Changeset 255
- Timestamp:
- Mar 15, 2007, 9:42:22 PM (18 years ago)
- Location:
- trunk
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ORBit2-2.14.0/src/idl-compiler/orbit-idl-c-headers.c
r254 r255 1321 1321 doWriteParametersOnly(of, tree); 1322 1322 fprintf(of, "ev) \\\n"); 1323 fprintf(of, " (parmCheckFunc_%s(nomSelf, ", id); 1324 /* Parameters for call */ 1325 doWriteParametersOnly(of, tree); 1326 1327 fprintf(of, "ev) ? \\\n"); 1328 fprintf(of, " (NOM_Resolve(nomSelf, %s, %s) \\\n", id2, id3); 1329 fprintf(of, " (nomSelf,"); 1330 /* add the parms */ 1331 doWriteParametersOnly(of, tree); 1332 fprintf(of, "ev)) : %s_retval)\n", id); 1333 1323 if(!strstr(id, "_nomIsObject")) 1324 { 1325 /* No check for _nomIsObject or otherwise we have a recursion */ 1326 fprintf(of, " (parmCheckFunc_%s(nomSelf, ", id); 1327 /* Parameters for call */ 1328 doWriteParametersOnly(of, tree); 1329 fprintf(of, "ev) ? \\\n"); 1330 fprintf(of, " (NOM_Resolve(nomSelf, %s, %s) \\\n", id2, id3); 1331 fprintf(of, " (nomSelf,"); 1332 /* add the parms */ 1333 doWriteParametersOnly(of, tree); 1334 fprintf(of, "ev)) : %s_retval)\n", id); 1335 } 1336 else 1337 { 1338 fprintf(of, " (NOM_Resolve(nomSelf, %s, %s) \\\n", id2, id3); 1339 fprintf(of, " (nomSelf,"); 1340 /* add the parms */ 1341 doWriteParametersOnly(of, tree); 1342 fprintf(of, "ev))\n"); 1343 } 1334 1344 /* else NOM_NO_PARAM_CHECK */ 1335 1345 fprintf(of, "#else /* Extended parameter check */\n"); … … 1340 1350 doWriteParametersOnly(of, tree); 1341 1351 fprintf(of, "ev) \\\n"); 1342 fprintf(of, " (objectCheckFunc_%s(nomSelf, ", id2); 1343 fprintf(of, " \"%s\") ? \\\n", id); 1344 fprintf(of, " (NOM_Resolve(nomSelf, %s, %s) \\\n", id2, id3); 1345 fprintf(of, " (nomSelf,"); 1346 /* add the parms */ 1347 doWriteParametersOnly(of, tree); 1348 fprintf(of, "ev)) : ("); 1349 orbit_cbe_write_param_typespec(of, tree); 1350 fprintf(of, ") NULL)\n"); 1352 if(!strstr(id, "_nomIsObject")) 1353 { 1354 /* No check for _nomIsObject or otherwise we have a recursion */ 1355 if(!strcmp(id2, "NOMObject")) 1356 fprintf(of, " (nomCheckNOMObjectPtr((NOMObject*)nomSelf, %sClassData.classObject,", id2); 1357 else 1358 fprintf(of, " (nomCheckObjectPtr((NOMObject*)nomSelf, %sClassData.classObject,", id2); 1359 fprintf(of, " \"%s\", ev) ? \\\n", id); /* method name */ 1360 fprintf(of, " (NOM_Resolve(nomSelf, %s, %s) \\\n", id2, id3); 1361 fprintf(of, " (nomSelf,"); 1362 /* add the parms */ 1363 doWriteParametersOnly(of, tree); 1364 fprintf(of, "ev)) : ("); 1365 orbit_cbe_write_param_typespec(of, tree); 1366 fprintf(of, ") NULL)\n"); 1367 } 1368 else 1369 { 1370 fprintf(of, " (NOM_Resolve(nomSelf, %s, %s) \\\n", id2, id3); 1371 fprintf(of, " (nomSelf,"); 1372 /* add the parms */ 1373 doWriteParametersOnly(of, tree); 1374 fprintf(of, "ev))\n"); 1375 } 1351 1376 fprintf(of, "#endif\n"); 1352 1377 … … 1480 1505 /******* Print generic object check function *******/ 1481 1506 1482 fprintf(ci->fh, "NOMEXTERN gboolean NOMLINK objectCheckFunc_%s(%s *nomSelf, gchar* chrMethodName);\n\n", id, id); 1483 1507 if(!strcmp(id, "NOMObject")) 1508 fprintf(ci->fh, "NOMEXTERN gboolean NOMLINK nomCheckNOMObjectPtr(NOMObject *nomSelf, NOMClass* nomClass, gchar* chrMethodName, CORBA_Environment *ev);\n\n"); 1509 else 1510 fprintf(ci->fh, "NOMEXTERN gboolean NOMLINK nomCheckObjectPtr(NOMObject *nomSelf, NOMClass* nomClass, gchar* chrMethodName, CORBA_Environment *ev);\n\n"); 1484 1511 1485 1512 /******* Print introduced methods *******/ -
trunk/ORBit2-2.14.0/src/idl-compiler/orbit-idl-c-skelimpl.c
r254 r255 460 460 check the object pointer. */ 461 461 fprintf(ski->of, "\n/* Function to check if an object is valid before calling a method on it */\n"); 462 fprintf(ski->of, "#if ndef NOM_NO_PARAM_CHECK\n");462 fprintf(ski->of, "#ifdef NOM_NO_PARAM_CHECK /* Disabled by now because not working */\n"); 463 463 fprintf(ski->of, "NOMEXTERN "); 464 464 fprintf(ski->of, "gboolean NOMLINK objectCheckFunc_%s(%s *nomSelf, gchar* chrMethodName)\n", … … 466 466 fprintf(ski->of, "{\n"); 467 467 468 fprintf(ski->of, "if(!nomIsObj(nomSelf) || !_nomIsA (nomSelf , %sClassData.classObject, NULLHANDLE))\n", id2);468 fprintf(ski->of, "if(!nomIsObj(nomSelf) || !_nomIsANoClsCheck(nomSelf , %sClassData.classObject, NULLHANDLE))\n", id2); 469 469 fprintf(ski->of, " {\n"); 470 470 fprintf(ski->of, " nomPrintObjectPointerError(nomSelf, \"%s\", chrMethodName);\n", id2); … … 1134 1134 fprintf(ski->of, "{\n"); 1135 1135 1136 fprintf(ski->of, "if(!nomIsObj(nomSelf) || !_nomIsA (nomSelf , %sClassData.classObject, NULLHANDLE))\n", id2);1136 fprintf(ski->of, "if(!nomIsObj(nomSelf) || !_nomIsANoClsCheck(nomSelf , %sClassData.classObject, NULLHANDLE))\n", id2); 1137 1137 fprintf(ski->of, " {\n"); 1138 1138 fprintf(ski->of, " nomPrintObjectPointerError(nomSelf, \"%s\", \"%s\");\n", id2, id); -
trunk/nom/class_c/nomclassmanager.c
r251 r255 302 302 NOMClassMgrData* nomThis=NOMClassMgrGetData(nomSelf); 303 303 304 g_message("In %s", __FUNCTION__); 304 305 NOMClassMgr_nomInit_parent((NOMObject*)nomSelf, ev); 305 306 -
trunk/nom/class_c/nomcls.c
r251 r255 79 79 gchar* nObj; 80 80 81 if(!nomSelf)82 return NULLHANDLE;83 84 81 if(!_ncpObject) 85 82 return NULLHANDLE; … … 134 131 CORBA_Environment *ev) 135 132 { 133 #if 0 134 CORBA_Environment tempEnv={0}; 135 tempEnv.fFlags=NOMENV_FLG_DONT_CHECK_OBJECT; 136 #endif 136 137 _nomRenewNoInit(nomSelf, nomObj, NULLHANDLE); 137 138 138 139 /* And now give the object the possibility to initialize... */ 140 /* Make sure the object is not checked. */ 141 //_nomInit((NOMObject*)nomObj, &tempEnv); 139 142 _nomInit((NOMObject*)nomObj, NULLHANDLE); 140 143 141 144 return nomObj; 142 145 } … … 210 213 NOM_Scope void NOMLINK impl_NOMClass_nomClassReady(NOMClass* nomSelf, CORBA_Environment *ev) 211 214 { 215 CORBA_Environment tempEnv={0}; 216 tempEnv.fFlags=NOMENV_FLG_DONT_CHECK_OBJECT; 212 217 213 218 nomPrintf(" Entering %s with nomSelf: 0x%x. nomSelf is: %s.\n", … … 231 236 //if(!_nomFindClassFromName(NOMClassMgrObject, _nomGetName(nomSelf, NULLHANDLE), 232 237 // 0, 0, NULLHANDLE)) 233 if(!_nomFindClassFromName(NOMClassMgrObject, _nomGetClassName(nomSelf, NULLHANDLE),234 0, 0, NULLHANDLE))238 if(!_nomFindClassFromName(NOMClassMgrObject, _nomGetClassName(nomSelf, &tempEnv), 239 0, 0, &tempEnv)) 235 240 236 241 { … … 305 310 { 306 311 /* NOMClassData* nomThis=NOMClassGetData(nomSelf); */ 307 308 //nomPrintf(" Entering %s with nomSelf: 0x%x. nomSelf is: %s.\n", 309 // __FUNCTION__, nomSelf, nomSelf->mtab->nomClassName); 310 311 NOMClass_nomInit_parent(nomSelf, ev); 312 } 313 312 #if 0 313 CORBA_Environment tempEnv={0}; 314 tempEnv.fFlags=NOMENV_FLG_DONT_CHECK_OBJECT; 315 #endif 316 // nomPrintf(" Entering %s with nomSelf: 0x%x. nomSelf is: %s.\n", 317 // __FUNCTION__, nomSelf, nomSelf->mtab->nomClassName); 318 319 /* Don't check object pointer. We are just created but not yet registered as a class. */ 320 // NOMClass_nomInit_parent(nomSelf, &tempEnv); 321 NOMClass_nomInit_parent(nomSelf, NULLHANDLE); 322 } 323 324 325 326 -
trunk/nom/class_c/nomobj.c
r251 r255 164 164 { 165 165 /* NOMObjectData* nomThis=NOMObjectGetData(nomSelf); */ 166 NOMClassPriv* ncp;167 nomMethodTabs mtabs; /* List of mtabs */168 166 169 167 if(!nomIsObj(nomClass)){ … … 171 169 return FALSE; 172 170 } 171 172 return _nomIsANoClsCheck(nomSelf, nomClass, ev); 173 } 174 175 176 NOM_Scope CORBA_boolean NOMLINK impl_NOMObject_nomIsANoClsCheck(NOMObject* nomSelf, const PNOMClass nomClass, 177 CORBA_Environment *ev) 178 { 179 /* NOMObjectData* nomThis=NOMObjectGetData(nomSelf); */ 180 NOMClassPriv* ncp; 181 nomMethodTabs mtabs; /* List of mtabs */ 173 182 174 183 /* Check if we have the class in our list of classes */ … … 185 194 } 186 195 187 188 196 NOM_Scope CORBA_boolean NOMLINK impl_NOMObject_nomIsInstanceOf(NOMObject* nomSelf, const PNOMClass nomClass, CORBA_Environment *ev) 189 197 { -
trunk/nom/exports.def
r219 r255 19 19 nomRegisterDLLByName 20 20 nomQueryUsingNameIsDLLRegistered 21 ; nomPrintObjectPointerErrorMsg 22 nomCheckNOMObjectPtr 23 nomCheckObjectPtr 24 nomCreateEnvNoObjectCheck 21 25 22 26 nomPrintf -
trunk/nom/idl/nomobj.idl
r251 r255 175 175 subclasses. 176 176 177 \sa nomIsInstanceOf() 177 \sa nomIsInstanceOf(), nomIsANoClsCheck() 178 178 */ 179 179 boolean nomIsA(in PNOMClass nomClass); … … 190 190 \returns TRUE if the object is an instance of exactly the given class. 191 191 192 \sa nomIsA() 192 \sa nomIsA(), nomIsANoClsCheck() 193 193 */ 194 194 boolean nomIsInstanceOf(in PNOMClass nomClass); … … 206 206 string nomGetClassName(); 207 207 208 /** 209 This method checks if the object is an instance of the given class or some subclass. Using 210 this method one can make sure some feature is available if the introducing class is known. 211 Every subclass of a given class also supports the features of the introducing class. 212 213 \remarks This method does \e not check the validity of \e nomClass using nomIsObj(). So 214 make sure to have checked it beforehand. You may want to use nomIsA() instead; 215 216 \param nomClass Pointer to a class object. 217 218 \returns TRUE if the object is an instance of the given class or one of its 219 subclasses. 220 221 \sa nomIsInstanceOf(), nomIsA() 222 */ 223 boolean nomIsANoClsCheck(in PNOMClass nomClass); 208 224 209 225 }; 210 226 211 227 #endif /* NOMOBJ_IDL_INCLUDED */ 228 229 -
trunk/nom/include/nom.h
r242 r255 161 161 162 162 /* The following is probably not correct... */ 163 typedef NOMAnyObj CORBA_Environment;163 //typedef NOMAnyObj CORBA_Environment; 164 164 165 165 #define nomresolve_(obj,mToken) ((nomMethodProc*)((void)obj, mToken)) -
trunk/nom/include/nomapi.h
r251 r255 181 181 } nomClassList, *nomClasses; 182 182 183 184 #define NOMENV_FLG_DONT_CHECK_OBJECT 0x00000001 185 186 typedef struct 187 { 188 gulong fFlags; 189 gpointer pReserved1; 190 gpointer pReserved2; 191 }nomEnvironment; 192 193 typedef nomEnvironment CORBA_Environment; 194 183 195 NOMEXTERN NOMClass * NOMLINK nomBuildClass (gulong ulReserved, 184 196 nomStaticClassInfo *sci, … … 186 198 gulong ulMinorVersion); 187 199 188 //#define nomIsObj(a) ((a)!= 0)189 200 #endif /* NOMAPI_H_INCLUDED */ 190 201 -
trunk/nom/include/nomtk.h
r221 r255 16 16 * The Initial Developer of the Original Code is 17 17 * netlabs.org: Chris Wohlgemuth <cinc-ml@netlabs.org>. 18 * Portions created by the Initial Developer are Copyright (C) 2005-200 618 * Portions created by the Initial Developer are Copyright (C) 2005-2007 19 19 * the Initial Developer. All Rights Reserved. 20 20 * … … 75 75 NOMEXTERN nomId NOMLINK nomIdFromString(gchar* inString); 76 76 NOMEXTERN gchar* NOMLINK nomStringFromId(nomId inId); 77 NOMEXTERN void NOMLINK nomPrintObjectPointerError(NOMObject* nomObject, gchar *chrClsName, gchar* chrMethodName); 78 NOMEXTERN gboolean NOMLINK nomCheckObjectPtr(NOMObject *nomSelf, NOMClass* nomClass, gchar* chrMethodName, CORBA_Environment *ev); 79 NOMEXTERN CORBA_Environment* NOMLINK nomCreateEnvNoObjectCheck(void); 77 80 78 81 /* Functions used by nomBuildClass() */ -
trunk/nom/src/nombuildclass.c
r221 r255 16 16 * The Initial Developer of the Original Code is 17 17 * netlabs.org: Chris Wohlgemuth <cinc-ml@netlabs.org>. 18 * Portions created by the Initial Developer are Copyright (C) 2005-200 618 * Portions created by the Initial Developer are Copyright (C) 2005-2007 19 19 * the Initial Developer. All Rights Reserved. 20 20 * … … 969 969 ulMajorVersion, ulMinorVersion); 970 970 if(nomClass){ 971 CORBA_Environment * tempEnv=nomCreateEnvNoObjectCheck(); 972 971 973 DBG_NOMBUILDCLASS(TRUE, "%s: class is 0x%x\n", nomClass->mtab->nomClassName, nomClass); 972 974 #if 0 … … 977 979 priv_checkForNomUnInitOverride( (NOMClassPriv*)nomClass->mtab->nomClsInfo, ncpParent); 978 980 #endif 979 _nomInit((NOMObject*)nomClass, NULLHANDLE); 980 _nomClassReady(nomClass, NULLHANDLE); 981 /* Make sure the env is marked that we don't chek the object pointer. This would fail 982 because the class isn't registered yet. */ 983 _nomInit((NOMObject*)nomClass, tempEnv); 984 _nomClassReady(nomClass, tempEnv); 981 985 } 982 986 … … 993 997 994 998 if(nomClass){ 995 _nomInit((NOMObject*)nomClass, NULLHANDLE); 996 _nomClassReady(nomClass, NULLHANDLE); 999 CORBA_Environment * tempEnv=nomCreateEnvNoObjectCheck(); 1000 /* Make sure the env is marked that we don't chek the object pointer. This would fail 1001 because the class isn't registered yet. */ 1002 _nomInit((NOMObject*)nomClass, tempEnv); 1003 _nomClassReady(nomClass, tempEnv); 997 1004 } 998 1005 return nomClass; … … 1088 1095 1089 1096 if(nomClass){ 1097 CORBA_Environment * tempEnv=nomCreateEnvNoObjectCheck(); 1098 1090 1099 /* Mark the class as using nomUnInit() if any parent did that. We just have to 1091 1100 check the flag and the flag of the parent class. This information is important … … 1094 1103 priv_checkForNomUnInitOverride( (NOMClassPriv*)nomClass->mtab->nomClsInfo, ncpParent); 1095 1104 1096 _nomInit(nomClass, NULLHANDLE); 1097 _nomClassReady(nomClass, NULLHANDLE); 1105 /* Make sure the env is marked that we don't chek the object pointer. This would fail 1106 because the class isn't registered yet. */ 1107 _nomInit(nomClass, tempEnv); 1108 _nomClassReady(nomClass, tempEnv); 1098 1109 } 1099 1110 return nomClass; -
trunk/nom/src/nombuildnomcls.c
r221 r255 16 16 * The Initial Developer of the Original Code is 17 17 * netlabs.org: Chris Wohlgemuth <cinc-ml@netlabs.org>. 18 * Portions created by the Initial Developer are Copyright (C) 2005-200 618 * Portions created by the Initial Developer are Copyright (C) 2005-2007 19 19 * the Initial Developer. All Rights Reserved. 20 20 * -
trunk/nom/src/nombuildnomobj.c
r221 r255 16 16 * The Initial Developer of the Original Code is 17 17 * netlabs.org: Chris Wohlgemuth <cinc-ml@netlabs.org>. 18 * Portions created by the Initial Developer are Copyright (C) 2005-200 618 * Portions created by the Initial Developer are Copyright (C) 2005-2007 19 19 * the Initial Developer. All Rights Reserved. 20 20 * -
trunk/nom/src/nomdebug.c
r94 r255 16 16 * The Initial Developer of the Original Code is 17 17 * netlabs.org: Chris Wohlgemuth <cinc-ml@netlabs.org>. 18 * Portions created by the Initial Developer are Copyright (C) 2005-200 618 * Portions created by the Initial Developer are Copyright (C) 2005-2007 19 19 * the Initial Developer. All Rights Reserved. 20 20 * … … 55 55 //#include "cwsomcls.h" 56 56 extern NOMClassMgr* NOMClassMgrObject; 57 57 extern gboolean fInitialized; 58 59 NOMEXTERN void NOMLINK nomPrintObjectPointerErrorMsg(NOMObject* nomObject, gchar *chrClsName, gchar* chrMethodName) 60 { 61 if(!nomObject) 62 g_warning("The object used to call the method %s is not valid. A NULL pointer was given.", chrMethodName); 63 else{ 64 if(!nomIsObj(nomObject)) 65 g_warning("The object used to call the method %s is not a valid NOM object. ", chrMethodName); 66 else 67 g_warning("The object used to call the method %s is not valid for this method. The object must be some instance of class %s (or of a subclass) but is a %s.", chrMethodName, chrClsName, NOMObject_nomGetClassName(nomObject, NULLHANDLE)); 68 } 69 } 70 71 /* 72 This function prints some more info about the object error. It's used for generic checks which 73 always return NULL which isn't always correct. 74 */ 75 static void nomPrintAdditionalErrorMsg(void) 76 { 77 g_message("Note that NULL is returned for the call (if the method returns a value). This may not be correct. Use the NOMPARMCHECK() macro to specify default return values for methods."); 78 } 79 80 /* Function to check if NOMObject is valid before calling a method on it. Note that we don't have to check 81 the instance class here using nomIsA*(). */ 82 NOMEXTERN gboolean NOMLINK nomCheckNOMObjectPtr(NOMObject *nomSelf, NOMClass* nomClass, gchar* chrMethodName, CORBA_Environment *ev) 83 { 84 /* Not initialized yet, so object check won't work. This means the three core NOM classes are not 85 yet created.*/ 86 if(!fInitialized) 87 return TRUE; 88 89 if(ev && (ev->fFlags & NOMENV_FLG_DONT_CHECK_OBJECT)) 90 return TRUE; 91 92 // g_message("In %s with %s %px nomClass: %px (%s)", __FUNCTION__, chrMethodName, nomSelf, nomClass, nomClass->mtab->nomClassName); 93 if(!nomIsObj(nomSelf)) 94 { 95 nomPrintObjectPointerErrorMsg(nomSelf, nomClass->mtab->nomClassName, chrMethodName); 96 nomPrintAdditionalErrorMsg(); 97 return FALSE; 98 } 99 return TRUE; 100 } 101 102 #include <string.h> 103 /* Function to check if an object is valid before calling a method on it */ 104 NOMEXTERN gboolean NOMLINK nomCheckObjectPtr(NOMObject *nomSelf, NOMClass* nomClass, gchar* chrMethodName, CORBA_Environment *ev) 105 { 106 /* Not initialized yet, so object check won't work. This means the three core NOM classes are not 107 yet created.*/ 108 if(!fInitialized) 109 return TRUE; 110 111 //if(strstr( chrMethodName, "nomIsObj")) 112 //return TRUE; 113 114 if(ev && (ev->fFlags & NOMENV_FLG_DONT_CHECK_OBJECT)) 115 return TRUE; 116 117 // g_message("In %s with %s %px nomClass: %px (%s)", __FUNCTION__, chrMethodName, nomSelf, nomClass, nomClass->mtab->nomClassName); 118 if(!nomIsObj(nomSelf) || !_nomIsANoClsCheck(nomSelf, nomClass, NULLHANDLE)) 119 { 120 nomPrintObjectPointerErrorMsg(nomSelf, nomClass->mtab->nomClassName, chrMethodName); 121 nomPrintAdditionalErrorMsg(); 122 return FALSE; 123 } 124 return TRUE; 125 } 126 127 NOMEXTERN CORBA_Environment* NOMLINK nomCreateEnvNoObjectCheck(void) 128 { 129 CORBA_Environment * tempEnv=(CORBA_Environment*)NOMMalloc(sizeof(CORBA_Environment)); 130 if(tempEnv) 131 tempEnv->fFlags|=NOMENV_FLG_DONT_CHECK_OBJECT; 132 return tempEnv; 133 } 134 58 135 static void dumpClassFunc(GQuark gquark, gpointer data, gpointer user_data) 59 136 { -
trunk/nom/src/nomtkinit.c
r219 r255 61 61 NOMClassMgr* NOMClassMgrObject=NULLHANDLE; /* Referenced from different files */ 62 62 63 gboolean fInitialized=FALSE; 64 63 65 /********************************************************/ 64 66 /* Toolkit functions, exported */ … … 131 133 NOMClassPriv* ncPriv; 132 134 NOMClass* nomCls; 135 // NOMClassMgr *NOMClassMgrObject_priv; 133 136 #if 0 134 137 NOMObject *nomObj; … … 162 165 163 166 #ifdef DEBUG_NOMENVNEW 164 nomPrintf("%s: NOMClassMgrObject: %x \n", __FUNCTION__, NOMClassMgrObject);167 nomPrintf("%s: NOMClassMgrObject: %x (%x)\n", __FUNCTION__, NOMClassMgrObject, pGlobalNomEnv->defaultMetaClass); 165 168 #endif 166 169 … … 196 199 _nomTestFunc_NOMTest2(nomTst2Obj, NULLHANDLE); 197 200 #endif 201 /* This must be done last! */ 202 // NOMClassMgrObject=NOMClassMgrObject_priv; 203 204 fInitialized=TRUE; 198 205 199 206 return NOMClassMgrObject;
Note:
See TracChangeset
for help on using the changeset viewer.