Changeset 326 for trunk/nom/src
- Timestamp:
- Apr 9, 2008, 10:22:08 PM (17 years ago)
- Location:
- trunk/nom/src
- Files:
-
- 1 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/nom/src/nombuildclass.c
r255 r326 36 36 */ 37 37 38 #define INCL_DOS 39 #define INCL_DOSERRORS 40 41 #include <os2.h> 38 #ifdef __OS2__ 39 # define INCL_DOS 40 # define INCL_DOSERRORS 41 # include <os2.h> 42 #endif /* __OS2__ */ 43 42 44 #include <stdarg.h> 43 45 #include <stdio.h> 44 46 #include <string.h> 45 #include <alloca.h> 47 #include <stdlib.h> 48 #if !defined(_MSC_VER) 49 # include <alloca.h> 50 #endif 46 51 #include <glib.h> 47 52 #define SOM_NO_OBJECTS /* Otherwise som.h includes the IBM SOM classes */ … … 69 74 #endif 70 75 71 #ifdef DEBUG_NOMBUILDCLASS 72 #define DBG_BUILD_LINE(a) 73 #define DBG_NOMBUILDCLASS(a, b,...) if(a) nomPrintf("%d: " b , __LINE__, __VA_ARGS__); 76 #ifdef _MSC_VER 77 void _inline DBG_NOMBUILDCLASS(gboolean a, const char fmt, ...) 78 { 79 /* sorry nothing here. */ 80 } 74 81 #else 75 #define DBG_NOMBUILDCLASS(a, b,...) 76 #endif 82 # ifdef DEBUG_NOMBUILDCLASS 83 # define DBG_BUILD_LINE(a) 84 # define DBG_NOMBUILDCLASS(a, b,...) if(a) nomPrintf("%d: " b , __LINE__, __VA_ARGS__); 85 # else 86 # define DBG_NOMBUILDCLASS(a, b,...) 87 # endif 88 #endif 77 89 78 90 #define DBGBUILDNOMCLASS_ENTER BUILDNOMCLASS_ENTER … … 95 107 */ 96 108 97 static ULONGthunk[]={0x0424448b, 0x00000405, 0x0000c300};109 static gulong thunk[]={0x0424448b, 0x00000405, 0x0000c300}; 98 110 99 111 /* … … 102 114 JMP DWORD PTR [EDX+0ACh] : JMP to address pointing to by EDX+0ACh 103 115 */ 104 static ULONGmThunkCode[]={0x04244c8b, 0xff00518b, 0x0000aca2 , 0x16000000};116 static gulong mThunkCode[]={0x04244c8b, 0xff00518b, 0x0000aca2 , 0x16000000}; 105 117 106 118 … … 116 128 */ 117 129 118 static BOOLpriv_nomIsA(NOMObject *nomSelf, NOMClass* aClassObj)130 static gboolean priv_nomIsA(NOMObject *nomSelf, NOMClass* aClassObj) 119 131 { 120 132 nomParentMtabStructPtr pParentMtab=&((NOMClassPriv * )nomSelf)->parentMtabStruct; … … 195 207 __FUNCTION__, __LINE__, gstr->str); 196 208 idx++; /* This is the position for the class pointer */ 197 ncPriv=_nomGetClassInfoPtrFromName(NOMClassMgrObject, sci->chrParentClassNames[a], NULL HANDLE);209 ncPriv=_nomGetClassInfoPtrFromName(NOMClassMgrObject, sci->chrParentClassNames[a], NULL); 198 210 /* now find the index */ 199 211 ulNumMethods=nomGetNumIntroducedMethods(ncPriv); … … 245 257 } 246 258 else{ 247 ncPriv=_nomGetClassInfoPtrFromName(NOMClassMgrObject, sci->chrParentClassNames[a], NULL HANDLE);259 ncPriv=_nomGetClassInfoPtrFromName(NOMClassMgrObject, sci->chrParentClassNames[a], NULL); 248 260 //nomPrintf(" %s did not introduce the method. Adding %d to index\n", 249 261 // sci->chrParentClassNames[a], nomGetNumIntroducedMethods(ncPriv)+1); … … 275 287 for(b=0;b<sci->ulNumStaticOverrides;b++) {/* For every overriden method do */ 276 288 nomMethodProc** entries; 277 ULONGindex;289 gulong index; 278 290 279 291 entries=&nClass->mtab->entries[0]; /* Adress of array where we enter our resoved method */ … … 333 345 boolean addMethodAndDataToThisPrivClassStruct(NOMClassPriv* nClass, NOMClassPriv* ncpParent, nomStaticClassInfo *sci) 334 346 { 335 BYTE* mem;347 guint8 * mem; 336 348 int a; 337 349 … … 389 401 /* Now finally put the thunking in so the procedures are resolved correctly. */ 390 402 for(a=0;a<sci->ulNumStaticMethods;a++) { 391 ULONGulOffset;403 gulong ulOffset; 392 404 393 405 memcpy(&nClass->mThunk[a], mThunkCode, sizeof(mThunkCode)); /* Copy thunking code */ 394 406 395 ulOffset=( ULONG)((char*)(mem+sizeof(NOMClass*))-(char*)nClass->mtab); /* Skip class object pointer */407 ulOffset=(gulong)((char*)(mem+sizeof(NOMClass*))-(char*)nClass->mtab); /* Skip class object pointer */ 396 408 nClass->mThunk[a].thunk[2]=((ulOffset+a*sizeof(nomMethodProc*))<<8)+0xa2; 397 409 /* Put thunking code address into CClassStruct */ … … 431 443 { 432 444 ncpParent=_nomGetClassInfoPtrFromName(NOMClassMgrObject, chrClassName, 433 NULL HANDLE);445 NULL); 434 446 } 435 447 … … 495 507 NOMClass* nomClass) 496 508 { 497 ULONGulParentDataSize=0;498 ULONGmtabSize;499 ULONGulMemSize=0;509 gulong ulParentDataSize=0; 510 gulong mtabSize; 511 gulong ulMemSize=0; 500 512 NOMClassPriv *nClass, *ncpParent; 501 513 … … 503 515 504 516 if(!nomClass||!sci) 505 return NULL HANDLE;517 return NULL; 506 518 507 519 /* The addresse of static methods in sci are already resolved. See nomBuildClass() */ … … 512 524 }/* nomIdAllParents */ 513 525 else 514 ncpParent = NULL HANDLE;526 ncpParent = NULL; 515 527 516 528 if(!ncpParent) { … … 518 530 /* FIXME: 519 531 Maybe we should panic here. */ 520 return NULL HANDLE; /* Only NOMObject has no parent, so we have a problem here. */532 return NULL; /* Only NOMObject has no parent, so we have a problem here. */ 521 533 } 522 534 … … 540 552 541 553 /* Alloc private class struct using NOMCalloc. */ 542 if((nClass=(NOMClassPriv*)NOMCalloc(1, ulMemSize))==NULL HANDLE)543 return NULL HANDLE;554 if((nClass=(NOMClassPriv*)NOMCalloc(1, ulMemSize))==NULL) 555 return NULL; 544 556 #if 0 545 557 //Moved to addMethodAndDataToThisPrivClassStruct() … … 549 561 if(!nClass->mThunk) { 550 562 NOMFree(nClass); 551 return NULL HANDLE;563 return NULL; 552 564 } 553 565 } … … 561 573 if(!addMethodAndDataToThisPrivClassStruct( nClass, ncpParent, sci)){ 562 574 NOMFree(nClass); 563 return NULL HANDLE;575 return NULL; 564 576 }; 565 577 … … 580 592 nClass->mtab->nomClassObject=nomClass; /* Class object (metaclass). We build a normal class here. */ 581 593 nClass->mtab->nomClsInfo=(nomClassInfo*)nClass; 594 #ifndef _MSC_VER 582 595 #warning !!!!! Change this when nomId is a GQuark !!!!! 596 #endif 583 597 nClass->mtab->nomClassName=*sci->nomClassId; 584 598 nClass->mtab->ulInstanceSize=sci->ulInstanceDataSize+ulParentDataSize; /* Size of instance data of this class and all … … 589 603 DBG_NOMBUILDCLASS(TRUE, "New NOMClassPriv*: %x\n", nClass); 590 604 591 _nomSetObjectCreateInfo(nomClass, nClass, NULL HANDLE);605 _nomSetObjectCreateInfo(nomClass, nClass, NULL); 592 606 593 607 /* Mark the class as using nomUnInit() if any parent did that. We just have to … … 610 624 611 625 if(NULL==NOMClassMgrObject) 612 return NULL HANDLE;626 return NULL; 613 627 614 628 /* Search for meta class. */ 629 #ifndef _MSC_VER 615 630 #warning !!!!! Change this when nomID is a GQuark !!!!! 616 nomClassMeta=_nomFindClassFromName(NOMClassMgrObject, *sci->nomExplicitMetaId, majorVersion, minorVersion, NULLHANDLE); 631 #endif 632 nomClassMeta=_nomFindClassFromName(NOMClassMgrObject, *sci->nomExplicitMetaId, majorVersion, minorVersion, NULL); 617 633 618 634 DBG_NOMBUILDCLASS(TRUE, "%x %s %s\n", nomClassMeta, *sci->nomClassId, *sci->nomExplicitMetaId); 619 635 620 636 if(!nomClassMeta) 621 return NULL HANDLE;637 return NULL; 622 638 623 639 /* Create a new class object. We create a copy here because we may change the mtab entries … … 625 641 sizes, methods etc. I wonder how IBM SOM manages to use the same metaclass 626 642 for different classes without (apparently) copying it for different uses... */ 627 if((nomClass=(NOMClass*)NOMCalloc(1, _nomGetSize(nomClassMeta, NULL HANDLE)))==NULLHANDLE)628 return NULL HANDLE;643 if((nomClass=(NOMClass*)NOMCalloc(1, _nomGetSize(nomClassMeta, NULL)))==NULL) 644 return NULL; 629 645 630 646 /* Maybe we should just copy the whole struct here? */ 631 647 nomClass->mtab=nomClassMeta->mtab; 648 #ifndef _MSC_VER 632 649 #warning !!!!! No call of _nomSetInstanceSize !!!!! 633 650 #warning !!!!! No call of _nomSetObjectsSCI !!!!! 651 #endif 634 652 #if 0 635 653 /* Set object data */ … … 678 696 { 679 697 NOMObject *nObject; 680 nObject=_nomFindClassFromName(NOMClassMgrObject, sci->chrParentClassNames[a], 0, 0, NULL HANDLE);698 nObject=_nomFindClassFromName(NOMClassMgrObject, sci->chrParentClassNames[a], 0, 0, NULL); 681 699 682 700 DBG_NOMBUILDCLASS( TRUE , " Parent %d: %s, class object: %x\n" , … … 710 728 711 729 #ifdef DEBUG_NOMBUILDCLASS 730 # ifndef _MSC_VER 712 731 #warning !!!!! Change this when nomId is a GQuark !!!!! 732 # endif 713 733 nomPrintf("\n%d: Entering %s to build %s\n", __LINE__, __FUNCTION__, *sci->nomClassId); 714 734 #endif … … 722 742 723 743 if(!nomClassDefault) 724 return NULL HANDLE;744 return NULL; 725 745 726 746 /* Found NOMClass object */ 727 747 728 //nomPrintf("_nomGetSize(): %d\n", _nomGetSize(nomClassParent, NULL HANDLE));748 //nomPrintf("_nomGetSize(): %d\n", _nomGetSize(nomClassParent, NULL)); 729 749 730 750 /* Create an object */ 731 if((nomClass=(NOMClass*)NOMCalloc(1, _nomGetSize(nomClassDefault, NULL HANDLE)))==NULLHANDLE)732 return NULL HANDLE;751 if((nomClass=(NOMClass*)NOMCalloc(1, _nomGetSize(nomClassDefault, NULL)))==NULL) 752 return NULL; 733 753 734 754 nomClass->mtab=nomClassDefault->mtab; 735 755 756 #ifndef _MSC_VER 736 757 #warning !!!!! _nomSetInstanceSize() not called here !!!!! 737 758 #warning !!!!! _nomSetObjectsSCI() not called here !!!!! 759 #endif 738 760 #if 0 739 761 /* Set object data */ … … 783 805 784 806 /* Allocate a class object for NOMObject for creating NOMObject instances. */ 785 if((nomObjClass=(NOMClass*)NOMCalloc(1, ulSize))==NULL HANDLE) {807 if((nomObjClass=(NOMClass*)NOMCalloc(1, ulSize))==NULL) { 786 808 /* We panic here for the simple reason that without a working NOMObject the whole object system 787 809 will not work. */ 788 810 g_error("No memory for building the class object _NOMObject for NOMObject."); 789 return NULL HANDLE;811 return NULL; 790 812 } 791 813 792 814 nomObjClass->mtab=nomClass->mtab; /* Now it's an object */ 793 815 794 _nomSetObjectCreateInfo(nomObjClass, pGlobalNomEnv->ncpNOMObject, NULL HANDLE); /* This NOMClassPriv holds all info to build816 _nomSetObjectCreateInfo(nomObjClass, pGlobalNomEnv->ncpNOMObject, NULL); /* This NOMClassPriv holds all info to build 795 817 instances of NOMObject (not that anybody 796 818 should do that but... */ 819 #ifndef _MSC_VER 797 820 #warning !!!!!!!!!!!!! _somSetObjectsSCI() not called!!!!!!!!!!!!!!!! 798 821 #warning !!!!!!!!!!!!! _somSetClassData() not called!!!!!!!!!!!!!!!! 822 #endif 799 823 #if 0 800 824 _somSetObjectsSCI(nomObjClass, ncp->sci); … … 828 852 NOMClassPriv *nClass; 829 853 NOMClassPriv *ncpParent; 830 ULONGulParentDataSize=0;831 ULONGmtabSize;832 ULONGulMemSize=0;854 gulong ulParentDataSize=0; 855 gulong mtabSize; 856 gulong ulMemSize=0; 833 857 int a; 834 858 … … 856 880 857 881 if(!strcmp(*sci->nomClassId, "NOMObject")){ 858 if(pGlobalNomEnv->ncpNOMObject!=NULL HANDLE){882 if(pGlobalNomEnv->ncpNOMObject!=NULL){ 859 883 DBG_NOMBUILDCLASS(TRUE, "Class %s already built. returning 0x%x\n", 860 884 *sci->nomClassId, sci->nomCds->nomClassObject); 861 885 /* FIXME: this seems to be broken!! */ 862 return NULL HANDLE; /* NOMObject already built */886 return NULL; /* NOMObject already built */ 863 887 } 864 888 } … … 871 895 if(sci->ulNumStaticMethods!=0 && !sci->nomSMethods){ 872 896 nomPrintf(" !!! %s line %d: sci->nomSMethods is NULL for %s !!!\n", __FUNCTION__, __LINE__, *sci->nomClassId); 873 return NULL HANDLE;897 return NULL; 874 898 } 875 899 /* Fill static classdata with the info from nomStaticMethodDesc array. This means … … 903 927 priv_buildNOMObjectClassInfo(ulReserved, sci, /* yes */ 904 928 ulMajorVersion, ulMinorVersion); 905 return NULL HANDLE; /* We can't return a NOMClass for NOMObject because NOMClass isn't built yet. */929 return NULL; /* We can't return a NOMClass for NOMObject because NOMClass isn't built yet. */ 906 930 } 907 931 … … 914 938 if(sci->nomIdAllParents) { 915 939 #ifdef DEBUG_NOMBUILDCLASS 940 # ifndef _MSC_VER 916 941 #warning !!!!! Change this when nomId is a GQuark !!!!! 942 # endif 917 943 nomPrintf("%d: About to search parent %s...\n", __LINE__, **(sci->nomIdAllParents)); 918 944 #endif … … 927 953 #endif 928 954 if(!ncpParent) 929 return NULL HANDLE; /* Every class except NOMObject must have a parent!! */955 return NULL; /* Every class except NOMObject must have a parent!! */ 930 956 }/* nomIdAllParents */ 931 957 else 932 return NULL HANDLE; /* Every class except NOMObject must have a parent!! */958 return NULL; /* Every class except NOMObject must have a parent!! */ 933 959 934 960 if(!ncpParent) 935 return NULL HANDLE; /* Every class except NOMObject must have a parent!! */961 return NULL; /* Every class except NOMObject must have a parent!! */ 936 962 937 963 #ifdef DEBUG_NOMBUILDCLASS … … 1029 1055 1030 1056 /* Alloc class struct using NOMCalloc. */ 1031 if((nClass=(NOMClassPriv*)NOMCalloc(1, ulMemSize))==NULL HANDLE)1032 return NULL HANDLE;1057 if((nClass=(NOMClassPriv*)NOMCalloc(1, ulMemSize))==NULL) 1058 return NULL; 1033 1059 1034 1060 #if 0 … … 1039 1065 if(!nClass->mThunk) { 1040 1066 NOMFree(nClass); 1041 return NULL HANDLE;1067 return NULL; 1042 1068 } 1043 1069 } … … 1046 1072 nClass->ulClassSize=sci->ulInstanceDataSize+ulParentDataSize; 1047 1073 1048 if((nomClass=(NOMClass*)NOMCalloc(1, sci->ulInstanceDataSize+ulParentDataSize))==NULL HANDLE) {1074 if((nomClass=(NOMClass*)NOMCalloc(1, sci->ulInstanceDataSize+ulParentDataSize))==NULL) { 1049 1075 //NOMFree(nClass->mThunk); 1050 1076 NOMFree(nClass); 1051 return NULL HANDLE;1077 return NULL; 1052 1078 } 1053 1079 … … 1058 1084 NOMFree(nClass); 1059 1085 NOMFree(nomClass); 1060 return NULL HANDLE;1086 return NULL; 1061 1087 }; 1062 1088 … … 1088 1114 1089 1115 /* Set this class size into instance var */ 1116 #ifndef _MSC_VER 1090 1117 #warning !!!!! No call of _nomSetInstanceSize() here !!!!! 1118 #endif 1091 1119 // _nomSetInstanceSize(nomClass, sci->ulInstanceDataSize+ulParentDataSize); 1092 1120 … … 1149 1177 sID=SOMMalloc(sizeof(void*)); 1150 1178 if(!sID) 1151 return NULL HANDLE;1179 return NULL; 1152 1180 1153 1181 *sID=(char*)sid; … … 1156 1184 1157 1185 /* No somId registered yet, so create one */ 1158 if((sid=(somIdItem*)SOMCalloc(1, sizeof(somIdItem)))==NULL HANDLE)1159 return NULL HANDLE;1186 if((sid=(somIdItem*)SOMCalloc(1, sizeof(somIdItem)))==NULL) 1187 return NULL; 1160 1188 1161 1189 sid->idString=SOMMalloc(strlen(aString)+1); … … 1163 1191 { 1164 1192 SOMFree(sid); 1165 return NULL HANDLE;1193 return NULL; 1166 1194 } 1167 1195 … … 1172 1200 SOMFree(sid->idString); 1173 1201 SOMFree(sid); 1174 return NULL HANDLE;1202 return NULL; 1175 1203 } 1176 1204 1177 1205 sID=SOMMalloc(sizeof(void*)); 1178 1206 if(!sID) 1179 return NULL HANDLE;1207 return NULL; 1180 1208 1181 1209 *sID=(char*)sid; … … 1193 1221 char* chrPtr; 1194 1222 SOMClassPriv *scp; 1195 ULONGulLen;1223 gulong ulLen; 1196 1224 char *chrMem; 1197 1225 1198 1226 if(!sid) 1199 return NULL HANDLE;1200 1201 if((chrPtr=strchr(**sid, ':'))==NULL HANDLE)1202 return NULL HANDLE;1227 return NULL; 1228 1229 if((chrPtr=strchr(**sid, ':'))==NULL) 1230 return NULL; 1203 1231 1204 1232 /* Create local copy */ 1205 1233 ulLen=strlen(**sid); 1206 1234 if(ulLen>5000) /* prevent stack overflow in case of error */ 1207 return NULL HANDLE;1235 return NULL; 1208 1236 1209 1237 chrMem=alloca(ulLen); 1210 1238 strcpy(chrMem, **sid); 1211 1239 1212 if((chrPtr=strchr(chrMem, ':'))==NULL HANDLE)1213 return NULL HANDLE; /* How should that happen, but anyway... */1240 if((chrPtr=strchr(chrMem, ':'))==NULL) 1241 return NULL; /* How should that happen, but anyway... */ 1214 1242 1215 1243 *chrPtr=0; /* Now we have separated the class name */ … … 1222 1250 #endif 1223 1251 if(!scp) 1224 return NULL HANDLE;1252 return NULL; 1225 1253 #ifdef DEBUG_SOMBUILDCLASS 1226 1254 somPrintf("%d: %s: found %x (SOMClassPriv) ->%x (SOMClass)\n", __LINE__, __FUNCTION__, scp, scp->mtab->classObject); … … 1240 1268 char* chrPtr; 1241 1269 SOMClassPriv *scp; 1242 ULONGulLen;1270 gulong ulLen; 1243 1271 char *chrMem; 1244 1272 1245 1273 if(!sid) 1246 return NULL HANDLE;1247 1248 if((chrPtr=strchr(**sid, ':'))==NULL HANDLE)1249 return NULL HANDLE;1274 return NULL; 1275 1276 if((chrPtr=strchr(**sid, ':'))==NULL) 1277 return NULL; 1250 1278 1251 1279 /* Create local copy */ 1252 1280 ulLen=strlen(**sid); 1253 1281 if(ulLen>5000) /* prevent stack overflow in case of error */ 1254 return NULL HANDLE;1282 return NULL; 1255 1283 1256 1284 chrMem=alloca(ulLen); 1257 1285 strcpy(chrMem, **sid); 1258 1286 1259 if((chrPtr=strchr(chrMem, ':'))==NULL HANDLE)1260 return NULL HANDLE; /* How should that happen, but anyway... */1287 if((chrPtr=strchr(chrMem, ':'))==NULL) 1288 return NULL; /* How should that happen, but anyway... */ 1261 1289 1262 1290 *chrPtr=0; /* Now we have separated the class name */ … … 1267 1295 somPrintf("%d: %s: found %x (SOMClassPriv)\n", __LINE__, __FUNCTION__, scp); 1268 1296 if(!scp) 1269 return NULL HANDLE;1297 return NULL; 1270 1298 #ifdef DEBUG_SOMBUILDCLASS 1271 1299 somPrintf("%d: %s: found %x (SOMClassPriv) ->%x\n", __LINE__, __FUNCTION__, scp, scp->mtab->classObject); … … 1284 1312 FIXME: semaphores ???? 1285 1313 */ 1286 static ULONGpriv_getIndexOfMethodToBeOverriden(somId *methodId )1314 static gulong priv_getIndexOfMethodToBeOverriden(somId *methodId ) 1287 1315 { 1288 1316 return 0; … … 1297 1325 struct somMethodTabListStruct; 1298 1326 struct somParentMtabStruct; Struct to place parent mtab pointer 1299 ULONGthunk[3]; Assembler thunking code1327 gulong thunk[3]; Assembler thunking code 1300 1328 somMethodTabStruct mtabStruct; See beloe 1301 1329 ClassDataStruct class1; … … 1367 1395 long minorVersion) 1368 1396 { 1369 BYTE* mem;1397 guint8 * mem; 1370 1398 SOMClassPriv *sClass; /* This struct holds our private data. A pointer will be in mtab->classInfo */ 1371 1399 SOMClass *somClass; /* A real SOMClass pointer */ 1372 1400 int a; 1373 ULONGmtabSize;1374 ULONGulMemSize=0;1375 ULONGulParentDataSize=0;1401 gulong mtabSize; 1402 gulong ulMemSize=0; 1403 gulong ulParentDataSize=0; 1376 1404 1377 1405 #ifdef DEBUG_BUILDSOMOBJECT … … 1382 1410 1383 1411 /* Note: SOMObject has no parents */ 1384 return NULL HANDLE;1412 return NULL; 1385 1413 1386 1414 /* ulMemsize will be the size of our private class structure SOMClassPriv */ … … 1397 1425 1398 1426 /* Alloc private class struct using SOMCalloc. */ 1399 if((sClass=(SOMClassPriv*)SOMCalloc(1, ulMemSize))==NULL HANDLE)1400 return NULL HANDLE;1427 if((sClass=(SOMClassPriv*)SOMCalloc(1, ulMemSize))==NULL) 1428 return NULL; 1401 1429 1402 1430 /* Get mem for method thunking code. This assembler code is needed so the indirect … … 1407 1435 if(!sClass->mThunk) { 1408 1436 SOMFree(sClass); 1409 return NULL HANDLE;1437 return NULL; 1410 1438 } 1411 1439 … … 1425 1453 /* And now the real SOMClass struct which will be seen by the user. A SOMClass has a mTab pointer 1426 1454 at the beginning and the instance data following. */ 1427 if((somClass=(SOMClass*)SOMCalloc(1, sci->instanceDataSize+sizeof(somMethodTab*)))==NULL HANDLE) {1455 if((somClass=(SOMClass*)SOMCalloc(1, sci->instanceDataSize+sizeof(somMethodTab*)))==NULL) { 1428 1456 SOMFree(sClass->mThunk); 1429 1457 SOMFree(sClass); 1430 return NULL HANDLE;1458 return NULL; 1431 1459 } 1432 1460 somClass->mtab=sClass->mtab; … … 1461 1489 /* Now finally put the thunking in so the procedures are resolved correctly. */ 1462 1490 for(a=0;a<sci->numStaticMethods;a++) { 1463 ULONGulOffset;1491 gulong ulOffset; 1464 1492 1465 1493 memcpy(&sClass->mThunk[a], mThunkCode, sizeof(mThunkCode)); /* Copy method thunking code template */ 1466 ulOffset=( ULONG)((char*)(mem+sizeof(SOMClass*))-(char*)somClass->mtab); /* Skip priv class data pointer */1494 ulOffset=(gulong)((char*)(mem+sizeof(SOMClass*))-(char*)somClass->mtab); /* Skip priv class data pointer */ 1467 1495 sClass->mThunk[a].thunk[2]=((ulOffset+a*sizeof(somMethodProc*))<<8)+0xa2; /* Calculate offset for assembler code */ 1468 1496 #ifdef DEBUG_BUILDSOMOBJECT -
trunk/nom/src/nombuildnomcls.c
r255 r326 33 33 * ***** END LICENSE BLOCK ***** */ 34 34 35 #define INCL_DOS 36 #define INCL_DOSERRORS 37 38 #include <os2.h> 35 #ifdef __OS2__ 36 # define INCL_DOS 37 # define INCL_DOSERRORS 38 # include <os2.h> 39 #endif /* __OS2__ */ 40 39 41 #include <stdio.h> 40 42 … … 63 65 #define BUILDNOMCLASS_ENTER 64 66 #define BUILDNOMCLASS_LEAVE 67 # ifdef _MSC_VER 68 void _inline DBG_BUILDNOMCLASS(gboolean a, const char *msg, ...) 69 { 70 /* sorry, nothing here. */ 71 } 72 # else 65 73 #define DBG_BUILDNOMCLASS(a, b,...) 74 # endif 66 75 #endif 67 76 … … 71 80 72 81 extern PNOM_ENV pGlobalNomEnv; 73 extern ULONGthunk[];74 extern ULONGmThunkCode[];82 extern gulong thunk[]; 83 extern gulong mThunkCode[]; 75 84 76 85 /********************************************************/ … … 119 128 120 129 /* Alloc private class struct using SOMCalloc. */ 121 if((nClass=(NOMClassPriv*)NOMCalloc(1, gulMemSize))==NULL HANDLE)122 return NULL HANDLE;130 if((nClass=(NOMClassPriv*)NOMCalloc(1, gulMemSize))==NULL) 131 return NULL; 123 132 124 133 /* Get mem for method thunking code. This assembler code is needed so the indirect … … 132 141 if(!nClass->mThunk) { 133 142 NOMFree(nClass); 134 return NULL HANDLE;143 return NULL; 135 144 } 136 145 } … … 150 159 if(!addMethodAndDataToThisPrivClassStruct( nClass, ncpParent, sci)){ 151 160 NOMFree(nClass); 152 return NULL HANDLE;161 return NULL; 153 162 }; 154 163 … … 158 167 nClass->mtab->mtabSize=mtabSize; 159 168 nClass->mtab->nomClsInfo=(nomClassInfo*)nClass; /* Hold a pointer to the private data that is this NOMClassPriv */ 169 #ifndef _MSC_VER 160 170 #warning !!!!! Change this when nomId is a GQuark !!!!! 171 #endif 161 172 nClass->mtab->nomClassName=*sci->nomClassId; 162 173 nClass->mtab->ulInstanceSize=sci->ulInstanceDataSize+gulParentDataSize; /* Size of instance data of this class and all … … 205 216 else{ 206 217 g_error("No NOMObject while trying to build NOMClass."); /* This will result in a termination of the app! */ 207 return NULL HANDLE; /* NOMClass *must* have an object as parent!218 return NULL; /* NOMClass *must* have an object as parent! 208 219 We won't reach this point */ 209 220 } … … 223 234 224 235 /* Build the NOMClassPriv for NOMClass */ 225 if((nClass=buildNOMClassPrivStruct(sci, ncpParent))==NULL HANDLE)226 return NULL HANDLE;236 if((nClass=buildNOMClassPrivStruct(sci, ncpParent))==NULL) 237 return NULL; 227 238 228 239 ulParentDataSize=ncpParent->mtab->ulInstanceSize; /* Parent instance size. This is the mtab pointer + instance vars */ … … 231 242 /* And now the NOMClass struct. A NOMClass has a mTab pointer at the beginning and the instance data 232 243 following (including the parent instance data).*/ 233 if((nomClass=(NOMClass*)NOMCalloc(1, sci->ulInstanceDataSize+ulParentDataSize))==NULL HANDLE) {244 if((nomClass=(NOMClass*)NOMCalloc(1, sci->ulInstanceDataSize+ulParentDataSize))==NULL) { 234 245 NOMFree(nClass->mThunk); 235 246 NOMFree(nClass); 236 return NULL HANDLE;247 return NULL; 237 248 } 238 249 … … 274 285 pGlobalNomEnv->defaultMetaClass=nomClass; 275 286 287 #ifndef _MSC_VER 276 288 #warning !!!!! _nomSetInstanceSize() not called !!!!! 289 #endif 277 290 #if 0 278 291 /* Set this class size into instance var */ … … 281 294 282 295 /* Run initialization code if any */ 283 _nomInit(nomClass, NULL HANDLE);296 _nomInit(nomClass, NULL); 284 297 return nomClass; 285 298 } -
trunk/nom/src/nombuildnomobj.c
r255 r326 33 33 * ***** END LICENSE BLOCK ***** */ 34 34 35 #define INCL_DOS 36 #define INCL_DOSERRORS 37 38 #include <os2.h> 35 #ifdef __OS2__ 36 # define INCL_DOS 37 # define INCL_DOSERRORS 38 # include <os2.h> 39 #endif /* __OS2__ */ 40 39 41 #include <stdio.h> 40 42 #include <string.h> … … 67 69 */ 68 70 69 static ULONGthunk[]={0x0424448b, 0x00000405, 0x0000c300};71 static gulong thunk[]={0x0424448b, 0x00000405, 0x0000c300}; 70 72 71 73 /* … … 74 76 JMP DWORD PTR [EDX+0ACh] : JMP to address pointing to by EDX+0ACh 75 77 */ 76 static ULONGmThunkCode[]={0x04244c8b, 0xff00518b, 0x0000aca2 , 0x16000000};78 static gulong mThunkCode[]={0x04244c8b, 0xff00518b, 0x0000aca2 , 0x16000000}; 77 79 78 80 /********************************************************/ … … 100 102 gulong mtabSize; 101 103 gulong ulMemSize=0; 102 BYTE* mem;104 guint8 * mem; 103 105 int a; 104 106 … … 116 118 117 119 /* Alloc private class struct using NOMCalloc. */ 118 if((nClass=(NOMClassPriv*)NOMCalloc(1, ulMemSize))==NULL HANDLE)119 return NULL HANDLE;120 if((nClass=(NOMClassPriv*)NOMCalloc(1, ulMemSize))==NULL) 121 return NULL; 120 122 121 123 … … 138 140 nClass->mtab->mtabSize=mtabSize; /* This mtab is the same as the one used in the public NOMClass */ 139 141 nClass->mtab->nomClsInfo=(nomClassInfo*)nClass; /* Hold a pointer to the private data that is this NOMClassPriv */ 142 #ifndef _MSC_VER 140 143 #warning !!!!! Change this when nomId is a GQuark !!!!! 144 #endif 141 145 nClass->mtab->nomClassName=*sci->nomClassId; 142 146 nClass->mtab->ulInstanceSize=sci->ulInstanceDataSize+sizeof(nomMethodTabPtr); /* sizeof(methodTabStruct*) + size of instance data of this class … … 151 155 if(!nClass->mThunk) { 152 156 NOMFree(nClass); 153 return NULL HANDLE;157 return NULL; 154 158 } 155 159 } … … 172 176 /* Now finally put the thunking in so the procedures are resolved correctly. */ 173 177 for(a=0;a<sci->ulNumStaticMethods;a++) { 174 ULONGulOffset;178 gulong ulOffset; 175 179 176 180 memcpy(&nClass->mThunk[a], mThunkCode, sizeof(mThunkCode)); /* Copy method thunking code template */ 177 ulOffset=( ULONG)((char*)(mem+sizeof(NOMClass*))-(char*)nClass->mtab); /* Skip priv class data pointer */181 ulOffset=(gulong)((char*)(mem+sizeof(NOMClass*))-(char*)nClass->mtab); /* Skip priv class data pointer */ 178 182 nClass->mThunk[a].thunk[2]=((ulOffset+a*sizeof(nomMethodProc*))<<8)+0xa2; /* Calculate offset for assembler code */ 179 183 #ifdef DEBUG_BUILDNOMOBJECT … … 202 206 { 203 207 NOMClassPriv *nClassPriv; /* This struct holds our private data. A pointer will be in mtab->nomClsInfo */ 204 ULONGulParentDataSize=0;208 gulong ulParentDataSize=0; 205 209 206 210 #ifdef DEBUG_BUILDNOMOBJECT … … 210 214 211 215 /* Note: NOMObject has no parents */ 212 if((nClassPriv=buildNOMClassPrivStructForNOMObject(sci))==NULL HANDLE)213 return NULL HANDLE;216 if((nClassPriv=buildNOMClassPrivStructForNOMObject(sci))==NULL) 217 return NULL; 214 218 215 219 #ifdef DEBUG_BUILDNOMOBJECT … … 221 225 sci->ccds->parentMtab->mtab=nClassPriv->mtab; /* This class mtab */ 222 226 sci->ccds->parentMtab->next=NULL; /* We dont have parents because we are NOMObject */ 223 sci->ccds->parentMtab->nomClassObject=NULL HANDLE; /* NOMClass* Class object. We don't have one yet */227 sci->ccds->parentMtab->nomClassObject=NULL; /* NOMClass* Class object. We don't have one yet */ 224 228 sci->ccds->parentMtab->ulInstanceSize=nClassPriv->mtab->ulInstanceSize; 225 229 /* C Class data structure */ … … 267 271 268 272 /* Run initialization code if any */ 269 _nomInit((NOMObject*)nClassPriv, NULL HANDLE);270 return NULL HANDLE;273 _nomInit((NOMObject*)nClassPriv, NULL); 274 return NULL; 271 275 } 272 276 -
trunk/nom/src/nomdebug.c
r281 r326 33 33 * ***** END LICENSE BLOCK ***** */ 34 34 35 #define INCL_DOS 36 #define INCL_DOSFILEMGR 37 #define INCL_DOSERRORS 38 #define INCL_WIN 39 #define INCL_WINWORKPLACE 40 #define INCL_OS2MM 41 #define INCL_MMIOOS2 42 #define INCL_MCIOS2 43 #define INCL_GPI 44 #define INCL_PM 45 46 #include <os2.h> 35 #ifdef __OS2__ 36 # define INCL_DOS 37 # define INCL_DOSFILEMGR 38 # define INCL_DOSERRORS 39 # define INCL_WIN 40 # define INCL_WINWORKPLACE 41 # define INCL_OS2MM 42 # define INCL_MMIOOS2 43 # define INCL_MCIOS2 44 # define INCL_GPI 45 # define INCL_PM 46 # include <os2.h> 47 #endif /* __OS2__ */ 48 47 49 #include <stdarg.h> 48 50 #include <stdio.h> … … 65 67 g_error("The object used to call the method %s is not a valid NOM object. ", chrMethodName); 66 68 else 67 g_error("The object for which the method %s should be called is not valid for this method.\nThe object must be some instance of class %s (or of a subclass) but is a %s.", chrMethodName, NOMClass_nomGetCreatedClassName(nomClass, NULL HANDLE),68 NOMObject_nomGetClassName(nomObject, NULL HANDLE));69 g_error("The object for which the method %s should be called is not valid for this method.\nThe object must be some instance of class %s (or of a subclass) but is a %s.", chrMethodName, NOMClass_nomGetCreatedClassName(nomClass, NULL), 70 NOMObject_nomGetClassName(nomObject, NULL)); 69 71 } 70 72 } … … 114 116 115 117 // g_message("In %s with %s %px nomClass: %px (%s)", __FUNCTION__, chrMethodName, nomSelf, nomClass, nomClass->mtab->nomClassName); 116 if(!nomIsObj(nomSelf) || !_nomIsANoClsCheck(nomSelf, nomClass, NULL HANDLE))118 if(!nomIsObj(nomSelf) || !_nomIsANoClsCheck(nomSelf, nomClass, NULL)) 117 119 { 118 120 nomPrintObjectPointerErrorMsg(nomSelf, nomClass, chrMethodName); … … 154 156 nomPrintf("----- %s ----- NOMClassMgrObject: %lx\n", __FUNCTION__, NOMClassMgrObject); 155 157 156 pgdata=_nomGetClassList(NOMClassMgrObject, NULL HANDLE);158 pgdata=_nomGetClassList(NOMClassMgrObject, NULL); 157 159 if(pgdata){ 158 160 nomPrintf("%s: classlist: %lx\n", __FUNCTION__, pgdata); … … 176 178 nomPrintf("explicitMetaId (meta class): %s\n", *sci->nomExplicitMetaId); 177 179 else 178 nomPrintf("explicitMetaId (meta class): NULL HANDLE\n");180 nomPrintf("explicitMetaId (meta class): NULL\n"); 179 181 // somPrintf("*parents: 0x%x\n", sci->parents); 180 182 nomPrintf("somClassDataStructure cds: 0x%x\n",sci->nomCds); … … 190 192 191 193 192 void _dumpClassDataStruct(nomClassDataStructure* cds, ULONGulNumMethods)194 void _dumpClassDataStruct(nomClassDataStructure* cds, gulong ulNumMethods) 193 195 { 194 196 int a; … … 215 217 nomPrintf(" instanceSize (this and all parents): %d 0x%x\n", mtab->ulInstanceSize, mtab->ulInstanceSize); 216 218 nomPrintf(" mtabSize: %d 0x%x\n", mtab->mtabSize, mtab->mtabSize); 217 nomPrintf(" somMethodProcs: (%ld)\n", (mtab->mtabSize-( LONG)sizeof(nomMethodTab))/4);219 nomPrintf(" somMethodProcs: (%ld)\n", (mtab->mtabSize-(glong)sizeof(nomMethodTab))/4); 218 220 // entries=sObj->mtab->entries[0]; 219 221 for(a=0; a<=(mtab->mtabSize-sizeof(nomMethodTab))/4; a++) … … 234 236 nomPrintf("*classInfo: 0x%x\n", *sObj->mtab->nomClsInfo); 235 237 236 so=( ULONG*)sObj->mtab->classInfo;238 so=(gulong*)sObj->mtab->classInfo; 237 239 #endif 238 240 nomPrintf("className: %s\n", sObj->mtab->nomClassName); … … 249 251 250 252 #if 0 251 void _dumpStaticMTab(somStaticMethod_t* smt, ULONGulMethod)253 void _dumpStaticMTab(somStaticMethod_t* smt, gulong ulMethod) 252 254 { 253 255 somStaticMethod_t* tmpSmt=&smt[ulMethod]; … … 262 264 } 263 265 264 void _dumpOverrideMTab(somOverrideMethod_t* omt, ULONGulMethod)266 void _dumpOverrideMTab(somOverrideMethod_t* omt, gulong ulMethod) 265 267 { 266 268 somOverrideMethod_t* tmpOmt=&omt[ulMethod]; … … 300 302 tempPtr=(void*)tempPtr->next->mtab; 301 303 else 302 tempPtr=NULL HANDLE;304 tempPtr=NULL; 303 305 } 304 306 … … 400 402 somPrintf(" instanceSize (this and all parents): %d 0x%x\n", sObj->mtab->instanceSize, sObj->mtab->instanceSize); 401 403 somPrintf(" mtabSize: %d 0x%x\n", sObj->mtab->mtabSize, sObj->mtab->mtabSize); 402 somPrintf(" somMethodProcs: (%ld)\n", (sObj->mtab->mtabSize-( LONG)sizeof(somMethodTab))/4);404 somPrintf(" somMethodProcs: (%ld)\n", (sObj->mtab->mtabSize-(glong)sizeof(somMethodTab))/4); 403 405 // entries=sObj->mtab->entries[0]; 404 406 for(a=0; a<=(sObj->mtab->mtabSize-sizeof(somMethodTab))/4; a++) -
trunk/nom/src/nomgc.c
r286 r326 37 37 */ 38 38 39 #define INCL_DOS 40 #define INCL_DOSERRORS 41 #define INCL_DOSMEMMGR 42 #include <os2.h> 39 #ifdef __OS2__ 40 # define INCL_DOS 41 # define INCL_DOSERRORS 42 # define INCL_DOSMEMMGR 43 # include <os2.h> 44 #endif /* __OS2__ */ 43 45 44 46 #include <stdio.h> … … 83 85 memory functions as the GLIB default allocation function. 84 86 */ 87 #ifdef __OS2__ 85 88 void _System nomInitGarbageCollection(void* pMemInExe) 89 #else 90 void nomInitGarbageCollection(void* pMemInExe) 91 #endif 86 92 { 87 93 GMemVTable vtbl={0}; … … 98 104 99 105 /* Cretea tree holding the already registered DLLs */ 106 #ifdef _MSC_VER 100 107 treeRegisteredDLL=g_tree_new((GCompareFunc)stricmp); 108 #else 109 treeRegisteredDLL=g_tree_new((GCompareFunc)strcasecmp); 110 #endif 101 111 102 112 bUseGC=TRUE; … … 104 114 105 115 116 #ifdef __OS2__ 106 117 void test() 107 118 { … … 110 121 HMODULE hModule; 111 122 112 if(DosQueryModFromEIP( &hModule, &ulObj, CCHMAXPATH, thePath, &ulOffset, ( ULONG)test)!=0) {123 if(DosQueryModFromEIP( &hModule, &ulObj, CCHMAXPATH, thePath, &ulOffset, (gulong)test)!=0) { 113 124 hModule=0; 114 125 return ; /* Error */ … … 116 127 117 128 } 129 #endif /* __OS2__ */ 118 130 119 131 NOMEXTERN void NOMLINK nomRegisterDataAreaForGC(char* pStart, char* pEnd) … … 122 134 } 123 135 136 #ifdef __OS2__ 137 124 138 static void qsAddDLLToList(HREGDLL hReg, qsLrec_t* rec) 125 139 { 126 if(NULL HANDLE==g_slist_find(hReg->dllList, rec))140 if(NULL==g_slist_find(hReg->dllList, rec)) 127 141 hReg->dllList=g_slist_append(hReg->dllList, rec); 128 142 } … … 160 174 /* g_message("%d Checking: %x -> %04X (%s)", a, pModRec, pModRec->hmte, pModRec->pName); */ 161 175 162 if (NULL HANDLE==pModRec->pObjInfo && pModRec->ctObj > 0)176 if (NULL==pModRec->pObjInfo && pModRec->ctObj > 0) 163 177 { 164 178 pModRec->pObjInfo = (qsLObjrec_t*)((char*)pModRec … … 179 193 } 180 194 195 181 196 /** 182 197 Get the info about the current DLLs from OS/2. Go over all found … … 187 202 NOMEXTERN HREGDLL NOMLINK nomBeginRegisterDLLWithGC(void) 188 203 { 189 ULONGrc;190 HREGDLL hReg=NULL HANDLE;204 gulong rc; 205 HREGDLL hReg=NULL; 191 206 PTIB ptib; 192 207 PPIB ppib; 193 208 char * buf; 194 HREGDLL pRegDLL=NULL HANDLE;209 HREGDLL pRegDLL=NULL; 195 210 196 211 rc = DosGetInfoBlocks(&ptib, &ppib); 197 212 if (rc!=NO_ERROR) 198 return NULL HANDLE;213 return NULL; 199 214 200 215 buf = malloc(BUFSIZE); 201 216 if(!buf) 202 return NULL HANDLE;217 return NULL; 203 218 204 219 pRegDLL =(HREGDLL) malloc(sizeof(REGDLL)); 205 220 if(!pRegDLL){ 206 221 free(buf); 207 return NULL HANDLE;222 return NULL; 208 223 } 209 pRegDLL->dllList=NULL HANDLE;224 pRegDLL->dllList=NULL; 210 225 211 226 memset(buf,0,BUFSIZE); … … 303 318 #define OBJWRITE 0x0002L 304 319 #define OBJINVALID 0x0080L 305 NOMEXTERN BOOLNOMLINK nomRegisterDLLByName(const HREGDLL hRegisterDLL, const char* chrDLLName)320 NOMEXTERN gboolean NOMLINK nomRegisterDLLByName(const HREGDLL hRegisterDLL, const char* chrDLLName) 306 321 { 307 322 GSList* lTemp; … … 316 331 if(pModRec){ 317 332 // g_message("DLL name: %s", pModRec->pName); 318 if(pModRec->pName && (NULL HANDLE!=strstr( pModRec->pName, chrDLLName)))333 if(pModRec->pName && (NULL!=strstr( pModRec->pName, chrDLLName))) 319 334 { 320 335 qsLObjrec_t *pObjInfo; 321 336 //g_message(" --> Found DLL %s", pModRec->pName); 322 337 pObjInfo=pModRec->pObjInfo; 323 if(NULL HANDLE!=pObjInfo)338 if(NULL!=pObjInfo) 324 339 { 325 340 int iObj; … … 344 359 } 345 360 346 347 NOMEXTERN BOOL NOMLINK nomQueryUsingNameIsDLLRegistered(const gchar *chrName) 348 { 349 if(NULLHANDLE!=g_tree_lookup(treeRegisteredDLL, chrName)) 361 //#elif defined(_WIN32) 362 #else /* PORTME */ 363 364 NOMEXTERN HREGDLL NOMLINK nomBeginRegisterDLLWithGC(void) 365 { 366 HREGDLL pRegDLL; 367 368 pRegDLL =(HREGDLL) malloc(sizeof(REGDLL)); 369 if(pRegDLL) 370 pRegDLL->dllList=NULL; 371 return pRegDLL; 372 } 373 374 NOMEXTERN void NOMLINK nomEndRegisterDLLWithGC(const HREGDLL hRegisterDLL ) 375 { 376 } 377 378 NOMEXTERN gboolean NOMLINK nomRegisterDLLByName(const HREGDLL hRegisterDLL, const char* chrDLLName) 379 { 350 380 return TRUE; 381 } 382 383 #endif 384 385 NOMEXTERN gboolean NOMLINK nomQueryUsingNameIsDLLRegistered(const gchar *chrName) 386 { 387 if(NULL!=g_tree_lookup(treeRegisteredDLL, chrName)) 388 return TRUE; 351 389 352 390 return FALSE; -
trunk/nom/src/nomid.c
r190 r326 33 33 * ***** END LICENSE BLOCK ***** */ 34 34 35 #define INCL_DOS 36 #define INCL_DOSERRORS 37 38 #include <os2.h> 35 #ifdef __OS2__ 36 # define INCL_DOS 37 # define INCL_DOSERRORS 38 # include <os2.h> 39 #endif /* __OS2__ */ 39 40 40 41 #include "nom.h" -
trunk/nom/src/nommemory.c
r193 r326 33 33 * ***** END LICENSE BLOCK ***** */ 34 34 35 #define INCL_DOS 36 #define INCL_DOSERRORS 37 #define INCL_DOSMEMMGR 35 #ifdef __OS2__ 36 # define INCL_DOS 37 # define INCL_DOSERRORS 38 # define INCL_DOSMEMMGR 39 # include <os2.h> 40 #endif /* __OS2__ */ 38 41 39 #include <os2.h>40 42 41 43 #include <string.h> 42 44 #include <stdlib.h> 43 45 44 #include <gtk/gtk.h> 46 /* #include <gtk/gtk.h> - why? */ 45 47 #include <nom.h> 46 48 #include <nomtk.h> … … 49 51 extern gboolean bUseGC; /* Set during initialization */ 50 52 51 NOMEXTERN nomToken NOMLINK NOMMalloc( ULONGsize)53 NOMEXTERN nomToken NOMLINK NOMMalloc(const gulong size) 52 54 { 53 55 gchar* memPtr; 54 56 55 if((memPtr=g_malloc(size))==NULL HANDLE)56 return NULL HANDLE;57 if((memPtr=g_malloc(size))==NULL) 58 return NULL; 57 59 58 60 return (nomToken) memPtr; … … 61 63 PULONG memPtr; 62 64 63 if((memPtr=g_malloc(size+sizeof(gpointer)))==NULL HANDLE)64 return NULL HANDLE;65 if((memPtr=g_malloc(size+sizeof(gpointer)))==NULL) 66 return NULL; 65 67 66 68 *memPtr=size; … … 70 72 } 71 73 72 nomToken NOMLINK NOMCalloc(const ULONG num, const ULONGsize)74 nomToken NOMLINK NOMCalloc(const gulong num, const gulong size) 73 75 { 74 76 gchar* memPtr; 75 77 76 if((memPtr=g_malloc(size*num ))==NULL HANDLE)77 return NULL HANDLE; /* We won't end here because GLib just terminates the process :-/78 if((memPtr=g_malloc(size*num ))==NULL) 79 return NULL; /* We won't end here because GLib just terminates the process :-/ 78 80 A really sick idea imho. */ 79 81 if(!bUseGC) … … 85 87 PULONG memPtr; 86 88 87 if((memPtr=g_malloc(size*num + sizeof( ULONG)))==NULLHANDLE)88 return NULL HANDLE; /* We won't end here because GLib just terminates the process :-/89 if((memPtr=g_malloc(size*num + sizeof(gulong)))==NULL) 90 return NULL; /* We won't end here because GLib just terminates the process :-/ 89 91 A really sick idea imho. */ 90 92 if(!bUseGC) 91 memset(memPtr, 0, size*num + sizeof( ULONG)); /* GC always returns zeroed memory */93 memset(memPtr, 0, size*num + sizeof(gulong)); /* GC always returns zeroed memory */ 92 94 93 95 *memPtr=size; … … 103 105 { 104 106 #if 0 105 ULONG* pul=(PULONG)memPtr;107 gulong* pul=(PULONG)memPtr; 106 108 107 109 pul--; -
trunk/nom/src/nomtkinit.c
r284 r326 33 33 * ***** END LICENSE BLOCK ***** */ 34 34 35 #define INCL_DOS 36 #define INCL_DOSERRORS 37 #define INCL_DOSMEMMGR 38 #include <os2.h> 35 #ifdef __OS2__ 36 # define INCL_DOS 37 # define INCL_DOSERRORS 38 # define INCL_DOSMEMMGR 39 # include <os2.h> 40 #endif /* __OS2__ */ 39 41 40 42 #include <stdarg.h> … … 59 61 PNOM_ENV pGlobalNomEnv; 60 62 /* Global class manager object */ 61 NOMClassMgr* NOMClassMgrObject=NULL HANDLE; /* Referenced from different files */63 NOMClassMgr* NOMClassMgrObject=NULL; /* Referenced from different files */ 62 64 63 65 gboolean fInitialized=FALSE; … … 80 82 { 81 83 if(NOMClassMgrObject) 82 return NOMClassMgr_nomIsObject(NOMClassMgrObject, (PNOMObject)nomObj, NULL HANDLE);84 return NOMClassMgr_nomIsObject(NOMClassMgrObject, (PNOMObject)nomObj, NULL); 83 85 84 86 if(!nomObj) … … 104 106 NOMEXTERN PNOM_ENV NOMLINK nomTkInit(void) 105 107 { 106 PVOIDmemPtr;108 void *memPtr; 107 109 108 110 if(pGlobalNomEnv) … … 170 172 171 173 /* Now register the classes we already have */ 172 _nomClassReady(pGlobalNomEnv->defaultMetaClass, NULL HANDLE); //NOMClass173 _nomClassReady( _NOMClassMgr, NULL HANDLE); //NOMClassMgr174 _nomClassReady(pGlobalNomEnv->defaultMetaClass, NULL); //NOMClass 175 _nomClassReady( _NOMClassMgr, NULL); //NOMClassMgr 174 176 ncPriv=(NOMClassPriv*)pGlobalNomEnv->nomObjectMetaClass->mtab->nomClsInfo; 175 177 176 178 /* Do not register the NOMObject metaclass here. It's already registered because it's 177 179 NOMClass in fact. */ 178 _nomClassReady(_NOMObject, NULL HANDLE); //NOMObject180 _nomClassReady(_NOMObject, NULL); //NOMObject 179 181 180 182 … … 186 188 187 189 nomPrintf("\nCalling _nomTestFunc_NOMTest2() 1\n", nomTst2Obj); 188 _nomTestFunc_NOMTest2(nomTst2Obj, NULL HANDLE);190 _nomTestFunc_NOMTest2(nomTst2Obj, NULL); 189 191 nomPrintf("\nCalling _nomTestFuncString_NOMTest2() 1\n", nomTst2Obj); 190 nomPrintf("--> %s\n",_nomTestFuncString_NOMTest2(nomTst2Obj, NULL HANDLE));192 nomPrintf("--> %s\n",_nomTestFuncString_NOMTest2(nomTst2Obj, NULL)); 191 193 nomPrintf("\nCalling _nomTestFunc_NOMTest2() 2\n", nomTst2Obj); 192 _nomTestFunc_NOMTest2(nomTst2Obj, NULL HANDLE);194 _nomTestFunc_NOMTest2(nomTst2Obj, NULL); 193 195 194 196 nomPrintf("\nCalling _nomTestFunc() with NOMTest2 object: %x\n", nomTst2Obj); 195 _nomTestFunc(nomTst2Obj, NULL HANDLE);197 _nomTestFunc(nomTst2Obj, NULL); 196 198 nomPrintf("\nCalling _nomTestFuncString() with NOMTest2: %x\n", nomTst2Obj); 197 nomPrintf("--> %s\n",_nomTestFuncString(nomTst2Obj, NULL HANDLE));199 nomPrintf("--> %s\n",_nomTestFuncString(nomTst2Obj, NULL)); 198 200 nomPrintf("\n"); 199 _nomTestFunc(nomTst2Obj, NULL HANDLE);200 _nomTestFunc_NOMTest2(nomTst2Obj, NULL HANDLE);201 _nomTestFunc(nomTst2Obj, NULL); 202 _nomTestFunc_NOMTest2(nomTst2Obj, NULL); 201 203 #endif 202 204 /* This must be done last! */
Note:
See TracChangeset
for help on using the changeset viewer.