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.
23 # include <libxml/xmlmemory.h>
24 # include <libxml/parser.h>
25 # include <libxml/encoding.h>
33 # endif /* ! defined _BSD_SOURCE */
35 # define MY_ENCODING "ISO-8859-1"
37 /* quick hack until we get a cmd line flag or something: just add
38 '-DEXTERN_VERBOSE' to 'CFLAGS' */
39 # ifndef EXTERN_VERBOSE
40 # define EXTERN_VERBOSE 1
42 # define EXTERN_VERBOSE 0
43 # endif /* defined EXTERN_VERBOSE */
45 # define CHECK(ptr,msg) assert (ptr && msg)
47 # define NODE_NAME(n, m) (0 == xmlStrcmp (n->name, (const xmlChar*) #m))
48 # define CHECK_NAME(n, m) assert (0 == xmlStrcmp (n->name, (const xmlChar*) #m))
50 # define NEW(T) (T*) malloc (sizeof (T))
52 /* first, the xml structures */
54 typedef struct type_str
58 entity *f_tp; /* firm type */
59 struct type_str *prev; /* linked list */
62 typedef struct entity_str
67 type *f_ent; /* firm entity */
68 struct entity_str *prev; /* linked list */
71 /* now the xml nodes */
72 typedef enum eff_node_kind {
86 /* dummy type for all other effects */
87 typedef struct eff_str
92 typedef struct effs_str
97 struct effs_str *next;
100 typedef struct arg_str
102 eff_node_kind_t kind;
107 typedef struct valref_str
109 eff_node_kind_t kind;
113 typedef struct select_str
115 eff_node_kind_t kind;
116 int valrefid; /* id of enclosed valref node, or -1 */
120 typedef struct load_str
122 eff_node_kind_t kind;
124 int ptrrefid; /* id of valref node enclosed in select, or -1 */
128 typedef struct store_str
130 eff_node_kind_t kind;
131 int ptrrefid; /* id of ptr valref node enclosed in select, or -1 */
132 int valrefid; /* id of val valref node enclosed in select, or -1 */
136 typedef struct alloc_str
138 eff_node_kind_t kind;
143 typedef struct call_str
145 eff_node_kind_t kind;
147 int valrefid; /* id of enclosed valref node, or -1 */
148 entity_t *ent; /* called entity */
153 typedef struct unknown_str
155 eff_node_kind_t kind;
159 typedef struct join_str
161 eff_node_kind_t kind;
167 typedef struct ret_str
169 eff_node_kind_t kind;
170 int ret_id; /* returned value, or -1 */
173 typedef struct raise_str
175 eff_node_kind_t kind;
176 /* struct eff_str *next; */
177 int valref; /* what was that one for? */
185 /** get the type entry with the given name */
186 type_t *getTypeByName (const char*);
188 /** get the type entry with the given Id */
189 type_t *getTypeById (const int);
191 /** get the entity entry that has the given names */
192 entity_t *getEntityByNames (const char*, const char*);
194 /** get the entity entry that has the given Id */
195 entity_t *getEntityById (const int);
197 /** get the effect entry for the given name */
198 effs_t *getEffectByName (const char*);
200 /** initialise the data structures */
201 void extern_init (void);
203 /** read in the file of the given name */
204 void extern_read (const char*);
206 /** clean up our mess */
207 void extern_cleanup (void);
209 # endif /* defined _READ_H_ */
213 Revision 1.2 2004/10/11 15:56:09 liekweg
214 Cleanup, comments ...
215 Added init func --flo
217 Revision 1.1 2004/10/11 09:31:06 liekweg
218 First Import of XML reading procs --flo