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 CONVERT_INCLUDED
32
#define CONVERT_INCLUDED
33
 
34
 
35
/*
36
    TYPE REPRESENTING AN IMPLICIT CONVERSION SEQUENCE
37
 
38
    This type is used to represent an implicit conversion sequence.  The
39
    main components are the two types being converted from and to, and
40
    the overall rank of the conversion (see below).  For user-defined
41
    conversions, the conversion function used and the rank of the following
42
    standard conversion are recorded.  For base class and qualification
43
    conversions the associated data is also recorded.
44
*/
45
 
46
typedef struct {
47
    TYPE from, to ;
48
    unsigned rank ;
49
    unsigned std ;
50
    IDENTIFIER usr ;
51
    GRAPH base ;
52
    CV_SPEC qual ;
53
} CONVERSION ;
54
 
55
 
56
/*
57
    TYPE CONVERSION DECLARATIONS
58
 
59
    The routines in this module are concerned with the standard C and C++
60
    type conversions.
61
*/
62
 
63
extern TYPE arith_type PROTO_S ( ( TYPE, TYPE, EXP, EXP ) ) ;
64
extern TYPE promote_type PROTO_S ( ( TYPE ) ) ;
65
extern TYPE unpromote_type PROTO_S ( ( TYPE ) ) ;
66
extern TYPE arg_promote_type PROTO_S ( ( TYPE, ERROR * ) ) ;
67
extern TYPE ptr_common_type PROTO_S ( ( TYPE, TYPE, int, int * ) ) ;
68
extern TYPE ptr_mem_common_type PROTO_S ( ( TYPE, TYPE, int * ) ) ;
69
extern TYPE common_type PROTO_S ( ( TYPE, TYPE, int * ) ) ;
70
extern unsigned check_qualifier PROTO_S ( ( TYPE, TYPE, int ) ) ;
71
extern int is_arg_promote PROTO_S ( ( TYPE ) ) ;
72
extern int qualifier_depth ;
73
 
74
extern EXP convert_arith PROTO_S ( ( TYPE, EXP, int, int ) ) ;
75
extern EXP convert_bitfield PROTO_S ( ( EXP ) ) ;
76
extern EXP convert_boolean PROTO_S ( ( EXP, unsigned, ERROR * ) ) ;
77
extern EXP convert_array PROTO_S ( ( EXP, int, ERROR * ) ) ;
78
extern EXP convert_lvalue PROTO_S ( ( EXP ) ) ;
79
extern EXP convert_none PROTO_S ( ( EXP ) ) ;
80
extern EXP convert_const PROTO_S ( ( EXP ) ) ;
81
extern EXP convert_promote PROTO_S ( ( TYPE, EXP ) ) ;
82
extern EXP convert_ptr_common PROTO_S ( ( TYPE, EXP, int, int ) ) ;
83
extern EXP convert_ptr_mem_common PROTO_S ( ( TYPE, EXP, int, int ) ) ;
84
extern EXP convert_reference PROTO_S ( ( EXP, int ) ) ;
85
extern TYPE convert_qual_type PROTO_S ( ( TYPE ) ) ;
86
 
87
extern unsigned convert_seq PROTO_S ( ( CONVERSION *, EXP, int, int ) ) ;
88
extern unsigned std_convert_seq PROTO_S ( ( CONVERSION *, EXP, int, int ) ) ;
89
extern int compare_seq PROTO_S ( ( CONVERSION *, CONVERSION * ) ) ;
90
extern int is_ambiguous_func PROTO_S ( ( IDENTIFIER ) ) ;
91
 
92
 
93
/*
94
    QUALIFICATION CONVERSION RULES
95
 
96
    These values comprise the bitpattern returned by check_qualifier.  They
97
    indicate which of the conditions required by the qualifaction conversions
98
    are satisfied by a particular pair of types.  They are also used to
99
    indicate whether the types are equal or equal functions.
100
*/
101
 
102
#define QUAL_SIMILAR		( ( unsigned ) 0x01 )
103
#define QUAL_CONST		( ( unsigned ) 0x02 )
104
#define QUAL_VOLATILE		( ( unsigned ) 0x04 )
105
#define QUAL_ALL_CONST		( ( unsigned ) 0x08 )
106
#define QUAL_EXACT		( ( unsigned ) 0x10 )
107
#define QUAL_FUNC		( ( unsigned ) 0x20 )
108
#define QUAL_TEMPL		( ( unsigned ) 0x40 )
109
 
110
#define QUAL_CV			( ( unsigned ) 0x0e )
111
#define QUAL_OK			( ( unsigned ) 0x0f )
112
#define QUAL_EQUAL		( ( unsigned ) 0x1f )
113
#define QUAL_EQ_FUNC		( ( unsigned ) 0x3f )
114
 
115
 
116
/*
117
    CONVERSION SEQUENCE RANKS
118
 
119
    These values are used to indicate the various ranks of implicit
120
    conversion sequences used within overload resolution.  The upper byte
121
    gives the conversion rank (the higher the value, the better the
122
    conversion), while the lower byte gives further information on the
123
    dominant conversion.
124
*/
125
 
126
#define CONV_EXACT		( ( unsigned ) 0x60 )
127
 
128
#define CONV_QUAL		( ( unsigned ) 0x50 )
129
#define CONV_STRING		( ( unsigned ) 0x51 )
130
 
131
#define CONV_INT_PROM		( ( unsigned ) 0x40 )
132
#define CONV_FLT_PROM		( ( unsigned ) 0x41 )
133
#define CONV_BITFIELD		( ( unsigned ) 0x42 )
134
 
135
#define CONV_INT_INT		( ( unsigned ) 0x30 )
136
#define CONV_FLT_FLT		( ( unsigned ) 0x31 )
137
#define CONV_INT_FLT		( ( unsigned ) 0x32 )
138
#define CONV_FLT_INT		( ( unsigned ) 0x33 )
139
#define CONV_PTR_BASE		( ( unsigned ) 0x34 )
140
#define CONV_PTR_VOID		( ( unsigned ) 0x35 )
141
#define CONV_PTR_BOTTOM		( ( unsigned ) 0x36 )
142
#define CONV_PTR_NULL		( ( unsigned ) 0x37 )
143
#define CONV_PTR_MEM_BASE	( ( unsigned ) 0x38 )
144
#define CONV_PTR_MEM_NULL	( ( unsigned ) 0x39 )
145
#define CONV_BASE		( ( unsigned ) 0x3a )
146
#define CONV_BOOL		( ( unsigned ) 0x3b )
147
 
148
#define CONV_USER		( ( unsigned ) 0x20 )
149
#define CONV_USER_MULTI		( ( unsigned ) 0x21 )
150
 
151
#define CONV_ELLIPSIS		( ( unsigned ) 0x10 )
152
 
153
#define CONV_NONE		( ( unsigned ) 0x00 )
154
#define CONV_NULL		( ( unsigned ) 0x01 )
155
#define CONV_PTR_PTR		( ( unsigned ) 0x02 )
156
#define CONV_PTR_PTR_ALIGN	( ( unsigned ) 0x03 )
157
#define CONV_INT_PTR		( ( unsigned ) 0x04 )
158
#define CONV_PTR_INT		( ( unsigned ) 0x05 )
159
#define CONV_PTR_MEM_PTR_MEM	( ( unsigned ) 0x06 )
160
#define CONV_PTR_MEM_FUNC	( ( unsigned ) 0x07 )
161
#define CONV_FUNC		( ( unsigned ) 0x08 )
162
#define CONV_ENUM		( ( unsigned ) 0x09 )
163
 
164
#define CONV_REVERSE		( ( unsigned ) 0x80 )
165
 
166
#define CONV_RANK( A )		( ( A ) & 0x70 )
167
 
168
 
169
/*
170
    REFERENCE CONVERSION CONTEXTS
171
 
172
    These values are used in convert_reference to indicate the various
173
    contexts for reference conversion.
174
*/
175
 
176
#define REF_NORMAL		0
177
#define REF_FUNCTION		1
178
#define REF_ASSIGN		2
179
#define REF_ADDRESS		3
180
 
181
 
182
#endif