xref: /openbsd-src/gnu/usr.bin/binutils/gas/input-file.h (revision 007c2a4539b8b8aaa95c5e73e77620090abe113b)
12159047fSniklas /* input_file.h header for input-file.c
25f210c2aSfgsch    Copyright 1987, 1992, 1993, 2000 Free Software Foundation, Inc.
32159047fSniklas 
42159047fSniklas    This file is part of GAS, the GNU Assembler.
52159047fSniklas 
62159047fSniklas    GAS is free software; you can redistribute it and/or modify
72159047fSniklas    it under the terms of the GNU General Public License as published by
82159047fSniklas    the Free Software Foundation; either version 2, or (at your option)
92159047fSniklas    any later version.
102159047fSniklas 
112159047fSniklas    GAS is distributed in the hope that it will be useful,
122159047fSniklas    but WITHOUT ANY WARRANTY; without even the implied warranty of
132159047fSniklas    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
142159047fSniklas    GNU General Public License for more details.
152159047fSniklas 
162159047fSniklas    You should have received a copy of the GNU General Public License
175f210c2aSfgsch    along with GAS; see the file COPYING.  If not, write to the Free
185f210c2aSfgsch    Software Foundation, 59 Temple Place - Suite 330, Boston, MA
195f210c2aSfgsch    02111-1307, USA.  */
202159047fSniklas 
212159047fSniklas /*"input_file.c":Operating-system dependant functions to read source files.*/
222159047fSniklas 
232159047fSniklas /*
242159047fSniklas  * No matter what the operating system, this module must provide the
252159047fSniklas  * following services to its callers.
262159047fSniklas  *
272159047fSniklas  * input_file_begin()			Call once before anything else.
282159047fSniklas  *
292159047fSniklas  * input_file_end()			Call once after everything else.
302159047fSniklas  *
312159047fSniklas  * input_file_buffer_size()		Call anytime. Returns largest possible
322159047fSniklas  *					delivery from
332159047fSniklas  *					input_file_give_next_buffer().
342159047fSniklas  *
352159047fSniklas  * input_file_open(name)		Call once for each input file.
362159047fSniklas  *
372159047fSniklas  * input_file_give_next_buffer(where)	Call once to get each new buffer.
382159047fSniklas  *					Return 0: no more chars left in file,
392159047fSniklas  *					   the file has already been closed.
402159047fSniklas  *					Otherwise: return a pointer to just
412159047fSniklas  *					   after the last character we read
422159047fSniklas  *					   into the buffer.
432159047fSniklas  *					If we can only read 0 characters, then
442159047fSniklas  *					end-of-file is faked.
452159047fSniklas  *
462159047fSniklas  * input_file_push()			Push state, which can be restored
472159047fSniklas  *					later.  Does implicit input_file_begin.
482159047fSniklas  *					Returns char * to saved state.
492159047fSniklas  *
502159047fSniklas  * input_file_pop (arg)			Pops previously saved state.
512159047fSniklas  *
522159047fSniklas  * input_file_close ()			Closes opened file.
532159047fSniklas  *
542159047fSniklas  * All errors are reported (using as_perror) so caller doesn't have to think
552159047fSniklas  * about I/O errors. No I/O errors are fatal: an end-of-file may be faked.
562159047fSniklas  */
572159047fSniklas 
58*007c2a45Smiod char *input_file_give_next_buffer (char *where);
59*007c2a45Smiod char *input_file_push (void);
60*007c2a45Smiod unsigned int input_file_buffer_size (void);
61*007c2a45Smiod int input_file_is_open (void);
62*007c2a45Smiod void input_file_begin (void);
63*007c2a45Smiod void input_file_close (void);
64*007c2a45Smiod void input_file_end (void);
65*007c2a45Smiod void input_file_open (char *filename, int pre);
66*007c2a45Smiod void input_file_pop (char *arg);
67