Lichen

Annotated lib/native.py

336:8c75cdf1a764
2016-12-06 Paul Boddie Introduced stream classes employing C-level FILE pointers, changing the sys stdin, stdout and stderr objects to be instances of these stream classes. Added fread and fwrite support to the native functions. Added support for raising EOFError.
paul@6 1
#!/usr/bin/env python
paul@6 2
paul@6 3
"""
paul@336 4
Native library functions.
paul@336 5
paul@336 6
None of these are actually defined here. Instead, native implementations are
paul@336 7
substituted when each program is built. It is, however, important to declare
paul@336 8
non-core exceptions used by the native functions because they need to be
paul@336 9
identified as being needed by the program.
paul@6 10
paul@6 11
Copyright (C) 2011, 2015, 2016 Paul Boddie <paul@boddie.org.uk>
paul@6 12
paul@6 13
This program is free software; you can redistribute it and/or modify it under
paul@6 14
the terms of the GNU General Public License as published by the Free Software
paul@6 15
Foundation; either version 3 of the License, or (at your option) any later
paul@6 16
version.
paul@6 17
paul@6 18
This program is distributed in the hope that it will be useful, but WITHOUT
paul@6 19
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
paul@6 20
FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
paul@6 21
details.
paul@6 22
paul@6 23
You should have received a copy of the GNU General Public License along with
paul@6 24
this program.  If not, see <http://www.gnu.org/licenses/>.
paul@6 25
"""
paul@6 26
paul@280 27
# Environment support.
paul@280 28
paul@171 29
def _exit(status): pass
paul@182 30
def _get_argv(): pass
paul@182 31
def _get_path(): pass
paul@171 32
paul@280 33
# Identity testing.
paul@280 34
paul@6 35
def _is(x, y): pass
paul@6 36
def _is_not(x, y): pass
paul@6 37
paul@309 38
# Limit definition.
paul@309 39
paul@309 40
def _get_maxint(): pass
paul@309 41
def _get_minint(): pass
paul@309 42
paul@280 43
# Integer operations.
paul@280 44
paul@6 45
def _int_add(self, other): pass
paul@6 46
def _int_div(self, other): pass
paul@6 47
def _int_mod(self, other): pass
paul@182 48
def _int_mul(self, other): pass
paul@207 49
def _int_neg(self): pass
paul@6 50
def _int_pow(self, other): pass
paul@182 51
def _int_sub(self, other): pass
paul@182 52
paul@6 53
def _int_and(self, other): pass
paul@307 54
def _int_not(self): pass
paul@6 55
def _int_or(self, other): pass
paul@6 56
def _int_xor(self, other): pass
paul@6 57
paul@6 58
def _int_lt(self, other): pass
paul@6 59
def _int_gt(self, other): pass
paul@6 60
def _int_eq(self, other): pass
paul@198 61
def _int_ne(self, other): pass
paul@198 62
paul@198 63
def _int_str(self): pass
paul@6 64
paul@280 65
# String operations.
paul@280 66
paul@6 67
def _str_add(self, other): pass
paul@296 68
def _str_eq(self, other): pass
paul@6 69
def _str_gt(self, other): pass
paul@296 70
def _str_lt(self, other): pass
paul@140 71
def _str_len(self): pass
paul@140 72
def _str_nonempty(self): pass
paul@296 73
def _str_ord(self): pass
paul@292 74
def _str_substr(self, start, size): pass
paul@140 75
paul@280 76
# List operations.
paul@280 77
paul@161 78
def _list_init(size): pass
paul@227 79
def _list_setsize(self, size): pass
paul@206 80
def _list_append(self, value): pass
paul@206 81
def _list_concat(self, other): pass
paul@140 82
def _list_len(self): pass
paul@140 83
def _list_nonempty(self): pass
paul@140 84
def _list_element(self, index): pass
paul@227 85
def _list_setelement(self, index, value): pass
paul@6 86
paul@280 87
# Buffer operations.
paul@280 88
paul@206 89
def _buffer_str(self): pass
paul@206 90
paul@280 91
# Method binding.
paul@280 92
paul@230 93
def _get_using(callable, instance): pass
paul@230 94
paul@280 95
# Introspection.
paul@280 96
paul@228 97
def _object_getattr(obj, name, default): pass
paul@6 98
def _isinstance(obj, cls): pass
paul@231 99
def _issubclass(obj, cls): pass
paul@6 100
paul@280 101
# Input/output.
paul@280 102
paul@328 103
def _fdopen(fd, mode): IOError
paul@328 104
def _read(fd, n): IOError
paul@173 105
def _write(fd, str): pass
paul@173 106
paul@336 107
def _fread(fd, n):
paul@336 108
    IOError
paul@336 109
    EOFError
paul@336 110
paul@336 111
def _fwrite(fd, str):
paul@336 112
    IOError
paul@336 113
    EOFError
paul@336 114
paul@6 115
# vim: tabstop=4 expandtab shiftwidth=4