X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=charset%2Fmisc%2Ftable2h;h=92a35d5924efe2db3ad7a69f4f6e9789245b27ca;hb=d9c55a4d021b4a317a25f14f89468d62592aae0b;hp=81bbb185493bab7e2a2ce7842f4be119357bff2f;hpb=abba9373525dbfa8fb8dfcb0505e7ae682357983;p=libucw.git diff --git a/charset/misc/table2h b/charset/misc/table2h index 81bbb185..92a35d59 100755 --- a/charset/misc/table2h +++ b/charset/misc/table2h @@ -9,9 +9,13 @@ $type=$ARGV[1]; while () { chomp; + /^#/ && next; + /^\s*$/ && next; + s/^0x//; ($i,$j) = split/\s+/; ($i =~ /^(..)(..)$/) || die "Syntax error at $i"; $table{$1} = "$name" . "_$1"; + die if defined $val{$i}; $val{$i} = $j; } @@ -20,7 +24,7 @@ print "/* Generated automatically by gentab. Please don't edit. */\n\n"; for($i=0; $i<256; $i++) { $x = sprintf("%02X", $i); if (defined($table{$x})) { - print "static $type $table{$x}\[256\] = \{\n"; + print "static const $type $table{$x}\[256\] = \{\n"; for($j=0; $j<256; $j++) { $y = $x . sprintf("%02X", $j); if ($val{$y}) { print $val{$y}; } @@ -32,7 +36,7 @@ for($i=0; $i<256; $i++) { } } -print "$type \*$name\[256\] = \{\n"; +print "const $type \*$name\[256\] = \{\n"; for($j=0; $j<256; $j++) { $y = sprintf("%02X", $j); if (defined $table{$y}) { print $table{$y}; }