Subversion Repositories tendra.SVN

Rev

Rev 2 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2 Rev 7
Line -... Line 1...
-
 
1
/*
-
 
2
 * Copyright (c) 2002-2006 The TenDRA Project <http://www.tendra.org/>.
-
 
3
 * All rights reserved.
-
 
4
 *
-
 
5
 * Redistribution and use in source and binary forms, with or without
-
 
6
 * modification, are permitted provided that the following conditions are met:
-
 
7
 *
-
 
8
 * 1. Redistributions of source code must retain the above copyright notice,
-
 
9
 *    this list of conditions and the following disclaimer.
-
 
10
 * 2. Redistributions in binary form must reproduce the above copyright notice,
-
 
11
 *    this list of conditions and the following disclaimer in the documentation
-
 
12
 *    and/or other materials provided with the distribution.
-
 
13
 * 3. Neither the name of The TenDRA Project nor the names of its contributors
-
 
14
 *    may be used to endorse or promote products derived from this software
-
 
15
 *    without specific, prior written permission.
-
 
16
 *
-
 
17
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
-
 
18
 * IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-
 
19
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-
 
20
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
-
 
21
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-
 
22
 * EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-
 
23
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-
 
24
 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-
 
25
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-
 
26
 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-
 
27
 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
 
28
 *
-
 
29
 * $Id$
-
 
30
 */
1
/*
31
/*
2
    		 Crown Copyright (c) 1997
32
    		 Crown Copyright (c) 1997
3
    
33
 
4
    This TenDRA(r) Computer Program is subject to Copyright
34
    This TenDRA(r) Computer Program is subject to Copyright
5
    owned by the United Kingdom Secretary of State for Defence
35
    owned by the United Kingdom Secretary of State for Defence
6
    acting through the Defence Evaluation and Research Agency
36
    acting through the Defence Evaluation and Research Agency
7
    (DERA).  It is made available to Recipients with a
37
    (DERA).  It is made available to Recipients with a
8
    royalty-free licence for its use, reproduction, transfer
38
    royalty-free licence for its use, reproduction, transfer
9
    to other parties and amendment for any purpose not excluding
39
    to other parties and amendment for any purpose not excluding
10
    product development provided that any such use et cetera
40
    product development provided that any such use et cetera
11
    shall be deemed to be acceptance of the following conditions:-
41
    shall be deemed to be acceptance of the following conditions:-
12
    
42
 
13
        (1) Its Recipients shall ensure that this Notice is
43
        (1) Its Recipients shall ensure that this Notice is
14
        reproduced upon any copies or amended versions of it;
44
        reproduced upon any copies or amended versions of it;
15
    
45
 
16
        (2) Any amended version of it shall be clearly marked to
46
        (2) Any amended version of it shall be clearly marked to
17
        show both the nature of and the organisation responsible
47
        show both the nature of and the organisation responsible
18
        for the relevant amendment or amendments;
48
        for the relevant amendment or amendments;
19
    
49
 
20
        (3) Its onward transfer from a recipient to another
50
        (3) Its onward transfer from a recipient to another
21
        party shall be deemed to be that party's acceptance of
51
        party shall be deemed to be that party's acceptance of
22
        these conditions;
52
        these conditions;
23
    
53
 
24
        (4) DERA gives no warranty or assurance as to its
54
        (4) DERA gives no warranty or assurance as to its
25
        quality or suitability for any purpose and DERA accepts
55
        quality or suitability for any purpose and DERA accepts
26
        no liability whatsoever in relation to any use to which
56
        no liability whatsoever in relation to any use to which
27
        it may be put.
57
        it may be put.
28
*/
58
*/
Line 115... Line 145...
115
#include "solve-cycles.h"
145
#include "solve-cycles.h"
116
 
146
 
117
/*--------------------------------------------------------------------------*/
147
/*--------------------------------------------------------------------------*/
118
 
148
 
119
#define USAGE "\
149
#define USAGE "\
120
\tusage: [mode] [option ...] file ...\n\
150
\tusage:[mode][option ...]file ...\n\
121
\twhere mode is one of: '-mc' (create library), '-ml' (link capsules),\n\
151
\twhere mode is one of: '-mc'(create library), '-ml'(link capsules),\n\
122
\t'-mt' (library table of contents) or '-mx' (extract from library),\n\
152
\t'-mt'(library table of contents)or '-mx'(extract from library),\n\
123
\tand option (for the current mode - default '-ml') is one of:"
153
\tand option(for the current mode - default '-ml')is one of:"
124
#ifndef VERSION
154
#ifndef VERSION
125
#define VERSION "tld version 4.0#7"
155
#define VERSION "tld version 4.0#7"
126
#endif /* !defined (VERSION) */
156
#endif /* !defined (VERSION) */
127
#ifndef RELEASE
157
#ifndef RELEASE
128
#define RELEASE "LOCAL"
158
#define RELEASE "LOCAL"
Line 155... Line 185...
155
static ArgDataT main_arg_data;
185
static ArgDataT main_arg_data;
156
 
186
 
157
/*--------------------------------------------------------------------------*/
187
/*--------------------------------------------------------------------------*/
158
 
188
 
159
static void
189
static void
160
main_print_version PROTO_Z ()
190
main_print_version(void)
161
{
191
{
162
    write_cstring (ostream_error, VERSION);
192
    write_cstring(ostream_error, VERSION);
163
    write_cstring (ostream_error, " (");
193
    write_cstring(ostream_error, " (");
164
    write_cstring (ostream_error, RELEASE);
194
    write_cstring(ostream_error, RELEASE);
165
    write_cstring (ostream_error, ")");
195
    write_cstring(ostream_error, ")");
166
    write_cstring (ostream_error, BANNER);
196
    write_cstring(ostream_error, BANNER);
167
    write_newline (ostream_error);
197
    write_newline(ostream_error);
168
    ostream_flush (ostream_error);
198
    ostream_flush(ostream_error);
169
}
199
}
170
 
200
 
171
static void
201
static void
172
main_handle_all PROTO_N ((option, usage, gclosure, enable))
202
main_handle_all(CStringP  option,			 ArgUsageP usage, 
173
		PROTO_T (CStringP  option X
-
 
174
			 ArgUsageP usage X
-
 
175
			 GenericP  gclosure X
203
			 GenericP  gclosure, 
176
			 BoolT     enable)
204
			 BoolT     enable)
177
{
205
{
178
    UNUSED (option);
206
    UNUSED(option);
179
    UNUSED (usage);
207
    UNUSED(usage);
180
    UNUSED (gclosure);
208
    UNUSED(gclosure);
181
    main_used_other = TRUE;
209
    main_used_other = TRUE;
182
    arg_data_set_extract_all (&main_arg_data, enable);
210
    arg_data_set_extract_all(&main_arg_data, enable);
183
}
211
}
184
 
212
 
185
static void
213
static void
186
main_handle_all_hide_defd PROTO_N ((option, usage, gclosure, enable))
214
main_handle_all_hide_defd(CStringP  option,				   ArgUsageP usage, 
187
			  PROTO_T (CStringP  option X
-
 
188
				   ArgUsageP usage X
-
 
189
				   GenericP  gclosure X
215
				   GenericP  gclosure, 
190
				   BoolT     enable)
216
				   BoolT     enable)
191
{
217
{
192
    UNUSED (option);
218
    UNUSED(option);
193
    UNUSED (usage);
219
    UNUSED(usage);
194
    UNUSED (gclosure);
220
    UNUSED(gclosure);
195
    main_used_other = TRUE;
221
    main_used_other = TRUE;
196
    arg_data_set_all_hide_defd (&main_arg_data, enable);
222
    arg_data_set_all_hide_defd(&main_arg_data, enable);
197
}
223
}
198
 
224
 
199
static void
225
static void
200
main_handle_basename PROTO_N ((option, usage, gclosure, enable))
226
main_handle_basename(CStringP  option,			      ArgUsageP usage, 
201
		     PROTO_T (CStringP  option X
-
 
202
			      ArgUsageP usage X
-
 
203
			      GenericP  gclosure X
227
			      GenericP  gclosure, 
204
			      BoolT     enable)
228
			      BoolT     enable)
205
{
229
{
206
    UNUSED (option);
230
    UNUSED(option);
207
    UNUSED (usage);
231
    UNUSED(usage);
208
    UNUSED (gclosure);
232
    UNUSED(gclosure);
209
    main_used_other = TRUE;
233
    main_used_other = TRUE;
210
    arg_data_set_extract_basename (&main_arg_data, enable);
234
    arg_data_set_extract_basename(&main_arg_data, enable);
211
}
235
}
212
 
236
 
213
static void
237
static void
214
main_handle_debug_file PROTO_N ((option, usage, gclosure, debug_file))
238
main_handle_debug_file(CStringP  option,				ArgUsageP usage, 
215
		       PROTO_T (CStringP  option X
-
 
216
				ArgUsageP usage X
-
 
217
				GenericP  gclosure X
239
				GenericP  gclosure, 
218
				CStringP  debug_file)
240
				CStringP  debug_file)
219
{
241
{
220
    UNUSED (option);
242
    UNUSED(option);
221
    UNUSED (usage);
243
    UNUSED(usage);
222
    UNUSED (gclosure);
244
    UNUSED(gclosure);
223
    main_used_other = TRUE;
245
    main_used_other = TRUE;
224
    arg_data_set_debug_file (&main_arg_data, debug_file);
246
    arg_data_set_debug_file(&main_arg_data, debug_file);
225
}
247
}
226
 
248
 
227
static void
249
static void
228
main_handle_help PROTO_N ((option, usage, gclosure))
250
main_handle_help(CStringP  option,			  ArgUsageP usage, 
229
		 PROTO_T (CStringP  option X
-
 
230
			  ArgUsageP usage X
-
 
231
			  GenericP  gclosure)
251
			  GenericP  gclosure)
232
{
252
{
233
    UNUSED (option);
253
    UNUSED(option);
234
    UNUSED (gclosure);
254
    UNUSED(gclosure);
235
    main_used_one_off = TRUE;
255
    main_used_one_off = TRUE;
236
    write_arg_usage (ostream_error, usage);
256
    write_arg_usage(ostream_error, usage);
237
    write_newline (ostream_error);
257
    write_newline(ostream_error);
238
    ostream_flush (ostream_error);
258
    ostream_flush(ostream_error);
239
}
259
}
240
 
260
 
241
static void
261
static void
242
main_handle_hide PROTO_N ((option, usage, gclosure, shape, name))
262
main_handle_hide(CStringP  option,			  ArgUsageP usage, 
243
		 PROTO_T (CStringP  option X
-
 
244
			  ArgUsageP usage X
-
 
245
			  GenericP  gclosure X
263
			  GenericP  gclosure, 
246
			  CStringP  shape X
264
			  CStringP  shape, 
247
			  CStringP  name)
265
			  CStringP  name)
248
{
266
{
249
    UNUSED (option);
267
    UNUSED(option);
250
    UNUSED (usage);
268
    UNUSED(usage);
251
    UNUSED (gclosure);
269
    UNUSED(gclosure);
252
    main_used_other = TRUE;
270
    main_used_other = TRUE;
253
    arg_data_add_hide (&main_arg_data, shape, name);
271
    arg_data_add_hide(&main_arg_data, shape, name);
254
}
272
}
255
 
273
 
256
static void
274
static void
257
main_handle_hide_defined PROTO_N ((option, usage, gclosure, shape))
275
main_handle_hide_defined(CStringP  option,				  ArgUsageP usage, 
258
			 PROTO_T (CStringP  option X
-
 
259
				  ArgUsageP usage X
-
 
260
				  GenericP  gclosure X
276
				  GenericP  gclosure, 
261
				  CStringP  shape)
277
				  CStringP  shape)
262
{
278
{
263
    UNUSED (option);
279
    UNUSED(option);
264
    UNUSED (usage);
280
    UNUSED(usage);
265
    UNUSED (gclosure);
281
    UNUSED(gclosure);
266
    main_used_other = TRUE;
282
    main_used_other = TRUE;
267
    arg_data_add_hide_defined (&main_arg_data, shape);
283
    arg_data_add_hide_defined(&main_arg_data, shape);
268
}
284
}
269
 
285
 
270
static void
286
static void
271
main_handle_index PROTO_N ((option, usage, gclosure, enable))
287
main_handle_index(CStringP  option,			   ArgUsageP usage, 
272
		  PROTO_T (CStringP  option X
-
 
273
			   ArgUsageP usage X
-
 
274
			   GenericP  gclosure X
288
			   GenericP  gclosure, 
275
			   BoolT     enable)
289
			   BoolT     enable)
276
{
290
{
277
    UNUSED (option);
291
    UNUSED(option);
278
    UNUSED (usage);
292
    UNUSED(usage);
279
    UNUSED (gclosure);
293
    UNUSED(gclosure);
280
    main_used_other = TRUE;
294
    main_used_other = TRUE;
281
    arg_data_set_content_index (&main_arg_data, enable);
295
    arg_data_set_content_index(&main_arg_data, enable);
282
}
296
}
283
 
297
 
284
static void
298
static void
285
main_handle_info PROTO_N ((option, usage, gclosure, enable))
299
main_handle_info(CStringP  option,			  ArgUsageP usage, 
286
		 PROTO_T (CStringP  option X
-
 
287
			  ArgUsageP usage X
-
 
288
			  GenericP  gclosure X
300
			  GenericP  gclosure, 
289
			  BoolT     enable)
301
			  BoolT     enable)
290
{
302
{
291
    UNUSED (option);
303
    UNUSED(option);
292
    UNUSED (usage);
304
    UNUSED(usage);
293
    UNUSED (gclosure);
305
    UNUSED(gclosure);
294
    main_used_other = TRUE;
306
    main_used_other = TRUE;
295
    if (enable) {
307
    if (enable) {
296
	error_set_min_report_severity (ERROR_SEVERITY_INFORMATION);
308
	error_set_min_report_severity(ERROR_SEVERITY_INFORMATION);
297
    } else {
309
    } else {
298
	error_set_min_report_severity (ERROR_SEVERITY_ERROR);
310
	error_set_min_report_severity(ERROR_SEVERITY_ERROR);
299
    }
311
    }
300
}
312
}
301
 
313
 
302
static void
314
static void
303
main_handle_keep PROTO_N ((option, usage, gclosure, shape, name))
315
main_handle_keep(CStringP  option,			  ArgUsageP usage, 
304
		 PROTO_T (CStringP  option X
-
 
305
			  ArgUsageP usage X
-
 
306
			  GenericP  gclosure X
316
			  GenericP  gclosure, 
307
			  CStringP  shape X
317
			  CStringP  shape, 
308
			  CStringP  name)
318
			  CStringP  name)
309
{
319
{
310
    UNUSED (option);
320
    UNUSED(option);
311
    UNUSED (usage);
321
    UNUSED(usage);
312
    UNUSED (gclosure);
322
    UNUSED(gclosure);
313
    main_used_other = TRUE;
323
    main_used_other = TRUE;
314
    arg_data_add_keep (&main_arg_data, shape, name);
324
    arg_data_add_keep(&main_arg_data, shape, name);
315
}
325
}
316
 
326
 
317
static void
327
static void
318
main_handle_keep_all PROTO_N ((option, usage, gclosure, shape))
328
main_handle_keep_all(CStringP  option,			      ArgUsageP usage, 
319
		     PROTO_T (CStringP  option X
-
 
320
			      ArgUsageP usage X
-
 
321
			      GenericP  gclosure X
329
			      GenericP  gclosure, 
322
			      CStringP  shape)
330
			      CStringP  shape)
323
{
331
{
324
    UNUSED (option);
332
    UNUSED(option);
325
    UNUSED (usage);
333
    UNUSED(usage);
326
    UNUSED (gclosure);
334
    UNUSED(gclosure);
327
    main_used_other = TRUE;
335
    main_used_other = TRUE;
328
    arg_data_add_keep_all (&main_arg_data, shape);
336
    arg_data_add_keep_all(&main_arg_data, shape);
329
}
337
}
330
 
338
 
331
static void
339
static void
332
main_handle_library_file PROTO_N ((option, usage, gclosure, library_file))
340
main_handle_library_file(CStringP  option,				  ArgUsageP usage, 
333
			 PROTO_T (CStringP  option X
-
 
334
				  ArgUsageP usage X
-
 
335
				  GenericP  gclosure X
341
				  GenericP  gclosure, 
336
				  CStringP  library_file)
342
				  CStringP  library_file)
337
{
343
{
338
    UNUSED (option);
344
    UNUSED(option);
339
    UNUSED (usage);
345
    UNUSED(usage);
340
    UNUSED (gclosure);
346
    UNUSED(gclosure);
341
    main_used_other = TRUE;
347
    main_used_other = TRUE;
342
    arg_data_add_library_file (&main_arg_data, library_file);
348
    arg_data_add_library_file(&main_arg_data, library_file);
343
}
349
}
344
 
350
 
345
static void
351
static void
346
main_handle_match_base PROTO_N ((option, usage, gclosure, enable))
352
main_handle_match_base(CStringP  option,				ArgUsageP usage, 
347
		       PROTO_T (CStringP  option X
-
 
348
				ArgUsageP usage X
-
 
349
				GenericP  gclosure X
353
				GenericP  gclosure, 
350
				BoolT     enable)
354
				BoolT     enable)
351
{
355
{
352
    UNUSED (option);
356
    UNUSED(option);
353
    UNUSED (usage);
357
    UNUSED(usage);
354
    UNUSED (gclosure);
358
    UNUSED(gclosure);
355
    main_used_other = TRUE;
359
    main_used_other = TRUE;
356
    arg_data_set_extract_match_base (&main_arg_data, enable);
360
    arg_data_set_extract_match_base(&main_arg_data, enable);
357
}
361
}
358
 
362
 
359
static void
363
static void
360
main_handle_output_file PROTO_N ((option, usage, gclosure, output_file))
364
main_handle_output_file(CStringP  option,				 ArgUsageP usage, 
361
			PROTO_T (CStringP  option X
-
 
362
				 ArgUsageP usage X
-
 
363
				 GenericP  gclosure X
365
				 GenericP  gclosure, 
364
				 CStringP  output_file)
366
				 CStringP  output_file)
365
{
367
{
366
    UNUSED (option);
368
    UNUSED(option);
367
    UNUSED (usage);
369
    UNUSED(usage);
368
    UNUSED (gclosure);
370
    UNUSED(gclosure);
369
    main_used_other = TRUE;
371
    main_used_other = TRUE;
370
    arg_data_set_output_file (&main_arg_data, output_file);
372
    arg_data_set_output_file(&main_arg_data, output_file);
371
}
373
}
372
 
374
 
373
static void
375
static void
374
main_handle_library_path PROTO_N ((option, usage, gclosure, directory))
376
main_handle_library_path(CStringP  option,				  ArgUsageP usage, 
375
			 PROTO_T (CStringP  option X
-
 
376
				  ArgUsageP usage X
-
 
377
				  GenericP  gclosure X
377
				  GenericP  gclosure, 
378
				  CStringP  directory)
378
				  CStringP  directory)
379
{
379
{
380
    UNUSED (option);
380
    UNUSED(option);
381
    UNUSED (usage);
381
    UNUSED(usage);
382
    UNUSED (gclosure);
382
    UNUSED(gclosure);
383
    main_used_other = TRUE;
383
    main_used_other = TRUE;
384
    arg_data_add_library_path (&main_arg_data, directory);
384
    arg_data_add_library_path(&main_arg_data, directory);
385
}
385
}
386
 
386
 
387
static void
387
static void
388
main_handle_rename PROTO_N ((option, usage, gclosure, shape, from, to))
388
main_handle_rename(CStringP  option,			    ArgUsageP usage, 
389
		   PROTO_T (CStringP  option X
-
 
390
			    ArgUsageP usage X
-
 
391
			    GenericP  gclosure X
389
			    GenericP  gclosure, 
392
			    CStringP  shape X
390
			    CStringP  shape, 
393
			    CStringP  from X
391
			    CStringP  from, 
394
			    CStringP  to)
392
			    CStringP  to)
395
{
393
{
396
    UNUSED (option);
394
    UNUSED(option);
397
    UNUSED (usage);
395
    UNUSED(usage);
398
    UNUSED (gclosure);
396
    UNUSED(gclosure);
399
    main_used_other = TRUE;
397
    main_used_other = TRUE;
400
    arg_data_parse_rename (&main_arg_data, shape, from, to);
398
    arg_data_parse_rename(&main_arg_data, shape, from, to);
401
}
399
}
402
 
400
 
403
static void
401
static void
404
main_handle_rename_file PROTO_N ((option, usage, gclosure, name))
402
main_handle_rename_file(CStringP  option,				 ArgUsageP usage, 
405
			PROTO_T (CStringP  option X
-
 
406
				 ArgUsageP usage X
-
 
407
				 GenericP  gclosure X
403
				 GenericP  gclosure, 
408
				 CStringP  name)
404
				 CStringP  name)
409
{
405
{
410
    UNUSED (option);
406
    UNUSED(option);
411
    UNUSED (usage);
407
    UNUSED(usage);
412
    UNUSED (gclosure);
408
    UNUSED(gclosure);
413
    main_used_other = TRUE;
409
    main_used_other = TRUE;
414
    rename_file_parse (name, &main_arg_data);
410
    rename_file_parse(name, &main_arg_data);
415
}
411
}
416
 
412
 
417
static void
413
static void
418
main_handle_show_errors PROTO_N ((option, usage, gclosure))
414
main_handle_show_errors(CStringP  option,				 ArgUsageP usage, 
419
			PROTO_T (CStringP  option X
-
 
420
				 ArgUsageP usage X
-
 
421
				 GenericP  gclosure)
415
				 GenericP  gclosure)
422
{
416
{
423
    UNUSED (option);
417
    UNUSED(option);
424
    UNUSED (usage);
418
    UNUSED(usage);
425
    UNUSED (gclosure);
419
    UNUSED(gclosure);
426
    main_used_one_off = TRUE;
420
    main_used_one_off = TRUE;
427
    write_error_file (ostream_output);
421
    write_error_file(ostream_output);
428
    ostream_flush (ostream_output);
422
    ostream_flush(ostream_output);
429
}
423
}
430
 
424
 
431
static void
425
static void
432
main_handle_size PROTO_N ((option, usage, gclosure, enable))
426
main_handle_size(CStringP  option,			  ArgUsageP usage, 
433
		 PROTO_T (CStringP  option X
-
 
434
			  ArgUsageP usage X
-
 
435
			  GenericP  gclosure X
427
			  GenericP  gclosure, 
436
			  BoolT     enable)
428
			  BoolT     enable)
437
{
429
{
438
    UNUSED (option);
430
    UNUSED(option);
439
    UNUSED (usage);
431
    UNUSED(usage);
440
    UNUSED (gclosure);
432
    UNUSED(gclosure);
441
    main_used_other = TRUE;
433
    main_used_other = TRUE;
442
    arg_data_set_content_size (&main_arg_data, enable);
434
    arg_data_set_content_size(&main_arg_data, enable);
443
}
435
}
444
 
436
 
445
static void
437
static void
446
main_handle_suppress PROTO_N ((option, usage, gclosure, shape, name))
438
main_handle_suppress(CStringP  option,			      ArgUsageP usage, 
447
		     PROTO_T (CStringP  option X
-
 
448
			      ArgUsageP usage X
-
 
449
			      GenericP  gclosure X
439
			      GenericP  gclosure, 
450
			      CStringP  shape X
440
			      CStringP  shape, 
451
			      CStringP  name)
441
			      CStringP  name)
452
{
442
{
453
    UNUSED (option);
443
    UNUSED(option);
454
    UNUSED (usage);
444
    UNUSED(usage);
455
    UNUSED (gclosure);
445
    UNUSED(gclosure);
456
    main_used_other = TRUE;
446
    main_used_other = TRUE;
457
    arg_data_add_suppress (&main_arg_data, shape, name);
447
    arg_data_add_suppress(&main_arg_data, shape, name);
458
}
448
}
459
 
449
 
460
static void
450
static void
461
main_handle_suppress_all PROTO_N ((option, usage, gclosure, shape))
451
main_handle_suppress_all(CStringP  option,				  ArgUsageP usage, 
462
			 PROTO_T (CStringP  option X
-
 
463
				  ArgUsageP usage X
-
 
464
				  GenericP  gclosure X
452
				  GenericP  gclosure, 
465
				  CStringP  shape)
453
				  CStringP  shape)
466
{
454
{
467
    UNUSED (option);
455
    UNUSED(option);
468
    UNUSED (usage);
456
    UNUSED(usage);
469
    UNUSED (gclosure);
457
    UNUSED(gclosure);
470
    main_used_other = TRUE;
458
    main_used_other = TRUE;
471
    arg_data_add_suppress_all (&main_arg_data, shape);
459
    arg_data_add_suppress_all(&main_arg_data, shape);
472
}
460
}
473
 
461
 
474
static void
462
static void
475
main_handle_suppress_mult PROTO_N ((option, usage, gclosure, enable))
463
main_handle_suppress_mult(CStringP  option,				   ArgUsageP usage, 
476
			  PROTO_T (CStringP  option X
-
 
477
				   ArgUsageP usage X
-
 
478
				   GenericP  gclosure X
464
				   GenericP  gclosure, 
479
				   BoolT     enable)
465
				   BoolT     enable)
480
{
466
{
481
    UNUSED (option);
467
    UNUSED(option);
482
    UNUSED (usage);
468
    UNUSED(usage);
483
    UNUSED (gclosure);
469
    UNUSED(gclosure);
484
    main_used_other = TRUE;
470
    main_used_other = TRUE;
485
    arg_data_set_suppress_mult (&main_arg_data, enable);
471
    arg_data_set_suppress_mult(&main_arg_data, enable);
486
}
472
}
487
 
473
 
488
static void
474
static void
489
main_handle_tdf_version PROTO_N ((option, usage, gclosure, enable))
475
main_handle_tdf_version(CStringP  option,				 ArgUsageP usage, 
490
    			PROTO_T (CStringP  option X
-
 
491
				 ArgUsageP usage X
-
 
492
				 GenericP  gclosure X
476
				 GenericP  gclosure, 
493
				 BoolT     enable)
477
				 BoolT     enable)
494
{
478
{
495
    UNUSED (option);
479
    UNUSED(option);
496
    UNUSED (usage);
480
    UNUSED(usage);
497
    UNUSED (gclosure);
481
    UNUSED(gclosure);
498
    main_used_other = TRUE;
482
    main_used_other = TRUE;
499
    arg_data_set_content_version (&main_arg_data, enable);
483
    arg_data_set_content_version(&main_arg_data, enable);
500
}
484
}
501
 
485
 
502
static void
486
static void
503
main_handle_unit_file PROTO_N ((option, usage, gclosure, unit_file))
487
main_handle_unit_file(CStringP  option,			       ArgUsageP usage, 
504
		      PROTO_T (CStringP  option X
-
 
505
			       ArgUsageP usage X
-
 
506
			       GenericP  gclosure X
488
			       GenericP  gclosure, 
507
			       CStringP  unit_file)
489
			       CStringP  unit_file)
508
{
490
{
509
    UNUSED (option);
491
    UNUSED(option);
510
    UNUSED (usage);
492
    UNUSED(usage);
511
    UNUSED (gclosure);
493
    UNUSED(gclosure);
512
    main_used_other = TRUE;
494
    main_used_other = TRUE;
513
    arg_data_set_unit_file (&main_arg_data, unit_file);
495
    arg_data_set_unit_file(&main_arg_data, unit_file);
514
}
496
}
515
 
497
 
516
static void
498
static void
517
main_handle_version PROTO_N ((option, usage, gclosure))
499
main_handle_version(CStringP  option,			     ArgUsageP usage, 
518
		    PROTO_T (CStringP  option X
-
 
519
			     ArgUsageP usage X
-
 
520
			     GenericP  gclosure)
500
			     GenericP  gclosure)
521
{
501
{
522
    UNUSED (option);
502
    UNUSED(option);
523
    UNUSED (usage);
503
    UNUSED(usage);
524
    UNUSED (gclosure);
504
    UNUSED(gclosure);
525
    main_used_one_off = TRUE;
505
    main_used_one_off = TRUE;
526
    main_print_version ();
506
    main_print_version();
527
}
507
}
528
 
508
 
529
static void
509
static void
530
main_handle_warning PROTO_N ((option, usage, gclosure, enable))
510
main_handle_warning(CStringP  option,			     ArgUsageP usage, 
531
		    PROTO_T (CStringP  option X
-
 
532
			     ArgUsageP usage X
-
 
533
			     GenericP  gclosure X
511
			     GenericP  gclosure, 
534
			     BoolT     enable)
512
			     BoolT     enable)
535
{
513
{
536
    UNUSED (option);
514
    UNUSED(option);
537
    UNUSED (usage);
515
    UNUSED(usage);
538
    UNUSED (gclosure);
516
    UNUSED(gclosure);
539
    main_used_other = TRUE;
517
    main_used_other = TRUE;
540
    if (enable) {
518
    if (enable) {
541
	error_set_min_report_severity (ERROR_SEVERITY_WARNING);
519
	error_set_min_report_severity(ERROR_SEVERITY_WARNING);
542
    } else {
520
    } else {
543
	error_set_min_report_severity (ERROR_SEVERITY_ERROR);
521
	error_set_min_report_severity(ERROR_SEVERITY_ERROR);
544
    }
522
    }
545
}
523
}
546
 
524
 
547
/*--------------------------------------------------------------------------*/
525
/*--------------------------------------------------------------------------*/
548
 
526
 
549
static EStringDataT main_description_strings [] = {
527
static EStringDataT main_description_strings[] = {
550
    UB {
528
    UB {
551
	"description of all",
529
	"description of all",
552
	"\n\tEnable/disable extraction of all capsules."
530
	"\n\tEnable/disable extraction of all capsules."
553
    } UE, UB {
531
    } UE, UB {
554
	"description of all-hide-defined",
532
	"description of all-hide-defined",
Line 592... Line 570...
592
    } UE, UB {
570
    } UE, UB {
593
	"description of match-basename",
571
	"description of match-basename",
594
	"\n\tEnable/disable matching capsules by their basename"
572
	"\n\tEnable/disable matching capsules by their basename"
595
    } UE, UB {
573
    } UE, UB {
596
	"description of output-file",
574
	"description of output-file",
597
	" FILE\n\tWrite output to FILE (default 'library.tl')."
575
	" FILE\n\tWrite output to FILE(default 'library.tl')."
598
    } UE, UB {
576
    } UE, UB {
599
	"description of path",
577
	"description of path",
600
	" DIRECTORY\n\tAppend DIRECTORY to library search path."
578
	" DIRECTORY\n\tAppend DIRECTORY to library search path."
601
    } UE, UB {
579
    } UE, UB {
602
	"description of L",
580
	"description of L",
Line 638... Line 616...
638
};
616
};
639
 
617
 
640
#ifdef __TenDRA__
618
#ifdef __TenDRA__
641
/* Some conversions to ArgProcP are slightly suspect */
619
/* Some conversions to ArgProcP are slightly suspect */
642
#pragma TenDRA begin
620
#pragma TenDRA begin
643
#pragma TenDRA conversion analysis (pointer-pointer) off
621
#pragma TenDRA conversion analysis(pointer-pointer)off
644
#endif
622
#endif
645
 
623
 
646
static ArgListT main_builder_arg_list [] = {
624
static ArgListT main_builder_arg_list[] = {
647
    {
625
    {
648
	"debug-file", 'd',			AT_FOLLOWING,
626
	"debug-file", 'd',			AT_FOLLOWING,
649
	(ArgProcP) main_handle_debug_file,	NIL (GenericP),
627
	(ArgProcP)main_handle_debug_file,	NIL(GenericP),
650
	UB "description of debug-file" UE
628
	UB "description of debug-file" UE
651
    }, {
629
    }, {
652
	"help", '?',				AT_EMPTY,
630
	"help", '?',				AT_EMPTY,
653
	(ArgProcP) main_handle_help,		NIL (GenericP),
631
	(ArgProcP)main_handle_help,		NIL(GenericP),
654
	UB "description of help" UE
632
	UB "description of help" UE
655
    }, {
633
    }, {
656
	"include-library", 'i',			AT_FOLLOWING,
634
	"include-library", 'i',			AT_FOLLOWING,
657
	(ArgProcP) main_handle_library_file,	NIL (GenericP),
635
	(ArgProcP)main_handle_library_file,	NIL(GenericP),
658
	UB "description of include-library" UE
636
	UB "description of include-library" UE
659
    }, {
637
    }, {
660
	"output-file", 'o',			AT_FOLLOWING,
638
	"output-file", 'o',			AT_FOLLOWING,
661
	(ArgProcP) main_handle_output_file,	NIL (GenericP),
639
	(ArgProcP)main_handle_output_file,	NIL(GenericP),
662
	UB "description of output-file" UE
640
	UB "description of output-file" UE
663
    }, {
641
    }, {
664
	"show-errors", 'e',			AT_EMPTY,
642
	"show-errors", 'e',			AT_EMPTY,
665
	(ArgProcP) main_handle_show_errors,	NIL (GenericP),
643
	(ArgProcP)main_handle_show_errors,	NIL(GenericP),
666
	UB "description of show-errors" UE
644
	UB "description of show-errors" UE
667
    }, {
645
    }, {
668
	"suppress", 's',			AT_FOLLOWING2,
646
	"suppress", 's',			AT_FOLLOWING2,
669
	(ArgProcP) main_handle_suppress,	NIL (GenericP),
647
	(ArgProcP)main_handle_suppress,	NIL(GenericP),
670
	UB "description of suppress" UE
648
	UB "description of suppress" UE
671
    }, {
649
    }, {
672
	"suppress-all", 'S',			AT_FOLLOWING,
650
	"suppress-all", 'S',			AT_FOLLOWING,
673
	(ArgProcP) main_handle_suppress_all,	NIL (GenericP),
651
	(ArgProcP)main_handle_suppress_all,	NIL(GenericP),
674
	UB "description of suppress-all" UE
652
	UB "description of suppress-all" UE
675
    }, {
653
    }, {
676
	"suppress-mult", 'M',			AT_PROC_SWITCH,
654
	"suppress-mult", 'M',			AT_PROC_SWITCH,
677
	(ArgProcP) main_handle_suppress_mult,	NIL (GenericP),
655
	(ArgProcP)main_handle_suppress_mult,	NIL(GenericP),
678
	UB "description of suppress-mult" UE
656
	UB "description of suppress-mult" UE
679
    }, {
657
    }, {
680
	"unit-file", 'u',			AT_FOLLOWING,
658
	"unit-file", 'u',			AT_FOLLOWING,
681
	(ArgProcP) main_handle_unit_file,	NIL (GenericP),
659
	(ArgProcP)main_handle_unit_file,	NIL(GenericP),
682
	UB "description of unit-file" UE
660
	UB "description of unit-file" UE
683
    }, {
661
    }, {
684
	"version", 'v',				AT_EMPTY,
662
	"version", 'v',				AT_EMPTY,
685
	(ArgProcP) main_handle_version,		NIL (GenericP),
663
	(ArgProcP)main_handle_version,		NIL(GenericP),
686
	UB "description of version" UE
664
	UB "description of version" UE
687
    }, ARG_PARSE_END_LIST
665
    }, ARG_PARSE_END_LIST
688
};
666
};
689
 
667
 
690
static ArgListT main_contents_arg_list [] = {
668
static ArgListT main_contents_arg_list[] = {
691
    {
669
    {
692
	"debug-file", 'd',			AT_FOLLOWING,
670
	"debug-file", 'd',			AT_FOLLOWING,
693
	(ArgProcP) main_handle_debug_file,	NIL (GenericP),
671
	(ArgProcP)main_handle_debug_file,	NIL(GenericP),
694
	UB "description of debug-file" UE
672
	UB "description of debug-file" UE
695
    }, {
673
    }, {
696
	"help", '?',				AT_EMPTY,
674
	"help", '?',				AT_EMPTY,
697
	(ArgProcP) main_handle_help,		NIL (GenericP),
675
	(ArgProcP)main_handle_help,		NIL(GenericP),
698
	UB "description of help" UE
676
	UB "description of help" UE
699
    }, {
677
    }, {
700
	"index", 'i',				AT_PROC_SWITCH,
678
	"index", 'i',				AT_PROC_SWITCH,
701
	(ArgProcP) main_handle_index,		NIL (GenericP),
679
	(ArgProcP)main_handle_index,		NIL(GenericP),
702
	UB "description of index" UE
680
	UB "description of index" UE
703
    }, {
681
    }, {
704
	"show-errors", 'e',			AT_EMPTY,
682
	"show-errors", 'e',			AT_EMPTY,
705
	(ArgProcP) main_handle_show_errors,	NIL (GenericP),
683
	(ArgProcP)main_handle_show_errors,	NIL(GenericP),
706
	UB "description of show-errors" UE
684
	UB "description of show-errors" UE
707
    }, {
685
    }, {
708
	"size", 's',				AT_PROC_SWITCH,
686
	"size", 's',				AT_PROC_SWITCH,
709
	(ArgProcP) main_handle_size,		NIL (GenericP),
687
	(ArgProcP)main_handle_size,		NIL(GenericP),
710
	UB "description of size" UE
688
	UB "description of size" UE
711
    }, {
689
    }, {
712
	"tdf-version", 't',			AT_PROC_SWITCH,
690
	"tdf-version", 't',			AT_PROC_SWITCH,
713
	(ArgProcP) main_handle_tdf_version,	NIL (GenericP),
691
	(ArgProcP)main_handle_tdf_version,	NIL(GenericP),
714
	UB "description of tdf-version" UE
692
	UB "description of tdf-version" UE
715
    }, {
693
    }, {
716
	"version", 'v',				AT_EMPTY,
694
	"version", 'v',				AT_EMPTY,
717
	(ArgProcP) main_handle_version,		NIL (GenericP),
695
	(ArgProcP)main_handle_version,		NIL(GenericP),
718
	UB "description of version" UE
696
	UB "description of version" UE
719
    }, ARG_PARSE_END_LIST
697
    }, ARG_PARSE_END_LIST
720
};
698
};
721
 
699
 
722
static ArgListT main_extract_arg_list [] = {
700
static ArgListT main_extract_arg_list[] = {
723
    {
701
    {
724
	"all", 'a',				AT_PROC_SWITCH,
702
	"all", 'a',				AT_PROC_SWITCH,
725
	(ArgProcP) main_handle_all,		NIL (GenericP),
703
	(ArgProcP)main_handle_all,		NIL(GenericP),
726
	UB "description of all" UE
704
	UB "description of all" UE
727
    }, {
705
    }, {
728
	"basename", 'b',			AT_PROC_SWITCH,
706
	"basename", 'b',			AT_PROC_SWITCH,
729
	(ArgProcP) main_handle_basename,	NIL (GenericP),
707
	(ArgProcP)main_handle_basename,	NIL(GenericP),
730
	UB "description of basename" UE
708
	UB "description of basename" UE
731
    }, {
709
    }, {
732
	"debug-file", 'd',			AT_FOLLOWING,
710
	"debug-file", 'd',			AT_FOLLOWING,
733
	(ArgProcP) main_handle_debug_file,	NIL (GenericP),
711
	(ArgProcP)main_handle_debug_file,	NIL(GenericP),
734
	UB "description of debug-file" UE
712
	UB "description of debug-file" UE
735
    }, {
713
    }, {
736
	"show-errors", 'e',			AT_EMPTY,
714
	"show-errors", 'e',			AT_EMPTY,
737
	(ArgProcP) main_handle_show_errors,	NIL (GenericP),
715
	(ArgProcP)main_handle_show_errors,	NIL(GenericP),
738
	UB "description of show-errors" UE
716
	UB "description of show-errors" UE
739
    }, {
717
    }, {
740
	"help", '?',				AT_EMPTY,
718
	"help", '?',				AT_EMPTY,
741
	(ArgProcP) main_handle_help,		NIL (GenericP),
719
	(ArgProcP)main_handle_help,		NIL(GenericP),
742
	UB "description of help" UE
720
	UB "description of help" UE
743
    }, {
721
    }, {
744
	"info", 'i',				AT_PROC_SWITCH,
722
	"info", 'i',				AT_PROC_SWITCH,
745
	(ArgProcP) main_handle_info,		NIL (GenericP),
723
	(ArgProcP)main_handle_info,		NIL(GenericP),
746
	UB "description of info" UE
724
	UB "description of info" UE
747
    }, {
725
    }, {
748
	"match-basename", 'm',			AT_PROC_SWITCH,
726
	"match-basename", 'm',			AT_PROC_SWITCH,
749
	(ArgProcP) main_handle_match_base,	NIL (GenericP),
727
	(ArgProcP)main_handle_match_base,	NIL(GenericP),
750
	UB "description of match-basename" UE
728
	UB "description of match-basename" UE
751
    }, {
729
    }, {
752
	"version", 'v',				AT_EMPTY,
730
	"version", 'v',				AT_EMPTY,
753
	(ArgProcP) main_handle_version,		NIL (GenericP),
731
	(ArgProcP)main_handle_version,		NIL(GenericP),
754
	UB "description of version" UE
732
	UB "description of version" UE
755
    }, ARG_PARSE_END_LIST
733
    }, ARG_PARSE_END_LIST
756
};
734
};
757
 
735
 
758
static ArgListT main_linker_arg_list [] = {
736
static ArgListT main_linker_arg_list[] = {
759
    {
737
    {
760
	"all-hide-defined", 'a',		AT_PROC_SWITCH,
738
	"all-hide-defined", 'a',		AT_PROC_SWITCH,
761
	(ArgProcP) main_handle_all_hide_defd,	NIL (GenericP),
739
	(ArgProcP)main_handle_all_hide_defd,	NIL(GenericP),
762
	UB "description of all-hide-defined" UE
740
	UB "description of all-hide-defined" UE
763
    }, {
741
    }, {
764
	"debug-file", 'd',			AT_FOLLOWING,
742
	"debug-file", 'd',			AT_FOLLOWING,
765
	(ArgProcP) main_handle_debug_file,	NIL (GenericP),
743
	(ArgProcP)main_handle_debug_file,	NIL(GenericP),
766
	UB "description of debug-file" UE
744
	UB "description of debug-file" UE
767
    }, {
745
    }, {
768
	"help", '?',				AT_EMPTY,
746
	"help", '?',				AT_EMPTY,
769
	(ArgProcP) main_handle_help,		NIL (GenericP),
747
	(ArgProcP)main_handle_help,		NIL(GenericP),
770
	UB "description of help" UE
748
	UB "description of help" UE
771
    }, {
749
    }, {
772
	"hide", 'h',				AT_FOLLOWING2,
750
	"hide", 'h',				AT_FOLLOWING2,
773
	(ArgProcP) main_handle_hide,		NIL (GenericP),
751
	(ArgProcP)main_handle_hide,		NIL(GenericP),
774
	UB "description of hide" UE
752
	UB "description of hide" UE
775
    }, {
753
    }, {
776
	"hide-defined", 'H',			AT_FOLLOWING,
754
	"hide-defined", 'H',			AT_FOLLOWING,
777
	(ArgProcP) main_handle_hide_defined,	NIL (GenericP),
755
	(ArgProcP)main_handle_hide_defined,	NIL(GenericP),
778
	UB "description of hide-defined" UE
756
	UB "description of hide-defined" UE
779
    }, {
757
    }, {
780
	"keep", 'k',				AT_FOLLOWING2,
758
	"keep", 'k',				AT_FOLLOWING2,
781
	(ArgProcP) main_handle_keep,		NIL (GenericP),
759
	(ArgProcP)main_handle_keep,		NIL(GenericP),
782
	UB "description of keep" UE
760
	UB "description of keep" UE
783
    }, {
761
    }, {
784
	"keep-all", 'K',			AT_FOLLOWING,
762
	"keep-all", 'K',			AT_FOLLOWING,
785
	(ArgProcP) main_handle_keep_all,	NIL (GenericP),
763
	(ArgProcP)main_handle_keep_all,	NIL(GenericP),
786
	UB "description of keep-all" UE
764
	UB "description of keep-all" UE
787
    }, {
765
    }, {
788
	"library", '\0',			AT_FOLLOWING,
766
	"library", '\0',			AT_FOLLOWING,
789
	(ArgProcP) main_handle_library_file,	NIL (GenericP),
767
	(ArgProcP)main_handle_library_file,	NIL(GenericP),
790
	UB "description of library-file" UE
768
	UB "description of library-file" UE
791
    }, {
769
    }, {
792
	NIL (CStringP), 'l',			AT_EITHER,
770
	NIL(CStringP), 'l',			AT_EITHER,
793
	(ArgProcP) main_handle_library_file,	NIL (GenericP),
771
	(ArgProcP)main_handle_library_file,	NIL(GenericP),
794
	UB "description of l" UE
772
	UB "description of l" UE
795
    }, {
773
    }, {
796
	"output-file", 'o',			AT_FOLLOWING,
774
	"output-file", 'o',			AT_FOLLOWING,
797
	(ArgProcP) main_handle_output_file,	NIL (GenericP),
775
	(ArgProcP)main_handle_output_file,	NIL(GenericP),
798
	UB "description of output-file" UE
776
	UB "description of output-file" UE
799
    }, {
777
    }, {
800
	"path", '\0',				AT_FOLLOWING,
778
	"path", '\0',				AT_FOLLOWING,
801
	(ArgProcP) main_handle_library_path,	NIL (GenericP),
779
	(ArgProcP)main_handle_library_path,	NIL(GenericP),
802
	UB "description of path" UE
780
	UB "description of path" UE
803
    }, {
781
    }, {
804
	NIL (CStringP), 'L',			AT_EITHER,
782
	NIL(CStringP), 'L',			AT_EITHER,
805
	(ArgProcP) main_handle_library_path,	NIL (GenericP),
783
	(ArgProcP)main_handle_library_path,	NIL(GenericP),
806
	UB "description of L" UE
784
	UB "description of L" UE
807
    }, {
785
    }, {
808
	"rename", 'r',				AT_FOLLOWING3,
786
	"rename", 'r',				AT_FOLLOWING3,
809
	(ArgProcP) main_handle_rename,		NIL (GenericP),
787
	(ArgProcP)main_handle_rename,		NIL(GenericP),
810
	UB "description of rename" UE
788
	UB "description of rename" UE
811
    }, {
789
    }, {
812
	"rename-file", 'R',			AT_FOLLOWING,
790
	"rename-file", 'R',			AT_FOLLOWING,
813
	(ArgProcP) main_handle_rename_file,	NIL (GenericP),
791
	(ArgProcP)main_handle_rename_file,	NIL(GenericP),
814
	UB "description of rename-file" UE
792
	UB "description of rename-file" UE
815
    }, {
793
    }, {
816
	"show-errors", 'e',			AT_EMPTY,
794
	"show-errors", 'e',			AT_EMPTY,
817
	(ArgProcP) main_handle_show_errors,	NIL (GenericP),
795
	(ArgProcP)main_handle_show_errors,	NIL(GenericP),
818
	UB "description of show-errors" UE
796
	UB "description of show-errors" UE
819
    }, {
797
    }, {
820
	"suppress", 's',			AT_FOLLOWING2,
798
	"suppress", 's',			AT_FOLLOWING2,
821
	(ArgProcP) main_handle_suppress,	NIL (GenericP),
799
	(ArgProcP)main_handle_suppress,	NIL(GenericP),
822
	UB "description of suppress" UE
800
	UB "description of suppress" UE
823
    }, {
801
    }, {
824
	"suppress-all", 'S',			AT_FOLLOWING,
802
	"suppress-all", 'S',			AT_FOLLOWING,
825
	(ArgProcP) main_handle_suppress_all,	NIL (GenericP),
803
	(ArgProcP)main_handle_suppress_all,	NIL(GenericP),
826
	UB "description of suppress-all" UE
804
	UB "description of suppress-all" UE
827
    }, {
805
    }, {
828
	"suppress-mult", 'M',			AT_PROC_SWITCH,
806
	"suppress-mult", 'M',			AT_PROC_SWITCH,
829
	(ArgProcP) main_handle_suppress_mult,	NIL (GenericP),
807
	(ArgProcP)main_handle_suppress_mult,	NIL(GenericP),
830
	UB "description of suppress-mult" UE
808
	UB "description of suppress-mult" UE
831
    }, {
809
    }, {
832
	"unit-file", 'u',			AT_FOLLOWING,
810
	"unit-file", 'u',			AT_FOLLOWING,
833
	(ArgProcP) main_handle_unit_file,	NIL (GenericP),
811
	(ArgProcP)main_handle_unit_file,	NIL(GenericP),
834
	UB "description of unit-file" UE
812
	UB "description of unit-file" UE
835
    }, {
813
    }, {
836
	"version", 'v',				AT_EMPTY,
814
	"version", 'v',				AT_EMPTY,
837
	(ArgProcP) main_handle_version,		NIL (GenericP),
815
	(ArgProcP)main_handle_version,		NIL(GenericP),
838
	UB "description of version" UE
816
	UB "description of version" UE
839
    }, {
817
    }, {
840
	"warnings", 'w',			AT_PROC_SWITCH,
818
	"warnings", 'w',			AT_PROC_SWITCH,
841
	(ArgProcP) main_handle_warning,		NIL (GenericP),
819
	(ArgProcP)main_handle_warning,		NIL(GenericP),
842
	UB "description of warning" UE
820
	UB "description of warning" UE
843
    }, ARG_PARSE_END_LIST
821
    }, ARG_PARSE_END_LIST
844
};
822
};
845
 
823
 
846
#ifdef __TenDRA__
824
#ifdef __TenDRA__
Line 848... Line 826...
848
#endif
826
#endif
849
 
827
 
850
/*--------------------------------------------------------------------------*/
828
/*--------------------------------------------------------------------------*/
851
 
829
 
852
static ModeT
830
static ModeT
853
main_init PROTO_N ((argc, argv))
831
main_init(int    argc,		   char **argv)
854
	  PROTO_T (int    argc X
-
 
855
		   char **argv)
-
 
856
{
832
{
857
    EStringP  usage_estring = error_define_string ("tld usage message", USAGE);
833
    EStringP  usage_estring = error_define_string("tld usage message", USAGE);
858
    ModeT     mode          = MODE_LINKER;
834
    ModeT     mode          = MODE_LINKER;
859
    ArgListP  arg_list      = main_linker_arg_list;
835
    ArgListP  arg_list      = main_linker_arg_list;
860
    CStringP  error_file;
836
    CStringP  error_file;
861
    int       skip;
837
    int       skip;
862
 
838
 
863
    error_init (argv [0], gen_errors_init_errors);
839
    error_init(argv[0], gen_errors_init_errors);
864
    error_intern_strings (main_description_strings);
840
    error_intern_strings(main_description_strings);
865
    if ((error_file = getenv ("TLD_ERROR_FILE")) != NIL (CStringP)) {
841
    if ((error_file = getenv("TLD_ERROR_FILE")) != NIL(CStringP)) {
866
	error_file_parse (error_file, FALSE);
842
	error_file_parse(error_file, FALSE);
867
    }
843
    }
868
    argc --;
844
    argc--;
869
    argv ++;
845
    argv++;
870
  retry:
846
  retry:
871
    if ((argc > 0) && (argv [0][0] == '-') && (argv [0][1] == 'm')) {
847
    if ((argc > 0) && (argv[0][0] == '-') && (argv[0][1] == 'm')) {
872
	char c = argv [0][2];
848
	char c = argv[0][2];
873
 
849
 
874
	argc --;
850
	argc--;
875
	argv ++;
851
	argv++;
876
	switch (c) {
852
	switch (c) {
877
	  case 'c':
853
	  case 'c':
878
	    mode     = MODE_BUILDER;
854
	    mode     = MODE_BUILDER;
879
	    arg_list = main_builder_arg_list;
855
	    arg_list = main_builder_arg_list;
880
	    arg_data_init (&main_arg_data, "library.tl");
856
	    arg_data_init(&main_arg_data, "library.tl");
881
	    break;
857
	    break;
882
	  case 't':
858
	  case 't':
883
	    mode     = MODE_CONTENTS;
859
	    mode     = MODE_CONTENTS;
884
	    arg_list = main_contents_arg_list;
860
	    arg_list = main_contents_arg_list;
885
	    arg_data_init (&main_arg_data, NIL (CStringP));
861
	    arg_data_init(&main_arg_data, NIL(CStringP));
886
	    break;
862
	    break;
887
	  case 'x':
863
	  case 'x':
888
	    mode     = MODE_EXTRACT;
864
	    mode     = MODE_EXTRACT;
889
	    arg_list = main_extract_arg_list;
865
	    arg_list = main_extract_arg_list;
890
	    arg_data_init (&main_arg_data, NIL (CStringP));
866
	    arg_data_init(&main_arg_data, NIL(CStringP));
891
	    break;
867
	    break;
892
	  case 'l':
868
	  case 'l':
893
	    goto linker_case;
869
	    goto linker_case;
894
	  case 'v':
870
	  case 'v':
895
	    main_used_one_off = TRUE;
871
	    main_used_one_off = TRUE;
896
	    main_used_other   = FALSE;
872
	    main_used_other   = FALSE;
897
	    main_print_version ();
873
	    main_print_version();
898
	    goto retry;
874
	    goto retry;
899
	  default:
875
	  default:
900
	    E_bad_mode (argv [0][2]);
876
	    E_bad_mode(argv[0][2]);
901
	    UNREACHED;
877
	    UNREACHED;
902
	}
878
	}
903
    } else {
879
    } else {
904
      linker_case:
880
      linker_case:
905
	arg_data_init (&main_arg_data, "capsule.j");
881
	arg_data_init(&main_arg_data, "capsule.j");
906
    }
882
    }
907
    arg_parse_intern_descriptions (arg_list);
883
    arg_parse_intern_descriptions(arg_list);
908
    skip = arg_parse_arguments (arg_list, usage_estring, argc, argv);
884
    skip = arg_parse_arguments(arg_list, usage_estring, argc, argv);
909
    argc -= skip;
885
    argc -= skip;
910
    argv += skip;
886
    argv += skip;
911
    if (main_used_one_off && (!main_used_other) && (argc == 0)) {
887
    if (main_used_one_off && (!main_used_other) && (argc == 0)) {
912
	exit (EXIT_SUCCESS);
888
	exit(EXIT_SUCCESS);
913
	UNREACHED;
889
	UNREACHED;
914
    } else if (argc == 0) {
890
    } else if (argc == 0) {
915
	E_missing_files ();
891
	E_missing_files();
916
	UNREACHED;
892
	UNREACHED;
917
    }
893
    }
918
    arg_data_set_files (&main_arg_data, argc, argv);
894
    arg_data_set_files(&main_arg_data, argc, argv);
919
    arg_data_vector_libraries (&main_arg_data);
895
    arg_data_vector_libraries(&main_arg_data);
920
    debug_set_file (arg_data_get_debug_file (&main_arg_data));
896
    debug_set_file(arg_data_get_debug_file(&main_arg_data));
921
    return (mode);
897
    return(mode);
922
}
898
}
923
 
899
 
924
/*--------------------------------------------------------------------------*/
900
/*--------------------------------------------------------------------------*/
925
 
901
 
926
int
902
int
927
main PROTO_N ((argc, argv))
-
 
928
     PROTO_T (int    argc X
-
 
929
	      char **argv)
903
main(int    argc,	      char **argv)
930
{
904
{
931
    HANDLE {
905
    HANDLE {
932
	istream_setup ();
906
	istream_setup();
933
	ostream_setup ();
907
	ostream_setup();
934
	switch (main_init (argc, argv)) EXHAUSTIVE {
908
	switch (main_init(argc, argv))EXHAUSTIVE {
935
	  case MODE_BUILDER:
909
	  case MODE_BUILDER:
936
	    builder_main (&main_arg_data);
910
	    builder_main(&main_arg_data);
937
	    break;
911
	    break;
938
	  case MODE_CONTENTS:
912
	  case MODE_CONTENTS:
939
	    contents_main (&main_arg_data);
913
	    contents_main(&main_arg_data);
940
	    break;
914
	    break;
941
	  case MODE_EXTRACT:
915
	  case MODE_EXTRACT:
942
	    extract_main (&main_arg_data);
916
	    extract_main(&main_arg_data);
943
	    break;
917
	    break;
944
	  case MODE_LINKER:
918
	  case MODE_LINKER:
945
	    linker_main (&main_arg_data);
919
	    linker_main(&main_arg_data);
946
	    break;
920
	    break;
947
	}
921
	}
948
    } WITH {
922
    } WITH {
949
	ExceptionP exception = EXCEPTION_EXCEPTION ();
923
	ExceptionP exception = EXCEPTION_EXCEPTION();
950
 
924
 
951
	if (exception == XX_dalloc_no_memory) {
925
	if (exception == XX_dalloc_no_memory) {
952
	    E_no_memory ();
926
	    E_no_memory();
953
	    UNREACHED;
927
	    UNREACHED;
954
	} else if ((exception == XX_istream_read_error) ||
928
	} else if ((exception == XX_istream_read_error) ||
955
		   (exception == XX_bistream_read_error)) {
929
		  (exception == XX_bistream_read_error)) {
956
	    CStringP file = (CStringP) EXCEPTION_VALUE ();
930
	    CStringP file = (CStringP)EXCEPTION_VALUE();
957
 
931
 
958
	    E_read_error (file);
932
	    E_read_error(file);
959
	    UNREACHED;
933
	    UNREACHED;
960
	} else if ((exception == XX_ostream_write_error) ||
934
	} else if ((exception == XX_ostream_write_error) ||
961
		   (exception == XX_bostream_write_error)) {
935
		  (exception == XX_bostream_write_error)) {
962
	    CStringP file = (CStringP) EXCEPTION_VALUE ();
936
	    CStringP file = (CStringP)EXCEPTION_VALUE();
963
 
937
 
964
	    E_write_error (file);
938
	    E_write_error(file);
965
	    UNREACHED;
939
	    UNREACHED;
966
	} else {
940
	} else {
967
	    RETHROW ();
941
	    RETHROW();
968
	    UNREACHED;
942
	    UNREACHED;
969
	}
943
	}
970
    } END_HANDLE
944
    } END_HANDLE
971
    exit (EXIT_SUCCESS);
945
    exit(EXIT_SUCCESS);
972
    UNREACHED;
946
    UNREACHED;
973
}
947
}
974

948

975
/*
949
/*
976
 * Local variables(smf):
950
 * Local variables(smf):