/[classpath]/classpath/doc/unicode/unicode-blocks.pl
ViewVC logotype

Diff of /classpath/doc/unicode/unicode-blocks.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by ericb, Sun Feb 17 07:30:03 2002 UTC revision 1.2 by ericb, Mon Feb 18 20:07:17 2002 UTC
# Line 1  Line 1 
1  #!/usr/bin/perl  #!/usr/bin/perl -w
2  # unicode-blocks -- Script to generate java.lang.Character.UnicodeBlock  # unicode-blocks.pl -- Script to generate java.lang.Character.UnicodeBlock
3  # Copyright (C) 2002 Free Software Foundation, Inc.  # Copyright (C) 2002 Free Software Foundation, Inc.
4  #  #
5  # This file is part of GNU Classpath.  # This file is part of GNU Classpath.
# Line 45  Line 45 
45  # will have to tweak this some for future use.  # will have to tweak this some for future use.
46  #  #
47  # author Eric Blake <ebb9@email.byu.edu>  # author Eric Blake <ebb9@email.byu.edu>
48    #
49    # usage: unicode-blocks.pl <blocks.txt>
50    #    where <blocks.txt> is obtained from www.unicode.org (named Blocks-3.txt
51    #    for Unicode version 3.0.0).
52    
 # usage: unicode-blocks.pl Blocks-3.txt  
53    
54    die "Usage: $0 <blocks.txt>" unless @ARGV == 1;
55  open (BLOCKS, $ARGV[0]) || die "Can't open Unicode block file: $!\n";  open (BLOCKS, $ARGV[0]) || die "Can't open Unicode block file: $!\n";
56    
57  # A hash of added fields and the JDK they were added in, to automatically  # A hash of added fields and the JDK they were added in, to automatically
# Line 78  print <<'EOF'; Line 82  print <<'EOF';
82     * A family of character subsets in the Unicode specification. A character     * A family of character subsets in the Unicode specification. A character
83     * is in at most one of these blocks.     * is in at most one of these blocks.
84     *     *
85     * This class was generated by doc/unicode/unicode-blocks.pl.     * This inner class was generated by doc/unicode/unicode-blocks.pl.
86     *     *
87       * @author doc/unicode/unicode-blocks.pl (written by Eric Blake)
88     * @since 1.2     * @since 1.2
89     */     */
90    public static final class UnicodeBlock extends Subset    public static final class UnicodeBlock extends Subset
# Line 139  $surrogateStart = 0; Line 144  $surrogateStart = 0;
144  while (<BLOCKS>) {  while (<BLOCKS>) {
145      next if /^\#/;      next if /^\#/;
146      ($start, $end, $block) = split(/; /);      ($start, $end, $block) = split(/; /);
147        next unless defined $block;
148      chomp $block;      chomp $block;
149      $block =~ s/ *$//;      $block =~ s/ *$//;
     next if $block eq "";  
150      if (! $seenSpecials and $block =~ /Specials/) {      if (! $seenSpecials and $block =~ /Specials/) {
151          # Special case SPECIALS, since it is two disjoint ranges          # Special case SPECIALS, since it is two disjoint ranges
152          $seenSpecials = 1;          $seenSpecials = 1;
# Line 162  while (<BLOCKS>) { Line 167  while (<BLOCKS>) {
167          }          }
168      }      }
169      # Special case the name of PRIVATE_USE_AREA.      # Special case the name of PRIVATE_USE_AREA.
170      $block =~ s/(Private Use)/\1 Area/;      $block =~ s/(Private Use)/$1 Area/;
171    
172      ($name = $block) =~ tr/a-z -/A-Z__/;      ($name = $block) =~ tr/a-z -/A-Z__/;
173      push @names, $name;      push @names, $name;

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26