Changeset 221 for trunk/nom/src/nombuildclass.c
- Timestamp:
- Feb 3, 2007, 11:01:41 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/nom/src/nombuildclass.c
r210 r221 32 32 * 33 33 * ***** END LICENSE BLOCK ***** */ 34 /** \file 35 This File contains most of the magic to create classes for NOM. 36 */ 34 37 35 38 #define INCL_DOS … … 320 323 321 324 322 /* 325 /** 323 326 - This function builds the nomMethodTab of class nClass. 324 327 - Calculates the method thunks … … 328 331 methods. 329 332 */ 330 voidaddMethodAndDataToThisPrivClassStruct(NOMClassPriv* nClass, NOMClassPriv* ncpParent, nomStaticClassInfo *sci)333 boolean addMethodAndDataToThisPrivClassStruct(NOMClassPriv* nClass, NOMClassPriv* ncpParent, nomStaticClassInfo *sci) 331 334 { 332 335 BYTE * mem; … … 334 337 335 338 BUILDNOMCLASS_ENTER 339 340 /* Get mem for method thunking code. This assembler code is needed so the indirect 341 jump to the methods from the object pointer which is known does work. For each class 342 an individual thunking code must be calculated because the number of instance 343 variables is not defined. */ 344 if(0!=sci->ulNumStaticMethods){ 345 nClass->mThunk=NOMMalloc(sizeof(nomMethodThunk)*sci->ulNumStaticMethods); 346 if(!nClass->mThunk) 347 return FALSE; 348 } 336 349 337 350 nClass->sci=sci; /* Save static class info for internal use */ … … 347 360 nClass->parentMtabStruct.mtab=(nomMethodTab*)&nClass->thisMtab; 348 361 349 #ifdef DEBUG_NOMBUILDCLASS 350 nomPrintf("nClass->mtabList.next: %x\n", nClass->mtabList.next); 351 #endif 362 DBG_NOMBUILDCLASS(TRUE, "nClass->mtabList.next: %x\n", nClass->mtabList.next); 352 363 353 364 /* There're some parents. Copy parent mtab data into new mtab. */ … … 367 378 /* Add class struct of this class. This includes the proc adresses. */ 368 379 if(sci->ulNumStaticMethods) { 369 #ifdef DEBUG_NOMBUILDCLASS 370 nomPrintf("copy own data: %d (classptr+numProcs*procpointersize) from %x (cds, classDataStruct of %x) to %x (our mtab part)\n",371 sizeof(NOMClass*)+sci->ulNumStaticMethods*sizeof(nomMethodProc*),372 sci->nomCds, sci->nomCds->nomClassObject, mem);373 #endif 380 DBG_NOMBUILDCLASS(TRUE, 381 "copy own data: %d (classptr+numProcs*procpointersize) from %x (cds, classDataStruct of %x) to %x (our mtab part)\n", 382 sizeof(NOMClass*)+sci->ulNumStaticMethods*sizeof(nomMethodProc*), 383 sci->nomCds, sci->nomCds->nomClassObject, mem); 384 374 385 nClass->entries0=(NOMClass**)mem; /* Our part in the mtab starts here. We need this position to insert the class object pointer 375 386 later. */ … … 396 407 sci->ccds->instanceDataToken=&nClass->thunk; 397 408 398 BUILDNOMCLASS_LEAVE 409 BUILDNOMCLASS_LEAVE; 410 return TRUE; 399 411 } 400 412 … … 530 542 if((nClass=(NOMClassPriv*)NOMCalloc(1, ulMemSize))==NULLHANDLE) 531 543 return NULLHANDLE; 532 544 #if 0 545 //Moved to addMethodAndDataToThisPrivClassStruct() 533 546 /* Get mem for method thunking code */ 534 547 if(0!=sci->ulNumStaticMethods){ … … 539 552 } 540 553 } 554 #endif 555 541 556 /* Add class struct of this class. 542 557 This includes … … 544 559 -add the parent mtab info to the new built mtab 545 560 */ 546 addMethodAndDataToThisPrivClassStruct( nClass, ncpParent, sci) ; 547 561 if(!addMethodAndDataToThisPrivClassStruct( nClass, ncpParent, sci)){ 562 NOMFree(nClass); 563 return NULLHANDLE; 564 }; 565 548 566 DBG_NOMBUILDCLASS(TRUE, "%s: mtab: %x\n", __FUNCTION__, nClass->mtab); 549 567 … … 598 616 nomClassMeta=_nomFindClassFromName(NOMClassMgrObject, *sci->nomExplicitMetaId, majorVersion, minorVersion, NULLHANDLE); 599 617 600 #ifdef DEBUG_NOMBUILDCLASS 601 nomPrintf("%d: %x %s %s\n", __LINE__, nomClassMeta, *sci->nomClassId, *sci->nomExplicitMetaId); 602 #endif 618 DBG_NOMBUILDCLASS(TRUE, "%x %s %s\n", nomClassMeta, *sci->nomClassId, *sci->nomExplicitMetaId); 603 619 604 620 if(!nomClassMeta) … … 632 648 nomClass); 633 649 634 #ifdef DEBUG_NOMBUILDCLASS 635 nomPrintf("%d: New class Object (child of NOMClass): %x \n", __LINE__, nomClass); 636 #endif 650 DBG_NOMBUILDCLASS(TRUE, "New class Object (child of NOMClass): %x \n", nomClass); 637 651 638 652 /* nomClassReady() is called in nomBuildClass() */ … … 802 816 } 803 817 804 818 /** 819 Build a class for NOM from the data generated from the IDL compiler and 820 compiled into the DLL. 821 */ 805 822 NOMEXTERN NOMClass * NOMLINK nomBuildClass(gulong ulReserved, 806 823 nomStaticClassInfo *sci, … … 886 903 priv_buildNOMObjectClassInfo(ulReserved, sci, /* yes */ 887 904 ulMajorVersion, ulMinorVersion); 888 return NULLHANDLE; /* We can't return a SOMClass for SOMObject because SOMClass isn't built yet. */905 return NULLHANDLE; /* We can't return a NOMClass for NOMObject because NOMClass isn't built yet. */ 889 906 } 890 907 … … 907 924 ncpParent=priv_findPrivClassInGlobalClassListFromName(pGlobalNomEnv, 908 925 **(sci->nomIdAllParents)); /* This may also return a class not derived 909 from SOMClass */926 from NOMClass */ 910 927 #endif 911 928 if(!ncpParent) … … 1008 1025 return NULLHANDLE; 1009 1026 1027 #if 0 1028 //Moved to addMethodAndDataToThisPrivClassStruct() 1010 1029 if(0!=sci->ulNumStaticMethods){ 1011 1030 /* Get mem for method thunking code */ … … 1016 1035 } 1017 1036 } 1037 #endif 1018 1038 1019 1039 nClass->ulClassSize=sci->ulInstanceDataSize+ulParentDataSize; 1020 1040 1021 1041 if((nomClass=(NOMClass*)NOMCalloc(1, sci->ulInstanceDataSize+ulParentDataSize))==NULLHANDLE) { 1022 NOMFree(nClass->mThunk);1042 //NOMFree(nClass->mThunk); 1023 1043 NOMFree(nClass); 1024 1044 return NULLHANDLE; … … 1028 1048 1029 1049 /* Add class struct of this class. This includes resolving the method adresses. */ 1030 addMethodAndDataToThisPrivClassStruct( nClass, ncpParent, sci) ; 1050 if(!addMethodAndDataToThisPrivClassStruct( nClass, ncpParent, sci)){ 1051 NOMFree(nClass); 1052 NOMFree(nomClass); 1053 return NULLHANDLE; 1054 }; 1031 1055 1032 1056 /* Resolve overrides if any */ … … 1047 1071 nClass->mtab->nomClassName=*sci->nomClassId; 1048 1072 nClass->mtab->ulInstanceSize=sci->ulInstanceDataSize+ulParentDataSize; /* Size of instance data of this class and all 1049 parent classes. This isn't actually allocated for this class 1050 object but the entry is used when creating the objects. */ 1073 parent classes. This isn't actually allocated 1074 for this class object but the entry is used 1075 when creating the objects. */ 1051 1076 fillCClassDataStructParentMtab(sci, nClass, nomClass); 1052 1077
Note:
See TracChangeset
for help on using the changeset viewer.