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 37... Line 67...
37
 
67
 
38
    The routines in this module are concerned with type checking and type
68
    The routines in this module are concerned with type checking and type
39
    consistency.
69
    consistency.
40
*/
70
*/
41
 
71
 
42
extern ERROR check_object PROTO_S ( ( TYPE ) ) ;
72
extern ERROR check_object(TYPE);
43
extern ERROR check_abstract PROTO_S ( ( TYPE ) ) ;
73
extern ERROR check_abstract(TYPE);
44
extern ERROR check_complete PROTO_S ( ( TYPE ) ) ;
74
extern ERROR check_complete(TYPE);
45
extern ERROR check_incomplete PROTO_S ( ( TYPE ) ) ;
75
extern ERROR check_incomplete(TYPE);
46
extern ERROR check_modifiable PROTO_S ( ( TYPE, EXP ) ) ;
76
extern ERROR check_modifiable(TYPE, EXP);
47
extern TYPE check_pointer PROTO_S ( ( TYPE, ERROR * ) ) ;
77
extern TYPE check_pointer(TYPE, ERROR *);
48
extern TYPE check_compatible PROTO_S ( ( TYPE, TYPE, int, ERROR *, int ) ) ;
78
extern TYPE check_compatible(TYPE, TYPE, int, ERROR *, int);
49
extern TYPE type_composite PROTO_S ( ( TYPE, TYPE, int, int, ERROR *, int ) ) ;
79
extern TYPE type_composite(TYPE, TYPE, int, int, ERROR *, int);
50
extern int is_global_type PROTO_S ( ( TYPE ) ) ;
80
extern int is_global_type(TYPE);
51
extern int unify_type PROTO_S ( ( TYPE, TYPE, CV_SPEC, int ) ) ;
81
extern int unify_type(TYPE, TYPE, CV_SPEC, int);
52
extern unsigned type_category PROTO_S ( ( TYPE * ) ) ;
82
extern unsigned type_category(TYPE *);
53
extern unsigned type_tag PROTO_S ( ( TYPE ) ) ;
83
extern unsigned type_tag(TYPE);
54
 
84
 
55
extern int eq_func_type PROTO_S ( ( TYPE, TYPE, int, int ) ) ;
85
extern int eq_func_type(TYPE, TYPE, int, int);
56
extern int eq_type_qual PROTO_S ( ( TYPE, TYPE, int ) ) ;
86
extern int eq_type_qual(TYPE, TYPE, int);
57
extern int eq_type_offset PROTO_S ( ( TYPE, TYPE ) ) ;
87
extern int eq_type_offset(TYPE, TYPE);
58
extern int eq_itype PROTO_S ( ( INT_TYPE, INT_TYPE ) ) ;
88
extern int eq_itype(INT_TYPE, INT_TYPE);
59
extern int eq_ftype PROTO_S ( ( FLOAT_TYPE, FLOAT_TYPE ) ) ;
89
extern int eq_ftype(FLOAT_TYPE, FLOAT_TYPE);
60
extern int eq_ctype PROTO_S ( ( CLASS_TYPE, CLASS_TYPE ) ) ;
90
extern int eq_ctype(CLASS_TYPE, CLASS_TYPE);
61
extern int eq_etype PROTO_S ( ( ENUM_TYPE, ENUM_TYPE ) ) ;
91
extern int eq_etype(ENUM_TYPE, ENUM_TYPE);
62
extern CV_SPEC cv_compare PROTO_S ( ( TYPE, TYPE ) ) ;
92
extern CV_SPEC cv_compare(TYPE, TYPE);
63
extern CV_SPEC find_cv_qual PROTO_S ( ( TYPE ) ) ;
93
extern CV_SPEC find_cv_qual(TYPE);
64
 
94
 
65
#define eq_type( A, B )			eq_type_qual ( ( A ), ( B ), 0 )
95
#define eq_type(A, B)			eq_type_qual((A), (B), 0)
66
#define eq_type_unqual( A, B )		eq_type_qual ( ( A ), ( B ), 1 )
96
#define eq_type_unqual(A, B)		eq_type_qual((A), (B), 1)
67
 
97
 
68
 
98
 
69
/*
99
/*
70
    TYPE CATEGORIES
100
    TYPE CATEGORIES
71
 
101
 
Line 78... Line 108...
78
	    INT = INTEGER u BITF u ENUM ;
108
	    INT = INTEGER u BITF u ENUM ;
79
	    ARITH = INTEGER u FLOAT u BITF u ENUM ;
109
	    ARITH = INTEGER u FLOAT u BITF u ENUM ;
80
	    OVERLOAD = CLASS u ENUM ;
110
	    OVERLOAD = CLASS u ENUM ;
81
*/
111
*/
82
 
112
 
83
#define CTYPE_NONE			( ( unsigned ) 0x0000 )
113
#define CTYPE_NONE			((unsigned)0x0000)
84
#define CTYPE_INTEGER			( ( unsigned ) 0x0001 )
114
#define CTYPE_INTEGER			((unsigned)0x0001)
85
#define CTYPE_FLOAT			( ( unsigned ) 0x0002 )
115
#define CTYPE_FLOAT			((unsigned)0x0002)
86
#define CTYPE_PTR			( ( unsigned ) 0x0004 )
116
#define CTYPE_PTR			((unsigned)0x0004)
87
#define CTYPE_PTR_MEM			( ( unsigned ) 0x0008 )
117
#define CTYPE_PTR_MEM			((unsigned)0x0008)
88
#define CTYPE_BITF			( ( unsigned ) 0x0010 )
118
#define CTYPE_BITF			((unsigned)0x0010)
89
#define CTYPE_CLASS			( ( unsigned ) 0x0020 )
119
#define CTYPE_CLASS			((unsigned)0x0020)
90
#define CTYPE_ENUM			( ( unsigned ) 0x0040 )
120
#define CTYPE_ENUM			((unsigned)0x0040)
91
#define CTYPE_VOID			( ( unsigned ) 0x0080 )
121
#define CTYPE_VOID			((unsigned)0x0080)
92
#define CTYPE_ERROR			( ( unsigned ) 0x0100 )
122
#define CTYPE_ERROR			((unsigned)0x0100)
93
#define CTYPE_TOKEN			( ( unsigned ) 0x0200 )
123
#define CTYPE_TOKEN			((unsigned)0x0200)
94
#define CTYPE_TEMPL			( ( unsigned ) 0x0400 )
124
#define CTYPE_TEMPL			((unsigned)0x0400)
95
#define CTYPE_LVALUE			( ( unsigned ) 0x0800 )
125
#define CTYPE_LVALUE			((unsigned)0x0800)
96
 
126
 
97
#define CTYPE_INT			( ( unsigned ) 0x0051 )
127
#define CTYPE_INT			((unsigned)0x0051)
98
#define CTYPE_ARITH			( ( unsigned ) 0x0053 )
128
#define CTYPE_ARITH			((unsigned)0x0053)
99
#define CTYPE_SCALAR			( ( unsigned ) 0x0057 )
129
#define CTYPE_SCALAR			((unsigned)0x0057)
100
#define CTYPE_OVERLOAD			( ( unsigned ) 0x0460 )
130
#define CTYPE_OVERLOAD			((unsigned)0x0460)
101
#define CTYPE_ADDRESS			( ( unsigned ) 0x082c )
131
#define CTYPE_ADDRESS			((unsigned)0x082c)
102
 
132
 
103
#define IS_TYPE_INTEGER( C )		( ( C ) & CTYPE_INTEGER )
133
#define IS_TYPE_INTEGER(C)		((C) & CTYPE_INTEGER)
104
#define IS_TYPE_FLOAT( C )		( ( C ) & CTYPE_FLOAT )
134
#define IS_TYPE_FLOAT(C)		((C) & CTYPE_FLOAT)
105
#define IS_TYPE_PTR( C )		( ( C ) & CTYPE_PTR )
135
#define IS_TYPE_PTR(C)			((C) & CTYPE_PTR)
106
#define IS_TYPE_PTR_MEM( C )		( ( C ) & CTYPE_PTR_MEM )
136
#define IS_TYPE_PTR_MEM(C)		((C) & CTYPE_PTR_MEM)
107
#define IS_TYPE_BITF( C )		( ( C ) & CTYPE_BITF )
137
#define IS_TYPE_BITF(C)			((C) & CTYPE_BITF)
108
#define IS_TYPE_CLASS( C )		( ( C ) & CTYPE_CLASS )
138
#define IS_TYPE_CLASS(C)		((C) & CTYPE_CLASS)
109
#define IS_TYPE_ENUM( C )		( ( C ) & CTYPE_ENUM )
139
#define IS_TYPE_ENUM(C)			((C) & CTYPE_ENUM)
110
#define IS_TYPE_VOID( C )		( ( C ) & CTYPE_VOID )
140
#define IS_TYPE_VOID(C)			((C) & CTYPE_VOID)
111
#define IS_TYPE_ERROR( C )		( ( C ) & CTYPE_ERROR )
141
#define IS_TYPE_ERROR(C)		((C) & CTYPE_ERROR)
112
#define IS_TYPE_TOKEN( C )		( ( C ) & CTYPE_TOKEN )
142
#define IS_TYPE_TOKEN(C)		((C) & CTYPE_TOKEN)
113
#define IS_TYPE_TEMPL( C )		( ( C ) & CTYPE_TEMPL )
143
#define IS_TYPE_TEMPL(C)		((C) & CTYPE_TEMPL)
114
#define IS_TYPE_LVALUE( C )		( ( C ) & CTYPE_LVALUE )
144
#define IS_TYPE_LVALUE(C)		((C) & CTYPE_LVALUE)
115
 
145
 
116
#define IS_TYPE_INT( C )		( ( C ) & CTYPE_INT )
146
#define IS_TYPE_INT(C)			((C) & CTYPE_INT)
117
#define IS_TYPE_ARITH( C )		( ( C ) & CTYPE_ARITH )
147
#define IS_TYPE_ARITH(C)		((C) & CTYPE_ARITH)
118
#define IS_TYPE_SCALAR( C )		( ( C ) & CTYPE_SCALAR )
148
#define IS_TYPE_SCALAR(C)		((C) & CTYPE_SCALAR)
119
#define IS_TYPE_OVERLOAD( C )		( ( C ) & CTYPE_OVERLOAD )
149
#define IS_TYPE_OVERLOAD(C)		((C) & CTYPE_OVERLOAD)
120
#define IS_TYPE_ADDRESS( C )		( ( C ) & CTYPE_ADDRESS )
150
#define IS_TYPE_ADDRESS(C)		((C) & CTYPE_ADDRESS)
121
 
151
 
122
 
152
 
123
#endif
153
#endif