+ 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コマンドのメイン
+ *
+ * @return 正常終了時は0、エラー発生時は1
+ *
+ * @param argc コマンドライン引数の数
+ * @param *argv[] コマンドライン引数の配列
+ */
+int main(int argc, char *argv[])
+{
+ 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";