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