#define _GNU_SOURCE
#include <getopt.h>
+/* comet2コマンドのオプション */
static struct option longopts[] = {
{"trace", no_argument, NULL, 't'},
{"tracearithmetic", no_argument, NULL, 't'},
{0, 0, 0, 0}
};
+/* 実行モード: trace, logical, dump */
EXECMODE execmode = {false, false, false};
/* エラー番号とエラーメッセージ */
};
/* 指定されたファイルからアセンブル結果を読込 */
-bool inassemble(char *file) {
+bool loadassemble(char *file) {
FILE *fp;
- reset();
if((fp = fopen(file, "r")) == NULL) {
perror(file);
return false;
while((opt = getopt_long(argc, argv, "tTdM:C:h", longopts, NULL)) != -1) {
switch(opt) {
case 't':
- (&execmode)->tracemode = true;
+ (&execmode)->trace = true;
break;
case 'T':
- (&execmode)->tracemode = true;
- (&execmode)->logicalmode = true;
+ (&execmode)->trace = true;
+ (&execmode)->logical = true;
break;
case 'd':
- (&execmode)->dumpmode = true;
+ (&execmode)->dump = true;
break;
case 'M':
memsize = atoi(optarg);
exit(-1);
}
}
- if(inassemble(argv[optind]) == true) {
+ reset();
+ if(loadassemble(argv[optind]) == true) {
exec(); /* プログラム実行 */
}
if(cerrno > 0) {