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
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";
30 for my $ch (0 .. 255) {
33 print OUT
" /* '$_' */ ";
35 printf OUT
" /* 0x%02x */ ", $ch;
39 push @a, sprintf "0x%02x", hex($_);
42 push @a, 'Xapian::Internal::IS_ALPHA';
45 push @a, 'Xapian::Internal::IS_UPPER';
48 push @a, 'Xapian::Internal::IS_DIGIT';
51 push @a, 'Xapian::Internal::IS_SPACE';
54 print OUT
join ' | ', @a;
61 rename "$out.tmp", $out or die $!;