10 /* Call (non)standard procedures.
11 * Almost totaly implementation dependent.
14 /** TRUE if graphics mode active */
15 bool graphmode = FALSE;
27 bzero(&msg,sizeof(G_MESSAGE));
28 while ((msg.msg_type != MSG_GRAPH) &&
29 (msg.param.pword[0] != GRAPH_INKEY_RESPONSE)) {
30 read_from_graph(&msg);
32 return(msg.param.pword[3]);
36 * Call (non)standard procedure
38 void nonstandard(word nrproc)
43 word ax, bx, cx, dx, i, t1, t2;
44 unsigned int v, p, h, l, r, c, sc;
45 unsigned int Res_graph_X,Res_graph_Y;
49 switch ((int) nrproc) {
54 case CLS: msg.msg_type = MSG_GRAPH;
55 msg.param.pword[0] = GRAPH_CLEAR;
56 msg.param.pword[1] = GraphRes;
61 msg.msg_type = MSG_GRAPH;
62 msg.param.pword[0] = GRAPH_POINT;
63 msg.param.pword[1] = GraphRes;
64 msg.param.pword[3] = param[0].xword;
65 msg.param.pword[4] = param[1].xword;
70 msg.msg_type = MSG_GRAPH;
71 msg.param.pword[0] = GRAPH_MOVE;
72 msg.param.pword[1] = GraphRes;
73 msg.param.pword[2] = param[0].xword;
74 msg.param.pword[3] = param[1].xword;
79 msg.msg_type = MSG_GRAPH;
80 msg.param.pword[0] = GRAPH_LINETO;
81 msg.param.pword[1] = GraphRes;
82 msg.param.pword[3] = param[0].xword;
83 msg.param.pword[4] = param[1].xword;
88 msg.msg_type = MSG_GRAPH;
89 msg.param.pword[0] = GRAPH_CURPOS;
90 msg.param.pword[1] = GraphRes;
92 while ((msg.msg_type != MSG_GRAPH) &&
93 (msg.param.pword[0] != GRAPH_CURPOS_RESPONSE))
94 read_from_graph(&msg);
96 param[0].xword = msg.param.pword[3];
100 msg.msg_type = MSG_GRAPH;
101 msg.param.pword[0] = GRAPH_CURPOS;
102 msg.param.pword[1] = GraphRes;
104 while ((msg.msg_type != MSG_GRAPH) ||
105 (msg.param.pword[0] != GRAPH_CURPOS_RESPONSE))
106 read_from_graph(&msg);
108 param[0].xword = msg.param.pword[4];
117 msg.msg_type = MSG_GRAPH;
118 msg.param.pword[0] = GRAPH_HASCII;
119 msg.param.pword[1] = param[0].xword;
124 msg.msg_type = MSG_GRAPH;
125 msg.param.pword[0] = GRAPH_FOREGROUND;
126 msg.param.pword[1] = GraphRes;
127 msg.param.pword[3] = param[0].xword;
132 msg.msg_type = MSG_GRAPH;
133 msg.param.pword[0] = GRAPH_BACKGROUND;
134 msg.param.pword[1] = GraphRes;
135 msg.param.pword[3] = param[0].xword;
146 msg.msg_type = MSG_GRAPH;
147 msg.param.pword[0] = GRAPH_OUTSTRING;
148 msg.param.pword[1] = GraphRes;
149 msg.param.pword[2] = param[0].xword;
150 msg.param.pword[3] = param[1].xword;
151 msg.param.pword[4] = param[3].xword;
152 msg.param.pword[5] = param[4].xword;
154 s= (char *)(M + strings + param[ 2 ].xword + 1);
155 strcpy(msg.param.pstr,s);
161 msg.msg_type = MSG_GRAPH;
162 msg.param.pword[0] = GRAPH_GETMAP;
163 msg.param.pword[1] = GraphRes;
164 msg.param.pword[2] = param[0].xword;
165 msg.param.pword[3] = param[1].xword;
167 while ((msg.msg_type != MSG_GRAPH) ||
168 (msg.param.pword[0] != GRAPH_GETMAP_RESPONSE))
169 read_from_graph(&msg);
173 map = msg.param.pword[2];
174 newarry((word) 1, 3, (word)AINT, ¶m[2].xvirt, &am);
176 M[am + 4] = msg.param.pword[3];
177 M[am + 5] = msg.param.pword[4];
182 if (member(¶m[0].xvirt, &am)) {
183 msg.msg_type = MSG_GRAPH;
184 msg.param.pword[0] = GRAPH_PUTMAP;
185 msg.param.pword[1] = GraphRes;
186 msg.param.pword[2] = M[am + 3];
187 msg.param.pword[4] = M[am + 4];
188 msg.param.pword[5] = M[am + 5];
198 msg.msg_type = MSG_GRAPH;
199 msg.param.pword[0] = GRAPH_RECT;
200 msg.param.pword[1] = GraphRes;
201 msg.param.pword[3] = param[0].xword;
202 msg.param.pword[4] = param[1].xword;
203 msg.param.pword[5] = param[2].xword;
204 msg.param.pword[6] = param[3].xword;
205 msg.param.pword[7] = param[4].xword;
206 msg.param.pword[8] = param[5].xword;
213 msg.msg_type = MSG_GRAPH;
214 msg.param.pword[0] = GRAPH_WRITEINTXY;
215 msg.param.pword[1] = GraphRes;
216 msg.param.pword[2] = param[0].xword;
217 msg.param.pword[3] = param[1].xword;
218 msg.param.pword[4] = param[4].xword;
219 msg.param.pword[5] = param[2].xword;
224 msg.msg_type = MSG_GRAPH;
225 msg.param.pword[0] = GRAPH_INKEY;
226 msg.param.pword[1] = GraphRes;
228 param[0].xword = wait_for_key();
232 msg.msg_type = MSG_GRAPH;
233 msg.param.pword[0] = GRAPH_ELLIPSE;
234 msg.param.pword[1] = GraphRes;
235 msg.param.pword[3] = param[0].xword;
236 msg.param.pword[4] = param[1].xword;
237 msg.param.pword[5] = param[2].xword;
238 msg.param.pword[6] = param[3].xword;
239 msg.param.pword[7] = (double)param[4].xword;
240 msg.param.pword[8] = (double)param[5].xword;
241 msg.param.pword[9] = param[7].xword;
245 /* ___________ magic library ____________ */
247 if (param[0].xword == 1000) {
250 else if (param[0].xword == 1001) {
251 sprintf(ss, "%s%c", ss, (char)(param[1].xword));
253 else if (param[0].xword == 303) {
254 msg.msg_type = MSG_GRAPH;
255 msg.param.pword[0] = GRAPH_MAGIC;
256 msg.param.pword[1] = param[0].xword; /* Lookout! */
257 msg.param.pword[2] = param[1].xword;
258 msg.param.pword[3] = param[2].xword;
259 msg.param.pword[4] = param[3].xword;
260 msg.param.pword[5] = param[5].xword;
262 strcpy(msg.param.pstr, ss);
265 else if (param[0].xword > 500) {
266 msg1.param.pword[1] = param[0].xword;
267 msg1.param.pword[2] = param[1].xword;
268 msg1.param.pword[3] = param[2].xword;
269 msg1.param.pword[4] = param[3].xword;
270 msg1.param.pword[5] = param[5].xword;
271 msg1.param.pword[6] = param[6].xword;
272 msg1.param.pword[7] = param[7].xword;
273 s = (char *)(M + strings + param[4].xword + 1);
274 strcpy(msg1.param.pstr, s);
277 switch(msg1.param.pword[1]) {
280 newarry((word)0, 2, (word)AINT, ¶m[8].xvirt,
283 M[ax++] = my_ctx.node;
285 /* number of nodes */
287 msg1.msg_type = MSG_NET;
288 msg1.param.pword[0] = NET_NODES_NUM;
289 write(net_sock,&msg1,sizeof(MESSAGE));
290 while ((msg1.msg_type != MSG_NET) ||
291 (msg1.param.pword[0] != NET_NODES_NUM_RESPONSE))
292 read_from_net(&msg1);
294 newarry((word)0, 2, (word)AINT, ¶m[8].xvirt, &ax);
296 M[ax++] = msg1.param.pword[1];
300 msg1.msg_type = MSG_NET;
301 msg1.param.pword[0] = NET_NODE_EXIST;
302 msg1.param.pword[1] = msg1.param.pword[2];
303 write(net_sock, &msg1, sizeof(MESSAGE));
304 bzero(&msg1, sizeof(msg1));
305 while ((msg1.msg_type != MSG_NET) ||
306 (msg1.param.pword[0] != NET_NODE_EXIST))
307 read_from_net(&msg1);
309 newarry((word)0, 2, (word)AINT, ¶m[8].xvirt, &ax);
311 M[ax++] = msg1.param.pword[1];
318 msg1.msg_type = MSG_NET;
319 msg1.param.pword[0] = NET_GET_INFO;
320 write(net_sock, &msg1, sizeof(MESSAGE));
321 while ((msg1.msg_type != MSG_NET) ||
322 (msg1.param.pword[0] != NET_INFO_END)) {
323 read_from_net(&msg1);
325 if (msg1.param.pword[0] == NET_INFO)
326 strcat(ss,msg1.param.pstr);
328 newarry((word)0, strlen(ss), (word)AINT, ¶m[8].xvirt, &ax);
341 msg.msg_type = MSG_GRAPH;
342 msg.param.pword[0] = GRAPH_MAGIC;
343 msg.param.pword[1] = param[0].xword;
344 msg.param.pword[2] = param[1].xword;
345 msg.param.pword[3] = param[2].xword;
346 msg.param.pword[4] = param[3].xword;
347 msg.param.pword[5] = param[5].xword;
348 msg.param.pword[6] = param[6].xword;
349 msg.param.pword[7] = param[7].xword;
350 s= (char *)(M + strings + param[ 4 ].xword + 1);
351 strcpy(msg.param.pstr,s);
356 if (msg.param.pword[1] < 0) {
357 lastmsg = msg.param.pword[1];
358 bzero(&msg,sizeof(G_MESSAGE));
359 while (msg.param.pword[0] != GRAPH_MAGIC_RESPONSE)
360 read_from_graph(&msg);
363 if (lastmsg == -305) {
364 newarry((word)0, 10, (word)AINT, ¶m[8].xvirt, &ax);
366 M[ax++] = atoi(msg.param.pstr);
369 else if (lastmsg == -306) {
370 newarry((word)0, 10, (word)AINT, ¶m[8].xvirt, &ax);
372 M[ax++] = msg.param.pchar;
375 else if (lastmsg == -307) {
376 newarry((word)0, 10, (word)AINT, ¶m[8].xvirt, &ax);
381 while ((sc < strlen(msg.param.pstr)) &&
382 (msg.param.pstr[sc] != '.')) {
383 ii[sc]=msg.param.pstr[sc];
389 while (scc<strlen(msg.param.pstr)) {
390 ff[sc++] = msg.param.pstr[scc++];
396 else if (msg.param.pword[1] == 1) {
397 newarry((word)0, 10, (word)AINT, ¶m[8].xvirt, &ax);
399 for(l = 2; l < 7; l++)
400 M[ax++] = msg.param.pword[l];
403 newarry((word)0, strlen(msg.param.pstr) + 2, (word)AINT, ¶m[8].xvirt, &ax);
420 msg.msg_type = MSG_GRAPH;
421 msg.param.pword[0] = GRAPH_MGETPRESS;
422 msg.param.pword[1] = GraphRes;
425 read_from_graph(&msg);
426 if ((msg.msg_type == MSG_GRAPH) &&
427 (msg.param.pword[0] == GRAPH_MGETPRESS_RESPONSE))
430 param[0].xword = msg.param.pword[2];
431 param[1].xword = msg.param.pword[3];
432 param[2].xword = msg.param.pword[4];
433 param[3].xword = msg.param.pword[5];
434 param[4].xword = msg.param.pword[6];
435 param[5].xword = msg.param.pword[7];