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
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/
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
15 * The Original Code is mozilla.org code.
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.
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.
36 * ***** END LICENSE BLOCK ***** */
40 * npupp.h $Revision: 3.25 $
41 * function call mecahnics needed by platform specific glue code.
53 #define GENERATINGCFM 0
60 #include "npruntime.h"
65 /******************************************************************************************
66 plug-in function table macros
67 for each function in and out of the plugin API we define
69 #define NewNPP_FooProc
70 #define CallNPP_FooProc
71 *******************************************************************************************/
75 typedef void (* NP_LOADDS NPP_InitializeUPP)(void);
76 #define NewNPP_InitializeProc(FUNC) \
77 ((NPP_InitializeUPP) (FUNC))
78 #define CallNPP_InitializeProc(FUNC) \
82 typedef void (* NP_LOADDS NPP_ShutdownUPP)(void);
83 #define NewNPP_ShutdownProc(FUNC) \
84 ((NPP_ShutdownUPP) (FUNC))
85 #define CallNPP_ShutdownProc(FUNC) \
89 typedef NPError (* NP_LOADDS NPP_NewUPP)(NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, char* argn[], char* argv[], NPSavedData* saved);
90 #define NewNPP_NewProc(FUNC) \
92 #define CallNPP_NewProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6, ARG7) \
93 (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4), (ARG5), (ARG6), (ARG7))
96 typedef NPError (* NP_LOADDS NPP_DestroyUPP)(NPP instance, NPSavedData** save);
97 #define NewNPP_DestroyProc(FUNC) \
98 ((NPP_DestroyUPP) (FUNC))
99 #define CallNPP_DestroyProc(FUNC, ARG1, ARG2) \
100 (*(FUNC))((ARG1), (ARG2))
103 typedef NPError (* NP_LOADDS NPP_SetWindowUPP)(NPP instance, NPWindow* window);
104 #define NewNPP_SetWindowProc(FUNC) \
105 ((NPP_SetWindowUPP) (FUNC))
106 #define CallNPP_SetWindowProc(FUNC, ARG1, ARG2) \
107 (*(FUNC))((ARG1), (ARG2))
110 typedef NPError (* NP_LOADDS NPP_NewStreamUPP)(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16* stype);
111 #define NewNPP_NewStreamProc(FUNC) \
112 ((NPP_NewStreamUPP) (FUNC))
113 #define CallNPP_NewStreamProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5) \
114 (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4), (ARG5))
116 /* NPP_DestroyStream */
117 typedef NPError (* NP_LOADDS NPP_DestroyStreamUPP)(NPP instance, NPStream* stream, NPReason reason);
118 #define NewNPP_DestroyStreamProc(FUNC) \
119 ((NPP_DestroyStreamUPP) (FUNC))
120 #define CallNPP_DestroyStreamProc(FUNC, NPParg, NPStreamPtr, NPReasonArg) \
121 (*(FUNC))((NPParg), (NPStreamPtr), (NPReasonArg))
124 typedef int32 (* NP_LOADDS NPP_WriteReadyUPP)(NPP instance, NPStream* stream);
125 #define NewNPP_WriteReadyProc(FUNC) \
126 ((NPP_WriteReadyUPP) (FUNC))
127 #define CallNPP_WriteReadyProc(FUNC, NPParg, NPStreamPtr) \
128 (*(FUNC))((NPParg), (NPStreamPtr))
131 typedef int32 (* NP_LOADDS NPP_WriteUPP)(NPP instance, NPStream* stream, int32 offset, int32 len, void* buffer);
132 #define NewNPP_WriteProc(FUNC) \
133 ((NPP_WriteUPP) (FUNC))
134 #define CallNPP_WriteProc(FUNC, NPParg, NPStreamPtr, offsetArg, lenArg, bufferPtr) \
135 (*(FUNC))((NPParg), (NPStreamPtr), (offsetArg), (lenArg), (bufferPtr))
137 /* NPP_StreamAsFile */
138 typedef void (* NP_LOADDS NPP_StreamAsFileUPP)(NPP instance, NPStream* stream, const char* fname);
139 #define NewNPP_StreamAsFileProc(FUNC) \
140 ((NPP_StreamAsFileUPP) (FUNC))
141 #define CallNPP_StreamAsFileProc(FUNC, ARG1, ARG2, ARG3) \
142 (*(FUNC))((ARG1), (ARG2), (ARG3))
145 typedef void (* NP_LOADDS NPP_PrintUPP)(NPP instance, NPPrint* platformPrint);
146 #define NewNPP_PrintProc(FUNC) \
147 ((NPP_PrintUPP) (FUNC))
148 #define CallNPP_PrintProc(FUNC, NPParg, NPPrintArg) \
149 (*(FUNC))((NPParg), (NPPrintArg))
151 /* NPP_HandleEvent */
152 typedef int16 (* NP_LOADDS NPP_HandleEventUPP)(NPP instance, void* event);
153 #define NewNPP_HandleEventProc(FUNC) \
154 ((NPP_HandleEventUPP) (FUNC))
155 #define CallNPP_HandleEventProc(FUNC, NPParg, voidPtr) \
156 (*(FUNC))((NPParg), (voidPtr))
159 typedef void (* NP_LOADDS NPP_URLNotifyUPP)(NPP instance, const char* url, NPReason reason, void* notifyData);
160 #define NewNPP_URLNotifyProc(FUNC) \
161 ((NPP_URLNotifyUPP) (FUNC))
162 #define CallNPP_URLNotifyProc(FUNC, ARG1, ARG2, ARG3, ARG4) \
163 (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4))
166 typedef NPError (* NP_LOADDS NPP_GetValueUPP)(NPP instance, NPPVariable variable, void *ret_alue);
167 #define NewNPP_GetValueProc(FUNC) \
168 ((NPP_GetValueUPP) (FUNC))
169 #define CallNPP_GetValueProc(FUNC, ARG1, ARG2, ARG3) \
170 (*(FUNC))((ARG1), (ARG2), (ARG3))
173 typedef NPError (* NP_LOADDS NPP_SetValueUPP)(NPP instance, NPNVariable variable, void *ret_alue);
174 #define NewNPP_SetValueProc(FUNC) \
175 ((NPP_SetValueUPP) (FUNC))
176 #define CallNPP_SetValueProc(FUNC, ARG1, ARG2, ARG3) \
177 (*(FUNC))((ARG1), (ARG2), (ARG3))
180 * Netscape entry points
185 typedef NPError (* NP_LOADDS NPN_GetValueUPP)(NPP instance, NPNVariable variable, void *ret_alue);
186 #define NewNPN_GetValueProc(FUNC) \
187 ((NPN_GetValueUPP) (FUNC))
188 #define CallNPN_GetValueProc(FUNC, ARG1, ARG2, ARG3) \
189 (*(FUNC))((ARG1), (ARG2), (ARG3))
192 typedef NPError (* NP_LOADDS NPN_SetValueUPP)(NPP instance, NPPVariable variable, void *ret_alue);
193 #define NewNPN_SetValueProc(FUNC) \
194 ((NPN_SetValueUPP) (FUNC))
195 #define CallNPN_SetValueProc(FUNC, ARG1, ARG2, ARG3) \
196 (*(FUNC))((ARG1), (ARG2), (ARG3))
198 /* NPN_GetUrlNotify */
199 typedef NPError (* NP_LOADDS NPN_GetURLNotifyUPP)(NPP instance, const char* url, const char* window, void* notifyData);
200 #define NewNPN_GetURLNotifyProc(FUNC) \
201 ((NPN_GetURLNotifyUPP) (FUNC))
202 #define CallNPN_GetURLNotifyProc(FUNC, ARG1, ARG2, ARG3, ARG4) \
203 (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4))
205 /* NPN_PostUrlNotify */
206 typedef NPError (* NP_LOADDS NPN_PostURLNotifyUPP)(NPP instance, const char* url, const char* window, uint32 len, const char* buf, NPBool file, void* notifyData);
207 #define NewNPN_PostURLNotifyProc(FUNC) \
208 ((NPN_PostURLNotifyUPP) (FUNC))
209 #define CallNPN_PostURLNotifyProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6, ARG7) \
210 (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4), (ARG5), (ARG6), (ARG7))
213 typedef NPError (* NP_LOADDS NPN_GetURLUPP)(NPP instance, const char* url, const char* window);
214 #define NewNPN_GetURLProc(FUNC) \
215 ((NPN_GetURLUPP) (FUNC))
216 #define CallNPN_GetURLProc(FUNC, ARG1, ARG2, ARG3) \
217 (*(FUNC))((ARG1), (ARG2), (ARG3))
220 typedef NPError (* NP_LOADDS NPN_PostURLUPP)(NPP instance, const char* url, const char* window, uint32 len, const char* buf, NPBool file);
221 #define NewNPN_PostURLProc(FUNC) \
222 ((NPN_PostURLUPP) (FUNC))
223 #define CallNPN_PostURLProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6) \
224 (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4), (ARG5), (ARG6))
226 /* NPN_RequestRead */
227 typedef NPError (* NP_LOADDS NPN_RequestReadUPP)(NPStream* stream, NPByteRange* rangeList);
228 #define NewNPN_RequestReadProc(FUNC) \
229 ((NPN_RequestReadUPP) (FUNC))
230 #define CallNPN_RequestReadProc(FUNC, stream, range) \
231 (*(FUNC))((stream), (range))
234 typedef NPError (* NP_LOADDS NPN_NewStreamUPP)(NPP instance, NPMIMEType type, const char* window, NPStream** stream);
235 #define NewNPN_NewStreamProc(FUNC) \
236 ((NPN_NewStreamUPP) (FUNC))
237 #define CallNPN_NewStreamProc(FUNC, npp, type, window, stream) \
238 (*(FUNC))((npp), (type), (window), (stream))
241 typedef int32 (* NP_LOADDS NPN_WriteUPP)(NPP instance, NPStream* stream, int32 len, void* buffer);
242 #define NewNPN_WriteProc(FUNC) \
243 ((NPN_WriteUPP) (FUNC))
244 #define CallNPN_WriteProc(FUNC, npp, stream, len, buffer) \
245 (*(FUNC))((npp), (stream), (len), (buffer))
247 /* NPN_DestroyStream */
248 typedef NPError (* NP_LOADDS NPN_DestroyStreamUPP)(NPP instance, NPStream* stream, NPReason reason);
249 #define NewNPN_DestroyStreamProc(FUNC) \
250 ((NPN_DestroyStreamUPP) (FUNC))
251 #define CallNPN_DestroyStreamProc(FUNC, npp, stream, reason) \
252 (*(FUNC))((npp), (stream), (reason))
255 typedef void (* NP_LOADDS NPN_StatusUPP)(NPP instance, const char* message);
256 #define NewNPN_StatusProc(FUNC) \
257 ((NPN_StatusUPP) (FUNC))
258 #define CallNPN_StatusProc(FUNC, npp, msg) \
259 (*(FUNC))((npp), (msg))
262 typedef const char* (* NP_LOADDS NPN_UserAgentUPP)(NPP instance);
263 #define NewNPN_UserAgentProc(FUNC) \
264 ((NPN_UserAgentUPP) (FUNC))
265 #define CallNPN_UserAgentProc(FUNC, ARG1) \
269 typedef void* (* NP_LOADDS NPN_MemAllocUPP)(uint32 size);
270 #define NewNPN_MemAllocProc(FUNC) \
271 ((NPN_MemAllocUPP) (FUNC))
272 #define CallNPN_MemAllocProc(FUNC, ARG1) \
276 typedef void (* NP_LOADDS NPN_MemFreeUPP)(void* ptr);
277 #define NewNPN_MemFreeProc(FUNC) \
278 ((NPN_MemFreeUPP) (FUNC))
279 #define CallNPN_MemFreeProc(FUNC, ARG1) \
283 typedef uint32 (* NP_LOADDS NPN_MemFlushUPP)(uint32 size);
284 #define NewNPN_MemFlushProc(FUNC) \
285 ((NPN_MemFlushUPP) (FUNC))
286 #define CallNPN_MemFlushProc(FUNC, ARG1) \
289 /* NPN_ReloadPlugins */
290 typedef void (* NP_LOADDS NPN_ReloadPluginsUPP)(NPBool reloadPages);
291 #define NewNPN_ReloadPluginsProc(FUNC) \
292 ((NPN_ReloadPluginsUPP) (FUNC))
293 #define CallNPN_ReloadPluginsProc(FUNC, ARG1) \
297 typedef JRIEnv* (* NP_LOADDS NPN_GetJavaEnvUPP)(void);
298 #define NewNPN_GetJavaEnvProc(FUNC) \
299 ((NPN_GetJavaEnvUPP) (FUNC))
300 #define CallNPN_GetJavaEnvProc(FUNC) \
303 /* NPN_GetJavaPeer */
304 typedef jref (* NP_LOADDS NPN_GetJavaPeerUPP)(NPP instance);
305 #define NewNPN_GetJavaPeerProc(FUNC) \
306 ((NPN_GetJavaPeerUPP) (FUNC))
307 #define CallNPN_GetJavaPeerProc(FUNC, ARG1) \
310 /* NPN_InvalidateRect */
311 typedef void (* NP_LOADDS NPN_InvalidateRectUPP)(NPP instance, NPRect *rect);
312 #define NewNPN_InvalidateRectProc(FUNC) \
313 ((NPN_InvalidateRectUPP) (FUNC))
314 #define CallNPN_InvalidateRectProc(FUNC, ARG1, ARG2) \
315 (*(FUNC))((ARG1), (ARG2))
317 /* NPN_InvalidateRegion */
318 typedef void (* NP_LOADDS NPN_InvalidateRegionUPP)(NPP instance, NPRegion region);
319 #define NewNPN_InvalidateRegionProc(FUNC) \
320 ((NPN_InvalidateRegionUPP) (FUNC))
321 #define CallNPN_InvalidateRegionProc(FUNC, ARG1, ARG2) \
322 (*(FUNC))((ARG1), (ARG2))
324 /* NPN_ForceRedraw */
325 typedef void (* NP_LOADDS NPN_ForceRedrawUPP)(NPP instance);
326 #define NewNPN_ForceRedrawProc(FUNC) \
327 ((NPN_ForceRedrawUPP) (FUNC))
328 #define CallNPN_ForceRedrawProc(FUNC, ARG1) \
331 /* NPN_GetStringIdentifier */
332 typedef NPIdentifier (* NP_LOADDS NPN_GetStringIdentifierUPP)(const NPUTF8* name);
333 #define NewNPN_GetStringIdentifierProc(FUNC) \
334 ((NPN_GetStringIdentifierUPP) (FUNC))
335 #define CallNPN_GetStringIdentifierProc(FUNC, ARG1) \
338 /* NPN_GetStringIdentifiers */
339 typedef void (* NP_LOADDS NPN_GetStringIdentifiersUPP)(const NPUTF8** names,
341 NPIdentifier* identifiers);
342 #define NewNPN_GetStringIdentifiersProc(FUNC) \
343 ((NPN_GetStringIdentifiersUPP) (FUNC))
344 #define CallNPN_GetStringIdentifiersProc(FUNC, ARG1, ARG2, ARG3) \
345 (*(FUNC))((ARG1), (ARG2), (ARG3))
347 /* NPN_GetIntIdentifier */
348 typedef NPIdentifier (* NP_LOADDS NPN_GetIntIdentifierUPP)(int32_t intid);
349 #define NewNPN_GetIntIdentifierProc(FUNC) \
350 ((NPN_GetIntIdentifierUPP) (FUNC))
351 #define CallNPN_GetIntIdentifierProc(FUNC, ARG1) \
354 /* NPN_IdentifierIsString */
355 typedef bool (* NP_LOADDS NPN_IdentifierIsStringUPP)(NPIdentifier identifier);
356 #define NewNPN_IdentifierIsStringProc(FUNC) \
357 ((NPN_IdentifierIsStringUPP) (FUNC))
358 #define CallNPN_IdentifierIsStringProc(FUNC, ARG1) \
361 /* NPN_UTF8FromIdentifier */
362 typedef NPUTF8* (* NP_LOADDS NPN_UTF8FromIdentifierUPP)(NPIdentifier identifier);
363 #define NewNPN_UTF8FromIdentifierProc(FUNC) \
364 ((NPN_UTF8FromIdentifierUPP) (FUNC))
365 #define CallNPN_UTF8FromIdentifierProc(FUNC, ARG1) \
368 /* NPN_IntFromIdentifier */
369 typedef int32_t (* NP_LOADDS NPN_IntFromIdentifierUPP)(NPIdentifier identifier);
370 #define NewNPN_IntFromIdentifierProc(FUNC) \
371 ((NPN_IntFromIdentifierUPP) (FUNC))
372 #define CallNPN_IntFromIdentifierProc(FUNC, ARG1) \
375 /* NPN_CreateObject */
376 typedef NPObject* (* NP_LOADDS NPN_CreateObjectUPP)(NPP npp, NPClass *aClass);
377 #define NewNPN_CreateObjectProc(FUNC) \
378 ((NPN_CreateObjectUPP) (FUNC))
379 #define CallNPN_CreateObjectProc(FUNC, ARG1, ARG2) \
380 (*(FUNC))((ARG1), (ARG2))
382 /* NPN_RetainObject */
383 typedef NPObject* (* NP_LOADDS NPN_RetainObjectUPP)(NPObject *obj);
384 #define NewNPN_RetainObjectProc(FUNC) \
385 ((NPN_RetainObjectUPP) (FUNC))
386 #define CallNPN_RetainObjectProc(FUNC, ARG1) \
389 /* NPN_ReleaseObject */
390 typedef void (* NP_LOADDS NPN_ReleaseObjectUPP)(NPObject *obj);
391 #define NewNPN_ReleaseObjectProc(FUNC) \
392 ((NPN_ReleaseObjectUPP) (FUNC))
393 #define CallNPN_ReleaseObjectProc(FUNC, ARG1) \
397 typedef bool (* NP_LOADDS NPN_InvokeUPP)(NPP npp, NPObject* obj, NPIdentifier methodName, const NPVariant *args, uint32_t argCount, NPVariant *result);
398 #define NewNPN_InvokeProc(FUNC) \
399 ((NPN_InvokeUPP) (FUNC))
400 #define CallNPN_InvokeProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6) \
401 (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4), (ARG5), (ARG6))
403 /* NPN_InvokeDefault */
404 typedef bool (* NP_LOADDS NPN_InvokeDefaultUPP)(NPP npp, NPObject* obj, const NPVariant *args, uint32_t argCount, NPVariant *result);
405 #define NewNPN_InvokeDefaultProc(FUNC) \
406 ((NPN_InvokeDefaultUPP) (FUNC))
407 #define CallNPN_InvokeDefaultProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5) \
408 (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4), (ARG5))
411 typedef bool (* NP_LOADDS NPN_EvaluateUPP)(NPP npp, NPObject *obj, NPString *script, NPVariant *result);
412 #define NewNPN_EvaluateProc(FUNC) \
413 ((NPN_EvaluateUPP) (FUNC))
414 #define CallNPN_EvaluateProc(FUNC, ARG1, ARG2, ARG3, ARG4) \
415 (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4))
417 /* NPN_GetProperty */
418 typedef bool (* NP_LOADDS NPN_GetPropertyUPP)(NPP npp, NPObject *obj, NPIdentifier propertyName, NPVariant *result);
419 #define NewNPN_GetPropertyProc(FUNC) \
420 ((NPN_GetPropertyUPP) (FUNC))
421 #define CallNPN_GetPropertyProc(FUNC, ARG1, ARG2, ARG3, ARG4) \
422 (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4))
424 /* NPN_SetProperty */
425 typedef bool (* NP_LOADDS NPN_SetPropertyUPP)(NPP npp, NPObject *obj, NPIdentifier propertyName, const NPVariant *value);
426 #define NewNPN_SetPropertyProc(FUNC) \
427 ((NPN_SetPropertyUPP) (FUNC))
428 #define CallNPN_SetPropertyProc(FUNC, ARG1, ARG2, ARG3, ARG4) \
429 (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4))
431 /* NPN_RemoveProperty */
432 typedef bool (* NP_LOADDS NPN_RemovePropertyUPP)(NPP npp, NPObject *obj, NPIdentifier propertyName);
433 #define NewNPN_RemovePropertyProc(FUNC) \
434 ((NPN_RemovePropertyUPP) (FUNC))
435 #define CallNPN_RemovePropertyProc(FUNC, ARG1, ARG2, ARG3) \
436 (*(FUNC))((ARG1), (ARG2), (ARG3))
438 /* NPN_HasProperty */
439 typedef bool (* NP_LOADDS NPN_HasPropertyUPP)(NPP npp, NPObject *obj, NPIdentifier propertyName);
440 #define NewNPN_HasPropertyProc(FUNC) \
441 ((NPN_HasPropertyUPP) (FUNC))
442 #define CallNPN_HasPropertyProc(FUNC, ARG1, ARG2, ARG3) \
443 (*(FUNC))((ARG1), (ARG2), (ARG3))
446 typedef bool (* NP_LOADDS NPN_HasMethodUPP)(NPP npp, NPObject *obj, NPIdentifier propertyName);
447 #define NewNPN_HasMethodProc(FUNC) \
448 ((NPN_HasMethodUPP) (FUNC))
449 #define CallNPN_HasMethodProc(FUNC, ARG1, ARG2, ARG3) \
450 (*(FUNC))((ARG1), (ARG2), (ARG3))
452 /* NPN_ReleaseVariantValue */
453 typedef void (* NP_LOADDS NPN_ReleaseVariantValueUPP)(NPVariant *variant);
454 #define NewNPN_ReleaseVariantValueProc(FUNC) \
455 ((NPN_ReleaseVariantValueUPP) (FUNC))
456 #define CallNPN_ReleaseVariantValueProc(FUNC, ARG1) \
459 /* NPN_SetException */
460 typedef void (* NP_LOADDS NPN_SetExceptionUPP)(NPObject *obj, const NPUTF8 *message);
461 #define NewNPN_SetExceptionProc(FUNC) \
462 ((NPN_SetExceptionUPP) (FUNC))
463 #define CallNPN_SetExceptionProc(FUNC, ARG1, ARG2) \
464 (*(FUNC))((ARG1), (ARG2))
466 /* NPN_PushPopupsEnabledStateUPP */
467 typedef bool (* NP_LOADDS NPN_PushPopupsEnabledStateUPP)(NPP npp, NPBool enabled);
468 #define NewNPN_PushPopupsEnabledStateProc(FUNC) \
469 ((NPN_PushPopupsEnabledStateUPP) (FUNC))
470 #define CallNPN_PushPopupsEnabledStateProc(FUNC, ARG1, ARG2) \
471 (*(FUNC))((ARG1), (ARG2))
473 /* NPN_PopPopupsEnabledState */
474 typedef bool (* NP_LOADDS NPN_PopPopupsEnabledStateUPP)(NPP npp);
475 #define NewNPN_PopPopupsEnabledStateProc(FUNC) \
476 ((NPN_PopPopupsEnabledStateUPP) (FUNC))
477 #define CallNPN_PopPopupsEnabledStateProc(FUNC, ARG1) \
481 typedef bool (* NP_LOADDS NPN_EnumerateUPP)(NPP npp, NPObject *obj, NPIdentifier **identifier, uint32_t *count);
482 #define NewNPN_EnumerateProc(FUNC) \
483 ((NPN_EnumerateUPP) (FUNC))
484 #define CallNPN_EnumerateProc(FUNC, ARG1, ARG2, ARG3, ARG4) \
485 (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4))
488 typedef void (* NP_LOADDS NPN_PluginThreadAsyncCallUPP)(NPP instance, void (*func)(void *), void *userData);
489 #define NewNPN_PluginThreadAsyncCallProc(FUNC) \
490 ((NPN_PluginThreadAsyncCallUPP) (FUNC))
491 #define CallNPN_PluginThreadAsyncCallProc(FUNC, ARG1, ARG2, ARG3) \
492 (*(FUNC))((ARG1), (ARG2), (ARG3))
495 /******************************************************************************************
496 * The actual plugin function table definitions
497 *******************************************************************************************/
499 typedef struct _NPPluginFuncs {
503 NPP_DestroyUPP destroy;
504 NPP_SetWindowUPP setwindow;
505 NPP_NewStreamUPP newstream;
506 NPP_DestroyStreamUPP destroystream;
507 NPP_StreamAsFileUPP asfile;
508 NPP_WriteReadyUPP writeready;
511 NPP_HandleEventUPP event;
512 NPP_URLNotifyUPP urlnotify;
513 JRIGlobalRef javaClass;
514 NPP_GetValueUPP getvalue;
515 NPP_SetValueUPP setvalue;
518 typedef struct _NPNetscapeFuncs {
521 NPN_GetURLUPP geturl;
522 NPN_PostURLUPP posturl;
523 NPN_RequestReadUPP requestread;
524 NPN_NewStreamUPP newstream;
526 NPN_DestroyStreamUPP destroystream;
527 NPN_StatusUPP status;
528 NPN_UserAgentUPP uagent;
529 NPN_MemAllocUPP memalloc;
530 NPN_MemFreeUPP memfree;
531 NPN_MemFlushUPP memflush;
532 NPN_ReloadPluginsUPP reloadplugins;
533 NPN_GetJavaEnvUPP getJavaEnv;
534 NPN_GetJavaPeerUPP getJavaPeer;
535 NPN_GetURLNotifyUPP geturlnotify;
536 NPN_PostURLNotifyUPP posturlnotify;
537 NPN_GetValueUPP getvalue;
538 NPN_SetValueUPP setvalue;
539 NPN_InvalidateRectUPP invalidaterect;
540 NPN_InvalidateRegionUPP invalidateregion;
541 NPN_ForceRedrawUPP forceredraw;
542 NPN_GetStringIdentifierUPP getstringidentifier;
543 NPN_GetStringIdentifiersUPP getstringidentifiers;
544 NPN_GetIntIdentifierUPP getintidentifier;
545 NPN_IdentifierIsStringUPP identifierisstring;
546 NPN_UTF8FromIdentifierUPP utf8fromidentifier;
547 NPN_IntFromIdentifierUPP intfromidentifier;
548 NPN_CreateObjectUPP createobject;
549 NPN_RetainObjectUPP retainobject;
550 NPN_ReleaseObjectUPP releaseobject;
551 NPN_InvokeUPP invoke;
552 NPN_InvokeDefaultUPP invokeDefault;
553 NPN_EvaluateUPP evaluate;
554 NPN_GetPropertyUPP getproperty;
555 NPN_SetPropertyUPP setproperty;
556 NPN_RemovePropertyUPP removeproperty;
557 NPN_HasPropertyUPP hasproperty;
558 NPN_HasMethodUPP hasmethod;
559 NPN_ReleaseVariantValueUPP releasevariantvalue;
560 NPN_SetExceptionUPP setexception;
561 NPN_PushPopupsEnabledStateUPP pushpopupsenabledstate;
562 NPN_PopPopupsEnabledStateUPP poppopupsenabledstate;
563 NPN_EnumerateUPP enumerate;
564 NPN_PluginThreadAsyncCallUPP pluginthreadasynccall;
569 /******************************************************************************************
570 * Mac platform-specific plugin glue stuff
571 *******************************************************************************************/
574 * Main entry point of the plugin.
575 * This routine will be called when the plugin is loaded. The function
576 * tables are passed in and the plugin fills in the NPPluginFuncs table
577 * and NPPShutdownUPP for Netscape's use.
579 typedef NPError (* NP_LOADDS NPP_MainEntryUPP)(NPNetscapeFuncs*, NPPluginFuncs*, NPP_ShutdownUPP*);
580 #define NewNPP_MainEntryProc(FUNC) \
581 ((NPP_MainEntryUPP) (FUNC))
582 #define CallNPP_MainEntryProc(FUNC, netscapeFunc, pluginFunc, shutdownUPP) \
583 (*(FUNC))((netscapeFunc), (pluginFunc), (shutdownUPP))
586 * Mac OS X version(s) of NP_GetMIMEDescription(const char *)
587 * These can be called to retreive MIME information from the plugin dynamically
589 * Note: For compatibility with Quicktime, BPSupportedMIMEtypes is another way
590 * to get mime info from the plugin only on OSX and may not be supported
591 * in furture version -- use NP_GetMIMEDescription instead
596 kBPSupportedMIMETypesStructVers_1 = 1
599 typedef struct _BPSupportedMIMETypes
601 SInt32 structVersion; /* struct version */
602 Handle typeStrings; /* STR# formated handle, allocated by plug-in */
603 Handle infoStrings; /* STR# formated handle, allocated by plug-in */
604 } BPSupportedMIMETypes;
605 OSErr BP_GetSupportedMIMETypes(BPSupportedMIMETypes *mimeInfo, UInt32 flags);
607 /* NP_GetMIMEDescription */
608 #define NP_GETMIMEDESCRIPTION_NAME "NP_GetMIMEDescription"
609 typedef const char* (* NP_LOADDS NP_GetMIMEDescriptionUPP)();
610 #define NewNP_GetMIMEDescEntryProc(FUNC) \
611 ((NP_GetMIMEDescriptionUPP) (FUNC))
612 #define CallNP_GetMIMEDescEntryProc(FUNC) \
615 /* BP_GetSupportedMIMETypes */
616 typedef OSErr (* NP_LOADDS BP_GetSupportedMIMETypesUPP)(BPSupportedMIMETypes*, UInt32);
617 #define NewBP_GetSupportedMIMETypesEntryProc(FUNC) \
618 ((BP_GetSupportedMIMETypesUPP) (FUNC))
619 #define CallBP_GetMIMEDescEntryProc(FUNC, mimeInfo, flags) \
620 (*(FUNC))((mimeInfo), (flags))
622 #endif /* XP_MACOSX */
624 #if defined(_WINDOWS)
625 #define OSCALL WINAPI
628 #define OSCALL _System
635 /* GCC 3.3 and later support the visibility attribute. */
636 #if defined(__GNUC__) && \
637 ((__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3))
638 #define NP_VISIBILITY_DEFAULT __attribute__((visibility("default")))
640 #define NP_VISIBILITY_DEFAULT
643 #define NP_EXPORT(__type) NP_VISIBILITY_DEFAULT __type
646 #if defined( _WINDOWS ) || defined (__OS2__)
652 /* plugin meta member functions */
655 typedef struct _NPPluginData { /* Alternate OS2 Plugin interface */
658 char *pFileOpenTemplate;
660 char *pProductDescription;
661 unsigned long dwProductVersionMS;
662 unsigned long dwProductVersionLS;
665 NPError OSCALL NP_GetPluginData(NPPluginData * pPluginData);
669 NPError OSCALL NP_GetEntryPoints(NPPluginFuncs* pFuncs);
671 NPError OSCALL NP_Initialize(NPNetscapeFuncs* pFuncs);
673 NPError OSCALL NP_Shutdown();
675 char* NP_GetMIMEDescription();
681 #endif /* _WINDOWS || __OS2__ */
693 /* plugin meta member functions */
695 NP_EXPORT(char*) NP_GetMIMEDescription(void);
696 NP_EXPORT(NPError) NP_Initialize(NPNetscapeFuncs*, NPPluginFuncs*);
697 NP_EXPORT(NPError) NP_Shutdown(void);
698 NP_EXPORT(NPError) NP_GetValue(void *future, NPPVariable aVariable, void *aValue);
706 #endif /* _NPUPP_H_ */