add more spacing
[personal-kdebase.git] / apps / nsplugins / sdk / jni_md.h
blob7566f19917133c64fe1545841a69c1d6084048b6
1 //krazy:excludeall=copyright
2 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
4 * ***** BEGIN LICENSE BLOCK *****
5 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
7 * The contents of this file are subject to the Mozilla Public License Version
8 * 1.1 (the "License"); you may not use this file except in compliance with
9 * the License. You may obtain a copy of the License at
10 * http://www.mozilla.org/MPL/
12 * Software distributed under the License is distributed on an "AS IS" basis,
13 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
14 * for the specific language governing rights and limitations under the
15 * License.
17 * The Original Code is mozilla.org code.
19 * The Initial Developer of the Original Code is
20 * Netscape Communications Corporation.
21 * Portions created by the Initial Developer are Copyright (C) 1998
22 * the Initial Developer. All Rights Reserved.
24 * Contributor(s):
26 * Alternatively, the contents of this file may be used under the terms of
27 * either the GNU General Public License Version 2 or later (the "GPL"), or
28 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
29 * in which case the provisions of the GPL or the LGPL are applicable instead
30 * of those above. If you wish to allow use of your version of this file only
31 * under the terms of either the GPL or the LGPL, and not to allow others to
32 * use your version of this file under the terms of the MPL, indicate your
33 * decision by deleting the provisions above and replace them with the notice
34 * and other provisions required by the GPL or the LGPL. If you do not delete
35 * the provisions above, a recipient may use your version of this file under
36 * the terms of any one of the MPL, the GPL or the LGPL.
38 * ***** END LICENSE BLOCK *****
41 * This Original Code has been modified by IBM Corporation.
42 * Modifications made by IBM described herein are
43 * Copyright (c) International Business Machines
44 * Corporation, 2000
46 * Modifications to Mozilla code or documentation
47 * identified per MPL Section 3.3
49 * Date Modified by Description of modification
50 * 03/27/2000 IBM Corp. Set JNICALL to Optlink for
51 * use in OS2
54 /*******************************************************************************
55 * Netscape version of jni_md.h -- depends on jri_md.h
56 ******************************************************************************/
58 #ifndef JNI_MD_H
59 #define JNI_MD_H
61 #include "prtypes.h" /* needed for _declspec */
63 /*******************************************************************************
64 * WHAT'S UP WITH THIS FILE?
66 * This is where we define the mystical JNI_PUBLIC_API macro that works on all
67 * platforms. If you're running with Visual C++, Symantec C, or Borland's
68 * development environment on the PC, you're all set. Or if you're on the Mac
69 * with Metrowerks, Symantec or MPW with SC you're ok too. For UNIX it shouldn't
70 * matter.
72 * Changes by sailesh on 9/26
74 * There are two symbols used in the declaration of the JNI functions
75 * and native code that uses the JNI:
76 * JNICALL - specifies the calling convention
77 * JNIEXPORT - specifies export status of the function
79 * The syntax to specify calling conventions is different in Win16 and
80 * Win32 - the brains at Micro$oft at work here. JavaSoft in their
81 * infinite wisdom cares for no platform other than Win32, and so they
82 * just define these two symbols as:
84 #define JNIEXPORT __declspec(dllexport)
85 #define JNICALL __stdcall
87 * We deal with this, in the way JRI defines the JRI_PUBLIC_API, by
88 * defining a macro called JNI_PUBLIC_API. Any of our developers who
89 * wish to use code for Win16 and Win32, _must_ use JNI_PUBLIC_API to
90 * be able to export functions properly.
92 * Since we must also maintain compatibility with JavaSoft, we
93 * continue to define the symbol JNIEXPORT. However, use of this
94 * internally is deprecated, since it will cause a mess on Win16.
96 * We _do not_ need a new symbol called JNICALL. Instead we
97 * redefine JNICALL in the same way JRI_CALLBACK was defined.
99 ******************************************************************************/
101 /* DLL Entry modifiers... */
102 #if defined(XP_OS2)
103 # ifdef XP_OS2_VACPP
104 # define JNI_PUBLIC_API(ResultType) ResultType _System
105 # define JNI_PUBLIC_VAR(VarType) VarType
106 # define JNICALL _Optlink
107 # define JNIEXPORT
108 # else
109 # define JNI_PUBLIC_API(ResultType) ResultType
110 # define JNI_PUBLIC_VAR(VarType) VarType
111 # define JNICALL
112 # define JNIEXPORT
113 # endif
114 /* Win32 */
115 #elif defined(XP_WIN) || defined(_WINDOWS) || defined(WIN32) || defined(_WIN32)
116 # include <windows.h>
117 # if defined(_MSC_VER) || defined(__GNUC__)
118 # if defined(WIN32) || defined(_WIN32)
119 # define JNI_PUBLIC_API(ResultType) _declspec(dllexport) ResultType __stdcall
120 # define JNI_PUBLIC_VAR(VarType) VarType
121 # define JNI_NATIVE_STUB(ResultType) _declspec(dllexport) ResultType
122 # define JNICALL __stdcall
123 # else /* !_WIN32 */
124 # if defined(_WINDLL)
125 # define JNI_PUBLIC_API(ResultType) ResultType __cdecl __export __loadds
126 # define JNI_PUBLIC_VAR(VarType) VarType
127 # define JNI_NATIVE_STUB(ResultType) ResultType __cdecl __loadds
128 # define JNICALL __loadds
129 # else /* !WINDLL */
130 # define JNI_PUBLIC_API(ResultType) ResultType __cdecl __export
131 # define JNI_PUBLIC_VAR(VarType) VarType
132 # define JNI_NATIVE_STUB(ResultType) ResultType __cdecl __export
133 # define JNICALL __export
134 # endif /* !WINDLL */
135 # endif /* !_WIN32 */
136 # elif defined(__BORLANDC__)
137 # if defined(WIN32) || defined(_WIN32)
138 # define JNI_PUBLIC_API(ResultType) __export ResultType
139 # define JNI_PUBLIC_VAR(VarType) VarType
140 # define JNI_NATIVE_STUB(ResultType) __export ResultType
141 # define JNICALL
142 # else /* !_WIN32 */
143 # define JNI_PUBLIC_API(ResultType) ResultType _cdecl _export _loadds
144 # define JNI_PUBLIC_VAR(VarType) VarType
145 # define JNI_NATIVE_STUB(ResultType) ResultType _cdecl _loadds
146 # define JNICALL _loadds
147 # endif
148 # else
149 # error Unsupported PC development environment.
150 # endif
151 # ifndef IS_LITTLE_ENDIAN
152 # define IS_LITTLE_ENDIAN
153 # endif
154 /* This is the stuff inherited from JavaSoft .. */
155 # define JNIEXPORT __declspec(dllexport)
158 /* Mac */
159 #elif defined(macintosh) || defined(Macintosh) || defined(THINK_C)
160 # if defined(__MWERKS__) /* Metrowerks */
161 # if !__option(enumsalwaysint)
162 # error You need to define 'Enums Always Int' for your project.
163 # endif
164 # if defined(TARGET_CPU_68K) && !TARGET_RT_MAC_CFM
165 # if !__option(fourbyteints)
166 # error You need to define 'Struct Alignment: 68k' for your project.
167 # endif
168 # endif /* !GENERATINGCFM */
169 # define JNI_PUBLIC_API(ResultType) __declspec(export) ResultType
170 # define JNI_PUBLIC_VAR(VarType) JNI_PUBLIC_API(VarType)
171 # define JNI_NATIVE_STUB(ResultType) JNI_PUBLIC_API(ResultType)
172 # elif defined(__SC__) /* Symantec */
173 # error What are the Symantec defines? (warren@netscape.com)
174 # elif macintosh && applec /* MPW */
175 # error Please upgrade to the latest MPW compiler (SC).
176 # else
177 # error Unsupported Mac development environment.
178 # endif
179 # define JNICALL
180 /* This is the stuff inherited from JavaSoft .. */
181 # define JNIEXPORT
183 /* Unix or else */
184 #else
185 # define JNI_PUBLIC_API(ResultType) ResultType
186 # define JNI_PUBLIC_VAR(VarType) VarType
187 # define JNI_NATIVE_STUB(ResultType) ResultType
188 # define JNICALL
189 /* This is the stuff inherited from JavaSoft .. */
190 # define JNIEXPORT
191 #endif
193 #ifndef FAR /* for non-Win16 */
194 #define FAR
195 #endif
197 /* Get the rest of the stuff from jri_md.h */
198 #include "jri_md.h"
200 #endif /* JNI_MD_H */