- Timestamp:
- Feb 3, 2007, 6:59:37 PM (19 years ago)
- Location:
- trunk/nom
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/nom/Makefile
r158 r219 53 53 TSTHFILES = $(CLASSINC)/nomobj.h $(CLASSINC)/nomcls.h 54 54 55 IHFILES = $(CLASSINC)/nomobj.ih $(CLASSINC)/nomcls.ih \ 55 IHFILES = $(CLASSINC)/nomobj.ih \ 56 $(CLASSINC)/nomcls.ih \ 56 57 $(CLASSINC)/nomclassmanager.ih 57 58 … … 72 73 73 74 74 $(BINDIR)/nobjtk.dll: $(OBJDIR)/o.dep $( NOMOBJECTS) $(OBJECTS) $(GCLIB) ./exports.def75 $(BINDIR)/nobjtk.dll: $(OBJDIR)/o.dep $(IHFILES) $(NOMOBJECTS) $(OBJECTS) $(GCLIB) ./exports.def 75 76 @echo "[33;1;mLinking "$@"...[0;m" 76 77 cmd.exe /C create_vobjtk_def $(OBJDIR)/nobjtk.def … … 101 102 102 103 103 $(OBJDIR)/%.o: $(CLASSCDIR)/%.c $( CLASSINC)/%.ih $(NOMINCLUDES)104 $(OBJDIR)/%.o: $(CLASSCDIR)/%.c $(NOMINCLUDES) 104 105 $(CC) -I $(INC) $(GCCFLAGS) -o$@ $< 105 106 … … 138 139 cp $(GCPATH)/.libs/gc.a $(GCLIB) 139 140 141 dox: 142 doxygen nom.dox 143 140 144 clean: 141 145 @cd $(OBJDIR) && rm * -
trunk/nom/class_c/nomcls.c
r210 r219 66 66 } 67 67 68 NOM_Scope CORBA_Object NOMLINK impl_NOMClass_nomNew(NOMClass* nomSelf, CORBA_Environment *ev) 68 /** 69 \brief Function which implements the nomNew() method of NOMClass. 70 */ 71 NOM_Scope PNOMObject NOMLINK impl_NOMClass_nomNew(NOMClass* nomSelf, CORBA_Environment *ev) 69 72 { 70 73 NOMClassData* nomThis=NOMClassGetData(nomSelf); … … 87 90 } 88 91 89 NOM_Scope CORBA_Object NOMLINK impl_NOMClass_nomRenewNoInit(NOMClass* nomSelf, 90 const CORBA_Object nomObj, 91 CORBA_Environment *ev) 92 /** 93 \brief Function which implements the nomRenewNoInit() method of NOMClass. 94 */ 95 NOM_Scope PNOMObject NOMLINK impl_NOMClass_nomRenewNoInit(NOMClass* nomSelf, 96 const gpointer nomObj, 97 CORBA_Environment *ev) 92 98 { 93 99 NOMClassPriv *ncp; … … 116 122 } 117 123 118 NOM_Scope CORBA_Object NOMLINK impl_NOMClass_nomRenew(NOMClass* nomSelf, const CORBA_Object nomObj, 119 CORBA_Environment *ev) 124 /** 125 \brief Function which implements the nomRenew() method of NOMClass. 126 */ 127 NOM_Scope PNOMObject NOMLINK impl_NOMClass_nomRenew(NOMClass* nomSelf, const gpointer nomObj, 128 CORBA_Environment *ev) 120 129 { 121 130 _nomRenewNoInit(nomSelf, nomObj, NULLHANDLE); … … 128 137 129 138 130 NOM_Scope CORBA_string NOMLINK impl_NOMClass_nomAllocate(NOMClass* nomSelf, const CORBA_long ulSize, 139 /** 140 \brief Function which implements the nomAllocate() method of NOMClass. 141 */ 142 NOM_Scope gpointer NOMLINK impl_NOMClass_nomAllocate(NOMClass* nomSelf, const CORBA_long ulSize, 131 143 CORBA_Environment *ev) 132 144 { … … 136 148 } 137 149 150 /** 151 Function which implements the nomGetName() method of NOMClass. 152 */ 138 153 NOM_Scope CORBA_string NOMLINK impl_NOMClass_nomGetName(NOMClass* nomSelf, CORBA_Environment *ev) 139 154 { … … 142 157 143 158 144 NOM_Scope void NOMLINK impl_NOMClass_nomDeallocate(NOMClass* nomSelf, const CORBA_char * memptr, CORBA_Environment *ev) 159 /** 160 \brief Function which implements the nomDeallocate() method of NOMClass. 161 */ 162 NOM_Scope void NOMLINK impl_NOMClass_nomDeallocate(NOMClass* nomSelf, const gpointer memptr, CORBA_Environment *ev) 145 163 { 146 164 NOMFree((nomToken)memptr); … … 148 166 149 167 168 /** 169 \brief Function which implements the nomSetObjectCreateInfo() method of NOMClass. 170 */ 150 171 NOM_Scope void NOMLINK impl_NOMClass_nomSetObjectCreateInfo(NOMClass* nomSelf, const gpointer ncpObject, 151 172 CORBA_Environment *ev) … … 159 180 } 160 181 182 /** 183 \brief Function which implements the nomGetObjectCreateInfo() method of NOMClass. 184 */ 161 185 NOM_Scope gpointer NOMLINK impl_NOMClass_nomGetObjectCreateInfo(NOMClass* nomSelf, CORBA_Environment *ev) 162 186 { … … 166 190 } 167 191 192 /** 193 \brief Function which implements the nomClassReady() method of NOMClass. 194 */ 168 195 NOM_Scope void NOMLINK impl_NOMClass_nomClassReady(NOMClass* nomSelf, CORBA_Environment *ev) 169 196 { -
trunk/nom/class_c/nomobj.c
r210 r219 46 46 #include "nomobj.ih" 47 47 48 /** 48 49 50 \brief This function implements the method nomInit() of class NOMObject. 51 */ 49 52 NOM_Scope void NOMLINK impl_NOMObject_nomInit(NOMObject *nomSelf, CORBA_Environment *ev) 50 53 { … … 53 56 } 54 57 58 /** 59 60 \brief This function implements the method nomUnInit() of class NOMObject. 61 */ 55 62 NOM_Scope void NOMLINK impl_NOMObject_nomUnInit(NOMObject *nomSelf, CORBA_Environment *ev) 56 63 { … … 61 68 } 62 69 70 /** 71 72 \brief This function implements the method nomGetSize() of class NOMObject. 73 */ 63 74 NOM_Scope CORBA_long NOMLINK impl_NOMObject_nomGetSize(NOMObject* nomSelf, CORBA_Environment *ev) 64 75 { … … 73 84 } 74 85 86 /** 87 88 \brief This function implements the method delete() of class NOMObject. 89 90 It calls nomUnInit() to give the object a chance of freeing system resources. Afterwards 91 the memory occupied by the object is given back to the system and the object is not 92 accessible anymore. 93 */ 75 94 NOM_Scope void NOMLINK impl_NOMObject_delete(NOMObject* nomSelf, CORBA_Environment *ev) 76 95 { … … 88 107 } 89 108 90 /* 91 Gets the class object of this object. 92 */ 109 /** 110 111 \brief This function implements the method nomGetClass() of class NOMObject. 112 It returns a pointer to the class object of this object. 113 114 \param nomSelf The pointer to the object. 115 \param ev Environment pointer or NULL. 116 \retval PNOMClass A pointer to the class object for this object. This can never be NULL. 117 */ 93 118 NOM_Scope PNOMClass NOMLINK impl_NOMObject_nomGetClass(NOMObject* nomSelf, CORBA_Environment *ev) 94 119 { … … 98 123 } 99 124 100 /* 101 Create a new class of the kind the caller is. This method ensures that subclasses 102 are properly handled without the need to override this method in every subclass. 125 /** 126 127 \brief This function implements the method new() of class NOMObject. 128 129 Create a new class of the kind the caller is. This method ensures that subclassing 130 is properly handled without the need to override this method in every subclass. 131 132 This method will get the class object of nomSelf () which may be any subclass 133 of NOMObject) and call nomNew() on it creating 134 a new object which has exactly the same class hierarchy as nomSelf. 103 135 */ 104 136 NOM_Scope PNOMObject NOMLINK impl_NOMObject_new(NOMObject* nomSelf, CORBA_Environment *ev) -
trunk/nom/exports.def
r195 r219 4 4 5 5 EXPORTS 6 nomTkInit @1 7 NOMMalloc @2 8 NOMCalloc @3 6 nomTkInit 7 nomTkUnInit 8 9 NOMMalloc 10 NOMCalloc 9 11 NOMFree 12 10 13 nomIsObj 11 14 … … 27 30 ; _NOMClassMgrObject 28 31 29 nomEnvironmentNew 32 nomEnvironmentNew 33 nomEnvironmentEnd 34 30 35 nomBuildClass 31 36 -
trunk/nom/idl/nomcls.idl
r179 r219 44 44 NOMCLASSVERSION(1, 0 ); 45 45 46 Object nomNew(); 46 /** 47 This method is called to create an object of the class this metaclass 48 is the class object for. 49 The method uses nomAllocate() to get the amount of storage necessary to 50 hold one instance of the object to be built. When successful nomRenew() 51 is called with the allocated storage block to initalize the object. 52 53 \sa nomRenew(), nomRenewNoInit(), impl_NOMClass_nomNew() 54 */ 55 PNOMObject nomNew(); 56 57 /** 58 This method returns the name of the class this class object is an instance of. 59 60 \par How to override 61 This method is usually not overriden. 62 63 \sa impl_NOMClass_nomGetName() 64 */ 47 65 string nomGetName(); 48 Object nomRenew(in Object nomObj);49 Object nomRenewNoInit(in Object nomObj);50 66 51 string nomAllocate(in long size); 52 void nomDeallocate(in string memptr); 67 /** 68 This method is called for example by nomNew() when creating a new object. It may be 69 used to create an object from a given memory block. If doing so be sure the storage 70 area is big enough to hold an objects instance. 71 72 The method first calls nomRenewNoInit() to set important object info on the memory block 73 and then calls nomInit() on the newly created object. 74 75 \par How to override 76 This method is usually not overriden. 77 78 \sa nomNew, nomRenewNoInit(), impl_NOMClass_nomRenew() 79 */ 80 PNOMObject nomRenew(in gpointer nomObj); 81 82 /** 83 Most of object creation is done in this method which is indirectly called by nomNew(). 84 The block of storage given to the method is set to zero first. Setting the pointer to the 85 mtab actually makes an object from the memory. 86 If the class this object is an instance of (or any of the parent classes) did override 87 nomUnInit() the object is registered for finalization with the garbage collector. By doing 88 so it is ensured that nomUnInit() is called on the object when it's collected eventually. 89 90 This method can be used to create an object from any block of memory. It may be faster 91 creating numerous objects from one huge memory area than calling nomNew() for every single 92 object. 93 94 \remark This method does not call nomInit() on the new object. It is guaranteed that this 95 method is always called during object creation. 96 97 \par How to override 98 This method can be overriden to track the creation of objects. When doing so 99 the parent should be called first. 100 101 \sa nomNew, nomRenew(), impl_NOMClass_nomRenewNoInit() 102 */ 103 PNOMObject nomRenewNoInit(in gpointer nomObj); 104 105 /** 106 Allocate size bytes for using when creating objects. 107 108 This method uses NOMMalloc() to allocate the memory. Because NOMMalloc() is just a wrapper 109 around g_malloc() which is replaced by a garbage collected memory allocation routine the returned block of 110 memory is zeroed similar to using NOMCalloc(). 111 112 \par How to override 113 This method is usually not overriden. 114 115 \sa impl_NOMClass_nomAllocate() 116 */ 117 gpointer nomAllocate(in long size); 118 119 /** 120 Free a block of memory allocated using nomAllocate(). Because NOM is using a garbage collector 121 this method does nothing. It's for compatibility with ported code. 122 123 \par How to override 124 This method is usually not overriden. 125 126 \sa impl_NOMClass_nomDeallocate() 127 */ 128 void nomDeallocate(in gpointer memptr); 53 129 void nomSetObjectCreateInfo(in gpointer ncpObject); 54 130 gpointer nomGetObjectCreateInfo(); 131 132 /** 133 This method is called after the class object is built. It registers the new 134 class with the NOMClassMagrObj. 135 In addition to registering the class object the class this metaclass can create will 136 also be registered. 137 138 \sa impl_NOMClass_nomClassReady() 139 */ 55 140 void nomClassReady(); 56 141 -
trunk/nom/idl/nomobj.idl
r210 r219 44 44 NOMCLASSVERSION(1, 0 ); 45 45 46 /** 47 This method is intended to be overriden by classes which need some initialization. 48 49 \par How to override 50 The parent class must always be called first when overriden. 51 52 \sa impl_NOMObject_nomInit() 53 */ 46 54 void nomInit(); 55 56 /** 57 This method is intended to be overriden by classes which need some uninitialization. 58 Note that when overriding the method the garbage collector will add the object 59 to the list of objects with a finalizer. The finalizer will be run when the object is 60 collected and calls nomUnInit() to give the object a chance for cleanup. 61 62 \note It's not necessary to free memory in nomUnInit(). This is the job of the garbage collector. 63 Only system resources like file handles etc. must be explicitely freed. 64 65 \par How to override 66 The parent method must be called after doing the own processing. 67 68 \sa impl_NOMObject_nomUnInit() 69 */ 47 70 void nomUnInit(); 48 /* Return the size of the object. That is sizeof(mTab*)+sizeof(all instance vars) */ 71 72 /** 73 Return the size of the object. That is sizeof(mTab*)+sizeof(all instance vars) 74 75 \par How to override 76 This method is usually not overriden. 77 78 \sa impl_NOMObject_nomGetSize() 79 */ 49 80 long nomGetSize(); 81 82 /** 83 This method calls nomUnInit() to give the object a chance of freeing system resources. 84 Afterwards the memory occupied by the object is given back to the system and the 85 object is not accessible anymore. 86 87 \sa impl_NOMObject_delete() 88 */ 50 89 void delete(); 90 91 /** 92 This method returns a pointer to the class object of this object. 93 94 \par How to override 95 This method is usually not overriden. 96 97 \return Pointer to the class object 98 99 \sa impl_NOMObject_nomGetClass() 100 */ 51 101 PNOMClass nomGetClass(); 102 103 /** 104 Create a new class of the kind the caller is. This method ensures that subclasses 105 are properly handled without the need to override this method in every subclass. 106 107 This method will get the class object of nomSelf and call nomNew() on it creating 108 a new object which has exactly the same class hierarchy of nomSelf. 109 110 \par How to override 111 This method is usually not overriden. 112 113 \return Pointer to a new object of the same kind as nomSelf. Note that this won't 114 create an exact copy but a completely new objecct. 115 116 \sa impl_NOMObject_new() 117 */ 52 118 PNOMObject new(); 53 #if 054 NOMOVERRIDE(wpEchoString);55 NOMINSTANCEVAR(long theLong);56 #endif57 119 }; 58 120 -
trunk/nom/src/nomtkinit.c
r195 r219 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 * … … 100 100 101 101 102 NOMEXTERN PNOM_ENV NOMLINK nomTkInit(void) 103 { 104 PVOID memPtr; 105 106 if(pGlobalNomEnv) 107 return pGlobalNomEnv; /* Already done */ 108 109 nomPrintf("Entering %s...\n", __FUNCTION__); 110 111 memPtr=g_malloc(sizeof(NOM_ENV)); /* g_malloc() can't fail... */ 112 113 nomPrintf("%s: Got root memory: %x\n", __FUNCTION__, memPtr); 114 115 /* Now init the structure */ 116 /* GC memory is zeroed... */ 117 ((PNOM_ENV)memPtr)->cbSize=sizeof(NOM_ENV); 118 pGlobalNomEnv=(PNOM_ENV)memPtr; 119 120 return (PNOM_ENV)memPtr; 121 } 122 102 123 103 124 /* … … 117 138 #endif 118 139 140 119 141 #ifdef DEBUG_NOMENVNEW 120 142 nomPrintf("Entering %s to initialize NOM runtime.\n\n", __FUNCTION__); 121 143 nomPrintf("**** Building NOMObject class...\n"); 122 144 #endif 145 nomTkInit(); 146 123 147 nomCls=NOMObjectNewClass(NOMObject_MajorVersion, NOMObject_MinorVersion); 124 148 … … 142 166 143 167 /* Now register the classes we already have */ 144 // _nomRegisterClass(NOMClassMgrObject, pGlobalNomEnv->defaultMetaClass->mtab, NULLHANDLE); //NOMClass145 168 _nomClassReady(pGlobalNomEnv->defaultMetaClass, NULLHANDLE); //NOMClass 146 //_nomRegisterClass(NOMClassMgrObject, NOMClassMgrObject->mtab, NULLHANDLE); //NOMClassMgr147 169 _nomClassReady( _NOMClassMgr, NULLHANDLE); //NOMClassMgr 148 170 ncPriv=(NOMClassPriv*)pGlobalNomEnv->nomObjectMetaClass->mtab->nomClsInfo; … … 150 172 /* Do not register the NOMObject metaclass here. It's already registered because it's 151 173 NOMClass in fact. */ 152 //_nomRegisterClass(NOMClassMgrObject, pGlobalNomEnv->nomObjectMetaClass->mtab, NULLHANDLE); //NOMObject153 174 _nomClassReady(_NOMObject, NULLHANDLE); //NOMObject 154 175 … … 180 201 181 202 182 NOMEXTERN PNOM_ENV NOMLINK nomTkInit(void) 183 { 184 PVOID memPtr; 185 //PVOID memPool; 186 187 nomPrintf("Entering %s...\n", __FUNCTION__); 188 189 memPtr=g_malloc(sizeof(NOM_ENV)); /* g_malloc() can't fail... */ 190 191 nomPrintf("%s: Got root memory: %x\n", __FUNCTION__, memPtr); 192 193 /* Now init the structure */ 194 /* GC memory is zeroed... */ 195 ((PNOM_ENV)memPtr)->cbSize=sizeof(NOM_ENV); 196 pGlobalNomEnv=(PNOM_ENV)memPtr; 197 198 #if 0 199 if(NO_ERROR!=DosCreateMutexSem(NULL, &((PNOM_ENV)memPtr)->hmtx, DC_SEM_SHARED, FALSE)) 200 { 201 g_free(memPtr); 202 return NULL; 203 } 204 #endif 205 206 return (PNOM_ENV)memPtr; 207 } 208 209 210 211 212 213 214 215 216 217 218 203 NOMEXTERN void NOMLINK nomTkUnInit(gpointer pReserved) 204 { 205 /* Nothing yet...*/ 206 } 207 208 NOMEXTERN void NOMLINK nomEnvironmentEnd (void) 209 { 210 nomTkUnInit(NULL); 211 } 212 213 214 215 216 217 218 219 220 221
Note:
See TracChangeset
for help on using the changeset viewer.