Subversion Repositories tendra.SVN

Rev

Rev 5 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5 Rev 6
Line -... Line 1...
-
 
1
/*
-
 
2
 * Copyright (c) 2002-2005 The TenDRA Project <http://www.tendra.org/>.
-
 
3
 * All rights reserved.
-
 
4
 *
-
 
5
 * Redistribution and use in source and binary forms, with or without
-
 
6
 * modification, are permitted provided that the following conditions are met:
-
 
7
 *
-
 
8
 * 1. Redistributions of source code must retain the above copyright notice,
-
 
9
 *    this list of conditions and the following disclaimer.
-
 
10
 * 2. Redistributions in binary form must reproduce the above copyright notice,
-
 
11
 *    this list of conditions and the following disclaimer in the documentation
-
 
12
 *    and/or other materials provided with the distribution.
-
 
13
 * 3. Neither the name of The TenDRA Project nor the names of its contributors
-
 
14
 *    may be used to endorse or promote products derived from this software
-
 
15
 *    without specific, prior written permission.
-
 
16
 *
-
 
17
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
-
 
18
 * IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-
 
19
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-
 
20
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
-
 
21
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-
 
22
 * EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-
 
23
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-
 
24
 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-
 
25
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-
 
26
 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-
 
27
 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
 
28
 *
-
 
29
 * $Id$
-
 
30
 */
1
/*
31
/*
2
    		 Crown Copyright (c) 1997
32
    		 Crown Copyright (c) 1997
3
    
33
 
4
    This TenDRA(r) Computer Program is subject to Copyright
34
    This TenDRA(r) Computer Program is subject to Copyright
5
    owned by the United Kingdom Secretary of State for Defence
35
    owned by the United Kingdom Secretary of State for Defence
6
    acting through the Defence Evaluation and Research Agency
36
    acting through the Defence Evaluation and Research Agency
7
    (DERA).  It is made available to Recipients with a
37
    (DERA).  It is made available to Recipients with a
8
    royalty-free licence for its use, reproduction, transfer
38
    royalty-free licence for its use, reproduction, transfer
9
    to other parties and amendment for any purpose not excluding
39
    to other parties and amendment for any purpose not excluding
10
    product development provided that any such use et cetera
40
    product development provided that any such use et cetera
11
    shall be deemed to be acceptance of the following conditions:-
41
    shall be deemed to be acceptance of the following conditions:-
12
    
42
 
13
        (1) Its Recipients shall ensure that this Notice is
43
        (1) Its Recipients shall ensure that this Notice is
14
        reproduced upon any copies or amended versions of it;
44
        reproduced upon any copies or amended versions of it;
15
    
45
 
16
        (2) Any amended version of it shall be clearly marked to
46
        (2) Any amended version of it shall be clearly marked to
17
        show both the nature of and the organisation responsible
47
        show both the nature of and the organisation responsible
18
        for the relevant amendment or amendments;
48
        for the relevant amendment or amendments;
19
    
49
 
20
        (3) Its onward transfer from a recipient to another
50
        (3) Its onward transfer from a recipient to another
21
        party shall be deemed to be that party's acceptance of
51
        party shall be deemed to be that party's acceptance of
22
        these conditions;
52
        these conditions;
23
    
53
 
24
        (4) DERA gives no warranty or assurance as to its
54
        (4) DERA gives no warranty or assurance as to its
25
        quality or suitability for any purpose and DERA accepts
55
        quality or suitability for any purpose and DERA accepts
26
        no liability whatsoever in relation to any use to which
56
        no liability whatsoever in relation to any use to which
27
        it may be put.
57
        it may be put.
28
*/
58
*/
Line 31... Line 61...
31
#ifndef FILENAME_INCLUDED
61
#ifndef FILENAME_INCLUDED
32
#define FILENAME_INCLUDED
62
#define FILENAME_INCLUDED
33
 
63
 
34
 
64
 
35
/*
65
/*
36
    TYPE REPRESENTING A FILE NAME
66
 * TYPE REPRESENTING A FILE NAME
-
 
67
 *
-
 
68
 * The filename structure is used to represent a tcc input or output file. It
-
 
69
 * has an associated name (the full pathname), a basename (with the directory
-
 
70
 * and file suffix removed), a file type (see below) and a file storage type
-
 
71
 * (see below). Filenames are formed into lists using the next field. The may
-
 
72
 * also be associated into groups which are passed around as if they were a
-
 
73
 * single file using the aux field.
-
 
74
 */
-
 
75
 
-
 
76
typedef struct filename_t {
-
 
77
	char *name;
-
 
78
	char *bname;
-
 
79
	int uniq;
-
 
80
	int type;
-
 
81
	int storage;
-
 
82
	boolean final;
-
 
83
	struct filename_t *aux;
-
 
84
	struct filename_t *next;
-
 
85
} filename;
-
 
86
 
-
 
87
#define no_filename	((filename *)null)
-
 
88
 
-
 
89
 
-
 
90
/*
-
 
91
 * FILE TYPES - Table 1
-
 
92
 *
-
 
93
 * Each of the file types handled by tcc is allocated an identifier. If this
-
 
94
 * table is changed then it may have knock-on effects in several places in the
-
 
95
 * program. Hopefully I have marked them all by suitable comments.
-
 
96
*/
-
 
97
 
-
 
98
#define C_SOURCE	0
-
 
99
#define PREPROC_C	1
-
 
100
#define CPP_SOURCE	2
-
 
101
#define PREPROC_CPP	3
-
 
102
#define INDEP_TDF	4
-
 
103
#define DEP_TDF		5
-
 
104
#define AS_SOURCE	6
-
 
105
#define BINARY_OBJ	7
-
 
106
#define EXECUTABLE	8
-
 
107
#define PRETTY_TDF	9
-
 
108
#define PL_TDF		10
-
 
109
#define TDF_ARCHIVE	11
-
 
110
#define MIPS_G_FILE	12
-
 
111
#define MIPS_T_FILE	13
-
 
112
#define C_SPEC		14
-
 
113
#define CPP_SPEC	15
-
 
114
#define STARTUP_FILE	16
-
 
115
#define UNKNOWN_TYPE	17
-
 
116
#define ALL_TYPES	31
-
 
117
#define DEFAULT_TYPE	BINARY_OBJ
-
 
118
 
-
 
119
 
-
 
120
/*
-
 
121
 * FILE STORAGE TYPES
-
 
122
 *
-
 
123
 * The files handled by tcc may be of three basic types, input files, permanent
-
 
124
 * output files and temporary output files. The first type may also contain
-
 
125
 * input options which are treated like input files (for example, system
-
 
126
 * libraries). The second type includes the preserved intermediate files. In
-
 
127
 * fact PRESERVED_FILE is only used as the input to make_filename.
-
 
128
 */
-
 
129
 
-
 
130
#define INPUT_FILE	0
-
 
131
#define INPUT_OPTION	1
-
 
132
#define OUTPUT_FILE	2
-
 
133
#define PRESERVED_FILE	3
-
 
134
#define TEMP_FILE	4
-
 
135
 
-
 
136
 
-
 
137
/*
-
 
138
 * SUFFIX OVERRIDES
-
 
139
 *
-
 
140
 * This table contains the strings which are used when the suffix overrides are
-
 
141
 * set from the command line. Initially, it is empty.
-
 
142
 */
-
 
143
 
-
 
144
extern char *suffixes[];
37
 
145
 
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
 
146
 
-
 
147
/*
-
 
148
 * FILE STORAGE LOCATIONS
-
 
149
 *
-
 
150
 * Output files may be stored either in the temporary directory or the work
-
 
151
 * directory.
-
 
152
 */
119
 
153
 
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 ;
154
extern char *tempdir;
128
extern char *workdir ;
155
extern char *workdir;
129
 
156
 
130
 
157
 
131
/*
158
/*
132
    INPUT FILE VARIABLES
159
 * INPUT FILE VARIABLES
133
 
160
 *
134
    These variables are used to pass information to and from find_filename.
161
 * These variables are used to pass information to and from find_filename.
135
*/
162
 */
136
 
163
 
137
extern boolean case_insensitive ;
164
extern boolean case_insensitive;
138
extern boolean option_next ;
165
extern boolean option_next;
139
extern int no_input_files ;
166
extern int no_input_files;
140
 
167
 
141
 
168
 
142
/*
169
/*
143
    PROCEDURE DECLARATIONS
170
 * PROCEDURE DECLARATIONS
144
 
171
 *
145
    These routines are concerned with creating and manipulating filenames.
172
 * These routines are concerned with creating and manipulating filenames.
146
*/
173
 */
147
 
174
 
148
extern char *find_basename PROTO_S ( ( char * ) ) ;
175
extern char *find_basename(char *);
149
extern char *find_fullname PROTO_S ( ( char * ) ) ;
176
extern char *find_fullname(char *);
150
extern filename *add_filename PROTO_S ( ( filename *, filename * ) ) ;
177
extern filename *add_filename(filename *, filename *);
151
extern filename *find_filename PROTO_S ( ( char *, int ) ) ;
178
extern filename *find_filename(char *, int);
152
extern filename *make_filename PROTO_S ( ( filename *, int, int ) ) ;
179
extern filename *make_filename(filename *, int, int);
153
extern int find_type PROTO_S ( ( int, int ) ) ;
180
extern int find_type(int, int);
154
extern int where PROTO_S ( ( int ) ) ;
181
extern int where(int);
155
 
182
 
156
 
183
 
157
#endif
184
#endif