Debian Codegraph @

gui/XDo/src/XDo.c

raw
1 /*------------------------------------------------------------
2 * This is the project main program file for Ux generated
3 * code. You may add application dependent source code
4 * at the appropriate places.
5 *
6 * Do not modify the statements preceded by the dollar
7 * sign ($), these statements will be replaced with
8 * the appropriate source code when the main program is
9 * automatically generated.
10 *
11 * $Date: 2009-08-25 13:23:09 $ $Revision: 1.2 $
12 *-----------------------------------------------------------*/
13
14 /*
15 .VERSION
16 090825 last modif
17 */
18
19 #ifdef XOPEN_CATALOG
20 #include <locale.h>
21 #endif
22
23 #include <stdlib.h>
24 #include <signal.h>
25
26 #include <UxLib.h>
27 #include <midas_def.h>
28 #include <tbldef.h>
29
30 #include <StdResources.h>
31
32
33 extern int initmytable(), read_ost_table();
34
35 extern void add_ident_table(), add_col_table(), display_ident_table();
36
37
38
39
40 /*----------------------------------------------
41 * Insert application global declarations here
42 *---------------------------------------------*/
43
44 char *osmmget();
45 static void reread();
46 char session[3];
47 char ostchoice[60],claschoice[60],assochoice[60],*colchoice,*coltemp,*rowtext[256];
48 char commerr[180];
49 int tidost,tidclas,tidasso,colno,itemsize,do8,doI,rowno,arowno,MonitorPid;
50 int msgvalue,coltempno,collabchan;
51 int tidcomm;
52 Widget row1[40],row2[40],row3[40],rowrule[256][2];
53 Widget arow1[20],arow2[20],arow3[20],arow4[20];
54 Widget FileListWidget,sb;
55 swidget pb, save, crea, ctx, hist, srch, klist,clist,flist,olist,dlist,ilist;
56 swidget classi,clashaupt,assohaupt,asso,myerror,mymsg,help,attri;
57 extern swidget create_transientShell3(),
58 create_transientShell8(),
59 create_transientShell1(),
60 create_applicationClas(),
61 create_Classify(),
62 create_SelectFrame(),
63 create_SelectDescrTable(),
64 create_SelectInstrument(),
65 create_Association(),
66 create_Associate(),
67 create_Warning(),
68 create_errorDialog1(),
69 create_HelpDo(),
70 create_ColAttribute();
71
72
73
74 int main(argc,argv)
75 int argc;
76 char *argv[];
77 {
78 /*-----------------------------------------------------------
79 * Declarations.
80 * The default identifier - mainIface will only be declared
81 * if the interface function is global and of type swidget.
82 * To change the identifier to a different name, modify the
83 * string mainIface in the file "main.dat". If "mainIface"
84 * is declared, it will be used below where the return value
85 * of PJ_INTERFACE_FUNCTION_CALL will be assigned to it.
86 *-----------------------------------------------------------*/
87
88 swidget mainIface;
89 int nbytes,i;
90
91
92 /*--------------------------------
93 * Interface function declaration
94 *-------------------------------*/
95
96 swidget popup_ApplicWindow();
97
98
99
100 /*---------------------
101 * Initialize Program
102 *--------------------*/
103
104 #ifdef XOPEN_CATALOG
105 setlocale(LC_ALL, "");
106 #endif
107
108 UxTopLevel = UxInitialize("Tempdo", &argc, argv);
109
110 /*------------------------------------------------------
111 * Insert initialization code for your application here
112 *-----------------------------------------------------*/
113 /*
114
115 */
116
117 MonitorPid = atoi(argv[1]);
118 strcpy(session, argv[2]);
119 session[2] = '\0';
120
121
122
123 /* printf("Version: %s, Mail: %s, Print: %s\nContext: %s\nMidwork: %s\nContexts: %s\n",
124 midvers, mid_mail, print_com, mid_ctx, mid_work, contxt); */
125
126 SCSPRO("-1");
127 osscatch(SIGUSR1,reread);
128 nbytes = (TBL_LABLEN+1) * 256;
129 colchoice = osmmget(nbytes);
130 /* strcpy(colchoice,"IDENT");
131
132 colno = 1;*/
133 oscfill(colchoice,'\0',nbytes);
134 for (i=0; i<60; i++) ostchoice[i] = '\0';
135
136 msgvalue = 1;
137 nbytes = (TBL_LABLEN+1) * 20;
138 coltemp = osmmget(nbytes);
139
140 crea = create_transientShell3();
141
142 klist = create_transientShell8();
143 clist = create_transientShell1();
144 flist = create_SelectFrame();
145 dlist = create_SelectDescrTable();
146 ilist = create_SelectInstrument();
147 classi = create_applicationClas();
148 clashaupt = create_Classify();
149 assohaupt = create_Association();
150 myerror = create_errorDialog1();
151 asso = create_Associate();
152 mymsg = create_Warning();
153 help = create_HelpDo();
154 attri = create_ColAttribute();
155 for (i=0; i<256; i++) {
156 rowrule[i][0] = (Widget )0;
157 rowrule[i][1] = (Widget )0;
158 }
159 for (i=0; i<40; i++) {
160 row1[i] = (Widget )0;
161 row2[i] = (Widget )0;
162 row3[i] = (Widget )0;
163 }
164 for (i=0; i<20; i++) {
165 arow1[i] = (Widget )0;
166 arow2[i] = (Widget )0;
167 arow3[i] = (Widget )0;
168 arow4[i] = (Widget )0;
169 }
170 tidclas = -1;
171 tidost = -1;
172 tidasso = -1;
173 tidcomm = -1;
174 initmytable();
175
176
177
178 /*----------------------------------------------------------------
179 * Create and popup the first window of the interface. The
180 * return value can be used in the popdown or destroy functions.
181 * The swidget return value of PJ_INTERFACE_FUNCTION_CALL will
182 * be assigned to "mainIface" from PJ_INTERFACE_RETVAL_TYPE.
183 *---------------------------------------------------------------*/
184
185 mainIface = popup_ApplicWindow();
186
187 UxPopupInterface(mainIface, no_grab);
188
189 /*-------------------------
190 * Enter the event loop
191 *------------------------*/
192
193 UxMainLoop();
194
195 return 0;
196 }
197
198 static void reread()
199 {
200 extern int tidost,tidcomm ;
201 extern char ostchoice[60];
202 int openflag,null;
203
204 osscatch(SIGUSR1,reread);
205 if (tidost != -1 ) {
206 TCTCLO(tidost);
207 tidost = -1 ;
208 }
209 TCTOPN("TAB_COMM.tbl",F_I_MODE,&tidcomm);
210 TCERDI(tidcomm,1,4,&openflag,&null);
211
212 if (openflag == 1) {
213 TCTOPN(ostchoice,F_I_MODE,&tidost);
214
215 add_ident_table(UxGetWidget(UxFindSwidget("identlist")));
216 add_col_table(UxGetWidget(UxFindSwidget("readtable")));
217 }
218 else {
219 strcpy(ostchoice,"ost.tbl");
220 if (read_ost_table()) display_ident_table(UxGetWidget(UxFindSwidget("identlist")));
221 }
222 TCTCLO(tidcomm);
223 }
224
225
226