-/* options.c - contains global options
+/* src/vm/options.c - contains global options
- Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
- Institut f. Computersprachen, TU Wien
- R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser, M. Probst,
- S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich,
- J. Wenninger
+ Copyright (C) 1996-2005 R. Grafl, A. Krall, C. Kruegel, C. Oates,
+ R. Obermaisser, M. Platter, M. Probst, S. Ring, E. Steiner,
+ C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich, J. Wenninger,
+ Institut f. Computersprachen - TU Wien
This file is part of CACAO.
Authors: Christian Thalinger
- $Id: options.c 1474 2004-11-11 10:09:10Z carolyn $
+ Changes:
+
+ $Id: options.c 3243 2005-09-21 14:55:34Z twisti $
*/
-#include "global.h"
+#include <string.h>
+
+#include "config.h"
+#include "vm/types.h"
+
+#include "vm/options.h"
+
+
+/* command line option ********************************************************/
+
+s4 opt_ind = 1; /* index of processed arguments */
+char *opt_arg; /* this one exports the option argument */
+#if defined(ENABLE_JIT)
+bool opt_jit = true; /* JIT mode execution (default) */
+bool opt_intrp = false; /* interpreter mode execution */
+#else
+bool opt_jit = false; /* JIT mode execution */
+bool opt_intrp = true; /* interpreter mode execution (default) */
+#endif
-/* command line option */
+s4 opt_stacksize = 0; /* thread stack size */
-bool verbose = false;
+bool opt_verbose = false;
bool compileall = false;
-bool runverbose = false; /* trace all method invocation */
+bool runverbose = false; /* trace all method invocation */
bool verboseexception = false;
-bool collectverbose = false;
bool loadverbose = false;
bool linkverbose = false;
bool initverbose = false;
+bool opt_verbosegc = false;
+bool opt_verbosejni = false;
-bool opt_rt = false; /* true if RTA parse should be used RT-CO */
-bool opt_xta = false; /* true if XTA parse should be used XTA-CO */
-bool opt_vta = false; /* true if VTA parse should be used VTA-CO */
+bool opt_rt = false; /* true if RTA parse should be used RT-CO */
+bool opt_xta = false; /* true if XTA parse should be used XTA-CO */
+bool opt_vta = false; /* true if VTA parse should be used VTA-CO */
-bool opt_liberalutf = false; /* Don't check overlong UTF-8 sequences */
+bool opt_liberalutf = false; /* Don't check overlong UTF-8 sequences */
bool showmethods = false;
bool showconstantpool = false;
bool showutf = false;
-bool compileverbose = false; /* trace compiler actions */
+bool compileverbose = false; /* trace compiler actions */
bool showstack = false;
-bool showdisassemble = false; /* generate disassembler listing */
-bool showddatasegment = false; /* generate data segment listing */
-bool showintermediate = false; /* generate intermediate code listing */
+bool opt_showdisassemble = false; /* generate disassembler listing */
+bool opt_showddatasegment = false; /* generate data segment listing */
+bool opt_showintermediate = false; /* generate intermediate code listing */
+bool opt_showexceptionstubs = false;
+bool opt_shownativestub = false;
bool useinliningm = false; /* use method inlining */
bool useinlining = false; /* use method inlining */
bool opt_stat = false;
bool opt_verify = true; /* true if classfiles should be verified */
bool opt_eager = false;
+#ifdef LSRA
+bool opt_lsra = false;
+#endif
+
+s4 opt_static_supers = 0x7fffffff;
+bool vm_debug = false; /* XXX this should be called `opt_trace' */
+
+
+/* get_opt *********************************************************************
+
+ DOCUMENT ME!!!
+
+*******************************************************************************/
+
+int get_opt(int argc, char **argv, opt_struct *opts)
+{
+ char *a;
+ s4 i;
+
+ if (opt_ind >= argc)
+ return OPT_DONE;
+
+ a = argv[opt_ind];
+
+ if (a[0] != '-')
+ return OPT_DONE;
+
+ for (i = 0; opts[i].name; i++) {
+ if (!opts[i].arg) {
+ /* boolean option found */
+
+ if (strcmp(a + 1, opts[i].name) == 0) {
+ opt_ind++;
+ return opts[i].value;
+ }
+
+ } else {
+ /* parameter option found */
+
+ /* with a space between */
+
+ if (strcmp(a + 1, opts[i].name) == 0) {
+ opt_ind++;
+
+ if (opt_ind < argc) {
+ opt_arg = argv[opt_ind];
+ opt_ind++;
+ return opts[i].value;
+ }
+
+ return OPT_ERROR;
+
+ } else {
+ /* parameter and option have no space between */
+
+ size_t l = strlen(opts[i].name);
+ if (strlen(a + 1) > l) {
+ if (memcmp(a + 1, opts[i].name, l) == 0) {
+ opt_ind++;
+ opt_arg = a + 1 + l;
+ return opts[i].value;
+ }
+ }
+ }
+ }
+ } /* end for */
+
+ return OPT_ERROR;
+}
/*