1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304
|
with Ada.Text_IO;
with Ada.Unchecked_Deallocation;
with ARM_Output;
with ARM_Contents;
package ARM_Texinfo is
--
-- Ada reference manual formatter.
--
-- This package defines the TEXINFO output object.
-- Output objects are responsible for implementing the details of
-- a particular format.
--
-- ---------------------------------------
--
-- Copyright (C) 2003, 2007, 2011, 2013 Stephen Leake. All Rights Reserved.
-- E-Mail: stephen_leake@stephe-leake.org
--
-- This library is free software; you can redistribute it and/or
-- modify it under terms of the GNU General Public License as
-- published by the Free Software Foundation; either version 3, or (at
-- your option) any later version. This library is distributed in the
-- hope that it will be useful, but WITHOUT ANY WARRANTY; without even
-- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-- PURPOSE. See the GNU General Public License for more details. You
-- should have received a copy of the GNU General Public License
-- distributed with this program; see file gnu-3-0.txt. If not, write to
-- the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
-- MA 02111-1307, USA.
-- ---------------------------------------
--
-- Edit History:
--
-- Ancient - S L - Developed package as add-on to Arm_Form.
-- 10/19/11 - RLB - Integrated outside-developed package into Arm_Form.
-- Commented out/replaced Ada 2005 features (this is
-- Ada 95 code). Updated for a few other changes since
-- the last update.
-- 10/25/11 - RLB - Added old insertion version to Revised_Clause_Header.
-- 4/ 1/12 - S L - Various revisions.
-- 8/31/12 - RLB - Added Output_Path.
-- 11/26/12 - RLB - Added subdivision names to Clause_Header and
-- Revised_Clause_Header.
type Texinfo_Output_Type is new ARM_Output.Output_Type with private;
--not overriding - Ada 2005-only
procedure Create
(Output_Object : in out Texinfo_Output_Type;
File_Prefix : in String;
Output_Path : in String;
Change_Version : in ARM_Contents.Change_Version_Type;
Title : in String);
-- Create an Output_Object for a document.
-- overriding - Ada 2005-only
procedure Close (Output_Object : in out Texinfo_Output_Type);
-- overriding
procedure Section
(Output_Object : in out Texinfo_Output_Type;
Section_Title : in String;
Section_Name : in String);
-- overriding
procedure Set_Columns
(Output_Object : in out Texinfo_Output_Type;
Number_of_Columns : in ARM_Output.Column_Count);
-- overriding
procedure Start_Paragraph
(Output_Object : in out Texinfo_Output_Type;
Style : in ARM_Output.Paragraph_Style_Type;
Indent : in ARM_Output.Paragraph_Indent_Type;
Number : in String;
No_Prefix : in Boolean := False;
Tab_Stops : in ARM_Output.Tab_Info := ARM_Output.NO_TABS;
No_Breaks : in Boolean := False;
Keep_with_Next : in Boolean := False;
Space_After : in ARM_Output.Space_After_Type := ARM_Output.Normal;
Justification : in ARM_Output.Justification_Type := ARM_Output.Default);
-- overriding
procedure End_Paragraph (Output_Object : in out Texinfo_Output_Type);
-- overriding
procedure Category_Header
(Output_Object : in out Texinfo_Output_Type;
Header_Text : String);
-- overriding
procedure Clause_Header
(Output_Object : in out Texinfo_Output_Type;
Header_Text : in String;
Level : in ARM_Contents.Level_Type;
Clause_Number : in String;
Top_Level_Subdivision_Name : in ARM_Output.Top_Level_Subdivision_Name_Kind;
No_Page_Break : in Boolean := False);
-- overriding
procedure Revised_Clause_Header
(Output_Object : in out Texinfo_Output_Type;
New_Header_Text : in String;
Old_Header_Text : in String;
Level : in ARM_Contents.Level_Type;
Clause_Number : in String;
Version : in ARM_Contents.Change_Version_Type;
Old_Version : in ARM_Contents.Change_Version_Type;
Top_Level_Subdivision_Name : in ARM_Output.Top_Level_Subdivision_Name_Kind;
No_Page_Break : in Boolean := False);
-- overriding
procedure TOC_Marker (Output_Object : in out Texinfo_Output_Type;
For_Start : in Boolean);
-- overriding
procedure New_Page (Output_Object : in out Texinfo_Output_Type;
Kind : ARM_Output.Page_Kind_Type := ARM_Output.Any_Page);
-- overriding
procedure New_Column (Output_Object : in out Texinfo_Output_Type);
-- overriding
procedure Separator_Line (Output_Object : in out Texinfo_Output_Type;
Is_Thin : Boolean := True);
-- overriding
procedure Start_Table
(Output_Object : in out Texinfo_Output_Type;
Columns : in ARM_Output.Column_Count;
First_Column_Width : in ARM_Output.Column_Count;
Last_Column_Width : in ARM_Output.Column_Count;
Alignment : in ARM_Output.Column_Text_Alignment;
No_Page_Break : in Boolean;
Has_Border : in Boolean;
Small_Text_Size : in Boolean;
Header_Kind : in ARM_Output.Header_Kind_Type);
-- overriding
procedure Table_Marker (Output_Object : in out Texinfo_Output_Type;
Marker : in ARM_Output.Table_Marker_Type);
-- overriding
procedure Ordinary_Text (Output_Object : in out Texinfo_Output_Type;
Text : in String);
-- overriding
procedure Ordinary_Character (Output_Object : in out Texinfo_Output_Type;
Char : in Character);
-- overriding
procedure Hard_Space (Output_Object : in out Texinfo_Output_Type);
-- overriding
procedure Line_Break (Output_Object : in out Texinfo_Output_Type);
-- overriding
procedure Index_Line_Break (Output_Object : in out Texinfo_Output_Type;
Clear_Keep_with_Next : in Boolean);
-- overriding
procedure Soft_Line_Break (Output_Object : in out Texinfo_Output_Type);
-- overriding
procedure Soft_Hyphen_Break (Output_Object : in out Texinfo_Output_Type);
-- overriding
procedure Tab (Output_Object : in out Texinfo_Output_Type);
-- overriding
procedure Special_Character
(Output_Object : in out Texinfo_Output_Type;
Char : in ARM_Output.Special_Character_Type);
-- overriding
procedure Unicode_Character
(Output_Object : in out Texinfo_Output_Type;
Char : in ARM_Output.Unicode_Type);
-- overriding
procedure End_Hang_Item (Output_Object : in out Texinfo_Output_Type);
-- overriding
procedure Text_Format
(Output_Object : in out Texinfo_Output_Type;
Format : in ARM_Output.Format_Type);
-- overriding
procedure Clause_Reference (Output_Object : in out Texinfo_Output_Type;
Text : in String;
Clause_Number : in String);
-- overriding
procedure Index_Target
(Output_Object : in out Texinfo_Output_Type;
Index_Key : in Natural);
-- overriding
procedure Index_Reference
(Output_Object : in out Texinfo_Output_Type;
Text : in String;
Index_Key : in Natural;
Clause_Number : in String);
-- overriding
procedure DR_Reference
(Output_Object : in out Texinfo_Output_Type;
Text : in String;
DR_Number : in String);
-- overriding
procedure AI_Reference
(Output_Object : in out Texinfo_Output_Type;
Text : in String;
AI_Number : in String);
-- overriding
procedure Local_Target
(Output_Object : in out Texinfo_Output_Type;
Text : in String;
Target : in String);
-- overriding
procedure Local_Link
(Output_Object : in out Texinfo_Output_Type;
Text : in String;
Target : in String;
Clause_Number : in String);
-- overriding
procedure Local_Link_Start
(Output_Object : in out Texinfo_Output_Type;
Target : in String;
Clause_Number : in String);
-- overriding
procedure Local_Link_End
(Output_Object : in out Texinfo_Output_Type;
Target : in String;
Clause_Number : in String);
-- overriding
procedure URL_Link
(Output_Object : in out Texinfo_Output_Type;
Text : in String;
URL : in String);
-- overriding
procedure Picture
(Output_Object : in out Texinfo_Output_Type;
Name : in String;
Descr : in String;
Alignment : in ARM_Output.Picture_Alignment;
Height, Width : in Natural;
Border : in ARM_Output.Border_Kind);
private
subtype Column_Index_Type is Integer range 1 .. 5;
type Column_Text_Item_Type;
type Column_Text_Ptr is access Column_Text_Item_Type;
type Column_Text_Item_Type is record
Text : String (1 .. 80);
Length : Natural;
Row : Natural; -- Which row in the column.
Next : Column_Text_Ptr;
end record;
type Column_Text_Ptrs_Type is array (Column_Index_Type) of Column_Text_Ptr;
type Column_Widths_Type is array (Column_Index_Type) of Natural;
procedure Free is new Ada.Unchecked_Deallocation (Column_Text_Item_Type, Column_Text_Ptr);
type State_Type is (Title, Contents, Table_Header, Multi_Column, Normal, Index_Start, Index);
type Texinfo_Output_Type is new ARM_Output.Output_Type with record
File : Ada.Text_IO.File_Type;
Is_Valid : Boolean := False;
State : State_Type;
In_Paragraph : Boolean := False; -- Sub-state within major states
Style : ARM_Output.Paragraph_Style_Type;
Indent : ARM_Output.Paragraph_Indent_Type;
End_Hang_Seen : Boolean;
-- Detecting end of title page
Line_Empty : Boolean := False; -- True if current line contains only whitespace.
First_Word : String (1 .. 80);
First_Word_Last : Natural;
-- Building menus
Menu_Section : ARM_Contents.Section_Number_Type := 0;
Menu_Clause : Natural := 0;
-- Table and Multi-Column format
Column_Count : ARM_Output.Column_Count;
Current_Column : Natural;
Current_Row : Natural;
Column_Text : Column_Text_Ptrs_Type := (others => null);
Column_Widths : Column_Widths_Type;
Max_Row : Natural := 0;
end record;
end ARM_Texinfo;
|