Changeset 326 for trunk/nom/include


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

Portability patches for Windows, Linux, Darwin by Bird.

Location:
trunk/nom/include
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/nom/include/nom.h

    r281 r326  
    4343  #define NOMEXTERN extern "C"
    4444 #else
    45    #define NOMEXTERN extern
     45  #define NOMEXTERN extern
    4646 #endif
    4747#endif
     
    6565#define NOMDLINK
    6666
     67/** @def NOMDLLEXPORT
     68 * Used for exporting a symbol.
     69 * See __declspec(dllexport) in the Visual C++ reference for details. */
     70/** @def NOMDLLIMPORT
     71 * Used for importing a symbol from a DLL/so.
     72 * See __declspec(dllimport) in the Visual C++ reference for details. */
     73#if defined(_WIN32) || (defined(__OS2__) && defined(__GNUC__) && defined(__declspec))
     74# define NOMDLLEXPORT __declspec(dllexport)
     75# define NOMDLLIMPORT __declspec(dllimport)
     76#elif defined(__GNUC__)
     77# if __GNUC__ >= 4
     78#  define NOMDLLEXPORT __attribute__((visibility("default")))
     79# else
     80#  define NOMDLLEXPORT
     81# endif
     82# define NOMDLLIMPORT
     83#else
     84# define NOMDLLEXPORT
     85# define NOMDLLIMPORT
     86#endif
     87
    6788typedef void* NOMLINK nomMethodProc(void*);
    6889
    6990#ifndef NULL
    70 #define NULL ((void *) 0)
     91# ifdef __cplusplus
     92#  define NULL 0
     93# else
     94#  define NULL ((void *) 0)
     95# endif
    7196#endif
    7297
  • trunk/nom/include/nomapi.h

    r294 r326  
    9191typedef struct nomStaticMethodDescStruct {
    9292  nomMToken *nomMAddressInClassData; /* Method token in class data struct */
    93   nomID nomMethodId;          /* This is a 'gchar**' pointing to something like 
     93  nomID nomMethodId;          /* This is a 'gchar**' pointing to something like
    9494                                 "wpQueryContainerHandle" */
    9595  char** chrMethodDescriptor; /* This points to something like:
    9696                                 "WPFolderWindow:wpQueryContainerHandle" */
    97   nomMethodProc *nomMethod;   /* Address of the function implementing this 
     97  nomMethodProc *nomMethod;   /* Address of the function implementing this
    9898                                 method. */
    9999  nomParmInfo  *pParamInfo;   /* Information about the parameter types */
     
    140140typedef struct
    141141{
    142   ULONG thunk[4];
     142  gulong thunk[4];
    143143}nomMethodThunk;
    144144
     
    150150   data and methods. Note that the name may be slightly misleading. This structure is not
    151151   limited to objects/classes which are related to NOMClass. It's a structure used by every NOM
    152    class (be it a normal class or a meta class). 
     152   class (be it a normal class or a meta class).
    153153*/
    154 typedef struct 
     154typedef struct
    155155{
    156156  nomMethodTab  *mtab;                  /* This is the mtab for this class it points to thisMtab at the
     
    164164  nomStaticClassInfo *sci;              /* Class description                                               */
    165165  /* FIXME: the following list may be obsolete maybe when we just use the parentMtabStruc??                */
    166   nomMethodTabList mtabList;            /* The (private) internal list of mtabs we maintain 
     166  nomMethodTabList mtabList;            /* The (private) internal list of mtabs we maintain
    167167                                           struct nomMethodTabList {
    168168                                           nomMethodTab             *mtab; /mtab for this class
     
    189189  gulong fFlags;
    190190  gpointer pReserved1;
    191   gpointer pReserved2; 
     191  gpointer pReserved2;
    192192}nomEnvironment;
    193193
  • trunk/nom/include/nomgc.h

    r284 r326  
    3939{
    4040  GSList*      dllList;
     41#ifdef __OS2__
    4142  qsPtrRec_t * pMainAnchor;
     43#endif
    4244}REGDLL,*HREGDLL;
    4345
    4446/* Garbage collector */
     47#ifdef __OS2__
    4548void _System nomInitGarbageCollection(void* pMemPtr); //The parameter will go away
     49#else
     50void nomInitGarbageCollection(void* pMemPtr); //The parameter will go away
     51#endif
    4652NOMEXTERN HREGDLL NOMLINK nomBeginRegisterDLLWithGC(void);
    4753NOMEXTERN void NOMLINK nomEndRegisterDLLWithGC(const HREGDLL hRegisterDLL );
    48 NOMEXTERN BOOL NOMLINK nomRegisterDLLByName(const HREGDLL hRegisterDLL, const char* chrDLLName);
     54NOMEXTERN gboolean NOMLINK nomRegisterDLLByName(const HREGDLL hRegisterDLL, const char* chrDLLName);
    4955NOMEXTERN void NOMLINK  nomRegisterDataAreaForGC(char* pStart, char* pEnd);
    5056#if 0
    51 NOMEXTERN BOOL NOMLINK nomRegisterDLLByHandle(const HREGDLL hRegisterDLL, const gpointer pDLLHandle);
     57NOMEXTERN gboolean NOMLINK nomRegisterDLLByHandle(const HREGDLL hRegisterDLL, const gpointer pDLLHandle);
    5258#endif
    5359
    54 NOMEXTERN BOOL NOMLINK nomQueryUsingNameIsDLLRegistered(const gchar *chrName);
     60NOMEXTERN gboolean NOMLINK nomQueryUsingNameIsDLLRegistered(const gchar *chrName);
    5561
    5662#endif /* NOMGC_H_INCLUDED */
  • trunk/nom/include/nomtk.h

    r255 r326  
    4646/* That's the base structure of all the SOM stuff */
    4747typedef struct _nomEnv {
    48   ULONG cbSize;      /* Size of this struct */
    49   PVOID pMemPool;    /* Shared memory heap for sub alloc */
     48  gulong cbSize;      /* Size of this struct */
     49  void *pMemPool;    /* Shared memory heap for sub alloc */
     50#ifdef __OS2__
    5051  HMTX  hmtx_obsolete;  /* Mutex sem to protect this structure -Will go away! */
    51   ULONG ulNumRegIds; /* Number of registered somIDs */
     52#else
     53/* PORTME */
     54#endif
     55  gulong ulNumRegIds; /* Number of registered somIDs */
    5256  NOMClassPriv  *ncpNOMObject;  /* This is for NOMObject*/
    5357  nomClasses livingMetaClasses; /* List of created meta classes. */
     
    6569NOMEXTERN PNOM_ENV NOMLINK nomTkInit(void);
    6670
    67 NOMEXTERN nomToken NOMLINK NOMMalloc(const ULONG size);
     71NOMEXTERN nomToken NOMLINK NOMMalloc(const gulong size);
    6872NOMEXTERN boolean NOMLINK NOMFree(const nomToken memPtr);
    69 NOMEXTERN nomToken NOMLINK  NOMCalloc(const ULONG num, const ULONG size);
     73NOMEXTERN nomToken NOMLINK  NOMCalloc(const gulong num, const gulong size);
    7074//NOMEXTERN gboolean NOMLINK nomIsObj(NOMObject * nomObj);
    7175NOMEXTERN gboolean NOMLINK nomIsObj(gpointer nomObj);
     
    8084
    8185/* Functions used by nomBuildClass() */
    82 ULONG priv_requestSomEnvMutex(PNOM_ENV pEnv);
    83 ULONG priv_releaseSomEnvMutex(PNOM_ENV pEnv);
    84 BOOL priv_addPrivClassToGlobalClassList(PNOM_ENV pEnv, NOMClassPriv * nClass);
     86gulong priv_requestSomEnvMutex(PNOM_ENV pEnv);
     87gulong priv_releaseSomEnvMutex(PNOM_ENV pEnv);
     88gboolean priv_addPrivClassToGlobalClassList(PNOM_ENV pEnv, NOMClassPriv * nClass);
    8589NOMClassPriv* priv_findPrivClassInGlobalClassListFromName(PNOM_ENV pEnv, char* nClass);
    8690
     
    114118#endif
    115119
    116 void _dumpClassDataStruct(nomClassDataStructure* cds, ULONG ulNumMethods);
     120void _dumpClassDataStruct(nomClassDataStructure* cds, gulong ulNumMethods);
    117121void _dumpSci(nomStaticClassInfo* sci);
    118122void  _dumpMtab(nomMethodTab* mtab);
Note: See TracChangeset for help on using the changeset viewer.