1 /*
   2  * Copyright 1999-2005 Sun Microsystems, Inc.  All Rights Reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
  20  * CA 95054 USA or visit www.sun.com if you need additional information or
  21  * have any questions.
  22  *  
  23  */
  24 
  25 /*
  26  * Gamma (Hotspot internal engineering test) launcher based on 1.6.0-b28 JDK,
  27  * search "GAMMA" for gamma specific changes.
  28  */
  29 
  30 #ifndef _JAVA_H_
  31 #define _JAVA_H_
  32 
  33 /*
  34  * Get system specific defines.
  35  */
  36 #include "jni.h"
  37 #include "java_md.h"
  38 
  39 /*
  40  * Pointers to the needed JNI invocation API, initialized by LoadJavaVM.
  41  */
  42 typedef jint (JNICALL *CreateJavaVM_t)(JavaVM **pvm, void **env, void *args);
  43 typedef jint (JNICALL *GetDefaultJavaVMInitArgs_t)(void *args);
  44 
  45 typedef struct {
  46     CreateJavaVM_t CreateJavaVM;
  47     GetDefaultJavaVMInitArgs_t GetDefaultJavaVMInitArgs;
  48 } InvocationFunctions;
  49 
  50 /*
  51  * Prototypes for launcher functions in the system specific java_md.c.
  52  */
  53 
  54 jboolean
  55 LoadJavaVM(const char *jvmpath, InvocationFunctions *ifn);
  56 
  57 void
  58 GetXUsagePath(char *buf, jint bufsize);
  59 
  60 jboolean
  61 GetApplicationHome(char *buf, jint bufsize);
  62 
  63 const char *
  64 GetArch();
  65 
  66 void CreateExecutionEnvironment(int *_argc,
  67                                        char ***_argv,
  68                                        char jrepath[],
  69                                        jint so_jrepath,
  70                                        char jvmpath[],
  71                                        jint so_jvmpath,
  72                                        char **original_argv);
  73 
  74 /*
  75  * Report an error message to stderr or a window as appropriate.  The
  76  * flag always is set to JNI_TRUE if message is to be reported to both
  77  * strerr and windows and set to JNI_FALSE if the message should only
  78  * be sent to a window.
  79  */
  80 void ReportErrorMessage(char * message, jboolean always);
  81 void ReportErrorMessage2(char * format, char * string, jboolean always);
  82 
  83 /*
  84  * Report an exception which terminates the vm to stderr or a window
  85  * as appropriate.
  86  */
  87 void ReportExceptionDescription(JNIEnv * env);
  88 
  89 jboolean RemovableMachineDependentOption(char * option);
  90 void PrintMachineDependentOptions();
  91 
  92 /* 
  93  * Functions defined in java.c and used in java_md.c.
  94  */
  95 jint ReadKnownVMs(const char *jrepath, char * arch, jboolean speculative); 
  96 char *CheckJvmType(int *argc, char ***argv, jboolean speculative);
  97 void* MemAlloc(size_t size);
  98 
  99 /*
 100  * Make launcher spit debug output.
 101  */
 102 extern jboolean _launcher_debug;
 103 
 104 #endif /* _JAVA_H_ */