*/
int main(int argc, char *argv[])
{
- int memsize = DEFAULT_MEMSIZE, clocks = DEFAULT_CLOCKS, opt, i, stat;
+ int memsize = DEFAULT_MEMSIZE, clocks = DEFAULT_CLOCKS, opt, i, stat = 0;
char *af[argc], *objfile = NULL;
const char *version = PACKAGE_VERSION, *cmdversion = "casl2 of YACASL2 version %s\n";
const char *usage =
"Usage: %s [-slLaAtTdbvh] [-oO[<OBJECTFILE>]] [-M <MEMORYSIZE>] [-C <CLOCKS>] FILE1[ FILE2 ...]\n";
- cerr_init();
- addcerrlist_casl2();
- addcerrlist_assemble();
- addcerrlist_exec();
/* オプションの処理 */
while((opt = getopt_long(argc, argv, "tTdslLbao::O::AM:C:vh", longopts, NULL)) != -1) {
switch(opt) {
exit(1);
}
}
+
+ /* エラーの定義 */
+ cerr_init();
+ addcerrlist_casl2();
+ addcerrlist_assemble();
+ addcerrlist_exec();
+
/* ソースファイルが指定されていない場合は終了 */
if(argv[optind] == NULL) {
setcerr(126, ""); /* no source file */
fprintf(stderr, "CASL2 error - %d: %s\n", cerr->num, cerr->msg);
+ freecerr(); /* エラーの解放 */
exit(1);
}
reset(memsize, clocks); /* 仮想マシンCOMET IIのリセット */
const char *version = PACKAGE_VERSION, *cmdversion = "comet2 of YACASL2 version %s\n";
const char *usage = "Usage: %s [-btTdvh] [-M <MEMORYSIZE>] [-C <CLOCKS>] FILE\n";
- cerr_init();
- addcerrlist_load();
- addcerrlist_exec();
-
/* オプションの処理 */
while((opt = getopt_long(argc, argv, "tTdM:C:vh", longopts, NULL)) != -1) {
switch(opt) {
exit(1);
}
}
+ /* エラーの定義 */
+ cerr_init();
+ addcerrlist_load();
+ addcerrlist_exec();
+
if(argv[optind] == NULL) {
setcerr(211, ""); /* object file not specified */
fprintf(stderr, "comet2 error - %d: %s\n", cerr->num, cerr->msg);
+ freecerr(); /* エラーの解放 */
exit(1);
}
+
/* COMET II仮想マシンのリセット */
reset(memsize, clocks);
execptr->start = 0;
/* COMET II仮想マシンのシャットダウン */
shutdown();
stat = (cerr->num == 0) ? 0 : 1;
- /* エラーの解放 */
- freecerr();
+ freecerr(); /* エラーの解放 */
return stat;
}
const char *version = PACKAGE_VERSION, *cmdversion = "dumpword of YACASL2 version %s\n";
const char *usage = "Usage: %s [-alh] WORD\n";
- cerr_init();
- addcerrlist_word();
while((opt = getopt_long(argc, argv, "alvh", longopts, NULL)) != -1) {
switch(opt) {
case 'l':
}
}
+ /* エラーの定義 */
+ cerr_init();
+ addcerrlist_word();
+
if(argv[optind] == NULL) {
fprintf(stderr, usage, argv[0]);
+ freecerr();
exit(1);
}
/* WORD値に変換 */
word = nh2word(argv[optind]);
if(cerr->num > 0) {
fprintf(stderr, "Dumpword Error - %d: %s\n", cerr->num, cerr->msg);
+ freecerr();
exit(1);
}
fprintf(stdout, "%6s: ", argv[optind]);
print_dumpword(word, logicalmode);
fprintf(stdout, "\n");
+ freecerr();
return 0;
}