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) 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
Line 95... Line 125...
95
 * Revision 1.1  1994/07/12  14:42:47  jmf
125
 * Revision 1.1  1994/07/12  14:42:47  jmf
96
 * Initial revision
126
 * Initial revision
97
 *
127
 *
98
**********************************************************************/
128
**********************************************************************/
99
 
129
 
100
 
130
 
101
#include "config.h"
131
#include "config.h"
102
#include "release.h"
132
#include "release.h"
103
#include "common_types.h"
133
#include "common_types.h"
104
#include "basicread.h"
134
#include "basicread.h"
105
#include "flags.h"
135
#include "flags.h"
Line 131... Line 161...
131
#ifdef NEWDWARF
161
#ifdef NEWDWARF
132
#include "dw2_iface.h"
162
#include "dw2_iface.h"
133
#include "dw2_vsn.h"
163
#include "dw2_vsn.h"
134
#include "dw2_abbrev.h"
164
#include "dw2_abbrev.h"
135
#include "dw2_common.h"
165
#include "dw2_common.h"
136
static bool dump_abbrev = 0 ;
166
static bool dump_abbrev = 0;
137
#endif
167
#endif
138
 
168
 
139
#if DWARF
169
#if DWARF
140
#include "dwarf_mc.h"
170
#include "dwarf_mc.h"
141
#endif
171
#endif
Line 143... Line 173...
143
extern int print_inlines;
173
extern int print_inlines;
144
 
174
 
145
/* PROCEDURES */
175
/* PROCEDURES */
146
 
176
 
147
static void init_all
177
static void init_all
148
    PROTO_Z ()
178
(void)
149
{
179
{
150
  init_flpt();
180
  init_flpt();
151
#include "inits.h"
181
#include "inits.h"
152
  good_trans = 0;
182
  good_trans = 0;
153
  capsule_freelist = (capsule_frees*)0;
183
  capsule_freelist = (capsule_frees*)0;
Line 155... Line 185...
155
 
185
 
156
/* 80x86 specific */
186
/* 80x86 specific */
157
  extra_stack = 0;
187
  extra_stack = 0;
158
  top_def = (dec*)0;
188
  top_def = (dec*)0;
159
  init_weights();
189
  init_weights();
160
  initzeros ();
190
  initzeros();
161
  const_list = nilexp;
191
  const_list = nilexp;
162
  return;
192
  return;
163
}
193
}
164
 
194
 
165
int   main
195
int   main
166
    PROTO_N ( (argc, argv) )
-
 
167
    PROTO_T ( int argc X char **argv )
196
(int argc, char **argv)
168
{
197
{
169
  int i;
198
  int i;
170
  char *outfname;
199
  char *outfname;
171
 
200
 
172
		/* defaults */
201
		/* defaults */
Line 241... Line 270...
241
	gcc_compatible = (s[2] == '1');
270
	gcc_compatible = (s[2] == '1');
242
	break;
271
	break;
243
      case 'H':
272
      case 'H':
244
	diagnose = 1;
273
	diagnose = 1;
245
#ifdef NEWDIAGS
274
#ifdef NEWDIAGS
246
	if (s[2] != 'O')
275
	if (s[2]!= 'O')
247
#endif
276
#endif
248
	{
277
	{
249
#ifdef NEWDIAGS
278
#ifdef NEWDIAGS
250
	  diag_visible = 1;
279
	  diag_visible = 1;
251
#endif
280
#endif
Line 380... Line 409...
380
	no_bss = 1;
409
	no_bss = 1;
381
	break;
410
	break;
382
      case 'i':
411
      case 'i':
383
	print_inlines = 1;
412
	print_inlines = 1;
384
	break;
413
	break;
-
 
414
#if isdragonfly
-
 
415
      case 'k':
-
 
416
        set_dragonfly_format(s[2] == '1');
-
 
417
        break;
-
 
418
#endif
-
 
419
#if isfreebsd
-
 
420
      case 'k':
-
 
421
        set_freebsd_format(s[2] == '1');
-
 
422
        break;
-
 
423
#endif
385
#if islinux
424
#if islinux
386
      case 'k':
425
      case 'k':
387
	set_linux_format (s[2] == '1');
426
	set_linux_format(s[2] == '1');
388
	break;
427
	break;
389
#endif
428
#endif
390
#if issco
429
#if issco
391
      case 's':
430
      case 's':
392
	sco_gas = 1;
431
	sco_gas = 1;
393
	break;
432
	break;
394
#endif
433
#endif
395
 
434
 
396
      default:
435
      default:
397
	failer (BAD_FLAG);
436
	failer(BAD_FLAG);
398
	break;
437
	break;
399
    };
438
    };
400
  };
439
  };
401
 
440
 
-
 
441
#if isdragonfly
-
 
442
  if (gcc_compatible < 0)
-
 
443
    gcc_compatible = !dragonfly_elf;
-
 
444
#endif
-
 
445
#if isfreebsd
-
 
446
  if (gcc_compatible < 0)
-
 
447
    gcc_compatible = !freebsd_elf;
-
 
448
#endif
402
#if islinux
449
#if islinux
403
  if (gcc_compatible < 0)
450
  if (gcc_compatible < 0)
404
    gcc_compatible = ! linux_elf;
451
    gcc_compatible = ! linux_elf;
405
#endif
452
#endif
406
 
453
 
407
  if (i == argc)
454
  if (i == argc)
408
    i--;	/* BAD_COMMAND1 */
455
    i--;	/* BAD_COMMAND1 */
409
 
456
 
410
  for (; i < argc ; i += 2) {
457
  for (; i < argc; i += 2) {
411
    if (i == (argc-1))
458
    if (i == (argc-1))
412
      {
459
      {
413
        failer (BAD_COMMAND1);
460
        failer(BAD_COMMAND1);
414
        return (1);
461
        return(1);
415
      };
462
      };
416
 
463
 
417
 
464
 
418
    outfname = argv[i+1];
465
    outfname = argv[i+1];
419
 
466
 
420
    /* initiate the output file */
467
    /* initiate the output file */
421
    if (!outinit (outfname)) {
468
    if (!outinit(outfname)) {
422
      failer (CANT_OPEN);
469
      failer(CANT_OPEN);
423
      return (1);
470
      return(1);
424
    };
471
    };
425
 
472
 
426
    if (!initreader (argv[i])) {
473
    if (!initreader(argv[i])) {
427
      failer (CANT_READ);
474
      failer(CANT_READ);
428
      return (1);
475
      return(1);
429
    };
476
    };
430
 
477
 
431
    init_all();
478
    init_all();
432
 
479
 
433
#ifdef NEWDWARF
480
#ifdef NEWDWARF
434
    if (dwarf2) {
481
    if (dwarf2) {
435
      init_dwarf2 ();
482
      init_dwarf2();
436
    } else
483
    } else
437
#endif
484
#endif
438
    if (diagnose) out_diagnose_prelude();
485
    if (diagnose)out_diagnose_prelude();
439
 
486
 
440
#ifdef NEWDWARF
487
#ifdef NEWDWARF
441
    if (dump_abbrev) {
488
    if (dump_abbrev) {
442
      outs (".text\n");
489
      outs(".text\n");
443
      do_abbreviations ();
490
      do_abbreviations();
444
      dwarf2_prelude ();
491
      dwarf2_prelude();
445
      make_dwarf_common ();
492
      make_dwarf_common();
446
      dwarf2_postlude ();
493
      dwarf2_postlude();
447
    } else
494
    } else
448
#endif
495
#endif
449
 
496
 
450
    IGNORE d_capsule();
497
    IGNORE d_capsule();
451
 
498
 
Line 459... Line 506...
459
       weak_list = weak_list -> next;
506
       weak_list = weak_list -> next;
460
     };
507
     };
461
 
508
 
462
#ifdef NEWDWARF
509
#ifdef NEWDWARF
463
    if (dwarf2) {
510
    if (dwarf2) {
464
      end_dwarf2 ();
511
      end_dwarf2();
465
    } else
512
    } else
466
#endif
513
#endif
467
    if (diagnose) out_diagnose_postlude();
514
    if (diagnose)out_diagnose_postlude();
468
 
515
 
469
    outend ();			/* close the .s file */
516
    outend ();			/* close the .s file */
470
    endreader();
517
    endreader();
471
 
518
 
472
    if (good_trans)
519
    if (good_trans)