Damien George
013d53c0b4
Remove skeletal modselect from extmod and just put it in stmhal.
10 years ago
Damien George
6c9c7bc75a
stmhal: Implement generic select.select and select.poll.
10 years ago
Damien George
8f81b5cb4b
py: Put SystemExit in builtin namespace.
Also fix unix port so that SystemExit with no arg exits with value 0.
10 years ago
Paul Sokolovsky
510296f25a
modzlibd: Decompress part of "zlib" module, based on miniz tinfl.c .
10 years ago
Damien George
4c03b3a899
py: Implement builtin reversed() function.
reversed function now implemented, and works for tuple, list, str, bytes
and user objects with __len__ and __getitem__.
Renamed mp_builtin_len to mp_obj_len to make it publically available (eg
for reversed).
10 years ago
Paul Sokolovsky
8215847b4d
moductypes: Foreign data interface module, roughly based on ctype ideas.
But much smaller and memory-efficient. Uses Python builtin data structures
(dict, tuple, int) to describe structure layout.
11 years ago
Paul Sokolovsky
cb78f862cb
py: Allow to disable array module and bytearray type.
array.array and bytearray share big deal of code, so to get real savings,
both need to be disabled.
11 years ago
Paul Sokolovsky
59c675a64c
py: Include mpconfig.h before all other includes.
It defines types used by all other headers.
Fixes #691 .
11 years ago
Paul Sokolovsky
3b6f7b95eb
py: Separate MICROPY_PY_BUILTINS_COMPLEX from MICROPY_PY_BUILTINS_FLOAT.
One thing is wanting to do 1 / 2 and get something else but 0, and quite
another - doing rocket science ;-).
11 years ago
Emmanuel Blot
f6932d6506
Prefix ARRAY_SIZE with micropython prefix MP_
11 years ago
Paul Sokolovsky
fbdf2f1d63
py: Rename builtin "io" to "_io".
Functionality we provide in builtin io module is fairly minimal. Some
code, including CPython stdlib, depends on more functionality. So, there's
a choice to either implement it in C, or move it _io, and let implement other
functionality in Python. 2nd choice is pursued. This setup matches CPython
too (_io is builtin, io is Python-level).
11 years ago
Damien George
b294a7e3c9
py: Properly fix configuration of float and math module.
11 years ago
Damien George
65ec33200a
py: Fix configuration of math module.
11 years ago
Damien George
3ebd4d0cae
py: Add option to disable set() object (enabled by default).
11 years ago
Damien George
fb510b3bf9
Rename bultins config variables to MICROPY_PY_BUILTINS_*.
This renames:
MICROPY_PY_FROZENSET -> MICROPY_PY_BUILTINS_FROZENSET
MICROPY_PY_PROPERTY -> MICROPY_PY_BUILTINS_PROPERTY
MICROPY_PY_SLICE -> MICROPY_PY_BUILTINS_SLICE
MICROPY_ENABLE_FLOAT -> MICROPY_PY_BUILTINS_FLOAT
See issue #35 for discussion.
11 years ago
Damien George
ee3fd46f13
Rename configuration variables controling Python features.
Now of the form MICROPY_PY_*. See issue #35 .
11 years ago
Damien George
58ebde4664
Tidy up some configuration options.
MP_ALLOC_* -> MICROPY_ALLOC_*
MICROPY_PATH_MAX -> MICROPY_ALLOC_PATH_MAX
MICROPY_ENABLE_REPL_HELPERS -> MICROPY_HELPER_REPL
MICROPY_ENABLE_LEXER_UNIX -> MICROPY_HELPER_LEXER_UNIX
MICROPY_EXTRA_* -> MICROPY_PORT_*
See issue #35 .
11 years ago
Paul Sokolovsky
ff30666c69
py: Add basic implementation of hasattr() function.
11 years ago
Paul Sokolovsky
b181b581aa
objset: Give up and implement frozenset.
Tired of patching CPython stdlib for it.
11 years ago
Paul Sokolovsky
f9e54e0ea5
modgc: Add new module for GC-related functionality.
11 years ago
Damien George
04b9147e15
Add license header to (almost) all files.
Blanket wide to all .c and .h files. Some files originating from ST are
difficult to deal with (license wise) so it was left out of those.
Also merged modpyb.h, modos.h, modstm.h and modtime.h in stmhal/.
11 years ago
Damien George
6d3c5e4301
Add ARRAY_SIZE macro, and use it where possible.
11 years ago
Damien George
107c9fb235
py: Make collections module configurable, enabled by default.
11 years ago
Damien George
71d3112f7e
py: Make built-in 'range' a class.
Addresses issue #487 .
11 years ago
Damien George
dbdfee15a1
py: Add cmath module, for complex math. Disabled by default.
Not all functions implemented. Not enabled on pyboard.
11 years ago
Damien George
897fe0c0d0
py: Add builtin functions bin and oct, and some tests for them.
11 years ago
Damien George
5805111732
py: Add hex builtin function.
A one-liner, added especially for @pfalcon :)
11 years ago
Damien George
777b0f32f4
py: Add property object, with basic functionality.
Enabled by MICROPY_ENABLE_PROPERTY.
11 years ago
Damien George
49f20b841d
py: Add more #if's for configurable MOD_SYS.
11 years ago
Paul Sokolovsky
48fdaad824
py: Rename collections module to _collections.
We're not going to implement all the plethora of types in there in C.
Funnily, CPython implements defaultdict in C, and namedtuple in Python.
11 years ago
Paul Sokolovsky
5500cdeec7
py, unix: Convert sys module to static representation.
11 years ago
Paul Sokolovsky
e9db840480
py: Start implementing "struct" module.
Only calcsize() and unpack() functions provided so far, for little-endian
byte order. Format strings don't support repition spec (like "2b3i").
Unfortunately, dealing with all the various binary type sizes and alignments
will lead to quite a bloated "binary" helper functions - if optimizing for
speed. Need to think if using dynamic parametrized algos makes more sense.
11 years ago
Paul Sokolovsky
4dcb605ac4
py: Make bytearray a proper type.
11 years ago
Paul Sokolovsky
cc0af3d727
py: Implement globals() and locals() builtins.
11 years ago
Damien George
7efc5b3f34
py: Make globals and locals proper dictionary objects.
Finishes addressing issue #424 .
In the end this was a very neat refactor that now makes things a lot
more consistent across the py code base. It allowed some
simplifications in certain places, now that everything is a dict object.
Also converted builtins tables to dictionaries. This will be useful
when we need to turn builtins into a proper module.
11 years ago
Paul Sokolovsky
c6813d92db
py: Put default namespace into module __main__.
That's how CPython has it, in particular, "import __main__" should work.
11 years ago
Paul Sokolovsky
98a627dc03
py: Add "io" module.
So far just includes "open" function, which should be supplied by a port.
TODO: Make the module #ifdef'ed.
11 years ago
Damien George
3e1a5c10c5
py: Rename old const type objects to mp_type_* for consistency.
11 years ago
Damien George
07ddab529c
py: Change mp_const_* objects to macros.
Addresses issue #388 .
11 years ago
Damien George
c63f984647
py: Thin out predefined exceptions.
Only exceptions that are actually used are left prefedined. Hierarchy
is still there, and removed exceptions are just commented out.
11 years ago
Paul Sokolovsky
e9137b94f2
py: Implement getattr() builtin.
11 years ago
Damien George
ffb5cfc8d8
py: Removed some unnecessary exception objects.
They still exist in commented-out form in objexcept.c if they are ever
needed.
11 years ago
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].
11 years ago