Ignore:
Timestamp:
Mar 30, 2007, 10:31:24 PM (18 years ago)
Author:
cinc
Message:

A load of fixes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/idl-compiler/ih-emitter_c/ih_file_emitter.c

    r279 r280  
    103103      PMETHODPARAM piv=(PMETHODPARAM)g_ptr_array_index(pArray, a);
    104104     
    105       fprintf(fh, "#define  _%s (nomThis->%s);\n", piv->chrName, piv->chrName);
     105      fprintf(fh, "#define  _%s (nomThis->%s)\n", piv->chrName, piv->chrName);
    106106    }
    107107  fprintf(fh, "\n");
     
    187187      fprintf(fh, "#if !defined(_decl_impl_%s_%s_)\n", pif->chrName, pm->chrName);
    188188      fprintf(fh, "#define _decl_impl_%s_%s_ 1\n", pif->chrName, pm->chrName);
    189       fprintf(fh, "NOM_Scope %s ", pm->mpReturn.chrType);
    190       fprintf(fh, "NOMLINK impl_%s_%s(%s *nomSelf,\n", pif->chrName, pm->chrName, pif->chrName);
     189      fprintf(fh, "NOM_Scope ");
     190      emitReturnType(pLocalPI, pif, pm);
     191      fprintf(fh, " NOMLINK impl_%s_%s(%s *nomSelf,\n", pif->chrName, pm->chrName, pif->chrName);
    191192      /* Do parameters */
    192193      emitMethodParams(pLocalPI, pif, pm->pParamArray);
     
    202203      fprintf(fh, "  \"%s\", /* Return type */\n  {\n", pm->mpReturn.chrType);
    203204      emitMethodParamStrings(pLocalPI, pif, pm->pParamArray);
    204       fprintf(fh, "  }\n}\n");
     205      fprintf(fh, "  }\n};\n");
    205206
    206207      fprintf(fh, "#endif /* _decl_impl_%s_%s_ */\n\n", pif->chrName, pm->chrName);
     
    252253      emitMethodParamsNoTypes(pLocalPI, pif, pm->pParamArray);
    253254      fprintf(fh, " ev) \\\n");
    254       fprintf(fh, "        (((nomTD_%s_%s) \\\n", pif->chrName, pom->chrName);
     255      fprintf(fh, "        (((nomTD_%s_%s) \\\n", pifIntroduced->chrName, pom->chrName);
    255256
    256257      fprintf(fh, "        %s_%s_parent_resolved)((%s*)nomSelf,",
     
    269270
    270271  fprintf(fh, "/* Table of the overriden methods by this class */\n");
    271   fprintf(fh, "static nomOverridenMethodDesc nomOverridenMethodsWPRootFolder[] = {\n");
     272  fprintf(fh, "static nomOverridenMethodDesc nomOverridenMethods%s[] = {\n", pif->chrName);
    272273
    273274  for(a=0;a<pArray->len;a++)
     
    324325  FILE* fh=pLocalPI->outFile;
    325326
    326   fprintf(fh, "/* The meta class for this class */\n");
    327   fprintf(fh, "static char * nomIdStringMetaClass_%s = \"%s\";\n\n", pif->chrName, pif->chrMetaClass);
     327  if(pif->chrMetaClass)
     328    {
     329      fprintf(fh, "/* The meta class for this class */\n");
     330      fprintf(fh, "static char * nomIdStringMetaClass_%s = \"%s\";\n\n", pif->chrName, pif->chrMetaClass);
     331    }
    328332}
    329333
     
    347351  int a;
    348352
    349   fprintf(fh, "/* Array of parent names (chain of parents) */\n");
    350   fprintf(fh, "static char* nomParentClassNames%s[]=\n{\n", pif->chrName);
    351   /* Emit the parents. We have to output them sorted beginning from the
    352      leftmost parent. */
    353   while(pifParent->chrParent && (pifParent=findInterfaceFromName(pifParent->chrParent))!=NULLHANDLE)
    354     {
    355       g_ptr_array_add(pArray, (gpointer) pifParent);
    356     }
    357 
    358   for(a=pArray->len-1; a>=0; a--)
    359     {
    360       pifParent=(PINTERFACE)g_ptr_array_index(pArray, a);
    361       fprintf(fh, "  \"%s\",\n", pifParent->chrName);
    362     }
    363   g_ptr_array_free(pArray, TRUE);
    364   fprintf(fh, "};\n\n");
    365 
    366   fprintf(fh, "static char * nomIdString_Parent_%s = \"%s\";\n\n", pif->chrParent, pif->chrParent);
    367 
    368   fprintf(fh, "/* Array of parent IDs (direct parents, for now NOM only support single inheritance) */\n");
    369   fprintf(fh, "static nomID nomParentClasses%s[]=\n", pif->chrName);
    370   fprintf(fh, "{\n");
    371   fprintf(fh, "  &nomIdString_Parent_%s,\n", pif->chrParent);
    372   fprintf(fh, "};\n\n");
     353  if(pif->chrParent)
     354    {
     355      fprintf(fh, "/* Array of parent names (chain of parents) */\n");
     356      fprintf(fh, "static char* nomParentClassNames%s[]=\n{\n", pif->chrName);
     357      /* Emit the parents. We have to output them sorted beginning from the
     358         leftmost parent. */
     359      while(pifParent->chrParent && (pifParent=findInterfaceFromName(pifParent->chrParent))!=NULLHANDLE)
     360        {
     361          g_ptr_array_add(pArray, (gpointer) pifParent);
     362        }
     363     
     364      for(a=pArray->len-1; a>=0; a--)
     365        {
     366          pifParent=(PINTERFACE)g_ptr_array_index(pArray, a);
     367          fprintf(fh, "  \"%s\",\n", pifParent->chrName);
     368        }
     369      g_ptr_array_free(pArray, TRUE);
     370      fprintf(fh, "};\n\n");
     371     
     372      fprintf(fh, "static char * nomIdString_Parent_%s = \"%s\";\n\n", pif->chrParent, pif->chrParent);
     373     
     374      fprintf(fh, "/* Array of parent IDs (direct parents, for now NOM only support single inheritance) */\n");
     375      fprintf(fh, "static nomID nomParentClasses%s[]=\n", pif->chrName);
     376      fprintf(fh, "{\n");
     377      fprintf(fh, "  &nomIdString_Parent_%s,\n", pif->chrParent);
     378      fprintf(fh, "};\n\n");
     379    }
    373380}
    374381
     
    443450  FILE* fh=pLocalPI->outFile;
    444451
     452  fprintf(fh, "/* Identify this class */\n");
     453  fprintf(fh, "static char * nomIdString_%s = \"%s\";\n\n", pif->chrName, pif->chrName);
     454
    445455  fprintf(fh, "static nomStaticClassInfo %sSCI = {\n", pif->chrName);
    446456  fprintf(fh, "  0,               /* Version */\n");
     
    461471  fprintf(fh, "  (nomStaticMethodDesc*)&nomStaticMethods%s,\n", pif->chrName);
    462472  if(pif->chrParent)
     473    {
    463474    fprintf(fh, "  nomParentClasses%s,\n", pif->chrName);
     475    fprintf(fh, "  nomParentClassNames%s, /* Name of all the parent classes in chain */\n", pif->chrName);
     476    }
    464477  else
    465     fprintf(fh, "  NULL,\n");
    466   fprintf(fh, "  nomParentClassNames%s, /* Name of all the parent classes in chain */\n", pif->chrName);
     478    {
     479      fprintf(fh, "    (void*)NULL,\n");
     480      fprintf(fh, "    (void*)NULL,\n");
     481    }
     482
    467483  fprintf(fh, "  %ld,                /* Number of parents in the chain of classes */\n",
    468484          getNumberOfParentsInChain( pLocalPI,  pif));
     
    521537              pif->chrMetaClass, pif->chrMetaClass, pif->chrMetaClass);
    522538    }
    523   fprintf(fh, "  %sNewClass(%s_MajorVersion, %s_MinorVersion);\n",
    524           pif->chrParent, pif->chrParent, pif->chrParent);
     539  if(pif->chrParent)
     540    {
     541      fprintf(fh, "  /* Create the parent class */\n");
     542      fprintf(fh, "  %sNewClass(%s_MajorVersion, %s_MinorVersion);\n",
     543              pif->chrParent, pif->chrParent, pif->chrParent);
     544    }
    525545  fprintf(fh, "  result = nomBuildClass(1, &%sSCI, ulMajor, ulMinor);\n\n", pif->chrName);
    526546  fprintf(fh, "  return result;\n");
     
    548568          gchar*  chrTemp;
    549569
    550           printInterface(pif);
     570          //printInterface(pif);
    551571         
    552572          chrTemp=g_strconcat(pif->chrFileStem, ".ih", NULL);
Note: See TracChangeset for help on using the changeset viewer.