Commit 2cfc94c6 authored by Point Gerald's avatar Point Gerald
Browse files

New feature: add procedure that display info related to a node.

parent abdaae54
......@@ -7,6 +7,9 @@ arc 1.4:
transitions whose event contains a component with the attribute 'id'.
. add CTL* logic into acheck specifications. Formulas are introduced using
ctlspec keyword.
. implement the function that displays info related to nodes. Displayed info
are dimensions (i.e. # of vars, # of events, ...) and the underlying
hierarchy.
arc 1.3.3 :
Bug fixes:
......
......@@ -3,6 +3,7 @@ ARC NEWS - History of user visible changes.
What's new in 1.4:
* add CTL* specifications into Acheck specs
* add 'attribute id' formula in Acheck specifications
* the 'info' command now displays dimension of nodes and their hierachy
What's new in 1.3:
* add ARC handbook.
......
......@@ -20,6 +20,7 @@
#include "ar-model.h"
#include "ar-mec5.h"
#include "arc-allcmds.h"
#include "arc-allcmds-p.h"
struct table
{
......@@ -59,7 +60,10 @@ ARC_DEFINE_COMMAND_HELP (info_command) =
#define s_info_for_parameter NULL
#define s_info_for_type NULL
#define s_info_for_node NULL
static void
s_info_for_node (ar_identifier *id);
#define s_info_for_signature NULL
static void
......@@ -191,3 +195,85 @@ s_info_for_relation (ar_identifier *id)
ar_mec5_relation_get_data_structure_size (mrel));
ar_mec5_relation_del_reference (mrel);
}
/* --------------- */
static void
s_log_node_structure (int tab, ar_node *node)
{
if (ar_node_get_template (node) != NULL)
{
ar_identifier *id = ar_node_get_name (node);
ar_identifier_log (CCL_LOG_DISPLAY, id);
ccl_display (" is a template node. No info available.\n");
ar_identifier_del_reference (id);
}
else
{
ar_context_slot_iterator *si = ar_node_get_slots_for_subnode_fields(node);
while (ccl_iterator_has_more_elements (si))
{
ar_context_slot *sl = ccl_iterator_next_element (si);
ar_identifier *sname = ar_context_slot_get_name (sl);
ar_node *sub = ar_node_get_subnode_model (node, sname);
ar_identifier *subname = ar_node_get_name (sub);
ccl_display ("%*s", tab, "");
ar_identifier_log (CCL_LOG_DISPLAY, sname);
ccl_display (" : ");
ar_identifier_log (CCL_LOG_DISPLAY, subname);
ccl_display (" \n");
ar_identifier_del_reference (sname);
ar_identifier_del_reference (subname);
ar_context_slot_del_reference (sl);
s_log_node_structure (tab + 2, sub);
ar_node_del_reference (sub);
}
ccl_iterator_delete (si);
}
}
/* --------------- */
static void
s_info_for_node (ar_identifier *id)
{
ar_node *node = ar_model_get_node (id);
if (ar_node_get_template (node) != NULL)
{
ar_identifier_log (CCL_LOG_DISPLAY, id);
ccl_display (" is a template node. No info available.\n");
}
else
{
char *sid = ar_identifier_to_string (id);
ar_ca *ca = arc_command_get_ca (sid);
ccl_display ("=== %s ===\n", sid);
ccl_delete (sid);
ccl_display ("statistics: \n");
ccl_display (" number of variables : %d\n",
ar_ca_get_number_of_variables(ca));
ccl_display (" flow variables : %d\n",
ar_ca_get_number_of_flow_variables(ca));
ccl_display (" state variables : %d\n",
ar_ca_get_number_of_state_variables(ca));
ccl_display (" max cardinality : %d\n", ar_ca_get_max_cardinality (ca));
ccl_display (" number of events : %d\n", ar_ca_get_number_of_events(ca));
ccl_display (" number of assertions : %d\n",
ar_ca_get_number_of_assertions (ca));
ccl_display (" number of transitions : %d\n",
ar_ca_get_number_of_transitions (ca));
ar_ca_del_reference (ca);
ccl_display ("hierarchy: \n");
s_log_node_structure (1, node);
}
ar_node_del_reference (node);
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment