Debian Codegraph @

progs/arm_str.ads

raw
1 with ARM_Input;
2 package ARM_String is
3
4 --
5 -- Ada reference manual formatter (ARM_Form).
6 --
7 -- This package contains the definition of reading input from a string.
8 --
9 -- ---------------------------------------
10 -- Copyright 2000, 2011
11 -- AXE Consultants. All rights reserved.
12 -- P.O. Box 1512, Madison WI 53701
13 -- E-Mail: [email protected]
14 --
15 -- ARM_Form is free software: you can redistribute it and/or modify
16 -- it under the terms of the GNU General Public License version 3
17 -- as published by the Free Software Foundation.
18 --
19 -- AXE CONSULTANTS MAKES THIS TOOL AND SOURCE CODE AVAILABLE ON AN "AS IS"
20 -- BASIS AND MAKES NO WARRANTY, EXPRESS OR IMPLIED, AS TO THE ACCURACY,
21 -- CAPABILITY, EFFICIENCY, MERCHANTABILITY, OR FUNCTIONING OF THIS TOOL.
22 -- IN NO EVENT WILL AXE CONSULTANTS BE LIABLE FOR ANY GENERAL,
23 -- CONSEQUENTIAL, INDIRECT, INCIDENTAL, EXEMPLARY, OR SPECIAL DAMAGES,
24 -- EVEN IF AXE CONSULTANTS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
25 -- DAMAGES.
26 --
27 -- A copy of the GNU General Public License is available in the file
28 -- gpl-3-0.txt in the standard distribution of the ARM_Form tool.
29 -- Otherwise, see <http://www.gnu.org/licenses/>.
30 --
31 -- If the GPLv3 license is not satisfactory for your needs, a commercial
32 -- use license is available for this tool. Contact Randy at AXE Consultants
33 -- for more information.
34 --
35 -- ---------------------------------------
36 --
37 -- Edit History:
38 --
39 -- 5/15/00 - RLB - Created package.
40 -- 10/18/11 - RLB - Changed to GPLv3 license.
41
42 type String_Input_Type is new ARM_Input.Input_Type with private;
43
44 procedure Open (Input_Object : in out String_Input_Type;
45 Text : in String;
46 Text_Name : in String);
47 -- Open an input object for a string (Text), with a name of Text_Name.
48 -- (The name is used for error messages).
49
50 procedure Close (Input_Object : in out String_Input_Type);
51 -- Close the input object (entity).
52 -- May propagate exceptions from the underlying implementation
53 -- (that is, I/O exceptions).
54
55 procedure Get_Char (Input_Object : in out String_Input_Type;
56 Char : out Character);
57 -- We represent end of line by Ascii.LF.
58 -- Raises: End_Error when the end of file is reached.
59 -- Not_Valid_Error if Input_Object is not valid (open).
60
61 procedure Replace_Char (Input_Object : in out String_Input_Type);
62 -- Replaces the last character read (with Get_Char); the next call
63 -- to Get_Char will return it.
64 -- Raises: Not_Valid_Error if Input_Object is not valid (open).
65
66 function Line_String (Input_Object : in String_Input_Type) return String;
67 -- Returns a string representing the line number and entity.
68 -- Usually used in error messages.
69 -- Raises: Not_Valid_Error if Input_Object is not valid (open).
70
71 procedure Start_Recording (Input_Object : in out String_Input_Type);
72 -- Start recording all characters read into a local buffer.
73 -- Use this when text needs to be formatted into the output
74 -- file *and* be saved for future use.
75 -- Raises: Not_Valid_Error if Input_Object is not valid (open).
76
77 procedure Stop_Recording_and_Read_Result
78 (Input_Object : in out String_Input_Type; Result : out String;
79 Len : out Natural);
80 -- Stop recording characters read. Put the result into Result,
81 -- and the number of characters written into Len.
82 -- Raises: Not_Valid_Error if Input_Object is not valid (open).
83
84 private
85 type String_Input_Type is new ARM_Input.Input_Type with record
86 Is_Valid : Boolean := False;
87 Line_Counter : Natural := 0;
88 Buffer : String(1..4000);
89 Buffer_Len : Natural := 0;
90 Buffer_Index : Natural := 0; -- Last character read from buffer.
91 -- For recording:
92 Recording : Boolean := False;
93 Recording_Start : Natural := 0; -- First character of recorded section.
94 -- Name:
95 Name : String(1..120);
96 Name_Len : Natural;
97 end record;
98 end ARM_String;