circuitpython/py
Jeff Epler e06a3bbceb translation: Compress as unicode, not bytes
By treating each unicode code-point as a single entity for huffman
compression, the overall compression rate can be somewhat improved
without changing the algorithm.  On the decompression side, when
compressed values above 127 are encountered, they need to be
converted from a 16-bit Unicode code point into a UTF-8 byte
sequence.

Doing this returns approximately 1.5kB of flash storage with the
zh_Latn_pinyin translation. (292 -> 1768 bytes remaining in my build
of trinket_m0)

Other "more ASCII" translations benefit less, and in fact
zh_Latn_pinyin is no longer the most constrained translation!
(de_DE 1156 -> 1384 bytes free in flash, I didn't check others
before pushing for CI)

English is slightly pessimized, 2840 -> 2788 bytes, probably mostly
because the "values" array was changed from uint8_t to uint16_t,
which is strictly not required for an all-ASCII translation.  This
could probably be avoided in this case, but as English is not the
most constrained translation it doesn't really matter.

Testing performed: built for feather nRF52840 express and trinket m0
in English and zh_Latn_pinyin; ran and verified the localized
messages such as
    Àn xià rènhé jiàn jìnrù REPL. Shǐyòng CTRL-D chóngxīn jiāzài.
and
    Press any key to enter the REPL. Use CTRL-D to reload.
were properly displayed.
2019-12-02 09:46:46 -06:00
..
argcheck.c py changes for supporting superclass constructors that take kwargs 2019-01-14 17:29:19 -08:00
asmarm.c py/asm*.c: Remove unnecessary check for num_locals<0 in asm entry func. 2018-02-24 23:10:20 +11:00
asmarm.h continued WIP: almost compiling 2018-07-12 14:13:51 -04:00
asmbase.c py/asmbase: Revert removal of clearing of label offsets for native emit. 2017-12-08 19:07:00 +11:00
asmbase.h py/asm: Remove need for dummy_data when doing initial assembler passes. 2016-12-09 22:50:58 +11:00
asmthumb.c py/asm*.c: Remove unnecessary check for num_locals<0 in asm entry func. 2018-02-24 23:10:20 +11:00
asmthumb.h continued WIP: almost compiling 2018-07-12 14:13:51 -04:00
asmx64.c py/asm*.c: Remove unnecessary check for num_locals<0 in asm entry func. 2018-02-24 23:10:20 +11:00
asmx64.h continued WIP: almost compiling 2018-07-12 14:13:51 -04:00
asmx86.c py/asm*.c: Remove unnecessary check for num_locals<0 in asm entry func. 2018-02-24 23:10:20 +11:00
asmx86.h WIP: complete manual inspection of all significant changes 2018-07-23 21:34:25 -04:00
asmxtensa.c py/asm: Remove need for dummy_data when doing initial assembler passes. 2016-12-09 22:50:58 +11:00
asmxtensa.h continued WIP: almost compiling 2018-07-12 14:13:51 -04:00
bc.c Two fixes and translate more strings. 2018-08-09 13:29:30 -07:00
bc.h all: Remove inclusion of internal py header files. 2017-10-04 12:37:50 +11:00
bc0.h py: Clean up unary and binary enum list to keep groups together. 2017-10-05 10:49:44 +11:00
binary.c mp_binary_get_int: avoid undefined behavior 2019-10-08 10:48:25 +09:00
binary.h py/binary: Change internal bytearray typecode from 0 to 1. 2017-08-17 16:19:35 +10:00
builtin.h py/builtinhelp: Change signature of help text var from pointer to array. 2017-09-12 16:03:52 +10:00
builtinevex.c Two fixes and translate more strings. 2018-08-09 13:29:30 -07:00
builtinhelp.c Fix output overflow and make help translatable 2018-11-09 16:41:08 -08:00
builtinimport.c modsys: exc_info: Add traceback 2018-10-07 19:37:49 +02:00
circuitpy_defns.mk Refine _bleio 2019-10-21 18:57:03 -07:00
circuitpy_mpconfig.h Allow boards to enable the `micropython.native` decorator 2019-11-05 14:27:53 -08:00
circuitpy_mpconfig.mk Merge remote-tracking branch 'adafruit/master' into testing-fixes 2019-11-22 11:55:34 -05:00
compile.c Make the @micropython.native decorator no-op if support isn't enabled 2019-11-26 13:09:30 -08:00
compile.h all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
emit.h py/emit: Combine setup with/except/finally into one emit function. 2018-05-23 00:35:16 +10:00
emitbc.c py/emit: Combine setup with/except/finally into one emit function. 2018-05-23 00:35:16 +10:00
emitcommon.c py/emit: Combine name and global into one func for load/store/delete. 2018-05-23 00:22:47 +10:00
emitglue.c Validate raw code and mpy read length 2019-06-25 17:54:27 -07:00
emitglue.h py/emitglue: When assigning bytecode only pass bytecode len if needed. 2018-02-14 18:41:17 +11:00
emitinlinethumb.c fix compilation errors in emitinlinethumb.c 2018-10-07 02:09:44 +03:00
emitinlinextensa.c Fix esp and samd 2018-08-16 17:41:35 -07:00
emitnarm.c py: Refactor how native emitter code is compiled with a file per arch. 2018-04-10 15:06:47 +10:00
emitnative.c Allow boards to enable the `micropython.native` decorator 2019-11-05 14:27:53 -08:00
emitnthumb.c py: Refactor how native emitter code is compiled with a file per arch. 2018-04-10 15:06:47 +10:00
emitnx64.c py: Refactor how native emitter code is compiled with a file per arch. 2018-04-10 15:06:47 +10:00
emitnx86.c py/emitnx86: Fix 32-bit x86 native emitter build by including header. 2018-05-04 20:39:16 +10:00
emitnxtensa.c py: Refactor how native emitter code is compiled with a file per arch. 2018-04-10 15:06:47 +10:00
formatfloat.c py/formatfloat: Fix case where floats could render with negative digits. 2018-03-01 17:00:02 +11:00
formatfloat.h all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
frozenmod.c merge finished 2018-07-28 13:29:47 -04:00
frozenmod.h Fix issue #207, esp8266 file operations problems (#222) 2017-09-01 16:12:26 -04:00
gc.c * only make objects long lived if they are on the GC heap 2019-11-22 13:47:13 -05:00
gc.h * only make objects long lived if they are on the GC heap 2019-11-22 13:47:13 -05:00
gc_long_lived.c * only make objects long lived if they are on the GC heap 2019-11-22 13:47:13 -05:00
gc_long_lived.h Introduce a long lived section of the heap. 2018-01-24 10:33:46 -08:00
grammar.h py/compile: Combine expr, xor_expr and and_expr into one function. 2018-06-22 17:00:29 +10:00
ioctl.h Initial merge of micropython v1.9.2 into circuitpython 2.0.0 (in development) master. 2017-08-25 22:17:07 -04:00
lexer.c Two fixes and translate more strings. 2018-08-09 13:29:30 -07:00
lexer.h all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
makemoduledefs.py Add files via upload 2019-04-05 21:38:32 +02:00
makeqstrdata.py translation: Compress as unicode, not bytes 2019-12-02 09:46:46 -06:00
makeqstrdefs.py Update filter and handle nested quotes 2018-08-09 14:16:28 -07:00
makeversionhdr.py Support internationalisation. 2018-08-07 14:58:57 -07:00
malloc.c WIP: after merge; before testing 2018-07-11 16:45:30 -04:00
map.c py/map: Don't include ordered-dict mutating code when not needed. 2017-12-19 13:37:15 +11:00
misc.h WIP: after merge; before testing 2018-07-11 16:45:30 -04:00
mkenv.mk Use python3 for mpy-tool 2018-10-18 10:37:42 -07:00
mkrules.mk Update mkrules.mk 2019-04-05 21:41:40 +02:00
modarray.c all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
modbuiltins.c Enable MICROPY_PY_BUILTINS_ROUND_INT; make round() work beter when it's disabled as well 2019-05-17 15:56:40 -04:00
modcmath.c py: Change obsolete "///" comment formatting to normal comments. 2017-08-30 21:02:00 +10:00
modcollections.c WIP: after merge; before testing 2018-07-11 16:45:30 -04:00
modgc.c py: Change obsolete "///" comment formatting to normal comments. 2017-08-30 21:02:00 +10:00
modio.c More make_new updates 2019-01-18 17:09:56 -08:00
modmath.c Two fixes and translate more strings. 2018-08-09 13:29:30 -07:00
modmicropython.c Two fixes and translate more strings. 2018-08-09 13:29:30 -07:00
modstruct.c Improve struct compatibility with CPython 2019-01-20 15:12:34 -05:00
modsys.c modsys: exc_info: Add traceback 2018-10-07 19:37:49 +02:00
modthread.c Two fixes and translate more strings. 2018-08-09 13:29:30 -07:00
moduerrno.c Add CIRCUITPY macro; rename u* only when CIRCUITPY=1 2019-02-21 11:09:44 -05:00
mpconfig.h Add CIRCUITPY macro; rename u* only when CIRCUITPY=1 2019-02-21 11:09:44 -05:00
mperrno.h Support OSError attributes 2018-11-13 22:04:44 +01:00
mphal.h all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
mpprint.c py/mpprint: Fix "%x" vs "%X" regression introduced in previous commit. 2017-12-07 10:31:14 +02:00
mpprint.h all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
mpstate.c all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
mpstate.h Reorganize board busses into shared-bindings and shared-module. 2019-04-08 16:58:50 -07:00
mpthread.h all: Unify header guard usage. 2017-07-18 11:57:39 +10:00
mpz.c py/mpz: Avoid undefined behavior at integer overflow in mpz_hash. 2018-05-21 12:48:26 +10:00
mpz.h py/mpz: Simplify handling of borrow and quo adjustment in mpn_div. 2017-12-29 14:05:48 +11:00
nativeglue.c py/emit: Merge build set/slice into existing build emit function. 2018-05-23 00:23:36 +10:00
nlr.c continued WIP: almost compiling 2018-07-12 14:13:51 -04:00
nlr.h restructure nlr.h for udefined archtectures 2019-10-14 07:02:32 -04:00
nlrsetjmp.c py/nlr: Factor out common NLR code to macro and generic funcs in nlr.c. 2017-12-28 16:46:30 +11:00
nlrthumb.c WIP: after merge; before testing 2018-07-11 16:45:30 -04:00
nlrx64.c continued WIP: almost compiling 2018-07-12 14:13:51 -04:00
nlrx86.c continued WIP: almost compiling 2018-07-12 14:13:51 -04:00
nlrxtensa.c continued WIP: almost compiling 2018-07-12 14:13:51 -04:00
obj.c In py/, must guard uses of RUN_BACKGROUND_TASKS 2019-09-11 21:15:10 -05:00
obj.h bleio: API change to create and connect related objects simulatenously: no orphan bleio objects 2019-08-28 16:15:09 -04:00
objarray.c py changes for supporting superclass constructors that take kwargs 2019-01-14 17:29:19 -08:00
objarray.h py/objarray: Replace 0x80 with new MP_OBJ_ARRAY_TYPECODE_FLAG_RW macro. 2018-06-18 13:40:53 +10:00
objattrtuple.c all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
objbool.c py changes for supporting superclass constructors that take kwargs 2019-01-14 17:29:19 -08:00
objboundmeth.c py/objboundmeth: Support __func__ property as in CPython 2018-10-07 19:36:24 +02:00
objcell.c all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
objclosure.c all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
objcomplex.c py changes for supporting superclass constructors that take kwargs 2019-01-14 17:29:19 -08:00
objdeque.c More make_new fixes for unix build 2019-01-18 11:53:09 -08:00
objdict.c Fix dict_make_new 2019-01-20 17:32:43 -08:00
objenumerate.c fixup micropy 2019-01-14 18:09:02 -08:00
objexcept.c Make MpyError a ValueError (since that's what it was before) 2019-05-08 13:58:31 -07:00
objexcept.h py/objexcept: Make MP_DEFINE_EXCEPTION public so ports can define excs. 2018-03-17 00:31:40 +11:00
objfilter.c py changes for supporting superclass constructors that take kwargs 2019-01-14 17:29:19 -08:00
objfloat.c py changes for supporting superclass constructors that take kwargs 2019-01-14 17:29:19 -08:00
objfun.c Fix bad call to mp_arg_check_num 2019-11-05 17:49:47 -08:00
objfun.h all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
objgenerator.c Two fixes and translate more strings. 2018-08-09 13:29:30 -07:00
objgenerator.h all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
objgetitemiter.c all: Remove inclusion of internal py header files. 2017-10-04 12:37:50 +11:00
objint.c use approx of original @godlygeek code for smallints; add tests 2019-05-12 11:17:29 -04:00
objint.h Handle truth values; speed up smallint checks 2019-05-12 00:10:53 -04:00
objint_longlong.c Two fixes and translate more strings. 2018-08-09 13:29:30 -07:00
objint_mpz.c Two fixes and translate more strings. 2018-08-09 13:29:30 -07:00
objlist.c WIP: rework of Characteristic properties; enhance Descriptor; not tested 2019-08-02 17:57:31 -04:00
objlist.h py/obj.h: Move declaration of mp_obj_list_init to objlist.h. 2018-03-13 14:03:15 +11:00
objmap.c py changes for supporting superclass constructors that take kwargs 2019-01-14 17:29:19 -08:00
objmodule.c Update objmodule.c 2019-04-05 21:40:28 +02:00
objmodule.h py/objmodule: Factor common code for calling __init__ on builtin module. 2018-02-20 17:56:58 +11:00
objnamedtuple.c Check for null kw_args 2019-01-20 16:18:34 -08:00
objnamedtuple.h py changes for supporting superclass constructors that take kwargs 2019-01-14 17:29:19 -08:00
objnone.c all: Remove inclusion of internal py header files. 2017-10-04 12:37:50 +11:00
objobject.c py changes for supporting superclass constructors that take kwargs 2019-01-14 17:29:19 -08:00
objpolyiter.c all: Remove inclusion of internal py header files. 2017-10-04 12:37:50 +11:00
objproperty.c py changes for supporting superclass constructors that take kwargs 2019-01-14 17:29:19 -08:00
objproperty.h Initial merge of micropython v1.9.2 into circuitpython 2.0.0 (in development) master. 2017-08-25 22:17:07 -04:00
objrange.c py changes for supporting superclass constructors that take kwargs 2019-01-14 17:29:19 -08:00
objreversed.c py changes for supporting superclass constructors that take kwargs 2019-01-14 17:29:19 -08:00
objset.c py changes for supporting superclass constructors that take kwargs 2019-01-14 17:29:19 -08:00
objsingleton.c all: Remove inclusion of internal py header files. 2017-10-04 12:37:50 +11:00
objslice.c py changes for supporting superclass constructors that take kwargs 2019-01-14 17:29:19 -08:00
objstr.c Switch arg check back to allow ignored args for strings 2019-10-14 19:59:23 -07:00
objstr.h cleanup adapter.address; add uniquish suffix to BLE device name 2019-07-31 00:30:24 -04:00
objstringio.c py changes for supporting superclass constructors that take kwargs 2019-01-14 17:29:19 -08:00
objstringio.h py/objstringio: If created from immutable object, follow copy on write policy. 2017-06-09 17:33:01 +03:00
objstrunicode.c extmod/ure: Support search/match() pos and endpos parameters 2019-02-14 15:42:28 +01:00
objtuple.c py: mp_obj_tuple_get: accept any item which can use tuple_getiter 2019-08-10 10:10:41 -05:00
objtuple.h WIP: works with just keyboard but not complex report descriptor 2018-03-30 23:24:00 -04:00
objtype.c mp_obj_instance_make_new: clearer way to avoid null pointer dereference 2019-10-10 13:25:24 +09:00
objtype.h Check native object in case of early access 2019-05-13 17:31:30 -07:00
objzip.c py changes for supporting superclass constructors that take kwargs 2019-01-14 17:29:19 -08:00
opmethods.c py/runtime: Add MP_BINARY_OP_CONTAINS as reverse of MP_BINARY_OP_IN. 2017-11-24 14:48:23 +11:00
parse.c Two fixes and translate more strings. 2018-08-09 13:29:30 -07:00
parse.h all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
parsenum.c Compress all translated strings with Huffman coding. 2018-08-16 17:40:57 -07:00
parsenum.h all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
parsenumbase.c all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
parsenumbase.h all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
persistentcode.c Validate raw code and mpy read length 2019-06-25 17:54:27 -07:00
persistentcode.h py: Factor out persistent-code reader into separate files. 2016-11-16 18:13:50 +11:00
py.mk Uncomment vm.c SUPEROPT (debugging typo); trim a few builds 2019-06-12 13:09:09 -04:00
pystack.c py/pystack: Use "pystack exhausted" as error msg for out of pystack mem. 2018-02-19 00:26:14 +11:00
pystack.h py: Introduce a Python stack for scoped allocation. 2017-12-11 13:49:09 +11:00
qstr.c Compress all translated strings with Huffman coding. 2018-08-16 17:40:57 -07:00
qstr.h Support internationalisation. 2018-08-07 14:58:57 -07:00
qstrdefs.h py/pystack: Use "pystack exhausted" as error msg for out of pystack mem. 2018-02-19 00:26:14 +11:00
reader.c py/reader: Allow MICROPY_VFS_POSIX to work with MICROPY_READER_POSIX. 2018-06-06 14:28:23 +10:00
reader.h py: Allow lexer to raise exceptions during construction. 2017-03-14 11:52:05 +11:00
reload.c move reload exception to reload.c 2018-05-14 17:41:17 -04:00
reload.h move reload exception to reload.c 2018-05-14 17:41:17 -04:00
repl.c Merge pull request #1859 from scottbelden/tabbing 2019-05-08 14:49:11 -04:00
repl.h all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
ringbuf.h Refine _bleio 2019-10-21 18:57:03 -07:00
runtime.c Use BluetoothError in _bleio 2019-11-20 14:02:15 -08:00
runtime.h Use OverflowError exception type for overflows 2019-05-09 03:22:26 -04:00
runtime0.h WIP: after merge; before testing 2018-07-11 16:45:30 -04:00
runtime_utils.c WIP: after merge; before testing 2018-07-11 16:45:30 -04:00
scheduler.c py: Add micropython.schedule() function and associated runtime code. 2017-03-20 15:20:26 +11:00
scope.c all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
scope.h all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
sequence.c Use generic overflow so 64 bit is handled ok. 2019-02-04 16:11:16 -08:00
showbc.c mp_bytecode_print_str: avoid undefined behavior 2019-10-08 11:16:11 +09:00
smallint.c all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
smallint.h py: Extend nan-boxing config to have 47-bit small integers. 2017-12-11 22:39:12 +11:00
stackctrl.c WIP: after merge; before testing 2018-07-11 16:45:30 -04:00
stackctrl.h Initial merge of micropython v1.9.2 into circuitpython 2.0.0 (in development) master. 2017-08-25 22:17:07 -04:00
stream.c In py/, must guard uses of RUN_BACKGROUND_TASKS 2019-09-11 21:15:10 -05:00
stream.h Support print("", flush=True) 2019-02-15 16:53:19 -08:00
unicode.c py/unicode: Clean up utf8 funcs and provide non-utf8 inline versions. 2018-02-14 18:19:22 +11:00
unicode.h py/objstr: Add check for valid UTF-8 when making a str from bytes. 2017-09-06 16:43:09 +10:00
vm.c Refine _bleio 2019-10-21 18:57:03 -07:00
vmentrytable.h Turn on MICROPY_OPT_COMPUTED_GOTO for 5x CPU-bound speedup 2019-06-11 12:43:48 -04:00
vstr.c py/vstr: Raise a RuntimeError if fixed vstr buffer overflows. 2017-09-21 20:29:41 +10:00
warning.c py: Add config option to print warnings/errors to stderr. 2017-09-26 11:59:11 +10:00