1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
10 -- Copyright (C) 2001 Free Software Foundation, Inc. --
12 -- GNAT is free software; you can redistribute it and/or modify it under --
13 -- terms of the GNU General Public License as published by the Free Soft- --
14 -- ware Foundation; either version 2, or (at your option) any later ver- --
15 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
16 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
17 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
18 -- for more details. You should have received a copy of the GNU General --
19 -- Public License distributed with GNAT; see file COPYING. If not, write --
20 -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
21 -- MA 02111-1307, USA. --
23 -- GNAT was originally developed by the GNAT team at New York University. --
24 -- Extensive contributions were provided by Ada Core Technologies Inc. --
26 ------------------------------------------------------------------------------
28 -- This package contains the low level, operating system routines used only
29 -- in the GNAT compiler for command line processing and file input output.
33 procedure Set_Output_Object_File_Name
(Name
: String);
34 -- Called by the subprogram processing the command line when an
35 -- output object file name is found.
37 function More_Source_Files
return Boolean;
38 -- Indicates whether more source file remain to be processed. Returns
39 -- False right away if no source files, or if all source files have
42 function Next_Main_Source
return File_Name_Type
;
43 -- This function returns the name of the next main source file specified
44 -- on the command line. It is an error to call Next_Main_Source if no more
45 -- source files exist (i.e. Next_Main_Source may be called only if a
46 -- previous call to More_Source_Files returned True). This name is the
47 -- simple file name (without any directory information).
49 ------------------------------
50 -- Debug Source File Output --
51 ------------------------------
53 -- These routines are used by the compiler to generate the debug source
54 -- file for the Debug_Generated_Code (-gnatD switch) option. Note that
55 -- debug source file writing occurs at a completely different point in
56 -- the processing from library information output, or representation
57 -- output, so the code in the body can assume that no two of these
58 -- functions are ever used at the same time.
60 function Create_Debug_File
(Src
: File_Name_Type
) return File_Name_Type
;
61 -- Given the simple name of a source file, this routine creates the
62 -- corresponding debug file, and returns its full name.
64 procedure Write_Debug_Info
(Info
: String);
65 -- Writes contents of given string as next line of the current debug
66 -- source file created by the most recent call to Create_Debug_File.
67 -- Info does not contain end of line or other formatting characters.
69 procedure Close_Debug_File
;
70 -- Close current debug file created by the most recent call to
73 function Debug_File_Eol_Length
return Nat
;
74 -- Returns the number of characters (1 for NL, 2 for CR/LF) written
75 -- at the end of each line by Write_Debug_Info.
77 --------------------------------
78 -- Representation File Output --
79 --------------------------------
81 -- These routines are used by the compiler to generate the representation
82 -- information to a file if this option is specified (-gnatR?s switch).
83 -- Note that the writing of this file occurs at a completely different
84 -- point in the processing from library information output, or from
85 -- debug file output, so the code in the body can assume that no two
86 -- of these functions are ever used at the same time.
88 -- Note: these routines are called from Repinfo, but are not called
89 -- directly, since we do not want Repinfo to depend on Osint. That
90 -- would cause a lot of unwanted junk to be dragged into ASIS. So
91 -- what we do is we have Initialize set the addresses of these three
92 -- procedures in appropriate variables in Repinfo, so that they can
93 -- be called indirectly without creating a dependence.
95 procedure Creat_Repinfo_File
(Src
: File_Name_Type
);
96 -- Given the simple name of a source file, this routine creates the
97 -- corresponding file to hold representation information
99 procedure Write_Repinfo_Line
(Info
: String);
100 -- Writes contents of given string as next line of the current debug
101 -- source file created by the most recent call to Create_Repinfo_File.
102 -- Info does not contain end of line or other formatting characters.
104 procedure Close_Repinfo_File
;
105 -- Close current debug file created by the most recent call to
106 -- Create_Repinfo_File.
108 --------------------------------
109 -- Library Information Output --
110 --------------------------------
112 -- These routines are used by the compiler to generate the library
113 -- information file for the main source file being compiled. See section
114 -- above for a discussion of how library information files are stored.
116 procedure Create_Output_Library_Info
;
117 -- Creates the output library information file for the source file which
118 -- is currently being compiled (i.e. the file which was most recently
119 -- returned by Next_Main_Source).
121 procedure Write_Library_Info
(Info
: String);
122 -- Writes the contents of the referenced string to the library information
123 -- file for the main source file currently being compiled (i.e. the file
124 -- which was most recently opened with a call to Read_Next_File). Info
125 -- represents a single line in the file, but does not contain any line
126 -- termination characters. The implementation of Write_Library_Info is
127 -- responsible for adding necessary end of line and end of file control
128 -- characters to the generated file.
130 procedure Close_Output_Library_Info
;
131 -- Closes the file created by Create_Output_Library_Info, flushing any
132 -- buffers etc from writes by Write_Library_Info.
134 procedure Read_Library_Info
135 (Name
: out File_Name_Type
;
136 Text
: out Text_Buffer_Ptr
);
137 -- The procedure version of Read_Library_Info is used from the compiler
138 -- to read an existing ali file associated with the main unit. If the
139 -- ALI file exists, then its file name is returned in Name, and its
140 -- text is returned in Text. If the file does not exist, then Text is
143 --------------------------------
144 -- Semantic Tree Input-Output --
145 --------------------------------
147 procedure Tree_Create
;
148 -- Creates the tree output file for the source file which is currently
149 -- being compiled (i.e. the file which was most recently returned by
150 -- Next_Main_Source), and initializes Tree_IO.Tree_Write for output.
152 procedure Tree_Close
;
153 -- Closes the file previously opened by Tree_Create