Subversion Repositories tendra.SVN

Rev

Rev 2 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
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
/*** c-code.h --- SID C code stuff.
32
 *
33
 ** Author: Steve Folkes <smf@hermes.mod.uk>
34
 *
35
 *** Commentary:
36
 *
37
 * See the file "c-code.c" for details.
38
 *
39
 *** Change Log:
40
 * $Log: c-code.h,v $
41
 * Revision 1.1.1.1  1998/01/17  15:57:43  release
42
 * First version to be checked into rolling release.
43
 *
44
 * Revision 1.2  1994/12/15  09:56:25  smf
45
 * Brought into line with OSSG C Coding Standards Document, as per
46
 * "CR94_178.sid+tld-update".
47
 *
48
 * Revision 1.1.1.1  1994/07/25  16:04:17  smf
49
 * Initial import of SID 1.8 non shared files.
50
 *
51
**/
52
 
53
/****************************************************************************/
54
 
55
#ifndef H_C_CODE
56
#define H_C_CODE
57
 
58
#include "os-interface.h"
59
#include "c-out-info.h"
60
#include "cstring.h"
61
#include "dalloc.h"
62
#include "dstring.h"
63
#include "entry.h"
64
#include "rstack.h"
65
#include "rule.h"
66
#include "table.h"
67
#include "types.h"
68
 
69
/*--------------------------------------------------------------------------*/
70
 
71
#ifdef FS_NO_ENUM
72
typedef int CCodeItemTypeT, *CCodeItemTypeP;
73
#define CCT_STRING	(0)
74
#define CCT_LABEL	(1)
75
#define CCT_IDENT	(2)
76
#define CCT_MOD_IDENT	(3)
77
#define CCT_REF_IDENT	(4)
78
#define CCT_EXCEPTION	(5)
79
#define CCT_ADVANCE	(6)
80
#define CCT_TERMINAL	(7)
81
#else
82
typedef enum {
83
    CCT_STRING,
84
    CCT_LABEL,
85
    CCT_IDENT,
86
    CCT_MOD_IDENT,
87
    CCT_REF_IDENT,
88
    CCT_EXCEPTION,
89
    CCT_ADVANCE,
90
    CCT_TERMINAL
91
} CCodeItemTypeT, *CCodeItemTypeP;
92
#endif /* defined (FS_NO_ENUM) */
93
 
94
typedef struct CCodeItemT {
95
    struct CCodeItemT	       *next;
96
    CCodeItemTypeT		type;
97
    union {
98
	NStringT		string;
99
	EntryP			ident;
100
    } u;
101
} CCodeItemT, *CCodeItemP;
102
 
103
typedef struct CCodeT {
104
    CCodeItemP			head;
105
    CCodeItemP		       *tail;
106
    unsigned			line;
107
    CStringP			file;
108
    TypeTupleT			param;
109
    TypeTupleT			result;
110
} CCodeT, *CCodeP;
111
 
112
/*--------------------------------------------------------------------------*/
113
 
114
extern CCodeP			c_code_create
115
	PROTO_S ((CStringP, unsigned));
116
extern void			c_code_append_string
117
	PROTO_S ((CCodeP, NStringP));
118
extern void			c_code_append_label
119
	PROTO_S ((CCodeP, NStringP));
120
extern void			c_code_append_identifier
121
	PROTO_S ((CCodeP, NStringP));
122
extern void			c_code_append_modifiable
123
	PROTO_S ((CCodeP, NStringP));
124
extern void			c_code_append_reference
125
	PROTO_S ((CCodeP, NStringP));
126
extern void			c_code_append_exception
127
	PROTO_S ((CCodeP));
128
extern void			c_code_append_advance
129
	PROTO_S ((CCodeP));
130
extern void			c_code_append_terminal
131
	PROTO_S ((CCodeP));
132
extern void			c_code_check
133
	PROTO_S ((CCodeP, BoolT, BoolT, TypeTupleP, TypeTupleP, TableP));
134
extern CStringP			c_code_file
135
	PROTO_S ((CCodeP));
136
extern unsigned			c_code_line
137
	PROTO_S ((CCodeP));
138
extern TypeTupleP		c_code_param
139
	PROTO_S ((CCodeP));
140
extern TypeTupleP		c_code_result
141
	PROTO_S ((CCodeP));
142
extern void			c_code_deallocate
143
	PROTO_S ((CCodeP));
144
 
145
extern void			c_output_c_code_action
146
	PROTO_S ((COutputInfoP, CCodeP, TypeTupleP, TypeTupleP, SaveRStackP,
147
		  RuleP));
148
extern void			c_output_c_code_basic
149
	PROTO_S ((COutputInfoP, CCodeP, TypeTupleP, SaveRStackP));
150
extern void			c_output_c_code_assign
151
	PROTO_S ((COutputInfoP, CCodeP, EntryP, EntryP, EntryP, BoolT, BoolT));
152
extern void			c_output_c_code_param_assign
153
	PROTO_S ((COutputInfoP, CCodeP, EntryP, EntryP));
154
extern void			c_output_c_code_result_assign
155
	PROTO_S ((COutputInfoP, CCodeP, EntryP, EntryP));
156
extern void			c_output_c_code
157
	PROTO_S ((COutputInfoP, CCodeP));
158
 
159
/*--------------------------------------------------------------------------*/
160
 
161
#ifdef FS_FAST
162
#define c_code_file(c) ((c)->file)
163
#define c_code_line(c) ((c)->line)
164
#endif /* defined (FS_FAST) */
165
 
166
#endif /* !defined (H_C_CODE) */
167
 
168
/*
169
 * Local variables(smf):
170
 * eval: (include::add-path-entry "../os-interface" "../library")
171
 * eval: (include::add-path-entry "../transforms" "../output")
172
 * eval: (include::add-path-entry "../c-output" "../generated")
173
 * end:
174
**/