コード例 #1
0
ファイル: npwin.cpp プロジェクト: Geal/Squeak-VM
//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\.
////\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//.
// NP_Initialize
//
//	called immediately after the plugin DLL is loaded
//
NPError WINAPI NP_EXPORT 
NP_Initialize(NPNetscapeFuncs* pFuncs)
{
    // trap a NULL ptr 
    if(pFuncs == NULL)
        return NPERR_INVALID_FUNCTABLE_ERROR;

    g_pNavigatorFuncs = pFuncs; // save it for future reference 

    // if the plugin's major ver level is lower than the Navigator's,
    // then they are incompatible, and should return an error 
    if(HIBYTE(pFuncs->version) > NP_VERSION_MAJOR)
        return NPERR_INCOMPATIBLE_VERSION_ERROR;

	// We have to defer these assignments until g_pNavigatorFuncs is set
    int navMinorVers = g_pNavigatorFuncs->version & 0xFF;

	if( navMinorVers >= NPVERS_HAS_NOTIFICATION ) {
		g_pluginFuncs->urlnotify = NPP_URLNotify;
	}
	
#ifdef WIN32 // An ugly hack, because Win16 lags behind in Java
	if( navMinorVers >= NPVERS_HAS_LIVECONNECT ) {
#else
	if( navMinorVers >= NPVERS_WIN16_HAS_LIVECONNECT )
#endif // WIN32
		g_pluginFuncs->javaClass = Private_GetJavaClass();
	}

	// NPP_Initialize is a standard (cross-platform) initialize function.
    return NPP_Initialize();
}
コード例 #2
0
ファイル: Npwin.cpp プロジェクト: agumonkey/Juice
//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\.
////\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//.
// NP_Initialize
//
//	called immediately after the plugin DLL is loaded
//
NPError WINAPI NP_EXPORT 
NP_Initialize(NPNetscapeFuncs* pFuncs)
{
    // trap a NULL ptr 
    if(pFuncs == NULL)
        return NPERR_INVALID_FUNCTABLE_ERROR;

    g_pNavigatorFuncs = pFuncs; // save it for future reference 

    // if the plugin's major ver level is lower than the Navigator's,
    // then they are incompatible, and should return an error 
    if(HIBYTE(pFuncs->version) > NP_VERSION_MAJOR)
        return NPERR_INCOMPATIBLE_VERSION_ERROR;

    // if the Navigator's function table is smaller than the plugin expects,
    // then they are incompatible, and should return an error 
    if(pFuncs->size < sizeof NPNetscapeFuncs)
        return NPERR_INVALID_FUNCTABLE_ERROR;

	// We have to defer this call until g_pNavigatorFunc is set
	g_pluginFuncs->javaClass	  = Private_GetJavaClass();

	// NPP_Initialize is a standard (cross-platform) initialize function.
	// I have no idea why it's only called thru this function and I don't
	// even understand the existence of this function
    return NPP_Initialize();
}
コード例 #3
0
ファイル: NPSqueakStub.c プロジェクト: Geal/Squeak-VM
int main(NPNetscapeFuncs* nsTable, NPPluginFuncs* pluginFuncs, NPP_ShutdownUPP* unloadUpp)
{
	int err=noErr;
	int navMinorVers = nsTable->version & 0xFF;
	
	gRememberOldgNetscapeFuncsForSafariIssue = *nsTable;
	
	gWhere = LoadLibViaPath("NPSqueak.bundle");
	if (gWhere == nil)
		return -1;
		
	GetMain = (void *) ioFindExternalFunctionIn("npmain",(int) gWhere);
	if (GetMain == NULL) 
		GetMain = (void *) ioFindExternalFunctionIn("main",(int) gWhere);
	err = GetMain(nsTable, pluginFuncs, unloadUpp);
	
	//
	// 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(Private_New);
	pluginFuncs->destroy = NewNPP_DestroyProc(Private_Destroy);
	pluginFuncs->setwindow = NewNPP_SetWindowProc(Private_SetWindow);
	pluginFuncs->newstream = NewNPP_NewStreamProc(Private_NewStream);
	pluginFuncs->destroystream = NewNPP_DestroyStreamProc(Private_DestroyStream);
	pluginFuncs->asfile = NewNPP_StreamAsFileProc(Private_StreamAsFile);
	pluginFuncs->writeready = NewNPP_WriteReadyProc(Private_WriteReady);
	pluginFuncs->write = NewNPP_WriteProc(Private_Write);
	pluginFuncs->print = NewNPP_PrintProc(Private_Print);
	pluginFuncs->event = NewNPP_HandleEventProc(Private_HandleEvent);	
	if( navMinorVers >= NPVERS_HAS_NOTIFICATION )
	{	
		pluginFuncs->urlnotify = NewNPP_URLNotifyProc(Private_URLNotify);			
	}
	if( navMinorVers >= NPVERS_HAS_LIVECONNECT )
	{
		pluginFuncs->javaClass	= (JRIGlobalRef) Private_GetJavaClass();
	}
	*unloadUpp = NewNPP_ShutdownProc(Private_Shutdown);

	return err;
}
コード例 #4
0
ファイル: npwin.c プロジェクト: BouKiCHi/nezplay
NPError WINAPI NP_Initialize(NPNetscapeFuncs *pFuncs)
{
	int navMinorVersion;
	if(pFuncs == NULL)
		return NPERR_INVALID_FUNCTABLE_ERROR;
	g_pNavigatorFuncs = pFuncs;
	if(HIBYTE(g_pNavigatorFuncs->version) > NP_VERSION_MAJOR)
		return NPERR_INCOMPATIBLE_VERSION_ERROR;
	navMinorVersion = g_pNavigatorFuncs->version & 0xFF;
	if (navMinorVersion >= NPVERS_HAS_NOTIFICATION)
	{
		g_pluginFuncs->urlnotify = NPP_URLNotify;
	}
	if (navMinorVersion >= NPVERS_HAS_LIVECONNECT)
	{
		g_pluginFuncs->javaClass = Private_GetJavaClass();
	}
	return NPP_Initialize();
}
コード例 #5
0
ファイル: npmngplg.c プロジェクト: 03050903/Torque3D
NPError WINAPI NP_Initialize(NPNetscapeFuncs* pFuncs)
{
	int navMinorVers;

    if(!pFuncs) return NPERR_INVALID_FUNCTABLE_ERROR;

    g_pNavigatorFuncs = pFuncs; // save it for future reference 

    if(HIBYTE(pFuncs->version) > NP_VERSION_MAJOR)
        return NPERR_INCOMPATIBLE_VERSION_ERROR;

    navMinorVers = g_pNavigatorFuncs->version & 0xFF;
	if(navMinorVers>=NPVERS_HAS_NOTIFICATION)
		g_pluginFuncs->urlnotify = NPP_URLNotify;
	if( navMinorVers>=NPVERS_HAS_LIVECONNECT)
		g_pluginFuncs->javaClass = Private_GetJavaClass();

    return NPP_Initialize();
}
コード例 #6
0
ファイル: npwin.cpp プロジェクト: deepmatrix/blaxxun-cc3d
void Private_SetJavaClass()
{
	if (!g_pluginFuncs->javaClass)
		g_pluginFuncs->javaClass = Private_GetJavaClass();
}
コード例 #7
0
ファイル: npwin.c プロジェクト: Limsik/e17
//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\.
////\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//.
// NP_Initialize
//
//	called immediately after the plugin DLL is loaded
//
NPError WINAPI NP_EXPORT
NP_Initialize(NPNetscapeFuncs* pFuncs)
{
    // trap a NULL ptr
    if(pFuncs == NULL)
	return NPERR_INVALID_FUNCTABLE_ERROR;

    g_pNavigatorFuncs = pFuncs; // save it for future reference

    // if the plugin's major ver level is lower than the Navigator's,
    // then they are incompatible, and should return an error
    if(HIBYTE(pFuncs->version) > NP_VERSION_MAJOR)
	return NPERR_INCOMPATIBLE_VERSION_ERROR;

    // We have to defer these assignments until g_pNavigatorFuncs is set
    int navMinorVers = g_pNavigatorFuncs->version & 0xFF;

    if( navMinorVers >= NPVERS_HAS_NOTIFICATION ) {
	g_pluginFuncs->urlnotify = NPP_URLNotify;
    }

#ifdef WIN32 // An ugly hack, because Win16 lags behind in Java
    if( navMinorVers >= NPVERS_HAS_LIVECONNECT ) {
#else
    if( navMinorVers >= NPVERS_WIN16_HAS_LIVECONNECT ) {
#endif // WIN32
	g_pluginFuncs->javaClass = Private_GetJavaClass();
    }

    // NPP_Initialize is a standard (cross-platform) initialize function.
    return NPP_Initialize();
}

//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\.
////\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//.
// NP_Shutdown
//
//	called immediately before the plugin DLL is unloaded.
//	This functio shuold check for some ref count on the dll to see if it is
//	unloadable or it needs to stay in memory.
//
NPError WINAPI NP_EXPORT
NP_Shutdown()
{
    NPP_Shutdown();
    g_pNavigatorFuncs = NULL;
    return NPERR_NO_ERROR;
}

//						END - PLUGIN DLL entry points
////\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//.
//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\.

/*    NAVIGATOR Entry points    */

/* These entry points expect to be called from within the plugin.  The
   noteworthy assumption is that DS has already been set to point to the
   plugin's DLL data segment.  Don't call these functions from outside
   the plugin without ensuring DS is set to the DLLs data segment first,
   typically using the NP_LOADDS macro
*/

// TOR
void NPN_InvalidateRect(NPP instance, NPRect *rect)
{
    return g_pNavigatorFuncs->invalidaterect(instance, rect);
}

/* returns the major/minor version numbers of the Plugin API for the plugin
   and the Navigator
*/
void NPN_Version(int* plugin_major, int* plugin_minor, int* netscape_major, int* netscape_minor)
{
    *plugin_major   = NP_VERSION_MAJOR;
    *plugin_minor   = NP_VERSION_MINOR;
    *netscape_major = HIBYTE(g_pNavigatorFuncs->version);
    *netscape_minor = LOBYTE(g_pNavigatorFuncs->version);
}