Changeset 280 for trunk/idl-compiler/ih-emitter_c
- Timestamp:
- Mar 30, 2007, 10:31:24 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/idl-compiler/ih-emitter_c/ih_file_emitter.c
r279 r280 103 103 PMETHODPARAM piv=(PMETHODPARAM)g_ptr_array_index(pArray, a); 104 104 105 fprintf(fh, "#define _%s (nomThis->%s) ;\n", piv->chrName, piv->chrName);105 fprintf(fh, "#define _%s (nomThis->%s)\n", piv->chrName, piv->chrName); 106 106 } 107 107 fprintf(fh, "\n"); … … 187 187 fprintf(fh, "#if !defined(_decl_impl_%s_%s_)\n", pif->chrName, pm->chrName); 188 188 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); 191 192 /* Do parameters */ 192 193 emitMethodParams(pLocalPI, pif, pm->pParamArray); … … 202 203 fprintf(fh, " \"%s\", /* Return type */\n {\n", pm->mpReturn.chrType); 203 204 emitMethodParamStrings(pLocalPI, pif, pm->pParamArray); 204 fprintf(fh, " }\n} \n");205 fprintf(fh, " }\n};\n"); 205 206 206 207 fprintf(fh, "#endif /* _decl_impl_%s_%s_ */\n\n", pif->chrName, pm->chrName); … … 252 253 emitMethodParamsNoTypes(pLocalPI, pif, pm->pParamArray); 253 254 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); 255 256 256 257 fprintf(fh, " %s_%s_parent_resolved)((%s*)nomSelf,", … … 269 270 270 271 fprintf(fh, "/* Table of the overriden methods by this class */\n"); 271 fprintf(fh, "static nomOverridenMethodDesc nomOverridenMethods WPRootFolder[] = {\n");272 fprintf(fh, "static nomOverridenMethodDesc nomOverridenMethods%s[] = {\n", pif->chrName); 272 273 273 274 for(a=0;a<pArray->len;a++) … … 324 325 FILE* fh=pLocalPI->outFile; 325 326 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 } 328 332 } 329 333 … … 347 351 int a; 348 352 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 } 373 380 } 374 381 … … 443 450 FILE* fh=pLocalPI->outFile; 444 451 452 fprintf(fh, "/* Identify this class */\n"); 453 fprintf(fh, "static char * nomIdString_%s = \"%s\";\n\n", pif->chrName, pif->chrName); 454 445 455 fprintf(fh, "static nomStaticClassInfo %sSCI = {\n", pif->chrName); 446 456 fprintf(fh, " 0, /* Version */\n"); … … 461 471 fprintf(fh, " (nomStaticMethodDesc*)&nomStaticMethods%s,\n", pif->chrName); 462 472 if(pif->chrParent) 473 { 463 474 fprintf(fh, " nomParentClasses%s,\n", pif->chrName); 475 fprintf(fh, " nomParentClassNames%s, /* Name of all the parent classes in chain */\n", pif->chrName); 476 } 464 477 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 467 483 fprintf(fh, " %ld, /* Number of parents in the chain of classes */\n", 468 484 getNumberOfParentsInChain( pLocalPI, pif)); … … 521 537 pif->chrMetaClass, pif->chrMetaClass, pif->chrMetaClass); 522 538 } 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 } 525 545 fprintf(fh, " result = nomBuildClass(1, &%sSCI, ulMajor, ulMinor);\n\n", pif->chrName); 526 546 fprintf(fh, " return result;\n"); … … 548 568 gchar* chrTemp; 549 569 550 printInterface(pif);570 //printInterface(pif); 551 571 552 572 chrTemp=g_strconcat(pif->chrFileStem, ".ih", NULL);
Note:
See TracChangeset
for help on using the changeset viewer.