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
ff3bdea49d
stream_read(): Shrink memory block to actual read size.
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
Paul Sokolovsky
d54bef7692
stream: Add generic unbuffered iternext method.
Uses stream_unbuffered_readline underline.
11 years ago
Paul Sokolovsky
dff3f896d7
mp_identity(): Add generic identity function.
Useful as getiter method for objects which are their own iterators, etc.
11 years ago
Paul Sokolovsky
3754c4a040
mp_obj_get_qstr(): Handle MP_OBJ_QSTR.
11 years ago
Damien George
91d457a277
py: Put micropython module init code in builtinmp.c.
11 years ago
Damien George
589233622c
Merge pull request #198 from pfalcon/expose-memstat
Expose memory stats functions via "micropython" module.
11 years ago
Paul Sokolovsky
440cc3f028
Expose memory stats functions via "micropython" module.
These are micropython.mem_total(), .mem_current(), .mem_peak(). These are 3
individual functions with simple scalar return value to make sure that
calls to these functions themselves have minimal (hopefully zero) impact on
memory allocation.
11 years ago
Damien George
164774c1c1
Merge branch 'master' of github.com:micropython/micropython
11 years ago
Damien George
7d08935458
Rename unix binary to 'micropython'.
11 years ago
Paul Sokolovsky
159c0f75da
Don't implicitly import "sys" module.
11 years ago
Paul Sokolovsky
fe2690da0a
unix: Implement sys.argv.
11 years ago
Paul Sokolovsky
f477bfbc75
Pre-create sys module.
11 years ago
Paul Sokolovsky
bb33cc66fb
Properly print MP_OBJ_QSTR objects.
11 years ago
Damien George
2c7a1b2ad1
Merge pull request #197 from pfalcon/mod-singletons
Implement modules as singletons Python semantics.
11 years ago
Paul Sokolovsky
d720ab5236
Implement modules as singletons Python semantics.
In Python, importing module several times returns same underlying module
object. This also fixes import statement handling for builtin modules.
There're still issues:
1. CPython exposes set of loaded modules as sys.modules, we may want to
do that either.
2. Builtin modules are implicitly imported, which is not really correct.
We should separate registering a (builtin) module and importing a module.
CPython keeps builtin module names in sys.builtin_module_names .
11 years ago
Damien George
f438b936e0
Small changes to README.
11 years ago
Damien George
5f7e8dc176
Merge branch 'master' of github.com:micropython/micropython
11 years ago
Damien George
b2ebb161d4
stm: Upgrade ST peripheral library from 1.1.0 to 1.3.0.
11 years ago
Paul Sokolovsky
db796ef84d
Add README for tests/.
11 years ago
Paul Sokolovsky
9954b4b99d
Add directory for I/O tests with basic test for file methods.
11 years ago
Damien George
1277753812
stm: Upgrade to latest CMSIS libraries.
CMSIS V3.01 -> V3.20. Now in stm/cmsis to keep separate from ST
libraries.
11 years ago
Paul Sokolovsky
8c3858b016
Move tests in basic/tests/ up one level preparating to multiple test dirs.
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
49f6a99c65
Merge branch 'master' of github.com:micropython/micropython
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
Paul Sokolovsky
e2f3e1d24a
Add socket examples (simple HTTP client and server).
11 years ago
Damien George
e02b2d4391
py: Temporary fix for bug where not enough VM state is allocated.
11 years ago
Damien George
ebde0b8a09
Tiny optimisation in objlist.c; a new test for inheritance.
11 years ago
Damien George
a8a6db2a1d
Fix warnings about int/pointer casting.
11 years ago
Damien George
2025e82cbf
Merge branch 'master' of github.com:micropython/micropython
11 years ago
Damien George
932bf1c48f
py: Fix VM/runtime unpack sequence bug, Issue #193 .
11 years ago
Paul Sokolovsky
a2715c05c6
Add objarray.h .
11 years ago
Damien George
8fce5b42a2
Merge pull request #194 from pfalcon/socket
Add lean ("raw") socket module.
11 years ago
Damien George
6b21538e91
Merge pull request #192 from pfalcon/arrays
Add skeleton implementation of array.array and bytearray.
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
aefe79880f
Merge branch 'master' of github.com:micropython/micropython
11 years ago
Damien George
f49ba1bd9c
Improve method lookup in mp_obj_class_lookup.
Now searches both locals_dict and methods. Partly addresses Issue #145 .
11 years ago
Paul Sokolovsky
427905cedd
Add skeleton implementation of array.array and bytearray.
So far, only storage, initialization, repr() and buffer protocol is
implemented - alredy suitable for passing binary data around.
11 years ago
Paul Sokolovsky
b31b5e0b5c
Add testcase for subclassing builtin type and calling native method (broken).
11 years ago
Damien George
1d6fc94c16
Implement framework for class-defined built-in operators.
Now working for class-defined methods: __getitem__, __setitem__,
__add__, __sub__. Easy to add others.
11 years ago
Damien George
0c4e909e76
Merge pull request #191 from pfalcon/store-item
Add store_item() virtual method to type to implement container[index] = val
11 years ago
Damien George
632cf5710c
Merge branch 'master' of github.com:dpgeorge/micropython
11 years ago
Paul Sokolovsky
d26b379eec
int: Add value accessors: mp_obj_int_get() & mp_obj_int_get_checked().
mp_obj_int_get() can be used when just full resolution of C machine_int_t
is required (returns truncated value of long int). mp_obj_int_get_checked()
will throw exception if Python int value not representable in machine_int_t.
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