Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Niefer2006-11-22 11:34:14 -0500
committerAndrew Niefer2006-11-22 11:34:14 -0500
commit18b1de36aafdac82e06e79db30eaa7c3210c77b3 (patch)
treeb02fde352a0d9258900f2ba106c587d85900a7b1
parent6827b4fb72f9fbeb64b41a06ae967be4214c1593 (diff)
downloadrt.equinox.framework-18b1de36aafdac82e06e79db30eaa7c3210c77b3.tar.gz
rt.equinox.framework-18b1de36aafdac82e06e79db30eaa7c3210c77b3.tar.xz
rt.equinox.framework-18b1de36aafdac82e06e79db30eaa7c3210c77b3.zip
port to the mac
-rw-r--r--bundles/org.eclipse.equinox.launcher/.cdtproject24
-rw-r--r--bundles/org.eclipse.equinox.launcher/.cvsignore1
-rw-r--r--bundles/org.eclipse.equinox.launcher/library/carbon/.cvsignore1
-rw-r--r--bundles/org.eclipse.equinox.launcher/library/carbon/eclipseCarbon.c512
-rw-r--r--bundles/org.eclipse.equinox.launcher/library/carbon/eclipseCarbonCommon.c125
-rw-r--r--bundles/org.eclipse.equinox.launcher/library/carbon/eclipseCarbonMain.c232
-rw-r--r--bundles/org.eclipse.equinox.launcher/library/carbon/eclipseMain.c (renamed from bundles/org.eclipse.equinox.launcher/library/carbon/eclipse.c)2
-rw-r--r--bundles/org.eclipse.equinox.launcher/library/carbon/make_macosx.mak52
-rw-r--r--bundles/org.eclipse.equinox.launcher/library/eclipse.c16
-rw-r--r--bundles/org.eclipse.equinox.launcher/library/eclipseCommon.h2
-rw-r--r--bundles/org.eclipse.equinox.launcher/library/eclipseJNI.c7
-rw-r--r--bundles/org.eclipse.equinox.launcher/library/eclipseMain.c5
12 files changed, 471 insertions, 508 deletions
diff --git a/bundles/org.eclipse.equinox.launcher/.cdtproject b/bundles/org.eclipse.equinox.launcher/.cdtproject
index 8f09e0faa..66a469dc8 100644
--- a/bundles/org.eclipse.equinox.launcher/.cdtproject
+++ b/bundles/org.eclipse.equinox.launcher/.cdtproject
@@ -58,35 +58,49 @@
</item>
<item id="org.eclipse.cdt.make.core.buildtargets">
<buildTargets>
-<target name="all-mingw" targetID="org.eclipse.cdt.make.MakeTargetBuilder" path="library/win32">
+<target name="all-mingw" path="library/win32" targetID="org.eclipse.cdt.make.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildArguments>-f make_mingw.mak</buildArguments>
<buildTarget>all</buildTarget>
<stopOnError>false</stopOnError>
<useDefaultCommand>false</useDefaultCommand>
</target>
-<target name="clean" targetID="org.eclipse.cdt.make.MakeTargetBuilder" path="library/win32">
+<target name="clean" path="library/win32" targetID="org.eclipse.cdt.make.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildArguments>-f make_mingw.mak</buildArguments>
<buildTarget>clean</buildTarget>
<stopOnError>false</stopOnError>
<useDefaultCommand>false</useDefaultCommand>
</target>
-<target name="linux-all" targetID="org.eclipse.cdt.make.MakeTargetBuilder" path="library/gtk">
+<target name="linux-all" path="library/gtk" targetID="org.eclipse.cdt.make.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildArguments>-f make_linux.mak</buildArguments>
<buildTarget>all</buildTarget>
<stopOnError>false</stopOnError>
<useDefaultCommand>false</useDefaultCommand>
</target>
-<target name="clean" targetID="org.eclipse.cdt.make.MakeTargetBuilder" path="library/gtk">
+<target name="clean" path="library/gtk" targetID="org.eclipse.cdt.make.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildArguments>-f make_linux.mak</buildArguments>
<buildTarget>clean</buildTarget>
<stopOnError>false</stopOnError>
<useDefaultCommand>false</useDefaultCommand>
</target>
-<target name="linux-all" targetID="org.eclipse.cdt.make.MakeTargetBuilder" path="library/motif">
+<target name="all" path="library/carbon" targetID="org.eclipse.cdt.make.MakeTargetBuilder">
+<buildCommand>make</buildCommand>
+<buildArguments>-f make_macosx.mak</buildArguments>
+<buildTarget>all</buildTarget>
+<stopOnError>false</stopOnError>
+<useDefaultCommand>false</useDefaultCommand>
+</target>
+<target name="clean" path="library/carbon" targetID="org.eclipse.cdt.make.MakeTargetBuilder">
+<buildCommand>make</buildCommand>
+<buildArguments>-f make_macosx.mak</buildArguments>
+<buildTarget>clean</buildTarget>
+<stopOnError>false</stopOnError>
+<useDefaultCommand>false</useDefaultCommand>
+</target>
+<target name="linux-all" path="library/motif" targetID="org.eclipse.cdt.make.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildArguments>-f make_linux.mak</buildArguments>
<buildTarget>all</buildTarget>
diff --git a/bundles/org.eclipse.equinox.launcher/.cvsignore b/bundles/org.eclipse.equinox.launcher/.cvsignore
new file mode 100644
index 000000000..78fb1fcef
--- /dev/null
+++ b/bundles/org.eclipse.equinox.launcher/.cvsignore
@@ -0,0 +1 @@
+.gdb_history
diff --git a/bundles/org.eclipse.equinox.launcher/library/carbon/.cvsignore b/bundles/org.eclipse.equinox.launcher/library/carbon/.cvsignore
index 5535df034..f0fdae47c 100644
--- a/bundles/org.eclipse.equinox.launcher/library/carbon/.cvsignore
+++ b/bundles/org.eclipse.equinox.launcher/library/carbon/.cvsignore
@@ -1,2 +1,3 @@
*.o
eclipse
+*.so
diff --git a/bundles/org.eclipse.equinox.launcher/library/carbon/eclipseCarbon.c b/bundles/org.eclipse.equinox.launcher/library/carbon/eclipseCarbon.c
index 2d5afd9f7..bbff5fd9c 100644
--- a/bundles/org.eclipse.equinox.launcher/library/carbon/eclipseCarbon.c
+++ b/bundles/org.eclipse.equinox.launcher/library/carbon/eclipseCarbon.c
@@ -13,17 +13,7 @@
/* MacOS X Carbon specific logic for displaying the splash screen. */
#include "eclipseOS.h"
-
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <fcntl.h>
-#include <ctype.h>
-#include <pwd.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <sys/ioctl.h>
-#include <unistd.h>
+#include "eclipseCommon.h"
#include <CoreServices/CoreServices.h>
#include <Carbon/Carbon.h>
@@ -34,29 +24,16 @@
#include "NgWinBMPFileFormat.h"
#define startupJarName "startup.jar"
-#define APP_PACKAGE_PATTERN ".app/Contents/MacOS/"
-#define APP_PACKAGE "APP_PACKAGE"
-#define JAVAROOT "JAVAROOT"
#define LAUNCHER "-launcher"
#define SPLASH_LAUNCHER "/Resources/Splash.app/Contents/"
#define DEBUG 0
char *findCommand(char *command);
-char* getProgramDir();
-static void debug(const char *fmt, ...);
-static void dumpArgs(char *tag, int argc, char* argv[]);
static PixMapHandle loadBMPImage(const char *image);
-static void init();
-static char *append(char *buffer, const char *s);
-static char *appendc(char *buffer, char c);
-static char *expandShell(char *arg, const char *appPackage, const char *javaRoot);
-static char *my_strcasestr(const char *big, const char *little);
/* Global Variables */
-char dirSeparator = '/';
-char pathSeparator = ':';
char* consoleVM = "java";
char* defaultVM = "java";
char* shippedVMDir = "jre/bin/";
@@ -64,190 +41,18 @@ char* shippedVMDir = "jre/bin/";
/* Define the window system arguments for the various Java VMs. */
static char* argVM_JAVA[] = { "-XstartOnFirstThread", NULL };
-static int fgPid, jvmPid, jvmExitCode = 0;
-static FILE *fgConsoleLog;
-static char *fgAppPackagePath;
+static int jvmPid, jvmExitCode = 0;
-static int mainEclipse = 0;
static WindowRef window;
static ControlRef progress = NULL, pane = NULL;
static RGBColor foreground = {0xFFFF, 0xFFFF, 0xFFFF};
static CFStringRef string = NULL;
static Rect messageRect = {0, 0, 0, 0}, progressRect = {0, 0, 0, 0};
static int value = 0, maximum = 0;
+static int splashHandle = 0;
-extern int original_main(int argc, char* argv[]);
-int main( int argc, char* argv[] ) {
-
- SInt32 systemVersion= 0;
- if (Gestalt(gestaltSystemVersion, &systemVersion) == noErr) {
- systemVersion &= 0xffff;
- if (systemVersion < 0x1020) {
- displayMessage(officialName, "Eclipse requires Jaguar (Mac OS X >= 10.2)");
- return 0;
- }
- }
-
- fgConsoleLog= fopen("/dev/console", "w");
- fgPid= getpid();
-
- dumpArgs("start", argc, argv);
-
- if (argc > 1 && strncmp(argv[1], "-psn_", 5) == 0) {
-
- /* find path to application bundle (ignoring case) */
- char *pos= my_strcasestr(argv[0], APP_PACKAGE_PATTERN);
- if (pos != NULL) {
- int l= pos-argv[0] + 4; // reserve space for ".app"
- fgAppPackagePath= malloc(l+1);
- strncpy(fgAppPackagePath, argv[0], l);
- fgAppPackagePath[l]= '\0'; // terminate result
- }
-
- /* Get the main bundle for the app */
- CFBundleRef mainBundle= CFBundleGetMainBundle();
- if (mainBundle != NULL) {
-
- /* Get an instance of the info plist.*/
- CFDictionaryRef bundleInfoDict= CFBundleGetInfoDictionary(mainBundle);
-
- /* If we succeeded, look for our property. */
- if (bundleInfoDict != NULL) {
- CFArrayRef ar= CFDictionaryGetValue(bundleInfoDict, CFSTR("Eclipse"));
- if (ar) {
- CFIndex size= CFArrayGetCount(ar);
- if (size > 0) {
- int i;
- char **old_argv= argv;
- argv= (char**) calloc(size+2, sizeof(char*));
- argc= 0;
- argv[argc++]= old_argv[0];
- for (i= 0; i < size; i++) {
- CFStringRef sr= (CFStringRef) CFArrayGetValueAtIndex (ar, i);
- CFIndex argStringSize= CFStringGetMaximumSizeForEncoding(CFStringGetLength(sr), kCFStringEncodingUTF8);
- char *s= malloc(argStringSize);
- if (CFStringGetCString(sr, s, argStringSize, kCFStringEncodingUTF8)) {
- argv[argc++]= expandShell(s, fgAppPackagePath, NULL);
- } else {
- fprintf(fgConsoleLog, "can't extract bytes\n");
- }
- //free(s);
- }
- }
- } else {
- fprintf(fgConsoleLog, "no Eclipse dict found\n");
- }
- } else {
- fprintf(fgConsoleLog, "no bundle dict found\n");
- }
- } else {
- fprintf(fgConsoleLog, "no bundle found\n");
- }
- }
- int exitcode= original_main(argc, argv);
- debug("<<<< exit(%d)\n", exitcode);
- fclose(fgConsoleLog);
- return exitcode;
-}
-
-/* Display a Message */
-void displayMessage(char *title, char *message)
-{
- CFStringRef inError, inDescription= NULL;
-
- /* try to break the message into a first sentence and the rest */
- char *pos= strstr(message, ". ");
- if (pos != NULL) {
- char *to, *from, *buffer= calloc(pos-message+2, sizeof(char));
- /* copy and replace line separators with blanks */
- for (to= buffer, from= message; from <= pos; from++, to++) {
- char c= *from;
- if (c == '\n') c= ' ';
- *to= c;
- }
- inError= CFStringCreateWithCString(kCFAllocatorDefault, buffer, kCFStringEncodingASCII);
- free(buffer);
- inDescription= CFStringCreateWithCString(kCFAllocatorDefault, pos+2, kCFStringEncodingASCII);
- } else {
- inError= CFStringCreateWithCString(kCFAllocatorDefault, message, kCFStringEncodingASCII);
- }
-
- init();
-
- DialogRef outAlert;
- OSStatus status= CreateStandardAlert(kAlertStopAlert, inError, inDescription, NULL, &outAlert);
- if (status == noErr) {
- DialogItemIndex outItemHit;
- RunStandardAlert(outAlert, NULL, &outItemHit);
- } else {
- debug("%s: displayMessage: %s\n", title, message);
- }
- CFRelease(inError);
- if (inDescription != NULL)
- CFRelease(inDescription);
-}
-
-static void debug(const char *fmt, ...) {
-#if DEBUG
- va_list ap;
- va_start(ap, fmt);
- fprintf(fgConsoleLog, "%05d: ", fgPid);
- vfprintf(fgConsoleLog, fmt, ap);
- va_end(ap);
-#endif
-}
-
-static void dumpArgs(char *tag, int argc, char* argv[]) {
-#if DEBUG
- int i;
- if (argc < 0) {
- argc= 0;
- for (i= 0; argv[i] != NULL; i++)
- argc++;
- }
- debug(">>>> %s:", tag);
- for (i= 0; i < argc && argv[i] != NULL; i++)
- fprintf(fgConsoleLog, " <%s>", argv[i]);
- fprintf(fgConsoleLog, "\n");
-#endif
-}
-
-static void init() {
- static int initialized= 0;
-
- if (!initialized) {
- ProcessSerialNumber psn;
- if (GetCurrentProcess(&psn) == noErr) {
- if (mainEclipse) {
- TransformProcessType(&psn, kProcessTransformToForegroundApplication);
- }
- SetFrontProcess(&psn);
- }
- ClearMenuBar();
- initialized= true;
- }
-}
-
-/* Initialize Window System
- *
- * Initialize Carbon.
- */
-void initWindowSystem( int* pArgc, char* argv[], int showSplash )
-{
- char *homeDir = getProgramDir();
- debug("install dir: %s\n", homeDir);
- if (homeDir != NULL)
- chdir(homeDir);
-
- mainEclipse = !showSplash;
- if (showSplash)
- init();
-}
-
-static void eventLoopTimerProc(EventLoopTimerRef inTimer, void *inUserData) {
- QuitApplicationEventLoop();
+int main() {
}
-
static void detectExitTimerProc(EventLoopTimerRef inTimer, void *inUserData) {
int exitCode = 0;
if (waitpid(jvmPid, &exitCode, WNOHANG) != 0) {
@@ -268,93 +73,6 @@ static void invalidateWindow () {
DisposeRgn(rgn);
}
-static void readRect(char *str, Rect *rect) {
- int x, y, width, height;
- char *temp = str, *comma;
- comma = strchr(temp, ',');
- if (comma == NULL) return;
- comma[0] = 0;
- x = atoi(temp);
- temp = comma + 1;
- comma = strchr(temp, ',');
- if (comma == NULL) return;
- comma[0] = 0;
- y = atoi(temp);
- temp = comma + 1;
- comma = strchr(temp, ',');
- if (comma == NULL) return;
- comma[0] = 0;
- width = atoi(temp);
- temp = comma + 1;
- height = atoi(temp);
- rect->left = x;
- rect->top = y;
- rect->right = x + width;
- rect->bottom = y + height;
-}
-
-static void readColor(char *str, RGBColor *color) {
- int value = atoi(str);
- color->red = ((value & 0xFF0000) >> 16) * 0xFF;
- color->green = ((value & 0xFF00) >> 8) * 0xFF;
- color->blue = ((value & 0xFF) >> 0) * 0xFF;
-}
-
-static void readInput() {
- int available;
- FILE *fd = stdin;
- char *buffer = NULL, *equals = NULL, *end, *line;
- ioctl(fileno(fd), FIONREAD, &available);
- if (available <= 0) return;
- buffer = malloc(available + 1);
- available = fread(buffer, 1, available, fd);
- buffer[available] = 0;
- line = buffer;
- while (line != NULL) {
- end = strchr(line, '\n');
- equals = strchr(line, '=');
- if (end != NULL) end[0] = 0;
- if (equals != NULL) {
- char *str = (char *)equals + 1;
- equals[0] = 0;
- if (strcmp(line, "maximum") == 0) {
- maximum = atoi(str);
- if (progress) {
- SetControl32BitMaximum (progress, maximum);
- }
- } else if (strcmp(line, "value") == 0) {
- value = atoi(str);
- if (progress) {
- SetControl32BitValue (progress, value);
- }
- } else if (strcmp(line, "progressRect") == 0) {
- readRect(str, &progressRect);
- if (progress) {
- SetControlBounds (progress, &progressRect);
- }
- } else if (strcmp(line, "messageRect") == 0) {
- readRect(str, &messageRect);
- invalidateWindow();
- } else if (strcmp(line, "foreground") == 0) {
- readColor(str, &foreground);
- invalidateWindow();
- } else if (strcmp(line, "message") == 0) {
- if (string != NULL) CFRelease(string);
- string = CFStringCreateWithBytes (kCFAllocatorDefault, (UInt8 *)str, strlen(str), CFStringGetSystemEncoding(), 1);
- invalidateWindow();
- }
-
- }
- if (end != NULL) line = end + 1;
- else line = NULL;
- }
- free(buffer);
-}
-
-static void timerProc(EventLoopTimerRef inTimer, void *inUserData) {
- readInput();
-}
-
static OSStatus drawProc (EventHandlerCallRef eventHandlerCallRef, EventRef eventRef, PixMap * pixmap) {
Rect rect;
int result = CallNextEventHandler(eventHandlerCallRef, eventRef);
@@ -373,7 +91,7 @@ static OSStatus drawProc (EventHandlerCallRef eventHandlerCallRef, EventRef even
*
* Create the splash window, load the bitmap and display the splash window.
*/
-int showSplash( char* timeoutString, char* featureImage )
+int showSplash( const _TCHAR* featureImage )
{
Rect wRect;
int w, h, deviceWidth, deviceHeight;
@@ -381,17 +99,9 @@ int showSplash( char* timeoutString, char* featureImage )
PixMapHandle pixmap;
EventTypeSpec draw = {kEventClassControl, kEventControlDraw};
- debug("featureImage: %s\n", featureImage);
+ /*debug("featureImage: %s\n", featureImage);*/
- init();
-
- /* Determine the splash timeout value (in seconds). */
- if (timeoutString != NULL && strlen(timeoutString) > 0) {
- int timeout;
- if (sscanf(timeoutString, "%d", &timeout) == 1) {
- InstallEventLoopTimer(GetMainEventLoop(), (EventTimerInterval) timeout, 0.0, NewEventLoopTimerUPP(eventLoopTimerProc), NULL, NULL);
- }
- }
+ /*init();*/
pixmap= loadBMPImage(featureImage);
/* If the splash image data could not be loaded, return an error. */
@@ -423,19 +133,34 @@ int showSplash( char* timeoutString, char* featureImage )
CreateProgressBarControl(window, &progressRect, value, 0, maximum, 0, &progress);
EmbedControl(progress, pane);
InstallEventHandler(GetControlEventTarget(pane), (EventHandlerUPP)drawProc, 1, &draw, pm, NULL);
- readInput();
- InstallEventLoopTimer (GetCurrentEventLoop (), 50 / 1000.0, 50 / 1000.0, NewEventLoopTimerUPP(timerProc), NULL, NULL);
+ /*readInput();
+ InstallEventLoopTimer (GetCurrentEventLoop (), 50 / 1000.0, 50 / 1000.0, NewEventLoopTimerUPP(timerProc), NULL, NULL);*/
ShowWindow(window);
- RunApplicationEventLoop();
+ splashHandle = (int)window;
+/* RunApplicationEventLoop();
DisposeWindow(window);
if (string != NULL) CFRelease(string);
string = NULL;
- progress = pane = NULL;
+ progress = pane = NULL;*/
}
return 0;
}
+int getSplashHandle() {
+ return splashHandle;
+}
+
+void dispatchMessages() {
+ EventRef event;
+ EventTargetRef target;
+
+ target = GetEventDispatcherTarget();
+ while( ReceiveNextEvent(0, NULL, kEventDurationNoWait, true, &event) == noErr ) {
+ SendEventToEventTarget(event, target);
+ ReleaseEvent(event);
+ }
+}
/* Get the window system specific VM arguments */
char** getArgVM( char* vm )
@@ -448,101 +173,6 @@ char** getArgVM( char* vm )
return result;
}
-/* Start the Java VM
- *
- * This method is called to start the Java virtual machine and to wait until it
- * terminates. The function returns the exit code from the JVM.
- */
-int startJavaVM( char* args[] )
-{
- unsigned int length = 1024, rc;
- int launcherIndex = 0, exitCode;
- char *launcher = NULL, *oldLauncher = NULL, *newLauncher = NULL, *path = args[0];
-
- /*
- * In order to be able to keep the Java VM in the Dock and restart
- * it, the first value of the list of arguments passed to execv()
- * is changed to point back to the Eclipse launcher program. The Eclipse
- * launcher program is marked as a LSBackgroundOnly app in its Info.plist
- * file and the secondary launcher used to show the splash screen
- * is marked as a LSUIElement app. Since it is not possible to change
- * the Info.plist file dynamically, two application bundles are needed.
- */
- launcher = malloc(length);
- if ((rc = _NSGetExecutablePath(launcher, &length)) == -1) {
- launcher = realloc(launcher, length);
- rc = _NSGetExecutablePath(launcher, &length);
- }
- if (rc == 0) {
- while (args[launcherIndex] != NULL) {
- if (_tcsicmp( args[ launcherIndex++ ], LAUNCHER ) == 0) {
- char *slash;
- slash = strrchr (launcher, '/');
- if (slash) {
- char * temp;
- *slash = '\0';
- temp = strrchr (launcher, '/');
- *slash = '/';
- slash = temp;
- }
- if (slash) {
- struct _stat stats;
- char* buffer;
- buffer = malloc(strlen(launcher) + strlen(SPLASH_LAUNCHER) + 1);
- *slash = '\0';
- buffer[0] = '\0';
- strcat(buffer, launcher);
- strcat(buffer, SPLASH_LAUNCHER);
- strcat(buffer, slash + 1);
- *slash = '/';
- if (stat(buffer, &stats) == 0) {
- oldLauncher = args[launcherIndex];
- newLauncher = buffer;
- args[launcherIndex] = buffer;
- args[0] = launcher;
- } else {
- free(buffer);
- }
- }
- break;
- }
- }
- }
-
- /* Create a child process for the JVM. */
- pid_t pid= fork();
- if (pid == 0) {
-
- dumpArgs("execv", -1, args);
-
- /* Child process ... start the JVM */
- execv(path, args);
-
- /* The JVM would not start ... return error code to parent process. */
- _exit(errno);
- }
-
- if (pid == -1) {
- exitCode = errno;
- } else {
- /* wait for it to terminate processing events */
- jvmPid = pid;
- InstallEventLoopTimer(GetCurrentEventLoop (), 100 / 1000.0, 100 / 1000.0, NewEventLoopTimerUPP(detectExitTimerProc), NULL, NULL);
- RunApplicationEventLoop();
- exitCode = jvmExitCode;
- exitCode = ((exitCode & 0x00ff) == 0 ? (exitCode >> 8) : exitCode);
- }
-
- if (newLauncher != NULL) {
- args[0] = path;
- args[launcherIndex] = oldLauncher;
- free(newLauncher);
- }
- if (launcher != NULL) free(launcher);
-
- return exitCode;
-}
-
/**
* loadBMPImage
* Create a QuickDraw PixMap representing the given BMP file.
@@ -613,92 +243,6 @@ static PixMapHandle loadBMPImage (const char *bmpPathname) {
return pixmap;
}
-/*
- * Expand $APP_PACKAGE, $JAVA_HOME, and does tilde expansion.
-
- A word beginning with an unquoted tilde character (~) is
- subject to tilde expansion. All the characters up to a
- slash (/) or the end of the word are treated as a username
- and are replaced with the user's home directory. If the
- username is missing (as in ~/foobar), the tilde is
- replaced with the value of the HOME variable (the current
- user's home directory).
- */
-static char *expandShell(char *arg, const char *appPackage, const char *javaRoot) {
-
- if (index(arg, '~') == NULL && index(arg, '$') == NULL)
- return arg;
-
- char *buffer= strdup("");
- char c, lastChar= ' ';
- const char *cp= arg;
- while ((c = *cp++) != 0) {
- if (isspace(lastChar) && c == '~') {
- char name[100], *dir= NULL;
- int j= 0;
- for (; (c = *cp) != 0; cp++) {
- if (! isalnum(c))
- break;
- name[j++]= c;
- lastChar= c;
- }
- name[j]= '\0';
- if (j > 0) {
- struct passwd *pw= getpwnam(name);
- if (pw != NULL)
- dir= pw->pw_dir;
- } else {
- dir= getenv("HOME");
- }
- if (dir != NULL)
- buffer= append(buffer, dir);
-
- } else if (c == '$') {
- int l= strlen(APP_PACKAGE);
- if (appPackage != NULL && strncmp(cp, APP_PACKAGE, l) == 0) {
- cp+= l;
- buffer= append(buffer, appPackage);
- } else {
- int l= strlen(JAVAROOT);
- if (javaRoot != NULL && strncmp(cp, JAVAROOT, l) == 0) {
- cp+= l;
- buffer= append(buffer, javaRoot);
- } else {
- buffer= appendc(buffer, c);
- }
- }
- } else
- buffer= appendc(buffer, c);
- lastChar= c;
- }
- return buffer;
+char * findVMLibrary( char* command ) {
+ return "/System/Library/Frameworks/JavaVM.framework/Versions/Current/JavaVM";
}
-
-static char *my_strcasestr(const char *big, const char *little) {
- char *cp, *s, *t;
- for (cp= (char*) big; *cp; cp++) {
- for (s= cp, t= (char*) little; *s && *t; s++, t++)
- if (toupper(*s) != toupper(*t))
- break;
- if (*t == '\0')
- return cp;
- }
- return NULL;
-}
-
-static char *append(char *buffer, const char *s) {
- int bl= strlen(buffer);
- int sl= strlen(s);
- buffer= realloc(buffer, bl+sl+1);
- strcpy(&buffer[bl], s);
- return buffer;
-}
-
-static char *appendc(char *buffer, char c) {
- int bl= strlen(buffer);
- buffer= realloc(buffer, bl+2);
- buffer[bl++]= c;
- buffer[bl]= '\0';
- return buffer;
-}
-
diff --git a/bundles/org.eclipse.equinox.launcher/library/carbon/eclipseCarbonCommon.c b/bundles/org.eclipse.equinox.launcher/library/carbon/eclipseCarbonCommon.c
new file mode 100644
index 000000000..6c04631a8
--- /dev/null
+++ b/bundles/org.eclipse.equinox.launcher/library/carbon/eclipseCarbonCommon.c
@@ -0,0 +1,125 @@
+/*******************************************************************************
+ * Copyright (c) 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ * Andrew Niefer
+ *******************************************************************************/
+
+#include "eclipseCommon.h"
+#include "eclipseOS.h"
+
+#include <locale.h>
+#include <dlfcn.h>
+#include <unistd.h>
+#include <CoreServices/CoreServices.h>
+#include <Carbon/Carbon.h>
+#include <mach-o/dyld.h>
+
+char dirSeparator = '/';
+char pathSeparator = ':';
+
+void initWindowSystem( int* pArgc, _TCHAR* argv[], int showSplash );
+
+int initialized = 0;
+
+static void init() {
+ if (!initialized) {
+ ProcessSerialNumber psn;
+ if (GetCurrentProcess(&psn) == noErr) {
+ TransformProcessType(&psn, kProcessTransformToForegroundApplication);
+ SetFrontProcess(&psn);
+ }
+ ClearMenuBar();
+ initialized= true;
+ }
+}
+
+
+/* Initialize Window System
+ *
+ * Initialize Carbon.
+ */
+void initWindowSystem( int* pArgc, char* argv[], int showSplash )
+{
+ char *homeDir = getProgramDir();
+ /*debug("install dir: %s\n", homeDir);*/
+ if (homeDir != NULL)
+ chdir(homeDir);
+
+ if (showSplash)
+ init();
+}
+
+/* Display a Message */
+void displayMessage(char *title, char *message)
+{
+ CFStringRef inError, inDescription= NULL;
+
+ /* try to break the message into a first sentence and the rest */
+ char *pos= strstr(message, ". ");
+ if (pos != NULL) {
+ char *to, *from, *buffer= calloc(pos-message+2, sizeof(char));
+ /* copy and replace line separators with blanks */
+ for (to= buffer, from= message; from <= pos; from++, to++) {
+ char c= *from;
+ if (c == '\n') c= ' ';
+ *to= c;
+ }
+ inError= CFStringCreateWithCString(kCFAllocatorDefault, buffer, kCFStringEncodingASCII);
+ free(buffer);
+ inDescription= CFStringCreateWithCString(kCFAllocatorDefault, pos+2, kCFStringEncodingASCII);
+ } else {
+ inError= CFStringCreateWithCString(kCFAllocatorDefault, message, kCFStringEncodingASCII);
+ }
+
+ init();
+
+ DialogRef outAlert;
+ OSStatus status= CreateStandardAlert(kAlertStopAlert, inError, inDescription, NULL, &outAlert);
+ if (status == noErr) {
+ DialogItemIndex outItemHit;
+ RunStandardAlert(outAlert, NULL, &outItemHit);
+ } else {
+ /*debug("%s: displayMessage: %s\n", title, message);*/
+ }
+ CFRelease(inError);
+ if (inDescription != NULL)
+ CFRelease(inDescription);
+}
+
+/* Load the specified shared library
+ */
+void * loadLibrary( char * library ){
+ void * result= dlopen(library, RTLD_NOW);
+ if(result == 0)
+ printf("%s\n",dlerror());
+ return result;
+/* NSObjectFileImage *fileImage;
+ NSModule handle;
+ if(NSCreateObjectFileImageFromFile(library, &fileImage) == NSObjectFileImageSuccess) {
+ handle = NSLinkModule(fileImage,filename, NSLINKMODULE_OPTION_RETURN_ON_ERROR | NSLINKMODULE_OPTION_PRIVATE);
+ NSDestroyObjectFileImage(fileImage);
+ }
+
+ return handle;
+*/}
+
+/* Unload the shared library
+ */
+void unloadLibrary( void * handle ){
+ dlclose(handle);
+/* NSUnlinkModule(handle, 0);*/
+}
+
+/* Find the given symbol in the shared library
+ */
+void * findSymbol( void * handle, char * symbol ){
+ return dlsym(handle, symbol);
+ /*NSSymbol sym = NSLookupSymbolInModule(handle, symbol);
+ return NSAddressOfSymbol(sym);*/
+}
diff --git a/bundles/org.eclipse.equinox.launcher/library/carbon/eclipseCarbonMain.c b/bundles/org.eclipse.equinox.launcher/library/carbon/eclipseCarbonMain.c
new file mode 100644
index 000000000..fcea2341b
--- /dev/null
+++ b/bundles/org.eclipse.equinox.launcher/library/carbon/eclipseCarbonMain.c
@@ -0,0 +1,232 @@
+/*
+ * Copyright (c) 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ * Andrew Niefer
+ */
+
+#include "eclipseCommon.h"
+
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <fcntl.h>
+#include <ctype.h>
+#include <pwd.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <sys/ioctl.h>
+#include <unistd.h>
+
+#include <CoreServices/CoreServices.h>
+#include <Carbon/Carbon.h>
+#include <mach-o/dyld.h>
+
+
+#define APP_PACKAGE_PATTERN ".app/Contents/MacOS/"
+#define APP_PACKAGE "APP_PACKAGE"
+#define JAVAROOT "JAVAROOT"
+
+static void debug(const char *fmt, ...);
+static void dumpArgs(char *tag, int argc, char* argv[]);
+static char *append(char *buffer, const char *s);
+static char *appendc(char *buffer, char c);
+static char *expandShell(char *arg, const char *appPackage, const char *javaRoot);
+static char *my_strcasestr(const char *big, const char *little);
+
+static FILE *fgConsoleLog;
+static char *fgAppPackagePath;
+static int fgPid;
+
+extern int original_main(int argc, char* argv[]);
+int main( int argc, char* argv[] ) {
+
+ SInt32 systemVersion= 0;
+ if (Gestalt(gestaltSystemVersion, &systemVersion) == noErr) {
+ systemVersion &= 0xffff;
+ if (systemVersion < 0x1020) {
+ displayMessage(officialName, "Eclipse requires Jaguar (Mac OS X >= 10.2)");
+ return 0;
+ }
+ }
+
+ fgConsoleLog= fopen("/dev/console", "w");
+ fgPid= getpid();
+
+ dumpArgs("start", argc, argv);
+
+ /*if (argc > 1 && strncmp(argv[1], "-psn_", 5) == 0) {*/
+
+ /* find path to application bundle (ignoring case) */
+ char *pos= my_strcasestr(argv[0], APP_PACKAGE_PATTERN);
+ if (pos != NULL) {
+ int l= pos-argv[0] + 4; // reserve space for ".app"
+ fgAppPackagePath= malloc(l+1);
+ strncpy(fgAppPackagePath, argv[0], l);
+ fgAppPackagePath[l]= '\0'; // terminate result
+ }
+
+ /* Get the main bundle for the app */
+ CFBundleRef mainBundle= CFBundleGetMainBundle();
+ if (mainBundle != NULL) {
+
+ /* Get an instance of the info plist.*/
+ CFDictionaryRef bundleInfoDict= CFBundleGetInfoDictionary(mainBundle);
+
+ /* If we succeeded, look for our property. */
+ if (bundleInfoDict != NULL) {
+ CFArrayRef ar= CFDictionaryGetValue(bundleInfoDict, CFSTR("Eclipse"));
+ if (ar) {
+ CFIndex size= CFArrayGetCount(ar);
+ if (size > 0) {
+ int i;
+ char **old_argv= argv;
+ argv= (char**) calloc(size+2, sizeof(char*));
+ argc= 0;
+ argv[argc++]= old_argv[0];
+ for (i= 0; i < size; i++) {
+ CFStringRef sr= (CFStringRef) CFArrayGetValueAtIndex (ar, i);
+ CFIndex argStringSize= CFStringGetMaximumSizeForEncoding(CFStringGetLength(sr), kCFStringEncodingUTF8);
+ char *s= malloc(argStringSize);
+ if (CFStringGetCString(sr, s, argStringSize, kCFStringEncodingUTF8)) {
+ argv[argc++]= expandShell(s, fgAppPackagePath, NULL);
+ } else {
+ fprintf(fgConsoleLog, "can't extract bytes\n");
+ }
+ //free(s);
+ }
+ }
+ } else {
+ fprintf(fgConsoleLog, "no Eclipse dict found\n");
+ }
+ } else {
+ fprintf(fgConsoleLog, "no bundle dict found\n");
+ }
+ } else {
+ fprintf(fgConsoleLog, "no bundle found\n");
+ }
+ /*}*/
+ int exitcode= original_main(argc, argv);
+ debug("<<<< exit(%d)\n", exitcode);
+ fclose(fgConsoleLog);
+ return exitcode;
+}
+
+static void debug(const char *fmt, ...) {
+#if DEBUG
+ va_list ap;
+ va_start(ap, fmt);
+ fprintf(fgConsoleLog, "%05d: ", fgPid);
+ vfprintf(fgConsoleLog, fmt, ap);
+ va_end(ap);
+#endif
+}
+
+static void dumpArgs(char *tag, int argc, char* argv[]) {
+#if DEBUG
+ int i;
+ if (argc < 0) {
+ argc= 0;
+ for (i= 0; argv[i] != NULL; i++)
+ argc++;
+ }
+ debug(">>>> %s:", tag);
+ for (i= 0; i < argc && argv[i] != NULL; i++)
+ fprintf(fgConsoleLog, " <%s>", argv[i]);
+ fprintf(fgConsoleLog, "\n");
+#endif
+}
+
+/*
+ * Expand $APP_PACKAGE, $JAVA_HOME, and does tilde expansion.
+
+ A word beginning with an unquoted tilde character (~) is
+ subject to tilde expansion. All the characters up to a
+ slash (/) or the end of the word are treated as a username
+ and are replaced with the user's home directory. If the
+ username is missing (as in ~/foobar), the tilde is
+ replaced with the value of the HOME variable (the current
+ user's home directory).
+ */
+static char *expandShell(char *arg, const char *appPackage, const char *javaRoot) {
+
+ if (index(arg, '~') == NULL && index(arg, '$') == NULL)
+ return arg;
+
+ char *buffer= strdup("");
+ char c, lastChar= ' ';
+ const char *cp= arg;
+ while ((c = *cp++) != 0) {
+ if (isspace(lastChar) && c == '~') {
+ char name[100], *dir= NULL;
+ int j= 0;
+ for (; (c = *cp) != 0; cp++) {
+ if (! isalnum(c))
+ break;
+ name[j++]= c;
+ lastChar= c;
+ }
+ name[j]= '\0';
+ if (j > 0) {
+ struct passwd *pw= getpwnam(name);
+ if (pw != NULL)
+ dir= pw->pw_dir;
+ } else {
+ dir= getenv("HOME");
+ }
+ if (dir != NULL)
+ buffer= append(buffer, dir);
+
+ } else if (c == '$') {
+ int l= strlen(APP_PACKAGE);
+ if (appPackage != NULL && strncmp(cp, APP_PACKAGE, l) == 0) {
+ cp+= l;
+ buffer= append(buffer, appPackage);
+ } else {
+ int l= strlen(JAVAROOT);
+ if (javaRoot != NULL && strncmp(cp, JAVAROOT, l) == 0) {
+ cp+= l;
+ buffer= append(buffer, javaRoot);
+ } else {
+ buffer= appendc(buffer, c);
+ }
+ }
+ } else
+ buffer= appendc(buffer, c);
+ lastChar= c;
+ }
+ return buffer;
+}
+
+static char *my_strcasestr(const char *big, const char *little) {
+ char *cp, *s, *t;
+ for (cp= (char*) big; *cp; cp++) {
+ for (s= cp, t= (char*) little; *s && *t; s++, t++)
+ if (toupper(*s) != toupper(*t))
+ break;
+ if (*t == '\0')
+ return cp;
+ }
+ return NULL;
+}
+
+static char *append(char *buffer, const char *s) {
+ int bl= strlen(buffer);
+ int sl= strlen(s);
+ buffer= realloc(buffer, bl+sl+1);
+ strcpy(&buffer[bl], s);
+ return buffer;
+}
+
+static char *appendc(char *buffer, char c) {
+ int bl= strlen(buffer);
+ buffer= realloc(buffer, bl+2);
+ buffer[bl++]= c;
+ buffer[bl]= '\0';
+ return buffer;
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.launcher/library/carbon/eclipse.c b/bundles/org.eclipse.equinox.launcher/library/carbon/eclipseMain.c
index 897aeca53..4d5425178 100644
--- a/bundles/org.eclipse.equinox.launcher/library/carbon/eclipse.c
+++ b/bundles/org.eclipse.equinox.launcher/library/carbon/eclipseMain.c
@@ -12,4 +12,4 @@
#define main original_main
-#include "../eclipse.c"
+#include "../eclipseMain.c"
diff --git a/bundles/org.eclipse.equinox.launcher/library/carbon/make_macosx.mak b/bundles/org.eclipse.equinox.launcher/library/carbon/make_macosx.mak
index 529d4b7a5..a1cf1060d 100644
--- a/bundles/org.eclipse.equinox.launcher/library/carbon/make_macosx.mak
+++ b/bundles/org.eclipse.equinox.launcher/library/carbon/make_macosx.mak
@@ -18,33 +18,56 @@
# DEFAULT_OS_ARCH - the default value of the "-arch" switch
# DEFAULT_WS - the default value of the "-ws" switch
+#default value for PROGRAM_OUTPUT
+ifeq ($(PROGRAM_OUTPUT),)
+ PROGRAM_OUTPUT=eclipse
+endif
+ifeq ($(PROGRAM_LIBRARY),)
+ PROGRAM_LIBRARY=$(PROGRAM_OUTPUT)_001.so
+endif
+
# Define the object modules to be compiled and flags.
-OBJS = eclipse.o eclipseUtil.o eclipseShm.o eclipseConfig.o eclipseCarbon.o NgImageData.o NgWinBMPFileFormat.o NgCommon.o
+#OBJS = eclipse.o eclipseUtil.o eclipseShm.o eclipseConfig.o eclipseCarbon.o NgImageData.o NgWinBMPFileFormat.o NgCommon.o
+MAIN_OBJS = eclipseMain.o eclipseCarbonMain.o
+COMMON_OBJS = eclipseConfig.o eclipseCommon.o eclipseCarbonCommon.o
+DLL_OBJS = eclipse.o eclipseCarbon.o eclipseUtil.o eclipseJNI.o NgImageData.o NgWinBMPFileFormat.o NgCommon.o
+
EXEC = $(PROGRAM_OUTPUT)
+DLL = $(PROGRAM_OUTPUT)_001.so
LIBS = -framework Carbon
-ARCHS = -arch i386 -arch ppc
-CFLAGS = -O -s \
+ARCHS = #-arch i386 -arch ppc
+CFLAGS = -g -s \
-Wall \
$(ARCHS) \
+ -DMACOSX \
-DDEFAULT_OS="\"$(DEFAULT_OS)\"" \
-DDEFAULT_OS_ARCH="\"$(DEFAULT_OS_ARCH)\"" \
-DDEFAULT_WS="\"$(DEFAULT_WS)\"" \
- -I.. -I../motif
+ -I.. -I../motif -I/System/Library/Frameworks/JavaVM.framework/Headers
+
+all: $(EXEC) $(DLL)
-all: $(EXEC)
+eclipse.o: ../eclipse.c ../eclipseOS.h ../eclipseCommon.h ../eclipseJNI.h
+ $(CC) $(CFLAGS) -c ../eclipse.c -o $@
-.c.o: ../eclipseOS.h
- $(CC) $(CFLAGS) -c $< -o $@
+eclipseCarbonMain.o : eclipseCarbonMain.c
+ $(CC) $(CFLAGS) -c eclipseCarbonMain.c -o $@
+
+eclipseMain.o: ../eclipseUnicode.h ../eclipseCommon.h eclipseMain.c ../eclipseMain.c
+ $(CC) $(CFLAGS) -c eclipseMain.c -o $@
+
+eclipseJNI.o: ../eclipseJNI.c ../eclipseCommon.h ../eclipseOS.h ../eclipseJNI.h
+ $(CC) $(CFLAGS) -c ../eclipseJNI.c -o $@
eclipseUtil.o: ../eclipseUtil.c ../eclipseUtil.h ../eclipseOS.h
$(CC) $(CFLAGS) -c ../eclipseUtil.c -o $@
-
-eclipseShm.o: ../eclipseShm.c ../eclipseShm.h ../eclipseOS.h
- $(CC) $(CFLAGS) -c ../eclipseShm.c -o $@
eclipseConfig.o: ../eclipseConfig.c ../eclipseConfig.h ../eclipseOS.h
$(CC) $(CFLAGS) -c ../eclipseConfig.c -o $@
+eclipseCommon.o: ../eclipseCommon.h ../eclipseUnicode.h ../eclipseCommon.c
+ $(CC) $(CFLAGS) -c ../eclipseCommon.c -o $@
+
NgCommon.o: ../motif/NgCommon.c
$(CC) $(CFLAGS) -c ../motif/NgCommon.c -o $@
@@ -54,8 +77,11 @@ NgWinBMPFileFormat.o: ../motif/NgWinBMPFileFormat.c
NgImageData.o: ../motif/NgImageData.c
$(CC) $(CFLAGS) -c ../motif/NgImageData.c -o $@
-$(EXEC): $(OBJS)
- $(CC) -o $(EXEC) $(ARCHS) $(OBJS) $(LIBS)
+$(EXEC): $(MAIN_OBJS) $(COMMON_OBJS)
+ $(CC) -o $(EXEC) $(ARCHS) $(MAIN_OBJS) $(COMMON_OBJS) $(LIBS)
+
+$(DLL): $(DLL_OBJS) $(COMMON_OBJS)
+ $(CC) -bundle -o $(DLL) $(ARCHS) $(DLL_OBJS) $(COMMON_OBJS) $(LIBS)
install: all
cp $(EXEC) $(PPC_OUTPUT_DIR)
@@ -63,4 +89,4 @@ install: all
rm -f $(EXEC) $(OBJS)
clean:
- rm -f $(EXEC) $(OBJS)
+ rm -f $(EXEC) $(MAIN_OBJS) $(COMMON_OBJS) $(DLL_OBJS)
diff --git a/bundles/org.eclipse.equinox.launcher/library/eclipse.c b/bundles/org.eclipse.equinox.launcher/library/eclipse.c
index f4a95e15e..9185b628d 100644
--- a/bundles/org.eclipse.equinox.launcher/library/eclipse.c
+++ b/bundles/org.eclipse.equinox.launcher/library/eclipse.c
@@ -820,13 +820,23 @@ static _TCHAR* findStartupJar(){
file = NULL;
}
}
- return file;
+ /* TODO What should the policy here be, if we didn't find what they
+ * specified? (Its harder to specify equinox.startup on the mac.) */
+ if(file != NULL)
+ return file;
}
int pathLength = _tcslen(programDir);
- pluginsPath = malloc( (pathLength + 7 + 1) * sizeof(char));
+#ifdef MACOSX
+ pathLength += 9;
+#endif
+ pluginsPath = malloc( (pathLength + 1 + 7) * sizeof(char));
_tcscpy(pluginsPath, programDir);
- pluginsPath[pathLength] = 0;
+ pluginsPath[pathLength] = dirSeparator;
+ pluginsPath[pathLength + 1] = 0;
+#ifdef MACOSX
+ _tcscat(pluginsPath, _T_ECLIPSE("../../../"));
+#endif
_tcscat(pluginsPath, _T_ECLIPSE("plugins"));
/* equinox startup jar? */
diff --git a/bundles/org.eclipse.equinox.launcher/library/eclipseCommon.h b/bundles/org.eclipse.equinox.launcher/library/eclipseCommon.h
index 4be22d465..ae52302f5 100644
--- a/bundles/org.eclipse.equinox.launcher/library/eclipseCommon.h
+++ b/bundles/org.eclipse.equinox.launcher/library/eclipseCommon.h
@@ -52,6 +52,8 @@ extern _TCHAR* findCommand( _TCHAR* command );
extern _TCHAR* findFile( _TCHAR* path, _TCHAR* prefix);
+extern _TCHAR* getProgramDir();
+
/** Display a Message
*
* This method is called to display an error message to the user before exiting.
diff --git a/bundles/org.eclipse.equinox.launcher/library/eclipseJNI.c b/bundles/org.eclipse.equinox.launcher/library/eclipseJNI.c
index 124af16ad..3cace4cc6 100644
--- a/bundles/org.eclipse.equinox.launcher/library/eclipseJNI.c
+++ b/bundles/org.eclipse.equinox.launcher/library/eclipseJNI.c
@@ -13,7 +13,9 @@
#include "eclipseJNI.h"
#include "eclipseCommon.h"
#include "eclipseOS.h"
+
#include <stdlib.h>
+#include <string.h>
static JNINativeMethod natives[] = {{"_update_splash", "()V", &update_splash},
{"_get_splash_handle", "()I", &get_splash_handle},
@@ -221,6 +223,11 @@ int startJavaVM( _TCHAR* libPath, _TCHAR* vmArgs[], _TCHAR* progArgs[] )
jobjectArray methodArgs = createRunArgs(env, progArgs);
jvmExitCode = (*env)->CallIntMethod(env, mainObject, runMethod, methodArgs);
}
+ } else {
+ if((*env)->ExceptionOccurred(env)){
+ (*env)->ExceptionDescribe(env);
+ (*env)->ExceptionClear(env);
+ }
}
/*(*jvm)->DestroyJavaVM(jvm);*/
}
diff --git a/bundles/org.eclipse.equinox.launcher/library/eclipseMain.c b/bundles/org.eclipse.equinox.launcher/library/eclipseMain.c
index e81f5adf0..ac3d746ef 100644
--- a/bundles/org.eclipse.equinox.launcher/library/eclipseMain.c
+++ b/bundles/org.eclipse.equinox.launcher/library/eclipseMain.c
@@ -16,6 +16,7 @@
#include <stdlib.h>
#include <stdio.h>
+#include <string.h>
#include <locale.h>
#include <sys/stat.h>
@@ -38,7 +39,6 @@ static _TCHAR* library = NULL; /* pathname of the eclipse shared library *
static int createUserArgs(int configArgc, _TCHAR **configArgv, int *argc, _TCHAR ***argv);
static void parseArgs( int* argc, _TCHAR* argv[] );
-static _TCHAR* getProgramDir();
static _TCHAR* getDefaultOfficialName(_TCHAR* program);
static _TCHAR* findLibrary(_TCHAR* program);
@@ -163,7 +163,8 @@ int main( int argc, _TCHAR* argv[] )
}
setArgs = findSymbol(handle, SET_INITIAL_ARGS);
- setArgs(initialArgc, initialArgv);
+ if(setArgs != NULL)
+ setArgs(initialArgc, initialArgv);
runMethod = findSymbol(handle, RUN_METHOD);
exitCode = runMethod(argc, argv, userVMarg);

Back to the top