Subversion Repositories tendra.SVN

Rev

Rev 2 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 7u83 1
/*
7 7u83 2
 * Copyright (c) 2002-2006 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
 */
31
/*
2 7u83 32
    		 Crown Copyright (c) 1997
7 7u83 33
 
2 7u83 34
    This TenDRA(r) Computer Program is subject to Copyright
35
    owned by the United Kingdom Secretary of State for Defence
36
    acting through the Defence Evaluation and Research Agency
37
    (DERA).  It is made available to Recipients with a
38
    royalty-free licence for its use, reproduction, transfer
39
    to other parties and amendment for any purpose not excluding
40
    product development provided that any such use et cetera
41
    shall be deemed to be acceptance of the following conditions:-
7 7u83 42
 
2 7u83 43
        (1) Its Recipients shall ensure that this Notice is
44
        reproduced upon any copies or amended versions of it;
7 7u83 45
 
2 7u83 46
        (2) Any amended version of it shall be clearly marked to
47
        show both the nature of and the organisation responsible
48
        for the relevant amendment or amendments;
7 7u83 49
 
2 7u83 50
        (3) Its onward transfer from a recipient to another
51
        party shall be deemed to be that party's acceptance of
52
        these conditions;
7 7u83 53
 
2 7u83 54
        (4) DERA gives no warranty or assurance as to its
55
        quality or suitability for any purpose and DERA accepts
56
        no liability whatsoever in relation to any use to which
57
        it may be put.
58
*/
59
 
60
 
61
#ifndef OPTION_INCLUDED
62
#define OPTION_INCLUDED
63
 
64
 
65
/*
66
    OPTION CATALOGUES
67
 
68
    The table OPT_CATALOG is used to maintain the list of all boolean
69
    options.  The table OPT_VALUE_CATALOG is used to hold the value
70
    options.  Macros are given to name the entries in the latter table.
71
    Names for entries in the former table are generated from the
72
    error catalogue.
73
*/
74
 
75
typedef struct {
7 7u83 76
    CONST char *name;
77
    int scoped;
78
    OPTION def[2];
79
} OPT_DATA;
2 7u83 80
 
81
typedef struct {
7 7u83 82
    CONST char *name;
83
    LOCATION *loc;
84
    unsigned long max_value;
85
    unsigned long min_value;
86
    unsigned long crt_value;
87
    int incr;
88
} OPT_VALUE_DATA;
2 7u83 89
 
7 7u83 90
extern OPT_DATA OPT_CATALOG[];
91
extern OPT_VALUE_DATA OPT_VALUE_CATALOG[];
2 7u83 92
 
93
 
94
/*
95
    OPTION LEVELS
96
 
97
    These values give the various option levels.  The fact that OPTION_OFF
98
    is zero is used extensively.
99
*/
100
 
7 7u83 101
#define OPTION_OFF				((OPTION)0)
102
#define OPTION_WARN				((OPTION)1)
103
#define OPTION_ON				((OPTION)2)
104
#define OPTION_WHATEVER				((OPTION)3)
2 7u83 105
 
106
#define OPTION_ALLOW				OPTION_OFF
107
#define OPTION_DISALLOW				OPTION_ON
108
 
109
 
110
/*
111
    OPTION VALUES
112
 
113
    These macros are used to represent the various numeric option values
114
    within the program.
115
*/
116
 
117
#define OPT_VAL_statement_depth			0
118
#define OPT_VAL_hash_if_depth			1
119
#define OPT_VAL_declarator_max			2
120
#define OPT_VAL_paren_depth			3
121
#define OPT_VAL_name_limit			4
122
#define OPT_VAL_extern_name_limit		5
123
#define OPT_VAL_external_ids			6
124
#define OPT_VAL_block_ids			7
125
#define OPT_VAL_macro_ids			8
126
#define OPT_VAL_func_pars			9
127
#define OPT_VAL_func_args			10
128
#define OPT_VAL_macro_pars			11
129
#define OPT_VAL_macro_args			12
130
#define OPT_VAL_line_length			13
131
#define OPT_VAL_string_length			14
132
#define OPT_VAL_sizeof_object			15
133
#define OPT_VAL_include_depth			16
134
#define OPT_VAL_switch_cases			17
135
#define OPT_VAL_data_members			18
136
#define OPT_VAL_enum_consts			19
137
#define OPT_VAL_nested_class			20
138
#define OPT_VAL_atexit_funcs			21
139
#define OPT_VAL_base_classes			22
140
#define OPT_VAL_direct_bases			23
141
#define OPT_VAL_class_members			24
142
#define OPT_VAL_virtual_funcs			25
143
#define OPT_VAL_virtual_bases			26
144
#define OPT_VAL_static_members			27
145
#define OPT_VAL_friends				28
146
#define OPT_VAL_access_declarations		29
147
#define OPT_VAL_ctor_initializers		30
148
#define OPT_VAL_scope_qualifiers		31
149
#define OPT_VAL_external_specs			32
150
#define OPT_VAL_template_pars			33
151
#define OPT_VAL_instance_depth			34
152
#define OPT_VAL_exception_handlers		35
153
#define OPT_VAL_exception_specs			36
154
#define OPT_VAL_cast_explicit			37
155
#define OPT_VAL_maximum_error			38
156
#define OPT_VAL_tab_width			39
157
 
158
 
159
/*
160
    COMPILER OPTION DECLARATIONS
161
 
162
    The routines in this module are concerned with configurable compiler
163
    options.
164
*/
165
 
7 7u83 166
extern OPTION *crt_opt;
167
extern OPTIONS *crt_opts;
168
extern OPTIONS *real_opts;
169
extern void set_option(int, unsigned);
170
extern void set_value(int, EXP, unsigned long);
171
extern void set_link_opt(DECL_SPEC);
172
extern ERROR set_severity(ERROR, int, int);
173
extern int find_option_no(STRING, int);
174
extern int find_value_no(STRING, int);
175
extern int find_type_no(STRING);
176
extern int check_value(int, unsigned long, ...);
177
extern int incr_value(int);
178
extern void decr_value(int);
179
extern void use_option(IDENTIFIER, unsigned);
180
extern void use_mode(OPTIONS *, int);
181
extern void set_mode(OPTIONS *);
182
extern void directory_option(IDENTIFIER, IDENTIFIER);
183
extern void begin_option(IDENTIFIER);
184
extern void end_option(int);
185
extern void init_option(int);
186
extern void term_option(void);
2 7u83 187
 
7 7u83 188
#define option(A)		(crt_opt[(A)])
189
#define option_value(A)	(OPT_VALUE_CATALOG[(A)].max_value)
190
#define crt_option_value(A)	(OPT_VALUE_CATALOG[(A)].crt_value)
2 7u83 191
 
192
 
193
#endif