4 * File name: ir/external/read.c
5 * Purpose: Read descriptions of external effects
7 * Modified by: Boris Boesler
10 * Copyright: (c) 1999-2004 Universität Karlsruhe
11 * Licence: This file is protected by GPL - GNU GENERAL PUBLIC LICENSE.
22 #include <libxml/xmlmemory.h>
23 #include <libxml/parser.h>
24 #include <libxml/encoding.h>
30 # define _BSD_SOURCE /* need strdup */
31 # endif /* ! defined _BSD_SOURCE */
33 # define MY_ENCODING "ISO-8859-1"
35 # define CHECK(ptr,msg) assert (ptr && msg)
37 # define NODE_NAME(n, m) (0 == xmlStrcmp (n->name, (const xmlChar*) #m))
38 # define CHECK_NAME(n, m) assert (0 == xmlStrcmp (n->name, (const xmlChar*) #m))
40 # define NEW(T) (T*) malloc (sizeof (T))
42 typedef const char* firmid_t;
44 /* first, the xml structures */
46 typedef struct type_str
50 type *f_tp; /* firm type */
51 struct type_str *prev;
54 typedef struct entity_str
56 const char *name; /* name of entity */
57 const char *tp_name; /* name of type/class */
58 firmid_t id; /* id for references */
59 firmid_t owner; /* id of owner */
60 entity *f_ent; /* firm entity */
61 struct entity_str *prev;
64 /* now the xml nodes */
65 typedef enum eff_node_kind {
67 eff_valref, // eliminated
68 eff_select, // eliminated
80 typedef struct arg_str
86 typedef struct valref_str
91 typedef struct select_str
96 typedef struct load_str
98 firmid_t ptrrefid; /* id of valref node enclosed in select, or -1 */
102 typedef struct store_str
104 firmid_t ptrrefid; /* id of ptr valref node enclosed in select, or -1 */
105 firmid_t valrefid; /* id of val valref node enclosed in select, or -1 */
109 typedef struct alloc_str
114 typedef struct call_str
116 firmid_t valrefid; /* id of enclosed valref node, or -1 */
117 entity_t *ent; /* called entity */
122 typedef struct unknown_str
127 typedef struct join_str
133 typedef struct ret_str
136 } ret_t; /* returned value, or NO_ID */
138 typedef struct raise_str
140 firmid_t valref; /* what was that one for? */
144 /* dummy type for all other effects */
145 typedef struct eff_str
147 eff_node_kind_t kind;
148 firmid_t id; /* identifier to access this node */
163 struct eff_str *next; /* effects with values are stored in proc.values */
166 typedef struct proc_str
168 const char *procname;
172 struct proc_str *next;
177 typedef struct mod_str
179 const char *name; /* name of module */
180 type_t *types; /* types in module */
181 entity_t *entities; /* entities in module */
182 proc_t *procs; /* methods with effects */
183 struct mod_str *next; /* unused - only one module possible */
188 The public intyerface
190 /** read the file and build the graphs */
191 void create_abstraction(const char *filename);
194 #endif /* defined _READ_H_ */
198 Revision 1.5 2004/10/21 15:31:55 boesler
200 - build abstract syntax trees
201 - build Firm graphs for many effects, still todos
203 Revision 1.1 2004/10/11 09:31:06 liekweg
204 First Import of XML reading procs --flo