summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
Diffstat (limited to 'includes')
-rw-r--r--includes/cmdline.h749
-rw-r--r--includes/common.h10
-rw-r--r--includes/cos.h41
-rw-r--r--includes/cw_common.h43
-rw-r--r--includes/macemul.h4
-rw-r--r--includes/mwcc_decomp.h1225
-rw-r--r--includes/option_system.h73
-rw-r--r--includes/oslib.h18
-rw-r--r--includes/parser.h370
-rw-r--r--includes/plugin.h123
-rw-r--r--includes/plugin_internal.h9
-rw-r--r--includes/pref_structs.h253
12 files changed, 1646 insertions, 1272 deletions
diff --git a/includes/cmdline.h b/includes/cmdline.h
new file mode 100644
index 0000000..2861794
--- /dev/null
+++ b/includes/cmdline.h
@@ -0,0 +1,749 @@
+#pragma once
+
+#include "cw_common.h"
+#include "pref_structs.h"
+
+enum {
+ CLStr1 = 1,
+ CLStr2 = 2,
+ CLStr3 = 3,
+ CLStr4 = 4,
+ CLStr5 = 5,
+ CLStr6 = 6,
+ CLStr7 = 7,
+ CLStr8 = 8,
+ CLStr9 = 9,
+ CLStr10 = 10,
+ CLStr11 = 11,
+ CLStr12 = 12,
+ CLStr13 = 13,
+ CLStr14 = 14,
+ CLStr15 = 15,
+ CLStr16 = 16,
+ CLStr17 = 17,
+ CLStr18 = 18,
+ CLStr19 = 19,
+ CLStr20 = 20,
+ CLStr21 = 21,
+ CLStr22 = 22,
+ CLStr23 = 23,
+ CLStr24 = 24,
+ CLStr25 = 25,
+ CLStr26 = 26,
+ CLStr27 = 27,
+ CLStr28 = 28,
+ CLStr29 = 29,
+ CLStr30 = 30,
+ CLStr31 = 31,
+ CLStr32 = 32,
+ CLStr33 = 33,
+ CLStr34 = 34,
+ CLStr35 = 35,
+ CLStr36 = 36,
+ CLStr37 = 37,
+ CLStr38 = 38,
+ CLStr39 = 39,
+ CLStr40 = 40,
+ CLStr41 = 41,
+ CLStr42 = 42,
+ CLStr43 = 43,
+ CLStr44 = 44,
+ CLStr45 = 45,
+ CLStr46 = 46,
+ CLStr47 = 47,
+ CLStr48 = 48,
+ CLStr49 = 49,
+ CLStr50 = 50,
+ CLStr51 = 51,
+ CLStr52 = 52,
+ CLStr53 = 53,
+ CLStr54 = 54,
+ CLStr55 = 55,
+ CLStr56 = 56,
+ CLStr57 = 57,
+ CLStr58 = 58,
+ CLStr59 = 59,
+ CLStr60 = 60,
+ CLStr61 = 61,
+ CLStr62 = 62,
+ CLStr63 = 63,
+ CLStr64 = 64,
+ CLStr65 = 65,
+ CLStr66 = 66,
+ CLStr67 = 67,
+ CLStr68 = 68,
+ CLStr69 = 69,
+ CLStr70 = 70,
+ CLStr71 = 71,
+ CLStr72 = 72,
+ CLStr73 = 73,
+ CLStr74 = 74,
+ CLStr75 = 75,
+ CLStr76 = 76,
+ CLStr77 = 77,
+ CLStr78 = 78,
+ CLStr79 = 79,
+ CLStr80 = 80,
+ CLStr81 = 81,
+ CLStr82 = 82,
+ CLStr83 = 83,
+ CLStr84 = 84,
+ CLStr85 = 85,
+ CLStr86 = 86,
+ CLStr87 = 87,
+ CLStr88 = 88,
+ CLStr89 = 89,
+ CLStr90 = 90,
+ CLStr91 = 91,
+ CLStr92 = 92,
+ CLStr93 = 93,
+ CLStr94 = 94,
+ CLStr95 = 95,
+ CLStr96 = 96,
+ CLStr97 = 97,
+ CLStr98 = 98,
+ CLStr99 = 99,
+ CLStr100 = 100,
+ CLStr101 = 101,
+ CLStr102 = 102,
+ CLStr103 = 103,
+ CLStr104 = 104,
+ CLStr105 = 105,
+ CLStr106 = 106,
+ CLStr107 = 107,
+ CLStr108 = 108,
+ CLStr109 = 109,
+ CLStr110 = 110,
+ CLStr111 = 111,
+ CLStr112 = 112
+};
+
+#define DO_INTERNAL_ERROR(...) CLInternalError(__FILE__, __LINE__, __VA_ARGS__)
+
+#ifdef __MWERKS__
+#pragma options align=mac68k
+#endif
+// TODO fixme
+typedef struct CPrepFileInfo {
+ FSSpec textfile;
+ void *nameNode;
+ SInt32 fileModDate;
+ char *textbuffer;
+ SInt32 textlength;
+ SInt32 linenumber;
+ SInt32 pos;
+ Boolean hasprepline;
+ SInt16 fileID;
+ Boolean recordbrowseinfo;
+ void *unk;
+} CPrepFileInfo;
+typedef CPrepFileInfo *CPrepFileInfoStack[];
+#ifdef __MWERKS__
+#pragma options align=reset
+#endif
+
+enum {
+ OptsCmdLineState_0 = 0,
+ OptsCmdLineState_1 = 1,
+ OptsCmdLineState_2 = 2,
+ OptsCmdLineState_3 = 3
+};
+enum {
+ OptsCompilerSbmState_0 = 0,
+ OptsCompilerSbmState_1 = 1, // sbmRebuild?
+ OptsCompilerSbmState_2 = 2,
+ OptsCompilerSbmState_3 = 3 // sbmClean?
+};
+enum {
+ CmdLineStage_Cg = 1,
+ CmdLineStage_Pp = 2,
+ CmdLineStage_Ds = 3
+};
+enum {
+ CmdLineStageMask_Pp = 1,
+ CmdLineStageMask_Cg = 2,
+ CmdLineStageMask_Ds = 4,
+ CmdLineStageMask_Dp = 8
+};
+
+// Result codes used by various things in CLMain and CLFileOps
+enum {
+ Result_Success = 0,
+ Result_Failed = 1,
+ Result_Cancelled = 2
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct MessageRef {
+ OSSpec sourcefile;
+ OSSpec errorfile;
+ char *sourceline;
+ SInt32 linenumber;
+ SInt32 tokenoffset;
+ SInt16 tokenlength;
+ SInt32 selectionoffset;
+ SInt16 selectionlength;
+} MessageRef;
+
+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;
+
+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;
+
+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;
+
+typedef struct Segment {
+ char name[32];
+ UInt16 attrs;
+} Segment;
+
+typedef struct Segments {
+ Segment **segsArray;
+ UInt16 arraySize;
+ UInt16 segsCount;
+} Segments;
+typedef struct File {
+ struct File *next;
+ SInt32 filenum;
+ UInt16 segnum;
+ time_t srcmoddate;
+ time_t 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;
+
+enum {
+ LinkModel0 = 0,
+ LinkModel1 = 1,
+ LinkModel2 = 2
+};
+
+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 Project {
+ Target *targets;
+ OSSpec projectDirectory;
+} Project;
+
+enum {
+ CLStyledMessageDispatch_Type0 = 0,
+ CLStyledMessageDispatch_Type1 = 1,
+ CLStyledMessageDispatch_Type2 = 2,
+ CLStyledMessageDispatch_Type3 = 3,
+ CLStyledMessageDispatch_Type4 = 4,
+ CLStyledMessageDispatch_Type5 = 5
+};
+
+enum {
+ IncludeSearch_Type0 = 0,
+ IncludeSearch_Type1 = 1,
+ IncludeSearch_Type2 = 2,
+ IncludeSearch_Type3 = 3,
+ IncludeSearch_Type4 = 4
+};
+
+typedef struct PrefPanel PrefPanel;
+
+typedef struct Plugin {
+ BasePluginCallbacks *cb;
+ CompilerLinkerPluginCallbacks *cl_cb;
+ ParserPluginCallbacks *pr_cb;
+ CWPluginContext context;
+ char *cached_ascii_version;
+ struct Plugin *next;
+} Plugin;
+
+/********************************/
+/* State */
+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;
+ Boolean stdout_written;
+} CLState; // assumed name
+
+extern char cmdline_build_time[32];
+extern char cmdline_build_date[32];
+extern CLState clState;
+extern PCmdLineLinker optsLinker;
+extern PCmdLineCompiler optsCompiler;
+extern PCmdLineEnvir optsEnvir;
+extern PCmdLine optsCmdLine;
+extern Target *gTarg;
+extern Project mainProj;
+extern CWCommandLineArgs *plugin_args;
+extern CWCommandLineArgs *panel_args;
+extern const char **panelNames;
+extern int numPanels;
+extern CLPluginInfo *pluginInfo;
+extern int numPlugins;
+extern jmp_buf exit_program;
+
+/********************************/
+/* Callbacks/CLParserCallbacks_V1.cpp */
+extern int (*PrefPanelsChangedCallback)(const char *);
+
+/********************************/
+/* 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, char **argv, const char *builddate, const char *buildtime);
+extern int CmdLine_Driver();
+extern int CmdLine_Terminate(int exitcode);
+
+/********************************/
+/* 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, ...);
+
+/********************************/
+/* Envir/CLIO.c */
+extern void SetupDebuggingTraps();
+extern Boolean IO_Initialize();
+extern Boolean IO_Terminate();
+extern Boolean IO_HelpInitialize();
+extern Boolean IO_HelpTerminate();
+extern void FixHandleForIDE(Handle text, UInt32 size);
+extern Boolean ShowHandle(Handle text, UInt32 size, Boolean decorate);
+extern Boolean WriteHandleToFile(OSSpec *spec, Handle text, UInt32 size, OSType creator, OSType type);
+extern Boolean WriteBinaryHandleToFile(OSSpec *spec, OSType maccreator, OSType mactype, OSHandle *text);
+extern Boolean AppendHandleToFile(OSSpec *spec, Handle text, UInt32 size, OSType maccreator, OSType mactype);
+extern void InitWorking();
+extern void ShowWorking(int x);
+extern void TermWorking();
+extern Boolean CheckForUserBreak();
+extern char *IO_FormatText(char *buffer, SInt32 size, char *newline, const char *format, ...);
+extern void CLPrintDispatch(int unk, SInt16 msgtype, const char *message);
+extern void CLPrintType(SInt16 msgtype, const char *format, ...);
+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, const char *format, ...);
+
+/********************************/
+/* Plugins/CLPlugins.c */
+extern const ToolVersionInfo *Plugin_GetToolVersionInfo();
+extern const char *Plugin_GetDropInName(Plugin *pl);
+extern const VersionInfo *Plugin_GetVersionInfo(Plugin *pl);
+extern 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);
+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, const char **panelNames);
+extern Boolean Plugin_CL_WriteObjectFile(Plugin *pl, FSSpec *srcfss, FSSpec *outfss, OSType creator, OSType type, Handle data);
+extern Boolean Plugin_CL_GetCompilerMapping(Plugin *pl, OSType type, const char *ext, UInt32 *flags);
+extern Plugin *Plugin_New(const BasePluginCallbacks *cb, const CompilerLinkerPluginCallbacks *cl_cb, const ParserPluginCallbacks *pr_cb);
+extern void Plugin_Free(Plugin *pl);
+extern Boolean 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, const 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, const char ***panelNames);
+extern int Plugin_AddFileTypeMappings(Plugin *pl, OSFileTypeMappings **mlist);
+extern int Plugins_AddFileTypeMappingsForTarget(Plugin *list, OSFileTypeMappings **mlist, OSType cpu, OSType os);
+extern SInt16 Plugin_Call(Plugin *pl, void *context);
+
+/********************************/
+/* Project/CLAccessPaths.c */
+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);
+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);
+extern Boolean Paths_GatherRecurse(Path *path);
+extern int Paths_CountRecurse(Paths *paths);
+extern void Paths_CopyRecurseFSS(FSSpec *list, Paths *paths, UInt16 count);
+extern Boolean MakeFrameworkPath(char *out, const char *filename, Path *globalpath);
+extern void Frameworks_AddPath(const OSPathSpec *oss);
+extern int Frameworks_AddFramework(const char *name, const char *version, Boolean hidden);
+extern void Framework_GetEnvInfo();
+extern int Frameworks_GetCount();
+extern Paths_FWInfo *Frameworks_GetInfo(int which);
+
+// Not sure if this is the right TU for this
+extern Paths FrameworkPaths;
+
+/********************************/
+/* Project/CLFiles.c */
+extern File *File_New();
+extern void File_Free(File *file);
+extern Boolean Files_Initialize(Files *);
+extern Boolean Files_Terminate(Files *);
+extern Boolean Files_AddFile(Files *, File *file);
+extern Boolean Files_InsertFile(Files *, File *file, SInt32 position);
+extern File *Files_GetFile(Files *, SInt32 filenum);
+extern File *Files_FindFile(Files *, OSSpec *spec);
+extern int Files_Count(Files *);
+extern Boolean VFiles_Initialize(VFile **list);
+extern void VFiles_Terminate(VFile **list);
+extern VFile *VFile_New(const char *name, Handle data);
+extern Boolean VFiles_Add(VFile **list, VFile *entry);
+extern VFile *VFiles_Find(VFile *list, const char *name);
+
+/********************************/
+/* Project/CLOverlays.c */
+extern Boolean Overlays_Initialize(Overlays *);
+extern Boolean Overlays_Terminate(Overlays *);
+extern Boolean Overlays_AddOvlGroup(Overlays *, OvlGroup *grp, SInt32 *grpnum);
+extern OvlGroup *Overlays_GetOvlGroup(Overlays *, SInt32 grpnum);
+extern SInt32 Overlays_CountGroups(Overlays *);
+extern Boolean Overlays_AddFileToOverlay(Overlays *, SInt32 grpnum, SInt32 ovlnum, SInt32 filenum);
+extern Overlay *Overlays_GetOverlayInGroup(Overlays *, SInt32 grpnum, SInt32 ovlnum);
+extern SInt32 Overlays_GetFileInOverlay(Overlays *, 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 *, Overlay *oly, SInt32 *olynum);
+extern Overlay *OvlGroup_GetOverlay(OvlGroup *, SInt32 olynum);
+extern SInt32 OvlGroup_CountOverlays(OvlGroup *);
+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 filnum);
+extern SInt32 Overlay_CountFiles(Overlay *oly);
+
+/********************************/
+/* Project/CLProj.c */
+extern Boolean Proj_Initialize(Project *);
+extern Boolean Proj_Terminate(Project *);
+
+/********************************/
+/* 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);
+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);
+
+/********************************/
+/* CLBrowser.c */
+extern int Browser_Initialize(OSHandle *browsetableptr);
+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);
+extern int Browser_PackBrowseFile(Handle browsedata, OSHandle *browsetable, OSHandle *browsefileptr);
+
+/********************************/
+/* CLDependencies.c */
+extern SInt16 *CLT_filesp;
+extern CPrepFileInfoStack *CLT_filestack;
+
+extern Boolean Incls_Initialize(Incls *incls, Target *targ);
+extern void Incls_Terminate(Incls *incls);
+extern Boolean Incls_FindFileInPaths(Incls *incls, 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();
+extern void Deps_AddDependency(Deps *deps, SInt32 incl, OSSpec *spec, Boolean unk, SInt16 dependencyType, Boolean *alreadyincluded);
+extern void Deps_ListDependencies(Incls *incls, File *file, OSHandle *h);
+
+/********************************/
+/* CLFileOps.c */
+extern int GetOutputFile(File *file, SInt16 stage);
+extern int StoreObjectFile(File *file);
+extern int CompileFilesInProject();
+extern int LinkProject();
+
+/********************************/
+/* CLIncludeFileCache.c */
+extern void InitializeIncludeCache();
+extern void CleanupIncludeCache();
+extern void CacheIncludeFile(OSSpec *spec, Handle text, Boolean precompiled);
+extern Handle CachedIncludeFile(OSSpec *spec, Boolean *precompiled);
+extern void FreeIncludeFile(Handle text);
+
+/********************************/
+/* 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();
+
+/********************************/
+/* CLLoadAndCache.c */
+extern short FixTextHandle(Handle txt);
+extern int LoadAndCacheFile(OSSpec *spec, Handle *texthandle, Boolean *precomp);
+extern void CopyFileText(Handle src, char **text, SInt32 *textsize);
+
+/********************************/
+/* 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();
+
+/********************************/
+/* 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,
+ 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);
+
+/********************************/
+/* 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 data);
+extern void Prefs_Initialize();
+extern void Prefs_Terminate();
+extern Boolean Prefs_AddPanel(PrefPanel *panel);
+extern PrefPanel *Prefs_FindPanel(const char *name);
+
+/********************************/
+/* CLTarg.c */
+extern Target *Target_New(const char *name, 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);
+
+/********************************/
+/* CLToolExec.c */
+extern void AppendArgumentList(int *argc, char ***argv, const char *str);
+extern int SetupTemporaries();
+extern int DeleteTemporaries();
+extern int ExecuteLinker(Plugin *plugin, SInt32 dropinflags, File *file, char *stdoutfile, char *stderrfile);
+
+/********************************/
+/* CLWriteObjectFile.c */
+extern int WriteObjectFile(File *file, OSType maccreator, OSType mactype);
+extern int WriteBrowseData(File *file, OSType maccreator, OSType mactype);
+
+/********************************/
+/* Unknown name - provisionally named uFileTypeMappings.c */
+extern void AddFileTypeMappingList(OSFileTypeMappings **list, const OSFileTypeMappingList *entry);
+extern void UseFileTypeMappings(OSFileTypeMappings *list);
+extern OSErr SetMacFileType(const FSSpec *spec, OSType mactype);
+extern OSErr GetMacFileType(const FSSpec *spec, OSType *mactype);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/includes/common.h b/includes/common.h
index 760be22..b1b5b61 100644
--- a/includes/common.h
+++ b/includes/common.h
@@ -24,6 +24,8 @@
#define va_arg(a,b) (*(b *) (void *) ((a = (char *) (((((unsigned long)(a)) + ((__alignof__ (b) == 16) ? 15 : 3)) & ~((__alignof__ (b) == 16) ? 15 : 3)) + ((sizeof (b) + 3) & ~3))) - ((sizeof (b) + 3) & ~3)))
#define va_end(a) ((void)0)
+#define alloca(x) __alloca(x)
+
#else
#include <stdarg.h>
// expand this to nothing
@@ -34,13 +36,13 @@
// MacTypes.h
#ifdef __MWERKS__
typedef unsigned char UInt8;
-typedef signed char SInt8;
+typedef char SInt8;
typedef unsigned short UInt16;
-typedef signed short SInt16;
+typedef short SInt16;
typedef unsigned long UInt32;
-typedef signed long SInt32;
+typedef long SInt32;
typedef unsigned long long UInt64;
-typedef signed long long SInt64;
+typedef long long SInt64;
typedef long Size;
#else
diff --git a/includes/cos.h b/includes/cos.h
new file mode 100644
index 0000000..777b380
--- /dev/null
+++ b/includes/cos.h
@@ -0,0 +1,41 @@
+#pragma once
+
+#include "common.h"
+
+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(StringPtr buffer, SInt16 strListID, SInt16 index);
+extern Boolean COS_IsMultiByte(const char *str, int offset);
+extern OSErr COS_FileNew(const FSSpec *spec, SInt16 *refNum, OSType creator, OSType fileType);
+extern OSErr COS_FileOpen(const FSSpec *spec, SInt16 *refNum);
+extern OSErr COS_FileGetType(const FSSpec *spec, OSType *fileType);
+extern OSErr COS_FileGetSize(SInt16 refNum, SInt32 *logEOF);
+extern OSErr COS_FileRead(SInt16 refNum, void *buffPtr, SInt32 count);
+extern OSErr COS_FileWrite(SInt16 refNum, const void *buffPtr, SInt32 count);
+extern OSErr COS_FileGetPos(SInt16 refNum, SInt32 *filePos);
+extern OSErr COS_FileSetPos(SInt16 refNum, SInt32 filePos);
+extern OSErr COS_FileClose(SInt16 refNum);
+extern void COS_FileSetFSSpec(FSSpec *spec, ConstStringPtr path);
+extern OSErr COS_FileMakeFSSpec(SInt16 vRefNum, SInt32 dirID, ConstStringPtr fileName, FSSpec *spec);
+extern OSErr COS_FileMakeFSSpecWithPath(const FSSpec *inputSpec, ConstStringPtr fileName, FSSpec *spec);
+extern OSErr COS_FileGetFileInfo(const FSSpec *spec, OSType *creator, OSType *fileType);
+extern void COS_FileGetFSSpecInfo(const FSSpec *spec, SInt16 *vRefNum, SInt32 *dirID, StringPtr fileName);
+extern void COS_FileGetPathName(char *buffer, const FSSpec *spec, SInt32 *mdDat);
+extern int COS_EqualFileSpec(const FSSpec *a, const FSSpec *b);
diff --git a/includes/cw_common.h b/includes/cw_common.h
new file mode 100644
index 0000000..bea498a
--- /dev/null
+++ b/includes/cw_common.h
@@ -0,0 +1,43 @@
+#pragma once
+
+/*
+ * Things that seem to be shared across different CodeWarrior modules
+ */
+
+#include "common.h"
+#include "oslib.h"
+#include "macemul.h"
+#include "plugin.h"
+
+typedef struct VersionInfo {
+ UInt16 major;
+ UInt16 minor;
+ UInt16 patch;
+ UInt16 build;
+} VersionInfo;
+
+typedef struct BasePluginCallbacks {
+ CWPLUGIN_ENTRY (*main)(CWPluginContext context);
+ CWPLUGIN_ENTRY (*GetDropInFlags)(const DropInFlags **flags, SInt32 *flagsSize);
+ CWPLUGIN_ENTRY (*GetDisplayName)(const char **displayName);
+ CWPLUGIN_ENTRY (*GetDropInName)(const char **dropInName);
+ CWPLUGIN_ENTRY (*GetPanelList)(const CWPanelList **panelList);
+ CWPLUGIN_ENTRY (*GetFamilyList)(const CWFamilyList **familyList);
+ CWPLUGIN_ENTRY (*GetHelpInfo)(const CWHelpInfo **helpInfo);
+ CWPLUGIN_ENTRY (*GetVersionInfo)(const VersionInfo **versionInfo);
+ CWPLUGIN_ENTRY (*GetFileTypeMappings)(const OSFileTypeMappingList **mappingList);
+} BasePluginCallbacks;
+
+typedef struct CompilerLinkerPluginCallbacks {
+ CWPLUGIN_ENTRY (*GetTargetList)(const struct CWTargetList **targetList);
+ CWPLUGIN_ENTRY (*GetDefaultMappingList)(const CWExtMapList **mappings);
+ CWPLUGIN_ENTRY (*Unmangle)();
+ CWPLUGIN_ENTRY (*BrSymbolEntryPoint)();
+ CWPLUGIN_ENTRY (*GetObjectFlags)(const CWObjectFlags **objectFlags);
+ CWPLUGIN_ENTRY (*WriteObjectFile)(const FSSpec *srcfss, const FSSpec *outfss, OSType creator, OSType type, Handle data);
+} CompilerLinkerPluginCallbacks;
+
+typedef struct ParserPluginCallbacks {
+ CWPLUGIN_ENTRY (*SupportsPlugin)(const CLPluginInfo *pluginfo, OSType cpu, OSType os, Boolean *isSupported);
+ CWPLUGIN_ENTRY (*SupportsPanels)(int numPanels, const char **panelNames, Boolean *isSupported);
+} ParserPluginCallbacks;
diff --git a/includes/macemul.h b/includes/macemul.h
index 4d0e502..dbc4765 100644
--- a/includes/macemul.h
+++ b/includes/macemul.h
@@ -110,7 +110,7 @@ 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 OSErr FSpOpenResFile(const FSSpec *spec, SInt8 permission);
extern SInt16 HOpenResFile(SInt16 vRefNum, SInt32 dirID, ConstStringPtr fileName, SInt8 permission);
extern SInt16 CurResFile();
extern void UseResFile(SInt16 refNum);
@@ -146,7 +146,7 @@ extern Boolean LMGetResLoad();
/********************************/
/* ResourceStrings */
extern void Res_Initialize();
-extern int Res_AddResource(const char *name, SInt16 rsrcid, Handle strings);
+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();
diff --git a/includes/mwcc_decomp.h b/includes/mwcc_decomp.h
index c5fa000..a898422 100644
--- a/includes/mwcc_decomp.h
+++ b/includes/mwcc_decomp.h
@@ -10,861 +10,11 @@
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
@@ -872,118 +22,6 @@ 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);
@@ -997,21 +35,6 @@ 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();
@@ -1045,6 +68,7 @@ extern int DisplayWarningOptions();
/********************************/
/* CCompiler.c */
+extern CWPLUGIN_ENTRY(MWC_main)(CWPluginContext context);
// LOTS OF STUFF
@@ -1054,242 +78,6 @@ 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[];
@@ -1300,17 +88,6 @@ extern char CMDLINE_BUILD_TIME[];
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
}
diff --git a/includes/option_system.h b/includes/option_system.h
index 521213b..aa519e2 100644
--- a/includes/option_system.h
+++ b/includes/option_system.h
@@ -4,7 +4,7 @@
#ifdef __cplusplus
extern "C" {
#endif
-#ifdef __MWERKS__
+#ifdef __MWERKS__
#pragma options align=packed
#endif
enum {
@@ -171,7 +171,7 @@ enum {
};
enum {
OTF_GLOBAL = 1,
- OTF2 = 2,
+ OTF_STICKY = 2,
OTF_CASED = 4,
OTF_OBSOLETE = 8,
OTF_SUBSTITUTED = 0x10,
@@ -182,16 +182,14 @@ enum {
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_HIDE_DEFAULT = 0x2000,
OTF_COMPATIBILITY = 0x4000,
- OTF8000 = 0x8000,
- OTF10000 = 0x10000,
- OTF20000 = 0x20000,
- OTF40000 = 0x40000,
+ OTF_HAS_SUB_OPTIONS = 0x8000,
+ OTF_SUB_OPTIONS_OPTIONAL = 0x10000,
+ OTF_ONLY_ONCE = 0x20000,
+ OTF_HAS_CONFLICTS = 0x40000,
OTF_WARNING = 0x80000,
OTF_SLFLAGS_8 = 0x100000,
OTF_SLFLAGS_10 = 0x200000,
@@ -205,8 +203,8 @@ enum {
OTF8000000 = 0x8000000,
OTF10000000 = 0x10000000,
OTF20000000 = 0x20000000,
- OTF40000000 = 0x40000000,
- OTF80000000 = 0x80000000
+ OTF_INTERNAL_SEEN_CONFLICTED = 0x40000000,
+ OTF_INTERNAL_ALREADY_SEEN = 0x80000000
};
enum {
@@ -260,7 +258,8 @@ enum {
};
enum {
LISTFLAGS_NONE = 0,
- LISTFLAGS_2 = 2,
+ LISTFLAGS_EXCLUSIVE = 1,
+ LISTFLAGS_ALLOW_UNKNOWNS = 2,
LISTFLAGS_4 = 4,
LISTFLAGS_COMPILER = 0x100,
LISTFLAGS_LINKER = 0x200,
@@ -288,7 +287,7 @@ enum {
PFLAGS_40 = 0x40,
PFLAGS_80 = 0x80
};
-#ifdef __MWERKS__
+#ifdef __MWERKS__
#pragma options align=reset
#endif
@@ -299,12 +298,12 @@ typedef struct {
char *text;
} ArgToken;
enum {
- ATK_0,
- ATK_1,
- ATK_2,
- ATK_3,
- ATK_4,
- ATK_5
+ ATK_END,
+ ATK_ARG_END,
+ ATK_ARG,
+ ATK_OPTION,
+ ATK_EQUALS,
+ ATK_COMMA
};
typedef struct {
int argc;
@@ -312,6 +311,20 @@ typedef struct {
char **argv;
} anon0_50;
+extern char compat;
+extern char *MAINOPTCHAR;
+extern char *FIRSTARGCHAR;
+extern char *SEPOPTSTR;
+extern char SEPOPTCHAR;
+extern char SEP1;
+extern char SEP2;
+extern char SEP3;
+extern char RESPFILECHAR;
+extern char *RESPFILESTR;
+extern anon0_50 linkargs;
+extern anon0_50 prelinkargs;
+extern anon0_50 postlinkargs;
+
extern void Arg_Init(int theargc, char **theargv);
extern void Arg_Terminate();
extern void Arg_Reset();
@@ -348,10 +361,9 @@ typedef struct {
} 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 char curopt[1024];
+
extern void Args_InitStack();
extern int Args_StackSize();
extern void Args_Push(SInt16 flags, void *first, void *second);
@@ -361,23 +373,14 @@ 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);
@@ -392,6 +395,8 @@ extern int Options_DisplayHelp();
/********************************/
/* Parameter.c */
+extern char curparam[4096];
+
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);
@@ -400,8 +405,8 @@ 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 int Help_Option(OptionList *lst, Option *opt, int subprint, const char *keyword);
+extern void Help_Options(OptionList *lst, int subprint, const char *keyword);
extern void Help_Usage();
extern void Help_Null();
extern void Help_Init();
diff --git a/includes/oslib.h b/includes/oslib.h
index 22e8ddc..dfa3827 100644
--- a/includes/oslib.h
+++ b/includes/oslib.h
@@ -7,6 +7,8 @@
* OS abstraction layer
*/
+#define OPTION_ASSERT(cond) do { if (!!(cond) == 0) { printf("%s:%u: failed assertion\n", __FILE__, __LINE__); abort(); } } while(0)
+
typedef struct uOSTypePair {
int perm;
} uOSTypePair; // unknown name
@@ -73,13 +75,17 @@ typedef struct OSFileTypeMappingList {
} OSFileTypeMappingList;
typedef struct OSFileTypeMappings {
- OSFileTypeMappingList *mappingList;
+ const OSFileTypeMappingList *mappingList;
struct OSFileTypeMappings *next;
} OSFileTypeMappings;
#ifdef __MWERKS__
#pragma options align=reset
#endif
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/********************************/
/* Generic */
extern int WildCardMatch(char *wild, char *name);
@@ -128,7 +134,7 @@ extern int OS_IsLegalPath(const char *path);
extern int OS_IsFullPath(const char *path);
extern char *OS_GetDirPtr(char *path);
extern int OS_EqualPath(const char *a, const char *b);
-extern int OS_CanonPath(char *src, char *dst);
+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);
@@ -168,7 +174,7 @@ 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);
+extern Boolean OS_IsMultiByte(const char *str, int offset);
/********************************/
/* FileHandles */
@@ -180,7 +186,7 @@ extern void OS_GetFileHandleSpec(const OSFileHandle *hand, OSSpec *spec);
/********************************/
/* MacFileTypes */
-extern void OS_AddFileTypeMappingList(OSFileTypeMappings **list, OSFileTypeMappingList *entry);
+extern void OS_AddFileTypeMappingList(OSFileTypeMappings **list, const 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);
@@ -226,3 +232,7 @@ 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, ...);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/includes/parser.h b/includes/parser.h
new file mode 100644
index 0000000..ae28fee
--- /dev/null
+++ b/includes/parser.h
@@ -0,0 +1,370 @@
+#pragma once
+
+#include "cw_common.h"
+#include "pref_structs.h"
+#include "option_system.h"
+
+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
+
+enum {
+ CLPStr0 = 0,
+ CLPStr1 = 1,
+ CLPStr2 = 2,
+ CLPStr3 = 3,
+ CLPStr4 = 4,
+ CLPStr5 = 5,
+ CLPStr6 = 6,
+ CLPStr7 = 7,
+ CLPStr8 = 8,
+ CLPStr9 = 9,
+ CLPStr10 = 10,
+ CLPStr11 = 11,
+ CLPStr12 = 12,
+ CLPStr13 = 13,
+ CLPStr14 = 14,
+ CLPStr15 = 15,
+ CLPStr16 = 16,
+ CLPStr17 = 17,
+ CLPStr18 = 18,
+ CLPStr19_UnknownOptionX = 19,
+ CLPStr20_UnknownOptionX_ExpectedOneOfX = 20,
+ CLPStr21_OptionObsolete = 21,
+ CLPStr22_OptionObsoleteWithHelp = 22,
+ CLPStr23_OptionXSubstitutedWithX = 23,
+ CLPStr24_OptionDeprecated = 24,
+ CLPStr25_OptionDeprecatedWithHelp = 25,
+ CLPStr26_OptionIgnored = 26,
+ CLPStr27_OptionIgnoredWithText = 27,
+ CLPStr28_WarningText = 28,
+ CLPStr29_OptionHasNoEffect = 29,
+ CLPStr30_OptionShouldNotBeSpecifiedMultipleTimes = 30,
+ CLPStr31_OptionOverridesEffect = 31,
+ CLPStr32_OptionOverridesEffectWithHelp = 32,
+ CLPStr33_NoDefaultHandlerSetUpForX_Ignoring = 33,
+ CLPStr34_ArgumentsExpected = 34,
+ CLPStr35_TokenXNotExpected = 35,
+ CLPStr36_UnexpectedAdditionalArgumentX = 36,
+ CLPStr37 = 37,
+ CLPStr38_NoHelpAvailableForOptionX = 38,
+ CLPStr39 = 39,
+ CLPStr40 = 40,
+ CLPStr41 = 41,
+ CLPStr42 = 42,
+ CLPStr43 = 43,
+ CLPStr44 = 44,
+ CLPStr45 = 45,
+ CLPStr46 = 46,
+ CLPStr47 = 47,
+ CLPStr48 = 48,
+ CLPStr49 = 49,
+ CLPStr50 = 50,
+ CLPStr51 = 51,
+ CLPStr52 = 52,
+ CLPStr53 = 53,
+ CLPStr54 = 54,
+ CLPStr55 = 55,
+ CLPStr56 = 56,
+ CLPStr57 = 57,
+ CLPStr58 = 58,
+ CLPStr59 = 59,
+ CLPStr60 = 60,
+ CLPStr61 = 61,
+ CLPStr62 = 62,
+ CLPStr63 = 63,
+ CLPStr64 = 64,
+ CLPStr65 = 65,
+ CLPStr66 = 66,
+ CLPStr67 = 67,
+ CLPStr68 = 68,
+ CLPStr69 = 69,
+ CLPStr70 = 70,
+ CLPStr71 = 71,
+ CLPStr72 = 72,
+ CLPStr73 = 73,
+ CLPStr74 = 74,
+ CLPStr75 = 75,
+ CLPStr76 = 76,
+ CLPStr77 = 77,
+ CLPStr78 = 78
+};
+
+// State
+
+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)();
+ int (*MidParse)();
+ int (*PostParse)();
+} ParserTool; // assumed name
+
+typedef struct {
+ 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];
+} ParseOptsType; // assumed name
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/********************************/
+/* IO.c */
+extern void ShowTextHandle(const char *description, Handle text);
+extern void ShowVersion(Boolean decorate);
+
+/********************************/
+/* OptimizerHelpers.c */
+extern Pragma irPragmas[];
+
+extern int SetPragmaOptimizationsToUnspecified(const char *opt, void *, const char *, int);
+extern int SetOptFlags(const char *opt, void *str, const char *, int flags);
+extern int DisplayOptimizationOptions();
+
+/********************************/
+/* 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, ...);
+
+/********************************/
+/* ParserFace.c */
+extern const char *failedCallback;
+extern jmp_buf exit_plugin;
+extern ParseOptsType parseopts;
+
+extern Handle Parser_FindPrefPanel(const char *name);
+extern SInt32 Parser_StorePanels(struct CWPluginPrivateContext *context);
+extern CWPLUGIN_ENTRY (CWParser_GetDropInFlags)(const DropInFlags **flags, SInt32 *flagsSize);
+extern CWPLUGIN_ENTRY (CWParser_GetDropInName)(const char **dropinName);
+extern CWPLUGIN_ENTRY (CWParser_GetDisplayName)(const char **displayName);
+extern CWPLUGIN_ENTRY (CWParser_GetPanelList)(const CWPanelList **panelList);
+extern CWPLUGIN_ENTRY (CWParser_GetTargetList)(const CWTargetList **targetList);
+extern CWPLUGIN_ENTRY (CWParser_GetVersionInfo)(const VersionInfo **versioninfo);
+extern CWPLUGIN_ENTRY (Parser_SupportsPlugin)(const struct CLPluginInfo *pluginfo, OSType cpu, OSType os, Boolean *isSupported);
+extern CWPLUGIN_ENTRY (Parser_SupportsPanels)(int numPanels, const char **panelNames, Boolean *isSupported);
+extern CWPLUGIN_ENTRY (parser_main)(struct CWPluginPrivateContext *context);
+
+/********************************/
+/* ParserGlue-mach-ppc-c.c */
+extern PCmdLine pCmdLine;
+extern PCmdLineCompiler pCmdLineCompiler;
+extern PCmdLineLinker pCmdLineLinker;
+extern PFrontEndC pFrontEndC;
+extern PWarningC pWarningC;
+extern PGlobalOptimizer pGlobalOptimizer;
+extern PBackEnd pBackEnd;
+extern PDisassembler pDisassembler;
+extern PMachOLinker pLinker;
+extern PMachOProject pMachOProject;
+extern PCLTExtras pCLTExtras;
+
+/********************************/
+/* ParserHelpers.c */
+extern SInt16 lastStage;
+extern Boolean dashIMinusMovesPaths;
+extern Boolean usedDashIMinus;
+extern Boolean namingSysPaths;
+
+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, int flags);
+extern int Opt_AddFrameworkPath(const char *opt, void *var, const char *arg, int flags);
+extern int Opt_AddFramework(const char *opt, void *var, const char *arg, int flags);
+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, int flags);
+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, int flags);
+extern void GetFirstSourceFilenameBase(char *buffer, char *defaul);
+extern int Opt_SavePrefs(const char *opt, void *var, const char *arg, int flags);
+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, int flags);
+
+/********************************/
+/* ParserHelpers-cc.c */
+extern Handle definesHandle;
+
+extern int Opt_AddStringToDefines(const char *opt, void *str, const char *param, int flags);
+extern int Opt_DefineSymbol(const char *var, const char *value);
+extern int Opt_UndefineSymbol(const char *opt, void *, const char *arg, int flags);
+extern int Opt_AddPrefixFile(const char *opt, void *handle, const char *filename, int flags);
+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);
+
+/********************************/
+/* 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);
+
+/********************************/
+/* TargetOptimizer-ppc-mach.c */
+extern char schedule_ppc_default;
+
+extern int TargetSetOptFlags(short val, Boolean set);
+extern void TargetDisplayOptimizationOptions(Handle txt);
+extern void TargetSetPragmaOptimizationsToUnspecified();
+
+/********************************/
+/* TargetWarningHelpers-ppc-cc.c */
+extern Pragma warningPragmas[];
+
+extern int TargetSetWarningFlags(short val, Boolean set);
+extern void TargetDisplayWarningOptions(Handle txt);
+
+/********************************/
+/* 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();
+
+/********************************/
+/* ToolHelpers.c */
+enum {
+ OutputOrdering0 = 0,
+ OutputOrdering1 = 1,
+ OutputOrdering2 = 2
+};
+extern char linkerOutputFilename[256];
+extern Boolean setLinkerOutputFilename;
+extern Boolean setOutputDirectory;
+extern SInt16 outputOrdering;
+
+extern int Opt_HandleOutputName(const char *opt, void *, const char *filename, int flags);
+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, int flags);
+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);
+
+/********************************/
+/* ToolHelpers-cc.c */
+extern int Opt_DummyLinkerRoutine(const char *opt, void *, const char *, int);
+extern int Opt_DummyLinkerSettingRoutine(const char *var, const char *val);
+extern void FinishCompilerTool();
+
+/********************************/
+/* Utils.c */
+extern int my_tolower(char c);
+extern int my_isdigit(char c);
+extern int my_isalpha(char c);
+extern int my_isalnum(char c);
+extern int my_isxdigit(char c);
+extern char *Utils_SpellList(char *list, char *buffer, char opts);
+extern int Utils_CompareOptionString(const char *a, const char *b, int cased, int sticky);
+
+/********************************/
+/* WarningHelpers.c */
+extern int SetWarningFlags(const char *opt, void *str, const char *, int flags);
+extern int DisplayWarningOptions();
+
+#ifdef __cplusplus
+extern "C" }
+#endif
diff --git a/includes/plugin.h b/includes/plugin.h
index 76b17cc..3341c82 100644
--- a/includes/plugin.h
+++ b/includes/plugin.h
@@ -16,7 +16,18 @@
#endif
enum {
- CWDROPINPARSERTYPE = CWFOURCHAR('P','a','r','s')
+ CWDROPINPARSERTYPE = CWFOURCHAR('P','a','r','s'),
+ CWDROPINDRIVERTYPE = CWFOURCHAR('c','l','d','r'),
+ CWDROPINANYTYPE = CWFOURCHAR('*','*','*','*')
+};
+
+// Extra drop-in flags that aren't in the public plugin SDK headers
+enum {
+ dropInExecutableTool = 1
+};
+
+enum {
+ Lang_Any = CWFOURCHAR('*','*','*','*')
};
typedef struct IDEAccessPath {
@@ -36,6 +47,7 @@ typedef struct IDEAccessPathList {
} IDEAccessPathList;
enum {
+ cwAccessPathTypeFlag1 = 1,
cwAccessPathTypeFlag2 = 2
};
typedef struct CWNewAccessPathInfo {
@@ -77,6 +89,27 @@ typedef struct ToolVersionInfo {
char *version;
} ToolVersionInfo;
+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 CLPluginInfo {
OSType plugintype;
OSType language;
@@ -154,7 +187,7 @@ struct CWCompilerLinkerCallbacks {
struct CWParserCallbacks {
CWResult (*cbParserAddAccessPath)(CWPluginContext, const CWNewAccessPathInfo *);
CWResult (*cbParserSwapAccessPaths)(CWPluginContext);
- CWResult (*cbParserSetNamedPreferences)(CWPluginContext, const char *, CWMemHandle);
+ CWResult (*cbParserSetNamedPreferences)(CWPluginContext, const char *, Handle);
CWResult (*cbParserSetFileOutputName)(CWPluginContext, SInt32, short, const char *);
CWResult (*cbParserSetOutputFileDirectory)(CWPluginContext, const CWFileSpec *);
CWResult (*cbParserAddOverlay1Group)(CWPluginContext, const char *, const CWAddr64 *, SInt32 *);
@@ -172,6 +205,10 @@ extern "C" {
#endif
CW_CALLBACK CWCheckoutLicense(CWPluginContext context, const char *a, const char *b, SInt32 c, void *d, SInt32 *cookiePtr);
CW_CALLBACK CWCheckinLicense(CWPluginContext context, SInt32 cookie);
+
+CW_CALLBACK CWOSErrorMessage(CWPluginContext context, const char *msg, OSErr errorcode);
+CW_CALLBACK CWOSAlert(CWPluginContext context, const char* message, OSErr errorcode);
+
CW_CALLBACK CWSecretAttachHandle(CWPluginContext context, Handle handle, CWMemHandle *memHandle);
CW_CALLBACK CWSecretDetachHandle(CWPluginContext context, CWMemHandle memHandle, Handle *handle);
CW_CALLBACK CWSecretPeekHandle(CWPluginContext context, CWMemHandle memHandle, Handle *handle);
@@ -187,7 +224,7 @@ CW_CALLBACK CWParserStoreCommandLineForPanel(CWPluginContext context, int index,
CW_CALLBACK CWParserStoreCommandLineForPlugin(CWPluginContext context, int index, const CWCommandLineArgs *args);
CW_CALLBACK CWParserAddAccessPath(CWPluginContext context, const CWNewAccessPathInfo *api);
CW_CALLBACK CWParserSwapAccessPaths(CWPluginContext context);
-CW_CALLBACK CWParserSetNamedPreferences(CWPluginContext context, const char *panelName, CWMemHandle paneldata);
+CW_CALLBACK CWParserSetNamedPreferences(CWPluginContext context, const char *panelName, Handle paneldata);
CW_CALLBACK CWParserSetFileOutputName(CWPluginContext context, SInt32 position, short which, const char *outfilename);
CW_CALLBACK CWParserSetOutputFileDirectory(CWPluginContext context, const CWFileSpec *idefss);
CW_CALLBACK CWParserAddOverlay1Group(CWPluginContext context, const char *name, const CWAddr64 *addr, SInt32 *newGroupNumber);
@@ -196,6 +233,86 @@ CW_CALLBACK CWParserAddSegment(CWPluginContext context, const char *name, short
CW_CALLBACK CWParserSetSegment(CWPluginContext context, SInt32 segmentNumber, const char *name, short attrs);
CW_CALLBACK CWParserCreateVirtualFile(CWPluginContext context, const char *name, CWMemHandle text);
CW_CALLBACK CWParserDisplayTextHandle(CWPluginContext context, const char *name, CWMemHandle text);
+
+// CLDropinCallbacks
+extern CWResult UCBGetFileInfo(CWPluginContext context, SInt32 whichfile, Boolean checkFileLocation, CWProjectFileInfo *fileinfo);
+extern CWResult UCBFindAndLoadFile(CWPluginContext context, const char *filename, CWFileInfo *fileinfo);
+extern CWResult UCBGetFileText(CWPluginContext context, const CWFileSpec *filespec, const char **text, SInt32 *textLength, short *filedatatype);
+extern CWResult UCBReleaseFileText(CWPluginContext context, const char *text);
+extern CWResult UCBGetSegmentInfo(CWPluginContext context, SInt32 whichsegment, CWProjectSegmentInfo *segmentinfo);
+extern CWResult UCBGetOverlay1GroupInfo(CWPluginContext context, SInt32 whichgroup, CWOverlay1GroupInfo *groupinfo);
+extern CWResult UCBGetOverlay1FileInfo(CWPluginContext context, SInt32 whichgroup, SInt32 whichoverlay, SInt32 whichoverlayfile, CWOverlay1FileInfo *fileinfo);
+extern CWResult UCBGetOverlay1Info(CWPluginContext context, SInt32 whichgroup, SInt32 whichoverlay, CWOverlay1Info *overlayinfo);
+extern CWResult UCBReportMessage(CWPluginContext context, const CWMessageRef *msgRef, const char *line1, const char *line2, short errorlevel, SInt32 errorNumber);
+extern CWResult UCBAlert(CWPluginContext context, const char *msg1, const char *msg2, const char *msg3, const char *msg4);
+extern CWResult UCBShowStatus(CWPluginContext context, const char *line1, const char *line2);
+extern CWResult UCBUserBreak(CWPluginContext context);
+extern CWResult UCBGetNamedPreferences(CWPluginContext context, const char *prefsname, CWMemHandle *prefsdata);
+extern CWResult UCBStorePluginData(CWPluginContext context, SInt32 whichfile, CWDataType type, CWMemHandle prefsdata);
+extern CWResult UCBGetPluginData(CWPluginContext context, SInt32 whichfile, CWDataType type, CWMemHandle *prefsdata);
+extern CWResult UCBSetModDate(CWPluginContext context, const CWFileSpec *filespec, CWFileTime *moddate, Boolean isGenerated);
+extern CWResult UCBAddProjectEntry(CWPluginContext context, const CWFileSpec *fileSpec, Boolean isGenerated, const CWNewProjectEntryInfo *projectEntryInfo, SInt32 *whichfile);
+extern CWResult UCBCreateNewTextDocument(CWPluginContext context, const CWNewTextDocumentInfo *docinfo);
+extern CWResult UCBAllocateMemory(CWPluginContext context, SInt32 size, Boolean isPermanent, void **ptr);
+extern CWResult UCBFreeMemory(CWPluginContext context, void *ptr, Boolean isPermanent);
+extern CWResult UCBAllocMemHandle(CWPluginContext context, SInt32 size, Boolean useTempMemory, CWMemHandle *handle);
+extern CWResult UCBFreeMemHandle(CWPluginContext context, CWMemHandle handle);
+extern CWResult UCBGetMemHandleSize(CWPluginContext context, CWMemHandle handle, SInt32 *size);
+extern CWResult UCBResizeMemHandle(CWPluginContext context, CWMemHandle handle, SInt32 newSize);
+extern CWResult UCBLockMemHandle(CWPluginContext context, CWMemHandle handle, Boolean moveHi, void **ptr);
+extern CWResult UCBUnlockMemHandle(CWPluginContext context, CWMemHandle handle);
+extern CWResult UCBGetTargetName(CWPluginContext context, char *name, short maxLength);
+extern CWResult UCBPreDialog(CWPluginContext context);
+extern CWResult UCBPostDialog(CWPluginContext context);
+extern CWResult UCBPreFileAction(CWPluginContext context, const CWFileSpec *theFile);
+extern CWResult UCBPostFileAction(CWPluginContext context, const CWFileSpec *theFile);
+extern CWResult UCBCacheAccessPathList(CWPluginContext context);
+extern CWResult UCBSecretAttachHandle(CWPluginContext context, Handle handle, CWMemHandle *memHandle);
+extern CWResult UCBSecretDetachHandle(CWPluginContext context, CWMemHandle memHandle, Handle *handle);
+extern CWResult UCBSecretPeekHandle(CWPluginContext context, CWMemHandle memHandle, Handle *handle);
+extern CWResult UCBCheckoutLicense(CWPluginContext context, const char *a, const char *b, SInt32 c, void *d, SInt32 *cookiePtr);
+extern CWResult UCBCheckinLicense(CWPluginContext context, SInt32 cookie);
+extern CWResult UCBResolveRelativePath(CWPluginContext context, const CWRelativePath *relativePath, CWFileSpec *fileSpec, Boolean create);
+extern CWResult UCBMacOSErrToCWResult(CWPluginContext context, OSErr err);
+
+// CLCompilerLinkerDropin
+extern CWResult UCBCachePrecompiledHeader(CWPluginContext context, const CWFileSpec *filespec, CWMemHandle pchhandle);
+extern CWResult UCBLoadObjectData(CWPluginContext context, SInt32 whichfile, CWMemHandle *objectdata);
+extern CWResult UCBStoreObjectData(CWPluginContext context, SInt32 whichfile, CWObjectData *object);
+extern CWResult UCBFreeObjectData(CWPluginContext context, SInt32 whichfile, CWMemHandle objectdata);
+extern CWResult UCBDisplayLines(CWPluginContext context, SInt32 nlines);
+extern CWResult UCBBeginSubCompile(CWPluginContext context, SInt32 whichfile, CWPluginContext *subContext);
+extern CWResult UCBEndSubCompile(CWPluginContext subContext);
+extern CWResult UCBGetPrecompiledHeaderSpec(CWPluginContext context, CWFileSpec *pchspec, const char *target);
+extern CWResult UCBGetResourceFile(CWPluginContext context, CWFileSpec *filespec);
+extern CWResult UCBPutResourceFile(CWPluginContext context, const char *prompt, const char *name, CWFileSpec *filespec);
+extern CWResult UCBLookUpUnit(CWPluginContext context, const char *name, Boolean isdependency, const void **unitdata, SInt32 *unitdatalength);
+extern CWResult UCBSBMfiles(CWPluginContext context, short libref);
+extern CWResult UCBStoreUnit(CWPluginContext context, const char *unitname, CWMemHandle unitdata, CWDependencyTag dependencytag);
+extern CWResult UCBReleaseUnit(CWPluginContext context, void *unitdata);
+extern CWResult UCBUnitNameToFileName(CWPluginContext context, const char *unitname, char *filename);
+extern CWResult UCBOSAlert(CWPluginContext context, const char *message, OSErr errorcode);
+extern CWResult UCBOSErrorMessage(CWPluginContext context, const char *msg, OSErr errorcode);
+extern CWResult UCBGetModifiedFiles(CWPluginContext context, SInt32 *modifiedFileCount, const SInt32 **modifiedFiles);
+extern CWResult UCBGetSuggestedObjectFileSpec(CWPluginContext context, SInt32 whichfile, CWFileSpec *fileSpec);
+extern CWResult UCBGetStoredObjectFileSpec(CWPluginContext context, SInt32 whichfile, CWFileSpec *fileSpec);
+extern CWResult UCBGetFrameworkCount(CWPluginContext context, SInt32 *frameworkCount);
+extern CWResult UCBGetFrameworkInfo(CWPluginContext context, SInt32 whichFramework, CWFrameworkInfo *frameworkInfo);
+
+// CLParserCallbacks
+extern CWResult UCBParserAddAccessPath(CWPluginContext context, const CWNewAccessPathInfo *api);
+extern CWResult UCBParserSwapAccessPaths(CWPluginContext context);
+extern CWResult UCBParserSetNamedPreferences(CWPluginContext context, const char *panelName, Handle paneldata);
+extern CWResult UCBParserSetFileOutputName(CWPluginContext context, SInt32 position, short which, const char *outfilename);
+extern CWResult UCBParserSetOutputFileDirectory(CWPluginContext context, const CWFileSpec *idefss);
+extern CWResult UCBParserAddOverlay1Group(CWPluginContext context, const char *name, const CWAddr64 *addr, SInt32 *newGroupNumber);
+extern CWResult UCBParserAddOverlay1(CWPluginContext context, const char *name, SInt32 groupNumber, SInt32 *newOverlayNumber);
+extern CWResult UCBParserAddSegment(CWPluginContext context, const char *name, short attrs, SInt32 *newSegmentNumber);
+extern CWResult UCBParserSetSegment(CWPluginContext context, SInt32 segmentNumber, const char *name, short attrs);
+
#ifdef __cplusplus
}
#endif
+
+// This one is intentionally outwith the extern "C" block as it's mangled
+extern CWResult OSErrtoCWResult(OSErr err); \ No newline at end of file
diff --git a/includes/plugin_internal.h b/includes/plugin_internal.h
index be84406..fdf2bd0 100644
--- a/includes/plugin_internal.h
+++ b/includes/plugin_internal.h
@@ -5,7 +5,7 @@
#pragma options align=mac68k
#endif
struct CWPluginPrivateContext {
- CWPluginPrivateContext();
+ CWPluginPrivateContext(SInt32 thePluginType, SInt32 totalSize = 0);
~CWPluginPrivateContext();
SInt32 request;
@@ -79,6 +79,13 @@ struct CWParserContext : CWPluginPrivateContext {
CWCommandLineArgs *panel_args;
CWParserCallbacks *callbacks;
};
+
+struct Plugin;
+typedef struct shellContextType {
+ Plugin *plugin;
+ Boolean userAccessPathsChanged;
+ Boolean systemAccessPathsChanged;
+} shellContextType;
#ifdef __MWERKS__
#pragma options align=reset
#endif
diff --git a/includes/pref_structs.h b/includes/pref_structs.h
new file mode 100644
index 0000000..b443bf7
--- /dev/null
+++ b/includes/pref_structs.h
@@ -0,0 +1,253 @@
+#pragma once
+#include "common.h"
+
+#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;
+ 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 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 PCmdLineEnvir {
+ SInt16 version;
+ SInt16 cols;
+ SInt16 rows;
+ Boolean underIDE;
+} PCmdLineEnvir;
+
+typedef struct PFrontEndC {
+ SInt16 version;
+ Boolean cplusplus;
+ Boolean checkprotos;
+ Boolean arm;
+ Boolean trigraphs;
+ Boolean onlystdkeywords;
+ Boolean enumsalwaysint;
+ Boolean mpwpointerstyle;
+ unsigned char oldprefixname[32];
+ Boolean ansistrict;
+ Boolean mpwcnewline;
+ Boolean wchar_type;
+ Boolean enableexceptions;
+ Boolean dontreusestrings;
+ Boolean poolstrings;
+ Boolean dontinline;
+ Boolean useRTTI;
+ Boolean multibyteaware;
+ Boolean unsignedchars;
+ Boolean autoinline;
+ Boolean booltruefalse;
+ Boolean direct_to_som;
+ Boolean som_env_check;
+ Boolean alwaysinline;
+ SInt16 inlinelevel;
+ Boolean ecplusplus;
+ Boolean objective_c;
+ Boolean defer_codegen;
+ Boolean templateparser;
+ Boolean c99;
+ Boolean bottomupinline;
+} PFrontEndC;
+
+typedef struct PWarningC {
+ SInt16 version;
+ Boolean warn_illpragma;
+ Boolean warn_emptydecl;
+ Boolean warn_possunwant;
+ Boolean warn_unusedvar;
+ Boolean warn_unusedarg;
+ Boolean warn_extracomma;
+ Boolean pedantic;
+ Boolean warningerrors;
+ Boolean warn_hidevirtual;
+ Boolean warn_implicitconv;
+ Boolean warn_notinlined;
+ Boolean warn_structclass;
+} PWarningC;
+
+typedef struct PGlobalOptimizer {
+ SInt16 version;
+ UInt8 optimizationlevel;
+ UInt8 optfor;
+ UInt8 reserved[8];
+} PGlobalOptimizer;
+
+// assumed name/symbols for this one
+typedef struct PExtraWarningC {
+ Boolean warn_largeargs;
+ Boolean warn_padding;
+ Boolean warn_resultnotused;
+ Boolean warn_ptr_int_conv;
+ Boolean warn_no_side_effect;
+} PExtraWarningC;
+
+#ifdef __MWERKS__
+#pragma options align=reset
+#endif