Paul Sokolovsky
9b0714b24c
py: Declare help, input, open builtins in core.
...
These are *defined* per-port, but why redeclare them again and again.
2016-04-15 00:07:56 +03:00
Damien George
53ad681ed1
extmod: Add initial framebuf module.
2016-04-12 14:06:53 +01:00
Paul Sokolovsky
24342dd65e
extmod/modwebsocket: Start module for WebSocket helper functions.
...
Currently, only write support is implemented (of limited buffer size).
2016-03-24 19:16:00 +02:00
Paul Sokolovsky
a58a91eb04
extmod/modurandom: Add "urandom" module.
...
Seedable and reproducible pseudo-random number generator. Implemented
functions are getrandbits(n) (n <= 32) and seed().
The algorithm used is Yasmarang by Ilya Levin:
http://www.literatecode.com/yasmarang
2016-01-17 12:13:01 +02:00
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.
2016-01-11 00:49:27 +00:00
Paul Sokolovsky
3a1bbcc2ef
extmod: Move fsusermount.c from stmhal for cross-port reuse.
2015-11-25 13:19:36 +02:00
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 .
2015-10-27 00:04:59 +03:00
Paul Sokolovsky
aaa8867d4a
modussl: SSL socket wrapper module based on axTLS.
2015-10-06 18:10:39 +03:00
Paul Sokolovsky
3d3ef36e97
modstruct: Rename module to "ustruct", to allow full Python-level impl.
2015-05-04 16:53:52 +03:00
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.
2015-05-04 13:05:12 +03:00
stijn
c1832fd206
py: Add setattr builtin.
2015-02-14 23:35:00 +00:00
Damien George
cd34207409
py: Can compile with -Wmissing-declarations and -Wmissing-prototypes.
2015-01-12 22:30:49 +00:00
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.
2015-01-07 20:33:00 +00:00
Damien George
51dfcb4bb7
py: Move to guarded includes, everywhere in py/ core.
...
Addresses issue #1022 .
2015-01-01 20:32:09 +00:00
Damien George
2a3e2b9033
py: Add execfile function (from Python 2); enable in stmhal port.
...
Adds just 60 bytes to stmhal binary. Addresses issue #362 .
2014-12-19 13:36:17 +00:00
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 .
2014-12-09 16:19:48 +00:00
Paul Sokolovsky
bfdc205934
modubinascii: Add, with hexlify() implementation.
2014-11-29 13:52:47 +00:00
Paul Sokolovsky
f4b19c873f
moduhashlib: Initial module skeleton.
2014-11-22 14:47:46 +02:00
Damien George
1559a97810
py: Add builtin round function.
...
Addresses issue #934 .
2014-10-31 11:28:50 +00:00
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 .
2014-10-25 22:07:25 +01:00
Paul Sokolovsky
8becca7c82
py: mp_builtin___import__(): Add const to arg type.
2014-10-25 22:31:26 +03:00
Damien George
f5d69794a8
extmod: Add uheapq module.
2014-10-22 23:20:15 +01:00
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
2014-10-21 22:10:01 +03:00
Paul Sokolovsky
911c00bbc5
modzlibd: Remove, superceded by moduzlib.
2014-10-13 14:13:22 +03:00
Paul Sokolovsky
34162872b1
moduzlib: Integrate into the system.
2014-10-13 00:07:44 +03:00
Paul Sokolovsky
c71e045165
modure: Initial module, using re1.5 (which is based on re1 codebase).
...
https://github.com/pfalcon/re1.5
2014-10-11 14:36:32 +03:00
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.
2014-09-17 22:56:34 +01:00
Damien George
013d53c0b4
Remove skeletal modselect from extmod and just put it in stmhal.
2014-09-07 20:42:01 +01:00
Damien George
6c9c7bc75a
stmhal: Implement generic select.select and select.poll.
2014-09-07 20:40:32 +01:00
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 .
2014-08-30 14:59:21 +01:00
Paul Sokolovsky
510296f25a
modzlibd: Decompress part of "zlib" module, based on miniz tinfl.c .
2014-08-13 00:26:19 +03:00
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).
2014-08-12 18:33:40 +01:00
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/.
2014-07-19 21:27:22 +03:00
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.
2014-07-09 19:28:24 +03:00
Paul Sokolovsky
561789d718
unix modsocket: Make .makefile() method more compliant.
...
.makefile() should allow to specify which stream time to create - byte
or text.
2014-05-24 21:24:37 +03:00
Paul Sokolovsky
ff30666c69
py: Add basic implementation of hasattr() function.
2014-05-11 20:51:30 +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
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
Paul Sokolovsky
14de114ba8
objdict: Add __delitem__.
2014-04-13 23:55:59 +03:00
Paul Sokolovsky
cd94b384a3
objdict: Add __setitem__.
2014-04-13 23:41:49 +03: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
68e7c5146c
py: Factor out impl of special methods for builtin types into opmethods.c
2014-04-13 11:54:53 +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
cc0af3d727
py: Implement globals() and locals() builtins.
2014-04-06 01:01:36 +03: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