summaryrefslogtreecommitdiffstatshomepage
path: root/py/modsys.c
Commit message (Collapse)AuthorAge
* all: Remove 'name' member from mp_obj_module_t struct.Damien George2016-09-22
| | | | One can instead lookup __name__ in the modules dict to get the value.
* py: Change type signature of builtin funs that take variable or kw args.Damien George2016-01-11
| | | | | With this patch the n_args parameter is changed type from mp_uint_t to size_t.
* py/modsys: Fix module globals table to use MP_ROM_QSTR.Damien George2015-12-16
|
* py/modsys: Use MP_ROM_PTR() initializer for sys.modules.Paul Sokolovsky2015-12-05
| | | | Based on similar usage for sys.argv/sys.path.
* py/modsys: Implement sys.modules.Paul Sokolovsky2015-12-05
| | | | | This for example will allow people to reload modules which didn't load successfully (e.g. due to syntax error).
* 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: Add MP_ROM_* macros and mp_rom_* types and use them.Damien George2015-11-29
|
* py/modsys: Consistently use indented #if's.Paul Sokolovsky2015-11-21
|
* py: Eliminate some cases which trigger unused parameter warnings.Damien George2015-09-04
|
* py: Replace py-version.sh with makeversionhdr.py, written in Python.Damien George2015-04-28
| | | | Also rename py-version.h to mpversion.h for consistency with mpconfig.h.
* modsys: Add basic sys.exc_info() implementation.Paul Sokolovsky2015-04-25
| | | | | | The implementation is very basic and non-compliant and provided solely for CPython compatibility. The function itself is bad Python2 heritage, its usage is discouraged.
* py: Add sys.implementation, containing uPy name and version number.Damien George2015-04-21
| | | | Uses attrtuple if it's enabled, otherwise just a normal tuple.
* py: Make mp_sys_stdout_print object, wrapping sys.stdout for mp_print*.Damien George2015-04-16
| | | | | So now all printing should go via either mp_plat_print or mp_sys_stdout_print.
* 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: Use a dummy type for referring to extern structsstijn2015-04-09
| | | | | Fixes msvc linker warnings about mismatching sizes between the mp_obj_fdfile_t struct defined in file.c and the mp_uint_t declarations found in modsys.c and modbuiltins.c
* py: Put mp_sys_path, mp_sys_argv and gc_collected in mp_state_ctx_t.Damien George2015-02-07
| | | | | Without mp_sys_path and mp_sys_argv in the root pointer section of the state, their memory was being incorrectly collected by GC.
* py: Can compile with -Wmissing-declarations and -Wmissing-prototypes.Damien George2015-01-12
|
* py: Move to guarded includes, everywhere in py/ core.Damien George2015-01-01
| | | | Addresses issue #1022.
* modsys: Add sys.print_exception(exc, file=sys.stdout) function.Paul Sokolovsky2014-12-08
| | | | | | | | | | | | The function is modeled after traceback.print_exception(), but unbloated, and put into existing module to save overhead on adding another module. Compliant traceback.print_exception() is intended to be implemented in micropython-lib in terms of sys.print_exception(). This change required refactoring mp_obj_print_exception() to take pfenv_t interface arguments. Addresses #751.
* Use MP_DEFINE_CONST_DICT macro to define module dicts.Damien George2014-11-29
| | | | | This is just a clean-up of the code. Generated code is exactly the same.
* py: Move definition of mp_sys_exit to core.Damien George2014-09-15
| | | | | | | | sys.exit always raises SystemExit so doesn't need a special implementation for each port. If C exit() is really needed, use the standard os._exit function. Also initialise mp_sys_path and mp_sys_argv in teensy port.
* doc: Fix up a few docs in sys module.Damien George2014-08-10
|
* doc: Document gc, sys, math, cmath.Damien George2014-08-10
|
* py: Make print() accept "file" argument, and actually print to stream.Paul Sokolovsky2014-07-19
| | | | | And not system printf(), like it was before. For this, move pfenv_printf() from stmhal port to py/.
* py: Implement sys.maxsize, standard way to check platform "bitness".Paul Sokolovsky2014-07-03
| | | | | Implementing it as a static constant is a bit peculiar and require cooperation from long int implementation.
* py: Include mpconfig.h before all other includes.Paul Sokolovsky2014-06-21
| | | | | | It defines types used by all other headers. Fixes #691.
* Prefix ARRAY_SIZE with micropython prefix MP_Emmanuel Blot2014-06-19
|
* modsys: Add optional support for sys.platform.Paul Sokolovsky2014-06-07
| | | | | Ports which wants to have it, should define MICROPY_PY_SYS_PLATFORM to a string value they need.
* Rename configuration variables controling Python features.Damien George2014-05-24
| | | | Now of the form MICROPY_PY_*. See issue #35.
* py: Rename MICROPY_SYS_EXIT to MICROPY_MOD_SYS_EXIT.Damien George2014-05-11
| | | | For consistency with MICROPY_MOD_SYS_STDFILES, etc.
* modsys: Enable sys.exit() per port after all.Paul Sokolovsky2014-05-10
|
* modsys, unix: Add sys.exit(), should be implemented by a port.Paul Sokolovsky2014-05-10
|
* 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/.
* Add ARRAY_SIZE macro, and use it where possible.Damien George2014-04-26
|
* modsys: Implement sys.version.Paul Sokolovsky2014-04-14
| | | | | | | | The logic appears to be that (at least beginning of) sys.versions is the version of reference Python language implemented, not version of particular implementation. Also, bump set versions at 3.4.0, based on @dpgeorge preference.
* modsys: Implement sys.byteorder.Paul Sokolovsky2014-04-13
|
* modsys: Implement basic sys.version_info.Paul Sokolovsky2014-04-13
|
* stmhal: Update for static mod sys.Paul Sokolovsky2014-04-13
|
* py, unix: Convert sys module to static representation.Paul Sokolovsky2014-04-13