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

Portability patches for Windows, Linux, Darwin by Bird.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/nom/src/nombuildnomcls.c

    r255 r326  
    3333* ***** END LICENSE BLOCK ***** */
    3434
    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
    3941#include <stdio.h>
    4042
     
    6365    #define BUILDNOMCLASS_ENTER
    6466    #define BUILDNOMCLASS_LEAVE
     67#   ifdef _MSC_VER
     68void _inline DBG_BUILDNOMCLASS(gboolean a, const char *msg, ...)
     69{
     70    /* sorry, nothing here. */
     71}
     72#   else
    6573    #define DBG_BUILDNOMCLASS(a, b,...)
     74#   endif
    6675#endif
    6776
     
    7180
    7281extern PNOM_ENV pGlobalNomEnv;
    73 extern ULONG thunk[];
    74 extern ULONG mThunkCode[];
     82extern gulong thunk[];
     83extern gulong mThunkCode[];
    7584
    7685/********************************************************/
     
    119128
    120129  /* Alloc private class struct using SOMCalloc. */
    121   if((nClass=(NOMClassPriv*)NOMCalloc(1, gulMemSize))==NULLHANDLE)
    122     return NULLHANDLE;
     130  if((nClass=(NOMClassPriv*)NOMCalloc(1, gulMemSize))==NULL)
     131    return NULL;
    123132
    124133  /* Get mem for method thunking code. This assembler code is needed so the indirect
     
    132141    if(!nClass->mThunk) {
    133142      NOMFree(nClass);
    134       return NULLHANDLE;
     143      return NULL;
    135144    }
    136145  }
     
    150159  if(!addMethodAndDataToThisPrivClassStruct( nClass, ncpParent, sci)){
    151160    NOMFree(nClass);
    152     return NULLHANDLE;
     161    return NULL;
    153162  };
    154163
     
    158167  nClass->mtab->mtabSize=mtabSize;
    159168  nClass->mtab->nomClsInfo=(nomClassInfo*)nClass;  /* Hold a pointer to the private data that is this NOMClassPriv */
     169#ifndef _MSC_VER
    160170#warning !!!!! Change this when nomId is a GQuark !!!!!
     171#endif
    161172  nClass->mtab->nomClassName=*sci->nomClassId;
    162173  nClass->mtab->ulInstanceSize=sci->ulInstanceDataSize+gulParentDataSize; /* Size of instance data of this class and all
     
    205216  else{
    206217    g_error("No NOMObject while trying to build NOMClass."); /* This will result in a termination of the app! */
    207     return NULLHANDLE;                                       /* NOMClass *must* have an object as parent!
     218    return NULL;                                       /* NOMClass *must* have an object as parent!
    208219                                                                We won't reach this point */
    209220  }
     
    223234
    224235  /* Build the NOMClassPriv for NOMClass */
    225   if((nClass=buildNOMClassPrivStruct(sci, ncpParent))==NULLHANDLE)
    226     return NULLHANDLE;
     236  if((nClass=buildNOMClassPrivStruct(sci, ncpParent))==NULL)
     237    return NULL;
    227238
    228239  ulParentDataSize=ncpParent->mtab->ulInstanceSize; /* Parent instance size. This is the mtab pointer + instance vars */
     
    231242  /* And now the NOMClass struct. A NOMClass has a mTab pointer at the beginning and the instance data
    232243     following (including the parent instance data).*/
    233   if((nomClass=(NOMClass*)NOMCalloc(1, sci->ulInstanceDataSize+ulParentDataSize))==NULLHANDLE) {
     244  if((nomClass=(NOMClass*)NOMCalloc(1, sci->ulInstanceDataSize+ulParentDataSize))==NULL) {
    234245    NOMFree(nClass->mThunk);
    235246    NOMFree(nClass);
    236     return NULLHANDLE;
     247    return NULL;
    237248  }
    238249
     
    274285  pGlobalNomEnv->defaultMetaClass=nomClass;
    275286
     287#ifndef _MSC_VER
    276288#warning !!!!! _nomSetInstanceSize() not called !!!!!
     289#endif
    277290#if 0
    278291  /* Set this class size into instance var */
     
    281294
    282295  /* Run initialization code if any */
    283   _nomInit(nomClass, NULLHANDLE);
     296  _nomInit(nomClass, NULL);
    284297  return nomClass;
    285298}
Note: See TracChangeset for help on using the changeset viewer.