Emmanuel Blot
f6932d6506
Prefix ARRAY_SIZE with micropython prefix MP_
2014-06-19 18:54:34 +02:00
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).
2014-06-12 01:22:25 +03:00
Damien George
b294a7e3c9
py: Properly fix configuration of float and math module.
2014-06-03 13:43:20 +01:00
Damien George
65ec33200a
py: Fix configuration of math module.
2014-06-03 12:33:38 +00:00
Damien George
3ebd4d0cae
py: Add option to disable set() object (enabled by default).
2014-06-01 13:46:47 +01:00
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.
2014-06-01 13:32:54 +01:00
Damien George
ee3fd46f13
Rename configuration variables controling Python features.
...
Now of the form MICROPY_PY_*. See issue #35 .
2014-05-24 23:03:12 +01:00
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 .
2014-05-21 20:32:59 +01:00
Paul Sokolovsky
ff30666c69
py: Add basic implementation of hasattr() function.
2014-05-11 20:51:30 +03:00
Paul Sokolovsky
b181b581aa
objset: Give up and implement frozenset.
...
Tired of patching CPython stdlib for it.
2014-05-10 16:56:20 +03:00
Paul Sokolovsky
f9e54e0ea5
modgc: Add new module for GC-related functionality.
2014-05-06 02:28:49 +03:00
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/.
2014-05-03 23:27:38 +01:00
Damien George
6d3c5e4301
Add ARRAY_SIZE macro, and use it where possible.
2014-04-26 10:47:29 +01:00
Damien George
107c9fb235
py: Make collections module configurable, enabled by default.
2014-04-26 10:31:15 +01:00
Damien George
71d3112f7e
py: Make built-in 'range' a class.
...
Addresses issue #487 .
2014-04-17 18:18:55 +01:00
Damien George
dbdfee15a1
py: Add cmath module, for complex math. Disabled by default.
...
Not all functions implemented. Not enabled on pyboard.
2014-04-17 17:11:03 +01:00
Damien George
897fe0c0d0
py: Add builtin functions bin and oct, and some tests for them.
2014-04-15 22:03:55 +01:00
Damien George
5805111732
py: Add hex builtin function.
...
A one-liner, added especially for @pfalcon :)
2014-04-15 12:42:52 +01:00
Damien George
777b0f32f4
py: Add property object, with basic functionality.
...
Enabled by MICROPY_ENABLE_PROPERTY.
2014-04-13 18:59:45 +01:00
Damien George
49f20b841d
py: Add more #if's for configurable MOD_SYS.
2014-04-13 13:05:16 +01:00
Damien George
640e7e4779
Merge pull request #476 from pfalcon/static-sys
...
Convert sys module to static allocation
2014-04-13 12:52:39 +01:00
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.
2014-04-13 10:24:00 +03:00
Paul Sokolovsky
5500cdeec7
py, unix: Convert sys module to static representation.
2014-04-13 07:02:56 +03:00
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.
2014-04-10 03:58:03 +03:00
Paul Sokolovsky
4dcb605ac4
py: Make bytearray a proper type.
2014-04-08 22:11:40 +03:00
Paul Sokolovsky
cc0af3d727
py: Implement globals() and locals() builtins.
2014-04-06 01:01:36 +03:00
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.
2014-04-05 22:36:42 +01:00
Paul Sokolovsky
c6813d92db
py: Put default namespace into module __main__.
...
That's how CPython has it, in particular, "import __main__" should work.
2014-04-05 12:29:15 +03:00
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.
2014-04-03 22:08:57 +03:00
Damien George
3e1a5c10c5
py: Rename old const type objects to mp_type_* for consistency.
2014-03-29 13:43:38 +00:00
Damien George
07ddab529c
py: Change mp_const_* objects to macros.
...
Addresses issue #388 .
2014-03-29 13:15:08 +00:00
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.
2014-03-27 23:49:06 +00:00
Paul Sokolovsky
e9137b94f2
py: Implement getattr() builtin.
2014-03-27 00:11:36 +02:00
Damien George
ffb5cfc8d8
py: Removed some unnecessary exception objects.
...
They still exist in commented-out form in objexcept.c if they are ever
needed.
2014-03-25 14:29:40 +00: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