|
1 /* |
|
2 * Copyright 2005-2006 Sun Microsystems, Inc. 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. Sun designates this |
|
8 * particular file as subject to the "Classpath" exception as provided |
|
9 * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
|
22 * CA 95054 USA or visit www.sun.com if you need additional information or |
|
23 * have any questions. |
|
24 */ |
|
25 |
|
26 #ifndef _JLI_UTIL_H |
|
27 #define _JLI_UTIL_H |
|
28 |
|
29 #include <stdlib.h> |
|
30 #include <jni.h> |
|
31 |
|
32 void *JLI_MemAlloc(size_t size); |
|
33 void *JLI_MemRealloc(void *ptr, size_t size); |
|
34 char *JLI_StringDup(const char *s1); |
|
35 void JLI_MemFree(void *ptr); |
|
36 char **JLI_CopyArgs(int argc, const char **iargv); |
|
37 int JLI_StrCCmp(const char *s1, const char* s2); |
|
38 |
|
39 |
|
40 #define JLI_StrLen(p1) strlen((p1)) |
|
41 #define JLI_StrChr(p1, p2) strchr((p1), (p2)) |
|
42 #define JLI_StrRChr(p1, p2) strrchr((p1), (p2)) |
|
43 #define JLI_StrCmp(p1, p2) strcmp((p1), (p2)) |
|
44 #define JLI_StrNCmp(p1, p2, p3) strncmp((p1), (p2), (p3)) |
|
45 #define JLI_StrCat(p1, p2) strcat((p1), (p2)) |
|
46 #define JLI_StrCpy(p1, p2) strcpy((p1), (p2)) |
|
47 #define JLI_StrNCpy(p1, p2, p3) strncpy((p1), (p2), (p3)) |
|
48 #define JLI_StrStr(p1, p2) strstr((p1), (p2)) |
|
49 #define JLI_StrSpn(p1, p2) strspn((p1), (p2)) |
|
50 #define JLI_StrCSpn(p1, p2) strcspn((p1), (p2)) |
|
51 #define JLI_StrPBrk(p1, p2) strpbrk((p1), (p2)) |
|
52 |
|
53 /* On Windows lseek() is in io.h rather than the location dictated by POSIX. */ |
|
54 #ifdef _WIN32 |
|
55 #include <windows.h> |
|
56 #include <io.h> |
|
57 #define JLI_StrCaseCmp(p1, p2) stricmp((p1), (p2)) |
|
58 #define JLI_StrNCaseCmp(p1, p2, p3) strnicmp((p1), (p2), (p3)) |
|
59 #else |
|
60 #include <unistd.h> |
|
61 #define JLI_StrCaseCmp(p1, p2) strcasecmp((p1), (p2)) |
|
62 #define JLI_StrNCaseCmp(p1, p2, p3) strncasecmp((p1), (p2), (p3)) |
|
63 #endif /* _WIN32 */ |
|
64 |
|
65 /* |
|
66 * Make launcher spit debug output. |
|
67 */ |
|
68 void JLI_TraceLauncher(const char* fmt, ...); |
|
69 void JLI_SetTraceLauncher(); |
|
70 jboolean JLI_IsTraceLauncher(); |
|
71 |
|
72 #endif /* _JLI_UTIL_H */ |