bootstrap: Update to omega to latest common
[xapian.git] / xapian-core / unicode / gen_c_istab
blob0d19026043017e43fcf286fbb6d1614610bbff3f
1 #!/usr/bin/perl
2 # Copyright (C) 2015 Olly Betts
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License as
6 # published by the Free Software Foundation; either version 2 of the
7 # License, or (at your option) any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 use strict;
19 use warnings;
21 @ARGV == 1 or die "Syntax: $0 OUTFILE\n";
23 my $out = shift @ARGV;
25 open OUT, '>', "$out.tmp" or die $!;
27 print OUT "/* Generated by $0 */\n\n";
29 print OUT "{\n";
30 for my $ch (0 .. 255) {
31 $_ = chr($ch);
32 if (/[ -~]/) {
33 print OUT " /* '$_' */ ";
34 } else {
35 printf OUT " /* 0x%02x */ ", $ch;
37 my @a;
38 if (/[0-9a-fA-F]/) {
39 push @a, sprintf "0x%02x", hex($_);
41 if (/[A-Za-z]/) {
42 push @a, 'Xapian::Internal::IS_ALPHA';
44 if (/[A-Z]/) {
45 push @a, 'Xapian::Internal::IS_UPPER';
47 if (/[0-9]/) {
48 push @a, 'Xapian::Internal::IS_DIGIT';
50 if (/[\t\n\f\r ]/) {
51 push @a, 'Xapian::Internal::IS_SPACE';
53 @a > 0 or @a = (0);
54 print OUT join ' | ', @a;
55 print OUT ",\n";
57 print OUT "},\n";
59 close OUT or die $!;
61 rename "$out.tmp", $out or die $!;