Commit 95bbe39f authored by point's avatar point
Browse files

. remove the generation of the _idle variable in the projected node.

parent b121aeff
......@@ -1778,13 +1778,11 @@ s_add_idle_state(ar_node *node)
{
if( ar_node_get_nb_variables(node) == 0 )
{
ar_identifier *idle = ar_identifier_create("_idle");
ar_type *dom = ar_type_crt_range (0, 0);
ar_node_add_variable (node, idle, dom,
ar_node_add_variable (node, AR_IDLE_VAR, dom,
AR_SLOT_FLAG_STATE_VAR|AR_SLOT_FLAG_PRIVATE,NULL);
ar_type_del_reference (dom);
ar_identifier_del_reference(idle);
}
}
......
......@@ -69,6 +69,27 @@ s_delete_event_list(void *ptr);
/* --------------- */
ar_identifier *AR_IDLE_VAR;
int
ar_node_init (void)
{
AR_IDLE_VAR = ar_identifier_create ("_idle");
return 1;
}
/* --------------- */
void
ar_node_terminate (void)
{
ar_identifier_del_reference (AR_IDLE_VAR);
}
/* --------------- */
ar_node *
ar_node_create(ar_context *ctx)
{
......
......@@ -28,6 +28,12 @@
typedef struct ar_node_st ar_node;
extern int
ar_node_init (void);
extern void
ar_node_terminate (void);
extern ar_node *
ar_node_create(ar_context *ctx);
......@@ -104,6 +110,8 @@ extern ccl_list *
ar_node_get_attributes(ar_node *node);
/* variables */
extern ar_identifier *AR_IDLE_VAR;
extern void
ar_node_add_variable(ar_node *node, ar_identifier *id, ar_type *type,
uint32_t flags, ccl_list *attr);
......
/* $Id: ar-ts-project.c,v 1.10 2009/02/19 09:24:21 point Exp $ */
/* $Id: ar-ts-project.c,v 1.11 2009/02/20 07:36:56 point Exp $ */
#include <ccl/ccl-assert.h>
#include "ar-model.h"
#include "ar-attributes.h"
......@@ -303,9 +303,17 @@ s_display_transitions (ccl_log_type log, ar_ts *ts, ar_identifier *subid,
ar_ca_exprman *man)
{
ccl_pair *p;
ccl_list *vars;
ccl_list *pvars;
ccl_list *transitions = ar_node_get_transitions (sub);
ccl_list *vars = ccl_list_create ();
ccl_list *pvars = s_projected_variable_set (subid, sub, vars);
if (ccl_list_is_empty (transitions) ||
(ccl_list_get_size (transitions) == 1 &&
ar_trans_has_event (CAR (FIRST (transitions)), AR_EPSILON)))
return;
vars = ccl_list_create ();
pvars = s_projected_variable_set (subid, sub, vars);
ccl_log (log, FIELD_TAB "trans\n");
for(p = FIRST (transitions); p; p = CDR (p))
......@@ -458,52 +466,64 @@ s_display_and_delete_prop_list(ccl_log_type log, ccl_list *l, int del_it)
/* --------------- */
static void
s_display_variables(ccl_log_type log, ar_node *sub)
s_display_variables (ccl_log_type log, ar_node *sub)
{
int i;
char *kind[2] = { "flow", "state" };
ccl_list *vars[2];
ar_context_slot_iterator *si = ar_node_get_slots_for_variables(sub);
ar_context_slot_iterator *si = ar_node_get_slots_for_variables (sub);
vars[0] = ccl_list_create();
vars[1] = ccl_list_create();
vars[0] = ccl_list_create ();
vars[1] = ccl_list_create ();
while( ccl_iterator_has_more_elements(si) )
while (ccl_iterator_has_more_elements (si))
{
ar_context_slot *sl = ccl_iterator_next_element(si);
if( (ar_context_slot_get_flags(sl) & AR_SLOT_FLAG_FLOW_VAR) )
ccl_list_add(vars[0],sl);
else
ccl_list_add(vars[1],sl);
ar_context_slot *sl = ccl_iterator_next_element (si);
if ((ar_context_slot_get_flags(sl) & AR_SLOT_FLAG_FLOW_VAR))
ccl_list_add (vars[0], sl);
else
ccl_list_add (vars[1], sl);
}
ccl_iterator_delete(si);
ccl_iterator_delete (si);
for(i = 0; i < 2; i++)
if (ccl_list_is_empty (vars[0]) && ccl_list_get_size (vars[1]) == 1)
{
if( !ccl_list_is_empty(vars[i]) )
ar_context_slot *sl = (ar_context_slot *) CAR (FIRST (vars[1]));
ar_identifier *id = ar_context_slot_get_name (sl);
if (id == AR_IDLE_VAR)
{
ccl_log(log,FIELD_TAB "%s\n",kind[i]);
while( ! ccl_list_is_empty(vars[i]) )
ar_context_slot_del_reference (sl);
ccl_list_clear (vars[1], NULL);
}
ar_identifier_del_reference (id);
}
for (i = 0; i < 2; i++)
{
if (! ccl_list_is_empty (vars[i]))
{
ccl_log (log, FIELD_TAB "%s\n", kind[i]);
while (! ccl_list_is_empty (vars[i]))
{
ar_context_slot *sl = (ar_context_slot *)
ccl_list_take_first(vars[i]);
ar_type *type = ar_context_slot_get_type(sl);
ar_identifier *id = ar_context_slot_get_name(sl);
ccl_list *attrs = ar_context_slot_get_attributes(sl);
ar_context_slot_del_reference(sl);
ccl_log(log,FIELD_TAB FIELD_TAB);
ar_identifier_log(log,id);
ar_identifier_del_reference(id);
ccl_log(log," : ");
ar_type_log(log,type);
ar_type_del_reference(type);
s_display_and_delete_prop_list(log,attrs,1);
ccl_log(log,";\n");
ccl_list_take_first (vars[i]);
ar_type *type = ar_context_slot_get_type (sl);
ar_identifier *id = ar_context_slot_get_name (sl);
ccl_list *attrs = ar_context_slot_get_attributes (sl);
ar_context_slot_del_reference (sl);
ccl_log (log, FIELD_TAB FIELD_TAB);
ar_identifier_log (log, id);
ar_identifier_del_reference (id);
ccl_log (log, " : ");
ar_type_log (log, type);
ar_type_del_reference (type);
s_display_and_delete_prop_list (log, attrs, 1);
ccl_log (log, ";\n");
}
}
ccl_list_delete(vars[i]);
ccl_list_delete (vars[i]);
}
}
......
......@@ -216,6 +216,7 @@ s_init_arc(void)
ar_identifier_init();
arc_shell_init();
ar_model_init();
ar_node_init ();
ar_semantics_init(ARC_PREFERENCES);
ar_translators_init(ARC_PREFERENCES);
ar_acheck_init (ARC_PREFERENCES);
......@@ -260,6 +261,7 @@ s_terminate_arc (void)
ar_acheck_terminate ();
ar_translators_terminate ();
ar_semantics_terminate ();
ar_node_terminate ();
ar_model_terminate ();
arc_shell_terminate ();
ar_identifier_terminate ();
......
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