summaryrefslogtreecommitdiffstats
path: root/src/libs/xpcom18a4/xpcom/typelib/xpidl/macplugin
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/libs/xpcom18a4/xpcom/typelib/xpidl/macplugin/compiler.rsrcbin0 -> 915 bytes
-rw-r--r--src/libs/xpcom18a4/xpcom/typelib/xpidl/macplugin/linker.rsrcbin0 -> 984 bytes
-rw-r--r--src/libs/xpcom18a4/xpcom/typelib/xpidl/macplugin/mac_console.c139
-rw-r--r--src/libs/xpcom18a4/xpcom/typelib/xpidl/macplugin/mac_console.h49
-rw-r--r--src/libs/xpcom18a4/xpcom/typelib/xpidl/macplugin/mac_memory.cpp146
-rw-r--r--src/libs/xpcom18a4/xpcom/typelib/xpidl/macplugin/mac_stdlib.cpp58
-rw-r--r--src/libs/xpcom18a4/xpcom/typelib/xpidl/macplugin/mac_strings.cpp38
-rw-r--r--src/libs/xpcom18a4/xpcom/typelib/xpidl/macplugin/mac_strings.h47
-rw-r--r--src/libs/xpcom18a4/xpcom/typelib/xpidl/macplugin/mac_xpidl.cpp417
-rw-r--r--src/libs/xpcom18a4/xpcom/typelib/xpidl/macplugin/mac_xpidl.h25
-rw-r--r--src/libs/xpcom18a4/xpcom/typelib/xpidl/macplugin/mac_xpidl_panel.cpp695
-rw-r--r--src/libs/xpcom18a4/xpcom/typelib/xpidl/macplugin/mac_xpidl_panel.h106
-rw-r--r--src/libs/xpcom18a4/xpcom/typelib/xpidl/macplugin/mac_xpt_linker.cpp546
-rw-r--r--src/libs/xpcom18a4/xpcom/typelib/xpidl/macplugin/panel.rsrcbin0 -> 16238 bytes
-rw-r--r--src/libs/xpcom18a4/xpcom/typelib/xpidl/macplugin/version.rsrcbin0 -> 755 bytes
15 files changed, 2266 insertions, 0 deletions
diff --git a/src/libs/xpcom18a4/xpcom/typelib/xpidl/macplugin/compiler.rsrc b/src/libs/xpcom18a4/xpcom/typelib/xpidl/macplugin/compiler.rsrc
new file mode 100644
index 00000000..fb06f6a3
--- /dev/null
+++ b/src/libs/xpcom18a4/xpcom/typelib/xpidl/macplugin/compiler.rsrc
Binary files differ
diff --git a/src/libs/xpcom18a4/xpcom/typelib/xpidl/macplugin/linker.rsrc b/src/libs/xpcom18a4/xpcom/typelib/xpidl/macplugin/linker.rsrc
new file mode 100644
index 00000000..bec7c043
--- /dev/null
+++ b/src/libs/xpcom18a4/xpcom/typelib/xpidl/macplugin/linker.rsrc
Binary files differ
diff --git a/src/libs/xpcom18a4/xpcom/typelib/xpidl/macplugin/mac_console.c b/src/libs/xpcom18a4/xpcom/typelib/xpidl/macplugin/mac_console.c
new file mode 100644
index 00000000..ecda11e0
--- /dev/null
+++ b/src/libs/xpcom18a4/xpcom/typelib/xpidl/macplugin/mac_console.c
@@ -0,0 +1,139 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: NPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Netscape Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the NPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the NPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#include "mac_console.h"
+
+#ifndef __CONSOLE__
+#include <console.h>
+#endif
+
+extern CWPluginContext gPluginContext;
+
+UInt32 mac_console_count = 0;
+CWMemHandle mac_console_handle = NULL;
+
+/*
+ * The following four functions provide the UI for the console package.
+ * Users wishing to replace SIOUX with their own console package need
+ * only provide the four functions below in a library.
+ */
+
+/*
+ * extern short InstallConsole(short fd);
+ *
+ * Installs the Console package, this function will be called right
+ * before any read or write to one of the standard streams.
+ *
+ * short fd: The stream which we are reading/writing to/from.
+ * returns short: 0 no error occurred, anything else error.
+ */
+
+short InstallConsole(short fd)
+{
+#pragma unused (fd)
+ mac_console_count = 0;
+ CWAllocMemHandle(gPluginContext, 8192, false, &mac_console_handle);
+ return 0;
+}
+
+/*
+ * extern void RemoveConsole(void);
+ *
+ * Removes the console package. It is called after all other streams
+ * are closed and exit functions (installed by either atexit or _atexit)
+ * have been called. Since there is no way to recover from an error,
+ * this function doesn't need to return any.
+ */
+
+void RemoveConsole(void)
+{
+ if (mac_console_handle != NULL) {
+ CWFreeMemHandle(gPluginContext, mac_console_handle);
+ mac_console_handle = NULL;
+ }
+}
+
+/*
+ * extern long WriteCharsToConsole(char *buffer, long n);
+ *
+ * Writes a stream of output to the Console window. This function is
+ * called by write.
+ *
+ * char *buffer: Pointer to the buffer to be written.
+ * long n: The length of the buffer to be written.
+ * returns short: Actual number of characters written to the stream,
+ * -1 if an error occurred.
+ */
+
+long WriteCharsToConsole(char *buffer, long n)
+{
+ long size = 0;
+ void* ptr = NULL;
+
+ if (CWGetMemHandleSize(gPluginContext, mac_console_handle, &size) == noErr) {
+ if (mac_console_count + n >= size) {
+ size += 8192;
+ if (CWResizeMemHandle(gPluginContext, mac_console_handle, size) != noErr)
+ return -1;
+ }
+ }
+
+ if (CWLockMemHandle(gPluginContext, mac_console_handle, false, &ptr) == noErr) {
+ BlockMoveData(buffer, (char *)ptr + mac_console_count, n);
+ mac_console_count += n;
+ CWUnlockMemHandle(gPluginContext, mac_console_handle);
+ }
+
+ return 0;
+}
+
+/*
+ * extern long ReadCharsFromConsole(char *buffer, long n);
+ *
+ * Reads from the Console into a buffer. This function is called by
+ * read.
+ *
+ * char *buffer: Pointer to the buffer which will recieve the input.
+ * long n: The maximum amount of characters to be read (size of
+ * buffer).
+ * returns short: Actual number of characters read from the stream,
+ * -1 if an error occurred.
+ */
+
+long ReadCharsFromConsole(char *buffer, long n)
+{
+ return 0;
+}
diff --git a/src/libs/xpcom18a4/xpcom/typelib/xpidl/macplugin/mac_console.h b/src/libs/xpcom18a4/xpcom/typelib/xpidl/macplugin/mac_console.h
new file mode 100644
index 00000000..88809f85
--- /dev/null
+++ b/src/libs/xpcom18a4/xpcom/typelib/xpidl/macplugin/mac_console.h
@@ -0,0 +1,49 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: NPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Netscape Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the NPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the NPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ mac_console.h
+ */
+
+#pragma once
+
+#include <Files.h>
+#include <Memory.h>
+
+#include "CWPlugins.h"
+
+extern UInt32 mac_console_count;
+extern CWMemHandle mac_console_handle;
diff --git a/src/libs/xpcom18a4/xpcom/typelib/xpidl/macplugin/mac_memory.cpp b/src/libs/xpcom18a4/xpcom/typelib/xpidl/macplugin/mac_memory.cpp
new file mode 100644
index 00000000..41d03d88
--- /dev/null
+++ b/src/libs/xpcom18a4/xpcom/typelib/xpidl/macplugin/mac_memory.cpp
@@ -0,0 +1,146 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: NPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Netscape Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the NPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the NPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ mac_memory.cpp
+ */
+
+#include <new.h>
+#include <stdlib.h>
+
+#include <Files.h>
+#include <Memory.h>
+
+#include "DropInCompilerLinker.h"
+#include "CompilerMapping.h"
+#include "CWPluginErrors.h"
+
+extern CWPluginContext gPluginContext;
+
+/**
+ * Note: memory allocated by these operators will automatically be freed after the
+ * current call into xpidl_compiler completes. This should be fine in most cases,
+ * as we are also having the compiler be reloaded for every request to reinitialize
+ * global data. Just be careful out there!
+ */
+
+const Boolean kTemporaryAllocation = false;
+
+void* operator new(size_t size)
+{
+ void* ptr = NULL;
+ if (CWAllocateMemory(gPluginContext, size, kTemporaryAllocation, &ptr) == cwNoErr)
+ return ptr;
+ return NULL;
+}
+
+void operator delete(void* ptr)
+{
+ if (ptr != NULL)
+ CWFreeMemory(gPluginContext, ptr, kTemporaryAllocation);
+}
+
+void* operator new[] (size_t size)
+{
+ void* ptr = NULL;
+ if (CWAllocateMemory(gPluginContext, size, kTemporaryAllocation, &ptr) == cwNoErr)
+ return ptr;
+ return NULL;
+}
+
+void operator delete[](void* ptr)
+{
+ if (ptr != NULL)
+ CWFreeMemory(gPluginContext, ptr, kTemporaryAllocation);
+}
+
+namespace std {
+
+#define TRACK_ALLOCATION
+#define kTrackedCookie 'TRKD'
+
+void* malloc(size_t size)
+{
+#if defined(TRACK_ALLOCATION)
+ OSType* ptr = (OSType*) new char[sizeof(OSType) + size];
+ if (ptr != NULL)
+ *ptr++ = kTrackedCookie;
+ return ptr;
+#else
+ return new char[size];
+#endif
+}
+
+void free(void *ptr)
+{
+#if defined(TRACK_ALLOCATION)
+ OSType* type = (OSType*)ptr;
+ if (*--type == kTrackedCookie)
+ delete[] (char*) type;
+ else
+ DebugStr("\pillegal block passed to free.");
+#else
+ delete[] (char*) ptr;
+#endif
+}
+
+void* calloc(size_t nmemb, size_t size)
+{
+ size *= nmemb;
+ void* ptr = malloc(size);
+ if (ptr != NULL) {
+ BlockZero(ptr, size);
+ }
+ return ptr;
+}
+
+void* realloc(void * ptr, size_t size)
+{
+ void* newptr = NULL;
+
+ if (size > 0)
+ newptr = malloc(size);
+
+ if (ptr != NULL && newptr != NULL)
+ BlockMoveData(ptr, newptr, size);
+
+ if (ptr != NULL)
+ free(ptr);
+
+ return newptr;
+}
+
+}
diff --git a/src/libs/xpcom18a4/xpcom/typelib/xpidl/macplugin/mac_stdlib.cpp b/src/libs/xpcom18a4/xpcom/typelib/xpidl/macplugin/mac_stdlib.cpp
new file mode 100644
index 00000000..881dcb0b
--- /dev/null
+++ b/src/libs/xpcom18a4/xpcom/typelib/xpidl/macplugin/mac_stdlib.cpp
@@ -0,0 +1,58 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: NPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Netscape Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the NPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the NPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ mac_stdlib.cpp
+
+ replacement functions for the CodeWarrior plugin.
+
+ by Patrick C. Beard.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <setjmp.h>
+
+// simply throw us out of here!
+
+jmp_buf exit_jump;
+int exit_status = 0;
+
+void std::exit(int status)
+{
+ exit_status = status;
+ longjmp(exit_jump, -1);
+}
diff --git a/src/libs/xpcom18a4/xpcom/typelib/xpidl/macplugin/mac_strings.cpp b/src/libs/xpcom18a4/xpcom/typelib/xpidl/macplugin/mac_strings.cpp
new file mode 100644
index 00000000..37e389e5
--- /dev/null
+++ b/src/libs/xpcom18a4/xpcom/typelib/xpidl/macplugin/mac_strings.cpp
@@ -0,0 +1,38 @@
+/*
+ mac_strings.cpp
+ */
+
+#include "mac_strings.h"
+
+#include <string.h>
+#include <Memory.h>
+#include <new>
+
+StringPtr c2p_strcpy(StringPtr pstr, const char* cstr)
+{
+ size_t len = ::strlen(cstr);
+ if (len > 255) len = 255;
+ BlockMoveData(cstr, pstr + 1, len);
+ pstr[0] = len;
+ return pstr;
+}
+
+char* p2c_strcpy(char* cstr, const StringPtr pstr)
+{
+ size_t len = pstr[0];
+ BlockMoveData(pstr + 1, cstr, len);
+ cstr[len] = '\0';
+ return cstr;
+}
+
+char* p2c_strdup(StringPtr pstr)
+{
+ size_t len = pstr[0];
+ char* cstr = new char[1 + len];
+ if (cstr != NULL) {
+ BlockMoveData(pstr + 1, cstr, len);
+ cstr[len] = '\0';
+ }
+ return cstr;
+}
+
diff --git a/src/libs/xpcom18a4/xpcom/typelib/xpidl/macplugin/mac_strings.h b/src/libs/xpcom18a4/xpcom/typelib/xpidl/macplugin/mac_strings.h
new file mode 100644
index 00000000..44f39312
--- /dev/null
+++ b/src/libs/xpcom18a4/xpcom/typelib/xpidl/macplugin/mac_strings.h
@@ -0,0 +1,47 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: NPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Netscape Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the NPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the NPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ mac_strings.h
+ */
+
+#pragma once
+
+#include <MacTypes.h>
+
+StringPtr c2p_strcpy(StringPtr pstr, const char* cstr);
+char* p2c_strcpy(char* cstr, const StringPtr pstr);
+char* p2c_strdup(StringPtr pstr);
diff --git a/src/libs/xpcom18a4/xpcom/typelib/xpidl/macplugin/mac_xpidl.cpp b/src/libs/xpcom18a4/xpcom/typelib/xpidl/macplugin/mac_xpidl.cpp
new file mode 100644
index 00000000..49f061d9
--- /dev/null
+++ b/src/libs/xpcom18a4/xpcom/typelib/xpidl/macplugin/mac_xpidl.cpp
@@ -0,0 +1,417 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: NPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Netscape Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the NPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the NPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ mac_xpidl.cpp
+
+ Metrowerks Codewarrior IDL plugin.
+
+ by Patrick C. Beard.
+ */
+
+/* standard headers */
+#include <ctype.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <new.h>
+#include <setjmp.h>
+
+/* system headers */
+#include <Files.h>
+#include <Errors.h>
+#include <Strings.h>
+
+#include "FullPath.h"
+#include "MoreFilesExtras.h"
+
+/* compiler headers */
+#include "DropInCompilerLinker.h"
+#include "CompilerMapping.h"
+#include "CWPluginErrors.h"
+
+/* local headers. */
+#include "mac_xpidl.h"
+#include "mac_console.h"
+#include "mac_strings.h"
+#include "mac_xpidl_panel.h"
+
+/* prototypes of local functions */
+static CWResult Compile(CWPluginContext context);
+static CWResult Disassemble(CWPluginContext context);
+static CWResult LocateFile(CWPluginContext context, const char* filename, FSSpec& file);
+
+/* external variables */
+extern jmp_buf exit_jump;
+extern int exit_status;
+
+/* global variables */
+CWPluginContext gPluginContext;
+
+/* local variables */
+static CWFileSpec gSourceFile;
+static char* gSourcePath = NULL;
+static CWFileSpec gOutputFile;
+
+extern "C" {
+pascal short xpidl_compiler(CWPluginContext context);
+int xpidl_main(int argc, char* argv[]);
+int xptdump_main(int argc, char* argv[]);
+
+FILE * FSp_fopen(ConstFSSpecPtr spec, const char * open_mode);
+}
+
+pascal short xpidl_compiler(CWPluginContext context)
+{
+ long request;
+ if (CWGetPluginRequest(context, &request) != cwNoErr)
+ return cwErrRequestFailed;
+
+ gPluginContext = context;
+ short result = cwNoErr;
+
+ /* dispatch on compiler request */
+ switch (request) {
+ case reqInitCompiler:
+ /* compiler has just been loaded into memory */
+ break;
+
+ case reqTermCompiler:
+ /* compiler is about to be unloaded from memory */
+ break;
+
+ case reqCompile:
+ /* compile a source file */
+ result = Compile(context);
+ break;
+
+ case reqCompDisassemble:
+ /* disassemble a source file */
+ result = Disassemble(context);
+ break;
+
+ default:
+ result = cwErrRequestFailed;
+ break;
+ }
+
+ /* is this necessary? */
+ CWDonePluginRequest(context, result);
+
+ /* return result code */
+ return (result);
+}
+
+static char* full_path_to(const FSSpec& file)
+{
+ short len = 0;
+ Handle fullPath = NULL;
+ if (FSpGetFullPath(&file, &len, &fullPath) == noErr && fullPath != NULL) {
+ char* path = new char[1 + len];
+ if (path != NULL) {
+ BlockMoveData(*fullPath, path, len);
+ path[len] = '\0';
+ }
+ DisposeHandle(fullPath);
+ return path;
+ }
+ return NULL;
+}
+
+static CWResult GetSettings(CWPluginContext context, XPIDLSettings& settings)
+{
+ CWMemHandle settingsHand;
+ CWResult err = CWGetNamedPreferences(context, kXPIDLPanelName, &settingsHand);
+ if (!CWSUCCESS(err))
+ return (err);
+
+ XPIDLSettings* settingsPtr = NULL;
+ err = CWLockMemHandle(context, settingsHand, false, (void**)&settingsPtr);
+ if (!CWSUCCESS(err))
+ return (err);
+
+ settings = *settingsPtr;
+
+ err = CWUnlockMemHandle(context, settingsHand);
+ if (!CWSUCCESS(err))
+ return (err);
+
+ return noErr;
+}
+
+static CWResult Compile(CWPluginContext context)
+{
+ CWResult err = CWGetMainFileSpec(context, &gSourceFile);
+ if (!CWSUCCESS(err))
+ return (err);
+
+ long fileNum;
+ err = CWGetMainFileNumber(context, &fileNum);
+ if (!CWSUCCESS(err))
+ return (err);
+
+ // get the name of the source file to compile.
+ gSourcePath = p2c_strdup(gSourceFile.name);
+ if (gSourcePath == NULL)
+ return cwErrOutOfMemory;
+
+ // build an argument list and call the compiler.
+ XPIDLSettings settings = { kXPIDLSettingsVersion, kXPIDLModeHeader, false, false };
+ GetSettings(context, settings);
+
+#if 0
+ // if generating .xpt files, let the IDE tell us where to put the output file.
+ // otherwise, put them in the project's output directory.
+ if (settings.mode == kXPIDLModeTypelib)
+ err = CWGetSuggestedObjectFileSpec(context, fileNum, &gOutputFile);
+ else
+ err = CWGetOutputFileDirectory(gPluginContext, &gOutputFile);
+#else
+ // always generate the output file into the project target's data directory.
+ err = CWGetSuggestedObjectFileSpec(context, fileNum, &gOutputFile);
+#endif
+ if (!CWSUCCESS(err))
+ return (err);
+
+ int argc = 3;
+ char* modes[] = { "header", "java", "typelib", "doc" };
+ char* argv[] = { "xpidl", "-m", modes[settings.mode - 1], NULL, NULL, NULL, NULL, };
+ if (settings.warnings) argv[argc++] = "-w";
+ if (settings.verbose) argv[argc++] = "-v";
+ argv[argc++] = gSourcePath;
+
+ if (setjmp(exit_jump) == 0) {
+ if (xpidl_main(argc, argv) != 0)
+ err = cwErrRequestFailed;
+ } else {
+ // evidently the good old exit function got called.
+ if (exit_status != 0)
+ err = cwErrRequestFailed;
+ }
+
+ // if the compilation succeeded, tell CodeWarrior about the output file.
+ // this ensures several things: 1. if the output file is deleted by the user,
+ // then the IDE will know to recompile it, which is good for dirty builds,
+ // where the output files may be hand deleted; 2. if the user elects to remove
+ // objects, the output files are deleted. Thanks to robv@metrowerks.com for
+ // pointing this new CWPro4 API out.
+ if (err == cwNoErr) {
+ CWObjectData objectData;
+ BlockZero(&objectData, sizeof(objectData));
+
+ // for fun, show how large the output file is in the data area.
+ long dataSize, rsrcSize;
+ if (FSpGetFileSize(&gOutputFile, &dataSize, &rsrcSize) == noErr)
+ objectData.idatasize = dataSize;
+
+ // tell the IDE that this file was generated by the compiler.
+ objectData.objectfile = &gOutputFile;
+
+ err = CWStoreObjectData(context, fileNum, &objectData);
+ } else {
+ // an error occured, delete the output file, which might be a partial file.
+ if (gOutputFile.name[0] != 0) {
+ ::FSpDelete(&gOutputFile);
+ }
+ }
+
+ delete[] gSourcePath;
+ gSourcePath = NULL;
+
+ return (err);
+}
+
+static CWResult Disassemble(CWPluginContext context)
+{
+ // the disassembly code has moved to the linker.
+ return noErr;
+}
+
+static CWResult LocateFile(CWPluginContext context, const char* filename, FSSpec& file)
+{
+ /* prefill the CWFileInfo struct */
+ CWFileInfo fileinfo;
+ BlockZero(&fileinfo, sizeof(fileinfo));
+ // memset(&fileinfo, 0, sizeof(fileinfo));
+ fileinfo.fullsearch = true;
+ fileinfo.suppressload = true;
+ fileinfo.dependencyType = cwNormalDependency;
+ fileinfo.isdependentoffile = kCurrentCompiledFile;
+
+ /* locate the file name using the project's access paths */
+ CWResult err = CWFindAndLoadFile(context, filename, &fileinfo);
+ if (err == cwNoErr) {
+ file = fileinfo.filespec;
+ } else if (err == cwErrFileNotFound) {
+ char errmsg[200];
+ sprintf(errmsg, "Can't locate file \"%s\".", filename);
+ CWResult callbackResult = CWReportMessage(context, 0, errmsg, 0, messagetypeError, 0);
+ }
+
+ return (err);
+}
+
+/**
+ * Substitute for standard fopen, treats certain filenames specially,
+ * and also considers the mode argument. If a file is being opened
+ * for reading, the file is assumed to be locateable using CodeWarrior's
+ * standard access paths. If it's for writing, the file is opened in
+ * the current project's output directory.
+ */
+FILE* std::fopen(const char* filename, const char *mode)
+{
+ FSSpec filespec;
+ CWResult err = noErr;
+ do {
+ if (filename == gSourcePath || strcmp(filename, gSourcePath) == 0) {
+ // opening the main source file.
+ filespec = gSourceFile;
+ } else if (mode[0] == 'w') {
+ // if an output file, open it in the current compilation's output directory.
+ c2p_strcpy(filespec.name, filename);
+ filespec.vRefNum = gOutputFile.vRefNum;
+ filespec.parID = gOutputFile.parID;
+ c2p_strcpy(gOutputFile.name, filename);
+ } else {
+ // an input file, use CodeWarrior's search paths to find the named source file.
+ err = LocateFile(gPluginContext, filename, filespec);
+ }
+ } while (0);
+ // if all went well, we have a file to open.
+ return (err == noErr ? FSp_fopen(&filespec, mode) : NULL);
+}
+
+/**
+ * Returns the length of a file, assuming it is always located in the
+ * project's output directory.
+ */
+size_t mac_get_file_length(const char* filename)
+{
+ long dataSize= 0, rsrcSize = 0;
+ FSSpec filespec;
+ if (CWGetOutputFileDirectory(gPluginContext, &filespec) != noErr)
+ return 0;
+ c2p_strcpy(filespec.name, filename);
+ if (FSpGetFileSize(&filespec, &dataSize, &rsrcSize) != noErr)
+ return 0;
+ return dataSize;
+}
+
+void mac_warning(const char* warning_message)
+{
+ CWReportMessage(gPluginContext, 0, warning_message, 0, messagetypeWarning, 0);
+}
+
+void mac_error(const char* error_message)
+{
+ CWReportMessage(gPluginContext, 0, error_message, 0, messagetypeError, 0);
+}
+
+// plugin compiler exports.
+
+#if CW_USE_PRAGMA_EXPORT
+#pragma export on
+#endif
+
+CWPLUGIN_ENTRY(CWPlugin_GetDropInFlags)(const DropInFlags** flags, long* flagsSize)
+{
+ static const DropInFlags sFlags = {
+ kCurrentDropInFlagsVersion,
+ CWDROPINCOMPILERTYPE,
+ DROPINCOMPILERLINKERAPIVERSION,
+ (kGeneratescode | /* kCandisassemble | */ kCompMultiTargAware | kCompAlwaysReload),
+ Lang_MISC,
+ DROPINCOMPILERLINKERAPIVERSION
+ };
+
+ *flags = &sFlags;
+ *flagsSize = sizeof(sFlags);
+
+ return cwNoErr;
+}
+
+CWPLUGIN_ENTRY(CWPlugin_GetDropInName)(const char** dropinName)
+{
+ static const char* sDropInName = "xpidl";
+
+ *dropinName = sDropInName;
+
+ return cwNoErr;
+}
+
+CWPLUGIN_ENTRY(CWPlugin_GetDisplayName)(const char** displayName)
+{
+ static const char* sDisplayName = "xpidl";
+
+ *displayName = sDisplayName;
+
+ return cwNoErr;
+}
+
+CWPLUGIN_ENTRY(CWPlugin_GetPanelList)(const CWPanelList** panelList)
+{
+ static const char* sPanelName = kXPIDLPanelName;
+ static CWPanelList sPanelList = { kCurrentCWPanelListVersion, 1, &sPanelName };
+
+ *panelList = &sPanelList;
+
+ return cwNoErr;
+}
+
+CWPLUGIN_ENTRY(CWPlugin_GetTargetList)(const CWTargetList** targetList)
+{
+ static CWDataType sCPU = '****';
+ static CWDataType sOS = '****';
+ static CWTargetList sTargetList = { kCurrentCWTargetListVersion, 1, &sCPU, 1, &sOS };
+
+ *targetList = &sTargetList;
+
+ return cwNoErr;
+}
+
+CWPLUGIN_ENTRY(CWPlugin_GetDefaultMappingList)(const CWExtMapList** defaultMappingList)
+{
+ static CWExtensionMapping sExtension = { 'TEXT', ".idl", 0 };
+ static CWExtMapList sExtensionMapList = { kCurrentCWExtMapListVersion, 1, &sExtension };
+
+ *defaultMappingList = &sExtensionMapList;
+
+ return cwNoErr;
+}
+
+#if CW_USE_PRAGMA_EXPORT
+#pragma export off
+#endif
diff --git a/src/libs/xpcom18a4/xpcom/typelib/xpidl/macplugin/mac_xpidl.h b/src/libs/xpcom18a4/xpcom/typelib/xpidl/macplugin/mac_xpidl.h
new file mode 100644
index 00000000..bb1c5048
--- /dev/null
+++ b/src/libs/xpcom18a4/xpcom/typelib/xpidl/macplugin/mac_xpidl.h
@@ -0,0 +1,25 @@
+/*
+ mac_xpidl.h
+
+ prototypes for the Mac CodeWarrior plugin version of xpidl.
+
+ by Patrick C. Beard.
+ */
+
+#pragma once
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _STDIO_H
+#include <stdio.h>
+#endif
+
+size_t mac_get_file_length(const char* filename);
+void mac_warning(const char* warning_message);
+void mac_error(const char* error_message);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/src/libs/xpcom18a4/xpcom/typelib/xpidl/macplugin/mac_xpidl_panel.cpp b/src/libs/xpcom18a4/xpcom/typelib/xpidl/macplugin/mac_xpidl_panel.cpp
new file mode 100644
index 00000000..b046071d
--- /dev/null
+++ b/src/libs/xpcom18a4/xpcom/typelib/xpidl/macplugin/mac_xpidl_panel.cpp
@@ -0,0 +1,695 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: NPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Netscape Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the NPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the NPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ mac_xpidl_panel.cpp
+ */
+
+#define CW_STRICT_DIALOGS 1
+
+/* standard headers */
+#include <stdarg.h>
+#include <stdio.h>
+#include <string.h>
+
+/* system headers */
+#include <AERegistry.h>
+#include <Drag.h>
+#include <Palettes.h>
+#include <Resources.h>
+#include <Scrap.h>
+#include <TextUtils.h>
+#include <Sound.h>
+
+/* compiler headers */
+#include <DropInPanel.h>
+
+/* project headers */
+#include "mac_xpidl_panel.h"
+
+enum {
+ kFactoryPrefsID = 128,
+ kCW7ItemListID = 128,
+ kCW8ItemListID = 129,
+
+ kXPIDLModeItem = 1,
+ kXPIDLWarningsItem,
+ kXPIDLVerboseItem,
+
+ kXPTLinkerOutputItem = 4
+};
+
+
+/* local variables */
+static RgnHandle sDragRgn;
+static Boolean sHighlightOn;
+
+
+/* prototypes of local functions */
+static short InitDialog(PanelParameterBlock *pb);
+static void TermDialog(PanelParameterBlock *pb);
+static void PutData(PanelParameterBlock *pb, Handle options);
+static short GetData(PanelParameterBlock *pb, Handle options, Boolean noisy);
+static void ByteSwapData(XPIDLSettingsHandle options);
+static short Filter(PanelParameterBlock *pb, EventRecord *event, short *itemHit);
+static void ItemHit(PanelParameterBlock *pb);
+static void Validate(Handle original, Handle current, Boolean *recompile, Boolean *relink, Boolean *reset);
+static short GetPref(AEKeyword keyword, AEDesc *prefsDesc, Handle settings);
+static short SetPref(AEKeyword keyword, const AEDesc *prefsDesc, Handle settings);
+static short GetFactory(Handle settings);
+static short UpdatePref(Handle settings);
+static Boolean ComparePrefs(Handle prefsHand1, Handle prefsHand2);
+static Boolean ComparePrefs(XPIDLSettings& prefs1, XPIDLSettings& prefs2);
+static void OutlineRect(const Rect* focusRect, Boolean outlineOn);
+static OSErr DragEnter(PanelParameterBlock *pb);
+static void DragWithin(PanelParameterBlock *pb);
+static void DragExit(PanelParameterBlock *pb);
+static void DragDrop(PanelParameterBlock *pb);
+
+extern "C" {
+
+pascal short xpidl_panel(PanelParameterBlock *pb);
+
+}
+
+/*
+ * main - entry-point for Drop-In Preferences Panel
+ *
+ */
+
+pascal short xpidl_panel(PanelParameterBlock *pb)
+{
+ short result;
+
+ result = noErr;
+
+ switch (pb->request)
+ {
+ case reqInitPanel:
+ /* panel has just been loaded into memory */
+ break;
+
+ case reqTermPanel:
+ /* panel is about to be unloaded from memory */
+ break;
+
+ case reqFirstLoad:
+ /* first time panel was loaded. */
+ break;
+
+ case reqInitDialog:
+ /* hook our dialog item list into the preferences dialog */
+ result = InitDialog(pb);
+ break;
+
+ case reqTermDialog:
+ /* unhook our dialog item list from the preferences dialog */
+ TermDialog(pb);
+ break;
+
+ case reqPutData:
+ /* put the data in the given handle into our dialog items */
+ PutData(pb, pb->currentPrefs);
+ break;
+
+ case reqGetData:
+ /* fill in the given handle with our dialog items */
+ result = GetData(pb, pb->currentPrefs, true);
+ break;
+
+ case reqByteSwapData:
+ /* byte swap the data in the handle */
+ ByteSwapData((XPIDLSettingsHandle)pb->currentPrefs);
+ break;
+
+ case reqFilter:
+ /* filter an event in the dialog */
+ result = Filter(pb, pb->event, &pb->itemHit);
+ break;
+
+ case reqItemHit:
+ /* handle a hit on one of our dialog items */
+ ItemHit(pb);
+ break;
+
+ case reqDrawCustomItem:
+ /* handle a request to draw one of our user items (CW/8 and later) */
+ break;
+
+ case reqActivateItem:
+ break;
+
+ case reqDeactivateItem:
+ break;
+
+ case reqHandleKey:
+ break;
+
+ case reqHandleClick:
+ break;
+
+ case reqFindStatus:
+ break;
+
+ case reqObeyCommand:
+ break;
+
+ case reqAEGetPref:
+ /* return one item in the given handle as an Apple Event descriptor */
+ result = GetPref(pb->prefsKeyword, &pb->prefsDesc, pb->currentPrefs);
+ break;
+
+ case reqAESetPref:
+ /* change one item in the given handle according to the given Apple Event descriptor */
+ result = SetPref(pb->prefsKeyword, &pb->prefsDesc, pb->currentPrefs);
+ break;
+
+ case reqValidate:
+ /* determine if we need to reset paths, recompile, or relink */
+ Validate(pb->originalPrefs, pb->currentPrefs, &pb->recompile, &pb->relink, &pb->reset);
+ break;
+
+ case reqGetFactory:
+ /* return our factory settings */
+ result = GetFactory(pb->factoryPrefs);
+ break;
+
+ case reqUpdatePref:
+ /* update the given handle to use the current format for our prefs data */
+ result = UpdatePref(pb->currentPrefs);
+ break;
+
+ case reqDragEnter:
+ /* determine if we can accept the drag and, if so, start tracking */
+ result = DragEnter(pb);
+ break;
+
+ case reqDragWithin:
+ /* continue tracking */
+ DragWithin(pb);
+ break;
+
+ case reqDragExit:
+ /* stop tracking */
+ DragExit(pb);
+ break;
+
+ case reqDragDrop:
+ /* the user has dropped in our panel */
+ DragDrop(pb);
+ break;
+
+ default:
+ result = paramErr;
+ break;
+ }
+
+ return (result);
+}
+
+/*
+ * InitDialog - initialize Dialog Box items for this panel
+ *
+ */
+
+static short InitDialog(PanelParameterBlock *pb)
+{
+ OSErr err;
+
+ // The library function will call the IDE to append the dialog items
+ // if possible; else it will call AppendDITL itself. This way, you
+ // don't have to worry about it.
+
+ err = CWPanlAppendItems(pb, kCW8ItemListID);
+ if (err != noErr)
+ return (err);
+
+ sDragRgn = NewRgn();
+
+ return (err);
+}
+
+/*
+ * TermDialog - destroy Dialog Box items for this panel
+ *
+ */
+
+static void TermDialog(PanelParameterBlock *pb)
+{
+ DisposeRgn(sDragRgn);
+}
+
+inline Boolean hasLinkerOutput(short mode)
+{
+ return (mode == kXPIDLModeHeader || mode == kXPIDLModeTypelib);
+}
+
+/*
+ * PutData - copy the options data from the handle to the screen
+ *
+ */
+
+static void PutData(PanelParameterBlock *pb, Handle options)
+{
+ // make sure the options are the right size.
+ UpdatePref(options);
+
+ XPIDLSettings prefsData = **(XPIDLSettingsHandle) options;
+
+ CWPanlSetItemValue(pb, kXPIDLModeItem, prefsData.mode);
+ CWPanlSetItemValue(pb, kXPIDLWarningsItem, prefsData.warnings);
+ CWPanlSetItemValue(pb, kXPIDLVerboseItem, prefsData.verbose);
+
+ CWPanlEnableItem(pb, kXPTLinkerOutputItem, hasLinkerOutput(prefsData.mode));
+ CWPanlSetItemText(pb, kXPTLinkerOutputItem, prefsData.output);
+}
+
+/*
+ * GetData - copy the options data from screen to the handle
+ *
+ */
+
+static short GetData(PanelParameterBlock *pb, Handle options, Boolean noisy)
+{
+ XPIDLSettings prefsData = **(XPIDLSettingsHandle) options;
+ long mode, warnings, verbose;
+
+ CWPanlGetItemValue(pb, kXPIDLModeItem, &mode);
+ CWPanlGetItemValue(pb, kXPIDLWarningsItem, &warnings);
+ CWPanlGetItemValue(pb, kXPIDLVerboseItem, &verbose);
+
+ prefsData.mode = (short) mode;
+ prefsData.warnings = (Boolean) warnings;
+ prefsData.verbose = (Boolean) verbose;
+
+ CWPanlGetItemText(pb, kXPTLinkerOutputItem, prefsData.output, sizeof(Str32));
+
+ ** (XPIDLSettingsHandle) options = prefsData;
+
+ return (noErr);
+}
+
+static void ByteSwapShort(short* x)
+{
+ union {
+ short s;
+ char c[2];
+ } from,to;
+
+ from.s=*x;
+ to.c[0]=from.c[1];
+ to.c[1]=from.c[0];
+ *x = to.s;
+}
+
+/*
+ * ByteSwapData - byte-swap the options data
+ *
+ */
+
+static void ByteSwapData(XPIDLSettingsHandle options)
+{
+ ByteSwapShort(&(**options).version);
+ ByteSwapShort(&(**options).mode);
+}
+
+/*
+ * Filter - filter an event for the Preferences panel
+ *
+ */
+static short Filter(PanelParameterBlock *pb, EventRecord *event, short *itemHit)
+{
+#pragma unused(pb, event, itemHit)
+
+ return (noErr);
+}
+
+/*
+ * ItemHit - handle an itemHit in a Preferences panel
+ *
+ */
+
+static void ItemHit(PanelParameterBlock *pb)
+{
+ short theItem = pb->itemHit - pb->baseItems;
+ long oldValue;
+
+ switch (theItem) {
+ case kXPIDLModeItem:
+ CWPanlGetItemValue(pb, theItem, &oldValue);
+ CWPanlEnableItem(pb, kXPTLinkerOutputItem, hasLinkerOutput(oldValue));
+ break;
+
+ case kXPIDLWarningsItem:
+ case kXPIDLVerboseItem:
+ CWPanlGetItemValue(pb, theItem, &oldValue);
+ break;
+ }
+
+ GetData(pb, pb->currentPrefs, false);
+
+ pb->canRevert = !ComparePrefs(pb->originalPrefs, pb->currentPrefs);
+ pb->canFactory = !ComparePrefs(pb->factoryPrefs, pb->currentPrefs);
+}
+
+/*
+ * Validate - check if panel's changes require a recompile or relink
+ *
+ */
+
+static void Validate(Handle original, Handle current, Boolean *recompile, Boolean *relink, Boolean *reset)
+{
+#pragma unused(original, current)
+ XPIDLSettings& origSettings = **(XPIDLSettingsHandle) original;
+ XPIDLSettings& currentSettings = **(XPIDLSettingsHandle) current;
+
+ *recompile = currentSettings.mode != origSettings.mode;
+ *relink = *recompile && hasLinkerOutput(currentSettings.mode);
+ *reset = false;
+}
+
+/*
+ * GetPref - get a specified Preference setting for an AppleEvent request
+ *
+ */
+static short GetPref(AEKeyword keyword, AEDesc *prefsDesc, Handle settings)
+{
+#if 0
+ XPIDLSettings prefsData = ** (XPIDLSettingsHandle) settings;
+ DescType anEnum;
+ OSErr err;
+
+ switch (keyword) {
+ case prefsLN_GenerateSymFile:
+ err = AECreateDesc(typeBoolean, &prefsData.linksym, sizeof(Boolean), prefsDesc);
+ break;
+
+ case prefsPR_ProjectType:
+ switch (prefsData.projtype)
+ {
+ case kProjTypeApplication: anEnum = enum_Project_Application; break;
+ case kProjTypeLibrary: anEnum = enum_Project_Library; break;
+ case kProjTypeSharedLib: anEnum = enum_Project_SharedLibrary; break;
+ case kProjTypeCodeResource: anEnum = enum_Project_CodeResource; break;
+ case kProjTypeMPWTool: anEnum = enum_Project_MPWTool; break;
+ default: return (paramErr);
+ }
+ err = AECreateDesc(typeEnumeration, &anEnum, sizeof(anEnum), prefsDesc);
+ break;
+
+ case prefsPR_FileName:
+ err = AECreateDesc(typeChar, prefsData.outfile+1, StrLength(prefsData.outfile), prefsDesc);
+ break;
+
+ default:
+ err = errAECantHandleClass;
+ break;
+ }
+
+ return (err);
+#else
+ return (errAECantHandleClass);
+#endif
+}
+
+/*
+ * SetPref - set a specified Preference setting from an AppleEvent request
+ *
+ */
+
+static short SetPref(AEKeyword keyword, const AEDesc *prefsDesc, Handle settings)
+{
+#if 0
+ XPIDLSettings prefsData = ** (XPIDLSettingsHandle) settings;
+ AEDesc toDesc = { typeNull, NULL };
+ OSErr err = noErr;
+ Handle dataHand;
+ Size textLength;
+ DescType anEnum;
+
+ switch (keyword)
+ {
+ case prefsLN_GenerateSymFile:
+ if (prefsDesc->descriptorType == typeBoolean)
+ {
+ dataHand = prefsDesc->dataHandle;
+ }
+ else
+ {
+ err = AECoerceDesc(prefsDesc, typeBoolean, &toDesc);
+ if (err == noErr)
+ dataHand = toDesc.dataHandle;
+ }
+ if (err == noErr)
+ {
+ prefsData.linksym = ** (Boolean **) dataHand;
+ }
+ break;
+
+ case prefsPR_ProjectType:
+ if (prefsDesc->descriptorType != typeEnumeration)
+ {
+ err = errAETypeError;
+ break;
+ }
+
+ anEnum = ** (DescType **) prefsDesc->dataHandle;
+
+ switch (anEnum)
+ {
+ case enum_Project_Application: prefsData.projtype = kProjTypeApplication; break;
+ case enum_Project_Library: prefsData.projtype = kProjTypeLibrary; break;
+ case enum_Project_SharedLibrary: prefsData.projtype = kProjTypeSharedLib; break;
+ case enum_Project_CodeResource: prefsData.projtype = kProjTypeCodeResource; break;
+ case enum_Project_MPWTool: prefsData.projtype = kProjTypeMPWTool; break;
+ default: return (errAECoercionFail);
+ }
+ break;
+
+ case prefsPR_FileName:
+ if (prefsDesc->descriptorType == typeChar)
+ {
+ dataHand = prefsDesc->dataHandle;
+ }
+ else
+ {
+ err = AECoerceDesc(prefsDesc, typeChar, &toDesc);
+ if (err == noErr)
+ dataHand = toDesc.dataHandle;
+ }
+ if (err == noErr)
+ {
+ textLength = GetHandleSize(dataHand);
+ if (textLength > sizeof(prefsData.outfile) - 1)
+ textLength = sizeof(prefsData.outfile) - 1;
+ BlockMoveData(*dataHand, prefsData.outfile+1, textLength);
+ prefsData.outfile[0] = textLength;
+ }
+ break;
+
+ default:
+ err = errAECantHandleClass;
+ break;
+ }
+
+ if (err == noErr)
+ {
+ ** (XPIDLSettingsHandle) settings = prefsData;
+ }
+
+ AEDisposeDesc(&toDesc);
+
+ return (err);
+#else
+ return (errAECantHandleClass);
+#endif
+}
+
+/*
+ * GetFactory - retrieve factory settings
+ *
+ */
+
+static short GetFactory(Handle settings)
+{
+ Handle factory;
+ Size size;
+ OSErr err;
+
+ factory = Get1Resource('pref', kFactoryPrefsID);
+ if (factory == NULL) {
+ err = ResError();
+ if (err == noErr)
+ err = resNotFound;
+ return (err);
+ }
+
+ size = GetHandleSize(factory);
+ SetHandleSize(settings, size);
+ err = MemError();
+
+ if (err == noErr) {
+ BlockMoveData(*factory, *settings, size);
+ }
+
+ return (err);
+}
+
+/*
+ * UpdatePref - "upgrade" a pref to the current version
+ */
+static short UpdatePref(Handle settings)
+{
+ if (GetHandleSize(settings) != sizeof(XPIDLSettings))
+ GetFactory(settings);
+
+ return (noErr);
+}
+
+/*
+ * ComparePrefs
+ *
+ */
+static Boolean ComparePrefs(Handle prefsHand1, Handle prefsHand2)
+{
+ XPIDLSettings& prefs1 = **(XPIDLSettingsHandle) prefsHand1;
+ XPIDLSettings& prefs2 = **(XPIDLSettingsHandle) prefsHand2;
+
+ return ((prefs1.mode == prefs2.mode) &&
+ (prefs1.warnings == prefs2.warnings) &&
+ (prefs1.verbose == prefs2.verbose) &&
+ (EqualString(prefs1.output, prefs2.output, true, true)));
+}
+
+static Boolean ComparePrefs(XPIDLSettings& prefs1, XPIDLSettings& prefs2)
+{
+ return ((prefs1.mode == prefs2.mode) &&
+ (prefs1.warnings == prefs2.warnings) &&
+ (prefs1.verbose == prefs2.verbose) &&
+ (EqualString(prefs1.output, prefs2.output, true, true)));
+}
+
+/*
+ * OutlineRect
+ *
+ */
+static void OutlineRect(const Rect* focusRect, Boolean outlineOn)
+{
+ ColorSpec savedForeColor, backColor;
+ PenState savedPen;
+
+ GetPenState(&savedPen);
+ PenNormal();
+
+ if (!outlineOn)
+ {
+ SaveFore(&savedForeColor);
+ SaveBack(&backColor);
+ RestoreFore(&backColor);
+ }
+
+ PenSize(2, 2);
+ FrameRect(focusRect);
+
+ SetPenState(&savedPen);
+
+ if (!outlineOn)
+ {
+ RestoreFore(&savedForeColor);
+ }
+}
+
+/*
+ * DragEnter
+ *
+ */
+static OSErr DragEnter(PanelParameterBlock *pb)
+{
+#if 0
+ short theItem = pb->itemHit - pb->baseItems;
+ unsigned short itemCount;
+ Rect itemRect;
+ OSErr err;
+#endif
+
+ /* Return paramErr if the user is on a item that can't be dropped on */
+ return (paramErr);
+}
+
+/*
+ * DragWithin
+ *
+ */
+static void DragWithin(PanelParameterBlock *pb)
+{
+#pragma unused(pb)
+
+ /* there's nothing to do */
+
+/// SysBreakStr("\preqDragWithin");
+}
+
+/*
+ * DragExit
+ *
+ */
+static void DragExit(PanelParameterBlock *pb)
+{
+ OSErr err;
+
+/// SysBreakStr("\preqDragExit");
+
+ if (sHighlightOn) {
+ err = HideDragHilite(pb->dragref);
+ if (err == noErr)
+ sHighlightOn = false;
+ }
+}
+
+/*
+ * DragDrop
+ *
+ */
+static void DragDrop(PanelParameterBlock *pb)
+{
+#if 0
+ Rect itemRect;
+#endif
+
+/// SysBreakStr("\preqDragDrop");
+
+ DragExit(pb);
+}
diff --git a/src/libs/xpcom18a4/xpcom/typelib/xpidl/macplugin/mac_xpidl_panel.h b/src/libs/xpcom18a4/xpcom/typelib/xpidl/macplugin/mac_xpidl_panel.h
new file mode 100644
index 00000000..582b1055
--- /dev/null
+++ b/src/libs/xpcom18a4/xpcom/typelib/xpidl/macplugin/mac_xpidl_panel.h
@@ -0,0 +1,106 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: NPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Netscape Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the NPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the NPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ mac_xpidl_panel.h
+ */
+
+#pragma once
+
+#ifndef __MAC_XPIDL_PANEL__
+#define __MAC_XPIDL_PANEL__
+
+#ifndef __TYPES__
+#include <Types.h>
+#endif
+
+#pragma options align=mac68k
+
+/* this is the name of the panel, as shown in the Finder */
+#define kXPIDLPanelName "xpidl Settings"
+
+/*
+ * AppleScript dictionary info. As a rule of thumb, dropin panels should use the
+ * same terminology and numeric code in their 'aete' that the IDE uses if there
+ * is already a similar item in the IDE's 'aete'. That is the case here, so we
+ * merely duplicate applicable 68K Project and 68K Linker user terms below.
+ */
+
+enum {
+/* Symbolic Name Code AETE Terminology */
+ class_XPIDL = 'XIDL',
+
+ prefsPR_ProjectType = 'PR01', /* Project Type */
+ prefsPR_FileName = 'PR02', /* File Name */
+ prefsLN_GenerateSymFile = 'LN02', /* Generate SYM File */
+
+ /* enumeration for project type */
+ enumeration_ProjectType = 'PRPT',
+ enum_Project_Application = 'PRPA', /* application */
+ enum_Project_Library = 'PRPL', /* library */
+ enum_Project_SharedLibrary = 'PRPS', /* shared library */
+ enum_Project_CodeResource = 'PRPC', /* code resource */
+ enum_Project_MPWTool = 'PRPM' /* MPW tool */
+};
+
+enum {
+ kXPIDLModeHeader = 1,
+ kXPIDLModeJava,
+ kXPIDLModeTypelib,
+ kXPIDLModeDoc
+};
+
+/* This is the structure that is manipulated by the panel. The sample
+ * compiler & linker both "know" about this structure.
+ */
+
+enum {
+ kXPIDLSettingsVersion = 0x0100
+};
+
+struct XPIDLSettings {
+ short version; /* version # of settings data */
+ short mode; /* one of kXPIDLModeHeader, ... */
+ Boolean warnings; /* generate warnings. */
+ Boolean verbose; /* verbose mode */
+ Str32Field output; /* name of the output file */
+};
+
+typedef struct XPIDLSettings XPIDLSettings, **XPIDLSettingsHandle;
+
+#pragma options align=reset
+
+#endif /* __MAC_XPIDL_PANEL__ */
diff --git a/src/libs/xpcom18a4/xpcom/typelib/xpidl/macplugin/mac_xpt_linker.cpp b/src/libs/xpcom18a4/xpcom/typelib/xpidl/macplugin/mac_xpt_linker.cpp
new file mode 100644
index 00000000..fe137959
--- /dev/null
+++ b/src/libs/xpcom18a4/xpcom/typelib/xpidl/macplugin/mac_xpt_linker.cpp
@@ -0,0 +1,546 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: NPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Netscape Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Netscape Communications Corporation.
+ * Portions created by the Initial Developer are Copyright (C) 1998
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the NPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the NPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/*
+ mac_xpt_linker.cpp
+
+ CodeWarrior plugin linker, links together multiple .xpt files.
+
+ by Patrick C. Beard.
+ */
+
+/* standard headers */
+#include <stdio.h>
+#include <string.h>
+#include <setjmp.h>
+
+/* system headers */
+#include <Files.h>
+#include <Strings.h>
+#include <Aliases.h>
+#include <Resources.h>
+
+/* compiler headers */
+#include "DropInCompilerLinker.h"
+#include "CompilerMapping.h"
+#include "CWPluginErrors.h"
+
+/* project headers */
+#include "mac_xpidl_panel.h"
+#include "mac_console.h"
+#include "mac_strings.h"
+#include "FullPath.h"
+#include "MoreFilesExtras.h"
+
+/* use standard CodeWarrior debugger */
+#define kDebuggerCreator 'MWDB'
+
+/* prototypes of local functions */
+static CWResult Link(CWPluginContext context);
+static CWResult Disassemble(CWPluginContext context);
+static CWResult GetTargetInfo(CWPluginContext context);
+
+extern "C" {
+pascal short xpt_linker(CWPluginContext context);
+int xptlink_main(int argc, char* argv[]);
+int xptdump_main(int argc, char* argv[]);
+
+FILE * FSp_fopen(ConstFSSpecPtr spec, const char * open_mode);
+size_t mac_get_file_length(const char* filename);
+}
+
+/* external variables */
+extern jmp_buf exit_jump;
+extern int exit_status;
+
+/* global variables */
+CWPluginContext gPluginContext;
+
+/* local variables */
+static CWFileSpec gOutputDirectory;
+static CWFileSpec gObjectCodeDirectory;
+
+/*
+ * xpt_linker - main entry-point for linker plugin
+ *
+ */
+pascal short xpt_linker(CWPluginContext context)
+{
+ long request;
+ if (CWGetPluginRequest(context, &request) != cwNoErr)
+ return cwErrRequestFailed;
+
+ gPluginContext = context;
+ short result = cwNoErr;
+
+ /* dispatch on linker request */
+ switch (request) {
+ case reqInitLinker:
+ /* linker has just been loaded into memory */
+ break;
+
+ case reqTermLinker:
+ /* linker is about to be unloaded from memory */
+ break;
+
+ case reqLink:
+ /* build the final executable */
+ result = Link(context);
+ break;
+
+ case reqDisassemble:
+ /* disassemble object code for a given project file */
+ result = Disassemble(context);
+ break;
+
+ case reqTargetInfo:
+ /* return info describing target characteristics */
+ result = GetTargetInfo(context);
+ break;
+
+ default:
+ result = cwErrRequestFailed;
+ break;
+ }
+
+ result = CWDonePluginRequest(context, result);
+
+ /* return result code */
+ return result;
+}
+
+static char* full_path_to(const FSSpec& file)
+{
+ short len = 0;
+ Handle fullPath = NULL;
+ if (FSpGetFullPath(&file, &len, &fullPath) == noErr && fullPath != NULL) {
+ char* path = new char[1 + len];
+ if (path != NULL) {
+ BlockMoveData(*fullPath, path, len);
+ path[len] = '\0';
+ }
+ DisposeHandle(fullPath);
+ return path;
+ }
+ return NULL;
+}
+
+/**
+ * Provides the full path name to a given directory.
+ */
+static char* full_path_to(short vRefNum, long dirID)
+{
+ long parID;
+ if (GetParentID(vRefNum, dirID, NULL, &parID) == noErr) {
+ FSSpec dirSpec = { vRefNum, parID };
+ if (GetDirName(vRefNum, dirID, dirSpec.name) == noErr) {
+ return full_path_to(dirSpec);
+ }
+ }
+ return NULL;
+}
+
+/**
+ * Returns the length of a file, assuming it is always located in the
+ * project's object code directory.
+ */
+size_t mac_get_file_length(const char* filename)
+{
+ FSSpec fileSpec = { gObjectCodeDirectory.vRefNum, gObjectCodeDirectory.parID };
+ c2p_strcpy(fileSpec.name, filename);
+ long dataSize, rsrcSize;
+ if (FSpGetFileSize(&fileSpec, &dataSize, &rsrcSize) != noErr)
+ dataSize = 0;
+ return dataSize;
+}
+
+/**
+ * replaces standard fopen -- opens files for writing in the project's output directory,
+ * and files for reading in the object code directory.
+ */
+FILE* std::fopen(const char* filename, const char *mode)
+{
+ CWFileSpec& fileDir = (mode[0] == 'r' ? gObjectCodeDirectory : gOutputDirectory);
+ FSSpec fileSpec = { fileDir.vRefNum, fileDir.parID };
+ c2p_strcpy(fileSpec.name, filename);
+ return FSp_fopen(&fileSpec, mode);
+}
+
+static CWResult GetSettings(CWPluginContext context, XPIDLSettings& settings)
+{
+ CWMemHandle settingsHand;
+ CWResult err = CWGetNamedPreferences(context, kXPIDLPanelName, &settingsHand);
+ if (!CWSUCCESS(err))
+ return err;
+
+ XPIDLSettings* settingsPtr = NULL;
+ err = CWLockMemHandle(context, settingsHand, false, (void**)&settingsPtr);
+ if (!CWSUCCESS(err))
+ return err;
+
+ settings = *settingsPtr;
+
+ err = CWUnlockMemHandle(context, settingsHand);
+ if (!CWSUCCESS(err))
+ return err;
+
+ return cwNoErr;
+}
+
+static CWResult LinkHeaders(CWPluginContext context, XPIDLSettings& settings)
+{
+ // find out how many files there are to link.
+ long fileCount = 0;
+ CWResult err = CWGetProjectFileCount(context, &fileCount);
+ if (err != cwNoErr || fileCount == 0)
+ return err;
+
+ // get the output directory.
+ FSSpec outputDir;
+ err = CWGetOutputFileDirectory(context, &outputDir);
+ if (!CWSUCCESS(err))
+ return err;
+
+ // enumerate all of the output header files, and make aliases to them in
+ // the output directory.
+ for (long index = 0; (err == cwNoErr) && (index < fileCount); index++) {
+ // get the name of each output file.
+ CWFileSpec outputFile;
+ err = CWGetStoredObjectFileSpec(context, index, &outputFile);
+ if (err == cwNoErr) {
+ FInfo info;
+ err = FSpGetFInfo(&outputFile, &info);
+
+ FSSpec aliasFile = { outputDir.vRefNum, outputDir.parID };
+ BlockMoveData(outputFile.name, aliasFile.name, 1 + outputFile.name[0]);
+
+ AliasHandle alias = NULL;
+ if (NewAliasMinimal(&outputFile, &alias) == noErr) {
+ // recreate the alias file from scratch.
+ FSpDelete(&aliasFile);
+ FSpCreateResFile(&aliasFile, info.fdCreator, info.fdType, smRoman);
+ short refNum = FSpOpenResFile(&aliasFile, fsRdWrPerm);
+ if (refNum != -1) {
+ UseResFile(refNum);
+ AddResource(Handle(alias), rAliasType, 0, aliasFile.name);
+ ReleaseResource(Handle(alias));
+ UpdateResFile(refNum);
+ CloseResFile(refNum);
+ }
+ // finally, mark the newly created file as an alias file.
+ FSpGetFInfo(&aliasFile, &info);
+ info.fdFlags |= kIsAlias;
+ FSpSetFInfo(&aliasFile, &info);
+ }
+ }
+ }
+
+ // create the target file in the output directory.
+ BlockMoveData(settings.output, outputDir.name, 1 + settings.output[0]);
+ FILE* outputFile = FSp_fopen(&outputDir, "w");
+ if (outputFile != NULL) fclose(outputFile);
+
+ return err;
+}
+
+static CWResult LinkTypeLib(CWPluginContext context, XPIDLSettings& settings)
+{
+ // find out how many files there are to link.
+ long fileCount = 0;
+ CWResult err = CWGetProjectFileCount(context, &fileCount);
+ if (err != cwNoErr || fileCount == 0)
+ return err;
+
+ // assemble the argument list.
+ // { "xpt_link", outputFile, inputFile1, ..., inputFileN, NULL }
+ char** argv = new char*[2 + fileCount + 1];
+ int argc = 0;
+ argv[argc++] = "xpt_link";
+
+ // get the output directory.
+ err = CWGetOutputFileDirectory(context, &gOutputDirectory);
+ if (!CWSUCCESS(err))
+ return err;
+
+ // get the object code directory.
+ err = CWGetStoredObjectFileSpec(context, 0, &gObjectCodeDirectory);
+ if (!CWSUCCESS(err))
+ return err;
+
+ // push the output file name.
+ if ((argv[argc++] = p2c_strdup(settings.output)) == NULL)
+ return cwErrOutOfMemory;
+
+ for (long index = 0; (err == cwNoErr) && (index < fileCount); index++) {
+ // get the name of each output file.
+ CWFileSpec outputFile;
+ err = CWGetStoredObjectFileSpec(context, index, &outputFile);
+ if (err == cwNoErr) {
+ if ((argv[argc++] = p2c_strdup(outputFile.name)) == NULL) {
+ err = cwErrOutOfMemory;
+ break;
+ }
+ }
+ }
+
+ if (err != cwNoErr)
+ return err;
+
+ // trap calls to exit, which longjmp back to here.
+ if (setjmp(exit_jump) == 0) {
+ if (xptlink_main(argc, argv) != 0)
+ err = cwErrRequestFailed;
+ } else {
+ // evidently the good old exit function got called.
+ if (exit_status != 0)
+ err = cwErrRequestFailed;
+ }
+
+ return err;
+}
+
+static CWResult Link(CWPluginContext context)
+{
+ // load the relevant prefs.
+ XPIDLSettings settings = { kXPIDLSettingsVersion, kXPIDLModeTypelib, false, false };
+ CWResult err = GetSettings(context, settings);
+ if (err != cwNoErr)
+ return err;
+
+ switch (settings.mode) {
+ case kXPIDLModeHeader:
+ return LinkHeaders(context, settings);
+ case kXPIDLModeTypelib:
+ return LinkTypeLib(context, settings);
+ default:
+ return cwNoErr;
+ }
+}
+
+static CWResult Disassemble(CWPluginContext context)
+{
+ CWResult err = noErr;
+
+ // cache the project's output directory.
+ err = CWGetOutputFileDirectory(gPluginContext, &gOutputDirectory);
+ if (!CWSUCCESS(err))
+ return err;
+
+ long fileNum;
+ err = CWGetMainFileNumber(context, &fileNum);
+ if (!CWSUCCESS(err))
+ return err;
+
+ // get the output file's location from the stored object data.
+ err = CWGetStoredObjectFileSpec(context, fileNum, &gObjectCodeDirectory);
+ if (!CWSUCCESS(err))
+ return err;
+
+ char* outputName = p2c_strdup(gObjectCodeDirectory.name);
+ if (outputName == NULL)
+ return cwErrOutOfMemory;
+
+ XPIDLSettings settings = { kXPIDLSettingsVersion, kXPIDLModeTypelib, false, false };
+ GetSettings(context, settings);
+
+ // build an argument list and call xpt_dump.
+ int argc = 1;
+ char* argv[] = { "xpt_dump", NULL, NULL, NULL };
+ if (settings.verbose) argv[argc++] = "-v";
+ argv[argc++] = outputName;
+
+ // trap calls to exit, which longjmp back to here.
+ if (setjmp(exit_jump) == 0) {
+ if (xptdump_main(argc, argv) != 0)
+ err = cwErrRequestFailed;
+ } else {
+ // evidently the good old exit function got called.
+ if (exit_status != 0)
+ err = cwErrRequestFailed;
+ }
+
+ delete[] outputName;
+
+ if (err == noErr) {
+ // display the disassembly in its own fresh text window.
+ CWNewTextDocumentInfo info = {
+ NULL,
+ mac_console_handle,
+ false
+ };
+ CWResizeMemHandle(context, mac_console_handle, mac_console_count);
+ err = CWCreateNewTextDocument(context, &info);
+ }
+
+ return err;
+}
+
+static CWResult GetTargetInfo(CWPluginContext context)
+{
+ CWTargetInfo targ;
+ memset(&targ, 0, sizeof(targ));
+
+ CWResult err = CWGetOutputFileDirectory(context, &targ.outfile);
+ targ.outputType = linkOutputFile;
+ targ.symfile = targ.outfile; /* location of SYM file */
+ targ.linkType = exelinkageFlat;
+ targ.targetCPU = '****';
+ targ.targetOS = '****';
+
+ // load the relevant settings.
+ XPIDLSettings settings = { kXPIDLSettingsVersion, kXPIDLModeTypelib, false, false };
+ err = GetSettings(context, settings);
+ if (err != cwNoErr)
+ return err;
+
+#if CWPLUGIN_HOST == CWPLUGIN_HOST_MACOS
+ // tell the IDE about the output file.
+ targ.outfileCreator = 'MMCH';
+ targ.outfileType = 'CWIE';
+ targ.debuggerCreator = kDebuggerCreator; /* so IDE can locate our debugger */
+
+ BlockMoveData(settings.output, targ.outfile.name, 1 + settings.output[0]);
+ targ.symfile.name[0] = 0;
+#endif
+
+#if CWPLUGIN_HOST == CWPLUGIN_HOST_WIN32
+ targ.debugHelperIsRegKey = true;
+ *(long*)targ.debugHelperName = kDebuggerCreator;
+ targ.debugHelperName[4] = 0;
+ strcat(targ.outfile.path, "\\");
+ strcat(targ.outfile.path, prefsData.outfile);
+ strcpy(targ.symfile.path, targ.outfile.path);
+ strcat(targ.symfile.path, ".SYM");
+#endif
+
+ targ.runfile = targ.outfile;
+ targ.linkAgainstFile = targ.outfile;
+
+ /* we can only run applications */
+ // targ.canRun = (prefsData.projtype == kProjTypeApplication);
+
+ /* we can only debug if we have a SYM file */
+ // targ.canDebug = prefsData.linksym;
+
+ err = CWSetTargetInfo(context, &targ);
+
+ return err;
+}
+
+#if 0
+
+#if CW_USE_PRAGMA_EXPORT
+#pragma export on
+#endif
+
+CWPLUGIN_ENTRY(CWPlugin_GetDropInFlags)(const DropInFlags** flags, long* flagsSize)
+{
+ static const DropInFlags sFlags = {
+ kCurrentDropInFlagsVersion,
+ CWDROPINLINKERTYPE,
+ DROPINCOMPILERLINKERAPIVERSION_7,
+ (linkMultiTargAware | linkAlwaysReload),
+ 0,
+ DROPINCOMPILERLINKERAPIVERSION
+ };
+
+ *flags = &sFlags;
+ *flagsSize = sizeof(sFlags);
+
+ return cwNoErr;
+}
+
+CWPLUGIN_ENTRY(CWPlugin_GetDropInName)(const char** dropinName)
+{
+ static const char* sDropInName = "xpt Linker";
+ *dropinName = sDropInName;
+ return cwNoErr;
+}
+
+CWPLUGIN_ENTRY(CWPlugin_GetDisplayName)(const char** displayName)
+{
+ static const char* sDisplayName = "xpt Linker";
+ *displayName = sDisplayName;
+ return cwNoErr;
+}
+
+CWPLUGIN_ENTRY(CWPlugin_GetPanelList)(const CWPanelList** panelList)
+{
+ // +++Turn this on when the sample panel has been converted!
+ static const char* sPanelName = kXPIDLPanelName;
+ static CWPanelList sPanelList = { kCurrentCWPanelListVersion, 1, &sPanelName };
+
+ *panelList = &sPanelList;
+
+ return cwNoErr;
+}
+
+CWPLUGIN_ENTRY(CWPlugin_GetTargetList)(const CWTargetList** targetList)
+{
+ static CWDataType sCPU = '****';
+ static CWDataType sOS = '****';
+ static CWTargetList sTargetList = { kCurrentCWTargetListVersion, 1, &sCPU, 1, &sOS };
+
+ *targetList = &sTargetList;
+
+ return cwNoErr;
+}
+
+CWPLUGIN_ENTRY(CWPlugin_GetDefaultMappingList)(const CWExtMapList** defaultMappingList)
+{
+ static CWExtensionMapping sExtension = { 'MMCH', ".xpt", 0 };
+ static CWExtMapList sExtensionMapList = { kCurrentCWExtMapListVersion, 1, &sExtension };
+
+ *defaultMappingList = &sExtensionMapList;
+
+ return cwNoErr;
+}
+
+CWPLUGIN_ENTRY (CWPlugin_GetFamilyList)(const CWFamilyList** familyList)
+{
+ static CWFamily sFamily = { 'XIDL', "xpidl Settings" };
+ static CWFamilyList sFamilyList = { kCurrentCWFamilyListVersion, 0, &sFamily };
+
+ *familyList = &sFamilyList;
+
+ return cwNoErr;
+}
+
+#if CW_USE_PRAGMA_EXPORT
+#pragma export off
+#endif
+
+#endif
diff --git a/src/libs/xpcom18a4/xpcom/typelib/xpidl/macplugin/panel.rsrc b/src/libs/xpcom18a4/xpcom/typelib/xpidl/macplugin/panel.rsrc
new file mode 100644
index 00000000..c5777088
--- /dev/null
+++ b/src/libs/xpcom18a4/xpcom/typelib/xpidl/macplugin/panel.rsrc
Binary files differ
diff --git a/src/libs/xpcom18a4/xpcom/typelib/xpidl/macplugin/version.rsrc b/src/libs/xpcom18a4/xpcom/typelib/xpidl/macplugin/version.rsrc
new file mode 100644
index 00000000..6737d356
--- /dev/null
+++ b/src/libs/xpcom18a4/xpcom/typelib/xpidl/macplugin/version.rsrc
Binary files differ