Changeset 221 for trunk/nom/src/nombuildnomcls.c
- Timestamp:
- Feb 3, 2007, 11:01:41 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/nom/src/nombuildnomcls.c
r210 r221 49 49 /********************************************************/ 50 50 51 /* Define if you want to have messages from somBuildClass() and friends */51 /* Define if you want to have messages from nomBuildClass() and friends */ 52 52 //#define DEBUG_NOMBUILDCLASS 53 53 /* Define if you want to have messages from building NOMObject */ … … 59 59 #define BUILDNOMCLASS_ENTER nomPrintf("\n%d: *** entering %s...\n",__LINE__, __FUNCTION__); 60 60 #define BUILDNOMCLASS_LEAVE nomPrintf("%d: *** Leaving %s...\n\n",__LINE__, __FUNCTION__); 61 #define DBG_BUILDNOMCLASS(a, b,...) if(a) nomPrintf("%d: " b , __LINE__, __VA_ARGS__); 61 62 #else 62 63 #define BUILDNOMCLASS_ENTER 63 64 #define BUILDNOMCLASS_LEAVE 65 #define DBG_BUILDNOMCLASS(a, b,...) 64 66 #endif 65 67 … … 101 103 102 104 /* Calculate size of new class object */ 103 #ifdef DEBUG_BUILDNOMCLASS 104 nomPrintf("%d: ncParent->mtab->mtabSize: %d\n", __LINE__, ncpParent->mtab->mtabSize); 105 #endif 105 DBG_BUILDNOMCLASS(TRUE, "ncParent->mtab->mtabSize: %d\n", ncpParent->mtab->mtabSize); 106 106 107 107 mtabSize=ncpParent->mtab->mtabSize+sizeof(nomMethodProc*)*(sci->ulNumStaticMethods)+sizeof(NOMClass*);/* numStaticMethods is correct here! … … 114 114 gulParentDataSize=ncpParent->mtab->ulInstanceSize; /* Parent instance size. This is the mtab pointer + instance vars */ 115 115 116 #ifdef DEBUG_BUILDNOMCLASS 117 nomPrintf("%d: mtabSize is: %d, ulParentDataSize is: %d (instance vars + mtab ptr)\n", 118 __LINE__, mtabSize, gulParentDataSize); 119 nomPrintf("%d: sci->numStaticMethods: %d\n", __LINE__, sci->ulNumStaticMethods); 120 #endif 116 DBG_BUILDNOMCLASS(TRUE,"mtabSize is: %d, ulParentDataSize is: %d (instance vars + mtab ptr)\n", 117 mtabSize, gulParentDataSize); 118 DBG_BUILDNOMCLASS(TRUE, "sci->numStaticMethods: %d\n", sci->ulNumStaticMethods); 121 119 122 120 /* Alloc private class struct using SOMCalloc. */ … … 124 122 return NULLHANDLE; 125 123 126 /* Get mem for method thunking code */ 127 nClass->mThunk=NOMMalloc(sizeof(nomMethodThunk)*sci->ulNumStaticMethods); 128 if(!nClass->mThunk) { 129 NOMFree(nClass); 130 return NULLHANDLE; 131 } 132 124 /* Get mem for method thunking code. This assembler code is needed so the indirect 125 jump to the methods from the object pointer which is known does work. For each class 126 an individual thunking code must be calculated because the number of instance 127 variables is not defined. */ 128 #if 0 129 //Moved to addMethodAndDataToThisPrivClassStruct() 130 if(0!=sci->ulNumStaticMethods){ 131 nClass->mThunk=NOMMalloc(sizeof(nomMethodThunk)*sci->ulNumStaticMethods); 132 if(!nClass->mThunk) { 133 NOMFree(nClass); 134 return NULLHANDLE; 135 } 136 } 137 #endif 133 138 /* The size of each instance of this class. A NOM object has a method tab pointer 134 139 at the beginning followed by the instance variables. */ … … 142 147 mtab-entries[] to our new one before adding our own methods. 143 148 sci will be saved in nClass->sci */ 144 #warning !!!!! Move mem alloc for thunking into this func !!!!! 145 addMethodAndDataToThisPrivClassStruct( nClass, ncpParent, sci); 149 //#warning !!!!! Move mem alloc for thunking into this func !!!!! 150 if(!addMethodAndDataToThisPrivClassStruct( nClass, ncpParent, sci)){ 151 NOMFree(nClass); 152 return NULLHANDLE; 153 }; 146 154 147 155 /**********************************/ … … 261 269 pGlobalNomEnv->nomObjectMetaClass=(NOMClass*)nomClass->mtab->entries[0]; 262 270 263 #ifdef DEBUG_BUILDNOMCLASS 264 nomPrintf("%d: mtab: %x New class ptr (class object SOMClass): %x (SOMClassPriv: %x) for %s\n", 265 __LINE__, nomClass->mtab, nomClass, nClass, *sci->nomClassId); 266 #endif 271 DBG_BUILDNOMCLASS(TRUE, "mtab: %x New class ptr (class object SOMClass): %x (SOMClassPriv: %x) for %s\n", 272 nomClass->mtab, nomClass, nClass, *sci->nomClassId); 267 273 268 274 pGlobalNomEnv->defaultMetaClass=nomClass; … … 274 280 #endif 275 281 276 277 282 /* Run initialization code if any */ 278 283 _nomInit(nomClass, NULLHANDLE);
Note:
See TracChangeset
for help on using the changeset viewer.