Wykres commitów

11 Commity (06593fb0f23dfc12f482561fbec1717dca0d4db4)

Autor SHA1 Wiadomość Data
Damien George 06593fb0f2 py: Use a wrapper to explicitly check self argument of builtin methods.
Previous to this patch a call such as list.append(1, 2) would lead to a
seg fault.  This is because list.append is a builtin method and the first
argument to such methods is always assumed to have the correct type.

Now, when a builtin method is extracted like this it is wrapped in a
checker object which checks the the type of the first argument before
calling the builtin function.

This feature is contrelled by MICROPY_BUILTIN_METHOD_CHECK_SELF_ARG and
is enabled by default.

See issue #1216.
2015-06-20 16:39:39 +01:00
Damien George 5aa311d330 py: Add attrtuple object, for space-efficient tuples with attr access.
If you need the functionality of a namedtuple but will only make 1 or a
few instances, then use an attrtuple instead.
2015-04-21 14:14:24 +00:00
Damien George 7f9d1d6ab9 py: Overhaul and simplify printf/pfenv mechanism.
Previous to this patch the printing mechanism was a bit of a tangled
mess.  This patch attempts to consolidate printing into one interface.

All (non-debug) printing now uses the mp_print* family of functions,
mainly mp_printf.  All these functions take an mp_print_t structure as
their first argument, and this structure defines the printing backend
through the "print_strn" function of said structure.

Printing from the uPy core can reach the platform-defined print code via
two paths: either through mp_sys_stdout_obj (defined pert port) in
conjunction with mp_stream_write; or through the mp_plat_print structure
which uses the MP_PLAT_PRINT_STRN macro to define how string are printed
on the platform.  The former is only used when MICROPY_PY_IO is defined.

With this new scheme printing is generally more efficient (less layers
to go through, less arguments to pass), and, given an mp_print_t*
structure, one can call mp_print_str for efficiency instead of
mp_printf("%s", ...).  Code size is also reduced by around 200 bytes on
Thumb2 archs.
2015-04-16 14:30:16 +00:00
Paul Sokolovsky 282ca09f8e py: Add MICROPY_PY_BUILTINS_REVERSED, disable for minimal ports. 2015-04-07 00:17:11 +03:00
Paul Sokolovsky e2d44e30c7 py: Add MICROPY_PY_BUILTINS_ENUMERATE, disable for minimal ports. 2015-04-06 23:51:29 +03:00
Damien George 42e0c59308 py: Add MICROPY_COMP_{DOUBLE,TRIPLE}_TUPLE_ASSIGN config options.
These allow to fine-tune the compiler to select whether it optimises
tuple assignments of the form a, b = c, d and a, b, c = d, e, f.
Sensible defaults are provided.
2015-03-14 13:11:35 +00:00
Damien George 601c814603 minimal: Allow to compile without defining MICROPY_HAL_H. 2015-02-13 15:26:53 +00:00
Paul Sokolovsky 640e0b221e py: Implement very simple frozen modules support.
Only modules (not packages) supported now. Source modules can be converted
to frozen module structures using tools/make-frozen.py script.
2015-01-20 11:52:12 +02:00
Paul Sokolovsky d7337f288e minimal: Support even-driven REPL. 2015-01-16 01:38:24 +02:00
Paul Sokolovsky 5ebabcda41 minimal: Convert "bare-arm" port to "minimal" port.
This enable libc functions, GC, and line-editing function. Also, UART
emulation for POSIX systems is added. Emulation build is set as default.
2015-01-13 04:02:56 +02:00
Paul Sokolovsky d511a20a6b minimal: New port, intended to represent minimal working code.
Unlike bare-arm, which is mostly intended to show raw interpreter size,
without library and support code dependencies. This port is intended to
be a better base to start new ports, and also will include emulation
build to allow debug some aspects of embedded targets on POSIX systems.

This initial commit is verbatim copy of bare-arm code.
2015-01-13 03:17:47 +02:00