| 1 |
757 |
jeremybenn |
/* jni_md.h
|
| 2 |
|
|
Copyright (C) 2001, 2005, 2007, 2010 Free Software Foundation, Inc.
|
| 3 |
|
|
|
| 4 |
|
|
This file is part of GNU Classpath.
|
| 5 |
|
|
|
| 6 |
|
|
GNU Classpath is free software; you can redistribute it and/or modify
|
| 7 |
|
|
it under the terms of the GNU General Public License as published by
|
| 8 |
|
|
the Free Software Foundation; either version 2, or (at your option)
|
| 9 |
|
|
any later version.
|
| 10 |
|
|
|
| 11 |
|
|
GNU Classpath is distributed in the hope that it will be useful, but
|
| 12 |
|
|
WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 13 |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
| 14 |
|
|
General Public License for more details.
|
| 15 |
|
|
|
| 16 |
|
|
You should have received a copy of the GNU General Public License
|
| 17 |
|
|
along with GNU Classpath; see the file COPYING. If not, write to the
|
| 18 |
|
|
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
| 19 |
|
|
02110-1301 USA.
|
| 20 |
|
|
|
| 21 |
|
|
As a special exception, if you link this library with other files to
|
| 22 |
|
|
produce an executable, this library does not by itself cause the
|
| 23 |
|
|
resulting executable to be covered by the GNU General Public License.
|
| 24 |
|
|
This exception does not however invalidate any other reasons why the
|
| 25 |
|
|
executable file might be covered by the GNU General Public License. */
|
| 26 |
|
|
|
| 27 |
|
|
#ifndef __GCJ_JNI_MD_H__
|
| 28 |
|
|
#define __GCJ_JNI_MD_H__
|
| 29 |
|
|
|
| 30 |
|
|
#include <gcj/libgcj-config.h>
|
| 31 |
|
|
|
| 32 |
|
|
#ifdef __GCJ_JNI_IMPL__
|
| 33 |
|
|
|
| 34 |
|
|
/* If __GCJ_JNI_IMPL__ is defined, then we assume that we're building
|
| 35 |
|
|
libgcj itself, and we include headers which taint the namespace
|
| 36 |
|
|
more than is acceptable for the ordinary JNI user. */
|
| 37 |
|
|
#include <gcj/javaprims.h>
|
| 38 |
|
|
#include <gcj/array.h>
|
| 39 |
|
|
#include <gnu/gcj/runtime/JNIWeakRef.h>
|
| 40 |
|
|
|
| 41 |
|
|
typedef gnu::gcj::runtime::JNIWeakRef *jweak;
|
| 42 |
|
|
|
| 43 |
|
|
typedef struct _Jv_JNIEnv JNIEnv;
|
| 44 |
|
|
typedef struct _Jv_JavaVM JavaVM;
|
| 45 |
|
|
|
| 46 |
|
|
#define JNI_TRUE true
|
| 47 |
|
|
#define JNI_FALSE false
|
| 48 |
|
|
|
| 49 |
|
|
/* We defined jobject and friends, so don't redefine them in jni.h. */
|
| 50 |
|
|
#define _CLASSPATH_VM_JNI_TYPES_DEFINED
|
| 51 |
|
|
|
| 52 |
|
|
/* We defined jmethodID and and jfieldID, so don't redefine them in
|
| 53 |
|
|
jni.h. */
|
| 54 |
|
|
#define _CLASSPATH_VM_INTERNAL_TYPES_DEFINED
|
| 55 |
|
|
|
| 56 |
|
|
/* Contents of the JNIEnv; but only inside the implementation. */
|
| 57 |
|
|
#define _CLASSPATH_JNIENV_CONTENTS \
|
| 58 |
|
|
/* The current exception. */ \
|
| 59 |
|
|
jthrowable ex; \
|
| 60 |
|
|
\
|
| 61 |
|
|
/* The chain of local frames. */ \
|
| 62 |
|
|
struct _Jv_JNI_LocalFrame *locals; \
|
| 63 |
|
|
\
|
| 64 |
|
|
/* The bottom-most element of the chain, initialized with the env and \
|
| 65 |
|
|
reused between non-nesting JNI calls. */ \
|
| 66 |
|
|
struct _Jv_JNI_LocalFrame *bottom_locals;
|
| 67 |
|
|
|
| 68 |
|
|
/* JNI calling convention. Also defined in javaprims.h. */
|
| 69 |
|
|
#ifndef JNICALL
|
| 70 |
|
|
#if (defined (_WIN32) || defined (__WIN32__) || defined (WIN32)) \
|
| 71 |
|
|
&& !defined (_WIN64)
|
| 72 |
|
|
#define JNICALL __stdcall
|
| 73 |
|
|
#else
|
| 74 |
|
|
#define JNICALL
|
| 75 |
|
|
#endif
|
| 76 |
|
|
#endif
|
| 77 |
|
|
|
| 78 |
|
|
#else /* __GCJ_JNI_IMPL__ */
|
| 79 |
|
|
|
| 80 |
|
|
# ifdef __GNUC__
|
| 81 |
|
|
|
| 82 |
|
|
/* If we're using gcc, we can use a platform-independent scheme to get
|
| 83 |
|
|
the right integer types. FIXME: this is not always correct, for
|
| 84 |
|
|
instance on the c4x it will be wrong -- it depends on whether
|
| 85 |
|
|
QImode is 8 bits. */
|
| 86 |
|
|
typedef int jbyte __attribute__((__mode__(__QI__)));
|
| 87 |
|
|
typedef int jshort __attribute__((__mode__(__HI__)));
|
| 88 |
|
|
typedef int jint __attribute__((__mode__(__SI__)));
|
| 89 |
|
|
typedef int jlong __attribute__((__mode__(__DI__)));
|
| 90 |
|
|
typedef unsigned int jboolean __attribute__((__mode__(__QI__)));
|
| 91 |
|
|
typedef unsigned short jchar __attribute__((__mode__(__HI__)));
|
| 92 |
|
|
typedef float jfloat;
|
| 93 |
|
|
typedef double jdouble;
|
| 94 |
|
|
typedef jint jsize;
|
| 95 |
|
|
|
| 96 |
|
|
# else /* __GNUC__ */
|
| 97 |
|
|
|
| 98 |
|
|
# ifdef JV_HAVE_INTTYPES_H
|
| 99 |
|
|
|
| 100 |
|
|
/* If <inttypes.h> is available, we use it. */
|
| 101 |
|
|
|
| 102 |
|
|
# include <inttypes.h>
|
| 103 |
|
|
|
| 104 |
|
|
typedef int8_t jbyte;
|
| 105 |
|
|
typedef int16_t jshort;
|
| 106 |
|
|
typedef int32_t jint;
|
| 107 |
|
|
typedef int64_t jlong;
|
| 108 |
|
|
typedef float jfloat;
|
| 109 |
|
|
typedef double jdouble;
|
| 110 |
|
|
typedef jint jsize;
|
| 111 |
|
|
typedef uint8_t jboolean;
|
| 112 |
|
|
typedef uint16_t jchar;
|
| 113 |
|
|
|
| 114 |
|
|
# else /* JV_HAVE_INTTYPES_H */
|
| 115 |
|
|
|
| 116 |
|
|
/* For now, we require either gcc or <inttypes.h>. If we did more
|
| 117 |
|
|
work at configure time we could get around this, but right now it
|
| 118 |
|
|
doesn't seem worth it. */
|
| 119 |
|
|
# error jni.h not ported to this platform
|
| 120 |
|
|
|
| 121 |
|
|
# endif /* JV_HAVE_INTTYPES_H */
|
| 122 |
|
|
|
| 123 |
|
|
# endif /* __GNUC__ */
|
| 124 |
|
|
|
| 125 |
|
|
#endif /* __GCJ_JNI_IMPL__ */
|
| 126 |
|
|
|
| 127 |
|
|
|
| 128 |
|
|
/* Linkage and calling conventions. */
|
| 129 |
|
|
#if (defined (_WIN32) || defined (__WIN32__) || defined (WIN32)) \
|
| 130 |
|
|
&& !defined (_WIN64)
|
| 131 |
|
|
|
| 132 |
|
|
#define JNIIMPORT __declspec(dllimport)
|
| 133 |
|
|
#define JNIEXPORT __declspec(dllexport)
|
| 134 |
|
|
|
| 135 |
|
|
#ifndef JNICALL
|
| 136 |
|
|
#define JNICALL __stdcall
|
| 137 |
|
|
#endif
|
| 138 |
|
|
|
| 139 |
|
|
#else /* !( _WIN32 || __WIN32__ || WIN32) || _WIN64 */
|
| 140 |
|
|
|
| 141 |
|
|
#define JNIIMPORT
|
| 142 |
|
|
#if defined(__GNUC__) && __GNUC__ > 3
|
| 143 |
|
|
#define JNIEXPORT __attribute__ ((visibility("default")))
|
| 144 |
|
|
#else
|
| 145 |
|
|
#define JNIEXPORT
|
| 146 |
|
|
#endif
|
| 147 |
|
|
|
| 148 |
|
|
#ifndef JNICALL
|
| 149 |
|
|
#define JNICALL
|
| 150 |
|
|
#endif
|
| 151 |
|
|
|
| 152 |
|
|
#endif /* !( _WIN32 || __WIN32__ || WIN32) || _WIN64 */
|
| 153 |
|
|
|
| 154 |
|
|
/* These defines apply to symbols in libgcj */
|
| 155 |
|
|
#ifdef __GCJ_DLL__
|
| 156 |
|
|
# ifdef __GCJ_JNI_IMPL__
|
| 157 |
|
|
# define _CLASSPATH_JNIIMPEXP JNIEXPORT
|
| 158 |
|
|
# else
|
| 159 |
|
|
# define _CLASSPATH_JNIIMPEXP JNIIMPORT
|
| 160 |
|
|
# endif /* ! __GCJ_JNI_IMPL__ */
|
| 161 |
|
|
#else /* ! __GCJ_DLL__ */
|
| 162 |
|
|
# define _CLASSPATH_JNIIMPEXP
|
| 163 |
|
|
#endif /* __GCJ_DLL__ */
|
| 164 |
|
|
|
| 165 |
|
|
#endif /* __GCJ_JNI_MD_H__ */
|