Subversion Repositories tendra.SVN

Rev

Rev 5 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 7u83 1
/*
6 7u83 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
 */
31
/*
2 7u83 32
    		 Crown Copyright (c) 1997
6 7u83 33
 
2 7u83 34
    This TenDRA(r) Computer Program is subject to Copyright
35
    owned by the United Kingdom Secretary of State for Defence
36
    acting through the Defence Evaluation and Research Agency
37
    (DERA).  It is made available to Recipients with a
38
    royalty-free licence for its use, reproduction, transfer
39
    to other parties and amendment for any purpose not excluding
40
    product development provided that any such use et cetera
41
    shall be deemed to be acceptance of the following conditions:-
6 7u83 42
 
2 7u83 43
        (1) Its Recipients shall ensure that this Notice is
44
        reproduced upon any copies or amended versions of it;
6 7u83 45
 
2 7u83 46
        (2) Any amended version of it shall be clearly marked to
47
        show both the nature of and the organisation responsible
48
        for the relevant amendment or amendments;
6 7u83 49
 
2 7u83 50
        (3) Its onward transfer from a recipient to another
51
        party shall be deemed to be that party's acceptance of
52
        these conditions;
6 7u83 53
 
2 7u83 54
        (4) DERA gives no warranty or assurance as to its
55
        quality or suitability for any purpose and DERA accepts
56
        no liability whatsoever in relation to any use to which
57
        it may be put.
58
*/
59
 
60
 
61
#ifndef CHKTYPE_INCLUDED
62
#define CHKTYPE_INCLUDED
63
 
64
 
65
/*
66
    TYPE CHECKING DECLARATIONS
67
 
68
    The routines in this module are concerned with type checking and type
69
    consistency.
70
*/
71
 
6 7u83 72
extern ERROR check_object(TYPE);
73
extern ERROR check_abstract(TYPE);
74
extern ERROR check_complete(TYPE);
75
extern ERROR check_incomplete(TYPE);
76
extern ERROR check_modifiable(TYPE, EXP);
77
extern TYPE check_pointer(TYPE, ERROR *);
78
extern TYPE check_compatible(TYPE, TYPE, int, ERROR *, int);
79
extern TYPE type_composite(TYPE, TYPE, int, int, ERROR *, int);
80
extern int is_global_type(TYPE);
81
extern int unify_type(TYPE, TYPE, CV_SPEC, int);
82
extern unsigned type_category(TYPE *);
83
extern unsigned type_tag(TYPE);
2 7u83 84
 
6 7u83 85
extern int eq_func_type(TYPE, TYPE, int, int);
86
extern int eq_type_qual(TYPE, TYPE, int);
87
extern int eq_type_offset(TYPE, TYPE);
88
extern int eq_itype(INT_TYPE, INT_TYPE);
89
extern int eq_ftype(FLOAT_TYPE, FLOAT_TYPE);
90
extern int eq_ctype(CLASS_TYPE, CLASS_TYPE);
91
extern int eq_etype(ENUM_TYPE, ENUM_TYPE);
92
extern CV_SPEC cv_compare(TYPE, TYPE);
93
extern CV_SPEC find_cv_qual(TYPE);
2 7u83 94
 
6 7u83 95
#define eq_type(A, B)			eq_type_qual((A), (B), 0)
96
#define eq_type_unqual(A, B)		eq_type_qual((A), (B), 1)
2 7u83 97
 
98
 
99
/*
100
    TYPE CATEGORIES
101
 
102
    These macros are used to describe the various categories of types.  The
103
    class value associated with a type can be found using type_category.
104
    There are categories for each of the basic kinds of type - integral
105
    types, pointer types etc. plus a category for lvalues.  Other categories
106
    are unions of existing categories, for example:
107
 
108
	    INT = INTEGER u BITF u ENUM ;
109
	    ARITH = INTEGER u FLOAT u BITF u ENUM ;
110
	    OVERLOAD = CLASS u ENUM ;
111
*/
112
 
6 7u83 113
#define CTYPE_NONE			((unsigned)0x0000)
114
#define CTYPE_INTEGER			((unsigned)0x0001)
115
#define CTYPE_FLOAT			((unsigned)0x0002)
116
#define CTYPE_PTR			((unsigned)0x0004)
117
#define CTYPE_PTR_MEM			((unsigned)0x0008)
118
#define CTYPE_BITF			((unsigned)0x0010)
119
#define CTYPE_CLASS			((unsigned)0x0020)
120
#define CTYPE_ENUM			((unsigned)0x0040)
121
#define CTYPE_VOID			((unsigned)0x0080)
122
#define CTYPE_ERROR			((unsigned)0x0100)
123
#define CTYPE_TOKEN			((unsigned)0x0200)
124
#define CTYPE_TEMPL			((unsigned)0x0400)
125
#define CTYPE_LVALUE			((unsigned)0x0800)
2 7u83 126
 
6 7u83 127
#define CTYPE_INT			((unsigned)0x0051)
128
#define CTYPE_ARITH			((unsigned)0x0053)
129
#define CTYPE_SCALAR			((unsigned)0x0057)
130
#define CTYPE_OVERLOAD			((unsigned)0x0460)
131
#define CTYPE_ADDRESS			((unsigned)0x082c)
2 7u83 132
 
6 7u83 133
#define IS_TYPE_INTEGER(C)		((C) & CTYPE_INTEGER)
134
#define IS_TYPE_FLOAT(C)		((C) & CTYPE_FLOAT)
135
#define IS_TYPE_PTR(C)			((C) & CTYPE_PTR)
136
#define IS_TYPE_PTR_MEM(C)		((C) & CTYPE_PTR_MEM)
137
#define IS_TYPE_BITF(C)			((C) & CTYPE_BITF)
138
#define IS_TYPE_CLASS(C)		((C) & CTYPE_CLASS)
139
#define IS_TYPE_ENUM(C)			((C) & CTYPE_ENUM)
140
#define IS_TYPE_VOID(C)			((C) & CTYPE_VOID)
141
#define IS_TYPE_ERROR(C)		((C) & CTYPE_ERROR)
142
#define IS_TYPE_TOKEN(C)		((C) & CTYPE_TOKEN)
143
#define IS_TYPE_TEMPL(C)		((C) & CTYPE_TEMPL)
144
#define IS_TYPE_LVALUE(C)		((C) & CTYPE_LVALUE)
2 7u83 145
 
6 7u83 146
#define IS_TYPE_INT(C)			((C) & CTYPE_INT)
147
#define IS_TYPE_ARITH(C)		((C) & CTYPE_ARITH)
148
#define IS_TYPE_SCALAR(C)		((C) & CTYPE_SCALAR)
149
#define IS_TYPE_OVERLOAD(C)		((C) & CTYPE_OVERLOAD)
150
#define IS_TYPE_ADDRESS(C)		((C) & CTYPE_ADDRESS)
2 7u83 151
 
152
 
153
#endif