Ignore:
Timestamp:
Mar 24, 2007, 5:18:50 PM (18 years ago)
Author:
cinc
Message:

Bail out on duplicate method definition. MEthod overriding checks for method.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/idl-compiler/c/nom-idl-compiler.c

    r261 r263  
    5353
    5454#include "parser.h"
     55
     56static gchar* chrOutputDir="";
     57static gchar* chrOutputName="";
     58static gboolean fOptionEmitH=FALSE;
     59static gboolean fOptionEmitIH=FALSE;
     60static gboolean fOptionEmitC=FALSE;
     61
     62/* Command line options */
     63static GOptionEntry gOptionEntries[] =
     64{
     65  {"directory", 'd', 0, G_OPTION_ARG_FILENAME, &chrOutputDir, "Output directory", NULL},
     66  {"emit-h", 0, 0, G_OPTION_ARG_NONE, &fOptionEmitH, "Emmit a header file (*.h)", NULL},
     67  {"emit-ih", 0, 0, G_OPTION_ARG_NONE, &fOptionEmitIH, "Emmit an include header (*.ih)", NULL},
     68  {"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", NULL},
     70  {NULL}
     71};
     72
     73static char* chrOutputFileName="";
    5574
    5675/* The pointer array holding the interfaces we found */
     
    125144}
    126145
     146
    127147/**
    128148   This is the root parse function. Here starts the fun...
     
    192212}
    193213
     214/* Show help.
     215   gContext must be valid.
     216*/
     217static void outputCompilerHelp(GOptionContext *gContext, gchar* chrExeName)
     218{
     219  GError *gError = NULL;
     220  int argc2=2;
     221  char *helpCmd[]={"","--help"};
     222  char** argv2=helpCmd;
     223  helpCmd[0]=chrExeName;
     224 
     225  g_option_context_parse (gContext, &argc2, &argv2, &gError);
     226}
    194227
    195228/*
     
    200233  int a;
    201234  int fd;
    202  
    203235  int idScope=0;
     236  GError *gError = NULL;
     237  GOptionContext* gContext;
     238
     239  /* Parse command line options */
     240  gContext = g_option_context_new ("file");
     241  g_option_context_add_main_entries (gContext, gOptionEntries, NULL);
     242
     243  if(!g_option_context_parse (gContext, &argc, &argv, &gError))
     244    {
     245      outputCompilerHelp(gContext, argv[0]);
     246    }
     247
     248  /* Correct emitter options? Exactly one emitter must be specified. */
     249  a=0;
     250  if(fOptionEmitH)
     251    a++;
     252  if(fOptionEmitIH)
     253    a++;
     254  if(fOptionEmitC)
     255    a++;
     256
     257#if 0
     258  if(!a){
     259    g_printf("An emitter must be specified.\n\n");
     260    outputCompilerHelp(gContext, argv[0]);
     261  }
     262  if(a>1){
     263    g_printf("Only one emitter must be specified.\n\n");
     264    outputCompilerHelp(gContext, argv[0]);
     265  }
     266#endif
     267  g_option_context_free(gContext);
     268
    204269
    205270  if(argc<2)
    206     return 1;
     271    {
     272      g_printf("No input file name given.\n\nUse %s --help for options.\n\n", argv[0]);
     273      return 1;
     274    }
    207275
    208276  for(a=0; a<argc; a++)
     
    210278      g_message("arg %d: %s", a, argv[a]);
    211279    }
     280
     281  /* Create output file name */
    212282
    213283  fd=open(argv[1], O_RDONLY);
Note: See TracChangeset for help on using the changeset viewer.