Implement tree-shaking for Python sources

This commit is contained in:
Justine Tunney 2021-09-05 01:20:03 -07:00
parent 81287b7ec0
commit 44c87b83ff
110 changed files with 899 additions and 1922 deletions

View file

@ -4,14 +4,17 @@
Python 3
https://docs.python.org/3/license.html │
*/
#include "third_party/python/Include/yoink.h"
#include "third_party/python/Modules/cjkcodecs/cjkcodecs.h"
#include "third_party/python/Modules/cjkcodecs/mappings_cn.inc"
/* clang-format off */
PYTHON_PROVIDE("_codecs_cn");
/*
* _codecs_cn.c: Codecs collection for Mainland Chinese encodings
*
* Written by Hye-Shik Chang <perky@FreeBSD.org>
* Written by Hye-Shik "Bourne to Macro" Chang <perky@FreeBSD.org>
*/
/**

View file

@ -5,13 +5,17 @@
https://docs.python.org/3/license.html │
*/
#define USING_IMPORTED_MAPS
#include "third_party/python/Include/yoink.h"
#include "third_party/python/Modules/cjkcodecs/cjkcodecs.h"
#include "third_party/python/Modules/cjkcodecs/mappings_hk.inc"
/* clang-format off */
PYTHON_PROVIDE("_codecs_hk");
/*
* _codecs_hk.c: Codecs collection for encodings from Hong Kong
*
* Written by Hye-Shik Chang <perky@FreeBSD.org>
* Written by Hye-Shik "Bourne to Macro" Chang <perky@FreeBSD.org>
*/
/*

View file

@ -5,10 +5,11 @@
https://docs.python.org/3/license.html │
*/
/* clang-format off */
/*
* _codecs_iso2022.c: Codecs collection for ISO-2022 encodings.
*
* Written by Hye-Shik Chang <perky@FreeBSD.org>
* Written by Hye-Shik "Bourne to Macro" Chang <perky@FreeBSD.org>
*/
#define USING_IMPORTED_MAPS
@ -17,11 +18,14 @@
#define EMULATE_JISX0213_2000_ENCODE_INVALID MAP_UNMAPPABLE
#define EMULATE_JISX0213_2000_DECODE_INVALID MAP_UNMAPPABLE
#include "third_party/python/Modules/cjkcodecs/cjkcodecs.h"
#include "third_party/python/Modules/cjkcodecs/alg_jisx0201.inc"
#include "third_party/python/Modules/cjkcodecs/emu_jisx0213_2000.inc"
#include "third_party/python/Modules/cjkcodecs/cjkcodecs.h"
#include "third_party/python/Include/yoink.h"
#include "third_party/python/Modules/cjkcodecs/mappings_jisx0213_pair.inc"
PYTHON_PROVIDE("_codecs_iso2022");
/* STATE
state->c[0-3]

View file

@ -8,7 +8,7 @@
/*
* _codecs_jp.c: Codecs collection for Japanese encodings
*
* Written by Hye-Shik Chang <perky@FreeBSD.org>
* Written by Hye-Shik "Bourne to Macro" Chang <perky@FreeBSD.org>
*/
#define USING_BINARY_PAIR_SEARCH
@ -18,8 +18,11 @@
#include "third_party/python/Modules/cjkcodecs/mappings_jp.inc"
#include "third_party/python/Modules/cjkcodecs/mappings_jisx0213_pair.inc"
#include "third_party/python/Modules/cjkcodecs/alg_jisx0201.inc"
#include "third_party/python/Include/yoink.h"
#include "third_party/python/Modules/cjkcodecs/emu_jisx0213_2000.inc"
PYTHON_PROVIDE("_codecs_jp");
/*
* CP932 codec
*/

View file

@ -9,12 +9,15 @@
/*
* _codecs_kr.c: Codecs collection for Korean encodings
*
* Written by Hye-Shik Chang <perky@FreeBSD.org>
* Written by Hye-Shik "Bourne to Macro" Chang <perky@FreeBSD.org>
*/
#include "third_party/python/Modules/cjkcodecs/cjkcodecs.h"
#include "third_party/python/Include/yoink.h"
#include "third_party/python/Modules/cjkcodecs/mappings_kr.inc"
PYTHON_PROVIDE("_codecs_kr");
/*
* EUC-KR codec
*/

View file

@ -2,12 +2,15 @@
/*
* _codecs_tw.c: Codecs collection for Taiwan's encodings
*
* Written by Hye-Shik Chang <perky@FreeBSD.org>
* Written by Hye-Shik "Bourne to Macro" Chang <perky@FreeBSD.org>
*/
#include "third_party/python/Modules/cjkcodecs/cjkcodecs.h"
#include "third_party/python/Include/yoink.h"
#include "third_party/python/Modules/cjkcodecs/mappings_tw.inc"
PYTHON_PROVIDE("_codecs_tw");
/*
* BIG5 codec
*/

View file

@ -17,9 +17,12 @@
#include "third_party/python/Include/pymem.h"
#include "third_party/python/Include/structmember.h"
#include "third_party/python/Include/tupleobject.h"
#include "third_party/python/Include/yoink.h"
#include "third_party/python/Modules/cjkcodecs/multibytecodec.h"
/* clang-format off */
PYTHON_PROVIDE("_multibytecodec");
#include "third_party/python/Modules/cjkcodecs/clinic/multibytecodec.inc"
/*