Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMikael Barbero2015-09-25 15:40:34 +0000
committerArun Thondapu2015-12-21 19:16:27 +0000
commit27d08789a04d0662043439cef7ab154370272692 (patch)
treedf67ad3ccbed2038de9086969fb8745b70f516e7
parent435dd2d09782e46095f4599e32318316a5459ab0 (diff)
downloadrt.equinox.framework-27d08789a04d0662043439cef7ab154370272692.tar.gz
rt.equinox.framework-27d08789a04d0662043439cef7ab154370272692.tar.xz
rt.equinox.framework-27d08789a04d0662043439cef7ab154370272692.zip
Bug 383545 - Remove Carbon specific code from launcher library
Change-Id: I3b1693f1d1344d8539aa989a8eb152a5bd1c6812 Signed-off-by: Mikael Barbero <mikael@eclipse.org>
-rw-r--r--features/org.eclipse.equinox.executable.feature/library/cocoa/eclipseCocoa.c288
-rw-r--r--features/org.eclipse.equinox.executable.feature/library/cocoa/eclipseCocoaCommon.c15
-rw-r--r--features/org.eclipse.equinox.executable.feature/library/cocoa/eclipseCocoaMain.c7
-rw-r--r--features/org.eclipse.equinox.executable.feature/library/eclipse.c288
4 files changed, 141 insertions, 457 deletions
diff --git a/features/org.eclipse.equinox.executable.feature/library/cocoa/eclipseCocoa.c b/features/org.eclipse.equinox.executable.feature/library/cocoa/eclipseCocoa.c
index 244e2b385..1090d550e 100644
--- a/features/org.eclipse.equinox.executable.feature/library/cocoa/eclipseCocoa.c
+++ b/features/org.eclipse.equinox.executable.feature/library/cocoa/eclipseCocoa.c
@@ -51,9 +51,6 @@ static char * findLib(char * command);
#ifdef i386
#define JAVA_ARCH "i386"
#define JAVA_HOME_ARCH "i386"
-#elif defined(__ppc__) || defined(__powerpc64__)
-#define JAVA_ARCH "ppc"
-#define JAVA_HOME_ARCH "ppc"
#elif defined(__amd64__) || defined(__x86_64__)
#define JAVA_ARCH "amd64"
#define JAVA_HOME_ARCH "x86_64"
@@ -83,7 +80,6 @@ static const char* jvmLibs[] = { "libjvm.dylib", "libjvm.jnilib", "libjvm.so", N
/* Define the window system arguments for the various Java VMs. */
static char* argVM_JAVA[] = { "-XstartOnFirstThread", NULL };
-#ifdef COCOA
static NSWindow* window = nil;
@interface KeyWindow : NSWindow { }
- (BOOL)canBecomeKeyWindow;
@@ -251,15 +247,6 @@ static NSWindow* window = nil;
}
}
@end
-#endif
-
-#ifndef COCOA
-static CFMutableArrayRef files;
-static EventHandlerRef appHandler;
-static int SWT_CLASS = 'SWT-';
-static int SWT_OPEN_FILE_KIND = 1;
-static int SWT_OPEN_FILE_PARAM = 'odoc';
-#endif
int main() {
return -1;
@@ -272,8 +259,6 @@ int reuseWorkbench(_TCHAR** filePath, int timeout) {
return 0;
}
-#ifdef COCOA
-
/* Show the Splash Window
*
* Create the splash window, load the bitmap and display the splash window.
@@ -312,211 +297,7 @@ void dispatchMessages() {
[pool release];
}
-#else
-static WindowRef window;
-static ControlRef pane = NULL;
-static CGImageRef image = NULL;
-static CGImageRef loadBMPImage(const char *image);
-
-typedef CGImageSourceRef (*CGImageSourceCreateWithURL_FUNC) (CFURLRef, CFDictionaryRef);
-typedef CGImageRef (*CGImageSourceCreateImageAtIndex_FUNC)(CGImageSourceRef, size_t, CFDictionaryRef);
-static CGImageSourceCreateWithURL_FUNC createWithURL = NULL;
-static CGImageSourceCreateImageAtIndex_FUNC createAtIndex = NULL;
-
-static pascal OSErr openDocumentsProc(const AppleEvent *theAppleEvent, AppleEvent *reply, long handlerRefcon);
-
-static OSStatus drawProc (EventHandlerCallRef eventHandlerCallRef, EventRef eventRef, void * data) {
- int result = CallNextEventHandler(eventHandlerCallRef, eventRef);
- if (image) {
- ControlRef control;
- CGContextRef context;
-
- GetEventParameter(eventRef, kEventParamDirectObject, typeControlRef, NULL, 4, NULL, &control);
- GetEventParameter(eventRef, kEventParamCGContextRef, typeCGContextRef, NULL, 4, NULL, &context);
-
- HIRect rect;
- HIViewGetBounds(control, &rect);
- HIViewDrawCGImage(context, &rect, image);
- }
- return result;
-}
-
-static OSStatus disposeProc (EventHandlerCallRef eventHandlerCallRef, EventRef eventRef, void * data) {
- window = NULL;
- return eventNotHandledErr;
-}
-
-void loadImageFns()
-{
- static int initialized = 0;
- static CFBundleRef bundle = NULL;
-
- if (!initialized) {
- if (!bundle) bundle = CFBundleGetBundleWithIdentifier(CFSTR("com.apple.Carbon"));
- if (bundle) createAtIndex = (CGImageSourceCreateImageAtIndex_FUNC)CFBundleGetFunctionPointerForName(bundle, CFSTR("CGImageSourceCreateImageAtIndex"));
- if (bundle) createWithURL = (CGImageSourceCreateWithURL_FUNC)CFBundleGetFunctionPointerForName(bundle, CFSTR("CGImageSourceCreateWithURL"));
- initialized = 1;
- }
-}
-
-static OSStatus appleEventProc(EventHandlerCallRef inCaller, EventRef theEvent, void* inRefcon) {
- EventRecord eventRecord;
- Boolean release = false;
- EventQueueRef queue;
-
- queue = GetCurrentEventQueue();
- if (IsEventInQueue (queue, theEvent)) {
- RetainEvent (theEvent);
- release = true;
- RemoveEventFromQueue (queue, theEvent);
- }
- ConvertEventRefToEventRecord (theEvent, &eventRecord);
- AEProcessAppleEvent (&eventRecord);
- if (release) ReleaseEvent (theEvent);
- return noErr;
-}
-
-static void timerProc(EventLoopTimerRef timer, void *userData) {
- EventTargetRef target = GetApplicationEventTarget();
- CFIndex count = CFArrayGetCount (files);
- int i;
- for (i=0; i<count; i++) {
- CFStringRef file = (CFStringRef) CFArrayGetValueAtIndex(files, i);
- EventRef event = NULL;
- CreateEvent (NULL, SWT_CLASS, SWT_OPEN_FILE_KIND, 0, kEventAttributeNone, &event);
- SetEventParameter (event, SWT_OPEN_FILE_PARAM, typeCFStringRef, sizeof(file), &file);
- OSStatus status = SendEventToEventTarget(event, target);
- ReleaseEvent(event);
- if (status == eventNotHandledErr) return;
- }
- CFRelease(files);
- RemoveEventLoopTimer(timer);
- RemoveEventHandler(appHandler);
- AERemoveEventHandler(kCoreEventClass, kAEOpenDocuments, NewAEEventHandlerUPP(openDocumentsProc), false);
-}
-
-static pascal OSErr openDocumentsProc(const AppleEvent *theAppleEvent, AppleEvent *reply, long handlerRefcon) {
- AEDescList docList;
- FSRef theFSRef;
- long index;
- long count = 0;
-
- AEGetParamDesc(theAppleEvent, keyDirectObject, typeAEList, &docList);
- AECountItems(&docList, &count);
- for(index = 1; index <= count; index++) {
- AEGetNthPtr(&docList, index, typeFSRef, NULL, NULL, &theFSRef, sizeof(FSRef), NULL);
- CFURLRef url = CFURLCreateFromFSRef(kCFAllocatorDefault, &theFSRef);
- CFStringRef pathName = CFURLCopyFileSystemPath(url, kCFURLPOSIXPathStyle);
- if (!files) {
- files = CFArrayCreateMutable(kCFAllocatorDefault, count, &kCFTypeArrayCallBacks);
- InstallEventLoopTimer(GetMainEventLoop(), 1, 1, NewEventLoopTimerUPP(timerProc), NULL, NULL);
- }
- CFArrayAppendValue(files, pathName);
- CFRelease(pathName);
- CFRelease(url);
- }
- AEDisposeDesc(&docList);
- return noErr;
-}
-
-/* Show the Splash Window
- *
- * Create the splash window, load the bitmap and display the splash window.
- */
-int showSplash( const _TCHAR* featureImage )
-{
- Rect wRect;
- int w, h, deviceWidth, deviceHeight;
- int attributes;
- EventTypeSpec draw = {kEventClassControl, kEventControlDraw};
- EventTypeSpec dispose = {kEventClassWindow, kEventWindowDispose};
- ControlRef root;
-
- if(window != NULL)
- return 0; /*already showing */
- if (featureImage == NULL)
- return ENOENT;
-
- loadImageFns();
- if (createWithURL && createAtIndex) {
- CFStringRef imageString = CFStringCreateWithCString(kCFAllocatorDefault, featureImage, kCFStringEncodingUTF8);
- if(imageString != NULL) {
- CFURLRef url = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, imageString, kCFURLPOSIXPathStyle, false);
- if(url != NULL) {
- CGImageSourceRef imageSource = createWithURL(url, NULL);
- if(imageSource != NULL) {
- image = createAtIndex(imageSource, 0, NULL);
- }
- CFRelease(url);
- }
- }
- CFRelease(imageString);
- } else {
- image = loadBMPImage(featureImage);
- }
-
- /*If the splash image data could not be loaded, return an error.*/
- if (image == NULL)
- return ENOENT;
-
- w = CGImageGetWidth(image);
- h = CGImageGetHeight(image);
-
- GetAvailableWindowPositioningBounds(GetMainDevice(), &wRect);
-
- deviceWidth= wRect.right - wRect.left;
- deviceHeight= wRect.bottom - wRect.top;
-
- wRect.left+= (deviceWidth-w)/2;
- wRect.top+= (deviceHeight-h)/3;
- wRect.right= wRect.left + w;
- wRect.bottom= wRect.top + h;
-
- attributes = kWindowStandardHandlerAttribute | kWindowCompositingAttribute;
- attributes &= GetAvailableWindowAttributes(kSheetWindowClass);
- CreateNewWindow(kSheetWindowClass, attributes, &wRect, &window);
- if (window != NULL) {
- GetRootControl(window, &root);
- wRect.left = wRect.top = 0;
- wRect.right = w;
- wRect.bottom = h;
- CreateUserPaneControl(window, &wRect, kControlSupportsEmbedding | kControlSupportsFocus | kControlGetsFocusOnClick, &pane);
- HIViewAddSubview(root, pane);
-
- InstallEventHandler(GetControlEventTarget(pane), (EventHandlerUPP)drawProc, 1, &draw, NULL, NULL);
- InstallEventHandler(GetWindowEventTarget(window), (EventHandlerUPP)disposeProc, 1, &dispose, NULL, NULL);
- ShowWindow(window);
- dispatchMessages();
- }
-
- return 0;
-}
-
-void takeDownSplash() {
- if( window != 0) {
- DisposeWindow(window);
- window = NULL;
- }
- if(image){
- CGImageRelease(image);
- image = NULL;
- }
-}
-
-void dispatchMessages() {
- EventRef event;
- EventTargetRef target;
-
- target = GetEventDispatcherTarget();
- while( ReceiveNextEvent(0, NULL, kEventDurationNoWait, true, &event) == noErr ) {
- SendEventToEventTarget(event, target);
- ReleaseEvent(event);
- }
-}
-#endif
-
void installAppleEventHandler() {
-#ifdef COCOA
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
AppleEventDelegate *appleEventDelegate = [[AppleEventDelegate alloc] init];
[NSApplication sharedApplication];
@@ -531,11 +312,6 @@ void installAppleEventHandler() {
andEventID:kAEGetURL];
// [appleEventDelegate release];
[pool release];
-#else
- EventTypeSpec kEvents[] = { {kEventClassAppleEvent, kEventAppleEvent} };
- InstallApplicationEventHandler(NewEventHandlerUPP(appleEventProc), GetEventTypeCount(kEvents), kEvents, 0, &appHandler);
- AEInstallEventHandler(kCoreEventClass, kAEOpenDocuments, NewAEEventHandlerUPP(openDocumentsProc), 0, false);
-#endif
}
jlong getSplashHandle() {
@@ -797,70 +573,6 @@ JavaResults* startJavaVM( _TCHAR* libPath, _TCHAR* vmArgs[], _TCHAR* progArgs[],
return startJavaJNI(libPath, vmArgs, progArgs, jarFile);
}
-#ifndef COCOA
-void disposeData(void *info, void *data, size_t size)
-{
- DisposePtr(data);
-}
-
-/**
- * loadBMPImage
- * Create a QuickDraw PixMap representing the given BMP file.
- *
- * bmpPathname: absolute path and name to the bmp file
- *
- * returned value: the PixMapHandle newly created if successful. 0 otherwise.
- */
-static CGImageRef loadBMPImage (const char *bmpPathname) {
- ng_stream_t in;
- ng_bitmap_image_t image;
- ng_err_t err= ERR_OK;
- CGImageRef ref;
- UBYTE1* data = NULL;
-
- NgInit();
-
- if (NgStreamInit(&in, (char*) bmpPathname) != ERR_OK) {
- NgError(ERR_NG, "Error can't open BMP file");
- return 0;
- }
-
- NgBitmapImageInit(&image);
- err= NgBmpDecoderReadImage (&in, &image);
- NgStreamClose(&in);
-
- if (err != ERR_OK) {
- NgBitmapImageFree(&image);
- return 0;
- }
-
- UBYTE4 srcDepth= NgBitmapImageBitCount(&image);
- if (srcDepth != 24) { /* We only support image depth of 24 bits */
- NgBitmapImageFree(&image);
- NgError (ERR_NG, "Error unsupported depth - only support 24 bit");
- return 0;
- }
-
- int width= (int)NgBitmapImageWidth(&image);
- int height= (int)NgBitmapImageHeight(&image);
- int rowBytes= width * 4;
- int alphainfo = kCGImageAlphaNoneSkipFirst | (NgIsMSB() ? 0 : kCGBitmapByteOrder32Little);
- data = (UBYTE1*)NewPtr(rowBytes * height);
- CGDataProviderRef provider = CGDataProviderCreateWithData(0, data, rowBytes * height, (CGDataProviderReleaseDataCallback)disposeData);
-
- ref = CGImageCreate(width, height, 8, 32, width * 4, CGColorSpaceCreateDeviceRGB(), alphainfo, provider, NULL, 1, 0);
- CGDataProviderRelease(provider);
-
- /* 24 bit source to direct screen destination */
- NgBitmapImageBlitDirectToDirect(NgBitmapImageImageData(&image), NgBitmapImageBytesPerRow(&image), width, height,
- data, 32, rowBytes, NgIsMSB(), 0xff0000, 0x00ff00, 0x0000ff);
-
- NgBitmapImageFree(&image);
-
- return ref;
-}
-#endif
-
#define DOCK_ICON_PREFIX "-Xdock:icon="
#define DOCK_NAME_PREFIX "-Xdock:name="
#define APP_ICON_PATTERN "APP_ICON_%d"
diff --git a/features/org.eclipse.equinox.executable.feature/library/cocoa/eclipseCocoaCommon.c b/features/org.eclipse.equinox.executable.feature/library/cocoa/eclipseCocoaCommon.c
index 130c225e0..1794dc44b 100644
--- a/features/org.eclipse.equinox.executable.feature/library/cocoa/eclipseCocoaCommon.c
+++ b/features/org.eclipse.equinox.executable.feature/library/cocoa/eclipseCocoaCommon.c
@@ -35,11 +35,7 @@ static void init() {
TransformProcessType(&psn, kProcessTransformToForegroundApplication);
SetFrontProcess(&psn);
}
-#ifdef COCOA
[NSApplication sharedApplication];
-#else
- ClearMenuBar();
-#endif
initialized= true;
}
}
@@ -86,23 +82,12 @@ void displayMessage(char *title, char *message)
init();
-#ifdef COCOA
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
NSAlert* alert = [NSAlert alertWithMessageText: (NSString*)(inDescription != nil ? inError : nil) defaultButton: nil alternateButton: nil otherButton: nil informativeTextWithFormat: (NSString*)(inDescription != nil ? inDescription : inError)];
[[alert window] setTitle: [NSString stringWithUTF8String: title]];
[alert setAlertStyle: NSCriticalAlertStyle];
[alert runModal];
[pool release];
-#else
- 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);*/
- }
-#endif
CFRelease(inError);
if (inDescription != NULL)
CFRelease(inDescription);
diff --git a/features/org.eclipse.equinox.executable.feature/library/cocoa/eclipseCocoaMain.c b/features/org.eclipse.equinox.executable.feature/library/cocoa/eclipseCocoaMain.c
index 62b93fed5..dd2b2db07 100644
--- a/features/org.eclipse.equinox.executable.feature/library/cocoa/eclipseCocoaMain.c
+++ b/features/org.eclipse.equinox.executable.feature/library/cocoa/eclipseCocoaMain.c
@@ -49,17 +49,10 @@ int main( int argc, char* argv[] ) {
SInt32 systemVersion= 0;
if (Gestalt(gestaltSystemVersion, &systemVersion) == noErr) {
systemVersion &= 0xffff;
-#ifdef COCOA
if (systemVersion < 0x1050) {
displayMessage("Error", "This application requires Mac OS X 10.5 (Leopard) or greater.");
return 0;
}
-#else
- if (systemVersion < 0x1020) {
- displayMessage("Error", "This application requires Jaguar (Mac OS X >= 10.2)");
- return 0;
- }
-#endif
}
fgConsoleLog= fopen("/dev/console", "w");
diff --git a/features/org.eclipse.equinox.executable.feature/library/eclipse.c b/features/org.eclipse.equinox.executable.feature/library/eclipse.c
index 444c89b88..8356ecd30 100644
--- a/features/org.eclipse.equinox.executable.feature/library/eclipse.c
+++ b/features/org.eclipse.equinox.executable.feature/library/eclipse.c
@@ -2,9 +2,9 @@
* Copyright (c) 2000, 2015 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
+ * which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* IBM Corporation - initial API and implementation
* Kevin Cornell (Rational Software Corporation)
@@ -19,27 +19,27 @@
* to start a Java VM, or alternatively it is loaded from Java to show the splash
* screen or write to the shared memory. See eclipseJNI.c for descriptions of the methods
* exposed to the Java program using JNI.
- *
- * To display a splash screen before starting the java vm, the launcher should be started
+ *
+ * To display a splash screen before starting the java vm, the launcher should be started
* with the location of the splash bitmap to use:
* -showsplash <path/to/splash.bmp>
* Otherwise, when the Java program starts, it should determine the location of
- * the splash bitmap to be used and use the JNI method show_splash.
- *
+ * the splash bitmap to be used and use the JNI method show_splash.
+ *
* When the Java program initialization is complete, the splash window
* is brought down by calling the JNI method takedown_splash.
*
- * The Java program can also call the get_splash_handle method to get the handle to the splash
+ * The Java program can also call the get_splash_handle method to get the handle to the splash
* window. This can be passed to SWT to create SWT widgets in the splash screen.
- *
+ *
* The Java application will receive two other arguments:
* -exitdata <shared memory id>
*
* The java program can call set_exit_data with this shared-memory-id
- * to provide specific exit data to the launcher.
+ * to provide specific exit data to the launcher.
*
* The exit data size must not exceed MAX_SHARED_LENGTH which is
- * 16Kb. The interpretation of the exit data is dependent on the
+ * 16Kb. The interpretation of the exit data is dependent on the
* exit value of the java application.
*
* The main launcher recognizes the following exit codes from the
@@ -83,12 +83,12 @@
* -library the location of the eclipse launcher shared library (this library) to use
* By default, the launcher exe (see eclipseMain.c) finds
* <userArgs> arguments that are passed along to the Java application
- * (i.e, -data <path>, -debug, -console, -consoleLog, etc)
+ * (i.e, -data <path>, -debug, -console, -consoleLog, etc)
* -vmargs <userVMargs> ... a list of arguments for the VM itself
*
* The -vmargs option and all user specified VM arguments must appear
* at the end of the command line, after all arguments that are
- * being passed to Java application.
+ * being passed to Java application.
*
* The argument order for the new Java VM process is as follows:
*
@@ -111,9 +111,9 @@
* [<defaultVMargs | <userVMargs>]
* -jar
* <startup jar full path>
- *
+ *
* The startup jar must be an executable jar.
- *
+ *
*
* See "Main.java" for a simple implementation of the Java
* application.
@@ -156,13 +156,7 @@
#endif
#ifdef MACOSX
-
-#ifdef COCOA
#include <Cocoa/Cocoa.h>
-#else
-#include <Carbon/Carbon.h>
-#endif
-
#endif
#include <stdio.h>
@@ -190,7 +184,7 @@ _TCHAR* exitData = NULL; /* exit data set from Java */
int initialArgc;
_TCHAR** initialArgv = NULL;
-
+
/* Define the special exit codes returned from Eclipse. */
#define RESTART_LAST_EC 23
#define RESTART_NEW_EC 24
@@ -276,16 +270,16 @@ static int noSplash = 0; /* True: do not show splash win */
static int suppressErrors = 0; /* True: do not display errors dialogs */
int secondThread = 0; /* True: start the VM on a second thread */
static int appendVmargs = 0; /* True: append cmdline vmargs to launcher.ini vmargs */
-
+
static _TCHAR* showSplashArg = NULL; /* showsplash data (main launcher window) */
static _TCHAR* splashBitmap = NULL; /* the actual splash bitmap */
static _TCHAR * startupArg = NULL; /* path of the startup.jar the user wants to run relative to the program path */
static _TCHAR* vmName = NULL; /* Java VM that the user wants to run */
-static _TCHAR* name = NULL; /* program name */
+static _TCHAR* name = NULL; /* program name */
static _TCHAR* permGen = NULL; /* perm gen size for sun */
static _TCHAR** filePath = NULL; /* list of files to open */
static _TCHAR* timeoutString = NULL; /* timeout value for opening a file */
-static _TCHAR* defaultAction = NULL; /* default action for non '-' command line arguments */
+static _TCHAR* defaultAction = NULL; /* default action for non '-' command line arguments */
static _TCHAR* iniFile = NULL; /* the launcher.ini file set if --launcher.ini was specified */
static _TCHAR* gtkVersionString = NULL; /* GTK+ version specified by --launcher.GTK_version */
static _TCHAR* protectMode = NULL; /* Process protectMode specified via -protect, to trigger the reading of eclipse.ini in the configuration (Mac specific currently) */
@@ -353,7 +347,7 @@ static int eeOptionsSize = (sizeof(eeOptions) / sizeof(eeOptions[0]));
/* Define the required VM arguments (all platforms). */
static _TCHAR* cp = NULL;
-static _TCHAR* cpValue = NULL;
+static _TCHAR* cpValue = NULL;
static _TCHAR** reqVMarg[] = { &cp, &cpValue, NULL }; /* required VM args */
static _TCHAR** userVMarg = NULL; /* user specific args for the Java VM */
static _TCHAR** eeVMarg = NULL; /* vm args specified in ee file */
@@ -423,9 +417,9 @@ JNIEXPORT int run(int argc, _TCHAR* argv[], _TCHAR* vmArgs[])
#ifdef MACOSX
if (secondThread != 0) {
-
- /* --launcher.secondThread was specified, create a new thread and run the
- * vm on it. This main thread will run the CFRunLoop
+
+ /* --launcher.secondThread was specified, create a new thread and run the
+ * vm on it. This main thread will run the CFRunLoop
*/
pthread_t thread;
struct rlimit limit = {0, 0};
@@ -435,7 +429,7 @@ JNIEXPORT int run(int argc, _TCHAR* argv[], _TCHAR* vmArgs[])
stackSize = limit.rlim_cur;
}
}
-
+
/* initialize thread attributes */
pthread_attr_t attributes;
pthread_attr_init(&attributes);
@@ -443,21 +437,21 @@ JNIEXPORT int run(int argc, _TCHAR* argv[], _TCHAR* vmArgs[])
pthread_attr_setdetachstate(&attributes, PTHREAD_CREATE_DETACHED);
if (stackSize != 0)
pthread_attr_setstacksize(&attributes, stackSize);
-
+
/* arguments to start the vm */
StartVMArgs args;
args.argc = argc;
args.argv = argv;
args.vmArgs = vmArgs;
args.result = 0;
-
+
/* create the thread */
pthread_create( &thread, &attributes, &startThread, &args);
pthread_attr_destroy(&attributes);
-
+
CFRunLoopSourceContext sourceContext = {
.version = 0, .info = NULL, .retain = NULL, .release = NULL,
- .copyDescription = NULL, .equal = NULL, .hash = NULL,
+ .copyDescription = NULL, .equal = NULL, .hash = NULL,
.schedule = NULL, .cancel = NULL, .perform = &dummyCallback
};
CFRunLoopSourceRef sourceRef = CFRunLoopSourceCreate(NULL, 0, &sourceContext);
@@ -465,10 +459,10 @@ JNIEXPORT int run(int argc, _TCHAR* argv[], _TCHAR* vmArgs[])
CFRunLoopAddSource(loopRef, sourceRef, kCFRunLoopCommonModes);
CFRunLoopRun();
CFRelease(sourceRef);
-
+
return args.result;
}
-
+
char firstThreadEnvVariable[80];
sprintf(firstThreadEnvVariable, "JAVA_STARTED_ON_FIRST_THREAD_%d", getpid());
setenv(firstThreadEnvVariable, "1", 1);
@@ -500,13 +494,13 @@ static int _run(int argc, _TCHAR* argv[], _TCHAR* vmArgs[])
JavaResults* javaResults = NULL;
int launchMode;
int running = 1;
-
+
/* arg[0] should be the full pathname of this program. */
program = _tcsdup( argv[0] );
/* Initialize official program name */
officialName = name != NULL ? _tcsdup( name ) : getDefaultOfficialName();
-
+
if (defaultAction != NULL) {
processDefaultAction(initialArgc, initialArgv);
}
@@ -542,18 +536,18 @@ static int _run(int argc, _TCHAR* argv[], _TCHAR* vmArgs[])
#ifdef MACOSX
/* Most platforms, we will initialize the window system later before trying to do any
- * graphics. On Mac, we need it initialized to get the dock icon properly, so always do
+ * graphics. On Mac, we need it initialized to get the dock icon properly, so always do
* it now.
*/
initWindowSystem( &argc, argv, !noSplash );
#elif _WIN32
/* this must be before doing any console stuff, platforms other than win32 leave this set to 0 */
consoleLauncher = isConsoleLauncher();
-
+
/*fix the DLL search path for security */
fixDLLSearchPath();
#endif
-
+
/* Find the directory where the Eclipse program is installed. */
programDir = getProgramDir();
if (programDir == NULL)
@@ -563,7 +557,7 @@ static int _run(int argc, _TCHAR* argv[], _TCHAR* vmArgs[])
if (!suppressErrors)
displayMessage( officialName, errorMsg );
else
- _ftprintf(stderr, _T_ECLIPSE("%s:\n%s\n"), officialName, errorMsg);
+ _ftprintf(stderr, _T_ECLIPSE("%s:\n%s\n"), officialName, errorMsg);
free( errorMsg );
exit( 1 );
}
@@ -582,8 +576,8 @@ static int _run(int argc, _TCHAR* argv[], _TCHAR* vmArgs[])
free( errorMsg );
free( msg );
exit(1);
- }
-
+ }
+
/* Find the startup.jar */
jarFile = findStartupJar();
if(jarFile == NULL) {
@@ -611,17 +605,17 @@ static int _run(int argc, _TCHAR* argv[], _TCHAR* vmArgs[])
showSplash(splashBitmap);
}
}
-
+
/* not using JNI launching, need some shared data */
if (launchMode == LAUNCH_EXE && createSharedData( &sharedID, MAX_SHARED_LENGTH )) {
if (debug) {
- if (!suppressErrors)
+ if (!suppressErrors)
displayMessage( officialName, shareMsg );
else
_ftprintf(stderr, _T_ECLIPSE("%s:\n%s\n"), officialName, shareMsg);
}
}
-
+
#ifndef _WIN32
#ifndef MACOSX
displayMessage( officialName, gtkCheck );
@@ -639,15 +633,15 @@ static int _run(int argc, _TCHAR* argv[], _TCHAR* vmArgs[])
cpValue = malloc((_tcslen(jarFile) + 1) * sizeof(_TCHAR));
_tcscpy(cpValue, jarFile);
}
-
+
/* Get the command to start the Java VM. */
userVMarg = vmArgs;
getVMCommand( launchMode, argc, argv, &vmCommandArgs, &progCommandArgs );
-
+
if (launchMode == LAUNCH_EXE) {
vmCommand = buildLaunchCommand(javaVM, vmCommandArgs, progCommandArgs);
}
-
+
/* While the Java VM should be restarted */
while(running)
{
@@ -659,7 +653,7 @@ static int _run(int argc, _TCHAR* argv[], _TCHAR* vmArgs[])
} else {
javaResults = launchJavaVM(vmCommand);
}
-
+
if (javaResults == NULL) {
/* shouldn't happen, but just in case */
javaResults = malloc(sizeof(JavaResults));
@@ -667,7 +661,7 @@ static int _run(int argc, _TCHAR* argv[], _TCHAR* vmArgs[])
javaResults->runResult = 0;
javaResults->errorMessage = _tcsdup(javaFailureMsg);
}
-
+
switch( javaResults->launchResult + javaResults->runResult ) {
case 0: /* normal exit */
running = 0;
@@ -682,7 +676,7 @@ static int _run(int argc, _TCHAR* argv[], _TCHAR* vmArgs[])
running = 0;
}
break;
-
+
case RESTART_NEW_EC:
if(launchMode == LAUNCH_EXE) {
if (exitData != NULL) free(exitData);
@@ -699,7 +693,7 @@ static int _run(int argc, _TCHAR* argv[], _TCHAR* vmArgs[])
} else {
running = 0;
if (debug) {
- if (!suppressErrors)
+ if (!suppressErrors)
displayMessage( officialName, shareMsg );
else
_ftprintf(stderr, _T_ECLIPSE("%s:\n%s\n"), officialName, shareMsg);
@@ -734,7 +728,7 @@ static int _run(int argc, _TCHAR* argv[], _TCHAR* vmArgs[])
}
} else {
if (debug) {
- if (!suppressErrors)
+ if (!suppressErrors)
displayMessage( title, shareMsg );
else
_ftprintf(stderr, _T_ECLIPSE("%s:\n%s\n"), title, shareMsg);
@@ -754,11 +748,11 @@ static int _run(int argc, _TCHAR* argv[], _TCHAR* vmArgs[])
_stprintf( errorMsg, exitMsg, javaResults->launchResult, msg );
}
}
-
+
if (_tcslen(errorMsg) > 0) {
if (!suppressErrors)
displayMessage( title, errorMsg );
- else
+ else
_ftprintf(stderr, _T_ECLIPSE("%s:\n%s\n"), title, errorMsg);
}
free( errorMsg );
@@ -771,15 +765,15 @@ static int _run(int argc, _TCHAR* argv[], _TCHAR* vmArgs[])
if(relaunchCommand != NULL)
restartLauncher(NULL, relaunchCommand);
-
+
if (launchMode == LAUNCH_JNI)
cleanupVM(javaResults->launchResult ? javaResults->launchResult : javaResults->runResult);
-
+
if (sharedID != NULL) {
destroySharedData( sharedID );
free( sharedID );
}
-
+
/* Cleanup time. */
free( vmCommandArgs );
free( progCommandArgs );
@@ -796,7 +790,7 @@ static int _run(int argc, _TCHAR* argv[], _TCHAR* vmArgs[])
if (javaResults == NULL)
return -1;
-
+
/* reuse the running variable for convenience */
running = javaResults->launchResult != 0 ? javaResults->launchResult : javaResults->runResult;
free(javaResults);
@@ -806,10 +800,10 @@ static int _run(int argc, _TCHAR* argv[], _TCHAR* vmArgs[])
static _TCHAR** buildLaunchCommand( _TCHAR* program, _TCHAR** vmArgs, _TCHAR** progArgs ) {
int nVM = -1, nProg = -1;
_TCHAR** result;
-
+
while(vmArgs[++nVM] != NULL) {}
while(progArgs[++nProg] != NULL) {}
-
+
result = malloc((nVM + nProg + 2) * sizeof(_TCHAR*));
memset(result, 0, (nVM + nProg + 2) * sizeof(_TCHAR*));
result[0] = program;
@@ -1070,7 +1064,7 @@ static void adjustVMArgs(_TCHAR *javaVM, _TCHAR *jniLib, _TCHAR **vmArgv[]) {
* Some of the arguments returned by this function were
* passed directly from the main( argv ) array so they
* should not be deallocated.
- *
+ *
* Arguments are split into 2: vm arguments and program arguments
*/
static void getVMCommand( int launchMode, int argc, _TCHAR* argv[], _TCHAR **vmArgv[], _TCHAR **progArgv[] )
@@ -1084,10 +1078,10 @@ static void getVMCommand( int launchMode, int argc, _TCHAR* argv[], _TCHAR **vmA
int dst;
/* If the user specified "-vmargs", add them instead of the default VM args. */
- vmArg = (userVMarg != NULL) ? userVMarg : getArgVM( (launchMode == LAUNCH_JNI) ? jniLib : javaVM );
+ vmArg = (userVMarg != NULL) ? userVMarg : getArgVM( (launchMode == LAUNCH_JNI) ? jniLib : javaVM );
adjustVMArgs(javaVM, jniLib, &vmArg);
-
+
/* Calculate the number of VM arguments. */
while (vmArg[ nVMarg ] != NULL)
nVMarg++;
@@ -1099,7 +1093,7 @@ static void getVMCommand( int launchMode, int argc, _TCHAR* argv[], _TCHAR **vmA
/* VM argument list */
totalVMArgs = nVMarg + nReqVMarg + nEEargs + 1;
*vmArgv = malloc( totalVMArgs * sizeof(_TCHAR*) );
-
+
dst = 0;
for (src = 0; src < nVMarg; src++){
/*if the user specified a classpath, skip it */
@@ -1113,15 +1107,15 @@ static void getVMCommand( int launchMode, int argc, _TCHAR* argv[], _TCHAR **vmA
if (eeVMarg != NULL)
for (src = 0; src < nEEargs; src++)
(*vmArgv)[ dst++ ] = eeVMarg[ src ];
-
+
/* For each required VM arg */
for (src = 0; src < nReqVMarg; src++)
if( *(reqVMarg[src]) != NULL)
(*vmArgv)[ dst++ ] = *(reqVMarg[ src ]);
-
-
+
+
(*vmArgv)[dst] = NULL;
-
+
/* Program arguments */
/* OS <os> + WS <ws> + ARCH <arch> + LAUNCHER <launcher> + NAME <officialName> +
* + LIBRARY <library> + SHOWSPLASH <cmd> + EXITDATA <cmd> + STARTUP <jar> + OVERRIDE/APPEND + argv[] + VM + <vm> +
@@ -1131,7 +1125,7 @@ static void getVMCommand( int launchMode, int argc, _TCHAR* argv[], _TCHAR **vmA
totalProgArgs = 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 1 + argc + 2 + 1 + nVMarg + nEEargs + nReqVMarg + 1;
*progArgv = malloc( totalProgArgs * sizeof( _TCHAR* ) );
dst = 0;
-
+
/* Append the required options. */
(*progArgv)[ dst++ ] = OS;
(*progArgv)[ dst++ ] = osArg;
@@ -1149,7 +1143,7 @@ static void getVMCommand( int launchMode, int argc, _TCHAR* argv[], _TCHAR **vmA
if(splashBitmap != NULL)
(*progArgv)[ dst++ ] = splashBitmap;
}
-
+
/* Append the launcher command */
(*progArgv)[ dst++ ] = LAUNCHER;
(*progArgv)[ dst++ ] = program;
@@ -1157,17 +1151,17 @@ static void getVMCommand( int launchMode, int argc, _TCHAR* argv[], _TCHAR **vmA
/* Append the name command */
(*progArgv)[ dst++ ] = NAME;
(*progArgv)[ dst++ ] = officialName;
-
+
/* And the shared library */
if (eclipseLibrary != NULL) {
(*progArgv)[ dst++ ] = LIBRARY;
(*progArgv)[ dst++ ] = eclipseLibrary;
}
-
+
/* the startup jar */
(*progArgv)[ dst++ ] = STARTUP;
(*progArgv)[ dst++ ] = jarFile;
-
+
/* the protect mode */
if (protectMode) {
(*progArgv)[ dst++ ] = PROTECT;
@@ -1196,14 +1190,14 @@ static void getVMCommand( int launchMode, int argc, _TCHAR* argv[], _TCHAR **vmA
else
(*progArgv)[ dst++ ] = javaVM;
(*progArgv)[ dst++ ] = VMARGS;
-
+
for (src = 0; src < nVMarg; src++)
(*progArgv)[ dst++ ] = vmArg[ src ];
-
+
if (eeVMarg != NULL)
for (src = 0; src < nEEargs; src++)
(*progArgv)[ dst++ ] = eeVMarg[ src ];
-
+
/* For each required VM arg */
for (src = 0; src < nReqVMarg; src++)
if (*(reqVMarg[src]) != NULL)
@@ -1218,8 +1212,8 @@ static void getVMCommand( int launchMode, int argc, _TCHAR* argv[], _TCHAR **vmA
* This method formats a string with the JVM start command (and all arguments)
* that can be used in displaying error messages. The string returned from this
* method is probably not NLS compliant and must be deallocated by the caller.
- *
- * The arguments in the message are either args (if not null) or the combination
+ *
+ * The arguments in the message are either args (if not null) or the combination
* of vmArgs + progArgs
*/
static _TCHAR* formatVmCommandMsg( _TCHAR* args[], _TCHAR* vmArgs[], _TCHAR* progArgs[] )
@@ -1242,7 +1236,7 @@ static _TCHAR* formatVmCommandMsg( _TCHAR* args[], _TCHAR* vmArgs[], _TCHAR* pr
else list = NULL;
}
message = malloc( (length + 5) * sizeof(_TCHAR) );
-
+
/* Format the message such that options (args starting with '-') begin
on a new line. Otherwise, the Motif MessageBox does not automatically wrap
the messages and the message window can extend beyond both sides of the display. */
@@ -1295,18 +1289,18 @@ void setProgramPath(_TCHAR* path) {
static _TCHAR* getDefaultOfficialName()
{
_TCHAR *ch = NULL;
-
+
/* Skip the directory part */
ch = lastDirSeparator( program );
if (ch == NULL) ch = program;
else ch++;
-
+
ch = _tcsdup( ch );
#ifdef _WIN32
{
/* Search for the extension .exe and cut it */
_TCHAR *extension = _tcsrchr(ch, _T_ECLIPSE('.'));
- if (extension != NULL)
+ if (extension != NULL)
{
*extension = _T_ECLIPSE('\0');
}
@@ -1357,24 +1351,24 @@ static _TCHAR* findSplash(_TCHAR* splashArg) {
_TCHAR *ch;
_TCHAR *path, *prefix;
size_t length;
-
+
if (splashArg == NULL)
return NULL;
-
+
splashArg = _tcsdup(splashArg);
length = _tcslen(splashArg);
/* _tstat doesn't seem to like dirSeparators on the end */
while (IS_DIR_SEPARATOR(splashArg[length - 1])) {
splashArg[--length] = 0;
}
-
+
/* does splashArg exist */
if (_tstat(splashArg, &stats) == 0) {
/* pointing to a file */
- if (stats.st_mode & S_IFREG) {
+ if (stats.st_mode & S_IFREG) {
/* file, use it*/
return splashArg;
- } else if (stats.st_mode & S_IFDIR) {
+ } else if (stats.st_mode & S_IFDIR) {
/*directory, look for splash.bmp*/
ch = malloc( (length + 12) * sizeof(_TCHAR));
_stprintf( ch, _T_ECLIPSE("%s%c%s"), splashArg, dirSeparator, _T_ECLIPSE("splash.bmp") );
@@ -1387,7 +1381,7 @@ static _TCHAR* findSplash(_TCHAR* splashArg) {
free(splashArg);
return NULL;
}
-
+
/* doesn't exist, separate into path & prefix and look for a /path/prefix_<version> */
ch = lastDirSeparator( splashArg );
if (ch != NULL) {
@@ -1409,7 +1403,7 @@ static _TCHAR* findSplash(_TCHAR* splashArg) {
_stprintf(path, _T_ECLIPSE("%s%c%s"), programDir, dirSeparator, _T_ECLIPSE("plugins"));
prefix = _tcsdup(splashArg);
}
-
+
ch = findFile(path, prefix);
free(path);
free(prefix);
@@ -1427,7 +1421,7 @@ static _TCHAR* findStartupJar(){
_TCHAR * pluginsPath;
struct _stat stats;
size_t pathLength, progLength;
-
+
if( startupArg != NULL ) {
/* startup jar was specified on the command line */
ch = _tcsdup(startupArg);
@@ -1457,24 +1451,24 @@ static _TCHAR* findStartupJar(){
_tcscat(pluginsPath, _T_ECLIPSE("../../../"));
#endif
_tcscat(pluginsPath, _T_ECLIPSE("plugins"));
-
- /* equinox startup jar? */
+
+ /* equinox startup jar? */
file = findFile(pluginsPath, DEFAULT_EQUINOX_STARTUP);
if(file != NULL)
return file;
-
+
/* old startup.jar? */
ch = OLD_STARTUP;
file = checkPath(ch, programDir, 1);
if (_tstat( file, &stats ) == 0)
return (file == ch) ? _tcsdup(ch) : file;
-
+
return NULL;
}
-/*
+/*
* Return the portion of the vmCommand that should be used for relaunching
- *
+ *
* The memory allocated for the command array must be freed
*/
static _TCHAR ** getRelaunchCommand( _TCHAR **vmCommand )
@@ -1482,7 +1476,7 @@ static _TCHAR ** getRelaunchCommand( _TCHAR **vmCommand )
int i = -1, req = 0, begin = -1;
int idx = 0;
_TCHAR ** relaunch;
-
+
if (vmCommand == NULL) return NULL;
while(vmCommand[++i] != NULL){
if ( begin == -1 && _tcsicmp( vmCommand[i], *reqVMarg[req] ) == 0) {
@@ -1491,7 +1485,7 @@ static _TCHAR ** getRelaunchCommand( _TCHAR **vmCommand )
}
}
}
-
+
relaunch = malloc((1 + i + 1) * sizeof(_TCHAR *));
relaunch[idx++] = program;
if(begin == -1) {
@@ -1509,7 +1503,7 @@ static _TCHAR ** getRelaunchCommand( _TCHAR **vmCommand )
}
relaunch[idx++] = vmCommand[i];
}
- if(_tcsicmp(relaunch[idx - 1], VMARGS) == 0)
+ if(_tcsicmp(relaunch[idx - 1], VMARGS) == 0)
relaunch[idx - 1] = NULL;
relaunch[idx] = NULL;
return relaunch;
@@ -1523,9 +1517,9 @@ static void createConsole() {
intptr_t stdHandle;
int conHandle;
FILE *fp;
-
+
AllocConsole();
-
+
/* redirect stdout */
stdHandle = (intptr_t) GetStdHandle(STD_OUTPUT_HANDLE);
conHandle = _open_osfhandle(stdHandle, _O_TEXT);
@@ -1533,7 +1527,7 @@ static void createConsole() {
fp = _fdopen(conHandle, "w");
*stdout = *fp;
}
-
+
/* redirect stdin */
stdHandle = (intptr_t) GetStdHandle(STD_INPUT_HANDLE);
conHandle = _open_osfhandle(stdHandle, _O_TEXT);
@@ -1541,7 +1535,7 @@ static void createConsole() {
fp = _fdopen(conHandle, "r");
*stdin = *fp;
}
-
+
/* stderr */
stdHandle = (intptr_t) GetStdHandle(STD_ERROR_HANDLE);
conHandle = _open_osfhandle(stdHandle, _O_TEXT);
@@ -1595,19 +1589,19 @@ static int vmEEProps(_TCHAR * eeFile, _TCHAR ** msg) {
if (jniLib != NULL)
return LAUNCH_JNI;
}
-
+
if (eeConsole != NULL && (debug || needConsole || consoleLauncher) ) {
javaVM = findSymlinkCommand(eeConsole, 0);
if (javaVM != NULL)
return LAUNCH_EXE;
}
-
+
if (eeExecutable != NULL) {
javaVM = findSymlinkCommand(eeExecutable, 0);
if (javaVM != NULL)
return LAUNCH_EXE;
}
-
+
*msg = _tcsdup(eeFile);
return -1;
}
@@ -1625,12 +1619,12 @@ static int determineVM(_TCHAR** msg) {
_TCHAR* vmSearchPath = NULL;
_TCHAR* defaultJava = defaultVM; /* default exe to look for */
int type = 0;
-
+
#ifdef _WIN32
if (debug || needConsole || consoleLauncher)
defaultJava = consoleVM; /* windows will want java.exe for the console, not javaw.exe */
#endif
-
+
/* vmName is passed in on command line with -vm */
if (vmName != NULL) {
size_t length = _tcslen(vmName);
@@ -1638,7 +1632,7 @@ static int determineVM(_TCHAR** msg) {
if (vmName[length - 1] == _T_ECLIPSE('/') || vmName[length - 1] == _T_ECLIPSE('\\')) {
vmName[length - 1] = 0;
}
-
+
vmName = checkPath(vmName, programDir, 1);
type = checkProvidedVMType(vmName);
switch (type) {
@@ -1646,7 +1640,7 @@ static int determineVM(_TCHAR** msg) {
/* vmName is a directory, look for default.ee */
ch = malloc((_tcslen(vmName) + 1 + _tcslen(DEFAULT_EE) + 1) * sizeof(_TCHAR));
_stprintf( ch, _T_ECLIPSE("%s%c%s"), vmName, dirSeparator, DEFAULT_EE );
-
+
result = findCommand(ch);
free(ch);
if (result == NULL) {
@@ -1667,20 +1661,20 @@ static int determineVM(_TCHAR** msg) {
}
/* found nothing, return error */
*msg = malloc( (3 * (_tcslen(vmName) + 2) + _tcslen(DEFAULT_EE) + _tcslen(defaultJava) + _tcslen(vmLibrary) + 1) * sizeof(_TCHAR));
- _stprintf( *msg, _T_ECLIPSE("%s%c%s\n%s%c%s\n%s%c%s"), vmName, dirSeparator, DEFAULT_EE,
+ _stprintf( *msg, _T_ECLIPSE("%s%c%s\n%s%c%s\n%s%c%s"), vmName, dirSeparator, DEFAULT_EE,
vmName, dirSeparator, defaultJava,
vmName, dirSeparator, vmLibrary);
return -1;
}
break;
}
-
+
/* else default.ee does exist */
vmName = result;
/* fall through to VM_EE_PROPS*/
case VM_EE_PROPS:
return vmEEProps(vmName, msg);
-
+
case VM_LIBRARY:
ch = findCommand(vmName);
if(ch != NULL) {
@@ -1698,14 +1692,14 @@ static int determineVM(_TCHAR** msg) {
*msg = _tcsdup(vmName);
}
return -1;
-
+
default:
/*otherwise, assume executable */
javaVM = findSymlinkCommand(vmName, 0);
if(javaVM != NULL) {
#ifdef MACOSX
/* right now, we are always doing JNI on Mac */
- break;
+ break;
#else
return LAUNCH_EXE;
#endif
@@ -1721,10 +1715,10 @@ static int determineVM(_TCHAR** msg) {
return -1;
}
}
-
+
if (vmName == NULL) {
/* no vm specified, Try to find the VM shipped with eclipse. */
-
+
/* look first for default.ee */
ch = malloc( (_tcslen( programDir ) + _tcslen( shippedVMDir ) + _tcslen( DEFAULT_EE ) + 1) * sizeof(_TCHAR) );
_stprintf( ch, _T_ECLIPSE("%s%s%s"), programDir, shippedVMDir, DEFAULT_EE );
@@ -1735,16 +1729,16 @@ static int determineVM(_TCHAR** msg) {
free(result);
return type;
}
-
+
/* then look for java(w).exe */
ch = malloc( (_tcslen( programDir ) + _tcslen( shippedVMDir ) + _tcslen( defaultJava ) + 10) * sizeof(_TCHAR) );
_stprintf( ch, _T_ECLIPSE("%s%s%s"), programDir, shippedVMDir, defaultJava );
vmSearchPath = _tcsdup(ch);
-
+
javaVM = findSymlinkCommand( ch, 0 );
free(ch);
}
-
+
if (javaVM == NULL) {
/* vm not found yet, look for one on the search path, but don't resolve symlinks */
javaVM = findSymlinkCommand(defaultJava, 0);
@@ -1752,7 +1746,7 @@ static int determineVM(_TCHAR** msg) {
/* can't find vm, error */
ch = malloc( (_tcslen(pathMsg) + _tcslen(defaultJava) + 1) * sizeof(_TCHAR));
_stprintf(ch, pathMsg, defaultJava);
-
+
if(vmSearchPath != NULL) {
*msg = malloc((_tcslen(ch) + 1 + _tcslen(vmSearchPath) + 1) * sizeof(_TCHAR));
_stprintf(*msg, _T_ECLIPSE("%s\n%s"), vmSearchPath, ch);
@@ -1766,21 +1760,21 @@ static int determineVM(_TCHAR** msg) {
if (vmSearchPath != NULL)
free(vmSearchPath);
-
+
#ifndef DEFAULT_JAVA_EXEC
/* resolve symlinks for finding the library */
ch = resolveSymlinks(javaVM);
jniLib = findVMLibrary(ch);
if (ch != jniLib && ch != javaVM)
free(ch);
- if (jniLib != NULL)
+ if (jniLib != NULL)
return LAUNCH_JNI;
#endif
-
+
return LAUNCH_EXE;
}
-static int processEEProps(_TCHAR* eeFile)
+static int processEEProps(_TCHAR* eeFile)
{
_TCHAR ** argv;
_TCHAR * c1, * c2;
@@ -1789,13 +1783,13 @@ static int processEEProps(_TCHAR* eeFile)
int index, i;
int matches = 0;
Option *option;
-
+
if(readConfigFile(eeFile, &argc, &argv) != 0)
return -1;
nEEargs = argc;
eeVMarg = argv;
-
+
eeDir = _tcsdup(eeFile);
c1 = lastDirSeparator( eeDir );
while (c1 != NULL)
@@ -1805,7 +1799,7 @@ static int processEEProps(_TCHAR* eeFile)
if (!IS_DIR_SEPARATOR(*c1))
c1 = NULL;
}
-
+
for (index = 0; index < argc; index++){
/* replace ${ee.home} with eeDir, loop in case there is more than one per argument */
while( (c1 = _tcsstr(argv[index], EE_HOME_VAR)) != NULL)
@@ -1817,7 +1811,7 @@ static int processEEProps(_TCHAR* eeFile)
free(argv[index]);
argv[index] = c2;
}
-
+
/* Find the corresponding argument is a option supported by the launcher */
option = NULL;
for (i = 0; option == NULL && i < eeOptionsSize; i++)
@@ -1828,7 +1822,7 @@ static int processEEProps(_TCHAR* eeFile)
}
}
if(option != NULL) {
- ++matches;
+ ++matches;
if (option->flag & VALUE_IS_FLAG)
*((int*)option->value) = 1;
else {
@@ -1853,17 +1847,17 @@ static int processEEProps(_TCHAR* eeFile)
}
/* set ee.home, ee.filename variables, and NULL */
argv = realloc(argv, (nEEargs + 3) * sizeof(_TCHAR*));
-
+
c1 = malloc( (_tcslen(EE_HOME) + _tcslen(eeDir) + 1) * sizeof(_TCHAR));
_stprintf(c1, _T_ECLIPSE("%s%s"), EE_HOME, eeDir);
argv[nEEargs++] = c1;
-
+
c1 = malloc( (_tcslen(EE_FILENAME) + _tcslen(eeFile) + 1) * sizeof(_TCHAR));
_stprintf(c1, _T_ECLIPSE("%s%s"), EE_FILENAME, eeFile);
argv[nEEargs++] = c1;
-
+
argv[nEEargs] = NULL;
-
+
free(eeDir);
return 0;
}
@@ -1882,19 +1876,19 @@ _TCHAR ** getVMLibrarySearchPath(_TCHAR * vmLibrary) {
int numPaths = 3;
int i;
struct _stat stats;
-
- buffer = (eeLibPath != NULL) ? _tcsdup(eeLibPath) : _tcsdup(vmLibrary);
+
+ buffer = (eeLibPath != NULL) ? _tcsdup(eeLibPath) : _tcsdup(vmLibrary);
#ifdef WIN32
/* On windows we sometimes get '/' instead of '\', just always use '/' */
i = -1;
while (buffer[++i] != 0) {
- if (buffer[i] == _T_ECLIPSE('\\'))
+ if (buffer[i] == _T_ECLIPSE('\\'))
buffer[i] = _T_ECLIPSE('/');
}
#endif
-
+
separator = (eeLibPath != NULL) ? pathSeparator : _T_ECLIPSE('/');
-
+
if (eeLibPath != NULL) {
/* count number of path elements */
numPaths = 1;
@@ -1903,11 +1897,11 @@ _TCHAR ** getVMLibrarySearchPath(_TCHAR * vmLibrary) {
numPaths++;
c++;
}
- }
-
+ }
+
paths = malloc((numPaths + 1) * sizeof(_TCHAR*));
paths[numPaths] = NULL;
-
+
/* We are either splitting eeLibPath (eg path1:path2), or we are extracting
* from libPath where we want the directory containing the library and the
* parent directory of that, and also grandparent/lib/arch */
@@ -1915,9 +1909,9 @@ _TCHAR ** getVMLibrarySearchPath(_TCHAR * vmLibrary) {
c = _tcsrchr(buffer, separator);
if (c != 0) {
*c++ = 0;
- if (eeLibPath != NULL) {
+ if (eeLibPath != NULL) {
path = c; /* we want from c to the end */
- } else {
+ } else {
path = buffer; /* we want from the start to c */
}
} else {
@@ -1952,7 +1946,7 @@ _TCHAR ** getVMLibrarySearchPath(_TCHAR * vmLibrary) {
path = NULL;
}
}
-
+
free(buffer);
return paths;
}

Back to the top