-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy patherror.c
More file actions
42 lines (40 loc) · 984 Bytes
/
Copy patherror.c
File metadata and controls
42 lines (40 loc) · 984 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/*
* module : error.c
* version : 1.4
* date : 01/24/26
*/
#include "globals.h"
/*
* print a runtime error to stderr and abort the execution of current program.
*/
void execerror(pEnv env, char *message, char *op)
{
int leng = 0;
char *ptr, *str;
#ifdef COMPILER
Entry ent;
if (env->compiling > 0) {
leng = lookup(env, op); /* locate in symbol table */
ent = vec_at(env->symtab, leng);
ent.flags |= IS_USED;
vec_at(env->symtab, leng) = ent;
printstack(env);
if (leng < tablesize())
fprintf(env->outfp, "%s_(env);\n", nickname(leng));
else
fprintf(env->outfp, "do_%s(env);\n", op);
return;
}
#endif
if ((ptr = strrchr(op, '/')) != 0)
ptr++;
else
ptr = op;
if ((str = strrchr(ptr, '.')) != 0 && str[1] == 'c')
leng = str - ptr;
else
leng = strlen(ptr);
fflush(stdout);
fprintf(stderr, "run time error: %s needed for %.*s\n", message, leng, ptr);
abortexecution_(ABORT_RETRY);
} /* LCOV_EXCL_LINE */