aboutsummaryrefslogtreecommitdiff
path: root/gcc/m2/gm2-compiler/M2GCCDeclare.def
blob: 2215b54b1b8e020fcd1db3a32c3a188791be8543 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
(* M2GCCDeclare.def declares Modula-2 types to GCC.

Copyright (C) 2001-2023 Free Software Foundation, Inc.
Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.

This file is part of GNU Modula-2.

GNU Modula-2 is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3, or (at your option)
any later version.

GNU Modula-2 is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
General Public License for more details.

You should have received a copy of the GNU General Public License
along with GNU Modula-2; see the file COPYING3.  If not see
<http://www.gnu.org/licenses/>.  *)

DEFINITION MODULE M2GCCDeclare ;

(*
    Title      : M2GCCDeclare
    Author     : Gaius Mulley
    System     : UNIX (gm2)
    Date       : Sat Jul 17 10:28:43 1999
    Last edit  : Sat Jul 17 10:28:43 1999
    Description: declares Modula-2 types to GCC,
                 only declares a type once all subcomponents are known.
*)

FROM SYSTEM IMPORT WORD ;
FROM m2tree IMPORT Tree ;
EXPORT QUALIFIED FoldConstants,
                 DeclareConstant, TryDeclareConstant,
                 DeclareConstructor, TryDeclareConstructor,
                 DeclareLocalVariables, PromoteToString, DeclareLocalVariable,
                 InitDeclarations, StartDeclareScope, EndDeclareScope,
                 DeclareModuleVariables, IsProcedureGccNested,
                 DeclareProcedure, PoisonSymbols, DeclareParameters,
                 DeclareM2linkGlobals,
                 CompletelyResolved, MarkExported, PrintSym,
                 ConstantKnownAndUsed,
                 PutToBeSolvedByQuads,
                 GetTypeMin, GetTypeMax,
                 WalkAction, IsAction ;

TYPE
   WalkAction = PROCEDURE (WORD) ;
   IsAction   = PROCEDURE (WORD) : BOOLEAN ;


(*
   FoldConstants - a wrapper for ResolveConstantExpressions.
*)

PROCEDURE FoldConstants (start, end: CARDINAL) ;


(*
   StartDeclareScope - declares types, variables associated with this scope.
*)

PROCEDURE StartDeclareScope (scope: CARDINAL) ;


(*
   EndDeclareScope -
*)

PROCEDURE EndDeclareScope ;


(*
   DeclareParameters -
*)

PROCEDURE DeclareParameters (sym: CARDINAL) ;


(*
   DeclareConstant - if, sym, is a constant then declare it.
                     The constant must be solvable at this point.
*)

PROCEDURE DeclareConstant (tokenno: CARDINAL; sym: CARDINAL) ;


(*
   DeclareConstructor - if, sym, is a constructor then declare it.
                        The constructor must be solvable at this point.
*)

PROCEDURE DeclareConstructor (tokenno: CARDINAL; quad: CARDINAL; sym: CARDINAL) ;


(*
   TryDeclareConstant - try and declare a constant.  If, sym, is a
                        constant try and declare it, if we cannot
                        then enter it into the to do list.
*)

PROCEDURE TryDeclareConstant (tokenno: CARDINAL; sym: CARDINAL) ;


(*
   TryDeclareConstructor - try and declare a constructor.  If, sym, is a
                           constructor try and declare it, if we cannot
                           then enter it into the to do list.
*)

PROCEDURE TryDeclareConstructor (tokenno: CARDINAL; sym: CARDINAL) ;


(*
   DeclareLocalVariables - lists the Local variables for procedure
                           together with their offset.
*)

PROCEDURE DeclareLocalVariables (procedure: CARDINAL) ;


(*
   DeclareLocalVariable - declare a local variable var.
*)

PROCEDURE DeclareLocalVariable (var: CARDINAL) ;


(*
   DeclareProcedure - declares procedure, sym, or all procedures inside
                      module sym.
*)

PROCEDURE DeclareProcedure (sym: WORD) ;


(*
   DeclareModuleVariables - declares Module variables for a module
                            which inside a procedure.
*)

PROCEDURE DeclareModuleVariables (sym: CARDINAL) ;


(*
   DeclareM2linkGlobals - will create M2LINK.StaticInitialization
                          and M2LINK.ForcedModuleInitOrder providing
                          they have not already been created.
*)

PROCEDURE DeclareM2linkGlobals (tokenno: CARDINAL) ;


(*
   IsProcedureGccNested - returns TRUE if procedure, sym, will be considered
                          as nested by GCC.
                          This will occur if either its outer defining scope
                          is a procedure or is a module which is inside a
                          procedure.
*)

PROCEDURE IsProcedureGccNested (sym: CARDINAL) : BOOLEAN ;


(*
   PoisonSymbols - poisons all gcc symbols from procedure, sym.
                   A debugging aid.
*)

PROCEDURE PoisonSymbols (sym: CARDINAL) ;


(*
   PromoteToString - declare, sym, and then promote it to a string.
                     Note that if sym is a single character we do
                          *not* record it as a string
                          but as a char however we always
                          return a string constant.
*)

PROCEDURE PromoteToString (tokenno: CARDINAL; sym: CARDINAL) : Tree ;


(*
   CompletelyResolved - returns TRUE if a symbol has been completely resolved
                        and is not partially declared (such as a record,
                        array or procedure type).
*)

PROCEDURE CompletelyResolved (sym: CARDINAL) : BOOLEAN ;


(*
   ConstantKnownAndUsed -
*)

PROCEDURE ConstantKnownAndUsed (sym: CARDINAL; t: Tree) ;


(*
   PutToBeSolvedByQuads - places, sym, in this list.
*)

PROCEDURE PutToBeSolvedByQuads (sym: CARDINAL) ;


(*
   MarkExported - tell GCC to mark all exported procedures in module sym.
*)

PROCEDURE MarkExported (sym: CARDINAL) ;


(*
   GetTypeMin - returns a symbol corresponding to MIN(type)
*)

PROCEDURE GetTypeMin (type: CARDINAL) : CARDINAL ;


(*
   GetTypeMax - returns a symbol corresponding to MAX(type)
*)

PROCEDURE GetTypeMax (type: CARDINAL) : CARDINAL ;


(*
   PrintSym - prints limited information about a symbol.
*)

PROCEDURE PrintSym (sym: CARDINAL) ;


(*
   InitDeclarations - initializes default types and the source filename.
*)

PROCEDURE InitDeclarations ;


END M2GCCDeclare.