MWCC/includes/mwcc_decomp.h

1807 lines
59 KiB
C

#pragma once
#include "common.h"
#include "oslib.h"
#include "macemul.h"
#ifdef __cplusplus
extern "C" {
#endif
/********************************/
/* Option Fuckery */
#ifdef __MWERKS__
#pragma options align=packed
#endif
typedef struct PARAM_T {
char which;
char flags;
char *myname;
struct PARAM_T *next;
} PARAM_T;
typedef struct MASK_T {
char which;
char flags;
char *myname;
PARAM_T *next;
char size;
UInt32 ormask;
UInt32 andmask;
void *num;
} MASK_T;
typedef struct STRING_T {
char which;
char flags;
char *myname;
PARAM_T *next;
SInt16 maxlen;
Boolean pstring;
char *str;
} STRING_T;
typedef struct SET_T {
char which;
char flags;
char *myname;
PARAM_T *next;
char size;
UInt32 value;
char *num;
} SET_T;
typedef struct SETSTRING_T {
char which;
char flags;
char *myname;
PARAM_T *next;
char *value;
char pstring;
void *var;
} SETSTRING_T;
typedef struct GENERIC_T {
char which;
char flags;
char *myname;
PARAM_T *next;
int (*parse)(const char *opt, void *var, const char *pstr, int flags);
void *var;
char *help;
} GENERIC_T;
typedef struct SETTING_T {
char which;
char flags;
char *myname;
PARAM_T *next;
int (*parse)(const char *a, const char *b); // TODO name these args
char *valuename;
} SETTING_T;
typedef struct TOGGLE_T {
char which;
char flags;
char *myname;
PARAM_T *next;
char size;
UInt32 mask;
void *num;
} TOGGLE_T;
typedef struct NUM_T {
char which;
char flags;
char *myname;
PARAM_T *next;
char size;
char fit;
UInt32 lo;
UInt32 hi;
void *num;
} NUM_T;
typedef struct FILEPATH_T {
char which;
char flags;
char *myname;
PARAM_T *next;
char fflags;
char *defaultstr;
void *filename;
int maxlen;
} FILEPATH_T;
typedef struct IFARG_T {
char which;
char flags;
char *myname;
PARAM_T *next;
PARAM_T *parg;
char *helpa;
PARAM_T *pnone;
char *helpn;
} IFARG_T;
typedef struct ONOFF_T {
char which;
char flags;
char *myname;
PARAM_T *next;
unsigned char *var;
} ONOFF_T;
typedef struct OFFON_T {
char which;
char flags;
char *myname;
PARAM_T *next;
unsigned char *var;
} OFFON_T;
typedef struct FTYPE_T {
char which;
char flags;
char *myname;
PARAM_T *next;
OSType *fc;
Boolean iscreator;
} FTYPE_T;
typedef struct OptionList {
char *help;
int flags;
struct Option **list;
} OptionList;
typedef struct Option {
char *names;
int avail;
PARAM_T *param;
OptionList *sub;
OptionList *conflicts;
char *help;
} Option;
enum {
HELPFLAGS_1 = 1,
HELPFLAGS_IGNORED = 2,
HELPFLAGS_OBSOLETE = 4,
HELPFLAGS_DEPRECATED = 8,
HELPFLAGS_SECRET = 0x10,
HELPFLAGS_MEANINGLESS = 0x20,
HELPFLAGS_COMPATIBLE = 0x40,
HELPFLAGS_NORMAL = 0x80, // andmask = 0xE?
HELPFLAGS_SPACES = 0x100,
HELPFLAGS_TOOL = 0x200,
HELPFLAGS_TOOL_THIS = 0x400,
HELPFLAGS_TOOL_OTHER = 0x800,
HELPFLAGS_TOOL_BOTH = 0xC00,
HELPFLAGS_1000 = 0x1000,
HELPFLAGS_2000 = 0x2000,
HELPFLAGS_USAGE = 0x4000,
HELPFLAGS_8000 = 0x8000
};
enum {
OTF_GLOBAL = 1,
OTF2 = 2,
OTF_CASED = 4,
OTF_OBSOLETE = 8,
OTF_SUBSTITUTED = 0x10,
OTF_DEPRECATED = 0x20,
OTF_TOOL_LINKER = 0x40,
OTF_TOOL_DISASSEMBLER = 0x80,
OTF_TOOL_COMPILER = 0x100,
OTF_TOOL_MASK = OTF_TOOL_LINKER | OTF_TOOL_DISASSEMBLER | OTF_TOOL_COMPILER,
OTF200 = 0x200,
OTF400 = 0x400,
OTF700 = 0x700,
OTF_IGNORED = 0x800,
OTFC00 = 0xC00,
OTF_SECRET = 0x1000,
OTF2000 = 0x2000,
OTF_COMPATIBILITY = 0x4000,
OTF8000 = 0x8000,
OTF10000 = 0x10000,
OTF20000 = 0x20000,
OTF40000 = 0x40000,
OTF_WARNING = 0x80000,
OTF_SLFLAGS_8 = 0x100000,
OTF_SLFLAGS_10 = 0x200000,
OTF_SLFLAGS_20 = 0x400000,
OTF_SLFLAGS_MASK = OTF_SLFLAGS_8 | OTF_SLFLAGS_10 | OTF_SLFLAGS_20,
OTF_MEANINGLESS = 0x800000,
OTF_ALL_HIDDEN_BY_DEFAULT = OTF_OBSOLETE | OTF_DEPRECATED | OTF_IGNORED | OTF_SECRET | OTF_MEANINGLESS,
OTF1000000 = 0x1000000,
OTF2000000 = 0x2000000,
OTF4000000 = 0x4000000,
OTF8000000 = 0x8000000,
OTF10000000 = 0x10000000,
OTF20000000 = 0x20000000,
OTF40000000 = 0x40000000,
OTF80000000 = 0x80000000
};
enum {
PARAMWHICH_None = 0,
PARAMWHICH_FTypeCreator = 1,
PARAMWHICH_FilePath = 2,
PARAMWHICH_Number = 3,
PARAMWHICH_String = 4,
PARAMWHICH_Id = 5,
PARAMWHICH_Sym = 6,
PARAMWHICH_OnOff = 7,
PARAMWHICH_OffOn = 8,
PARAMWHICH_Mask = 9,
PARAMWHICH_Toggle = 0xA,
PARAMWHICH_Set = 0xB,
PARAMWHICH_SetString = 0xC,
PARAMWHICH_Generic = 0xD,
PARAMWHICH_IfArg = 0xE,
PARAMWHICH_Setting = 0xF,
PARAMWHICH_MAX = 0x10
};
enum {
PARAMFLAGS_1 = 1,
PARAMFLAGS_2 = 2,
PARAMFLAGS_3 = 3,
PARAMFLAGS_4 = 4,
PARAMFLAGS_8 = 8,
PARAMFLAGS_10 = 0x10,
PARAMFLAGS_12 = 0x12
};
enum {
PARAMPARSEFLAGS_0 = 0,
PARAMPARSEFLAGS_1 = 1,
PARAMPARSEFLAGS_2 = 2,
PARAMPARSEFLAGS_4 = 4,
PARAMPARSEFLAGS_8 = 8,
PARAMPARSEFLAGS_10 = 0x10,
PARAMPARSEFLAGS_20 = 0x20,
PARAMPARSEFLAGS_40 = 0x40,
PARAMPARSEFLAGS_80 = 0x80,
PARAMPARSEFLAGS_100 = 0x100
};
enum {
SLFLAGS_1 = 1,
SLFLAGS_2 = 2,
SLFLAGS_4 = 4, // displays =...
SLFLAGS_8 = 8, // displays [no] -- produces e.g. [no]err[or] | [no]iserr[or], [no]implicit[conv]
SLFLAGS_10 = 0x10, // displays [-]
SLFLAGS_20 = 0x20, // displays [no-]
SLFLAGS_40 = 0x40
};
enum {
LISTFLAGS_NONE = 0,
LISTFLAGS_2 = 2,
LISTFLAGS_4 = 4,
LISTFLAGS_COMPILER = 0x100,
LISTFLAGS_LINKER = 0x200,
LISTFLAGS_DISASSEMBLER = 0x400,
LISTFLAGS_TOOL_MASK = LISTFLAGS_COMPILER | LISTFLAGS_LINKER | LISTFLAGS_DISASSEMBLER
};
#ifdef __MWERKS__
#pragma options align=reset
#endif
struct IDEAccessPath {
FSSpec pathSpec;
Boolean recursive;
SInt32 subdirectoryCount;
FSSpec *subdirectories;
};
struct IDEAccessPathList {
SInt32 userPathCount;
struct IDEAccessPath *userPaths;
SInt32 systemPathCount;
struct IDEAccessPath *systemPaths;
unsigned char alwaysSearchUserPaths;
unsigned char convertPaths;
};
#ifdef __MWERKS__
#pragma options align=mac68k
#endif
typedef struct CWObjectFlags {
SInt16 version;
SInt32 flags;
const char *objFileExt;
const char *brsFileExt;
const char *ppFileExt;
const char *disFileExt;
const char *depFileExt;
const char *pchFileExt;
OSType objFileCreator;
OSType objFileType;
OSType brsFileCreator;
OSType brsFileType;
OSType ppFileCreator;
OSType ppFileType;
OSType disFileCreator;
OSType disFileType;
OSType depFileCreator;
OSType depFileType;
} CWObjectFlags;
typedef struct CWIDEInfo {
UInt16 majorVersion;
UInt16 minorVersion;
UInt16 bugFixVersion;
UInt16 buildVersion;
UInt16 dropinAPIVersion;
} CWIDEInfo;
typedef struct DropInFlags {
SInt16 rsrcversion;
OSType dropintype;
UInt16 earliestCompatibleAPIVersion;
UInt32 dropinflags;
OSType edit_language;
UInt16 newestAPIVersion;
} DropInFlags;
typedef struct CWPanelList {
SInt16 version;
SInt16 count;
const char **names;
} CWPanelList;
typedef struct CWFamily {
OSType type;
const char *name;
} CWFamily;
typedef struct CWFamilyList {
SInt16 version;
SInt16 count;
CWFamily *families;
} CWFamilyList;
typedef struct CWTargetList {
SInt16 version;
SInt16 cpuCount;
OSType *cpus;
SInt16 osCount;
OSType *oss;
} CWTargetList;
typedef struct CWExtensionMapping {
OSType type;
char extension[32];
UInt32 flags;
} CWExtensionMapping;
typedef struct CWExtMapList {
SInt16 version;
SInt16 nMappings;
CWExtensionMapping *mappings;
} CWExtMapList;
typedef struct CWHelpInfo {
SInt16 version;
const char *helpFileName;
} CWHelpInfo;
#ifdef __MWERKS__
#pragma options align=reset
#endif
struct CW_BasePluginCallbacks {
void (*cbGetFileInfo)();
void (*cbFindAndLoadFile)();
void (*cbGetFileText)();
void (*cbReleaseFileText)();
void (*cbGetSegmentInfo)();
void (*cbGetOverlay1GroupInfo)();
void (*cbGetOverlay1Info)();
void (*cbGetOverlay1FileInfo)();
void (*cbReportMessage)();
void (*cbAlert)();
void (*cbShowStatus)();
void (*cbUserBreak)();
void (*cbGetNamedPreferences)();
void (*cbStorePluginData)();
void (*cbGetPluginData)();
void (*cbSetModDate)();
void (*cbAddProjectEntry)();
void (*cbCreateNewTextDocument)();
void (*cbAllocateMemory)();
void (*cbFreeMemory)();
void (*cbAllocMemHandle)();
void (*cbFreeMemHandle)();
void (*cbGetMemHandleSize)();
void (*cbResizeMemHandle)();
void (*cbLockMemHandle)();
void (*cbUnlockMemHandle)();
void *cbInternal[8];
void (*cbGetTargetName)();
void (*cbCacheAccessPathList)();
void (*cbPreDialog)();
void (*cbPostDialog)();
void (*cbPreFileAction)();
void (*cbPostFileAction)();
void (*cbCheckoutLicense)();
void (*cbCheckinLicense)();
void (*cbResolveRelativePath)();
};
struct CWCompilerLinkerCallbacks {
void (*cbCachePrecompiledHeader)();
void (*cbLoadObjectData)();
void (*cbStoreObjectData)();
void (*cbFreeObjectData)();
void (*cbDisplayLines)();
void (*cbBeginSubCompile)();
void (*cbEndSubCompile)();
void (*cbGetPrecompiledHeaderSpec)();
void (*cbPutResourceFile)();
void (*cbGetResourceFile)();
void (*cbLookUpUnit)();
void (*cbSBMfiles)();
void (*cbStoreUnit)();
void (*cbReleaseUnit)();
void (*cbUnitNameToFileName)();
void (*cbOSErrorMessage)();
void (*cbOSAlert)();
void (*cbGetModifiedFiles)();
void (*cbGetSuggestedObjectFileSpec)();
void (*cbGetStoredObjectFileSpec)();
void (*cbGetRuntimeSettings)();
void (*cbGetFrameworkCount)();
void (*cbGetFrameworkInfo)();
void (*cbGetFrameworkSharedLibrary)();
};
struct CWParserCallbacks {
void (*cbParserAddAccessPath)();
void (*cbParserSwapAccessPaths)();
void (*cbParserSetNamedPreferences)();
void (*cbParserSetFileOutputName)();
void (*cbParserSetOutputFileDirectory)();
void (*cbParserAddOverlay1Group)();
void (*cbParserAddOverlay1)();
void (*cbParserAddSegment)();
void (*cbParserSetSegment)();
};
struct CWPluginPrivateContext {
SInt32 request;
SInt32 apiVersion;
void *shellContext;
void *pluginStorage;
FSSpec projectFile;
FSSpec outputFileDirectory;
OSType shellSignature;
OSType pluginType;
SInt32 numFiles;
SInt32 numOverlayGroups;
OSErr callbackOSError;
OSErr pluginOSError;
CWIDEInfo *shellInfo;
struct IDEAccessPathList *accessPathList;
SInt32 dontEatEvents;
FSSpec *targetDataDirectorySpec;
SInt32 reserved[17];
struct CW_BasePluginCallbacks *callbacks;
};
// Pref panels
#ifdef __MWERKS__
#pragma options align=mac68k
#endif
typedef struct PCmdLine {
SInt16 version;
SInt16 state;
SInt16 stages;
SInt16 toDisk;
SInt16 outNameOwner;
Boolean dryRun;
Boolean debugInfo;
SInt16 verbose;
Boolean showLines;
Boolean timeWorking;
Boolean noWarnings;
Boolean warningsAreErrors;
Boolean maxErrors;
Boolean maxWarnings;
SInt16 msgStyle;
Boolean noWrapOutput;
Boolean stderr2stdout;
Boolean noCmdLineWarnings;
} PCmdLine;
typedef struct PCmdLineCompiler {
SInt16 version;
Boolean noSysPath;
Boolean noFail;
SInt16 includeSearch;
char linkerName[64];
char objFileExt[15];
char brsFileExt[15];
char ppFileExt[15];
char disFileExt[15];
char depFileExt[15];
char pchFileExt[15];
OSType objFileCreator;
OSType objFileType;
OSType brsFileCreator;
OSType brsFileType;
OSType ppFileCreator;
OSType ppFileType;
OSType disFileCreator;
OSType disFileType;
OSType depFileCreator;
OSType depFileType;
Boolean compileIgnored;
Boolean relPathInOutputDir;
Boolean browserEnabled;
Boolean depsOnlyUserFiles;
char outMakefile[256];
SInt8 forcePrecompile;
Boolean ignoreMissingFiles;
Boolean printHeaderNames;
SInt8 sbmState;
char sbmPath[256];
Boolean canonicalIncludes;
Boolean keepObjects;
} PCmdLineCompiler;
typedef struct PCmdLineLinker {
SInt16 version;
Boolean callPreLinker;
Boolean callPostLinker;
Boolean keepLinkerOutput;
Boolean callLinker;
} PCmdLineLinker;
typedef struct PCmdLineEnvir {
SInt16 version;
SInt16 cols;
SInt16 rows;
Boolean underIDE;
} PCmdLineEnvir;
typedef struct PBackEnd {
SInt16 version;
UInt8 structalignment;
UInt8 tracebacktables;
UInt8 processor;
UInt8 readonlystrings;
UInt8 profiler;
UInt8 fpcontract;
UInt8 schedule;
UInt8 peephole;
UInt8 processorspecific;
UInt8 altivec;
UInt8 vrsave;
UInt8 autovectorize;
UInt8 usebuiltins;
UInt8 pic;
UInt8 dynamic;
UInt8 common;
UInt8 implicit_templates;
UInt8 reserved[3];
} PBackEnd;
typedef struct PDisassembler {
SInt16 version;
Boolean showcode;
Boolean extended;
Boolean mix;
Boolean nohex;
Boolean showdata;
Boolean showexceptions;
Boolean showsym;
Boolean shownames;
} PDisassembler;
typedef struct PMachOLinker {
SInt16 version;
UInt8 linksym;
UInt8 symfullpath;
UInt8 suppresswarn;
UInt8 linkmap;
UInt8 multisymerror;
UInt8 whatfileloaded;
UInt8 whyfileloaded;
UInt8 use_objectivec_semantics;
SInt8 undefinedsymbols;
SInt8 readonlyrelocs;
SInt8 reserved_value1;
SInt8 reserved_value2;
SInt16 exports;
SInt16 reserved_short1;
UInt32 currentversion;
UInt32 compatibleversion;
SInt32 reserved_long1;
char mainname[64];
UInt8 prebind;
UInt8 dead_strip;
UInt8 twolevel_namespace;
UInt8 strip_debug_symbols;
} PMachOLinker;
typedef struct PMachOProject {
SInt16 version;
SInt16 type;
Str63 outfile;
OSType filecreator;
OSType filetype;
SInt32 stacksize;
SInt32 stackaddress;
SInt32 reserved1;
SInt32 reserved2;
SInt32 reserved3;
SInt32 reserved4;
SInt32 reserved5;
SInt32 reserved6;
SInt32 reserved7;
SInt32 reserved8;
SInt32 reserved9;
SInt32 reserved10;
SInt32 reserved11;
SInt32 reserved12;
SInt32 reserved13;
SInt32 reserved14;
SInt32 reserved15;
SInt32 reserved16;
SInt32 reserved17;
SInt32 reserved18;
SInt32 reserved19;
SInt32 reserved20;
UInt8 flatrsrc;
UInt8 filler1;
UInt8 filler2;
UInt8 filler3;
Str63 separateflatfile;
Str255 installpath;
} PMachOProject;
typedef struct {
SInt16 version;
Boolean userSetCreator;
Boolean userSetType;
Boolean gPrintMapToStdOutput;
Str255 mapfilename;
Str255 symfilename;
} PCLTExtras;
#ifdef __MWERKS__
#pragma options align=reset
#endif
typedef struct CWCommandLineArgs {
int argc;
char **argv;
char **envp;
} CWCommandLineArgs;
typedef struct VersionInfo {
UInt16 major;
UInt16 minor;
UInt16 patch;
UInt16 build;
} VersionInfo;
typedef struct CLPluginInfo {
OSType plugintype;
OSType language;
SInt32 dropinflags;
char *version;
Boolean storeCommandLine;
} CLPluginInfo;
typedef struct ToolVersionInfo {
char *company;
char *product;
char *tool;
char *copyright;
char *version;
} ToolVersionInfo;
// may not actually be named this
struct ParseOptsType {
struct CWPluginPrivateContext *context;
char helpKey[64];
SInt32 helpFlags;
UInt16 ioCols;
UInt16 ioRows;
CWCommandLineArgs *args;
ToolVersionInfo *toolVersion;
int numPlugins;
CLPluginInfo *plugins;
int numPanels;
char **panelNames;
OSType cpu;
OSType os;
char lastoutputname[256];
SInt32 currentSegment;
SInt32 currentOverlayGroup;
SInt32 currentOverlay;
int possibleFiles;
int userSpecifiedFiles;
int unusedFiles;
Boolean hadAnyOutput;
Boolean hadErrors;
Boolean showHelp;
Boolean underIDE;
Boolean alwaysUsePaths;
Boolean noOptions;
Boolean printedVersion;
Boolean passingArgs;
Boolean disToFile;
Boolean ppToFile;
Boolean initBefore;
Boolean weakImport;
Boolean mergeIntoOutput;
Boolean success;
Boolean ignoreUnknown;
UInt8 unused[2];
};
typedef struct {
int argc;
const char **argv;
OSType cpu;
OSType os;
OSType plugintype;
OSType language;
OSType parserstyle;
OSSpec programSpec;
const char *programName;
SInt16 countWarnings;
SInt16 countErrors;
Boolean pluginDebug;
Boolean userBreak;
Boolean withholdWarnings;
Boolean withholdErrors;
OSSpec makefileSpec;
OSPathSpec sbmPathSpec;
OSHandle browseTableHandle;
const char *stdout_base;
int stdout_written;
} CLState; // assumed name
typedef struct BasePluginCallbacks {
SInt16 (*main)(void *context);
SInt16 (*GetDropInFlags)(const DropInFlags **flags, SInt32 *flagsSize);
SInt16 (*GetDisplayName)(const char **displayName);
SInt16 (*GetDropInName)(const char **dropInName);
SInt16 (*GetPanelList)(const CWPanelList **panelList);
SInt16 (*GetFamilyList)(const CWFamilyList **familyList);
SInt16 (*GetHelpInfo)(const CWHelpInfo **helpInfo);
SInt16 (*GetVersionInfo)(const VersionInfo **versionInfo);
SInt16 (*GetFileTypeMappings)(const OSFileTypeMappingList **mappingList);
} BasePluginCallbacks;
typedef struct CompilerLinkerPluginCallbacks {
SInt16 (*GetTargetList)(const struct CWTargetList **targetList);
SInt16 (*GetDefaultMappingList)();
SInt16 (*Unmangle)();
SInt16 (*BrSymbolEntryPoint)();
SInt16 (*GetObjectFlags)();
SInt16 (*WriteObjectFile)();
} CompilerLinkerPluginCallbacks;
typedef struct ParserPluginCallbacks {
SInt16 (*SupportsPlugin)();
SInt16 (*SupportsPanels)();
} ParserPluginCallbacks;
typedef struct {
char *name;
void *ptr;
SInt32 size;
} PrefDataPanel; // assumed name
typedef struct {
OSType TYPE;
OSType LANG;
OSType CPU;
OSType OS;
int numPrefPanels;
char **prefPanels;
char *toolInfo;
char *copyright;
int numOptionLists;
OptionList **optionLists;
int numPrefDataPanels;
PrefDataPanel *prefDataPanels;
int (*PreParse)(); // sig?
int (*MidParse)(); // sig?
int (*PostParse)(); // sig?
} ParserTool; // assumed name
// I think this is internally defined in its .c file
// pro8 mwcc refers to it as =s0
typedef struct PrefPanel {
char *name;
Handle data;
Handle workData;
struct PrefPanel *next;
} PrefPanel;
// CLAccessPaths
typedef struct Paths {
struct Path **pathsArray;
UInt16 arraySize;
UInt16 pathsCount;
} Paths;
typedef struct Frameworks {
struct Paths_FWInfo **fwsArray;
UInt16 arraySize;
UInt16 fwsCount;
} Frameworks;
typedef struct Path {
OSPathSpec *spec;
Paths *recursive;
char *dirlist;
SInt16 flags;
} Path;
typedef struct Paths_FWInfo {
OSSpec fileSpec;
OSPathSpec version;
OSPathSpec name;
Path *path;
Boolean hidden;
} Paths_FWInfo;
// CLDependencies
typedef struct InclFile {
SInt32 filenameoffs;
Path *accesspath;
Path *globalpath;
Path *specialpath;
Boolean syspath;
} InclFile;
typedef struct Incls {
struct Target *targ;
SInt32 numincls;
SInt32 maxincls;
InclFile *files;
SInt32 buflen;
SInt32 bufpos;
char *buffer;
Paths *allPaths;
} Incls;
typedef struct Deps {
int numDeps;
int maxDeps;
SInt32 *list;
Incls *incls;
} Deps;
// CLFiles
typedef struct File {
struct File *next;
SInt32 filenum;
UInt16 segnum;
SInt32 srcmoddate;
SInt32 outmoddate;
char srcfilename[256];
char outfilename[256];
SInt16 outfileowner;
OSSpec srcfss;
OSSpec outfss;
SInt16 writeToDisk;
SInt16 wroteToDisk;
SInt16 tempOnDisk;
struct Plugin *compiler;
SInt32 dropinflags;
SInt32 objectflags;
SInt32 mappingflags;
SInt16 sourceUsage;
SInt16 objectUsage;
Handle textdata;
Handle objectdata;
Handle browsedata;
SInt32 codesize;
SInt32 udatasize;
SInt32 idatasize;
SInt32 compiledlines;
Boolean recompileDependents;
Boolean gendebug;
Boolean hasobjectcode;
Boolean hasresources;
Boolean isresourcefile;
Boolean weakimport;
Boolean initbefore;
Boolean mergeintooutput;
Deps deps;
Boolean recordbrowseinfo;
SInt16 browseFileID;
char browseoptions[32];
OSType filetype;
OSType filecreator;
} File;
typedef struct Files {
File *fileList;
SInt32 fileCount;
} Files;
typedef struct VFile {
char displayName[32];
Handle data;
struct VFile *next;
} VFile;
// CLOverlays
typedef struct OvlAddr {
UInt32 lo, hi;
} OvlAddr;
typedef struct Overlay {
char name[256];
SInt32 *list;
SInt32 cnt;
SInt32 max;
struct Overlay *next;
} Overlay;
typedef struct OvlGroup {
char name[256];
OvlAddr addr;
Overlay *olys;
Overlay *lastoly;
int olycnt;
struct OvlGroup *next;
} OvlGroup;
typedef struct Overlays {
OvlGroup *groups;
OvlGroup *lastgrp;
SInt32 grpcnt;
} Overlays;
// CLSegs
typedef struct Segment {
char name[32];
SInt16 attrs;
} Segment;
typedef struct Segments {
Segment **segsArray;
UInt16 arraySize;
UInt16 segsCount;
} Segments;
// CLTarg
// Is this actually in Pro7? Not sure
typedef struct CLTargetInfo {
OSType targetCPU;
OSType targetOS;
SInt16 outputType;
SInt16 linkType;
Boolean canRun;
Boolean canDebug;
OSSpec outfile;
OSSpec symfile;
OSSpec runfile;
OSSpec linkAgainstFile;
} CLTargetInfo;
typedef struct CWTargetInfo {
SInt16 outputType;
FSSpec outfile;
FSSpec symfile;
FSSpec runfile;
SInt16 linkType;
Boolean canRun;
Boolean canDebug;
OSType targetCPU;
OSType targetOS;
OSType outfileCreator;
OSType outfileType;
OSType debuggerCreator;
OSType runHelperCreator;
FSSpec linkAgainstFile;
} CWTargetInfo;
typedef struct Target {
struct BuildInfo {
UInt32 linesCompiled;
UInt32 codeSize;
UInt32 iDataSize;
UInt32 uDataSize;
} info;
CWTargetInfo *targetinfo;
struct {
Segments segs;
Overlays overlays;
} linkage;
SInt32 linkmodel;
Files files;
Files pchs;
Incls incls;
Paths sysPaths;
Paths userPaths;
OSType lang;
OSType cpu;
OSType os;
char targetName[64];
struct Plugin *preLinker;
struct Plugin *linker;
struct Plugin *postLinker;
UInt32 preLinkerDropinFlags;
UInt32 linkerDropinFlags;
UInt32 postLinkerDropinFlags;
OSPathSpec outputDirectory;
VFile *virtualFiles;
struct Target *next;
} Target;
typedef struct Plugin {
BasePluginCallbacks *cb;
CompilerLinkerPluginCallbacks *cl_cb;
ParserPluginCallbacks *pr_cb;
void *context;
char *cached_ascii_version;
struct Plugin *next;
} Plugin;
typedef struct Token {
int x0;
void *x4;
} Token;
/********************************/
/* command_line/CmdLine/Src/Clients/CLStaticMain.c */
extern int main(int argc, const char **argv);
/********************************/
/* command_line/CmdLine/Src/Clients/ClientGlue.c */
extern int RegisterResource(const char *name, SInt16 rsrcid, Handle list);
extern int RegisterStaticPlugin(const BasePluginCallbacks *callbacks);
extern int RegisterStaticCompilerLinkerPlugin(const BasePluginCallbacks *callbacks, const CompilerLinkerPluginCallbacks *cl_callbacks);
extern int RegisterStaticParserPlugin(const BasePluginCallbacks *cb, const ParserPluginCallbacks *pr_callbacks);
extern void SetBuildTarget(OSType cpu, OSType os);
extern void SetParserType(OSType plang);
extern void SetPluginType(OSType lang, OSType type);
extern int CmdLine_Initialize(int argc, const char **argv, const char *builddate, const char *buildtime);
extern int CmdLine_Driver();
extern int CmdLine_Terminate(int exitcode);
/********************************/
/* command_line/CmdLine/Src/CLMain.c */
extern void Main_PreParse(int *pArgc, char ***pArgv);
extern void Main_PassSpecialArgs(void *unk1, void *unk2);
extern int Main_Initialize(int argc, const char **argv);
extern int Main_Terminate(int code);
extern int Main_Driver();
/********************************/
/* command_line/CmdLine/Src/Envir/CLErrors.c */
extern void CLReportError(SInt16 errid, ...);
extern void CLReportWarning(SInt16 errid, ...);
extern void CLReport(SInt16 errid, ...);
extern void CLReportOSError(SInt16 errid, int err, ...);
extern void CLReportCError(SInt16 errid, int err_no, ...);
extern void CLInternalError(const char *file, int line, const char *format, ...);
extern void CLFatalError(const char *format, ...);
/********************************/
/* command_line/CmdLine/Src/Plugins/CLPlugins.c */
//static void GetToolVersionInfo();
extern const ToolVersionInfo *Plugin_GetToolVersionInfo();
//static const char *Plugin_GetDisplayName(Plugin *pl);
extern const char *Plugin_GetDropInName(Plugin *pl);
extern VersionInfo *Plugin_GetVersionInfo(Plugin *pl);
extern const char *Plugin_GetVersionInfoASCII(Plugin *pl);
extern DropInFlags *Plugin_GetDropInFlags(Plugin *pl);
extern OSType Plugin_GetPluginType(Plugin *pl);
extern const CWTargetList *Plugin_CL_GetTargetList(Plugin *pl);
extern const CWPanelList *Plugin_GetPanelList(Plugin *pl);
extern const CWExtMapList *Plugin_CL_GetExtMapList(Plugin *pl);
extern const OSFileTypeMappingList *Plugin_GetFileTypeMappingList(Plugin *pl);
extern const CWObjectFlags *Plugin_CL_GetObjectFlags(Plugin *pl);
extern Boolean Plugin_MatchesName(Plugin *pl, const char *name);
extern Boolean Plugin_CL_MatchesTarget(Plugin *pl, OSType cpu, OSType os, Boolean exact);
extern Boolean Plugins_CL_HaveMatchingTargets(Plugin *p1, Plugin *p2, Boolean exact);
//static CL_MatchesExtMapping(CWExtensionMapping *map, OSType type, const char *ext, Boolean exact);
extern Boolean Plugin_CL_MatchesFileType(Plugin *pl, OSType type, const char *extension, Boolean exact);
extern Boolean Plugin_MatchesType(Plugin *pl, OSType type, OSType lang, Boolean exact);
extern Boolean Plugin_Pr_MatchesPlugin(Plugin *pl, CLPluginInfo *pluginfo, OSType cpu, OSType os);
extern Boolean Plugin_Pr_MatchesPanels(Plugin *pl, int numPanels, char **panelNames);
extern Boolean Plugin_CL_WriteObjectFile(Plugin *pl, FSSpec *src, FSSpec *out, OSType creator, OSType type, OSHandle *data);
extern Boolean Plugin_CL_GetCompilerMapping(Plugin *pl, OSType type, const char *ext, UInt32 *flags);
//static Boolean SupportedPlugin(Plugin *pl, const char **reason);
//static Boolean VerifyPanels(Plugin *pl);
extern Plugin *Plugin_New(const BasePluginCallbacks *cb, const CompilerLinkerPluginCallbacks *cl_cb, const ParserPluginCallbacks *pr_cb);
extern void Plugin_Free(Plugin *pl);
extern int Plugin_VerifyPanels(Plugin *pl);
extern void Plugins_Init();
extern void Plugins_Term();
extern int Plugins_Add(Plugin *pl);
extern Plugin *Plugins_MatchName(Plugin *list, const char *name);
extern Plugin *Plugins_CL_MatchTarget(Plugin *list, OSType cpu, OSType os, OSType type, OSType lang);
extern Plugin *Plugins_CL_MatchFileType(Plugin *list, OSType type, const char *ext, Boolean exact);
extern Plugin *Plugins_GetPluginForFile(Plugin *list, OSType plugintype, OSType cpu, OSType os, OSType type, const char *ext, OSType lang);
extern Plugin *Plugins_GetLinker(Plugin *list, OSType cpu, OSType os);
extern Plugin *Plugins_GetPreLinker(Plugin *list, OSType cpu, OSType os);
extern Plugin *Plugins_GetPostLinker(Plugin *list, OSType cpu, OSType os);
extern Plugin *Plugins_GetParserForPlugin(Plugin *list, OSType style, int numPlugins, CLPluginInfo *plugins, OSType cpu, OSType os, int numPanels, char **panelNames);
extern Plugin *Plugins_GetCompilerForLinker(Plugin *list, Plugin *linker, OSType type, const char *ext, OSType edit);
extern Boolean Plugins_GetPluginList(Plugin *list, int *numPlugins, CLPluginInfo **pluginInfo);
extern Boolean Plugins_GetPrefPanelUnion(Plugin *list, int *numPanels, const char ***panelNames);
extern Boolean Plugin_AddFileTypeMappings(Plugin *pl, OSFileTypeMappingList *ftml);
extern Boolean Plugins_AddFileTypeMappingsForTarget(Plugin *list, OSFileTypeMappings **mlist, OSType cpu, OSType os);
extern SInt16 Plugin_Call(Plugin *pl, void *context);
/********************************/
/* command_line/CmdLine/Src/Callbacks/CLParserCallbacks_v1.cpp */
// haha this is a C++ nightmare
/********************************/
/* command_line/CmdLine/Src/Envir/CLIO.c */
typedef struct MessageRef {
OSSpec sourcefile;
OSSpec errorfile;
char *sourceline;
SInt32 linenumber;
SInt32 tokenoffset;
SInt16 tokenlength;
SInt32 selectionoffset;
SInt16 selectionlength;
} MessageRef;
extern void SetupDebuggingTraps();
extern Boolean IO_Initialize();
extern Boolean IO_Terminate();
extern Boolean IO_HelpInitialize();
extern Boolean IO_HelpTerminate();
extern void FixHandleForIDE(OSHandle *text);
extern Boolean ShowHandle(OSHandle *text, Boolean decorate);
extern Boolean WriteHandleToFile(OSSpec *spec, OSHandle *text, OSType creator, OSType type);
extern Boolean WriteBinaryHandleToFile(OSSpec *spec, OSType maccreator, OSType mactype, OSHandle *text);
extern Boolean AppendHandleToFile(OSSpec *spec, OSHandle *text, OSType maccreator, OSType mactype);
extern void InitWorking();
extern void ShowWorking();
extern void TermWorking();
extern Boolean CheckForUserBreak();
extern char *IO_FormatText(char *buffer, SInt32 size, char *newline, const char *format, ...);
extern void CLPrintDispatch(SInt16 msgtype, const char *message, FILE *out, char *ptr, char *nptr);
extern void CLPrintType(SInt16 msgtype, ...);
extern void CLPrint(SInt16 msgtype, ...);
extern void CLPrintWarning(SInt16 msgtype, ...);
extern void CLPrintErr(SInt16 msgtype, ...);
extern SInt16 CLStyledMessageDispatch(Plugin *plugin, MessageRef *ref, SInt32 errorNumber, SInt16 msgType);
/********************************/
/* command_line/CmdLine/Src/CLToolExec.c */
extern void AppendArgumentList(int *argc, const char ***argv, const char *str);
// static int CopyArgumentList(int argc, const char **argv, int *Argc, const char ***Argv);
// static int FreeArgumentList(const char **argv);
// static int SetupLinkerCommandLine(SInt32 dropinflags, File *file, CWCommandLineArgs *args);
extern int SetupTemporaries(SInt32 idx, File *file);
extern int DeleteTemporaries(SInt32 idx, File *file);
extern int ExecuteLinker(Plugin *plugin, SInt32 dropinflags, File *file, char *stdoutfile, char *stderrfile);
/********************************/
/* command_line/CmdLine/Src/Project/CLProj.c */
typedef struct Project {
Target *targets;
OSSpec projectDirectory;
} Project;
extern int Proj_Initialize(Project *this);
extern int Proj_Terminate(Project *this);
/********************************/
/* command_line/CmdLine/Src/CLLicenses.c */
extern void License_Initialize();
extern void License_Terminate();
extern SInt32 License_Checkout();
extern void License_Refresh();
extern void License_Checkin();
extern void License_AutoCheckin();
/********************************/
/* command_line/CmdLine/Src/CLPluginRequests.cpp */
extern Boolean SendParserRequest(
Plugin *plugin,
Target *target,
CWCommandLineArgs *args,
OSType cpu,
OSType os,
int numPlugins,
CLPluginInfo *pluginInfo,
int numPanels,
const char **panelNames,
CWCommandLineArgs *plugin_args,
CWCommandLineArgs *panel_args,
const char *build_date,
const char *build_time,
ToolVersionInfo *build_tool
);
extern Boolean SendCompilerRequest(Plugin *plugin, File *file, SInt16 stage);
extern Boolean SendTargetInfoRequest(Target *targ, Plugin *linker, SInt32 dropinflags);
extern Boolean SendLinkerRequest(Plugin *plugin, SInt32 dropinflags, CWTargetInfo *targetInfo);
extern Boolean SendDisassemblerRequest(Plugin *linker, File *file);
extern Boolean SendInitOrTermRequest(Plugin *plugin, Boolean reqIsInitialize);
/********************************/
/* command_line/CmdLine/Src/CLFileOps.c */
// PRO8 ONLY ??? Boolean CanFlushObjectData(File *file);
// PRO8 ONLY ??? void FlushObjectData(File *file);
// PRO8 ONLY ??? Boolean RetrieveObjectData(File *file);
// static int OutputTextData(File *file, SInt16 stage, OSType maccreator, OSType mactype);
// static int fstrcat(const char *file, const char *add, SInt32 length);
// static void extstrcat(char *file, const char *ext);
extern int GetOutputFile(File *file, SInt16 stage);
// static int SyntaxCheckFile(File *file);
// static int PreprocessFile(File *file);
// static int DependencyMapFile(File *file, Boolean compileifnecessary);
// static int RecordBrowseInfo(File *file);
// static int RecordObjectData(File *file);
extern int StoreObjectFile(File *file);
// static int CompileFile(File *file);
// static int DisassembleWithLinker(File *file, Plugin *linker, SInt32 linkerDropinFlags);
// static int DisassembleFile(File *file, Plugin *disasm);
// static int CompileEntry(File *file, Boolean *compiled);
// static void DumpFileAndPathInfo();
extern int CompileFilesInProject();
// static int PostLinkFilesInProject();
extern int LinkProject();
/********************************/
/* command_line/CmdLine/Src/Project/CLPrefs.c */
extern PrefPanel *PrefPanel_New(const char *name, void *initdata, SInt32 initdatasize);
extern Handle PrefPanel_GetHandle(PrefPanel *panel);
extern int PrefPanel_PutHandle(PrefPanel *panel, Handle handle);
extern void Prefs_Initialize();
extern void Prefs_Terminate();
extern Boolean Prefs_AddPanel(PrefPanel *panel);
extern PrefPanel *Prefs_FindPanel(const char *name);
/********************************/
/* command_line/CmdLine/Src/Project/CLTarg.c */
extern Target *Target_New(const char *name, OSType cpu, OSType os, OSType lang);
extern void Target_Free(Target *targ);
extern void Targets_Term(Target *list);
extern void Target_Add(Target **list, Target *targ);
/********************************/
/* command_line/CmdLine/Src/Project/CLAccessPaths.c */
// 0,40=Path
// 0,41=OSPathSpec
// 0,43=Paths
// 0,44=Path**
// 0,45=Path*
// 0,46=OSPathSpec*
// 0,47=Paths*
// 0,48=Path*
extern Path *Path_Init(const OSPathSpec *dir, Path *path);
extern Path *Path_New(const OSPathSpec *dir);
extern void Path_Free(Path *path);
extern Boolean Paths_Initialize(Paths *paths);
extern Boolean Paths_Terminate(Paths *paths);
//static Boolean Paths_GrowPaths(Paths *paths, UInt16 *index);
extern Boolean Paths_AddPath(Paths *paths, Path *path);
extern Boolean Paths_InsertPath(Paths *paths, UInt16 index, Path *path);
extern Boolean Paths_RemovePath(Paths *paths, UInt16 index);
extern Boolean Paths_DeletePath(Paths *paths, UInt16 index);
extern Path *Paths_GetPath(Paths *paths, UInt16 pathnum);
extern UInt16 Paths_Count(const Paths *paths);
extern Boolean Paths_FindPath(const Paths *paths, const Path *path);
extern Path *Paths_FindPathSpec(const Paths *paths, const OSPathSpec *dir);
//static Boolean GatherRecurse(Paths *paths, Path *path);
extern Boolean Paths_GatherRecurse(Paths *paths);
extern int Paths_CountRecurse(Paths *paths);
//static void CopyRecurseFSS(FSSpec **pFss, Paths *paths, UInt16 *pCount);
extern void Paths_CopyRecurseFSS(FSSpec *fss, Paths *paths, UInt16 count);
//static Boolean Frameworks_Initialize(Frameworks *fws);
//static Boolean Frameworks_Grow(Frameworks *fws, UInt16 *index);
//static Boolean Frameworks_Add(Frameworks *fws, Paths_FWInfo *info);
//static Paths_FWInfo *Framework_Init(OSSpec *dir, const char *name, const char *version, Paths_FWInfo *info, Path *p, Boolean hidden);
//static Paths_FWInfo *Framework_New(OSSpec *dir, const char *name, const char *version, Path *p, Boolean hidden);
//static Boolean CheckForFileInFrameworkDir(char *out, const char *framework_path, OSPathSpec *osps, const char *fname);
//static Boolean CheckForFileInFramework(char *out, int i, const char *fname);
extern Boolean MakeFrameworkPath(char *out, const char *filename, OSPathSpec **globalpath);
extern Boolean Frameworks_AddPath(const OSPathSpec *oss);
extern Boolean Frameworks_AddFramework(const char *frameworkName, const char *version, Boolean flag);
extern void Framework_GetEnvInfo();
extern int Frameworks_GetCount();
extern Paths_FWInfo *Frameworks_GetInfo(int which);
/********************************/
/* ??? */
extern int AddFileTypeMappingList(void *a, void *b); // TODO sig
extern void UseFileTypeMappings(void *a); // TODO sig
extern OSErr SetMacFileType(const FSSpec *fss, void *a); // TODO sig
extern OSErr GetMacFileType(const FSSpec *fss, void *a); // TODO sig
/********************************/
/* command_line/CmdLine/Src/Project/CLFiles.c */
extern File *File_New();
extern void File_Free(File *file);
extern Boolean Files_Initialize(Files *this);
extern Boolean Files_Terminate(Files *this);
extern Boolean Files_AddFile(Files *this, File *file);
extern Boolean Files_InsertFile(Files *this, File *file, SInt32 position);
extern File *Files_GetFile(Files *this, SInt32 filenum);
extern File *Files_FindFile(Files *this, OSSpec *spec);
extern int Files_Count(Files *this);
extern Boolean VFiles_Initialize(VFile **list);
extern void VFiles_Terminate(VFile **list);
extern VFile *VFile_New(const char *name, OSHandle *data);
extern Boolean VFiles_Add(VFile **list, VFile *entry);
extern VFile *VFiles_Find(VFile *list, const char *name);
/********************************/
/* command_line/CmdLine/Src/Project/CLOverlays.c */
extern Boolean Overlays_Initialize(Overlays *this);
extern Boolean Overlays_Terminate(Overlays *this);
extern Boolean Overlays_AddOvlGroup(Overlays *this, OvlGroup *grp, SInt32 *grpnum);
extern OvlGroup *Overlays_GetOvlGroup(Overlays *this, SInt32 grpnum);
extern SInt32 Overlays_CountGroups(Overlays *this);
extern Boolean Overlays_AddFileToOverlay(Overlays *this, SInt32 grpnum, SInt32 ovlnum, SInt32 filenum);
extern Overlay *Overlays_GetOverlayInGroup(Overlays *this, SInt32 grpnum, SInt32 ovlnum);
extern SInt32 Overlays_GetFileInOverlay(Overlays *this, SInt32 grpnum, SInt32 ovlnum, SInt32 filnum);
extern OvlGroup *OvlGroup_New(const char *name, OvlAddr addr);
extern void OvlGroup_Delete(OvlGroup *grp);
extern Boolean OvlGroup_AddOverlay(OvlGroup *this, Overlay *oly, SInt32 *olynum);
extern Overlay *OvlGroup_GetOverlay(OvlGroup *this, SInt32 olynum);
extern SInt32 OvlGroup_CountOverlays(OvlGroup *this);
extern Overlay *Overlay_New(const char *name);
extern void Overlay_Delete(Overlay *oly);
extern Boolean Overlay_AddFile(Overlay *oly, SInt32 filenum, SInt32 *filnum);
extern SInt32 Overlay_GetFile(Overlay *oly, SInt32 filnul);
extern SInt32 Overlay_CountFiles(Overlay *oly);
/********************************/
/* command_line/CmdLine/Src/Project/CLSegs.c */
extern Segment *Segment_New(const char *name, UInt16 attrs);
extern void Segment_Free(Segment *seg);
extern Boolean Segments_Initialize(Segments *segs);
extern Boolean Segments_Terminate(Segments *segs);
//static Boolean Segments_GrowSegments(Segments *segs, UInt16 *index);
extern Boolean Segments_AddSegment(Segments *segs, Segment *seg, UInt16 *index);
extern Boolean Segments_InsertSegment(Segments *segs, UInt16 index, Segment *seg);
extern Boolean Segments_DeleteSegment(Segments *segs, UInt16 index);
extern Segment *Segments_GetSegment(Segments *segs, UInt16 segnum);
extern UInt16 Segments_Count(const Segments *segs);
/********************************/
/* CLDropinCallbacks_V10.cpp */
// TODO
/********************************/
/* command_line/CmdLine/Src/Callbacks/CLCompilerLinkerDropin_V10.cpp */
// TODO
/********************************/
/* command_line/CmdLine/Src/CLDependencies.c */
extern Boolean Incls_Initialize(Incls *incls, Target *targ);
extern void Incls_Terminate(Incls *incls);
// static Boolean IsSysIncl(Incls *incls, SInt32 idx);
// static void MakeInclFileSpec(Incls *incls, SInt32 idx, OSSpec *spec);
// static Boolean QuickFindFileInIncls(Incls *incls, Boolean fullsearch, const char *filename, OSSpec *spec, SInt32 *index, InclFile **f);
// static Boolean SameIncl(Incls *incls, SInt32 a, SInt32 b);
// static Path *FindOrAddGlobalInclPath(Paths *paths, OSPathSpec *spec);
// static Boolean _FindFileInPath(Path *path, const char *filename, Path **thepath, OSSpec *spec);
// static Boolean FindFileInPaths(Paths *paths, const char *filename, Path **thepath, OSSpec *spec);
// static void AddFileToIncls(Incls *incls, const char *infilename, Boolean syspath, Path *accesspath, Path *globalpath, SInt32 *index);
extern Boolean Incls_FindFileInPaths(Incls *incls, const char *filename, Boolean fullsearch, OSSpec *spec, SInt32 *inclidx);
extern Boolean Deps_Initialize(Deps *deps, Incls *incls);
extern void Deps_Terminate(Deps *deps);
extern int Deps_ChangeSpecialAccessPath(OSSpec *srcfss, Boolean initialize);
extern Path *Deps_GetSpecialAccessPath();
// static void SetSpecialAccessPathFromIncludeStackTOS();
// static Boolean FindDepFile(Deps *deps, SInt32 incl);
// static void AddDepFile(Deps *deps, SInt32 incl);
extern void Deps_AddDependency(Deps *deps, SInt32 incl, OSSpec *spec, SInt16 dependencyType);
// static char *EscapeName(Boolean spaces, char *escbuf, const char *path);
extern void Deps_ListDependencies(Incls *incls, File *file, Handle h);
/********************************/
/* command_line/CmdLine/Src/CLWriteObjectFile.c */
extern Boolean WriteObjectFile(File *file, OSType maccreator, OSType mactype);
extern Boolean WriteBrowseData(File *file, OSType maccreator, OSType mactype);
/********************************/
/* command_line/CmdLine/Src/CLBrowser.c */
// GetBrowseTableInfoAndLock
extern int Browser_Initialize(OSHandle *browsetableptr);
//static int Destroy(OSHandle *browsetable);
extern int Browser_Terminate(OSHandle *browsetableptr);
extern int Browser_SearchFile(OSHandle *browsetable, const char *fullpath, SInt16 *ID);
extern int Browser_SearchAndAddFile(OSHandle *browsetable, const char *fullpath, SInt16 *ID);
//static SInt32 CalcDiskSpaceRequirements(...); // needs table type
//static int ConvertMemToDisk(...); // needs table type
extern int Browser_PackBrowseFile(OSHandle *browsedata, OSHandle *browsetable, OSHandle *browsefileptr);
/********************************/
/* command_line/CmdLine/Src/CLIncludeFileCache.c */
// TODO
/********************************/
/* ?? Error */
extern char *GetSysErrText(SInt16 code, char *buffer);
/********************************/
/* Might be cc-mach-ppc-mw.c? */
extern void GetStaticTarget(OSType *cpu, OSType *os);
extern void GetStaticPluginType(OSType *language, OSType *plugintype);
extern void GetStaticParserPluginType(OSType *style);
extern int RegisterStaticTargetResources();
extern int RegisterStaticTargetPlugins();
/********************************/
/* Might be ParserGlue-mach-ppc-cc.c? */
extern int RegisterStaticParserToolInfo();
/********************************/
/* Might be cc-mach-ppc.c? */
extern CW_PASCAL SInt16 CWPlugin_GetDropInFlags(const DropInFlags **flags, SInt32 *flagsSize);
extern CW_PASCAL SInt16 CWPlugin_GetTargetList(const CWTargetList **targetList);
extern CW_PASCAL SInt16 CWPlugin_GetDropInName(const char **dropinName);
extern CW_PASCAL SInt16 CWPlugin_GetDisplayName(const char **displayName);
extern CW_PASCAL SInt16 CWPlugin_GetDefaultMappingList(const CWExtMapList **defaultMappingList);
extern CW_PASCAL SInt16 CWPlugin_GetPanelList(const CWPanelList **panelList);
//_CmdLine_GetObjectFlags
//_CWPlugin_GetVersionInfo
//_CWPlugin_GetFileTypeMappings
//_Linker_GetDropInFlags
//_Linker_GetDropInName
//_Linker_GetDisplayName
//_Linker_GetPanelList
//_Linker_GetTargetList
//_Linker_GetDefaultMappingList
extern int RegisterStaticCompilerPlugin();
extern int RegisterCompilerResources();
/********************************/
/* libimp-mach-ppc.c */
// some statics here
extern int RegisterStaticLibImporterPlugin();
extern int RegisterLibImporterResources();
/********************************/
/* TargetOptimizer-ppc-mach.c */
extern int TargetSetOptFlags(SInt16 val, Boolean set);
extern void TargetDisplayOptimizationOptions(Handle txt);
extern void TargetSetPragmaOptimizationsToUnspecified();
/********************************/
/* OptimizerHelpers.c */
extern int SetPragmaOptimizationsToUnspecified();
extern int SetOptFlags(char *opt, void *str, ...); // two unknown args
extern int DisplayOptimizationOptions();
/********************************/
/* Unk name lol */
extern int TargetSetWarningFlags(SInt16 val, Boolean set);
extern int TargetDisplayWarningOptions(Handle txt);
/********************************/
/* WarningHelpers.c */
extern int SetWarningFlags(char *opt, void *str, ...); // two unknown args
extern int DisplayWarningOptions();
/********************************/
/* CCompiler.c */
// LOTS OF STUFF
/********************************/
/* StaticParserGlue.c */
extern int RegisterStaticParserResources();
extern int RegisterStaticParserPlugins();
/********************************/
/* ParserFace.c */
extern Handle Parser_FindPrefPanel(char *name);
extern SInt32 Parser_StorePanels(struct CWPluginPrivateContext *context);
extern SInt16 CWParser_GetDropInFlags(const DropInFlags **flags, SInt32 *flagsSize);
extern SInt16 CWParser_GetDropInName(const char **dropinName);
extern SInt16 CWParser_GetDisplayName(const char **displayName);
extern SInt16 CWParser_GetPanelList(const CWPanelList **panelList);
extern SInt16 CWParser_GetTargetList(const CWTargetList **targetList);
extern SInt16 CWParser_GetVersionInfo(const VersionInfo **versioninfo);
extern SInt16 Parser_SupportsPlugin(struct CLPluginInfo *pluginfo, OSType cpu, OSType os, Boolean *isSupported);
extern SInt16 Parser_SupportsPanels(int numPanels, char **panelNames, Boolean *isSupported);
extern SInt16 parser_main(struct CWPluginPrivateContext *context);
extern struct ParseOptsType parseopts;
/********************************/
/* ParserHelpers.c */
extern int FindFileInPath(const char *filename, OSSpec *fss);
extern char *GetEnvVar(const char *name, Boolean warn, char **match);
//static Boolean MatchesExtension(const char *list, const char *filename);
extern int Opt_AddAccessPath(const char *opt, void *var, const char *arg);
extern int Opt_AddFrameworkPath(const char *opt, void *var, const char *arg);
extern int Opt_AddFramework(const char *opt, void *var, const char *arg);
extern void ListParseMessage(void *errprint, const char *envvar, SInt16 id); // TODO funcptr sig - same as CLPReportWarning_V, CLPReportError_V
extern int AddAccessPathList(const char *list, char sep1, char sep2, int source, char *text, Boolean system, SInt32 position, Boolean recursive);
extern int Opt_FindAndAddFile(const char *opt, void *var, const char *arg);
extern int Opt_FindAndAddFileRef(const char *opt, void *var, const char *arg);
extern int Opt_AddUnixLibraryFile(const char *opt, void *var, const char *arg);
extern int AddFileList(const char *list, char sep1, char sep2, int source, char *text, SInt32 position);
extern int IsFileInOutputDirectory(const OSSpec *file);
extern void GetCFileNameInOutputDirectory(const char *input, char *name, int maxlen);
extern void GetPFileNameInOutputDirectory(const char *input, unsigned char *name, int len);
extern void AddStringLenToHandle(Handle h, const char *str, int len);
extern void AddStringToHandle(Handle h, const char *str);
extern int Opt_PrintVersion(const char *opt, void *var, const char *arg);
extern void GetFirstSourceFilenameBase(char *buffer, char *defaul);
extern int Opt_SavePrefs(const char *opt, void *var, const char *arg);
extern int ParseNumber(const char *arg, Boolean emit_error, SInt32 *ret, const char **endptr);
extern int Opt_MaybeMoveAccessPaths(const char *opt, void *var, const char *arg);
/********************************/
/* ToolHelpers.c */
extern int Opt_HandleOutputName(const char *opt, void *, const char *filename);
extern int ValidateToolState(Boolean mustHaveFiles);
extern void ToolReportMessage(SInt16 errid, SInt16 type, va_list va);
extern void ToolReportWarning(SInt16 id, ...);
extern void ToolReportError(SInt16 id, ...);
extern void ToolReportOSError(SInt16 id, ...);
extern void ToolReportInfo(SInt16 id, ...);
extern int Opt_DoNotLink(const char *opt, void *var, const char *arg);
extern int Opt_IncreaseVerbosity(const char *opt, void *var, const char *arg);
extern int Opt_SetStage(const char *opt, void *str, const char *arg, void *unk);
// lots of the Opt_ funcs have weird sigs, need to double check them
extern int Opt_RedirectStream(const char *opt, void *file, const char *filename);
/********************************/
/* ParserHelpers-cc.c */
typedef struct {
void *value;
const char *pragma;
int flags;
} Pragma; // assumed name
extern int Opt_AddStringToDefines(const char *opt, void *str, const char *param);
extern int Opt_DefineSymbol(const char *var, const char *value);
extern int Opt_UndefineSymbol(const char *opt, void *, const char *arg);
extern int Opt_AddPrefixFile(const char *opt, void *handle, const char *filename);
extern int Opt_PragmaTrueFalse(const char *, void *flag, const char *, int flags);
extern int Opt_PragmaFalseTrue(const char *, void *flag, const char *, int flags);
extern int Opt_PragmaOnOff(const char *, void *flag, const char *arg);
extern int Opt_PragmaOffOn(const char *, void *flag, const char *arg);
extern int SetupPragmas(const Pragma *pragmas);
/********************************/
/* Arguments.c */
typedef struct {
SInt16 val;
char *text;
} ArgToken;
enum {
ATK_0,
ATK_1,
ATK_2,
ATK_3,
ATK_4,
ATK_5
};
typedef struct {
int argc;
int nargv;
char **argv;
} anon0_50;
extern void Arg_Init(int theargc, char **theargv);
extern void Arg_Terminate();
extern void Arg_Reset();
extern void Arg_Stop(ArgToken *where);
extern ArgToken *Arg_PeekToken();
extern ArgToken *Arg_UsedToken();
extern int Arg_IsEmpty();
extern ArgToken *Arg_GetToken();
extern ArgToken *Arg_UndoToken();
extern const char *Arg_GetTokenName(ArgToken *tok);
extern const char *Arg_GetTokenText(ArgToken *tok, char *buffer, int maxlen, unsigned char warn);
extern void Arg_InitToolArgs(anon0_50 *ta);
extern void Arg_AddToToolArgs(anon0_50 *ta, SInt16 tokval, char *toktxt);
extern void Arg_FinishToolArgs(anon0_50 *ta);
extern void Arg_ToolArgsForPlugin(anon0_50 *ta, struct CWCommandLineArgs *args);
extern void Arg_FreeToolArgs(anon0_50 *ta);
/********************************/
/* ToolHelpers-cc.c */
extern int Opt_DummyLinkerRoutine(const char *opt);
extern int Opt_DummyLinkerSettingRoutine(const char *var, const char *val);
extern void FinishCompilerTool();
/********************************/
/* IO.c */
extern void ShowTextHandle(const char *description, Handle text);
extern void ShowVersion(Boolean decorate);
/********************************/
/* Projects.c */
extern int GetFileCount();
extern void SetFileOutputName(SInt32 position, SInt16 which, char *outfilename);
extern int AddFileToProject(OSSpec *oss, SInt16 which, char *outfilename, Boolean exists, SInt32 position);
extern Boolean GetFileInfo(SInt32 position, OSSpec *spec, char *plugin);
extern int AddAccessPath(const OSPathSpec *oss, SInt16 type, SInt32 position, Boolean recursive);
extern int MoveSystemPathsIntoUserList();
extern void AddVirtualFile(const char *filename, Handle *text);
extern void GetOutputFileDirectory(OSPathSpec *dir);
extern void SetOutputFileDirectory(const OSPathSpec *dir);
extern void AddOverlayGroup(const char *name, OvlAddr *addr, SInt32 *groupnum, SInt32 *overlaynum);
extern void AddOverlay(SInt32 groupnum, const char *name, SInt32 *overlaynum);
extern void AddSegment(const char *name, SInt16 attrs, SInt32 *segmentnum);
extern void ChangeSegment(SInt32 segmentnum, const char *name, SInt16 attrs);
extern int GetSegment(SInt32 segmentnum, char *name, SInt16 *attrs);
/********************************/
/* Targets.c */
extern int SetParserToolInfo(ParserTool *tool);
extern Boolean ParserToolMatchesPlugin(OSType type, OSType lang, OSType cpu, OSType os);
extern Boolean ParserToolHandlesPanels(int numPanels, const char **panelNames);
extern Boolean SetupParserToolOptions();
/********************************/
/* Option.c */
typedef struct {
void *first;
void *second;
} Opt50;
typedef struct {
Option *opt;
char *curopt;
} Opt52;
typedef struct {
union {
Opt50 v;
OptionList *lst;
Opt52 o;
char *param;
} e;
SInt16 flags;
} Opt48;
//static void Option_PushList(OptionList *lst);
//static void Option_PushOpt(Option *opt, const char *optname);
//static void Option_PopOpt(const char *optname);
//static void Option_PopList();
extern void Args_InitStack();
extern int Args_StackSize();
extern void Args_Push(SInt16 flags, void *first, void *second);
extern Opt48 *Args_Pop(SInt16 flags);
extern void Args_SpellStack(char *buffer, SInt16 flags);
extern void Args_AddToToolArgs(anon0_50 *ta);
extern void Options_Init();
extern OptionList *Options_GetOptions();
extern void Options_SortOptions();
//static void Options_AddOption(Option *opt);
extern int Options_AddList(OptionList *optlst);
extern int Options_AddLists(OptionList **optlst);
//static void Options_Reset(OptionList *optlst);
//static void Option_SpellList(char *buffer, OptionList *conflicts, int flags);
extern int Option_ForTool(Option *opt, int which);
extern int Option_ThisTool();
extern int Option_ForThisTool(Option *opt);
extern int Option_AlsoPassedToTool(Option *opt, int which);
extern int Option_AlsoPassedFromThisTool(Option *opt);
//static Boolean Option_ContinuesThisLevel(int level, ArgToken *tok);
//static Boolean Option_IsEndingThisLevel(int level, ArgToken *tok);
//static Boolean Option_IsEndingLevel(int level, ArgToken *tok);
extern int Option_Parse(Option *opt, int oflags);
//static int Option_MatchString(char *list, char *str, int flags, int *result);
//static Option *Option_Lookup(OptionList *search, void *unk, int *flags);
//static int Options_DoParse(OptionList *search, int flags);
extern int Options_Parse(OptionList *options, int flags);
extern int Option_ParseDefaultOption(OptionList *options);
extern void Option_ParamError(SInt16 id, va_list ap);
extern void Option_ParamWarning(SInt16 id, va_list ap);
extern void Option_OptionError(SInt16 id, va_list ap);
extern void Option_OptionWarning(SInt16 id, va_list ap);
extern void Option_Error(SInt16 id, ...);
extern void Option_Warning(SInt16 id, ...);
extern int Options_Help(const char *keyword);
extern int Option_Help(const char *opt);
extern int Options_DisplayHelp();
/********************************/
/* ParserErrors.c */
extern void CLPReportError_V(const char *format, va_list ap);
extern void CLPReportWarning_V(const char *format, va_list ap);
extern void CLPReport_V(const char *format, va_list ap);
extern void CLPStatus_V(const char *format, va_list ap);
extern void CLPAlert_V(const char *format, va_list ap);
extern void CLPOSAlert_V(const char *format, SInt32 err, va_list ap);
extern void CLPGetErrorString(SInt16 errid, char *buffer);
extern void CLPReportError(SInt16 errid, ...);
extern void CLPReportWarning(SInt16 errid, ...);
extern void CLPReport(SInt16 errid, ...);
extern void CLPAlert(SInt16 errid, ...);
extern void CLPOSAlert(SInt16 errid, SInt16 err, ...);
extern void CLPProgress(SInt16 errid, ...);
extern void CLPStatus(SInt16 errid, ...);
extern void CLPFatalError(const char *format, ...);
extern char curopt[1024];
/********************************/
/* Utils.c */
// something is weird with these parameters
// they're supposed to be just "char"...
extern int my_tolower(unsigned char c);
extern int my_isdigit(unsigned char c);
extern int my_isalpha(unsigned char c);
extern int my_isalnum(unsigned char c);
extern int my_isxdigit(unsigned char c);
extern char *Utils_SpellList(char *list, char *buffer, char opts);
extern int Utils_CompareOptionString(const char *a, const char *b, int cased, int sticky);
/********************************/
/* Parameter.c */
extern void Param_DescHelp(PARAM_T *param, const char **desc, const char **help, const char **defaul);
extern int Param_Compare(PARAM_T *param);
extern int Params_Parse(PARAM_T *param, int flags);
extern void Param_Error(SInt16 id, ...);
extern void Param_Warning(SInt16 id, ...);
/********************************/
/* Help.c */
extern int Help_Option(struct OptionList *lst, struct Option *opt, int subprint, const char *keyword);
extern void Help_Options(struct OptionList *lst, int subprint, const char *keyword);
extern void Help_Usage();
extern void Help_Null();
extern void Help_Init();
extern void Help_Line(char ch);
extern void Help_Term();
/********************************/
/* */
/********************************/
/* */
/********************************/
/* ?? COS */
// static COS_pstrcpy
// static COS_pstrcat
// static COS_pstrcharcat
// static COS_pstrcmp
extern Handle COS_NewHandle(SInt32 byteCount);
extern Handle COS_NewOSHandle(SInt32 logicalSize);
extern void COS_FreeHandle(Handle handle);
extern Boolean COS_ResizeHandle(Handle handle, SInt32 newSize);
extern SInt32 COS_GetHandleSize(Handle handle);
extern void COS_LockHandle(Handle handle);
extern void COS_LockHandleHi(Handle handle);
extern void COS_UnlockHandle(Handle handle);
extern int COS_GetHandleState(Handle handle);
extern void COS_SetHandleState(Handle handle, int state);
extern Boolean COS_IsLockedState(int state);
extern char *COS_NewPtr(SInt32 byteCount);
extern char *COS_NewPtrClear(SInt32 byteCount);
extern void COS_FreePtr(char *ptr);
extern void COS_AppendPtrToHandle(char *ptr1, Handle hand2, SInt32 size);
extern OSErr COS_GetMemErr();
extern SInt32 COS_GetTicks();
extern SInt32 COS_GetTime();
extern void COS_GetString(char *buffer, SInt16 strListID, SInt16 index);
extern void COS_GetPString(unsigned char *buffer, SInt16 strListID, SInt16 index);
extern Boolean COS_IsMultiByte(char *buffer, char *str);
extern SInt16 COS_FileNew(const FSSpec *spec, SInt16 *refNum, OSType creator, OSType fileType);
extern SInt16 COS_FileOpen(const FSSpec *spec, SInt16 *refNum);
extern SInt16 COS_FileGetType(const FSSpec *spec, OSType *fileType);
extern SInt16 COS_FileGetSize(SInt16 refNum, SInt32 *logEOF);
extern SInt16 COS_FileRead(SInt16 refNum, void *buffPtr, SInt32 count);
extern SInt16 COS_FileWrite(SInt16 refNum, const void *buffPtr, SInt32 count);
extern SInt16 COS_FileGetPos(SInt16 refNum, SInt32 *filePos);
extern SInt16 COS_FileSetPos(SInt16 refNum, SInt32 filePos);
extern SInt16 COS_FileClose(SInt16 refNum);
extern void COS_FileSetFSSpec(FSSpec *spec, unsigned char *path);
extern SInt16 COS_FileMakeFSSpec(SInt16 vRefNum, SInt32 dirID, unsigned char *fileName, FSSpec *spec);
extern SInt16 COS_FileMakeFSSpecWithPath(const FSSpec *inputSpec, unsigned char *fileName, FSSpec *spec);
extern SInt16 COS_FileGetFileInfo(const FSSpec *spec, OSType *creator, OSType *fileType);
extern void COS_FileGetFSSpecInfo(const FSSpec *spec, SInt16 *vRefNum, SInt32 *dirID, unsigned char *fileName);
//static void COS_MakePath(SInt16 vRefNum, SInt32 dirID, char *path);
extern void COS_FileGetPathName(char *buffer, const FSSpec *spec, SInt32 *mdDat);
extern Boolean COS_EqualFileSpec(const FSSpec *a, const FSSpec *b);
// TODO sort me
extern Project *gProj;
extern ParserTool *pTool;
extern PCmdLine optsCmdLine;
extern PCmdLineEnvir optsEnvir;
extern PCmdLineCompiler optsCompiler;
extern PCmdLineLinker optsLinker;
extern CLState clState;
/********************************/
/* CmdLineBuildDate.c */
extern char CMDLINE_BUILD_DATE[];
extern char CMDLINE_BUILD_TIME[];
/********************************/
/* MISC */
extern char cmdline_build_date[32];
extern char cmdline_build_time[32];
extern StringPtr pstrcpy(StringPtr dst, ConstStringPtr src);
extern int (*PrefPanelsChangedCallback)(const char *);
extern Boolean systemHandles;
extern char *MAINOPTCHAR;
extern char *SEPOPTSTR;
extern char compat;
extern anon0_50 linkargs;
#ifdef __cplusplus
}
#endif