11 static int child_no=0;
12 static int fcol=1,bcol=0;
14 static Display *theDisplay;
15 static Window myWindow,theWindow;
16 static XClientMessageEvent theMessage;
19 static void send_sig(nrproc) int nrproc; {
20 theMessage.type=ClientMessage;
21 theMessage.format = 16;
22 theMessage.message_type = nrproc;
23 XSendEvent(theDisplay,theWindow,True,NoEventMask,&theMessage);
28 do XNextEvent( theDisplay, &retEv );
29 while( retEv.type!=ClientMessage );
35 void graph_on(x,y,title) int x,y; char *title; {
37 if ((theDisplay = XOpenDisplay(NULL)) == NULL){
38 fprintf (stderr,"\ngraph: Can't open display\n");
42 myWindow = XCreateWindow(
44 RootWindow(theDisplay,DefaultScreen(theDisplay)),
46 CopyFromParent,InputOnly,CopyFromParent,
50 if( (child_no=fork())==0 ){
54 sprintf(me,"%d",(int)myWindow);
57 execlp("./graph","graph",me,xs,ys,title,NULL);
61 theWindow = (int)(retEv.xclient.data.l[0]);
66 send_sig(GRAPH_CMD_END);
71 void graph_point( x,c ) int x,c; {
72 theMessage.data.l[0]=x;
73 theMessage.data.l[1]=c;
74 send_sig(GRAPH_CMD_POINT);
77 void graph_board( size ) int size; {
78 theMessage.data.l[0]=size;
79 send_sig(GRAPH_CMD_LINE);