5 * comet2monitorコマンドのオプション
7 static struct option longopts[] = {
8 {"memorysize", required_argument, NULL, 'M'},
9 {"clocks", required_argument, NULL, 'C'},
10 {"version", no_argument, NULL, 'v' },
11 {"help", no_argument, NULL, 'h'},
16 * @brief comet2コマンドのメイン
18 * @return 正常終了時は0、異常終了時は1
20 * @param argc コマンドライン引数の数
21 * @param *argv[] コマンドライン引数の配列
23 int main(int argc, char *argv[])
25 int memsize = DEFAULT_MEMSIZE, clocks = DEFAULT_CLOCKS;
27 const char *version = PACKAGE_VERSION, *cmdversion = "comet2monitor: COMET II machine code monitor of YACASL2 version %s\n";
28 const char *usage = "Usage: %s [-vh] [-M <MEMORYSIZE>] [-C <CLOCKS>]\n";
31 while((opt = getopt_long(argc, argv, "M:C:vh", longopts, NULL)) != -1) {
34 memsize = atoi(optarg);
37 clocks = atoi(optarg);
40 fprintf(stdout, cmdversion, version);
43 fprintf(stdout, usage, argv[0]);
46 fprintf(stderr, usage, argv[0]);
55 create_cmdtable(HASH_CMDTYPE);
56 reset(memsize, clocks); /* COMET II仮想マシンのリセット */
58 execmode.monitor = true;
62 free_cmdtable(HASH_CMDTYPE);
63 free_cmdtable(HASH_CODE);
64 stat = (cerr->num == 0) ? 0 : 1;
65 freecerr(); /* エラーの解放 */