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);
}
if (ext) {
report("%L: %s %s also %s at %L",
dot, funvar(dot), dot->id_name,
defdec(ext), ext);
if (!streq(dot->id_file, ext->id_file)) {
report("%L: %s %s also %s at %L",
dot, funvar(dot), dot->id_name,
defdec(ext), ext);
}
}
sta = dot;
dot = new_inpdef();

View file

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

View file

@ -7,11 +7,15 @@
#include <varargs.h>
#include <system.h>
#include "private.h"
#include "class.h"
#include "inpdef.h"
#define MSGOUT STDERR /* filedes on which to write the messages */
#define ERROUT STDERR /* filedes on which to write the panics */
PRIVATE rep_loc();
/* VARARGS */
report(va_alist)
va_dcl
@ -25,7 +29,8 @@ report(va_alist)
register char fc;
/* 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') {
/* it is an inpdef */
@ -57,8 +62,7 @@ report(va_alist)
register int i;
case 'L': /* a location item */
id = va_arg(ap, struct inpdef *);
fprint(MSGOUT, "\"%s\", line %d",
id->id_file, id->id_line);
rep_loc(id);
break;
case 's': /* a string item */
s = va_arg(ap, char *);
@ -82,6 +86,19 @@ report(va_alist)
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 */
panic(fmt, args)
char *fmt;