Changeset 196 for trunk/nom/src/nombuildclass.c
- Timestamp:
- Jan 18, 2007, 9:41:30 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/nom/src/nombuildclass.c
r177 r196 538 538 #warning !!!!! Change this when nomID is a GQuark !!!!! 539 539 nomClassParent=_nomFindClassFromName(NOMClassMgrObject, *sci->nomExplicitMetaId, majorVersion, minorVersion, NULLHANDLE); 540 540 printf(" 2 ----------------- %d %x %s %s\n", __LINE__, nomClassParent, *sci->nomClassId, *sci->nomExplicitMetaId); 541 541 if(!nomClassParent) 542 542 return NULLHANDLE; … … 549 549 return NULLHANDLE; 550 550 551 552 551 /* Mabe we should just copy the whole struct here? */ 553 552 nomClass->mtab=nomClassParent->mtab; … … 713 712 nomMethodTabs psmTab; 714 713 /* Print some info for debbuging */ 715 nomPrintf("\n%d: Entering %s to build class %s. ---> SCMO: %x (NOMClassManagerObject)\n",716 __LINE__, __FUNCTION__, *sci->nomClassId, N ULL /*NOMClassMgrObject*/);717 nomPrintf(" cds: %x nomClassObject: %x\n", sci->nomCds, sci->nomCds->nomClassObject);714 nomPrintf("\n%d: Entering %s to build class %s. ---> SCMO: 0x%x (NOMClassManagerObject)\n", 715 __LINE__, __FUNCTION__, *sci->nomClassId, NOMClassMgrObject); 716 nomPrintf("d: cds: 0x%x nomClassObject: 0x%x\n", __LINE__, sci->nomCds, sci->nomCds->nomClassObject); 718 717 #endif 719 718 … … 775 774 #endif 776 775 777 /* Do we want to build SOMObject the mother of all classes? */776 /* Do we want to build NOMObject the mother of all classes? */ 778 777 if(!strcmp(*sci->nomClassId, "NOMObject")){ 779 778 #ifdef DEBUG_NOMBUILDCLASS … … 782 781 priv_buildNOMObjectClassInfo(ulReserved, sci, /* yes */ 783 782 ulMajorVersion, ulMinorVersion); 784 return NULLHANDLE; /* We can't return a SOMClass for SOMObject because SOMClass isn't 785 built yet. */ 783 return NULLHANDLE; /* We can't return a SOMClass for SOMObject because SOMClass isn't built yet. */ 786 784 } 787 785 … … 835 833 or an explicit meta class if given. */ 836 834 #ifdef DEBUG_NOMBUILDCLASS 837 nomPrintf("Class %x (ncpParent->mtab->nomClassName: %s) is not a NOMClass\n", ncpParent, ncpParent->mtab->nomClassName); 835 nomPrintf("%d: Class %x (ncpParent->mtab->nomClassName: %s) is not a NOMClass\n", 836 __LINE__, ncpParent, ncpParent->mtab->nomClassName); 838 837 #endif 839 838 … … 849 848 nomPrintf("sci->nomExplicitMetaId is set\n"); 850 849 #endif 851 852 853 850 854 851 nomClass= priv_buildWithExplicitMetaClass(ulReserved, sci, 855 852 ulMajorVersion, ulMinorVersion); 856 853 if(nomClass){ 857 854 #ifdef DEBUG_NOMBUILDCLASS 858 nomPrintf("% s: class is %x\n", nomClass->mtab->nomClassName, nomClass);855 nomPrintf("%d: %s: class is 0x%x\n", __LINE__, nomClass->mtab->nomClassName, nomClass); 859 856 #endif 860 857 _nomInit(nomClass, NULLHANDLE); … … 884 881 /* Child of some NOMClass */ 885 882 886 887 883 /**** From this point we are building a new class object (derived from NOMClass ****/ 888 884 ulMemSize=sizeof(NOMClassPriv)-sizeof(nomMethodTab); /* start size class struct */ … … 890 886 /* Calculate size of new class object */ 891 887 #ifdef DEBUG_NOMBUILDCLASS 892 nomPrintf(" Parent class%x (ncpParent->mtab->nomClassName: %s) is a NOMClass (or derived)\n",893 ncpParent, ncpParent->mtab->nomClassName);894 nomPrintf(" ncParent->mtab->mtabSize: %d\n", ncpParent->mtab->mtabSize);888 nomPrintf("%d: Parent class 0x%x (ncpParent->mtab->nomClassName: %s) is a NOMClass (or derived)\n", 889 __LINE__, ncpParent, ncpParent->mtab->nomClassName); 890 nomPrintf(" ncParent->mtab->mtabSize: %d\n", ncpParent->mtab->mtabSize); 895 891 #endif 896 892 mtabSize=ncpParent->mtab->mtabSize+sizeof(nomMethodProc*)*(sci->ulNumStaticMethods)+sizeof(NOMClass*);/* ulNumStaticMethods is correct here! … … 903 899 904 900 #ifdef DEBUG_NOMBUILDCLASS 905 nomPrintf("% s mtabSize is: %d, ulParentDataSize is: %d\n", *sci->nomClassId, mtabSize, ulParentDataSize);906 #endif 907 908 909 /* Alloc class struct using SOMCalloc. This means the struct is allocated in shared mem */901 nomPrintf("%d: %s mtabSize is: %d, ulParentDataSize is: %d\n", __LINE__, *sci->nomClassId, mtabSize, ulParentDataSize); 902 #endif 903 904 905 /* Alloc class struct using NOMCalloc. This means the struct is allocated in shared mem */ 910 906 if((nClass=(NOMClassPriv*)NOMCalloc(1, ulMemSize))==NULLHANDLE) 911 907 return NULLHANDLE; 912 908 913 /* Get mem for method thunking code */ 914 nClass->mThunk=NOMMalloc(sizeof(nomMethodThunk)*sci->ulNumStaticMethods); 915 if(!nClass->mThunk) { 916 NOMFree(nClass); 917 return NULLHANDLE; 909 if(0!=sci->ulNumStaticMethods){ 910 /* Get mem for method thunking code */ 911 nClass->mThunk=NOMMalloc(sizeof(nomMethodThunk)*sci->ulNumStaticMethods); 912 if(!nClass->mThunk) { 913 NOMFree(nClass); 914 return NULLHANDLE; 915 } 918 916 } 919 917 … … 932 930 addMethodAndDataToThisPrivClassStruct( nClass, ncpParent, sci) ; 933 931 934 /* Resolve ovverrides if any */ 935 //#warning !!!!! no resolving of overriden methods here !!!!! 932 /* Resolve overrides if any */ 936 933 priv_resolveOverrideMethods(nClass, sci); 937 934 938 935 nomClass->mtab=nClass->mtab; 939 #ifdef DEBUG_ nOMBUILDCLASS940 nomPrintf(" mtab: %x\n", nClass->mtab);936 #ifdef DEBUG_NOMBUILDCLASS 937 nomPrintf("%d: mtab: %x\n", __LINE__, nClass->mtab); 941 938 #endif 942 939 sci->nomCds->nomClassObject=nomClass; /* Put class pointer in static struct */ … … 963 960 964 961 #ifdef DEBUG_NOMBUILDCLASS 965 nomPrintf(" New class ptr (class object): %x (NOMClassPriv: %x) for %s\n", nomClass, nClass, *sci->nomClassId);962 nomPrintf("%d: New class ptr (class object): %x (NOMClassPriv: %x) for %s\n", __LINE__, nomClass, nClass, *sci->nomClassId); 966 963 #endif 967 964 … … 982 979 #include <cwsomcls.h> 983 980 #include <somclassmanager.h> 984 /********************************************************/985 /* Internal functions */986 /********************************************************/987 988 /* String manager functions */989 static BOOL priv_addSomIdToIdList(PSOM_ENV pEnv, somIdItem * sid)990 {991 somIdItem *tmpList;992 993 if(!sid || !pEnv)994 return FALSE;995 996 if(NO_ERROR != priv_requestSomEnvMutex(pEnv))997 return FALSE;998 999 if(!pEnv->livingSomIds)1000 {1001 /* Add first class */1002 pEnv->livingSomIds=sid;1003 priv_releaseSomEnvMutex(pEnv);1004 return TRUE;1005 }1006 tmpList=sid;1007 1008 tmpList->next=(somIdItem*)pEnv->livingSomIds;1009 pEnv->livingSomIds=tmpList;1010 pEnv->ulNumRegIds++;1011 1012 priv_releaseSomEnvMutex(pEnv);1013 return TRUE;1014 }1015 1016 /* This returns the ID of a string, this means the hash of this string if1017 already registered. */1018 static somIdItem* priv_findSomIdInList(PSOM_ENV pEnv, string aString)1019 {1020 somIdItem *tmpItem;1021 ULONG ulHash;1022 1023 if(!pEnv|| aString)1024 return 0;1025 1026 ulHash=calculateNameHash(aString);1027 1028 if(NO_ERROR != priv_requestSomEnvMutex(pEnv))1029 return NULL;1030 1031 tmpItem=pEnv->livingSomIds;1032 while(tmpItem)1033 {1034 if(tmpItem->id == ulHash) {1035 priv_releaseSomEnvMutex(pEnv);1036 return tmpItem; /* We have found the string return somId */1037 }1038 tmpItem=tmpItem->next;1039 };1040 priv_releaseSomEnvMutex(pEnv);1041 1042 return NULL; /* No id yet. */1043 }1044 1045 981 /********************************************************/ 1046 982 /* Toolkit functions, exported */ … … 1102 1038 *sID=(char*)sid; 1103 1039 return sID; 1104 }1105 1106 /* Returns the total number of ids that have been registered so far, */1107 unsigned long SOMLINK somTotalRegIds(void)1108 {1109 long numIds;1110 1111 if(NO_ERROR != priv_requestSomEnvMutex(pGlobalSomEnv))1112 return 0;1113 1114 numIds=pGlobalSomEnv->ulNumRegIds;1115 priv_releaseSomEnvMutex(pGlobalSomEnv);1116 1117 return numIds;1118 1040 } 1119 1041
Note:
See TracChangeset
for help on using the changeset viewer.