+static void parse_options(struct model_params *params, int argc, char **argv)
+{
+ const char *shortopts = "hyYt:o:m:M:s:S:f:e:b:u:v::";
+ const struct option longopts[] = {
+ {"help", no_argument, NULL, 'h'},
+ {"liveness", required_argument, NULL, 'm'},
+ {"maxfv", required_argument, NULL, 'M'},
+ {"maxfvdelay", required_argument, NULL, 's'},
+ {"fvslop", required_argument, NULL, 'S'},
+ {"fairness", required_argument, NULL, 'f'},
+ {"yield", no_argument, NULL, 'y'},
+ {"yieldblock", no_argument, NULL, 'Y'},
+ {"enabled", required_argument, NULL, 'e'},
+ {"bound", required_argument, NULL, 'b'},
+ {"verbose", optional_argument, NULL, 'v'},
+ {"uninitialized", optional_argument, NULL, 'u'},
+ {"analysis", optional_argument, NULL, 't'},
+ {"options", optional_argument, NULL, 'o'},
+ {0, 0, 0, 0} /* Terminator */
+ };
+ int opt, longindex;
+ bool error = false;
+ while (!error && (opt = getopt_long(argc, argv, shortopts, longopts, &longindex)) != -1) {
+ switch (opt) {
+ case 'h':
+ print_usage(argv[0], params);
+ break;
+ case 's':
+ params->maxfuturedelay = atoi(optarg);
+ break;
+ case 'S':
+ params->expireslop = atoi(optarg);
+ break;
+ case 'f':
+ params->fairwindow = atoi(optarg);
+ break;
+ case 'e':
+ params->enabledcount = atoi(optarg);
+ break;
+ case 'b':
+ params->bound = atoi(optarg);
+ break;
+ case 'm':
+ params->maxreads = atoi(optarg);
+ break;
+ case 'M':
+ params->maxfuturevalues = atoi(optarg);
+ break;
+ case 'v':
+ params->verbose = optarg ? atoi(optarg) : 1;
+ break;
+ case 'u':
+ params->uninitvalue = atoi(optarg);
+ break;
+ case 'y':
+ params->yieldon = true;
+ break;
+ case 't':
+ if (install_plugin(optarg))
+ error = true;
+ break;
+ case 'o':
+ {
+ ModelVector<TraceAnalysis *> * analyses = getInstalledTraceAnalysis();
+ if ( analyses->size() == 0 || (*analyses)[analyses->size()-1]->option(optarg))
+ error = true;
+ }
+ break;
+ case 'Y':
+ params->yieldblock = true;
+ break;
+ default: /* '?' */
+ error = true;
+ break;
+ }
+ }