Subversion Repositories tendra.SVN

Rev

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

Rev 5 Rev 6
Line -... Line 1...
-
 
1
/*
-
 
2
 * Copyright (c) 2002-2005 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) 1996
32
    		 Crown Copyright (c) 1996
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
Line 34... Line 64...
34
$Header: /u/g/release/CVSROOT/Source/src/installers/680x0/sunos/main.c,v 1.2 1998/02/06 17:04:20 release Exp $
64
$Header: /u/g/release/CVSROOT/Source/src/installers/680x0/sunos/main.c,v 1.2 1998/02/06 17:04:20 release Exp $
35
--------------------------------------------------------------------------
65
--------------------------------------------------------------------------
36
$Log: main.c,v $
66
$Log: main.c,v $
37
 * Revision 1.2  1998/02/06  17:04:20  release
67
 * Revision 1.2  1998/02/06  17:04:20  release
38
 * Last minute pre-release polishing.
68
 * Last minute pre-release polishing.
39
 *
69
 *
40
 * Revision 1.1.1.1  1998/01/17  15:55:51  release
70
 * Revision 1.1.1.1  1998/01/17  15:55:51  release
41
 * First version to be checked into rolling release.
71
 * First version to be checked into rolling release.
42
 *
72
 *
43
Revision 1.1.1.1  1997/10/13 12:42:56  ma
73
Revision 1.1.1.1  1997/10/13 12:42:56  ma
44
First version.
74
First version.
Line 132... Line 162...
132
#include "where.h"
162
#include "where.h"
133
#if have_diagnostics
163
#if have_diagnostics
134
#include "xdb_basics.h"
164
#include "xdb_basics.h"
135
#include "xdb_output.h"
165
#include "xdb_output.h"
136
#endif
166
#endif
137
extern int errors ;
167
extern int errors;
138
extern int max_errors ;
168
extern int max_errors;
139
 
169
 
140
 
170
 
141
/*
171
/*
142
    PROGRAM NAME AND VERSION NUMBER
172
    PROGRAM NAME AND VERSION NUMBER
143
*/
173
*/
144
 
174
 
145
char *progname = "hptrans" ;
175
char *progname = "hptrans";
146
static char *version_str = "Version: 0.6" ;
176
static char *version_str = "Version: 0.6";
147
static char *revision = REVISION_STRING ;
177
static char *revision = REVISION_STRING;
148
static char *revdate = DATE_STRING ;
178
static char *revdate = DATE_STRING;
149
int normal_version = 1 ;
179
int normal_version = 1;
150
 
180
 
151
 
181
 
152
/*
182
/*
153
    EXTRA COMPILATION FLAGS
183
    EXTRA COMPILATION FLAGS
154
*/
184
*/
155
 
-
 
156
int do_peephole = 1 ;
-
 
157
int do_pic = 0 ;
-
 
158
static int do_quit = 0 ;
-
 
159
static int do_sep_units = 0 ;
-
 
160
static int ignore_errors = 0 ;
-
 
161
#ifdef EBUG
-
 
162
int optimize = 0 ;
-
 
163
#else
-
 
164
static int optimize = 1 ;
-
 
165
#endif
-
 
166
static int report_version = 0 ;
-
 
167
static int report_tdf_versions = 0 ;
-
 
168
static int show_options = 0 ;
-
 
169
static int dummy_option = 0 ;
-
 
170
 
-
 
171
#ifdef EBUG
-
 
172
 
-
 
173
int do_test = 0 ;
-
 
174
int seek_label = 0 ;
-
 
175
int seek_extern = 0 ;
-
 
176
int seek_label_no ;
-
 
177
char *seek_extern_id ;
-
 
178
 
-
 
179
int seek_line = 0 ;
-
 
180
int seek_line_no ;
-
 
181
static char *seek_line_id ;
-
 
182
 
185
 
-
 
186
int do_peephole = 1;
-
 
187
int do_pic = 0;
-
 
188
static int do_quit = 0;
-
 
189
static int do_sep_units = 0;
-
 
190
static int ignore_errors = 0;
-
 
191
#ifdef EBUG
-
 
192
int optimize = 0;
-
 
193
#else
-
 
194
static int optimize = 1;
183
#endif
195
#endif
-
 
196
static int report_version = 0;
-
 
197
static int report_tdf_versions = 0;
-
 
198
static int show_options = 0;
-
 
199
static int dummy_option = 0;
-
 
200
 
-
 
201
#ifdef EBUG
-
 
202
 
-
 
203
int do_test = 0;
-
 
204
int seek_label = 0;
-
 
205
int seek_extern = 0;
-
 
206
int seek_label_no;
-
 
207
char *seek_extern_id;
-
 
208
 
-
 
209
int seek_line = 0;
-
 
210
int seek_line_no;
-
 
211
static char *seek_line_id;
-
 
212
 
-
 
213
#endif
-
 
214
 
-
 
215
int diag_override;
-
 
216
static int diag_stab_override = 0;
-
 
217
static int diag_xdb_new_override = 0;
-
 
218
static int diag_xdb_old_override = 0;
-
 
219
 
184
 
220
 
185
int diag_override ;
-
 
186
static int diag_stab_override = 0 ;
-
 
187
static int diag_xdb_new_override = 0 ;
-
 
188
static int diag_xdb_old_override = 0 ;
-
 
189
 
-
 
190
 
-
 
191
 
-
 
192
/*
-
 
193
    VARIABLE SIZES AND ALIGNMENTS
-
 
194
*/
-
 
195
 
-
 
196
alignment MAX_BF_SIZE ;
-
 
197
 
-
 
198
 
221
 
199
/*
222
/*
200
    MAXIMUM EXPONENT FOR FLOATING-POINT NUMBERS
223
    VARIABLE SIZES AND ALIGNMENTS
201
*/
224
*/
202
 
225
 
-
 
226
alignment MAX_BF_SIZE;
-
 
227
 
-
 
228
 
-
 
229
/*
-
 
230
    MAXIMUM EXPONENT FOR FLOATING-POINT NUMBERS
-
 
231
*/
-
 
232
 
203
int target_dbl_maxexp = 1024 ;
233
int target_dbl_maxexp = 1024;
204
 
234
 
205
 
235
 
206
/*
236
/*
207
    OPTIONS
237
    OPTIONS
208
 
238
 
209
    There are two types of options.  Firstly, for certain key words,
239
    There are two types of options.  Firstly, for certain key words,
210
    key, the option "-key" enables, and the option "-no_key" disables,
240
    key, the option "-key" enables, and the option "-no_key" disables,
211
    the corresponding action.  Some of these options take an additional
241
    the corresponding action.  Some of these options take an additional
212
    argument in their positive form, i.e. "-key arg".  Secondly, single
242
    argument in their positive form, i.e. "-key arg".  Secondly, single
213
    letter options are used as shorthand for some of the options of the
243
    letter options are used as shorthand for some of the options of the
Line 216... Line 246...
216
    Each entry in this table gives a key word, key, followed by the
246
    Each entry in this table gives a key word, key, followed by the
217
    single letter option for "-key" (or 0 is there isn't one) and
247
    single letter option for "-key" (or 0 is there isn't one) and
218
    the single letter option for "-no_key".  There is also a pointer
248
    the single letter option for "-no_key".  There is also a pointer
219
    to the boolean changed by this option and, if the option takes a
249
    to the boolean changed by this option and, if the option takes a
220
    qualifying string, a pointer to the string thus set.
250
    qualifying string, a pointer to the string thus set.
221
*/
251
*/
222
 
252
 
223
struct {
253
struct {
224
    char *opt ;
254
    char *opt;
225
    char on ;
255
    char on;
226
    char off ;
256
    char off;
227
    char sw ;
257
    char sw;
228
    int *flag ;
258
    int *flag;
229
    char **value ;
259
    char **value;
230
} options [] = {
260
} options[] = {
231
    { "alloca", 0, 0, 'A', &do_alloca, null },
261
    {"alloca", 0, 0, 'A', &do_alloca, null},
232
    { "cc", 'c', 'g', 0, &cc_conventions, null },
262
    {"cc", 'c', 'g', 0, &cc_conventions, null},
233
    { "diag", 'H', 0, 0, &diagnose, null },
263
    {"diag", 'H', 0, 0, &diagnose, null},
234
    { "extra_checks", 0, 'E', 0, &extra_checks, null },
264
    {"extra_checks", 0, 'E', 0, &extra_checks, null},
235
    { "float_div", 0, 0, 'M', &strict_fl_div, null },
265
    {"float_div", 0, 0, 'M', &strict_fl_div, null},
236
    { "float_inf", 0, 0, 'B', &flpt_const_overflow_fail, null },
266
    {"float_inf", 0, 0, 'B', &flpt_const_overflow_fail, null},
237
    { "foralls", 0, 0, 'F', &do_foralls, null },
267
    {"foralls", 0, 0, 'F', &do_foralls, null},
238
    { "ignore", 0, 0, 0, &ignore_errors, null },
268
    {"ignore", 0, 0, 0, &ignore_errors, null},
239
    { "immediate", 'i', 0, 0, &output_immediately, null },
269
    {"immediate", 'i', 0, 0, &output_immediately, null},
240
    { "inlining", 0, 0, 'I', &do_inlining, null },
270
    {"inlining", 0, 0, 'I', &do_inlining, null},
241
    { "loopconsts", 0, 0, 'C', &do_loopconsts, null },
271
    {"loopconsts", 0, 0, 'C', &do_loopconsts, null},
242
#if have_diagnostics
272
#if have_diagnostics
243
    { "stab", 0, 0, 0, &diag_stab_override, null },
273
    {"stab", 0, 0, 0, &diag_stab_override, null},
244
    { "new_diag", 0, 0, 0, &diag_xdb_new_override, null },
274
    {"new_diag", 0, 0, 0, &diag_xdb_new_override, null},
245
    { "old_diag", 0, 0, 0, &diag_xdb_old_override, null },
275
    {"old_diag", 0, 0, 0, &diag_xdb_old_override, null},
246
#endif
276
#endif
247
    { "opt", 'O', 'X', 0, &optimize, null },
277
    {"opt", 'O', 'X', 0, &optimize, null},
248
    { "options", 'o', 0, 0, &show_options, null },
278
    {"options", 'o', 0, 0, &show_options, null},
249
    { "peephole", 0, 0, 0, &do_peephole, null },
279
    {"peephole", 0, 0, 0, &do_peephole, null},
250
    { "pic", 0, 0, 'D', &do_pic, null },
280
    {"pic", 0, 0, 'D', &do_pic, null},
251
    { "profile", 'P', 0, 0, &do_profile, null },
281
    {"profile", 'P', 0, 0, &do_profile, null},
252
    { "quit", 'Q', 0, 0, &do_quit, null },
282
    {"quit", 'Q', 0, 0, &do_quit, null},
253
    { "report_version", 'Z', 0, 0, &report_tdf_versions, null },
283
    {"report_version", 'Z', 0, 0, &report_tdf_versions, null},
254
    { "round", 'r', 0, 'R', &round_after_flop, null },
284
    {"round", 'r', 0, 'R', &round_after_flop, null},
255
    { "separate_units", 'U', 0, 0, &do_sep_units, null },
285
    {"separate_units", 'U', 0, 0, &do_sep_units, null},
256
    { "special_fns", 0, 0, 0, &do_special_fns, null },
286
    {"special_fns", 0, 0, 0, &do_special_fns, null},
257
    { "sub_params", 0, 0, 0, &do_sub_params, null },
287
    {"sub_params", 0, 0, 0, &do_sub_params, null},
258
#ifdef EBUG
288
#ifdef EBUG
259
    { "label", 'L', 0, 0, &seek_extern, &seek_extern_id },
289
    {"label", 'L', 0, 0, &seek_extern, &seek_extern_id},
260
    { "line", 'l', 0, 0, &seek_line, &seek_line_id },
290
    {"line", 'l', 0, 0, &seek_line, &seek_line_id},
261
    { "test", 'l', 0, 0, &do_test, null },
291
    {"test", 'l', 0, 0, &do_test, null},
262
#endif
292
#endif
263
    { "unroll", 0, 0, 'U', &do_unroll, null },
293
    {"unroll", 0, 0, 'U', &do_unroll, null},
264
    { "version", 'V', 0, 0, &report_version, null },
294
    {"version", 'V', 0, 0, &report_version, null},
265
    { "write_strings", 0, 0, 'W', &dummy_option, null }
295
    {"write_strings", 0, 0, 'W', &dummy_option, null}
266
} ;
296
};
267
 
297
 
268
 
298
 
269
/*
299
/*
270
    MAIN ROUTINE
300
    MAIN ROUTINE
271
 
301
 
Line 273... Line 303...
273
    initialization routines, and then calls the main processing
303
    initialization routines, and then calls the main processing
274
    routines.
304
    routines.
275
*/
305
*/
276
 
306
 
277
int main
307
int main
278
    PROTO_N ( ( argc, argv ) )
-
 
279
    PROTO_T ( int argc X char **argv )
308
(int argc, char **argv)
280
{
309
{
281
    int a ;
310
    int a;
282
    char **p = null ;
311
    char **p = null;
283
    char *input = null ;
312
    char *input = null;
284
    char *output = null ;
313
    char *output = null;
285
 
314
 
286
    /* Set up program name */
315
    /* Set up program name */
287
    progname = basename ( argv [0] ) ;
316
    progname = basename(argv[0]);
288
 
317
 
289
    /* Set default options */
318
    /* Set default options */
290
    diagnose = 0 ;
319
    diagnose = 0;
291
    do_alloca = 1 ;
320
    do_alloca = 1;
292
    do_foralls = 1 ;
321
    do_foralls = 1;
293
    do_inlining = 1 ;
322
    do_inlining = 1;
294
    do_loopconsts = 1 ;
323
    do_loopconsts = 1;
295
    do_profile = 0 ;
324
    do_profile = 0;
296
    do_special_fns = 1 ;
325
    do_special_fns = 1;
297
    do_unroll = 1 ;
326
    do_unroll = 1;
298
    extra_checks = 1 ;
327
    extra_checks = 1;
299
    redo_structfns = 0 ;
328
    redo_structfns = 0;
300
 
329
 
301
    /* Process arguments */
330
    /* Process arguments */
302
    for ( a = 1 ; a < argc ; a++ ) {
331
    for (a = 1; a < argc; a++) {
303
	if ( p ) {
332
	if (p) {
304
	    /* Set extra part of two part options */
333
	    /* Set extra part of two part options */
305
	    *p = argv [a] ;
334
	    *p = argv[a];
306
	    p = null ;
335
	    p = null;
307
	} else if ( argv [a][0] == '-' && argv [a][1] ) {
336
	} else if (argv[a][0] == '-' && argv[a][1]) {
308
	    /* Search option table */
337
	    /* Search option table */
309
	    bool found = 0 ;
338
	    bool found = 0;
310
	    char *s = argv [a] + 1 ;
339
	    char *s = argv[a] + 1;
311
	    int i, n = array_size ( options ) ;
340
	    int i, n = array_size(options);
312
	    if ( ( s [1] == '0' || s [1] == '1' ) && s [2] == 0 ) {
341
	    if ((s[1] == '0' || s[1] == '1') && s[2] == 0) {
313
		for ( i = 0 ; !found && i < n ; i++ ) {
342
		for (i = 0; !found && i < n; i++) {
314
		    if ( *s == options [i].sw ) {
343
		    if (*s == options[i].sw) {
315
			*( options [i].flag ) = ( s [1] - '0' ) ;
344
			*(options[i].flag) = (s[1] - '0');
316
			p = options [i].value ;
345
			p = options[i].value;
317
			found = 1 ;
346
			found = 1;
318
		    }
347
		    }
319
		}
348
		}
320
	    } else if ( s [1] ) {
349
	    } else if (s[1]) {
321
		bool b = 1 ;
350
		bool b = 1;
322
		if ( strncmp ( s, "no_", 3 ) == 0 ) {
351
		if (strncmp(s, "no_", 3) == 0) {
323
		    s += 3 ;
352
		    s + = 3;
324
		    b = 0 ;
353
		    b = 0;
325
		}
354
		}
326
		for ( i = 0 ; !found && i < n ; i++ ) {
355
		for (i = 0; !found && i < n; i++) {
327
		    if ( eq ( s, options [i].opt ) ) {
356
		    if (eq(s, options[i].opt)) {
328
			*( options [i].flag ) = b ;
357
			*(options[i].flag) = b;
329
			if ( b ) p = options [i].value ;
358
			if (b)p = options[i].value;
330
			found = 1 ;
359
			found = 1;
331
		    }
360
		    }
332
		}
361
		}
333
	    } else {
362
	    } else {
334
		for ( i = 0 ; !found && i < n ; i++ ) {
363
		for (i = 0; !found && i < n; i++) {
335
		    if ( *s == options [i].on ) {
364
		    if (*s == options[i].on) {
336
			*( options [i].flag ) = 1 ;
365
			*(options[i].flag) = 1;
337
			p = options [i].value ;
366
			p = options[i].value;
338
			found = 1 ;
367
			found = 1;
339
		    } else if ( *s == options [i].off ) {
368
		    } else if (*s == options[i].off) {
340
			*( options [i].flag ) = 0 ;
369
			*(options[i].flag) = 0;
341
			found = 1 ;
370
			found = 1;
342
		    }
371
		    }
343
		}
372
		}
344
	    }
373
	    }
-
 
374
	    if (!found) {
345
	    if ( !found ) warning ( "Unknown option, %s", argv [a] ) ;
375
		    warning("Unknown option, %s", argv[a]);
-
 
376
	    }
346
	} else {
377
	} else {
347
	    /* Set up input and output files */
378
	    /* Set up input and output files */
348
	    if ( input == null ) {
379
	    if (input == null) {
349
		input = argv [a] ;
380
		input = argv[a];
350
	    } else if ( output == null ) {
381
	    } else if (output == null) {
351
		output = argv [a] ;
382
		output = argv[a];
352
	    } else {
383
	    } else {
353
		error ( "Too many arguments" ) ;
384
		error("Too many arguments");
354
		exit ( EXIT_FAILURE ) ;
385
		exit(EXIT_FAILURE);
355
	    }
386
	    }
356
	}
387
	}
357
    }
388
    }
358
 
389
 
359
#ifdef EBUG
390
#ifdef EBUG
360
    /* Deal with debugging options */
391
    /* Deal with debugging options */
361
    if ( seek_extern ) {
392
    if (seek_extern) {
362
	if ( is_local ( seek_extern_id ) ) {
393
	if (is_local(seek_extern_id)) {
363
	    seek_label = 1 ;
394
	    seek_label = 1;
364
	    seek_label_no = atoi ( seek_extern_id + 1 ) ;
395
	    seek_label_no = atoi(seek_extern_id + 1);
365
	}
396
	}
366
    }
397
    }
367
    if ( seek_line ) seek_line_no = atoi ( seek_line_id ) ;
398
    if (seek_line)seek_line_no = atoi(seek_line_id);
368
#endif
399
#endif
369
 
400
 
370
    /* Report version if required */
401
    /* Report version if required */
371
    if ( report_version ) {
402
    if (report_version) {
372
#ifdef NEXT
403
#ifdef NEXT
373
	char *machine = "NeXT" ;
404
	char *machine = "NeXT";
374
#else
405
#else
375
#ifdef SUN
406
#ifdef SUN
376
	char *machine = "Sun/3" ;
407
	char *machine = "Sun / 3";
377
#else
408
#else
378
	char *machine = "HP" ;
409
	char *machine = "HP";
379
#endif
410
#endif
380
#endif
411
#endif
381
	fprintf(stderr, "DRA TDF translator (TDF version %d.%d)\n",
412
	fprintf(stderr, "DRA TDF translator (TDF version %d.%d)\n",
382
		MAJOR_VERSION, MINOR_VERSION);
413
		MAJOR_VERSION, MINOR_VERSION);
383
	fprintf(stderr, "reader %d.%d: ", reader_version,
414
	fprintf(stderr, "reader %d.%d: ", reader_version,
Line 389... Line 420...
389
	fprintf(stderr, "system %s",machine);
420
	fprintf(stderr, "system %s",machine);
390
#ifdef __DATE__
421
#ifdef __DATE__
391
	fprintf(stderr," : installer compilation %s\n", __DATE__);
422
	fprintf(stderr," : installer compilation %s\n", __DATE__);
392
#endif
423
#endif
393
	fprintf(stderr,"release: %s\n",RELEASE);
424
	fprintf(stderr,"release: %s\n",RELEASE);
394
	fprintf ( stderr, ".\n" ) ;
425
	fprintf(stderr, ".\n");
395
#ifdef EBUG
426
#ifdef EBUG
396
	fprintf ( stderr, "Last revised %s.\n", revdate ) ;
427
	fprintf(stderr, "Last revised %s.\n", revdate);
397
#endif
428
#endif
398
    }
429
    }
399
    if ( report_tdf_versions ) report_versions = 1 ;
430
    if (report_tdf_versions) {
-
 
431
	    report_versions = 1;
-
 
432
    }
400
 
433
 
401
    /* Check on diagnostics */
434
    /* Check on diagnostics */
402
    if ( !have_diagnostics && diagnose ) {
435
    if (!have_diagnostics && diagnose) {
403
	error ( "Diagnostics not supported" ) ;
436
	error("Diagnostics not supported");
404
	diagnose = 0 ;
437
	diagnose = 0;
405
    }
438
    }
406
 
439
 
407
#if have_diagnostics
440
#if have_diagnostics
408
    diag_override = DIAG_UNKNOWN ;
441
    diag_override = DIAG_UNKNOWN;
-
 
442
    if (diag_stab_override) {
409
    if ( diag_stab_override ) diag_override = DIAG_STAB ;
443
	    diag_override = DIAG_STAB;
-
 
444
    }
-
 
445
    if (diag_xdb_new_override) {
410
    if ( diag_xdb_new_override ) diag_override = DIAG_XDB_NEW ;
446
	    diag_override = DIAG_XDB_NEW;
-
 
447
    }
-
 
448
    if (diag_xdb_old_override) {
411
    if ( diag_xdb_old_override ) diag_override = DIAG_XDB_OLD ;
449
	    diag_override = DIAG_XDB_OLD;
-
 
450
    }
412
#endif
451
#endif
413
 
452
 
414
    /* Switch off optimizations if required */
453
    /* Switch off optimizations if required */
415
    if ( diagnose || !optimize ) {
454
    if (diagnose || !optimize) {
416
	do_inlining = 0 ;
455
	do_inlining = 0;
417
	do_loopconsts = 0 ;
456
	do_loopconsts = 0;
418
	do_foralls = 0 ;
457
	do_foralls = 0;
419
	do_peephole = 0 ;
458
	do_peephole = 0;
420
	do_unroll = 0 ;
459
	do_unroll = 0;
421
    }
460
    }
422
 
461
 
423
    /* Show options if necessary */
462
    /* Show options if necessary */
424
    if ( show_options ) {
463
    if (show_options) {
425
	int i, n = array_size ( options ) ;
464
	int i, n = array_size(options);
426
	for ( i = 0 ; i < n ; i++ ) {
465
	for (i = 0; i < n; i++) {
427
	    bool b = *( options [i].flag ) ;
466
	    bool b = *(options[i].flag);
428
	    char **pv = options [i].value ;
467
	    char **pv = options[i].value;
429
	    printf ( "%s = %s", options [i].opt, ( b ? "True" : "False" ) ) ;
468
	    printf("%s = %s", options[i].opt,(b ? "True" : "False"));
-
 
469
	    if (pv && b) {
430
	    if ( pv && b ) printf ( " (%s)", *pv ) ;
470
		    printf(" (%s)", *pv);
-
 
471
	    }
431
	    printf ( "\n" ) ;
472
	    printf("\n");
432
	}
473
	}
433
    }
474
    }
434
 
475
 
435
    /* Check on separate units */
476
    /* Check on separate units */
436
    if ( do_sep_units ) {
477
    if (do_sep_units) {
437
	separate_units = 1 ;
478
	separate_units = 1;
438
#if 0
479
#if 0
439
	current_alloc_size = first_alloc_size ;
480
	current_alloc_size = first_alloc_size;
440
#endif
481
#endif
441
    }
482
    }
442
 
483
 
443
    do_pic = 0 ; /* TODO */
484
    do_pic = 0 ; /* TODO */
444
 
485
 
445
    /* Other options */
486
    /* Other options */
-
 
487
    if (do_pic) {
446
    if ( do_pic ) PIC_code = 1 ;
488
	    PIC_code = 1;
-
 
489
    }
-
 
490
    
-
 
491
    if (!extra_checks) {
447
    if ( !extra_checks ) target_dbl_maxexp = 16384 ;
492
	    target_dbl_maxexp = 16384;
-
 
493
    }
-
 
494
 
-
 
495
    if (do_quit) {
448
    if ( do_quit ) exit ( EXIT_SUCCESS ) ;
496
	    exit(EXIT_SUCCESS);
-
 
497
    }
449
 
498
 
450
    /* Open input file */
499
    /* Open input file */
451
    if ( input == null ) {
500
    if (input == null) {
452
	error ( "Not enough arguments" ) ;
501
	error("Not enough arguments");
453
	exit ( EXIT_FAILURE ) ;
502
	exit(EXIT_FAILURE);
454
    }
503
    }
455
    if ( !initreader ( input ) ) {
504
    if (!initreader(input)) {
456
	exit ( EXIT_FAILURE ) ;
505
	exit(EXIT_FAILURE);
457
    }
506
    }
458
    /*open_input ( input ) ;*/
507
    /* open_input(input);*/
459
 
508
 
460
    /* Set up alignment rules */
509
    /* Set up alignment rules */
461
    double_align = DBL_ALIGN ;
510
    double_align = DBL_ALIGN;
462
    param_align = PARAM_ALIGN ;
511
    param_align = PARAM_ALIGN;
463
    stack_align = STACK_ALIGN ;
512
    stack_align = STACK_ALIGN;
464
 
513
 
465
    MAX_BF_SIZE = ( cc_conventions ? MAX_BF_SIZE_CC : MAX_BF_SIZE_GCC ) ;
514
    MAX_BF_SIZE = (cc_conventions ? MAX_BF_SIZE_CC : MAX_BF_SIZE_GCC);
466
 
515
 
467
    /* Call initialization routines */
516
    /* Call initialization routines */
468
    top_def = null ;
517
    top_def = null;
469
    init_flpt () ;
518
    init_flpt();
470
    init_instructions () ;
519
    init_instructions();
471
#include "inits.h"
520
#include "inits.h"
472
    init_weights () ;
521
    init_weights();
473
    init_wheres () ;
522
    init_wheres();
474
 
523
 
475
    /* Decode, optimize and process the input TDF */
524
    /* Decode, optimize and process the input TDF */
476
    open_output ( output ) ;
525
    open_output(output);
477
    asm_comment ;
526
    asm_comment;
478
    outs ( " TDF to 680x0, " ) ;
527
    outs(" TDF to 680x0, ");
479
    outs ( version_str ) ;
528
    outs(version_str);
480
    outs ( ", " ) ;
529
    outs(", ");
481
    outs ( revision ) ;
530
    outs(revision);
482
    outnl () ;
531
    outnl();
483
    init_output () ;
532
    init_output();
484
    area ( ptext ) ;
533
    area(ptext);
485
#if have_diagnostics
534
#if have_diagnostics
-
 
535
    if (diagnose) {
486
    if ( diagnose ) diag_prologue () ;
536
	    diag_prologue();
-
 
537
    }
487
#endif
538
#endif
488
    d_capsule () ;
539
    d_capsule();
489
#if have_diagnostics
540
#if have_diagnostics
-
 
541
    if (diagnose) {
490
    if ( diagnose ) diag_epilogue () ;
542
	    diag_epilogue();
-
 
543
    }
491
#endif
544
#endif
492
#ifdef asm_version
545
#ifdef asm_version
493
    if ( normal_version ) {
546
    if (normal_version) {
494
	asm_version ;
547
	asm_version;
495
    } else {
548
    } else {
496
	asm_version_aux ;
549
	asm_version_aux;
497
    }
550
    }
498
    outnl () ;
551
    outnl();
499
#endif
552
#endif
500
    if ( errors && !ignore_errors ) exit ( EXIT_FAILURE ) ;
553
    if (errors && !ignore_errors) {
-
 
554
	    exit(EXIT_FAILURE);
-
 
555
    }
501
    return ( 0 ) ;
556
    return(0);
502
}
557
}