MWCC/includes/plugin.h

202 lines
9.8 KiB
C
Raw Normal View History

2022-10-14 22:15:32 +00:00
#pragma once
#include "CWPlugins.h"
#include "CWPluginErrors.h"
#include "DropInCompilerLinker.h"
#ifdef __MWERKS__
#pragma options align=mac68k
#endif
#if CWPLUGIN_API == CWPLUGIN_API_MACOS
#define CWFileSpecNotEmpty(specPtr) ((specPtr)->name[0] != 0)
#elif CWPLUGIN_API == CWPLUGIN_API_WIN32
#define CWFileSpecNotEmpty(specPtr) ((specPtr)->path[0] != 0)
#elif CWPLUGIN_API == CWPLUGIN_API_UNIX
#define CWFileSpecNotEmpty(specPtr) ((specPtr)->path[0] != 0)
#endif
enum {
CWDROPINPARSERTYPE = CWFOURCHAR('P','a','r','s')
};
typedef struct IDEAccessPath {
FSSpec pathSpec;
Boolean recursive;
SInt32 subdirectoryCount;
FSSpec *subdirectories;
} IDEAccessPath;
typedef struct IDEAccessPathList {
SInt32 userPathCount;
IDEAccessPath *userPaths;
SInt32 systemPathCount;
IDEAccessPath *systemPaths;
Boolean alwaysSearchUserPaths;
Boolean convertPaths;
} IDEAccessPathList;
enum {
cwAccessPathTypeFlag2 = 2
};
typedef struct CWNewAccessPathInfo {
CWFileSpec pathSpec;
SInt32 position;
Boolean recursive;
CWAccessPathType type;
} CWNewAccessPathInfo;
typedef struct CWTargetInfoV7 {
CWFileSpec outfile;
CWFileSpec symfile;
short linkType;
Boolean canRun;
Boolean canDebug;
Boolean useRunHelperApp;
char reserved1;
CWDataType debuggerCreator;
CWDataType runHelperCreator;
SInt32 reserved2[2];
} CWTargetInfoV7;
typedef struct CWEnvVarInfo {
char *name;
char *value;
} CWEnvVarInfo;
typedef struct CWCommandLineArgs {
int argc;
char **argv;
char **envp;
} CWCommandLineArgs;
typedef struct ToolVersionInfo {
char *company;
char *product;
char *tool;
char *copyright;
char *version;
} ToolVersionInfo;
typedef struct CLPluginInfo {
OSType plugintype;
OSType language;
SInt32 dropinflags;
char *version;
Boolean storeCommandLine;
} CLPluginInfo;
struct CW_BasePluginCallbacks {
CWResult (*cbGetFileInfo)(CWPluginContext, SInt32, Boolean, CWProjectFileInfo *);
CWResult (*cbFindAndLoadFile)(CWPluginContext, const char *, CWFileInfo *);
CWResult (*cbGetFileText)(CWPluginContext, const CWFileSpec *, const char **, SInt32 *, short *);
CWResult (*cbReleaseFileText)(CWPluginContext, const char *);
CWResult (*cbGetSegmentInfo)(CWPluginContext, SInt32, CWProjectSegmentInfo *);
CWResult (*cbGetOverlay1GroupInfo)(CWPluginContext, SInt32, CWOverlay1GroupInfo *);
CWResult (*cbGetOverlay1Info)(CWPluginContext, SInt32, SInt32, CWOverlay1Info *);
CWResult (*cbGetOverlay1FileInfo)(CWPluginContext, SInt32, SInt32, SInt32, CWOverlay1FileInfo *);
CWResult (*cbReportMessage)(CWPluginContext, const CWMessageRef *, const char *, const char *, short, SInt32);
CWResult (*cbAlert)(CWPluginContext, const char *, const char *, const char *, const char *);
CWResult (*cbShowStatus)(CWPluginContext, const char *, const char *);
CWResult (*cbUserBreak)(CWPluginContext);
CWResult (*cbGetNamedPreferences)(CWPluginContext, const char *, CWMemHandle *);
CWResult (*cbStorePluginData)(CWPluginContext, SInt32, CWDataType, CWMemHandle);
CWResult (*cbGetPluginData)(CWPluginContext, SInt32, CWDataType, CWMemHandle *);
CWResult (*cbSetModDate)(CWPluginContext, const CWFileSpec *, CWFileTime *, Boolean);
CWResult (*cbAddProjectEntry)(CWPluginContext, const CWFileSpec *, Boolean, const CWNewProjectEntryInfo *, SInt32 *);
CWResult (*cbCreateNewTextDocument)(CWPluginContext, const CWNewTextDocumentInfo *);
CWResult (*cbAllocateMemory)(CWPluginContext, SInt32, Boolean, void **);
CWResult (*cbFreeMemory)(CWPluginContext, void *, Boolean);
CWResult (*cbAllocMemHandle)(CWPluginContext, SInt32, Boolean, CWMemHandle *);
CWResult (*cbFreeMemHandle)(CWPluginContext, CWMemHandle);
CWResult (*cbGetMemHandleSize)(CWPluginContext, CWMemHandle, SInt32 *);
CWResult (*cbResizeMemHandle)(CWPluginContext, CWMemHandle, SInt32);
CWResult (*cbLockMemHandle)(CWPluginContext, CWMemHandle, Boolean, void **);
CWResult (*cbUnlockMemHandle)(CWPluginContext, CWMemHandle);
void *cbInternal[8];
CWResult (*cbGetTargetName)(CWPluginContext, char *, short);
CWResult (*cbCacheAccessPathList)(CWPluginContext);
CWResult (*cbPreDialog)(CWPluginContext);
CWResult (*cbPostDialog)(CWPluginContext);
CWResult (*cbPreFileAction)(CWPluginContext, const CWFileSpec *);
CWResult (*cbPostFileAction)(CWPluginContext, const CWFileSpec *);
CWResult (*cbCheckoutLicense)(CWPluginContext, const char *, const char *, SInt32, void *, SInt32 *);
CWResult (*cbCheckinLicense)(CWPluginContext, SInt32);
CWResult (*cbResolveRelativePath)(CWPluginContext, const CWRelativePath *, CWFileSpec *, Boolean);
};
struct CWCompilerLinkerCallbacks {
CWResult (*cbCachePrecompiledHeader)(CWPluginContext, const CWFileSpec *, CWMemHandle);
CWResult (*cbLoadObjectData)(CWPluginContext, SInt32, CWMemHandle *);
CWResult (*cbStoreObjectData)(CWPluginContext, SInt32, CWObjectData *);
CWResult (*cbFreeObjectData)(CWPluginContext, SInt32, CWMemHandle);
CWResult (*cbDisplayLines)(CWPluginContext, SInt32);
CWResult (*cbBeginSubCompile)(CWPluginContext, SInt32, CWPluginContext *);
CWResult (*cbEndSubCompile)(CWPluginContext);
CWResult (*cbGetPrecompiledHeaderSpec)(CWPluginContext, CWFileSpec *, const char *);
CWResult (*cbGetResourceFile)(CWPluginContext, CWFileSpec *);
CWResult (*cbPutResourceFile)(CWPluginContext, const char *, const char *, CWFileSpec *);
CWResult (*cbLookUpUnit)(CWPluginContext, const char *, Boolean, const void **, SInt32 *);
CWResult (*cbSBMfiles)(CWPluginContext, short);
CWResult (*cbStoreUnit)(CWPluginContext, const char *, CWMemHandle, CWDependencyTag);
CWResult (*cbReleaseUnit)(CWPluginContext, void *);
CWResult (*cbUnitNameToFileName)(CWPluginContext, const char *, char *);
CWResult (*cbOSErrorMessage)(CWPluginContext, const char *, OSErr);
CWResult (*cbOSAlert)(CWPluginContext, const char *, OSErr);
CWResult (*cbGetModifiedFiles)(CWPluginContext, SInt32 *, const SInt32 **);
CWResult (*cbGetSuggestedObjectFileSpec)(CWPluginContext, SInt32, CWFileSpec *);
CWResult (*cbGetStoredObjectFileSpec)(CWPluginContext, SInt32, CWFileSpec *);
CWResult (*cbGetRuntimeSettings)(CWPluginContext);
CWResult (*cbGetFrameworkCount)(CWPluginContext, SInt32 *);
CWResult (*cbGetFrameworkInfo)(CWPluginContext, SInt32, CWFrameworkInfo *);
CWResult (*cbGetFrameworkSharedLibrary)(CWPluginContext);
};
struct CWParserCallbacks {
CWResult (*cbParserAddAccessPath)(CWPluginContext, const CWNewAccessPathInfo *);
CWResult (*cbParserSwapAccessPaths)(CWPluginContext);
CWResult (*cbParserSetNamedPreferences)(CWPluginContext, const char *, CWMemHandle);
CWResult (*cbParserSetFileOutputName)(CWPluginContext, SInt32, short, const char *);
CWResult (*cbParserSetOutputFileDirectory)(CWPluginContext, const CWFileSpec *);
CWResult (*cbParserAddOverlay1Group)(CWPluginContext, const char *, const CWAddr64 *, SInt32 *);
CWResult (*cbParserAddOverlay1)(CWPluginContext, const char *, SInt32, SInt32 *);
CWResult (*cbParserAddSegment)(CWPluginContext, const char *, short, SInt32 *);
CWResult (*cbParserSetSegment)(CWPluginContext, SInt32, const char *, short);
};
#ifdef __MWERKS__
#pragma options align=reset
#endif
#ifdef __cplusplus
extern "C" {
#endif
CW_CALLBACK CWCheckoutLicense(CWPluginContext context, const char *a, const char *b, SInt32 c, void *d, SInt32 *cookiePtr);
CW_CALLBACK CWCheckinLicense(CWPluginContext context, SInt32 cookie);
CW_CALLBACK CWSecretAttachHandle(CWPluginContext context, Handle handle, CWMemHandle *memHandle);
CW_CALLBACK CWSecretDetachHandle(CWPluginContext context, CWMemHandle memHandle, Handle *handle);
CW_CALLBACK CWSecretPeekHandle(CWPluginContext context, CWMemHandle memHandle, Handle *handle);
CW_CALLBACK CWSecretGetNamedPreferences(CWPluginContext context, const char *prefsname, Handle *prefsdata);
CW_CALLBACK CWParserGetBuildDate(CWPluginContext context, const char **buildDate, const char **buildTime);
CW_CALLBACK CWParserGetCommandLine(CWPluginContext context, CWCommandLineArgs **args);
CW_CALLBACK CWParserGetTargetInfo(CWPluginContext context, CWDataType *cpu, CWDataType *os);
CW_CALLBACK CWParserGetToolInfo(CWPluginContext context, const ToolVersionInfo **toolVersionInfo);
CW_CALLBACK CWParserGetPlugins(CWPluginContext context, int *numPlugins, const CLPluginInfo **pluginInfo);
CW_CALLBACK CWParserGetPanels(CWPluginContext context, int *numPanels, const char ***panelNames);
CW_CALLBACK CWParserStoreCommandLineForPanel(CWPluginContext context, int index, const CWCommandLineArgs *args);
CW_CALLBACK CWParserStoreCommandLineForPlugin(CWPluginContext context, int index, const CWCommandLineArgs *args);
CW_CALLBACK CWParserAddAccessPath(CWPluginContext context, const CWNewAccessPathInfo *api);
CW_CALLBACK CWParserSwapAccessPaths(CWPluginContext context);
CW_CALLBACK CWParserSetNamedPreferences(CWPluginContext context, const char *panelName, CWMemHandle paneldata);
CW_CALLBACK CWParserSetFileOutputName(CWPluginContext context, SInt32 position, short which, const char *outfilename);
CW_CALLBACK CWParserSetOutputFileDirectory(CWPluginContext context, const CWFileSpec *idefss);
CW_CALLBACK CWParserAddOverlay1Group(CWPluginContext context, const char *name, const CWAddr64 *addr, SInt32 *newGroupNumber);
CW_CALLBACK CWParserAddOverlay1(CWPluginContext context, const char *name, SInt32 groupNumber, SInt32 *newOverlayNumber);
CW_CALLBACK CWParserAddSegment(CWPluginContext context, const char *name, short attrs, SInt32 *newSegmentNumber);
CW_CALLBACK CWParserSetSegment(CWPluginContext context, SInt32 segmentNumber, const char *name, short attrs);
CW_CALLBACK CWParserCreateVirtualFile(CWPluginContext context, const char *name, CWMemHandle text);
CW_CALLBACK CWParserDisplayTextHandle(CWPluginContext context, const char *name, CWMemHandle text);
#ifdef __cplusplus
}
#endif