* arm.c (FL_WBUF): Define.
[official-gcc.git] / gcc / ada / osint.ads
blob6e5672d1aca7408c7bc6732309be3979b77dac86
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT COMPILER COMPONENTS --
4 -- --
5 -- O S I N T --
6 -- --
7 -- S p e c --
8 -- --
9 -- Copyright (C) 1992-2004 Free Software Foundation, Inc. --
10 -- --
11 -- GNAT is free software; you can redistribute it and/or modify it under --
12 -- terms of the GNU General Public License as published by the Free Soft- --
13 -- ware Foundation; either version 2, or (at your option) any later ver- --
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
16 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
17 -- for more details. You should have received a copy of the GNU General --
18 -- Public License distributed with GNAT; see file COPYING. If not, write --
19 -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
20 -- MA 02111-1307, USA. --
21 -- --
22 -- GNAT was originally developed by the GNAT team at New York University. --
23 -- Extensive contributions were provided by Ada Core Technologies Inc. --
24 -- --
25 ------------------------------------------------------------------------------
27 -- This package contains the low level, operating system routines used in
28 -- the GNAT compiler and binder for command line processing and file input
29 -- output.
31 with GNAT.OS_Lib; use GNAT.OS_Lib;
32 with System; use System;
33 with Types; use Types;
35 pragma Elaborate (GNAT.OS_Lib);
37 package Osint is
39 Multi_Unit_Index_Character : Character := '~';
40 -- The character before the index of the unit in a multi-unit source,
41 -- in ALI and object file names. This is not a constant, because it is
42 -- changed to '$' on VMS.
44 Ada_Include_Path : constant String := "ADA_INCLUDE_PATH";
45 Ada_Objects_Path : constant String := "ADA_OBJECTS_PATH";
46 Project_Include_Path_File : constant String := "ADA_PRJ_INCLUDE_FILE";
47 Project_Objects_Path_File : constant String := "ADA_PRJ_OBJECTS_FILE";
49 procedure Initialize;
50 -- Initialize internal tables
52 function Normalize_Directory_Name (Directory : String) return String_Ptr;
53 -- Verify and normalize a directory name. If directory name is invalid,
54 -- this will return an empty string. Otherwise it will insure a trailing
55 -- slash and make other normalizations.
57 type File_Type is (Source, Library, Config, Definition, Preprocessing_Data);
59 function Find_File
60 (N : File_Name_Type;
61 T : File_Type) return File_Name_Type;
62 -- Finds a source, library or config file depending on the value
63 -- of T following the directory search order rules unless N is the
64 -- name of the file just read with Next_Main_File and already
65 -- contains directiory information, in which case just look in the
66 -- Primary_Directory. Returns File_Name_Type of the full file name
67 -- if found, No_File if file not found. Note that for the special
68 -- case of gnat.adc, only the compilation environment directory is
69 -- searched, i.e. the directory where the ali and object files are
70 -- written. Another special case is when Debug_Generated_Code is
71 -- set and the file name ends on ".dg", in which case we look for
72 -- the generated file only in the current directory, since that is
73 -- where it is always built.
75 function Get_File_Names_Case_Sensitive return Int;
76 pragma Import (C, Get_File_Names_Case_Sensitive,
77 "__gnat_get_file_names_case_sensitive");
78 File_Names_Case_Sensitive : constant Boolean :=
79 Get_File_Names_Case_Sensitive /= 0;
80 -- Set to indicate whether the operating system convention is for file
81 -- names to be case sensitive (e.g., in Unix, set True), or non case
82 -- sensitive (e.g., in OS/2, set False).
84 procedure Canonical_Case_File_Name (S : in out String);
85 -- Given a file name, converts it to canonical case form. For systems
86 -- where file names are case sensitive, this procedure has no effect.
87 -- If file names are not case sensitive (i.e. for example if you have
88 -- the file "xyz.adb", you can refer to it as XYZ.adb or XyZ.AdB), then
89 -- this call converts the given string to canonical all lower case form,
90 -- so that two file names compare equal if they refer to the same file.
92 function Number_Of_Files return Int;
93 -- gives the total number of filenames found on the command line.
95 No_Index : constant := -1;
96 -- Value used in Add_File to indicate that no index is specified
97 -- for a main.
99 procedure Add_File (File_Name : String; Index : Int := No_Index);
100 -- Called by the subprogram processing the command line for each
101 -- file name found. The index, when not defaulted to No_Index
102 -- is the index of the subprogram in its source, zero indicating
103 -- that the source is not multi-unit.
105 procedure Find_Program_Name;
106 -- Put simple name of current program being run (excluding the directory
107 -- path) in Name_Buffer, with the length in Name_Len.
109 function Program_Name (Nam : String) return String_Access;
110 -- In the native compilation case, Create a string containing Nam. In
111 -- the cross compilation case, looks at the prefix of the current
112 -- program being run and prepend it to Nam. For instance if the program
113 -- being run is <target>-gnatmake and Nam is "gcc", the returned value
114 -- will be a pointer to "<target>-gcc". This function clobbers
115 -- Name_Buffer and Name_Len.
117 procedure Write_Program_Name;
118 -- Writes name of program as invoked to the current output
119 -- (normally standard output).
121 procedure Fail (S1 : String; S2 : String := ""; S3 : String := "");
122 pragma No_Return (Fail);
123 -- Outputs error messages S1 & S2 & S3 preceded by the name of the
124 -- executing program and exits with E_Fatal. The output goes to
125 -- standard error, except if special output is in effect (see Output).
127 function Is_Directory_Separator (C : Character) return Boolean;
128 -- Returns True if C is a directory separator
130 function Get_Directory (Name : File_Name_Type) return File_Name_Type;
131 -- Get the prefix directory name (if any) from Name. The last separator
132 -- is preserved. Return the normalized current directory if there is no
133 -- directory part in the name.
135 function Is_Readonly_Library (File : File_Name_Type) return Boolean;
136 -- Check if this library file is a read-only file.
138 function Strip_Directory (Name : File_Name_Type) return File_Name_Type;
139 -- Strips the prefix directory name (if any) from Name. Returns the
140 -- stripped name. Name cannot end with a directory separator.
142 function Strip_Suffix (Name : File_Name_Type) return File_Name_Type;
143 -- Strips the suffix (the last '.' and whatever comes after it) from Name.
144 -- Returns the stripped name.
146 function Executable_Name (Name : File_Name_Type) return File_Name_Type;
147 -- Given a file name it adds the appropriate suffix at the end so that
148 -- it becomes the name of the executable on the system at end. For
149 -- instance under DOS it adds the ".exe" suffix, whereas under UNIX no
150 -- suffix is added.
152 function File_Stamp (Name : File_Name_Type) return Time_Stamp_Type;
153 -- Returns the time stamp of file Name. Name should include relative
154 -- path information in order to locate it. If the source file cannot be
155 -- opened, or Name = No_File, and all blank time stamp is returned (this is
156 -- not an error situation).
158 type String_Access_List is array (Positive range <>) of String_Access;
159 -- Deferenced type used to return a list of file specs in
160 -- To_Canonical_File_List.
162 type String_Access_List_Access is access all String_Access_List;
163 -- Type used to return a String_Access_List without dragging in secondary
164 -- stack.
166 function To_Canonical_File_List
167 (Wildcard_Host_File : String;
168 Only_Dirs : Boolean) return String_Access_List_Access;
169 -- Expand a wildcard host syntax file or directory specification (e.g. on
170 -- a VMS host, any file or directory spec that contains:
171 -- "*", or "%", or "...")
172 -- and return a list of valid Unix syntax file or directory specs.
173 -- If Only_Dirs is True, then only return directories.
175 function To_Canonical_Dir_Spec
176 (Host_Dir : String;
177 Prefix_Style : Boolean) return String_Access;
178 -- Convert a host syntax directory specification (e.g. on a VMS host:
179 -- "SYS$DEVICE:[DIR]") to canonical (Unix) syntax (e.g. "/sys$device/dir").
180 -- If Prefix_Style then make it a valid file specification prefix.
181 -- A file specification prefix is a directory specification that
182 -- can be appended with a simple file specification to yield a valid
183 -- absolute or relative path to a file. On a conversion to Unix syntax
184 -- this simply means the spec has a trailing slash ("/").
186 function To_Canonical_File_Spec
187 (Host_File : String) return String_Access;
188 -- Convert a host syntax file specification (e.g. on a VMS host:
189 -- "SYS$DEVICE:[DIR]FILE.EXT;69 to canonical (Unix) syntax (e.g.
190 -- "/sys$device/dir/file.ext.69").
192 function To_Canonical_Path_Spec
193 (Host_Path : String) return String_Access;
194 -- Convert a host syntax Path specification (e.g. on a VMS host:
195 -- "SYS$DEVICE:[BAR],DISK$USER:[FOO] to canonical (Unix) syntax (e.g.
196 -- "/sys$device/foo:disk$user/foo").
198 function To_Host_Dir_Spec
199 (Canonical_Dir : String;
200 Prefix_Style : Boolean) return String_Access;
201 -- Convert a canonical syntax directory specification to host syntax.
202 -- The Prefix_Style flag is currently ignored but should be set to
203 -- False.
205 function To_Host_File_Spec
206 (Canonical_File : String) return String_Access;
207 -- Convert a canonical syntax file specification to host syntax.
209 function Relocate_Path
210 (Prefix : String;
211 Path : String) return String_Ptr;
212 -- Given an absolute path and a prefix, if Path starts with Prefix,
213 -- replace the Prefix substring with the root installation directory.
214 -- By default, try to compute the root installation directory by looking
215 -- at the executable name as it was typed on the command line and, if
216 -- needed, use the PATH environment variable. If the above computation
217 -- fails, return Path. This function assumes Prefix'First = Path'First.
219 function Shared_Lib (Name : String) return String;
220 -- Returns the runtime shared library in the form -l<name>-<version> where
221 -- version is the GNAT runtime library option for the platform. For example
222 -- this routine called with Name set to "gnat" will return "-lgnat-5.02"
223 -- on UNIX and Windows and -lgnat_5_02 on VMS.
225 -------------------------
226 -- Search Dir Routines --
227 -------------------------
229 function Include_Dir_Default_Prefix return String;
230 -- Return the directory of the run-time library sources, as modified
231 -- by update_path.
233 function Object_Dir_Default_Prefix return String;
234 -- Return the directory of the run-time library ALI and object files, as
235 -- modified by update_path.
237 procedure Add_Default_Search_Dirs;
238 -- This routine adds the default search dirs indicated by the
239 -- environment variables and sdefault package.
241 procedure Add_Lib_Search_Dir (Dir : String);
242 -- Add Dir at the end of the library file search path
244 procedure Add_Src_Search_Dir (Dir : String);
245 -- Add Dir at the end of the source file search path
247 procedure Get_Next_Dir_In_Path_Init
248 (Search_Path : String_Access);
249 function Get_Next_Dir_In_Path
250 (Search_Path : String_Access) return String_Access;
251 -- These subprograms are used to parse out the directory names in a
252 -- search path specified by a Search_Path argument. The procedure
253 -- initializes an internal pointer to point to the initial directory
254 -- name, and calls to the function return successive directory names,
255 -- with a null pointer marking the end of the list.
257 type Search_File_Type is (Include, Objects);
259 procedure Add_Search_Dirs
260 (Search_Path : String_Ptr;
261 Path_Type : Search_File_Type);
262 -- These procedure adds all the search directories that are in Search_Path
263 -- in the proper file search path (library or source)
265 function Get_Primary_Src_Search_Directory return String_Ptr;
266 -- Retrieved the primary directory (directory containing the main source
267 -- file for Gnatmake.
269 function Nb_Dir_In_Src_Search_Path return Natural;
270 function Dir_In_Src_Search_Path (Position : Natural) return String_Ptr;
271 -- Functions to access the directory names in the source search path
273 function Nb_Dir_In_Obj_Search_Path return Natural;
274 function Dir_In_Obj_Search_Path (Position : Natural) return String_Ptr;
275 -- Functions to access the directory names in the Object search path
277 Include_Search_File : constant String_Access :=
278 new String'("ada_source_path");
279 Objects_Search_File : constant String_Access :=
280 new String'("ada_object_path");
281 -- Names of the files containg the default include or objects search
282 -- directories. These files, located in Sdefault.Search_Dir_Prefix, do
283 -- not necessarily exist.
285 Exec_Name : String_Ptr;
286 -- Executable name as typed by the user (used to compute the
287 -- executable prefix).
289 function Read_Default_Search_Dirs
290 (Search_Dir_Prefix : String_Access;
291 Search_File : String_Access;
292 Search_Dir_Default_Name : String_Access) return String_Access;
293 -- Read and return the default search directories from the file located
294 -- in Search_Dir_Prefix (as modified by update_path) and named Search_File.
295 -- If no such file exists or an error occurs then instead return the
296 -- Search_Dir_Default_Name (as modified by update_path).
298 function Get_RTS_Search_Dir
299 (Search_Dir : String;
300 File_Type : Search_File_Type) return String_Ptr;
301 -- This function retrieves the paths to the search (resp. lib) dirs and
302 -- return them. The search dir can be absolute or relative. If the search
303 -- dir contains Include_Search_File (resp. Object_Search_File), then this
304 -- function reads and returns the default search directories from the file.
305 -- Otherwise, if the directory is absolute, it will try to find 'adalib'
306 -- (resp. 'adainclude'). If found, null is returned. If the directory is
307 -- relative, the following directories for the directories 'adalib' and
308 -- 'adainclude' will be scanned:
310 -- - current directory (from which the tool has been spawned)
311 -- - $GNAT_ROOT/gcc/gcc-lib/$targ/$vers/
312 -- - $GNAT_ROOT/gcc/gcc-lib/$targ/$vers/rts-
314 -- The scan will stop as soon as the directory being searched for (adalib
315 -- or adainclude) is found. If the scan fails, null is returned.
317 -----------------------
318 -- Source File Input --
319 -----------------------
321 -- Source file input routines are used by the compiler to read the main
322 -- source files and the subsidiary source files (e.g. with'ed units), and
323 -- also by the binder to check presence/time stamps of sources.
325 procedure Read_Source_File
326 (N : File_Name_Type;
327 Lo : Source_Ptr;
328 Hi : out Source_Ptr;
329 Src : out Source_Buffer_Ptr;
330 T : File_Type := Source);
331 -- Allocates a Source_Buffer of appropriate length and then reads the
332 -- entire contents of the source file N into the buffer. The address of
333 -- the allocated buffer is returned in Src.
335 -- Each line of text is terminated by one of the sequences:
337 -- CR
338 -- CR/LF
339 -- LF/CR
340 -- LF
342 -- The source is terminated by an EOF (16#1A#) character, which is
343 -- the last charcater of the returned source bufer (note that any
344 -- EOF characters in positions other than the last source character
345 -- are treated as representing blanks).
347 -- The logical lower bound of the source buffer is the input value of Lo,
348 -- and on exit Hi is set to the logical upper bound of the source buffer.
349 -- Note that the returned value in Src points to an array with a physical
350 -- lower bound of zero. This virtual origin addressing approach means that
351 -- a constrained array pointer can be used with a low bound of zero which
352 -- results in more efficient code.
354 -- If the given file cannot be opened, then the action depends on whether
355 -- this file is the current main unit (i.e. its name matches the name
356 -- returned by the most recent call to Next_Main_Source). If so, then the
357 -- failure to find the file is a fatal error, an error message is output,
358 -- and program execution is terminated. Otherwise (for the case of a
359 -- subsidiary source loaded directly or indirectly using with), a file
360 -- not found condition causes null to be set as the result value.
362 -- Note that the name passed to this function is the simple file name,
363 -- without any directory information. The implementation is responsible
364 -- for searching for the file in the appropriate directories.
366 -- Note the special case that if the file name is gnat.adc, then the
367 -- search for the file is done ONLY in the directory corresponding to
368 -- the current compilation environment, i.e. in the same directory
369 -- where the ali and object files will be written.
371 function Full_Source_Name return File_Name_Type;
372 function Current_Source_File_Stamp return Time_Stamp_Type;
373 -- Returns the full name/time stamp of the source file most recently read
374 -- using Read_Source_File. Calling this routine entails no source file
375 -- directory lookup penalty.
377 function Full_Source_Name (N : File_Name_Type) return File_Name_Type;
378 function Source_File_Stamp (N : File_Name_Type) return Time_Stamp_Type;
379 -- Returns the full name/time stamp of the source file whose simple name
380 -- is N which should not include path information. Note that if the file
381 -- cannot be located No_File is returned for the first routine and an
382 -- all blank time stamp is returned for the second (this is not an error
383 -- situation). The full name includes the appropriate directory
384 -- information. The source file directory lookup penalty is incurred
385 -- every single time the routines are called unless you have previously
386 -- called Source_File_Data (Cache => True). See below.
388 function Current_File_Index return Int;
389 -- Return the index in its source file of the current main unit
391 function Matching_Full_Source_Name
392 (N : File_Name_Type;
393 T : Time_Stamp_Type) return File_Name_Type;
394 -- Same semantics than Full_Source_Name but will search on the source
395 -- path until a source file with time stamp matching T is found. If
396 -- none is found returns No_File.
398 procedure Source_File_Data (Cache : Boolean);
399 -- By default source file data (full source file name and time stamp)
400 -- are looked up every time a call to Full_Source_Name (N) or
401 -- Source_File_Stamp (N) is made. This may be undesirable in certain
402 -- applications as this is uselessly slow if source file data does not
403 -- change during program execution. When this procedure is called with
404 -- Cache => True access to source file data does not encurr a penalty if
405 -- this data was previously retrieved.
407 -------------------------------------------
408 -- Representation of Library Information --
409 -------------------------------------------
411 -- Associated with each compiled source file is library information,
412 -- a string of bytes whose exact format is described in the body of
413 -- Lib.Writ. Compiling a source file generates this library information
414 -- for the compiled unit, and access the library information for units
415 -- that were compiled previously on which the unit being compiled depends.
417 -- How this information is stored is up to the implementation of this
418 -- package. At the interface level, this information is simply associated
419 -- with its corresponding source.
421 -- Several different implementations are possible:
423 -- 1. The information could be directly associated with the source file,
424 -- e.g. placed in a resource fork of this file on the Mac, or on
425 -- MS-DOS, written to the source file after the end of file mark.
427 -- 2. The information could be written into the generated object module
428 -- if the system supports the inclusion of arbitrary informational
429 -- byte streams into object files. In this case there must be a naming
430 -- convention that allows object files to be located given the name of
431 -- the corresponding source file.
433 -- 3. The information could be written to a separate file, whose name is
434 -- related to the name of the source file by a fixed convention.
436 -- Which of these three methods is chosen depends on the constraints of the
437 -- host operating system. The interface described here is independent of
438 -- which of these approaches is used.
440 -------------------------------
441 -- Library Information Input --
442 -------------------------------
444 -- These subprograms are used by the binder to read library information
445 -- files, see section above for representation of these files.
447 function Read_Library_Info
448 (Lib_File : File_Name_Type;
449 Fatal_Err : Boolean := False) return Text_Buffer_Ptr;
450 -- Allocates a Text_Buffer of appropriate length and reads in the entire
451 -- source of the library information from the library information file
452 -- whose name is given by the parameter Name.
454 -- See description of Read_Source_File for details on the format of the
455 -- returned text buffer (the format is identical). THe lower bound of
456 -- the Text_Buffer is always zero
458 -- If the specified file cannot be opened, then the action depends on
459 -- Fatal_Err. If Fatal_Err is True, an error message is given and the
460 -- compilation is abandoned. Otherwise if Fatal_Err is False, then null
461 -- is returned. Note that the Lib_File is a simple name which does not
462 -- include any directory information. The implementation is responsible
463 -- for searching for the file in appropriate directories.
465 -- If Opt.Check_Object_Consistency is set to True then this routine
466 -- checks whether the object file corresponding to the Lib_File is
467 -- consistent with it. The object file is inconsistent if the object
468 -- does not exist or if it has an older time stamp than Lib_File.
469 -- This check is not performed when the Lib_File is "locked" (i.e.
470 -- read/only) because in this case the object file may be buried
471 -- in a library. In case of inconsistencies Read_Library_Info
472 -- behaves as if it did not find Lib_File (namely if Fatal_Err is
473 -- False, null is returned).
475 function Full_Library_Info_Name return File_Name_Type;
476 function Full_Object_File_Name return File_Name_Type;
477 -- Returns the full name of the library/object file most recently read
478 -- using Read_Library_Info, including appropriate directory information.
479 -- Calling this routine entails no library file directory lookup
480 -- penalty. Note that the object file corresponding to a library file
481 -- is not actually read. Its time stamp is fected when the flag
482 -- Opt.Check_Object_Consistency is set.
484 function Current_Library_File_Stamp return Time_Stamp_Type;
485 function Current_Object_File_Stamp return Time_Stamp_Type;
486 -- The time stamps of the files returned by the previous two routines.
487 -- It is an error to call Current_Object_File_Stamp if
488 -- Opt.Check_Object_Consistency is set to False.
490 function Full_Lib_File_Name (N : File_Name_Type) return File_Name_Type;
491 function Library_File_Stamp (N : File_Name_Type) return Time_Stamp_Type;
492 -- Returns the full name/time stamp of library file N. N should not
493 -- include path information. Note that if the file cannot be located
494 -- No_File is returned for the first routine and an all blank time stamp
495 -- is returned for the second (this is not an error situation). The
496 -- full name includes the appropriate directory information. The library
497 -- file directory lookup penalty is incurred every single time this
498 -- routine is called.
500 function Lib_File_Name
501 (Source_File : File_Name_Type;
502 Munit_Index : Nat := 0) return File_Name_Type;
503 -- Given the name of a source file, returns the name of the corresponding
504 -- library information file. This may be the name of the object file, or
505 -- of a separate file used to store the library information. In either case
506 -- the returned result is suitable for use in a call to Read_Library_Info.
507 -- The Munit_Index is the unit index in multiple unit per file mode, or
508 -- zero in normal single unit per file mode (used to add ~nnn suffix).
509 -- Note: this subprogram is in this section because it is used by the
510 -- compiler to determine the proper library information names to be placed
511 -- in the generated library information file.
513 -----------------
514 -- Termination --
515 -----------------
517 type Exit_Code_Type is (
518 E_Success, -- No warnings or errors
519 E_Warnings, -- Compiler warnings generated
520 E_No_Code, -- No code generated
521 E_No_Compile, -- Compilation not needed (smart recompilation)
522 E_Errors, -- Compiler error messages generated
523 E_Fatal, -- Fatal (serious) error, e.g. source file not found
524 E_Abort); -- Internally detected compiler error
526 procedure Exit_Program (Exit_Code : Exit_Code_Type);
527 pragma No_Return (Exit_Program);
528 -- A call to Exit_Program terminates execution with the given status.
529 -- A status of zero indicates normal completion, a non-zero status
530 -- indicates abnormal termination.
532 -------------------------
533 -- Command Line Access --
534 -------------------------
536 -- Direct interface to command line parameters. (We don't want to use
537 -- the predefined command line package because it defines functions
538 -- returning string)
540 function Arg_Count return Natural;
541 pragma Import (C, Arg_Count, "__gnat_arg_count");
542 -- Get number of arguments (note: optional globbing may be enabled)
544 procedure Fill_Arg (A : System.Address; Arg_Num : Integer);
545 pragma Import (C, Fill_Arg, "__gnat_fill_arg");
546 -- Store one argument
548 function Len_Arg (Arg_Num : Integer) return Integer;
549 pragma Import (C, Len_Arg, "__gnat_len_arg");
550 -- Get length of argument
552 private
554 ALI_Suffix : constant String_Ptr := new String'("ali");
555 -- The suffix used for the library files (also known as ALI files).
557 Current_Main : File_Name_Type := No_File;
558 -- Used to save a simple file name between calls to Next_Main_Source and
559 -- Read_Source_File. If the file name argument to Read_Source_File is
560 -- No_File, that indicates that the file whose name was returned by the
561 -- last call to Next_Main_Source (and stored here) is to be read.
563 Object_Suffix : constant String := Get_Object_Suffix.all;
564 -- The suffix used for the object files.
566 Output_FD : File_Descriptor;
567 -- The file descriptor for the current library info, tree or binder output
569 Output_File_Name : File_Name_Type;
570 -- File_Name_Type for name of open file whose FD is in Output_FD, the name
571 -- stored does not include the trailing NUL character.
573 Argument_Count : constant Integer := Arg_Count - 1;
574 -- Number of arguments (excluding program name)
576 type File_Name_Array is array (Int range <>) of String_Ptr;
577 type File_Name_Array_Ptr is access File_Name_Array;
578 File_Names : File_Name_Array_Ptr :=
579 new File_Name_Array (1 .. Int (Argument_Count) + 2);
580 -- As arguments are scanned, file names are stored in this array
581 -- The strings do not have terminating NUL files. The array is
582 -- extensible, because when using project files, there may be
583 -- more files than arguments on the command line.
585 type File_Index_Array is array (Int range <>) of Int;
586 type File_Index_Array_Ptr is access File_Index_Array;
587 File_Indexes : File_Index_Array_Ptr :=
588 new File_Index_Array (1 .. Int (Argument_Count) + 2);
590 Current_File_Name_Index : Int := 0;
591 -- The index in File_Names of the last file opened by Next_Main_Source
592 -- or Next_Main_Lib_File. The value 0 indicates that no files have been
593 -- opened yet.
595 procedure Create_File_And_Check
596 (Fdesc : out File_Descriptor;
597 Fmode : Mode);
598 -- Create file whose name (NUL terminated) is in Name_Buffer (with the
599 -- length in Name_Len), and place the resulting descriptor in Fdesc.
600 -- Issue message and exit with fatal error if file cannot be created.
601 -- The Fmode parameter is set to either Text or Binary (see description
602 -- of GNAT.OS_Lib.Create_File).
604 type Program_Type is (Compiler, Binder, Make, Gnatls, Unspecified);
605 -- Program currently running
606 procedure Set_Program (P : Program_Type);
607 -- Indicates to the body of Osint the program currently running.
608 -- This procedure is called by the child packages of Osint.
609 -- A check is made that this procedure is not called several times.
611 function More_Files return Boolean;
612 -- Implements More_Source_Files and More_Lib_Files.
614 function Next_Main_File return File_Name_Type;
615 -- Implements Next_Main_Source and Next_Main_Lib_File.
617 function Object_File_Name (N : File_Name_Type) return File_Name_Type;
618 -- Constructs the name of the object file corresponding to library
619 -- file N. If N is a full file name than the returned file name will
620 -- also be a full file name. Note that no lookup in the library file
621 -- directories is done for this file. This routine merely constructs
622 -- the name.
624 procedure Write_Info (Info : String);
625 -- Implementation of Write_Binder_Info, Write_Debug_Info and
626 -- Write_Library_Info (identical)
628 end Osint;