summaryrefslogtreecommitdiffstatshomepage
path: root/lib/utils
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.
* all: Unify header guard usage.Alexander Steffen2017-07-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The code conventions suggest using header guards, but do not define how those should look like and instead point to existing files. However, not all existing files follow the same scheme, sometimes omitting header guards altogether, sometimes using non-standard names, making it easy to accidentally pick a "wrong" example. This commit ensures that all header files of the MicroPython project (that were not simply copied from somewhere else) follow the same pattern, that was already present in the majority of files, especially in the py folder. The rules are as follows. Naming convention: * start with the words MICROPY_INCLUDED * contain the full path to the file * replace special characters with _ In addition, there are no empty lines before #ifndef, between #ifndef and one empty line before #endif. #endif is followed by a comment containing the name of the guard macro. py/grammar.h cannot use header guards by design, since it has to be included multiple times in a single C file. Several other files also do not need header guards as they are only used internally and guaranteed to be included only once: * MICROPY_MPHALPORT_H * mpconfigboard.h * mpconfigport.h * mpthreadport.h * pin_defs_*.h * qstrdefs*.h
* stmhal: Move pybstdio.c to lib/utils/sys_stdio_mphal.c for common use.Damien George2017-06-15
| | | | | It provides sys.stdin, sys.stdout, sys.stderr for bare-metal targets based on mp_hal functions.
* lib/utils/interrupt_char: Remove support for KBD_EXCEPTION disabled.Damien George2017-06-02
| | | | | If a port is using interrupt_char.c then it must enable MICROPY_KBD_EXCEPTION. This is the case for all official ports.
* various: Spelling fixesVille Skyttä2017-05-29
|
* lib/utils/pyexec: Update event-driven REPL to match non-event REPL.Tom Collins2017-05-05
| | | | | Don't print dupe ">>> " prompt when starting event-driven REPL. Clear incomplete line in transition from raw to friendly REPL.
* py: Add micropython.schedule() function and associated runtime code.Damien George2017-03-20
|
* lib/utils/pyexec: Fix bug with pyexec_file not setting flag for source.Damien George2017-03-14
|
* lib/utils/pyexec: Refactor to put lexer constructors all in one place.Damien George2017-03-14
| | | | | The lexer can now raise an exception on construction so it must go within an nlr handler block.
* lib/utils/pyexec: Allow to compile when the uPy compiler is disabled.Damien George2017-02-27
|
* lib/utils/pyexec: Only print help prompt if HELP feature is enabled.Damien George2017-01-22
|
* lib/utils: Remove old pyhelp helper, replaced with py/builtinhelp.c.Damien George2017-01-22
| | | | | | Ports should no longer use pyhelp_print_obj but instead should define MICROPY_PY_BUILTINS_HELP to 1 and then specify their help text using MICROPY_PY_BUILTINS_HELP_TEXT.
* lib/utils/interrupt_char: Use core-provided mp_kbd_exception if enabled.Damien George2016-12-15
| | | | | Ultimately all ports that use lib/utils/interrupt_char would enable MICROPY_KBD_EXCEPTION, so this is an interim solution.
* zephyr: Fix mp_hal_set_interrupt_char() declaration to be compatible.Paul Sokolovsky2016-10-26
| | | | | With other ports. Other ports declare it in mphalport.h, it can be inline or macro.
* lib/utils/pyexec: Fix compilation warning of type vs format mismatch.Paul Sokolovsky2016-10-26
| | | | | | | This happens with some compilers on some architectures, which don't define size_t as unsigned int. MicroPython's printf() dooesn't support obscure format specifiers for size_t, so the obvious choice is to explicitly cast to unsigned, to match %u used in printf().
* lib/utils/pyexec: Add mp_hal_set_interrupt_char() prototype.Vincenzo Frascino2016-10-26
| | | | | | This patch removes a compilation warning in pyexec. Signed-off-by: Vincenzo Frascino <vincenzo.frascino@linaro.org>
* lib/utils/pyhelp.c: Use mp_printf() instead of printf()Erik Moqvist2016-10-21
| | | | This patch introduces MP_PYTHON_PRINTER for general use.
* py: Be more specific with MP_DECLARE_CONST_FUN_OBJ macros.Damien George2016-10-21
| | | | | | | In order to have more fine-grained control over how builtin functions are constructed, the MP_DECLARE_CONST_FUN_OBJ macros are made more specific, with suffix of _0, _1, _2, _3, _VAR, _VAR_BETEEN or _KW. These names now match the MP_DEFINE_CONST_FUN_OBJ macros.
* lib/utils/pyexec: Allow behaviour of SystemExit to be configurable.Damien George2016-10-17
| | | | | Setting the pyexec_system_exit variable to PYEXEC_FORCED_EXT allows SystemExit exceptions to terminate the pyexec functions.
* py/vstr: Combine vstr_new_size with vstr_new since they are rarely used.Damien George2016-10-14
| | | | | | | Now there is just one function to allocate a new vstr, namely vstr_new (in addition to vstr_init etc). The caller of this function should know what initial size to allocate for the buffer, or at least have some policy or config option, instead of leaving it to a default (as it was before).
* lib/utils/pyexec: Don't treat SystemExit as "forced exit".Paul Sokolovsky2016-10-12
| | | | | | "Forced exit" is treated as soft-reboot (Ctrl+D). But expected effect of calling sys.exit() is termination of the current script, not any further and more serious actions like mentioned soft reboot.
* lib/interrupt_char: Factor out typical Ctrl+C handling from esp8266 port.Paul Sokolovsky2016-09-29
| | | | | Utility functions for keyboard interrupt handling, to be reused across (baremetal) ports.
* py: Add MICROPY_USE_INTERNAL_PRINTF option, defaults to enabled.Delio Brignoli2016-09-05
| | | | | | | | This new config option allows to control whether MicroPython uses its own internal printf or not (if not, an external one should be linked in). Accompanying this new option is the inclusion of lib/utils/printf.c in the core list of source files, so that ports no longer need to include it themselves.
* lib/utils/pyexec: qstr_pool_info() requires size_t* parameters.Paul Sokolovsky2016-08-30
|
* lib/utils/stdout_helpers: Fix function signature to match py/mphal.h.Paul Sokolovsky2016-08-25
|
* lib/utils/stdout_helpers: Move from minimal/uart_extra.c for reuse.Paul Sokolovsky2016-07-22
|
* lib/utils/pyexec: Use full path to readline.h header, per latest conventions.Paul Sokolovsky2016-07-21
|
* lib/utils/pyhelp: Extract implementation of help(obj) to a library function.Colin Hogben2016-04-25
| | | | | | Several ports use identical code for the 1-argument form of the builtin help function. Move this code to a library function to allow easier re-use by ports.
* lib/utils/pyexec: Condition-out GC calls from pyexec.Colin Hogben2016-04-19
| | | | | | | | | A port which uses lib/utils/pyexec.c but which does not enable garbage collection should not need to implement the gc_collect function. This patch also moves the gc_collect call to after printing the qstr info. Since qstrs cannot be collected it should not make any difference to the printed statistics.
* py: Add ability to have frozen persistent bytecode from .mpy files.Damien George2016-04-13
| | | | | | | The config variable MICROPY_MODULE_FROZEN is now made of two separate parts: MICROPY_MODULE_FROZEN_STR and MICROPY_MODULE_FROZEN_MPY. This allows to have none, either or both of frozen strings and frozen mpy files (aka frozen bytecode).
* lib/utils/printf: Rework overriding printer of DEBUG_printf().Paul Sokolovsky2016-04-13
| | | | | By default it uses mp_plat_print, but a port may override it to another value with MICROPY_DEBUG_PRINTER_DEST.
* esp8266: Disallow recursive calls to REPL.Paul Sokolovsky2016-04-01
| | | | | | | | | Before this change, if REPL blocked executing some code, it was possible to still input new statememts and excuting them, all leading to weird, and portentially dangerous interaction. TODO: Current implementation may have issues processing input accumulated while REPL was blocked.
* esp8266: Fix issue when current repl line was garbage-collected.Paul Sokolovsky2016-03-30
| | | | Reference it from root pointers section.
* lib/utils: Add pyexec_frozen_module to load and execute frozen module.Damien George2015-12-26
| | | | | | This is a convenience function similar to pyexec_file. It should be used instead of raw mp_parse_compile_execute because the latter does not catch and report exceptions.
* lib/utils/printf: Add vsnprintf alias for Clang.Paul Sokolovsky2015-12-12
| | | | Was reported to break MacOSX build.
* lib/utils/printf: Apply workaround for static linking with uclibc.Paul Sokolovsky2015-12-10
| | | | uclibc objects call __GI_vsnprintf().
* py: Change mp_print_strn_t func type to use size_t for the str length.Damien George2015-11-29
|
* lib/utils/printf: Use more conservative check for MICROPY_DEBUG_STDERR.Paul Sokolovsky2015-11-23
|
* lib/utils/printf: Fix issue with putchar define for some ports.Paul Sokolovsky2015-11-22
|
* lib/utils/printf: Add extra prototypes.Paul Sokolovsky2015-11-22
|
* unix: Use printf() implementation in terms of mp_printf().Paul Sokolovsky2015-11-22
| | | | | | In other words, unix port now uses overriden printf(), instead of using libc's. This should remove almost all dependency on libc stdio (which is bloated).
* py/emitglue: Host definition of mp_verbose_flag.Paul Sokolovsky2015-11-21
| | | | | This may not seem like the ideal place, but is actually the only place in py/ where it gets referenced, so is just right.
* lib/utils/printf: Move from stmhal/ .Paul Sokolovsky2015-11-10
| | | | | This file contains various MicroPython-specific helper functions, so isn't good fit for lib/libc/.
* lib/pyexec: Move header pyexec.h from stmhal directory.Damien George2015-11-09
|
* lib/pyexec: For paste mode use "Ctrl" as the name of the key, not "CTRL".Damien George2015-11-03
|
* stmhal: pyexec.c is common module, move to lib/utils/ .Paul Sokolovsky2015-10-31