MWCC/mwcc_decomp.h

1919 lines
69 KiB
C

#pragma once
#include <MacHeadersMach-O>
#define macintosh
#include "sdk_hdrs/CompilerMapping.h"
#include "sdk_hdrs/DropInCompilerLinker.h"
#ifdef __cplusplus
extern "C" {
#endif
/********************************/
/* OS Garbage */
typedef struct OSPathSpec {
char s[256];
} OSPathSpec;
typedef struct OSNameSpec {
char s[64];
} OSNameSpec;
typedef struct OSSpec {
OSPathSpec path;
OSNameSpec name;
} OSSpec;
typedef struct OSHandle {
void *addr;
unsigned long used;
unsigned long size;
} OSHandle;
typedef struct {
OSSpec spec;
OSHandle hand;
unsigned char loaded;
unsigned char changed;
unsigned char writeable;
} OSFileHandle; // assumed name
/********************************/
/* 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;
unsigned long ormask;
unsigned long andmask;
void *num;
} MASK_T;
typedef struct STRING_T {
char which;
char flags;
char *myname;
PARAM_T *next;
short maxlen;
unsigned char pstring;
char *str;
} STRING_T;
typedef struct SET_T {
char which;
char flags;
char *myname;
PARAM_T *next;
char size;
unsigned long 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;
void (*parse)(); // TODO missing sig
void *var;
char *help;
} GENERIC_T;
typedef struct SETTING_T {
char which;
char flags;
char *myname;
PARAM_T *next;
void (*parse)(); // TODO missing sig
char *valuename;
} SETTING_T;
typedef struct TOGGLE_T {
char which;
char flags;
char *myname;
PARAM_T *next;
char size;
unsigned long mask;
void *num;
} TOGGLE_T;
typedef struct NUM_T {
char which;
char flags;
char *myname;
PARAM_T *next;
char size;
char fit;
unsigned long lo;
unsigned long 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;
unsigned long *fc;
unsigned char 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,
HELPFLAGS_10000 = 0x10000,
HELPFLAGS_20000 = 0x20000,
HELPFLAGS_40000 = 0x40000,
HELPFLAGS_80000 = 0x80000,
HELPFLAGS_100000 = 0x100000,
HELPFLAGS_200000 = 0x200000,
HELPFLAGS_400000 = 0x400000,
HELPFLAGS_700000 = 0x700000,
HELPFLAGS_800000 = 0x800000,
HELPFLAGS_801828 = 0x801828,
HELPFLAGS_1000000 = 0x1000000,
HELPFLAGS_2000000 = 0x2000000,
HELPFLAGS_4000000 = 0x4000000,
HELPFLAGS_8000000 = 0x8000000,
HELPFLAGS_10000000 = 0x10000000,
HELPFLAGS_20000000 = 0x20000000,
HELPFLAGS_40000000 = 0x40000000,
HELPFLAGS_80000000 = 0x80000000
};
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_5 = 5,
PARAMWHICH_6 = 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
};
enum {
PARAMFLAGS_1 = 1,
PARAMFLAGS_2 = 2,
PARAMFLAGS_3 = 3,
PARAMFLAGS_4 = 4,
PARAMFLAGS_8 = 8
};
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_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;
unsigned char recursive;
long subdirectoryCount;
FSSpec *subdirectories;
};
struct IDEAccessPathList {
long userPathCount;
struct IDEAccessPath *userPaths;
long systemPathCount;
struct IDEAccessPath *systemPaths;
unsigned char alwaysSearchUserPaths;
unsigned char convertPaths;
};
#ifdef __MWERKS__
#pragma options align=mac68k
#endif
typedef struct CWObjectFlags {
short version;
long flags;
const char *objFileExt;
const char *brsFileExt;
const char *ppFileExt;
const char *disFileExt;
const char *depFileExt;
const char *pchFileExt;
CWDataType objFileCreator;
CWDataType objFileType;
CWDataType brsFileCreator;
CWDataType brsFileType;
CWDataType ppFileCreator;
CWDataType ppFileType;
CWDataType disFileCreator;
CWDataType disFileType;
CWDataType depFileCreator;
CWDataType depFileType;
} CWObjectFlags;
#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 CWPluginPrivateContext {
long request;
long apiVersion;
void *shellContext;
void *pluginStorage;
FSSpec projectFile;
FSSpec outputFileDirectory;
long shellSignature;
long pluginType;
long numFiles;
long numOverlayGroups;
short callbackOSError;
short pluginOSError;
CWIDEInfo *shellInfo;
struct IDEAccessPathList *accessPathList;
long dontEatEvents;
struct FSSpec *targetDataDirectorySpec;
long reserved[17];
struct CW_BasePluginCallbacks *callbacks;
};
// Pref panels
#ifdef __MWERKS__
#pragma options align=mac68k
#endif
typedef struct PCmdLine {
short version;
short state;
short stages;
short toDisk;
short outNameOwner;
unsigned char dryRun;
unsigned char debugInfo;
short verbose;
unsigned char showLines;
unsigned char timeWorking;
unsigned char noWarnings;
unsigned char warningsAreErrors;
unsigned short maxErrors;
unsigned short maxWarnings;
short msgStyle;
unsigned char noWrapOutput;
unsigned char stderr2stdout;
unsigned char noCmdLineWarnings;
} PCmdLine;
typedef struct PCmdLineCompiler {
short version;
unsigned char noSysPath;
unsigned char noFail;
short includeSearch;
char linkerName[64];
char objFileExt[15];
char brsFileExt[15];
char ppFileExt[15];
char disFileExt[15];
char depFileExt[15];
char pchFileExt[15];
CWDataType objFileCreator;
CWDataType objFileType;
CWDataType brsFileCreator;
CWDataType brsFileType;
CWDataType ppFileCreator;
CWDataType ppFileType;
CWDataType disFileCreator;
CWDataType disFileType;
CWDataType depFileCreator;
CWDataType depFileType;
unsigned char compileIgnored;
unsigned char relPathInOutputDir;
unsigned char browserEnabled;
unsigned char depsOnlyUserFiles;
char outMakefile[256];
char forcePrecompile;
unsigned char ignoreMissingFiles;
unsigned char printHeaderNames;
char sbmState;
char sbmPath[256];
unsigned char canonicalIncludes;
unsigned char keepObjects;
} PCmdLineCompiler;
typedef struct PCmdLineLinker {
short version;
unsigned char callPreLinker;
unsigned char callPostLinker;
unsigned char keepLinkerOutput;
unsigned char callLinker;
} PCmdLineLinker;
typedef struct PCmdLineEnvir {
short version;
short cols;
short rows;
unsigned char underIDE;
} PCmdLineEnvir;
typedef struct PBackEnd {
short version;
unsigned char structalignment;
unsigned char tracebacktables;
unsigned char processor;
unsigned char readonlystrings;
unsigned char profiler;
unsigned char fpcontract;
unsigned char schedule;
unsigned char peephole;
unsigned char processorspecific;
unsigned char altivec;
unsigned char vrsave;
unsigned char autovectorize;
unsigned char usebuiltins;
unsigned char pic;
unsigned char dynamic;
unsigned char common;
unsigned char implicit_templates;
unsigned char reserved[3];
} PBackEnd;
typedef struct PDisassembler {
short version;
unsigned char showcode;
unsigned char extended;
unsigned char mix;
unsigned char nohex;
unsigned char showdata;
unsigned char showexceptions;
unsigned char showsym;
unsigned char shownames;
} PDisassembler;
typedef struct PMachOLinker {
short version;
unsigned char linksym;
unsigned char symfullpath;
unsigned char suppresswarn;
unsigned char linkmap;
unsigned char multisymerror;
unsigned char whatfileloaded;
unsigned char whyfileloaded;
unsigned char use_objectivec_semantics;
char undefinedsymbols;
char readonlyrelocs;
char reserved_value1;
char reserved_value2;
short exports;
short reserved_short1;
unsigned long currentversion;
unsigned long compatibleversion;
long reserved_long1;
char mainname[64];
unsigned char prebind;
unsigned char dead_strip;
unsigned char twolevel_namespace;
unsigned char strip_debug_symbols;
} PMachOLinker;
typedef struct PMachOProject {
short version;
short type;
unsigned char outfile[64];
long filecreator;
long filetype;
long stacksize;
long stackaddress;
unsigned long reserved1;
unsigned long reserved2;
unsigned long reserved3;
unsigned long reserved4;
unsigned long reserved5;
unsigned long reserved6;
unsigned long reserved7;
unsigned long reserved8;
unsigned long reserved9;
unsigned long reserved10;
unsigned long reserved11;
unsigned long reserved12;
unsigned long reserved13;
unsigned long reserved14;
unsigned long reserved15;
unsigned long reserved16;
unsigned long reserved17;
unsigned long reserved18;
unsigned long reserved19;
unsigned long reserved20;
unsigned char flatrsrc;
unsigned char filler1;
unsigned char filler2;
unsigned char filler3;
unsigned char separateflatfile[64];
unsigned char installpath[256];
} PMachOProject;
typedef struct {
short version;
unsigned char userSetCreator;
unsigned char userSetType;
unsigned char gPrintMapToStdOutput;
unsigned char mapfilename[256];
unsigned char symfilename[256];
} PCLTExtras;
#ifdef __MWERKS__
#pragma options align=reset
#endif
typedef struct CWCommandLineArgs {
int argc;
char **argv;
char **envp;
} CWCommandLineArgs;
typedef struct VersionInfo {
unsigned short major;
unsigned short minor;
unsigned short patch;
unsigned short build;
} VersionInfo;
typedef struct CLPluginInfo {
unsigned long plugintype;
unsigned long language;
long dropinflags;
char *version;
unsigned char storeCommandLine;
} CLPluginInfo;
typedef struct ToolVersionInfo {
char *company;
char *product;
char *tool;
char *copyright;
char *version;
} ToolVersionInfo;
// may not actually be named this
struct ParseOptsType {
CWPluginContext context;
char helpKey[64];
long helpFlags;
unsigned short ioCols;
unsigned short ioRows;
CWCommandLineArgs *args;
ToolVersionInfo *toolVersion;
int numPlugins;
CLPluginInfo *plugins;
int numPanels;
char **panelNames;
unsigned long cpu;
unsigned long os;
char lastoutputname[256];
long currentSegment;
long currentOverlayGroup;
long currentOverlay;
int possibleFiles;
int userSpecifiedFiles;
int unusedFiles;
unsigned char hadAnyOutput;
unsigned char hadErrors;
unsigned char showHelp;
unsigned char underIDE;
unsigned char alwaysUsePaths;
unsigned char noOptions;
unsigned char printedVersion;
unsigned char passingArgs;
unsigned char disToFile;
unsigned char ppToFile;
unsigned char initBefore;
unsigned char weakImport;
unsigned char mergeIntoOutput;
unsigned char success;
unsigned char ignoreUnknown;
unsigned char unused[2];
};
// assumed name
typedef struct CLState {
int argc;
const char **argv;
CWDataType cpu;
CWDataType os;
CWDataType plugintype;
CWDataType language;
CWDataType style;
OSSpec programPath;
const char *programName;
short numWarnings;
short numErrors;
Boolean pluginDebug;
Boolean userBreak;
Boolean reachedWarningThreshold;
Boolean reachedErrorThreshold;
OSSpec makefileSpec;
OSPathSpec sbmPathSpec;
OSHandle browseHandle;
const char *stdoutBase;
int appendToStdoutBase;
} CLState;
typedef struct OSFileTypeMapping {
CWDataType mactype;
const char *magic;
char length;
const char *mimetype;
char executable; // not sure why this is rearranged
} OSFileTypeMapping;
typedef struct OSFileTypeMappingList {
short numMappings;
const OSFileTypeMapping *mappings;
} OSFileTypeMappingList;
typedef struct BasePluginCallbacks {
short (*main)();
short (*GetDropInFlags)(const DropInFlags **flags, long *flagsSize);
short (*GetDisplayName)(const char **displayName);
short (*GetDropInName)(const char **dropInName);
short (*GetPanelList)(const CWPanelList **panelList);
short (*GetFamilyList)(const CWFamilyList **familyList);
short (*GetHelpInfo)(const CWHelpInfo **helpInfo);
short (*GetVersionInfo)(const VersionInfo **versionInfo);
short (*GetFileTypeMappings)(const OSFileTypeMappingList **mappingList);
} BasePluginCallbacks;
typedef struct CompilerLinkerPluginCallbacks {
short (*GetTargetList)(const struct CWTargetList **targetList);
short (*GetDefaultMappingList)();
short (*Unmangle)();
short (*BrSymbolEntryPoint)();
short (*GetObjectFlags)();
short (*WriteObjectFile)();
} CompilerLinkerPluginCallbacks;
typedef struct ParserPluginCallbacks {
short (*SupportsPlugin)();
short (*SupportsPanels)();
} ParserPluginCallbacks;
typedef struct {
char *name;
void *ptr;
long size;
} PrefDataPanel; // assumed name
typedef struct {
CWDataType TYPE;
CWDataType LANG;
CWDataType CPU;
CWDataType 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
typedef struct PrefPanel { // assumed name
char *name;
Handle data;
Handle workData;
struct PrefPanel *next;
} PrefPanel; // assumed name
// CLAccessPaths
typedef struct Paths {
struct Path **array;
unsigned short capacity;
unsigned short count;
} Paths; // assumed name
typedef struct Frameworks {
struct Framework **array;
unsigned short capacity;
unsigned short count;
} Frameworks; // assumed name
typedef struct Path {
OSPathSpec *spec;
Paths *subpaths;
int x8;
short xC;
} Path; // assumed name
typedef struct Framework {
OSSpec frameworkSpec;
OSPathSpec name;
OSPathSpec version;
Path *containingPath;
Boolean flag344;
} Framework; // assumed name
// CLFiles
typedef struct File {
struct File *next;
int index;
// TODO fill me up
} File;
typedef struct Files {
File *files;
int count;
} Files; // assumed name
typedef struct VFile {
char name[32];
Handle hand;
struct VFile *next;
} VFile; // assumed name
// CLOverlays
typedef struct Overlay {
char name[256];
int *fileIDList;
int fileCount;
int fileCapacity;
struct Overlay *next;
} Overlay; // assumed name
typedef struct OvlGroup {
char name[256];
CWAddr64 addr;
Overlay *overlays;
Overlay *lastOverlay;
int overlayCount;
struct OvlGroup *next;
} OvlGroup; // assumed name
typedef struct Overlays {
OvlGroup *groups;
OvlGroup *lastGroup;
} Overlays; // assumed name
// CLSegs
typedef struct Segment {
char name[32];
short attributes;
} Segment; // assumed name
typedef struct Segments {
Segment **array;
unsigned short capacity;
unsigned short count;
} Segments; // assumed name
// CLDependencies
typedef struct Incls {
struct Target *target;
// ...
Paths *paths;
} Incls; // assumed name
typedef struct Deps {
int x0;
int x4;
int x8;
Incls *incls;
} Deps; // assumed name
// CLTarg
typedef struct Target {
int count0;
int count4;
int count8;
int countC;
CWTargetInfo *targetInfo;
Segments segments;
Overlays overlays;
int x28;
Files accessPathFiles;
Files files2;
Incls incls;
Paths systemPaths;
Paths userPaths;
CWDataType language;
CWDataType cpu;
CWDataType os;
char name[64];
struct Plugin *preLinker;
struct Plugin *linker;
struct Plugin *postLinker;
unsigned long preLinkerFlags;
unsigned long linkerFlags;
unsigned long postLinkerFlags;
OSPathSpec cwd;
VFile *vfiles;
struct Target *next;
} Target; // assumed name
typedef struct Plugin {
BasePluginCallbacks *cb;
CompilerLinkerPluginCallbacks *clcb;
ParserPluginCallbacks *pcb;
void *context;
char *versionInfoASCII;
struct Plugin *next;
} Plugin;
typedef struct Token {
int x0;
void *x4;
} Token;
/********************************/
/* UMain.c */
extern int main(int argc, const char **argv);
extern int RegisterResource(const char *name, short index, void *data);
extern int RegisterStaticPlugin(const BasePluginCallbacks *cb);
extern int RegisterStaticCompilerLinkerPlugin(const BasePluginCallbacks *cb, void *b);
extern int RegisterStaticParserPlugin(const BasePluginCallbacks *cb, void *b);
extern void SetBuildTarget(CWDataType cpu, CWDataType os);
extern void SetParserType(CWDataType style);
extern void SetPluginType(CWDataType language, CWDataType plugintype);
extern int CmdLine_Initialize(int argc, const char **argv, const char *buildDate, const char *buildTime);
extern int CmdLine_Driver();
extern int CmdLine_Terminate(int code);
/********************************/
/* UCLTMain.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();
/********************************/
/* Resources.c */
/********************************/
/* ?? CL Errors */
//static void CLGetErrorString(short errid, char *buffer);
//static void CLMessageReporter(int kind, short errid, va_list ap);
extern void CLReportError(short errid, ...);
extern void CLReportWarning(short errid, ...);
extern void CLReport(short errid, ...);
extern void CLReportOSError(short errid, long err, ...);
extern void CLReportCError(short errid, long err, ...);
extern void CLInternalError(const char *filename, int linenum, const char *format, ...);
extern void CLFatalError(const char *format, ...);
/********************************/
/* ?? Res */
extern void Res_Initialize();
extern void Res_AddResource(const char *name, short id, const void *data);
extern const char *Res_GetResource(short listIndex, short strId);
extern void Res_Cleanup();
/********************************/
/* CLPlugins.c */
//static void GetToolVersionInfo();
extern const ToolVersionInfo *Plugin_GetToolVersionInfo();
//static const char *Plugin_GetDisplayName(Plugin *plugin);
extern const char *Plugin_GetDropInName(Plugin *plugin);
extern VersionInfo *Plugin_GetVersionInfo(Plugin *plugin);
extern const char *Plugin_GetVersionInfoASCII(Plugin *plugin);
extern DropInFlags *Plugin_GetDropInFlags(Plugin *plugin);
extern CWDataType Plugin_GetPluginType(Plugin *plugin);
extern const CWTargetList *Plugin_CL_GetTargetList(Plugin *plugin);
extern const CWPanelList *Plugin_GetPanelList(Plugin *plugin);
extern const CWExtMapList *Plugin_CL_GetExtMapList(Plugin *plugin);
extern const OSFileTypeMappingList *Plugin_GetFileTypeMappingList(Plugin *plugin);
extern const CWObjectFlags *Plugin_CL_GetObjectFlags(Plugin *plugin);
extern Boolean Plugin_MatchesName(Plugin *plugin, const char *name);
extern Boolean Plugin_CL_MatchesTarget(Plugin *plugin, CWDataType cpu, CWDataType os, Boolean flag);
extern Boolean Plugins_CL_HaveMatchingTargets(Plugin *a, Plugin *b, Boolean flag);
//static CL_MatchesExtMapping(CWExtensionMapping *em, CWDataType type, const char *extension, Boolean flag);
extern Boolean Plugin_CL_MatchesFileType(Plugin *plugin, CWDataType type, const char *extension, Boolean flag);
extern Boolean Plugin_MatchesType(Plugin *plugin, CWDataType plugintype, CWDataType edit_language, Boolean flag);
extern Boolean Plugin_Pr_MatchesPlugin(Plugin *plugin, void *unk1, void *unk2, void *unk3); // fixme
extern Boolean Plugin_Pr_MatchesPanels(Plugin *plugin, void *unk1, void *unk2); // fixme
extern Boolean Plugin_CL_WriteObjectFile(Plugin *plugin, FSSpec *fss1, FSSpec *fss2, CWDataType creator, CWDataType filetype, Handle h);
extern Boolean Plugin_CL_GetCompilerMapping(Plugin *plugin, CWDataType type, const char *extension, CompilerMappingFlags *flags);
//static Boolean SupportedPlugin(Plugin *plugin, const char **errmsg);
//static Boolean VerifyPanels(Plugin *plugin);
extern Plugin *Plugin_New(const BasePluginCallbacks *cb, const CompilerLinkerPluginCallbacks *clcb, const ParserPluginCallbacks *pcb);
extern void Plugin_Free(Plugin *plugin);
extern int Plugin_VerifyPanels(Plugin *plugin);
extern void Plugins_Init();
extern void Plugins_Term();
extern int Plugins_Add(Plugin *plugin);
extern Plugin *Plugins_MatchName(Plugin *first, const char *name);
extern Plugin *Plugins_CL_MatchTarget(Plugin *first, CWDataType cpu, CWDataType os, CWDataType plugintype, CWDataType edit_language);
extern Plugin *Plugins_CL_MatchFileType(Plugin *first, CWDataType type, const char *extension, Boolean flag);
extern Plugin *Plugins_GetPluginForFile(Plugin *first, CWDataType plugintype, CWDataType cpu, CWDataType os, CWDataType type, const char *extension);
extern Plugin *Plugins_GetLinker(Plugin *first, CWDataType cpu, CWDataType os);
extern Plugin *Plugins_GetPreLinker(Plugin *first, CWDataType cpu, CWDataType os);
extern Plugin *Plugins_GetPostLinker(Plugin *first, CWDataType cpu, CWDataType os);
extern Plugin *Plugins_GetParserForPlugin(...); // TODO fixme args
extern Plugin *Plugins_GetCompilerForLinker(Plugin *first, Plugin *linker, CWDataType type, const char *extension, CWDataType edit_language);
extern Boolean Plugins_GetPluginList(Plugin *first, int *count, void **list); // TODO fixme define list struct
extern Boolean Plugins_GetPrefPanelUnion(Plugin *first, int *count, void **list); // TODO fixme define struct
extern Boolean Plugin_AddFileTypeMappings(Plugin *plugin, void *unk);
extern Boolean Plugins_AddFileTypeMappingsForTarget(Plugin *first, void *unk, CWDataType cpu, CWDataType os);
extern short Plugin_Call(Plugin *plugin, void *context);
/********************************/
/* ?? parser_cb */
/********************************/
/* CLIO.c */
/********************************/
/* CLToolExec.c */
/********************************/
/* OS TU 1 */
typedef struct uOSTypePair { // unknown name
short a;
short b;
} uOSTypePair;
extern const char *OS_GetErrText(int errnum);
extern int OS_InitProgram(int *pArgc, const char ***pArgv);
extern int OS_TermProgram();
extern int OS_Create(const OSSpec *spec, const uOSTypePair *type);
extern int OS_Status(const OSSpec *spec);
extern int OS_GetFileType(const OSSpec *spec, uOSTypePair *type);
extern int OS_SetFileType(const OSSpec *spec, const uOSTypePair *type);
extern int OS_GetFileTime(const OSSpec *spec, time_t *ctime, time_t *mtime);
extern int OS_SetFileTime(const OSSpec *spec, const time_t *ctime, const time_t *mtime);
extern int OS_Open(const OSSpec *spec, unsigned short mode, int *pRef);
extern int OS_Write(int ref, const void *data, long *pLen);
extern int OS_Read(int ref, void *data, long *pLen);
extern int OS_Seek(int ref, unsigned short how, long offset);
extern int OS_Tell(int ref, long *pOffset);
extern int OS_Close(int ref);
extern int OS_GetSize(int ref, long *pSize);
extern int OS_SetSize(int ref, long size);
extern int OS_Delete(const OSSpec *spec);
extern int OS_Rename(const OSSpec *a, const OSSpec *b);
extern int OS_Mkdir(const OSSpec *spec);
extern int OS_Rmdir(const OSPathSpec *spec);
extern int OS_Chdir(const OSPathSpec *spec);
extern int OS_GetCWD(OSPathSpec *spec);
extern int OS_Execute(); // TODO figure out the args for this properly
extern int OS_IsLegalPath(const char *str);
extern int OS_IsFullPath(const char *str);
extern char *OS_GetDirPtr(OSPathSpec *spec);
//extern int OS_CompactPath(const char *spec, char *dest);
extern int OS_EqualPath(const char *a, const char *b);
extern int OS_CanonPath(const char *src, char *dest);
extern int OS_MakeSpec(const char *path, OSSpec *spec, Boolean *pFlag);
extern int OS_MakeFileSpec(const char *path, OSSpec *spec);
extern int OS_MakePathSpec(const char *a, const char *b, OSPathSpec *spec);
extern int OS_MakeNameSpec(const char *src, OSNameSpec *spec);
extern int OS_GetRootSpec(OSPathSpec *spec);
extern char *OS_SpecToString(const OSSpec *spec, char *output, int maxlen);
extern char *OS_PathSpecToString(const OSPathSpec *spec, char *output, int maxlen);
extern char *OS_NameSpecToString(const OSNameSpec *spec, char *output, int maxlen);
extern int OS_SizeOfPathSpec(const OSPathSpec *spec);
extern int OS_SizeOfNameSpec(const OSNameSpec *spec);
extern int OS_EqualSpec(const OSSpec *a, const OSSpec *b);
extern int OS_EqualPathSpec(const OSPathSpec *a, const OSPathSpec *b);
extern int OS_EqualNameSpec(const OSNameSpec *a, const OSNameSpec *b);
extern int OS_IsDir(const OSSpec *spec);
extern int OS_IsFile(const OSSpec *spec);
extern int OS_IsLink(const OSSpec *spec);
extern int OS_ResolveLink(const OSSpec *src, OSSpec *dest);
extern int OS_OpenDir(const OSPathSpec *spec, void *data); // TODO arg type
extern int OS_ReadDir(void *data, OSSpec *spec, OSNameSpec *nameSpec, Boolean *pFlag);
extern int OS_CloseDir(void *data); // TODO arg type
extern long OS_GetMilliseconds();
extern time_t OS_GetTime(time_t *p);
extern int OS_NewHandle(unsigned long size, OSHandle *hand);
extern int OS_ResizeHandle(OSHandle *hand, unsigned long newSize);
extern void *OS_LockHandle(OSHandle *hand);
extern void OS_UnlockHandle(OSHandle *hand);
extern int OS_FreeHandle(OSHandle *hand);
extern int OS_GetHandleSize(OSHandle *hand, unsigned long *pSize);
extern void OS_InvalidateHandle(OSHandle *handle);
extern Boolean OS_ValidHandle(OSHandle *handle);
extern short OS_MacError(int err);
extern void OS_TimeToMac(time_t t, unsigned long *pMacTime);
extern time_t OS_MacToTime(unsigned long macTime, time_t *p);
extern short OS_RefToMac(int ref);
extern int OS_MacToRef(short macRef);
extern int OS_OpenLibrary(const char *a, int *p);
extern int OS_GetLibrarySymbol(void *a, void *b, int *p);
extern int OS_CloseLibrary(void *a);
extern int OS_LoadMacResourceFork(const OSSpec *spec, void **unkA, void **unkB);
extern int OS_IsMultiByte(const char *str, int offset);
extern char *strcatn(char *dst, const char *src, int maxlen);
extern char *strcpyn(char *dst, const char *src, int maxlen);
extern int ustrcmp(const char *a, const char *b);
extern int ustrncmp(const char *a, const char *b, int maxlen);
/********************************/
/* OS TU 2 */
extern int WildCardMatch(const char *a, const char *b);
extern OSSpec *OS_MatchPath(const char *path);
extern char *OS_GetFileNamePtr(char *path);
extern char *OS_GetDirName(const OSPathSpec *spec, char *buf, int bufsize);
extern int OS_MakeSpec2(const char *a, const char *b, OSSpec *spec);
extern int OS_MakeSpecWithPath(const char *pathSpec, const char *str, Boolean flag, OSSpec *spec);
extern int OS_NameSpecChangeExtension(OSNameSpec *nameSpec, const char *newExt, Boolean flag);
extern int OS_NameSpecSetExtension(OSNameSpec *nameSpec, const char *newExt);
extern char *OS_CompactPaths(char *str, const char *a, const char *b, int lenmaybe);
extern char *OS_SpecToStringRelative(const OSSpec *spec, const OSPathSpec *pathSpec, char *outbuf, int outlen);
extern int OS_FindFileInPath(const char *filename, const char *paths, OSSpec *spec);
extern int OS_FindProgram(const char *path, OSSpec *spec);
extern int OS_CopyHandle(OSHandle *src, OSHandle *dest);
extern int OS_AppendHandle(OSHandle *hand, const void *data, long size);
/********************************/
/* CLProj.c */
typedef struct Proj {
Target *target;
OSPathSpec projDir;
OSNameSpec projName;
} Proj;
extern int Proj_Initialize(Proj *proj);
extern int Proj_Terminate(Proj *proj);
/********************************/
/* ?? License */
extern void License_Initialize();
extern void License_Terminate();
extern long License_Checkout();
extern void License_Refresh();
extern void License_Checkin();
extern void License_AutoCheckin();
/********************************/
/* ?? 'x' funcs */
extern void *xmalloc(const char *str, size_t amount);
extern void *xcalloc(const char *str, size_t amount);
extern void *xrealloc(const char *str, void *curPtr, size_t amount);
extern char *xstrdup(const char *str);
extern void xfree(void *ptr);
/********************************/
/* CLPluginRequests.cpp */
extern Boolean SendParserRequest(
Plugin *plugin,
Target *target,
CWCommandLineArgs *args,
CWDataType cpu,
CWDataType os,
int numPlugin,
void *pluginInfo,
int numPanels,
void *panelNames,
void *pluginArgs,
void *panelArgs,
const char *cmdlineBuildDate,
const char *cmdlineBuildTime,
ToolVersionInfo *toolVersionInfo
);
extern Boolean SendCompilerRequest(Plugin *plugin, File *file, short request);
extern Boolean SendTargetInfoRequest(Target *target, Plugin *plugin, int flags);
extern Boolean SendLinkerRequest(Plugin *plugin, int flags, CWTargetInfo *targetInfo);
extern Boolean SendDisassemblerRequest(Plugin *plugin, File *file);
extern Boolean SendInitOrTermRequest(Plugin *plugin, Boolean action);
/********************************/
/* ?? LM funcs */
extern unsigned long LMGetTicks();
extern unsigned long LMGetTime();
extern short LMGetMemErr();
extern void LMSetMemErr(short err);
/********************************/
/* CLFileOps.c */
extern int GetOutputFile(); // TODO args
extern int StoreObjectFile(); // TODO args
extern int CompileFilesInProject();
extern int LinkProject();
/********************************/
/* CLPrefs.c */
extern PrefPanel *PrefPanel_New(const char *name, void *data, long dataSize);
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);
/********************************/
/* CLTarg.c */
extern Target *Target_New(const char *name, CWDataType cpu, CWDataType os, CWDataType language);
extern void Target_Free(Target *target);
extern void Targets_Term(Target *targets);
extern void Target_Add(Target **targets, Target *targetToAdd);
/********************************/
/* CLAccessPaths.c */
extern Path *Path_Init(const OSPathSpec *pathSpec, Path *path);
extern Path *Path_New(const OSPathSpec *pathSpec);
extern void Path_Free(Path *path);
extern Boolean Paths_Initialize(Paths *paths);
extern Boolean Paths_Terminate(Paths *paths);
//static Boolean Paths_GrowPaths(Paths *paths, unsigned short *pIndex);
extern Boolean Paths_AddPath(Paths *paths, Path *path);
extern Boolean Paths_InsertPath(Paths *paths, unsigned short index, Path *path);
extern Boolean Paths_RemovePath(Paths *paths, unsigned short index);
extern Boolean Paths_DeletePath(Paths *paths, unsigned short index);
extern Path *Paths_GetPath(Paths *paths, unsigned short index);
extern unsigned short Paths_Count(const Paths *paths);
extern Boolean Paths_FindPath(const Paths *paths, const Path *path);
extern Path *Paths_FindPathSpec(const Paths *paths, const OSPathSpec *pathSpec);
//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, unsigned short *pCount);
extern void Paths_CopyRecurseFSS(FSSpec *fss, Paths *paths, unsigned short count);
//static Boolean Frameworks_Initialize(Frameworks *frameworks);
//static Boolean Frameworks_Grow(Frameworks *frameworks, unsigned short *pIndex);
//static Boolean Frameworks_Add(Frameworks *frameworks, Framework *framework);
//static Framework *Framework_Init(OSSpec *frameworkSpec, const char *name, const char *version, Framework *framework, Path *containingPath, Boolean flag);
//static Framework *Framework_New(OSSpec *frameworkSpec, const char *name, const char *version, Path *containingPath, Boolean flag);
//static Boolean CheckForFileInFrameworkDir(char *buf, const char *dir, OSPathSpec *pathSpec, const char *filename);
//static Boolean CheckForFileInFramework(char *buf, int fwIndex, const char *filename);
extern Boolean MakeFrameworkPath(char *buf, const char *frameworkName, OSPathSpec **pOutputSpec);
extern Boolean Frameworks_AddPath(const OSPathSpec *pathSpec);
extern Boolean Frameworks_AddFramework(const char *frameworkName, const char *version, Boolean flag);
extern void Framework_GetEnvInfo();
extern int Frameworks_GetCount();
extern Framework *Frameworks_GetInfo(int index);
/********************************/
/* MacSpecs.c */
// This is pretty much self-contained lol
extern OSErr OS_OSPathSpec_To_VolDir(const OSPathSpec *pathSpec, short *pVol, long *pDir);
extern OSErr OS_OSSpec_To_FSSpec(const OSSpec *spec, FSSpec *fss);
extern OSErr OS_VolDir_To_OSNameSpec(short vol, long dir, OSNameSpec *nameSpec, long *pDir);
extern OSErr OS_VolDir_To_OSPathSpec(short vol, long dir, OSPathSpec *pathSpec);
extern OSErr OS_FSSpec_To_OSSpec(const FSSpec *fss, OSSpec *spec);
extern OSErr OS_GetRsrcOSSpec(const OSSpec *baseSpec, OSSpec *rsrcSpec, Boolean createFlag);
/********************************/
/* StringUtils.c */
extern StringPtr _pstrcpy(StringPtr dst, ConstStringPtr src);
extern StringPtr _pstrcat(StringPtr dst, ConstStringPtr src);
extern StringPtr _pstrcharcat(StringPtr dst, unsigned char c);
extern StringPtr pstrncpy(StringPtr dst, ConstStringPtr src, short maxlen);
extern StringPtr pstrncat(StringPtr dst, ConstStringPtr src, short maxlen);
extern int pstrcmp(ConstStringPtr a, ConstStringPtr b);
extern int pstrchr(ConstStringPtr str, char c);
extern void c2pstrcpy(StringPtr dst, const char *src);
extern void p2cstrcpy(char *dst, ConstStringPtr src);
extern char *mvprintf(char *str, size_t size, const char *format, va_list ap);
extern char *mprintf(char *str, size_t size, const char *format, ...);
extern int HPrintF(Handle hand, const char *format, ...);
/********************************/
/* ?? Handle emulation */
typedef struct MacHandle {
char *addr;
OSHandle hand;
} MacHandle;
extern OSHandle *OS_PeekMacHandle(MacHandle *mh);
//static void FixHandlePtr(MacHandle *mh, char *ptr);
extern MacHandle *OS_CreateMacHandle(OSHandle *hand);
extern MacHandle *OS_CreateMacHandleDup(MacHandle *mh);
extern void OS_DestroyMacHandle(MacHandle *mh, OSHandle *hand);
extern OSErr MemError();
extern Handle NewHandle(long byteCount);
extern Handle NewHandleClear(long byteCount);
extern Handle TempNewHandle(long logicalSize, OSErr *resultCode);
extern void DisposeHandle(Handle h);
extern void HLock(Handle h);
extern void HLockHi(Handle h);
extern void HUnlock(Handle h);
extern void HPurge(Handle h);
extern void HNoPurge(Handle h);
extern SInt8 HGetState(Handle h);
extern void HSetState(Handle h, SInt8 flags);
extern long GetHandleSize(Handle h);
extern void SetHandleSize(Handle h, long size);
extern OSErr PtrAndHand(const void *ptr1, Handle hand2, long size);
extern OSErr PtrToHand(const void *srcPtr, Handle *dstHndl, long size);
extern OSErr HandToHand(Handle *theHndl);
extern OSErr HandAndHand(Handle hand1, Handle hand2);
extern void MoveHHi(Handle h);
extern void BlockMove(const void *srcPtr, void *destPtr, long byteCount);
extern void BlockMoveData(const void *srcPtr, void *destPtr, long byteCount);
extern Ptr NewPtr(long byteCount);
extern void DisposePtr(Ptr p);
extern Ptr NewPtrClear(long byteCount);
extern void DebugStr(ConstStringPtr debuggerMsg);
extern OSErr HandleZone();
extern OSErr ApplicationZone();
/********************************/
/* Files.c */
typedef struct FileParamInfo { // i think this is internal, move it once i impl Files.c
unsigned long creationDate;
unsigned long modifiedDate;
long logicalLen;
long physicalLen;
long rLogicalLen;
long rPhysicalLen;
long x18;
long x1C;
unsigned char attrib;
} FileParamInfo; // assumed name
//static int OS_GetFileParamInfo(const OSSpec *spec, FileParamInfo *info, FInfo *finfo);
//static int OS_SetFileParamInfo(const OSSpec *spec, FileParamInfo *info, FInfo *finfo);
extern OSErr HCreate(short vRefNum, long dirID, ConstStr255Param fileName, OSType creator, OSType fileType);
extern OSErr HOpen(short vRefNum, long dirID, ConstStr255Param fileName, SInt8 permission, short *refNum);
extern OSErr HOpenDF(short vRefNum, long dirID, ConstStr255Param fileName, SInt8 permission, short *refNum);
extern OSErr HDelete(short vRefNum, long dirID, ConstStr255Param fileName);
extern OSErr HRename(short vRefNum, long dirID, ConstStr255Param oldName, ConstStr255Param newName);
extern OSErr HGetFInfo(short vRefNum, long dirID, ConstStr255Param fileName, FInfo *fndrInfo);
extern OSErr HSetFInfo(short vRefNum, long dirID, ConstStr255Param fileName, const FInfo *fndrInfo);
extern OSErr FSpCreate(const FSSpec *spec, OSType creator, OSType fileType, ScriptCode scriptTag);
extern OSErr FSpDirCreate(const FSSpec *spec, ScriptCode scriptTag, long *createdDirID);
extern OSErr FSpOpenDF(const FSSpec *spec, SInt8 permission, short *refNum);
extern OSErr FSpDelete(const FSSpec *spec);
extern OSErr FSpRename(const FSSpec *spec, ConstStr255Param newName);
extern OSErr FSpGetFInfo(const FSSpec *spec, FInfo *fndrInfo);
extern OSErr FSpSetFInfo(const FSSpec *spec, const FInfo *fndrInfo);
extern OSErr HGetVol(StringPtr volName, short *vRefNum, long *dirID);
extern OSErr HSetVol(ConstStr63Param volName, short vRefNum, long dirID);
extern OSErr FlushVol(ConstStr63Param volName, short vRefNum);
extern OSErr FSRead(short refNum, long *count, void *buffPtr);
extern OSErr FSWrite(short refNum, long *count, const void *buffPtr);
extern OSErr FSClose(short refNum);
extern OSErr GetEOF(short refNum, long *logEOF);
extern OSErr SetEOF(short refNum, long logEOF);
extern OSErr GetFPos(short refNum, long *filePos);
extern OSErr SetFPos(short refNum, short posMode, long posOff);
extern OSErr GetVInfo(short drvNum, StringPtr volName, short *vRefNum, long *freeBytes);
extern OSErr PBWriteSync(ParmBlkPtr paramBlock);
extern OSErr PBHGetFInfoSync(HParmBlkPtr paramBlock);
extern OSErr PBHSetFInfoSync(HParmBlkPtr paramBlock);
extern OSErr PBGetCatInfoSync(CInfoPBPtr paramBlock);
extern OSErr ResolveAliasFile(FSSpec *theSpec, Boolean resolveAliasChains, Boolean *targetIsFolder, Boolean *wasAliased);
extern OSErr FSMakeFSSpec(short vRefNum, long dirID, ConstStr255Param fileName, FSSpec *spec);
extern OSErr Allocate(short refNum, long *count);
extern StringPtr c2pstr(char *str);
extern char *p2cstr(StringPtr str);
extern short CharacterByteType(Ptr textBuf, short textOffset, ScriptCode script);
extern short CharByte();
extern void GetDateTime(unsigned long *secs);
extern Boolean EqualString(ConstStr255Param str1, ConstStr255Param str2, Boolean caseSensitive, Boolean diacSensitive);
extern void GetIndString(Str255 theString, short strListID, short index);
extern char *getindstring(char *theString, short strListID, short index);
extern void NumToString(long theNum, Str255 theString);
extern void StringToNum(ConstStr255Param theString, long *theNum);
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
/********************************/
/* CLFiles.c */
extern File *File_New();
extern void File_Free(File *file);
extern int Files_Initialize(Files *files);
extern int Files_Terminate(Files *files);
extern int Files_AddFile(Files *files, File *file);
extern int Files_InsertFile(Files *files, File *file, int index);
extern File *Files_GetFile(Files *files, int index);
extern File *Files_FindFile(Files *files, OSSpec *spec);
extern int Files_Count(Files *files);
extern int VFiles_Initialize(VFile **vfiles);
extern int VFiles_Terminate(VFile **vfiles);
extern VFile *VFile_New(const char *name, Handle data);
extern int VFiles_Add(VFile **vfiles, VFile *vfile);
extern VFile *VFiles_Find(VFile *vfiles, const char *name);
/********************************/
/* CLOverlays.c */
extern int Overlays_Initialize(Overlays *overlays);
extern int Overlays_Terminate(Overlays *overlays);
extern int Overlays_AddOvlGroup(Overlays *overlays, OvlGroup *group, int *pIndex);
extern OvlGroup *Overlays_GetOvlGroup(Overlays *overlays, int index);
extern int Overlays_CountGroups(Overlays *overlays);
extern int Overlays_AddFileToOverlay(Overlays *overlays, int groupIndex, int overlayIndex, int fileID);
extern Overlay *Overlays_GetOverlayInGroup(Overlays *overlays, int groupIndex, int overlayIndex);
extern int Overlays_GetFileInOverlay(Overlays *overlays, int groupIndex, int overlayIndex, int fileIndex);
extern OvlGroup *OvlGroup_New(const char *name, CWAddr64 addr);
extern void OvlGroup_Delete(OvlGroup *group);
extern int OvlGroup_AddOverlay(OvlGroup *group, Overlay *overlay, int *pIndex);
extern Overlay *OvlGroup_GetOverlay(OvlGroup *group, int index);
extern int OvlGroup_CountOverlays(OvlGroup *group);
extern Overlay *Overlay_New(const char *name);
extern void Overlay_Delete(Overlay *overlay);
extern int Overlay_AddFile(Overlay *overlay, int fileID, int *pIndex);
extern int Overlay_GetFile(Overlay *overlay, int index);
extern int Overlay_CountFiles(Overlay *overlay);
/********************************/
/* CLSegs.c */
extern Segment *Segment_New(const char *name, unsigned short a);
extern void Segment_Free(Segment *segment);
extern int Segments_Initialize(Segments *segments);
extern int Segments_Terminate(Segments *segments);
//static Boolean Segments_GrowSegments(Segments *segments, unsigned short *pIndex);
extern int Segments_AddSegment(Segments *segments, Segment *segment, unsigned short *pIndex);
extern Boolean Segments_InsertSegment(Segments *segments, unsigned short index, Segment *segment);
extern Boolean Segments_DeleteSegment(Segments *segments, unsigned short index);
extern Segment *Segments_GetSegment(Segments *segments, unsigned short index);
extern unsigned short Segments_Count(const Segments *segments);
/********************************/
/* CLDropinCallbacks_V10.cpp */
// TODO
/********************************/
/* MacFileTypes.c */
typedef struct OSFileTypeMappingListNode {
OSFileTypeMappingList *list;
struct OSFileTypeMappingListNode *next;
} OSFileTypeMappingListNode; // assumed name
extern void OS_AddFileTypeMappingList(OSFileTypeMappingListNode **node, OSFileTypeMappingList *list);
extern void OS_UseFileTypeMappings(OSFileTypeMappingListNode *node);
extern void OS_MacType_To_OSType(OSType mactype, uOSTypePair *ostype);
extern int OS_SetMacFileType(const OSSpec *spec, OSType mactype);
extern int OS_GetMacFileTypeMagic(const void *magic, int length, OSType *mactype);
extern int OS_GetMacFileType(const OSSpec *spec, OSType *mactype);
extern int OS_SetMacFileCreatorAndType(const OSSpec *spec, OSType creator, OSType mactype);
/********************************/
/* ?? Handles */
//extern int OS_LoadFileHandle(OSFileHandle *fh);
//extern int OS_WriteFileHandle(OSFileHandle *fh);
extern int OS_NewFileHandle(const OSSpec *spec, OSHandle *hand, Boolean writeable, OSFileHandle *fh);
extern int OS_LockFileHandle(OSFileHandle *fh, Ptr *h, unsigned long *pSize);
extern int OS_UnlockFileHandle(OSFileHandle *fh);
extern int OS_FreeFileHandle(OSFileHandle *fh);
extern void OS_GetFileHandleSpec(const OSFileHandle *fh, OSSpec *spec);
/********************************/
/* CLCompilerLinkerDropin_V10.cpp */
// TODO
/********************************/
/* CLDependencies.c */
extern int Incls_Initialize(Incls *incls);
extern void Incls_Terminate(Incls *incls);
// IsSysIncl
// MakeInclFileSpec
// QuickFindFileInIncls
// SameIncl
// FindOrAddGlobalInclPath
// _FindFileInPath
// FindFileInPaths
// AddFileToIncls
extern int Incls_FindFileInPaths(Incls *incls, ...); // TODO sig
extern int Deps_Initialize(Deps *deps, Incls *incls);
extern void Deps_Terminate(Deps *deps);
extern int Deps_ChangeSpecialAccessPath(OSPathSpec *pathSpec, Boolean flag);
extern Path *Deps_GetSpecialAccessPath();
//extern void SetSpecialAccessPathFromIncludeStackTOS();
// FindDepFile
// AddDepFile
extern int Deps_AddDependency(); // TODO sig
// EscapeName
extern int Deps_ListDependencies(); // TODO sig
/********************************/
/* CLWriteObjectFile.c */
extern Boolean WriteObjectFile(File *file, OSType creator, OSType filetype);
extern Boolean WriteBrowseData(File *file);
/********************************/
/* CLBrowser.c */
// GetBrowseTableInfoAndLock
extern int Browser_Initialize(OSHandle *hand);
//static int Destroy(OSHandle *hand);
extern int Browser_Terminate(OSHandle *hand);
extern int Browser_SearchFile(OSHandle *hand, const char *path, short *pIndex);
extern int Browser_SearchAndAddFile(OSHandle *hand, const char *path, short *pIndex);
//static long CalcDiskSpaceRequirements(...); // needs table type
//static int ConvertMemToDisk(...); // needs table type
extern int Browser_PackBrowseFile(Handle h, OSHandle *hand, OSHandle *hand2);
/********************************/
/* ?? Include Cache */
// TODO
/********************************/
/* ?? Error */
extern char *GetSysErrText(short code, char *buffer);
/********************************/
/* Might be cc-mach-ppc-mw.c? */
extern void GetStaticTarget(CWDataType *cpu, CWDataType *os);
extern void GetStaticPluginType(CWDataType *language, CWDataType *plugintype);
extern void GetStaticParserPluginType(CWDataType *style);
extern int RegisterStaticTargetResources();
extern int RegisterStaticTargetPlugins();
/********************************/
/* Might be ParserGlue-mach-ppc-cc.c? */
extern int RegisterStaticParserToolInfo();
/********************************/
/* Might be cc-mach-ppc.c? */
extern pascal short CWPlugin_GetDropInFlags(const DropInFlags **flags, long *flagsSize);
extern pascal short CWPlugin_GetTargetList(const CWTargetList **targetList);
extern pascal short CWPlugin_GetDropInName(const char **dropinName);
extern pascal short CWPlugin_GetDisplayName(const char **displayName);
extern pascal short CWPlugin_GetDefaultMappingList(const CWExtMapList **defaultMappingList);
extern pascal short 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(short 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(short 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 CWResult Parser_StorePanels(CWPluginContext context);
extern short CWParser_GetDropInFlags(const DropInFlags **flags, long *flagsSize);
extern short CWParser_GetDropInName(const char **dropinName);
extern short CWParser_GetDisplayName(const char **displayName);
extern short CWParser_GetPanelList(const CWPanelList **panelList);
extern short CWParser_GetTargetList(const CWTargetList **targetList);
extern short CWParser_GetVersionInfo(const VersionInfo **versioninfo);
extern short Parser_SupportsPlugin(struct CLPluginInfo *pluginfo, CWDataType cpu, CWDataType os, Boolean *isSupported);
extern short Parser_SupportsPanels(int numPanels, char **panelNames, Boolean *isSupported);
extern short parser_main(CWPluginContext 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, short 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, long 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, long 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, long *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(short errid, short type, va_list va);
extern void ToolReportWarning(short id, ...);
extern void ToolReportError(short id, ...);
extern void ToolReportOSError(short id, ...);
extern void ToolReportInfo(short 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 {
short 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, short 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(long position, short which, char *outfilename);
extern int AddFileToProject(OSSpec *oss, short which, char *outfilename, Boolean exists, long position);
extern Boolean GetFileInfo(long position, OSSpec *spec, char *plugin);
extern int AddAccessPath(const OSPathSpec *oss, short type, long 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, CWAddr64 *addr, long *groupnum, long *overlaynum);
extern void AddOverlay(long groupnum, const char *name, long *overlaynum);
extern void AddSegment(const char *name, short attrs, long *segmentnum);
extern void ChangeSegment(long segmentnum, const char *name, short attrs);
extern int GetSegment(long segmentnum, char *name, short *attrs);
/********************************/
/* Targets.c */
extern int SetParserToolInfo(ParserTool *tool);
extern Boolean ParserToolMatchesPlugin(CWDataType type, CWDataType lang, CWDataType cpu, CWDataType 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;
short 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(short flags, void *first, void *second);
extern Opt48 *Args_Pop(short flags);
extern void Args_SpellStack(char *buffer, short 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(short id, va_list ap);
extern void Option_ParamWarning(short id, va_list ap);
extern void Option_OptionError(short id, va_list ap);
extern void Option_OptionWarning(short id, va_list ap);
extern void Option_Error(short id, ...);
extern void Option_Warning(short 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, long err, va_list ap);
extern void CLPGetErrorString(short errid, char *buffer);
extern void CLPReportError(short errid, ...);
extern void CLPReportWarning(short errid, ...);
extern void CLPReport(short errid, ...);
extern void CLPAlert(short errid, ...);
extern void CLPOSAlert(short errid, short err, ...);
extern void CLPProgress(short errid, ...);
extern void CLPStatus(short errid, ...);
extern void CLPFatalError(const char *format, ...);
/********************************/
/* Utils.c */
extern int my_tolower(char c);
extern int my_isdigit(char c);
extern int my_isalpha(char c);
extern int my_isalnum(char c);
extern int my_isxdigit(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 */
//static int Param_None();
//static void DescHelpParam_None(PARAM_T *p, const char **desc, const char **help, const char **defaul);
//static int CompareParam_None();
//static void DescHelpParam_Number(NUM_T *p, const char **desc, const char **help, const char **defaul);
//static int CompareParam_Number();
//static int Param_Number(NUM_T *p, const char *pstr);
//static void DescHelpParam_FTypeCreator(FTYPE_T *p, const char **desc, const char **help, const char **defaul);
//static int CompareParam_FTypeCreator();
//static int Param_FTypeCreator(FTYPE_T *p, const char *pstr);
//static void DescHelpParam_String(STRING_T *p, const char **desc, const char **help, const char **defaul);
//static int CompareParam_String();
//static int Param_String(STRING_T *p, const char *pstr);
//static void DescHelpParam_ID_or_SYM(STRING_T *p, const char **desc, const char **help, const char **defaul);
//static int CompareParam_ID_or_SYM();
//static int Param_ID_or_SYM(STRING_T *p, const char *pstr);
//static void DescHelpParam_OnOff(ONOFF_T *p, const char **desc, const char **help, const char **defaul);
//static int CompareParam_OnOff();
//static int Param_OnOff(ONOFF_T *p, const char *pstr);
//static void DescHelpParam_OffOn(ONOFF_T *p, const char **desc, const char **help, const char **defaul);
//static int CompareParam_OffOn();
//static int Param_OffOn(OFFON_T *p, const char *pstr);
//static void DescHelpParam_FilePath(FILEPATH_T *p, const char **desc, const char **help, const char **defaul);
//static int CompareParam_FilePath();
//static int Param_FilePath(FILEPATH_T *p, const char *pstr);
//static void DescHelpParam_Mask(MASK_T *p, const char **desc, const char **help, const char **defaul);
//static int CompareParam_Mask(MASK_T *p);
//static int Param_Mask(MASK_T *p, const char *pstr, int flags);
//static void DescHelpParam_Toggle(TOGGLE_T *p, const char **desc, const char **help, const char **defaul);
//static int CompareParam_Toggle(TOGGLE_T *p);
//static int Param_Toggle(TOGGLE_T *p, const char *pstr);
//static void DescHelpParam_Set(SET_T *p, const char **desc, const char **help, const char **defaul);
//static int CompareParam_Set(SET_T *p);
//static int Param_Set(SET_T *p, const char *pstr, int flags);
//static void DescHelpParam_SetString(SETSTRING_T *p, const char **desc, const char **help, const char **defaul);
//static int CompareParam_SetString(SETSTRING_T *p);
//static int Param_SetString(SETSTRING_T *p, const char *pstr, int flags);
//static void DescHelpParam_Generic(GENERIC_T *p, const char **desc, const char **help, const char **defaul);
//static int CompareParam_Generic(GENERIC_T *p);
//static int Param_Generic(GENERIC_T *p, const char *pstr, int flags);
//static void DescHelpParam_Setting(SETTING_T *p, const char **desc, const char **help, const char **defaul);
//static int CompareParam_Setting(SETTING_T *p);
//static int Param_Setting(SETTING_T *p, const char *pstr, int flags);
//static void DescHelpParam_IfArg(IFARG_T *p, const char **desc, const char **help, const char **defaul);
//static int CompareParam_IfArg(IFARG_T *p);
//static int Param_IfArg(IFARG_T *p, const char *pstr, int flags);
//static int Param_Parse(PARAM_T *param, const char *cparam, int flags);
extern void Param_DescHelp(PARAM_T *param, const char **desc, const char **help, const char **defaul);
extern int Param_Compare(PARAM_T *param);
//static void Param_PushParam(const char *param);
//static void Param_PopParam();
//static Boolean Param_IsNonTextFile(const char *fname, Boolean warn);
//static int Param_GetArgument(PARAM_T *param, const char *cparam, int exec);
extern int Params_Parse(PARAM_T *param, int flags);
extern void Param_Error(short id, ...);
extern void Param_Warning(short 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(long byteCount);
extern Handle COS_NewOSHandle(long logicalSize);
extern void COS_FreeHandle(Handle handle);
extern Boolean COS_ResizeHandle(Handle handle, long newSize);
extern long 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(long byteCount);
extern char *COS_NewPtrClear(long byteCount);
extern void COS_FreePtr(char *ptr);
extern void COS_AppendPtrToHandle(char *ptr1, Handle hand2, long size);
extern short COS_GetMemErr();
extern long COS_GetTicks();
extern long COS_GetTime();
extern void COS_GetString(char *buffer, short strListID, short index);
extern void COS_GetPString(unsigned char *buffer, short strListID, short index);
extern Boolean COS_IsMultiByte(char *buffer, char *str);
extern short COS_FileNew(const FSSpec *spec, short *refNum, FourCharCode creator, FourCharCode fileType);
extern short COS_FileOpen(const FSSpec *spec, short *refNum);
extern short COS_FileGetType(const FSSpec *spec, FourCharCode *fileType);
extern short COS_FileGetSize(short refNum, long *logEOF);
extern short COS_FileRead(short refNum, void *buffPtr, long count);
extern short COS_FileWrite(short refNum, const void *buffPtr, long count);
extern short COS_FileGetPos(short refNum, long *filePos);
extern short COS_FileSetPos(short refNum, long filePos);
extern short COS_FileClose(short refNum);
extern void COS_FileSetFSSpec(FSSpec *spec, unsigned char *path);
extern short COS_FileMakeFSSpec(short vRefNum, long dirID, unsigned char *fileName, FSSpec *spec);
extern short COS_FileMakeFSSpecWithPath(const FSSpec *inputSpec, unsigned char *fileName, FSSpec *spec);
extern short COS_FileGetFileInfo(const FSSpec *spec, OSType *creator, OSType *fileType);
extern void COS_FileGetFSSpecInfo(const FSSpec *spec, short *vRefNum, long *dirID, unsigned char *fileName);
//static void COS_MakePath(short vRefNum, long dirID, char *path);
extern void COS_FileGetPathName(char *buffer, const FSSpec *spec, long *mdDat);
extern Boolean COS_EqualFileSpec(const FSSpec *a, const FSSpec *b);
/********************************/
/* */
// TODO sort me
extern Proj *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 void IO_Terminate();
extern void SetupDebuggingTraps();
extern void AppendArgumentList(void *unk1, void *unk2, const char *arg);
extern int (*PrefPanelsChangedCallback)(const char *);
extern Boolean systemHandles;
extern char *MAINOPTCHAR;
extern char *SEPOPTSTR;
extern char compat;
extern anon0_50 linkargs;
#ifdef __cplusplus
}
#endif