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