make/data/characterdata/CharacterData02.java.template
author mhorie
Tue, 11 Dec 2018 20:31:18 -0500
changeset 52979 7384e00d5860
parent 47216 71c04702a3d5
child 58028 7ac4273bb49b
permissions -rw-r--r--
8213754: PPC64: Add Intrinsics for isDigit/isLowerCase/isUpperCase/isWhitespace Reviewed-by: kvn, rriggs, mdoerr, gromero
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
52979
7384e00d5860 8213754: PPC64: Add Intrinsics for isDigit/isLowerCase/isUpperCase/isWhitespace
mhorie
parents: 47216
diff changeset
     2
 * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package java.lang;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
/** The CharacterData class encapsulates the large tables found in
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
    Java.lang.Character. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
class CharacterData02 extends CharacterData {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
    /* The character properties are currently encoded into 32 bits in the following manner:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
        1 bit   mirrored property
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
        4 bits  directionality property
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
        9 bits  signed offset used for converting case
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
        1 bit   if 1, adding the signed offset converts the character to lowercase
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
        1 bit   if 1, subtracting the signed offset converts the character to uppercase
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
        1 bit   if 1, this character has a titlecase equivalent (possibly itself)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
        3 bits  0  may not be part of an identifier
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
                1  ignorable control; may continue a Unicode identifier or Java identifier
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
                2  may continue a Java identifier but not a Unicode identifier (unused)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
                3  may continue a Unicode identifier or Java identifier
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
                4  is a Java whitespace character
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
                5  may start or continue a Java identifier;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
                   may continue but not start a Unicode identifier (underscores)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
                6  may start or continue a Java identifier but not a Unicode identifier ($)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
                7  may start or continue a Unicode identifier or Java identifier
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
                Thus:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
                   5, 6, 7 may start a Java identifier
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
                   1, 2, 3, 5, 6, 7 may continue a Java identifier
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
                   7 may start a Unicode identifier
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
                   1, 3, 5, 7 may continue a Unicode identifier
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
                   1 is ignorable within an identifier
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
                   4 is Java whitespace
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
        2 bits  0  this character has no numeric property
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
                1  adding the digit offset to the character code and then
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
                   masking with 0x1F will produce the desired numeric value
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
                2  this character has a "strange" numeric value
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
                3  a Java supradecimal digit: adding the digit offset to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
                   character code, then masking with 0x1F, then adding 10
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
                   will produce the desired numeric value
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
        5 bits  digit offset
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
        5 bits  character type
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
        The encoding of character properties is subject to change at any time.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
    int getProperties(int ch) {
9535
d930011fd275 7037261: j.l.Character.isLowerCase/isUpperCase need to match the Unicode Standard
sherman
parents: 5506
diff changeset
    69
	char offset = (char)ch;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
        int props = $$Lookup(offset);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
        return props;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
9535
d930011fd275 7037261: j.l.Character.isLowerCase/isUpperCase need to match the Unicode Standard
sherman
parents: 5506
diff changeset
    74
    int getPropertiesEx(int ch) {
d930011fd275 7037261: j.l.Character.isLowerCase/isUpperCase need to match the Unicode Standard
sherman
parents: 5506
diff changeset
    75
        char offset = (char)ch;
d930011fd275 7037261: j.l.Character.isLowerCase/isUpperCase need to match the Unicode Standard
sherman
parents: 5506
diff changeset
    76
        int props = $$LookupEx(offset);
d930011fd275 7037261: j.l.Character.isLowerCase/isUpperCase need to match the Unicode Standard
sherman
parents: 5506
diff changeset
    77
        return props;
d930011fd275 7037261: j.l.Character.isLowerCase/isUpperCase need to match the Unicode Standard
sherman
parents: 5506
diff changeset
    78
    }
d930011fd275 7037261: j.l.Character.isLowerCase/isUpperCase need to match the Unicode Standard
sherman
parents: 5506
diff changeset
    79
d930011fd275 7037261: j.l.Character.isLowerCase/isUpperCase need to match the Unicode Standard
sherman
parents: 5506
diff changeset
    80
    boolean isOtherLowercase(int ch) {
d930011fd275 7037261: j.l.Character.isLowerCase/isUpperCase need to match the Unicode Standard
sherman
parents: 5506
diff changeset
    81
        int props = getPropertiesEx(ch);
d930011fd275 7037261: j.l.Character.isLowerCase/isUpperCase need to match the Unicode Standard
sherman
parents: 5506
diff changeset
    82
        return (props & $$maskOtherLowercase) != 0;
d930011fd275 7037261: j.l.Character.isLowerCase/isUpperCase need to match the Unicode Standard
sherman
parents: 5506
diff changeset
    83
    }
d930011fd275 7037261: j.l.Character.isLowerCase/isUpperCase need to match the Unicode Standard
sherman
parents: 5506
diff changeset
    84
d930011fd275 7037261: j.l.Character.isLowerCase/isUpperCase need to match the Unicode Standard
sherman
parents: 5506
diff changeset
    85
    boolean isOtherUppercase(int ch) {
d930011fd275 7037261: j.l.Character.isLowerCase/isUpperCase need to match the Unicode Standard
sherman
parents: 5506
diff changeset
    86
        int props = getPropertiesEx(ch);
d930011fd275 7037261: j.l.Character.isLowerCase/isUpperCase need to match the Unicode Standard
sherman
parents: 5506
diff changeset
    87
        return (props & $$maskOtherUppercase) != 0;
d930011fd275 7037261: j.l.Character.isLowerCase/isUpperCase need to match the Unicode Standard
sherman
parents: 5506
diff changeset
    88
    }
d930011fd275 7037261: j.l.Character.isLowerCase/isUpperCase need to match the Unicode Standard
sherman
parents: 5506
diff changeset
    89
d930011fd275 7037261: j.l.Character.isLowerCase/isUpperCase need to match the Unicode Standard
sherman
parents: 5506
diff changeset
    90
    boolean isOtherAlphabetic(int ch) {
d930011fd275 7037261: j.l.Character.isLowerCase/isUpperCase need to match the Unicode Standard
sherman
parents: 5506
diff changeset
    91
        int props = getPropertiesEx(ch);
d930011fd275 7037261: j.l.Character.isLowerCase/isUpperCase need to match the Unicode Standard
sherman
parents: 5506
diff changeset
    92
        return (props & $$maskOtherAlphabetic) != 0;
d930011fd275 7037261: j.l.Character.isLowerCase/isUpperCase need to match the Unicode Standard
sherman
parents: 5506
diff changeset
    93
    }
d930011fd275 7037261: j.l.Character.isLowerCase/isUpperCase need to match the Unicode Standard
sherman
parents: 5506
diff changeset
    94
d930011fd275 7037261: j.l.Character.isLowerCase/isUpperCase need to match the Unicode Standard
sherman
parents: 5506
diff changeset
    95
    boolean isIdeographic(int ch) {
d930011fd275 7037261: j.l.Character.isLowerCase/isUpperCase need to match the Unicode Standard
sherman
parents: 5506
diff changeset
    96
        int props = getPropertiesEx(ch);
d930011fd275 7037261: j.l.Character.isLowerCase/isUpperCase need to match the Unicode Standard
sherman
parents: 5506
diff changeset
    97
        return (props & $$maskIdeographic) != 0;
d930011fd275 7037261: j.l.Character.isLowerCase/isUpperCase need to match the Unicode Standard
sherman
parents: 5506
diff changeset
    98
    }
d930011fd275 7037261: j.l.Character.isLowerCase/isUpperCase need to match the Unicode Standard
sherman
parents: 5506
diff changeset
    99
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
    int getType(int ch) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
        int props = getProperties(ch);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
        return (props & $$maskType);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
    boolean isJavaIdentifierStart(int ch) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
        int props = getProperties(ch);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
        return ((props & $$maskIdentifierInfo) >= $$lowJavaStart);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
    boolean isJavaIdentifierPart(int ch) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
        int props = getProperties(ch);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
        return ((props & $$nonzeroJavaPart) != 0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
    boolean isUnicodeIdentifierStart(int ch) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
        int props = getProperties(ch);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
        return ((props & $$maskIdentifierInfo) == $$valueUnicodeStart);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
    boolean isUnicodeIdentifierPart(int ch) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
        int props = getProperties(ch);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
        return ((props & $$maskUnicodePart) != 0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
    boolean isIdentifierIgnorable(int ch) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
        int props = getProperties(ch);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
        return ((props & $$maskIdentifierInfo) == $$valueIgnorable);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
    int toLowerCase(int ch) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
        int mapChar = ch;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
        int val = getProperties(ch);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
        if ((val & $$maskLowerCase) != 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
            int offset = val << $$shiftCaseOffsetSign >> ($$shiftCaseOffsetSign+$$shiftCaseOffset);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
            mapChar = ch + offset;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
        return mapChar;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
    int toUpperCase(int ch) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
        int mapChar = ch;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
        int val = getProperties(ch);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
        if ((val & $$maskUpperCase) != 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
            int offset = val  << $$shiftCaseOffsetSign >> ($$shiftCaseOffsetSign+$$shiftCaseOffset);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
            mapChar =  ch - offset;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
        return mapChar;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
    int toTitleCase(int ch) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
        int mapChar = ch;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
        int val = getProperties(ch);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
        if ((val & $$maskTitleCase) != 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
            // There is a titlecase equivalent.  Perform further checks:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
            if ((val & $$maskUpperCase) == 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
                // The character does not have an uppercase equivalent, so it must
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
                // already be uppercase; so add 1 to get the titlecase form.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
                mapChar = ch + 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
            else if ((val & $$maskLowerCase) == 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
                // The character does not have a lowercase equivalent, so it must
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
                // already be lowercase; so subtract 1 to get the titlecase form.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
                mapChar = ch - 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
            // else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
            // The character has both an uppercase equivalent and a lowercase
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
            // equivalent, so it must itself be a titlecase form; return it.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
            // return ch;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
            //}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
        else if ((val & $$maskUpperCase) != 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
            // This character has no titlecase equivalent but it does have an
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
            // uppercase equivalent, so use that (subtract the signed case offset).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
            mapChar = toUpperCase(ch);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
        return mapChar;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
    int digit(int ch, int radix) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
        int value = -1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
        if (radix >= Character.MIN_RADIX && radix <= Character.MAX_RADIX) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
            int val = getProperties(ch);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
            int kind = val & $$maskType;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
            if (kind == Character.DECIMAL_DIGIT_NUMBER) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
                value = ch + ((val & $$maskDigitOffset) >> $$shiftDigitOffset) & $$maskDigit;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
            else if ((val & $$maskNumericType) == $$valueJavaSupradecimal) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
                // Java supradecimal digit
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
                value = (ch + ((val & $$maskDigitOffset) >> $$shiftDigitOffset) & $$maskDigit) + 10;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
        return (value < radix) ? value : -1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
    int getNumericValue(int ch) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
        int val = getProperties(ch);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
        int retval = -1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
        switch (val & $$maskNumericType) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
        default: // cannot occur
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
        case ($$valueNotNumeric):         // not numeric
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
            retval = -1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
        case ($$valueDigit):              // simple numeric
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
            retval = ch + ((val & $$maskDigitOffset) >> $$shiftDigitOffset) & $$maskDigit;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
        case ($$valueStrangeNumeric)      :       // "strange" numeric
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
            retval = -2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
        case ($$valueJavaSupradecimal):           // Java supradecimal
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
            retval = (ch + ((val & $$maskDigitOffset) >> $$shiftDigitOffset) & $$maskDigit) + 10;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
        return retval;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
52979
7384e00d5860 8213754: PPC64: Add Intrinsics for isDigit/isLowerCase/isUpperCase/isWhitespace
mhorie
parents: 47216
diff changeset
   220
    boolean isDigit(int ch) {
7384e00d5860 8213754: PPC64: Add Intrinsics for isDigit/isLowerCase/isUpperCase/isWhitespace
mhorie
parents: 47216
diff changeset
   221
        int props = getProperties(ch);
7384e00d5860 8213754: PPC64: Add Intrinsics for isDigit/isLowerCase/isUpperCase/isWhitespace
mhorie
parents: 47216
diff changeset
   222
        return (props & $$maskType) == Character.DECIMAL_DIGIT_NUMBER;
7384e00d5860 8213754: PPC64: Add Intrinsics for isDigit/isLowerCase/isUpperCase/isWhitespace
mhorie
parents: 47216
diff changeset
   223
    }
7384e00d5860 8213754: PPC64: Add Intrinsics for isDigit/isLowerCase/isUpperCase/isWhitespace
mhorie
parents: 47216
diff changeset
   224
7384e00d5860 8213754: PPC64: Add Intrinsics for isDigit/isLowerCase/isUpperCase/isWhitespace
mhorie
parents: 47216
diff changeset
   225
    boolean isLowerCase(int ch) {
7384e00d5860 8213754: PPC64: Add Intrinsics for isDigit/isLowerCase/isUpperCase/isWhitespace
mhorie
parents: 47216
diff changeset
   226
        int props = getProperties(ch);
7384e00d5860 8213754: PPC64: Add Intrinsics for isDigit/isLowerCase/isUpperCase/isWhitespace
mhorie
parents: 47216
diff changeset
   227
        return (props & $$maskType) == Character.LOWERCASE_LETTER;
7384e00d5860 8213754: PPC64: Add Intrinsics for isDigit/isLowerCase/isUpperCase/isWhitespace
mhorie
parents: 47216
diff changeset
   228
    }
7384e00d5860 8213754: PPC64: Add Intrinsics for isDigit/isLowerCase/isUpperCase/isWhitespace
mhorie
parents: 47216
diff changeset
   229
7384e00d5860 8213754: PPC64: Add Intrinsics for isDigit/isLowerCase/isUpperCase/isWhitespace
mhorie
parents: 47216
diff changeset
   230
    boolean isUpperCase(int ch) {
7384e00d5860 8213754: PPC64: Add Intrinsics for isDigit/isLowerCase/isUpperCase/isWhitespace
mhorie
parents: 47216
diff changeset
   231
        int props = getProperties(ch);
7384e00d5860 8213754: PPC64: Add Intrinsics for isDigit/isLowerCase/isUpperCase/isWhitespace
mhorie
parents: 47216
diff changeset
   232
        return (props & $$maskType) == Character.UPPERCASE_LETTER;
7384e00d5860 8213754: PPC64: Add Intrinsics for isDigit/isLowerCase/isUpperCase/isWhitespace
mhorie
parents: 47216
diff changeset
   233
    }
7384e00d5860 8213754: PPC64: Add Intrinsics for isDigit/isLowerCase/isUpperCase/isWhitespace
mhorie
parents: 47216
diff changeset
   234
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
    boolean isWhitespace(int ch) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
        return (getProperties(ch) & $$maskIdentifierInfo) == $$valueJavaWhitespace;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
    byte getDirectionality(int ch) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
        int val = getProperties(ch);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
        byte directionality = (byte)((val & $$maskBidi) >> $$shiftBidi);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
        if (directionality == 0xF ) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
	        directionality = Character.DIRECTIONALITY_UNDEFINED;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
        return directionality;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
    boolean isMirrored(int ch) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
        return (getProperties(ch) & $$maskMirrored) != 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
    static final CharacterData instance = new CharacterData02();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
    private CharacterData02() {};
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
    $$Tables
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
    static {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
        $$Initializers
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
    }        
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
}