2 IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. ("Apple") in
3 consideration of your agreement to the following terms, and your use, installation,
4 modification or redistribution of this Apple software constitutes acceptance of these
5 terms. If you do not agree with these terms, please do not use, install, modify or
6 redistribute this Apple software.
8 In consideration of your agreement to abide by the following terms, and subject to these
9 terms, Apple grants you a personal, non-exclusive license, under AppleĆs copyrights in
10 this original Apple software (the "Apple Software"), to use, reproduce, modify and
11 redistribute the Apple Software, with or without modifications, in source and/or binary
12 forms; provided that if you redistribute the Apple Software in its entirety and without
13 modifications, you must retain this notice and the following text and disclaimers in all
14 such redistributions of the Apple Software. Neither the name, trademarks, service marks
15 or logos of Apple Computer, Inc. may be used to endorse or promote products derived from
16 the Apple Software without specific prior written permission from Apple. Except as expressly
17 stated in this notice, no other rights or licenses, express or implied, are granted by Apple
18 herein, including but not limited to any patent rights that may be infringed by your
19 derivative works or by other works in which the Apple Software may be incorporated.
21 The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES,
22 EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT,
23 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS
24 USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
26 IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL
27 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
28 OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE,
29 REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND
30 WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR
31 OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 #import "PluginObject.h"
35 NPNetscapeFuncs *browser;
37 // Mach-o entry points
38 NPError NP_Initialize(NPNetscapeFuncs *browserFuncs);
39 NPError NP_GetEntryPoints(NPPluginFuncs *pluginFuncs);
40 void NP_Shutdown(void);
42 // Mach-o entry points
43 NPError NP_Initialize(NPNetscapeFuncs *browserFuncs)
45 browser = browserFuncs;
46 return NPERR_NO_ERROR;
49 NPError NP_GetEntryPoints(NPPluginFuncs *pluginFuncs)
51 pluginFuncs->version = 11;
52 pluginFuncs->size = sizeof(pluginFuncs);
53 pluginFuncs->newp = NPP_New;
54 pluginFuncs->destroy = NPP_Destroy;
55 pluginFuncs->setwindow = NPP_SetWindow;
56 pluginFuncs->newstream = NPP_NewStream;
57 pluginFuncs->destroystream = NPP_DestroyStream;
58 pluginFuncs->asfile = NPP_StreamAsFile;
59 pluginFuncs->writeready = NPP_WriteReady;
60 pluginFuncs->write = (NPP_WriteProcPtr)NPP_Write;
61 pluginFuncs->print = NPP_Print;
62 pluginFuncs->event = NPP_HandleEvent;
63 pluginFuncs->urlnotify = NPP_URLNotify;
64 pluginFuncs->getvalue = NPP_GetValue;
65 pluginFuncs->setvalue = NPP_SetValue;
67 return NPERR_NO_ERROR;
70 void NP_Shutdown(void)
75 NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, char *argn[], char *argv[], NPSavedData *saved)
77 if (browser->version >= 14)
78 instance->pdata = browser->createobject (instance, getPluginClass());
80 return NPERR_NO_ERROR;
83 NPError NPP_Destroy(NPP instance, NPSavedData **save)
85 return NPERR_NO_ERROR;
88 NPError NPP_SetWindow(NPP instance, NPWindow *window)
90 PluginObject *obj = instance->pdata;
92 // Do nothing if browser didn't support NPN_CreateObject which would have created the PluginObject.
96 return NPERR_NO_ERROR;
100 NPError NPP_NewStream(NPP instance, NPMIMEType type, NPStream *stream, NPBool seekable, uint16 *stype)
102 *stype = NP_ASFILEONLY;
103 return NPERR_NO_ERROR;
106 NPError NPP_DestroyStream(NPP instance, NPStream *stream, NPReason reason)
108 return NPERR_NO_ERROR;
111 int32 NPP_WriteReady(NPP instance, NPStream *stream)
116 int32 NPP_Write(NPP instance, NPStream *stream, int32 offset, int32 len, void *buffer)
121 void NPP_StreamAsFile(NPP instance, NPStream *stream, const char *fname)
126 void NPP_Print(NPP instance, NPPrint *platformPrint)
131 int16 NPP_HandleEvent(NPP instance, void *event)
136 void NPP_URLNotify(NPP instance, const char *url, NPReason reason, void *notifyData)
141 NPError NPP_GetValue(NPP instance, NPPVariable variable, void *value)
143 if (variable == NPPVpluginScriptableNPObject) {
144 void **v = (void **)value;
145 PluginObject *obj = instance->pdata;
147 return NPERR_NO_ERROR;
149 return NPERR_GENERIC_ERROR;
152 NPError NPP_SetValue(NPP instance, NPNVariable variable, void *value)
154 return NPERR_GENERIC_ERROR;