1 /* do not edit automatically generated by mc from PushBackInput. */
2 /* PushBackInput.def provides a method for pushing back and consuming input.
4 Copyright (C) 2001-2024 Free Software Foundation, Inc.
5 Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
7 This file is part of GNU Modula-2.
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)
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.
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.
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/>. */
29 #if !defined (_PushBackInput_H)
30 # define _PushBackInput_H
38 # if !defined (PROC_D)
40 typedef void (*PROC_t
) (void);
41 typedef struct { PROC_t proc
; } PROC
;
45 # include "GDynamicStrings.h"
47 # if defined (_PushBackInput_C)
50 # define EXTERN extern
55 Open - opens a file for reading.
58 EXTERN FIO_File
PushBackInput_Open (const char *a_
, unsigned int _a_high
);
61 GetCh - gets a character from either the push back stack or
65 EXTERN
char PushBackInput_GetCh (FIO_File f
);
68 PutCh - pushes a character onto the push back stack, it also
69 returns the character which has been pushed.
72 EXTERN
char PushBackInput_PutCh (char ch
);
75 PutString - pushes a string onto the push back stack.
78 EXTERN
void PushBackInput_PutString (const char *a_
, unsigned int _a_high
);
81 PutStr - pushes a dynamic string onto the push back stack.
82 The string, s, is not deallocated.
85 EXTERN
void PushBackInput_PutStr (DynamicStrings_String s
);
88 Error - emits an error message with the appropriate file, line combination.
91 EXTERN
void PushBackInput_Error (const char *a_
, unsigned int _a_high
);
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
99 EXTERN
void PushBackInput_WarnError (const char *a_
, unsigned int _a_high
);
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
107 EXTERN
void PushBackInput_WarnString (DynamicStrings_String s
);
110 Close - closes the opened file.
113 EXTERN
void PushBackInput_Close (FIO_File f
);
116 GetExitStatus - returns the exit status which will be 1 if any warnings were issued.
119 EXTERN
unsigned int PushBackInput_GetExitStatus (void);
122 SetDebug - sets the debug flag on or off.
125 EXTERN
void PushBackInput_SetDebug (bool d
);
128 GetColumnPosition - returns the column position of the current character.
131 EXTERN
unsigned int PushBackInput_GetColumnPosition (void);
134 GetCurrentLine - returns the current line number.
137 EXTERN
unsigned int PushBackInput_GetCurrentLine (void);