# $Id: generate_nameprep_data.pl,v 1.1 2003/06/04 00:27:54 marka Exp $
#
# Copyright (c) 2001 Japan Network Information Center. All rights reserved.
#
# By using this file, you agree to the terms and conditions set forth bellow.
#
# LICENSE TERMS AND CONDITIONS
#
# The following License Terms and Conditions apply, unless a different
# license is obtained from Japan Network Information Center ("JPNIC"),
# a Japanese association, Kokusai-Kougyou-Kanda Bldg 6F, 2-3-4 Uchi-Kanda,
# Chiyoda-ku, Tokyo 101-0047, Japan.
#
# 1. Use, Modification and Redistribution (including distribution of any
# under this License Terms and Conditions.
#
# 2. Redistribution of source code must retain the copyright notices as they
# appear in each source code file, this License Terms and Conditions.
#
# 3. Redistribution in binary form must reproduce the Copyright Notice,
# materials provided with the distribution. For the purposes of binary
# distribution the "Copyright Notice" refers to the following language:
# "Copyright (c) 2000-2002 Japan Network Information Center. All rights reserved."
#
# 4. The name of JPNIC may not be used to endorse or promote products
# derived from this Software without specific prior written approval of
# JPNIC.
#
# 5. Disclaimer/Limitation of Liability: THIS SOFTWARE IS PROVIDED BY JPNIC
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JPNIC BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
#
use bytes;
use lib qw(.);
use SparseMap;
(my $myid = '$Id: generate_nameprep_data.pl,v 1.1 2003/06/04 00:27:54 marka Exp $') =~ s/\$([^\$]+)\$/\$-$1-\$/;
my $dir = '.';
my @versions = ();
print_header();
generate_data($_) foreach @ARGV;
sub usage {
die "Usage: $0 [-dir dir] version..\n";
}
sub generate_data {
my $version = shift;
}
#
# Generate mapping data.
#
sub generate_mapdata {
my $version = shift;
my $file = shift;
MAX => 0x110000,
MAPALL => 1,
DEFAULT => 0);
my %maphash = ();
while (<FILE>) {
my $same_as = $1;
close FILE;
return;
}
next;
}
next if /^\#/;
next if /^\s*$/;
}
close FILE;
}
#
# Generate prohibited character data.
#
sub generate_prohibiteddata {
my $version = shift;
my $file = shift;
MAX => 0x110000);
while (<FILE>) {
my $same_as = $1;
close FILE;
return;
}
next;
}
next if /^\#/;
next if /^\s*$/;
register_prohibited($proh, $_);
}
close FILE;
}
#
# Generate unassigned codepoint data.
#
sub generate_unassigneddata {
my $version = shift;
my $file = shift;
MAX => 0x110000);
while (<FILE>) {
my $same_as = $1;
close FILE;
return;
}
next;
}
next if /^\#/;
next if /^\s*$/;
register_unassigned($unas, $_);
}
close FILE;
}
#
# Generate data of bidi "R" or "AL" characters.
#
sub generate_bididata {
my $version = shift;
my $file = shift;
MAX => 0x110000);
my $type = 0;
while (<FILE>) {
my $same_as = $1;
close FILE;
return;
}
next;
}
if (/^%\s*BIDI_TYPE\s+(\S+)$/) {
my $i = 0;
for ($i = 0; $i < @bidi_types; $i++) {
if ($1 eq $bidi_types[$i]) {
$type = $i;
last;
}
}
die "unrecognized line: $_" if ($i >= @bidi_types);
next;
}
next if /^\#/;
next if /^\s*$/;
}
close FILE;
}
sub print_header {
print <<"END";
/* \$Id\$ */
/* $myid */
/*
*/
END
}
sub bits_definition {
my $name = shift;
my @bits = @_;
my $i = 0;
foreach my $n (@bits) {
print "#define ${name}_BITS_$i\t$n\n";
$i++;
}
print "\n";
}
sub register_map {
$ucs4 =~ s/\000+$//;
my $offset;
} else {
}
}
sub generate_map {
print "\nstatic const unsigned char nameprep_${version}_map_data[] = \{\n";
print "};\n\n";
}
sub generate_map_ref {
my ($version, $refversion) = @_;
print <<"END";
#define nameprep_${version}_map_imap nameprep_${refversion}_map_imap
#define nameprep_${version}_map_table nameprep_${refversion}_map_table
#define nameprep_${version}_map_data nameprep_${refversion}_map_data
END
}
sub print_uchararray {
my $i = 0;
foreach my $v (@chars) {
if ($i % 12 == 0) {
print "\n" if $i != 0;
print "\t";
}
printf "%3d, ", $v;
$i++;
}
print "\n";
}
sub register_prohibited {
my $proh = shift;
register_bitmap($proh, @_);
}
sub register_unassigned {
my $unas = shift;
register_bitmap($unas, @_);
}
sub register_bidi {
my $bidi = shift;
my $type = shift;
}
sub generate_prohibited {
print "\n";
}
sub generate_prohibited_ref {
my ($version, $refversion) = @_;
print <<"END";
#define nameprep_${version}_prohibited_imap nameprep_${refversion}_prohibited_imap
#define nameprep_${version}_prohibited_bitmap nameprep_${refversion}_prohibited_bitmap
END
}
sub generate_unassigned {
print "\n";
}
sub generate_unassigned_ref {
my ($version, $refversion) = @_;
print <<"END";
#define nameprep_${version}_unassigned_imap nameprep_${refversion}_unassigned_imap
#define nameprep_${version}_unassigned_bitmap nameprep_${refversion}_unassigned_bitmap
END
}
sub generate_bidi {
print "\n";
print "static const unsigned char nameprep_${version}_bidi_data[] = \{\n";
foreach my $type (@bidi_types) {
printf "\tidn_biditype_%s, \n", lc($type);
}
print "};\n\n";
}
sub generate_bidi_ref {
my ($version, $refversion) = @_;
print <<"END";
#define nameprep_${version}_bidi_imap nameprep_${refversion}_bidi_imap
#define nameprep_${version}_bidi_table nameprep_${refversion}_bidi_table
END
}
sub register_bitmap {
my $map = shift;
my $line = shift;
my $start = hex($1);
if (defined $end) {
} else {
}
}
sub register_intmap {
my $map = shift;
my $value = shift;
my $line = shift;
my $start = hex($1);
}
}
sub generate_bitmap {
my $map = shift;
my $name = shift;
#$map->stat();
}