aboutsummaryrefslogtreecommitdiff
path: root/py/runtime.h
AgeCommit message (Collapse)Author
2014-03-27py: Factor out code from runtime.c to emitglue.c.Damien George
2014-03-26py: Support closures with default args.Paul Sokolovsky
2014-03-26py: Replace mp_const_stop_iteration object with MP_OBJ_NULL.Damien George
2014-03-23py: Implement support for "except Exception as var" clause.Paul Sokolovsky
For this, needed to implement DELETE_NAME bytecode (because var bound in except clause is automatically deleted at its end). http://docs.python.org/3/reference/compound_stmts.html#except : "When an exception has been assigned using as target, it is cleared at the end of the except clause."
2014-02-17Add pin mapping code.Dave Hylands
This commit also introduces board directories and moves board specific config into the appropriate board directory. boards/stm32f4xx-af.csv was extracted from the STM32F4xx datasheet and hand-tweaked. make-pins.py takes boards/stm32f4xx-af.csv, boards/stm32f4xx-prefix.c, and boards/BOARD-NAME/pins.csv as input and generates the file build/pins_BOARD_NAME.c The generated pin file for PYBOARD4 looks like this: https://gist.github.com/dhylands/9063231 The generated pins file includes all of the supported alternate functions, and includes upsupported alternate functions as comments. See the commnet block at the top of stm/pin_map.c for details on how to use the pin mapper. I also went ahead and modified stm/gpio.c to use the pin mapper.
2014-02-15Implement proper exception type hierarchy.Damien George
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.
2014-02-14Implement "from module import *" construct.Paul Sokolovsky
2014-02-05Implement support for sys.path when loading modules.Paul Sokolovsky
sys.path is not initialized by rt_init(), that's left for platform-specific startup code. (For example, bare metal port may have some hardcoded defaults, and let user change sys.path directly; while port for OS with environment feature can take path from environment). If it's not explicitly initialized, modules will be imported only from a current directory.
2014-02-02py: Partially fix native emitter to work with latest runtime.Damien George
Native emitter has been broken since stack order has changed from reverse to standard. This fix gets it partially working.
2014-02-01Implement default function arguments (for Python functions).Paul Sokolovsky
TODO: Decide if we really need separate bytecode for creating functions with default arguments - we would need same for closures, then there're keywords arguments too. Having all combinations is a small exponential explosion, likely we need just 2 cases - simplest (no defaults, no kw), and full - defaults & kw.
2014-01-24Add basic implementation of bytes type, piggybacking on str.Paul Sokolovsky
This reuses as much str implementation as possible, from this we can make them more separate as needed.
2014-01-22py: Initialise loaded_module map in rt_init.Damien George
STM port crashes without this re-init. There should not be any state in the core py/ code that relies on pre-initialised data.
2014-01-18Make VM stack grow upwards, and so no reversed args arrays.Damien George
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.
2014-01-13Consolidate rt_make_function_[0123] to rt_make_function_n.Damien George
2014-01-11unified the bopsJohn R. Lenton
2014-01-04Split qstr into pools, and put initial pool in ROM.Damien George
Qstr's are now split into a linked-list of qstr pools. This has 2 benefits: the first pool can be in ROM (huge benefit, since we no longer use RAM for the core qstrs), and subsequent pools use m_new for the next pool instead of m_renew (thus avoiding a huge single table for all the qstrs). Still would be better to use a hash table, but this scheme takes us part of the way (eventually convert the pools to hash tables). Also fixed bug with import. Also improved the way the module code is referenced (not magic number 1 anymore).
2014-01-03Basic implementation of import.Damien George
import works for simple cases. Still work to do on finding the right script, and setting globals/locals correctly when running an imported function.
2013-12-21Change object representation from 1 big union to individual structs.Damien
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).
2013-12-17py: add more Python built-in functions.Damien
2013-12-17py: split runtime into map, obj, builtin.Damien
2013-12-11py: work towards working closures.Damien
2013-12-10py: add skeletal import functionality.Damien
2013-11-26py: add list pop and sort, unpack_sequence, and keywords in method_call.Damien
2013-11-03Add simple var-arg functions; add simple string.format.Damien
2013-11-03Change Py API names, py_get_* -> py_obj_get_*.Damien
2013-11-02Add user object to runtime.Damien
2013-11-02Fix bug: emit native didn't clear last_was_return in label_assign.Damien
2013-11-02Add basic complex number support.Damien
2013-11-02Implement: str.join, more float support, ROT_TWO in VM.Damien
2013-10-25Add py_get_array_fixed_n function.Damien
2013-10-23Add working MMA support.Damien
2013-10-23Fix func decls with no arguments: () -> (void).Damien
2013-10-23Add py_get_qstr.Damien
2013-10-22Add simple support for C modules.Damien
2013-10-19Make grammar rules const so the go in .text section.Damien
2013-10-19Make rt_fun_table const, so it goes in .text section.Damien
2013-10-18Implement REPL.Damien
2013-10-16Add iterators and comprehension to emitnative.Damien
2013-10-16Add SET_ADD opcode to VM.Damien
2013-10-16Implement BC & runtime support for generator/yielding.Damien
2013-10-16Support tuples and list comprehension, albeit crude.Damien
2013-10-15Implement basic exception framework, and simple for loop.Damien
2013-10-10Simplify and improve function & method calling.Damien
2013-10-10Implement basic class/object in native code.Damien
2013-10-09Implement basic class/object functionality in runtime.Damien
2013-10-05Add support for inline thumb assembly.Damien
2013-10-04Initial commit.Damien