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/nombuildnomobj.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#include <string.h>
     
    6769*/
    6870
    69 static ULONG thunk[]={0x0424448b, 0x00000405, 0x0000c300};
     71static gulong thunk[]={0x0424448b, 0x00000405, 0x0000c300};
    7072
    7173/*
     
    7476JMP DWORD PTR [EDX+0ACh]  : JMP to address pointing to by EDX+0ACh
    7577 */
    76 static ULONG mThunkCode[]={0x04244c8b, 0xff00518b, 0x0000aca2 , 0x16000000};
     78static gulong mThunkCode[]={0x04244c8b, 0xff00518b, 0x0000aca2 , 0x16000000};
    7779
    7880/********************************************************/
     
    100102  gulong mtabSize;
    101103  gulong ulMemSize=0;
    102   BYTE * mem;
     104  guint8 * mem;
    103105  int a;
    104106
     
    116118 
    117119  /* Alloc private class struct using NOMCalloc. */
    118   if((nClass=(NOMClassPriv*)NOMCalloc(1, ulMemSize))==NULLHANDLE)
    119     return NULLHANDLE;
     120  if((nClass=(NOMClassPriv*)NOMCalloc(1, ulMemSize))==NULL)
     121    return NULL;
    120122 
    121123
     
    138140  nClass->mtab->mtabSize=mtabSize;        /* This mtab is the same as the one used in the public NOMClass */
    139141  nClass->mtab->nomClsInfo=(nomClassInfo*)nClass;        /* Hold a pointer to the private data that is this NOMClassPriv */
     142#ifndef _MSC_VER
    140143#warning !!!!! Change this when nomId is a GQuark !!!!!
     144#endif
    141145  nClass->mtab->nomClassName=*sci->nomClassId;
    142146  nClass->mtab->ulInstanceSize=sci->ulInstanceDataSize+sizeof(nomMethodTabPtr); /* sizeof(methodTabStruct*) + size of instance data of this class
     
    151155    if(!nClass->mThunk) {
    152156      NOMFree(nClass);
    153       return NULLHANDLE;
     157      return NULL;
    154158    }
    155159  }
     
    172176    /* Now finally put the thunking in so the procedures are resolved correctly. */
    173177    for(a=0;a<sci->ulNumStaticMethods;a++) {
    174       ULONG ulOffset;
     178      gulong ulOffset;
    175179
    176180      memcpy(&nClass->mThunk[a], mThunkCode, sizeof(mThunkCode));               /* Copy method thunking code template  */
    177       ulOffset=(ULONG)((char*)(mem+sizeof(NOMClass*))-(char*)nClass->mtab);     /* Skip priv class data pointer        */
     181      ulOffset=(gulong)((char*)(mem+sizeof(NOMClass*))-(char*)nClass->mtab);     /* Skip priv class data pointer        */
    178182      nClass->mThunk[a].thunk[2]=((ulOffset+a*sizeof(nomMethodProc*))<<8)+0xa2; /* Calculate offset for assembler code */
    179183#ifdef DEBUG_BUILDNOMOBJECT
     
    202206{
    203207  NOMClassPriv *nClassPriv; /* This struct holds our private data. A pointer will be in mtab->nomClsInfo */
    204   ULONG ulParentDataSize=0;
     208  gulong ulParentDataSize=0;
    205209
    206210#ifdef DEBUG_BUILDNOMOBJECT
     
    210214
    211215  /* Note: NOMObject has no parents */
    212   if((nClassPriv=buildNOMClassPrivStructForNOMObject(sci))==NULLHANDLE)
    213     return NULLHANDLE;
     216  if((nClassPriv=buildNOMClassPrivStructForNOMObject(sci))==NULL)
     217    return NULL;
    214218
    215219#ifdef DEBUG_BUILDNOMOBJECT
     
    221225  sci->ccds->parentMtab->mtab=nClassPriv->mtab;         /* This class mtab                               */
    222226  sci->ccds->parentMtab->next=NULL;                     /* We dont have parents because we are NOMObject */
    223   sci->ccds->parentMtab->nomClassObject=NULLHANDLE;     /* NOMClass* Class object. We don't have one yet */
     227  sci->ccds->parentMtab->nomClassObject=NULL;     /* NOMClass* Class object. We don't have one yet */
    224228  sci->ccds->parentMtab->ulInstanceSize=nClassPriv->mtab->ulInstanceSize;
    225229  /* C Class data structure */
     
    267271
    268272  /* Run initialization code if any */
    269   _nomInit((NOMObject*)nClassPriv, NULLHANDLE);
    270   return NULLHANDLE;
     273  _nomInit((NOMObject*)nClassPriv, NULL);
     274  return NULL;
    271275}
    272276
Note: See TracChangeset for help on using the changeset viewer.