Lichen

Annotated lib/native.py

292:436d7832ca66
2016-12-01 Paul Boddie Introduced the itemaccess class as the base of sequence types and strings. Added support for obtaining substrings from strings. Added tests of string operations. Removed the superfluous _tuple function from the sequence module.
paul@6 1
#!/usr/bin/env python
paul@6 2
paul@6 3
"""
paul@280 4
Native library functions. None of these are actually defined here. Instead,
paul@280 5
native implementations are substituted when each program is built.
paul@6 6
paul@6 7
Copyright (C) 2011, 2015, 2016 Paul Boddie <paul@boddie.org.uk>
paul@6 8
paul@6 9
This program is free software; you can redistribute it and/or modify it under
paul@6 10
the terms of the GNU General Public License as published by the Free Software
paul@6 11
Foundation; either version 3 of the License, or (at your option) any later
paul@6 12
version.
paul@6 13
paul@6 14
This program is distributed in the hope that it will be useful, but WITHOUT
paul@6 15
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
paul@6 16
FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
paul@6 17
details.
paul@6 18
paul@6 19
You should have received a copy of the GNU General Public License along with
paul@6 20
this program.  If not, see <http://www.gnu.org/licenses/>.
paul@6 21
"""
paul@6 22
paul@280 23
# Environment support.
paul@280 24
paul@171 25
def _exit(status): pass
paul@182 26
def _get_argv(): pass
paul@182 27
def _get_path(): pass
paul@171 28
paul@280 29
# Identity testing.
paul@280 30
paul@6 31
def _is(x, y): pass
paul@6 32
def _is_not(x, y): pass
paul@6 33
paul@280 34
# Integer operations.
paul@280 35
paul@6 36
def _int_add(self, other): pass
paul@6 37
def _int_div(self, other): pass
paul@6 38
def _int_mod(self, other): pass
paul@182 39
def _int_mul(self, other): pass
paul@207 40
def _int_neg(self): pass
paul@6 41
def _int_pow(self, other): pass
paul@182 42
def _int_sub(self, other): pass
paul@182 43
paul@6 44
def _int_and(self, other): pass
paul@6 45
def _int_or(self, other): pass
paul@6 46
def _int_xor(self, other): pass
paul@6 47
paul@6 48
def _int_lt(self, other): pass
paul@6 49
def _int_gt(self, other): pass
paul@6 50
def _int_eq(self, other): pass
paul@198 51
def _int_ne(self, other): pass
paul@198 52
paul@198 53
def _int_str(self): pass
paul@6 54
paul@280 55
# String operations.
paul@280 56
paul@6 57
def _str_add(self, other): pass
paul@6 58
def _str_lt(self, other): pass
paul@6 59
def _str_gt(self, other): pass
paul@6 60
def _str_eq(self, other): pass
paul@140 61
def _str_len(self): pass
paul@140 62
def _str_nonempty(self): pass
paul@292 63
def _str_substr(self, start, size): pass
paul@140 64
paul@280 65
# List operations.
paul@280 66
paul@161 67
def _list_init(size): pass
paul@227 68
def _list_setsize(self, size): pass
paul@206 69
def _list_append(self, value): pass
paul@206 70
def _list_concat(self, other): pass
paul@140 71
def _list_len(self): pass
paul@140 72
def _list_nonempty(self): pass
paul@140 73
def _list_element(self, index): pass
paul@227 74
def _list_setelement(self, index, value): pass
paul@6 75
paul@283 76
# Dictionary operations.
paul@283 77
paul@283 78
def _dict_init(size): pass
paul@283 79
def _dict_bucketsize(self, index): pass
paul@283 80
def _dict_key(self, index, element): pass
paul@283 81
def _dict_value(self, index, element): pass
paul@283 82
def _dict_additem(self, index, key, value): pass
paul@283 83
def _dict_setitem(self, index, element, key, value): pass
paul@283 84
def _dict_keys(self): pass
paul@283 85
def _dict_values(self): pass
paul@283 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@173 103
def _read(fd, n): pass
paul@173 104
def _write(fd, str): pass
paul@173 105
paul@6 106
# vim: tabstop=4 expandtab shiftwidth=4