Fixed problems that occured on input files with missing LF at end of file.

git-svn-id: svn://svn.cc65.org/cc65/trunk@1903 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz
2003-01-19 12:04:33 +00:00
parent 22b4faabb2
commit b6c4ff2e01
7 changed files with 40 additions and 29 deletions

View File

@@ -6,7 +6,7 @@
/* */
/* */
/* */
/* (C) 1998-2000 Ullrich von Bassewitz */
/* (C) 1998-2003 Ullrich von Bassewitz */
/* Wacholderweg 14 */
/* D-70597 Stuttgart */
/* EMail: uz@musoftware.de */
@@ -382,7 +382,7 @@ void MacDef (unsigned Style)
}
} else {
/* Accept a newline or end of file for new style macros */
if (Tok == TOK_SEP || Tok == TOK_EOF) {
if (TokIsSep (Tok)) {
break;
}
}
@@ -548,7 +548,7 @@ static int MacExpand (void* Data)
* generated by a user.
*/
unsigned PrefixLen = (I->Id[0] == LocalStart);
sprintf (SVal, "%.*sLOCAL-MACRO-SYMBOL-%04X", PrefixLen,
sprintf (SVal, "%.*sLOCAL-MACRO-SYMBOL-%04X", PrefixLen,
I->Id, Mac->LocalStart + Index);
break;
}
@@ -604,7 +604,7 @@ static void StartExpClassic (Macro* M)
E = NewMacExp (M);
/* Read the actual parameters */
while (Tok != TOK_SEP && Tok != TOK_EOF) {
while (!TokIsSep (Tok)) {
TokNode* Last;
@@ -617,7 +617,7 @@ static void StartExpClassic (Macro* M)
/* Read tokens for one parameter, accept empty params */
Last = 0;
while (Tok != TOK_COMMA && Tok != TOK_SEP) {
while (!TokIsSep (Tok)) {
TokNode* T;
@@ -679,7 +679,7 @@ static void StartExpDefine (Macro* M)
TokNode* Last;
/* Check if there is really a parameter */
if (Tok == TOK_SEP || Tok == TOK_EOF || Tok == TOK_COMMA) {
if (TokIsSep (Tok) || Tok == TOK_COMMA) {
Error (ERR_MACRO_PARAM_EXPECTED);
SkipUntilSep ();
return;
@@ -696,16 +696,16 @@ static void StartExpDefine (Macro* M)
/* Insert it into the list */
if (Last == 0) {
E->Params [E->ParamCount] = T;
E->Params [E->ParamCount] = T;
} else {
Last->Next = T;
Last->Next = T;
}
Last = T;
/* And skip it... */
NextTok ();
} while (Tok != TOK_COMMA && Tok != TOK_SEP && Tok != TOK_EOF);
} while (Tok != TOK_COMMA && !TokIsSep (Tok));
/* One parameter more */
++E->ParamCount;