PageRenderTime 78ms CodeModel.GetById 43ms RepoModel.GetById 1ms app.codeStats 0ms

/gecko_api/include/npupp.h

http://firefox-mac-pdf.googlecode.com/
C++ Header | 715 lines | 469 code | 111 blank | 135 comment | 5 complexity | eebdddc61da38eff881a9488844b50fb MD5 | raw file
  1. /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
  2. /* ***** BEGIN LICENSE BLOCK *****
  3. * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  4. *
  5. * The contents of this file are subject to the Mozilla Public License Version
  6. * 1.1 (the "License"); you may not use this file except in compliance with
  7. * the License. You may obtain a copy of the License at
  8. * http://www.mozilla.org/MPL/
  9. *
  10. * Software distributed under the License is distributed on an "AS IS" basis,
  11. * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  12. * for the specific language governing rights and limitations under the
  13. * License.
  14. *
  15. * The Original Code is mozilla.org code.
  16. *
  17. * The Initial Developer of the Original Code is
  18. * Netscape Communications Corporation.
  19. * Portions created by the Initial Developer are Copyright (C) 1998
  20. * the Initial Developer. All Rights Reserved.
  21. *
  22. * Contributor(s):
  23. *
  24. * Alternatively, the contents of this file may be used under the terms of
  25. * either the GNU General Public License Version 2 or later (the "GPL"), or
  26. * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  27. * in which case the provisions of the GPL or the LGPL are applicable instead
  28. * of those above. If you wish to allow use of your version of this file only
  29. * under the terms of either the GPL or the LGPL, and not to allow others to
  30. * use your version of this file under the terms of the MPL, indicate your
  31. * decision by deleting the provisions above and replace them with the notice
  32. * and other provisions required by the GPL or the LGPL. If you do not delete
  33. * the provisions above, a recipient may use your version of this file under
  34. * the terms of any one of the MPL, the GPL or the LGPL.
  35. *
  36. * ***** END LICENSE BLOCK ***** */
  37. /*
  38. * npupp.h $Revision: 3.26 $
  39. * function call mecahnics needed by platform specific glue code.
  40. */
  41. #ifndef _NPUPP_H_
  42. #define _NPUPP_H_
  43. #if defined(__OS2__)
  44. #pragma pack(1)
  45. #endif
  46. #ifndef GENERATINGCFM
  47. #define GENERATINGCFM 0
  48. #endif
  49. #ifndef _NPAPI_H_
  50. #include "npapi.h"
  51. #endif
  52. #include "npruntime.h"
  53. #include "jri.h"
  54. /******************************************************************************************
  55. plug-in function table macros
  56. for each function in and out of the plugin API we define
  57. typedef NPP_FooUPP
  58. #define NewNPP_FooProc
  59. #define CallNPP_FooProc
  60. *******************************************************************************************/
  61. /* NPP_Initialize */
  62. typedef void (* NP_LOADDS NPP_InitializeUPP)(void);
  63. #define NewNPP_InitializeProc(FUNC) \
  64. ((NPP_InitializeUPP) (FUNC))
  65. #define CallNPP_InitializeProc(FUNC) \
  66. (*(FUNC))()
  67. /* NPP_Shutdown */
  68. typedef void (* NP_LOADDS NPP_ShutdownUPP)(void);
  69. #define NewNPP_ShutdownProc(FUNC) \
  70. ((NPP_ShutdownUPP) (FUNC))
  71. #define CallNPP_ShutdownProc(FUNC) \
  72. (*(FUNC))()
  73. /* NPP_New */
  74. typedef NPError (* NP_LOADDS NPP_NewUPP)(NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, char* argn[], char* argv[], NPSavedData* saved);
  75. #define NewNPP_NewProc(FUNC) \
  76. ((NPP_NewUPP) (FUNC))
  77. #define CallNPP_NewProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6, ARG7) \
  78. (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4), (ARG5), (ARG6), (ARG7))
  79. /* NPP_Destroy */
  80. typedef NPError (* NP_LOADDS NPP_DestroyUPP)(NPP instance, NPSavedData** save);
  81. #define NewNPP_DestroyProc(FUNC) \
  82. ((NPP_DestroyUPP) (FUNC))
  83. #define CallNPP_DestroyProc(FUNC, ARG1, ARG2) \
  84. (*(FUNC))((ARG1), (ARG2))
  85. /* NPP_SetWindow */
  86. typedef NPError (* NP_LOADDS NPP_SetWindowUPP)(NPP instance, NPWindow* window);
  87. #define NewNPP_SetWindowProc(FUNC) \
  88. ((NPP_SetWindowUPP) (FUNC))
  89. #define CallNPP_SetWindowProc(FUNC, ARG1, ARG2) \
  90. (*(FUNC))((ARG1), (ARG2))
  91. /* NPP_NewStream */
  92. typedef NPError (* NP_LOADDS NPP_NewStreamUPP)(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16* stype);
  93. #define NewNPP_NewStreamProc(FUNC) \
  94. ((NPP_NewStreamUPP) (FUNC))
  95. #define CallNPP_NewStreamProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5) \
  96. (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4), (ARG5))
  97. /* NPP_DestroyStream */
  98. typedef NPError (* NP_LOADDS NPP_DestroyStreamUPP)(NPP instance, NPStream* stream, NPReason reason);
  99. #define NewNPP_DestroyStreamProc(FUNC) \
  100. ((NPP_DestroyStreamUPP) (FUNC))
  101. #define CallNPP_DestroyStreamProc(FUNC, NPParg, NPStreamPtr, NPReasonArg) \
  102. (*(FUNC))((NPParg), (NPStreamPtr), (NPReasonArg))
  103. /* NPP_WriteReady */
  104. typedef int32 (* NP_LOADDS NPP_WriteReadyUPP)(NPP instance, NPStream* stream);
  105. #define NewNPP_WriteReadyProc(FUNC) \
  106. ((NPP_WriteReadyUPP) (FUNC))
  107. #define CallNPP_WriteReadyProc(FUNC, NPParg, NPStreamPtr) \
  108. (*(FUNC))((NPParg), (NPStreamPtr))
  109. /* NPP_Write */
  110. typedef int32 (* NP_LOADDS NPP_WriteUPP)(NPP instance, NPStream* stream, int32 offset, int32 len, void* buffer);
  111. #define NewNPP_WriteProc(FUNC) \
  112. ((NPP_WriteUPP) (FUNC))
  113. #define CallNPP_WriteProc(FUNC, NPParg, NPStreamPtr, offsetArg, lenArg, bufferPtr) \
  114. (*(FUNC))((NPParg), (NPStreamPtr), (offsetArg), (lenArg), (bufferPtr))
  115. /* NPP_StreamAsFile */
  116. typedef void (* NP_LOADDS NPP_StreamAsFileUPP)(NPP instance, NPStream* stream, const char* fname);
  117. #define NewNPP_StreamAsFileProc(FUNC) \
  118. ((NPP_StreamAsFileUPP) (FUNC))
  119. #define CallNPP_StreamAsFileProc(FUNC, ARG1, ARG2, ARG3) \
  120. (*(FUNC))((ARG1), (ARG2), (ARG3))
  121. /* NPP_Print */
  122. typedef void (* NP_LOADDS NPP_PrintUPP)(NPP instance, NPPrint* platformPrint);
  123. #define NewNPP_PrintProc(FUNC) \
  124. ((NPP_PrintUPP) (FUNC))
  125. #define CallNPP_PrintProc(FUNC, NPParg, NPPrintArg) \
  126. (*(FUNC))((NPParg), (NPPrintArg))
  127. /* NPP_HandleEvent */
  128. typedef int16 (* NP_LOADDS NPP_HandleEventUPP)(NPP instance, void* event);
  129. #define NewNPP_HandleEventProc(FUNC) \
  130. ((NPP_HandleEventUPP) (FUNC))
  131. #define CallNPP_HandleEventProc(FUNC, NPParg, voidPtr) \
  132. (*(FUNC))((NPParg), (voidPtr))
  133. /* NPP_URLNotify */
  134. typedef void (* NP_LOADDS NPP_URLNotifyUPP)(NPP instance, const char* url, NPReason reason, void* notifyData);
  135. #define NewNPP_URLNotifyProc(FUNC) \
  136. ((NPP_URLNotifyUPP) (FUNC))
  137. #define CallNPP_URLNotifyProc(FUNC, ARG1, ARG2, ARG3, ARG4) \
  138. (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4))
  139. /* NPP_GetValue */
  140. typedef NPError (* NP_LOADDS NPP_GetValueUPP)(NPP instance, NPPVariable variable, void *ret_alue);
  141. #define NewNPP_GetValueProc(FUNC) \
  142. ((NPP_GetValueUPP) (FUNC))
  143. #define CallNPP_GetValueProc(FUNC, ARG1, ARG2, ARG3) \
  144. (*(FUNC))((ARG1), (ARG2), (ARG3))
  145. /* NPP_SetValue */
  146. typedef NPError (* NP_LOADDS NPP_SetValueUPP)(NPP instance, NPNVariable variable, void *ret_alue);
  147. #define NewNPP_SetValueProc(FUNC) \
  148. ((NPP_SetValueUPP) (FUNC))
  149. #define CallNPP_SetValueProc(FUNC, ARG1, ARG2, ARG3) \
  150. (*(FUNC))((ARG1), (ARG2), (ARG3))
  151. /*
  152. * Netscape entry points
  153. */
  154. /* NPN_GetValue */
  155. typedef NPError (* NP_LOADDS NPN_GetValueUPP)(NPP instance, NPNVariable variable, void *ret_alue);
  156. #define NewNPN_GetValueProc(FUNC) \
  157. ((NPN_GetValueUPP) (FUNC))
  158. #define CallNPN_GetValueProc(FUNC, ARG1, ARG2, ARG3) \
  159. (*(FUNC))((ARG1), (ARG2), (ARG3))
  160. /* NPN_SetValue */
  161. typedef NPError (* NP_LOADDS NPN_SetValueUPP)(NPP instance, NPPVariable variable, void *ret_alue);
  162. #define NewNPN_SetValueProc(FUNC) \
  163. ((NPN_SetValueUPP) (FUNC))
  164. #define CallNPN_SetValueProc(FUNC, ARG1, ARG2, ARG3) \
  165. (*(FUNC))((ARG1), (ARG2), (ARG3))
  166. /* NPN_GetUrlNotify */
  167. typedef NPError (* NP_LOADDS NPN_GetURLNotifyUPP)(NPP instance, const char* url, const char* window, void* notifyData);
  168. #define NewNPN_GetURLNotifyProc(FUNC) \
  169. ((NPN_GetURLNotifyUPP) (FUNC))
  170. #define CallNPN_GetURLNotifyProc(FUNC, ARG1, ARG2, ARG3, ARG4) \
  171. (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4))
  172. /* NPN_PostUrlNotify */
  173. typedef NPError (* NP_LOADDS NPN_PostURLNotifyUPP)(NPP instance, const char* url, const char* window, uint32 len, const char* buf, NPBool file, void* notifyData);
  174. #define NewNPN_PostURLNotifyProc(FUNC) \
  175. ((NPN_PostURLNotifyUPP) (FUNC))
  176. #define CallNPN_PostURLNotifyProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6, ARG7) \
  177. (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4), (ARG5), (ARG6), (ARG7))
  178. /* NPN_GetUrl */
  179. typedef NPError (* NP_LOADDS NPN_GetURLUPP)(NPP instance, const char* url, const char* window);
  180. #define NewNPN_GetURLProc(FUNC) \
  181. ((NPN_GetURLUPP) (FUNC))
  182. #define CallNPN_GetURLProc(FUNC, ARG1, ARG2, ARG3) \
  183. (*(FUNC))((ARG1), (ARG2), (ARG3))
  184. /* NPN_PostUrl */
  185. typedef NPError (* NP_LOADDS NPN_PostURLUPP)(NPP instance, const char* url, const char* window, uint32 len, const char* buf, NPBool file);
  186. #define NewNPN_PostURLProc(FUNC) \
  187. ((NPN_PostURLUPP) (FUNC))
  188. #define CallNPN_PostURLProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6) \
  189. (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4), (ARG5), (ARG6))
  190. /* NPN_RequestRead */
  191. typedef NPError (* NP_LOADDS NPN_RequestReadUPP)(NPStream* stream, NPByteRange* rangeList);
  192. #define NewNPN_RequestReadProc(FUNC) \
  193. ((NPN_RequestReadUPP) (FUNC))
  194. #define CallNPN_RequestReadProc(FUNC, stream, range) \
  195. (*(FUNC))((stream), (range))
  196. /* NPN_NewStream */
  197. typedef NPError (* NP_LOADDS NPN_NewStreamUPP)(NPP instance, NPMIMEType type, const char* window, NPStream** stream);
  198. #define NewNPN_NewStreamProc(FUNC) \
  199. ((NPN_NewStreamUPP) (FUNC))
  200. #define CallNPN_NewStreamProc(FUNC, npp, type, window, stream) \
  201. (*(FUNC))((npp), (type), (window), (stream))
  202. /* NPN_Write */
  203. typedef int32 (* NP_LOADDS NPN_WriteUPP)(NPP instance, NPStream* stream, int32 len, void* buffer);
  204. #define NewNPN_WriteProc(FUNC) \
  205. ((NPN_WriteUPP) (FUNC))
  206. #define CallNPN_WriteProc(FUNC, npp, stream, len, buffer) \
  207. (*(FUNC))((npp), (stream), (len), (buffer))
  208. /* NPN_DestroyStream */
  209. typedef NPError (* NP_LOADDS NPN_DestroyStreamUPP)(NPP instance, NPStream* stream, NPReason reason);
  210. #define NewNPN_DestroyStreamProc(FUNC) \
  211. ((NPN_DestroyStreamUPP) (FUNC))
  212. #define CallNPN_DestroyStreamProc(FUNC, npp, stream, reason) \
  213. (*(FUNC))((npp), (stream), (reason))
  214. /* NPN_Status */
  215. typedef void (* NP_LOADDS NPN_StatusUPP)(NPP instance, const char* message);
  216. #define NewNPN_StatusProc(FUNC) \
  217. ((NPN_StatusUPP) (FUNC))
  218. #define CallNPN_StatusProc(FUNC, npp, msg) \
  219. (*(FUNC))((npp), (msg))
  220. /* NPN_UserAgent */
  221. typedef const char* (* NP_LOADDS NPN_UserAgentUPP)(NPP instance);
  222. #define NewNPN_UserAgentProc(FUNC) \
  223. ((NPN_UserAgentUPP) (FUNC))
  224. #define CallNPN_UserAgentProc(FUNC, ARG1) \
  225. (*(FUNC))((ARG1))
  226. /* NPN_MemAlloc */
  227. typedef void* (* NP_LOADDS NPN_MemAllocUPP)(uint32 size);
  228. #define NewNPN_MemAllocProc(FUNC) \
  229. ((NPN_MemAllocUPP) (FUNC))
  230. #define CallNPN_MemAllocProc(FUNC, ARG1) \
  231. (*(FUNC))((ARG1))
  232. /* NPN__MemFree */
  233. typedef void (* NP_LOADDS NPN_MemFreeUPP)(void* ptr);
  234. #define NewNPN_MemFreeProc(FUNC) \
  235. ((NPN_MemFreeUPP) (FUNC))
  236. #define CallNPN_MemFreeProc(FUNC, ARG1) \
  237. (*(FUNC))((ARG1))
  238. /* NPN_MemFlush */
  239. typedef uint32 (* NP_LOADDS NPN_MemFlushUPP)(uint32 size);
  240. #define NewNPN_MemFlushProc(FUNC) \
  241. ((NPN_MemFlushUPP) (FUNC))
  242. #define CallNPN_MemFlushProc(FUNC, ARG1) \
  243. (*(FUNC))((ARG1))
  244. /* NPN_ReloadPlugins */
  245. typedef void (* NP_LOADDS NPN_ReloadPluginsUPP)(NPBool reloadPages);
  246. #define NewNPN_ReloadPluginsProc(FUNC) \
  247. ((NPN_ReloadPluginsUPP) (FUNC))
  248. #define CallNPN_ReloadPluginsProc(FUNC, ARG1) \
  249. (*(FUNC))((ARG1))
  250. /* NPN_GetJavaEnv */
  251. typedef JRIEnv* (* NP_LOADDS NPN_GetJavaEnvUPP)(void);
  252. #define NewNPN_GetJavaEnvProc(FUNC) \
  253. ((NPN_GetJavaEnvUPP) (FUNC))
  254. #define CallNPN_GetJavaEnvProc(FUNC) \
  255. (*(FUNC))()
  256. /* NPN_GetJavaPeer */
  257. typedef jref (* NP_LOADDS NPN_GetJavaPeerUPP)(NPP instance);
  258. #define NewNPN_GetJavaPeerProc(FUNC) \
  259. ((NPN_GetJavaPeerUPP) (FUNC))
  260. #define CallNPN_GetJavaPeerProc(FUNC, ARG1) \
  261. (*(FUNC))((ARG1))
  262. /* NPN_InvalidateRect */
  263. typedef void (* NP_LOADDS NPN_InvalidateRectUPP)(NPP instance, NPRect *rect);
  264. #define NewNPN_InvalidateRectProc(FUNC) \
  265. ((NPN_InvalidateRectUPP) (FUNC))
  266. #define CallNPN_InvalidateRectProc(FUNC, ARG1, ARG2) \
  267. (*(FUNC))((ARG1), (ARG2))
  268. /* NPN_InvalidateRegion */
  269. typedef void (* NP_LOADDS NPN_InvalidateRegionUPP)(NPP instance, NPRegion region);
  270. #define NewNPN_InvalidateRegionProc(FUNC) \
  271. ((NPN_InvalidateRegionUPP) (FUNC))
  272. #define CallNPN_InvalidateRegionProc(FUNC, ARG1, ARG2) \
  273. (*(FUNC))((ARG1), (ARG2))
  274. /* NPN_ForceRedraw */
  275. typedef void (* NP_LOADDS NPN_ForceRedrawUPP)(NPP instance);
  276. #define NewNPN_ForceRedrawProc(FUNC) \
  277. ((NPN_ForceRedrawUPP) (FUNC))
  278. #define CallNPN_ForceRedrawProc(FUNC, ARG1) \
  279. (*(FUNC))((ARG1))
  280. /* NPN_GetStringIdentifier */
  281. typedef NPIdentifier (* NP_LOADDS NPN_GetStringIdentifierUPP)(const NPUTF8* name);
  282. #define NewNPN_GetStringIdentifierProc(FUNC) \
  283. ((NPN_GetStringIdentifierUPP) (FUNC))
  284. #define CallNPN_GetStringIdentifierProc(FUNC, ARG1) \
  285. (*(FUNC))((ARG1))
  286. /* NPN_GetStringIdentifiers */
  287. typedef void (* NP_LOADDS NPN_GetStringIdentifiersUPP)(const NPUTF8** names,
  288. int32_t nameCount,
  289. NPIdentifier* identifiers);
  290. #define NewNPN_GetStringIdentifiersProc(FUNC) \
  291. ((NPN_GetStringIdentifiersUPP) (FUNC))
  292. #define CallNPN_GetStringIdentifiersProc(FUNC, ARG1, ARG2, ARG3) \
  293. (*(FUNC))((ARG1), (ARG2), (ARG3))
  294. /* NPN_GetIntIdentifier */
  295. typedef NPIdentifier (* NP_LOADDS NPN_GetIntIdentifierUPP)(int32_t intid);
  296. #define NewNPN_GetIntIdentifierProc(FUNC) \
  297. ((NPN_GetIntIdentifierUPP) (FUNC))
  298. #define CallNPN_GetIntIdentifierProc(FUNC, ARG1) \
  299. (*(FUNC))((ARG1))
  300. /* NPN_IdentifierIsString */
  301. typedef bool (* NP_LOADDS NPN_IdentifierIsStringUPP)(NPIdentifier identifier);
  302. #define NewNPN_IdentifierIsStringProc(FUNC) \
  303. ((NPN_IdentifierIsStringUPP) (FUNC))
  304. #define CallNPN_IdentifierIsStringProc(FUNC, ARG1) \
  305. (*(FUNC))((ARG1))
  306. /* NPN_UTF8FromIdentifier */
  307. typedef NPUTF8* (* NP_LOADDS NPN_UTF8FromIdentifierUPP)(NPIdentifier identifier);
  308. #define NewNPN_UTF8FromIdentifierProc(FUNC) \
  309. ((NPN_UTF8FromIdentifierUPP) (FUNC))
  310. #define CallNPN_UTF8FromIdentifierProc(FUNC, ARG1) \
  311. (*(FUNC))((ARG1))
  312. /* NPN_IntFromIdentifier */
  313. typedef int32_t (* NP_LOADDS NPN_IntFromIdentifierUPP)(NPIdentifier identifier);
  314. #define NewNPN_IntFromIdentifierProc(FUNC) \
  315. ((NPN_IntFromIdentifierUPP) (FUNC))
  316. #define CallNPN_IntFromIdentifierProc(FUNC, ARG1) \
  317. (*(FUNC))((ARG1))
  318. /* NPN_CreateObject */
  319. typedef NPObject* (* NP_LOADDS NPN_CreateObjectUPP)(NPP npp, NPClass *aClass);
  320. #define NewNPN_CreateObjectProc(FUNC) \
  321. ((NPN_CreateObjectUPP) (FUNC))
  322. #define CallNPN_CreateObjectProc(FUNC, ARG1, ARG2) \
  323. (*(FUNC))((ARG1), (ARG2))
  324. /* NPN_RetainObject */
  325. typedef NPObject* (* NP_LOADDS NPN_RetainObjectUPP)(NPObject *obj);
  326. #define NewNPN_RetainObjectProc(FUNC) \
  327. ((NPN_RetainObjectUPP) (FUNC))
  328. #define CallNPN_RetainObjectProc(FUNC, ARG1) \
  329. (*(FUNC))((ARG1))
  330. /* NPN_ReleaseObject */
  331. typedef void (* NP_LOADDS NPN_ReleaseObjectUPP)(NPObject *obj);
  332. #define NewNPN_ReleaseObjectProc(FUNC) \
  333. ((NPN_ReleaseObjectUPP) (FUNC))
  334. #define CallNPN_ReleaseObjectProc(FUNC, ARG1) \
  335. (*(FUNC))((ARG1))
  336. /* NPN_Invoke */
  337. typedef bool (* NP_LOADDS NPN_InvokeUPP)(NPP npp, NPObject* obj, NPIdentifier methodName, const NPVariant *args, uint32_t argCount, NPVariant *result);
  338. #define NewNPN_InvokeProc(FUNC) \
  339. ((NPN_InvokeUPP) (FUNC))
  340. #define CallNPN_InvokeProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6) \
  341. (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4), (ARG5), (ARG6))
  342. /* NPN_InvokeDefault */
  343. typedef bool (* NP_LOADDS NPN_InvokeDefaultUPP)(NPP npp, NPObject* obj, const NPVariant *args, uint32_t argCount, NPVariant *result);
  344. #define NewNPN_InvokeDefaultProc(FUNC) \
  345. ((NPN_InvokeDefaultUPP) (FUNC))
  346. #define CallNPN_InvokeDefaultProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5) \
  347. (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4), (ARG5))
  348. /* NPN_Evaluate */
  349. typedef bool (* NP_LOADDS NPN_EvaluateUPP)(NPP npp, NPObject *obj, NPString *script, NPVariant *result);
  350. #define NewNPN_EvaluateProc(FUNC) \
  351. ((NPN_EvaluateUPP) (FUNC))
  352. #define CallNPN_EvaluateProc(FUNC, ARG1, ARG2, ARG3, ARG4) \
  353. (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4))
  354. /* NPN_GetProperty */
  355. typedef bool (* NP_LOADDS NPN_GetPropertyUPP)(NPP npp, NPObject *obj, NPIdentifier propertyName, NPVariant *result);
  356. #define NewNPN_GetPropertyProc(FUNC) \
  357. ((NPN_GetPropertyUPP) (FUNC))
  358. #define CallNPN_GetPropertyProc(FUNC, ARG1, ARG2, ARG3, ARG4) \
  359. (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4))
  360. /* NPN_SetProperty */
  361. typedef bool (* NP_LOADDS NPN_SetPropertyUPP)(NPP npp, NPObject *obj, NPIdentifier propertyName, const NPVariant *value);
  362. #define NewNPN_SetPropertyProc(FUNC) \
  363. ((NPN_SetPropertyUPP) (FUNC))
  364. #define CallNPN_SetPropertyProc(FUNC, ARG1, ARG2, ARG3, ARG4) \
  365. (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4))
  366. /* NPN_RemoveProperty */
  367. typedef bool (* NP_LOADDS NPN_RemovePropertyUPP)(NPP npp, NPObject *obj, NPIdentifier propertyName);
  368. #define NewNPN_RemovePropertyProc(FUNC) \
  369. ((NPN_RemovePropertyUPP) (FUNC))
  370. #define CallNPN_RemovePropertyProc(FUNC, ARG1, ARG2, ARG3) \
  371. (*(FUNC))((ARG1), (ARG2), (ARG3))
  372. /* NPN_HasProperty */
  373. typedef bool (* NP_LOADDS NPN_HasPropertyUPP)(NPP npp, NPObject *obj, NPIdentifier propertyName);
  374. #define NewNPN_HasPropertyProc(FUNC) \
  375. ((NPN_HasPropertyUPP) (FUNC))
  376. #define CallNPN_HasPropertyProc(FUNC, ARG1, ARG2, ARG3) \
  377. (*(FUNC))((ARG1), (ARG2), (ARG3))
  378. /* NPN_HasMethod */
  379. typedef bool (* NP_LOADDS NPN_HasMethodUPP)(NPP npp, NPObject *obj, NPIdentifier propertyName);
  380. #define NewNPN_HasMethodProc(FUNC) \
  381. ((NPN_HasMethodUPP) (FUNC))
  382. #define CallNPN_HasMethodProc(FUNC, ARG1, ARG2, ARG3) \
  383. (*(FUNC))((ARG1), (ARG2), (ARG3))
  384. /* NPN_ReleaseVariantValue */
  385. typedef void (* NP_LOADDS NPN_ReleaseVariantValueUPP)(NPVariant *variant);
  386. #define NewNPN_ReleaseVariantValueProc(FUNC) \
  387. ((NPN_ReleaseVariantValueUPP) (FUNC))
  388. #define CallNPN_ReleaseVariantValueProc(FUNC, ARG1) \
  389. (*(FUNC))((ARG1))
  390. /* NPN_SetException */
  391. typedef void (* NP_LOADDS NPN_SetExceptionUPP)(NPObject *obj, const NPUTF8 *message);
  392. #define NewNPN_SetExceptionProc(FUNC) \
  393. ((NPN_SetExceptionUPP) (FUNC))
  394. #define CallNPN_SetExceptionProc(FUNC, ARG1, ARG2) \
  395. (*(FUNC))((ARG1), (ARG2))
  396. /* NPN_PushPopupsEnabledStateUPP */
  397. typedef bool (* NP_LOADDS NPN_PushPopupsEnabledStateUPP)(NPP npp, NPBool enabled);
  398. #define NewNPN_PushPopupsEnabledStateProc(FUNC) \
  399. ((NPN_PushPopupsEnabledStateUPP) (FUNC))
  400. #define CallNPN_PushPopupsEnabledStateProc(FUNC, ARG1, ARG2) \
  401. (*(FUNC))((ARG1), (ARG2))
  402. /* NPN_PopPopupsEnabledState */
  403. typedef bool (* NP_LOADDS NPN_PopPopupsEnabledStateUPP)(NPP npp);
  404. #define NewNPN_PopPopupsEnabledStateProc(FUNC) \
  405. ((NPN_PopPopupsEnabledStateUPP) (FUNC))
  406. #define CallNPN_PopPopupsEnabledStateProc(FUNC, ARG1) \
  407. (*(FUNC))((ARG1))
  408. /* NPN_Enumerate */
  409. typedef bool (* NP_LOADDS NPN_EnumerateUPP)(NPP npp, NPObject *obj, NPIdentifier **identifier, uint32_t *count);
  410. #define NewNPN_EnumerateProc(FUNC) \
  411. ((NPN_EnumerateUPP) (FUNC))
  412. #define CallNPN_EnumerateProc(FUNC, ARG1, ARG2, ARG3, ARG4) \
  413. (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4))
  414. /* NPN_PluginThreadAsyncCall */
  415. typedef void (* NP_LOADDS NPN_PluginThreadAsyncCallUPP)(NPP instance, void (*func)(void *), void *userData);
  416. #define NewNPN_PluginThreadAsyncCallProc(FUNC) \
  417. ((NPN_PluginThreadAsyncCallUPP) (FUNC))
  418. #define CallNPN_PluginThreadAsyncCallProc(FUNC, ARG1, ARG2, ARG3) \
  419. (*(FUNC))((ARG1), (ARG2), (ARG3))
  420. /* NPN_Construct */
  421. typedef bool (* NP_LOADDS NPN_ConstructUPP)(NPP npp, NPObject* obj, const NPVariant *args, uint32_t argCount, NPVariant *result);
  422. #define NewNPN_ConstructProc(FUNC) \
  423. ((NPN_ConstructUPP) (FUNC))
  424. #define CallNPN_ConstructProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5) \
  425. (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4), (ARG5))
  426. /******************************************************************************************
  427. * The actual plugin function table definitions
  428. *******************************************************************************************/
  429. typedef struct _NPPluginFuncs {
  430. uint16 size;
  431. uint16 version;
  432. NPP_NewUPP newp;
  433. NPP_DestroyUPP destroy;
  434. NPP_SetWindowUPP setwindow;
  435. NPP_NewStreamUPP newstream;
  436. NPP_DestroyStreamUPP destroystream;
  437. NPP_StreamAsFileUPP asfile;
  438. NPP_WriteReadyUPP writeready;
  439. NPP_WriteUPP write;
  440. NPP_PrintUPP print;
  441. NPP_HandleEventUPP event;
  442. NPP_URLNotifyUPP urlnotify;
  443. JRIGlobalRef javaClass;
  444. NPP_GetValueUPP getvalue;
  445. NPP_SetValueUPP setvalue;
  446. } NPPluginFuncs;
  447. typedef struct _NPNetscapeFuncs {
  448. uint16 size;
  449. uint16 version;
  450. NPN_GetURLUPP geturl;
  451. NPN_PostURLUPP posturl;
  452. NPN_RequestReadUPP requestread;
  453. NPN_NewStreamUPP newstream;
  454. NPN_WriteUPP write;
  455. NPN_DestroyStreamUPP destroystream;
  456. NPN_StatusUPP status;
  457. NPN_UserAgentUPP uagent;
  458. NPN_MemAllocUPP memalloc;
  459. NPN_MemFreeUPP memfree;
  460. NPN_MemFlushUPP memflush;
  461. NPN_ReloadPluginsUPP reloadplugins;
  462. NPN_GetJavaEnvUPP getJavaEnv;
  463. NPN_GetJavaPeerUPP getJavaPeer;
  464. NPN_GetURLNotifyUPP geturlnotify;
  465. NPN_PostURLNotifyUPP posturlnotify;
  466. NPN_GetValueUPP getvalue;
  467. NPN_SetValueUPP setvalue;
  468. NPN_InvalidateRectUPP invalidaterect;
  469. NPN_InvalidateRegionUPP invalidateregion;
  470. NPN_ForceRedrawUPP forceredraw;
  471. NPN_GetStringIdentifierUPP getstringidentifier;
  472. NPN_GetStringIdentifiersUPP getstringidentifiers;
  473. NPN_GetIntIdentifierUPP getintidentifier;
  474. NPN_IdentifierIsStringUPP identifierisstring;
  475. NPN_UTF8FromIdentifierUPP utf8fromidentifier;
  476. NPN_IntFromIdentifierUPP intfromidentifier;
  477. NPN_CreateObjectUPP createobject;
  478. NPN_RetainObjectUPP retainobject;
  479. NPN_ReleaseObjectUPP releaseobject;
  480. NPN_InvokeUPP invoke;
  481. NPN_InvokeDefaultUPP invokeDefault;
  482. NPN_EvaluateUPP evaluate;
  483. NPN_GetPropertyUPP getproperty;
  484. NPN_SetPropertyUPP setproperty;
  485. NPN_RemovePropertyUPP removeproperty;
  486. NPN_HasPropertyUPP hasproperty;
  487. NPN_HasMethodUPP hasmethod;
  488. NPN_ReleaseVariantValueUPP releasevariantvalue;
  489. NPN_SetExceptionUPP setexception;
  490. NPN_PushPopupsEnabledStateUPP pushpopupsenabledstate;
  491. NPN_PopPopupsEnabledStateUPP poppopupsenabledstate;
  492. NPN_EnumerateUPP enumerate;
  493. NPN_PluginThreadAsyncCallUPP pluginthreadasynccall;
  494. NPN_ConstructUPP construct;
  495. } NPNetscapeFuncs;
  496. #ifdef XP_MACOSX
  497. /******************************************************************************************
  498. * Mac platform-specific plugin glue stuff
  499. *******************************************************************************************/
  500. /*
  501. * Main entry point of the plugin.
  502. * This routine will be called when the plugin is loaded. The function
  503. * tables are passed in and the plugin fills in the NPPluginFuncs table
  504. * and NPPShutdownUPP for Netscape's use.
  505. */
  506. typedef NPError (* NP_LOADDS NPP_MainEntryUPP)(NPNetscapeFuncs*, NPPluginFuncs*, NPP_ShutdownUPP*);
  507. #define NewNPP_MainEntryProc(FUNC) \
  508. ((NPP_MainEntryUPP) (FUNC))
  509. #define CallNPP_MainEntryProc(FUNC, netscapeFunc, pluginFunc, shutdownUPP) \
  510. (*(FUNC))((netscapeFunc), (pluginFunc), (shutdownUPP))
  511. /*
  512. * Mac OS X version(s) of NP_GetMIMEDescription(const char *)
  513. * These can be called to retreive MIME information from the plugin dynamically
  514. *
  515. * Note: For compatibility with Quicktime, BPSupportedMIMEtypes is another way
  516. * to get mime info from the plugin only on OSX and may not be supported
  517. * in furture version -- use NP_GetMIMEDescription instead
  518. */
  519. enum
  520. {
  521. kBPSupportedMIMETypesStructVers_1 = 1
  522. };
  523. typedef struct _BPSupportedMIMETypes
  524. {
  525. SInt32 structVersion; /* struct version */
  526. Handle typeStrings; /* STR# formated handle, allocated by plug-in */
  527. Handle infoStrings; /* STR# formated handle, allocated by plug-in */
  528. } BPSupportedMIMETypes;
  529. OSErr BP_GetSupportedMIMETypes(BPSupportedMIMETypes *mimeInfo, UInt32 flags);
  530. /* NP_GetMIMEDescription */
  531. #define NP_GETMIMEDESCRIPTION_NAME "NP_GetMIMEDescription"
  532. typedef const char* (* NP_LOADDS NP_GetMIMEDescriptionUPP)();
  533. #define NewNP_GetMIMEDescEntryProc(FUNC) \
  534. ((NP_GetMIMEDescriptionUPP) (FUNC))
  535. #define CallNP_GetMIMEDescEntryProc(FUNC) \
  536. (*(FUNC))()
  537. /* BP_GetSupportedMIMETypes */
  538. typedef OSErr (* NP_LOADDS BP_GetSupportedMIMETypesUPP)(BPSupportedMIMETypes*, UInt32);
  539. #define NewBP_GetSupportedMIMETypesEntryProc(FUNC) \
  540. ((BP_GetSupportedMIMETypesUPP) (FUNC))
  541. #define CallBP_GetMIMEDescEntryProc(FUNC, mimeInfo, flags) \
  542. (*(FUNC))((mimeInfo), (flags))
  543. #endif /* XP_MACOSX */
  544. #if defined(_WINDOWS)
  545. #define OSCALL WINAPI
  546. #else
  547. #if defined(__OS2__)
  548. #define OSCALL _System
  549. #else
  550. #define OSCALL
  551. #endif
  552. #endif
  553. #if defined(XP_UNIX)
  554. /* GCC 3.3 and later support the visibility attribute. */
  555. #if defined(__GNUC__) && \
  556. ((__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3))
  557. #define NP_VISIBILITY_DEFAULT __attribute__((visibility("default")))
  558. #else
  559. #define NP_VISIBILITY_DEFAULT
  560. #endif
  561. #define NP_EXPORT(__type) NP_VISIBILITY_DEFAULT __type
  562. #endif
  563. #if defined( _WINDOWS ) || defined (__OS2__)
  564. #ifdef __cplusplus
  565. extern "C" {
  566. #endif
  567. /* plugin meta member functions */
  568. #if defined(__OS2__)
  569. typedef struct _NPPluginData { /* Alternate OS2 Plugin interface */
  570. char *pMimeTypes;
  571. char *pFileExtents;
  572. char *pFileOpenTemplate;
  573. char *pProductName;
  574. char *pProductDescription;
  575. unsigned long dwProductVersionMS;
  576. unsigned long dwProductVersionLS;
  577. } NPPluginData;
  578. NPError OSCALL NP_GetPluginData(NPPluginData * pPluginData);
  579. #endif
  580. NPError OSCALL NP_GetEntryPoints(NPPluginFuncs* pFuncs);
  581. NPError OSCALL NP_Initialize(NPNetscapeFuncs* pFuncs);
  582. NPError OSCALL NP_Shutdown();
  583. char* NP_GetMIMEDescription();
  584. #ifdef __cplusplus
  585. }
  586. #endif
  587. #endif /* _WINDOWS || __OS2__ */
  588. #if defined(__OS2__)
  589. #pragma pack()
  590. #endif
  591. #ifdef XP_UNIX
  592. #ifdef __cplusplus
  593. extern "C" {
  594. #endif
  595. /* plugin meta member functions */
  596. NP_EXPORT(char*) NP_GetMIMEDescription(void);
  597. NP_EXPORT(NPError) NP_Initialize(NPNetscapeFuncs*, NPPluginFuncs*);
  598. NP_EXPORT(NPError) NP_Shutdown(void);
  599. NP_EXPORT(NPError) NP_GetValue(void *future, NPPVariable aVariable, void *aValue);
  600. #ifdef __cplusplus
  601. }
  602. #endif
  603. #endif /* XP_UNIX */
  604. #endif /* _NPUPP_H_ */