Commit Graph

571 Commits

Author SHA1 Message Date
Paul Sokolovsky 8c3858b016 Move tests in basic/tests/ up one level preparating to multiple test dirs. 2014-01-19 18:41:55 +02:00
Damien George a11ceca807 Change int to uint for n_args in function with variable arguments. 2014-01-19 16:02:09 +00:00
Damien George 136b149e41 py: Add full traceback to exception printing. 2014-01-19 12:38:49 +00:00
Damien George 49f6a99c65 Merge branch 'master' of github.com:micropython/micropython 2014-01-19 11:50:14 +00:00
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.
2014-01-19 11:48:48 +00:00
Paul Sokolovsky 50a2d6ff59 Fix incorrect prototype of mp_builtin_open() after args refactor. 2014-01-19 07:50:45 +02:00
Paul Sokolovsky e2f3e1d24a Add socket examples (simple HTTP client and server). 2014-01-19 07:29:30 +02:00
Damien George e02b2d4391 py: Temporary fix for bug where not enough VM state is allocated. 2014-01-19 01:14:37 +00:00
Damien George ebde0b8a09 Tiny optimisation in objlist.c; a new test for inheritance. 2014-01-19 00:47:40 +00:00
Damien George a8a6db2a1d Fix warnings about int/pointer casting. 2014-01-18 23:50:12 +00:00
Damien George 2025e82cbf Merge branch 'master' of github.com:micropython/micropython 2014-01-18 23:43:31 +00:00
Damien George 932bf1c48f py: Fix VM/runtime unpack sequence bug, Issue #193. 2014-01-18 23:42:49 +00:00
Paul Sokolovsky a2715c05c6 Add objarray.h . 2014-01-19 01:40:47 +02:00
Damien George 8fce5b42a2 Merge pull request #194 from pfalcon/socket
Add lean ("raw") socket module.
2014-01-18 15:34:30 -08:00
Damien George 6b21538e91 Merge pull request #192 from pfalcon/arrays
Add skeleton implementation of array.array and bytearray.
2014-01-18 15:31:57 -08:00
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.
2014-01-18 23:24:36 +00:00
Paul Sokolovsky fc92608237 Add lean ("raw") socket module. 2014-01-19 00:16:39 +02:00
Damien George aefe79880f Merge branch 'master' of github.com:micropython/micropython 2014-01-18 17:54:35 +00:00
Damien George f49ba1bd9c Improve method lookup in mp_obj_class_lookup.
Now searches both locals_dict and methods.  Partly addresses Issue #145.
2014-01-18 17:52:41 +00:00
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.
2014-01-18 19:27:38 +02:00
Paul Sokolovsky b31b5e0b5c Add testcase for subclassing builtin type and calling native method (broken). 2014-01-18 19:12:17 +02:00
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.
2014-01-18 15:31:13 +00:00
Damien George 0c4e909e76 Merge pull request #191 from pfalcon/store-item
Add store_item() virtual method to type to implement container[index] = val
2014-01-18 06:57:47 -08:00
Damien George 632cf5710c Merge branch 'master' of github.com:dpgeorge/micropython 2014-01-18 14:15:48 +00:00
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.
2014-01-18 16:12:12 +02:00
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.
2014-01-18 14:10:48 +00:00
Paul Sokolovsky 6d8edf6acf Add store_item() virtual method to type to implement container[index] = val. 2014-01-18 13:11:59 +02:00
Paul Sokolovsky 166bb40fb2 Add OverflowError and use it for small int overflow instead of assert. 2014-01-18 12:46:43 +02:00
Damien George 8655065f8c Merge pull request #184 from pfalcon/int-longlong
Python long int implementation using C long long
2014-01-17 13:48:40 -08:00
Paul Sokolovsky a9f5abd48c Implement LOAD_CONST_INT (by dispatching to int object implementation). 2014-01-17 20:05:10 +02:00
Paul Sokolovsky 966879cf59 Add long int implementation using C long long type, enable for unix port. 2014-01-17 20:05:02 +02:00
Damien George 5a877503d9 Merge branch 'master' of github.com:dpgeorge/micropython 2014-01-16 22:09:54 +00:00
Damien George 8161a10de1 stm: Add stm import support. 2014-01-16 22:09:13 +00:00
Paul Sokolovsky 10744dd816 Add empty (false) value testing for strings, tuples, lists, dicts. 2014-01-16 23:54:17 +02:00
Damien George eea2eb1bb7 Merge pull request #180 from pfalcon/examples-improve
Improve compatibility of examples with CPython (+ interp compatibility too)
2014-01-16 10:56:39 -08:00
Paul Sokolovsky dcac88095b Add empty "micropython" module to allow more seamless CPython portability.
Implicit "micropython" module contains (at least) codegeneration decorators.
Make it explicit, so an app could have "import micropython". On MicroPython,
that will be no-op. On CPython, that will give a chance to have a module
with placeholder decorators.
2014-01-16 19:29:11 +02:00
Paul Sokolovsky c8742a06ca Add dummy micropython module to enable mandel.py run with CPython. 2014-01-16 19:29:11 +02:00
Paul Sokolovsky d0db3d3e45 conwaylife.py: Give people chance to enjoy the show.
Delay between frames; run more generations.
2014-01-16 19:29:11 +02:00
Paul Sokolovsky 2aefde06b7 CPython pyb.py placeholder: Implement delay(). 2014-01-16 19:29:11 +02:00
Paul Sokolovsky a671f891dd Make file.read() and file.read(-1) call out to file.readall().
Per Python3 io module semantics.
2014-01-16 12:58:36 +02:00
Paul Sokolovsky 323c09e881 Do not assume that vstr buf is the same after it was extended. 2014-01-16 12:58:18 +02:00
Paul Sokolovsky f2b796e7c7 str.format: Don't assume that '}' immediately follows '{', skip insides.
That at least makes stuff like "{:x}".format(1) to produce not completely
broken output.
2014-01-16 03:46:01 +02:00
Damien George b99d9ea258 Add errno=0 before call. 2014-01-15 23:08:33 +00:00
Damien George 613eb25545 stm: Fix print methods with new kind argument. 2014-01-15 23:02:53 +00:00
Damien George 5573f9f150 Merge branch 'str2int' of github.com:xyb/micropython into xyb-str2int
Conflicts:
	py/objint.c
	unix-cpy/Makefile
	unix/Makefile
2014-01-15 22:58:39 +00:00
Damien George 4899ff9470 Merge branch 'str-repr' of github.com:pfalcon/micropython into pfalcon-str-repr
Conflicts:
	tests/basics/tests/exception1.py
2014-01-15 22:39:03 +00:00
Damien George 7a9d0c4540 Merge branch 'builtins' of github.com:chipaca/micropython into chipaca-builtins
Added some checks for number of arguments.

Conflicts:
	py/mpqstrraw.h
2014-01-15 22:27:16 +00:00
Damien George 11507f4074 Merge branch 'master' of github.com:dpgeorge/micropython 2014-01-15 22:14:18 +00:00
Damien George d02c6d8962 Implement eval. 2014-01-15 22:14:03 +00:00
Paul Sokolovsky 9953ca432b Add unbuffered readline() implementation for Raw I/O files. 2014-01-15 23:43:25 +02:00