1 /*******************************************************************************
2  * Copyright (c) 2000, 2015 IBM Corporation and others.
3  *
4  * This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License 2.0
6  * which accompanies this distribution, and is available at
7  * https://www.eclipse.org/legal/epl-2.0/
8  *
9  * SPDX-License-Identifier: EPL-2.0
10  *
11  * Contributors:
12  *     IBM Corporation - initial API and implementation
13  *     Kevin Cornell (Rational Software Corporation)
14  *     Rapicorp, Inc - Default the configuration to Application Support (bug 461725)
15  *******************************************************************************/
16 
17 #ifndef ECLIPSE_OS_H
18 #define ECLIPSE_OS_H
19 
20 #include "eclipseJNI.h"
21 #include "eclipseUnicode.h"
22 
23 #ifdef MACOSX
24 #define JAVA_FRAMEWORK "/System/Library/Frameworks/JavaVM.framework"
25 #endif
26 
27 /* Operating System Dependent Information */
28 
29 /*** See eclipse.c for information on the launcher runtime architecture ***/
30 
31 /* Global Variables */
32 extern _TCHAR*  defaultVM;   			/* name of VM to use normally      */
33 #ifdef _WIN32
34 extern _TCHAR*  consoleVM;				/* windows needs a different vm executable for the console */
35 #endif
36 extern _TCHAR*  shippedVMDir;			/* VM bin directory with separator */
37 extern _TCHAR*  exitData;		  		/* exit data set from Java */
38 extern _TCHAR*  vmLibrary;				/* name of the VM shared library */
39 extern int		initialArgc;			/* argc originally used to start launcher */
40 extern _TCHAR**	initialArgv;			/* argv originally used to start launcher */
41 extern _TCHAR*  eeLibPath;				/* library path specified in a .ee file */
42 extern int		secondThread;			/* whether or not to start the vm on a second thread */
43 
44 
45 /* OS Specific Functions */
46 
47 /** Display a Message
48  *
49  * This method is called to display a message to the user.
50  * The method should not return until the user has acknowledged
51  * the message. This method will only be called after the window
52  * system has been initialized.
53  */
54 extern void displayMessage( _TCHAR* title, _TCHAR* message );
55 
56 
57 /** Initialize the Window System
58  *
59  * This method is called after the command line arguments have been
60  * parsed. Its purpose is to initialize the corresponding window system.
61  *
62  * The showSplash flag indicates the splash window will be displayed by
63  * this process (e.g., value will be zero for the main launcher).
64  */
65 extern int initWindowSystem( int* argc, _TCHAR* argv[], int showSplash );
66 
67 
68 /** Show the Splash Window
69  *
70  * This method is called to display the actual splash window. It will only
71  * be called by the splash window process and not the main launcher process.
72  * The splash ID passed corresponds to the string returned from initWindowSystem().
73  * If possible, this ID should be used to communicate some piece of data back
74  * to the main launcher program for two reasons:
75  * 1) to detect when the splash window process terminates
76  * 2) to terminate the splash window process should the JVM terminate before it
77  *    completes its initialization.
78  *
79  * Two parameters are passed: the install home directory and a specific bitmap image
80  * file for a feature. The feature's image file is tried first and if it cannot be
81  * displayed, the images from the install directory are used.
82  *
83  * Return (exit code):
84  * 0        - success
85  * non-zero - could not find a splash image to display
86  */
87 extern int showSplash( const _TCHAR* featureImage );
88 
89 /** Get List of Java VM Arguments
90  *
91  * A given Java VM might require a special set of arguments in order to
92  * optimize its performance. This method returns a NULL terminated array
93  * of strings, where each string is a separate VM argument.
94  */
95 extern _TCHAR** getArgVM( _TCHAR *vm );
96 
97 /* Find the vm shared library associated with the given java executable */
98 extern _TCHAR * findVMLibrary( _TCHAR * command );
99 
100 extern void dispatchMessages();
101 
102 extern jlong getSplashHandle();
103 
104 extern void takeDownSplash();
105 
106 extern void restartLauncher( _TCHAR* program, _TCHAR* args[] );
107 
108 /* launch the vm in a separate process and wait for it to finish */
109 extern JavaResults* launchJavaVM( _TCHAR* args[] );
110 
111 /* launch the vm in this process using JNI invocation */
112 extern JavaResults* startJavaVM( _TCHAR* libPath, _TCHAR* vmArgs[], _TCHAR* progArgs[], _TCHAR* jarFile );
113 
114 /* do any platform specific processing of the user vmargs */
115 extern void processVMArgs(_TCHAR **vmargs[] );
116 
117 /* is this a JVM whose version is >= 9 (then allow the --add-modules VM argument), returns 0 if we don't know */
118 extern int isModularVM( _TCHAR * javaVM, _TCHAR * jniLib );
119 
120 /* an array of paths that will need to be on the search path to load the vm shared library */
121 extern _TCHAR ** getVMLibrarySearchPath(_TCHAR * vmLibrary);
122 
123 extern int reuseWorkbench(_TCHAR** filePath, int timeout);
124 
125 extern _TCHAR* getFolderForApplicationData();
126 
127 #endif /* ECLIPSE_OS_H */
128 
129