Subversion Repositories tendra.SVN

Rev

Rev 2 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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