зеркало из https://github.com/mozilla/pjs.git
Cleaning up obsolete dead code, see bug 314432. r=josh sr=pink
This commit is contained in:
Родитель
20eabdfc00
Коммит
4bc6c3332f
|
@ -36,22 +36,10 @@
|
||||||
* ***** END LICENSE BLOCK ***** */
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
|
|
||||||
#ifndef _NPAPI_H_
|
|
||||||
#include "npapi.h"
|
#include "npapi.h"
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef XP_MACOSX
|
#include <Carbon/Carbon.h>
|
||||||
#undef DARWIN
|
|
||||||
#include <CoreFoundation/CoreFoundation.h>
|
#include <CoreFoundation/CoreFoundation.h>
|
||||||
#else
|
|
||||||
#include <Gestalt.h>
|
|
||||||
#include <Icons.h>
|
|
||||||
#include <Resources.h>
|
|
||||||
#include <Processes.h>
|
|
||||||
#include <Script.h>
|
|
||||||
#include <TextUtils.h>
|
|
||||||
#include <CFPreferences.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
@ -146,10 +134,6 @@ Boolean CPlugin::sRunningOnOSX = false;
|
||||||
|
|
||||||
extern short gResFile;
|
extern short gResFile;
|
||||||
|
|
||||||
#if !TARGET_API_MAC_CARBON
|
|
||||||
extern QDGlobals* gQDPtr;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// 'cicn'
|
// 'cicn'
|
||||||
const short rBrokenPluginIcon = 326;
|
const short rBrokenPluginIcon = 326;
|
||||||
|
|
||||||
|
@ -169,34 +153,6 @@ const short rTypeListStrings = 129;
|
||||||
static const char szPluginFinderCommandBeginning[] = PLUGINFINDER_COMMAND_BEGINNING;
|
static const char szPluginFinderCommandBeginning[] = PLUGINFINDER_COMMAND_BEGINNING;
|
||||||
static const char szPluginFinderCommandEnd[] = PLUGINFINDER_COMMAND_END;
|
static const char szPluginFinderCommandEnd[] = PLUGINFINDER_COMMAND_END;
|
||||||
|
|
||||||
//#ifndef XP_MACOSX
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------
|
|
||||||
// strcasecomp: Why don't the MW C libraries have this??
|
|
||||||
//------------------------------------------------------------------------------------
|
|
||||||
#define XP_TO_LOWER(i) ((((unsigned int) (i)) > 0x7f) ? (int) (i) : tolower(i))
|
|
||||||
int strcasecmp (const char* one, const char *two);
|
|
||||||
|
|
||||||
int strcasecmp (const char* one, const char *two)
|
|
||||||
{
|
|
||||||
const char *pA;
|
|
||||||
const char *pB;
|
|
||||||
|
|
||||||
for(pA=one, pB=two; *pA && *pB; pA++, pB++)
|
|
||||||
{
|
|
||||||
int tmp = XP_TO_LOWER(*pA) - XP_TO_LOWER(*pB);
|
|
||||||
if (tmp)
|
|
||||||
return tmp;
|
|
||||||
}
|
|
||||||
if (*pA)
|
|
||||||
return 1;
|
|
||||||
if (*pB)
|
|
||||||
return -1;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
//#endif // XP_MACOSX
|
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------
|
||||||
// NPP_Initialize:
|
// NPP_Initialize:
|
||||||
|
@ -740,12 +696,8 @@ void CPlugin::Draw(HiliteState hilite)
|
||||||
RGBForeColor(&black);
|
RGBForeColor(&black);
|
||||||
RGBBackColor(&white);
|
RGBBackColor(&white);
|
||||||
|
|
||||||
#if !TARGET_API_MAC_CARBON
|
|
||||||
FillRect(&drawRect, &(gQDPtr->white));
|
|
||||||
#else
|
|
||||||
Pattern qdWhite;
|
Pattern qdWhite;
|
||||||
FillRect(&drawRect, GetQDGlobalsWhite(&qdWhite));
|
FillRect(&drawRect, GetQDGlobalsWhite(&qdWhite));
|
||||||
#endif
|
|
||||||
|
|
||||||
if (hilite == kHilited) {
|
if (hilite == kHilited) {
|
||||||
hiliteColor.red = 0xFFFF;
|
hiliteColor.red = 0xFFFF;
|
||||||
|
@ -835,11 +787,7 @@ Boolean CPlugin::FocusDraw()
|
||||||
GetPort(&fSavePort);
|
GetPort(&fSavePort);
|
||||||
SetPort((GrafPtr) ourPort);
|
SetPort((GrafPtr) ourPort);
|
||||||
Rect portRect;
|
Rect portRect;
|
||||||
#if !TARGET_API_MAC_CARBON
|
|
||||||
portRect = ourPort->portRect;
|
|
||||||
#else
|
|
||||||
GetPortBounds(ourPort, &portRect);
|
GetPortBounds(ourPort, &portRect);
|
||||||
#endif
|
|
||||||
fSavePortTop = portRect.top;
|
fSavePortTop = portRect.top;
|
||||||
fSavePortLeft = portRect.left;
|
fSavePortLeft = portRect.left;
|
||||||
GetClip(fSaveClip);
|
GetClip(fSaveClip);
|
||||||
|
@ -1193,12 +1141,8 @@ void CPlugin::AskAndLoadURL()
|
||||||
|
|
||||||
// NOTE: We need to set the cursor because almost always we will have set it to the
|
// NOTE: We need to set the cursor because almost always we will have set it to the
|
||||||
// hand cursor before we get here.
|
// hand cursor before we get here.
|
||||||
#if !TARGET_API_MAC_CARBON
|
|
||||||
SetCursor(&(gQDPtr->arrow));
|
|
||||||
#else
|
|
||||||
Cursor qdArrow;
|
Cursor qdArrow;
|
||||||
SetCursor(GetQDGlobalsArrow(&qdArrow));
|
SetCursor(GetQDGlobalsArrow(&qdArrow));
|
||||||
#endif
|
|
||||||
|
|
||||||
// Now that weÕve queried the user about this mime type,
|
// Now that weÕve queried the user about this mime type,
|
||||||
// add it to our list so we wonÕt bug them again.
|
// add it to our list so we wonÕt bug them again.
|
||||||
|
|
|
@ -6,76 +6,11 @@
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <Processes.h>
|
#include <Carbon/Carbon.h>
|
||||||
#include <Gestalt.h>
|
|
||||||
#include <CodeFragments.h>
|
|
||||||
#include <Timer.h>
|
|
||||||
#include <Resources.h>
|
|
||||||
#include <ToolUtils.h>
|
|
||||||
|
|
||||||
#define XP_MAC 1
|
|
||||||
|
|
||||||
//
|
|
||||||
// A4Stuff.h contains the definition of EnterCodeResource and
|
|
||||||
// EnterCodeResource, used for setting up the code resourceÕs
|
|
||||||
// globals for 68K (analagous to the function SetCurrentA5
|
|
||||||
// defined by the toolbox).
|
|
||||||
//
|
|
||||||
// A4Stuff does not exist as of CW 7. Define them to nothing.
|
|
||||||
//
|
|
||||||
|
|
||||||
#if (defined(__MWERKS__) && (__MWERKS__ >= 0x2400)) || defined(__GNUC__)
|
|
||||||
#define EnterCodeResource()
|
|
||||||
#define ExitCodeResource()
|
|
||||||
#else
|
|
||||||
#include <A4Stuff.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "npapi.h"
|
#include "npapi.h"
|
||||||
|
|
||||||
//
|
|
||||||
// The Mixed Mode procInfos defined in npupp.h assume Think C-
|
|
||||||
// style calling conventions. These conventions are used by
|
|
||||||
// Metrowerks with the exception of pointer return types, which
|
|
||||||
// in Metrowerks 68K are returned in A0, instead of the standard
|
|
||||||
// D0. Thus, since NPN_MemAlloc and NPN_UserAgent return pointers,
|
|
||||||
// Mixed Mode will return the values to a 68K plugin in D0, but
|
|
||||||
// a 68K plugin compiled by Metrowerks will expect the result in
|
|
||||||
// A0. The following pragma forces Metrowerks to use D0 instead.
|
|
||||||
//
|
|
||||||
#ifdef __MWERKS__
|
|
||||||
#ifndef powerc
|
|
||||||
#pragma pointers_in_D0
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "npupp.h"
|
#include "npupp.h"
|
||||||
|
|
||||||
#ifdef __MWERKS__
|
|
||||||
#ifndef powerc
|
|
||||||
#pragma pointers_in_A0
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// The following fix for static initializers (which fixes a previous
|
|
||||||
// incompatibility with some parts of PowerPlant, was submitted by
|
|
||||||
// Jan Ulbrich.
|
|
||||||
#ifdef __MWERKS__
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
#ifndef powerc
|
|
||||||
extern void __InitCode__(void);
|
|
||||||
#else
|
|
||||||
extern void __sinit(void);
|
|
||||||
#define __InitCode__ __sinit
|
|
||||||
#endif
|
|
||||||
extern void __destroy_global_chain(void);
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif // __cplusplus
|
|
||||||
#endif // __MWERKS__
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Define PLUGIN_TRACE to 1 to have the wrapper functions emit
|
// Define PLUGIN_TRACE to 1 to have the wrapper functions emit
|
||||||
// DebugStr messages whenever they are called.
|
// DebugStr messages whenever they are called.
|
||||||
|
@ -96,7 +31,7 @@ struct TFPtoTVGlue{
|
||||||
void* glue[2];
|
void* glue[2];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct {
|
struct pluginFuncsGlueTable {
|
||||||
TFPtoTVGlue newp;
|
TFPtoTVGlue newp;
|
||||||
TFPtoTVGlue destroy;
|
TFPtoTVGlue destroy;
|
||||||
TFPtoTVGlue setwindow;
|
TFPtoTVGlue setwindow;
|
||||||
|
@ -128,7 +63,7 @@ struct TTVtoFPGlue {
|
||||||
uint32 glue[6];
|
uint32 glue[6];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct {
|
struct netscapeFuncsGlueTable {
|
||||||
TTVtoFPGlue geturl;
|
TTVtoFPGlue geturl;
|
||||||
TTVtoFPGlue posturl;
|
TTVtoFPGlue posturl;
|
||||||
TTVtoFPGlue requestread;
|
TTVtoFPGlue requestread;
|
||||||
|
@ -184,9 +119,6 @@ static void* SetupTVtoFPGlue(TTVtoFPGlue* functionGlue, void* tvp)
|
||||||
//
|
//
|
||||||
//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
|
||||||
|
|
||||||
#if !TARGET_API_MAC_CARBON
|
|
||||||
QDGlobals* gQDPtr; // Pointer to NetscapeÕs QuickDraw globals
|
|
||||||
#endif
|
|
||||||
short gResFile; // Refnum of the pluginÕs resource file
|
short gResFile; // Refnum of the pluginÕs resource file
|
||||||
NPNetscapeFuncs gNetscapeFuncs; // Function table for procs in Netscape called by plugin
|
NPNetscapeFuncs gNetscapeFuncs; // Function table for procs in Netscape called by plugin
|
||||||
|
|
||||||
|
@ -411,140 +343,90 @@ jobject Private_GetJavaClass(void);
|
||||||
|
|
||||||
NPError Private_Initialize(void)
|
NPError Private_Initialize(void)
|
||||||
{
|
{
|
||||||
NPError err;
|
|
||||||
EnterCodeResource();
|
|
||||||
PLUGINDEBUGSTR("\pInitialize;g;");
|
PLUGINDEBUGSTR("\pInitialize;g;");
|
||||||
err = NPP_Initialize();
|
return NPP_Initialize();
|
||||||
ExitCodeResource();
|
|
||||||
return err;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Private_Shutdown(void)
|
void Private_Shutdown(void)
|
||||||
{
|
{
|
||||||
EnterCodeResource();
|
|
||||||
PLUGINDEBUGSTR("\pShutdown;g;");
|
PLUGINDEBUGSTR("\pShutdown;g;");
|
||||||
NPP_Shutdown();
|
NPP_Shutdown();
|
||||||
|
|
||||||
#ifdef __MWERKS__
|
|
||||||
__destroy_global_chain();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
ExitCodeResource();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NPError Private_New(NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, char* argn[], char* argv[], NPSavedData* saved)
|
NPError Private_New(NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, char* argn[], char* argv[], NPSavedData* saved)
|
||||||
{
|
{
|
||||||
EnterCodeResource();
|
|
||||||
NPError ret = NPP_New(pluginType, instance, mode, argc, argn, argv, saved);
|
|
||||||
PLUGINDEBUGSTR("\pNew;g;");
|
PLUGINDEBUGSTR("\pNew;g;");
|
||||||
ExitCodeResource();
|
return NPP_New(pluginType, instance, mode, argc, argn, argv, saved);
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NPError Private_Destroy(NPP instance, NPSavedData** save)
|
NPError Private_Destroy(NPP instance, NPSavedData** save)
|
||||||
{
|
{
|
||||||
NPError err;
|
|
||||||
EnterCodeResource();
|
|
||||||
PLUGINDEBUGSTR("\pDestroy;g;");
|
PLUGINDEBUGSTR("\pDestroy;g;");
|
||||||
err = NPP_Destroy(instance, save);
|
return NPP_Destroy(instance, save);
|
||||||
ExitCodeResource();
|
|
||||||
return err;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NPError Private_SetWindow(NPP instance, NPWindow* window)
|
NPError Private_SetWindow(NPP instance, NPWindow* window)
|
||||||
{
|
{
|
||||||
NPError err;
|
|
||||||
EnterCodeResource();
|
|
||||||
PLUGINDEBUGSTR("\pSetWindow;g;");
|
PLUGINDEBUGSTR("\pSetWindow;g;");
|
||||||
err = NPP_SetWindow(instance, window);
|
return NPP_SetWindow(instance, window);
|
||||||
ExitCodeResource();
|
|
||||||
return err;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NPError Private_NewStream(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16* stype)
|
NPError Private_NewStream(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16* stype)
|
||||||
{
|
{
|
||||||
NPError err;
|
|
||||||
EnterCodeResource();
|
|
||||||
PLUGINDEBUGSTR("\pNewStream;g;");
|
PLUGINDEBUGSTR("\pNewStream;g;");
|
||||||
err = NPP_NewStream(instance, type, stream, seekable, stype);
|
return NPP_NewStream(instance, type, stream, seekable, stype);
|
||||||
ExitCodeResource();
|
|
||||||
return err;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int32 Private_WriteReady(NPP instance, NPStream* stream)
|
int32 Private_WriteReady(NPP instance, NPStream* stream)
|
||||||
{
|
{
|
||||||
int32 result;
|
|
||||||
EnterCodeResource();
|
|
||||||
PLUGINDEBUGSTR("\pWriteReady;g;");
|
PLUGINDEBUGSTR("\pWriteReady;g;");
|
||||||
result = NPP_WriteReady(instance, stream);
|
return NPP_WriteReady(instance, stream);
|
||||||
ExitCodeResource();
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int32 Private_Write(NPP instance, NPStream* stream, int32 offset, int32 len, void* buffer)
|
int32 Private_Write(NPP instance, NPStream* stream, int32 offset, int32 len, void* buffer)
|
||||||
{
|
{
|
||||||
int32 result;
|
|
||||||
EnterCodeResource();
|
|
||||||
PLUGINDEBUGSTR("\pWrite;g;");
|
PLUGINDEBUGSTR("\pWrite;g;");
|
||||||
result = NPP_Write(instance, stream, offset, len, buffer);
|
return NPP_Write(instance, stream, offset, len, buffer);
|
||||||
ExitCodeResource();
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Private_StreamAsFile(NPP instance, NPStream* stream, const char* fname)
|
void Private_StreamAsFile(NPP instance, NPStream* stream, const char* fname)
|
||||||
{
|
{
|
||||||
EnterCodeResource();
|
|
||||||
PLUGINDEBUGSTR("\pStreamAsFile;g;");
|
PLUGINDEBUGSTR("\pStreamAsFile;g;");
|
||||||
NPP_StreamAsFile(instance, stream, fname);
|
NPP_StreamAsFile(instance, stream, fname);
|
||||||
ExitCodeResource();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NPError Private_DestroyStream(NPP instance, NPStream* stream, NPError reason)
|
NPError Private_DestroyStream(NPP instance, NPStream* stream, NPError reason)
|
||||||
{
|
{
|
||||||
NPError err;
|
|
||||||
EnterCodeResource();
|
|
||||||
PLUGINDEBUGSTR("\pDestroyStream;g;");
|
PLUGINDEBUGSTR("\pDestroyStream;g;");
|
||||||
err = NPP_DestroyStream(instance, stream, reason);
|
return NPP_DestroyStream(instance, stream, reason);
|
||||||
ExitCodeResource();
|
|
||||||
return err;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int16 Private_HandleEvent(NPP instance, void* event)
|
int16 Private_HandleEvent(NPP instance, void* event)
|
||||||
{
|
{
|
||||||
int16 result;
|
|
||||||
EnterCodeResource();
|
|
||||||
PLUGINDEBUGSTR("\pHandleEvent;g;");
|
PLUGINDEBUGSTR("\pHandleEvent;g;");
|
||||||
result = NPP_HandleEvent(instance, event);
|
return NPP_HandleEvent(instance, event);
|
||||||
ExitCodeResource();
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Private_Print(NPP instance, NPPrint* platformPrint)
|
void Private_Print(NPP instance, NPPrint* platformPrint)
|
||||||
{
|
{
|
||||||
EnterCodeResource();
|
|
||||||
PLUGINDEBUGSTR("\pPrint;g;");
|
PLUGINDEBUGSTR("\pPrint;g;");
|
||||||
NPP_Print(instance, platformPrint);
|
NPP_Print(instance, platformPrint);
|
||||||
ExitCodeResource();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Private_URLNotify(NPP instance, const char* url, NPReason reason, void* notifyData)
|
void Private_URLNotify(NPP instance, const char* url, NPReason reason, void* notifyData)
|
||||||
{
|
{
|
||||||
EnterCodeResource();
|
|
||||||
PLUGINDEBUGSTR("\pURLNotify;g;");
|
PLUGINDEBUGSTR("\pURLNotify;g;");
|
||||||
NPP_URLNotify(instance, url, reason, notifyData);
|
NPP_URLNotify(instance, url, reason, notifyData);
|
||||||
ExitCodeResource();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef OJI
|
#ifdef OJI
|
||||||
jobject Private_GetJavaClass(void)
|
jobject Private_GetJavaClass(void)
|
||||||
{
|
{
|
||||||
EnterCodeResource();
|
|
||||||
PLUGINDEBUGSTR("\pGetJavaClass;g;");
|
PLUGINDEBUGSTR("\pGetJavaClass;g;");
|
||||||
|
|
||||||
jobject clazz = NPP_GetJavaClass();
|
jobject clazz = NPP_GetJavaClass();
|
||||||
ExitCodeResource();
|
|
||||||
if (clazz)
|
if (clazz)
|
||||||
{
|
{
|
||||||
JRIEnv* env = NPN_GetJavaEnv();
|
JRIEnv* env = NPN_GetJavaEnv();
|
||||||
|
@ -557,126 +439,20 @@ jobject Private_GetJavaClass(void)
|
||||||
void SetUpQD(void);
|
void SetUpQD(void);
|
||||||
void SetUpQD(void)
|
void SetUpQD(void)
|
||||||
{
|
{
|
||||||
#if !TARGET_API_MAC_CARBON
|
|
||||||
ProcessSerialNumber PSN;
|
|
||||||
FSSpec myFSSpec;
|
|
||||||
Str63 name;
|
|
||||||
ProcessInfoRec infoRec;
|
|
||||||
OSErr result = noErr;
|
|
||||||
CFragConnectionID connID;
|
|
||||||
Str255 errName;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Memorize the pluginÕs resource file
|
// Memorize the pluginÕs resource file
|
||||||
// refnum for later use.
|
// refnum for later use.
|
||||||
//
|
//
|
||||||
gResFile = CurResFile();
|
gResFile = CurResFile();
|
||||||
|
|
||||||
#if !TARGET_API_MAC_CARBON
|
|
||||||
//
|
|
||||||
// Ask the system if CFM is available.
|
|
||||||
//
|
|
||||||
long response;
|
|
||||||
OSErr err = Gestalt(gestaltCFMAttr, &response);
|
|
||||||
Boolean hasCFM = BitTst(&response, 31-gestaltCFMPresent);
|
|
||||||
|
|
||||||
ProcessInfoRec infoRec;
|
|
||||||
if (hasCFM)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// GetProcessInformation takes a process serial number and
|
|
||||||
// will give us back the name and FSSpec of the application.
|
|
||||||
// See the Process Manager in IM.
|
|
||||||
//
|
|
||||||
Str63 name;
|
|
||||||
FSSpec myFSSpec;
|
|
||||||
infoRec.processInfoLength = sizeof(ProcessInfoRec);
|
|
||||||
infoRec.processName = name;
|
|
||||||
infoRec.processAppSpec = &myFSSpec;
|
|
||||||
|
|
||||||
ProcessSerialNumber PSN;
|
|
||||||
PSN.highLongOfPSN = 0;
|
|
||||||
PSN.lowLongOfPSN = kCurrentProcess;
|
|
||||||
|
|
||||||
result = GetProcessInformation(&PSN, &infoRec);
|
|
||||||
if (result != noErr)
|
|
||||||
PLUGINDEBUGSTR("\pFailed in GetProcessInformation");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
//
|
|
||||||
// If no CFM installed, assume it must be a 68K app.
|
|
||||||
//
|
|
||||||
result = -1;
|
|
||||||
|
|
||||||
CFragConnectionID connID;
|
|
||||||
if (result == noErr)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// Now that we know the app name and FSSpec, we can call GetDiskFragment
|
|
||||||
// to get a connID to use in a subsequent call to FindSymbol (it will also
|
|
||||||
// return the address of ÒmainÓ in app, which we ignore). If GetDiskFragment
|
|
||||||
// returns an error, we assume the app must be 68K.
|
|
||||||
//
|
|
||||||
Ptr mainAddr;
|
|
||||||
Str255 errName;
|
|
||||||
result = GetDiskFragment(infoRec.processAppSpec, 0L, 0L, infoRec.processName,
|
|
||||||
kLoadCFrag, &connID, (Ptr*)&mainAddr, errName);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (result == noErr)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// The app is a PPC code fragment, so call FindSymbol
|
|
||||||
// to get the exported ÒqdÓ symbol so we can access its
|
|
||||||
// QuickDraw globals.
|
|
||||||
//
|
|
||||||
CFragSymbolClass symClass;
|
|
||||||
result = FindSymbol(connID, "\pqd", (Ptr*)&gQDPtr, &symClass);
|
|
||||||
if (result != noErr) { // this fails if we are in NS 6
|
|
||||||
gQDPtr = &qd; // so we default to the standard QD globals
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// The app is 68K, so use its A5 to compute the address
|
|
||||||
// of its QuickDraw globals.
|
|
||||||
//
|
|
||||||
gQDPtr = (QDGlobals*)(*((long*)SetCurrentA5()) - (sizeof(QDGlobals) - sizeof(GrafPtr)));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef __GNUC__
|
|
||||||
// gcc requires that main have an 'int' return type
|
|
||||||
int main(NPNetscapeFuncs* nsTable, NPPluginFuncs* pluginFuncs, NPP_ShutdownUPP* unloadUpp);
|
int main(NPNetscapeFuncs* nsTable, NPPluginFuncs* pluginFuncs, NPP_ShutdownUPP* unloadUpp);
|
||||||
#else
|
|
||||||
NPError main(NPNetscapeFuncs* nsTable, NPPluginFuncs* pluginFuncs, NPP_ShutdownUPP* unloadUpp);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !TARGET_API_MAC_CARBON
|
|
||||||
#pragma export on
|
|
||||||
#if GENERATINGCFM
|
|
||||||
RoutineDescriptor mainRD = BUILD_ROUTINE_DESCRIPTOR(uppNPP_MainEntryProcInfo, main);
|
|
||||||
#endif
|
|
||||||
#pragma export off
|
|
||||||
#endif /* !TARGET_API_MAC_CARBON */
|
|
||||||
|
|
||||||
#ifdef __GNUC__
|
|
||||||
DEFINE_API_C(int) main(NPNetscapeFuncs* nsTable, NPPluginFuncs* pluginFuncs, NPP_ShutdownUPP* unloadUpp)
|
DEFINE_API_C(int) main(NPNetscapeFuncs* nsTable, NPPluginFuncs* pluginFuncs, NPP_ShutdownUPP* unloadUpp)
|
||||||
#else
|
|
||||||
DEFINE_API_C(NPError) main(NPNetscapeFuncs* nsTable, NPPluginFuncs* pluginFuncs, NPP_ShutdownUPP* unloadUpp)
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
EnterCodeResource();
|
|
||||||
PLUGINDEBUGSTR("\pmain");
|
PLUGINDEBUGSTR("\pmain");
|
||||||
|
|
||||||
#ifdef __MWERKS__
|
|
||||||
__InitCode__();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
NPError err = NPERR_NO_ERROR;
|
NPError err = NPERR_NO_ERROR;
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -778,6 +554,5 @@ DEFINE_API_C(NPError) main(NPNetscapeFuncs* nsTable, NPPluginFuncs* pluginFuncs,
|
||||||
err = Private_Initialize();
|
err = Private_Initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
ExitCodeResource();
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче