MWCC/includes/mwcc_decomp.h

1318 lines
46 KiB
C

#pragma once
#include "common.h"
#include "oslib.h"
#include "macemul.h"
#include "plugin.h"
#define OPTION_ASSERT(cond) do { if (!!(cond) == 0) { printf("%s:%u: failed assertion\n", __FILE__, __LINE__); abort(); } } while(0)
#ifdef __cplusplus
extern "C" {
#endif
#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;
#ifdef __MWERKS__
#pragma options align=reset
#endif
// Pref panels
#ifdef __MWERKS__
#pragma options align=mac68k
#endif
enum {
OptsCmdLineState_0 = 0,
OptsCmdLineState_1 = 1,
OptsCmdLineState_2 = 2,
OptsCmdLineState_3 = 3
};
enum {
CmdLineStage_Cg = 1,
CmdLineStage_Pp = 2,
CmdLineStage_Ds = 3
};
enum {
CmdLineStageMask_Pp = 1,
CmdLineStageMask_Cg = 2,
CmdLineStageMask_Ds = 4,
CmdLineStageMask_Dp = 8
};
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;
UInt16 maxErrors;
UInt16 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;
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;*/
#ifdef __MWERKS__
#pragma options align=reset
#endif
// may not actually be named this
struct ParseOptsType {
struct CWPluginPrivateContext *context;
char helpKey[64];
SInt32 helpFlags;
UInt16 ioCols;
UInt16 ioRows;
CWCommandLineArgs *args;
const ToolVersionInfo *toolVersion;
int numPlugins;
const CLPluginInfo *plugins;
int numPanels;
const 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;
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;
char *stdout_base;
int stdout_written;
} CLState; // assumed name
typedef struct BasePluginCallbacks {
SInt16 (*main)(CWPluginContext 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;
struct OptionList **optionLists;
int numPrefDataPanels;
PrefDataPanel *prefDataPanels;
int (*PreParse)();
int (*MidParse)();
int (*PostParse)();
} 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, const char **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 *argc, char ***argv);
extern void Main_PassSpecialArgs(int *argc, char ***argv);
extern int Main_Initialize(int argc, 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 int Plugins_GetPluginList(Plugin *list, int *numPlugins, CLPluginInfo **pluginInfo);
extern int Plugins_GetPrefPanelUnion(Plugin *list, int *numPanels, char ***panelNames);
extern int Plugin_AddFileTypeMappings(Plugin *pl, OSFileTypeMappingList *ftml);
extern int 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(const char *format, ...);
extern void CLPrintWarning(const char *format, ...);
extern void CLPrintErr(const char *format, ...);
extern SInt16 CLStyledMessageDispatch(Plugin *plugin, MessageRef *ref, SInt32 errorNumber, SInt16 msgType);
/********************************/
/* command_line/CmdLine/Src/CLToolExec.c */
extern void AppendArgumentList(int *argc, 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();
extern int DeleteTemporaries();
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;
#ifndef __cplusplus
extern int Proj_Initialize(Project *this);
extern int Proj_Terminate(Project *this);
#endif
/********************************/
/* 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,
char **panelNames,
CWCommandLineArgs *plugin_args,
CWCommandLineArgs *panel_args,
const char *build_date,
const char *build_time,
const 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 void Frameworks_AddPath(const OSPathSpec *oss);
extern int 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 */
#ifndef __cplusplus
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);
#endif
/********************************/
/* command_line/CmdLine/Src/Project/CLOverlays.c */
#ifndef __cplusplus
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);
#endif
/********************************/
/* 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 RegisterStaticParserPlugins();
extern int RegisterStaticParserResources();
/********************************/
/* ParserFace.c */
extern Handle Parser_FindPrefPanel(const 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, const char **panelNames, Boolean *isSupported);
extern SInt16 parser_main(struct CWPluginPrivateContext *context);
extern const char *failedCallback;
extern jmp_buf exit_plugin;
extern struct ParseOptsType parseopts;
/********************************/
/* ParserHelpers.c */
extern SInt16 lastStage;
extern int FindFileInPath(const char *filename, OSSpec *fss);
extern char *GetEnvVar(const char *name, Boolean warn, const char **match);
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 *, va_list), const char *envvar, SInt16 id, ...);
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 */
enum {
OutputOrdering0 = 0,
OutputOrdering1 = 1,
OutputOrdering2 = 2
};
extern SInt16 outputOrdering;
extern Boolean setOutputDirectory;
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, int err, ...);
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, int flags);
extern int Opt_RedirectStream(const char *opt, void *file, const char *filename);
/********************************/
/* ParserHelpers-cc.c */
extern Handle definesHandle;
enum {
PRAGMA_FLAGS_0,
PRAGMA_FLAGS_1
};
enum {
PR_UNSET = 0, // this is the only one we know the name of (from asserts)
PR_ON = 1,
PR_OFF = 2,
PR_AUTO = 3,
PR_RESET = 4
};
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);
/********************************/
/* 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(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(OSPathSpec *dir);
extern void AddOverlayGroup(const char *name, CWAddr64 *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 ParserTool *pTool;
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();
/********************************/
/* 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 char *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"...
#ifdef UNSIGNED_CHAR_FOR_MY_UTILS
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);
#else
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);
#endif
extern char *Utils_SpellList(char *list, char *buffer, char opts);
extern int Utils_CompareOptionString(const char *a, const char *b, int cased, int sticky);
/********************************/
/* */
/********************************/
/* */
/********************************/
/* ?? 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);
#include "option_system.h"
// TODO sort me
extern Project *gProj;
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;
extern anon0_50 prelinkargs;
extern anon0_50 postlinkargs;
extern PCmdLine pCmdLine;
extern PCmdLineCompiler pCmdLineCompiler;
#ifdef __cplusplus
}
#endif