1 #!/usr/bin/env python 2 3 """ 4 Native library functions for input/output. 5 6 None of these are actually defined here. Instead, native implementations are 7 substituted when each program is built. It is, however, important to declare 8 non-core exceptions used by the native functions because they need to be 9 identified as being needed by the program. 10 11 Copyright (C) 2011, 2015, 2016, 2017 Paul Boddie <paul@boddie.org.uk> 12 13 This program is free software; you can redistribute it and/or modify it under 14 the terms of the GNU General Public License as published by the Free Software 15 Foundation; either version 3 of the License, or (at your option) any later 16 version. 17 18 This program is distributed in the hope that it will be useful, but WITHOUT 19 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 20 FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 21 details. 22 23 You should have received a copy of the GNU General Public License along with 24 this program. If not, see <http://www.gnu.org/licenses/>. 25 """ 26 27 # NOTE: Example values used to provide type information. 28 29 def fclose(fp): IOError 30 def fflush(fp): IOError 31 def fopen(filename, mode): IOError 32 def fdopen(fd, mode): IOError 33 def close(fd): IOError 34 35 def read(fd, n): 36 IOError 37 return "" 38 39 def write(fd, str): 40 IOError 41 return 0 42 43 def fread(fp, n): 44 IOError 45 EOFError 46 return "" 47 48 def fwrite(fp, str): 49 IOError 50 EOFError 51 52 # vim: tabstop=4 expandtab shiftwidth=4