Exemplo n.º 1
0
void attr_list(){
	attr_decl();
	while(lookahead == ','){
		match(',');	
		attr_decl();	
	}
}
Exemplo n.º 2
0
/*Ritorno lo schema dell'attr_list*/
Pschema attr_list(Pnode attr_list_node){
#ifdef DEBUG_ATTR_LIST
	printf( "ATTR_LIST - enter\n");
#endif
	//Punto al primo figlio
	Pnode first_attr_decl_node = attr_list_node;

	//Estraggo lo schema del primo figlio
	Pschema schema = attr_decl(first_attr_decl_node);

	//Punto al secondo figlio
	Pnode attr_decl_node = first_attr_decl_node->brother;
	//Punto al primo schema
	Pschema prev_schema = schema;
	
	//Prendo gli schemi degli attributi successivi
	while (attr_decl_node != NULL) {
		//Prendo lo schema del nodo
		Pschema attr_schema = attr_decl(attr_decl_node);
		
		//Controllo che nell'elenco dei nomi non ci sia già un id con quel nome
		if(name_in_schema(attr_schema->name,schema)!=NULL)
			semerror(attr_decl_node,"Variable already defined in table");

		//Aggiungo lo schema allo schema della attr_list
		prev_schema->next = attr_schema;
		prev_schema = prev_schema->next;

		//Passo al fratello di attr_decl
		attr_decl_node = attr_decl_node->brother;
	}

#ifdef DEBUG_ATTR_LIST
	printf( "ATTR_LIST - exit\n");
#endif

	return schema;
}
Exemplo n.º 3
0
int
be_visitor_executor_exh::visit_component (be_component *node)
{
  if (node->imported ())
    {
      return 0;
    }
  this->node_ = node;
  AST_Decl *scope = ScopeAsDecl (node->defined_in ());
  ACE_CString sname_str (scope->full_name ());
  const char *sname = sname_str.c_str ();

  // No _cxx_ prefix.
  const char *lname =
    node->original_local_name ()->get_string ();

  const char *global = (sname_str == "" ? "" : "::");

  os_ << be_nl_2
      << "/// Component Executor Implementation Class: "
      << lname <<  "_exec_i";

  os_ << be_nl
      << "class ";

  os_ << lname
      << "_exec_i" << be_idt_nl
      << ": public virtual " << lname << "_Exec," << be_idt_nl;

  os_ << "public virtual ::CORBA::LocalObject";

  os_ << be_uidt << be_uidt_nl
      << "{" << be_nl
      << "public:" << be_idt_nl;

  os_ << "/// Constructor" << be_nl
      << lname << "_exec_i (void);";

  os_ << be_nl
      << "/// Destructor" << be_nl
      << "virtual ~" << lname << "_exec_i (void);";

  os_ << be_nl_2
      << "/** @name Supported operations and attributes. */" << be_nl
      << "//@{";

  int status =
    node->traverse_inheritance_graph (
      be_interface::op_attr_decl_helper,
      &os_,
      false,
      false);

  os_ << be_nl_2 << "//@}" << be_nl_2;

  if (status == -1)
    {
      ACE_ERROR_RETURN ((LM_ERROR,
                         ACE_TEXT ("be_visitor_executor_exh::")
                         ACE_TEXT ("visit_component - ")
                         ACE_TEXT ("traverse_inheritance_graph() ")
                         ACE_TEXT ("failed\n")),
                        -1);
    }

  os_ << "/** @name Component attributes and port operations. */" << be_nl
      << "//@{";

  status = this->visit_component_scope (node);

  os_<< be_nl << "//@}" << be_nl_2;

  if (status == -1)
    {
      ACE_ERROR_RETURN ((LM_ERROR,
                         ACE_TEXT ("be_visitor_executor_exh::")
                         ACE_TEXT ("visit_component - ")
                         ACE_TEXT ("visit_component_scope() ")
                         ACE_TEXT ("failed\n")),
                        -1);
    }

  os_ << "/** @name Session component operations */" << be_nl
  //    Operations from Components::" << be_global->ciao_container_type ()
  //    << "Component. */" << be_nl
      << "//@{";

  const char *container_type = be_global->ciao_container_type ();

  os_ << be_nl_2
      << "/// Setter for container context for this component" << be_nl
      << "/// @param[in] ctx - Container context" << be_nl
      << "virtual void set_"
      << tao_cg->downcase (container_type)
      << "_context ("
      << "::Components::" << be_global->ciao_container_type ()
      << "Context_ptr ctx);";

  if (ACE_OS::strcmp (be_global->ciao_container_type (), "Session") == 0)
    {
      os_ << be_nl_2
          << "/// Component state change method to configuration_complete state" << be_nl
          << "virtual void configuration_complete (void);";

      os_ << be_nl_2
          << "/// Component state change method to activated state" << be_nl
          << "virtual void ccm_activate (void);" << be_nl_2
          << "/// Component state change method to passivated state" << be_nl
          << "virtual void ccm_passivate (void);";
    }

  os_ << be_nl_2
      << "/// Component state change method to removed state" << be_nl
      << "virtual void ccm_remove (void);";

  os_ << be_nl
      << "//@}";

  os_ << be_nl_2
      << "/** @name User defined public operations. */" << be_nl
      << "//@{";

  os_ << be_nl_2 << "//@}";

  os_ << be_uidt << be_nl_2
      << "private:" << be_idt_nl
      << "/// Context for component instance. Used for all middleware communication" << be_nl
      << global << sname << "::CCM_" << lname
      << "_Context_var ciao_context_;" << be_nl_2;


  // Traverse inheritance graph twice to group
  // component attributes and component facets for DOxygen documentation

  // Traverse inheritance grapp for component facets:

  // The overload of traverse_inheritance_graph() used here
  // doesn't automatically prime the queues.
  node->get_insert_queue ().reset ();
  node->get_del_queue ().reset ();
  node->get_insert_queue ().enqueue_tail (node_);

  be_visitor_executor_private_exh v (this->ctx_);
  v.node (node);

  v.set_flags (false, true);

 os_ << "/** @name Component attributes. */" << be_nl
      << "//@{";

  Exec_Attr_Decl_Generator attr_decl (&v);

  status =
    node->traverse_inheritance_graph (attr_decl,
                                      &os_,
                                      false,
                                      false);

  if (status == -1)
    {
      ACE_ERROR_RETURN ((LM_ERROR,
                         ACE_TEXT ("be_visitor_executor_exh::")
                         ACE_TEXT ("visit_component - ")
                         ACE_TEXT ("traverse_inheritance_graph() ")
                         ACE_TEXT ("for attr decls failed\n")),
                        -1);
    }

  os_<< be_nl << "//@}" << be_nl_2;

  // Traverse inheritance grapp for component facets:

  // The overload of traverse_inheritance_graph() used here
  // doesn't automatically prime the queues.
  node->get_insert_queue ().reset ();
  node->get_del_queue ().reset ();
  node->get_insert_queue ().enqueue_tail (node_);

  be_visitor_executor_private_exh v_f (this->ctx_);
  v_f.node (node);

  v_f.set_flags (true, false);

  os_ << "/** @name Component facets. */" << be_nl
      << "//@{";

  Exec_Attr_Decl_Generator facet_decl (&v_f);

  status =
    node->traverse_inheritance_graph (facet_decl,
                                      &os_,
                                      false,
                                      false);

  if (status == -1)
    {
      ACE_ERROR_RETURN ((LM_ERROR,
                         ACE_TEXT ("be_visitor_executor_exh::")
                         ACE_TEXT ("visit_component - ")
                         ACE_TEXT ("traverse_inheritance_graph() ")
                         ACE_TEXT ("for facet decls failed\n")),
                        -1);
    }

  os_<< be_nl << "//@}" << be_nl_2;


  os_ << "/** @name User defined members. */" << be_nl
      << "//@{";

  os_ << be_nl_2 << "//@}";

  os_ << be_nl_2
      << "/** @name User defined private operations. */" << be_nl
      << "//@{";

  os_ << be_nl_2 << "//@}";

  if (be_global->gen_ciao_exec_reactor_impl ())
    {
      os_ << be_nl_2
          << "/// Get the ACE_Reactor" << be_nl
          << "/// @return non-owning pointer to reactor" << be_nl
          << "ACE_Reactor* reactor (void);";
    }

  os_ << be_uidt_nl
      << "};";

  return 0;
}