Skip to content

Commit 54a5878

Browse files
committed
WIP
1 parent acf350a commit 54a5878

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

py/misc.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,6 @@ typedef union _mp_float_union_t {
297297
// So leave MP_COMPRESSED_ROM_TEXT in place for makeqstrdefs.py / makecompresseddata.py to find them.
298298

299299
#else
300-
301300
// Compression enabled and doing a regular build.
302301
// Map MP_COMPRESSED_ROM_TEXT to the compressed strings.
303302

@@ -327,10 +326,9 @@ inline MP_ALWAYSINLINE const char *MP_COMPRESSED_ROM_TEXT(const char *msg) {
327326

328327
return msg;
329328
}
330-
331329
#endif
332330

333-
#elif CIRCUITPY
331+
#elif defined(CIRCUITPY)
334332
#include "supervisor/shared/translate/translate.h"
335333
#else
336334

@@ -339,6 +337,10 @@ inline MP_ALWAYSINLINE const char *MP_COMPRESSED_ROM_TEXT(const char *msg) {
339337
typedef const char *mp_rom_error_text_t;
340338
#define MP_COMPRESSED_ROM_TEXT(x) x
341339

342-
#endif // MICROPY_ROM_TEXT_COMPRESSION // CIRCUITPY
340+
#endif // MICROPY_ROM_TEXT_COMPRESSION
341+
342+
// Might add more types of compressed text in the future.
343+
// For now, forward directly to MP_COMPRESSED_ROM_TEXT.
344+
#define MP_ERROR_TEXT(x) (mp_rom_error_text_t)MP_COMPRESSED_ROM_TEXT(x)
343345

344346
#endif // MICROPY_INCLUDED_PY_MISC_H

supervisor/shared/translate/compressed_string.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@
9494
typedef struct compressed_string {
9595
uint8_t data;
9696
const uint8_t tail[];
97-
} mp_rom_error_text_t;
97+
} *mp_rom_error_text_t;
9898

9999
// Return the compressed, translated version of a source string
100100
// Usually, due to LTO, this is optimized into a load of a constant

supervisor/shared/translate/translate.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,7 @@
3333
#include "supervisor/shared/translate/compressed_string.h"
3434

3535
// Map MicroPython's error messages to our translations.
36-
#if !defined(MICROPY_ENABLE_DYNRUNTIME) || !MICROPY_ENABLE_DYNRUNTIME
37-
#define MP_ERROR_TEXT(x) translate(x)
38-
#endif
36+
#define MP_COMPRESSED_ROM_TEXT(x) translate(x)
3937

4038
// translate() is a giant function with many strcmp calls. The assumption is
4139
// that the build process will optimize this away and replace it with the

0 commit comments

Comments
 (0)