Lichen

Annotated lib/native/io.py

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