Subversion Repositories tendra.SVN

Rev

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

Rev 2 Rev 7
Line -... Line 1...
-
 
1
/*
-
 
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
 */
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 53... Line 83...
53
 
83
 
54
    The routines in this module are concerned with error reporting and
84
    The routines in this module are concerned with error reporting and
55
    related areas.
85
    related areas.
56
*/
86
*/
57
 
87
 
58
extern ERROR make_error PROTO_W ( ( int, ... ) ) ;
88
extern ERROR make_error(int, ...);
59
extern void error PROTO_W ( ( int, CONST char *, ... ) ) ;
89
extern void error(int, CONST char *, ...);
60
extern void set_progname PROTO_S ( ( CONST char *, CONST char * ) ) ;
90
extern void set_progname(CONST char *, CONST char *);
61
extern string report_version PROTO_S ( ( int ) ) ;
91
extern string report_version(int);
62
extern void error_option PROTO_S ( ( string ) ) ;
92
extern void error_option(string);
63
extern void print_error PROTO_S ( ( LOCATION *, ERROR ) ) ;
93
extern void print_error(LOCATION *, ERROR);
64
extern EXP install_error PROTO_S ( ( LOCATION *, ERROR ) ) ;
94
extern EXP install_error(LOCATION *, ERROR);
65
extern void commentary PROTO_S ( ( IDENTIFIER ) ) ;
95
extern void commentary(IDENTIFIER);
66
extern void destroy_error PROTO_S ( ( ERROR, int ) ) ;
96
extern void destroy_error(ERROR, int);
67
extern ERROR concat_error PROTO_S ( ( ERROR, ERROR ) ) ;
97
extern ERROR concat_error(ERROR, ERROR);
68
extern ERROR concat_warning PROTO_S ( ( ERROR, ERROR ) ) ;
98
extern ERROR concat_warning(ERROR, ERROR);
69
extern void add_error PROTO_S ( ( ERROR *, ERROR ) ) ;
99
extern void add_error(ERROR *, ERROR);
70
extern void term_error PROTO_S ( ( int ) ) ;
100
extern void term_error(int);
71
extern ERROR set_prefix PROTO_S ( ( ERROR ) ) ;
101
extern ERROR set_prefix(ERROR);
72
extern void restore_prefix PROTO_S ( ( ERROR ) ) ;
102
extern void restore_prefix(ERROR);
73
 
103
 
74
#define report( A, B )		print_error ( &( A ), ( B ) )
104
#define report(A, B)	print_error(&(A), (B))
75
#define fail( A )		print_error ( NIL ( LOCATION ), ( A ) )
105
#define fail(A)		print_error(NIL(LOCATION), (A))
76
#define KILL_err		NIL ( ERROR )
106
#define KILL_err	NIL(ERROR)
77
 
107
 
78
 
108
 
79
/*
109
/*
80
    ERROR REPORTING VARIABLES
110
    ERROR REPORTING VARIABLES
81
 
111
 
82
    These variables are used in the configuration of the error reporting
112
    These variables are used in the configuration of the error reporting
83
    routines.
113
    routines.
84
*/
114
*/
85
 
115
 
86
extern CONST char *progname ;
116
extern CONST char *progname;
87
extern CONST char *progvers ;
117
extern CONST char *progvers;
88
extern int exit_status ;
118
extern int exit_status;
89
extern unsigned long number_errors ;
119
extern unsigned long number_errors;
90
extern unsigned long number_warnings ;
120
extern unsigned long number_warnings;
91
extern unsigned long max_errors ;
121
extern unsigned long max_errors;
92
extern int error_severity [] ;
122
extern int error_severity[];
93
extern int default_severity [] ;
123
extern int default_severity[];
94
extern int verbose ;
124
extern int verbose;
95
extern int error_threshold ;
125
extern int error_threshold;
96
extern int no_error_args ;
126
extern int no_error_args;
97
extern LOCATION crt_loc ;
127
extern LOCATION crt_loc;
98
extern LOCATION builtin_loc ;
128
extern LOCATION builtin_loc;
99
extern FILE *error_file ;
129
extern FILE *error_file;
100
 
130
 
101
 
131
 
102
/*
132
/*
103
    ASSERTION ROUTINE DECLARATIONS
133
    ASSERTION ROUTINE DECLARATIONS
104
 
134
 
Line 109... Line 139...
109
    FAIL_COMPILER is intended as an alternative to #error blows up some
139
    FAIL_COMPILER is intended as an alternative to #error blows up some
110
    compilers even if it is not on the main compilation path.
140
    compilers even if it is not on the main compilation path.
111
*/
141
*/
112
 
142
 
113
#ifdef ASSERTS
143
#ifdef ASSERTS
114
extern int is_true PROTO_S ( ( int ) ) ;
144
extern int is_true(int);
115
extern void assertion PROTO_S ( ( CONST char *, CONST char *, int ) ) ;
145
extern void assertion(CONST char *, CONST char *, int);
116
#if FS_STDC_HASH
146
#if FS_STDC_HASH
117
#define ASSERT( A )	if ( is_true ( !( A ) ) )\
147
#define ASSERT(A)	if (is_true(!(A)))\
118
			    assertion ( #A, __FILE__, __LINE__ )
148
			    assertion(#A, __FILE__, __LINE__)
119
#define FAIL( A )	assertion ( #A, __FILE__, __LINE__ )
149
#define FAIL(A)		assertion(#A, __FILE__, __LINE__)
120
#else
150
#else
121
#define ASSERT( A )	if ( is_true ( !( A ) ) )\
151
#define ASSERT(A)	if (is_true(!(A)))\
122
			    assertion ( "A", __FILE__, __LINE__ )
152
			    assertion("A", __FILE__, __LINE__)
123
#define FAIL( A )	assertion ( "A", __FILE__, __LINE__ )
153
#define FAIL(A)		assertion("A", __FILE__, __LINE__)
124
#endif
154
#endif
125
#else
155
#else
126
#if FS_LINT
156
#if FS_LINT
127
#define ASSERT( A )	/* empty */
157
#define ASSERT(A)	/* empty */
128
#define FAIL( A )	/* empty */
158
#define FAIL(A)		/* empty */
129
#else
159
#else
130
#define ASSERT( A )	( IGNORE 0 )
160
#define ASSERT(A)	(IGNORE 0)
131
#define FAIL( A )	( IGNORE 0 )
161
#define FAIL(A)		(IGNORE 0)
132
#endif
162
#endif
133
#endif
163
#endif
134
 
164
 
135
#define FAIL_COMPILER	ERROR [!]
165
#define FAIL_COMPILER	ERROR[!]
136
 
166
 
137
 
167
 
138
#endif
168
#endif