with text_io; use text_io; with ada.strings.unbounded; use ada.strings.unbounded; procedure dfg is --------------------------- -- Constates --------------------------- NB_MAX_BLOCKS_CFG : natural := 30; MAX_NB_STATEMENTS_BLOCK : natural :=10; MAX_NB_USED_VAR_STATEMENT : natural :=10; MAX_NB_NEXT_NODES_STATEMENT : natural := 10; MAX_NB_PREVIOUS_NODES_STATEMENT : natural := 10; MAX_DEF : natural := (MAX_NB_STATEMENTS_BLOCK*NB_MAX_BLOCKS_CFG); MAX_USE : natural := (MAX_NB_USED_VAR_STATEMENT*MAX_NB_STATEMENTS_BLOCK); MAX_DEF_USE : natural := (MAX_USE*MAX_DEF*NB_MAX_BLOCKS_CFG); --------------------------- -- Types --------------------------- type cfg_graph_type is (start_node, middle_node, terminate_node); type variable is record name : unbounded_string; end record; type variable_ptr is access variable; type variable_table is array (1..MAX_NB_USED_VAR_STATEMENT) of variable_ptr; type statement is record name : unbounded_string; defined_variable : variable_ptr; used_variable : variable_table; end record; type statement_ptr is access statement; --------------------------- -- Subprograms --------------------------- procedure print_statement(stmt : in statement_ptr) is begin put_line("---------- Statement : " & to_string(stmt.name)); put_line(" with def_var : "); if (stmt /= NULL) then if (stmt.defined_variable /= NULL) then put(to_string(stmt.defined_variable.name)); end if; end if; put_line(" with used_vars : "); if (stmt /= NULL) then for i in variable_table'range loop if (stmt.used_variable(i) /= NULL) then put(to_string(stmt.used_variable(i).name)); end if; end loop; end if; end print_statement; begin text_io.put_line("bonjour valou :-) "); end dfg;