View | Details | Raw Unified | Return to bug 149994 | Differences between
and this patch

Collapse All | Expand All

(-).cproject (-2 / +5 lines)
Lines 1-4 Link Here
1
<?xml version="1.0" encoding="UTF-8"?><?fileVersion 4.0.0?><cproject>
1
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
<?fileVersion 4.0.0?>
3
4
<cproject>
2
	<storageModule moduleId="org.eclipse.cdt.core.settings">
5
	<storageModule moduleId="org.eclipse.cdt.core.settings">
3
		<cconfiguration id="converted.config.1797282818">
6
		<cconfiguration id="converted.config.1797282818">
4
			<storageModule moduleId="scannerConfiguration">
7
			<storageModule moduleId="scannerConfiguration">
Lines 134-137 Link Here
134
			</storageModule>
137
			</storageModule>
135
		</cconfiguration>
138
		</cconfiguration>
136
	</storageModule>
139
	</storageModule>
137
</cproject>
140
</cproject>
(-)library/eclipse.c (-6 / +60 lines)
Lines 9-14 Link Here
9
 *     IBM Corporation - initial API and implementation
9
 *     IBM Corporation - initial API and implementation
10
 *     Kevin Cornell (Rational Software Corporation)
10
 *     Kevin Cornell (Rational Software Corporation)
11
 *	   Markus Schorn (Wind River Systems), bug 193340
11
 *	   Markus Schorn (Wind River Systems), bug 193340
12
 *	   Martin Oberhuber (Wind River) - [149994] Add --launcher.appendVmargs
12
 *******************************************************************************/
13
 *******************************************************************************/
13
14
14
/* Eclipse Program Launcher
15
/* Eclipse Program Launcher
Lines 233-238 Link Here
233
#define LIBRARY		  _T_ECLIPSE("--launcher.library")
234
#define LIBRARY		  _T_ECLIPSE("--launcher.library")
234
#define SUPRESSERRORS _T_ECLIPSE("--launcher.suppressErrors")
235
#define SUPRESSERRORS _T_ECLIPSE("--launcher.suppressErrors")
235
#define INI			  _T_ECLIPSE("--launcher.ini")
236
#define INI			  _T_ECLIPSE("--launcher.ini")
237
#define APPEND_VMARGS _T_ECLIPSE("--launcher.appendVmargs")
238
#define OVERRIDE_VMARGS _T_ECLIPSE("--launcher.overrideVmargs")
236
#define SECOND_THREAD _T_ECLIPSE("--launcher.secondThread")
239
#define SECOND_THREAD _T_ECLIPSE("--launcher.secondThread")
237
#define PERM_GEN	  _T_ECLIPSE("--launcher.XXMaxPermSize")
240
#define PERM_GEN	  _T_ECLIPSE("--launcher.XXMaxPermSize")
238
241
Lines 254-259 Link Here
254
static int     noSplash      = 0;				/* True: do not show splash win	*/
257
static int     noSplash      = 0;				/* True: do not show splash win	*/
255
static int	   suppressErrors = 0;				/* True: do not display errors dialogs */
258
static int	   suppressErrors = 0;				/* True: do not display errors dialogs */
256
       int     secondThread  = 0;				/* True: start the VM on a second thread */
259
       int     secondThread  = 0;				/* True: start the VM on a second thread */
260
static int     appendVmargs = 0;                /* True: append cmdline vmargs to launcher.ini vmargs */
257
       
261
       
258
static _TCHAR*  showSplashArg = NULL;			/* showsplash data (main launcher window) */
262
static _TCHAR*  showSplashArg = NULL;			/* showsplash data (main launcher window) */
259
static _TCHAR*  splashBitmap  = NULL;			/* the actual splash bitmap */
263
static _TCHAR*  splashBitmap  = NULL;			/* the actual splash bitmap */
Lines 289-294 Link Here
289
							/* don't assign it and only remove (remove - 1) arguments  */
293
							/* don't assign it and only remove (remove - 1) arguments  */
290
#define ADJUST_PATH		4  	/* value is a path, do processing on relative paths to try and make them absolute */
294
#define ADJUST_PATH		4  	/* value is a path, do processing on relative paths to try and make them absolute */
291
#define VALUE_IS_LIST	8  	/* value is a pointer to a tokenized _TCHAR* string for EE files, or a _TCHAR** list for the command line */
295
#define VALUE_IS_LIST	8  	/* value is a pointer to a tokenized _TCHAR* string for EE files, or a _TCHAR** list for the command line */
296
#define INVERT_FLAG    16   /* invert the meaning of a flag, i.e. reset it */
292
297
293
static Option options[] = {
298
static Option options[] = {
294
    { CONSOLE,		&needConsole,	VALUE_IS_FLAG,	0 },
299
    { CONSOLE,		&needConsole,	VALUE_IS_FLAG,	0 },
Lines 297-302 Link Here
297
    { NOSPLASH,     &noSplash,      VALUE_IS_FLAG,	1 },
302
    { NOSPLASH,     &noSplash,      VALUE_IS_FLAG,	1 },
298
    { SUPRESSERRORS, &suppressErrors, VALUE_IS_FLAG, 1},
303
    { SUPRESSERRORS, &suppressErrors, VALUE_IS_FLAG, 1},
299
    { SECOND_THREAD, &secondThread, VALUE_IS_FLAG,  1 },
304
    { SECOND_THREAD, &secondThread, VALUE_IS_FLAG,  1 },
305
    { APPEND_VMARGS, &appendVmargs,	VALUE_IS_FLAG, 1 },
306
    { OVERRIDE_VMARGS, &appendVmargs, VALUE_IS_FLAG | INVERT_FLAG, 1 },
300
    { LIBRARY,		NULL,			0,			2 }, /* library was parsed by exe, just remove it */
307
    { LIBRARY,		NULL,			0,			2 }, /* library was parsed by exe, just remove it */
301
    { INI,			NULL, 			0,			2 }, /* same with ini */
308
    { INI,			NULL, 			0,			2 }, /* same with ini */
302
    { OS,			&osArg,			0,			2 },
309
    { OS,			&osArg,			0,			2 },
Lines 331-336 Link Here
331
/* Local methods */
338
/* Local methods */
332
static void     parseArgs( int* argc, _TCHAR* argv[] );
339
static void     parseArgs( int* argc, _TCHAR* argv[] );
333
static void 	processDefaultAction(int argc, _TCHAR* argv[]);
340
static void 	processDefaultAction(int argc, _TCHAR* argv[]);
341
static void 	mergeUserVMArgs( _TCHAR **vmArgs[] );
334
static void     getVMCommand( int launchMode, int argc, _TCHAR* argv[], _TCHAR **vmArgv[], _TCHAR **progArgv[] );
342
static void     getVMCommand( int launchMode, int argc, _TCHAR* argv[], _TCHAR **vmArgv[], _TCHAR **progArgv[] );
335
static int 		determineVM(_TCHAR** msg);
343
static int 		determineVM(_TCHAR** msg);
336
static int 		vmEEProps(_TCHAR* eeFile, _TCHAR** msg);
344
static int 		vmEEProps(_TCHAR* eeFile, _TCHAR** msg);
Lines 422-429 Link Here
422
    	exit( 1 );
430
    	exit( 1 );
423
    }
431
    }
424
432
425
    /* platform specific processing of user's vmargs */
433
    if (vmArgs != NULL) {
426
    processVMArgs(&vmArgs);
434
    	/* reconcile VM Args from commandline with launcher.ini (append or override) */
435
    	mergeUserVMArgs(&vmArgs);
436
    	/* platform specific processing of user's vmargs */
437
    	processVMArgs(&vmArgs);
438
    }
427
    launchMode = determineVM(&msg);
439
    launchMode = determineVM(&msg);
428
    if (launchMode == -1) {
440
    if (launchMode == -1) {
429
    	/* problem */
441
    	/* problem */
Lines 720-726 Link Here
720
			/* If the option requires a value and there is one, extract the value. */
732
			/* If the option requires a value and there is one, extract the value. */
721
			if (option->value != NULL) {
733
			if (option->value != NULL) {
722
				if (option->flag & VALUE_IS_FLAG)
734
				if (option->flag & VALUE_IS_FLAG)
723
					*((int *) option->value) = 1;
735
					*((int *) option->value) = (option->flag & INVERT_FLAG) ? 0 : 1;
724
				else {
736
				else {
725
					int count = 1;
737
					int count = 1;
726
					if (option->flag & VALUE_IS_LIST) {
738
					if (option->flag & VALUE_IS_LIST) {
Lines 796-815 Link Here
796
    return execArg;
808
    return execArg;
797
}
809
}
798
810
811
/* Return the list of args from the launcher ini file (if it exists). Caller is responsible to free(). */
812
static _TCHAR** getConfigArgs() {
813
	_TCHAR*  iniFile = NULL;
814
	_TCHAR** configArgv = NULL;
815
	int 	 configArgc = 0;
816
	int      ret = 0;
817
	int      iniArg;
818
819
	/* Parse configuration file arguments */
820
	iniArg = indexOf(INI, initialArgv);
821
	if (iniArg > 0) {
822
		iniFile = initialArgv[iniArg + 1];
823
		ret = readConfigFile(iniFile, &configArgc, &configArgv);
824
	} else {
825
		ret = readIniFile(program, &configArgc, &configArgv);
826
	}
827
	if (ret == 0) {
828
		return configArgv;
829
	}
830
	return NULL;
831
}
832
833
/** Append Commandline VM Args to VM Args that came from the launcher.ini */
834
static void mergeUserVMArgs( _TCHAR **vmArgs[] ) {
835
	if (appendVmargs != 0 && indexOf(VMARGS, initialArgv) > 0) {
836
		/* Get vmargs from the launcher.ini, if any */
837
		_TCHAR** configArgs = getConfigArgs();
838
		if (configArgs != NULL) {
839
			int vmArg = indexOf(VMARGS, configArgs);
840
			if (vmArg >= 0) {
841
				_TCHAR** configVMArgs = configArgs + vmArg + 1;
842
				if (configVMArgs != NULL) {
843
					*vmArgv = concatArgs(configVMArgs, *vmArgv);
844
				}
845
			}
846
			free(configArgs);
847
		}
848
		/* else, no merge is necessary (there was only commandline vmargs) */
849
	}
850
}
851
799
static void adjustVMArgs( _TCHAR *javaVM, _TCHAR *jniLib, _TCHAR **vmArgv[] ) {
852
static void adjustVMArgs( _TCHAR *javaVM, _TCHAR *jniLib, _TCHAR **vmArgv[] ) {
800
	/* Sun VMs need some extra perm gen space */
853
	/* Sun VMs need some extra perm gen space */
801
	if (permGen != NULL && isSunVM(javaVM, jniLib)) {
854
	/* Detecting Sun VM is expensive - only do so if necessary */
855
	if (permGen != NULL) {
802
		int specified = 0, i = -1;
856
		int specified = 0, i = -1;
803
		
857
		
804
		/* first check to see if it is already specified */
858
		/* first check to see if it is already specified */
805
		while ( (*vmArgv)[++i] != NULL) {
859
		while ((*vmArgv)[++i] != NULL) {
806
			/* we are also counting the number of args here */
860
			/* we are also counting the number of args here */
807
			if (!specified && _tcsncmp((*vmArgv)[i], XXPERMGEN, _tcslen(XXPERMGEN)) == 0) {
861
			if (!specified && _tcsncmp((*vmArgv)[i], XXPERMGEN, _tcslen(XXPERMGEN)) == 0) {
808
				specified = 1;
862
				specified = 1;
809
			}
863
			}
810
		}
864
		}
811
		
865
		
812
		if (!specified) {
866
		if (!specified && isSunVM(javaVM, jniLib)) {
813
			_TCHAR ** oldArgs = *vmArgv;
867
			_TCHAR ** oldArgs = *vmArgv;
814
			_TCHAR *newArg = malloc((_tcslen(XXPERMGEN) + _tcslen(permGen) + 1) * sizeof(_TCHAR));
868
			_TCHAR *newArg = malloc((_tcslen(XXPERMGEN) + _tcslen(permGen) + 1) * sizeof(_TCHAR));
815
			_stprintf(newArg, _T_ECLIPSE("%s%s"), XXPERMGEN, permGen);
869
			_stprintf(newArg, _T_ECLIPSE("%s%s"), XXPERMGEN, permGen);
(-)library/eclipseUtil.c (-1 / +44 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2005 IBM Corporation and others.
2
 * Copyright (c) 2000, 2010 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at 
5
 * which accompanies this distribution, and is available at 
Lines 8-13 Link Here
8
 * Contributors:
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
9
 *     IBM Corporation - initial API and implementation
10
 *     Kevin Cornell (Rational Software Corporation)
10
 *     Kevin Cornell (Rational Software Corporation)
11
 *	   Martin Oberhuber (Wind River) - [149994] Add --launcher.appendVmargs
11
 *******************************************************************************/
12
 *******************************************************************************/
12
13
13
/* Eclipse Launcher Utility Methods */
14
/* Eclipse Launcher Utility Methods */
Lines 159-164 Link Here
159
}
160
}
160
161
161
/*
162
/*
163
 * Concatenates two NULL-terminated arrays of Strings,
164
 * returning a new NULL-terminated array.
165
 * The returned array must be freed with the regular free().
166
 */
167
_TCHAR** concatArgs(_TCHAR** l1, _TCHAR** l2) {
168
	_TCHAR** newArray = NULL;
169
	int size1 = 0;
170
	int size2 = 0;
171
172
	if (l1 != NULL)
173
		while (l1[size1] != NULL) size1++;
174
	if (l2 != NULL)
175
		while (l2[size2] != NULL) size2++;
176
177
	newArray = (_TCHAR **) malloc((size1 + size2 + 1) * sizeof(_TCHAR *));
178
	if (size1 > 0) {
179
		memcpy(newArray, l1, size1 * sizeof(_TCHAR *));
180
	}
181
	if (size2 > 0) {
182
		memcpy(newArray + size1, l2, size2 * sizeof(_TCHAR *));
183
	}
184
	newArray[size1 + size2] = NULL;
185
	return newArray;
186
}
187
188
/*
189
 * returns the relative position of arg in the NULL-terminated list of args,
190
 * or -1 if args does not contain arg.
191
 */
192
int indexOf(_TCHAR *arg, _TCHAR **args) {
193
	int i = -1;
194
	if (arg != NULL && args != NULL) {
195
		while (args[++i] != NULL) {
196
			if (_tcsicmp(arg, args[i]) == 0) {
197
				return i;
198
			}
199
		}
200
	}
201
	return -1;
202
}
203
204
/*
162
 * buffer contains a pathSeparator separated list of paths, check 
205
 * buffer contains a pathSeparator separated list of paths, check 
163
 * that it contains all the paths given.  Each path is expected to be
206
 * that it contains all the paths given.  Each path is expected to be
164
 * terminated with a pathSeparator character.
207
 * terminated with a pathSeparator character.
(-)library/eclipseUtil.h (-1 / +8 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2005 IBM Corporation and others.
2
 * Copyright (c) 2000, 2010 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at 
5
 * which accompanies this distribution, and is available at 
Lines 8-13 Link Here
8
 * Contributors:
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
9
 *     IBM Corporation - initial API and implementation
10
 *     Kevin Cornell (Rational Software Corporation)
10
 *     Kevin Cornell (Rational Software Corporation)
11
 *	   Martin Oberhuber (Wind River) - [149994] Add --launcher.appendVmargs
11
 *******************************************************************************/
12
 *******************************************************************************/
12
13
13
#ifndef ECLIPSE_UTIL_H
14
#ifndef ECLIPSE_UTIL_H
Lines 37-42 Link Here
37
/* take a NULL terminated array of strings and concatenate them together into one string */
38
/* take a NULL terminated array of strings and concatenate them together into one string */
38
extern _TCHAR * concatStrings(_TCHAR** strs);
39
extern _TCHAR * concatStrings(_TCHAR** strs);
39
40
41
/* Concatenates two NULL-terminated arrays of strings into a new array of strings */
42
extern _TCHAR** concatArgs(_TCHAR** l1, _TCHAR** l2);
43
44
/* Returns the relative position of arg in the NULL-terminated list of args, or -1 */
45
extern int indexOf(_TCHAR *arg, _TCHAR **args);
46
40
/* take a NULL terminated array of strings and concatenate them together using the give pathSeparator */
47
/* take a NULL terminated array of strings and concatenate them together using the give pathSeparator */
41
extern _TCHAR* concatPaths(_TCHAR** paths, _TCHAR pathSeparator);
48
extern _TCHAR* concatPaths(_TCHAR** paths, _TCHAR pathSeparator);
42
49

Return to bug 149994