Changeset 326


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
Files:
21 added
40 edited

Legend:

Unmodified
Added
Removed
  • trunk/gc6.8/include/gc_config_macros.h

    r132 r326  
    135135#endif
    136136
    137 #if defined(__MINGW32__) && defined(GC_DLL)
     137#if (defined(__MINGW32__) || defined(__KLIBC__)) && defined(GC_DLL)
    138138# ifdef GC_BUILD
    139139#   define GC_API __declspec(dllexport)
  • trunk/gc6.8/mallocx.c

    r132 r326  
    598598#include <limits.h>
    599599
     600#ifdef __OS2__ /* required for linking the testcase */
     601GC_API
     602#endif
    600603GC_PTR GC_memalign(size_t align, size_t lb)
    601604{
  • trunk/idl-compiler/c-emitter_c/c_file_emitter.c

    r295 r326  
    3232*
    3333* ***** END LICENSE BLOCK ***** */
    34 #include <os2.h>
     34#ifdef __OS2__
     35# include <os2.h>
     36#endif
    3537#include <stdlib.h>
    3638#include <string.h>
     
    7981
    8082      /* Do return type */
    81       fprintf(fh, "NOM_Scope ");
     83      fprintf(fh, "NOMDLLEXPORT NOM_Scope ");
    8284      emitReturnType(pLocalPI, pif, pm);
    8385
     
    123125        }
    124126
    125       fprintf(fh, "NOM_Scope ");
     127      fprintf(fh, "NOMDLLEXPORT NOM_Scope ");
    126128      emitReturnType(pLocalPI, pif, pm);
    127129      fprintf(fh, " NOMLINK impl_%s_%s(%s* nomSelf,\n", pif->chrName, pom->chrName, pif->chrName);
     
    167169             
    168170              //printInterface(pif);             
    169               if((pLocalPI->outFile=openOutfile(gScanner, chrTemp))!=NULLHANDLE)
     171              if((pLocalPI->outFile=openOutfile(gScanner, chrTemp))!=NULL)
    170172                {
    171173                  emitCFileHeader(pLocalPI, pif);
     
    173175                  emitOverridenMethods(pLocalPI, pif);
    174176                  closeOutfile(pLocalPI->outFile);
     177                  pLocalPI->outFile = NULL;
    175178                }
    176179              g_free(chrTemp);
  • trunk/idl-compiler/c/emitter.c

    r290 r326  
    3232*
    3333* ***** END LICENSE BLOCK ***** */
    34 #include <os2.h>
     34#ifdef __OS2__
     35# include <os2.h>
     36#endif /* __OS2__ */
     37
    3538#include <stdlib.h>
    3639#include <string.h>
    3740
    38 #include <glib.h> 
    39 #include <glib/gprintf.h> 
     41#include <glib.h>
     42#include <glib/gprintf.h>
    4043
    4144#define INCL_FILE
     
    8689      for(b=0;b<pm->uiStar;b++)
    8790        fprintf(fh, "*");
    88       fprintf(fh, " %s,\n", pm->chrName);     
     91      fprintf(fh, " %s,\n", pm->chrName);
    8992    }
    9093}
     
    101104    {
    102105      PMETHODPARAM pm=(PMETHODPARAM)g_ptr_array_index(pArray, a);
    103       fprintf(fh, " %s,", pm->chrName);     
     106      fprintf(fh, " %s,", pm->chrName);
    104107    }
    105108}
  • trunk/idl-compiler/c/nom-idl-compiler.c

    r310 r326  
    3232*
    3333* ***** END LICENSE BLOCK ***** */
    34 #define INCL_DOSPROCESS
    35 #define INCL_DOS
    36 #define INCL_DOSPROFILE
    37 #define INCL_DOSERRORS
    38 
    39 #include <os2.h>
     34#ifdef __OS2__
     35# define INCL_DOSPROCESS
     36# define INCL_DOS
     37# define INCL_DOSPROFILE
     38# define INCL_DOSERRORS
     39# include <os2.h>
     40#endif /* __OS2__ */
     41
    4042#include <stdio.h>
    4143#include <stdlib.h>
    4244#include <string.h>
    4345
    44 #include <io.h>
     46#ifdef HAVE_IO_H
     47# include <io.h>
     48#endif
     49#ifdef HAVE_UNISTD_H
     50# include <unistd.h>
     51#endif
    4552#include <fcntl.h>
    46 #include <sys\stat.h>
    47 
    48 #include <glib.h> 
     53#include <sys/stat.h>
     54
     55#include <glib.h>
    4956#include <glib/gprintf.h>
    5057
     
    6067
    6168/* Command line options */
    62 static GOptionEntry gOptionEntries[] = 
     69static GOptionEntry gOptionEntries[] =
    6370{
    6471  {"directory", 'd', 0, G_OPTION_ARG_FILENAME, &chrOutputDir, "Output directory", NULL},
     
    361368   This is the root parse function. Here starts the fun. When a token is found in the
    362369   input stream which matches one of the known token types the respective parsing function
    363    is called for further processing. In case of an error the parsing function in question 
     370   is called for further processing. In case of an error the parsing function in question
    364371   prints an error which describes the problem and exits the application.
    365372
     
    370377  while(g_scanner_peek_next_token(gScanner) != G_TOKEN_EOF) {
    371378    GTokenType token;
     379    GTokenValue value;
    372380
    373381    g_scanner_get_next_token(gScanner);
    374382    token=gScanner->token;
    375     GTokenValue value=gScanner->value;
    376    
     383    value=gScanner->value;
     384
    377385    switch(token)
    378386      {
     
    468476filename\n\n");
    469477
    470   /* This prints the standard option help to screen. */ 
     478  /* This prints the standard option help to screen. */
    471479  g_option_context_parse (gContext, &argc2, &argv2, &gError);
    472480}
     
    494502void funcMsgHandler(GScanner *gScanner, gchar *message, gboolean error)
    495503{
    496   g_printf("%s:%d: error: %s (%d %d)\n", parseInfo.chrCurrentSourceFile,
     504  g_printf("%s:%d: error: %s (%d %d)\n",
     505           parseInfo.chrCurrentSourceFile ? parseInfo.chrCurrentSourceFile : "<null>", /* glib doesn't check for NULL like printf. */
    497506           g_scanner_cur_line(gScanner)-parseInfo.uiLineCorrection, message,
    498507           g_scanner_cur_line(gScanner), parseInfo.uiLineCorrection);
     
    554563    }
    555564#endif
    556  
     565
    557566  /*** Create output path name ****/
    558567  if(g_path_is_absolute(chrOutputDir))
     
    572581  else
    573582    fd=open(argv[1], O_RDONLY);
    574  
     583
    575584  if(-1==fd)
    576585    {
     
    600609  while(pSymbols->chrSymbolName)
    601610    {
    602 #warning !!! Create a copy here so it is the same as with new symbols added later.
     611#ifndef _MSC_VER
     612# warning !!! Create a copy here so it is the same as with new symbols added later.
     613#endif
    603614      g_scanner_scope_add_symbol(gScanner, ID_SCOPE, pSymbols->chrSymbolName,
    604615                                 pSymbols);
  • trunk/idl-compiler/c/open_outfile.c

    r319 r326  
    3232*
    3333* ***** END LICENSE BLOCK ***** */
    34 #include <os2.h>
     34#ifdef __OS2__
     35# include <os2.h>
     36#endif /* __OS2__ */
     37
    3538#include <stdlib.h>
    3639#include <string.h>
  • trunk/idl-compiler/c/printdata.c

    r321 r326  
    3232*
    3333* ***** END LICENSE BLOCK ***** */
    34 #include <os2.h>
     34#ifdef __OS2__
     35# include <os2.h>
     36#endif
    3537#include <stdio.h>
    3638#include <stdlib.h>
    3739#include <string.h>
    3840
    39 #include <io.h>
     41#ifdef HAVE_IO_H
     42# include <io.h>
     43#endif
     44#ifdef HAVE_UNISTD_H
     45# include <unistd.h>
     46#endif
    4047#include <fcntl.h>
    41 #include <sys\stat.h>
     48#include <sys/stat.h>
    4249
    4350#include <glib/gprintf.h>
  • trunk/idl-compiler/c/token.c

    r321 r326  
    3333* ***** END LICENSE BLOCK ***** */
    3434
    35 #include <os2.h>
     35#ifdef __OS2__
     36# include <os2.h>
     37#endif /* __OS2__ */
     38
    3639#include <stdio.h>
    3740#include "nom.h"
  • trunk/idl-compiler/c/util.c

    r292 r326  
    3232*
    3333* ***** END LICENSE BLOCK ***** */
    34 #include <os2.h>
     34#ifdef __OS2__
     35# include <os2.h>
     36#endif
    3537#include <stdlib.h>
    3638#include <string.h>
     
    6264    return NULL;
    6365
    64   while((pifParent=getParentInterface(pifParent))!=NULLHANDLE)
     66  while((pifParent=getParentInterface(pifParent))!=NULL)
    6567    {
    6668      int a;
     
    100102    return NULL;
    101103
    102   while((pifParent=getParentInterface(pifParent))!=NULLHANDLE)
     104  while((pifParent=getParentInterface(pifParent))!=NULL)
    103105    {
    104106      int a;
  • trunk/idl-compiler/h-emitter_c/h_file_emitter.c

    r292 r326  
    3232*
    3333* ***** END LICENSE BLOCK ***** */
    34 #include <os2.h>
     34#ifdef __OS2__
     35# include <os2.h>
     36#endif  /* __OS2__ */
     37
    3538#include <stdlib.h>
    3639#include <string.h>
     
    107110
    108111  fprintf(fh, "/* Class data structure */\n");
     112  fprintf(fh, "#ifdef NOM_%s_IMPLEMENTATION_FILE\n", pif->chrName);
     113  fprintf(fh, "NOMDLLEXPORT\n");
     114  fprintf(fh, "#else\n");
     115  fprintf(fh, "NOMDLLIMPORT\n");
     116  fprintf(fh, "#endif\n");
    109117  fprintf(fh, "NOMEXTERN struct %sClassDataStructure {\n", pif->chrName);
    110118
     
    116124      fprintf(fh, "    nomMToken %s;\n", pm->chrName);
    117125    }
    118   fprintf(fh, "}%sClassData;\n\n", pif->chrName);
    119 
     126  fprintf(fh, "} NOMDLINK %sClassData;\n\n", pif->chrName);
     127
     128  fprintf(fh, "#ifdef NOM_%s_IMPLEMENTATION_FILE\n", pif->chrName);
     129  fprintf(fh, "NOMDLLEXPORT\n");
     130  fprintf(fh, "#else\n");
     131  fprintf(fh, "NOMDLLIMPORT\n");
     132  fprintf(fh, "#endif\n");
    120133  fprintf(fh, "NOMEXTERN struct %sCClassDataStructure {\n", pif->chrName);
    121134  fprintf(fh, "   nomMethodTabs parentMtab;\n");
     
    132145  if(strcmp(pif->chrName , "NOMObject"))
    133146    {
     147/* FIXME: why is this here too? it's already in nomtk.h... */
    134148      fprintf(fh, "/* This function is used to check if a given object is valid and the\n");
    135149      fprintf(fh, "   object supports the method */\n");
     
    181195              pif->chrName, pm->chrName);
    182196      /* Forward declaration of parameter test function */
     197      fprintf(fh, "#ifdef NOM_%s_IMPLEMENTATION_FILE\n", pif->chrName);
     198      fprintf(fh, "NOMDLLEXPORT\n");
     199      fprintf(fh, "#else\n");
     200      fprintf(fh, "NOMDLLIMPORT\n");
     201      fprintf(fh, "#endif\n");
    183202      fprintf(fh, "NOMEXTERN gboolean NOMLINK parmCheckFunc_%s_%s(%s *nomSelf,\n",
    184203              pif->chrName,  pm->chrName, pif->chrName);
     
    266285
    267286  fprintf(fh, "/*\n * Class creation function\n */\n");
     287  fprintf(fh, "#ifdef NOM_%s_IMPLEMENTATION_FILE\n", pif->chrName);
     288  fprintf(fh, "NOMDLLEXPORT\n");
     289  fprintf(fh, "#else\n");
     290  fprintf(fh, "NOMDLLIMPORT\n");
     291  fprintf(fh, "#endif\n");
    268292  fprintf(fh, "NOMEXTERN NOMClass * NOMLINK %sNewClass(gulong clsMajorVersion, gulong clsMinorVersion);\n\n",
    269293          pif->chrName);
     
    291315  PINTERFACE pifParent=pif;
    292316
    293   while((pifParent=getParentInterface(pifParent))!=NULLHANDLE)
     317  while((pifParent=getParentInterface(pifParent))!=NULL)
    294318    {
    295319      GPtrArray *pArray;
     
    345369             
    346370              //printInterface(pif);             
    347               if((pLocalPI->outFile=openOutfile(gScanner, chrTemp))!=NULLHANDLE)
     371              if((pLocalPI->outFile=openOutfile(gScanner, chrTemp))!=NULL)
    348372                {
    349373                  emitHFileHeader(pLocalPI, pif);
     
    357381                  emitHFileFooter(pLocalPI, pif);
    358382                  closeOutfile(pLocalPI->outFile);
     383                  pLocalPI->outFile = NULL;
    359384                }
    360385              g_free(chrTemp);
  • trunk/idl-compiler/ih-emitter_c/ih_file_emitter.c

    r293 r326  
    3232*
    3333* ***** END LICENSE BLOCK ***** */
    34 #include <os2.h>
     34#ifdef __OS2__
     35# include <os2.h>
     36#endif /* __OS2__ */
     37
    3538#include <stdlib.h>
    3639#include <string.h>
     
    8083            fprintf(fh, "  %s;\n", piv->chrName);
    8184    }
    82   fprintf(fh, "}%sData;\n\n", pif->chrName);
     85#ifdef _MSC_VER
     86  if(!a)
     87    fprintf(fh, "  int iDummy;\n"); /* HACK ALERT! */
     88#endif
     89  fprintf(fh, "} %sData;\n\n", pif->chrName);
    8390}
    8491
     
    8693{
    8794  FILE* fh=pLocalPI->outFile;
    88   GPtrArray *pArray=pif->pInstanceVarArray;;
     95  GPtrArray *pArray=pif->pInstanceVarArray;
    8996  int a;
    9097
     
    116123
    117124  fprintf(fh, "/*** Class data structures ***/\n");
    118   fprintf(fh, "struct %sClassDataStructure %sClassData = {0};\n", pif->chrName, pif->chrName );
    119   fprintf(fh, "static struct %sCClassDataStructure %sCClassData = {0};\n\n",
     125  fprintf(fh, "NOMDLLEXPORT struct %sClassDataStructure %sClassData = {0};\n", pif->chrName, pif->chrName );
     126  fprintf(fh, "NOMDLLEXPORT struct %sCClassDataStructure %sCClassData = {0};\n\n",
    120127          pif->chrName, pif->chrName);
    121128}
     
    126133NOMEXTERN gboolean NOMLINK objectCheckFunc_WPRootFolder(WPRootFolder *nomSelf, gchar* chrMethodName)
    127134{
    128 if(!nomIsObj(nomSelf) || !_nomIsANoClsCheck(nomSelf , WPRootFolderClassData.classObject, NULLHANDLE))
     135if(!nomIsObj(nomSelf) || !_nomIsANoClsCheck(nomSelf , WPRootFolderClassData.classObject, NULL))
    129136  {
    130137  nomPrintObjectPointerError(nomSelf, "WPRootFolder", chrMethodName);
     
    170177      fprintf(fh, "\",\n");     
    171178    }
     179#ifdef _MSC_VER
     180  if(!a)
     181    fprintf(fh, "  NULL\n");
     182#endif
    172183}
    173184
     
    187198      fprintf(fh, "#if !defined(_decl_impl_%s_%s_)\n", pif->chrName, pm->chrName);
    188199      fprintf(fh, "#define _decl_impl_%s_%s_ 1\n", pif->chrName, pm->chrName);
    189       fprintf(fh, "NOM_Scope ");
     200      fprintf(fh, "NOMDLLEXPORT NOM_Scope ");
    190201      emitReturnType(pLocalPI, pif, pm);
    191202      fprintf(fh, " NOMLINK impl_%s_%s(%s *nomSelf,\n", pif->chrName, pm->chrName, pif->chrName);
     
    238249        }
    239250
    240       fprintf(fh, "NOM_Scope ");
     251      fprintf(fh, "NOMDLLEXPORT NOM_Scope ");
    241252      emitReturnType(pLocalPI, pif, pm);
    242253      fprintf(fh, " NOMLINK impl_%s_%s(%s* nomSelf,\n", pif->chrName, pom->chrName, pif->chrName);
     
    271282  fprintf(fh, "static nomOverridenMethodDesc nomOverridenMethods%s[] = {\n", pif->chrName);
    272283
     284  pArray=pif->pOverrideArray;
     285
    273286  for(a=0;a<pArray->len;a++)
    274287    {
     
    289302      fprintf(fh, "  },\n");
    290303    }
    291     fprintf(fh, "};\n\n");
     304#ifdef _MSC_VER
     305  if(!a)
     306    fprintf(fh, "  { NULL, NULL, NULL }\n");
     307#endif
     308  fprintf(fh, "};\n\n");
    292309}
    293310
     
    316333      fprintf(fh, "},\n");
    317334    }
     335#ifdef _MSC_VER
     336  if(!a)
     337    fprintf(fh, "  { NULL, NULL, NULL, NULL, NULL }\n");
     338#endif
    318339  fprintf(fh, "};\n\n");
    319340}
     
    344365      /* Emit the parents. We have to output them sorted beginning from the
    345366         leftmost parent. */
    346       while(pifParent->chrParent && (pifParent=findInterfaceFromName(pifParent->chrParent))!=NULLHANDLE)
     367      while(pifParent->chrParent && (pifParent=findInterfaceFromName(pifParent->chrParent))!=NULL)
    347368        {
    348369          g_ptr_array_add(pArray, (gpointer) pifParent);
     
    372393  PINTERFACE pifParent=pif;
    373394
    374   while(pifParent->chrParent && (pifParent=findInterfaceFromName(pifParent->chrParent))!=NULLHANDLE)
     395  while(pifParent->chrParent && (pifParent=findInterfaceFromName(pifParent->chrParent))!=NULL)
    375396    ulRet++;
    376397
     
    498519    }
    499520  fprintf(fh, "#include \"nomgc.h\"\n");
     521  fprintf(fh, "#ifdef NOM_%s_IMPLEMENTATION_FILE\n", pif->chrName);
     522  fprintf(fh, "NOMDLLEXPORT\n");
     523  fprintf(fh, "#else\n");
     524  fprintf(fh, "NOMDLLIMPORT\n");
     525  fprintf(fh, "#endif\n");
    500526  fprintf(fh, "NOMClass* NOMLINK %sNewClass(gulong ulMajor, gulong ulMinor)\n", pif->chrName);
    501527  fprintf(fh, "{\n");
     
    516542  fprintf(fh, "    nomEndRegisterDLLWithGC(hReg);\n");
    517543  fprintf(fh, "    }\n");
     544  fprintf(fh, "#elif defined(_WIN32)\n");
     545  fprintf(fh, " /* FIXME: check this up with the GC. */\n");
     546  fprintf(fh, "#elif defined(__APPLE__)\n");
     547  fprintf(fh, "# warning FIXME: Check out GC/dylib.\n");
     548  fprintf(fh, "#elif defined(__linux__)\n");
     549  fprintf(fh, "# warning FIXME: Check out GC/so on linux.\n");
    518550  fprintf(fh, "#else\n");
    519551  fprintf(fh, "#error DLL must be registered with the garbage collector!\n");
     
    562594              //printInterface(pif);
    563595              chrTemp=g_strconcat(pif->chrFileStem, ".ih", NULL);
    564               if((pLocalPI->outFile=openOutfile(gScanner, chrTemp))!=NULLHANDLE)
     596              if((pLocalPI->outFile=openOutfile(gScanner, chrTemp))!=NULL)
    565597                {
    566598                  emitIHFileHeader(pLocalPI, pif);
  • trunk/idl-compiler/parser_c/classversion_parser.c

    r271 r326  
    3232*
    3333* ***** END LICENSE BLOCK ***** */
    34 #include <os2.h>
     34#ifdef __OS2__
     35# include <os2.h>
     36#endif /* __OS2__ */
     37
    3538#include <stdio.h>
    3639#include <stdlib.h>
  • trunk/idl-compiler/parser_c/filestem_parser.c

    r307 r326  
    3232*
    3333* ***** END LICENSE BLOCK ***** */
    34 #include <os2.h>
     34#ifdef __OS2__
     35# include <os2.h>
     36#endif  /* __OS2__ */
     37
    3538#include <stdio.h>
    3639#include <stdlib.h>
  • trunk/idl-compiler/parser_c/hash_parser.c

    r308 r326  
    3232*
    3333* ***** END LICENSE BLOCK ***** */
    34 #include <os2.h>
     34#ifdef __OS2__
     35# include <os2.h>
     36#endif /* __OS2__ */
     37
    3538#include <stdio.h>
    3639#include <stdlib.h>
     
    4548  Current token is a '#'.
    4649
    47   H:= '#' INT STRING INT     // Line info from the preprocessor
     50  H:= '#line' INT STRING INT // Line info from the preprocessor
     51  H:= '#' INT STRING INT     // Line info from the preprocessor (gcc short hand)
    4852 */
    4953void parseHash(void)
    5054{
     55  if (g_scanner_peek_next_token(gScanner) == G_TOKEN_IDENTIFIER
     56   && !strcmp(gScanner->next_value.v_identifier, "line"))
     57    getNextToken(); /* skip the line part. */
    5158
    5259  if(matchNext(G_TOKEN_INT))
  • trunk/idl-compiler/parser_c/instancevar_parser.c

    r271 r326  
    3232*
    3333* ***** END LICENSE BLOCK ***** */
    34 #include <os2.h>
     34#ifdef __OS2__
     35# include <os2.h>
     36#endif /* __OS2__ */
     37
    3538#include <stdio.h>
    3639#include <stdlib.h>
  • trunk/idl-compiler/parser_c/interface_parser.c

    r309 r326  
    3737  a specialized parser function in another source file is called from here.
    3838 */
    39 #include <os2.h>
     39#ifdef __OS2__
     40# include <os2.h>
     41#endif /* __OS2__ */
     42
    4043#include <stdlib.h>
    4144#include <string.h>
     
    292295{
    293296  PSYMBOL pCurSymbol;
     297  GTokenValue value;
    294298
    295299  /* Parent interface */
     
    305309      exit(1);
    306310    }
    307   GTokenValue value=gScanner->value;
     311  value=gScanner->value;
    308312  /* Make sure it's the correct symbol */
    309313  pCurSymbol=value.v_symbol;
  • trunk/idl-compiler/parser_c/lineinfo_parser.c

    r306 r326  
    3939 */
    4040
    41 #include <os2.h>
     41#ifdef __OS2__
     42# include <os2.h>
     43#endif /* __OS2__ */
     44
    4245#include <stdio.h>
    4346#include <stdlib.h>
  • trunk/idl-compiler/parser_c/metaclass_parser.c

    r320 r326  
    3232*
    3333* ***** END LICENSE BLOCK ***** */
    34 #include <os2.h>
     34#ifdef __OS2__
     35# include <os2.h>
     36#endif /* __OS2__ */
     37
    3538#include <stdio.h>
    3639#include <stdlib.h>
  • trunk/idl-compiler/parser_c/method_parser.c

    r271 r326  
    3232*
    3333* ***** END LICENSE BLOCK ***** */
    34 #include <os2.h>
     34#ifdef __OS2__
     35# include <os2.h>
     36#endif /* __OS2__ */
     37
    3538#include <stdlib.h>
    3639
  • trunk/idl-compiler/parser_c/override_parser.c

    r309 r326  
    3232*
    3333* ***** END LICENSE BLOCK ***** */
    34 #include <os2.h>
     34#ifdef __OS2__
     35# include <os2.h>
     36#endif /* __OS2__ */
     37
    3538#include <stdio.h>
    3639#include <stdlib.h>
  • trunk/idl-compiler/parser_c/typespec_parser.c

    r269 r326  
    3232*
    3333* ***** END LICENSE BLOCK ***** */
    34 #include <os2.h>
     34#ifdef __OS2__
     35# include <os2.h>
     36#endif /* __OS2__ */
     37
    3538#include <stdio.h>
    3639
  • 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 
  • trunk/nom/idl/nombase.idl

    r268 r326  
    6363#define NOMCLASSNAME( a ) native P ## a
    6464#endif
     65#ifndef _MSC_VER /* doesn't work here yet. */
    6566/* For doing parameter checks */
    6667#define NOMPARMCHECK(a ,...)   const string _conc(a, _conc(__PARMCHECK__, _conc(__LINE__,__INCLUDE_LEVEL__))) = #__VA_ARGS__
     68#endif
    6769
    6870
  • 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);
  • trunk/nom/src/nombuildclass.c

    r255 r326  
    3636 */
    3737
    38 #define INCL_DOS
    39 #define INCL_DOSERRORS
    40 
    41 #include <os2.h>
     38#ifdef __OS2__
     39# define INCL_DOS
     40# define INCL_DOSERRORS
     41# include <os2.h>
     42#endif /* __OS2__ */
     43
    4244#include <stdarg.h>
    4345#include <stdio.h>
    4446#include <string.h>
    45 #include <alloca.h>
     47#include <stdlib.h>
     48#if !defined(_MSC_VER)
     49# include <alloca.h>
     50#endif
    4651#include <glib.h>
    4752#define SOM_NO_OBJECTS  /* Otherwise som.h includes the IBM SOM classes */
     
    6974#endif
    7075
    71 #ifdef DEBUG_NOMBUILDCLASS
    72 #define DBG_BUILD_LINE(a)
    73 #define DBG_NOMBUILDCLASS(a, b,...)   if(a) nomPrintf("%d: " b , __LINE__,  __VA_ARGS__);
     76#ifdef _MSC_VER
     77void _inline DBG_NOMBUILDCLASS(gboolean a, const char fmt, ...)
     78{
     79    /* sorry nothing here. */
     80}
    7481#else
    75 #define DBG_NOMBUILDCLASS(a, b,...)
    76 #endif
     82# ifdef DEBUG_NOMBUILDCLASS
     83#  define DBG_BUILD_LINE(a)
     84#  define DBG_NOMBUILDCLASS(a, b,...)   if(a) nomPrintf("%d: " b , __LINE__,  __VA_ARGS__);
     85# else
     86#  define DBG_NOMBUILDCLASS(a, b,...)
     87# endif
     88#endif
    7789
    7890#define DBGBUILDNOMCLASS_ENTER BUILDNOMCLASS_ENTER
     
    95107*/
    96108
    97 static ULONG thunk[]={0x0424448b, 0x00000405, 0x0000c300};
     109static gulong thunk[]={0x0424448b, 0x00000405, 0x0000c300};
    98110
    99111/*
     
    102114JMP DWORD PTR [EDX+0ACh]  : JMP to address pointing to by EDX+0ACh
    103115 */
    104 static ULONG mThunkCode[]={0x04244c8b, 0xff00518b, 0x0000aca2 , 0x16000000};
     116static gulong mThunkCode[]={0x04244c8b, 0xff00518b, 0x0000aca2 , 0x16000000};
    105117
    106118
     
    116128 */
    117129
    118 static BOOL priv_nomIsA(NOMObject *nomSelf, NOMClass* aClassObj)
     130static gboolean priv_nomIsA(NOMObject *nomSelf, NOMClass* aClassObj)
    119131{
    120132  nomParentMtabStructPtr pParentMtab=&((NOMClassPriv * )nomSelf)->parentMtabStruct;
     
    195207                    __FUNCTION__, __LINE__, gstr->str);
    196208          idx++; /* This is the position for the class pointer */
    197           ncPriv=_nomGetClassInfoPtrFromName(NOMClassMgrObject, sci->chrParentClassNames[a], NULLHANDLE);
     209          ncPriv=_nomGetClassInfoPtrFromName(NOMClassMgrObject, sci->chrParentClassNames[a], NULL);
    198210          /* now find the index */
    199211          ulNumMethods=nomGetNumIntroducedMethods(ncPriv);
     
    245257          }
    246258          else{
    247             ncPriv=_nomGetClassInfoPtrFromName(NOMClassMgrObject, sci->chrParentClassNames[a], NULLHANDLE);
     259            ncPriv=_nomGetClassInfoPtrFromName(NOMClassMgrObject, sci->chrParentClassNames[a], NULL);
    248260            //nomPrintf("   %s did not introduce the method. Adding %d to index\n",
    249261            //        sci->chrParentClassNames[a], nomGetNumIntroducedMethods(ncPriv)+1);
     
    275287    for(b=0;b<sci->ulNumStaticOverrides;b++) {/* For every overriden method do */
    276288      nomMethodProc** entries;
    277       ULONG index;
     289      gulong index;
    278290
    279291      entries=&nClass->mtab->entries[0];  /* Adress of array where we enter our resoved method */
     
    333345boolean addMethodAndDataToThisPrivClassStruct(NOMClassPriv* nClass, NOMClassPriv* ncpParent, nomStaticClassInfo *sci)
    334346{
    335   BYTE * mem;
     347  guint8 * mem;
    336348  int a;
    337349
     
    389401    /* Now finally put the thunking in so the procedures are resolved correctly. */
    390402    for(a=0;a<sci->ulNumStaticMethods;a++) {
    391       ULONG ulOffset;
     403      gulong ulOffset;
    392404
    393405      memcpy(&nClass->mThunk[a], mThunkCode, sizeof(mThunkCode)); /* Copy thunking code */
    394406
    395       ulOffset=(ULONG)((char*)(mem+sizeof(NOMClass*))-(char*)nClass->mtab); /* Skip class object pointer */
     407      ulOffset=(gulong)((char*)(mem+sizeof(NOMClass*))-(char*)nClass->mtab); /* Skip class object pointer */
    396408      nClass->mThunk[a].thunk[2]=((ulOffset+a*sizeof(nomMethodProc*))<<8)+0xa2;
    397409      /* Put thunking code address into CClassStruct */
     
    431443    {
    432444      ncpParent=_nomGetClassInfoPtrFromName(NOMClassMgrObject, chrClassName,
    433                                   NULLHANDLE);
     445                                  NULL);
    434446    }
    435447
     
    495507                                                        NOMClass* nomClass)
    496508{
    497   ULONG ulParentDataSize=0;
    498   ULONG mtabSize;
    499   ULONG ulMemSize=0;
     509  gulong ulParentDataSize=0;
     510  gulong mtabSize;
     511  gulong ulMemSize=0;
    500512  NOMClassPriv  *nClass, *ncpParent;
    501513
     
    503515
    504516  if(!nomClass||!sci)
    505     return NULLHANDLE;
     517    return NULL;
    506518
    507519  /* The addresse of static methods in sci are already resolved. See nomBuildClass() */
     
    512524  }/* nomIdAllParents */
    513525  else
    514     ncpParent = NULLHANDLE;
     526    ncpParent = NULL;
    515527
    516528  if(!ncpParent) {
     
    518530    /* FIXME:       
    519531       Maybe we should panic here.  */
    520     return NULLHANDLE; /* Only NOMObject has no parent, so we have a problem here. */
     532    return NULL; /* Only NOMObject has no parent, so we have a problem here. */
    521533  }
    522534
     
    540552
    541553  /* Alloc private class struct using NOMCalloc. */
    542   if((nClass=(NOMClassPriv*)NOMCalloc(1, ulMemSize))==NULLHANDLE)
    543     return NULLHANDLE;
     554  if((nClass=(NOMClassPriv*)NOMCalloc(1, ulMemSize))==NULL)
     555    return NULL;
    544556#if 0
    545557  //Moved to addMethodAndDataToThisPrivClassStruct()
     
    549561    if(!nClass->mThunk) {
    550562      NOMFree(nClass);
    551       return NULLHANDLE;
     563      return NULL;
    552564    }
    553565  }
     
    561573  if(!addMethodAndDataToThisPrivClassStruct( nClass, ncpParent, sci)){
    562574    NOMFree(nClass);
    563     return NULLHANDLE;
     575    return NULL;
    564576  };
    565577 
     
    580592  nClass->mtab->nomClassObject=nomClass; /* Class object (metaclass). We build a normal class here. */
    581593  nClass->mtab->nomClsInfo=(nomClassInfo*)nClass;
     594#ifndef _MSC_VER
    582595#warning !!!!! Change this when nomId is a GQuark !!!!!
     596#endif
    583597  nClass->mtab->nomClassName=*sci->nomClassId;
    584598  nClass->mtab->ulInstanceSize=sci->ulInstanceDataSize+ulParentDataSize; /* Size of instance data of this class and all
     
    589603  DBG_NOMBUILDCLASS(TRUE, "New NOMClassPriv*: %x\n", nClass);
    590604
    591   _nomSetObjectCreateInfo(nomClass, nClass, NULLHANDLE);
     605  _nomSetObjectCreateInfo(nomClass, nClass, NULL);
    592606
    593607  /* Mark the class as using nomUnInit() if any parent did that. We just have to
     
    610624 
    611625  if(NULL==NOMClassMgrObject)
    612     return NULLHANDLE;
     626    return NULL;
    613627
    614628  /* Search for meta class. */
     629#ifndef _MSC_VER
    615630#warning !!!!! Change this when nomID is a GQuark !!!!!
    616   nomClassMeta=_nomFindClassFromName(NOMClassMgrObject, *sci->nomExplicitMetaId, majorVersion, minorVersion, NULLHANDLE);
     631#endif
     632  nomClassMeta=_nomFindClassFromName(NOMClassMgrObject, *sci->nomExplicitMetaId, majorVersion, minorVersion, NULL);
    617633
    618634    DBG_NOMBUILDCLASS(TRUE, "%x %s %s\n", nomClassMeta, *sci->nomClassId, *sci->nomExplicitMetaId);
    619635
    620636  if(!nomClassMeta)
    621     return NULLHANDLE;
     637    return NULL;
    622638
    623639  /* Create a new class object. We create a copy here because we may change the mtab entries
     
    625641     sizes, methods etc. I wonder how IBM SOM manages to use the same metaclass
    626642     for different classes without (apparently) copying it for different uses... */
    627   if((nomClass=(NOMClass*)NOMCalloc(1, _nomGetSize(nomClassMeta, NULLHANDLE)))==NULLHANDLE)
    628     return NULLHANDLE;
     643  if((nomClass=(NOMClass*)NOMCalloc(1, _nomGetSize(nomClassMeta, NULL)))==NULL)
     644    return NULL;
    629645
    630646  /* Maybe we should just copy the whole struct here? */
    631647  nomClass->mtab=nomClassMeta->mtab;
     648#ifndef _MSC_VER
    632649#warning !!!!! No call of _nomSetInstanceSize  !!!!!
    633650#warning !!!!! No call of _nomSetObjectsSCI   !!!!!
     651#endif
    634652#if 0
    635653  /* Set object data */
     
    678696    {
    679697      NOMObject *nObject;
    680       nObject=_nomFindClassFromName(NOMClassMgrObject, sci->chrParentClassNames[a], 0, 0, NULLHANDLE);
     698      nObject=_nomFindClassFromName(NOMClassMgrObject, sci->chrParentClassNames[a], 0, 0, NULL);
    681699
    682700      DBG_NOMBUILDCLASS( TRUE , "   Parent %d: %s, class object: %x\n" ,
     
    710728
    711729#ifdef DEBUG_NOMBUILDCLASS
     730# ifndef _MSC_VER
    712731#warning !!!!! Change this when nomId is a GQuark !!!!!
     732# endif
    713733  nomPrintf("\n%d: Entering %s to build %s\n", __LINE__, __FUNCTION__, *sci->nomClassId);
    714734#endif
     
    722742
    723743  if(!nomClassDefault)
    724     return NULLHANDLE;
     744    return NULL;
    725745
    726746  /* Found NOMClass object */
    727747
    728   //nomPrintf("_nomGetSize(): %d\n", _nomGetSize(nomClassParent, NULLHANDLE));
     748  //nomPrintf("_nomGetSize(): %d\n", _nomGetSize(nomClassParent, NULL));
    729749
    730750  /* Create an object */
    731   if((nomClass=(NOMClass*)NOMCalloc(1, _nomGetSize(nomClassDefault, NULLHANDLE)))==NULLHANDLE)
    732     return NULLHANDLE;
     751  if((nomClass=(NOMClass*)NOMCalloc(1, _nomGetSize(nomClassDefault, NULL)))==NULL)
     752    return NULL;
    733753
    734754  nomClass->mtab=nomClassDefault->mtab;
    735755
     756#ifndef _MSC_VER
    736757#warning !!!!! _nomSetInstanceSize() not called here !!!!!
    737758#warning !!!!! _nomSetObjectsSCI() not called here !!!!!
     759#endif
    738760#if 0
    739761  /* Set object data */
     
    783805
    784806  /* Allocate a class object for NOMObject for creating NOMObject instances. */
    785   if((nomObjClass=(NOMClass*)NOMCalloc(1, ulSize))==NULLHANDLE) {
     807  if((nomObjClass=(NOMClass*)NOMCalloc(1, ulSize))==NULL) {
    786808    /* We panic here for the simple reason that without a working NOMObject the whole object system
    787809       will not work. */
    788810    g_error("No memory for building the class object _NOMObject for NOMObject.");
    789     return NULLHANDLE;
     811    return NULL;
    790812  }
    791813
    792814  nomObjClass->mtab=nomClass->mtab;         /* Now it's an object */
    793815
    794   _nomSetObjectCreateInfo(nomObjClass, pGlobalNomEnv->ncpNOMObject, NULLHANDLE); /* This NOMClassPriv holds all info to build
     816  _nomSetObjectCreateInfo(nomObjClass, pGlobalNomEnv->ncpNOMObject, NULL); /* This NOMClassPriv holds all info to build
    795817                                                                                    instances of NOMObject (not that anybody
    796818                                                                                    should do that but... */
     819#ifndef _MSC_VER
    797820#warning !!!!!!!!!!!!! _somSetObjectsSCI() not called!!!!!!!!!!!!!!!!
    798821#warning !!!!!!!!!!!!! _somSetClassData() not called!!!!!!!!!!!!!!!!
     822#endif
    799823#if 0
    800824  _somSetObjectsSCI(nomObjClass, ncp->sci);
     
    828852  NOMClassPriv *nClass;
    829853  NOMClassPriv *ncpParent;
    830   ULONG ulParentDataSize=0;
    831   ULONG mtabSize;
    832   ULONG ulMemSize=0;
     854  gulong ulParentDataSize=0;
     855  gulong mtabSize;
     856  gulong ulMemSize=0;
    833857  int a;
    834858
     
    856880
    857881  if(!strcmp(*sci->nomClassId, "NOMObject")){
    858     if(pGlobalNomEnv->ncpNOMObject!=NULLHANDLE){
     882    if(pGlobalNomEnv->ncpNOMObject!=NULL){
    859883      DBG_NOMBUILDCLASS(TRUE, "Class %s already built. returning 0x%x\n",
    860884                        *sci->nomClassId, sci->nomCds->nomClassObject);
    861885      /* FIXME: this seems to be broken!! */
    862       return NULLHANDLE; /* NOMObject already built */
     886      return NULL; /* NOMObject already built */
    863887    }
    864888  }
     
    871895  if(sci->ulNumStaticMethods!=0 && !sci->nomSMethods){
    872896    nomPrintf("  !!! %s line %d: sci->nomSMethods is NULL for %s !!!\n", __FUNCTION__, __LINE__, *sci->nomClassId);
    873     return NULLHANDLE;
     897    return NULL;
    874898  }
    875899  /* Fill static classdata with the info from nomStaticMethodDesc array. This means
     
    903927    priv_buildNOMObjectClassInfo(ulReserved, sci, /* yes */
    904928                                 ulMajorVersion, ulMinorVersion);
    905     return NULLHANDLE; /* We can't return a NOMClass for NOMObject because NOMClass isn't built yet. */
     929    return NULL; /* We can't return a NOMClass for NOMObject because NOMClass isn't built yet. */
    906930  }
    907931
     
    914938  if(sci->nomIdAllParents) {
    915939#ifdef DEBUG_NOMBUILDCLASS
     940# ifndef _MSC_VER
    916941#warning !!!!! Change this when nomId is a GQuark !!!!!
     942# endif
    917943    nomPrintf("%d: About to search parent %s...\n", __LINE__, **(sci->nomIdAllParents));
    918944#endif
     
    927953#endif
    928954    if(!ncpParent)
    929       return NULLHANDLE; /* Every class except NOMObject must have a parent!! */
     955      return NULL; /* Every class except NOMObject must have a parent!! */
    930956  }/* nomIdAllParents */
    931957  else
    932     return NULLHANDLE; /* Every class except NOMObject must have a parent!! */
     958    return NULL; /* Every class except NOMObject must have a parent!! */
    933959
    934960  if(!ncpParent)
    935     return NULLHANDLE; /* Every class except NOMObject must have a parent!! */
     961    return NULL; /* Every class except NOMObject must have a parent!! */
    936962
    937963#ifdef DEBUG_NOMBUILDCLASS
     
    10291055
    10301056  /* Alloc class struct using NOMCalloc. */
    1031   if((nClass=(NOMClassPriv*)NOMCalloc(1, ulMemSize))==NULLHANDLE)
    1032     return NULLHANDLE;
     1057  if((nClass=(NOMClassPriv*)NOMCalloc(1, ulMemSize))==NULL)
     1058    return NULL;
    10331059
    10341060#if 0
     
    10391065    if(!nClass->mThunk) {
    10401066      NOMFree(nClass);
    1041       return NULLHANDLE;
     1067      return NULL;
    10421068    }
    10431069  }
     
    10461072  nClass->ulClassSize=sci->ulInstanceDataSize+ulParentDataSize;
    10471073
    1048   if((nomClass=(NOMClass*)NOMCalloc(1, sci->ulInstanceDataSize+ulParentDataSize))==NULLHANDLE) {
     1074  if((nomClass=(NOMClass*)NOMCalloc(1, sci->ulInstanceDataSize+ulParentDataSize))==NULL) {
    10491075    //NOMFree(nClass->mThunk);
    10501076    NOMFree(nClass);
    1051     return NULLHANDLE;
     1077    return NULL;
    10521078  }
    10531079
     
    10581084    NOMFree(nClass);
    10591085    NOMFree(nomClass);
    1060     return NULLHANDLE;
     1086    return NULL;
    10611087  };
    10621088
     
    10881114
    10891115  /* Set this class size into instance var */
     1116#ifndef _MSC_VER
    10901117#warning !!!!! No call of _nomSetInstanceSize() here !!!!!
     1118#endif
    10911119  // _nomSetInstanceSize(nomClass, sci->ulInstanceDataSize+ulParentDataSize);
    10921120
     
    11491177    sID=SOMMalloc(sizeof(void*));
    11501178    if(!sID)
    1151       return NULLHANDLE;
     1179      return NULL;
    11521180
    11531181    *sID=(char*)sid;
     
    11561184
    11571185  /* No somId registered  yet, so create one */
    1158   if((sid=(somIdItem*)SOMCalloc(1, sizeof(somIdItem)))==NULLHANDLE)
    1159     return NULLHANDLE;
     1186  if((sid=(somIdItem*)SOMCalloc(1, sizeof(somIdItem)))==NULL)
     1187    return NULL;
    11601188
    11611189  sid->idString=SOMMalloc(strlen(aString)+1);
     
    11631191    {
    11641192      SOMFree(sid);
    1165       return NULLHANDLE;
     1193      return NULL;
    11661194    }
    11671195
     
    11721200    SOMFree(sid->idString);
    11731201    SOMFree(sid);
    1174     return NULLHANDLE;
     1202    return NULL;
    11751203  }
    11761204
    11771205  sID=SOMMalloc(sizeof(void*));
    11781206  if(!sID)
    1179     return NULLHANDLE;
     1207    return NULL;
    11801208
    11811209  *sID=(char*)sid;
     
    11931221  char* chrPtr;
    11941222  SOMClassPriv *scp;
    1195   ULONG ulLen;
     1223  gulong ulLen;
    11961224  char *chrMem;
    11971225
    11981226  if(!sid)
    1199     return NULLHANDLE;
    1200 
    1201   if((chrPtr=strchr(**sid, ':'))==NULLHANDLE)
    1202     return NULLHANDLE;
     1227    return NULL;
     1228
     1229  if((chrPtr=strchr(**sid, ':'))==NULL)
     1230    return NULL;
    12031231
    12041232  /* Create local copy */
    12051233  ulLen=strlen(**sid);
    12061234  if(ulLen>5000) /* prevent stack overflow in case of error */
    1207     return NULLHANDLE;
     1235    return NULL;
    12081236
    12091237  chrMem=alloca(ulLen);
    12101238  strcpy(chrMem, **sid);
    12111239
    1212   if((chrPtr=strchr(chrMem, ':'))==NULLHANDLE)
    1213     return NULLHANDLE; /* How should that happen, but anyway... */
     1240  if((chrPtr=strchr(chrMem, ':'))==NULL)
     1241    return NULL; /* How should that happen, but anyway... */
    12141242
    12151243  *chrPtr=0; /* Now we have separated the class name */
     
    12221250#endif
    12231251  if(!scp)
    1224     return NULLHANDLE;
     1252    return NULL;
    12251253#ifdef DEBUG_SOMBUILDCLASS
    12261254  somPrintf("%d: %s: found %x (SOMClassPriv) ->%x (SOMClass)\n", __LINE__, __FUNCTION__, scp, scp->mtab->classObject);
     
    12401268  char* chrPtr;
    12411269  SOMClassPriv *scp;
    1242   ULONG ulLen;
     1270  gulong ulLen;
    12431271  char *chrMem;
    12441272
    12451273  if(!sid)
    1246     return NULLHANDLE;
    1247 
    1248   if((chrPtr=strchr(**sid, ':'))==NULLHANDLE)
    1249     return NULLHANDLE;
     1274    return NULL;
     1275
     1276  if((chrPtr=strchr(**sid, ':'))==NULL)
     1277    return NULL;
    12501278
    12511279  /* Create local copy */
    12521280  ulLen=strlen(**sid);
    12531281  if(ulLen>5000) /* prevent stack overflow in case of error */
    1254     return NULLHANDLE;
     1282    return NULL;
    12551283
    12561284  chrMem=alloca(ulLen);
    12571285  strcpy(chrMem, **sid);
    12581286
    1259   if((chrPtr=strchr(chrMem, ':'))==NULLHANDLE)
    1260     return NULLHANDLE; /* How should that happen, but anyway... */
     1287  if((chrPtr=strchr(chrMem, ':'))==NULL)
     1288    return NULL; /* How should that happen, but anyway... */
    12611289
    12621290  *chrPtr=0; /* Now we have separated the class name */
     
    12671295  somPrintf("%d: %s: found %x (SOMClassPriv)\n", __LINE__, __FUNCTION__, scp);
    12681296  if(!scp)
    1269     return NULLHANDLE;
     1297    return NULL;
    12701298#ifdef DEBUG_SOMBUILDCLASS
    12711299  somPrintf("%d: %s: found %x (SOMClassPriv) ->%x\n", __LINE__, __FUNCTION__, scp, scp->mtab->classObject);
     
    12841312  FIXME: semaphores ????
    12851313 */
    1286 static ULONG priv_getIndexOfMethodToBeOverriden(somId *methodId )
     1314static gulong priv_getIndexOfMethodToBeOverriden(somId *methodId )
    12871315{
    12881316  return 0;
     
    12971325  struct somMethodTabListStruct;
    12981326  struct somParentMtabStruct;               Struct to place parent mtab pointer
    1299   ULONG  thunk[3];                       Assembler thunking code
     1327  gulong  thunk[3];                       Assembler thunking code
    13001328  somMethodTabStruct mtabStruct;         See beloe
    13011329  ClassDataStruct class1;
     
    13671395                                       long minorVersion)
    13681396{
    1369   BYTE * mem;
     1397  guint8 * mem;
    13701398  SOMClassPriv *sClass; /* This struct holds our private data. A pointer will be in mtab->classInfo */
    13711399  SOMClass *somClass;   /* A real SOMClass pointer */
    13721400  int a;
    1373   ULONG mtabSize;
    1374   ULONG ulMemSize=0;
    1375   ULONG ulParentDataSize=0;
     1401  gulong mtabSize;
     1402  gulong ulMemSize=0;
     1403  gulong ulParentDataSize=0;
    13761404
    13771405#ifdef DEBUG_BUILDSOMOBJECT
     
    13821410
    13831411  /* Note: SOMObject has no parents */
    1384   return NULLHANDLE;
     1412  return NULL;
    13851413 
    13861414  /* ulMemsize will be the size of our private class structure SOMClassPriv */
     
    13971425
    13981426  /* Alloc private class struct using SOMCalloc. */
    1399   if((sClass=(SOMClassPriv*)SOMCalloc(1, ulMemSize))==NULLHANDLE)
    1400     return NULLHANDLE;
     1427  if((sClass=(SOMClassPriv*)SOMCalloc(1, ulMemSize))==NULL)
     1428    return NULL;
    14011429
    14021430  /* Get mem for method thunking code. This assembler code is needed so the indirect
     
    14071435  if(!sClass->mThunk) {
    14081436    SOMFree(sClass);
    1409     return NULLHANDLE;
     1437    return NULL;
    14101438  }
    14111439
     
    14251453  /* And now the real SOMClass struct which will be seen by the user. A SOMClass has a mTab pointer
    14261454     at the beginning and the instance data following. */
    1427   if((somClass=(SOMClass*)SOMCalloc(1, sci->instanceDataSize+sizeof(somMethodTab*)))==NULLHANDLE) {
     1455  if((somClass=(SOMClass*)SOMCalloc(1, sci->instanceDataSize+sizeof(somMethodTab*)))==NULL) {
    14281456    SOMFree(sClass->mThunk);
    14291457    SOMFree(sClass);
    1430     return NULLHANDLE;
     1458    return NULL;
    14311459  }
    14321460  somClass->mtab=sClass->mtab;
     
    14611489    /* Now finally put the thunking in so the procedures are resolved correctly. */
    14621490    for(a=0;a<sci->numStaticMethods;a++) {
    1463       ULONG ulOffset;
     1491      gulong ulOffset;
    14641492
    14651493      memcpy(&sClass->mThunk[a], mThunkCode, sizeof(mThunkCode));               /* Copy method thunking code template  */
    1466       ulOffset=(ULONG)((char*)(mem+sizeof(SOMClass*))-(char*)somClass->mtab);   /* Skip priv class data pointer        */
     1494      ulOffset=(gulong)((char*)(mem+sizeof(SOMClass*))-(char*)somClass->mtab);   /* Skip priv class data pointer        */
    14671495      sClass->mThunk[a].thunk[2]=((ulOffset+a*sizeof(somMethodProc*))<<8)+0xa2; /* Calculate offset for assembler code */
    14681496#ifdef DEBUG_BUILDSOMOBJECT
  • 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}
  • 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
  • trunk/nom/src/nomdebug.c

    r281 r326  
    3333* ***** END LICENSE BLOCK ***** */
    3434
    35 #define INCL_DOS
    36 #define INCL_DOSFILEMGR
    37 #define INCL_DOSERRORS
    38 #define INCL_WIN
    39 #define INCL_WINWORKPLACE
    40 #define INCL_OS2MM
    41 #define INCL_MMIOOS2
    42 #define INCL_MCIOS2
    43 #define INCL_GPI
    44 #define INCL_PM
    45 
    46 #include <os2.h>
     35#ifdef __OS2__
     36# define INCL_DOS
     37# define INCL_DOSFILEMGR
     38# define INCL_DOSERRORS
     39# define INCL_WIN
     40# define INCL_WINWORKPLACE
     41# define INCL_OS2MM
     42# define INCL_MMIOOS2
     43# define INCL_MCIOS2
     44# define INCL_GPI
     45# define INCL_PM
     46# include <os2.h>
     47#endif /* __OS2__ */
     48
    4749#include <stdarg.h>
    4850#include <stdio.h>
     
    6567      g_error("The object used to call the method %s is not a valid NOM object. ", chrMethodName);
    6668    else
    67       g_error("The object for which the method %s should be called is not valid for this method.\nThe object must be some instance of class %s (or of a subclass) but is a %s.", chrMethodName, NOMClass_nomGetCreatedClassName(nomClass, NULLHANDLE),
    68                 NOMObject_nomGetClassName(nomObject, NULLHANDLE));
     69      g_error("The object for which the method %s should be called is not valid for this method.\nThe object must be some instance of class %s (or of a subclass) but is a %s.", chrMethodName, NOMClass_nomGetCreatedClassName(nomClass, NULL),
     70                NOMObject_nomGetClassName(nomObject, NULL));
    6971  }
    7072}
     
    114116
    115117  //  g_message("In %s with %s %px nomClass: %px (%s)", __FUNCTION__, chrMethodName, nomSelf, nomClass, nomClass->mtab->nomClassName);
    116   if(!nomIsObj(nomSelf) || !_nomIsANoClsCheck(nomSelf, nomClass, NULLHANDLE))
     118  if(!nomIsObj(nomSelf) || !_nomIsANoClsCheck(nomSelf, nomClass, NULL))
    117119    {
    118120      nomPrintObjectPointerErrorMsg(nomSelf, nomClass, chrMethodName);
     
    154156  nomPrintf("----- %s -----  NOMClassMgrObject: %lx\n", __FUNCTION__, NOMClassMgrObject);
    155157
    156   pgdata=_nomGetClassList(NOMClassMgrObject, NULLHANDLE);
     158  pgdata=_nomGetClassList(NOMClassMgrObject, NULL);
    157159  if(pgdata){
    158160    nomPrintf("%s: classlist: %lx\n", __FUNCTION__, pgdata);
     
    176178    nomPrintf("explicitMetaId (meta class): %s\n", *sci->nomExplicitMetaId);
    177179  else
    178     nomPrintf("explicitMetaId (meta class): NULLHANDLE\n");
     180    nomPrintf("explicitMetaId (meta class): NULL\n");
    179181  //  somPrintf("*parents: 0x%x\n", sci->parents);
    180182  nomPrintf("somClassDataStructure cds: 0x%x\n",sci->nomCds);
     
    190192
    191193
    192 void _dumpClassDataStruct(nomClassDataStructure* cds, ULONG ulNumMethods)
     194void _dumpClassDataStruct(nomClassDataStructure* cds, gulong ulNumMethods)
    193195{
    194196  int a;
     
    215217  nomPrintf("  instanceSize (this and all parents): %d 0x%x\n", mtab->ulInstanceSize, mtab->ulInstanceSize);
    216218  nomPrintf("  mtabSize: %d 0x%x\n", mtab->mtabSize, mtab->mtabSize);
    217   nomPrintf("  somMethodProcs: (%ld)\n", (mtab->mtabSize-(LONG)sizeof(nomMethodTab))/4);
     219  nomPrintf("  somMethodProcs: (%ld)\n", (mtab->mtabSize-(glong)sizeof(nomMethodTab))/4);
    218220  //  entries=sObj->mtab->entries[0];
    219221   for(a=0; a<=(mtab->mtabSize-sizeof(nomMethodTab))/4; a++)
     
    234236  nomPrintf("*classInfo: 0x%x\n", *sObj->mtab->nomClsInfo);
    235237
    236   so=(ULONG*)sObj->mtab->classInfo;
     238  so=(gulong*)sObj->mtab->classInfo;
    237239#endif
    238240  nomPrintf("className: %s\n", sObj->mtab->nomClassName);
     
    249251
    250252#if 0
    251 void _dumpStaticMTab(somStaticMethod_t* smt, ULONG ulMethod)
     253void _dumpStaticMTab(somStaticMethod_t* smt, gulong ulMethod)
    252254{
    253255  somStaticMethod_t* tmpSmt=&smt[ulMethod];
     
    262264}
    263265
    264 void _dumpOverrideMTab(somOverrideMethod_t* omt, ULONG ulMethod)
     266void _dumpOverrideMTab(somOverrideMethod_t* omt, gulong ulMethod)
    265267{
    266268  somOverrideMethod_t* tmpOmt=&omt[ulMethod];
     
    300302      tempPtr=(void*)tempPtr->next->mtab;
    301303    else
    302       tempPtr=NULLHANDLE;
     304      tempPtr=NULL;
    303305  }
    304306
     
    400402  somPrintf("  instanceSize (this and all parents): %d 0x%x\n", sObj->mtab->instanceSize, sObj->mtab->instanceSize);
    401403  somPrintf("  mtabSize: %d 0x%x\n", sObj->mtab->mtabSize, sObj->mtab->mtabSize);
    402   somPrintf("  somMethodProcs: (%ld)\n", (sObj->mtab->mtabSize-(LONG)sizeof(somMethodTab))/4);
     404  somPrintf("  somMethodProcs: (%ld)\n", (sObj->mtab->mtabSize-(glong)sizeof(somMethodTab))/4);
    403405  //  entries=sObj->mtab->entries[0];
    404406   for(a=0; a<=(sObj->mtab->mtabSize-sizeof(somMethodTab))/4; a++)
  • trunk/nom/src/nomgc.c

    r286 r326  
    3737 */
    3838
    39 #define INCL_DOS
    40 #define INCL_DOSERRORS
    41 #define INCL_DOSMEMMGR
    42 #include <os2.h>
     39#ifdef __OS2__
     40# define INCL_DOS
     41# define INCL_DOSERRORS
     42# define INCL_DOSMEMMGR
     43# include <os2.h>
     44#endif /* __OS2__ */
    4345
    4446#include <stdio.h>
     
    8385  memory functions as the GLIB default allocation function.
    8486 */
     87#ifdef __OS2__
    8588void _System  nomInitGarbageCollection(void* pMemInExe)
     89#else
     90void nomInitGarbageCollection(void* pMemInExe)
     91#endif
    8692{
    8793 GMemVTable vtbl={0};
     
    98104
    99105 /* Cretea tree holding the already registered DLLs */
     106#ifdef _MSC_VER
    100107 treeRegisteredDLL=g_tree_new((GCompareFunc)stricmp);
     108#else
     109 treeRegisteredDLL=g_tree_new((GCompareFunc)strcasecmp);
     110#endif
    101111
    102112 bUseGC=TRUE;
     
    104114
    105115
     116#ifdef __OS2__
    106117void test()
    107118{
     
    110121  HMODULE hModule;
    111122
    112   if(DosQueryModFromEIP( &hModule, &ulObj, CCHMAXPATH, thePath, &ulOffset, (ULONG)test)!=0) {
     123  if(DosQueryModFromEIP( &hModule, &ulObj, CCHMAXPATH, thePath, &ulOffset, (gulong)test)!=0) {
    113124    hModule=0;
    114125    return ; /* Error */
     
    116127
    117128}
     129#endif /* __OS2__ */
    118130
    119131NOMEXTERN void NOMLINK  nomRegisterDataAreaForGC(char* pStart, char* pEnd)
     
    122134}
    123135
     136#ifdef __OS2__
     137
    124138static void qsAddDLLToList(HREGDLL hReg, qsLrec_t* rec)
    125139{
    126   if(NULLHANDLE==g_slist_find(hReg->dllList, rec))
     140  if(NULL==g_slist_find(hReg->dllList, rec))
    127141    hReg->dllList=g_slist_append(hReg->dllList, rec);
    128142}
     
    160174      /* g_message("%d Checking: %x -> %04X (%s)", a, pModRec, pModRec->hmte, pModRec->pName); */
    161175
    162       if (NULLHANDLE==pModRec->pObjInfo   && pModRec->ctObj > 0)
     176      if (NULL==pModRec->pObjInfo   && pModRec->ctObj > 0)
    163177        {
    164178          pModRec->pObjInfo = (qsLObjrec_t*)((char*)pModRec
     
    179193}
    180194
     195
    181196/**
    182197   Get the info about the current DLLs from OS/2. Go over all found
     
    187202NOMEXTERN HREGDLL NOMLINK nomBeginRegisterDLLWithGC(void)
    188203{
    189   ULONG rc;
    190   HREGDLL hReg=NULLHANDLE;
     204  gulong rc;
     205  HREGDLL hReg=NULL;
    191206  PTIB     ptib;
    192207  PPIB     ppib;
    193208  char *  buf;
    194   HREGDLL  pRegDLL=NULLHANDLE;
     209  HREGDLL  pRegDLL=NULL;
    195210
    196211  rc = DosGetInfoBlocks(&ptib, &ppib);
    197212  if (rc!=NO_ERROR)
    198     return NULLHANDLE;
     213    return NULL;
    199214
    200215  buf = malloc(BUFSIZE);
    201216  if(!buf)
    202     return NULLHANDLE;
     217    return NULL;
    203218
    204219  pRegDLL =(HREGDLL) malloc(sizeof(REGDLL));
    205220  if(!pRegDLL){
    206221    free(buf);
    207     return NULLHANDLE;
     222    return NULL;
    208223  }
    209   pRegDLL->dllList=NULLHANDLE;
     224  pRegDLL->dllList=NULL;
    210225
    211226  memset(buf,0,BUFSIZE);
     
    303318#define OBJWRITE        0x0002L
    304319#define OBJINVALID      0x0080L
    305 NOMEXTERN BOOL NOMLINK nomRegisterDLLByName(const HREGDLL hRegisterDLL, const char* chrDLLName)
     320NOMEXTERN gboolean NOMLINK nomRegisterDLLByName(const HREGDLL hRegisterDLL, const char* chrDLLName)
    306321{
    307322  GSList* lTemp;
     
    316331      if(pModRec){
    317332        //  g_message("DLL name: %s", pModRec->pName);
    318         if(pModRec->pName && (NULLHANDLE!=strstr( pModRec->pName, chrDLLName)))
     333        if(pModRec->pName && (NULL!=strstr( pModRec->pName, chrDLLName)))
    319334          {
    320335            qsLObjrec_t  *pObjInfo;
    321336            //g_message("    --> Found DLL %s", pModRec->pName);
    322337            pObjInfo=pModRec->pObjInfo;
    323             if(NULLHANDLE!=pObjInfo)
     338            if(NULL!=pObjInfo)
    324339              {
    325340                int iObj;
     
    344359}
    345360
    346 
    347 NOMEXTERN BOOL NOMLINK nomQueryUsingNameIsDLLRegistered(const gchar *chrName)
    348 {
    349   if(NULLHANDLE!=g_tree_lookup(treeRegisteredDLL, chrName))
     361//#elif defined(_WIN32)
     362#else /* PORTME */
     363
     364NOMEXTERN HREGDLL NOMLINK nomBeginRegisterDLLWithGC(void)
     365{
     366    HREGDLL pRegDLL;
     367
     368    pRegDLL =(HREGDLL) malloc(sizeof(REGDLL));
     369    if(pRegDLL)
     370      pRegDLL->dllList=NULL;
     371    return pRegDLL;
     372}
     373
     374NOMEXTERN void NOMLINK nomEndRegisterDLLWithGC(const HREGDLL hRegisterDLL )
     375{
     376}
     377
     378NOMEXTERN gboolean NOMLINK nomRegisterDLLByName(const HREGDLL hRegisterDLL, const char* chrDLLName)
     379{
    350380    return TRUE;
     381}
     382
     383#endif
     384
     385NOMEXTERN gboolean NOMLINK nomQueryUsingNameIsDLLRegistered(const gchar *chrName)
     386{
     387  if(NULL!=g_tree_lookup(treeRegisteredDLL, chrName))
     388    return TRUE;
    351389
    352390  return FALSE;
  • trunk/nom/src/nomid.c

    r190 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__ */
    3940
    4041#include "nom.h"
  • trunk/nom/src/nommemory.c

    r193 r326  
    3333* ***** END LICENSE BLOCK ***** */
    3434
    35 #define INCL_DOS
    36 #define INCL_DOSERRORS
    37 #define INCL_DOSMEMMGR
     35#ifdef __OS2__
     36# define INCL_DOS
     37# define INCL_DOSERRORS
     38# define INCL_DOSMEMMGR
     39# include <os2.h>
     40#endif /* __OS2__ */
    3841
    39 #include <os2.h>
    4042
    4143#include <string.h>
    4244#include <stdlib.h>
    4345
    44 #include <gtk/gtk.h>
     46/* #include <gtk/gtk.h> - why? */
    4547#include <nom.h>
    4648#include <nomtk.h>
     
    4951extern gboolean bUseGC; /* Set during initialization */
    5052
    51 NOMEXTERN nomToken NOMLINK NOMMalloc(ULONG size)
     53NOMEXTERN nomToken NOMLINK NOMMalloc(const gulong size)
    5254{
    5355  gchar* memPtr;
    5456
    55   if((memPtr=g_malloc(size))==NULLHANDLE)
    56     return NULLHANDLE;
     57  if((memPtr=g_malloc(size))==NULL)
     58    return NULL;
    5759
    5860  return (nomToken) memPtr;
     
    6163  PULONG memPtr;
    6264
    63   if((memPtr=g_malloc(size+sizeof(gpointer)))==NULLHANDLE)
    64     return NULLHANDLE;
     65  if((memPtr=g_malloc(size+sizeof(gpointer)))==NULL)
     66    return NULL;
    6567
    6668  *memPtr=size;
     
    7072}
    7173
    72 nomToken NOMLINK NOMCalloc(const ULONG num, const ULONG size)
     74nomToken NOMLINK NOMCalloc(const gulong num, const gulong size)
    7375{
    7476  gchar* memPtr;
    7577
    76   if((memPtr=g_malloc(size*num ))==NULLHANDLE)
    77     return NULLHANDLE; /* We won't end here because GLib just terminates the process :-/
     78  if((memPtr=g_malloc(size*num ))==NULL)
     79    return NULL; /* We won't end here because GLib just terminates the process :-/
    7880                          A really sick idea imho. */
    7981  if(!bUseGC)
     
    8587  PULONG memPtr;
    8688
    87   if((memPtr=g_malloc(size*num + sizeof(ULONG)))==NULLHANDLE)
    88     return NULLHANDLE; /* We won't end here because GLib just terminates the process :-/
     89  if((memPtr=g_malloc(size*num + sizeof(gulong)))==NULL)
     90    return NULL; /* We won't end here because GLib just terminates the process :-/
    8991                          A really sick idea imho. */
    9092  if(!bUseGC)
    91     memset(memPtr, 0, size*num + sizeof(ULONG)); /* GC always returns zeroed memory */
     93    memset(memPtr, 0, size*num + sizeof(gulong)); /* GC always returns zeroed memory */
    9294
    9395  *memPtr=size;
     
    103105{
    104106#if 0
    105   ULONG* pul=(PULONG)memPtr;
     107  gulong* pul=(PULONG)memPtr;
    106108
    107109  pul--;
  • trunk/nom/src/nomtkinit.c

    r284 r326  
    3333* ***** END LICENSE BLOCK ***** */
    3434
    35 #define INCL_DOS
    36 #define INCL_DOSERRORS
    37 #define INCL_DOSMEMMGR
    38 #include <os2.h>
     35#ifdef __OS2__
     36# define INCL_DOS
     37# define INCL_DOSERRORS
     38# define INCL_DOSMEMMGR
     39# include <os2.h>
     40#endif /* __OS2__ */
    3941
    4042#include <stdarg.h>
     
    5961PNOM_ENV pGlobalNomEnv;
    6062/* Global class manager object */
    61 NOMClassMgr* NOMClassMgrObject=NULLHANDLE; /* Referenced from different files */
     63NOMClassMgr* NOMClassMgrObject=NULL; /* Referenced from different files */
    6264
    6365gboolean fInitialized=FALSE;
     
    8082{
    8183  if(NOMClassMgrObject)
    82     return NOMClassMgr_nomIsObject(NOMClassMgrObject, (PNOMObject)nomObj, NULLHANDLE);
     84    return NOMClassMgr_nomIsObject(NOMClassMgrObject, (PNOMObject)nomObj, NULL);
    8385
    8486  if(!nomObj)
     
    104106NOMEXTERN PNOM_ENV NOMLINK nomTkInit(void)
    105107{
    106   PVOID memPtr;
     108  void *memPtr;
    107109
    108110  if(pGlobalNomEnv)
     
    170172
    171173  /* Now register the classes we already have */
    172   _nomClassReady(pGlobalNomEnv->defaultMetaClass, NULLHANDLE); //NOMClass
    173   _nomClassReady(  _NOMClassMgr, NULLHANDLE); //NOMClassMgr
     174  _nomClassReady(pGlobalNomEnv->defaultMetaClass, NULL); //NOMClass
     175  _nomClassReady(  _NOMClassMgr, NULL); //NOMClassMgr
    174176  ncPriv=(NOMClassPriv*)pGlobalNomEnv->nomObjectMetaClass->mtab->nomClsInfo;
    175177
    176178  /* Do not register the NOMObject metaclass here. It's already registered because it's
    177179     NOMClass in fact. */
    178   _nomClassReady(_NOMObject, NULLHANDLE); //NOMObject
     180  _nomClassReady(_NOMObject, NULL); //NOMObject
    179181
    180182
     
    186188
    187189  nomPrintf("\nCalling _nomTestFunc_NOMTest2() 1\n", nomTst2Obj);
    188   _nomTestFunc_NOMTest2(nomTst2Obj, NULLHANDLE);
     190  _nomTestFunc_NOMTest2(nomTst2Obj, NULL);
    189191  nomPrintf("\nCalling _nomTestFuncString_NOMTest2() 1\n", nomTst2Obj);
    190   nomPrintf("--> %s\n",_nomTestFuncString_NOMTest2(nomTst2Obj, NULLHANDLE));
     192  nomPrintf("--> %s\n",_nomTestFuncString_NOMTest2(nomTst2Obj, NULL));
    191193  nomPrintf("\nCalling _nomTestFunc_NOMTest2() 2\n", nomTst2Obj);
    192   _nomTestFunc_NOMTest2(nomTst2Obj, NULLHANDLE);
     194  _nomTestFunc_NOMTest2(nomTst2Obj, NULL);
    193195
    194196  nomPrintf("\nCalling _nomTestFunc() with NOMTest2 object: %x\n", nomTst2Obj);
    195   _nomTestFunc(nomTst2Obj, NULLHANDLE);
     197  _nomTestFunc(nomTst2Obj, NULL);
    196198  nomPrintf("\nCalling _nomTestFuncString() with NOMTest2: %x\n", nomTst2Obj);
    197   nomPrintf("--> %s\n",_nomTestFuncString(nomTst2Obj, NULLHANDLE));
     199  nomPrintf("--> %s\n",_nomTestFuncString(nomTst2Obj, NULL));
    198200  nomPrintf("\n");
    199   _nomTestFunc(nomTst2Obj, NULLHANDLE);
    200   _nomTestFunc_NOMTest2(nomTst2Obj, NULLHANDLE);
     201  _nomTestFunc(nomTst2Obj, NULL);
     202  _nomTestFunc_NOMTest2(nomTst2Obj, NULL);
    201203#endif
    202204  /* This must be done last! */
  • trunk/tests/c/test-nom.c

    r323 r326  
    3232*
    3333* ***** END LICENSE BLOCK ***** */
    34 #define INCL_DOSPROCESS
    35 #define INCL_DOS
    36 #define INCL_DOSPROFILE
    37 #define INCL_DOSERRORS
    38 
    39 #include <os2.h>
     34#ifdef __OS2__
     35# define INCL_DOSPROCESS
     36# define INCL_DOS
     37# define INCL_DOSPROFILE
     38# define INCL_DOSERRORS
     39# include <os2.h>
     40#endif /* __OS2__ */
     41
    4042#include <stdio.h>
    4143#include <stdlib.h>
    4244#include <string.h>
    4345
    44 #include <io.h>
     46#ifdef HAVE_IO_H
     47# include <io.h>
     48#endif
     49#ifdef HAVE_UNISTD_H
     50# include <unistd.h>
     51#endif
    4552#include <fcntl.h>
    46 #include <sys\stat.h>
     53#include <sys/stat.h>
    4754
    4855#include <glib.h>
     
    8996void tstAClassInstanceVarInitValues(AClass * aObject)
    9097{
    91   ULONG ulRC;
     98  gulong ulRC;
    9299
    93100  g_message("================================================================");
     
    95102  g_message("================================================================");
    96103 
    97   ulRC=_tstQueryUlongVar1(aObject, NULLHANDLE);
     104  ulRC=_tstQueryUlongVar1(aObject, NULL);
    98105  g_message("Calling tstQueryUlongVar1():\t%ld\t\t%s", ulRC, (0!=ulRC ? "FAILED" : "OK"));
    99106  g_assert(0==ulRC);
    100107 
    101   ulRC=_tstQueryUlongVar2(aObject, NULLHANDLE);
     108  ulRC=_tstQueryUlongVar2(aObject, NULL);
    102109  g_message("Calling tstQueryUlongVar2():\t%ld\t\t%s\n", ulRC, (0!=ulRC ? "FAILED" : "OK"));
    103110  g_assert(0==ulRC);
     
    107114void tstBClassInstanceVarInitValues(BClass * aObject)
    108115{
    109   ULONG ulRC;
     116  gulong ulRC;
    110117
    111118  g_message("================================================================");
     
    113120  g_message("================================================================");
    114121 
    115   ulRC=_tstQueryBClassUlongVar1(aObject, NULLHANDLE);
     122  ulRC=_tstQueryBClassUlongVar1(aObject, NULL);
    116123  g_message("Calling tstQueryBClassUlongVar1():\t%ld\t\t%s", ulRC, (0!=ulRC ? "FAILED" : "OK"));
    117124  g_assert(0==ulRC);
    118125 
    119   ulRC=_tstQueryBClassUlongVar2(aObject, NULLHANDLE);
     126  ulRC=_tstQueryBClassUlongVar2(aObject, NULL);
    120127  g_message("Calling tstQueryBClassUlongVar2():\t%ld\t\t%s\n", ulRC, (0!=ulRC ? "FAILED" : "OK"));
    121128  g_assert(0==ulRC);
     
    125132void tstSetAClassInstanceVar(AClass * aObject)
    126133{
    127   ULONG ulRC;
     134  gulong ulRC;
    128135
    129136  g_message("========================================================");
     
    131138  g_message("========================================================");
    132139  /* Set 1. value */
    133   _tstSetUlongVar1(aObject, ULONG_TESTVALUE_1, NULLHANDLE);
    134   ulRC=_tstQueryUlongVar1(aObject, NULLHANDLE);
    135   g_message("Calling tstQueryUlongVar1():\t0x%lx\t\t%s", ulRC, (ULONG_TESTVALUE_1!=ulRC ? "FAILED" : "OK"));
    136   g_assert(ULONG_TESTVALUE_1==ulRC);
    137 
    138   ulRC=_tstQueryUlongVar2(aObject, NULLHANDLE);
     140  _tstSetUlongVar1(aObject, ULONG_TESTVALUE_1, NULL);
     141  ulRC=_tstQueryUlongVar1(aObject, NULL);
     142  g_message("Calling tstQueryUlongVar1():\t0x%lx\t\t%s", ulRC, (ULONG_TESTVALUE_1!=ulRC ? "FAILED" : "OK"));
     143  g_assert(ULONG_TESTVALUE_1==ulRC);
     144
     145  ulRC=_tstQueryUlongVar2(aObject, NULL);
    139146  g_message("Calling tstQueryUlongVar2():\t0x%lx\t\t\t%s\n", ulRC, (0!=ulRC ? "FAILED" : "OK"));
    140147  g_assert(0==ulRC);
    141148
    142149  /* Set 2. value */
    143   _tstSetUlongVar2(aObject, ULONG_TESTVALUE_2, NULLHANDLE);
    144   ulRC=_tstQueryUlongVar1(aObject, NULLHANDLE);
    145   g_message("Calling tstQueryUlongVar1():\t0x%lx\t\t%s", ulRC, (ULONG_TESTVALUE_1!=ulRC ? "FAILED" : "OK"));
    146   g_assert(ULONG_TESTVALUE_1==ulRC);
    147 
    148   ulRC=_tstQueryUlongVar2(aObject, NULLHANDLE);
     150  _tstSetUlongVar2(aObject, ULONG_TESTVALUE_2, NULL);
     151  ulRC=_tstQueryUlongVar1(aObject, NULL);
     152  g_message("Calling tstQueryUlongVar1():\t0x%lx\t\t%s", ulRC, (ULONG_TESTVALUE_1!=ulRC ? "FAILED" : "OK"));
     153  g_assert(ULONG_TESTVALUE_1==ulRC);
     154
     155  ulRC=_tstQueryUlongVar2(aObject, NULL);
    149156  g_message("Calling tstQueryUlongVar2():\t0x%lx\t\t%s\n\n", ulRC, (ULONG_TESTVALUE_2!=ulRC ? "FAILED" : "OK"));
    150157  g_assert(ULONG_TESTVALUE_2==ulRC);
     
    153160void tstSetBClassInstanceVar(BClass * aObject)
    154161{
    155   ULONG ulRC;
     162  gulong ulRC;
    156163
    157164  g_message("========================================================");
     
    159166  g_message("========================================================");
    160167  /* Set 1. value */
    161   _tstSetBClassUlongVar1(aObject, ULONG_TESTVALUE_BCLASS_1, NULLHANDLE);
     168  _tstSetBClassUlongVar1(aObject, ULONG_TESTVALUE_BCLASS_1, NULL);
    162169
    163170  /* AClass */
    164   ulRC=_tstQueryUlongVar1(aObject, NULLHANDLE);
    165   g_message("Calling tstQueryUlongVar1():\t0x%lx\t\t%s", ulRC, (ULONG_TESTVALUE_1!=ulRC ? "FAILED" : "OK"));
    166   g_assert(ULONG_TESTVALUE_1==ulRC);
    167   ulRC=_tstQueryUlongVar2(aObject, NULLHANDLE);
     171  ulRC=_tstQueryUlongVar1(aObject, NULL);
     172  g_message("Calling tstQueryUlongVar1():\t0x%lx\t\t%s", ulRC, (ULONG_TESTVALUE_1!=ulRC ? "FAILED" : "OK"));
     173  g_assert(ULONG_TESTVALUE_1==ulRC);
     174  ulRC=_tstQueryUlongVar2(aObject, NULL);
    168175  g_message("Calling tstQueryUlongVar2():\t0x%lx\t\t%s", ulRC, (ULONG_TESTVALUE_2!=ulRC ? "FAILED" : "OK"));
    169176  g_assert(ULONG_TESTVALUE_2==ulRC);
    170177
    171178  /* BClass*/
    172   ulRC=_tstQueryBClassUlongVar1(aObject, NULLHANDLE);
     179  ulRC=_tstQueryBClassUlongVar1(aObject, NULL);
    173180  g_message("Calling tstQueryBClassUlongVar1():\t0x%lx\t\t%s", ulRC, (ULONG_TESTVALUE_BCLASS_1!=ulRC ? "FAILED" : "OK"));
    174181  g_assert(ULONG_TESTVALUE_BCLASS_1==ulRC);
    175182
    176   ulRC=_tstQueryBClassUlongVar2(aObject, NULLHANDLE);
     183  ulRC=_tstQueryBClassUlongVar2(aObject, NULL);
    177184  g_message("Calling tstQueryBClassUlongVar2():\t0x%lx\t\t\t%s\n\n", ulRC, (0!=ulRC ? "FAILED" : "OK"));
    178185  g_assert(0==ulRC);
     
    181188
    182189  /* Set 2. value */
    183   _tstSetBClassUlongVar2(aObject, ULONG_TESTVALUE_BCLASS_2, NULLHANDLE);
     190  _tstSetBClassUlongVar2(aObject, ULONG_TESTVALUE_BCLASS_2, NULL);
    184191
    185192  /* AClass */
    186   ulRC=_tstQueryUlongVar1(aObject, NULLHANDLE);
    187   g_message("Calling tstQueryUlongVar1():\t0x%lx\t\t%s", ulRC, (ULONG_TESTVALUE_1!=ulRC ? "FAILED" : "OK"));
    188   g_assert(ULONG_TESTVALUE_1==ulRC);
    189   ulRC=_tstQueryUlongVar2(aObject, NULLHANDLE);
     193  ulRC=_tstQueryUlongVar1(aObject, NULL);
     194  g_message("Calling tstQueryUlongVar1():\t0x%lx\t\t%s", ulRC, (ULONG_TESTVALUE_1!=ulRC ? "FAILED" : "OK"));
     195  g_assert(ULONG_TESTVALUE_1==ulRC);
     196  ulRC=_tstQueryUlongVar2(aObject, NULL);
    190197  g_message("Calling tstQueryUlongVar2():\t0x%lx\t\t%s", ulRC, (ULONG_TESTVALUE_2!=ulRC ? "FAILED" : "OK"));
    191198  g_assert(ULONG_TESTVALUE_2==ulRC);
    192199
    193200  /* BClass*/
    194   ulRC=_tstQueryBClassUlongVar1(aObject, NULLHANDLE);
     201  ulRC=_tstQueryBClassUlongVar1(aObject, NULL);
    195202  g_message("Calling tstQueryBClassUlongVar1():\t0x%lx\t\t%s", ulRC, (ULONG_TESTVALUE_BCLASS_1!=ulRC ? "FAILED" : "OK"));
    196203  g_assert(ULONG_TESTVALUE_BCLASS_1==ulRC);
    197204
    198   ulRC=_tstQueryBClassUlongVar2(aObject, NULLHANDLE);
     205  ulRC=_tstQueryBClassUlongVar2(aObject, NULL);
    199206  g_message("Calling tstQueryBClassUlongVar2():\t0x%lx\t\t%s\n\n", ulRC, (ULONG_TESTVALUE_BCLASS_2!=ulRC ? "FAILED" : "OK"));
    200207  g_assert(ULONG_TESTVALUE_BCLASS_2==ulRC);
     
    209216{
    210217  NOMClassMgr *NOMClassMgrObject;
    211   HREGDLL hReg=NULLHANDLE;
     218  HREGDLL hReg=NULL;
    212219  AClass*  aObject;
    213220  BClass*  bObject;
     
    226233  /* Register DLLs with the garbage collector */
    227234  hReg=nomBeginRegisterDLLWithGC();
    228   if(NULLHANDLE==hReg)
     235  if(NULL==hReg)
    229236    return 1;
    230237
  • trunk/tests/class_c/aclass.c

    r315 r326  
    3636#endif
    3737
    38 #define INCL_DOS
    39 #include <os2.h>
     38#ifdef __OS2__
     39# define INCL_DOS
     40# include <os2.h>
     41#endif /* __OS2__ */
    4042
    4143#include "glib.h"
  • trunk/tests/class_c/bclass.c

    r322 r326  
    1212#endif
    1313
    14 #define INCL_DOS
    15 #include <os2.h>
     14#ifdef __OS2__
     15# define INCL_DOS
     16# include <os2.h>
     17#endif /* __OS2__ */
     18
    1619#include <nom.h>
    1720#include <nomtk.h>
Note: See TracChangeset for help on using the changeset viewer.