Branch data 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-2024 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 <stdbool.h>
26 : : # if !defined (PROC_D)
27 : : # define PROC_D
28 : : typedef void (*PROC_t) (void);
29 : : typedef struct { PROC_t proc; } PROC;
30 : : # endif
31 : :
32 : : # if !defined (FALSE)
33 : : # define FALSE (1==0)
34 : : # endif
35 : :
36 : : #define _M2Bitset_H
37 : : #define _M2Bitset_C
38 : :
39 : : # include "GM2Debug.h"
40 : : # include "Gm2tree.h"
41 : : # include "Gm2linemap.h"
42 : : # include "Gm2type.h"
43 : : # include "Gm2decl.h"
44 : : # include "Gm2expr.h"
45 : : # include "GM2ALU.h"
46 : : # include "GNameKey.h"
47 : : # include "GM2System.h"
48 : : # include "GM2Base.h"
49 : : # include "GM2LexBuf.h"
50 : : # include "GSymbolTable.h"
51 : :
52 : : unsigned int M2Bitset_Bitnum;
53 : : unsigned int M2Bitset_Bitset;
54 : : static unsigned int MinBitset;
55 : : static unsigned int MaxBitset;
56 : :
57 : : /*
58 : : MakeBitset - creates and declares the type BITSET.
59 : : */
60 : :
61 : : extern "C" void M2Bitset_MakeBitset (void);
62 : :
63 : : /*
64 : : GetBitsetMinMax - assigns min and max to the minimum and maximum values of BITSET.
65 : : */
66 : :
67 : : extern "C" void M2Bitset_GetBitsetMinMax (unsigned int *min, unsigned int *max);
68 : :
69 : :
70 : : /*
71 : : MakeBitset - creates and declares the type BITSET.
72 : : */
73 : :
74 : 12963 : extern "C" void M2Bitset_MakeBitset (void)
75 : : {
76 : 12963 : M2Bitset_Bitset = SymbolTable_MakeSet (M2LexBuf_BuiltinTokenNo, NameKey_MakeKey ((const char *) "BITSET", 6)); /* Base Type */
77 : : /* MinBitset */
78 : 12963 : MinBitset = SymbolTable_MakeConstLit (M2LexBuf_BuiltinTokenNo, NameKey_MakeKey ((const char *) "0", 1), M2Base_Cardinal);
79 : : /* MaxBitset */
80 : 12963 : MaxBitset = SymbolTable_MakeConstVar (M2LexBuf_BuiltinTokenNo, NameKey_MakeKey ((const char *) "MaxBitset", 9));
81 : 12963 : M2ALU_PushCard (static_cast<unsigned int> ((m2decl_GetBitsPerBitset ())-1));
82 : 12963 : SymbolTable_PopValue (MaxBitset);
83 : 12963 : M2Debug_Assert (M2System_Word != SymbolTable_NulSym);
84 : 12963 : M2Bitset_Bitnum = SymbolTable_MakeSubrange (M2LexBuf_BuiltinTokenNo, NameKey_MakeKey ((const char *) "BITNUM", 6));
85 : 12963 : SymbolTable_PutSubrange (M2Bitset_Bitnum, MinBitset, MaxBitset, M2Base_Cardinal);
86 : 12963 : SymbolTable_PutSet (M2Bitset_Bitset, M2Bitset_Bitnum, false);
87 : 12963 : M2ALU_PushIntegerTree (m2expr_GetSizeOf (m2linemap_BuiltinsLocation (), m2type_GetWordType ()));
88 : 12963 : SymbolTable_PopSize (M2Bitset_Bitset);
89 : 12963 : }
90 : :
91 : :
92 : : /*
93 : : GetBitsetMinMax - assigns min and max to the minimum and maximum values of BITSET.
94 : : */
95 : :
96 : 0 : extern "C" void M2Bitset_GetBitsetMinMax (unsigned int *min, unsigned int *max)
97 : : {
98 : 0 : (*min) = MinBitset;
99 : 0 : (*max) = MaxBitset;
100 : 0 : }
101 : :
102 : 12963 : extern "C" void _M2_M2Bitset_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
103 : : {
104 : 12963 : }
105 : :
106 : 0 : extern "C" void _M2_M2Bitset_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
107 : : {
108 : 0 : }
|