]> Shamusworld >> Repos - rmac/blobdiff - token.c
Removed naked 'abs' (sans leading dot) from mntab.
[rmac] / token.c
diff --git a/token.c b/token.c
index 84faa8f157bc5a9157f60e25e88dbda49e4df0f3..66399d6c5078e49be637ce3cdc86b4eb4a868526 100644 (file)
--- a/token.c
+++ b/token.c
@@ -679,8 +679,8 @@ int include(int handle, char * fname)
        INOBJ * inobj;
        FILEREC * fr;
 
-       // Verbose mode
-       if (verb_flag)
+       // Debug mode
+       if (debug)
                printf("[include: %s, cfileno=%u]\n", fname, cfileno);
 
        // Alloc and initialize include-descriptors
@@ -742,21 +742,21 @@ int fpop(void)
                switch (inobj->in_type)
                {
                case SRC_IFILE:                                         // Pop and release an IFILE
-                       if (verb_flag)
+                       if (debug)
                                printf("[Leaving: %s]\n", curfname);
 
                        ifile = inobj->inobj.ifile;
                        ifile->if_link = f_ifile;
                        f_ifile = ifile;
                        close(ifile->ifhandle);                 // Close source file
-if (verb_flag) printf("[fpop (pre):  curfname=%s]\n", curfname);
+if (debug)     printf("[fpop (pre):  curfname=%s]\n", curfname);
                        curfname = ifile->ifoldfname;   // Set current filename
-if (verb_flag) printf("[fpop (post): curfname=%s]\n", curfname);
-if (verb_flag) printf("[fpop: (pre)  cfileno=%d ifile->ifno=%d]\n", (int)cfileno, (int)ifile->ifno);
+if (debug)     printf("[fpop (post): curfname=%s]\n", curfname);
+if (debug)     printf("[fpop: (pre)  cfileno=%d ifile->ifno=%d]\n", (int)cfileno, (int)ifile->ifno);
                        curlineno = ifile->ifoldlineno; // Set current line# 
                        DEBUG printf("cfileno=%d ifile->ifno=%d\n", (int)cfileno, (int)ifile->ifno);
                        cfileno = ifile->ifno;                  // Restore current file number
-if (verb_flag) printf("[fpop: (post) cfileno=%d ifile->ifno=%d]\n", (int)cfileno, (int)ifile->ifno);
+if (debug)     printf("[fpop: (post) cfileno=%d ifile->ifno=%d]\n", (int)cfileno, (int)ifile->ifno);
                        break;
                case SRC_IMACRO:                                        // Pop and release an IMACRO
                        imacro = inobj->inobj.imacro;
@@ -911,9 +911,14 @@ retry:
        case SRC_IFILE:
                if ((ln = GetNextLine()) == NULL)
                {
-if (verb_flag) printf("TokenizeLine: Calling fpop() from SRC_IFILE...\n");
-                       fpop();                                                 // Pop input level
-                       goto retry;                                             // Try for more lines 
+if (debug) printf("TokenizeLine: Calling fpop() from SRC_IFILE...\n");
+                       if (fpop()==0)                                  // Pop input level
+                               goto retry;                                     // Try for more lines 
+                       else
+                       {
+                               ifent->if_prev = (IFENT *) - 1; //Signal Assemble() that we have reached EOF with unbalanced if/endifs
+                               return TKEOF;
+                       }
                }
 
                curlineno++;                                            // Bump line number
@@ -960,7 +965,7 @@ if (verb_flag) printf("TokenizeLine: Calling fpop() from SRC_IFILE...\n");
        case SRC_IREPT:
                if ((ln = GetNextRepeatLine()) == NULL)
                {
-if (verb_flag) printf("TokenizeLine: Calling fpop() from SRC_IREPT...\n");
+if (debug) printf("TokenizeLine: Calling fpop() from SRC_IREPT...\n");
                        fpop();
                        goto retry;
                }