bump product version to 4.1.6.2
[LibreOffice.git] / np_sdk / npsdk / npupp.h
blobe0812ecd9408ba939cc2526f930cd0ee1727c86b
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 ***** */
40 * function call mechanics needed by platform specific glue code.
44 #ifndef _NPUPP_H_
45 #define _NPUPP_H_
47 #ifndef GENERATINGCFM
48 #define GENERATINGCFM 0
49 #endif
51 #ifndef _NPAPI_H_
52 #include "npapi.h"
53 #endif
55 #include "jri.h"
57 /******************************************************************************************
58 plug-in function table macros
59 for each function in and out of the plugin API we define
60 typedef NPP_FooUPP
61 #define NewNPP_FooProc
62 #define CallNPP_FooProc
63 for mac, define the UPP magic for PPC/68K calling
64 *******************************************************************************************/
67 /* NPP_Initialize */
69 #ifndef TARGET_RT_MAC_CFM
70 #define TARGET_RT_MAC_CFM 0
71 #endif
73 #define _NPUPP_USE_UPP_ (TARGET_RT_MAC_CFM && !TARGET_API_MAC_CARBON)
75 #if _NPUPP_USE_UPP_
76 typedef UniversalProcPtr NPP_InitializeUPP;
78 enum {
79 uppNPP_InitializeProcInfo = kThinkCStackBased
80 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(0))
81 | RESULT_SIZE(SIZE_CODE(0))
84 #define NewNPP_InitializeProc(FUNC) \
85 (NPP_InitializeUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_InitializeProcInfo, GetCurrentArchitecture())
86 #define CallNPP_InitializeProc(FUNC) \
87 (void)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_InitializeProcInfo)
89 #else
91 typedef void (* NP_LOADDS NPP_InitializeUPP)(void);
92 #define NewNPP_InitializeProc(FUNC) \
93 ((NPP_InitializeUPP) (FUNC))
94 #define CallNPP_InitializeProc(FUNC) \
95 (*(FUNC))()
97 #endif
100 /* NPP_Shutdown */
102 #if _NPUPP_USE_UPP_
103 typedef UniversalProcPtr NPP_ShutdownUPP;
105 enum {
106 uppNPP_ShutdownProcInfo = kThinkCStackBased
107 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(0))
108 | RESULT_SIZE(SIZE_CODE(0))
111 #define NewNPP_ShutdownProc(FUNC) \
112 (NPP_ShutdownUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_ShutdownProcInfo, GetCurrentArchitecture())
113 #define CallNPP_ShutdownProc(FUNC) \
114 (void)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_ShutdownProcInfo)
116 #else
118 typedef void (* NP_LOADDS NPP_ShutdownUPP)(void);
119 #define NewNPP_ShutdownProc(FUNC) \
120 ((NPP_ShutdownUPP) (FUNC))
121 #define CallNPP_ShutdownProc(FUNC) \
122 (*(FUNC))()
124 #endif
127 /* NPP_New */
129 #if _NPUPP_USE_UPP_
130 typedef UniversalProcPtr NPP_NewUPP;
132 enum {
133 uppNPP_NewProcInfo = kThinkCStackBased
134 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPMIMEType)))
135 | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPP)))
136 | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(uint16_t)))
137 | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(int16_t)))
138 | STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(char **)))
139 | STACK_ROUTINE_PARAMETER(6, SIZE_CODE(sizeof(char **)))
140 | STACK_ROUTINE_PARAMETER(7, SIZE_CODE(sizeof(NPSavedData *)))
141 | RESULT_SIZE(SIZE_CODE(sizeof(NPError)))
144 #define NewNPP_NewProc(FUNC) \
145 (NPP_NewUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_NewProcInfo, GetCurrentArchitecture())
146 #define CallNPP_NewProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6, ARG7) \
147 (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_NewProcInfo, \
148 (ARG1), (ARG2), (ARG3), (ARG4), (ARG5), (ARG6), (ARG7))
149 #else
151 typedef NPError (* NP_LOADDS NPP_NewUPP)(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc, char* argn[], char* argv[], NPSavedData* saved);
152 #define NewNPP_NewProc(FUNC) \
153 ((NPP_NewUPP) (FUNC))
154 #define CallNPP_NewProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6, ARG7) \
155 (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4), (ARG5), (ARG6), (ARG7))
157 #endif
160 /* NPP_Destroy */
162 #if _NPUPP_USE_UPP_
164 typedef UniversalProcPtr NPP_DestroyUPP;
165 enum {
166 uppNPP_DestroyProcInfo = kThinkCStackBased
167 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
168 | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPSavedData **)))
169 | RESULT_SIZE(SIZE_CODE(sizeof(NPError)))
171 #define NewNPP_DestroyProc(FUNC) \
172 (NPP_DestroyUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_DestroyProcInfo, GetCurrentArchitecture())
173 #define CallNPP_DestroyProc(FUNC, ARG1, ARG2) \
174 (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_DestroyProcInfo, (ARG1), (ARG2))
175 #else
177 typedef NPError (* NP_LOADDS NPP_DestroyUPP)(NPP instance, NPSavedData** save);
178 #define NewNPP_DestroyProc(FUNC) \
179 ((NPP_DestroyUPP) (FUNC))
180 #define CallNPP_DestroyProc(FUNC, ARG1, ARG2) \
181 (*(FUNC))((ARG1), (ARG2))
183 #endif
186 /* NPP_SetWindow */
188 #if _NPUPP_USE_UPP_
190 typedef UniversalProcPtr NPP_SetWindowUPP;
191 enum {
192 uppNPP_SetWindowProcInfo = kThinkCStackBased
193 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
194 | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPWindow *)))
195 | RESULT_SIZE(SIZE_CODE(sizeof(NPError)))
197 #define NewNPP_SetWindowProc(FUNC) \
198 (NPP_SetWindowUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_SetWindowProcInfo, GetCurrentArchitecture())
199 #define CallNPP_SetWindowProc(FUNC, ARG1, ARG2) \
200 (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_SetWindowProcInfo, (ARG1), (ARG2))
202 #else
204 typedef NPError (* NP_LOADDS NPP_SetWindowUPP)(NPP instance, NPWindow* window);
205 #define NewNPP_SetWindowProc(FUNC) \
206 ((NPP_SetWindowUPP) (FUNC))
207 #define CallNPP_SetWindowProc(FUNC, ARG1, ARG2) \
208 (*(FUNC))((ARG1), (ARG2))
210 #endif
213 /* NPP_NewStream */
215 #if _NPUPP_USE_UPP_
217 typedef UniversalProcPtr NPP_NewStreamUPP;
218 enum {
219 uppNPP_NewStreamProcInfo = kThinkCStackBased
220 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
221 | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPMIMEType)))
222 | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(NPStream *)))
223 | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(NPBool)))
224 | STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(uint16_t *)))
225 | RESULT_SIZE(SIZE_CODE(sizeof(NPError)))
227 #define NewNPP_NewStreamProc(FUNC) \
228 (NPP_NewStreamUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_NewStreamProcInfo, GetCurrentArchitecture())
229 #define CallNPP_NewStreamProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5) \
230 (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_NewStreamProcInfo, (ARG1), (ARG2), (ARG3), (ARG4), (ARG5))
231 #else
233 typedef NPError (* NP_LOADDS NPP_NewStreamUPP)(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16_t* stype);
234 #define NewNPP_NewStreamProc(FUNC) \
235 ((NPP_NewStreamUPP) (FUNC))
236 #define CallNPP_NewStreamProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5) \
237 (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4), (ARG5))
238 #endif
241 /* NPP_DestroyStream */
243 #if _NPUPP_USE_UPP_
245 typedef UniversalProcPtr NPP_DestroyStreamUPP;
246 enum {
247 uppNPP_DestroyStreamProcInfo = kThinkCStackBased
248 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
249 | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPStream *)))
250 | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(NPReason)))
251 | RESULT_SIZE(SIZE_CODE(sizeof(NPError)))
253 #define NewNPP_DestroyStreamProc(FUNC) \
254 (NPP_DestroyStreamUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_DestroyStreamProcInfo, GetCurrentArchitecture())
255 #define CallNPP_DestroyStreamProc(FUNC, NPParg, NPStreamPtr, NPReasonArg) \
256 (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_DestroyStreamProcInfo, (NPParg), (NPStreamPtr), (NPReasonArg))
258 #else
260 typedef NPError (* NP_LOADDS NPP_DestroyStreamUPP)(NPP instance, NPStream* stream, NPReason reason);
261 #define NewNPP_DestroyStreamProc(FUNC) \
262 ((NPP_DestroyStreamUPP) (FUNC))
263 #define CallNPP_DestroyStreamProc(FUNC, NPParg, NPStreamPtr, NPReasonArg) \
264 (*(FUNC))((NPParg), (NPStreamPtr), (NPReasonArg))
266 #endif
269 /* NPP_WriteReady */
271 #if _NPUPP_USE_UPP_
273 typedef UniversalProcPtr NPP_WriteReadyUPP;
274 enum {
275 uppNPP_WriteReadyProcInfo = kThinkCStackBased
276 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
277 | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPStream *)))
278 | RESULT_SIZE(SIZE_CODE(sizeof(int32_t)))
280 #define NewNPP_WriteReadyProc(FUNC) \
281 (NPP_WriteReadyUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_WriteReadyProcInfo, GetCurrentArchitecture())
282 #define CallNPP_WriteReadyProc(FUNC, NPParg, NPStreamPtr) \
283 (int32_t)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_WriteReadyProcInfo, (NPParg), (NPStreamPtr))
285 #else
287 typedef int32_t (* NP_LOADDS NPP_WriteReadyUPP)(NPP instance, NPStream* stream);
288 #define NewNPP_WriteReadyProc(FUNC) \
289 ((NPP_WriteReadyUPP) (FUNC))
290 #define CallNPP_WriteReadyProc(FUNC, NPParg, NPStreamPtr) \
291 (*(FUNC))((NPParg), (NPStreamPtr))
293 #endif
296 /* NPP_Write */
298 #if _NPUPP_USE_UPP_
300 typedef UniversalProcPtr NPP_WriteUPP;
301 enum {
302 uppNPP_WriteProcInfo = kThinkCStackBased
303 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
304 | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPStream *)))
305 | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(int32_t)))
306 | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(int32_t)))
307 | STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(void*)))
308 | RESULT_SIZE(SIZE_CODE(sizeof(int32_t)))
310 #define NewNPP_WriteProc(FUNC) \
311 (NPP_WriteUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_WriteProcInfo, GetCurrentArchitecture())
312 #define CallNPP_WriteProc(FUNC, NPParg, NPStreamPtr, offsetArg, lenArg, bufferPtr) \
313 (int32_t)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_WriteProcInfo, (NPParg), (NPStreamPtr), (offsetArg), (lenArg), (bufferPtr))
315 #else
317 typedef int32_t (* NP_LOADDS NPP_WriteUPP)(NPP instance, NPStream* stream, int32_t offset, int32_t len, void* buffer);
318 #define NewNPP_WriteProc(FUNC) \
319 ((NPP_WriteUPP) (FUNC))
320 #define CallNPP_WriteProc(FUNC, NPParg, NPStreamPtr, offsetArg, lenArg, bufferPtr) \
321 (*(FUNC))((NPParg), (NPStreamPtr), (offsetArg), (lenArg), (bufferPtr))
323 #endif
326 /* NPP_StreamAsFile */
328 #if _NPUPP_USE_UPP_
330 typedef UniversalProcPtr NPP_StreamAsFileUPP;
331 enum {
332 uppNPP_StreamAsFileProcInfo = kThinkCStackBased
333 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
334 | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPStream *)))
335 | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(const char *)))
336 | RESULT_SIZE(SIZE_CODE(0))
338 #define NewNPP_StreamAsFileProc(FUNC) \
339 (NPP_StreamAsFileUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_StreamAsFileProcInfo, GetCurrentArchitecture())
340 #define CallNPP_StreamAsFileProc(FUNC, ARG1, ARG2, ARG3) \
341 (void)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_StreamAsFileProcInfo, (ARG1), (ARG2), (ARG3))
343 #else
345 typedef void (* NP_LOADDS NPP_StreamAsFileUPP)(NPP instance, NPStream* stream, const char* fname);
346 #define NewNPP_StreamAsFileProc(FUNC) \
347 ((NPP_StreamAsFileUPP) (FUNC))
348 #define CallNPP_StreamAsFileProc(FUNC, ARG1, ARG2, ARG3) \
349 (*(FUNC))((ARG1), (ARG2), (ARG3))
350 #endif
353 /* NPP_Print */
355 #if _NPUPP_USE_UPP_
357 typedef UniversalProcPtr NPP_PrintUPP;
358 enum {
359 uppNPP_PrintProcInfo = kThinkCStackBased
360 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
361 | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPPrint *)))
362 | RESULT_SIZE(SIZE_CODE(0))
364 #define NewNPP_PrintProc(FUNC) \
365 (NPP_PrintUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_PrintProcInfo, GetCurrentArchitecture())
366 #define CallNPP_PrintProc(FUNC, NPParg, voidPtr) \
367 (void)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_PrintProcInfo, (NPParg), (voidPtr))
369 #else
371 typedef void (* NP_LOADDS NPP_PrintUPP)(NPP instance, NPPrint* platformPrint);
372 #define NewNPP_PrintProc(FUNC) \
373 ((NPP_PrintUPP) (FUNC))
374 #define CallNPP_PrintProc(FUNC, NPParg, NPPrintArg) \
375 (*(FUNC))((NPParg), (NPPrintArg))
377 #endif
380 /* NPP_HandleEvent */
382 #if _NPUPP_USE_UPP_
384 typedef UniversalProcPtr NPP_HandleEventUPP;
385 enum {
386 uppNPP_HandleEventProcInfo = kThinkCStackBased
387 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
388 | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(void *)))
389 | RESULT_SIZE(SIZE_CODE(sizeof(int16_t)))
391 #define NewNPP_HandleEventProc(FUNC) \
392 (NPP_HandleEventUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_HandleEventProcInfo, GetCurrentArchitecture())
393 #define CallNPP_HandleEventProc(FUNC, NPParg, voidPtr) \
394 (int16_t)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_HandleEventProcInfo, (NPParg), (voidPtr))
396 #else
398 typedef int16_t (* NP_LOADDS NPP_HandleEventUPP)(NPP instance, void* event);
399 #define NewNPP_HandleEventProc(FUNC) \
400 ((NPP_HandleEventUPP) (FUNC))
401 #define CallNPP_HandleEventProc(FUNC, NPParg, voidPtr) \
402 (*(FUNC))((NPParg), (voidPtr))
404 #endif
407 /* NPP_URLNotify */
409 #if _NPUPP_USE_UPP_
411 typedef UniversalProcPtr NPP_URLNotifyUPP;
412 enum {
413 uppNPP_URLNotifyProcInfo = kThinkCStackBased
414 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
415 | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(const char*)))
416 | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(NPReason)))
417 | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(void*)))
418 | RESULT_SIZE(SIZE_CODE(SIZE_CODE(0)))
420 #define NewNPP_URLNotifyProc(FUNC) \
421 (NPP_URLNotifyUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_URLNotifyProcInfo, GetCurrentArchitecture())
422 #define CallNPP_URLNotifyProc(FUNC, ARG1, ARG2, ARG3, ARG4) \
423 (void)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_URLNotifyProcInfo, (ARG1), (ARG2), (ARG3), (ARG4))
425 #else
427 typedef void (* NP_LOADDS NPP_URLNotifyUPP)(NPP instance, const char* url, NPReason reason, void* notifyData);
428 #define NewNPP_URLNotifyProc(FUNC) \
429 ((NPP_URLNotifyUPP) (FUNC))
430 #define CallNPP_URLNotifyProc(FUNC, ARG1, ARG2, ARG3, ARG4) \
431 (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4))
433 #endif
436 /* NPP_GetValue */
438 #if _NPUPP_USE_UPP_
440 typedef UniversalProcPtr NPP_GetValueUPP;
441 enum {
442 uppNPP_GetValueProcInfo = kThinkCStackBased
443 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
444 | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPPVariable)))
445 | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(void *)))
446 | RESULT_SIZE(SIZE_CODE(sizeof(NPError)))
448 #define NewNPP_GetValueProc(FUNC) \
449 (NPP_GetValueUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_GetValueProcInfo, GetCurrentArchitecture())
450 #define CallNPP_GetValueProc(FUNC, ARG1, ARG2, ARG3) \
451 (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_GetValueProcInfo, (ARG1), (ARG2), (ARG3))
452 #else
454 typedef NPError (* NP_LOADDS NPP_GetValueUPP)(NPP instance, NPPVariable variable, void *ret_alue);
455 #define NewNPP_GetValueProc(FUNC) \
456 ((NPP_GetValueUPP) (FUNC))
457 #define CallNPP_GetValueProc(FUNC, ARG1, ARG2, ARG3) \
458 (*(FUNC))((ARG1), (ARG2), (ARG3))
459 #endif
462 /* NPP_SetValue */
464 #if _NPUPP_USE_UPP_
466 typedef UniversalProcPtr NPP_SetValueUPP;
467 enum {
468 uppNPP_SetValueProcInfo = kThinkCStackBased
469 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
470 | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPNVariable)))
471 | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(void *)))
472 | RESULT_SIZE(SIZE_CODE(sizeof(NPError)))
474 #define NewNPP_SetValueProc(FUNC) \
475 (NPP_SetValueUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_SetValueProcInfo, GetCurrentArchitecture())
476 #define CallNPP_SetValueProc(FUNC, ARG1, ARG2, ARG3) \
477 (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_SetValueProcInfo, (ARG1), (ARG2), (ARG3))
478 #else
480 typedef NPError (* NP_LOADDS NPP_SetValueUPP)(NPP instance, NPNVariable variable, void *ret_alue);
481 #define NewNPP_SetValueProc(FUNC) \
482 ((NPP_SetValueUPP) (FUNC))
483 #define CallNPP_SetValueProc(FUNC, ARG1, ARG2, ARG3) \
484 (*(FUNC))((ARG1), (ARG2), (ARG3))
485 #endif
491 * Netscape entry points
495 /* NPN_GetValue */
497 #if _NPUPP_USE_UPP_
499 typedef UniversalProcPtr NPN_GetValueUPP;
500 enum {
501 uppNPN_GetValueProcInfo = kThinkCStackBased
502 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
503 | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPNVariable)))
504 | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(void *)))
505 | RESULT_SIZE(SIZE_CODE(sizeof(NPError)))
507 #define NewNPN_GetValueProc(FUNC) \
508 (NPN_GetValueUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_GetValueProcInfo, GetCurrentArchitecture())
509 #define CallNPN_GetValueProc(FUNC, ARG1, ARG2, ARG3) \
510 (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_GetValueProcInfo, (ARG1), (ARG2), (ARG3))
511 #else
513 typedef NPError (* NP_LOADDS NPN_GetValueUPP)(NPP instance, NPNVariable variable, void *ret_alue);
514 #define NewNPN_GetValueProc(FUNC) \
515 ((NPN_GetValueUPP) (FUNC))
516 #define CallNPN_GetValueProc(FUNC, ARG1, ARG2, ARG3) \
517 (*(FUNC))((ARG1), (ARG2), (ARG3))
518 #endif
521 /* NPN_SetValue */
523 #if _NPUPP_USE_UPP_
525 typedef UniversalProcPtr NPN_SetValueUPP;
526 enum {
527 uppNPN_SetValueProcInfo = kThinkCStackBased
528 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
529 | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPPVariable)))
530 | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(void *)))
531 | RESULT_SIZE(SIZE_CODE(sizeof(NPError)))
533 #define NewNPN_SetValueProc(FUNC) \
534 (NPN_SetValueUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_SetValueProcInfo, GetCurrentArchitecture())
535 #define CallNPN_SetValueProc(FUNC, ARG1, ARG2, ARG3) \
536 (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_SetValueProcInfo, (ARG1), (ARG2), (ARG3))
537 #else
539 typedef NPError (* NP_LOADDS NPN_SetValueUPP)(NPP instance, NPPVariable variable, void *ret_alue);
540 #define NewNPN_SetValueProc(FUNC) \
541 ((NPN_SetValueUPP) (FUNC))
542 #define CallNPN_SetValueProc(FUNC, ARG1, ARG2, ARG3) \
543 (*(FUNC))((ARG1), (ARG2), (ARG3))
544 #endif
547 /* NPN_GetUrlNotify */
549 #if _NPUPP_USE_UPP_
551 typedef UniversalProcPtr NPN_GetURLNotifyUPP;
552 enum {
553 uppNPN_GetURLNotifyProcInfo = kThinkCStackBased
554 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
555 | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(const char*)))
556 | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(const char*)))
557 | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(void*)))
558 | RESULT_SIZE(SIZE_CODE(sizeof(NPError)))
560 #define NewNPN_GetURLNotifyProc(FUNC) \
561 (NPN_GetURLNotifyUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_GetURLNotifyProcInfo, GetCurrentArchitecture())
562 #define CallNPN_GetURLNotifyProc(FUNC, ARG1, ARG2, ARG3, ARG4) \
563 (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_GetURLNotifyProcInfo, (ARG1), (ARG2), (ARG3), (ARG4))
564 #else
566 typedef NPError (* NP_LOADDS NPN_GetURLNotifyUPP)(NPP instance, const char* url, const char* window, void* notifyData);
567 #define NewNPN_GetURLNotifyProc(FUNC) \
568 ((NPN_GetURLNotifyUPP) (FUNC))
569 #define CallNPN_GetURLNotifyProc(FUNC, ARG1, ARG2, ARG3, ARG4) \
570 (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4))
571 #endif
574 /* NPN_PostUrlNotify */
576 #if _NPUPP_USE_UPP_
578 typedef UniversalProcPtr NPN_PostURLNotifyUPP;
579 enum {
580 uppNPN_PostURLNotifyProcInfo = kThinkCStackBased
581 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
582 | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(const char*)))
583 | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(const char*)))
584 | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(uint32_t)))
585 | STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(const char*)))
586 | STACK_ROUTINE_PARAMETER(6, SIZE_CODE(sizeof(NPBool)))
587 | STACK_ROUTINE_PARAMETER(7, SIZE_CODE(sizeof(void*)))
588 | RESULT_SIZE(SIZE_CODE(sizeof(NPError)))
590 #define NewNPN_PostURLNotifyProc(FUNC) \
591 (NPN_PostURLNotifyUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_PostURLNotifyProcInfo, GetCurrentArchitecture())
592 #define CallNPN_PostURLNotifyProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6, ARG7) \
593 (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_PostURLNotifyProcInfo, (ARG1), (ARG2), (ARG3), (ARG4), (ARG5), (ARG6), (ARG7))
594 #else
596 typedef NPError (* NP_LOADDS NPN_PostURLNotifyUPP)(NPP instance, const char* url, const char* window, uint32_t len, const char* buf, NPBool file, void* notifyData);
597 #define NewNPN_PostURLNotifyProc(FUNC) \
598 ((NPN_PostURLNotifyUPP) (FUNC))
599 #define CallNPN_PostURLNotifyProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6, ARG7) \
600 (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4), (ARG5), (ARG6), (ARG7))
601 #endif
604 /* NPN_GetUrl */
606 #if _NPUPP_USE_UPP_
608 typedef UniversalProcPtr NPN_GetURLUPP;
609 enum {
610 uppNPN_GetURLProcInfo = kThinkCStackBased
611 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
612 | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(const char*)))
613 | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(const char*)))
614 | RESULT_SIZE(SIZE_CODE(sizeof(NPError)))
616 #define NewNPN_GetURLProc(FUNC) \
617 (NPN_GetURLUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_GetURLProcInfo, GetCurrentArchitecture())
618 #define CallNPN_GetURLProc(FUNC, ARG1, ARG2, ARG3) \
619 (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_GetURLProcInfo, (ARG1), (ARG2), (ARG3))
620 #else
622 typedef NPError (* NP_LOADDS NPN_GetURLUPP)(NPP instance, const char* url, const char* window);
623 #define NewNPN_GetURLProc(FUNC) \
624 ((NPN_GetURLUPP) (FUNC))
625 #define CallNPN_GetURLProc(FUNC, ARG1, ARG2, ARG3) \
626 (*(FUNC))((ARG1), (ARG2), (ARG3))
627 #endif
630 /* NPN_PostUrl */
632 #if _NPUPP_USE_UPP_
634 typedef UniversalProcPtr NPN_PostURLUPP;
635 enum {
636 uppNPN_PostURLProcInfo = kThinkCStackBased
637 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
638 | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(const char*)))
639 | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(const char*)))
640 | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(uint32_t)))
641 | STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(const char*)))
642 | STACK_ROUTINE_PARAMETER(6, SIZE_CODE(sizeof(NPBool)))
643 | RESULT_SIZE(SIZE_CODE(sizeof(NPError)))
645 #define NewNPN_PostURLProc(FUNC) \
646 (NPN_PostURLUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_PostURLProcInfo, GetCurrentArchitecture())
647 #define CallNPN_PostURLProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6) \
648 (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_PostURLProcInfo, (ARG1), (ARG2), (ARG3), (ARG4), (ARG5), (ARG6))
649 #else
651 typedef NPError (* NP_LOADDS NPN_PostURLUPP)(NPP instance, const char* url, const char* window, uint32_t len, const char* buf, NPBool file);
652 #define NewNPN_PostURLProc(FUNC) \
653 ((NPN_PostURLUPP) (FUNC))
654 #define CallNPN_PostURLProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6) \
655 (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4), (ARG5), (ARG6))
656 #endif
659 /* NPN_RequestRead */
661 #if _NPUPP_USE_UPP_
663 typedef UniversalProcPtr NPN_RequestReadUPP;
664 enum {
665 uppNPN_RequestReadProcInfo = kThinkCStackBased
666 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPStream *)))
667 | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPByteRange *)))
668 | RESULT_SIZE(SIZE_CODE(sizeof(NPError)))
670 #define NewNPN_RequestReadProc(FUNC) \
671 (NPN_RequestReadUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_RequestReadProcInfo, GetCurrentArchitecture())
672 #define CallNPN_RequestReadProc(FUNC, stream, range) \
673 (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_RequestReadProcInfo, (stream), (range))
675 #else
677 typedef NPError (* NP_LOADDS NPN_RequestReadUPP)(NPStream* stream, NPByteRange* rangeList);
678 #define NewNPN_RequestReadProc(FUNC) \
679 ((NPN_RequestReadUPP) (FUNC))
680 #define CallNPN_RequestReadProc(FUNC, stream, range) \
681 (*(FUNC))((stream), (range))
683 #endif
686 /* NPN_NewStream */
688 #if _NPUPP_USE_UPP_
690 typedef UniversalProcPtr NPN_NewStreamUPP;
691 enum {
692 uppNPN_NewStreamProcInfo = kThinkCStackBased
693 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
694 | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPMIMEType)))
695 | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(const char *)))
696 | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(NPStream **)))
697 | RESULT_SIZE(SIZE_CODE(sizeof(NPError)))
699 #define NewNPN_NewStreamProc(FUNC) \
700 (NPN_NewStreamUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_NewStreamProcInfo, GetCurrentArchitecture())
701 #define CallNPN_NewStreamProc(FUNC, npp, type, window, stream) \
702 (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_NewStreamProcInfo, (npp), (type), (window), (stream))
704 #else
706 typedef NPError (* NP_LOADDS NPN_NewStreamUPP)(NPP instance, NPMIMEType type, const char* window, NPStream** stream);
707 #define NewNPN_NewStreamProc(FUNC) \
708 ((NPN_NewStreamUPP) (FUNC))
709 #define CallNPN_NewStreamProc(FUNC, npp, type, window, stream) \
710 (*(FUNC))((npp), (type), (window), (stream))
712 #endif
715 /* NPN_Write */
717 #if _NPUPP_USE_UPP_
719 typedef UniversalProcPtr NPN_WriteUPP;
720 enum {
721 uppNPN_WriteProcInfo = kThinkCStackBased
722 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
723 | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPStream *)))
724 | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(int32_t)))
725 | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(void*)))
726 | RESULT_SIZE(SIZE_CODE(sizeof(int32_t)))
728 #define NewNPN_WriteProc(FUNC) \
729 (NPN_WriteUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_WriteProcInfo, GetCurrentArchitecture())
730 #define CallNPN_WriteProc(FUNC, npp, stream, len, buffer) \
731 (int32_t)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_WriteProcInfo, (npp), (stream), (len), (buffer))
733 #else
735 typedef int32_t (* NP_LOADDS NPN_WriteUPP)(NPP instance, NPStream* stream, int32_t len, void* buffer);
736 #define NewNPN_WriteProc(FUNC) \
737 ((NPN_WriteUPP) (FUNC))
738 #define CallNPN_WriteProc(FUNC, npp, stream, len, buffer) \
739 (*(FUNC))((npp), (stream), (len), (buffer))
741 #endif
744 /* NPN_DestroyStream */
746 #if _NPUPP_USE_UPP_
748 typedef UniversalProcPtr NPN_DestroyStreamUPP;
749 enum {
750 uppNPN_DestroyStreamProcInfo = kThinkCStackBased
751 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP )))
752 | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPStream *)))
753 | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(NPReason)))
754 | RESULT_SIZE(SIZE_CODE(sizeof(NPError)))
756 #define NewNPN_DestroyStreamProc(FUNC) \
757 (NPN_DestroyStreamUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_DestroyStreamProcInfo, GetCurrentArchitecture())
758 #define CallNPN_DestroyStreamProc(FUNC, npp, stream, reason) \
759 (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_DestroyStreamProcInfo, (npp), (stream), (reason))
761 #else
763 typedef NPError (* NP_LOADDS NPN_DestroyStreamUPP)(NPP instance, NPStream* stream, NPReason reason);
764 #define NewNPN_DestroyStreamProc(FUNC) \
765 ((NPN_DestroyStreamUPP) (FUNC))
766 #define CallNPN_DestroyStreamProc(FUNC, npp, stream, reason) \
767 (*(FUNC))((npp), (stream), (reason))
769 #endif
772 /* NPN_Status */
774 #if _NPUPP_USE_UPP_
776 typedef UniversalProcPtr NPN_StatusUPP;
777 enum {
778 uppNPN_StatusProcInfo = kThinkCStackBased
779 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
780 | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(char *)))
783 #define NewNPN_StatusProc(FUNC) \
784 (NPN_StatusUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_StatusProcInfo, GetCurrentArchitecture())
785 #define CallNPN_StatusProc(FUNC, npp, msg) \
786 (void)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_StatusProcInfo, (npp), (msg))
788 #else
790 typedef void (* NP_LOADDS NPN_StatusUPP)(NPP instance, const char* message);
791 #define NewNPN_StatusProc(FUNC) \
792 ((NPN_StatusUPP) (FUNC))
793 #define CallNPN_StatusProc(FUNC, npp, msg) \
794 (*(FUNC))((npp), (msg))
796 #endif
799 /* NPN_UserAgent */
800 #if _NPUPP_USE_UPP_
802 typedef UniversalProcPtr NPN_UserAgentUPP;
803 enum {
804 uppNPN_UserAgentProcInfo = kThinkCStackBased
805 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
806 | RESULT_SIZE(SIZE_CODE(sizeof(const char *)))
809 #define NewNPN_UserAgentProc(FUNC) \
810 (NPN_UserAgentUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_UserAgentProcInfo, GetCurrentArchitecture())
811 #define CallNPN_UserAgentProc(FUNC, ARG1) \
812 (const char*)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_UserAgentProcInfo, (ARG1))
814 #else
816 typedef const char* (* NP_LOADDS NPN_UserAgentUPP)(NPP instance);
817 #define NewNPN_UserAgentProc(FUNC) \
818 ((NPN_UserAgentUPP) (FUNC))
819 #define CallNPN_UserAgentProc(FUNC, ARG1) \
820 (*(FUNC))((ARG1))
822 #endif
825 /* NPN_MemAlloc */
826 #if _NPUPP_USE_UPP_
828 typedef UniversalProcPtr NPN_MemAllocUPP;
829 enum {
830 uppNPN_MemAllocProcInfo = kThinkCStackBased
831 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(uint32_t)))
832 | RESULT_SIZE(SIZE_CODE(sizeof(void *)))
835 #define NewNPN_MemAllocProc(FUNC) \
836 (NPN_MemAllocUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_MemAllocProcInfo, GetCurrentArchitecture())
837 #define CallNPN_MemAllocProc(FUNC, ARG1) \
838 (void*)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_MemAllocProcInfo, (ARG1))
840 #else
842 typedef void* (* NP_LOADDS NPN_MemAllocUPP)(uint32_t size);
843 #define NewNPN_MemAllocProc(FUNC) \
844 ((NPN_MemAllocUPP) (FUNC))
845 #define CallNPN_MemAllocProc(FUNC, ARG1) \
846 (*(FUNC))((ARG1))
848 #endif
851 /* NPN__MemFree */
853 #if _NPUPP_USE_UPP_
855 typedef UniversalProcPtr NPN_MemFreeUPP;
856 enum {
857 uppNPN_MemFreeProcInfo = kThinkCStackBased
858 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(void *)))
861 #define NewNPN_MemFreeProc(FUNC) \
862 (NPN_MemFreeUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_MemFreeProcInfo, GetCurrentArchitecture())
863 #define CallNPN_MemFreeProc(FUNC, ARG1) \
864 (void)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_MemFreeProcInfo, (ARG1))
866 #else
868 typedef void (* NP_LOADDS NPN_MemFreeUPP)(void* ptr);
869 #define NewNPN_MemFreeProc(FUNC) \
870 ((NPN_MemFreeUPP) (FUNC))
871 #define CallNPN_MemFreeProc(FUNC, ARG1) \
872 (*(FUNC))((ARG1))
874 #endif
877 /* NPN_MemFlush */
879 #if _NPUPP_USE_UPP_
881 typedef UniversalProcPtr NPN_MemFlushUPP;
882 enum {
883 uppNPN_MemFlushProcInfo = kThinkCStackBased
884 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(uint32_t)))
885 | RESULT_SIZE(SIZE_CODE(sizeof(uint32_t)))
888 #define NewNPN_MemFlushProc(FUNC) \
889 (NPN_MemFlushUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_MemFlushProcInfo, GetCurrentArchitecture())
890 #define CallNPN_MemFlushProc(FUNC, ARG1) \
891 (uint32_t)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_MemFlushProcInfo, (ARG1))
893 #else
895 typedef uint32_t (* NP_LOADDS NPN_MemFlushUPP)(uint32_t size);
896 #define NewNPN_MemFlushProc(FUNC) \
897 ((NPN_MemFlushUPP) (FUNC))
898 #define CallNPN_MemFlushProc(FUNC, ARG1) \
899 (*(FUNC))((ARG1))
901 #endif
905 /* NPN_ReloadPlugins */
907 #if _NPUPP_USE_UPP_
909 typedef UniversalProcPtr NPN_ReloadPluginsUPP;
910 enum {
911 uppNPN_ReloadPluginsProcInfo = kThinkCStackBased
912 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPBool)))
913 | RESULT_SIZE(SIZE_CODE(0))
916 #define NewNPN_ReloadPluginsProc(FUNC) \
917 (NPN_ReloadPluginsUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_ReloadPluginsProcInfo, GetCurrentArchitecture())
918 #define CallNPN_ReloadPluginsProc(FUNC, ARG1) \
919 (void)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_ReloadPluginsProcInfo, (ARG1))
921 #else
923 typedef void (* NP_LOADDS NPN_ReloadPluginsUPP)(NPBool reloadPages);
924 #define NewNPN_ReloadPluginsProc(FUNC) \
925 ((NPN_ReloadPluginsUPP) (FUNC))
926 #define CallNPN_ReloadPluginsProc(FUNC, ARG1) \
927 (*(FUNC))((ARG1))
929 #endif
932 /* NPN_GetJavaEnv */
934 #if _NPUPP_USE_UPP_
936 typedef UniversalProcPtr NPN_GetJavaEnvUPP;
937 enum {
938 uppNPN_GetJavaEnvProcInfo = kThinkCStackBased
939 | RESULT_SIZE(SIZE_CODE(sizeof(JRIEnv*)))
942 #define NewNPN_GetJavaEnvProc(FUNC) \
943 (NPN_GetJavaEnvUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_GetJavaEnvProcInfo, GetCurrentArchitecture())
944 #define CallNPN_GetJavaEnvProc(FUNC) \
945 (JRIEnv*)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_GetJavaEnvProcInfo)
947 #else
948 typedef JRIEnv* (* NP_LOADDS NPN_GetJavaEnvUPP)(void);
949 #define NewNPN_GetJavaEnvProc(FUNC) \
950 ((NPN_GetJavaEnvUPP) (FUNC))
951 #define CallNPN_GetJavaEnvProc(FUNC) \
952 (*(FUNC))()
954 #endif
957 /* NPN_GetJavaPeer */
959 #if _NPUPP_USE_UPP_
961 typedef UniversalProcPtr NPN_GetJavaPeerUPP;
962 enum {
963 uppNPN_GetJavaPeerProcInfo = kThinkCStackBased
964 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
965 | RESULT_SIZE(SIZE_CODE(sizeof(jref)))
968 #define NewNPN_GetJavaPeerProc(FUNC) \
969 (NPN_GetJavaPeerUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_GetJavaPeerProcInfo, GetCurrentArchitecture())
970 #define CallNPN_GetJavaPeerProc(FUNC, ARG1) \
971 (jref)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_GetJavaPeerProcInfo, (ARG1))
973 #else
975 typedef jref (* NP_LOADDS NPN_GetJavaPeerUPP)(NPP instance);
976 #define NewNPN_GetJavaPeerProc(FUNC) \
977 ((NPN_GetJavaPeerUPP) (FUNC))
978 #define CallNPN_GetJavaPeerProc(FUNC, ARG1) \
979 (*(FUNC))((ARG1))
981 #endif
984 /* NPN_InvalidateRect */
986 #if _NPUPP_USE_UPP_
988 typedef UniversalProcPtr NPN_InvalidateRectUPP;
989 enum {
990 uppNPN_InvalidateRectProcInfo = kThinkCStackBased
991 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
992 | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPRect *)))
993 | RESULT_SIZE(SIZE_CODE(0))
996 #define NewNPN_InvalidateRectProc(FUNC) \
997 (NPN_InvalidateRectUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_InvalidateRectProcInfo, GetCurrentArchitecture())
998 #define CallNPN_InvalidateRectProc(FUNC, ARG1, ARG2) \
999 (void)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_InvalidateRectProcInfo, (ARG1), (ARG2))
1001 #else
1003 typedef void (* NP_LOADDS NPN_InvalidateRectUPP)(NPP instance, NPRect *rect);
1004 #define NewNPN_InvalidateRectProc(FUNC) \
1005 ((NPN_InvalidateRectUPP) (FUNC))
1006 #define CallNPN_InvalidateRectProc(FUNC, ARG1, ARG2) \
1007 (*(FUNC))((ARG1), (ARG2))
1009 #endif
1012 /* NPN_InvalidateRegion */
1014 #if _NPUPP_USE_UPP_
1016 typedef UniversalProcPtr NPN_InvalidateRegionUPP;
1017 enum {
1018 uppNPN_InvalidateRegionProcInfo = kThinkCStackBased
1019 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
1020 | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPRegion)))
1021 | RESULT_SIZE(SIZE_CODE(0))
1024 #define NewNPN_InvalidateRegionProc(FUNC) \
1025 (NPN_InvalidateRegionUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_InvalidateRegionProcInfo, GetCurrentArchitecture())
1026 #define CallNPN_InvalidateRegionProc(FUNC, ARG1, ARG2) \
1027 (void)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_InvalidateRegionProcInfo, (ARG1), (ARG2))
1029 #else
1031 typedef void (* NP_LOADDS NPN_InvalidateRegionUPP)(NPP instance, NPRegion region);
1032 #define NewNPN_InvalidateRegionProc(FUNC) \
1033 ((NPN_InvalidateRegionUPP) (FUNC))
1034 #define CallNPN_InvalidateRegionProc(FUNC, ARG1, ARG2) \
1035 (*(FUNC))((ARG1), (ARG2))
1037 #endif
1039 /* NPN_ForceRedraw */
1041 #if _NPUPP_USE_UPP_
1043 typedef UniversalProcPtr NPN_ForceRedrawUPP;
1044 enum {
1045 uppNPN_ForceRedrawProcInfo = kThinkCStackBased
1046 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
1047 | RESULT_SIZE(SIZE_CODE(sizeof(0)))
1050 #define NewNPN_ForceRedrawProc(FUNC) \
1051 (NPN_ForceRedrawUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_ForceRedrawProcInfo, GetCurrentArchitecture())
1052 #define CallNPN_ForceRedrawProc(FUNC, ARG1) \
1053 (jref)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_ForceRedrawProcInfo, (ARG1))
1055 #else
1057 typedef void (* NP_LOADDS NPN_ForceRedrawUPP)(NPP instance);
1058 #define NewNPN_ForceRedrawProc(FUNC) \
1059 ((NPN_ForceRedrawUPP) (FUNC))
1060 #define CallNPN_ForceRedrawProc(FUNC, ARG1) \
1061 (*(FUNC))((ARG1))
1063 #endif
1066 /******************************************************************************************
1067 * The actual plugin function table definitions
1068 *******************************************************************************************/
1070 #ifdef XP_MAC
1071 #if PRAGMA_STRUCT_ALIGN
1072 #pragma options align=mac68k
1073 #endif
1074 #endif
1076 typedef struct _NPPluginFuncs {
1077 uint16_t size;
1078 uint16_t version;
1079 NPP_NewUPP newp;
1080 NPP_DestroyUPP destroy;
1081 NPP_SetWindowUPP setwindow;
1082 NPP_NewStreamUPP newstream;
1083 NPP_DestroyStreamUPP destroystream;
1084 NPP_StreamAsFileUPP asfile;
1085 NPP_WriteReadyUPP writeready;
1086 NPP_WriteUPP write;
1087 NPP_PrintUPP print;
1088 NPP_HandleEventUPP event;
1089 NPP_URLNotifyUPP urlnotify;
1090 JRIGlobalRef javaClass;
1091 NPP_GetValueUPP getvalue;
1092 NPP_SetValueUPP setvalue;
1093 } NPPluginFuncs;
1095 typedef struct _NPNetscapeFuncs {
1096 uint16_t size;
1097 uint16_t version;
1098 NPN_GetURLUPP geturl;
1099 NPN_PostURLUPP posturl;
1100 NPN_RequestReadUPP requestread;
1101 NPN_NewStreamUPP newstream;
1102 NPN_WriteUPP write;
1103 NPN_DestroyStreamUPP destroystream;
1104 NPN_StatusUPP status;
1105 NPN_UserAgentUPP uagent;
1106 NPN_MemAllocUPP memalloc;
1107 NPN_MemFreeUPP memfree;
1108 NPN_MemFlushUPP memflush;
1109 NPN_ReloadPluginsUPP reloadplugins;
1110 NPN_GetJavaEnvUPP getJavaEnv;
1111 NPN_GetJavaPeerUPP getJavaPeer;
1112 NPN_GetURLNotifyUPP geturlnotify;
1113 NPN_PostURLNotifyUPP posturlnotify;
1114 NPN_GetValueUPP getvalue;
1115 NPN_SetValueUPP setvalue;
1116 NPN_InvalidateRectUPP invalidaterect;
1117 NPN_InvalidateRegionUPP invalidateregion;
1118 NPN_ForceRedrawUPP forceredraw;
1119 } NPNetscapeFuncs;
1121 #ifdef XP_MAC
1122 #if PRAGMA_STRUCT_ALIGN
1123 #pragma options align=reset
1124 #endif
1125 #endif
1128 #ifdef XP_MAC
1129 /******************************************************************************************
1130 * Mac platform-specific plugin glue stuff
1131 *******************************************************************************************/
1134 * Main entry point of the plugin.
1135 * This routine will be called when the plugin is loaded. The function
1136 * tables are passed in and the plugin fills in the NPPluginFuncs table
1137 * and NPPShutdownUPP for Netscape's use.
1140 #if _NPUPP_USE_UPP_
1142 typedef UniversalProcPtr NPP_MainEntryUPP;
1143 enum {
1144 uppNPP_MainEntryProcInfo = kThinkCStackBased
1145 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPNetscapeFuncs*)))
1146 | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPPluginFuncs*)))
1147 | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(NPP_ShutdownUPP*)))
1148 | RESULT_SIZE(SIZE_CODE(sizeof(NPError)))
1150 #define NewNPP_MainEntryProc(FUNC) \
1151 (NPP_MainEntryUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_MainEntryProcInfo, GetCurrentArchitecture())
1152 #define CallNPP_MainEntryProc(FUNC, netscapeFunc, pluginFunc, shutdownUPP) \
1153 CallUniversalProc((UniversalProcPtr)(FUNC), (ProcInfoType)uppNPP_MainEntryProcInfo, (netscapeFunc), (pluginFunc), (shutdownUPP))
1155 #else
1157 typedef NPError (* NP_LOADDS NPP_MainEntryUPP)(NPNetscapeFuncs*, NPPluginFuncs*, NPP_ShutdownUPP*);
1158 #define NewNPP_MainEntryProc(FUNC) \
1159 ((NPP_MainEntryUPP) (FUNC))
1160 #define CallNPP_MainEntryProc(FUNC, netscapeFunc, pluginFunc, shutdownUPP) \
1161 (*(FUNC))((netscapeFunc), (pluginFunc), (shutdownUPP))
1163 #endif
1167 * Mac version(s) of NP_GetMIMEDescription(const char *)
1168 * These can be called to retrieve MIME information from the plugin dynamically
1170 * Note: For compatibility with Quicktime, BPSupportedMIMEtypes is another way
1171 * to get mime info from the plugin only on OSX and may not be supported
1172 * in future version--use NP_GetMIMEDescription instead
1175 enum
1177 kBPSupportedMIMETypesStructVers_1 = 1
1180 typedef struct _BPSupportedMIMETypes
1182 SInt32 structVersion; // struct version
1183 Handle typeStrings; // STR# formated handle, allocated by plug-in
1184 Handle infoStrings; // STR# formated handle, allocated by plug-in
1185 } BPSupportedMIMETypes;
1186 OSErr BP_GetSupportedMIMETypes(BPSupportedMIMETypes *mimeInfo, UInt32 flags);
1188 #if _NPUPP_USE_UPP_
1190 #define NP_GETMIMEDESCRIPTION_NAME "NP_GetMIMEDescriptionRD"
1191 typedef UniversalProcPtr NP_GetMIMEDescriptionUPP;
1192 enum {
1193 uppNP_GetMIMEDescEntryProc = kThinkCStackBased
1194 | RESULT_SIZE(SIZE_CODE(sizeof(const char *)))
1196 #define NewNP_GetMIMEDescEntryProc(FUNC) \
1197 (NP_GetMIMEDescriptionUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNP_GetMIMEDescEntryProc, GetCurrentArchitecture())
1198 #define CallNP_GetMIMEDescEntryProc(FUNC) \
1199 (const char *)CallUniversalProc((UniversalProcPtr)(FUNC), (ProcInfoType)uppNP_GetMIMEDescEntryProc)
1202 #else // !_NPUPP_USE_UPP_
1204 // NP_GetMIMEDescription
1205 #define NP_GETMIMEDESCRIPTION_NAME "NP_GetMIMEDescription"
1206 typedef const char* (* NP_LOADDS NP_GetMIMEDescriptionUPP)();
1207 #define NewNP_GetMIMEDescEntryProc(FUNC) \
1208 ((NP_GetMIMEDescriptionUPP) (FUNC))
1209 #define CallNP_GetMIMEDescEntryProc(FUNC) \
1210 (*(FUNC))()
1211 // BP_GetSupportedMIMETypes
1212 typedef OSErr (* NP_LOADDS BP_GetSupportedMIMETypesUPP)(BPSupportedMIMETypes*, UInt32);
1213 #define NewBP_GetSupportedMIMETypesEntryProc(FUNC) \
1214 ((BP_GetSupportedMIMETypesUPP) (FUNC))
1215 #define CallBP_GetMIMEDescEntryProc(FUNC, mimeInfo, flags) \
1216 (*(FUNC))((mimeInfo), (flags))
1218 #endif
1219 #endif /* MAC */
1221 #if defined(_WINDOWS)
1222 #define OSCALL WINAPI
1223 #else
1224 #define OSCALL
1225 #endif
1227 #if defined( _WINDOWS )
1229 #ifdef __cplusplus
1230 extern "C" {
1231 #endif
1233 /* plugin meta member functions */
1235 NPError WINAPI NP_GetEntryPoints(NPPluginFuncs* pFuncs);
1237 NPError WINAPI NP_Initialize(NPNetscapeFuncs *aNPNFuncs);
1239 void WINAPI NP_Shutdown();
1241 char* NP_GetMIMEDescription();
1243 #ifdef __cplusplus
1245 #endif
1247 #endif /* _WINDOWS */
1249 #ifdef XP_UNIX
1251 #ifdef __cplusplus
1252 extern "C" {
1253 #endif
1255 /* plugin meta member functions */
1257 char* NP_GetMIMEDescription(void);
1258 NPError NP_Initialize(NPNetscapeFuncs *aNPNFuncs, NPPluginFuncs *aNPPFuncs);
1259 void NP_Shutdown(void);
1261 #ifdef __cplusplus
1263 #endif
1265 #endif /* XP_UNIX */
1267 #endif /* _NPUPP_H_ */