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 40... Line 70...
40
    directives, start-up and end-up files.  The routine next_char is the
70
    directives, start-up and end-up files.  The routine next_char is the
41
    lowest level file reading routine, which returns the next character
71
    lowest level file reading routine, which returns the next character
42
    in the input file.
72
    in the input file.
43
*/
73
*/
44
 
74
 
45
extern int refill_char PROTO_S ( ( void ) ) ;
75
extern int refill_char(void);
46
extern string init_buffer PROTO_S ( ( unsigned long ) ) ;
76
extern string init_buffer(unsigned long);
47
extern string make_pathname PROTO_S ( ( string ) ) ;
77
extern string make_pathname(string);
48
extern int is_full_pathname PROTO_S ( ( string ) ) ;
78
extern int is_full_pathname(string);
49
extern string set_crt_loc PROTO_S ( ( string, int ) ) ;
79
extern string set_crt_loc(string, int);
50
extern int start_include PROTO_S ( ( string, int, int, int ) ) ;
80
extern int start_include(string, int, int, int);
51
extern int end_include PROTO_S ( ( int ) ) ;
81
extern int end_include(int);
52
extern void open_startup PROTO_S ( ( void ) ) ;
82
extern void open_startup(void);
53
extern int open_input PROTO_S ( ( int ) ) ;
83
extern int open_input(int);
54
extern int open_output PROTO_S ( ( int, int ) ) ;
84
extern int open_output(int, int);
55
extern void close_input PROTO_S ( ( void ) ) ;
85
extern void close_input(void);
56
extern void close_output PROTO_S ( ( int ) ) ;
86
extern void close_output(int);
57
extern void set_incl_depth PROTO_S ( ( unsigned long ) ) ;
87
extern void set_incl_depth(unsigned long);
58
extern void add_directory PROTO_S ( ( string, string ) ) ;
88
extern void add_directory(string, string);
59
extern void directory_mode PROTO_S ( ( string, OPTIONS * ) ) ;
89
extern void directory_mode(string, OPTIONS *);
60
extern void builtin_startup PROTO_S ( ( void ) ) ;
90
extern void builtin_startup(void);
61
extern void term_input PROTO_S ( ( void ) ) ;
91
extern void term_input(void);
62
extern long tell_buffer PROTO_S ( ( unsigned long ) ) ;
92
extern long tell_buffer(unsigned long);
63
extern void seek_buffer PROTO_S ( ( unsigned long, long, int ) ) ;
93
extern void seek_buffer(unsigned long, long, int);
64
extern void protection_macro PROTO_S ( ( HASHID, int, int ) ) ;
94
extern void protection_macro(HASHID, int, int);
65
extern void update_column PROTO_S ( ( void ) ) ;
95
extern void update_column(void);
66
 
96
 
67
#ifdef SYSTEM_INCLUDED
97
#ifdef SYSTEM_INCLUDED
68
extern int already_included PROTO_S ( ( string, STAT_TYPE *, int ) ) ;
98
extern int already_included(string, STAT_TYPE *, int);
69
#endif
99
#endif
70
 
100
 
71
 
101
 
72
/*
102
/*
73
    TYPE REPRESENTING AN INCLUSION DIRECTORY
103
    TYPE REPRESENTING AN INCLUSION DIRECTORY
Line 75... Line 105...
75
    This type is used to represent a directory which is searched during
105
    This type is used to represent a directory which is searched during
76
    file inclusion.
106
    file inclusion.
77
*/
107
*/
78
 
108
 
79
typedef struct incl_dir_tag {
109
typedef struct incl_dir_tag {
80
    string path ;
110
	string path;
81
    string name ;
111
	string name;
82
    OPTIONS *mode ;
112
	OPTIONS *mode;
83
    ulong no ;
113
	ulong no;
84
    struct incl_dir_tag *next ;
114
	struct incl_dir_tag *next;
85
} INCL_DIR ;
115
} INCL_DIR;
86
 
116
 
87
 
117
 
88
/*
118
/*
89
    FILE READING VARIABLES
119
    FILE READING VARIABLES
90
 
120
 
91
    These variables relate to the file reading and writing routines.
121
    These variables relate to the file reading and writing routines.
92
*/
122
*/
93
 
123
 
94
extern int crt_line_changed ;
124
extern int crt_line_changed;
95
extern int crt_file_changed ;
125
extern int crt_file_changed;
96
extern int crt_col_changed ;
126
extern int crt_col_changed;
97
extern int crt_file_type ;
127
extern int crt_file_type;
98
extern int bad_crt_loc ;
128
extern int bad_crt_loc;
99
extern unsigned long crt_spaces ;
129
extern unsigned long crt_spaces;
100
extern unsigned long tab_width ;
130
extern unsigned long tab_width;
101
extern BUFFER internal_buff ;
131
extern BUFFER internal_buff;
102
extern BUFFER incl_buff ;
132
extern BUFFER incl_buff;
103
extern LIST ( string ) startup_files, endup_files ;
133
extern LIST(string)startup_files, endup_files;
104
extern FILE *input_file, *output_file [] ;
134
extern FILE *input_file, *output_file[];
105
extern string input_name, output_name [] ;
135
extern string input_name, output_name[];
106
extern unsigned long crt_buff_no ;
136
extern unsigned long crt_buff_no;
107
extern string input_start, input_end ;
137
extern string input_start, input_end;
108
extern string input_posn, input_eof ;
138
extern string input_posn, input_eof;
109
extern string input_crt ;
139
extern string input_crt;
110
extern INCL_DIR *dir_path ;
140
extern INCL_DIR *dir_path;
111
 
141
 
112
 
142
 
113
/*
143
/*
114
    CHARACTER READING AND UNREADING MACROS
144
    CHARACTER READING AND UNREADING MACROS
115
 
145
 
Line 117... Line 147...
117
    It needs to be checked against char_end to spot the end of the buffer.
147
    It needs to be checked against char_end to spot the end of the buffer.
118
    The macro unread_char unreads the character A by inserting it back
148
    The macro unread_char unreads the character A by inserting it back
119
    into the input buffer.
149
    into the input buffer.
120
*/
150
*/
121
 
151
 
122
#define next_char()		( ( int ) ( *( input_posn++ ) ) )
152
#define next_char()	((int)(*(input_posn++)))
123
#define unread_char( A )	( *( --input_posn ) = ( character ) ( A ) )
153
#define unread_char(A)	(*(--input_posn) = (character)(A))
124
 
154
 
125
 
155
 
126
/*
156
/*
127
    OUTPUT FILE NUMBERS
157
    OUTPUT FILE NUMBERS
128
 
158