1  /* do not edit automatically generated by mc from PushBackInput.  */
       2  /* PushBackInput.def provides a method for pushing back and consuming input.
       3  
       4  Copyright (C) 2001-2023 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  Under Section 7 of GPL version 3, you are granted additional
      20  permissions described in the GCC Runtime Library Exception, version
      21  3.1, as published by the Free Software Foundation.
      22  
      23  You should have received a copy of the GNU General Public License and
      24  a copy of the GCC Runtime Library Exception along with this program;
      25  see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
      26  <http://www.gnu.org/licenses/>.  */
      27  
      28  
      29  #if !defined (_PushBackInput_H)
      30  #   define _PushBackInput_H
      31  
      32  #include "config.h"
      33  #include "system.h"
      34  #   ifdef __cplusplus
      35  extern "C" {
      36  #   endif
      37  #include <stdbool.h>
      38  #   if !defined (PROC_D)
      39  #      define PROC_D
      40         typedef void (*PROC_t) (void);
      41         typedef struct { PROC_t proc; } PROC;
      42  #   endif
      43  
      44  #   include "GFIO.h"
      45  #   include "GDynamicStrings.h"
      46  
      47  #   if defined (_PushBackInput_C)
      48  #      define EXTERN
      49  #   else
      50  #      define EXTERN extern
      51  #   endif
      52  
      53  
      54  /*
      55     Open - opens a file for reading.
      56  */
      57  
      58  EXTERN FIO_File PushBackInput_Open (const char *a_, unsigned int _a_high);
      59  
      60  /*
      61     GetCh - gets a character from either the push back stack or
      62             from file, f.
      63  */
      64  
      65  EXTERN char PushBackInput_GetCh (FIO_File f);
      66  
      67  /*
      68     PutCh - pushes a character onto the push back stack, it also
      69             returns the character which has been pushed.
      70  */
      71  
      72  EXTERN char PushBackInput_PutCh (char ch);
      73  
      74  /*
      75     PutString - pushes a string onto the push back stack.
      76  */
      77  
      78  EXTERN void PushBackInput_PutString (const char *a_, unsigned int _a_high);
      79  
      80  /*
      81     PutStr - pushes a dynamic string onto the push back stack.
      82              The string, s, is not deallocated.
      83  */
      84  
      85  EXTERN void PushBackInput_PutStr (DynamicStrings_String s);
      86  
      87  /*
      88     Error - emits an error message with the appropriate file, line combination.
      89  */
      90  
      91  EXTERN void PushBackInput_Error (const char *a_, unsigned int _a_high);
      92  
      93  /*
      94     WarnError - emits an error message with the appropriate file, line combination.
      95                 It does not terminate but when the program finishes an exit status of
      96                 1 will be issued.
      97  */
      98  
      99  EXTERN void PushBackInput_WarnError (const char *a_, unsigned int _a_high);
     100  
     101  /*
     102     WarnString - emits an error message with the appropriate file, line combination.
     103                  It does not terminate but when the program finishes an exit status of
     104                  1 will be issued.
     105  */
     106  
     107  EXTERN void PushBackInput_WarnString (DynamicStrings_String s);
     108  
     109  /*
     110     Close - closes the opened file.
     111  */
     112  
     113  EXTERN void PushBackInput_Close (FIO_File f);
     114  
     115  /*
     116     GetExitStatus - returns the exit status which will be 1 if any warnings were issued.
     117  */
     118  
     119  EXTERN unsigned int PushBackInput_GetExitStatus (void);
     120  
     121  /*
     122     SetDebug - sets the debug flag on or off.
     123  */
     124  
     125  EXTERN void PushBackInput_SetDebug (bool d);
     126  
     127  /*
     128     GetColumnPosition - returns the column position of the current character.
     129  */
     130  
     131  EXTERN unsigned int PushBackInput_GetColumnPosition (void);
     132  
     133  /*
     134     GetCurrentLine - returns the current line number.
     135  */
     136  
     137  EXTERN unsigned int PushBackInput_GetCurrentLine (void);
     138  #   ifdef __cplusplus
     139  }
     140  #   endif
     141  
     142  #   undef EXTERN
     143  #endif