Line data Source code
1 : /* do not edit automatically generated by mc from M2Bitset. */
2 : /* M2Bitset.mod provides the BITSET type.
3 :
4 : Copyright (C) 2003-2026 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 : #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 (FALSE)
35 : # define FALSE (1==0)
36 : # endif
37 :
38 : #define _M2Bitset_C
39 :
40 : #include "GM2Bitset.h"
41 : # include "GM2Debug.h"
42 : # include "Gm2linemap.h"
43 : # include "Gm2type.h"
44 : # include "Gm2decl.h"
45 : # include "Gm2expr.h"
46 : # include "GM2ALU.h"
47 : # include "GNameKey.h"
48 : # include "GM2System.h"
49 : # include "GM2Base.h"
50 : # include "GM2LexBuf.h"
51 : # include "GSymbolTable.h"
52 :
53 : static unsigned int MinBitset;
54 : static unsigned int MaxBitset;
55 :
56 : /*
57 : MakeBitset - creates and declares the type BITSET.
58 : */
59 :
60 : extern "C" void M2Bitset_MakeBitset (void);
61 :
62 : /*
63 : GetBitsetMinMax - assigns min and max to the minimum and maximum values of BITSET.
64 : */
65 :
66 : extern "C" void M2Bitset_GetBitsetMinMax (unsigned int *min, unsigned int *max);
67 :
68 :
69 : /*
70 : MakeBitset - creates and declares the type BITSET.
71 : */
72 :
73 14952 : extern "C" void M2Bitset_MakeBitset (void)
74 : {
75 14952 : M2Bitset_Bitset = SymbolTable_MakeSet (M2LexBuf_BuiltinTokenNo, NameKey_MakeKey ((const char *) "BITSET", 6)); /* Base Type */
76 : /* MinBitset */
77 14952 : MinBitset = SymbolTable_MakeConstLit (M2LexBuf_BuiltinTokenNo, NameKey_MakeKey ((const char *) "0", 1), M2Base_Cardinal);
78 : /* MaxBitset */
79 14952 : MaxBitset = SymbolTable_MakeConstVar (M2LexBuf_BuiltinTokenNo, NameKey_MakeKey ((const char *) "MaxBitset", 9));
80 14952 : M2ALU_PushCard (static_cast<unsigned int> ((m2decl_GetBitsPerBitset ())-1));
81 14952 : SymbolTable_PopValue (MaxBitset);
82 14952 : M2Debug_Assert (M2System_Word != SymbolTable_NulSym);
83 14952 : M2Bitset_Bitnum = SymbolTable_MakeSubrange (M2LexBuf_BuiltinTokenNo, NameKey_MakeKey ((const char *) "BITNUM", 6));
84 14952 : SymbolTable_PutSubrange (M2Bitset_Bitnum, MinBitset, MaxBitset, M2Base_Cardinal);
85 14952 : SymbolTable_PutSet (M2Bitset_Bitset, M2Bitset_Bitnum, false);
86 14952 : M2ALU_PushIntegerTree (m2expr_GetSizeOf (m2linemap_BuiltinsLocation (), m2type_GetWordType ()));
87 14952 : SymbolTable_PopSize (M2Bitset_Bitset);
88 14952 : }
89 :
90 :
91 : /*
92 : GetBitsetMinMax - assigns min and max to the minimum and maximum values of BITSET.
93 : */
94 :
95 0 : extern "C" void M2Bitset_GetBitsetMinMax (unsigned int *min, unsigned int *max)
96 : {
97 0 : (*min) = MinBitset;
98 0 : (*max) = MaxBitset;
99 0 : }
100 :
101 14952 : extern "C" void _M2_M2Bitset_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
102 : {
103 14952 : }
104 :
105 0 : extern "C" void _M2_M2Bitset_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
106 : {
107 0 : }
|