In gcc/objc/: 2010-12-30 Nicola Pero <nicola.pero@meta-innovation.com>
[official-gcc.git] / libjava / include / jni_md.h
blobf65a15c5659da66384f24bafa89ce8c753411d2d
1 /* jni_md.h
2 Copyright (C) 2001, 2005, 2007 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;
69 #else /* __GCJ_JNI_IMPL__ */
71 # ifdef __GNUC__
73 /* If we're using gcc, we can use a platform-independent scheme to get
74 the right integer types. FIXME: this is not always correct, for
75 instance on the c4x it will be wrong -- it depends on whether
76 QImode is 8 bits. */
77 typedef int jbyte __attribute__((__mode__(__QI__)));
78 typedef int jshort __attribute__((__mode__(__HI__)));
79 typedef int jint __attribute__((__mode__(__SI__)));
80 typedef int jlong __attribute__((__mode__(__DI__)));
81 typedef unsigned int jboolean __attribute__((__mode__(__QI__)));
82 typedef unsigned short jchar __attribute__((__mode__(__HI__)));
83 typedef float jfloat;
84 typedef double jdouble;
85 typedef jint jsize;
87 # else /* __GNUC__ */
89 # ifdef JV_HAVE_INTTYPES_H
91 /* If <inttypes.h> is available, we use it. */
93 # include <inttypes.h>
95 typedef int8_t jbyte;
96 typedef int16_t jshort;
97 typedef int32_t jint;
98 typedef int64_t jlong;
99 typedef float jfloat;
100 typedef double jdouble;
101 typedef jint jsize;
102 typedef uint8_t jboolean;
103 typedef uint16_t jchar;
105 # else /* JV_HAVE_INTTYPES_H */
107 /* For now, we require either gcc or <inttypes.h>. If we did more
108 work at configure time we could get around this, but right now it
109 doesn't seem worth it. */
110 # error jni.h not ported to this platform
112 # endif /* JV_HAVE_INTTYPES_H */
114 # endif /* __GNUC__ */
116 #endif /* __GCJ_JNI_IMPL__ */
119 /* Linkage and calling conventions. */
120 #if defined (_WIN32) || defined (__WIN32__) || defined (WIN32)
122 #define JNIIMPORT __declspec(dllimport)
123 #define JNIEXPORT __declspec(dllexport)
125 #define JNICALL __stdcall
127 #else /* !( _WIN32 || __WIN32__ || WIN32) */
129 #define JNIIMPORT
130 #if defined(__GNUC__) && __GNUC__ > 3
131 #define JNIEXPORT __attribute__ ((visibility("default")))
132 #else
133 #define JNIEXPORT
134 #endif
136 #define JNICALL
138 #endif /* !( _WIN32 || __WIN32__ || WIN32) */
140 /* These defines apply to symbols in libgcj */
141 #ifdef __GCJ_DLL__
142 # ifdef __GCJ_JNI_IMPL__
143 # define _CLASSPATH_JNIIMPEXP JNIEXPORT
144 # else
145 # define _CLASSPATH_JNIIMPEXP JNIIMPORT
146 # endif /* ! __GCJ_JNI_IMPL__ */
147 #else /* ! __GCJ_DLL__ */
148 # define _CLASSPATH_JNIIMPEXP
149 #endif /* __GCJ_DLL__ */
151 #endif /* __GCJ_JNI_MD_H__ */