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 UTILITY_INCLUDED
|
|
|
32 |
#define UTILITY_INCLUDED
|
|
|
33 |
|
|
|
34 |
|
|
|
35 |
/*
|
|
|
36 |
TEMPORARY WORK SPACE
|
|
|
37 |
|
|
|
38 |
This is used as a scratch work area.
|
|
|
39 |
*/
|
|
|
40 |
|
|
|
41 |
extern char *buffer ;
|
|
|
42 |
#define buffer_size 5000
|
|
|
43 |
|
|
|
44 |
|
|
|
45 |
/*
|
|
|
46 |
PROCEDURE DECLARATIONS
|
|
|
47 |
|
|
|
48 |
These routines are concerned with error reporting and memory
|
|
|
49 |
allocation.
|
|
|
50 |
*/
|
|
|
51 |
|
|
|
52 |
extern void error PROTO_W ( ( int, char *, ... ) ) ;
|
|
|
53 |
extern void comment PROTO_W ( ( int, char *, ... ) ) ;
|
|
|
54 |
extern pointer xalloc PROTO_S ( ( int ) ) ;
|
|
|
55 |
extern pointer xrealloc PROTO_S ( ( pointer, int ) ) ;
|
|
|
56 |
extern char *string_copy PROTO_S ( ( char * ) ) ;
|
|
|
57 |
extern char *string_concat PROTO_S ( ( char *, char * ) ) ;
|
|
|
58 |
|
|
|
59 |
|
|
|
60 |
/*
|
|
|
61 |
ERROR VARIABLES
|
|
|
62 |
|
|
|
63 |
These variables are concerned with error reporting.
|
|
|
64 |
*/
|
|
|
65 |
|
|
|
66 |
extern int exit_status ;
|
|
|
67 |
extern char *progname ;
|
|
|
68 |
|
|
|
69 |
|
|
|
70 |
/*
|
|
|
71 |
ERROR TYPES
|
|
|
72 |
|
|
|
73 |
These values give the severity levels for the error reporting
|
|
|
74 |
routine, error.
|
|
|
75 |
*/
|
|
|
76 |
|
|
|
77 |
#define FATAL 0
|
|
|
78 |
#define INTERNAL 1
|
|
|
79 |
#define SERIOUS 2
|
|
|
80 |
#define OPTION 3
|
|
|
81 |
#define WARNING 4
|
|
|
82 |
#define INFO 5
|
|
|
83 |
|
|
|
84 |
|
|
|
85 |
/*
|
|
|
86 |
UTILITY MACROS
|
|
|
87 |
|
|
|
88 |
These macros give convenient shorthands for various constructs.
|
|
|
89 |
*/
|
|
|
90 |
|
|
|
91 |
#define alloc_size( T, N )\
|
|
|
92 |
( ( int ) ( N ) * ( int ) sizeof ( T ) )
|
|
|
93 |
#define alloc_nof( T, N )\
|
|
|
94 |
( T * ) xalloc ( alloc_size ( T, N ) )
|
|
|
95 |
#define realloc_nof( P, T, N )\
|
|
|
96 |
( T * ) xrealloc ( ( pointer ) ( P ), alloc_size ( T, N ) )
|
|
|
97 |
#define array_size( A )\
|
|
|
98 |
( ( int ) sizeof ( A ) / ( int ) sizeof ( A [0] ) )
|
|
|
99 |
|
|
|
100 |
|
|
|
101 |
#endif
|