1------------------------------------------------------------------------------
2--                                                                          --
3--                         GNAT COMPILER COMPONENTS                         --
4--                                                                          --
5--                              O S I N T - B                               --
6--                                                                          --
7--                                 S p e c                                  --
8--                                                                          --
9--          Copyright (C) 2001 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 only
28--  in the GNAT binder for command line processing and file input output.
29
30package Osint.B is
31
32   procedure Record_Time_From_Last_Bind;
33   --  Trigger the computing of the time from the last bind of the same
34   --  program.
35
36   function More_Lib_Files return Boolean;
37   --  Indicates whether more library information files remain to be processed.
38   --  Returns False right away if no source files, or if all source files
39   --  have been processed.
40
41   function Next_Main_Lib_File return File_Name_Type;
42   --  This function returns the name of the next library info file specified
43   --  on the command line. It is an error to call Next_Main_Lib_File if no
44   --  more library information files exist (i.e. Next_Main_Lib_File may be
45   --  called only if a previous call to More_Lib_Files returned True). This
46   --  name is the simple name, excluding any directory information.
47
48   function Time_From_Last_Bind return Nat;
49   --  This function give an approximate number of minute from the last bind.
50   --  It bases its computation on file stamp and therefore does gibe not
51   --  any meaningful result before the new output binder file is written.
52   --  So it returns Nat'last if:
53   --
54   --   - it is the first bind of this  specific program
55   --   - Record_Time_From_Last_Bind was not Called first
56   --   - Close_Binder_Output was not called first
57   --
58   --  otherwise it returns the number of minutes from the last bind. The
59   --  computation does not try to be completely accurate and in particular
60   --  does not take leap years into account.
61
62   -------------------
63   -- Binder Output --
64   -------------------
65
66   --  These routines are used by the binder to generate the C source file
67   --  containing the binder output. The format of this file is described
68   --  in the package Bindfmt.
69
70   procedure Create_Binder_Output
71     (Output_File_Name : String;
72      Typ              : Character;
73      Bfile            : out Name_Id);
74   --  Creates the binder output file. Typ is one of
75   --
76   --    'c'   create output file for case of generating C
77   --    'b'   create body file for case of generating Ada
78   --    's'   create spec file for case of generating Ada
79   --
80   --  If Output_File_Name is null, then a default name is used based on
81   --  the name of the most recently accessed main source file name. If
82   --  Output_File_Name is non-null then it is the full path name of the
83   --  file to be output (in the case of Ada, it must have an extension
84   --  of adb, and the spec file is created by changing the last character
85   --  from b to s. On return, Bfile also contains the Name_Id for the
86   --  generated file name.
87
88   procedure Write_Binder_Info (Info : String);
89   --  Writes the contents of the referenced string to the binder output file
90   --  created by a previous call to Create_Binder_Output. Info represents a
91   --  single line in the file, but does not contain any line termination
92   --  characters. The implementation of Write_Binder_Info is responsible
93   --  for adding necessary end of line and end of file control characters
94   --  as required by the operating system.
95
96   procedure Close_Binder_Output;
97   --  Closes the file created by Create_Binder_Output, flushing any
98   --  buffers etc from writes by Write_Binder_Info.
99
100end Osint.B;
101