Damien George
4b72b3a133
py: Change type signature of builtin funs that take variable or kw args.
With this patch the n_args parameter is changed type from mp_uint_t to
size_t.
9 years ago
Paul Sokolovsky
3a1bbcc2ef
extmod: Move fsusermount.c from stmhal for cross-port reuse.
9 years ago
Paul Sokolovsky
e0d7740a22
extmod/modlwip: slip: Use stream protocol and be port-independent.
Based on the original patch by Galen Hazelwood:
https://github.com/micropython/micropython/pull/1517 .
9 years ago
Paul Sokolovsky
aaa8867d4a
modussl: SSL socket wrapper module based on axTLS.
9 years ago
Paul Sokolovsky
3d3ef36e97
modstruct: Rename module to "ustruct", to allow full Python-level impl.
10 years ago
Paul Sokolovsky
0116218fa8
modmachine: Add new module to access hardware, starting with physical memory.
Refactored from "stm" module, provides mem8, mem16, mem32 objects with
array subscript syntax.
10 years ago
stijn
c1832fd206
py: Add setattr builtin.
10 years ago
Damien George
cd34207409
py: Can compile with -Wmissing-declarations and -Wmissing-prototypes.
10 years ago
Damien George
b4b10fd350
py: Put all global state together in state structures.
This patch consolidates all global variables in py/ core into one place,
in a global structure. Root pointers are all located together to make
GC tracing easier and more efficient.
10 years ago
Damien George
51dfcb4bb7
py: Move to guarded includes, everywhere in py/ core.
Addresses issue #1022 .
10 years ago
Damien George
2a3e2b9033
py: Add execfile function (from Python 2); enable in stmhal port.
Adds just 60 bytes to stmhal binary. Addresses issue #362 .
10 years ago
Damien George
78d702c300
py: Allow builtins to be overridden.
This patch adds a configuration option (MICROPY_CAN_OVERRIDE_BUILTINS)
which, when enabled, allows to override all names within the builtins
module. A builtins override dict is created the first time the user
assigns to a name in the builtins model, and then that dict is searched
first on subsequent lookups. Note that this implementation doesn't
allow deleting of names.
This patch also does some refactoring of builtins code, creating the
modbuiltins.c file.
Addresses issue #959 .
10 years ago
Paul Sokolovsky
bfdc205934
modubinascii: Add, with hexlify() implementation.
10 years ago
Paul Sokolovsky
f4b19c873f
moduhashlib: Initial module skeleton.
10 years ago
Damien George
1559a97810
py: Add builtin round function.
Addresses issue #934 .
10 years ago
Damien George
c9fc620723
py: Implement compile builtin, enabled only on unix port.
This should be pretty compliant with CPython, except perhaps for some
corner cases to do with globals/locals context.
Addresses issue #879 .
10 years ago
Paul Sokolovsky
8becca7c82
py: mp_builtin___import__(): Add const to arg type.
10 years ago
Damien George
f5d69794a8
extmod: Add uheapq module.
10 years ago
stijn
2fe4cf7761
Implement kwargs for builtin open() and _io.FileIO
This makes open() and _io.FileIO() more CPython compliant.
The mode kwarg is fully iplemented.
The encoding kwarg is allowed but not implemented; mainly to allow
the tests to specify encoding for CPython, see #874
10 years ago
Paul Sokolovsky
911c00bbc5
modzlibd: Remove, superceded by moduzlib.
10 years ago
Paul Sokolovsky
34162872b1
moduzlib: Integrate into the system.
10 years ago
Paul Sokolovsky
c71e045165
modure: Initial module, using re1.5 (which is based on re1 codebase).
https://github.com/pfalcon/re1.5
10 years ago
Damien George
612045f53f
py: Add native json printing using existing print framework.
Also add start of ujson module with dumps implemented. Enabled in unix
and stmhal ports. Test passes on both.
10 years ago
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
4abff7500f
py: Change uint to mp_uint_t in runtime.h, stackctrl.h, binary.h.
Part of code cleanup, working towards resolving issue #50 .
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
cb66f41ebc
py: Make print() accept "file" argument, and actually print to stream.
And not system printf(), like it was before. For this, move pfenv_printf()
from stmhal port to py/.
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
561789d718
unix modsocket: Make .makefile() method more compliant.
.makefile() should allow to specify which stream time to create - byte
or text.
11 years ago
Paul Sokolovsky
ff30666c69
py: Add basic implementation of hasattr() function.
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
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
Paul Sokolovsky
14de114ba8
objdict: Add __delitem__.
11 years ago
Paul Sokolovsky
cd94b384a3
objdict: Add __setitem__.
11 years ago
Paul Sokolovsky
68e7c5146c
py: Factor out impl of special methods for builtin types into opmethods.c
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
cc0af3d727
py: Implement globals() and locals() builtins.
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
Paul Sokolovsky
e9137b94f2
py: Implement getattr() builtin.
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
Damien George
24ff063e80
py: Remove obsolete declarations; make mp_obj_get_array consistent.
11 years ago
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).
11 years ago