Line data Source code
1 : /* do not edit automatically generated by mc from M2StackSpell. */
2 : /* M2StackSpell.mod maintain a stack of scopes used in spell checks.
3 :
4 : Copyright (C) 2025-2026 Free Software Foundation, Inc.
5 : Contributed by Gaius Mulley <gaiusmod2@gmail.com>.
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 : #include "config.h"
24 : #include "system.h"
25 : #include "gcc-consolidation.h"
26 :
27 : #include <stdbool.h>
28 : # if !defined (PROC_D)
29 : # define PROC_D
30 : typedef void (*PROC_t) (void);
31 : typedef struct { PROC_t proc; } PROC;
32 : # endif
33 :
34 : #if defined(__cplusplus)
35 : # undef NULL
36 : # define NULL 0
37 : #endif
38 : #define _M2StackSpell_C
39 :
40 : #include "GM2StackSpell.h"
41 : # include "GSymbolTable.h"
42 : # include "GSymbolKey.h"
43 : # include "GDynamicStrings.h"
44 : # include "GFormatStrings.h"
45 : # include "GNameKey.h"
46 : # include "GM2MetaError.h"
47 : # include "GM2StackWord.h"
48 : # include "GCDataTypes.h"
49 : # include "GM2Batch.h"
50 : # include "Gm2spellcheck.h"
51 :
52 : typedef enum {M2StackSpell_constant, M2StackSpell_type, M2StackSpell_variable} M2StackSpell_FilterKind;
53 :
54 : typedef unsigned int M2StackSpell_FilterSet;
55 :
56 : static M2StackWord_StackOfWord DefaultStack;
57 : static M2StackSpell_FilterSet CurrentFilter;
58 : static unsigned int PushCount;
59 : static m2spellcheck_Candidates PushCandidate;
60 :
61 : /*
62 : Push - push a scope onto the spelling stack.
63 : sym might be a ModSym, DefImpSym or a varsym
64 : of a record type denoting a with statement.
65 : */
66 :
67 : extern "C" void M2StackSpell_Push (unsigned int sym);
68 :
69 : /*
70 : Pop - remove the top scope from the spelling stack.
71 : */
72 :
73 : extern "C" void M2StackSpell_Pop (void);
74 :
75 : /*
76 : GetRecordField - return the record field containing fieldName.
77 : An error is generated if the fieldName is not
78 : found in record.
79 : */
80 :
81 : extern "C" unsigned int M2StackSpell_GetRecordField (unsigned int tokno, unsigned int record, NameKey_Name fieldName);
82 :
83 : /*
84 : GetDefModuleSpellHint - return a string describing a spelling
85 : hint for the definition module name
86 : similiar to defimp. The premise is that
87 : defimp has been misspelt. NIL is returned
88 : if no hint can be given.
89 : */
90 :
91 : extern "C" DynamicStrings_String M2StackSpell_GetDefModuleSpellHint (unsigned int defimp);
92 :
93 : /*
94 : GetSpellHint - return a string describing a spelling hint.
95 : The spell candidates can be filtered using
96 : the attributes below. Note that the
97 : GetDefModuleSpellHint and GetRecordField
98 : are not filtered.
99 : */
100 :
101 : extern "C" DynamicStrings_String M2StackSpell_GetSpellHint (unsigned int unknown);
102 :
103 : /*
104 : FilterConst - filter on constants.
105 : */
106 :
107 : extern "C" void M2StackSpell_FilterConst (void);
108 :
109 : /*
110 : FilterVariable - filter on variables.
111 : */
112 :
113 : extern "C" void M2StackSpell_FilterVariable (void);
114 :
115 : /*
116 : FilterType - filter on types.
117 : */
118 :
119 : extern "C" void M2StackSpell_FilterType (void);
120 :
121 : /*
122 : CandidatePushName - push a symbol name to the candidate list.
123 : */
124 :
125 : static void CandidatePushName (m2spellcheck_Candidates cand, unsigned int sym);
126 :
127 : /*
128 : PushName - push a name to the candidate vec.
129 : */
130 :
131 : static void PushName (unsigned int sym);
132 :
133 : /*
134 : PushNameFilter - push a name to the candidate vec provided
135 : the filter allows.
136 : */
137 :
138 : static void PushNameFilter (unsigned int sym);
139 :
140 : /*
141 : ForeachRecordFieldDo -
142 : */
143 :
144 : static void ForeachRecordFieldDo (unsigned int record, SymbolKey_PerformOperation op);
145 :
146 : /*
147 : PushCandidates -
148 : */
149 :
150 : static unsigned int PushCandidates (m2spellcheck_Candidates cand, unsigned int sym);
151 :
152 : /*
153 : BuildHintStr - create the did you mean hint and return it
154 : if HintStr is NIL. Otherwise append a hint
155 : to HintStr. If content is NIL then return NIL.
156 : */
157 :
158 : static DynamicStrings_String BuildHintStr (DynamicStrings_String HintStr, const char * content);
159 :
160 : /*
161 : CheckForHintStr - lookup a spell hint matching misspelt. If one exists
162 : then append it to HintStr. Return HintStr.
163 : */
164 :
165 : static DynamicStrings_String CheckForHintStr (unsigned int sym, DynamicStrings_String HintStr, DynamicStrings_String misspelt);
166 :
167 : /*
168 : AddPunctuation - adds punct to the end of str providing that str is non NIL.
169 : */
170 :
171 : static DynamicStrings_String AddPunctuation (DynamicStrings_String str, const char *punct_, unsigned int _punct_high);
172 :
173 : /*
174 : GetSpellHintFilter - return a string describing a spelling hint.
175 : The hint may be filtered.
176 : */
177 :
178 : static DynamicStrings_String GetSpellHintFilter (unsigned int unknown);
179 :
180 : /*
181 : GetExportedSpellHint - return a string describing a spelling hint
182 : using the module exported identifiers.
183 : */
184 :
185 : static DynamicStrings_String GetExportedSpellHint (unsigned int unknown, unsigned int module);
186 :
187 : /*
188 : GetScopeSpellHint - return a string describing a spelling hint
189 : using the visible scopes.
190 : */
191 :
192 : static DynamicStrings_String GetScopeSpellHint (unsigned int unknown);
193 :
194 : /*
195 : Init -
196 : */
197 :
198 : static void Init (void);
199 :
200 :
201 : /*
202 : CandidatePushName - push a symbol name to the candidate list.
203 : */
204 :
205 83 : static void CandidatePushName (m2spellcheck_Candidates cand, unsigned int sym)
206 : {
207 83 : DynamicStrings_String str;
208 :
209 83 : str = DynamicStrings_InitStringCharStar (NameKey_KeyToCharStar (SymbolTable_GetSymName (sym)));
210 83 : m2spellcheck_Push (cand, const_cast <const char * > (static_cast <char * > (DynamicStrings_string (str))));
211 83 : PushCount += 1;
212 83 : }
213 :
214 :
215 : /*
216 : PushName - push a name to the candidate vec.
217 : */
218 :
219 24019 : static void PushName (unsigned int sym)
220 : {
221 24019 : DynamicStrings_String str;
222 :
223 24019 : str = DynamicStrings_InitStringCharStar (NameKey_KeyToCharStar (SymbolTable_GetSymName (sym)));
224 24019 : m2spellcheck_Push (PushCandidate, const_cast <const char * > (static_cast <char * > (DynamicStrings_string (str))));
225 : /* str := KillString (str) ; */
226 24019 : PushCount += 1;
227 24019 : }
228 :
229 :
230 : /*
231 : PushNameFilter - push a name to the candidate vec provided
232 : the filter allows.
233 : */
234 :
235 24747 : static void PushNameFilter (unsigned int sym)
236 : {
237 24747 : if (CurrentFilter == (M2StackSpell_FilterSet) 0)
238 : {
239 : /* No filtering. */
240 23827 : PushName (sym);
241 : }
242 : else
243 : {
244 920 : if (((((1 << (M2StackSpell_constant-M2StackSpell_constant)) & (CurrentFilter)) != 0)) && (SymbolTable_IsConst (sym)))
245 : {
246 0 : PushName (sym);
247 : }
248 920 : else if (((((1 << (M2StackSpell_type-M2StackSpell_constant)) & (CurrentFilter)) != 0)) && (SymbolTable_IsAModula2Type (sym)))
249 : {
250 : /* avoid dangling else. */
251 140 : PushName (sym);
252 : }
253 780 : else if (((((1 << (M2StackSpell_variable-M2StackSpell_constant)) & (CurrentFilter)) != 0)) && (SymbolTable_IsVar (sym)))
254 : {
255 : /* avoid dangling else. */
256 4 : PushName (sym);
257 : }
258 : }
259 24747 : }
260 :
261 :
262 : /*
263 : ForeachRecordFieldDo -
264 : */
265 :
266 12 : static void ForeachRecordFieldDo (unsigned int record, SymbolKey_PerformOperation op)
267 : {
268 12 : unsigned int i;
269 12 : unsigned int field;
270 :
271 12 : i = 1;
272 36 : do {
273 36 : field = SymbolTable_GetNth (record, i);
274 36 : if (field != SymbolTable_NulSym)
275 : {
276 24 : (*op.proc) (field);
277 : }
278 36 : i += 1;
279 36 : } while (! (field == SymbolTable_NulSym));
280 12 : }
281 :
282 :
283 : /*
284 : PushCandidates -
285 : */
286 :
287 462 : static unsigned int PushCandidates (m2spellcheck_Candidates cand, unsigned int sym)
288 : {
289 462 : PushCount = 0;
290 462 : PushCandidate = cand;
291 462 : if ((SymbolTable_IsModule (sym)) || (SymbolTable_IsDefImp (sym)))
292 : {
293 442 : SymbolTable_ForeachProcedureDo (sym, (SymbolKey_PerformOperation) {(SymbolKey_PerformOperation_t) PushNameFilter});
294 442 : SymbolTable_ForeachLocalSymDo (sym, (SymbolKey_PerformOperation) {(SymbolKey_PerformOperation_t) PushNameFilter});
295 : }
296 20 : else if (SymbolTable_IsEnumeration (sym))
297 : {
298 : /* avoid dangling else. */
299 0 : SymbolTable_ForeachFieldEnumerationDo (sym, (SymbolKey_PerformOperation) {(SymbolKey_PerformOperation_t) PushNameFilter});
300 : }
301 20 : else if (SymbolTable_IsRecord (sym))
302 : {
303 : /* avoid dangling else. */
304 12 : ForeachRecordFieldDo (sym, (SymbolKey_PerformOperation) {(SymbolKey_PerformOperation_t) PushNameFilter});
305 : }
306 462 : return PushCount;
307 : /* static analysis guarentees a RETURN statement will be used before here. */
308 : __builtin_unreachable ();
309 : }
310 :
311 :
312 : /*
313 : BuildHintStr - create the did you mean hint and return it
314 : if HintStr is NIL. Otherwise append a hint
315 : to HintStr. If content is NIL then return NIL.
316 : */
317 :
318 482 : static DynamicStrings_String BuildHintStr (DynamicStrings_String HintStr, const char * content)
319 : {
320 482 : DynamicStrings_String str;
321 :
322 482 : if (content != NULL)
323 : {
324 78 : str = DynamicStrings_InitStringCharStar (static_cast <void *> (const_cast <char * > (content)));
325 78 : if (HintStr == NULL)
326 : {
327 78 : return FormatStrings_Sprintf1 (DynamicStrings_Mark (DynamicStrings_InitString ((const char *) ", did you mean %s", 17)), (const unsigned char *) &str, (sizeof (str)-1));
328 : }
329 : else
330 : {
331 0 : return FormatStrings_Sprintf2 (DynamicStrings_Mark (DynamicStrings_InitString ((const char *) "%s or %s", 8)), (const unsigned char *) &HintStr, (sizeof (HintStr)-1), (const unsigned char *) &str, (sizeof (str)-1));
332 : }
333 : }
334 : return static_cast<DynamicStrings_String> (NULL);
335 : /* static analysis guarentees a RETURN statement will be used before here. */
336 : __builtin_unreachable ();
337 : }
338 :
339 :
340 : /*
341 : CheckForHintStr - lookup a spell hint matching misspelt. If one exists
342 : then append it to HintStr. Return HintStr.
343 : */
344 :
345 456 : static DynamicStrings_String CheckForHintStr (unsigned int sym, DynamicStrings_String HintStr, DynamicStrings_String misspelt)
346 : {
347 456 : m2spellcheck_Candidates cand;
348 456 : const char * content;
349 :
350 456 : if (((((SymbolTable_IsModule (sym)) || (SymbolTable_IsDefImp (sym))) || (SymbolTable_IsProcedure (sym))) || (SymbolTable_IsRecord (sym))) || (SymbolTable_IsEnumeration (sym)))
351 : {
352 456 : cand = m2spellcheck_InitCandidates ();
353 456 : if ((PushCandidates (cand, sym)) > 1)
354 : {
355 441 : content = m2spellcheck_FindClosestCharStar (cand, const_cast <const char * > (static_cast <char * > (DynamicStrings_string (misspelt))));
356 : }
357 : else
358 : {
359 : content = static_cast<const char *> (NULL);
360 : }
361 456 : m2spellcheck_KillCandidates (&cand);
362 456 : HintStr = BuildHintStr (HintStr, content);
363 : }
364 456 : return HintStr;
365 : /* static analysis guarentees a RETURN statement will be used before here. */
366 : __builtin_unreachable ();
367 : }
368 :
369 :
370 : /*
371 : AddPunctuation - adds punct to the end of str providing that str is non NIL.
372 : */
373 :
374 286 : static DynamicStrings_String AddPunctuation (DynamicStrings_String str, const char *punct_, unsigned int _punct_high)
375 : {
376 286 : char punct[_punct_high+1];
377 :
378 : /* make a local copy of each unbounded array. */
379 286 : memcpy (punct, punct_, _punct_high+1);
380 :
381 286 : if (str == NULL)
382 : {
383 : return static_cast<DynamicStrings_String> (NULL);
384 : }
385 : else
386 : {
387 78 : return DynamicStrings_ConCat (str, DynamicStrings_Mark (DynamicStrings_InitString ((const char *) punct, _punct_high)));
388 : }
389 : /* static analysis guarentees a RETURN statement will be used before here. */
390 : __builtin_unreachable ();
391 286 : }
392 :
393 :
394 : /*
395 : GetSpellHintFilter - return a string describing a spelling hint.
396 : The hint may be filtered.
397 : */
398 :
399 263 : static DynamicStrings_String GetSpellHintFilter (unsigned int unknown)
400 : {
401 263 : if (((SymbolTable_IsUnknown (unknown)) && (SymbolTable_GetUnknownOnImport (unknown))) && ((SymbolTable_GetUnknownDeclScope (unknown)) != (SymbolTable_GetScope (unknown))))
402 : {
403 : /* It was created during an import statement. */
404 9 : return GetExportedSpellHint (unknown, SymbolTable_GetUnknownDeclScope (unknown));
405 : }
406 254 : return GetScopeSpellHint (unknown);
407 : /* static analysis guarentees a RETURN statement will be used before here. */
408 : __builtin_unreachable ();
409 : }
410 :
411 :
412 : /*
413 : GetExportedSpellHint - return a string describing a spelling hint
414 : using the module exported identifiers.
415 : */
416 :
417 9 : static DynamicStrings_String GetExportedSpellHint (unsigned int unknown, unsigned int module)
418 : {
419 9 : const char * content;
420 9 : DynamicStrings_String misspell;
421 9 : DynamicStrings_String HintStr;
422 :
423 9 : misspell = DynamicStrings_InitStringCharStar (NameKey_KeyToCharStar (SymbolTable_GetSymName (unknown)));
424 9 : HintStr = static_cast<DynamicStrings_String> (NULL);
425 9 : PushCount = 0;
426 9 : PushCandidate = m2spellcheck_InitCandidates ();
427 9 : SymbolTable_ForeachExportedDo (module, (SymbolKey_PerformOperation) {(SymbolKey_PerformOperation_t) PushName});
428 9 : SymbolTable_ForeachLocalSymDo (module, (SymbolKey_PerformOperation) {(SymbolKey_PerformOperation_t) PushName});
429 9 : if (PushCount > 0)
430 : {
431 9 : content = m2spellcheck_FindClosestCharStar (PushCandidate, const_cast <const char * > (static_cast <char * > (DynamicStrings_string (misspell))));
432 9 : HintStr = BuildHintStr (HintStr, content);
433 : }
434 9 : m2spellcheck_KillCandidates (&PushCandidate);
435 9 : return AddPunctuation (HintStr, (const char *) "?", 1);
436 : /* static analysis guarentees a RETURN statement will be used before here. */
437 : __builtin_unreachable ();
438 : }
439 :
440 :
441 : /*
442 : GetScopeSpellHint - return a string describing a spelling hint
443 : using the visible scopes.
444 : */
445 :
446 254 : static DynamicStrings_String GetScopeSpellHint (unsigned int unknown)
447 : {
448 254 : unsigned int i;
449 254 : unsigned int n;
450 254 : unsigned int sym;
451 254 : DynamicStrings_String misspell;
452 254 : DynamicStrings_String HintStr;
453 :
454 254 : misspell = DynamicStrings_InitStringCharStar (NameKey_KeyToCharStar (SymbolTable_GetSymName (unknown)));
455 254 : HintStr = static_cast<DynamicStrings_String> (NULL);
456 254 : n = M2StackWord_NoOfItemsInStackWord (DefaultStack);
457 254 : i = 1;
458 964 : while ((i <= n) && (HintStr == NULL))
459 : {
460 456 : sym = static_cast<unsigned int> (M2StackWord_PeepWord (DefaultStack, i));
461 456 : HintStr = CheckForHintStr (sym, HintStr, misspell);
462 456 : i += 1;
463 : }
464 254 : return AddPunctuation (HintStr, (const char *) "?", 1);
465 : /* static analysis guarentees a RETURN statement will be used before here. */
466 : __builtin_unreachable ();
467 : }
468 :
469 :
470 : /*
471 : Init -
472 : */
473 :
474 15451 : static void Init (void)
475 : {
476 0 : DefaultStack = M2StackWord_InitStackWord ();
477 15451 : CurrentFilter = (M2StackSpell_FilterSet) 0;
478 0 : }
479 :
480 :
481 : /*
482 : Push - push a scope onto the spelling stack.
483 : sym might be a ModSym, DefImpSym or a varsym
484 : of a record type denoting a with statement.
485 : */
486 :
487 11571569 : extern "C" void M2StackSpell_Push (unsigned int sym)
488 : {
489 11571569 : M2StackWord_PushWord (DefaultStack, sym);
490 11571569 : }
491 :
492 :
493 : /*
494 : Pop - remove the top scope from the spelling stack.
495 : */
496 :
497 11571033 : extern "C" void M2StackSpell_Pop (void)
498 : {
499 11571033 : if ((M2StackWord_PopWord (DefaultStack)) == 0)
500 : {} /* empty. */
501 11571033 : }
502 :
503 :
504 : /*
505 : GetRecordField - return the record field containing fieldName.
506 : An error is generated if the fieldName is not
507 : found in record.
508 : */
509 :
510 26740 : extern "C" unsigned int M2StackSpell_GetRecordField (unsigned int tokno, unsigned int record, NameKey_Name fieldName)
511 : {
512 26740 : DynamicStrings_String str;
513 26740 : unsigned int sym;
514 26740 : NameKey_Name recordName;
515 26740 : const char * content;
516 26740 : m2spellcheck_Candidates cand;
517 26740 : DynamicStrings_String fieldStr;
518 26740 : DynamicStrings_String recordStr;
519 26740 : DynamicStrings_String contentStr;
520 :
521 26740 : sym = SymbolTable_GetLocalSym (record, fieldName);
522 26740 : if (sym == SymbolTable_NulSym)
523 : {
524 6 : recordName = SymbolTable_GetSymName (record);
525 6 : content = static_cast<const char *> (NULL);
526 6 : cand = m2spellcheck_InitCandidates ();
527 6 : if ((PushCandidates (cand, record)) > 0)
528 : {
529 6 : content = m2spellcheck_FindClosestCharStar (cand, const_cast <const char * > (static_cast <char * > (NameKey_KeyToCharStar (fieldName))));
530 : }
531 6 : fieldStr = DynamicStrings_Mark (DynamicStrings_InitStringCharStar (NameKey_KeyToCharStar (fieldName)));
532 6 : recordStr = DynamicStrings_Mark (DynamicStrings_InitStringCharStar (NameKey_KeyToCharStar (recordName)));
533 6 : if (content == NULL)
534 : {
535 0 : str = FormatStrings_Sprintf2 (DynamicStrings_Mark (DynamicStrings_InitString ((const char *) "field %s does not exist within record %s", 40)), (const unsigned char *) &fieldStr, (sizeof (fieldStr)-1), (const unsigned char *) &recordStr, (sizeof (recordStr)-1));
536 : }
537 : else
538 : {
539 6 : contentStr = DynamicStrings_Mark (DynamicStrings_InitStringCharStar (static_cast <void *> (const_cast <char * > (content))));
540 6 : str = FormatStrings_Sprintf3 (DynamicStrings_Mark (DynamicStrings_InitString ((const char *) "field %s does not exist within record %s, did you mean %s?", 58)), (const unsigned char *) &fieldStr, (sizeof (fieldStr)-1), (const unsigned char *) &recordStr, (sizeof (recordStr)-1), (const unsigned char *) &contentStr, (sizeof (contentStr)-1));
541 : }
542 6 : M2MetaError_MetaErrorStringT0 (tokno, str);
543 6 : m2spellcheck_KillCandidates (&cand);
544 : }
545 26740 : return sym;
546 : /* static analysis guarentees a RETURN statement will be used before here. */
547 : __builtin_unreachable ();
548 : }
549 :
550 :
551 : /*
552 : GetDefModuleSpellHint - return a string describing a spelling
553 : hint for the definition module name
554 : similiar to defimp. The premise is that
555 : defimp has been misspelt. NIL is returned
556 : if no hint can be given.
557 : */
558 :
559 23 : extern "C" DynamicStrings_String M2StackSpell_GetDefModuleSpellHint (unsigned int defimp)
560 : {
561 23 : unsigned int i;
562 23 : unsigned int sym;
563 23 : m2spellcheck_Candidates cand;
564 23 : const char * misspell;
565 23 : const char * content;
566 23 : DynamicStrings_String HintStr;
567 :
568 23 : HintStr = static_cast<DynamicStrings_String> (NULL);
569 23 : if ((SymbolTable_GetSymName (defimp)) != NameKey_NulName)
570 : {
571 17 : misspell = static_cast<const char *> (NameKey_KeyToCharStar (SymbolTable_GetSymName (defimp)));
572 17 : i = 1;
573 17 : sym = M2Batch_GetModuleNo (i);
574 17 : cand = m2spellcheck_InitCandidates ();
575 117 : while (sym != SymbolTable_NulSym)
576 : {
577 100 : if (sym != defimp)
578 : {
579 83 : CandidatePushName (cand, sym);
580 : }
581 100 : i += 1;
582 100 : sym = M2Batch_GetModuleNo (i);
583 : }
584 17 : content = m2spellcheck_FindClosestCharStar (cand, misspell);
585 17 : HintStr = BuildHintStr (HintStr, content);
586 17 : m2spellcheck_KillCandidates (&cand);
587 : }
588 23 : return AddPunctuation (HintStr, (const char *) "?", 1);
589 : /* static analysis guarentees a RETURN statement will be used before here. */
590 : __builtin_unreachable ();
591 : }
592 :
593 :
594 : /*
595 : GetSpellHint - return a string describing a spelling hint.
596 : The spell candidates can be filtered using
597 : the attributes below. Note that the
598 : GetDefModuleSpellHint and GetRecordField
599 : are not filtered.
600 : */
601 :
602 263 : extern "C" DynamicStrings_String M2StackSpell_GetSpellHint (unsigned int unknown)
603 : {
604 263 : DynamicStrings_String hint;
605 :
606 263 : hint = GetSpellHintFilter (unknown);
607 263 : CurrentFilter = (M2StackSpell_FilterSet) 0; /* Reset for the next time. */
608 263 : return hint; /* Reset for the next time. */
609 : /* static analysis guarentees a RETURN statement will be used before here. */
610 : __builtin_unreachable ();
611 : }
612 :
613 :
614 : /*
615 : FilterConst - filter on constants.
616 : */
617 :
618 2 : extern "C" void M2StackSpell_FilterConst (void)
619 : {
620 2 : CurrentFilter |= (1 << (M2StackSpell_constant-M2StackSpell_constant ));
621 2 : }
622 :
623 :
624 : /*
625 : FilterVariable - filter on variables.
626 : */
627 :
628 2 : extern "C" void M2StackSpell_FilterVariable (void)
629 : {
630 2 : CurrentFilter |= (1 << (M2StackSpell_variable-M2StackSpell_constant ));
631 2 : }
632 :
633 :
634 : /*
635 : FilterType - filter on types.
636 : */
637 :
638 7 : extern "C" void M2StackSpell_FilterType (void)
639 : {
640 7 : CurrentFilter |= (1 << (M2StackSpell_type-M2StackSpell_constant ));
641 7 : }
642 :
643 15451 : extern "C" void _M2_M2StackSpell_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
644 : {
645 15451 : Init ();
646 15451 : }
647 :
648 0 : extern "C" void _M2_M2StackSpell_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
649 : {
650 0 : }
|