1 /* Copyright (C) 2001 by Universitaet Karlsruhe
2 ** All rights reserved.
4 ** Authors: Goetz Lindenmaier
20 tp_op *type_enumeration;
22 tp_op *type_primitive;
26 new_tpop (tp_opcode code, ident *name, size_t attr_size)
30 res = (tp_op *) xmalloc (sizeof (tp_op));
33 res->attr_size = attr_size;
40 type_class = new_tpop (tpo_class , id_from_str("class" , 5), sizeof (cls_attr));
41 type_struct = new_tpop (tpo_struct , id_from_str("struct" , 6), sizeof (stc_attr));
42 type_method = new_tpop (tpo_method , id_from_str("method" , 6), sizeof (mtd_attr));
43 type_union = new_tpop (tpo_union , id_from_str("union" , 5), sizeof (uni_attr));
44 type_array = new_tpop (tpo_array , id_from_str("array" , 5), sizeof (arr_attr));
45 type_enumeration = new_tpop (tpo_enumeration, id_from_str("enumeration",11), sizeof (enm_attr));
46 type_pointer = new_tpop (tpo_pointer , id_from_str("pointer" , 7), sizeof (ptr_attr));
47 type_primitive = new_tpop (tpo_primitive , id_from_str("primitive" , 9), /* sizeof (pri_attr) */ 0);
48 type_id = new_tpop (tpo_id , id_from_str("type_id" , 7), /* sizeof (id_attr) */ 0);
51 /* Returns the string for the tp_opcode. */
52 const char *get_tpop_name (tp_op *op) {
53 return id_to_str(op->name);
56 tp_opcode get_tpop_code (tp_op *op){
60 ident *get_tpop_ident(tp_op *op){
64 /* returns the attribute size of the operator. */
65 int get_tpop_attr_size (tp_op *op) {