Subversion Repositories tendra.SVN

Rev

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

Rev Author Line No. Line
2 7u83 1
/*
7 7u83 2
 * Copyright (c) 2002-2005 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
7 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:-
7 7u83 42
 
2 7u83 43
        (1) Its Recipients shall ensure that this Notice is
44
        reproduced upon any copies or amended versions of it;
7 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;
7 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;
7 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 OBJECT_INCLUDED
62
#define OBJECT_INCLUDED
63
 
7 7u83 64
#ifndef CONFIG_INCLUDED
65
#include "config.h"
66
#endif
2 7u83 67
 
68
/*
69
    FORWARD STRUCTURE DECLARATIONS
70
 
71
    A number of types are defined recursively, these are declared here.
72
*/
73
 
7 7u83 74
struct field_tag;
75
struct info_tag;
76
struct type_tag;
2 7u83 77
 
78
 
79
/*
80
    TYPE REPRESENTING AN OBJECT
81
 
82
    This type is used to represent a general object of list of objects.
83
    Each object has an associated name, an object type, a union giving
84
    different information for different object types, and a pointer to
85
    the next object.
86
*/
87
 
88
typedef struct object_tag {
7 7u83 89
    char *name;
90
    int objtype;
2 7u83 91
    union {
7 7u83 92
	int u_num;
93
	char *u_str;
94
	FILE *u_file;
95
	struct field_tag *u_field;
96
	struct info_tag *u_info;
97
	struct object_tag *u_obj;
98
	struct type_tag *u_type;
99
    } u;
100
    struct object_tag *next;
101
    char *filename;
102
    int line_no;
103
} object;
2 7u83 104
 
105
 
106
/*
107
    OBJECT TYPES
108
 
109
    These values give the various values for the objtype field of an
110
    object.  For each object type, the corresponding field of the union
111
    is given.
112
*/
113
 
114
#define OBJ_CONST		0	/* u_type */
115
#define OBJ_DEFINE		1	/* u_str */
116
#define OBJ_ENUM		2	/* u_type */
117
#define OBJ_ENUMVAL		3	/* u_str */
118
#define OBJ_EXP			4	/* u_type */
119
#define OBJ_EXTERN		5	/* u_type */
120
#define OBJ_FIELD		6	/* u_field */
121
#define OBJ_FILE		7	/* u_file */
122
#define OBJ_FUNC		8	/* u_type */
123
#define OBJ_IF			9	/* u_num */
124
#define OBJ_IMPLEMENT		10	/* u_obj */
125
#define OBJ_MACRO		11	/* u_str */
126
#define OBJ_NAT			12	/* none */
127
#define OBJ_SET			13	/* u_obj */
128
#define OBJ_STATEMENT		14	/* u_type */
129
#define OBJ_SUBSET		15	/* u_info */
130
#define OBJ_TEXT_INCL		16	/* none */
131
#define OBJ_TEXT_SRC		17	/* none */
132
#define OBJ_TOKEN		18	/* u_obj or u_str */
133
#define OBJ_TYPE		19	/* u_type */
134
#define OBJ_USE			20	/* u_obj */
135
#define OBJ_WEAK		21	/* u_type */
136
#define OBJ_KEYWORD		22	/* u_num */
7 7u83 137
#define OBJ_DEFMIN		23	/* u_str */
2 7u83 138
 
139
 
140
/*
141
    SUBTYPES FOR IF STATEMENTS
142
 
7 7u83 143
    Objects of type OBJ_IF are classified by a number indicating the
2 7u83 144
    corresponding directive.
145
*/
146
 
147
#define CMD_END			0
148
#define CMD_IF			1
149
#define CMD_IFDEF		2
150
#define CMD_IFNDEF		3
151
#define CMD_ELSE		4
152
#define CMD_ENDIF		5
153
#define CMD_NONE		6
154
 
155
 
156
/*
157
    SUBSET INFORMATION
158
 
159
    This routine is used to represent subset information.
160
*/
161
 
162
typedef struct info_tag {
7 7u83 163
    char *api, *file, *subset;
164
    time_t age;
165
    char *incl, *src;
166
    char *block;
167
    char *linkage;
168
    char *nspace;
169
    char *method;
170
    char *prefix;
171
    char *protect;
172
    char *version;
173
    boolean tokens;
174
    int implemented;
175
    object *elements;
176
} info;
2 7u83 177
 
178
 
179
/*
180
    PROCEDURE DECLARATIONS
181
 
182
    These routines are concerned with creating and manipulating objects.
183
*/
184
 
7 7u83 185
extern object *make_object(char *, int);
186
extern object *join_object(object *, object *);
187
extern object *make_subset(char *);
188
extern info *make_info(char *, char *, char *);
189
extern object *make_token(char *, int, object *, int);
190
extern object *make_exp(char *, int, int);
191
extern void update_time(object *, object *);
2 7u83 192
 
193
 
194
#endif