summaryrefslogtreecommitdiffstatshomepage
path: root/py/objclosure.c
Commit message (Collapse)AuthorAge
* all: Use the name MicroPython consistently in commentsAlexander Steffen2017-07-31
| | | | | There were several different spellings of MicroPython present in comments, when there should be only one.
* py/objclosure: Convert mp_uint_t to size_t where appropriate.Damien George2017-02-16
|
* py: Fix passing of some wide int types to printf varg format list.Damien George2016-03-14
| | | | | | Passing an mp_uint_t to a %d printf format is incorrect for builds where mp_uint_t is larger than word size (eg a nanboxing build). This patch adds some simple casting to int in these cases.
* py: Change type of .make_new and .call args: mp_uint_t becomes size_t.Damien George2016-01-11
| | | | | | | This patch changes the type signature of .make_new and .call object method slots to use size_t for n_args and n_kw (was mp_uint_t. Makes code more efficient when mp_uint_t is larger than a machine word. Doesn't affect ports when size_t and mp_uint_t have the same size.
* py: Wrap all obj-ptr conversions in MP_OBJ_TO_PTR/MP_OBJ_FROM_PTR.Damien George2015-11-29
| | | | | | | | | This allows the mp_obj_t type to be configured to something other than a pointer-sized primitive type. This patch also includes additional changes to allow the code to compile when sizeof(mp_uint_t) != sizeof(void*), such as using size_t instead of mp_uint_t, and various casts.
* py: Overhaul and simplify printf/pfenv mechanism.Damien George2015-04-16
| | | | | | | | | | | | | | | | | | | | | | 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.
* py, unix: Allow to compile with -Wunused-parameter.Damien George2015-01-20
| | | | See issue #699.
* py: Move to guarded includes, everywhere in py/ core.Damien George2015-01-01
| | | | Addresses issue #1022.
* py: Make functions static where appropriate.Damien George2014-12-10
|
* objclosure: Fix printing of generator closures.Paul Sokolovsky2014-10-16
| | | | The code previously assumed that only functions can be closed over.
* py: Change [u]int to mp_[u]int_t in qstr.[ch], and some other places.Damien George2014-10-03
| | | | This should pretty much resolve issue #50.
* py: Change all uint to mp_uint_t in obj.h.Damien George2014-08-30
| | | | Part of code cleanup, working towards resolving issue #50.
* Change some parts of the core API to use mp_uint_t instead of uint/int.Damien George2014-08-30
| | | | Addressing issue #50, still some way to go yet.
* Rename machine_(u)int_t to mp_(u)int_t.Damien George2014-07-03
| | | | See discussion in issue #50.
* Add license header to (almost) all files.Damien George2014-05-03
| | | | | | | 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/.
* objclosure, objcell: Print detailed representation if was requested.Paul Sokolovsky2014-05-03
| | | | | Well, it is bound to "detailed error reporting", but that's closest what we have now without creating new entities.
* py, unix: Make "mpconfig.h" be first included, as other headers depend on it.Paul Sokolovsky2014-05-02
| | | | Specifically, nlr.h does.
* py: Making closures now passes pointer to stack, not a tuple for vars.Damien George2014-04-20
| | | | | | | Closed over variables are now passed on the stack, instead of creating a tuple and passing that. This way memory for the closed over variables can be allocated within the closure object itself. See issue #510 for background.
* objclosure: Store reference to entire closed variables tuple.Paul Sokolovsky2014-04-20
| | | | Avoids pointer-to-field garbage collection issue. Fixes #510.
* Rename rt_* to mp_*.Damien George2014-03-30
| | | | | | | Mostly just a global search and replace. Except rt_is_true which becomes mp_obj_is_true. Still would like to tidy up some of the names, but this will do for now.
* py: Clean up includes.xbe2014-03-17
| | | | Remove unnecessary includes. Add includes that improve portability.
* Implement proper exception type hierarchy.Damien George2014-02-15
| | | | | | | | | | | | | | Each built-in exception is now a type, with base type BaseException. C exceptions are created by passing a pointer to the exception type to make an instance of. When raising an exception from the VM, an instance is created automatically if an exception type is raised (as opposed to an exception instance). Exception matching (RT_BINARY_OP_EXCEPTION_MATCH) is now proper. Handling of parse error changed to match new exceptions. mp_const_type renamed to mp_type_type for consistency.
* Change mp_obj_type_t.name from const char * to qstr.Damien George2014-02-15
| | | | | | Ultimately all static strings should be qstr. This entry in the type structure is only used for printing error messages (to tell the type of the bad argument), and printing objects that don't supply a .print method.
* Revamp qstrs: they now include length and hash.Damien George2014-01-21
| | | | | Can now have null bytes in strings. Can define ROM qstrs per port using qstrdefsport.h
* Make VM stack grow upwards, and so no reversed args arrays.Damien George2014-01-18
| | | | | | | | | | | | | | | Change state layout in VM so the stack starts at state[0] and grows upwards. Locals are at the top end of the state and number downwards. This cleans up a lot of the interface connecting the VM to C: now all functions that take an array of Micro Python objects are in order (ie no longer in reverse). Also clean up C API with keyword arguments (call_n and call_n_kw replaced with single call method that takes keyword arguments). And now make_new takes keyword arguments. emitnative.c has not yet been changed to comply with the new order of stack layout.
* Merge branch 'cplusplus' of https://github.com/ian-v/micropython into ↵Damien George2014-01-07
|\ | | | | | | | | | | | | ian-v-cplusplus Conflicts: py/objcomplex.c
| * Co-exist with C++ (issue #85)ian-v2014-01-06
|/
* Convert many object types structs to use C99 tagged initializer syntax.Paul Sokolovsky2014-01-05
|
* Convert Python types to proper Python type hierarchy.Damien George2014-01-04
| | | | Now much more inline with how CPython does types.
* py: make closures work.Damien George2013-12-30
|
* Change object representation from 1 big union to individual structs.Damien2013-12-21
A big change. Micro Python objects are allocated as individual structs with the first element being a pointer to the type information (which is itself an object). This scheme follows CPython. Much more flexible, not necessarily slower, uses same heap memory, and can allocate objects statically. Also change name prefix, from py_ to mp_ (mp for Micro Python).