X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=src%2Fld65%2Fscanner.c;h=82a04010757c7287dd27884c9c8d0d01aeb984bc;hb=ead7de2b4299f8bb20264b03bbd70ca162d873bf;hp=7b0770016335d41fdc77c3ad0880ed7e07327ff1;hpb=b9970cb7da2f36cb330c9f6b94a71c8faa9bb324;p=cc65 diff --git a/src/ld65/scanner.c b/src/ld65/scanner.c index 7b0770016..82a040107 100644 --- a/src/ld65/scanner.c +++ b/src/ld65/scanner.c @@ -40,6 +40,7 @@ #include /* common */ +#include "chartype.h" #include "xsprintf.h" /* ld65 */ @@ -92,7 +93,7 @@ void CfgWarning (const char* Format, ...) xvsprintf (Buf, sizeof (Buf), Format, ap); va_end (ap); - Warning ("%s(%u): %s", CfgName, CfgErrorLine, Buf); + Warning ("%s(%u): %s", CfgGetName(), CfgErrorLine, Buf); } @@ -107,7 +108,7 @@ void CfgError (const char* Format, ...) xvsprintf (Buf, sizeof (Buf), Format, ap); va_end (ap); - Error ("%s(%u): %s", CfgName, CfgErrorLine, Buf); + Error ("%s(%u): %s", CfgGetName(), CfgErrorLine, Buf); } @@ -125,7 +126,7 @@ static void NextChar (void) /* Read from buffer */ C = (unsigned char)(*CfgBuf); if (C == 0) { - C = EOF; + C = EOF; } else { ++CfgBuf; } @@ -177,11 +178,11 @@ Again: CfgErrorCol = InputCol; /* Identifier? */ - if (C == '_' || isalpha (C)) { + if (C == '_' || IsAlpha (C)) { /* Read the identifier */ I = 0; - while (C == '_' || isalnum (C)) { + while (C == '_' || IsAlNum (C)) { if (I < CFG_MAX_IDENT_LEN) { CfgSVal [I++] = C; } @@ -254,7 +255,7 @@ Again: case ':': NextChar (); CfgTok = CFGTOK_COLON; - break; + break; case '\"': NextChar (); @@ -297,7 +298,7 @@ Again: CfgSVal [0] = '\0'; } CfgTok = CFGTOK_STRCON; - break; + break; case 'S': NextChar (); @@ -426,7 +427,7 @@ void CfgSpecialToken (const IdentTok* Table, unsigned Size, const char* Name) /* Linear search */ for (I = 0; I < Size; ++I) { - if (strcmp (CfgSVal, Table [I].Ident) == 0) { + if (strcmp (CfgSVal, Table [I].Ident) == 0) { CfgTok = Table [I].Tok; return; } @@ -475,7 +476,13 @@ void CfgSetName (const char* Name) const char* CfgGetName (void) /* Get the name of the config file */ { - return CfgName? CfgName : ""; + if (CfgName) { + return CfgName; + } else if (CfgBuf) { + return "[builtin config]"; + } else { + return ""; + } } @@ -535,4 +542,4 @@ void CfgCloseInput (void) - +