3 * function call mecahnics needed by platform specific glue code.
11 #define GENERATINGCFM 0
18 /******************************************************************************************
19 plug-in function table macros
20 for each function in and out of the plugin API we define
22 #define NewNPP_FooProc
23 #define CallNPP_FooProc
24 for mac, define the UPP magic for PPC/68K calling
25 *******************************************************************************************/
31 typedef UniversalProcPtr NPP_InitializeUPP
;
34 uppNPP_InitializeProcInfo
= kThinkCStackBased
35 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(0))
36 | RESULT_SIZE(SIZE_CODE(0))
39 #define NewNPP_InitializeProc(FUNC) \
40 (NPP_InitializeUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_InitializeProcInfo, GetCurrentArchitecture())
41 #define CallNPP_InitializeProc(FUNC) \
42 (void)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_InitializeProcInfo)
46 typedef void (*NPP_InitializeUPP
)(void);
47 #define NewNPP_InitializeProc(FUNC) \
48 ((NPP_InitializeUPP) (FUNC))
49 #define CallNPP_InitializeProc(FUNC) \
58 typedef UniversalProcPtr NPP_ShutdownUPP
;
61 uppNPP_ShutdownProcInfo
= kThinkCStackBased
62 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(0))
63 | RESULT_SIZE(SIZE_CODE(0))
66 #define NewNPP_ShutdownProc(FUNC) \
67 (NPP_ShutdownUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_ShutdownProcInfo, GetCurrentArchitecture())
68 #define CallNPP_ShutdownProc(FUNC) \
69 (void)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_ShutdownProcInfo)
73 typedef void (*NPP_ShutdownUPP
)(void);
74 #define NewNPP_ShutdownProc(FUNC) \
75 ((NPP_ShutdownUPP) (FUNC))
76 #define CallNPP_ShutdownProc(FUNC) \
85 typedef UniversalProcPtr NPP_NewUPP
;
88 uppNPP_NewProcInfo
= kThinkCStackBased
89 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPMIMEType
)))
90 | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPP
)))
91 | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(uint16
)))
92 | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(int16
)))
93 | STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(char **)))
94 | STACK_ROUTINE_PARAMETER(6, SIZE_CODE(sizeof(char **)))
95 | STACK_ROUTINE_PARAMETER(7, SIZE_CODE(sizeof(NPSavedData
*)))
96 | RESULT_SIZE(SIZE_CODE(sizeof(NPError
)))
99 #define NewNPP_NewProc(FUNC) \
100 (NPP_NewUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_NewProcInfo, GetCurrentArchitecture())
101 #define CallNPP_NewProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6, ARG7) \
102 (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_NewProcInfo, \
103 (ARG1), (ARG2), (ARG3), (ARG4), (ARG5), (ARG6), (ARG7))
106 typedef NPError (*NPP_NewUPP
)(NPMIMEType pluginType
, NPP instance
, uint16 mode
, int16 argc
, char* argn
[], char* argv
[], NPSavedData
* saved
);
107 #define NewNPP_NewProc(FUNC) \
108 ((NPP_NewUPP) (FUNC))
109 #define CallNPP_NewProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6, ARG7) \
110 (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4), (ARG5), (ARG6), (ARG7))
119 typedef UniversalProcPtr NPP_DestroyUPP
;
121 uppNPP_DestroyProcInfo
= kThinkCStackBased
122 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP
)))
123 | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPSavedData
**)))
124 | RESULT_SIZE(SIZE_CODE(sizeof(NPError
)))
126 #define NewNPP_DestroyProc(FUNC) \
127 (NPP_DestroyUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_DestroyProcInfo, GetCurrentArchitecture())
128 #define CallNPP_DestroyProc(FUNC, ARG1, ARG2) \
129 (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_DestroyProcInfo, (ARG1), (ARG2))
132 typedef NPError (*NPP_DestroyUPP
)(NPP instance
, NPSavedData
** save
);
133 #define NewNPP_DestroyProc(FUNC) \
134 ((NPP_DestroyUPP) (FUNC))
135 #define CallNPP_DestroyProc(FUNC, ARG1, ARG2) \
136 (*(FUNC))((ARG1), (ARG2))
145 typedef UniversalProcPtr NPP_SetWindowUPP
;
147 uppNPP_SetWindowProcInfo
= kThinkCStackBased
148 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP
)))
149 | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPWindow
*)))
150 | RESULT_SIZE(SIZE_CODE(sizeof(NPError
)))
152 #define NewNPP_SetWindowProc(FUNC) \
153 (NPP_SetWindowUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_SetWindowProcInfo, GetCurrentArchitecture())
154 #define CallNPP_SetWindowProc(FUNC, ARG1, ARG2) \
155 (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_SetWindowProcInfo, (ARG1), (ARG2))
159 typedef NPError (*NPP_SetWindowUPP
)(NPP instance
, NPWindow
* window
);
160 #define NewNPP_SetWindowProc(FUNC) \
161 ((NPP_SetWindowUPP) (FUNC))
162 #define CallNPP_SetWindowProc(FUNC, ARG1, ARG2) \
163 (*(FUNC))((ARG1), (ARG2))
172 typedef UniversalProcPtr NPP_NewStreamUPP
;
174 uppNPP_NewStreamProcInfo
= kThinkCStackBased
175 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP
)))
176 | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPMIMEType
)))
177 | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(NPStream
*)))
178 | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(NPBool
)))
179 | STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(uint16
*)))
180 | RESULT_SIZE(SIZE_CODE(sizeof(NPError
)))
182 #define NewNPP_NewStreamProc(FUNC) \
183 (NPP_NewStreamUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_NewStreamProcInfo, GetCurrentArchitecture())
184 #define CallNPP_NewStreamProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5) \
185 (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_NewStreamProcInfo, (ARG1), (ARG2), (ARG3), (ARG4), (ARG5))
188 typedef NPError (*NPP_NewStreamUPP
)(NPP instance
, NPMIMEType type
, NPStream
* stream
, NPBool seekable
, uint16
* stype
);
189 #define NewNPP_NewStreamProc(FUNC) \
190 ((NPP_NewStreamUPP) (FUNC))
191 #define CallNPP_NewStreamProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5) \
192 (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4), (ARG5))
196 /* NPP_DestroyStream */
200 typedef UniversalProcPtr NPP_DestroyStreamUPP
;
202 uppNPP_DestroyStreamProcInfo
= kThinkCStackBased
203 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP
)))
204 | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPStream
*)))
205 | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(NPError
)))
206 | RESULT_SIZE(SIZE_CODE(sizeof(NPError
)))
208 #define NewNPP_DestroyStreamProc(FUNC) \
209 (NPP_DestroyStreamUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_DestroyStreamProcInfo, GetCurrentArchitecture())
210 #define CallNPP_DestroyStreamProc(FUNC, NPParg, NPStreamPtr, NPErrorArg) \
211 (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_DestroyStreamProcInfo, (NPParg), (NPStreamPtr), (NPErrorArg))
215 typedef NPError (*NPP_DestroyStreamUPP
)(NPP instance
, NPStream
* stream
, NPError reason
);
216 #define NewNPP_DestroyStreamProc(FUNC) \
217 ((NPP_DestroyStreamUPP) (FUNC))
218 #define CallNPP_DestroyStreamProc(FUNC, NPParg, NPStreamPtr, NPErrorArg) \
219 (*(FUNC))((NPParg), (NPStreamPtr), (NPErrorArg))
228 typedef UniversalProcPtr NPP_WriteReadyUPP
;
230 uppNPP_WriteReadyProcInfo
= kThinkCStackBased
231 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP
)))
232 | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPStream
*)))
233 | RESULT_SIZE(SIZE_CODE(sizeof(int32
)))
235 #define NewNPP_WriteReadyProc(FUNC) \
236 (NPP_WriteReadyUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_WriteReadyProcInfo, GetCurrentArchitecture())
237 #define CallNPP_WriteReadyProc(FUNC, NPParg, NPStreamPtr) \
238 (int32)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_WriteReadyProcInfo, (NPParg), (NPStreamPtr))
242 typedef int32 (*NPP_WriteReadyUPP
)(NPP instance
, NPStream
* stream
);
243 #define NewNPP_WriteReadyProc(FUNC) \
244 ((NPP_WriteReadyUPP) (FUNC))
245 #define CallNPP_WriteReadyProc(FUNC, NPParg, NPStreamPtr) \
246 (*(FUNC))((NPParg), (NPStreamPtr))
255 typedef UniversalProcPtr NPP_WriteUPP
;
257 uppNPP_WriteProcInfo
= kThinkCStackBased
258 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP
)))
259 | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPStream
*)))
260 | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(int32
)))
261 | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(int32
)))
262 | STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(void*)))
263 | RESULT_SIZE(SIZE_CODE(sizeof(int32
)))
265 #define NewNPP_WriteProc(FUNC) \
266 (NPP_WriteUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_WriteProcInfo, GetCurrentArchitecture())
267 #define CallNPP_WriteProc(FUNC, NPParg, NPStreamPtr, offsetArg, lenArg, bufferPtr) \
268 (int32)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_WriteProcInfo, (NPParg), (NPStreamPtr), (offsetArg), (lenArg), (bufferPtr))
272 typedef int32 (*NPP_WriteUPP
)(NPP instance
, NPStream
* stream
, int32 offset
, int32 len
, void* buffer
);
273 #define NewNPP_WriteProc(FUNC) \
274 ((NPP_WriteUPP) (FUNC))
275 #define CallNPP_WriteProc(FUNC, NPParg, NPStreamPtr, offsetArg, lenArg, bufferPtr) \
276 (*(FUNC))((NPParg), (NPStreamPtr), (offsetArg), (lenArg), (bufferPtr))
281 /* NPP_StreamAsFile */
285 typedef UniversalProcPtr NPP_StreamAsFileUPP
;
287 uppNPP_StreamAsFileProcInfo
= kThinkCStackBased
288 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP
)))
289 | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPStream
*)))
290 | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(const char *)))
291 | RESULT_SIZE(SIZE_CODE(0))
293 #define NewNPP_StreamAsFileProc(FUNC) \
294 (NPP_StreamAsFileUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_StreamAsFileProcInfo, GetCurrentArchitecture())
295 #define CallNPP_StreamAsFileProc(FUNC, ARG1, ARG2, ARG3) \
296 (void)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_StreamAsFileProcInfo, (ARG1), (ARG2), (ARG3))
300 typedef void (*NPP_StreamAsFileUPP
)(NPP instance
, NPStream
* stream
, const char* fname
);
301 #define NewNPP_StreamAsFileProc(FUNC) \
302 ((NPP_StreamAsFileUPP) (FUNC))
303 #define CallNPP_StreamAsFileProc(FUNC, ARG1, ARG2, ARG3) \
304 (*(FUNC))((ARG1), (ARG2), (ARG3))
312 typedef UniversalProcPtr NPP_PrintUPP
;
314 uppNPP_PrintProcInfo
= kThinkCStackBased
315 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP
)))
316 | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPPrint
*)))
317 | RESULT_SIZE(SIZE_CODE(0))
319 #define NewNPP_PrintProc(FUNC) \
320 (NPP_PrintUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_PrintProcInfo, GetCurrentArchitecture())
321 #define CallNPP_PrintProc(FUNC, NPParg, voidPtr) \
322 (void)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_PrintProcInfo, (NPParg), (voidPtr))
326 typedef void (*NPP_PrintUPP
)(NPP instance
, NPPrint
* platformPrint
);
327 #define NewNPP_PrintProc(FUNC) \
328 ((NPP_PrintUPP) (FUNC))
329 #define CallNPP_PrintProc(FUNC, NPParg, NPPrintArg) \
330 (*(FUNC))((NPParg), (NPPrintArg))
335 /* NPP_HandleEvent */
339 typedef UniversalProcPtr NPP_HandleEventUPP
;
341 uppNPP_HandleEventProcInfo
= kThinkCStackBased
342 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP
)))
343 | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(void *)))
344 | RESULT_SIZE(SIZE_CODE(sizeof(int16
)))
346 #define NewNPP_HandleEventProc(FUNC) \
347 (NPP_HandleEventUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_HandleEventProcInfo, GetCurrentArchitecture())
348 #define CallNPP_HandleEventProc(FUNC, NPParg, voidPtr) \
349 (int16)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_HandleEventProcInfo, (NPParg), (voidPtr))
353 typedef int16 (*NPP_HandleEventUPP
)(NPP instance
, void* event
);
354 #define NewNPP_HandleEventProc(FUNC) \
355 ((NPP_HandleEventUPP) (FUNC))
356 #define CallNPP_HandleEventProc(FUNC, NPParg, voidPtr) \
357 (*(FUNC))((NPParg), (voidPtr))
365 * Netscape entry points
373 typedef UniversalProcPtr NPN_GetURLUPP
;
375 uppNPN_GetURLProcInfo
= kThinkCStackBased
376 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP
)))
377 | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(const char*)))
378 | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(const char*)))
379 | RESULT_SIZE(SIZE_CODE(sizeof(NPError
)))
381 #define NewNPN_GetURLProc(FUNC) \
382 (NPN_GetURLUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_GetURLProcInfo, GetCurrentArchitecture())
383 #define CallNPN_GetURLProc(FUNC, ARG1, ARG2, ARG3) \
384 (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_GetURLProcInfo, (ARG1), (ARG2), (ARG3))
387 typedef NPError (*NPN_GetURLUPP
)(NPP instance
, const char* url
, const char* window
);
388 #define NewNPN_GetURLProc(FUNC) \
389 ((NPN_GetURLUPP) (FUNC))
390 #define CallNPN_GetURLProc(FUNC, ARG1, ARG2, ARG3) \
391 (*(FUNC))((ARG1), (ARG2), (ARG3))
399 typedef UniversalProcPtr NPN_PostURLUPP
;
401 uppNPN_PostURLProcInfo
= kThinkCStackBased
402 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP
)))
403 | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(const char*)))
404 | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(const char*)))
405 | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(uint32
)))
406 | STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(const char*)))
407 | STACK_ROUTINE_PARAMETER(6, SIZE_CODE(sizeof(NPBool
)))
408 | RESULT_SIZE(SIZE_CODE(sizeof(NPError
)))
410 #define NewNPN_PostURLProc(FUNC) \
411 (NPN_PostURLUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_PostURLProcInfo, GetCurrentArchitecture())
412 #define CallNPN_PostURLProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6) \
413 (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_PostURLProcInfo, (ARG1), (ARG2), (ARG3), (ARG4), (ARG5), (ARG6))
416 typedef NPError (*NPN_PostURLUPP
)(NPP instance
, const char* url
, const char* window
, uint32 len
, const char* buf
, NPBool file
);
417 #define NewNPN_PostURLProc(FUNC) \
418 ((NPN_PostURLUPP) (FUNC))
419 #define CallNPN_PostURLProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6) \
420 (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4), (ARG5), (ARG6))
424 /* NPN_RequestRead */
428 typedef UniversalProcPtr NPN_RequestReadUPP
;
430 uppNPN_RequestReadProcInfo
= kThinkCStackBased
431 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPStream
*)))
432 | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPByteRange
*)))
433 | RESULT_SIZE(SIZE_CODE(sizeof(NPError
)))
435 #define NewNPN_RequestReadProc(FUNC) \
436 (NPN_RequestReadUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_RequestReadProcInfo, GetCurrentArchitecture())
437 #define CallNPN_RequestReadProc(FUNC, stream, range) \
438 (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_RequestReadProcInfo, (stream), (range))
442 typedef NPError (*NPN_RequestReadUPP
)(NPStream
* stream
, NPByteRange
* rangeList
);
443 #define NewNPN_RequestReadProc(FUNC) \
444 ((NPN_RequestReadUPP) (FUNC))
445 #define CallNPN_RequestReadProc(FUNC, stream, range) \
446 (*(FUNC))((stream), (range))
455 typedef UniversalProcPtr NPN_NewStreamUPP
;
457 uppNPN_NewStreamProcInfo
= kThinkCStackBased
458 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP
)))
459 | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPMIMEType
)))
460 | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(NPStream
*)))
461 | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(NPBool
)))
462 | STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(uint16
*)))
463 | RESULT_SIZE(SIZE_CODE(sizeof(NPError
)))
465 #define NewNPN_NewStreamProc(FUNC) \
466 (NPN_NewStreamUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_NewStreamProcInfo, GetCurrentArchitecture())
467 #define CallNPN_NewStreamProc(FUNC, npp, type, stream) \
468 (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_NewStreamProcInfo, (npp), (type), (stream))
472 typedef NPError (*NPN_NewStreamUPP
)(NPP instance
, NPMIMEType type
, NPStream
* stream
);
473 #define NewNPN_NewStreamProc(FUNC) \
474 ((NPN_NewStreamUPP) (FUNC))
475 #define CallNPN_NewStreamProc(FUNC, npp, type, stream) \
476 (*(FUNC))((npp), (type), (stream))
485 typedef UniversalProcPtr NPN_WriteUPP
;
487 uppNPN_WriteProcInfo
= kThinkCStackBased
488 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP
)))
489 | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPStream
*)))
490 | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(int32
)))
491 | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(void*)))
492 | RESULT_SIZE(SIZE_CODE(sizeof(int32
)))
494 #define NewNPN_WriteProc(FUNC) \
495 (NPN_WriteUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_WriteProcInfo, GetCurrentArchitecture())
496 #define CallNPN_WriteProc(FUNC, npp, stream, len, buffer) \
497 (int32)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_WriteProcInfo, (npp), (stream), (len), (buffer))
501 typedef int32 (*NPN_WriteUPP
)(NPP instance
, NPStream
* stream
, int32 len
, void* buffer
);
502 #define NewNPN_WriteProc(FUNC) \
503 ((NPN_WriteUPP) (FUNC))
504 #define CallNPN_WriteProc(FUNC, npp, stream, len, buffer) \
505 (*(FUNC))((npp), (stream), (len), (buffer))
510 /* NPN_DestroyStream */
514 typedef UniversalProcPtr NPN_DestroyStreamUPP
;
516 uppNPN_DestroyStreamProcInfo
= kThinkCStackBased
517 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP
)))
518 | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPStream
*)))
519 | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(NPError
)))
520 | RESULT_SIZE(SIZE_CODE(sizeof(NPError
)))
522 #define NewNPN_DestroyStreamProc(FUNC) \
523 (NPN_DestroyStreamUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_DestroyStreamProcInfo, GetCurrentArchitecture())
524 #define CallNPN_DestroyStreamProc(FUNC, npp, stream, err) \
525 (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_DestroyStreamProcInfo, (npp), (stream), (err))
529 typedef NPError (*NPN_DestroyStreamUPP
)(NPP instance
, NPStream
* stream
, NPError reason
);
530 #define NewNPN_DestroyStreamProc(FUNC) \
531 ((NPN_DestroyStreamUPP) (FUNC))
532 #define CallNPN_DestroyStreamProc(FUNC, npp, stream, err) \
533 (*(FUNC))((npp), (stream), (err))
542 typedef UniversalProcPtr NPN_StatusUPP
;
544 uppNPN_StatusProcInfo
= kThinkCStackBased
545 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP
)))
546 | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(char *)))
549 #define NewNPN_StatusProc(FUNC) \
550 (NPN_StatusUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_StatusProcInfo, GetCurrentArchitecture())
551 #define CallNPN_StatusProc(FUNC, npp, msg) \
552 (void)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_StatusProcInfo, (npp), (msg))
556 typedef void (*NPN_StatusUPP
)(NPP instance
, const char* message
);
557 #define NewNPN_StatusProc(FUNC) \
558 ((NPN_StatusUPP) (FUNC))
559 #define CallNPN_StatusProc(FUNC, npp, msg) \
560 (*(FUNC))((npp), (msg))
568 typedef UniversalProcPtr NPN_UserAgentUPP
;
570 uppNPN_UserAgentProcInfo
= kThinkCStackBased
571 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP
)))
572 | RESULT_SIZE(SIZE_CODE(sizeof(const char *)))
575 #define NewNPN_UserAgentProc(FUNC) \
576 (NPN_UserAgentUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_UserAgentProcInfo, GetCurrentArchitecture())
577 #define CallNPN_UserAgentProc(FUNC, ARG1) \
578 (const char*)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_UserAgentProcInfo, (ARG1))
582 typedef const char* (*NPN_UserAgentUPP
)(NPP instance
);
583 #define NewNPN_UserAgentProc(FUNC) \
584 ((NPN_UserAgentUPP) (FUNC))
585 #define CallNPN_UserAgentProc(FUNC, ARG1) \
594 typedef UniversalProcPtr NPN_MemAllocUPP
;
596 uppNPN_MemAllocProcInfo
= kThinkCStackBased
597 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(uint32
)))
598 | RESULT_SIZE(SIZE_CODE(sizeof(void *)))
601 #define NewNPN_MemAllocProc(FUNC) \
602 (NPN_MemAllocUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_MemAllocProcInfo, GetCurrentArchitecture())
603 #define CallNPN_MemAllocProc(FUNC, ARG1) \
604 (void*)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_MemAllocProcInfo, (ARG1))
608 typedef void* (*NPN_MemAllocUPP
)(uint32 size
);
609 #define NewNPN_MemAllocProc(FUNC) \
610 ((NPN_MemAllocUPP) (FUNC))
611 #define CallNPN_MemAllocProc(FUNC, ARG1) \
621 typedef UniversalProcPtr NPN_MemFreeUPP
;
623 uppNPN_MemFreeProcInfo
= kThinkCStackBased
624 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(void *)))
627 #define NewNPN_MemFreeProc(FUNC) \
628 (NPN_MemFreeUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_MemFreeProcInfo, GetCurrentArchitecture())
629 #define CallNPN_MemFreeProc(FUNC, ARG1) \
630 (void)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_MemFreeProcInfo, (ARG1))
634 typedef void (*NPN_MemFreeUPP
)(void* ptr
);
635 #define NewNPN_MemFreeProc(FUNC) \
636 ((NPN_MemFreeUPP) (FUNC))
637 #define CallNPN_MemFreeProc(FUNC, ARG1) \
647 typedef UniversalProcPtr NPN_MemFlushUPP
;
649 uppNPN_MemFlushProcInfo
= kThinkCStackBased
650 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(uint32
)))
651 | RESULT_SIZE(SIZE_CODE(sizeof(uint32
)))
654 #define NewNPN_MemFlushProc(FUNC) \
655 (NPN_MemFlushUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_MemFlushProcInfo, GetCurrentArchitecture())
656 #define CallNPN_MemFlushProc(FUNC, ARG1) \
657 (uint32)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_MemFlushProcInfo, (ARG1))
661 typedef uint32 (*NPN_MemFlushUPP
)(uint32 size
);
662 #define NewNPN_MemFlushProc(FUNC) \
663 ((NPN_MemFlushUPP) (FUNC))
664 #define CallNPN_MemFlushProc(FUNC, ARG1) \
671 /* NPN_ReloadPlugins */
675 typedef UniversalProcPtr NPN_ReloadPluginsUPP
;
677 uppNPN_ReloadPluginsProcInfo
= kThinkCStackBased
678 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPBool
)))
679 | RESULT_SIZE(SIZE_CODE(0))
682 #define NewNPN_ReloadPluginsProc(FUNC) \
683 (NPN_ReloadPluginsUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_ReloadPluginsProcInfo, GetCurrentArchitecture())
684 #define CallNPN_ReloadPluginsProc(FUNC, ARG1) \
685 (void)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_ReloadPluginsProcInfo, (ARG1))
689 typedef void (*NPN_ReloadPluginsUPP
)(NPBool reloadPages
);
690 #define NewNPN_ReloadPluginsProc(FUNC) \
691 ((NPN_ReloadPluginsUPP) (FUNC))
692 #define CallNPN_ReloadPluginsProc(FUNC, ARG1) \
700 /******************************************************************************************
701 * The actual plugin function table definitions
702 *******************************************************************************************/
704 typedef struct _NPPluginFuncs
{
708 NPP_DestroyUPP destroy
;
709 NPP_SetWindowUPP setwindow
;
710 NPP_NewStreamUPP newstream
;
711 NPP_DestroyStreamUPP destroystream
;
712 NPP_StreamAsFileUPP asfile
;
713 NPP_WriteReadyUPP writeready
;
716 NPP_HandleEventUPP event
;
719 typedef struct _NPNetscapeFuncs
{
722 NPN_GetURLUPP geturl
;
723 NPN_PostURLUPP posturl
;
724 NPN_RequestReadUPP requestread
;
725 NPN_NewStreamUPP newstream
;
727 NPN_DestroyStreamUPP destroystream
;
728 NPN_StatusUPP status
;
729 NPN_UserAgentUPP uagent
;
730 NPN_MemAllocUPP memalloc
;
731 NPN_MemFreeUPP memfree
;
732 NPN_MemFlushUPP memflush
;
733 NPN_ReloadPluginsUPP reloadplugins
;
739 /******************************************************************************************
740 * Mac platform-specific plugin glue stuff
741 *******************************************************************************************/
744 * Main entry point of the plugin.
745 * This routine will be called when the plugin is loaded. The function
746 * tables are passed in and the plugin fills in the NPPluginFuncs table
747 * and NPPShutdownUPP for Netscape's use.
752 typedef UniversalProcPtr NPP_MainEntryUPP
;
754 uppNPP_MainEntryProcInfo
= kThinkCStackBased
755 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPNetscapeFuncs
*)))
756 | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPPluginFuncs
*)))
757 | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(NPP_ShutdownUPP
*)))
758 | RESULT_SIZE(SIZE_CODE(sizeof(NPError
)))
760 #define NewNPP_MainEntryProc(FUNC) \
761 (NPP_MainEntryUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_MainEntryProcInfo, GetCurrentArchitecture())
762 #define CallNPP_MainEntryProc(FUNC, netscapeFunc, pluginFunc, shutdownUPP) \
763 CallUniversalProc((UniversalProcPtr)(FUNC), (ProcInfoType)uppNPP_MainEntryProcInfo, (netscapeFunc), (pluginFunc), (shutdownUPP))
767 typedef NPError (*NPP_MainEntryUPP
)(NPNetscapeFuncs
*, NPPluginFuncs
*, NPP_ShutdownUPP
*);
768 #define NewNPP_MainEntryProc(FUNC) \
769 ((NPP_MainEntryUPP) (FUNC))
770 #define CallNPP_MainEntryProc(FUNC, netscapeFunc, pluginFunc, shutdownUPP) \
771 (*(FUNC))((netscapeFunc), (pluginFunc), (shutdownUPP))
783 /* plugin meta member functions */
785 NPError WINAPI
NP_GetEntryPoints(NPPluginFuncs
* pFuncs
);
787 NPError WINAPI
NP_Initialize(NPNetscapeFuncs
* pFuncs
);
789 NPError WINAPI
NP_Shutdown();
795 #endif /* _WINDOWS */
798 #endif /* _NPUPP_H_ */