void inner_main( void *closure, int argc, char **argv ) { int token; yyin = fopen(argv[1], "r"); xscheme_init(); semantic_init( 4096 ); yyparse(); }
psim_options(device *root, char **argv) { device *current = root; int argp; if (argv == NULL) return NULL; argp = 0; while (argv[argp] != NULL && argv[argp][0] == '-') { char *p = argv[argp] + 1; char *param; while (*p != '\0') { switch (*p) { default: psim_usage(0); error (""); break; case 'c': param = find_arg("Missing <count> option for -c (max-iterations)\n", &argp, argv); tree_parse(root, "/openprom/options/max-iterations %s", param); break; case 'e': param = find_arg("Missing <emul> option for -e (os-emul)\n", &argp, argv); tree_parse(root, "/openprom/options/os-emul %s", param); break; case 'E': /* endian spec, ignored for now */ param = find_arg("Missing <endian> option for -E (target-endian)\n", &argp, argv); if (strcmp (param, "big") == 0) tree_parse (root, "/options/little-endian? false"); else if (strcmp (param, "little") == 0) tree_parse (root, "/options/little-endian? true"); else { printf_filtered ("Invalid <endian> option for -E (target-endian)\n"); psim_usage (0); } break; case 'f': param = find_arg("Missing <file> option for -f\n", &argp, argv); psim_merge_device_file(root, param); break; case 'h': case '?': psim_usage(1); break; case 'H': psim_usage(2); break; case 'i': if (isdigit(p[1])) { tree_parse(root, "/openprom/trace/print-info %c", p[1]); p++; } else { tree_parse(root, "/openprom/trace/print-info 1"); } break; case 'I': tree_parse(root, "/openprom/trace/print-info 2"); tree_parse(root, "/openprom/options/model-issue %d", MODEL_ISSUE_PROCESS); break; case 'm': param = find_arg("Missing <model> option for -m (model)\n", &argp, argv); tree_parse(root, "/openprom/options/model \"%s", param); break; case 'n': param = find_arg("Missing <nr-smp> option for -n (smp)\n", &argp, argv); tree_parse(root, "/openprom/options/smp %s", param); break; case 'o': param = find_arg("Missing <dev-spec> option for -o\n", &argp, argv); if (memcmp(param, "mpc860c0", 8) == 0) { if (param[8] == '\0') tree_parse(root, "/options/mpc860c0 5"); else if (param[8] == '=' && is_num(param+9, 1, 10, 0)) { tree_parse(root, "/options/mpc860c0 %s", param+9); } else error("Invalid mpc860c0 option for -o\n"); } else current = tree_parse(current, "%s", param); break; case 'r': param = find_arg("Missing <ram-size> option for -r (oea-memory-size)\n", &argp, argv); tree_parse(root, "/openprom/options/oea-memory-size %s", param); break; case 't': param = find_arg("Missing <trace> option for -t (trace/*)\n", &argp, argv); if (param[0] == '!') tree_parse(root, "/openprom/trace/%s 0", param+1); else tree_parse(root, "/openprom/trace/%s 1", param); break; case '-': /* it's a long option of the form --optionname=optionvalue. Such options can be passed through if we are invoked by gdb. */ if (strstr(argv[argp], "architecture") != NULL) { /* we must consume the argument here, so that we get out of the loop. */ p = argv[argp] + strlen(argv[argp]) - 1; printf_filtered("Warning - architecture parameter ignored\n"); } else error("Unrecognized option"); break; } p += 1; } argp += 1; } /* force the trace node to process its options now *before* the tree initialization occures */ device_ioctl(tree_find_device(root, "/openprom/trace"), NULL, 0, device_ioctl_set_trace); { void semantic_init(device* root); semantic_init(root); } /* return where the options end */ return argv + argp; }