~ubuntu-branches/debian/jessie/eso-midas/jessie

« back to all changes in this revision

Viewing changes to gui/XHelp/src/XHelp.c

  • Committer: Package Import Robot
  • Author(s): Ole Streicher
  • Date: 2014-04-22 14:44:58 UTC
  • Revision ID: package-import@ubuntu.com-20140422144458-okiwi1assxkkiz39
Tags: upstream-13.09pl1.2+dfsg
ImportĀ upstreamĀ versionĀ 13.09pl1.2+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*===========================================================================
 
2
  Copyright (C) 1995-2009 European Southern Observatory (ESO)
 
3
 
 
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.
 
8
 
 
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.
 
13
 
 
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, 
 
17
  MA 02139, USA.
 
18
 
 
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 
 
25
                        GERMANY
 
26
===========================================================================*/
 
27
 
 
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. 
 
32
 *                           
 
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. 
 
37
 *                      
 
38
 * $Date: 2009-08-21 08:02:33 $                 $Revision: 1.3 $ 
 
39
 
 
40
.VERSION
 
41
 090818         last modif
 
42
 
 
43
 *-----------------------------------------------------------*/
 
44
 
 
45
#ifdef XOPEN_CATALOG
 
46
#include <locale.h>
 
47
#endif
 
48
 
 
49
#include <UxLib.h>
 
50
 
 
51
 
 
52
/*----------------------------------------------
 
53
 * Insert application global declarations here
 
54
 *---------------------------------------------*/
 
55
 
 
56
#include <StdResources.h>
 
57
 
 
58
 
 
59
/* MAX_CONTXT*8+2 is 15*80 + 2 = 122 < len(argv[6]) = 160     (070823) */
 
60
 
 
61
char contxt[164], nctx[164], midvers[20], filename[200];
 
62
char mid_ctx[100], mid_mail[100], print_com[100], mid_work[100];
 
63
 
 
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();
 
71
 
 
72
extern int init_monit_connection();
 
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 ncar;
 
90
 
 
91
        /*--------------------------------
 
92
         * Interface function declaration
 
93
         *-------------------------------*/     
 
94
 
 
95
        swidget popup_ApplicWindow();
 
96
 
 
97
        
 
98
 
 
99
        /*------------------------------------------------
 
100
         * Initialize interrupt routine for MIDAS monitor
 
101
         *----------------------------------------------*/
 
102
 
 
103
        (void) init_monit_connection();
 
104
 
 
105
        /*---------------------
 
106
         * Initialize Program
 
107
         *--------------------*/
 
108
 
 
109
#ifdef XOPEN_CATALOG
 
110
        setlocale(LC_ALL, "");
 
111
#endif
 
112
 
 
113
        UxTopLevel = UxInitialize("XHelp", &argc, argv);
 
114
 
 
115
        /*------------------------------------------------------
 
116
         * Insert initialization code for your application here
 
117
         *-----------------------------------------------------*/
 
118
 
 
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]);
 
125
 
 
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); */
 
129
 
 
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;
 
135
        else
 
136
            printf("Warning: Unexpected print option. Check Print in Setup");
 
137
        print_com[ncar] = '\0';
 
138
 
 
139
         strcpy(filename,"/tmp/hprint.txt");
 
140
 
 
141
         pb    = create_transientShell1(); 
 
142
         ctx   = create_transientShell2(); 
 
143
         sys   = create_transientShell3(); 
 
144
         save  = create_transientShell4(); 
 
145
         hist  = create_transientShell5(); 
 
146
         srch  = create_transientShell6(); 
 
147
 
 
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
         *---------------------------------------------------------------*/
 
154
 
 
155
        mainIface = popup_ApplicWindow();
 
156
 
 
157
        UxPopupInterface(mainIface, no_grab);
 
158
 
 
159
        /*-------------------------
 
160
         * Enter the event loop 
 
161
         *------------------------*/
 
162
 
 
163
        UxMainLoop();
 
164
 
 
165
return 0;
 
166
}
 
167
 
 
168
int convert(s1,s2)
 
169
 
 
170
char *s1,*s2;
 
171
 
 
172
{
 
173
 
 
174
int i=0, k=0, kmax;
 
175
char car;
 
176
 
 
177
while((car = s2[i++]) != '\0') {
 
178
  if (car != '\n') s1[k++] = car;
 
179
  else  {
 
180
    kmax = (int) (k/8);
 
181
    kmax = (kmax+1)*8 - 1;
 
182
    while (k <= kmax) s1[k++] = ' ';
 
183
    }
 
184
}
 
185
 
 
186
s1[k] = '\0';
 
187
strcat(s1,"        ");
 
188
 
 
189
return(k);
 
190
 
 
191
}