1 /********************************************************************
3 type.c - function for handling types in pascal
5 Niksa Orlic, 2004-04-28
7 ********************************************************************/
11 //#include "../util/message.h"
21 #include <string.h>
22 #include <stdlib.h>
26 /*
27 Create an empty type
28 */
30 {
40 }
43 /*
44 Deletes a type
45 */
47 {
52 {
54 {
58 }
61 {
65 }
66 }
69 }
72 /*
73 Create a copy of a type
74 */
76 {
86 {
89 }
92 {
96 }
99 }
102 /*
103 Return a nonzero value if both types are equal.
104 */
106 {
117 {
119 {
128 }
131 {
135 }
138 {
149 }
150 }
153 }
155 /*
156 Return 0 if types are not equal; 1 if the types
157 are exactly the same, 2 if type1 is real and type2 int
158 or 3 if type2 is real and type1 int
160 Also, char can be casted into string
161 */
163 {
184 }
187 /*
188 Returns a name for any basic type, string 'unknown type' otherwise
189 */
191 {
193 {
238 }
241 }
244 /*
245 Check if any name from element_names already exists in
246 item->elements_name_list
247 */
249 {
253 {
255 {
259 {
261 {
264 {
266 }
267 }
270 }
271 }
274 }
275 }
278 /*
279 Add elements into a record type
280 */
282 {
283 /* check for duplicate names in the names */
287 {
289 {
292 }
295 }
296 }
299 /*
300 Returns the type of an element of a given record type identified
301 by a given name. In case of an error, NULL is returned.
302 */
304 {
315 {
317 {
319 {
321 }
322 }
326 }
329 }