2 |
7u83 |
1 |
/*
|
|
|
2 |
Crown Copyright (c) 1997
|
|
|
3 |
|
|
|
4 |
This TenDRA(r) Computer Program is subject to Copyright
|
|
|
5 |
owned by the United Kingdom Secretary of State for Defence
|
|
|
6 |
acting through the Defence Evaluation and Research Agency
|
|
|
7 |
(DERA). It is made available to Recipients with a
|
|
|
8 |
royalty-free licence for its use, reproduction, transfer
|
|
|
9 |
to other parties and amendment for any purpose not excluding
|
|
|
10 |
product development provided that any such use et cetera
|
|
|
11 |
shall be deemed to be acceptance of the following conditions:-
|
|
|
12 |
|
|
|
13 |
(1) Its Recipients shall ensure that this Notice is
|
|
|
14 |
reproduced upon any copies or amended versions of it;
|
|
|
15 |
|
|
|
16 |
(2) Any amended version of it shall be clearly marked to
|
|
|
17 |
show both the nature of and the organisation responsible
|
|
|
18 |
for the relevant amendment or amendments;
|
|
|
19 |
|
|
|
20 |
(3) Its onward transfer from a recipient to another
|
|
|
21 |
party shall be deemed to be that party's acceptance of
|
|
|
22 |
these conditions;
|
|
|
23 |
|
|
|
24 |
(4) DERA gives no warranty or assurance as to its
|
|
|
25 |
quality or suitability for any purpose and DERA accepts
|
|
|
26 |
no liability whatsoever in relation to any use to which
|
|
|
27 |
it may be put.
|
|
|
28 |
*/
|
|
|
29 |
|
|
|
30 |
|
|
|
31 |
/* $Id: fail.c,v 1.1.1.1 1998/01/17 15:56:00 release Exp $ */
|
|
|
32 |
|
|
|
33 |
#ifndef lint
|
|
|
34 |
static char vcid[] = "$Id: fail.c,v 1.1.1.1 1998/01/17 15:56:00 release Exp $";
|
|
|
35 |
#endif /* lint */
|
|
|
36 |
|
|
|
37 |
/*
|
|
|
38 |
$Log: fail.c,v $
|
|
|
39 |
* Revision 1.1.1.1 1998/01/17 15:56:00 release
|
|
|
40 |
* First version to be checked into rolling release.
|
|
|
41 |
*
|
|
|
42 |
* Revision 1.5 1995/09/13 08:22:59 john
|
|
|
43 |
* Addition for exception handling
|
|
|
44 |
*
|
|
|
45 |
* Revision 1.4 1995/09/06 09:00:58 john
|
|
|
46 |
* removed old command line argument parsing
|
|
|
47 |
*
|
|
|
48 |
* Revision 1.3 1995/05/16 10:48:19 john
|
|
|
49 |
* Cosmetic changes
|
|
|
50 |
*
|
|
|
51 |
* Revision 1.2 1995/03/29 14:07:18 john
|
|
|
52 |
* Added a couple of breaks
|
|
|
53 |
*
|
|
|
54 |
* Revision 1.1.1.1 1995/03/23 10:39:07 john
|
|
|
55 |
* Entered into CVS
|
|
|
56 |
*
|
|
|
57 |
* Revision 1.5 1995/01/12 15:04:26 john
|
|
|
58 |
* Changed message formats
|
|
|
59 |
*
|
|
|
60 |
*/
|
|
|
61 |
|
|
|
62 |
/*
|
|
|
63 |
fail.c
|
|
|
64 |
|
|
|
65 |
This file contains the error handling functions for the
|
|
|
66 |
alpha translator.
|
|
|
67 |
*/
|
|
|
68 |
|
|
|
69 |
#include "config.h"
|
|
|
70 |
#include "fail.h"
|
|
|
71 |
#include "pseudo.h"
|
|
|
72 |
#define USEAGE_STRING "alphatrans -[ABCDEFHIKMPQRSUXVWZu] file.t file.G file.T [file.s]"
|
|
|
73 |
void alphafail
|
|
|
74 |
PROTO_N ( ( reason,message,extra_info ) )
|
|
|
75 |
PROTO_T ( fail_conditions reason X char *message X char *extra_info )
|
|
|
76 |
{
|
|
|
77 |
int fatal=0;
|
|
|
78 |
static int warnings=0;
|
|
|
79 |
switch(reason){
|
|
|
80 |
case FILE_OPEN:
|
|
|
81 |
fprintf(stderr,"Error: Cannot Open file %s",message);
|
|
|
82 |
fatal=1;
|
|
|
83 |
break;
|
|
|
84 |
case USEAGE:
|
|
|
85 |
fprintf(stderr,"Error: %s\nuseage: is %s",message,USEAGE_STRING);
|
|
|
86 |
fatal=1;
|
|
|
87 |
break;
|
|
|
88 |
case OVERFLOW:
|
|
|
89 |
fprintf(stderr,"Overflow error: %s",message);
|
|
|
90 |
fatal=1;
|
|
|
91 |
break;
|
|
|
92 |
case CROSS_IMPLEMENTATION:
|
|
|
93 |
fprintf(stderr,
|
|
|
94 |
"Error: incomplete implementation on this machine: %s",
|
|
|
95 |
message);
|
|
|
96 |
fatal=1;
|
|
|
97 |
break;
|
|
|
98 |
case REG_ALLOC:
|
|
|
99 |
fprintf(stderr,"Error: error in register allocation: %s",message);
|
|
|
100 |
comment("***ERROR HERE***");
|
|
|
101 |
fatal=0;
|
|
|
102 |
break;
|
|
|
103 |
case IMPLEMENTATION:
|
|
|
104 |
fprintf(stderr,"Warning: implementation : %s",message);
|
|
|
105 |
++warnings;
|
|
|
106 |
break;
|
|
|
107 |
case INSTRUCTION_OUTPUT:
|
|
|
108 |
fprintf(stderr,"Warning: assembler output: %s",message);
|
|
|
109 |
++warnings;
|
|
|
110 |
break;
|
|
|
111 |
case MISC:
|
|
|
112 |
fprintf(stderr,"Warning: %s",message);
|
|
|
113 |
++warnings;
|
|
|
114 |
break;
|
|
|
115 |
case INTERNAL:
|
|
|
116 |
fprintf(stderr,"Internal error: %s",message);
|
|
|
117 |
fatal=1;
|
|
|
118 |
break;
|
|
|
119 |
}
|
|
|
120 |
fprintf(stderr,"%s\n",extra_info);
|
|
|
121 |
fatal = fatal || (warnings>MAX_WARNINGS);
|
|
|
122 |
if(fatal) exit(EXIT_FAILURE);
|
|
|
123 |
return;
|
|
|
124 |
}
|