Main Page   Modules   Compound List   File List   Compound Members   File Members  

clib.h

Go to the documentation of this file.
00001 
00013 #ifndef JAUNE_CLIB_H
00014 #define JAUNE_CLIB_H    1
00015 
00022 enum _ClibMagic
00023 {
00028   CLASSMAGIC = 0x1234
00029 };
00030 
00031 #define NULL    0
00032 #define STATIC
00033 
00039 #ifdef ASM_GBZ80_TYPES_INCLUDE
00040 #define UINTX_INTX_DEFINED      1
00041 #endif
00042 
00043 #if !UINTX_INTX_DEFINED
00044 typedef unsigned short UINT16;
00045 typedef signed short INT16;
00046 
00047 typedef unsigned char UINT8;
00048 typedef signed char INT8;
00049 #endif
00050 
00051 typedef unsigned char BOOL;
00052 typedef unsigned int UINT;
00053 typedef signed int INT;
00054 
00055 typedef UINT JBOOLEAN;
00056 typedef INT JBYTE;
00057 typedef INT JSHORT;
00058 typedef UINT JCHAR;
00059 typedef INT JINT;
00060 
00061 #define JFALSE 0
00062 #define JTRUE  1
00063 
00072 typedef struct
00073 {
00075   UINT16 uId;
00077   void *p;
00078 } TableEntry;
00079 
00081 typedef struct _Class Class;
00082 
00085 struct _Class
00086 {
00088   Class *pSuper;
00094   UINT16 uFieldSize;
00098   TableEntry *pMethodTable;
00102   TableEntry *pMethodTableEnd;
00106   TableEntry *pInterfaceMethodTable;
00110   TableEntry *pInterfaceMethodTableEnd;
00115   TableEntry *pFieldTable;
00117   TableEntry *pFieldTableEnd;
00120   Class **pImplsTable;
00122   Class **pImplsTableEnd;
00124   const char *szName;
00126   UINT16 uMagic;
00127 };
00128 
00132 typedef struct _Instance
00133 {
00135   Class *pClass;
00136 } Instance;
00137 
00140 typedef struct _Array
00141 {
00142   Instance header;
00144   UINT16 uLength;
00145 } Array;
00146 
00151 typedef struct _String
00152 {
00153   Instance header;
00155   UINT16 uLength;
00157   UINT8 sz[1];
00158 } String;
00159 
00166 typedef struct _StringBufferData
00167 {
00168   Instance header;
00169   char sz[1];
00170 } StringBufferData;
00171 
00174 typedef struct _StringBuffer
00175 {
00176   Instance header;
00178   UINT16 uLength;
00181   UINT16 uMaxLength;
00184   StringBufferData *pData;
00185 } StringBuffer;
00186 
00196 extern Class ByteArray_class;
00197 extern Class ReferenceArray_class;
00198 extern Class WordArray_class;
00199 extern Class JLJString_class;
00200 extern Class JLJStringBuffer_class;
00201 extern Class StringBufferData_class;
00202 
00207 void _cthrow(const char *pMsg);
00210 void _cassert(const char *pMsg, int line);
00211 
00225 #define TRYTHROW(_a, _msg) \
00226         if (!(_a)) _cthrow(_msg);
00227 
00230 #ifdef DISABLE_ASSERT
00231 #define ASSERT(_a, _msg)
00232 
00233 #else
00234 #define ASSERT(_a, _msg) \
00235         if (!(_a)) _cassert(_msg " at " __FILE__ ":", __LINE__);
00236 
00237 #endif
00238 
00248 #define NUMELEMS(_a) \
00249         (sizeof(_a)/sizeof(_a[0]))
00250 
00254 #define UNUSED(_a) \
00255         if (0 && (_a));
00256 
00260 #if DISABLE_VALIDATE
00261 #define VALIDATE(_a, _c1)
00262 #define CHECKINSTANCEISCLASS(_a)
00263 
00264 #else
00265 #define VALIDATE(_a, _cl) \
00266         ASSERT(_a, "Null object pointer"); \
00267         ASSERT((_a)->header.pClass == &(_cl), "Wrong class of object passed in")
00268 
00269 #define CHECKINSTANCEISCLASS(_a) \
00270         ASSERT(_a, "Null object pointer"); \
00271         ASSERT((_a)->pClass->uMagic == CLASSMAGIC, "Parameter is not a class instance");
00272 
00273 #endif
00274 
00275 #endif

Generated on Sat May 11 15:15:41 2002 for JauneRuntimeclib by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002