summaryrefslogtreecommitdiffstats
path: root/luni/src/main/native/java_lang_Character.cpp
blob: c1324d6ddda51d270a5fe4e0f1a8260d6687e72d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
//
//  java_lang_Character.cpp
//  Android
//
//  Copyright 2006 The Android Open Source Project
//
#include "JNIHelp.h"
#include "AndroidSystemNatives.h"

//#define LOG_TAG "Character"
//#include "utils/Log.h"
#include "utils/AndroidUnicode.h"

#include <stdlib.h>


using namespace android;

/*
 * native private static int nativeGetData(int c)
 */
static jint getData(JNIEnv* env, jclass clazz, jint val)
{
    return Unicode::getPackedData(val);
}

/*
 * native private static int nativeToLower(int c)
 */
static jint toLower(JNIEnv* env, jclass clazz, jint val)
{
    return Unicode::toLower(val);
}

/*
 * native private static int nativeToUpper(int c)
 */
static jint toUpper(JNIEnv* env, jclass clazz, jint val)
{
    return Unicode::toUpper(val);
}

/*
 * native private static int nativeNumericValue(int c)
 */
static jint numericValue(JNIEnv* env, jclass clazz, jint val)
{
    return Unicode::getNumericValue(val);
}

/*
 * native private static int nativeToTitle(int c)
 */
static jint toTitle(JNIEnv* env, jclass clazz, jint val)
{
    return Unicode::toTitle(val);
}

/*
 * JNI registration
 */
static JNINativeMethod gMethods[] = {
    /* name, signature, funcPtr */
    { "nativeGetData",          "(I)I",     (void*) getData },
    { "nativeToLower",          "(I)I",     (void*) toLower },
    { "nativeToUpper",          "(I)I",     (void*) toUpper },
    { "nativeNumericValue",     "(I)I",     (void*) numericValue },
    { "nativeToTitle",          "(I)I",     (void*) toTitle },
};
int register_java_lang_Character(JNIEnv* env)
{
    return jniRegisterNativeMethods(env, "java/lang/Character",
        gMethods, NELEM(gMethods));
}