Subversion Repositories tendra.SVN

Rev

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