match.pd: Relax some tree_nop_conversion_p
[official-gcc.git] / libjava / include / jni_md.h
blob7709c0bc48672bf37a4793a3438d1d82b21a898d
1 /* jni_md.h
2 Copyright (C) 2001, 2005, 2007, 2010, 2011 Free Software Foundation, Inc.
4 This file is part of GNU Classpath.
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.
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.
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.
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. */
27 #ifndef __GCJ_JNI_MD_H__
28 #define __GCJ_JNI_MD_H__
30 #include <gcj/libgcj-config.h>
32 #ifdef __GCJ_JNI_IMPL__
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>
41 typedef gnu::gcj::runtime::JNIWeakRef *jweak;
43 typedef struct _Jv_JNIEnv JNIEnv;
44 typedef struct _Jv_JavaVM JavaVM;
46 #define JNI_TRUE true
47 #define JNI_FALSE false
49 /* We defined jobject and friends, so don't redefine them in jni.h. */
50 #define _CLASSPATH_VM_JNI_TYPES_DEFINED
52 /* We defined jmethodID and and jfieldID, so don't redefine them in
53 jni.h. */
54 #define _CLASSPATH_VM_INTERNAL_TYPES_DEFINED
56 /* Contents of the JNIEnv; but only inside the implementation. */
57 #define _CLASSPATH_JNIENV_CONTENTS \
58 /* The current exception. */ \
59 jthrowable ex; \
61 /* The chain of local frames. */ \
62 struct _Jv_JNI_LocalFrame *locals; \
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;
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
78 #else /* __GCJ_JNI_IMPL__ */
80 # ifdef __GNUC__
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;
96 # else /* __GNUC__ */
98 # ifdef JV_HAVE_INTTYPES_H
100 /* If <inttypes.h> is available, we use it. */
102 # include <inttypes.h>
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;
114 # else /* JV_HAVE_INTTYPES_H */
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
121 # endif /* JV_HAVE_INTTYPES_H */
123 # endif /* __GNUC__ */
125 #endif /* __GCJ_JNI_IMPL__ */
128 /* Linkage and calling conventions. */
129 #if (defined (_WIN32) || defined (__WIN32__) || defined (WIN32)) \
130 && !defined (_WIN64)
132 #define JNIIMPORT __declspec(dllimport)
133 #define JNIEXPORT __declspec(dllexport)
135 #ifndef JNICALL
136 #define JNICALL __stdcall
137 #endif
139 #else /* !( _WIN32 || __WIN32__ || WIN32) || _WIN64 */
141 #define JNIIMPORT
142 #if defined(__GNUC__) && __GNUC__ > 3
143 #define JNIEXPORT __attribute__ ((visibility("default")))
144 #else
145 #define JNIEXPORT
146 #endif
148 #ifndef JNICALL
149 #define JNICALL
150 #endif
152 #endif /* !( _WIN32 || __WIN32__ || WIN32) || _WIN64 */
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__ */
165 #endif /* __GCJ_JNI_MD_H__ */