changed evaluation of LIST operator so that it did a
authorMark Linton <linton@ucbvax.Berkeley.EDU>
Tue, 9 Mar 1982 11:34:23 +0000 (03:34 -0800)
committerMark Linton <linton@ucbvax.Berkeley.EDU>
Tue, 9 Mar 1982 11:34:23 +0000 (03:34 -0800)
"skimsource" of the associated source file before printing the lines

SCCS-vsn: usr.bin/pascal/pdx/tree/eval.c 1.6

usr/src/usr.bin/pascal/pdx/tree/eval.c

index 7dbc357..82bdfed 100644 (file)
@@ -1,6 +1,6 @@
 /* Copyright (c) 1982 Regents of the University of California */
 
 /* Copyright (c) 1982 Regents of the University of California */
 
-static char sccsid[] = "@(#)eval.c 1.5 %G%";
+static char sccsid[] = "@(#)eval.c 1.6 %G%";
 
 /*
  * Parse tree evaluation.
 
 /*
  * Parse tree evaluation.
@@ -273,13 +273,19 @@ register NODE *p;
 
        case O_LIST: {
            SYM *b;
 
        case O_LIST: {
            SYM *b;
+           ADDRESS addr;
 
            if (p->left->op == O_NAME) {
                b = p->left->nameval;
                if (!isblock(b)) {
                    error("\"%s\" is not a procedure or function", name(b));
                }
 
            if (p->left->op == O_NAME) {
                b = p->left->nameval;
                if (!isblock(b)) {
                    error("\"%s\" is not a procedure or function", name(b));
                }
-               r0 = srcline(firstline(b));
+               addr = firstline(b);
+               if (addr == -1) {
+                   error("\"%s\" is empty", name(b));
+               }
+               skimsource(srcfilename(addr));
+               r0 = srcline(addr);
                r1 = r0 + 5;
                if (r1 > lastlinenum) {
                    r1 = lastlinenum;
                r1 = r0 + 5;
                if (r1 > lastlinenum) {
                    r1 = lastlinenum;