X-Git-Url: http://j8takagi.net/cgi-bin/gitweb.cgi?p=YACASL2.git;a=blobdiff_plain;f=src%2Fcasl2.c;h=fb4290a9e4f33e0f47b0f644c3bb58d6d52023b5;hp=a54adb860a5d67bc3f8100c6c94c1352dfc62203;hb=2f0b91ab1a54973a084e1609b46a1432c8b8e334;hpb=170d5903618ef67fae20a54cac942ca8b8821f10 diff --git a/src/casl2.c b/src/casl2.c index a54adb8..fb4290a 100644 --- a/src/casl2.c +++ b/src/casl2.c @@ -1,6 +1,5 @@ #include "package.h" #include "assemble.h" -#include "exec.h" /** * @brief CASL IIのエラーをエラーリストに追加 @@ -18,16 +17,6 @@ void addcerrlist_casl2(); */ const char *objfile_name(const char *str); -/** - * @brief 指定された1つまたは複数のファイルを2回アセンブル - * - * @return なし - * - * @param filec アセンブルするファイルの数 - * @param filev アセンブルするファイル名の配列 - */ -void assemble(int filec, char *filev[]); - /** * @brief casl2コマンドのオプション */ @@ -69,50 +58,6 @@ const char *objfile_name(const char *str) return (str == NULL) ? default_name : str; } -void assemble(int filec, char *filev[]) -{ - int i; - PASS pass; - WORD bp[filec]; - - create_cmdtype_code(); /* 命令の名前とタイプがキーのハッシュ表を作成 */ - asptr = malloc_chk(sizeof(ASPTR), "asptr"); /* アセンブル時のプロパティ用の領域確保 */ - asptr->prog = malloc_chk(LABELSIZE + 1, "asptr.prog"); - asptr->ptr = 0; - /* アセンブル。ラベル表作成のため、2回行う */ - for(pass = FIRST; pass <= SECOND; pass++) { - for(i = 0; i < filec; i++) { - /* データの格納開始位置 */ - if(pass == FIRST) { - bp[i] = asptr->ptr; - } else if(pass == SECOND) { - asptr->ptr = bp[i]; - } - if(execmode.trace == true || execmode.dump == true || - asmode.src == true || asmode.label == true || asmode.asdetail == true) - { - fprintf(stdout, "\nAssemble %s (%d)\n", filev[i], pass); - } - /* ファイルをアセンブル */ - if(assemblefile(filev[i], pass) == false) { - goto asfin; - } - } - if(pass == FIRST && asmode.label == true) { - fprintf(stdout, "\nLabel::::\n"); - printlabel(); - if(asmode.onlylabel == true) { - break; - } - } - } -asfin: - freelabel(); /* ラベルハッシュ表を解放 */ - free_cmdtype_code(); /* 命令の名前とタイプがキーのハッシュ表を解放 */ - FREE(asptr->prog); /* アセンブル時のプロパティを解放 */ - FREE(asptr); -} - /** * @brief casl2コマンドのメイン * @@ -204,7 +149,7 @@ int main(int argc, char *argv[]) for(i = 0; i < argc - optind; i++) { /* 引数からファイル名配列を取得 */ af[i] = argv[optind + i]; } - assemble(i, af); /* アセンブル */ + assemble(i, af, 0); /* アセンブル */ if(asmode.onlylabel == true || cerr->num > 0) { goto casl2fin; }