PIPS
io.c
Go to the documentation of this file.
1 /*
2 
3  $Id: io.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 transformer - IOs
28  *
29  * Francois Irigoin, 21 April 1990
30  */
31 
32 #include <stdio.h>
33 
34 #include "genC.h"
35 #include "misc.h"
36 #include "linear.h"
37 #include "ri.h"
38 #include "ri-util.h"
39 
40 #include "boolean.h"
41 #include "vecteur.h"
42 #include "contrainte.h"
43 #include "sc.h"
44 
45 #include "transformer.h"
46 
47 /* print_transformer(tf): not a macro because of dbx and gdb */
49 {
50  (void) fprint_transformer(stderr, tf,
52  return tf;
53 }
54 
55 /* For debugging without problem from temporary values */
57 {
58  return fprint_transformer(stderr, tf,
60 }
61 
63 {
64  return fprint_transformers(stderr, tl,
66 }
67 
70  transformer tf,
71  get_variable_name_t value_name)
72 {
73  /* print_transformer returns an int to be compatible with the debug()
74  function; however, debug being a function and not a macro, its
75  arguments are ALWAYS evaluated regardless of the debug level;
76  so a call to print_transformer passed as an argument to debug
77  is ALWAYS effective */
78 
79  if(tf==transformer_undefined)
80  (void) fprintf(stderr,"TRANSFORMER UNDEFINED\n");
81  // For debugging with gdb, dynamic type checking
83  (void) fprintf(stderr,"Arg. \"tf\"is not a transformer.\n");
84  }
85  else {
86  cons * args = transformer_arguments(tf);
88 
89  /* print argument list */
90  (void) fprintf(fd,"arguments:");
91  print_homogeneous_arguments(args, (const char* (*) (entity))value_name);
92 
93  /* print relation */
94  if(SC_UNDEFINED_P(sc))
95  pips_internal_error("undefined relation");
96  (void) fprintf(fd,"\nrelation:");
97  sc_fprint(fd,
98  sc,
99  value_name);
100  }
101 
102  return tf;
103 }
104 
106  list tl,
107  get_variable_name_t value_name)
108 {
109  if(ENDP(tl)) {
110  // FI: I changed my mind; this is a way to represent a non
111  //feasible transformer
112  //pips_internal_error("transformer lists should never be empty.");
113  fprintf(fd, "Empty transformer list\n");
114  }
115  else {
116  FOREACH(TRANSFORMER, tf, tl) {
117  fprint_transformer(fd, tf, value_name);
118  }
119  }
120  return tl;
121 }
122 
123 /* char * dump_value_name(e): used as functional argument because
124  * entity_name is a macro
125  *
126  * FI: should be moved in ri-util/entity.c
127  */
129 entity e;
130 {
131  return entity_name(e);
132 }
133 
135 transformer tf;
136 {
138 }
void print_homogeneous_arguments(list args, const char *variable_name(entity))
Functions dealing with entity lists.
Definition: arguments.c:54
#define ENDP(l)
Test if a list is empty.
Definition: newgen_list.h:66
#define FOREACH(_fe_CASTER, _fe_item, _fe_list)
Apply/map an instruction block on all the elements of a list.
Definition: newgen_list.h:179
#define pips_internal_error
Definition: misc-local.h:149
transformer fprint_transformer(FILE *fd, transformer tf, get_variable_name_t value_name)
Definition: io.c:69
char * dump_value_name(entity e)
char * dump_value_name(e): used as functional argument because entity_name is a macro
Definition: io.c:128
list fprint_transformers(FILE *fd, list tl, get_variable_name_t value_name)
Definition: io.c:105
void dump_transformer(transformer tf)
Definition: io.c:134
transformer print_transformer(transformer tf)
package transformer - IOs
Definition: io.c:48
transformer print_any_transformer(transformer tf)
For debugging without problem from temporary values.
Definition: io.c:56
list print_transformers(list tl)
Definition: io.c:62
const char * entity_local_name(entity e)
entity_local_name modified so that it does not core when used in vect_fprint, since someone thought t...
Definition: entity.c:453
#define transformer_undefined
Definition: ri.h:2847
#define TRANSFORMER(x)
TRANSFORMER.
Definition: ri.h:2841
#define transformer_domain_number(x)
Definition: ri.h:2869
#define transformer_domain
newgen_test_domain_defined
Definition: ri.h:426
#define entity_name(x)
Definition: ri.h:2790
#define transformer_relation(x)
Definition: ri.h:2873
#define transformer_arguments(x)
Definition: ri.h:2871
#define predicate_system(x)
Definition: ri.h:2069
struct Ssysteme * Psysteme
void sc_fprint(FILE *fp, Psysteme ps, get_variable_name_t nom_var)
void sc_fprint(FILE * f, Psysteme ps, char * (*nom_var)()): cette fonction imprime dans le fichier po...
Definition: sc_io.c:220
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...
The structure used to build lists in NewGen.
Definition: newgen_list.h:41
const char * external_value_name(entity)
Definition: value.c:753
char *(* get_variable_name_t)(Variable)
Definition: vecteur-local.h:62