xref: /dflybsd-src/contrib/binutils-2.34/gas/input-file.h (revision b52ef7118d1621abed722c5bbbd542210290ecef)
1*fae548d3Szrj /* input_file.h header for input-file.c
2*fae548d3Szrj    Copyright (C) 1987-2020 Free Software Foundation, Inc.
3*fae548d3Szrj 
4*fae548d3Szrj    This file is part of GAS, the GNU Assembler.
5*fae548d3Szrj 
6*fae548d3Szrj    GAS is free software; you can redistribute it and/or modify
7*fae548d3Szrj    it under the terms of the GNU General Public License as published by
8*fae548d3Szrj    the Free Software Foundation; either version 3, or (at your option)
9*fae548d3Szrj    any later version.
10*fae548d3Szrj 
11*fae548d3Szrj    GAS is distributed in the hope that it will be useful,
12*fae548d3Szrj    but WITHOUT ANY WARRANTY; without even the implied warranty of
13*fae548d3Szrj    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14*fae548d3Szrj    GNU General Public License for more details.
15*fae548d3Szrj 
16*fae548d3Szrj    You should have received a copy of the GNU General Public License
17*fae548d3Szrj    along with GAS; see the file COPYING.  If not, write to the Free
18*fae548d3Szrj    Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
19*fae548d3Szrj    02110-1301, USA.  */
20*fae548d3Szrj 
21*fae548d3Szrj /*"input_file.c":Operating-system dependent functions to read source files.*/
22*fae548d3Szrj 
23*fae548d3Szrj /*
24*fae548d3Szrj  * No matter what the operating system, this module must provide the
25*fae548d3Szrj  * following services to its callers.
26*fae548d3Szrj  *
27*fae548d3Szrj  * input_file_begin()			Call once before anything else.
28*fae548d3Szrj  *
29*fae548d3Szrj  * input_file_end()			Call once after everything else.
30*fae548d3Szrj  *
31*fae548d3Szrj  * input_file_buffer_size()		Call anytime. Returns largest possible
32*fae548d3Szrj  *					delivery from
33*fae548d3Szrj  *					input_file_give_next_buffer().
34*fae548d3Szrj  *
35*fae548d3Szrj  * input_file_open(name)		Call once for each input file.
36*fae548d3Szrj  *
37*fae548d3Szrj  * input_file_give_next_buffer(where)	Call once to get each new buffer.
38*fae548d3Szrj  *					Return 0: no more chars left in file,
39*fae548d3Szrj  *					   the file has already been closed.
40*fae548d3Szrj  *					Otherwise: return a pointer to just
41*fae548d3Szrj  *					   after the last character we read
42*fae548d3Szrj  *					   into the buffer.
43*fae548d3Szrj  *					If we can only read 0 characters, then
44*fae548d3Szrj  *					end-of-file is faked.
45*fae548d3Szrj  *
46*fae548d3Szrj  * input_file_push()			Push state, which can be restored
47*fae548d3Szrj  *					later.  Does implicit input_file_begin.
48*fae548d3Szrj  *					Returns char * to saved state.
49*fae548d3Szrj  *
50*fae548d3Szrj  * input_file_pop (arg)			Pops previously saved state.
51*fae548d3Szrj  *
52*fae548d3Szrj  * input_file_close ()			Closes opened file.
53*fae548d3Szrj  *
54*fae548d3Szrj  * All errors are reported so caller doesn't have to think
55*fae548d3Szrj  * about I/O errors.
56*fae548d3Szrj  */
57*fae548d3Szrj 
58*fae548d3Szrj char *input_file_give_next_buffer (char *where);
59*fae548d3Szrj char *input_file_push (void);
60*fae548d3Szrj size_t input_file_buffer_size (void);
61*fae548d3Szrj void input_file_begin (void);
62*fae548d3Szrj void input_file_close (void);
63*fae548d3Szrj void input_file_end (void);
64*fae548d3Szrj void input_file_open (const char *filename, int pre);
65*fae548d3Szrj void input_file_pop (char *arg);
66