PageRenderTime 31ms CodeModel.GetById 15ms RepoModel.GetById 0ms app.codeStats 0ms

/gecko_api/include/jni_md.h

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