Home | History | Annotate | Download | only in plugin
      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.25 $
     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 */
     75 typedef 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 */
     82 typedef 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 */
     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)		\
     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 */
     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))
    101 
    102 /* NPP_SetWindow */
    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))
    108 
    109 /* NPP_NewStream */
    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))
    115 
    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))
    122 
    123 /* NPP_WriteReady */
    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))
    129 
    130 /* NPP_Write */
    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))
    136 
    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))
    143 
    144 /* NPP_Print */
    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))
    150 
    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))
    157 
    158 /* NPP_URLNotify */
    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))
    164 
    165 /* NPP_GetValue */
    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))
    171 
    172 /* NPP_SetValue */
    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))
    178 
    179 /*
    180  *  Netscape entry points
    181  */
    182 
    183 
    184 /* NPN_GetValue */
    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))
    190 
    191 /* NPN_SetValue */
    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))
    197 
    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))
    204 
    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))
    211 
    212 /* NPN_GetUrl */
    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))
    218 
    219 /* NPN_PostUrl */
    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))
    225 
    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))
    232 
    233 /* NPN_NewStream */
    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))
    239 
    240 /* NPN_Write */
    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))
    246 
    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))
    253 
    254 /* NPN_Status */
    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))
    260 
    261 /* NPN_UserAgent */
    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)               \
    266                 (*(FUNC))((ARG1))
    267 
    268 /* NPN_MemAlloc */
    269 typedef 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 */
    276 typedef 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 */
    283 typedef 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 */
    290 typedef 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 */
    297 typedef 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 */
    304 typedef 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 */
    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))
    316 
    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))
    323 
    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)		\
    329 		(*(FUNC))((ARG1))
    330 
    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)		\
    336 		(*(FUNC))((ARG1))
    337 
    338 /* NPN_GetStringIdentifiers */
    339 typedef 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 */
    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)		\
    352 		(*(FUNC))((ARG1))
    353 
    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)		\
    359 		(*(FUNC))((ARG1))
    360 
    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)		\
    366 		(*(FUNC))((ARG1))
    367 
    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)		\
    373 		(*(FUNC))((ARG1))
    374 
    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))
    381 
    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)		\
    387 		(*(FUNC))((ARG1))
    388 
    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)		\
    394 		(*(FUNC))((ARG1))
    395 
    396 /* NPN_Invoke */
    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))
    402 
    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))
    409 
    410 /* NPN_Evaluate */
    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))
    416 
    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))
    423 
    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))
    430 
    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))
    437 
    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))
    444 
    445 /* NPN_HasMethod */
    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))
    451 
    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)		\
    457 		(*(FUNC))((ARG1))
    458 
    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))
    465 
    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))
    472 
    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)		\
    478 		(*(FUNC))((ARG1))
    479 
    480 /* NPN_Enumerate */
    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))
    486 
    487 /* NPN_Enumerate */
    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))
    493 
    494 
    495 /******************************************************************************************
    496  * The actual plugin function table definitions
    497  *******************************************************************************************/
    498 
    499 typedef struct _NPPluginFuncs {
    500     uint16 size;
    501     uint16 version;
    502     NPP_NewUPP newp;
    503     NPP_DestroyUPP destroy;
    504     NPP_SetWindowUPP setwindow;
    505     NPP_NewStreamUPP newstream;
    506     NPP_DestroyStreamUPP destroystream;
    507     NPP_StreamAsFileUPP asfile;
    508     NPP_WriteReadyUPP writeready;
    509     NPP_WriteUPP write;
    510     NPP_PrintUPP print;
    511     NPP_HandleEventUPP event;
    512     NPP_URLNotifyUPP urlnotify;
    513     JRIGlobalRef javaClass;
    514     NPP_GetValueUPP getvalue;
    515     NPP_SetValueUPP setvalue;
    516 } NPPluginFuncs;
    517 
    518 typedef struct _NPNetscapeFuncs {
    519     uint16 size;
    520     uint16 version;
    521     NPN_GetURLUPP geturl;
    522     NPN_PostURLUPP posturl;
    523     NPN_RequestReadUPP requestread;
    524     NPN_NewStreamUPP newstream;
    525     NPN_WriteUPP write;
    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;
    565 } NPNetscapeFuncs;
    566 
    567 
    568 #ifdef XP_MACOSX
    569 /******************************************************************************************
    570  * Mac platform-specific plugin glue stuff
    571  *******************************************************************************************/
    572 
    573 /*
    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.
    578  */
    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))
    584 
    585 /*
    586  * Mac OS X version(s) of NP_GetMIMEDescription(const char *)
    587  * These can be called to retreive MIME information from the plugin dynamically
    588  *
    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
    592  */
    593 
    594 enum
    595 {
    596  kBPSupportedMIMETypesStructVers_1    = 1
    597 };
    598 
    599 typedef struct _BPSupportedMIMETypes
    600 {
    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);
    606 
    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)		\
    613 		(*(FUNC))()
    614 
    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))
    621 
    622 #endif /* XP_MACOSX */
    623 
    624 #if defined(_WINDOWS)
    625 #define OSCALL WINAPI
    626 #else
    627 #if defined(__OS2__)
    628 #define OSCALL _System
    629 #else
    630 #define OSCALL
    631 #endif
    632 #endif
    633 
    634 #if defined(XP_UNIX)
    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")))
    639 #else
    640 #define NP_VISIBILITY_DEFAULT
    641 #endif
    642 
    643 #define NP_EXPORT(__type) NP_VISIBILITY_DEFAULT __type
    644 #endif
    645 
    646 #if defined( _WINDOWS ) || defined (__OS2__)
    647 
    648 #ifdef __cplusplus
    649 extern "C" {
    650 #endif
    651 
    652 /* plugin meta member functions */
    653 #if defined(__OS2__)
    654 
    655 typedef struct _NPPluginData {   /* Alternate OS2 Plugin interface */
    656     char *pMimeTypes;
    657     char *pFileExtents;
    658     char *pFileOpenTemplate;
    659     char *pProductName;
    660     char *pProductDescription;
    661     unsigned long dwProductVersionMS;
    662     unsigned long dwProductVersionLS;
    663 } NPPluginData;
    664 
    665 NPError OSCALL NP_GetPluginData(NPPluginData * pPluginData);
    666 
    667 #endif
    668 
    669 NPError OSCALL NP_GetEntryPoints(NPPluginFuncs* pFuncs);
    670 
    671 NPError OSCALL NP_Initialize(NPNetscapeFuncs* pFuncs);
    672 
    673 NPError OSCALL NP_Shutdown();
    674 
    675 char*	NP_GetMIMEDescription();
    676 
    677 #ifdef __cplusplus
    678 }
    679 #endif
    680 
    681 #endif /* _WINDOWS || __OS2__ */
    682 
    683 #if defined(__OS2__)
    684 #pragma pack()
    685 #endif
    686 
    687 #ifdef XP_UNIX
    688 
    689 #ifdef __cplusplus
    690 extern "C" {
    691 #endif
    692 
    693 /* plugin meta member functions */
    694 
    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);
    699 
    700 #ifdef __cplusplus
    701 }
    702 #endif
    703 
    704 #endif /* XP_UNIX */
    705 
    706 #endif /* _NPUPP_H_ */
    707