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