jdk/makefiles/java/nio/genCoder.sh
changeset 12317 9670c1610c53
equal deleted inserted replaced
12316:ba6b7a51e226 12317:9670c1610c53
       
     1 #! /bin/sh
       
     2 
       
     3 #
       
     4 # Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved.
       
     5 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       
     6 #
       
     7 # This code is free software; you can redistribute it and/or modify it
       
     8 # under the terms of the GNU General Public License version 2 only, as
       
     9 # published by the Free Software Foundation.  Oracle designates this
       
    10 # particular file as subject to the "Classpath" exception as provided
       
    11 # by Oracle in the LICENSE file that accompanied this code.
       
    12 #
       
    13 # This code is distributed in the hope that it will be useful, but WITHOUT
       
    14 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
       
    15 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
       
    16 # version 2 for more details (a copy is included in the LICENSE file that
       
    17 # accompanied this code).
       
    18 #
       
    19 # You should have received a copy of the GNU General Public License version
       
    20 # 2 along with this work; if not, write to the Free Software Foundation,
       
    21 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
       
    22 #
       
    23 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
       
    24 # or visit www.oracle.com if you need additional information or have any
       
    25 # questions.
       
    26 #
       
    27 
       
    28 # Generate charset coder and decoder classes
       
    29 
       
    30 # Environment variables required from make: SED SPP
       
    31 
       
    32 what=$1
       
    33 SRC=$2
       
    34 DST=$3
       
    35 
       
    36 if [ x$what = xdecoder ]; then
       
    37 
       
    38   echo '  '$SRC '--('$what')-->' $DST
       
    39   $SPP <$SRC >$DST \
       
    40     -K$what \
       
    41     -DA='A' \
       
    42     -Da='a' \
       
    43     -DCode='Decode' \
       
    44     -Dcode='decode' \
       
    45     -DitypesPhrase='bytes in a specific charset' \
       
    46     -DotypesPhrase='sixteen-bit Unicode characters' \
       
    47     -Ditype='byte' \
       
    48     -Dotype='character' \
       
    49     -DItype='Byte' \
       
    50     -DOtype='Char' \
       
    51     -Dcoder='decoder' \
       
    52     -DCoder='Decoder' \
       
    53     -Dcoding='decoding' \
       
    54     -DOtherCoder='Encoder' \
       
    55     -DreplTypeName='string' \
       
    56     -DdefaultRepl='"\\uFFFD"' \
       
    57     -DdefaultReplName='<tt>"\&#92;uFFFD"<\/tt>' \
       
    58     -DreplType='String' \
       
    59     -DreplFQType='java.lang.String' \
       
    60     -DreplLength='length()' \
       
    61     -DItypesPerOtype='CharsPerByte' \
       
    62     -DnotLegal='not legal for this charset' \
       
    63     -Dotypes-per-itype='chars-per-byte' \
       
    64     -DoutSequence='Unicode character'
       
    65 
       
    66 elif [ x$what = xencoder ]; then
       
    67 
       
    68   echo '  '$SRC '--('$what')-->' $DST
       
    69   $SPP <$SRC >$DST \
       
    70     -K$what \
       
    71     -DA='An' \
       
    72     -Da='an' \
       
    73     -DCode='Encode' \
       
    74     -Dcode='encode' \
       
    75     -DitypesPhrase='sixteen-bit Unicode characters' \
       
    76     -DotypesPhrase='bytes in a specific charset' \
       
    77     -Ditype='character' \
       
    78     -Dotype='byte' \
       
    79     -DItype='Char' \
       
    80     -DOtype='Byte' \
       
    81     -Dcoder='encoder' \
       
    82     -DCoder='Encoder' \
       
    83     -Dcoding='encoding' \
       
    84     -DOtherCoder='Decoder' \
       
    85     -DreplTypeName='byte array' \
       
    86     -DdefaultRepl='new byte[] { (byte)'"'"\\?"'"' }' \
       
    87     -DdefaultReplName='<tt>{<\/tt>\&nbsp;<tt>(byte)'"'"\\?"'"'<\/tt>\&nbsp;<tt>}<\/tt>' \
       
    88     -DreplType='byte[]' \
       
    89     -DreplFQType='byte[]' \
       
    90     -DreplLength='length' \
       
    91     -DItypesPerOtype='BytesPerChar' \
       
    92     -DnotLegal='not a legal sixteen-bit Unicode sequence' \
       
    93     -Dotypes-per-itype='bytes-per-char' \
       
    94     -DoutSequence='byte sequence in the given charset'
       
    95 
       
    96 else
       
    97   echo Illegal coder type: $what
       
    98   exit 1
       
    99 fi