PIPS
prettyprint.c
Go to the documentation of this file.
1 /*
2 
3  $Id: prettyprint.c 23412 2017-08-09 15:07:09Z irigoin $
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 /*
28  * package semantics - prettyprint interface
29  */
30 
31 #include <stdlib.h>
32 #include <stdio.h>
33 #include <stdlib.h>
34 #include <string.h>
35 
36 #include "genC.h"
37 
38 #include "text.h"
39 #include "text-util.h"
40 
41 #include "top-level.h"
42 
43 #include "linear.h"
44 #include "ri.h"
45 #include "effects.h"
46 #include "ri-util.h"
47 #include "workspace-util.h"
48 #include "effects-util.h"
49 
50 #include "callgraph.h"
51 
52 #include "database.h"
53 #include "pipsdbm.h"
54 #include "resources.h"
55 
56 #include "misc.h"
57 #include "properties.h"
58 
59 #include "prettyprint.h"
60 
61 #include "transformer.h"
62 #include "effects-generic.h"
63 
64 #include "semantics.h"
65 //#include "preprocessor.h"
66 
67 #define PREC_FORESYS_PREFIX "C$PREC"
68 #define TRAN_FORESYS_PREFIX "C$TRAN"
69 
71 
72 static bool is_transformer;
74 static bool is_user_view;
76 
78 {
79  is_transformer = true;
80  is_total_precondition = false;
82 }
83 
85 //static string non_feasible_system;
86 
87 static bool print_code_semantics();
88 static text get_semantic_text(const char*,bool);
89 
91 {
92  is_user_view = false;
93  is_transformer = true;
94  is_total_precondition = false;
97 }
98 
99 bool print_code_as_a_graph_transformers(const string mod_name)
100 {
101  bool success;
102 
103  set_bool_property("PRETTYPRINT_UNSTRUCTURED_AS_A_GRAPH", true);
104  success = print_code_transformers(mod_name);
105  set_bool_property("PRETTYPRINT_UNSTRUCTURED_AS_A_GRAPH", false);
106 
107  return success;
108 }
109 
111 {
112  is_user_view = false;
113  is_transformer = false;
114  is_total_precondition = false;
116  get_bool_property("SEMANTICS_FILTERED_PRECONDITIONS");
118 }
119 
120 bool print_code_as_a_graph_preconditions(const string mod_name)
121 {
122  bool success;
123 
124  set_bool_property("PRETTYPRINT_UNSTRUCTURED_AS_A_GRAPH", true);
125  success = print_code_preconditions(mod_name);
126  set_bool_property("PRETTYPRINT_UNSTRUCTURED_AS_A_GRAPH", false);
127 
128  return success;
129 }
130 
132 {
133  bool success;
134 
135  is_user_view = false;
136  is_transformer = false;
137  is_total_precondition = true;
139  get_bool_property("SEMANTICS_FILTERED_PRECONDITIONS");
141  return success;
142 }
143 
144 bool print_code_as_a_graph_total_preconditions(const string mod_name)
145 {
146  bool success;
147 
148  set_bool_property("PRETTYPRINT_UNSTRUCTURED_AS_A_GRAPH", true);
150  set_bool_property("PRETTYPRINT_UNSTRUCTURED_AS_A_GRAPH", false);
151 
152  return success;
153 }
154 
156 {
157  is_user_view = true;
158  is_transformer = true;
159  is_total_precondition = false;
160  is_transformer_filtered = false;
162 }
163 
165 {
166  is_user_view = true;
167  is_transformer = false;
168  is_total_precondition = false;
170  get_bool_property("SEMANTICS_FILTERED_PRECONDITIONS");
172 }
173 
175 {
176  is_user_view = true;
177  is_transformer = false;
178  is_total_precondition = true;
180  get_bool_property("SEMANTICS_FILTERED_PRECONDITIONS");
182 }
183 
185 {
186  is_user_view = false;
187  is_transformer = true;
188  is_total_precondition = false;
189  is_transformer_filtered = false;
190  return get_semantic_text(module_name,false);
191 }
192 
194 {
195  is_user_view = false;
196  is_transformer = false;
197  is_total_precondition = false;
199  get_bool_property("SEMANTICS_FILTERED_PRECONDITIONS");
200  return get_semantic_text(module_name,false);
201 }
202 
204 {
205  is_user_view = false;
206  is_transformer = false;
207  is_total_precondition = true;
209  get_bool_property("SEMANTICS_FILTERED_PRECONDITIONS");
210  return get_semantic_text(module_name,false);
211 }
212 
213 static bool print_code_semantics(const char* module_name)
214 {
215  bool success = true;
216  text t = text_undefined;
217 
218  char * file_ext =
222  :
228 
230  ("PRETTYPRINT_UNSTRUCTURED_AS_A_GRAPH") ?
231  GRAPH_FILE_EXT : "",
232 
233  /* To exploit the language sensitive prettyprint ability of the display */
235 
236  NULL));
237 
238  char * resource_name =
239  get_bool_property("PRETTYPRINT_UNSTRUCTURED_AS_A_GRAPH") ?
240  DBR_GRAPH_PRINTED_FILE :
241  (is_user_view? DBR_PARSED_PRINTED_FILE :
242  DBR_PRINTED_FILE);
243 
245  t = get_semantic_text(module_name,true);
248 
249  free_text(t);
250  free(file_ext);
251  return success;
252 }
253 
254 static text get_semantic_text(const char* module_name, bool give_code_p)
255 {
256  text r = make_text(NIL), txt_summary;
257  entity mod;
260  statement user_stat = statement_undefined;
261 
264 
266  ((statement)db_get_memory_resource(DBR_CODE, module_name, true) );
268 
269  /* To set up the hash table to translate value into value names */
272  (DBR_CUMULATED_EFFECTS, module_name, true));
275  (DBR_PROPER_EFFECTS, module_name, true));
276 
277  debug_on("SEMANTICS_PRINT_DEBUG_LEVEL");
278 
280 
281  if(is_user_view) {
282  user_stat = (statement)
283  db_get_memory_resource(DBR_PARSED_CODE, module_name, true);
284 
287 
289  }
290 
292  db_get_memory_resource(is_transformer? DBR_TRANSFORMERS:
294  DBR_TOTAL_PRECONDITIONS : DBR_PRECONDITIONS),
295  module_name, true));
296 
297  summary = (transformer)
298  db_get_memory_resource(is_transformer? DBR_SUMMARY_TRANSFORMER:
300  DBR_SUMMARY_TOTAL_PRECONDITION: DBR_SUMMARY_PRECONDITION),
301  module_name, true);
302  /* The summary precondition may be in another module's frame */
303  translate_global_values(mod, summary);
304 
306 
307  /* initial version; to be used again when prettyprint really prettyprints*/
308  /* print_text(fd, text_statement(mod, 0, mod_stat)); */
309 
310  /* summary information first */
311  txt_summary = text_transformer(summary);
312  ifdebug(7){
313  dump_text(txt_summary);
314  pips_debug(7, "summary text consistent? %s\n",
315  text_consistent_p(txt_summary)? "YES":"NO");
316  }
317  MERGE_TEXTS(r,txt_summary );
319  if (is_transformer) {
321  }
322  else if(is_total_precondition) {
324  }
325  else {
327  }
328 
329  if (give_code_p == true) {
330  MERGE_TEXTS(r, text_module(mod, is_user_view? user_stat:mod_stat));
331  }
332 
333  debug_off();
334 
335  if(is_user_view) {
338  }
339 
341 
347 
349 
350  return r;
351 }
352 
353 /* this function name is VERY misleading - it should be changed, sometime FI */
355  entity module,
356  int margin,
357  statement stmt)
358 {
359  transformer t;
360  text txt;
361 
362  pips_assert("To please the compiler", module==module && margin==margin);
363 
364  if(is_user_view) {
366 
367  if(!statement_undefined_p(i)) {
369  }
370  else
372  }
373  else
375 
377  && t != (transformer) HASH_UNDEFINED_VALUE) {
379  t = filter_transformer(t, ef);
380  }
381 
382  txt = text_transformer(t);
383 
384  if (is_transformer)
386  else if (is_total_precondition)
388  else
390 
391  return txt;
392 }
393 ␌
394 /* The strange argument type is required by qsort(), deep down in the
395  * calls.
396  *
397  * FI: what is it supposed to do? Is it allowed to return with
398  * equal==0, which leads to an assert failure later above
399  * vect_lexicographic_unsafe_compare_generic ().
400  */
401 static int
403 {
404  /* The constant term is given the highest weight to push constant
405  terms at the end of the constraints and to make those easy
406  to compare. If not, constant 0 will be handled differently from
407  other constants. However, it would be nice to give constant terms
408  the lowest weight to print simple constraints first...
409 
410  Either I define two comparison functions, or I cheat somewhere else.
411  Let's cheat? */
412  int is_equal = 0;
413 
414  if (term_cst(*pvarval1) && !term_cst(*pvarval2))
415  is_equal = 1;
416  else if (term_cst(*pvarval1) && term_cst(*pvarval2))
417  is_equal = 0;
418  else if(term_cst(*pvarval2))
419  is_equal = -1;
420  else {
421  is_equal =
422  strcmp(pips_user_value_name((entity) vecteur_var(*pvarval1)),
423  pips_user_value_name((entity) vecteur_var(*pvarval2)));
424  if(is_equal==0 && !vect_equal(*pvarval1, *pvarval2))
425  is_equal =
426  strcmp(entity_name((entity) vecteur_var(*pvarval1)),
427  entity_name((entity) vecteur_var(*pvarval2)));
428  }
429 
430  return is_equal;
431 }
432 
433 #define append(s) add_to_current_line(crt_line, s, str_prefix, txt)
434 
435 static bool __attribute__ ((unused))
436 value_is_inferior_pvarval(Pvecteur * pvarval1, Pvecteur * pvarval2)
437 {
438  bool is_inferior = true;
439 
440  if (term_cst(*pvarval1))
441  is_inferior = false;
442  else if(term_cst(*pvarval2))
443  is_inferior = true;
444  else
445  is_inferior = (strcmp(external_value_name((entity) vecteur_var(*pvarval1)),
446  external_value_name((entity) vecteur_var(*pvarval2)))
447  > 0 );
448 
449  return is_inferior;
450 }
451 ␌
452 /* text text_transformer(transformer tran)
453  * input : a transformer representing a transformer or a precondition
454  * output : a text containing commentaries representing the transformer
455  * modifies : nothing.
456  *
457  * Modification: AP, Nov 10th, 1995. Instead of building a (very long)
458  * string, I directly use the transformer to build the prettyprint in text
459  * format. This is to avoid the problem occuring when the buffer used in
460  * transformer[precondition]_to_string() is too small. I also use a static
461  * buffer to build each constraint; we are restricted to constraints of
462  * lengths smaller than the line length.
463  */
465 {
466  text txt = make_text(NIL);
467  bool foresys = get_bool_property("PRETTYPRINT_FOR_FORESYS");
468  string str_prefix;
469  char crt_line[MAX_LINE_LENGTH];
470 
471  /* If in EMACS mode, does not add any separator line: */
472  if (get_bool_property("PRETTYPRINT_ANALYSES_WITH_LF")
473  && !get_bool_property("PRETTYPRINT_ADD_EMACS_PROPERTIES"))
475  strdup("\n")));
476 
477  str_prefix = foresys? FORESYS_CONTINUATION_PREFIX: get_comment_continuation();
478  crt_line[0] = '\0';
479 
480  if (foresys)
482  else
484 
485  if(tran != (transformer) HASH_UNDEFINED_VALUE &&
486  tran != (transformer) list_undefined) {
487  if(tran==transformer_undefined) {
488  if (is_transformer)
489  append(" TRANSFORMER: TRANSFORMER_UNDEFINED");
490  else if(is_total_precondition)
491  append(" TOTAL PRECONDITION: TRANSFORMER_UNDEFINED");
492  else
493  append(" PRECONDITION: TRANSFORMER_UNDEFINED");
494  }
495  else {
496  Psysteme ps;
497  list args = transformer_arguments(tran);
498 
499  append(is_transformer? " T(": (is_total_precondition? " TP(" : " P("));
500 
501  entity_list_text_format(crt_line, str_prefix, txt,
502  args, entity_minimal_name);
503 
504  append(")");
505  if (foresys) append(",");
506  append(" ");
507 
510 
511  ifdebug(7) {
512  pips_debug(7, "sys %p\n", ps);
513  sc_syst_debug(ps);
514  }
515 
516  system_text_format(crt_line, str_prefix, txt, ps,
517  (char * (*)(Variable)) pips_user_value_name, foresys);
518 
519  sc_rm(ps);
520  }
521 
522  close_current_line(crt_line, txt, str_prefix);
523  }
524 
525  if (get_bool_property("PRETTYPRINT_ANALYSES_WITH_LF")
526  && !get_bool_property("PRETTYPRINT_ADD_EMACS_PROPERTIES"))
528  strdup("\n")));
529 
530  ifdebug(7){
531  pips_debug(7, "final txt: \n");
532  dump_text(txt);
533  }
534 
535  return txt;
536 }
537 ␌
538 /* call this one from outside.
539  */
540 text text_for_a_transformer(transformer tran, bool is_a_transformer)
541 {
542  bool save_is_transformer = is_transformer;
543  bool save_is_total_precondition = is_total_precondition;
544  text t = text_undefined;
545 
546  is_transformer = is_a_transformer;
547  is_total_precondition = false;
548  t = text_transformer(tran);
549  is_transformer = save_is_transformer;
550  is_total_precondition = save_is_total_precondition;
551  return t;
552 }
553 
554 ␌
555 /* ---------------------------------------------------------------- */
556 /* to convert strings containing predicates to text of commentaries */
557 /* BA, april 1994 */
558 /* ---------------------------------------------------------------- */
559 
560 #define MAX_PRED_COMMENTARY_STRLEN 70
561 
562 
563 /* text string_predicate_to_commentary(string str_pred, string comment_prefix)
564  * input : a string, part of which represents a predicate.
565  * output : a text consisting of several lines of commentaries,
566  * containing the string str_pred, and beginning with
567  * comment_prefix.
568  * modifies : str_pred;
569  */
570 text string_predicate_to_commentary(str_pred, comment_prefix)
571 string str_pred;
572 string comment_prefix;
573 {
574  text t_pred = make_text(NIL);
575  string str_suiv = NULL;
576  string str_prefix = comment_prefix;
577  char str_tmp[MAX_PRED_COMMENTARY_STRLEN];
578  int len, new_str_pred_len, longueur_max;
579  bool premiere_ligne = true;
580  bool foresys = get_bool_property("PRETTYPRINT_FOR_FORESYS");
581  longueur_max = MAX_PRED_COMMENTARY_STRLEN - strlen(str_prefix) - 2;
582 
583  /* if str_pred is too long, it must be splitted in several lines;
584  * the hyphenation must be done only between the constraints of the
585  * predicate, when there is a "," or a ")". A space is added at the beginning
586  * of extra lines, for indentation. */
587  while((len = strlen(str_pred)) > 0) {
588  if (len > longueur_max) {
589 
590  /* search the maximal substring which length
591  * is less than longueur_max */
592  str_tmp[0] = '\0';
593  (void) strncat(str_tmp, str_pred, longueur_max);
594 
595  if (foresys)
596  str_suiv = strrchr(str_tmp, ')');
597  else
598  str_suiv = strrchr(str_tmp, ',');
599 
600  new_str_pred_len = (strlen(str_tmp) - strlen(str_suiv)) + 1;
601  str_suiv = strdup(&(str_pred[new_str_pred_len]));
602 
603  str_tmp[0] = '\0';
604  if (!premiere_ligne)
605  (void) strcat(str_tmp, " ");
606  (void) strncat(str_tmp, str_pred, new_str_pred_len);
607 
608  /* add it to the text */
609  ADD_SENTENCE_TO_TEXT(t_pred,
611  str_prefix));
612  str_pred = str_suiv;
613  }
614  else {
615  /* if the remaining string fits in one line */
616  str_tmp[0] = '\0';
617  if (!premiere_ligne)
618  (void) strcat(str_tmp, " ");
619  (void) strcat(str_tmp, str_pred);
620 
621  ADD_SENTENCE_TO_TEXT(t_pred,
623  str_prefix));
624  str_pred[0] = '\0';
625  }
626 
627  if (premiere_ligne) {
628  premiere_ligne = false;
629  longueur_max = longueur_max - 1;
630  if (foresys){
631  int i;
632  int nb_espaces = strlen(str_prefix) -
634 
635  str_prefix = strdup(str_prefix);
636  str_prefix[0] = '\0';
637  (void) strcat(str_prefix, FORESYS_CONTINUATION_PREFIX);
638  for (i=1; i <= nb_espaces; i++)
639  (void) strcat(str_prefix, " ");
640  }
641  }
642  }
643 
644  return(t_pred);
645 }
646 
647 /* text words_predicate_to_commentary(list w_pred, string comment_prefix)
648  * input : a list of strings, one of them representing a predicate.
649  * output : a text of several lines of commentaries containing
650  * this list of strings, and beginning with comment_prefix.
651  * modifies : nothing.
652  */
653 text words_predicate_to_commentary(w_pred, comment_prefix)
654 list w_pred;
655 string comment_prefix;
656 {
657  string str_pred;
658  text t_pred;
659 
660  /* str_pred is the string corresponding to the concatenation
661  * of the strings in w_pred */
662  str_pred = words_to_string(w_pred);
663 
664  t_pred = string_predicate_to_commentary(str_pred, comment_prefix);
665 
666  return(t_pred);
667 }
668 
669 
670 /* sentence make_pred_commentary_sentence(string str_pred,
671  * string comment_prefix)
672  * input : a substring formatted to be a commentary
673  * output : a sentence, containing the commentary form of this string,
674  * beginning with the comment_prefix.
675  * modifies : nothing
676  */
677 sentence
678 make_pred_commentary_sentence(str_pred, comment_prefix)
679 string str_pred;
680 string comment_prefix;
681 {
682  /*
683  char str_tmp[MAX_PRED_COMMENTARY_STRLEN + 1];
684 
685  str_tmp[0] = '\0';
686  (void) strcat(str_tmp, comment_prefix);
687  (void) strcat(str_tmp, " ");
688  (void) strcat(str_tmp, str_pred);
689  (void) strcat(str_tmp, "\n");
690  */
691  char * str_tmp = NULL;
692  sentence sent_pred = sentence_undefined;
693 
694  str_tmp = strdup(concatenate(comment_prefix, " ", str_pred, "\n", NULL));
695  sent_pred = make_sentence_formatted(str_tmp);
696  return(sent_pred);
697 }
698 
699 /*
700  * Print callgraph with transformers
701  */
703 {
704  bool success = false;
706  return success;
707 }
708 
709 /*
710  * Print callgraph with preconditions
711  */
713 {
714  bool success = false;
716  return success;
717 }
718 
719 /*
720  * Print callgraph with preconditions
721  */
723 {
724  bool success = false;
727  return success;
728 }
729 
730 /********************************************************************** ICFG */
731 
732 #include "pips-libs.h"
733 #ifdef HAVE_PIPS_icfg_LIBRARY
734 #include "icfg.h"
735 
737 {
738  return generic_print_icfg_precise(module_name, false, false, false,
740 }
741 
742 bool print_icfg_with_transformers(const string module_name)
743 {
744  return generic_print_icfg(module_name, false, false, false,
746 }
747 
749 {
750  return generic_print_icfg_precise(module_name, false, true, false,
752 }
753 
755 {
756  return generic_print_icfg(module_name, false, true, false,
758 }
759 
761 {
762  return generic_print_icfg_precise(module_name, true, true, false,
764 }
765 
767 {
768  return generic_print_icfg(module_name, true, true, false,
770 }
771 
773 {
774  pips_internal_error("on %s -- not implemented", module_name);
775  return false;
776 }
777 
779 {
780  pips_internal_error("on %s -- not implemented", module_name);
781  return false;
782 }
783 
785 {
786  pips_internal_error("on %s -- not implemented", module_name);
787  return false;
788 }
789 
790 #endif // HAVE_PIPS_icfg_LIBRARY
sentence make_sentence_formatted(string _field_)
Definition: text.c:62
bool text_consistent_p(text p)
Definition: text.c:80
sentence make_sentence(enum sentence_utype tag, void *val)
Definition: text.c:59
text make_text(list a)
Definition: text.c:107
void free_text(text p)
Definition: text.c:74
void attach_transformers_decoration_to_text(text t)
Attach a transformers decoration:
void attach_preconditions_decoration_to_text(text t)
Attach a preconditions decoration:
void attach_decoration_to_text(text t)
Attach a decoration:
void begin_attachment_prettyprint(void)
The translation functions between unique names and objects:
void end_attachment_prettyprint(void)
Clean the things related with the attachment of properties:
void attach_total_preconditions_decoration_to_text(text __attribute__((unused)) t)
Attach a total preconditions decoration:
bool print_decorated_call_graph(const string, text(*)(const string))
Definition: print.c:64
struct _newgen_struct_statement_ * statement
Definition: cloning.h:21
void entity_list_text_format(string line, string continuation, text t, list le, const char *(*var_name)(entity))
appends the list of entity...
void system_text_format(string line, string prefix, text txt, Psysteme ps, string(*variable_name)(Variable), bool a_la_fortran)
appends ps to line/txt with prefix continuations.
void sc_syst_debug(Psysteme s)
constraint_to_text.c
#define resource_name(x)
Definition: database.h:108
void reset_proper_rw_effects(void)
void set_proper_rw_effects(statement_effects)
void set_cumulated_rw_effects(statement_effects)
list load_cumulated_rw_effects_list(statement)
void reset_cumulated_rw_effects(void)
const char * module_name(const char *s)
Return the module part of an entity name.
Definition: entity_names.c:296
bool get_bool_property(const string)
FC 2015-07-20: yuk, moved out to prevent an include cycle dependency include "properties....
void free(void *)
bool success
Definition: gpips-local.h:59
void reset_current_module_entity(void)
Reset the current module entity.
Definition: static.c:97
void reset_current_module_statement(void)
Reset the current module statement.
Definition: static.c:221
statement set_current_module_statement(statement)
Set the current module statement.
Definition: static.c:165
statement get_current_module_statement(void)
Get the current module statement.
Definition: static.c:208
entity set_current_module_entity(entity)
static.c
Definition: static.c:66
entity get_current_module_entity(void)
Get the entity of the current module.
Definition: static.c:85
#define NIL
The empty list (nil in Lisp)
Definition: newgen_list.h:47
#define list_undefined
Undefined list definition :-)
Definition: newgen_list.h:69
string db_get_memory_resource(const char *rname, const char *oname, bool pure)
Return the pointer to the resource, whatever it is.
Definition: database.c:755
statement apply_number_to_statement(hash_table, _int)
Definition: statement.c:1495
hash_table allocate_number_to_statement(void)
Definition: statement.c:1540
hash_table build_number_to_statement(hash_table, statement)
Definition: statement.c:1516
void hash_table_free(hash_table htp)
this function deletes a hash table that is no longer useful.
Definition: hash.c:327
bool generic_print_icfg(const string, bool, bool, bool, text(*)(const string))
Definition: icfg_scan.c:713
bool generic_print_icfg_precise(const string, bool, bool, bool, text(*)(entity, entity, statement, call))
Definition: icfg_scan.c:724
static statement mod_stat
We want to keep track of the current statement inside the recurse.
Definition: impact_check.c:41
bool vect_equal(Pvecteur v1, Pvecteur v2)
bool vect_equal(Pvecteur v1, Pvecteur v2): test a egalite de deux vecteurs
Definition: reductions.c:278
#define debug_on(env)
Definition: misc-local.h:157
#define pips_debug
these macros use the GNU extensions that allow variadic macros, including with an empty list.
Definition: misc-local.h:145
#define pips_assert(what, predicate)
common macros, two flavors depending on NDEBUG
Definition: misc-local.h:172
#define pips_internal_error
Definition: misc-local.h:149
#define debug_off()
Definition: misc-local.h:160
const char * entity_minimal_name(entity e)
Do preserve scope informations.
Definition: naming.c:214
#define DEFINE_CURRENT_MAPPING(name, type)
Definition: newgen-local.h:58
string concatenate(const char *,...)
Return the concatenation of the given strings.
Definition: string.c:183
#define HASH_UNDEFINED_VALUE
value returned by hash_get() when the key is not found; could also be called HASH_KEY_NOT_FOUND,...
Definition: newgen_hash.h:56
#define hash_table_undefined
Value of an undefined hash_table.
Definition: newgen_hash.h:49
static char * module
Definition: pips.c:74
string get_comment_sentinel()
Start a single line comment.
Definition: misc.c:154
string get_comment_continuation()
Start a single line comment with continuation (blank spaces)
Definition: misc.c:167
void close_prettyprint()
because some prettyprint functions may be used for debug, so the last hook set by somebody may have s...
Definition: misc.c:242
void init_prettyprint(text(*hook)(entity, int, statement))
checks that the prettyprint hook was actually reset...
Definition: misc.c:231
text text_module(entity, statement)
void print_number_to_statement(hash_table)
Definition: statement.c:209
bool make_text_resource(const char *, const char *, const char *, text)
print.c
Definition: print.c:55
void set_bool_property(const char *, bool)
bool c_module_p(entity m)
Test if a module "m" is written in C.
Definition: entity.c:2777
entity module_name_to_entity(const char *mn)
This is an alias for local_name_to_top_level_entity.
Definition: entity.c:1479
#define transformer_undefined
Definition: ri.h:2847
#define transformer_undefined_p(x)
Definition: ri.h:2848
#define entity_name(x)
Definition: ri.h:2790
#define transformer_relation(x)
Definition: ri.h:2873
#define transformer_arguments(x)
Definition: ri.h:2871
struct _newgen_struct_transformer_ * transformer
Definition: ri.h:431
#define statement_undefined_p(x)
Definition: ri.h:2420
#define statement_number(x)
Definition: ri.h:2452
#define predicate_system(x)
Definition: ri.h:2069
#define statement_undefined
Definition: ri.h:2419
transformer filter_transformer(transformer t, list e)
Previous version of effects_to_transformer() transformer effects_to_transformer(list e) { list args =...
void sc_rm(Psysteme ps)
void sc_rm(Psysteme ps): liberation de l'espace memoire occupe par le systeme de contraintes ps;
Definition: sc_alloc.c:277
Psysteme sc_copy(Psysteme ps)
Psysteme sc_copy(Psysteme ps): duplication d'un systeme (allocation et copie complete des champs sans...
Definition: sc_alloc.c:230
char * strdup()
void sc_lexicographic_sort(Psysteme sc, int(*compare)(Pvecteur *, Pvecteur *))
Minimize first the lexico-graphic weight of each constraint according to the comparison function "com...
Definition: sc_unaires.c:206
#define SEQUENTIAL_PRECONDITION_SUFFIX
#define SEQUENTIAL_TOTAL_PRECONDITION_SUFFIX
#define USER_TOTAL_PRECONDITION_SUFFIX
#define USER_PRECONDITION_SUFFIX
#define SEQUENTIAL_TRANSFORMER_SUFFIX
#define USER_TRANSFORMER_SUFFIX
void translate_global_values(entity m, transformer tf)
text call_site_to_module_precondition_text(entity caller, entity callee, statement s, call c)
This function does everything needed.
void module_to_value_mappings(entity m)
void module_to_value_mappings(entity m): build hash tables between variables and values (old,...
Definition: mappings.c:624
static bool is_total_precondition
Definition: prettyprint.c:73
static bool is_transformer
Definition: prettyprint.c:72
static int semantics_is_inferior_pvarval(Pvecteur *pvarval1, Pvecteur *pvarval2)
The strange argument type is required by qsort(), deep down in the calls.
Definition: prettyprint.c:402
bool print_source_transformers(const char *module_name)
Definition: prettyprint.c:155
bool print_code_total_preconditions(const char *module_name)
Definition: prettyprint.c:131
#define PREC_FORESYS_PREFIX
Definition: prettyprint.c:67
text text_for_a_transformer(transformer tran, bool is_a_transformer)
call this one from outside.
Definition: prettyprint.c:540
bool print_call_graph_with_total_preconditions(const string module_name)
Definition: prettyprint.c:722
void set_prettyprint_transformer(void)
Definition: prettyprint.c:77
sentence make_pred_commentary_sentence(string str_pred, string comment_prefix)
sentence make_pred_commentary_sentence(string str_pred, string comment_prefix) input : a substring fo...
Definition: prettyprint.c:678
text get_text_total_preconditions(const string module_name)
Definition: prettyprint.c:203
static bool is_user_view
Definition: prettyprint.c:74
bool print_call_graph_with_transformers(const string module_name)
Definition: prettyprint.c:702
bool print_code_as_a_graph_total_preconditions(const string mod_name)
Definition: prettyprint.c:144
bool print_code_transformers(const char *module_name)
Definition: prettyprint.c:90
text string_predicate_to_commentary(string str_pred, string comment_prefix)
text string_predicate_to_commentary(string str_pred, string comment_prefix) input : a string,...
Definition: prettyprint.c:570
bool print_call_graph_with_preconditions(const string module_name)
Definition: prettyprint.c:712
static text get_semantic_text(const char *, bool)
Definition: prettyprint.c:254
bool print_code_as_a_graph_transformers(const string mod_name)
Definition: prettyprint.c:99
bool print_source_preconditions(const char *module_name)
Definition: prettyprint.c:164
text semantic_to_text(entity module, int margin, statement stmt)
this function name is VERY misleading - it should be changed, sometime FI
Definition: prettyprint.c:354
bool print_code_preconditions(const char *module_name)
Definition: prettyprint.c:110
bool print_code_as_a_graph_preconditions(const string mod_name)
Definition: prettyprint.c:120
static bool is_transformer_filtered
Definition: prettyprint.c:75
static hash_table nts
Definition: prettyprint.c:84
text words_predicate_to_commentary(list w_pred, string comment_prefix)
text words_predicate_to_commentary(list w_pred, string comment_prefix) input : a list of strings,...
Definition: prettyprint.c:653
#define TRAN_FORESYS_PREFIX
Definition: prettyprint.c:68
text text_transformer(transformer tran)
text text_transformer(transformer tran) input : a transformer representing a transformer or a precond...
Definition: prettyprint.c:464
bool print_source_total_preconditions(const char *module_name)
Definition: prettyprint.c:174
#define append(s)
Definition: prettyprint.c:433
text get_text_preconditions(const string module_name)
Definition: prettyprint.c:193
text get_text_transformers(const string module_name)
Definition: prettyprint.c:184
static bool print_code_semantics()
static bool __attribute__((unused))
Definition: prettyprint.c:435
#define MAX_PRED_COMMENTARY_STRLEN
to convert strings containing predicates to text of commentaries
Definition: prettyprint.c:560
bool print_icfg_with_loops_total_preconditions(const string)
transformer load_statement_semantic(statement)
bool print_icfg_with_preconditions(const string)
bool print_icfg_with_total_preconditions(const string)
void set_semantic_map(statement_mapping)
bool print_icfg_with_control_preconditions(const string)
bool print_icfg_with_control_transformers(const string)
void reset_semantic_map(void)
bool print_icfg_with_loops_transformers(const string)
bool print_icfg_with_loops_preconditions(const string)
bool print_icfg_with_transformers(const string)
bool print_icfg_with_control_total_preconditions(const string)
#define ifdebug(n)
Definition: sg.c:47
le type des coefficients dans les vecteurs: Value est defini dans le package arithmetique
Definition: vecteur-local.h:89
The structure used to build lists in NewGen.
Definition: newgen_list.h:41
Definition: statement.c:54
#define FORESYS_CONTINUATION_PREFIX
#define MERGE_TEXTS(r, t)
#define ADD_SENTENCE_TO_TEXT(t, p)
#define MAX_LINE_LENGTH
maximum length of a line when prettyprinting...
string words_to_string(cons *lw)
Definition: print.c:211
void dump_text(text t)
FI: print_text() should be fprint_text() and dump_text(), print_text()
Definition: print.c:205
void close_current_line(string, text, string)
Definition: util.c:235
#define sentence_undefined
Definition: text.h:42
#define text_undefined
Definition: text.h:91
@ is_sentence_formatted
Definition: text.h:57
const char * external_value_name(entity)
Definition: value.c:753
const char * pips_user_value_name(entity)
This function is called many times when the constraints and the system of constraints are sorted usin...
Definition: value.c:815
void free_value_mappings(void)
Normal call to free the mappings.
Definition: value.c:1212
#define vecteur_var(v)
void * Variable
arithmetique is a requirement for vecteur, but I do not want to inforce it in all pips files....
Definition: vecteur-local.h:60
#define term_cst(varval)