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