Debian Codegraph @

progs/arm_corr.adb

raw
1 with --ARM_Output,
2 --ARM_Contents,
3 --Ada.Text_IO,
4 Ada.Exceptions,
5 Ada.Strings.Fixed,
6 Ada.Strings.Maps;
7 package body ARM_Corr is
8
9 --
10 -- Ada reference manual formatter (ARM_Form).
11 --
12 -- This package defines the text output object.
13 -- Output objects are responsible for implementing the details of
14 -- a particular format.
15 --
16 -- ---------------------------------------
17 -- Copyright 2000, 2002, 2004, 2005, 2006, 2007, 2011, 2012
18 -- AXE Consultants. All rights reserved.
19 -- P.O. Box 1512, Madison WI 53701
20 -- E-Mail: [email protected]
21 --
22 -- ARM_Form is free software: you can redistribute it and/or modify
23 -- it under the terms of the GNU General Public License version 3
24 -- as published by the Free Software Foundation.
25 --
26 -- AXE CONSULTANTS MAKES THIS TOOL AND SOURCE CODE AVAILABLE ON AN "AS IS"
27 -- BASIS AND MAKES NO WARRANTY, EXPRESS OR IMPLIED, AS TO THE ACCURACY,
28 -- CAPABILITY, EFFICIENCY, MERCHANTABILITY, OR FUNCTIONING OF THIS TOOL.
29 -- IN NO EVENT WILL AXE CONSULTANTS BE LIABLE FOR ANY GENERAL,
30 -- CONSEQUENTIAL, INDIRECT, INCIDENTAL, EXEMPLARY, OR SPECIAL DAMAGES,
31 -- EVEN IF AXE CONSULTANTS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
32 -- DAMAGES.
33 --
34 -- A copy of the GNU General Public License is available in the file
35 -- gpl-3-0.txt in the standard distribution of the ARM_Form tool.
36 -- Otherwise, see <http://www.gnu.org/licenses/>.
37 --
38 -- If the GPLv3 license is not satisfactory for your needs, a commercial
39 -- use license is available for this tool. Contact Randy at AXE Consultants
40 -- for more information.
41 --
42 -- ---------------------------------------
43 --
44 -- Edit History:
45 --
46 -- 6/ 2/05 - RLB - Created package from text and HTML versions.
47 -- 1/11/06 - RLB - Eliminated dispatching Create in favor of tailored
48 -- versions.
49 -- 1/18/06 - RLB - Added additional styles.
50 -- 2/ 8/06 - RLB - Added additional parameters to the table command.
51 -- 2/10/06 - RLB - Added even more additional parameters to the
52 -- table command.
53 -- - RLB - Added picture command.
54 -- 9/22/06 - RLB - Added missing with.
55 -- 9/25/06 - RLB - Handled optional renaming of TOC.
56 -- - RLB - Added Last_Column_Width to Start_Table.
57 -- 10/13/06 - RLB - Added Local_Link_Start and Local_Link_End to allow
58 -- formatting in the linked text.
59 -- 2/ 9/07 - RLB - Changed comments on AI_Reference.
60 -- 2/13/07 - RLB - Revised to separate style and indent information
61 -- for paragraphs.
62 -- 12/18/07 - RLB - Added Plain_Annex.
63 -- 12/19/07 - RLB - Added limited colors to Text_Format.
64 -- 10/18/11 - RLB - Changed to GPLv3 license.
65 -- 10/25/11 - RLB - Added old insertion version to Revised_Clause_Header.
66 -- 8/31/12 - RLB - Added Output_Path.
67 -- 10/18/12 - RLB - Added additional hanging styles.
68 -- 11/26/12 - RLB - Added subdivision names to Clause_Header and
69 -- Revised_Clause_Header.
70
71 LINE_LENGTH : constant := 78;
72 -- Maximum intended line length.
73
74 Special_Set : constant Ada.Strings.Maps.Character_Set :=
75 Ada.Strings.Maps."or" (Ada.Strings.Maps.To_Set ('>'),
76 Ada.Strings.Maps.To_Set ('@'));
77
78 procedure Create (Output_Object : in out Corr_Output_Type;
79 File_Prefix : in String;
80 Output_Path : in String;
81 Title : in String := "") is
82 -- Create an Output_Object for a document.
83 -- The prefix of the output file names is File_Prefix - this
84 -- should be no more then 5 characters allowed in file names.
85 -- The result files will be written to Output_Path.
86 -- The title of the document is Title.
87 begin
88 if Output_Object.Is_Valid then
89 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
90 "Already valid object");
91 end if;
92 Output_Object.Is_Valid := True;
93 Ada.Strings.Fixed.Move (Target => Output_Object.File_Prefix,
94 Source => File_Prefix);
95 Ada.Strings.Fixed.Move (Target => Output_Object.Output_Path,
96 Source => Output_Path);
97 Output_Object.Output_Path_Len := Output_Path'Length;
98 -- We don't use the title.
99 end Create;
100
101
102 procedure Close (Output_Object : in out Corr_Output_Type) is
103 -- Close an Output_Object. No further output to the object is
104 -- allowed after this call.
105 begin
106 if not Output_Object.Is_Valid then
107 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
108 "Not valid object");
109 end if;
110 if Ada.Text_IO.Is_Open (Output_Object.Output_File) then
111 Ada.Text_IO.Close (Output_Object.Output_File);
112 end if;
113 Output_Object.Is_Valid := False;
114 end Close;
115
116
117 procedure Section (Output_Object : in out Corr_Output_Type;
118 Section_Title : in String;
119 Section_Name : in String) is
120 -- Start a new section. The title is Section_Title (this is
121 -- intended for humans). The name is Section_Name (this is
122 -- intended to be suitable to be a portion of a file name).
123 begin
124 if not Output_Object.Is_Valid then
125 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
126 "Not valid object");
127 end if;
128 if Output_Object.Is_In_Paragraph then
129 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
130 "Section in paragraph");
131 end if;
132 if Ada.Text_IO.Is_Open (Output_Object.Output_File) then
133 Ada.Text_IO.Close (Output_Object.Output_File);
134 end if;
135 -- Create a new file for this section:
136 -- Unix directory separator for Windows and Debian
137 Ada.Text_IO.Create (Output_Object.Output_File, Ada.Text_IO.Out_File,
138 Output_Object.Output_Path(1..Output_Object.Output_Path_Len) &
139 Ada.Strings.Fixed.Trim (Output_Object.File_Prefix, Ada.Strings.Right) &
140 "-Corr-" & Section_Name & ".TXT");
141 Ada.Text_IO.New_Line (Output_Object.Output_File);
142 end Section;
143
144
145 procedure Set_Columns (Output_Object : in out Corr_Output_Type;
146 Number_of_Columns : in ARM_Output.Column_Count) is
147 -- Set the number of columns.
148 -- Raises Not_Valid_Error if in a paragraph.
149 begin
150 if not Output_Object.Is_Valid then
151 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
152 "Not valid object");
153 end if;
154 if Output_Object.Is_In_Paragraph then
155 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
156 "In paragraph");
157 end if;
158 -- No columns in text format.
159 end Set_Columns;
160
161
162 procedure Make_Indent (Output_Object : in out Corr_Output_Type) is
163 -- Internal:
164 -- Output the appropriate indent after a New_Line or Put_Line.
165 begin
166 --Ada.Text_IO.Put_Line("Make_Indent: Amount=" & Natural'Image(Output_Object.Indent_Amount));
167 for I in 1 .. Output_Object.Indent_Amount loop
168 Ada.Text_IO.Put (Output_Object.Output_File, ' ');
169 end loop;
170 Output_Object.Char_Count := Output_Object.Indent_Amount;
171 Output_Object.Out_Char_Count := Output_Object.Indent_Amount;
172 Output_Object.Output_Buffer_Space_Before := False;
173 end Make_Indent;
174
175
176 procedure Spill (Output_Object : in out Corr_Output_Type) is
177 -- Internal:
178 -- Empty the output buffer in preperation for a New_Line or Put_Line.
179 begin
180 if Output_Object.Output_Buffer_Space_Before then
181 Ada.Text_IO.Put (Output_Object.Output_File, ' ');
182 Output_Object.Char_Count := Output_Object.Char_Count + 1; -- Count the space.
183 Output_Object.Out_Char_Count := Output_Object.Out_Char_Count + 1; -- Count the space.
184 end if;
185 if Output_Object.Output_Buffer_Len /= 0 then
186 Ada.Text_IO.Put (Output_Object.Output_File,
187 Output_Object.Output_Buffer (1 .. Output_Object.Output_Buffer_Len));
188 --Ada.Text_IO.Put_Line("Spill: Len=" & Natural'Image(Output_Object.Output_Buffer_Len) &
189 -- " Space added=" & Boolean'Image(Output_Object.Output_Buffer_Space_Before) & " Text=" &
190 -- Output_Object.Output_Buffer (1 .. Output_Object.Output_Buffer_Len));
191 Output_Object.Output_Buffer_Len := 0;
192 Output_Object.Out_Char_Count := Output_Object.Out_Char_Count +
193 Output_Object.Output_Buffer_Len;
194 end if;
195 Output_Object.Output_Buffer_Space_Before := False;
196 end Spill;
197
198
199 procedure Buffer (Output_Object : in out Corr_Output_Type;
200 Char : in Character) is
201 -- Internal:
202 -- Add Char to the output buffer. Char will *not* be a word break
203 -- character.
204 begin
205 if Output_Object.Output_Buffer_Len = Output_Object.Output_Buffer'Last then
206 -- Oops, buffer is full. Spill it, and this character.
207 --Ada.Text_IO.Put_Line("** Buffer overflow!!");
208 Spill (Output_Object);
209 Ada.Text_IO.Put (Output_Object.Output_File, Char);
210 Output_Object.Char_Count := Output_Object.Char_Count + 1;
211 Output_Object.Out_Char_Count := Output_Object.Out_Char_Count + 1;
212 return;
213 end if;
214 Output_Object.Output_Buffer_Len := Output_Object.Output_Buffer_Len + 1;
215 Output_Object.Output_Buffer(Output_Object.Output_Buffer_Len) := Char;
216 Output_Object.Char_Count := Output_Object.Char_Count + 1;
217 end Buffer;
218
219
220 procedure Buffer (Output_Object : in out Corr_Output_Type;
221 Str : in String) is
222 -- Internal:
223 -- Add Char to the output buffer. String will *not* include a word
224 -- break character.
225 begin
226 if Output_Object.Output_Buffer_Len+Str'Length >= Output_Object.Output_Buffer'Last then
227 -- Oops, buffer is full. Spill it.
228 --Ada.Text_IO.Put_Line("** Buffer overflow!!");
229 Spill (Output_Object);
230 end if;
231 Output_Object.Output_Buffer(Output_Object.Output_Buffer_Len+1..Output_Object.Output_Buffer_Len+Str'Length)
232 := Str;
233 Output_Object.Output_Buffer_Len := Output_Object.Output_Buffer_Len + Str'Length;
234 Output_Object.Char_Count := Output_Object.Char_Count + Str'Length;
235 end Buffer;
236
237
238 procedure Start_Paragraph (Output_Object : in out Corr_Output_Type;
239 Style : in ARM_Output.Paragraph_Style_Type;
240 Indent : in ARM_Output.Paragraph_Indent_Type;
241 Number : in String;
242 No_Prefix : in Boolean := False;
243 Tab_Stops : in ARM_Output.Tab_Info := ARM_Output.NO_TABS;
244 No_Breaks : in Boolean := False;
245 Keep_with_Next : in Boolean := False;
246 Space_After : in ARM_Output.Space_After_Type
247 := ARM_Output.Normal;
248 Justification : in ARM_Output.Justification_Type
249 := ARM_Output.Default) is
250 -- Start a new paragraph. The style and indent of the paragraph is as
251 -- specified. The (AA)RM paragraph number (which might include update
252 -- and version numbers as well: [12.1/1]) is Number. If the format is
253 -- a type with a prefix (bullets, hangining items), the prefix is
254 -- omitted if No_Prefix is true. Tab_Stops defines the tab stops for
255 -- the paragraph. If No_Breaks is True, we will try to avoid page breaks
256 -- in the paragraph. If Keep_with_Next is true, we will try to avoid
257 -- separating this paragraph and the next one. (These may have no
258 -- effect in formats that don't have page breaks). Space_After
259 -- specifies the amount of space following the paragraph. Justification
260 -- specifies the text justification for the paragraph. Not_Valid_Error
261 -- is raised if Tab_Stops /= NO_TABS for a hanging or bulleted format.
262 use type ARM_Output.Paragraph_Indent_Type;
263 begin
264 if not Output_Object.Is_Valid then
265 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
266 "Not valid object");
267 end if;
268 if Output_Object.Is_In_Paragraph then
269 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
270 "Already in paragraph");
271 end if;
272 Output_Object.Is_In_Paragraph := True;
273 Output_Object.Is_Hanging := False;
274 Output_Object.Saw_Hang_End := False;
275 Output_Object.Char_Count := 0;
276 Output_Object.Out_Char_Count := 0;
277 Output_Object.Output_Buffer_Space_Before := False; -- Nothing in it or on the line.
278 Output_Object.Output_Buffer_Len := 0;
279 Output_Object.Font := ARM_Output.Default;
280 Output_Object.Is_Bold := False;
281 Output_Object.Is_Italic := False;
282 Output_Object.Size := 0;
283 Output_Object.Para_Style := Style;
284 Output_Object.Para_Indent := Indent;
285 Output_Object.Is_Fixed_Format := False;
286
287 if Output_Object.Clause_Len /= 0 and then
288 Number /= "" then
289 Ada.Text_IO.New_Line (Output_Object.Output_File);
290 Ada.Text_IO.Put (Output_Object.Output_File, "!paragraph ");
291 Ada.Text_IO.Put (Output_Object.Output_File, Output_Object.Clause_Num(1..Output_Object.Clause_Len));
292 Ada.Text_IO.Put (Output_Object.Output_File, '(');
293 Ada.Text_IO.Put (Output_Object.Output_File, Number);
294 Ada.Text_IO.Put (Output_Object.Output_File, ") [");
295 Ada.Text_IO.Put (Output_Object.Output_File, ARM_Output.Paragraph_Style_Type'Image(Style) &
296 " :" & ARM_Output.Paragraph_Indent_Type'Image(Indent));
297 Ada.Text_IO.Put_Line (Output_Object.Output_File, "]");
298 Ada.Text_IO.New_Line (Output_Object.Output_File);
299 else
300 Ada.Text_IO.New_Line (Output_Object.Output_File);
301 end if;
302
303 Output_Object.Indent_Amount := Integer(Indent)*4 + 2;
304
305 case Style is
306 when ARM_Output.Normal =>
307 if Indent = 0 then
308 null; -- %% Temp.
309 Output_Object.Indent_Amount := 0; -- %% Temp.
310 elsif Indent = 3 then
311 Ada.Text_IO.Put (Output_Object.Output_File, "@xindent<");
312 Output_Object.Char_Count := 9;
313 Output_Object.Indent_Amount := 0; -- %% Temp.
314 else -- Unknown case.
315 null; -- ** Tbd.
316 end if;
317 when ARM_Output.Wide_Above => null;
318 if Indent = 0 then
319 null; -- %% Temp.
320 Output_Object.Indent_Amount := 0; -- %% Temp.
321 else -- Unknown case.
322 null; -- ** Tbd.
323 end if;
324
325 when ARM_Output.Small =>
326 if Indent = 1 then -- Notes.
327 Ada.Text_IO.Put (Output_Object.Output_File, "@xindent<@s9<");
328 Output_Object.Char_Count := 13;
329 Output_Object.Indent_Amount := 0; -- %% Temp.
330 else -- Unknown case.
331 null; -- ** Tbd.
332 end if;
333 when ARM_Output.Small_Wide_Above =>
334 null; -- ** TBD (Unknown cases).
335
336 when ARM_Output.Header =>
337 null; -- ** TBD (Unknown cases).
338
339 when ARM_Output.Small_Header =>
340 if Indent = 1 then -- Notes Header.
341 null;
342 --Output_Object.Indent_Amount := 6; --** TBD.
343 else -- Unknown case.
344 null; -- ** Tbd.
345 end if;
346
347 when ARM_Output.Index => null; --** TBD.
348 when ARM_Output.Syntax_Summary => null; --** TBD.
349 when ARM_Output.Title =>
350 null; -- ** TBD (Unknown cases).
351
352 when ARM_Output.Examples =>
353 if Indent = 1 then
354 Ada.Text_IO.Put (Output_Object.Output_File, "@xcode<");
355 Output_Object.Char_Count := 7;
356 Output_Object.Is_Fixed_Format := True;
357 Output_Object.Indent_Amount := 0; -- %% Temp.
358 else -- Unknown case.
359 null; -- ** Tbd.
360 end if;
361
362 when ARM_Output.Small_Examples => null; --** TBD.
363
364 when ARM_Output.Swiss_Examples =>
365 if Indent = 1 then
366 Ada.Text_IO.Put (Output_Object.Output_File, "@xcode<");
367 Output_Object.Char_Count := 7;
368 Output_Object.Is_Fixed_Format := True;
369 Output_Object.Indent_Amount := 0; -- %% Temp.
370 else -- Unknown case.
371 null; -- ** Tbd.
372 end if;
373
374 when ARM_Output.Small_Swiss_Examples => null; --** TBD.
375
376 when ARM_Output.Bulleted =>
377 if Indent = 1 then
378 Output_Object.Indent_Amount := 0; -- %% Temp.
379 if No_Prefix then
380 Ada.Text_IO.Put (Output_Object.Output_File, "@xindent<");
381 Output_Object.Char_Count := 9;
382 else
383 Ada.Text_IO.Put (Output_Object.Output_File, "@xbullet<");
384 Output_Object.Char_Count := 9;
385 end if;
386 else -- Unknown/unimplemented case.
387 null; -- ** Tbd.
388 end if;
389
390 when ARM_Output.Nested_Bulleted => null; --** TBD.
391
392 when ARM_Output.Small_Bulleted => null; --** TBD.
393
394 when ARM_Output.Small_Nested_Bulleted => null; --** TBD.
395
396 when ARM_Output.Giant_Hanging => null; --** TBD.
397
398 when ARM_Output.Wide_Hanging =>
399 if Indent = 3 then
400 Output_Object.Indent_Amount := 0; -- %% Temp.
401 Output_Object.Is_Hanging := True;
402 if No_Prefix then
403 Output_Object.Saw_Hang_End := True;
404 Output_Object.Char_Count := 0;
405 else -- Has prefix
406 -- No units on first line.
407 Output_Object.Saw_Hang_End := False;
408 Ada.Text_IO.Put (Output_Object.Output_File, "@xhang<@xterm<");
409 Output_Object.Char_Count := 14;
410 end if;
411 else -- Unknown/unimplemented case.
412 null; -- ** Tbd.
413 end if;
414
415 when ARM_Output.Medium_Hanging => null; --** TBD.
416
417 when ARM_Output.Narrow_Hanging => null; --** TBD.
418
419 when ARM_Output.Hanging_in_Bulleted => null; --** TBD.
420
421 when ARM_Output.Small_Giant_Hanging => null; --** TBD.
422
423 when ARM_Output.Small_Wide_Hanging => null; --** TBD.
424
425 when ARM_Output.Small_Medium_Hanging => null; --** TBD.
426
427 when ARM_Output.Small_Narrow_Hanging => null; --** TBD.
428
429 when ARM_Output.Small_Hanging_in_Bulleted => null; --** TBD.
430
431 when ARM_Output.Enumerated => null; --** TBD.
432
433 when ARM_Output.Small_Enumerated => null; --** TBD.
434
435 end case;
436
437 if Output_Object.Indent_Amount > 6 then
438 for I in 1 .. (Output_Object.Indent_Amount-6)/4 loop
439 Ada.Text_IO.Put (Output_Object.Output_File, " ");
440 Output_Object.Char_Count := Output_Object.Char_Count + 4;
441 end loop;
442 end if;
443
444 case Style is
445 when ARM_Output.Normal | ARM_Output.Wide_Above |
446 ARM_Output.Small | ARM_Output.Small_Wide_Above |
447 ARM_Output.Header | ARM_Output.Small_Header |
448 ARM_Output.Index | ARM_Output.Syntax_Summary |
449 ARM_Output.Title |
450 ARM_Output.Examples | ARM_Output.Small_Examples |
451 ARM_Output.Swiss_Examples | ARM_Output.Small_Swiss_Examples =>
452 Output_Object.Tab_Stops := Tab_Stops;
453 -- We'll expand proportional stops here (text characters
454 -- are larger than the variable ones these are set up for).
455 for I in 1 .. Tab_Stops.Number loop
456 if ARM_Output."=" (Tab_Stops.Stops(I).Kind,
457 ARM_Output.Left_Proportional) then
458 Output_Object.Tab_Stops.Stops(I).Stop :=
459 (Tab_Stops.Stops(I).Stop * 5 / 4) + Output_Object.Indent_Amount;
460 else
461 Output_Object.Tab_Stops.Stops(I).Stop :=
462 Tab_Stops.Stops(I).Stop + Output_Object.Indent_Amount;
463 end if;
464 end loop;
465 when ARM_Output.Bulleted | ARM_Output.Nested_Bulleted |
466 ARM_Output.Small_Bulleted | ARM_Output.Small_Nested_Bulleted |
467 ARM_Output.Giant_Hanging | ARM_Output.Wide_Hanging |
468 ARM_Output.Medium_Hanging | ARM_Output.Narrow_Hanging |
469 ARM_Output.Hanging_in_Bulleted |
470 ARM_Output.Small_Giant_Hanging | ARM_Output.Small_Wide_Hanging |
471 ARM_Output.Small_Medium_Hanging | ARM_Output.Small_Narrow_Hanging |
472 ARM_Output.Small_Hanging_in_Bulleted |
473 ARM_Output.Enumerated | ARM_Output.Small_Enumerated =>
474 if Tab_Stops.Number /= 0 then
475 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
476 "Tabs in hanging/bulleted paragraph");
477 end if;
478 end case;
479 Output_Object.Out_Char_Count := Output_Object.Char_Count;
480
481 -- Note: No_Breaks, Keep_with_Next, and Justification have no effect
482 -- here.
483 --Ada.Text_IO.Put_Line ("Start_Paragraph - Indent=" & Natural'Image(Output_Object.Indent_Amount) & " Cnt=" &
484 -- Natural'Image(Output_Object.Char_Count));
485 end Start_Paragraph;
486
487
488 procedure End_Paragraph (Output_Object : in out Corr_Output_Type) is
489 -- End a paragraph.
490 use type ARM_Output.Paragraph_Indent_Type;
491 begin
492 if not Output_Object.Is_Valid then
493 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
494 "Not valid object");
495 end if;
496 if not Output_Object.Is_In_Paragraph then
497 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
498 "Not in paragraph");
499 end if;
500 case Output_Object.Para_Style is
501 when ARM_Output.Normal =>
502 if Output_Object.Para_Indent = 0 then
503 null;
504 elsif Output_Object.Para_Indent = 3 then
505 Buffer (Output_Object, '>');
506 else -- Unknown case.
507 null; -- ** Tbd.
508 end if;
509 when ARM_Output.Wide_Above => null;
510 if Output_Object.Para_Indent = 0 then
511 null; -- %% Temp.
512 else -- Unknown case.
513 null; -- ** Tbd.
514 end if;
515
516 when ARM_Output.Small =>
517 if Output_Object.Para_Indent = 1 then -- Notes.
518 Buffer (Output_Object, ">>");
519 else -- Unknown case.
520 null; -- ** Tbd.
521 end if;
522 when ARM_Output.Small_Wide_Above =>
523 null; -- ** TBD (Unknown cases).
524
525 when ARM_Output.Header =>
526 null; -- ** TBD (Unknown cases).
527
528 when ARM_Output.Small_Header =>
529 if Output_Object.Para_Indent = 1 then -- Notes Header.
530 null;
531 else -- Unknown case.
532 null; -- ** Tbd.
533 end if;
534
535 when ARM_Output.Index => null; --** TBD.
536 when ARM_Output.Syntax_Summary => null; --** TBD.
537 when ARM_Output.Title => null; --** TBD.
538 when ARM_Output.Examples =>
539 if Output_Object.Para_Indent = 1 then
540 Buffer (Output_Object, '>');
541 else -- Unknown case.
542 null; -- ** Tbd.
543 end if;
544
545 when ARM_Output.Small_Examples => null; --** TBD.
546
547 when ARM_Output.Swiss_Examples =>
548 if Output_Object.Para_Indent = 1 then
549 Buffer (Output_Object, '>');
550 else -- Unknown case.
551 null; -- ** Tbd.
552 end if;
553
554 when ARM_Output.Small_Swiss_Examples => null; --** TBD.
555
556 when ARM_Output.Bulleted =>
557 if Output_Object.Para_Indent = 1 then
558 Buffer (Output_Object, '>');
559 else -- Unknown/unimplemented case.
560 null; -- ** Tbd.
561 end if;
562
563 when ARM_Output.Nested_Bulleted => null; --** TBD.
564
565 when ARM_Output.Small_Bulleted => null; --** TBD.
566
567 when ARM_Output.Small_Nested_Bulleted => null; --** TBD.
568
569 when ARM_Output.Giant_Hanging => null; --** TBD.
570
571 when ARM_Output.Wide_Hanging =>
572 if Output_Object.Para_Indent = 3 then
573 Buffer (Output_Object, '>');
574 else -- Unknown/unimplemented case.
575 null; -- ** Tbd.
576 end if;
577
578 when ARM_Output.Medium_Hanging => null; --** TBD.
579
580 when ARM_Output.Narrow_Hanging => null; --** TBD.
581
582 when ARM_Output.Hanging_in_Bulleted => null; --** TBD.
583
584 when ARM_Output.Small_Giant_Hanging => null; --** TBD.
585
586 when ARM_Output.Small_Wide_Hanging => null; --** TBD.
587
588 when ARM_Output.Small_Medium_Hanging => null; --** TBD.
589
590 when ARM_Output.Small_Narrow_Hanging => null; --** TBD.
591
592 when ARM_Output.Small_Hanging_in_Bulleted => null; --** TBD.
593
594 when ARM_Output.Enumerated => null; --** TBD.
595
596 when ARM_Output.Small_Enumerated => null; --** TBD.
597
598 end case;
599
600 if Output_Object.Output_Buffer_Len /= 0 then
601 Spill (Output_Object);
602 end if;
603 Output_Object.Is_In_Paragraph := False;
604 Ada.Text_IO.New_Line (Output_Object.Output_File, 2); -- Double space paragraphs.
605 end End_Paragraph;
606
607
608 procedure Category_Header (Output_Object : in out Corr_Output_Type;
609 Header_Text : String) is
610 -- Output a Category header (that is, "Legality Rules",
611 -- "Dynamic Semantics", etc.)
612 -- (Note: We did not use a enumeration here to insure that these
613 -- headers are spelled the same in all output versions).
614 -- Raises Not_Valid_Error if in a paragraph.
615 begin
616 if not Output_Object.Is_Valid then
617 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
618 "Not valid object");
619 end if;
620 if Output_Object.Is_In_Paragraph then
621 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
622 "Header in paragraph");
623 end if;
624 Ada.Text_IO.New_Line (Output_Object.Output_File);
625 Ada.Text_IO.Put_Line (Output_Object.Output_File, "!subheader");
626 Ada.Text_IO.Put (Output_Object.Output_File, "@i<@s8<");
627 if Ada.Strings.Fixed.Count (Header_Text, Special_Set) = 0 then
628 Ada.Text_IO.Put (Output_Object.Output_File, Header_Text);
629 else
630 for I in Header_Text'Range loop
631 if Header_Text(I) = '>' then
632 Ada.Text_IO.Put (Output_Object.Output_File, "@>");
633 elsif Header_Text(I) = '@' then
634 Ada.Text_IO.Put (Output_Object.Output_File, "@@");
635 else
636 Ada.Text_IO.Put (Output_Object.Output_File, Header_Text(I));
637 end if;
638 end loop;
639 end if;
640 Ada.Text_IO.Put (Output_Object.Output_File, ">>");
641 Ada.Text_IO.New_Line (Output_Object.Output_File);
642 Output_Object.Char_Count := 0;
643 Output_Object.Out_Char_Count := 0;
644 end Category_Header;
645
646
647 procedure Clause_Header (Output_Object : in out Corr_Output_Type;
648 Header_Text : in String;
649 Level : in ARM_Contents.Level_Type;
650 Clause_Number : in String;
651 Top_Level_Subdivision_Name : in ARM_Output.Top_Level_Subdivision_Name_Kind;
652 No_Page_Break : in Boolean := False) is
653 -- Output a Clause header. The level of the header is specified
654 -- in Level. The Clause Number is as specified; the top-level (and
655 -- other) subdivision names are as specified. These should appear in
656 -- the table of contents.
657 -- For hyperlinked formats, this should generate a link target.
658 -- If No_Page_Break is True, suppress any page breaks.
659 -- Raises Not_Valid_Error if in a paragraph.
660 begin
661 if not Output_Object.Is_Valid then
662 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
663 "Not valid object");
664 end if;
665 if Output_Object.Is_In_Paragraph then
666 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
667 "Header in paragraph");
668 end if;
669 Ada.Text_IO.New_Line (Output_Object.Output_File);
670
671 Output_Object.Clause_Len := Clause_Number'Length;
672 Output_Object.Clause_Num(1..Output_Object.Clause_Len) :=
673 Clause_Number;
674 -- Special for table of contents:
675 if Clause_Number = "" and then
676 (Header_Text = "Table of Contents" or else
677 Header_Text = "Contents") then
678 Ada.Text_IO.Put (Output_Object.Output_File,
679 "!clause ");
680 Ada.Text_IO.Put_Line (Output_Object.Output_File,
681 Header_Text);
682 Ada.Text_IO.New_Line (Output_Object.Output_File, 2);
683 Output_Object.Char_Count := 0;
684 Output_Object.Out_Char_Count := 0;
685 return;
686 end if;
687
688 Ada.Text_IO.Put (Output_Object.Output_File,
689 "!clause ");
690 case Level is
691 when ARM_Contents.Plain_Annex =>
692 Ada.Text_IO.Put_Line (Output_Object.Output_File,
693 Clause_Number); -- Note: Clause_Number includes "Annex"
694 Ada.Text_IO.Put_Line (Output_Object.Output_File,
695 Header_Text);
696 when ARM_Contents.Normative_Annex =>
697 Ada.Text_IO.Put_Line (Output_Object.Output_File,
698 Clause_Number); -- Note: Clause_Number includes "Annex"
699 Ada.Text_IO.Put_Line (Output_Object.Output_File,
700 "(normative)");
701 Ada.Text_IO.New_Line (Output_Object.Output_File);
702 Ada.Text_IO.Put_Line (Output_Object.Output_File,
703 Header_Text);
704 when ARM_Contents.Informative_Annex =>
705 Ada.Text_IO.Put_Line (Output_Object.Output_File,
706 Clause_Number); -- Note: Clause_Number includes "Annex"
707 Ada.Text_IO.Put_Line (Output_Object.Output_File,
708 "(informative)");
709 Ada.Text_IO.New_Line (Output_Object.Output_File);
710 Ada.Text_IO.Put_Line (Output_Object.Output_File,
711 Header_Text);
712 when ARM_Contents.Section =>
713 case Top_Level_Subdivision_Name is
714 when ARM_Output.Chapter =>
715 Ada.Text_IO.Put_Line (Output_Object.Output_File,
716 "Chapter " & Clause_Number & ": " & Header_Text);
717 when ARM_Output.Section =>
718 Ada.Text_IO.Put_Line (Output_Object.Output_File,
719 "Section " & Clause_Number & ": " & Header_Text);
720 when ARM_Output.Clause =>
721 Ada.Text_IO.Put_Line (Output_Object.Output_File,
722 Clause_Number & " " & Header_Text);
723 end case;
724 when ARM_Contents.Unnumbered_Section =>
725 if Header_Text /= "" then
726 Ada.Text_IO.Put_Line (Output_Object.Output_File,
727 Header_Text);
728 end if;
729 when ARM_Contents.Clause | ARM_Contents.Subclause |
730 ARM_Contents.Subsubclause =>
731 Ada.Text_IO.Put_Line (Output_Object.Output_File,
732 Clause_Number & ' ' & Header_Text);
733 when ARM_Contents.Dead_Clause =>
734 raise Program_Error; -- No headers for dead clauses.
735 end case;
736 Ada.Text_IO.New_Line (Output_Object.Output_File, 2);
737 Output_Object.Char_Count := 0;
738 Output_Object.Out_Char_Count := 0;
739 -- We don't have any page breaks here to suppress.
740 end Clause_Header;
741
742
743 procedure Revised_Clause_Header
744 (Output_Object : in out Corr_Output_Type;
745 New_Header_Text : in String;
746 Old_Header_Text : in String;
747 Level : in ARM_Contents.Level_Type;
748 Clause_Number : in String;
749 Version : in ARM_Contents.Change_Version_Type;
750 Old_Version : in ARM_Contents.Change_Version_Type;
751 Top_Level_Subdivision_Name : in ARM_Output.Top_Level_Subdivision_Name_Kind;
752 No_Page_Break : in Boolean := False) is
753 -- Output a revised clause header. Both the original and new text will
754 -- be output. The level of the header is specified in Level. The Clause
755 -- Number is as specified; the top-level (and other) subdivision names
756 -- are as specified. These should appear in the table of contents.
757 -- For hyperlinked formats, this should generate a link target.
758 -- Version is the insertion version of the new text; Old_Version is
759 -- the insertion version of the old text.
760 -- If No_Page_Break is True, suppress any page breaks.
761 -- Raises Not_Valid_Error if in a paragraph.
762 function Header_Text return String is
763 -- Note: Version and Old_Version are not used.
764 begin
765 return '{' & New_Header_Text & "} [" & Old_Header_Text & ']';
766 end Header_Text;
767 begin
768 if not Output_Object.Is_Valid then
769 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
770 "Not valid object");
771 end if;
772 if Output_Object.Is_In_Paragraph then
773 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
774 "Header in paragraph");
775 end if;
776 Ada.Text_IO.New_Line (Output_Object.Output_File);
777
778 Output_Object.Clause_Len := Clause_Number'Length;
779 Output_Object.Clause_Num(1..Output_Object.Clause_Len) :=
780 Clause_Number;
781 -- Special for table of contents:
782 if Clause_Number = "" and then
783 (Header_Text = "Table of Contents" or else -- Ada 95 format
784 Header_Text = "Contents") then -- ISO 2004 format.
785 Ada.Text_IO.Put (Output_Object.Output_File,
786 "!clause ");
787 Ada.Text_IO.Put_Line (Output_Object.Output_File,
788 Header_Text);
789 Ada.Text_IO.New_Line (Output_Object.Output_File, 2);
790 Output_Object.Char_Count := 0;
791 Output_Object.Out_Char_Count := 0;
792 return;
793 end if;
794
795 Ada.Text_IO.Put (Output_Object.Output_File,
796 "!clause ");
797 case Level is
798 when ARM_Contents.Plain_Annex =>
799 Ada.Text_IO.Put_Line (Output_Object.Output_File,
800 Clause_Number); -- Note: Clause_Number includes "Annex"
801 Ada.Text_IO.Put_Line (Output_Object.Output_File,
802 Header_Text);
803 when ARM_Contents.Normative_Annex =>
804 Ada.Text_IO.Put_Line (Output_Object.Output_File,
805 Clause_Number); -- Note: Clause_Number includes "Annex"
806 Ada.Text_IO.Put_Line (Output_Object.Output_File,
807 "(normative)");
808 Ada.Text_IO.New_Line (Output_Object.Output_File);
809 Ada.Text_IO.Put_Line (Output_Object.Output_File,
810 Header_Text);
811 when ARM_Contents.Informative_Annex =>
812 Ada.Text_IO.Put_Line (Output_Object.Output_File,
813 Clause_Number); -- Note: Clause_Number includes "Annex"
814 Ada.Text_IO.Put_Line (Output_Object.Output_File,
815 "(informative)");
816 Ada.Text_IO.New_Line (Output_Object.Output_File);
817 Ada.Text_IO.Put_Line (Output_Object.Output_File,
818 Header_Text);
819 when ARM_Contents.Section =>
820 case Top_Level_Subdivision_Name is
821 when ARM_Output.Chapter =>
822 Ada.Text_IO.Put_Line (Output_Object.Output_File,
823 "Chapter " & Clause_Number & ": " & Header_Text);
824 when ARM_Output.Section =>
825 Ada.Text_IO.Put_Line (Output_Object.Output_File,
826 "Section " & Clause_Number & ": " & Header_Text);
827 when ARM_Output.Clause =>
828 Ada.Text_IO.Put_Line (Output_Object.Output_File,
829 Clause_Number & " " & Header_Text);
830 end case;
831
832 when ARM_Contents.Unnumbered_Section =>
833 if Header_Text /= "" then
834 Ada.Text_IO.Put_Line (Output_Object.Output_File,
835 Header_Text);
836 end if;
837 when ARM_Contents.Clause | ARM_Contents.Subclause |
838 ARM_Contents.Subsubclause =>
839 Ada.Text_IO.Put_Line (Output_Object.Output_File,
840 Clause_Number & ' ' & Header_Text);
841 when ARM_Contents.Dead_Clause =>
842 raise Program_Error; -- No headers for dead clauses.
843 end case;
844 Ada.Text_IO.New_Line (Output_Object.Output_File, 2);
845 Output_Object.Char_Count := 0;
846 Output_Object.Out_Char_Count := 0;
847 -- We don't have any page breaks here to suppress.
848 end Revised_Clause_Header;
849
850
851 procedure TOC_Marker (Output_Object : in out Corr_Output_Type;
852 For_Start : in Boolean) is
853 -- Mark the start (if For_Start is True) or end (if For_Start is
854 -- False) of the table of contents data. Output objects that
855 -- auto-generate the table of contents can use this to do needed
856 -- actions.
857 begin
858 if not Output_Object.Is_Valid then
859 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
860 "Not valid object");
861 end if;
862 null; -- We don't care about this.
863 end TOC_Marker;
864
865
866 procedure New_Page (Output_Object : in out Corr_Output_Type;
867 Kind : ARM_Output.Page_Kind_Type := ARM_Output.Any_Page) is
868 -- Output a page break.
869 -- Note that this has no effect on non-printing formats.
870 -- Any_Page breaks to the top of the next page (whatever it is);
871 -- Odd_Page_Only breaks to the top of the odd-numbered page;
872 -- Soft_Page allows a page break but does not force one (use in
873 -- "No_Breaks" paragraphs.)
874 -- Raises Not_Valid_Error if in a paragraph if Kind = Any_Page or
875 -- Odd_Page, and if not in a paragraph if Kind = Soft_Page.
876 begin
877 if not Output_Object.Is_Valid then
878 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
879 "Not valid object");
880 end if;
881 case Kind is
882 when ARM_Output.Any_Page | ARM_Output.Odd_Page_Only =>
883 if Output_Object.Is_In_Paragraph then
884 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
885 "Page in paragraph");
886 end if;
887 Ada.Text_IO.New_Line (Output_Object.Output_File, 2);
888 when ARM_Output.Soft_Page =>
889 if not Output_Object.Is_In_Paragraph then
890 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
891 "Soft page not in paragraph");
892 end if;
893 null; -- No page breaks.
894 Spill (Output_Object);
895 end case;
896 end New_Page;
897
898
899 procedure New_Column (Output_Object : in out Corr_Output_Type) is
900 -- Output a column break.
901 -- Raises Not_Valid_Error if in a paragraph, or if the number of
902 -- columns is 1.
903 begin
904 if not Output_Object.Is_Valid then
905 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
906 "Not valid object");
907 end if;
908 if Output_Object.Is_In_Paragraph then
909 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
910 "New column in paragraph");
911 end if;
912 -- No columns in text format.
913 Ada.Text_IO.New_Line (Output_Object.Output_File);
914 end New_Column;
915
916
917 procedure Start_Table (Output_Object : in out Corr_Output_Type;
918 Columns : in ARM_Output.Column_Count;
919 First_Column_Width : in ARM_Output.Column_Count;
920 Last_Column_Width : in ARM_Output.Column_Count;
921 Alignment : in ARM_Output.Column_Text_Alignment;
922 No_Page_Break : in Boolean;
923 Has_Border : in Boolean;
924 Small_Text_Size : in Boolean;
925 Header_Kind : in ARM_Output.Header_Kind_Type) is
926 -- Starts a table. The number of columns is Columns; the first
927 -- column has First_Column_Width times the normal column width, and
928 -- the last column has Last_Column_Width times the normal column width.
929 -- Alignment is the horizontal text alignment within the columns.
930 -- No_Page_Break should be True to keep the table intact on a single
931 -- page; False to allow it to be split across pages.
932 -- Has_Border should be true if a border is desired, false otherwise.
933 -- Small_Text_Size means that the contents will have the AARM size;
934 -- otherwise it will have the normal size.
935 -- Header_Kind determines whether the table has headers.
936 -- This command starts a paragraph; the entire table is a single
937 -- paragraph. Text will be considered part of the caption until the
938 -- next table marker call.
939 -- Raises Not_Valid_Error if in a paragraph.
940 begin
941 -- Alignment, No_Page_Break, Border, Small_Text_Size, and Header_Kind
942 -- not used here.
943 if not Output_Object.Is_Valid then
944 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
945 "Not valid object");
946 end if;
947 if Output_Object.Is_In_Paragraph then
948 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
949 "Table in paragraph");
950 end if;
951
952 Output_Object.Tab_Stops.Number := Columns;
953 declare
954 Column_Units : constant ARM_Output.Column_Count :=
955 Columns+First_Column_Width+Last_Column_Width-2;
956 Width : Natural :=
957 (72/(Column_Units));
958 begin
959 if Column_Units <= 3 then -- Keep it from getting too wide.
960 Width := 22;
961 end if;
962 for I in 1 .. Columns loop
963 Output_Object.Tab_Stops.Stops(I) := (Kind => ARM_Output.Left_Fixed,
964 Stop => Width*(I+First_Column_Width-1)+10);
965 end loop;
966 end;
967
968 Output_Object.Indent_Amount := 10;
969 Ada.Text_IO.Put (Output_Object.Output_File, " ");
970 Output_Object.Char_Count := 10;
971 Output_Object.Out_Char_Count := 10;
972
973 Output_Object.Is_In_Paragraph := True;
974 Output_Object.Is_In_Table := True;
975 end Start_Table;
976
977
978 procedure Table_Marker (Output_Object : in out Corr_Output_Type;
979 Marker : in ARM_Output.Table_Marker_Type) is
980 -- Marks the end of an entity in a table.
981 -- If Marker is End_Caption, the table caption ends and the
982 -- future text is part of the table header.
983 -- If Marker is End_Header, the table header ends and the
984 -- future text is part of the table body.
985 -- If Marker is End_Row, a row in the table is completed, and another
986 -- row started.
987 -- If Marker is End_Row_Next_Is_Last, a row in the table is completed,
988 -- and another row started. That row is the last row in the table.
989 -- If Marker is End_Item, an item in the table header or body is ended,
990 -- and another started.
991 -- If Marker is End_Table, the entire table is finished.
992 -- Raises Not_Valid_Error if not in a table.
993 begin
994 if not Output_Object.Is_Valid then
995 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
996 "Not valid object");
997 end if;
998 if (not Output_Object.Is_In_Paragraph) or (not Output_Object.Is_In_Table) then
999 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
1000 "Table marker not in table");
1001 end if;
1002 case Marker is
1003 when ARM_Output.End_Item =>
1004 -- Just tab over one row:
1005 Spill (Output_Object);
1006 Ada.Text_IO.Put_Line (Output_Object.Output_File, " ");
1007 Output_Object.Char_Count := Output_Object.Char_Count + 1;
1008 Output_Object.Out_Char_Count := Output_Object.Out_Char_Count + 1;
1009 for I in 1 .. Output_Object.Tab_Stops.Number loop
1010 if Output_Object.Tab_Stops.Stops(I).Stop > Output_Object.Char_Count then
1011 for J in Output_Object.Char_Count+1 .. Output_Object.Tab_Stops.Stops(I).Stop-1 loop
1012 Ada.Text_IO.Put_Line (Output_Object.Output_File, " ");
1013 Output_Object.Char_Count := Output_Object.Char_Count + 1;
1014 Output_Object.Out_Char_Count := Output_Object.Out_Char_Count + 1;
1015 end loop;
1016 end if;
1017 end loop;
1018
1019 when ARM_Output.End_Caption =>
1020 Spill (Output_Object);
1021 Ada.Text_IO.New_Line (Output_Object.Output_File, 2);
1022 Ada.Text_IO.Put (Output_Object.Output_File, " ");
1023 Output_Object.Char_Count := 10;
1024 Output_Object.Out_Char_Count := 10;
1025 when ARM_Output.End_Header =>
1026 Spill (Output_Object);
1027 Ada.Text_IO.New_Line (Output_Object.Output_File, 2);
1028 Ada.Text_IO.Put (Output_Object.Output_File, " ");
1029 Output_Object.Char_Count := 10;
1030 Output_Object.Out_Char_Count := 10;
1031 when ARM_Output.End_Row | ARM_Output.End_Row_Next_Is_Last =>
1032 Spill (Output_Object);
1033 Ada.Text_IO.New_Line (Output_Object.Output_File, 1);
1034 Ada.Text_IO.Put (Output_Object.Output_File, " ");
1035 Output_Object.Char_Count := 10;
1036 Output_Object.Out_Char_Count := 10;
1037 when ARM_Output.End_Table =>
1038 Spill (Output_Object);
1039 Output_Object.Is_In_Paragraph := False;
1040 Output_Object.Is_In_Table := False;
1041 Ada.Text_IO.New_Line (Output_Object.Output_File);
1042 Output_Object.Tab_Stops := ARM_Output.NO_TABS;
1043 end case;
1044 end Table_Marker;
1045
1046
1047 procedure Separator_Line (Output_Object : in out Corr_Output_Type;
1048 Is_Thin : Boolean := True) is
1049 -- Output a separator line. It is thin if "Is_Thin" is true.
1050 -- Raises Not_Valid_Error if in a paragraph.
1051 begin
1052 if not Output_Object.Is_Valid then
1053 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
1054 "Not valid object");
1055 end if;
1056 if Output_Object.Is_In_Paragraph then
1057 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
1058 "Separator in paragraph");
1059 end if;
1060 Ada.Text_IO.New_Line (Output_Object.Output_File);
1061 if Is_Thin then
1062 Ada.Text_IO.Put_Line (Output_Object.Output_File, "---------------------------------------------------------------------");
1063 else
1064 Ada.Text_IO.Put_Line (Output_Object.Output_File, "=====================================================================");
1065 end if;
1066 Ada.Text_IO.New_Line (Output_Object.Output_File);
1067 end Separator_Line;
1068
1069
1070 -- Text output: These are only allowed after a Start_Paragraph and
1071 -- before any End_Paragraph. Raises Not_Valid_Error if not allowed.
1072
1073 procedure Ordinary_Text (Output_Object : in out Corr_Output_Type;
1074 Text : in String) is
1075 -- Output ordinary text.
1076 -- The text must end at a word break, never in the middle of a word.
1077 begin
1078 if not Output_Object.Is_Valid then
1079 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
1080 "Not valid object");
1081 end if;
1082 if not Output_Object.Is_In_Paragraph then
1083 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
1084 "Not in paragraph");
1085 end if;
1086 --Ada.Text_IO.Put_Line ("Ordinary_Text: Cnt=" & Natural'Image(Output_Object.Char_Count) &
1087 --" Buffer=" & Natural'Image(Output_Object.Output_Buffer_Len));
1088 if Output_Object.Char_Count + Text'Length >= LINE_LENGTH - 2 and then
1089 Output_Object.Out_Char_Count > Output_Object.Indent_Amount then
1090 -- We want a line break here if the line is too long and something was output:
1091 Ada.Text_IO.New_Line (Output_Object.Output_File);
1092 Make_Indent (Output_Object);
1093 --Output_Object.Output_Buffer_Space_Before := False;
1094 -- Start of line, this is done by Make_Indent.
1095 Spill (Output_Object);
1096 else
1097 Spill (Output_Object);
1098 end if;
1099 if Ada.Strings.Fixed.Count (Text, Special_Set) = 0 then
1100 Ada.Text_IO.Put (Output_Object.Output_File, Text);
1101 Output_Object.Char_Count := Output_Object.Char_Count + Text'Length;
1102 Output_Object.Out_Char_Count := Output_Object.Out_Char_Count + Text'Length;
1103 else
1104 for I in Text'Range loop
1105 if Text(I) = '>' then
1106 Ada.Text_IO.Put (Output_Object.Output_File, "@>");
1107 Output_Object.Char_Count := Output_Object.Char_Count + 2;
1108 Output_Object.Out_Char_Count := Output_Object.Out_Char_Count + 2;
1109 elsif Text(I) = '@' then
1110 Ada.Text_IO.Put (Output_Object.Output_File, "@@");
1111 Output_Object.Char_Count := Output_Object.Char_Count + 2;
1112 Output_Object.Out_Char_Count := Output_Object.Out_Char_Count + 2;
1113 else
1114 Ada.Text_IO.Put (Output_Object.Output_File, Text(I));
1115 Output_Object.Char_Count := Output_Object.Char_Count + 1;
1116 Output_Object.Out_Char_Count := Output_Object.Out_Char_Count + 1;
1117 end if;
1118 end loop;
1119 end if;
1120 Output_Object.Output_Buffer_Space_Before := False; -- No space between
1121 -- this and any following text.
1122 end Ordinary_Text;
1123
1124
1125 procedure Ordinary_Character (Output_Object : in out Corr_Output_Type;
1126 Char : in Character) is
1127 -- Output an ordinary character.
1128 -- Spaces will be used to break lines as needed.
1129 begin
1130 if not Output_Object.Is_Valid then
1131 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
1132 "Not valid object");
1133 end if;
1134 if not Output_Object.Is_In_Paragraph then
1135 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
1136 "Not in paragraph");
1137 end if;
1138
1139 if Output_Object.Char_Count >= LINE_LENGTH and then
1140 Output_Object.Out_Char_Count > Output_Object.Indent_Amount then
1141 -- Insert a break here if anything has been output (but don't
1142 -- Spill the buffer):
1143 --Ada.Text_IO.Put_Line ("Ordinary_Char [Break, no spill]: Cnt=" & Natural'Image(Output_Object.Char_Count));
1144 Ada.Text_IO.New_Line (Output_Object.Output_File);
1145 Make_Indent (Output_Object);
1146 --Output_Object.Output_Buffer_Space_Before := False;
1147 -- Start of line, this is done by Make_Indent.
1148 -- Note that this may make the space disappear.
1149 -- Add the contents of the buffer to the character count for this line:
1150 Output_Object.Char_Count := Output_Object.Char_Count +
1151 Output_Object.Output_Buffer_Len;
1152 if Char = '>' then
1153 Buffer (Output_Object, "@>");
1154 elsif Char = '@' then
1155 Buffer (Output_Object, "@@");
1156 elsif Char /= ' ' then
1157 Buffer (Output_Object, Char);
1158 else -- Break character, spill on the new line:
1159 if Output_Object.Output_Buffer_Len /= 0 then
1160 Spill (Output_Object); -- Output the buffer up to the space.
1161 Output_Object.Output_Buffer_Space_Before := True; -- Mid-line now.
1162 -- else nothing in buffer, so nothing to output; just skip it.
1163 end if;
1164 end if;
1165 elsif Char = ' ' then
1166 -- Break character, and it fits on this line:
1167 if Output_Object.Output_Buffer_Len /= 0 then
1168 --Ada.Text_IO.Put_Line ("Ordinary_Char [Space spill]: Cnt=" & Natural'Image(Output_Object.Char_Count));
1169 Spill (Output_Object); -- Output the buffer up to the space.
1170 Output_Object.Output_Buffer_Space_Before := True; -- Mid-line now.
1171 else -- nothing in buffer.
1172 -- nothing to output. But make sure we display a space before
1173 -- the next item.
1174 Output_Object.Output_Buffer_Space_Before := True; -- Mid-line now.
1175 end if;
1176 elsif Char = '>' then
1177 Buffer (Output_Object, "@>");
1178 elsif Char = '@' then
1179 Buffer (Output_Object, "@@");
1180 else
1181 Buffer (Output_Object, Char);
1182 end if;
1183 end Ordinary_Character;
1184
1185
1186 procedure Hard_Space (Output_Object : in out Corr_Output_Type) is
1187 -- Output a hard space. No line break should happen at a hard space.
1188 begin
1189 if not Output_Object.Is_Valid then
1190 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
1191 "Not valid object");
1192 end if;
1193 if not Output_Object.Is_In_Paragraph then
1194 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
1195 "Not in paragraph");
1196 end if;
1197 if Output_Object.Is_Fixed_Format then
1198 -- In this format, all spaces are hard spaces.
1199 Buffer (Output_Object, ' ');
1200 else -- A hard space command.
1201 Buffer (Output_Object, "@ ");
1202 end if;
1203 end Hard_Space;
1204
1205
1206 procedure Line_Break (Output_Object : in out Corr_Output_Type) is
1207 -- Output a line break. This does not start a new paragraph.
1208 -- This corresponds to a "<BR>" in HTML.
1209 begin
1210 if not Output_Object.Is_Valid then
1211 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
1212 "Not valid object");
1213 end if;
1214 if not Output_Object.Is_In_Paragraph then
1215 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
1216 "Not in paragraph");
1217 end if;
1218 --Ada.Text_Io.Put_Line ("Line_Break");
1219 if Output_Object.Is_Fixed_Format then
1220 -- In this format, all line breaks are significant.
1221 null;
1222 else -- A hard space command.
1223 Buffer (Output_Object, "@hr");
1224 end if;
1225 if Output_Object.Output_Buffer_Len /= 0 then
1226 Spill (Output_Object);
1227 end if;
1228 Ada.Text_IO.New_Line (Output_Object.Output_File);
1229 Make_Indent (Output_Object);
1230 end Line_Break;
1231
1232
1233 procedure Index_Line_Break (Output_Object : in out Corr_Output_Type;
1234 Clear_Keep_with_Next : in Boolean) is
1235 -- Output a line break for the index. This does not start a new
1236 -- paragraph in terms of spacing. This corresponds to a "<BR>"
1237 -- in HTML. If Clear_Keep_with_Next is true, insure that the next
1238 -- line does not require the following line to stay with it.
1239 -- Raises Not_Valid_Error if the paragraph is not in the index format.
1240 begin
1241 Line_Break (Output_Object);
1242 end Index_Line_Break;
1243
1244
1245 procedure Soft_Line_Break (Output_Object : in out Corr_Output_Type) is
1246 -- Output a soft line break. This is a place (in the middle of a
1247 -- "word") that we allow a line break. It is usually used after
1248 -- underscores in long non-terminals.
1249 begin
1250 if not Output_Object.Is_Valid then
1251 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
1252 "Not valid object");
1253 end if;
1254 if not Output_Object.Is_In_Paragraph then
1255 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
1256 "Not in paragraph");
1257 end if;
1258 -- if Output_Object.Char_Count >= LINE_LENGTH - 10 then
1259 -- if Output_Object.Output_Buffer_Len /= 0 then
1260 -- Spill (Output_Object);
1261 -- end if;
1262 -- Ada.Text_IO.New_Line (Output_Object.Output_File);
1263 -- Make_Indent (Output_Object);
1264 -- -- else we don't need a line break.
1265 -- end if;
1266 null; -- Ignore this, there is no counterpart in Corrigendum formatting.
1267 end Soft_Line_Break;
1268
1269
1270 procedure Soft_Hyphen_Break (Output_Object : in out Corr_Output_Type) is
1271 -- Output a soft line break, with a hyphen. This is a place (in the middle of
1272 -- a "word") that we allow a line break. If the line break is used,
1273 -- a hyphen will be added to the text.
1274 begin
1275 if not Output_Object.Is_Valid then
1276 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
1277 "Not valid object");
1278 end if;
1279 if not Output_Object.Is_In_Paragraph then
1280 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
1281 "Not in paragraph");
1282 end if;
1283 -- if Output_Object.Char_Count >= LINE_LENGTH - 8 then
1284 -- Spill (Output_Object);
1285 -- Ada.Text_IO.Put_Line (Output_Object.Output_File, "-"); -- Add the hyphen and break.
1286 -- Make_Indent (Output_Object);
1287 -- -- else we don't need a line break.
1288 -- end if;
1289 null; -- Ignore this, there is no counterpart in Corrigendum formatting.
1290 end Soft_Hyphen_Break;
1291
1292
1293 procedure Tab (Output_Object : in out Corr_Output_Type) is
1294 -- Output a tab, inserting space up to the next tab stop.
1295 -- Raises Not_Valid_Error if the paragraph was created with
1296 -- Tab_Stops = ARM_Output.NO_TABS.
1297 begin
1298 if not Output_Object.Is_Valid then
1299 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
1300 "Not valid object");
1301 end if;
1302 if not Output_Object.Is_In_Paragraph then
1303 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
1304 "Not in paragraph");
1305 end if;
1306 if ARM_Output."="(Output_Object.Tab_Stops, ARM_Output.NO_TABS) then
1307 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
1308 "Tab, but none set");
1309 end if;
1310 -- We use the tab stops as characters here, and fixed and proportional
1311 -- stops are treated identically.
1312 -- Find the first stop greater than the current character count. (After
1313 -- writing a space).
1314 --Ada.Text_IO.Put_Line ("Tab");
1315 Buffer (Output_Object, "@tab");
1316 Output_Object.Output_Buffer_Space_Before := False; -- Spaces needed were output.
1317 end Tab;
1318
1319
1320 procedure Special_Character (Output_Object : in out Corr_Output_Type;
1321 Char : in ARM_Output.Special_Character_Type) is
1322 -- Output an special character.
1323 begin
1324 --** Could use Latin1 and Unicode equivalents for most of these.
1325 case Char is
1326 when ARM_Output.EM_Dash =>
1327 Buffer (Output_Object, "@emdash");
1328 when ARM_Output.EN_Dash =>
1329 Buffer (Output_Object, "@endash");
1330 when ARM_Output.GEQ =>
1331 Ordinary_Text (Output_Object, ">="); -- Not available in Corrigendum, use the Ada one.
1332 when ARM_Output.LEQ =>
1333 Ordinary_Text (Output_Object, "<="); -- Not available in Corrigendum, use the Ada one.
1334 when ARM_Output.NEQ =>
1335 Ordinary_Text (Output_Object, "/="); -- Not available in Corrigendum, use the Ada one.
1336 when ARM_Output.PI =>
1337 Buffer (Output_Object, "@pi");
1338 when ARM_Output.Left_Ceiling =>
1339 Ordinary_Text (Output_Object, "Ceiling("); -- Not available in Corrigendum.
1340 when ARM_Output.Right_Ceiling =>
1341 Ordinary_Text (Output_Object, ")"); -- Not available in Corrigendum.
1342 when ARM_Output.Left_Floor =>
1343 Ordinary_Text (Output_Object, "Floor("); -- Not available in Corrigendum.
1344 when ARM_Output.Right_Floor =>
1345 Ordinary_Text (Output_Object, ")"); -- Not available in Corrigendum.
1346 when ARM_Output.Thin_Space =>
1347 Ordinary_Text (Output_Object, " "); -- Not available in Corrigendum.
1348 when ARM_Output.Left_Quote =>
1349 Buffer (Output_Object, "@lquote");
1350 when ARM_Output.Right_Quote =>
1351 Buffer (Output_Object, "@rquote");
1352 when ARM_Output.Left_Double_Quote =>
1353 Ordinary_Text (Output_Object, """"); -- Not available in Corrigendum, use double quote.
1354 when ARM_Output.Right_Double_Quote =>
1355 Ordinary_Text (Output_Object, """"); -- Not available in Corrigendum, use double quote.
1356 when ARM_Output.Small_Dotless_I =>
1357 Ordinary_Text (Output_Object, "i"); -- Not available in Corrigendum, use the nearest text.
1358 when ARM_Output.Capital_Dotted_I =>
1359 Ordinary_Text (Output_Object, "I"); -- Not available in Corrigendum, use the nearest text.
1360 end case;
1361 end Special_Character;
1362
1363
1364 procedure Unicode_Character (Output_Object : in out Corr_Output_Type;
1365 Char : in ARM_Output.Unicode_Type) is
1366 -- Output a Unicode character, with code position Char.
1367 Char_Code : constant String := ARM_Output.Unicode_Type'Image(Char);
1368 begin
1369 -- We don't check, but we assume this is not a normal character.
1370 Buffer (Output_Object, "@unicode<" & Char_Code(2..Char_Code'Last) & ">");
1371 end Unicode_Character;
1372
1373
1374 procedure End_Hang_Item (Output_Object : in out Corr_Output_Type) is
1375 -- Marks the end of a hanging item. Call only once per paragraph.
1376 -- Raises Not_Valid_Error if the paragraph style is not in
1377 -- Text_Prefixed_Style_Subtype, or if this has already been
1378 -- called for the current paragraph, or if the paragraph was started
1379 -- with No_Prefix = True.
1380 begin
1381 if not Output_Object.Is_Valid then
1382 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
1383 "Not valid object");
1384 end if;
1385 if not Output_Object.Is_In_Paragraph then
1386 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
1387 "Not in paragraph");
1388 end if;
1389 if not Output_Object.Is_Hanging then
1390 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
1391 "Not a hanging paragraph");
1392 end if;
1393 if Output_Object.Saw_Hang_End then
1394 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
1395 "Already saw the end of the hanging part");
1396 end if;
1397 Output_Object.Saw_Hang_End := True;
1398
1399 Buffer (Output_Object, ">"); -- Close @Xterm<
1400 end End_Hang_Item;
1401
1402
1403 procedure Text_Format (Output_Object : in out Corr_Output_Type;
1404 Format : in ARM_Output.Format_Type) is
1405 -- Change the text format so that all of the properties are as specified.
1406 -- Note: Changes to these properties ought be stack-like; that is,
1407 -- Bold on, Italic on, Italic off, Bold off is OK; Bold on, Italic on,
1408 -- Bold off, Italic off should be avoided (as separate commands).
1409 use type ARM_Output.Change_Type;
1410 use type ARM_Output.Location_Type;
1411 use type ARM_Output.Size_Type;
1412 -- Note: We ignore colors here, no colors in !Corrigendum markup.
1413 begin
1414 if not Output_Object.Is_Valid then
1415 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
1416 "Not valid object");
1417 end if;
1418 if not Output_Object.Is_In_Paragraph then
1419 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
1420 "Not in paragraph");
1421 end if;
1422
1423 if not Format.Bold and Output_Object.Is_Bold then
1424 Buffer (Output_Object, '>');
1425 Output_Object.Is_Bold := False;
1426 end if;
1427
1428 if not Format.Italic and Output_Object.Is_Italic then
1429 Buffer (Output_Object, '>');
1430 Output_Object.Is_Italic := False;
1431 end if;
1432
1433 if Format.Size /= Output_Object.Size then
1434 if Output_Object.Size /= 0 then
1435 Buffer (Output_Object, '>');
1436 end if;
1437 end if;
1438
1439 -- if Format.Location /= Output_Object.Location then
1440 -- if Output_Object.Location /= ARM_Output.Normal then
1441 -- --Buffer (Output_Object, '>');
1442 -- null; -- Corrigendum doesn't support this.
1443 -- end if;
1444 -- end if;
1445
1446 if ARM_Output."/=" (Format.Font, Output_Object.Font) then
1447 case Output_Object.Font is
1448 when ARM_Output.Default => null;
1449 when ARM_Output.Fixed =>
1450 Buffer (Output_Object, '>');
1451 when ARM_Output.Roman =>
1452 Buffer (Output_Object, '>');
1453 when ARM_Output.Swiss =>
1454 Buffer (Output_Object, '>');
1455 end case;
1456 end if;
1457
1458 -- For the intended purpose, there should be no Change commands.
1459 if Format.Change /= Output_Object.Change then
1460 if Format.Change = ARM_Output.Both then
1461 -- Open only the one(s) needed:
1462 case Output_Object.Change is
1463 -- Note: Version is not used.
1464 when ARM_Output.Insertion =>
1465 -- Open the deletion:
1466 Buffer(Output_Object, '[');
1467 when ARM_Output.Deletion =>
1468 -- Open the insertion:
1469 Buffer(Output_Object, '{');
1470 when ARM_Output.None =>
1471 Buffer(Output_Object, '{');
1472 Buffer(Output_Object, '[');
1473 when ARM_Output.Both =>
1474 null;
1475 end case;
1476 elsif Output_Object.Change = ARM_Output.Both then
1477 -- Close only the one(s) needed:
1478 case Format.Change is
1479 -- Note: Version is not used.
1480 when ARM_Output.Insertion =>
1481 -- Close the deletion:
1482 Buffer(Output_Object, ']');
1483 when ARM_Output.Deletion =>
1484 -- Close the insertion:
1485 Buffer(Output_Object, '}');
1486 when ARM_Output.None =>
1487 Buffer(Output_Object, ']');
1488 Buffer(Output_Object, '}');
1489 when ARM_Output.Both =>
1490 null;
1491 end case;
1492 else -- Both can't get here.
1493 case Output_Object.Change is
1494 when ARM_Output.Insertion =>
1495 Buffer(Output_Object, '}');
1496 when ARM_Output.Deletion =>
1497 Buffer(Output_Object, ']');
1498 when ARM_Output.None =>
1499 null;
1500 when ARM_Output.Both =>
1501 Buffer(Output_Object, ']');
1502 Buffer(Output_Object, '}');
1503 end case;
1504 case Format.Change is
1505 -- Note: Version is not used.
1506 when ARM_Output.Insertion =>
1507 Buffer(Output_Object, '{');
1508 when ARM_Output.Deletion =>
1509 Buffer(Output_Object, '[');
1510 when ARM_Output.None =>
1511 null;
1512 when ARM_Output.Both =>
1513 Buffer(Output_Object, '{');
1514 Buffer(Output_Object, '[');
1515 end case;
1516 end if;
1517 Output_Object.Change := Format.Change;
1518 end if;
1519 if ARM_Output."/=" (Format.Font, Output_Object.Font) then
1520 case Format.Font is
1521 when ARM_Output.Default => null;
1522 when ARM_Output.Fixed =>
1523 Buffer (Output_Object, "@fc<");
1524 when ARM_Output.Roman =>
1525 Buffer (Output_Object, "@ft<");
1526 when ARM_Output.Swiss =>
1527 Buffer (Output_Object, "@fa<");
1528 end case;
1529 Output_Object.Font := Format.Font;
1530 end if;
1531
1532 if Format.Location /= Output_Object.Location then
1533 case Format.Location is
1534 when ARM_Output.Superscript =>
1535 --Buffer (Output_Object, "@+<");
1536 null; -- Corrigendum doesn't support this.
1537 when ARM_Output.Subscript =>
1538 --Buffer (Output_Object, "@+<");
1539 null; -- Corrigendum doesn't support this.
1540 when ARM_Output.Normal =>
1541 null;
1542 end case;
1543 Output_Object.Location := Format.Location;
1544 end if;
1545
1546 if Format.Size /= Output_Object.Size then
1547 if Format.Size < 0 then
1548 Buffer (Output_Object, "@s" & Character'Val(10+Format.Size+Character'Pos('0')) & '<');
1549 else
1550 Buffer (Output_Object, "@s1" & Character'Val(Format.Size+Character'Pos('0')) & '<');
1551 end if;
1552 Output_Object.Size := Format.Size;
1553 end if;
1554
1555 if Format.Italic and (not Output_Object.Is_Italic) then
1556 Buffer (Output_Object, "@i<");
1557 Output_Object.Is_Italic := True;
1558 end if;
1559 if Format.Bold and (not Output_Object.Is_Bold) then
1560 Buffer (Output_Object, "@b<");
1561 Output_Object.Is_Bold := True;
1562 end if;
1563
1564 end Text_Format;
1565
1566
1567 procedure Clause_Reference (Output_Object : in out Corr_Output_Type;
1568 Text : in String;
1569 Clause_Number : in String) is
1570 -- Generate a reference to a clause in the standard. The text of
1571 -- the reference is "Text", and the number of the clause is
1572 -- Clause_Number. For hyperlinked formats, this should generate
1573 -- a link; for other formats, the text alone is generated.
1574 begin
1575 Ordinary_Text (Output_Object, Text); -- Nothing special in this format.
1576 end Clause_Reference;
1577
1578
1579 procedure Index_Target (Output_Object : in out Corr_Output_Type;
1580 Index_Key : in Natural) is
1581 -- Generate a index target. This marks the location where an index
1582 -- reference occurs. Index_Key names the index item involved.
1583 -- For hyperlinked formats, this should generate a link target;
1584 -- for other formats, nothing is generated.
1585 begin
1586 if not Output_Object.Is_Valid then
1587 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
1588 "Not valid object");
1589 end if;
1590 if not Output_Object.Is_In_Paragraph then
1591 Ada.Exceptions.Raise_Exception (ARM_Output.Not_Valid_Error'Identity,
1592 "Not in paragraph");
1593 end if;
1594 null; -- Nothing to do for plain text.
1595 end Index_Target;
1596
1597
1598 procedure Index_Reference (Output_Object : in out Corr_Output_Type;
1599 Text : in String;
1600 Index_Key : in Natural;
1601 Clause_Number : in String) is
1602 -- Generate a reference to an index target in the standard. The text
1603 -- of the reference is "Text", and Index_Key and Clause_Number denotes
1604 -- the target. For hyperlinked formats, this should generate
1605 -- a link; for other formats, the text alone is generated.
1606 begin
1607 Ordinary_Text (Output_Object, Text); -- Nothing special in this format.
1608 end Index_Reference;
1609
1610
1611 procedure DR_Reference (Output_Object : in out Corr_Output_Type;
1612 Text : in String;
1613 DR_Number : in String) is
1614 -- Generate a reference to an DR from the standard. The text
1615 -- of the reference is "Text", and DR_Number denotes
1616 -- the target. For hyperlinked formats, this should generate
1617 -- a link; for other formats, the text alone is generated.
1618 begin
1619 Ordinary_Text (Output_Object, Text); -- Nothing special in this format.
1620 end DR_Reference;
1621
1622
1623 procedure AI_Reference (Output_Object : in out Corr_Output_Type;
1624 Text : in String;
1625 AI_Number : in String) is
1626 -- Generate a reference to an AI from the standard. The text
1627 -- of the reference is "Text", and AI_Number denotes
1628 -- the target (in unfolded format). For hyperlinked formats, this
1629 -- should generate a link; for other formats, the text alone is
1630 -- generated.
1631 begin
1632 Ordinary_Text (Output_Object, Text); -- Nothing special in this format.
1633 end AI_Reference;
1634
1635
1636 procedure Local_Target (Output_Object : in out Corr_Output_Type;
1637 Text : in String;
1638 Target : in String) is
1639 -- Generate a local target. This marks the potential target of local
1640 -- links identified by "Target". Text is the text of the target.
1641 -- For hyperlinked formats, this should generate a link target;
1642 -- for other formats, only the text is generated.
1643 begin
1644 Ordinary_Text (Output_Object, Text); -- Nothing special in this format.
1645 end Local_Target;
1646
1647
1648 procedure Local_Link (Output_Object : in out Corr_Output_Type;
1649 Text : in String;
1650 Target : in String;
1651 Clause_Number : in String) is
1652 -- Generate a local link to the target and clause given.
1653 -- Text is the text of the link.
1654 -- For hyperlinked formats, this should generate a link;
1655 -- for other formats, only the text is generated.
1656 begin
1657 Ordinary_Text (Output_Object, Text); -- Nothing special in this format.
1658 end Local_Link;
1659
1660
1661 procedure Local_Link_Start (Output_Object : in out Corr_Output_Type;
1662 Target : in String;
1663 Clause_Number : in String) is
1664 -- Generate a local link to the target and clause given.
1665 -- The link will surround text until Local_Link_End is called.
1666 -- Local_Link_End must be called before this routine can be used again.
1667 -- For hyperlinked formats, this should generate a link;
1668 -- for other formats, only the text is generated.
1669 begin
1670 null; -- No link, nothing to do.
1671 end Local_Link_Start;
1672
1673
1674 procedure Local_Link_End (Output_Object : in out Corr_Output_Type;
1675 Target : in String;
1676 Clause_Number : in String) is
1677 -- End a local link for the target and clause given.
1678 -- This must be in the same paragraph as the Local_Link_Start.
1679 -- For hyperlinked formats, this should generate a link;
1680 -- for other formats, only the text is generated.
1681 begin
1682 null; -- No link, nothing to do.
1683 end Local_Link_End;
1684
1685
1686 procedure URL_Link (Output_Object : in out Corr_Output_Type;
1687 Text : in String;
1688 URL : in String) is
1689 -- Generate a link to the URL given.
1690 -- Text is the text of the link.
1691 -- For hyperlinked formats, this should generate a link;
1692 -- for other formats, only the text is generated.
1693 begin
1694 Ordinary_Text (Output_Object, Text); -- Nothing special in this format.
1695 end URL_Link;
1696
1697
1698 procedure Picture (Output_Object : in out Corr_Output_Type;
1699 Name : in String;
1700 Descr : in String;
1701 Alignment : in ARM_Output.Picture_Alignment;
1702 Height, Width : in Natural;
1703 Border : in ARM_Output.Border_Kind) is
1704 -- Generate a picture.
1705 -- Name is the (simple) file name of the picture; Descr is a
1706 -- descriptive name for the picture (it will appear in some web
1707 -- browsers).
1708 -- We assume that it is a .GIF or .JPG and that it will be present
1709 -- in the same directory as the input files and the same directory as
1710 -- the .HTML output files.
1711 -- Alignment specifies the picture alignment.
1712 -- Height and Width specify the picture size in pixels.
1713 -- Border specifies the kind of border.
1714 begin
1715 Ordinary_Text (Output_Object, "[Picture: " & Name &
1716 " - " & Descr & "]");
1717 end Picture;
1718
1719 end ARM_Corr;