PIPS
html_prettyprinter.c File Reference
#include <stdio.h>
#include <ctype.h>
#include "genC.h"
#include "linear.h"
#include "misc.h"
#include "pipsdbm.h"
#include "properties.h"
#include "ri-util.h"
+ Include dependency graph for html_prettyprinter.c:

Go to the source code of this file.

Macros

#define NL   "\n"
 
#define current_module_is_a_function()   (entity_function_p(get_current_module_entity()))
 
#define html_print(format, args...)
 

Functions

static void html_print_expression (expression e, bool cr)
 
static void html_print_range (range r)
 
static void html_print_statement (statement r)
 
static void html_print_type (type t)
 
static void html_print_value (value v)
 
static void html_set_output (FILE *new_fp)
 
static void begin_block (const char *block, bool cr)
 
static void end_block (const char *block, bool cr)
 
void html_output (const char *out, bool cr)
 html_prettyprinter.c More...
 
static void html_print_entity_name (entity e)
 
static void html_print_ram (ram r)
 
static void html_print_formal (formal f)
 
static void html_print_rom (_UNUSED_ unit r)
 
static void html_print_code (code c)
 
static void html_print_storage (storage s)
 
static void html_print_basic (basic b)
 
static void html_print_area (area a)
 
static void html_print_qualifier (qualifier q)
 
static void html_print_dimension (dimension d)
 
static void html_print_variable (variable v)
 
static void html_print_mode (mode m)
 
static void html_print_parameter (parameter p)
 
static void html_print_functional (functional f)
 
static void html_print_constant (constant c)
 
void html_print_entity_full (entity e)
 
static void html_print_call (call c)
 
static void html_print_unstructured (_UNUSED_ unstructured u)
 
static void html_print_reference (reference r)
 
static void html_print_subscript (subscript s)
 
static void html_print_loop (loop l)
 
static void html_print_whileloop (whileloop w)
 
static void html_print_forloop (forloop f)
 
static void html_print_sequence (sequence seq)
 
static void html_print_test (test t)
 
void html_print_symbol_table (void)
 
bool html_prettyprint (const string mod_name)
 
bool html_prettyprint_symbol_table (const string module)
 

Variables

static FILE * out_fp = 0
 

Macro Definition Documentation

◆ current_module_is_a_function

#define current_module_is_a_function ( )    (entity_function_p(get_current_module_entity()))

Definition at line 59 of file html_prettyprinter.c.

◆ html_print

#define html_print (   format,
  args... 
)
Value:
{ \
pips_assert("Output is set",out_fp); \
fprintf(out_fp,format,##args); \
}
static FILE * out_fp

Definition at line 79 of file html_prettyprinter.c.

◆ NL

#define NL   "\n"

Definition at line 56 of file html_prettyprinter.c.

Function Documentation

◆ begin_block()

static void begin_block ( const char *  block,
bool  cr 
)
static

◆ end_block()

◆ html_output()

void html_output ( const char *  out,
bool  cr 
)

html_prettyprinter.c

Parameters
outut
crr

Definition at line 105 of file html_prettyprinter.c.

105  {
106  if(cr) {
107  html_print("<li><span>%s</span></li>" NL, out);
108  } else {
109  html_print("<li class=\"inlined\"><span>%s</span></li>" NL, out);
110  }
111 }
static FILE * out
Definition: alias_check.c:128

References html_print, NL, and out.

Referenced by html_print_area(), html_print_basic(), html_print_constant(), html_print_entity_full(), html_print_entity_name(), html_print_expression(), html_print_formal(), html_print_mode(), html_print_parameter(), html_print_qualifier(), html_print_ram(), html_print_rom(), html_print_statement(), html_print_storage(), html_print_type(), html_print_unstructured(), html_print_value(), and html_print_whileloop().

+ Here is the caller graph for this function:

◆ html_prettyprint()

bool html_prettyprint ( const string  mod_name)

Set the current module entity required to have many things working in PIPS:

The debug is now controled by this environment variable name:

Print current module

Parameters
mod_nameod_name

Definition at line 818 of file html_prettyprinter.c.

819 {
820 
822  mod_name,
823  true);
824 
826 
827  /* Set the current module entity required to have many things
828  working in PIPS: */
830 
831 
832  /* The debug is now controled by this environment variable name: */
833  debug_on("HTML_PRETTYPRINT_DEBUG_LEVEL");
834  pips_assert("Statement should be OK at entry...",
836 
837  // Prepare the output file
838  string html_file_name = db_build_file_resource_name( "RI", mod_name, ".ri.html" );
839  string output_file = strdup( concatenate( db_get_current_workspace_directory( ),
840  "/",
841  html_file_name,
842  NULL ) );
843  pips_debug(2,"Output in %s",output_file);
844  FILE *fp = safe_fopen( output_file, "w" );
845  html_set_output(fp);
846 
847  /* Print current module */
848  html_print(NL "<li><ul class=\"module\">" NL);
849  begin_block(mod_name, true);
851  end_block(mod_name, true);
852  html_print("<li class=\"endmodule\">&nbsp;</li>" NL "</ul></li>" NL);
853 
854 
855  if(get_bool_property("HTML_PRETTYPRINT_SYMBOL_TABLE")) {
857  }
858 
859  // Reset output file
860  html_set_output(0);
861  safe_fclose( fp, output_file );
862 
863 
864  DB_PUT_FILE_RESOURCE( DBR_HTML_IR_FILE, strdup( mod_name ), html_file_name );
865 
868 
869  return true;
870 }
bool statement_consistent_p(statement p)
Definition: ri.c:2195
static statement module_statement
Definition: alias_check.c:125
struct _newgen_struct_statement_ * statement
Definition: cloning.h:21
FILE * safe_fopen(const char *filename, const char *what)
Definition: file.c:67
int safe_fclose(FILE *stream, const char *filename)
Definition: file.c:77
bool get_bool_property(const string)
FC 2015-07-20: yuk, moved out to prevent an include cycle dependency include "properties....
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
entity set_current_module_entity(entity)
static.c
Definition: static.c:66
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
#define DB_PUT_FILE_RESOURCE
Put a file resource into the current workspace database.
Definition: pipsdbm-local.h:85
void html_print_symbol_table(void)
static void end_block(const char *block, bool cr)
static void html_print_statement(statement r)
static void begin_block(const char *block, bool cr)
static void html_set_output(FILE *new_fp)
string db_build_file_resource_name(const char *rname, const char *oname, const char *suffix)
returns an allocated file name for a file resource.
Definition: lowlevel.c:169
#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
string concatenate(const char *,...)
Return the concatenation of the given strings.
Definition: string.c:183
string db_get_current_workspace_directory(void)
Definition: workspace.c:96
entity module_name_to_entity(const char *mn)
This is an alias for local_name_to_top_level_entity.
Definition: entity.c:1479
char * strdup()

References begin_block(), concatenate(), db_build_file_resource_name(), db_get_current_workspace_directory(), db_get_memory_resource(), DB_PUT_FILE_RESOURCE, debug_on, end_block(), get_bool_property(), html_print, html_print_statement(), html_print_symbol_table(), html_set_output(), module_name_to_entity(), module_statement, NL, pips_assert, pips_debug, reset_current_module_entity(), reset_current_module_statement(), safe_fclose(), safe_fopen(), set_current_module_entity(), set_current_module_statement(), statement_consistent_p(), and strdup().

+ Here is the call graph for this function:

◆ html_prettyprint_symbol_table()

bool html_prettyprint_symbol_table ( const string  module)
Parameters
moduleodule

Definition at line 872 of file html_prettyprinter.c.

873 {
874  pips_debug(1, "working on %s", module);
875 
876  // Prepare the output file
877  string html_file_name =
878  db_build_file_resource_name( "Symbols", "", ".symbols.html" );
879  string output_file =
881  "/", html_file_name, NULL ) );
882  FILE *fp = safe_fopen( output_file, "w" );
883  html_set_output(fp);
884 
885  // Reset output file
886  html_set_output(0);
887  safe_fclose( fp, output_file );
888 
889  DB_PUT_FILE_RESOURCE( DBR_HTML_IR_FILE, "", html_file_name );
890 
891  return true;
892 }
static char * module
Definition: pips.c:74

References concatenate(), db_build_file_resource_name(), db_get_current_workspace_directory(), DB_PUT_FILE_RESOURCE, html_set_output(), module, pips_debug, safe_fclose(), safe_fopen(), and strdup().

+ Here is the call graph for this function:

◆ html_print_area()

static void html_print_area ( area  a)
static

Definition at line 275 of file html_prettyprinter.c.

275  {
276  begin_block("area", false);
277 
278  string buf;
279  pips_assert("Asprintf !",
280  asprintf( &buf, "Size : %d", (int) area_size( a ) ) > 0);
281  html_output(buf, false);
282  free(buf);
283 
284  html_output("Layout", false);
285  FOREACH(entity, e, area_layout( a ) ) {
287  }
288 
289  end_block("area", false);
290 }
void free(void *)
#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
static void html_print_entity_name(entity e)
void html_output(const char *out, bool cr)
html_prettyprinter.c
#define asprintf
Definition: misc-local.h:225
#define area_size(x)
Definition: ri.h:544
#define area_layout(x)
Definition: ri.h:546
static char buf[BSZ]
Definition: split_file.c:157

References area_layout, area_size, asprintf, begin_block(), buf, end_block(), FOREACH, free(), html_output(), html_print_entity_name(), and pips_assert.

Referenced by html_print_type().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ html_print_basic()

static void html_print_basic ( basic  b)
static

Definition at line 213 of file html_prettyprinter.c.

213  {
214  begin_block("basic", false);
215  string buf;
216 
217  if(!b || b == basic_undefined) {
218  html_output("undefined", false);
219  } else {
220  switch(basic_tag( b )) {
221  case is_basic_int:
222  html_output("int", false);
223  pips_assert("Asprintf !", asprintf( &buf, "%d", (int)basic_int(b) ));
224  html_output(buf, false);
225  free(buf);
226  break;
227  case is_basic_float:
228  html_output("float", false);
229  pips_assert("Asprintf !", asprintf( &buf, "%f", (float)basic_int(b) ));
230  html_output(buf, false);
231  free(buf);
232  break;
233  case is_basic_logical:
234  html_output("logical", false);
235  pips_assert("Asprintf !", asprintf( &buf, "%d", (int)basic_int(b) ));
236  html_output(buf, false);
237  free(buf);
238  break;
239  case is_basic_overloaded:
240  html_output("overloaded", false);
241  html_output("unimplemented", false);
242  break;
243  case is_basic_complex:
244  html_output("complex", false);
245  html_output("unimplemented", false);
246  break;
247  case is_basic_string:
248  html_output("string", false);
250  break;
251  case is_basic_bit:
252  html_output("bit", false);
253  html_output("unimplemented", false);
254  break;
255  case is_basic_pointer:
256  html_output("pointer", false);
258  break;
259  case is_basic_derived:
260  html_output("derived", false);
262  break;
263  case is_basic_typedef:
264  html_output("typedef", false);
266  break;
267  default:
268  html_output("unknown", false);
269  break;
270  }
271  }
272  end_block("basic", false);
273 }
static void html_print_value(value v)
static void html_print_type(type t)
@ is_basic_derived
Definition: ri.h:579
@ is_basic_string
Definition: ri.h:576
@ is_basic_float
Definition: ri.h:572
@ is_basic_bit
Definition: ri.h:577
@ is_basic_pointer
Definition: ri.h:578
@ is_basic_overloaded
Definition: ri.h:574
@ is_basic_int
Definition: ri.h:571
@ is_basic_logical
Definition: ri.h:573
@ is_basic_typedef
Definition: ri.h:580
@ is_basic_complex
Definition: ri.h:575
#define basic_pointer(x)
Definition: ri.h:637
#define basic_derived(x)
Definition: ri.h:640
#define basic_int(x)
Definition: ri.h:616
#define basic_tag(x)
Definition: ri.h:613
#define basic_typedef(x)
Definition: ri.h:643
#define basic_undefined
Definition: ri.h:556
#define basic_string(x)
Definition: ri.h:631

References asprintf, basic_derived, basic_int, basic_pointer, basic_string, basic_tag, basic_typedef, basic_undefined, begin_block(), buf, end_block(), free(), html_output(), html_print_entity_name(), html_print_type(), html_print_value(), is_basic_bit, is_basic_complex, is_basic_derived, is_basic_float, is_basic_int, is_basic_logical, is_basic_overloaded, is_basic_pointer, is_basic_string, is_basic_typedef, and pips_assert.

Referenced by html_print_variable().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ html_print_call()

static void html_print_call ( call  c)
static

Definition at line 531 of file html_prettyprinter.c.

531  {
532  bool cr = false;
533  if(call_arguments( c )) {
534  cr = true;
535  }
536  begin_block("call", cr);
537 
538  begin_block("function", cr);
540  end_block("function", cr);
541 
542  if(call_arguments( c )) {
543  begin_block("arguments", cr);
544  FOREACH(expression, e, call_arguments( c ) ) {
545  html_print_expression(e, cr);
546  }
547  end_block("arguments", cr);
548  }
549  end_block("call", cr);
550 }
static void html_print_expression(expression e, bool cr)
#define call_function(x)
Definition: ri.h:709
#define call_arguments(x)
Definition: ri.h:711

References begin_block(), call_arguments, call_function, end_block(), FOREACH, html_print_entity_name(), and html_print_expression().

Referenced by html_print_expression(), and html_print_statement().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ html_print_code()

static void html_print_code ( code  c)
static

Definition at line 167 of file html_prettyprinter.c.

167  {
168  begin_block("code", true);
169 
170  list l = code_declarations(c);
171  if(l) {
172  begin_block("declarations", true);
173  if(!ENDP(l)) {
174  FOREACH(entity, e, l )
175  {
176  begin_block("", true);
178  end_block("", true);
179  }
180  }
181  end_block("declarations", true);
182  }
183  end_block("code", true);
184 }
#define ENDP(l)
Test if a list is empty.
Definition: newgen_list.h:66
#define code_declarations(x)
Definition: ri.h:784
The structure used to build lists in NewGen.
Definition: newgen_list.h:41

References begin_block(), code_declarations, end_block(), ENDP, FOREACH, and html_print_entity_name().

Referenced by html_print_value().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ html_print_constant()

static void html_print_constant ( constant  c)
static

Definition at line 440 of file html_prettyprinter.c.

440  {
441  begin_block("constant", false);
442  if(!c || c == constant_undefined) {
443  html_output("undefined", false);
444  } else {
445  switch(constant_tag( c )) {
446  case is_constant_int: {
447  string buf;
448  pips_assert("Asprintf !",
449  asprintf( &buf, "int : %d", (int) constant_int( c ) ) > 0 );
450  html_output(buf, true);
451  free(buf);
452  break;
453  }
454  case is_constant_float: {
455  string buf;
456  pips_assert("Asprintf !",
457  asprintf( &buf, "float : %f", (float) constant_float( c ) ) > 0 );
458  html_output(buf, true);
459  free(buf);
460  break;
461  }
462  case is_constant_logical: {
463  string buf;
464  pips_assert("Asprintf !",
465  asprintf( &buf, "Logical : %d", (int) constant_logical( c ) ) > 0 );
466  html_output(buf, true);
467  free(buf);
468  break;
469  }
471  html_output("litteral", false);
472  break;
473  case is_constant_call:
475  break;
476  case is_constant_unknown:
477  begin_block("unknown", false);
478  break;
479  default:
480  html_output("error", false);
481  break;
482  }
483  }
484  end_block("constant", false);
485 }
#define constant_tag(x)
Definition: ri.h:847
#define constant_int(x)
Definition: ri.h:850
@ is_constant_int
Definition: ri.h:817
@ is_constant_logical
Definition: ri.h:819
@ is_constant_unknown
Definition: ri.h:822
@ is_constant_litteral
Definition: ri.h:820
@ is_constant_float
Definition: ri.h:818
@ is_constant_call
Definition: ri.h:821
#define constant_float(x)
Definition: ri.h:853
#define constant_logical(x)
Definition: ri.h:856
#define constant_call(x)
Definition: ri.h:862
#define constant_undefined
Definition: ri.h:802

References asprintf, begin_block(), buf, constant_call, constant_float, constant_int, constant_logical, constant_tag, constant_undefined, end_block(), free(), html_output(), html_print_entity_name(), is_constant_call, is_constant_float, is_constant_int, is_constant_litteral, is_constant_logical, is_constant_unknown, and pips_assert.

Referenced by html_print_value().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ html_print_dimension()

static void html_print_dimension ( dimension  d)
static

Definition at line 319 of file html_prettyprinter.c.

319  {
320  begin_block("dimension", true);
323  end_block("dimension", true);
324 }
#define dimension_lower(x)
Definition: ri.h:980
#define dimension_upper(x)
Definition: ri.h:982

References begin_block(), dimension_lower, dimension_upper, end_block(), and html_print_expression().

Referenced by html_print_variable().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ html_print_entity_full()

void html_print_entity_full ( entity  e)

Definition at line 521 of file html_prettyprinter.c.

521  {
522  begin_block("entity", true);
523  html_output(entity_name( e ), true);
527 
528  end_block("entity", true);
529 }
static void html_print_storage(storage s)
#define entity_storage(x)
Definition: ri.h:2794
#define entity_name(x)
Definition: ri.h:2790
#define entity_type(x)
Definition: ri.h:2792
#define entity_initial(x)
Definition: ri.h:2796

References begin_block(), end_block(), entity_initial, entity_name, entity_storage, entity_type, html_output(), html_print_storage(), html_print_type(), and html_print_value().

Referenced by html_print_symbol_table().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ html_print_entity_name()

static void html_print_entity_name ( entity  e)
static

Definition at line 113 of file html_prettyprinter.c.

113  {
114  begin_block("entity", false);
115  html_output(entity_name( e ), false);
116  end_block("entity", false);
117 }

References begin_block(), end_block(), entity_name, and html_output().

Referenced by html_print_area(), html_print_basic(), html_print_call(), html_print_code(), html_print_constant(), html_print_formal(), html_print_loop(), html_print_ram(), html_print_reference(), html_print_statement(), html_print_storage(), and html_print_type().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ html_print_expression()

static void html_print_expression ( expression  e,
bool  cr 
)
static

Definition at line 593 of file html_prettyprinter.c.

593  {
594  begin_block("expression", cr);
595  begin_block("syntax", false);
596 
597  syntax s = expression_syntax(e);
598  switch(syntax_tag(s)) {
599  case is_syntax_call:
601  break;
602  case is_syntax_range:
604  break;
605  case is_syntax_reference:
607  break;
608  case is_syntax_subscript:
610  break;
611  case is_syntax_cast:
612  html_output("cast unimplemented", false);
613  break;
615  html_output("sizeofexpression unimplemented", false);
616  break;
618  html_output("sizeofexpression unimplemented", false);
619  break;
620  case is_syntax_va_arg:
621  html_output("va_arg unimplemented", false);
622  break;
623  default:
624  pips_internal_error("unexpected syntax tag");
625  }
626 
627  end_block("syntax", false);
628  end_block("expression", cr);
629 }
static void html_print_call(call c)
static void html_print_subscript(subscript s)
static void html_print_range(range r)
static void html_print_reference(reference r)
#define pips_internal_error
Definition: misc-local.h:149
#define syntax_reference(x)
Definition: ri.h:2730
#define syntax_tag(x)
Definition: ri.h:2727
#define syntax_range(x)
Definition: ri.h:2733
@ is_syntax_range
Definition: ri.h:2692
@ is_syntax_application
Definition: ri.h:2697
@ is_syntax_cast
Definition: ri.h:2694
@ is_syntax_call
Definition: ri.h:2693
@ is_syntax_va_arg
Definition: ri.h:2698
@ is_syntax_reference
Definition: ri.h:2691
@ is_syntax_sizeofexpression
Definition: ri.h:2695
@ is_syntax_subscript
Definition: ri.h:2696
#define syntax_call(x)
Definition: ri.h:2736
#define syntax_subscript(x)
Definition: ri.h:2745
#define expression_syntax(x)
Definition: ri.h:1247

References begin_block(), end_block(), expression_syntax, html_output(), html_print_call(), html_print_range(), html_print_reference(), html_print_subscript(), is_syntax_application, is_syntax_call, is_syntax_cast, is_syntax_range, is_syntax_reference, is_syntax_sizeofexpression, is_syntax_subscript, is_syntax_va_arg, pips_internal_error, syntax_call, syntax_range, syntax_reference, syntax_subscript, and syntax_tag.

Referenced by html_print_call(), html_print_dimension(), html_print_forloop(), html_print_range(), html_print_reference(), html_print_statement(), html_print_subscript(), html_print_test(), html_print_value(), and html_print_whileloop().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ html_print_forloop()

static void html_print_forloop ( forloop  f)
static

partial implementation...

Definition at line 691 of file html_prettyprinter.c.

691  {
692  /* partial implementation... */
693 
694  begin_block("forloop", true);
695 
696  begin_block("initialization", true);
698  end_block("initialization", true);
699 
700  begin_block("condition", true);
702  end_block("condition", true);
703 
704  begin_block("increment", true);
706  end_block("increment", true);
707 
708  begin_block("body", false);
710  end_block("body", false);
711 
712  end_block("forloop", true);
713 }
int f(int off1, int off2, int n, float r[n], float a[n], float b[n])
Definition: offsets.c:15
#define forloop_initialization(x)
Definition: ri.h:1366
#define forloop_increment(x)
Definition: ri.h:1370
#define forloop_condition(x)
Definition: ri.h:1368
#define forloop_body(x)
Definition: ri.h:1372

References begin_block(), end_block(), f(), forloop_body, forloop_condition, forloop_increment, forloop_initialization, html_print_expression(), and html_print_statement().

Referenced by html_print_statement().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ html_print_formal()

static void html_print_formal ( formal  f)
static

Definition at line 144 of file html_prettyprinter.c.

144  {
145  begin_block("formal", true);
146 
147  begin_block("Function", false);
149  end_block("Function", false);
150 
151  string buf;
152  pips_assert("Asprintf !",
153  asprintf( &buf, "Offset : %d", (int) formal_offset( f ) ) > 0);
154  html_output(buf, true);
155 
156  end_block("formal", true);
157 }
#define formal_offset(x)
Definition: ri.h:1408
#define formal_function(x)
Definition: ri.h:1406

References asprintf, begin_block(), buf, end_block(), f(), formal_function, formal_offset, html_output(), html_print_entity_name(), and pips_assert.

Referenced by html_print_storage().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ html_print_functional()

static void html_print_functional ( functional  f)
static

Definition at line 368 of file html_prettyprinter.c.

368  {
369  begin_block("functional", true);
372  }
373 
374  begin_block("return", false);
376  end_block("return", false);
377 
378  end_block("functional", true);
379 }
static void html_print_parameter(parameter p)
#define functional_result(x)
Definition: ri.h:1444
#define functional_parameters(x)
Definition: ri.h:1442
Definition: replace.c:135

References begin_block(), end_block(), f(), FOREACH, functional_parameters, functional_result, html_print_parameter(), and html_print_type().

Referenced by html_print_type().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ html_print_loop()

static void html_print_loop ( loop  l)
static

partial implementation ???

Definition at line 645 of file html_prettyprinter.c.

645  {
646  begin_block("loop", true);
647  /* partial implementation ??? */
648 
649  begin_block("index", false);
651  end_block("index", false);
652 
654 
655  begin_block("body", false);
657  end_block("body", false);
658 
659  end_block("loop", true);
660 }
#define loop_body(x)
Definition: ri.h:1644
#define loop_range(x)
Definition: ri.h:1642
#define loop_index(x)
Definition: ri.h:1640

References begin_block(), end_block(), html_print_entity_name(), html_print_range(), html_print_statement(), loop_body, loop_index, and loop_range.

Referenced by html_print_statement().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ html_print_mode()

static void html_print_mode ( mode  m)
static

Definition at line 340 of file html_prettyprinter.c.

340  {
341  begin_block("mode", false);
342 
343  switch(mode_tag( m )) {
344  case is_mode_value:
345  html_output("value", false);
346  break;
347  case is_mode_reference:
348  html_output("reference", false);
349  break;
350  default:
351  html_output("unknown", false);
352  break;
353  }
354 
355  end_block("mode", false);
356 }
@ is_mode_reference
Definition: ri.h:1676
@ is_mode_value
Definition: ri.h:1675
#define mode_tag(x)
Definition: ri.h:1693

References begin_block(), end_block(), html_output(), is_mode_reference, is_mode_value, and mode_tag.

Referenced by html_print_parameter().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ html_print_parameter()

static void html_print_parameter ( parameter  p)
static

Definition at line 358 of file html_prettyprinter.c.

358  {
359  begin_block("parameter", true);
360 
363  html_output("Dummy : not implemented", true);
364 
365  end_block("parameter", true);
366 }
static void html_print_mode(mode m)
#define parameter_type(x)
Definition: ri.h:1819
#define parameter_mode(x)
Definition: ri.h:1821

References begin_block(), end_block(), html_output(), html_print_mode(), html_print_type(), parameter_mode, and parameter_type.

Referenced by html_print_functional().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ html_print_qualifier()

static void html_print_qualifier ( qualifier  q)
static

Definition at line 292 of file html_prettyprinter.c.

292  {
293  begin_block("qualifier", false);
294 
295  switch(qualifier_tag( q )) {
296  case is_qualifier_const:
297  html_output("const", false);
298  break;
300  html_output("restrict", false);
301  break;
303  html_output("volatile", false);
304  break;
306  html_output("register", false);
307  break;
308  case is_qualifier_auto:
309  html_output("auto", false);
310  break;
311  default:
312  html_output("unknown", false);
313  break;
314  }
315 
316  end_block("qualifier", false);
317 }
#define qualifier_tag(x)
Definition: ri.h:2175
@ is_qualifier_volatile
Definition: ri.h:2129
@ is_qualifier_register
Definition: ri.h:2130
@ is_qualifier_restrict
Definition: ri.h:2128
@ is_qualifier_const
Definition: ri.h:2127
@ is_qualifier_auto
Definition: ri.h:2131

References begin_block(), end_block(), html_output(), is_qualifier_auto, is_qualifier_const, is_qualifier_register, is_qualifier_restrict, is_qualifier_volatile, and qualifier_tag.

Referenced by html_print_variable().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ html_print_ram()

static void html_print_ram ( ram  r)
static

Definition at line 119 of file html_prettyprinter.c.

119  {
120  begin_block("ram", true);
121 
122  begin_block("Function", true);
124  end_block("Function", true);
125 
126  html_output(NL, false);
127 
128  begin_block("Section", true);
130  end_block("Section", true);
131 
132  string buf;
133  pips_assert("Asprintf !",
134  asprintf( &buf, "Offset : %d", (int) ram_offset( r ) ) > 0 );
135  html_output(buf, true);
136  free(buf);
137  FOREACH(entity, e, ram_shared( r ) ) {
139  }
140 
141  end_block("ram", true);
142 }
#define ram_section(x)
Definition: ri.h:2249
#define ram_function(x)
Definition: ri.h:2247
#define ram_shared(x)
Definition: ri.h:2253
#define ram_offset(x)
Definition: ri.h:2251

References asprintf, begin_block(), buf, end_block(), FOREACH, free(), html_output(), html_print_entity_name(), NL, pips_assert, ram_function, ram_offset, ram_section, and ram_shared.

Referenced by html_print_storage().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ html_print_range()

static void html_print_range ( range  r)
static

Definition at line 631 of file html_prettyprinter.c.

631  {
632  begin_block("range", true);
633  begin_block("lower", false);
634  html_print_expression(range_lower( r ), false);
635  end_block("lower", false);
636  begin_block("upper", true);
637  html_print_expression(range_upper( r ), false);
638  end_block("upper", true);
639  begin_block("increment", true);
641  end_block("increment", true);
642  end_block("range", true);
643 }
#define range_upper(x)
Definition: ri.h:2290
#define range_increment(x)
Definition: ri.h:2292
#define range_lower(x)
Definition: ri.h:2288

References begin_block(), end_block(), html_print_expression(), range_increment, range_lower, and range_upper.

Referenced by html_print_expression(), and html_print_loop().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ html_print_reference()

static void html_print_reference ( reference  r)
static

Definition at line 558 of file html_prettyprinter.c.

558  {
559  bool cr = false;
560  if(reference_indices( r )) {
561  cr = true;
562  }
563 
564  begin_block("reference", cr);
565  begin_block("variable", cr);
567  end_block("variable", cr);
568 
569  if(reference_indices( r )) {
570  begin_block("indices", cr);
572  html_print_expression(e, false);
573  }
574  end_block("indices", cr);
575  }
576 
577  end_block("reference", cr);
578 }
#define reference_variable(x)
Definition: ri.h:2326
#define reference_indices(x)
Definition: ri.h:2328

References begin_block(), end_block(), FOREACH, html_print_entity_name(), html_print_expression(), reference_indices, and reference_variable.

Referenced by html_print_expression().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ html_print_rom()

static void html_print_rom ( _UNUSED_ unit  r)
static

Definition at line 159 of file html_prettyprinter.c.

159  {
160  begin_block("rom", false);
161 
162  html_output("unit ? (not implemented)", false);
163 
164  end_block("rom", false);
165 }

References begin_block(), end_block(), and html_output().

Referenced by html_print_storage().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ html_print_sequence()

static void html_print_sequence ( sequence  seq)
static

Definition at line 715 of file html_prettyprinter.c.

715  {
716  begin_block("sequence", true);
717  FOREACH( statement, s, sequence_statements( seq ) ) {
719  }
720  end_block("sequence", true);
721 }
#define sequence_statements(x)
Definition: ri.h:2360

References begin_block(), end_block(), FOREACH, html_print_statement(), and sequence_statements.

Referenced by html_print_statement().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ html_print_statement()

static void html_print_statement ( statement  r)
static

statement g = instruction_goto(i); entity el = statement_label(g); string l = entity_local_name(el) + sizeof(LABEL_PREFIX) -1; printf("%s", strdup( concatenate( "goto ", l, SEMICOLON, NULL ) ) );

add switch, forloop break, continue, return instructions here

Definition at line 743 of file html_prettyprinter.c.

743  {
744  begin_block("statement", true);
745 
747  begin_block("label", false);
749  end_block("label", false);
750  }
751 
753  if(!ENDP(l)) {
754  begin_block("declarations", true);
755  FOREACH( entity, e, l ) {
757  }
758  end_block("declarations", true);
759  }
760 
761  begin_block("instruction", true);
763  switch(instruction_tag(i)) {
764  case is_instruction_test:
766  break;
769  break;
770  case is_instruction_loop:
772  break;
775  break;
778  break;
779  case is_instruction_call:
781  break;
784  break;
787  break;
788  case is_instruction_goto:
789  /* statement g = instruction_goto(i);
790  entity el = statement_label(g);
791  string l = entity_local_name(el) + sizeof(LABEL_PREFIX) -1;
792  printf("%s", strdup( concatenate( "goto ", l, SEMICOLON, NULL ) ) );*/
793  break;
794  /* add switch, forloop break, continue, return instructions here*/
795  default:
796  html_output(" Instruction not implemented" NL, false);
797  break;
798  }
799  end_block("instruction", true);
800 
801  end_block("statement", true);
802 }
static void html_print_whileloop(whileloop w)
static void html_print_unstructured(_UNUSED_ unstructured u)
static void html_print_forloop(forloop f)
static void html_print_sequence(sequence seq)
static void html_print_loop(loop l)
static void html_print_test(test t)
#define instruction_loop(x)
Definition: ri.h:1520
#define statement_label(x)
Definition: ri.h:2450
#define entity_undefined
Definition: ri.h:2761
@ is_instruction_goto
Definition: ri.h:1473
@ is_instruction_unstructured
Definition: ri.h:1475
@ is_instruction_whileloop
Definition: ri.h:1472
@ is_instruction_expression
Definition: ri.h:1478
@ is_instruction_test
Definition: ri.h:1470
@ is_instruction_call
Definition: ri.h:1474
@ is_instruction_sequence
Definition: ri.h:1469
@ is_instruction_forloop
Definition: ri.h:1477
@ is_instruction_loop
Definition: ri.h:1471
#define instruction_tag(x)
Definition: ri.h:1511
#define instruction_sequence(x)
Definition: ri.h:1514
#define instruction_forloop(x)
Definition: ri.h:1538
#define instruction_expression(x)
Definition: ri.h:1541
#define instruction_whileloop(x)
Definition: ri.h:1523
#define statement_declarations(x)
Definition: ri.h:2460
#define statement_instruction(x)
Definition: ri.h:2458
#define instruction_call(x)
Definition: ri.h:1529
#define instruction_test(x)
Definition: ri.h:1517
#define instruction_unstructured(x)
Definition: ri.h:1532

References begin_block(), end_block(), ENDP, entity_undefined, FOREACH, html_output(), html_print_call(), html_print_entity_name(), html_print_expression(), html_print_forloop(), html_print_loop(), html_print_sequence(), html_print_test(), html_print_unstructured(), html_print_whileloop(), instruction_call, instruction_expression, instruction_forloop, instruction_loop, instruction_sequence, instruction_tag, instruction_test, instruction_unstructured, instruction_whileloop, is_instruction_call, is_instruction_expression, is_instruction_forloop, is_instruction_goto, is_instruction_loop, is_instruction_sequence, is_instruction_test, is_instruction_unstructured, is_instruction_whileloop, NL, statement_declarations, statement_instruction, and statement_label.

Referenced by html_prettyprint(), html_print_forloop(), html_print_loop(), html_print_sequence(), html_print_test(), and html_print_whileloop().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ html_print_storage()

static void html_print_storage ( storage  s)
static

Definition at line 186 of file html_prettyprinter.c.

186  {
187  begin_block("storage", true);
188  if(storage_undefined_p(s)) {
189  html_output("undefined", false);
190  } else {
191  switch(storage_tag( s )) {
192  case is_storage_return:
193  html_output("Return", false);
195  break;
196  case is_storage_ram:
198  break;
199  case is_storage_formal:
201  break;
202  case is_storage_rom:
204  break;
205  default:
206  html_output("Unknown storage", true);
207  break;
208  }
209  }
210  end_block("storage", true);
211 }
static void html_print_ram(ram r)
static void html_print_formal(formal f)
static void html_print_rom(_UNUSED_ unit r)
#define storage_tag(x)
Definition: ri.h:2515
#define storage_rom(x)
Definition: ri.h:2527
#define storage_formal(x)
Definition: ri.h:2524
@ is_storage_rom
Definition: ri.h:2494
@ is_storage_return
Definition: ri.h:2491
@ is_storage_ram
Definition: ri.h:2492
@ is_storage_formal
Definition: ri.h:2493
#define storage_ram(x)
Definition: ri.h:2521
#define storage_undefined_p(x)
Definition: ri.h:2477
#define storage_return(x)
Definition: ri.h:2518

References begin_block(), end_block(), html_output(), html_print_entity_name(), html_print_formal(), html_print_ram(), html_print_rom(), is_storage_formal, is_storage_ram, is_storage_return, is_storage_rom, storage_formal, storage_ram, storage_return, storage_rom, storage_tag, and storage_undefined_p.

Referenced by html_print_entity_full().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ html_print_subscript()

static void html_print_subscript ( subscript  s)
static

Definition at line 580 of file html_prettyprinter.c.

580  {
581  begin_block("subscript", false);
582  begin_block("array", false);
584  end_block("array", false);
585  begin_block("indices", false);
587  html_print_expression(e, false);
588  }
589  end_block("indices", false);
590  end_block("subscript", false);
591 }
#define subscript_indices(x)
Definition: ri.h:2563
#define subscript_array(x)
Definition: ri.h:2561

References begin_block(), end_block(), FOREACH, html_print_expression(), subscript_array, and subscript_indices.

Referenced by html_print_expression().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ html_print_symbol_table()

void html_print_symbol_table ( void  )

Print symbol table

Definition at line 805 of file html_prettyprinter.c.

806 {
807  /* Print symbol table */
808  html_print(NL "<li><ul class=\"symbolTable\">" NL);
809  begin_block("Symbol table", true);
811  FOREACH(entity, e, entities ) {
813  }
814  html_print("<li class=\"endSymbolTable\">&nbsp;</li>" NL "</ul></li>" NL);
815  end_block("Symbol table", true);
816 }
bool gen_true(__attribute__((unused)) gen_chunk *unused)
Return true and ignore the argument.
Definition: genClib.c:2780
void html_print_entity_full(entity e)
list gen_filter_tabulated(bool(*)(gen_chunk *), int)
returns the list of entities with this caracteristics.
Definition: tabulated.c:144
#define entity_domain
newgen_syntax_domain_defined
Definition: ri.h:410

References begin_block(), end_block(), entity_domain, FOREACH, gen_filter_tabulated(), gen_true(), html_print, html_print_entity_full(), and NL.

Referenced by html_prettyprint().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ html_print_test()

static void html_print_test ( test  t)
static

Definition at line 723 of file html_prettyprinter.c.

723  {
724  begin_block("test", true);
725 
726  begin_block("cond", true);
728  end_block("cond", true);
729 
730  begin_block("strue", false);
732  end_block("strue", false);
733 
734  if(!empty_statement_p(test_false( t ))) {
735  begin_block("sfalse", false);
737  end_block("sfalse", false);
738  }
739 
740  end_block("test", true);
741 }
bool empty_statement_p(statement)
Test if a statement is empty.
Definition: statement.c:391
#define test_false(x)
Definition: ri.h:2837
#define test_true(x)
Definition: ri.h:2835
#define test_condition(x)
Definition: ri.h:2833

References begin_block(), empty_statement_p(), end_block(), html_print_expression(), html_print_statement(), test_condition, test_false, and test_true.

Referenced by html_print_statement().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ html_print_type()

static void html_print_type ( type  t)
static

Definition at line 381 of file html_prettyprinter.c.

381  {
382  begin_block("type", true);
383  if(t == type_undefined) {
384  html_output("*undefined*", true);
385  } else {
386  switch(type_tag( t )) {
387  case is_type_statement:
388  html_output("Statement (unit ?) ", true);
389  break;
390  case is_type_area:
392  break;
393  case is_type_variable:
395  break;
396  case is_type_functional:
398  break;
399  case is_type_varargs:
400  html_output("VarArgs", true);
402  break;
403  case is_type_unknown:
404  html_output("Unknown", true);
405  break;
406  case is_type_void:
407  html_output("Void", true);
408  break;
409  case is_type_struct:
410  begin_block("Struct", true);
411  FOREACH(entity, e, type_struct( t ) )
412  {
413  begin_block("field", true);
415  end_block("field", true);
416  }
417  end_block("Struct", true);
418  break;
419  case is_type_union:
420  html_output("Union", true);
421  FOREACH(entity, e, type_union( t ) )
422  {
424  }
425  break;
426  case is_type_enum:
427  html_output("Enum", true);
428  FOREACH(entity, e, type_enum( t ) )
429  {
431  }
432  break;
433  default:
434  break;
435  }
436  }
437  end_block("type", true);
438 }
static void html_print_area(area a)
static void html_print_variable(variable v)
static void html_print_functional(functional f)
#define type_struct(x)
Definition: ri.h:2964
#define type_tag(x)
Definition: ri.h:2940
#define type_functional(x)
Definition: ri.h:2952
#define type_variable(x)
Definition: ri.h:2949
#define type_enum(x)
Definition: ri.h:2970
#define type_varargs(x)
Definition: ri.h:2955
#define type_area(x)
Definition: ri.h:2946
#define type_undefined
Definition: ri.h:2883
@ is_type_varargs
Definition: ri.h:2902
@ is_type_void
Definition: ri.h:2904
@ is_type_enum
Definition: ri.h:2907
@ is_type_statement
Definition: ri.h:2898
@ is_type_functional
Definition: ri.h:2901
@ is_type_variable
Definition: ri.h:2900
@ is_type_union
Definition: ri.h:2906
@ is_type_area
Definition: ri.h:2899
@ is_type_unknown
Definition: ri.h:2903
@ is_type_struct
Definition: ri.h:2905
#define type_union(x)
Definition: ri.h:2967

References begin_block(), end_block(), FOREACH, html_output(), html_print_area(), html_print_entity_name(), html_print_functional(), html_print_variable(), is_type_area, is_type_enum, is_type_functional, is_type_statement, is_type_struct, is_type_union, is_type_unknown, is_type_varargs, is_type_variable, is_type_void, type_area, type_enum, type_functional, type_struct, type_tag, type_undefined, type_union, type_varargs, and type_variable.

Referenced by html_print_basic(), html_print_entity_full(), html_print_functional(), and html_print_parameter().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ html_print_unstructured()

static void html_print_unstructured ( _UNUSED_ unstructured  u)
static

Definition at line 552 of file html_prettyprinter.c.

552  {
553  begin_block("unstructured", false);
554  html_output("Not implemented", false);
555  end_block("unstructured", false);
556 }

References begin_block(), end_block(), and html_output().

Referenced by html_print_statement().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ html_print_value()

static void html_print_value ( value  v)
static

Definition at line 487 of file html_prettyprinter.c.

487  {
488  begin_block("value", false);
489  if(!v || v == value_undefined) {
490  html_output("undefined", false);
491  } else {
492  switch(value_tag( v )) {
493  case is_value_code:
495  break;
496  case is_value_symbolic:
497  html_output("symbolic", false);
498  break;
499  case is_value_constant:
501  break;
502  case is_value_intrinsic:
503  html_output("intrinsic", false);
504  break;
505  case is_value_unknown:
506  html_output("unknown", false);
507  break;
508  case is_value_expression:
509  begin_block("expression", false);
511  end_block("expression", false);
512  break;
513  default:
514  html_output("error", false);
515  break;
516  }
517  }
518  end_block("value", false);
519 }
static void html_print_constant(constant c)
static void html_print_code(code c)
#define value_tag(x)
Definition: ri.h:3064
#define value_undefined
Definition: ri.h:3016
#define value_constant(x)
Definition: ri.h:3073
@ is_value_intrinsic
Definition: ri.h:3034
@ is_value_unknown
Definition: ri.h:3035
@ is_value_expression
Definition: ri.h:3036
@ is_value_constant
Definition: ri.h:3033
@ is_value_code
Definition: ri.h:3031
@ is_value_symbolic
Definition: ri.h:3032
#define value_code(x)
Definition: ri.h:3067
#define value_expression(x)
Definition: ri.h:3082

References begin_block(), end_block(), html_output(), html_print_code(), html_print_constant(), html_print_expression(), is_value_code, is_value_constant, is_value_expression, is_value_intrinsic, is_value_symbolic, is_value_unknown, value_code, value_constant, value_expression, value_tag, and value_undefined.

Referenced by html_print_basic(), and html_print_entity_full().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ html_print_variable()

static void html_print_variable ( variable  v)
static

Definition at line 326 of file html_prettyprinter.c.

326  {
327  begin_block("variable", true);
328 
332  }
335  }
336 
337  end_block("variable", true);
338 }
static void html_print_qualifier(qualifier q)
static void html_print_basic(basic b)
static void html_print_dimension(dimension d)
#define variable_qualifiers(x)
Definition: ri.h:3124
#define variable_dimensions(x)
Definition: ri.h:3122
#define variable_basic(x)
Definition: ri.h:3120

References begin_block(), end_block(), FOREACH, html_print_basic(), html_print_dimension(), html_print_qualifier(), variable_basic, variable_dimensions, and variable_qualifiers.

Referenced by html_print_type().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ html_print_whileloop()

static void html_print_whileloop ( whileloop  w)
static

partial implementation... ??

o while and while do loops

Definition at line 662 of file html_prettyprinter.c.

662  {
663  /* partial implementation... ?? */
664 
665  begin_block("whileloop", true);
666 
667  begin_block("condition", false);
669  end_block("condition", false);
670 
671  begin_block("statement", false);
673  end_block("statement", false);
674 
675  begin_block("evaluation", false);
677  /*do while and while do loops */
679  html_output("while() {}" NL, false);
680  else
681  html_output("do {} while(); " NL, false);
682  end_block("evaluation", false);
683 
684  begin_block("body", false);
686  end_block("body", false);
687 
688  end_block("whileloop", true);
689 }
static Value eval(Pvecteur pv, Value val, Variable var)
#define whileloop_evaluation(x)
Definition: ri.h:3166
#define whileloop_body(x)
Definition: ri.h:3162
#define whileloop_condition(x)
Definition: ri.h:3160
#define evaluation_before_p(x)
Definition: ri.h:1159

References begin_block(), end_block(), eval(), evaluation_before_p, html_output(), html_print_expression(), html_print_statement(), NL, whileloop_body, whileloop_condition, and whileloop_evaluation.

Referenced by html_print_statement().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ html_set_output()

static void html_set_output ( FILE *  new_fp)
static

Definition at line 72 of file html_prettyprinter.c.

72  {
73  out_fp = new_fp;
74 }

References out_fp.

Referenced by html_prettyprint(), and html_prettyprint_symbol_table().

+ Here is the caller graph for this function:

Variable Documentation

◆ out_fp

FILE* out_fp = 0
static

Definition at line 69 of file html_prettyprinter.c.

Referenced by html_set_output().