PIPS
options.c
Go to the documentation of this file.
1 /*
2 
3  $Id: options.c 23065 2016-03-02 09:05:50Z coelho $
4 
5  Copyright 1989-2016 MINES ParisTech
6 
7  This file is part of PIPS.
8 
9  PIPS is free software: you can redistribute it and/or modify it
10  under the terms of the GNU General Public License as published by
11  the Free Software Foundation, either version 3 of the License, or
12  any later version.
13 
14  PIPS is distributed in the hope that it will be useful, but WITHOUT ANY
15  WARRANTY; without even the implied warranty of MERCHANTABILITY or
16  FITNESS FOR A PARTICULAR PURPOSE.
17 
18  See the GNU General Public License for more details.
19 
20  You should have received a copy of the GNU General Public License
21  along with PIPS. If not, see <http://www.gnu.org/licenses/>.
22 
23 */
24 #ifdef HAVE_CONFIG_H
25  #include "pips_config.h"
26 #endif
27  /* package hyperplane
28  *
29  * Yi-qing Yang, June 1990
30  */
31 
32 #include <stdio.h>
33 
34 #include "genC.h"
35 #include "linear.h"
36 #include "ri.h"
37 #include "ri-util.h"
38 #include "constants.h"
39 
40 #include "misc.h"
41 
42 #include "arithmetique.h"
43 #include "boolean.h"
44 #include "vecteur.h"
45 #include "contrainte.h"
46 #include "sc.h"
47 
48 #include "properties.h"
49 #include "hyperplane.h"
50 
51 /* analyzes command line options and returns the index of the first argument
52  * in argv[]
53  */
55 int argc;
56 char * argv[];
57 {
58  int errflg = 0;
59  char * options = HYPERPLANE_OPTIONS;
60  bool truth = true;
61  char c;
62  extern char * optarg;
63  extern int optind;
64 
65  /* get Pips default properties */
67 
68  /* set semantics default properties */
71 
72  /* check and set execution parameters; should be done with
73  pips_flag_get() from the parameters package to avoid inconsistencies */
74  while((c=getopt(argc,argv,options))!=-1) {
75  switch(c) {
76  case '-':
77  /* let's take care of that later */
78  ;
79  case 'O':
81  break;
82  case 't':
84  break;
85  case 'c':
87  break;
88  case 'i':
90  break;
91  case 'f':
93  break;
94  case 'e':
96  if(truth) {
97  /* implied flags, non resettable */
100  }
101  break;
102  case 'o':
103  /* set_bool_property(ONE_TRIP_DO, truth); */
104  break;
105  case 'd':
107  if(truth)
108  /* this implies flow sensitivity, i.e. convex hull
109  computation; non resettable */
111  break;
112  case 'D':
113  if(!truth)
114  /* debug level cannot be inversed, but can be zeroed */
116  else {
117  int semantics_debug_level = atoi(optarg);
118  /* a 0 debug level is equivalent to no debug
119  a negative debug level is meaningless */
120  if(semantics_debug_level<=0) errflg++;
122  semantics_debug_level);
123  }
124  break;
125  case '?':
126  default:
127  errflg++;
128  }
129  /* set/reset truth */
130  truth = (c != '-');
131  }
132 
133  /* two parameters at least are needed */
134  if (argc - optind < 2 || errflg != 0)
135  user_error("semantics_main",
136  "usage: %s [-tcife[D nn]] program module [module ...]\n",
137  argv[0]);
138 
139 
140  /*
141  (void) fprintf(stderr,"semantics_main semantics_debug_level = %d\n",
142  semantics_debug_level);
143  (void) fprintf(stderr,"semantics_main argc = %d, optind=%d \n",
144  argc, optind);
145  */
146 
147  return optind;
148 }
#define HYPERPLANE_OPTIONS
package hyperplane
#define user_error(fn,...)
Definition: misc-local.h:265
int set_hyperplane_parameters(int argc, argv)
package hyperplane
Definition: options.c:54
#define PRETTYPRINT_TRANSFORMER
#define SEMANTICS_FIX_POINT
#define pips_flag_p(p)
for upwards compatibility with Francois's modified version
#define SEMANTICS_FLOW_SENSITIVE
#define SEMANTICS_DEBUG_LEVEL
#define SEMANTICS_STDOUT
#define SEMANTICS_INTERPROCEDURAL
#define PRETTYPRINT_EXECUTION_CONTEXT
#define SEMANTICS_INEQUALITY_INVARIANT
void set_bool_property(const char *, bool)
void set_int_property(const char *, int)
int optind
char * optarg