projects
/
YACASL2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
入出力時のエラー条件を変更
[YACASL2.git]
/
src
/
assemble.c
diff --git
a/src/assemble.c
b/src/assemble.c
index
929288e
..
fc7aed1
100644
(file)
--- a/
src/assemble.c
+++ b/
src/assemble.c
@@
-634,9
+634,10
@@
void addcerrlist_assemble()
/**
* 指定された名前のファイルをアセンブル
/**
* 指定された名前のファイルをアセンブル
- * 2回実行される
+ * 1回目ではラベルを登録し、2回目ではラベルからアドレスを読み込む
+ * アセンブル完了時はtrue、エラー発生時はfalseを返す
*/
*/
-
void assemb
le(const char *file, PASS pass)
+
bool assemblefi
le(const char *file, PASS pass)
{
int lineno = 0;
char *line;
{
int lineno = 0;
char *line;
@@
-644,7
+645,7
@@
void assemble(const char *file, PASS pass)
if((fp = fopen(file, "r")) == NULL) {
perror(file);
if((fp = fopen(file, "r")) == NULL) {
perror(file);
-
exit(-1)
;
+
return false
;
}
line = malloc_chk(LINESIZE + 1, "assemble.line");
while(fgets(line, LINESIZE, fp)) {
}
line = malloc_chk(LINESIZE + 1, "assemble.line");
while(fgets(line, LINESIZE, fp)) {
@@
-664,6
+665,7
@@
void assemble(const char *file, PASS pass)
}
FREE(line);
fclose(fp);
}
FREE(line);
fclose(fp);
+ return (cerr->num == 0) ? true : false;
}
/**
}
/**