1 //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
5 //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
11 #include <CodeFragments.h>
13 #include <Resources.h>
14 #include <ToolUtils.h>
19 // A4Stuff.h contains the definition of EnterCodeResource and
20 // EnterCodeResource, used for setting up the code resource’s
21 // globals for 68K (analagous to the function SetCurrentA5
22 // defined by the toolbox).
24 // A4Stuff does not exist as of CW 7. Define them to nothing.
27 #if (defined(__MWERKS__) && (__MWERKS__ >= 0x2400)) || defined(__GNUC__)
28 #define EnterCodeResource()
29 #define ExitCodeResource()
37 // The Mixed Mode procInfos defined in npupp.h assume Think C-
38 // style calling conventions. These conventions are used by
39 // Metrowerks with the exception of pointer return types, which
40 // in Metrowerks 68K are returned in A0, instead of the standard
41 // D0. Thus, since NPN_MemAlloc and NPN_UserAgent return pointers,
42 // Mixed Mode will return the values to a 68K plugin in D0, but
43 // a 68K plugin compiled by Metrowerks will expect the result in
44 // A0. The following pragma forces Metrowerks to use D0 instead.
48 #pragma pointers_in_D0
56 #pragma pointers_in_A0
60 // The following fix for static initializers (which fixes a previous
61 // incompatibility with some parts of PowerPlant, was submitted by
68 extern void __InitCode__(void);
70 extern void __sinit(void);
71 #define __InitCode__ __sinit
73 extern void __destroy_global_chain(void);
80 // Define PLUGIN_TRACE to 1 to have the wrapper functions emit
81 // DebugStr messages whenever they are called.
83 //#define PLUGIN_TRACE 1
86 #define PLUGINDEBUGSTR(msg) ::DebugStr(msg)
88 #define PLUGINDEBUGSTR
94 // glue for mapping outgoing Macho function pointers to TVectors
102 TFPtoTVGlue setwindow;
103 TFPtoTVGlue newstream;
104 TFPtoTVGlue destroystream;
106 TFPtoTVGlue writeready;
110 TFPtoTVGlue urlnotify;
111 TFPtoTVGlue getvalue;
112 TFPtoTVGlue setvalue;
114 TFPtoTVGlue shutdown;
115 } gPluginFuncsGlueTable;
117 static inline void* SetupFPtoTVGlue(TFPtoTVGlue* functionGlue, void* fp)
119 functionGlue->glue[0] = fp;
120 functionGlue->glue[1] = 0;
124 #define PLUGIN_TO_HOST_GLUE(name, fp) (SetupFPtoTVGlue(&gPluginFuncsGlueTable.name, (void*)fp))
126 // glue for mapping netscape TVectors to Macho function pointers
134 TTVtoFPGlue requestread;
135 TTVtoFPGlue newstream;
137 TTVtoFPGlue destroystream;
140 TTVtoFPGlue memalloc;
142 TTVtoFPGlue memflush;
143 TTVtoFPGlue reloadplugins;
144 TTVtoFPGlue getJavaEnv;
145 TTVtoFPGlue getJavaPeer;
146 TTVtoFPGlue geturlnotify;
147 TTVtoFPGlue posturlnotify;
148 TTVtoFPGlue getvalue;
149 TTVtoFPGlue setvalue;
150 TTVtoFPGlue invalidaterect;
151 TTVtoFPGlue invalidateregion;
152 TTVtoFPGlue forceredraw;
153 } gNetscapeFuncsGlueTable;
155 static void* SetupTVtoFPGlue(TTVtoFPGlue* functionGlue, void* tvp)
157 static const TTVtoFPGlue glueTemplate = { 0x3D800000, 0x618C0000, 0x800C0000, 0x804C0004, 0x7C0903A6, 0x4E800420 };
159 memcpy(functionGlue, &glueTemplate, sizeof(TTVtoFPGlue));
160 functionGlue->glue[0] |= ((UInt32)tvp >> 16);
161 functionGlue->glue[1] |= ((UInt32)tvp & 0xFFFF);
162 ::MakeDataExecutable(functionGlue, sizeof(TTVtoFPGlue));
166 #define HOST_TO_PLUGIN_GLUE(name, fp) (SetupTVtoFPGlue(&gNetscapeFuncsGlueTable.name, (void*)fp))
170 #define PLUGIN_TO_HOST_GLUE(name, fp) (fp)
171 #define HOST_TO_PLUGIN_GLUE(name, fp) (fp)
173 #endif /* XP_MACOSX */
179 //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
183 //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
185 #if !TARGET_API_MAC_CARBON
186 QDGlobals* gQDPtr; // Pointer to Netscape’s QuickDraw globals
188 short gResFile; // Refnum of the plugin’s resource file
189 NPNetscapeFuncs gNetscapeFuncs; // Function table for procs in Netscape called by plugin
191 //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
193 // Wrapper functions for all calls from the plugin to Netscape.
194 // These functions let the plugin developer just call the APIs
195 // as documented and defined in npapi.h, without needing to know
196 // about the function table and call macros in npupp.h.
198 //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
201 void NPN_Version(int* plugin_major, int* plugin_minor, int* netscape_major, int* netscape_minor)
203 *plugin_major = NP_VERSION_MAJOR;
204 *plugin_minor = NP_VERSION_MINOR;
205 *netscape_major = gNetscapeFuncs.version >> 8; // Major version is in high byte
206 *netscape_minor = gNetscapeFuncs.version & 0xFF; // Minor version is in low byte
209 NPError NPN_GetURLNotify(NPP instance, const char* url, const char* window, void* notifyData)
211 int navMinorVers = gNetscapeFuncs.version & 0xFF;
214 if( navMinorVers >= NPVERS_HAS_NOTIFICATION )
216 err = CallNPN_GetURLNotifyProc(gNetscapeFuncs.geturlnotify, instance, url, window, notifyData);
220 err = NPERR_INCOMPATIBLE_VERSION_ERROR;
225 NPError NPN_GetURL(NPP instance, const char* url, const char* window)
227 return CallNPN_GetURLProc(gNetscapeFuncs.geturl, instance, url, window);
230 NPError NPN_PostURLNotify(NPP instance, const char* url, const char* window, uint32 len, const char* buf, NPBool file, void* notifyData)
232 int navMinorVers = gNetscapeFuncs.version & 0xFF;
235 if( navMinorVers >= NPVERS_HAS_NOTIFICATION )
237 err = CallNPN_PostURLNotifyProc(gNetscapeFuncs.posturlnotify, instance, url,
238 window, len, buf, file, notifyData);
242 err = NPERR_INCOMPATIBLE_VERSION_ERROR;
247 NPError NPN_PostURL(NPP instance, const char* url, const char* window, uint32 len, const char* buf, NPBool file)
249 return CallNPN_PostURLProc(gNetscapeFuncs.posturl, instance, url, window, len, buf, file);
252 NPError NPN_RequestRead(NPStream* stream, NPByteRange* rangeList)
254 return CallNPN_RequestReadProc(gNetscapeFuncs.requestread, stream, rangeList);
257 NPError NPN_NewStream(NPP instance, NPMIMEType type, const char* window, NPStream** stream)
259 int navMinorVers = gNetscapeFuncs.version & 0xFF;
262 if( navMinorVers >= NPVERS_HAS_STREAMOUTPUT )
264 err = CallNPN_NewStreamProc(gNetscapeFuncs.newstream, instance, type, window, stream);
268 err = NPERR_INCOMPATIBLE_VERSION_ERROR;
273 int32 NPN_Write(NPP instance, NPStream* stream, int32 len, void* buffer)
275 int navMinorVers = gNetscapeFuncs.version & 0xFF;
278 if( navMinorVers >= NPVERS_HAS_STREAMOUTPUT )
280 err = CallNPN_WriteProc(gNetscapeFuncs.write, instance, stream, len, buffer);
284 err = NPERR_INCOMPATIBLE_VERSION_ERROR;
289 NPError NPN_DestroyStream(NPP instance, NPStream* stream, NPError reason)
291 int navMinorVers = gNetscapeFuncs.version & 0xFF;
294 if( navMinorVers >= NPVERS_HAS_STREAMOUTPUT )
296 err = CallNPN_DestroyStreamProc(gNetscapeFuncs.destroystream, instance, stream, reason);
300 err = NPERR_INCOMPATIBLE_VERSION_ERROR;
305 void NPN_Status(NPP instance, const char* message)
307 CallNPN_StatusProc(gNetscapeFuncs.status, instance, message);
310 const char* NPN_UserAgent(NPP instance)
312 return CallNPN_UserAgentProc(gNetscapeFuncs.uagent, instance);
315 void* NPN_MemAlloc(uint32 size)
317 return CallNPN_MemAllocProc(gNetscapeFuncs.memalloc, size);
320 void NPN_MemFree(void* ptr)
322 CallNPN_MemFreeProc(gNetscapeFuncs.memfree, ptr);
325 uint32 NPN_MemFlush(uint32 size)
327 return CallNPN_MemFlushProc(gNetscapeFuncs.memflush, size);
330 void NPN_ReloadPlugins(NPBool reloadPages)
332 CallNPN_ReloadPluginsProc(gNetscapeFuncs.reloadplugins, reloadPages);
336 JRIEnv* NPN_GetJavaEnv(void)
338 return CallNPN_GetJavaEnvProc( gNetscapeFuncs.getJavaEnv );
341 jobject NPN_GetJavaPeer(NPP instance)
343 return CallNPN_GetJavaPeerProc( gNetscapeFuncs.getJavaPeer, instance );
347 NPError NPN_GetValue(NPP instance, NPNVariable variable, void *value)
349 return CallNPN_GetValueProc( gNetscapeFuncs.getvalue, instance, variable, value);
352 NPError NPN_SetValue(NPP instance, NPPVariable variable, void *value)
354 return CallNPN_SetValueProc( gNetscapeFuncs.setvalue, instance, variable, value);
357 void NPN_InvalidateRect(NPP instance, NPRect *rect)
359 CallNPN_InvalidateRectProc( gNetscapeFuncs.invalidaterect, instance, rect);
362 void NPN_InvalidateRegion(NPP instance, NPRegion region)
364 CallNPN_InvalidateRegionProc( gNetscapeFuncs.invalidateregion, instance, region);
367 void NPN_ForceRedraw(NPP instance)
369 CallNPN_ForceRedrawProc( gNetscapeFuncs.forceredraw, instance);
374 //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
376 // Wrapper functions for all calls from Netscape to the plugin.
377 // These functions let the plugin developer just create the APIs
378 // as documented and defined in npapi.h, without needing to
379 // install those functions in the function table or worry about
380 // setting up globals for 68K plugins.
382 //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
384 NPError Private_Initialize(void);
385 void Private_Shutdown(void);
386 NPError Private_New(NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, char* argn[], char* argv[], NPSavedData* saved);
387 NPError Private_Destroy(NPP instance, NPSavedData** save);
388 NPError Private_SetWindow(NPP instance, NPWindow* window);
389 NPError Private_GetValue( NPP instance, NPPVariable variable, void *value );
390 NPError Private_NewStream(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16* stype);
391 NPError Private_DestroyStream(NPP instance, NPStream* stream, NPError reason);
392 int32 Private_WriteReady(NPP instance, NPStream* stream);
393 int32 Private_Write(NPP instance, NPStream* stream, int32 offset, int32 len, void* buffer);
394 void Private_StreamAsFile(NPP instance, NPStream* stream, const char* fname);
395 void Private_Print(NPP instance, NPPrint* platformPrint);
396 int16 Private_HandleEvent(NPP instance, void* event);
397 void Private_URLNotify(NPP instance, const char* url, NPReason reason, void* notifyData);
398 jobject Private_GetJavaClass(void);
401 NPError Private_Initialize(void)
405 PLUGINDEBUGSTR("\pInitialize;g;");
406 err = NPP_Initialize();
411 void Private_Shutdown(void)
414 PLUGINDEBUGSTR("\pShutdown;g;");
418 __destroy_global_chain();
425 NPError Private_New(NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, char* argn[], char* argv[], NPSavedData* saved)
428 NPError ret = NPP_New(pluginType, instance, mode, argc, argn, argv, saved);
429 PLUGINDEBUGSTR("\pNew;g;");
434 NPError Private_Destroy(NPP instance, NPSavedData** save)
438 PLUGINDEBUGSTR("\pDestroy;g;");
439 err = NPP_Destroy(instance, save);
444 NPError Private_SetWindow(NPP instance, NPWindow* window)
448 PLUGINDEBUGSTR("\pSetWindow;g;");
449 err = NPP_SetWindow(instance, window);
454 NPError Private_GetValue( NPP instance, NPPVariable variable, void *value )
458 PLUGINDEBUGSTR("\pGetValue;g;");
459 err = NPP_GetValue( instance, variable, value);
464 NPError Private_NewStream(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16* stype)
468 PLUGINDEBUGSTR("\pNewStream;g;");
469 err = NPP_NewStream(instance, type, stream, seekable, stype);
474 int32 Private_WriteReady(NPP instance, NPStream* stream)
478 PLUGINDEBUGSTR("\pWriteReady;g;");
479 result = NPP_WriteReady(instance, stream);
484 int32 Private_Write(NPP instance, NPStream* stream, int32 offset, int32 len, void* buffer)
488 PLUGINDEBUGSTR("\pWrite;g;");
489 result = NPP_Write(instance, stream, offset, len, buffer);
494 void Private_StreamAsFile(NPP instance, NPStream* stream, const char* fname)
497 PLUGINDEBUGSTR("\pStreamAsFile;g;");
498 NPP_StreamAsFile(instance, stream, fname);
503 NPError Private_DestroyStream(NPP instance, NPStream* stream, NPError reason)
507 PLUGINDEBUGSTR("\pDestroyStream;g;");
508 err = NPP_DestroyStream(instance, stream, reason);
513 int16 Private_HandleEvent(NPP instance, void* event)
517 PLUGINDEBUGSTR("\pHandleEvent;g;");
518 result = NPP_HandleEvent(instance, event);
523 void Private_Print(NPP instance, NPPrint* platformPrint)
526 PLUGINDEBUGSTR("\pPrint;g;");
527 NPP_Print(instance, platformPrint);
531 void Private_URLNotify(NPP instance, const char* url, NPReason reason, void* notifyData)
534 PLUGINDEBUGSTR("\pURLNotify;g;");
535 NPP_URLNotify(instance, url, reason, notifyData);
540 jobject Private_GetJavaClass(void)
543 PLUGINDEBUGSTR("\pGetJavaClass;g;");
545 jobject clazz = NPP_GetJavaClass();
549 JRIEnv* env = NPN_GetJavaEnv();
550 return (jobject)JRI_NewGlobalRef(env, clazz);
559 #if !TARGET_API_MAC_CARBON
560 ProcessSerialNumber PSN;
563 ProcessInfoRec infoRec;
564 OSErr result = noErr;
565 CFragConnectionID connID;
570 // Memorize the plugin’s resource file
571 // refnum for later use.
573 gResFile = CurResFile();
575 #if !TARGET_API_MAC_CARBON
577 // Ask the system if CFM is available.
580 OSErr err = Gestalt(gestaltCFMAttr, &response);
581 Boolean hasCFM = BitTst(&response, 31-gestaltCFMPresent);
583 ProcessInfoRec infoRec;
587 // GetProcessInformation takes a process serial number and
588 // will give us back the name and FSSpec of the application.
589 // See the Process Manager in IM.
593 infoRec.processInfoLength = sizeof(ProcessInfoRec);
594 infoRec.processName = name;
595 infoRec.processAppSpec = &myFSSpec;
597 ProcessSerialNumber PSN;
598 PSN.highLongOfPSN = 0;
599 PSN.lowLongOfPSN = kCurrentProcess;
601 result = GetProcessInformation(&PSN, &infoRec);
603 PLUGINDEBUGSTR("\pFailed in GetProcessInformation");
607 // If no CFM installed, assume it must be a 68K app.
611 CFragConnectionID connID;
615 // Now that we know the app name and FSSpec, we can call GetDiskFragment
616 // to get a connID to use in a subsequent call to FindSymbol (it will also
617 // return the address of “main” in app, which we ignore). If GetDiskFragment
618 // returns an error, we assume the app must be 68K.
622 result = GetDiskFragment(infoRec.processAppSpec, 0L, 0L, infoRec.processName,
623 kLoadCFrag, &connID, (Ptr*)&mainAddr, errName);
629 // The app is a PPC code fragment, so call FindSymbol
630 // to get the exported “qd” symbol so we can access its
631 // QuickDraw globals.
633 CFragSymbolClass symClass;
634 result = FindSymbol(connID, "\pqd", (Ptr*)&gQDPtr, &symClass);
635 if (result != noErr) { // this fails if we are in NS 6
636 gQDPtr = &qd; // so we default to the standard QD globals
642 // The app is 68K, so use its A5 to compute the address
643 // of its QuickDraw globals.
645 gQDPtr = (QDGlobals*)(*((long*)SetCurrentA5()) - (sizeof(QDGlobals) - sizeof(GrafPtr)));
652 // gcc requires that main have an 'int' return type
653 int main(NPNetscapeFuncs* nsTable, NPPluginFuncs* pluginFuncs, NPP_ShutdownUPP* unloadUpp);
655 NPError main(NPNetscapeFuncs* nsTable, NPPluginFuncs* pluginFuncs, NPP_ShutdownUPP* unloadUpp);
658 #if !TARGET_API_MAC_CARBON
661 RoutineDescriptor mainRD = BUILD_ROUTINE_DESCRIPTOR(uppNPP_MainEntryProcInfo, main);
664 #endif /* !TARGET_API_MAC_CARBON */
667 DEFINE_API_C(int) main(NPNetscapeFuncs* nsTable, NPPluginFuncs* pluginFuncs, NPP_ShutdownUPP* unloadUpp)
669 DEFINE_API_C(NPError) main(NPNetscapeFuncs* nsTable, NPPluginFuncs* pluginFuncs, NPP_ShutdownUPP* unloadUpp)
673 PLUGINDEBUGSTR("\pmain");
679 NPError err = NPERR_NO_ERROR;
682 // Ensure that everything Netscape passed us is valid!
684 if ((nsTable == NULL) || (pluginFuncs == NULL) || (unloadUpp == NULL))
685 err = NPERR_INVALID_FUNCTABLE_ERROR;
688 // Check the “major” version passed in Netscape’s function table.
689 // We won’t load if the major version is newer than what we expect.
690 // Also check that the function tables passed in are big enough for
691 // all the functions we need (they could be bigger, if Netscape added
692 // new APIs, but that’s OK with us -- we’ll just ignore them).
694 if (err == NPERR_NO_ERROR)
696 if ((nsTable->version >> 8) > NP_VERSION_MAJOR) // Major version is in high byte
697 err = NPERR_INCOMPATIBLE_VERSION_ERROR;
701 if (err == NPERR_NO_ERROR)
704 // Copy all the fields of Netscape’s function table into our
705 // copy so we can call back into Netscape later. Note that
706 // we need to copy the fields one by one, rather than assigning
707 // the whole structure, because the Netscape function table
708 // could actually be bigger than what we expect.
711 int navMinorVers = nsTable->version & 0xFF;
713 gNetscapeFuncs.version = nsTable->version;
714 gNetscapeFuncs.size = nsTable->size;
715 gNetscapeFuncs.posturl = (NPN_PostURLUPP)HOST_TO_PLUGIN_GLUE(posturl, nsTable->posturl);
716 gNetscapeFuncs.geturl = (NPN_GetURLUPP)HOST_TO_PLUGIN_GLUE(geturl, nsTable->geturl);
717 gNetscapeFuncs.requestread = (NPN_RequestReadUPP)HOST_TO_PLUGIN_GLUE(requestread, nsTable->requestread);
718 gNetscapeFuncs.newstream = (NPN_NewStreamUPP)HOST_TO_PLUGIN_GLUE(newstream, nsTable->newstream);
719 gNetscapeFuncs.write = (NPN_WriteUPP)HOST_TO_PLUGIN_GLUE(write, nsTable->write);
720 gNetscapeFuncs.destroystream = (NPN_DestroyStreamUPP)HOST_TO_PLUGIN_GLUE(destroystream, nsTable->destroystream);
721 gNetscapeFuncs.status = (NPN_StatusUPP)HOST_TO_PLUGIN_GLUE(status, nsTable->status);
722 gNetscapeFuncs.uagent = (NPN_UserAgentUPP)HOST_TO_PLUGIN_GLUE(uagent, nsTable->uagent);
723 gNetscapeFuncs.memalloc = (NPN_MemAllocUPP)HOST_TO_PLUGIN_GLUE(memalloc, nsTable->memalloc);
724 gNetscapeFuncs.memfree = (NPN_MemFreeUPP)HOST_TO_PLUGIN_GLUE(memfree, nsTable->memfree);
725 gNetscapeFuncs.memflush = (NPN_MemFlushUPP)HOST_TO_PLUGIN_GLUE(memflush, nsTable->memflush);
726 gNetscapeFuncs.reloadplugins = (NPN_ReloadPluginsUPP)HOST_TO_PLUGIN_GLUE(reloadplugins, nsTable->reloadplugins);
727 if( navMinorVers >= NPVERS_HAS_LIVECONNECT )
729 gNetscapeFuncs.getJavaEnv = (NPN_GetJavaEnvUPP)HOST_TO_PLUGIN_GLUE(getJavaEnv, nsTable->getJavaEnv);
730 gNetscapeFuncs.getJavaPeer = (NPN_GetJavaPeerUPP)HOST_TO_PLUGIN_GLUE(getJavaPeer, nsTable->getJavaPeer);
732 if( navMinorVers >= NPVERS_HAS_NOTIFICATION )
734 gNetscapeFuncs.geturlnotify = (NPN_GetURLNotifyUPP)HOST_TO_PLUGIN_GLUE(geturlnotify, nsTable->geturlnotify);
735 gNetscapeFuncs.posturlnotify = (NPN_PostURLNotifyUPP)HOST_TO_PLUGIN_GLUE(posturlnotify, nsTable->posturlnotify);
737 gNetscapeFuncs.getvalue = (NPN_GetValueUPP)HOST_TO_PLUGIN_GLUE(getvalue, nsTable->getvalue);
738 gNetscapeFuncs.setvalue = (NPN_SetValueUPP)HOST_TO_PLUGIN_GLUE(setvalue, nsTable->setvalue);
739 gNetscapeFuncs.invalidaterect = (NPN_InvalidateRectUPP)HOST_TO_PLUGIN_GLUE(invalidaterect, nsTable->invalidaterect);
740 gNetscapeFuncs.invalidateregion = (NPN_InvalidateRegionUPP)HOST_TO_PLUGIN_GLUE(invalidateregion, nsTable->invalidateregion);
741 gNetscapeFuncs.forceredraw = (NPN_ForceRedrawUPP)HOST_TO_PLUGIN_GLUE(forceredraw, nsTable->forceredraw);
744 // Set up the plugin function table that Netscape will use to
745 // call us. Netscape needs to know about our version and size
746 // and have a UniversalProcPointer for every function we implement.
748 pluginFuncs->version = (NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR;
749 pluginFuncs->size = sizeof(NPPluginFuncs);
750 pluginFuncs->newp = NewNPP_NewProc(PLUGIN_TO_HOST_GLUE(newp, Private_New));
751 pluginFuncs->destroy = NewNPP_DestroyProc(PLUGIN_TO_HOST_GLUE(destroy, Private_Destroy));
752 pluginFuncs->setwindow = NewNPP_SetWindowProc(PLUGIN_TO_HOST_GLUE(setwindow, Private_SetWindow));
753 pluginFuncs->newstream = NewNPP_NewStreamProc(PLUGIN_TO_HOST_GLUE(newstream, Private_NewStream));
754 pluginFuncs->destroystream = NewNPP_DestroyStreamProc(PLUGIN_TO_HOST_GLUE(destroystream, Private_DestroyStream));
755 pluginFuncs->asfile = NewNPP_StreamAsFileProc(PLUGIN_TO_HOST_GLUE(asfile, Private_StreamAsFile));
756 pluginFuncs->writeready = NewNPP_WriteReadyProc(PLUGIN_TO_HOST_GLUE(writeready, Private_WriteReady));
757 pluginFuncs->write = NewNPP_WriteProc(PLUGIN_TO_HOST_GLUE(write, Private_Write));
758 pluginFuncs->print = NewNPP_PrintProc(PLUGIN_TO_HOST_GLUE(print, Private_Print));
759 pluginFuncs->event = NewNPP_HandleEventProc(PLUGIN_TO_HOST_GLUE(event, Private_HandleEvent));
760 pluginFuncs->getvalue = NewNPP_GetValueProc(PLUGIN_TO_HOST_GLUE(getvalue, Private_GetValue));
761 if( navMinorVers >= NPVERS_HAS_NOTIFICATION )
763 pluginFuncs->urlnotify = NewNPP_URLNotifyProc(PLUGIN_TO_HOST_GLUE(urlnotify, Private_URLNotify));
766 if( navMinorVers >= NPVERS_HAS_LIVECONNECT )
768 pluginFuncs->javaClass = (JRIGlobalRef) Private_GetJavaClass();
771 pluginFuncs->javaClass = NULL;
773 *unloadUpp = NewNPP_ShutdownProc(PLUGIN_TO_HOST_GLUE(shutdown, Private_Shutdown));
776 err = Private_Initialize();