diff options
author | Nicholas Clark <nick@ccl4.org> | 2011-01-24 06:28:19 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2011-01-24 06:30:35 +0000 |
commit | cfb8fd6a832933165061cfa856e30964185ab828 (patch) | |
tree | bff1b67d7aeb6e4b8c54fca94056d45996203de0 | |
parent | 96ac09754b53d56f88a3effe7c9c82d363d89ee5 (diff) | |
download | perl-cfb8fd6a832933165061cfa856e30964185ab828.tar.gz |
Convert mk_PL_charclass.pl to use regen_lib.pl
Change it to read CaseFolding.txt from lib/unicore, instead of the file
installed with perl, so that it can run with an uninstalled perl.
Add "read only" editor blocks to l1_char_class_tab.h
-rw-r--r-- | Porting/mk_PL_charclass.pl | 10 | ||||
-rw-r--r-- | l1_char_class_tab.h | 10 |
2 files changed, 16 insertions, 4 deletions
diff --git a/Porting/mk_PL_charclass.pl b/Porting/mk_PL_charclass.pl index e174184541..5b2cca70f1 100644 --- a/Porting/mk_PL_charclass.pl +++ b/Porting/mk_PL_charclass.pl @@ -2,7 +2,7 @@ use 5.012; use strict; use warnings; -use Config; +require 'regen/regen_lib.pl'; # This program outputs the 256 lines that form the guts of the PL_charclass # table. The output should be used to manually replace the table contents in @@ -57,7 +57,7 @@ my @properties = qw( # Read in the case fold mappings. my %folded_closure; -my $file="$Config{privlib}/unicore/CaseFolding.txt"; +my $file="lib/unicore/CaseFolding.txt"; open my $fh, "<", $file or die "Failed to read '$file': $!"; while (<$fh>) { chomp; @@ -222,6 +222,9 @@ my @C1 = qw( APC ); +my $out_fh = safer_open('l1_char_class_tab.h-new', 'l1_char_class_tab.h'); +print $out_fh read_only_top(lang => 'C', style => '*', by => $0, from => $file); + # Output the table using fairly short names for each char. for my $ord (0..255) { my $name; @@ -237,6 +240,7 @@ for my $ord (0..255) { $name =~ s/LATIN CAPITAL LETTER // || $name =~ s/LATIN SMALL LETTER (.*)/\L$1/; } - printf "/* U+%02X %s */ %s,\n", $ord, $name, $bits[$ord]; + printf $out_fh "/* U+%02X %s */ %s,\n", $ord, $name, $bits[$ord]; } +read_only_bottom_close_and_rename($out_fh) diff --git a/l1_char_class_tab.h b/l1_char_class_tab.h index d8bc8faec6..9be42d26da 100644 --- a/l1_char_class_tab.h +++ b/l1_char_class_tab.h @@ -1,4 +1,10 @@ -/* !! MODIFY AND USE Porting/mk_PL_charclass.pl TO CHANGE THIS TABLE !! */ +/* -*- buffer-read-only: t -*- + * !!!!!!! DO NOT EDIT THIS FILE !!!!!!! + * This file is built by Porting/mk_PL_charclass.pl from + * lib/unicore/CaseFolding.txt. + * Any changes made here will be lost! + */ + /* U+00 NUL */ _CC_CNTRL_A|_CC_CNTRL_L1, /* U+01 SOH */ _CC_CNTRL_A|_CC_CNTRL_L1, /* U+02 STX */ _CC_CNTRL_A|_CC_CNTRL_L1, @@ -255,3 +261,5 @@ /* U+FD y with acute */ _CC_ALNUMC_L1|_CC_ALPHA_L1|_CC_CHARNAME_CONT|_CC_GRAPH_L1|_CC_IDFIRST_L1|_CC_LOWER_L1|_CC_PRINT_L1|_CC_WORDCHAR_L1, /* U+FE thorn */ _CC_ALNUMC_L1|_CC_ALPHA_L1|_CC_CHARNAME_CONT|_CC_GRAPH_L1|_CC_IDFIRST_L1|_CC_LOWER_L1|_CC_PRINT_L1|_CC_WORDCHAR_L1, /* U+FF y with diaeresis */ _CC_NONLATIN1_FOLD|_CC_ALNUMC_L1|_CC_ALPHA_L1|_CC_CHARNAME_CONT|_CC_GRAPH_L1|_CC_IDFIRST_L1|_CC_LOWER_L1|_CC_PRINT_L1|_CC_WORDCHAR_L1, + +/* ex: set ro: */ |