X-Git-Url: http://j8takagi.net/cgi-bin/gitweb.cgi?p=YACASL2.git;a=blobdiff_plain;f=src%2Fassemble.c;h=fc7aed16418af9bbb5c7c45a676e5f3bfc5887ca;hp=67664ef913f4323c7945da2a60f502179555ade1;hb=f9ad3a081e1777bb6d892af65d0e4090cb31bbfa;hpb=85a32cf5cc8e39dc5d4f085179559de71ad87cb8 diff --git a/src/assemble.c b/src/assemble.c index 67664ef..fc7aed1 100644 --- a/src/assemble.c +++ b/src/assemble.c @@ -634,19 +634,20 @@ void addcerrlist_assemble() /** * 指定された名前のファイルをアセンブル - * 2回実行される + * 1回目ではラベルを登録し、2回目ではラベルからアドレスを読み込む + * アセンブル完了時はtrue、エラー発生時はfalseを返す */ -bool assemble(const char *file, PASS pass) +bool assemblefile(const char *file, PASS pass) { int lineno = 0; - bool status = true; - char *line = malloc_chk(LINESIZE + 1, "assemble.line"); + char *line; FILE *fp; if((fp = fopen(file, "r")) == NULL) { perror(file); return false; } + line = malloc_chk(LINESIZE + 1, "assemble.line"); while(fgets(line, LINESIZE, fp)) { lineno++; if((pass == FIRST && asmode.src == true) || @@ -661,11 +662,10 @@ bool assemble(const char *file, PASS pass) if(cerr->num > 0) { fprintf(stderr, "Assemble error - %d: %s\n", cerr->num, cerr->msg); printline(stderr, file, lineno, line); - status = false; } FREE(line); fclose(fp); - return status; + return (cerr->num == 0) ? true : false; } /**