w3m

Unnamed repository; edit this file to name it for gitweb.
git clone https://logand.com/git/w3m.git/
Log | Files | Refs | README

mk_combining_map.pl (3548B)


      1 
      2 open(C, "ucs_combining.map");
      3 while(<C>) {
      4   /^\s*\{/ || next;
      5   /\{\s*(\w+),\s*(\w+)\s*\}/;
      6   ($a, $b) = ($1, $2);
      7   for $c (hex($a) .. hex($b)) {
      8     $COMB{$c} = 1;
      9   }
     10 }
     11 close(C);
     12 
     13 @NAME = ();
     14 while(<DATA>) {
     15   chop;
     16   s/\s*$//;
     17   (($n, $m, $c) = split(" ", $_, 3)) >= 3 || next;
     18   push(@NAME, $n);
     19   $MAP{$n} = $m;
     20   $CODE{$n} = $c;
     21 }
     22 
     23 foreach $name (@NAME) {
     24 
     25 $code = $CODE{$name};
     26 $map = $MAP{$name};
     27 
     28 print "$name\t$map\t$code\n";
     29 
     30 @to_ucs = ();
     31 %from_ucs = ();
     32 open(MAP, "< $map");
     33 while(<MAP>) {
     34   /^#/ && next;
     35   s/#.*//;
     36   (($i, $u) = split(" ")) || next;
     37   $i = hex($i);
     38   $u = hex($u);
     39   if ($u >= 0xa0) {
     40     $to_ucs[$i] = $u;
     41     if ($i < 0x80) {
     42       print STDERR "$map $i $u\n";
     43 #     $from_ucs{$u} = $i;
     44     } else {
     45       $from_ucs{$u} = $i;
     46     }
     47   }
     48 }
     49 close(MAP);
     50 
     51 $ok = 0;
     52 @comb = ();
     53 foreach $i (0x80 .. 0xFF) {
     54    $comb[$i] = $COMB{$to_ucs[$i]} ? 1 : 0;
     55    $comb[$i] && ($ok = 1);
     56 }
     57 $ok || next;
     58 
     59 open(OUT, "> ${name}_combining.map");
     60 print OUT <<EOF;
     61 /* $code */
     62 
     63 static wc_uint8 ${name}_combining_map[ 0x80 ] = {
     64 EOF
     65 
     66 foreach $i (0x8 .. 0xF) {
     67   print OUT " ";
     68 foreach $j (0 .. 0xF) {
     69   $_ = $i * 16 + $j;
     70   print OUT " $comb[$_],";
     71 }
     72   print OUT "\n";
     73 }
     74 
     75 print OUT <<EOF;
     76 };
     77 EOF
     78 
     79 }
     80 
     81 __END__
     82 jisx0201k	EASTASIA/JIS/JIS0201.TXT	JIS X 0201 (Japanese Kana)
     83 iso88591	ISO8859/8859-1.TXT	ISO-8859-1 (Latin 1)
     84 iso88592	ISO8859/8859-2.TXT	ISO-8859-2 (Latin 2)
     85 iso88593	ISO8859/8859-3.TXT	ISO-8859-3 (Latin 3)
     86 iso88594	ISO8859/8859-4.TXT	ISO-8859-4 (Latin 4)
     87 iso88595	ISO8859/8859-5.TXT	ISO-8859-5 (Cyrillic)
     88 iso88596	ISO8859/8859-6.TXT	ISO-8859-6 (Arabic)
     89 iso88597	ISO8859/8859-7.TXT	ISO-8859-7 (Greek)
     90 iso88598	ISO8859/8859-8.TXT	ISO-8859-8 (Hebrew)
     91 iso88599	ISO8859/8859-9.TXT	ISO-8859-9 (Latin 5)
     92 iso885910	ISO8859/8859-10.TXT	ISO-8859-10 (Latin 6)
     93 iso885911	VENDORS/MICSFT/WINDOWS/CP874.TXT	ISO-8859-11 (Vietnamese)
     94 iso885913	ISO8859/8859-13.TXT	ISO-8859-13 (Latin 7)
     95 iso885914	ISO8859/8859-14.TXT	ISO-8859-14 (Latin 8)
     96 iso885915	ISO8859/8859-15.TXT	ISO-8859-15 (Latin 9)
     97 
     98 cp856	VENDORS/MISC/CP856.TXT		CP856 (Hebrew)                  
     99 cp1006	VENDORS/MISC/CP1006.TXT		IBM CP1006 (Arabic)
    100 koi8r	VENDORS/MISC/KOI8-R.TXT		KOI8-R (Cyrillic)
    101 
    102 nextstep	VENDORS/NEXT/NEXTSTEP.TXT	NeXTSTEP
    103 
    104 cp437	VENDORS/MICSFT/PC/CP437.TXT	CP437 (Latin)
    105 cp737	VENDORS/MICSFT/PC/CP737.TXT	CP737 (Greek)
    106 cp775	VENDORS/MICSFT/PC/CP775.TXT	CP775 (Baltic Rim)
    107 cp850	VENDORS/MICSFT/PC/CP850.TXT	CP850 (Latin 1)
    108 cp852	VENDORS/MICSFT/PC/CP852.TXT	CP852 (Latin 2)
    109 cp855	VENDORS/MICSFT/PC/CP855.TXT	CP855 (Cyrillic)
    110 cp857	VENDORS/MICSFT/PC/CP857.TXT	CP857 (Turkish)
    111 cp860	VENDORS/MICSFT/PC/CP860.TXT	CP860 (Portuguese)
    112 cp861	VENDORS/MICSFT/PC/CP861.TXT	CP861 (Icelandic)
    113 cp862	VENDORS/MICSFT/PC/CP862.TXT	CP862 (Hebrew)
    114 cp863	VENDORS/MICSFT/PC/CP863.TXT	CP863 (Canada French)
    115 cp864	VENDORS/MICSFT/PC/CP864.TXT	CP864 (Arabic)
    116 cp865	VENDORS/MICSFT/PC/CP865.TXT	CP865 (Nordic)
    117 cp866	VENDORS/MICSFT/PC/CP866.TXT	CP866 (Cyrillic Russian)
    118 cp869	VENDORS/MICSFT/PC/CP869.TXT	CP869 (Greek 2)
    119 cp874	VENDORS/MICSFT/PC/CP874.TXT	CP874 (Thai)
    120 
    121 cp1250	VENDORS/MICSFT/WINDOWS/CP1250.TXT	CP1250 (Latin 2)
    122 cp1251	VENDORS/MICSFT/WINDOWS/CP1251.TXT	CP1251 (Cyrillic)
    123 cp1252	VENDORS/MICSFT/WINDOWS/CP1252.TXT	CP1252 (Latin 1)
    124 cp1253	VENDORS/MICSFT/WINDOWS/CP1253.TXT	CP1253 (Greek)
    125 cp1254	VENDORS/MICSFT/WINDOWS/CP1254.TXT	CP1254 (Turkish)
    126 cp1255	VENDORS/MICSFT/WINDOWS/CP1255.TXT	CP1255 (Hebrew)
    127 cp1256	VENDORS/MICSFT/WINDOWS/CP1256.TXT	CP1256 (Arabic)
    128 cp1257	VENDORS/MICSFT/WINDOWS/CP1257.TXT	CP1257 (Baltic Rim)
    129 cp1258	VENDORS/MICSFT/WINDOWS/CP1258.TXT	CP1258 (Vietnamese)
    130