Commit Graph

337 Commits

Author SHA1 Message Date
John R. Lenton
07205ec323 added zip() 2014-01-13 02:31:00 +00:00
Paul Sokolovsky
48b3572f7e Add framework to support alternative implementations of long int Python type. 2014-01-12 22:04:21 +02:00
Paul Sokolovsky
757ac81a69 Add proper checks for fits-in-small-int. Make it reusable.
We likely should make mp_obj_new_int() inline, and rely on its
encapsulated check rather than inline checks everywhere explicitly.

Also, parser for big small int values is still broken.
2014-01-12 22:04:21 +02:00
Damien George
eae16445d5 py: Implement staticmethod and classmethod (internally).
Still need to make built-ins by these names, and write tests.
2014-01-11 19:22:29 +00:00
John R. Lenton
b8698fca75 unified the bops 2014-01-11 00:58:59 +00:00
John R. Lenton
4bee76ebca Added dict.fromkeys. Are we done with dict and #99 yet? I do think we are. 2014-01-10 11:25:03 +00:00
Damien George
004cdcebfe py: Implement base class lookup, issubclass, isinstance. 2014-01-09 21:43:51 +00:00
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.
2014-01-09 20:57:50 +00:00
Damien George
6c73ca1e75 py: add variable argument exception constructor function.
Addresses issue #104.
2014-01-08 18:11:23 +00:00
Damien George
199b9e04eb Merge pull request #114 from pfalcon/streams-bootstrap
Define buffer and stream protocols, and other starting bits of io.* framework, with io.FileIO-like implementation for Unix
2014-01-08 09:50:15 -08:00
Damien George
38a2da68c2 py: Stuff qstr in object pointer; keys for mp_map_t are now always mp_obj_t. 2014-01-08 17:33:12 +00:00
Paul Sokolovsky
5b15daf6d1 Add support for stream and buffer protocols.
Stream protocol is abstraction of serial I/O. Buffer protocol is
abstraction of random-access I/O. These protocols are defined down
to C level, to allow generic, while still efficient algorithms
to be coded in C (like, buffered transfer between 2 stream objects,
saving/loading of buffer object to/from stream, etc). (Note that CPython
define buffer protocol on C level, but apparently not stream protocol).
2014-01-08 17:38:38 +02:00
Damien George
b97669ab94 py: Improve __build_class__. 2014-01-08 11:47:55 +00:00
Damien George
dfc0bac086 py: Small big fix to type declarations. 2014-01-07 23:18:54 +00:00
John R. Lenton
270112f731 Merge remote-tracking branch 'upstream/master' into listsort. Lots of conflict fun.
Conflicts:
	py/obj.h
	py/objbool.c
	py/objboundmeth.c
	py/objcell.c
	py/objclass.c
	py/objclosure.c
	py/objcomplex.c
	py/objdict.c
	py/objexcept.c
	py/objfun.c
	py/objgenerator.c
	py/objinstance.c
	py/objmodule.c
	py/objrange.c
	py/objset.c
	py/objslice.c
2014-01-07 18:01:08 +00:00
John R. Lenton
c06763a020 This implements a better (more python-conformant) list.sort.
It's not really about that, though; it's about me figuring out a sane
way forward for keyword-argument functions (and function
metadata). But it's useful as is, and shouldn't break any existing
code, so here you have it; I'm going to park it in my mind for a bit
while sorting out the rest of the dict branch.
2014-01-07 17:29:16 +00:00
Damien George
97209d38e1 Merge branch 'cplusplus' of https://github.com/ian-v/micropython into ian-v-cplusplus
Conflicts:
	py/objcomplex.c
2014-01-07 15:58:30 +00:00
Damien George
e2e3d11e87 py: Fix up number operations and coercion. 2014-01-06 22:13:00 +00:00
ian-v
5fd8fd2c16 Revert MP_BOOL, etc. and use <stdbool.h> instead 2014-01-06 13:51:53 -08:00
ian-v
7a16fadbf8 Co-exist with C++ (issue #85) 2014-01-06 09:52:29 -08:00
John R. Lenton
8428b8f3c9 Merge remote-tracking branch 'upstream/master' into list_insert 2014-01-05 22:11:01 +00:00
Damien George
71c5181a8d Convert Python types to proper Python type hierarchy.
Now much more inline with how CPython does types.
2014-01-04 20:21:15 +00:00
Damien George
e9906ac3d7 Add ellipsis object. 2014-01-04 18:44:46 +00:00
John R. Lenton
f1c6ad46af Merge remote-tracking branch 'upstream/master' into list_insert 2014-01-04 01:36:10 +00:00
John R. Lenton
45a8744617 Implements list.insert. Fixes issue #61. 2014-01-04 01:15:01 +00:00
Paul Sokolovsky
1c6de11f77 Add basic implementation of slice object.
So far, only start and stop integer indexes are supported. Step is
not supported, as well as objects of arbitrary types.
2014-01-04 02:35:48 +02:00
Damien George
66028ab6dc Basic implementation of import.
import works for simple cases.  Still work to do on finding the right
script, and setting globals/locals correctly when running an imported
function.
2014-01-03 14:03:48 +00:00
Damien George
2870862601 Add module object, to be used eventually for import. 2014-01-02 21:30:26 +00:00
Damien George
0ff883904a py: Fix generator where state array was incorrectly indexed.
Generator objects now allocate the object and the state in one malloc.
This improvement fixes Issue #38.
2014-01-02 20:57:05 +00:00
Damien George
df884fe4cc py: change declaration of mp_map_t in obj.h (for issue #24). 2014-01-01 21:27:43 +00:00
Damien George
6baf76e28b py: make closures work. 2013-12-30 22:32:17 +00:00
Damien
dae7eb7226 py: add dict length function, and fix rt_store_set. 2013-12-29 22:32:51 +00:00
Damien
b86e3f9293 py: implement some basic exception matching. 2013-12-29 17:17:43 +00:00
Damien
d9d6201b52 py: simplify __next__ method for generators. 2013-12-21 18:38:03 +00:00
Damien
d99b05282d Change object representation from 1 big union to individual structs.
A big change.  Micro Python objects are allocated as individual structs
with the first element being a pointer to the type information (which
is itself an object).  This scheme follows CPython.  Much more flexible,
not necessarily slower, uses same heap memory, and can allocate objects
statically.

Also change name prefix, from py_ to mp_ (mp for Micro Python).
2013-12-21 18:17:45 +00:00
Damien
a3dcd9e80c py: add more Python built-in functions. 2013-12-17 21:35:38 +00:00
Damien
660365e14c py: split runtime into map, obj, builtin. 2013-12-17 18:27:24 +00:00