~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Linux Cross Reference
Tina4/src/Xm/tw_init.c

Version: ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /**@(#)
  2 **/
  3 #include <signal.h>
  4 #include <stdio.h>
  5 #include <tina/sys.h>
  6 #include <tina/math.h>
  7 #include <tina/tv.h>
  8 #include  <tina/mtw.h>
  9 #include  <tina/tv_screen.h>
 10 #include <tina/Xmfuncs.h>
 11 
 12 /* FORWARD REFS */
 13 
 14 
 15 #define PROGRAM_CLASS "tinatool"
 16 
 17 static Bool save = false;
 18 
 19 Bool    tw_save(void)
 20 {
 21     return (save);
 22 }
 23 
 24 static Bool recover = false;
 25 
 26 Bool    tw_recover(void)
 27 {
 28     return (recover);
 29 }
 30 
 31 void tw_set_save(Bool newsave)
 32 {
 33     save =  newsave;
 34 }
 35 
 36 static char *progname;
 37 
 38 char   *tw_get_progname(void)
 39 {
 40     return (progname);
 41 }
 42 
 43 static Display *display = (Display *) NULL;
 44 
 45 Display *tw_get_display(void)
 46 {
 47     return (display);
 48 }
 49 
 50 void   *tw_set_display(Display * newdisplay)
 51 {
 52     display = newdisplay;
 53 }
 54 
 55 static XtAppContext context = 0;
 56 
 57 XtAppContext tw_get_context(void)
 58 {
 59     return (context);
 60 }
 61 
 62 void    tw_flush(void)
 63 {
 64     XFlush(display);
 65 }
 66 
 67 tw_read_args(int *argc, char **argv)
 68 {
 69     int     i;
 70 
 71     progname = argv[0];
 72 
 73     for (i = 1; i < *argc; i++)
 74     {
 75         if (argv[i][0] != '-')
 76             continue;
 77         switch (argv[i][1])
 78         {
 79         case 's':
 80             save = true;
 81             break;
 82         case 'r':
 83             recover = true;
 84             break;
 85         case 'f':
 86             recover = true;
 87             progname =  argv[i+1];
 88             break;
 89         }
 90     }
 91 }
 92 
 93 int     tw_init(int *argc, char **argv)
 94 {
 95     Widget  first_tool = XtInitialize("Tinatool",
 96                                       PROGRAM_CLASS, NULL, 0,
 97                                       argc, argv);
 98 
 99     extern void alarm_handler();
100     extern void interrupt_handler();
101 
102     context = XtWidgetToApplicationContext(first_tool);
103     display = XtDisplay(first_tool);
104     tw_first_tool_set(first_tool);
105     tw_read_args(argc, argv);
106 
107     /* handle interrupts */
108     (void) signal(SIGALRM, alarm_handler);
109     (void) signal(SIGINT, interrupt_handler);
110 
111     /**** OLD VERSION
112       XtToolkitInitialize();
113       context = XtCreateApplicationContext();
114       display = XtOpenDisplay(context, NULL, NULL,
115       PROGRAM_CLASS, NULL, 0,
116       argc, argv);
117       ****/
118 }
119 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.