Changeset 290 for trunk/idl-compiler
- Timestamp:
- Apr 1, 2007, 3:50:13 PM (18 years ago)
- Location:
- trunk/idl-compiler
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/idl-compiler/c/emitter.c
r285 r290 66 66 else if(!strcmp(pm->chrType, "unsigned long")) 67 67 chrType="CORBA_unsigned_long"; 68 else if(!strcmp(pm->chrType, "boolean")) 69 chrType="CORBA_boolean"; 68 70 69 71 switch(pm->uiDirection) -
trunk/idl-compiler/h-emitter_c/h_file_emitter.c
r289 r290 302 302 PMETHOD pm=(PMETHOD)g_ptr_array_index(pArray, a); 303 303 304 fprintf(fh, "#define %s_%s \\\n", pif->chrName, pm->chrName); 305 fprintf(fh, " %s_%s \n", pifParent->chrName, pm->chrName); 304 fprintf(fh, "#define %s_%s(nomSelf, ", pif->chrName, pm->chrName); 305 /* Do parameters */ 306 emitMethodParamsNoTypes(pLocalPI, pif, pm->pParamArray); 307 fprintf(fh, " ev) \\\n"); 308 fprintf(fh, " %s_%s((%s*) nomSelf, ", pifParent->chrName, pm->chrName, pifParent->chrName); 309 /* Do parameters */ 310 emitMethodParamsNoTypes(pLocalPI, pif, pm->pParamArray); 311 fprintf(fh, " ev)\n"); 306 312 } 307 313 } -
trunk/idl-compiler/ih-emitter_c/ih_file_emitter.c
r280 r290 237 237 } 238 238 239 fprintf(fh, "NOM_Scope %s", pm->mpReturn.chrType); 240 for(b=0;b<pm->mpReturn.uiStar;b++) 241 fprintf(fh, "*"); 242 239 fprintf(fh, "NOM_Scope "); 240 emitReturnType(pLocalPI, pif, pm); 243 241 fprintf(fh, " NOMLINK impl_%s_%s(%s* nomSelf,\n", pif->chrName, pom->chrName, pif->chrName); 244 242 /* Do parameters */ … … 331 329 } 332 330 } 333 334 static void emitClassId(PPARSEINFO pLocalPI, PINTERFACE pif)335 {336 FILE* fh=pLocalPI->outFile;337 338 if(pif->chrMetaClass)339 {340 fprintf(fh, "/* Identify this class */\n");341 fprintf(fh, "static char * nomIdString_%s = \"%s\";\n\n", pif->chrName, pif->chrName);342 }343 }344 345 331 346 332 static void emitParentClasses(PPARSEINFO pLocalPI, PINTERFACE pif) … … 432 418 else if(!strcmp(piv->chrType, "gdouble")) 433 419 ulRet+=sizeof(gdouble); 420 else if(!strcmp(piv->chrType, "string")) 421 ulRet+=sizeof(gpointer); 434 422 else 435 423 /* Check if it's an interface */ … … 566 554 if(!strcmp(pif->chrSourceFileName, pLocalPI->chrRootSourceFile)) 567 555 { 568 gchar* chrTemp; 569 570 //printInterface(pif); 571 572 chrTemp=g_strconcat(pif->chrFileStem, ".ih", NULL); 573 if((pLocalPI->outFile=openOutfile(gScanner, chrTemp))!=NULLHANDLE) 556 /* Only interfaces which are fully defined. No forwarder */ 557 if(!pif->fIsForwardDeclaration) 574 558 { 575 emitIHFileHeader(pLocalPI, pif); 576 emitInstanceVariables(pLocalPI, pif); 577 emitGetDataMacros(pLocalPI, pif); 578 emitIHClassDataStructs(pLocalPI, pif); 579 emitNewMethods(pLocalPI, pif); 580 emitOverridenMethods(pLocalPI, pif); 581 emitOverridenMethodTable(pLocalPI, pif); 582 emitStaticMethodTable(pLocalPI, pif); 583 emitMetaClass(pLocalPI, pif); 584 emitClassId(pLocalPI, pif); 585 emitParentClasses(pLocalPI, pif); 586 emitStaticClassInfo(pLocalPI, pif); 587 emitClassCreationFunc(pLocalPI, pif); 588 589 emitIHFileFooter(pLocalPI, pif); 590 } 591 g_free(chrTemp); 592 } 593 } 594 } 595 596 559 gchar* chrTemp; 560 561 //printInterface(pif); 562 chrTemp=g_strconcat(pif->chrFileStem, ".ih", NULL); 563 if((pLocalPI->outFile=openOutfile(gScanner, chrTemp))!=NULLHANDLE) 564 { 565 emitIHFileHeader(pLocalPI, pif); 566 emitInstanceVariables(pLocalPI, pif); 567 emitGetDataMacros(pLocalPI, pif); 568 emitIHClassDataStructs(pLocalPI, pif); 569 emitNewMethods(pLocalPI, pif); 570 emitOverridenMethods(pLocalPI, pif); 571 emitOverridenMethodTable(pLocalPI, pif); 572 emitStaticMethodTable(pLocalPI, pif); 573 emitMetaClass(pLocalPI, pif); 574 emitParentClasses(pLocalPI, pif); 575 emitStaticClassInfo(pLocalPI, pif); 576 emitClassCreationFunc(pLocalPI, pif); 577 578 emitIHFileFooter(pLocalPI, pif); 579 } 580 g_free(chrTemp); 581 }/* fIsForwardDeclaration */ 582 } 583 } 584 } 585 586 -
trunk/idl-compiler/parser_c/interface_parser.c
r289 r290 47 47 PSYMBOL pNewSymbol=g_malloc0(sizeof(SYMBOL)); 48 48 49 // 49 //g_message("In %s for %s", __FUNCTION__, pParseInfo->pCurInterface->chrName); 50 50 51 51 pParseInfo->pCurInterface->pSymbolIFace=pNewSymbol; … … 81 81 static void deRegisterInterface(PINTERFACE pif) 82 82 { 83 // 83 //g_message("In %s", __FUNCTION__); 84 84 85 85 /* Remove the interface from our list */ … … 193 193 static void parseIFace(GTokenType token) 194 194 { 195 195 196 if(matchNext(G_TOKEN_IDENTIFIER)) 196 197 { … … 200 201 } 201 202 else 202 if(matchNext(G_TOKEN_SYMBOL)) 203 { 204 /* If the interface name is a symbol, it means the interface was 205 already registered before. Maybe because of a forward statement. 206 We will check that in the function which called us. */ 207 208 /* Check if it's one of our interface symbols */ 209 PSYMBOL pCurSymbol; 210 GTokenValue value; 211 212 value=gScanner->value; 213 pCurSymbol=value.v_symbol; 214 if(IDL_SYMBOL_REGINTERFACE!=pCurSymbol->uiSymbolToken) 215 { 216 //g_message("%s %d", pCurSymbol->chrSymbolName, pCurSymbol->uiKind); 217 g_scanner_unexp_token(gScanner, 218 G_TOKEN_SYMBOL, 219 NULL, 220 NULL, 221 NULL, 222 "Keyword 'interface' is not followed by a valid identifier.", 223 TRUE); /* is_error */ 224 exit(1); 225 } 226 227 /* Save interface info */ 228 pParseInfo->pCurInterface->chrName=g_strdup(value.v_identifier); 203 { 204 if(matchNext(G_TOKEN_SYMBOL)) 205 { 206 /* If the interface name is a symbol, it means the interface was 207 already registered before. Maybe because of a forward statement. 208 We will check that in the function which called us. */ 209 210 /* Check if it's one of our interface symbols */ 211 PSYMBOL pCurSymbol; 212 GTokenValue value; 213 214 value=gScanner->value; 215 pCurSymbol=value.v_symbol; 216 if(IDL_SYMBOL_REGINTERFACE!=pCurSymbol->uiSymbolToken) 217 { 218 //g_message("%s %d", pCurSymbol->chrSymbolName, pCurSymbol->uiKind); 219 g_scanner_unexp_token(gScanner, 220 G_TOKEN_SYMBOL, 221 NULL, 222 NULL, 223 NULL, 224 "Keyword 'interface' is not followed by a valid identifier.", 225 TRUE); /* is_error */ 226 exit(1); 227 } 228 /* Save interface info */ 229 pParseInfo->pCurInterface->chrName=g_strdup(pCurSymbol->chrSymbolName); 230 } 231 else{ 232 g_scanner_unexp_token(gScanner, 233 G_TOKEN_IDENTIFIER, 234 NULL, 235 NULL, 236 NULL, 237 "Keyword 'interface' must be followed by an identifier", 238 TRUE); /* is_error */ 239 exit(1); 229 240 } 230 else{231 g_scanner_unexp_token(gScanner,232 G_TOKEN_IDENTIFIER,233 NULL,234 NULL,235 NULL,236 "Keyword 'interface' must be followed by an identifier",237 TRUE); /* is_error */238 exit(1);239 241 } 240 242 } … … 378 380 { 379 381 PINTERFACE pif; 382 gchar *chrTemp=pParseInfo->pCurInterface->chrName; 380 383 381 384 /* Check if we already have a (maybe forward) declaration */ … … 401 404 } 402 405 } 406 pParseInfo->pCurInterface->chrName=chrTemp; 403 407 pParseInfo->pCurInterface->chrSourceFileName=g_strdup(pParseInfo->chrCurrentSourceFile); 404 408 /* It's save to register the interface right here even if the struct is almost empty.
Note:
See TracChangeset
for help on using the changeset viewer.