Back to index

lightning-sunbird  0.9+nobinonly
npupp.h
Go to the documentation of this file.
00001 /* -*- Mode: C; tab-width: 4; -*- */
00002 /*
00003  *  npupp.h $Revision: 1.1 $
00004  *  function call mecahnics needed by platform specific glue code.
00005  */
00006 
00007 
00008 #ifndef _NPUPP_H_
00009 #define _NPUPP_H_
00010 
00011 #ifndef GENERATINGCFM
00012 #define GENERATINGCFM 0
00013 #endif
00014 
00015 #ifndef _NPAPI_H_
00016 #include "npapi.h"
00017 #endif
00018 
00019 #include "jri.h"
00020 
00021 /******************************************************************************************
00022    plug-in function table macros
00023           for each function in and out of the plugin API we define
00024                     typedef NPP_FooUPP
00025           #define NewNPP_FooProc
00026           #define CallNPP_FooProc
00027       for mac, define the UPP magic for PPC/68K calling
00028  *******************************************************************************************/
00029 
00030 
00031 /* NPP_Initialize */
00032 
00033 #if GENERATINGCFM
00034 typedef UniversalProcPtr NPP_InitializeUPP;
00035 
00036 enum {
00037   uppNPP_InitializeProcInfo = kThinkCStackBased
00038     | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(0))    
00039     | RESULT_SIZE(SIZE_CODE(0))
00040 };
00041 
00042 #define NewNPP_InitializeProc(FUNC)   \
00043     (NPP_InitializeUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_InitializeProcInfo, GetCurrentArchitecture())
00044 #define CallNPP_InitializeProc(FUNC)    \
00045     (void)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_InitializeProcInfo)
00046     
00047 #else
00048 
00049 typedef void (*NPP_InitializeUPP)(void);
00050 #define NewNPP_InitializeProc(FUNC)   \
00051     ((NPP_InitializeUPP) (FUNC))
00052 #define CallNPP_InitializeProc(FUNC)    \
00053     (*(FUNC))()
00054 
00055 #endif
00056 
00057 
00058 /* NPP_Shutdown */
00059 
00060 #if GENERATINGCFM
00061 typedef UniversalProcPtr NPP_ShutdownUPP;
00062 
00063 enum {
00064   uppNPP_ShutdownProcInfo = kThinkCStackBased
00065     | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(0))    
00066     | RESULT_SIZE(SIZE_CODE(0))
00067 };
00068 
00069 #define NewNPP_ShutdownProc(FUNC)   \
00070     (NPP_ShutdownUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_ShutdownProcInfo, GetCurrentArchitecture())
00071 #define CallNPP_ShutdownProc(FUNC)    \
00072     (void)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_ShutdownProcInfo)
00073     
00074 #else
00075 
00076 typedef void (*NPP_ShutdownUPP)(void);
00077 #define NewNPP_ShutdownProc(FUNC)   \
00078     ((NPP_ShutdownUPP) (FUNC))
00079 #define CallNPP_ShutdownProc(FUNC)    \
00080     (*(FUNC))()
00081 
00082 #endif
00083 
00084 
00085 /* NPP_New */
00086 
00087 #if GENERATINGCFM
00088 typedef UniversalProcPtr NPP_NewUPP;
00089 
00090 enum {
00091   uppNPP_NewProcInfo = kThinkCStackBased
00092     | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPMIMEType)))
00093     | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPP)))
00094     | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(uint16)))
00095     | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(int16)))
00096     | STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(char **)))
00097     | STACK_ROUTINE_PARAMETER(6, SIZE_CODE(sizeof(char **)))
00098     | STACK_ROUTINE_PARAMETER(7, SIZE_CODE(sizeof(NPSavedData *)))
00099     | RESULT_SIZE(SIZE_CODE(sizeof(NPError)))
00100 };
00101 
00102 #define NewNPP_NewProc(FUNC)    \
00103     (NPP_NewUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_NewProcInfo, GetCurrentArchitecture())
00104 #define CallNPP_NewProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6, ARG7) \
00105     (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_NewProcInfo, \
00106                    (ARG1), (ARG2), (ARG3), (ARG4), (ARG5), (ARG6), (ARG7))
00107 #else
00108 
00109 typedef NPError (*NPP_NewUPP)(NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, char* argn[], char* argv[], NPSavedData* saved);
00110 #define NewNPP_NewProc(FUNC)    \
00111     ((NPP_NewUPP) (FUNC))
00112 #define CallNPP_NewProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6, ARG7)   \
00113     (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4), (ARG5), (ARG6), (ARG7))
00114 
00115 #endif
00116 
00117 
00118 /* NPP_Destroy */
00119 
00120 #if GENERATINGCFM
00121 
00122 typedef UniversalProcPtr NPP_DestroyUPP;
00123 enum {
00124   uppNPP_DestroyProcInfo = kThinkCStackBased
00125     | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
00126     | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPSavedData **)))
00127     | RESULT_SIZE(SIZE_CODE(sizeof(NPError)))
00128 };
00129 #define NewNPP_DestroyProc(FUNC)    \
00130     (NPP_DestroyUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_DestroyProcInfo, GetCurrentArchitecture())
00131 #define CallNPP_DestroyProc(FUNC, ARG1, ARG2)   \
00132     (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_DestroyProcInfo, (ARG1), (ARG2))
00133 #else
00134 
00135 typedef NPError (*NPP_DestroyUPP)(NPP instance, NPSavedData** save);
00136 #define NewNPP_DestroyProc(FUNC)    \
00137     ((NPP_DestroyUPP) (FUNC))
00138 #define CallNPP_DestroyProc(FUNC, ARG1, ARG2)   \
00139     (*(FUNC))((ARG1), (ARG2))
00140 
00141 #endif
00142 
00143 
00144 /* NPP_SetWindow */
00145 
00146 #if GENERATINGCFM
00147 
00148 typedef UniversalProcPtr NPP_SetWindowUPP;
00149 enum {
00150   uppNPP_SetWindowProcInfo = kThinkCStackBased
00151     | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
00152     | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPWindow *)))
00153     | RESULT_SIZE(SIZE_CODE(sizeof(NPError)))
00154 };
00155 #define NewNPP_SetWindowProc(FUNC)    \
00156     (NPP_SetWindowUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_SetWindowProcInfo, GetCurrentArchitecture())
00157 #define CallNPP_SetWindowProc(FUNC, ARG1, ARG2)   \
00158     (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_SetWindowProcInfo, (ARG1), (ARG2))
00159 
00160 #else
00161 
00162 typedef NPError (*NPP_SetWindowUPP)(NPP instance, NPWindow* window);
00163 #define NewNPP_SetWindowProc(FUNC)    \
00164     ((NPP_SetWindowUPP) (FUNC))
00165 #define CallNPP_SetWindowProc(FUNC, ARG1, ARG2)   \
00166     (*(FUNC))((ARG1), (ARG2))
00167 
00168 #endif
00169 
00170 
00171 /* NPP_NewStream */
00172 
00173 #if GENERATINGCFM
00174 
00175 typedef UniversalProcPtr NPP_NewStreamUPP;
00176 enum {
00177   uppNPP_NewStreamProcInfo = kThinkCStackBased
00178     | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
00179     | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPMIMEType)))
00180     | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(NPStream *)))
00181     | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(NPBool)))
00182     | STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(uint16 *)))
00183     | RESULT_SIZE(SIZE_CODE(sizeof(NPError)))
00184 };
00185 #define NewNPP_NewStreamProc(FUNC)    \
00186     (NPP_NewStreamUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_NewStreamProcInfo, GetCurrentArchitecture())
00187 #define CallNPP_NewStreamProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5)   \
00188     (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_NewStreamProcInfo, (ARG1), (ARG2), (ARG3), (ARG4), (ARG5))
00189 #else
00190 
00191 typedef NPError (*NPP_NewStreamUPP)(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16* stype);
00192 #define NewNPP_NewStreamProc(FUNC)    \
00193     ((NPP_NewStreamUPP) (FUNC))
00194 #define CallNPP_NewStreamProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5) \
00195     (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4), (ARG5))
00196 #endif
00197 
00198 
00199 /* NPP_DestroyStream */
00200 
00201 #if GENERATINGCFM
00202 
00203 typedef UniversalProcPtr NPP_DestroyStreamUPP;
00204 enum {
00205   uppNPP_DestroyStreamProcInfo = kThinkCStackBased
00206     | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
00207     | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPStream *)))
00208     | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(NPReason)))
00209     | RESULT_SIZE(SIZE_CODE(sizeof(NPError)))
00210 };
00211 #define NewNPP_DestroyStreamProc(FUNC)    \
00212     (NPP_DestroyStreamUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_DestroyStreamProcInfo, GetCurrentArchitecture())
00213 #define CallNPP_DestroyStreamProc(FUNC,  NPParg, NPStreamPtr, NPReasonArg)    \
00214     (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_DestroyStreamProcInfo, (NPParg), (NPStreamPtr), (NPReasonArg))
00215 
00216 #else
00217 
00218 typedef NPError (*NPP_DestroyStreamUPP)(NPP instance, NPStream* stream, NPReason reason);
00219 #define NewNPP_DestroyStreamProc(FUNC)    \
00220     ((NPP_DestroyStreamUPP) (FUNC))
00221 #define CallNPP_DestroyStreamProc(FUNC,  NPParg, NPStreamPtr, NPReasonArg)    \
00222     (*(FUNC))((NPParg), (NPStreamPtr), (NPReasonArg))
00223 
00224 #endif
00225 
00226 
00227 /* NPP_WriteReady */
00228 
00229 #if GENERATINGCFM
00230 
00231 typedef UniversalProcPtr NPP_WriteReadyUPP;
00232 enum {
00233   uppNPP_WriteReadyProcInfo = kThinkCStackBased
00234     | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
00235     | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPStream *)))
00236     | RESULT_SIZE(SIZE_CODE(sizeof(int32)))
00237 };
00238 #define NewNPP_WriteReadyProc(FUNC)   \
00239     (NPP_WriteReadyUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_WriteReadyProcInfo, GetCurrentArchitecture())
00240 #define CallNPP_WriteReadyProc(FUNC,  NPParg, NPStreamPtr)    \
00241     (int32)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_WriteReadyProcInfo, (NPParg), (NPStreamPtr))
00242 
00243 #else
00244 
00245 typedef int32 (*NPP_WriteReadyUPP)(NPP instance, NPStream* stream);
00246 #define NewNPP_WriteReadyProc(FUNC)   \
00247     ((NPP_WriteReadyUPP) (FUNC))
00248 #define CallNPP_WriteReadyProc(FUNC,  NPParg, NPStreamPtr)    \
00249     (*(FUNC))((NPParg), (NPStreamPtr))
00250 
00251 #endif
00252 
00253 
00254 /* NPP_Write */
00255 
00256 #if GENERATINGCFM
00257 
00258 typedef UniversalProcPtr NPP_WriteUPP;
00259 enum {
00260   uppNPP_WriteProcInfo = kThinkCStackBased
00261     | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
00262     | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPStream *)))
00263     | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(int32)))
00264     | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(int32)))
00265     | STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(void*)))
00266     | RESULT_SIZE(SIZE_CODE(sizeof(int32)))
00267 };
00268 #define NewNPP_WriteProc(FUNC)    \
00269     (NPP_WriteUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_WriteProcInfo, GetCurrentArchitecture())
00270 #define CallNPP_WriteProc(FUNC,  NPParg, NPStreamPtr, offsetArg, lenArg, bufferPtr)   \
00271     (int32)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_WriteProcInfo, (NPParg), (NPStreamPtr), (offsetArg), (lenArg), (bufferPtr))
00272 
00273 #else
00274 
00275 typedef int32 (*NPP_WriteUPP)(NPP instance, NPStream* stream, int32 offset, int32 len, void* buffer);
00276 #define NewNPP_WriteProc(FUNC)    \
00277     ((NPP_WriteUPP) (FUNC))
00278 #define CallNPP_WriteProc(FUNC,  NPParg, NPStreamPtr, offsetArg, lenArg, bufferPtr)   \
00279     (*(FUNC))((NPParg), (NPStreamPtr), (offsetArg), (lenArg), (bufferPtr))
00280 
00281 #endif
00282 
00283 
00284 /* NPP_StreamAsFile */
00285 
00286 #if GENERATINGCFM
00287 
00288 typedef UniversalProcPtr NPP_StreamAsFileUPP;
00289 enum {
00290   uppNPP_StreamAsFileProcInfo = kThinkCStackBased
00291     | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
00292     | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPStream *)))
00293     | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(const char *)))
00294     | RESULT_SIZE(SIZE_CODE(0))
00295 };
00296 #define NewNPP_StreamAsFileProc(FUNC)   \
00297     (NPP_StreamAsFileUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_StreamAsFileProcInfo, GetCurrentArchitecture())
00298 #define CallNPP_StreamAsFileProc(FUNC, ARG1, ARG2, ARG3)    \
00299     (void)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_StreamAsFileProcInfo, (ARG1), (ARG2), (ARG3))
00300 
00301 #else
00302 
00303 typedef void (*NPP_StreamAsFileUPP)(NPP instance, NPStream* stream, const char* fname);
00304 #define NewNPP_StreamAsFileProc(FUNC)   \
00305     ((NPP_StreamAsFileUPP) (FUNC))
00306 #define CallNPP_StreamAsFileProc(FUNC,  ARG1, ARG2, ARG3)   \
00307     (*(FUNC))((ARG1), (ARG2), (ARG3))
00308 #endif
00309 
00310 
00311 /* NPP_Print */
00312 
00313 #if GENERATINGCFM
00314 
00315 typedef UniversalProcPtr NPP_PrintUPP;
00316 enum {
00317   uppNPP_PrintProcInfo = kThinkCStackBased
00318     | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
00319     | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPPrint *)))
00320     | RESULT_SIZE(SIZE_CODE(0))
00321 };
00322 #define NewNPP_PrintProc(FUNC)    \
00323     (NPP_PrintUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_PrintProcInfo, GetCurrentArchitecture())
00324 #define CallNPP_PrintProc(FUNC,  NPParg, voidPtr)   \
00325     (void)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_PrintProcInfo, (NPParg), (voidPtr))
00326 
00327 #else
00328 
00329 typedef void (*NPP_PrintUPP)(NPP instance, NPPrint* platformPrint);
00330 #define NewNPP_PrintProc(FUNC)    \
00331     ((NPP_PrintUPP) (FUNC))
00332 #define CallNPP_PrintProc(FUNC,  NPParg, NPPrintArg)    \
00333     (*(FUNC))((NPParg), (NPPrintArg))
00334 
00335 #endif
00336 
00337 
00338 /* NPP_HandleEvent */
00339 
00340 #if GENERATINGCFM
00341 
00342 typedef UniversalProcPtr NPP_HandleEventUPP;
00343 enum {
00344   uppNPP_HandleEventProcInfo = kThinkCStackBased
00345     | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
00346     | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(void *)))
00347     | RESULT_SIZE(SIZE_CODE(sizeof(int16)))
00348 };
00349 #define NewNPP_HandleEventProc(FUNC)    \
00350     (NPP_HandleEventUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_HandleEventProcInfo, GetCurrentArchitecture())
00351 #define CallNPP_HandleEventProc(FUNC,  NPParg, voidPtr)   \
00352     (int16)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_HandleEventProcInfo, (NPParg), (voidPtr))
00353 
00354 #else
00355 
00356 typedef int16 (*NPP_HandleEventUPP)(NPP instance, void* event);
00357 #define NewNPP_HandleEventProc(FUNC)    \
00358     ((NPP_HandleEventUPP) (FUNC))
00359 #define CallNPP_HandleEventProc(FUNC,  NPParg, voidPtr)   \
00360     (*(FUNC))((NPParg), (voidPtr))
00361 
00362 #endif
00363 
00364 
00365 /* NPP_URLNotify */
00366 
00367 #if GENERATINGCFM
00368 
00369 typedef UniversalProcPtr NPP_URLNotifyUPP;
00370 enum {
00371   uppNPP_URLNotifyProcInfo = kThinkCStackBased
00372     | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
00373     | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(const char*)))
00374     | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(NPReason)))
00375     | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(void*)))
00376     | RESULT_SIZE(SIZE_CODE(SIZE_CODE(0)))
00377 };
00378 #define NewNPP_URLNotifyProc(FUNC)    \
00379     (NPP_URLNotifyUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_URLNotifyProcInfo, GetCurrentArchitecture())
00380 #define CallNPP_URLNotifyProc(FUNC,  ARG1, ARG2, ARG3, ARG4)    \
00381     (void)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_URLNotifyProcInfo, (ARG1), (ARG2), (ARG3), (ARG4))
00382 
00383 #else
00384 
00385 typedef void (*NPP_URLNotifyUPP)(NPP instance, const char* url, NPReason reason, void* notifyData);
00386 #define NewNPP_URLNotifyProc(FUNC)    \
00387     ((NPP_URLNotifyUPP) (FUNC))
00388 #define CallNPP_URLNotifyProc(FUNC,  ARG1, ARG2, ARG3, ARG4)    \
00389     (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4))
00390 
00391 #endif
00392 
00393 
00394 /* NPP_GetValue */
00395 
00396 #if GENERATINGCFM
00397 
00398 typedef UniversalProcPtr NPP_GetValueUPP;
00399 enum {
00400   uppNPP_GetValueProcInfo = kThinkCStackBased
00401     | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
00402     | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPPVariable)))
00403     | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(void *)))
00404     | RESULT_SIZE(SIZE_CODE(sizeof(NPError)))
00405 };
00406 #define NewNPP_GetValueProc(FUNC)   \
00407     (NPP_GetValueUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_GetValueProcInfo, GetCurrentArchitecture())
00408 #define CallNPP_GetValueProc(FUNC, ARG1, ARG2, ARG3) \
00409     (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_GetValueProcInfo, (ARG1), (ARG2), (ARG3))
00410 #else
00411 
00412 typedef NPError (*NPP_GetValueUPP)(NPP instance, NPPVariable variable, void *ret_alue);
00413 #define NewNPP_GetValueProc(FUNC)   \
00414     ((NPP_GetValueUPP) (FUNC))
00415 #define CallNPP_GetValueProc(FUNC, ARG1, ARG2, ARG3)    \
00416     (*(FUNC))((ARG1), (ARG2), (ARG3))
00417 #endif
00418 
00419 
00420 /* NPP_SetValue */
00421 
00422 #if GENERATINGCFM
00423 
00424 typedef UniversalProcPtr NPP_SetValueUPP;
00425 enum {
00426   uppNPP_SetValueProcInfo = kThinkCStackBased
00427     | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
00428     | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPNVariable)))
00429     | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(void *)))
00430     | RESULT_SIZE(SIZE_CODE(sizeof(NPError)))
00431 };
00432 #define NewNPP_SetValueProc(FUNC)   \
00433     (NPP_SetValueUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_SetValueProcInfo, GetCurrentArchitecture())
00434 #define CallNPP_SetValueProc(FUNC, ARG1, ARG2, ARG3) \
00435     (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPP_SetValueProcInfo, (ARG1), (ARG2), (ARG3))
00436 #else
00437 
00438 typedef NPError (*NPP_SetValueUPP)(NPP instance, NPNVariable variable, void *ret_alue);
00439 #define NewNPP_SetValueProc(FUNC)   \
00440     ((NPP_SetValueUPP) (FUNC))
00441 #define CallNPP_SetValueProc(FUNC, ARG1, ARG2, ARG3)    \
00442     (*(FUNC))((ARG1), (ARG2), (ARG3))
00443 #endif
00444 
00445 
00446 
00447 
00448 /*
00449  *  Netscape entry points
00450  */
00451 
00452 
00453 /* NPN_GetValue */
00454 
00455 #if GENERATINGCFM
00456 
00457 typedef UniversalProcPtr NPN_GetValueUPP;
00458 enum {
00459   uppNPN_GetValueProcInfo = kThinkCStackBased
00460     | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
00461     | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPNVariable)))
00462     | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(void *)))
00463     | RESULT_SIZE(SIZE_CODE(sizeof(NPError)))
00464 };
00465 #define NewNPN_GetValueProc(FUNC)   \
00466     (NPN_GetValueUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_GetValueProcInfo, GetCurrentArchitecture())
00467 #define CallNPN_GetValueProc(FUNC, ARG1, ARG2, ARG3) \
00468     (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_GetValueProcInfo, (ARG1), (ARG2), (ARG3))
00469 #else
00470 
00471 typedef NPError (*NPN_GetValueUPP)(NPP instance, NPNVariable variable, void *ret_alue);
00472 #define NewNPN_GetValueProc(FUNC)   \
00473     ((NPN_GetValueUPP) (FUNC))
00474 #define CallNPN_GetValueProc(FUNC, ARG1, ARG2, ARG3)    \
00475     (*(FUNC))((ARG1), (ARG2), (ARG3))
00476 #endif
00477 
00478 
00479 /* NPN_SetValue */
00480 
00481 #if GENERATINGCFM
00482 
00483 typedef UniversalProcPtr NPN_SetValueUPP;
00484 enum {
00485   uppNPN_SetValueProcInfo = kThinkCStackBased
00486     | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
00487     | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPPVariable)))
00488     | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(void *)))
00489     | RESULT_SIZE(SIZE_CODE(sizeof(NPError)))
00490 };
00491 #define NewNPN_SetValueProc(FUNC)   \
00492     (NPN_SetValueUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_SetValueProcInfo, GetCurrentArchitecture())
00493 #define CallNPN_SetValueProc(FUNC, ARG1, ARG2, ARG3) \
00494     (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_SetValueProcInfo, (ARG1), (ARG2), (ARG3))
00495 #else
00496 
00497 typedef NPError (*NPN_SetValueUPP)(NPP instance, NPPVariable variable, void *ret_alue);
00498 #define NewNPN_SetValueProc(FUNC)   \
00499     ((NPN_SetValueUPP) (FUNC))
00500 #define CallNPN_SetValueProc(FUNC, ARG1, ARG2, ARG3)    \
00501     (*(FUNC))((ARG1), (ARG2), (ARG3))
00502 #endif
00503 
00504 
00505 /* NPN_GetUrlNotify */
00506 
00507 #if GENERATINGCFM
00508 
00509 typedef UniversalProcPtr NPN_GetURLNotifyUPP;
00510 enum {
00511   uppNPN_GetURLNotifyProcInfo = kThinkCStackBased
00512     | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
00513     | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(const char*)))
00514     | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(const char*)))
00515     | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(void*)))
00516     | RESULT_SIZE(SIZE_CODE(sizeof(NPError)))
00517 };
00518 #define NewNPN_GetURLNotifyProc(FUNC)   \
00519     (NPN_GetURLNotifyUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_GetURLNotifyProcInfo, GetCurrentArchitecture())
00520 #define CallNPN_GetURLNotifyProc(FUNC, ARG1, ARG2, ARG3, ARG4) \
00521     (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_GetURLNotifyProcInfo, (ARG1), (ARG2), (ARG3), (ARG4))
00522 #else
00523 
00524 typedef NPError (*NPN_GetURLNotifyUPP)(NPP instance, const char* url, const char* window, void* notifyData);
00525 #define NewNPN_GetURLNotifyProc(FUNC)   \
00526     ((NPN_GetURLNotifyUPP) (FUNC))
00527 #define CallNPN_GetURLNotifyProc(FUNC, ARG1, ARG2, ARG3, ARG4)    \
00528     (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4))
00529 #endif
00530 
00531 
00532 /* NPN_PostUrlNotify */
00533 
00534 #if GENERATINGCFM
00535 
00536 typedef UniversalProcPtr NPN_PostURLNotifyUPP;
00537 enum {
00538   uppNPN_PostURLNotifyProcInfo = kThinkCStackBased
00539     | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
00540     | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(const char*)))
00541     | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(const char*)))
00542     | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(uint32)))
00543     | STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(const char*)))
00544     | STACK_ROUTINE_PARAMETER(6, SIZE_CODE(sizeof(NPBool)))
00545     | STACK_ROUTINE_PARAMETER(7, SIZE_CODE(sizeof(void*)))
00546     | RESULT_SIZE(SIZE_CODE(sizeof(NPError)))
00547 };
00548 #define NewNPN_PostURLNotifyProc(FUNC)    \
00549     (NPN_PostURLNotifyUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_PostURLNotifyProcInfo, GetCurrentArchitecture())
00550 #define CallNPN_PostURLNotifyProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6, ARG7) \
00551     (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_PostURLNotifyProcInfo, (ARG1), (ARG2), (ARG3), (ARG4), (ARG5), (ARG6), (ARG7))
00552 #else
00553 
00554 typedef NPError (*NPN_PostURLNotifyUPP)(NPP instance, const char* url, const char* window, uint32 len, const char* buf, NPBool file, void* notifyData);
00555 #define NewNPN_PostURLNotifyProc(FUNC)    \
00556     ((NPN_PostURLNotifyUPP) (FUNC))
00557 #define CallNPN_PostURLNotifyProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6, ARG7) \
00558     (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4), (ARG5), (ARG6), (ARG7))
00559 #endif
00560 
00561 
00562 /* NPN_GetUrl */
00563 
00564 #if GENERATINGCFM
00565 
00566 typedef UniversalProcPtr NPN_GetURLUPP;
00567 enum {
00568   uppNPN_GetURLProcInfo = kThinkCStackBased
00569     | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
00570     | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(const char*)))
00571     | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(const char*)))
00572     | RESULT_SIZE(SIZE_CODE(sizeof(NPError)))
00573 };
00574 #define NewNPN_GetURLProc(FUNC)   \
00575     (NPN_GetURLUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_GetURLProcInfo, GetCurrentArchitecture())
00576 #define CallNPN_GetURLProc(FUNC, ARG1, ARG2, ARG3) \
00577     (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_GetURLProcInfo, (ARG1), (ARG2), (ARG3))
00578 #else
00579 
00580 typedef NPError (*NPN_GetURLUPP)(NPP instance, const char* url, const char* window);
00581 #define NewNPN_GetURLProc(FUNC)   \
00582     ((NPN_GetURLUPP) (FUNC))
00583 #define CallNPN_GetURLProc(FUNC, ARG1, ARG2, ARG3)    \
00584     (*(FUNC))((ARG1), (ARG2), (ARG3))
00585 #endif
00586 
00587 
00588 /* NPN_PostUrl */
00589 
00590 #if GENERATINGCFM
00591 
00592 typedef UniversalProcPtr NPN_PostURLUPP;
00593 enum {
00594   uppNPN_PostURLProcInfo = kThinkCStackBased
00595     | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
00596     | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(const char*)))
00597     | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(const char*)))
00598     | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(uint32)))
00599     | STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(const char*)))
00600     | STACK_ROUTINE_PARAMETER(6, SIZE_CODE(sizeof(NPBool)))
00601     | RESULT_SIZE(SIZE_CODE(sizeof(NPError)))
00602 };
00603 #define NewNPN_PostURLProc(FUNC)    \
00604     (NPN_PostURLUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_PostURLProcInfo, GetCurrentArchitecture())
00605 #define CallNPN_PostURLProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6) \
00606     (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_PostURLProcInfo, (ARG1), (ARG2), (ARG3), (ARG4), (ARG5), (ARG6))
00607 #else
00608 
00609 typedef NPError (*NPN_PostURLUPP)(NPP instance, const char* url, const char* window, uint32 len, const char* buf, NPBool file);
00610 #define NewNPN_PostURLProc(FUNC)    \
00611     ((NPN_PostURLUPP) (FUNC))
00612 #define CallNPN_PostURLProc(FUNC, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6) \
00613     (*(FUNC))((ARG1), (ARG2), (ARG3), (ARG4), (ARG5), (ARG6))
00614 #endif
00615 
00616 
00617 /* NPN_RequestRead */
00618 
00619 #if GENERATINGCFM
00620 
00621 typedef UniversalProcPtr NPN_RequestReadUPP;
00622 enum {
00623   uppNPN_RequestReadProcInfo = kThinkCStackBased
00624     | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPStream *)))
00625     | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPByteRange *)))
00626     | RESULT_SIZE(SIZE_CODE(sizeof(NPError)))
00627 };
00628 #define NewNPN_RequestReadProc(FUNC)    \
00629     (NPN_RequestReadUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_RequestReadProcInfo, GetCurrentArchitecture())
00630 #define CallNPN_RequestReadProc(FUNC,  stream, range)   \
00631     (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_RequestReadProcInfo, (stream), (range))
00632 
00633 #else
00634 
00635 typedef NPError (*NPN_RequestReadUPP)(NPStream* stream, NPByteRange* rangeList);
00636 #define NewNPN_RequestReadProc(FUNC)    \
00637     ((NPN_RequestReadUPP) (FUNC))
00638 #define CallNPN_RequestReadProc(FUNC, stream, range)    \
00639     (*(FUNC))((stream), (range))
00640 
00641 #endif
00642 
00643 
00644 /* NPN_NewStream */
00645 
00646 #if GENERATINGCFM
00647 
00648 typedef UniversalProcPtr NPN_NewStreamUPP;
00649 enum {
00650   uppNPN_NewStreamProcInfo = kThinkCStackBased
00651     | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
00652     | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPMIMEType)))
00653     | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(const char *)))
00654     | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(NPStream **)))
00655     | RESULT_SIZE(SIZE_CODE(sizeof(NPError)))
00656 };
00657 #define NewNPN_NewStreamProc(FUNC)    \
00658     (NPN_NewStreamUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_NewStreamProcInfo, GetCurrentArchitecture())
00659 #define CallNPN_NewStreamProc(FUNC, npp, type, window, stream)    \
00660     (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_NewStreamProcInfo, (npp), (type), (window), (stream)) 
00661 
00662 #else
00663 
00664 typedef NPError (*NPN_NewStreamUPP)(NPP instance, NPMIMEType type, const char* window, NPStream** stream);
00665 #define NewNPN_NewStreamProc(FUNC)    \
00666     ((NPN_NewStreamUPP) (FUNC))
00667 #define CallNPN_NewStreamProc(FUNC, npp, type, window, stream)    \
00668     (*(FUNC))((npp), (type), (window), (stream))
00669 
00670 #endif
00671 
00672 
00673 /* NPN_Write */
00674 
00675 #if GENERATINGCFM
00676 
00677 typedef UniversalProcPtr NPN_WriteUPP;
00678 enum {
00679   uppNPN_WriteProcInfo = kThinkCStackBased
00680     | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
00681     | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPStream *)))
00682     | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(int32)))
00683     | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(void*)))
00684     | RESULT_SIZE(SIZE_CODE(sizeof(int32)))
00685 };
00686 #define NewNPN_WriteProc(FUNC)    \
00687     (NPN_WriteUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_WriteProcInfo, GetCurrentArchitecture())
00688 #define CallNPN_WriteProc(FUNC, npp, stream, len, buffer)   \
00689     (int32)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_WriteProcInfo, (npp), (stream), (len), (buffer))  
00690 
00691 #else
00692 
00693 typedef int32 (*NPN_WriteUPP)(NPP instance, NPStream* stream, int32 len, void* buffer);
00694 #define NewNPN_WriteProc(FUNC)    \
00695     ((NPN_WriteUPP) (FUNC))
00696 #define CallNPN_WriteProc(FUNC, npp, stream, len, buffer)   \
00697     (*(FUNC))((npp), (stream), (len), (buffer))
00698 
00699 #endif
00700 
00701 
00702 /* NPN_DestroyStream */
00703 
00704 #if GENERATINGCFM
00705 
00706 typedef UniversalProcPtr NPN_DestroyStreamUPP;
00707 enum {
00708   uppNPN_DestroyStreamProcInfo = kThinkCStackBased
00709     | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP )))
00710     | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPStream *)))
00711     | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(NPReason)))
00712     | RESULT_SIZE(SIZE_CODE(sizeof(NPError)))
00713 };
00714 #define NewNPN_DestroyStreamProc(FUNC)    \
00715     (NPN_DestroyStreamUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_DestroyStreamProcInfo, GetCurrentArchitecture())
00716 #define CallNPN_DestroyStreamProc(FUNC, npp, stream, reason)    \
00717     (NPError)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_DestroyStreamProcInfo, (npp), (stream), (reason)) 
00718 
00719 #else
00720 
00721 typedef NPError (*NPN_DestroyStreamUPP)(NPP instance, NPStream* stream, NPReason reason);
00722 #define NewNPN_DestroyStreamProc(FUNC)    \
00723     ((NPN_DestroyStreamUPP) (FUNC))
00724 #define CallNPN_DestroyStreamProc(FUNC, npp, stream, reason)    \
00725     (*(FUNC))((npp), (stream), (reason))
00726 
00727 #endif
00728 
00729 
00730 /* NPN_Status */
00731 
00732 #if GENERATINGCFM
00733 
00734 typedef UniversalProcPtr NPN_StatusUPP;
00735 enum {
00736   uppNPN_StatusProcInfo = kThinkCStackBased
00737     | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
00738     | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(char *)))
00739 };
00740 
00741 #define NewNPN_StatusProc(FUNC)   \
00742     (NPN_StatusUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_StatusProcInfo, GetCurrentArchitecture())
00743 #define CallNPN_StatusProc(FUNC, npp, msg)    \
00744     (void)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_StatusProcInfo, (npp), (msg))  
00745 
00746 #else
00747 
00748 typedef void (*NPN_StatusUPP)(NPP instance, const char* message);
00749 #define NewNPN_StatusProc(FUNC)   \
00750     ((NPN_StatusUPP) (FUNC))
00751 #define CallNPN_StatusProc(FUNC, npp, msg)    \
00752     (*(FUNC))((npp), (msg)) 
00753 
00754 #endif
00755 
00756 
00757 /* NPN_UserAgent */
00758 #if GENERATINGCFM
00759 
00760 typedef UniversalProcPtr NPN_UserAgentUPP;
00761 enum {
00762         uppNPN_UserAgentProcInfo = kThinkCStackBased
00763                 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
00764                 | RESULT_SIZE(SIZE_CODE(sizeof(const char *)))
00765 };
00766 
00767 #define NewNPN_UserAgentProc(FUNC)              \
00768                 (NPN_UserAgentUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_UserAgentProcInfo, GetCurrentArchitecture())
00769 #define CallNPN_UserAgentProc(FUNC, ARG1)               \
00770                 (const char*)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_UserAgentProcInfo, (ARG1))
00771 
00772 #else
00773 
00774 typedef const char* (*NPN_UserAgentUPP)(NPP instance);
00775 #define NewNPN_UserAgentProc(FUNC)              \
00776                 ((NPN_UserAgentUPP) (FUNC))
00777 #define CallNPN_UserAgentProc(FUNC, ARG1)               \
00778                 (*(FUNC))((ARG1))
00779 
00780 #endif
00781 
00782 
00783 /* NPN_MemAlloc */
00784 #if GENERATINGCFM
00785 
00786 typedef UniversalProcPtr NPN_MemAllocUPP;
00787 enum {
00788   uppNPN_MemAllocProcInfo = kThinkCStackBased
00789     | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(uint32)))
00790     | RESULT_SIZE(SIZE_CODE(sizeof(void *)))
00791 };
00792 
00793 #define NewNPN_MemAllocProc(FUNC)   \
00794     (NPN_MemAllocUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_MemAllocProcInfo, GetCurrentArchitecture())
00795 #define CallNPN_MemAllocProc(FUNC, ARG1)    \
00796     (void*)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_MemAllocProcInfo, (ARG1)) 
00797 
00798 #else
00799 
00800 typedef void* (*NPN_MemAllocUPP)(uint32 size);
00801 #define NewNPN_MemAllocProc(FUNC)   \
00802     ((NPN_MemAllocUPP) (FUNC))
00803 #define CallNPN_MemAllocProc(FUNC, ARG1)    \
00804     (*(FUNC))((ARG1)) 
00805 
00806 #endif
00807 
00808 
00809 /* NPN__MemFree */
00810 
00811 #if GENERATINGCFM
00812 
00813 typedef UniversalProcPtr NPN_MemFreeUPP;
00814 enum {
00815   uppNPN_MemFreeProcInfo = kThinkCStackBased
00816     | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(void *)))
00817 };
00818 
00819 #define NewNPN_MemFreeProc(FUNC)    \
00820     (NPN_MemFreeUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_MemFreeProcInfo, GetCurrentArchitecture())
00821 #define CallNPN_MemFreeProc(FUNC, ARG1)   \
00822     (void)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_MemFreeProcInfo, (ARG1))
00823 
00824 #else
00825 
00826 typedef void (*NPN_MemFreeUPP)(void* ptr);
00827 #define NewNPN_MemFreeProc(FUNC)    \
00828     ((NPN_MemFreeUPP) (FUNC))
00829 #define CallNPN_MemFreeProc(FUNC, ARG1)   \
00830     (*(FUNC))((ARG1)) 
00831 
00832 #endif
00833 
00834 
00835 /* NPN_MemFlush */
00836 
00837 #if GENERATINGCFM
00838 
00839 typedef UniversalProcPtr NPN_MemFlushUPP;
00840 enum {
00841   uppNPN_MemFlushProcInfo = kThinkCStackBased
00842     | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(uint32)))
00843     | RESULT_SIZE(SIZE_CODE(sizeof(uint32)))
00844 };
00845 
00846 #define NewNPN_MemFlushProc(FUNC)   \
00847     (NPN_MemFlushUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_MemFlushProcInfo, GetCurrentArchitecture())
00848 #define CallNPN_MemFlushProc(FUNC, ARG1)    \
00849     (uint32)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_MemFlushProcInfo, (ARG1))  
00850 
00851 #else
00852 
00853 typedef uint32 (*NPN_MemFlushUPP)(uint32 size);
00854 #define NewNPN_MemFlushProc(FUNC)   \
00855     ((NPN_MemFlushUPP) (FUNC))
00856 #define CallNPN_MemFlushProc(FUNC, ARG1)    \
00857     (*(FUNC))((ARG1)) 
00858 
00859 #endif
00860 
00861 
00862 
00863 /* NPN_ReloadPlugins */
00864 
00865 #if GENERATINGCFM
00866 
00867 typedef UniversalProcPtr NPN_ReloadPluginsUPP;
00868 enum {
00869   uppNPN_ReloadPluginsProcInfo = kThinkCStackBased
00870     | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPBool)))
00871     | RESULT_SIZE(SIZE_CODE(0))
00872 };
00873 
00874 #define NewNPN_ReloadPluginsProc(FUNC)    \
00875     (NPN_ReloadPluginsUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_ReloadPluginsProcInfo, GetCurrentArchitecture())
00876 #define CallNPN_ReloadPluginsProc(FUNC, ARG1)   \
00877     (void)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_ReloadPluginsProcInfo, (ARG1)) 
00878 
00879 #else
00880 
00881 typedef void (*NPN_ReloadPluginsUPP)(NPBool reloadPages);
00882 #define NewNPN_ReloadPluginsProc(FUNC)    \
00883     ((NPN_ReloadPluginsUPP) (FUNC))
00884 #define CallNPN_ReloadPluginsProc(FUNC, ARG1)   \
00885     (*(FUNC))((ARG1)) 
00886 
00887 #endif
00888 
00889 
00890 /* NPN_GetJavaEnv */
00891 
00892 #if GENERATINGCFM
00893 
00894 typedef UniversalProcPtr NPN_GetJavaEnvUPP;
00895 enum {
00896   uppNPN_GetJavaEnvProcInfo = kThinkCStackBased
00897     | RESULT_SIZE(SIZE_CODE(sizeof(JRIEnv*)))
00898 };
00899 
00900 #define NewNPN_GetJavaEnvProc(FUNC)   \
00901     (NPN_GetJavaEnvUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_GetJavaEnvProcInfo, GetCurrentArchitecture())
00902 #define CallNPN_GetJavaEnvProc(FUNC)    \
00903     (JRIEnv*)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_GetJavaEnvProcInfo) 
00904 
00905 #else
00906 
00907 typedef JRIEnv* (*NPN_GetJavaEnvUPP)(void);
00908 #define NewNPN_GetJavaEnvProc(FUNC)   \
00909     ((NPN_GetJavaEnvUPP) (FUNC))
00910 #define CallNPN_GetJavaEnvProc(FUNC)    \
00911     (*(FUNC))() 
00912 
00913 #endif
00914 
00915 
00916 /* NPN_GetJavaPeer */
00917 
00918 #if GENERATINGCFM
00919 
00920 typedef UniversalProcPtr NPN_GetJavaPeerUPP;
00921 enum {
00922   uppNPN_GetJavaPeerProcInfo = kThinkCStackBased
00923     | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
00924     | RESULT_SIZE(SIZE_CODE(sizeof(jref)))
00925 };
00926 
00927 #define NewNPN_GetJavaPeerProc(FUNC)    \
00928     (NPN_GetJavaPeerUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_GetJavaPeerProcInfo, GetCurrentArchitecture())
00929 #define CallNPN_GetJavaPeerProc(FUNC, ARG1)   \
00930     (jref)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_GetJavaPeerProcInfo, (ARG1)) 
00931 
00932 #else
00933 
00934 typedef jref (*NPN_GetJavaPeerUPP)(NPP instance);
00935 #define NewNPN_GetJavaPeerProc(FUNC)    \
00936     ((NPN_GetJavaPeerUPP) (FUNC))
00937 #define CallNPN_GetJavaPeerProc(FUNC, ARG1)   \
00938     (*(FUNC))((ARG1)) 
00939 
00940 #endif
00941 
00942 
00943 /* NPN_InvalidateRect */
00944 
00945 #if GENERATINGCFM
00946 
00947 typedef UniversalProcPtr NPN_InvalidateRectUPP;
00948 enum {
00949   uppNPN_InvalidateRectProcInfo = kThinkCStackBased
00950     | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
00951     | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPRect *)))
00952     | RESULT_SIZE(SIZE_CODE(0))
00953 };
00954 
00955 #define NewNPN_InvalidateRectProc(FUNC)   \
00956     (NPN_InvalidateRectUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_InvalidateRectProcInfo, GetCurrentArchitecture())
00957 #define CallNPN_InvalidateRectProc(FUNC, ARG1, ARG2)    \
00958     (void)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_InvalidateRectProcInfo, (ARG1), (ARG2))  
00959 
00960 #else
00961 
00962 typedef void (*NPN_InvalidateRectUPP)(NPP instance, NPRect *rect);
00963 #define NewNPN_InvalidateRectProc(FUNC)   \
00964     ((NPN_InvalidateRectUPP) (FUNC))
00965 #define CallNPN_InvalidateRectProc(FUNC, ARG1, ARG2)    \
00966     (*(FUNC))((ARG1), (ARG2)) 
00967 
00968 #endif
00969 
00970 
00971 /* NPN_InvalidateRegion */
00972 
00973 #if GENERATINGCFM
00974 
00975 typedef UniversalProcPtr NPN_InvalidateRegionUPP;
00976 enum {
00977   uppNPN_InvalidateRegionProcInfo = kThinkCStackBased
00978     | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
00979     | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPRegion)))
00980     | RESULT_SIZE(SIZE_CODE(0))
00981 };
00982 
00983 #define NewNPN_InvalidateRegionProc(FUNC)   \
00984     (NPN_InvalidateRegionUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_InvalidateRegionProcInfo, GetCurrentArchitecture())
00985 #define CallNPN_InvalidateRegionProc(FUNC, ARG1, ARG2)    \
00986     (void)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_InvalidateRegionProcInfo, (ARG1), (ARG2))  
00987 
00988 #else
00989 
00990 typedef void (*NPN_InvalidateRegionUPP)(NPP instance, NPRegion region);
00991 #define NewNPN_InvalidateRegionProc(FUNC)   \
00992     ((NPN_InvalidateRegionUPP) (FUNC))
00993 #define CallNPN_InvalidateRegionProc(FUNC, ARG1, ARG2)    \
00994     (*(FUNC))((ARG1), (ARG2)) 
00995 
00996 #endif
00997 
00998 /* NPN_ForceRedraw */
00999 
01000 #if GENERATINGCFM
01001 
01002 typedef UniversalProcPtr NPN_ForceRedrawUPP;
01003 enum {
01004   uppNPN_ForceRedrawProcInfo = kThinkCStackBased
01005     | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPP)))
01006     | RESULT_SIZE(SIZE_CODE(sizeof(0)))
01007 };
01008 
01009 #define NewNPN_ForceRedrawProc(FUNC)    \
01010     (NPN_ForceRedrawUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPN_ForceRedrawProcInfo, GetCurrentArchitecture())
01011 #define CallNPN_ForceRedrawProc(FUNC, ARG1)   \
01012     (jref)CallUniversalProc((UniversalProcPtr)(FUNC), uppNPN_ForceRedrawProcInfo, (ARG1)) 
01013 
01014 #else
01015 
01016 typedef void (*NPN_ForceRedrawUPP)(NPP instance);
01017 #define NewNPN_ForceRedrawProc(FUNC)    \
01018     ((NPN_ForceRedrawUPP) (FUNC))
01019 #define CallNPN_ForceRedrawProc(FUNC, ARG1)   \
01020     (*(FUNC))((ARG1)) 
01021 
01022 #endif
01023 
01024 
01025 /******************************************************************************************
01026  * The actual plugin function table definitions
01027  *******************************************************************************************/
01028 
01029 #ifdef XP_MAC
01030 #pragma align=mac68k
01031 #endif
01032 
01033 typedef struct _NPPluginFuncs {
01034     uint16 size;
01035     uint16 version;
01036     NPP_NewUPP newp;
01037     NPP_DestroyUPP destroy;
01038     NPP_SetWindowUPP setwindow;
01039     NPP_NewStreamUPP newstream;
01040     NPP_DestroyStreamUPP destroystream;
01041     NPP_StreamAsFileUPP asfile;
01042     NPP_WriteReadyUPP writeready;
01043     NPP_WriteUPP write;
01044     NPP_PrintUPP print;
01045     NPP_HandleEventUPP event;
01046     NPP_URLNotifyUPP urlnotify;
01047     JRIGlobalRef javaClass;
01048     NPP_GetValueUPP getvalue;
01049     NPP_SetValueUPP setvalue;
01050 } NPPluginFuncs;
01051 
01052 typedef struct _NPNetscapeFuncs {
01053     uint16 size;
01054     uint16 version;
01055     NPN_GetURLUPP geturl;
01056     NPN_PostURLUPP posturl;
01057     NPN_RequestReadUPP requestread;
01058     NPN_NewStreamUPP newstream;
01059     NPN_WriteUPP write;
01060     NPN_DestroyStreamUPP destroystream;
01061     NPN_StatusUPP status;
01062     NPN_UserAgentUPP uagent;
01063     NPN_MemAllocUPP memalloc;
01064     NPN_MemFreeUPP memfree;
01065     NPN_MemFlushUPP memflush;
01066     NPN_ReloadPluginsUPP reloadplugins;
01067     NPN_GetJavaEnvUPP getJavaEnv;
01068     NPN_GetJavaPeerUPP getJavaPeer;
01069     NPN_GetURLNotifyUPP geturlnotify;
01070     NPN_PostURLNotifyUPP posturlnotify;
01071     NPN_GetValueUPP getvalue;
01072     NPN_SetValueUPP setvalue;
01073     NPN_InvalidateRectUPP invalidaterect;
01074     NPN_InvalidateRegionUPP invalidateregion;
01075     NPN_ForceRedrawUPP forceredraw;
01076 } NPNetscapeFuncs;
01077 
01078 #ifdef XP_MAC
01079 #pragma align=reset
01080 #endif
01081 
01082 
01083 #ifdef XP_MAC
01084 /******************************************************************************************
01085  * Mac platform-specific plugin glue stuff
01086  *******************************************************************************************/
01087 
01088 /*
01089  * Main entry point of the plugin.
01090  * This routine will be called when the plugin is loaded. The function
01091  * tables are passed in and the plugin fills in the NPPluginFuncs table
01092  * and NPPShutdownUPP for Netscape's use.
01093  */
01094 
01095 #if GENERATINGCFM
01096 
01097 typedef UniversalProcPtr NPP_MainEntryUPP;
01098 enum {
01099   uppNPP_MainEntryProcInfo = kThinkCStackBased
01100     | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NPNetscapeFuncs*)))
01101     | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(NPPluginFuncs*)))
01102     | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(NPP_ShutdownUPP*)))
01103     | RESULT_SIZE(SIZE_CODE(sizeof(NPError)))
01104 };
01105 #define NewNPP_MainEntryProc(FUNC)    \
01106     (NPP_MainEntryUPP) NewRoutineDescriptor((ProcPtr)(FUNC), uppNPP_MainEntryProcInfo, GetCurrentArchitecture())
01107 #define CallNPP_MainEntryProc(FUNC,  netscapeFunc, pluginFunc, shutdownUPP)   \
01108     CallUniversalProc((UniversalProcPtr)(FUNC), (ProcInfoType)uppNPP_MainEntryProcInfo, (netscapeFunc), (pluginFunc), (shutdownUPP))
01109 
01110 #else
01111 
01112 typedef NPError (*NPP_MainEntryUPP)(NPNetscapeFuncs*, NPPluginFuncs*, NPP_ShutdownUPP*);
01113 #define NewNPP_MainEntryProc(FUNC)    \
01114     ((NPP_MainEntryUPP) (FUNC))
01115 #define CallNPP_MainEntryProc(FUNC,  netscapeFunc, pluginFunc, shutdownUPP)   \
01116     (*(FUNC))((netscapeFunc), (pluginFunc), (shutdownUPP))
01117 
01118 #endif
01119 #endif /* MAC */
01120 
01121 
01122 #ifdef _WINDOWS
01123 
01124 #ifdef __cplusplus
01125 extern "C" {
01126 #endif
01127 
01128 /* plugin meta member functions */
01129 
01130 NPError WINAPI NP_GetEntryPoints(NPPluginFuncs* pFuncs);
01131 
01132 NPError WINAPI NP_Initialize(NPNetscapeFuncs* pFuncs);
01133 
01134 NPError WINAPI NP_Shutdown();
01135 
01136 #ifdef __cplusplus
01137 }
01138 #endif
01139 
01140 #endif /* _WINDOWS */
01141 
01142 #ifdef XP_UNIX
01143 
01144 #ifdef __cplusplus
01145 extern "C" {
01146 #endif
01147 
01148 /* plugin meta member functions */
01149 
01150 char* NP_GetMIMEDescription(void);
01151 NPError NP_Initialize(NPNetscapeFuncs*, NPPluginFuncs*);
01152 NPError NP_Shutdown(void);
01153 
01154 #ifdef __cplusplus
01155 }
01156 #endif
01157 
01158 #endif /* XP_UNIX */
01159 
01160 #endif /* _NPUPP_H_ */