Subversion Repositories tendra.SVN

Rev

Rev 2 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
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 ERROR_INCLUDED
32
#define ERROR_INCLUDED
33
 
34
 
35
/*
36
    ERROR SEVERITY LEVELS
37
 
38
    These macros give the various error types recognised by the error
39
    routines.  Their values are in order of increasing severity.
40
*/
41
 
42
#define ERROR_WHATEVER		0
43
#define ERROR_NONE		1
44
#define ERROR_WARNING		2
45
#define ERROR_OPTION		3
46
#define ERROR_SERIOUS		4
47
#define ERROR_INTERNAL		5
48
#define ERROR_FATAL		6
49
 
50
 
51
/*
52
    ERROR ROUTINE DECLARATIONS
53
 
54
    The routines in this module are concerned with error reporting and
55
    related areas.
56
*/
57
 
58
extern ERROR make_error PROTO_W ( ( int, ... ) ) ;
59
extern void error PROTO_W ( ( int, CONST char *, ... ) ) ;
60
extern void set_progname PROTO_S ( ( CONST char *, CONST char * ) ) ;
61
extern string report_version PROTO_S ( ( int ) ) ;
62
extern void error_option PROTO_S ( ( string ) ) ;
63
extern void print_error PROTO_S ( ( LOCATION *, ERROR ) ) ;
64
extern EXP install_error PROTO_S ( ( LOCATION *, ERROR ) ) ;
65
extern void commentary PROTO_S ( ( IDENTIFIER ) ) ;
66
extern void destroy_error PROTO_S ( ( ERROR, int ) ) ;
67
extern ERROR concat_error PROTO_S ( ( ERROR, ERROR ) ) ;
68
extern ERROR concat_warning PROTO_S ( ( ERROR, ERROR ) ) ;
69
extern void add_error PROTO_S ( ( ERROR *, ERROR ) ) ;
70
extern void term_error PROTO_S ( ( int ) ) ;
71
extern ERROR set_prefix PROTO_S ( ( ERROR ) ) ;
72
extern void restore_prefix PROTO_S ( ( ERROR ) ) ;
73
 
74
#define report( A, B )		print_error ( &( A ), ( B ) )
75
#define fail( A )		print_error ( NIL ( LOCATION ), ( A ) )
76
#define KILL_err		NIL ( ERROR )
77
 
78
 
79
/*
80
    ERROR REPORTING VARIABLES
81
 
82
    These variables are used in the configuration of the error reporting
83
    routines.
84
*/
85
 
86
extern CONST char *progname ;
87
extern CONST char *progvers ;
88
extern int exit_status ;
89
extern unsigned long number_errors ;
90
extern unsigned long number_warnings ;
91
extern unsigned long max_errors ;
92
extern int error_severity [] ;
93
extern int default_severity [] ;
94
extern int verbose ;
95
extern int error_threshold ;
96
extern int no_error_args ;
97
extern LOCATION crt_loc ;
98
extern LOCATION builtin_loc ;
99
extern FILE *error_file ;
100
 
101
 
102
/*
103
    ASSERTION ROUTINE DECLARATIONS
104
 
105
    These macros are used to define assertions for aiding program
106
    development.  If the macro ASSERTS is defined then code for checking
107
    these assertions is output, otherwise the macros have no effect.
108
    Note that ASSERTS is automatically defined if DEBUG is (see config.h).
109
    FAIL_COMPILER is intended as an alternative to #error blows up some
110
    compilers even if it is not on the main compilation path.
111
*/
112
 
113
#ifdef ASSERTS
114
extern int is_true PROTO_S ( ( int ) ) ;
115
extern void assertion PROTO_S ( ( CONST char *, CONST char *, int ) ) ;
116
#if FS_STDC_HASH
117
#define ASSERT( A )	if ( is_true ( !( A ) ) )\
118
			    assertion ( #A, __FILE__, __LINE__ )
119
#define FAIL( A )	assertion ( #A, __FILE__, __LINE__ )
120
#else
121
#define ASSERT( A )	if ( is_true ( !( A ) ) )\
122
			    assertion ( "A", __FILE__, __LINE__ )
123
#define FAIL( A )	assertion ( "A", __FILE__, __LINE__ )
124
#endif
125
#else
126
#if FS_LINT
127
#define ASSERT( A )	/* empty */
128
#define FAIL( A )	/* empty */
129
#else
130
#define ASSERT( A )	( IGNORE 0 )
131
#define FAIL( A )	( IGNORE 0 )
132
#endif
133
#endif
134
 
135
#define FAIL_COMPILER	ERROR [!]
136
 
137
 
138
#endif