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 38... |
Line 68... |
38 |
The routines in this module are concerned with the construction of
|
68 |
The routines in this module are concerned with the construction of
|
39 |
integer, floating-point, character, string and boolean literal
|
69 |
integer, floating-point, character, string and boolean literal
|
40 |
expressions.
|
70 |
expressions.
|
41 |
*/
|
71 |
*/
|
42 |
|
72 |
|
43 |
extern EXP make_literal_exp PROTO_S ( ( string, int *, int ) ) ;
|
73 |
extern EXP make_literal_exp(string, int *, int);
|
44 |
extern EXP make_bool_exp PROTO_S ( ( unsigned, unsigned ) ) ;
|
74 |
extern EXP make_bool_exp(unsigned, unsigned);
|
45 |
extern EXP make_string_exp PROTO_S ( ( STRING ) ) ;
|
75 |
extern EXP make_string_exp(STRING);
|
46 |
|
76 |
|
47 |
extern int is_zero_float PROTO_S ( ( FLOAT ) ) ;
|
77 |
extern int is_zero_float(FLOAT);
|
48 |
extern int eq_float_lit PROTO_S ( ( FLOAT, FLOAT ) ) ;
|
78 |
extern int eq_float_lit(FLOAT, FLOAT);
|
49 |
extern int eq_string_lit PROTO_S ( ( STRING, STRING ) ) ;
|
79 |
extern int eq_string_lit(STRING, STRING);
|
50 |
extern unsigned test_bool_exp PROTO_S ( ( EXP ) ) ;
|
80 |
extern unsigned test_bool_exp(EXP);
|
51 |
extern unsigned long eval_line_digits PROTO_S ( ( string, unsigned * ) ) ;
|
81 |
extern unsigned long eval_line_digits(string, unsigned *);
|
52 |
extern unsigned long get_multi_char PROTO_S ( ( string, int * ) ) ;
|
82 |
extern unsigned long get_multi_char(string, int *);
|
53 |
extern unsigned long get_string_char PROTO_S ( ( STRING, int * ) ) ;
|
83 |
extern unsigned long get_string_char(STRING, int *);
|
54 |
extern void add_multi_char PROTO_S ( ( string, unsigned long, int ) ) ;
|
84 |
extern void add_multi_char(string, unsigned long, int);
|
55 |
extern unsigned long eval_unicode PROTO_S ( ( int, unsigned, int *, string *, ERROR * ) ) ;
|
85 |
extern unsigned long eval_unicode(int, unsigned, int *, string *, ERROR *);
|
56 |
extern TYPE find_literal_type PROTO_S ( ( NAT, int, int, string, int * ) ) ;
|
86 |
extern TYPE find_literal_type(NAT, int, int, string, int *);
|
57 |
extern TYPE find_char_type PROTO_S ( ( NAT ) ) ;
|
87 |
extern TYPE find_char_type(NAT);
|
58 |
extern NAT round_float_lit PROTO_S ( ( FLOAT, RMODE ) ) ;
|
88 |
extern NAT round_float_lit(FLOAT, RMODE);
|
59 |
extern STRING new_string_lit PROTO_S ( ( string, string, int ) ) ;
|
89 |
extern STRING new_string_lit(string, string, int);
|
60 |
extern STRING concat_string_lit PROTO_S ( ( STRING, STRING ) ) ;
|
90 |
extern STRING concat_string_lit(STRING, STRING);
|
61 |
extern STRING share_string_lit PROTO_S ( ( STRING ) ) ;
|
91 |
extern STRING share_string_lit(STRING);
|
62 |
extern NAT eval_char_lit PROTO_S ( ( STRING ) ) ;
|
92 |
extern NAT eval_char_lit(STRING);
|
63 |
extern int get_char_value PROTO_S ( ( EXP ) ) ;
|
93 |
extern int get_char_value(EXP);
|
64 |
extern void begin_literal PROTO_S ( ( int, int ) ) ;
|
94 |
extern void begin_literal(int, int);
|
65 |
extern void add_range_literal PROTO_S ( ( EXP, int ) ) ;
|
95 |
extern void add_range_literal(EXP, int);
|
66 |
extern void add_type_literal PROTO_S ( ( TYPE ) ) ;
|
96 |
extern void add_type_literal(TYPE);
|
67 |
extern void add_token_literal PROTO_S ( ( IDENTIFIER, unsigned ) ) ;
|
97 |
extern void add_token_literal(IDENTIFIER, unsigned);
|
68 |
extern void set_string_qual PROTO_S ( ( CV_SPEC ) ) ;
|
98 |
extern void set_string_qual(CV_SPEC);
|
69 |
extern void set_escape PROTO_S ( ( EXP, EXP ) ) ;
|
99 |
extern void set_escape(EXP, EXP);
|
70 |
extern void set_char_lit PROTO_S ( ( TYPE ) ) ;
|
100 |
extern void set_char_lit(TYPE);
|
71 |
extern void init_literal PROTO_S ( ( void ) ) ;
|
101 |
extern void init_literal(void);
|
72 |
|
102 |
|
73 |
extern unsigned char digit_values [] ;
|
103 |
extern unsigned char digit_values[];
|
74 |
extern unsigned char escape_sequences [] ;
|
104 |
extern unsigned char escape_sequences[];
|
75 |
extern RMODE crt_round_mode ;
|
105 |
extern RMODE crt_round_mode;
|
76 |
extern CV_SPEC cv_string ;
|
106 |
extern CV_SPEC cv_string;
|
77 |
|
107 |
|
78 |
|
108 |
|
79 |
/*
|
109 |
/*
|
80 |
STRING TYPES
|
110 |
STRING TYPES
|
81 |
|
111 |
|
82 |
The values STRING_* form a bitfield which is used to identify the
|
112 |
The values STRING_* form a bitfield which is used to identify the
|
83 |
various types of string literals. The values CHAR_* are used to
|
113 |
various types of string literals. The values CHAR_* are used to
|
84 |
identify the various types of character in multibyte strings.
|
114 |
identify the various types of character in multibyte strings.
|
85 |
*/
|
115 |
*/
|
86 |
|
116 |
|
87 |
#define STRING_NONE ( ( unsigned ) 0x00 )
|
117 |
#define STRING_NONE ((unsigned)0x00)
|
88 |
#define STRING_CHAR ( ( unsigned ) 0x01 )
|
118 |
#define STRING_CHAR ((unsigned)0x01)
|
89 |
#define STRING_WIDE ( ( unsigned ) 0x02 )
|
119 |
#define STRING_WIDE ((unsigned)0x02)
|
90 |
#define STRING_MULTI ( ( unsigned ) 0x04 )
|
120 |
#define STRING_MULTI ((unsigned)0x04)
|
91 |
#define STRING_FAT ( ( unsigned ) 0x08 )
|
121 |
#define STRING_FAT ((unsigned)0x08)
|
92 |
#define CHAR_SIMPLE 0
|
122 |
#define CHAR_SIMPLE 0
|
93 |
#define CHAR_ASCII 1
|
123 |
#define CHAR_ASCII 1
|
94 |
#define CHAR_OCTAL 2
|
124 |
#define CHAR_OCTAL 2
|
95 |
#define CHAR_HEX 3
|
125 |
#define CHAR_HEX 3
|
96 |
#define CHAR_UNI4 4
|
126 |
#define CHAR_UNI4 4
|
Line 105... |
Line 135... |
105 |
These values give the boolean values, true and false, plus a third
|
135 |
These values give the boolean values, true and false, plus a third
|
106 |
value indicating an indeterminate boolean. A fourth error value is
|
136 |
value indicating an indeterminate boolean. A fourth error value is
|
107 |
also given.
|
137 |
also given.
|
108 |
*/
|
138 |
*/
|
109 |
|
139 |
|
110 |
#define BOOL_FALSE ( ( unsigned ) 0 )
|
140 |
#define BOOL_FALSE ((unsigned)0)
|
111 |
#define BOOL_TRUE ( ( unsigned ) 1 )
|
141 |
#define BOOL_TRUE ((unsigned)1)
|
112 |
#define BOOL_UNKNOWN ( ( unsigned ) 2 )
|
142 |
#define BOOL_UNKNOWN ((unsigned)2)
|
113 |
#define BOOL_INVALID ( ( unsigned ) 3 )
|
143 |
#define BOOL_INVALID ((unsigned)3)
|
114 |
#define BOOL_VALUE( C ) ( ( C ) ? BOOL_TRUE : BOOL_FALSE )
|
144 |
#define BOOL_VALUE(C) ((C)? BOOL_TRUE : BOOL_FALSE)
|
115 |
#define BOOL_NEGATE( C ) ( ( C ) ? BOOL_FALSE : BOOL_TRUE )
|
145 |
#define BOOL_NEGATE(C) ((C)? BOOL_FALSE : BOOL_TRUE)
|
116 |
|
146 |
|
117 |
|
147 |
|
118 |
/*
|
148 |
/*
|
119 |
LITERAL BASE AND SUFFIX VALUES
|
149 |
LITERAL BASE AND SUFFIX VALUES
|
120 |
|
150 |
|
Line 133... |
Line 163... |
133 |
#define SUFFIX_UL 3
|
163 |
#define SUFFIX_UL 3
|
134 |
#define SUFFIX_LL 4
|
164 |
#define SUFFIX_LL 4
|
135 |
#define SUFFIX_ULL 5
|
165 |
#define SUFFIX_ULL 5
|
136 |
#define SUFFIX_NO 6
|
166 |
#define SUFFIX_NO 6
|
137 |
|
167 |
|
138 |
#define SUFFIX( U, L ) ( 2 * ( L ) + ( U ) )
|
168 |
#define SUFFIX(U, L) (2 * (L) + (U))
|
139 |
|
169 |
|
140 |
|
170 |
|
141 |
#endif
|
171 |
#endif
|