华夏公益教科书: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 和其他编辑器中很有用。
跟踪更改
[编辑源代码]鼓励贡献者 跟踪书籍的最新更改 以修复错误的版本、改进新内容、与其他贡献者讨论更改并保持工作一致性。在手动添加要跟踪的页面后,监视列表 功能对此也很有用。