5 * File name: ir/external/read.c
6 * Purpose: Read descriptions of external effects
11 * Copyright: (c) 1999-2004 Universität Karlsruhe
12 * Licence: This file is protected by GPL - GNU GENERAL PUBLIC LICENSE.
22 # endif /* ! defined _GNU_SOURCE */
30 # include <libxml/xmlmemory.h>
31 # include <libxml/parser.h>
32 # include <libxml/encoding.h>
38 # define MY_ENCODING "ISO-8859-1"
40 /* quick hack until we get a cmd line flag or something: just add
41 '-DEXTERN_VERBOSE' to 'CFLAGS' */
42 # ifndef EXTERN_VERBOSE
43 # define EXTERN_VERBOSE 1
45 # define EXTERN_VERBOSE 0
46 # endif /* defined EXTERN_VERBOSE */
48 # define CHECK(ptr,msg) assert (ptr && msg)
50 # define NODE_NAME(n, m) (0 == xmlStrcmp (n->name, (const xmlChar*) #m))
51 # define CHECK_NAME(n, m) assert (0 == xmlStrcmp (n->name, (const xmlChar*) #m))
53 # define NEW(T) (T*) malloc (sizeof (T))
55 /* first, the xml structures */
57 typedef struct type_str
61 entity *f_tp; /* firm type */
62 struct type_str *prev; /* linked list */
65 typedef struct entity_str
70 type *f_ent; /* firm entity */
71 struct entity_str *prev; /* linked list */
74 /* now the xml nodes */
75 typedef enum eff_node_kind {
89 /* dummy type for all other effects */
90 typedef struct eff_str
95 typedef struct effs_str
100 struct effs_str *next;
103 typedef struct arg_str
105 eff_node_kind_t kind;
110 typedef struct valref_str
112 eff_node_kind_t kind;
116 typedef struct select_str
118 eff_node_kind_t kind;
119 int valrefid; /* id of enclosed valref node, or -1 */
123 typedef struct load_str
125 eff_node_kind_t kind;
127 int ptrrefid; /* id of valref node enclosed in select, or -1 */
131 typedef struct store_str
133 eff_node_kind_t kind;
134 int ptrrefid; /* id of ptr valref node enclosed in select, or -1 */
135 int valrefid; /* id of val valref node enclosed in select, or -1 */
139 typedef struct alloc_str
141 eff_node_kind_t kind;
146 typedef struct call_str
148 eff_node_kind_t kind;
150 int valrefid; /* id of enclosed valref node, or -1 */
151 entity_t *ent; /* called entity */
156 typedef struct unknown_str
158 eff_node_kind_t kind;
162 typedef struct join_str
164 eff_node_kind_t kind;
170 typedef struct ret_str
172 eff_node_kind_t kind;
173 int ret_id; /* returned value, or -1 */
176 typedef struct raise_str
178 eff_node_kind_t kind;
179 /* struct eff_str *next; */
180 int valref; /* what was that one for? */
188 /** get the type entry with the given name */
189 type_t *getTypeByName (const char*);
191 /** get the type entry with the given Id */
192 type_t *getTypeById (const int);
194 /** get the entity entry that has the given names */
195 entity_t *getEntityByNames (const char*, const char*);
197 /** get the entity entry that has the given Id */
198 entity_t *getEntityById (const int);
200 /** get the effect entry for the given name */
201 effs_t *getEffectByName (const char*);
203 /** initialise the data structures */
204 void extern_init (void);
206 /** read in the file of the given name */
207 void extern_read (const char*);
209 /** clean up our mess */
210 void extern_cleanup (void);
212 # endif /* defined _READ_H_ */
216 Revision 1.4 2004/10/13 11:56:16 liekweg
217 need strdup, don't need _GNU_SOURCE (wtf?)
219 Revision 1.3 2004/10/13 08:39:59 liekweg
222 Revision 1.2 2004/10/11 15:56:09 liekweg
223 Cleanup, comments ...
224 Added init func --flo
226 Revision 1.1 2004/10/11 09:31:06 liekweg
227 First Import of XML reading procs --flo