The embedded 40250 script layer needs its own interpreter on five platforms. 2.7 is end-of-life, so nothing can be fetched from the target SDKs and the source is vendored (official 2.7.18 tarball, trimmed to 25MB; Lib/ stays for step 3's python27.zip). cpython-2.7.18/CMakeLists.txt builds one `mtpython` static library from exactly the 133 objects the reference libpython2.7.a contains, off by default behind -DMTGODOT_EMBED_PYTHON=ON. The source list and the built-in module table (config/config.c, 39 entries) are shared; pyconfig.h is a probe result and is not, so each platform keeps its own under config/<platform>/, regenerated by tools/py_embed/gen_pyconfig.sh and checked against the shared table. Three vendor patches, documented in docs/THIRD-PARTY.md: configure/configure.ac learn arm64 on macOS, and posixmodule.c undefines the process-control calls it hard-defines past pyconfig.h when building for iOS. macOS (ctest python.embed: every builtin imports, codecs and pickle work off the vendored Lib/), Android arm64 and iOS arm64 build. Linux needs a Linux host and Windows needs a MinGW-vs-MSVC decision; both are noted for step 4. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
44 lines
2.3 KiB
C
44 lines
2.3 KiB
C
/* These routines may be quite inefficient, but it's used only to emulate old
|
|
* standards. */
|
|
|
|
#ifndef EMULATE_JISX0213_2000_ENCODE_INVALID
|
|
#define EMULATE_JISX0213_2000_ENCODE_INVALID 1
|
|
#endif
|
|
|
|
#define EMULATE_JISX0213_2000_ENCODE_BMP(assi, c) \
|
|
if (config == (void *)2000 && ( \
|
|
(c) == 0x9B1C || (c) == 0x4FF1 || \
|
|
(c) == 0x525D || (c) == 0x541E || \
|
|
(c) == 0x5653 || (c) == 0x59F8 || \
|
|
(c) == 0x5C5B || (c) == 0x5E77 || \
|
|
(c) == 0x7626 || (c) == 0x7E6B)) \
|
|
return EMULATE_JISX0213_2000_ENCODE_INVALID; \
|
|
else if (config == (void *)2000 && (c) == 0x9B1D) \
|
|
(assi) = 0x8000 | 0x7d3b; \
|
|
|
|
#define EMULATE_JISX0213_2000_ENCODE_EMP(assi, c) \
|
|
if (config == (void *)2000 && (c) == 0x20B9F) \
|
|
return EMULATE_JISX0213_2000_ENCODE_INVALID;
|
|
|
|
#ifndef EMULATE_JISX0213_2000_DECODE_INVALID
|
|
#define EMULATE_JISX0213_2000_DECODE_INVALID 2
|
|
#endif
|
|
|
|
#define EMULATE_JISX0213_2000_DECODE_PLANE1(assi, c1, c2) \
|
|
if (config == (void *)2000 && \
|
|
(((c1) == 0x2E && (c2) == 0x21) || \
|
|
((c1) == 0x2F && (c2) == 0x7E) || \
|
|
((c1) == 0x4F && (c2) == 0x54) || \
|
|
((c1) == 0x4F && (c2) == 0x7E) || \
|
|
((c1) == 0x74 && (c2) == 0x27) || \
|
|
((c1) == 0x7E && (c2) == 0x7A) || \
|
|
((c1) == 0x7E && (c2) == 0x7B) || \
|
|
((c1) == 0x7E && (c2) == 0x7C) || \
|
|
((c1) == 0x7E && (c2) == 0x7D) || \
|
|
((c1) == 0x7E && (c2) == 0x7E))) \
|
|
return EMULATE_JISX0213_2000_DECODE_INVALID;
|
|
|
|
#define EMULATE_JISX0213_2000_DECODE_PLANE2(assi, c1, c2) \
|
|
if (config == (void *)2000 && (c1) == 0x7D && (c2) == 0x3B) \
|
|
(assi) = 0x9B1D;
|