--- rxvt-unicode/src/gentables 2003/11/24 17:28:08 1.1 +++ rxvt-unicode/src/gentables 2004/09/05 09:32:59 1.7 @@ -1,6 +1,6 @@ #!/opt/bin/perl -# the generated tables mostly have NOT been chcked so far! +# the generated tables mostly have NOT been checked so far! use v5.8.2; use utf8; @@ -8,6 +8,8 @@ my $gen; +$TO_UNICODE = 0; # also generate to_unicode tables + sub linear { my ($a, $l, $h, $b) = @_; for ($l .. $h) { @@ -215,11 +217,12 @@ } } - my ($tab1, $fun1) = gen \@enc1, "$base\_f", "unicode"; - my ($tab2, $fun2) = gen \@enc2, "$base\_t", "enc"; + my ($tab1, $fun1); + my ($tab2, $fun2); + + ($tab1, $fun1) = gen \@enc1, "$base\_f", "unicode"; + ($tab2, $fun2) = gen \@enc2, "$base\_t", "enc" if $TO_UNICODE; - #$tab1 =~ s/^/ /gm; - #$tab2 =~ s/^/ /gm; $fun1 =~ s/^/ /gm; $fun2 =~ s/^/ /gm; @@ -233,16 +236,25 @@ #ifdef ENCODING_$group $tab1$tab2 -struct rxvt_codeset_conv_$base : rxvt_codeset_conv { - uint32_t from_unicode (uint32_t unicode) const { -$fun1 } - uint32_t to_unicode (uint32_t enc) const { -$fun2 } -} rxvt_codeset_conv_$base; +static uint32_t cs_$base\_from_unicode (unicode_t unicode) { +$fun1} +EOF + +if ($TO_UNICODE) { + print OUT <