Changeset 326 for trunk/nom/class_c


Ignore:
Timestamp:
Apr 9, 2008, 10:22:08 PM (17 years ago)
Author:
cinc
Message:

Portability patches for Windows, Linux, Darwin by Bird.

Location:
trunk/nom/class_c
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/nom/class_c/nomclassmanager.c

    r313 r326  
    4444#endif
    4545
    46 #define INCL_DOS
    47 #include <os2.h>
     46#ifdef __OS2__
     47# define INCL_DOS
     48# include <os2.h>
     49#endif /* __OS2__ */
     50
    4851#include <string.h>
    49 #include <gtk/gtk.h>
     52#ifdef NOM_WITH_GTK
     53# include <gtk/gtk.h>
     54#endif
    5055
    5156
     
    8590                                                                  CORBA_Environment *ev)
    8691{
    87   CORBA_Object nomRetval=NULLHANDLE;
     92  CORBA_Object nomRetval=NULL;
    8893  nomMethodTab * mtab;
    8994  NOMClassMgrData *nomThis = NOMClassMgrGetData(nomSelf);
     
    9196  /* This is only for NOMClass objects */
    9297  if(strchr(className, ':'))
    93     return NULLHANDLE;
     98    return NULL;
    9499
    95100  mtab=g_datalist_get_data(&_gdataClassList, className);
     
    164169  /* This is only for NOMClassPriv objects */
    165170  if(strchr(className, ':'))
    166     return NULLHANDLE;
     171    return NULL;
    167172
    168173  mtab=g_datalist_get_data(&_gdataClassList, className);
     
    170175    return mtab->nomClsInfo;
    171176  else
    172     return NULLHANDLE;
     177    return NULL;
    173178}
    174179
     
    214219  NOMClassMgrData* nomThis=NOMClassMgrGetData(nomSelf);
    215220
    216   if(NULLHANDLE==nomObject)
     221  if(NULL==nomObject)
    217222    return FALSE;
    218223
    219   return (g_tree_lookup(_pClassListTree, nomObject->mtab)!= NULLHANDLE);
     224  return (g_tree_lookup(_pClassListTree, nomObject->mtab)!= NULL);
    220225}
    221226
     
    234239
    235240  /* This returns a meta class */
    236   if((oClass=_nomFindClassFromName( nomSelf, oldClass, 0, 0, NULLHANDLE))==NULLHANDLE)
     241  if((oClass=_nomFindClassFromName( nomSelf, oldClass, 0, 0, NULL))==NULL)
    237242    return FALSE;
    238243
    239   if((rClass=_nomFindClassFromName( nomSelf, replacementClass, 0, 0, NULLHANDLE))==NULLHANDLE)
     244  if((rClass=_nomFindClassFromName( nomSelf, replacementClass, 0, 0, NULL))==NULL)
    240245    return FALSE;
    241246
    242247  /* Check if the class is a direct child */
    243   ncp=(NOMClassPriv*)_nomGetObjectCreateInfo(rClass, NULLHANDLE);
     248  ncp=(NOMClassPriv*)_nomGetObjectCreateInfo(rClass, NULL);
    244249 
    245250  if(strcmp(ncp->parentMtabStruct.next->mtab->nomClassName, oldClass))
     
    269274    return NULL;
    270275
    271   if((thePath=NOMPathNew())==NULLHANDLE)
     276  if((thePath=NOMPathNew())==NULL)
    272277    return NULL;
    273278
  • trunk/nom/class_c/nomcls.c

    r294 r326  
    4040#endif
    4141
    42 #define INCL_DOS
    43 #include <os2.h>
     42#ifdef __OS2__
     43# define INCL_DOS
     44# include <os2.h>
     45#endif /* __OS2__ */
     46
    4447#include <string.h>
    4548#include <stdlib.h>
    46 #include <gtk/gtk.h>
     49#ifdef NOM_WITH_GTK
     50# include <gtk/gtk.h>
     51#endif
    4752
    4853
     
    6469  if(nomIsObj(nObj)){
    6570    //nomPrintf("Finalizing 0x%x: %s \n", nObj, nObj->mtab->nomClassName);
    66     _nomUnInit(nObj, NULLHANDLE);
     71    _nomUnInit(nObj, NULL);
    6772  }
    6873  //else
     
    8085
    8186  if(!_ncpObject)
    82     return NULLHANDLE;
     87    return NULL;
    8388
    8489  ncp=(NOMClassPriv*)_ncpObject;
     
    8691  /* Allocate memory big enough to hold an object. This means the size is that of the
    8792     mtab pointer and all instance variables. */
    88   if((nObj=_nomAllocate(nomSelf, ncp->mtab->ulInstanceSize, NULLHANDLE))==NULLHANDLE)
    89     return NULLHANDLE;
     93  if((nObj=_nomAllocate(nomSelf, ncp->mtab->ulInstanceSize, NULL))==NULL)
     94    return NULL;
    9095
    9196  /* _nomInit() is called in _nomRenew() */
    92   return _nomRenew(nomSelf, (CORBA_Object)nObj, NULLHANDLE); /* This will also init the object */
     97  return _nomRenew(nomSelf, (CORBA_Object)nObj, NULL); /* This will also init the object */
    9398}
    9499
     
    135140  tempEnv.fFlags=NOMENV_FLG_DONT_CHECK_OBJECT;
    136141#endif
    137   _nomRenewNoInit(nomSelf, nomObj, NULLHANDLE);
     142  _nomRenewNoInit(nomSelf, nomObj, NULL);
    138143
    139144  /* And now give the object the possibility to initialize... */
    140145  /* Make sure the object is not checked. */
    141146  //_nomInit((NOMObject*)nomObj, &tempEnv);
    142   _nomInit((NOMObject*)nomObj, NULLHANDLE);
     147  _nomInit((NOMObject*)nomObj, NULL);
    143148
    144149  return nomObj;
     
    165170
    166171  /* The private struct characterizing the objects this meta class can create. */
    167   ncp=_nomGetObjectCreateInfo(nomSelf, NULLHANDLE);
     172  ncp=_nomGetObjectCreateInfo(nomSelf, NULL);
    168173
    169174  if(!ncp)
     
    231236     
    232237      //The following was used before changing nomGetname()
    233       //if(!_nomFindClassFromName(NOMClassMgrObject, _nomGetName(nomSelf, NULLHANDLE),
    234       //                        0, 0, NULLHANDLE))
     238      //if(!_nomFindClassFromName(NOMClassMgrObject, _nomGetName(nomSelf, NULL),
     239      //                        0, 0, NULL))
    235240      if(!_nomFindClassFromName(NOMClassMgrObject, _nomGetClassName(nomSelf, &tempEnv),
    236241                              0, 0, &tempEnv))
     
    246251          //ncPriv->ulIsMetaClass=1; /* Mark that we are a metaclass */
    247252          ncPriv->ulClassFlags|=NOM_FLG_IS_METACLASS; /* Mark that we are a metaclass */
    248           _nomRegisterClass(NOMClassMgrObject, nomSelf->mtab, NULLHANDLE);
     253          _nomRegisterClass(NOMClassMgrObject, nomSelf->mtab, NULL);
    249254          /* Register all the methods this class introduces */
    250255          ulNumIntroducedMethods=ncPriv->sci->ulNumStaticMethods;
     
    253258              if(*ncPriv->sci->nomSMethods[a].chrMethodDescriptor)
    254259                _nomRegisterMethod(NOMClassMgrObject, nomSelf->mtab,
    255                                    *ncPriv->sci->nomSMethods[a].chrMethodDescriptor, NULLHANDLE);
     260                                   *ncPriv->sci->nomSMethods[a].chrMethodDescriptor, NULL);
    256261            }
    257262          /* Metaclass is registered. Register the object class this
    258263             metaclass may create. */
    259           ncPriv=(NOMClassPriv*)_nomGetObjectCreateInfo(nomSelf, NULLHANDLE);//nomSelf->mtab->nomClsInfo;
     264          ncPriv=(NOMClassPriv*)_nomGetObjectCreateInfo(nomSelf, NULL);//nomSelf->mtab->nomClsInfo;
    260265          if(ncPriv){
     266#ifndef _MSC_VER
    261267#warning !!!!! NOMClass does not have this pointer, this is a bug !!!!!
     268#endif
    262269            //ncPriv->ulIsMetaClass=0; /* Mark that we are not a metaclass (should be 0 already) */
    263270            ncPriv->ulClassFlags&=~NOM_FLG_IS_METACLASS; /* Mark that we are not a metaclass (should be 0 already) */
    264             _nomRegisterClass(NOMClassMgrObject, ncPriv->mtab, NULLHANDLE);
     271            _nomRegisterClass(NOMClassMgrObject, ncPriv->mtab, NULL);
    265272
    266273            /* Register all the methods this class introduces */
     
    270277                if(*ncPriv->sci->nomSMethods[a].chrMethodDescriptor)
    271278                  _nomRegisterMethod(NOMClassMgrObject, ncPriv->mtab,
    272                                      *ncPriv->sci->nomSMethods[a].chrMethodDescriptor, NULLHANDLE);
     279                                     *ncPriv->sci->nomSMethods[a].chrMethodDescriptor, NULL);
    273280              }/* for(a) */
    274281          }/* ncPriv */
     
    281288        nomPrintf("%s: Metaclass already registered, registering normal object class now.\n", __FUNCTION__);
    282289
    283         ncPriv=(NOMClassPriv*)_nomGetObjectCreateInfo(nomSelf, NULLHANDLE);//nomSelf->mtab->nomClsInfo;
     290        ncPriv=(NOMClassPriv*)_nomGetObjectCreateInfo(nomSelf, NULL);//nomSelf->mtab->nomClsInfo;
    284291        // ncPriv->ulIsMetaClass=0; /* Mark that we are not a metaclass (should be 0 already) */
    285292        ncPriv->ulClassFlags&=~NOM_FLG_IS_METACLASS; /* Mark that we are not a metaclass (should be 0 already) */
     
    292299              if(*ncPriv->sci->nomSMethods[a].chrMethodDescriptor)
    293300                _nomRegisterMethod(NOMClassMgrObject, ncPriv->mtab,
    294                                    *ncPriv->sci->nomSMethods[a].chrMethodDescriptor, NULLHANDLE);
     301                                   *ncPriv->sci->nomSMethods[a].chrMethodDescriptor, NULL);
    295302            }
    296303          //nomPrintf("%s %s \n", nomSelf->mtab->nomClassName, ncPriv->mtab->nomClassName);
    297           _nomRegisterClass(NOMClassMgrObject, ncPriv->mtab, NULLHANDLE);
     304          _nomRegisterClass(NOMClassMgrObject, ncPriv->mtab, NULL);
    298305        }
    299306      }
     
    316323  /* Don't check object pointer. We are just created but not yet registered as a class. */
    317324  //  NOMClass_nomInit_parent(nomSelf,  &tempEnv);
    318   NOMClass_nomInit_parent(nomSelf, NULLHANDLE);
    319 }
    320 
    321 
    322 
    323 
     325  NOMClass_nomInit_parent(nomSelf, NULL);
     326}
     327
     328
     329
     330
  • trunk/nom/class_c/nomobj.c

    r255 r326  
    4141#endif
    4242
    43 #define INCL_DOS
    44 #include <os2.h>
     43#ifdef __OS2__
     44# define INCL_DOS
     45# include <os2.h>
     46#endif /* __OS2__ */
     47
    4548#include <string.h>
    46 #include <gtk/gtk.h>
     49/* #include <gtk/gtk.h> - why? */
    4750
    4851#include "nom.h"
     
    110113
    111114  /* Give object the chance to free resources */
    112   _nomUnInit(nomSelf, NULLHANDLE);
     115  _nomUnInit(nomSelf, NULL);
    113116
    114117  /* And now delete the object */
     
    155158     It is possible that we are called by a subclass. So get the class object and let the
    156159     class object create the correct class. */
    157   nomCls=NOMObject_nomGetClass(nomSelf, NULLHANDLE);
    158   return NOMClass_nomNew(nomCls, NULLHANDLE);
     160  nomCls=NOMObject_nomGetClass(nomSelf, NULL);
     161  return NOMClass_nomNew(nomCls, NULL);
    159162}
    160163
     
    203206  }
    204207 
    205   if(nomClass==_nomGetClass(nomSelf, NULLHANDLE))
     208  if(nomClass==_nomGetClass(nomSelf, NULL))
    206209    return TRUE;
    207210 
Note: See TracChangeset for help on using the changeset viewer.