| 1 |
with -- ARM_Output, -- redudant with spec |
| 2 |
-- ARM_Input, |
| 3 |
ARM_File, |
| 4 |
ARM_String, |
| 5 |
-- ARM_Contents, |
| 6 |
-- ARM_Database, |
| 7 |
ARM_Syntax, |
| 8 |
ARM_Index, |
| 9 |
-- ARM_Subindex, |
| 10 |
ARM_Format.Data, |
| 11 |
Ada.Text_IO, |
| 12 |
Ada.Characters.Handling, |
| 13 |
Ada.Strings.Fixed; |
| 14 |
package body ARM_Format is |
| 15 |
|
| 16 |
-- |
| 17 |
-- Ada reference manual formatter (ARM_Form). |
| 18 |
-- |
| 19 |
-- This package contains the routines to parse the input files, and |
| 20 |
-- determine what to output. |
| 21 |
-- |
| 22 |
-- --------------------------------------- |
| 23 |
-- Copyright 2000, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, |
| 24 |
-- 2010, 2011, 2012, 2013, 2016, 2017, 2019, 2020 |
| 25 |
-- AXE Consultants. All rights reserved. |
| 26 |
-- P.O. Box 1512, Madison WI 53701 |
| 27 |
-- E-Mail: [email protected] |
| 28 |
-- |
| 29 |
-- ARM_Form is free software: you can redistribute it and/or modify |
| 30 |
-- it under the terms of the GNU General Public License version 3 |
| 31 |
-- as published by the Free Software Foundation. |
| 32 |
-- |
| 33 |
-- AXE CONSULTANTS MAKES THIS TOOL AND SOURCE CODE AVAILABLE ON AN "AS IS" |
| 34 |
-- BASIS AND MAKES NO WARRANTY, EXPRESS OR IMPLIED, AS TO THE ACCURACY, |
| 35 |
-- CAPABILITY, EFFICIENCY, MERCHANTABILITY, OR FUNCTIONING OF THIS TOOL. |
| 36 |
-- IN NO EVENT WILL AXE CONSULTANTS BE LIABLE FOR ANY GENERAL, |
| 37 |
-- CONSEQUENTIAL, INDIRECT, INCIDENTAL, EXEMPLARY, OR SPECIAL DAMAGES, |
| 38 |
-- EVEN IF AXE CONSULTANTS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH |
| 39 |
-- DAMAGES. |
| 40 |
-- |
| 41 |
-- A copy of the GNU General Public License is available in the file |
| 42 |
-- gpl-3-0.txt in the standard distribution of the ARM_Form tool. |
| 43 |
-- Otherwise, see <http://www.gnu.org/licenses/>. |
| 44 |
-- |
| 45 |
-- If the GPLv3 license is not satisfactory for your needs, a commercial |
| 46 |
-- use license is available for this tool. Contact Randy at AXE Consultants |
| 47 |
-- for more information. |
| 48 |
-- |
| 49 |
-- --------------------------------------- |
| 50 |
-- |
| 51 |
-- Edit History: |
| 52 |
-- |
| 53 |
-- 4/14/00 - RLB - Created base package. |
| 54 |
-- 4/17/00 - RLB - Starting implementation of commands. |
| 55 |
-- 4/19/00 - RLB - Implemented contents package and section references. |
| 56 |
-- 4/21/00 - RLB - Added hard_space and line_break output routines. |
| 57 |
-- 4/24/00 - RLB - Added Change_Kind and Display_Index_Entries. |
| 58 |
-- - RLB - Added Change and ChgRef. |
| 59 |
-- 4/26/00 - RLB - Added paragraph commands and formats. |
| 60 |
-- 4/29/00 - RLB - Loose ends: "Part", fixes for the example format, |
| 61 |
-- "DescribeCode" and "Itemize". |
| 62 |
-- 5/10/00 - RLB - Added missing "MetricsName" and "MetricsTitle". |
| 63 |
-- Added additional paragraph format kinds. |
| 64 |
-- 5/11/00 - RLB - Implemented numbers on enumerated paragraphs. |
| 65 |
-- 5/12/00 - RLB - Added NoPrefix. |
| 66 |
-- - RLB - Added attribute commands. |
| 67 |
-- 5/13/00 - RLB - Added various character macros. |
| 68 |
-- 5/15/00 - RLB - Split input from parsing/formatting. |
| 69 |
-- 5/16/00 - RLB - Added database objects and Destroy. |
| 70 |
-- - RLB - Implemented pragma commands. |
| 71 |
-- 5/17/00 - RLB - Implemented syntax commands. |
| 72 |
-- 5/19/00 - RLB - Added hinge analysis. |
| 73 |
-- 5/23/00 - RLB - Added column commands. |
| 74 |
-- - RLB - Added tab commands. |
| 75 |
-- 5/24/00 - RLB - Implemented subscript/superscript commands. |
| 76 |
-- 5/25/00 - RLB - Added more formatting commands and styles. |
| 77 |
-- 5/26/00 - RLB - Removed hinge analysis, other junk. |
| 78 |
-- 5/28/00 - RLB - Implemented index operations. |
| 79 |
-- 6/ 2/00 - RLB - Implemented @|. |
| 80 |
-- - RLB - Added AdaDefn and AdaSubDefn commands, and unit saving. |
| 81 |
-- 8/ 2/00 - RLB - Implemented @! (as @| doesn't work); implemented |
| 82 |
-- lquote, etc. |
| 83 |
-- 8/ 4/00 - RLB - Added additional styles. |
| 84 |
-- 8/ 8/00 - RLB - Added Attribute_Leading. |
| 85 |
-- 8/11/00 - RLB - Fixed glossary report. |
| 86 |
-- - RLB - Added Hanging_in_Bulleted low-level style. |
| 87 |
-- 8/15/00 - RLB - Replaced "LangDefType" with "AdaTypeDefn" (much smaller). |
| 88 |
-- 8/16/00 - RLB - Added double nesting support for InnerItemize. |
| 89 |
-- - RLB - Added "noparanum" command; removed no paranum formats. |
| 90 |
-- 8/17/00 - RLB - Changed Leading flag to Space_After, added Trailing command. |
| 91 |
-- - RLB - Added Nested_Enumerated styles. |
| 92 |
-- 8/18/00 - RLB - Fixed a variety of errors in the AARM paragraph numbering. |
| 93 |
-- - RLB - Fixed Display_Index_Entry so it would work right when |
| 94 |
-- given in an insertion or deletion. |
| 95 |
-- 8/21/00 - RLB - Fixed so send and later references in a ChgReg command |
| 96 |
-- don't accidentally include all preceding ones. |
| 97 |
-- 8/22/00 - RLB - Added Labeled_Revised_Clause and |
| 98 |
-- Labeled_Revised_Subclause commands. |
| 99 |
-- 8/23/00 - RLB - Fixed Syntax_Rules to allow @Chg commands in the |
| 100 |
-- LHS. |
| 101 |
-- - RLB - Fixed error in display of Defn2 index entries. |
| 102 |
-- 8/28/00 - RLB - Added implementation-defined changes command. |
| 103 |
-- 8/30/00 - RLB - Adjusted code in index entries to match old AARM. |
| 104 |
-- - RLB - Made the deleted paragraph text appear in all new |
| 105 |
-- versions. |
| 106 |
-- - RLB - Added AddedSubheading. |
| 107 |
-- 8/31/00 - RLB - Added the New_Changes change kind. |
| 108 |
-- - RLB - Added RM_New_Page command. |
| 109 |
-- 9/ 1/00 - RLB - Fixed bugs that prevented "deleted paragraph" messages |
| 110 |
-- from appearing and caused junk headers to appear for |
| 111 |
-- sections not appearing in the old document. |
| 112 |
-- 9/ 8/00 - RLB - Added information about the language-defined |
| 113 |
-- subprograms to the index introduction. |
| 114 |
-- 9/26/00 - RLB - Added Syntax_Display format. |
| 115 |
-- 9/28/00 - RLB - Added RefSecbyNum command. |
| 116 |
-- 10/30/00 - RLB - Added ISOOnly paragraph grouping. |
| 117 |
-- - RLB - Fixed inserted paragraph numbers to support more than 9. |
| 118 |
-- 6/17/02 - RLB - Added Ada95 changes sections. |
| 119 |
-- 7/18/02 - RLB - Moved document type here. |
| 120 |
-- - RLB - Added ARef= parameter to ChgRef. |
| 121 |
-- - RLB - Added Changes_Only and versioning for individual changes. |
| 122 |
-- 4/10/03 - RLB - Fixed Index_Pragma to include "<name> pragma". |
| 123 |
-- 4/11/03 - RLB - Fixed order of removal for formatting for Heading and |
| 124 |
-- Subheading, so that the nesting is right (it needs to |
| 125 |
-- be exactly like the order of application). |
| 126 |
-- - RLB - Fixed code so that parameter version numbers aren't |
| 127 |
-- displayed higher than the item we're generating. |
| 128 |
-- - RLB - Fixed ChgRef and others not to generate anything if |
| 129 |
-- we're not generating the version that the reference is |
| 130 |
-- for. Similarly, avoid changing the paragraph kind if |
| 131 |
-- we're not going to use the changes. |
| 132 |
-- - RLB - Fixed font for changing non-terminals in @Syn. |
| 133 |
-- 9/09/04 - RLB - Removed unused junk noticed by Stephen Leake. |
| 134 |
-- 9/10/04 - RLB - Added Version to many Text_Format commands. |
| 135 |
-- - RLB - Fixed Get_NT to allow the Version parameter in @Chg. |
| 136 |
-- - RLB - Updated to allow @Chg nesting. |
| 137 |
-- 9/14/04 - RLB - Moved Change_Version_Type to ARM_Contents. |
| 138 |
-- - RLB - Added version number parameters to revised header |
| 139 |
-- commands; added additional header commands. |
| 140 |
-- - RLB - Added code so that section references in Annex L and M |
| 141 |
-- are links. |
| 142 |
-- 9/15/04 - RLB - Fixed incorrect name for LabeledAddedSubClause command. |
| 143 |
-- - RLB - Fixed to lift limit on number of inserted paragraphs. |
| 144 |
-- 10/28/04 - RLB - Replaced double single quotes with double quotes, |
| 145 |
-- as directed by the ARG. |
| 146 |
-- - RLB - Added "AddedNormal" ChgRef kind. |
| 147 |
-- 10/29/04 - RLB - Added code so that section references in Annex K are |
| 148 |
-- links. |
| 149 |
-- 11/02/04 - RLB - Added "DeletedAdded" ChgRef kind. |
| 150 |
-- 11/03/04 - RLB - Fixed @Chg nesting glitch. |
| 151 |
-- - RLB - Added InnerInnerItemize == Nested_X2_Bulleted. |
| 152 |
-- 11/04/04 - RLB - Fixed a problem that reset the insertion number for |
| 153 |
-- paragraphs have a normal AARM para. was encountered. |
| 154 |
-- 11/15/04 - RLB - Added Indented_Nested_Bulleted style. |
| 155 |
-- 12/06/04 - RLB - Added "RevisedAdded" ChgRef kind. |
| 156 |
-- - RLB - Delayed generation of references until the start of |
| 157 |
-- the paragraph. That avoids "pinning" problems, |
| 158 |
-- especially for multiple changes in a single paragraph. |
| 159 |
-- - RLB - Allow multiple Ref and ARef params in ChgAttribute. |
| 160 |
-- - RLB - Added ChgAdded and ChgDeleted for entire paragraph |
| 161 |
-- operations. |
| 162 |
-- 12/11/04 - RLB - Fixed brackets in Added_Pragma_Syntax to allow {} in |
| 163 |
-- text. |
| 164 |
-- - RLB - Implemented attribute adding in Change_Attribute. |
| 165 |
-- 12/13/04 - RLB - Fixed problems in the new change commands. |
| 166 |
-- 12/15/04 - RLB - Fixed so a change is not left open across |
| 167 |
-- an End_Hang_Item. |
| 168 |
-- - RLB - Fixed glitches with deleted paragraphs. |
| 169 |
-- 1/19/05 - RLB - Added LabeledRevisedInformativeAnnex. |
| 170 |
-- - RLB - Fixed AARM paragraph numbers to allow more than 52, |
| 171 |
-- and to put out an error message if we exceed the maximum. |
| 172 |
-- - RLB - Added ChgDocReq and ChgImplAdvice. |
| 173 |
-- - RLB - Added AddedDocReqList and AddedImplAdviceList. |
| 174 |
-- 1/20/05 - RLB - Added debugging for stack overflows. |
| 175 |
-- 1/24/05 - RLB - Added Inner_Indented. |
| 176 |
-- 1/25/05 - RLB - Added AddedSyn and DeleteSyn commands. |
| 177 |
-- 2/ 1/05 - RLB - Added Turkish Is. |
| 178 |
-- 2/ 2/05 - RLB - Corrected so normal AARM numbers don't reset the |
| 179 |
-- RM insertion number. |
| 180 |
-- 3/15/05 - RLB - Corrected spelling. |
| 181 |
-- 5/27/05 - RLB - Added @Unicode command for examples. |
| 182 |
-- 8/ 9/05 - RLB - Changed the capitalization of some AARM note headers. |
| 183 |
-- 10/17/05 - RLB - Added Glossary change commands. |
| 184 |
-- 10/28/05 - RLB - Made index changes for Ada 200Y. |
| 185 |
-- - RLB - Added added Annex headers. |
| 186 |
-- - RLB - Added Language-Defined Entity indexes. |
| 187 |
-- 10/31/05 - RLB - Fixed the "this paragraph was deleted" code to |
| 188 |
-- not change the version; it's not necessarily |
| 189 |
-- initialized, and the Kind isn't set anyway if the |
| 190 |
-- version is too new. |
| 191 |
-- 1/ 5/06 - RLB - Corrected a comment. |
| 192 |
-- 1/12/06 - RLB - Replaced "Document" with a number of new more general |
| 193 |
-- properties. |
| 194 |
-- 1/13/06 - RLB - Added various link commands. |
| 195 |
-- 1/16/06 - RLB - Added missing initializations. |
| 196 |
-- - RLB - Added IndexList command. |
| 197 |
-- - RLB - Added Unnumbered_Section counter to ensure that |
| 198 |
-- such sections are uniquely named. |
| 199 |
-- 1/18/06 - RLB - Added "Example_Font". |
| 200 |
-- - RLB - Redid formatting command nesting so that closing |
| 201 |
-- restores to the initial state for the command, not the |
| 202 |
-- default state. |
| 203 |
-- 1/20/06 - RLB - Added AILink command. |
| 204 |
-- 2/ 8/06 - RLB - Added command checking at the end of each table row. |
| 205 |
-- 2/ 9/06 - RLB - Implemented enhanced Table command. |
| 206 |
-- 2/10/06 - RLB - Split scanning phase into a separate file. |
| 207 |
-- - RLB - Added additional features to the Table command. |
| 208 |
-- - RLB - Added the picture command. |
| 209 |
-- 2/15/06 - RLB - Added code to prevent the generation of note numbers |
| 210 |
-- for deleted notes in final documents. |
| 211 |
-- 2/17/06 - RLB - Tracked down issues with @ChgImplDef. |
| 212 |
-- - RLB - Added code so that index entries don't display soft |
| 213 |
-- hyphens. |
| 214 |
-- - RLB - Fixed glossary entries to not display insertions if |
| 215 |
-- the mode would prevent that. |
| 216 |
-- 6/22/06 - RLB - Added non-terminal linking. |
| 217 |
-- 8/ 4/06 - RLB - Added checking for bad unit indexing. |
| 218 |
-- 9/22/06 - RLB - Added "Use_ISO_2004_Note_Format", and implemented that |
| 219 |
-- format. |
| 220 |
-- - RLB - Revised to use Clause_Number_Type, and to support |
| 221 |
-- Subsubclauses. |
| 222 |
-- 9/25/06 - RLB - Added "Use_ISO_2004_Contents_Format". |
| 223 |
-- - RLB - Added LastColWidth to @Table. |
| 224 |
-- - RLB - Fixed Enumerated in Notes styles. |
| 225 |
-- 9/29/06 - RLB - Added Element_Ref and Child_Ref for ASIS. |
| 226 |
-- 10/04/06 - RLB - Added and implemented "Use_ISO_2004_List_Format". |
| 227 |
-- - RLB - Added "InnerEnumerate" text block. |
| 228 |
-- 10/13/06 - RLB - Added the @ntf command to handle cases where the |
| 229 |
-- text needs to look like a non-terminal but it isn't |
| 230 |
-- a real non-terminal. |
| 231 |
-- - RLB - Added code to handle simple embedded commands in |
| 232 |
-- @nt{} to generate links. |
| 233 |
-- 10/16/06 - RLB - Added code to register deleted non-terminals (so |
| 234 |
-- that they can be linked). |
| 235 |
-- 10/18/06 - RLB - Fixed so that deleted glossary items still get |
| 236 |
-- deleted paragraph numbers. |
| 237 |
-- 2/ 5/07 - RLB - Added a paragraph kind, and changed ones that |
| 238 |
-- appear in ASIS. Also renamed "Wide" to "Wide_Above" |
| 239 |
-- so the purpose is more obvious. |
| 240 |
-- 2/ 9/07 - RLB - Moved AI interpretation and folding to the HTML |
| 241 |
-- driver, as constructing the link should be its |
| 242 |
-- responsibility. This also allows new kinds of AI here. |
| 243 |
-- 2/13/07 - RLB - Redid output formating to use an explict indent; |
| 244 |
-- added ChildExample. |
| 245 |
-- 2/16/07 - RLB - Added Indent format. |
| 246 |
-- 2/19/07 - RLB - Added Title format. |
| 247 |
-- 12/18/07 - RLB - Initialized Version in some cases. |
| 248 |
-- - RLB - Added check for open formatting commands |
| 249 |
-- in Check_End_Paragraph. |
| 250 |
-- - RLB - Added Plain_Annex and associated commands. |
| 251 |
-- 12/19/07 - RLB - Added color commands. |
| 252 |
-- 6/12/08 - RLB - Corrected handling of the ChgGlossary command. |
| 253 |
-- 3/ 4/09 - RLB - Added code to suppress bullets and the like when |
| 254 |
-- displaying a deleted paragraph in New-Only mode |
| 255 |
-- and no paragraph numbers are shown. |
| 256 |
-- 5/ 6/09 - RLB - Added Labeled_Deleted_xxx. |
| 257 |
-- 5/15/09 - RLB - Fixed missing code for note numbers in revised/added clauses. |
| 258 |
-- 4/23/10 - RLB - Added Ada 2005 clause headers for Ada 2012 edition. |
| 259 |
-- 8/ 8/11 - RLB - Split various data items to reduce the size of this |
| 260 |
-- package. |
| 261 |
-- 10/18/11 - RLB - Changed to GPLv3 license. |
| 262 |
-- 10/19/11 - RLB - Added AspectDefn command. |
| 263 |
-- 10/20/11 - RLB - Added optional initial version parameter to ChgImplDef |
| 264 |
-- and related commands. |
| 265 |
-- - RLB - Added DeletedPragmaSyn command. |
| 266 |
-- 10/25/11 - RLB - Added optional initial version parameter to |
| 267 |
-- LabeledRevisedSomething commands. |
| 268 |
-- 10/26/11 - RLB - Added versioned break commands. |
| 269 |
-- 3/19/12 - RLB - Fixed bug that occurred only when paragraph numbers |
| 270 |
-- are off (ISO versions). Fixed sort order of attributes. |
| 271 |
-- 3/27/12 - RLB - Added more versioned break commands. |
| 272 |
-- 4/ 3/12 - RLB - Removed dead variables. |
| 273 |
-- 8/31/12 - RLB - Put glossary components into a subrecord to prevent |
| 274 |
-- inappropriate usage. |
| 275 |
-- 10/18/12 - RLB - Put impdef components into a subrecord to prevent |
| 276 |
-- inappropriate usage. Fixed problem caused by putting |
| 277 |
-- newer items than the generated version into the DB. |
| 278 |
-- - RLB - Added four specific indent hanging formats and |
| 279 |
-- "small" format. |
| 280 |
-- 11/ 5/12 - RLB - Added stupidly missing compare for "small" format. |
| 281 |
-- 11/26/12 - RLB - Added subdivision names. |
| 282 |
-- 7/ 5/13 - RLB - Added a nasty hack so added aspect names are marked |
| 283 |
-- as such in Show_Changes versions. |
| 284 |
-- 12/13/13 - RLB - Added InitialVersion parameter to ChgAttrib. |
| 285 |
-- 3/17/16 - RLB - Removed Changes_Only, added Base_Change_Version. |
| 286 |
-- 7/21/17 - RLB - Changed maximum prefix length. |
| 287 |
-- 1/27/19 - RLB - Added code to deal with attribute references where |
| 288 |
-- the paragraph is closed. |
| 289 |
-- 2/15/19 - RLB - Improved handling os deleted attribute references. |
| 290 |
-- 4/23/19 - RLB - Added Line info to the nesting stack so we can find |
| 291 |
-- out where the problems lie. |
| 292 |
-- 6/ 5/19 - RLB - Displayed Line info to the nesting stack for begin/end |
| 293 |
-- mismatches. |
| 294 |
-- 5/ 7/20 - RLB - Minor cleanups in tracing code. |
| 295 |
|
| 296 |
type Command_Kind_Type is (Normal, Begin_Word, Parameter); |
| 297 |
|
| 298 |
use ARM_Format.Data; -- use all type ARM_Format.Data.Command_Type; |
| 299 |
-- Make the enumeration literals visible. |
| 300 |
|
| 301 |
Free_References : Reference_Ptr := null; -- Unused reference objects. |
| 302 |
-- We don't expect there ever to be many of these, so we don't try |
| 303 |
-- to deallocate them. |
| 304 |
Allocated_Reference_Count : Natural := 0; |
| 305 |
|
| 306 |
function Allocate_Reference return Reference_Ptr is |
| 307 |
-- Allocate a reference object from either the free list, or allocate |
| 308 |
-- it. |
| 309 |
T : Reference_Ptr; |
| 310 |
begin |
| 311 |
if Free_References /= null then |
| 312 |
T := Free_References; |
| 313 |
Free_References := Free_References.Next; |
| 314 |
return T; |
| 315 |
else |
| 316 |
Allocated_Reference_Count := Allocated_Reference_Count + 1; |
| 317 |
if Allocated_Reference_Count > 20 then -- Never more than this on one paragraph. |
| 318 |
Ada.Text_IO.Put_Line (" ** Too many references allocated"); |
| 319 |
end if; |
| 320 |
return new Reference; |
| 321 |
end if; |
| 322 |
end Allocate_Reference; |
| 323 |
|
| 324 |
|
| 325 |
procedure Free_Reference (Reference : in out Reference_Ptr) is |
| 326 |
-- Put a reference object on the free list; setting Reference to null. |
| 327 |
begin |
| 328 |
Reference.Next := Free_References; |
| 329 |
Free_References := Reference; |
| 330 |
Reference.Ref_Len := 0; -- Clear length, so we don't reuse by accident. |
| 331 |
Reference := null; |
| 332 |
end Free_Reference; |
| 333 |
|
| 334 |
|
| 335 |
procedure Create (Format_Object : in out Format_Type; |
| 336 |
Changes : in ARM_Format.Change_Kind; |
| 337 |
Change_Version : in ARM_Contents.Change_Version_Type; |
| 338 |
Base_Change_Version : in ARM_Contents.Change_Version_Type; |
| 339 |
Display_Index_Entries : in Boolean; |
| 340 |
Include_Annotations : in Boolean; |
| 341 |
Include_ISO : in Boolean; |
| 342 |
Link_Non_Terminals : in Boolean; |
| 343 |
Number_Paragraphs : in Boolean; |
| 344 |
Examples_Font : in ARM_Output.Font_Family_Type; |
| 345 |
Use_ISO_2004_Note_Format : in Boolean; |
| 346 |
Use_ISO_2004_Contents_Format : in Boolean; |
| 347 |
Use_ISO_2004_List_Format : in Boolean; |
| 348 |
Top_Level_Subdivision_Name : in ARM_Output.Top_Level_Subdivision_Name_Kind) is |
| 349 |
-- Initialize an input object. Changes, Change_Version, |
| 350 |
-- and Base_Change_Version determine |
| 351 |
-- which changes should be displayed. If Display_Index_Entries is True, |
| 352 |
-- index entries will be printed in the document; otherwise, they |
| 353 |
-- will not generate any visible text (although they might generate |
| 354 |
-- a link anchor). If Include_Annotations is True, annotations (AARM |
| 355 |
-- text) will be included in the output; otherwise it will not be. |
| 356 |
-- If Include_ISO is True, ISOOnly text will be included in the output |
| 357 |
-- (and NotISO text will not); otherwise the reverse is true. |
| 358 |
-- If Link_Non_Terminals is True, links will be generated for |
| 359 |
-- each Non_Terminal, linking it to its definition. |
| 360 |
-- If Number_Paragraphs is true, paragraphs will be numbered (per |
| 361 |
-- subclause); otherwise they will not be. |
| 362 |
-- Example_Font specifies the font that examples will be set in. |
| 363 |
-- If Use_ISO_2004_Note_Format is true, that format will be used; |
| 364 |
-- else the Ada95 standard's format will be used for notes. |
| 365 |
-- If Use_ISO_2004_Contents_Format is true, that format will be used; |
| 366 |
-- else the Ada95 standard's format will be used for the table of contents. |
| 367 |
-- If Use_ISO_2004_List_Format is true, then lists will be lettered; |
| 368 |
-- else the Ada95 standard's numbering format will be used for |
| 369 |
-- enumerated lists. |
| 370 |
-- The top-level (and other) subdivision names are as specified |
| 371 |
-- in Top_Level_Subdivision_Name. |
| 372 |
begin |
| 373 |
Format_Object.Changes := Changes; |
| 374 |
Format_Object.Change_Version := Change_Version; |
| 375 |
Format_Object.Base_Change_Version := Base_Change_Version; |
| 376 |
Format_Object.Display_Index_Entries := Display_Index_Entries; |
| 377 |
Format_Object.Include_Annotations := Include_Annotations; |
| 378 |
Format_Object.Include_ISO := Include_ISO; |
| 379 |
Format_Object.Link_Non_Terminals := Link_Non_Terminals; |
| 380 |
Format_Object.Number_Paragraphs := Number_Paragraphs; |
| 381 |
Format_Object.Examples_Font := Examples_Font; |
| 382 |
Format_Object.Use_ISO_2004_Note_Format := Use_ISO_2004_Note_Format; |
| 383 |
Format_Object.Use_ISO_2004_Contents_Format := Use_ISO_2004_Contents_Format; |
| 384 |
Format_Object.Use_ISO_2004_List_Format := Use_ISO_2004_List_Format; |
| 385 |
Format_Object.Top_Level_Subdivision_Name := Top_Level_Subdivision_Name; |
| 386 |
|
| 387 |
Format_Object.Clause_Number := (Section => 0, Clause => 0, |
| 388 |
Subclause => 0, Subsubclause => 0); |
| 389 |
Format_Object.Unnumbered_Section := 0; |
| 390 |
Format_Object.Next_Note := 1; |
| 391 |
Format_Object.Next_Paragraph := 1; |
| 392 |
Format_Object.Next_Insert_Para := 1; |
| 393 |
Format_Object.Next_AARM_Sub := 'a'; |
| 394 |
Format_Object.Next_AARM_Insert_Para := 1; |
| 395 |
Format_Object.Next_Enumerated_Num := 1; |
| 396 |
Format_Object.Enumerated_Level := 0; |
| 397 |
Format_Object.Last_Paragraph_Subhead_Type := Plain; |
| 398 |
Format_Object.Next_Paragraph_Subhead_Type := Plain; |
| 399 |
Format_Object.Next_Paragraph_Format_Type := Plain; |
| 400 |
ARM_Database.Create (Format_Object.Aspect_DB); |
| 401 |
ARM_Database.Create (Format_Object.Attr_DB); |
| 402 |
ARM_Database.Create (Format_Object.Pragma_DB); |
| 403 |
ARM_Database.Create (Format_Object.Glossary_DB); |
| 404 |
ARM_Database.Create (Format_Object.Impdef_DB); |
| 405 |
ARM_Database.Create (Format_Object.Impladv_DB); |
| 406 |
ARM_Database.Create (Format_Object.Docreq_DB); |
| 407 |
ARM_Syntax.Create; |
| 408 |
ARM_Index.Create; |
| 409 |
ARM_Subindex.Create (Format_Object.Package_Index); |
| 410 |
ARM_Subindex.Create (Format_Object.Type_Index); |
| 411 |
ARM_Subindex.Create (Format_Object.Subprogram_Index); |
| 412 |
ARM_Subindex.Create (Format_Object.Exception_Index); |
| 413 |
ARM_Subindex.Create (Format_Object.Object_Index); |
| 414 |
end Create; |
| 415 |
|
| 416 |
|
| 417 |
procedure Destroy (Format_Object : in out Format_Type) is |
| 418 |
-- Destroy a format object, releasing any resources. |
| 419 |
begin |
| 420 |
ARM_Database.Destroy (Format_Object.Aspect_DB); |
| 421 |
ARM_Database.Destroy (Format_Object.Attr_DB); |
| 422 |
ARM_Database.Destroy (Format_Object.Pragma_DB); |
| 423 |
ARM_Database.Destroy (Format_Object.Glossary_DB); |
| 424 |
ARM_Database.Destroy (Format_Object.Impdef_DB); |
| 425 |
ARM_Database.Destroy (Format_Object.Impladv_DB); |
| 426 |
ARM_Database.Destroy (Format_Object.Docreq_DB); |
| 427 |
ARM_Syntax.Destroy; |
| 428 |
ARM_Index.Destroy; |
| 429 |
ARM_Subindex.Destroy (Format_Object.Package_Index); |
| 430 |
ARM_Subindex.Destroy (Format_Object.Type_Index); |
| 431 |
ARM_Subindex.Destroy (Format_Object.Subprogram_Index); |
| 432 |
ARM_Subindex.Destroy (Format_Object.Exception_Index); |
| 433 |
ARM_Subindex.Destroy (Format_Object.Object_Index); |
| 434 |
end Destroy; |
| 435 |
|
| 436 |
|
| 437 |
function Clause_String (Format_Object : in Format_Type) return String is |
| 438 |
-- Returns a string for a clause reference. |
| 439 |
use type ARM_Contents.Section_Number_Type; |
| 440 |
begin |
| 441 |
if Format_Object.Clause_Number.Subsubclause /= 0 then |
| 442 |
return ARM_Contents.Make_Clause_Number ( |
| 443 |
ARM_Contents.SubSubClause, |
| 444 |
Format_Object.Clause_Number); |
| 445 |
elsif Format_Object.Clause_Number.Subclause /= 0 then |
| 446 |
return ARM_Contents.Make_Clause_Number ( |
| 447 |
ARM_Contents.SubClause, |
| 448 |
Format_Object.Clause_Number); |
| 449 |
elsif Format_Object.Clause_Number.Clause /= 0 then |
| 450 |
return ARM_Contents.Make_Clause_Number ( |
| 451 |
ARM_Contents.Clause, |
| 452 |
Format_Object.Clause_Number); |
| 453 |
else |
| 454 |
if Format_Object.Clause_Number.Section = 0 then |
| 455 |
return ARM_Contents.Make_Clause_Number ( |
| 456 |
ARM_Contents.Unnumbered_Section, |
| 457 |
Format_Object.Clause_Number); |
| 458 |
elsif Format_Object.Clause_Number.Section < ARM_Contents.ANNEX_START then |
| 459 |
return ARM_Contents.Make_Clause_Number ( |
| 460 |
ARM_Contents.Section, |
| 461 |
Format_Object.Clause_Number); |
| 462 |
else |
| 463 |
return ARM_Contents.Make_Clause_Number ( |
| 464 |
ARM_Contents.Plain_Annex, -- Same for all kinds of annex. |
| 465 |
Format_Object.Clause_Number); |
| 466 |
end if; |
| 467 |
end if; |
| 468 |
end Clause_String; |
| 469 |
|
| 470 |
|
| 471 |
Do_Not_Display_Text : constant ARM_Output.Change_Type := ARM_Output.Both; |
| 472 |
-- Special meaning for Calc_Change_Disposition, below. |
| 473 |
procedure Calc_Change_Disposition |
| 474 |
(Format_Object : in Format_Type; |
| 475 |
Version : in ARM_Contents.Change_Version_Type; |
| 476 |
Operation : in ARM_Output.Change_Type; |
| 477 |
Text_Kind : out ARM_Output.Change_Type) is |
| 478 |
-- Determine the appropriate disposition for text. |
| 479 |
-- The text is to be inserted if Operation is Insertion; |
| 480 |
-- and deleted if Operation is Deletion. |
| 481 |
-- The appropriate Change_Type to use is returned in Text_Kind. |
| 482 |
-- If Text_Kind is None, the text should be displayed normally. |
| 483 |
-- If Text_Kind is Insertion, the text should be displayed as inserted. |
| 484 |
-- If Text_Kind is Deletion, the text should be displayed as deletion. |
| 485 |
-- If Text_Kind is Do_Not_Display_Text (same as Both), the |
| 486 |
-- text should not be shown at all. |
| 487 |
-- Program_Error is raised if Operation is None or Both. |
| 488 |
-- This routine assumes that we are not nested |
| 489 |
-- in some other change item. |
| 490 |
use type ARM_Output.Change_Type; |
| 491 |
begin |
| 492 |
if Operation = ARM_Output.None or else |
| 493 |
Operation = ARM_Output.Both then |
| 494 |
raise Program_Error; |
| 495 |
end if; |
| 496 |
-- We can't check for nesting, because in some cases it happens |
| 497 |
-- harmlessly (i.e. Added_Pragma_Syn). |
| 498 |
|
| 499 |
case Format_Object.Changes is |
| 500 |
when ARM_Format.Old_Only => |
| 501 |
-- Display only the original version ('0'). |
| 502 |
if Operation = ARM_Output.Insertion then |
| 503 |
if Version > '0' then |
| 504 |
Text_Kind := Do_Not_Display_Text; -- Newer than original. |
| 505 |
else |
| 506 |
Text_Kind := ARM_Output.None; -- Display normally. |
| 507 |
end if; |
| 508 |
else -- Deletion |
| 509 |
if Version > '0' then |
| 510 |
Text_Kind := ARM_Output.None; -- Display normally, not deleted in original code. |
| 511 |
else |
| 512 |
Text_Kind := Do_Not_Display_Text; -- Deleted in original. |
| 513 |
end if; |
| 514 |
end if; |
| 515 |
when ARM_Format.New_Only => |
| 516 |
-- Display only the version |
| 517 |
-- Format_Object.Change_Version, no insertions or deletions. |
| 518 |
if Operation = ARM_Output.Insertion then |
| 519 |
if Version > Format_Object.Change_Version then |
| 520 |
-- Change version newer than we're displaying; |
| 521 |
-- ignore the item. |
| 522 |
Text_Kind := Do_Not_Display_Text; |
| 523 |
else |
| 524 |
-- Display the change normally. |
| 525 |
Text_Kind := ARM_Output.None; |
| 526 |
end if; |
| 527 |
else -- Deletion |
| 528 |
if Version > Format_Object.Change_Version then |
| 529 |
-- Change version newer than we're displaying; |
| 530 |
-- leave the item in and display normally. |
| 531 |
Text_Kind := ARM_Output.None; |
| 532 |
else |
| 533 |
-- Delete the item. |
| 534 |
Text_Kind := Do_Not_Display_Text; |
| 535 |
end if; |
| 536 |
end if; |
| 537 |
when ARM_Format.Show_Changes | |
| 538 |
ARM_Format.New_Changes => |
| 539 |
-- Display only the the changes for versions |
| 540 |
-- Format_Object.Base_Change_Version .. |
| 541 |
-- Format_Object.Change_Version, older changes |
| 542 |
-- are applied and newer changes are ignored. |
| 543 |
-- (New_Changes shows deletions as a single |
| 544 |
-- character for older versions of Word, but otherwise |
| 545 |
-- is the same.) |
| 546 |
if Operation = ARM_Output.Insertion then |
| 547 |
if Version > Format_Object.Change_Version then |
| 548 |
-- Change version is newer than we're displaying; |
| 549 |
-- ignore the item. |
| 550 |
Text_Kind := Do_Not_Display_Text; |
| 551 |
elsif Version < Format_Object.Base_Change_Version then |
| 552 |
-- Change version is older than we're displaying; |
| 553 |
-- display the change normally. |
| 554 |
Text_Kind := ARM_Output.None; |
| 555 |
else |
| 556 |
-- This version or older, display the change |
| 557 |
-- as an insertion. |
| 558 |
Text_Kind := ARM_Output.Insertion; |
| 559 |
end if; |
| 560 |
else -- Deletion. |
| 561 |
if Version > Format_Object.Change_Version then |
| 562 |
-- Change version is newer than we're displaying; |
| 563 |
-- the item isn't deleted yet, display the change |
| 564 |
-- normally. |
| 565 |
Text_Kind := ARM_Output.None; |
| 566 |
elsif Version < Format_Object.Base_Change_Version then |
| 567 |
-- Change version is older than we're displaying; |
| 568 |
-- the item is deleted, so ignore the item. |
| 569 |
Text_Kind := Do_Not_Display_Text; |
| 570 |
else |
| 571 |
-- The correct version, display the change |
| 572 |
-- as a deletion. |
| 573 |
Text_Kind := ARM_Output.Deletion; |
| 574 |
end if; |
| 575 |
end if; |
| 576 |
end case; |
| 577 |
end Calc_Change_Disposition; |
| 578 |
|
| 579 |
|
| 580 |
function Get_Current_Item (Format_Object : in Format_Type; |
| 581 |
Input_Object : in ARM_Input.Input_Type'Class; |
| 582 |
Item : in String) return String is |
| 583 |
-- Return the "current" item from Item. This is Item itself, |
| 584 |
-- unless Item includes an @Chg. |
| 585 |
New_Pos : Natural; |
| 586 |
Close_Ch : Character; |
| 587 |
Open_Cnt : Natural; |
| 588 |
My_Item : constant String (1 .. Item'Length) := Item; |
| 589 |
-- Just to slide the bounds. |
| 590 |
Version : ARM_Contents.Change_Version_Type := '0'; |
| 591 |
Disposition : ARM_Output.Change_Type; |
| 592 |
use type ARM_Output.Change_Type; |
| 593 |
begin |
| 594 |
if My_Item'Length < 11 or else |
| 595 |
My_Item (1) /= '@' or else |
| 596 |
Ada.Characters.Handling.To_Lower (My_Item (2 .. 4)) /= "chg" then |
| 597 |
-- No @Chg command here. |
| 598 |
return My_Item; |
| 599 |
end if; |
| 600 |
if Ada.Characters.Handling.To_Lower (My_Item (6 .. 9)) = "new=" then |
| 601 |
-- No version parameter: |
| 602 |
New_Pos := 6; |
| 603 |
Version := '1'; |
| 604 |
elsif My_Item'Length > 22 and then |
| 605 |
Ada.Characters.Handling.To_Lower (My_Item (6 .. 14)) = "version=[" and then |
| 606 |
Ada.Characters.Handling.To_Lower (My_Item (16 .. 21)) = "],new=" then |
| 607 |
New_Pos := 18; |
| 608 |
Version := My_Item(15); |
| 609 |
else |
| 610 |
Ada.Text_IO.Put_Line ("%% Oops, can't find either Version or New in item chg command, line " & ARM_Input.Line_String (Input_Object)); |
| 611 |
return My_Item; |
| 612 |
end if; |
| 613 |
|
| 614 |
Calc_Change_Disposition (Format_Object => Format_Object, |
| 615 |
Version => Version, |
| 616 |
Operation => ARM_Output.Insertion, |
| 617 |
Text_Kind => Disposition); |
| 618 |
|
| 619 |
if Disposition = Do_Not_Display_Text then |
| 620 |
-- Find the end of the "New" parameter, and return the "Old" |
| 621 |
-- parameter. |
| 622 |
Close_Ch := ARM_Input.Get_Close_Char ( |
| 623 |
My_Item(New_Pos+4)); |
| 624 |
Open_Cnt := 1; |
| 625 |
for I in New_Pos+5 .. My_Item'Last loop |
| 626 |
if My_Item(I) = My_Item(New_Pos+4) then |
| 627 |
Open_Cnt := Open_Cnt + 1; |
| 628 |
elsif My_Item(I) = Close_Ch then |
| 629 |
if Open_Cnt <= 1 then |
| 630 |
-- OK, the end of the "New" parameter is at 'I'. |
| 631 |
if My_Item'Last < I+7 or else |
| 632 |
My_Item (I+1) /= ',' or else |
| 633 |
Ada.Characters.Handling.To_Lower (My_Item (I+2 .. I+4)) /= "old" or else |
| 634 |
My_Item (I+5) /= '=' then |
| 635 |
exit; -- Heck if I know. |
| 636 |
end if; |
| 637 |
Close_Ch := ARM_Input.Get_Close_Char ( |
| 638 |
My_Item(I+6)); |
| 639 |
Open_Cnt := 1; |
| 640 |
for J in I+7 .. My_Item'Last loop |
| 641 |
if My_Item(J) = My_Item(I+6) then |
| 642 |
Open_Cnt := Open_Cnt + 1; |
| 643 |
elsif My_Item(J) = Close_Ch then |
| 644 |
if Open_Cnt <= 1 then |
| 645 |
return My_Item (I + 7 .. J - 1); |
| 646 |
else |
| 647 |
Open_Cnt := Open_Cnt - 1; |
| 648 |
end if; |
| 649 |
-- else continue looking. |
| 650 |
end if; |
| 651 |
end loop; |
| 652 |
Ada.Text_IO.Put_Line ("%% Oops, can't find end of item chg old command, line " & ARM_Input.Line_String (Input_Object)); |
| 653 |
return My_Item (I + 7 .. My_Item'Last); |
| 654 |
else |
| 655 |
Open_Cnt := Open_Cnt - 1; |
| 656 |
end if; |
| 657 |
-- else continue looking. |
| 658 |
end if; |
| 659 |
end loop; |
| 660 |
Ada.Text_IO.Put_Line ("%% Oops, can't find end of item chg new command, line " & ARM_Input.Line_String (Input_Object)); |
| 661 |
return My_Item (New_Pos+5 .. My_Item'Length); |
| 662 |
else -- Some new format, use the new name. |
| 663 |
-- Find the end of the "New" parameter, and |
| 664 |
-- return it. |
| 665 |
Close_Ch := ARM_Input.Get_Close_Char (My_Item(New_Pos+4)); |
| 666 |
Open_Cnt := 1; |
| 667 |
for I in New_Pos+5 .. My_Item'Last loop |
| 668 |
if My_Item(I) = My_Item(New_Pos+4) then |
| 669 |
Open_Cnt := Open_Cnt + 1; |
| 670 |
elsif My_Item(I) = Close_Ch then |
| 671 |
if Open_Cnt <= 1 then |
| 672 |
return My_Item (New_Pos+5 .. I - 1); |
| 673 |
else |
| 674 |
Open_Cnt := Open_Cnt - 1; |
| 675 |
end if; |
| 676 |
-- else continue looking. |
| 677 |
end if; |
| 678 |
end loop; |
| 679 |
-- Weird if we get here, can't find end of parameter. |
| 680 |
Ada.Text_IO.Put_Line ("%% Oops, can't find end of NT chg new command, line " & ARM_Input.Line_String (Input_Object)); |
| 681 |
return My_Item (New_Pos+5 .. My_Item'Last); |
| 682 |
end if; |
| 683 |
end Get_Current_Item; |
| 684 |
|
| 685 |
|
| 686 |
function Get_Old_Item (Format_Object : in Format_Type; |
| 687 |
Input_Object : in ARM_Input.Input_Type'Class; |
| 688 |
Item : in String) return String is |
| 689 |
-- Return the "old" item from Item, or nothing if there is no |
| 690 |
-- old item. This is nothing unless Item includes an @Chg, |
| 691 |
-- *and* the new item in the @Chg is displayed. |
| 692 |
New_Pos : Natural; |
| 693 |
Close_Ch : Character; |
| 694 |
Open_Cnt : Natural; |
| 695 |
My_Item : constant String (1 .. Item'Length) := Item; |
| 696 |
-- Just to slide the bounds. |
| 697 |
Version : ARM_Contents.Change_Version_Type := '0'; |
| 698 |
Disposition : ARM_Output.Change_Type; |
| 699 |
use type ARM_Output.Change_Type; |
| 700 |
begin |
| 701 |
if My_Item'Length < 11 or else |
| 702 |
My_Item (1) /= '@' or else |
| 703 |
Ada.Characters.Handling.To_Lower (My_Item (2 .. 4)) /= "chg" then |
| 704 |
-- No @Chg command here. |
| 705 |
return ""; |
| 706 |
end if; |
| 707 |
if Ada.Characters.Handling.To_Lower (My_Item (6 .. 9)) = "new=" then |
| 708 |
-- No version parameter: |
| 709 |
New_Pos := 6; |
| 710 |
Version := '1'; |
| 711 |
elsif My_Item'Length > 22 and then |
| 712 |
Ada.Characters.Handling.To_Lower (My_Item (6 .. 14)) = "version=[" and then |
| 713 |
Ada.Characters.Handling.To_Lower (My_Item (16 .. 21)) = "],new=" then |
| 714 |
New_Pos := 18; |
| 715 |
Version := My_Item(15); |
| 716 |
else |
| 717 |
Ada.Text_IO.Put_Line ("%% Oops, can't find either Version or New in item chg command, line " & ARM_Input.Line_String (Input_Object)); |
| 718 |
return ""; |
| 719 |
end if; |
| 720 |
|
| 721 |
Calc_Change_Disposition (Format_Object => Format_Object, |
| 722 |
Version => Version, |
| 723 |
Operation => ARM_Output.Insertion, |
| 724 |
Text_Kind => Disposition); |
| 725 |
|
| 726 |
if Disposition /= Do_Not_Display_Text then |
| 727 |
-- Some new item was shown. |
| 728 |
-- Find the end of the "New" parameter, and return the "Old" |
| 729 |
-- parameter. |
| 730 |
Close_Ch := ARM_Input.Get_Close_Char ( |
| 731 |
My_Item(New_Pos+4)); |
| 732 |
Open_Cnt := 1; |
| 733 |
for I in New_Pos+5 .. My_Item'Last loop |
| 734 |
if My_Item(I) = My_Item(New_Pos+4) then |
| 735 |
Open_Cnt := Open_Cnt + 1; |
| 736 |
elsif My_Item(I) = Close_Ch then |
| 737 |
if Open_Cnt <= 1 then |
| 738 |
-- OK, the end of the "New" parameter is at 'I'. |
| 739 |
if My_Item'Last < I+7 or else |
| 740 |
My_Item (I+1) /= ',' or else |
| 741 |
Ada.Characters.Handling.To_Lower (My_Item (I+2 .. I+4)) /= "old" or else |
| 742 |
My_Item (I+5) /= '=' then |
| 743 |
exit; -- Heck if I know. |
| 744 |
end if; |
| 745 |
Close_Ch := ARM_Input.Get_Close_Char ( |
| 746 |
My_Item(I+6)); |
| 747 |
Open_Cnt := 1; |
| 748 |
for J in I+7 .. My_Item'Last loop |
| 749 |
if My_Item(J) = My_Item(I+6) then |
| 750 |
Open_Cnt := Open_Cnt + 1; |
| 751 |
elsif My_Item(J) = Close_Ch then |
| 752 |
if Open_Cnt <= 1 then |
| 753 |
return My_Item (I + 7 .. J - 1); |
| 754 |
else |
| 755 |
Open_Cnt := Open_Cnt - 1; |
| 756 |
end if; |
| 757 |
-- else continue looking. |
| 758 |
end if; |
| 759 |
end loop; |
| 760 |
Ada.Text_IO.Put_Line ("%% Oops, can't find end of item chg old command, line " & ARM_Input.Line_String (Input_Object)); |
| 761 |
return My_Item (I + 7 .. My_Item'Last); |
| 762 |
else |
| 763 |
Open_Cnt := Open_Cnt - 1; |
| 764 |
end if; |
| 765 |
-- else continue looking. |
| 766 |
end if; |
| 767 |
end loop; |
| 768 |
Ada.Text_IO.Put_Line ("%% Oops, can't find end of item chg new command, line " & ARM_Input.Line_String (Input_Object)); |
| 769 |
return ""; |
| 770 |
else -- The new item wasn't displayed, so we already have used the |
| 771 |
-- old item. |
| 772 |
return ""; |
| 773 |
end if; |
| 774 |
end Get_Old_Item; |
| 775 |
|
| 776 |
|
| 777 |
procedure Scan (Format_Object : in out Format_Type; |
| 778 |
File_Name : in String; |
| 779 |
Section_Number : in ARM_Contents.Section_Number_Type; |
| 780 |
Starts_New_Section : in Boolean) is separate; |
| 781 |
-- Scans the contents for File_Name, determining the table of contents |
| 782 |
-- for the section. The results are written to the contents package. |
| 783 |
-- Starts_New_Section is True if the file starts a new section. |
| 784 |
-- Section_Number is the number (or letter) of the section. |
| 785 |
-- See ARM_FRMS.ADB. |
| 786 |
|
| 787 |
|
| 788 |
procedure Write_Table_of_Contents ( |
| 789 |
Format_Object : in out Format_Type; |
| 790 |
Output_Object : in out ARM_Output.Output_Type'Class) is |
| 791 |
-- Writes the table of contents for the document. (It will have |
| 792 |
-- a section name of "TOC"). This should be done after all calls to |
| 793 |
-- Scan and before any calls to Process. |
| 794 |
|
| 795 |
In_Paragraph : Boolean := False; |
| 796 |
|
| 797 |
procedure Write_It (Title : in ARM_Contents.Title_Type; |
| 798 |
Level : in ARM_Contents.Level_Type; |
| 799 |
Clause_Number : in ARM_Contents.Clause_Number_Type; |
| 800 |
Version : in ARM_Contents.Change_Version_Type; |
| 801 |
Quit : out Boolean) is |
| 802 |
Clause_Text : constant String := |
| 803 |
ARM_Contents.Make_Clause_Number (Level, Clause_Number); |
| 804 |
Old_Title : ARM_Contents.Title_Type := |
| 805 |
ARM_Contents.Lookup_Old_Title ( |
| 806 |
Level, Clause_Number); |
| 807 |
begin |
| 808 |
Quit := False; |
| 809 |
if Old_Title = ARM_Contents.Title_Type'(others => ' ') and then |
| 810 |
(Format_Object.Change_Version < Version or else |
| 811 |
ARM_Format."=" (Format_Object.Changes, ARM_Format.Old_Only)) then |
| 812 |
-- This is an added item, and we're generating a version |
| 813 |
-- that does not include it. Skip it completely. |
| 814 |
return; |
| 815 |
end if; |
| 816 |
if ARM_Contents."=" (Level, ARM_Contents.Clause) then |
| 817 |
ARM_Output.Line_Break (Output_Object); |
| 818 |
ARM_Output.Ordinary_Text (Output_Object, " "); |
| 819 |
ARM_Output.Ordinary_Text (Output_Object, Clause_Text); |
| 820 |
ARM_Output.Hard_Space (Output_Object); |
| 821 |
elsif ARM_Contents."=" (Level, ARM_Contents.Subclause) then |
| 822 |
ARM_Output.Line_Break (Output_Object); |
| 823 |
ARM_Output.Ordinary_Text (Output_Object, " "); |
| 824 |
ARM_Output.Ordinary_Text (Output_Object, Clause_Text); |
| 825 |
ARM_Output.Hard_Space (Output_Object); |
| 826 |
elsif ARM_Contents."=" (Level, ARM_Contents.Subsubclause) then |
| 827 |
ARM_Output.Line_Break (Output_Object); |
| 828 |
ARM_Output.Ordinary_Text (Output_Object, " "); |
| 829 |
ARM_Output.Ordinary_Text (Output_Object, Clause_Text); |
| 830 |
ARM_Output.Hard_Space (Output_Object); |
| 831 |
elsif ARM_Contents."=" (Level, ARM_Contents.Unnumbered_Section) then |
| 832 |
if In_Paragraph then |
| 833 |
ARM_Output.End_Paragraph (Output_Object); |
| 834 |
end if; |
| 835 |
ARM_Output.Start_Paragraph (Output_Object, |
| 836 |
ARM_Output.Normal, |
| 837 |
Indent => 0, Number => "", |
| 838 |
Justification => ARM_Output.Left); |
| 839 |
In_Paragraph := True; |
| 840 |
else |
| 841 |
if In_Paragraph then |
| 842 |
ARM_Output.End_Paragraph (Output_Object); |
| 843 |
end if; |
| 844 |
ARM_Output.Start_Paragraph (Output_Object, |
| 845 |
ARM_Output.Normal, |
| 846 |
Indent => 0, Number => "", |
| 847 |
Justification => ARM_Output.Left); |
| 848 |
In_Paragraph := True; |
| 849 |
if ARM_Contents."=" (Level, ARM_Contents.Section) then |
| 850 |
ARM_Output.Ordinary_Text (Output_Object, Clause_Text); |
| 851 |
ARM_Output.Ordinary_Text (Output_Object, ". "); |
| 852 |
else -- Annexes. |
| 853 |
ARM_Output.Ordinary_Character (Output_Object, Clause_Text(Clause_Text'Last)); -- We don't want the "Annex" part. |
| 854 |
ARM_Output.Ordinary_Text (Output_Object, ". "); |
| 855 |
end if; |
| 856 |
end if; |
| 857 |
if Format_Object.Change_Version < Version then |
| 858 |
-- Ignore the change: |
| 859 |
ARM_Output.Clause_Reference (Output_Object, |
| 860 |
Ada.Strings.Fixed.Trim ( |
| 861 |
ARM_Contents.Lookup_Old_Title ( |
| 862 |
Level, Clause_Number), Ada.Strings.Right), |
| 863 |
Clause_Text); |
| 864 |
else |
| 865 |
case Format_Object.Changes is |
| 866 |
when ARM_Format.Old_Only => |
| 867 |
ARM_Output.Clause_Reference (Output_Object, |
| 868 |
Ada.Strings.Fixed.Trim ( |
| 869 |
ARM_Contents.Lookup_Old_Title ( |
| 870 |
Level, Clause_Number), Ada.Strings.Right), |
| 871 |
Clause_Text); |
| 872 |
when ARM_Format.New_Only | |
| 873 |
ARM_Format.Show_Changes | |
| 874 |
ARM_Format.New_Changes => |
| 875 |
ARM_Output.Clause_Reference (Output_Object, |
| 876 |
Ada.Strings.Fixed.Trim (Title, Ada.Strings.Right), |
| 877 |
Clause_Text); |
| 878 |
end case; |
| 879 |
end if; |
| 880 |
end Write_It; |
| 881 |
|
| 882 |
procedure Write_Contents is new ARM_Contents.For_Each (Write_It); |
| 883 |
|
| 884 |
begin |
| 885 |
-- Note: For .RTF version, the result of this call will not be used, |
| 886 |
-- preferring to let Word make the TOC (it can include page numbers). |
| 887 |
if Format_Object.Use_ISO_2004_Contents_Format then |
| 888 |
ARM_Output.Section (Output_Object, |
| 889 |
Section_Title => "Contents", |
| 890 |
Section_Name => "TOC"); |
| 891 |
|
| 892 |
ARM_Output.Clause_Header (Output_Object, |
| 893 |
Header_Text => "Contents", |
| 894 |
Level => ARM_Contents.Section, |
| 895 |
Clause_Number => "", |
| 896 |
Top_Level_Subdivision_Name => Format_Object.Top_Level_Subdivision_Name); |
| 897 |
else |
| 898 |
ARM_Output.Section (Output_Object, |
| 899 |
Section_Title => "Table of Contents", |
| 900 |
Section_Name => "TOC"); |
| 901 |
|
| 902 |
ARM_Output.Clause_Header (Output_Object, |
| 903 |
Header_Text => "Table of Contents", |
| 904 |
Level => ARM_Contents.Section, |
| 905 |
Clause_Number => "", |
| 906 |
Top_Level_Subdivision_Name => Format_Object.Top_Level_Subdivision_Name); |
| 907 |
end if; |
| 908 |
|
| 909 |
ARM_Output.TOC_Marker (Output_Object, For_Start => True); |
| 910 |
|
| 911 |
Write_Contents; |
| 912 |
|
| 913 |
if In_Paragraph then |
| 914 |
ARM_Output.End_Paragraph (Output_Object); |
| 915 |
end if; |
| 916 |
|
| 917 |
ARM_Output.TOC_Marker (Output_Object, For_Start => False); |
| 918 |
|
| 919 |
end Write_Table_of_Contents; |
| 920 |
|
| 921 |
|
| 922 |
procedure Make_References (List : in out Reference_Ptr; |
| 923 |
Format_Object : in out Format_Type; |
| 924 |
Output_Object : in out ARM_Output.Output_Type'Class) is |
| 925 |
-- Write the references to the Output_Object, using the format |
| 926 |
-- of Format_Object. |
| 927 |
-- Deallocate the references on List; List will be null afterwards. |
| 928 |
Temp : Reference_Ptr; |
| 929 |
Our_Text_Format : ARM_Output.Format_Type; |
| 930 |
begin |
| 931 |
-- We assume these are only stored here if we want to see them |
| 932 |
-- on *this* paragraph. Thus, we just output them if they exist |
| 933 |
-- here. |
| 934 |
Our_Text_Format := Format_Object.Text_Format; |
| 935 |
Our_Text_Format.Change := ARM_Output.None; -- No changes should be reflected in references. |
| 936 |
|
| 937 |
while List /= null loop |
| 938 |
-- Output a reference. These are *never* marked as |
| 939 |
-- inserted or deleted, so set the style properly. |
| 940 |
ARM_Output.Text_Format (Output_Object, |
| 941 |
Format => Our_Text_Format); |
| 942 |
ARM_Output.Ordinary_Character (Output_Object, '{'); |
| 943 |
Our_Text_Format.Italic := True; |
| 944 |
ARM_Output.Text_Format (Output_Object, |
| 945 |
Format => Our_Text_Format); |
| 946 |
if List.Is_DR_Ref then |
| 947 |
-- Output a DR reference. |
| 948 |
ARM_Output.DR_Reference (Output_Object, |
| 949 |
Text => List.Ref_Name(1..List.Ref_Len), |
| 950 |
DR_Number => List.Ref_Name(1..List.Ref_Len)); |
| 951 |
else |
| 952 |
-- Output an AI reference. |
| 953 |
ARM_Output.AI_Reference (Output_Object, |
| 954 |
Text => List.Ref_Name(1..List.Ref_Len), |
| 955 |
AI_Number => List.Ref_Name(1..List.Ref_Len)); |
| 956 |
end if; |
| 957 |
Our_Text_Format.Italic := Format_Object.Text_Format.Italic; |
| 958 |
ARM_Output.Text_Format (Output_Object, |
| 959 |
Format => Our_Text_Format); |
| 960 |
ARM_Output.Ordinary_Character (Output_Object, '}'); |
| 961 |
ARM_Output.Ordinary_Character (Output_Object, ' '); |
| 962 |
-- Reset to the current format. |
| 963 |
ARM_Output.Text_Format (Output_Object, |
| 964 |
Format => Format_Object.Text_Format); |
| 965 |
Format_Object.Last_Non_Space := False; |
| 966 |
|
| 967 |
Temp := List; |
| 968 |
List := List.Next; |
| 969 |
Free_Reference (Temp); |
| 970 |
end loop; |
| 971 |
end Make_References; |
| 972 |
|
| 973 |
|
| 974 |
procedure Dump_References (List : in out Reference_Ptr) is |
| 975 |
-- Destroy any references in List; List will be null afterwards. |
| 976 |
Temp : Reference_Ptr; |
| 977 |
begin |
| 978 |
while List /= null loop |
| 979 |
Temp := List; |
| 980 |
List := List.Next; |
| 981 |
Free_Reference (Temp); |
| 982 |
end loop; |
| 983 |
end Dump_References; |
| 984 |
|
| 985 |
|
| 986 |
type Items is record |
| 987 |
Kind : Command_Kind_Type; |
| 988 |
Name : ARM_Input.Command_Name_Type; |
| 989 |
Command : Data.Command_Type; |
| 990 |
Close_Char : Character; -- Ought to be }, ], >, or ). |
| 991 |
Open_Line : String(1..12); |
| 992 |
Text_Format : ARM_Output.Format_Type; |
| 993 |
-- Format at the start of the command. |
| 994 |
|
| 995 |
-- The next four are only used if Kind=Begin_Word, or for |
| 996 |
-- Command=Implementation_Defined, Glossary_Text_Param, or |
| 997 |
-- Syntax_Rule_RHS. |
| 998 |
Old_Last_Subhead_Paragraph : Paragraph_Type; |
| 999 |
Old_Next_Subhead_Paragraph : Paragraph_Type; |
| 1000 |
Old_Next_Paragraph_Format : Paragraph_Type; |
| 1001 |
Old_Tab_Stops : ARM_Output.Tab_Info; |
| 1002 |
Old_Next_Enum_Num : Positive; |
| 1003 |
Is_Formatting : Boolean; -- Only used if Kind=Begin_Word. |
| 1004 |
-- The command changes the PARAGRAPH format. |
| 1005 |
-- Otherwise, it should be ignored when |
| 1006 |
-- when determining the format. |
| 1007 |
-- The following is only used if Command = Change, Change_Added, |
| 1008 |
-- Change_Deleted, Added_Subheading, |
| 1009 |
-- Added_Pragma_Syntax, Deleted_Pragma_Syntax, |
| 1010 |
-- Added_Syntax, Deleted_Syntax, |
| 1011 |
-- New_Page_for_Version, New_Column_for_Version, |
| 1012 |
-- RM_New_Page_for_Version, Not_ISO_RM_New_Page_for_Version, and |
| 1013 |
-- ISO_Only_RM_New_Page_for_Version. |
| 1014 |
Change_Version : ARM_Contents.Change_Version_Type; |
| 1015 |
-- The following are only used if Command = Change, |
| 1016 |
-- Added_Pragma_Syntax, and Deleted_Pragma_Syntax. |
| 1017 |
Prev_Change_Version : ARM_Contents.Change_Version_Type; |
| 1018 |
-- The following are only used if Command = Change. |
| 1019 |
Was_Text : Boolean; -- Did the current subcommand have text? |
| 1020 |
Prev_Change : ARM_Output.Change_Type; |
| 1021 |
Prev_Added_Change_Version : ARM_Contents.Change_Version_Type; |
| 1022 |
end record; |
| 1023 |
type Nesting_Stack_Type is array (1 .. 40) of Items; |
| 1024 |
type Format_State_Type is record |
| 1025 |
Nesting_Stack : Nesting_Stack_Type; |
| 1026 |
Nesting_Stack_Ptr : Natural := 0; |
| 1027 |
end record; |
| 1028 |
|
| 1029 |
|
| 1030 |
procedure Real_Process (Format_Object : in out Format_Type; |
| 1031 |
Format_State : in out Format_State_Type; |
| 1032 |
Input_Object : in out ARM_Input.Input_Type'Class; |
| 1033 |
Output_Object : in out ARM_Output.Output_Type'Class) is |
| 1034 |
-- Process the contents of Input_Object, writing the results to |
| 1035 |
-- Output_Object. (Output_Object uses dispatching calls to provide |
| 1036 |
-- the correct formatting). Format_Object holds information about |
| 1037 |
-- the state of the formatting. |
| 1038 |
|
| 1039 |
procedure Set_Nesting_for_Command (Name : in ARM_Input.Command_Name_Type; |
| 1040 |
Kind : in Command_Kind_Type; |
| 1041 |
Param_Ch : in Character) is |
| 1042 |
-- Push the command onto the nesting stack. |
| 1043 |
begin |
| 1044 |
Format_State.Nesting_Stack_Ptr := Format_State.Nesting_Stack_Ptr + 1; |
| 1045 |
Format_State.Nesting_Stack (Format_State.Nesting_Stack_Ptr) := |
| 1046 |
(Name => Name, |
| 1047 |
Kind => Kind, |
| 1048 |
Command => Data.Command (Name), |
| 1049 |
Open_Line => (1..12 => ' '), -- Set below. |
| 1050 |
Close_Char => ' ', -- Set below. |
| 1051 |
Text_Format => Format_Object.Text_Format, -- Save the current format. |
| 1052 |
-- Other things next necessarily used: |
| 1053 |
Old_Last_Subhead_Paragraph => Plain, -- Not used. |
| 1054 |
Old_Next_Subhead_Paragraph => Plain, -- Not used. |
| 1055 |
Old_Next_Paragraph_Format => Plain, -- Not used. |
| 1056 |
Old_Tab_Stops => ARM_Output.NO_TABS, -- Not used. |
| 1057 |
Old_Next_Enum_Num => 1, -- Not used. |
| 1058 |
Is_Formatting => False, -- Not used. |
| 1059 |
Change_Version => '0', -- Not used. |
| 1060 |
Was_Text => False, -- Not used. |
| 1061 |
Prev_Change => ARM_Output.None, -- Not used. |
| 1062 |
Prev_Change_Version => '0', -- Not used. |
| 1063 |
Prev_Added_Change_Version => '0'); -- Not used. |
| 1064 |
Format_State.Nesting_Stack (Format_State.Nesting_Stack_Ptr).Close_Char := ARM_Input.Get_Close_Char (Param_Ch); |
| 1065 |
Ada.Strings.Fixed.Move (Target => Format_State.Nesting_Stack (Format_State.Nesting_Stack_Ptr).Open_Line, |
| 1066 |
Source => ARM_Input.Line_String (Input_Object), |
| 1067 |
Drop => Ada.Strings.Right); |
| 1068 |
--Ada.Text_IO.Put_Line (" &Stack (" & Name & "); Close-Char=" & |
| 1069 |
-- Format_State.Nesting_Stack (Format_State.Nesting_Stack_Ptr).Close_Char); |
| 1070 |
end Set_Nesting_for_Command; |
| 1071 |
|
| 1072 |
|
| 1073 |
procedure Set_Nesting_for_Parameter (Command : in Data.Command_Type; |
| 1074 |
Close_Ch : in Character) is |
| 1075 |
-- Push the parameter onto the nesting stack. |
| 1076 |
begin |
| 1077 |
Format_State.Nesting_Stack_Ptr := Format_State.Nesting_Stack_Ptr + 1; |
| 1078 |
Format_State.Nesting_Stack (Format_State.Nesting_Stack_Ptr) := |
| 1079 |
(Name => (others => ' '), |
| 1080 |
Kind => Parameter, |
| 1081 |
Command => Command, |
| 1082 |
Close_Char => Close_Ch, |
| 1083 |
Open_Line => (1..12 => ' '), -- Set below. |
| 1084 |
Text_Format => Format_Object.Text_Format, -- Save the current |
| 1085 |
-- format (not really used here). |
| 1086 |
Old_Last_Subhead_Paragraph => Plain, -- Not used. |
| 1087 |
Old_Next_Subhead_Paragraph => Plain, -- Not used. |
| 1088 |
Old_Next_Paragraph_Format => Plain, -- Not used. |
| 1089 |
Old_Tab_Stops => ARM_Output.NO_TABS, -- Not used. |
| 1090 |
Old_Next_Enum_Num => 1, -- Not used. |
| 1091 |
Is_Formatting => False, -- Not used. |
| 1092 |
Change_Version => '0', -- Not used. |
| 1093 |
Was_Text => False, -- Not used. |
| 1094 |
Prev_Change => ARM_Output.None, -- Not used. |
| 1095 |
Prev_Change_Version => '0', -- Not used. |
| 1096 |
Prev_Added_Change_Version => '0'); -- Not used. |
| 1097 |
Ada.Strings.Fixed.Move (Target => Format_State.Nesting_Stack (Format_State.Nesting_Stack_Ptr).Open_Line, |
| 1098 |
Source => ARM_Input.Line_String (Input_Object), |
| 1099 |
Drop => Ada.Strings.Right); |
| 1100 |
--Ada.Text_IO.Put_Line (" &Stack (Parameter)"); |
| 1101 |
end Set_Nesting_for_Parameter; |
| 1102 |
|
| 1103 |
|
| 1104 |
function Is_AARM_Paragraph (Kind : in Paragraph_Type) return Boolean is |
| 1105 |
begin |
| 1106 |
case Kind is |
| 1107 |
when Plain | Introduction | Syntax | Resolution | Legality | |
| 1108 |
Static_Semantics | Link_Time | |
| 1109 |
Run_Time | Bounded_Errors | |
| 1110 |
Erroneous | Requirements | Documentation | |
| 1111 |
Metrics | Permissions | Advice | Notes | Single_Note | |
| 1112 |
Examples => |
| 1113 |
return False; |
| 1114 |
when Language_Design | Ada83_Inconsistencies | |
| 1115 |
Ada83_Incompatibilities | Ada83_Extensions | |
| 1116 |
Ada83_Wording | Ada95_Inconsistencies | |
| 1117 |
Ada95_Incompatibilities | Ada95_Extensions | |
| 1118 |
Ada95_Wording | Ada2005_Inconsistencies | |
| 1119 |
Ada2005_Incompatibilities | Ada2005_Extensions | |
| 1120 |
Ada2005_Wording | Ada2012_Inconsistencies | |
| 1121 |
Ada2012_Incompatibilities | Ada2012_Extensions | |
| 1122 |
Ada2012_Wording | Reason | Ramification | Proof | |
| 1123 |
Imp_Note | Corr_Change | Discussion | |
| 1124 |
Honest | Glossary_Marker | Bare_Annotation | |
| 1125 |
Element_Ref | Child_Ref | Usage_Note => |
| 1126 |
return True; |
| 1127 |
when In_Table => |
| 1128 |
return False; -- Tables are never considered part of the |
| 1129 |
-- AARM for formatting purposes, even when they are. |
| 1130 |
when Wide_Above | Example_Text | Indented_Example_Text | |
| 1131 |
Child_Example_Text | Code_Indented | Indent | |
| 1132 |
Bulleted | |
| 1133 |
Nested_Bulleted | Nested_X2_Bulleted | |
| 1134 |
Display | Syntax_Display | |
| 1135 |
Syntax_Indented | Syntax_Production | |
| 1136 |
Enumerated | Nested_Enumerated | |
| 1137 |
Hanging_Indented_1 | Hanging_Indented_2 | |
| 1138 |
Hanging_Indented_3 | Hanging_Indented_4 | |
| 1139 |
Small | Title => |
| 1140 |
-- This depends on the containing paragraph kind; |
| 1141 |
-- Last_Paragraph_Subhead_Type should contain that. |
| 1142 |
if Format_Object.Last_Paragraph_Subhead_Type = Wide_Above or else |
| 1143 |
Format_Object.Last_Paragraph_Subhead_Type = Example_Text or else |
| 1144 |
Format_Object.Last_Paragraph_Subhead_Type = Child_Example_Text or else |
| 1145 |
Format_Object.Last_Paragraph_Subhead_Type = Indented_Example_Text or else |
| 1146 |
Format_Object.Last_Paragraph_Subhead_Type = Bulleted or else |
| 1147 |
Format_Object.Last_Paragraph_Subhead_Type = Code_Indented or else |
| 1148 |
Format_Object.Last_Paragraph_Subhead_Type = Indent or else |
| 1149 |
Format_Object.Last_Paragraph_Subhead_Type = Nested_Bulleted or else |
| 1150 |
Format_Object.Last_Paragraph_Subhead_Type = Nested_X2_Bulleted or else |
| 1151 |
Format_Object.Last_Paragraph_Subhead_Type = Display or else |
| 1152 |
Format_Object.Last_Paragraph_Subhead_Type = Syntax_Display or else |
| 1153 |
Format_Object.Last_Paragraph_Subhead_Type = Syntax_Indented or else |
| 1154 |
Format_Object.Last_Paragraph_Subhead_Type = Syntax_Production or else |
| 1155 |
Format_Object.Last_Paragraph_Subhead_Type = Enumerated or else |
| 1156 |
Format_Object.Last_Paragraph_Subhead_Type = Nested_Enumerated or else |
| 1157 |
Format_Object.Last_Paragraph_Subhead_Type = Hanging_Indented_1 or else |
| 1158 |
Format_Object.Last_Paragraph_Subhead_Type = Hanging_Indented_2 or else |
| 1159 |
Format_Object.Last_Paragraph_Subhead_Type = Hanging_Indented_3 or else |
| 1160 |
Format_Object.Last_Paragraph_Subhead_Type = Hanging_Indented_4 or else |
| 1161 |
Format_Object.Last_Paragraph_Subhead_Type = Title or else |
| 1162 |
Format_Object.Last_Paragraph_Subhead_Type = In_Table then |
| 1163 |
Ada.Text_IO.Put_Line ("%% Oops, can't find out if AARM paragraph, line " & ARM_Input.Line_String (Input_Object)); |
| 1164 |
return False; -- Oops, can't tell (double nesting). |
| 1165 |
-- We make this check to avoid infinite recursion. |
| 1166 |
else |
| 1167 |
return Is_AARM_Paragraph (Format_Object.Last_Paragraph_Subhead_Type); |
| 1168 |
end if; |
| 1169 |
end case; |
| 1170 |
end Is_AARM_Paragraph; |
| 1171 |
|
| 1172 |
|
| 1173 |
procedure Paragraph_Number_String (Update_Numbers : in Boolean) is |
| 1174 |
-- Generate the current (next) paragraph number string into |
| 1175 |
-- Format_Object.Current_Paragraph_String. Update the paragraph |
| 1176 |
-- numbers if Update_Numbers is True. |
| 1177 |
PNum : constant String := Integer'Image(Format_Object.Next_Paragraph); |
| 1178 |
PNum_Pred : constant String := Integer'Image(Format_Object.Next_Paragraph-1); |
| 1179 |
use type Arm_Database.Paragraph_Change_Kind_Type; |
| 1180 |
|
| 1181 |
procedure AARM_Sub_Num (Sub_Letter : in Character) is |
| 1182 |
-- Adds a properly formatted AARM sub letter, with leading '.'. |
| 1183 |
-- Sets the length appropriately. |
| 1184 |
begin |
| 1185 |
Format_Object.Current_Paragraph_String(PNum_Pred'Last) := |
| 1186 |
'.'; |
| 1187 |
if Sub_Letter <= 'z' then |
| 1188 |
Format_Object.Current_Paragraph_String(PNum_Pred'Last+1) := |
| 1189 |
Sub_Letter; |
| 1190 |
Format_Object.Current_Paragraph_Len := |
| 1191 |
PNum_Pred'Last + 1; |
| 1192 |
elsif Character'Val(Character'Pos(Sub_Letter) - 26) <= 'z' then |
| 1193 |
-- Double letter. |
| 1194 |
Format_Object.Current_Paragraph_String(PNum_Pred'Last+1) := |
| 1195 |
Character'Val(Character'Pos(Sub_Letter) - 26); |
| 1196 |
Format_Object.Current_Paragraph_String(PNum_Pred'Last+2) := |
| 1197 |
Character'Val(Character'Pos(Sub_Letter) - 26); |
| 1198 |
Format_Object.Current_Paragraph_Len := |
| 1199 |
PNum_Pred'Last + 2; |
| 1200 |
elsif Character'Val(Character'Pos(Sub_Letter) - 52) <= 'z' then |
| 1201 |
-- Triple letter. |
| 1202 |
Format_Object.Current_Paragraph_String(PNum_Pred'Last+1) := |
| 1203 |
Character'Val(Character'Pos(Sub_Letter) - 52); |
| 1204 |
Format_Object.Current_Paragraph_String(PNum_Pred'Last+2) := |
| 1205 |
Character'Val(Character'Pos(Sub_Letter) - 52); |
| 1206 |
Format_Object.Current_Paragraph_String(PNum_Pred'Last+3) := |
| 1207 |
Character'Val(Character'Pos(Sub_Letter) - 52); |
| 1208 |
Format_Object.Current_Paragraph_Len := |
| 1209 |
PNum_Pred'Last + 3; |
| 1210 |
else -- Doesn't fit! |
| 1211 |
Ada.Text_IO.Put_Line ("** AARM paragraph number out of range, line " & ARM_Input.Line_String (Input_Object)); |
| 1212 |
Format_Object.Current_Paragraph_String(PNum_Pred'Last+1) := '$'; |
| 1213 |
Format_Object.Current_Paragraph_String(PNum_Pred'Last+2) := '$'; |
| 1214 |
Format_Object.Current_Paragraph_String(PNum_Pred'Last+3) := '$'; |
| 1215 |
Format_Object.Current_Paragraph_Len := |
| 1216 |
PNum_Pred'Last + 3; |
| 1217 |
end if; |
| 1218 |
end AARM_Sub_Num; |
| 1219 |
|
| 1220 |
begin |
| 1221 |
-- The full paragraph number is: |
| 1222 |
-- Num.AARM.Ins/Vers |
| 1223 |
-- where Num is a paragraph number in the RM; AARM is the |
| 1224 |
-- paragraph subletter for AARM text; Ins is the number of |
| 1225 |
-- inserted paragraph; and Vers is the version number ('1' |
| 1226 |
-- for Technical Corrigendum 1; '0' for original RM.; |
| 1227 |
-- '2' for Amendment 1). Note that we don't include change |
| 1228 |
-- versions greater than the one we're currently processing. |
| 1229 |
-- Unused parts are omitted. |
| 1230 |
|
| 1231 |
-- %%%% Buglet: If a paragraph was changed by multiple versions, |
| 1232 |
-- we only know the last one. So we guess. If there was a change |
| 1233 |
-- visible here, there must be a revision number, so we use the |
| 1234 |
-- one we're generating. That could be wrong if we have three |
| 1235 |
-- or more versions. I hope we don't need to regenerate old |
| 1236 |
-- versions that far back. |
| 1237 |
|
| 1238 |
if Format_Object.Next_Paragraph_Change_Kind = ARM_Database.None or else |
| 1239 |
Format_Object.Changes = Old_Only then |
| 1240 |
-- Either there is no change, or we are only producing |
| 1241 |
-- the original document (which means we ignore all |
| 1242 |
-- marked changes). |
| 1243 |
if Is_AARM_Paragraph (Format_Object.Next_Paragraph_Subhead_Type) then |
| 1244 |
Format_Object.Current_Paragraph_String(1 .. PNum_Pred'Last-1) := |
| 1245 |
PNum_Pred(2..PNum_Pred'Last); |
| 1246 |
AARM_Sub_Num (Format_Object.Next_AARM_Sub); |
| 1247 |
if Update_Numbers then |
| 1248 |
Format_Object.Next_AARM_Sub := Character'Succ(Format_Object.Next_AARM_Sub); |
| 1249 |
Format_Object.Next_AARM_Insert_Para := 1; |
| 1250 |
end if; |
| 1251 |
else |
| 1252 |
Format_Object.Current_Paragraph_String(1 .. PNum'Last-1) := |
| 1253 |
PNum(2..PNum'Last); |
| 1254 |
Format_Object.Current_Paragraph_Len := PNum'Last - 1; |
| 1255 |
if Update_Numbers then |
| 1256 |
Format_Object.Next_Paragraph := Format_Object.Next_Paragraph + 1; |
| 1257 |
Format_Object.Next_Insert_Para := 1; |
| 1258 |
Format_Object.Next_AARM_Sub := 'a'; |
| 1259 |
Format_Object.Next_AARM_Insert_Para := 1; |
| 1260 |
end if; |
| 1261 |
end if; |
| 1262 |
elsif Format_Object.Next_Paragraph_Change_Kind = ARM_Database.Inserted or else |
| 1263 |
Format_Object.Next_Paragraph_Change_Kind = ARM_Database.Revised_Inserted_Number or else |
| 1264 |
Format_Object.Next_Paragraph_Change_Kind = ARM_Database.Deleted_Inserted_Number or else |
| 1265 |
Format_Object.Next_Paragraph_Change_Kind = ARM_Database.Deleted_Inserted_Number_No_Delete_Message then |
| 1266 |
-- We'll assume that there are no more than 99 inserted |
| 1267 |
-- paragraphs in a row. |
| 1268 |
Format_Object.Current_Paragraph_String(1 .. PNum_Pred'Last-1) := |
| 1269 |
PNum_Pred(2..PNum_Pred'Last); |
| 1270 |
if Is_AARM_Paragraph (Format_Object.Next_Paragraph_Subhead_Type) then |
| 1271 |
if Format_Object.Next_AARM_Sub = 'a' then |
| 1272 |
AARM_Sub_Num ('a'); -- No paras before the insertion. |
| 1273 |
else |
| 1274 |
AARM_Sub_Num (Character'Pred(Format_Object.Next_AARM_Sub)); |
| 1275 |
-- Insertions use the preceeding paragraph letter. |
| 1276 |
end if; |
| 1277 |
Format_Object.Current_Paragraph_String(Format_Object.Current_Paragraph_Len + 1) := |
| 1278 |
'.'; |
| 1279 |
if Format_Object.Next_AARM_Insert_Para >= 10 then |
| 1280 |
Format_Object.Current_Paragraph_String(Format_Object.Current_Paragraph_Len + 2) := |
| 1281 |
Character'Val((Format_Object.Next_AARM_Insert_Para/10) + Character'Pos('0')); |
| 1282 |
Format_Object.Current_Paragraph_String(Format_Object.Current_Paragraph_Len + 3) := |
| 1283 |
Character'Val((Format_Object.Next_AARM_Insert_Para mod 10) + Character'Pos('0')); |
| 1284 |
Format_Object.Current_Paragraph_Len := Format_Object.Current_Paragraph_Len + 1; |
| 1285 |
-- Make this consistent with the other cases. |
| 1286 |
else |
| 1287 |
Format_Object.Current_Paragraph_String(Format_Object.Current_Paragraph_Len + 2) := |
| 1288 |
Character'Val(Format_Object.Next_AARM_Insert_Para + Character'Pos('0')); |
| 1289 |
end if; |
| 1290 |
if Update_Numbers then |
| 1291 |
Format_Object.Next_AARM_Insert_Para := |
| 1292 |
Format_Object.Next_AARM_Insert_Para + 1; |
| 1293 |
end if; |
| 1294 |
else -- None inserted paragraphs. |
| 1295 |
Format_Object.Current_Paragraph_Len := PNum_Pred'Last - 1; |
| 1296 |
Format_Object.Current_Paragraph_String(Format_Object.Current_Paragraph_Len + 1) := |
| 1297 |
'.'; |
| 1298 |
if Format_Object.Next_Insert_Para >= 10 then |
| 1299 |
Format_Object.Current_Paragraph_String(Format_Object.Current_Paragraph_Len + 2) := |
| 1300 |
Character'Val((Format_Object.Next_Insert_Para/10) + Character'Pos('0')); |
| 1301 |
Format_Object.Current_Paragraph_String(Format_Object.Current_Paragraph_Len + 3) := |
| 1302 |
Character'Val((Format_Object.Next_Insert_Para mod 10) + Character'Pos('0')); |
| 1303 |
Format_Object.Current_Paragraph_Len := Format_Object.Current_Paragraph_Len + 1; |
| 1304 |
-- Make this consistent with the other cases. |
| 1305 |
else |
| 1306 |
Format_Object.Current_Paragraph_String(Format_Object.Current_Paragraph_Len + 2) := |
| 1307 |
Character'Val(Format_Object.Next_Insert_Para + Character'Pos('0')); |
| 1308 |
end if; |
| 1309 |
if Update_Numbers then |
| 1310 |
Format_Object.Next_Insert_Para := Format_Object.Next_Insert_Para + 1; |
| 1311 |
-- Note: We don't update the AARM numbers for |
| 1312 |
-- inserted paragraphs, as the insertion number is |
| 1313 |
-- not included in them. |
| 1314 |
end if; |
| 1315 |
end if; |
| 1316 |
if Format_Object.Next_Paragraph_Version /= '0' then |
| 1317 |
Format_Object.Current_Paragraph_String(Format_Object.Current_Paragraph_Len + 3) := |
| 1318 |
'/'; |
| 1319 |
if Format_Object.Next_Paragraph_Version <= Format_Object.Change_Version then |
| 1320 |
Format_Object.Current_Paragraph_String(Format_Object.Current_Paragraph_Len + 4) := |
| 1321 |
Format_Object.Next_Paragraph_Version; |
| 1322 |
else -- Use the number we're generating. |
| 1323 |
Format_Object.Current_Paragraph_String(Format_Object.Current_Paragraph_Len + 4) := |
| 1324 |
Format_Object.Change_Version; |
| 1325 |
end if; |
| 1326 |
Format_Object.Current_Paragraph_Len := Format_Object.Current_Paragraph_Len + 4; |
| 1327 |
else |
| 1328 |
Format_Object.Current_Paragraph_Len := Format_Object.Current_Paragraph_Len + 2; |
| 1329 |
end if; |
| 1330 |
else --if Format_Object.Next_Paragraph_Change_Kind = ARM_Database.Revised or else |
| 1331 |
-- Format_Object.Next_Paragraph_Change_Kind = ARM_Database.Deleted or else |
| 1332 |
-- Format_Object.Next_Paragraph_Change_Kind = ARM_Database.Inserted_Normal_Number then |
| 1333 |
if Is_AARM_Paragraph (Format_Object.Next_Paragraph_Subhead_Type) then |
| 1334 |
Format_Object.Current_Paragraph_String(1 .. PNum_Pred'Last-1) := |
| 1335 |
PNum_Pred(2..PNum_Pred'Last); |
| 1336 |
AARM_Sub_Num (Format_Object.Next_AARM_Sub); |
| 1337 |
--Format_Object.Current_Paragraph_Len := Format_Object.Current_Paragraph_Len; -- Unchanged. |
| 1338 |
if Update_Numbers then |
| 1339 |
Format_Object.Next_AARM_Sub := Character'Succ(Format_Object.Next_AARM_Sub); |
| 1340 |
Format_Object.Next_AARM_Insert_Para := 1; |
| 1341 |
end if; |
| 1342 |
else |
| 1343 |
Format_Object.Current_Paragraph_String(1 .. PNum'Last-1) := |
| 1344 |
PNum(2..PNum'Last); |
| 1345 |
Format_Object.Current_Paragraph_Len := PNum'Last - 1; |
| 1346 |
if Update_Numbers then |
| 1347 |
Format_Object.Next_Paragraph := Format_Object.Next_Paragraph + 1; |
| 1348 |
Format_Object.Next_Insert_Para := 1; |
| 1349 |
Format_Object.Next_AARM_Sub := 'a'; |
| 1350 |
Format_Object.Next_AARM_Insert_Para := 1; |
| 1351 |
end if; |
| 1352 |
end if; |
| 1353 |
if Format_Object.Next_Paragraph_Version /= '0' then |
| 1354 |
Format_Object.Current_Paragraph_String(Format_Object.Current_Paragraph_Len + 1) := |
| 1355 |
'/'; |
| 1356 |
if Format_Object.Next_Paragraph_Version <= Format_Object.Change_Version then |
| 1357 |
Format_Object.Current_Paragraph_String(Format_Object.Current_Paragraph_Len + 2) := |
| 1358 |
Format_Object.Next_Paragraph_Version; |
| 1359 |
else -- Use the number we're generating. |
| 1360 |
Format_Object.Current_Paragraph_String(Format_Object.Current_Paragraph_Len + 2) := |
| 1361 |
Format_Object.Change_Version; |
| 1362 |
end if; |
| 1363 |
Format_Object.Current_Paragraph_Len := Format_Object.Current_Paragraph_Len + 2; |
| 1364 |
-- else no version to display. |
| 1365 |
end if; |
| 1366 |
end if; |
| 1367 |
end Paragraph_Number_String; |
| 1368 |
|
| 1369 |
|
| 1370 |
function Paragraph_String return String is |
| 1371 |
-- Returns a string for a paragraph reference, for use in an |
| 1372 |
-- index entry. |
| 1373 |
begin |
| 1374 |
if Format_Object.In_Paragraph then |
| 1375 |
null; -- It is already is stored. |
| 1376 |
else -- Generate the next paragraph number. |
| 1377 |
Paragraph_Number_String (Update_Numbers => False); |
| 1378 |
end if; |
| 1379 |
return Format_Object.Current_Paragraph_String ( |
| 1380 |
1 .. Format_Object.Current_Paragraph_Len); |
| 1381 |
end Paragraph_String; |
| 1382 |
|
| 1383 |
|
| 1384 |
procedure Check_Paragraph is |
| 1385 |
-- Open a paragraph if needed before outputting any text that needs |
| 1386 |
-- one. |
| 1387 |
|
| 1388 |
procedure Set_Format (For_Type : Paragraph_Type) is |
| 1389 |
|
| 1390 |
use type ARM_Output.Paragraph_Indent_Type; |
| 1391 |
|
| 1392 |
function Enclosing_Format return Paragraph_Type is |
| 1393 |
begin |
| 1394 |
for I in reverse 1 .. Format_State.Nesting_Stack_Ptr loop |
| 1395 |
if Format_State.Nesting_Stack(I).Command = Text_Begin and then |
| 1396 |
(Format_State.Nesting_Stack(I).Is_Formatting) then |
| 1397 |
return Format_State.Nesting_Stack(I).Old_Next_Paragraph_Format; |
| 1398 |
end if; |
| 1399 |
end loop; |
| 1400 |
return Plain; -- The default format. |
| 1401 |
end Enclosing_Format; |
| 1402 |
|
| 1403 |
function Enclosing_Indent return ARM_Output.Paragraph_Indent_Type is |
| 1404 |
function Nested_Indent (Start_Nesting : in Natural) return ARM_Output.Paragraph_Indent_Type is |
| 1405 |
begin |
| 1406 |
for I in reverse 1 .. Start_Nesting loop |
| 1407 |
if Format_State.Nesting_Stack(I).Command = Text_Begin and then |
| 1408 |
(Format_State.Nesting_Stack(I).Is_Formatting) then |
| 1409 |
case Format_State.Nesting_Stack(I).Old_Next_Paragraph_Format is |
| 1410 |
when Plain | Introduction | |
| 1411 |
Resolution | |
| 1412 |
Legality | |
| 1413 |
Static_Semantics | |
| 1414 |
Link_Time | |
| 1415 |
Run_Time | |
| 1416 |
Bounded_Errors | |
| 1417 |
Erroneous | |
| 1418 |
Requirements | -- ImplReq |
| 1419 |
Documentation | -- DocReq |
| 1420 |
Metrics | |
| 1421 |
Permissions | -- ImplPerm |
| 1422 |
Advice | -- ImplAdvice |
| 1423 |
Examples => |
| 1424 |
return 0; -- No indent. |
| 1425 |
when Wide_Above => |
| 1426 |
if Is_AARM_Paragraph (Format_Object.Last_Paragraph_Subhead_Type) then |
| 1427 |
return 2; -- Normal indent for annotations. |
| 1428 |
else |
| 1429 |
return 0; -- No indent. |
| 1430 |
end if; |
| 1431 |
when Syntax => |
| 1432 |
return 1; -- One unit. |
| 1433 |
when Notes | Single_Note => -- Notes (only the numbering varies) |
| 1434 |
return 1; -- One unit. |
| 1435 |
when Element_Ref | Child_Ref | Usage_Note => -- Similar to an AARM note. |
| 1436 |
return 2; -- Normal indent for annotations. |
| 1437 |
when Language_Design | -- "MetaRules" |
| 1438 |
Ada83_Inconsistencies | -- Inconsistent83 |
| 1439 |
Ada83_Incompatibilities | -- Incompatible83 |
| 1440 |
Ada83_Extensions | -- Extend83 |
| 1441 |
Ada83_Wording | -- DiffWord83 |
| 1442 |
Ada95_Inconsistencies | -- Inconsistent95 |
| 1443 |
Ada95_Incompatibilities | -- Incompatible95 |
| 1444 |
Ada95_Extensions | -- Extend95 |
| 1445 |
Ada95_Wording | -- DiffWord95 |
| 1446 |
Ada2005_Inconsistencies | -- Inconsistent2005 |
| 1447 |
Ada2005_Incompatibilities | -- Incompatible2005 |
| 1448 |
Ada2005_Extensions | -- Extend2005 |
| 1449 |
Ada2005_Wording | -- DiffWord2005 |
| 1450 |
Ada2012_Inconsistencies | -- Inconsistent2012 |
| 1451 |
Ada2012_Incompatibilities | -- Incompatible2012 |
| 1452 |
Ada2012_Extensions | -- Extend2012 |
| 1453 |
Ada2012_Wording => -- DiffWord2012 |
| 1454 |
return 2; -- Normal indent for annotations. |
| 1455 |
when Reason | Ramification | Proof | |
| 1456 |
Imp_Note | Corr_Change | Discussion | |
| 1457 |
Honest | Glossary_Marker | Bare_Annotation => |
| 1458 |
return 2; -- Normal indent for annotations. |
| 1459 |
when Example_Text => |
| 1460 |
if Is_AARM_Paragraph (Format_Object.Last_Paragraph_Subhead_Type) then |
| 1461 |
return 3; -- Three units. |
| 1462 |
else |
| 1463 |
return 1; -- One unit. |
| 1464 |
end if; |
| 1465 |
when Child_Example_Text => |
| 1466 |
return 1 + Nested_Indent(I-1); -- Depends on enclosing. |
| 1467 |
when Indented_Example_Text => |
| 1468 |
if Is_AARM_Paragraph (Format_Object.Last_Paragraph_Subhead_Type) then |
| 1469 |
return 6; -- Six units. |
| 1470 |
else |
| 1471 |
return 4; -- Four units. |
| 1472 |
end if; |
| 1473 |
when Code_Indented => |
| 1474 |
if Is_AARM_Paragraph (Format_Object.Last_Paragraph_Subhead_Type) then |
| 1475 |
return 4; -- Four units. |
| 1476 |
else |
| 1477 |
return 2; -- Two units. |
| 1478 |
end if; |
| 1479 |
when Indent => |
| 1480 |
return 1 + Nested_Indent(I-1); -- Depends on enclosing. |
| 1481 |
when Bulleted | Nested_Bulleted | Nested_X2_Bulleted => |
| 1482 |
return 1 + Nested_Indent(I-1); -- Depends on enclosing. |
| 1483 |
when Display => |
| 1484 |
return 1 + Nested_Indent(I-1); -- Depends on enclosing. |
| 1485 |
when Syntax_Display => |
| 1486 |
return 1; -- One unit. |
| 1487 |
when Enumerated | Nested_Enumerated => |
| 1488 |
return 1 + Nested_Indent(I-1); -- Depends on enclosing. |
| 1489 |
when Syntax_Indented => |
| 1490 |
return 1; -- One unit. |
| 1491 |
when Syntax_Production => |
| 1492 |
return Nested_Indent(I-1); -- Depends on enclosing. |
| 1493 |
when Hanging_Indented_1 => |
| 1494 |
return Nested_Indent(I-1) + 1; -- Depends on enclosing, at least 1. |
| 1495 |
when Hanging_Indented_2 => |
| 1496 |
return Nested_Indent(I-1) + 2; -- Depends on enclosing, at least 2. |
| 1497 |
when Hanging_Indented_3 => |
| 1498 |
return Nested_Indent(I-1) + 3; -- Depends on enclosing, at least 3. |
| 1499 |
when Hanging_Indented_4 => |
| 1500 |
return Nested_Indent(I-1) + 4; -- Depends on enclosing, at least 4. |
| 1501 |
when Small => |
| 1502 |
return Nested_Indent(I-1); -- Depends on enclosing, does not change. |
| 1503 |
when Title => |
| 1504 |
return 0; -- No indent. |
| 1505 |
when In_Table => |
| 1506 |
-- Shouldn't get here. |
| 1507 |
return 0; -- No indent. |
| 1508 |
end case; |
| 1509 |
end if; |
| 1510 |
end loop; |
| 1511 |
return 0; -- No indent. |
| 1512 |
end Nested_Indent; |
| 1513 |
|
| 1514 |
begin |
| 1515 |
return Nested_Indent (Format_State.Nesting_Stack_Ptr); |
| 1516 |
end Enclosing_Indent; |
| 1517 |
|
| 1518 |
function Is_Small_Format_Paragraph (Subhead_Kind : in Paragraph_Type) return Boolean is |
| 1519 |
-- AARM annotations are in the small font, as are user notes. |
| 1520 |
begin |
| 1521 |
if Is_AARM_Paragraph (Subhead_Kind) then |
| 1522 |
return True; -- AARM paragraphs are always small. |
| 1523 |
else -- Check the enclosing formatting for "small" or |
| 1524 |
-- other styles that imply that. |
| 1525 |
for I in reverse 1 .. Format_State.Nesting_Stack_Ptr loop |
| 1526 |
if Format_State.Nesting_Stack(I).Command = Text_Begin and then |
| 1527 |
(Format_State.Nesting_Stack(I).Is_Formatting) then |
| 1528 |
case Format_State.Nesting_Stack(I).Old_Next_Paragraph_Format is |
| 1529 |
when Introduction | Syntax | Resolution | Legality | |
| 1530 |
Static_Semantics | Link_Time | |
| 1531 |
Run_Time | Bounded_Errors | |
| 1532 |
Erroneous | Requirements | Documentation | |
| 1533 |
Metrics | Permissions | Advice | Examples => |
| 1534 |
return False; |
| 1535 |
when Language_Design | Ada83_Inconsistencies | |
| 1536 |
Ada83_Incompatibilities | Ada83_Extensions | |
| 1537 |
Ada83_Wording | Ada95_Inconsistencies | |
| 1538 |
Ada95_Incompatibilities | Ada95_Extensions | |
| 1539 |
Ada95_Wording | Ada2005_Inconsistencies | |
| 1540 |
Ada2005_Incompatibilities | Ada2005_Extensions | |
| 1541 |
Ada2005_Wording | Ada2012_Inconsistencies | |
| 1542 |
Ada2012_Incompatibilities | Ada2012_Extensions | |
| 1543 |
Ada2012_Wording | Reason | Ramification | Proof | |
| 1544 |
Imp_Note | Corr_Change | Discussion | |
| 1545 |
Honest | Glossary_Marker | Bare_Annotation | |
| 1546 |
Element_Ref | Child_Ref | Usage_Note | |
| 1547 |
Notes | Single_Note | Small => |
| 1548 |
return True; |
| 1549 |
when Plain | Wide_Above | In_Table | Example_Text | Indented_Example_Text | |
| 1550 |
Child_Example_Text | Code_Indented | Indent | |
| 1551 |
Bulleted | |
| 1552 |
Nested_Bulleted | Nested_X2_Bulleted | |
| 1553 |
Display | Syntax_Display | |
| 1554 |
Syntax_Indented | Syntax_Production | |
| 1555 |
Enumerated | Nested_Enumerated | |
| 1556 |
Hanging_Indented_1 | Hanging_Indented_2 | |
| 1557 |
Hanging_Indented_3 | Hanging_Indented_4 | |
| 1558 |
Title => |
| 1559 |
-- This depends on the containing paragraph kind, |
| 1560 |
-- keep looking. |
| 1561 |
null; |
| 1562 |
end case; |
| 1563 |
end if; |
| 1564 |
end loop; |
| 1565 |
return False; -- Don't know. |
| 1566 |
end if; |
| 1567 |
end Is_Small_Format_Paragraph; |
| 1568 |
|
| 1569 |
begin |
| 1570 |
case For_Type is |
| 1571 |
when Plain | Introduction | |
| 1572 |
Resolution | |
| 1573 |
Legality | |
| 1574 |
Static_Semantics | |
| 1575 |
Link_Time | |
| 1576 |
Run_Time | |
| 1577 |
Bounded_Errors | |
| 1578 |
Erroneous | |
| 1579 |
Requirements | -- ImplReq |
| 1580 |
Documentation | -- DocReq |
| 1581 |
Metrics | |
| 1582 |
Permissions | -- ImplPerm |
| 1583 |
Advice | -- ImplAdvice |
| 1584 |
Examples => |
| 1585 |
Format_Object.Style := ARM_Output.Normal; |
| 1586 |
Format_Object.Indent := 0; -- No indent. |
| 1587 |
Format_Object.No_Breaks := False; |
| 1588 |
when Wide_Above => |
| 1589 |
if Is_AARM_Paragraph (Format_Object.Last_Paragraph_Subhead_Type) then |
| 1590 |
Format_Object.Style := ARM_Output.Small_Wide_Above; |
| 1591 |
Format_Object.Indent := 2; -- Two units. |
| 1592 |
elsif Format_Object.Last_Paragraph_Subhead_Type = Notes or else |
| 1593 |
Format_Object.Last_Paragraph_Subhead_Type = Single_Note then |
| 1594 |
Format_Object.Style := ARM_Output.Small_Wide_Above; |
| 1595 |
Format_Object.Indent := 1; -- One unit. |
| 1596 |
else |
| 1597 |
Format_Object.Style := ARM_Output.Wide_Above; |
| 1598 |
Format_Object.Indent := 0; -- No indent. |
| 1599 |
end if; |
| 1600 |
Format_Object.No_Breaks := False; |
| 1601 |
when Syntax => |
| 1602 |
Format_Object.Style := ARM_Output.Normal; |
| 1603 |
Format_Object.Indent := 1; -- One unit. |
| 1604 |
Format_Object.No_Breaks := True; |
| 1605 |
when Notes | Single_Note | Small => -- Notes (only the numbering varies) |
| 1606 |
Format_Object.Style := ARM_Output.Small; |
| 1607 |
Format_Object.Indent := 1; -- One unit. |
| 1608 |
Format_Object.No_Breaks := False; |
| 1609 |
when Element_Ref | Child_Ref | Usage_Note => -- Similar to an AARM note. |
| 1610 |
Format_Object.Style := ARM_Output.Small; |
| 1611 |
Format_Object.Indent := 2; -- Two units. |
| 1612 |
Format_Object.No_Breaks := False; |
| 1613 |
when Language_Design | -- "MetaRules" |
| 1614 |
Ada83_Inconsistencies | -- Inconsistent83 |
| 1615 |
Ada83_Incompatibilities | -- Incompatible83 |
| 1616 |
Ada83_Extensions | -- Extend83 |
| 1617 |
Ada83_Wording | -- DiffWord83 |
| 1618 |
Ada95_Inconsistencies | -- Inconsistent95 |
| 1619 |
Ada95_Incompatibilities | -- Incompatible95 |
| 1620 |
Ada95_Extensions | -- Extend95 |
| 1621 |
Ada95_Wording | -- DiffWord95 |
| 1622 |
Ada2005_Inconsistencies | -- Inconsistent2005 |
| 1623 |
Ada2005_Incompatibilities | -- Incompatible2005 |
| 1624 |
Ada2005_Extensions | -- Extend2005 |
| 1625 |
Ada2005_Wording | -- DiffWord2005 |
| 1626 |
Ada2012_Inconsistencies | -- Inconsistent2012 |
| 1627 |
Ada2012_Incompatibilities | -- Incompatible2012 |
| 1628 |
Ada2012_Extensions | -- Extend2012 |
| 1629 |
Ada2012_Wording => -- DiffWord2012 |
| 1630 |
Format_Object.Style := ARM_Output.Small; |
| 1631 |
Format_Object.Indent := 2; -- Two units. |
| 1632 |
Format_Object.No_Breaks := False; |
| 1633 |
when Reason | Ramification | Proof | |
| 1634 |
Imp_Note | Corr_Change | Discussion | |
| 1635 |
Honest | Glossary_Marker | Bare_Annotation => |
| 1636 |
Format_Object.Style := ARM_Output.Small; |
| 1637 |
Format_Object.Indent := 2; -- Two units. |
| 1638 |
Format_Object.No_Breaks := False; |
| 1639 |
|
| 1640 |
when Example_Text | Child_Example_Text | |
| 1641 |
Indented_Example_Text => |
| 1642 |
case Format_Object.Examples_Font is |
| 1643 |
when ARM_Output.Fixed | ARM_Output.Default => |
| 1644 |
if Is_Small_Format_Paragraph (Format_Object.Last_Paragraph_Subhead_Type) then |
| 1645 |
--if not Is_AARM_Paragraph (Format_Object.Last_Paragraph_Subhead_Type) and then |
| 1646 |
-- Format_Object.Last_Paragraph_Subhead_Type /= Small then |
| 1647 |
-- Ada.Text_IO.Put_Line ("$$ Example in notes: size change, line " & ARM_Input.Line_String (Input_Object)); |
| 1648 |
--end if; |
| 1649 |
Format_Object.Style := ARM_Output.Small_Examples; |
| 1650 |
else |
| 1651 |
Format_Object.Style := ARM_Output.Examples; |
| 1652 |
end if; |
| 1653 |
when ARM_Output.Roman => |
| 1654 |
if Is_Small_Format_Paragraph (Format_Object.Last_Paragraph_Subhead_Type) then |
| 1655 |
Format_Object.Style := ARM_Output.Small; |
| 1656 |
else |
| 1657 |
Format_Object.Style := ARM_Output.Normal; |
| 1658 |
end if; |
| 1659 |
when ARM_Output.Swiss => |
| 1660 |
if Is_Small_Format_Paragraph (Format_Object.Last_Paragraph_Subhead_Type) then |
| 1661 |
Format_Object.Style := ARM_Output.Small_Swiss_Examples; |
| 1662 |
else |
| 1663 |
Format_Object.Style := ARM_Output.Swiss_Examples; |
| 1664 |
end if; |
| 1665 |
end case; |
| 1666 |
Format_Object.No_Breaks := True; |
| 1667 |
if For_Type = Child_Example_Text then |
| 1668 |
Format_Object.Indent := 1 + Enclosing_Indent; |
| 1669 |
--Ada.Text_IO.Put_Line ("&& Child example paragraph, line " & ARM_Input.Line_String (Input_Object) & " EF=" & Paragraph_Type'Image(Enclosing_Format) & " Indent=" & |
| 1670 |
-- ARM_Output.Paragraph_Indent_Type'Image(Format_Object.Indent)); |
| 1671 |
elsif For_Type = Indented_Example_Text then |
| 1672 |
if Is_AARM_Paragraph (Format_Object.Last_Paragraph_Subhead_Type) then |
| 1673 |
Format_Object.Indent := 6; -- Fixed indent. |
| 1674 |
elsif Format_Object.Last_Paragraph_Subhead_Type = Notes or else |
| 1675 |
Format_Object.Last_Paragraph_Subhead_Type = Single_Note then |
| 1676 |
Format_Object.Indent := 5; -- Fixed indent. |
| 1677 |
else |
| 1678 |
Format_Object.Indent := 4; -- Fixed indent. |
| 1679 |
end if; |
| 1680 |
else |
| 1681 |
if Is_AARM_Paragraph (Format_Object.Last_Paragraph_Subhead_Type) then |
| 1682 |
Format_Object.Indent := 3; -- Fixed indent. |
| 1683 |
elsif Format_Object.Last_Paragraph_Subhead_Type = Notes or else |
| 1684 |
Format_Object.Last_Paragraph_Subhead_Type = Single_Note then |
| 1685 |
Format_Object.Indent := 2; -- Fixed indent. |
| 1686 |
else |
| 1687 |
Format_Object.Indent := 1; -- Fixed indent. |
| 1688 |
end if; |
| 1689 |
end if; |
| 1690 |
|
| 1691 |
when Code_Indented => |
| 1692 |
if Is_AARM_Paragraph (Format_Object.Last_Paragraph_Subhead_Type) then |
| 1693 |
Format_Object.Style := ARM_Output.Small; |
| 1694 |
Format_Object.Indent := 4; -- Four units. |
| 1695 |
elsif Format_Object.Last_Paragraph_Subhead_Type = Notes or else |
| 1696 |
Format_Object.Last_Paragraph_Subhead_Type = Single_Note then |
| 1697 |
Format_Object.Style := ARM_Output.Small; |
| 1698 |
Format_Object.Indent := 3; -- Three units. |
| 1699 |
elsif Format_Object.Last_Paragraph_Subhead_Type = Small then |
| 1700 |
Format_Object.Style := ARM_Output.Small; |
| 1701 |
Format_Object.Indent := 2; -- Two units. |
| 1702 |
else |
| 1703 |
Format_Object.Style := ARM_Output.Normal; |
| 1704 |
Format_Object.Indent := 2; -- Two indent. |
| 1705 |
end if; |
| 1706 |
Format_Object.No_Breaks := False; |
| 1707 |
|
| 1708 |
when Indent => |
| 1709 |
if Is_Small_Format_Paragraph (Format_Object.Last_Paragraph_Subhead_Type) then |
| 1710 |
Format_Object.Style := ARM_Output.Small; |
| 1711 |
else |
| 1712 |
Format_Object.Style := ARM_Output.Normal; |
| 1713 |
end if; |
| 1714 |
if Enclosing_Indent = Arm_Output.Paragraph_Indent_Type'Last then |
| 1715 |
raise Program_Error with |
| 1716 |
"Overindented (indent) text on line " & ARM_Input.Line_String (Input_Object); |
| 1717 |
else |
| 1718 |
Format_Object.Indent := 1 + Enclosing_Indent; |
| 1719 |
end if; |
| 1720 |
--Ada.Text_IO.Put_Line ("&& Child Indented paragraph, line " & ARM_Input.Line_String (Input_Object) & " EF=" & Paragraph_Type'Image(Enclosing_Format) & " Indent=" & |
| 1721 |
-- ARM_Output.Paragraph_Indent_Type'Image(Format_Object.Indent)); |
| 1722 |
Format_Object.No_Breaks := False; |
| 1723 |
|
| 1724 |
when Bulleted => |
| 1725 |
if Is_Small_Format_Paragraph (Format_Object.Last_Paragraph_Subhead_Type) then |
| 1726 |
Format_Object.Style := ARM_Output.Small_Bulleted; |
| 1727 |
else |
| 1728 |
Format_Object.Style := ARM_Output.Bulleted; |
| 1729 |
end if; |
| 1730 |
if Enclosing_Indent = Arm_Output.Paragraph_Indent_Type'Last then |
| 1731 |
raise Program_Error with |
| 1732 |
"Overindented (bullet) text on line " & ARM_Input.Line_String (Input_Object); |
| 1733 |
else |
| 1734 |
Format_Object.Indent := 1 + Enclosing_Indent; |
| 1735 |
end if; |
| 1736 |
--Ada.Text_IO.Put_Line ("&& Regular bulleted paragraph, line " & ARM_Input.Line_String (Input_Object) & " EF=" & Paragraph_Type'Image(Enclosing_Format) & " Indent=" & |
| 1737 |
-- ARM_Output.Paragraph_Indent_Type'Image(Format_Object.Indent)); |
| 1738 |
Format_Object.Paragraph_Tab_Stops := ARM_Output.NO_TABS; |
| 1739 |
Format_Object.No_Breaks := False; |
| 1740 |
|
| 1741 |
when Nested_Bulleted => |
| 1742 |
if Is_Small_Format_Paragraph (Format_Object.Last_Paragraph_Subhead_Type) then |
| 1743 |
Format_Object.Style := ARM_Output.Small_Nested_Bulleted; |
| 1744 |
else |
| 1745 |
Format_Object.Style := ARM_Output.Nested_Bulleted; |
| 1746 |
end if; |
| 1747 |
if Enclosing_Indent = Arm_Output.Paragraph_Indent_Type'Last then |
| 1748 |
raise Program_Error with |
| 1749 |
"Overindented (nestbullet) text on line " & ARM_Input.Line_String (Input_Object); |
| 1750 |
else |
| 1751 |
Format_Object.Indent := 1 + Enclosing_Indent; |
| 1752 |
end if; |
| 1753 |
--Ada.Text_IO.Put_Line ("&& Nested bulleted paragraph, line " & ARM_Input.Line_String (Input_Object) & " EF=" & Paragraph_Type'Image(Enclosing_Format) & " Indent=" & |
| 1754 |
-- ARM_Output.Paragraph_Indent_Type'Image(Format_Object.Indent)); |
| 1755 |
Format_Object.Paragraph_Tab_Stops := ARM_Output.NO_TABS; |
| 1756 |
Format_Object.No_Breaks := False; |
| 1757 |
|
| 1758 |
when Nested_X2_Bulleted => |
| 1759 |
if Is_Small_Format_Paragraph (Format_Object.Last_Paragraph_Subhead_Type) then |
| 1760 |
Format_Object.Style := ARM_Output.Small_Nested_Bulleted; |
| 1761 |
else |
| 1762 |
Format_Object.Style := ARM_Output.Nested_Bulleted; |
| 1763 |
end if; |
| 1764 |
Format_Object.Indent := 1 + Enclosing_Indent; |
| 1765 |
--Ada.Text_IO.Put_Line ("&& Nested X2 bulleted paragraph, line " & ARM_Input.Line_String (Input_Object) & " EF=" & Paragraph_Type'Image(Enclosing_Format) & " Indent=" & |
| 1766 |
-- ARM_Output.Paragraph_Indent_Type'Image(Format_Object.Indent)); |
| 1767 |
Format_Object.Paragraph_Tab_Stops := ARM_Output.NO_TABS; |
| 1768 |
Format_Object.No_Breaks := False; |
| 1769 |
|
| 1770 |
when Display => |
| 1771 |
if Is_Small_Format_Paragraph (Format_Object.Last_Paragraph_Subhead_Type) then |
| 1772 |
Format_Object.Style := ARM_Output.Small; |
| 1773 |
else |
| 1774 |
Format_Object.Style := ARM_Output.Normal; |
| 1775 |
end if; |
| 1776 |
Format_Object.Indent := 1 + Enclosing_Indent; |
| 1777 |
--Ada.Text_IO.Put_Line ("&& Display paragraph, line " & ARM_Input.Line_String (Input_Object) & " EF=" & Paragraph_Type'Image(Enclosing_Format) & " Indent=" & |
| 1778 |
-- ARM_Output.Paragraph_Indent_Type'Image(Format_Object.Indent)); |
| 1779 |
Format_Object.No_Breaks := True; |
| 1780 |
|
| 1781 |
when Syntax_Display => |
| 1782 |
Format_Object.Style := ARM_Output.Small; |
| 1783 |
Format_Object.Indent := 1; |
| 1784 |
Format_Object.No_Breaks := True; |
| 1785 |
|
| 1786 |
when Enumerated => |
| 1787 |
if Is_Small_Format_Paragraph (Format_Object.Last_Paragraph_Subhead_Type) then |
| 1788 |
Format_Object.Style := ARM_Output.Small_Enumerated; |
| 1789 |
else |
| 1790 |
Format_Object.Style := ARM_Output.Enumerated; |
| 1791 |
end if; |
| 1792 |
Format_Object.Indent := 1 + Enclosing_Indent; |
| 1793 |
--Ada.Text_IO.Put_Line ("&& Regular enumerated paragraph, line " & ARM_Input.Line_String (Input_Object) & " EF=" & Paragraph_Type'Image(Enclosing_Format) & " Indent=" & |
| 1794 |
-- ARM_Output.Paragraph_Indent_Type'Image(Format_Object.Indent)); |
| 1795 |
Format_Object.Paragraph_Tab_Stops := ARM_Output.NO_TABS; |
| 1796 |
Format_Object.No_Breaks := False; |
| 1797 |
|
| 1798 |
when Nested_Enumerated => |
| 1799 |
if Is_Small_Format_Paragraph (Format_Object.Last_Paragraph_Subhead_Type) then |
| 1800 |
Format_Object.Style := ARM_Output.Small_Enumerated; |
| 1801 |
else |
| 1802 |
Format_Object.Style := ARM_Output.Enumerated; |
| 1803 |
end if; |
| 1804 |
Format_Object.Indent := 1 + Enclosing_Indent; |
| 1805 |
--Ada.Text_IO.Put_Line ("&& Nested enumerated paragraph, line " & ARM_Input.Line_String (Input_Object) & " EF=" & Paragraph_Type'Image(Enclosing_Format) & " Indent=" & |
| 1806 |
-- ARM_Output.Paragraph_Indent_Type'Image(Format_Object.Indent)); |
| 1807 |
-- Note: The difference here is the numbering, not the |
| 1808 |
-- layout. |
| 1809 |
Format_Object.Paragraph_Tab_Stops := ARM_Output.NO_TABS; |
| 1810 |
Format_Object.No_Breaks := False; |
| 1811 |
|
| 1812 |
when Syntax_Indented => |
| 1813 |
Format_Object.Style := ARM_Output.Normal; |
| 1814 |
Format_Object.Indent := 1; -- One unit. |
| 1815 |
Format_Object.No_Breaks := False; |
| 1816 |
when Syntax_Production => |
| 1817 |
null; -- Leave format alone (but line-breaks are preserved). |
| 1818 |
Format_Object.No_Breaks := True; |
| 1819 |
|
| 1820 |
when Hanging_Indented_1 => |
| 1821 |
if Is_Small_Format_Paragraph (Format_Object.Last_Paragraph_Subhead_Type) then |
| 1822 |
Format_Object.Style := ARM_Output.Small_Narrow_Hanging; |
| 1823 |
else -- Normal: |
| 1824 |
Format_Object.Style := ARM_Output.Narrow_Hanging; |
| 1825 |
end if; |
| 1826 |
Format_Object.Indent := 1 + Enclosing_Indent; |
| 1827 |
Format_Object.Paragraph_Tab_Stops := ARM_Output.NO_TABS; |
| 1828 |
Format_Object.No_Breaks := False; |
| 1829 |
|
| 1830 |
when Hanging_Indented_2 => |
| 1831 |
if Is_Small_Format_Paragraph (Format_Object.Last_Paragraph_Subhead_Type) then |
| 1832 |
if Enclosing_Format = Bulleted or else |
| 1833 |
Enclosing_Format = Enumerated then |
| 1834 |
Format_Object.Style := ARM_Output.Small_Hanging_in_Bulleted; |
| 1835 |
-- The right margin is also adjusted in this case. |
| 1836 |
-- This is a weird special case, used only in |
| 1837 |
-- RM 11.5. |
| 1838 |
else |
| 1839 |
Format_Object.Style := ARM_Output.Small_Medium_Hanging; |
| 1840 |
end if; |
| 1841 |
else -- Normal: |
| 1842 |
if Enclosing_Format = Bulleted or else |
| 1843 |
Enclosing_Format = Enumerated then |
| 1844 |
Format_Object.Style := ARM_Output.Hanging_in_Bulleted; |
| 1845 |
-- The right margin is also adjusted in this case. |
| 1846 |
else |
| 1847 |
Format_Object.Style := ARM_Output.Medium_Hanging; |
| 1848 |
end if; |
| 1849 |
end if; |
| 1850 |
Format_Object.Indent := 2 + Enclosing_Indent; |
| 1851 |
Format_Object.Paragraph_Tab_Stops := ARM_Output.NO_TABS; |
| 1852 |
Format_Object.No_Breaks := False; |
| 1853 |
|
| 1854 |
when Hanging_Indented_3 => |
| 1855 |
if Is_Small_Format_Paragraph (Format_Object.Last_Paragraph_Subhead_Type) then |
| 1856 |
Format_Object.Style := ARM_Output.Small_Wide_Hanging; |
| 1857 |
else -- Normal: |
| 1858 |
Format_Object.Style := ARM_Output.Wide_Hanging; |
| 1859 |
end if; |
| 1860 |
Format_Object.Indent := 3 + Enclosing_Indent; |
| 1861 |
Format_Object.Paragraph_Tab_Stops := ARM_Output.NO_TABS; |
| 1862 |
Format_Object.No_Breaks := False; |
| 1863 |
|
| 1864 |
when Hanging_Indented_4 => |
| 1865 |
if Is_Small_Format_Paragraph (Format_Object.Last_Paragraph_Subhead_Type) then |
| 1866 |
Format_Object.Style := ARM_Output.Small_Giant_Hanging; |
| 1867 |
else -- Normal: |
| 1868 |
Format_Object.Style := ARM_Output.Giant_Hanging; |
| 1869 |
end if; |
| 1870 |
Format_Object.Indent := 4 + Enclosing_Indent; |
| 1871 |
Format_Object.Paragraph_Tab_Stops := ARM_Output.NO_TABS; |
| 1872 |
Format_Object.No_Breaks := False; |
| 1873 |
|
| 1874 |
when Title => |
| 1875 |
Format_Object.Style := ARM_Output.Title; |
| 1876 |
Format_Object.Indent := 0; -- No indent. |
| 1877 |
Format_Object.No_Breaks := False; |
| 1878 |
when In_Table => |
| 1879 |
-- Shouldn't get here. |
| 1880 |
if Is_Small_Format_Paragraph (Format_Object.Last_Paragraph_Subhead_Type) then |
| 1881 |
Format_Object.Style := ARM_Output.Small; |
| 1882 |
else |
| 1883 |
Format_Object.Style := ARM_Output.Normal; |
| 1884 |
end if; |
| 1885 |
Format_Object.Indent := 0; -- No indent. |
| 1886 |
Format_Object.No_Breaks := False; |
| 1887 |
end case; |
| 1888 |
end Set_Format; |
| 1889 |
|
| 1890 |
|
| 1891 |
procedure Make_Subhead (For_Type : Paragraph_Type) is |
| 1892 |
begin |
| 1893 |
case For_Type is |
| 1894 |
when Syntax | |
| 1895 |
Resolution | |
| 1896 |
Legality | |
| 1897 |
Static_Semantics | |
| 1898 |
Link_Time | |
| 1899 |
Run_Time | |
| 1900 |
Bounded_Errors | |
| 1901 |
Erroneous | |
| 1902 |
Requirements | -- ImplReq |
| 1903 |
Documentation | -- DocReq |
| 1904 |
Metrics | |
| 1905 |
Permissions | -- ImplPerm |
| 1906 |
Advice | -- ImplAdvice |
| 1907 |
Examples => |
| 1908 |
ARM_Output.Category_Header (Output_Object, Data.Paragraph_Kind_Title(For_Type).Str(1..Data.Paragraph_Kind_Title(For_Type).Length)); |
| 1909 |
Format_Object.Last_Paragraph_Subhead_Type := For_Type; |
| 1910 |
when Notes | Single_Note => -- Notes |
| 1911 |
if not Format_Object.Use_ISO_2004_Note_Format then |
| 1912 |
-- The Notes header looks different from the others. |
| 1913 |
ARM_Output.Start_Paragraph (Output_Object, |
| 1914 |
Style => ARM_Output.Small_Header, |
| 1915 |
Indent => 1, |
| 1916 |
Number => "", |
| 1917 |
No_Breaks => True, |
| 1918 |
Keep_with_Next => True); |
| 1919 |
ARM_Output.Ordinary_Text (Output_Object, Data.Paragraph_Kind_Title(For_Type).Str(1..Data.Paragraph_Kind_Title(For_Type).Length)); |
| 1920 |
ARM_Output.End_Paragraph (Output_Object); |
| 1921 |
Format_Object.Last_Paragraph_Subhead_Type := For_Type; |
| 1922 |
--!!Debug: |
| 1923 |
--Ada.Text_IO.Put_Line ("Write notes header"); |
| 1924 |
else |
| 1925 |
null; -- No subheader. We don't change the last |
| 1926 |
-- subheader generated, either. |
| 1927 |
end if; |
| 1928 |
when Language_Design | -- "MetaRules" |
| 1929 |
Ada83_Inconsistencies | -- Inconsistent83 |
| 1930 |
Ada83_Incompatibilities | -- Incompatible83 |
| 1931 |
Ada83_Extensions | -- Extend83 |
| 1932 |
Ada83_Wording | -- DiffWord83 |
| 1933 |
Ada95_Inconsistencies | -- Inconsistent95 |
| 1934 |
Ada95_Incompatibilities | -- Incompatible95 |
| 1935 |
Ada95_Extensions | -- Extend95 |
| 1936 |
Ada95_Wording | -- DiffWord95 |
| 1937 |
Ada2005_Inconsistencies | -- Inconsistent2005 |
| 1938 |
Ada2005_Incompatibilities | -- Incompatible2005 |
| 1939 |
Ada2005_Extensions | -- Extend2005 |
| 1940 |
Ada2005_Wording | -- DiffWord2005 |
| 1941 |
Ada2012_Inconsistencies | -- Inconsistent2012 |
| 1942 |
Ada2012_Incompatibilities | -- Incompatible2012 |
| 1943 |
Ada2012_Extensions | -- Extend2012 |
| 1944 |
Ada2012_Wording => -- DiffWord2012 |
| 1945 |
ARM_Output.Category_Header (Output_Object, Paragraph_Kind_Title(For_Type).Str(1..Paragraph_Kind_Title(For_Type).Length)); |
| 1946 |
Format_Object.Last_Paragraph_Subhead_Type := For_Type; |
| 1947 |
when Plain | Introduction | Element_Ref | Child_Ref | Usage_Note => |
| 1948 |
null; -- No subheader. We don't change the last |
| 1949 |
-- subheader generated, either. |
| 1950 |
when Reason | Ramification | Proof | |
| 1951 |
Imp_Note | Corr_Change | Discussion | |
| 1952 |
Honest | Glossary_Marker | Bare_Annotation | |
| 1953 |
Wide_Above | Example_Text | Child_Example_Text | |
| 1954 |
Indented_Example_Text | Code_Indented | Indent | |
| 1955 |
Bulleted | Nested_Bulleted | Nested_X2_Bulleted | |
| 1956 |
Display | |
| 1957 |
Syntax_Display | Syntax_Indented | Syntax_Production | |
| 1958 |
Hanging_Indented_1 | Hanging_Indented_2 | |
| 1959 |
Hanging_Indented_3 | Hanging_Indented_4 | Title | |
| 1960 |
Enumerated | Nested_Enumerated | Small | |
| 1961 |
In_Table => |
| 1962 |
null; -- No subheader. We don't change the last |
| 1963 |
-- subheader generated, either. |
| 1964 |
end case; |
| 1965 |
end Make_Subhead; |
| 1966 |
|
| 1967 |
|
| 1968 |
procedure Make_Annotation_Preface (For_Type : Paragraph_Type) is |
| 1969 |
begin |
| 1970 |
case For_Type is |
| 1971 |
when Plain | Introduction | |
| 1972 |
Syntax | |
| 1973 |
Resolution | |
| 1974 |
Legality | |
| 1975 |
Static_Semantics | |
| 1976 |
Link_Time | |
| 1977 |
Run_Time | |
| 1978 |
Bounded_Errors | |
| 1979 |
Erroneous | |
| 1980 |
Requirements | -- ImplReq |
| 1981 |
Documentation | -- DocReq |
| 1982 |
Metrics | |
| 1983 |
Permissions | -- ImplPerm |
| 1984 |
Advice | -- ImplAdvice |
| 1985 |
Examples | |
| 1986 |
Notes | Single_Note | |
| 1987 |
Language_Design | -- "MetaRules" |
| 1988 |
Ada83_Inconsistencies | -- Inconsistent83 |
| 1989 |
Ada83_Incompatibilities | -- Incompatible83 |
| 1990 |
Ada83_Extensions | -- Extend83 |
| 1991 |
Ada83_Wording | -- DiffWord83 |
| 1992 |
Ada95_Inconsistencies | -- Inconsistent95 |
| 1993 |
Ada95_Incompatibilities | -- Incompatible95 |
| 1994 |
Ada95_Extensions | -- Extend95 |
| 1995 |
Ada95_Wording | -- DiffWord95 |
| 1996 |
Ada2005_Inconsistencies | -- Inconsistent2005 |
| 1997 |
Ada2005_Incompatibilities | -- Incompatible2005 |
| 1998 |
Ada2005_Extensions | -- Extend2005 |
| 1999 |
Ada2005_Wording | -- DiffWord2005 |
| 2000 |
Ada2012_Inconsistencies | -- Inconsistent2012 |
| 2001 |
Ada2012_Incompatibilities | -- Incompatible2012 |
| 2002 |
Ada2012_Extensions | -- Extend2012 |
| 2003 |
Ada2012_Wording => -- DiffWord2012 |
| 2004 |
null; -- Not an annotation. |
| 2005 |
when Reason | Ramification | Proof | |
| 2006 |
Imp_Note | Corr_Change | Discussion | |
| 2007 |
Honest | Glossary_Marker | |
| 2008 |
Element_Ref | Child_Ref | Usage_Note => |
| 2009 |
declare |
| 2010 |
Format_Bold : ARM_Output.Format_Type := |
| 2011 |
Format_Object.Text_Format; |
| 2012 |
begin |
| 2013 |
Format_Bold.Bold := True; |
| 2014 |
ARM_Output.Text_Format (Output_Object, |
| 2015 |
Format => Format_Bold); |
| 2016 |
end; |
| 2017 |
ARM_Output.Ordinary_Text (Output_Object, |
| 2018 |
Text => Paragraph_Kind_Title(For_Type).Str( |
| 2019 |
1..Paragraph_Kind_Title(For_Type).Length)); |
| 2020 |
ARM_Output.Text_Format (Output_Object, |
| 2021 |
Format => Format_Object.Text_Format); |
| 2022 |
Format_Object.Last_Paragraph_Subhead_Type := For_Type; |
| 2023 |
when Bare_Annotation => |
| 2024 |
null; -- Header (if any) is generated elsewhere. |
| 2025 |
when Wide_Above | |
| 2026 |
Example_Text | Child_Example_Text | Indented_Example_Text | |
| 2027 |
Code_Indented | Indent | |
| 2028 |
Bulleted | Nested_Bulleted | Nested_X2_Bulleted | |
| 2029 |
Display | Syntax_Display | |
| 2030 |
Syntax_Indented | Syntax_Production | |
| 2031 |
Hanging_Indented_1 | Hanging_Indented_2 | |
| 2032 |
Hanging_Indented_3 | Hanging_Indented_4 | Title | |
| 2033 |
Enumerated | Nested_Enumerated | Small | |
| 2034 |
In_Table => |
| 2035 |
null; -- Just a format. |
| 2036 |
end case; |
| 2037 |
end Make_Annotation_Preface; |
| 2038 |
|
| 2039 |
|
| 2040 |
function Show_Leading_Text_for_Paragraph return Boolean is |
| 2041 |
-- Returns True if the leading text (note number, |
| 2042 |
-- annotation preface, etc.) should be shown for this paragraph. |
| 2043 |
-- We assume that the current paragraph has a version less than |
| 2044 |
-- or equal to the one that we're displaying. |
| 2045 |
-- ** Note: This is not quite right. If this |
| 2046 |
-- paragraph is deleted, but a following one needs the |
| 2047 |
-- leading item, this will still lead the item out. |
| 2048 |
-- We *do* have enough information for that, at least in the |
| 2049 |
-- case of annotations: they can be marked as deleted, in |
| 2050 |
-- which case we don't need them here. *But* that information |
| 2051 |
-- doesn't get here in the case that we're not showing deletions. |
| 2052 |
-- I can't think of a fix right now, and the note numbers need |
| 2053 |
-- fixing ASAP. |
| 2054 |
begin |
| 2055 |
--Ada.Text_IO.Put_Line ("Show_Leading_Text, para kind: " & |
| 2056 |
--ARM_Database.Paragraph_Change_Kind_Type'Image(Format_Object.Next_Paragraph_Change_Kind) & |
| 2057 |
--"; version=" & Format_Object.Next_Paragraph_Version & "; on line " & Arm_Input.Line_String(Input_Object)); |
| 2058 |
if (ARM_Database."/=" (Format_Object.Next_Paragraph_Change_Kind, ARM_Database.Deleted) and then |
| 2059 |
ARM_Database."/=" (Format_Object.Next_Paragraph_Change_Kind, ARM_Database.Deleted_Inserted_Number) and then |
| 2060 |
ARM_Database."/=" (Format_Object.Next_Paragraph_Change_Kind, ARM_Database.Deleted_No_Delete_Message) and then |
| 2061 |
ARM_Database."/=" (Format_Object.Next_Paragraph_Change_Kind, ARM_Database.Deleted_Inserted_Number_No_Delete_Message)) then |
| 2062 |
-- Not a deleted paragraph. |
| 2063 |
--Ada.Text_IO.Put_Line ("%% True - Not deleted"); |
| 2064 |
return True; |
| 2065 |
end if; |
| 2066 |
case Format_Object.Changes is |
| 2067 |
when ARM_Format.Old_Only => |
| 2068 |
-- Display only the original version ('0'). |
| 2069 |
if ARM_Database."=" (Format_Object.Next_Paragraph_Change_Kind, ARM_Database.Deleted_Inserted_Number) or else |
| 2070 |
ARM_Database."=" (Format_Object.Next_Paragraph_Change_Kind, ARM_Database.Deleted_Inserted_Number_No_Delete_Message) then |
| 2071 |
--Ada.Text_IO.Put_Line ("%% True - Not original"); |
| 2072 |
return False; -- Not in the original document. |
| 2073 |
else |
| 2074 |
--Ada.Text_IO.Put_Line ("%% True - Original"); |
| 2075 |
return True; -- Probably in the original document. |
| 2076 |
-- (If the paragraph numbers were "new" in a |
| 2077 |
-- later version, we couldn't tell.) |
| 2078 |
end if; |
| 2079 |
when ARM_Format.New_Only => |
| 2080 |
-- Display only the version |
| 2081 |
-- Format_Object.Change_Version, no insertions or deletions. |
| 2082 |
--Ada.Text_IO.Put_Line ("%% False - New only"); |
| 2083 |
return False; -- This is always deleted. |
| 2084 |
when ARM_Format.Show_Changes | |
| 2085 |
ARM_Format.New_Changes => |
| 2086 |
-- Display only the the changes for versions |
| 2087 |
-- Format_Object.Base_Change_Version .. |
| 2088 |
-- Format_Object.Change_Version, older changes |
| 2089 |
-- are applied and newer changes are ignored. |
| 2090 |
-- (New_Changes shows deletions as a single |
| 2091 |
-- character for older versions of Word, but otherwise |
| 2092 |
-- is the same.) |
| 2093 |
if Format_Object.Next_Paragraph_Version < |
| 2094 |
Format_Object.Base_Change_Version then |
| 2095 |
-- Change version is older than we're displaying; |
| 2096 |
-- no text will be shown. |
| 2097 |
--Ada.Text_IO.Put_Line ("%% False - show changes, old version"); |
| 2098 |
return False; -- This is always deleted. |
| 2099 |
else |
| 2100 |
-- The correct version. |
| 2101 |
--Ada.Text_IO.Put_Line ("%% True - show changes, new enough version"); |
| 2102 |
return True; -- Show the item, as the old text |
| 2103 |
-- will be shown as deleted. |
| 2104 |
end if; |
| 2105 |
end case; |
| 2106 |
end Show_Leading_Text_for_Paragraph; |
| 2107 |
|
| 2108 |
begin |
| 2109 |
if not Format_Object.In_Paragraph then |
| 2110 |
-- Output subheader, if needed. |
| 2111 |
if Format_Object.Next_Paragraph_Subhead_Type /= |
| 2112 |
Format_Object.Last_Paragraph_Subhead_Type then |
| 2113 |
if (ARM_Database."=" (Format_Object.Next_Paragraph_Change_Kind, ARM_Database.Deleted_No_Delete_Message) or else |
| 2114 |
ARM_Database."=" (Format_Object.Next_Paragraph_Change_Kind, ARM_Database.Deleted_Inserted_Number_No_Delete_Message)) and then |
| 2115 |
ARM_Format."=" (Format_Object.Changes, ARM_Format.New_Only) then |
| 2116 |
-- Nothing at all should be showm. |
| 2117 |
null; |
| 2118 |
if Format_Object.Next_Paragraph_Subhead_Type /= Plain and then |
| 2119 |
Format_Object.Next_Paragraph_Subhead_Type /= Introduction then |
| 2120 |
Ada.Text_IO.Put_Line(" -- No subhead (DelNoMsg); on line " & Arm_Input.Line_String(Input_Object)); |
| 2121 |
end if; |
| 2122 |
elsif ((not Format_Object.Number_Paragraphs) or else |
| 2123 |
Format_Object.No_Para_Num) and then |
| 2124 |
(ARM_Database."=" (Format_Object.Next_Paragraph_Change_Kind, ARM_Database.Deleted) or else |
| 2125 |
ARM_Database."=" (Format_Object.Next_Paragraph_Change_Kind, ARM_Database.Deleted_Inserted_Number)) and then |
| 2126 |
ARM_Format."=" (Format_Object.Changes, ARM_Format.New_Only) then |
| 2127 |
-- Nothing at all should be showm. |
| 2128 |
null; |
| 2129 |
if Format_Object.Next_Paragraph_Subhead_Type /= Plain and then |
| 2130 |
Format_Object.Next_Paragraph_Subhead_Type /= Introduction then |
| 2131 |
Ada.Text_IO.Put_Line(" -- No subhead (Del-no paranum); on line " & Arm_Input.Line_String(Input_Object)); |
| 2132 |
end if; |
| 2133 |
else |
| 2134 |
Make_Subhead (Format_Object.Next_Paragraph_Subhead_Type); |
| 2135 |
end if; |
| 2136 |
end if; |
| 2137 |
|
| 2138 |
-- Set the paragraph format: |
| 2139 |
Set_Format (Format_Object.Next_Paragraph_Format_Type); |
| 2140 |
|
| 2141 |
if Format_Object.Number_Paragraphs and then |
| 2142 |
not Format_Object.No_Para_Num then |
| 2143 |
|
| 2144 |
-- Format the paragraph number: |
| 2145 |
Paragraph_Number_String (Update_Numbers => True); |
| 2146 |
|
| 2147 |
--Ada.Text_IO.Put_Line ("Check_Paragraph, make number " & |
| 2148 |
--Format_Object.Current_Paragraph_String (1 .. Format_Object.Current_Paragraph_Len) & |
| 2149 |
--": format= " & Paragraph_Type'Image(Format_Object.Next_Paragraph_Format_Type)); |
| 2150 |
-- ...and start the paragraph: |
| 2151 |
if (ARM_Database."=" (Format_Object.Next_Paragraph_Change_Kind, ARM_Database.Deleted_No_Delete_Message) or else |
| 2152 |
ARM_Database."=" (Format_Object.Next_Paragraph_Change_Kind, ARM_Database.Deleted_Inserted_Number_No_Delete_Message)) and then |
| 2153 |
ARM_Format."=" (Format_Object.Changes, ARM_Format.New_Only) then |
| 2154 |
-- Nothing at all should be showm. |
| 2155 |
-- ** Warning ** If we lie here, the program will crash! |
| 2156 |
Format_Object.No_Start_Paragraph := True; |
| 2157 |
Ada.Text_IO.Put_Line (" -- No Start Paragraph (DelNoMsg)"); |
| 2158 |
Ada.Text_IO.Put_Line (" Skipped number " & Format_Object.Current_Paragraph_String (1 .. Format_Object.Current_Paragraph_Len)); |
| 2159 |
else |
| 2160 |
ARM_Output.Start_Paragraph (Output_Object, |
| 2161 |
Style => Format_Object.Style, |
| 2162 |
Indent => Format_Object.Indent, |
| 2163 |
Number => Format_Object.Current_Paragraph_String (1 .. Format_Object.Current_Paragraph_Len), |
| 2164 |
No_Prefix => Format_Object.No_Prefix, |
| 2165 |
Tab_Stops => Format_Object.Paragraph_Tab_Stops, |
| 2166 |
No_Breaks => Format_Object.No_Breaks or Format_Object.In_Bundle, |
| 2167 |
Keep_with_Next => Format_Object.Keep_with_Next or Format_Object.In_Bundle, |
| 2168 |
Space_After => Format_Object.Space_After); |
| 2169 |
Format_Object.No_Start_Paragraph := False; |
| 2170 |
end if; |
| 2171 |
if ARM_Database."=" (Format_Object.Next_Paragraph_Change_Kind, ARM_Database.Deleted) or else |
| 2172 |
ARM_Database."=" (Format_Object.Next_Paragraph_Change_Kind, ARM_Database.Deleted_Inserted_Number) then |
| 2173 |
-- If needed, make the "deleted text" message. |
| 2174 |
-- We trust that Next_Paragraph_Change_Kind is not |
| 2175 |
-- set to Deleted if the version number of the change |
| 2176 |
-- is beyond the document generation version. |
| 2177 |
-- (Note that Current_Change_Version may not be set, |
| 2178 |
-- so it is not safe to test here.) |
| 2179 |
case Format_Object.Changes is |
| 2180 |
when ARM_Format.New_Only | |
| 2181 |
ARM_Format.Show_Changes | |
| 2182 |
ARM_Format.New_Changes => |
| 2183 |
-- Note that we include this in the |
| 2184 |
-- "Show_Changes" version, even when the item |
| 2185 |
-- is older than the base change version, |
| 2186 |
-- so that complete paragraph deletions are obvious, |
| 2187 |
-- and also so that we can use revision bars rather than |
| 2188 |
-- displaying the changes in the RM version. |
| 2189 |
if ARM_Format."=" (Format_Object.Changes, ARM_Format.New_Only) and then |
| 2190 |
(Format_Object.Next_Paragraph_Format_Type = Enumerated or else |
| 2191 |
Format_Object.Next_Paragraph_Format_Type = Nested_Enumerated or else |
| 2192 |
Format_Object.Next_Paragraph_Format_Type = Hanging_Indented_1 or else |
| 2193 |
Format_Object.Next_Paragraph_Format_Type = Hanging_Indented_2 or else |
| 2194 |
Format_Object.Next_Paragraph_Format_Type = Hanging_Indented_3 or else |
| 2195 |
Format_Object.Next_Paragraph_Format_Type = Hanging_Indented_4) then |
| 2196 |
-- We're in a hanging style, we need to end hanging first. |
| 2197 |
-- Nothing else will be displayed; if we didn't end the hang this |
| 2198 |
-- would end up on the same line as the next paragraph. |
| 2199 |
-- It's possible that we could have a problem with |
| 2200 |
-- hanging in one of the other cases if no text will be |
| 2201 |
-- displayed, but there is no way to know that here. |
| 2202 |
ARM_Output.End_Hang_Item (Output_Object); |
| 2203 |
end if; |
| 2204 |
ARM_Output.Text_Format (Output_Object, |
| 2205 |
Format => (Bold => Format_Object.Text_Format.Bold, |
| 2206 |
Italic => True, |
| 2207 |
Font => Format_Object.Text_Format.Font, |
| 2208 |
Color => Format_Object.Text_Format.Color, |
| 2209 |
Change => ARM_Output.None, -- Never mark this as changed!! |
| 2210 |
Version => '0', Added_Version => '0', -- Not used. |
| 2211 |
Size => ARM_Output."-"(Format_Object.Text_Format.Size, 1), |
| 2212 |
Location => Format_Object.Text_Format.Location)); |
| 2213 |
ARM_Output.Ordinary_Text (Output_Object, |
| 2214 |
Text => "This paragraph was deleted."); |
| 2215 |
ARM_Output.Text_Format (Output_Object, -- Restore the format. |
| 2216 |
Format => Format_Object.Text_Format); |
| 2217 |
when ARM_Format.Old_Only => null; -- Not deleted. |
| 2218 |
end case; |
| 2219 |
end if; |
| 2220 |
Format_Object.In_Paragraph := True; |
| 2221 |
Format_Object.Last_Non_Space := False; |
| 2222 |
|
| 2223 |
else -- No paragraph numbers (or if the paragraph |
| 2224 |
-- number has been suppressed with @NoParaNum): |
| 2225 |
|
| 2226 |
--Ada.Text_IO.Put_Line ("Check_Paragraph, no number: format= " & Paragraph_Type'Image(Format_Object.Next_Paragraph_Format_Type) & |
| 2227 |
-- " output style= " & ARM_Output.Paragraph_Style_Type'Image(Format_Object.Style)); |
| 2228 |
-- Start the paragraph: |
| 2229 |
if (ARM_Database."=" (Format_Object.Next_Paragraph_Change_Kind, ARM_Database.Deleted_No_Delete_Message) or else |
| 2230 |
ARM_Database."=" (Format_Object.Next_Paragraph_Change_Kind, ARM_Database.Deleted_Inserted_Number_No_Delete_Message) or else |
| 2231 |
ARM_Database."=" (Format_Object.Next_Paragraph_Change_Kind, ARM_Database.Deleted) or else |
| 2232 |
ARM_Database."=" (Format_Object.Next_Paragraph_Change_Kind, ARM_Database.Deleted_Inserted_Number)) and then |
| 2233 |
ARM_Format."=" (Format_Object.Changes, ARM_Format.New_Only) then |
| 2234 |
-- Nothing at all should be showm. |
| 2235 |
-- ** Warning ** If we lie here, the program will crash! |
| 2236 |
Format_Object.No_Start_Paragraph := True; |
| 2237 |
Ada.Text_IO.Put_Line(" -- No Start Paragraph (Del-NewOnly)"); |
| 2238 |
else |
| 2239 |
ARM_Output.Start_Paragraph (Output_Object, |
| 2240 |
Style => Format_Object.Style, |
| 2241 |
Indent => Format_Object.Indent, |
| 2242 |
Number => "", |
| 2243 |
No_Prefix => Format_Object.No_Prefix, |
| 2244 |
Tab_Stops => Format_Object.Paragraph_Tab_Stops, |
| 2245 |
No_Breaks => Format_Object.No_Breaks or Format_Object.In_Bundle, |
| 2246 |
Keep_with_Next => Format_Object.Keep_with_Next or Format_Object.In_Bundle, |
| 2247 |
Space_After => Format_Object.Space_After); |
| 2248 |
Format_Object.In_Paragraph := True; |
| 2249 |
Format_Object.No_Start_Paragraph := False; |
| 2250 |
Format_Object.Current_Paragraph_Len := 0; -- Empty paragraph number. |
| 2251 |
Format_Object.No_Para_Num := False; |
| 2252 |
end if; |
| 2253 |
end if; |
| 2254 |
|
| 2255 |
if not Format_Object.No_Prefix then |
| 2256 |
if Format_Object.Next_Paragraph_Format_Type = Notes and then |
| 2257 |
Show_Leading_Text_for_Paragraph then |
| 2258 |
if not Format_Object.Use_ISO_2004_Note_Format then |
| 2259 |
-- Output the note number (Ada95 format). |
| 2260 |
declare |
| 2261 |
NNum : constant String := Integer'Image(Format_Object.Next_Note); |
| 2262 |
begin |
| 2263 |
ARM_Output.Ordinary_Text (Output_Object, |
| 2264 |
NNum(2..NNum'Last)); |
| 2265 |
ARM_Output.Hard_Space (Output_Object); |
| 2266 |
ARM_Output.Hard_Space (Output_Object); |
| 2267 |
Format_Object.Next_Note := Format_Object.Next_Note + 1; |
| 2268 |
end; |
| 2269 |
else |
| 2270 |
-- Output the note header (ISO 2004 format). |
| 2271 |
declare |
| 2272 |
NNum : constant String := Integer'Image(Format_Object.Next_Note); |
| 2273 |
begin |
| 2274 |
ARM_Output.Ordinary_Text (Output_Object, |
| 2275 |
"NOTE " & NNum(2..NNum'Last)); |
| 2276 |
ARM_Output.Hard_Space (Output_Object); |
| 2277 |
ARM_Output.Hard_Space (Output_Object); |
| 2278 |
ARM_Output.Hard_Space (Output_Object); |
| 2279 |
Format_Object.Next_Note := Format_Object.Next_Note + 1; |
| 2280 |
end; |
| 2281 |
end if; |
| 2282 |
elsif Format_Object.Next_Paragraph_Format_Type = Single_Note and then |
| 2283 |
Show_Leading_Text_for_Paragraph then |
| 2284 |
if not Format_Object.Use_ISO_2004_Note_Format then |
| 2285 |
-- No note number, and nothing else needed. |
| 2286 |
null; |
| 2287 |
else |
| 2288 |
-- Output the note header (ISO 2004 format) |
| 2289 |
-- without a number. |
| 2290 |
ARM_Output.Ordinary_Text (Output_Object, |
| 2291 |
"NOTE"); |
| 2292 |
ARM_Output.Hard_Space (Output_Object); |
| 2293 |
ARM_Output.Hard_Space (Output_Object); |
| 2294 |
ARM_Output.Hard_Space (Output_Object); |
| 2295 |
end if; |
| 2296 |
elsif (Format_Object.Next_Paragraph_Format_Type = Enumerated or else |
| 2297 |
Format_Object.Next_Paragraph_Format_Type = Nested_Enumerated) and then |
| 2298 |
Show_Leading_Text_for_Paragraph then |
| 2299 |
-- Output the item number. |
| 2300 |
if Format_Object.Use_ISO_2004_Note_Format then |
| 2301 |
if Format_Object.Enumerated_Level <= 1 then -- Outer list. |
| 2302 |
-- Lower case letters for list: |
| 2303 |
ARM_Output.Ordinary_Text (Output_Object, |
| 2304 |
Character'Val ((Format_Object.Next_Enumerated_Num - 1) + |
| 2305 |
Character'Pos ('a')) |
| 2306 |
& ')'); |
| 2307 |
ARM_Output.End_Hang_Item (Output_Object); |
| 2308 |
Format_Object.Next_Enumerated_Num := Format_Object.Next_Enumerated_Num + 1; |
| 2309 |
else -- numbered. |
| 2310 |
declare |
| 2311 |
NNum : constant String := Integer'Image(Format_Object.Next_Enumerated_Num); |
| 2312 |
begin |
| 2313 |
ARM_Output.Ordinary_Text (Output_Object, |
| 2314 |
NNum(2..NNum'Last) & ')'); |
| 2315 |
ARM_Output.End_Hang_Item (Output_Object); |
| 2316 |
Format_Object.Next_Enumerated_Num := Format_Object.Next_Enumerated_Num + 1; |
| 2317 |
end; |
| 2318 |
end if; |
| 2319 |
else -- Ada 95 lists. |
| 2320 |
declare |
| 2321 |
NNum : constant String := Integer'Image(Format_Object.Next_Enumerated_Num); |
| 2322 |
begin |
| 2323 |
ARM_Output.Ordinary_Text (Output_Object, |
| 2324 |
NNum(2..NNum'Last) & '.'); |
| 2325 |
ARM_Output.End_Hang_Item (Output_Object); |
| 2326 |
Format_Object.Next_Enumerated_Num := Format_Object.Next_Enumerated_Num + 1; |
| 2327 |
end; |
| 2328 |
end if; |
| 2329 |
end if; |
| 2330 |
else -- No prefix marked, meaning no number. |
| 2331 |
Format_Object.No_Prefix := False; -- Reset. |
| 2332 |
end if; |
| 2333 |
Format_Object.Last_Non_Space := False; |
| 2334 |
|
| 2335 |
Format_Object.Keep_with_Next := False; -- Reset for next paragraph. |
| 2336 |
|
| 2337 |
Format_Object.Space_After := ARM_Output.Normal; -- Reset for next paragraph. |
| 2338 |
|
| 2339 |
-- Output the annotation preface, if needed. |
| 2340 |
if Format_Object.Next_Paragraph_Subhead_Type /= |
| 2341 |
Format_Object.Last_Paragraph_Subhead_Type then |
| 2342 |
if Show_Leading_Text_for_Paragraph then |
| 2343 |
Make_Annotation_Preface (Format_Object.Next_Paragraph_Subhead_Type); |
| 2344 |
end if; |
| 2345 |
end if; |
| 2346 |
|
| 2347 |
if Format_Object.References /= null then |
| 2348 |
-- We assume these are only stored here if we want to see |
| 2349 |
-- them on *this* paragraph. Thus, we just output them if |
| 2350 |
-- they exist here. Note: This deallocates the references |
| 2351 |
-- after writing them. |
| 2352 |
if Format_Object.No_Start_Paragraph then |
| 2353 |
-- Oh-oh! Can't generate references; there aren't |
| 2354 |
-- supposed to be any at this point. |
| 2355 |
Ada.Text_IO.Put_Line ("** References generated for no display paragraph; line " & ARM_Input.Line_String (Input_Object)); |
| 2356 |
else |
| 2357 |
pragma Warnings (Off, "writable actual for ""List"" overlaps with actual for ""Format_Object"""); |
| 2358 |
Make_References (Format_Object.References, Format_Object, Output_Object); |
| 2359 |
pragma Warnings (On); |
| 2360 |
end if; |
| 2361 |
end if; |
| 2362 |
|
| 2363 |
-- Reset the "next" paragraph kind and version (we have to |
| 2364 |
-- wait, so that we can use this to determine whether |
| 2365 |
-- note numbers and things are output): |
| 2366 |
Format_Object.Next_Paragraph_Change_Kind := ARM_Database.None; |
| 2367 |
Format_Object.Next_Paragraph_Version := '0'; |
| 2368 |
-- else already in a paragraph. |
| 2369 |
end if; |
| 2370 |
end Check_Paragraph; |
| 2371 |
|
| 2372 |
|
| 2373 |
procedure Check_End_Paragraph is |
| 2374 |
-- Check for the end of a paragraph; closing it if necessary. |
| 2375 |
-- We will never be in a paragraph after this routine. |
| 2376 |
begin |
| 2377 |
if Format_Object.In_Paragraph then |
| 2378 |
if not Format_Object.No_Start_Paragraph then |
| 2379 |
ARM_Output.End_Paragraph (Output_Object); |
| 2380 |
--else Ada.Text_IO.Put_Line("No Start Paragraph, so no End Paragraph"); |
| 2381 |
end if; |
| 2382 |
Format_Object.In_Paragraph := False; |
| 2383 |
Format_Object.No_Start_Paragraph := False; |
| 2384 |
Format_Object.No_Para_Num := False; |
| 2385 |
-- Make sure any "leftover" |
| 2386 |
-- NoParaNums are cleared; we don't want this lasting into |
| 2387 |
-- the next paragraph. |
| 2388 |
if Format_Object.In_Change then |
| 2389 |
Ada.Text_IO.Put_Line ("** Paragraph end while in change; line " & ARM_Input.Line_String (Input_Object)); |
| 2390 |
Format_Object.In_Change := False; |
| 2391 |
end if; |
| 2392 |
-- Check command stack for any open formatting commands, |
| 2393 |
-- and complain (these won't be closed properly and chaos |
| 2394 |
-- may result): |
| 2395 |
for I in reverse 1 .. Format_State.Nesting_Stack_Ptr loop |
| 2396 |
if Format_State.Nesting_Stack (I).Command in Bold .. Tab_Set then |
| 2397 |
-- There is a formatting command active. |
| 2398 |
-- (Note: not all of these can be on the stack.) |
| 2399 |
Ada.Text_IO.Put_Line ("** Paragraph end while in formatting command " & |
| 2400 |
Data.Command_Type'Image(Format_State.Nesting_Stack (I).Command) & |
| 2401 |
"; line " & ARM_Input.Line_String (Input_Object)); |
| 2402 |
exit; |
| 2403 |
end if; |
| 2404 |
end loop; |
| 2405 |
end if; |
| 2406 |
end Check_End_Paragraph; |
| 2407 |
|
| 2408 |
|
| 2409 |
type DIE_Kind is (None, Is_Root, Is_Partial); |
| 2410 |
|
| 2411 |
procedure Display_Index_Entry (Term_Text : in String; |
| 2412 |
Special : in DIE_Kind := None) is |
| 2413 |
-- If necessary, display the index entry for Term_Text. |
| 2414 |
Is_AARM : constant Boolean := Is_AARM_Paragraph (Format_Object.Next_Paragraph_Subhead_Type); |
| 2415 |
use type ARM_Output.Size_Type; |
| 2416 |
begin |
| 2417 |
if Format_Object.Display_Index_Entries then |
| 2418 |
Check_Paragraph; |
| 2419 |
if not Is_AARM then |
| 2420 |
ARM_Output.Text_Format (Output_Object, |
| 2421 |
Format => (Bold => False, Italic => False, |
| 2422 |
Font => ARM_Output.Default, |
| 2423 |
Color => ARM_Output.Default, |
| 2424 |
Size => -1, |
| 2425 |
Change => Format_Object.Text_Format.Change, |
| 2426 |
Version => Format_Object.Text_Format.Version, |
| 2427 |
Added_Version => Format_Object.Text_Format.Added_Version, |
| 2428 |
Location => ARM_Output.Normal)); |
| 2429 |
end if; |
| 2430 |
ARM_Output.Ordinary_Character (Output_Object, '{'); |
| 2431 |
if not Is_AARM then |
| 2432 |
ARM_Output.Text_Format (Output_Object, |
| 2433 |
Format => (Bold => False, Italic => True, |
| 2434 |
Font => ARM_Output.Default, |
| 2435 |
Color => ARM_Output.Default, |
| 2436 |
Size => -1, |
| 2437 |
Change => Format_Object.Text_Format.Change, |
| 2438 |
Version => Format_Object.Text_Format.Version, |
| 2439 |
Added_Version => Format_Object.Text_Format.Added_Version, |
| 2440 |
Location => ARM_Output.Normal)); |
| 2441 |
else |
| 2442 |
ARM_Output.Text_Format (Output_Object, |
| 2443 |
Format => (Bold => False, Italic => True, |
| 2444 |
Font => ARM_Output.Default, |
| 2445 |
Color => ARM_Output.Default, |
| 2446 |
Size => 0, |
| 2447 |
Change => Format_Object.Text_Format.Change, |
| 2448 |
Version => Format_Object.Text_Format.Version, |
| 2449 |
Added_Version => Format_Object.Text_Format.Added_Version, |
| 2450 |
Location => ARM_Output.Normal)); |
| 2451 |
end if; |
| 2452 |
ARM_Output.Ordinary_Text (Output_Object, ARM_Index.Clean(Term_Text, Remove_Soft_Hyphens => True)); |
| 2453 |
if not Is_AARM then |
| 2454 |
ARM_Output.Text_Format (Output_Object, |
| 2455 |
Format => (Bold => False, Italic => False, |
| 2456 |
Font => ARM_Output.Default, |
| 2457 |
Color => ARM_Output.Default, |
| 2458 |
Size => -1, |
| 2459 |
Change => Format_Object.Text_Format.Change, |
| 2460 |
Version => Format_Object.Text_Format.Version, |
| 2461 |
Added_Version => Format_Object.Text_Format.Added_Version, |
| 2462 |
Location => ARM_Output.Normal)); |
| 2463 |
else |
| 2464 |
ARM_Output.Text_Format (Output_Object, |
| 2465 |
Format => (Bold => False, Italic => False, |
| 2466 |
Font => ARM_Output.Default, |
| 2467 |
Color => ARM_Output.Default, |
| 2468 |
Size => 0, |
| 2469 |
Change => Format_Object.Text_Format.Change, |
| 2470 |
Version => Format_Object.Text_Format.Version, |
| 2471 |
Added_Version => Format_Object.Text_Format.Added_Version, |
| 2472 |
Location => ARM_Output.Normal)); |
| 2473 |
end if; |
| 2474 |
case Special is |
| 2475 |
when None => null; |
| 2476 |
when Is_Root => ARM_Output.Ordinary_Text (Output_Object, " [distributed]"); |
| 2477 |
when Is_Partial => ARM_Output.Ordinary_Text (Output_Object, " [partial]"); |
| 2478 |
end case; |
| 2479 |
ARM_Output.Ordinary_Character (Output_Object, '}'); |
| 2480 |
if not Is_AARM then |
| 2481 |
ARM_Output.Text_Format (Output_Object, |
| 2482 |
Format => (Bold => False, Italic => False, |
| 2483 |
Font => ARM_Output.Default, |
| 2484 |
Color => ARM_Output.Default, |
| 2485 |
Size => 0, |
| 2486 |
Change => Format_Object.Text_Format.Change, |
| 2487 |
Version => Format_Object.Text_Format.Version, |
| 2488 |
Added_Version => Format_Object.Text_Format.Added_Version, |
| 2489 |
Location => ARM_Output.Normal)); |
| 2490 |
end if; |
| 2491 |
ARM_Output.Ordinary_Character (Output_Object, ' '); |
| 2492 |
Format_Object.Last_Non_Space := False; |
| 2493 |
-- else not displayed. |
| 2494 |
end if; |
| 2495 |
end Display_Index_Entry; |
| 2496 |
|
| 2497 |
|
| 2498 |
procedure Parse_Tab_Stops (Stops : in String; |
| 2499 |
Tabs : in out ARM_Output.Tab_Info) is |
| 2500 |
-- Parse "Stops" as a tab string; store the result in Tabs. |
| 2501 |
Loc : Natural := Stops'First; |
| 2502 |
begin |
| 2503 |
-- Parse tab stops: |
| 2504 |
-- <tab_stop> ::= <modifier><pica_count_literal> |
| 2505 |
-- <modifier> ::= L | P |
| 2506 |
-- <tab_stops> ::= <tab_stop> {, <tab_stop>} |
| 2507 |
while Loc <= Stops'Length loop |
| 2508 |
Tabs.Number := Tabs.Number + 1; |
| 2509 |
if Stops(Loc) = 'l' or Stops(Loc) = 'L' then |
| 2510 |
Tabs.Stops(Tabs.Number).Kind := |
| 2511 |
ARM_Output.Left_Fixed; |
| 2512 |
Loc := Loc + 1; |
| 2513 |
elsif Stops(Loc) = 'p' or Stops(Loc) = 'P' then |
| 2514 |
Tabs.Stops(Tabs.Number).Kind := |
| 2515 |
ARM_Output.Left_Proportional; |
| 2516 |
Loc := Loc + 1; |
| 2517 |
else -- Default: |
| 2518 |
Tabs.Stops(Tabs.Number).Kind := |
| 2519 |
ARM_Output.Left_Fixed; |
| 2520 |
end if; |
| 2521 |
while Loc <= Stops'Length loop |
| 2522 |
if Stops(Loc) in '0' .. '9' then |
| 2523 |
Tabs.Stops(Tabs.Number).Stop := |
| 2524 |
Tabs.Stops(Tabs.Number).Stop * 10 + |
| 2525 |
Character'Pos(Stops(Loc)) - Character'Pos('0'); |
| 2526 |
Loc := Loc + 1; |
| 2527 |
else |
| 2528 |
exit; -- Number ended. |
| 2529 |
end if; |
| 2530 |
end loop; |
| 2531 |
if Tabs.Stops(Tabs.Number).Stop = 0 then |
| 2532 |
Tabs.Number := Tabs.Number - 1; |
| 2533 |
Ada.Text_IO.Put_Line (" ** Bad tab stop format, position" & Natural'Image(Loc) & |
| 2534 |
" in [" & Stops & "] from line " & |
| 2535 |
ARM_Input.Line_String (Input_Object)); |
| 2536 |
exit; -- Give up on this tabset. |
| 2537 |
elsif Tabs.Number < 1 and then |
| 2538 |
Tabs.Stops(Tabs.Number-1).Stop >= |
| 2539 |
Tabs.Stops(Tabs.Number).Stop then |
| 2540 |
Tabs.Number := Tabs.Number - 1; |
| 2541 |
Ada.Text_IO.Put_Line (" ** Bad tab stop, less than previous, at position" & Natural'Image(Loc) & |
| 2542 |
" in [" & Stops & "] from line " & |
| 2543 |
ARM_Input.Line_String (Input_Object)); |
| 2544 |
exit; -- Give up on this tabset. |
| 2545 |
end if; |
| 2546 |
if Loc > Stops'Length then |
| 2547 |
exit; -- Finished. |
| 2548 |
elsif Stops(Loc) = ',' then |
| 2549 |
Loc := Loc + 1; |
| 2550 |
if Loc > Stops'Length then |
| 2551 |
Ada.Text_IO.Put_Line (" ** Bad tab stop set format, ends with comma in [" & |
| 2552 |
Stops & "] from line " & |
| 2553 |
ARM_Input.Line_String (Input_Object)); |
| 2554 |
exit; -- Give up on this tabset. |
| 2555 |
end if; |
| 2556 |
end if; |
| 2557 |
-- Skip any blanks in between. |
| 2558 |
while Loc <= Stops'Length and then Stops(Loc) = ' ' loop |
| 2559 |
Loc := Loc + 1; |
| 2560 |
end loop; |
| 2561 |
end loop; |
| 2562 |
end Parse_Tab_Stops; |
| 2563 |
|
| 2564 |
|
| 2565 |
procedure Write_Subindex ( |
| 2566 |
Subindex_Object : in out ARM_Subindex.Subindex_Type; |
| 2567 |
Format_Object : in out Format_Type; |
| 2568 |
Output_Object : in out ARM_Output.Output_Type'Class; |
| 2569 |
Minimize_Lines : in Boolean) is |
| 2570 |
-- Writes a subindex for the document. |
| 2571 |
begin |
| 2572 |
Check_End_Paragraph; |
| 2573 |
|
| 2574 |
-- Insert a blank paragraph: |
| 2575 |
ARM_Output.Start_Paragraph (Output_Object, ARM_Output.Normal, |
| 2576 |
Indent => 0, Number => ""); |
| 2577 |
ARM_Output.Hard_Space (Output_Object); |
| 2578 |
ARM_Output.End_Paragraph (Output_Object); |
| 2579 |
|
| 2580 |
ARM_Output.Set_Columns (Output_Object, Number_of_Columns => 2); |
| 2581 |
|
| 2582 |
ARM_Subindex.Write_Subindex ( |
| 2583 |
Subindex_Object, |
| 2584 |
Output_Object, |
| 2585 |
Use_Paragraphs => Format_Object.Number_Paragraphs, |
| 2586 |
Minimize_Lines => Minimize_Lines); |
| 2587 |
|
| 2588 |
ARM_Output.Set_Columns (Output_Object, Number_of_Columns => 1); |
| 2589 |
|
| 2590 |
-- Not in a paragraph here, either. |
| 2591 |
end Write_Subindex; |
| 2592 |
|
| 2593 |
|
| 2594 |
procedure Simple_Subindex_Item ( |
| 2595 |
Subindex_Object : in out ARM_Subindex.Subindex_Type; |
| 2596 |
Format_Object : in out Format_Type; |
| 2597 |
Output_Object : in out ARM_Output.Output_Type'Class; |
| 2598 |
Entity_Kind_Name : in String) is |
| 2599 |
-- Create a simple subindex item; the command has a single |
| 2600 |
-- parameter <defn>. |
| 2601 |
-- Create an "In_Unit" entry for the item; |
| 2602 |
-- Also create two regular index entries: |
| 2603 |
-- One for <defn> with a secondary entry of "@i{in} <Unit>" |
| 2604 |
-- (where Unit is the unit saved by a previous RootLibUnit or |
| 2605 |
-- ChildUnit.), |
| 2606 |
-- and a Second (only for version < 2 and if the entity name is |
| 2607 |
-- non-null) for |
| 2608 |
-- "Language-Defined <Entity>" with a |
| 2609 |
-- secondary entry of "<defn> @i{in} <Unit>". |
| 2610 |
-- Also outputs the <defn> parameter to the output file. |
| 2611 |
Entity : String(1..80); |
| 2612 |
Len : Natural := 0; |
| 2613 |
Key : ARM_Index.Index_Key := ARM_Index.Get_Key; |
| 2614 |
Disposition : ARM_Output.Change_Type; |
| 2615 |
use type ARM_Output.Change_Type; |
| 2616 |
begin |
| 2617 |
ARM_Input.Copy_to_String_until_Close_Char ( |
| 2618 |
Input_Object, |
| 2619 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Close_Char, |
| 2620 |
Entity, |
| 2621 |
Len); |
| 2622 |
|
| 2623 |
-- Determine what to do with the "Language-Defined" entry: |
| 2624 |
Calc_Change_Disposition ( |
| 2625 |
Format_Object => Format_Object, |
| 2626 |
Version => '2', |
| 2627 |
Operation => ARM_Output.Deletion, |
| 2628 |
Text_Kind => Disposition); |
| 2629 |
if Entity_Kind_Name'Length = 0 or else |
| 2630 |
Disposition = Do_Not_Display_Text then |
| 2631 |
null; -- Ignore this. |
| 2632 |
elsif Disposition = ARM_Output.None then |
| 2633 |
-- Normal reference: |
| 2634 |
ARM_Index.Add_Reusing_Key ( |
| 2635 |
Term => "Language-Defined " & Entity_Kind_Name, |
| 2636 |
Subterm => Entity(1..Len) & " in " & |
| 2637 |
Format_Object.Unit(1..Format_Object.Unit_Len), |
| 2638 |
Kind => ARM_Index.SubDeclaration_in_Package, |
| 2639 |
Clause => Clause_String (Format_Object), |
| 2640 |
Paragraph => Paragraph_String, |
| 2641 |
Key => Key); |
| 2642 |
-- Note that the Subdeclaration type changes the |
| 2643 |
-- "in" into italics. |
| 2644 |
elsif Disposition = ARM_Output.Deletion then |
| 2645 |
null; -- Ignore this (no change info in the index). |
| 2646 |
else -- Insertion. |
| 2647 |
raise Program_Error; -- An insertion inside of a deletion command! |
| 2648 |
end if; |
| 2649 |
|
| 2650 |
Check_Paragraph; |
| 2651 |
ARM_Output.Index_Target (Output_Object, Key); |
| 2652 |
|
| 2653 |
if Format_Object.Unit_Len = 0 then |
| 2654 |
Ada.Text_IO.Put_Line ("** No unit defined for index entry expecting one on line " & ARM_Input.Line_String (Input_Object)); |
| 2655 |
|
| 2656 |
ARM_Index.Add_Reusing_Key ( |
| 2657 |
Term => Entity(1..Len), |
| 2658 |
Subterm => "*unknown*", |
| 2659 |
Kind => ARM_Index.Declaration_in_Package, |
| 2660 |
Clause => Clause_String (Format_Object), |
| 2661 |
Paragraph => Paragraph_String, |
| 2662 |
Key => Key); |
| 2663 |
|
| 2664 |
ARM_Subindex.Insert ( |
| 2665 |
Subindex_Object => Subindex_Object, |
| 2666 |
Entity => Entity(1..Len), |
| 2667 |
From_Unit => "*unknown*", |
| 2668 |
Kind => ARM_Subindex.In_Unit, |
| 2669 |
Clause => Clause_String (Format_Object), |
| 2670 |
Paragraph => Paragraph_String, |
| 2671 |
Key => Key); |
| 2672 |
else |
| 2673 |
ARM_Index.Add_Reusing_Key ( |
| 2674 |
Term => Entity(1..Len), |
| 2675 |
Subterm => Format_Object.Unit(1..Format_Object.Unit_Len), |
| 2676 |
Kind => ARM_Index.Declaration_in_Package, |
| 2677 |
Clause => Clause_String (Format_Object), |
| 2678 |
Paragraph => Paragraph_String, |
| 2679 |
Key => Key); |
| 2680 |
|
| 2681 |
ARM_Subindex.Insert ( |
| 2682 |
Subindex_Object => Subindex_Object, |
| 2683 |
Entity => Entity(1..Len), |
| 2684 |
From_Unit => Format_Object.Unit(1..Format_Object.Unit_Len), |
| 2685 |
Kind => ARM_Subindex.In_Unit, |
| 2686 |
Clause => Clause_String (Format_Object), |
| 2687 |
Paragraph => Paragraph_String, |
| 2688 |
Key => Key); |
| 2689 |
end if; |
| 2690 |
|
| 2691 |
ARM_Output.Ordinary_Text (Output_Object, Entity(1..Len)); |
| 2692 |
Format_Object.Last_Non_Space := True; |
| 2693 |
end Simple_Subindex_Item; |
| 2694 |
|
| 2695 |
|
| 2696 |
procedure Child_Unit ( |
| 2697 |
Subindex_Object : in out ARM_Subindex.Subindex_Type; |
| 2698 |
Format_Object : in out Format_Type; |
| 2699 |
Output_Object : in out ARM_Output.Output_Type'Class) is |
| 2700 |
-- Generates three index entries: An index entry for <child>, with |
| 2701 |
-- a secondary of "@i{child of} <parent>", an index entry for |
| 2702 |
-- "Language-Defined Library Units" with a secondary entry of |
| 2703 |
-- <parent>.<child>, and an index entry for <parent>.<child>. The |
| 2704 |
-- Unit is set to <parent>.<child>. (For version 2 or later, the |
| 2705 |
-- Language-Defined entry is not generated.) The first entry is |
| 2706 |
-- added to the subindex list as well. |
| 2707 |
Close_Ch : Character; |
| 2708 |
Parent, Child : String(1..80); |
| 2709 |
PLen, CLen : Natural := 0; |
| 2710 |
Key : ARM_Index.Index_Key := ARM_Index.Get_Key; |
| 2711 |
Disposition : ARM_Output.Change_Type; |
| 2712 |
use type ARM_Output.Change_Type; |
| 2713 |
begin |
| 2714 |
ARM_Input.Check_Parameter_Name (Input_Object, |
| 2715 |
Param_Name => "Parent" & (7..ARM_Input.Command_Name_Type'Last => ' '), |
| 2716 |
Is_First => True, |
| 2717 |
Param_Close_Bracket => Close_Ch); |
| 2718 |
if Close_Ch /= ' ' then |
| 2719 |
-- Copy over the term: |
| 2720 |
ARM_Input.Copy_to_String_until_Close_Char ( |
| 2721 |
Input_Object, |
| 2722 |
Close_Ch, |
| 2723 |
Parent, |
| 2724 |
PLen); |
| 2725 |
-- else no parameter. Weird. |
| 2726 |
end if; |
| 2727 |
|
| 2728 |
ARM_Input.Check_Parameter_Name (Input_Object, |
| 2729 |
Param_Name => "Child" & (6..ARM_Input.Command_Name_Type'Last => ' '), |
| 2730 |
Is_First => False, |
| 2731 |
Param_Close_Bracket => Close_Ch); |
| 2732 |
if Close_Ch /= ' ' then |
| 2733 |
-- Copy over the term: |
| 2734 |
ARM_Input.Copy_to_String_until_Close_Char ( |
| 2735 |
Input_Object, |
| 2736 |
Close_Ch, |
| 2737 |
Child, |
| 2738 |
CLen); |
| 2739 |
-- else no parameter. Weird. |
| 2740 |
end if; |
| 2741 |
|
| 2742 |
-- Set the current unit for future use: |
| 2743 |
Format_Object.Unit_Len := PLen + CLen + 1; |
| 2744 |
Format_Object.Unit (1..Format_Object.Unit_Len) := |
| 2745 |
Parent(1..PLen) & '.' & Child(1..CLen); |
| 2746 |
|
| 2747 |
ARM_Index.Add_Reusing_Key ( |
| 2748 |
Term => Child(1..CLen), |
| 2749 |
Subterm => Parent(1..PLen), |
| 2750 |
Kind => ARM_Index.Child_Unit_Parent, |
| 2751 |
Clause => Clause_String (Format_Object), |
| 2752 |
Paragraph => Paragraph_String, |
| 2753 |
Key => Key); |
| 2754 |
|
| 2755 |
Check_Paragraph; |
| 2756 |
ARM_Output.Index_Target (Output_Object, Key); |
| 2757 |
|
| 2758 |
-- Determine what to do with the "Language-Defined" entry: |
| 2759 |
Calc_Change_Disposition ( |
| 2760 |
Format_Object => Format_Object, |
| 2761 |
Version => '2', |
| 2762 |
Operation => ARM_Output.Deletion, |
| 2763 |
Text_Kind => Disposition); |
| 2764 |
if Disposition = Do_Not_Display_Text then |
| 2765 |
null; -- Ignore this. |
| 2766 |
elsif Disposition = ARM_Output.None then |
| 2767 |
-- Make reference: |
| 2768 |
ARM_Index.Add_Reusing_Key ( |
| 2769 |
Term => "Language-Defined Library Units", |
| 2770 |
Subterm => Parent(1..PLen) & '.' & Child(1..CLen), |
| 2771 |
Kind => ARM_Index.Primary_Term_and_Subterm, |
| 2772 |
Clause => Clause_String (Format_Object), |
| 2773 |
Paragraph => Paragraph_String, |
| 2774 |
Key => Key); |
| 2775 |
elsif Disposition = ARM_Output.Deletion then |
| 2776 |
null; -- Ignore this (no change info in the index). |
| 2777 |
else -- Insertion. |
| 2778 |
raise Program_Error; -- An insertion inside of a deletion command! |
| 2779 |
end if; |
| 2780 |
|
| 2781 |
ARM_Index.Add_Reusing_Key ( |
| 2782 |
Term => Parent(1..PLen) & '.' & Child(1..CLen), |
| 2783 |
Kind => ARM_Index.Primary_Term, |
| 2784 |
Clause => Clause_String (Format_Object), |
| 2785 |
Paragraph => Paragraph_String, |
| 2786 |
Key => Key); |
| 2787 |
|
| 2788 |
ARM_Subindex.Insert ( |
| 2789 |
Subindex_Object => Subindex_Object, |
| 2790 |
Entity => Child(1..CLen), |
| 2791 |
From_Unit => Parent(1..PLen), |
| 2792 |
Kind => ARM_Subindex.Child_of_Parent, |
| 2793 |
Clause => Clause_String (Format_Object), |
| 2794 |
Paragraph => Paragraph_String, |
| 2795 |
Key => Key); |
| 2796 |
|
| 2797 |
-- Leave the command end marker, let normal processing |
| 2798 |
-- get rid of it. |
| 2799 |
end Child_Unit; |
| 2800 |
|
| 2801 |
|
| 2802 |
procedure Process_Begin is |
| 2803 |
-- Process a "begin". The "begin" has been stacked. |
| 2804 |
|
| 2805 |
procedure Toss_for_RM (Paragraph_Kind_Name : in String) is |
| 2806 |
-- Call this for AARM-only sections. |
| 2807 |
-- It skips *everything* until the matching end. This includes |
| 2808 |
-- index references, section references, and the like. Anything |
| 2809 |
-- that ought to be in the RM should be moved outside of the |
| 2810 |
-- AARM specific code. Thus, we can use a fairly simple text |
| 2811 |
-- skip. |
| 2812 |
Ch : Character; |
| 2813 |
Close_Ch : Character; |
| 2814 |
Command_Name : ARM_Input.Command_Name_Type; |
| 2815 |
begin |
| 2816 |
-- Skip everything up to the next @end{<Paragraph_Kind_Name... |
| 2817 |
-- then pop the stack and return. |
| 2818 |
loop |
| 2819 |
ARM_Input.Get_Char (Input_Object, Ch); |
| 2820 |
while Ch /= '@' loop |
| 2821 |
ARM_Input.Get_Char (Input_Object, Ch); |
| 2822 |
end loop; |
| 2823 |
Arm_Input.Get_Name (Input_Object, Command_Name, Null_Name_Allowed => True); |
| 2824 |
-- Get the command name. |
| 2825 |
if Ada.Characters.Handling.To_Lower (Ada.Strings.Fixed.Trim ( |
| 2826 |
Command_Name, Ada.Strings.Right)) /= "end" then |
| 2827 |
-- Not an "end" command, keep going. |
| 2828 |
null; |
| 2829 |
else -- An End command, check if this is the one we want: |
| 2830 |
ARM_Input.Get_Char (Input_Object, Ch); |
| 2831 |
if ARM_Input.Is_Open_Char (Ch) then -- Start parameter: |
| 2832 |
Close_Ch := ARM_Input.Get_Close_Char (Ch); |
| 2833 |
Arm_Input.Get_Name (Input_Object, Command_Name); -- Get the end "type". |
| 2834 |
if Ada.Characters.Handling.To_Lower (Ada.Strings.Fixed.Trim ( |
| 2835 |
Command_Name, Ada.Strings.Right)) /= Paragraph_Kind_Name then |
| 2836 |
null; -- Wrong end, keep going. |
| 2837 |
else -- Right end! |
| 2838 |
-- Skip to the close character: |
| 2839 |
while Ch /= Close_Ch loop |
| 2840 |
ARM_Input.Get_Char (Input_Object, Ch); |
| 2841 |
end loop; |
| 2842 |
-- Unstack the "begin". |
| 2843 |
Format_State.Nesting_Stack_Ptr := Format_State.Nesting_Stack_Ptr - 1; |
| 2844 |
--Ada.Text_IO.Put_Line (" &Unstack (End AARM-Only)"); |
| 2845 |
-- And we're done with this "begin". |
| 2846 |
return; |
| 2847 |
end if; |
| 2848 |
else -- No parameter, forget it. |
| 2849 |
null; |
| 2850 |
end if; |
| 2851 |
end if; |
| 2852 |
end loop; |
| 2853 |
end Toss_for_RM; |
| 2854 |
|
| 2855 |
begin |
| 2856 |
Check_End_Paragraph; -- End any paragraph that we're in. |
| 2857 |
if Ada.Characters.Handling.To_Lower (Ada.Strings.Fixed.Trim ( |
| 2858 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Name, Ada.Strings.Right)) |
| 2859 |
= "comment" then |
| 2860 |
Toss_for_RM ("comment"); |
| 2861 |
-- Format only: |
| 2862 |
elsif Ada.Characters.Handling.To_Lower (Ada.Strings.Fixed.Trim ( |
| 2863 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Name, Ada.Strings.Right)) |
| 2864 |
= "wideabove" then |
| 2865 |
Format_Object.Next_Paragraph_Format_Type := Wide_Above; |
| 2866 |
elsif Ada.Characters.Handling.To_Lower (Ada.Strings.Fixed.Trim ( |
| 2867 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Name, Ada.Strings.Right)) |
| 2868 |
= "example" then |
| 2869 |
Format_Object.Next_Paragraph_Format_Type := Example_Text; |
| 2870 |
elsif Ada.Characters.Handling.To_Lower (Ada.Strings.Fixed.Trim ( |
| 2871 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Name, Ada.Strings.Right)) |
| 2872 |
= "childexample" then |
| 2873 |
Format_Object.Next_Paragraph_Format_Type := Child_Example_Text; |
| 2874 |
elsif Ada.Characters.Handling.To_Lower (Ada.Strings.Fixed.Trim ( |
| 2875 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Name, Ada.Strings.Right)) |
| 2876 |
= "descexample" then |
| 2877 |
Format_Object.Next_Paragraph_Format_Type := Indented_Example_Text; |
| 2878 |
elsif Ada.Characters.Handling.To_Lower (Ada.Strings.Fixed.Trim ( |
| 2879 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Name, Ada.Strings.Right)) |
| 2880 |
= "describecode" then |
| 2881 |
Format_Object.Next_Paragraph_Format_Type := Code_Indented; |
| 2882 |
elsif Ada.Characters.Handling.To_Lower (Ada.Strings.Fixed.Trim ( |
| 2883 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Name, Ada.Strings.Right)) |
| 2884 |
= "indent" then |
| 2885 |
Format_Object.Next_Paragraph_Format_Type := Indent; |
| 2886 |
elsif Ada.Characters.Handling.To_Lower (Ada.Strings.Fixed.Trim ( |
| 2887 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Name, Ada.Strings.Right)) |
| 2888 |
= "itemize" then |
| 2889 |
Format_Object.Next_Paragraph_Format_Type := Bulleted; |
| 2890 |
elsif Ada.Characters.Handling.To_Lower (Ada.Strings.Fixed.Trim ( |
| 2891 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Name, Ada.Strings.Right)) |
| 2892 |
= "inneritemize" then |
| 2893 |
Format_Object.Next_Paragraph_Format_Type := Nested_Bulleted; |
| 2894 |
elsif Ada.Characters.Handling.To_Lower (Ada.Strings.Fixed.Trim ( |
| 2895 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Name, Ada.Strings.Right)) |
| 2896 |
= "innerinneritemize" then |
| 2897 |
Format_Object.Next_Paragraph_Format_Type := Nested_X2_Bulleted; |
| 2898 |
elsif Ada.Characters.Handling.To_Lower (Ada.Strings.Fixed.Trim ( |
| 2899 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Name, Ada.Strings.Right)) |
| 2900 |
= "display" then |
| 2901 |
Format_Object.Next_Paragraph_Format_Type := Display; |
| 2902 |
elsif Ada.Characters.Handling.To_Lower (Ada.Strings.Fixed.Trim ( |
| 2903 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Name, Ada.Strings.Right)) |
| 2904 |
= "syntaxdisplay" then |
| 2905 |
Format_Object.Next_Paragraph_Format_Type := Syntax_Display; |
| 2906 |
elsif Ada.Characters.Handling.To_Lower (Ada.Strings.Fixed.Trim ( |
| 2907 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Name, Ada.Strings.Right)) |
| 2908 |
= "syntaxtext" then |
| 2909 |
Format_Object.Next_Paragraph_Format_Type := Syntax_Indented; |
| 2910 |
elsif Ada.Characters.Handling.To_Lower (Ada.Strings.Fixed.Trim ( |
| 2911 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Name, Ada.Strings.Right)) |
| 2912 |
= "description" then |
| 2913 |
Format_Object.Next_Paragraph_Format_Type := Hanging_Indented_3; |
| 2914 |
elsif Ada.Characters.Handling.To_Lower (Ada.Strings.Fixed.Trim ( |
| 2915 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Name, Ada.Strings.Right)) |
| 2916 |
= "small" then |
| 2917 |
Format_Object.Next_Paragraph_Format_Type := Small; |
| 2918 |
elsif Ada.Characters.Handling.To_Lower (Ada.Strings.Fixed.Trim ( |
| 2919 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Name, Ada.Strings.Right)) |
| 2920 |
= "enumerate" then |
| 2921 |
Format_Object.Next_Paragraph_Format_Type := Enumerated; |
| 2922 |
Format_Object.Next_Enumerated_Num := 1; |
| 2923 |
Format_Object.Enumerated_Level := Format_Object.Enumerated_Level + 1; |
| 2924 |
elsif Ada.Characters.Handling.To_Lower (Ada.Strings.Fixed.Trim ( |
| 2925 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Name, Ada.Strings.Right)) |
| 2926 |
= "innerenumerate" then |
| 2927 |
Format_Object.Next_Paragraph_Format_Type := Nested_Enumerated; |
| 2928 |
Format_Object.Next_Enumerated_Num := 1; |
| 2929 |
Format_Object.Enumerated_Level := Format_Object.Enumerated_Level + 1; |
| 2930 |
elsif Ada.Characters.Handling.To_Lower (Ada.Strings.Fixed.Trim ( |
| 2931 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Name, Ada.Strings.Right)) |
| 2932 |
= "hang1list" then |
| 2933 |
Format_Object.Next_Paragraph_Format_Type := Hanging_Indented_1; |
| 2934 |
elsif Ada.Characters.Handling.To_Lower (Ada.Strings.Fixed.Trim ( |
| 2935 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Name, Ada.Strings.Right)) |
| 2936 |
= "hang2list" then |
| 2937 |
Format_Object.Next_Paragraph_Format_Type := Hanging_Indented_2; |
| 2938 |
elsif Ada.Characters.Handling.To_Lower (Ada.Strings.Fixed.Trim ( |
| 2939 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Name, Ada.Strings.Right)) |
| 2940 |
= "hang3list" then |
| 2941 |
Format_Object.Next_Paragraph_Format_Type := Hanging_Indented_3; |
| 2942 |
elsif Ada.Characters.Handling.To_Lower (Ada.Strings.Fixed.Trim ( |
| 2943 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Name, Ada.Strings.Right)) |
| 2944 |
= "hang4list" then |
| 2945 |
Format_Object.Next_Paragraph_Format_Type := Hanging_Indented_4; |
| 2946 |
elsif Ada.Characters.Handling.To_Lower (Ada.Strings.Fixed.Trim ( |
| 2947 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Name, Ada.Strings.Right)) |
| 2948 |
= "title" then |
| 2949 |
Format_Object.Next_Paragraph_Format_Type := Title; |
| 2950 |
elsif Ada.Characters.Handling.To_Lower (Ada.Strings.Fixed.Trim ( |
| 2951 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Name, Ada.Strings.Right)) |
| 2952 |
= "bundle" then |
| 2953 |
-- Should prevent any page breaks until the "end". Not |
| 2954 |
-- implemented currently. |
| 2955 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Is_Formatting |
| 2956 |
:= False; -- Leave the format alone. |
| 2957 |
Format_Object.In_Bundle := True; -- We don't need to stack this, |
| 2958 |
-- because once we're in it, we can't leave it until the @End. |
| 2959 |
elsif Ada.Characters.Handling.To_Lower (Ada.Strings.Fixed.Trim ( |
| 2960 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Name, Ada.Strings.Right)) |
| 2961 |
= "twocol" then |
| 2962 |
-- Two column; no affect on format. |
| 2963 |
ARM_Output.Set_Columns (Output_Object, Number_of_Columns => 2); |
| 2964 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Is_Formatting |
| 2965 |
:= False; |
| 2966 |
elsif Ada.Characters.Handling.To_Lower (Ada.Strings.Fixed.Trim ( |
| 2967 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Name, Ada.Strings.Right)) |
| 2968 |
= "fourcol" then |
| 2969 |
-- Four column; no affect on format. |
| 2970 |
ARM_Output.Set_Columns (Output_Object, Number_of_Columns => 4); |
| 2971 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Is_Formatting |
| 2972 |
:= False; |
| 2973 |
-- RM groupings: |
| 2974 |
elsif Ada.Characters.Handling.To_Lower (Ada.Strings.Fixed.Trim ( |
| 2975 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Name, Ada.Strings.Right)) |
| 2976 |
= "intro" then |
| 2977 |
Format_Object.Next_Paragraph_Format_Type := Introduction; |
| 2978 |
Format_Object.Next_Paragraph_Subhead_Type := Introduction; |
| 2979 |
elsif Ada.Characters.Handling.To_Lower (Ada.Strings.Fixed.Trim ( |
| 2980 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Name, Ada.Strings.Right)) |
| 2981 |
= "syntax" then |
| 2982 |
Format_Object.Next_Paragraph_Format_Type := Syntax; |
| 2983 |
Format_Object.Next_Paragraph_Subhead_Type := Syntax; |
| 2984 |
elsif Ada.Characters.Handling.To_Lower (Ada.Strings.Fixed.Trim ( |
| 2985 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Name, Ada.Strings.Right)) |
| 2986 |
= "resolution" then |
| 2987 |
Format_Object.Next_Paragraph_Format_Type := Resolution; |
| 2988 |
Format_Object.Next_Paragraph_Subhead_Type := Resolution; |
| 2989 |
elsif Ada.Characters.Handling.To_Lower (Ada.Strings.Fixed.Trim ( |
| 2990 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Name, Ada.Strings.Right)) |
| 2991 |
= "legality" then |
| 2992 |
Format_Object.Next_Paragraph_Format_Type := Legality; |
| 2993 |
Format_Object.Next_Paragraph_Subhead_Type := Legality; |
| 2994 |
elsif Ada.Characters.Handling.To_Lower (Ada.Strings.Fixed.Trim ( |
| 2995 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Name, Ada.Strings.Right)) |
| 2996 |
= "staticsem" then |
| 2997 |
Format_Object.Next_Paragraph_Format_Type := Static_Semantics; |
| 2998 |
Format_Object.Next_Paragraph_Subhead_Type := Static_Semantics; |
| 2999 |
elsif Ada.Characters.Handling.To_Lower (Ada.Strings.Fixed.Trim ( |
| 3000 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Name, Ada.Strings.Right)) |
| 3001 |
= "linktime" then |
| 3002 |
Format_Object.Next_Paragraph_Format_Type := Link_Time; |
| 3003 |
Format_Object.Next_Paragraph_Subhead_Type := Link_Time; |
| 3004 |
elsif Ada.Characters.Handling.To_Lower (Ada.Strings.Fixed.Trim ( |
| 3005 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Name, Ada.Strings.Right)) |
| 3006 |
= "runtime" then |
| 3007 |
Format_Object.Next_Paragraph_Format_Type := Run_Time; |
| 3008 |
Format_Object.Next_Paragraph_Subhead_Type := Run_Time; |
| 3009 |
elsif Ada.Characters.Handling.To_Lower (Ada.Strings.Fixed.Trim ( |
| 3010 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Name, Ada.Strings.Right)) |
| 3011 |
= "bounded" then |
| 3012 |
Format_Object.Next_Paragraph_Format_Type := Bounded_Errors; |
| 3013 |
Format_Object.Next_Paragraph_Subhead_Type := Bounded_Errors; |
| 3014 |
elsif Ada.Characters.Handling.To_Lower (Ada.Strings.Fixed.Trim ( |
| 3015 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Name, Ada.Strings.Right)) |
| 3016 |
= "erron" then |
| 3017 |
Format_Object.Next_Paragraph_Format_Type := Erroneous; |
| 3018 |
Format_Object.Next_Paragraph_Subhead_Type := Erroneous; |
| 3019 |
elsif Ada.Characters.Handling.To_Lower (Ada.Strings.Fixed.Trim ( |
| 3020 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Name, Ada.Strings.Right)) |
| 3021 |
= "implreq" then |
| 3022 |
Format_Object.Next_Paragraph_Format_Type := Requirements; |
| 3023 |
Format_Object.Next_Paragraph_Subhead_Type := Requirements; |
| 3024 |
elsif Ada.Characters.Handling.To_Lower (Ada.Strings.Fixed.Trim ( |
| 3025 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Name, Ada.Strings.Right)) |
| 3026 |
= "docreq" then |
| 3027 |
Format_Object.Next_Paragraph_Format_Type := Documentation; |
| 3028 |
Format_Object.Next_Paragraph_Subhead_Type := Documentation; |
| 3029 |
elsif Ada.Characters.Handling.To_Lower (Ada.Strings.Fixed.Trim ( |
| 3030 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Name, Ada.Strings.Right)) |
| 3031 |
= "metrics" then |
| 3032 |
Format_Object.Next_Paragraph_Format_Type := Metrics; |
| 3033 |
Format_Object.Next_Paragraph_Subhead_Type := Metrics; |
| 3034 |
elsif Ada.Characters.Handling.To_Lower (Ada.Strings.Fixed.Trim ( |
| 3035 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Name, Ada.Strings.Right)) |
| 3036 |
= "implperm" then |
| 3037 |
Format_Object.Next_Paragraph_Format_Type := Permissions; |
| 3038 |
Format_Object.Next_Paragraph_Subhead_Type := Permissions; |
| 3039 |
elsif Ada.Characters.Handling.To_Lower (Ada.Strings.Fixed.Trim ( |
| 3040 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Name, Ada.Strings.Right)) |
| 3041 |
= "impladvice" then |
| 3042 |
Format_Object.Next_Paragraph_Format_Type := Advice; |
| 3043 |
Format_Object.Next_Paragraph_Subhead_Type := Advice; |
| 3044 |
elsif Ada.Characters.Handling.To_Lower (Ada.Strings.Fixed.Trim ( |
| 3045 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Name, Ada.Strings.Right)) |
| 3046 |
= "examples" then |
| 3047 |
Format_Object.Next_Paragraph_Format_Type := Examples; |
| 3048 |
Format_Object.Next_Paragraph_Subhead_Type := Examples; |
| 3049 |
elsif Ada.Characters.Handling.To_Lower (Ada.Strings.Fixed.Trim ( |
| 3050 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Name, Ada.Strings.Right)) |
| 3051 |
= "notes" then |
| 3052 |
Format_Object.Next_Paragraph_Format_Type := Notes; |
| 3053 |
Format_Object.Next_Paragraph_Subhead_Type := Notes; |
| 3054 |
elsif Ada.Characters.Handling.To_Lower (Ada.Strings.Fixed.Trim ( |
| 3055 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Name, Ada.Strings.Right)) |
| 3056 |
= "singlenote" then |
| 3057 |
Format_Object.Next_Paragraph_Format_Type := Single_Note; |
| 3058 |
Format_Object.Next_Paragraph_Subhead_Type := Single_Note; |
| 3059 |
elsif Ada.Characters.Handling.To_Lower (Ada.Strings.Fixed.Trim ( |
| 3060 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Name, Ada.Strings.Right)) |
| 3061 |
= "rmonly" then |
| 3062 |
if Format_Object.Include_Annotations then -- AARM, but this is RM-only. |
| 3063 |
Toss_for_RM ("rmonly"); |
| 3064 |
else |
| 3065 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Is_Formatting |
| 3066 |
:= False; -- Leave the format alone. |
| 3067 |
end if; |
| 3068 |
-- NotISO text: |
| 3069 |
elsif Ada.Characters.Handling.To_Lower (Ada.Strings.Fixed.Trim ( |
| 3070 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Name, Ada.Strings.Right)) |
| 3071 |
= "notiso" then |
| 3072 |
if Format_Object.Include_ISO then |
| 3073 |
Toss_for_RM ("notiso"); -- This text does not appear in ISO documents. |
| 3074 |
else -- not ISO |
| 3075 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Is_Formatting |
| 3076 |
:= False; -- Leave the format alone. |
| 3077 |
end if; |
| 3078 |
--!!Debug: |
| 3079 |
---Ada.Text_IO.Put_Line ("Next=" & Paragraph_Type'Image(Format_Object.Next_Paragraph_Subhead_Type)); |
| 3080 |
|
| 3081 |
-- ISOOnly text: |
| 3082 |
elsif Ada.Characters.Handling.To_Lower (Ada.Strings.Fixed.Trim ( |
| 3083 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Name, Ada.Strings.Right)) |
| 3084 |
= "isoonly" then |
| 3085 |
if Format_Object.Include_ISO then |
| 3086 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Is_Formatting |
| 3087 |
:= False; -- Leave the format alone. |
| 3088 |
else -- Not ISO |
| 3089 |
Toss_for_RM ("isoonly"); -- This text does not appear in non-ISO documents. |
| 3090 |
end if; |
| 3091 |
-- AARM groupings: |
| 3092 |
elsif Ada.Characters.Handling.To_Lower (Ada.Strings.Fixed.Trim ( |
| 3093 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Name, Ada.Strings.Right)) |
| 3094 |
= "metarules" then |
| 3095 |
if Format_Object.Include_Annotations then |
| 3096 |
Format_Object.Next_Paragraph_Format_Type := Language_Design; |
| 3097 |
Format_Object.Next_Paragraph_Subhead_Type := Language_Design; |
| 3098 |
else -- Don't show annotations. |
| 3099 |
Toss_for_RM ("metarules"); |
| 3100 |
end if; |
| 3101 |
elsif Ada.Characters.Handling.To_Lower (Ada.Strings.Fixed.Trim ( |
| 3102 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Name, Ada.Strings.Right)) |
| 3103 |
= "inconsistent83" then |
| 3104 |
if Format_Object.Include_Annotations then |
| 3105 |
Format_Object.Next_Paragraph_Format_Type := Ada83_Inconsistencies; |
| 3106 |
Format_Object.Next_Paragraph_Subhead_Type := Ada83_Inconsistencies; |
| 3107 |
else -- Don't show annotations. |
| 3108 |
Toss_for_RM ("inconsistent83"); |
| 3109 |
end if; |
| 3110 |
elsif Ada.Characters.Handling.To_Lower (Ada.Strings.Fixed.Trim ( |
| 3111 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Name, Ada.Strings.Right)) |
| 3112 |
= "incompatible83" then |
| 3113 |
if Format_Object.Include_Annotations then |
| 3114 |
Format_Object.Next_Paragraph_Format_Type := Ada83_Incompatibilities; |
| 3115 |
Format_Object.Next_Paragraph_Subhead_Type := Ada83_Incompatibilities; |
| 3116 |
else -- Don't show annotations. |
| 3117 |
Toss_for_RM ("incompatible83"); |
| 3118 |
end if; |
| 3119 |
elsif Ada.Characters.Handling.To_Lower (Ada.Strings.Fixed.Trim ( |
| 3120 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Name, Ada.Strings.Right)) |
| 3121 |
= "extend83" then |
| 3122 |
if Format_Object.Include_Annotations then |
| 3123 |
Format_Object.Next_Paragraph_Format_Type := Ada83_Extensions; |
| 3124 |
Format_Object.Next_Paragraph_Subhead_Type := Ada83_Extensions; |
| 3125 |
else -- Don't show annotations. |
| 3126 |
Toss_for_RM ("extend83"); |
| 3127 |
end if; |
| 3128 |
elsif Ada.Characters.Handling.To_Lower (Ada.Strings.Fixed.Trim ( |
| 3129 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Name, Ada.Strings.Right)) |
| 3130 |
= "diffword83" then |
| 3131 |
if Format_Object.Include_Annotations then |
| 3132 |
Format_Object.Next_Paragraph_Format_Type := Ada83_Wording; |
| 3133 |
Format_Object.Next_Paragraph_Subhead_Type := Ada83_Wording; |
| 3134 |
else -- Don't show annotations. |
| 3135 |
Toss_for_RM ("diffword83"); |
| 3136 |
end if; |
| 3137 |
elsif Ada.Characters.Handling.To_Lower (Ada.Strings.Fixed.Trim ( |
| 3138 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Name, Ada.Strings.Right)) |
| 3139 |
= "inconsistent95" then |
| 3140 |
if Format_Object.Include_Annotations then |
| 3141 |
Format_Object.Next_Paragraph_Format_Type := Ada95_Inconsistencies; |
| 3142 |
Format_Object.Next_Paragraph_Subhead_Type := Ada95_Inconsistencies; |
| 3143 |
else -- Don't show annotations. |
| 3144 |
Toss_for_RM ("inconsistent95"); |
| 3145 |
end if; |
| 3146 |
elsif Ada.Characters.Handling.To_Lower (Ada.Strings.Fixed.Trim ( |
| 3147 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Name, Ada.Strings.Right)) |
| 3148 |
= "incompatible95" then |
| 3149 |
if Format_Object.Include_Annotations then |
| 3150 |
Format_Object.Next_Paragraph_Format_Type := Ada95_Incompatibilities; |
| 3151 |
Format_Object.Next_Paragraph_Subhead_Type := Ada95_Incompatibilities; |
| 3152 |
else -- Don't show annotations. |
| 3153 |
Toss_for_RM ("incompatible95"); |
| 3154 |
end if; |
| 3155 |
elsif Ada.Characters.Handling.To_Lower (Ada.Strings.Fixed.Trim ( |
| 3156 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Name, Ada.Strings.Right)) |
| 3157 |
= "extend95" then |
| 3158 |
if Format_Object.Include_Annotations then |
| 3159 |
Format_Object.Next_Paragraph_Format_Type := Ada95_Extensions; |
| 3160 |
Format_Object.Next_Paragraph_Subhead_Type := Ada95_Extensions; |
| 3161 |
else -- Don't show annotations. |
| 3162 |
Toss_for_RM ("extend95"); |
| 3163 |
end if; |
| 3164 |
elsif Ada.Characters.Handling.To_Lower (Ada.Strings.Fixed.Trim ( |
| 3165 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Name, Ada.Strings.Right)) |
| 3166 |
= "diffword95" then |
| 3167 |
if Format_Object.Include_Annotations then |
| 3168 |
Format_Object.Next_Paragraph_Format_Type := Ada95_Wording; |
| 3169 |
Format_Object.Next_Paragraph_Subhead_Type := Ada95_Wording; |
| 3170 |
else -- Don't show annotations. |
| 3171 |
Toss_for_RM ("diffword95"); |
| 3172 |
end if; |
| 3173 |
elsif Ada.Characters.Handling.To_Lower (Ada.Strings.Fixed.Trim ( |
| 3174 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Name, Ada.Strings.Right)) |
| 3175 |
= "inconsistent2005" then |
| 3176 |
if Format_Object.Include_Annotations then |
| 3177 |
Format_Object.Next_Paragraph_Format_Type := Ada2005_Inconsistencies; |
| 3178 |
Format_Object.Next_Paragraph_Subhead_Type := Ada2005_Inconsistencies; |
| 3179 |
else -- Don't show annotations. |
| 3180 |
Toss_for_RM ("inconsistent2005"); |
| 3181 |
end if; |
| 3182 |
elsif Ada.Characters.Handling.To_Lower (Ada.Strings.Fixed.Trim ( |
| 3183 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Name, Ada.Strings.Right)) |
| 3184 |
= "incompatible2005" then |
| 3185 |
if Format_Object.Include_Annotations then |
| 3186 |
Format_Object.Next_Paragraph_Format_Type := Ada2005_Incompatibilities; |
| 3187 |
Format_Object.Next_Paragraph_Subhead_Type := Ada2005_Incompatibilities; |
| 3188 |
else -- Don't show annotations. |
| 3189 |
Toss_for_RM ("incompatible2005"); |
| 3190 |
end if; |
| 3191 |
elsif Ada.Characters.Handling.To_Lower (Ada.Strings.Fixed.Trim ( |
| 3192 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Name, Ada.Strings.Right)) |
| 3193 |
= "extend2005" then |
| 3194 |
if Format_Object.Include_Annotations then |
| 3195 |
Format_Object.Next_Paragraph_Format_Type := Ada2005_Extensions; |
| 3196 |
Format_Object.Next_Paragraph_Subhead_Type := Ada2005_Extensions; |
| 3197 |
else -- Don't show annotations. |
| 3198 |
Toss_for_RM ("extend2005"); |
| 3199 |
end if; |
| 3200 |
elsif Ada.Characters.Handling.To_Lower (Ada.Strings.Fixed.Trim ( |
| 3201 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Name, Ada.Strings.Right)) |
| 3202 |
= "diffword2005" then |
| 3203 |
if Format_Object.Include_Annotations then |
| 3204 |
Format_Object.Next_Paragraph_Format_Type := Ada2005_Wording; |
| 3205 |
Format_Object.Next_Paragraph_Subhead_Type := Ada2005_Wording; |
| 3206 |
else -- Don't show annotations. |
| 3207 |
Toss_for_RM ("diffword2005"); |
| 3208 |
end if; |
| 3209 |
elsif Ada.Characters.Handling.To_Lower (Ada.Strings.Fixed.Trim ( |
| 3210 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Name, Ada.Strings.Right)) |
| 3211 |
= "inconsistent2012" then |
| 3212 |
if Format_Object.Include_Annotations then |
| 3213 |
Format_Object.Next_Paragraph_Format_Type := Ada2012_Inconsistencies; |
| 3214 |
Format_Object.Next_Paragraph_Subhead_Type := Ada2012_Inconsistencies; |
| 3215 |
else -- Don't show annotations. |
| 3216 |
Toss_for_RM ("inconsistent2012"); |
| 3217 |
end if; |
| 3218 |
elsif Ada.Characters.Handling.To_Lower (Ada.Strings.Fixed.Trim ( |
| 3219 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Name, Ada.Strings.Right)) |
| 3220 |
= "incompatible2012" then |
| 3221 |
if Format_Object.Include_Annotations then |
| 3222 |
Format_Object.Next_Paragraph_Format_Type := Ada2012_Incompatibilities; |
| 3223 |
Format_Object.Next_Paragraph_Subhead_Type := Ada2012_Incompatibilities; |
| 3224 |
else -- Don't show annotations. |
| 3225 |
Toss_for_RM ("incompatible2012"); |
| 3226 |
end if; |
| 3227 |
elsif Ada.Characters.Handling.To_Lower (Ada.Strings.Fixed.Trim ( |
| 3228 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Name, Ada.Strings.Right)) |
| 3229 |
= "extend2012" then |
| 3230 |
if Format_Object.Include_Annotations then |
| 3231 |
Format_Object.Next_Paragraph_Format_Type := Ada2012_Extensions; |
| 3232 |
Format_Object.Next_Paragraph_Subhead_Type := Ada2012_Extensions; |
| 3233 |
else -- Don't show annotations. |
| 3234 |
Toss_for_RM ("extend2012"); |
| 3235 |
end if; |
| 3236 |
elsif Ada.Characters.Handling.To_Lower (Ada.Strings.Fixed.Trim ( |
| 3237 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Name, Ada.Strings.Right)) |
| 3238 |
= "diffword2012" then |
| 3239 |
if Format_Object.Include_Annotations then |
| 3240 |
Format_Object.Next_Paragraph_Format_Type := Ada2012_Wording; |
| 3241 |
Format_Object.Next_Paragraph_Subhead_Type := Ada2012_Wording; |
| 3242 |
else -- Don't show annotations. |
| 3243 |
Toss_for_RM ("diffword2012"); |
| 3244 |
end if; |
| 3245 |
-- ASIS groupings: |
| 3246 |
elsif Ada.Characters.Handling.To_Lower (Ada.Strings.Fixed.Trim ( |
| 3247 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Name, Ada.Strings.Right)) |
| 3248 |
= "elementref" then |
| 3249 |
if Format_Object.Include_Annotations then |
| 3250 |
Format_Object.Next_Paragraph_Format_Type := Element_Ref; |
| 3251 |
Format_Object.Next_Paragraph_Subhead_Type := Element_Ref; |
| 3252 |
else -- Don't show annotations. |
| 3253 |
Toss_for_RM ("elementref"); |
| 3254 |
end if; |
| 3255 |
elsif Ada.Characters.Handling.To_Lower (Ada.Strings.Fixed.Trim ( |
| 3256 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Name, Ada.Strings.Right)) |
| 3257 |
= "childref" then |
| 3258 |
if Format_Object.Include_Annotations then |
| 3259 |
Format_Object.Next_Paragraph_Format_Type := Child_Ref; |
| 3260 |
Format_Object.Next_Paragraph_Subhead_Type := Child_Ref; |
| 3261 |
else -- Don't show annotations. |
| 3262 |
Toss_for_RM ("childref"); |
| 3263 |
end if; |
| 3264 |
elsif Ada.Characters.Handling.To_Lower (Ada.Strings.Fixed.Trim ( |
| 3265 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Name, Ada.Strings.Right)) |
| 3266 |
= "usagenote" then |
| 3267 |
if Format_Object.Include_Annotations then |
| 3268 |
Format_Object.Next_Paragraph_Format_Type := Usage_Note; |
| 3269 |
Format_Object.Next_Paragraph_Subhead_Type := Usage_Note; |
| 3270 |
else -- Don't show annotations. |
| 3271 |
Toss_for_RM ("usagenote"); |
| 3272 |
end if; |
| 3273 |
-- AARM annotations: |
| 3274 |
elsif Ada.Characters.Handling.To_Lower (Ada.Strings.Fixed.Trim ( |
| 3275 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Name, Ada.Strings.Right)) |
| 3276 |
= "discussion" then |
| 3277 |
if Format_Object.Include_Annotations then |
| 3278 |
Format_Object.Next_Paragraph_Format_Type := Discussion; |
| 3279 |
Format_Object.Next_Paragraph_Subhead_Type := Discussion; |
| 3280 |
else -- Don't show annotations. |
| 3281 |
Toss_for_RM ("discussion"); |
| 3282 |
end if; |
| 3283 |
elsif Ada.Characters.Handling.To_Lower (Ada.Strings.Fixed.Trim ( |
| 3284 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Name, Ada.Strings.Right)) |
| 3285 |
= "reason" then |
| 3286 |
if Format_Object.Include_Annotations then |
| 3287 |
Format_Object.Next_Paragraph_Format_Type := Reason; |
| 3288 |
Format_Object.Next_Paragraph_Subhead_Type := Reason; |
| 3289 |
else -- Don't show annotations. |
| 3290 |
Toss_for_RM ("reason"); |
| 3291 |
end if; |
| 3292 |
elsif Ada.Characters.Handling.To_Lower (Ada.Strings.Fixed.Trim ( |
| 3293 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Name, Ada.Strings.Right)) |
| 3294 |
= "ramification" then |
| 3295 |
if Format_Object.Include_Annotations then |
| 3296 |
Format_Object.Next_Paragraph_Format_Type := Ramification; |
| 3297 |
Format_Object.Next_Paragraph_Subhead_Type := Ramification; |
| 3298 |
else -- Don't show annotations. |
| 3299 |
Toss_for_RM ("ramification"); |
| 3300 |
end if; |
| 3301 |
elsif Ada.Characters.Handling.To_Lower (Ada.Strings.Fixed.Trim ( |
| 3302 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Name, Ada.Strings.Right)) |
| 3303 |
= "theproof" then |
| 3304 |
if Format_Object.Include_Annotations then |
| 3305 |
Format_Object.Next_Paragraph_Format_Type := Proof; |
| 3306 |
Format_Object.Next_Paragraph_Subhead_Type := Proof; |
| 3307 |
else -- Don't show annotations. |
| 3308 |
Toss_for_RM ("theproof"); |
| 3309 |
end if; |
| 3310 |
elsif Ada.Characters.Handling.To_Lower (Ada.Strings.Fixed.Trim ( |
| 3311 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Name, Ada.Strings.Right)) |
| 3312 |
= "implnote" then |
| 3313 |
if Format_Object.Include_Annotations then |
| 3314 |
Format_Object.Next_Paragraph_Format_Type := Imp_Note; |
| 3315 |
Format_Object.Next_Paragraph_Subhead_Type := Imp_Note; |
| 3316 |
else -- Don't show annotations. |
| 3317 |
Toss_for_RM ("implnote"); |
| 3318 |
end if; |
| 3319 |
elsif Ada.Characters.Handling.To_Lower (Ada.Strings.Fixed.Trim ( |
| 3320 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Name, Ada.Strings.Right)) |
| 3321 |
= "honest" then |
| 3322 |
if Format_Object.Include_Annotations then |
| 3323 |
Format_Object.Next_Paragraph_Format_Type := Honest; |
| 3324 |
Format_Object.Next_Paragraph_Subhead_Type := Honest; |
| 3325 |
else -- Don't show annotations. |
| 3326 |
Toss_for_RM ("honest"); |
| 3327 |
end if; |
| 3328 |
elsif Ada.Characters.Handling.To_Lower (Ada.Strings.Fixed.Trim ( |
| 3329 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Name, Ada.Strings.Right)) |
| 3330 |
= "glossarymarker" then |
| 3331 |
if Format_Object.Include_Annotations then |
| 3332 |
Format_Object.Next_Paragraph_Format_Type := Glossary_Marker; |
| 3333 |
Format_Object.Next_Paragraph_Subhead_Type := Glossary_Marker; |
| 3334 |
else -- Don't show annotations. |
| 3335 |
Toss_for_RM ("glossarymarker"); |
| 3336 |
end if; |
| 3337 |
elsif Ada.Characters.Handling.To_Lower (Ada.Strings.Fixed.Trim ( |
| 3338 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Name, Ada.Strings.Right)) |
| 3339 |
= "aarmonly" then |
| 3340 |
if Format_Object.Include_Annotations then |
| 3341 |
null; -- Leave the format alone. |
| 3342 |
else -- Don't show annotations. |
| 3343 |
Toss_for_RM ("aarmonly"); |
| 3344 |
end if; |
| 3345 |
else |
| 3346 |
Ada.Text_IO.Put_Line (" -- Unknown 'begin' type - " & |
| 3347 |
Ada.Strings.Fixed.Trim (Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Name, Ada.Strings.Right) & |
| 3348 |
" on line " & ARM_Input.Line_String (Input_Object)); |
| 3349 |
end if; |
| 3350 |
end Process_Begin; |
| 3351 |
|
| 3352 |
|
| 3353 |
procedure Process_Command_with_Parameter is |
| 3354 |
-- Process the start of a command with a parameter. |
| 3355 |
-- The parameter character has been processed, and |
| 3356 |
-- a stack item pushed. |
| 3357 |
|
| 3358 |
function Get_NT return String is |
| 3359 |
-- Local routine: |
| 3360 |
-- Return the "current" non-terminal from |
| 3361 |
-- the Syntax_NT string. Handles @Chg. |
| 3362 |
begin |
| 3363 |
return Get_Current_Item (Format_Object, Input_Object, |
| 3364 |
Format_Object.Syntax_NT (1 .. Format_Object.Syntax_NT_Len)); |
| 3365 |
end Get_NT; |
| 3366 |
|
| 3367 |
|
| 3368 |
function Get_Old_NT return String is |
| 3369 |
-- Local routine: |
| 3370 |
-- Return the "current" non-terminal from |
| 3371 |
-- the Syntax_NT string. Handles @Chg. |
| 3372 |
begin |
| 3373 |
return Get_Old_Item (Format_Object, Input_Object, |
| 3374 |
Format_Object.Syntax_NT (1 .. Format_Object.Syntax_NT_Len)); |
| 3375 |
end Get_Old_NT; |
| 3376 |
|
| 3377 |
|
| 3378 |
procedure Get_Change_Version (Is_First : in Boolean; |
| 3379 |
Version : out Character) is |
| 3380 |
-- Get a parameter named "Version", |
| 3381 |
-- containing a character representing the version number. |
| 3382 |
Ch, Close_Ch : Character; |
| 3383 |
begin |
| 3384 |
ARM_Input.Check_Parameter_Name (Input_Object, |
| 3385 |
Param_Name => "Version" & (8..ARM_Input.Command_Name_Type'Last => ' '), |
| 3386 |
Is_First => Is_First, |
| 3387 |
Param_Close_Bracket => Close_Ch); |
| 3388 |
if Close_Ch /= ' ' then |
| 3389 |
-- Get the version character: |
| 3390 |
ARM_Input.Get_Char (Input_Object, Version); |
| 3391 |
ARM_Input.Get_Char (Input_Object, Ch); |
| 3392 |
if Ch /= Close_Ch then |
| 3393 |
Ada.Text_IO.Put_Line (" ** Bad close for change version on line " & ARM_Input.Line_String (Input_Object)); |
| 3394 |
ARM_Input.Replace_Char (Input_Object); |
| 3395 |
end if; |
| 3396 |
-- else no parameter. Weird. |
| 3397 |
end if; |
| 3398 |
end Get_Change_Version; |
| 3399 |
|
| 3400 |
|
| 3401 |
procedure Get_Change_Kind (Kind : out ARM_Database.Paragraph_Change_Kind_Type) is |
| 3402 |
-- Get a parameter named "Kind", containing a word representing |
| 3403 |
-- a change kind. |
| 3404 |
Kind_Name : ARM_Input.Command_Name_Type; |
| 3405 |
Ch, Close_Ch : Character; |
| 3406 |
begin |
| 3407 |
ARM_Input.Check_Parameter_Name (Input_Object, |
| 3408 |
Param_Name => "Kind" & (5..ARM_Input.Command_Name_Type'Last => ' '), |
| 3409 |
Is_First => False, |
| 3410 |
Param_Close_Bracket => Close_Ch); |
| 3411 |
if Close_Ch /= ' ' then |
| 3412 |
-- Get the kind word: |
| 3413 |
Arm_Input.Get_Name (Input_Object, Kind_Name); |
| 3414 |
ARM_Input.Get_Char (Input_Object, Ch); |
| 3415 |
if Ch /= Close_Ch then |
| 3416 |
Ada.Text_IO.Put_Line (" ** Bad close for change kind on line " & ARM_Input.Line_String (Input_Object)); |
| 3417 |
ARM_Input.Replace_Char (Input_Object); |
| 3418 |
end if; |
| 3419 |
if Ada.Characters.Handling.To_Lower (Ada.Strings.Fixed.Trim (Kind_Name, Ada.Strings.Right)) = |
| 3420 |
"revised" then |
| 3421 |
Kind := ARM_Database.Revised; |
| 3422 |
elsif Ada.Characters.Handling.To_Lower (Ada.Strings.Fixed.Trim (Kind_Name, Ada.Strings.Right)) = |
| 3423 |
"revisedadded" then |
| 3424 |
Kind := ARM_Database.Revised_Inserted_Number; |
| 3425 |
elsif Ada.Characters.Handling.To_Lower (Ada.Strings.Fixed.Trim (Kind_Name, Ada.Strings.Right)) = |
| 3426 |
"added" then |
| 3427 |
Kind := ARM_Database.Inserted; |
| 3428 |
elsif Ada.Characters.Handling.To_Lower (Ada.Strings.Fixed.Trim (Kind_Name, Ada.Strings.Right)) = |
| 3429 |
"addednormal" then |
| 3430 |
Kind := ARM_Database.Inserted_Normal_Number; |
| 3431 |
elsif Ada.Characters.Handling.To_Lower (Ada.Strings.Fixed.Trim (Kind_Name, Ada.Strings.Right)) = |
| 3432 |
"deleted" then |
| 3433 |
Kind := ARM_Database.Deleted; |
| 3434 |
elsif Ada.Characters.Handling.To_Lower (Ada.Strings.Fixed.Trim (Kind_Name, Ada.Strings.Right)) = |
| 3435 |
"deletedadded" then |
| 3436 |
Kind := ARM_Database.Deleted_Inserted_Number; |
| 3437 |
elsif Ada.Characters.Handling.To_Lower (Ada.Strings.Fixed.Trim (Kind_Name, Ada.Strings.Right)) = |
| 3438 |
"deletednodelmsg" then |
| 3439 |
Kind := ARM_Database.Deleted_No_Delete_Message; |
| 3440 |
elsif Ada.Characters.Handling.To_Lower (Ada.Strings.Fixed.Trim (Kind_Name, Ada.Strings.Right)) = |
| 3441 |
"deletedaddednodelmsg" then |
| 3442 |
Kind := ARM_Database.Deleted_Inserted_Number_No_Delete_Message; |
| 3443 |
else |
| 3444 |
Ada.Text_IO.Put_Line (" ** Bad kind for change kind: " & |
| 3445 |
Ada.Strings.Fixed.Trim (Kind_Name, Ada.Strings.Right) & |
| 3446 |
" on line " & ARM_Input.Line_String (Input_Object)); |
| 3447 |
end if; |
| 3448 |
-- else no parameter. Weird. |
| 3449 |
end if; |
| 3450 |
end Get_Change_Kind; |
| 3451 |
|
| 3452 |
|
| 3453 |
procedure Get_Boolean (Param_Name : in ARM_Input.Command_Name_Type; |
| 3454 |
Result : out Boolean) is |
| 3455 |
-- Get a boolean value from a parameter named Param_Name. |
| 3456 |
Ch, Close_Ch : Character; |
| 3457 |
begin |
| 3458 |
ARM_Input.Check_Parameter_Name (Input_Object, |
| 3459 |
Param_Name => Param_Name, |
| 3460 |
Is_First => False, |
| 3461 |
Param_Close_Bracket => Close_Ch); |
| 3462 |
if Close_Ch /= ' ' then |
| 3463 |
-- Get the Boolean character: |
| 3464 |
ARM_Input.Get_Char (Input_Object, Ch); |
| 3465 |
case Ch is |
| 3466 |
when 'F' | 'f' | 'N' | 'n' => |
| 3467 |
Result := False; |
| 3468 |
when 'T' | 't' | 'Y' | 'y' => |
| 3469 |
Result := True; |
| 3470 |
when others => |
| 3471 |
Ada.Text_IO.Put_Line (" ** Bad value for boolean parameter " & |
| 3472 |
Ada.Strings.Fixed.Trim (Param_Name, Ada.Strings.Right) & |
| 3473 |
" on line " & ARM_Input.Line_String (Input_Object)); |
| 3474 |
end case; |
| 3475 |
ARM_Input.Get_Char (Input_Object, Ch); |
| 3476 |
if Ch /= Close_Ch then |
| 3477 |
Ada.Text_IO.Put_Line (" ** Bad close for boolean parameter " & |
| 3478 |
Ada.Strings.Fixed.Trim (Param_Name, Ada.Strings.Right) & |
| 3479 |
" on line " & ARM_Input.Line_String (Input_Object)); |
| 3480 |
ARM_Input.Replace_Char (Input_Object); |
| 3481 |
end if; |
| 3482 |
-- else no parameter. Weird. |
| 3483 |
end if; |
| 3484 |
end Get_Boolean; |
| 3485 |
|
| 3486 |
|
| 3487 |
procedure Gen_Ref_or_ARef_Parameter (Display_It : Boolean) is |
| 3488 |
-- Generate (and read) a "Ref" or "ARef" parameter, containing |
| 3489 |
-- a DR or AI reference. Generate it into the document only |
| 3490 |
-- if Display_It is True. |
| 3491 |
Ch, Close_Ch : Character; |
| 3492 |
Ref_Name : ARM_Input.Command_Name_Type; |
| 3493 |
Len : Natural; |
| 3494 |
Which_Param : ARM_Input.Param_Num; |
| 3495 |
New_Ref, Cursor : Reference_Ptr; |
| 3496 |
begin |
| 3497 |
ARM_Input.Check_One_of_Parameter_Names (Input_Object, |
| 3498 |
Param_Name_1 => "Ref" & (4..ARM_Input.Command_Name_Type'Last => ' '), |
| 3499 |
Param_Name_2 => "ARef" & (5..ARM_Input.Command_Name_Type'Last => ' '), |
| 3500 |
Is_First => False, |
| 3501 |
Param_Found => Which_Param, |
| 3502 |
Param_Close_Bracket => Close_Ch); |
| 3503 |
if Close_Ch /= ' ' then |
| 3504 |
-- Get the reference: |
| 3505 |
Len := 0; |
| 3506 |
loop |
| 3507 |
ARM_Input.Get_Char (Input_Object, Ch); |
| 3508 |
if Ch /= Close_Ch then |
| 3509 |
Len := Len + 1; |
| 3510 |
if Len > Ref_Name'Last then |
| 3511 |
Ada.Text_IO.Put_Line (" ** Reference too long on line " & ARM_Input.Line_String (Input_Object)); |
| 3512 |
else |
| 3513 |
Ref_Name(Len) := Ch; |
| 3514 |
end if; |
| 3515 |
else -- End of the reference. |
| 3516 |
if Len = 0 then |
| 3517 |
Ada.Text_IO.Put_Line (" ** Failed to find reference on line " & ARM_Input.Line_String (Input_Object)); |
| 3518 |
end if; |
| 3519 |
exit; |
| 3520 |
end if; |
| 3521 |
end loop; |
| 3522 |
|
| 3523 |
if Display_It then |
| 3524 |
-- Save a reference for outputting on the next |
| 3525 |
-- paragraph start. |
| 3526 |
New_Ref := Allocate_Reference; |
| 3527 |
New_Ref.all := (Ref_Name => Ref_Name, |
| 3528 |
Ref_Len => Len, |
| 3529 |
Is_DR_Ref => (Which_Param = 1), |
| 3530 |
-- DR reference if Param = 1; |
| 3531 |
-- AI reference otherwise. |
| 3532 |
Next => null); |
| 3533 |
-- Attach this to the *end* of the list. |
| 3534 |
if Format_Object.References = null then |
| 3535 |
Format_Object.References := New_Ref; |
| 3536 |
else |
| 3537 |
Cursor := Format_Object.References; |
| 3538 |
while Cursor.Next /= null loop |
| 3539 |
Cursor := Cursor.next; |
| 3540 |
end loop; |
| 3541 |
Cursor.Next := New_Ref; |
| 3542 |
end if; |
| 3543 |
-- else don't display it. |
| 3544 |
end if; |
| 3545 |
-- else no parameter. Weird. |
| 3546 |
end if; |
| 3547 |
end Gen_Ref_or_ARef_Parameter; |
| 3548 |
|
| 3549 |
|
| 3550 |
procedure Gen_Chg_xxxx (Param_Cmd : in Data.Command_Type; |
| 3551 |
AARM_Prefix : in String) is |
| 3552 |
-- Implement chgimpdef, chgimpladv, chgdocreq, and |
| 3553 |
-- chgaspectdesc commands. |
| 3554 |
-- The AARM prefix (if needed) is AARM_Prefix, and |
| 3555 |
-- the parameter command is Param_Cmd. |
| 3556 |
|
| 3557 |
-- This command is of the form: |
| 3558 |
-- @chgxxxxx{Version=[<version>], Kind=(<kind>), |
| 3559 |
-- Text=(<text>)}} |
| 3560 |
-- where <version> is a single character, <Kind> is one |
| 3561 |
-- of Revised, Added, or Deleted, and this is followed |
| 3562 |
-- by the text. As usual, any of the |
| 3563 |
-- allowed bracketing characters can be used. |
| 3564 |
Close_Ch : Character; |
| 3565 |
Kind : ARM_Database.Paragraph_Change_Kind_Type; |
| 3566 |
Version : ARM_Contents.Change_Version_Type; |
| 3567 |
Display_It : Boolean; |
| 3568 |
use type ARM_Database.Paragraph_Change_Kind_Type; |
| 3569 |
Local_Change : ARM_Output.Change_Type; |
| 3570 |
Skip_Header : Boolean := False; |
| 3571 |
begin |
| 3572 |
Get_Change_Version (Is_First => True, |
| 3573 |
Version => Version); |
| 3574 |
-- Read a parameter named "Version". |
| 3575 |
|
| 3576 |
Get_Change_Kind (Kind); |
| 3577 |
-- Read a parameter named "Kind". |
| 3578 |
|
| 3579 |
if Format_Object.Impdef_Info.Command /= None then |
| 3580 |
Ada.Text_IO.Put_Line (" ** Nested impdef entry on line " & ARM_Input.Line_String (Input_Object)); |
| 3581 |
-- else OK. |
| 3582 |
end if; |
| 3583 |
-- Setup impdef information for this command: |
| 3584 |
case Param_Cmd is |
| 3585 |
when Change_Impdef_Text_Param => |
| 3586 |
Format_Object.Impdef_Info := |
| 3587 |
(Command => Impdef, |
| 3588 |
Change_Kind => <>, -- Set below. |
| 3589 |
Version => <>, -- Set below. |
| 3590 |
Initial_Version => |
| 3591 |
Version, -- Until we decide differently. |
| 3592 |
Add_to_DB => True, -- Until we decide differently. |
| 3593 |
Paragraph_String => <>, -- Set below. |
| 3594 |
Paragraph_Len => <>);-- Set below. |
| 3595 |
when Change_Docreq_Text_Param => |
| 3596 |
Format_Object.Impdef_Info := |
| 3597 |
(Command => Docreq, |
| 3598 |
Change_Kind => <>, -- Set below. |
| 3599 |
Version => <>, -- Set below. |
| 3600 |
Initial_Version => |
| 3601 |
Version, -- Until we decide differently. |
| 3602 |
Add_to_DB => True, -- Until we decide differently. |
| 3603 |
Paragraph_String => <>, -- Set below. |
| 3604 |
Paragraph_Len => <>);-- Set below. |
| 3605 |
when Change_Impladv_Text_Param => |
| 3606 |
Format_Object.Impdef_Info := |
| 3607 |
(Command => Impladv, |
| 3608 |
Change_Kind => <>, -- Set below. |
| 3609 |
Version => <>, -- Set below. |
| 3610 |
Initial_Version => |
| 3611 |
Version, -- Until we decide differently. |
| 3612 |
Add_to_DB => True, -- Until we decide differently. |
| 3613 |
Paragraph_String => <>, -- Set below. |
| 3614 |
Paragraph_Len => <>);-- Set below. |
| 3615 |
when Change_AspectDesc_Text_Param => |
| 3616 |
Format_Object.Impdef_Info := |
| 3617 |
(Command => Aspect, |
| 3618 |
Change_Kind => <>, -- Set below. |
| 3619 |
Version => <>, -- Set below. |
| 3620 |
Initial_Version => |
| 3621 |
Version, -- Until we decide differently. |
| 3622 |
Add_to_DB => True, -- Until we decide differently. |
| 3623 |
Aspect_Name => <>, -- Set below. |
| 3624 |
Aspect_Name_Len => <>, -- Set below. |
| 3625 |
Paragraph_String => <>, -- Set below. |
| 3626 |
Paragraph_Len => <>);-- Set below. |
| 3627 |
when others => |
| 3628 |
raise Program_Error; -- Wrong kind of command passed in. |
| 3629 |
end case; |
| 3630 |
-- Check for the optional "InitialVersion" parameter, |
| 3631 |
-- and the not optional, but only used for some commands |
| 3632 |
-- "Aspect" parameter, stopping when we reach Text: |
| 3633 |
|
| 3634 |
-- Note: If there is no InitialVersion command, use the same |
| 3635 |
-- version of the rest of the command (which was set when the |
| 3636 |
-- Info was created). |
| 3637 |
declare |
| 3638 |
Which_Param : ARM_Input.Param_Num; |
| 3639 |
Ch : Character; |
| 3640 |
Saw_Aspect : Boolean := False; |
| 3641 |
begin |
| 3642 |
loop |
| 3643 |
ARM_Input.Check_One_of_Parameter_Names (Input_Object, |
| 3644 |
Param_Name_1 => "InitialVersion" & (15..ARM_Input.Command_Name_Type'Last => ' '), |
| 3645 |
Param_Name_2 => "Aspect" & (7..ARM_Input.Command_Name_Type'Last => ' '), |
| 3646 |
Param_Name_3 => "Text" & (5..ARM_Input.Command_Name_Type'Last => ' '), |
| 3647 |
Is_First => False, |
| 3648 |
Param_Found => Which_Param, |
| 3649 |
Param_Close_Bracket => Close_Ch); |
| 3650 |
|
| 3651 |
if Which_Param = 1 and then Close_Ch /= ' ' then |
| 3652 |
-- Found InitialVersion |
| 3653 |
ARM_Input.Get_Char (Input_Object, Ch); |
| 3654 |
Format_Object.Impdef_Info.Initial_Version := Ch; |
| 3655 |
ARM_Input.Get_Char (Input_Object, Ch); |
| 3656 |
if Ch /= Close_Ch then |
| 3657 |
Ada.Text_IO.Put_Line (" ** Bad close for InitialVersion parameter on line " & |
| 3658 |
ARM_Input.Line_String (Input_Object)); |
| 3659 |
ARM_Input.Replace_Char (Input_Object); |
| 3660 |
end if; |
| 3661 |
elsif Which_Param = 2 and then Close_Ch /= ' ' then |
| 3662 |
-- Found Aspect parameter. |
| 3663 |
Saw_Aspect := True; |
| 3664 |
|
| 3665 |
-- Save name: |
| 3666 |
ARM_Input.Copy_to_String_until_Close_Char ( |
| 3667 |
Input_Object, |
| 3668 |
Close_Ch, |
| 3669 |
Format_Object.Impdef_Info.Aspect_Name, |
| 3670 |
Format_Object.Impdef_Info.Aspect_Name_Len); |
| 3671 |
|
| 3672 |
else -- We found "Text" (or an error) |
| 3673 |
exit; -- Handling of Text is below. |
| 3674 |
end if; |
| 3675 |
end loop; |
| 3676 |
if Format_Object.Impdef_Info.Command = Aspect then |
| 3677 |
if not Saw_Aspect then |
| 3678 |
Ada.Text_IO.Put_Line (" ** Missing Aspect parameter on line " & |
| 3679 |
ARM_Input.Line_String (Input_Object)); |
| 3680 |
-- else OK. |
| 3681 |
end if; |
| 3682 |
else -- Not aspect. |
| 3683 |
if Saw_Aspect then |
| 3684 |
Ada.Text_IO.Put_Line (" ** Aspect parameter on non-aspect command on line " & |
| 3685 |
ARM_Input.Line_String (Input_Object)); |
| 3686 |
-- else OK. |
| 3687 |
end if; |
| 3688 |
end if; |
| 3689 |
end; |
| 3690 |
|
| 3691 |
--Ada.Text_IO.Put_Line ("Gen_Chg_xxxx, Kind=" & |
| 3692 |
--ARM_Database.Paragraph_Change_Kind_Type'Image(Kind) & |
| 3693 |
--"; version=" & Version & "; InitVer=" & Format_Object.Impdef_Initial_Version); |
| 3694 |
|
| 3695 |
if (Kind = ARM_Database.Inserted or else |
| 3696 |
Kind = ARM_Database.Inserted_Normal_Number) then |
| 3697 |
Calc_Change_Disposition |
| 3698 |
(Format_Object => Format_Object, |
| 3699 |
Version => Version, |
| 3700 |
Operation => ARM_Output.Insertion, |
| 3701 |
Text_Kind => Local_Change); |
| 3702 |
--Ada.Text_IO.Put_Line (" Insert, Local_Change=" & |
| 3703 |
--ARM_Output.Change_Type'Image(Local_Change)); |
| 3704 |
case Local_Change is |
| 3705 |
when Do_Not_Display_Text => |
| 3706 |
Display_It := False; |
| 3707 |
Local_Change := ARM_Output.None; |
| 3708 |
Format_Object.Impdef_Info.Add_to_DB := False; |
| 3709 |
-- Do not add to the database, or display anything. |
| 3710 |
when ARM_Output.None|ARM_Output.Insertion => |
| 3711 |
Format_Object.Impdef_Info.Version := Version; |
| 3712 |
Format_Object.Impdef_Info.Change_Kind := Kind; |
| 3713 |
Display_It := Format_Object.Include_Annotations; |
| 3714 |
-- Show impdef notes only if we're showing annotations. |
| 3715 |
when ARM_Output.Deletion => |
| 3716 |
raise Program_Error; |
| 3717 |
end case; |
| 3718 |
elsif Kind = ARM_Database.Deleted or else |
| 3719 |
Kind = ARM_Database.Deleted_Inserted_Number or else |
| 3720 |
Kind = ARM_Database.Deleted_No_Delete_Message or else |
| 3721 |
Kind = ARM_Database.Deleted_Inserted_Number_No_Delete_Message then |
| 3722 |
Calc_Change_Disposition |
| 3723 |
(Format_Object => Format_Object, |
| 3724 |
Version => Version, |
| 3725 |
Operation => ARM_Output.Deletion, |
| 3726 |
Text_Kind => Local_Change); |
| 3727 |
--Ada.Text_IO.Put_Line (" Delete, Local_Change=" & |
| 3728 |
--ARM_Output.Change_Type'Image(Local_Change)); |
| 3729 |
case Local_Change is |
| 3730 |
when Do_Not_Display_Text => |
| 3731 |
--Display_It := False; |
| 3732 |
-- We need to show the paragraph, without its header, |
| 3733 |
-- so that we get a proper "this paragraph is deleted" |
| 3734 |
-- message (if one is needed). Nothing will actually |
| 3735 |
-- be output in this case. |
| 3736 |
Local_Change := ARM_Output.None; |
| 3737 |
Skip_Header := True; |
| 3738 |
Format_Object.Impdef_Info.Version := Version; |
| 3739 |
Format_Object.Impdef_Info.Change_Kind := Kind; |
| 3740 |
Display_It := Format_Object.Include_Annotations; |
| 3741 |
-- Show impdef notes only if we're showing annotations. |
| 3742 |
Format_Object.Impdef_Info.Add_to_DB := True; |
| 3743 |
-- This will add deleted text to the database, |
| 3744 |
-- but there isn't a sensible alternative option, |
| 3745 |
-- as we need to have the deleted paragraph numbers. |
| 3746 |
when ARM_Output.None | ARM_Output.Deletion => |
| 3747 |
Format_Object.Impdef_Info.Version := Version; |
| 3748 |
Format_Object.Impdef_Info.Change_Kind := Kind; |
| 3749 |
Display_It := Format_Object.Include_Annotations; |
| 3750 |
-- Show impdef notes only if we're showing annotations. |
| 3751 |
Skip_Header := False; |
| 3752 |
when ARM_Output.Insertion => |
| 3753 |
raise Program_Error; |
| 3754 |
end case; |
| 3755 |
else -- we always display it. |
| 3756 |
--Ada.Text_IO.Put_Line (" Other"); |
| 3757 |
Format_Object.Impdef_Info.Version := Version; |
| 3758 |
Format_Object.Impdef_Info.Change_Kind := Kind; |
| 3759 |
Display_It := Format_Object.Include_Annotations; |
| 3760 |
-- Show impdef notes only if we're showing annotations. |
| 3761 |
Local_Change := ARM_Output.None; |
| 3762 |
end if; |
| 3763 |
--Ada.Text_IO.Put_Line (" Display_It=" & Boolean'Image(Display_It)); |
| 3764 |
|
| 3765 |
-- "Text" parameter name consumed above. |
| 3766 |
if Close_Ch /= ' ' then |
| 3767 |
-- Stack it so we can process the end: |
| 3768 |
Set_Nesting_for_Parameter |
| 3769 |
(Command => Param_Cmd, |
| 3770 |
Close_Ch => Close_Ch); |
| 3771 |
|
| 3772 |
ARM_Input.Start_Recording (Input_Object); |
| 3773 |
|
| 3774 |
if Format_Object.In_Paragraph then |
| 3775 |
-- Do this to preserve any inserted paragraph info. |
| 3776 |
Format_Object.Impdef_Info.Paragraph_String := |
| 3777 |
Format_Object.Current_Paragraph_String; |
| 3778 |
Format_Object.Impdef_Info.Paragraph_Len := |
| 3779 |
Format_Object.Current_Paragraph_Len; |
| 3780 |
else |
| 3781 |
declare |
| 3782 |
PNum : constant String := Positive'Image ( |
| 3783 |
Format_Object.Next_Paragraph - 1); |
| 3784 |
begin |
| 3785 |
Format_Object.Impdef_Info.Paragraph_Len := PNum'Length - 1; |
| 3786 |
Format_Object.Impdef_Info.Paragraph_String (1 .. PNum'Last-1) := |
| 3787 |
PNum (2 .. PNum'Last); |
| 3788 |
end; |
| 3789 |
end if; |
| 3790 |
|
| 3791 |
if Display_It then |
| 3792 |
Check_End_Paragraph; -- End any paragraph that we're in. |
| 3793 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Old_Last_Subhead_Paragraph := Format_Object.Last_Paragraph_Subhead_Type; |
| 3794 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Old_Next_Subhead_Paragraph := Format_Object.Next_Paragraph_Subhead_Type; |
| 3795 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Old_Next_Paragraph_Format := Format_Object.Next_Paragraph_Format_Type; |
| 3796 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Old_Tab_Stops := Format_Object.Paragraph_Tab_Stops; |
| 3797 |
Format_Object.Next_Paragraph_Format_Type := Bare_Annotation; |
| 3798 |
Format_Object.Next_Paragraph_Subhead_Type := Bare_Annotation; |
| 3799 |
Format_Object.Next_Paragraph_Version := Format_Object.Impdef_Info.Version; |
| 3800 |
Format_Object.Next_Paragraph_Change_Kind := Format_Object.Impdef_Info.Change_Kind; |
| 3801 |
Format_Object.Paragraph_Tab_Stops := ARM_Output.NO_TABS; |
| 3802 |
Check_Paragraph; |
| 3803 |
|
| 3804 |
if not Skip_Header then |
| 3805 |
declare |
| 3806 |
Local_Format : ARM_Output.Format_Type := |
| 3807 |
Format_Object.Text_Format; |
| 3808 |
begin |
| 3809 |
Local_Format.Bold := True; |
| 3810 |
Local_Format.Version := Format_Object.Impdef_Info.Version; |
| 3811 |
if ARM_Output."/=" (Local_Change, ARM_Output.None) then |
| 3812 |
Local_Format.Change := Local_Change; |
| 3813 |
ARM_Output.Text_Format (Output_Object, |
| 3814 |
Local_Format); |
| 3815 |
else -- No change from us: |
| 3816 |
ARM_Output.Text_Format (Output_Object, |
| 3817 |
Local_Format); |
| 3818 |
end if; |
| 3819 |
ARM_Output.Ordinary_Text (Output_Object, |
| 3820 |
Text => AARM_Prefix); |
| 3821 |
Local_Format.Bold := Format_Object.Text_Format.Bold; |
| 3822 |
Local_Format.Change := Format_Object.Text_Format.Change; |
| 3823 |
ARM_Output.Text_Format (Output_Object, |
| 3824 |
Local_Format); |
| 3825 |
end; |
| 3826 |
-- else skip the header, do nothing. |
| 3827 |
end if; |
| 3828 |
Format_Object.Last_Paragraph_Subhead_Type := Bare_Annotation; |
| 3829 |
Format_Object.Last_Non_Space := False; |
| 3830 |
|
| 3831 |
if Format_Object.Impdef_Info.Command = Aspect then |
| 3832 |
-- Output the aspect name: |
| 3833 |
declare |
| 3834 |
Local_Format : ARM_Output.Format_Type := |
| 3835 |
Format_Object.Text_Format; |
| 3836 |
begin |
| 3837 |
Local_Format.Bold := True; |
| 3838 |
Local_Format.Version := Format_Object.Impdef_Info.Version; |
| 3839 |
if ARM_Output."/=" (Local_Change, ARM_Output.None) then |
| 3840 |
Local_Format.Change := Local_Change; |
| 3841 |
ARM_Output.Text_Format (Output_Object, |
| 3842 |
Local_Format); |
| 3843 |
else -- No change from us: |
| 3844 |
ARM_Output.Text_Format (Output_Object, |
| 3845 |
Local_Format); |
| 3846 |
end if; |
| 3847 |
ARM_Output.Ordinary_Text (Output_Object, |
| 3848 |
Text => Format_Object.Impdef_Info.Aspect_Name(1..Format_Object.Impdef_Info.Aspect_Name_Len)); |
| 3849 |
ARM_Output.Ordinary_Text (Output_Object, |
| 3850 |
Text => ": "); |
| 3851 |
Local_Format.Bold := Format_Object.Text_Format.Bold; |
| 3852 |
Local_Format.Change := Format_Object.Text_Format.Change; |
| 3853 |
ARM_Output.Text_Format (Output_Object, |
| 3854 |
Local_Format); |
| 3855 |
end; |
| 3856 |
-- else no additional text. |
| 3857 |
end if; |
| 3858 |
else -- Don't display, skip the text: |
| 3859 |
ARM_Input.Skip_until_Close_Char (Input_Object, |
| 3860 |
Close_Ch); |
| 3861 |
ARM_Input.Replace_Char (Input_Object); -- Let the normal termination clean this up. |
| 3862 |
end if; |
| 3863 |
|
| 3864 |
-- else no parameter. Weird. |
| 3865 |
end if; |
| 3866 |
end Gen_Chg_xxxx; |
| 3867 |
|
| 3868 |
|
| 3869 |
procedure Get_Syntax_Parameters (Has_Version : in Boolean; |
| 3870 |
RHS_Close_Ch : out Character) is |
| 3871 |
-- Get the parameters for a Syn, AddedSyn, or DeletedSyn |
| 3872 |
-- command. The command has a version parameter (it's not @Syn) |
| 3873 |
-- if Has_Version is True. The results are put into the usual |
| 3874 |
-- places. The RHS parameter's name is evaluated, and its |
| 3875 |
-- closing character is RHS_Close_Ch. |
| 3876 |
-- @Syn{[Tabs=<Tabset>, ]LHS=<Non-terminal>, RHS=<Production>} |
| 3877 |
-- @AddedSyn{Version=[Version],[Tabs=<Tabset>, ]LHS=<Non-terminal>, RHS=<Production>} |
| 3878 |
-- @DeletedSyn{Version=[Version],[Tabs=<Tabset>, ]LHS=<Non-terminal>, RHS=<Production>} |
| 3879 |
Close_Ch, Ch : Character; |
| 3880 |
Was_Tabs : Boolean := False; |
| 3881 |
begin |
| 3882 |
if Has_Version then |
| 3883 |
Get_Change_Version (Is_First => True, |
| 3884 |
Version => |
| 3885 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Change_Version); |
| 3886 |
end if; |
| 3887 |
|
| 3888 |
-- Peek to see if Tabs parmeter is present: |
| 3889 |
ARM_Input.Get_Char (Input_Object, Ch); |
| 3890 |
ARM_Input.Replace_Char (Input_Object); |
| 3891 |
if Ch = 'T' or else Ch = 't' then |
| 3892 |
Was_Tabs := True; |
| 3893 |
ARM_Input.Check_Parameter_Name (Input_Object, |
| 3894 |
Param_Name => "Tabs" & (5..ARM_Input.Command_Name_Type'Last => ' '), |
| 3895 |
Is_First => (not Has_Version), |
| 3896 |
Param_Close_Bracket => Close_Ch); |
| 3897 |
if Close_Ch /= ' ' then |
| 3898 |
-- Grab the tab string: |
| 3899 |
ARM_Input.Copy_to_String_until_Close_Char ( |
| 3900 |
Input_Object, |
| 3901 |
Close_Ch, |
| 3902 |
Format_Object.Syntax_Tab, |
| 3903 |
Format_Object.Syntax_Tab_Len); |
| 3904 |
-- else no parameter. Weird. |
| 3905 |
end if; |
| 3906 |
else |
| 3907 |
Format_Object.Syntax_Tab_Len := 0; |
| 3908 |
end if; |
| 3909 |
|
| 3910 |
ARM_Input.Check_Parameter_Name (Input_Object, |
| 3911 |
Param_Name => "LHS" & (4..ARM_Input.Command_Name_Type'Last => ' '), |
| 3912 |
Is_First => (not Was_Tabs) and (not Has_Version), |
| 3913 |
Param_Close_Bracket => Close_Ch); |
| 3914 |
if Close_Ch /= ' ' then |
| 3915 |
-- Copy over the non-terminal: |
| 3916 |
ARM_Input.Copy_to_String_until_Close_Char ( |
| 3917 |
Input_Object, |
| 3918 |
Close_Ch, |
| 3919 |
Format_Object.Syntax_NT, |
| 3920 |
Format_Object.Syntax_NT_Len); |
| 3921 |
-- else no parameter. Weird. |
| 3922 |
end if; |
| 3923 |
|
| 3924 |
ARM_Input.Check_Parameter_Name (Input_Object, |
| 3925 |
Param_Name => "RHS" & (4..ARM_Input.Command_Name_Type'Last => ' '), |
| 3926 |
Is_First => False, |
| 3927 |
Param_Close_Bracket => RHS_Close_Ch); |
| 3928 |
end Get_Syntax_Parameters; |
| 3929 |
|
| 3930 |
|
| 3931 |
procedure Gen_Syntax_Rule (Disposition : in ARM_Output.Change_Type; |
| 3932 |
RHS_Close_Ch : in Character) is |
| 3933 |
-- Generate a syntax rule with the specified disposition |
| 3934 |
-- for explicitly generated text. All of the parameters have been |
| 3935 |
-- read in; the close character for the RHS parameter is |
| 3936 |
-- RHS_Close_Ch. |
| 3937 |
use type ARM_Output.Change_Type; |
| 3938 |
Org_Tabs : ARM_Output.Tab_Info; |
| 3939 |
Key : ARM_Index.Index_Key; |
| 3940 |
begin |
| 3941 |
if Disposition = Do_Not_Display_Text then |
| 3942 |
if RHS_Close_Ch /= ' ' then |
| 3943 |
-- Skip the RHS and put nothing in the DB. |
| 3944 |
ARM_Input.Skip_until_Close_Char (Input_Object, RHS_Close_Ch); |
| 3945 |
ARM_Input.Replace_Char (Input_Object); -- Let the normal termination clean this up. |
| 3946 |
if ARM_Database."=" (Format_Object.Next_Paragraph_Change_Kind, |
| 3947 |
ARM_Database.Deleted) or else |
| 3948 |
ARM_Database."=" (Format_Object.Next_Paragraph_Change_Kind, |
| 3949 |
ARM_Database.Deleted_Inserted_Number) or else |
| 3950 |
ARM_Database."=" (Format_Object.Next_Paragraph_Change_Kind, |
| 3951 |
ARM_Database.Deleted_No_Delete_Message) or else |
| 3952 |
ARM_Database."=" (Format_Object.Next_Paragraph_Change_Kind, |
| 3953 |
ARM_Database.Deleted_Inserted_Number_No_Delete_Message) then |
| 3954 |
-- In a deleted paragraph, call Check_Paragraph |
| 3955 |
-- to trigger the "deleted paragraph" message. |
| 3956 |
-- (Otherwise, this may never happen.) |
| 3957 |
Check_Paragraph; |
| 3958 |
-- else null; -- Nothing special to do. |
| 3959 |
end if; |
| 3960 |
end if; |
| 3961 |
-- Stack it so we can process the end: |
| 3962 |
Set_Nesting_for_Parameter |
| 3963 |
(Command => Syntax_Rule_RHS, |
| 3964 |
Close_Ch => RHS_Close_Ch); |
| 3965 |
-- (We probably don't need to do the above, but consistency |
| 3966 |
-- is preferred.) |
| 3967 |
else |
| 3968 |
-- Set up the tabs: |
| 3969 |
Org_Tabs := Format_Object.Paragraph_Tab_Stops; |
| 3970 |
Format_Object.Paragraph_Tab_Stops := ARM_Output.NO_TABS; |
| 3971 |
if Format_Object.Syntax_Tab_Len /= 0 then |
| 3972 |
Parse_Tab_Stops (Format_Object.Syntax_Tab(1..Format_Object.Syntax_Tab_Len), |
| 3973 |
Format_Object.Paragraph_Tab_Stops); |
| 3974 |
end if; |
| 3975 |
|
| 3976 |
Check_Paragraph; |
| 3977 |
ARM_Format.Format (Format_Object, |
| 3978 |
"@s{" & Format_Object.Syntax_NT(1..Format_Object.Syntax_NT_Len) & "}", |
| 3979 |
Output_Object, |
| 3980 |
Text_Name => "@Syn(LHS=", |
| 3981 |
No_Annotations => False); |
| 3982 |
-- We use Format here so we can support changes in |
| 3983 |
-- the non-terminal. |
| 3984 |
|
| 3985 |
-- Index the non-terminal: |
| 3986 |
ARM_Index.Add (Term => Get_NT, |
| 3987 |
Kind => ARM_Index.Primary_Term, |
| 3988 |
Clause => Clause_String (Format_Object), |
| 3989 |
Paragraph => Paragraph_String, |
| 3990 |
Key => Key); |
| 3991 |
ARM_Output.Index_Target (Output_Object, Key); |
| 3992 |
|
| 3993 |
-- Make an anchor for the non-terminal: |
| 3994 |
if Format_Object.Link_Non_Terminals then |
| 3995 |
declare |
| 3996 |
Lower_NT : constant String := |
| 3997 |
Ada.Characters.Handling.To_Lower (Get_NT); |
| 3998 |
Link_Target : ARM_Syntax.Target_Type := |
| 3999 |
ARM_Syntax.Non_Terminal_Link_Target (Lower_NT); |
| 4000 |
Lower_Old_NT : constant String := |
| 4001 |
Ada.Characters.Handling.To_Lower (Get_Old_NT); |
| 4002 |
Old_Link_Target : ARM_Syntax.Target_Type := |
| 4003 |
ARM_Syntax.Non_Terminal_Link_Target (Lower_Old_NT); |
| 4004 |
begin |
| 4005 |
if Lower_NT /= "" then |
| 4006 |
if Clause_String (Format_Object) /= |
| 4007 |
ARM_Syntax.Non_Terminal_Clause (Lower_NT) then |
| 4008 |
Ada.Text_IO.Put_Line (" ** Clause mismatch for non-terminal: Is=" & |
| 4009 |
Clause_String (Format_Object) & "; Was=" & ARM_Syntax.Non_Terminal_Clause (Lower_NT) & |
| 4010 |
"; NT=" & Lower_NT & "; on line " & ARM_Input.Line_String (Input_Object)); |
| 4011 |
end if; |
| 4012 |
ARM_Output.Local_Target (Output_Object, |
| 4013 |
Text => "", |
| 4014 |
Target => Link_Target); |
| 4015 |
-- else the Non-Terminal was deleted, no |
| 4016 |
-- anchor is needed. |
| 4017 |
end if; |
| 4018 |
if Lower_Old_NT /= "" then |
| 4019 |
if Clause_String (Format_Object) /= |
| 4020 |
ARM_Syntax.Non_Terminal_Clause (Lower_Old_NT) then |
| 4021 |
-- This can happen if an item is inserted |
| 4022 |
-- on one place and deleted in another. |
| 4023 |
-- We'll assume this isn't an error and just |
| 4024 |
-- do nothing here. |
| 4025 |
--Ada.Text_IO.Put_Line (" %% Clause mismatch for old non-terminal: Is=" & |
| 4026 |
-- Clause_String (Format_Object) & "; Was=" & ARM_Syntax.Non_Terminal_Clause (Lower_Old_NT) & |
| 4027 |
-- "; NT=" & Lower_Old_NT & "; on line " & ARM_Input.Line_String (Input_Object)); |
| 4028 |
null; |
| 4029 |
else |
| 4030 |
ARM_Output.Local_Target (Output_Object, |
| 4031 |
Text => "", |
| 4032 |
Target => Old_Link_Target); |
| 4033 |
end if; |
| 4034 |
-- else there was no old Non-Terminal. |
| 4035 |
end if; |
| 4036 |
end; |
| 4037 |
end if; |
| 4038 |
|
| 4039 |
-- Set the font for the "::=". Note that we use @s{} |
| 4040 |
-- above, so that any font changes in the Non-Terminal |
| 4041 |
-- (as in a @Chg command) are respected. |
| 4042 |
-- This command includes any needed insertion or deletion. |
| 4043 |
|
| 4044 |
declare |
| 4045 |
Swiss_Format : ARM_Output.Format_Type := |
| 4046 |
Format_Object.Text_Format; |
| 4047 |
begin |
| 4048 |
Swiss_Format.Font := ARM_Output.Swiss; |
| 4049 |
if Disposition = ARM_Output.None then |
| 4050 |
null; |
| 4051 |
else |
| 4052 |
Swiss_Format.Change := Disposition; |
| 4053 |
Swiss_Format.Version := Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Change_Version; |
| 4054 |
end if; |
| 4055 |
ARM_Output.Text_Format (Output_Object, |
| 4056 |
Swiss_Format); |
| 4057 |
end; |
| 4058 |
ARM_Output.Ordinary_Text (Output_Object, " ::= "); |
| 4059 |
ARM_Output.Text_Format (Output_Object, |
| 4060 |
Format_Object.Text_Format); -- Reset format. |
| 4061 |
Format_Object.Last_Non_Space := False; |
| 4062 |
|
| 4063 |
if RHS_Close_Ch /= ' ' then |
| 4064 |
-- Now, handle the parameter: |
| 4065 |
-- Stack it so we can process the end: |
| 4066 |
Set_Nesting_for_Parameter |
| 4067 |
(Command => Syntax_Rule_RHS, |
| 4068 |
Close_Ch => RHS_Close_Ch); |
| 4069 |
|
| 4070 |
ARM_Input.Start_Recording (Input_Object); |
| 4071 |
|
| 4072 |
-- Set the format to preserve line breaks. |
| 4073 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Old_Last_Subhead_Paragraph := Format_Object.Last_Paragraph_Subhead_Type; |
| 4074 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Old_Next_Subhead_Paragraph := Format_Object.Next_Paragraph_Subhead_Type; |
| 4075 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Old_Next_Paragraph_Format := Format_Object.Next_Paragraph_Format_Type; |
| 4076 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Old_Tab_Stops := Org_Tabs; |
| 4077 |
Format_Object.Next_Paragraph_Format_Type := Syntax_Production; |
| 4078 |
-- Tab stops are already set. |
| 4079 |
-- else no parameter, weird. |
| 4080 |
end if; |
| 4081 |
end if; |
| 4082 |
end Gen_Syntax_Rule; |
| 4083 |
|
| 4084 |
|
| 4085 |
procedure Format_Text (Text : in String; |
| 4086 |
Text_Name : in String) is |
| 4087 |
-- Note: We use the state of the surrounding call. |
| 4088 |
Input_Object : Arm_String.String_Input_Type; |
| 4089 |
Real_Include_Annotations : Boolean := Format_Object.Include_Annotations; |
| 4090 |
begin |
| 4091 |
-- Don't show annotations here: |
| 4092 |
Format_Object.Include_Annotations := False; |
| 4093 |
Arm_String.Open (Input_Object, Text, Text_Name); |
| 4094 |
-- Open the input object using a string for input. |
| 4095 |
Real_Process (Format_Object, Format_State, Input_Object, Output_Object); |
| 4096 |
Arm_String.Close (Input_Object); |
| 4097 |
Format_Object.Include_Annotations := Real_Include_Annotations; |
| 4098 |
end Format_Text; |
| 4099 |
|
| 4100 |
procedure DB_Report is new ARM_Database.Report (Format_Text); |
| 4101 |
|
| 4102 |
begin |
| 4103 |
case Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Command is |
| 4104 |
|
| 4105 |
-- Basic text commands: |
| 4106 |
|
| 4107 |
when Redundant => |
| 4108 |
if Format_Object.Include_Annotations then |
| 4109 |
Check_Paragraph; |
| 4110 |
ARM_Output.Ordinary_Character (Output_Object, '['); |
| 4111 |
Format_Object.Last_Non_Space := True; |
| 4112 |
-- else ignored. |
| 4113 |
end if; |
| 4114 |
|
| 4115 |
when Comment | Part => |
| 4116 |
-- Skip the contents of this command. |
| 4117 |
-- For Part, we don't use the information contained, |
| 4118 |
-- but it would help a human reader. |
| 4119 |
ARM_Input.Skip_until_Close_Char (Input_Object, |
| 4120 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Close_Char, |
| 4121 |
Exit_on_Para_End => False); |
| 4122 |
Format_State.Nesting_Stack_Ptr := Format_State.Nesting_Stack_Ptr - 1; |
| 4123 |
-- Remove the "comment" or "part" record. |
| 4124 |
|
| 4125 |
when Bold => |
| 4126 |
Check_Paragraph; |
| 4127 |
Format_Object.Text_Format.Bold := True; |
| 4128 |
ARM_Output.Text_Format (Output_Object, |
| 4129 |
Format => Format_Object.Text_Format); |
| 4130 |
|
| 4131 |
when Italic => |
| 4132 |
Check_Paragraph; |
| 4133 |
Format_Object.Text_Format.Italic := True; |
| 4134 |
ARM_Output.Text_Format (Output_Object, |
| 4135 |
Format => Format_Object.Text_Format); |
| 4136 |
|
| 4137 |
when Roman => |
| 4138 |
Check_Paragraph; |
| 4139 |
Format_Object.Text_Format.Font := ARM_Output.Roman; |
| 4140 |
ARM_Output.Text_Format (Output_Object, |
| 4141 |
Format => Format_Object.Text_Format); |
| 4142 |
|
| 4143 |
when Swiss => |
| 4144 |
Check_Paragraph; |
| 4145 |
Format_Object.Text_Format.Font := ARM_Output.Swiss; |
| 4146 |
ARM_Output.Text_Format (Output_Object, |
| 4147 |
Format => Format_Object.Text_Format); |
| 4148 |
|
| 4149 |
when Fixed => |
| 4150 |
Check_Paragraph; |
| 4151 |
Format_Object.Text_Format.Font := ARM_Output.Fixed; |
| 4152 |
ARM_Output.Text_Format (Output_Object, |
| 4153 |
Format => Format_Object.Text_Format); |
| 4154 |
|
| 4155 |
when Roman_Italic => |
| 4156 |
Check_Paragraph; |
| 4157 |
Format_Object.Text_Format.Italic := True; |
| 4158 |
Format_Object.Text_Format.Font := ARM_Output.Roman; |
| 4159 |
ARM_Output.Text_Format (Output_Object, |
| 4160 |
Format => Format_Object.Text_Format); |
| 4161 |
when Shrink => |
| 4162 |
declare |
| 4163 |
use type ARM_Output.Size_Type; |
| 4164 |
begin |
| 4165 |
Check_Paragraph; |
| 4166 |
Format_Object.Text_Format.Size := |
| 4167 |
Format_Object.Text_Format.Size - 1; |
| 4168 |
ARM_Output.Text_Format (Output_Object, |
| 4169 |
Format => Format_Object.Text_Format); |
| 4170 |
end; |
| 4171 |
|
| 4172 |
when Grow => |
| 4173 |
declare |
| 4174 |
use type ARM_Output.Size_Type; |
| 4175 |
begin |
| 4176 |
Check_Paragraph; |
| 4177 |
Format_Object.Text_Format.Size := |
| 4178 |
Format_Object.Text_Format.Size + 1; |
| 4179 |
ARM_Output.Text_Format (Output_Object, |
| 4180 |
Format => Format_Object.Text_Format); |
| 4181 |
end; |
| 4182 |
|
| 4183 |
when Black => |
| 4184 |
Check_Paragraph; |
| 4185 |
Format_Object.Text_Format.Color := ARM_Output.Black; |
| 4186 |
ARM_Output.Text_Format (Output_Object, |
| 4187 |
Format => Format_Object.Text_Format); |
| 4188 |
|
| 4189 |
when Red => |
| 4190 |
Check_Paragraph; |
| 4191 |
Format_Object.Text_Format.Color := ARM_Output.Red; |
| 4192 |
ARM_Output.Text_Format (Output_Object, |
| 4193 |
Format => Format_Object.Text_Format); |
| 4194 |
|
| 4195 |
when Green => |
| 4196 |
Check_Paragraph; |
| 4197 |
Format_Object.Text_Format.Color := ARM_Output.Green; |
| 4198 |
ARM_Output.Text_Format (Output_Object, |
| 4199 |
Format => Format_Object.Text_Format); |
| 4200 |
|
| 4201 |
when Blue => |
| 4202 |
Check_Paragraph; |
| 4203 |
Format_Object.Text_Format.Color := ARM_Output.Blue; |
| 4204 |
ARM_Output.Text_Format (Output_Object, |
| 4205 |
Format => Format_Object.Text_Format); |
| 4206 |
|
| 4207 |
when Keyword => |
| 4208 |
Check_Paragraph; |
| 4209 |
Format_Object.Text_Format.Bold := True; |
| 4210 |
ARM_Output.Text_Format (Output_Object, |
| 4211 |
Format => Format_Object.Text_Format); |
| 4212 |
|
| 4213 |
when Non_Terminal_Format => |
| 4214 |
-- No linking here. |
| 4215 |
Check_Paragraph; |
| 4216 |
Format_Object.Text_Format.Font := ARM_Output.Swiss; |
| 4217 |
ARM_Output.Text_Format (Output_Object, |
| 4218 |
Format => Format_Object.Text_Format); |
| 4219 |
|
| 4220 |
when Example_Text => |
| 4221 |
Check_Paragraph; |
| 4222 |
Format_Object.Text_Format.Font := Format_Object.Examples_Font; |
| 4223 |
ARM_Output.Text_Format (Output_Object, |
| 4224 |
Format => Format_Object.Text_Format); |
| 4225 |
|
| 4226 |
when Example_Comment => |
| 4227 |
Check_Paragraph; |
| 4228 |
Format_Object.Text_Format.Font := ARM_Output.Roman; |
| 4229 |
Format_Object.Text_Format.Italic := True; |
| 4230 |
ARM_Output.Text_Format (Output_Object, |
| 4231 |
Format => Format_Object.Text_Format); |
| 4232 |
|
| 4233 |
when Tab_Clear => |
| 4234 |
Format_Object.Paragraph_Tab_Stops := ARM_Output.NO_TABS; |
| 4235 |
|
| 4236 |
when Tab_Set => |
| 4237 |
if Format_Object.Next_Paragraph_Format_Type = Bulleted or else |
| 4238 |
Format_Object.Next_Paragraph_Format_Type = Nested_Bulleted or else |
| 4239 |
Format_Object.Next_Paragraph_Format_Type = Nested_X2_Bulleted or else |
| 4240 |
Format_Object.Next_Paragraph_Format_Type = Enumerated or else |
| 4241 |
Format_Object.Next_Paragraph_Format_Type = Nested_Enumerated or else |
| 4242 |
Format_Object.Next_Paragraph_Format_Type = Hanging_Indented_1 or else |
| 4243 |
Format_Object.Next_Paragraph_Format_Type = Hanging_Indented_2 or else |
| 4244 |
Format_Object.Next_Paragraph_Format_Type = Hanging_Indented_3 or else |
| 4245 |
Format_Object.Next_Paragraph_Format_Type = Hanging_Indented_4 then |
| 4246 |
Ada.Text_IO.Put_Line (" ** Tab set in hang or bulleted format: " & |
| 4247 |
Paragraph_Type'Image(Format_Object.Next_Paragraph_Format_Type) & |
| 4248 |
", line " & ARM_Input.Line_String (Input_Object)); |
| 4249 |
elsif ARM_Output."/=" (Format_Object.Paragraph_Tab_Stops, ARM_Output.NO_TABS) then |
| 4250 |
Ada.Text_IO.Put_Line (" ** Setting tabs when they are not clear on line " |
| 4251 |
& ARM_Input.Line_String (Input_Object)); |
| 4252 |
else |
| 4253 |
declare |
| 4254 |
My_Tabs : ARM_Output.Tab_Info := ARM_Output.NO_TABS; |
| 4255 |
Stops : String(1..80); |
| 4256 |
Len : Natural; |
| 4257 |
begin |
| 4258 |
ARM_Input.Copy_to_String_until_Close_Char ( |
| 4259 |
Input_Object, |
| 4260 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Close_Char, |
| 4261 |
Stops, Len); |
| 4262 |
Parse_Tab_Stops (Stops(1..Len), My_Tabs); |
| 4263 |
|
| 4264 |
Format_Object.Paragraph_Tab_Stops := My_Tabs; |
| 4265 |
Format_State.Nesting_Stack_Ptr := Format_State.Nesting_Stack_Ptr - 1; |
| 4266 |
--Ada.Text_IO.Put_Line (" &Unstack (Tabstop)"); |
| 4267 |
end; |
| 4268 |
end if; |
| 4269 |
|
| 4270 |
when Non_Terminal => |
| 4271 |
-- @nt{text} |
| 4272 |
-- This *was* simple, until we added linking. |
| 4273 |
declare |
| 4274 |
Name : String(1..120); |
| 4275 |
Len : Natural; |
| 4276 |
Swiss_Format : ARM_Output.Format_Type := |
| 4277 |
Format_Object.Text_Format; |
| 4278 |
begin |
| 4279 |
ARM_Input.Copy_to_String_until_Close_Char ( |
| 4280 |
Input_Object, |
| 4281 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Close_Char, |
| 4282 |
Name, Len); |
| 4283 |
|
| 4284 |
-- Set the appropriate style: |
| 4285 |
Check_Paragraph; |
| 4286 |
|
| 4287 |
Swiss_Format.Font := ARM_Output.Swiss; |
| 4288 |
ARM_Output.Text_Format (Output_Object, |
| 4289 |
Format => Swiss_Format); |
| 4290 |
if Format_Object.Link_Non_Terminals then |
| 4291 |
if Ada.Strings.Fixed.Index (Name(1..Len), "@") /= 0 then |
| 4292 |
-- Embedded commands. We have to clean the |
| 4293 |
-- string of the commands (if we can) before |
| 4294 |
-- making a link. |
| 4295 |
declare |
| 4296 |
Lower_NT : String := |
| 4297 |
Ada.Characters.Handling.To_Lower (Name(1..Len)); |
| 4298 |
Lower_NT_Len : Natural := Lower_NT'Length; |
| 4299 |
Loc : Natural := Lower_NT'First; |
| 4300 |
begin |
| 4301 |
while Loc <= Lower_NT_Len loop |
| 4302 |
-- Check for simple commands and remove them: |
| 4303 |
if Lower_NT(Loc) = '@' then -- Start of a command. |
| 4304 |
if Loc < Lower_NT_Len and then |
| 4305 |
(Lower_NT(Loc+1) = '!' or else |
| 4306 |
Lower_NT(Loc+1) = ';') then |
| 4307 |
-- Soft hyphen or no-op, remove. |
| 4308 |
Lower_NT(Loc .. Lower_NT_Len-2) := |
| 4309 |
Lower_NT(Loc+2 .. Lower_NT_Len); |
| 4310 |
Lower_NT_Len := Lower_NT_Len - 2; |
| 4311 |
else -- Unknown. |
| 4312 |
exit; |
| 4313 |
end if; |
| 4314 |
else -- nothing to do, move to next character |
| 4315 |
Loc := Loc + 1; |
| 4316 |
end if; |
| 4317 |
end loop; |
| 4318 |
|
| 4319 |
declare |
| 4320 |
Clause : constant String := |
| 4321 |
ARM_Syntax.Non_Terminal_Clause (Lower_NT(1..Lower_NT_Len)); |
| 4322 |
Target : constant ARM_Syntax.Target_Type := |
| 4323 |
ARM_Syntax.Non_Terminal_Link_Target (Lower_NT(1..Lower_NT_Len)); |
| 4324 |
Org_Font : ARM_Output.Font_Family_Type := |
| 4325 |
Format_Object.Text_Format.Font; |
| 4326 |
begin |
| 4327 |
Format_Object.Text_Format.Font := ARM_Output.Swiss; |
| 4328 |
if Clause = "" then -- Not found. No link, but error message: |
| 4329 |
if Ada.Strings.Fixed.Index (Lower_NT(1..Lower_NT_Len), "@") /= 0 then |
| 4330 |
Ada.Text_IO.Put_Line (" %% Non-terminal with complex embedded commands " & |
| 4331 |
Lower_NT(1..Lower_NT_Len) & " on line " & ARM_Input.Line_String (Input_Object)); |
| 4332 |
else |
| 4333 |
Ada.Text_IO.Put_Line (" ?? Unknown non-terminal " & |
| 4334 |
Lower_NT(1..Lower_NT_Len) & " on line " & ARM_Input.Line_String (Input_Object)); |
| 4335 |
end if; |
| 4336 |
ARM_Format.Format (Format_Object, |
| 4337 |
Name(1..Len), |
| 4338 |
Output_Object, |
| 4339 |
Text_Name => "@nt{}", |
| 4340 |
No_Annotations => False); |
| 4341 |
else |
| 4342 |
ARM_Output.Local_Link_Start (Output_Object, |
| 4343 |
Target => Target, Clause_Number => Clause); |
| 4344 |
ARM_Format.Format (Format_Object, |
| 4345 |
Name(1..Len), |
| 4346 |
Output_Object, |
| 4347 |
Text_Name => "@nt{}", |
| 4348 |
No_Annotations => False); |
| 4349 |
ARM_Output.Local_Link_End (Output_Object, |
| 4350 |
Target => Target, Clause_Number => Clause); |
| 4351 |
end if; |
| 4352 |
Format_Object.Text_Format.Font := Org_Font; |
| 4353 |
end; |
| 4354 |
end; |
| 4355 |
else -- Ordinary link. |
| 4356 |
declare |
| 4357 |
Lower_NT : constant String := |
| 4358 |
Ada.Characters.Handling.To_Lower (Name(1..Len)); |
| 4359 |
Clause : constant String := |
| 4360 |
ARM_Syntax.Non_Terminal_Clause (Lower_NT); |
| 4361 |
Target : constant ARM_Syntax.Target_Type := |
| 4362 |
ARM_Syntax.Non_Terminal_Link_Target (Lower_NT); |
| 4363 |
begin |
| 4364 |
if Clause = "" then -- Not found. No link, but error message: |
| 4365 |
Ada.Text_IO.Put_Line (" ?? Unknown non-terminal " & |
| 4366 |
Name(1..Len) & " on line " & ARM_Input.Line_String (Input_Object)); |
| 4367 |
ARM_Output.Ordinary_Text (Output_Object, Name(1..Len)); |
| 4368 |
else |
| 4369 |
ARM_Output.Local_Link (Output_Object, Text => Name(1..Len), |
| 4370 |
Target => Target, Clause_Number => Clause); |
| 4371 |
end if; |
| 4372 |
end; |
| 4373 |
end if; |
| 4374 |
else |
| 4375 |
if Ada.Strings.Fixed.Index (Name(1..Len), "@") /= 0 then |
| 4376 |
-- Embedded commands, better execute them. |
| 4377 |
declare |
| 4378 |
Org_Font : ARM_Output.Font_Family_Type := |
| 4379 |
Format_Object.Text_Format.Font; |
| 4380 |
begin |
| 4381 |
Format_Object.Text_Format.Font := ARM_Output.Swiss; |
| 4382 |
ARM_Format.Format (Format_Object, |
| 4383 |
Name(1..Len), |
| 4384 |
Output_Object, |
| 4385 |
Text_Name => "@nt{}", |
| 4386 |
No_Annotations => False); |
| 4387 |
Format_Object.Text_Format.Font := Org_Font; |
| 4388 |
end; |
| 4389 |
else |
| 4390 |
ARM_Output.Ordinary_Text (Output_Object, Name(1..Len)); |
| 4391 |
end if; |
| 4392 |
end if; |
| 4393 |
ARM_Output.Text_Format (Output_Object, |
| 4394 |
Format => Format_Object.Text_Format); |
| 4395 |
Format_Object.Last_Non_Space := True; |
| 4396 |
end; |
| 4397 |
Format_State.Nesting_Stack_Ptr := Format_State.Nesting_Stack_Ptr - 1; |
| 4398 |
--Ada.Text_IO.Put_Line (" &Unstack (Nonterminal)"); |
| 4399 |
|
| 4400 |
-- Versioned breaking: |
| 4401 |
when New_Page_for_Version | RM_New_Page_for_Version | |
| 4402 |
New_Column_for_Version | |
| 4403 |
Not_ISO_RM_New_Page_for_Version | |
| 4404 |
ISO_Only_RM_New_Page_for_Version => |
| 4405 |
declare |
| 4406 |
Version : ARM_Contents.Change_Version_Type; |
| 4407 |
begin |
| 4408 |
Get_Change_Version (Is_First => True, |
| 4409 |
Version => Version); |
| 4410 |
-- Read a parameter named "Version". |
| 4411 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Change_Version := Version; |
| 4412 |
end; |
| 4413 |
|
| 4414 |
-- Tables: |
| 4415 |
when Table => |
| 4416 |
-- @table(Columns=<number>, |
| 4417 |
-- Alignment=<AllLeft|AllCenter|CenterExceptFirst>, |
| 4418 |
-- FirstColWidth=<number>, |
| 4419 |
-- LastColWidth=<number>, |
| 4420 |
-- NoBreak=<T|F>, |
| 4421 |
-- Border=<T|F>, |
| 4422 |
-- SmallSize=<T|F>, |
| 4423 |
-- Caption=<text>, |
| 4424 |
-- Headers=<text>, |
| 4425 |
-- Body=<row_text>) |
| 4426 |
-- Columns must be a single digit (2-9). |
| 4427 |
-- Caption defines the table caption. |
| 4428 |
-- Headers defines the table headers. |
| 4429 |
-- Body defines the table body. |
| 4430 |
|
| 4431 |
Check_End_Paragraph; -- End any paragraph we're in. |
| 4432 |
declare |
| 4433 |
Close_Ch, Ch : Character; |
| 4434 |
Align_Name : ARM_Input.Command_Name_Type; |
| 4435 |
Cols, FirstWidth, LastWidth : Character; |
| 4436 |
No_Page_Break : Boolean; |
| 4437 |
Has_Border : Boolean; |
| 4438 |
Small_Text : Boolean; |
| 4439 |
Alignment : ARM_Output.Column_Text_Alignment; |
| 4440 |
begin |
| 4441 |
ARM_Input.Check_Parameter_Name (Input_Object, |
| 4442 |
Param_Name => "Columns" & (8..ARM_Input.Command_Name_Type'Last => ' '), |
| 4443 |
Is_First => True, |
| 4444 |
Param_Close_Bracket => Close_Ch); |
| 4445 |
if Close_Ch /= ' ' then |
| 4446 |
ARM_Input.Get_Char (Input_Object, Cols); |
| 4447 |
ARM_Input.Get_Char (Input_Object, Ch); |
| 4448 |
if Ch /= Close_Ch then |
| 4449 |
Ada.Text_IO.Put_Line (" ** Bad close for Table Columns on line " & ARM_Input.Line_String (Input_Object)); |
| 4450 |
ARM_Input.Replace_Char (Input_Object); |
| 4451 |
end if; |
| 4452 |
if Cols not in '2'..'9' then |
| 4453 |
Ada.Text_IO.Put_Line (" ** Bad table column count on line " & ARM_Input.Line_String (Input_Object)); |
| 4454 |
end if; |
| 4455 |
end if; |
| 4456 |
|
| 4457 |
ARM_Input.Check_Parameter_Name (Input_Object, |
| 4458 |
Param_Name => "Alignment" & (10..ARM_Input.Command_Name_Type'Last => ' '), |
| 4459 |
Is_First => False, |
| 4460 |
Param_Close_Bracket => Close_Ch); |
| 4461 |
if Close_Ch /= ' ' then |
| 4462 |
-- Get the alignment word: |
| 4463 |
Arm_Input.Get_Name (Input_Object, Align_Name); |
| 4464 |
ARM_Input.Get_Char (Input_Object, Ch); |
| 4465 |
if Ch /= Close_Ch then |
| 4466 |
Ada.Text_IO.Put_Line (" ** Bad close for Table Alignment on line " & ARM_Input.Line_String (Input_Object)); |
| 4467 |
ARM_Input.Replace_Char (Input_Object); |
| 4468 |
end if; |
| 4469 |
|
| 4470 |
if Ada.Characters.Handling.To_Lower (Ada.Strings.Fixed.Trim (Align_Name, Ada.Strings.Right)) = |
| 4471 |
"allleft" then |
| 4472 |
Alignment := ARM_Output.Left_All; |
| 4473 |
elsif Ada.Characters.Handling.To_Lower (Ada.Strings.Fixed.Trim (Align_Name, Ada.Strings.Right)) = |
| 4474 |
"allcenter" then |
| 4475 |
Alignment := ARM_Output.Center_All; |
| 4476 |
elsif Ada.Characters.Handling.To_Lower (Ada.Strings.Fixed.Trim (Align_Name, Ada.Strings.Right)) = |
| 4477 |
"centerexceptfirst" then |
| 4478 |
Alignment := ARM_Output.Center_Except_First; |
| 4479 |
else |
| 4480 |
Ada.Text_IO.Put_Line (" ** Bad column alignment: " & |
| 4481 |
Ada.Strings.Fixed.Trim (Align_Name, Ada.Strings.Right) & |
| 4482 |
" on line " & ARM_Input.Line_String (Input_Object)); |
| 4483 |
end if; |
| 4484 |
-- else no parameter. Weird. |
| 4485 |
end if; |
| 4486 |
|
| 4487 |
ARM_Input.Check_Parameter_Name (Input_Object, |
| 4488 |
Param_Name => "FirstColWidth" & (14..ARM_Input.Command_Name_Type'Last => ' '), |
| 4489 |
Is_First => False, |
| 4490 |
Param_Close_Bracket => Close_Ch); |
| 4491 |
if Close_Ch /= ' ' then |
| 4492 |
ARM_Input.Get_Char (Input_Object, FirstWidth); |
| 4493 |
ARM_Input.Get_Char (Input_Object, Ch); |
| 4494 |
if Ch /= Close_Ch then |
| 4495 |
Ada.Text_IO.Put_Line (" ** Bad close for Table FirstColWidth on line " & ARM_Input.Line_String (Input_Object)); |
| 4496 |
ARM_Input.Replace_Char (Input_Object); |
| 4497 |
end if; |
| 4498 |
if FirstWidth not in '1'..'9' then |
| 4499 |
Ada.Text_IO.Put_Line (" ** Bad table 1st column width on line " & ARM_Input.Line_String (Input_Object)); |
| 4500 |
end if; |
| 4501 |
end if; |
| 4502 |
|
| 4503 |
ARM_Input.Check_Parameter_Name (Input_Object, |
| 4504 |
Param_Name => "LastColWidth" & (13..ARM_Input.Command_Name_Type'Last => ' '), |
| 4505 |
Is_First => False, |
| 4506 |
Param_Close_Bracket => Close_Ch); |
| 4507 |
if Close_Ch /= ' ' then |
| 4508 |
ARM_Input.Get_Char (Input_Object, LastWidth); |
| 4509 |
ARM_Input.Get_Char (Input_Object, Ch); |
| 4510 |
if Ch /= Close_Ch then |
| 4511 |
Ada.Text_IO.Put_Line (" ** Bad close for Table FirstColWidth on line " & ARM_Input.Line_String (Input_Object)); |
| 4512 |
ARM_Input.Replace_Char (Input_Object); |
| 4513 |
end if; |
| 4514 |
if FirstWidth not in '1'..'9' then |
| 4515 |
Ada.Text_IO.Put_Line (" ** Bad table last column width on line " & ARM_Input.Line_String (Input_Object)); |
| 4516 |
end if; |
| 4517 |
end if; |
| 4518 |
|
| 4519 |
Get_Boolean ("NoBreak" & (8..ARM_Input.Command_Name_Type'Last => ' '), No_Page_Break); |
| 4520 |
Get_Boolean ("Border" & (7..ARM_Input.Command_Name_Type'Last => ' '), Has_Border); |
| 4521 |
Get_Boolean ("SmallSize" & (10..ARM_Input.Command_Name_Type'Last => ' '), Small_Text); |
| 4522 |
|
| 4523 |
-- Set to the table format: |
| 4524 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Old_Last_Subhead_Paragraph := Format_Object.Last_Paragraph_Subhead_Type; |
| 4525 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Old_Next_Subhead_Paragraph := Format_Object.Next_Paragraph_Subhead_Type; |
| 4526 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Old_Next_Paragraph_Format := Format_Object.Next_Paragraph_Format_Type; |
| 4527 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Old_Tab_Stops := Format_Object.Paragraph_Tab_Stops; |
| 4528 |
Format_Object.Next_Paragraph_Format_Type := In_Table; |
| 4529 |
Format_Object.In_Paragraph := True; -- A fake, but we cannot have any format. |
| 4530 |
Format_Object.No_Start_Paragraph := False; -- For most purposes, being in a table is like being in a paragraph. |
| 4531 |
|
| 4532 |
-- OK, we've started the table. Now, get the caption: |
| 4533 |
ARM_Input.Check_Parameter_Name (Input_Object, |
| 4534 |
Param_Name => "Caption" & (8..ARM_Input.Command_Name_Type'Last => ' '), |
| 4535 |
Is_First => False, |
| 4536 |
Param_Close_Bracket => Close_Ch); |
| 4537 |
if Close_Ch /= ' ' then |
| 4538 |
-- Check if the parameter is empty: |
| 4539 |
ARM_Input.Get_Char (Input_Object, Ch); |
| 4540 |
if Ch /= Close_Ch then |
| 4541 |
-- There is a caption: |
| 4542 |
ARM_Input.Replace_Char (Input_Object); |
| 4543 |
|
| 4544 |
-- Create the table. |
| 4545 |
Arm_Output.Start_Table ( |
| 4546 |
Output_Object, |
| 4547 |
Columns => Character'Pos(Cols) - Character'Pos('0'), |
| 4548 |
First_Column_Width => Character'Pos(FirstWidth) - Character'Pos('0'), |
| 4549 |
Last_Column_Width => Character'Pos(LastWidth) - Character'Pos('0'), |
| 4550 |
Alignment => Alignment, |
| 4551 |
No_Page_Break => No_Page_Break, |
| 4552 |
Has_Border => Has_Border, |
| 4553 |
Small_Text_Size => Small_Text, |
| 4554 |
Header_Kind => ARM_Output.Both_Caption_and_Header); |
| 4555 |
|
| 4556 |
-- Now, handle the parameter: |
| 4557 |
-- Stack it so we can process the end: |
| 4558 |
Set_Nesting_for_Parameter |
| 4559 |
(Command => Table_Param_Caption, |
| 4560 |
Close_Ch => Close_Ch); |
| 4561 |
|
| 4562 |
else -- Empty Caption. Move on to the Headers |
| 4563 |
-- command. |
| 4564 |
ARM_Input.Check_Parameter_Name (Input_Object, |
| 4565 |
Param_Name => "Headers" & (8..ARM_Input.Command_Name_Type'Last => ' '), |
| 4566 |
Is_First => False, |
| 4567 |
Param_Close_Bracket => Close_Ch); |
| 4568 |
|
| 4569 |
if Close_Ch /= ' ' then |
| 4570 |
-- Check if the parameter is empty: |
| 4571 |
ARM_Input.Get_Char (Input_Object, Ch); |
| 4572 |
if Ch /= Close_Ch then |
| 4573 |
-- There is a header: |
| 4574 |
ARM_Input.Replace_Char (Input_Object); |
| 4575 |
|
| 4576 |
-- Create the table. |
| 4577 |
Arm_Output.Start_Table ( |
| 4578 |
Output_Object, |
| 4579 |
Columns => Character'Pos(Cols) - Character'Pos('0'), |
| 4580 |
First_Column_Width => Character'Pos(FirstWidth) - Character'Pos('0'), |
| 4581 |
Last_Column_Width => Character'Pos(LastWidth) - Character'Pos('0'), |
| 4582 |
Alignment => Alignment, |
| 4583 |
No_Page_Break => No_Page_Break, |
| 4584 |
Has_Border => Has_Border, |
| 4585 |
Small_Text_Size => Small_Text, |
| 4586 |
Header_Kind => ARM_Output.Header_Only); |
| 4587 |
|
| 4588 |
-- Now, handle the parameter: |
| 4589 |
-- Stack it so we can process the end: |
| 4590 |
Set_Nesting_for_Parameter |
| 4591 |
(Command => Table_Param_Header, |
| 4592 |
Close_Ch => Close_Ch); |
| 4593 |
|
| 4594 |
else -- Empty Headers, too. Move on to the |
| 4595 |
-- Body command. |
| 4596 |
ARM_Input.Check_Parameter_Name (Input_Object, |
| 4597 |
Param_Name => "Body" & (5..ARM_Input.Command_Name_Type'Last => ' '), |
| 4598 |
Is_First => False, |
| 4599 |
Param_Close_Bracket => Close_Ch); |
| 4600 |
|
| 4601 |
if Close_Ch /= ' ' then |
| 4602 |
-- Create the table. |
| 4603 |
Arm_Output.Start_Table ( |
| 4604 |
Output_Object, |
| 4605 |
Columns => Character'Pos(Cols) - Character'Pos('0'), |
| 4606 |
First_Column_Width => Character'Pos(FirstWidth) - Character'Pos('0'), |
| 4607 |
Last_Column_Width => Character'Pos(LastWidth) - Character'Pos('0'), |
| 4608 |
Alignment => Alignment, |
| 4609 |
No_Page_Break => No_Page_Break, |
| 4610 |
Has_Border => Has_Border, |
| 4611 |
Small_Text_Size => Small_Text, |
| 4612 |
Header_Kind => ARM_Output.No_Headers); |
| 4613 |
|
| 4614 |
-- Now, handle the parameter: |
| 4615 |
-- Stack it so we can process the end: |
| 4616 |
Set_Nesting_for_Parameter |
| 4617 |
(Command => Table_Param_Body, |
| 4618 |
Close_Ch => Close_Ch); |
| 4619 |
|
| 4620 |
-- else no parameter, weird. |
| 4621 |
end if; |
| 4622 |
|
| 4623 |
end if; |
| 4624 |
|
| 4625 |
-- else no parameter, weird. |
| 4626 |
end if; |
| 4627 |
|
| 4628 |
end if; |
| 4629 |
|
| 4630 |
-- else no parameter, weird. |
| 4631 |
end if; |
| 4632 |
end; |
| 4633 |
|
| 4634 |
-- Pictures: |
| 4635 |
when Picture_Alone | Picture_Inline => |
| 4636 |
-- @PictureInline(Alignment=<Inline|FloatLeft|FloatRight>, |
| 4637 |
-- Border=<None|Thin|Thick>, |
| 4638 |
-- Height=<nnn>, |
| 4639 |
-- Width=<nnn>, |
| 4640 |
-- Name=<name>, |
| 4641 |
-- Descr=<descr>) |
| 4642 |
-- @PictureAlone(Alignment=<Left|Right|Center>, |
| 4643 |
-- Border=<None|Thin|Thick>, |
| 4644 |
-- Height=<nnn>, |
| 4645 |
-- Width=<nnn>, |
| 4646 |
-- Name=<name>, |
| 4647 |
-- Descr=<descr>) |
| 4648 |
declare |
| 4649 |
Close_Ch, Ch : Character; |
| 4650 |
Align_Name : ARM_Input.Command_Name_Type; |
| 4651 |
Alignment : ARM_Output.Picture_Alignment; |
| 4652 |
Border : ARM_Output.Border_Kind; |
| 4653 |
Height : Natural := 0; |
| 4654 |
Width : Natural := 0; |
| 4655 |
Name, Descr : String(1..120); |
| 4656 |
NLen, DLen : Natural := 0; |
| 4657 |
begin |
| 4658 |
if Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Command = |
| 4659 |
Picture_Alone then |
| 4660 |
Check_End_Paragraph; -- End any paragraph that we're in. |
| 4661 |
|
| 4662 |
ARM_Input.Check_Parameter_Name (Input_Object, |
| 4663 |
Param_Name => "Alignment" & (10..ARM_Input.Command_Name_Type'Last => ' '), |
| 4664 |
Is_First => True, |
| 4665 |
Param_Close_Bracket => Close_Ch); |
| 4666 |
if Close_Ch /= ' ' then |
| 4667 |
-- Get the alignment word: |
| 4668 |
Arm_Input.Get_Name (Input_Object, Align_Name); |
| 4669 |
ARM_Input.Get_Char (Input_Object, Ch); |
| 4670 |
if Ch /= Close_Ch then |
| 4671 |
Ada.Text_IO.Put_Line (" ** Bad close for Picture Alignment on line " & ARM_Input.Line_String (Input_Object)); |
| 4672 |
ARM_Input.Replace_Char (Input_Object); |
| 4673 |
end if; |
| 4674 |
|
| 4675 |
if Ada.Characters.Handling.To_Lower (Ada.Strings.Fixed.Trim (Align_Name, Ada.Strings.Right)) = |
| 4676 |
"left" then |
| 4677 |
Alignment := ARM_Output.Alone_Left; |
| 4678 |
elsif Ada.Characters.Handling.To_Lower (Ada.Strings.Fixed.Trim (Align_Name, Ada.Strings.Right)) = |
| 4679 |
"right" then |
| 4680 |
Alignment := ARM_Output.Alone_Right; |
| 4681 |
elsif Ada.Characters.Handling.To_Lower (Ada.Strings.Fixed.Trim (Align_Name, Ada.Strings.Right)) = |
| 4682 |
"center" then |
| 4683 |
Alignment := ARM_Output.Alone_Center; |
| 4684 |
else |
| 4685 |
Ada.Text_IO.Put_Line (" ** Bad stand-alone picture alignment: " & |
| 4686 |
Ada.Strings.Fixed.Trim (Align_Name, Ada.Strings.Right) & |
| 4687 |
" on line " & ARM_Input.Line_String (Input_Object)); |
| 4688 |
end if; |
| 4689 |
-- else no parameter. Weird. |
| 4690 |
end if; |
| 4691 |
|
| 4692 |
else -- Picture_Inline. |
| 4693 |
Check_Paragraph; -- Make sure we're in a paragraph. |
| 4694 |
|
| 4695 |
ARM_Input.Check_Parameter_Name (Input_Object, |
| 4696 |
Param_Name => "Alignment" & (10..ARM_Input.Command_Name_Type'Last => ' '), |
| 4697 |
Is_First => True, |
| 4698 |
Param_Close_Bracket => Close_Ch); |
| 4699 |
if Close_Ch /= ' ' then |
| 4700 |
-- Get the alignment word: |
| 4701 |
Arm_Input.Get_Name (Input_Object, Align_Name); |
| 4702 |
ARM_Input.Get_Char (Input_Object, Ch); |
| 4703 |
if Ch /= Close_Ch then |
| 4704 |
Ada.Text_IO.Put_Line (" ** Bad close for Picture Alignment on line " & ARM_Input.Line_String (Input_Object)); |
| 4705 |
ARM_Input.Replace_Char (Input_Object); |
| 4706 |
end if; |
| 4707 |
|
| 4708 |
if Ada.Characters.Handling.To_Lower (Ada.Strings.Fixed.Trim (Align_Name, Ada.Strings.Right)) = |
| 4709 |
"inline" then |
| 4710 |
Alignment := ARM_Output.Inline; |
| 4711 |
elsif Ada.Characters.Handling.To_Lower (Ada.Strings.Fixed.Trim (Align_Name, Ada.Strings.Right)) = |
| 4712 |
"floatleft" then |
| 4713 |
Alignment := ARM_Output.Float_Left; |
| 4714 |
elsif Ada.Characters.Handling.To_Lower (Ada.Strings.Fixed.Trim (Align_Name, Ada.Strings.Right)) = |
| 4715 |
"floatright" then |
| 4716 |
Alignment := ARM_Output.Float_Right; |
| 4717 |
else |
| 4718 |
Ada.Text_IO.Put_Line (" ** Bad inline picture alignment: " & |
| 4719 |
Ada.Strings.Fixed.Trim (Align_Name, Ada.Strings.Right) & |
| 4720 |
" on line " & ARM_Input.Line_String (Input_Object)); |
| 4721 |
end if; |
| 4722 |
-- else no parameter. Weird. |
| 4723 |
end if; |
| 4724 |
|
| 4725 |
end if; |
| 4726 |
|
| 4727 |
ARM_Input.Check_Parameter_Name (Input_Object, |
| 4728 |
Param_Name => "Border" & (7..ARM_Input.Command_Name_Type'Last => ' '), |
| 4729 |
Is_First => False, |
| 4730 |
Param_Close_Bracket => Close_Ch); |
| 4731 |
if Close_Ch /= ' ' then |
| 4732 |
-- Get the alignment word: |
| 4733 |
Arm_Input.Get_Name (Input_Object, Align_Name); |
| 4734 |
ARM_Input.Get_Char (Input_Object, Ch); |
| 4735 |
if Ch /= Close_Ch then |
| 4736 |
Ada.Text_IO.Put_Line (" ** Bad close for Picture Border on line " & ARM_Input.Line_String (Input_Object)); |
| 4737 |
ARM_Input.Replace_Char (Input_Object); |
| 4738 |
end if; |
| 4739 |
|
| 4740 |
if Ada.Characters.Handling.To_Lower (Ada.Strings.Fixed.Trim (Align_Name, Ada.Strings.Right)) = |
| 4741 |
"none" then |
| 4742 |
Border := ARM_Output.None; |
| 4743 |
elsif Ada.Characters.Handling.To_Lower (Ada.Strings.Fixed.Trim (Align_Name, Ada.Strings.Right)) = |
| 4744 |
"thin" then |
| 4745 |
Border := ARM_Output.Thin; |
| 4746 |
elsif Ada.Characters.Handling.To_Lower (Ada.Strings.Fixed.Trim (Align_Name, Ada.Strings.Right)) = |
| 4747 |
"thick" then |
| 4748 |
Border := ARM_Output.Thick; |
| 4749 |
else |
| 4750 |
Ada.Text_IO.Put_Line (" ** Bad picture border: " & |
| 4751 |
Ada.Strings.Fixed.Trim (Align_Name, Ada.Strings.Right) & |
| 4752 |
" on line " & ARM_Input.Line_String (Input_Object)); |
| 4753 |
end if; |
| 4754 |
-- else no parameter. Weird. |
| 4755 |
end if; |
| 4756 |
|
| 4757 |
ARM_Input.Check_Parameter_Name (Input_Object, |
| 4758 |
Param_Name => "Height" & (7..ARM_Input.Command_Name_Type'Last => ' '), |
| 4759 |
Is_First => False, |
| 4760 |
Param_Close_Bracket => Close_Ch); |
| 4761 |
if Close_Ch /= ' ' then |
| 4762 |
-- Copy over the term: |
| 4763 |
ARM_Input.Copy_to_String_until_Close_Char ( |
| 4764 |
Input_Object, |
| 4765 |
Close_Ch, |
| 4766 |
Name, |
| 4767 |
NLen); |
| 4768 |
begin |
| 4769 |
Height := Natural'Value(Name(1..NLen)); |
| 4770 |
exception |
| 4771 |
when Constraint_Error => |
| 4772 |
Ada.Text_IO.Put_Line (" ** Bad picture height: " & |
| 4773 |
Name(1..NLen) & " on line " & ARM_Input.Line_String (Input_Object)); |
| 4774 |
end; |
| 4775 |
-- else no parameter. Weird. |
| 4776 |
end if; |
| 4777 |
|
| 4778 |
ARM_Input.Check_Parameter_Name (Input_Object, |
| 4779 |
Param_Name => "Width" & (6..ARM_Input.Command_Name_Type'Last => ' '), |
| 4780 |
Is_First => False, |
| 4781 |
Param_Close_Bracket => Close_Ch); |
| 4782 |
if Close_Ch /= ' ' then |
| 4783 |
-- Copy over the term: |
| 4784 |
ARM_Input.Copy_to_String_until_Close_Char ( |
| 4785 |
Input_Object, |
| 4786 |
Close_Ch, |
| 4787 |
Name, |
| 4788 |
NLen); |
| 4789 |
begin |
| 4790 |
Width := Natural'Value(Name(1..NLen)); |
| 4791 |
exception |
| 4792 |
when Constraint_Error => |
| 4793 |
Ada.Text_IO.Put_Line (" ** Bad picture width: " & |
| 4794 |
Name(1..NLen) & " on line " & ARM_Input.Line_String (Input_Object)); |
| 4795 |
end; |
| 4796 |
-- else no parameter. Weird. |
| 4797 |
end if; |
| 4798 |
|
| 4799 |
ARM_Input.Check_Parameter_Name (Input_Object, |
| 4800 |
Param_Name => "Name" & (5..ARM_Input.Command_Name_Type'Last => ' '), |
| 4801 |
Is_First => False, |
| 4802 |
Param_Close_Bracket => Close_Ch); |
| 4803 |
if Close_Ch /= ' ' then |
| 4804 |
-- Copy over the term: |
| 4805 |
ARM_Input.Copy_to_String_until_Close_Char ( |
| 4806 |
Input_Object, |
| 4807 |
Close_Ch, |
| 4808 |
Name, |
| 4809 |
NLen); |
| 4810 |
-- else no parameter. Weird. |
| 4811 |
end if; |
| 4812 |
|
| 4813 |
ARM_Input.Check_Parameter_Name (Input_Object, |
| 4814 |
Param_Name => "Descr" & (6..ARM_Input.Command_Name_Type'Last => ' '), |
| 4815 |
Is_First => False, |
| 4816 |
Param_Close_Bracket => Close_Ch); |
| 4817 |
if Close_Ch /= ' ' then |
| 4818 |
-- Copy over the term: |
| 4819 |
ARM_Input.Copy_to_String_until_Close_Char ( |
| 4820 |
Input_Object, |
| 4821 |
Close_Ch, |
| 4822 |
Descr, |
| 4823 |
DLen); |
| 4824 |
-- else no parameter. Weird. |
| 4825 |
end if; |
| 4826 |
|
| 4827 |
ARM_Output.Picture ( |
| 4828 |
Output_Object, |
| 4829 |
Alignment => Alignment, |
| 4830 |
Border => Border, |
| 4831 |
Height => Height, |
| 4832 |
Width => Width, |
| 4833 |
Name => Name(1..NLen), |
| 4834 |
Descr => Descr(1..DLen)); |
| 4835 |
end; |
| 4836 |
-- Normal processing should remove the command end marker. |
| 4837 |
|
| 4838 |
-- Paragraph kind commands: |
| 4839 |
|
| 4840 |
when Text_Begin => |
| 4841 |
declare |
| 4842 |
Type_Name : ARM_Input.Command_Name_Type; |
| 4843 |
Ch : Character; |
| 4844 |
begin |
| 4845 |
-- OK, now read the begin "type": |
| 4846 |
Arm_Input.Get_Name (Input_Object, Type_Name); |
| 4847 |
ARM_Input.Get_Char (Input_Object, Ch); |
| 4848 |
if Ch = ',' then |
| 4849 |
-- Multiple parameters. The remaining |
| 4850 |
-- parameters appear to be format instructions, |
| 4851 |
-- which we ought to replace or remove. |
| 4852 |
Ada.Text_IO.Put_Line (" -- Multi-parameter begin, line " & ARM_Input.Line_String (Input_Object)); |
| 4853 |
|
| 4854 |
-- We ignore everything until the end of the |
| 4855 |
-- parameter. |
| 4856 |
while Ch /= Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Close_Char loop |
| 4857 |
-- Ignore everything until the end character |
| 4858 |
-- turns up. |
| 4859 |
ARM_Input.Get_Char (Input_Object, Ch); |
| 4860 |
end loop; |
| 4861 |
end if; |
| 4862 |
|
| 4863 |
if Format_State.Nesting_Stack (Format_State.Nesting_Stack_Ptr).Close_Char = Ch then |
| 4864 |
-- Found the end of the parameter. |
| 4865 |
-- Replace the top of stack with the appropriate begin record: |
| 4866 |
Format_State.Nesting_Stack (Format_State.Nesting_Stack_Ptr) := |
| 4867 |
(Name => Ada.Characters.Handling.To_Lower (Type_Name), |
| 4868 |
Kind => Begin_Word, |
| 4869 |
Command => Text_Begin, |
| 4870 |
Close_Char => ' ',-- No close character. |
| 4871 |
Open_Line => (1..12 => ' '), |
| 4872 |
Text_Format => Format_Object.Text_Format, |
| 4873 |
-- Save the current format. |
| 4874 |
Old_Last_Subhead_Paragraph => Format_Object.Last_Paragraph_Subhead_Type, |
| 4875 |
Old_Next_Subhead_Paragraph => Format_Object.Next_Paragraph_Subhead_Type, |
| 4876 |
Old_Next_Paragraph_Format => Format_Object.Next_Paragraph_Format_Type, |
| 4877 |
Old_Tab_Stops => Format_Object.Paragraph_Tab_Stops, |
| 4878 |
Old_Next_Enum_Num => Format_Object.Next_Enumerated_Num, |
| 4879 |
Is_Formatting => True, -- Reset if needed later. |
| 4880 |
Change_Version => '0', -- Not used. |
| 4881 |
Was_Text => False, -- Not used. |
| 4882 |
Prev_Change => ARM_Output.None, -- Not used. |
| 4883 |
Prev_Change_Version => '0', -- Not used. |
| 4884 |
Prev_Added_Change_Version => '0'); -- Not used. |
| 4885 |
Ada.Strings.Fixed.Move (Target => Format_State.Nesting_Stack (Format_State.Nesting_Stack_Ptr).Open_Line, |
| 4886 |
Source => ARM_Input.Line_String (Input_Object), |
| 4887 |
Drop => Ada.Strings.Right); |
| 4888 |
|
| 4889 |
Process_Begin; |
| 4890 |
|
| 4891 |
else |
| 4892 |
ARM_Input.Replace_Char (Input_Object); |
| 4893 |
Ada.Text_IO.Put_Line (" ** Failed to find close for parameter to begin, line " & ARM_Input.Line_String (Input_Object)); |
| 4894 |
--Bracket_Check := Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Old_Bracket_State; |
| 4895 |
Format_State.Nesting_Stack_Ptr := Format_State.Nesting_Stack_Ptr - 1; |
| 4896 |
--Ada.Text_IO.Put_Line (" &Unstack (Bad Begin)"); |
| 4897 |
end if; |
| 4898 |
end; |
| 4899 |
|
| 4900 |
when Text_End => |
| 4901 |
declare |
| 4902 |
Type_Name : ARM_Input.Command_Name_Type; |
| 4903 |
Ch : Character; |
| 4904 |
begin |
| 4905 |
Arm_Input.Get_Name (Input_Object, Type_Name); -- Get the end "type". |
| 4906 |
ARM_Input.Get_Char (Input_Object, Ch); |
| 4907 |
if Format_State.Nesting_Stack (Format_State.Nesting_Stack_Ptr).Close_Char = Ch then |
| 4908 |
-- Found end of parameter: |
| 4909 |
Format_State.Nesting_Stack_Ptr := Format_State.Nesting_Stack_Ptr - 1; |
| 4910 |
-- Remove the "End" record. |
| 4911 |
-- Check for the matching begin, and remove it. |
| 4912 |
if Format_State.Nesting_Stack_Ptr = 0 then |
| 4913 |
Ada.Text_IO.Put_Line (" ** No begin for end, line " & ARM_Input.Line_String (Input_Object)); |
| 4914 |
elsif Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Name /= |
| 4915 |
Ada.Characters.Handling.To_Lower (Type_Name) then |
| 4916 |
Ada.Text_IO.Put_Line (" ** Names of begin and end mismatch, line " & ARM_Input.Line_String (Input_Object)); |
| 4917 |
Ada.Text_IO.Put_Line (" Begin name: " & Ada.Strings.Fixed.Trim(Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Name, Ada.Strings.Right) & |
| 4918 |
" End name: " & Ada.Strings.Fixed.Trim(Type_Name, Ada.Strings.Right)); |
| 4919 |
Ada.Text_IO.Put_Line (" Begin line: " & Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Open_Line); |
| 4920 |
--Ada.Text_IO.Put_Line (" &Stack name is " & Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Name); |
| 4921 |
else |
| 4922 |
if Format_Object.Next_Paragraph_Subhead_Type /= Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Old_Next_Subhead_Paragraph then |
| 4923 |
Format_Object.Last_Paragraph_Subhead_Type := Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Old_Last_Subhead_Paragraph; |
| 4924 |
-- else still in same subhead, leave alone. (If |
| 4925 |
-- we didn't do this, we'd output the subhead |
| 4926 |
-- multiple times). |
| 4927 |
end if; |
| 4928 |
Format_Object.Next_Paragraph_Subhead_Type := Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Old_Next_Subhead_Paragraph; |
| 4929 |
Format_Object.Next_Paragraph_Format_Type := Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Old_Next_Paragraph_Format; |
| 4930 |
Format_Object.Paragraph_Tab_Stops := Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Old_Tab_Stops; |
| 4931 |
Format_Object.Next_Enumerated_Num := Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Old_Next_Enum_Num; |
| 4932 |
Format_State.Nesting_Stack_Ptr := Format_State.Nesting_Stack_Ptr - 1; |
| 4933 |
--Ada.Text_IO.Put_Line (" &Unstack (End)"); |
| 4934 |
--!!Debug: |
| 4935 |
--Ada.Text_IO.Put_Line ("(End) Next=" & Paragraph_Type'Image(Format_Object.Next_Paragraph_Subhead_Type)); |
| 4936 |
end if; |
| 4937 |
|
| 4938 |
Check_End_Paragraph; -- End any paragraph that we're in. |
| 4939 |
|
| 4940 |
declare |
| 4941 |
Lower_Type_Name : constant String := |
| 4942 |
Ada.Characters.Handling.To_Lower (Ada.Strings.Fixed.Trim ( |
| 4943 |
Type_Name, Ada.Strings.Right)); |
| 4944 |
begin |
| 4945 |
-- Check if number of columns is changing: |
| 4946 |
if Lower_Type_Name = "twocol" then |
| 4947 |
-- Leaving two column region, reset to one: |
| 4948 |
ARM_Output.Set_Columns (Output_Object, Number_of_Columns => 1); |
| 4949 |
elsif Lower_Type_Name = "fourcol" then |
| 4950 |
-- Leaving four column region, reset to one: |
| 4951 |
ARM_Output.Set_Columns (Output_Object, Number_of_Columns => 1); |
| 4952 |
end if; |
| 4953 |
-- Check if we're leaving a bundle: |
| 4954 |
if Lower_Type_Name = "bundle" then |
| 4955 |
Format_Object.In_Bundle := False; |
| 4956 |
end if; |
| 4957 |
-- Check if we're leaving an enumerated list: |
| 4958 |
if Lower_Type_Name = "enumerate" or else |
| 4959 |
Lower_Type_Name = "innerenumerate" then |
| 4960 |
Format_Object.Enumerated_Level := |
| 4961 |
Format_Object.Enumerated_Level - 1; |
| 4962 |
end if; |
| 4963 |
end; |
| 4964 |
else |
| 4965 |
ARM_Input.Replace_Char (Input_Object); |
| 4966 |
Ada.Text_IO.Put_Line (" ** Failed to find close for parameter to end, line " & ARM_Input.Line_String (Input_Object)); |
| 4967 |
Format_State.Nesting_Stack_Ptr := Format_State.Nesting_Stack_Ptr - 1; |
| 4968 |
--Ada.Text_IO.Put_Line (" &Unstack (Bad End)"); |
| 4969 |
end if; |
| 4970 |
end; |
| 4971 |
|
| 4972 |
-- Indexing commands: |
| 4973 |
|
| 4974 |
when Defn | RootDefn => |
| 4975 |
-- @Defn{term} or @RootDefn{term}. Index the term. |
| 4976 |
-- Note that there is no difference between these in terms |
| 4977 |
-- of the index, so we do them together. |
| 4978 |
declare |
| 4979 |
Term : String(1..80); |
| 4980 |
Len : Natural := 0; |
| 4981 |
Key : ARM_Index.Index_Key; |
| 4982 |
begin |
| 4983 |
ARM_Input.Copy_to_String_until_Close_Char ( |
| 4984 |
Input_Object, |
| 4985 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Close_Char, |
| 4986 |
Term, |
| 4987 |
Len); |
| 4988 |
ARM_Index.Add (Term => Term(1..Len), |
| 4989 |
Kind => ARM_Index.Primary_Term, |
| 4990 |
Clause => Clause_String (Format_Object), |
| 4991 |
Paragraph => Paragraph_String, |
| 4992 |
Key => Key); |
| 4993 |
|
| 4994 |
Check_Paragraph; |
| 4995 |
if Format_Object.Display_Index_Entries then |
| 4996 |
if Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Command = Defn then |
| 4997 |
Display_Index_Entry (Term(1..Len)); |
| 4998 |
else -- RootDefn |
| 4999 |
Display_Index_Entry (Term(1..Len), Special => Is_Root); |
| 5000 |
end if; |
| 5001 |
end if; |
| 5002 |
ARM_Output.Index_Target (Output_Object, Key); |
| 5003 |
Format_State.Nesting_Stack_Ptr := Format_State.Nesting_Stack_Ptr - 1; |
| 5004 |
-- Remove the "(Root)Defn" record. |
| 5005 |
end; |
| 5006 |
|
| 5007 |
when PDefn => |
| 5008 |
-- @PDefn{term} ot @RootDefn{term}. Index the term as a partial |
| 5009 |
-- definition. |
| 5010 |
declare |
| 5011 |
Term : String(1..80); |
| 5012 |
Len : Natural := 0; |
| 5013 |
Key : ARM_Index.Index_Key; |
| 5014 |
begin |
| 5015 |
ARM_Input.Copy_to_String_until_Close_Char ( |
| 5016 |
Input_Object, |
| 5017 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Close_Char, |
| 5018 |
Term, |
| 5019 |
Len); |
| 5020 |
ARM_Index.Add (Term => Term(1..Len), |
| 5021 |
Kind => ARM_Index.Partial_Term, |
| 5022 |
Clause => Clause_String (Format_Object), |
| 5023 |
Paragraph => Paragraph_String, |
| 5024 |
Key => Key); |
| 5025 |
|
| 5026 |
Check_Paragraph; |
| 5027 |
if Format_Object.Display_Index_Entries then |
| 5028 |
Display_Index_Entry (Term(1..Len), Special => Is_Partial); |
| 5029 |
end if; |
| 5030 |
ARM_Output.Index_Target (Output_Object, Key); |
| 5031 |
Format_State.Nesting_Stack_Ptr := Format_State.Nesting_Stack_Ptr - 1; |
| 5032 |
-- Remove the "PDefn" record. |
| 5033 |
end; |
| 5034 |
|
| 5035 |
when Defn2 | RootDefn2 => |
| 5036 |
-- @Defn2[Term={term}, Sec={sec}] |
| 5037 |
-- @RootDefn[Term={term}, Sec={sec}]. Index the term and subterm. |
| 5038 |
-- Note that there is no difference between these in terms |
| 5039 |
-- of the index, so we do them together. |
| 5040 |
declare |
| 5041 |
Close_Ch : Character; |
| 5042 |
Term, Subterm : String(1..90); |
| 5043 |
TLen, SLen : Natural := 0; |
| 5044 |
Key : ARM_Index.Index_Key; |
| 5045 |
begin |
| 5046 |
ARM_Input.Check_Parameter_Name (Input_Object, |
| 5047 |
Param_Name => "Term" & (5..ARM_Input.Command_Name_Type'Last => ' '), |
| 5048 |
Is_First => True, |
| 5049 |
Param_Close_Bracket => Close_Ch); |
| 5050 |
if Close_Ch /= ' ' then |
| 5051 |
-- Copy over the term: |
| 5052 |
ARM_Input.Copy_to_String_until_Close_Char ( |
| 5053 |
Input_Object, |
| 5054 |
Close_Ch, |
| 5055 |
Term, |
| 5056 |
TLen); |
| 5057 |
-- else no parameter. Weird. |
| 5058 |
end if; |
| 5059 |
|
| 5060 |
ARM_Input.Check_Parameter_Name (Input_Object, |
| 5061 |
Param_Name => "Sec" & (4..ARM_Input.Command_Name_Type'Last => ' '), |
| 5062 |
Is_First => False, |
| 5063 |
Param_Close_Bracket => Close_Ch); |
| 5064 |
if Close_Ch /= ' ' then |
| 5065 |
-- Copy over the term: |
| 5066 |
ARM_Input.Copy_to_String_until_Close_Char ( |
| 5067 |
Input_Object, |
| 5068 |
Close_Ch, |
| 5069 |
Subterm, |
| 5070 |
SLen); |
| 5071 |
-- else no parameter. Weird. |
| 5072 |
end if; |
| 5073 |
|
| 5074 |
ARM_Index.Add (Term => Term(1..TLen), |
| 5075 |
Subterm => Subterm(1..SLen), |
| 5076 |
Kind => ARM_Index.Primary_Term_and_Subterm, |
| 5077 |
Clause => Clause_String (Format_Object), |
| 5078 |
Paragraph => Paragraph_String, |
| 5079 |
Key => Key); |
| 5080 |
|
| 5081 |
Check_Paragraph; |
| 5082 |
if Format_Object.Display_Index_Entries then |
| 5083 |
if Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Command = Defn2 then |
| 5084 |
Display_Index_Entry (Term(1..TLen) & " (" & Subterm(1..SLen) & ')'); |
| 5085 |
else -- RootDefn |
| 5086 |
Display_Index_Entry (Term(1..TLen) & " (" & Subterm(1..SLen) & ')', Special => Is_Root); |
| 5087 |
end if; |
| 5088 |
end if; |
| 5089 |
ARM_Output.Index_Target (Output_Object, Key); |
| 5090 |
|
| 5091 |
-- Leave the command end marker, let normal processing |
| 5092 |
-- get rid of it. |
| 5093 |
end; |
| 5094 |
|
| 5095 |
when PDefn2 => |
| 5096 |
-- @PDefn2[Term={term}, Sec={sec}]. Index the term and subterm. |
| 5097 |
-- Note that there is no difference between these in terms |
| 5098 |
-- of the index, so we do them together. |
| 5099 |
declare |
| 5100 |
Close_Ch : Character; |
| 5101 |
Term, Subterm : String(1..90); |
| 5102 |
TLen, SLen : Natural := 0; |
| 5103 |
Key : ARM_Index.Index_Key; |
| 5104 |
begin |
| 5105 |
ARM_Input.Check_Parameter_Name (Input_Object, |
| 5106 |
Param_Name => "Term" & (5..ARM_Input.Command_Name_Type'Last => ' '), |
| 5107 |
Is_First => True, |
| 5108 |
Param_Close_Bracket => Close_Ch); |
| 5109 |
if Close_Ch /= ' ' then |
| 5110 |
-- Copy over the term: |
| 5111 |
ARM_Input.Copy_to_String_until_Close_Char ( |
| 5112 |
Input_Object, |
| 5113 |
Close_Ch, |
| 5114 |
Term, |
| 5115 |
TLen); |
| 5116 |
-- else no parameter. Weird. |
| 5117 |
end if; |
| 5118 |
|
| 5119 |
ARM_Input.Check_Parameter_Name (Input_Object, |
| 5120 |
Param_Name => "Sec" & (4..ARM_Input.Command_Name_Type'Last => ' '), |
| 5121 |
Is_First => False, |
| 5122 |
Param_Close_Bracket => Close_Ch); |
| 5123 |
if Close_Ch /= ' ' then |
| 5124 |
-- Copy over the term: |
| 5125 |
ARM_Input.Copy_to_String_until_Close_Char ( |
| 5126 |
Input_Object, |
| 5127 |
Close_Ch, |
| 5128 |
Subterm, |
| 5129 |
SLen); |
| 5130 |
-- else no parameter. Weird. |
| 5131 |
end if; |
| 5132 |
|
| 5133 |
ARM_Index.Add (Term => Term(1..TLen), |
| 5134 |
Subterm => Subterm(1..SLen), |
| 5135 |
Kind => ARM_Index.Partial_Term_with_Subterm, |
| 5136 |
Clause => Clause_String (Format_Object), |
| 5137 |
Paragraph => Paragraph_String, |
| 5138 |
Key => Key); |
| 5139 |
|
| 5140 |
Check_Paragraph; |
| 5141 |
if Format_Object.Display_Index_Entries then |
| 5142 |
Display_Index_Entry (Term(1..TLen) & " (" & Subterm(1..SLen) & ')', |
| 5143 |
Special => Is_Partial); |
| 5144 |
end if; |
| 5145 |
ARM_Output.Index_Target (Output_Object, Key); |
| 5146 |
|
| 5147 |
-- Leave the command end marker, let normal processing |
| 5148 |
-- get rid of it. |
| 5149 |
end; |
| 5150 |
|
| 5151 |
when Index_See => |
| 5152 |
-- @IndexSee[Term={term}, See={see}]. Index a See item. |
| 5153 |
declare |
| 5154 |
Close_Ch : Character; |
| 5155 |
Term, See : String(1..80); |
| 5156 |
TLen, SLen : Natural := 0; |
| 5157 |
Key : ARM_Index.Index_Key; |
| 5158 |
begin |
| 5159 |
ARM_Input.Check_Parameter_Name (Input_Object, |
| 5160 |
Param_Name => "Term" & (5..ARM_Input.Command_Name_Type'Last => ' '), |
| 5161 |
Is_First => True, |
| 5162 |
Param_Close_Bracket => Close_Ch); |
| 5163 |
if Close_Ch /= ' ' then |
| 5164 |
-- Copy over the term: |
| 5165 |
ARM_Input.Copy_to_String_until_Close_Char ( |
| 5166 |
Input_Object, |
| 5167 |
Close_Ch, |
| 5168 |
Term, |
| 5169 |
TLen); |
| 5170 |
-- else no parameter. Weird. |
| 5171 |
end if; |
| 5172 |
|
| 5173 |
ARM_Input.Check_Parameter_Name (Input_Object, |
| 5174 |
Param_Name => "See" & (4..ARM_Input.Command_Name_Type'Last => ' '), |
| 5175 |
Is_First => False, |
| 5176 |
Param_Close_Bracket => Close_Ch); |
| 5177 |
if Close_Ch /= ' ' then |
| 5178 |
-- Copy over the term: |
| 5179 |
ARM_Input.Copy_to_String_until_Close_Char ( |
| 5180 |
Input_Object, |
| 5181 |
Close_Ch, |
| 5182 |
See, |
| 5183 |
SLen); |
| 5184 |
-- else no parameter. Weird. |
| 5185 |
end if; |
| 5186 |
|
| 5187 |
ARM_Index.Add (Term => Term(1..TLen), |
| 5188 |
Subterm => See(1..SLen), |
| 5189 |
Kind => ARM_Index.See_Term, |
| 5190 |
Clause => Clause_String (Format_Object), |
| 5191 |
Paragraph => Paragraph_String, |
| 5192 |
Key => Key); |
| 5193 |
|
| 5194 |
Check_Paragraph; |
| 5195 |
if Format_Object.Display_Index_Entries then |
| 5196 |
Display_Index_Entry (Term(1..TLen) & ": See " & See(1..SLen)); |
| 5197 |
end if; |
| 5198 |
ARM_Output.Index_Target (Output_Object, Key); |
| 5199 |
|
| 5200 |
-- Leave the command end marker, let normal processing |
| 5201 |
-- get rid of it. |
| 5202 |
end; |
| 5203 |
|
| 5204 |
when Index_See_Also => |
| 5205 |
-- @IndexSeeAlso[Term={term}, See={see}]. Index a See Also item. |
| 5206 |
declare |
| 5207 |
Close_Ch : Character; |
| 5208 |
Term, See : String(1..80); |
| 5209 |
TLen, SLen : Natural := 0; |
| 5210 |
Key : ARM_Index.Index_Key; |
| 5211 |
begin |
| 5212 |
ARM_Input.Check_Parameter_Name (Input_Object, |
| 5213 |
Param_Name => "Term" & (5..ARM_Input.Command_Name_Type'Last => ' '), |
| 5214 |
Is_First => True, |
| 5215 |
Param_Close_Bracket => Close_Ch); |
| 5216 |
if Close_Ch /= ' ' then |
| 5217 |
-- Copy over the term: |
| 5218 |
ARM_Input.Copy_to_String_until_Close_Char ( |
| 5219 |
Input_Object, |
| 5220 |
Close_Ch, |
| 5221 |
Term, |
| 5222 |
TLen); |
| 5223 |
-- else no parameter. Weird. |
| 5224 |
end if; |
| 5225 |
|
| 5226 |
ARM_Input.Check_Parameter_Name (Input_Object, |
| 5227 |
Param_Name => "See" & (4..ARM_Input.Command_Name_Type'Last => ' '), |
| 5228 |
Is_First => False, |
| 5229 |
Param_Close_Bracket => Close_Ch); |
| 5230 |
if Close_Ch /= ' ' then |
| 5231 |
-- Copy over the term: |
| 5232 |
ARM_Input.Copy_to_String_until_Close_Char ( |
| 5233 |
Input_Object, |
| 5234 |
Close_Ch, |
| 5235 |
See, |
| 5236 |
SLen); |
| 5237 |
-- else no parameter. Weird. |
| 5238 |
end if; |
| 5239 |
|
| 5240 |
ARM_Index.Add (Term => Term(1..TLen), |
| 5241 |
Subterm => See(1..SLen), |
| 5242 |
Kind => ARM_Index.See_Also_Term, |
| 5243 |
Clause => Clause_String (Format_Object), |
| 5244 |
Paragraph => Paragraph_String, |
| 5245 |
Key => Key); |
| 5246 |
|
| 5247 |
Check_Paragraph; |
| 5248 |
if Format_Object.Display_Index_Entries then |
| 5249 |
Display_Index_Entry (Term(1..TLen) & ": See also " & See(1..SLen)); |
| 5250 |
end if; |
| 5251 |
ARM_Output.Index_Target (Output_Object, Key); |
| 5252 |
|
| 5253 |
-- Leave the command end marker, let normal processing |
| 5254 |
-- get rid of it. |
| 5255 |
end; |
| 5256 |
|
| 5257 |
when See_Other => |
| 5258 |
-- @SeeOther[Primary={term}, Other={see}]. Generate a |
| 5259 |
-- See {see} in the index, but no reference. |
| 5260 |
declare |
| 5261 |
Close_Ch : Character; |
| 5262 |
Term, See : String(1..80); |
| 5263 |
TLen, SLen : Natural := 0; |
| 5264 |
Key : ARM_Index.Index_Key; |
| 5265 |
begin |
| 5266 |
ARM_Input.Check_Parameter_Name (Input_Object, |
| 5267 |
Param_Name => "Primary" & (8..ARM_Input.Command_Name_Type'Last => ' '), |
| 5268 |
Is_First => True, |
| 5269 |
Param_Close_Bracket => Close_Ch); |
| 5270 |
if Close_Ch /= ' ' then |
| 5271 |
-- Copy over the term: |
| 5272 |
ARM_Input.Copy_to_String_until_Close_Char ( |
| 5273 |
Input_Object, |
| 5274 |
Close_Ch, |
| 5275 |
Term, |
| 5276 |
TLen); |
| 5277 |
-- else no parameter. Weird. |
| 5278 |
end if; |
| 5279 |
|
| 5280 |
ARM_Input.Check_Parameter_Name (Input_Object, |
| 5281 |
Param_Name => "Other" & (6..ARM_Input.Command_Name_Type'Last => ' '), |
| 5282 |
Is_First => False, |
| 5283 |
Param_Close_Bracket => Close_Ch); |
| 5284 |
if Close_Ch /= ' ' then |
| 5285 |
-- Copy over the term: |
| 5286 |
ARM_Input.Copy_to_String_until_Close_Char ( |
| 5287 |
Input_Object, |
| 5288 |
Close_Ch, |
| 5289 |
See, |
| 5290 |
SLen); |
| 5291 |
-- else no parameter. Weird. |
| 5292 |
end if; |
| 5293 |
|
| 5294 |
ARM_Index.Add (Term => Term(1..TLen), |
| 5295 |
Subterm => See(1..SLen), |
| 5296 |
Kind => ARM_Index.See_Other_Term, |
| 5297 |
Clause => "", |
| 5298 |
Paragraph => "", |
| 5299 |
Key => Key); |
| 5300 |
|
| 5301 |
Check_Paragraph; |
| 5302 |
ARM_Output.Index_Target (Output_Object, Key); |
| 5303 |
|
| 5304 |
-- Leave the command end marker, let normal processing |
| 5305 |
-- get rid of it. |
| 5306 |
end; |
| 5307 |
|
| 5308 |
when See_Also => |
| 5309 |
-- @SeeAlso[Primary={term}, Other={see}]. Generate a |
| 5310 |
-- See also {see} in the index, but no reference. |
| 5311 |
declare |
| 5312 |
Close_Ch : Character; |
| 5313 |
Term, See : String(1..80); |
| 5314 |
TLen, SLen : Natural := 0; |
| 5315 |
Key : ARM_Index.Index_Key; |
| 5316 |
begin |
| 5317 |
ARM_Input.Check_Parameter_Name (Input_Object, |
| 5318 |
Param_Name => "Primary" & (8..ARM_Input.Command_Name_Type'Last => ' '), |
| 5319 |
Is_First => True, |
| 5320 |
Param_Close_Bracket => Close_Ch); |
| 5321 |
if Close_Ch /= ' ' then |
| 5322 |
-- Copy over the term: |
| 5323 |
ARM_Input.Copy_to_String_until_Close_Char ( |
| 5324 |
Input_Object, |
| 5325 |
Close_Ch, |
| 5326 |
Term, |
| 5327 |
TLen); |
| 5328 |
-- else no parameter. Weird. |
| 5329 |
end if; |
| 5330 |
|
| 5331 |
ARM_Input.Check_Parameter_Name (Input_Object, |
| 5332 |
Param_Name => "Other" & (6..ARM_Input.Command_Name_Type'Last => ' '), |
| 5333 |
Is_First => False, |
| 5334 |
Param_Close_Bracket => Close_Ch); |
| 5335 |
if Close_Ch /= ' ' then |
| 5336 |
-- Copy over the term: |
| 5337 |
ARM_Input.Copy_to_String_until_Close_Char ( |
| 5338 |
Input_Object, |
| 5339 |
Close_Ch, |
| 5340 |
See, |
| 5341 |
SLen); |
| 5342 |
-- else no parameter. Weird. |
| 5343 |
end if; |
| 5344 |
|
| 5345 |
ARM_Index.Add (Term => Term(1..TLen), |
| 5346 |
Subterm => See(1..SLen), |
| 5347 |
Kind => ARM_Index.See_Also_Other_Term, |
| 5348 |
Clause => "", |
| 5349 |
Paragraph => "", |
| 5350 |
Key => Key); |
| 5351 |
|
| 5352 |
Check_Paragraph; |
| 5353 |
ARM_Output.Index_Target (Output_Object, Key); |
| 5354 |
|
| 5355 |
-- Leave the command end marker, let normal processing |
| 5356 |
-- get rid of it. |
| 5357 |
end; |
| 5358 |
|
| 5359 |
when Index_Root_Unit => |
| 5360 |
-- @RootLibUnit{<unit>} |
| 5361 |
-- Generates two index entries: An index entry for |
| 5362 |
-- "Language-Defined Library Units" with a secondary |
| 5363 |
-- entry of <unit>, and an index entry for <unit>. |
| 5364 |
declare |
| 5365 |
Term : String(1..80); |
| 5366 |
Len : Natural := 0; |
| 5367 |
Key : ARM_Index.Index_Key := ARM_Index.Get_Key; |
| 5368 |
Disposition : ARM_Output.Change_Type; |
| 5369 |
use type ARM_Output.Change_Type; |
| 5370 |
begin |
| 5371 |
ARM_Input.Copy_to_String_until_Close_Char ( |
| 5372 |
Input_Object, |
| 5373 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Close_Char, |
| 5374 |
Term, |
| 5375 |
Len); |
| 5376 |
|
| 5377 |
-- Set the current unit for future use: |
| 5378 |
Format_Object.Unit (1..Len) := Term(1..Len); |
| 5379 |
Format_Object.Unit_Len := Len; |
| 5380 |
|
| 5381 |
-- Determine what to do with the "Language-Defined" entry: |
| 5382 |
Calc_Change_Disposition ( |
| 5383 |
Format_Object => Format_Object, |
| 5384 |
Version => '2', |
| 5385 |
Operation => ARM_Output.Deletion, |
| 5386 |
Text_Kind => Disposition); |
| 5387 |
if Disposition = Do_Not_Display_Text then |
| 5388 |
null; -- Ignore this. |
| 5389 |
elsif Disposition = ARM_Output.None then |
| 5390 |
-- Make reference: |
| 5391 |
ARM_Index.Add_Reusing_Key ( |
| 5392 |
Term => "Language-Defined Library Units", |
| 5393 |
Subterm => Term(1..Len), |
| 5394 |
Kind => ARM_Index.Primary_Term_and_Subterm, |
| 5395 |
Clause => Clause_String (Format_Object), |
| 5396 |
Paragraph => Paragraph_String, |
| 5397 |
Key => Key); |
| 5398 |
elsif Disposition = ARM_Output.Deletion then |
| 5399 |
null; -- Ignore this (no change info in the index). |
| 5400 |
else -- Insertion. |
| 5401 |
raise Program_Error; -- An insertion inside of a deletion command! |
| 5402 |
end if; |
| 5403 |
|
| 5404 |
Check_Paragraph; |
| 5405 |
ARM_Output.Index_Target (Output_Object, Key); |
| 5406 |
|
| 5407 |
ARM_Index.Add_Reusing_Key ( |
| 5408 |
Term => Term(1..Len), |
| 5409 |
Kind => ARM_Index.Primary_Term, |
| 5410 |
Clause => Clause_String (Format_Object), |
| 5411 |
Paragraph => Paragraph_String, |
| 5412 |
Key => Key); |
| 5413 |
|
| 5414 |
ARM_Subindex.Insert ( |
| 5415 |
Subindex_Object => Format_Object.Package_Index, |
| 5416 |
Entity => Term(1..Len), |
| 5417 |
Kind => ARM_Subindex.Top_Level, |
| 5418 |
Clause => Clause_String (Format_Object), |
| 5419 |
Paragraph => Paragraph_String, |
| 5420 |
Key => Key); |
| 5421 |
|
| 5422 |
Format_State.Nesting_Stack_Ptr := Format_State.Nesting_Stack_Ptr - 1; |
| 5423 |
-- Remove the "RootLibUnit" record. |
| 5424 |
end; |
| 5425 |
|
| 5426 |
when Index_Child_Unit => |
| 5427 |
-- @ChildUnit{Parent=[<parent>],Child=[<child>]} |
| 5428 |
-- Generates three index entries: An index entry for <child>, with a secondary |
| 5429 |
-- of "@i{child of} <parent>", an index entry for "Language-Defined |
| 5430 |
-- Library Units" with a secondary entry of <parent>.<child>, |
| 5431 |
-- and an index entry for <parent>.<child>. |
| 5432 |
Child_Unit (Format_Object.Package_Index, |
| 5433 |
Format_Object, |
| 5434 |
Output_Object); |
| 5435 |
|
| 5436 |
|
| 5437 |
when Index_Subprogram_Child_Unit => |
| 5438 |
-- @ChildUnit{Parent=[<parent>],Child=[<child>]} |
| 5439 |
-- Generates three index entries: An index entry for <child>, with a secondary |
| 5440 |
-- of "@i{child of} <parent>", an index entry for "Language-Defined |
| 5441 |
-- Library Units" with a secondary entry of <parent>.<child>, |
| 5442 |
-- and an index entry for <parent>.<child>. |
| 5443 |
Child_Unit (Format_Object.Subprogram_Index, |
| 5444 |
Format_Object, |
| 5445 |
Output_Object); |
| 5446 |
|
| 5447 |
when Index_Type => |
| 5448 |
-- @AdaTypeDefn{<defn>} |
| 5449 |
-- Generates two index entries: one for <defn> with a |
| 5450 |
-- secondary entry of "@i{in} <Unit>" (where Unit is |
| 5451 |
-- the unit saved by a previous RootLibUnit or ChildUnit.), |
| 5452 |
-- adds a similar entry to the exception list, |
| 5453 |
-- and second for "Language-Defined Type" with a |
| 5454 |
-- secondary entry of "<defn> @i{in} <Unit>". |
| 5455 |
-- Also outputs the <defn> to the output file. |
| 5456 |
|
| 5457 |
Simple_Subindex_Item ( |
| 5458 |
Format_Object.Type_Index, |
| 5459 |
Format_Object, |
| 5460 |
Output_Object, |
| 5461 |
Entity_Kind_Name => "Type"); |
| 5462 |
Format_State.Nesting_Stack_Ptr := Format_State.Nesting_Stack_Ptr - 1; |
| 5463 |
-- Remove the "AdaTypeDefn" record. |
| 5464 |
|
| 5465 |
when Index_Subtype => |
| 5466 |
-- @AdaSubTypeDefn{Name=<defn>,Of=<type>} |
| 5467 |
-- Generates an index entry of "<defn> @i{subtype of} |
| 5468 |
-- <type>" with a secondary entry of "@i{in} <Unit>" (where |
| 5469 |
-- Unit is the unit saved by a previous RootLibUnit or |
| 5470 |
-- ChildUnit.) The entry is added to the type list as well. |
| 5471 |
-- Also outputs the <defn> to the output file. |
| 5472 |
declare |
| 5473 |
Subtype_Name, Type_Name : String(1..80); |
| 5474 |
SLen, TLen : Natural := 0; |
| 5475 |
Key : ARM_Index.Index_Key := ARM_Index.Get_Key; |
| 5476 |
Close_Ch : Character; |
| 5477 |
begin |
| 5478 |
ARM_Input.Check_Parameter_Name (Input_Object, |
| 5479 |
Param_Name => "Name" & (5..ARM_Input.Command_Name_Type'Last => ' '), |
| 5480 |
Is_First => True, |
| 5481 |
Param_Close_Bracket => Close_Ch); |
| 5482 |
if Close_Ch /= ' ' then |
| 5483 |
-- Copy over the term: |
| 5484 |
ARM_Input.Copy_to_String_until_Close_Char ( |
| 5485 |
Input_Object, |
| 5486 |
Close_Ch, |
| 5487 |
Subtype_Name, |
| 5488 |
SLen); |
| 5489 |
-- else no parameter. Weird. |
| 5490 |
end if; |
| 5491 |
|
| 5492 |
ARM_Input.Check_Parameter_Name (Input_Object, |
| 5493 |
Param_Name => "Of" & (3..ARM_Input.Command_Name_Type'Last => ' '), |
| 5494 |
Is_First => False, |
| 5495 |
Param_Close_Bracket => Close_Ch); |
| 5496 |
if Close_Ch /= ' ' then |
| 5497 |
-- Copy over the term: |
| 5498 |
ARM_Input.Copy_to_String_until_Close_Char ( |
| 5499 |
Input_Object, |
| 5500 |
Close_Ch, |
| 5501 |
Type_Name, |
| 5502 |
TLen); |
| 5503 |
-- else no parameter. Weird. |
| 5504 |
end if; |
| 5505 |
|
| 5506 |
Check_Paragraph; |
| 5507 |
ARM_Output.Index_Target (Output_Object, Key); |
| 5508 |
|
| 5509 |
if Format_Object.Unit_Len = 0 then |
| 5510 |
Ada.Text_IO.Put_Line ("** No unit defined for index entry expecting one on line " & ARM_Input.Line_String (Input_Object)); |
| 5511 |
|
| 5512 |
ARM_Index.Add_Reusing_Key ( |
| 5513 |
Term => Subtype_Name(1..SLen) & " subtype of " & |
| 5514 |
Type_Name(1..TLen), |
| 5515 |
Subterm => "*unknown*", |
| 5516 |
Kind => ARM_Index.Subtype_Declaration_in_Package, |
| 5517 |
Clause => Clause_String (Format_Object), |
| 5518 |
Paragraph => Paragraph_String, |
| 5519 |
Key => Key); |
| 5520 |
|
| 5521 |
ARM_Subindex.Insert ( |
| 5522 |
Subindex_Object => Format_Object.Type_Index, |
| 5523 |
Entity => Subtype_Name(1..SLen) & " subtype of " & |
| 5524 |
Type_Name(1..TLen), |
| 5525 |
From_Unit => "*unknown*", |
| 5526 |
Kind => ARM_Subindex.Subtype_In_Unit, |
| 5527 |
Clause => Clause_String (Format_Object), |
| 5528 |
Paragraph => Paragraph_String, |
| 5529 |
Key => Key); |
| 5530 |
else |
| 5531 |
ARM_Index.Add_Reusing_Key ( |
| 5532 |
Term => Subtype_Name(1..SLen) & " subtype of " & |
| 5533 |
Type_Name(1..TLen), |
| 5534 |
Subterm => Format_Object.Unit(1..Format_Object.Unit_Len), |
| 5535 |
Kind => ARM_Index.Subtype_Declaration_in_Package, |
| 5536 |
Clause => Clause_String (Format_Object), |
| 5537 |
Paragraph => Paragraph_String, |
| 5538 |
Key => Key); |
| 5539 |
|
| 5540 |
ARM_Subindex.Insert ( |
| 5541 |
Subindex_Object => Format_Object.Type_Index, |
| 5542 |
Entity => Subtype_Name(1..SLen) & " subtype of " & |
| 5543 |
Type_Name(1..TLen), |
| 5544 |
From_Unit => Format_Object.Unit(1..Format_Object.Unit_Len), |
| 5545 |
Kind => ARM_Subindex.Subtype_In_Unit, |
| 5546 |
Clause => Clause_String (Format_Object), |
| 5547 |
Paragraph => Paragraph_String, |
| 5548 |
Key => Key); |
| 5549 |
end if; |
| 5550 |
ARM_Output.Ordinary_Text (Output_Object, Subtype_Name(1..SLen)); |
| 5551 |
Format_Object.Last_Non_Space := True; |
| 5552 |
-- Leave the command end marker, let normal processing |
| 5553 |
-- get rid of it. |
| 5554 |
end; |
| 5555 |
|
| 5556 |
when Index_Subprogram => |
| 5557 |
-- @AdaSubDefn{<defn>} |
| 5558 |
-- Generates two index entries: one for <defn> with a |
| 5559 |
-- secondary entry of "@i{in} <Unit>" (where Unit is |
| 5560 |
-- the unit saved by a previous RootLibUnit or ChildUnit.), |
| 5561 |
-- adds a similar entry to the exception list, |
| 5562 |
-- and second for "Language-Defined Subprogram" with a |
| 5563 |
-- secondary entry of "<defn> @i{in} <Unit>". |
| 5564 |
-- Also outputs the <defn> to the output file. |
| 5565 |
Simple_Subindex_Item ( |
| 5566 |
Format_Object.Subprogram_Index, |
| 5567 |
Format_Object, |
| 5568 |
Output_Object, |
| 5569 |
Entity_Kind_Name => "Subprogram"); |
| 5570 |
Format_State.Nesting_Stack_Ptr := Format_State.Nesting_Stack_Ptr - 1; |
| 5571 |
-- Remove the "AdaSubDefn" record. |
| 5572 |
|
| 5573 |
when Index_Exception => |
| 5574 |
-- @AdaExcDefn{<defn>} |
| 5575 |
-- Generates and index entries for <defn> with a |
| 5576 |
-- secondary entry of "@i{in} <Unit>" (where Unit is |
| 5577 |
-- the unit saved by a previous RootLibUnit or ChildUnit.), |
| 5578 |
-- and adds a similar entry to the exception list. |
| 5579 |
-- Also outputs the <defn> to the output file. |
| 5580 |
Simple_Subindex_Item ( |
| 5581 |
Format_Object.Exception_Index, |
| 5582 |
Format_Object, |
| 5583 |
Output_Object, |
| 5584 |
Entity_Kind_Name => ""); |
| 5585 |
Format_State.Nesting_Stack_Ptr := Format_State.Nesting_Stack_Ptr - 1; |
| 5586 |
-- Remove the "AdaExcDefn" record. |
| 5587 |
|
| 5588 |
when Index_Object => |
| 5589 |
-- @AdaObjDefn{<defn>} |
| 5590 |
-- Generates and index entries for <defn> with a |
| 5591 |
-- secondary entry of "@i{in} <Unit>" (where Unit is |
| 5592 |
-- the unit saved by a previous RootLibUnit or ChildUnit.), |
| 5593 |
-- and adds a similar entry to the exception list. |
| 5594 |
-- Also outputs the <defn> to the output file. |
| 5595 |
Simple_Subindex_Item ( |
| 5596 |
Format_Object.Object_Index, |
| 5597 |
Format_Object, |
| 5598 |
Output_Object, |
| 5599 |
Entity_Kind_Name => ""); |
| 5600 |
Format_State.Nesting_Stack_Ptr := Format_State.Nesting_Stack_Ptr - 1; |
| 5601 |
-- Remove the "AdaObjDefn" record. |
| 5602 |
|
| 5603 |
when Index_Package => |
| 5604 |
-- @AdaObjDefn{<defn>} |
| 5605 |
-- Generates and index entries for <defn> with a |
| 5606 |
-- secondary entry of "@i{in} <Unit>" (where Unit is |
| 5607 |
-- the unit saved by a previous RootLibUnit or ChildUnit.), |
| 5608 |
-- and adds a similar entry to the package list. |
| 5609 |
-- Also outputs the <defn> to the output file. |
| 5610 |
Simple_Subindex_Item ( |
| 5611 |
Format_Object.Package_Index, |
| 5612 |
Format_Object, |
| 5613 |
Output_Object, |
| 5614 |
Entity_Kind_Name => ""); |
| 5615 |
Format_State.Nesting_Stack_Ptr := Format_State.Nesting_Stack_Ptr - 1; |
| 5616 |
-- Remove the "AdaPackDefn" record. |
| 5617 |
|
| 5618 |
when Index_Other => |
| 5619 |
-- @AdaDefn{<defn>} |
| 5620 |
-- Generate an index entries for <defn> with a |
| 5621 |
-- secondary entry of "@i{in} <Unit>" (where Unit is |
| 5622 |
-- the unit saved by a previous RootLibUnit or ChildUnit.). |
| 5623 |
-- Also outputs the <defn> to the output file. |
| 5624 |
declare |
| 5625 |
Item : String(1..80); |
| 5626 |
Len : Natural := 0; |
| 5627 |
Key : ARM_Index.Index_Key; |
| 5628 |
begin |
| 5629 |
ARM_Input.Copy_to_String_until_Close_Char ( |
| 5630 |
Input_Object, |
| 5631 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Close_Char, |
| 5632 |
Item, |
| 5633 |
Len); |
| 5634 |
|
| 5635 |
ARM_Index.Add (Term => Item(1..Len), |
| 5636 |
Subterm => Format_Object.Unit(1..Format_Object.Unit_Len), |
| 5637 |
Kind => ARM_Index.Declaration_in_Package, |
| 5638 |
Clause => Clause_String (Format_Object), |
| 5639 |
Paragraph => Paragraph_String, |
| 5640 |
Key => Key); |
| 5641 |
Check_Paragraph; |
| 5642 |
ARM_Output.Index_Target (Output_Object, Key); |
| 5643 |
|
| 5644 |
ARM_Output.Ordinary_Text (Output_Object, Item(1..Len)); |
| 5645 |
Format_Object.Last_Non_Space := True; |
| 5646 |
|
| 5647 |
Format_State.Nesting_Stack_Ptr := Format_State.Nesting_Stack_Ptr - 1; |
| 5648 |
-- Remove the "AdaDefn" record. |
| 5649 |
end; |
| 5650 |
|
| 5651 |
when Index_Check => |
| 5652 |
-- @Indexcheck{<check>} |
| 5653 |
-- Generates index items for |
| 5654 |
-- "check, language-defined", <check>, |
| 5655 |
-- and <check> [partial]. |
| 5656 |
declare |
| 5657 |
Term : String(1..80); |
| 5658 |
Len : Natural := 0; |
| 5659 |
Key : ARM_Index.Index_Key; |
| 5660 |
begin |
| 5661 |
ARM_Input.Copy_to_String_until_Close_Char ( |
| 5662 |
Input_Object, |
| 5663 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Close_Char, |
| 5664 |
Term, |
| 5665 |
Len); |
| 5666 |
|
| 5667 |
ARM_Index.Add (Term => Term(1..Len), |
| 5668 |
Kind => ARM_Index.Partial_Term, |
| 5669 |
Clause => Clause_String (Format_Object), |
| 5670 |
Paragraph => Paragraph_String, |
| 5671 |
Key => Key); |
| 5672 |
Check_Paragraph; |
| 5673 |
if Format_Object.Display_Index_Entries then |
| 5674 |
Display_Index_Entry (Term(1..Len), Special => Is_Partial); |
| 5675 |
end if; |
| 5676 |
ARM_Output.Index_Target (Output_Object, Key); |
| 5677 |
|
| 5678 |
ARM_Index.Add (Term => "check, language-defined", |
| 5679 |
Subterm => Term(1..Len), |
| 5680 |
Kind => ARM_Index.Primary_Term_and_Subterm, |
| 5681 |
Clause => Clause_String (Format_Object), |
| 5682 |
Paragraph => Paragraph_String, |
| 5683 |
Key => Key); |
| 5684 |
if Format_Object.Display_Index_Entries then |
| 5685 |
Display_Index_Entry ("check, language-defined (" & Term(1..Len) & ")"); |
| 5686 |
end if; |
| 5687 |
ARM_Output.Index_Target (Output_Object, Key); |
| 5688 |
|
| 5689 |
Format_State.Nesting_Stack_Ptr := Format_State.Nesting_Stack_Ptr - 1; |
| 5690 |
-- Remove the "Indexcheck" record. |
| 5691 |
end; |
| 5692 |
|
| 5693 |
when Index_Attr => |
| 5694 |
-- This command indexes an attribute name. |
| 5695 |
-- This calls Defn2("attributes", <param>), and |
| 5696 |
-- also writes <param> to output. |
| 5697 |
declare |
| 5698 |
Param : String(1..20); |
| 5699 |
Len : Natural := 0; |
| 5700 |
Key : ARM_Index.Index_Key; |
| 5701 |
begin |
| 5702 |
ARM_Input.Copy_to_String_until_Close_Char ( |
| 5703 |
Input_Object, |
| 5704 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Close_Char, |
| 5705 |
Param, |
| 5706 |
Len); |
| 5707 |
|
| 5708 |
Check_Paragraph; |
| 5709 |
|
| 5710 |
ARM_Index.Add (Term => "attributes", |
| 5711 |
Subterm => Param(1..Len), |
| 5712 |
Kind => ARM_Index.Primary_Term_and_Subterm, |
| 5713 |
Clause => Clause_String (Format_Object), |
| 5714 |
Paragraph => Paragraph_String, |
| 5715 |
Key => Key); |
| 5716 |
ARM_Output.Index_Target (Output_Object, Key); |
| 5717 |
|
| 5718 |
ARM_Index.Add (Term => Param(1..Len) & " attribute", |
| 5719 |
Kind => ARM_Index.Primary_Term, |
| 5720 |
Clause => Clause_String (Format_Object), |
| 5721 |
Paragraph => Paragraph_String, |
| 5722 |
Key => Key); |
| 5723 |
ARM_Output.Index_Target (Output_Object, Key); |
| 5724 |
|
| 5725 |
ARM_Output.Ordinary_Text (Output_Object, |
| 5726 |
Param(1..Len)); |
| 5727 |
Format_State.Nesting_Stack_Ptr := Format_State.Nesting_Stack_Ptr - 1; |
| 5728 |
-- Remove the "Index_Attr" record. |
| 5729 |
end; |
| 5730 |
|
| 5731 |
when Index_Pragma => |
| 5732 |
-- This command indexes a pragma name. |
| 5733 |
-- This calls Defn2("pragmas", <param>), and |
| 5734 |
-- also writes <param> to output. |
| 5735 |
declare |
| 5736 |
Param : String(1..30); |
| 5737 |
Len : Natural := 0; |
| 5738 |
Key : ARM_Index.Index_Key; |
| 5739 |
begin |
| 5740 |
ARM_Input.Copy_to_String_until_Close_Char ( |
| 5741 |
Input_Object, |
| 5742 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Close_Char, |
| 5743 |
Param, |
| 5744 |
Len); |
| 5745 |
Check_Paragraph; |
| 5746 |
ARM_Index.Add (Term => "pragmas", |
| 5747 |
Subterm => Param(1..Len), |
| 5748 |
Kind => ARM_Index.Primary_Term_and_Subterm, |
| 5749 |
Clause => Clause_String (Format_Object), |
| 5750 |
Paragraph => Paragraph_String, |
| 5751 |
Key => Key); |
| 5752 |
ARM_Output.Index_Target (Output_Object, Key); |
| 5753 |
|
| 5754 |
ARM_Index.Add (Term => Param(1..Len) & " pragma", |
| 5755 |
Kind => ARM_Index.Primary_Term, |
| 5756 |
Clause => Clause_String (Format_Object), |
| 5757 |
Paragraph => Paragraph_String, |
| 5758 |
Key => Key); |
| 5759 |
ARM_Output.Index_Target (Output_Object, Key); |
| 5760 |
|
| 5761 |
ARM_Output.Ordinary_Text (Output_Object, |
| 5762 |
Param(1..Len)); |
| 5763 |
Format_State.Nesting_Stack_Ptr := Format_State.Nesting_Stack_Ptr - 1; |
| 5764 |
-- Remove the "Index_Pragma" record. |
| 5765 |
end; |
| 5766 |
|
| 5767 |
when Index_Aspect => |
| 5768 |
-- This command indexes an aspect name. |
| 5769 |
-- This calls Defn2("aspects", <param>), and |
| 5770 |
-- Defn(<param> "aspect") |
| 5771 |
declare |
| 5772 |
Param : String(1..30); |
| 5773 |
Len : Natural := 0; |
| 5774 |
Key : ARM_Index.Index_Key; |
| 5775 |
begin |
| 5776 |
ARM_Input.Copy_to_String_until_Close_Char ( |
| 5777 |
Input_Object, |
| 5778 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Close_Char, |
| 5779 |
Param, |
| 5780 |
Len); |
| 5781 |
Check_Paragraph; |
| 5782 |
ARM_Index.Add (Term => "aspects", |
| 5783 |
Subterm => Param(1..Len), |
| 5784 |
Kind => ARM_Index.Primary_Term_and_Subterm, |
| 5785 |
Clause => Clause_String (Format_Object), |
| 5786 |
Paragraph => Paragraph_String, |
| 5787 |
Key => Key); |
| 5788 |
ARM_Output.Index_Target (Output_Object, Key); |
| 5789 |
|
| 5790 |
ARM_Index.Add (Term => Param(1..Len) & " aspect", |
| 5791 |
Kind => ARM_Index.Primary_Term, |
| 5792 |
Clause => Clause_String (Format_Object), |
| 5793 |
Paragraph => Paragraph_String, |
| 5794 |
Key => Key); |
| 5795 |
ARM_Output.Index_Target (Output_Object, Key); |
| 5796 |
|
| 5797 |
Format_State.Nesting_Stack_Ptr := Format_State.Nesting_Stack_Ptr - 1; |
| 5798 |
-- Remove the "Index_Aspect" record. |
| 5799 |
end; |
| 5800 |
|
| 5801 |
when Syntax_Rule => |
| 5802 |
-- @syn{[Tabs=<Tabset>, ]LHS=<Non-terminal>, RHS=<Production>} |
| 5803 |
-- Marks a syntax production of the form: |
| 5804 |
-- @nt<Non-Terminal> ::= <Production> |
| 5805 |
-- <Tabset> defines any tabs needed by the syntax production. |
| 5806 |
-- |
| 5807 |
-- Also, the <Non-terminal> is indexed. The <Non-Terminal> |
| 5808 |
-- and <Production> (and the clause number) are sent to the |
| 5809 |
-- syntax manager. Also, saves <Non-terminal> for any |
| 5810 |
-- following Syntax_Term (@Syn2) to use. |
| 5811 |
|
| 5812 |
declare |
| 5813 |
RHS_Close_Ch : Character; |
| 5814 |
begin |
| 5815 |
Get_Syntax_Parameters (Has_Version => False, |
| 5816 |
RHS_Close_Ch => RHS_Close_Ch); |
| 5817 |
|
| 5818 |
Gen_Syntax_Rule (ARM_Output.None, RHS_Close_Ch); |
| 5819 |
end; |
| 5820 |
|
| 5821 |
when Added_Syntax_Rule => |
| 5822 |
-- @AddedSyn{Version=[Version],[Tabs=<Tabset>, ]LHS=<Non-terminal>, RHS=<Production>} |
| 5823 |
-- Marks an added syntax production of the form: |
| 5824 |
-- @nt<Non-Terminal> ::= <Production> |
| 5825 |
-- See Syntax_Rule for the details. |
| 5826 |
declare |
| 5827 |
RHS_Close_Ch : Character; |
| 5828 |
Disposition : ARM_Output.Change_Type; |
| 5829 |
begin |
| 5830 |
Get_Syntax_Parameters (Has_Version => True, |
| 5831 |
RHS_Close_Ch => RHS_Close_Ch); |
| 5832 |
if Format_Object.In_Change then |
| 5833 |
Ada.Text_IO.Put_Line (" ** In change for AddedSyn on line " & ARM_Input.Line_String (Input_Object)); |
| 5834 |
raise Program_Error; |
| 5835 |
end if; |
| 5836 |
|
| 5837 |
Calc_Change_Disposition ( |
| 5838 |
Format_Object => Format_Object, |
| 5839 |
Version => Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Change_Version, |
| 5840 |
Operation => ARM_Output.Insertion, |
| 5841 |
Text_Kind => Disposition); |
| 5842 |
|
| 5843 |
Gen_Syntax_Rule (Disposition, RHS_Close_Ch); |
| 5844 |
end; |
| 5845 |
|
| 5846 |
when Deleted_Syntax_Rule => |
| 5847 |
-- @DeletedSyn{Version=[Version],[Tabs=<Tabset>, ]LHS=<Non-terminal>, RHS=<Production>} |
| 5848 |
-- Marks a deleted syntax production of the form: |
| 5849 |
-- @nt<Non-Terminal> ::= <Production> |
| 5850 |
-- See Syntax_Rule for the details. |
| 5851 |
declare |
| 5852 |
RHS_Close_Ch : Character; |
| 5853 |
Disposition : ARM_Output.Change_Type; |
| 5854 |
begin |
| 5855 |
Get_Syntax_Parameters (Has_Version => True, |
| 5856 |
RHS_Close_Ch => RHS_Close_Ch); |
| 5857 |
if Format_Object.In_Change then |
| 5858 |
Ada.Text_IO.Put_Line (" ** In change for DeletedSyn on line " & ARM_Input.Line_String (Input_Object)); |
| 5859 |
raise Program_Error; |
| 5860 |
end if; |
| 5861 |
|
| 5862 |
Calc_Change_Disposition ( |
| 5863 |
Format_Object => Format_Object, |
| 5864 |
Version => Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Change_Version, |
| 5865 |
Operation => ARM_Output.Deletion, |
| 5866 |
Text_Kind => Disposition); |
| 5867 |
|
| 5868 |
Gen_Syntax_Rule (Disposition, RHS_Close_Ch); |
| 5869 |
end; |
| 5870 |
|
| 5871 |
when Syntax_Term | Syntax_Term_Undefined => |
| 5872 |
-- Marks a non-terminal name in the production of a syntax |
| 5873 |
-- rule. Generates the term in the same style as |
| 5874 |
-- @nt (Non_Terminal). "Undefined" means the term is |
| 5875 |
-- not formally defined (like the character class names in |
| 5876 |
-- the Ada standard). |
| 5877 |
-- If the current LHS non-terminal is not null, generates |
| 5878 |
-- a syntax cross reference entry: |
| 5879 |
-- <Name> in <Non-Terminal> at <ClauseNum>. Also, |
| 5880 |
-- generate an index entry for the item: |
| 5881 |
-- @Defn2(Term=<Name>,Sec=@i{used}. |
| 5882 |
-- Note: We assume no internal formatting in <Name>. |
| 5883 |
declare |
| 5884 |
Name : String(1..40); |
| 5885 |
Len : Natural; |
| 5886 |
Key : ARM_Index.Index_Key; |
| 5887 |
Defined : constant Boolean := |
| 5888 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Command = |
| 5889 |
Syntax_Term; |
| 5890 |
begin |
| 5891 |
ARM_Input.Copy_to_String_until_Close_Char ( |
| 5892 |
Input_Object, |
| 5893 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Close_Char, |
| 5894 |
Name, Len); |
| 5895 |
if Format_Object.Syntax_NT_Len /= 0 then |
| 5896 |
-- Generate a syntax cross-reference entry. |
| 5897 |
declare |
| 5898 |
NT : constant String := Get_NT; |
| 5899 |
begin |
| 5900 |
if NT /= "" then |
| 5901 |
ARM_Syntax.Add_Xref ( |
| 5902 |
Name => Name(1..Len), |
| 5903 |
Used_In => Get_NT, |
| 5904 |
Clause => Clause_String (Format_Object), |
| 5905 |
Defined => Defined); |
| 5906 |
-- else this is a deleted production that is |
| 5907 |
-- still displayed; forget the XRef. |
| 5908 |
end if; |
| 5909 |
end; |
| 5910 |
end if; |
| 5911 |
|
| 5912 |
-- Index the non-terminal: |
| 5913 |
ARM_Index.Add (Term => Name(1..Len), |
| 5914 |
Kind => ARM_Index.Syntax_NT_Used, |
| 5915 |
Clause => Clause_String (Format_Object), |
| 5916 |
Paragraph => Paragraph_String, |
| 5917 |
Key => Key); |
| 5918 |
ARM_Output.Index_Target (Output_Object, Key); |
| 5919 |
|
| 5920 |
-- Set the appropriate style: |
| 5921 |
Check_Paragraph; |
| 5922 |
declare |
| 5923 |
Swiss_Format : ARM_Output.Format_Type := |
| 5924 |
Format_Object.Text_Format; |
| 5925 |
begin |
| 5926 |
Swiss_Format.Font := ARM_Output.Swiss; |
| 5927 |
ARM_Output.Text_Format (Output_Object, |
| 5928 |
Swiss_Format); |
| 5929 |
end; |
| 5930 |
if not Defined then |
| 5931 |
-- No linking to do. |
| 5932 |
ARM_Output.Ordinary_Text (Output_Object, Name(1..Len)); |
| 5933 |
elsif Format_Object.Link_Non_Terminals then |
| 5934 |
declare |
| 5935 |
Lower_NT : constant String := |
| 5936 |
Ada.Characters.Handling.To_Lower (Name(1..Len)); |
| 5937 |
Clause : constant String := |
| 5938 |
ARM_Syntax.Non_Terminal_Clause (Lower_NT); |
| 5939 |
Target : constant ARM_Syntax.Target_Type := |
| 5940 |
ARM_Syntax.Non_Terminal_Link_Target (Lower_NT); |
| 5941 |
begin |
| 5942 |
if Clause = "" then -- Not found. No link, but error message: |
| 5943 |
Ada.Text_IO.Put_Line (" ** Unknown non-terminal in syntax production " & |
| 5944 |
Name(1..Len) & " on line " & ARM_Input.Line_String (Input_Object)); |
| 5945 |
ARM_Output.Ordinary_Text (Output_Object, Name(1..Len)); |
| 5946 |
else |
| 5947 |
ARM_Output.Local_Link (Output_Object, Text => Name(1..Len), |
| 5948 |
Target => Target, Clause_Number => Clause); |
| 5949 |
end if; |
| 5950 |
end; |
| 5951 |
else |
| 5952 |
ARM_Output.Ordinary_Text (Output_Object, Name(1..Len)); |
| 5953 |
end if; |
| 5954 |
ARM_Output.Text_Format (Output_Object, |
| 5955 |
Format_Object.Text_Format); -- Reset the format. |
| 5956 |
Format_Object.Last_Non_Space := True; |
| 5957 |
end; |
| 5958 |
Format_State.Nesting_Stack_Ptr := Format_State.Nesting_Stack_Ptr - 1; |
| 5959 |
--Ada.Text_IO.Put_Line (" &Unstack (Syntax Term)"); |
| 5960 |
|
| 5961 |
when Syntax_Prefix => |
| 5962 |
-- Marks the prefix of a non-terminal. Writes italized |
| 5963 |
-- text in the current font. |
| 5964 |
-- Set the appropriate style: |
| 5965 |
Check_Paragraph; |
| 5966 |
Format_Object.Text_Format.Italic := True; |
| 5967 |
ARM_Output.Text_Format (Output_Object, |
| 5968 |
Format_Object.Text_Format); |
| 5969 |
|
| 5970 |
when To_Glossary | To_Glossary_Also => |
| 5971 |
-- This is a glossary command. |
| 5972 |
-- It is of the form @ToGlossary(Term=[<term>], Text=[<text>]) |
| 5973 |
-- We will store the term and definition in the glossary |
| 5974 |
-- database. We also have to pass through the Text |
| 5975 |
-- parameter, either to the regular text (for |
| 5976 |
-- ToGlossaryAlso) or the AARM (for ToGlossary). |
| 5977 |
|
| 5978 |
declare |
| 5979 |
Close_Ch : Character; |
| 5980 |
Key : ARM_Index.Index_Key; |
| 5981 |
begin |
| 5982 |
if Format_Object.Glossary_Info.Active then |
| 5983 |
Ada.Text_IO.Put_Line (" ** Nested glossary entry on line " & ARM_Input.Line_String (Input_Object)); |
| 5984 |
-- else OK. |
| 5985 |
end if; |
| 5986 |
-- Setup glossary information for this command: |
| 5987 |
Format_Object.Glossary_Info := |
| 5988 |
(Active => True, |
| 5989 |
Change_Kind => ARM_Database.None, |
| 5990 |
-- No change for this command. |
| 5991 |
Term => <>, -- Set below. |
| 5992 |
Term_Len => <>, -- Set below. |
| 5993 |
Add_to_Glossary => True, -- Always add it. |
| 5994 |
Displayed => False); -- Until we decide differently. |
| 5995 |
|
| 5996 |
ARM_Input.Check_Parameter_Name (Input_Object, |
| 5997 |
Param_Name => "Term" & (5..ARM_Input.Command_Name_Type'Last => ' '), |
| 5998 |
Is_First => True, |
| 5999 |
Param_Close_Bracket => Close_Ch); |
| 6000 |
if Close_Ch /= ' ' then |
| 6001 |
-- Copy the term: |
| 6002 |
ARM_Input.Copy_to_String_until_Close_Char ( |
| 6003 |
Input_Object, |
| 6004 |
Close_Ch, |
| 6005 |
Format_Object.Glossary_Info.Term, |
| 6006 |
Format_Object.Glossary_Info.Term_Len); |
| 6007 |
-- else no parameter. Weird. |
| 6008 |
end if; |
| 6009 |
|
| 6010 |
ARM_Input.Check_Parameter_Name (Input_Object, |
| 6011 |
Param_Name => "Text" & (5..ARM_Input.Command_Name_Type'Last => ' '), |
| 6012 |
Is_First => False, |
| 6013 |
Param_Close_Bracket => Close_Ch); |
| 6014 |
if Close_Ch /= ' ' then |
| 6015 |
-- Now, handle the parameter: |
| 6016 |
-- Stack it so we can process the end: |
| 6017 |
Set_Nesting_for_Parameter |
| 6018 |
(Command => Glossary_Text_Param, |
| 6019 |
Close_Ch => Close_Ch); |
| 6020 |
|
| 6021 |
ARM_Input.Start_Recording (Input_Object); |
| 6022 |
|
| 6023 |
if Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr-1).Command = To_Glossary_Also then |
| 6024 |
-- The text just goes straight to the file. |
| 6025 |
if Format_Object.Display_Index_Entries then |
| 6026 |
Display_Index_Entry (Format_Object.Glossary_Info.Term (1..Format_Object.Glossary_Info.Term_Len)); -- Includes Check_Paragraph. |
| 6027 |
ARM_Output.Ordinary_Text (Output_Object, |
| 6028 |
"[Glossary Entry]"); |
| 6029 |
Format_Object.Last_Non_Space := True; |
| 6030 |
-- else no marker. |
| 6031 |
end if; |
| 6032 |
|
| 6033 |
-- Index the term (because it does appear here): |
| 6034 |
Check_Paragraph; -- We've got to be in a paragraph to write this. |
| 6035 |
ARM_Index.Add (Term => Format_Object.Glossary_Info.Term (1..Format_Object.Glossary_Info.Term_Len), |
| 6036 |
Kind => ARM_Index.Primary_Term, |
| 6037 |
Clause => Clause_String (Format_Object), |
| 6038 |
Paragraph => Paragraph_String, |
| 6039 |
Key => Key); |
| 6040 |
ARM_Output.Index_Target (Output_Object, Key); |
| 6041 |
Format_Object.Glossary_Info.Displayed := True; |
| 6042 |
elsif Format_Object.Include_Annotations then |
| 6043 |
Check_End_Paragraph; -- End any paragraph that we're in. |
| 6044 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Old_Last_Subhead_Paragraph := Format_Object.Last_Paragraph_Subhead_Type; |
| 6045 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Old_Next_Subhead_Paragraph := Format_Object.Next_Paragraph_Subhead_Type; |
| 6046 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Old_Next_Paragraph_Format := Format_Object.Next_Paragraph_Format_Type; |
| 6047 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Old_Tab_Stops := Format_Object.Paragraph_Tab_Stops; |
| 6048 |
Format_Object.Next_Paragraph_Format_Type := Glossary_Marker; |
| 6049 |
Format_Object.Next_Paragraph_Subhead_Type := Glossary_Marker; |
| 6050 |
Format_Object.Paragraph_Tab_Stops := ARM_Output.NO_TABS; |
| 6051 |
Display_Index_Entry (Format_Object.Glossary_Info.Term (1..Format_Object.Glossary_Info.Term_Len)); -- Includes Check_Paragraph. |
| 6052 |
Format_Object.Glossary_Info.Displayed := True; |
| 6053 |
-- Note: The term is indexed in the glossary, |
| 6054 |
-- but not here. |
| 6055 |
else -- No annotations, "To_Glossary" |
| 6056 |
if Format_Object.Display_Index_Entries then |
| 6057 |
Display_Index_Entry (Format_Object.Glossary_Info.Term (1..Format_Object.Glossary_Info.Term_Len)); -- Includes Check_Paragraph. |
| 6058 |
ARM_Output.Ordinary_Text (Output_Object, |
| 6059 |
"[Glossary Entry]"); |
| 6060 |
Format_Object.Last_Non_Space := True; |
| 6061 |
-- else no marker. |
| 6062 |
end if; |
| 6063 |
-- Skip the text: |
| 6064 |
ARM_Input.Skip_until_Close_Char (Input_Object, |
| 6065 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Close_Char); |
| 6066 |
ARM_Input.Replace_Char (Input_Object); -- Let the normal termination clean this up. |
| 6067 |
Format_Object.Glossary_Info.Displayed := False; |
| 6068 |
-- Note: The term is indexed in the glossary, |
| 6069 |
-- but not here. |
| 6070 |
end if; |
| 6071 |
end if; |
| 6072 |
end; |
| 6073 |
|
| 6074 |
when Change_To_Glossary | Change_To_Glossary_Also => |
| 6075 |
-- This is a change glossary command. |
| 6076 |
-- It is of the form |
| 6077 |
-- @ChgToGlossary(Version=[<version>],Kind=(<kind>),Term=[<term>], Text=[<text>]) |
| 6078 |
-- We will store the term and definition in the glossary |
| 6079 |
-- database. We also have to pass through the Text |
| 6080 |
-- parameter, either to the regular text (for |
| 6081 |
-- ChgToGlossaryAlso) or the AARM (for ChgToGlossary). |
| 6082 |
|
| 6083 |
declare |
| 6084 |
Close_Ch : Character; |
| 6085 |
Key : ARM_Index.Index_Key; |
| 6086 |
Kind : ARM_Database.Paragraph_Change_Kind_Type; |
| 6087 |
Our_Version : ARM_Contents.Change_Version_Type; |
| 6088 |
use type ARM_Database.Paragraph_Change_Kind_Type; |
| 6089 |
Local_Change : ARM_Output.Change_Type; |
| 6090 |
begin |
| 6091 |
if Format_Object.Glossary_Info.Active then |
| 6092 |
Ada.Text_IO.Put_Line (" ** Nested glossary entry on line " & ARM_Input.Line_String (Input_Object)); |
| 6093 |
-- else OK. |
| 6094 |
end if; |
| 6095 |
|
| 6096 |
Get_Change_Version (Is_First => True, |
| 6097 |
Version => Our_Version); |
| 6098 |
-- Read a parameter named "Version". |
| 6099 |
|
| 6100 |
Get_Change_Kind (Kind); |
| 6101 |
-- Read a parameter named "Kind". |
| 6102 |
|
| 6103 |
-- Setup glossary information for this command (now |
| 6104 |
-- that we know the above): |
| 6105 |
-- Note: Discriminants need to be static, so we have |
| 6106 |
-- to use the following brain-damaged initialization. |
| 6107 |
-- At least this lets us strip the number and message |
| 6108 |
-- information from Inserted and Deleted (which we |
| 6109 |
-- would have to do anyway). |
| 6110 |
case Kind is |
| 6111 |
when ARM_Database.Inserted | |
| 6112 |
ARM_Database.Inserted_Normal_Number => |
| 6113 |
Format_Object.Glossary_Info := |
| 6114 |
(Active => True, |
| 6115 |
Change_Kind => ARM_Database.Inserted, |
| 6116 |
Version => Our_Version, |
| 6117 |
Term => <>, -- Set below. |
| 6118 |
Term_Len => <>, -- Set below. |
| 6119 |
Add_to_Glossary => <>, -- Set below. |
| 6120 |
Displayed => <>); -- Set below. |
| 6121 |
when ARM_Database.Deleted | |
| 6122 |
ARM_Database.Deleted_Inserted_Number | |
| 6123 |
ARM_Database.Deleted_No_Delete_Message | |
| 6124 |
ARM_Database.Deleted_Inserted_Number_No_Delete_Message => |
| 6125 |
Format_Object.Glossary_Info := |
| 6126 |
(Active => True, |
| 6127 |
Change_Kind => ARM_Database.Deleted, |
| 6128 |
Version => Our_Version, |
| 6129 |
Term => <>, -- Set below. |
| 6130 |
Term_Len => <>, -- Set below. |
| 6131 |
Add_to_Glossary => <>, -- Set below. |
| 6132 |
Displayed => <>); -- Set below. |
| 6133 |
when ARM_Database.Revised => |
| 6134 |
Format_Object.Glossary_Info := |
| 6135 |
(Active => True, |
| 6136 |
Change_Kind => ARM_Database.Revised, |
| 6137 |
Version => Our_Version, |
| 6138 |
Term => <>, -- Set below. |
| 6139 |
Term_Len => <>, -- Set below. |
| 6140 |
Add_to_Glossary => <>, -- Set below. |
| 6141 |
Displayed => <>); -- Set below. |
| 6142 |
when ARM_Database.Revised_Inserted_Number => |
| 6143 |
Format_Object.Glossary_Info := |
| 6144 |
(Active => True, |
| 6145 |
Change_Kind => ARM_Database.Revised_Inserted_Number, |
| 6146 |
Version => Our_Version, |
| 6147 |
Term => <>, -- Set below. |
| 6148 |
Term_Len => <>, -- Set below. |
| 6149 |
Add_to_Glossary => <>, -- Set below. |
| 6150 |
Displayed => <>); -- Set below. |
| 6151 |
when ARM_Database.None => |
| 6152 |
raise Program_Error; -- Can't happen. |
| 6153 |
end case; |
| 6154 |
|
| 6155 |
if Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Command = Change_To_Glossary_Also then |
| 6156 |
-- The text just goes straight to the file. It will |
| 6157 |
-- get formatted appropriately. So we only need to |
| 6158 |
-- figure out whether it will get indexed and displayed |
| 6159 |
-- in the Glossary. |
| 6160 |
Format_Object.Glossary_Info.Displayed := True; |
| 6161 |
Local_Change := ARM_Output.None; |
| 6162 |
if Format_Object.Changes = ARM_Format.Old_Only and then |
| 6163 |
Format_Object.Glossary_Info.Version > '0' then |
| 6164 |
-- Old only, don't display it (and it won't be |
| 6165 |
-- inserted, either). |
| 6166 |
Format_Object.Glossary_Info.Add_to_Glossary := False; |
| 6167 |
elsif Format_Object.Glossary_Info.Change_Kind = ARM_Database.Inserted then |
| 6168 |
if Format_Object.Glossary_Info.Version <= Format_Object.Change_Version then |
| 6169 |
Format_Object.Glossary_Info.Add_to_Glossary := True; |
| 6170 |
else --This reference is too new, ignore it. |
| 6171 |
Format_Object.Glossary_Info.Displayed := False; |
| 6172 |
Format_Object.Glossary_Info.Add_to_Glossary := False; |
| 6173 |
end if; |
| 6174 |
elsif Format_Object.Glossary_Info.Change_Kind = ARM_Database.Deleted then |
| 6175 |
Format_Object.Glossary_Info.Add_to_Glossary := True; |
| 6176 |
else -- we always display it. |
| 6177 |
Format_Object.Glossary_Info.Add_to_Glossary := True; |
| 6178 |
end if; |
| 6179 |
else |
| 6180 |
if Format_Object.Glossary_Info.Change_Kind = ARM_Database.Inserted then |
| 6181 |
Calc_Change_Disposition |
| 6182 |
(Format_Object => Format_Object, |
| 6183 |
Version => Format_Object.Glossary_Info.Version, |
| 6184 |
Operation => ARM_Output.Insertion, |
| 6185 |
Text_Kind => Local_Change); |
| 6186 |
case Local_Change is |
| 6187 |
when Do_Not_Display_Text => |
| 6188 |
Format_Object.Glossary_Info.Displayed := False; |
| 6189 |
Format_Object.Glossary_Info.Add_to_Glossary := False; |
| 6190 |
Local_Change := ARM_Output.None; |
| 6191 |
when ARM_Output.None|ARM_Output.Insertion => |
| 6192 |
Format_Object.Glossary_Info.Displayed := |
| 6193 |
Format_Object.Include_Annotations; |
| 6194 |
Format_Object.Glossary_Info.Add_to_Glossary := True; |
| 6195 |
when ARM_Output.Deletion => |
| 6196 |
raise Program_Error; |
| 6197 |
end case; |
| 6198 |
elsif Format_Object.Glossary_Info.Change_Kind = ARM_Database.Deleted then |
| 6199 |
-- Note: other forms of delete removed previously. |
| 6200 |
Calc_Change_Disposition |
| 6201 |
(Format_Object => Format_Object, |
| 6202 |
Version => Format_Object.Glossary_Info.Version, |
| 6203 |
Operation => ARM_Output.Deletion, |
| 6204 |
Text_Kind => Local_Change); |
| 6205 |
case Local_Change is |
| 6206 |
when Do_Not_Display_Text => |
| 6207 |
Format_Object.Glossary_Info.Displayed := False; |
| 6208 |
Format_Object.Glossary_Info.Add_to_Glossary := True; |
| 6209 |
-- We still add this to the glossary so that |
| 6210 |
-- the deleted paragraph message can be displayed for it. |
| 6211 |
Local_Change := ARM_Output.None; |
| 6212 |
when ARM_Output.None|ARM_Output.Deletion => |
| 6213 |
Format_Object.Glossary_Info.Displayed := |
| 6214 |
Format_Object.Include_Annotations; |
| 6215 |
Format_Object.Glossary_Info.Add_to_Glossary := True; |
| 6216 |
when ARM_Output.Insertion => |
| 6217 |
raise Program_Error; |
| 6218 |
end case; |
| 6219 |
else -- we always display it. |
| 6220 |
Format_Object.Glossary_Info.Displayed := |
| 6221 |
Format_Object.Include_Annotations; |
| 6222 |
Format_Object.Glossary_Info.Add_to_Glossary := True; |
| 6223 |
Local_Change := ARM_Output.None; |
| 6224 |
end if; |
| 6225 |
end if; |
| 6226 |
|
| 6227 |
ARM_Input.Check_Parameter_Name (Input_Object, |
| 6228 |
Param_Name => "Term" & (5..ARM_Input.Command_Name_Type'Last => ' '), |
| 6229 |
Is_First => False, |
| 6230 |
Param_Close_Bracket => Close_Ch); |
| 6231 |
if Close_Ch /= ' ' then |
| 6232 |
-- Copy the term: |
| 6233 |
ARM_Input.Copy_to_String_until_Close_Char ( |
| 6234 |
Input_Object, |
| 6235 |
Close_Ch, |
| 6236 |
Format_Object.Glossary_Info.Term, |
| 6237 |
Format_Object.Glossary_Info.Term_Len); |
| 6238 |
-- else no parameter. Weird. |
| 6239 |
end if; |
| 6240 |
|
| 6241 |
ARM_Input.Check_Parameter_Name (Input_Object, |
| 6242 |
Param_Name => "Text" & (5..ARM_Input.Command_Name_Type'Last => ' '), |
| 6243 |
Is_First => False, |
| 6244 |
Param_Close_Bracket => Close_Ch); |
| 6245 |
if Close_Ch /= ' ' then |
| 6246 |
-- Now, handle the parameter: |
| 6247 |
-- Stack it so we can process the end: |
| 6248 |
Set_Nesting_for_Parameter |
| 6249 |
(Command => Glossary_Text_Param, |
| 6250 |
Close_Ch => Close_Ch); |
| 6251 |
|
| 6252 |
ARM_Input.Start_Recording (Input_Object); |
| 6253 |
|
| 6254 |
if Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr-1).Command = Change_To_Glossary_Also then |
| 6255 |
-- The text just goes straight to the file. |
| 6256 |
if Format_Object.Glossary_Info.Add_to_Glossary then |
| 6257 |
if Format_Object.Display_Index_Entries then |
| 6258 |
Display_Index_Entry (Format_Object.Glossary_Info.Term (1..Format_Object.Glossary_Info.Term_Len)); -- Includes Check_Paragraph. |
| 6259 |
ARM_Output.Ordinary_Text (Output_Object, |
| 6260 |
"[Glossary Entry]"); |
| 6261 |
Format_Object.Last_Non_Space := True; |
| 6262 |
-- else no marker. |
| 6263 |
end if; |
| 6264 |
|
| 6265 |
-- Index the term (because it does appear here): |
| 6266 |
Check_Paragraph; -- We've got to be in a paragraph to write this. |
| 6267 |
ARM_Index.Add (Term => Format_Object.Glossary_Info.Term (1..Format_Object.Glossary_Info.Term_Len), |
| 6268 |
Kind => ARM_Index.Primary_Term, |
| 6269 |
Clause => Clause_String (Format_Object), |
| 6270 |
Paragraph => Paragraph_String, |
| 6271 |
Key => Key); |
| 6272 |
ARM_Output.Index_Target (Output_Object, Key); |
| 6273 |
-- else no indexing. |
| 6274 |
end if; |
| 6275 |
elsif Format_Object.Glossary_Info.Displayed then -- Change_To_Glossary |
| 6276 |
-- Create the AARM annotation: |
| 6277 |
Check_End_Paragraph; -- End any paragraph that we're in. |
| 6278 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Old_Last_Subhead_Paragraph := Format_Object.Last_Paragraph_Subhead_Type; |
| 6279 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Old_Next_Subhead_Paragraph := Format_Object.Next_Paragraph_Subhead_Type; |
| 6280 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Old_Next_Paragraph_Format := Format_Object.Next_Paragraph_Format_Type; |
| 6281 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Old_Tab_Stops := Format_Object.Paragraph_Tab_Stops; |
| 6282 |
Format_Object.Next_Paragraph_Format_Type := Glossary_Marker; |
| 6283 |
Format_Object.Next_Paragraph_Subhead_Type := Glossary_Marker; |
| 6284 |
Format_Object.Paragraph_Tab_Stops := ARM_Output.NO_TABS; |
| 6285 |
Format_Object.Next_Paragraph_Version := Format_Object.Glossary_Info.Version; |
| 6286 |
Format_Object.Next_Paragraph_Change_Kind := Kind; |
| 6287 |
|
| 6288 |
-- We assume no outer changes; |
| 6289 |
-- set new change state: |
| 6290 |
Format_Object.Text_Format.Change := Local_Change; |
| 6291 |
Format_Object.Text_Format.Version := |
| 6292 |
Format_Object.Glossary_Info.Version; |
| 6293 |
Format_Object.Text_Format.Added_Version := '0'; |
| 6294 |
-- Change the state *before* outputting the |
| 6295 |
-- paragraph header, so the AARM prefix is included. |
| 6296 |
Display_Index_Entry (Format_Object.Glossary_Info.Term (1..Format_Object.Glossary_Info.Term_Len)); -- Includes Check_Paragraph. |
| 6297 |
|
| 6298 |
Format_Object.Text_Format.Change := ARM_Output.None; -- Undo (header) change. |
| 6299 |
Format_Object.Text_Format.Version := '0'; |
| 6300 |
|
| 6301 |
elsif Format_Object.Glossary_Info.Add_to_Glossary then -- Change_To_Glossary |
| 6302 |
-- No AARM annotation: |
| 6303 |
if Format_Object.Display_Index_Entries then |
| 6304 |
Display_Index_Entry (Format_Object.Glossary_Info.Term (1..Format_Object.Glossary_Info.Term_Len)); -- Includes Check_Paragraph. |
| 6305 |
ARM_Output.Ordinary_Text (Output_Object, |
| 6306 |
"[Glossary Entry]"); |
| 6307 |
Format_Object.Last_Non_Space := True; |
| 6308 |
-- else no marker. |
| 6309 |
end if; |
| 6310 |
-- Skip the text: |
| 6311 |
ARM_Input.Skip_until_Close_Char (Input_Object, |
| 6312 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Close_Char); |
| 6313 |
ARM_Input.Replace_Char (Input_Object); -- Let the normal termination clean this up. |
| 6314 |
|
| 6315 |
-- Note: The term is indexed in the glossary, |
| 6316 |
-- but not here. |
| 6317 |
else |
| 6318 |
-- Skip the text (it won't be used at all): |
| 6319 |
ARM_Input.Skip_until_Close_Char (Input_Object, |
| 6320 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Close_Char); |
| 6321 |
ARM_Input.Replace_Char (Input_Object); -- Let the normal termination clean this up. |
| 6322 |
end if; |
| 6323 |
end if; |
| 6324 |
end; |
| 6325 |
|
| 6326 |
when Implementation_Defined => |
| 6327 |
-- Store an "implementation-defined" entry for the parameter; |
| 6328 |
-- also save the clause and paragraph reference. |
| 6329 |
|
| 6330 |
ARM_Input.Start_Recording (Input_Object); |
| 6331 |
|
| 6332 |
if Format_Object.Impdef_Info.Command /= None then |
| 6333 |
Ada.Text_IO.Put_Line (" ** Nested impdef entry on line " & ARM_Input.Line_String (Input_Object)); |
| 6334 |
-- else OK. |
| 6335 |
end if; |
| 6336 |
-- Setup impdef information for this command: |
| 6337 |
Format_Object.Impdef_Info := |
| 6338 |
(Command => Impdef, |
| 6339 |
Change_Kind => ARM_Database.None, |
| 6340 |
Version => '0', |
| 6341 |
Initial_Version => '0', |
| 6342 |
Add_to_DB => True, -- Until we decide differently. |
| 6343 |
Paragraph_String => <>, -- Set below. |
| 6344 |
Paragraph_Len => <>);-- Set below. |
| 6345 |
|
| 6346 |
if Format_Object.In_Paragraph then |
| 6347 |
-- Do this to preserve any inserted paragraph info. |
| 6348 |
Format_Object.Impdef_Info.Paragraph_String := |
| 6349 |
Format_Object.Current_Paragraph_String; |
| 6350 |
Format_Object.Impdef_Info.Paragraph_Len := |
| 6351 |
Format_Object.Current_Paragraph_Len; |
| 6352 |
else |
| 6353 |
declare |
| 6354 |
PNum : constant String := Positive'Image ( |
| 6355 |
Format_Object.Next_Paragraph - 1); |
| 6356 |
begin |
| 6357 |
Format_Object.Impdef_Info.Paragraph_Len := PNum'Length - 1; |
| 6358 |
Format_Object.Impdef_Info.Paragraph_String (1 .. PNum'Last-1) := |
| 6359 |
PNum (2 .. PNum'Last); |
| 6360 |
end; |
| 6361 |
end if; |
| 6362 |
|
| 6363 |
if Format_Object.Include_Annotations then |
| 6364 |
Check_End_Paragraph; -- End any paragraph that we're in. |
| 6365 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Old_Last_Subhead_Paragraph := Format_Object.Last_Paragraph_Subhead_Type; |
| 6366 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Old_Next_Subhead_Paragraph := Format_Object.Next_Paragraph_Subhead_Type; |
| 6367 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Old_Next_Paragraph_Format := Format_Object.Next_Paragraph_Format_Type; |
| 6368 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Old_Tab_Stops := Format_Object.Paragraph_Tab_Stops; |
| 6369 |
Format_Object.Next_Paragraph_Format_Type := Bare_Annotation; |
| 6370 |
Format_Object.Next_Paragraph_Subhead_Type := Bare_Annotation; |
| 6371 |
Format_Object.Paragraph_Tab_Stops := ARM_Output.NO_TABS; |
| 6372 |
Check_Paragraph; |
| 6373 |
declare |
| 6374 |
Bold_Format : ARM_Output.Format_Type := |
| 6375 |
Format_Object.Text_Format; |
| 6376 |
begin |
| 6377 |
Bold_Format.Bold := True; -- Change only the boldface. |
| 6378 |
ARM_Output.Text_Format (Output_Object, |
| 6379 |
Bold_Format); |
| 6380 |
end; |
| 6381 |
ARM_Output.Ordinary_Text (Output_Object, |
| 6382 |
Text => "Implementation defined: "); |
| 6383 |
ARM_Output.Text_Format (Output_Object, |
| 6384 |
Format_Object.Text_Format); -- Reset style. |
| 6385 |
Format_Object.Last_Paragraph_Subhead_Type := Bare_Annotation; |
| 6386 |
Format_Object.Last_Non_Space := False; |
| 6387 |
else -- No annotations |
| 6388 |
-- Skip the text: |
| 6389 |
ARM_Input.Skip_until_Close_Char (Input_Object, |
| 6390 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Close_Char); |
| 6391 |
ARM_Input.Replace_Char (Input_Object); -- Let the normal termination clean this up. |
| 6392 |
end if; |
| 6393 |
|
| 6394 |
when Prefix_Type => |
| 6395 |
-- Copy the text into the Format_Object.Prefix_Text string. |
| 6396 |
Check_Paragraph; |
| 6397 |
ARM_Input.Start_Recording (Input_Object); |
| 6398 |
-- No changes in this version (use ChgAttribute if you need that). |
| 6399 |
Format_Object.Attr_Prefix_Change_Kind := ARM_Database.None; |
| 6400 |
Format_Object.Attr_Prefix_Version := '0'; |
| 6401 |
|
| 6402 |
when Reset_Prefix_Type => |
| 6403 |
-- Set Format_Object.Prefix_Text string to the default. |
| 6404 |
Format_Object.Prefix_Text := "@b{NONE!}" & (10..MAX_PREFIX => ' '); |
| 6405 |
Format_Object.Prefix_Text_Len := 9; |
| 6406 |
|
| 6407 |
when Attribute | Attribute_Leading => |
| 6408 |
-- @Attribute{Prefix=<Prefix>,AttrName=<Name>,Text=<Text>} |
| 6409 |
-- Defines an attribute. Creates a hanging text item <Prefix>'<Name>, |
| 6410 |
-- with the specified text. The text can contain arbitrary commands; |
| 6411 |
-- it will be run through the full evaluation code. |
| 6412 |
-- The attribute and text is also sent to a database used to later create |
| 6413 |
-- Annex K. (This uses the current value of PrefixType.) Finally, the |
| 6414 |
-- attribute <Name> is indexed as by calling @Defn2{Term=[Attribute], |
| 6415 |
-- Sec=<Name>}, and as by calling @Defn{<Name> attribute}. |
| 6416 |
declare |
| 6417 |
Close_Ch : Character; |
| 6418 |
Key : ARM_Index.Index_Key; |
| 6419 |
begin |
| 6420 |
Check_End_Paragraph; -- This is always a paragraph end. |
| 6421 |
|
| 6422 |
-- No changes in this version (use ChgAttribute if you need that). |
| 6423 |
Format_Object.Attr_Change_Kind := ARM_Database.None; |
| 6424 |
Format_Object.Attr_Version := '0'; |
| 6425 |
Format_Object.Attr_Initial_Version := '0'; |
| 6426 |
|
| 6427 |
ARM_Input.Check_Parameter_Name (Input_Object, |
| 6428 |
Param_Name => "Prefix" & (7..ARM_Input.Command_Name_Type'Last => ' '), |
| 6429 |
Is_First => True, |
| 6430 |
Param_Close_Bracket => Close_Ch); |
| 6431 |
if Close_Ch /= ' ' then |
| 6432 |
-- Save prefix: |
| 6433 |
ARM_Input.Copy_to_String_until_Close_Char ( |
| 6434 |
Input_Object, |
| 6435 |
Close_Ch, |
| 6436 |
Format_Object.Attr_Prefix, |
| 6437 |
Format_Object.Attr_Prefix_Len); |
| 6438 |
-- else no parameter. Weird. |
| 6439 |
end if; |
| 6440 |
|
| 6441 |
ARM_Input.Check_Parameter_Name (Input_Object, |
| 6442 |
Param_Name => "AttrName" & (9..ARM_Input.Command_Name_Type'Last => ' '), |
| 6443 |
Is_First => False, |
| 6444 |
Param_Close_Bracket => Close_Ch); |
| 6445 |
if Close_Ch /= ' ' then |
| 6446 |
-- Save name: |
| 6447 |
ARM_Input.Copy_to_String_until_Close_Char ( |
| 6448 |
Input_Object, |
| 6449 |
Close_Ch, |
| 6450 |
Format_Object.Attr_Name, |
| 6451 |
Format_Object.Attr_Name_Len); |
| 6452 |
-- else no parameter. Weird. |
| 6453 |
end if; |
| 6454 |
|
| 6455 |
-- Output <Prefix>'<Name> as the hanging text. |
| 6456 |
if Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Command = Attribute_Leading then |
| 6457 |
Format_Object.Space_After := ARM_Output.Narrow; |
| 6458 |
Format_Object.Attr_Leading := True; |
| 6459 |
else |
| 6460 |
Format_Object.Space_After := ARM_Output.Normal; |
| 6461 |
Format_Object.Attr_Leading := False; |
| 6462 |
end if; |
| 6463 |
Check_Paragraph; |
| 6464 |
ARM_Output.Ordinary_Text (Output_Object, |
| 6465 |
Format_Object.Attr_Prefix (1 .. Format_Object.Attr_Prefix_Len)); |
| 6466 |
ARM_Output.Ordinary_Character (Output_Object, '''); |
| 6467 |
ARM_Output.Ordinary_Text (Output_Object, |
| 6468 |
Format_Object.Attr_Name (1 .. Format_Object.Attr_Name_Len)); |
| 6469 |
ARM_Output.End_Hang_Item (Output_Object); |
| 6470 |
Format_Object.Last_Non_Space := False; -- Treat like start of a line. |
| 6471 |
|
| 6472 |
ARM_Index.Add (Term => "attributes", |
| 6473 |
Subterm => Format_Object.Attr_Name (1 .. Format_Object.Attr_Name_Len), |
| 6474 |
Kind => ARM_Index.Primary_Term_and_Subterm, |
| 6475 |
Clause => Clause_String (Format_Object), |
| 6476 |
Paragraph => Paragraph_String, |
| 6477 |
Key => Key); |
| 6478 |
ARM_Output.Index_Target (Output_Object, Key); |
| 6479 |
|
| 6480 |
ARM_Index.Add (Term => Format_Object.Attr_Name (1 .. Format_Object.Attr_Name_Len) & " attribute", |
| 6481 |
Kind => ARM_Index.Primary_Term, |
| 6482 |
Clause => Clause_String (Format_Object), |
| 6483 |
Paragraph => Paragraph_String, |
| 6484 |
Key => Key); |
| 6485 |
ARM_Output.Index_Target (Output_Object, Key); |
| 6486 |
|
| 6487 |
ARM_Input.Check_Parameter_Name (Input_Object, |
| 6488 |
Param_Name => "Text" & (5..ARM_Input.Command_Name_Type'Last => ' '), |
| 6489 |
Is_First => False, |
| 6490 |
Param_Close_Bracket => Close_Ch); |
| 6491 |
if Close_Ch /= ' ' then |
| 6492 |
-- Now, handle the parameter: |
| 6493 |
-- The text goes to the file *and* is recorded. |
| 6494 |
Arm_Input.Start_Recording (Input_Object); |
| 6495 |
-- Stack the parameter so we can process the end: |
| 6496 |
Set_Nesting_for_Parameter |
| 6497 |
(Command => Attribute_Text_Param, |
| 6498 |
Close_Ch => Close_Ch); |
| 6499 |
end if; |
| 6500 |
end; |
| 6501 |
|
| 6502 |
when Pragma_Syntax => |
| 6503 |
-- @PragmaSyntax{<Text>} |
| 6504 |
-- Defines a pragma. The text can contain arbitrary commands; |
| 6505 |
-- it will be run through the full evaluation code. |
| 6506 |
-- The text is also sent to a database used to later create |
| 6507 |
-- Annex L. |
| 6508 |
-- Note that these are indented slightly more than regular |
| 6509 |
-- syntax text. We handle that by adding a couple of |
| 6510 |
-- spaces before the text. |
| 6511 |
|
| 6512 |
--Ada.Text_IO.Put_Line ("%% Pragma - normal initialization."); |
| 6513 |
-- All we have to do here is output a couple of |
| 6514 |
-- hard spaces and then start recording. |
| 6515 |
Check_Paragraph; |
| 6516 |
ARM_Output.Hard_Space (Output_Object); |
| 6517 |
ARM_Output.Hard_Space (Output_Object); |
| 6518 |
ARM_Input.Start_Recording (Input_Object); |
| 6519 |
-- Just handle the text normally. |
| 6520 |
|
| 6521 |
when Added_Pragma_Syntax => |
| 6522 |
-- @AddedPragmaSyntax{Version=[<Version>],<Text>} |
| 6523 |
-- Defines a pragma. The text can contain arbitrary commands; |
| 6524 |
-- it will be run through the full evaluation code. |
| 6525 |
-- The text is also sent to a database used to later create |
| 6526 |
-- Annex L. |
| 6527 |
-- Note that these are indented slightly more than regular |
| 6528 |
-- syntax text. We handle that by adding a couple of |
| 6529 |
-- spaces before the text. |
| 6530 |
|
| 6531 |
declare |
| 6532 |
Ch : Character; |
| 6533 |
Version : ARM_Contents.Change_Version_Type := '0'; |
| 6534 |
|
| 6535 |
Disposition : ARM_Output.Change_Type; |
| 6536 |
use type ARM_Output.Change_Type; |
| 6537 |
begin |
| 6538 |
Get_Change_Version (Is_First => True, |
| 6539 |
Version => Version); |
| 6540 |
ARM_Input.Get_Char (Input_Object, Ch); |
| 6541 |
if Ch /= ',' then |
| 6542 |
Ada.Text_IO.Put_Line (" ** Missing comma for AddedPragmaSyn on line " & ARM_Input.Line_String (Input_Object)); |
| 6543 |
ARM_Input.Replace_Char (Input_Object); |
| 6544 |
end if; |
| 6545 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Change_Version := Version; |
| 6546 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Prev_Change_Version := Version; -- Don't have or need an InitialVersion parameter. |
| 6547 |
|
| 6548 |
Calc_Change_Disposition ( |
| 6549 |
Format_Object => Format_Object, |
| 6550 |
Version => Version, |
| 6551 |
Operation => ARM_Output.Insertion, |
| 6552 |
Text_Kind => Disposition); |
| 6553 |
|
| 6554 |
-- All we have to do here is output a couple of |
| 6555 |
-- hard spaces (if anything will be displayed) and then |
| 6556 |
-- start recording. The inner @Chg will handle the |
| 6557 |
-- formatting for this. |
| 6558 |
--Ada.Text_IO.Put_Line ("%% Added pragma."); |
| 6559 |
Check_Paragraph; |
| 6560 |
if Disposition /= Do_Not_Display_Text then |
| 6561 |
ARM_Output.Hard_Space (Output_Object); |
| 6562 |
ARM_Output.Hard_Space (Output_Object); |
| 6563 |
-- else nothing to display. |
| 6564 |
end if; |
| 6565 |
ARM_Input.Start_Recording (Input_Object); |
| 6566 |
-- Just handle the text normally. |
| 6567 |
end; |
| 6568 |
|
| 6569 |
when Deleted_Pragma_Syntax => |
| 6570 |
-- @DeletedPragmaSyntax{Version=[<Version>],InitialVersion=[<InitialVersion>],<Text>} |
| 6571 |
-- Defines a pragma. The text can contain arbitrary commands; |
| 6572 |
-- it will be run through the full evaluation code. |
| 6573 |
-- The text is also sent to a database used to later create |
| 6574 |
-- Annex L. |
| 6575 |
-- Note that these are indented slightly more than regular |
| 6576 |
-- syntax text. We handle that by adding a couple of |
| 6577 |
-- spaces before the text. |
| 6578 |
|
| 6579 |
declare |
| 6580 |
Close_Ch, Ch : Character; |
| 6581 |
Version : ARM_Contents.Change_Version_Type := '0'; |
| 6582 |
Initial_Version : ARM_Contents.Change_Version_Type := '0'; |
| 6583 |
|
| 6584 |
Disposition : ARM_Output.Change_Type; |
| 6585 |
use type ARM_Output.Change_Type; |
| 6586 |
begin |
| 6587 |
Get_Change_Version (Is_First => True, |
| 6588 |
Version => Version); |
| 6589 |
|
| 6590 |
-- Now, get InitialVersion. |
| 6591 |
ARM_Input.Check_Parameter_Name (Input_Object, |
| 6592 |
Param_Name => "InitialVersion" & (15..ARM_Input.Command_Name_Type'Last => ' '), |
| 6593 |
Is_First => False, |
| 6594 |
Param_Close_Bracket => Close_Ch); |
| 6595 |
|
| 6596 |
ARM_Input.Get_Char (Input_Object, Initial_Version); |
| 6597 |
ARM_Input.Get_Char (Input_Object, Ch); |
| 6598 |
if Ch /= Close_Ch then |
| 6599 |
Ada.Text_IO.Put_Line (" ** Bad close for InitialVersion parameter on line " & |
| 6600 |
ARM_Input.Line_String (Input_Object)); |
| 6601 |
ARM_Input.Replace_Char (Input_Object); |
| 6602 |
end if; |
| 6603 |
|
| 6604 |
ARM_Input.Get_Char (Input_Object, Ch); |
| 6605 |
if Ch /= ',' then |
| 6606 |
Ada.Text_IO.Put_Line (" ** Missing comma for AddedPragmaSyn on line " & ARM_Input.Line_String (Input_Object)); |
| 6607 |
ARM_Input.Replace_Char (Input_Object); |
| 6608 |
end if; |
| 6609 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Change_Version := Version; |
| 6610 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Prev_Change_Version := Initial_Version; |
| 6611 |
|
| 6612 |
Calc_Change_Disposition ( |
| 6613 |
Format_Object => Format_Object, |
| 6614 |
Version => Version, |
| 6615 |
Operation => ARM_Output.Deletion, |
| 6616 |
Text_Kind => Disposition); |
| 6617 |
|
| 6618 |
--Ada.Text_IO.Put_Line ("%% Deleted pragma."); |
| 6619 |
-- All we have to do here is output a couple of |
| 6620 |
-- hard spaces (if anything will be displayed) and then |
| 6621 |
-- start recording. The inner @Chg will handle the |
| 6622 |
-- formatting for this. |
| 6623 |
Check_Paragraph; |
| 6624 |
if Disposition /= Do_Not_Display_Text then |
| 6625 |
ARM_Output.Hard_Space (Output_Object); |
| 6626 |
ARM_Output.Hard_Space (Output_Object); |
| 6627 |
-- else nothing to display. |
| 6628 |
end if; |
| 6629 |
ARM_Input.Start_Recording (Input_Object); |
| 6630 |
-- Just handle the text normally. |
| 6631 |
end; |
| 6632 |
|
| 6633 |
-- Clause title and reference commands: |
| 6634 |
|
| 6635 |
when Labeled_Section | Labeled_Section_No_Break | |
| 6636 |
Labeled_Annex | Labeled_Informative_Annex | |
| 6637 |
Labeled_Normative_Annex | Labeled_Clause | |
| 6638 |
Labeled_Subclause | Labeled_Subsubclause | |
| 6639 |
Unnumbered_Section => |
| 6640 |
-- Load the title into the Title string: |
| 6641 |
declare |
| 6642 |
Title : ARM_Contents.Title_Type; |
| 6643 |
Title_Length : Natural; |
| 6644 |
Level : ARM_Contents.Level_Type; |
| 6645 |
begin |
| 6646 |
ARM_Input.Copy_to_String_until_Close_Char ( |
| 6647 |
Input_Object, |
| 6648 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Close_Char, |
| 6649 |
Title, Title_Length); |
| 6650 |
if Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Command = Labeled_Subclause then |
| 6651 |
Format_Object.Clause_Number := |
| 6652 |
(Section => Format_Object.Clause_Number.Section, |
| 6653 |
Clause => Format_Object.Clause_Number.Clause, |
| 6654 |
Subclause => Format_Object.Clause_Number.Subclause + 1, |
| 6655 |
Subsubclause => 0); |
| 6656 |
Level := ARM_Contents.Subclause; |
| 6657 |
elsif Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Command = Labeled_Subsubclause then |
| 6658 |
Format_Object.Clause_Number.Subsubclause := |
| 6659 |
Format_Object.Clause_Number.Subsubclause + 1; |
| 6660 |
Level := ARM_Contents.Subsubclause; |
| 6661 |
elsif Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Command = Labeled_Clause then |
| 6662 |
Format_Object.Clause_Number := |
| 6663 |
(Section => Format_Object.Clause_Number.Section, |
| 6664 |
Clause => Format_Object.Clause_Number.Clause + 1, |
| 6665 |
Subclause => 0, Subsubclause => 0); |
| 6666 |
Level := ARM_Contents.Clause; |
| 6667 |
elsif Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Command = Unnumbered_Section then |
| 6668 |
Format_Object.Unnumbered_Section := |
| 6669 |
Format_Object.Unnumbered_Section + 1; |
| 6670 |
Format_Object.Clause_Number := |
| 6671 |
(Section => 0, |
| 6672 |
Clause => Format_Object.Unnumbered_Section, |
| 6673 |
Subclause => 0, Subsubclause => 0); |
| 6674 |
Level := ARM_Contents.Unnumbered_Section; |
| 6675 |
elsif Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Command = Labeled_Section or else |
| 6676 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Command = Labeled_Section_No_Break then |
| 6677 |
Format_Object.Clause_Number := |
| 6678 |
(Section => Format_Object.Clause_Number.Section, -- Will be set elsewhere. |
| 6679 |
Clause => 0, |
| 6680 |
Subclause => 0, Subsubclause => 0); |
| 6681 |
Level := ARM_Contents.Section; |
| 6682 |
elsif Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Command = Labeled_Annex then |
| 6683 |
Format_Object.Clause_Number := |
| 6684 |
(Section => Format_Object.Clause_Number.Section, -- Will be set elsewhere. |
| 6685 |
Clause => 0, |
| 6686 |
Subclause => 0, Subsubclause => 0); |
| 6687 |
Level := ARM_Contents.Plain_Annex; |
| 6688 |
elsif Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Command = Labeled_Normative_Annex then |
| 6689 |
Format_Object.Clause_Number := |
| 6690 |
(Section => Format_Object.Clause_Number.Section, -- Will be set elsewhere. |
| 6691 |
Clause => 0, |
| 6692 |
Subclause => 0, Subsubclause => 0); |
| 6693 |
Level := ARM_Contents.Normative_Annex; |
| 6694 |
else -- Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Command = Labeled_Informative_Annex then |
| 6695 |
Format_Object.Clause_Number := |
| 6696 |
(Section => Format_Object.Clause_Number.Section, -- Will be set elsewhere. |
| 6697 |
Clause => 0, |
| 6698 |
Subclause => 0, Subsubclause => 0); |
| 6699 |
Level := ARM_Contents.Informative_Annex; |
| 6700 |
end if; |
| 6701 |
Title(Title_Length+1 .. Title'Last) := |
| 6702 |
(others => ' '); |
| 6703 |
|
| 6704 |
begin |
| 6705 |
declare |
| 6706 |
Clause_Number : constant String := |
| 6707 |
ARM_Contents.Lookup_Clause_Number (Title); |
| 6708 |
begin |
| 6709 |
Check_End_Paragraph; -- End any paragraph that we're in. |
| 6710 |
if Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Command = Labeled_Section_No_Break then |
| 6711 |
ARM_Output.Clause_Header (Output_Object, |
| 6712 |
Title(1..Title_Length), |
| 6713 |
Level => ARM_Contents.Section, |
| 6714 |
Clause_Number => Clause_Number, |
| 6715 |
No_Page_Break => True, |
| 6716 |
Top_Level_Subdivision_Name => Format_Object.Top_Level_Subdivision_Name); |
| 6717 |
|
| 6718 |
else -- Other cases: |
| 6719 |
ARM_Output.Clause_Header (Output_Object, |
| 6720 |
Title(1..Title_Length), |
| 6721 |
Level => Level, |
| 6722 |
Clause_Number => Clause_Number, |
| 6723 |
Top_Level_Subdivision_Name => Format_Object.Top_Level_Subdivision_Name); |
| 6724 |
end if; |
| 6725 |
-- Check that the section numbers match the title: |
| 6726 |
if Ada.Characters.Handling.To_Lower (Title) /= |
| 6727 |
Ada.Characters.Handling.To_Lower (ARM_Contents.Lookup_Title ( |
| 6728 |
Level, Format_Object.Clause_Number)) then |
| 6729 |
Ada.Text_IO.Put_Line ("** Unable to match title with section numbers, line " & ARM_Input.Line_String (Input_Object)); |
| 6730 |
end if; |
| 6731 |
--!!Debug: |
| 6732 |
--Ada.Text_IO.Put_Line ("Start clause " & Clause_Number & " -- " & Title(1..Title_Length)); |
| 6733 |
|
| 6734 |
end; |
| 6735 |
exception |
| 6736 |
when ARM_Contents.Not_Found_Error => |
| 6737 |
Ada.Text_IO.Put_Line ("** Unable to find header reference, line " & ARM_Input.Line_String (Input_Object)); |
| 6738 |
Ada.Text_IO.Put_Line (" Looking for " & Title(1..Title_Length)); |
| 6739 |
end; |
| 6740 |
end; |
| 6741 |
-- Reset the paragraph numbers: |
| 6742 |
Format_Object.Next_Paragraph := 1; |
| 6743 |
Format_Object.Next_Insert_Para := 1; |
| 6744 |
Format_Object.Next_AARM_Sub := 'a'; |
| 6745 |
if Format_Object.Use_ISO_2004_Note_Format then |
| 6746 |
-- Reset the note number: |
| 6747 |
Format_Object.Next_Note := 1; |
| 6748 |
elsif Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Command = Labeled_Section or else |
| 6749 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Command = Labeled_Section_No_Break or else |
| 6750 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Command = Labeled_Annex or else |
| 6751 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Command = Labeled_Informative_Annex or else |
| 6752 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Command = Labeled_Normative_Annex then |
| 6753 |
-- Reset the note number, only for sections: |
| 6754 |
Format_Object.Next_Note := 1; |
| 6755 |
end if; |
| 6756 |
-- Reset the subhead: |
| 6757 |
Format_Object.Last_Paragraph_Subhead_Type := Plain; |
| 6758 |
Format_Object.Next_Paragraph_Format_Type := Plain; |
| 6759 |
|
| 6760 |
Format_State.Nesting_Stack_Ptr := Format_State.Nesting_Stack_Ptr - 1; |
| 6761 |
--Ada.Text_IO.Put_Line (" &Unstack (Header)"); |
| 6762 |
|
| 6763 |
when Labeled_Revised_Annex | |
| 6764 |
Labeled_Revised_Informative_Annex | |
| 6765 |
Labeled_Revised_Normative_Annex | |
| 6766 |
Labeled_Revised_Section | |
| 6767 |
Labeled_Revised_Clause | |
| 6768 |
Labeled_Revised_Subclause | |
| 6769 |
Labeled_Revised_Subsubclause => |
| 6770 |
-- Load the title into the Title string: |
| 6771 |
declare |
| 6772 |
New_Title : ARM_Contents.Title_Type; |
| 6773 |
New_Title_Length : Natural; |
| 6774 |
Old_Title : ARM_Contents.Title_Type; |
| 6775 |
Old_Title_Length : Natural; |
| 6776 |
Close_Ch : Character; |
| 6777 |
Version : ARM_Contents.Change_Version_Type := '0'; |
| 6778 |
Initial_Version : ARM_Contents.Change_Version_Type := '0'; |
| 6779 |
Level : ARM_Contents.Level_Type; |
| 6780 |
begin |
| 6781 |
Get_Change_Version (Is_First => True, |
| 6782 |
Version => Version); |
| 6783 |
|
| 6784 |
-- Check for the optional "InitialVersion" parameter, |
| 6785 |
-- stopping when we reach "New": |
| 6786 |
declare |
| 6787 |
Which_Param : ARM_Input.Param_Num; |
| 6788 |
Ch : Character; |
| 6789 |
begin |
| 6790 |
-- If there is no InitialVersion command, use the same |
| 6791 |
-- version of the rest of the command. |
| 6792 |
loop |
| 6793 |
ARM_Input.Check_One_of_Parameter_Names (Input_Object, |
| 6794 |
Param_Name_1 => "InitialVersion" & (15..ARM_Input.Command_Name_Type'Last => ' '), |
| 6795 |
Param_Name_2 => "New" & (4..ARM_Input.Command_Name_Type'Last => ' '), |
| 6796 |
Is_First => False, |
| 6797 |
Param_Found => Which_Param, |
| 6798 |
Param_Close_Bracket => Close_Ch); |
| 6799 |
|
| 6800 |
if Which_Param = 1 and then Close_Ch /= ' ' then |
| 6801 |
-- Found InitialVersion |
| 6802 |
ARM_Input.Get_Char (Input_Object, Ch); |
| 6803 |
Initial_Version := Ch; |
| 6804 |
ARM_Input.Get_Char (Input_Object, Ch); |
| 6805 |
if Ch /= Close_Ch then |
| 6806 |
Ada.Text_IO.Put_Line (" ** Bad close for InitialVersion parameter on line " & |
| 6807 |
ARM_Input.Line_String (Input_Object)); |
| 6808 |
ARM_Input.Replace_Char (Input_Object); |
| 6809 |
end if; |
| 6810 |
else -- We found "New" (or an error) |
| 6811 |
exit; -- Handling of New is below. |
| 6812 |
end if; |
| 6813 |
end loop; |
| 6814 |
end; |
| 6815 |
|
| 6816 |
if Close_Ch /= ' ' then |
| 6817 |
-- There is a parameter: |
| 6818 |
-- Load the new title into the Title string: |
| 6819 |
ARM_Input.Copy_to_String_until_Close_Char ( |
| 6820 |
Input_Object, |
| 6821 |
Close_Ch, |
| 6822 |
New_Title, New_Title_Length); |
| 6823 |
New_Title(New_Title_Length+1 .. New_Title'Last) := |
| 6824 |
(others => ' '); |
| 6825 |
ARM_Input.Check_Parameter_Name (Input_Object, |
| 6826 |
Param_Name => "Old" & (4..ARM_Input.Command_Name_Type'Last => ' '), |
| 6827 |
Is_First => False, |
| 6828 |
Param_Close_Bracket => Close_Ch); |
| 6829 |
if Close_Ch /= ' ' then |
| 6830 |
-- There is a parameter: |
| 6831 |
-- Load the new title into the Title string: |
| 6832 |
ARM_Input.Copy_to_String_until_Close_Char ( |
| 6833 |
Input_Object, |
| 6834 |
Close_Ch, |
| 6835 |
Old_Title, Old_Title_Length); |
| 6836 |
Old_Title(Old_Title_Length+1 .. Old_Title'Last) := |
| 6837 |
(others => ' '); |
| 6838 |
end if; |
| 6839 |
end if; |
| 6840 |
ARM_Input.Get_Char (Input_Object, Close_Ch); |
| 6841 |
if Close_Ch /= Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Close_Char then |
| 6842 |
Ada.Text_IO.Put_Line (" ** Bad close for Labeled_Revised_(SubClause|Annex) on line " & ARM_Input.Line_String (Input_Object)); |
| 6843 |
ARM_Input.Replace_Char (Input_Object); |
| 6844 |
end if; |
| 6845 |
|
| 6846 |
if Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Command = Labeled_Revised_Subclause then |
| 6847 |
Format_Object.Clause_Number := |
| 6848 |
(Section => Format_Object.Clause_Number.Section, |
| 6849 |
Clause => Format_Object.Clause_Number.Clause, |
| 6850 |
Subclause => Format_Object.Clause_Number.Subclause + 1, |
| 6851 |
Subsubclause => 0); |
| 6852 |
Level := ARM_Contents.Subclause; |
| 6853 |
elsif Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Command = Labeled_Revised_Subsubclause then |
| 6854 |
Format_Object.Clause_Number.Subsubclause := |
| 6855 |
Format_Object.Clause_Number.Subsubclause + 1; |
| 6856 |
Level := ARM_Contents.Subsubclause; |
| 6857 |
elsif Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Command = Labeled_Revised_Clause then |
| 6858 |
Format_Object.Clause_Number := |
| 6859 |
(Section => Format_Object.Clause_Number.Section, |
| 6860 |
Clause => Format_Object.Clause_Number.Clause + 1, |
| 6861 |
Subclause => 0, Subsubclause => 0); |
| 6862 |
Level := ARM_Contents.Clause; |
| 6863 |
elsif Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Command = Labeled_Revised_Section then |
| 6864 |
Format_Object.Clause_Number := |
| 6865 |
(Section => Format_Object.Clause_Number.Section, -- Will be set elsewhere. |
| 6866 |
Clause => 0, |
| 6867 |
Subclause => 0, Subsubclause => 0); |
| 6868 |
Level := ARM_Contents.Section; |
| 6869 |
elsif Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Command = Labeled_Revised_Annex then |
| 6870 |
Format_Object.Clause_Number := |
| 6871 |
(Section => Format_Object.Clause_Number.Section, -- Will be set elsewhere. |
| 6872 |
Clause => 0, |
| 6873 |
Subclause => 0, Subsubclause => 0); |
| 6874 |
Level := ARM_Contents.Plain_Annex; |
| 6875 |
elsif Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Command = Labeled_Revised_Normative_Annex then |
| 6876 |
Format_Object.Clause_Number := |
| 6877 |
(Section => Format_Object.Clause_Number.Section, -- Will be set elsewhere. |
| 6878 |
Clause => 0, |
| 6879 |
Subclause => 0, Subsubclause => 0); |
| 6880 |
Level := ARM_Contents.Normative_Annex; |
| 6881 |
else -- Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Command = Labeled_Revised_Informative_Annex then |
| 6882 |
Format_Object.Clause_Number := |
| 6883 |
(Section => Format_Object.Clause_Number.Section, -- Will be set elsewhere. |
| 6884 |
Clause => 0, |
| 6885 |
Subclause => 0, Subsubclause => 0); |
| 6886 |
Level := ARM_Contents.Informative_Annex; |
| 6887 |
end if; |
| 6888 |
|
| 6889 |
begin |
| 6890 |
declare |
| 6891 |
Clause_Number : constant String := |
| 6892 |
ARM_Contents.Lookup_Clause_Number (New_Title); |
| 6893 |
|
| 6894 |
New_Disposition : ARM_Output.Change_Type; |
| 6895 |
Old_Disposition : ARM_Output.Change_Type; |
| 6896 |
use type ARM_Output.Change_Type; |
| 6897 |
begin |
| 6898 |
Check_End_Paragraph; -- End any paragraph that we're in. |
| 6899 |
-- Check that the section numbers match the title: |
| 6900 |
if Ada.Characters.Handling.To_Lower (New_Title) /= |
| 6901 |
Ada.Characters.Handling.To_Lower (ARM_Contents.Lookup_Title ( |
| 6902 |
Level, Format_Object.Clause_Number)) then |
| 6903 |
Ada.Text_IO.Put_Line ("** Unable to match title with section numbers, line " & ARM_Input.Line_String (Input_Object)); |
| 6904 |
end if; |
| 6905 |
|
| 6906 |
Calc_Change_Disposition ( |
| 6907 |
Format_Object => Format_Object, |
| 6908 |
Version => Version, |
| 6909 |
Operation => ARM_Output.Insertion, |
| 6910 |
Text_Kind => New_Disposition); |
| 6911 |
-- Note: We use insertion here because |
| 6912 |
-- we want to decide what to do with |
| 6913 |
-- the New part. |
| 6914 |
Calc_Change_Disposition ( |
| 6915 |
Format_Object => Format_Object, |
| 6916 |
Version => Initial_Version, |
| 6917 |
Operation => ARM_Output.Insertion, |
| 6918 |
Text_Kind => Old_Disposition); |
| 6919 |
|
| 6920 |
if New_Disposition = Do_Not_Display_Text then |
| 6921 |
if Old_Disposition = Do_Not_Display_Text then |
| 6922 |
null; -- Show nothing. |
| 6923 |
elsif Old_Disposition = ARM_Output.None then |
| 6924 |
-- Use the old only: |
| 6925 |
ARM_Output.Clause_Header (Output_Object, |
| 6926 |
Old_Title(1..Old_Title_Length), |
| 6927 |
Level => Level, |
| 6928 |
Clause_Number => Clause_Number, |
| 6929 |
Top_Level_Subdivision_Name => Format_Object.Top_Level_Subdivision_Name); |
| 6930 |
elsif Old_Disposition = ARM_Output.Deletion then |
| 6931 |
raise Program_Error; -- A deletion inside of an insertion command! |
| 6932 |
else -- an insertion of the Old. Show this like an added item: |
| 6933 |
ARM_Output.Revised_Clause_Header (Output_Object, |
| 6934 |
New_Header_Text => Old_Title(1..Old_Title_Length), |
| 6935 |
Old_Header_Text => "", |
| 6936 |
Level => Level, |
| 6937 |
Version => Initial_Version, |
| 6938 |
Old_Version => '0', |
| 6939 |
Clause_Number => Clause_Number, |
| 6940 |
Top_Level_Subdivision_Name => Format_Object.Top_Level_Subdivision_Name); |
| 6941 |
end if; |
| 6942 |
elsif New_Disposition = ARM_Output.None then |
| 6943 |
-- Use the new only: |
| 6944 |
ARM_Output.Clause_Header (Output_Object, |
| 6945 |
New_Title(1..New_Title_Length), |
| 6946 |
Level => Level, |
| 6947 |
Clause_Number => Clause_Number, |
| 6948 |
Top_Level_Subdivision_Name => Format_Object.Top_Level_Subdivision_Name); |
| 6949 |
-- In this case, we have no sane |
| 6950 |
-- way to show the old, so we hope that |
| 6951 |
-- isn't expected. |
| 6952 |
--!!Debug: |
| 6953 |
--Ada.Text_IO.Put_Line ("Start clause " & Clause_Number & " -- " & New_Title(1..New_Title_Length)); |
| 6954 |
elsif New_Disposition = ARM_Output.Deletion then |
| 6955 |
raise Program_Error; -- A deletion inside of an insertion command! |
| 6956 |
else -- Insertion. |
| 6957 |
if Format_Object.Changes = ARM_Format.New_Changes or else |
| 6958 |
Old_Disposition = Do_Not_Display_Text then |
| 6959 |
ARM_Output.Revised_Clause_Header (Output_Object, |
| 6960 |
New_Header_Text => New_Title(1..New_Title_Length), |
| 6961 |
Old_Header_Text => " ", |
| 6962 |
Level => Level, |
| 6963 |
Version => Version, |
| 6964 |
Old_Version => '0', |
| 6965 |
Clause_Number => Clause_Number, |
| 6966 |
Top_Level_Subdivision_Name => Format_Object.Top_Level_Subdivision_Name); |
| 6967 |
elsif Old_Disposition = ARM_Output.None then |
| 6968 |
-- Show old without any insertion marks: |
| 6969 |
ARM_Output.Revised_Clause_Header (Output_Object, |
| 6970 |
New_Header_Text => New_Title(1..New_Title_Length), |
| 6971 |
Old_Header_Text => Old_Title(1..Old_Title_Length), |
| 6972 |
Level => Level, |
| 6973 |
Version => Version, |
| 6974 |
Old_Version => '0', |
| 6975 |
Clause_Number => Clause_Number, |
| 6976 |
Top_Level_Subdivision_Name => Format_Object.Top_Level_Subdivision_Name); |
| 6977 |
elsif Old_Disposition = ARM_Output.Deletion then |
| 6978 |
raise Program_Error; -- A deletion inside of an insertion command! |
| 6979 |
else -- An insertion of the Old item: |
| 6980 |
ARM_Output.Revised_Clause_Header (Output_Object, |
| 6981 |
New_Header_Text => New_Title(1..New_Title_Length), |
| 6982 |
Old_Header_Text => Old_Title(1..Old_Title_Length), |
| 6983 |
Level => Level, |
| 6984 |
Version => Version, |
| 6985 |
Old_Version => Initial_Version, |
| 6986 |
Clause_Number => Clause_Number, |
| 6987 |
Top_Level_Subdivision_Name => Format_Object.Top_Level_Subdivision_Name); |
| 6988 |
end if; |
| 6989 |
--!!Debug: |
| 6990 |
--Ada.Text_IO.Put_Line ("Start clause " & Clause_Number & " -- " & New_Title(1..New_Title_Length)); |
| 6991 |
end if; |
| 6992 |
end; |
| 6993 |
exception |
| 6994 |
when ARM_Contents.Not_Found_Error => |
| 6995 |
Ada.Text_IO.Put_Line ("** Unable to find header reference, line " & ARM_Input.Line_String (Input_Object)); |
| 6996 |
Ada.Text_IO.Put_Line (" Looking for " & New_Title(1..New_Title_Length)); |
| 6997 |
end; |
| 6998 |
-- Reset the paragraph numbers: |
| 6999 |
Format_Object.Next_Paragraph := 1; |
| 7000 |
Format_Object.Next_Insert_Para := 1; |
| 7001 |
Format_Object.Next_AARM_Sub := 'a'; |
| 7002 |
if Format_Object.Use_ISO_2004_Note_Format then |
| 7003 |
-- Reset the note number: |
| 7004 |
Format_Object.Next_Note := 1; |
| 7005 |
elsif Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Command = Labeled_Revised_Section or else |
| 7006 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Command = Labeled_Revised_Annex or else |
| 7007 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Command = Labeled_Revised_Informative_Annex or else |
| 7008 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Command = Labeled_Revised_Normative_Annex then |
| 7009 |
-- Reset the note number, only for sections: |
| 7010 |
Format_Object.Next_Note := 1; |
| 7011 |
end if; |
| 7012 |
-- Reset the subhead: |
| 7013 |
Format_Object.Last_Paragraph_Subhead_Type := Plain; |
| 7014 |
Format_Object.Next_Paragraph_Format_Type := Plain; |
| 7015 |
|
| 7016 |
Format_State.Nesting_Stack_Ptr := Format_State.Nesting_Stack_Ptr - 1; |
| 7017 |
--Ada.Text_IO.Put_Line (" &Unstack (Header)"); |
| 7018 |
end; |
| 7019 |
|
| 7020 |
when Labeled_Added_Annex | |
| 7021 |
Labeled_Added_Informative_Annex | |
| 7022 |
Labeled_Added_Normative_Annex | |
| 7023 |
Labeled_Added_Section | |
| 7024 |
Labeled_Added_Clause | |
| 7025 |
Labeled_Added_Subclause | |
| 7026 |
Labeled_Added_Subsubclause => |
| 7027 |
-- Load the title into the Title string: |
| 7028 |
declare |
| 7029 |
New_Title : ARM_Contents.Title_Type; |
| 7030 |
New_Title_Length : Natural; |
| 7031 |
Ch : Character; |
| 7032 |
Version : ARM_Contents.Change_Version_Type := '0'; |
| 7033 |
Level : ARM_Contents.Level_Type; |
| 7034 |
Disposition : ARM_Output.Change_Type; |
| 7035 |
use type ARM_Output.Change_Type; |
| 7036 |
begin |
| 7037 |
Get_Change_Version (Is_First => True, |
| 7038 |
Version => Version); |
| 7039 |
ARM_Input.Check_Parameter_Name (Input_Object, |
| 7040 |
Param_Name => "Name" & (5..ARM_Input.Command_Name_Type'Last => ' '), |
| 7041 |
Is_First => False, |
| 7042 |
Param_Close_Bracket => Ch); |
| 7043 |
if Ch /= ' ' then |
| 7044 |
-- There is a parameter: |
| 7045 |
-- Load the new title into the Title string: |
| 7046 |
ARM_Input.Copy_to_String_until_Close_Char ( |
| 7047 |
Input_Object, |
| 7048 |
Ch, |
| 7049 |
New_Title, New_Title_Length); |
| 7050 |
New_Title(New_Title_Length+1 .. New_Title'Last) := |
| 7051 |
(others => ' '); |
| 7052 |
end if; |
| 7053 |
ARM_Input.Get_Char (Input_Object, Ch); |
| 7054 |
if Ch /= Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Close_Char then |
| 7055 |
Ada.Text_IO.Put_Line (" ** Bad close for Labeled_Added_(Sub)Clause on line " & ARM_Input.Line_String (Input_Object)); |
| 7056 |
ARM_Input.Replace_Char (Input_Object); |
| 7057 |
end if; |
| 7058 |
|
| 7059 |
Calc_Change_Disposition ( |
| 7060 |
Format_Object => Format_Object, |
| 7061 |
Version => Version, |
| 7062 |
Operation => ARM_Output.Insertion, |
| 7063 |
Text_Kind => Disposition); |
| 7064 |
|
| 7065 |
if Disposition = Do_Not_Display_Text then |
| 7066 |
null; -- Ignore this; it isn't numbered or anything. |
| 7067 |
elsif Disposition = ARM_Output.Deletion then |
| 7068 |
raise Program_Error; -- A deletion inside of an insertion command! |
| 7069 |
else |
| 7070 |
if Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Command = Labeled_Added_Subclause then |
| 7071 |
Format_Object.Clause_Number := |
| 7072 |
(Section => Format_Object.Clause_Number.Section, |
| 7073 |
Clause => Format_Object.Clause_Number.Clause, |
| 7074 |
Subclause => Format_Object.Clause_Number.Subclause + 1, |
| 7075 |
Subsubclause => 0); |
| 7076 |
Level := ARM_Contents.Subclause; |
| 7077 |
elsif Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Command = Labeled_Added_Subsubclause then |
| 7078 |
Format_Object.Clause_Number.Subsubclause := |
| 7079 |
Format_Object.Clause_Number.Subsubclause + 1; |
| 7080 |
Level := ARM_Contents.Subsubclause; |
| 7081 |
elsif Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Command = Labeled_Added_Clause then |
| 7082 |
Format_Object.Clause_Number := |
| 7083 |
(Section => Format_Object.Clause_Number.Section, |
| 7084 |
Clause => Format_Object.Clause_Number.Clause + 1, |
| 7085 |
Subclause => 0, Subsubclause => 0); |
| 7086 |
Level := ARM_Contents.Clause; |
| 7087 |
elsif Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Command = Labeled_Added_Section then |
| 7088 |
Format_Object.Clause_Number := |
| 7089 |
(Section => Format_Object.Clause_Number.Section, -- Will be set elsewhere. |
| 7090 |
Clause => 0, |
| 7091 |
Subclause => 0, Subsubclause => 0); |
| 7092 |
Level := ARM_Contents.Section; |
| 7093 |
elsif Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Command = Labeled_Added_Annex then |
| 7094 |
Format_Object.Clause_Number := |
| 7095 |
(Section => Format_Object.Clause_Number.Section, -- Will be set elsewhere. |
| 7096 |
Clause => 0, |
| 7097 |
Subclause => 0, Subsubclause => 0); |
| 7098 |
Level := ARM_Contents.Plain_Annex; |
| 7099 |
elsif Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Command = Labeled_Added_Normative_Annex then |
| 7100 |
Format_Object.Clause_Number := |
| 7101 |
(Section => Format_Object.Clause_Number.Section, -- Will be set elsewhere. |
| 7102 |
Clause => 0, |
| 7103 |
Subclause => 0, Subsubclause => 0); |
| 7104 |
Level := ARM_Contents.Normative_Annex; |
| 7105 |
else -- Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Command = Labeled_Added_Informative_Annex then |
| 7106 |
Format_Object.Clause_Number := |
| 7107 |
(Section => Format_Object.Clause_Number.Section, -- Will be set elsewhere. |
| 7108 |
Clause => 0, |
| 7109 |
Subclause => 0, Subsubclause => 0); |
| 7110 |
Level := ARM_Contents.Informative_Annex; |
| 7111 |
end if; |
| 7112 |
|
| 7113 |
begin |
| 7114 |
declare |
| 7115 |
Clause_Number : constant String := |
| 7116 |
ARM_Contents.Lookup_Clause_Number (New_Title); |
| 7117 |
|
| 7118 |
begin |
| 7119 |
if Disposition = ARM_Output.None then |
| 7120 |
-- Normal reference: |
| 7121 |
Check_End_Paragraph; -- End any paragraph that we're in. |
| 7122 |
ARM_Output.Clause_Header (Output_Object, |
| 7123 |
New_Title(1..New_Title_Length), |
| 7124 |
Level => Level, |
| 7125 |
Clause_Number => Clause_Number, |
| 7126 |
Top_Level_Subdivision_Name => Format_Object.Top_Level_Subdivision_Name); |
| 7127 |
else -- Insertion. |
| 7128 |
Check_End_Paragraph; -- End any paragraph that we're in. |
| 7129 |
ARM_Output.Revised_Clause_Header (Output_Object, |
| 7130 |
New_Header_Text => New_Title(1..New_Title_Length), |
| 7131 |
Old_Header_Text => "", |
| 7132 |
Level => Level, |
| 7133 |
Version => Version, |
| 7134 |
Old_Version => '0', |
| 7135 |
Clause_Number => Clause_Number, |
| 7136 |
Top_Level_Subdivision_Name => Format_Object.Top_Level_Subdivision_Name); |
| 7137 |
end if; |
| 7138 |
|
| 7139 |
-- Check that the section numbers match the title: |
| 7140 |
if Ada.Characters.Handling.To_Lower (New_Title) /= |
| 7141 |
Ada.Characters.Handling.To_Lower (ARM_Contents.Lookup_Title ( |
| 7142 |
Level, Format_Object.Clause_Number)) then |
| 7143 |
Ada.Text_IO.Put_Line ("** Unable to match title with section numbers, line " & ARM_Input.Line_String (Input_Object)); |
| 7144 |
end if; |
| 7145 |
--!!Debug: |
| 7146 |
--Ada.Text_IO.Put_Line ("Start clause " & Clause_Number & " -- " & New_Title(1..New_Title_Length)); |
| 7147 |
end; |
| 7148 |
exception |
| 7149 |
when ARM_Contents.Not_Found_Error => |
| 7150 |
Ada.Text_IO.Put_Line ("** Unable to find header reference, line " & ARM_Input.Line_String (Input_Object)); |
| 7151 |
Ada.Text_IO.Put_Line (" Looking for " & New_Title(1..New_Title_Length)); |
| 7152 |
end; |
| 7153 |
-- Reset the paragraph numbers: |
| 7154 |
Format_Object.Next_Paragraph := 1; |
| 7155 |
Format_Object.Next_Insert_Para := 1; |
| 7156 |
Format_Object.Next_AARM_Sub := 'a'; |
| 7157 |
if Format_Object.Use_ISO_2004_Note_Format then |
| 7158 |
-- Reset the note number: |
| 7159 |
Format_Object.Next_Note := 1; |
| 7160 |
elsif Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Command = Labeled_Added_Section or else |
| 7161 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Command = Labeled_Added_Annex or else |
| 7162 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Command = Labeled_Added_Informative_Annex or else |
| 7163 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Command = Labeled_Added_Normative_Annex then |
| 7164 |
-- Reset the note number, only for sections: |
| 7165 |
Format_Object.Next_Note := 1; |
| 7166 |
end if; |
| 7167 |
-- Reset the subhead: |
| 7168 |
Format_Object.Last_Paragraph_Subhead_Type := Plain; |
| 7169 |
Format_Object.Next_Paragraph_Format_Type := Plain; |
| 7170 |
end if; |
| 7171 |
|
| 7172 |
Format_State.Nesting_Stack_Ptr := Format_State.Nesting_Stack_Ptr - 1; |
| 7173 |
--Ada.Text_IO.Put_Line (" &Unstack (Header)"); |
| 7174 |
end; |
| 7175 |
|
| 7176 |
when Labeled_Deleted_Clause | |
| 7177 |
Labeled_Deleted_Subclause | |
| 7178 |
Labeled_Deleted_Subsubclause => |
| 7179 |
-- Load the title into the Title string: |
| 7180 |
declare |
| 7181 |
Old_Title : ARM_Contents.Title_Type; |
| 7182 |
Old_Title_Length : Natural; |
| 7183 |
Ch : Character; |
| 7184 |
Version : ARM_Contents.Change_Version_Type := '0'; |
| 7185 |
Level : ARM_Contents.Level_Type; |
| 7186 |
Disposition : ARM_Output.Change_Type; |
| 7187 |
use type ARM_Output.Change_Type; |
| 7188 |
begin |
| 7189 |
Get_Change_Version (Is_First => True, |
| 7190 |
Version => Version); |
| 7191 |
ARM_Input.Check_Parameter_Name (Input_Object, |
| 7192 |
Param_Name => "Name" & (5..ARM_Input.Command_Name_Type'Last => ' '), |
| 7193 |
Is_First => False, |
| 7194 |
Param_Close_Bracket => Ch); |
| 7195 |
if Ch /= ' ' then |
| 7196 |
-- There is a parameter: |
| 7197 |
-- Load the new title into the Title string: |
| 7198 |
ARM_Input.Copy_to_String_until_Close_Char ( |
| 7199 |
Input_Object, |
| 7200 |
Ch, |
| 7201 |
Old_Title, Old_Title_Length); |
| 7202 |
Old_Title(Old_Title_Length+1 .. Old_Title'Last) := |
| 7203 |
(others => ' '); |
| 7204 |
end if; |
| 7205 |
ARM_Input.Get_Char (Input_Object, Ch); |
| 7206 |
if Ch /= Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Close_Char then |
| 7207 |
Ada.Text_IO.Put_Line (" ** Bad close for Labeled_Deleted_(Sub)Clause on line " & ARM_Input.Line_String (Input_Object)); |
| 7208 |
ARM_Input.Replace_Char (Input_Object); |
| 7209 |
end if; |
| 7210 |
|
| 7211 |
Calc_Change_Disposition ( |
| 7212 |
Format_Object => Format_Object, |
| 7213 |
Version => Version, |
| 7214 |
Operation => ARM_Output.Deletion, |
| 7215 |
Text_Kind => Disposition); |
| 7216 |
|
| 7217 |
--Ada.Text_IO.Put_Line ("Labeled_Deleted disp: " & ARM_Output.Change_Type'Image(Disposition)); |
| 7218 |
--Ada.Text_IO.Put_Line (" Version:" & Version); |
| 7219 |
if Disposition = Do_Not_Display_Text then |
| 7220 |
null; -- Ignore this; it isn't numbered or anything. |
| 7221 |
elsif Disposition = ARM_Output.Insertion then |
| 7222 |
raise Program_Error; -- An insertion inside of a deletion command! |
| 7223 |
elsif Disposition = ARM_Output.Deletion then |
| 7224 |
-- Format the text as a deletion, but not as a header. |
| 7225 |
Check_End_Paragraph; -- End any paragraph that we're in. |
| 7226 |
|
| 7227 |
ARM_Output.Start_Paragraph (Output_Object, |
| 7228 |
Style => ARM_Output.Title, |
| 7229 |
Indent => 0, |
| 7230 |
Number => ""); |
| 7231 |
ARM_Output.Text_Format (Output_Object, |
| 7232 |
Format => (Bold => True, |
| 7233 |
Italic => False, |
| 7234 |
Font => ARM_Output.Default, |
| 7235 |
Size => ARM_Output.Size_Type(-2), |
| 7236 |
Color => ARM_Output.Default, |
| 7237 |
Change => ARM_Output.Deletion, |
| 7238 |
Version => Version, |
| 7239 |
Added_Version => '0', |
| 7240 |
Location => ARM_Output.Normal)); |
| 7241 |
ARM_Output.Ordinary_Text (Output_Object, |
| 7242 |
Old_Title(1..Old_Title_Length)); |
| 7243 |
ARM_Output.Text_Format (Output_Object, |
| 7244 |
ARM_Output.NORMAL_FORMAT); |
| 7245 |
ARM_Output.End_Paragraph (Output_Object); |
| 7246 |
|
| 7247 |
-- Reset the paragraph numbers: (for the following deleted text, presumably also shown). |
| 7248 |
Format_Object.Next_Paragraph := 1; |
| 7249 |
Format_Object.Next_Insert_Para := 1; |
| 7250 |
Format_Object.Next_AARM_Sub := 'a'; |
| 7251 |
if Format_Object.Use_ISO_2004_Note_Format then |
| 7252 |
-- Reset the note number: |
| 7253 |
Format_Object.Next_Note := 1; |
| 7254 |
--elsif Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Command = Labeled_Deleted_Section or else |
| 7255 |
-- Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Command = Labeled_Deleted_Annex or else |
| 7256 |
-- Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Command = Labeled_Deleted_Informative_Annex or else |
| 7257 |
-- Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Command = Labeled_Deleted_Normative_Annex then |
| 7258 |
-- -- Reset the note number, only for sections: (no sections yet) |
| 7259 |
-- Format_Object.Next_Note := 1; |
| 7260 |
end if; |
| 7261 |
-- Reset the subhead: |
| 7262 |
Format_Object.Last_Paragraph_Subhead_Type := Plain; |
| 7263 |
Format_Object.Next_Paragraph_Format_Type := Plain; |
| 7264 |
else -- Disposition = ARM_Output.None then |
| 7265 |
if Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Command = Labeled_Deleted_Subclause then |
| 7266 |
Format_Object.Clause_Number := |
| 7267 |
(Section => Format_Object.Clause_Number.Section, |
| 7268 |
Clause => Format_Object.Clause_Number.Clause, |
| 7269 |
Subclause => Format_Object.Clause_Number.Subclause + 1, |
| 7270 |
Subsubclause => 0); |
| 7271 |
Level := ARM_Contents.Subclause; |
| 7272 |
elsif Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Command = Labeled_Deleted_Subsubclause then |
| 7273 |
Format_Object.Clause_Number.Subsubclause := |
| 7274 |
Format_Object.Clause_Number.Subsubclause + 1; |
| 7275 |
Level := ARM_Contents.Subsubclause; |
| 7276 |
else --Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Command = Labeled_Deleted_Clause then |
| 7277 |
Format_Object.Clause_Number := |
| 7278 |
(Section => Format_Object.Clause_Number.Section, |
| 7279 |
Clause => Format_Object.Clause_Number.Clause + 1, |
| 7280 |
Subclause => 0, Subsubclause => 0); |
| 7281 |
Level := ARM_Contents.Clause; |
| 7282 |
end if; |
| 7283 |
|
| 7284 |
begin |
| 7285 |
declare |
| 7286 |
Clause_Number : constant String := |
| 7287 |
ARM_Contents.Lookup_Clause_Number (Old_Title); |
| 7288 |
begin |
| 7289 |
-- Normal reference: |
| 7290 |
Check_End_Paragraph; -- End any paragraph that we're in. |
| 7291 |
ARM_Output.Clause_Header (Output_Object, |
| 7292 |
Old_Title(1..Old_Title_Length), |
| 7293 |
Level => Level, |
| 7294 |
Clause_Number => Clause_Number, |
| 7295 |
Top_Level_Subdivision_Name => Format_Object.Top_Level_Subdivision_Name); |
| 7296 |
end; |
| 7297 |
|
| 7298 |
-- Check that the section numbers match the title: |
| 7299 |
if Ada.Characters.Handling.To_Lower (Old_Title) /= |
| 7300 |
Ada.Characters.Handling.To_Lower (ARM_Contents.Lookup_Title ( |
| 7301 |
Level, Format_Object.Clause_Number)) then |
| 7302 |
Ada.Text_IO.Put_Line ("** Unable to match title with section numbers, line " & ARM_Input.Line_String (Input_Object)); |
| 7303 |
end if; |
| 7304 |
exception |
| 7305 |
when ARM_Contents.Not_Found_Error => |
| 7306 |
Ada.Text_IO.Put_Line ("** Unable to find header reference, line " & ARM_Input.Line_String (Input_Object)); |
| 7307 |
Ada.Text_IO.Put_Line (" Looking for " & Old_Title(1..Old_Title_Length)); |
| 7308 |
end; |
| 7309 |
-- Reset the paragraph numbers: |
| 7310 |
Format_Object.Next_Paragraph := 1; |
| 7311 |
Format_Object.Next_Insert_Para := 1; |
| 7312 |
Format_Object.Next_AARM_Sub := 'a'; |
| 7313 |
-- Reset the subhead: |
| 7314 |
Format_Object.Last_Paragraph_Subhead_Type := Plain; |
| 7315 |
Format_Object.Next_Paragraph_Format_Type := Plain; |
| 7316 |
end if; |
| 7317 |
|
| 7318 |
Format_State.Nesting_Stack_Ptr := Format_State.Nesting_Stack_Ptr - 1; |
| 7319 |
--Ada.Text_IO.Put_Line (" &Unstack (Header)"); |
| 7320 |
end; |
| 7321 |
|
| 7322 |
when Preface_Section => |
| 7323 |
Check_End_Paragraph; -- End any paragraph that we're in. |
| 7324 |
--ARM_Output.New_Page (Output_Object, ARM_Output.Odd_Page_Only); |
| 7325 |
ARM_Output.Clause_Header (Output_Object, |
| 7326 |
Header_Text => "", |
| 7327 |
Level => ARM_Contents.Unnumbered_Section, |
| 7328 |
Clause_Number => "0.99", |
| 7329 |
Top_Level_Subdivision_Name => Format_Object.Top_Level_Subdivision_Name); |
| 7330 |
|
| 7331 |
when Subheading => |
| 7332 |
-- This is used in preface sections where no numbers or |
| 7333 |
-- contents are desired. |
| 7334 |
Check_End_Paragraph; -- End any paragraph that we're in. |
| 7335 |
ARM_Output.Start_Paragraph (Output_Object, |
| 7336 |
Style => ARM_Output.Wide_Above, |
| 7337 |
Indent => 0, |
| 7338 |
Number => "", |
| 7339 |
No_Breaks => True, Keep_with_Next => True); |
| 7340 |
Format_Object.In_Paragraph := True; |
| 7341 |
Format_Object.No_Start_Paragraph := False; |
| 7342 |
|
| 7343 |
Format_Object.Text_Format := ARM_Output.NORMAL_FORMAT; |
| 7344 |
Format_Object.Text_Format.Bold := True; |
| 7345 |
Format_Object.Text_Format.Font := ARM_Output.Swiss; |
| 7346 |
Format_Object.Text_Format.Size := 2; |
| 7347 |
ARM_Output.Text_Format (Output_Object, |
| 7348 |
Format_Object.Text_Format); |
| 7349 |
|
| 7350 |
when Added_Subheading => |
| 7351 |
-- This is used in preface sections where no numbers or |
| 7352 |
-- contents are desired. |
| 7353 |
declare |
| 7354 |
Ch : Character; |
| 7355 |
Version : ARM_Contents.Change_Version_Type := '0'; |
| 7356 |
|
| 7357 |
Disposition : ARM_Output.Change_Type; |
| 7358 |
use type ARM_Output.Change_Type; |
| 7359 |
begin |
| 7360 |
Get_Change_Version (Is_First => True, |
| 7361 |
Version => Version); |
| 7362 |
ARM_Input.Get_Char (Input_Object, Ch); |
| 7363 |
if Ch /= ',' then |
| 7364 |
Ada.Text_IO.Put_Line (" ** Missing comma for AddedSubheading on line " & ARM_Input.Line_String (Input_Object)); |
| 7365 |
ARM_Input.Replace_Char (Input_Object); |
| 7366 |
end if; |
| 7367 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Change_Version := Version; |
| 7368 |
|
| 7369 |
Calc_Change_Disposition ( |
| 7370 |
Format_Object => Format_Object, |
| 7371 |
Version => Version, |
| 7372 |
Operation => ARM_Output.Insertion, |
| 7373 |
Text_Kind => Disposition); |
| 7374 |
|
| 7375 |
if Disposition = Do_Not_Display_Text then |
| 7376 |
-- Skip the text: |
| 7377 |
ARM_Input.Skip_until_Close_Char (Input_Object, |
| 7378 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Close_Char); |
| 7379 |
ARM_Input.Replace_Char (Input_Object); -- Let the normal termination clean this up. |
| 7380 |
elsif Disposition = ARM_Output.None then |
| 7381 |
-- Normal text: |
| 7382 |
ARM_Output.Start_Paragraph (Output_Object, |
| 7383 |
Style => ARM_Output.Wide_Above, |
| 7384 |
Indent => 0, |
| 7385 |
Number => "", |
| 7386 |
No_Breaks => True, Keep_with_Next => True); |
| 7387 |
Format_Object.In_Paragraph := True; |
| 7388 |
Format_Object.No_Start_Paragraph := False; |
| 7389 |
|
| 7390 |
Format_Object.Text_Format := ARM_Output.NORMAL_FORMAT; |
| 7391 |
Format_Object.Text_Format.Bold := True; |
| 7392 |
Format_Object.Text_Format.Font := ARM_Output.Swiss; |
| 7393 |
Format_Object.Text_Format.Size := 2; |
| 7394 |
ARM_Output.Text_Format (Output_Object, |
| 7395 |
Format_Object.Text_Format); |
| 7396 |
elsif Disposition = ARM_Output.Deletion then |
| 7397 |
raise Program_Error; -- A deletion inside of an insertion command! |
| 7398 |
else -- Insertion. |
| 7399 |
ARM_Output.Start_Paragraph (Output_Object, |
| 7400 |
Style => ARM_Output.Wide_Above, |
| 7401 |
Indent => 0, |
| 7402 |
Number => "", |
| 7403 |
No_Breaks => True, Keep_with_Next => True); |
| 7404 |
Format_Object.In_Paragraph := True; |
| 7405 |
Format_Object.No_Start_Paragraph := False; |
| 7406 |
|
| 7407 |
Format_Object.Text_Format := ARM_Output.NORMAL_FORMAT; |
| 7408 |
Format_Object.Text_Format.Bold := True; |
| 7409 |
Format_Object.Text_Format.Font := ARM_Output.Swiss; |
| 7410 |
Format_Object.Text_Format.Size := 2; |
| 7411 |
Format_Object.Text_Format.Change := ARM_Output.Insertion; |
| 7412 |
Format_Object.Text_Format.Version := Version; |
| 7413 |
ARM_Output.Text_Format (Output_Object, |
| 7414 |
Format_Object.Text_Format); |
| 7415 |
end if; |
| 7416 |
end; |
| 7417 |
|
| 7418 |
when Heading => |
| 7419 |
-- This is used in preface sections where no numbers or |
| 7420 |
-- contents are desired. |
| 7421 |
Check_End_Paragraph; -- End any paragraph that we're in. |
| 7422 |
ARM_Output.Start_Paragraph (Output_Object, |
| 7423 |
Style => ARM_Output.Title, |
| 7424 |
Indent => 0, |
| 7425 |
Number => "", |
| 7426 |
No_Breaks => True, Keep_with_Next => True, |
| 7427 |
Justification => ARM_Output.Center); |
| 7428 |
Format_Object.In_Paragraph := True; |
| 7429 |
Format_Object.No_Start_Paragraph := False; |
| 7430 |
|
| 7431 |
Format_Object.Text_Format := ARM_Output.NORMAL_FORMAT; |
| 7432 |
Format_Object.Text_Format.Bold := True; |
| 7433 |
Format_Object.Text_Format.Font := ARM_Output.Swiss; |
| 7434 |
Format_Object.Text_Format.Size := 0; |
| 7435 |
-- Note that the size is +3 from the Title format. |
| 7436 |
ARM_Output.Text_Format (Output_Object, |
| 7437 |
Format_Object.Text_Format); |
| 7438 |
|
| 7439 |
when Center => |
| 7440 |
Check_End_Paragraph; -- End any paragraph that we're in. |
| 7441 |
ARM_Output.Start_Paragraph (Output_Object, |
| 7442 |
Style => ARM_Output.Normal, |
| 7443 |
Indent => 0, |
| 7444 |
Number => "", |
| 7445 |
No_Breaks => True, Keep_with_Next => False, |
| 7446 |
Justification => ARM_Output.Center); |
| 7447 |
Format_Object.In_Paragraph := True; |
| 7448 |
Format_Object.No_Start_Paragraph := False; |
| 7449 |
|
| 7450 |
when Right => |
| 7451 |
Check_End_Paragraph; -- End any paragraph that we're in. |
| 7452 |
ARM_Output.Start_Paragraph (Output_Object, |
| 7453 |
Style => ARM_Output.Normal, |
| 7454 |
Indent => 0, |
| 7455 |
Number => "", |
| 7456 |
No_Breaks => True, Keep_with_Next => False, |
| 7457 |
Justification => ARM_Output.Right); |
| 7458 |
Format_Object.In_Paragraph := True; |
| 7459 |
Format_Object.No_Start_Paragraph := False; |
| 7460 |
|
| 7461 |
when Ref_Section | Ref_Section_Number => |
| 7462 |
-- Load the title into the Title string: |
| 7463 |
declare |
| 7464 |
Ch : Character; |
| 7465 |
Title : ARM_Contents.Title_Type; |
| 7466 |
Title_Length : Natural; |
| 7467 |
begin |
| 7468 |
ARM_Input.Get_Char (Input_Object, Ch); |
| 7469 |
Title_Length := 0; |
| 7470 |
while Ch /= Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Close_Char loop |
| 7471 |
Title_Length := Title_Length + 1; |
| 7472 |
Title(Title_Length) := Ch; |
| 7473 |
ARM_Input.Get_Char (Input_Object, Ch); |
| 7474 |
end loop; |
| 7475 |
Title(Title_Length+1 .. Title'Last) := |
| 7476 |
(others => ' '); |
| 7477 |
|
| 7478 |
begin |
| 7479 |
declare |
| 7480 |
Clause_Number_Text : constant String := |
| 7481 |
ARM_Contents.Lookup_Clause_Number (Title); |
| 7482 |
begin |
| 7483 |
if Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Command = Ref_Section then |
| 7484 |
Check_Paragraph; |
| 7485 |
ARM_Output.Clause_Reference (Output_Object, |
| 7486 |
Text => Clause_Number_Text, |
| 7487 |
Clause_Number => Clause_Number_Text); |
| 7488 |
ARM_Output.Ordinary_Text (Output_Object, ", "); |
| 7489 |
-- Was: (To match the Ada 95 Standard) |
| 7490 |
--ARM_Output.Special_Character (Output_Object, ARM_Output.Left_Quote); |
| 7491 |
--ARM_Output.Special_Character (Output_Object, ARM_Output.Left_Quote); |
| 7492 |
ARM_Output.Special_Character (Output_Object, ARM_Output.Left_Double_Quote); |
| 7493 |
if Format_Object.Change_Version < '1' or else |
| 7494 |
Format_Object.Changes = ARM_Format.Old_Only then |
| 7495 |
-- Use original version: |
| 7496 |
declare |
| 7497 |
Clause_Number : ARM_Contents.Clause_Number_Type; |
| 7498 |
begin |
| 7499 |
ARM_Contents.Make_Clause (Clause_Number_Text, |
| 7500 |
Clause_Number); |
| 7501 |
ARM_Output.Clause_Reference (Output_Object, |
| 7502 |
Text => Ada.Strings.Fixed.Trim ( |
| 7503 |
ARM_Contents.Lookup_Old_Title ( |
| 7504 |
ARM_Contents.Lookup_Level (Title), |
| 7505 |
Clause_Number), |
| 7506 |
Ada.Strings.Right), |
| 7507 |
Clause_Number => Clause_Number_Text); |
| 7508 |
end; |
| 7509 |
else |
| 7510 |
-- Use new version. We don't have version numbers for these yet. |
| 7511 |
ARM_Output.Clause_Reference (Output_Object, |
| 7512 |
Text => Title(1..Title_Length), |
| 7513 |
Clause_Number => Clause_Number_Text); |
| 7514 |
end if; |
| 7515 |
-- Was: (To match the Ada 95 Standard) |
| 7516 |
--ARM_Output.Special_Character (Output_Object, ARM_Output.Right_Quote); |
| 7517 |
--ARM_Output.Special_Character (Output_Object, ARM_Output.Right_Quote); |
| 7518 |
ARM_Output.Special_Character (Output_Object, ARM_Output.Right_Double_Quote); |
| 7519 |
else -- Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Command = Ref_Section_Number then |
| 7520 |
Check_Paragraph; |
| 7521 |
ARM_Output.Clause_Reference (Output_Object, |
| 7522 |
Text => Clause_Number_Text, |
| 7523 |
Clause_Number => Clause_Number_Text); |
| 7524 |
end if; |
| 7525 |
Format_Object.Last_Non_Space := True; |
| 7526 |
end; |
| 7527 |
exception |
| 7528 |
when ARM_Contents.Not_Found_Error => |
| 7529 |
Ada.Text_IO.Put_Line ("** Unable to find section reference, line " & ARM_Input.Line_String (Input_Object)); |
| 7530 |
Ada.Text_IO.Put_Line (" Looking for " & Title(1..Title_Length)); |
| 7531 |
end; |
| 7532 |
end; |
| 7533 |
|
| 7534 |
Format_State.Nesting_Stack_Ptr := Format_State.Nesting_Stack_Ptr - 1; |
| 7535 |
--Ada.Text_IO.Put_Line (" &Unstack (Section Reference)"); |
| 7536 |
|
| 7537 |
when Ref_Section_by_Number => |
| 7538 |
-- Load the number into the Number string: |
| 7539 |
declare |
| 7540 |
Ch : Character; |
| 7541 |
Number : String(1..20); |
| 7542 |
Number_Length : Natural; |
| 7543 |
begin |
| 7544 |
ARM_Input.Get_Char (Input_Object, Ch); |
| 7545 |
Number_Length := 0; |
| 7546 |
while Ch /= Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Close_Char loop |
| 7547 |
Number_Length := Number_Length + 1; |
| 7548 |
Number(Number_Length) := Ch; |
| 7549 |
ARM_Input.Get_Char (Input_Object, Ch); |
| 7550 |
end loop; |
| 7551 |
Number(Number_Length+1 .. Number'Last) := |
| 7552 |
(others => ' '); |
| 7553 |
|
| 7554 |
Check_Paragraph; |
| 7555 |
ARM_Output.Clause_Reference (Output_Object, |
| 7556 |
Text => Number(1..Number_Length), |
| 7557 |
Clause_Number => Number(1..Number_Length)); |
| 7558 |
Format_Object.Last_Non_Space := True; |
| 7559 |
-- No checking here. |
| 7560 |
end; |
| 7561 |
|
| 7562 |
Format_State.Nesting_Stack_Ptr := Format_State.Nesting_Stack_Ptr - 1; |
| 7563 |
--Ada.Text_IO.Put_Line (" &Unstack (Section Num Reference)"); |
| 7564 |
|
| 7565 |
-- Link commands: |
| 7566 |
when Local_Target => |
| 7567 |
-- @LocalTarget{Target=[<target-text>],Text=[<text>]} |
| 7568 |
declare |
| 7569 |
Close_Ch : Character; |
| 7570 |
Target : String(1..40); |
| 7571 |
Target_Len : Natural; |
| 7572 |
Text : String(1..100); |
| 7573 |
Text_Len : Natural; |
| 7574 |
begin |
| 7575 |
ARM_Input.Check_Parameter_Name (Input_Object, |
| 7576 |
Param_Name => "Target" & (7..ARM_Input.Command_Name_Type'Last => ' '), |
| 7577 |
Is_First => True, |
| 7578 |
Param_Close_Bracket => Close_Ch); |
| 7579 |
if Close_Ch /= ' ' then |
| 7580 |
-- Save URL: |
| 7581 |
ARM_Input.Copy_to_String_until_Close_Char ( |
| 7582 |
Input_Object, |
| 7583 |
Close_Ch, |
| 7584 |
Target, |
| 7585 |
Target_Len); |
| 7586 |
-- else no parameter. Weird. |
| 7587 |
end if; |
| 7588 |
|
| 7589 |
ARM_Input.Check_Parameter_Name (Input_Object, |
| 7590 |
Param_Name => "Text" & (5..ARM_Input.Command_Name_Type'Last => ' '), |
| 7591 |
Is_First => False, |
| 7592 |
Param_Close_Bracket => Close_Ch); |
| 7593 |
if Close_Ch /= ' ' then |
| 7594 |
-- Save name: |
| 7595 |
ARM_Input.Copy_to_String_until_Close_Char ( |
| 7596 |
Input_Object, |
| 7597 |
Close_Ch, |
| 7598 |
Text, |
| 7599 |
Text_Len); |
| 7600 |
-- else no parameter. Weird. |
| 7601 |
end if; |
| 7602 |
|
| 7603 |
Check_Paragraph; |
| 7604 |
ARM_Output.Local_Target (Output_Object, |
| 7605 |
Text => Text(1..Text_Len), |
| 7606 |
Target => Target(1..Target_Len)); |
| 7607 |
if Text_Len /= 0 and then Text(Text_Len) /= ' ' then |
| 7608 |
Format_Object.Last_Non_Space := True; |
| 7609 |
end if; |
| 7610 |
end; |
| 7611 |
-- Leave the command end marker, let normal processing |
| 7612 |
-- get rid of it. |
| 7613 |
|
| 7614 |
when Local_Link => |
| 7615 |
-- @LocalLink{Target=[<target-text>],Sec=[<title>],Text=[<text>]} |
| 7616 |
declare |
| 7617 |
Close_Ch : Character; |
| 7618 |
Target : String(1..40); |
| 7619 |
Target_Len : Natural; |
| 7620 |
Text : String(1..100); |
| 7621 |
Text_Len : Natural; |
| 7622 |
Title : ARM_Contents.Title_Type; |
| 7623 |
Title_Length : Natural; |
| 7624 |
begin |
| 7625 |
ARM_Input.Check_Parameter_Name (Input_Object, |
| 7626 |
Param_Name => "Target" & (7..ARM_Input.Command_Name_Type'Last => ' '), |
| 7627 |
Is_First => True, |
| 7628 |
Param_Close_Bracket => Close_Ch); |
| 7629 |
if Close_Ch /= ' ' then |
| 7630 |
-- Save URL: |
| 7631 |
ARM_Input.Copy_to_String_until_Close_Char ( |
| 7632 |
Input_Object, |
| 7633 |
Close_Ch, |
| 7634 |
Target, |
| 7635 |
Target_Len); |
| 7636 |
-- else no parameter. Weird. |
| 7637 |
end if; |
| 7638 |
|
| 7639 |
ARM_Input.Check_Parameter_Name (Input_Object, |
| 7640 |
Param_Name => "Sec" & (4..ARM_Input.Command_Name_Type'Last => ' '), |
| 7641 |
Is_First => False, |
| 7642 |
Param_Close_Bracket => Close_Ch); |
| 7643 |
if Close_Ch /= ' ' then |
| 7644 |
-- Save URL: |
| 7645 |
ARM_Input.Copy_to_String_until_Close_Char ( |
| 7646 |
Input_Object, |
| 7647 |
Close_Ch, |
| 7648 |
Title, |
| 7649 |
Title_Length); |
| 7650 |
Title(Title_Length+1 .. Title'Last) := |
| 7651 |
(others => ' '); |
| 7652 |
-- else no parameter. Weird. |
| 7653 |
end if; |
| 7654 |
|
| 7655 |
ARM_Input.Check_Parameter_Name (Input_Object, |
| 7656 |
Param_Name => "Text" & (5..ARM_Input.Command_Name_Type'Last => ' '), |
| 7657 |
Is_First => False, |
| 7658 |
Param_Close_Bracket => Close_Ch); |
| 7659 |
if Close_Ch /= ' ' then |
| 7660 |
-- Save name: |
| 7661 |
ARM_Input.Copy_to_String_until_Close_Char ( |
| 7662 |
Input_Object, |
| 7663 |
Close_Ch, |
| 7664 |
Text, |
| 7665 |
Text_Len); |
| 7666 |
-- else no parameter. Weird. |
| 7667 |
end if; |
| 7668 |
|
| 7669 |
begin |
| 7670 |
declare |
| 7671 |
Clause_Number_Text : constant String := |
| 7672 |
ARM_Contents.Lookup_Clause_Number (Title); |
| 7673 |
begin |
| 7674 |
Check_Paragraph; |
| 7675 |
ARM_Output.Local_Link (Output_Object, |
| 7676 |
Text => Text(1..Text_Len), |
| 7677 |
Target => Target(1..Target_Len), |
| 7678 |
Clause_Number => Clause_Number_Text); |
| 7679 |
if Text_Len /= 0 and then Text(Text_Len) /= ' ' then |
| 7680 |
Format_Object.Last_Non_Space := True; |
| 7681 |
end if; |
| 7682 |
end; |
| 7683 |
exception |
| 7684 |
when ARM_Contents.Not_Found_Error => |
| 7685 |
Ada.Text_IO.Put_Line ("** Unable to find section in local link, line " & ARM_Input.Line_String (Input_Object)); |
| 7686 |
Ada.Text_IO.Put_Line (" Looking for " & Title(1..Title_Length)); |
| 7687 |
end; |
| 7688 |
end; |
| 7689 |
-- Leave the command end marker, let normal processing |
| 7690 |
-- get rid of it. |
| 7691 |
|
| 7692 |
when URL_Link => |
| 7693 |
-- @URLLink{URL=[<URL>],Text=[<text>]} |
| 7694 |
declare |
| 7695 |
Close_Ch : Character; |
| 7696 |
URL : String(1..80); |
| 7697 |
URL_Len : Natural; |
| 7698 |
Text : String(1..100); |
| 7699 |
Text_Len : Natural; |
| 7700 |
begin |
| 7701 |
ARM_Input.Check_Parameter_Name (Input_Object, |
| 7702 |
Param_Name => "URL" & (4..ARM_Input.Command_Name_Type'Last => ' '), |
| 7703 |
Is_First => True, |
| 7704 |
Param_Close_Bracket => Close_Ch); |
| 7705 |
if Close_Ch /= ' ' then |
| 7706 |
-- Save URL: |
| 7707 |
ARM_Input.Copy_to_String_until_Close_Char ( |
| 7708 |
Input_Object, |
| 7709 |
Close_Ch, |
| 7710 |
URL, |
| 7711 |
URL_Len); |
| 7712 |
-- else no parameter. Weird. |
| 7713 |
end if; |
| 7714 |
|
| 7715 |
ARM_Input.Check_Parameter_Name (Input_Object, |
| 7716 |
Param_Name => "Text" & (5..ARM_Input.Command_Name_Type'Last => ' '), |
| 7717 |
Is_First => False, |
| 7718 |
Param_Close_Bracket => Close_Ch); |
| 7719 |
if Close_Ch /= ' ' then |
| 7720 |
-- Save name: |
| 7721 |
ARM_Input.Copy_to_String_until_Close_Char ( |
| 7722 |
Input_Object, |
| 7723 |
Close_Ch, |
| 7724 |
Text, |
| 7725 |
Text_Len); |
| 7726 |
-- else no parameter. Weird. |
| 7727 |
end if; |
| 7728 |
|
| 7729 |
Check_Paragraph; |
| 7730 |
ARM_Output.URL_Link (Output_Object, |
| 7731 |
Text => Text(1..Text_Len), |
| 7732 |
URL => URL(1..URL_Len)); |
| 7733 |
if Text_Len /= 0 and then Text(Text_Len) /= ' ' then |
| 7734 |
Format_Object.Last_Non_Space := True; |
| 7735 |
end if; |
| 7736 |
end; |
| 7737 |
-- Leave the command end marker, let normal processing |
| 7738 |
-- get rid of it. |
| 7739 |
|
| 7740 |
when AI_Link => |
| 7741 |
-- @AILink{AI=[<AI>],Text=[<text>]} |
| 7742 |
declare |
| 7743 |
Close_Ch : Character; |
| 7744 |
AI : String(1..30); |
| 7745 |
AI_Len : Natural; |
| 7746 |
Text : String(1..100); |
| 7747 |
Text_Len : Natural; |
| 7748 |
begin |
| 7749 |
ARM_Input.Check_Parameter_Name (Input_Object, |
| 7750 |
Param_Name => "AI" & (3..ARM_Input.Command_Name_Type'Last => ' '), |
| 7751 |
Is_First => True, |
| 7752 |
Param_Close_Bracket => Close_Ch); |
| 7753 |
if Close_Ch /= ' ' then |
| 7754 |
-- Save AI: |
| 7755 |
ARM_Input.Copy_to_String_until_Close_Char ( |
| 7756 |
Input_Object, |
| 7757 |
Close_Ch, |
| 7758 |
AI, |
| 7759 |
AI_Len); |
| 7760 |
-- else no parameter. Weird. |
| 7761 |
end if; |
| 7762 |
|
| 7763 |
ARM_Input.Check_Parameter_Name (Input_Object, |
| 7764 |
Param_Name => "Text" & (5..ARM_Input.Command_Name_Type'Last => ' '), |
| 7765 |
Is_First => False, |
| 7766 |
Param_Close_Bracket => Close_Ch); |
| 7767 |
if Close_Ch /= ' ' then |
| 7768 |
-- Save name: |
| 7769 |
ARM_Input.Copy_to_String_until_Close_Char ( |
| 7770 |
Input_Object, |
| 7771 |
Close_Ch, |
| 7772 |
Text, |
| 7773 |
Text_Len); |
| 7774 |
-- else no parameter. Weird. |
| 7775 |
end if; |
| 7776 |
|
| 7777 |
Check_Paragraph; |
| 7778 |
ARM_Output.AI_Reference (Output_Object, |
| 7779 |
Text => Text(1..Text_Len), |
| 7780 |
AI_Number => AI(1..AI_Len)); |
| 7781 |
if Text_Len /= 0 and then Text(Text_Len) /= ' ' then |
| 7782 |
Format_Object.Last_Non_Space := True; |
| 7783 |
end if; |
| 7784 |
end; |
| 7785 |
-- Leave the command end marker, let normal processing |
| 7786 |
-- get rid of it. |
| 7787 |
|
| 7788 |
-- Change commands: |
| 7789 |
|
| 7790 |
when Change => |
| 7791 |
-- This command is of the form: |
| 7792 |
-- @chg{[version=<Version>],new=[<new text>],old=[<old text>]}. |
| 7793 |
-- where the parameter names (other than version) are |
| 7794 |
-- optional (but highly recommended), and the curly and |
| 7795 |
-- square brackets can be any of the allowed bracketing characters. |
| 7796 |
-- We have to process this in parts, in order that the |
| 7797 |
-- text can be handled normally. |
| 7798 |
|
| 7799 |
declare |
| 7800 |
Ch : Character; |
| 7801 |
Saw_Version : Boolean; |
| 7802 |
begin |
| 7803 |
-- Check for the optional "Version" parameter: |
| 7804 |
ARM_Input.Get_Char (Input_Object, Ch); |
| 7805 |
ARM_Input.Replace_Char (Input_Object); |
| 7806 |
if Ch = 'V' or else Ch = 'v' then |
| 7807 |
-- There is a Version parameter, grab it. |
| 7808 |
Get_Change_Version (Is_First => True, |
| 7809 |
Version => Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Change_Version); |
| 7810 |
-- Read a parameter named "Version". |
| 7811 |
Saw_Version := True; |
| 7812 |
else |
| 7813 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Change_Version := '1'; |
| 7814 |
Saw_Version := False; |
| 7815 |
end if; |
| 7816 |
|
| 7817 |
-- Save the current state: |
| 7818 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Prev_Change := |
| 7819 |
Format_Object.Text_Format.Change; |
| 7820 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Prev_Change_Version := |
| 7821 |
Format_Object.Text_Format.Version; |
| 7822 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Prev_Added_Change_Version := |
| 7823 |
Format_Object.Text_Format.Added_Version; |
| 7824 |
|
| 7825 |
-- Check and handle the "New" parameter: |
| 7826 |
ARM_Input.Check_Parameter_Name (Input_Object, |
| 7827 |
Param_Name => "New" & (4..ARM_Input.Command_Name_Type'Last => ' '), |
| 7828 |
Is_First => not Saw_Version, |
| 7829 |
Param_Close_Bracket => Ch); |
| 7830 |
if Ch /= ' ' then |
| 7831 |
-- There is a parameter: |
| 7832 |
|
| 7833 |
-- Stack the parameter so we can process the end: |
| 7834 |
Set_Nesting_for_Parameter |
| 7835 |
(Command => Change_Param_New, |
| 7836 |
Close_Ch => Ch); |
| 7837 |
|
| 7838 |
Format_Object.In_Change := True; |
| 7839 |
|
| 7840 |
-- Note: We can't use Calc_Change_Disposition here, |
| 7841 |
-- because it isn't intended to work on possibly |
| 7842 |
-- nested calls like these. |
| 7843 |
|
| 7844 |
-- Now, handle the parameter: |
| 7845 |
if Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr-1).Change_Version > |
| 7846 |
Format_Object.Change_Version then |
| 7847 |
-- Ignore any changes with version numbers higher than |
| 7848 |
-- the current maximum. |
| 7849 |
-- Skip the text: |
| 7850 |
ARM_Input.Skip_until_Close_Char (Input_Object, |
| 7851 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Close_Char); |
| 7852 |
ARM_Input.Replace_Char (Input_Object); -- Let the normal termination clean this up. |
| 7853 |
else |
| 7854 |
case Format_Object.Changes is |
| 7855 |
when ARM_Format.Old_Only => |
| 7856 |
-- Skip the text: |
| 7857 |
ARM_Input.Skip_until_Close_Char (Input_Object, |
| 7858 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Close_Char); |
| 7859 |
ARM_Input.Replace_Char (Input_Object); -- Let the normal termination clean this up. |
| 7860 |
when ARM_Format.New_Only => |
| 7861 |
if ARM_Database."=" (Format_Object.Next_Paragraph_Change_Kind, |
| 7862 |
ARM_Database.Deleted) or else |
| 7863 |
ARM_Database."=" (Format_Object.Next_Paragraph_Change_Kind, |
| 7864 |
ARM_Database.Deleted_Inserted_Number) or else |
| 7865 |
ARM_Database."=" (Format_Object.Next_Paragraph_Change_Kind, |
| 7866 |
ARM_Database.Deleted_No_Delete_Message) or else |
| 7867 |
ARM_Database."=" (Format_Object.Next_Paragraph_Change_Kind, |
| 7868 |
ARM_Database.Deleted_Inserted_Number_No_Delete_Message) then |
| 7869 |
-- In a deleted paragraph, call Check_Paragraph |
| 7870 |
-- to trigger the "deleted paragraph" message. |
| 7871 |
-- (Otherwise, this never happens.) |
| 7872 |
Check_Paragraph; |
| 7873 |
-- else null; -- Nothing special to do. |
| 7874 |
end if; |
| 7875 |
when ARM_Format.Show_Changes | |
| 7876 |
ARM_Format.New_Changes => |
| 7877 |
if Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr-1).Change_Version < |
| 7878 |
Format_Object.Base_Change_Version then |
| 7879 |
-- Just normal output text. |
| 7880 |
if ARM_Database."=" (Format_Object.Next_Paragraph_Change_Kind, |
| 7881 |
ARM_Database.Deleted) or else |
| 7882 |
ARM_Database."=" (Format_Object.Next_Paragraph_Change_Kind, |
| 7883 |
ARM_Database.Deleted_Inserted_Number) or else |
| 7884 |
ARM_Database."=" (Format_Object.Next_Paragraph_Change_Kind, |
| 7885 |
ARM_Database.Deleted_No_Delete_Message) or else |
| 7886 |
ARM_Database."=" (Format_Object.Next_Paragraph_Change_Kind, |
| 7887 |
ARM_Database.Deleted_Inserted_Number_No_Delete_Message) then |
| 7888 |
-- In a deleted paragraph, call Check_Paragraph |
| 7889 |
-- to trigger the "deleted paragraph" message. |
| 7890 |
-- (Otherwise, this never happens.) |
| 7891 |
Check_Paragraph; |
| 7892 |
-- else null; -- Nothing special to do. |
| 7893 |
end if; |
| 7894 |
else |
| 7895 |
ARM_Input.Get_Char (Input_Object, Ch); |
| 7896 |
ARM_Input.Replace_Char (Input_Object); |
| 7897 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr-1).Was_Text := |
| 7898 |
Ch /= Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Close_Char; |
| 7899 |
if Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr-1).Was_Text then |
| 7900 |
-- Non-empty text; Calculate new change state (current is insertion): |
| 7901 |
Check_Paragraph; -- Change the state *after* outputting the paragraph header. |
| 7902 |
case Format_Object.Text_Format.Change is |
| 7903 |
when ARM_Output.Insertion | ARM_Output.None => |
| 7904 |
Format_Object.Text_Format.Change := ARM_Output.Insertion; |
| 7905 |
Format_Object.Text_Format.Version := |
| 7906 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr-1).Change_Version; |
| 7907 |
Format_Object.Text_Format.Added_Version := '0'; |
| 7908 |
when ARM_Output.Deletion => |
| 7909 |
Format_Object.Text_Format.Change := ARM_Output.Both; |
| 7910 |
Format_Object.Text_Format.Added_Version := -- The insertion should be older. |
| 7911 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr-1).Change_Version; |
| 7912 |
-- .Text_Format.Version is unchanged. |
| 7913 |
when ARM_Output.Both => |
| 7914 |
Format_Object.Text_Format.Change := ARM_Output.Both; |
| 7915 |
Format_Object.Text_Format.Added_Version := -- The insertion should be older. |
| 7916 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr-1).Change_Version; |
| 7917 |
-- .Text_Format.Version is unchanged. |
| 7918 |
end case; |
| 7919 |
ARM_Output.Text_Format (Output_Object, |
| 7920 |
Format_Object.Text_Format); -- Set style. |
| 7921 |
-- else no text, so don't bother. |
| 7922 |
end if; |
| 7923 |
end if; |
| 7924 |
end case; |
| 7925 |
end if; |
| 7926 |
-- else no parameter. Weird. |
| 7927 |
end if; |
| 7928 |
end; |
| 7929 |
|
| 7930 |
when Change_Param_Old | Change_Param_New => |
| 7931 |
-- These can't get here; they represent the parameters of |
| 7932 |
-- "Change" and can't be generated explicitly. |
| 7933 |
Ada.Text_IO.Put_Line (" ** Change parameter command?? on line " & ARM_Input.Line_String (Input_Object)); |
| 7934 |
|
| 7935 |
when Change_Added | Change_Deleted => |
| 7936 |
-- @ChgAdded{Version=[<Version>],[NoPrefix=[T|F],][NoParanum=[T|F],] |
| 7937 |
-- [Type=[Leading|Trailing|Normal],][Keepnext=[T|F],]Text=[text]} |
| 7938 |
-- @ChgDeleted{Version=[<Version>],[NoPrefix=[T|F],][NoParanum=[T|F],] |
| 7939 |
-- [Type=[Leading|Trailing|Normal],][Keepnext=[T|F],]Text=[text]} |
| 7940 |
-- Whole paragraph change. These let us modify the AARM prefix |
| 7941 |
-- (like "Reason:" or "Discussion:", and also let us |
| 7942 |
-- conditionally handle paragraph formatting (which |
| 7943 |
-- otherwise would come too late). |
| 7944 |
declare |
| 7945 |
Which_Param : ARM_Input.Param_Num; |
| 7946 |
Close_Ch : Character; |
| 7947 |
|
| 7948 |
NoPrefix, Noparanum, Keepnext : Boolean := False; |
| 7949 |
Space_After : ARM_Output.Space_After_Type := ARM_Output.Normal; |
| 7950 |
|
| 7951 |
Disposition : ARM_Output.Change_Type; |
| 7952 |
use type ARM_Output.Change_Type; |
| 7953 |
|
| 7954 |
function Read_Boolean (Close_Ch : in Character; |
| 7955 |
Name : in String) return Boolean is |
| 7956 |
-- Read a Boolean parameter for a parameter already |
| 7957 |
-- opened and ending with Close_Ch. |
| 7958 |
-- Name is the name of the parameter; for error messages only. |
| 7959 |
Ch : Character; |
| 7960 |
Result : Boolean; |
| 7961 |
begin |
| 7962 |
ARM_Input.Get_Char (Input_Object, Ch); |
| 7963 |
case Ch is |
| 7964 |
when 'F' | 'f' | 'N' | 'n' => |
| 7965 |
Result := False; |
| 7966 |
when 'T' | 't' | 'Y' | 'y' => |
| 7967 |
Result := True; |
| 7968 |
when others => |
| 7969 |
Ada.Text_IO.Put_Line (" ** Bad value for boolean parameter " & |
| 7970 |
Name & " on line " & ARM_Input.Line_String (Input_Object)); |
| 7971 |
end case; |
| 7972 |
ARM_Input.Get_Char (Input_Object, Ch); |
| 7973 |
if Ch /= Close_Ch then |
| 7974 |
Ada.Text_IO.Put_Line (" ** Bad close for boolean parameter " & |
| 7975 |
Name & " on line " & ARM_Input.Line_String (Input_Object)); |
| 7976 |
ARM_Input.Replace_Char (Input_Object); |
| 7977 |
end if; |
| 7978 |
return Result; |
| 7979 |
end Read_Boolean; |
| 7980 |
|
| 7981 |
function Read_Type (Close_Ch : in Character) return ARM_Output.Space_After_Type is |
| 7982 |
-- Read the Type parameter. |
| 7983 |
Type_Name : ARM_Input.Command_Name_Type; |
| 7984 |
Ch : Character; |
| 7985 |
Result : ARM_Output.Space_After_Type := ARM_Output.Normal; |
| 7986 |
begin |
| 7987 |
-- Get the type word: |
| 7988 |
Arm_Input.Get_Name (Input_Object, Type_Name); |
| 7989 |
ARM_Input.Get_Char (Input_Object, Ch); |
| 7990 |
if Ch /= Close_Ch then |
| 7991 |
Ada.Text_IO.Put_Line (" ** Bad close for Type on line " & ARM_Input.Line_String (Input_Object)); |
| 7992 |
ARM_Input.Replace_Char (Input_Object); |
| 7993 |
end if; |
| 7994 |
if Ada.Characters.Handling.To_Lower (Ada.Strings.Fixed.Trim (Type_Name, Ada.Strings.Right)) = |
| 7995 |
"leading" then |
| 7996 |
Result := ARM_Output.Narrow; |
| 7997 |
elsif Ada.Characters.Handling.To_Lower (Ada.Strings.Fixed.Trim (Type_Name, Ada.Strings.Right)) = |
| 7998 |
"trailing" then |
| 7999 |
Result := ARM_Output.Wide; |
| 8000 |
elsif Ada.Characters.Handling.To_Lower (Ada.Strings.Fixed.Trim (Type_Name, Ada.Strings.Right)) = |
| 8001 |
"normal" then |
| 8002 |
Result := ARM_Output.Normal; |
| 8003 |
else |
| 8004 |
Ada.Text_IO.Put_Line (" ** Bad type for paragraph type: " & |
| 8005 |
Ada.Strings.Fixed.Trim (Type_Name, Ada.Strings.Right) & |
| 8006 |
" on line " & ARM_Input.Line_String (Input_Object)); |
| 8007 |
end if; |
| 8008 |
return Result; |
| 8009 |
end Read_Type; |
| 8010 |
|
| 8011 |
begin |
| 8012 |
-- These are not allowed in other @Chg commands. |
| 8013 |
if Format_Object.In_Change then |
| 8014 |
Ada.Text_IO.Put_Line ("** ChgAdded/ChgDeleted nested in other Chg, line " & ARM_Input.Line_String (Input_Object)); |
| 8015 |
end if; |
| 8016 |
|
| 8017 |
Get_Change_Version (Is_First => True, |
| 8018 |
Version => Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Change_Version); |
| 8019 |
-- Read a parameter named "Version". |
| 8020 |
|
| 8021 |
loop |
| 8022 |
-- Handle the optional parameters; stop on Text. |
| 8023 |
ARM_Input.Check_One_of_Parameter_Names (Input_Object, |
| 8024 |
Param_Name_1 => "NoPrefix" & (9..ARM_Input.Command_Name_Type'Last => ' '), |
| 8025 |
Param_Name_2 => "NoParanum" & (10..ARM_Input.Command_Name_Type'Last => ' '), |
| 8026 |
Param_Name_3 => "Type" & (5..ARM_Input.Command_Name_Type'Last => ' '), |
| 8027 |
Param_Name_4 => "Keepnext" & (9..ARM_Input.Command_Name_Type'Last => ' '), |
| 8028 |
Param_Name_5 => "Text" & (5..ARM_Input.Command_Name_Type'Last => ' '), |
| 8029 |
Is_First => False, |
| 8030 |
Param_Found => Which_Param, |
| 8031 |
Param_Close_Bracket => Close_Ch); |
| 8032 |
|
| 8033 |
if Which_Param = 1 and then Close_Ch /= ' ' then |
| 8034 |
NoPrefix := Read_Boolean (Close_Ch, "NoPrefix"); |
| 8035 |
elsif Which_Param = 2 and then Close_Ch /= ' ' then |
| 8036 |
NoParanum := Read_Boolean (Close_Ch, "NoParanum"); |
| 8037 |
elsif Which_Param = 3 and then Close_Ch /= ' ' then |
| 8038 |
Space_After := Read_Type (Close_Ch); |
| 8039 |
elsif Which_Param = 4 and then Close_Ch /= ' ' then |
| 8040 |
Keepnext := Read_Boolean (Close_Ch, "KeepNext"); |
| 8041 |
else |
| 8042 |
exit; -- We found "Text" (or an error) |
| 8043 |
end if; |
| 8044 |
end loop; |
| 8045 |
|
| 8046 |
if Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Command = Change_Added and then |
| 8047 |
Close_Ch /= ' ' then |
| 8048 |
-- Generate an insertion, there is a Text parameter. |
| 8049 |
|
| 8050 |
Calc_Change_Disposition ( |
| 8051 |
Format_Object => Format_Object, |
| 8052 |
Version => Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Change_Version, |
| 8053 |
Operation => ARM_Output.Insertion, |
| 8054 |
Text_Kind => Disposition); |
| 8055 |
|
| 8056 |
-- Stack the parameter so we can process the end: |
| 8057 |
Set_Nesting_for_Parameter |
| 8058 |
(Command => Change_Added_Param, |
| 8059 |
Close_Ch => Close_Ch); |
| 8060 |
|
| 8061 |
Format_Object.In_Change := True; |
| 8062 |
|
| 8063 |
if Disposition = Do_Not_Display_Text then |
| 8064 |
-- Skip the text: |
| 8065 |
ARM_Input.Skip_until_Close_Char (Input_Object, |
| 8066 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Close_Char); |
| 8067 |
ARM_Input.Replace_Char (Input_Object); -- Let the normal termination clean this up. |
| 8068 |
elsif Disposition = ARM_Output.None then |
| 8069 |
-- Display the text normally. |
| 8070 |
Format_Object.No_Prefix := NoPrefix; |
| 8071 |
Format_Object.No_Para_Num := NoParanum; |
| 8072 |
Format_Object.Keep_with_Next := KeepNext; |
| 8073 |
Format_Object.Space_After := Space_After; |
| 8074 |
elsif Disposition = ARM_Output.Deletion then |
| 8075 |
raise Program_Error; -- A deletion inside of an insertion command! |
| 8076 |
else -- Insertion. |
| 8077 |
Format_Object.No_Prefix := NoPrefix; |
| 8078 |
Format_Object.No_Para_Num := NoParanum; |
| 8079 |
Format_Object.Keep_with_Next := KeepNext; |
| 8080 |
Format_Object.Space_After := Space_After; |
| 8081 |
-- We assume non-empty text and no outer changes; |
| 8082 |
-- set new change state: |
| 8083 |
Format_Object.Text_Format.Change := ARM_Output.Insertion; |
| 8084 |
Format_Object.Text_Format.Version := |
| 8085 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr-1).Change_Version; |
| 8086 |
Format_Object.Text_Format.Added_Version := '0'; |
| 8087 |
Check_Paragraph; -- Change the state *before* outputting the |
| 8088 |
-- paragraph header, so the AARM prefix is included. |
| 8089 |
ARM_Output.Text_Format (Output_Object, |
| 8090 |
Format_Object.Text_Format); -- Reset style. |
| 8091 |
end if; |
| 8092 |
|
| 8093 |
elsif Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Command = Change_Deleted and then |
| 8094 |
Close_Ch /= ' ' then |
| 8095 |
-- Generate a deletion. |
| 8096 |
|
| 8097 |
Calc_Change_Disposition ( |
| 8098 |
Format_Object => Format_Object, |
| 8099 |
Version => Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Change_Version, |
| 8100 |
Operation => ARM_Output.Deletion, |
| 8101 |
Text_Kind => Disposition); |
| 8102 |
|
| 8103 |
-- Stack the parameter so we can process the end: |
| 8104 |
Set_Nesting_for_Parameter |
| 8105 |
(Command => Change_Deleted_Param, |
| 8106 |
Close_Ch => Close_Ch); |
| 8107 |
|
| 8108 |
Format_Object.In_Change := True; |
| 8109 |
|
| 8110 |
if Disposition = Do_Not_Display_Text then |
| 8111 |
-- Skip the text: |
| 8112 |
ARM_Input.Skip_until_Close_Char (Input_Object, |
| 8113 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Close_Char); |
| 8114 |
ARM_Input.Replace_Char (Input_Object); -- Let the normal termination clean this up. |
| 8115 |
if ARM_Database."=" (Format_Object.Next_Paragraph_Change_Kind, |
| 8116 |
ARM_Database.Deleted) or else |
| 8117 |
ARM_Database."=" (Format_Object.Next_Paragraph_Change_Kind, |
| 8118 |
ARM_Database.Deleted_Inserted_Number) or else |
| 8119 |
ARM_Database."=" (Format_Object.Next_Paragraph_Change_Kind, |
| 8120 |
ARM_Database.Deleted_No_Delete_Message) or else |
| 8121 |
ARM_Database."=" (Format_Object.Next_Paragraph_Change_Kind, |
| 8122 |
ARM_Database.Deleted_Inserted_Number_No_Delete_Message) then |
| 8123 |
-- In a deleted paragraph, call Check_Paragraph |
| 8124 |
-- to trigger the "deleted paragraph" message and |
| 8125 |
-- increment the paragraph number. |
| 8126 |
-- (Otherwise, this may never happen.) |
| 8127 |
Format_Object.No_Para_Num := NoParanum; |
| 8128 |
Check_Paragraph; |
| 8129 |
-- else null; -- Nothing special to do. |
| 8130 |
end if; |
| 8131 |
elsif Disposition = ARM_Output.None then |
| 8132 |
-- Display the text normally. |
| 8133 |
Format_Object.No_Prefix := NoPrefix; |
| 8134 |
Format_Object.No_Para_Num := NoParanum; |
| 8135 |
Format_Object.Keep_with_Next := KeepNext; |
| 8136 |
Format_Object.Space_After := Space_After; |
| 8137 |
elsif Disposition = ARM_Output.Insertion then |
| 8138 |
raise Program_Error; -- An insertion inside of a deletion command! |
| 8139 |
else -- Deletion. |
| 8140 |
if Format_Object.Changes = ARM_Format.New_Changes then |
| 8141 |
-- Special case: we ignore the deleted text, but mark its presence. |
| 8142 |
-- We assume that the text is non-empty; |
| 8143 |
-- set the new change state. |
| 8144 |
-- Note: We ignore the formatting here! |
| 8145 |
Format_Object.No_Prefix := True; |
| 8146 |
Format_Object.No_Para_Num := NoParanum; |
| 8147 |
Format_Object.Text_Format.Change := ARM_Output.Deletion; |
| 8148 |
Format_Object.Text_Format.Version := |
| 8149 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr-1).Change_Version; |
| 8150 |
Format_Object.Text_Format.Added_Version := '0'; |
| 8151 |
Check_Paragraph; -- Output the paragraph headers *after* changing the state, |
| 8152 |
-- so that AARM headers are marked. |
| 8153 |
ARM_Output.Text_Format (Output_Object, |
| 8154 |
Format_Object.Text_Format); -- Reset style. |
| 8155 |
|
| 8156 |
ARM_Output.Ordinary_Character (Output_Object, ' '); |
| 8157 |
-- Skip the text (we're not going to output it): |
| 8158 |
ARM_Input.Skip_until_Close_Char (Input_Object, Close_Ch); |
| 8159 |
ARM_Input.Replace_Char (Input_Object); -- Let the normal termination clean this up. |
| 8160 |
|
| 8161 |
else -- Normal. |
| 8162 |
-- We assume that the text is non-empty; |
| 8163 |
-- set the new change state and formatting. |
| 8164 |
Format_Object.No_Prefix := NoPrefix; |
| 8165 |
Format_Object.No_Para_Num := NoParanum; |
| 8166 |
Format_Object.Keep_with_Next := KeepNext; |
| 8167 |
Format_Object.Space_After := Space_After; |
| 8168 |
|
| 8169 |
Format_Object.Text_Format.Change := ARM_Output.Deletion; |
| 8170 |
Format_Object.Text_Format.Version := |
| 8171 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr-1).Change_Version; |
| 8172 |
Format_Object.Text_Format.Added_Version := '0'; |
| 8173 |
Check_Paragraph; -- Output the paragraph headers *after* changing the state, |
| 8174 |
-- so that AARM headers are marked. |
| 8175 |
ARM_Output.Text_Format (Output_Object, |
| 8176 |
Format_Object.Text_Format); -- Reset style. |
| 8177 |
end if; |
| 8178 |
end if; |
| 8179 |
-- else no parameter; previous error. |
| 8180 |
end if; |
| 8181 |
end; |
| 8182 |
|
| 8183 |
when Change_Added_Param | Change_Deleted_Param => |
| 8184 |
-- These can't get here; they represent the parameter of |
| 8185 |
-- "Change_Added" and "Change_Deleted" and can't be generated explicitly. |
| 8186 |
Ada.Text_IO.Put_Line (" ** Change_xxx parameter command?? on line " & ARM_Input.Line_String (Input_Object)); |
| 8187 |
|
| 8188 |
when Table_Param_Caption | Table_Param_Header | Table_Param_Body => |
| 8189 |
-- These can't get here; they represent the parameters of |
| 8190 |
-- "Table" and can't be generated explicitly. |
| 8191 |
Ada.Text_IO.Put_Line (" ** Table parameter command?? on line " & ARM_Input.Line_String (Input_Object)); |
| 8192 |
|
| 8193 |
when Syntax_Rule_RHS => |
| 8194 |
-- This can't get here; it represents the second parameter of |
| 8195 |
-- "Syn" and can't be generated explicitly. |
| 8196 |
Ada.Text_IO.Put_Line (" ** Syntax parameter command?? on line " & ARM_Input.Line_String (Input_Object)); |
| 8197 |
|
| 8198 |
when Glossary_Text_Param => |
| 8199 |
-- This can't get here; it represents the second parameter of |
| 8200 |
-- "ToGlossary" and can't be generated explicitly. |
| 8201 |
Ada.Text_IO.Put_Line (" ** Glossary parameter command?? on line " & ARM_Input.Line_String (Input_Object)); |
| 8202 |
|
| 8203 |
when Attribute_Text_Param => |
| 8204 |
-- This can't get here; it represents the third parameter of |
| 8205 |
-- "Attribute" and can't be generated explicitly. |
| 8206 |
Ada.Text_IO.Put_Line (" ** Attribute parameter command?? on line " & ARM_Input.Line_String (Input_Object)); |
| 8207 |
|
| 8208 |
when Change_Impdef_Text_Param => |
| 8209 |
-- This can't get here; it represents the third parameter of |
| 8210 |
-- "ChgImpldef" and can't be generated explicitly. |
| 8211 |
Ada.Text_IO.Put_Line (" ** Impdef parameter command?? on line " & ARM_Input.Line_String (Input_Object)); |
| 8212 |
|
| 8213 |
when Change_Impladv_Text_Param => |
| 8214 |
-- This can't get here; it represents the third parameter of |
| 8215 |
-- "ChgImpladvice" and can't be generated explicitly. |
| 8216 |
Ada.Text_IO.Put_Line (" ** Impladv parameter command?? on line " & ARM_Input.Line_String (Input_Object)); |
| 8217 |
|
| 8218 |
when Change_Docreq_Text_Param => |
| 8219 |
-- This can't get here; it represents the third parameter of |
| 8220 |
-- "ChgDocReq" and can't be generated explicitly. |
| 8221 |
Ada.Text_IO.Put_Line (" ** Docreq parameter command?? on line " & ARM_Input.Line_String (Input_Object)); |
| 8222 |
|
| 8223 |
when Change_AspectDesc_Text_Param => |
| 8224 |
-- This can't get here; it represents the fourth parameter of |
| 8225 |
-- "ChgAspectDesc" and can't be generated explicitly. |
| 8226 |
Ada.Text_IO.Put_Line (" ** AspectDesc parameter command?? on line " & ARM_Input.Line_String (Input_Object)); |
| 8227 |
|
| 8228 |
when Change_Prefix_Text_Param => |
| 8229 |
-- This can't get here; it represents the second parameter of |
| 8230 |
-- "ChgPrefixType" and can't be generated explicitly. |
| 8231 |
Ada.Text_IO.Put_Line (" ** ChgPrefix parameter command?? on line " & ARM_Input.Line_String (Input_Object)); |
| 8232 |
|
| 8233 |
when Change_Reference => |
| 8234 |
-- This command is of the form: |
| 8235 |
-- @chgref{Version=[<version>], Kind=(<kind>) |
| 8236 |
-- {,Ref=(<DR_Number>)}{,ARef=(<AI_Number>)}} |
| 8237 |
-- where <version> is a single character, <Kind> is one |
| 8238 |
-- of Revised, Added, or Deleted, followed by zero or more |
| 8239 |
-- DR references, and finally zero or more AI references. |
| 8240 |
-- As usual, any of the allowed bracketing characters can |
| 8241 |
-- be used. |
| 8242 |
|
| 8243 |
declare |
| 8244 |
Ch : Character; |
| 8245 |
Kind : ARM_Database.Paragraph_Change_Kind_Type; |
| 8246 |
Version : ARM_Contents.Change_Version_Type; |
| 8247 |
Display_It : Boolean; |
| 8248 |
begin |
| 8249 |
Get_Change_Version (Is_First => True, |
| 8250 |
Version => Version); |
| 8251 |
-- Read a parameter named "Version". |
| 8252 |
|
| 8253 |
Get_Change_Kind (Kind); |
| 8254 |
-- Read a parameter named "Kind". |
| 8255 |
|
| 8256 |
if Version <= Format_Object.Change_Version then |
| 8257 |
Format_Object.Next_Paragraph_Version := Version; |
| 8258 |
Format_Object.Next_Paragraph_Change_Kind := Kind; |
| 8259 |
if (ARM_Database."=" (Kind, ARM_Database.Deleted_No_Delete_Message) or else |
| 8260 |
ARM_Database."=" (Kind, ARM_Database.Deleted_Inserted_Number_No_Delete_Message)) and then |
| 8261 |
ARM_Format."=" (Format_Object.Changes, ARM_Format.New_Only) then |
| 8262 |
-- In this case, display nothing, period. |
| 8263 |
Display_It := False; |
| 8264 |
-- Check if any Ref's already exist; remove them |
| 8265 |
-- if they do. %% Ugly: This is needed if |
| 8266 |
-- a paragraph is first revised, then deleted, |
| 8267 |
-- as in 4.6. There ought to be a better way |
| 8268 |
-- of handling this, not sure what it is. |
| 8269 |
Dump_References (Format_Object.References); |
| 8270 |
elsif (ARM_Database."=" (Kind, ARM_Database.Deleted) or else |
| 8271 |
ARM_Database."=" (Kind, ARM_Database.Deleted_Inserted_Number)) and then |
| 8272 |
ARM_Format."=" (Format_Object.Changes, ARM_Format.New_Only) and then |
| 8273 |
(not Format_Object.Number_Paragraphs) then |
| 8274 |
-- No delete messages ever in this case, so |
| 8275 |
-- display nothing, period. |
| 8276 |
Display_It := False; |
| 8277 |
-- Check if any Ref's already exist; see above. |
| 8278 |
Dump_References (Format_Object.References); |
| 8279 |
else |
| 8280 |
Display_It := Format_Object.Include_Annotations; |
| 8281 |
end if; |
| 8282 |
else --This reference is too new, ignore it. |
| 8283 |
Display_It := False; |
| 8284 |
end if; |
| 8285 |
|
| 8286 |
-- Handle zero or more "Ref" parameters. |
| 8287 |
loop |
| 8288 |
ARM_Input.Get_Char (Input_Object, Ch); |
| 8289 |
if Ch /= ',' then |
| 8290 |
exit; -- No more commands. |
| 8291 |
else |
| 8292 |
ARM_Input.Replace_Char (Input_Object); |
| 8293 |
end if; |
| 8294 |
Gen_Ref_or_ARef_Parameter (Display_It); |
| 8295 |
-- Read (and possibly generate) a "Ref" or "ARef" parameter. |
| 8296 |
end loop; |
| 8297 |
|
| 8298 |
-- Now, close the command. |
| 8299 |
-- Ch was read when checking for commas, above. |
| 8300 |
if Ch /= Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Close_Char then |
| 8301 |
Ada.Text_IO.Put_Line (" ** Bad close for Chgref on line " & ARM_Input.Line_String (Input_Object)); |
| 8302 |
ARM_Input.Replace_Char (Input_Object); |
| 8303 |
end if; |
| 8304 |
Format_State.Nesting_Stack_Ptr := Format_State.Nesting_Stack_Ptr - 1; |
| 8305 |
-- Remove the "Change_Reference" record. |
| 8306 |
end; |
| 8307 |
|
| 8308 |
when Change_Note => |
| 8309 |
-- Skip the contents of this command. |
| 8310 |
ARM_Input.Skip_until_Close_Char (Input_Object, |
| 8311 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Close_Char, |
| 8312 |
Exit_on_Para_End => False); |
| 8313 |
Format_State.Nesting_Stack_Ptr := Format_State.Nesting_Stack_Ptr - 1; |
| 8314 |
-- Remove the "Change_Note" record. |
| 8315 |
|
| 8316 |
when Change_Implementation_Defined => |
| 8317 |
-- This command is of the form: |
| 8318 |
-- @chgimpldef{Version=[<version>], Kind=(<kind>), |
| 8319 |
-- Text=(<text>)}} |
| 8320 |
-- where <version> is a single character, <Kind> is one |
| 8321 |
-- of Revised, Added, or Deleted, and this is followed |
| 8322 |
-- by the text. As usual, any of the |
| 8323 |
-- allowed bracketing characters can be used. |
| 8324 |
Gen_Chg_xxxx (Param_Cmd => Change_Impdef_Text_Param, |
| 8325 |
AARM_Prefix => "Implementation defined: "); |
| 8326 |
|
| 8327 |
when Change_Implementation_Advice => |
| 8328 |
-- This command is of the form: |
| 8329 |
-- @chgimpladvice{Version=[<version>], Kind=(<kind>), |
| 8330 |
-- Text=(<text>)}} |
| 8331 |
-- where <version> is a single character, <Kind> is one |
| 8332 |
-- of Revised, Added, or Deleted, and this is followed |
| 8333 |
-- by the text. As usual, any of the |
| 8334 |
-- allowed bracketing characters can be used. |
| 8335 |
Gen_Chg_xxxx (Param_Cmd => Change_Impladv_Text_Param, |
| 8336 |
AARM_Prefix => "Implementation Advice: "); |
| 8337 |
|
| 8338 |
when Change_Documentation_Requirement => |
| 8339 |
-- This command is of the form: |
| 8340 |
-- @chgdocreq{Version=[<version>], Kind=(<kind>), |
| 8341 |
-- Text=(<text>)}} |
| 8342 |
-- where <version> is a single character, <Kind> is one |
| 8343 |
-- of Revised, Added, or Deleted, and this is followed |
| 8344 |
-- by the text. As usual, any of the |
| 8345 |
-- allowed bracketing characters can be used. |
| 8346 |
Gen_Chg_xxxx (Param_Cmd => Change_Docreq_Text_Param, |
| 8347 |
AARM_Prefix => "Documentation Requirement: "); |
| 8348 |
|
| 8349 |
when Change_Aspect_Description => |
| 8350 |
-- This command is of the form: |
| 8351 |
-- @chgaspectdesc{Version=[<version>], Kind=(<kind>), |
| 8352 |
-- Aspect=[<name>],Text=(<text>)}} |
| 8353 |
-- where <version> is a single character, <Kind> is one |
| 8354 |
-- of Revised, Added, or Deleted, <Name> is the aspect |
| 8355 |
-- name, and this is followed |
| 8356 |
-- by the text. As usual, any of the |
| 8357 |
-- allowed bracketing characters can be used. |
| 8358 |
Gen_Chg_xxxx (Param_Cmd => Change_AspectDesc_Text_Param, |
| 8359 |
AARM_Prefix => "Aspect Description for "); |
| 8360 |
|
| 8361 |
when Change_Attribute => |
| 8362 |
-- @ChgAttribute{Version=[<version>], Kind=(<kind>), |
| 8363 |
-- Chginannex=[T|F],Leading=[T|F], |
| 8364 |
-- Prefix=<Prefix>,AttrName=<Name>, |
| 8365 |
-- {[A]Ref=[<DR_Number>],} |
| 8366 |
-- [InitialVersion=[<>],][OmitAnnex=[T|F],]Text=<Text>} |
| 8367 |
-- Defines a changed attribute. |
| 8368 |
declare |
| 8369 |
Close_Ch : Character; |
| 8370 |
Key : ARM_Index.Index_Key; |
| 8371 |
Chg_in_Annex : Boolean; |
| 8372 |
Is_Leading : Boolean; |
| 8373 |
Kind : ARM_Database.Paragraph_Change_Kind_Type; |
| 8374 |
Version : ARM_Contents.Change_Version_Type; |
| 8375 |
InitialVersion : ARM_Contents.Change_Version_Type; |
| 8376 |
Omit_from_Annex : Boolean := False; |
| 8377 |
Display_Ref : Boolean; |
| 8378 |
References : Reference_Ptr := null; |
| 8379 |
|
| 8380 |
|
| 8381 |
procedure Make_Attribute_Text is |
| 8382 |
-- Generate the attribute text. |
| 8383 |
-- Output <Prefix>'<Name> as the hanging text. |
| 8384 |
-- Generate the needed index entries. |
| 8385 |
begin |
| 8386 |
Check_Paragraph; |
| 8387 |
ARM_Output.Ordinary_Text (Output_Object, |
| 8388 |
Format_Object.Attr_Prefix (1 .. Format_Object.Attr_Prefix_Len)); |
| 8389 |
ARM_Output.Ordinary_Character (Output_Object, '''); |
| 8390 |
ARM_Output.Ordinary_Text (Output_Object, |
| 8391 |
Format_Object.Attr_Name (1 .. Format_Object.Attr_Name_Len)); |
| 8392 |
ARM_Output.End_Hang_Item (Output_Object); |
| 8393 |
Format_Object.Last_Non_Space := False; -- Treat like start of a line. |
| 8394 |
|
| 8395 |
ARM_Index.Add (Term => "attributes", |
| 8396 |
Subterm => Format_Object.Attr_Name (1 .. Format_Object.Attr_Name_Len), |
| 8397 |
Kind => ARM_Index.Primary_Term_and_Subterm, |
| 8398 |
Clause => Clause_String (Format_Object), |
| 8399 |
Paragraph => Paragraph_String, |
| 8400 |
Key => Key); |
| 8401 |
ARM_Output.Index_Target (Output_Object, Key); |
| 8402 |
|
| 8403 |
ARM_Index.Add (Term => Format_Object.Attr_Name (1 .. Format_Object.Attr_Name_Len) & " attribute", |
| 8404 |
Kind => ARM_Index.Primary_Term, |
| 8405 |
Clause => Clause_String (Format_Object), |
| 8406 |
Paragraph => Paragraph_String, |
| 8407 |
Key => Key); |
| 8408 |
ARM_Output.Index_Target (Output_Object, Key); |
| 8409 |
|
| 8410 |
Make_References (References, Format_Object, Output_Object); |
| 8411 |
|
| 8412 |
end Make_Attribute_Text; |
| 8413 |
|
| 8414 |
begin |
| 8415 |
Check_End_Paragraph; -- This is always a paragraph end. |
| 8416 |
|
| 8417 |
-- No NoPrefix should carry into here (there is always |
| 8418 |
-- a hanging item here): |
| 8419 |
Format_Object.No_Prefix := False; |
| 8420 |
-- This shouldn't happen, but if it does, just get |
| 8421 |
-- rid of it rather than crashing. |
| 8422 |
|
| 8423 |
Get_Change_Version (Is_First => True, |
| 8424 |
Version => Version); |
| 8425 |
-- Read a parameter named "Version". |
| 8426 |
|
| 8427 |
Get_Change_Kind (Kind); |
| 8428 |
-- Read a parameter named "Kind". |
| 8429 |
|
| 8430 |
if Version <= Format_Object.Change_Version then |
| 8431 |
Format_Object.Next_Paragraph_Version := Version; |
| 8432 |
Format_Object.Next_Paragraph_Change_Kind := Kind; |
| 8433 |
if (ARM_Database."=" (Kind, ARM_Database.Deleted_No_Delete_Message) or else |
| 8434 |
ARM_Database."=" (Kind, ARM_Database.Deleted_Inserted_Number_No_Delete_Message)) and then |
| 8435 |
ARM_Format."=" (Format_Object.Changes, ARM_Format.New_Only) then |
| 8436 |
-- In this case, display nothing, period. |
| 8437 |
Display_Ref := False; |
| 8438 |
else |
| 8439 |
Display_Ref := Format_Object.Include_Annotations; |
| 8440 |
end if; |
| 8441 |
else --This reference is too new, ignore it. |
| 8442 |
Display_Ref := False; |
| 8443 |
end if; |
| 8444 |
|
| 8445 |
Get_Boolean ("ChginAnnex" & (11..ARM_Input.Command_Name_Type'Last => ' '), |
| 8446 |
Chg_in_Annex); |
| 8447 |
-- Read a boolean parameter. |
| 8448 |
|
| 8449 |
if Chg_in_Annex then |
| 8450 |
Format_Object.Attr_Change_Kind := Kind; |
| 8451 |
Format_Object.Attr_Version := Version; |
| 8452 |
else -- don't save the change info.; it only applies here. |
| 8453 |
Format_Object.Attr_Change_Kind := ARM_Database.None; |
| 8454 |
Format_Object.Attr_Version := '0'; |
| 8455 |
Format_Object.Attr_Initial_Version := '0'; |
| 8456 |
end if; |
| 8457 |
|
| 8458 |
Get_Boolean ("Leading" & (8..ARM_Input.Command_Name_Type'Last => ' '), |
| 8459 |
Is_Leading); |
| 8460 |
-- Read a boolean parameter. |
| 8461 |
|
| 8462 |
if Is_Leading then |
| 8463 |
Format_Object.Space_After := ARM_Output.Narrow; |
| 8464 |
Format_Object.Attr_Leading := True; |
| 8465 |
else |
| 8466 |
Format_Object.Space_After := ARM_Output.Normal; |
| 8467 |
Format_Object.Attr_Leading := False; |
| 8468 |
end if; |
| 8469 |
|
| 8470 |
ARM_Input.Check_Parameter_Name (Input_Object, |
| 8471 |
Param_Name => "Prefix" & (7..ARM_Input.Command_Name_Type'Last => ' '), |
| 8472 |
Is_First => False, |
| 8473 |
Param_Close_Bracket => Close_Ch); |
| 8474 |
if Close_Ch /= ' ' then |
| 8475 |
-- Save prefix: |
| 8476 |
ARM_Input.Copy_to_String_until_Close_Char ( |
| 8477 |
Input_Object, |
| 8478 |
Close_Ch, |
| 8479 |
Format_Object.Attr_Prefix, |
| 8480 |
Format_Object.Attr_Prefix_Len); |
| 8481 |
-- else no parameter. Weird. |
| 8482 |
end if; |
| 8483 |
|
| 8484 |
ARM_Input.Check_Parameter_Name (Input_Object, |
| 8485 |
Param_Name => "AttrName" & (9..ARM_Input.Command_Name_Type'Last => ' '), |
| 8486 |
Is_First => False, |
| 8487 |
Param_Close_Bracket => Close_Ch); |
| 8488 |
if Close_Ch /= ' ' then |
| 8489 |
-- Save name: |
| 8490 |
ARM_Input.Copy_to_String_until_Close_Char ( |
| 8491 |
Input_Object, |
| 8492 |
Close_Ch, |
| 8493 |
Format_Object.Attr_Name, |
| 8494 |
Format_Object.Attr_Name_Len); |
| 8495 |
-- else no parameter. Weird. |
| 8496 |
end if; |
| 8497 |
|
| 8498 |
-- Handle the Ref, ARef, and InitialVersion parameters, |
| 8499 |
-- until the Text parameter shows up. |
| 8500 |
|
| 8501 |
-- Note: If there is no InitialVersion command, use the |
| 8502 |
-- value of Version. |
| 8503 |
InitialVersion := Version; |
| 8504 |
declare |
| 8505 |
Which_Param : ARM_Input.Param_Num; |
| 8506 |
Ch : Character; |
| 8507 |
begin |
| 8508 |
loop |
| 8509 |
ARM_Input.Check_One_of_Parameter_Names (Input_Object, |
| 8510 |
Param_Name_1 => "Ref" & (4..ARM_Input.Command_Name_Type'Last => ' '), |
| 8511 |
Param_Name_2 => "ARef" & (5..ARM_Input.Command_Name_Type'Last => ' '), |
| 8512 |
Param_Name_3 => "InitialVersion" & (15..ARM_Input.Command_Name_Type'Last => ' '), |
| 8513 |
Param_Name_4 => "OmitAnnex" & (10..ARM_Input.Command_Name_Type'Last => ' '), |
| 8514 |
Param_Name_5 => "Text" & (5..ARM_Input.Command_Name_Type'Last => ' '), |
| 8515 |
Is_First => False, |
| 8516 |
Param_Found => Which_Param, |
| 8517 |
Param_Close_Bracket => Close_Ch); |
| 8518 |
if (Which_Param = 1 or else Which_Param = 2) and then |
| 8519 |
Close_Ch /= ' ' then |
| 8520 |
declare |
| 8521 |
Ref_Name : ARM_Input.Command_Name_Type; |
| 8522 |
Len : Natural := 0; |
| 8523 |
New_Ref, Cursor : Reference_Ptr; |
| 8524 |
Ch : Character; |
| 8525 |
begin |
| 8526 |
-- Get the reference: |
| 8527 |
loop |
| 8528 |
ARM_Input.Get_Char (Input_Object, Ch); |
| 8529 |
if Ch /= Close_Ch then |
| 8530 |
Len := Len + 1; |
| 8531 |
if Len > Ref_Name'Last then |
| 8532 |
Ada.Text_IO.Put_Line (" ** Reference too long on line " & ARM_Input.Line_String (Input_Object)); |
| 8533 |
else |
| 8534 |
Ref_Name(Len) := Ch; |
| 8535 |
end if; |
| 8536 |
else -- End of the reference. |
| 8537 |
if Len = 0 then |
| 8538 |
Ada.Text_IO.Put_Line (" ** Failed to find reference on line " & ARM_Input.Line_String (Input_Object)); |
| 8539 |
end if; |
| 8540 |
exit; |
| 8541 |
end if; |
| 8542 |
end loop; |
| 8543 |
|
| 8544 |
if Display_Ref then |
| 8545 |
-- Save a reference for outputting |
| 8546 |
-- later. |
| 8547 |
New_Ref := Allocate_Reference; |
| 8548 |
New_Ref.all := (Ref_Name => Ref_Name, |
| 8549 |
Ref_Len => Len, |
| 8550 |
Is_DR_Ref => (Which_Param = 1), |
| 8551 |
-- DR reference if Param = 1; |
| 8552 |
-- AI reference otherwise. |
| 8553 |
Next => null); |
| 8554 |
-- Attach this to the *end* of the list. |
| 8555 |
if References = null then |
| 8556 |
References := New_Ref; |
| 8557 |
else |
| 8558 |
Cursor := References; |
| 8559 |
while Cursor.Next /= null loop |
| 8560 |
Cursor := Cursor.next; |
| 8561 |
end loop; |
| 8562 |
Cursor.Next := New_Ref; |
| 8563 |
end if; |
| 8564 |
-- else don't display it. |
| 8565 |
end if; |
| 8566 |
end; |
| 8567 |
elsif Which_Param = 3 and then Close_Ch /= ' ' then |
| 8568 |
-- Found InitialVersion |
| 8569 |
ARM_Input.Get_Char (Input_Object, Ch); |
| 8570 |
InitialVersion := Ch; |
| 8571 |
ARM_Input.Get_Char (Input_Object, Ch); |
| 8572 |
if Ch /= Close_Ch then |
| 8573 |
Ada.Text_IO.Put_Line (" ** Bad close for InitialVersion parameter on line " & |
| 8574 |
ARM_Input.Line_String (Input_Object)); |
| 8575 |
ARM_Input.Replace_Char (Input_Object); |
| 8576 |
end if; |
| 8577 |
elsif Which_Param = 4 and then Close_Ch /= ' ' then |
| 8578 |
-- Found OmitAnnex |
| 8579 |
ARM_Input.Get_Char (Input_Object, Ch); |
| 8580 |
case Ch is |
| 8581 |
when 'F' | 'f' | 'N' | 'n' => |
| 8582 |
Omit_from_Annex := False; |
| 8583 |
when 'T' | 't' | 'Y' | 'y' => |
| 8584 |
Omit_from_Annex := True; |
| 8585 |
when others => |
| 8586 |
Ada.Text_IO.Put_Line (" ** Bad value for boolean parameter OmitAnnex on line " & |
| 8587 |
" on line " & ARM_Input.Line_String (Input_Object)); |
| 8588 |
end case; |
| 8589 |
ARM_Input.Get_Char (Input_Object, Ch); |
| 8590 |
if Ch /= Close_Ch then |
| 8591 |
Ada.Text_IO.Put_Line (" ** Bad close for OmitAnnex parameter on line " & |
| 8592 |
ARM_Input.Line_String (Input_Object)); |
| 8593 |
ARM_Input.Replace_Char (Input_Object); |
| 8594 |
end if; |
| 8595 |
else |
| 8596 |
exit; -- We found "Text" (or an error) |
| 8597 |
end if; |
| 8598 |
end loop; |
| 8599 |
end; |
| 8600 |
|
| 8601 |
--**Debug: |
| 8602 |
--Ada.Text_IO.Put_Line ("ChgAttr on line " & ARM_Input.Line_String (Input_Object) & |
| 8603 |
-- "; Vers=" & Version & "; InitVer=" & InitialVersion & "; Kind=" & ARM_Database.Paragraph_Change_Kind_Type'Image(Format_Object.Attr_Change_Kind)); |
| 8604 |
--Ada.Text_IO.Put_Line (" Omit=" & Boolean'Image(Omit_from_Annex)); |
| 8605 |
if ARM_Database."/=" (Format_Object.Attr_Change_Kind, ARM_Database.None) then |
| 8606 |
Format_Object.Attr_Initial_Version := InitialVersion; |
| 8607 |
Format_Object.Attr_Omit := Omit_from_Annex; |
| 8608 |
-- else ChginAnnex is False, don't care about this. |
| 8609 |
end if; |
| 8610 |
|
| 8611 |
-- How the prefix (attribute name) is handled depends |
| 8612 |
-- primarily on the InitialVersion and its relationship |
| 8613 |
-- to the version we're generating. It only depends on |
| 8614 |
-- the (current) change kind to determine whether the |
| 8615 |
-- item is deleted (it is treated as inserted otherwise). |
| 8616 |
|
| 8617 |
if Close_Ch /= ' ' then -- We have a parameter: |
| 8618 |
|
| 8619 |
-- Stack the parameter so we can process the end: |
| 8620 |
Set_Nesting_for_Parameter |
| 8621 |
(Command => Attribute_Text_Param, |
| 8622 |
Close_Ch => Close_Ch); |
| 8623 |
|
| 8624 |
declare |
| 8625 |
Insert_Disposition : ARM_Output.Change_Type; |
| 8626 |
Delete_Disposition : ARM_Output.Change_Type; |
| 8627 |
use type ARM_Output.Change_Type; |
| 8628 |
begin |
| 8629 |
-- First, we calculate the insertion |
| 8630 |
-- disposition. This only depends upon the |
| 8631 |
-- original number and what we're generating: |
| 8632 |
if InitialVersion = '0' then -- Original, |
| 8633 |
-- never inserted. |
| 8634 |
Insert_Disposition := ARM_Output.None; |
| 8635 |
else |
| 8636 |
Calc_Change_Disposition ( |
| 8637 |
Format_Object => Format_Object, |
| 8638 |
Version => InitialVersion, |
| 8639 |
Operation => ARM_Output.Insertion, |
| 8640 |
Text_Kind => Insert_Disposition); |
| 8641 |
end if; |
| 8642 |
|
| 8643 |
if (ARM_Database."=" (Kind, ARM_Database.Deleted_No_Delete_Message) or else |
| 8644 |
ARM_Database."=" (Kind, ARM_Database.Deleted_Inserted_Number_No_Delete_Message) or else |
| 8645 |
ARM_Database."=" (Kind, ARM_Database.Deleted) or else |
| 8646 |
ARM_Database."=" (Kind, ARM_Database.Deleted_Inserted_Number)) then |
| 8647 |
-- The current version is some sort of delete: |
| 8648 |
Calc_Change_Disposition ( |
| 8649 |
Format_Object => Format_Object, |
| 8650 |
Version => Version, |
| 8651 |
Operation => ARM_Output.Deletion, |
| 8652 |
Text_Kind => Delete_Disposition); |
| 8653 |
else |
| 8654 |
Delete_Disposition := ARM_Output.None; |
| 8655 |
end if; |
| 8656 |
|
| 8657 |
|
| 8658 |
if Delete_Disposition = Do_Not_Display_Text or else |
| 8659 |
(Delete_Disposition = ARM_Output.None and then |
| 8660 |
Insert_Disposition = Do_Not_Display_Text) then |
| 8661 |
|
| 8662 |
Check_Paragraph; -- We need to *count* this |
| 8663 |
-- paragraph, lest the numbers get all |
| 8664 |
-- messed up. But we don't want to generate anything. |
| 8665 |
-- Skip the text: (but only to the end of the first paragraph). |
| 8666 |
ARM_Input.Skip_until_Close_Char (Input_Object, Close_Ch); |
| 8667 |
ARM_Input.Replace_Char (Input_Object); -- Let the normal termination clean this up. |
| 8668 |
--Ada.Text_IO.Put_Line("--Skip text"); |
| 8669 |
|
| 8670 |
elsif Delete_Disposition = ARM_Output.None and then |
| 8671 |
Insert_Disposition = ARM_Output.None then |
| 8672 |
-- Display the text normally. |
| 8673 |
Make_Attribute_Text; |
| 8674 |
-- Nothing special to do (normal text). |
| 8675 |
--Ada.Text_IO.Put_Line("--Normal text"); |
| 8676 |
|
| 8677 |
else -- We'll need a style change (or there is a horrible error). |
| 8678 |
|
| 8679 |
-- Only the new style depends on the parameters: |
| 8680 |
if Delete_Disposition = ARM_Output.None and then |
| 8681 |
Insert_Disposition = ARM_Output.Insertion then -- Normal insertion. |
| 8682 |
--Ada.Text_IO.Put_Line("--Insertion"); |
| 8683 |
-- We assume non-empty text and no outer changes; |
| 8684 |
-- set new change state: |
| 8685 |
Format_Object.Text_Format.Change := ARM_Output.Insertion; |
| 8686 |
Format_Object.Text_Format.Version := InitialVersion; |
| 8687 |
Format_Object.Text_Format.Added_Version := '0'; |
| 8688 |
elsif Delete_Disposition = ARM_Output.Deletion and then |
| 8689 |
Insert_Disposition = ARM_Output.None then -- Deletion. |
| 8690 |
|
| 8691 |
--Ada.Text_IO.Put_Line("--Deletion"); |
| 8692 |
-- We assume non-empty text and no outer changes; |
| 8693 |
-- set new change state: |
| 8694 |
Format_Object.Text_Format.Change := ARM_Output.Deletion; |
| 8695 |
Format_Object.Text_Format.Version := Version; |
| 8696 |
Format_Object.Text_Format.Added_Version := '0'; |
| 8697 |
|
| 8698 |
elsif Delete_Disposition = ARM_Output.Deletion and then |
| 8699 |
Insert_Disposition = ARM_Output.Insertion then -- Both. |
| 8700 |
Format_Object.Text_Format.Change := ARM_Output.Both; |
| 8701 |
Format_Object.Text_Format.Version := Version; |
| 8702 |
Format_Object.Text_Format.Added_Version := InitialVersion; |
| 8703 |
|
| 8704 |
--Ada.Text_IO.Put_Line("--Both Insert/Delete"); |
| 8705 |
|
| 8706 |
elsif Insert_Disposition = ARM_Output.Deletion then |
| 8707 |
raise Program_Error with "Delete in insert"; |
| 8708 |
-- A deletion inside of an insertion command! |
| 8709 |
|
| 8710 |
elsif Delete_Disposition = ARM_Output.Insertion then |
| 8711 |
raise Program_Error with "Insert in delete"; |
| 8712 |
-- A insertion inside of a deletion command! |
| 8713 |
|
| 8714 |
else |
| 8715 |
Ada.Text_IO.Put_Line ("** Unimplemented disposition on line " & ARM_Input.Line_String (Input_Object) & |
| 8716 |
"Ins=" & ARM_Output.Change_Type'Image(Insert_Disposition) & |
| 8717 |
"Del=" & ARM_Output.Change_Type'Image(Delete_Disposition)); |
| 8718 |
raise Program_Error with "Weird combo"; |
| 8719 |
end if; |
| 8720 |
Check_Paragraph; -- Change the state *before* outputting the |
| 8721 |
-- paragraph header, so the AARM prefix is included. |
| 8722 |
ARM_Output.Text_Format (Output_Object, |
| 8723 |
Format_Object.Text_Format); |
| 8724 |
Make_Attribute_Text; |
| 8725 |
|
| 8726 |
-- Reset the state to normal: |
| 8727 |
Format_Object.Text_Format.Change := ARM_Output.None; |
| 8728 |
Format_Object.Text_Format.Version := '0'; |
| 8729 |
Format_Object.Text_Format.Added_Version := '0'; |
| 8730 |
ARM_Output.Text_Format (Output_Object, |
| 8731 |
Format_Object.Text_Format); |
| 8732 |
end if; |
| 8733 |
|
| 8734 |
end; |
| 8735 |
|
| 8736 |
-- The text goes to the file *and* is recorded. |
| 8737 |
Arm_Input.Start_Recording (Input_Object); |
| 8738 |
|
| 8739 |
-- else no parameter. Do nothing. |
| 8740 |
end if; |
| 8741 |
end; |
| 8742 |
|
| 8743 |
when Change_Prefix_Type => |
| 8744 |
-- This command is of the form: |
| 8745 |
-- @chgprefixtype{Version=[<version>], Kind=(<kind>), |
| 8746 |
-- Text=(<text>)}} |
| 8747 |
-- where <version> is a single character, <Kind> is one |
| 8748 |
-- of Revised, Added, or Deleted, and this is followed |
| 8749 |
-- by the text. As usual, any of the |
| 8750 |
-- allowed bracketing characters can be used. |
| 8751 |
declare |
| 8752 |
Close_Ch : Character; |
| 8753 |
begin |
| 8754 |
Get_Change_Version (Is_First => True, |
| 8755 |
Version => Format_Object.Attr_Prefix_Version); |
| 8756 |
-- Read a parameter named "Version". |
| 8757 |
|
| 8758 |
Get_Change_Kind (Format_Object.Attr_Prefix_Change_Kind); |
| 8759 |
-- Read a parameter named "Kind". |
| 8760 |
|
| 8761 |
ARM_Input.Check_Parameter_Name (Input_Object, |
| 8762 |
Param_Name => "Text" & (5..ARM_Input.Command_Name_Type'Last => ' '), |
| 8763 |
Is_First => False, |
| 8764 |
Param_Close_Bracket => Close_Ch); |
| 8765 |
if Close_Ch /= ' ' then |
| 8766 |
-- Stack it so we can process the end: |
| 8767 |
Set_Nesting_for_Parameter |
| 8768 |
(Command => Change_Prefix_Text_Param, |
| 8769 |
Close_Ch => Close_Ch); |
| 8770 |
|
| 8771 |
ARM_Input.Start_Recording (Input_Object); |
| 8772 |
-- else no parameter. Weird. |
| 8773 |
end if; |
| 8774 |
end; |
| 8775 |
|
| 8776 |
when Added_Implementation_Advice_List => |
| 8777 |
-- This command is of the form: |
| 8778 |
-- @AddedImplAdvice{Version=[v]} |
| 8779 |
declare |
| 8780 |
Version : ARM_Contents.Change_Version_Type; |
| 8781 |
begin |
| 8782 |
Get_Change_Version (Is_First => True, |
| 8783 |
Version => Version); |
| 8784 |
-- Read a parameter named "Version". |
| 8785 |
DB_Report (Format_Object.ImplAdv_DB, |
| 8786 |
ARM_Database.Bullet_List, |
| 8787 |
Sorted => True, |
| 8788 |
Added_Version => Version); |
| 8789 |
end; |
| 8790 |
|
| 8791 |
when Added_Documentation_Requirements_List => |
| 8792 |
-- This command is of the form: |
| 8793 |
-- @AddedDocReq{Version=[v]} |
| 8794 |
declare |
| 8795 |
Version : ARM_Contents.Change_Version_Type; |
| 8796 |
begin |
| 8797 |
Get_Change_Version (Is_First => True, |
| 8798 |
Version => Version); |
| 8799 |
-- Read a parameter named "Version". |
| 8800 |
DB_Report (Format_Object.Docreq_DB, |
| 8801 |
ARM_Database.Bullet_List, |
| 8802 |
Sorted => True, |
| 8803 |
Added_Version => Version); |
| 8804 |
end; |
| 8805 |
|
| 8806 |
when Added_Aspect_Description_List => |
| 8807 |
-- This command is of the form: |
| 8808 |
-- @AddedAspectList{Version=[v]} |
| 8809 |
declare |
| 8810 |
Version : ARM_Contents.Change_Version_Type; |
| 8811 |
begin |
| 8812 |
Get_Change_Version (Is_First => True, |
| 8813 |
Version => Version); |
| 8814 |
-- Read a parameter named "Version". |
| 8815 |
DB_Report (Format_Object.Aspect_DB, |
| 8816 |
ARM_Database.Hanging_List, |
| 8817 |
Sorted => True, |
| 8818 |
Added_Version => Version); |
| 8819 |
end; |
| 8820 |
|
| 8821 |
when Latin_1 => |
| 8822 |
-- The parameter is the decimal code for the Latin-1 |
| 8823 |
-- character to generate. |
| 8824 |
declare |
| 8825 |
Value : String (1..5); |
| 8826 |
Len : Natural := 0; |
| 8827 |
Ch : Character; |
| 8828 |
begin |
| 8829 |
ARM_Input.Get_Char (Input_Object, Ch); |
| 8830 |
while Ch /= Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Close_Char loop |
| 8831 |
Len := Len + 1; |
| 8832 |
if Len > Value'Last then |
| 8833 |
Ada.Text_IO.Put_Line (" ** Latin-1 value too long on line " & |
| 8834 |
ARM_Input.Line_String (Input_Object)); |
| 8835 |
exit; |
| 8836 |
end if; |
| 8837 |
Value(Len) := Ch; |
| 8838 |
ARM_Input.Get_Char (Input_Object, Ch); |
| 8839 |
end loop; |
| 8840 |
Format_State.Nesting_Stack_Ptr := Format_State.Nesting_Stack_Ptr - 1; |
| 8841 |
-- Remove the "Latin-1" record. |
| 8842 |
Check_Paragraph; |
| 8843 |
ARM_Output.Ordinary_Character (Output_Object, |
| 8844 |
Character'Val(Natural'Value(Value(1..Len)))); |
| 8845 |
Format_Object.Last_Non_Space := True; |
| 8846 |
exception |
| 8847 |
when Constraint_Error => |
| 8848 |
Ada.Text_IO.Put_Line (" ** Bad Latin-1 value [" & |
| 8849 |
Value(1..Len) & "] on line " & |
| 8850 |
ARM_Input.Line_String (Input_Object)); |
| 8851 |
end; |
| 8852 |
|
| 8853 |
when Unicode => |
| 8854 |
-- The parameter is the decimal code for the Uncode |
| 8855 |
-- character to generate. |
| 8856 |
declare |
| 8857 |
Value : String (1..11); |
| 8858 |
Len : Natural := 0; |
| 8859 |
Ch : Character; |
| 8860 |
begin |
| 8861 |
ARM_Input.Get_Char (Input_Object, Ch); |
| 8862 |
while Ch /= Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Close_Char loop |
| 8863 |
Len := Len + 1; |
| 8864 |
if Len > Value'Last then |
| 8865 |
Ada.Text_IO.Put_Line (" ** Unicode value too long on line " & |
| 8866 |
ARM_Input.Line_String (Input_Object)); |
| 8867 |
exit; |
| 8868 |
end if; |
| 8869 |
Value(Len) := Ch; |
| 8870 |
ARM_Input.Get_Char (Input_Object, Ch); |
| 8871 |
end loop; |
| 8872 |
Format_State.Nesting_Stack_Ptr := Format_State.Nesting_Stack_Ptr - 1; |
| 8873 |
-- Remove the "Unicode" record. |
| 8874 |
Check_Paragraph; |
| 8875 |
ARM_Output.Unicode_Character (Output_Object, |
| 8876 |
ARM_Output.Unicode_Type'Value(Value(1..Len))); |
| 8877 |
Format_Object.Last_Non_Space := True; |
| 8878 |
exception |
| 8879 |
when Constraint_Error => |
| 8880 |
Ada.Text_IO.Put_Line (" ** Bad Unicode value [" & |
| 8881 |
Value(1..Len) & "] on line " & |
| 8882 |
ARM_Input.Line_String (Input_Object)); |
| 8883 |
end; |
| 8884 |
|
| 8885 |
when Ceiling => |
| 8886 |
Check_Paragraph; |
| 8887 |
ARM_Output.Special_Character (Output_Object, ARM_Output.Left_Ceiling); |
| 8888 |
Format_Object.Last_Non_Space := True; |
| 8889 |
|
| 8890 |
when Floor => |
| 8891 |
Check_Paragraph; |
| 8892 |
ARM_Output.Special_Character (Output_Object, ARM_Output.Left_Floor); |
| 8893 |
Format_Object.Last_Non_Space := True; |
| 8894 |
|
| 8895 |
when Absolute => |
| 8896 |
Check_Paragraph; |
| 8897 |
ARM_Output.Ordinary_Character (Output_Object, '|'); |
| 8898 |
Format_Object.Last_Non_Space := True; |
| 8899 |
|
| 8900 |
when Log => |
| 8901 |
Check_Paragraph; |
| 8902 |
ARM_Output.Ordinary_Text (Output_Object, "log("); |
| 8903 |
Format_Object.Last_Non_Space := True; |
| 8904 |
|
| 8905 |
when Down | Up => |
| 8906 |
Ada.Text_IO.Put_Line (" ** Su(b|per)script can't occur directly, line " & |
| 8907 |
ARM_Input.Line_String (Input_Object)); |
| 8908 |
|
| 8909 |
when New_Column | New_Page | RM_New_Page | Soft_Page | |
| 8910 |
No_Prefix | No_Para_Num | Keep_with_Next | Leading | Trailing | |
| 8911 |
Thin_Line | Thick_Line | Table_Last | |
| 8912 |
Index_List | |
| 8913 |
Syntax_Summary | Syntax_XRef | Glossary_List | |
| 8914 |
Attribute_List | Pragma_List | Implementation_Defined_List | |
| 8915 |
Package_List | Type_List | Subprogram_List | |
| 8916 |
Exception_List | Object_List | |
| 8917 |
Intro_Name | Syntax_Name | Resolution_Name | |
| 8918 |
Legality_Name | Static_Name | Link_Name | Run_Name | |
| 8919 |
Bounded_Name | Erroneous_Name | Req_Name | |
| 8920 |
Doc_Name | Metrics_Name | Permission_Name | Advice_Name | |
| 8921 |
Notes_Name | Single_Note_Name | Examples_Name | |
| 8922 |
Meta_Name | Inconsistent83_Name | |
| 8923 |
Incompatible83_Name | Extend83_Name | Wording83_Name | |
| 8924 |
Inconsistent95_Name | |
| 8925 |
Incompatible95_Name | Extend95_Name | Wording95_Name | |
| 8926 |
Inconsistent2005_Name | |
| 8927 |
Incompatible2005_Name | Extend2005_Name | Wording2005_Name | |
| 8928 |
Inconsistent2012_Name | |
| 8929 |
Incompatible2012_Name | Extend2012_Name | Wording2012_Name | |
| 8930 |
Syntax_Title | Resolution_Title | Legality_Title | |
| 8931 |
Static_Title | Link_Title | Run_Title | Bounded_Title | |
| 8932 |
Erroneous_Title | Req_Title | Doc_Title | Metrics_Title | |
| 8933 |
Permission_Title | Advice_Title | Notes_Title | |
| 8934 |
Single_Note_Title | |
| 8935 |
Examples_Title | Meta_Title | Inconsistent83_Title | |
| 8936 |
Incompatible83_Title | Extend83_Title | Wording83_Title | |
| 8937 |
Inconsistent95_Title | |
| 8938 |
Incompatible95_Title | Extend95_Title | Wording95_Title | |
| 8939 |
Inconsistent2005_Title | |
| 8940 |
Incompatible2005_Title | Extend2005_Title | Wording2005_Title | |
| 8941 |
Inconsistent2012_Title | |
| 8942 |
Incompatible2012_Title | Extend2012_Title | Wording2012_Title | |
| 8943 |
EM_Dash | EN_Dash | LT | LE | GT | GE | NE | PI | |
| 8944 |
Times | PorM | Single_Quote | Thin_Space | Left_Quote | |
| 8945 |
Right_Quote | Left_Double_Quote | Right_Double_Quote | |
| 8946 |
Left_Quote_Pair | Right_Quote_Pair | Small_Dotless_I | |
| 8947 |
Capital_Dotted_I => |
| 8948 |
|
| 8949 |
-- These commands must not have a parameter. |
| 8950 |
Ada.Text_IO.Put_Line (" ** Parameter for " & |
| 8951 |
Ada.Strings.Fixed.Trim (Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Name, Ada.Strings.Right) & |
| 8952 |
", line " & ARM_Input.Line_String (Input_Object)); |
| 8953 |
|
| 8954 |
when Unknown => |
| 8955 |
Ada.Text_IO.Put_Line (" ?? Unknown command (skipped) - " & |
| 8956 |
Ada.Strings.Fixed.Trim (Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Name, Ada.Strings.Right) & |
| 8957 |
" on line " & ARM_Input.Line_String (Input_Object)); |
| 8958 |
end case; |
| 8959 |
end Process_Command_with_Parameter; |
| 8960 |
|
| 8961 |
|
| 8962 |
procedure Process_Command_without_Parameter (Name : in ARM_Input.Command_Name_Type) is |
| 8963 |
-- Process the start of a command without a parameter. The name |
| 8964 |
-- of the command is Name. |
| 8965 |
procedure Put_Name (Kind : Paragraph_Type) is |
| 8966 |
begin |
| 8967 |
Check_Paragraph; |
| 8968 |
ARM_Output.Ordinary_Text (Output_Object, |
| 8969 |
Data.Paragraph_Kind_Name(Kind).Str(1..Data.Paragraph_Kind_Name(Kind).Length)); |
| 8970 |
Format_Object.Last_Non_Space := True; |
| 8971 |
end Put_Name; |
| 8972 |
|
| 8973 |
procedure Put_Title (Kind : Paragraph_Type) is |
| 8974 |
begin |
| 8975 |
Check_Paragraph; |
| 8976 |
ARM_Output.Ordinary_Text (Output_Object, |
| 8977 |
Paragraph_Kind_Title(Kind).Str(1..Paragraph_Kind_Title(Kind).Length)); |
| 8978 |
Format_Object.Last_Non_Space := True; |
| 8979 |
end Put_Title; |
| 8980 |
|
| 8981 |
procedure Format_Text (Text : in String; |
| 8982 |
Text_Name : in String) is |
| 8983 |
-- Note: We use the state of the surrounding call. |
| 8984 |
Input_Object : Arm_String.String_Input_Type; |
| 8985 |
Real_Include_Annotations : Boolean := Format_Object.Include_Annotations; |
| 8986 |
begin |
| 8987 |
-- Don't show annotations here: |
| 8988 |
Format_Object.Include_Annotations := False; |
| 8989 |
Arm_String.Open (Input_Object, Text, Text_Name); |
| 8990 |
-- Open the input object using a string for input. |
| 8991 |
Real_Process (Format_Object, Format_State, Input_Object, Output_Object); |
| 8992 |
Arm_String.Close (Input_Object); |
| 8993 |
Format_Object.Include_Annotations := Real_Include_Annotations; |
| 8994 |
end Format_Text; |
| 8995 |
|
| 8996 |
procedure DB_Report is new ARM_Database.Report (Format_Text); |
| 8997 |
|
| 8998 |
procedure Syn_Report is new ARM_Syntax.Report (Format_Text); |
| 8999 |
|
| 9000 |
procedure Syn_XRef is new ARM_Syntax.XRef (Format_Text); |
| 9001 |
|
| 9002 |
begin |
| 9003 |
case Command (Name) is |
| 9004 |
when Comment => |
| 9005 |
null; -- Harmless, but still junk. |
| 9006 |
|
| 9007 |
when No_Prefix => |
| 9008 |
Format_Object.No_Prefix := True; |
| 9009 |
|
| 9010 |
when No_Para_Num => |
| 9011 |
Format_Object.No_Para_Num := True; |
| 9012 |
|
| 9013 |
when Keep_with_Next => |
| 9014 |
Format_Object.Keep_with_Next := True; |
| 9015 |
|
| 9016 |
when Leading => |
| 9017 |
Format_Object.Space_After := ARM_Output.Narrow; |
| 9018 |
|
| 9019 |
when Trailing => |
| 9020 |
Format_Object.Space_After := ARM_Output.Wide; |
| 9021 |
|
| 9022 |
when New_Page => |
| 9023 |
Check_End_Paragraph; -- End any paragraph that we're in. |
| 9024 |
ARM_Output.New_Page (Output_Object, ARM_Output.Any_Page); |
| 9025 |
|
| 9026 |
when RM_New_Page => |
| 9027 |
if not Format_Object.Include_Annotations then |
| 9028 |
Check_End_Paragraph; -- End any paragraph that we're in. |
| 9029 |
ARM_Output.New_Page (Output_Object, ARM_Output.Any_Page); |
| 9030 |
-- else do nothing. |
| 9031 |
end if; |
| 9032 |
|
| 9033 |
when Soft_Page => |
| 9034 |
Check_Paragraph; |
| 9035 |
ARM_Output.New_Page (Output_Object, ARM_Output.Soft_Page); |
| 9036 |
|
| 9037 |
when New_Column => |
| 9038 |
Check_End_Paragraph; -- End any paragraph that we're in. |
| 9039 |
ARM_Output.New_Column (Output_Object); |
| 9040 |
|
| 9041 |
when Thin_Line => |
| 9042 |
Check_End_Paragraph; |
| 9043 |
ARM_Output.Separator_Line (Output_Object, Is_Thin => True); |
| 9044 |
|
| 9045 |
when Thick_Line => |
| 9046 |
Check_End_Paragraph; |
| 9047 |
ARM_Output.Separator_Line (Output_Object, Is_Thin => False); |
| 9048 |
|
| 9049 |
when Table_Last => |
| 9050 |
if Format_Object.Next_Paragraph_Format_Type = In_Table then |
| 9051 |
-- If in a table, ends the second last row. |
| 9052 |
ARM_Output.Table_Marker (Output_Object, ARM_Output.End_Row_Next_is_Last); |
| 9053 |
-- Eat the following LF, if any, to avoid confusing |
| 9054 |
-- row ends: |
| 9055 |
declare |
| 9056 |
Ch : Character; |
| 9057 |
begin |
| 9058 |
ARM_Input.Get_Char (Input_Object, Ch); |
| 9059 |
if Ch /= Ascii.LF then |
| 9060 |
ARM_Input.Replace_Char (Input_Object); |
| 9061 |
end if; |
| 9062 |
end; |
| 9063 |
else |
| 9064 |
Ada.Text_IO.Put_Line (" ** @Last command not in table, line " & ARM_Input.Line_String (Input_Object)); |
| 9065 |
end if; |
| 9066 |
|
| 9067 |
when Index_List => |
| 9068 |
-- Generate the index body. |
| 9069 |
Check_End_Paragraph; |
| 9070 |
|
| 9071 |
ARM_Output.Set_Columns (Output_Object, Number_of_Columns => 3); |
| 9072 |
|
| 9073 |
ARM_Index.Generate_Index_Body (Output_Object, |
| 9074 |
Use_Paragraphs => Format_Object.Number_Paragraphs); |
| 9075 |
|
| 9076 |
ARM_Output.Set_Columns (Output_Object, Number_of_Columns => 1); |
| 9077 |
|
| 9078 |
when Syntax_Summary => |
| 9079 |
--Ada.Text_IO.Put_Line ("%% Generate Syntax summary"); |
| 9080 |
Syn_Report; |
| 9081 |
|
| 9082 |
when Syntax_XRef => |
| 9083 |
--Ada.Text_IO.Put_Line ("%% Generate Syntax xref"); |
| 9084 |
Syn_XRef; |
| 9085 |
|
| 9086 |
when Glossary_List => |
| 9087 |
DB_Report (Format_Object.Glossary_DB, |
| 9088 |
ARM_Database.Normal_Indexed_List, |
| 9089 |
Sorted => True); |
| 9090 |
|
| 9091 |
when Attribute_List => |
| 9092 |
DB_Report (Format_Object.Attr_DB, |
| 9093 |
ARM_Database.Hanging_List, |
| 9094 |
Sorted => True, |
| 9095 |
No_Deleted_Paragraph_Messages => True); |
| 9096 |
|
| 9097 |
when Pragma_List => |
| 9098 |
DB_Report (Format_Object.Pragma_DB, |
| 9099 |
ARM_Database.Normal_List, |
| 9100 |
Sorted => True); |
| 9101 |
|
| 9102 |
when Implementation_Defined_List => |
| 9103 |
DB_Report (Format_Object.Impdef_DB, |
| 9104 |
ARM_Database.Bullet_List, |
| 9105 |
Sorted => True); |
| 9106 |
|
| 9107 |
when Package_List => |
| 9108 |
Write_Subindex (Format_Object.Package_Index, |
| 9109 |
Format_Object, |
| 9110 |
Output_Object, |
| 9111 |
Minimize_Lines => False); |
| 9112 |
|
| 9113 |
when Type_List => |
| 9114 |
Write_Subindex (Format_Object.Type_Index, |
| 9115 |
Format_Object, |
| 9116 |
Output_Object, |
| 9117 |
Minimize_Lines => False); |
| 9118 |
|
| 9119 |
when Subprogram_List => |
| 9120 |
Write_Subindex (Format_Object.Subprogram_Index, |
| 9121 |
Format_Object, |
| 9122 |
Output_Object, |
| 9123 |
Minimize_Lines => True); |
| 9124 |
|
| 9125 |
when Exception_List => |
| 9126 |
Write_Subindex (Format_Object.Exception_Index, |
| 9127 |
Format_Object, |
| 9128 |
Output_Object, |
| 9129 |
Minimize_Lines => False); |
| 9130 |
|
| 9131 |
when Object_List => |
| 9132 |
Write_Subindex (Format_Object.Object_Index, |
| 9133 |
Format_Object, |
| 9134 |
Output_Object, |
| 9135 |
Minimize_Lines => True); |
| 9136 |
|
| 9137 |
when Text_Begin | Text_End | Redundant | Part | Bold | Italic | |
| 9138 |
Roman | Swiss | Fixed | Roman_Italic | Shrink | Grow | |
| 9139 |
Black | Red | Green | Blue | |
| 9140 |
Keyword | Non_Terminal | Non_Terminal_Format | |
| 9141 |
Example_Text | Example_Comment | |
| 9142 |
Up | Down | Tab_Clear | Tab_Set | |
| 9143 |
New_Page_for_Version | RM_New_Page_for_Version | |
| 9144 |
Not_ISO_RM_New_Page_for_Version | |
| 9145 |
ISO_Only_RM_New_Page_for_Version | |
| 9146 |
New_Column_for_Version | |
| 9147 |
Table | Picture_Alone | Picture_Inline | |
| 9148 |
Defn | RootDefn | PDefn | Defn2 | RootDefn2 | PDefn2 | |
| 9149 |
Index_See | Index_See_Also | See_Other | See_Also | |
| 9150 |
Index_Root_Unit | Index_Child_Unit | Index_Subprogram_Child_Unit | |
| 9151 |
Index_Type | Index_Subtype | |
| 9152 |
Index_Subprogram | Index_Exception | Index_Object | |
| 9153 |
Index_Package | Index_Other | Index_Check | |
| 9154 |
Index_Attr | Index_Pragma | Index_Aspect | |
| 9155 |
Syntax_Rule | Syntax_Term | Syntax_Term_Undefined | Syntax_Prefix | |
| 9156 |
Added_Syntax_Rule | Deleted_Syntax_Rule | |
| 9157 |
To_Glossary | To_Glossary_Also | |
| 9158 |
Change_To_Glossary | Change_To_Glossary_Also | |
| 9159 |
Implementation_Defined | |
| 9160 |
Prefix_Type | Reset_Prefix_Type | Attribute | Attribute_Leading | |
| 9161 |
Pragma_Syntax | Added_Pragma_Syntax | Deleted_Pragma_Syntax | |
| 9162 |
Labeled_Section | Labeled_Section_No_Break | |
| 9163 |
Labeled_Clause | Labeled_Subclause | Labeled_Subsubclause | |
| 9164 |
Labeled_Revised_Section | Labeled_Revised_Clause | |
| 9165 |
Labeled_Revised_Subclause | Labeled_Revised_Subsubclause | |
| 9166 |
Labeled_Added_Section | Labeled_Added_Clause | |
| 9167 |
Labeled_Added_Subclause | Labeled_Added_Subsubclause | |
| 9168 |
Labeled_Deleted_Clause | |
| 9169 |
Labeled_Deleted_Subclause | Labeled_Deleted_Subsubclause | |
| 9170 |
Labeled_Annex | Labeled_Revised_Annex | Labeled_Added_Annex | |
| 9171 |
Labeled_Informative_Annex | Labeled_Revised_Informative_Annex | |
| 9172 |
Labeled_Added_Informative_Annex | |
| 9173 |
Labeled_Normative_Annex | Labeled_Revised_Normative_Annex | |
| 9174 |
Labeled_Added_Normative_Annex | |
| 9175 |
Unnumbered_Section | Subheading | Added_Subheading | Heading | |
| 9176 |
Center | Right | |
| 9177 |
Preface_Section | Ref_Section | Ref_Section_Number | Ref_Section_by_Number | |
| 9178 |
Local_Target | Local_Link | URL_Link | AI_Link | |
| 9179 |
Change | Change_Reference | Change_Note | |
| 9180 |
Change_Added | Change_Deleted | |
| 9181 |
Change_Implementation_Defined | |
| 9182 |
Change_Implementation_Advice | |
| 9183 |
Change_Documentation_Requirement | |
| 9184 |
Change_Aspect_Description | |
| 9185 |
Added_Implementation_Advice_List | |
| 9186 |
Added_Documentation_Requirements_List | |
| 9187 |
Added_Aspect_Description_List | |
| 9188 |
Change_Attribute | |
| 9189 |
Change_Prefix_Type | |
| 9190 |
Latin_1 | Unicode | Ceiling | Floor | Absolute | Log => |
| 9191 |
-- These commands must have a parameter. |
| 9192 |
Ada.Text_IO.Put_Line (" ** Failed to find parameter for " & |
| 9193 |
Ada.Strings.Fixed.Trim (Name, Ada.Strings.Right) & |
| 9194 |
", line " & ARM_Input.Line_String (Input_Object)); |
| 9195 |
|
| 9196 |
when Change_Param_Old | Change_Param_New | Change_Added_Param | Change_Deleted_Param => |
| 9197 |
-- These can't get here; they represent the parameters of |
| 9198 |
-- "Change" and can't be generated explicitly. |
| 9199 |
Ada.Text_IO.Put_Line (" ** Change parameter command?? on line " & ARM_Input.Line_String (Input_Object)); |
| 9200 |
|
| 9201 |
when Table_Param_Caption | Table_Param_Header | Table_Param_Body => |
| 9202 |
-- These can't get here; they represent the parameters of |
| 9203 |
-- "Table" and can't be generated explicitly. |
| 9204 |
Ada.Text_IO.Put_Line (" ** Table parameter command?? on line " & ARM_Input.Line_String (Input_Object)); |
| 9205 |
|
| 9206 |
when Syntax_Rule_RHS => |
| 9207 |
-- This can't get here; it represents the second parameter of |
| 9208 |
-- "Syn" and can't be generated explicitly. |
| 9209 |
Ada.Text_IO.Put_Line (" ** Syntax parameter command?? on line " & ARM_Input.Line_String (Input_Object)); |
| 9210 |
|
| 9211 |
when Glossary_Text_Param => |
| 9212 |
-- This can't get here; it represents a parameter of |
| 9213 |
-- "ToGlossary" and can't be generated explicitly. |
| 9214 |
Ada.Text_IO.Put_Line (" ** Glossary parameter command?? on line " & ARM_Input.Line_String (Input_Object)); |
| 9215 |
|
| 9216 |
when Attribute_Text_Param => |
| 9217 |
-- This can't get here; it represents a parameter of |
| 9218 |
-- "Attribute" and can't be generated explicitly. |
| 9219 |
Ada.Text_IO.Put_Line (" ** Attribute parameter command?? on line " & ARM_Input.Line_String (Input_Object)); |
| 9220 |
|
| 9221 |
when Change_Impdef_Text_Param => |
| 9222 |
-- This can't get here; it represents a parameter of |
| 9223 |
-- "ChgImpldef" and can't be generated explicitly. |
| 9224 |
Ada.Text_IO.Put_Line (" ** Impdef parameter command?? on line " & ARM_Input.Line_String (Input_Object)); |
| 9225 |
|
| 9226 |
when Change_Impladv_Text_Param => |
| 9227 |
-- This can't get here; it represents a parameter of |
| 9228 |
-- "ChgImpladv" and can't be generated explicitly. |
| 9229 |
Ada.Text_IO.Put_Line (" ** Impladv parameter command?? on line " & ARM_Input.Line_String (Input_Object)); |
| 9230 |
|
| 9231 |
when Change_Docreq_Text_Param => |
| 9232 |
-- This can't get here; it represents a parameter of |
| 9233 |
-- "ChgDocreq" and can't be generated explicitly. |
| 9234 |
Ada.Text_IO.Put_Line (" ** DocReq parameter command?? on line " & ARM_Input.Line_String (Input_Object)); |
| 9235 |
|
| 9236 |
when Change_AspectDesc_Text_Param => |
| 9237 |
-- This can't get here; it represents a parameter of |
| 9238 |
-- "ChgAspectDesc" and can't be generated explicitly. |
| 9239 |
Ada.Text_IO.Put_Line (" ** AspectDesc parameter command?? on line " & ARM_Input.Line_String (Input_Object)); |
| 9240 |
|
| 9241 |
when Change_Prefix_Text_Param => |
| 9242 |
-- This can't get here; it represents a parameter of |
| 9243 |
-- "ChgPrefixType" and can't be generated explicitly. |
| 9244 |
Ada.Text_IO.Put_Line (" ** ChgPrefix parameter command?? on line " & ARM_Input.Line_String (Input_Object)); |
| 9245 |
|
| 9246 |
when Intro_Name => |
| 9247 |
Put_Name(Introduction); |
| 9248 |
when Syntax_Name => |
| 9249 |
Put_Name(Syntax); |
| 9250 |
when Resolution_Name => |
| 9251 |
Put_Name(Resolution); |
| 9252 |
when Legality_Name => |
| 9253 |
Put_Name(Legality); |
| 9254 |
when Static_Name => |
| 9255 |
Put_Name(Static_Semantics); |
| 9256 |
when Link_Name => |
| 9257 |
Put_Name(Link_Time); |
| 9258 |
when Run_Name => |
| 9259 |
Put_Name(Run_Time); |
| 9260 |
when Bounded_Name => |
| 9261 |
Put_Name(Bounded_Errors); |
| 9262 |
when Erroneous_Name => |
| 9263 |
Put_Name(Erroneous); |
| 9264 |
when Req_Name => |
| 9265 |
Put_Name(Requirements); |
| 9266 |
when Doc_Name => |
| 9267 |
Put_Name(Documentation); |
| 9268 |
when Metrics_Name => |
| 9269 |
Put_Name(Metrics); |
| 9270 |
when Permission_Name => |
| 9271 |
Put_Name(Permissions); |
| 9272 |
when Advice_Name => |
| 9273 |
Put_Name(Advice); |
| 9274 |
when Notes_Name => |
| 9275 |
Put_Name(Notes); |
| 9276 |
when Single_Note_Name => |
| 9277 |
Put_Name(Single_Note); |
| 9278 |
when Examples_Name => |
| 9279 |
Put_Name(Examples); |
| 9280 |
when Meta_Name => |
| 9281 |
Put_Name(Language_Design); |
| 9282 |
when Inconsistent83_Name => |
| 9283 |
Put_Name(Ada83_Inconsistencies); |
| 9284 |
when Incompatible83_Name => |
| 9285 |
Put_Name(Ada83_Incompatibilities); |
| 9286 |
when Extend83_Name => |
| 9287 |
Put_Name(Ada83_Extensions); |
| 9288 |
when Wording83_Name => |
| 9289 |
Put_Name(Ada83_Wording); |
| 9290 |
when Inconsistent95_Name => |
| 9291 |
Put_Name(Ada95_Inconsistencies); |
| 9292 |
when Incompatible95_Name => |
| 9293 |
Put_Name(Ada95_Incompatibilities); |
| 9294 |
when Extend95_Name => |
| 9295 |
Put_Name(Ada95_Extensions); |
| 9296 |
when Wording95_Name => |
| 9297 |
Put_Name(Ada95_Wording); |
| 9298 |
when Inconsistent2005_Name => |
| 9299 |
Put_Name(Ada2005_Inconsistencies); |
| 9300 |
when Incompatible2005_Name => |
| 9301 |
Put_Name(Ada2005_Incompatibilities); |
| 9302 |
when Extend2005_Name => |
| 9303 |
Put_Name(Ada2005_Extensions); |
| 9304 |
when Wording2005_Name => |
| 9305 |
Put_Name(Ada2005_Wording); |
| 9306 |
when Inconsistent2012_Name => |
| 9307 |
Put_Name(Ada2012_Inconsistencies); |
| 9308 |
when Incompatible2012_Name => |
| 9309 |
Put_Name(Ada2012_Incompatibilities); |
| 9310 |
when Extend2012_Name => |
| 9311 |
Put_Name(Ada2012_Extensions); |
| 9312 |
when Wording2012_Name => |
| 9313 |
Put_Name(Ada2012_Wording); |
| 9314 |
|
| 9315 |
when Syntax_Title => |
| 9316 |
Put_Title(Syntax); |
| 9317 |
when Resolution_Title => |
| 9318 |
Put_Title(Resolution); |
| 9319 |
when Legality_Title => |
| 9320 |
Put_Title(Legality); |
| 9321 |
when Static_Title => |
| 9322 |
Put_Title(Static_Semantics); |
| 9323 |
when Link_Title => |
| 9324 |
Put_Title(Link_Time); |
| 9325 |
when Run_Title => |
| 9326 |
Put_Title(Run_Time); |
| 9327 |
when Bounded_Title => |
| 9328 |
Put_Title(Bounded_Errors); |
| 9329 |
when Erroneous_Title => |
| 9330 |
Put_Title(Erroneous); |
| 9331 |
when Req_Title => |
| 9332 |
Put_Title(Requirements); |
| 9333 |
when Doc_Title => |
| 9334 |
Put_Title(Documentation); |
| 9335 |
when Metrics_Title => |
| 9336 |
Put_Title(Metrics); |
| 9337 |
when Permission_Title => |
| 9338 |
Put_Title(Permissions); |
| 9339 |
when Advice_Title => |
| 9340 |
Put_Title(Advice); |
| 9341 |
when Notes_Title => |
| 9342 |
Put_Title(Notes); |
| 9343 |
when Single_Note_Title => |
| 9344 |
Put_Title(Single_Note); |
| 9345 |
when Examples_Title => |
| 9346 |
Put_Title(Examples); |
| 9347 |
when Meta_Title => |
| 9348 |
Put_Title(Language_Design); |
| 9349 |
when Inconsistent83_Title => |
| 9350 |
Put_Title(Ada83_Inconsistencies); |
| 9351 |
when Incompatible83_Title => |
| 9352 |
Put_Title(Ada83_Incompatibilities); |
| 9353 |
when Extend83_Title => |
| 9354 |
Put_Title(Ada83_Extensions); |
| 9355 |
when Wording83_Title => |
| 9356 |
Put_Title(Ada83_Wording); |
| 9357 |
when Inconsistent95_Title => |
| 9358 |
Put_Title(Ada95_Inconsistencies); |
| 9359 |
when Incompatible95_Title => |
| 9360 |
Put_Title(Ada95_Incompatibilities); |
| 9361 |
when Extend95_Title => |
| 9362 |
Put_Title(Ada95_Extensions); |
| 9363 |
when Wording95_Title => |
| 9364 |
Put_Title(Ada95_Wording); |
| 9365 |
when Inconsistent2005_Title => |
| 9366 |
Put_Title(Ada2005_Inconsistencies); |
| 9367 |
when Incompatible2005_Title => |
| 9368 |
Put_Title(Ada2005_Incompatibilities); |
| 9369 |
when Extend2005_Title => |
| 9370 |
Put_Title(Ada2005_Extensions); |
| 9371 |
when Wording2005_Title => |
| 9372 |
Put_Title(Ada2005_Wording); |
| 9373 |
when Inconsistent2012_Title => |
| 9374 |
Put_Title(Ada2012_Inconsistencies); |
| 9375 |
when Incompatible2012_Title => |
| 9376 |
Put_Title(Ada2012_Incompatibilities); |
| 9377 |
when Extend2012_Title => |
| 9378 |
Put_Title(Ada2012_Extensions); |
| 9379 |
when Wording2012_Title => |
| 9380 |
Put_Title(Ada2012_Wording); |
| 9381 |
|
| 9382 |
when EM_Dash => |
| 9383 |
Check_Paragraph; |
| 9384 |
ARM_Output.Special_Character (Output_Object, ARM_Output.EM_Dash); |
| 9385 |
Format_Object.Last_Non_Space := True; |
| 9386 |
when EN_Dash => |
| 9387 |
Check_Paragraph; |
| 9388 |
ARM_Output.Special_Character (Output_Object, ARM_Output.EN_Dash); |
| 9389 |
Format_Object.Last_Non_Space := True; |
| 9390 |
when LE => |
| 9391 |
Check_Paragraph; |
| 9392 |
ARM_Output.Special_Character (Output_Object, ARM_Output.LEQ); |
| 9393 |
Format_Object.Last_Non_Space := True; |
| 9394 |
when LT => |
| 9395 |
Check_Paragraph; |
| 9396 |
ARM_Output.Ordinary_Character (Output_Object, '<'); |
| 9397 |
Format_Object.Last_Non_Space := True; |
| 9398 |
when GE => |
| 9399 |
Check_Paragraph; |
| 9400 |
ARM_Output.Special_Character (Output_Object, ARM_Output.GEQ); |
| 9401 |
Format_Object.Last_Non_Space := True; |
| 9402 |
when GT => |
| 9403 |
Check_Paragraph; |
| 9404 |
ARM_Output.Ordinary_Character (Output_Object, '>'); |
| 9405 |
Format_Object.Last_Non_Space := True; |
| 9406 |
when NE => |
| 9407 |
Check_Paragraph; |
| 9408 |
ARM_Output.Special_Character (Output_Object, ARM_Output.NEQ); |
| 9409 |
Format_Object.Last_Non_Space := True; |
| 9410 |
when PI => |
| 9411 |
Check_Paragraph; |
| 9412 |
ARM_Output.Special_Character (Output_Object, ARM_Output.PI); |
| 9413 |
Format_Object.Last_Non_Space := True; |
| 9414 |
when Times => |
| 9415 |
Check_Paragraph; |
| 9416 |
ARM_Output.Ordinary_Character (Output_Object, Character'Val(183)); -- Middle Dot. |
| 9417 |
Format_Object.Last_Non_Space := True; |
| 9418 |
when PorM => |
| 9419 |
Check_Paragraph; |
| 9420 |
ARM_Output.Ordinary_Character (Output_Object, Character'Val(177)); -- Plus or Minus character. |
| 9421 |
Format_Object.Last_Non_Space := True; |
| 9422 |
when Single_Quote => |
| 9423 |
Check_Paragraph; |
| 9424 |
ARM_Output.Ordinary_Character (Output_Object, '''); -- Single quote. |
| 9425 |
Format_Object.Last_Non_Space := True; |
| 9426 |
when Thin_Space => |
| 9427 |
Check_Paragraph; |
| 9428 |
ARM_Output.Special_Character (Output_Object, ARM_Output.Thin_Space); |
| 9429 |
Format_Object.Last_Non_Space := True; |
| 9430 |
when Small_Dotless_I => |
| 9431 |
Check_Paragraph; |
| 9432 |
ARM_Output.Special_Character (Output_Object, ARM_Output.Small_Dotless_I); |
| 9433 |
Format_Object.Last_Non_Space := True; |
| 9434 |
when Capital_Dotted_I => |
| 9435 |
Check_Paragraph; |
| 9436 |
ARM_Output.Special_Character (Output_Object, ARM_Output.Capital_Dotted_I); |
| 9437 |
Format_Object.Last_Non_Space := True; |
| 9438 |
when Left_Quote => |
| 9439 |
Check_Paragraph; |
| 9440 |
ARM_Output.Special_Character (Output_Object, ARM_Output.Left_Quote); |
| 9441 |
Format_Object.Last_Non_Space := True; |
| 9442 |
when Right_Quote => |
| 9443 |
Check_Paragraph; |
| 9444 |
ARM_Output.Special_Character (Output_Object, ARM_Output.Right_Quote); |
| 9445 |
Format_Object.Last_Non_Space := True; |
| 9446 |
when Left_Double_Quote => |
| 9447 |
Check_Paragraph; |
| 9448 |
ARM_Output.Special_Character (Output_Object, ARM_Output.Left_Double_Quote); |
| 9449 |
Format_Object.Last_Non_Space := True; |
| 9450 |
when Right_Double_Quote => |
| 9451 |
Check_Paragraph; |
| 9452 |
ARM_Output.Special_Character (Output_Object, ARM_Output.Right_Double_Quote); |
| 9453 |
Format_Object.Last_Non_Space := True; |
| 9454 |
when Left_Quote_Pair => |
| 9455 |
Check_Paragraph; |
| 9456 |
-- Was: To match the Ada 95 standard: |
| 9457 |
--ARM_Output.Special_Character (Output_Object, ARM_Output.Left_Quote); |
| 9458 |
--ARM_Output.Special_Character (Output_Object, ARM_Output.Left_Quote); |
| 9459 |
ARM_Output.Special_Character (Output_Object, ARM_Output.Left_Double_Quote); |
| 9460 |
Format_Object.Last_Non_Space := True; |
| 9461 |
when Right_Quote_Pair => |
| 9462 |
Check_Paragraph; |
| 9463 |
-- Was: To match the Ada 95 standard: |
| 9464 |
--ARM_Output.Special_Character (Output_Object, ARM_Output.Right_Quote); |
| 9465 |
--ARM_Output.Special_Character (Output_Object, ARM_Output.Right_Quote); |
| 9466 |
ARM_Output.Special_Character (Output_Object, ARM_Output.Right_Double_Quote); |
| 9467 |
Format_Object.Last_Non_Space := True; |
| 9468 |
|
| 9469 |
when Unknown => |
| 9470 |
Ada.Text_IO.Put_Line (" ?? Unknown command (skipped) - " & |
| 9471 |
Ada.Strings.Fixed.Trim (Name, Ada.Strings.Right) & |
| 9472 |
" on line " & ARM_Input.Line_String (Input_Object)); |
| 9473 |
end case; |
| 9474 |
end Process_Command_without_Parameter; |
| 9475 |
|
| 9476 |
|
| 9477 |
procedure Handle_End_of_Command is |
| 9478 |
-- Unstack and handle the end of Commands. |
| 9479 |
|
| 9480 |
procedure Finish_and_DB_Entry (DB : in out ARM_Database.Database_Type) is |
| 9481 |
-- Close the text parameter for a number of commands |
| 9482 |
-- (impdef, chgimpdef, chgimpladv, chgdocreg) |
| 9483 |
-- and insert the resulting string into the appropriate DB. |
| 9484 |
Text_Buffer : String (1..ARM_Input.MAX_RECORDING_SIZE); |
| 9485 |
Text_Buffer_Len : Natural; |
| 9486 |
|
| 9487 |
function DB_Clause_String return String is |
| 9488 |
use type ARM_Contents.Section_Number_Type; |
| 9489 |
begin |
| 9490 |
if Format_Object.Clause_Number.Clause = 0 then |
| 9491 |
if Format_Object.Clause_Number.Section in 0 .. 9 then |
| 9492 |
return |
| 9493 |
Character'Val(Character'Pos('0') + |
| 9494 |
Format_Object.Clause_Number.Section) & ""; |
| 9495 |
elsif Format_Object.Clause_Number.Section in 10 .. 19 then |
| 9496 |
return "1" & |
| 9497 |
Character'Val(Character'Pos('0') + |
| 9498 |
Format_Object.Clause_Number.Section - 10); |
| 9499 |
elsif Format_Object.Clause_Number.Section in 20 .. 29 then |
| 9500 |
return "2" & |
| 9501 |
Character'Val(Character'Pos('0') + |
| 9502 |
Format_Object.Clause_Number.Section - 20); |
| 9503 |
elsif Format_Object.Clause_Number.Section = 30 then |
| 9504 |
return "30"; |
| 9505 |
else --if Format_Object.Clause_Number.Section >= ARM_Contents.ANNEX_START then |
| 9506 |
return Character'Val (Character'Pos('A') + |
| 9507 |
(Format_Object.Clause_Number.Section - |
| 9508 |
ARM_Contents.ANNEX_START)) & ""; |
| 9509 |
end if; |
| 9510 |
elsif Format_Object.Clause_Number.Subclause = 0 then |
| 9511 |
return ARM_Contents.Make_Clause_Number ( |
| 9512 |
ARM_Contents.Clause, |
| 9513 |
Format_Object.Clause_Number); |
| 9514 |
elsif Format_Object.Clause_Number.Subsubclause = 0 then |
| 9515 |
return ARM_Contents.Make_Clause_Number ( |
| 9516 |
ARM_Contents.SubClause, |
| 9517 |
Format_Object.Clause_Number); |
| 9518 |
else |
| 9519 |
return ARM_Contents.Make_Clause_Number ( |
| 9520 |
ARM_Contents.SubsubClause, |
| 9521 |
Format_Object.Clause_Number); |
| 9522 |
end if; |
| 9523 |
end DB_Clause_String; |
| 9524 |
|
| 9525 |
function Sort_Clause_String return String is |
| 9526 |
Res : String(1..13); |
| 9527 |
-- Always use the paragraph for sorting: |
| 9528 |
begin |
| 9529 |
-- The funny encoding to insure proper sorting. |
| 9530 |
-- (Otherwise "10" sorts before "2". |
| 9531 |
Res(1) := Character'Val (Natural(Format_Object.Clause_Number.Section) + 16#30#); |
| 9532 |
Res(2) := '.'; |
| 9533 |
Res(3) := Character'Val (Format_Object.Clause_Number.Clause + 16#30#); |
| 9534 |
Res(4) := '.'; |
| 9535 |
Res(5) := Character'Val (Format_Object.Clause_Number.Subclause + 16#30#); |
| 9536 |
Res(6) := '.'; |
| 9537 |
Res(7) := Character'Val (Format_Object.Clause_Number.Subsubclause + 16#30#); |
| 9538 |
Res(8) := '('; |
| 9539 |
Res(9) := Character'Val ((Format_Object.Next_Paragraph / 10) + 16#30#); |
| 9540 |
Res(10) := Character'Val ((Format_Object.Next_Paragraph mod 10) + 16#30#); |
| 9541 |
Res(11) := '.'; |
| 9542 |
Res(12) := Character'Val ((Format_Object.Next_Insert_Para mod 10) + 16#30#); |
| 9543 |
Res(13) := ')'; |
| 9544 |
return Res; |
| 9545 |
end Sort_Clause_String; |
| 9546 |
|
| 9547 |
function See_String return String is |
| 9548 |
begin |
| 9549 |
case Format_Object.Impdef_Info.Change_Kind is |
| 9550 |
when ARM_Database.None | ARM_Database.Revised | |
| 9551 |
ARM_Database.Revised_Inserted_Number => |
| 9552 |
if Format_Object.Number_Paragraphs and then |
| 9553 |
Format_Object.Impdef_Info.Command /= Aspect then |
| 9554 |
return " See @RefSecbyNum{" & DB_Clause_String & "}(" & |
| 9555 |
Format_Object.Impdef_Info.Paragraph_String (1..Format_Object.Impdef_Info.Paragraph_Len) & |
| 9556 |
")."; |
| 9557 |
else -- No paragraph numbers. |
| 9558 |
return " See @RefSecbyNum{" & DB_Clause_String & "}."; |
| 9559 |
end if; |
| 9560 |
when ARM_Database.Inserted | ARM_Database.Inserted_Normal_Number => |
| 9561 |
if Format_Object.Number_Paragraphs and then |
| 9562 |
Format_Object.Impdef_Info.Command /= Aspect then |
| 9563 |
return "@Chg{Version=[" & Format_Object.Impdef_Info.Version & |
| 9564 |
"], New=[ See @RefSecbyNum{" & DB_Clause_String & "}(" & |
| 9565 |
Format_Object.Impdef_Info.Paragraph_String (1..Format_Object.Impdef_Info.Paragraph_Len) & |
| 9566 |
").],Old=[]}"; |
| 9567 |
else -- No paragraph numbers. |
| 9568 |
return "@Chg{Version=[" & Format_Object.Impdef_Info.Version & |
| 9569 |
"], New=[ See @RefSecbyNum{" & DB_Clause_String & "}.],Old=[]}"; |
| 9570 |
end if; |
| 9571 |
when ARM_Database.Deleted | |
| 9572 |
ARM_Database.Deleted_Inserted_Number | |
| 9573 |
ARM_Database.Deleted_No_Delete_Message | |
| 9574 |
ARM_Database.Deleted_Inserted_Number_No_Delete_Message => |
| 9575 |
if Format_Object.Number_Paragraphs and then |
| 9576 |
Format_Object.Impdef_Info.Command /= Aspect then |
| 9577 |
return "@Chg{Version=[" & Format_Object.Impdef_Info.Version & |
| 9578 |
"], New=[],Old=[ See @RefSecbyNum{" & DB_Clause_String & "}(" & |
| 9579 |
Format_Object.Impdef_Info.Paragraph_String (1..Format_Object.Impdef_Info.Paragraph_Len) & |
| 9580 |
").]}"; |
| 9581 |
else -- No paragraph numbers. |
| 9582 |
return "@Chg{Version=[" & Format_Object.Impdef_Info.Version & |
| 9583 |
"], New=[],Old=[ See @RefSecbyNum{" & DB_Clause_String & "}.]}"; |
| 9584 |
end if; |
| 9585 |
end case; |
| 9586 |
end See_String; |
| 9587 |
|
| 9588 |
begin |
| 9589 |
Arm_Input.Stop_Recording_and_Read_Result |
| 9590 |
(Input_Object, Text_Buffer, Text_Buffer_Len); |
| 9591 |
Text_Buffer_Len := Text_Buffer_Len - 1; -- Remove command close character. |
| 9592 |
if not Format_Object.Impdef_Info.Add_to_DB then |
| 9593 |
null; -- Don't add to the DB |
| 9594 |
elsif Format_Object.Impdef_Info.Command = Aspect then |
| 9595 |
if Format_Object.Impdef_Info.Initial_Version >= '4' then |
| 9596 |
-- ** Horrible hack: We treat the aspect as inserted |
| 9597 |
-- if the initial version is greater than 4 (this is |
| 9598 |
-- what we need in the RM and AARM). This |
| 9599 |
-- should depend on other parameters, and ideally |
| 9600 |
-- be determined inside of the DB_Report code. |
| 9601 |
ARM_Database.Insert (DB, |
| 9602 |
Sort_Key => Format_Object.Impdef_Info.Aspect_Name(1..Format_Object.Impdef_Info.Aspect_Name_Len), |
| 9603 |
Hang_Item => "@Chg{Version=[" & Format_Object.Impdef_Info.Initial_Version & |
| 9604 |
"],New=[" & Format_Object.Impdef_Info.Aspect_Name(1..Format_Object.Impdef_Info.Aspect_Name_Len) & |
| 9605 |
"],Old=[]}", |
| 9606 |
Text => Text_Buffer(1..Text_Buffer_Len) & |
| 9607 |
See_String, |
| 9608 |
Change_Kind => Format_Object.Impdef_Info.Change_Kind, |
| 9609 |
Version => Format_Object.Impdef_Info.Version, |
| 9610 |
Initial_Version => Format_Object.Impdef_Info.Initial_Version); |
| 9611 |
else -- Normal |
| 9612 |
ARM_Database.Insert (DB, |
| 9613 |
Sort_Key => Format_Object.Impdef_Info.Aspect_Name(1..Format_Object.Impdef_Info.Aspect_Name_Len), |
| 9614 |
Hang_Item => Format_Object.Impdef_Info.Aspect_Name(1..Format_Object.Impdef_Info.Aspect_Name_Len), |
| 9615 |
Text => Text_Buffer(1..Text_Buffer_Len) & |
| 9616 |
See_String, |
| 9617 |
Change_Kind => Format_Object.Impdef_Info.Change_Kind, |
| 9618 |
Version => Format_Object.Impdef_Info.Version, |
| 9619 |
Initial_Version => Format_Object.Impdef_Info.Initial_Version); |
| 9620 |
end if; |
| 9621 |
else |
| 9622 |
ARM_Database.Insert (DB, |
| 9623 |
Sort_Key => Sort_Clause_String, |
| 9624 |
Hang_Item => "", |
| 9625 |
Text => Text_Buffer(1..Text_Buffer_Len) & |
| 9626 |
See_String, |
| 9627 |
Change_Kind => Format_Object.Impdef_Info.Change_Kind, |
| 9628 |
Version => Format_Object.Impdef_Info.Version, |
| 9629 |
Initial_Version => Format_Object.Impdef_Info.Initial_Version); |
| 9630 |
end if; |
| 9631 |
-- Finish the text processing: |
| 9632 |
if Format_Object.Impdef_Info.Add_to_DB and |
| 9633 |
Format_Object.Include_Annotations then |
| 9634 |
-- End the annotation: |
| 9635 |
Check_End_Paragraph; |
| 9636 |
if Format_Object.Next_Paragraph_Subhead_Type /= |
| 9637 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Old_Next_Subhead_Paragraph then |
| 9638 |
Format_Object.Last_Paragraph_Subhead_Type := |
| 9639 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Old_Last_Subhead_Paragraph; |
| 9640 |
-- else still in same subhead, leave alone. (If |
| 9641 |
-- we didn't do this, we'd output the subhead |
| 9642 |
-- multiple times). |
| 9643 |
end if; |
| 9644 |
Format_Object.Next_Paragraph_Subhead_Type := |
| 9645 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Old_Next_Subhead_Paragraph; |
| 9646 |
Format_Object.Next_Paragraph_Format_Type := |
| 9647 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Old_Next_Paragraph_Format; |
| 9648 |
Format_Object.Paragraph_Tab_Stops := |
| 9649 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Old_Tab_Stops; |
| 9650 |
-- else nothing started, nothing to finish. |
| 9651 |
end if; |
| 9652 |
-- Clear the Impdef information: |
| 9653 |
Format_Object.Impdef_Info := (Command => None); |
| 9654 |
end Finish_and_DB_Entry; |
| 9655 |
|
| 9656 |
begin |
| 9657 |
case Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Command is |
| 9658 |
when Redundant => |
| 9659 |
if Format_Object.Include_Annotations then |
| 9660 |
Check_Paragraph; |
| 9661 |
ARM_Output.Ordinary_Character (Output_Object, ']'); |
| 9662 |
-- else ignored. |
| 9663 |
end if; |
| 9664 |
|
| 9665 |
when Bold | Italic | Roman | Swiss | Fixed | Roman_Italic | |
| 9666 |
Shrink | Grow | Up | Down | |
| 9667 |
Black | Red | Green | Blue | |
| 9668 |
Keyword | Non_Terminal | Non_Terminal_Format | |
| 9669 |
Example_Text | Example_Comment => |
| 9670 |
-- Formatting commands; revert to the previous (saved) |
| 9671 |
-- version: |
| 9672 |
Check_Paragraph; |
| 9673 |
Format_Object.Text_Format := |
| 9674 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Text_Format; |
| 9675 |
ARM_Output.Text_Format (Output_Object, |
| 9676 |
Format => Format_Object.Text_Format); |
| 9677 |
|
| 9678 |
when Subheading | Heading => |
| 9679 |
-- Restore the format. |
| 9680 |
Check_Paragraph; |
| 9681 |
ARM_Output.Text_Format (Output_Object, |
| 9682 |
Format => ARM_Output.NORMAL_FORMAT); |
| 9683 |
Format_Object.Text_Format := ARM_Output.NORMAL_FORMAT; |
| 9684 |
Check_End_Paragraph; |
| 9685 |
|
| 9686 |
when Added_Subheading => |
| 9687 |
-- Restore the format. |
| 9688 |
declare |
| 9689 |
Disposition : ARM_Output.Change_Type; |
| 9690 |
use type ARM_Output.Change_Type; |
| 9691 |
begin |
| 9692 |
Calc_Change_Disposition ( |
| 9693 |
Format_Object => Format_Object, |
| 9694 |
Version => Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Change_Version, |
| 9695 |
Operation => ARM_Output.Insertion, |
| 9696 |
Text_Kind => Disposition); |
| 9697 |
|
| 9698 |
if Disposition = Do_Not_Display_Text then |
| 9699 |
-- The new text was ignored. |
| 9700 |
null; -- Nothing to do (we nulled out the text before we got here). |
| 9701 |
elsif Disposition = ARM_Output.None then |
| 9702 |
-- Display the text normally. |
| 9703 |
Check_Paragraph; |
| 9704 |
ARM_Output.Text_Format (Output_Object, |
| 9705 |
Format => ARM_Output.NORMAL_FORMAT); |
| 9706 |
Format_Object.Text_Format := ARM_Output.NORMAL_FORMAT; |
| 9707 |
Check_End_Paragraph; |
| 9708 |
elsif Disposition = ARM_Output.Deletion then |
| 9709 |
raise Program_Error; -- A deletion inside of an insertion command! |
| 9710 |
else -- Insertion. |
| 9711 |
Check_Paragraph; |
| 9712 |
ARM_Output.Text_Format (Output_Object, |
| 9713 |
Format => ARM_Output.NORMAL_FORMAT); |
| 9714 |
Format_Object.Text_Format := ARM_Output.NORMAL_FORMAT; |
| 9715 |
Check_End_Paragraph; |
| 9716 |
end if; |
| 9717 |
end; |
| 9718 |
|
| 9719 |
when Center | Right => |
| 9720 |
-- Close the paragraph. |
| 9721 |
Check_End_Paragraph; |
| 9722 |
|
| 9723 |
when New_Page_for_Version => |
| 9724 |
-- The version parameter is stored in Change_Version on |
| 9725 |
-- the stack. |
| 9726 |
if Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Change_Version |
| 9727 |
= Format_Object.Change_Version then |
| 9728 |
Check_End_Paragraph; -- End any paragraph that we're in. |
| 9729 |
ARM_Output.New_Page (Output_Object, ARM_Output.Any_Page); |
| 9730 |
-- else do nothing. |
| 9731 |
end if; |
| 9732 |
|
| 9733 |
when RM_New_Page_for_Version => |
| 9734 |
-- The version parameter is stored in Change_Version on |
| 9735 |
-- the stack. |
| 9736 |
if not Format_Object.Include_Annotations and then |
| 9737 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Change_Version |
| 9738 |
= Format_Object.Change_Version then |
| 9739 |
Check_End_Paragraph; -- End any paragraph that we're in. |
| 9740 |
ARM_Output.New_Page (Output_Object, ARM_Output.Any_Page); |
| 9741 |
-- else do nothing. |
| 9742 |
end if; |
| 9743 |
|
| 9744 |
when Not_ISO_RM_New_Page_for_Version => |
| 9745 |
-- The version parameter is stored in Change_Version on |
| 9746 |
-- the stack. |
| 9747 |
if not Format_Object.Include_Annotations and then |
| 9748 |
not Format_Object.Include_ISO and then |
| 9749 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Change_Version |
| 9750 |
= Format_Object.Change_Version then |
| 9751 |
Check_End_Paragraph; -- End any paragraph that we're in. |
| 9752 |
ARM_Output.New_Page (Output_Object, ARM_Output.Any_Page); |
| 9753 |
-- else do nothing. |
| 9754 |
end if; |
| 9755 |
|
| 9756 |
when ISO_Only_RM_New_Page_for_Version => |
| 9757 |
-- The version parameter is stored in Change_Version on |
| 9758 |
-- the stack. |
| 9759 |
if not Format_Object.Include_Annotations and then |
| 9760 |
Format_Object.Include_ISO and then |
| 9761 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Change_Version |
| 9762 |
= Format_Object.Change_Version then |
| 9763 |
Check_End_Paragraph; -- End any paragraph that we're in. |
| 9764 |
ARM_Output.New_Page (Output_Object, ARM_Output.Any_Page); |
| 9765 |
-- else do nothing. |
| 9766 |
end if; |
| 9767 |
|
| 9768 |
when New_Column_for_Version => |
| 9769 |
-- The version parameter is stored in Change_Version on |
| 9770 |
-- the stack. |
| 9771 |
if Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Change_Version |
| 9772 |
= Format_Object.Change_Version then |
| 9773 |
Check_End_Paragraph; -- End any paragraph that we're in. |
| 9774 |
ARM_Output.New_Column (Output_Object); |
| 9775 |
-- else do nothing. |
| 9776 |
end if; |
| 9777 |
|
| 9778 |
when Table_Param_Caption => |
| 9779 |
ARM_Output.Table_Marker (Output_Object, |
| 9780 |
ARM_Output.End_Caption); |
| 9781 |
Format_Object.Last_Non_Space := False; |
| 9782 |
|
| 9783 |
Format_State.Nesting_Stack_Ptr := Format_State.Nesting_Stack_Ptr - 1; |
| 9784 |
-- Unstack the "Caption" parameter. |
| 9785 |
--Ada.Text_IO.Put_Line (" &Unstack (Tab Cap)"); |
| 9786 |
|
| 9787 |
-- Check and handle the following "Headers" parameter: |
| 9788 |
declare |
| 9789 |
Ch : Character; |
| 9790 |
begin |
| 9791 |
ARM_Input.Check_Parameter_Name (Input_Object, |
| 9792 |
Param_Name => "Headers" & (8..ARM_Input.Command_Name_Type'Last => ' '), |
| 9793 |
Is_First => False, |
| 9794 |
Param_Close_Bracket => Ch); |
| 9795 |
if Ch /= ' ' then -- There is a parameter. |
| 9796 |
-- Stack the parameter so we can process the end: |
| 9797 |
Set_Nesting_for_Parameter |
| 9798 |
(Command => Table_Param_Header, |
| 9799 |
Close_Ch => Ch); |
| 9800 |
|
| 9801 |
-- No processing needed here. |
| 9802 |
|
| 9803 |
-- else no parameter. Weird. |
| 9804 |
end if; |
| 9805 |
return; -- We've already done the unstacking. |
| 9806 |
end; |
| 9807 |
|
| 9808 |
when Table_Param_Header => |
| 9809 |
ARM_Output.Table_Marker (Output_Object, |
| 9810 |
ARM_Output.End_Header); |
| 9811 |
Format_Object.Last_Non_Space := False; |
| 9812 |
|
| 9813 |
Format_State.Nesting_Stack_Ptr := Format_State.Nesting_Stack_Ptr - 1; |
| 9814 |
-- Unstack the "Header" parameter. |
| 9815 |
--Ada.Text_IO.Put_Line (" &Unstack (Tab Head)"); |
| 9816 |
|
| 9817 |
-- Check and handle the following "Body" parameter: |
| 9818 |
declare |
| 9819 |
Ch : Character; |
| 9820 |
begin |
| 9821 |
ARM_Input.Check_Parameter_Name (Input_Object, |
| 9822 |
Param_Name => "Body" & (5..ARM_Input.Command_Name_Type'Last => ' '), |
| 9823 |
Is_First => False, |
| 9824 |
Param_Close_Bracket => Ch); |
| 9825 |
if Ch /= ' ' then -- There is a parameter. |
| 9826 |
-- Stack the parameter so we can process the end: |
| 9827 |
Set_Nesting_for_Parameter |
| 9828 |
(Command => Table_Param_Body, |
| 9829 |
Close_Ch => Ch); |
| 9830 |
|
| 9831 |
-- No processing needed here. |
| 9832 |
|
| 9833 |
-- else no parameter. Weird. |
| 9834 |
end if; |
| 9835 |
return; -- We've already done the unstacking. |
| 9836 |
end; |
| 9837 |
|
| 9838 |
when Table_Param_Body => |
| 9839 |
-- Close the table: |
| 9840 |
ARM_Output.Table_Marker (Output_Object, |
| 9841 |
ARM_Output.End_Table); |
| 9842 |
Format_Object.Last_Non_Space := False; |
| 9843 |
|
| 9844 |
-- Reset the paragraph format (and skip over the parameter records): |
| 9845 |
Format_Object.Last_Paragraph_Subhead_Type := |
| 9846 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr-1).Old_Last_Subhead_Paragraph; |
| 9847 |
Format_Object.Next_Paragraph_Subhead_Type := |
| 9848 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr-1).Old_Next_Subhead_Paragraph; |
| 9849 |
Format_Object.Next_Paragraph_Format_Type := |
| 9850 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr-1).Old_Next_Paragraph_Format; |
| 9851 |
Format_Object.Paragraph_Tab_Stops := |
| 9852 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr-1).Old_Tab_Stops; |
| 9853 |
Format_Object.In_Paragraph := False; -- End fake paragraph. |
| 9854 |
Format_Object.No_Start_Paragraph := False; |
| 9855 |
|
| 9856 |
when Syntax_Rule_RHS => |
| 9857 |
-- Send the production to the syntax manager. |
| 9858 |
-- Other processing has already been handled. |
| 9859 |
declare |
| 9860 |
Text_Buffer : String (1..ARM_Input.MAX_RECORDING_SIZE); |
| 9861 |
Text_Buffer_Len : Natural; |
| 9862 |
Disposition : ARM_Output.Change_Type; |
| 9863 |
use type ARM_Output.Change_Type; |
| 9864 |
begin |
| 9865 |
-- Calculate Disposition: |
| 9866 |
if Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr-1).Command = Syntax_Rule then |
| 9867 |
Disposition := ARM_Output.None; -- Normal text. |
| 9868 |
elsif Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr-1).Command = Added_Syntax_Rule then |
| 9869 |
Calc_Change_Disposition ( |
| 9870 |
Format_Object => Format_Object, |
| 9871 |
Version => Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr-1).Change_Version, |
| 9872 |
Operation => ARM_Output.Insertion, |
| 9873 |
Text_Kind => Disposition); |
| 9874 |
else -- Deleted_Syntax_Rule |
| 9875 |
Calc_Change_Disposition ( |
| 9876 |
Format_Object => Format_Object, |
| 9877 |
Version => Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr-1).Change_Version, |
| 9878 |
Operation => ARM_Output.Deletion, |
| 9879 |
Text_Kind => Disposition); |
| 9880 |
end if; |
| 9881 |
|
| 9882 |
if Disposition = Do_Not_Display_Text then |
| 9883 |
-- The text was ignored and skipped. |
| 9884 |
-- Set the Non-terminal to empty: |
| 9885 |
Format_Object.Syntax_NT_Len := 0; |
| 9886 |
Format_Object.Syntax_Tab_Len := 0; |
| 9887 |
else |
| 9888 |
Arm_Input.Stop_Recording_and_Read_Result |
| 9889 |
(Input_Object, Text_Buffer, Text_Buffer_Len); |
| 9890 |
Text_Buffer_Len := Text_Buffer_Len - 1; -- Remove command close character. |
| 9891 |
if Disposition = ARM_Output.None then |
| 9892 |
-- Display the text normally. |
| 9893 |
ARM_Syntax.Insert_Rule (For_Clause => Clause_String (Format_Object), |
| 9894 |
Rule => "@ntf{" & Format_Object.Syntax_NT(1..Format_Object.Syntax_NT_Len) & |
| 9895 |
" ::=} " & Text_Buffer(1..Text_Buffer_Len), |
| 9896 |
Tabset => Format_Object.Syntax_Tab(1..Format_Object.Syntax_Tab_Len)); |
| 9897 |
elsif Disposition = ARM_Output.Deletion then |
| 9898 |
ARM_Syntax.Insert_Rule (For_Clause => Clause_String (Format_Object), |
| 9899 |
Rule => "@ntf{" & Format_Object.Syntax_NT(1..Format_Object.Syntax_NT_Len) & |
| 9900 |
"@Chg{Version=[" & Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr-1).Change_Version & |
| 9901 |
"],New=[],Old=[ ::=]}} " & Text_Buffer(1..Text_Buffer_Len), |
| 9902 |
Tabset => Format_Object.Syntax_Tab(1..Format_Object.Syntax_Tab_Len)); |
| 9903 |
else -- Insertion. |
| 9904 |
ARM_Syntax.Insert_Rule (For_Clause => Clause_String (Format_Object), |
| 9905 |
Rule => "@ntf{" & Format_Object.Syntax_NT(1..Format_Object.Syntax_NT_Len) & |
| 9906 |
"@Chg{Version=[" & Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr-1).Change_Version & |
| 9907 |
"],New=[ ::=],Old=[]}} " & Text_Buffer(1..Text_Buffer_Len), |
| 9908 |
Tabset => Format_Object.Syntax_Tab(1..Format_Object.Syntax_Tab_Len)); |
| 9909 |
end if; |
| 9910 |
-- Note: The LHS non-terminals aren't linked as usual. |
| 9911 |
|
| 9912 |
Check_End_Paragraph; -- End the paragraph, so the |
| 9913 |
-- next rule gets its own. |
| 9914 |
|
| 9915 |
-- Reset the paragraph format: |
| 9916 |
Format_Object.Last_Paragraph_Subhead_Type := |
| 9917 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Old_Last_Subhead_Paragraph; |
| 9918 |
Format_Object.Next_Paragraph_Subhead_Type := |
| 9919 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Old_Next_Subhead_Paragraph; |
| 9920 |
Format_Object.Next_Paragraph_Format_Type := |
| 9921 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Old_Next_Paragraph_Format; |
| 9922 |
Format_Object.Paragraph_Tab_Stops := |
| 9923 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Old_Tab_Stops; |
| 9924 |
|
| 9925 |
-- Set the Non-terminal to empty: |
| 9926 |
Format_Object.Syntax_NT_Len := 0; |
| 9927 |
Format_Object.Syntax_Tab_Len := 0; |
| 9928 |
end if; |
| 9929 |
end; |
| 9930 |
|
| 9931 |
when Syntax_Prefix => |
| 9932 |
-- Reset the style: |
| 9933 |
Check_Paragraph; |
| 9934 |
Format_Object.Text_Format.Italic := False; |
| 9935 |
ARM_Output.Text_Format (Output_Object, |
| 9936 |
Format_Object.Text_Format); |
| 9937 |
|
| 9938 |
when Glossary_Text_Param => |
| 9939 |
-- Save the glossary entry in the Glossary database. |
| 9940 |
if not Format_Object.Glossary_Info.Active then |
| 9941 |
Ada.Text_IO.Put_Line (" ** Not in glossary command at end of glossary command!? on line " & ARM_Input.Line_String (Input_Object)); |
| 9942 |
-- else OK. |
| 9943 |
end if; |
| 9944 |
declare |
| 9945 |
use type ARM_Database.Paragraph_Change_Kind_Type; |
| 9946 |
Text_Buffer : String (1..ARM_Input.MAX_RECORDING_SIZE); |
| 9947 |
Text_Buffer_Len : Natural; |
| 9948 |
begin |
| 9949 |
Arm_Input.Stop_Recording_and_Read_Result |
| 9950 |
(Input_Object, Text_Buffer, Text_Buffer_Len); |
| 9951 |
Text_Buffer_Len := Text_Buffer_Len - 1; -- Remove command close character. |
| 9952 |
if Format_Object.Glossary_Info.Add_to_Glossary then |
| 9953 |
if Format_Object.Glossary_Info.Change_Kind = ARM_Database.Inserted then |
| 9954 |
ARM_Database.Insert (Format_Object.Glossary_DB, |
| 9955 |
Sort_Key => Format_Object.Glossary_Info.Term(1..Format_Object.Glossary_Info.Term_Len), |
| 9956 |
Hang_Item => "", |
| 9957 |
Text => "@chg{Version=[" & Format_Object.Glossary_Info.Version & "],New=[@b{" & |
| 9958 |
Format_Object.Glossary_Info.Term(1..Format_Object.Glossary_Info.Term_Len) & |
| 9959 |
".}],Old=[]} " & Text_Buffer(1..Text_Buffer_Len), |
| 9960 |
Change_Kind => Format_Object.Glossary_Info.Change_Kind, |
| 9961 |
Version => Format_Object.Glossary_Info.Version, |
| 9962 |
Initial_Version => Format_Object.Glossary_Info.Version); |
| 9963 |
|
| 9964 |
elsif Format_Object.Glossary_Info.Change_Kind = ARM_Database.Deleted then |
| 9965 |
ARM_Database.Insert (Format_Object.Glossary_DB, |
| 9966 |
Sort_Key => Format_Object.Glossary_Info.Term(1..Format_Object.Glossary_Info.Term_Len), |
| 9967 |
Hang_Item => "", |
| 9968 |
Text => "@chg{Version=[" & Format_Object.Glossary_Info.Version & "],New=[],Old=[@b{" & |
| 9969 |
Format_Object.Glossary_Info.Term(1..Format_Object.Glossary_Info.Term_Len) & |
| 9970 |
".}]} " & Text_Buffer(1..Text_Buffer_Len), |
| 9971 |
Change_Kind => Format_Object.Glossary_Info.Change_Kind, |
| 9972 |
Version => Format_Object.Glossary_Info.Version); |
| 9973 |
|
| 9974 |
elsif Format_Object.Glossary_Info.Change_Kind = ARM_Database.None then |
| 9975 |
ARM_Database.Insert (Format_Object.Glossary_DB, |
| 9976 |
Sort_Key => Format_Object.Glossary_Info.Term(1..Format_Object.Glossary_Info.Term_Len), |
| 9977 |
Hang_Item => "", |
| 9978 |
Text => "@b{" & Format_Object.Glossary_Info.Term(1..Format_Object.Glossary_Info.Term_Len) & |
| 9979 |
".} " & Text_Buffer(1..Text_Buffer_Len), |
| 9980 |
Change_Kind => ARM_Database.None); |
| 9981 |
|
| 9982 |
else |
| 9983 |
ARM_Database.Insert (Format_Object.Glossary_DB, |
| 9984 |
Sort_Key => Format_Object.Glossary_Info.Term(1..Format_Object.Glossary_Info.Term_Len), |
| 9985 |
Hang_Item => "", |
| 9986 |
Text => "@b{" & Format_Object.Glossary_Info.Term(1..Format_Object.Glossary_Info.Term_Len) & |
| 9987 |
".} " & Text_Buffer(1..Text_Buffer_Len), |
| 9988 |
Change_Kind => Format_Object.Glossary_Info.Change_Kind, |
| 9989 |
Version => Format_Object.Glossary_Info.Version); |
| 9990 |
end if; |
| 9991 |
end if; |
| 9992 |
end; |
| 9993 |
|
| 9994 |
-- Finish the text processing: |
| 9995 |
if Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr-1).Command = To_Glossary_Also or else |
| 9996 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr-1).Command = Change_To_Glossary_Also then |
| 9997 |
null; -- Normal text, no special handling needed. |
| 9998 |
else |
| 9999 |
if Format_Object.Glossary_Info.Displayed then |
| 10000 |
-- End the annotation. |
| 10001 |
Check_End_Paragraph; |
| 10002 |
Format_Object.Last_Paragraph_Subhead_Type := |
| 10003 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Old_Last_Subhead_Paragraph; |
| 10004 |
Format_Object.Next_Paragraph_Subhead_Type := |
| 10005 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Old_Next_Subhead_Paragraph; |
| 10006 |
Format_Object.Next_Paragraph_Format_Type := |
| 10007 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Old_Next_Paragraph_Format; |
| 10008 |
Format_Object.Paragraph_Tab_Stops := |
| 10009 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Old_Tab_Stops; |
| 10010 |
else |
| 10011 |
null; -- No text, no special handling needed. |
| 10012 |
end if; |
| 10013 |
end if; |
| 10014 |
-- Remove glossary information as the command is finished: |
| 10015 |
Format_Object.Glossary_Info := |
| 10016 |
(Active => False, |
| 10017 |
Change_Kind => ARM_Database.None); |
| 10018 |
|
| 10019 |
when Attribute_Text_Param => |
| 10020 |
declare |
| 10021 |
Text_Buffer : String (1..ARM_Input.MAX_RECORDING_SIZE); |
| 10022 |
Text_Buffer_Len : Natural; |
| 10023 |
|
| 10024 |
function Sort_Key return String is |
| 10025 |
-- Generate a Sort Key so that these sort |
| 10026 |
-- as they did in Ada 95. |
| 10027 |
begin |
| 10028 |
if Format_Object.Attr_Prefix_Len > 2 and then |
| 10029 |
Format_Object.Attr_Prefix(2) = ''' then |
| 10030 |
-- Class-wide prefix. For some reason, this |
| 10031 |
-- sorts before the main item in the Ada 95 RM. |
| 10032 |
-- (And this continues in later RMs.) |
| 10033 |
return Format_Object.Attr_Name(1..Format_Object.Attr_Name_Len) & |
| 10034 |
''' & Character'Pred(Format_Object.Attr_Prefix(1)) & |
| 10035 |
"'Class"; |
| 10036 |
-- Sort by name, then by prefix. |
| 10037 |
else |
| 10038 |
return Format_Object.Attr_Name(1..Format_Object.Attr_Name_Len) & |
| 10039 |
''' & Format_Object.Attr_Prefix(1..Format_Object.Attr_Prefix_Len); |
| 10040 |
-- Sort by name, then by prefix. |
| 10041 |
end if; |
| 10042 |
-- Note: Ada 2005 sorted E'Identity and T'Identity |
| 10043 |
-- backwards from Ada 95. This will fix that. |
| 10044 |
end Sort_Key; |
| 10045 |
|
| 10046 |
function ChgRef_Command (Kind : in ARM_Database.Paragraph_Change_Kind_Type; |
| 10047 |
Version : in Character; |
| 10048 |
Initial_Version : in Character) return String is |
| 10049 |
-- Careful: This assumes this is being used for |
| 10050 |
-- the attribute index, which has always existed. |
| 10051 |
-- Use the annex initial version rather than '0' |
| 10052 |
-- to determine whether it is inserted or not for |
| 10053 |
-- other listings. |
| 10054 |
begin |
| 10055 |
case Kind is |
| 10056 |
when ARM_Database.None => |
| 10057 |
return ""; |
| 10058 |
when ARM_Database.Inserted | ARM_Database.Inserted_Normal_Number => |
| 10059 |
if Initial_Version > '0' then -- Not original. |
| 10060 |
return "@Chgref{Version=[" & Version & |
| 10061 |
"],Kind=[Added]}"; |
| 10062 |
else |
| 10063 |
return "@Chgref{Version=[" & Version & |
| 10064 |
"],Kind=[AddedNormal]}"; |
| 10065 |
end if; |
| 10066 |
when ARM_Database.Deleted | |
| 10067 |
ARM_Database.Deleted_Inserted_Number | |
| 10068 |
ARM_Database.Deleted_No_Delete_Message | |
| 10069 |
ARM_Database.Deleted_Inserted_Number_No_Delete_Message => |
| 10070 |
if Initial_Version > '0' then -- Not original. |
| 10071 |
return "@Chgref{Version=[" & Version & |
| 10072 |
"],Kind=[DeletedAdded]}"; |
| 10073 |
else |
| 10074 |
return "@Chgref{Version=[" & Version & |
| 10075 |
"],Kind=[Deleted]}"; |
| 10076 |
end if; |
| 10077 |
when ARM_Database.Revised | ARM_Database.Revised_Inserted_Number => |
| 10078 |
if Initial_Version > '0' then -- Not original. |
| 10079 |
return "@Chgref{Version=[" & Version & |
| 10080 |
"],Kind=[RevisedAdded]}"; |
| 10081 |
else |
| 10082 |
return "@Chgref{Version=[" & Version & |
| 10083 |
"],Kind=[Revised]}"; |
| 10084 |
end if; |
| 10085 |
end case; |
| 10086 |
end ChgRef_Command; |
| 10087 |
|
| 10088 |
|
| 10089 |
function XRef_String (Text_Kind : |
| 10090 |
in ARM_Database.Paragraph_Change_Kind_Type; |
| 10091 |
Text_Version, Initial_Version : in Character) |
| 10092 |
return String is |
| 10093 |
-- Return the correct Cross-Reference string |
| 10094 |
-- for this item. If we're not in a paragraph, |
| 10095 |
-- we need to include appropriate @ChgRef and |
| 10096 |
-- a @Noprefix commands, lest this XRef hang out |
| 10097 |
-- with the incorrect kind of paragraph number. |
| 10098 |
begin |
| 10099 |
if Format_Object.In_Paragraph then |
| 10100 |
-- We can just stick this on the existing |
| 10101 |
-- paragraph. |
| 10102 |
return " See @RefSecbyNum{" & |
| 10103 |
Clause_String(Format_Object) & "}."; |
| 10104 |
else |
| 10105 |
-- We have to create a separate paragraph (this |
| 10106 |
-- usually happens if some other format |
| 10107 |
-- immediately precedes the end). |
| 10108 |
return ChgRef_Command (Text_Kind, Text_Version, Initial_Version) & |
| 10109 |
"@noprefix@;See @RefSecbyNum{" & |
| 10110 |
Clause_String(Format_Object) & "}."; |
| 10111 |
end if; |
| 10112 |
end XRef_String; |
| 10113 |
|
| 10114 |
|
| 10115 |
procedure Write_to_DB (Prefix_Kind, Text_Kind : |
| 10116 |
in ARM_Database.Paragraph_Change_Kind_Type; |
| 10117 |
Prefix_Version, Text_Version, |
| 10118 |
Initial_Version : in Character) is |
| 10119 |
-- Write the item to the DB; use Prefix_Kind and |
| 10120 |
-- Text_Kind for the change kind. |
| 10121 |
begin |
| 10122 |
if Format_Object.Attr_Leading then |
| 10123 |
ARM_Database.Insert (Format_Object.Attr_DB, |
| 10124 |
Sort_Key => Sort_Key, |
| 10125 |
Hang_Item => |
| 10126 |
Format_Object.Attr_Prefix(1..Format_Object.Attr_Prefix_Len) & |
| 10127 |
''' & Format_Object.Attr_Name(1..Format_Object.Attr_Name_Len), |
| 10128 |
Text => "For " & Format_Object.Prefix_Text(1..Format_Object.Prefix_Text_Len) & |
| 10129 |
":" & Ascii.LF & Ascii.LF & |
| 10130 |
ChgRef_Command (Text_Kind, Text_Version, Initial_Version) & |
| 10131 |
"@leading@noprefix@;" & Text_Buffer(1..Text_Buffer_Len) & |
| 10132 |
XRef_String (Text_Kind, Text_Version, Initial_Version), |
| 10133 |
Change_Kind => Prefix_Kind, |
| 10134 |
Version => Prefix_Version, |
| 10135 |
Initial_Version => Initial_Version); |
| 10136 |
else -- not leading: |
| 10137 |
ARM_Database.Insert (Format_Object.Attr_DB, |
| 10138 |
Sort_Key => Sort_Key, |
| 10139 |
Hang_Item => |
| 10140 |
Format_Object.Attr_Prefix(1..Format_Object.Attr_Prefix_Len) & |
| 10141 |
''' & Format_Object.Attr_Name(1..Format_Object.Attr_Name_Len), |
| 10142 |
Text => "For " & Format_Object.Prefix_Text(1..Format_Object.Prefix_Text_Len) & |
| 10143 |
":" & Ascii.LF & Ascii.LF & |
| 10144 |
ChgRef_Command (Text_Kind, Text_Version, Initial_Version) & |
| 10145 |
"@noprefix@;" & Text_Buffer(1..Text_Buffer_Len) & |
| 10146 |
XRef_String (Text_Kind, Text_Version, Initial_Version), |
| 10147 |
Change_Kind => Prefix_Kind, |
| 10148 |
Version => Prefix_Version, |
| 10149 |
Initial_Version => Initial_Version); |
| 10150 |
end if; |
| 10151 |
end Write_to_DB; |
| 10152 |
|
| 10153 |
use type ARM_Database.Paragraph_Change_Kind_Type; |
| 10154 |
|
| 10155 |
begin |
| 10156 |
Arm_Input.Stop_Recording_and_Read_Result |
| 10157 |
(Input_Object, Text_Buffer, Text_Buffer_Len); |
| 10158 |
Text_Buffer_Len := Text_Buffer_Len - 1; -- Remove command close character. |
| 10159 |
--Ada.Text_IO.Put_Line ("&& Attr: " & Format_Object.Attr_Name(1..Format_Object.Attr_Name_Len) & |
| 10160 |
-- "; Prefix kind=" & ARM_Database.Paragraph_Change_Kind_Type'Image(Format_Object.Attr_Prefix_Change_Kind) & |
| 10161 |
-- "; Attr chg kind=" & ARM_Database.Paragraph_Change_Kind_Type'Image(Format_Object.Attr_Change_Kind)); |
| 10162 |
--Ada.Text_IO.Put_Line (" Attr Prefix Vers=" & Format_Object.Attr_Prefix_Version & "; Attr Text Vers=" & Format_Object.Attr_Version & |
| 10163 |
-- "; Attr Init Vers=" & Format_Object.Attr_Initial_Version & |
| 10164 |
-- "; In_Paragraph: " & Boolean'Image(Format_Object.In_Paragraph)); |
| 10165 |
--Ada.Text_IO.Put_Line (" Text_Buffer: " & Text_Buffer(1..Text_Buffer_Len)); |
| 10166 |
|
| 10167 |
-- How the prefix text is handled depends only on |
| 10168 |
-- the Initial_Version and what version we're generating. |
| 10169 |
-- The Kind and Version of the prefix or item is |
| 10170 |
-- irrelevant (it's needed mainly for the paragraph |
| 10171 |
-- revision number). We assume that all attributes |
| 10172 |
-- are inserted for their Initial_Version (since it's |
| 10173 |
-- unlikely that we'd delete an attribute). |
| 10174 |
|
| 10175 |
if Format_Object.Attr_Omit then |
| 10176 |
-- We want to omit this entry; typically, this |
| 10177 |
-- means it is an inserted item that we are moving |
| 10178 |
-- within the RM. |
| 10179 |
null; |
| 10180 |
|
| 10181 |
elsif Format_Object.Attr_Initial_Version = '0' then |
| 10182 |
-- Initial version, not inserted. |
| 10183 |
--Ada.Text_IO.Put_Line (" Attr: Normal initial version"); |
| 10184 |
-- Normal reference: |
| 10185 |
Write_to_DB (Prefix_Kind => Format_Object.Attr_Prefix_Change_Kind, |
| 10186 |
Text_Kind => Format_Object.Attr_Change_Kind, |
| 10187 |
Prefix_Version => Format_Object.Attr_Prefix_Version, |
| 10188 |
Text_Version => Format_Object.Attr_Version, |
| 10189 |
Initial_Version => '0'); |
| 10190 |
else |
| 10191 |
declare |
| 10192 |
Disposition : ARM_Output.Change_Type; |
| 10193 |
use type ARM_Output.Change_Type; |
| 10194 |
PVersion : Character := Format_Object.Attr_Prefix_Version; |
| 10195 |
PKind : ARM_Database.Paragraph_Change_Kind_Type := |
| 10196 |
Format_Object.Attr_Prefix_Change_Kind; |
| 10197 |
begin |
| 10198 |
if PVersion < Format_Object.Attr_Initial_Version then |
| 10199 |
-- This usually happens when the prefix used |
| 10200 |
-- @PrefixType; in that case, the |
| 10201 |
-- Initial_Version is really want we want. |
| 10202 |
-- And in that case, the prefix paragraph number |
| 10203 |
-- is always inserted (since we can't get here |
| 10204 |
-- if the Initial_Version is '0'). |
| 10205 |
PVersion := Format_Object.Attr_Initial_Version; |
| 10206 |
PKind := ARM_Database.Inserted; |
| 10207 |
end if; |
| 10208 |
|
| 10209 |
Calc_Change_Disposition ( |
| 10210 |
Format_Object => Format_Object, |
| 10211 |
Version => Format_Object.Attr_Initial_Version, |
| 10212 |
Operation => ARM_Output.Insertion, |
| 10213 |
Text_Kind => Disposition); |
| 10214 |
|
| 10215 |
if Disposition = Do_Not_Display_Text then |
| 10216 |
null; -- Do *not* put this into the DB. |
| 10217 |
--Ada.Text_IO.Put_Line (" Attr: Ignore"); |
| 10218 |
elsif Disposition = ARM_Output.None then |
| 10219 |
--Ada.Text_IO.Put_Line (" Attr: Normal"); |
| 10220 |
-- Normal reference: |
| 10221 |
Write_to_DB (Prefix_Kind => PKind, |
| 10222 |
Text_Kind => Format_Object.Attr_Change_Kind, |
| 10223 |
Prefix_Version => PVersion, |
| 10224 |
Text_Version => Format_Object.Attr_Version, |
| 10225 |
Initial_Version => Format_Object.Attr_Initial_Version); |
| 10226 |
elsif Disposition = ARM_Output.Deletion then |
| 10227 |
raise Program_Error; -- A deletion inside of an insertion command! |
| 10228 |
else -- Insertion. |
| 10229 |
-- Write inserted text: |
| 10230 |
-- We need to mark everything with |
| 10231 |
-- the kind and version of the *entire* insertion, |
| 10232 |
-- because the entire thing is an |
| 10233 |
-- insertion. (So we ignore the prefix kind and version). |
| 10234 |
--Ada.Text_IO.Put_Line (" Attr: Inserted version:" & Format_Object.Attr_Initial_Version); |
| 10235 |
if Format_Object.Attr_Leading then |
| 10236 |
ARM_Database.Insert (Format_Object.Attr_DB, |
| 10237 |
Sort_Key => Sort_Key, |
| 10238 |
Hang_Item => |
| 10239 |
"@ChgAdded{Version=[" & Format_Object.Attr_Initial_Version & "],Text=<" & |
| 10240 |
Format_Object.Attr_Prefix(1..Format_Object.Attr_Prefix_Len) & |
| 10241 |
''' & Format_Object.Attr_Name(1..Format_Object.Attr_Name_Len) & ">}", |
| 10242 |
Text => |
| 10243 |
"@ChgAdded{Version=[" & Format_Object.Attr_Initial_Version & "],Text=[" & |
| 10244 |
"For " & Format_Object.Prefix_Text(1..Format_Object.Prefix_Text_Len) & |
| 10245 |
":]}" & Ascii.LF & Ascii.LF & |
| 10246 |
ChgRef_Command (Format_Object.Attr_Change_Kind, Format_Object.Attr_Version, Format_Object.Attr_Initial_Version) & |
| 10247 |
"@leading@noprefix@;" & Text_Buffer(1..Text_Buffer_Len) & |
| 10248 |
XRef_String (Format_Object.Attr_Change_Kind, Format_Object.Attr_Version, Format_Object.Attr_Initial_Version), |
| 10249 |
Change_Kind => PKind, |
| 10250 |
Version => PVersion, |
| 10251 |
Initial_Version => Format_Object.Attr_Initial_Version); |
| 10252 |
else -- not leading: |
| 10253 |
ARM_Database.Insert (Format_Object.Attr_DB, |
| 10254 |
Sort_Key => Sort_Key, |
| 10255 |
Hang_Item => |
| 10256 |
"@ChgAdded{Version=[" & Format_Object.Attr_Initial_Version & "],Text=<" & |
| 10257 |
Format_Object.Attr_Prefix(1..Format_Object.Attr_Prefix_Len) & |
| 10258 |
''' & Format_Object.Attr_Name(1..Format_Object.Attr_Name_Len) & ">}", |
| 10259 |
Text => |
| 10260 |
"@ChgAdded{Version=[" & Format_Object.Attr_Initial_Version & "],Text=[" & |
| 10261 |
"For " & Format_Object.Prefix_Text(1..Format_Object.Prefix_Text_Len) & |
| 10262 |
":]}" & Ascii.LF & Ascii.LF & |
| 10263 |
ChgRef_Command (Format_Object.Attr_Change_Kind, Format_Object.Attr_Version, Format_Object.Attr_Initial_Version) & |
| 10264 |
"@noprefix@;" & Text_Buffer(1..Text_Buffer_Len) & |
| 10265 |
XRef_String (Format_Object.Attr_Change_Kind, Format_Object.Attr_Version, Format_Object.Attr_Initial_Version), |
| 10266 |
Change_Kind => PKind, |
| 10267 |
Version => PVersion, |
| 10268 |
Initial_Version => Format_Object.Attr_Initial_Version); |
| 10269 |
end if; |
| 10270 |
end if; |
| 10271 |
end; |
| 10272 |
end if; |
| 10273 |
Format_Object.Attr_Name_Len := 0; -- No attribute in progress. |
| 10274 |
end; |
| 10275 |
|
| 10276 |
when Pragma_Syntax | Added_Pragma_Syntax | Deleted_Pragma_Syntax => |
| 10277 |
-- Note: Pragma_Syntax is not recorded in the syntax summary. |
| 10278 |
declare |
| 10279 |
Text_Buffer : String (1..ARM_Input.MAX_RECORDING_SIZE); |
| 10280 |
Text_Buffer_Len : Natural; |
| 10281 |
|
| 10282 |
function My_Sort return String is |
| 10283 |
-- Find and return the @prag argument. |
| 10284 |
begin |
| 10285 |
for I in 1 .. Text_Buffer_Len - 7 loop |
| 10286 |
if Text_Buffer(I) = '@' and then |
| 10287 |
(Text_Buffer(I+1) = 'p' or else Text_Buffer(I+1) = 'P') and then |
| 10288 |
(Text_Buffer(I+2) = 'r' or else Text_Buffer(I+2) = 'R') and then |
| 10289 |
(Text_Buffer(I+3) = 'a' or else Text_Buffer(I+3) = 'A') and then |
| 10290 |
(Text_Buffer(I+4) = 'g' or else Text_Buffer(I+4) = 'G') and then |
| 10291 |
ARM_Input.Is_Open_Char (Text_Buffer(I+5)) then |
| 10292 |
-- Found @prag. |
| 10293 |
for J in I+6 .. Text_Buffer_Len loop |
| 10294 |
if Text_Buffer(J) = ARM_Input.Get_Close_Char (Text_Buffer(I+5)) then |
| 10295 |
return Text_Buffer(I+6 .. J-1); |
| 10296 |
end if; |
| 10297 |
end loop; |
| 10298 |
Ada.Text_IO.Put_Line ("** Can't find argument for @prag: " & Text_Buffer(1..Text_Buffer_Len) & |
| 10299 |
" on line " & ARM_Input.Line_String (Input_Object)); |
| 10300 |
return ""; -- Never found the end of the argument. |
| 10301 |
-- else not @prag, keep looking. |
| 10302 |
end if; |
| 10303 |
end loop; |
| 10304 |
-- If we get here, we never found "@prag" |
| 10305 |
Ada.Text_IO.Put_Line ("** Funny pragma format: " & Text_Buffer(1..Text_Buffer_Len) & |
| 10306 |
" on line " & ARM_Input.Line_String (Input_Object)); |
| 10307 |
return ""; -- Gotta return something. |
| 10308 |
end My_Sort; |
| 10309 |
|
| 10310 |
begin |
| 10311 |
Arm_Input.Stop_Recording_and_Read_Result |
| 10312 |
(Input_Object, Text_Buffer, Text_Buffer_Len); |
| 10313 |
Text_Buffer_Len := Text_Buffer_Len - 1; -- Remove command close character. |
| 10314 |
-- Ordinary text processing is fine for the local text. |
| 10315 |
if Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Command = Pragma_Syntax then |
| 10316 |
ARM_Database.Insert (Format_Object.Pragma_DB, |
| 10317 |
Sort_Key => My_Sort, |
| 10318 |
Hang_Item => "", |
| 10319 |
Text => Text_Buffer(1..Text_Buffer_Len) & |
| 10320 |
" @em See @RefSecbyNum{" & Clause_String(Format_Object) & "}."); |
| 10321 |
elsif Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Command = Added_Pragma_Syntax then |
| 10322 |
declare |
| 10323 |
Disposition : ARM_Output.Change_Type; |
| 10324 |
use type ARM_Output.Change_Type; |
| 10325 |
begin |
| 10326 |
Calc_Change_Disposition ( |
| 10327 |
Format_Object => Format_Object, |
| 10328 |
Version => Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Change_Version, |
| 10329 |
Operation => ARM_Output.Insertion, |
| 10330 |
Text_Kind => Disposition); |
| 10331 |
|
| 10332 |
if Disposition = Do_Not_Display_Text then |
| 10333 |
null; -- Not in old versions, omit from Annex. |
| 10334 |
elsif Disposition = ARM_Output.None then |
| 10335 |
-- Normal reference: |
| 10336 |
ARM_Database.Insert (Format_Object.Pragma_DB, |
| 10337 |
Sort_Key => My_Sort, |
| 10338 |
Hang_Item => "", |
| 10339 |
Text => "@ChgRef{Version=[" & Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Change_Version & |
| 10340 |
"],Kind=[Added]}" & |
| 10341 |
Text_Buffer(1..Text_Buffer_Len) & |
| 10342 |
" @em See @RefSecbyNum{" & Clause_String(Format_Object) & "}."); |
| 10343 |
-- Note: We still need the @ChgRef in order |
| 10344 |
-- to get the paragraph numbers right. |
| 10345 |
elsif Disposition = ARM_Output.Deletion then |
| 10346 |
raise Program_Error; -- A deletion inside of an insertion command! |
| 10347 |
else -- Insertion. |
| 10348 |
ARM_Database.Insert (Format_Object.Pragma_DB, |
| 10349 |
Sort_Key => My_Sort, |
| 10350 |
Hang_Item => "", |
| 10351 |
Text => "@ChgRef{Version=[" & Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Change_Version & |
| 10352 |
"],Kind=[Added]}" & |
| 10353 |
Text_Buffer(1..Text_Buffer_Len) & |
| 10354 |
"@Chg{Version=[" & Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Change_Version & |
| 10355 |
"],New=[" & |
| 10356 |
" @em See @RefSecbyNum<" & Clause_String(Format_Object) & ">.],Old=[]}"); |
| 10357 |
-- Note: Text includes any needed @Chg commands. |
| 10358 |
end if; |
| 10359 |
end; |
| 10360 |
else --if Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Command = Deleted_Pragma_Syntax then |
| 10361 |
declare |
| 10362 |
Add_Disposition : ARM_Output.Change_Type; |
| 10363 |
Del_Disposition : ARM_Output.Change_Type; |
| 10364 |
use type ARM_Output.Change_Type; |
| 10365 |
|
| 10366 |
function Para_Kind return String is |
| 10367 |
begin |
| 10368 |
if Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Prev_Change_Version = '0' and then |
| 10369 |
Add_Disposition /= ARM_Output.Insertion then |
| 10370 |
return "Deleted"; |
| 10371 |
else |
| 10372 |
return "DeletedAdded"; |
| 10373 |
end if; |
| 10374 |
end Para_Kind; |
| 10375 |
|
| 10376 |
begin |
| 10377 |
Calc_Change_Disposition ( |
| 10378 |
Format_Object => Format_Object, |
| 10379 |
Version => Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Change_Version, |
| 10380 |
Operation => ARM_Output.Deletion, |
| 10381 |
Text_Kind => Del_Disposition); |
| 10382 |
if Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Prev_Change_Version = '0' then |
| 10383 |
Add_Disposition := ARM_Output.None; |
| 10384 |
else |
| 10385 |
Calc_Change_Disposition ( |
| 10386 |
Format_Object => Format_Object, |
| 10387 |
Version => Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Prev_Change_Version, |
| 10388 |
Operation => ARM_Output.Insertion, |
| 10389 |
Text_Kind => Add_Disposition); |
| 10390 |
end if; |
| 10391 |
|
| 10392 |
if Del_Disposition = Do_Not_Display_Text then |
| 10393 |
--Ada.Text_IO.Put_Line ("%% Deleted pragma completely omitted"); |
| 10394 |
if Add_Disposition /= Do_Not_Display_Text |
| 10395 |
and then Format_Object.Number_Paragraphs then |
| 10396 |
-- If this was in older editions, then |
| 10397 |
-- we need a deletion message (and also |
| 10398 |
-- to get the paragraph numbers right). |
| 10399 |
-- But don't need this if there are no |
| 10400 |
-- paragraph numbers (then there is no |
| 10401 |
-- deleted message). |
| 10402 |
--Ada.Text_IO.Put_Line (" ... but need a deletion message"); |
| 10403 |
ARM_Database.Insert (Format_Object.Pragma_DB, |
| 10404 |
Sort_Key => My_Sort, |
| 10405 |
Hang_Item => "", |
| 10406 |
Text => "@ChgRef{Version=[" & Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Change_Version & |
| 10407 |
"],Kind=[" & Para_Kind & "]}@ "); |
| 10408 |
else |
| 10409 |
null; -- Not at all in this version, omit from Annex. |
| 10410 |
end if; |
| 10411 |
elsif Del_Disposition = ARM_Output.None then |
| 10412 |
--Ada.Text_IO.Put_Line ("%% Deleted pragma normal format"); |
| 10413 |
-- Is the initial item inserted or normal? |
| 10414 |
if Add_Disposition = ARM_Output.Insertion then |
| 10415 |
--Ada.Text_IO.Put_Line ("... but inserted"); |
| 10416 |
-- Inserted reference: |
| 10417 |
ARM_Database.Insert (Format_Object.Pragma_DB, |
| 10418 |
Sort_Key => My_Sort, |
| 10419 |
Hang_Item => "", |
| 10420 |
Text => "@ChgRef{Version=[" & Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Prev_Change_Version & |
| 10421 |
"],Kind=[Added]}" & |
| 10422 |
Text_Buffer(1..Text_Buffer_Len) & |
| 10423 |
"@Chg{Version=[" & Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Prev_Change_Version & |
| 10424 |
"],New=[" & |
| 10425 |
" @em See @RefSecbyNum<" & Clause_String(Format_Object) & ">.],Old=[]}"); |
| 10426 |
else -- Anything else. |
| 10427 |
-- Normal reference: |
| 10428 |
if Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Prev_Change_Version = '0' then |
| 10429 |
ARM_Database.Insert (Format_Object.Pragma_DB, |
| 10430 |
Sort_Key => My_Sort, |
| 10431 |
Hang_Item => "", |
| 10432 |
Text => Text_Buffer(1..Text_Buffer_Len) & |
| 10433 |
" @em See @RefSecbyNum{" & Clause_String(Format_Object) & "}."); |
| 10434 |
else |
| 10435 |
ARM_Database.Insert (Format_Object.Pragma_DB, |
| 10436 |
Sort_Key => My_Sort, |
| 10437 |
Hang_Item => "", |
| 10438 |
Text => "@ChgRef{Version=[" & Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Prev_Change_Version & |
| 10439 |
"],Kind=[Added]}" & |
| 10440 |
Text_Buffer(1..Text_Buffer_Len) & |
| 10441 |
" @em See @RefSecbyNum{" & Clause_String(Format_Object) & "}."); |
| 10442 |
-- Note: We still need the @ChgRef in order |
| 10443 |
-- to get the paragraph numbers right. |
| 10444 |
end if; |
| 10445 |
end if; |
| 10446 |
elsif Del_Disposition = ARM_Output.Insertion then |
| 10447 |
raise Program_Error; -- An insertion inside of a deletion command! |
| 10448 |
else -- Deletion. |
| 10449 |
--Ada.Text_IO.Put_Line ("%% Deleted pragma deleted text"); |
| 10450 |
-- Is the initial item inserted or normal? |
| 10451 |
if Add_Disposition = ARM_Output.Insertion then |
| 10452 |
ARM_Database.Insert (Format_Object.Pragma_DB, |
| 10453 |
Sort_Key => My_Sort, |
| 10454 |
Hang_Item => "", |
| 10455 |
Text => "@ChgRef{Version=[" & Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Change_Version & |
| 10456 |
"],Kind=[DeletedAdded]}" & |
| 10457 |
Text_Buffer(1..Text_Buffer_Len) & |
| 10458 |
"@Chg{Version=[" & Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Prev_Change_Version & |
| 10459 |
"],New=[" & |
| 10460 |
"@Chg{Version=[" & Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Change_Version & |
| 10461 |
"],New=[],Old=[" & |
| 10462 |
" @em See @RefSecbyNum<" & Clause_String(Format_Object) & ">.]}],Old=[]}"); |
| 10463 |
else -- Anything else. |
| 10464 |
-- Just a deleted reference: |
| 10465 |
ARM_Database.Insert (Format_Object.Pragma_DB, |
| 10466 |
Sort_Key => My_Sort, |
| 10467 |
Hang_Item => "", |
| 10468 |
Text => "@ChgRef{Version=[" & Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Change_Version & |
| 10469 |
"],Kind=[" & Para_Kind & "]}" & |
| 10470 |
Text_Buffer(1..Text_Buffer_Len) & |
| 10471 |
"@Chg{Version=[" & Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr).Change_Version & |
| 10472 |
"],New=[],Old=[" & |
| 10473 |
" @em See @RefSecbyNum<" & Clause_String(Format_Object) & ">.]}"); |
| 10474 |
-- Note: We still need the @ChgRef in order |
| 10475 |
-- to get the paragraph numbers right and for the deleted paragraph message. |
| 10476 |
end if; |
| 10477 |
end if; |
| 10478 |
end; |
| 10479 |
|
| 10480 |
end if; |
| 10481 |
end; |
| 10482 |
|
| 10483 |
when Implementation_Defined | Change_Impdef_Text_Param => |
| 10484 |
-- Save the implementation-defined entry in the database. |
| 10485 |
Finish_and_DB_Entry (Format_Object.Impdef_DB); |
| 10486 |
|
| 10487 |
when Change_Impladv_Text_Param => |
| 10488 |
-- Save the implementation advice entry in the database. |
| 10489 |
Finish_and_DB_Entry (Format_Object.Impladv_DB); |
| 10490 |
|
| 10491 |
when Change_Docreq_Text_Param => |
| 10492 |
-- Save the documentation requirement entry in the database. |
| 10493 |
Finish_and_DB_Entry (Format_Object.Docreq_DB); |
| 10494 |
|
| 10495 |
when Change_AspectDesc_Text_Param => |
| 10496 |
-- Save the documentation requirement entry in the database. |
| 10497 |
Finish_and_DB_Entry (Format_Object.Aspect_DB); |
| 10498 |
|
| 10499 |
when Prefix_Type | Change_Prefix_Text_Param => |
| 10500 |
-- Copy the text into the Format_Object.Prefix_Text string. |
| 10501 |
ARM_Input.Stop_Recording_and_Read_Result ( |
| 10502 |
Input_Object, |
| 10503 |
Format_Object.Prefix_Text, |
| 10504 |
Format_Object.Prefix_Text_Len); |
| 10505 |
Format_Object.Prefix_Text_Len := |
| 10506 |
Format_Object.Prefix_Text_Len - 1; -- Remove command close character. |
| 10507 |
|
| 10508 |
when Change_Param_Old => |
| 10509 |
if Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr-1).Change_Version > |
| 10510 |
Format_Object.Change_Version then |
| 10511 |
-- The new text was ignored, use the old only. |
| 10512 |
null; -- Nothing special to do. |
| 10513 |
else |
| 10514 |
case Format_Object.Changes is |
| 10515 |
when ARM_Format.Old_Only => |
| 10516 |
null; -- Nothing special to do. |
| 10517 |
when ARM_Format.New_Only => |
| 10518 |
null; -- Nothing to do (we nulled out the text before we got here). |
| 10519 |
when ARM_Format.Show_Changes | |
| 10520 |
ARM_Format.New_Changes => |
| 10521 |
if Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr-1).Change_Version < |
| 10522 |
Format_Object.Base_Change_Version then |
| 10523 |
-- Old enough that only the new text is shown. |
| 10524 |
null; -- Nothing to do (we nulled out the text before we got here). |
| 10525 |
else |
| 10526 |
if Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr-1).Was_Text then |
| 10527 |
-- Non-empty text. Restore the previous |
| 10528 |
-- insertion state. |
| 10529 |
Format_Object.Text_Format.Change := |
| 10530 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr-1).Prev_Change; |
| 10531 |
Format_Object.Text_Format.Version := |
| 10532 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr-1).Prev_Change_Version; |
| 10533 |
Format_Object.Text_Format.Added_Version := |
| 10534 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr-1).Prev_Added_Change_Version; |
| 10535 |
|
| 10536 |
Check_Paragraph; -- We have to be in a paragraph |
| 10537 |
-- in correct code, but this could happen |
| 10538 |
-- if the user ended the paragraph by mistake |
| 10539 |
-- (we've already generated an error in that case). |
| 10540 |
ARM_Output.Text_Format (Output_Object, |
| 10541 |
Format_Object.Text_Format); |
| 10542 |
-- else no text. |
| 10543 |
end if; |
| 10544 |
end if; |
| 10545 |
end case; |
| 10546 |
end if; |
| 10547 |
Format_Object.In_Change := |
| 10548 |
Arm_Output."/=" (Format_Object.Text_Format.Change, ARM_Output.None); |
| 10549 |
|
| 10550 |
when Change_Param_New => |
| 10551 |
if Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr-1).Change_Version > |
| 10552 |
Format_Object.Change_Version then |
| 10553 |
-- The new text was ignored. |
| 10554 |
null; -- Nothing to do (we nulled out the text before we got here). |
| 10555 |
else |
| 10556 |
case Format_Object.Changes is |
| 10557 |
when ARM_Format.Old_Only => |
| 10558 |
null; -- Nothing to do (we nulled out the text before we got here). |
| 10559 |
when ARM_Format.New_Only => |
| 10560 |
null; -- Nothing special to do. |
| 10561 |
when ARM_Format.Show_Changes | |
| 10562 |
ARM_Format.New_Changes => |
| 10563 |
if Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr-1).Change_Version < |
| 10564 |
Format_Object.Base_Change_Version then |
| 10565 |
-- Old enough that only the new text is shown. |
| 10566 |
null; -- Nothing special to do. |
| 10567 |
else |
| 10568 |
if Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr-1).Was_Text then |
| 10569 |
-- Non-empty text. Restore the previous |
| 10570 |
-- insertion state. |
| 10571 |
Format_Object.Text_Format.Change := |
| 10572 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr-1).Prev_Change; |
| 10573 |
Format_Object.Text_Format.Version := |
| 10574 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr-1).Prev_Change_Version; |
| 10575 |
Format_Object.Text_Format.Added_Version := |
| 10576 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr-1).Prev_Added_Change_Version; |
| 10577 |
|
| 10578 |
Check_Paragraph; -- We have to be in a paragraph |
| 10579 |
-- in correct code, but this could happen |
| 10580 |
-- if the user ended the paragraph by mistake |
| 10581 |
-- (we've already generated an error in that case). |
| 10582 |
ARM_Output.Text_Format (Output_Object, |
| 10583 |
Format_Object.Text_Format); |
| 10584 |
-- else no text. |
| 10585 |
end if; |
| 10586 |
end if; |
| 10587 |
end case; |
| 10588 |
end if; |
| 10589 |
|
| 10590 |
Format_State.Nesting_Stack_Ptr := Format_State.Nesting_Stack_Ptr - 1; |
| 10591 |
-- Unstack the "New" parameter. |
| 10592 |
--Ada.Text_IO.Put_Line (" &Unstack (Chg New)"); |
| 10593 |
|
| 10594 |
-- Check and handle the following "Old" parameter: |
| 10595 |
declare |
| 10596 |
Ch, Ch2 : Character; |
| 10597 |
begin |
| 10598 |
ARM_Input.Check_Parameter_Name (Input_Object, |
| 10599 |
Param_Name => "Old" & (4..ARM_Input.Command_Name_Type'Last => ' '), |
| 10600 |
Is_First => False, |
| 10601 |
Param_Close_Bracket => Ch); |
| 10602 |
if Ch /= ' ' then -- There is a parameter. |
| 10603 |
-- Stack the parameter so we can process the end: |
| 10604 |
Set_Nesting_for_Parameter |
| 10605 |
(Command => Change_Param_Old, |
| 10606 |
Close_Ch => Ch); |
| 10607 |
|
| 10608 |
-- Now, handle the parameter: |
| 10609 |
if Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr-1).Change_Version > |
| 10610 |
Format_Object.Change_Version then |
| 10611 |
-- The new text was ignored, show the old only. |
| 10612 |
null; -- Nothing special to do. |
| 10613 |
else |
| 10614 |
case Format_Object.Changes is |
| 10615 |
when ARM_Format.Old_Only => |
| 10616 |
null; -- Nothing special to do. |
| 10617 |
when ARM_Format.New_Only => |
| 10618 |
-- Skip the text: |
| 10619 |
ARM_Input.Skip_until_Close_Char (Input_Object, Ch); |
| 10620 |
ARM_Input.Replace_Char (Input_Object); -- Let the normal termination clean this up. |
| 10621 |
when ARM_Format.Show_Changes | |
| 10622 |
ARM_Format.New_Changes => |
| 10623 |
if Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr-1).Change_Version < |
| 10624 |
Format_Object.Base_Change_Version then |
| 10625 |
-- Old enough that only the new text is shown. |
| 10626 |
-- Skip the text: |
| 10627 |
ARM_Input.Skip_until_Close_Char (Input_Object, Ch); |
| 10628 |
ARM_Input.Replace_Char (Input_Object); -- Let the normal termination clean this up. |
| 10629 |
else |
| 10630 |
ARM_Input.Get_Char (Input_Object, Ch2); |
| 10631 |
ARM_Input.Replace_Char (Input_Object); |
| 10632 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr-1).Was_Text := |
| 10633 |
Ch /= Ch2; |
| 10634 |
if Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr-1).Was_Text then |
| 10635 |
-- Non-empty text; calculate new change state: (current is deletion) |
| 10636 |
Check_Paragraph; -- Output the paragraph headers before changing the state. |
| 10637 |
-- This can only matter for a deletion without |
| 10638 |
-- an insertion; otherwise, we're already in a paragraph. |
| 10639 |
case Format_Object.Text_Format.Change is |
| 10640 |
when ARM_Output.Deletion | ARM_Output.None => |
| 10641 |
Format_Object.Text_Format.Change := ARM_Output.Deletion; |
| 10642 |
Format_Object.Text_Format.Version := |
| 10643 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr-1).Change_Version; |
| 10644 |
Format_Object.Text_Format.Added_Version := '0'; |
| 10645 |
when ARM_Output.Insertion => |
| 10646 |
Format_Object.Text_Format.Change := ARM_Output.Both; |
| 10647 |
Format_Object.Text_Format.Added_Version := |
| 10648 |
Format_Object.Text_Format.Version; |
| 10649 |
Format_Object.Text_Format.Version := |
| 10650 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr-1).Change_Version; |
| 10651 |
when ARM_Output.Both => |
| 10652 |
Format_Object.Text_Format.Change := ARM_Output.Both; |
| 10653 |
-- Added_Version is unchanged. |
| 10654 |
Format_Object.Text_Format.Version := |
| 10655 |
Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr-1).Change_Version; |
| 10656 |
end case; |
| 10657 |
ARM_Output.Text_Format (Output_Object, |
| 10658 |
Format_Object.Text_Format); |
| 10659 |
if Format_Object.Changes = ARM_Format.New_Changes then |
| 10660 |
ARM_Output.Ordinary_Character (Output_Object, ' '); |
| 10661 |
-- Skip the text (we're not going to output it): |
| 10662 |
ARM_Input.Skip_until_Close_Char (Input_Object, Ch); |
| 10663 |
ARM_Input.Replace_Char (Input_Object); -- Let the normal termination clean this up. |
| 10664 |
-- else if Format_Object.Changes = ARM_Format.Show_Changes then |
| 10665 |
-- Nothing else needed. |
| 10666 |
end if; |
| 10667 |
-- else no text, so don't emit a change area. |
| 10668 |
end if; |
| 10669 |
end if; |
| 10670 |
end case; |
| 10671 |
end if; |
| 10672 |
Format_Object.In_Change := True; |
| 10673 |
|
| 10674 |
-- else no parameter. Weird. |
| 10675 |
end if; |
| 10676 |
return; -- We've already done the unstacking. |
| 10677 |
end; |
| 10678 |
|
| 10679 |
when Change_Added_Param => |
| 10680 |
declare |
| 10681 |
Disposition : ARM_Output.Change_Type; |
| 10682 |
use type ARM_Output.Change_Type; |
| 10683 |
begin |
| 10684 |
Format_Object.In_Change := False; |
| 10685 |
|
| 10686 |
Calc_Change_Disposition ( |
| 10687 |
Format_Object => Format_Object, |
| 10688 |
Version => Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr-1).Change_Version, |
| 10689 |
Operation => ARM_Output.Insertion, |
| 10690 |
Text_Kind => Disposition); |
| 10691 |
|
| 10692 |
if Disposition = Do_Not_Display_Text then |
| 10693 |
-- The new text was ignored. |
| 10694 |
null; -- Nothing to do (we nulled out the text before we got here). |
| 10695 |
elsif Disposition = ARM_Output.None then |
| 10696 |
-- Display the text normally. |
| 10697 |
null; -- Nothing special to do. |
| 10698 |
elsif Disposition = ARM_Output.Deletion then |
| 10699 |
raise Program_Error; -- A deletion inside of an insertion command! |
| 10700 |
else -- Insertion. |
| 10701 |
-- Reset the state to normal: |
| 10702 |
Format_Object.Text_Format.Change := ARM_Output.None; |
| 10703 |
Format_Object.Text_Format.Version := '0'; |
| 10704 |
Format_Object.Text_Format.Added_Version := '0'; |
| 10705 |
|
| 10706 |
Check_Paragraph; -- We have to be in a paragraph |
| 10707 |
-- in correct code, but this could happen |
| 10708 |
-- if the user ended the paragraph by mistake |
| 10709 |
-- (we've already generated an error in that case). |
| 10710 |
ARM_Output.Text_Format (Output_Object, |
| 10711 |
Format_Object.Text_Format); |
| 10712 |
end if; |
| 10713 |
end; |
| 10714 |
|
| 10715 |
when Change_Deleted_Param => |
| 10716 |
declare |
| 10717 |
Disposition : ARM_Output.Change_Type; |
| 10718 |
use type ARM_Output.Change_Type; |
| 10719 |
begin |
| 10720 |
Format_Object.In_Change := False; |
| 10721 |
|
| 10722 |
Calc_Change_Disposition ( |
| 10723 |
Format_Object => Format_Object, |
| 10724 |
Version => Format_State.Nesting_Stack(Format_State.Nesting_Stack_Ptr-1).Change_Version, |
| 10725 |
Operation => ARM_Output.Deletion, |
| 10726 |
Text_Kind => Disposition); |
| 10727 |
|
| 10728 |
if Disposition = Do_Not_Display_Text then |
| 10729 |
-- The old text was ignored. |
| 10730 |
null; -- Nothing to do (we nulled out the text before we got here). |
| 10731 |
elsif Disposition = ARM_Output.None then |
| 10732 |
-- Display the text normally. |
| 10733 |
null; -- Nothing special to do. |
| 10734 |
elsif Disposition = ARM_Output.Insertion then |
| 10735 |
raise Program_Error; -- An insertion inside of a deletion command! |
| 10736 |
else -- Insertion. |
| 10737 |
-- Reset the state to normal: |
| 10738 |
Format_Object.Text_Format.Change := ARM_Output.None; |
| 10739 |
Format_Object.Text_Format.Version := '0'; |
| 10740 |
Format_Object.Text_Format.Added_Version := '0'; |
| 10741 |
|
| 10742 |
Check_Paragraph; -- We have to be in a paragraph |
| 10743 |
-- in correct code, but this could happen |
| 10744 |
-- if the user ended the paragraph by mistake |
| 10745 |
-- (we've already generated an error in that case). |
| 10746 |
ARM_Output.Text_Format (Output_Object, |
| 10747 |
Format_Object.Text_Format); |
| 10748 |
end if; |
| 10749 |
end; |
| 10750 |
|
| 10751 |
when Ceiling => |
| 10752 |
Check_Paragraph; |
| 10753 |
ARM_Output.Special_Character (Output_Object, ARM_Output.Right_Ceiling); |
| 10754 |
Format_Object.Last_Non_Space := True; |
| 10755 |
|
| 10756 |
when Floor => |
| 10757 |
Check_Paragraph; |
| 10758 |
ARM_Output.Special_Character (Output_Object, ARM_Output.Right_Floor); |
| 10759 |
Format_Object.Last_Non_Space := True; |
| 10760 |
|
| 10761 |
when Absolute => |
| 10762 |
Check_Paragraph; |
| 10763 |
ARM_Output.Ordinary_Character (Output_Object, '|'); |
| 10764 |
Format_Object.Last_Non_Space := True; |
| 10765 |
|
| 10766 |
when Log => |
| 10767 |
Check_Paragraph; |
| 10768 |
ARM_Output.Ordinary_Character (Output_Object, ')'); |
| 10769 |
Format_Object.Last_Non_Space := True; |
| 10770 |
|
| 10771 |
when others => |
| 10772 |
-- No special handling needed. |
| 10773 |
null; |
| 10774 |
end case; |
| 10775 |
--Ada.Text_IO.Put_Line (" &Unstack (Normal)"); |
| 10776 |
Format_State.Nesting_Stack_Ptr := Format_State.Nesting_Stack_Ptr - 1; |
| 10777 |
end Handle_End_of_Command; |
| 10778 |
|
| 10779 |
|
| 10780 |
procedure Process_Special is |
| 10781 |
-- Process a special command/macro/tab. |
| 10782 |
-- These all start with '@'. |
| 10783 |
-- @xxxx is a command. It may have parameters delimited by |
| 10784 |
-- (), {}, [], or <>. There does not appear to be an escape, so |
| 10785 |
-- we don't have to worry about '}' being used in {} brackets, |
| 10786 |
-- for example. (Must be a pain to write, though.) |
| 10787 |
Command_Name : ARM_Input.Command_Name_Type; |
| 10788 |
Ch : Character; |
| 10789 |
use type ARM_Output.Size_Type; |
| 10790 |
begin |
| 10791 |
ARM_Input.Get_Char (Input_Object, Ch); |
| 10792 |
if Ch = '\' then |
| 10793 |
-- This represents a tab, or the end of centered text. |
| 10794 |
-- (According to Bob Duff, from the Scribe manual). |
| 10795 |
if Format_Object.Next_Paragraph_Format_Type = Hanging_Indented_1 or else |
| 10796 |
Format_Object.Next_Paragraph_Format_Type = Hanging_Indented_2 or else |
| 10797 |
Format_Object.Next_Paragraph_Format_Type = Hanging_Indented_3 or else |
| 10798 |
Format_Object.Next_Paragraph_Format_Type = Hanging_Indented_4 then |
| 10799 |
-- Instead of a tab, just use this to mark the end |
| 10800 |
-- of the hanging portion: |
| 10801 |
Check_Paragraph; |
| 10802 |
if Format_Object.In_Change then |
| 10803 |
-- Close all formatting: |
| 10804 |
declare |
| 10805 |
Closed_Formatting : ARM_Output.Format_Type := |
| 10806 |
ARM_Output.NORMAL_FORMAT; |
| 10807 |
begin |
| 10808 |
Closed_Formatting.Font := Format_Object.Text_Format.Font; -- No clear default for these. |
| 10809 |
Closed_Formatting.Size := Format_Object.Text_Format.Size; |
| 10810 |
|
| 10811 |
ARM_Output.Text_Format (Output_Object, |
| 10812 |
Closed_Formatting); |
| 10813 |
end; |
| 10814 |
end if; |
| 10815 |
ARM_Output.End_Hang_Item (Output_Object); |
| 10816 |
if Format_Object.In_Change then |
| 10817 |
-- Reset to the normal case: |
| 10818 |
ARM_Output.Text_Format (Output_Object, |
| 10819 |
Format_Object.Text_Format); |
| 10820 |
end if; |
| 10821 |
elsif Format_Object.Next_Paragraph_Format_Type = In_Table then |
| 10822 |
-- If in a table, ends a item. |
| 10823 |
ARM_Output.Table_Marker (Output_Object, ARM_Output.End_Item); |
| 10824 |
-- elsif centered text: TBD. |
| 10825 |
elsif ARM_Output."="(Format_Object.Paragraph_Tab_Stops, ARM_Output.NO_TABS) then |
| 10826 |
Ada.Text_IO.Put_Line (" ** Tab, but no tab stops set on line " & |
| 10827 |
ARM_Input.Line_String (Input_Object)); |
| 10828 |
else |
| 10829 |
Check_Paragraph; |
| 10830 |
ARM_Output.Tab (Output_Object); |
| 10831 |
end if; |
| 10832 |
return; -- We're done here. |
| 10833 |
elsif Ch = '=' then |
| 10834 |
-- This marks the start of centered text. |
| 10835 |
-- (According to Bob Duff, from the Scribe manual). |
| 10836 |
-- We're not implementing this; we're just going to replace |
| 10837 |
-- the handful of uses. |
| 10838 |
-- We're done here. |
| 10839 |
Ada.Text_IO.Put_Line (" ** Centered text unimplemented (skipped) on line " & |
| 10840 |
ARM_Input.Line_String (Input_Object)); |
| 10841 |
return; |
| 10842 |
elsif Ch = '^' then |
| 10843 |
-- This represents setting at tab stop at the current location. |
| 10844 |
-- Neither HTML nor RTF supports such a thing, so these should |
| 10845 |
-- all have been replaced by conventional tab stops. |
| 10846 |
Ada.Text_IO.Put_Line (" && Cursor tab stop unimplemented (skipped) on line " & |
| 10847 |
ARM_Input.Line_String (Input_Object)); |
| 10848 |
return; |
| 10849 |
elsif Ch = '@' then |
| 10850 |
-- This represents @ in the text. We're done here. |
| 10851 |
Check_Paragraph; |
| 10852 |
ARM_Output.Ordinary_Character (Output_Object, '@'); |
| 10853 |
return; |
| 10854 |
elsif Ch = ' ' then |
| 10855 |
-- This represents a hard space in the text. We're done here. |
| 10856 |
Check_Paragraph; |
| 10857 |
ARM_Output.Hard_Space (Output_Object); |
| 10858 |
return; |
| 10859 |
elsif Ch = ';' then |
| 10860 |
-- This seems to be an end of command (or substitution) marker. |
| 10861 |
-- For instance, it is used in Section 1: |
| 10862 |
-- .. the distinction between @ResolutionName@;s and ... |
| 10863 |
-- This converts to: |
| 10864 |
-- .. the distinction between Name Resolution Rules and ... |
| 10865 |
-- Without it, the 's' would append to the command name, and |
| 10866 |
-- we would get the wrong command. Thus, it itself does nothing |
| 10867 |
-- at all, so we're done here. |
| 10868 |
return; |
| 10869 |
elsif Ch = '-' then |
| 10870 |
-- This represents a subscript. It has an argument. |
| 10871 |
ARM_Input.Get_Char (Input_Object, Ch); |
| 10872 |
if ARM_Input.Is_Open_Char (Ch) then -- Start parameter: |
| 10873 |
Set_Nesting_for_Command |
| 10874 |
(Name => '-' & (2..ARM_Input.Command_Name_Type'Last => ' '), |
| 10875 |
Kind => Normal, |
| 10876 |
Param_Ch => Ch); |
| 10877 |
Check_Paragraph; |
| 10878 |
Format_Object.Text_Format.Size := |
| 10879 |
Format_Object.Text_Format.Size - 2; |
| 10880 |
Format_Object.Text_Format.Location := ARM_Output.Subscript; |
| 10881 |
ARM_Output.Text_Format (Output_Object, |
| 10882 |
Format_Object.Text_Format); |
| 10883 |
else -- No parameter. Weird. |
| 10884 |
ARM_Input.Replace_Char (Input_Object); |
| 10885 |
Ada.Text_IO.Put_Line (" ** Failed to find parameter for subscript, line " & ARM_Input.Line_String (Input_Object)); |
| 10886 |
end if; |
| 10887 |
return; |
| 10888 |
elsif Ch = '+' then |
| 10889 |
-- This represents a superscript. It has an argument. |
| 10890 |
ARM_Input.Get_Char (Input_Object, Ch); |
| 10891 |
if ARM_Input.Is_Open_Char (Ch) then -- Start parameter: |
| 10892 |
Set_Nesting_for_Command |
| 10893 |
(Name => '+' & (2..ARM_Input.Command_Name_Type'Last => ' '), |
| 10894 |
Kind => Normal, |
| 10895 |
Param_Ch => Ch); |
| 10896 |
Check_Paragraph; |
| 10897 |
Format_Object.Text_Format.Size := |
| 10898 |
Format_Object.Text_Format.Size - 2; |
| 10899 |
Format_Object.Text_Format.Location := ARM_Output.Superscript; |
| 10900 |
ARM_Output.Text_Format (Output_Object, |
| 10901 |
Format_Object.Text_Format); |
| 10902 |
else -- No parameter. Weird. |
| 10903 |
ARM_Input.Replace_Char (Input_Object); |
| 10904 |
Ada.Text_IO.Put_Line (" ** Failed to find parameter for superscript, line " & ARM_Input.Line_String (Input_Object)); |
| 10905 |
end if; |
| 10906 |
return; |
| 10907 |
elsif Ch = ':' then |
| 10908 |
-- According to Tucker, the Scribe manual says: |
| 10909 |
-- @: After a ".", it forces the "." to be interpreted as a |
| 10910 |
-- sentence-ending period rather than as an initial-ending |
| 10911 |
-- period. E.g.: You are better than I.@: F. Stone is |
| 10912 |
-- even better. Without the @:, the period after "I" |
| 10913 |
-- would be interpreted as the period signifying an |
| 10914 |
-- initial. |
| 10915 |
-- |
| 10916 |
-- Besides not making much sense, this certainly does nothing |
| 10917 |
-- for us. |
| 10918 |
return; |
| 10919 |
elsif Ch = '*' then |
| 10920 |
-- According to Tucker, the Scribe manual says: |
| 10921 |
-- @* This forces a line break, without starting a new |
| 10922 |
-- paragraph. |
| 10923 |
-- Tucker thinks this is "<BR>" in HTML. |
| 10924 |
if Format_Object.In_Paragraph then |
| 10925 |
ARM_Output.Line_Break (Output_Object); |
| 10926 |
Format_Object.Last_Non_Space := False; |
| 10927 |
-- else why start a paragraph with a line break?? |
| 10928 |
end if; |
| 10929 |
return; |
| 10930 |
elsif Ch = '|' then |
| 10931 |
-- According to Tucker, the Scribe manual says: |
| 10932 |
-- @| This marks a place within a word where a line break |
| 10933 |
-- may be inserted, *without* inserting a hyphen. It is |
| 10934 |
-- effectively a zero-length "word". You can use it to add |
| 10935 |
-- spaces between words that disappear if the line gets |
| 10936 |
-- broken there. For example: |
| 10937 |
-- This is @| a sentence with two spaces between "is" and "a". |
| 10938 |
-- The extra space will disappear if the line is broken |
| 10939 |
-- between "is" and "a". |
| 10940 |
-- |
| 10941 |
-- However, this appears to be used mainly to insert potential |
| 10942 |
-- line breaks into large words, and we use and implement it |
| 10943 |
-- that way. |
| 10944 |
if Format_Object.In_Paragraph then |
| 10945 |
ARM_Output.Soft_Line_Break (Output_Object); |
| 10946 |
Format_Object.Last_Non_Space := False; |
| 10947 |
-- else don't care about non-required breaks between paragraphs. |
| 10948 |
end if; |
| 10949 |
return; |
| 10950 |
elsif Ch = '!' then |
| 10951 |
-- This marks a place within a word where a line break |
| 10952 |
-- may be inserted, inserting a hyphen. |
| 10953 |
if Format_Object.In_Paragraph then |
| 10954 |
ARM_Output.Soft_Hyphen_Break (Output_Object); |
| 10955 |
Format_Object.Last_Non_Space := False; |
| 10956 |
-- else don't care about non-required breaks between paragraphs. |
| 10957 |
end if; |
| 10958 |
return; |
| 10959 |
elsif Ch = Ascii.LF then |
| 10960 |
-- Stand alone '@'. |
| 10961 |
-- I now believe this is an error, perhaps a hard space where |
| 10962 |
-- the trailing blank was dropped. It originally appeared in |
| 10963 |
-- Infosys.MSS. |
| 10964 |
Ada.Text_IO.Put_Line("** Stand-alone '@' on line " & ARM_Input.Line_String (Input_Object)); |
| 10965 |
return; |
| 10966 |
end if; |
| 10967 |
ARM_Input.Replace_Char (Input_Object); |
| 10968 |
ARM_Input.Get_Name (Input_Object, Command_Name); |
| 10969 |
--Ada.Text_IO.Put_Line("!!Command=" & Ada.Strings.Fixed.Trim(Command_Name, Ada.Strings.Both)); |
| 10970 |
|
| 10971 |
ARM_Input.Get_Char (Input_Object, Ch); |
| 10972 |
if ARM_Input.Is_Open_Char (Ch) then -- Start parameter: |
| 10973 |
Set_Nesting_for_Command |
| 10974 |
(Name => Ada.Characters.Handling.To_Lower (Command_Name), |
| 10975 |
Kind => Normal, |
| 10976 |
Param_Ch => Ch); |
| 10977 |
Process_Command_with_Parameter; |
| 10978 |
else |
| 10979 |
ARM_Input.Replace_Char (Input_Object); |
| 10980 |
Process_Command_without_Parameter (Command_Name); |
| 10981 |
end if; |
| 10982 |
end Process_Special; |
| 10983 |
|
| 10984 |
|
| 10985 |
procedure Lookahead_for_End_of_Paragraph is |
| 10986 |
-- Look at the command following to see if it would |
| 10987 |
-- end the paragraph. If not, generate a Line_Break. |
| 10988 |
-- In any case, process the command (we don't allow more than |
| 10989 |
-- one call to Replace_Char). |
| 10990 |
-- We can assume that we are in a paragraph. |
| 10991 |
Command_Name : ARM_Input.Command_Name_Type; |
| 10992 |
Ch : Character; |
| 10993 |
begin |
| 10994 |
ARM_Input.Get_Char (Input_Object, Ch); |
| 10995 |
if Ch not in 'A' .. 'Z' and then Ch not in 'a' .. 'z' then |
| 10996 |
-- Not a named command, these never end a paragraph: |
| 10997 |
ARM_Input.Replace_Char (Input_Object); |
| 10998 |
ARM_Output.Line_Break (Output_Object); |
| 10999 |
Format_Object.Last_Non_Space := False; |
| 11000 |
Process_Special; |
| 11001 |
else -- Named command. |
| 11002 |
ARM_Input.Replace_Char (Input_Object); |
| 11003 |
ARM_Input.Get_Name (Input_Object, Command_Name); |
| 11004 |
|
| 11005 |
case Command (Command_Name) is |
| 11006 |
when Text_Begin | Text_End | New_Page | New_Column | RM_New_Page | |
| 11007 |
Thin_Line | Thick_Line | Table | Picture_Alone | |
| 11008 |
To_Glossary | Change_To_Glossary | |
| 11009 |
Implementation_Defined | |
| 11010 |
Change_Implementation_Defined | |
| 11011 |
Change_Implementation_Advice | |
| 11012 |
Change_Documentation_Requirement | |
| 11013 |
Labeled_Section | |
| 11014 |
Labeled_Section_No_Break | |
| 11015 |
Labeled_Clause | Labeled_Subclause | Labeled_Subsubclause | |
| 11016 |
Labeled_Revised_Section | Labeled_Revised_Clause | |
| 11017 |
Labeled_Revised_Subclause | Labeled_Revised_Subsubclause | |
| 11018 |
Labeled_Added_Section | Labeled_Added_Clause | |
| 11019 |
Labeled_Added_Subclause | Labeled_Added_Subsubclause | |
| 11020 |
Labeled_Deleted_Clause | |
| 11021 |
Labeled_Deleted_Subclause | Labeled_Deleted_Subsubclause | |
| 11022 |
Preface_Section | |
| 11023 |
Labeled_Annex | Labeled_Revised_Annex | Labeled_Added_Annex | |
| 11024 |
Labeled_Informative_Annex | |
| 11025 |
Labeled_Revised_Informative_Annex | Labeled_Added_Informative_Annex | |
| 11026 |
Labeled_Normative_Annex | |
| 11027 |
Labeled_Revised_Normative_Annex | Labeled_Added_Normative_Annex | |
| 11028 |
Unnumbered_Section | Subheading | Heading | Center | Right => |
| 11029 |
-- Ends a paragraph. No line break needed here (or |
| 11030 |
-- we'd end up with two). |
| 11031 |
null; |
| 11032 |
when others => |
| 11033 |
-- Does not end a paragraph. Put in the soft break. |
| 11034 |
ARM_Output.Line_Break (Output_Object); |
| 11035 |
Format_Object.Last_Non_Space := False; |
| 11036 |
end case; |
| 11037 |
|
| 11038 |
-- Now, process the command: |
| 11039 |
ARM_Input.Get_Char (Input_Object, Ch); |
| 11040 |
if ARM_Input.Is_Open_Char (Ch) then -- Start parameter: |
| 11041 |
Set_Nesting_for_Command |
| 11042 |
(Name => Ada.Characters.Handling.To_Lower (Command_Name), |
| 11043 |
Kind => Normal, |
| 11044 |
Param_Ch => Ch); |
| 11045 |
Process_Command_with_Parameter; |
| 11046 |
else |
| 11047 |
ARM_Input.Replace_Char (Input_Object); |
| 11048 |
Process_Command_without_Parameter (Command_Name); |
| 11049 |
end if; |
| 11050 |
end if; |
| 11051 |
end Lookahead_for_End_of_Paragraph; |
| 11052 |
|
| 11053 |
begin |
| 11054 |
Reading_Loop: loop |
| 11055 |
declare |
| 11056 |
Char : Character; |
| 11057 |
begin |
| 11058 |
ARM_Input.Get_Char (Input_Object, Char); |
| 11059 |
--Ada.Text_IO.Put_Line("!!Char=" & Char & " Nesting=" & Natural'Image(Format_State.Nesting_Stack_Ptr)); |
| 11060 |
case Char is |
| 11061 |
when '@' => |
| 11062 |
Process_Special; |
| 11063 |
when Ascii.LF => |
| 11064 |
ARM_Input.Get_Char (Input_Object, Char); |
| 11065 |
if Char /= Ascii.LF then |
| 11066 |
-- Soft line break. |
| 11067 |
if Format_Object.Next_Paragraph_Format_Type = Example_Text or else |
| 11068 |
Format_Object.Next_Paragraph_Format_Type = Child_Example_Text or else |
| 11069 |
Format_Object.Next_Paragraph_Format_Type = Indented_Example_Text or else |
| 11070 |
Format_Object.Next_Paragraph_Format_Type = Display or else |
| 11071 |
Format_Object.Next_Paragraph_Format_Type = Syntax_Display or else |
| 11072 |
Format_Object.Next_Paragraph_Format_Type = Syntax_Production then |
| 11073 |
-- These formats preserves all line breaks, but a |
| 11074 |
-- "soft" break does not end a paragraph. |
| 11075 |
if Char /= '@' or else (not Format_Object.In_Paragraph) then |
| 11076 |
-- Not a paragraph end coming up: |
| 11077 |
if Format_Object.In_Paragraph then |
| 11078 |
ARM_Output.Line_Break (Output_Object); |
| 11079 |
Format_Object.Last_Non_Space := False; |
| 11080 |
-- else not in paragraph, we don't need to preserve |
| 11081 |
-- the break. |
| 11082 |
end if; |
| 11083 |
ARM_Input.Replace_Char (Input_Object); |
| 11084 |
else |
| 11085 |
-- A command following, and we're in a paragraph. |
| 11086 |
-- If that command ends the paragraph, then |
| 11087 |
-- we don't want a soft break here (else we'd |
| 11088 |
-- end up with an extra blank line at the end). |
| 11089 |
-- Otherwise, we do. |
| 11090 |
Lookahead_for_End_of_Paragraph; |
| 11091 |
end if; |
| 11092 |
elsif Format_Object.Next_Paragraph_Format_Type = In_Table then |
| 11093 |
-- If in a table, ends a row. |
| 11094 |
ARM_Output.Table_Marker (Output_Object, ARM_Output.End_Row); |
| 11095 |
ARM_Input.Replace_Char (Input_Object); |
| 11096 |
Format_Object.Last_Non_Space := False; |
| 11097 |
-- There should be nothing above the table at |
| 11098 |
-- this point. Complain about other commands |
| 11099 |
-- (this is a signficant aid to building tables): |
| 11100 |
declare |
| 11101 |
Start_Depth : Natural := 1; |
| 11102 |
begin |
| 11103 |
--Find the table: |
| 11104 |
for I in reverse 1 .. Format_State.Nesting_Stack_Ptr loop |
| 11105 |
if Format_State.Nesting_Stack(I).Command = Table then |
| 11106 |
Start_Depth := I; |
| 11107 |
exit; |
| 11108 |
end if; |
| 11109 |
end loop; |
| 11110 |
if Format_State.Nesting_Stack(Start_Depth+1).Command /= Table_Param_Body then |
| 11111 |
Ada.Text_IO.Put_Line (" ** Wrong command on top of table, line " & ARM_Input.Line_String (Input_Object)); |
| 11112 |
Ada.Text_IO.Put_Line (" Command=" & Format_State.Nesting_Stack(Start_Depth+1).Name & " Class=" & |
| 11113 |
Data.Command_Type'Image(Format_State.Nesting_Stack(Start_Depth+1).Command)); |
| 11114 |
elsif Format_State.Nesting_Stack_Ptr /= Start_Depth+1 then |
| 11115 |
Ada.Text_IO.Put_Line (" ** Unfinished commands detected at end of row, line " & ARM_Input.Line_String (Input_Object)); |
| 11116 |
end if; |
| 11117 |
for I in reverse Start_Depth+2 .. Format_State.Nesting_Stack_Ptr loop |
| 11118 |
Ada.Text_IO.Put_Line (" Open command=" & |
| 11119 |
Format_State.Nesting_Stack(I).Name & " Class=" & |
| 11120 |
Data.Command_Type'Image(Format_State.Nesting_Stack(I).Command) & " Line=" & |
| 11121 |
Format_State.Nesting_Stack(I).Open_Line); |
| 11122 |
end loop; |
| 11123 |
end; |
| 11124 |
|
| 11125 |
else -- Normal paragraph: |
| 11126 |
-- Output a space if the last character was |
| 11127 |
-- not a space and the next character is |
| 11128 |
-- not a space. Eliminate any leading blanks |
| 11129 |
-- added for formatting: |
| 11130 |
if Format_Object.In_Paragraph and then |
| 11131 |
Format_Object.Last_Non_Space then |
| 11132 |
ARM_Output.Ordinary_Character (Output_Object, ' '); |
| 11133 |
Format_Object.Last_Non_Space := False; |
| 11134 |
end if; |
| 11135 |
-- Skip any leading spaces for the next paragraph: |
| 11136 |
while Char = ' ' loop |
| 11137 |
ARM_Input.Get_Char (Input_Object, Char); |
| 11138 |
end loop; |
| 11139 |
ARM_Input.Replace_Char (Input_Object); |
| 11140 |
end if; |
| 11141 |
else -- Hard paragraph break. Only one, no matter |
| 11142 |
-- how many blank lines there are: |
| 11143 |
while Char = Ascii.LF loop |
| 11144 |
ARM_Input.Get_Char (Input_Object, Char); |
| 11145 |
end loop; |
| 11146 |
if Format_Object.Next_Paragraph_Format_Type = Example_Text or else |
| 11147 |
Format_Object.Next_Paragraph_Format_Type = Child_Example_Text or else |
| 11148 |
Format_Object.Next_Paragraph_Format_Type = Indented_Example_Text or else |
| 11149 |
Format_Object.Next_Paragraph_Format_Type = Display or else |
| 11150 |
Format_Object.Next_Paragraph_Format_Type = Syntax_Display or else |
| 11151 |
Format_Object.Next_Paragraph_Format_Type = Syntax_Production then |
| 11152 |
null; -- In these formats, blanks remain. |
| 11153 |
else |
| 11154 |
-- Also remove any leading blanks from the next |
| 11155 |
-- paragraph: |
| 11156 |
while Char = ' ' loop |
| 11157 |
ARM_Input.Get_Char (Input_Object, Char); |
| 11158 |
end loop; |
| 11159 |
end if; |
| 11160 |
ARM_Input.Replace_Char (Input_Object); |
| 11161 |
Check_End_Paragraph; -- End the paragraph. |
| 11162 |
end if; |
| 11163 |
when ' ' => |
| 11164 |
if Format_Object.Next_Paragraph_Format_Type = Example_Text or else |
| 11165 |
Format_Object.Next_Paragraph_Format_Type = Child_Example_Text or else |
| 11166 |
Format_Object.Next_Paragraph_Format_Type = Indented_Example_Text or else |
| 11167 |
Format_Object.Next_Paragraph_Format_Type = Display or else |
| 11168 |
Format_Object.Next_Paragraph_Format_Type = Syntax_Display or else |
| 11169 |
Format_Object.Next_Paragraph_Format_Type = Syntax_Production then |
| 11170 |
-- Spaces are significant these formats. |
| 11171 |
Check_Paragraph; |
| 11172 |
ARM_Output.Hard_Space (Output_Object); |
| 11173 |
else |
| 11174 |
if Format_Object.In_Paragraph then |
| 11175 |
if Format_Object.No_Start_Paragraph then |
| 11176 |
-- Not really in a paragraph. |
| 11177 |
Ada.Text_IO.Put_Line ("Attempt to write into a deleted paragraph, on line " & ARM_Input.Line_String (Input_Object)); |
| 11178 |
-- We'll probably crash soon. |
| 11179 |
null; |
| 11180 |
else |
| 11181 |
ARM_Output.Ordinary_Character (Output_Object, ' '); |
| 11182 |
end if; |
| 11183 |
-- else we never want to start a paragraph with a space. |
| 11184 |
end if; |
| 11185 |
end if; |
| 11186 |
Format_Object.Last_Non_Space := False; |
| 11187 |
when Ascii.SUB => |
| 11188 |
-- End of file. |
| 11189 |
exit Reading_Loop; |
| 11190 |
when others => |
| 11191 |
if Format_State.Nesting_Stack_Ptr /= 0 and then |
| 11192 |
Format_State.Nesting_Stack (Format_State.Nesting_Stack_Ptr).Close_Char /= ' ' and then |
| 11193 |
Format_State.Nesting_Stack (Format_State.Nesting_Stack_Ptr).Close_Char = Char then |
| 11194 |
-- Closing a command, remove it from the stack. |
| 11195 |
Handle_End_of_Command; |
| 11196 |
else |
| 11197 |
Check_Paragraph; |
| 11198 |
ARM_Output.Ordinary_Character (Output_Object, Char); |
| 11199 |
null; -- Ordinary characters, output them. |
| 11200 |
Format_Object.Last_Non_Space := True; |
| 11201 |
end if; |
| 11202 |
end case; |
| 11203 |
end; |
| 11204 |
end loop Reading_Loop; |
| 11205 |
exception |
| 11206 |
when ARM_Output.Not_Valid_Error => |
| 11207 |
Ada.Text_IO.Put_Line ("** Output validity error processing line " & ARM_Input.Line_String (Input_Object)); |
| 11208 |
raise; |
| 11209 |
end Real_Process; |
| 11210 |
|
| 11211 |
|
| 11212 |
procedure Process (Format_Object : in out Format_Type; |
| 11213 |
File_Name : in String; |
| 11214 |
Output_Object : in out ARM_Output.Output_Type'Class; |
| 11215 |
Section_Name : in String; |
| 11216 |
Section_Number : in ARM_Contents.Section_Number_Type; |
| 11217 |
Starts_New_Section : in Boolean) is |
| 11218 |
-- Process the contents for File_Name, writing the results to |
| 11219 |
-- Output_Object. (Output_Object uses dispatching calls to provide |
| 11220 |
-- the correct formatting). Section_Name is the name of the section |
| 11221 |
-- for this file. Starts_New_Section is True if the file starts |
| 11222 |
-- a new section. Section_Number is the number (or letter) of the |
| 11223 |
-- section. Values > 20 represent annex letters (21 => A, 22 => B, etc.) |
| 11224 |
Input_Object : Arm_File.File_Input_Type; |
| 11225 |
Format_State : Format_State_Type; |
| 11226 |
begin |
| 11227 |
Ada.Text_IO.Put_Line ("-- Processing " & File_Name); |
| 11228 |
begin |
| 11229 |
Arm_File.Open (Input_Object, File_Name); |
| 11230 |
exception |
| 11231 |
when others => |
| 11232 |
Ada.Text_IO.Put_Line ("** Unable to open file " & File_Name); |
| 11233 |
raise; |
| 11234 |
end; |
| 11235 |
if Starts_New_Section then |
| 11236 |
Format_Object.Clause_Number := (Section => Section_Number, |
| 11237 |
Clause => 0, Subclause => 0, Subsubclause => 0); |
| 11238 |
declare |
| 11239 |
use type ARM_Contents.Section_Number_Type; |
| 11240 |
begin |
| 11241 |
if Section_Number = 0 then -- No title at all. |
| 11242 |
ARM_Output.Section (Output_Object, |
| 11243 |
Section_Title => "", |
| 11244 |
Section_Name => Section_Name); |
| 11245 |
elsif Section_Number < ARM_Contents.ANNEX_START then |
| 11246 |
ARM_Output.Section (Output_Object, |
| 11247 |
Section_Title => Ada.Strings.Fixed.Trim ( |
| 11248 |
ARM_Contents.Lookup_Title (ARM_Contents.Section, |
| 11249 |
(Section => Section_Number, others => 0)), Ada.Strings.Right), |
| 11250 |
Section_Name => Section_Name); |
| 11251 |
else |
| 11252 |
-- We don't have a way to tell between the three kinds of annexes, so we try them all: |
| 11253 |
begin |
| 11254 |
ARM_Output.Section (Output_Object, |
| 11255 |
Section_Title => Ada.Strings.Fixed.Trim ( |
| 11256 |
ARM_Contents.Lookup_Title (ARM_Contents.Normative_Annex, |
| 11257 |
(Section => Section_Number, others => 0)), Ada.Strings.Right), |
| 11258 |
Section_Name => Section_Name); |
| 11259 |
exception |
| 11260 |
when ARM_Contents.Not_Found_Error => |
| 11261 |
begin |
| 11262 |
ARM_Output.Section (Output_Object, |
| 11263 |
Section_Title => Ada.Strings.Fixed.Trim ( |
| 11264 |
ARM_Contents.Lookup_Title (ARM_Contents.Informative_Annex, |
| 11265 |
(Section => Section_Number, others => 0)), Ada.Strings.Right), |
| 11266 |
Section_Name => Section_Name); |
| 11267 |
exception |
| 11268 |
when ARM_Contents.Not_Found_Error => |
| 11269 |
ARM_Output.Section (Output_Object, |
| 11270 |
Section_Title => Ada.Strings.Fixed.Trim ( |
| 11271 |
ARM_Contents.Lookup_Title (ARM_Contents.Plain_Annex, |
| 11272 |
(Section => Section_Number, others => 0)), Ada.Strings.Right), |
| 11273 |
Section_Name => Section_Name); |
| 11274 |
-- If this fails, too, we just propagate to the outer handler. |
| 11275 |
end; |
| 11276 |
end; |
| 11277 |
end if; |
| 11278 |
exception |
| 11279 |
when ARM_Contents.Not_Found_Error => |
| 11280 |
Ada.Text_IO.Put_Line ("** Unable to find section title, line " & ARM_File.Line_String (Input_Object)); |
| 11281 |
end; |
| 11282 |
Format_Object.Next_Note := 1; |
| 11283 |
Format_Object.Next_Paragraph := 1; |
| 11284 |
Format_Object.Next_Insert_Para := 1; |
| 11285 |
Format_Object.Next_AARM_Sub := 'a'; |
| 11286 |
Format_Object.Next_Enumerated_Num := 1; |
| 11287 |
Format_Object.Enumerated_Level := 0; |
| 11288 |
|
| 11289 |
Format_Object.Text_Format := ARM_Output.NORMAL_FORMAT; |
| 11290 |
|
| 11291 |
Format_Object.No_Prefix := False; |
| 11292 |
Format_Object.No_Para_Num := False; |
| 11293 |
Format_Object.Keep_with_Next := False; |
| 11294 |
Format_Object.Space_After := ARM_Output.Normal; |
| 11295 |
Format_Object.No_Breaks := False; |
| 11296 |
Format_Object.In_Change := False; |
| 11297 |
Format_Object.Last_Non_Space := False; |
| 11298 |
|
| 11299 |
Format_Object.Next_Paragraph_Change_Kind := ARM_Database.None; |
| 11300 |
|
| 11301 |
Format_Object.Style := ARM_Output.Normal; -- The default. |
| 11302 |
Format_Object.Indent := 0; -- No indent to start. |
| 11303 |
Format_Object.In_Paragraph := False; |
| 11304 |
Format_Object.No_Start_Paragraph := False; |
| 11305 |
end if; |
| 11306 |
|
| 11307 |
Real_Process (Format_Object, Format_State, Input_Object, Output_Object); |
| 11308 |
|
| 11309 |
-- Reached end of the file/input object. |
| 11310 |
-- Kill any open paragraph: |
| 11311 |
if Format_Object.In_Paragraph and then (not Format_Object.No_Start_Paragraph) then |
| 11312 |
ARM_Output.End_Paragraph (Output_Object); |
| 11313 |
Format_Object.In_Paragraph := False; |
| 11314 |
Format_Object.No_Start_Paragraph := False; |
| 11315 |
end if; |
| 11316 |
Ada.Text_IO.Put_Line (" Lines processed: " & |
| 11317 |
ARM_File.Line_String (Input_Object)); |
| 11318 |
Arm_File.Close (Input_Object); |
| 11319 |
if Format_State.Nesting_Stack_Ptr /= 0 then |
| 11320 |
Ada.Text_IO.Put_Line (" ** Unfinished commands detected."); |
| 11321 |
for I in reverse 1 .. Format_State.Nesting_Stack_Ptr loop |
| 11322 |
Ada.Text_IO.Put_Line (" Open command=" & |
| 11323 |
Format_State.Nesting_Stack(I).Name & "; Line=" & |
| 11324 |
Format_State.Nesting_Stack(I).Open_Line); |
| 11325 |
end loop; |
| 11326 |
end if; |
| 11327 |
end Process; |
| 11328 |
|
| 11329 |
|
| 11330 |
procedure Format (Format_Object : in out Format_Type; |
| 11331 |
Text : in String; |
| 11332 |
Output_Object : in out ARM_Output.Output_Type'Class; |
| 11333 |
Text_Name : in String; |
| 11334 |
No_Annotations : in Boolean) is |
| 11335 |
-- Format the contents of Text, writing the results to |
| 11336 |
-- Output_Object. (Output_Object uses dispatching calls to provide |
| 11337 |
-- the correct formatting). Text is assumed to be a component of |
| 11338 |
-- a larger section. Text_Name is an identifying name for error messages. |
| 11339 |
-- If No_Annotations is true, we don't want any annotations even if we |
| 11340 |
-- are generating a document with annotations. |
| 11341 |
Input_Object : Arm_String.String_Input_Type; |
| 11342 |
Format_State : Format_State_Type; |
| 11343 |
Real_Include_Annotations : Boolean := Format_Object.Include_Annotations; |
| 11344 |
begin |
| 11345 |
if No_Annotations then |
| 11346 |
Format_Object.Include_Annotations := False; |
| 11347 |
end if; |
| 11348 |
Arm_String.Open (Input_Object, Text, Text_Name); |
| 11349 |
-- Open the input object using a string for input. |
| 11350 |
Real_Process (Format_Object, Format_State, Input_Object, Output_Object); |
| 11351 |
Arm_String.Close (Input_Object); |
| 11352 |
Format_Object.Include_Annotations := Real_Include_Annotations; |
| 11353 |
if Format_State.Nesting_Stack_Ptr /= 0 then |
| 11354 |
Ada.Text_IO.Put_Line (" ** Unfinished commands detected."); |
| 11355 |
for I in reverse 1 .. Format_State.Nesting_Stack_Ptr loop |
| 11356 |
Ada.Text_IO.Put_Line (" Open command=" & |
| 11357 |
Format_State.Nesting_Stack(I).Name & "; Line=" & |
| 11358 |
Format_State.Nesting_Stack(I).Open_Line); |
| 11359 |
end loop; |
| 11360 |
end if; |
| 11361 |
end Format; |
| 11362 |
|
| 11363 |
end ARM_Format; |