Changeset 255 for trunk/nom/src/nomdebug.c
- Timestamp:
- Mar 15, 2007, 9:42:22 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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 {
Note:
See TracChangeset
for help on using the changeset viewer.