Commit Graph

26 Commits

Author SHA1 Message Date
Paul Sokolovsky e9137b94f2 py: Implement getattr() builtin. 2014-03-27 00:11:36 +02:00
Damien George caac542b23 Proper support for registering builtin modules in ROM.
Comes with some refactoring of code and renaming of files.  All modules
are now named mod*.[ch].
2014-03-25 14:18:18 +00:00
Damien George 24ff063e80 py: Remove obsolete declarations; make mp_obj_get_array consistent. 2014-03-24 10:47:13 +00:00
Damien George 0c36da0b59 Implement ROMable modules. Add math module.
mp_module_obj_t can now be put in ROM.

Configuration of float type is now similar to longint: can now choose
none, float or double as the implementation.

math module has basic math functions.  For STM port, these are not yet
implemented (they are just stub functions).
2014-03-08 15:24:39 +00:00
Paul Sokolovsky d08fd68664 Add basic collections.namedtuple implementation. 2014-03-03 11:42:53 +08:00
Paul Sokolovsky 1d938c9503 Expose __import__() function. 2014-02-04 00:47:06 +02:00
Damien George ca4767984b py: Implement builtin exec. 2014-02-03 22:44:10 +00:00
Damien George 4acb2452b3 py: Add very basic implementation of dir() builtin.
Only works on modules and class instances.
2014-02-02 22:07:44 +00:00
xbe 0ebf8534ab Implement and add tests for the id() builtin function. 2014-02-01 19:00:41 -08:00
Paul Sokolovsky a80ff04fe7 Add dummy bytes() constructor.
Currently, MicroPython strings are mix between CPython byte and unicode
strings. So, conversion is null so far. This dummy implementation is
intended for compatibility with CPython (so, same code can run on both).
2014-01-20 20:37:01 +02:00
Damien George 91d457a277 py: Put micropython module init code in builtinmp.c. 2014-01-20 10:30:24 +00:00
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.
2014-01-20 02:20:40 +02: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 d02c6d8962 Implement eval. 2014-01-15 22:14:03 +00:00
Damien George e2fb2baaa4 Implement repr. 2014-01-15 21:40:48 +00:00
Paul Sokolovsky 36c4499d36 Implement str() and repr() builtin functions. 2014-01-15 02:15:47 +02:00
John R. Lenton 93451002f0 Merge remote-tracking branch 'upstream/master' into builtins
Conflicts:
	py/builtin.c
	py/builtin.h
	py/runtime.c
2014-01-13 23:14:35 +00:00
Damien George 2300537c79 Cleanup built-ins, and fix some compiler warnings/errors. 2014-01-13 19:39:01 +00:00
John R. Lenton 5c76839559 sorted 2014-01-13 05:12:50 +00:00
Damien George 004cdcebfe py: Implement base class lookup, issubclass, isinstance. 2014-01-09 21:43:51 +00:00
Damien George b97669ab94 py: Improve __build_class__. 2014-01-08 11:47:55 +00:00
Damien George 40563d56bd py: Add framework for built-in "type()" function. 2014-01-02 16:01:17 +00:00
Damien George 209d1b1835 py: add int() and float() built-ins, partially implemented. 2014-01-01 17:03:35 +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