Damien George
62ad189a65
py: Add compile option to enable/disable source line numbers.
11 years ago
Damien George
4d5b28cd08
Add qstr_info() function and bindings for unix port.
11 years ago
Damien George
8bf91f2a87
unix: Fix compile warnings for ffi module on 64-bit machine.
11 years ago
Paul Sokolovsky
60a9fac8d4
unix: Initial implementation of FFI module.
Foreign Function Interface module allows to load native dynamic libraries,
call functions and access variables in them. This makes possible to write
interface modules in pure Python.
This module provides thin wrapper around libffi. ctypes compatibility might
be possible to implement on top of this module (though ctypes allow to call
functions without prototypes, which is not supported by libffi (i.e.
implementation would be inefficient))).
11 years ago
Damien George
56bb636014
Change -Og to -O0 in unix-cpy/Makefile; cast to small int in socket.c.
11 years ago
Paul Sokolovsky
a88c30c64a
unix socket: Add setsockopt() method.
11 years ago
Paul Sokolovsky
5d362d3209
unix socket: Add few more socket constants.
11 years ago
Paul Sokolovsky
db0b282d45
unix socket: Store module constants in data structure.
-147 bytes on x86.
11 years ago
Paul Sokolovsky
e2febe90e3
unix Makefile: -Og doesn't work (at least) with gcc 4.6 below.
Also, don't try to force debug info format, use native.
11 years ago
Damien George
b829b5caec
Implement mp_parse_node_free; print properly repr(string).
11 years ago
Paul Sokolovsky
aee2ba70de
Add parse_node_free_struct() and use it to free parse tree after compilation.
TODO: Check lexer/parse/compile error path for leaks too.
11 years ago
Dave Hylands
c89c681a9f
Rework makefiles. Add proper dependency checking.
11 years ago
Paul Sokolovsky
2b2cb7b7f4
unix main: Free input line.
Also, readline uses system malloc, so for symmetry, use the same for
non-readline case.
11 years ago
Damien George
5fa93b6755
Second stage of qstr revamp: uPy str object can be qstr or not.
11 years ago
Damien George
55baff4c9b
Revamp qstrs: they now include length and hash.
Can now have null bytes in strings. Can define ROM qstrs per port using
qstrdefsport.h
11 years ago
Paul Sokolovsky
51ee44a718
unix file: Refactor and add sys.stdout/stdin/stderr.
11 years ago
Paul Sokolovsky
f0cfb8cb45
Don't preimport socket module.
11 years ago
Paul Sokolovsky
fc35aa6828
unix socket: Add send() and recv() methods.
CPython _socket actually have only those and doesn't provide stream
interface (higher-level CPython "socket" what adds this).
+516 bytes x86.
11 years ago
Paul Sokolovsky
decd597273
unix io.FileIO: Add iteration support.
A file cannot be iterated concurrently, so we make io.FileIO its own
iterator.
11 years ago
Damien George
7d08935458
Rename unix binary to 'micropython'.
11 years ago
Paul Sokolovsky
fe2690da0a
unix: Implement sys.argv.
11 years ago
Damien George
a11ceca807
Change int to uint for n_args in function with variable arguments.
11 years ago
Damien George
136b149e41
py: Add full traceback to exception printing.
11 years ago
Damien George
cbd2f7482c
py: Add module/function/class name to exceptions.
Exceptions know source file, line and block name.
Also tidy up some debug printing functions and provide a global
flag to enable/disable them.
11 years ago
Paul Sokolovsky
50a2d6ff59
Fix incorrect prototype of mp_builtin_open() after args refactor.
11 years ago
Damien George
a8a6db2a1d
Fix warnings about int/pointer casting.
11 years ago
Damien George
08335004cf
Add source file name and line number to error messages.
Byte code has a map from byte-code offset to source-code line number,
used to give better error messages.
11 years ago
Paul Sokolovsky
fc92608237
Add lean ("raw") socket module.
11 years ago
Damien George
20006dbba9
Make VM stack grow upwards, and so no reversed args arrays.
Change state layout in VM so the stack starts at state[0] and grows
upwards. Locals are at the top end of the state and number downwards.
This cleans up a lot of the interface connecting the VM to C: now all
functions that take an array of Micro Python objects are in order (ie no
longer in reverse).
Also clean up C API with keyword arguments (call_n and call_n_kw
replaced with single call method that takes keyword arguments). And now
make_new takes keyword arguments.
emitnative.c has not yet been changed to comply with the new order of
stack layout.
11 years ago
Paul Sokolovsky
966879cf59
Add long int implementation using C long long type, enable for unix port.
11 years ago
Paul Sokolovsky
9953ca432b
Add unbuffered readline() implementation for Raw I/O files.
11 years ago
Damien George
9528cd66d7
Convert parse errors to exceptions.
Parser no longer prints an error, but instead returns an exception ID
and message.
11 years ago
Paul Sokolovsky
76d982ef34
type->print(): Distinguish str() and repr() variety by passing extra param.
11 years ago
xyb
c178ea471e
Implemented int(str) in UNIX
11 years ago
Paul Sokolovsky
5225450b9f
Add generic impl of stream .readall() method. Use one for unix io.FileIO.
11 years ago
John R. Lenton
9549919349
made DEBUG control CFLAGS in Makefiles oter than stm as well.
11 years ago
Damien George
004cdcebfe
py: Implement base class lookup, issubclass, isinstance.
11 years ago
Damien George
062478e66d
Improved type/class/instance code; mp_obj_type_t now has load_attr, store_attr.
Creating of classes (types) and instances is much more like CPython now.
You can use "type('name', (), {...})" to create classes.
11 years ago
Dave Hylands
4646801181
Make build output quieter.
Use make V=1e make V=1 or set BUILD_VERBOSE in your environment to increase build verbosity.
This should fix issue #117
11 years ago
Damien George
6c73ca1e75
py: add variable argument exception constructor function.
Addresses issue #104 .
11 years ago
Paul Sokolovsky
e0e79ae6d6
unix: Add basic implementation of io.FileIO object.
Note: only read/write/close methods are defined so far, and class
is not exposed (use open() factory function, as usual).
11 years ago
John R. Lenton
9c83ec0eda
Merge remote-tracking branch 'upstream/master' into dict_feats
11 years ago
Damien George
d3ebe4829d
Factor and simplify Makefile's and mpconfig, part 2.
11 years ago
Damien George
136f67523b
Factor and simplify Makefile's and mpconfig.
11 years ago
ian-v
5fd8fd2c16
Revert MP_BOOL, etc. and use <stdbool.h> instead
11 years ago
ian-v
7a16fadbf8
Co-exist with C++ (issue #85 )
11 years ago
Paul Sokolovsky
860ffb0a43
Convert many object types structs to use C99 tagged initializer syntax.
11 years ago
Damien George
71c5181a8d
Convert Python types to proper Python type hierarchy.
Now much more inline with how CPython does types.
11 years ago
Paul Sokolovsky
d674bd5989
Convert USE_READLINE config option to be consistent with others.
11 years ago
Damien George
eb7bfcb286
Split qstr into pools, and put initial pool in ROM.
Qstr's are now split into a linked-list of qstr pools. This has 2
benefits: the first pool can be in ROM (huge benefit, since we no longer
use RAM for the core qstrs), and subsequent pools use m_new for the next
pool instead of m_renew (thus avoiding a huge single table for all the
qstrs).
Still would be better to use a hash table, but this scheme takes us part
of the way (eventually convert the pools to hash tables).
Also fixed bug with import.
Also improved the way the module code is referenced (not magic number 1
anymore).
11 years ago