pike.git / src / modules / _Charset / make_jisx0213_tables_h.pike

version» Context lines:

pike.git/src/modules/_Charset/make_jisx0213_tables_h.pike:1:   /*    * Generate the JIS X 0213:2000 and JIS X 0213:2004    * Unicode translation tables for Pike from    *    * http://x0213.org/codetable/jisx0213-2004-std.txt    *    * 2011-04-22 Henrik Grubbström    */    + // NB: This script needs to be able to run on an older system pike. + #if !constant(String.trim) + #define trim trim_all_whites + #endif +    // These are the characters added by JIS X0213/AMMENDMENT-1:2004.   // All of them are in JIS X0213 plane 1.   constant jis_x0213_amd_1_2004 = ([    0x2e21: 0x4ff1,    0x2f7e: 0x525d,    0x4f54: 0x20b9f,    0x4f7e: 0x541e,    0x7427: 0x5653,    0x7e7a: 0x59f8,    0x7e7b: 0x5c5b,
pike.git/src/modules/_Charset/make_jisx0213_tables_h.pike:61:   array(mapping(int:int)) combiners = ({ ([]), ([]) });      array(array(int)) parse_jisx_file(string path)   {    Stdio.File f = Stdio.File();    if (!f->open(path, "r")) return UNDEFINED;       array(array(int)) result = allocate(2, allocate)(94*94, 0xfffd);    foreach(f->line_iterator(1);;string line) {    line = (line/"#")[0]; -  array(string) fields = map(line/"\t", String.trim_all_whites) - ({ "" }); +  array(string) fields = map(line/"\t", String.trim) - ({ "" });    if (sizeof(fields) < 2) continue;    int plane;    if (has_prefix(fields[0], "3-")) {    plane = 0;    } else if (has_prefix(fields[0], "4-")) {    plane = 1;    } else {    werror("Unsupported JIS prefix: %O\n", fields[0][..1]);    exit(2);    }