1 /* |
|
2 * Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved. |
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
|
4 * |
|
5 * This code is free software; you can redistribute it and/or modify it |
|
6 * under the terms of the GNU General Public License version 2 only, as |
|
7 * published by the Free Software Foundation. Oracle designates this |
|
8 * particular file as subject to the "Classpath" exception as provided |
|
9 * by Oracle in the LICENSE file that accompanied this code. |
|
10 * |
|
11 * This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 * version 2 for more details (a copy is included in the LICENSE file that |
|
15 * accompanied this code). |
|
16 * |
|
17 * You should have received a copy of the GNU General Public License version |
|
18 * 2 along with this work; if not, write to the Free Software Foundation, |
|
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 * |
|
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
22 * or visit www.oracle.com if you need additional information or have any |
|
23 * questions. |
|
24 */ |
|
25 |
|
26 /* Routines for various UTF conversions */ |
|
27 |
|
28 #ifndef _UTF_H |
|
29 #define _UTF_H |
|
30 |
|
31 #include <stdio.h> |
|
32 |
|
33 #include "jni.h" |
|
34 #include "utf_md.h" |
|
35 |
|
36 /* Use THIS_FILE when it is available. */ |
|
37 #ifndef THIS_FILE |
|
38 #define THIS_FILE __FILE__ |
|
39 #endif |
|
40 |
|
41 /* Error and assert macros */ |
|
42 #define UTF_ERROR(m) utfError(THIS_FILE, __LINE__, m) |
|
43 #define UTF_ASSERT(x) ( (x)==0 ? UTF_ERROR("ASSERT ERROR " #x) : (void)0 ) |
|
44 |
|
45 void utfError(char *file, int line, char *message); |
|
46 |
|
47 struct UtfInst* JNICALL utfInitialize |
|
48 (char *options); |
|
49 void JNICALL utfTerminate |
|
50 (struct UtfInst *ui, char *options); |
|
51 int JNICALL utf8ToPlatform |
|
52 (struct UtfInst *ui, jbyte *utf8, |
|
53 int len, char *output, int outputMaxLen); |
|
54 int JNICALL utf8FromPlatform |
|
55 (struct UtfInst *ui, char *str, int len, |
|
56 jbyte *output, int outputMaxLen); |
|
57 int JNICALL utf8ToUtf16 |
|
58 (struct UtfInst *ui, jbyte *utf8, int len, |
|
59 jchar *output, int outputMaxLen); |
|
60 int JNICALL utf16ToUtf8m |
|
61 (struct UtfInst *ui, jchar *utf16, int len, |
|
62 jbyte *output, int outputMaxLen); |
|
63 int JNICALL utf16ToUtf8s |
|
64 (struct UtfInst *ui, jchar *utf16, int len, |
|
65 jbyte *output, int outputMaxLen); |
|
66 int JNICALL utf8sToUtf8mLength |
|
67 (struct UtfInst *ui, jbyte *string, int length); |
|
68 void JNICALL utf8sToUtf8m |
|
69 (struct UtfInst *ui, jbyte *string, int length, |
|
70 jbyte *new_string, int new_length); |
|
71 int JNICALL utf8mToUtf8sLength |
|
72 (struct UtfInst *ui, jbyte *string, int length); |
|
73 void JNICALL utf8mToUtf8s |
|
74 (struct UtfInst *ui, jbyte *string, int length, |
|
75 jbyte *new_string, int new_length); |
|
76 |
|
77 #endif |
|