1  /* m2block.h header file for m2block.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(m2block_h)
      23  #define m2block_h
      24  #if defined(m2block_c)
      25  #if defined(__GNUG__)
      26  #define EXTERN extern "C"
      27  #else /* !__GNUG__.  */
      28  #define EXTERN
      29  #endif /* !__GNUG__.  */
      30  #else /* !m2block_c.  */
      31  #if defined(__GNUG__)
      32  #define EXTERN extern "C"
      33  #else /* !m2block_h.  */
      34  #define EXTERN extern
      35  #endif /* !m2block_c.  */
      36  #endif /* !m2block_h.  */
      37  
      38  #include <stdbool.h>
      39  
      40  EXTERN tree m2block_getLabel (location_t location, char *name);
      41  EXTERN void m2block_pushFunctionScope (tree fndecl);
      42  EXTERN tree m2block_popFunctionScope (void);
      43  EXTERN void m2block_pushGlobalScope (void);
      44  EXTERN void m2block_popGlobalScope (void);
      45  EXTERN tree m2block_pushDecl (tree decl);
      46  EXTERN void m2block_addDeclExpr (tree t);
      47  
      48  EXTERN tree m2block_begin_statement_list (void);
      49  EXTERN tree m2block_push_statement_list (tree t);
      50  EXTERN tree m2block_pop_statement_list (void);
      51  
      52  EXTERN void m2block_finishFunctionDecl (location_t location, tree fndecl);
      53  EXTERN void m2block_finishFunctionCode (tree fndecl);
      54  
      55  EXTERN tree m2block_RememberType (tree t);
      56  EXTERN tree m2block_RememberConstant (tree t);
      57  EXTERN tree m2block_DumpGlobalConstants (void);
      58  EXTERN tree m2block_RememberInitModuleFunction (tree t);
      59  EXTERN tree m2block_global_constant (tree t);
      60  EXTERN bool m2block_toplevel (void);
      61  EXTERN tree m2block_GetErrorNode (void);
      62  
      63  EXTERN void m2block_addStmtNote (location_t location);
      64  
      65  EXTERN tree m2block_cur_stmt_list (void);
      66  EXTERN tree *m2block_cur_stmt_list_addr (void);
      67  EXTERN int m2block_is_building_stmt_list (void);
      68  EXTERN tree m2block_GetGlobals (void);
      69  EXTERN tree m2block_GetGlobalContext (void);
      70  EXTERN void m2block_finishGlobals (void);
      71  EXTERN void m2block_includeDecl (tree);
      72  EXTERN tree m2block_add_stmt (location_t location, tree t);
      73  EXTERN void m2block_addStmtNote (location_t location);
      74  EXTERN void m2block_removeStmtNote (void);
      75  
      76  EXTERN void m2block_init (void);
      77  
      78  #undef EXTERN
      79  #endif /* m2block_h.  */