10 /* Call (non)standard procedures.
11 * Almost totaly implementation dependent.
14 bool graphmode = FALSE; /* TRUE iff graphics mode active */
26 bzero(&msg,sizeof(G_MESSAGE));
27 while ((msg.msg_type != MSG_GRAPH) && (msg.param.pword[0] != GRAPH_INKEY_RESPONSE))
28 { read_from_graph(&msg);
31 return(msg.param.pword[3]);
35 void nonstandard(nrproc) /* Call (non)standard procedure */
42 word ax,bx,cx,dx,i,t1,t2;
43 unsigned int v,p,h,l,r,c,sc;
44 unsigned int Res_graph_X,Res_graph_Y;
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;
69 msg.msg_type = MSG_GRAPH;
70 msg.param.pword[0]=GRAPH_MOVE;
71 msg.param.pword[1] = GraphRes;
72 msg.param.pword[2]=param[0].xword;
73 msg.param.pword[3]=param[1].xword;
78 msg.msg_type = MSG_GRAPH;
79 msg.param.pword[0]=GRAPH_LINETO;
80 msg.param.pword[1] = GraphRes;
81 msg.param.pword[3]=param[0].xword;
82 msg.param.pword[4]=param[1].xword;
87 msg.msg_type = MSG_GRAPH;
88 msg.param.pword[0]=GRAPH_CURPOS;
89 msg.param.pword[1] = GraphRes;
91 while ((msg.msg_type!=MSG_GRAPH)&&(msg.param.pword[0]!=GRAPH_CURPOS_RESPONSE))
92 read_from_graph(&msg);
93 param[0].xword = msg.param.pword[3];
97 msg.msg_type = MSG_GRAPH;
98 msg.param.pword[0]=GRAPH_CURPOS;
99 msg.param.pword[1] = GraphRes;
101 while ((msg.msg_type!=MSG_GRAPH)||(msg.param.pword[0]!=GRAPH_CURPOS_RESPONSE))
102 read_from_graph(&msg);
103 param[0].xword = msg.param.pword[4];
112 msg.msg_type = MSG_GRAPH;
113 msg.param.pword[0]=GRAPH_HASCII;
114 msg.param.pword[1]=param[0].xword;
119 msg.msg_type = MSG_GRAPH;
120 msg.param.pword[0]=GRAPH_FOREGROUND;
121 msg.param.pword[1] = GraphRes;
122 msg.param.pword[3] = param[0].xword;
127 msg.msg_type = MSG_GRAPH;
128 msg.param.pword[0]=GRAPH_BACKGROUND;
129 msg.param.pword[1] = GraphRes;
130 msg.param.pword[3] = param[0].xword;
141 msg.msg_type = MSG_GRAPH;
142 msg.param.pword[0]=GRAPH_OUTSTRING;
143 msg.param.pword[1] = GraphRes;
144 msg.param.pword[2] = param[0].xword;
145 msg.param.pword[3] = param[1].xword;
146 msg.param.pword[4] = param[3].xword;
147 msg.param.pword[5] = param[4].xword;
149 s= (char *)(M + strings + param[ 2 ].xword + 1);
150 strcpy(msg.param.pstr,s);
156 msg.msg_type = MSG_GRAPH;
157 msg.param.pword[0] = GRAPH_GETMAP;
158 msg.param.pword[1] = GraphRes;
159 msg.param.pword[2] = param[0].xword;
160 msg.param.pword[3] = param[1].xword;
162 while ((msg.msg_type!=MSG_GRAPH)||(msg.param.pword[0]!=GRAPH_GETMAP_RESPONSE))
163 read_from_graph(&msg);
168 map =msg.param.pword[2];
169 newarry((word) 1, 3, (word)AINT, ¶m[ 2 ].xvirt, &am);
171 M[ am+4 ] = msg.param.pword[3];
172 M[ am+5 ] = msg.param.pword[4];
179 if (member(¶m[ 0 ].xvirt, &am)){
180 msg.msg_type = MSG_GRAPH;
181 msg.param.pword[0] = GRAPH_PUTMAP;
182 msg.param.pword[1] = GraphRes;
183 msg.param.pword[2] = M[am+3];
184 msg.param.pword[4] = M[am+4];
185 msg.param.pword[5] = M[am+5];
195 msg.msg_type = MSG_GRAPH;
196 msg.param.pword[0]=GRAPH_RECT;
197 msg.param.pword[1] = GraphRes;
198 msg.param.pword[3] = param[0].xword;
199 msg.param.pword[4] = param[1].xword;
200 msg.param.pword[5] = param[2].xword;
201 msg.param.pword[6] = param[3].xword;
202 msg.param.pword[7] = param[4].xword;
203 msg.param.pword[8] = param[5].xword;
204 send_to_graph(&msg); break;
208 msg.msg_type = MSG_GRAPH;
209 msg.param.pword[0] = GRAPH_WRITEINTXY;
210 msg.param.pword[1] = GraphRes;
211 msg.param.pword[2] = param[0].xword;
212 msg.param.pword[3] = param[1].xword;
213 msg.param.pword[4] = param[4].xword;
214 msg.param.pword[5] = param[2].xword;
219 msg.msg_type = MSG_GRAPH;
220 msg.param.pword[0]=GRAPH_INKEY;
221 msg.param.pword[1] = GraphRes;
223 param[0].xword = wait_for_key();
228 msg.msg_type = MSG_GRAPH;
229 msg.param.pword[0]=GRAPH_ELLIPSE;
230 msg.param.pword[1] = GraphRes;
231 msg.param.pword[3]=param[0].xword; msg.param.pword[4]=param[1].xword;
232 msg.param.pword[5]=param[2].xword; msg.param.pword[6]=param[3].xword;
233 msg.param.pword[7]=(double)param[4].xword;
234 msg.param.pword[8]=(double) param[5].xword;
235 msg.param.pword[9]=param[7].xword;
239 case HFONT8: /* ___________ magic library ____________ */
241 if (param[0].xword==1000)
245 if (param[0].xword==1001)
247 sprintf(ss,"%s%c",ss,(char)(param[1].xword));
249 if (param[0].xword==303)
251 msg.param.pword[1] = param[0].xword;
252 msg.param.pword[2] = param[1].xword;
253 msg.param.pword[3] = param[2].xword;
254 msg.param.pword[4] = param[3].xword;
255 msg.param.pword[5] = param[5].xword;
256 msg.msg_type = MSG_GRAPH;
257 msg.param.pword[0] = GRAPH_MAGIC;
258 strcpy(msg.param.pstr,ss);
261 if (param[0].xword>500)
263 msg1.param.pword[1] = param[0].xword;
264 msg1.param.pword[2] = param[1].xword;
265 msg1.param.pword[3] = param[2].xword;
266 msg1.param.pword[4] = param[3].xword;
267 s= (char *)(M + strings + param[ 4 ].xword + 1);
268 strcpy(msg1.param.pstr,s);
269 msg1.param.pword[5] = param[5].xword;
270 msg1.param.pword[6] = param[6].xword;
271 msg1.param.pword[7] = param[7].xword;
273 switch(msg1.param.pword[1]) /* Machine class */
275 case 501: /* get local node */
276 newarry((word)0,2,(word)AINT,¶m[8].xvirt,&ax);
280 case 502: /* number of nodes */
281 msg1.msg_type = MSG_NET;
282 msg1.param.pword[0]=NET_NODES_NUM;
283 write(net_sock,&msg1,sizeof(MESSAGE));
284 while ((msg1.msg_type!=MSG_NET) || (msg1.param.pword[0]!=NET_NODES_NUM_RESPONSE) )
285 read_from_net(&msg1);
286 newarry((word)0,2,(word)AINT,¶m[8].xvirt,&ax);
288 M[ax++]=msg1.param.pword[1];
290 case 503: /* node exists */
291 msg1.msg_type = MSG_NET;
292 msg1.param.pword[0]=NET_NODE_EXIST;
293 msg1.param.pword[1]=msg1.param.pword[2];
294 write(net_sock,&msg1,sizeof(MESSAGE));
295 bzero(&msg1,sizeof(msg1));
296 while ((msg1.msg_type!=MSG_NET) || (msg1.param.pword[0]!=NET_NODE_EXIST) )
297 read_from_net(&msg1);
298 newarry((word)0,2,(word)AINT,¶m[8].xvirt,&ax);
300 M[ax++]=msg1.param.pword[1];
302 case 504: /* get nodes info */
306 msg1.msg_type = MSG_NET;
307 msg1.param.pword[0]=NET_GET_INFO;
308 write(net_sock,&msg1,sizeof(MESSAGE));
309 while ( (msg1.msg_type!=MSG_NET) ||(msg1.param.pword[0]!=NET_INFO_END) )
311 read_from_net(&msg1);
312 if (msg1.param.pword[0]==NET_INFO)
313 strcat(ss,msg1.param.pstr);
315 newarry((word)0,strlen(ss),(word)AINT,
316 ¶m[8].xvirt,&ax);
329 msg.param.pword[1] = param[0].xword;
330 msg.param.pword[2] = param[1].xword;
331 msg.param.pword[3] = param[2].xword;
332 msg.param.pword[4] = param[3].xword;
333 s= (char *)(M + strings + param[ 4 ].xword + 1);
334 strcpy(msg.param.pstr,s);
335 msg.param.pword[5] = param[5].xword;
336 msg.param.pword[6] = param[6].xword;
337 msg.param.pword[7] = param[7].xword;
339 msg.msg_type = MSG_GRAPH;
340 msg.param.pword[0] = GRAPH_MAGIC;
344 if (msg.param.pword[1]<0)
346 lastmsg=msg.param.pword[1];
347 bzero(&msg,sizeof(G_MESSAGE));
348 while (msg.param.pword[0]!=GRAPH_MAGIC_RESPONSE)
349 read_from_graph(&msg);
350 if (lastmsg==-305) // Read integer
352 newarry((word)0,10,(word)AINT,¶m[8].xvirt,&ax);
354 M[ax++]=atoi(msg.param.pstr);
357 if (lastmsg==-306) // Read char
359 newarry((word)0,10,(word)AINT,¶m[8].xvirt,&ax);
361 M[ax++]=msg.param.pchar;
364 if (lastmsg==-307) // Read real
366 newarry((word)0,10,(word)AINT,¶m[8].xvirt,&ax);
368 strcpy(ii,"");strcpy(ff,"");sc=0;
369 while ((sc<strlen(msg.param.pstr)) && (msg.param.pstr[sc]!='.'))
371 ii[sc]=msg.param.pstr[sc];
374 ii[sc++]='\0';scc=sc;sc=0;
375 while (scc<strlen(msg.param.pstr))
377 ff[sc++]=msg.param.pstr[scc++];
385 if (msg.param.pword[1]==1)
387 newarry((word)0,10,(word)AINT,¶m[8].xvirt,&ax);
390 M[ax++]=msg.param.pword[l];
394 newarry((word)0,strlen(msg.param.pstr)+2,(word)AINT,
395 ¶m[8].xvirt,&ax);
413 msg.msg_type = MSG_GRAPH;
414 msg.param.pword[0]=GRAPH_MGETPRESS;
415 msg.param.pword[1] = GraphRes;
419 read_from_graph(&msg);
420 if ( (msg.msg_type==MSG_GRAPH)&&(msg.param.pword[0]==GRAPH_MGETPRESS_RESPONSE)) break;
422 param[0].xword = msg.param.pword[2];
423 param[1].xword = msg.param.pword[3];
424 param[2].xword = msg.param.pword[4];
425 param[3].xword = msg.param.pword[5];
426 param[4].xword = msg.param.pword[6];
427 param[5].xword = msg.param.pword[7];