jdk/make/java/nio/genCharsetProvider.sh
author xdono
Wed, 02 Jul 2008 12:55:45 -0700
changeset 715 f16baef3a20e
parent 29 b8bedccd805d
child 5506 202f599c92aa
permissions -rw-r--r--
6719955: Update copyright year Summary: Update copyright year for files that have been modified in 2008 Reviewed-by: ohair, tbell
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
#! /bin/sh
90ce3da70b43 Initial load
duke
parents:
diff changeset
     2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
#
715
f16baef3a20e 6719955: Update copyright year
xdono
parents: 29
diff changeset
     4
# Copyright 2004-2008 Sun Microsystems, Inc.  All Rights Reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
# This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
# under the terms of the GNU General Public License version 2 only, as
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
# published by the Free Software Foundation.  Sun designates this
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
# particular file as subject to the "Classpath" exception as provided
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
# by Sun in the LICENSE file that accompanied this code.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
# This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
# version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
# accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
# You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
# 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    21
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
# CA 95054 USA or visit www.sun.com if you need additional information or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
# have any questions.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
# Generate a charset provider class
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
# Required environment variables
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
#   NAWK	awk tool
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
#   TEMPDIR      temporary directory
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
#   HASHER	Hasher program
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
SPEC=$1; shift
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
DST=$1; shift
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
eval `$NAWK <$SPEC '
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
  /^[ \t]*copyright / { printf "COPYRIGHT_YEARS=%s\n", $2; }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
  /^[ \t]*package / { printf "PKG=%s\n", $2; }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
  /^[ \t]*class / { printf "CLASS=%s\n", $2; }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
'`
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
OUT=$DST/$CLASS.java
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
echo '-->' $OUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
# Header
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
29
b8bedccd805d 6638060: Build failed with GNU make 3.81 (part of latest Solaris 'gmake')
ohair
parents: 2
diff changeset
    51
$SH ./addNotices.sh "$COPYRIGHT_YEARS" > $OUT
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
cat <<__END__ >>$OUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
// -- This file was mechanically generated: Do not edit! -- //
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
package $PKG;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
import java.nio.charset.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
public class $CLASS
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
    extends FastCharsetProvider
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
__END__
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
# Alias tables
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
$NAWK <$SPEC >>$OUT '
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
  BEGIN { n = 1; m = 1; }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
  /^[ \t]*charset / {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
    csn = $2; cln = $3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
    lcsn = tolower(csn);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
    lcsns[n++] = lcsn;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
    csns[lcsn] = csn;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
    classMap[lcsn] = cln;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
    if (n > 2)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
      printf "    };\n\n";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
    printf "    static final String[] aliases_%s = new String[] {\n", cln;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
  /^[ \t]*alias / {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
    acsns[m++] = tolower($2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
    aliasMap[tolower($2)] = lcsn; 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
    printf "        \"%s\",\n", $2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
  END {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
    printf "    };\n\n";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
'
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
# Prehashed alias and class maps
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
$NAWK <$SPEC >$TEMPDIR/aliases '
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
  /^[ \t]*charset / {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
    csn = $2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
    lcsn = tolower(csn);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
  /^[ \t]*alias / {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
    an = tolower($2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
    printf "%-20s \"%s\"\n", an, lcsn;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
'
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
$NAWK <$SPEC >$TEMPDIR/classes '
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
  /^[ \t]*charset / {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
    csn = $2; cln = $3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
    lcsn = tolower(csn);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
    printf "%-20s \"%s\"\n", lcsn, cln;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
'
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
${HASHER} -i Aliases <$TEMPDIR/aliases >>$OUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
${HASHER} -i Classes <$TEMPDIR/classes >>$OUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
${HASHER} -i -e Cache -t Charset <$TEMPDIR/classes >>$OUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
# Constructor
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
cat <<__END__ >>$OUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
    public $CLASS() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
        super("$PKG", new Aliases(), new Classes(), new Cache());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
__END__