~ubuntu-branches/ubuntu/quantal/openmotif/quantal

« back to all changes in this revision

Viewing changes to clients/uil/UilCmd.c

  • Committer: Bazaar Package Importer
  • Author(s): Stefan Bauer
  • Date: 2010-06-23 12:12:31 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20100623121231-u89gxdp51sg9wjj2
Tags: 2.3.0-1
* New Maintainer (Closes: #379258) 
* Acknowledge NMU changes
* New upstream release (Closes: #494375)
* Get rid of security patches as they are already part of new upstream
  release (00-xpmvuln.openmotif.patch, 342092-CVE-2005-3964.patch)
* Bump Standards to 3.8.4
* Added {misc:Depends} to make the package lintian cleaner
* Fix weak-library-dev-dependency by adding ${binary:Version}) for the
  -dev Package of openmotif
* Let package depend on autotools-dev to use newer autotools-helper-files
* Work around an autoconf-bug (Gentoo-Bug #1475)
* Added Client-side anti-aliased fonts support via XFT
* Added UTF-8 and UTF8_STRING atom support
* Ability to show text and pixmaps in Label, LabelGadget and all
  derived widgets
* Support of PNG/JPEG image formats in the same way as XPM is supported
* Increase FILE_OFFSET_BITS to 64 to show files >2GB in file-selector
  Idea taken from Magne Oestlyngen (Closes: #288537)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* 
 
2
 *  @OPENGROUP_COPYRIGHT@
 
3
 *  COPYRIGHT NOTICE
 
4
 *  Copyright (c) 1990, 1991, 1992, 1993 Open Software Foundation, Inc.
 
5
 *  Copyright (c) 1996, 1997, 1998, 1999, 2000 The Open Group
 
6
 *  ALL RIGHTS RESERVED (MOTIF). See the file named COPYRIGHT.MOTIF for
 
7
 *  the full copyright text.
 
8
 *  
 
9
 *  This software is subject to an open license. It may only be
 
10
 *  used on, with or for operating systems which are themselves open
 
11
 *  source systems. You must contact The Open Group for a license
 
12
 *  allowing distribution and sublicensing of this software on, with,
 
13
 *  or for operating systems which are not Open Source programs.
 
14
 *  
 
15
 *  See http://www.opengroup.org/openmotif/license for full
 
16
 *  details of the license agreement. Any use, reproduction, or
 
17
 *  distribution of the program constitutes recipient's acceptance of
 
18
 *  this agreement.
 
19
 *  
 
20
 *  EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS
 
21
 *  PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 
22
 *  KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY
 
23
 *  WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY
 
24
 *  OR FITNESS FOR A PARTICULAR PURPOSE
 
25
 *  
 
26
 *  EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT
 
27
 *  NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT,
 
28
 *  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 
29
 *  DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED
 
30
 *  AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 
31
 *  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
 
32
 *  ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE
 
33
 *  EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE
 
34
 *  POSSIBILITY OF SUCH DAMAGES.
 
35
*/ 
 
36
/* 
 
37
 * HISTORY
 
38
*/ 
 
39
#ifdef REV_INFO
 
40
#ifndef lint
 
41
static char rcsid[] = "$XConsortium: UilCmd.c /main/11 1995/07/14 09:32:29 drk $"
 
42
#endif
 
43
#endif
 
44
 
 
45
#ifdef HAVE_CONFIG_H
 
46
#include <config.h>
 
47
#endif
 
48
 
 
49
 
 
50
/*
 
51
*  (c) Copyright 1989, 1990, DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS. */
 
52
 
 
53
/*
 
54
**++
 
55
**  FACILITY:
 
56
**
 
57
**      User Interface Language Compiler (UIL)
 
58
**
 
59
**  ABSTRACT:
 
60
**
 
61
**      Command line interpreter for the
 
62
**
 
63
**--
 
64
**/
 
65
 
 
66
/*
 
67
**
 
68
**  INCLUDE FILES
 
69
**
 
70
**/
 
71
 
 
72
 
 
73
#include "UilDefI.h"
 
74
#include "UilCmdDef.h"
 
75
 
 
76
 
 
77
/*
 
78
**
 
79
**  GLOBAL DECLARATIONS
 
80
**
 
81
**/
 
82
 
 
83
externaldef(uil_comp_glbl) cmd_command_line_type Uil_cmd_z_command = {
 
84
        NULL,   /* *ac_source_file */
 
85
        NULL,   /* *ac_resource_file */
 
86
        NULL,   /* *ac_listing_file */
 
87
        0,      /* include_dir_count */
 
88
        NULL,   /* **ac_include_dir */
 
89
        1,      /* v_listing_file */
 
90
        1,      /* v_resource_file */
 
91
        1,      /* v_show_machine_code */
 
92
        1,      /* v_report_info_msg */
 
93
        1,      /* v_report_warn_msg */
 
94
        1,      /* v_parse_tree */
 
95
        1,      /* v_issue_summary */
 
96
        0,      /* status_update_delay */
 
97
        NULL,   /* (*message_cb)() */
 
98
        NULL,   /* *message_data */
 
99
        NULL,   /* (*status_cb)() */
 
100
        NULL,   /* *status_data */
 
101
        1,      /* v_use_setlocal */
 
102
        NULL,   /* *ac_database */
 
103
        1       /* v_database */
 
104
};
 
105
 
 
106
 
 
107
 
 
108
/*
 
109
**++
 
110
**  FUNCTIONAL DESCRIPTION:
 
111
**
 
112
**      This procedure parses the command line and places the
 
113
**      results of the parse in the global structure "Uil_cmd_z_command".
 
114
**
 
115
**  FORMAL PARAMETERS:
 
116
**
 
117
**      l_arg_count:    number of command arguments
 
118
**      rac_arg_value:  array of pointers to null terminated character strings
 
119
**                      each of which is one of the command line arguments
 
120
**
 
121
**  IMPLICIT INPUTS:
 
122
**
 
123
**      none
 
124
**
 
125
**  IMPLICIT OUTPUTS:
 
126
**
 
127
**      Uil_cmd_z_command:      respository for command line info
 
128
**
 
129
**  FUNCTION VALUE:
 
130
**
 
131
**      void
 
132
**
 
133
**  SIDE EFFECTS:
 
134
**
 
135
**      Uil_cmd_z_command is set
 
136
**
 
137
**--
 
138
**/
 
139
void    cmd_decode_command_line( l_arg_count, rac_arg_value )
 
140
int     l_arg_count;
 
141
char    *rac_arg_value[ ];
 
142
 
 
143
{
 
144
    static char     *include_list       [Uil_k_max_include_dir_count];
 
145
    int i;
 
146
 
 
147
    Uil_cmd_z_command.ac_source_file = NULL;
 
148
    Uil_cmd_z_command.ac_resource_file = NULL;
 
149
    Uil_cmd_z_command.ac_listing_file = NULL;
 
150
    Uil_cmd_z_command.include_dir_count = 0;
 
151
    Uil_cmd_z_command.ac_include_dir = (char **)include_list;
 
152
    Uil_cmd_z_command.v_resource_file = TRUE;
 
153
    Uil_cmd_z_command.v_listing_file = FALSE;
 
154
    Uil_cmd_z_command.v_show_machine_code = FALSE;
 
155
    Uil_cmd_z_command.v_report_info_msg = TRUE;
 
156
    Uil_cmd_z_command.v_report_warn_msg = TRUE;
 
157
    Uil_cmd_z_command.v_parse_tree = FALSE;
 
158
    Uil_cmd_z_command.v_use_setlocale = FALSE;
 
159
    Uil_cmd_z_command.status_update_delay = 0;
 
160
    Uil_cmd_z_command.message_cb = (Uil_continue_type(*)())NULL;
 
161
    Uil_cmd_z_command.status_cb = (Uil_continue_type(*)())NULL;
 
162
    Uil_cmd_z_command.ac_database = NULL;
 
163
    Uil_cmd_z_command.v_database = FALSE;
 
164
 
 
165
#if debug_version
 
166
    uil_v_dump_tokens = FALSE;
 
167
    uil_v_dump_symbols = FALSE;
 
168
#endif
 
169
 
 
170
    /* traverse the options on the command line */
 
171
 
 
172
    for (i = 1;  i < l_arg_count;  i++)
 
173
    {
 
174
        /* check for an output file  */
 
175
 
 
176
        if ( strcmp("-o", rac_arg_value[ i ]) == 0 )
 
177
        {
 
178
            /* the next argument is the output file name  */
 
179
 
 
180
            /* check next field is not an option */
 
181
 
 
182
            if (((i+1) >= l_arg_count) ||
 
183
                ( '-' == rac_arg_value[ i+1 ][ 0 ] ))
 
184
            {
 
185
                diag_issue_diagnostic
 
186
                        ( d_miss_opt_arg, 
 
187
                          diag_k_no_source, diag_k_no_column,
 
188
                          rac_arg_value[ i ],
 
189
                          "output file"
 
190
                        );
 
191
                continue;
 
192
            }
 
193
 
 
194
            if (Uil_cmd_z_command.ac_resource_file == NULL)
 
195
                Uil_cmd_z_command.ac_resource_file = rac_arg_value[ i+1 ];
 
196
            else
 
197
                diag_issue_diagnostic
 
198
                    ( d_dupl_opt, 
 
199
                      diag_k_no_source, diag_k_no_column,
 
200
                      rac_arg_value[ i ]
 
201
                    );
 
202
            i = i + 1;
 
203
        }
 
204
            
 
205
        /* check for a binary database file */
 
206
 
 
207
        else if ( strcmp("-wmd", rac_arg_value[ i ]) == 0 )
 
208
        {
 
209
            /* the next argument is the binary database file name  */
 
210
 
 
211
            /* check next field is not an option */
 
212
 
 
213
            if (((i+1) >= l_arg_count) ||
 
214
                ( '-' == rac_arg_value[ i+1 ][ 0 ] ))
 
215
            {
 
216
                diag_issue_diagnostic
 
217
                        ( d_miss_opt_arg, 
 
218
                          diag_k_no_source, diag_k_no_column,
 
219
                          rac_arg_value[ i ],
 
220
                          "binary database file"
 
221
                        );
 
222
                continue;
 
223
            }
 
224
 
 
225
            if (!Uil_cmd_z_command.v_database)
 
226
            {
 
227
                Uil_cmd_z_command.v_database = TRUE;
 
228
                Uil_cmd_z_command.ac_database = rac_arg_value[ i+1 ];
 
229
            }
 
230
            else
 
231
                diag_issue_diagnostic
 
232
                    ( d_dupl_opt, 
 
233
                      diag_k_no_source, diag_k_no_column,
 
234
                      rac_arg_value[ i ]
 
235
                    );
 
236
            i = i + 1;
 
237
        }
 
238
 
 
239
        /* check for an listing file */
 
240
 
 
241
        else if ( strcmp("-v", rac_arg_value[ i ]) == 0 )
 
242
        {
 
243
            /* the next argument is the listing file name  */
 
244
 
 
245
            /* check next field is not an option */
 
246
 
 
247
            if (((i+1) >= l_arg_count) ||
 
248
                ( '-' == rac_arg_value[ i+1 ][ 0 ] ))
 
249
            {
 
250
                diag_issue_diagnostic
 
251
                        ( d_miss_opt_arg, 
 
252
                          diag_k_no_source, diag_k_no_column,
 
253
                          rac_arg_value[ i ],
 
254
                          "listing file"
 
255
                        );
 
256
                continue;
 
257
            }
 
258
 
 
259
            if (!Uil_cmd_z_command.v_listing_file)
 
260
            {
 
261
                Uil_cmd_z_command.v_listing_file = TRUE;
 
262
                Uil_cmd_z_command.ac_listing_file = rac_arg_value[ i+1 ];
 
263
            }
 
264
            else
 
265
                diag_issue_diagnostic
 
266
                    ( d_dupl_opt, 
 
267
                      diag_k_no_source, diag_k_no_column,
 
268
                      rac_arg_value[ i ]
 
269
                    );
 
270
            i = i + 1;
 
271
        }
 
272
            
 
273
        /* check for the machine code option */
 
274
 
 
275
        else if ( strcmp("-m", rac_arg_value[ i ]) == 0 )
 
276
        {
 
277
                Uil_cmd_z_command.v_show_machine_code = TRUE;
 
278
        }
 
279
            
 
280
        /* check if warnings are to be supressed */
 
281
 
 
282
        else if ( strcmp("-w", rac_arg_value[ i ]) == 0 )
 
283
        {
 
284
                Uil_cmd_z_command.v_report_info_msg = FALSE;
 
285
                Uil_cmd_z_command.v_report_warn_msg = FALSE;
 
286
        }
 
287
 
 
288
        /* check if setlocale is to be enabled */
 
289
 
 
290
        else if ( strcmp("-s", rac_arg_value[ i ]) == 0 )
 
291
        {
 
292
          Uil_cmd_z_command.v_use_setlocale = TRUE;
 
293
        }
 
294
        
 
295
        /* check for an unexpected option */
 
296
 
 
297
        else if ( '-' == rac_arg_value[ i ][ 0 ] )
 
298
        {
 
299
 
 
300
        /* check for an include directory */
 
301
 
 
302
            if ( 'I' == rac_arg_value[ i ][ 1 ] )
 
303
            {
 
304
                if (Uil_cmd_z_command.include_dir_count < Uil_k_max_include_dir_count)
 
305
                    
 
306
                    include_list[Uil_cmd_z_command.include_dir_count++] = 
 
307
                        & rac_arg_value[i] [2];
 
308
                else
 
309
                    diag_issue_diagnostic
 
310
                        ( d_too_many_dirs, 
 
311
                          diag_k_no_source, diag_k_no_column,
 
312
                          rac_arg_value[ i ], Uil_k_max_include_dir_count
 
313
                        );
 
314
            } else
 
315
            {
 
316
                diag_issue_diagnostic
 
317
                    ( d_unknown_opt, 
 
318
                      diag_k_no_source, diag_k_no_column,
 
319
                      rac_arg_value[ i ]
 
320
                    );
 
321
            }
 
322
        }
 
323
 
 
324
        /* assume it is a UIL source file specification
 
325
         * validation of the file spec is done when file is opened */
 
326
 
 
327
        else
 
328
        {
 
329
            if (Uil_cmd_z_command.ac_source_file == NULL)
 
330
               Uil_cmd_z_command.ac_source_file = rac_arg_value[ i ];
 
331
            else
 
332
                diag_issue_diagnostic
 
333
                    ( d_add_source, 
 
334
                      diag_k_no_source, diag_k_no_column,
 
335
                      rac_arg_value[ i ]
 
336
                    );
 
337
        }
 
338
    }
 
339
 
 
340
    /*
 
341
    **  Check for a source file - otherwise issue a diagnostic.
 
342
    */
 
343
 
 
344
    if (Uil_cmd_z_command.ac_source_file == NULL)
 
345
        diag_issue_diagnostic
 
346
            ( d_no_source, diag_k_no_source, diag_k_no_column );
 
347
 
 
348
    if (Uil_cmd_z_command.ac_resource_file == NULL)
 
349
        {
 
350
        Uil_cmd_z_command.ac_resource_file = XtMalloc (strlen ("a.uid") + 1);
 
351
        strcpy (Uil_cmd_z_command.ac_resource_file,"a.uid");
 
352
        }
 
353
 
 
354
    /*
 
355
    **  Machine code listing only makes sense if listing is set.
 
356
    */
 
357
    
 
358
    Uil_cmd_z_command.v_show_machine_code =
 
359
        ( Uil_cmd_z_command.v_listing_file & 
 
360
          Uil_cmd_z_command.v_show_machine_code);
 
361
}
 
362
 
 
363
 
 
364