merge the formfield patch from ooo-build
[ooovba.git] / np_sdk / mozsrc / npupp.h
blob9cf63e12c5713371706f769305e204f77b845dd0
1 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: NPL 1.1/GPL 2.0/LGPL 2.1
5 * The contents of this file are subject to the Netscape Public License
6 * Version 1.1 (the "License"); you may not use this file except in
7 * compliance with the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/NPL/
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.
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.
22 * Contributor(s):
25 * Alternatively, the contents of this file may be used under the terms of
26 * either the GNU General Public License Version 2 or later (the "GPL"), or
27 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28 * in which case the provisions of the GPL or the LGPL are applicable instead
29 * of those above. If you wish to allow use of your version of this file only
30 * under the terms of either the GPL or the LGPL, and not to allow others to
31 * use your version of this file under the terms of the NPL, indicate your
32 * decision by deleting the provisions above and replace them with the notice
33 * and other provisions required by the GPL or the LGPL. If you do not delete
34 * the provisions above, a recipient may use your version of this file under
35 * the terms of any one of the NPL, the GPL or the LGPL.
37 * ***** END LICENSE BLOCK ***** */
41 * npupp.h $Revision: 1.2 $
42 * function call mecahnics needed by platform specific glue code.
46 #ifndef _NPUPP_H_
47 #define _NPUPP_H_
49 #if defined(__OS2__)
50 #pragma pack(1)
51 #endif
53 #ifndef GENERATINGCFM
54 #define GENERATINGCFM 0
55 #endif
57 #ifndef _NPAPI_H_
58 #include "npapi.h"
59 #endif
61 #include "jri.h"
63 /******************************************************************************************
64 plug-in function table macros
65 for each function in and out of the plugin API we define
66 typedef NPP_FooUPP
67 #define NewNPP_FooProc
68 #define CallNPP_FooProc
69 for mac, define the UPP magic for PPC/68K calling
70 *******************************************************************************************/
73 /* NPP_Initialize */
75 #define _NPUPP_USE_UPP_ (TARGET_RT_MAC_CFM && !TARGET_API_MAC_CARBON)
77 #if _NPUPP_USE_UPP_
78 typedef UniversalProcPtr NPP_InitializeUPP;
80 enum {
81 uppNPP_InitializeProcInfo = kThinkCStackBased
82 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(0))
83 | RESULT_SIZE(SIZE_CODE(0))
86 #define NewNPP_InitializeProc(FUNC) \
87 (NPP_InitializeUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_InitializeProcInfo, GetCurrentArchitecture())
88 #define CallNPP_InitializeProc(FUNC) \
89 (void)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_InitializeProcInfo)
91 #else
93 typedef void (* NP_LOADDS NPP_InitializeUPP)(void);
94 #define NewNPP_InitializeProc(FUNC) \
95 ((NPP_InitializeUPP) (FUNC))
96 #define CallNPP_InitializeProc(FUNC) \
97 (*(FUNC))()
99 #endif
102 /* NPP_Shutdown */
104 #if _NPUPP_USE_UPP_
105 typedef UniversalProcPtr NPP_ShutdownUPP;
107 enum {
108 uppNPP_ShutdownProcInfo = kThinkCStackBased
109 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(0))
110 | RESULT_SIZE(SIZE_CODE(0))
113 #define NewNPP_ShutdownProc(FUNC) \
114 (NPP_ShutdownUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_ShutdownProcInfo, GetCurrentArchitecture())
115 #define CallNPP_ShutdownProc(FUNC) \
116 (void)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_ShutdownProcInfo)
118 #else
120 typedef void (* NP_LOADDS NPP_ShutdownUPP)(void);
121 #define NewNPP_ShutdownProc(FUNC) \
122 ((NPP_ShutdownUPP) (FUNC))
123 #define CallNPP_ShutdownProc(FUNC) \
124 (*(FUNC))()
126 #endif
129 /* NPP_New */
131 #if _NPUPP_USE_UPP_
132 typedef UniversalProcPtr NPP_NewUPP;
134 enum {
135 uppNPP_NewProcInfo = kThinkCStackBased
136 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPMIMEType)))
137 | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPP)))
138 | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(uint16)))
139 | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(int16)))
140 | STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(char **)))
141 | STACK_ROUTINE_PARAMETER(6, SIZE_CODE(sizeof(char **)))
142 | STACK_ROUTINE_PARAMETER(7, SIZE_CODE(sizeof(NPSavedData *)))
143 | RESULT_SIZE(SIZE_CODE(sizeof(NPError)))
146 #define NewNPP_NewProc(FUNC) \
147 (NPP_NewUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_NewProcInfo, GetCurrentArchitecture())
148 #define CallNPP_NewProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6, ARG7) \
149 (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_NewProcInfo, \
150 (ARG1), (ARG2), (ARG3), (ARG4), (ARG5), (ARG6), (ARG7))
151 #else
153 typedef NPError (* NP_LOADDS NPP_NewUPP)(NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, char* argn[], char* argv[], NPSavedData* saved);
154 #define NewNPP_NewProc(FUNC) \
155 ((NPP_NewUPP) (FUNC))
156 #define CallNPP_NewProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6, ARG7) \
157 (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4), (ARG5), (ARG6), (ARG7))
159 #endif
162 /* NPP_Destroy */
164 #if _NPUPP_USE_UPP_
166 typedef UniversalProcPtr NPP_DestroyUPP;
167 enum {
168 uppNPP_DestroyProcInfo = kThinkCStackBased
169 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
170 | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPSavedData **)))
171 | RESULT_SIZE(SIZE_CODE(sizeof(NPError)))
173 #define NewNPP_DestroyProc(FUNC) \
174 (NPP_DestroyUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_DestroyProcInfo, GetCurrentArchitecture())
175 #define CallNPP_DestroyProc(FUNC, ARG1, ARG2) \
176 (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_DestroyProcInfo, (ARG1), (ARG2))
177 #else
179 typedef NPError (* NP_LOADDS NPP_DestroyUPP)(NPP instance, NPSavedData** save);
180 #define NewNPP_DestroyProc(FUNC) \
181 ((NPP_DestroyUPP) (FUNC))
182 #define CallNPP_DestroyProc(FUNC, ARG1, ARG2) \
183 (*(FUNC))((ARG1), (ARG2))
185 #endif
188 /* NPP_SetWindow */
190 #if _NPUPP_USE_UPP_
192 typedef UniversalProcPtr NPP_SetWindowUPP;
193 enum {
194 uppNPP_SetWindowProcInfo = kThinkCStackBased
195 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
196 | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPWindow *)))
197 | RESULT_SIZE(SIZE_CODE(sizeof(NPError)))
199 #define NewNPP_SetWindowProc(FUNC) \
200 (NPP_SetWindowUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_SetWindowProcInfo, GetCurrentArchitecture())
201 #define CallNPP_SetWindowProc(FUNC, ARG1, ARG2) \
202 (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_SetWindowProcInfo, (ARG1), (ARG2))
204 #else
206 typedef NPError (* NP_LOADDS NPP_SetWindowUPP)(NPP instance, NPWindow* window);
207 #define NewNPP_SetWindowProc(FUNC) \
208 ((NPP_SetWindowUPP) (FUNC))
209 #define CallNPP_SetWindowProc(FUNC, ARG1, ARG2) \
210 (*(FUNC))((ARG1), (ARG2))
212 #endif
215 /* NPP_NewStream */
217 #if _NPUPP_USE_UPP_
219 typedef UniversalProcPtr NPP_NewStreamUPP;
220 enum {
221 uppNPP_NewStreamProcInfo = kThinkCStackBased
222 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
223 | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPMIMEType)))
224 | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(NPStream *)))
225 | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(NPBool)))
226 | STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(uint16 *)))
227 | RESULT_SIZE(SIZE_CODE(sizeof(NPError)))
229 #define NewNPP_NewStreamProc(FUNC) \
230 (NPP_NewStreamUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_NewStreamProcInfo, GetCurrentArchitecture())
231 #define CallNPP_NewStreamProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5) \
232 (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_NewStreamProcInfo, (ARG1), (ARG2), (ARG3), (ARG4), (ARG5))
233 #else
235 typedef NPError (* NP_LOADDS NPP_NewStreamUPP)(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16* stype);
236 #define NewNPP_NewStreamProc(FUNC) \
237 ((NPP_NewStreamUPP) (FUNC))
238 #define CallNPP_NewStreamProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5) \
239 (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4), (ARG5))
240 #endif
243 /* NPP_DestroyStream */
245 #if _NPUPP_USE_UPP_
247 typedef UniversalProcPtr NPP_DestroyStreamUPP;
248 enum {
249 uppNPP_DestroyStreamProcInfo = kThinkCStackBased
250 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
251 | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPStream *)))
252 | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(NPReason)))
253 | RESULT_SIZE(SIZE_CODE(sizeof(NPError)))
255 #define NewNPP_DestroyStreamProc(FUNC) \
256 (NPP_DestroyStreamUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_DestroyStreamProcInfo, GetCurrentArchitecture())
257 #define CallNPP_DestroyStreamProc(FUNC, NPParg, NPStreamPtr, NPReasonArg) \
258 (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_DestroyStreamProcInfo, (NPParg), (NPStreamPtr), (NPReasonArg))
260 #else
262 typedef NPError (* NP_LOADDS NPP_DestroyStreamUPP)(NPP instance, NPStream* stream, NPReason reason);
263 #define NewNPP_DestroyStreamProc(FUNC) \
264 ((NPP_DestroyStreamUPP) (FUNC))
265 #define CallNPP_DestroyStreamProc(FUNC, NPParg, NPStreamPtr, NPReasonArg) \
266 (*(FUNC))((NPParg), (NPStreamPtr), (NPReasonArg))
268 #endif
271 /* NPP_WriteReady */
273 #if _NPUPP_USE_UPP_
275 typedef UniversalProcPtr NPP_WriteReadyUPP;
276 enum {
277 uppNPP_WriteReadyProcInfo = kThinkCStackBased
278 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
279 | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPStream *)))
280 | RESULT_SIZE(SIZE_CODE(sizeof(int32)))
282 #define NewNPP_WriteReadyProc(FUNC) \
283 (NPP_WriteReadyUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_WriteReadyProcInfo, GetCurrentArchitecture())
284 #define CallNPP_WriteReadyProc(FUNC, NPParg, NPStreamPtr) \
285 (int32)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_WriteReadyProcInfo, (NPParg), (NPStreamPtr))
287 #else
289 typedef int32 (* NP_LOADDS NPP_WriteReadyUPP)(NPP instance, NPStream* stream);
290 #define NewNPP_WriteReadyProc(FUNC) \
291 ((NPP_WriteReadyUPP) (FUNC))
292 #define CallNPP_WriteReadyProc(FUNC, NPParg, NPStreamPtr) \
293 (*(FUNC))((NPParg), (NPStreamPtr))
295 #endif
298 /* NPP_Write */
300 #if _NPUPP_USE_UPP_
302 typedef UniversalProcPtr NPP_WriteUPP;
303 enum {
304 uppNPP_WriteProcInfo = kThinkCStackBased
305 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
306 | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPStream *)))
307 | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(int32)))
308 | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(int32)))
309 | STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(void*)))
310 | RESULT_SIZE(SIZE_CODE(sizeof(int32)))
312 #define NewNPP_WriteProc(FUNC) \
313 (NPP_WriteUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_WriteProcInfo, GetCurrentArchitecture())
314 #define CallNPP_WriteProc(FUNC, NPParg, NPStreamPtr, offsetArg, lenArg, bufferPtr) \
315 (int32)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_WriteProcInfo, (NPParg), (NPStreamPtr), (offsetArg), (lenArg), (bufferPtr))
317 #else
319 typedef int32 (* NP_LOADDS NPP_WriteUPP)(NPP instance, NPStream* stream, int32 offset, int32 len, void* buffer);
320 #define NewNPP_WriteProc(FUNC) \
321 ((NPP_WriteUPP) (FUNC))
322 #define CallNPP_WriteProc(FUNC, NPParg, NPStreamPtr, offsetArg, lenArg, bufferPtr) \
323 (*(FUNC))((NPParg), (NPStreamPtr), (offsetArg), (lenArg), (bufferPtr))
325 #endif
328 /* NPP_StreamAsFile */
330 #if _NPUPP_USE_UPP_
332 typedef UniversalProcPtr NPP_StreamAsFileUPP;
333 enum {
334 uppNPP_StreamAsFileProcInfo = kThinkCStackBased
335 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
336 | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPStream *)))
337 | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(const char *)))
338 | RESULT_SIZE(SIZE_CODE(0))
340 #define NewNPP_StreamAsFileProc(FUNC) \
341 (NPP_StreamAsFileUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_StreamAsFileProcInfo, GetCurrentArchitecture())
342 #define CallNPP_StreamAsFileProc(FUNC, ARG1, ARG2, ARG3) \
343 (void)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_StreamAsFileProcInfo, (ARG1), (ARG2), (ARG3))
345 #else
347 typedef void (* NP_LOADDS NPP_StreamAsFileUPP)(NPP instance, NPStream* stream, const char* fname);
348 #define NewNPP_StreamAsFileProc(FUNC) \
349 ((NPP_StreamAsFileUPP) (FUNC))
350 #define CallNPP_StreamAsFileProc(FUNC, ARG1, ARG2, ARG3) \
351 (*(FUNC))((ARG1), (ARG2), (ARG3))
352 #endif
355 /* NPP_Print */
357 #if _NPUPP_USE_UPP_
359 typedef UniversalProcPtr NPP_PrintUPP;
360 enum {
361 uppNPP_PrintProcInfo = kThinkCStackBased
362 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
363 | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPPrint *)))
364 | RESULT_SIZE(SIZE_CODE(0))
366 #define NewNPP_PrintProc(FUNC) \
367 (NPP_PrintUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_PrintProcInfo, GetCurrentArchitecture())
368 #define CallNPP_PrintProc(FUNC, NPParg, voidPtr) \
369 (void)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_PrintProcInfo, (NPParg), (voidPtr))
371 #else
373 typedef void (* NP_LOADDS NPP_PrintUPP)(NPP instance, NPPrint* platformPrint);
374 #define NewNPP_PrintProc(FUNC) \
375 ((NPP_PrintUPP) (FUNC))
376 #define CallNPP_PrintProc(FUNC, NPParg, NPPrintArg) \
377 (*(FUNC))((NPParg), (NPPrintArg))
379 #endif
382 /* NPP_HandleEvent */
384 #if _NPUPP_USE_UPP_
386 typedef UniversalProcPtr NPP_HandleEventUPP;
387 enum {
388 uppNPP_HandleEventProcInfo = kThinkCStackBased
389 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
390 | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(void *)))
391 | RESULT_SIZE(SIZE_CODE(sizeof(int16)))
393 #define NewNPP_HandleEventProc(FUNC) \
394 (NPP_HandleEventUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_HandleEventProcInfo, GetCurrentArchitecture())
395 #define CallNPP_HandleEventProc(FUNC, NPParg, voidPtr) \
396 (int16)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_HandleEventProcInfo, (NPParg), (voidPtr))
398 #else
400 typedef int16 (* NP_LOADDS NPP_HandleEventUPP)(NPP instance, void* event);
401 #define NewNPP_HandleEventProc(FUNC) \
402 ((NPP_HandleEventUPP) (FUNC))
403 #define CallNPP_HandleEventProc(FUNC, NPParg, voidPtr) \
404 (*(FUNC))((NPParg), (voidPtr))
406 #endif
409 /* NPP_URLNotify */
411 #if _NPUPP_USE_UPP_
413 typedef UniversalProcPtr NPP_URLNotifyUPP;
414 enum {
415 uppNPP_URLNotifyProcInfo = kThinkCStackBased
416 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
417 | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(const char*)))
418 | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(NPReason)))
419 | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(void*)))
420 | RESULT_SIZE(SIZE_CODE(SIZE_CODE(0)))
422 #define NewNPP_URLNotifyProc(FUNC) \
423 (NPP_URLNotifyUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_URLNotifyProcInfo, GetCurrentArchitecture())
424 #define CallNPP_URLNotifyProc(FUNC, ARG1, ARG2, ARG3, ARG4) \
425 (void)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_URLNotifyProcInfo, (ARG1), (ARG2), (ARG3), (ARG4))
427 #else
429 typedef void (* NP_LOADDS NPP_URLNotifyUPP)(NPP instance, const char* url, NPReason reason, void* notifyData);
430 #define NewNPP_URLNotifyProc(FUNC) \
431 ((NPP_URLNotifyUPP) (FUNC))
432 #define CallNPP_URLNotifyProc(FUNC, ARG1, ARG2, ARG3, ARG4) \
433 (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4))
435 #endif
438 /* NPP_GetValue */
440 #if _NPUPP_USE_UPP_
442 typedef UniversalProcPtr NPP_GetValueUPP;
443 enum {
444 uppNPP_GetValueProcInfo = kThinkCStackBased
445 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
446 | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPPVariable)))
447 | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(void *)))
448 | RESULT_SIZE(SIZE_CODE(sizeof(NPError)))
450 #define NewNPP_GetValueProc(FUNC) \
451 (NPP_GetValueUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_GetValueProcInfo, GetCurrentArchitecture())
452 #define CallNPP_GetValueProc(FUNC, ARG1, ARG2, ARG3) \
453 (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_GetValueProcInfo, (ARG1), (ARG2), (ARG3))
454 #else
456 typedef NPError (* NP_LOADDS NPP_GetValueUPP)(NPP instance, NPPVariable variable, void *ret_alue);
457 #define NewNPP_GetValueProc(FUNC) \
458 ((NPP_GetValueUPP) (FUNC))
459 #define CallNPP_GetValueProc(FUNC, ARG1, ARG2, ARG3) \
460 (*(FUNC))((ARG1), (ARG2), (ARG3))
461 #endif
464 /* NPP_SetValue */
466 #if _NPUPP_USE_UPP_
468 typedef UniversalProcPtr NPP_SetValueUPP;
469 enum {
470 uppNPP_SetValueProcInfo = kThinkCStackBased
471 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
472 | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPNVariable)))
473 | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(void *)))
474 | RESULT_SIZE(SIZE_CODE(sizeof(NPError)))
476 #define NewNPP_SetValueProc(FUNC) \
477 (NPP_SetValueUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_SetValueProcInfo, GetCurrentArchitecture())
478 #define CallNPP_SetValueProc(FUNC, ARG1, ARG2, ARG3) \
479 (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_SetValueProcInfo, (ARG1), (ARG2), (ARG3))
480 #else
482 typedef NPError (* NP_LOADDS NPP_SetValueUPP)(NPP instance, NPNVariable variable, void *ret_alue);
483 #define NewNPP_SetValueProc(FUNC) \
484 ((NPP_SetValueUPP) (FUNC))
485 #define CallNPP_SetValueProc(FUNC, ARG1, ARG2, ARG3) \
486 (*(FUNC))((ARG1), (ARG2), (ARG3))
487 #endif
493 * Netscape entry points
497 /* NPN_GetValue */
499 #if _NPUPP_USE_UPP_
501 typedef UniversalProcPtr NPN_GetValueUPP;
502 enum {
503 uppNPN_GetValueProcInfo = kThinkCStackBased
504 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
505 | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPNVariable)))
506 | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(void *)))
507 | RESULT_SIZE(SIZE_CODE(sizeof(NPError)))
509 #define NewNPN_GetValueProc(FUNC) \
510 (NPN_GetValueUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_GetValueProcInfo, GetCurrentArchitecture())
511 #define CallNPN_GetValueProc(FUNC, ARG1, ARG2, ARG3) \
512 (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_GetValueProcInfo, (ARG1), (ARG2), (ARG3))
513 #else
515 typedef NPError (* NP_LOADDS NPN_GetValueUPP)(NPP instance, NPNVariable variable, void *ret_alue);
516 #define NewNPN_GetValueProc(FUNC) \
517 ((NPN_GetValueUPP) (FUNC))
518 #define CallNPN_GetValueProc(FUNC, ARG1, ARG2, ARG3) \
519 (*(FUNC))((ARG1), (ARG2), (ARG3))
520 #endif
523 /* NPN_SetValue */
525 #if _NPUPP_USE_UPP_
527 typedef UniversalProcPtr NPN_SetValueUPP;
528 enum {
529 uppNPN_SetValueProcInfo = kThinkCStackBased
530 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
531 | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPPVariable)))
532 | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(void *)))
533 | RESULT_SIZE(SIZE_CODE(sizeof(NPError)))
535 #define NewNPN_SetValueProc(FUNC) \
536 (NPN_SetValueUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_SetValueProcInfo, GetCurrentArchitecture())
537 #define CallNPN_SetValueProc(FUNC, ARG1, ARG2, ARG3) \
538 (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_SetValueProcInfo, (ARG1), (ARG2), (ARG3))
539 #else
541 typedef NPError (* NP_LOADDS NPN_SetValueUPP)(NPP instance, NPPVariable variable, void *ret_alue);
542 #define NewNPN_SetValueProc(FUNC) \
543 ((NPN_SetValueUPP) (FUNC))
544 #define CallNPN_SetValueProc(FUNC, ARG1, ARG2, ARG3) \
545 (*(FUNC))((ARG1), (ARG2), (ARG3))
546 #endif
549 /* NPN_GetUrlNotify */
551 #if _NPUPP_USE_UPP_
553 typedef UniversalProcPtr NPN_GetURLNotifyUPP;
554 enum {
555 uppNPN_GetURLNotifyProcInfo = kThinkCStackBased
556 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
557 | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(const char*)))
558 | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(const char*)))
559 | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(void*)))
560 | RESULT_SIZE(SIZE_CODE(sizeof(NPError)))
562 #define NewNPN_GetURLNotifyProc(FUNC) \
563 (NPN_GetURLNotifyUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_GetURLNotifyProcInfo, GetCurrentArchitecture())
564 #define CallNPN_GetURLNotifyProc(FUNC, ARG1, ARG2, ARG3, ARG4) \
565 (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_GetURLNotifyProcInfo, (ARG1), (ARG2), (ARG3), (ARG4))
566 #else
568 typedef NPError (* NP_LOADDS NPN_GetURLNotifyUPP)(NPP instance, const char* url, const char* window, void* notifyData);
569 #define NewNPN_GetURLNotifyProc(FUNC) \
570 ((NPN_GetURLNotifyUPP) (FUNC))
571 #define CallNPN_GetURLNotifyProc(FUNC, ARG1, ARG2, ARG3, ARG4) \
572 (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4))
573 #endif
576 /* NPN_PostUrlNotify */
578 #if _NPUPP_USE_UPP_
580 typedef UniversalProcPtr NPN_PostURLNotifyUPP;
581 enum {
582 uppNPN_PostURLNotifyProcInfo = kThinkCStackBased
583 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
584 | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(const char*)))
585 | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(const char*)))
586 | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(uint32)))
587 | STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(const char*)))
588 | STACK_ROUTINE_PARAMETER(6, SIZE_CODE(sizeof(NPBool)))
589 | STACK_ROUTINE_PARAMETER(7, SIZE_CODE(sizeof(void*)))
590 | RESULT_SIZE(SIZE_CODE(sizeof(NPError)))
592 #define NewNPN_PostURLNotifyProc(FUNC) \
593 (NPN_PostURLNotifyUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_PostURLNotifyProcInfo, GetCurrentArchitecture())
594 #define CallNPN_PostURLNotifyProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6, ARG7) \
595 (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_PostURLNotifyProcInfo, (ARG1), (ARG2), (ARG3), (ARG4), (ARG5), (ARG6), (ARG7))
596 #else
598 typedef NPError (* NP_LOADDS NPN_PostURLNotifyUPP)(NPP instance, const char* url, const char* window, uint32 len, const char* buf, NPBool file, void* notifyData);
599 #define NewNPN_PostURLNotifyProc(FUNC) \
600 ((NPN_PostURLNotifyUPP) (FUNC))
601 #define CallNPN_PostURLNotifyProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6, ARG7) \
602 (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4), (ARG5), (ARG6), (ARG7))
603 #endif
606 /* NPN_GetUrl */
608 #if _NPUPP_USE_UPP_
610 typedef UniversalProcPtr NPN_GetURLUPP;
611 enum {
612 uppNPN_GetURLProcInfo = kThinkCStackBased
613 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
614 | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(const char*)))
615 | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(const char*)))
616 | RESULT_SIZE(SIZE_CODE(sizeof(NPError)))
618 #define NewNPN_GetURLProc(FUNC) \
619 (NPN_GetURLUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_GetURLProcInfo, GetCurrentArchitecture())
620 #define CallNPN_GetURLProc(FUNC, ARG1, ARG2, ARG3) \
621 (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_GetURLProcInfo, (ARG1), (ARG2), (ARG3))
622 #else
624 typedef NPError (* NP_LOADDS NPN_GetURLUPP)(NPP instance, const char* url, const char* window);
625 #define NewNPN_GetURLProc(FUNC) \
626 ((NPN_GetURLUPP) (FUNC))
627 #define CallNPN_GetURLProc(FUNC, ARG1, ARG2, ARG3) \
628 (*(FUNC))((ARG1), (ARG2), (ARG3))
629 #endif
632 /* NPN_PostUrl */
634 #if _NPUPP_USE_UPP_
636 typedef UniversalProcPtr NPN_PostURLUPP;
637 enum {
638 uppNPN_PostURLProcInfo = kThinkCStackBased
639 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
640 | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(const char*)))
641 | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(const char*)))
642 | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(uint32)))
643 | STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(const char*)))
644 | STACK_ROUTINE_PARAMETER(6, SIZE_CODE(sizeof(NPBool)))
645 | RESULT_SIZE(SIZE_CODE(sizeof(NPError)))
647 #define NewNPN_PostURLProc(FUNC) \
648 (NPN_PostURLUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_PostURLProcInfo, GetCurrentArchitecture())
649 #define CallNPN_PostURLProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6) \
650 (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_PostURLProcInfo, (ARG1), (ARG2), (ARG3), (ARG4), (ARG5), (ARG6))
651 #else
653 typedef NPError (* NP_LOADDS NPN_PostURLUPP)(NPP instance, const char* url, const char* window, uint32 len, const char* buf, NPBool file);
654 #define NewNPN_PostURLProc(FUNC) \
655 ((NPN_PostURLUPP) (FUNC))
656 #define CallNPN_PostURLProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6) \
657 (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4), (ARG5), (ARG6))
658 #endif
661 /* NPN_RequestRead */
663 #if _NPUPP_USE_UPP_
665 typedef UniversalProcPtr NPN_RequestReadUPP;
666 enum {
667 uppNPN_RequestReadProcInfo = kThinkCStackBased
668 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPStream *)))
669 | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPByteRange *)))
670 | RESULT_SIZE(SIZE_CODE(sizeof(NPError)))
672 #define NewNPN_RequestReadProc(FUNC) \
673 (NPN_RequestReadUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_RequestReadProcInfo, GetCurrentArchitecture())
674 #define CallNPN_RequestReadProc(FUNC, stream, range) \
675 (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_RequestReadProcInfo, (stream), (range))
677 #else
679 typedef NPError (* NP_LOADDS NPN_RequestReadUPP)(NPStream* stream, NPByteRange* rangeList);
680 #define NewNPN_RequestReadProc(FUNC) \
681 ((NPN_RequestReadUPP) (FUNC))
682 #define CallNPN_RequestReadProc(FUNC, stream, range) \
683 (*(FUNC))((stream), (range))
685 #endif
688 /* NPN_NewStream */
690 #if _NPUPP_USE_UPP_
692 typedef UniversalProcPtr NPN_NewStreamUPP;
693 enum {
694 uppNPN_NewStreamProcInfo = kThinkCStackBased
695 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
696 | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPMIMEType)))
697 | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(const char *)))
698 | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(NPStream **)))
699 | RESULT_SIZE(SIZE_CODE(sizeof(NPError)))
701 #define NewNPN_NewStreamProc(FUNC) \
702 (NPN_NewStreamUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_NewStreamProcInfo, GetCurrentArchitecture())
703 #define CallNPN_NewStreamProc(FUNC, npp, type, window, stream) \
704 (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_NewStreamProcInfo, (npp), (type), (window), (stream))
706 #else
708 typedef NPError (* NP_LOADDS NPN_NewStreamUPP)(NPP instance, NPMIMEType type, const char* window, NPStream** stream);
709 #define NewNPN_NewStreamProc(FUNC) \
710 ((NPN_NewStreamUPP) (FUNC))
711 #define CallNPN_NewStreamProc(FUNC, npp, type, window, stream) \
712 (*(FUNC))((npp), (type), (window), (stream))
714 #endif
717 /* NPN_Write */
719 #if _NPUPP_USE_UPP_
721 typedef UniversalProcPtr NPN_WriteUPP;
722 enum {
723 uppNPN_WriteProcInfo = kThinkCStackBased
724 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
725 | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPStream *)))
726 | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(int32)))
727 | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(void*)))
728 | RESULT_SIZE(SIZE_CODE(sizeof(int32)))
730 #define NewNPN_WriteProc(FUNC) \
731 (NPN_WriteUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_WriteProcInfo, GetCurrentArchitecture())
732 #define CallNPN_WriteProc(FUNC, npp, stream, len, buffer) \
733 (int32)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_WriteProcInfo, (npp), (stream), (len), (buffer))
735 #else
737 typedef int32 (* NP_LOADDS NPN_WriteUPP)(NPP instance, NPStream* stream, int32 len, void* buffer);
738 #define NewNPN_WriteProc(FUNC) \
739 ((NPN_WriteUPP) (FUNC))
740 #define CallNPN_WriteProc(FUNC, npp, stream, len, buffer) \
741 (*(FUNC))((npp), (stream), (len), (buffer))
743 #endif
746 /* NPN_DestroyStream */
748 #if _NPUPP_USE_UPP_
750 typedef UniversalProcPtr NPN_DestroyStreamUPP;
751 enum {
752 uppNPN_DestroyStreamProcInfo = kThinkCStackBased
753 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP )))
754 | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPStream *)))
755 | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(NPReason)))
756 | RESULT_SIZE(SIZE_CODE(sizeof(NPError)))
758 #define NewNPN_DestroyStreamProc(FUNC) \
759 (NPN_DestroyStreamUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_DestroyStreamProcInfo, GetCurrentArchitecture())
760 #define CallNPN_DestroyStreamProc(FUNC, npp, stream, reason) \
761 (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_DestroyStreamProcInfo, (npp), (stream), (reason))
763 #else
765 typedef NPError (* NP_LOADDS NPN_DestroyStreamUPP)(NPP instance, NPStream* stream, NPReason reason);
766 #define NewNPN_DestroyStreamProc(FUNC) \
767 ((NPN_DestroyStreamUPP) (FUNC))
768 #define CallNPN_DestroyStreamProc(FUNC, npp, stream, reason) \
769 (*(FUNC))((npp), (stream), (reason))
771 #endif
774 /* NPN_Status */
776 #if _NPUPP_USE_UPP_
778 typedef UniversalProcPtr NPN_StatusUPP;
779 enum {
780 uppNPN_StatusProcInfo = kThinkCStackBased
781 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
782 | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(char *)))
785 #define NewNPN_StatusProc(FUNC) \
786 (NPN_StatusUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_StatusProcInfo, GetCurrentArchitecture())
787 #define CallNPN_StatusProc(FUNC, npp, msg) \
788 (void)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_StatusProcInfo, (npp), (msg))
790 #else
792 typedef void (* NP_LOADDS NPN_StatusUPP)(NPP instance, const char* message);
793 #define NewNPN_StatusProc(FUNC) \
794 ((NPN_StatusUPP) (FUNC))
795 #define CallNPN_StatusProc(FUNC, npp, msg) \
796 (*(FUNC))((npp), (msg))
798 #endif
801 /* NPN_UserAgent */
802 #if _NPUPP_USE_UPP_
804 typedef UniversalProcPtr NPN_UserAgentUPP;
805 enum {
806 uppNPN_UserAgentProcInfo = kThinkCStackBased
807 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
808 | RESULT_SIZE(SIZE_CODE(sizeof(const char *)))
811 #define NewNPN_UserAgentProc(FUNC) \
812 (NPN_UserAgentUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_UserAgentProcInfo, GetCurrentArchitecture())
813 #define CallNPN_UserAgentProc(FUNC, ARG1) \
814 (const char*)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_UserAgentProcInfo, (ARG1))
816 #else
818 typedef const char* (* NP_LOADDS NPN_UserAgentUPP)(NPP instance);
819 #define NewNPN_UserAgentProc(FUNC) \
820 ((NPN_UserAgentUPP) (FUNC))
821 #define CallNPN_UserAgentProc(FUNC, ARG1) \
822 (*(FUNC))((ARG1))
824 #endif
827 /* NPN_MemAlloc */
828 #if _NPUPP_USE_UPP_
830 typedef UniversalProcPtr NPN_MemAllocUPP;
831 enum {
832 uppNPN_MemAllocProcInfo = kThinkCStackBased
833 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(uint32)))
834 | RESULT_SIZE(SIZE_CODE(sizeof(void *)))
837 #define NewNPN_MemAllocProc(FUNC) \
838 (NPN_MemAllocUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_MemAllocProcInfo, GetCurrentArchitecture())
839 #define CallNPN_MemAllocProc(FUNC, ARG1) \
840 (void*)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_MemAllocProcInfo, (ARG1))
842 #else
844 typedef void* (* NP_LOADDS NPN_MemAllocUPP)(uint32 size);
845 #define NewNPN_MemAllocProc(FUNC) \
846 ((NPN_MemAllocUPP) (FUNC))
847 #define CallNPN_MemAllocProc(FUNC, ARG1) \
848 (*(FUNC))((ARG1))
850 #endif
853 /* NPN__MemFree */
855 #if _NPUPP_USE_UPP_
857 typedef UniversalProcPtr NPN_MemFreeUPP;
858 enum {
859 uppNPN_MemFreeProcInfo = kThinkCStackBased
860 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(void *)))
863 #define NewNPN_MemFreeProc(FUNC) \
864 (NPN_MemFreeUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_MemFreeProcInfo, GetCurrentArchitecture())
865 #define CallNPN_MemFreeProc(FUNC, ARG1) \
866 (void)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_MemFreeProcInfo, (ARG1))
868 #else
870 typedef void (* NP_LOADDS NPN_MemFreeUPP)(void* ptr);
871 #define NewNPN_MemFreeProc(FUNC) \
872 ((NPN_MemFreeUPP) (FUNC))
873 #define CallNPN_MemFreeProc(FUNC, ARG1) \
874 (*(FUNC))((ARG1))
876 #endif
879 /* NPN_MemFlush */
881 #if _NPUPP_USE_UPP_
883 typedef UniversalProcPtr NPN_MemFlushUPP;
884 enum {
885 uppNPN_MemFlushProcInfo = kThinkCStackBased
886 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(uint32)))
887 | RESULT_SIZE(SIZE_CODE(sizeof(uint32)))
890 #define NewNPN_MemFlushProc(FUNC) \
891 (NPN_MemFlushUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_MemFlushProcInfo, GetCurrentArchitecture())
892 #define CallNPN_MemFlushProc(FUNC, ARG1) \
893 (uint32)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_MemFlushProcInfo, (ARG1))
895 #else
897 typedef uint32 (* NP_LOADDS NPN_MemFlushUPP)(uint32 size);
898 #define NewNPN_MemFlushProc(FUNC) \
899 ((NPN_MemFlushUPP) (FUNC))
900 #define CallNPN_MemFlushProc(FUNC, ARG1) \
901 (*(FUNC))((ARG1))
903 #endif
907 /* NPN_ReloadPlugins */
909 #if _NPUPP_USE_UPP_
911 typedef UniversalProcPtr NPN_ReloadPluginsUPP;
912 enum {
913 uppNPN_ReloadPluginsProcInfo = kThinkCStackBased
914 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPBool)))
915 | RESULT_SIZE(SIZE_CODE(0))
918 #define NewNPN_ReloadPluginsProc(FUNC) \
919 (NPN_ReloadPluginsUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_ReloadPluginsProcInfo, GetCurrentArchitecture())
920 #define CallNPN_ReloadPluginsProc(FUNC, ARG1) \
921 (void)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_ReloadPluginsProcInfo, (ARG1))
923 #else
925 typedef void (* NP_LOADDS NPN_ReloadPluginsUPP)(NPBool reloadPages);
926 #define NewNPN_ReloadPluginsProc(FUNC) \
927 ((NPN_ReloadPluginsUPP) (FUNC))
928 #define CallNPN_ReloadPluginsProc(FUNC, ARG1) \
929 (*(FUNC))((ARG1))
931 #endif
934 /* NPN_GetJavaEnv */
936 #if _NPUPP_USE_UPP_
938 typedef UniversalProcPtr NPN_GetJavaEnvUPP;
939 enum {
940 uppNPN_GetJavaEnvProcInfo = kThinkCStackBased
941 | RESULT_SIZE(SIZE_CODE(sizeof(JRIEnv*)))
944 #define NewNPN_GetJavaEnvProc(FUNC) \
945 (NPN_GetJavaEnvUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_GetJavaEnvProcInfo, GetCurrentArchitecture())
946 #define CallNPN_GetJavaEnvProc(FUNC) \
947 (JRIEnv*)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_GetJavaEnvProcInfo)
949 #else
950 typedef JRIEnv* (* NP_LOADDS NPN_GetJavaEnvUPP)(void);
951 #define NewNPN_GetJavaEnvProc(FUNC) \
952 ((NPN_GetJavaEnvUPP) (FUNC))
953 #define CallNPN_GetJavaEnvProc(FUNC) \
954 (*(FUNC))()
956 #endif
959 /* NPN_GetJavaPeer */
961 #if _NPUPP_USE_UPP_
963 typedef UniversalProcPtr NPN_GetJavaPeerUPP;
964 enum {
965 uppNPN_GetJavaPeerProcInfo = kThinkCStackBased
966 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
967 | RESULT_SIZE(SIZE_CODE(sizeof(jref)))
970 #define NewNPN_GetJavaPeerProc(FUNC) \
971 (NPN_GetJavaPeerUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_GetJavaPeerProcInfo, GetCurrentArchitecture())
972 #define CallNPN_GetJavaPeerProc(FUNC, ARG1) \
973 (jref)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_GetJavaPeerProcInfo, (ARG1))
975 #else
977 typedef jref (* NP_LOADDS NPN_GetJavaPeerUPP)(NPP instance);
978 #define NewNPN_GetJavaPeerProc(FUNC) \
979 ((NPN_GetJavaPeerUPP) (FUNC))
980 #define CallNPN_GetJavaPeerProc(FUNC, ARG1) \
981 (*(FUNC))((ARG1))
983 #endif
986 /* NPN_InvalidateRect */
988 #if _NPUPP_USE_UPP_
990 typedef UniversalProcPtr NPN_InvalidateRectUPP;
991 enum {
992 uppNPN_InvalidateRectProcInfo = kThinkCStackBased
993 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
994 | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPRect *)))
995 | RESULT_SIZE(SIZE_CODE(0))
998 #define NewNPN_InvalidateRectProc(FUNC) \
999 (NPN_InvalidateRectUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_InvalidateRectProcInfo, GetCurrentArchitecture())
1000 #define CallNPN_InvalidateRectProc(FUNC, ARG1, ARG2) \
1001 (void)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_InvalidateRectProcInfo, (ARG1), (ARG2))
1003 #else
1005 typedef void (* NP_LOADDS NPN_InvalidateRectUPP)(NPP instance, NPRect *rect);
1006 #define NewNPN_InvalidateRectProc(FUNC) \
1007 ((NPN_InvalidateRectUPP) (FUNC))
1008 #define CallNPN_InvalidateRectProc(FUNC, ARG1, ARG2) \
1009 (*(FUNC))((ARG1), (ARG2))
1011 #endif
1014 /* NPN_InvalidateRegion */
1016 #if _NPUPP_USE_UPP_
1018 typedef UniversalProcPtr NPN_InvalidateRegionUPP;
1019 enum {
1020 uppNPN_InvalidateRegionProcInfo = kThinkCStackBased
1021 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
1022 | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPRegion)))
1023 | RESULT_SIZE(SIZE_CODE(0))
1026 #define NewNPN_InvalidateRegionProc(FUNC) \
1027 (NPN_InvalidateRegionUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_InvalidateRegionProcInfo, GetCurrentArchitecture())
1028 #define CallNPN_InvalidateRegionProc(FUNC, ARG1, ARG2) \
1029 (void)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_InvalidateRegionProcInfo, (ARG1), (ARG2))
1031 #else
1033 typedef void (* NP_LOADDS NPN_InvalidateRegionUPP)(NPP instance, NPRegion region);
1034 #define NewNPN_InvalidateRegionProc(FUNC) \
1035 ((NPN_InvalidateRegionUPP) (FUNC))
1036 #define CallNPN_InvalidateRegionProc(FUNC, ARG1, ARG2) \
1037 (*(FUNC))((ARG1), (ARG2))
1039 #endif
1041 /* NPN_ForceRedraw */
1043 #if _NPUPP_USE_UPP_
1045 typedef UniversalProcPtr NPN_ForceRedrawUPP;
1046 enum {
1047 uppNPN_ForceRedrawProcInfo = kThinkCStackBased
1048 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
1049 | RESULT_SIZE(SIZE_CODE(sizeof(0)))
1052 #define NewNPN_ForceRedrawProc(FUNC) \
1053 (NPN_ForceRedrawUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_ForceRedrawProcInfo, GetCurrentArchitecture())
1054 #define CallNPN_ForceRedrawProc(FUNC, ARG1) \
1055 (jref)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_ForceRedrawProcInfo, (ARG1))
1057 #else
1059 typedef void (* NP_LOADDS NPN_ForceRedrawUPP)(NPP instance);
1060 #define NewNPN_ForceRedrawProc(FUNC) \
1061 ((NPN_ForceRedrawUPP) (FUNC))
1062 #define CallNPN_ForceRedrawProc(FUNC, ARG1) \
1063 (*(FUNC))((ARG1))
1065 #endif
1068 /******************************************************************************************
1069 * The actual plugin function table definitions
1070 *******************************************************************************************/
1072 #ifdef XP_MAC
1073 #if PRAGMA_STRUCT_ALIGN
1074 #pragma options align=mac68k
1075 #endif
1076 #endif
1078 typedef struct _NPPluginFuncs {
1079 uint16 size;
1080 uint16 version;
1081 NPP_NewUPP newp;
1082 NPP_DestroyUPP destroy;
1083 NPP_SetWindowUPP setwindow;
1084 NPP_NewStreamUPP newstream;
1085 NPP_DestroyStreamUPP destroystream;
1086 NPP_StreamAsFileUPP asfile;
1087 NPP_WriteReadyUPP writeready;
1088 NPP_WriteUPP write;
1089 NPP_PrintUPP print;
1090 NPP_HandleEventUPP event;
1091 NPP_URLNotifyUPP urlnotify;
1092 JRIGlobalRef javaClass;
1093 NPP_GetValueUPP getvalue;
1094 NPP_SetValueUPP setvalue;
1095 } NPPluginFuncs;
1097 typedef struct _NPNetscapeFuncs {
1098 uint16 size;
1099 uint16 version;
1100 NPN_GetURLUPP geturl;
1101 NPN_PostURLUPP posturl;
1102 NPN_RequestReadUPP requestread;
1103 NPN_NewStreamUPP newstream;
1104 NPN_WriteUPP write;
1105 NPN_DestroyStreamUPP destroystream;
1106 NPN_StatusUPP status;
1107 NPN_UserAgentUPP uagent;
1108 NPN_MemAllocUPP memalloc;
1109 NPN_MemFreeUPP memfree;
1110 NPN_MemFlushUPP memflush;
1111 NPN_ReloadPluginsUPP reloadplugins;
1112 NPN_GetJavaEnvUPP getJavaEnv;
1113 NPN_GetJavaPeerUPP getJavaPeer;
1114 NPN_GetURLNotifyUPP geturlnotify;
1115 NPN_PostURLNotifyUPP posturlnotify;
1116 NPN_GetValueUPP getvalue;
1117 NPN_SetValueUPP setvalue;
1118 NPN_InvalidateRectUPP invalidaterect;
1119 NPN_InvalidateRegionUPP invalidateregion;
1120 NPN_ForceRedrawUPP forceredraw;
1121 } NPNetscapeFuncs;
1123 #ifdef XP_MAC
1124 #if PRAGMA_STRUCT_ALIGN
1125 #pragma options align=reset
1126 #endif
1127 #endif
1130 #ifdef XP_MAC
1131 /******************************************************************************************
1132 * Mac platform-specific plugin glue stuff
1133 *******************************************************************************************/
1136 * Main entry point of the plugin.
1137 * This routine will be called when the plugin is loaded. The function
1138 * tables are passed in and the plugin fills in the NPPluginFuncs table
1139 * and NPPShutdownUPP for Netscape's use.
1142 #if _NPUPP_USE_UPP_
1144 typedef UniversalProcPtr NPP_MainEntryUPP;
1145 enum {
1146 uppNPP_MainEntryProcInfo = kThinkCStackBased
1147 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPNetscapeFuncs*)))
1148 | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPPluginFuncs*)))
1149 | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(NPP_ShutdownUPP*)))
1150 | RESULT_SIZE(SIZE_CODE(sizeof(NPError)))
1152 #define NewNPP_MainEntryProc(FUNC) \
1153 (NPP_MainEntryUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_MainEntryProcInfo, GetCurrentArchitecture())
1154 #define CallNPP_MainEntryProc(FUNC, netscapeFunc, pluginFunc, shutdownUPP) \
1155 CallUniversalProc((UniversalProcPtr)(FUNC), (ProcInfoType)uppNPP_MainEntryProcInfo, (netscapeFunc), (pluginFunc), (shutdownUPP))
1157 #else
1159 typedef NPError (* NP_LOADDS NPP_MainEntryUPP)(NPNetscapeFuncs*, NPPluginFuncs*, NPP_ShutdownUPP*);
1160 #define NewNPP_MainEntryProc(FUNC) \
1161 ((NPP_MainEntryUPP) (FUNC))
1162 #define CallNPP_MainEntryProc(FUNC, netscapeFunc, pluginFunc, shutdownUPP) \
1163 (*(FUNC))((netscapeFunc), (pluginFunc), (shutdownUPP))
1165 #endif
1169 * Mac version(s) of NP_GetMIMEDescription(const char *)
1170 * These can be called to retreive MIME information from the plugin dynamically
1172 * Note: For compatibility with Quicktime, BPSupportedMIMEtypes is another way
1173 * to get mime info from the plugin only on OSX and may not be supported
1174 * in furture version--use NP_GetMIMEDescription instead
1177 enum
1179 kBPSupportedMIMETypesStructVers_1 = 1
1182 typedef struct _BPSupportedMIMETypes
1184 SInt32 structVersion; // struct version
1185 Handle typeStrings; // STR# formated handle, allocated by plug-in
1186 Handle infoStrings; // STR# formated handle, allocated by plug-in
1187 } BPSupportedMIMETypes;
1188 OSErr BP_GetSupportedMIMETypes(BPSupportedMIMETypes *mimeInfo, UInt32 flags);
1190 #if _NPUPP_USE_UPP_
1192 #define NP_GETMIMEDESCRIPTION_NAME "NP_GetMIMEDescriptionRD"
1193 typedef UniversalProcPtr NP_GetMIMEDescriptionUPP;
1194 enum {
1195 uppNP_GetMIMEDescEntryProc = kThinkCStackBased
1196 | RESULT_SIZE(SIZE_CODE(sizeof(const char *)))
1198 #define NewNP_GetMIMEDescEntryProc(FUNC) \
1199 (NP_GetMIMEDescriptionUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNP_GetMIMEDescEntryProc, GetCurrentArchitecture())
1200 #define CallNP_GetMIMEDescEntryProc(FUNC) \
1201 (const char *)CallUniversalProc((UniversalProcPtr)(FUNC), (ProcInfoType)uppNP_GetMIMEDescEntryProc)
1204 #else // !_NPUPP_USE_UPP_
1206 // NP_GetMIMEDescription
1207 #define NP_GETMIMEDESCRIPTION_NAME "NP_GetMIMEDescription"
1208 typedef const char* (* NP_LOADDS NP_GetMIMEDescriptionUPP)();
1209 #define NewNP_GetMIMEDescEntryProc(FUNC) \
1210 ((NP_GetMIMEDescriptionUPP) (FUNC))
1211 #define CallNP_GetMIMEDescEntryProc(FUNC) \
1212 (*(FUNC))()
1213 // BP_GetSupportedMIMETypes
1214 typedef OSErr (* NP_LOADDS BP_GetSupportedMIMETypesUPP)(BPSupportedMIMETypes*, UInt32);
1215 #define NewBP_GetSupportedMIMETypesEntryProc(FUNC) \
1216 ((BP_GetSupportedMIMETypesUPP) (FUNC))
1217 #define CallBP_GetMIMEDescEntryProc(FUNC, mimeInfo, flags) \
1218 (*(FUNC))((mimeInfo), (flags))
1220 #endif
1221 #endif /* MAC */
1223 #if defined(_WINDOWS)
1224 #define OSCALL WINAPI
1225 #else
1226 #if defined(__OS2__)
1227 #define OSCALL _System
1228 #else
1229 #define OSCALL
1230 #endif
1231 #endif
1233 #if defined( _WINDOWS ) || defined (__OS2__)
1235 #ifdef __cplusplus
1236 extern "C" {
1237 #endif
1239 /* plugin meta member functions */
1240 #if defined(__OS2__)
1242 typedef struct _NPPluginData { /* Alternate OS2 Plugin interface */
1243 char *pMimeTypes;
1244 char *pFileExtents;
1245 char *pFileOpenTemplate;
1246 char *pProductName;
1247 char *pProductDescription;
1248 unsigned long dwProductVersionMS;
1249 unsigned long dwProductVersionLS;
1250 } NPPluginData;
1252 NPError OSCALL NP_GetPluginData(NPPluginData * pPluginData);
1254 #endif
1256 NPError OSCALL NP_GetEntryPoints(NPPluginFuncs* pFuncs);
1258 NPError OSCALL NP_Initialize(NPNetscapeFuncs* pFuncs);
1260 NPError OSCALL NP_Shutdown();
1262 char* NP_GetMIMEDescription();
1264 #ifdef __cplusplus
1266 #endif
1268 #endif /* _WINDOWS || __OS2__ */
1270 #if defined(__OS2__)
1271 #pragma pack()
1272 #endif
1274 #ifdef XP_UNIX
1276 #ifdef __cplusplus
1277 extern "C" {
1278 #endif
1280 /* plugin meta member functions */
1282 char* NP_GetMIMEDescription(void);
1283 NPError NP_Initialize(NPNetscapeFuncs*, NPPluginFuncs*);
1284 NPError NP_Shutdown(void);
1286 #ifdef __cplusplus
1288 #endif
1290 #endif /* XP_UNIX */
1292 #endif /* _NPUPP_H_ */