Commit Graph

1145 Commits

Author SHA1 Message Date
Damien George 3765ea419a extmod: Prefix py/ for includes from py core directory. 2015-01-01 20:35:21 +00:00
Damien George 969a6b37bf py: Make functions static where appropriate. 2014-12-10 22:08:14 +00:00
Damien George be6d8be91e py: Rename mp_obj_int_get to mp_obj_int_get_truncated; fix struct.pack.
mp_obj_int_get_truncated is used as a "fast path" int accessor that
doesn't check for overflow and returns the int truncated to the machine
word size, ie mp_int_t.

Use mp_obj_int_get_truncated to fix struct.pack when packing maximum word
sized values.

Addresses issues #779 and #998.
2014-12-05 23:13:52 +00:00
Damien George 3b603f29ec Use MP_DEFINE_CONST_DICT macro to define module dicts.
This is just a clean-up of the code.  Generated code is exactly the
same.
2014-11-29 14:39:27 +00:00
Paul Sokolovsky bfdc205934 modubinascii: Add, with hexlify() implementation. 2014-11-29 13:52:47 +00:00
Paul Sokolovsky a944183b35 moduhashlib: Integrate sha256 implementation. 2014-11-22 14:48:17 +02:00
Paul Sokolovsky 63e02e8cc0 moduhashlib: Add sha256 implementation from "crypto-algorithms" project.
https://github.com/B-Con/crypto-algorithms revision 100f4ff
2014-11-22 14:47:52 +02:00
Paul Sokolovsky f4b19c873f moduhashlib: Initial module skeleton. 2014-11-22 14:47:46 +02:00
stijn b89eaaa2e2 windows: Update config with latest features
- update mpconfigport.h to reflect latest unix version
- fix compilation error in modure due to msvc not allowing dynamic arrays
2014-11-21 19:38:33 +00:00
Paul Sokolovsky 8bb71f0b06 moductypes: Make .sizeof() work with bytearrays. 2014-10-30 03:50:37 +02:00
Paul Sokolovsky 6d287a6a02 moductypes: When dereferencing a field which is array of uint8, use bytearray.
Because bytearrays are much friendlier to work with, e.g. they can be printed
easily.
2014-10-30 03:50:34 +02:00
Paul Sokolovsky 2559e13957 moductypes: Make sure we can apply .sizeof() to all aggregate types.
Before, sizeof() could be applied to a structure field only if that field
was itself a structure. Now it can be applied to PTR and ARRAY fields too.
It's not possible to apply it to scalar fields though, because as soon as
scalar field (int or float) is dereferenced, its value is converted into
Python int/float value, and all original type info is lost. Moreover, we
allow sizeof of type definitions too, and there int is used to represent
(scalar) types. So, we have ambiguity what int may be - either dereferenced
scalar structure field, or encoded scalar type. So, rather throw an error
if user tries to apply sizeof() to int.
2014-10-30 03:50:23 +02:00
Damien George f5d69794a8 extmod: Add uheapq module. 2014-10-22 23:20:15 +01:00
Paul Sokolovsky 297d8469b8 modure: Update to re1.5 v0.6.1, fixed and extended character class support. 2014-10-17 22:25:18 +03:00
Paul Sokolovsky 95908b0f50 modure: Update to re1.5 v0.6, support for char sets/classes ([a-c]). 2014-10-15 04:44:07 +03:00
Paul Sokolovsky 911c00bbc5 modzlibd: Remove, superceded by moduzlib. 2014-10-13 14:13:22 +03:00
Damien George 4b71c056ef moduzlib: Fix fn prototype and some code style; use it in stmhal port. 2014-10-12 23:35:38 +01:00
Paul Sokolovsky bfb6af857a moduzlib: Import uzlib v1.1.
https://github.com/pfalcon/uzlib
2014-10-13 00:09:43 +03:00
Paul Sokolovsky 426bb58b23 moduzlib: New zlib-like module, based on uzlib. 2014-10-13 00:07:43 +03:00
Paul Sokolovsky 1606607bd4 modure: Make sure that re1.5 compiled in only of modure itself is enabled.
This is achieved by including re1.5 *.c files straight from modure.c .
2014-10-12 03:40:20 +03:00
Paul Sokolovsky 457c0a606c modure: Upgrade re1.5 to 0.5.1
Changes include:

regexp.h: Add double-include protection.
2014-10-12 03:12:19 +03:00
Paul Sokolovsky 5edbadefc1 modure: Import needed files from re1.5 v0.5.
https://github.com/pfalcon/re1.5
2014-10-11 14:36:32 +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 9336ee320a py: Make mp_binary_set_val work on big endian machine. 2014-10-06 15:05:35 +00:00
Dave Hylands 39296b40d4 Fix timer overflow code.
Teensy doesn't need to worry about overflows since all of
its timers are only 16-bit.

For PWM, the pulse width needs to be able to vary from 0..period+1
(pulse-width == period+1 corresponds to 100% PWM)

I couldn't test the 0xffffffff cases since we can't currently get a
period that big in python. With a prescaler of 0, that corresponds
to a freq of 0.039 (i.e. cycle every 25.56 seconds), and we can't
set that using freq or period.

I also tested both stmhal and teensy with floats disabled, which
required a few other code changes to compile.
2014-09-27 19:40:37 -07:00
Damien George 2c180f7ccc extmod, ujson: Add test and comment for loads. 2014-09-21 23:43:03 +01:00
Damien George df1e92ba3a extmod, ujson: Add \uxxxx parsing in json strings. 2014-09-21 23:43:03 +01:00
Damien George fa2f1f72e0 extmod, ujson: Slight reduction in code size. 2014-09-21 23:43:03 +01:00
Damien George 89e4657c69 extmod: Add loads to ujson module. 2014-09-21 23:43:03 +01: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 c8c44a4c2e py: Add ioctl method to stream protocol; add initial modselect. 2014-09-07 20:40:10 +01:00
Damien George e875e3882d extmod: Fix type-punned-ptr error. 2014-09-02 11:38:45 +01:00
stijn 759138caee msvc: Exclude modtermios, include extmod and fix compilation error 2014-09-02 09:00:20 +02:00
Damien George ecc88e949c Change some parts of the core API to use mp_uint_t instead of uint/int.
Addressing issue #50, still some way to go yet.
2014-08-30 00:35:11 +01:00
Damien George 72b115cbaa extmod, zlibd: Make some simple ROM and RAM savings.
ROM down by 320 bytes on stmhal.  RAM down by 5.5k for a decompression
object.
2014-08-22 18:38:16 +01:00
Damien George 1ddd844815 extmod: Finish rename of zlib to zlibd; enable zlibd on stmhal. 2014-08-12 23:23:53 +01:00
Paul Sokolovsky 8882c20b8f modzlibd: Add tinfl.c from miniz SVN repo, r63.
The only change is line-ending convesion to LF.
2014-08-13 00:26:19 +03: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 105e32f1a5 stmhal: Enable moductypes by default.
Also fixes compiler error in moductypes when compiled without debugging.

Addresses issue #778.
2014-08-12 20:02:26 +01:00
Paul Sokolovsky 5f47ebbf82 moductypes: Remove debug inclusion of stdio.h . 2014-08-10 10:11:22 +03:00
Damien George bb4c6f35c6 py: Make MP_OBJ_NEW_SMALL_INT cast arg to mp_int_t itself.
Addresses issue #724.
2014-07-31 10:49:14 +01:00
Paul Sokolovsky 2097c8b1e1 moductypes: Add symbolic constants to specify bitfield position/length. 2014-07-11 00:06:36 +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