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