src/tipe.h

Go to the documentation of this file.
00001 /* -*- Mode: objc; c-basic-offset: 2; tab-width: 2 indent-tabs-mode: nil -*- */
00002 /* vim: set filetype=objc ts=2 sw=2 expandtab: */
00003 
00004 
00005 /*
00006  * Copyright (C) 2007 Neil Dantam
00007  *               2007 Jeff Seibert
00008  *
00009  * This program is free software: you can redistribute it and/or modify it
00010  * under the terms of the GNU General Public License, verson 3 ONLY, as
00011  * published by the Free Software Foundation.
00012  * 
00013  * This program is distributed in the hope that it will be useful, but WITHOUT
00014  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00015  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
00016  * more details.
00017  * 
00018  * You should have received a copy of the GNU General Public License along with
00019  * this program.  If not, see <http://www.gnu.org/licenses/>.
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 //-(void) type_name: (char* name);         ///< gets primitivies name
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

Generated on Mon Dec 24 06:11:58 2007 for gfront by  doxygen 1.5.2