diff options
author | Andrew Niefer | 2006-12-11 21:24:59 +0000 |
---|---|---|
committer | Andrew Niefer | 2006-12-11 21:24:59 +0000 |
commit | 138e0695660cf2e72082231791da7adb58373904 (patch) | |
tree | f356a0dea10b3272d93afc468c058f083d8f8382 /bundles | |
parent | 67c0407d4a1b5d4542a080d051f5ce383b609702 (diff) | |
download | rt.equinox.framework-138e0695660cf2e72082231791da7adb58373904.tar.gz rt.equinox.framework-138e0695660cf2e72082231791da7adb58373904.tar.xz rt.equinox.framework-138e0695660cf2e72082231791da7adb58373904.zip |
-console
Diffstat (limited to 'bundles')
9 files changed, 49 insertions, 18 deletions
diff --git a/bundles/org.eclipse.equinox.executable/library/carbon/eclipseCarbon.c b/bundles/org.eclipse.equinox.executable/library/carbon/eclipseCarbon.c index d4e6de80c..6679b47e9 100644 --- a/bundles/org.eclipse.equinox.executable/library/carbon/eclipseCarbon.c +++ b/bundles/org.eclipse.equinox.executable/library/carbon/eclipseCarbon.c @@ -29,7 +29,6 @@ char *findCommand(char *command); /* Global Variables */ -char* consoleVM = "java"; char* defaultVM = "java"; char* shippedVMDir = "jre/bin/"; diff --git a/bundles/org.eclipse.equinox.executable/library/eclipse.c b/bundles/org.eclipse.equinox.executable/library/eclipse.c index 30dfe9da0..5a5b610d5 100644 --- a/bundles/org.eclipse.equinox.executable/library/eclipse.c +++ b/bundles/org.eclipse.equinox.executable/library/eclipse.c @@ -185,6 +185,8 @@ #ifdef _WIN32 #include <direct.h> +#include <io.h> +#include <fcntl.h> #else #include <unistd.h> #include <strings.h> @@ -289,21 +291,23 @@ static Option options[] = { static int optionsSize = (sizeof(options) / sizeof(options[0])); /* Define the required VM arguments (all platforms). */ -static _TCHAR* cp = NULL; +static _TCHAR* cp = NULL; static _TCHAR** reqVMarg[] = { &cp, NULL }; /* required VM args */ static _TCHAR** userVMarg = NULL; /* user specific args for the Java VM */ /* Local methods */ -static void parseArgs( int* argc, _TCHAR* argv[] ); +static void parseArgs( int* argc, _TCHAR* argv[] ); +static void freeArgList( _TCHAR** data ); +static void getVMCommand( int argc, _TCHAR* argv[], _TCHAR **vmArgv[], _TCHAR **progArgv[] ); static _TCHAR** parseArgList( _TCHAR *data ); -static void freeArgList( _TCHAR** data ); -static void getVMCommand( int argc, _TCHAR* argv[], _TCHAR **vmArgv[], _TCHAR **progArgv[] ); static _TCHAR* formatVmCommandMsg( _TCHAR* args[] ); - _TCHAR* getProgramDir(); -static _TCHAR* getDefaultOfficialName(); +static _TCHAR* getDefaultOfficialName(); static _TCHAR* findStartupJar(); -static _TCHAR ** getRelaunchCommand( _TCHAR **vmCommand ); +static _TCHAR** getRelaunchCommand( _TCHAR **vmCommand ); +#ifdef _WIN32 +static void createConsole(); +#endif /* Record the arguments that were used to start the original executable */ JNIEXPORT void setInitialArgs(int argc, _TCHAR** argv) { @@ -354,7 +358,7 @@ JNIEXPORT int run(int argc, _TCHAR* argv[], _TCHAR* vmArgs[]) if (vmName == NULL) { /* Determine which type of VM should be used. */ - vmName = ((debug || needConsole) ? consoleVM : defaultVM); + vmName = defaultVM; /* Try to find the VM shipped with eclipse. */ shippedVM = malloc( (_tcslen( programDir ) + _tcslen( shippedVMDir ) + _tcslen( vmName ) + 10) * sizeof(_TCHAR) ); @@ -398,6 +402,12 @@ JNIEXPORT int run(int argc, _TCHAR* argv[], _TCHAR* vmArgs[]) exit( 1 ); } +#ifdef _WIN32 + if(debug || needConsole) { + createConsole(); + } +#endif + /* If the showsplash option was given */ if (!noSplash && showSplashArg) { @@ -885,3 +895,31 @@ static _TCHAR ** getRelaunchCommand( _TCHAR **vmCommand ) relaunch[idx] = NULL; return relaunch; } + +#ifdef _WIN32 +static void createConsole() { + long stdHandle; + int conHandle; + FILE *fp; + + AllocConsole(); + + /* redirect stdout */ + stdHandle = (long)GetStdHandle(STD_OUTPUT_HANDLE); + conHandle = _open_osfhandle(stdHandle, _O_TEXT); + fp = _fdopen(conHandle, "w"); + *stdout = *fp; + + /* redirect stdin */ + stdHandle = (long)GetStdHandle(STD_INPUT_HANDLE); + conHandle = _open_osfhandle(stdHandle, _O_TEXT); + fp = _fdopen(conHandle, "r"); + *stdin = *fp; + + /* stderr */ + stdHandle = (long)GetStdHandle(STD_ERROR_HANDLE); + conHandle = _open_osfhandle(stdHandle, _O_TEXT); + fp = _fdopen(conHandle, "r"); + *stderr = *fp; +} +#endif diff --git a/bundles/org.eclipse.equinox.executable/library/eclipseJNI.c b/bundles/org.eclipse.equinox.executable/library/eclipseJNI.c index fd34a7605..cd691be18 100644 --- a/bundles/org.eclipse.equinox.executable/library/eclipseJNI.c +++ b/bundles/org.eclipse.equinox.executable/library/eclipseJNI.c @@ -238,7 +238,6 @@ int startJavaVM( _TCHAR* libPath, _TCHAR* vmArgs[], _TCHAR* progArgs[] ) } /*(*jvm)->DestroyJavaVM(jvm);*/ } - unloadLibrary(jniLibrary); free(progArgs); /* toNarrow allocated new strings, free them */ @@ -246,6 +245,8 @@ int startJavaVM( _TCHAR* libPath, _TCHAR* vmArgs[], _TCHAR* progArgs[] ) free( options[i].optionString ); } free(options); + + unloadLibrary(jniLibrary); return jvmExitCode; } diff --git a/bundles/org.eclipse.equinox.executable/library/eclipseOS.h b/bundles/org.eclipse.equinox.executable/library/eclipseOS.h index 61d57df62..e2e1cb5f1 100644 --- a/bundles/org.eclipse.equinox.executable/library/eclipseOS.h +++ b/bundles/org.eclipse.equinox.executable/library/eclipseOS.h @@ -18,7 +18,6 @@ #ifdef UNICODE #define shippedVMDir shippedVMDirW #define defaultVM defaultVMW -#define consoleVM consoleVMW #define initWindowSystem initWindowSystemW #define showSplash showSplashW #define getArgVM getArgVMW @@ -37,7 +36,6 @@ /*** See eclipse.c for information on the launcher runtime architecture ***/ /* Global Variables */ -extern _TCHAR* consoleVM; /* name of VM to use for debugging */ extern _TCHAR* defaultVM; /* name of VM to use normally */ extern _TCHAR* shippedVMDir; /* VM bin directory with separator */ extern _TCHAR* exitData; /* exit data set from Java */ diff --git a/bundles/org.eclipse.equinox.executable/library/gtk/eclipseGtk.c b/bundles/org.eclipse.equinox.executable/library/gtk/eclipseGtk.c index 79c18fbf9..1175f1436 100644 --- a/bundles/org.eclipse.equinox.executable/library/gtk/eclipseGtk.c +++ b/bundles/org.eclipse.equinox.executable/library/gtk/eclipseGtk.c @@ -36,7 +36,6 @@ #include <gdk-pixbuf/gdk-pixbuf.h> /* Global Variables */ -char* consoleVM = "java"; char* defaultVM = "java"; char* vmLibrary = "libjvm.so"; char* shippedVMDir = "jre/bin/"; diff --git a/bundles/org.eclipse.equinox.executable/library/motif/eclipseMotif.c b/bundles/org.eclipse.equinox.executable/library/motif/eclipseMotif.c index 69aebdf1f..d0f886ed0 100644 --- a/bundles/org.eclipse.equinox.executable/library/motif/eclipseMotif.c +++ b/bundles/org.eclipse.equinox.executable/library/motif/eclipseMotif.c @@ -41,7 +41,6 @@ #include <stdlib.h> /* Global Variables */ -char* consoleVM = "java"; char* defaultVM = "java"; char* shippedVMDir = "jre/bin/"; diff --git a/bundles/org.eclipse.equinox.executable/library/photon/eclipsePhoton.c b/bundles/org.eclipse.equinox.executable/library/photon/eclipsePhoton.c index e45e2c0e2..582864374 100644 --- a/bundles/org.eclipse.equinox.executable/library/photon/eclipsePhoton.c +++ b/bundles/org.eclipse.equinox.executable/library/photon/eclipsePhoton.c @@ -34,11 +34,9 @@ char dirSeparator = '/'; char pathSeparator = ':'; #ifndef J9VM -char* consoleVM = "java"; char* defaultVM = "java"; char* shippedVMDir = "jre/bin/"; #else -char* consoleVM = "j9"; char* defaultVM = "j9"; char* shippedVMDir = "ive/bin/"; #endif diff --git a/bundles/org.eclipse.equinox.executable/library/win32/eclipseWin.c b/bundles/org.eclipse.equinox.executable/library/win32/eclipseWin.c index a1a5fa2b4..a5b151699 100644 --- a/bundles/org.eclipse.equinox.executable/library/win32/eclipseWin.c +++ b/bundles/org.eclipse.equinox.executable/library/win32/eclipseWin.c @@ -28,7 +28,6 @@ extern HWND topWindow; /* Global Variables */ -_TCHAR* consoleVM = _T("java.exe"); _TCHAR* defaultVM = _T("javaw.exe"); _TCHAR* vmLibrary = _T("jvm.dll"); _TCHAR* shippedVMDir = _T("jre\\bin\\"); diff --git a/bundles/org.eclipse.equinox.executable/library/win32/make_win32.mak b/bundles/org.eclipse.equinox.executable/library/win32/make_win32.mak index b2056f248..947f56f16 100644 --- a/bundles/org.eclipse.equinox.executable/library/win32/make_win32.mak +++ b/bundles/org.eclipse.equinox.executable/library/win32/make_win32.mak @@ -47,7 +47,7 @@ acflags = -I.. -DDEFAULT_OS="\"$(DEFAULT_OS)\"" \ /I$(JAVA_HOME)\include /I$(JAVA_HOME)\include\win32 \ $(cflags) wcflags = -DUNICODE $(acflags) -cvars = /Zi #/O1 +cvars = -MD -D_MT -D_DLL -DWIN32 -D_WIN32 all: $(EXEC) $(DLL) eclipseMain.obj: ../eclipseUnicode.h ../eclipseCommon.h ../eclipseMain.c |