gecko/modules/plugin/sdk/samples/npruntime/np_entry.cpp
Josh Aas f67ebb90ae put all sample plugins into the npapi sdk. b=360955 rs=jst
--HG--
rename : modules/plugin/samples/4x-scriptable/acmeIScriptObject.idl => modules/plugin/sdk/samples/4x-scriptable/acmeIScriptObject.idl
rename : modules/plugin/samples/4x-scriptable/doc.html => modules/plugin/sdk/samples/4x-scriptable/doc.html
rename : modules/plugin/samples/4x-scriptable/makefile.win => modules/plugin/sdk/samples/4x-scriptable/makefile.win
rename : modules/plugin/samples/4x-scriptable/np4xscr.def => modules/plugin/sdk/samples/4x-scriptable/np4xscr.def
rename : modules/plugin/samples/4x-scriptable/np4xscr.rc => modules/plugin/sdk/samples/4x-scriptable/np4xscr.rc
rename : modules/plugin/samples/4x-scriptable/np_entry.cpp => modules/plugin/sdk/samples/4x-scriptable/np_entry.cpp
rename : modules/plugin/samples/4x-scriptable/npmac.cpp => modules/plugin/sdk/samples/4x-scriptable/npmac.cpp
rename : modules/plugin/samples/4x-scriptable/npn_gate.cpp => modules/plugin/sdk/samples/4x-scriptable/npn_gate.cpp
rename : modules/plugin/samples/4x-scriptable/npp_gate.cpp => modules/plugin/sdk/samples/4x-scriptable/npp_gate.cpp
rename : modules/plugin/samples/4x-scriptable/nsI4xScriptablePlugin.idl => modules/plugin/sdk/samples/4x-scriptable/nsI4xScriptablePlugin.idl
rename : modules/plugin/samples/4x-scriptable/nsScriptablePeer.cpp => modules/plugin/sdk/samples/4x-scriptable/nsScriptablePeer.cpp
rename : modules/plugin/samples/4x-scriptable/nsScriptablePeer.h => modules/plugin/sdk/samples/4x-scriptable/nsScriptablePeer.h
rename : modules/plugin/samples/4x-scriptable/nsScriptablePeer1.cpp => modules/plugin/sdk/samples/4x-scriptable/nsScriptablePeer1.cpp
rename : modules/plugin/samples/4x-scriptable/nsScriptablePeer1.h => modules/plugin/sdk/samples/4x-scriptable/nsScriptablePeer1.h
rename : modules/plugin/samples/4x-scriptable/plugin.cpp => modules/plugin/sdk/samples/4x-scriptable/plugin.cpp
rename : modules/plugin/samples/4x-scriptable/plugin.h => modules/plugin/sdk/samples/4x-scriptable/plugin.h
rename : modules/plugin/samples/4x-scriptable/readme.txt => modules/plugin/sdk/samples/4x-scriptable/readme.txt
rename : modules/plugin/samples/4x-scriptable/resource.h => modules/plugin/sdk/samples/4x-scriptable/resource.h
rename : modules/plugin/samples/4x-scriptable/script-test.html => modules/plugin/sdk/samples/4x-scriptable/script-test.html
rename : modules/plugin/samples/4x-scriptable/test.html => modules/plugin/sdk/samples/4x-scriptable/test.html
rename : modules/plugin/samples/SanePlugin/Makefile.in => modules/plugin/sdk/samples/SanePlugin/Makefile.in
rename : modules/plugin/samples/SanePlugin/README => modules/plugin/sdk/samples/SanePlugin/README
rename : modules/plugin/samples/SanePlugin/nsSanePlugin.cpp => modules/plugin/sdk/samples/SanePlugin/nsSanePlugin.cpp
rename : modules/plugin/samples/SanePlugin/nsSanePlugin.h => modules/plugin/sdk/samples/SanePlugin/nsSanePlugin.h
rename : modules/plugin/samples/SanePlugin/nsSanePluginControl.idl => modules/plugin/sdk/samples/SanePlugin/nsSanePluginControl.idl
rename : modules/plugin/samples/SanePlugin/nsSanePluginFactory.cpp => modules/plugin/sdk/samples/SanePlugin/nsSanePluginFactory.cpp
rename : modules/plugin/samples/SanePlugin/nsSanePluginFactory.h => modules/plugin/sdk/samples/SanePlugin/nsSanePluginFactory.h
rename : modules/plugin/samples/SanePlugin/nsSanePlugin_CID.h => modules/plugin/sdk/samples/SanePlugin/nsSanePlugin_CID.h
rename : modules/plugin/samples/SanePlugin/test/camera.html => modules/plugin/sdk/samples/SanePlugin/test/camera.html
rename : modules/plugin/samples/SanePlugin/test/scanner.html => modules/plugin/sdk/samples/SanePlugin/test/scanner.html
rename : modules/plugin/samples/npruntime/Makefile.in => modules/plugin/sdk/samples/npruntime/Makefile.in
rename : modules/plugin/samples/npruntime/np_entry.cpp => modules/plugin/sdk/samples/npruntime/np_entry.cpp
rename : modules/plugin/samples/npruntime/npn_gate.cpp => modules/plugin/sdk/samples/npruntime/npn_gate.cpp
rename : modules/plugin/samples/npruntime/npp_gate.cpp => modules/plugin/sdk/samples/npruntime/npp_gate.cpp
rename : modules/plugin/samples/npruntime/nprt.def => modules/plugin/sdk/samples/npruntime/nprt.def
rename : modules/plugin/samples/npruntime/nprt.rc => modules/plugin/sdk/samples/npruntime/nprt.rc
rename : modules/plugin/samples/npruntime/plugin.cpp => modules/plugin/sdk/samples/npruntime/plugin.cpp
rename : modules/plugin/samples/npruntime/plugin.h => modules/plugin/sdk/samples/npruntime/plugin.h
rename : modules/plugin/samples/npruntime/resource.h => modules/plugin/sdk/samples/npruntime/resource.h
rename : modules/plugin/samples/npruntime/test.html => modules/plugin/sdk/samples/npruntime/test.html
rename : modules/plugin/samples/npthread/windows/action.cpp => modules/plugin/sdk/samples/npthread/windows/action.cpp
rename : modules/plugin/samples/npthread/windows/action.h => modules/plugin/sdk/samples/npthread/windows/action.h
rename : modules/plugin/samples/npthread/windows/dbg.cpp => modules/plugin/sdk/samples/npthread/windows/dbg.cpp
rename : modules/plugin/samples/npthread/windows/dbg.h => modules/plugin/sdk/samples/npthread/windows/dbg.h
rename : modules/plugin/samples/npthread/windows/np_entry.cpp => modules/plugin/sdk/samples/npthread/windows/np_entry.cpp
rename : modules/plugin/samples/npthread/windows/npn_gate.cpp => modules/plugin/sdk/samples/npthread/windows/npn_gate.cpp
rename : modules/plugin/samples/npthread/windows/npp_gate.cpp => modules/plugin/sdk/samples/npthread/windows/npp_gate.cpp
rename : modules/plugin/samples/npthread/windows/npthread.def => modules/plugin/sdk/samples/npthread/windows/npthread.def
rename : modules/plugin/samples/npthread/windows/npthread.dsp => modules/plugin/sdk/samples/npthread/windows/npthread.dsp
rename : modules/plugin/samples/npthread/windows/npthread.dsw => modules/plugin/sdk/samples/npthread/windows/npthread.dsw
rename : modules/plugin/samples/npthread/windows/npthread.rc => modules/plugin/sdk/samples/npthread/windows/npthread.rc
rename : modules/plugin/samples/npthread/windows/plugin.cpp => modules/plugin/sdk/samples/npthread/windows/plugin.cpp
rename : modules/plugin/samples/npthread/windows/plugin.h => modules/plugin/sdk/samples/npthread/windows/plugin.h
rename : modules/plugin/samples/npthread/windows/plugload.cpp => modules/plugin/sdk/samples/npthread/windows/plugload.cpp
rename : modules/plugin/samples/npthread/windows/plugload.h => modules/plugin/sdk/samples/npthread/windows/plugload.h
rename : modules/plugin/samples/npthread/windows/readme.txt => modules/plugin/sdk/samples/npthread/windows/readme.txt
rename : modules/plugin/samples/npthread/windows/resource.h => modules/plugin/sdk/samples/npthread/windows/resource.h
rename : modules/plugin/samples/npthread/windows/thread.cpp => modules/plugin/sdk/samples/npthread/windows/thread.cpp
rename : modules/plugin/samples/npthread/windows/thread.h => modules/plugin/sdk/samples/npthread/windows/thread.h
rename : modules/plugin/samples/testevents/Makefile => modules/plugin/sdk/samples/testevents/Makefile
rename : modules/plugin/samples/testevents/Makefile.in => modules/plugin/sdk/samples/testevents/Makefile.in
rename : modules/plugin/samples/testevents/README.txt => modules/plugin/sdk/samples/testevents/README.txt
rename : modules/plugin/samples/testevents/SimpleEventsTest.html => modules/plugin/sdk/samples/testevents/SimpleEventsTest.html
rename : modules/plugin/samples/testevents/npevents.cpp => modules/plugin/sdk/samples/testevents/npevents.cpp
rename : modules/plugin/samples/testevents/nsIEventsPluginInstance.idl => modules/plugin/sdk/samples/testevents/nsIEventsPluginInstance.idl
rename : modules/plugin/samples/unixprinting/Makefile.in => modules/plugin/sdk/samples/unixprinting/Makefile.in
rename : modules/plugin/samples/unixprinting/npprint.pkg => modules/plugin/sdk/samples/unixprinting/npprint.pkg
rename : modules/plugin/samples/unixprinting/npshell.c => modules/plugin/sdk/samples/unixprinting/npshell.c
rename : modules/plugin/samples/unixprinting/npunix.c => modules/plugin/sdk/samples/unixprinting/npunix.c
rename : modules/plugin/samples/unixprinting/printplugin.c => modules/plugin/sdk/samples/unixprinting/printplugin.c
rename : modules/plugin/samples/unixprinting/printplugin.h => modules/plugin/sdk/samples/unixprinting/printplugin.h
rename : modules/plugin/samples/unixprinting/unixprintplugin_test1.html => modules/plugin/sdk/samples/unixprinting/unixprintplugin_test1.html
rename : modules/plugin/samples/unixprinting/unixprintplugin_test2.html => modules/plugin/sdk/samples/unixprinting/unixprintplugin_test2.html
2008-09-02 14:51:32 -04:00

188 lines
7.0 KiB
C++

/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Netscape Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the NPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the NPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
//////////////////////////////////////////////////////////////
//
// Main plugin entry point implementation
//
#include "npapi.h"
#include "npupp.h"
#ifndef HIBYTE
#define HIBYTE(x) ((((uint32)(x)) & 0xff00) >> 8)
#endif
NPNetscapeFuncs NPNFuncs;
#ifdef XP_WIN
NPError OSCALL NP_GetEntryPoints(NPPluginFuncs* pFuncs)
{
if(pFuncs == NULL)
return NPERR_INVALID_FUNCTABLE_ERROR;
if(pFuncs->size < sizeof(NPPluginFuncs))
return NPERR_INVALID_FUNCTABLE_ERROR;
pFuncs->version = (NP_VERSION_MAJOR << 8) | NP_VERSION_MINOR;
pFuncs->newp = NPP_New;
pFuncs->destroy = NPP_Destroy;
pFuncs->setwindow = NPP_SetWindow;
pFuncs->newstream = NPP_NewStream;
pFuncs->destroystream = NPP_DestroyStream;
pFuncs->asfile = NPP_StreamAsFile;
pFuncs->writeready = NPP_WriteReady;
pFuncs->write = NPP_Write;
pFuncs->print = NPP_Print;
pFuncs->event = NPP_HandleEvent;
pFuncs->urlnotify = NPP_URLNotify;
pFuncs->getvalue = NPP_GetValue;
pFuncs->setvalue = NPP_SetValue;
pFuncs->javaClass = NULL;
return NPERR_NO_ERROR;
}
#endif /* XP_WIN */
char *NPP_GetMIMEDescription();
char *
NP_GetMIMEDescription()
{
return NPP_GetMIMEDescription();
}
NPError
NP_GetValue(void* future, NPPVariable variable, void *value)
{
return NPP_GetValue((NPP_t *)future, variable, value);
}
NPError OSCALL
NP_Initialize(NPNetscapeFuncs* pFuncs
#ifdef XP_UNIX
, NPPluginFuncs* pluginFuncs
#endif
)
{
if(pFuncs == NULL)
return NPERR_INVALID_FUNCTABLE_ERROR;
if(HIBYTE(pFuncs->version) > NP_VERSION_MAJOR)
return NPERR_INCOMPATIBLE_VERSION_ERROR;
if(pFuncs->size < sizeof(NPNetscapeFuncs))
return NPERR_INVALID_FUNCTABLE_ERROR;
NPNFuncs.size = pFuncs->size;
NPNFuncs.version = pFuncs->version;
NPNFuncs.geturlnotify = pFuncs->geturlnotify;
NPNFuncs.geturl = pFuncs->geturl;
NPNFuncs.posturlnotify = pFuncs->posturlnotify;
NPNFuncs.posturl = pFuncs->posturl;
NPNFuncs.requestread = pFuncs->requestread;
NPNFuncs.newstream = pFuncs->newstream;
NPNFuncs.write = pFuncs->write;
NPNFuncs.destroystream = pFuncs->destroystream;
NPNFuncs.status = pFuncs->status;
NPNFuncs.uagent = pFuncs->uagent;
NPNFuncs.memalloc = pFuncs->memalloc;
NPNFuncs.memfree = pFuncs->memfree;
NPNFuncs.memflush = pFuncs->memflush;
NPNFuncs.reloadplugins = pFuncs->reloadplugins;
NPNFuncs.getJavaEnv = NULL;
NPNFuncs.getJavaPeer = NULL;
NPNFuncs.getvalue = pFuncs->getvalue;
NPNFuncs.setvalue = pFuncs->setvalue;
NPNFuncs.invalidaterect = pFuncs->invalidaterect;
NPNFuncs.invalidateregion = pFuncs->invalidateregion;
NPNFuncs.forceredraw = pFuncs->forceredraw;
NPNFuncs.getstringidentifier = pFuncs->getstringidentifier;
NPNFuncs.getstringidentifiers = pFuncs->getstringidentifiers;
NPNFuncs.getintidentifier = pFuncs->getintidentifier;
NPNFuncs.identifierisstring = pFuncs->identifierisstring;
NPNFuncs.utf8fromidentifier = pFuncs->utf8fromidentifier;
NPNFuncs.intfromidentifier = pFuncs->intfromidentifier;
NPNFuncs.createobject = pFuncs->createobject;
NPNFuncs.retainobject = pFuncs->retainobject;
NPNFuncs.releaseobject = pFuncs->releaseobject;
NPNFuncs.invoke = pFuncs->invoke;
NPNFuncs.invokeDefault = pFuncs->invokeDefault;
NPNFuncs.evaluate = pFuncs->evaluate;
NPNFuncs.getproperty = pFuncs->getproperty;
NPNFuncs.setproperty = pFuncs->setproperty;
NPNFuncs.removeproperty = pFuncs->removeproperty;
NPNFuncs.hasproperty = pFuncs->hasproperty;
NPNFuncs.hasmethod = pFuncs->hasmethod;
NPNFuncs.releasevariantvalue = pFuncs->releasevariantvalue;
NPNFuncs.setexception = pFuncs->setexception;
#ifdef XP_UNIX
/*
* Set up the plugin function table that Netscape will use to
* call us. Netscape needs to know about our version and size
* and have a UniversalProcPointer for every function we
* implement.
*/
pluginFuncs->version = (NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR;
pluginFuncs->size = sizeof(NPPluginFuncs);
pluginFuncs->newp = NewNPP_NewProc(NPP_New);
pluginFuncs->destroy = NewNPP_DestroyProc(NPP_Destroy);
pluginFuncs->setwindow = NewNPP_SetWindowProc(NPP_SetWindow);
pluginFuncs->newstream = NewNPP_NewStreamProc(NPP_NewStream);
pluginFuncs->destroystream = NewNPP_DestroyStreamProc(NPP_DestroyStream);
pluginFuncs->asfile = NewNPP_StreamAsFileProc(NPP_StreamAsFile);
pluginFuncs->writeready = NewNPP_WriteReadyProc(NPP_WriteReady);
pluginFuncs->write = NewNPP_WriteProc(NPP_Write);
pluginFuncs->print = NewNPP_PrintProc(NPP_Print);
pluginFuncs->urlnotify = NewNPP_URLNotifyProc(NPP_URLNotify);
pluginFuncs->event = NULL;
pluginFuncs->getvalue = NewNPP_GetValueProc(NPP_GetValue);
pluginFuncs->javaClass = NULL;
NPP_Initialize();
#endif
return NPERR_NO_ERROR;
}
NPError OSCALL NP_Shutdown()
{
return NPERR_NO_ERROR;
}