(root)/
gcc-13.2.0/
gcc/
m2/
gm2-gcc/
m2type.h
       1  /* m2type.h header file for m2type.cc.
       2  
       3  Copyright (C) 2012-2023 Free Software Foundation, Inc.
       4  Contributed by Gaius Mulley <gaius@glam.ac.uk>.
       5  
       6  This file is part of GNU Modula-2.
       7  
       8  GNU Modula-2 is free software; you can redistribute it and/or modify
       9  it under the terms of the GNU General Public License as published by
      10  the Free Software Foundation; either version 3, or (at your option)
      11  any later version.
      12  
      13  GNU Modula-2 is distributed in the hope that it will be useful, but
      14  WITHOUT ANY WARRANTY; without even the implied warranty of
      15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      16  General Public License for more details.
      17  
      18  You should have received a copy of the GNU General Public License
      19  along with GNU Modula-2; see the file COPYING3.  If not see
      20  <http://www.gnu.org/licenses/>.  */
      21  
      22  #if !defined(m2type_h)
      23  #define m2type_h
      24  #if defined(m2type_c)
      25  #if defined(__GNUG__)
      26  #define EXTERN extern "C"
      27  #else /* !__GNUG__.  */
      28  #define EXTERN
      29  #endif /* !__GNUG__.  */
      30  #else /* !m2type_c.  */
      31  #if defined(__GNUG__)
      32  #define EXTERN extern "C"
      33  #else /* !__GNUG__.  */
      34  #define EXTERN extern
      35  #endif /* !__GNUG__.  */
      36  #endif /* !m2type_c.  */
      37  
      38  #include <stdbool.h>
      39  
      40  typedef void *m2type_Constructor;
      41  
      42  EXTERN bool m2type_ValueInTypeRange (tree type, tree value);
      43  EXTERN bool m2type_ExceedsTypeRange (tree type, tree low, tree high);
      44  EXTERN bool m2type_ValueOutOfTypeRange (tree type, tree value);
      45  EXTERN bool m2type_WithinTypeRange (tree type, tree low, tree high);
      46  EXTERN tree m2type_BuildStartArrayType (tree index_type, tree elt_type,
      47                                          int type);
      48  EXTERN void m2type_PutArrayType (tree array, tree type);
      49  EXTERN tree m2type_BuildEndArrayType (tree arraytype, tree elementtype,
      50                                        tree indextype, int type);
      51  EXTERN tree m2type_GetArrayNoOfElements (location_t location, tree arraytype);
      52  EXTERN tree m2type_BuildArrayIndexType (tree low, tree high);
      53  EXTERN void m2type_GarbageCollect (void);
      54  EXTERN void m2type_MarkFunctionReferenced (tree f);
      55  EXTERN void m2type_AddStatement (location_t location, tree t);
      56  EXTERN tree m2type_BuildNumberOfArrayElements (location_t location,
      57                                                 tree arrayType);
      58  EXTERN tree m2type_BuildPackedFieldRecord (location_t location, char *name,
      59                                             tree fieldtype);
      60  EXTERN tree m2type_SetRecordFieldOffset (tree field, tree byteOffset,
      61                                           tree bitOffset, tree fieldtype,
      62                                           tree nbits);
      63  EXTERN tree m2type_SetTypePacked (tree node);
      64  EXTERN tree m2type_SetDeclPacked (tree node);
      65  EXTERN tree m2type_SetAlignment (tree node, tree align);
      66  EXTERN tree m2type_BuildEndRecord (location_t location, tree record,
      67                                     tree fieldlist, bool isPacked);
      68  EXTERN tree m2type_AddStringToTreeList (tree list, tree string);
      69  EXTERN tree m2type_ChainOnParamValue (tree list, tree name, tree str,
      70                                        tree value);
      71  EXTERN tree m2type_ChainOn (tree t1, tree t2);
      72  EXTERN tree m2type_BuildFieldRecord (location_t location, char *name,
      73                                       tree type);
      74  EXTERN tree m2type_BuildStartFieldRecord (location_t location, char *name,
      75                                            tree type);
      76  EXTERN tree m2type_BuildEndFieldVarient (location_t location,
      77                                           tree varientField, tree varientList,
      78                                           bool isPacked);
      79  EXTERN tree m2type_BuildStartFieldVarient (location_t location, char *name);
      80  EXTERN tree m2type_BuildEndVarient (location_t location, tree varientField,
      81                                      tree varientList, bool isPacked);
      82  EXTERN tree m2type_BuildStartVarient (location_t location, char *name);
      83  EXTERN tree m2type_BuildStartUnion (location_t location, char *name);
      84  EXTERN tree m2type_BuildStartRecord (location_t location, char *name);
      85  EXTERN tree m2type_RealToTree (char *name);
      86  EXTERN tree m2type_BuildArrayStringConstructor (location_t location,
      87                                                  tree arrayType, tree str,
      88                                                  tree length);
      89  
      90  #if 0
      91  EXTERN tree m2type_GetPointerOne (void);
      92  EXTERN tree m2type_GetPointerZero (void);
      93  EXTERN tree m2type_GetWordOne (void);
      94  EXTERN tree m2type_GetWordZero (void);
      95  #endif
      96  
      97  EXTERN tree m2type_GetM2CharType (void);
      98  EXTERN tree m2type_GetM2IntegerType (void);
      99  EXTERN tree m2type_GetM2ShortRealType (void);
     100  EXTERN tree m2type_GetM2RealType (void);
     101  EXTERN tree m2type_GetM2LongRealType (void);
     102  EXTERN tree m2type_GetM2LongIntType (void);
     103  EXTERN tree m2type_GetM2LongCardType (void);
     104  EXTERN tree m2type_GetM2ShortIntType (void);
     105  EXTERN tree m2type_GetShortIntType (void);
     106  EXTERN tree m2type_GetM2ShortCardType (void);
     107  EXTERN tree m2type_GetShortCardType (void);
     108  EXTERN tree m2type_GetISOWordType (void);
     109  EXTERN tree m2type_GetISOByteType (void);
     110  EXTERN tree m2type_GetISOLocType (void);
     111  EXTERN tree m2type_GetM2Integer8 (void);
     112  EXTERN tree m2type_GetM2Integer16 (void);
     113  EXTERN tree m2type_GetM2Integer32 (void);
     114  EXTERN tree m2type_GetM2Integer64 (void);
     115  EXTERN tree m2type_GetM2Cardinal8 (void);
     116  EXTERN tree m2type_GetM2Cardinal16 (void);
     117  EXTERN tree m2type_GetM2Cardinal32 (void);
     118  EXTERN tree m2type_GetM2Cardinal64 (void);
     119  EXTERN tree m2type_GetM2Word16 (void);
     120  EXTERN tree m2type_GetM2Word32 (void);
     121  EXTERN tree m2type_GetM2Word64 (void);
     122  EXTERN tree m2type_GetM2Bitset8 (void);
     123  EXTERN tree m2type_GetM2Bitset16 (void);
     124  EXTERN tree m2type_GetM2Bitset32 (void);
     125  EXTERN tree m2type_GetM2Real32 (void);
     126  EXTERN tree m2type_GetM2Real64 (void);
     127  EXTERN tree m2type_GetM2Real96 (void);
     128  EXTERN tree m2type_GetM2Real128 (void);
     129  EXTERN tree m2type_GetM2Complex32 (void);
     130  EXTERN tree m2type_GetM2Complex64 (void);
     131  EXTERN tree m2type_GetM2Complex96 (void);
     132  EXTERN tree m2type_GetM2Complex128 (void);
     133  EXTERN tree m2type_GetM2ShortComplexType (void);
     134  EXTERN tree m2type_GetM2LongComplexType (void);
     135  EXTERN tree m2type_GetM2ComplexType (void);
     136  EXTERN tree m2type_GetShortCardType (void);
     137  EXTERN tree m2type_GetProcType (void);
     138  EXTERN tree m2type_GetCSizeTType (void);
     139  EXTERN tree m2type_GetCSSizeTType (void);
     140  
     141  EXTERN tree m2type_GetM2CType (void);
     142  
     143  EXTERN tree m2type_GetBitsetType (void);
     144  EXTERN tree m2type_GetM2CardinalType (void);
     145  EXTERN tree m2type_GetWordType (void);
     146  EXTERN tree m2type_GetIntegerType (void);
     147  EXTERN tree m2type_GetCardinalType (void);
     148  EXTERN tree m2type_GetPointerType (void);
     149  EXTERN tree m2type_GetLongIntType (void);
     150  EXTERN tree m2type_GetShortRealType (void);
     151  EXTERN tree m2type_GetLongRealType (void);
     152  EXTERN tree m2type_GetRealType (void);
     153  EXTERN tree m2type_GetBitnumType (void);
     154  EXTERN tree m2type_GetVoidType (void);
     155  EXTERN tree m2type_GetByteType (void);
     156  EXTERN tree m2type_GetCharType (void);
     157  EXTERN tree m2type_GetPackedBooleanType (void);
     158  EXTERN tree m2type_GetBooleanTrue (void);
     159  EXTERN tree m2type_GetBooleanFalse (void);
     160  EXTERN tree m2type_GetBooleanType (void);
     161  EXTERN tree m2type_BuildSmallestTypeRange (location_t location, tree low,
     162                                             tree high);
     163  EXTERN tree m2type_BuildSetTypeFromSubrange (location_t location, char *name,
     164                                               tree subrangeType, tree lowval,
     165                                               tree highval, bool ispacked);
     166  EXTERN int m2type_GetBitsPerBitset (void);
     167  EXTERN tree m2type_GetM2RType (void);
     168  EXTERN tree m2type_GetM2ZType (void);
     169  
     170  EXTERN tree m2type_DeclareKnownType (location_t location, char *name,
     171                                       tree type);
     172  EXTERN tree m2type_GetTreeType (tree type);
     173  EXTERN tree m2type_BuildEndFunctionType (tree func, tree type,
     174                                           bool uses_varargs);
     175  EXTERN tree m2type_BuildStartFunctionType (
     176      location_t location ATTRIBUTE_UNUSED, char *name ATTRIBUTE_UNUSED);
     177  EXTERN void m2type_InitFunctionTypeParameters (void);
     178  EXTERN tree m2type_BuildVariableArrayAndDeclare (location_t location,
     179                                                   tree elementtype, tree high,
     180                                                   char *name, tree scope);
     181  EXTERN void m2type_InitSystemTypes (location_t location, int loc);
     182  EXTERN void m2type_InitBaseTypes (location_t location);
     183  EXTERN tree m2type_BuildStartType (location_t location, char *name, tree type);
     184  EXTERN tree m2type_BuildEndType (location_t location, tree type);
     185  EXTERN tree m2type_GetDefaultType (location_t location, char *name, tree type);
     186  EXTERN tree m2type_GetMinFrom (location_t location, tree type);
     187  EXTERN tree m2type_GetMaxFrom (location_t location, tree type);
     188  EXTERN void m2type_BuildTypeDeclaration (location_t location, tree type);
     189  EXTERN tree m2type_BuildStartEnumeration (location_t location, char *name,
     190                                            bool ispacked);
     191  EXTERN tree m2type_BuildEndEnumeration (location_t location, tree enumtype,
     192                                          tree enumvalues);
     193  EXTERN tree m2type_BuildEnumerator (location_t location, char *name,
     194                                      tree value, tree *enumvalues);
     195  EXTERN tree m2type_BuildPointerType (tree totype);
     196  EXTERN tree m2type_BuildConstPointerType (tree totype);
     197  EXTERN tree m2type_BuildSetType (location_t location, char *name, tree type,
     198                                   tree lowval, tree highval, bool ispacked);
     199  EXTERN void *m2type_BuildStartSetConstructor (tree type);
     200  EXTERN void m2type_BuildSetConstructorElement (void *p, tree value);
     201  EXTERN tree m2type_BuildEndSetConstructor (void *p);
     202  EXTERN void *m2type_BuildStartRecordConstructor (tree type);
     203  EXTERN tree m2type_BuildEndRecordConstructor (void *p);
     204  EXTERN void m2type_BuildRecordConstructorElement (void *p, tree value);
     205  EXTERN void *m2type_BuildStartArrayConstructor (tree type);
     206  EXTERN tree m2type_BuildEndArrayConstructor (void *p);
     207  EXTERN void m2type_BuildArrayConstructorElement (void *p, tree value,
     208                                                   tree indice);
     209  EXTERN tree m2type_BuildCharConstant (location_t location, const char *string);
     210  EXTERN tree m2type_BuildCharConstantChar (location_t location, char ch);
     211  EXTERN tree m2type_BuildSubrangeType (location_t location, char *name,
     212                                        tree type, tree lowval, tree highval);
     213  EXTERN tree m2type_gm2_unsigned_type (tree type);
     214  EXTERN tree m2type_gm2_signed_type (tree type);
     215  EXTERN tree m2type_gm2_signed_or_unsigned_type (int unsignedp, tree type);
     216  EXTERN tree m2type_gm2_type_for_size (unsigned int bits, int unsignedp);
     217  EXTERN tree m2type_BuildProcTypeParameterDeclaration (location_t location,
     218                                                        tree type,
     219                                                        bool isreference);
     220  EXTERN int m2type_IsAddress (tree type);
     221  EXTERN tree m2type_GetCardinalAddressType (void);
     222  
     223  #undef EXTERN
     224  #endif /* m2type_h  */