Damien George
6d24dc23b8
py/emitglue: Move typedef of mp_raw_code_t from .c to .h file.
...
It's needed by frozen bytecode.
2016-04-13 16:05:43 +01:00
Damien George
eacbd7aeba
py: Fix constant folding and inline-asm to work with new async grammar.
2016-04-13 15:26:39 +01:00
pohmelie
81ebba7e02
py: add async/await/async for/async with syntax
...
They are sugar for marking function as generator, "yield from"
and pep492 python "semantically equivalents" respectively.
@dpgeorge was the original author of this patch, but @pohmelie made
changes to implement `async for` and `async with`.
2016-04-13 15:26:38 +01:00
Paul Sokolovsky
b67d098841
py/modbuiltins: __repl_print__: Add comment about setting "_" special var.
2016-04-13 00:59:41 +03:00
Damien George
eec8a94f04
extmod/machine_i2c: Implement I2C memory reading/writing.
2016-04-12 15:52:17 +01:00
Damien George
d083712224
extmod: Add generic machine.I2C class, with bit-bang I2C.
...
Should work on any machine that provides the correct pin functions.
2016-04-12 14:06:54 +01:00
Damien George
53ad681ed1
extmod: Add initial framebuf module.
2016-04-12 14:06:53 +01:00
Damien George
358e5d8bad
py/stream: Move uPy func obj wrappers to below their respective funcs.
2016-04-10 12:41:28 +01:00
Damien George
657aef66ff
py/stream: Simplify arg extraction logic for stream_ioctl.
...
Saves 16 bytes of code.
Also, use mp_obj_get_int_truncated to allow integers as big as a machine
word to be passed as the value.
2016-04-10 12:37:59 +01:00
Paul Sokolovsky
558fd5d228
py/stream: ioctl(): Properly support 2-arg form.
2016-04-10 13:36:44 +03:00
Paul Sokolovsky
6c3db26ab7
py/stream: Fix signed comparison issue.
2016-04-10 13:31:52 +03:00
Paul Sokolovsky
0c97e4c414
py/stream: Add Python-level ioctl() method.
...
Will call underlying C virtual methods of stream interface. This isn't
intended to be added to every stream object (it's not in CPython), but
is convenient way to expose extra operation on Python side without
adding bunch of Python-level methods.
2016-04-10 12:45:46 +03:00
Paul Sokolovsky
a45e280c58
py/stream.h: Add bigger inventory of stream ioctl's.
2016-04-10 12:42:41 +03:00
Damien George
04d5e644fc
py/objarray: Fix array.append so it doesn't extend if append fails.
...
Addresses issue #1965 .
2016-04-07 09:03:33 +01:00
Damien George
2c915e1ae6
py: Implement basic with support in native emitter.
2016-04-07 08:53:24 +01:00
Damien George
ce8b4e8749
py: Combine continuous block of emit steps into with_cleanup emit call.
...
Because different emitters need to handle with-cleanup in different ways.
2016-04-07 08:50:38 +01:00
Paul Sokolovsky
e6a4d4e23c
py: Move stream-related declarations from obj.h to stream.h.
2016-04-05 22:06:52 +03:00
Paul Sokolovsky
069654f2be
py/obj.h: Add comment why mp_fun_kw_t takes non-const mp_map_t*.
...
mp_fun_kw_t takes mp_map_t* (and not const mp_map_t*) to ease passing
this arg to mp_map_lookup(), which may modify its arg, depending on
flags.
2016-04-04 15:37:19 +03:00
Stephen Kyle
b475327ffa
py/map: Prevent map resize failure from destroying map.
2016-04-01 16:36:00 +03:00
Paul Sokolovsky
b1dfdaf6cb
py/ringbuf.h: Add reusable ring buffer class.
...
Features inline get/put operations for the highest performance. Locking
is not part of implementation, operation should be wrapped with locking
externally as needed.
2016-03-30 14:48:31 +03:00
Damien George
2599672384
py/parsenum: Use pow function to apply exponent to decimal number.
...
Pow is already a dependency when compiling with floats, so may as well
use it here to reduce code size and speed up the conversion for most
cases.
2016-03-29 22:12:07 +01:00
Damien George
e1e7657277
py/formatfloat: Fix further cases of buffer overflow in formatting.
...
Includes extensive test cases to catch hopefully all cases where
buffer might overflow.
2016-03-29 22:07:15 +01:00
Damien George
03b8bb7ec9
py/formatfloat: Fix case of float format where leading digit was "10".
...
When taking the logarithm of the float to determine the exponent, there
are some edge cases that finish the log loop too large. Eg for an
input value of 1e32-epsilon, this is actually less than 1e32 from the
log-loop table and finishes as 10.0e31 when it should be 1.0e32. It
is thus rendered as :e32 (: comes after 9 in ascii).
There was the same problem with numbers less than 1.
2016-03-29 22:03:13 +01:00
Paul Sokolovsky
53ad5edc01
py/stream: Fix stupid thinko with variable naming/shadowing.
2016-03-27 12:58:33 +03:00
Paul Sokolovsky
8f1854ad2d
extmod/modlwip: Add SOL_SOCKET and SO_REUSEADDR constants for setsockopt().
2016-03-25 15:06:12 +02:00