2 |
7u83 |
1 |
/*
|
6 |
7u83 |
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 |
*/
|
|
|
31 |
/*
|
2 |
7u83 |
32 |
Crown Copyright (c) 1997
|
6 |
7u83 |
33 |
|
2 |
7u83 |
34 |
This TenDRA(r) Computer Program is subject to Copyright
|
|
|
35 |
owned by the United Kingdom Secretary of State for Defence
|
|
|
36 |
acting through the Defence Evaluation and Research Agency
|
|
|
37 |
(DERA). It is made available to Recipients with a
|
|
|
38 |
royalty-free licence for its use, reproduction, transfer
|
|
|
39 |
to other parties and amendment for any purpose not excluding
|
|
|
40 |
product development provided that any such use et cetera
|
|
|
41 |
shall be deemed to be acceptance of the following conditions:-
|
6 |
7u83 |
42 |
|
2 |
7u83 |
43 |
(1) Its Recipients shall ensure that this Notice is
|
|
|
44 |
reproduced upon any copies or amended versions of it;
|
6 |
7u83 |
45 |
|
2 |
7u83 |
46 |
(2) Any amended version of it shall be clearly marked to
|
|
|
47 |
show both the nature of and the organisation responsible
|
|
|
48 |
for the relevant amendment or amendments;
|
6 |
7u83 |
49 |
|
2 |
7u83 |
50 |
(3) Its onward transfer from a recipient to another
|
|
|
51 |
party shall be deemed to be that party's acceptance of
|
|
|
52 |
these conditions;
|
6 |
7u83 |
53 |
|
2 |
7u83 |
54 |
(4) DERA gives no warranty or assurance as to its
|
|
|
55 |
quality or suitability for any purpose and DERA accepts
|
|
|
56 |
no liability whatsoever in relation to any use to which
|
|
|
57 |
it may be put.
|
|
|
58 |
*/
|
|
|
59 |
|
|
|
60 |
|
|
|
61 |
/*** c-out-info.h --- Output control ADT.
|
|
|
62 |
*
|
|
|
63 |
** Author: Steve Folkes <smf@hermes.mod.uk>
|
|
|
64 |
*
|
|
|
65 |
*** Commentary:
|
|
|
66 |
*
|
|
|
67 |
* See the file "c-out-info.c" for more information.
|
|
|
68 |
*
|
|
|
69 |
*** Change Log:
|
|
|
70 |
* $Log: c-out-info.h,v $
|
|
|
71 |
* Revision 1.1.1.1 1998/01/17 15:57:43 release
|
|
|
72 |
* First version to be checked into rolling release.
|
|
|
73 |
*
|
|
|
74 |
* Revision 1.3 1996/03/01 09:53:15 smf
|
|
|
75 |
* c-code.c, c-out-info.c, c-out-info.h, c-output.c:
|
|
|
76 |
* - improved unreachable code analysis;
|
|
|
77 |
* - improved some output formatting;
|
|
|
78 |
* - added support for comment or macro to mark unreachable code.
|
|
|
79 |
*
|
|
|
80 |
* Revision 1.2 1994/12/15 09:56:29 smf
|
|
|
81 |
* Brought into line with OSSG C Coding Standards Document, as per
|
|
|
82 |
* "CR94_178.sid+tld-update".
|
|
|
83 |
*
|
|
|
84 |
* Revision 1.1.1.1 1994/07/25 16:04:18 smf
|
|
|
85 |
* Initial import of SID 1.8 non shared files.
|
|
|
86 |
*
|
|
|
87 |
**/
|
|
|
88 |
|
|
|
89 |
/****************************************************************************/
|
|
|
90 |
|
|
|
91 |
#ifndef H_C_OUT_INFO
|
|
|
92 |
#define H_C_OUT_INFO
|
|
|
93 |
|
|
|
94 |
#include "os-interface.h"
|
|
|
95 |
#include "dstring.h"
|
|
|
96 |
#include "ostream.h"
|
|
|
97 |
#include "output.h"
|
|
|
98 |
|
|
|
99 |
/*To avoid circularity:*/
|
|
|
100 |
struct CCodeT;
|
|
|
101 |
|
|
|
102 |
/*--------------------------------------------------------------------------*/
|
|
|
103 |
|
|
|
104 |
#ifdef FS_NO_ENUM
|
|
|
105 |
typedef int CPrefixT, *CPrefixP;
|
|
|
106 |
#define CPFX_TYPE (0)
|
|
|
107 |
#define CPFX_FN (1)
|
|
|
108 |
#define CPFX_IN (2)
|
|
|
109 |
#define CPFX_OUT (3)
|
|
|
110 |
#define CPFX_LABEL (4)
|
|
|
111 |
#define CPFX_TERMINAL (5)
|
|
|
112 |
#define CPFX_NUM_PREFIXES (6)
|
|
|
113 |
#else
|
|
|
114 |
typedef enum {
|
|
|
115 |
CPFX_TYPE,
|
|
|
116 |
CPFX_FN,
|
|
|
117 |
CPFX_IN,
|
|
|
118 |
CPFX_OUT,
|
|
|
119 |
CPFX_LABEL,
|
|
|
120 |
CPFX_TERMINAL,
|
|
|
121 |
CPFX_NUM_PREFIXES
|
|
|
122 |
} CPrefixT, *CPrefixP;
|
|
|
123 |
#endif /* defined (FS_NO_ENUM) */
|
|
|
124 |
|
|
|
125 |
typedef struct COutputInfoT {
|
|
|
126 |
OutputInfoP info;
|
|
|
127 |
struct CCodeT *header1;
|
|
|
128 |
struct CCodeT *header2;
|
|
|
129 |
struct CCodeT *trailer1;
|
|
|
130 |
struct CCodeT *trailer2;
|
6 |
7u83 |
131 |
NStringT prefixes[CPFX_NUM_PREFIXES];
|
2 |
7u83 |
132 |
BoolT prototypes;
|
|
|
133 |
BoolT numeric_ids;
|
|
|
134 |
BoolT casts;
|
|
|
135 |
BoolT unreachable;
|
|
|
136 |
BoolT lines;
|
|
|
137 |
unsigned split;
|
|
|
138 |
} COutputInfoT, *COutputInfoP;
|
|
|
139 |
|
|
|
140 |
/*--------------------------------------------------------------------------*/
|
|
|
141 |
|
6 |
7u83 |
142 |
extern void c_out_info_init(COutputInfoP, OutputInfoP);
|
|
|
143 |
extern OutputInfoP c_out_info_info(COutputInfoP);
|
|
|
144 |
extern OStreamP c_out_info_ostream(COutputInfoP);
|
|
|
145 |
extern CStringP c_out_info_program_name(COutputInfoP);
|
|
|
146 |
extern CStringP c_out_info_source_name(COutputInfoP);
|
|
|
147 |
extern CStringP c_out_info_c_source_name(COutputInfoP);
|
|
|
148 |
extern struct CCodeT *c_out_info_get_header1(COutputInfoP);
|
|
|
149 |
extern void c_out_info_set_header1(COutputInfoP, struct CCodeT *);
|
|
|
150 |
extern struct CCodeT *c_out_info_get_header2(COutputInfoP);
|
|
|
151 |
extern void c_out_info_set_header2(COutputInfoP, struct CCodeT *);
|
|
|
152 |
extern struct CCodeT *c_out_info_get_trailer1(COutputInfoP);
|
|
|
153 |
extern void c_out_info_set_trailer1(COutputInfoP, struct CCodeT *);
|
|
|
154 |
extern struct CCodeT *c_out_info_get_trailer2(COutputInfoP);
|
|
|
155 |
extern void c_out_info_set_trailer2(COutputInfoP, struct CCodeT *);
|
|
|
156 |
extern NStringP c_out_info_type_prefix(COutputInfoP);
|
|
|
157 |
extern NStringP c_out_info_fn_prefix(COutputInfoP);
|
|
|
158 |
extern NStringP c_out_info_in_prefix(COutputInfoP);
|
|
|
159 |
extern NStringP c_out_info_out_prefix(COutputInfoP);
|
|
|
160 |
extern NStringP c_out_info_label_prefix(COutputInfoP);
|
|
|
161 |
extern NStringP c_out_info_terminal_prefix(COutputInfoP);
|
|
|
162 |
extern NStringP c_out_info_prefix(COutputInfoP, CPrefixT);
|
|
|
163 |
extern BoolT c_out_info_get_prototypes(COutputInfoP);
|
|
|
164 |
extern void c_out_info_set_prototypes(COutputInfoP, BoolT);
|
|
|
165 |
extern BoolT c_out_info_get_numeric_ids(COutputInfoP);
|
|
|
166 |
extern void c_out_info_set_numeric_ids(COutputInfoP, BoolT);
|
|
|
167 |
extern BoolT c_out_info_get_casts(COutputInfoP);
|
|
|
168 |
extern void c_out_info_set_casts(COutputInfoP, BoolT);
|
|
|
169 |
extern BoolT c_out_info_get_unreachable(COutputInfoP);
|
|
|
170 |
extern void c_out_info_set_unreachable(COutputInfoP, BoolT);
|
|
|
171 |
extern BoolT c_out_info_get_lines(COutputInfoP);
|
|
|
172 |
extern void c_out_info_set_lines(COutputInfoP, BoolT);
|
|
|
173 |
extern unsigned c_out_info_get_split(COutputInfoP);
|
|
|
174 |
extern void c_out_info_set_split(COutputInfoP, unsigned);
|
2 |
7u83 |
175 |
|
|
|
176 |
/*--------------------------------------------------------------------------*/
|
|
|
177 |
|
|
|
178 |
#ifdef FS_FAST
|
6 |
7u83 |
179 |
#define c_out_info_info(o) ((o)->info)
|
|
|
180 |
#define c_out_info_ostream(o) (out_info_get_current_ostream((o)->info))
|
|
|
181 |
#define c_out_info_program_name(o) (out_info_get_prog_name((o)->info))
|
|
|
182 |
#define c_out_info_source_name(o)\
|
|
|
183 |
(out_info_get_infile_name((o)->info, (unsigned)0))
|
|
|
184 |
#define c_out_info_c_source_name(o)\
|
|
|
185 |
(out_info_get_infile_name((o)->info, (unsigned)1))
|
|
|
186 |
#define c_out_info_get_header1(o) ((o)->header1)
|
|
|
187 |
#define c_out_info_set_header1(o, c) ((o)->header1 = (c))
|
|
|
188 |
#define c_out_info_get_header2(o) ((o)->header2)
|
|
|
189 |
#define c_out_info_set_header2(o, c) ((o)->header2 = (c))
|
|
|
190 |
#define c_out_info_get_trailer1(o) ((o)->trailer1)
|
|
|
191 |
#define c_out_info_set_trailer1(o, c) ((o)->trailer1 = (c))
|
|
|
192 |
#define c_out_info_get_trailer2(o) ((o)->trailer2)
|
|
|
193 |
#define c_out_info_set_trailer2(o, c) ((o)->trailer2 = (c))
|
|
|
194 |
#define c_out_info_type_prefix(o) (&((o)->prefixes[CPFX_TYPE]))
|
|
|
195 |
#define c_out_info_fn_prefix(o) (&((o)->prefixes[CPFX_FN]))
|
|
|
196 |
#define c_out_info_in_prefix(o) (&((o)->prefixes[CPFX_IN]))
|
|
|
197 |
#define c_out_info_out_prefix(o) (&((o)->prefixes[CPFX_OUT]))
|
|
|
198 |
#define c_out_info_label_prefix(o) (&((o)->prefixes[CPFX_LABEL]))
|
|
|
199 |
#define c_out_info_terminal_prefix(o) (&((o)->prefixes[CPFX_TERMINAL]))
|
|
|
200 |
#define c_out_info_prefix(o, i) (&((o)->prefixes[(i)]))
|
|
|
201 |
#define c_out_info_get_prototypes(o) ((o)->prototypes)
|
|
|
202 |
#define c_out_info_set_prototypes(o, b) ((o)->prototypes = (b))
|
|
|
203 |
#define c_out_info_get_numeric_ids(o) ((o)->numeric_ids)
|
|
|
204 |
#define c_out_info_set_numeric_ids(o, b) ((o)->numeric_ids = (b))
|
|
|
205 |
#define c_out_info_get_casts(o) ((o)->casts)
|
|
|
206 |
#define c_out_info_set_casts(o, b) ((o)->casts = (b))
|
|
|
207 |
#define c_out_info_get_unreachable(o) ((o)->unreachable)
|
|
|
208 |
#define c_out_info_set_unreachable(o, b) ((o)->unreachable = (b))
|
|
|
209 |
#define c_out_info_get_lines(o) ((o)->lines)
|
|
|
210 |
#define c_out_info_set_lines(o, b) ((o)->lines = (b))
|
|
|
211 |
#define c_out_info_get_split(o) ((o)->split)
|
|
|
212 |
#define c_out_info_set_split(o, n) ((o)->split = (n))
|
2 |
7u83 |
213 |
#endif /* defined (FS_FAST) */
|
|
|
214 |
|
|
|
215 |
#endif /* !defined (H_C_OUT_INFO) */
|
|
|
216 |
|
|
|
217 |
/*
|
|
|
218 |
* Local variables(smf):
|
|
|
219 |
* eval: (include::add-path-entry "../os-interface" "../library")
|
|
|
220 |
* eval: (include::add-path-entry "../transforms" "../output" "../generated")
|
|
|
221 |
* end:
|
|
|
222 |
**/
|