summaryrefslogtreecommitdiff
path: root/py/pfenv.c
AgeCommit message (Collapse)Author
2015-04-16py: Overhaul and simplify printf/pfenv mechanism.Damien George
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.
2015-04-04py: Some trivial cosmetic changes, for code style consistency.Damien George
2015-03-14py: Remove unnecessary and unused sgn argument from pfenv_print_mp_int.Damien George
2015-02-27py: Use m_{new,renew,del} consistently.Damien George
This is so all memory requests go through the same interface.
2015-01-20py, unix: Allow to compile with -Wunused-parameter.Damien George
See issue #699.
2015-01-16py, unix: Allow to compile with -Wsign-compare.Damien George
See issue #699.
2015-01-01py: Move to guarded includes, everywhere in py/ core.Damien George
Addresses issue #1022.
2014-10-03py: Convert [u]int to mp_[u]int_t where appropriate.Damien George
Addressing issue #50.
2014-07-03Rename machine_(u)int_t to mp_(u)int_t.Damien George
See discussion in issue #50.
2014-06-21py: Include mpconfig.h before all other includes.Paul Sokolovsky
It defines types used by all other headers. Fixes #691.
2014-06-05Fix str.modulo when precision is specified.Dave Hylands
2014-06-01Rename bultins config variables to MICROPY_PY_BUILTINS_*.Damien George
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.
2014-05-03Add license header to (almost) all files.Damien George
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/.
2014-04-17py: Fix pfenv_print_strn to return correct number of chars printed.Damien George
With this fix, all tests in tests/basics pass on pyboard.
2014-04-08py: Reinstate old pfenv_print_int function for stmhal's printf.Damien George
2014-04-08py: Rename pfenv_print_int to pfenv_print_mp_int, and add back former.Damien George
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.
2014-04-07Add string formatting support for longlong and mpz.Dave Hylands
2014-04-05Change pfenv_print_int to take machine_uint_t rather than unsinged inDave Hylands
With this change, the following works: >>> print('%#x' % 0x1234567890abcdef) 0x1234567890abcdef
2014-04-01py: Make pfenv.c conform to code conventions.Damien George
2014-04-01Reduce stack usage of pfenv_print_strnDave Hylands
2014-04-01Fix INT_BUF_SIZE to work with 32-bit and 64-bitDave Hylands
2014-04-01Enhance str.format supportDave Hylands
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