00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00030 #ifndef _TIPE_H_
00031 #define _TIPE_H_
00032
00033 #include "cons.h"
00034 #include "symtable.h"
00035
00036
00038 @interface Tipe : Object {
00039
00040 }
00042 - (BOOL) isAssignableFrom: (Tipe*) t;
00044 - (BOOL) isAssignableTo: (Tipe*) t;
00046 - (BOOL) isEquivalentTo: (Tipe*) t;
00051 - (void) explain;
00052 @end
00053
00055 @interface ErrorTipe : Tipe
00056 @end
00057
00059 @interface PrimitiveTipe : Tipe {
00060 char *type;
00061 }
00062 -(id)setName: (char *) t;
00063 -(char*) type_name;
00064
00065 @end
00066
00067
00069 @interface PointerTipe : Tipe {
00070 Tipe *type;
00071 }
00073 -(id) init: (Tipe*) t;
00075 -(Tipe*) type;
00077 +(PointerTipe*) reference: (Tipe*) t;
00079 +(Tipe*) deref: (Tipe*) t;
00080 @end
00081
00082
00084 @interface FunctionTipe : Tipe {
00085 Tipe *result;
00086 }
00088 -(FunctionTipe*) init: (id) r;
00089 -(Tipe*) result;
00090 @end
00091
00092
00094 @interface Field : Object {
00095 Tipe *type;
00096 char *name;
00097 }
00099 -(id) init: (Tipe*) t;
00101 -(Tipe*) type;
00103 -(char*) field_name;
00105 -(id) field_name: (char*) n;
00107 -(BOOL) equiv: (id) i;
00108 @end
00109
00110
00112 @interface ContainerTipe : Tipe {
00113 Cons *fields;
00114 }
00116 -(void) addField: (Field*) f;
00118 -(void) addField: (Tipe*) t name: (char*) n;
00120 -(Cons*) fields;
00122 -(Tipe*) fieldType: (char*) n;
00123 -(BOOL) hasField: (char*) n;
00124 @end
00125
00126
00128 @interface StructTipe : ContainerTipe
00129 @end
00130
00131
00133 @interface UnionTipe : ContainerTipe
00134 @end
00135
00136
00145 @interface ObjectTipe : ContainerTipe {
00146 ObjectTipe *parent;
00147 char *name;
00148 SymTable *methods;
00149 }
00151 -(void) parent: (id) p;
00153 -(id) parent;
00158 -(id) parentTipe: (int) level;
00163 -(int) fieldOrder: (char*) f;
00165 -(char*) classname;
00167 -(void) classname: (char*) n;
00169 -(void) method: (char*) msg;
00171 -(BOOL) hasMethod: (char*) msg;
00173 -(int) findMethod: (char*) msg;
00174
00175 @end
00176
00177 #endif