華夏公益教科書:Ada 維基計劃
| 這是一個 維基計劃,一個協作區域和開放的編輯者群體,致力於改進維基百科對特定主題的覆蓋範圍。任何人都可以加入維基計劃;如果您有興趣幫忙,請檢視本頁面的資源,以獲取有關您可以做些什麼來幫助的想法和建議。 |

這裡是我們編寫 Ada 華夏公益教科書時使用的所有慣例的學習或記憶場所。
提示:請保持此頁面開啟以進行剪下/複製/貼上。
署名
[編輯原始碼]考慮在維基百科中 建立一個帳戶,這既簡單又方便。您只需要提供使用者名稱和密碼。登入後,您的貢獻將分配給一個名稱,而不是您的 IP 地址。它還有其他好處,請參閱維基百科頁面 為什麼要建立帳戶?。
演示原始碼
[編輯原始碼]與 程式設計 系列中的大多數其他書籍不同,我們的目標不僅提供程式碼片段,而且最重要的是提供完全可執行的演示。
為了簡化演示程式的處理,一個名為 SourceForge 的關聯專案,稱為 wikibook-ada 已註冊。
作為貢獻者,您可以利用 svn 儲存庫 來儲存您的原始碼。您還可以使用 viewscvs 從程式設計:Ada 到您的 原始碼 建立連結。您可以使用 模板: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 程式設計主頁面 的連結。
- Ada 參考手冊
- 在 RM 索引 中查詢相關頁面。
- Ada 質量和風格指南
- 在 此指南索引 中查詢相關指南。
- 分類
- 所有頁面都應使用模板 {{BookCat}} 新增到“Ada 程式設計”分類中)。
標準化章節
[編輯原始碼]如果我們遵循一些約定,例如標準的章節數量,可以提高華夏公益教科書的可讀性。
屬性和編譯指示
[編輯原始碼]描述每個 編譯指示 和 屬性 的頁面部分(例如,有關pragma Atomic 和“Bit_Order”屬性的頁面)。
- 語法 摘要
- 描述,指定了編譯指示/屬性類別(表示、配置等)以及它是否已過時或與實現相關。
- 說明性示例
- 可移植性:
- Ada 版本之間
- 編譯器之間
- 平臺之間(體系結構、作業系統、嵌入式/自託管、單處理器/多處理器等)
- 其他語言中用於介面的等效功能(針對編譯指示)
編碼規則
[編輯原始碼]關於如何使用靜態分析工具檢查良好程式設計實踐(例如,沒有goto語句)的說明
維基百科模板列表
[編輯原始碼]這是Ada 程式設計維基百科中可用的模板列表。另見分類:書籍:Ada 程式設計/模板。
語言元素
[編輯原始碼]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;
顯示為
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/存根}} (用於未完成的頁面)
外部連結
[編輯來源]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.
}}
顯示為
|
| {{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.
}}
顯示為
請注意,它連結到與上面相同的段落,但 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
}}
顯示為
|
| {{Ada/Cite ACM}} |
引用自 ACM SIGAda Ada 通訊. 所有引數都是可選的,除了 標題 {{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
}}
顯示為
|
| {{Ada/Cite 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
}}
顯示為
|
| {{Ada/Cite 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
}}
顯示為
|
| {{Ada/83/Cite R}} {{Ada/95/Cite 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
}}
顯示為
|
| {{cite journal}} |
(注意:以上使用模板 {{Ada/Cite ACM}} 或 {{Ada/Cite AUJ}} 用於引用 'ACM SIGAda Ada 通訊' 或 'Ada 使用者雜誌') 所有引數都是可選的,除了 標題 {{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
}}
顯示為
|
| {{cite conference}} |
所有引數都是可選的,除了 標題 和 書名 {{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
}}
顯示為
|
| {{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
}}
顯示為
|
| {{cite web}} |
所有引數都是可選的,除了 url、標題 和 訪問日期 {{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
}}
顯示為
|
| {{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
}}
顯示為
|
導航
[編輯原始碼]
軟體
[編輯原始碼]Emacs 使用者可能會發現此 Emacs Lisp 檔案 在編輯 Ada 程式以包含在維基頁面時很有用。 ada-to-wiki.el
一個類似的純 Ada 程式,ASnip,將使用標準輸入/輸出執行相同的操作。 在 vi 和其他編輯器中很有用。
跟蹤更改
[編輯原始碼]鼓勵貢獻者 跟蹤書籍的最近更改 為了修復不良版本,改進新內容,與其他貢獻者討論更改並保持工作一致性。 手動新增要跟蹤的頁面後,監視列表 功能也很有用。