circuitpython/py
Damien George 88d7bba961 py: Make it so that printing a small int does not allocate heap memory.
With the implementation of proper string formatting, code to print a
small int was delegated to mpz_as_str_inpl (after first converting the
small int to an mpz using stack memory).  But mpz_as_str_inpl allocates
heap memory to do the conversion, so small ints needed heap memory just
to be printed.

This fix has a separate function to print small ints, which does not
allocate heap, and allocates less stack.

String formatting, printf and pfenv are now large beasts, with some
semi-duplicated code.
2014-04-08 23:30:46 +01:00
..
asmthumb.c py: Improve inline assembler; add a few more opcodes. 2014-04-08 18:28:33 +01:00
asmthumb.h py: Improve inline assembler; add a few more opcodes. 2014-04-08 18:28:33 +01:00
asmx64.c Replace global "static" -> "STATIC", to allow "analysis builds". Part 2. 2014-02-12 18:31:30 +02:00
asmx64.h Revert MP_BOOL, etc. and use <stdbool.h> instead 2014-01-06 13:51:53 -08:00
bc0.h py: Remove DELETE_SUBSCR opcode, combine with STORE_SUBSCR. 2014-04-08 21:32:29 +01:00
bc.h py: Implement support for generalized generator protocol. 2014-03-30 23:30:16 +03:00
binary.c py: Clean up includes. 2014-03-17 02:43:40 -07:00
binary.h ffi: Implement ffivar.get()/set() methods. 2014-02-14 20:38:35 +02:00
builtin.c py: Revert mp_load_attr() to its previous state (not supporting default val). 2014-04-06 02:15:23 +03:00
builtin.h py: Implement globals() and locals() builtins. 2014-04-06 01:01:36 +03:00
builtinevex.c py: Add option to compiler to specify default code emitter. 2014-04-06 11:48:15 +01:00
builtinimport.c py: Add option to compiler to specify default code emitter. 2014-04-06 11:48:15 +01:00
builtintables.c py: Make bytearray a proper type. 2014-04-08 22:11:40 +03:00
builtintables.h py: Make globals and locals proper dictionary objects. 2014-04-05 22:36:42 +01:00
compile.c py: implement UNPACK_EX byte code (for: a, *b, c = d) 2014-04-08 17:51:47 +01:00
compile.h py: Add option to compiler to specify default code emitter. 2014-04-06 11:48:15 +01:00
emit.h py: Move to Python 3.4.0 compatibility. 2014-04-02 15:56:31 +01:00
emitbc.c py: Remove DELETE_SUBSCR opcode, combine with STORE_SUBSCR. 2014-04-08 21:32:29 +01:00
emitcommon.c py: Clean up includes. 2014-03-17 02:43:40 -07:00
emitcpy.c py: Move to Python 3.4.0 compatibility. 2014-04-02 15:56:31 +01:00
emitglue.c py: Implement more features in native emitter. 2014-04-06 12:58:40 +01:00
emitglue.h py: Free unique_code slot for outer module. 2014-03-29 11:39:36 +00:00
emitinlinethumb.c py: Improve inline assembler; add a few more opcodes. 2014-04-08 18:28:33 +01:00
emitnative.c py: Implement more features in native emitter. 2014-04-06 12:58:40 +01:00
emitpass1.c py: Move to Python 3.4.0 compatibility. 2014-04-02 15:56:31 +01:00
formatfloat.c Enhance str.format support 2014-04-01 01:17:33 -07:00
formatfloat.h Rename formatfloat file; remove MICROPY_ENABLE_FLOAT from mpconfigport.h. 2014-03-10 13:27:02 +00:00
gc.c py: Improve GC locking/unlocking, and make it part of the API. 2014-04-08 11:31:21 +00:00
gc.h py: Improve GC locking/unlocking, and make it part of the API. 2014-04-08 11:31:21 +00:00
grammar.h Clean up handling of function return type annotation. 2014-02-10 02:04:26 +02:00
lexer.c py: Clean up includes. 2014-03-17 02:43:40 -07:00
lexer.h Search paths properly on import and execute __init__.py if it exists. 2014-02-05 23:57:48 +00:00
lexerstr.c py: Clean up includes. 2014-03-17 02:43:40 -07:00
lexerunix.c py: Clean up includes. 2014-03-17 02:43:40 -07:00
lexerunix.h Move lexerstr to main py directory (everyone uses it). 2014-01-08 15:28:26 +00:00
makeqstrdata.py py: Replace naive and teribble hash function with djb2. 2014-03-25 15:27:15 +00:00
malloc.c Improve GC finalisation code; add option to disable it. 2014-04-05 20:35:48 +01:00
map.c py: Revert revert for allocation policy of set hash table. 2014-04-07 01:16:17 +01:00
misc.h Improve GC finalisation code; add option to disable it. 2014-04-05 20:35:48 +01:00
mkenv.mk Replace some Makefile commands with variables in py/mkenv.mk 2014-04-07 01:35:45 +01:00
mkrules.mk Replace some Makefile commands with variables in py/mkenv.mk 2014-04-07 01:35:45 +01:00
modarray.c py: Change module globals from mp_map_t* to mp_obj_dict_t*. 2014-04-05 21:53:54 +01:00
modcollections.c py: Change module globals from mp_map_t* to mp_obj_dict_t*. 2014-04-05 21:53:54 +01:00
modio.c py: Change module globals from mp_map_t* to mp_obj_dict_t*. 2014-04-05 21:53:54 +01:00
modmath.c py: Change module globals from mp_map_t* to mp_obj_dict_t*. 2014-04-05 21:53:54 +01:00
modmicropython.c py: Change module globals from mp_map_t* to mp_obj_dict_t*. 2014-04-05 21:53:54 +01:00
mpconfig.h Improve GC finalisation code; add option to disable it. 2014-04-05 20:35:48 +01:00
mpz.c py: Add comment mpz function, and free memory used for string printing. 2014-04-08 23:11:00 +01:00
mpz.h Add string formatting support for longlong and mpz. 2014-04-07 11:38:45 -07:00
nlr.h Add a check for NULL nlr_top in nlr_jump. 2014-04-08 14:08:14 +00:00
nlrthumb.S Add a check for NULL nlr_top in nlr_jump. 2014-04-08 14:08:14 +00:00
nlrx64.S Add a check for NULL nlr_top in nlr_jump. 2014-04-08 14:08:14 +00:00
nlrx86.S Add a check for NULL nlr_top in nlr_jump. 2014-04-08 14:08:14 +00:00
obj.c py: Add mp_get_buffer(), mp_get_buffer_raise() convenience functions to API. 2014-04-09 01:07:37 +03:00
obj.h py: Add mp_get_buffer(), mp_get_buffer_raise() convenience functions to API. 2014-04-09 01:07:37 +03:00
objarray.c py: Remove DELETE_SUBSCR opcode, combine with STORE_SUBSCR. 2014-04-08 21:32:29 +01:00
objarray.h py: Make bytearray a proper type. 2014-04-08 22:11:40 +03:00
objbool.c py: Change nlr_jump to nlr_raise, to aid in debugging. 2014-04-05 18:32:08 +01:00
objboundmeth.c Rename rt_* to mp_*. 2014-03-30 13:35:08 +01:00
objcell.c py: Change module globals from mp_map_t* to mp_obj_dict_t*. 2014-04-05 21:53:54 +01:00
objclosure.c Rename rt_* to mp_*. 2014-03-30 13:35:08 +01:00
objcomplex.c py: Change nlr_jump to nlr_raise, to aid in debugging. 2014-04-05 18:32:08 +01:00
objdict.c py: Remove DELETE_SUBSCR opcode, combine with STORE_SUBSCR. 2014-04-08 21:32:29 +01:00
objenumerate.c Rename rt_* to mp_*. 2014-03-30 13:35:08 +01:00
objexcept.c py: Change nlr_jump to nlr_raise, to aid in debugging. 2014-04-05 18:32:08 +01:00
objfilter.c py: Change nlr_jump to nlr_raise, to aid in debugging. 2014-04-05 18:32:08 +01:00
objfloat.c py: Fix float printing on stmhal. 2014-04-05 20:51:29 +01:00
objfun.c py: Make globals and locals proper dictionary objects. 2014-04-05 22:36:42 +01:00
objgenerator.c py: Change nlr_jump to nlr_raise, to aid in debugging. 2014-04-05 18:32:08 +01:00
objgenerator.h py: Swap around the double return value of mp_obj_gen_resume. 2014-03-26 19:33:23 +00:00
objgetitemiter.c py: Change nlr_jump to nlr_raise, to aid in debugging. 2014-04-05 18:32:08 +01:00
objint_longlong.c py: Make it so that printing a small int does not allocate heap memory. 2014-04-08 23:30:46 +01:00
objint_mpz.c py: Make it so that printing a small int does not allocate heap memory. 2014-04-08 23:30:46 +01:00
objint.c py: Make it so that printing a small int does not allocate heap memory. 2014-04-08 23:30:46 +01:00
objint.h py: Make it so that printing a small int does not allocate heap memory. 2014-04-08 23:30:46 +01:00
objlist.c py: Remove DELETE_SUBSCR opcode, combine with STORE_SUBSCR. 2014-04-08 21:32:29 +01:00
objmap.c py: Change nlr_jump to nlr_raise, to aid in debugging. 2014-04-05 18:32:08 +01:00
objmodule.c py: Finish implementation of all del opcodes. 2014-04-08 21:11:49 +01:00
objmodule.h Proper support for registering builtin modules in ROM. 2014-03-25 14:18:18 +00:00
objnamedtuple.c py: Change nlr_jump to nlr_raise, to aid in debugging. 2014-04-05 18:32:08 +01:00
objnone.c Rename rt_* to mp_*. 2014-03-30 13:35:08 +01:00
objobject.c py: Make all objects and instances derive from object. 2014-04-05 22:45:23 +01:00
objrange.c py: Fix "TypeError: 'iterator' object is not iterable", doh. 2014-03-30 23:37:24 +03:00
objset.c objset: Fix incorrect workaround against mp_set_init() munging alloc size. 2014-04-07 03:08:46 +03:00
objslice.c py: Rename old const type objects to mp_type_* for consistency. 2014-03-29 13:43:38 +00:00
objstr.c bytes: Support buffer protocol. 2014-04-08 19:08:34 +03:00
objtuple.c py: Change nlr_jump to nlr_raise, to aid in debugging. 2014-04-05 18:32:08 +01:00
objtuple.h namedtuple: Inherit unary/binary ops from tuple base class. 2014-03-03 11:42:53 +08:00
objtype.c py: Remove DELETE_SUBSCR opcode, combine with STORE_SUBSCR. 2014-04-08 21:32:29 +01:00
objzip.c objzip: Use mp_identity(). 2014-03-30 23:30:15 +03:00
parse.c py: Clean up includes. 2014-03-17 02:43:40 -07:00
parse.h py: Put number parsing code together in parsenum.c. 2014-02-22 18:12:43 +00:00
parsehelper.c Implement proper exception type hierarchy. 2014-02-15 16:10:44 +00:00
parsehelper.h Implement proper exception type hierarchy. 2014-02-15 16:10:44 +00:00
parsenum.c py: Change nlr_jump to nlr_raise, to aid in debugging. 2014-04-05 18:32:08 +01:00
parsenum.h py: Allow 'complex()' to take a string as first argument. 2014-03-21 11:45:46 +00:00
parsenumbase.c py: Implement bit-shift and not operations for mpz. 2014-03-01 19:50:50 +00:00
parsenumbase.h py: Implement bit-shift and not operations for mpz. 2014-03-01 19:50:50 +00:00
pfenv.c py: Reinstate old pfenv_print_int function for stmhal's printf. 2014-04-08 22:10:37 +01:00
pfenv.h py: Reinstate old pfenv_print_int function for stmhal's printf. 2014-04-08 22:10:37 +01:00
py-version.sh Add the git version to the banner 2014-04-03 16:55:15 -07:00
py.mk Replace some Makefile commands with variables in py/mkenv.mk 2014-04-07 01:35:45 +01:00
qstr.c py: Replace naive and teribble hash function with djb2. 2014-03-25 15:27:15 +00:00
qstr.h Add qstr_info() function and bindings for unix port. 2014-01-29 18:56:46 +00:00
qstrdefs.h objint: Implement int.from_bytes() class method and .to_bytes() method. 2014-04-09 01:07:37 +03:00
repl.c py: Continue line if last character is backslash. 2014-04-08 11:33:28 +00:00
repl.h Improve REPL detecting when input needs to continue. 2014-04-08 11:04:29 +00:00
runtime0.h py: Implement more features in native emitter. 2014-04-06 12:58:40 +01:00
runtime.c py: Remove DELETE_SUBSCR opcode, combine with STORE_SUBSCR. 2014-04-08 21:32:29 +01:00
runtime.h py: Remove obsolete mp_delete_subscr declaration. 2014-04-08 22:06:31 +01:00
scope.c py: Clean up includes. 2014-03-17 02:43:40 -07:00
scope.h py: Calculate maximum exception stack size in compiler. 2014-03-27 10:55:21 +00:00
sequence.c py: Change nlr_jump to nlr_raise, to aid in debugging. 2014-04-05 18:32:08 +01:00
showbc.c py: Finish implementation of all del opcodes. 2014-04-08 21:11:49 +01:00
smallint.c py: This time, real proper overflow checking of small int power. 2014-04-04 11:13:51 +00:00
smallint.h py: This time, real proper overflow checking of small int power. 2014-04-04 11:13:51 +00:00
stream.c py: Replace stream_p with *stream_p in mp_obj_type_t. 2014-04-05 23:02:23 +01:00
stream.h stream: Add generic unbuffered iternext method. 2014-01-20 18:42:08 +02:00
unicode.c Replace global "static" -> "STATIC", to allow "analysis builds". Part 2. 2014-02-12 18:31:30 +02:00
vm.c py: Remove DELETE_SUBSCR opcode, combine with STORE_SUBSCR. 2014-04-08 21:32:29 +01:00
vstr.c py: Fix vstr_init for case that alloc = 0. 2014-03-31 17:10:59 +01:00