1
/*===========================================================================
2
Copyright (C) 1995-2009 European Southern Observatory (ESO)
4
This program is free software; you can redistribute it and/or
5
modify it under the terms of the GNU General Public License as
6
published by the Free Software Foundation; either version 2 of
7
the License, or (at your option) any later version.
9
This program is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
GNU General Public License for more details.
14
You should have received a copy of the GNU General Public
15
License along with this program; if not, write to the Free
16
Software Foundation, Inc., 675 Massachusetts Ave, Cambridge,
19
Correspondence concerning ESO-MIDAS should be addressed as follows:
20
Internet e-mail: midas@eso.org
21
Postal address: European Southern Observatory
22
Data Management Division
23
Karl-Schwarzschild-Strasse 2
24
D 85748 Garching bei Muenchen
26
===========================================================================*/
28
/*------------------------------------------------------------
29
* This is the project main program file for Ux generated
30
* code. You may add application dependent source code
31
* at the appropriate places.
33
* Do not modify the statements preceded by the dollar
34
* sign ($), these statements will be replaced with
35
* the appropriate source code when the main program is
36
* automatically generated.
38
* $Date: 2009-08-21 08:02:33 $ $Revision: 1.3 $
43
*-----------------------------------------------------------*/
52
/*----------------------------------------------
53
* Insert application global declarations here
54
*---------------------------------------------*/
56
#include <StdResources.h>
59
/* MAX_CONTXT*8+2 is 15*80 + 2 = 122 < len(argv[6]) = 160 (070823) */
61
char contxt[164], nctx[164], midvers[20], filename[200];
62
char mid_ctx[100], mid_mail[100], print_com[100], mid_work[100];
64
swidget pb, save, sys, ctx, hist, srch;
65
extern swidget create_transientShell1(),
66
create_transientShell2(),
67
create_transientShell3(),
68
create_transientShell4(),
69
create_transientShell5(),
70
create_transientShell6();
72
extern int init_monit_connection();
78
/*-----------------------------------------------------------
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
*-----------------------------------------------------------*/
91
/*--------------------------------
92
* Interface function declaration
93
*-------------------------------*/
95
swidget popup_ApplicWindow();
99
/*------------------------------------------------
100
* Initialize interrupt routine for MIDAS monitor
101
*----------------------------------------------*/
103
(void) init_monit_connection();
105
/*---------------------
107
*--------------------*/
110
setlocale(LC_ALL, "");
113
UxTopLevel = UxInitialize("XHelp", &argc, argv);
115
/*------------------------------------------------------
116
* Insert initialization code for your application here
117
*-----------------------------------------------------*/
119
strcpy(midvers, argv[1]);
120
strcpy(mid_mail, argv[2]);
121
strcpy(print_com,argv[3]);
122
strcpy(mid_ctx, argv[4]);
123
strcpy(mid_work, argv[5]);
124
strcpy(contxt, argv[6]);
126
/* printf("Version: %s, Mail: %s, Print: %s\nContext: %s\n
127
Midwork: %s\nContexts: %s\n",
128
midvers, mid_mail, print_com, mid_ctx, mid_work, contxt); */
130
/* Process print command to remove final -P or -d option */
131
ncar = (int) strlen(print_com)-1;
132
while (print_com[ncar] == ' ') ncar--;
133
if (print_com[ncar-1] == '-' && (print_com[ncar] == 'P' ||
134
print_com[ncar] == 'd')) ncar = ncar-1;
136
printf("Warning: Unexpected print option. Check Print in Setup");
137
print_com[ncar] = '\0';
139
strcpy(filename,"/tmp/hprint.txt");
141
pb = create_transientShell1();
142
ctx = create_transientShell2();
143
sys = create_transientShell3();
144
save = create_transientShell4();
145
hist = create_transientShell5();
146
srch = create_transientShell6();
148
/*----------------------------------------------------------------
149
* Create and popup the first window of the interface. The
150
* return value can be used in the popdown or destroy functions.
151
* The swidget return value of PJ_INTERFACE_FUNCTION_CALL will
152
* be assigned to "mainIface" from PJ_INTERFACE_RETVAL_TYPE.
153
*---------------------------------------------------------------*/
155
mainIface = popup_ApplicWindow();
157
UxPopupInterface(mainIface, no_grab);
159
/*-------------------------
160
* Enter the event loop
161
*------------------------*/
177
while((car = s2[i++]) != '\0') {
178
if (car != '\n') s1[k++] = car;
181
kmax = (kmax+1)*8 - 1;
182
while (k <= kmax) s1[k++] = ' ';