3 Netscape plugin API wrapper.
6 Copyright (c) 2000 Stefan Schimanski <schimmi@kde.org>
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
27 #include <X11/Xlibint.h>
36 #include "sdk/npupp.h"
39 NPNetscapeFuncs gNetscapeFuncs
; /* Netscape Function table */
40 NPNetscapeFuncs gExtNetscapeFuncs
; /* table that is passed to the plugin*/
41 NPPluginFuncs gPluginFuncs
;
43 typedef char* NP_GetMIMEDescription_t(void);
44 typedef NPError
NP_Initialize_t(NPNetscapeFuncs
*, NPPluginFuncs
*);
45 typedef NPError
NP_Shutdown_t(void);
46 typedef NPError
NP_GetValue_t(void *future
, NPPVariable variable
, void *value
);
48 NP_GetMIMEDescription_t
*gNP_GetMIMEDescription
= NULL
;
49 NP_Initialize_t
*gNP_Initialize
= NULL
;
50 NP_Shutdown_t
*gNP_Shutdown
= NULL
;
51 NP_GetValue_t
*gNP_GetValue
= NULL
;
66 DEB( ef
, "-> UnloadPlugin\n" );
68 DEB( ef
, "<- UnloadPlugin\n" );
74 DEB( ef
, "-> UnloadPlugin\n" );
78 DEB( ef
, "<- UnloadPlugin\n" );
88 ef
= fopen( "/tmp/plugin.log", "a" );
89 DEB( ef
, "-------------------------------\n" );
91 ef
= fopen( "/tmp/plugin.log", "a" );
92 setvbuf( ef
, NULL
, _IONBF
, 0 );
93 DEB( ef
, "-> LoadPlugin\n" );
96 gLib
= shl_load("/tmp/plugin.so", BIND_IMMEDIATE
, 0L);
97 if (shl_findsym(&gLib
, "/tmp/plugin.so", (short) TYPE_PROCEDURE
, (void *) &gNP_GetMIMEDescription
))
98 gNP_GetMIMEDescription
= NULL
;
99 if (shl_findsym(&gLib
, "/tmp/plugin.so", (short) TYPE_PROCEDURE
, (void *) &gNP_Initialize
))
100 gNP_Initialize
= NULL
;
101 if (shl_findsym(&gLib
, "/tmp/plugin.so", (short) TYPE_PROCEDURE
, (void *) &gNP_Shutdown
))
103 if (shl_findsym(&gLib
, "/tmp/plugin.so", (short) TYPE_PROCEDURE
, (void *) &gNP_GetValue
))
106 gLib
= dlopen( "/tmp/plugin.so", RTLD_NOW
);
107 DEB( ef
, "gLib = %x\n", gLib
);
109 gNP_GetMIMEDescription
= dlsym( gLib
, "NP_GetMIMEDescription" );
110 gNP_Initialize
= dlsym( gLib
, "NP_Initialize" );
111 gNP_Shutdown
= dlsym( gLib
, "NP_Shutdown" );
112 gNP_GetValue
= dlsym( gLib
, "NP_GetValue" );
114 DEB( ef
, "gNP_GetMIMEDescription = %x\n", NP_GetMIMEDescription
);
115 DEB( ef
, "gNP_Initialize = %x\n", gNP_Initialize
);
116 DEB( ef
, "gNP_Shutdown = %x\n", gNP_Shutdown
);
117 DEB( ef
, "gNP_GetValue = %x\n", gNP_GetValue
);
119 if ( !gNP_GetMIMEDescription
|| !gNP_Initialize
|| !gNP_Initialize
|| !gNP_GetValue
) {
120 DEB( ef
, "<- LoadPlugin - will unload before\n" );
123 DEB( ef
, "<- LoadPlugin\n" );
127 extern char *NP_GetMIMEDescription(void);
128 char *NP_GetMIMEDescription(void)
133 if ( !gLib
) return NULL
;
134 DEB(ef
, "-> NP_GetMIMEDescription()\n" );
136 ret
= gNP_GetMIMEDescription();
137 DEB(ef
, "<- NP_GetMIMEDescription = %s\n", ret
);
142 NPError MyNPP_Initialize(void)
145 DEB(ef, "-> NPP_Initialize( )\n");
147 err = gPluginFuncs.initialize( );
148 DEB(ef, "<- NPP_Initialize = %d\n", err);
153 void MyNPP_Shutdown(void)
155 DEB(ef, "-> NPP_Shutdown( )\n");
156 gPluginFuncs.shutdown( );
157 DEB(ef, "<- NPP_Shutdown\n");
161 NPError
MyNPP_New(NPMIMEType pluginType
, NPP instance
,
162 uint16 mode
, int16 argc
, char* argn
[],
163 char* argv
[], NPSavedData
* saved
)
167 DEB(ef
, "-> NPP_New( %s, 0x%x, %d, %d, .., .., 0x%x )\n", pluginType
, instance
, mode
, argc
, saved
);
169 for ( n
=0; n
<argc
; n
++ ) {
170 DEB(ef
, "%s=%s\n", argn
[n
], argv
[n
] );
173 err
= gPluginFuncs
.newp( pluginType
, instance
, mode
, argc
, argn
, argv
, saved
);
174 DEB(ef
, "<- NPP_New = %d\n", err
);
179 NPError
MyNPP_Destroy(NPP instance
, NPSavedData
** save
)
182 DEB(ef
, "-> NPP_Destrpy( %x, 0x%x )\n", instance
, save
);
184 err
= gPluginFuncs
.destroy( instance
, save
);
185 DEB(ef
, "<- NPP_Destroy = %d\n", err
);
190 NPError
MyNPP_SetWindow(NPP instance
, NPWindow
* window
)
193 NPSetWindowCallbackStruct
*win_info
;
194 DEB(ef
, "-> NPP_SetWindow( %x, 0x%x )\n", instance
, window
);
196 DEB(ef
, "window->window = 0x%x\n", window
->window
);
197 DEB(ef
, "window->x = %d\n", window
->x
);
198 DEB(ef
, "window->y = %d\n", window
->y
);
199 DEB(ef
, "window->width = %d\n", window
->width
);
200 DEB(ef
, "window->height = %d\n", window
->height
);
201 DEB(ef
, "window->ws_info = 0x%x\n", window
->ws_info
);
202 DEB(ef
, "window->type = 0x%x\n", window
->type
);
204 win_info
= (NPSetWindowCallbackStruct
*)window
->ws_info
;
205 DEB(ef
, "win_info->type = %d\n", win_info
->type
);
206 DEB(ef
, "win_info->display = 0x%x\n", win_info
->display
);
207 DEB(ef
, "win_info->visual = 0x%x\n", win_info
->visual
);
208 DEB(ef
, "win_info->colormap = 0x%x\n", win_info
->colormap
);
209 DEB(ef
, "win_info->depth = %d\n", win_info
->depth
);
211 err
= gPluginFuncs
.setwindow( instance
, window
);
212 DEB(ef
, "<- NPP_SetWindow = %d\n", err
);
217 NPError
MyNPP_NewStream(NPP instance
, NPMIMEType type
,
218 NPStream
* stream
, NPBool seekable
,
222 DEB(ef
, "-> NPP_NewStream( %x, %s, 0x%x, %d, 0x%x )\n", instance
, type
, stream
, seekable
, stype
);
224 DEB(ef
, "stream->ndata = 0x%x\n", stream
->ndata
);
225 DEB(ef
, "stream->url = %s\n", stream
->url
);
226 DEB(ef
, "stream->end = %d\n", stream
->end
);
227 DEB(ef
, "stream->pdata = 0x%x\n", stream
->pdata
);
228 DEB(ef
, "stream->lastmodified = %d\n", stream
->lastmodified
);
229 DEB(ef
, "stream->notifyData = 0x%x\n", stream
->notifyData
);
231 err
= gPluginFuncs
.newstream( instance
, type
, stream
, seekable
, stype
);
232 DEB(ef
, "<- NPP_NewStream = %d\n", err
);
233 DEB(ef
, "stype = %d\n", *stype
);
238 NPError
MyNPP_DestroyStream(NPP instance
, NPStream
* stream
,
242 DEB(ef
, "-> NPP_DestroyStream( %x, 0x%x, %d )\n", instance
, stream
, reason
);
244 err
= gPluginFuncs
.destroystream( instance
, stream
, reason
);
245 DEB(ef
, "<- NPP_DestroyStream = %d\n", err
);
250 int32
MyNPP_WriteReady(NPP instance
, NPStream
* stream
)
253 DEB(ef
, "-> NPP_WriteReady( %x, 0x%x )\n", instance
, stream
);
255 ret
= gPluginFuncs
.writeready( instance
, stream
);
256 DEB(ef
, "<- NPP_WriteReady = %d\n", ret
);
261 int32
MyNPP_Write(NPP instance
, NPStream
* stream
, int32 offset
,
262 int32 len
, void* buffer
)
265 DEB(ef
, "-> NPP_Write( %x, 0x%x, %d, %d, 0x%x )\n", instance
, stream
, offset
, len
, buffer
);
267 ret
= gPluginFuncs
.write( instance
, stream
, offset
, len
, buffer
);
268 DEB(ef
, "<- NPP_Write = %d\n", ret
);
273 void MyNPP_StreamAsFile(NPP instance
, NPStream
* stream
,
276 DEB(ef
, "-> NPP_StreamAsFile( %x, 0x%x, %s )\n", instance
, stream
, fname
);
278 gPluginFuncs
.asfile( instance
, stream
, fname
);
279 DEB(ef
, "<- NPP_StreamAsFile\n");
283 void MyNPP_Print(NPP instance
, NPPrint
* platformPrint
)
285 DEB(ef
, "-> NPP_Print( %x, 0x%x )\n", instance
, platformPrint
);
286 gPluginFuncs
.print( instance
, platformPrint
);
287 DEB(ef
, "<- NPP_Print\n");
291 int16
MyNPP_HandleEvent(NPP instance
, void* event
)
294 DEB(ef
, "-> NPP_HandleEvent( %x, 0x%x )\n", instance
, event
);
296 ret
= gPluginFuncs
.event( instance
, event
);
297 DEB(ef
, "<- NPP_HandleEvent = %d\n", ret
);
302 void MyNPP_URLNotify(NPP instance
, const char* url
,
303 NPReason reason
, void* notifyData
)
305 DEB(ef
, "-> NPP_URLNotify( %x, %s, %d, 0x%x )\n", instance
, url
, reason
, notifyData
);
306 gPluginFuncs
.urlnotify( instance
, url
, reason
, notifyData
);
307 DEB(ef
, "<- NPP_URLNotify\n");
312 jref
MyNPP_GetJavaClass(void)
315 DEB(ef
, "-> NPP_GetJavaClass( )\n" );
317 /* ret = gPluginFuncs.javaClass( );*/
318 DEB(ef
, "<- NPP_GetJavaClass = %d\n", ret
);
324 NPError
MyNPP_GetValue(void *instance
, NPPVariable variable
, void *value
)
327 DEB(ef
, "-> NPP_GetValue( %x, %d, 0x%x )\n", instance
, variable
, value
);
329 err
= gPluginFuncs
.getvalue( instance
, variable
, value
);
330 DEB(ef
, "<- NPP_GetValue = %d\n", err
);
335 NPError
MyNPP_SetValue(void *instance
, NPNVariable variable
, void *value
)
338 DEB(ef
, "-> NPP_SetValue( %x, %d, 0x%x )\n", instance
, variable
, value
);
340 err
= gPluginFuncs
.getvalue( instance
, variable
, value
);
341 DEB(ef
, "<- NPP_SetValue = %d\n", err
);
346 void MyNPN_Version(int* plugin_major, int* plugin_minor,
347 int* netscape_major, int* netscape_minor)
349 DEB(ef, "-> NPN_Version( %d, %d, %d, %d )\n", *plugin_major, *plugin_minor, *netscape_major, *netscape_minor);
351 gNetscapeFuncs.version( plugin_major, plugin_minor, netscape_major, netscape_minor );
352 DEB(ef, "<- NPN_Version\n");
353 DEB(ef, "plugin_major = %d\n", *plugin_major);
354 DEB(ef, "plugin_minor = %d\n", *plugin_minor);
355 DEB(ef, "netscape_major = %d\n", *plugin_major);
356 DEB(ef, "netscape_minor = %d\n", *plugin_minor);
360 NPError
MyNPN_GetURLNotify(NPP instance
, const char* url
,
361 const char* target
, void* notifyData
)
364 DEB(ef
, "-> NPN_GetURLNotify( %x, %s, %s, 0x%x )\n", instance
, url
, target
, notifyData
);
366 err
= gNetscapeFuncs
.geturlnotify( instance
, url
, target
, notifyData
);
367 DEB(ef
, "<- NPN_GetURLNotify = %d\n", err
);
372 NPError
MyNPN_GetURL(NPP instance
, const char* url
,
376 DEB(ef
, "-> NPN_GetURL( %x, %s, %s )\n", instance
, url
, target
);
378 err
= gNetscapeFuncs
.geturl( instance
, url
, target
);
379 DEB(ef
, "<- NPN_GetURL = %d\n", err
);
384 NPError
MyNPN_PostURLNotify(NPP instance
, const char* url
,
385 const char* target
, uint32 len
,
386 const char* buf
, NPBool file
,
390 DEB(ef
, "-> NPN_PostURLNotify( %x, %s, %s, %d, 0x%x, %d, 0x%x )\n", instance
, url
, target
, len
, buf
, file
, notifyData
);
392 err
= gNetscapeFuncs
.posturlnotify( instance
, url
, target
, len
, buf
, file
, notifyData
);
393 DEB(ef
, "<- NPN_PostURLNotify = %d\n", err
);
398 NPError
MyNPN_PostURL(NPP instance
, const char* url
,
399 const char* target
, uint32 len
,
400 const char* buf
, NPBool file
)
403 DEB(ef
, "-> NPN_PostURL( %x, %s, %s, %d, 0x%x, %d )\n", instance
, url
, target
, len
, buf
, file
);
405 err
= gNetscapeFuncs
.posturl( instance
, url
, target
, len
, buf
, file
);
406 DEB(ef
, "<- NPN_PostURL = %d\n", err
);
411 NPError
MyNPN_RequestRead(NPStream
* stream
, NPByteRange
* rangeList
)
414 DEB(ef
, "-> NPN_RequestRead( %x, 0x%x )\n", stream
, rangeList
);
415 DEB(ef
, "rangeList->offset = %d\n", rangeList
->offset
);
416 DEB(ef
, "rangeList->length = %d\n", rangeList
->length
);
417 DEB(ef
, "rangeList->next = 0x%x\n", rangeList
->next
);
419 err
= gNetscapeFuncs
.requestread( stream
, rangeList
);
420 DEB(ef
, "<- NPN_RequestRead = %d\n", err
);
421 DEB(ef
, "rangeList->offset = %d\n", rangeList
->offset
);
422 DEB(ef
, "rangeList->length = %d\n", rangeList
->length
);
423 DEB(ef
, "rangeList->next = 0x%x\n", rangeList
->next
);
428 NPError
MyNPN_NewStream(NPP instance
, NPMIMEType type
,
429 const char* target
, NPStream
** stream
)
432 DEB(ef
, "-> NPN_NewStream( %x, %s, %s, 0x%x )\n", instance
, type
, target
, stream
);
434 err
= gNetscapeFuncs
.newstream( instance
, type
, target
, stream
);
435 DEB(ef
, "<- NPN_NewStream = %d\n", err
);
440 int32
MyNPN_Write(NPP instance
, NPStream
* stream
, int32 len
,
444 DEB(ef
, "-> NPN_Write( %x, 0x%x, %d, 0x%x )\n", instance
, stream
, len
, buffer
);
446 ret
= gNetscapeFuncs
.write( instance
, stream
, len
, buffer
);
447 DEB(ef
, "<- NPN_Write = %d\n", ret
);
452 NPError
MyNPN_DestroyStream(NPP instance
, NPStream
* stream
,
456 DEB(ef
, "-> NPN_DestroyStream( %x, 0x%x, %d )\n", instance
, stream
, reason
);
458 err
= gNetscapeFuncs
.destroystream( instance
, stream
, reason
);
459 DEB(ef
, "<- NPN_DestroyStream = %d\n", err
);
464 void MyNPN_Status(NPP instance
, const char* message
)
466 DEB(ef
, "-> NPN_Status( %x, %s )\n", instance
, message
);
467 gNetscapeFuncs
.status( instance
, message
);
468 DEB(ef
, "<- NPN_Status\n");
472 const char* MyNPN_UserAgent(NPP instance
)
475 DEB(ef
, "-> NPN_UserAgent( %x )\n", instance
);
477 ret
= gNetscapeFuncs
.uagent( instance
);
478 DEB(ef
, "<- NPN_UserAgent = %s\n", ret
);
483 void* MyNPN_MemAlloc(uint32 size
)
486 DEB(ef
, "-> NPN_MemAlloc( %d )\n", size
);
488 ret
= gNetscapeFuncs
.memalloc( size
);
489 DEB(ef
, "<- NPN_MemAlloc = 0x%x\n", ret
);
494 void MyNPN_MemFree(void* ptr
)
496 DEB(ef
, "-> NPN_MemFree( 0x%x )\n", ptr
);
497 gNetscapeFuncs
.memfree( ptr
);
498 DEB(ef
, "<- NPN_MemFree\n");
502 uint32
MyNPN_MemFlush(uint32 size
)
505 DEB(ef
, "-> NPN_MemFlush( %d )\n", size
);
507 ret
= gNetscapeFuncs
.memflush( size
);
508 DEB(ef
, "<- NPN_MemFlush = %d\n", ret
);
513 void MyNPN_ReloadPlugins(NPBool reloadPages
)
515 DEB(ef
, "-> NPN_ReloadPlugins( %d )\n", reloadPages
);
516 gNetscapeFuncs
.reloadplugins( reloadPages
);
517 DEB(ef
, "<- NPN_ReloadPlugins\n");
521 JRIEnv
* MyNPN_GetJavaEnv(void)
524 DEB(ef
, "-> NPN_GetJavaEnv( )\n");
526 ret
= gNetscapeFuncs
.getJavaEnv( );
527 DEB(ef
, "<- NPN_GetJavaEnv = 0x%x\n", ret
);
532 jref
MyNPN_GetJavaPeer(NPP instance
)
535 DEB(ef
, "-> NPN_GetJavaPeer( %x )\n", instance
);
537 ret
= gNetscapeFuncs
.getJavaPeer( instance
);
538 DEB(ef
, "<- NPN_GetJavaPeer = 0x%x\n", ret
);
543 NPError
MyNPN_GetValue(NPP instance
, NPNVariable variable
,
547 DEB(ef
, "-> NPN_GetValue( %x, %d, 0x%x)\n", instance
, variable
, value
);
548 ret
= gNetscapeFuncs
.getvalue( instance
, variable
, value
);
549 DEB(ef
, "<- NPN_GetValue = %d\n", ret
);
554 NPError
MyNPN_SetValue(NPP instance
, NPPVariable variable
,
558 DEB(ef
, "-> NPN_SetValue( %x, %d, 0x%x)\n", instance
, variable
, value
);
560 ret
= gNetscapeFuncs
.setvalue( instance
, variable
, value
);
561 DEB(ef
, "<- NPN_SetValue = %d\n", ret
);
566 void MyNPN_InvalidateRect(NPP instance
, NPRect
*invalidRect
)
568 DEB(ef
, "-> NPN_InvalidateRect( %x, 0x%x )\n", instance
, invalidRect
);
569 gNetscapeFuncs
.invalidaterect( instance
, invalidRect
);
570 DEB(ef
, "<- NPN_InvalidateRect\n");
574 void MyNPN_InvalidateRegion(NPP instance
, NPRegion invalidRegion
)
576 DEB(ef
, "-> NPN_InvalidateRegion( %x, 0x%x )\n", instance
, invalidRegion
);
577 gNetscapeFuncs
.invalidateregion( instance
, invalidRegion
);
578 DEB(ef
, "<- NPN_InvalidateRegion\n");
582 void MyNPN_ForceRedraw(NPP instance
)
584 DEB(ef
, "-> NPN_ForceRedraw( %x )\n", instance
);
585 gNetscapeFuncs
.forceredraw( instance
);
586 DEB(ef
, "<- NPN_ForceRedraw\n");
589 extern NPError
NP_GetValue(void *future
, NPPVariable variable
, void *value
);
590 NPError
NP_GetValue(void *future
, NPPVariable variable
, void *value
)
594 if ( !gLib
) return NPERR_GENERIC_ERROR
;
595 DEB(ef
, "-> NP_GetValue( %x, %d, %x )\n", future
, variable
, value
);
597 err
= gNP_GetValue( future
, variable
, value
);
598 DEB(ef
, "<- NP_GetValue = %d\n", err
);
602 extern NPError
NP_Initialize(NPNetscapeFuncs
* nsTable
, NPPluginFuncs
* pluginFuncs
);
603 NPError
NP_Initialize(NPNetscapeFuncs
* nsTable
, NPPluginFuncs
* pluginFuncs
)
607 if ( !gLib
) return NPERR_GENERIC_ERROR
;
608 DEB(ef
, "-> NP_Initialize( %x, %x )\n", nsTable
, pluginFuncs
);
610 DEB(ef
, "nsTable->size = %d\n", nsTable
->size
);
611 DEB(ef
, "nsTable->version = 0x%x\n", nsTable
->version
);
612 DEB(ef
, "nsTable->geturl = 0x%x\n", nsTable
->geturl
);
613 DEB(ef
, "nsTable->posturl = 0x%x\n", nsTable
->posturl
);
614 DEB(ef
, "nsTable->requestread = 0x%x\n", nsTable
->requestread
);
615 DEB(ef
, "nsTable->newstream = 0x%x\n", nsTable
->newstream
);
616 DEB(ef
, "nsTable->write = 0x%x\n", nsTable
->write
);
617 DEB(ef
, "nsTable->destroystream = 0x%x\n", nsTable
->destroystream
);
618 DEB(ef
, "nsTable->status = 0x%x\n", nsTable
->status
);
619 DEB(ef
, "nsTable->uagent = 0x%x\n", nsTable
->uagent
);
620 DEB(ef
, "nsTable->memalloc = 0x%x\n", nsTable
->memalloc
);
621 DEB(ef
, "nsTable->memfree = 0x%x\n", nsTable
->memfree
);
622 DEB(ef
, "nsTable->memflush = 0x%x\n", nsTable
->memflush
);
623 DEB(ef
, "nsTable->reloadplugins = 0x%x\n", nsTable
->reloadplugins
);
624 DEB(ef
, "nsTable->getJavaEnv = 0x%x\n", nsTable
->getJavaEnv
);
625 DEB(ef
, "nsTable->getJavaPeer = 0x%x\n", nsTable
->getJavaPeer
);
626 DEB(ef
, "nsTable->geturlnotify = 0x%x\n", nsTable
->geturlnotify
);
627 DEB(ef
, "nsTable->posturlnotify = 0x%x\n", nsTable
->posturlnotify
);
628 DEB(ef
, "nsTable->getvalue = 0x%x\n", nsTable
->getvalue
);
629 DEB(ef
, "nsTable->setvalue = 0x%x\n", nsTable
->setvalue
);
630 DEB(ef
, "nsTable->invalidaterect = 0x%x\n", nsTable
->invalidaterect
);
631 DEB(ef
, "nsTable->invalidateregion = 0x%x\n", nsTable
->invalidateregion
);
632 DEB(ef
, "nsTable->forceredraw = 0x%x\n", nsTable
->forceredraw
);
634 DEB(ef
, "pluginFuncs->size = %d\n", pluginFuncs
->size
);
635 DEB(ef
, "pluginFuncs->version = 0x%x\n", pluginFuncs
->version
);
636 DEB(ef
, "pluginFuncs->newp = 0x%x\n", pluginFuncs
->newp
);
637 DEB(ef
, "pluginFuncs->destroy = 0x%x\n", pluginFuncs
->destroy
);
638 DEB(ef
, "pluginFuncs->setwindow = 0x%x\n", pluginFuncs
->setwindow
);
639 DEB(ef
, "pluginFuncs->newstream = 0x%x\n", pluginFuncs
->newstream
);
640 DEB(ef
, "pluginFuncs->destroystream = 0x%x\n", pluginFuncs
->destroystream
);
641 DEB(ef
, "pluginFuncs->asfile = 0x%x\n", pluginFuncs
->asfile
);
642 DEB(ef
, "pluginFuncs->writeready = 0x%x\n", pluginFuncs
->writeready
);
643 DEB(ef
, "pluginFuncs->write = 0x%x\n", pluginFuncs
->write
);
644 DEB(ef
, "pluginFuncs->print = 0x%x\n", pluginFuncs
->print
);
645 DEB(ef
, "pluginFuncs->event = 0x%x\n", pluginFuncs
->event
);
646 DEB(ef
, "pluginFuncs->urlnotify = 0x%x\n", pluginFuncs
->urlnotify
);
647 DEB(ef
, "pluginFuncs->javaClass = 0x%x\n", pluginFuncs
->javaClass
);
648 DEB(ef
, "pluginFuncs->getvalue = 0x%x\n", pluginFuncs
->getvalue
);
649 DEB(ef
, "pluginFuncs->setvalue = 0x%x\n", pluginFuncs
->setvalue
);
651 if ( pluginFuncs
->size
>sizeof(gPluginFuncs
) )
653 DEB(ef
, "Plugin function table too big\n");
654 return NPERR_GENERIC_ERROR
;
657 if ( nsTable
->size
>sizeof(gNetscapeFuncs
) )
659 DEB(ef
, "Netscape function table too big\n");
660 return NPERR_GENERIC_ERROR
;
663 memcpy(&gNetscapeFuncs
, nsTable
, sizeof(gNetscapeFuncs
));
664 memcpy(&gExtNetscapeFuncs
, nsTable
, sizeof(gExtNetscapeFuncs
));
666 gExtNetscapeFuncs
.geturl
= MyNPN_GetURL
;
667 gExtNetscapeFuncs
.posturl
= MyNPN_PostURL
;
668 gExtNetscapeFuncs
.requestread
= MyNPN_RequestRead
;
669 gExtNetscapeFuncs
.newstream
= MyNPN_NewStream
;
670 gExtNetscapeFuncs
.write
= MyNPN_Write
;
671 gExtNetscapeFuncs
.destroystream
= MyNPN_DestroyStream
;
672 gExtNetscapeFuncs
.status
= MyNPN_Status
;
673 gExtNetscapeFuncs
.uagent
= MyNPN_UserAgent
;
674 /*gExtNetscapeFuncs.memalloc = MyNPN_MemAlloc;
675 gExtNetscapeFuncs.memfree = MyNPN_MemFree;
676 gExtNetscapeFuncs.memflush = MyNPN_MemFlush;*/
677 gExtNetscapeFuncs
.reloadplugins
= MyNPN_ReloadPlugins
;
678 gExtNetscapeFuncs
.getJavaEnv
= MyNPN_GetJavaEnv
;
679 gExtNetscapeFuncs
.getJavaPeer
= MyNPN_GetJavaPeer
;
680 gExtNetscapeFuncs
.geturlnotify
= MyNPN_GetURLNotify
;
681 gExtNetscapeFuncs
.posturlnotify
= MyNPN_PostURLNotify
;
682 gExtNetscapeFuncs
.getvalue
= MyNPN_GetValue
;
683 gExtNetscapeFuncs
.setvalue
= MyNPN_SetValue
;
684 gExtNetscapeFuncs
.invalidaterect
= MyNPN_InvalidateRect
;
685 gExtNetscapeFuncs
.invalidateregion
= MyNPN_InvalidateRegion
;
686 gExtNetscapeFuncs
.forceredraw
= MyNPN_ForceRedraw
;
688 gPluginFuncs
.size
= sizeof( gPluginFuncs
);
692 err
= gNP_Initialize( &gExtNetscapeFuncs
, &gPluginFuncs
);
695 /*memcpy(&pluginFuncs, gPluginFuncs, sizeof(gPluginFuncs));*/
697 /*pluginFuncs->initialize = MyNPP_Initialize;
698 pluginFuncs->shutdown = MyNPP_Shutdown;*/
699 pluginFuncs
->newp
= MyNPP_New
;
700 pluginFuncs
->destroy
= MyNPP_Destroy
;
701 pluginFuncs
->setwindow
= MyNPP_SetWindow
;
702 pluginFuncs
->newstream
= MyNPP_NewStream
;
703 pluginFuncs
->destroystream
= MyNPP_DestroyStream
;
704 pluginFuncs
->asfile
= MyNPP_StreamAsFile
;
705 pluginFuncs
->writeready
= MyNPP_WriteReady
;
706 pluginFuncs
->write
= MyNPP_Write
;
707 pluginFuncs
->print
= MyNPP_Print
;
708 pluginFuncs
->event
= MyNPP_HandleEvent
;
709 pluginFuncs
->urlnotify
= MyNPP_URLNotify
;
710 pluginFuncs
->javaClass
= 0; /* MyNPP_GetJavaClass; */
711 pluginFuncs
->getvalue
= (NPP_GetValueUPP
)MyNPP_GetValue
;
712 pluginFuncs
->setvalue
= (NPP_SetValueUPP
)MyNPP_SetValue
;
714 DEB(ef
, "nsTable->size = %d\n", gExtNetscapeFuncs
.size
);
715 DEB(ef
, "nsTable->version = 0x%x\n", gExtNetscapeFuncs
.version
);
716 DEB(ef
, "nsTable->geturl = 0x%x\n", gExtNetscapeFuncs
.geturl
);
717 DEB(ef
, "nsTable->posturl = 0x%x\n", gExtNetscapeFuncs
.posturl
);
718 DEB(ef
, "nsTable->requestread = 0x%x\n", gExtNetscapeFuncs
.requestread
);
719 DEB(ef
, "nsTable->newstream = 0x%x\n", gExtNetscapeFuncs
.newstream
);
720 DEB(ef
, "nsTable->write = 0x%x\n", gExtNetscapeFuncs
.write
);
721 DEB(ef
, "nsTable->destroystream = 0x%x\n", gExtNetscapeFuncs
.destroystream
);
722 DEB(ef
, "nsTable->status = 0x%x\n", gExtNetscapeFuncs
.status
);
723 DEB(ef
, "nsTable->uagent = 0x%x\n", gExtNetscapeFuncs
.uagent
);
724 DEB(ef
, "nsTable->memalloc = 0x%x\n", gExtNetscapeFuncs
.memalloc
);
725 DEB(ef
, "nsTable->memfree = 0x%x\n", gExtNetscapeFuncs
.memfree
);
726 DEB(ef
, "nsTable->memflush = 0x%x\n", gExtNetscapeFuncs
.memflush
);
727 DEB(ef
, "nsTable->reloadplugins = 0x%x\n", gExtNetscapeFuncs
.reloadplugins
);
728 DEB(ef
, "nsTable->getJavaEnv = 0x%x\n", gExtNetscapeFuncs
.getJavaEnv
);
729 DEB(ef
, "nsTable->getJavaPeer = 0x%x\n", gExtNetscapeFuncs
.getJavaPeer
);
730 DEB(ef
, "nsTable->geturlnotify = 0x%x\n", gExtNetscapeFuncs
.geturlnotify
);
731 DEB(ef
, "nsTable->posturlnotify = 0x%x\n", gExtNetscapeFuncs
.posturlnotify
);
732 DEB(ef
, "nsTable->getvalue = 0x%x\n", gExtNetscapeFuncs
.getvalue
);
733 DEB(ef
, "nsTable->setvalue = 0x%x\n", gExtNetscapeFuncs
.setvalue
);
734 DEB(ef
, "nsTable->invalidaterect = 0x%x\n", gExtNetscapeFuncs
.invalidaterect
);
735 DEB(ef
, "nsTable->invalidateregion = 0x%x\n", gExtNetscapeFuncs
.invalidateregion
);
736 DEB(ef
, "nsTable->forceredraw = 0x%x\n", gExtNetscapeFuncs
.forceredraw
);
738 DEB(ef
, "pluginFuncs->size = %d\n", pluginFuncs
->size
);
739 DEB(ef
, "pluginFuncs->version = 0x%x\n", pluginFuncs
->version
);
740 DEB(ef
, "pluginFuncs->newp = 0x%x\n", pluginFuncs
->newp
);
741 DEB(ef
, "pluginFuncs->destroy = 0x%x\n", pluginFuncs
->destroy
);
742 DEB(ef
, "pluginFuncs->setwindow = 0x%x\n", pluginFuncs
->setwindow
);
743 DEB(ef
, "pluginFuncs->newstream = 0x%x\n", pluginFuncs
->newstream
);
744 DEB(ef
, "pluginFuncs->destroystream = 0x%x\n", pluginFuncs
->destroystream
);
745 DEB(ef
, "pluginFuncs->asfile = 0x%x\n", pluginFuncs
->asfile
);
746 DEB(ef
, "pluginFuncs->writeready = 0x%x\n", pluginFuncs
->writeready
);
747 DEB(ef
, "pluginFuncs->write = 0x%x\n", pluginFuncs
->write
);
748 DEB(ef
, "pluginFuncs->print = 0x%x\n", pluginFuncs
->print
);
749 DEB(ef
, "pluginFuncs->event = 0x%x\n", pluginFuncs
->event
);
750 DEB(ef
, "pluginFuncs->urlnotify = 0x%x\n", pluginFuncs
->urlnotify
);
751 DEB(ef
, "pluginFuncs->javaClass = 0x%x\n", pluginFuncs
->javaClass
);
752 DEB(ef
, "pluginFuncs->getvalue = 0x%x\n", pluginFuncs
->getvalue
);
753 DEB(ef
, "pluginFuncs->setvalue = 0x%x\n", pluginFuncs
->setvalue
);
756 DEB(ef
, "<- NP_Initialize = %d\n", err
);
760 extern NPError
NP_Shutdown(void);
761 NPError
NP_Shutdown(void)
765 if ( !gLib
) return NPERR_GENERIC_ERROR
;
766 DEB(ef
, "-> NP_Shutdown()\n" );
768 err
= gNP_Shutdown( );
769 DEB(ef
, "<- NP_Shutdown = %d\n", err
);