GNU header update.
[cacao.git] / src / vm / options.c
index f4d9b8ee6a27e4ca056bdc15972255fb8e869447..8d1d567480b291748ef5a47b70d88421c4b64bbc 100644 (file)
@@ -1,10 +1,9 @@
 /* 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 1223 2004-06-30 19:13:00Z twisti $
+   $Id: options.c 1735 2004-12-07 14:33:27Z twisti $
 
 */
 
 
-#include "global.h"
+#include <string.h>
+#include "options.h"
+#include "types.h"
 
 
 /* command line option */
 
-bool verbose = false;
+bool opt_verbose = false;
 bool compileall = false;
 bool runverbose = false;       /* trace all method invocation                */
 bool verboseexception = false;
@@ -63,6 +64,7 @@ bool showdisassemble = false;  /* generate disassembler listing              */
 bool showddatasegment = false; /* generate data segment listing              */
 bool showintermediate = false; /* generate intermediate code listing         */
 
+bool useinliningm = false;      /* use method inlining                        */
 bool useinlining = false;      /* use method inlining                        */
 bool inlinevirtuals = false;   /* inline unique virtual methods              */
 bool inlineexceptions = false; /* inline methods, that contain excptions     */
@@ -85,6 +87,63 @@ int has_ext_instr_set = 0;     /* has instruction set extensions */
 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
+int opt_ind = 1;               /* index of processed arguments               */
+char *opt_arg;                 /* this one exports the option argument       */
+
+
+/* get_opt *********************************************************************
+
+   DOCUMENT ME!!!
+
+*******************************************************************************/
+
+int get_opt(int argc, char **argv, opt_struct *opts)
+{
+       char *a;
+       int 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) {
+                       if (strcmp(a + 1, opts[i].name) == 0) { /* boolean option found */
+                               opt_ind++;
+                               return opts[i].value;
+                       }
+
+               } else {
+                       if (strcmp(a + 1, opts[i].name) == 0) { /* parameter option found */
+                               opt_ind++;
+                               if (opt_ind < argc) {
+                                       opt_arg = argv[opt_ind];
+                                       opt_ind++;
+                                       return opts[i].value;
+                               }
+                               return OPT_ERROR;
+
+                       } else {
+                               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;
+}
 
 
 /*