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