Changeset 277 for trunk/idl-compiler/c/nom-idl-compiler.c
- Timestamp:
- Mar 27, 2007, 7:58:40 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/idl-compiler/c/nom-idl-compiler.c
r276 r277 55 55 56 56 static gchar* chrOutputDir=""; 57 static gchar* chrOutputName="";58 57 static gboolean fOptionEmitH=FALSE; 59 58 static gboolean fOptionEmitIH=FALSE; … … 67 66 {"emit-ih", 0, 0, G_OPTION_ARG_NONE, &fOptionEmitIH, "Emmit an include header (*.ih)", NULL}, 68 67 {"emit-c", 0, 0, G_OPTION_ARG_NONE, &fOptionEmitC, "Emmit an implementation template (*.c)", NULL}, 69 {"output", 'o', 0, G_OPTION_ARG_FILENAME, &chrOutputName, "Output name. Must not be omitted.", NULL},70 68 {NULL} 71 69 }; … … 480 478 helpCmd[0]=chrExeName; 481 479 482 g_printf("An output filename must always be specified. If the name is an absolute path\n\ 483 it will be used unmodified. Otherwise the output name is built from the given\n\ 484 name and the directory specification.\n\n\ 480 g_printf("The output filename is specified in the IDL file using the 'filestem' keyword.\n\ 485 481 -If no directory is specified the output name is built from the current directory\n\ 486 482 path and the given filename.\n\ … … 533 529 /* Vars for filename building */ 534 530 char* chrOutputFileName=""; 535 char* chrTemp;536 531 537 532 GError *gError = NULL; … … 565 560 } 566 561 567 if(strlen(chrOutputName)==0)568 {569 g_printf("No output file name given.\n\n");570 outputCompilerHelp(gContext, argv[0]);571 }572 562 g_option_context_free(gContext); 573 563 … … 585 575 586 576 587 /*** Create output file name ****/ 588 if(!g_path_is_absolute(chrOutputName)) 589 { 590 if(g_path_is_absolute(chrOutputDir)) 591 chrOutputFileName=g_build_filename(chrOutputDir, chrOutputName, NULL); 592 else 593 { 594 /* Yes this is a memory leak but I don't care */ 595 chrOutputFileName=g_build_filename(g_get_current_dir(), chrOutputDir, chrOutputName, NULL); 596 } 597 } 577 /*** Create output path name ****/ 578 if(g_path_is_absolute(chrOutputDir)) 579 chrOutputFileName=chrOutputDir; 598 580 else 599 chrOutputFileName=chrOutputName; 600 601 /* Add emitter extension */ 602 if(fOptionEmitH) 603 chrTemp=g_strconcat(chrOutputFileName, ".h", NULL); 604 else if(fOptionEmitIH) 605 chrTemp=g_strconcat(chrOutputFileName, ".ih", NULL); 606 else if(fOptionEmitC) 607 chrTemp=g_strconcat(chrOutputFileName, ".c", NULL); 608 g_free(chrOutputFileName); 609 chrOutputFileName=chrTemp; 610 611 g_message("Output file: %s", chrOutputFileName); 581 { 582 /* Yes this is a memory leak but I don't care */ 583 chrOutputFileName=g_build_filename(g_get_current_dir(), chrOutputDir, NULL); 584 } 585 586 g_message("Output path: %s", chrOutputFileName); 587 parseInfo.chrOutfilePath=chrOutputFileName; 612 588 613 589 /* Open input */ … … 622 598 exit(1); 623 599 } 624 625 /* Open output */626 parseInfo.outFile=fopen(chrOutputFileName, "w");627 600 628 601 g_printf("\n"); … … 663 636 664 637 #if 0 665 else if(fOptionEmitIH)666 667 638 else if(fOptionEmitC) 668 639 a++;
Note:
See TracChangeset
for help on using the changeset viewer.