]> git.sesse.net Git - vlc/blob - mozilla/support/npunix.c
Fix compilation on FC3 linux for mozilla plugin.
[vlc] / mozilla / support / npunix.c
1 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2  *
3  * The contents of this file are subject to the Mozilla Public
4  * License Version 1.1 (the "License"); you may not use this file
5  * except in compliance with the License. You may obtain a copy of
6  * the License at http://www.mozilla.org/MPL/
7  * 
8  * Software distributed under the License is distributed on an "AS
9  * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
10  * implied. See the License for the specific language governing
11  * rights and limitations under the License.
12  * 
13  * The Original Code is mozilla.org code.
14  *
15  * The Initial Developer of the Original Code is Netscape
16  * Communications Corporation.  Portions created by Netscape are
17  * Copyright (C) 1998 Netscape Communications Corporation. All
18  * Rights Reserved.
19  *
20  * Contributor(s): 
21  * Stephen Mak <smak@sun.com>
22  */
23
24 /*
25  * npunix.c
26  *
27  * Netscape Client Plugin API
28  * - Wrapper function to interface with the Netscape Navigator
29  *
30  * dp Suresh <dp@netscape.com>
31  *
32  *----------------------------------------------------------------------
33  * PLUGIN DEVELOPERS:
34  *  YOU WILL NOT NEED TO EDIT THIS FILE.
35  * TO NETSCAPE DEVELOPERS:
36  *  OF COURSE I WILL NEED TO EDIT THIS FILE, YOU BORKED IT ALL AROUND YOU
37  *  IGNORANT FOOLS -- sam
38  *----------------------------------------------------------------------
39  */
40
41 #define XP_UNIX 1
42 #define OJI 1
43
44 #include <stdio.h>
45 #include <nscore.h>
46 #include <npapi.h>
47 #include <npupp.h>
48
49 /*
50  * Define PLUGIN_TRACE to have the wrapper functions print
51  * messages to stderr whenever they are called.
52  */
53
54 #ifdef PLUGIN_TRACE
55 #include <stdio.h>
56 #define PLUGINDEBUGSTR(msg) fprintf(stderr, "%s\n", msg)
57 #else
58 #define PLUGINDEBUGSTR(msg)
59 #endif
60
61 #define PLUGIN_TO_HOST_GLUE(name, fp) (fp)
62 #define HOST_TO_PLUGIN_GLUE(name, fp) (fp)
63
64 /***********************************************************************
65  *
66  * Globals
67  *
68  ***********************************************************************/
69
70 static NPNetscapeFuncs   gNetscapeFuncs;    /* Netscape Function table */
71
72
73 /***********************************************************************
74  *
75  * Wrapper functions : plugin calling Netscape Navigator
76  *
77  * These functions let the plugin developer just call the APIs
78  * as documented and defined in npapi.h, without needing to know
79  * about the function table and call macros in npupp.h.
80  *
81  ***********************************************************************/
82
83 void
84 NPN_Version(int* plugin_major, int* plugin_minor,
85          int* netscape_major, int* netscape_minor)
86 {
87     *plugin_major = NP_VERSION_MAJOR;
88     *plugin_minor = NP_VERSION_MINOR;
89
90     /* Major version is in high byte */
91     *netscape_major = gNetscapeFuncs.version >> 8;
92     /* Minor version is in low byte */
93     *netscape_minor = gNetscapeFuncs.version & 0xFF;
94 }
95
96 NPError
97 NPN_GetValue(NPP instance, NPNVariable variable, void *r_value)
98 {
99     return CallNPN_GetValueProc(gNetscapeFuncs.getvalue,
100                     instance, variable, r_value);
101 }
102
103 NPError
104 NPN_SetValue(NPP instance, NPPVariable variable, void *value)
105 {
106     return CallNPN_SetValueProc(gNetscapeFuncs.setvalue,
107                     instance, variable, value);
108 }
109
110 NPError
111 NPN_GetURL(NPP instance, const char* url, const char* window)
112 {
113     return CallNPN_GetURLProc(gNetscapeFuncs.geturl, instance, url, window);
114 }
115
116 NPError
117 NPN_GetURLNotify(NPP instance, const char* url, const char* window, void* notifyData)
118 {
119     return CallNPN_GetURLNotifyProc(gNetscapeFuncs.geturlnotify, instance, url, window, notifyData);
120 }
121
122 NPError
123 NPN_PostURL(NPP instance, const char* url, const char* window,
124          uint32 len, const char* buf, NPBool file)
125 {
126     return CallNPN_PostURLProc(gNetscapeFuncs.posturl, instance,
127                     url, window, len, buf, file);
128 }
129
130 NPError
131 NPN_PostURLNotify(NPP instance, const char* url, const char* window, uint32 len,
132                   const char* buf, NPBool file, void* notifyData)
133 {
134     return CallNPN_PostURLNotifyProc(gNetscapeFuncs.posturlnotify,
135             instance, url, window, len, buf, file, notifyData);
136 }
137
138 NPError
139 NPN_RequestRead(NPStream* stream, NPByteRange* rangeList)
140 {
141     return CallNPN_RequestReadProc(gNetscapeFuncs.requestread,
142                     stream, rangeList);
143 }
144
145 NPError
146 NPN_NewStream(NPP instance, NPMIMEType type, const char *window,
147           NPStream** stream_ptr)
148 {
149     return CallNPN_NewStreamProc(gNetscapeFuncs.newstream, instance,
150                     type, window, stream_ptr);
151 }
152
153 int32
154 NPN_Write(NPP instance, NPStream* stream, int32 len, void* buffer)
155 {
156     return CallNPN_WriteProc(gNetscapeFuncs.write, instance,
157                     stream, len, buffer);
158 }
159
160 NPError
161 NPN_DestroyStream(NPP instance, NPStream* stream, NPError reason)
162 {
163     return CallNPN_DestroyStreamProc(gNetscapeFuncs.destroystream,
164                         instance, stream, reason);
165 }
166
167 void
168 NPN_Status(NPP instance, const char* message)
169 {
170     CallNPN_StatusProc(gNetscapeFuncs.status, instance, message);
171 }
172
173 const char*
174 NPN_UserAgent(NPP instance)
175 {
176     return CallNPN_UserAgentProc(gNetscapeFuncs.uagent, instance);
177 }
178
179 void*
180 NPN_MemAlloc(uint32 size)
181 {
182     return CallNPN_MemAllocProc(gNetscapeFuncs.memalloc, size);
183 }
184
185 void NPN_MemFree(void* ptr)
186 {
187     CallNPN_MemFreeProc(gNetscapeFuncs.memfree, ptr);
188 }
189
190 uint32 NPN_MemFlush(uint32 size)
191 {
192     return CallNPN_MemFlushProc(gNetscapeFuncs.memflush, size);
193 }
194
195 void NPN_ReloadPlugins(NPBool reloadPages)
196 {
197     CallNPN_ReloadPluginsProc(gNetscapeFuncs.reloadplugins, reloadPages);
198 }
199
200 JRIEnv* NPN_GetJavaEnv()
201 {
202     return CallNPN_GetJavaEnvProc(gNetscapeFuncs.getJavaEnv);
203 }
204
205 jref NPN_GetJavaPeer(NPP instance)
206 {
207     return CallNPN_GetJavaPeerProc(gNetscapeFuncs.getJavaPeer,
208                        instance);
209 }
210
211 void
212 NPN_InvalidateRect(NPP instance, NPRect *invalidRect)
213 {
214     CallNPN_InvalidateRectProc(gNetscapeFuncs.invalidaterect, instance,
215         invalidRect);
216 }
217
218 void
219 NPN_InvalidateRegion(NPP instance, NPRegion invalidRegion)
220 {
221     CallNPN_InvalidateRegionProc(gNetscapeFuncs.invalidateregion, instance,
222         invalidRegion);
223 }
224
225 void
226 NPN_ForceRedraw(NPP instance)
227 {
228     CallNPN_ForceRedrawProc(gNetscapeFuncs.forceredraw, instance);
229 }
230
231 NPIdentifier NPN_GetStringIdentifier(const NPUTF8 *name)
232 {
233     int navMinorVers = gNetscapeFuncs.version & 0xFF;
234     if( navMinorVers >= 14 )
235     {   
236         return CallNPN_GetStringIdentifierProc( gNetscapeFuncs.getstringidentifier, name);
237     }
238     return NULL;
239 }
240
241 void NPN_GetStringIdentifiers(const NPUTF8 **names, int32_t nameCount, NPIdentifier *identifiers)
242 {
243     int navMinorVers = gNetscapeFuncs.version & 0xFF;
244     if( navMinorVers >= 14 )
245     {   
246         CallNPN_GetStringIdentifiersProc( gNetscapeFuncs.getstringidentifiers, names, nameCount, identifiers);
247     }
248 }
249
250 NPIdentifier NPN_GetIntIdentifier(int32_t intid)
251 {
252     int navMinorVers = gNetscapeFuncs.version & 0xFF;
253     if( navMinorVers >= 14 )
254     {   
255         return CallNPN_GetIntIdentifierProc( gNetscapeFuncs.getintidentifier, intid);
256     }
257     return NULL;
258 }
259
260 bool NPN_IdentifierIsString(NPIdentifier identifier)
261 {
262     int navMinorVers = gNetscapeFuncs.version & 0xFF;
263     if( navMinorVers >= 14 )
264     {   
265         return CallNPN_IdentifierIsStringProc( gNetscapeFuncs.identifierisstring, identifier);
266     }
267     return false;
268 }
269
270 NPUTF8 *NPN_UTF8FromIdentifier(NPIdentifier identifier)
271 {
272     int navMinorVers = gNetscapeFuncs.version & 0xFF;
273     if( navMinorVers >= 14 )
274     {   
275         return CallNPN_UTF8FromIdentifierProc( gNetscapeFuncs.utf8fromidentifier, identifier);
276     }
277     return NULL;
278 }
279
280 int32_t NPN_IntFromIdentifier(NPIdentifier identifier)
281 {
282     int navMinorVers = gNetscapeFuncs.version & 0xFF;
283     if( navMinorVers >= 14 )
284     {   
285         return CallNPN_IntFromIdentifierProc( gNetscapeFuncs.intfromidentifier, identifier);
286     }
287     return 0;
288 }
289
290 NPObject *NPN_CreateObject(NPP instance, NPClass *aClass)
291 {
292     int navMinorVers = gNetscapeFuncs.version & 0xFF;
293     if( navMinorVers >= 14 )
294     {   
295         return CallNPN_CreateObjectProc( gNetscapeFuncs.createobject, instance, aClass);
296     }
297     return NULL;
298 }
299
300 NPObject *NPN_RetainObject(NPObject *npobj)
301 {
302     int navMinorVers = gNetscapeFuncs.version & 0xFF;
303     if( navMinorVers >= 14 )
304     {   
305         return CallNPN_RetainObjectProc( gNetscapeFuncs.retainobject, npobj);
306     }
307     return NULL;
308 }
309
310 void NPN_ReleaseObject(NPObject *npobj)
311 {
312     int navMinorVers = gNetscapeFuncs.version & 0xFF;
313     if( navMinorVers >= 14 )
314     {   
315         CallNPN_ReleaseObjectProc( gNetscapeFuncs.releaseobject, npobj);
316     }
317 }
318
319 bool NPN_Invoke(NPP instance, NPObject *npobj, NPIdentifier methodName, const NPVariant *args, uint32_t argCount, NPVariant *result)
320 {
321     int navMinorVers = gNetscapeFuncs.version & 0xFF;
322     if( navMinorVers >= 14 )
323     {   
324         return CallNPN_InvokeProc( gNetscapeFuncs.invoke, instance, npobj, methodName, args, argCount, result);
325     }
326     return false;
327 }
328
329 bool NPN_InvokeDefault(NPP instance, NPObject *npobj, const NPVariant *args, uint32_t argCount, NPVariant *result)
330 {
331     int navMinorVers = gNetscapeFuncs.version & 0xFF;
332     if( navMinorVers >= 14 )
333     {   
334         return CallNPN_InvokeDefaultProc( gNetscapeFuncs.invokeDefault, instance, npobj, args, argCount, result);
335     }
336     return false;
337 }
338
339 bool NPN_Evaluate(NPP instance, NPObject *npobj, NPString *script, NPVariant *result)
340 {
341     int navMinorVers = gNetscapeFuncs.version & 0xFF;
342     if( navMinorVers >= 14 )
343     {   
344         return CallNPN_EvaluateProc( gNetscapeFuncs.evaluate, instance, npobj, script, result);
345     }
346     return false;
347 }
348
349 bool NPN_GetProperty(NPP instance, NPObject *npobj, NPIdentifier propertyName, NPVariant *result)
350 {
351     int navMinorVers = gNetscapeFuncs.version & 0xFF;
352     if( navMinorVers >= 14 )
353     {   
354         return CallNPN_GetPropertyProc( gNetscapeFuncs.getproperty, instance, npobj, propertyName, result);
355     }
356     return false;
357 }
358
359 bool NPN_SetProperty(NPP instance, NPObject *npobj, NPIdentifier propertyName, const NPVariant *value)
360 {
361     int navMinorVers = gNetscapeFuncs.version & 0xFF;
362     if( navMinorVers >= 14 )
363     {   
364         return CallNPN_SetPropertyProc( gNetscapeFuncs.setproperty, instance, npobj, propertyName, value);
365     }
366     return false;
367 }
368
369 bool NPN_RemoveProperty(NPP instance, NPObject *npobj, NPIdentifier propertyName)
370 {
371     int navMinorVers = gNetscapeFuncs.version & 0xFF;
372     if( navMinorVers >= 14 )
373     {   
374         return CallNPN_RemovePropertyProc( gNetscapeFuncs.removeproperty, instance, npobj, propertyName);
375     }
376     return false;
377 }
378
379 bool NPN_HasProperty(NPP instance, NPObject *npobj, NPIdentifier propertyName)
380 {
381     int navMinorVers = gNetscapeFuncs.version & 0xFF;
382     if( navMinorVers >= 14 )
383     {   
384         return CallNPN_HasPropertyProc( gNetscapeFuncs.hasproperty, instance, npobj, propertyName);
385     }
386     return false;
387 }
388
389 bool NPN_HasMethod(NPP instance, NPObject *npobj, NPIdentifier methodName)
390 {
391     int navMinorVers = gNetscapeFuncs.version & 0xFF;
392     if( navMinorVers >= 14 )
393     {   
394         return CallNPN_HasMethodProc( gNetscapeFuncs.hasmethod, instance, npobj, methodName);
395     }
396     return false;
397 }
398
399 void NPN_ReleaseVariantValue(NPVariant *variant)
400 {
401     int navMinorVers = gNetscapeFuncs.version & 0xFF;
402     if( navMinorVers >= 14 )
403     {   
404         CallNPN_ReleaseVariantValueProc( gNetscapeFuncs.releasevariantvalue, variant);
405     }
406 }
407
408 void NPN_SetException(NPObject *npobj, const NPUTF8 *message)
409 {
410     int navMinorVers = gNetscapeFuncs.version & 0xFF;
411     if( navMinorVers >= 14 )
412     {   
413         CallNPN_SetExceptionProc( gNetscapeFuncs.setexception, npobj, message);
414     }
415 }
416
417
418 /***********************************************************************
419  *
420  * Wrapper functions : Netscape Navigator -> plugin
421  *
422  * These functions let the plugin developer just create the APIs
423  * as documented and defined in npapi.h, without needing to 
424  * install those functions in the function table or worry about
425  * setting up globals for 68K plugins.
426  *
427  ***********************************************************************/
428
429 NPError
430 Private_New(NPMIMEType pluginType, NPP instance, uint16 mode,
431         int16 argc, char* argn[], char* argv[], NPSavedData* saved)
432 {
433     NPError ret;
434     PLUGINDEBUGSTR("New");
435     ret = NPP_New(pluginType, instance, mode, argc, argn, argv, saved);
436     return ret; 
437 }
438
439 NPError
440 Private_Destroy(NPP instance, NPSavedData** save)
441 {
442     PLUGINDEBUGSTR("Destroy");
443     return NPP_Destroy(instance, save);
444 }
445
446 NPError
447 Private_SetWindow(NPP instance, NPWindow* window)
448 {
449     NPError err;
450     PLUGINDEBUGSTR("SetWindow");
451     err = NPP_SetWindow(instance, window);
452     return err;
453 }
454
455 NPError
456 Private_NewStream(NPP instance, NPMIMEType type, NPStream* stream,
457             NPBool seekable, uint16* stype)
458 {
459     NPError err;
460     PLUGINDEBUGSTR("NewStream");
461     err = NPP_NewStream(instance, type, stream, seekable, stype);
462     return err;
463 }
464
465 int32
466 Private_WriteReady(NPP instance, NPStream* stream)
467 {
468     unsigned int result;
469     PLUGINDEBUGSTR("WriteReady");
470     result = NPP_WriteReady(instance, stream);
471     return result;
472 }
473
474 int32
475 Private_Write(NPP instance, NPStream* stream, int32 offset, int32 len,
476         void* buffer)
477 {
478     unsigned int result;
479     PLUGINDEBUGSTR("Write");
480     result = NPP_Write(instance, stream, offset, len, buffer);
481     return result;
482 }
483
484 void
485 Private_StreamAsFile(NPP instance, NPStream* stream, const char* fname)
486 {
487     PLUGINDEBUGSTR("StreamAsFile");
488     NPP_StreamAsFile(instance, stream, fname);
489 }
490
491
492 NPError
493 Private_DestroyStream(NPP instance, NPStream* stream, NPError reason)
494 {
495     NPError err;
496     PLUGINDEBUGSTR("DestroyStream");
497     err = NPP_DestroyStream(instance, stream, reason);
498     return err;
499 }
500
501 void
502 Private_URLNotify(NPP instance, const char* url,
503                 NPReason reason, void* notifyData)
504                 
505 {
506     PLUGINDEBUGSTR("URLNotify");
507     NPP_URLNotify(instance, url, reason, notifyData);
508 }
509
510
511
512 void
513 Private_Print(NPP instance, NPPrint* platformPrint)
514 {
515     PLUGINDEBUGSTR("Print");
516     NPP_Print(instance, platformPrint);
517 }
518
519 NPError
520 Private_GetValue(NPP instance, NPPVariable variable, void *r_value)
521 {
522     PLUGINDEBUGSTR("GetValue");
523 return NPP_GetValue(instance, variable, r_value);
524 }
525
526 NPError
527 Private_SetValue(NPP instance, NPPVariable variable, void *r_value)
528 {
529     PLUGINDEBUGSTR("SetValue");
530     return NPERR_NO_ERROR; //NPP_SetValue(instance, variable, r_value);
531 }
532
533 JRIGlobalRef
534 Private_GetJavaClass(void)
535 {
536     jref clazz = NPP_GetJavaClass();
537     if (clazz) {
538     JRIEnv* env = NPN_GetJavaEnv();
539     return JRI_NewGlobalRef(env, clazz);
540     }
541     return NULL;
542 }
543
544 /*********************************************************************** 
545  *
546  * These functions are located automagically by netscape.
547  *
548  ***********************************************************************/
549
550 /*
551  * NP_GetMIMEDescription
552  *  - Netscape needs to know about this symbol
553  *  - Netscape uses the return value to identify when an object instance
554  *    of this plugin should be created.
555  */
556 char *
557 NP_GetMIMEDescription(void)
558 {
559     return NPP_GetMIMEDescription();
560 }
561
562 /*
563  * NP_GetValue [optional]
564  *  - Netscape needs to know about this symbol.
565  *  - Interfaces with plugin to get values for predefined variables
566  *    that the navigator needs.
567  */
568 NPError
569 NP_GetValue(void *future, NPPVariable variable, void *value)
570 {
571     return NPP_GetValue(future, variable, value);
572 }
573
574 /*
575  * NP_Initialize
576  *  - Netscape needs to know about this symbol.
577  *  - It calls this function after looking up its symbol before it
578  *    is about to create the first ever object of this kind.
579  *
580  * PARAMETERS
581  *    nsTable   - The netscape function table. If developers just use these
582  *        wrappers, they dont need to worry about all these function
583  *        tables.
584  * RETURN
585  *    pluginFuncs
586  *      - This functions needs to fill the plugin function table
587  *        pluginFuncs and return it. Netscape Navigator plugin
588  *        library will use this function table to call the plugin.
589  *
590  */
591 NPError
592 NP_Initialize(NPNetscapeFuncs* nsTable, NPPluginFuncs* pluginFuncs)
593 {
594     NPError err = NPERR_NO_ERROR;
595
596     PLUGINDEBUGSTR("NP_Initialize");
597     
598     /* validate input parameters */
599
600     if ((nsTable == NULL) || (pluginFuncs == NULL))
601         err = NPERR_INVALID_FUNCTABLE_ERROR;
602     
603     /*
604      * Check the major version passed in Netscape's function table.
605      * We won't load if the major version is newer than what we expect.
606      * Also check that the function tables passed in are big enough for
607      * all the functions we need (they could be bigger, if Netscape added
608      * new APIs, but that's OK with us -- we'll just ignore them).
609      *
610      */
611
612     if (err == NPERR_NO_ERROR) {
613         if ((nsTable->version >> 8) > NP_VERSION_MAJOR)
614             err = NPERR_INCOMPATIBLE_VERSION_ERROR;
615         if (nsTable->size < sizeof(NPNetscapeFuncs))
616             err = NPERR_INVALID_FUNCTABLE_ERROR;
617         if (pluginFuncs->size < sizeof(NPPluginFuncs))      
618             err = NPERR_INVALID_FUNCTABLE_ERROR;
619     }
620     
621     if (err == NPERR_NO_ERROR) {
622         /*
623          * Copy all the fields of Netscape function table into our
624          * copy so we can call back into Netscape later.  Note that
625          * we need to copy the fields one by one, rather than assigning
626          * the whole structure, because the Netscape function table
627          * could actually be bigger than what we expect.
628          */
629         int navMinorVers = nsTable->version & 0xFF;
630
631         gNetscapeFuncs.version       = nsTable->version;
632         gNetscapeFuncs.size          = nsTable->size;
633         gNetscapeFuncs.posturl       = nsTable->posturl;
634         gNetscapeFuncs.geturl        = nsTable->geturl;
635         gNetscapeFuncs.requestread   = nsTable->requestread;
636         gNetscapeFuncs.newstream     = nsTable->newstream;
637         gNetscapeFuncs.write         = nsTable->write;
638         gNetscapeFuncs.destroystream = nsTable->destroystream;
639         gNetscapeFuncs.status        = nsTable->status;
640         gNetscapeFuncs.uagent        = nsTable->uagent;
641         gNetscapeFuncs.memalloc      = nsTable->memalloc;
642         gNetscapeFuncs.memfree       = nsTable->memfree;
643         gNetscapeFuncs.memflush      = nsTable->memflush;
644         gNetscapeFuncs.reloadplugins = nsTable->reloadplugins;
645         if( navMinorVers >= NPVERS_HAS_LIVECONNECT )
646         {
647             gNetscapeFuncs.getJavaEnv   = nsTable->getJavaEnv;
648             gNetscapeFuncs.getJavaPeer  = nsTable->getJavaPeer;
649         }
650         if( navMinorVers >= NPVERS_HAS_NOTIFICATION )
651         {   
652             gNetscapeFuncs.geturlnotify  = nsTable->geturlnotify;
653             gNetscapeFuncs.posturlnotify = nsTable->posturlnotify;
654         }
655         gNetscapeFuncs.getvalue         = nsTable->getvalue;
656         gNetscapeFuncs.setvalue         = nsTable->setvalue;
657         gNetscapeFuncs.invalidaterect   = nsTable->invalidaterect;
658         gNetscapeFuncs.invalidateregion = nsTable->invalidateregion;
659         gNetscapeFuncs.forceredraw      = nsTable->forceredraw;
660         if( navMinorVers >= 14 )
661         {   
662             // NPRuntime support 
663             gNetscapeFuncs.getstringidentifier  = nsTable->getstringidentifier;
664             gNetscapeFuncs.getstringidentifiers = nsTable->getstringidentifiers;
665             gNetscapeFuncs.getintidentifier     = nsTable->getintidentifier;
666             gNetscapeFuncs.identifierisstring   = nsTable->identifierisstring;
667             gNetscapeFuncs.utf8fromidentifier   = nsTable->utf8fromidentifier;
668             gNetscapeFuncs.intfromidentifier    = nsTable->intfromidentifier;
669             gNetscapeFuncs.createobject         = nsTable->createobject;
670             gNetscapeFuncs.retainobject         = nsTable->retainobject;
671             gNetscapeFuncs.releaseobject        = nsTable->releaseobject;
672             gNetscapeFuncs.invoke               = nsTable->invoke;
673             gNetscapeFuncs.invokeDefault        = nsTable->invokeDefault;
674             gNetscapeFuncs.evaluate             = nsTable->evaluate;
675             gNetscapeFuncs.getproperty          = nsTable->getproperty;
676             gNetscapeFuncs.setproperty          = nsTable->setproperty;
677             gNetscapeFuncs.removeproperty       = nsTable->removeproperty;
678             gNetscapeFuncs.hasproperty          = nsTable->hasproperty;
679             gNetscapeFuncs.hasmethod            = nsTable->hasmethod;
680             gNetscapeFuncs.releasevariantvalue  = nsTable->releasevariantvalue;
681             gNetscapeFuncs.setexception         = nsTable->setexception;
682         }
683
684         /*
685          * Set up the plugin function table that Netscape will use to
686          * call us.  Netscape needs to know about our version and size
687          * and have a UniversalProcPointer for every function we
688          * implement.
689          */
690         pluginFuncs->version    = (NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR;
691         pluginFuncs->size       = sizeof(NPPluginFuncs);
692         pluginFuncs->newp       = NewNPP_NewProc(Private_New);
693         pluginFuncs->destroy    = NewNPP_DestroyProc(Private_Destroy);
694         pluginFuncs->setwindow  = NewNPP_SetWindowProc(Private_SetWindow);
695         pluginFuncs->newstream  = NewNPP_NewStreamProc(Private_NewStream);
696         pluginFuncs->destroystream = NewNPP_DestroyStreamProc(Private_DestroyStream);
697         pluginFuncs->asfile     = NewNPP_StreamAsFileProc(Private_StreamAsFile);
698         pluginFuncs->writeready = NewNPP_WriteReadyProc(Private_WriteReady);
699         pluginFuncs->write      = NewNPP_WriteProc(Private_Write);
700         pluginFuncs->print      = NewNPP_PrintProc(Private_Print);
701         pluginFuncs->event      = NULL;
702         pluginFuncs->getvalue   = NewNPP_GetValueProc(Private_GetValue);
703         if( navMinorVers >= NPVERS_HAS_NOTIFICATION )
704         {   
705             pluginFuncs->urlnotify = NewNPP_URLNotifyProc(PLUGIN_TO_HOST_GLUE(urlnotify, Private_URLNotify));           
706         }
707 #ifdef OJI
708         if( navMinorVers >= NPVERS_HAS_LIVECONNECT )
709         {
710             pluginFuncs->javaClass  = (JRIGlobalRef) Private_GetJavaClass();
711         }
712 #else
713         pluginFuncs->javaClass = NULL;
714 #endif
715         
716         err = NPP_Initialize();
717     }
718     
719     return err;
720 }
721
722 /*
723  * NP_Shutdown [optional]
724  *  - Netscape needs to know about this symbol.
725  *  - It calls this function after looking up its symbol after
726  *    the last object of this kind has been destroyed.
727  *
728  */
729 NPError
730 NP_Shutdown(void)
731 {
732     PLUGINDEBUGSTR("NP_Shutdown");
733     NPP_Shutdown();
734     return NPERR_NO_ERROR;
735 }