PageRenderTime 413ms CodeModel.GetById 101ms app.highlight 104ms RepoModel.GetById 91ms app.codeStats 1ms

/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
 39/*
 40 *  npupp.h $Revision: 3.26 $
 41 *  function call mecahnics needed by platform specific glue code.
 42 */
 43
 44
 45#ifndef _NPUPP_H_
 46#define _NPUPP_H_
 47
 48#if defined(__OS2__)
 49#pragma pack(1)
 50#endif
 51
 52#ifndef GENERATINGCFM
 53#define GENERATINGCFM 0
 54#endif
 55
 56#ifndef _NPAPI_H_
 57#include "npapi.h"
 58#endif
 59
 60#include "npruntime.h"
 61
 62#include "jri.h"
 63
 64
 65/******************************************************************************************
 66   plug-in function table macros
 67 	        for each function in and out of the plugin API we define
 68                    typedef NPP_FooUPP
 69					#define NewNPP_FooProc
 70					#define CallNPP_FooProc
 71 *******************************************************************************************/
 72
 73
 74/* NPP_Initialize */
 75typedef void (* NP_LOADDS NPP_InitializeUPP)(void);
 76#define NewNPP_InitializeProc(FUNC)		\
 77		((NPP_InitializeUPP) (FUNC))
 78#define CallNPP_InitializeProc(FUNC)		\
 79		(*(FUNC))()
 80
 81/* NPP_Shutdown */
 82typedef void (* NP_LOADDS NPP_ShutdownUPP)(void);
 83#define NewNPP_ShutdownProc(FUNC)		\
 84		((NPP_ShutdownUPP) (FUNC))
 85#define CallNPP_ShutdownProc(FUNC)		\
 86		(*(FUNC))()
 87
 88/* NPP_New */
 89typedef NPError	(* NP_LOADDS NPP_NewUPP)(NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, char* argn[], char* argv[], NPSavedData* saved);
 90#define NewNPP_NewProc(FUNC)		\
 91		((NPP_NewUPP) (FUNC))
 92#define CallNPP_NewProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6, ARG7)		\
 93		(*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4), (ARG5), (ARG6), (ARG7))
 94
 95/* NPP_Destroy */
 96typedef 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))
101
102/* NPP_SetWindow */
103typedef 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))
108
109/* NPP_NewStream */
110typedef 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))
115
116/* NPP_DestroyStream */
117typedef 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))
122
123/* NPP_WriteReady */
124typedef 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))
129
130/* NPP_Write */
131typedef 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))
136
137/* NPP_StreamAsFile */
138typedef 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))
143
144/* NPP_Print */
145typedef 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))
150
151/* NPP_HandleEvent */
152typedef 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))
157
158/* NPP_URLNotify */
159typedef 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))
164
165/* NPP_GetValue */
166typedef 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))
171
172/* NPP_SetValue */
173typedef 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))
178
179/*
180 *  Netscape entry points
181 */
182
183
184/* NPN_GetValue */
185typedef 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))
190
191/* NPN_SetValue */
192typedef 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))
197
198/* NPN_GetUrlNotify */
199typedef 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))
204
205/* NPN_PostUrlNotify */
206typedef 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))
211
212/* NPN_GetUrl */
213typedef 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))
218
219/* NPN_PostUrl */
220typedef 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))
225
226/* NPN_RequestRead */
227typedef 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))
232
233/* NPN_NewStream */
234typedef 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))
239
240/* NPN_Write */
241typedef 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))
246
247/* NPN_DestroyStream */
248typedef 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))
253
254/* NPN_Status */
255typedef 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))	
260
261/* NPN_UserAgent */
262typedef const char*	(* NP_LOADDS NPN_UserAgentUPP)(NPP instance);
263#define NewNPN_UserAgentProc(FUNC)              \
264                ((NPN_UserAgentUPP) (FUNC))
265#define CallNPN_UserAgentProc(FUNC, ARG1)               \
266                (*(FUNC))((ARG1))
267
268/* NPN_MemAlloc */
269typedef void* (* NP_LOADDS NPN_MemAllocUPP)(uint32 size);
270#define NewNPN_MemAllocProc(FUNC)		\
271		((NPN_MemAllocUPP) (FUNC))
272#define CallNPN_MemAllocProc(FUNC, ARG1)		\
273		(*(FUNC))((ARG1))	
274
275/* NPN__MemFree */
276typedef void (* NP_LOADDS NPN_MemFreeUPP)(void* ptr);
277#define NewNPN_MemFreeProc(FUNC)		\
278		((NPN_MemFreeUPP) (FUNC))
279#define CallNPN_MemFreeProc(FUNC, ARG1)		\
280		(*(FUNC))((ARG1))	
281
282/* NPN_MemFlush */
283typedef uint32 (* NP_LOADDS NPN_MemFlushUPP)(uint32 size);
284#define NewNPN_MemFlushProc(FUNC)		\
285		((NPN_MemFlushUPP) (FUNC))
286#define CallNPN_MemFlushProc(FUNC, ARG1)		\
287		(*(FUNC))((ARG1))	
288
289/* NPN_ReloadPlugins */
290typedef void (* NP_LOADDS NPN_ReloadPluginsUPP)(NPBool reloadPages);
291#define NewNPN_ReloadPluginsProc(FUNC)		\
292		((NPN_ReloadPluginsUPP) (FUNC))
293#define CallNPN_ReloadPluginsProc(FUNC, ARG1)		\
294		(*(FUNC))((ARG1))	
295
296/* NPN_GetJavaEnv */
297typedef JRIEnv* (* NP_LOADDS NPN_GetJavaEnvUPP)(void);
298#define NewNPN_GetJavaEnvProc(FUNC)		\
299		((NPN_GetJavaEnvUPP) (FUNC))
300#define CallNPN_GetJavaEnvProc(FUNC)		\
301		(*(FUNC))()	
302
303/* NPN_GetJavaPeer */
304typedef jref (* NP_LOADDS NPN_GetJavaPeerUPP)(NPP instance);
305#define NewNPN_GetJavaPeerProc(FUNC)		\
306		((NPN_GetJavaPeerUPP) (FUNC))
307#define CallNPN_GetJavaPeerProc(FUNC, ARG1)		\
308		(*(FUNC))((ARG1))	
309
310/* NPN_InvalidateRect */
311typedef 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))	
316
317/* NPN_InvalidateRegion */
318typedef 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))	
323
324/* NPN_ForceRedraw */
325typedef void (* NP_LOADDS NPN_ForceRedrawUPP)(NPP instance);
326#define NewNPN_ForceRedrawProc(FUNC)		\
327		((NPN_ForceRedrawUPP) (FUNC))
328#define CallNPN_ForceRedrawProc(FUNC, ARG1)		\
329		(*(FUNC))((ARG1))	
330
331/* NPN_GetStringIdentifier */
332typedef NPIdentifier (* NP_LOADDS NPN_GetStringIdentifierUPP)(const NPUTF8* name);
333#define NewNPN_GetStringIdentifierProc(FUNC)		\
334		((NPN_GetStringIdentifierUPP) (FUNC))
335#define CallNPN_GetStringIdentifierProc(FUNC, ARG1)		\
336		(*(FUNC))((ARG1))
337
338/* NPN_GetStringIdentifiers */
339typedef void (* NP_LOADDS NPN_GetStringIdentifiersUPP)(const NPUTF8** names,
340                                                 int32_t nameCount,
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))
346
347/* NPN_GetIntIdentifier */
348typedef NPIdentifier (* NP_LOADDS NPN_GetIntIdentifierUPP)(int32_t intid);
349#define NewNPN_GetIntIdentifierProc(FUNC)		\
350		((NPN_GetIntIdentifierUPP) (FUNC))
351#define CallNPN_GetIntIdentifierProc(FUNC, ARG1)		\
352		(*(FUNC))((ARG1))
353
354/* NPN_IdentifierIsString */
355typedef bool (* NP_LOADDS NPN_IdentifierIsStringUPP)(NPIdentifier identifier);
356#define NewNPN_IdentifierIsStringProc(FUNC)		\
357		((NPN_IdentifierIsStringUPP) (FUNC))
358#define CallNPN_IdentifierIsStringProc(FUNC, ARG1)		\
359		(*(FUNC))((ARG1))
360
361/* NPN_UTF8FromIdentifier */
362typedef NPUTF8* (* NP_LOADDS NPN_UTF8FromIdentifierUPP)(NPIdentifier identifier);
363#define NewNPN_UTF8FromIdentifierProc(FUNC)		\
364		((NPN_UTF8FromIdentifierUPP) (FUNC))
365#define CallNPN_UTF8FromIdentifierProc(FUNC, ARG1)		\
366		(*(FUNC))((ARG1))
367
368/* NPN_IntFromIdentifier */
369typedef int32_t (* NP_LOADDS NPN_IntFromIdentifierUPP)(NPIdentifier identifier);
370#define NewNPN_IntFromIdentifierProc(FUNC)		\
371		((NPN_IntFromIdentifierUPP) (FUNC))
372#define CallNPN_IntFromIdentifierProc(FUNC, ARG1)		\
373		(*(FUNC))((ARG1))
374
375/* NPN_CreateObject */
376typedef 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))
381
382/* NPN_RetainObject */
383typedef NPObject* (* NP_LOADDS NPN_RetainObjectUPP)(NPObject *obj);
384#define NewNPN_RetainObjectProc(FUNC)		\
385		((NPN_RetainObjectUPP) (FUNC))
386#define CallNPN_RetainObjectProc(FUNC, ARG1)		\
387		(*(FUNC))((ARG1))
388
389/* NPN_ReleaseObject */
390typedef void (* NP_LOADDS NPN_ReleaseObjectUPP)(NPObject *obj);
391#define NewNPN_ReleaseObjectProc(FUNC)		\
392		((NPN_ReleaseObjectUPP) (FUNC))
393#define CallNPN_ReleaseObjectProc(FUNC, ARG1)		\
394		(*(FUNC))((ARG1))
395
396/* NPN_Invoke */
397typedef 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))
402
403/* NPN_InvokeDefault */
404typedef 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))
409
410/* NPN_Evaluate */
411typedef 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))
416
417/* NPN_GetProperty */
418typedef 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))
423
424/* NPN_SetProperty */
425typedef 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))
430
431/* NPN_RemoveProperty */
432typedef 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))
437
438/* NPN_HasProperty */
439typedef 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))
444
445/* NPN_HasMethod */
446typedef 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))
451
452/* NPN_ReleaseVariantValue */
453typedef void (* NP_LOADDS NPN_ReleaseVariantValueUPP)(NPVariant *variant);
454#define NewNPN_ReleaseVariantValueProc(FUNC)		\
455		((NPN_ReleaseVariantValueUPP) (FUNC))
456#define CallNPN_ReleaseVariantValueProc(FUNC, ARG1)		\
457		(*(FUNC))((ARG1))
458
459/* NPN_SetException */
460typedef 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))	
465
466/* NPN_PushPopupsEnabledStateUPP */
467typedef 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))
472
473/* NPN_PopPopupsEnabledState */
474typedef bool (* NP_LOADDS NPN_PopPopupsEnabledStateUPP)(NPP npp);
475#define NewNPN_PopPopupsEnabledStateProc(FUNC)		\
476		((NPN_PopPopupsEnabledStateUPP) (FUNC))
477#define CallNPN_PopPopupsEnabledStateProc(FUNC, ARG1)		\
478		(*(FUNC))((ARG1))
479
480/* NPN_Enumerate */
481typedef 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))
486
487/* NPN_PluginThreadAsyncCall */
488typedef 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))
493
494/* NPN_Construct */
495typedef bool (* NP_LOADDS NPN_ConstructUPP)(NPP npp, NPObject* obj, const NPVariant *args, uint32_t argCount, NPVariant *result);
496#define NewNPN_ConstructProc(FUNC)		\
497		((NPN_ConstructUPP) (FUNC))
498#define CallNPN_ConstructProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5)      \
499		(*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4), (ARG5))
500
501
502
503/******************************************************************************************
504 * The actual plugin function table definitions
505 *******************************************************************************************/
506
507typedef struct _NPPluginFuncs {
508    uint16 size;
509    uint16 version;
510    NPP_NewUPP newp;
511    NPP_DestroyUPP destroy;
512    NPP_SetWindowUPP setwindow;
513    NPP_NewStreamUPP newstream;
514    NPP_DestroyStreamUPP destroystream;
515    NPP_StreamAsFileUPP asfile;
516    NPP_WriteReadyUPP writeready;
517    NPP_WriteUPP write;
518    NPP_PrintUPP print;
519    NPP_HandleEventUPP event;
520    NPP_URLNotifyUPP urlnotify;
521    JRIGlobalRef javaClass;
522    NPP_GetValueUPP getvalue;
523    NPP_SetValueUPP setvalue;
524} NPPluginFuncs;
525
526typedef struct _NPNetscapeFuncs {
527    uint16 size;
528    uint16 version;
529    NPN_GetURLUPP geturl;
530    NPN_PostURLUPP posturl;
531    NPN_RequestReadUPP requestread;
532    NPN_NewStreamUPP newstream;
533    NPN_WriteUPP write;
534    NPN_DestroyStreamUPP destroystream;
535    NPN_StatusUPP status;
536    NPN_UserAgentUPP uagent;
537    NPN_MemAllocUPP memalloc;
538    NPN_MemFreeUPP memfree;
539    NPN_MemFlushUPP memflush;
540    NPN_ReloadPluginsUPP reloadplugins;
541    NPN_GetJavaEnvUPP getJavaEnv;
542    NPN_GetJavaPeerUPP getJavaPeer;
543    NPN_GetURLNotifyUPP geturlnotify;
544    NPN_PostURLNotifyUPP posturlnotify;
545    NPN_GetValueUPP getvalue;
546    NPN_SetValueUPP setvalue;
547    NPN_InvalidateRectUPP invalidaterect;
548    NPN_InvalidateRegionUPP invalidateregion;
549    NPN_ForceRedrawUPP forceredraw;
550    NPN_GetStringIdentifierUPP getstringidentifier;
551    NPN_GetStringIdentifiersUPP getstringidentifiers;
552    NPN_GetIntIdentifierUPP getintidentifier;
553    NPN_IdentifierIsStringUPP identifierisstring;
554    NPN_UTF8FromIdentifierUPP utf8fromidentifier;
555    NPN_IntFromIdentifierUPP intfromidentifier;
556    NPN_CreateObjectUPP createobject;
557    NPN_RetainObjectUPP retainobject;
558    NPN_ReleaseObjectUPP releaseobject;
559    NPN_InvokeUPP invoke;
560    NPN_InvokeDefaultUPP invokeDefault;
561    NPN_EvaluateUPP evaluate;
562    NPN_GetPropertyUPP getproperty;
563    NPN_SetPropertyUPP setproperty;
564    NPN_RemovePropertyUPP removeproperty;
565    NPN_HasPropertyUPP hasproperty;
566    NPN_HasMethodUPP hasmethod;
567    NPN_ReleaseVariantValueUPP releasevariantvalue;
568    NPN_SetExceptionUPP setexception;
569    NPN_PushPopupsEnabledStateUPP pushpopupsenabledstate;
570    NPN_PopPopupsEnabledStateUPP poppopupsenabledstate;
571    NPN_EnumerateUPP enumerate;
572    NPN_PluginThreadAsyncCallUPP pluginthreadasynccall;
573    NPN_ConstructUPP construct;
574} NPNetscapeFuncs;
575
576
577#ifdef XP_MACOSX
578/******************************************************************************************
579 * Mac platform-specific plugin glue stuff
580 *******************************************************************************************/
581
582/*
583 * Main entry point of the plugin.
584 * This routine will be called when the plugin is loaded. The function
585 * tables are passed in and the plugin fills in the NPPluginFuncs table
586 * and NPPShutdownUPP for Netscape's use.
587 */
588typedef NPError (* NP_LOADDS NPP_MainEntryUPP)(NPNetscapeFuncs*, NPPluginFuncs*, NPP_ShutdownUPP*);
589#define NewNPP_MainEntryProc(FUNC)		\
590		((NPP_MainEntryUPP) (FUNC))
591#define CallNPP_MainEntryProc(FUNC,  netscapeFunc, pluginFunc, shutdownUPP)		\
592		(*(FUNC))((netscapeFunc), (pluginFunc), (shutdownUPP))
593
594/*
595 * Mac OS X version(s) of NP_GetMIMEDescription(const char *)
596 * These can be called to retreive MIME information from the plugin dynamically
597 *
598 * Note: For compatibility with Quicktime, BPSupportedMIMEtypes is another way
599 *       to get mime info from the plugin only on OSX and may not be supported 
600 *       in furture version -- use NP_GetMIMEDescription instead
601 */
602
603enum
604{
605 kBPSupportedMIMETypesStructVers_1    = 1
606};
607
608typedef struct _BPSupportedMIMETypes
609{
610 SInt32    structVersion;      /* struct version */
611 Handle    typeStrings;        /* STR# formated handle, allocated by plug-in */
612 Handle    infoStrings;        /* STR# formated handle, allocated by plug-in */
613} BPSupportedMIMETypes;
614OSErr BP_GetSupportedMIMETypes(BPSupportedMIMETypes *mimeInfo, UInt32 flags);
615
616 /* NP_GetMIMEDescription */
617#define NP_GETMIMEDESCRIPTION_NAME "NP_GetMIMEDescription"
618typedef const char* (* NP_LOADDS NP_GetMIMEDescriptionUPP)();
619#define NewNP_GetMIMEDescEntryProc(FUNC)		\
620		((NP_GetMIMEDescriptionUPP) (FUNC))
621#define CallNP_GetMIMEDescEntryProc(FUNC)		\
622		(*(FUNC))()
623
624/* BP_GetSupportedMIMETypes */
625typedef OSErr (* NP_LOADDS BP_GetSupportedMIMETypesUPP)(BPSupportedMIMETypes*, UInt32);
626#define NewBP_GetSupportedMIMETypesEntryProc(FUNC)		\
627		((BP_GetSupportedMIMETypesUPP) (FUNC))
628#define CallBP_GetMIMEDescEntryProc(FUNC,  mimeInfo, flags)		\
629		(*(FUNC))((mimeInfo), (flags))
630
631#endif /* XP_MACOSX */
632
633#if defined(_WINDOWS)
634#define OSCALL WINAPI
635#else
636#if defined(__OS2__)
637#define OSCALL _System
638#else
639#define OSCALL
640#endif
641#endif
642
643#if defined(XP_UNIX)
644/* GCC 3.3 and later support the visibility attribute. */
645#if defined(__GNUC__) && \
646    ((__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3))
647#define NP_VISIBILITY_DEFAULT __attribute__((visibility("default")))
648#else
649#define NP_VISIBILITY_DEFAULT
650#endif
651
652#define NP_EXPORT(__type) NP_VISIBILITY_DEFAULT __type
653#endif
654
655#if defined( _WINDOWS ) || defined (__OS2__)
656
657#ifdef __cplusplus
658extern "C" {
659#endif
660
661/* plugin meta member functions */
662#if defined(__OS2__)
663
664typedef struct _NPPluginData {   /* Alternate OS2 Plugin interface */
665    char *pMimeTypes;
666    char *pFileExtents;
667    char *pFileOpenTemplate;
668    char *pProductName;
669    char *pProductDescription;
670    unsigned long dwProductVersionMS;
671    unsigned long dwProductVersionLS;
672} NPPluginData;
673
674NPError OSCALL NP_GetPluginData(NPPluginData * pPluginData);
675
676#endif
677
678NPError OSCALL NP_GetEntryPoints(NPPluginFuncs* pFuncs);
679
680NPError OSCALL NP_Initialize(NPNetscapeFuncs* pFuncs);
681
682NPError OSCALL NP_Shutdown();
683
684char*	NP_GetMIMEDescription();
685
686#ifdef __cplusplus
687}
688#endif
689
690#endif /* _WINDOWS || __OS2__ */
691
692#if defined(__OS2__)
693#pragma pack()
694#endif
695
696#ifdef XP_UNIX
697
698#ifdef __cplusplus
699extern "C" {
700#endif
701
702/* plugin meta member functions */
703
704NP_EXPORT(char*)   NP_GetMIMEDescription(void);
705NP_EXPORT(NPError) NP_Initialize(NPNetscapeFuncs*, NPPluginFuncs*);
706NP_EXPORT(NPError) NP_Shutdown(void);
707NP_EXPORT(NPError) NP_GetValue(void *future, NPPVariable aVariable, void *aValue);
708
709#ifdef __cplusplus
710}
711#endif
712
713#endif /* XP_UNIX */
714
715#endif /* _NPUPP_H_ */