]> git.sur5r.net Git - cc65/blobdiff - src/ld65/scanner.c
Ignore module.inc
[cc65] / src / ld65 / scanner.c
index 7b0770016335d41fdc77c3ad0880ed7e07327ff1..82a04010757c7287dd27884c9c8d0d01aeb984bc 100644 (file)
@@ -40,6 +40,7 @@
 #include <ctype.h>
 
 /* 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)
 
 
 
-                         
+