int main(int argc, char * const argv[]) { ParserContext context; GC_INIT(); const char *syntax_file = NULL; const char *orig_argv0 = argv[0]; int opt; while ((opt = getopt(argc, argv, "f:")) != -1) { switch (opt) { case 'f': syntax_file = optarg; break; default: /* '?' */ pegvm_usage(orig_argv0); } } if (syntax_file == NULL) { pegvm_usage(orig_argv0); } argc -= optind; argv += optind; if (argc == 0) { pegvm_usage(orig_argv0); } ParserContext_Init(&context); if (ParserContext_LoadSyntax(&context, syntax_file)) { pegvm_error("invalid bytecode"); } if (ParserContext_ParseFiles(&context, argc, (char **)argv)) { pegvm_error(context.last_error); } ParserContext_Dispose(&context); return 0; }
int main(void) { parsercontext p; //size_t size, night, density, touchscreen, keyboard, textinput, navstate, navmethod; // Core-C init phase ParserContext_Init(&p,NULL,NULL,NULL); StdAfx_Init((nodemodule*)&p); //ProjectSettings((nodecontext*)&p); OutputArrayValues(&p, T("size"), Size, sizeof(Size)/sizeof(tchar_t*)); OutputArrayValues(&p, T("night"), Night, sizeof(Night)/sizeof(tchar_t*)); OutputArrayValues(&p, T("density"), Density, sizeof(Density)/sizeof(tchar_t*)); OutputArrayValues(&p, T("touchscreen"), TouchScreen, sizeof(TouchScreen)/sizeof(tchar_t*)); OutputArrayValues(&p, T("keyboard"), Keyboard, sizeof(Keyboard)/sizeof(tchar_t*)); OutputArrayValues(&p, T("textinput"), TextInput, sizeof(TextInput)/sizeof(tchar_t*)); OutputArrayValues(&p, T("navstate"), NavigationState, sizeof(NavigationState)/sizeof(tchar_t*)); OutputArrayValues(&p, T("navmethod"), NavigationMethod, sizeof(NavigationMethod)/sizeof(tchar_t*)); OutputArrayValues(&p, T("aspect"), Aspect, sizeof(Aspect)/sizeof(tchar_t*)); OutputArrayValues(&p, T("orientation"), Orientation, sizeof(Orientation)/sizeof(tchar_t*)); OutputArrayValues(&p, T("uimode"), Mode, sizeof(Mode)/sizeof(tchar_t*)); #if 0 for (size = 0; size < sizeof(Size)/sizeof(tchar_t*); ++size) { for (night = 0; night < sizeof(Night)/sizeof(tchar_t*); ++night) { for (density = 0; density < sizeof(Density)/sizeof(tchar_t*); ++density) { for (touchscreen = 0; touchscreen < sizeof(TouchScreen)/sizeof(tchar_t*); ++touchscreen) { for (keyboard = 0; keyboard < sizeof(Keyboard)/sizeof(tchar_t*); ++keyboard) { for (textinput = 0; textinput < sizeof(TextInput)/sizeof(tchar_t*); ++textinput) { for (navstate = 0; navstate < sizeof(NavigationState)/sizeof(tchar_t*); ++navstate) { for (navmethod = 0; navmethod < sizeof(NavigationMethod)/sizeof(tchar_t*); ++navmethod) { OutputValues(&p, size, night, density, touchscreen, keyboard, textinput, navstate, navmethod); } } } } } } } } #endif // Core-C ending StdAfx_Done((nodemodule*)&p); ParserContext_Done(&p); return 0; }