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/idl-compiler/h-emitter_c
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • 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);
Note: See TracChangeset for help on using the changeset viewer.