]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/m2/mc-boot/GmcLexBuf.h
Update copyright years.
[thirdparty/gcc.git] / gcc / m2 / mc-boot / GmcLexBuf.h
1 /* do not edit automatically generated by mc from mcLexBuf. */
2 /* mcLexBuf.def provides a buffer for the all the tokens created by m2.lex.
3
4 Copyright (C) 2015-2023 Free Software Foundation, Inc.
5 Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
6
7 This file is part of GNU Modula-2.
8
9 GNU Modula-2 is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 3, or (at your option)
12 any later version.
13
14 GNU Modula-2 is distributed in the hope that it will be useful, but
15 WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with GNU Modula-2; see the file COPYING3. If not see
21 <http://www.gnu.org/licenses/>. */
22
23
24 #if !defined (_mcLexBuf_H)
25 # define _mcLexBuf_H
26
27 #include "config.h"
28 #include "system.h"
29 # ifdef __cplusplus
30 extern "C" {
31 # endif
32 # if !defined (PROC_D)
33 # define PROC_D
34 typedef void (*PROC_t) (void);
35 typedef struct { PROC_t proc; } PROC;
36 # endif
37
38 # include "GSYSTEM.h"
39 # include "GmcReserved.h"
40 # include "GDynamicStrings.h"
41 # include "GmcComment.h"
42
43 # if defined (_mcLexBuf_C)
44 # define EXTERN
45 # else
46 # define EXTERN extern
47 # endif
48
49 EXTERN mcReserved_toktype mcLexBuf_currenttoken;
50 EXTERN void * mcLexBuf_currentstring;
51 EXTERN unsigned int mcLexBuf_currentcolumn;
52 EXTERN int mcLexBuf_currentinteger;
53 EXTERN mcComment_commentDesc mcLexBuf_lastcomment;
54 EXTERN mcComment_commentDesc mcLexBuf_currentcomment;
55
56 /*
57 getProcedureComment - returns the procedure comment if it exists,
58 or NIL otherwise.
59 */
60
61 EXTERN mcComment_commentDesc mcLexBuf_getProcedureComment (void);
62
63 /*
64 getBodyComment - returns the body comment if it exists,
65 or NIL otherwise.
66 */
67
68 EXTERN mcComment_commentDesc mcLexBuf_getBodyComment (void);
69
70 /*
71 getAfterComment - returns the after comment if it exists,
72 or NIL otherwise.
73 */
74
75 EXTERN mcComment_commentDesc mcLexBuf_getAfterComment (void);
76
77 /*
78 openSource - Attempts to open the source file, s.
79 The success of the operation is returned.
80 */
81
82 EXTERN unsigned int mcLexBuf_openSource (DynamicStrings_String s);
83
84 /*
85 closeSource - closes the current open file.
86 */
87
88 EXTERN void mcLexBuf_closeSource (void);
89
90 /*
91 reInitialize - re-initialize the all the data structures.
92 */
93
94 EXTERN void mcLexBuf_reInitialize (void);
95
96 /*
97 resetForNewPass - reset the buffer pointers to the beginning ready for
98 a new pass
99 */
100
101 EXTERN void mcLexBuf_resetForNewPass (void);
102
103 /*
104 getToken - gets the next token into currenttoken.
105 */
106
107 EXTERN void mcLexBuf_getToken (void);
108
109 /*
110 insertToken - inserts a symbol, token, infront of the current token
111 ready for the next pass.
112 */
113
114 EXTERN void mcLexBuf_insertToken (mcReserved_toktype token);
115
116 /*
117 insertTokenAndRewind - inserts a symbol, token, infront of the current token
118 and then moves the token stream back onto the inserted token.
119 */
120
121 EXTERN void mcLexBuf_insertTokenAndRewind (mcReserved_toktype token);
122
123 /*
124 getPreviousTokenLineNo - returns the line number of the previous token.
125 */
126
127 EXTERN unsigned int mcLexBuf_getPreviousTokenLineNo (void);
128
129 /*
130 getLineNo - returns the current line number where the symbol occurs in
131 the source file.
132 */
133
134 EXTERN unsigned int mcLexBuf_getLineNo (void);
135
136 /*
137 getTokenNo - returns the current token number.
138 */
139
140 EXTERN unsigned int mcLexBuf_getTokenNo (void);
141
142 /*
143 tokenToLineNo - returns the line number of the current file for the
144 TokenNo. The depth refers to the include depth.
145 A depth of 0 is the current file, depth of 1 is the file
146 which included the current file. Zero is returned if the
147 depth exceeds the file nesting level.
148 */
149
150 EXTERN unsigned int mcLexBuf_tokenToLineNo (unsigned int tokenNo, unsigned int depth);
151
152 /*
153 getColumnNo - returns the current column where the symbol occurs in
154 the source file.
155 */
156
157 EXTERN unsigned int mcLexBuf_getColumnNo (void);
158
159 /*
160 tokenToColumnNo - returns the column number of the current file for the
161 TokenNo. The depth refers to the include depth.
162 A depth of 0 is the current file, depth of 1 is the file
163 which included the current file. Zero is returned if the
164 depth exceeds the file nesting level.
165 */
166
167 EXTERN unsigned int mcLexBuf_tokenToColumnNo (unsigned int tokenNo, unsigned int depth);
168
169 /*
170 findFileNameFromToken - returns the complete FileName for the appropriate
171 source file yields the token number, TokenNo.
172 The, Depth, indicates the include level: 0..n
173 Level 0 is the current. NIL is returned if n+1
174 is requested.
175 */
176
177 EXTERN DynamicStrings_String mcLexBuf_findFileNameFromToken (unsigned int tokenNo, unsigned int depth);
178
179 /*
180 getFileName - returns a String defining the current file.
181 */
182
183 EXTERN DynamicStrings_String mcLexBuf_getFileName (void);
184
185 /*
186 addTok - adds a token to the buffer.
187 */
188
189 EXTERN void mcLexBuf_addTok (mcReserved_toktype t);
190
191 /*
192 addTokCharStar - adds a token to the buffer and an additional string, s.
193 A copy of string, s, is made.
194 */
195
196 EXTERN void mcLexBuf_addTokCharStar (mcReserved_toktype t, void * s);
197
198 /*
199 addTokInteger - adds a token and an integer to the buffer.
200 */
201
202 EXTERN void mcLexBuf_addTokInteger (mcReserved_toktype t, int i);
203
204 /*
205 addTokComment - adds a token to the buffer and a comment descriptor, com.
206 */
207
208 EXTERN void mcLexBuf_addTokComment (mcReserved_toktype t, mcComment_commentDesc com);
209
210 /*
211 setFile - sets the current filename to, filename.
212 */
213
214 EXTERN void mcLexBuf_setFile (void * filename);
215
216 /*
217 pushFile - indicates that, filename, has just been included.
218 */
219
220 EXTERN void mcLexBuf_pushFile (void * filename);
221
222 /*
223 popFile - indicates that we are returning to, filename, having finished
224 an include.
225 */
226
227 EXTERN void mcLexBuf_popFile (void * filename);
228 # ifdef __cplusplus
229 }
230 # endif
231
232 # undef EXTERN
233 #endif