2 |
7u83 |
1 |
/*
|
|
|
2 |
Crown Copyright (c) 1997
|
|
|
3 |
|
|
|
4 |
This TenDRA(r) Computer Program is subject to Copyright
|
|
|
5 |
owned by the United Kingdom Secretary of State for Defence
|
|
|
6 |
acting through the Defence Evaluation and Research Agency
|
|
|
7 |
(DERA). It is made available to Recipients with a
|
|
|
8 |
royalty-free licence for its use, reproduction, transfer
|
|
|
9 |
to other parties and amendment for any purpose not excluding
|
|
|
10 |
product development provided that any such use et cetera
|
|
|
11 |
shall be deemed to be acceptance of the following conditions:-
|
|
|
12 |
|
|
|
13 |
(1) Its Recipients shall ensure that this Notice is
|
|
|
14 |
reproduced upon any copies or amended versions of it;
|
|
|
15 |
|
|
|
16 |
(2) Any amended version of it shall be clearly marked to
|
|
|
17 |
show both the nature of and the organisation responsible
|
|
|
18 |
for the relevant amendment or amendments;
|
|
|
19 |
|
|
|
20 |
(3) Its onward transfer from a recipient to another
|
|
|
21 |
party shall be deemed to be that party's acceptance of
|
|
|
22 |
these conditions;
|
|
|
23 |
|
|
|
24 |
(4) DERA gives no warranty or assurance as to its
|
|
|
25 |
quality or suitability for any purpose and DERA accepts
|
|
|
26 |
no liability whatsoever in relation to any use to which
|
|
|
27 |
it may be put.
|
|
|
28 |
*/
|
|
|
29 |
|
|
|
30 |
|
|
|
31 |
#ifndef FILENAME_INCLUDED
|
|
|
32 |
#define FILENAME_INCLUDED
|
|
|
33 |
|
|
|
34 |
|
|
|
35 |
/*
|
|
|
36 |
TYPE REPRESENTING A FILE NAME
|
|
|
37 |
|
|
|
38 |
The filename structure is used to represent a tcc input or output
|
|
|
39 |
file. It has an associated name (the full pathname), a basename
|
|
|
40 |
(with the directory and file suffix removed), a file type (see
|
|
|
41 |
below) and a file storage type (see below). filenames are formed
|
|
|
42 |
into lists using the next field. The may also be associated into
|
|
|
43 |
groups which are passed around as if they were a single file using
|
|
|
44 |
the aux field.
|
|
|
45 |
*/
|
|
|
46 |
|
|
|
47 |
typedef struct filename_t {
|
|
|
48 |
char *name ;
|
|
|
49 |
char *bname ;
|
|
|
50 |
int uniq ;
|
|
|
51 |
int type ;
|
|
|
52 |
int storage ;
|
|
|
53 |
boolean final ;
|
|
|
54 |
struct filename_t *aux ;
|
|
|
55 |
struct filename_t *next ;
|
|
|
56 |
} filename ;
|
|
|
57 |
|
|
|
58 |
#define no_filename ( ( filename * ) null )
|
|
|
59 |
|
|
|
60 |
|
|
|
61 |
/*
|
|
|
62 |
FILE TYPES
|
|
|
63 |
|
|
|
64 |
Each of the file types handled by tcc is allocated an identifier.
|
|
|
65 |
This is Table 1, if it is changed then it may have knock-on effects
|
|
|
66 |
in several places in the program. Hopefully I have marked them all
|
|
|
67 |
by suitable comments.
|
|
|
68 |
*/
|
|
|
69 |
|
|
|
70 |
#define C_SOURCE 0
|
|
|
71 |
#define PREPROC_C 1
|
|
|
72 |
#define CPP_SOURCE 2
|
|
|
73 |
#define PREPROC_CPP 3
|
|
|
74 |
#define INDEP_TDF 4
|
|
|
75 |
#define DEP_TDF 5
|
|
|
76 |
#define AS_SOURCE 6
|
|
|
77 |
#define BINARY_OBJ 7
|
|
|
78 |
#define EXECUTABLE 8
|
|
|
79 |
#define PRETTY_TDF 9
|
|
|
80 |
#define PL_TDF 10
|
|
|
81 |
#define TDF_ARCHIVE 11
|
|
|
82 |
#define MIPS_G_FILE 12
|
|
|
83 |
#define MIPS_T_FILE 13
|
|
|
84 |
#define C_SPEC 14
|
|
|
85 |
#define CPP_SPEC 15
|
|
|
86 |
#define STARTUP_FILE 16
|
|
|
87 |
#define UNKNOWN_TYPE 17
|
|
|
88 |
#define ALL_TYPES 31
|
|
|
89 |
#define DEFAULT_TYPE BINARY_OBJ
|
|
|
90 |
|
|
|
91 |
|
|
|
92 |
/*
|
|
|
93 |
FILE STORAGE TYPES
|
|
|
94 |
|
|
|
95 |
The files handled by tcc may be of three basic types, input files,
|
|
|
96 |
permanent output files and temporary output files. The first type
|
|
|
97 |
may also contain input options which are treated like input files
|
|
|
98 |
(for example, system libraries). The second type includes the
|
|
|
99 |
preserved intermediate files. In fact PRESERVED_FILE is only used
|
|
|
100 |
as the input to make_filename.
|
|
|
101 |
*/
|
|
|
102 |
|
|
|
103 |
#define INPUT_FILE 0
|
|
|
104 |
#define INPUT_OPTION 1
|
|
|
105 |
#define OUTPUT_FILE 2
|
|
|
106 |
#define PRESERVED_FILE 3
|
|
|
107 |
#define TEMP_FILE 4
|
|
|
108 |
|
|
|
109 |
|
|
|
110 |
/*
|
|
|
111 |
SUFFIX OVERRIDES
|
|
|
112 |
|
|
|
113 |
This table contains the strings which are used when the suffix
|
|
|
114 |
overrides are set from the command line. Initially, it is empty.
|
|
|
115 |
*/
|
|
|
116 |
|
|
|
117 |
extern char *suffixes [] ;
|
|
|
118 |
|
|
|
119 |
|
|
|
120 |
/*
|
|
|
121 |
FILE STORAGE LOCATIONS
|
|
|
122 |
|
|
|
123 |
Output files may be stored either in the temporary directory or
|
|
|
124 |
the work directory.
|
|
|
125 |
*/
|
|
|
126 |
|
|
|
127 |
extern char *tempdir ;
|
|
|
128 |
extern char *workdir ;
|
|
|
129 |
|
|
|
130 |
|
|
|
131 |
/*
|
|
|
132 |
INPUT FILE VARIABLES
|
|
|
133 |
|
|
|
134 |
These variables are used to pass information to and from find_filename.
|
|
|
135 |
*/
|
|
|
136 |
|
|
|
137 |
extern boolean case_insensitive ;
|
|
|
138 |
extern boolean option_next ;
|
|
|
139 |
extern int no_input_files ;
|
|
|
140 |
|
|
|
141 |
|
|
|
142 |
/*
|
|
|
143 |
PROCEDURE DECLARATIONS
|
|
|
144 |
|
|
|
145 |
These routines are concerned with creating and manipulating filenames.
|
|
|
146 |
*/
|
|
|
147 |
|
|
|
148 |
extern char *find_basename PROTO_S ( ( char * ) ) ;
|
|
|
149 |
extern char *find_fullname PROTO_S ( ( char * ) ) ;
|
|
|
150 |
extern filename *add_filename PROTO_S ( ( filename *, filename * ) ) ;
|
|
|
151 |
extern filename *find_filename PROTO_S ( ( char *, int ) ) ;
|
|
|
152 |
extern filename *make_filename PROTO_S ( ( filename *, int, int ) ) ;
|
|
|
153 |
extern int find_type PROTO_S ( ( int, int ) ) ;
|
|
|
154 |
extern int where PROTO_S ( ( int ) ) ;
|
|
|
155 |
|
|
|
156 |
|
|
|
157 |
#endif
|