refinements in error reporting

This commit is contained in:
dick 1988-09-30 15:20:24 +00:00
parent 63d95a5f0e
commit 1fb9c249b3
3 changed files with 28 additions and 12 deletions

View file

@ -342,9 +342,11 @@ PRIVATE stat_def(stnr)
dot, funvar(dot), dot->id_name, lib); dot, funvar(dot), dot->id_name, lib);
} }
if (ext) { if (ext) {
report("%L: %s %s also %s at %L", if (!streq(dot->id_file, ext->id_file)) {
dot, funvar(dot), dot->id_name, report("%L: %s %s also %s at %L",
defdec(ext), ext); dot, funvar(dot), dot->id_name,
defdec(ext), ext);
}
} }
sta = dot; sta = dot;
dot = new_inpdef(); dot = new_inpdef();

View file

@ -10,7 +10,7 @@
#include <ctype.h> #include <ctype.h>
#define INP_NPUSHBACK 2 #define INP_NPUSHBACK 1
#include <inp_pkg.spec> #include <inp_pkg.spec>
#include <inp_pkg.body> #include <inp_pkg.body>
@ -79,10 +79,6 @@ get_id(id)
if (!ReadString(id->id_file, '\n', FNAMESIZE)) if (!ReadString(id->id_file, '\n', FNAMESIZE))
return 0; return 0;
{ extern char loptions[];
if (loptions['X'])
print_id("read", id);/*???*/
}
return (1); return (1);
} }
@ -174,7 +170,6 @@ ReadArgs(nrargs, buf)
*/ */
int i; int i;
int charcount = 1; int charcount = 1;
int n;
if (nrargs < 0) { if (nrargs < 0) {
/* variable # of args */ /* variable # of args */
@ -182,6 +177,8 @@ ReadArgs(nrargs, buf)
} }
*buf = '\0'; *buf = '\0';
for (i = 0; i < nrargs; i++) { for (i = 0; i < nrargs; i++) {
int n;
if (!ReadString(buf, ':', ARGTPSSIZE-charcount-1)) if (!ReadString(buf, ':', ARGTPSSIZE-charcount-1))
return 0; return 0;
n = strlen(buf) + 1; n = strlen(buf) + 1;

View file

@ -7,11 +7,15 @@
#include <varargs.h> #include <varargs.h>
#include <system.h> #include <system.h>
#include "private.h"
#include "class.h"
#include "inpdef.h" #include "inpdef.h"
#define MSGOUT STDERR /* filedes on which to write the messages */ #define MSGOUT STDERR /* filedes on which to write the messages */
#define ERROUT STDERR /* filedes on which to write the panics */ #define ERROUT STDERR /* filedes on which to write the panics */
PRIVATE rep_loc();
/* VARARGS */ /* VARARGS */
report(va_alist) report(va_alist)
va_dcl va_dcl
@ -25,7 +29,8 @@ report(va_alist)
register char fc; register char fc;
/* First see if the first arg is an inpdef with /* First see if the first arg is an inpdef with
a global file name; if so, skip this message. a global file name not ending in .c; if so,
skip this message.
*/ */
if (f[0] == '%' && f[1] == 'L') { if (f[0] == '%' && f[1] == 'L') {
/* it is an inpdef */ /* it is an inpdef */
@ -57,8 +62,7 @@ report(va_alist)
register int i; register int i;
case 'L': /* a location item */ case 'L': /* a location item */
id = va_arg(ap, struct inpdef *); id = va_arg(ap, struct inpdef *);
fprint(MSGOUT, "\"%s\", line %d", rep_loc(id);
id->id_file, id->id_line);
break; break;
case 's': /* a string item */ case 's': /* a string item */
s = va_arg(ap, char *); s = va_arg(ap, char *);
@ -82,6 +86,19 @@ report(va_alist)
va_end(ap); va_end(ap);
} }
PRIVATE
rep_loc(id)
struct inpdef *id;
{
if (is_class(id, CL_LIB)) {
fprint(MSGOUT, "library file %s", id->id_file);
}
else {
fprint(MSGOUT, "\"%s\", line %d",
id->id_file, id->id_line);
}
}
/* VARARGS1 */ /* VARARGS1 */
panic(fmt, args) panic(fmt, args)
char *fmt; char *fmt;