8 * This file is part of PhysicsFS (http://icculus.org/physfs/)
10 * This data generated by physfs/extras/makecasefoldhashtable.pl ...
11 * Do not manually edit this file!
13 * Please see the file LICENSE.txt in the source's root directory.
16 #ifndef __PHYSICSFS_INTERNAL__
17 #error Do not include this header from your applications.
25 for (my $i = 0; $i < 256; $i++) {
29 open(FH,'<','casefolding.txt') or die("failed to open casefolding.txt: $!\n");
32 # strip comments from textfile...
39 next if not /\A([a-fA-F0-9]+)\;\s*(.)\;\s*(.+)\;/;
40 my ($code, $status, $mapping) = ($1, $2, $3);
41 my $hexxed = hex($code);
42 my $hashed = (($hexxed ^ ($hexxed >> 8)) & 0xFF);
43 #print("// code '$code' status '$status' mapping '$mapping'\n");
44 #print("// hexxed '$hexxed' hashed '$hashed'\n");
46 if (($status eq 'C') or ($status eq 'F')) {
47 my ($map1, $map2, $map3) = ('0000', '0000', '0000');
48 $map1 = $1 if $mapping =~ s/\A([a-fA-F0-9]+)(\s*|\Z)//;
49 $map2 = $1 if $mapping =~ s/\A([a-fA-F0-9]+)(\s*|\Z)//;
50 $map3 = $1 if $mapping =~ s/\A([a-fA-F0-9]+)(\s*|\Z)//;
51 die("mapping space too small for '$code'\n") if ($mapping ne '');
52 $foldPairs[$hashed] .= " { 0x$code, 0x$map1, 0x$map2, 0x$map3 },\n";
57 for (my $i = 0; $i < 256; $i++) {
58 $foldPairs[$i] =~ s/,\n\Z//;
59 my $str = $foldPairs[$i];
62 $num =~ s/\A.*?(\d\d\d)\Z/$1/;
63 my $sym = "case_fold_${num}";
64 print("static const CaseFoldMapping ${sym}[] = {\n$str\n};\n\n");
67 print("\nstatic const CaseFoldHashBucket case_fold_hash[256] = {\n");
69 for (my $i = 0; $i < 256; $i++) {
70 my $str = $foldPairs[$i];
72 print(" { 0, NULL },\n");
75 $num =~ s/\A.*?(\d\d\d)\Z/$1/;
76 my $sym = "case_fold_${num}";
77 print(" { __PHYSFS_ARRAYLEN($sym), $sym },\n");
84 # end of makecashfoldhashtable.pl ...