1 #include <X11/Intrinsic.h>
2 #include <stdio.h>
3
4 RwcBoolean workproc_A( XtPointer ) ; /* protos */
5 RwcBoolean workproc_B( XtPointer ) ;
6 void killit_CB( XtPointer , XtIntervalId * ) ;
7
8 static XtAppContext app ; /* global */
9
10 /*------------------------------------------------------------------*/
11
main(int argc,char * argv[])12 int main( int argc , char * argv[] )
13 {
14 Widget wid ;
15
16 wid = XtVaAppInitialize(
17 &app, "Elvis", NULL, 0, &argc, argv, NULL, NULL ) ;
18 if( wid == NULL ){
19 fprintf(stderr,"*** Cannot initialize X11!\n") ; exit(1) ;
20 }
21
22 XtAppAddTimeOut( app , 1234 , killit_CB , NULL ) ;
23
24 XtAppAddWorkProc( app, workproc_A, NULL ) ;
25 XtAppMainLoop(app) ;
26 exit(0) ;
27 }
28
29 /*------------------------------------------------------------------*/
30
killit_CB(XtPointer xyzzy,XtIntervalId * zork)31 void killit_CB( XtPointer xyzzy , XtIntervalId * zork )
32 { exit(0) ; }
33
34 /*------------------------------------------------------------------*/
35
36 #define WMAX 4
37
workproc_A(XtPointer elvis)38 RwcBoolean workproc_A( XtPointer elvis )
39 {
40 static int ncall=0 ;
41
42 if( ncall == 0 ) XtAppAddWorkProc( app, workproc_B, NULL ) ;
43 ncall++ ; printf("workproc_A: %d\n",ncall) ;
44 return (ncall < WMAX) ? False : True ;
45 }
46
47 /*------------------------------------------------------------------*/
48
workproc_B(XtPointer presley)49 RwcBoolean workproc_B( XtPointer presley )
50 {
51 static int ncall=0 ;
52 ncall++ ; printf("workproc_B: %d\n",ncall) ;
53 return (ncall < WMAX) ? False : True ;
54 }
55
56 /*------------------------------------------------------------------*/
57
58 /*---------- Fix a Linux stupidity -------------------------------*/
59
60 #ifdef NEED_XSETLOCALE
61 #include <locale.h>
_Xsetlocale(int category,const char * locale)62 char * _Xsetlocale( int category, const char * locale)
63 { return setlocale(category,locale) ; }
64 #endif
65