summaryrefslogtreecommitdiffstatshomepage
path: root/py/pfenv.h
Commit message (Collapse)AuthorAge
* 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: Remove unnecessary and unused sgn argument from pfenv_print_mp_int.Damien George2015-03-14
|
* 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.
* py: Convert [u]int to mp_[u]int_t where appropriate.Damien George2014-10-03
| | | | Addressing issue #50.
* 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/.
* Rename machine_(u)int_t to mp_(u)int_t.Damien George2014-07-03
| | | | See discussion in issue #50.
* Fix str.modulo when precision is specified.Dave Hylands2014-06-05
|
* Rename bultins config variables to MICROPY_PY_BUILTINS_*.Damien George2014-06-01
| | | | | | | | | | This renames: MICROPY_PY_FROZENSET -> MICROPY_PY_BUILTINS_FROZENSET MICROPY_PY_PROPERTY -> MICROPY_PY_BUILTINS_PROPERTY MICROPY_PY_SLICE -> MICROPY_PY_BUILTINS_SLICE MICROPY_ENABLE_FLOAT -> MICROPY_PY_BUILTINS_FLOAT See issue #35 for discussion.
* 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/.
* py: Reinstate old pfenv_print_int function for stmhal's printf.Damien George2014-04-08
|
* py: Rename pfenv_print_int to pfenv_print_mp_int, and add back former.Damien George2014-04-08
| | | | | | | | | | | | | | stmhal relies on pfenv_* to implement its printf. Thus, it needs a pfenv_print_int which prints a proper 32-bit integer. With latest change to pfenv, this function became one that took mp_obj_t, and extracted the integer value from that object. To fix temporarily, pfenv_print_int has been renamed to pfenv_print_mp_int (to indicate it takes a mp_obj_t for the int), and pfenv_print_int has been added (which takes a normal C int). Currently, pfenv_print_int proxies to pfenv_print_mp_int, but this means it looses the MSB. Need to find a way to fix this, but the only way I can think of will duplicate lots of code.
* Add string formatting support for longlong and mpz.Dave Hylands2014-04-07
|
* Change pfenv_print_int to take machine_uint_t rather than unsinged inDave Hylands2014-04-05
| | | | | | | With this change, the following works: >>> print('%#x' % 0x1234567890abcdef) 0x1234567890abcdef
* Enhance str.format supportDave Hylands2014-04-01
This adds support for almost everything (the comma isn't currently supported). The "unspecified" type with floats also doesn't behave exactly like python. Tested under unix with float and double Spot tested on stmhal