1: # include "ctlmod.h"
2: # include "pipes.h"
3: # include <pv.h>
4: # include <sccs.h>
5:
6: SCCSID(@(#)error.c 8.1 12/31/84)
7:
8: /*
9: ** ERROR -- Ingres error message generator
10: **
11: ** Error message `num' is sent up towards the caller with param-
12: ** eters `msg'. This routine may have any number of parameters,
13: ** but the last one must be zero.
14: **
15: ** Parameters:
16: ** num -- the error number.
17: ** msg -- the first in a null-terminated list of
18: ** arguments, all of type char *, which are
19: ** passed as arguments to the error.
20: **
21: ** Returns:
22: ** non-locally
23: **
24: ** Side Effects:
25: ** Many and vast. The message gets passed up the
26: ** stack of activations. The activation stack gets
27: ** popped. Etc.
28: **
29: ** Trace Flags:
30: ** 6.0 - 6.7
31: */
32:
33: /*VARARGS2*/
34: error(num, msg)
35: int num;
36: char *msg;
37: {
38: register char **x;
39: pb_t pb;
40: extern jmp_buf CmReset;
41: typedef int ftype();
42:
43: # ifdef xCTR1
44: if (tTf(6, 0))
45: lprintf("error: %d, Ctx.ctx_cmark %d\n", num, Ctx.ctx_cmark);
46: # endif
47:
48: /* flush the current input pipe */
49: while (!bitset(PB_EOF, Ctx.ctx_ppb->pb_stat))
50: pb_read(Ctx.ctx_ppb);
51:
52: /* free up some stack space (in case called from need) */
53: if (num == -ERR_QBUF)
54: {
55: freebuf(Qbuf, Ctx.ctx_cmark);
56: Ctx.ctx_pmark = Ctx.ctx_cmark;
57: Ctx.ctx_new = TRUE;
58: }
59:
60: /* create an error context & set the message parameters */
61: initp();
62: setp(PV_INT, (char *) num, 0);
63: x = &msg;
64: while (*x != NULL)
65: setp(PV_STR, *x++, 0);
66:
67: /* send it to my caller */
68: pb_prime(&pb, PB_ERR);
69: call_setup(&pb, PB_NONE, (ftype *) NULL);
70:
71: /* send the message to the correct place & unwind the stack */
72: proc_err(&pb, Ctx.ctx_pc, Ctx.ctx_pv);
73: syserr("error: proc_err");
74: }
75: /*
76: ** NFERROR -- non-fatal error.
77: **
78: ** Errors of this type are passed directly to the front end.
79: **
80: ** Parameters:
81: ** (same as error)
82: **
83: ** Returns:
84: ** The error number.
85: **
86: ** Side Effects:
87: ** The message is sent off to the front end. It
88: ** is marked as being informational only.
89: */
90:
91: /*VARARGS2*/
92: nferror(num, msg)
93: int num;
94: char *msg;
95: {
96: register char **p;
97: pb_t pb;
98: typedef int ftype();
99:
100: initp();
101: setp(PV_INT, (char *) num, 0);
102: for (p = &msg; *p != NULL; p++)
103: setp(PV_STR, *p, 0);
104: pb_prime(&pb, PB_ERR);
105: call_setup(&pb, PB_NONE, (ftype *) NULL);
106: pb.pb_stat |= PB_INFO;
107: pb.pb_proc = PB_FRONT;
108: send_off(&pb, Ctx.ctx_pc, Ctx.ctx_pv);
109: pb_flush(&pb);
110: resetp();
111: return (num);
112: }
Defined functions
error
defined in line
6; used 5 times