華夏公益教科書:Ada 維基工程
| 這是一個 維基工程,一個協作區域和開放的編輯組,致力於改善華夏公益教科書對特定主題的覆蓋範圍。任何人都可以加入維基工程;如果您有興趣幫助,請參閱本頁面的資源,瞭解您可以做些什麼來提供幫助。 |

這裡是學習或回憶我們用於編寫 Ada 華夏公益教科書的所有約定的場所
提示:將此頁面保持開啟狀態以進行剪下/複製/貼上。
署名
[編輯原始碼]考慮在華夏公益教科書中 建立帳戶,這很容易且方便。您只需要提供使用者名稱和密碼。登入後,您的貢獻將被分配到一個名稱,而不是您的 IP 地址。它還有其他好處,請參閱維基百科的頁面 為什麼建立帳戶?。
演示原始碼
[編輯原始碼]與大多數其他 程式設計 系列的書籍不同,我們的目標不僅是提供程式碼片段,而且最重要的是提供完全可用的演示。
為了簡化演示程式的處理,一個名為 SourceForge 的專案名為 wikibook-ada 已註冊。
作為貢獻者,您可以利用 svn 儲存庫 來儲存您的原始碼。您還可以使用 viewscvs 從 Programming:Ada 到您的 原始碼 建立連結。您可以使用 Template:Ada/Sourceforge 來建立連結。
SourceForge 還允許我們提供 所有演示原始碼的下載。
最後但並非最不重要的一點是,SourceForge 為我們提供了 下載統計資料,因此我們可以瞭解我們的服務是否被接受。
標題
[編輯原始碼]所有頁面都應該有一個像這樣的標題
<noinclude>
{{Ada/Navigation}}
__TOC__
</noinclude>
以前有“Ada/Navigation 1”到“Ada/Navigation 3”(用於一到三級深度導航),但它們現在已經過時,因為書籍內部的導航由子頁面功能提供。
連結
[編輯原始碼]像 Ada 程式設計 這樣的線上文件依賴於“可點選”的文字 - 點選一下,您就可以獲得更多關於您感興趣內容的詳細資訊。所以一定要建立連結!
關鍵字等
[編輯原始碼]語言特性,如關鍵字、編譯指示等,應該這樣寫
Keywords: {{Ada/kw|abort}} or {{Ada/keyword|new}}
Operators: {{Ada/op|&}} or {{Ada/operator|+}}
{{Ada/op|1 = <=}} or {{Ada/op|1 = =}}
Delimiters: {{Ada/dl|:}} or {{Ada/delimiter|:}}
{{Ada/dl|1 = :=}} or {{Ada/dl|1 = =>}}
Types: '''[[Ada Programming/Types/range|range]]'''
Attributes: X'{{Ada/at|Access}} or X'{{Ada/attribute|Access}}
Pragmas: {{Ada/pragma|No_Return}} or {{Ada/pragma name|No_Return}}
Packages: {{Ada/package|Standard}}
Child Packages: {{Ada/package|Ada|Text_IO}}, {{Ada/package|Ada|Containers|Vectors}}, ...
Restrictions: {{Ada/restriction|No_Obsolescent_Features}} or {{Ada/restriction name|No_Obsolescent_Features}}
Comments: {{Ada/--|This is a comment}} or {{Ada/comment|This is a comment}}
Sourceforge link: {{Ada/Sourceforge|numeric_1.adb}}
然後它將顯示為
Keywords:abortornewOperators: & or + <= or = Delimiters: : or : := or => Types: range Attributes: X'Access or X'Access Pragmas:pragmaNo_Return or No_Return Packages: Standard Child Packages: Ada.Text_IO, Ada.Containers.Vectors, ... Restrictions:pragmaRestrictions (No_Obsolescent_Features) or No_Obsolescent_Features Comments: -- This is a comment or -- This is a comment
Sourceforge 連結
ASnip,由 使用者:GorgeUbuasha 編寫,可以幫助將模板新增到 Ada 原始碼中。
- 運算子說明
- 所有運算子要麼是關鍵字,要麼是分隔符。因此,所有運算子頁面都只是對相應關鍵字或分隔符的重定向。但是,在演示原始碼中,運算子、關鍵字和特殊字元的呈現方式不同。
另請參閱
[編輯原始碼]任何頁面都應該有一個“另請參閱”部分,它應該看起來像這樣
== See also ==
=== Wikibook ===
* [[Ada Programming]]
* [[Ada Programming/Operators]]
=== Ada 95 Reference Manual ===
* {{Ada/95/RM2|4|4|Expressions}}
* {{Ada/95/RM3|4|5|5|Multiplying Operators}}
* {{Ada/95/RMA3|A|4|3|Fixed-Length String Handling}}
* {{Ada/95/RMA3|A|4|4|Bounded-Length String Handling}}
* {{Ada/95/RMA3|A|4|5|Unbounded-Length String Handling}}
* {{Ada/95/RMA3|A|18|2|The Package Containers.Vectors}}
=== Ada 2005 Reference Manual ===
* {{Ada/2005/RM|4|4|title=Expressions}}
* {{Ada/2005/RM|4|5|5|title=Multiplying Operators}}
* {{Ada/2005/RMA|A|4|3|title=Fixed-Length String Handling}}
* {{Ada/2005/RMA|A|4|4|title=Bounded-Length String Handling}}
* {{Ada/2005/RMA|A|4|5|title=Unbounded-Length String Handling}}
* {{Ada/2005/RMA|A|18|2|title=The Package Containers.Vectors}}
=== Ada Quality and Style Guide ===
* {{Ada/SG1|1|Introduction}}
* {{Ada/SG2|4|1|High-Level Structure}}
* {{Ada/SG3|5|5|5|Short Circuit Forms of the Logical Operators}}
* {{Ada/SG3|10|5|2|Short-Circuit Operators}}
{{BookCat}}
- 華夏公益教科書
- 始終新增指向 Ada Programming 主頁的連結。
- Ada 語言參考手冊
- 在 RM 的索引 中查詢相關頁面。
- Ada 質量和風格指南
- 在 本指南的索引 中查詢相關指南。
- 分類
- 所有頁面都應該使用模板 {{BookCat}} 新增到“Ada Programming”分類中。
規範化的章節
[編輯原始碼]如果我們遵循一些約定,例如標準的章節數量,華夏公益教科書的可讀性會得到提高。
屬性和編譯指示
[編輯原始碼]用於描述每個 編譯指示 和 屬性 的頁面的部分(例如,有關pragma Atomic 和 'Bit_Order 屬性的頁面。)
- 語法 摘要
- 描述,指定編譯指示/屬性類別(表示、配置...)以及它是否已過時或與實現相關。
- 說明性的示例
- 可移植性:
- Ada 版本之間
- 編譯器之間
- 平臺之間(體系結構、作業系統、嵌入式/自託管、單處理器/多處理器...)
- 其他語言中用於介面的等效功能(對於編譯指示)
編碼規則
[編輯原始碼]關於如何使用靜態分析工具檢查良好程式設計實踐(例如,沒有 goto 語句)的描述
華夏公益教科書的模板列表
[編輯原始碼]這是 Ada 程式設計 華夏公益教科書中可用的模板列表。另請參閱 Category:Book:Ada Programming/Templates。
語言元素
[編輯原始碼]Ada 程式碼
[編輯原始碼]| 模板 | 簡短 | 備註 |
|---|---|---|
| {{Ada/keyword}} | {{Ada/kw}} | 用法
|
| {{Ada/operator}} | {{Ada/op}} |
正常用法 當分隔符包含等號('=')時,需要顯式命名引數('1=') |
| {{Ada/delimiter}} | {{Ada/dl}} |
正常用法
當分隔符包含等號('=')時,需要顯式命名引數('1=') 由於技術限制,管道'|'不允許作為模板引數,因此必須使用ASCII數字
|
| {{Ada/attribute}} | {{Ada/at}} |
用法
預設情況下不包含引號('),但可以可選地新增
|
| {{Ada/package}} | {{Ada/pk}} | 對於子包,模板接受多個引數 |
| {{Ada/aspect}} | {{Ada/as}} |
用法
或Template:Ada/aspect name,它不插入=>分隔符
|
| {{Ada/pragma}} |
用法 或Template:Ada/pragma name,它不插入
| |
| {{Ada/restriction}} |
用法
或Template:Ada/restriction name,它不插入"
| |
| {{Ada/comment}} | {{Ada/--}} | 用法
|
| {{Ada/string}} | {{Ada/"}} | 用法
|
| {{Ada/character}} | {{Ada/ch}} | 用法
|
| {{Ada/integer}} | {{Ada/in}} |
正常用法
也可以指定基數(可選地指定指數)
|
| {{Ada/real}} | {{Ada/re}} |
正常用法
也可以指定基數(可選地指定指數)
|
完整示例
{{Ada/restriction|No_Obsolescent_Features}};
{{Ada/kw|with}} {{Ada/package|Ada|Text_IO}};
{{Ada/kw|with}} {{Ada/package|Ada|Characters|Latin_1}};
{{Ada/kw|procedure}} Print_Constants {{Ada/kw|is}}
{{Ada/kw|package}} T_IO {{Ada/kw|renames}} {{Ada/package|Ada|Text_IO}};
{{Ada/kw|package}} Latin_1 {{Ada/kw|renames}} {{Ada/package|Ada|Characters|Latin_1}};
{{Ada/kw|begin}}
T_IO.Put_Line (Item {{Ada/dl|1==>}} {{Ada/"|Hello!}}); {{Ada/--|String literal}}
T_IO.Put_Line (Latin_1.Not_Sign {{Ada/op|&}} {{Ada/ch|P}}); {{Ada/--|Character literal (¬P)}}
T_IO.Put_Line (Integer{{Ada/at|'|Image}} ({{Ada/in|42}})); {{Ada/--|Integer literal}}
T_IO.Put_Line (Float{{Ada/at|'|Image}} ({{Ada/re|3.1416}})); {{Ada/--|Real literal}}
{{Ada/kw|end}} Print_Constants;
gives
pragmaRestrictions (No_Obsolescent_Features);withAda.Text_IO;withAda.Characters.Latin_1;procedurePrint_ConstantsispackageT_IOrenamesAda.Text_IO;packageLatin_1renamesAda.Characters.Latin_1;beginT_IO.Put_Line (Item => "Hello!"); -- String literal T_IO.Put_Line (Latin_1.Not_Sign & 'P'); -- Character literal (¬P) T_IO.Put_Line (Integer'Image (42)); -- Integer literal T_IO.Put_Line (Float'Image (3.1416)); -- Real literalendPrint_Constants;
C 程式碼
[編輯原始碼]| 模板 | 簡短 | 備註 |
|---|---|---|
| {{Ada/C/keyword}} | {{Ada/C/kw}} | 用法
|
| {{Ada/C/comment}} | {{Ada/C/*}} | 用法
|
| {{Ada/C/preprocessor}} | {{Ada/C/pre}} | 用法
|
標籤
[編輯原始碼]- 語言的新特性
- 語言的已棄用特性
- 與先前語言版本引入的不相容性
- 維護
- {{Ada/stub}}(用於未完成的頁面)
外部連結
[編輯原始碼]Ada 參考手冊
[編輯原始碼]除非必要,否則首選選項是連結到最新的官方版本。
- 預設版本(當前為 Ada 2012)
- Ada 2022
- Ada 2012
- Ada 2005
- Ada 95
- Ada 83
Ada 質量和風格指南
[編輯原始碼]- 最新版本(目前適用於 Ada 95)
- Ada 95
- Ada 83
Ada 理據
[編輯原始碼]- Ada 2005
- Ada 95
- Ada 83
注意:沒有指向理據最新版本的模板重定向,因為每種語言版本都有自己的理據,與其他版本完全不同。
Ada 問題
[編輯原始碼]原始碼倉庫
[編輯原始碼]| 名稱 | 備註 |
|---|---|
| {{Ada/Sourceforge}} |
指向 wikibook-ada 專案 中原始碼的外部連結 |
| {{Sourceforge 連結}} |
指向 Sourceforge 庫專案的首頁、原始碼和下載頁面的外部連結。 單個引數是專案名稱。(可能適用於其他書籍) |
| {{GitHub 連結}} |
指向 GitHub 庫專案的首頁、原始碼和下載頁面的外部連結。 第一個引數是使用者或組織名稱,第二個引數是儲存庫名稱。(可能適用於其他書籍) |
標準庫單元中的外部連結
[編輯原始碼]| 名稱 | 備註 |
|---|---|
| {{Ada/標準庫}} | 搜尋有關標準單元的示例和帖子。搜尋詞來自頁面名稱。 |
| {{Ada/GNAT}} | 連結到 GNAT 中標準庫單元的實現。 單個引數是檔名。 |
| {{Ada/drake}} | 連結到 drake 中標準庫單元的實現。 單個引數是檔名。 |
參考文獻
[編輯原始碼]Ada 特定
[編輯原始碼]| 名稱 | 備註 |
|---|---|
| {{Ada/83/引用 RM}} {{Ada/95/引用 RM}} {{Ada/2005/引用 RM}} {{Ada/2012/引用 RM}} |
除標題和第一個(節號)外,所有引數都是可選的 {{Ada/2005/Cite RM|(section)|(subsection)|(sub-subsection)
| title = (required)
| par =
| id =
| quote =
}}
例如 *{{Ada/2005/Cite RM|13|5|3
| title = Bit Ordering
| par = 2
| id = I4589
| quote = A bit ordering is a method of interpreting the meaning of the storage place attributes.
}}
gives
|
| {{Ada/83/引用 AARM}} {{Ada/95/引用 AARM}} {{Ada/2005/引用 AARM}} {{Ada/2012/引用 AARM}} |
除標題和第一個(節號)外,所有引數都是可選的 {{Ada/2005/Cite AARM|(section)|(subsection)|(sub-subsection)
| title = (required)
| par =
| id =
| quote =
}}
例如 *{{Ada/2005/Cite AARM|13|5|3
| title = Bit Ordering
| par = 2
| id = I5077
| quote = A bit ordering is a method of interpreting the meaning of the storage place attributes.
}}
gives
請注意,它連結到與上面相同的段落,但在 AARM 中的“id”引數與 LRM 中的值不同。 |
| {{Ada/95/引用 AI}} {{Ada/2005/引用 AI}} |
除標題和id外,所有引數都是可選的 {{Ada/95/Cite AI
| title = (required)
| id = (required)
| alt =
| class =
| date =
| rev =
| quote =
| accessdate = 2024-10-24
}}
例如,以下例項 *{{Ada/95/Cite AI
| title = Limited With Clauses
| id = 217
| alt = 6
| class = Amendment
| date = 2005-10-11
| rev = 1.21
| quote =
| accessdate = 2009-01-01
}}
gives
|
| {{Ada/引用 ACM}} |
引用ACM SIGAda Ada Letters。 除標題外,所有引數都是可選的 {{Ada/Cite ACM
| author =
| title = (required)
| year =
| month =
| volume =
| issue =
| pages =
| doi =
| url =
| quote =
| accessdate = 2024-10-24
}}
以下例項 *{{Ada/Cite ACM
| author = Alan Burns, Brian Dobbing, Tullio Vardanega
| title = Guide for the use of the Ada Ravenscar Profile in high integrity systems
| year = 2004
| month = June
| volume = XXIV
| issue = 2
| pages = 1–74
| doi = 10.1145/997119.997120
| url = http://www.sigada.org/ada_letters/jun2004/ravenscar_article.pdf
}}
gives
|
| {{Ada/引用 AUJ}} |
引用Ada 使用者期刊,由 Ada-Europe 出版。標籤: “國際 Ada 社群的期刊” 除標題外,所有引數都是可選的 {{Ada/Cite AUJ
| author =
| title = (required)
| year =
| month =
| volume =
| number =
| pages =
| url =
| quote =
| accessdate = 2024-10-24
}}
以下例項 *{{Ada/Cite AUJ
| author = Alan Marriott, Urs Maurer
| title = Ada Bug Finder
| year = 2005
| month = September
| volume = 26
| number = 3
| pages = 214–219
| url = http://www.ada-europe.org/archive/auj/auj-26-3.pdf
}}
gives
|
| {{Ada/引用 cla}} |
引用“comp.lang.ada”新聞組 {{Ada/Cite cla
| author =
| title = (required)
| date =
| url =
| quote =
| accessdate = 2024-10-24
}}
以下例項 *{{Ada/Cite cla
| author = Robert Dewar
| title = pragma Shared (was Ada is almost ....)
| date = 1996-02-17
| url = http://groups.google.es/group/comp.lang.ada/msg/eeee3a7515837ea2
| quote = pragma Atomic is QUITE different from pragma Volatile.
| accessdate = 2008-05-28
}}
gives
|
| {{Ada/83/引用 R}} {{Ada/95/引用 R}} {{Ada/2005/Cite R}} {{Ada/2012/Cite R}} |
|
| {{Ada/83/Cite SG}} {{Ada/95/Cite SG}} |
|
| {{Ada/Ref RM}} {{Ada/83/Ref RM}} {{Ada/95/Ref RM}} {{Ada/2005/Ref RM}} {{Ada/2012/Ref RM}} |
所有引數都是可選的,除了第一個(節號) {{Ada/Ref RM|(section)|(subsection)|(sub-subsection)|par=|id=}}
例如
|
| {{Ada/Ref AARM}} {{Ada/83/Ref AARM}} {{Ada/95/Ref AARM}} {{Ada/2005/Ref AARM}} {{Ada/2012/Ref AARM}} |
所有引數都是可選的,除了第一個(節號) {{Ada/Ref AARM|(section)|(subsection)|(sub-subsection)|par=|id=}}
例如
|
一般
[編輯原始碼]| 名稱 | 備註 |
|---|---|
| {{cite book}} |
除標題外,所有引數都是可選的 {{cite book
| author =
| editor =
| others =
| title = (required)
| url =
| chapter =
| chapterurl =
| pages =
| origdate =
| origyear =
| origmonth =
| format =
| edition =
| date =
| year =
| month =
| publisher =
| location =
| language =
| id =
| doi =
| quote =
| accessdate = 2024-10-24
}}
例如,例項化 *{{cite book
| author = [[w:John Barnes (computer scientist)|]]
| title = High-Integrity Software: The SPARK Approach to Safety and Security
| date = 2003-03-25
| publisher = Addison-Wesley
| isbn = 0-321-13616-0
| url = http://dl.acm.org/citation.cfm?id=829555
| accessdate = 2008-06-06
| quote = Representation clauses are now strictly known as aspect clauses
| pages = 212
}}
gives
|
| {{cite journal}} |
(注意:使用模板 {{Ada/Cite ACM}} 或 {{Ada/Cite AUJ}} 以上引用 'ACM SIGAda Ada Letters' 或 'Ada User Journal') 除標題外,所有引數都是可選的 {{cite journal
| author =
| title = (required)
| journal =
| pages =
| volume =
| issue =
| date =
| year =
| month =
| publisher =
| issn =
| url =
| quote =
| accessdate = 2024-10-24
}}
例如,例項化 *{{cite journal
| author = Daniel Ramirez
| title = Robotics with Ada 95
| journal = Circuit Cellar
| issue = 212
| year = 2008
| month = March
| url = http://www.circuitcellar.com/archives/viewable/212-Ramirez/
| accessdate = 2009-01-01
}}
gives
|
| {{cite conference}} |
所有引數都是可選的,除了 title 和 booktitle {{cite conference
| author =
| title = (required)
| conference =
|conferenceurl =
| booktitle = (required)
| date =
| year =
| month =
| editor =
| others =
| volume =
| edition =
| publisher =
| location =
| pages =
| doi =
| id =
| oclc =
| url =
| format =
| quote =
| accessdate = 2024-10-24
}}
例如,例項化 *{{cite conference
| author = Gaetan Allaert, Dirk Craeynest, Philippe Waroquiers
| title = European air traffic flow management: porting a large application to GNU/linux
| conference = SIGAda'03
|conferenceurl = http://www.sigada.org/conf/sigada2003/SIGAda2003-CDROM/SIGAda2003-Proceedings/00-proceedings.html
| booktitle = Proceedings of the 2003 annual ACM SIGAda international conference on Ada
| year = 2003
| pages = 29–37
| doi = 10.1145/958420.958426
| isbn = 1-58113-476-2
| url = http://www.sigada.org/conf/sigada2003/SIGAda2003-CDROM/SIGAda2003-Proceedings/p29-allaert.pdf
| accessdate = 2009-01-02
}}
gives
|
| {{cite paper}} |
除標題外,所有引數都是可選的 {{cite paper
| author =
| title = (required)
| version =
| pages =
| publisher =
| date =
| url =
| format =
| id =
| quote =
| accessdate = 2024-10-24
}}
例如,例項化 *{{cite paper
| author = Stephen F. Zeigler
| title = Comparing Development Costs of C and Ada
| date = 1995-03-30
| url = http://archive.adaic.com/intro/ada-vs-c/cada_art.html
| quote = Our data indicates that Ada has saved us millions of development dollars.
| accessdate = 2009-01-02
}}
gives
|
| {{cite web}} |
所有引數都是可選的,除了 url、title 和 accessdate {{cite web
| url = (required)
| title = (required)
| accessdate = 2024-10-24
| author =
| date =
| year =
| month =
| format =
| work =
| publisher =
| pages =
| language =
| archiveurl =
|archivedate =
| quote =
}}
例如,例項化 *{{cite web
| url = http://archive.adaic.com/news/pressrelease/Ada05-final.html
| title = Ada 2005 Becomes Official ISO Standard
| accessdate = 2009-01-02
| date = 2007-03-09
| publisher = Ada Resource Association
| archiveurl = http://web.archive.org/web/20071208105755/http://www.adaic.com/news/Ada05-final.html
|archivedate = 2007-12-08
}}
gives
|
| {{cite newsgroup}} |
(注意:使用模板 {{Ada/Cite cla}} 以上引用 'comp.lang.ada') 除標題外,所有引數都是可選的 {{cite newsgroup
| author =
| title = (required)
| date =
| newsgroup =
| url =
| quote =
| accessdate = 2024-10-24
}}
例如,例項化 *{{cite newsgroup
| author = Pat Rogers
| title = Ada as a real time language
| date = 2002-08-28
| newsgroup = comp.realtime
| url = http://groups.google.es/group/comp.realtime/msg/355d3c9ab43fcb77
| quote = you don't need an RTOS to write real-time systems with Ada
| accessdate = 2009-01-05
}}
gives
|
導航
[編輯原始碼]
軟體
[編輯原始碼]Emacs 使用者在編輯包含在維基頁面中的 Ada 程式時,可能會發現此 Emacs Lisp 檔案 有用。ada-to-wiki.el
一個類似的純 Ada 程式,ASnip,將使用標準輸入/輸出執行相同的操作。在 vi 和其他編輯器中很有用。
跟蹤更改
[編輯原始碼]鼓勵貢獻者 跟蹤書籍的最新更改 以修復錯誤的版本、改進新內容、與其他貢獻者討論更改並保持工作一致性。在手動新增要跟蹤的頁面後,監視列表 功能對此也很有用。