diff options
Diffstat (limited to 'includes/mwcc_decomp.h')
-rw-r--r-- | includes/mwcc_decomp.h | 2404 |
1 files changed, 2404 insertions, 0 deletions
diff --git a/includes/mwcc_decomp.h b/includes/mwcc_decomp.h new file mode 100644 index 0000000..3b4d2b1 --- /dev/null +++ b/includes/mwcc_decomp.h @@ -0,0 +1,2404 @@ +#pragma once + +#ifdef __MWERKS__ +#define macintosh +//#include <MacHeadersMach-O> +#define CW_PASCAL pascal +#include <ctype.h> +#include <stdint.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <time.h> +#undef toupper +#else +#include <ctype.h> +#include <stdarg.h> +#include <stdint.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <time.h> + +// expand this to nothing +#define CW_PASCAL +#endif + +// MacOS nonsense + +// ---------- +// MacTypes.h +typedef uint8_t UInt8; +typedef int8_t SInt8; +typedef uint16_t UInt16; +typedef int16_t SInt16; +typedef uint32_t UInt32; +typedef int32_t SInt32; +typedef uint64_t UInt64; +typedef int64_t SInt64; + +typedef char *Ptr; +typedef Ptr *Handle; +typedef int32_t Size; + +typedef SInt16 OSErr; +typedef SInt32 OSStatus; +typedef SInt16 ScriptCode; +typedef UInt32 FourCharCode; +typedef FourCharCode OSType; +typedef FourCharCode ResType; +typedef OSType *OSTypePtr; +typedef ResType *ResTypePtr; + +typedef uint8_t Boolean; + +enum { + noErr = 0, + fnfErr = -43, // file not found + dupFNErr = -48, // duplicate filename + memFullErr = -108, // not enough memory + nilHandleErr = -109, // pointer was nil + inputOutOfBounds = -190, + resNotFound = -192, // resource not found + resFNotFound = -193, // resource file not found + addResFailed = -194, // AddResource failed + rmvResFailed = -196, // RmveResource failed + resAttrErr = -198 // inconsistent attribute +}; +enum { kNilOptions = 0 }; +enum { kUnknownType = 0x3F3F3F3F }; + +// Pascal strings +typedef unsigned char Str255[256]; +typedef unsigned char Str63[64]; +typedef unsigned char *StringPtr; +typedef const unsigned char *ConstStringPtr; +typedef const unsigned char *ConstStr63Param; +typedef const unsigned char *ConstStr255Param; +// XXX: MacTypes.h defines StrLength() which is an inline for C++ and a macro for C +// This might be useful? + +typedef struct Point { + SInt16 v, h; +} Point; + +typedef struct Rect { + SInt16 top, left, bottom, right; +} Rect; + +// ------- +// Files.h +typedef struct FSSpec { + SInt16 vRefNum; + SInt32 parID; + Str255 name; +} FSSpec; + +typedef struct FInfo { + OSType fdType; + OSType fdCreator; + UInt16 fdFlags; + Point fdLocation; + SInt16 fdFldr; +} FInfo; + +typedef struct FXInfo { + SInt16 fdIconID; + SInt16 fdUnused[3]; + SInt8 fdScript; + SInt8 fdXFlags; + SInt16 fdComment; + SInt32 fdPutAway; +} FXInfo; + +typedef struct DInfo { + Rect frRect; + SInt16 frFlags; + Point frLocation; + SInt16 frView; +} DInfo; + +typedef struct DXInfo { + Point frScroll; + SInt32 frOpenChain; + SInt16 frUnused; + SInt16 frComment; + SInt32 frPutAway; +} DXInfo; + +typedef struct IOParam { + SInt16 ioResult; + SInt16 ioRefNum; + char *ioBuffer; + SInt32 ioReqCount; + SInt32 ioActCount; + SInt16 ioPosMode; + SInt32 ioPosOffset; +} IOParam; +typedef union ParamBlockRec { + IOParam ioParam; +} ParamBlockRec; +typedef ParamBlockRec *ParmBlkPtr; + +typedef struct HFileParam { + void *qLink; + SInt16 qType; + SInt16 ioTrap; + Ptr ioCmdAddr; + void *ioCompletion; + SInt16 ioResult; + StringPtr ioNamePtr; + SInt16 ioVRefNum; + SInt16 ioFRefNum; + SInt8 ioFVersNum; + SInt8 filler1; + SInt16 ioFDirIndex; + SInt8 ioFlAttrib; + SInt8 ioFlVersNum; + FInfo ioFlFndrInfo; + SInt32 ioDirID; + UInt16 ioFlStBlk; + SInt32 ioFlLgLen; + SInt32 ioFlPyLen; + UInt16 ioFlRStBlk; + SInt32 ioFlRLgLen; + SInt32 ioFlRPyLen; + UInt32 ioFlCrDat; + UInt32 ioFlMdDat; +} HFileParam; +typedef union HParamBlockRec { + HFileParam fileParam; +} HParamBlockRec; +typedef HParamBlockRec *HParmBlkPtr; + +typedef struct HFileInfo { + void *qLink; + SInt16 qType; + SInt16 ioTrap; + Ptr ioCmdAddr; + void *ioCompletion; + SInt16 ioResult; + StringPtr ioNamePtr; + SInt16 ioVRefNum; + SInt16 ioFRefNum; + SInt8 ioFVersNum; + SInt8 filler1; + SInt16 ioFDirIndex; + SInt8 ioFlAttrib; + SInt8 ioACUser; + FInfo ioFlFndrInfo; + SInt32 ioDirID; + UInt16 ioFlStBlk; + SInt32 ioFlLgLen; + SInt32 ioFlPyLen; + UInt16 ioFlRStBlk; + SInt32 ioFlRLgLen; + SInt32 ioFlRPyLen; + UInt32 ioFlCrDat; + UInt32 ioFlMdDat; + UInt32 ioFlBkDat; + FXInfo ioFlXFndrInfo; + SInt32 ioFlParID; + SInt32 ioFlClpSiz; +} HFileInfo; +typedef struct DirInfo { + void *qLink; + SInt16 qType; + SInt16 ioTrap; + Ptr ioCmdAddr; + void *ioCompletion; + SInt16 ioResult; + StringPtr ioNamePtr; + SInt16 ioVRefNum; + SInt16 ioFRefNum; + SInt8 ioFVersNum; + SInt8 filler1; + SInt16 ioFDirIndex; + SInt8 ioFlAttrib; + SInt8 ioACUser; + DInfo ioDrUsrWds; + SInt32 ioDrDirID; + UInt16 ioDrNmFls; + SInt16 filler3[9]; + UInt32 ioDrCrDat; + UInt32 ioDrMdDat; + UInt32 ioDrBkDat; + DXInfo ioDrFndrInfo; + SInt32 ioDrParID; +} DirInfo; +typedef union CInfoPBRec { + HFileInfo hFileInfo; + DirInfo hDirInfo; +} CInfoPBRec; +typedef CInfoPBRec *CInfoPBPtr; +//#endif + +//#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; + UInt32 used; + UInt32 size; +} OSHandle; + +typedef struct { + OSSpec spec; + OSHandle hand; + Boolean loaded; + Boolean changed; + Boolean 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; + UInt32 ormask; + UInt32 andmask; + void *num; +} MASK_T; +typedef struct STRING_T { + char which; + char flags; + char *myname; + PARAM_T *next; + SInt16 maxlen; + Boolean pstring; + char *str; +} STRING_T; +typedef struct SET_T { + char which; + char flags; + char *myname; + PARAM_T *next; + char size; + UInt32 value; + char *num; +} SET_T; +typedef struct SETSTRING_T { + char which; + char flags; + char *myname; + PARAM_T *next; + char *value; + char pstring; + void *var; +} SETSTRING_T; +typedef struct GENERIC_T { + char which; + char flags; + char *myname; + PARAM_T *next; + int (*parse)(const char *opt, void *var, const char *pstr, int flags); + void *var; + char *help; +} GENERIC_T; +typedef struct SETTING_T { + char which; + char flags; + char *myname; + PARAM_T *next; + int (*parse)(const char *a, const char *b); // TODO name these args + char *valuename; +} SETTING_T; +typedef struct TOGGLE_T { + char which; + char flags; + char *myname; + PARAM_T *next; + char size; + UInt32 mask; + void *num; +} TOGGLE_T; +typedef struct NUM_T { + char which; + char flags; + char *myname; + PARAM_T *next; + char size; + char fit; + UInt32 lo; + UInt32 hi; + void *num; +} NUM_T; +typedef struct FILEPATH_T { + char which; + char flags; + char *myname; + PARAM_T *next; + char fflags; + char *defaultstr; + void *filename; + int maxlen; +} FILEPATH_T; +typedef struct IFARG_T { + char which; + char flags; + char *myname; + PARAM_T *next; + PARAM_T *parg; + char *helpa; + PARAM_T *pnone; + char *helpn; +} IFARG_T; +typedef struct ONOFF_T { + char which; + char flags; + char *myname; + PARAM_T *next; + unsigned char *var; +} ONOFF_T; +typedef struct OFFON_T { + char which; + char flags; + char *myname; + PARAM_T *next; + unsigned char *var; +} OFFON_T; +typedef struct FTYPE_T { + char which; + char flags; + char *myname; + PARAM_T *next; + OSType *fc; + Boolean iscreator; +} FTYPE_T; +typedef struct OptionList { + char *help; + int flags; + struct Option **list; +} OptionList; +typedef struct Option { + char *names; + int avail; + PARAM_T *param; + OptionList *sub; + OptionList *conflicts; + char *help; +} Option; +enum { + HELPFLAGS_1 = 1, + HELPFLAGS_IGNORED = 2, + HELPFLAGS_OBSOLETE = 4, + HELPFLAGS_DEPRECATED = 8, + HELPFLAGS_SECRET = 0x10, + HELPFLAGS_MEANINGLESS = 0x20, + HELPFLAGS_COMPATIBLE = 0x40, + HELPFLAGS_NORMAL = 0x80, // andmask = 0xE? + HELPFLAGS_SPACES = 0x100, + HELPFLAGS_TOOL = 0x200, + HELPFLAGS_TOOL_THIS = 0x400, + HELPFLAGS_TOOL_OTHER = 0x800, + HELPFLAGS_TOOL_BOTH = 0xC00, + HELPFLAGS_1000 = 0x1000, + HELPFLAGS_2000 = 0x2000, + HELPFLAGS_USAGE = 0x4000, + HELPFLAGS_8000 = 0x8000 +}; +enum { + OTF_GLOBAL = 1, + OTF2 = 2, + OTF_CASED = 4, + OTF_OBSOLETE = 8, + OTF_SUBSTITUTED = 0x10, + OTF_DEPRECATED = 0x20, + OTF_TOOL_LINKER = 0x40, + OTF_TOOL_DISASSEMBLER = 0x80, + OTF_TOOL_COMPILER = 0x100, + OTF_TOOL_MASK = OTF_TOOL_LINKER | OTF_TOOL_DISASSEMBLER | OTF_TOOL_COMPILER, + OTF200 = 0x200, + OTF400 = 0x400, + OTF700 = 0x700, + OTF_IGNORED = 0x800, + OTFC00 = 0xC00, + OTF_SECRET = 0x1000, + OTF2000 = 0x2000, + OTF_COMPATIBILITY = 0x4000, + OTF8000 = 0x8000, + OTF10000 = 0x10000, + OTF20000 = 0x20000, + OTF40000 = 0x40000, + OTF_WARNING = 0x80000, + OTF_SLFLAGS_8 = 0x100000, + OTF_SLFLAGS_10 = 0x200000, + OTF_SLFLAGS_20 = 0x400000, + OTF_SLFLAGS_MASK = OTF_SLFLAGS_8 | OTF_SLFLAGS_10 | OTF_SLFLAGS_20, + OTF_MEANINGLESS = 0x800000, + OTF_ALL_HIDDEN_BY_DEFAULT = OTF_OBSOLETE | OTF_DEPRECATED | OTF_IGNORED | OTF_SECRET | OTF_MEANINGLESS, + OTF1000000 = 0x1000000, + OTF2000000 = 0x2000000, + OTF4000000 = 0x4000000, + OTF8000000 = 0x8000000, + OTF10000000 = 0x10000000, + OTF20000000 = 0x20000000, + OTF40000000 = 0x40000000, + OTF80000000 = 0x80000000 +}; + +enum { + PARAMWHICH_None = 0, + PARAMWHICH_FTypeCreator = 1, + PARAMWHICH_FilePath = 2, + PARAMWHICH_Number = 3, + PARAMWHICH_String = 4, + PARAMWHICH_Id = 5, + PARAMWHICH_Sym = 6, + PARAMWHICH_OnOff = 7, + PARAMWHICH_OffOn = 8, + PARAMWHICH_Mask = 9, + PARAMWHICH_Toggle = 0xA, + PARAMWHICH_Set = 0xB, + PARAMWHICH_SetString = 0xC, + PARAMWHICH_Generic = 0xD, + PARAMWHICH_IfArg = 0xE, + PARAMWHICH_Setting = 0xF, + PARAMWHICH_MAX = 0x10 +}; +enum { + PARAMFLAGS_1 = 1, + PARAMFLAGS_2 = 2, + PARAMFLAGS_3 = 3, + PARAMFLAGS_4 = 4, + PARAMFLAGS_8 = 8, + PARAMFLAGS_10 = 0x10, + PARAMFLAGS_12 = 0x12 +}; +enum { + PARAMPARSEFLAGS_0 = 0, + PARAMPARSEFLAGS_1 = 1, + PARAMPARSEFLAGS_2 = 2, + PARAMPARSEFLAGS_4 = 4, + PARAMPARSEFLAGS_8 = 8, + PARAMPARSEFLAGS_10 = 0x10, + PARAMPARSEFLAGS_20 = 0x20, + PARAMPARSEFLAGS_40 = 0x40, + PARAMPARSEFLAGS_80 = 0x80, + PARAMPARSEFLAGS_100 = 0x100 +}; +enum { + SLFLAGS_1 = 1, + SLFLAGS_2 = 2, + SLFLAGS_4 = 4, // displays =... + SLFLAGS_8 = 8, // displays [no] -- produces e.g. [no]err[or] | [no]iserr[or], [no]implicit[conv] + SLFLAGS_10 = 0x10, // displays [-] + SLFLAGS_20 = 0x20, // displays [no-] + SLFLAGS_40 = 0x40 +}; +enum { + LISTFLAGS_NONE = 0, + LISTFLAGS_2 = 2, + LISTFLAGS_4 = 4, + LISTFLAGS_COMPILER = 0x100, + LISTFLAGS_LINKER = 0x200, + LISTFLAGS_DISASSEMBLER = 0x400, + LISTFLAGS_TOOL_MASK = LISTFLAGS_COMPILER | LISTFLAGS_LINKER | LISTFLAGS_DISASSEMBLER +}; +#ifdef __MWERKS__ +#pragma options align=reset +#endif + + +struct IDEAccessPath { + FSSpec pathSpec; + Boolean recursive; + SInt32 subdirectoryCount; + FSSpec *subdirectories; +}; + +struct IDEAccessPathList { + SInt32 userPathCount; + struct IDEAccessPath *userPaths; + SInt32 systemPathCount; + struct IDEAccessPath *systemPaths; + unsigned char alwaysSearchUserPaths; + unsigned char convertPaths; +}; + +#ifdef __MWERKS__ +#pragma options align=mac68k +#endif +typedef struct CWObjectFlags { + SInt16 version; + SInt32 flags; + const char *objFileExt; + const char *brsFileExt; + const char *ppFileExt; + const char *disFileExt; + const char *depFileExt; + const char *pchFileExt; + OSType objFileCreator; + OSType objFileType; + OSType brsFileCreator; + OSType brsFileType; + OSType ppFileCreator; + OSType ppFileType; + OSType disFileCreator; + OSType disFileType; + OSType depFileCreator; + OSType depFileType; +} CWObjectFlags; + +typedef struct CWIDEInfo { + UInt16 majorVersion; + UInt16 minorVersion; + UInt16 bugFixVersion; + UInt16 buildVersion; + UInt16 dropinAPIVersion; +} CWIDEInfo; + +typedef struct DropInFlags { + SInt16 rsrcversion; + OSType dropintype; + UInt16 earliestCompatibleAPIVersion; + UInt32 dropinflags; + OSType edit_language; + UInt16 newestAPIVersion; +} DropInFlags; + +typedef struct CWPanelList { + SInt16 version; + SInt16 count; + const char **names; +} CWPanelList; + +typedef struct CWFamily { + OSType type; + const char *name; +} CWFamily; + +typedef struct CWFamilyList { + SInt16 version; + SInt16 count; + CWFamily *families; +} CWFamilyList; + +typedef struct CWTargetList { + SInt16 version; + SInt16 cpuCount; + OSType *cpus; + SInt16 osCount; + OSType *oss; +} CWTargetList; + +typedef struct CWExtensionMapping { + OSType type; + char extension[32]; + UInt32 flags; +} CWExtensionMapping; + +typedef struct CWExtMapList { + SInt16 version; + SInt16 nMappings; + CWExtensionMapping *mappings; +} CWExtMapList; + +typedef struct CWHelpInfo { + SInt16 version; + const char *helpFileName; +} CWHelpInfo; +#ifdef __MWERKS__ +#pragma options align=reset +#endif + +struct CW_BasePluginCallbacks { + void (*cbGetFileInfo)(); + void (*cbFindAndLoadFile)(); + void (*cbGetFileText)(); + void (*cbReleaseFileText)(); + void (*cbGetSegmentInfo)(); + void (*cbGetOverlay1GroupInfo)(); + void (*cbGetOverlay1Info)(); + void (*cbGetOverlay1FileInfo)(); + void (*cbReportMessage)(); + void (*cbAlert)(); + void (*cbShowStatus)(); + void (*cbUserBreak)(); + void (*cbGetNamedPreferences)(); + void (*cbStorePluginData)(); + void (*cbGetPluginData)(); + void (*cbSetModDate)(); + void (*cbAddProjectEntry)(); + void (*cbCreateNewTextDocument)(); + void (*cbAllocateMemory)(); + void (*cbFreeMemory)(); + void (*cbAllocMemHandle)(); + void (*cbFreeMemHandle)(); + void (*cbGetMemHandleSize)(); + void (*cbResizeMemHandle)(); + void (*cbLockMemHandle)(); + void (*cbUnlockMemHandle)(); + void *cbInternal[8]; + void (*cbGetTargetName)(); + void (*cbCacheAccessPathList)(); + void (*cbPreDialog)(); + void (*cbPostDialog)(); + void (*cbPreFileAction)(); + void (*cbPostFileAction)(); + void (*cbCheckoutLicense)(); + void (*cbCheckinLicense)(); + void (*cbResolveRelativePath)(); +}; +struct CWCompilerLinkerCallbacks { + void (*cbCachePrecompiledHeader)(); + void (*cbLoadObjectData)(); + void (*cbStoreObjectData)(); + void (*cbFreeObjectData)(); + void (*cbDisplayLines)(); + void (*cbBeginSubCompile)(); + void (*cbEndSubCompile)(); + void (*cbGetPrecompiledHeaderSpec)(); + void (*cbPutResourceFile)(); + void (*cbGetResourceFile)(); + void (*cbLookUpUnit)(); + void (*cbSBMfiles)(); + void (*cbStoreUnit)(); + void (*cbReleaseUnit)(); + void (*cbUnitNameToFileName)(); + void (*cbOSErrorMessage)(); + void (*cbOSAlert)(); + void (*cbGetModifiedFiles)(); + void (*cbGetSuggestedObjectFileSpec)(); + void (*cbGetStoredObjectFileSpec)(); + void (*cbGetRuntimeSettings)(); + void (*cbGetFrameworkCount)(); + void (*cbGetFrameworkInfo)(); + void (*cbGetFrameworkSharedLibrary)(); +}; +struct CWParserCallbacks { + void (*cbParserAddAccessPath)(); + void (*cbParserSwapAccessPaths)(); + void (*cbParserSetNamedPreferences)(); + void (*cbParserSetFileOutputName)(); + void (*cbParserSetOutputFileDirectory)(); + void (*cbParserAddOverlay1Group)(); + void (*cbParserAddOverlay1)(); + void (*cbParserAddSegment)(); + void (*cbParserSetSegment)(); +}; + +struct CWPluginPrivateContext { + SInt32 request; + SInt32 apiVersion; + void *shellContext; + void *pluginStorage; + FSSpec projectFile; + FSSpec outputFileDirectory; + OSType shellSignature; + OSType pluginType; + SInt32 numFiles; + SInt32 numOverlayGroups; + OSErr callbackOSError; + OSErr pluginOSError; + CWIDEInfo *shellInfo; + struct IDEAccessPathList *accessPathList; + SInt32 dontEatEvents; + FSSpec *targetDataDirectorySpec; + SInt32 reserved[17]; + struct CW_BasePluginCallbacks *callbacks; +}; + +// Pref panels +#ifdef __MWERKS__ +#pragma options align=mac68k +#endif +typedef struct PCmdLine { + SInt16 version; + SInt16 state; + SInt16 stages; + SInt16 toDisk; + SInt16 outNameOwner; + Boolean dryRun; + Boolean debugInfo; + SInt16 verbose; + Boolean showLines; + Boolean timeWorking; + Boolean noWarnings; + Boolean warningsAreErrors; + Boolean maxErrors; + Boolean maxWarnings; + SInt16 msgStyle; + Boolean noWrapOutput; + Boolean stderr2stdout; + Boolean noCmdLineWarnings; +} PCmdLine; +typedef struct PCmdLineCompiler { + SInt16 version; + Boolean noSysPath; + Boolean noFail; + SInt16 includeSearch; + char linkerName[64]; + char objFileExt[15]; + char brsFileExt[15]; + char ppFileExt[15]; + char disFileExt[15]; + char depFileExt[15]; + char pchFileExt[15]; + OSType objFileCreator; + OSType objFileType; + OSType brsFileCreator; + OSType brsFileType; + OSType ppFileCreator; + OSType ppFileType; + OSType disFileCreator; + OSType disFileType; + OSType depFileCreator; + OSType depFileType; + Boolean compileIgnored; + Boolean relPathInOutputDir; + Boolean browserEnabled; + Boolean depsOnlyUserFiles; + char outMakefile[256]; + SInt8 forcePrecompile; + Boolean ignoreMissingFiles; + Boolean printHeaderNames; + SInt8 sbmState; + char sbmPath[256]; + Boolean canonicalIncludes; + Boolean keepObjects; +} PCmdLineCompiler; +typedef struct PCmdLineLinker { + SInt16 version; + Boolean callPreLinker; + Boolean callPostLinker; + Boolean keepLinkerOutput; + Boolean callLinker; +} PCmdLineLinker; +typedef struct PCmdLineEnvir { + SInt16 version; + SInt16 cols; + SInt16 rows; + Boolean underIDE; +} PCmdLineEnvir; +typedef struct PBackEnd { + SInt16 version; + UInt8 structalignment; + UInt8 tracebacktables; + UInt8 processor; + UInt8 readonlystrings; + UInt8 profiler; + UInt8 fpcontract; + UInt8 schedule; + UInt8 peephole; + UInt8 processorspecific; + UInt8 altivec; + UInt8 vrsave; + UInt8 autovectorize; + UInt8 usebuiltins; + UInt8 pic; + UInt8 dynamic; + UInt8 common; + UInt8 implicit_templates; + UInt8 reserved[3]; +} PBackEnd; +typedef struct PDisassembler { + SInt16 version; + Boolean showcode; + Boolean extended; + Boolean mix; + Boolean nohex; + Boolean showdata; + Boolean showexceptions; + Boolean showsym; + Boolean shownames; +} PDisassembler; +typedef struct PMachOLinker { + SInt16 version; + UInt8 linksym; + UInt8 symfullpath; + UInt8 suppresswarn; + UInt8 linkmap; + UInt8 multisymerror; + UInt8 whatfileloaded; + UInt8 whyfileloaded; + UInt8 use_objectivec_semantics; + SInt8 undefinedsymbols; + SInt8 readonlyrelocs; + SInt8 reserved_value1; + SInt8 reserved_value2; + SInt16 exports; + SInt16 reserved_short1; + UInt32 currentversion; + UInt32 compatibleversion; + SInt32 reserved_long1; + char mainname[64]; + UInt8 prebind; + UInt8 dead_strip; + UInt8 twolevel_namespace; + UInt8 strip_debug_symbols; +} PMachOLinker; +typedef struct PMachOProject { + SInt16 version; + SInt16 type; + Str63 outfile; + OSType filecreator; + OSType filetype; + SInt32 stacksize; + SInt32 stackaddress; + SInt32 reserved1; + SInt32 reserved2; + SInt32 reserved3; + SInt32 reserved4; + SInt32 reserved5; + SInt32 reserved6; + SInt32 reserved7; + SInt32 reserved8; + SInt32 reserved9; + SInt32 reserved10; + SInt32 reserved11; + SInt32 reserved12; + SInt32 reserved13; + SInt32 reserved14; + SInt32 reserved15; + SInt32 reserved16; + SInt32 reserved17; + SInt32 reserved18; + SInt32 reserved19; + SInt32 reserved20; + UInt8 flatrsrc; + UInt8 filler1; + UInt8 filler2; + UInt8 filler3; + Str63 separateflatfile; + Str255 installpath; +} PMachOProject; +typedef struct { + SInt16 version; + Boolean userSetCreator; + Boolean userSetType; + Boolean gPrintMapToStdOutput; + Str255 mapfilename; + Str255 symfilename; +} PCLTExtras; +#ifdef __MWERKS__ +#pragma options align=reset +#endif + +typedef struct CWCommandLineArgs { + int argc; + char **argv; + char **envp; +} CWCommandLineArgs; + +typedef struct VersionInfo { + UInt16 major; + UInt16 minor; + UInt16 patch; + UInt16 build; +} VersionInfo; + +typedef struct CLPluginInfo { + OSType plugintype; + OSType language; + SInt32 dropinflags; + char *version; + Boolean storeCommandLine; +} CLPluginInfo; + +typedef struct ToolVersionInfo { + char *company; + char *product; + char *tool; + char *copyright; + char *version; +} ToolVersionInfo; + +// may not actually be named this +struct ParseOptsType { + struct CWPluginPrivateContext *context; + char helpKey[64]; + SInt32 helpFlags; + UInt16 ioCols; + UInt16 ioRows; + CWCommandLineArgs *args; + ToolVersionInfo *toolVersion; + int numPlugins; + CLPluginInfo *plugins; + int numPanels; + char **panelNames; + OSType cpu; + OSType os; + char lastoutputname[256]; + SInt32 currentSegment; + SInt32 currentOverlayGroup; + SInt32 currentOverlay; + int possibleFiles; + int userSpecifiedFiles; + int unusedFiles; + Boolean hadAnyOutput; + Boolean hadErrors; + Boolean showHelp; + Boolean underIDE; + Boolean alwaysUsePaths; + Boolean noOptions; + Boolean printedVersion; + Boolean passingArgs; + Boolean disToFile; + Boolean ppToFile; + Boolean initBefore; + Boolean weakImport; + Boolean mergeIntoOutput; + Boolean success; + Boolean ignoreUnknown; + UInt8 unused[2]; +}; + +typedef struct { + int argc; + const char **argv; + OSType cpu; + OSType os; + OSType plugintype; + OSType language; + OSType parserstyle; + OSSpec programSpec; + const char *programName; + SInt16 countWarnings; + SInt16 countErrors; + Boolean pluginDebug; + Boolean userBreak; + Boolean withholdWarnings; + Boolean withholdErrors; + OSSpec makefileSpec; + OSPathSpec sbmPathSpec; + OSHandle browseTableHandle; + const char *stdout_base; + int stdout_written; +} CLState; // assumed name + +typedef struct OSFileTypeMapping { + OSType mactype; + const char *magic; + char length; + const char *mimetype; + char executable; // not sure why this is rearranged +} OSFileTypeMapping; + +typedef struct OSFileTypeMappingList { + SInt16 numMappings; + const OSFileTypeMapping *mappings; +} OSFileTypeMappingList; + +typedef struct BasePluginCallbacks { + SInt16 (*main)(void *context); + SInt16 (*GetDropInFlags)(const DropInFlags **flags, SInt32 *flagsSize); + SInt16 (*GetDisplayName)(const char **displayName); + SInt16 (*GetDropInName)(const char **dropInName); + SInt16 (*GetPanelList)(const CWPanelList **panelList); + SInt16 (*GetFamilyList)(const CWFamilyList **familyList); + SInt16 (*GetHelpInfo)(const CWHelpInfo **helpInfo); + SInt16 (*GetVersionInfo)(const VersionInfo **versionInfo); + SInt16 (*GetFileTypeMappings)(const OSFileTypeMappingList **mappingList); +} BasePluginCallbacks; + +typedef struct CompilerLinkerPluginCallbacks { + SInt16 (*GetTargetList)(const struct CWTargetList **targetList); + SInt16 (*GetDefaultMappingList)(); + SInt16 (*Unmangle)(); + SInt16 (*BrSymbolEntryPoint)(); + SInt16 (*GetObjectFlags)(); + SInt16 (*WriteObjectFile)(); +} CompilerLinkerPluginCallbacks; + +typedef struct ParserPluginCallbacks { + SInt16 (*SupportsPlugin)(); + SInt16 (*SupportsPanels)(); +} ParserPluginCallbacks; + +typedef struct { + char *name; + void *ptr; + SInt32 size; +} PrefDataPanel; // assumed name + +typedef struct { + OSType TYPE; + OSType LANG; + OSType CPU; + OSType OS; + int numPrefPanels; + char **prefPanels; + char *toolInfo; + char *copyright; + int numOptionLists; + OptionList **optionLists; + int numPrefDataPanels; + PrefDataPanel *prefDataPanels; + int (*PreParse)(); // sig? + int (*MidParse)(); // sig? + int (*PostParse)(); // sig? +} ParserTool; // assumed name + +// I think this is internally defined in its .c file +// pro8 mwcc refers to it as =s0 +typedef struct PrefPanel { + char *name; + Handle data; + Handle workData; + struct PrefPanel *next; +} PrefPanel; + +// CLAccessPaths +typedef struct Paths { + struct Path **pathsArray; + UInt16 arraySize; + UInt16 pathsCount; +} Paths; + +typedef struct Frameworks { + struct Paths_FWInfo **fwsArray; + UInt16 arraySize; + UInt16 fwsCount; +} Frameworks; + +typedef struct Path { + OSPathSpec *spec; + Paths *recursive; + char *dirlist; + SInt16 flags; +} Path; + +typedef struct Paths_FWInfo { + OSSpec fileSpec; + OSPathSpec version; + OSPathSpec name; + Path *path; + Boolean hidden; +} Paths_FWInfo; + +// CLDependencies +typedef struct InclFile { + SInt32 filenameoffs; + Path *accesspath; + Path *globalpath; + Path *specialpath; + Boolean syspath; +} InclFile; + +typedef struct Incls { + struct Target *targ; + SInt32 numincls; + SInt32 maxincls; + InclFile *files; + SInt32 buflen; + SInt32 bufpos; + char *buffer; + Paths *allPaths; +} Incls; + +typedef struct Deps { + int numDeps; + int maxDeps; + SInt32 *list; + Incls *incls; +} Deps; + +// CLFiles +typedef struct File { + struct File *next; + SInt32 filenum; + UInt16 segnum; + SInt32 srcmoddate; + SInt32 outmoddate; + char srcfilename[256]; + char outfilename[256]; + SInt16 outfileowner; + OSSpec srcfss; + OSSpec outfss; + SInt16 writeToDisk; + SInt16 wroteToDisk; + SInt16 tempOnDisk; + struct Plugin *compiler; + SInt32 dropinflags; + SInt32 objectflags; + SInt32 mappingflags; + SInt16 sourceUsage; + SInt16 objectUsage; + Handle textdata; + Handle objectdata; + Handle browsedata; + SInt32 codesize; + SInt32 udatasize; + SInt32 idatasize; + SInt32 compiledlines; + Boolean recompileDependents; + Boolean gendebug; + Boolean hasobjectcode; + Boolean hasresources; + Boolean isresourcefile; + Boolean weakimport; + Boolean initbefore; + Boolean mergeintooutput; + Deps deps; + Boolean recordbrowseinfo; + SInt16 browseFileID; + char browseoptions[32]; + OSType filetype; + OSType filecreator; +} File; + +typedef struct Files { + File *fileList; + SInt32 fileCount; +} Files; + +typedef struct VFile { + char displayName[32]; + Handle data; + struct VFile *next; +} VFile; + +// CLOverlays +typedef struct OvlAddr { + UInt32 lo, hi; +} OvlAddr; + +typedef struct Overlay { + char name[256]; + SInt32 *list; + SInt32 cnt; + SInt32 max; + struct Overlay *next; +} Overlay; + +typedef struct OvlGroup { + char name[256]; + OvlAddr addr; + Overlay *olys; + Overlay *lastoly; + int olycnt; + struct OvlGroup *next; +} OvlGroup; + +typedef struct Overlays { + OvlGroup *groups; + OvlGroup *lastgrp; + SInt32 grpcnt; +} Overlays; + +// CLSegs +typedef struct Segment { + char name[32]; + SInt16 attrs; +} Segment; + +typedef struct Segments { + Segment **segsArray; + UInt16 arraySize; + UInt16 segsCount; +} Segments; + +// CLTarg +// Is this actually in Pro7? Not sure +typedef struct CLTargetInfo { + OSType targetCPU; + OSType targetOS; + SInt16 outputType; + SInt16 linkType; + Boolean canRun; + Boolean canDebug; + OSSpec outfile; + OSSpec symfile; + OSSpec runfile; + OSSpec linkAgainstFile; +} CLTargetInfo; +typedef struct CWTargetInfo { + SInt16 outputType; + FSSpec outfile; + FSSpec symfile; + FSSpec runfile; + SInt16 linkType; + Boolean canRun; + Boolean canDebug; + OSType targetCPU; + OSType targetOS; + OSType outfileCreator; + OSType outfileType; + OSType debuggerCreator; + OSType runHelperCreator; + FSSpec linkAgainstFile; +} CWTargetInfo; +typedef struct Target { + struct BuildInfo { + UInt32 linesCompiled; + UInt32 codeSize; + UInt32 iDataSize; + UInt32 uDataSize; + } info; + CWTargetInfo *targetinfo; + struct { + Segments segs; + Overlays overlays; + } linkage; + SInt32 linkmodel; + Files files; + Files pchs; + Incls incls; + Paths sysPaths; + Paths userPaths; + OSType lang; + OSType cpu; + OSType os; + char targetName[64]; + struct Plugin *preLinker; + struct Plugin *linker; + struct Plugin *postLinker; + UInt32 preLinkerDropinFlags; + UInt32 linkerDropinFlags; + UInt32 postLinkerDropinFlags; + OSPathSpec outputDirectory; + VFile *virtualFiles; + struct Target *next; +} Target; + +typedef struct Plugin { + BasePluginCallbacks *cb; + CompilerLinkerPluginCallbacks *cl_cb; + ParserPluginCallbacks *pr_cb; + void *context; + char *cached_ascii_version; + struct Plugin *next; +} Plugin; + +typedef struct Token { + int x0; + void *x4; +} Token; + +/********************************/ +/* command_line/CmdLine/Src/Clients/CLStaticMain.c */ +extern int main(int argc, const char **argv); + +/********************************/ +/* command_line/CmdLine/Src/Clients/ClientGlue.c */ +extern int RegisterResource(const char *name, SInt16 rsrcid, Handle list); +extern int RegisterStaticPlugin(const BasePluginCallbacks *callbacks); +extern int RegisterStaticCompilerLinkerPlugin(const BasePluginCallbacks *callbacks, const CompilerLinkerPluginCallbacks *cl_callbacks); +extern int RegisterStaticParserPlugin(const BasePluginCallbacks *cb, const ParserPluginCallbacks *pr_callbacks); +extern void SetBuildTarget(OSType cpu, OSType os); +extern void SetParserType(OSType plang); +extern void SetPluginType(OSType lang, OSType type); +extern int CmdLine_Initialize(int argc, const char **argv, const char *builddate, const char *buildtime); +extern int CmdLine_Driver(); +extern int CmdLine_Terminate(int exitcode); + +/********************************/ +/* command_line/CmdLine/Src/CLMain.c */ +extern void Main_PreParse(int *pArgc, char ***pArgv); +extern void Main_PassSpecialArgs(void *unk1, void *unk2); +extern int Main_Initialize(int argc, const char **argv); +extern int Main_Terminate(int code); +extern int Main_Driver(); + +/********************************/ +/* command_line/CmdLine/Src/Envir/CLErrors.c */ +extern void CLReportError(SInt16 errid, ...); +extern void CLReportWarning(SInt16 errid, ...); +extern void CLReport(SInt16 errid, ...); +extern void CLReportOSError(SInt16 errid, int err, ...); +extern void CLReportCError(SInt16 errid, int err_no, ...); +extern void CLInternalError(const char *file, int line, const char *format, ...); +extern void CLFatalError(const char *format, ...); + +/********************************/ +/* command_line/CmdLine/Src/Plugins/CLPlugins.c */ +//static void GetToolVersionInfo(); +extern const ToolVersionInfo *Plugin_GetToolVersionInfo(); +//static const char *Plugin_GetDisplayName(Plugin *pl); +extern const char *Plugin_GetDropInName(Plugin *pl); +extern VersionInfo *Plugin_GetVersionInfo(Plugin *pl); +extern const char *Plugin_GetVersionInfoASCII(Plugin *pl); +extern DropInFlags *Plugin_GetDropInFlags(Plugin *pl); +extern OSType Plugin_GetPluginType(Plugin *pl); +extern const CWTargetList *Plugin_CL_GetTargetList(Plugin *pl); +extern const CWPanelList *Plugin_GetPanelList(Plugin *pl); +extern const CWExtMapList *Plugin_CL_GetExtMapList(Plugin *pl); +extern const OSFileTypeMappingList *Plugin_GetFileTypeMappingList(Plugin *pl); +extern const CWObjectFlags *Plugin_CL_GetObjectFlags(Plugin *pl); +extern Boolean Plugin_MatchesName(Plugin *pl, const char *name); +extern Boolean Plugin_CL_MatchesTarget(Plugin *pl, OSType cpu, OSType os, Boolean exact); +extern Boolean Plugins_CL_HaveMatchingTargets(Plugin *p1, Plugin *p2, Boolean exact); +//static CL_MatchesExtMapping(CWExtensionMapping *map, OSType type, const char *ext, Boolean exact); +extern Boolean Plugin_CL_MatchesFileType(Plugin *pl, OSType type, const char *extension, Boolean exact); +extern Boolean Plugin_MatchesType(Plugin *pl, OSType type, OSType lang, Boolean exact); +extern Boolean Plugin_Pr_MatchesPlugin(Plugin *pl, CLPluginInfo *pluginfo, OSType cpu, OSType os); +extern Boolean Plugin_Pr_MatchesPanels(Plugin *pl, int numPanels, char **panelNames); +extern Boolean Plugin_CL_WriteObjectFile(Plugin *pl, FSSpec *src, FSSpec *out, OSType creator, OSType type, OSHandle *data); +extern Boolean Plugin_CL_GetCompilerMapping(Plugin *pl, OSType type, const char *ext, UInt32 *flags); +//static Boolean SupportedPlugin(Plugin *pl, const char **reason); +//static Boolean VerifyPanels(Plugin *pl); +extern Plugin *Plugin_New(const BasePluginCallbacks *cb, const CompilerLinkerPluginCallbacks *cl_cb, const ParserPluginCallbacks *pr_cb); +extern void Plugin_Free(Plugin *pl); +extern int Plugin_VerifyPanels(Plugin *pl); +extern void Plugins_Init(); +extern void Plugins_Term(); +extern int Plugins_Add(Plugin *pl); +extern Plugin *Plugins_MatchName(Plugin *list, const char *name); +extern Plugin *Plugins_CL_MatchTarget(Plugin *list, OSType cpu, OSType os, OSType type, OSType lang); +extern Plugin *Plugins_CL_MatchFileType(Plugin *list, OSType type, const char *ext, Boolean exact); +extern Plugin *Plugins_GetPluginForFile(Plugin *list, OSType plugintype, OSType cpu, OSType os, OSType type, const char *ext, OSType lang); +extern Plugin *Plugins_GetLinker(Plugin *list, OSType cpu, OSType os); +extern Plugin *Plugins_GetPreLinker(Plugin *list, OSType cpu, OSType os); +extern Plugin *Plugins_GetPostLinker(Plugin *list, OSType cpu, OSType os); +extern Plugin *Plugins_GetParserForPlugin(Plugin *list, OSType style, int numPlugins, CLPluginInfo *plugins, OSType cpu, OSType os, int numPanels, char **panelNames); +extern Plugin *Plugins_GetCompilerForLinker(Plugin *list, Plugin *linker, OSType type, const char *ext, OSType edit); +extern Boolean Plugins_GetPluginList(Plugin *list, int *numPlugins, CLPluginInfo **pluginInfo); +extern Boolean Plugins_GetPrefPanelUnion(Plugin *list, int *numPanels, const char ***panelNames); +extern Boolean Plugin_AddFileTypeMappings(Plugin *pl, OSFileTypeMappingList *ftml); +typedef struct OSFileTypeMappings { + OSFileTypeMappingList *mappingList; + struct OSFileTypeMappings *next; +} OSFileTypeMappings; +extern Boolean Plugins_AddFileTypeMappingsForTarget(Plugin *list, OSFileTypeMappings **mlist, OSType cpu, OSType os); +extern SInt16 Plugin_Call(Plugin *pl, void *context); + +/********************************/ +/* command_line/CmdLine/Src/Callbacks/CLParserCallbacks_v1.cpp */ +// haha this is a C++ nightmare + +/********************************/ +/* command_line/CmdLine/Src/Envir/CLIO.c */ +typedef struct MessageRef { + OSSpec sourcefile; + OSSpec errorfile; + char *sourceline; + SInt32 linenumber; + SInt32 tokenoffset; + SInt16 tokenlength; + SInt32 selectionoffset; + SInt16 selectionlength; +} MessageRef; + +extern void SetupDebuggingTraps(); +extern Boolean IO_Initialize(); +extern Boolean IO_Terminate(); +extern Boolean IO_HelpInitialize(); +extern Boolean IO_HelpTerminate(); +extern void FixHandleForIDE(OSHandle *text); +extern Boolean ShowHandle(OSHandle *text, Boolean decorate); +extern Boolean WriteHandleToFile(OSSpec *spec, OSHandle *text, OSType creator, OSType type); +extern Boolean WriteBinaryHandleToFile(OSSpec *spec, OSType maccreator, OSType mactype, OSHandle *text); +extern Boolean AppendHandleToFile(OSSpec *spec, OSHandle *text, OSType maccreator, OSType mactype); +extern void InitWorking(); +extern void ShowWorking(); +extern void TermWorking(); +extern Boolean CheckForUserBreak(); +extern char *IO_FormatText(char *buffer, SInt32 size, char *newline, const char *format, ...); +extern void CLPrintDispatch(SInt16 msgtype, const char *message, FILE *out, char *ptr, char *nptr); +extern void CLPrintType(SInt16 msgtype, ...); +extern void CLPrint(SInt16 msgtype, ...); +extern void CLPrintWarning(SInt16 msgtype, ...); +extern void CLPrintErr(SInt16 msgtype, ...); +extern SInt16 CLStyledMessageDispatch(Plugin *plugin, MessageRef *ref, SInt32 errorNumber, SInt16 msgType); + +/********************************/ +/* command_line/CmdLine/Src/CLToolExec.c */ +extern void AppendArgumentList(int *argc, const char ***argv, const char *str); +// static int CopyArgumentList(int argc, const char **argv, int *Argc, const char ***Argv); +// static int FreeArgumentList(const char **argv); +// static int SetupLinkerCommandLine(SInt32 dropinflags, File *file, CWCommandLineArgs *args); +extern int SetupTemporaries(SInt32 idx, File *file); +extern int DeleteTemporaries(SInt32 idx, File *file); +extern int ExecuteLinker(Plugin *plugin, SInt32 dropinflags, File *file, char *stdoutfile, char *stderrfile); + +/********************************/ +/* command_line/CmdLine/Src/OSLib/Posix.c */ +typedef struct uOSTypePair { + int perm; +} uOSTypePair; // unknown name +extern uOSTypePair OS_TEXTTYPE; +typedef enum { + OSReadOnly, + OSWrite, + OSReadWrite, + OSAppend +} OSOpenMode; // assumed name +typedef enum { + OSSeekRel, + OSSeekAbs, + OSSeekEnd +} OSSeekMode; // assumed name +extern const char *OS_GetErrText(int err); +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 *crtm, time_t *chtm); +extern int OS_SetFileTime(const OSSpec *spec, const time_t *crtm, const time_t *chtm); +extern int OS_Open(const OSSpec *spec, OSOpenMode mode, int *ref); +extern int OS_Write(int ref, const void *buffer, UInt32 *length); +extern int OS_Read(int ref, void *buffer, UInt32 *length); +extern int OS_Seek(int ref, OSSeekMode how, SInt32 offset); +extern int OS_Tell(int ref, SInt32 *offset); +extern int OS_Close(int ref); +extern int OS_GetSize(int ref, UInt32 *length); +extern int OS_SetSize(int ref, UInt32 size); +extern int OS_Delete(const OSSpec *spec); +extern int OS_Rename(const OSSpec *oldspec, const OSSpec *newspec); +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(const char **argv, const char **envp, const char *stdoutfile, const char *stderrfile, int *exitcode); +extern int OS_IsLegalPath(const char *path); +extern int OS_IsFullPath(const char *path); +extern char *OS_GetDirPtr(char *path); +// static int OS_CompactPath(const char *src, char *dst); +extern int OS_EqualPath(const char *a, const char *b); +extern int OS_CanonPath(const char *src, char *dst); +extern int OS_MakeSpec(const char *path, OSSpec *spec, Boolean *isfile); +extern int OS_MakeFileSpec(const char *path, OSSpec *spec); +extern int OS_MakePathSpec(const char *vol, const char *dir, OSPathSpec *spec); +extern int OS_MakeNameSpec(const char *name, OSNameSpec *spec); +extern int OS_GetRootSpec(OSPathSpec *spec); +extern char *OS_SpecToString(const OSSpec *spec, char *path, int size); +extern char *OS_PathSpecToString(const OSPathSpec *pspec, char *path, int size); +extern char *OS_NameSpecToString(const OSNameSpec *nspec, char *name, int size); +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 *link, OSSpec *target); +typedef struct { + void *dir; + OSPathSpec spec; +} OSOpenedDir; // assumed name +extern int OS_OpenDir(const OSPathSpec *spec, OSOpenedDir *ref); +extern int OS_ReadDir(OSOpenedDir *ref, OSSpec *spec, char *filename, Boolean *isfile); +extern int OS_CloseDir(OSOpenedDir *ref); +extern UInt32 OS_GetMilliseconds(); +extern void OS_GetTime(time_t *p); +extern int OS_NewHandle(UInt32 size, OSHandle *hand); +extern int OS_ResizeHandle(OSHandle *hand, UInt32 size); +extern void *OS_LockHandle(OSHandle *hand); +extern void OS_UnlockHandle(OSHandle *hand); +extern int OS_FreeHandle(OSHandle *hand); +extern int OS_GetHandleSize(OSHandle *hand, UInt32 *size); +extern void OS_InvalidateHandle(OSHandle *hand); +extern Boolean OS_ValidHandle(OSHandle *hand); +extern OSErr OS_MacError(int err); +extern void OS_TimeToMac(time_t sectm, UInt32 *secs); +extern void OS_MacToTime(UInt32 secs, time_t *sectm); +extern SInt16 OS_RefToMac(int ref); +extern int OS_MacToRef(SInt16 refnum); +extern int OS_OpenLibrary(const char *a, void **lib); +extern int OS_GetLibrarySymbol(void *a, void *b, void **sym); +extern int OS_CloseLibrary(void *a); +extern int OS_LoadMacResourceFork(const OSSpec *spec, void **file_data, SInt32 *file_len); +extern int OS_IsMultiByte(const char *str, int offset); + +/********************************/ +/* command_line/CmdLine/Src/OSLib/StringExtras.c */ +extern char *strcatn(char *d, const char *s, SInt32 max); +extern char *strcpyn(char *d, const char *s, SInt32 len, SInt32 max); +extern int ustrcmp(const char *src, const char *dst); +extern int ustrncmp(const char *src, const char *dst, UInt32 len); + +/********************************/ +/* command_line/CmdLine/Src/OSLib/Generic.c */ +extern int WildCardMatch(const char *wild, const char *name); +extern OSSpec *OS_MatchPath(const char *path); +extern char *OS_GetFileNamePtr(char *path); +extern char *OS_GetDirName(const OSPathSpec *spec, char *buf, int size); +extern int OS_MakeSpec2(const char *path, const char *filename, OSSpec *spec); +extern int OS_MakeSpecWithPath(OSPathSpec *path, const char *filename, Boolean noRelative, OSSpec *spec); +extern int OS_NameSpecChangeExtension(OSNameSpec *spec, const char *ext, Boolean append); +extern int OS_NameSpecSetExtension(OSNameSpec *spec, const char *ext); +extern char *OS_CompactPaths(char *buf, const char *p, const char *n, int size); +extern char *OS_SpecToStringRelative(const OSSpec *spec, const OSPathSpec *cwdspec, char *path, int size); +extern int OS_FindFileInPath(const char *filename, const char *plist, OSSpec *spec); +extern int OS_FindProgram(const char *filename, OSSpec *spec); +extern int OS_CopyHandle(OSHandle *hand, OSHandle *copy); +extern int OS_AppendHandle(OSHandle *hand, const void *data, UInt32 len); + +/********************************/ +/* command_line/CmdLine/Src/Project/CLProj.c */ +typedef struct Project { + Target *targets; + OSSpec projectDirectory; +} Project; +extern int Proj_Initialize(Project *this); +extern int Proj_Terminate(Project *this); + +/********************************/ +/* command_line/CmdLine/Src/CLLicenses.c */ +extern void License_Initialize(); +extern void License_Terminate(); +extern SInt32 License_Checkout(); +extern void License_Refresh(); +extern void License_Checkin(); +extern void License_AutoCheckin(); + +/********************************/ +/* command_line/CmdLine/Src/OSLib/MemUtils.c */ +extern void *xmalloc(const char *what, int size); +extern void *xcalloc(const char *what, int size); +extern void *xrealloc(const char *what, void *old, int size); +extern char *xstrdup(const char *str); +extern void xfree(void *ptr); + +/********************************/ +/* command_line/CmdLine/Src/CLPluginRequests.cpp */ +extern Boolean SendParserRequest( + Plugin *plugin, + Target *target, + CWCommandLineArgs *args, + OSType cpu, + OSType os, + int numPlugins, + CLPluginInfo *pluginInfo, + int numPanels, + const char **panelNames, + CWCommandLineArgs *plugin_args, + CWCommandLineArgs *panel_args, + const char *build_date, + const char *build_time, + ToolVersionInfo *build_tool + ); +extern Boolean SendCompilerRequest(Plugin *plugin, File *file, SInt16 stage); +extern Boolean SendTargetInfoRequest(Target *targ, Plugin *linker, SInt32 dropinflags); +extern Boolean SendLinkerRequest(Plugin *plugin, SInt32 dropinflags, CWTargetInfo *targetInfo); +extern Boolean SendDisassemblerRequest(Plugin *linker, File *file); +extern Boolean SendInitOrTermRequest(Plugin *plugin, Boolean reqIsInitialize); + +/********************************/ +/* command_line/CmdLine/Src/CLFileOps.c */ +// PRO8 ONLY ??? Boolean CanFlushObjectData(File *file); +// PRO8 ONLY ??? void FlushObjectData(File *file); +// PRO8 ONLY ??? Boolean RetrieveObjectData(File *file); +// static int OutputTextData(File *file, SInt16 stage, OSType maccreator, OSType mactype); +// static int fstrcat(const char *file, const char *add, SInt32 length); +// static void extstrcat(char *file, const char *ext); +extern int GetOutputFile(File *file, SInt16 stage); +// static int SyntaxCheckFile(File *file); +// static int PreprocessFile(File *file); +// static int DependencyMapFile(File *file, Boolean compileifnecessary); +// static int RecordBrowseInfo(File *file); +// static int RecordObjectData(File *file); +extern int StoreObjectFile(File *file); +// static int CompileFile(File *file); +// static int DisassembleWithLinker(File *file, Plugin *linker, SInt32 linkerDropinFlags); +// static int DisassembleFile(File *file, Plugin *disasm); +// static int CompileEntry(File *file, Boolean *compiled); +// static void DumpFileAndPathInfo(); +extern int CompileFilesInProject(); +// static int PostLinkFilesInProject(); +extern int LinkProject(); + +/********************************/ +/* command_line/CmdLine/Src/Project/CLPrefs.c */ +extern PrefPanel *PrefPanel_New(const char *name, void *initdata, SInt32 initdatasize); +extern Handle PrefPanel_GetHandle(PrefPanel *panel); +extern int PrefPanel_PutHandle(PrefPanel *panel, Handle handle); +extern void Prefs_Initialize(); +extern void Prefs_Terminate(); +extern Boolean Prefs_AddPanel(PrefPanel *panel); +extern PrefPanel *Prefs_FindPanel(const char *name); + +/********************************/ +/* command_line/CmdLine/Src/Project/CLTarg.c */ +extern Target *Target_New(const char *name, OSType cpu, OSType os, OSType lang); +extern void Target_Free(Target *targ); +extern void Targets_Term(Target *list); +extern void Target_Add(Target **list, Target *targ); + +/********************************/ +/* command_line/CmdLine/Src/Project/CLAccessPaths.c */ +// 0,40=Path +// 0,41=OSPathSpec +// 0,43=Paths +// 0,44=Path** +// 0,45=Path* +// 0,46=OSPathSpec* +// 0,47=Paths* +// 0,48=Path* +extern Path *Path_Init(const OSPathSpec *dir, Path *path); +extern Path *Path_New(const OSPathSpec *dir); +extern void Path_Free(Path *path); +extern Boolean Paths_Initialize(Paths *paths); +extern Boolean Paths_Terminate(Paths *paths); +//static Boolean Paths_GrowPaths(Paths *paths, UInt16 *index); +extern Boolean Paths_AddPath(Paths *paths, Path *path); +extern Boolean Paths_InsertPath(Paths *paths, UInt16 index, Path *path); +extern Boolean Paths_RemovePath(Paths *paths, UInt16 index); +extern Boolean Paths_DeletePath(Paths *paths, UInt16 index); +extern Path *Paths_GetPath(Paths *paths, UInt16 pathnum); +extern UInt16 Paths_Count(const Paths *paths); +extern Boolean Paths_FindPath(const Paths *paths, const Path *path); +extern Path *Paths_FindPathSpec(const Paths *paths, const OSPathSpec *dir); +//static Boolean GatherRecurse(Paths *paths, Path *path); +extern Boolean Paths_GatherRecurse(Paths *paths); +extern int Paths_CountRecurse(Paths *paths); +//static void CopyRecurseFSS(FSSpec **pFss, Paths *paths, UInt16 *pCount); +extern void Paths_CopyRecurseFSS(FSSpec *fss, Paths *paths, UInt16 count); +//static Boolean Frameworks_Initialize(Frameworks *fws); +//static Boolean Frameworks_Grow(Frameworks *fws, UInt16 *index); +//static Boolean Frameworks_Add(Frameworks *fws, Paths_FWInfo *info); +//static Paths_FWInfo *Framework_Init(OSSpec *dir, const char *name, const char *version, Paths_FWInfo *info, Path *p, Boolean hidden); +//static Paths_FWInfo *Framework_New(OSSpec *dir, const char *name, const char *version, Path *p, Boolean hidden); +//static Boolean CheckForFileInFrameworkDir(char *out, const char *framework_path, OSPathSpec *osps, const char *fname); +//static Boolean CheckForFileInFramework(char *out, int i, const char *fname); +extern Boolean MakeFrameworkPath(char *out, const char *filename, OSPathSpec **globalpath); +extern Boolean Frameworks_AddPath(const OSPathSpec *oss); +extern Boolean Frameworks_AddFramework(const char *frameworkName, const char *version, Boolean flag); +extern void Framework_GetEnvInfo(); +extern int Frameworks_GetCount(); +extern Paths_FWInfo *Frameworks_GetInfo(int which); + +/********************************/ +/* command_line/CmdLine/Src/OSLib/MacSpecs.c */ +// This is pretty much self-contained lol +extern int OS_OSPathSpec_To_VolDir(const OSPathSpec *spec, SInt16 *vRefNum, SInt32 *dirID); +extern int OS_OSSpec_To_FSSpec(const OSSpec *spec, FSSpec *fss); +extern int OS_VolDir_To_OSNameSpec(SInt16 vRefNum, SInt32 dirID, OSNameSpec *spec, SInt32 *parID); +extern int OS_VolDir_To_OSPathSpec(SInt16 vRefNum, SInt32 dirID, OSPathSpec *spec); +extern int OS_FSSpec_To_OSSpec(const FSSpec *fss, OSSpec *spec); +extern int OS_GetRsrcOSSpec(const OSSpec *spec, OSSpec *rspec, Boolean create); + +/********************************/ +/* command_line/CmdLine/Src/OSLib/StringUtils.c */ +extern StringPtr _pstrcpy(StringPtr dst, ConstStringPtr src); +extern void _pstrcat(StringPtr dst, ConstStringPtr src); +extern void _pstrcharcat(StringPtr to, char ch); +extern void pstrncpy(StringPtr to, ConstStringPtr from, int max); +extern void pstrncat(StringPtr to, ConstStringPtr append, int max); +extern int pstrcmp(ConstStringPtr a, ConstStringPtr b); +extern int pstrchr(ConstStringPtr str, char find); +extern void c2pstrcpy(StringPtr dst, const char *src); +extern void p2cstrcpy(char *dst, ConstStringPtr src); +extern char *mvprintf(char *mybuf, unsigned int len, const char *format, va_list va); +extern char *mprintf(char *mybuf, unsigned int len, const char *format, ...); +extern int HPrintF(Handle text, const char *format, ...); + +/********************************/ +/* ??? */ +extern int AddFileTypeMappingList(void *a, void *b); // TODO sig +extern void UseFileTypeMappings(void *a); // TODO sig +extern OSErr SetMacFileType(const FSSpec *fss, void *a); // TODO sig +extern OSErr GetMacFileType(const FSSpec *fss, void *a); // TODO sig + +/********************************/ +/* command_line/CmdLine/Src/Project/CLFiles.c */ +extern File *File_New(); +extern void File_Free(File *file); +extern Boolean Files_Initialize(Files *this); +extern Boolean Files_Terminate(Files *this); +extern Boolean Files_AddFile(Files *this, File *file); +extern Boolean Files_InsertFile(Files *this, File *file, SInt32 position); +extern File *Files_GetFile(Files *this, SInt32 filenum); +extern File *Files_FindFile(Files *this, OSSpec *spec); +extern int Files_Count(Files *this); +extern Boolean VFiles_Initialize(VFile **list); +extern void VFiles_Terminate(VFile **list); +extern VFile *VFile_New(const char *name, OSHandle *data); +extern Boolean VFiles_Add(VFile **list, VFile *entry); +extern VFile *VFiles_Find(VFile *list, const char *name); + +/********************************/ +/* command_line/CmdLine/Src/Project/CLOverlays.c */ +extern Boolean Overlays_Initialize(Overlays *this); +extern Boolean Overlays_Terminate(Overlays *this); +extern Boolean Overlays_AddOvlGroup(Overlays *this, OvlGroup *grp, SInt32 *grpnum); +extern OvlGroup *Overlays_GetOvlGroup(Overlays *this, SInt32 grpnum); +extern SInt32 Overlays_CountGroups(Overlays *this); +extern Boolean Overlays_AddFileToOverlay(Overlays *this, SInt32 grpnum, SInt32 ovlnum, SInt32 filenum); +extern Overlay *Overlays_GetOverlayInGroup(Overlays *this, SInt32 grpnum, SInt32 ovlnum); +extern SInt32 Overlays_GetFileInOverlay(Overlays *this, SInt32 grpnum, SInt32 ovlnum, SInt32 filnum); +extern OvlGroup *OvlGroup_New(const char *name, OvlAddr addr); +extern void OvlGroup_Delete(OvlGroup *grp); +extern Boolean OvlGroup_AddOverlay(OvlGroup *this, Overlay *oly, SInt32 *olynum); +extern Overlay *OvlGroup_GetOverlay(OvlGroup *this, SInt32 olynum); +extern SInt32 OvlGroup_CountOverlays(OvlGroup *this); +extern Overlay *Overlay_New(const char *name); +extern void Overlay_Delete(Overlay *oly); +extern Boolean Overlay_AddFile(Overlay *oly, SInt32 filenum, SInt32 *filnum); +extern SInt32 Overlay_GetFile(Overlay *oly, SInt32 filnul); +extern SInt32 Overlay_CountFiles(Overlay *oly); + +/********************************/ +/* command_line/CmdLine/Src/Project/CLSegs.c */ +extern Segment *Segment_New(const char *name, UInt16 attrs); +extern void Segment_Free(Segment *seg); +extern Boolean Segments_Initialize(Segments *segs); +extern Boolean Segments_Terminate(Segments *segs); +//static Boolean Segments_GrowSegments(Segments *segs, UInt16 *index); +extern Boolean Segments_AddSegment(Segments *segs, Segment *seg, UInt16 *index); +extern Boolean Segments_InsertSegment(Segments *segs, UInt16 index, Segment *seg); +extern Boolean Segments_DeleteSegment(Segments *segs, UInt16 index); +extern Segment *Segments_GetSegment(Segments *segs, UInt16 segnum); +extern UInt16 Segments_Count(const Segments *segs); + +/********************************/ +/* CLDropinCallbacks_V10.cpp */ +// TODO + +/********************************/ +/* command_line/CmdLine/Src/OSLib/MacFileTypes.c */ +extern void OS_AddFileTypeMappingList(OSFileTypeMappings **list, OSFileTypeMappingList *entry); +extern void OS_UseFileTypeMappings(OSFileTypeMappings *list); +extern void OS_MacType_To_OSType(OSType mactype, uOSTypePair *type); +extern int OS_SetMacFileType(const OSSpec *spec, OSType mactype); +extern Boolean OS_GetMacFileTypeMagic(const char *buffer, int count, OSType *mactype); +extern int OS_GetMacFileType(const OSSpec *spec, OSType *mactype); +extern int OS_SetMacFileCreatorAndType(const OSSpec *spec, OSType creator, OSType mactype); + +/********************************/ +/* command_line/CmdLine/Src/OSLib/FileHandles.c */ +//extern int OS_LoadFileHandle(OSFileHandle *hand); +//extern int OS_WriteFileHandle(OSFileHandle *hand); +extern int OS_NewFileHandle(const OSSpec *spec, OSHandle *src, Boolean writeable, OSFileHandle *hand); +extern int OS_LockFileHandle(OSFileHandle *hand, Ptr *ptr, UInt32 *size); +extern int OS_UnlockFileHandle(OSFileHandle *hand); +extern int OS_FreeFileHandle(OSFileHandle *hand); +extern void OS_GetFileHandleSpec(const OSFileHandle *hand, OSSpec *spec); + +/********************************/ +/* command_line/CmdLine/Src/Callbacks/CLCompilerLinkerDropin_V10.cpp */ +// TODO + +/********************************/ +/* command_line/CmdLine/Src/CLDependencies.c */ +extern Boolean Incls_Initialize(Incls *incls, Target *targ); +extern void Incls_Terminate(Incls *incls); +// static Boolean IsSysIncl(Incls *incls, SInt32 idx); +// static void MakeInclFileSpec(Incls *incls, SInt32 idx, OSSpec *spec); +// static Boolean QuickFindFileInIncls(Incls *incls, Boolean fullsearch, const char *filename, OSSpec *spec, SInt32 *index, InclFile **f); +// static Boolean SameIncl(Incls *incls, SInt32 a, SInt32 b); +// static Path *FindOrAddGlobalInclPath(Paths *paths, OSPathSpec *spec); +// static Boolean _FindFileInPath(Path *path, const char *filename, Path **thepath, OSSpec *spec); +// static Boolean FindFileInPaths(Paths *paths, const char *filename, Path **thepath, OSSpec *spec); +// static void AddFileToIncls(Incls *incls, const char *infilename, Boolean syspath, Path *accesspath, Path *globalpath, SInt32 *index); +extern Boolean Incls_FindFileInPaths(Incls *incls, const char *filename, Boolean fullsearch, OSSpec *spec, SInt32 *inclidx); +extern Boolean Deps_Initialize(Deps *deps, Incls *incls); +extern void Deps_Terminate(Deps *deps); +extern int Deps_ChangeSpecialAccessPath(OSSpec *srcfss, Boolean initialize); +extern Path *Deps_GetSpecialAccessPath(); +// static void SetSpecialAccessPathFromIncludeStackTOS(); +// static Boolean FindDepFile(Deps *deps, SInt32 incl); +// static void AddDepFile(Deps *deps, SInt32 incl); +extern void Deps_AddDependency(Deps *deps, SInt32 incl, OSSpec *spec, SInt16 dependencyType); +// static char *EscapeName(Boolean spaces, char *escbuf, const char *path); +extern void Deps_ListDependencies(Incls *incls, File *file, Handle h); + +/********************************/ +/* command_line/CmdLine/Src/CLWriteObjectFile.c */ +extern Boolean WriteObjectFile(File *file, OSType maccreator, OSType mactype); +extern Boolean WriteBrowseData(File *file, OSType maccreator, OSType mactype); + +/********************************/ +/* command_line/CmdLine/Src/CLBrowser.c */ +// GetBrowseTableInfoAndLock +extern int Browser_Initialize(OSHandle *browsetableptr); +//static int Destroy(OSHandle *browsetable); +extern int Browser_Terminate(OSHandle *browsetableptr); +extern int Browser_SearchFile(OSHandle *browsetable, const char *fullpath, SInt16 *ID); +extern int Browser_SearchAndAddFile(OSHandle *browsetable, const char *fullpath, SInt16 *ID); +//static SInt32 CalcDiskSpaceRequirements(...); // needs table type +//static int ConvertMemToDisk(...); // needs table type +extern int Browser_PackBrowseFile(OSHandle *browsedata, OSHandle *browsetable, OSHandle *browsefileptr); + +/********************************/ +/* command_line/CmdLine/Src/CLIncludeFileCache.c */ +// TODO + +/********************************/ +/* ?? Error */ +extern char *GetSysErrText(SInt16 code, char *buffer); + +/********************************/ +/* Might be cc-mach-ppc-mw.c? */ +extern void GetStaticTarget(OSType *cpu, OSType *os); +extern void GetStaticPluginType(OSType *language, OSType *plugintype); +extern void GetStaticParserPluginType(OSType *style); +extern int RegisterStaticTargetResources(); +extern int RegisterStaticTargetPlugins(); + +/********************************/ +/* Might be ParserGlue-mach-ppc-cc.c? */ +extern int RegisterStaticParserToolInfo(); + +/********************************/ +/* Might be cc-mach-ppc.c? */ +extern CW_PASCAL SInt16 CWPlugin_GetDropInFlags(const DropInFlags **flags, SInt32 *flagsSize); +extern CW_PASCAL SInt16 CWPlugin_GetTargetList(const CWTargetList **targetList); +extern CW_PASCAL SInt16 CWPlugin_GetDropInName(const char **dropinName); +extern CW_PASCAL SInt16 CWPlugin_GetDisplayName(const char **displayName); +extern CW_PASCAL SInt16 CWPlugin_GetDefaultMappingList(const CWExtMapList **defaultMappingList); +extern CW_PASCAL SInt16 CWPlugin_GetPanelList(const CWPanelList **panelList); +//_CmdLine_GetObjectFlags +//_CWPlugin_GetVersionInfo +//_CWPlugin_GetFileTypeMappings +//_Linker_GetDropInFlags +//_Linker_GetDropInName +//_Linker_GetDisplayName +//_Linker_GetPanelList +//_Linker_GetTargetList +//_Linker_GetDefaultMappingList +extern int RegisterStaticCompilerPlugin(); +extern int RegisterCompilerResources(); + +/********************************/ +/* libimp-mach-ppc.c */ +// some statics here +extern int RegisterStaticLibImporterPlugin(); +extern int RegisterLibImporterResources(); + +/********************************/ +/* TargetOptimizer-ppc-mach.c */ +extern int TargetSetOptFlags(SInt16 val, Boolean set); +extern void TargetDisplayOptimizationOptions(Handle txt); +extern void TargetSetPragmaOptimizationsToUnspecified(); + +/********************************/ +/* OptimizerHelpers.c */ +extern int SetPragmaOptimizationsToUnspecified(); +extern int SetOptFlags(char *opt, void *str, ...); // two unknown args +extern int DisplayOptimizationOptions(); + +/********************************/ +/* Unk name lol */ +extern int TargetSetWarningFlags(SInt16 val, Boolean set); +extern int TargetDisplayWarningOptions(Handle txt); + +/********************************/ +/* WarningHelpers.c */ +extern int SetWarningFlags(char *opt, void *str, ...); // two unknown args +extern int DisplayWarningOptions(); + +/********************************/ +/* CCompiler.c */ + +// LOTS OF STUFF + +/********************************/ +/* StaticParserGlue.c */ +extern int RegisterStaticParserResources(); +extern int RegisterStaticParserPlugins(); + +/********************************/ +/* ParserFace.c */ +extern Handle Parser_FindPrefPanel(char *name); +extern SInt32 Parser_StorePanels(struct CWPluginPrivateContext *context); +extern SInt16 CWParser_GetDropInFlags(const DropInFlags **flags, SInt32 *flagsSize); +extern SInt16 CWParser_GetDropInName(const char **dropinName); +extern SInt16 CWParser_GetDisplayName(const char **displayName); +extern SInt16 CWParser_GetPanelList(const CWPanelList **panelList); +extern SInt16 CWParser_GetTargetList(const CWTargetList **targetList); +extern SInt16 CWParser_GetVersionInfo(const VersionInfo **versioninfo); +extern SInt16 Parser_SupportsPlugin(struct CLPluginInfo *pluginfo, OSType cpu, OSType os, Boolean *isSupported); +extern SInt16 Parser_SupportsPanels(int numPanels, char **panelNames, Boolean *isSupported); +extern SInt16 parser_main(struct CWPluginPrivateContext *context); + +extern struct ParseOptsType parseopts; + +/********************************/ +/* ParserHelpers.c */ +extern int FindFileInPath(const char *filename, OSSpec *fss); +extern char *GetEnvVar(const char *name, Boolean warn, char **match); +//static Boolean MatchesExtension(const char *list, const char *filename); +extern int Opt_AddAccessPath(const char *opt, void *var, const char *arg); +extern int Opt_AddFrameworkPath(const char *opt, void *var, const char *arg); +extern int Opt_AddFramework(const char *opt, void *var, const char *arg); +extern void ListParseMessage(void *errprint, const char *envvar, SInt16 id); // TODO funcptr sig - same as CLPReportWarning_V, CLPReportError_V +extern int AddAccessPathList(const char *list, char sep1, char sep2, int source, char *text, Boolean system, SInt32 position, Boolean recursive); +extern int Opt_FindAndAddFile(const char *opt, void *var, const char *arg); +extern int Opt_FindAndAddFileRef(const char *opt, void *var, const char *arg); +extern int Opt_AddUnixLibraryFile(const char *opt, void *var, const char *arg); +extern int AddFileList(const char *list, char sep1, char sep2, int source, char *text, SInt32 position); +extern int IsFileInOutputDirectory(const OSSpec *file); +extern void GetCFileNameInOutputDirectory(const char *input, char *name, int maxlen); +extern void GetPFileNameInOutputDirectory(const char *input, unsigned char *name, int len); +extern void AddStringLenToHandle(Handle h, const char *str, int len); +extern void AddStringToHandle(Handle h, const char *str); +extern int Opt_PrintVersion(const char *opt, void *var, const char *arg); +extern void GetFirstSourceFilenameBase(char *buffer, char *defaul); +extern int Opt_SavePrefs(const char *opt, void *var, const char *arg); +extern int ParseNumber(const char *arg, Boolean emit_error, SInt32 *ret, const char **endptr); +extern int Opt_MaybeMoveAccessPaths(const char *opt, void *var, const char *arg); + +/********************************/ +/* ToolHelpers.c */ +extern int Opt_HandleOutputName(const char *opt, void *, const char *filename); +extern int ValidateToolState(Boolean mustHaveFiles); +extern void ToolReportMessage(SInt16 errid, SInt16 type, va_list va); +extern void ToolReportWarning(SInt16 id, ...); +extern void ToolReportError(SInt16 id, ...); +extern void ToolReportOSError(SInt16 id, ...); +extern void ToolReportInfo(SInt16 id, ...); +extern int Opt_DoNotLink(const char *opt, void *var, const char *arg); +extern int Opt_IncreaseVerbosity(const char *opt, void *var, const char *arg); +extern int Opt_SetStage(const char *opt, void *str, const char *arg, void *unk); +// lots of the Opt_ funcs have weird sigs, need to double check them +extern int Opt_RedirectStream(const char *opt, void *file, const char *filename); + +/********************************/ +/* ParserHelpers-cc.c */ +typedef struct { + void *value; + const char *pragma; + int flags; +} Pragma; // assumed name +extern int Opt_AddStringToDefines(const char *opt, void *str, const char *param); +extern int Opt_DefineSymbol(const char *var, const char *value); +extern int Opt_UndefineSymbol(const char *opt, void *, const char *arg); +extern int Opt_AddPrefixFile(const char *opt, void *handle, const char *filename); +extern int Opt_PragmaTrueFalse(const char *, void *flag, const char *, int flags); +extern int Opt_PragmaFalseTrue(const char *, void *flag, const char *, int flags); +extern int Opt_PragmaOnOff(const char *, void *flag, const char *arg); +extern int Opt_PragmaOffOn(const char *, void *flag, const char *arg); +extern int SetupPragmas(const Pragma *pragmas); + +/********************************/ +/* Arguments.c */ +typedef struct { + SInt16 val; + char *text; +} ArgToken; +enum { + ATK_0, + ATK_1, + ATK_2, + ATK_3, + ATK_4, + ATK_5 +}; +typedef struct { + int argc; + int nargv; + char **argv; +} anon0_50; + +extern void Arg_Init(int theargc, char **theargv); +extern void Arg_Terminate(); +extern void Arg_Reset(); +extern void Arg_Stop(ArgToken *where); +extern ArgToken *Arg_PeekToken(); +extern ArgToken *Arg_UsedToken(); +extern int Arg_IsEmpty(); +extern ArgToken *Arg_GetToken(); +extern ArgToken *Arg_UndoToken(); +extern const char *Arg_GetTokenName(ArgToken *tok); +extern const char *Arg_GetTokenText(ArgToken *tok, char *buffer, int maxlen, unsigned char warn); +extern void Arg_InitToolArgs(anon0_50 *ta); +extern void Arg_AddToToolArgs(anon0_50 *ta, SInt16 tokval, char *toktxt); +extern void Arg_FinishToolArgs(anon0_50 *ta); +extern void Arg_ToolArgsForPlugin(anon0_50 *ta, struct CWCommandLineArgs *args); +extern void Arg_FreeToolArgs(anon0_50 *ta); + +/********************************/ +/* ToolHelpers-cc.c */ +extern int Opt_DummyLinkerRoutine(const char *opt); +extern int Opt_DummyLinkerSettingRoutine(const char *var, const char *val); +extern void FinishCompilerTool(); + +/********************************/ +/* IO.c */ +extern void ShowTextHandle(const char *description, Handle text); +extern void ShowVersion(Boolean decorate); + +/********************************/ +/* Projects.c */ +extern int GetFileCount(); +extern void SetFileOutputName(SInt32 position, SInt16 which, char *outfilename); +extern int AddFileToProject(OSSpec *oss, SInt16 which, char *outfilename, Boolean exists, SInt32 position); +extern Boolean GetFileInfo(SInt32 position, OSSpec *spec, char *plugin); +extern int AddAccessPath(const OSPathSpec *oss, SInt16 type, SInt32 position, Boolean recursive); +extern int MoveSystemPathsIntoUserList(); +extern void AddVirtualFile(const char *filename, Handle *text); +extern void GetOutputFileDirectory(OSPathSpec *dir); +extern void SetOutputFileDirectory(const OSPathSpec *dir); +extern void AddOverlayGroup(const char *name, OvlAddr *addr, SInt32 *groupnum, SInt32 *overlaynum); +extern void AddOverlay(SInt32 groupnum, const char *name, SInt32 *overlaynum); +extern void AddSegment(const char *name, SInt16 attrs, SInt32 *segmentnum); +extern void ChangeSegment(SInt32 segmentnum, const char *name, SInt16 attrs); +extern int GetSegment(SInt32 segmentnum, char *name, SInt16 *attrs); + +/********************************/ +/* Targets.c */ +extern int SetParserToolInfo(ParserTool *tool); +extern Boolean ParserToolMatchesPlugin(OSType type, OSType lang, OSType cpu, OSType os); +extern Boolean ParserToolHandlesPanels(int numPanels, const char **panelNames); +extern Boolean SetupParserToolOptions(); + +/********************************/ +/* Option.c */ +typedef struct { + void *first; + void *second; +} Opt50; +typedef struct { + Option *opt; + char *curopt; +} Opt52; +typedef struct { + union { + Opt50 v; + OptionList *lst; + Opt52 o; + char *param; + } e; + SInt16 flags; +} Opt48; +//static void Option_PushList(OptionList *lst); +//static void Option_PushOpt(Option *opt, const char *optname); +//static void Option_PopOpt(const char *optname); +//static void Option_PopList(); +extern void Args_InitStack(); +extern int Args_StackSize(); +extern void Args_Push(SInt16 flags, void *first, void *second); +extern Opt48 *Args_Pop(SInt16 flags); +extern void Args_SpellStack(char *buffer, SInt16 flags); +extern void Args_AddToToolArgs(anon0_50 *ta); +extern void Options_Init(); +extern OptionList *Options_GetOptions(); +extern void Options_SortOptions(); +//static void Options_AddOption(Option *opt); +extern int Options_AddList(OptionList *optlst); +extern int Options_AddLists(OptionList **optlst); +//static void Options_Reset(OptionList *optlst); +//static void Option_SpellList(char *buffer, OptionList *conflicts, int flags); +extern int Option_ForTool(Option *opt, int which); +extern int Option_ThisTool(); +extern int Option_ForThisTool(Option *opt); +extern int Option_AlsoPassedToTool(Option *opt, int which); +extern int Option_AlsoPassedFromThisTool(Option *opt); +//static Boolean Option_ContinuesThisLevel(int level, ArgToken *tok); +//static Boolean Option_IsEndingThisLevel(int level, ArgToken *tok); +//static Boolean Option_IsEndingLevel(int level, ArgToken *tok); +extern int Option_Parse(Option *opt, int oflags); +//static int Option_MatchString(char *list, char *str, int flags, int *result); +//static Option *Option_Lookup(OptionList *search, void *unk, int *flags); +//static int Options_DoParse(OptionList *search, int flags); +extern int Options_Parse(OptionList *options, int flags); +extern int Option_ParseDefaultOption(OptionList *options); +extern void Option_ParamError(SInt16 id, va_list ap); +extern void Option_ParamWarning(SInt16 id, va_list ap); +extern void Option_OptionError(SInt16 id, va_list ap); +extern void Option_OptionWarning(SInt16 id, va_list ap); +extern void Option_Error(SInt16 id, ...); +extern void Option_Warning(SInt16 id, ...); +extern int Options_Help(const char *keyword); +extern int Option_Help(const char *opt); +extern int Options_DisplayHelp(); + +/********************************/ +/* ParserErrors.c */ +extern void CLPReportError_V(const char *format, va_list ap); +extern void CLPReportWarning_V(const char *format, va_list ap); +extern void CLPReport_V(const char *format, va_list ap); +extern void CLPStatus_V(const char *format, va_list ap); +extern void CLPAlert_V(const char *format, va_list ap); +extern void CLPOSAlert_V(const char *format, SInt32 err, va_list ap); +extern void CLPGetErrorString(SInt16 errid, char *buffer); +extern void CLPReportError(SInt16 errid, ...); +extern void CLPReportWarning(SInt16 errid, ...); +extern void CLPReport(SInt16 errid, ...); +extern void CLPAlert(SInt16 errid, ...); +extern void CLPOSAlert(SInt16 errid, SInt16 err, ...); +extern void CLPProgress(SInt16 errid, ...); +extern void CLPStatus(SInt16 errid, ...); +extern void CLPFatalError(const char *format, ...); + +extern char curopt[1024]; + +/********************************/ +/* Utils.c */ +// something is weird with these parameters +// they're supposed to be just "char"... +extern int my_tolower(unsigned char c); +extern int my_isdigit(unsigned char c); +extern int my_isalpha(unsigned char c); +extern int my_isalnum(unsigned char c); +extern int my_isxdigit(unsigned char c); +extern char *Utils_SpellList(char *list, char *buffer, char opts); +extern int Utils_CompareOptionString(const char *a, const char *b, int cased, int sticky); + +/********************************/ +/* Parameter.c */ +extern void Param_DescHelp(PARAM_T *param, const char **desc, const char **help, const char **defaul); +extern int Param_Compare(PARAM_T *param); +extern int Params_Parse(PARAM_T *param, int flags); +extern void Param_Error(SInt16 id, ...); +extern void Param_Warning(SInt16 id, ...); + +/********************************/ +/* Help.c */ +extern int Help_Option(struct OptionList *lst, struct Option *opt, int subprint, const char *keyword); +extern void Help_Options(struct OptionList *lst, int subprint, const char *keyword); +extern void Help_Usage(); +extern void Help_Null(); +extern void Help_Init(); +extern void Help_Line(char ch); +extern void Help_Term(); + +/********************************/ +/* */ + +/********************************/ +/* */ + +/********************************/ +/* ?? COS */ +// static COS_pstrcpy +// static COS_pstrcat +// static COS_pstrcharcat +// static COS_pstrcmp +extern Handle COS_NewHandle(SInt32 byteCount); +extern Handle COS_NewOSHandle(SInt32 logicalSize); +extern void COS_FreeHandle(Handle handle); +extern Boolean COS_ResizeHandle(Handle handle, SInt32 newSize); +extern SInt32 COS_GetHandleSize(Handle handle); +extern void COS_LockHandle(Handle handle); +extern void COS_LockHandleHi(Handle handle); +extern void COS_UnlockHandle(Handle handle); +extern int COS_GetHandleState(Handle handle); +extern void COS_SetHandleState(Handle handle, int state); +extern Boolean COS_IsLockedState(int state); +extern char *COS_NewPtr(SInt32 byteCount); +extern char *COS_NewPtrClear(SInt32 byteCount); +extern void COS_FreePtr(char *ptr); +extern void COS_AppendPtrToHandle(char *ptr1, Handle hand2, SInt32 size); +extern OSErr COS_GetMemErr(); +extern SInt32 COS_GetTicks(); +extern SInt32 COS_GetTime(); +extern void COS_GetString(char *buffer, SInt16 strListID, SInt16 index); +extern void COS_GetPString(unsigned char *buffer, SInt16 strListID, SInt16 index); +extern Boolean COS_IsMultiByte(char *buffer, char *str); +extern SInt16 COS_FileNew(const FSSpec *spec, SInt16 *refNum, OSType creator, OSType fileType); +extern SInt16 COS_FileOpen(const FSSpec *spec, SInt16 *refNum); +extern SInt16 COS_FileGetType(const FSSpec *spec, OSType *fileType); +extern SInt16 COS_FileGetSize(SInt16 refNum, SInt32 *logEOF); +extern SInt16 COS_FileRead(SInt16 refNum, void *buffPtr, SInt32 count); +extern SInt16 COS_FileWrite(SInt16 refNum, const void *buffPtr, SInt32 count); +extern SInt16 COS_FileGetPos(SInt16 refNum, SInt32 *filePos); +extern SInt16 COS_FileSetPos(SInt16 refNum, SInt32 filePos); +extern SInt16 COS_FileClose(SInt16 refNum); +extern void COS_FileSetFSSpec(FSSpec *spec, unsigned char *path); +extern SInt16 COS_FileMakeFSSpec(SInt16 vRefNum, SInt32 dirID, unsigned char *fileName, FSSpec *spec); +extern SInt16 COS_FileMakeFSSpecWithPath(const FSSpec *inputSpec, unsigned char *fileName, FSSpec *spec); +extern SInt16 COS_FileGetFileInfo(const FSSpec *spec, OSType *creator, OSType *fileType); +extern void COS_FileGetFSSpecInfo(const FSSpec *spec, SInt16 *vRefNum, SInt32 *dirID, unsigned char *fileName); +//static void COS_MakePath(SInt16 vRefNum, SInt32 dirID, char *path); +extern void COS_FileGetPathName(char *buffer, const FSSpec *spec, SInt32 *mdDat); +extern Boolean COS_EqualFileSpec(const FSSpec *a, const FSSpec *b); + +/********************************/ +/* MacEmul - ErrMgr */ +extern char *GetSysErrText(SInt16 msgNbr, char *errMsg); + +/********************************/ +/* MacEmul - Files */ +extern OSErr HCreate(SInt16 volume, SInt32 dirid, ConstStr255Param fileName, OSType creator, OSType type); +extern OSErr HOpen(SInt16 vRefNum, SInt32 dirID, ConstStr255Param fileName, SInt8 permission, SInt16 *refNum); +extern OSErr HOpenDF(SInt16 vRefNum, SInt32 dirID, ConstStr255Param fileName, SInt8 permission, SInt16 *refNum); +extern OSErr HDelete(SInt16 vRefNum, SInt32 dirID, ConstStr255Param fileName); +extern OSErr HRename(SInt16 vRefNum, SInt32 dirID, ConstStr255Param oldName, ConstStr255Param newName); +extern OSErr HGetFInfo(SInt16 vRefNum, SInt32 dirID, ConstStr255Param fileName, FInfo *fndrInfo); +extern OSErr HSetFInfo(SInt16 vRefNum, SInt32 dirID, ConstStr255Param fileName, const FInfo *fndrInfo); +extern OSErr FSpCreate(const FSSpec *fss, OSType creator, OSType fileType, ScriptCode scriptTag); +extern OSErr FSpDirCreate(const FSSpec *fss, ScriptCode scriptTag, SInt32 *createdDirID); +extern OSErr FSpOpenDF(const FSSpec *fss, SInt8 permission, SInt16 *refNum); +extern OSErr FSpDelete(const FSSpec *fss); +extern OSErr FSpRename(const FSSpec *oldfss, ConstStr255Param newName); +extern OSErr FSpGetFInfo(const FSSpec *fss, FInfo *fndrInfo); +extern OSErr FSpSetFInfo(const FSSpec *fss, const FInfo *fndrInfo); +extern OSErr HGetVol(StringPtr volName, SInt16 *vRefNum, SInt32 *dirID); +extern OSErr HSetVol(ConstStr63Param volName, SInt16 vRefNum, SInt32 dirID); +extern OSErr FlushVol(ConstStr63Param volName, SInt16 vRefNum); +extern OSErr FSRead(SInt16 fRefNum, SInt32 *Size, void *Buffer); +extern OSErr FSWrite(SInt16 fRefNum, SInt32 *Size, const void *Buffer); +extern OSErr FSClose(SInt16 fRefNum); +extern OSErr GetEOF(SInt16 fRefNum, SInt32 *curEOF); +extern OSErr SetEOF(SInt16 fRefNum, SInt32 newEOF); +extern OSErr GetFPos(SInt16 fRefNum, SInt32 *pos); +extern OSErr SetFPos(SInt16 fRefNum, SInt16 posMode, SInt32 posOffset); +extern OSErr GetVInfo(SInt16 vRefNum, StringPtr name, SInt16 *vRef, SInt32 *hDir); +extern OSErr PBWriteSync(ParmBlkPtr paramBlock); +extern OSErr PBHGetFInfoSync(HParmBlkPtr paramBlock); +extern OSErr PBHSetFInfoSync(HParmBlkPtr paramBlock); +extern OSErr PBGetCatInfoSync(CInfoPBPtr paramBlock); +extern OSErr ResolveAliasFile(FSSpec *fss, Boolean resolveChains, Boolean *isFolder, Boolean *wasAliased); +extern OSErr FSMakeFSSpec(SInt16 vRefNum, SInt32 dirID, ConstStr255Param pathName, FSSpec *fss); +extern OSErr Allocate(SInt16 refNum, SInt32 *byteCount); + +/********************************/ +/* MacEmul - LowMem */ +extern UInt32 LMGetTicks(); +extern UInt32 LMGetTime(); +extern OSErr LMGetMemErr(); +extern void LMSetMemErr(OSErr value); + +/********************************/ +/* MacEmul - Memory */ +extern OSHandle *OS_PeekMacHandle(Handle h); +extern Handle OS_CreateMacHandle(OSHandle *h); +extern Handle OS_CreateMacHandleDup(OSHandle *h); +extern void OS_DestroyMacHandle(Handle h, OSHandle *ret); + +extern OSErr MemError(); +extern Handle NewHandle(SInt32 dataSize); +extern Handle NewHandleClear(UInt32 dataSize); +extern Handle TempNewHandle(UInt32 dataSize, 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 theHandle); +extern void HNoPurge(Handle theHandle); +extern SInt8 HGetState(Handle theHandle); +extern void HSetState(Handle theHandle, SInt8 flags); +extern SInt32 GetHandleSize(Handle h); +extern void SetHandleSize(Handle h, SInt32 newSize); +extern OSErr PtrAndHand(const void *srcPtr, Handle destHandle, SInt32 size); +extern OSErr PtrToHand(const void *srcPtr, Handle *destHandle, SInt32 size); +extern OSErr HandToHand(Handle *destHandle); +extern OSErr HandAndHand(Handle src, Handle dst); +extern void MoveHHi(Handle theHandle); +extern void BlockMove(const void *srcPtr, void *destPtr, UInt32 byteCount); +extern void BlockMoveData(const void *srcPtr, void *destPtr, UInt32 byteCount); +extern Ptr NewPtr(SInt32 dataSize); +extern void DisposePtr(Ptr p); +extern Ptr NewPtrClear(SInt32 dataSize); +extern void DebugStr(ConstStringPtr str); +extern struct Zone *HandleZone(); +extern struct Zone *ApplicationZone(); + +/********************************/ +/* MacEmul - Resources */ +extern Boolean OS_UsingMacResourceForkInfo(); +extern void OS_UseMacResourceForkInfo(Boolean which); +extern OSErr SystemInitResources(OSSpec *spec); +extern void OS_AddMacResourceForkRef(int ref, const OSSpec *spec); +extern void OS_RemoveMacResourceForkRef(int ref); +extern OSSpec *OS_GetMacResourceForkFromRef(int ref); +extern Boolean OS_SearchMacResourceForkList(const OSSpec *rspec, int *ref); +extern int OS_SetMacResourceForkCreatorAndType(int ref, OSType creator, OSType type); +extern int OS_GetMacResourceForkCreatorAndType(int ref, OSType *creator, OSType *type); +extern void OS_CleanupMacResourceForkDir(const OSPathSpec *dir); +extern OSErr OS_MacDumpResourceFork(SInt16 ref, Boolean dumpContents); +extern OSErr FSpOpenRF(const FSSpec *fss, SInt8 permission, SInt16 *refNum); +extern OSErr HOpenRF(SInt16 vRefNum, SInt32 dirID, ConstStringPtr fileName, SInt8 permission, SInt16 *refNum); +extern OSErr InitResources(); +extern OSErr ResError(); +extern void FSpCreateResFile(const FSSpec *fss, OSType creator, OSType fileType, ScriptCode scriptTag); +extern void HCreateResFile(SInt16 vRefNum, SInt32 dirID, ConstStringPtr fileName); +extern OSErr FSpOpenResFile(const FSSpec *fss, SInt8 permission); +extern SInt16 HOpenResFile(SInt16 vRefNum, SInt32 dirID, ConstStringPtr fileName, SInt8 permission); +extern SInt16 CurResFile(); +extern void UseResFile(SInt16 refNum); +extern SInt16 HomeResFile(Handle theResource); +extern Handle GetResource(OSType theType, SInt16 theID); +extern Handle Get1Resource(OSType theType, SInt16 theID); +extern Handle GetNamedResource(OSType theType, ConstStringPtr theName); +extern Handle Get1NamedResource(OSType theType, ConstStringPtr theName); +extern void SetResLoad(Boolean load); +extern void MacEmul_LoadResource(Handle theResource); +extern void GetResInfo(Handle theResource, SInt16 *theID, OSType *theType, StringPtr name); +extern void SetResInfo(Handle theResource, SInt16 theID, ConstStringPtr name); +extern SInt16 GetResAttrs(Handle theResource); +extern void SetResAttrs(Handle theResource, SInt16 attrs); +extern void ChangedResource(Handle theResource); +extern void AddResource(Handle theData, OSType theType, SInt16 theID, ConstStringPtr name); +extern void UpdateResFile(SInt16 refnum); +extern void WriteResource(Handle theResource); +extern void SetResPurge(Boolean install); +extern SInt16 CountResources(OSType theType); +extern SInt16 Count1Resources(OSType theType); +extern Handle GetIndResource(OSType theType, SInt16 index); +extern Handle Get1IndResource(OSType theType, SInt16 index); +extern SInt16 Count1Types(); +extern void Get1IndType(OSType *theType, SInt16 index); +extern void ReleaseResource(); +extern void DetachResource(Handle theResource); +extern void RemoveResource(Handle theResource); +extern void CloseResFile(SInt16 refNum); +extern SInt16 GetResFileAttrs(SInt16); +extern Boolean LMGetResLoad(); + +/********************************/ +/* MacEmul - ResourceStrings */ +extern void Res_Initialize(); +extern int Res_AddResource(const char *name, SInt16 rsrcid, const char **strings); +extern const char *Res_GetResource(SInt16 rsrcid, SInt16 index); +extern void Res_Cleanup(); + +/********************************/ +/* MacEmul - TextUtils */ +extern StringPtr c2pstr(char *s); +extern char *p2cstr(StringPtr s); +extern SInt16 CharacterByteType(Ptr textBuf, SInt16 textOffset, ScriptCode script); +extern SInt16 CharByte(); +extern void GetDateTime(UInt32 *secs); +extern Boolean EqualString(ConstStr255Param strA, ConstStr255Param strB, Boolean caseSens, Boolean diacSens); +extern void GetIndString(Str255 theString, SInt16 strListID, SInt16 index); +extern char *getindstring(char *theString, SInt16 strListID, SInt16 index); +extern void NumToString(SInt32 theNum, Str255 theString); +extern void StringToNum(ConstStr255Param theString, SInt32 *theNum); + +// TODO sort me +extern Project *gProj; +extern ParserTool *pTool; +extern PCmdLine optsCmdLine; +extern PCmdLineEnvir optsEnvir; +extern PCmdLineCompiler optsCompiler; +extern PCmdLineLinker optsLinker; +extern CLState clState; + +/********************************/ +/* CmdLineBuildDate.c */ +extern char CMDLINE_BUILD_DATE[]; +extern char CMDLINE_BUILD_TIME[]; + + +/********************************/ +/* MISC */ +extern char cmdline_build_date[32]; +extern char cmdline_build_time[32]; + +extern StringPtr pstrcpy(StringPtr dst, ConstStringPtr src); +extern int (*PrefPanelsChangedCallback)(const char *); +extern Boolean systemHandles; +extern char *MAINOPTCHAR; +extern char *SEPOPTSTR; +extern char compat; +extern anon0_50 linkargs; + +#ifdef __cplusplus +} +#endif |