|
|
1.1 root 1: # include <ingres.h>
2: # undef MAXNAME
3: # include "../equel/constants.h"
4: # include "IIglobals.h"
5: # include <sccs.h>
6:
7: SCCSID(@(#)IIw_right.c 7.1 2/5/81)
8:
9:
10: /*
11: ** IIw_right -- Write down to the Quel parser a string
12: ** for a target list of anything but a tupret.
13: **
14: ** Parameters:
15: ** string -- a string which contains the target list
16: ** of a quel statement, where values from C variables
17: ** to be plugged in are flagged by the construct
18: ** '%<ingres_type>" a la printf(). String is left
19: ** unchanged.
20: ** To escape the '%' mechanism use '%%'.
21: **
22: ** argv -- a vector of pointers to
23: ** variables from which the values flagged by the '%'
24: ** mechanism are taken.
25: **
26: ** Usage:
27: ** argv [0] = &double_raise;
28: ** IIw_right("dom1 = i.ifield * (1+%f8)", argv);
29: **
30: ** Required By:
31: ** all the parametrized statements except "tupret_p".
32: **
33: ** Error numbers:
34: ** 1004 -- bad type in parametrized statement.
35: */
36:
37:
38:
39: IIw_right(string, argv)
40: char *string;
41: char **argv;
42: {
43: register char *b_st, *e_st;
44: register char **av;
45: int type;
46: char *IIitos();
47:
48: if (IIdebug)
49: printf("ent IIw_right : string \"%s\"\n",
50: string);
51: av = argv;
52: for (b_st = e_st = string; *e_st; )
53: {
54: if (*e_st != '%')
55: {
56: e_st++;
57: continue;
58: }
59:
60: /* provide '%%' escape mechanism */
61: if (e_st [1] == '%')
62: {
63: e_st [1] = '\0';
64: IIwrite(b_st);
65: e_st [1] = '%';
66: b_st = e_st = &e_st [2];
67: continue;
68: }
69: *e_st = '\0';
70: IIwrite(b_st);
71: *e_st++ = '%';
72:
73: switch (*e_st)
74: {
75:
76: case 'f' :
77: switch (*++e_st)
78: {
79:
80: case '8' :
81: IIcvar(*av, 4, 8);
82: break;
83:
84: case '4' :
85: IIcvar(*av, 2, 4);
86: break;
87:
88: default :
89: goto error_label;
90: }
91: av++;
92: break;
93:
94: case 'i' :
95: switch (*++e_st)
96: {
97:
98: case '4' :
99: IIcvar(*av, 2, 4);
100: break;
101:
102: case '2' :
103: IIcvar(*av, 1, 2);
104: break;
105:
106: case '1' :
107: IIcvar(*av, 5, 1);
108:
109: default :
110: goto error_label;
111: }
112: av++;
113: break;
114:
115: case 'c' :
116: IIcvar(*av++, 3, 0);
117: break;
118: }
119: b_st = ++e_st;
120: }
121: IIwrite(b_st);
122: return;
123:
124:
125: error_label :
126: IIerror(1004, 1, &string);
127: IIerrflag = 1004;
128: /* make sure that part already written down will
129: * cause an error, and don't print it.
130: * The old IIprint_err is restored in IIerror()
131: */
132: IIwrite(",");
133: IIo_print = IIprint_err;
134: IIprint_err = IIno_err;
135: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.