Changeset 263 for trunk/idl-compiler/c/nom-idl-compiler.c
- Timestamp:
- Mar 24, 2007, 5:18:50 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/idl-compiler/c/nom-idl-compiler.c
r261 r263 53 53 54 54 #include "parser.h" 55 56 static gchar* chrOutputDir=""; 57 static gchar* chrOutputName=""; 58 static gboolean fOptionEmitH=FALSE; 59 static gboolean fOptionEmitIH=FALSE; 60 static gboolean fOptionEmitC=FALSE; 61 62 /* Command line options */ 63 static 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 73 static char* chrOutputFileName=""; 55 74 56 75 /* The pointer array holding the interfaces we found */ … … 125 144 } 126 145 146 127 147 /** 128 148 This is the root parse function. Here starts the fun... … … 192 212 } 193 213 214 /* Show help. 215 gContext must be valid. 216 */ 217 static 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 } 194 227 195 228 /* … … 200 233 int a; 201 234 int fd; 202 203 235 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 204 269 205 270 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 } 207 275 208 276 for(a=0; a<argc; a++) … … 210 278 g_message("arg %d: %s", a, argv[a]); 211 279 } 280 281 /* Create output file name */ 212 282 213 283 fd=open(argv[1], O_RDONLY);
Note:
See TracChangeset
for help on using the changeset viewer.