]> git.proxmox.com Git - mirror_edk2.git/blobdiff - AppPkg/Applications/Python/Python-2.7.10/Modules/cjkcodecs/_codecs_hk.c
edk2: Remove AppPkg, StdLib, StdLibPrivateInternalFiles
[mirror_edk2.git] / AppPkg / Applications / Python / Python-2.7.10 / Modules / cjkcodecs / _codecs_hk.c
diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/cjkcodecs/_codecs_hk.c b/AppPkg/Applications/Python/Python-2.7.10/Modules/cjkcodecs/_codecs_hk.c
deleted file mode 100644 (file)
index 5302b52..0000000
+++ /dev/null
@@ -1,184 +0,0 @@
-/*\r
- * _codecs_hk.c: Codecs collection for encodings from Hong Kong\r
- *\r
- * Written by Hye-Shik Chang <perky@FreeBSD.org>\r
- */\r
-\r
-#define USING_IMPORTED_MAPS\r
-\r
-#include "cjkcodecs.h"\r
-#include "mappings_hk.h"\r
-\r
-/*\r
- * BIG5HKSCS codec\r
- */\r
-\r
-static const encode_map *big5_encmap = NULL;\r
-static const decode_map *big5_decmap = NULL;\r
-\r
-CODEC_INIT(big5hkscs)\r
-{\r
-    static int initialized = 0;\r
-\r
-    if (!initialized && IMPORT_MAP(tw, big5, &big5_encmap, &big5_decmap))\r
-        return -1;\r
-    initialized = 1;\r
-    return 0;\r
-}\r
-\r
-/*\r
- * There are four possible pair unicode -> big5hkscs maps as in HKSCS 2004:\r
- *  U+00CA U+0304 -> 8862  (U+00CA alone is mapped to 8866)\r
- *  U+00CA U+030C -> 8864\r
- *  U+00EA U+0304 -> 88a3  (U+00EA alone is mapped to 88a7)\r
- *  U+00EA U+030C -> 88a5\r
- * These are handled by not mapping tables but a hand-written code.\r
- */\r
-static const DBCHAR big5hkscs_pairenc_table[4] = {0x8862, 0x8864, 0x88a3, 0x88a5};\r
-\r
-ENCODER(big5hkscs)\r
-{\r
-    while (inleft > 0) {\r
-        ucs4_t c = **inbuf;\r
-        DBCHAR code;\r
-        Py_ssize_t insize;\r
-\r
-        if (c < 0x80) {\r
-            REQUIRE_OUTBUF(1)\r
-            **outbuf = (unsigned char)c;\r
-            NEXT(1, 1)\r
-            continue;\r
-        }\r
-\r
-        DECODE_SURROGATE(c)\r
-        insize = GET_INSIZE(c);\r
-\r
-        REQUIRE_OUTBUF(2)\r
-\r
-        if (c < 0x10000) {\r
-            TRYMAP_ENC(big5hkscs_bmp, code, c) {\r
-                if (code == MULTIC) {\r
-                    if (inleft >= 2 &&\r
-                        ((c & 0xffdf) == 0x00ca) &&\r
-                        (((*inbuf)[1] & 0xfff7) == 0x0304)) {\r
-                        code = big5hkscs_pairenc_table[\r
-                            ((c >> 4) |\r
-                             ((*inbuf)[1] >> 3)) & 3];\r
-                        insize = 2;\r
-                    }\r
-                    else if (inleft < 2 &&\r
-                             !(flags & MBENC_FLUSH))\r
-                        return MBERR_TOOFEW;\r
-                    else {\r
-                        if (c == 0xca)\r
-                            code = 0x8866;\r
-                        else /* c == 0xea */\r
-                            code = 0x88a7;\r
-                    }\r
-                }\r
-            }\r
-            else TRYMAP_ENC(big5, code, c);\r
-            else return 1;\r
-        }\r
-        else if (c < 0x20000)\r
-            return insize;\r
-        else if (c < 0x30000) {\r
-            TRYMAP_ENC(big5hkscs_nonbmp, code, c & 0xffff);\r
-            else return insize;\r
-        }\r
-        else\r
-            return insize;\r
-\r
-        OUT1(code >> 8)\r
-        OUT2(code & 0xFF)\r
-        NEXT(insize, 2)\r
-    }\r
-\r
-    return 0;\r
-}\r
-\r
-#define BH2S(c1, c2) (((c1) - 0x87) * (0xfe - 0x40 + 1) + ((c2) - 0x40))\r
-\r
-DECODER(big5hkscs)\r
-{\r
-    while (inleft > 0) {\r
-        unsigned char c = IN1;\r
-        ucs4_t decoded;\r
-\r
-        REQUIRE_OUTBUF(1)\r
-\r
-        if (c < 0x80) {\r
-            OUT1(c)\r
-            NEXT(1, 1)\r
-            continue;\r
-        }\r
-\r
-        REQUIRE_INBUF(2)\r
-\r
-        if (0xc6 > c || c > 0xc8 || (c < 0xc7 && IN2 < 0xa1)) {\r
-            TRYMAP_DEC(big5, **outbuf, c, IN2) {\r
-                NEXT(2, 1)\r
-                continue;\r
-            }\r
-        }\r
-\r
-        TRYMAP_DEC(big5hkscs, decoded, c, IN2)\r
-        {\r
-            int s = BH2S(c, IN2);\r
-            const unsigned char *hintbase;\r
-\r
-            assert(0x87 <= c && c <= 0xfe);\r
-            assert(0x40 <= IN2 && IN2 <= 0xfe);\r
-\r
-            if (BH2S(0x87, 0x40) <= s && s <= BH2S(0xa0, 0xfe)) {\r
-                    hintbase = big5hkscs_phint_0;\r
-                    s -= BH2S(0x87, 0x40);\r
-            }\r
-            else if (BH2S(0xc6,0xa1) <= s && s <= BH2S(0xc8,0xfe)){\r
-                    hintbase = big5hkscs_phint_12130;\r
-                    s -= BH2S(0xc6, 0xa1);\r
-            }\r
-            else if (BH2S(0xf9,0xd6) <= s && s <= BH2S(0xfe,0xfe)){\r
-                    hintbase = big5hkscs_phint_21924;\r
-                    s -= BH2S(0xf9, 0xd6);\r
-            }\r
-            else\r
-                    return MBERR_INTERNAL;\r
-\r
-            if (hintbase[s >> 3] & (1 << (s & 7))) {\r
-                    WRITEUCS4(decoded | 0x20000)\r
-                    NEXT_IN(2)\r
-            }\r
-            else {\r
-                    OUT1(decoded)\r
-                    NEXT(2, 1)\r
-            }\r
-            continue;\r
-        }\r
-\r
-        switch ((c << 8) | IN2) {\r
-        case 0x8862: WRITE2(0x00ca, 0x0304); break;\r
-        case 0x8864: WRITE2(0x00ca, 0x030c); break;\r
-        case 0x88a3: WRITE2(0x00ea, 0x0304); break;\r
-        case 0x88a5: WRITE2(0x00ea, 0x030c); break;\r
-        default: return 2;\r
-        }\r
-\r
-        NEXT(2, 2) /* all decoded code points are pairs, above. */\r
-    }\r
-\r
-    return 0;\r
-}\r
-\r
-\r
-BEGIN_MAPPINGS_LIST\r
-  MAPPING_DECONLY(big5hkscs)\r
-  MAPPING_ENCONLY(big5hkscs_bmp)\r
-  MAPPING_ENCONLY(big5hkscs_nonbmp)\r
-END_MAPPINGS_LIST\r
-\r
-BEGIN_CODECS_LIST\r
-  CODEC_STATELESS_WINIT(big5hkscs)\r
-END_CODECS_LIST\r
-\r
-I_AM_A_MODULE_FOR(hk)\r