#include <ifr_adding_visitor.h>
Inheritance diagram for ifr_adding_visitor:
Public Member Functions | |
ifr_adding_visitor (AST_Decl *scope, CORBA::Boolean in_reopened=0) | |
virtual | ~ifr_adding_visitor (void) |
virtual int | visit_scope (UTL_Scope *node) |
virtual int | visit_predefined_type (AST_PredefinedType *node) |
virtual int | visit_module (AST_Module *node) |
virtual int | visit_interface (AST_Interface *node) |
virtual int | visit_interface_fwd (AST_InterfaceFwd *node) |
virtual int | visit_valuebox (AST_ValueBox *node) |
virtual int | visit_valuetype (AST_ValueType *node) |
virtual int | visit_valuetype_fwd (AST_ValueTypeFwd *node) |
virtual int | visit_component (AST_Component *node) |
virtual int | visit_component_fwd (AST_ComponentFwd *node) |
virtual int | visit_eventtype (AST_EventType *node) |
virtual int | visit_eventtype_fwd (AST_EventTypeFwd *node) |
virtual int | visit_home (AST_Home *node) |
virtual int | visit_factory (AST_Factory *node) |
virtual int | visit_structure (AST_Structure *node) |
virtual int | visit_structure_fwd (AST_StructureFwd *node) |
virtual int | visit_exception (AST_Exception *node) |
virtual int | visit_enum (AST_Enum *node) |
virtual int | visit_operation (AST_Operation *node) |
virtual int | visit_field (AST_Field *node) |
virtual int | visit_attribute (AST_Attribute *node) |
virtual int | visit_union (AST_Union *node) |
virtual int | visit_union_fwd (AST_UnionFwd *node) |
virtual int | visit_constant (AST_Constant *node) |
virtual int | visit_array (AST_Array *node) |
virtual int | visit_sequence (AST_Sequence *node) |
virtual int | visit_string (AST_String *node) |
virtual int | visit_typedef (AST_Typedef *node) |
virtual int | visit_root (AST_Root *node) |
virtual int | visit_native (AST_Native *node) |
Protected Member Functions | |
CORBA::PrimitiveKind | expr_type_to_pkind (AST_Expression::ExprType et) |
CORBA::PrimitiveKind | predefined_type_to_pkind (AST_PredefinedType *node) |
void | load_any (AST_Expression::AST_ExprValue *ev, CORBA::Any &any) |
void | element_type (AST_Type *base_type, bool owned=false) |
int | create_interface_def (AST_Interface *node) |
int | create_value_def (AST_ValueType *node) |
int | create_component_def (AST_Component *node) |
int | create_home_def (AST_Home *node) |
int | create_event_def (AST_EventType *node) |
int | create_value_member (AST_Field *node) |
void | get_referenced_type (AST_Type *node) |
void | fill_base_value (CORBA::ValueDef_ptr &result, AST_ValueType *node) |
void | fill_base_component (CORBA::ComponentIR::ComponentDef_ptr &result, AST_Component *node) |
void | fill_base_home (CORBA::ComponentIR::HomeDef_ptr &result, AST_Home *node) |
void | fill_managed_component (CORBA::ComponentIR::ComponentDef_ptr &result, AST_Home *node) |
void | fill_primary_key (CORBA::ValueDef_ptr &result, AST_Home *node) |
void | fill_abstract_base_values (CORBA::ValueDefSeq &result, AST_ValueType *node) |
void | fill_inherited_interfaces (CORBA::InterfaceDefSeq &result, AST_Interface *node) |
void | fill_supported_interfaces (CORBA::InterfaceDefSeq &result, AST_Interface *node) |
void | fill_interfaces (CORBA::InterfaceDefSeq &result, AST_Interface **list, CORBA::Long length) |
void | fill_initializers (CORBA::ExtInitializerSeq &result, AST_ValueType *node) |
void | fill_get_exceptions (CORBA::ExceptionDefSeq &result, AST_Attribute *node) |
void | fill_set_exceptions (CORBA::ExceptionDefSeq &result, AST_Attribute *node) |
void | fill_exceptions (CORBA::ExceptionDefSeq &result, AST_Decl *node) |
void | fill_exceptions (CORBA::ExceptionDefSeq &result, UTL_ExceptList *list) |
void | fill_params (CORBA::ParDescriptionSeq &result, AST_Operation *node) |
void | visit_all_provides (AST_Component *node, CORBA::ComponentIR::ComponentDef_ptr c) |
void | visit_all_uses (AST_Component *node, CORBA::ComponentIR::ComponentDef_ptr c) |
void | visit_all_emits (AST_Component *node, CORBA::ComponentIR::ComponentDef_ptr c) |
void | visit_all_publishes (AST_Component *node, CORBA::ComponentIR::ComponentDef_ptr c) |
void | visit_all_consumes (AST_Component *node, CORBA::ComponentIR::ComponentDef_ptr c) |
void | visit_all_factories (AST_Home *node, CORBA::ComponentIR::HomeDef_ptr h) |
void | visit_all_finders (AST_Home *node, CORBA::ComponentIR::HomeDef_ptr h) |
void | expand_id (ACE_CString &str, const char *local_name) |
Protected Attributes | |
CORBA::IDLType_var | ir_current_ |
AST_Decl * | scope_ |
bool | in_reopened_ |
|
|
|
Definition at line 59 of file ifr_adding_visitor.cpp.
00060 { 00061 } |
|
Definition at line 2863 of file ifr_adding_visitor.cpp. References ACE_ERROR_RETURN, ACE_TEXT(), be_global, fill_base_component(), fill_supported_interfaces(), BE_GlobalData::ifr_scopes(), ir_current_, LM_ERROR, visit_all_consumes(), visit_all_emits(), visit_all_provides(), visit_all_publishes(), visit_all_uses(), and visit_scope(). Referenced by visit_component().
02864 { 02865 CORBA::Container_ptr current_scope = 02866 CORBA::Container::_nil (); 02867 02868 if (be_global->ifr_scopes ().top (current_scope) == 0) 02869 { 02870 CORBA::ComponentIR::ComponentDef_var base_component; 02871 this->fill_base_component (base_component.out (), 02872 node); 02873 02874 CORBA::InterfaceDefSeq supported_interfaces; 02875 this->fill_supported_interfaces (supported_interfaces, 02876 node); 02877 02878 CORBA::ComponentIR::Container_var ccm_scope = 02879 CORBA::ComponentIR::Container::_narrow (current_scope); 02880 02881 CORBA::ComponentIR::ComponentDef_var new_def = 02882 ccm_scope->create_component (node->repoID (), 02883 node->local_name ()->get_string (), 02884 node->version (), 02885 base_component.in (), 02886 supported_interfaces); 02887 02888 node->ifr_added (true); 02889 02890 if (be_global->ifr_scopes ().push (new_def.in ()) != 0) 02891 { 02892 ACE_ERROR_RETURN (( 02893 LM_ERROR, 02894 ACE_TEXT ("(%N:%l) ifr_adding_visitor::") 02895 ACE_TEXT ("create_component_def -") 02896 ACE_TEXT (" scope push failed\n") 02897 ), 02898 -1 02899 ); 02900 } 02901 02902 // Visit the members, if any. 02903 if (this->visit_scope (node) == -1) 02904 { 02905 ACE_ERROR_RETURN (( 02906 LM_ERROR, 02907 ACE_TEXT ("(%N:%l) ifr_adding_visitor::") 02908 ACE_TEXT ("create_component_def -") 02909 ACE_TEXT (" visit_scope failed\n") 02910 ), 02911 -1 02912 ); 02913 } 02914 02915 this->visit_all_provides (node, 02916 new_def.in ()); 02917 02918 this->visit_all_uses (node, 02919 new_def.in ()); 02920 02921 this->visit_all_emits (node, 02922 new_def.in ()); 02923 02924 this->visit_all_publishes (node, 02925 new_def.in ()); 02926 02927 this->visit_all_consumes (node, 02928 new_def.in ()); 02929 02930 // This spot in the AST doesn't necessarily have to be the 02931 // interface definition - it could be any reference to it. 02932 // The front end will already have fully defined it, so all 02933 // the info is available anywhere. So it's a good idea to 02934 // update the current IR object holder now. This will 02935 // consume the objref pointer. 02936 this->ir_current_ = 02937 CORBA::IDLType::_duplicate (new_def.in ()); 02938 02939 CORBA::Container_ptr used_scope = 02940 CORBA::Container::_nil (); 02941 02942 // Pop the new IR object back off the scope stack. 02943 if (be_global->ifr_scopes ().pop (used_scope) != 0) 02944 { 02945 ACE_ERROR_RETURN (( 02946 LM_ERROR, 02947 ACE_TEXT ("(%N:%l) ifr_adding_visitor::") 02948 ACE_TEXT ("create_component_def -") 02949 ACE_TEXT (" scope pop failed\n") 02950 ), 02951 -1 02952 ); 02953 } 02954 } 02955 else 02956 { 02957 ACE_ERROR_RETURN (( 02958 LM_ERROR, 02959 ACE_TEXT ("(%N:%l) ifr_adding_visitor::create_component_def -") 02960 ACE_TEXT (" scope stack is empty\n") 02961 ), 02962 -1 02963 ); 02964 } 02965 02966 return 0; 02967 } |
|
Definition at line 3084 of file ifr_adding_visitor.cpp. References ACE_ERROR_RETURN, ACE_TEXT(), be_global, fill_abstract_base_values(), fill_base_value(), fill_initializers(), fill_supported_interfaces(), BE_GlobalData::ifr_scopes(), ir_current_, LM_ERROR, and visit_scope(). Referenced by visit_eventtype().
03085 { 03086 CORBA::Container_ptr current_scope = 03087 CORBA::Container::_nil (); 03088 03089 if (be_global->ifr_scopes ().top (current_scope) == 0) 03090 { 03091 CORBA::ValueDef_var base_value; 03092 this->fill_base_value (base_value.out (), 03093 node); 03094 03095 CORBA::ValueDefSeq abstract_base_values; 03096 this->fill_abstract_base_values (abstract_base_values, 03097 node); 03098 03099 CORBA::InterfaceDefSeq supported_interfaces; 03100 this->fill_supported_interfaces (supported_interfaces, 03101 node); 03102 03103 CORBA::ExtInitializerSeq initializers; 03104 this->fill_initializers (initializers, 03105 node); 03106 03107 CORBA::ComponentIR::Container_var ccm_scope = 03108 CORBA::ComponentIR::Container::_narrow (current_scope); 03109 03110 CORBA::ExtValueDef_var new_def = 03111 ccm_scope->create_event ( 03112 node->repoID (), 03113 node->local_name ()->get_string (), 03114 node->version (), 03115 static_cast<CORBA::Boolean> (node->custom ()), 03116 static_cast<CORBA::Boolean> (node->is_abstract ()), 03117 base_value.in (), 03118 static_cast<CORBA::Boolean> (node->truncatable ()), 03119 abstract_base_values, 03120 supported_interfaces, 03121 initializers 03122 ); 03123 03124 node->ifr_added (true); 03125 03126 // Push the new IR object onto the scope stack. 03127 CORBA::Container_var new_scope = 03128 CORBA::Container::_narrow (new_def.in ()); 03129 03130 if (be_global->ifr_scopes ().push (new_scope.in ()) != 0) 03131 { 03132 ACE_ERROR_RETURN (( 03133 LM_ERROR, 03134 ACE_TEXT ("(%N:%l) ifr_adding_visitor::") 03135 ACE_TEXT ("create_event_def -") 03136 ACE_TEXT (" scope push failed\n") 03137 ), 03138 -1 03139 ); 03140 } 03141 03142 // Visit the members, if any. 03143 if (this->visit_scope (node) == -1) 03144 { 03145 ACE_ERROR_RETURN (( 03146 LM_ERROR, 03147 ACE_TEXT ("(%N:%l) ifr_adding_visitor::") 03148 ACE_TEXT ("create_event_def -") 03149 ACE_TEXT (" visit_scope failed\n") 03150 ), 03151 -1 03152 ); 03153 } 03154 03155 // This spot in the AST doesn't necessarily have to be the 03156 // interface definition - it could be any reference to it. 03157 // The front end will already have fully defined it, so all 03158 // the info is available anywhere. So it's a good idea to 03159 // update the current IR object holder now. This will 03160 // consume the objref pointer. 03161 this->ir_current_ = 03162 CORBA::IDLType::_duplicate (new_def.in ()); 03163 03164 CORBA::Container_ptr used_scope = 03165 CORBA::Container::_nil (); 03166 03167 // Pop the new IR object back off the scope stack. 03168 if (be_global->ifr_scopes ().pop (used_scope) != 0) 03169 { 03170 ACE_ERROR_RETURN (( 03171 LM_ERROR, 03172 ACE_TEXT ("(%N:%l) ifr_adding_visitor::") 03173 ACE_TEXT ("create_event_def -") 03174 ACE_TEXT (" scope pop failed\n") 03175 ), 03176 -1 03177 ); 03178 } 03179 } 03180 else 03181 { 03182 ACE_ERROR_RETURN (( 03183 LM_ERROR, 03184 ACE_TEXT ("(%N:%l) ifr_adding_visitor::create_event_def -") 03185 ACE_TEXT (" scope stack is empty\n") 03186 ), 03187 -1 03188 ); 03189 } 03190 03191 return 0; 03192 } |
|
Definition at line 2970 of file ifr_adding_visitor.cpp. References ACE_ERROR_RETURN, ACE_TEXT(), be_global, fill_base_home(), fill_managed_component(), fill_primary_key(), fill_supported_interfaces(), BE_GlobalData::ifr_scopes(), ir_current_, LM_ERROR, visit_all_factories(), visit_all_finders(), and visit_scope(). Referenced by visit_home().
02971 { 02972 CORBA::Container_ptr current_scope = 02973 CORBA::Container::_nil (); 02974 02975 if (be_global->ifr_scopes ().top (current_scope) == 0) 02976 { 02977 CORBA::ComponentIR::HomeDef_var base_home; 02978 this->fill_base_home (base_home.out (), 02979 node); 02980 02981 CORBA::ComponentIR::ComponentDef_var managed_component; 02982 this->fill_managed_component (managed_component.out (), 02983 node); 02984 02985 CORBA::InterfaceDefSeq supported_interfaces; 02986 this->fill_supported_interfaces (supported_interfaces, 02987 node); 02988 02989 CORBA::ValueDef_var primary_key; 02990 this->fill_primary_key (primary_key.out (), 02991 node); 02992 02993 CORBA::ComponentIR::Container_var ccm_scope = 02994 CORBA::ComponentIR::Container::_narrow (current_scope); 02995 02996 CORBA::ComponentIR::HomeDef_var new_def = 02997 ccm_scope->create_home (node->repoID (), 02998 node->local_name ()->get_string (), 02999 node->version (), 03000 base_home.in (), 03001 managed_component.in (), 03002 supported_interfaces, 03003 primary_key.in ()); 03004 03005 node->ifr_added (true); 03006 03007 // Push the new IR object onto the scope stack. 03008 CORBA::Container_var new_scope = 03009 CORBA::Container::_narrow (new_def.in ()); 03010 03011 if (be_global->ifr_scopes ().push (new_scope.in ()) != 0) 03012 { 03013 ACE_ERROR_RETURN (( 03014 LM_ERROR, 03015 ACE_TEXT ("(%N:%l) ifr_adding_visitor::") 03016 ACE_TEXT ("create_home_def -") 03017 ACE_TEXT (" scope push failed\n") 03018 ), 03019 -1 03020 ); 03021 } 03022 03023 // Visit the members, if any. 03024 if (this->visit_scope (node) == -1) 03025 { 03026 ACE_ERROR_RETURN (( 03027 LM_ERROR, 03028 ACE_TEXT ("(%N:%l) ifr_adding_visitor::") 03029 ACE_TEXT ("create_home_def -") 03030 ACE_TEXT (" visit_scope failed\n") 03031 ), 03032 -1 03033 ); 03034 } 03035 03036 // Get the contents of these lists into the repository. 03037 03038 this->visit_all_factories (node, 03039 new_def.in ()); 03040 03041 this->visit_all_finders (node, 03042 new_def.in ()); 03043 03044 // This spot in the AST doesn't necessarily have to be the 03045 // interface definition - it could be any reference to it. 03046 // The front end will already have fully defined it, so all 03047 // the info is available anywhere. So it's a good idea to 03048 // update the current IR object holder now. This will 03049 // consume the objref pointer. 03050 this->ir_current_ = 03051 CORBA::IDLType::_duplicate (new_def.in ()); 03052 03053 CORBA::Container_ptr used_scope = 03054 CORBA::Container::_nil (); 03055 03056 // Pop the new IR object back off the scope stack. 03057 if (be_global->ifr_scopes ().pop (used_scope) != 0) 03058 { 03059 ACE_ERROR_RETURN (( 03060 LM_ERROR, 03061 ACE_TEXT ("(%N:%l) ifr_adding_visitor::") 03062 ACE_TEXT ("create_home_def -") 03063 ACE_TEXT (" scope pop failed\n") 03064 ), 03065 -1 03066 ); 03067 } 03068 } 03069 else 03070 { 03071 ACE_ERROR_RETURN (( 03072 LM_ERROR, 03073 ACE_TEXT ("(%N:%l) ifr_adding_visitor::create_home_def -") 03074 ACE_TEXT (" scope stack is empty\n") 03075 ), 03076 -1 03077 ); 03078 } 03079 03080 return 0; 03081 } |
|
Definition at line 2538 of file ifr_adding_visitor.cpp. References ACE_ERROR_RETURN, ACE_TEXT(), be_global, BE_GlobalData::ifr_scopes(), ir_current_, CORBA::is_nil(), LM_ERROR, BE_GlobalData::repository(), and visit_scope(). Referenced by visit_interface().
02539 { 02540 CORBA::ULong n_parents = static_cast<CORBA::ULong> (node->n_inherits ()); 02541 AST_Interface **parents = node->inherits (); 02542 CORBA::Contained_var result; 02543 CORBA::AbstractInterfaceDefSeq abs_bases; 02544 CORBA::InterfaceDefSeq bases; 02545 02546 if (node->is_abstract ()) 02547 { 02548 abs_bases.length (n_parents); 02549 02550 // Construct a list of the parents. 02551 for (CORBA::ULong i = 0; i < n_parents; ++i) 02552 { 02553 result = 02554 be_global->repository ()->lookup_id (parents[i]->repoID ()); 02555 02556 // If we got to visit_interface() from a forward declared interface, 02557 // this node may not yet be in the repository. 02558 if (CORBA::is_nil (result.in ())) 02559 { 02560 int status = this->create_interface_def (parents[i]); 02561 02562 if (status != 0) 02563 { 02564 ACE_ERROR_RETURN (( 02565 LM_ERROR, 02566 ACE_TEXT ("(%N:%l) ifr_adding_visitor::") 02567 ACE_TEXT ("create_interface_def -") 02568 ACE_TEXT (" parent interfacedef creation failed\n") 02569 ), 02570 -1 02571 ); 02572 } 02573 02574 bases[i] = 02575 CORBA::AbstractInterfaceDef::_narrow (this->ir_current_.in ()); 02576 } 02577 else 02578 { 02579 abs_bases[i] = 02580 CORBA::AbstractInterfaceDef::_narrow (result.in ()); 02581 } 02582 02583 if (CORBA::is_nil (abs_bases[i])) 02584 { 02585 ACE_ERROR_RETURN (( 02586 LM_ERROR, 02587 ACE_TEXT ("(%N:%l) ifr_adding_visitor::") 02588 ACE_TEXT ("create_interface_def -") 02589 ACE_TEXT (" CORBA::InterfaceDef::_narrow failed\n") 02590 ), 02591 -1 02592 ); 02593 } 02594 } 02595 } 02596 else 02597 { 02598 bases.length (n_parents); 02599 02600 // Construct a list of the parents. 02601 for (CORBA::ULong i = 0; i < n_parents; ++i) 02602 { 02603 result = 02604 be_global->repository ()->lookup_id (parents[i]->repoID ()); 02605 02606 // If we got to visit_interface() from a forward declared interface, 02607 // this node may not yet be in the repository. 02608 if (CORBA::is_nil (result.in ())) 02609 { 02610 int status = this->create_interface_def (parents[i]); 02611 02612 if (status != 0) 02613 { 02614 ACE_ERROR_RETURN (( 02615 LM_ERROR, 02616 ACE_TEXT ("(%N:%l) ifr_adding_visitor::") 02617 ACE_TEXT ("create_interface_def -") 02618 ACE_TEXT (" parent interfacedef creation failed\n") 02619 ), 02620 -1 02621 ); 02622 } 02623 02624 bases[i] = CORBA::InterfaceDef::_narrow (this->ir_current_.in ()); 02625 } 02626 else 02627 { 02628 bases[i] = CORBA::InterfaceDef::_narrow (result.in ()); 02629 } 02630 02631 if (CORBA::is_nil (bases[i])) 02632 { 02633 ACE_ERROR_RETURN (( 02634 LM_ERROR, 02635 ACE_TEXT ("(%N:%l) ifr_adding_visitor::") 02636 ACE_TEXT ("create_interface_def -") 02637 ACE_TEXT (" CORBA::InterfaceDef::_narrow failed\n") 02638 ), 02639 -1 02640 ); 02641 } 02642 } 02643 } 02644 02645 CORBA::Container_ptr current_scope = 02646 CORBA::Container::_nil (); 02647 02648 if (be_global->ifr_scopes ().top (current_scope) == 0) 02649 { 02650 CORBA::InterfaceDef_var new_def; 02651 02652 if (node->is_local ()) 02653 { 02654 new_def = 02655 current_scope->create_local_interface ( 02656 node->repoID (), 02657 node->local_name ()->get_string (), 02658 node->version (), 02659 bases 02660 ); 02661 } 02662 else if (node->is_abstract ()) 02663 { 02664 new_def = 02665 current_scope->create_abstract_interface ( 02666 node->repoID (), 02667 node->local_name ()->get_string (), 02668 node->version (), 02669 abs_bases 02670 ); 02671 } 02672 else 02673 { 02674 new_def = 02675 current_scope->create_interface ( 02676 node->repoID (), 02677 node->local_name ()->get_string (), 02678 node->version (), 02679 bases 02680 ); 02681 } 02682 02683 02684 node->ifr_added (true); 02685 02686 // Push the new IR object onto the scope stack. 02687 CORBA::Container_var new_scope = 02688 CORBA::Container::_narrow (new_def.in ()); 02689 02690 if (be_global->ifr_scopes ().push (new_scope.in ()) != 0) 02691 { 02692 ACE_ERROR_RETURN (( 02693 LM_ERROR, 02694 ACE_TEXT ("(%N:%l) ifr_adding_visitor::") 02695 ACE_TEXT ("create_interface_def -") 02696 ACE_TEXT (" scope push failed\n") 02697 ), 02698 -1 02699 ); 02700 } 02701 02702 // Visit the members, if any. 02703 if (this->visit_scope (node) == -1) 02704 { 02705 ACE_ERROR_RETURN (( 02706 LM_ERROR, 02707 ACE_TEXT ("(%N:%l) ifr_adding_visitor::") 02708 ACE_TEXT ("create_interface_def -") 02709 ACE_TEXT (" visit_scope failed\n") 02710 ), 02711 -1 02712 ); 02713 } 02714 02715 // This spot in the AST doesn't necessarily have to be the 02716 // interface definition - it could be any reference to it. 02717 // The front end will already have fully defined it, so all 02718 // the info is available anywhere. So it's a good idea to 02719 // update the current IR object holder now. This will 02720 // consume the objref pointer. 02721 this->ir_current_ = 02722 CORBA::IDLType::_duplicate (new_def.in ()); 02723 02724 CORBA::Container_ptr used_scope = 02725 CORBA::Container::_nil (); 02726 02727 // Pop the new IR object back off the scope stack. 02728 if (be_global->ifr_scopes ().pop (used_scope) != 0) 02729 { 02730 ACE_ERROR_RETURN (( 02731 LM_ERROR, 02732 ACE_TEXT ("(%N:%l) ifr_adding_visitor::") 02733 ACE_TEXT ("create_interface_def -") 02734 ACE_TEXT (" scope pop failed\n") 02735 ), 02736 -1 02737 ); 02738 } 02739 } 02740 else 02741 { 02742 ACE_ERROR_RETURN (( 02743 LM_ERROR, 02744 ACE_TEXT ("(%N:%l) ifr_adding_visitor::create_interface_def -") 02745 ACE_TEXT (" scope stack is empty\n") 02746 ), 02747 -1 02748 ); 02749 } 02750 02751 return 0; 02752 } |
|
Definition at line 2755 of file ifr_adding_visitor.cpp. References ACE_ERROR_RETURN, ACE_TEXT(), be_global, fill_abstract_base_values(), fill_base_value(), fill_initializers(), fill_supported_interfaces(), BE_GlobalData::ifr_scopes(), ir_current_, LM_ERROR, and visit_scope(). Referenced by visit_valuetype().
02756 { 02757 CORBA::Container_ptr current_scope = 02758 CORBA::Container::_nil (); 02759 02760 if (be_global->ifr_scopes ().top (current_scope) == 0) 02761 { 02762 CORBA::ValueDef_var base_value; 02763 this->fill_base_value (base_value.out (), 02764 node); 02765 02766 CORBA::ValueDefSeq abstract_base_values; 02767 this->fill_abstract_base_values (abstract_base_values, 02768 node); 02769 02770 CORBA::InterfaceDefSeq supported_interfaces; 02771 this->fill_supported_interfaces (supported_interfaces, 02772 node); 02773 02774 CORBA::ExtInitializerSeq initializers; 02775 this->fill_initializers (initializers, 02776 node); 02777 02778 CORBA::ExtValueDef_var new_def = 02779 current_scope->create_ext_value ( 02780 node->repoID (), 02781 node->local_name ()->get_string (), 02782 node->version (), 02783 static_cast<CORBA::Boolean> (node->custom ()), 02784 static_cast<CORBA::Boolean> (node->is_abstract ()), 02785 base_value.in (), 02786 static_cast<CORBA::Boolean> (node->truncatable ()), 02787 abstract_base_values, 02788 supported_interfaces, 02789 initializers 02790 ); 02791 02792 node->ifr_added (true); 02793 02794 // Push the new IR object onto the scope stack. 02795 CORBA::Container_var new_scope = 02796 CORBA::Container::_narrow (new_def.in ()); 02797 02798 if (be_global->ifr_scopes ().push (new_scope.in ()) != 0) 02799 { 02800 ACE_ERROR_RETURN (( 02801 LM_ERROR, 02802 ACE_TEXT ("(%N:%l) ifr_adding_visitor::") 02803 ACE_TEXT ("create_value_def -") 02804 ACE_TEXT (" scope push failed\n") 02805 ), 02806 -1 02807 ); 02808 } 02809 02810 // Visit the members, if any. 02811 if (this->visit_scope (node) == -1) 02812 { 02813 ACE_ERROR_RETURN (( 02814 LM_ERROR, 02815 ACE_TEXT ("(%N:%l) ifr_adding_visitor::") 02816 ACE_TEXT ("create_value_def -") 02817 ACE_TEXT (" visit_scope failed\n") 02818 ), 02819 -1 02820 ); 02821 } 02822 02823 // This spot in the AST doesn't necessarily have to be the 02824 // interface definition - it could be any reference to it. 02825 // The front end will already have fully defined it, so all 02826 // the info is available anywhere. So it's a good idea to 02827 // update the current IR object holder now. This will 02828 // consume the objref pointer. 02829 this->ir_current_ = 02830 CORBA::IDLType::_duplicate (new_def.in ()); 02831 02832 CORBA::Container_ptr used_scope = 02833 CORBA::Container::_nil (); 02834 02835 // Pop the new IR object back off the scope stack. 02836 if (be_global->ifr_scopes ().pop (used_scope) != 0) 02837 { 02838 ACE_ERROR_RETURN (( 02839 LM_ERROR, 02840 ACE_TEXT ("(%N:%l) ifr_adding_visitor::") 02841 ACE_TEXT ("create_value_def -") 02842 ACE_TEXT (" scope pop failed\n") 02843 ), 02844 -1 02845 ); 02846 } 02847 } 02848 else 02849 { 02850 ACE_ERROR_RETURN (( 02851 LM_ERROR, 02852 ACE_TEXT ("(%N:%l) ifr_adding_visitor::create_value_def -") 02853 ACE_TEXT (" scope stack is empty\n") 02854 ), 02855 -1 02856 ); 02857 } 02858 02859 return 0; 02860 } |
|
This will put the repo entry into ir_current_. Definition at line 3195 of file ifr_adding_visitor.cpp. References ACE_ERROR_RETURN, ACE_TEXT(), be_global, BE_GlobalData::ifr_scopes(), ir_current_, LM_ERROR, and BE_GlobalData::repository(). Referenced by visit_field().
03196 { 03197 try 03198 { 03199 AST_Type *bt = node->field_type (); 03200 AST_Decl::NodeType nt = bt->node_type (); 03201 03202 // We can't use lookup_id() on these, because 03203 // they don't inherit from Contained. 03204 if (nt == AST_Decl::NT_pre_defined 03205 || nt == AST_Decl::NT_string 03206 || nt == AST_Decl::NT_wstring 03207 || nt == AST_Decl::NT_array 03208 || nt == AST_Decl::NT_sequence) 03209 { 03210 /// This will put the repo entry into ir_current_. 03211 if (bt->ast_accept (this) != 0) 03212 { 03213 ACE_ERROR_RETURN (( 03214 LM_ERROR, 03215 ACE_TEXT ("(%N:%l) ifr_adding_visitor::") 03216 ACE_TEXT ("create_value_member -") 03217 ACE_TEXT (" visit base type failed\n") 03218 ), 03219 -1 03220 ); 03221 } 03222 } 03223 else 03224 { 03225 // If the IDL is legal, this will succeed. 03226 CORBA::Contained_var holder = 03227 be_global->repository ()->lookup_id (bt->repoID ()); 03228 03229 this->ir_current_ = 03230 CORBA::IDLType::_narrow (holder.in ()); 03231 } 03232 03233 CORBA::Visibility vis = CORBA::PUBLIC_MEMBER; 03234 03235 switch (node->visibility ()) 03236 { 03237 case AST_Field::vis_PUBLIC: 03238 break; 03239 case AST_Field::vis_PRIVATE: 03240 vis = CORBA::PRIVATE_MEMBER; 03241 break; 03242 default: 03243 ACE_ERROR_RETURN (( 03244 LM_ERROR, 03245 ACE_TEXT ("(%N:%l) ifr_adding_visitor::create_value_member -") 03246 ACE_TEXT (" bad visibility value in node\n") 03247 ), 03248 -1 03249 ); 03250 }; 03251 03252 CORBA::Container_ptr current_scope = CORBA::Container::_nil (); 03253 03254 if (be_global->ifr_scopes ().top (current_scope) != 0) 03255 { 03256 ACE_ERROR_RETURN (( 03257 LM_ERROR, 03258 ACE_TEXT ("(%N:%l) ifr_adding_visitor::") 03259 ACE_TEXT ("create_value_member -") 03260 ACE_TEXT (" scope stack empty\n") 03261 ), 03262 -1 03263 ); 03264 } 03265 03266 CORBA::ValueDef_var vt = 03267 CORBA::ValueDef::_narrow (current_scope); 03268 03269 CORBA::ValueMemberDef_var vm = 03270 vt->create_value_member (node->repoID (), 03271 node->local_name ()->get_string (), 03272 node->version (), 03273 this->ir_current_.in (), 03274 vis); 03275 } 03276 catch (const CORBA::Exception& ex) 03277 { 03278 ex._tao_print_exception (ACE_TEXT ("create_value_member")); 03279 03280 return -1; 03281 } 03282 03283 return 0; 03284 } |
|
Definition at line 2501 of file ifr_adding_visitor.cpp. References ACE_ERROR, ACE_TEXT(), be_global, ir_current_, CORBA::is_nil(), LM_ERROR, and BE_GlobalData::repository(). Referenced by visit_array(), visit_sequence(), visit_typedef(), and visit_valuebox().
02502 { 02503 AST_Decl::NodeType nt = base_type->node_type (); 02504 bool no_repo_id = nt == AST_Decl::NT_array 02505 || nt == AST_Decl::NT_sequence 02506 || base_type->anonymous (); 02507 02508 if (no_repo_id || owned) 02509 { 02510 if (base_type->ast_accept (this) == -1) 02511 { 02512 ACE_ERROR (( 02513 LM_ERROR, 02514 ACE_TEXT ("(%N:%l) ifr_adding_visitor::element_type -") 02515 ACE_TEXT (" failed to accept visitor\n") 02516 )); 02517 } 02518 } 02519 else 02520 { 02521 CORBA::Contained_var contained = 02522 be_global->repository ()->lookup_id (base_type->repoID ()); 02523 02524 if (CORBA::is_nil (contained.in ())) 02525 { 02526 ACE_ERROR (( 02527 LM_ERROR, 02528 ACE_TEXT ("(%N:%l) ifr_adding_visitor::element_type -") 02529 ACE_TEXT (" lookup_id failed\n") 02530 )); 02531 } 02532 02533 this->ir_current_ = CORBA::IDLType::_narrow (contained.in ()); 02534 } 02535 } |
|
Definition at line 3991 of file ifr_adding_visitor.cpp. References ssize_t. Referenced by visit_all_consumes(), visit_all_emits(), visit_all_provides(), visit_all_publishes(), and visit_all_uses().
03993 { 03994 ssize_t pos = str.rfind (':'); 03995 str = str.substr (0, pos) + '/' + local_name + str.substr (pos); 03996 } |
|
Definition at line 2326 of file ifr_adding_visitor.cpp. Referenced by visit_constant().
02327 { 02328 switch (et) 02329 { 02330 case AST_Expression::EV_short: 02331 return CORBA::pk_short; 02332 case AST_Expression::EV_ushort: 02333 return CORBA::pk_ushort; 02334 case AST_Expression::EV_long: 02335 return CORBA::pk_long; 02336 case AST_Expression::EV_ulong: 02337 return CORBA::pk_ulong; 02338 case AST_Expression::EV_longlong: 02339 return CORBA::pk_longlong; 02340 case AST_Expression::EV_ulonglong: 02341 return CORBA::pk_ulonglong; 02342 case AST_Expression::EV_float: 02343 return CORBA::pk_float; 02344 case AST_Expression::EV_double: 02345 return CORBA::pk_double; 02346 case AST_Expression::EV_longdouble: 02347 return CORBA::pk_longdouble; 02348 case AST_Expression::EV_char: 02349 return CORBA::pk_char; 02350 case AST_Expression::EV_wchar: 02351 return CORBA::pk_wchar; 02352 case AST_Expression::EV_octet: 02353 return CORBA::pk_octet; 02354 case AST_Expression::EV_bool: 02355 return CORBA::pk_boolean; 02356 case AST_Expression::EV_string: 02357 return CORBA::pk_string; 02358 case AST_Expression::EV_wstring: 02359 return CORBA::pk_wstring; 02360 case AST_Expression::EV_any: 02361 return CORBA::pk_any; 02362 case AST_Expression::EV_void: 02363 return CORBA::pk_void; 02364 case AST_Expression::EV_none: 02365 return CORBA::pk_null; 02366 default: 02367 return CORBA::pk_null; 02368 } 02369 } |
|
Definition at line 3469 of file ifr_adding_visitor.cpp. Referenced by create_event_def(), create_value_def(), visit_eventtype(), and visit_valuetype().
03471 { 03472 CORBA::Long s_length = node->n_inherits (); 03473 result.length (0); 03474 03475 // Not sure if this could be negative in some default case or 03476 // not. If it's 0, we should make the call anyway to clear 03477 // existing entries, if any, from the repository. 03478 if (s_length > 0) 03479 { 03480 AST_Interface **list = node->inherits (); 03481 CORBA::ULong u_length = static_cast<CORBA::ULong> (s_length); 03482 bool first_abs = list[0]->is_abstract (); 03483 result.length (first_abs ? u_length : u_length - 1); 03484 03485 for (CORBA::ULong i = 0; i < u_length; ++i) 03486 { 03487 if (i == 0 && ! first_abs) 03488 { 03489 continue; 03490 } 03491 03492 // Get list[i] into ir_current_. 03493 (void) list[i]->ast_accept (this); 03494 03495 result[first_abs ? i : i - 1] = 03496 CORBA::ValueDef::_narrow (this->ir_current_.in ()); 03497 } 03498 } 03499 } |
|
Definition at line 3349 of file ifr_adding_visitor.cpp. References be_global, CORBA::is_nil(), and BE_GlobalData::repository(). Referenced by create_component_def(), visit_component(), and visit_component_fwd().
03353 { 03354 result = CORBA::ComponentIR::ComponentDef::_nil (); 03355 AST_Component *base_component = node->base_component (); 03356 03357 if (base_component == 0) 03358 { 03359 return; 03360 } 03361 03362 CORBA::Contained_var holder = 03363 be_global->repository ()->lookup_id ( 03364 base_component->repoID () 03365 ); 03366 03367 if (!CORBA::is_nil (holder.in ())) 03368 { 03369 result = 03370 CORBA::ComponentIR::ComponentDef::_narrow (holder.in ()); 03371 } 03372 } |
|
Definition at line 3375 of file ifr_adding_visitor.cpp. References be_global, CORBA::is_nil(), and BE_GlobalData::repository(). Referenced by create_home_def().
03377 { 03378 result = CORBA::ComponentIR::HomeDef::_nil (); 03379 AST_Home *base_home = node->base_home (); 03380 03381 if (base_home == 0) 03382 { 03383 return; 03384 } 03385 03386 CORBA::Contained_var holder = 03387 be_global->repository ()->lookup_id ( 03388 base_home->repoID () 03389 ); 03390 03391 if (!CORBA::is_nil (holder.in ())) 03392 { 03393 result = 03394 CORBA::ComponentIR::HomeDef::_narrow (holder.in ()); 03395 } 03396 else 03397 { 03398 /// Maybe the base home is in an included IDL file - put it in 03399 /// the repository and go again. 03400 (void) base_home->ast_accept (this); 03401 this->fill_base_home (result, 03402 node); 03403 } 03404 } |
|
Definition at line 3325 of file ifr_adding_visitor.cpp. References be_global, CORBA::is_nil(), and BE_GlobalData::repository(). Referenced by create_event_def(), create_value_def(), visit_eventtype(), and visit_valuetype().
03327 { 03328 result = CORBA::ValueDef::_nil (); 03329 AST_ValueType *base_value = node->inherits_concrete (); 03330 03331 if (base_value == 0) 03332 { 03333 return; 03334 } 03335 03336 CORBA::Contained_var holder = 03337 be_global->repository ()->lookup_id ( 03338 base_value->repoID () 03339 ); 03340 03341 if (!CORBA::is_nil (holder.in ())) 03342 { 03343 result = 03344 CORBA::ValueDef::_narrow (holder.in ()); 03345 } 03346 } |
|
Definition at line 3711 of file ifr_adding_visitor.cpp. References be_global, and BE_GlobalData::repository().
03713 { 03714 if (list == 0) 03715 { 03716 result.length (0); 03717 return; 03718 } 03719 03720 result.length (static_cast<CORBA::ULong> (list->length ())); 03721 CORBA::ULong index = 0; 03722 AST_Decl *d = 0; 03723 CORBA::Contained_var holder; 03724 03725 for (UTL_ExceptlistActiveIterator ei (list); 03726 !ei.is_done (); 03727 ei.next (), ++index) 03728 { 03729 d = ei.item (); 03730 03731 // Just to make sure. The call will return quickly if d has already 03732 // been visited. Can't use ir_current_ because ExceptionDef doesn't 03733 // inherit from IDLType. 03734 (void) d->ast_accept (this); 03735 03736 holder = be_global->repository ()->lookup_id (d->repoID ()); 03737 03738 result[index] = 03739 CORBA::ExceptionDef::_narrow (holder.in ()); 03740 } 03741 } |
|
Definition at line 3685 of file ifr_adding_visitor.cpp. Referenced by fill_get_exceptions(), fill_set_exceptions(), visit_all_factories(), and visit_all_finders().
03687 { 03688 switch (node->node_type ()) 03689 { 03690 case AST_Decl::NT_op: 03691 { 03692 AST_Operation *op = AST_Operation::narrow_from_decl (node); 03693 this->fill_exceptions (result, 03694 op->exceptions ()); 03695 return; 03696 } 03697 case AST_Decl::NT_factory: 03698 { 03699 AST_Factory *f = AST_Factory::narrow_from_decl (node); 03700 this->fill_exceptions (result, 03701 f->exceptions ()); 03702 return; 03703 } 03704 default: 03705 result.length (0); 03706 return; 03707 } 03708 } |
|
Definition at line 3669 of file ifr_adding_visitor.cpp. References fill_exceptions(). Referenced by visit_attribute().
03671 { 03672 this->fill_exceptions (result, 03673 node->get_get_exceptions ()); 03674 } |
|
Definition at line 3502 of file ifr_adding_visitor.cpp. References fill_interfaces().
03504 { 03505 result.length (0); 03506 this->fill_interfaces (result, 03507 node->inherits (), 03508 node->n_inherits ()); 03509 } |
|
Definition at line 3577 of file ifr_adding_visitor.cpp. References ACE_ERROR, ACE_TEXT(), LM_ERROR, ACE_Vector< T, DEFAULT_SIZE >::push_back(), ACE_Vector< T, DEFAULT_SIZE >::size(), and CORBA::string_dup(). Referenced by create_event_def(), create_value_def(), visit_eventtype(), and visit_valuetype().
03579 { 03580 result.length (0); 03581 AST_Decl *item = 0; 03582 ACE_Vector<AST_Factory *> factories; 03583 03584 for (UTL_ScopeActiveIterator v_iter (node, 03585 UTL_Scope::IK_decls); 03586 !v_iter.is_done (); 03587 v_iter.next ()) 03588 { 03589 item = v_iter.item (); 03590 03591 if (item->node_type () == AST_Decl::NT_factory) 03592 { 03593 factories.push_back (AST_Factory::narrow_from_decl (item)); 03594 } 03595 } 03596 03597 CORBA::ULong n_factories = factories.size (); 03598 03599 if (n_factories == 0) 03600 { 03601 return; 03602 } 03603 03604 result.length (n_factories); 03605 CORBA::ULong n_args = 0; 03606 AST_Argument *arg = 0; 03607 CORBA::ULong index = 0; 03608 AST_Exception *excp = 0; 03609 CORBA::Contained_var holder; 03610 03611 for (CORBA::ULong i = 0; i < n_factories; ++i) 03612 { 03613 result[i].name = 03614 CORBA::string_dup (factories[i]->local_name ()->get_string ()); 03615 n_args = static_cast<CORBA::ULong> (factories[i]->argument_count ()); 03616 result[i].members.length (n_args); 03617 03618 // The factory should have nothing in its scope but args. 03619 for (UTL_ScopeActiveIterator f_iter (factories[i], 03620 UTL_Scope::IK_decls); 03621 !f_iter.is_done (); 03622 f_iter.next (), ++index) 03623 { 03624 arg = AST_Argument::narrow_from_decl (f_iter.item ()); 03625 result[i].members[index].name = 03626 CORBA::string_dup (arg->local_name ()->get_string ()); 03627 result[i].members[index].type = 03628 CORBA::TypeCode::_duplicate (CORBA::_tc_void); 03629 03630 /// This will put the field type in ir_current_, and also add it 03631 /// to the repository if it's not already there. 03632 if (arg->field_type ()->ast_accept (this) != 0) 03633 { 03634 ACE_ERROR (( 03635 LM_ERROR, 03636 ACE_TEXT ("(%N:%l) ifr_adding_visitor::") 03637 ACE_TEXT ("fill_initializers -") 03638 ACE_TEXT (" failed to accept arg type visitor\n") 03639 )); 03640 } 03641 03642 result[i].members[index].type_def = 03643 CORBA::IDLType::_duplicate (this->ir_current_.in ()); 03644 } 03645 03646 CORBA::ULong n_exceptions = 03647 static_cast<CORBA::ULong> (factories[i]->n_exceptions ()); 03648 result[i].exceptions.length (n_exceptions); 03649 index = 0; 03650 03651 for (UTL_ExceptlistActiveIterator ei (factories[i]->exceptions ()); 03652 !ei.is_done (); 03653 ei.next ()) 03654 { 03655 excp = AST_Exception::narrow_from_decl (ei.item ()); 03656 result[i].exceptions[index].name = 03657 CORBA::string_dup (excp->local_name ()->get_string ()); 03658 result[i].exceptions[index].id = excp->repoID (); 03659 result[i].exceptions[index].defined_in = 03660 ScopeAsDecl (excp->defined_in ())->repoID (); 03661 result[i].exceptions[index].version = excp->version (); 03662 result[i].exceptions[index++].type = 03663 CORBA::TypeCode::_duplicate (CORBA::_tc_void); 03664 } 03665 } 03666 } |
|
Definition at line 3553 of file ifr_adding_visitor.cpp. Referenced by fill_inherited_interfaces(), and fill_supported_interfaces().
03556 { 03557 // Not sure if this could be negative in some default case or 03558 // not. If it's 0, we should make the call anyway to clear 03559 // existing entries, if any, from the repository. 03560 if (length > 0) 03561 { 03562 CORBA::ULong u_length = static_cast<CORBA::ULong> (length); 03563 result.length (u_length); 03564 03565 for (CORBA::ULong i = 0; i < u_length; ++i) 03566 { 03567 // Get list[i] into ir_current_. 03568 (void) list[i]->ast_accept (this); 03569 03570 result[i] = 03571 CORBA::InterfaceDef::_narrow (this->ir_current_.in ()); 03572 } 03573 } 03574 } |
|
Definition at line 3407 of file ifr_adding_visitor.cpp. References be_global, CORBA::is_nil(), and BE_GlobalData::repository(). Referenced by create_home_def().
03411 { 03412 result = CORBA::ComponentIR::ComponentDef::_nil (); 03413 AST_Component *managed_component = node->managed_component (); 03414 03415 if (managed_component == 0) 03416 { 03417 return; 03418 } 03419 03420 CORBA::Contained_var holder = 03421 be_global->repository ()->lookup_id (managed_component->repoID ()); 03422 03423 if (!CORBA::is_nil (holder.in ())) 03424 { 03425 result = 03426 CORBA::ComponentIR::ComponentDef::_narrow (holder.in ()); 03427 } 03428 else 03429 { 03430 /// Maybe the managed component is in an included IDL file - put it in 03431 /// the repository and go again. 03432 (void) managed_component->ast_accept (this); 03433 this->fill_managed_component (result, 03434 node); 03435 } 03436 } |
|
Definition at line 3744 of file ifr_adding_visitor.cpp. References CORBA::string_dup(). Referenced by visit_all_factories(), and visit_all_finders().
03746 { 03747 AST_Argument *arg = 0; 03748 CORBA::ULong n_args = static_cast<CORBA::ULong> (node->argument_count ()); 03749 result.length (n_args); 03750 CORBA::ULong index = 0; 03751 CORBA::Contained_var holder; 03752 03753 for (UTL_ScopeActiveIterator iter (node, 03754 UTL_Scope::IK_decls); 03755 ! iter.is_done (); 03756 iter.next (), ++index) 03757 { 03758 arg = AST_Argument::narrow_from_decl (iter.item ()); 03759 result[index].name = 03760 CORBA::string_dup (arg->local_name ()->get_string ()); 03761 result[index].type = CORBA::TypeCode::_duplicate (CORBA::_tc_void); 03762 03763 // Get the arg type into ir_current_. 03764 (void) arg->ast_accept (this); 03765 03766 result[index].type_def = 03767 CORBA::IDLType::_duplicate (this->ir_current_.in ()); 03768 03769 result[index].mode = CORBA::PARAM_IN; 03770 } 03771 } |
|
Definition at line 3439 of file ifr_adding_visitor.cpp. References be_global, CORBA::is_nil(), and BE_GlobalData::repository(). Referenced by create_home_def().
03441 { 03442 result = CORBA::ValueDef::_nil (); 03443 AST_ValueType *primary_key = node->primary_key (); 03444 03445 if (primary_key == 0) 03446 { 03447 return; 03448 } 03449 03450 CORBA::Contained_var holder = 03451 be_global->repository ()->lookup_id (primary_key->repoID ()); 03452 03453 if (!CORBA::is_nil (holder.in ())) 03454 { 03455 result = 03456 CORBA::ValueDef::_narrow (holder.in ()); 03457 } 03458 else 03459 { 03460 /// Maybe the primary key is in an included IDL file - put it in 03461 /// the repository and go again. 03462 (void) primary_key->ast_accept (this); 03463 this->fill_primary_key (result, 03464 node); 03465 } 03466 } |
|
Definition at line 3677 of file ifr_adding_visitor.cpp. References fill_exceptions(). Referenced by visit_attribute().
03679 { 03680 this->fill_exceptions (result, 03681 node->get_set_exceptions ()); 03682 } |
|
Definition at line 3512 of file ifr_adding_visitor.cpp. References fill_interfaces(). Referenced by create_component_def(), create_event_def(), create_home_def(), create_value_def(), visit_component(), visit_component_fwd(), visit_eventtype(), and visit_valuetype().
03514 { 03515 result.length (0); 03516 CORBA::Long s_length = 0; 03517 AST_Interface **list = 0; 03518 03519 switch (node->node_type ()) 03520 { 03521 case AST_Decl::NT_valuetype: 03522 case AST_Decl::NT_eventtype: 03523 { 03524 AST_ValueType *v = AST_ValueType::narrow_from_decl (node); 03525 s_length = v->n_supports (); 03526 list = v->supports (); 03527 break; 03528 } 03529 case AST_Decl::NT_component: 03530 { 03531 AST_Component *c = AST_Component::narrow_from_decl (node); 03532 s_length = c->n_supports (); 03533 list = c->supports (); 03534 break; 03535 } 03536 case AST_Decl::NT_home: 03537 { 03538 AST_Home *h = AST_Home::narrow_from_decl (node); 03539 s_length = h->n_supports (); 03540 list = h->supports (); 03541 break; 03542 } 03543 default: 03544 return; 03545 } 03546 03547 this->fill_interfaces (result, 03548 list, 03549 s_length); 03550 } |
|
Definition at line 3287 of file ifr_adding_visitor.cpp. References ACE_ERROR, ACE_TEXT(), be_global, ir_current_, LM_ERROR, and BE_GlobalData::repository(). Referenced by ifr_adding_visitor_operation::visit_argument(), visit_attribute(), ifr_adding_visitor_operation::visit_operation(), ifr_adding_visitor_union::visit_scope(), ifr_adding_visitor_structure::visit_scope(), and ifr_adding_visitor_exception::visit_scope().
03288 { 03289 switch (node->node_type ()) 03290 { 03291 // For anonymous types, a new IR object is be created each 03292 // time, so we just visit the node, which get the object and 03293 // updates ir_current_. 03294 case AST_Decl::NT_pre_defined: 03295 case AST_Decl::NT_string: 03296 case AST_Decl::NT_wstring: 03297 case AST_Decl::NT_array: 03298 case AST_Decl::NT_sequence: 03299 if (node->ast_accept (this) == -1) 03300 { 03301 ACE_ERROR (( 03302 LM_ERROR, 03303 ACE_TEXT ("(%N:%l) ifr_adding_visitor::") 03304 ACE_TEXT ("get_scope_member -") 03305 ACE_TEXT (" failed to accept visitor\n") 03306 )); 03307 } 03308 03309 break; 03310 // For names types, we can just look up the entry and update 03311 // ir_current_. 03312 default: 03313 { 03314 CORBA::Contained_var prev_def = 03315 be_global->repository ()->lookup_id (node->repoID ()); 03316 03317 this->ir_current_ = 03318 CORBA::IDLType::_narrow (prev_def.in ()); 03319 break; 03320 } 03321 } 03322 } |
|
Definition at line 2427 of file ifr_adding_visitor.cpp. References ACE_NEW, and ACE_OS::strlen(). Referenced by visit_constant(), and ifr_adding_visitor_union::visit_scope().
02429 { 02430 switch (ev->et) 02431 { 02432 case AST_Expression::EV_short: 02433 any <<= ev->u.sval; 02434 break; 02435 case AST_Expression::EV_ushort: 02436 any <<= ev->u.usval; 02437 break; 02438 case AST_Expression::EV_long: 02439 any <<= static_cast<CORBA::Long> (ev->u.lval); 02440 break; 02441 case AST_Expression::EV_ulong: 02442 any <<= static_cast<CORBA::ULong> (ev->u.ulval); 02443 break; 02444 #if !defined (ACE_LACKS_LONGLONG_T) 02445 case AST_Expression::EV_longlong: 02446 any <<= ev->u.llval; 02447 break; 02448 case AST_Expression::EV_ulonglong: 02449 any <<= ev->u.ullval; 02450 break; 02451 #endif /* !defined (ACE_LACKS_LONGLONG_T) */ 02452 case AST_Expression::EV_float: 02453 any <<= ev->u.fval; 02454 break; 02455 case AST_Expression::EV_double: 02456 any <<= ev->u.dval; 02457 break; 02458 #if 0 02459 case AST_Expression::EV_longdouble: 02460 // Not implemented in IDL compiler. 02461 #endif 02462 case AST_Expression::EV_char: 02463 any <<= CORBA::Any::from_char (ev->u.cval); 02464 break; 02465 case AST_Expression::EV_wchar: 02466 any <<= CORBA::Any::from_wchar (ev->u.wcval); 02467 break; 02468 case AST_Expression::EV_octet: 02469 any <<= CORBA::Any::from_octet (ev->u.oval); 02470 break; 02471 case AST_Expression::EV_bool: 02472 any <<= CORBA::Any::from_boolean ((CORBA::Boolean) ev->u.bval); 02473 break; 02474 case AST_Expression::EV_string: 02475 any <<= ev->u.strval->get_string (); 02476 break; 02477 case AST_Expression::EV_wstring: 02478 { 02479 char *str = ev->u.wstrval; 02480 size_t len = ACE_OS::strlen (str); 02481 CORBA::WChar *wstr = 0; 02482 ACE_NEW (wstr, 02483 CORBA::WChar[len + 1]); 02484 02485 for (size_t i = 0; i < len; ++i) 02486 { 02487 wstr[i] = static_cast<CORBA::WChar> (str[i]); 02488 } 02489 02490 wstr[len] = 0; 02491 any <<= wstr; 02492 delete wstr; 02493 break; 02494 } 02495 default: 02496 break; 02497 } 02498 } |
|
Definition at line 2372 of file ifr_adding_visitor.cpp. References ACE_OS::strcmp().
02373 { 02374 switch (node->pt ()) 02375 { 02376 case AST_PredefinedType::PT_short: 02377 return CORBA::pk_short; 02378 case AST_PredefinedType::PT_ushort: 02379 return CORBA::pk_ushort; 02380 case AST_PredefinedType::PT_long: 02381 return CORBA::pk_long; 02382 case AST_PredefinedType::PT_ulong: 02383 return CORBA::pk_ulong; 02384 case AST_PredefinedType::PT_longlong: 02385 return CORBA::pk_longlong; 02386 case AST_PredefinedType::PT_ulonglong: 02387 return CORBA::pk_ulonglong; 02388 case AST_PredefinedType::PT_float: 02389 return CORBA::pk_float; 02390 case AST_PredefinedType::PT_double: 02391 return CORBA::pk_double; 02392 case AST_PredefinedType::PT_longdouble: 02393 return CORBA::pk_longdouble; 02394 case AST_PredefinedType::PT_char: 02395 return CORBA::pk_char; 02396 case AST_PredefinedType::PT_wchar: 02397 return CORBA::pk_wchar; 02398 case AST_PredefinedType::PT_octet: 02399 return CORBA::pk_octet; 02400 case AST_PredefinedType::PT_boolean: 02401 return CORBA::pk_boolean; 02402 case AST_PredefinedType::PT_any: 02403 return CORBA::pk_any; 02404 case AST_PredefinedType::PT_void: 02405 return CORBA::pk_void; 02406 case AST_PredefinedType::PT_object: 02407 return CORBA::pk_objref; 02408 case AST_PredefinedType::PT_pseudo: 02409 { 02410 const char *local_name = node->local_name ()->get_string (); 02411 02412 if (!ACE_OS::strcmp (local_name, "Principal")) 02413 { 02414 return CORBA::pk_Principal; 02415 } 02416 else 02417 { 02418 return CORBA::pk_TypeCode; 02419 } 02420 } 02421 default: 02422 return CORBA::pk_null; 02423 } 02424 } |
|
Definition at line 3901 of file ifr_adding_visitor.cpp. References ACE_CString, ACE_Unbounded_Queue_Iterator< T >::advance(), be_global, ACE_Unbounded_Queue_Iterator< T >::done(), expand_id(), ACE_Unbounded_Queue_Iterator< T >::next(), and BE_GlobalData::repository(). Referenced by create_component_def(), visit_component(), and visit_component_fwd().
03903 { 03904 AST_Component::port_description *tmp = 0; 03905 CORBA::Contained_var contained; 03906 CORBA::ComponentIR::EventDef_var event_type; 03907 CORBA::ComponentIR::ConsumesDef_var new_def; 03908 char *local_name = 0; 03909 03910 for (ACE_Unbounded_Queue_Iterator<AST_Component::port_description> i ( 03911 node->consumes () 03912 ); 03913 ! i.done (); 03914 i.advance ()) 03915 { 03916 i.next (tmp); 03917 contained = be_global->repository ()->lookup_id (tmp->impl->repoID ()); 03918 03919 event_type = 03920 CORBA::ComponentIR::EventDef::_narrow (contained.in ()); 03921 03922 ACE_CString str (node->repoID ()); 03923 local_name = tmp->id->get_string (); 03924 this->expand_id (str, local_name); 03925 new_def = c->create_consumes (str.fast_rep (), 03926 local_name, 03927 tmp->impl->version (), 03928 event_type.in ()); 03929 } 03930 } |
|
Definition at line 3837 of file ifr_adding_visitor.cpp. References ACE_CString, ACE_Unbounded_Queue_Iterator< T >::advance(), be_global, ACE_Unbounded_Queue_Iterator< T >::done(), expand_id(), ACE_Unbounded_Queue_Iterator< T >::next(), and BE_GlobalData::repository(). Referenced by create_component_def(), visit_component(), and visit_component_fwd().
03839 { 03840 AST_Component::port_description *tmp = 0; 03841 CORBA::Contained_var contained; 03842 CORBA::ComponentIR::EventDef_var event_type; 03843 CORBA::ComponentIR::EmitsDef_var new_def; 03844 char *local_name = 0; 03845 03846 for (ACE_Unbounded_Queue_Iterator<AST_Component::port_description> i ( 03847 node->emits () 03848 ); 03849 ! i.done (); 03850 i.advance ()) 03851 { 03852 i.next (tmp); 03853 contained = be_global->repository ()->lookup_id (tmp->impl->repoID ()); 03854 03855 event_type = 03856 CORBA::ComponentIR::EventDef::_narrow (contained.in ()); 03857 03858 ACE_CString str (node->repoID ()); 03859 local_name = tmp->id->get_string (); 03860 this->expand_id (str, local_name); 03861 new_def = c->create_emits (str.fast_rep (), 03862 local_name, 03863 tmp->impl->version (), 03864 event_type.in ()); 03865 } 03866 } |
|
Definition at line 3933 of file ifr_adding_visitor.cpp. References ACE_Unbounded_Queue_Iterator< T >::advance(), ACE_Unbounded_Queue_Iterator< T >::done(), fill_exceptions(), fill_params(), and ACE_Unbounded_Queue_Iterator< T >::next(). Referenced by create_home_def().
03935 { 03936 AST_Operation **tmp = 0; 03937 CORBA::Contained_var contained; 03938 CORBA::ComponentIR::FactoryDef_var new_def; 03939 03940 for (ACE_Unbounded_Queue_Iterator<AST_Operation *> i (node->factories ()); 03941 ! i.done (); 03942 i.advance ()) 03943 { 03944 i.next (tmp); 03945 CORBA::ParDescriptionSeq params; 03946 this->fill_params (params, 03947 *tmp); 03948 03949 CORBA::ExceptionDefSeq exceptions; 03950 this->fill_exceptions (exceptions, 03951 *tmp); 03952 03953 new_def = h->create_factory ((*tmp)->repoID (), 03954 (*tmp)->local_name ()->get_string (), 03955 (*tmp)->version (), 03956 params, 03957 exceptions); 03958 } 03959 } |
|
Definition at line 3962 of file ifr_adding_visitor.cpp. References ACE_Unbounded_Queue_Iterator< T >::advance(), ACE_Unbounded_Queue_Iterator< T >::done(), fill_exceptions(), fill_params(), and ACE_Unbounded_Queue_Iterator< T >::next(). Referenced by create_home_def().
03964 { 03965 AST_Operation **tmp = 0; 03966 CORBA::Contained_var contained; 03967 CORBA::ComponentIR::FinderDef_var new_def; 03968 03969 for (ACE_Unbounded_Queue_Iterator<AST_Operation *> i (node->finders ()); 03970 ! i.done (); 03971 i.advance ()) 03972 { 03973 i.next (tmp); 03974 CORBA::ParDescriptionSeq params; 03975 this->fill_params (params, 03976 *tmp); 03977 03978 CORBA::ExceptionDefSeq exceptions; 03979 this->fill_exceptions (exceptions, 03980 *tmp); 03981 03982 new_def = h->create_finder ((*tmp)->repoID (), 03983 (*tmp)->local_name ()->get_string (), 03984 (*tmp)->version (), 03985 params, 03986 exceptions); 03987 } 03988 } |
|
Definition at line 3774 of file ifr_adding_visitor.cpp. References ACE_CString, ACE_Unbounded_Queue_Iterator< T >::advance(), be_global, ACE_Unbounded_Queue_Iterator< T >::done(), expand_id(), ACE_Unbounded_Queue_Iterator< T >::next(), and BE_GlobalData::repository(). Referenced by create_component_def(), visit_component(), and visit_component_fwd().
03776 { 03777 AST_Component::port_description *tmp = 0; 03778 CORBA::Contained_var contained; 03779 CORBA::InterfaceDef_var interface_type; 03780 CORBA::ComponentIR::ProvidesDef_var new_def; 03781 char *local_name = 0; 03782 03783 for (ACE_Unbounded_Queue_Iterator<AST_Component::port_description> i ( 03784 node->provides () 03785 ); 03786 ! i.done (); 03787 i.advance ()) 03788 { 03789 i.next (tmp); 03790 contained = be_global->repository ()->lookup_id (tmp->impl->repoID ()); 03791 03792 interface_type = CORBA::InterfaceDef::_narrow (contained.in ()); 03793 03794 ACE_CString str (node->repoID ()); 03795 local_name = tmp->id->get_string (); 03796 this->expand_id (str, local_name); 03797 new_def = c->create_provides (str.fast_rep (), 03798 local_name, 03799 tmp->impl->version (), 03800 interface_type.in ()); 03801 } 03802 } |
|
Definition at line 3869 of file ifr_adding_visitor.cpp. References ACE_CString, ACE_Unbounded_Queue_Iterator< T >::advance(), be_global, ACE_Unbounded_Queue_Iterator< T >::done(), expand_id(), ACE_Unbounded_Queue_Iterator< T >::next(), and BE_GlobalData::repository(). Referenced by create_component_def(), visit_component(), and visit_component_fwd().
03871 { 03872 AST_Component::port_description *tmp = 0; 03873 CORBA::Contained_var contained; 03874 CORBA::ComponentIR::EventDef_var event_type; 03875 CORBA::ComponentIR::PublishesDef_var new_def; 03876 char *local_name = 0; 03877 03878 for (ACE_Unbounded_Queue_Iterator<AST_Component::port_description> i ( 03879 node->publishes () 03880 ); 03881 ! i.done (); 03882 i.advance ()) 03883 { 03884 i.next (tmp); 03885 contained = be_global->repository ()->lookup_id (tmp->impl->repoID ()); 03886 03887 event_type = 03888 CORBA::ComponentIR::EventDef::_narrow (contained.in ()); 03889 03890 ACE_CString str (node->repoID ()); 03891 local_name = tmp->id->get_string (); 03892 this->expand_id (str, local_name); 03893 new_def = c->create_publishes (str.fast_rep (), 03894 local_name, 03895 tmp->impl->version (), 03896 event_type.in ()); 03897 } 03898 } |
|
Definition at line 3805 of file ifr_adding_visitor.cpp. References ACE_CString, ACE_Unbounded_Queue_Iterator< T >::advance(), be_global, ACE_Unbounded_Queue_Iterator< T >::done(), expand_id(), ACE_Unbounded_Queue_Iterator< T >::next(), and BE_GlobalData::repository(). Referenced by create_component_def(), visit_component(), and visit_component_fwd().
03807 { 03808 AST_Component::port_description *tmp = 0; 03809 CORBA::Contained_var contained; 03810 CORBA::InterfaceDef_var interface_type; 03811 CORBA::ComponentIR::UsesDef_var new_def; 03812 char *local_name = 0; 03813 03814 for (ACE_Unbounded_Queue_Iterator<AST_Component::port_description> i ( 03815 node->uses () 03816 ); 03817 ! i.done (); 03818 i.advance ()) 03819 { 03820 i.next (tmp); 03821 contained = be_global->repository ()->lookup_id (tmp->impl->repoID ()); 03822 03823 interface_type = CORBA::InterfaceDef::_narrow (contained.in ()); 03824 03825 ACE_CString str (node->repoID ()); 03826 local_name = tmp->id->get_string (); 03827 this->expand_id (str, local_name); 03828 new_def = c->create_uses (str.fast_rep (), 03829 local_name, 03830 tmp->impl->version (), 03831 interface_type.in (), 03832 static_cast<CORBA::Boolean> (tmp->is_multiple)); 03833 } 03834 } |
|
Reimplemented from ifr_visitor. Definition at line 2084 of file ifr_adding_visitor.cpp. References ACE_TEXT(), be_global, element_type(), ir_current_, and BE_GlobalData::repository().
02085 { 02086 try 02087 { 02088 this->element_type (node->base_type ()); 02089 02090 AST_Expression **dims = node->dims (); 02091 02092 for (unsigned long i = node->n_dims (); i > 0; --i) 02093 { 02094 this->ir_current_ = 02095 be_global->repository ()->create_array ( 02096 dims[i - 1]->ev ()->u.ulval, 02097 this->ir_current_.in () 02098 ); 02099 } 02100 } 02101 catch (const CORBA::Exception& ex) 02102 { 02103 ex._tao_print_exception (ACE_TEXT ("visit_array")); 02104 02105 return -1; 02106 } 02107 02108 return 0; 02109 } |
|
Reimplemented from ifr_visitor. Definition at line 1794 of file ifr_adding_visitor.cpp. References ACE_ERROR_RETURN, ACE_TEXT(), be_global, fill_get_exceptions(), fill_set_exceptions(), get_referenced_type(), BE_GlobalData::ifr_scopes(), ir_current_, and LM_ERROR.
01795 { 01796 try 01797 { 01798 AST_Type *type = node->field_type (); 01799 01800 // Updates ir_current_. 01801 this->get_referenced_type (type); 01802 01803 CORBA::AttributeMode mode = 01804 node->readonly () ? CORBA::ATTR_READONLY : CORBA::ATTR_NORMAL; 01805 01806 CORBA::ExceptionDefSeq get_exceptions; 01807 this->fill_get_exceptions (get_exceptions, 01808 node); 01809 01810 CORBA::ExceptionDefSeq set_exceptions; 01811 this->fill_set_exceptions (set_exceptions, 01812 node); 01813 01814 CORBA::Container_ptr current_scope = 01815 CORBA::Container::_nil (); 01816 01817 if (be_global->ifr_scopes ().top (current_scope) == 0) 01818 { 01819 CORBA::DefinitionKind kind = 01820 current_scope->def_kind (); 01821 01822 if (kind == CORBA::dk_Value || kind == CORBA::dk_Event) 01823 { 01824 CORBA::ExtValueDef_var value = 01825 CORBA::ExtValueDef::_narrow (current_scope); 01826 01827 CORBA::ExtAttributeDef_var new_def = 01828 value->create_ext_attribute ( 01829 node->repoID (), 01830 node->local_name ()->get_string (), 01831 node->version (), 01832 this->ir_current_.in (), 01833 mode, 01834 get_exceptions, 01835 set_exceptions 01836 ); 01837 } 01838 else 01839 { 01840 // We are an interface, a local interface, an abstract 01841 // interface or a component. This narrow covers them all. 01842 CORBA::InterfaceAttrExtension_var iface = 01843 CORBA::InterfaceAttrExtension::_narrow (current_scope); 01844 01845 CORBA::ExtAttributeDef_var new_def = 01846 iface->create_ext_attribute ( 01847 node->repoID (), 01848 node->local_name ()->get_string (), 01849 node->version (), 01850 this->ir_current_.in (), 01851 mode, 01852 get_exceptions, 01853 set_exceptions 01854 ); 01855 } 01856 } 01857 else 01858 { 01859 ACE_ERROR_RETURN (( 01860 LM_ERROR, 01861 ACE_TEXT ("(%N:%l) ifr_adding_visitor::visit_attribute -") 01862 ACE_TEXT (" scope stack is empty\n") 01863 ), 01864 -1 01865 ); 01866 } 01867 } 01868 catch (const CORBA::Exception& ex) 01869 { 01870 ex._tao_print_exception (ACE_TEXT ("visit_attribute")); 01871 01872 return -1; 01873 } 01874 01875 return 0; 01876 } |
|
Reimplemented from ifr_visitor. Definition at line 842 of file ifr_adding_visitor.cpp. References ACE_ERROR_RETURN, ACE_TEXT(), be_global, create_component_def(), BE_GlobalData::do_included_files(), fill_base_component(), fill_supported_interfaces(), BE_GlobalData::ifr_scopes(), ir_current_, CORBA::is_nil(), LM_ERROR, BE_GlobalData::repository(), visit_all_consumes(), visit_all_emits(), visit_all_provides(), visit_all_publishes(), visit_all_uses(), and visit_scope().
00843 { 00844 if (node->imported () && !be_global->do_included_files ()) 00845 { 00846 return 0; 00847 } 00848 00849 try 00850 { 00851 // Is this interface already in the respository? 00852 CORBA::Contained_var prev_def = 00853 be_global->repository ()->lookup_id (node->repoID ()); 00854 00855 // If not, create a new entry. 00856 if (CORBA::is_nil (prev_def.in ())) 00857 { 00858 int status = this->create_component_def (node); 00859 00860 return status; 00861 } 00862 else 00863 { 00864 // There is already an entry in the repository. If the interface is 00865 // defined and has not already been populated, we do so 00866 // now. If it is not yet defined or the full definition has already 00867 // been added to the repository, we just update the current IR object 00868 // holder. 00869 if (node->is_defined () && !node->ifr_added ()) 00870 { 00871 // If we are here and the line below is true, then either 00872 // 1. We are defining an undefined forward declaration 00873 // from a previously processed IDL file, or 00874 // 2. We are clobbering a previous definition, either of the 00875 // node type or of some other type. 00876 // If prev_def would narrow successfully to the node type, we 00877 // have NO WAY of knowing if we are defining or clobbering. So 00878 // we destroy the contents of the previous entry (we don't want 00879 // to destroy the entry itself, since it may have already been 00880 // made a member of some other entry, and destroying it would 00881 // make the containing entry's section key invalid) and repopulate. 00882 // On the other hand, if prev_def is NOT the node type, we go 00883 // ahead an attempt to create an interface, which will get an 00884 // exception from the IFR, as the spec requires. 00885 if (!node->ifr_fwd_added ()) 00886 { 00887 CORBA::DefinitionKind kind = 00888 prev_def->def_kind (); 00889 00890 if (kind == CORBA::dk_Component) 00891 { 00892 CORBA::ComponentIR::ComponentDef_var value = 00893 CORBA::ComponentIR::ComponentDef::_narrow ( 00894 prev_def.in () 00895 ); 00896 00897 CORBA::ContainedSeq_var contents = 00898 value->contents (CORBA::dk_all, 00899 1); 00900 00901 CORBA::ULong length = contents->length (); 00902 00903 for (CORBA::ULong i = 0; i < length; ++i) 00904 { 00905 contents[i]->destroy (); 00906 } 00907 } 00908 else 00909 { 00910 prev_def->destroy (); 00911 00912 int status = 00913 this->create_component_def (node); 00914 00915 return status; 00916 } 00917 } 00918 00919 // Re-populate the repository entry. 00920 00921 CORBA::ComponentIR::ComponentDef_var extant_def = 00922 CORBA::ComponentIR::ComponentDef::_narrow ( 00923 prev_def.in () 00924 ); 00925 00926 CORBA::InterfaceDefSeq supported_interfaces; 00927 this->fill_supported_interfaces (supported_interfaces, 00928 node); 00929 00930 extant_def->supported_interfaces (supported_interfaces); 00931 00932 CORBA::ComponentIR::ComponentDef_var base_component; 00933 this->fill_base_component (base_component.out (), 00934 node); 00935 00936 extant_def->base_component (base_component.in ()); 00937 00938 this->visit_all_provides (node, 00939 extant_def.in ()); 00940 00941 this->visit_all_uses (node, 00942 extant_def.in ()); 00943 00944 this->visit_all_emits (node, 00945 extant_def.in ()); 00946 00947 this->visit_all_publishes (node, 00948 extant_def.in ()); 00949 00950 this->visit_all_consumes (node, 00951 extant_def.in ()); 00952 00953 node->ifr_added (true); 00954 00955 // Push the new IR object onto the scope stack before visiting 00956 // the new object's scope. 00957 if (be_global->ifr_scopes ().push (extant_def.in ()) != 0) 00958 { 00959 ACE_ERROR_RETURN (( 00960 LM_ERROR, 00961 ACE_TEXT ("(%N:%l) ifr_adding_visitor::") 00962 ACE_TEXT ("visit_component -") 00963 ACE_TEXT (" scope push failed\n") 00964 ), 00965 -1 00966 ); 00967 } 00968 00969 // Visit the members, if any. 00970 if (this->visit_scope (node) == -1) 00971 { 00972 ACE_ERROR_RETURN (( 00973 LM_ERROR, 00974 ACE_TEXT ("(%N:%l) ifr_adding_visitor::") 00975 ACE_TEXT ("visit_component -") 00976 ACE_TEXT (" visit_scope failed\n") 00977 ), 00978 -1 00979 ); 00980 } 00981 00982 // This spot in the AST doesn't necessarily have to be the 00983 // interface definition - it could be any reference to it. 00984 // The front end will already have fully defined it, so all 00985 // the info is available anywhere. So it's a good idea to 00986 // update the current IR object holder now. 00987 this->ir_current_ = 00988 CORBA::IDLType::_duplicate (extant_def.in ()); 00989 00990 CORBA::Container_ptr used_scope = 00991 CORBA::Container::_nil (); 00992 00993 // Pop the new IR object back off the scope stack. 00994 if (be_global->ifr_scopes ().pop (used_scope) != 0) 00995 { 00996 ACE_ERROR_RETURN (( 00997 LM_ERROR, 00998 ACE_TEXT ("(%N:%l) ifr_adding_visitor::") 00999 ACE_TEXT ("visit_interface -") 01000 ACE_TEXT (" scope pop failed\n") 01001 ), 01002 -1 01003 ); 01004 } 01005 } 01006 else 01007 { 01008 // @@ (JP) I think we're ok here without a check: 01009 // not defined/not added - visit_interface_fwd will have 01010 // detected a clobber. 01011 // not defined/added - not possible. 01012 // defined/not added - takes the other branch. 01013 // defined/added - we're ok. 01014 this->ir_current_ = 01015 CORBA::IDLType::_narrow (prev_def.in ()); 01016 } 01017 } 01018 } 01019 catch (const CORBA::Exception& ex) 01020 { 01021 ex._tao_print_exception (ACE_TEXT ("visit_component")); 01022 01023 return -1; 01024 } 01025 01026 return 0; 01027 } |
|
Reimplemented from ifr_visitor. Definition at line 1030 of file ifr_adding_visitor.cpp. References ACE_ERROR_RETURN, ACE_TEXT(), be_global, BE_GlobalData::do_included_files(), fill_base_component(), fill_supported_interfaces(), BE_GlobalData::ifr_scopes(), ir_current_, CORBA::is_nil(), LM_ERROR, BE_GlobalData::repository(), visit_all_consumes(), visit_all_emits(), visit_all_provides(), visit_all_publishes(), and visit_all_uses().
01031 { 01032 if (node->imported () && !be_global->do_included_files ()) 01033 { 01034 return 0; 01035 } 01036 01037 AST_Component *c = 01038 AST_Component::narrow_from_decl (node->full_definition ()); 01039 01040 try 01041 { 01042 // Is this interface already in the respository? 01043 CORBA::Contained_var prev_def = 01044 be_global->repository ()->lookup_id (c->repoID ()); 01045 01046 if (CORBA::is_nil (prev_def.in ())) 01047 { 01048 CORBA::Container_ptr current_scope = 01049 CORBA::Container::_nil (); 01050 01051 if (be_global->ifr_scopes ().top (current_scope) == 0) 01052 { 01053 CORBA::ComponentIR::Container_var ccm_scope = 01054 CORBA::ComponentIR::Container::_narrow ( 01055 current_scope 01056 ); 01057 01058 // If our full definition is found in this IDL file, we go 01059 // ahead and create the full entry now. 01060 // The forward declared component is not defined anywhere 01061 // in this IDL file, so we just create an empty entry to 01062 // be replaced by a full definition later. 01063 CORBA::InterfaceDefSeq supported_interfaces; 01064 supported_interfaces.length (0); 01065 CORBA::ComponentIR::ComponentDef_var base_component; 01066 01067 01068 if (node->is_defined ()) 01069 { 01070 this->fill_supported_interfaces (supported_interfaces, 01071 c); 01072 01073 this->fill_base_component (base_component.out (), 01074 c); 01075 } 01076 01077 this->ir_current_ = 01078 ccm_scope->create_component ( 01079 c->repoID (), 01080 c->local_name ()->get_string (), 01081 c->version (), 01082 base_component.in (), 01083 supported_interfaces 01084 ); 01085 01086 // Might as well go ahead and complete the repository 01087 // entry now, if we can - we're halfway there already. 01088 if (node->is_defined ()) 01089 { 01090 CORBA::ComponentIR::ComponentDef_var new_def = 01091 CORBA::ComponentIR::ComponentDef::_narrow ( 01092 this->ir_current_.in () 01093 ); 01094 01095 this->visit_all_provides (c, 01096 new_def.in ()); 01097 01098 this->visit_all_uses (c, 01099 new_def.in ()); 01100 01101 this->visit_all_emits (c, 01102 new_def.in ()); 01103 01104 this->visit_all_publishes (c, 01105 new_def.in ()); 01106 01107 this->visit_all_consumes (c, 01108 new_def.in ()); 01109 } 01110 } 01111 else 01112 { 01113 ACE_ERROR_RETURN (( 01114 LM_ERROR, 01115 ACE_TEXT ("(%N:%l) ifr_adding_visitor::") 01116 ACE_TEXT ("visit_component_fwd -") 01117 ACE_TEXT (" scope stack is empty\n") 01118 ), 01119 -1 01120 ); 01121 } 01122 01123 node->ifr_added (true); 01124 c->ifr_fwd_added (true); 01125 } 01126 } 01127 catch (const CORBA::Exception& ex) 01128 { 01129 ex._tao_print_exception (ACE_TEXT ("visit_component_fwd")); 01130 01131 return -1; 01132 } 01133 01134 return 0; 01135 } |
|
Reimplemented from ifr_visitor. Definition at line 1988 of file ifr_adding_visitor.cpp. References ACE_ERROR_RETURN, ACE_TEXT(), be_global, BE_GlobalData::do_included_files(), expr_type_to_pkind(), BE_GlobalData::ifr_scopes(), ir_current_, CORBA::is_nil(), LM_ERROR, load_any(), and BE_GlobalData::repository().
01989 { 01990 if (node->imported () && !be_global->do_included_files ()) 01991 { 01992 return 0; 01993 } 01994 01995 const char *id = node->repoID (); 01996 01997 try 01998 { 01999 CORBA::Contained_var prev_def = 02000 be_global->repository ()->lookup_id (id); 02001 02002 // Nothing prevents this constant's repo id from already being 02003 // in the repository as another type, if it came from another 02004 // IDL file whose generated code is not linked to the generated 02005 // code from this IDL file. So we check here before we make a 02006 // call on ir_current_. 02007 if (!CORBA::is_nil (prev_def.in ())) 02008 { 02009 // If the line below is true, we are clobbering a previous 02010 // entry (from another IDL file) of another type. In that 02011 // case we do what other ORB vendors do, and destroy the 02012 // original entry, create the new one, and let the user beware. 02013 if (!node->ifr_added ()) 02014 { 02015 prev_def->destroy (); 02016 } 02017 else 02018 { 02019 // The node is referenced in an array size, string bound 02020 // or sequence bound - no action needed in the IFR. 02021 return 0; 02022 } 02023 } 02024 02025 AST_Expression::AST_ExprValue *ev = node->constant_value ()->ev (); 02026 AST_Decl *td = node->constant_value ()->get_tdef (); 02027 02028 if (td != 0 && td->node_type () == AST_Decl::NT_typedef) 02029 { 02030 // This constant's type is a typedef - look up the typedef to 02031 // pass to create_constant(). 02032 CORBA::Contained_var contained = 02033 be_global->repository ()->lookup_id (td->repoID ()); 02034 02035 this->ir_current_ = CORBA::IDLType::_narrow (contained.in ()); 02036 } 02037 else 02038 { 02039 CORBA::PrimitiveKind pkind = this->expr_type_to_pkind (ev->et); 02040 this->ir_current_ = 02041 be_global->repository ()->get_primitive (pkind); 02042 } 02043 02044 CORBA::Any any; 02045 this->load_any (ev, 02046 any); 02047 02048 CORBA::Container_ptr current_scope = 02049 CORBA::Container::_nil (); 02050 02051 if (be_global->ifr_scopes ().top (current_scope) == 0) 02052 { 02053 CORBA::ConstantDef_var new_def = 02054 current_scope->create_constant ( 02055 id, 02056 node->local_name ()->get_string (), 02057 node->version (), 02058 this->ir_current_.in (), 02059 any 02060 ); 02061 } 02062 else 02063 { 02064 ACE_ERROR_RETURN (( 02065 LM_ERROR, 02066 ACE_TEXT ("(%N:%l) ifr_adding_visitor::visit_constant -") 02067 ACE_TEXT (" scope stack is empty\n") 02068 ), 02069 -1 02070 ); 02071 } 02072 } 02073 catch (const CORBA::Exception& ex) 02074 { 02075 ex._tao_print_exception (ACE_TEXT ("visit_constant")); 02076 02077 return -1; 02078 } 02079 02080 return 0; 02081 } |
|
Reimplemented from ifr_visitor. Reimplemented in ifr_adding_visitor_exception, ifr_adding_visitor_structure, and ifr_adding_visitor_union. Definition at line 1655 of file ifr_adding_visitor.cpp. References ACE_ERROR_RETURN, ACE_TEXT(), be_global, BE_GlobalData::do_included_files(), BE_GlobalData::ifr_scopes(), ir_current_, CORBA::is_nil(), LM_ERROR, BE_GlobalData::repository(), and CORBA::string_dup().
01656 { 01657 if (node->imported () && !be_global->do_included_files ()) 01658 { 01659 return 0; 01660 } 01661 01662 try 01663 { 01664 // Is this enum already in the respository? 01665 CORBA::Contained_var prev_def = 01666 be_global->repository ()->lookup_id (node->repoID ()); 01667 01668 // If not, create a new entry. 01669 if (CORBA::is_nil (prev_def.in ())) 01670 { 01671 CORBA::ULong member_count = 01672 static_cast<CORBA::ULong> (node->member_count ()); 01673 01674 CORBA::EnumMemberSeq members (member_count); 01675 members.length (member_count); 01676 01677 UTL_ScopedName *member_name = 0; 01678 01679 // Get a list of the member names. 01680 for (CORBA::ULong i = 0; i < member_count; ++i) 01681 { 01682 member_name = node->value_to_name (i); 01683 01684 members[i] = 01685 CORBA::string_dup ( 01686 member_name->last_component ()->get_string () 01687 ); 01688 } 01689 01690 CORBA::Container_ptr current_scope = 01691 CORBA::Container::_nil (); 01692 01693 if (be_global->ifr_scopes ().top (current_scope) == 0) 01694 { 01695 this->ir_current_ = 01696 current_scope->create_enum ( 01697 node->repoID (), 01698 node->local_name ()->get_string (), 01699 node->version (), 01700 members 01701 ); 01702 } 01703 else 01704 { 01705 ACE_ERROR_RETURN (( 01706 LM_ERROR, 01707 ACE_TEXT ("(%N:%l) ifr_adding_visitor::visit_enum -") 01708 ACE_TEXT (" scope stack is empty\n") 01709 ), 01710 -1 01711 ); 01712 } 01713 01714 node->ifr_added (true); 01715 } 01716 else 01717 { 01718 // If the line below is true, we are clobbering a previous 01719 // entry (from another IDL file) of another type. In that 01720 // case we do what other ORB vendors do, and destroy the 01721 // original entry, create the new one, and let the user beware. 01722 if (!node->ifr_added ()) 01723 { 01724 prev_def->destroy (); 01725 01726 return this->visit_enum (node); 01727 } 01728 01729 // There is already an entry in the repository, so just update 01730 // the current IR object holder. 01731 this->ir_current_ = 01732 CORBA::EnumDef::_narrow (prev_def.in ()); 01733 } 01734 } 01735 catch (const CORBA::Exception& ex) 01736 { 01737 ex._tao_print_exception (ACE_TEXT ("ifr_adding_visitor::visit_enum")); 01738 01739 return -1; 01740 } 01741 01742 return 0; 01743 } |
|
Reimplemented from ifr_visitor. Definition at line 1138 of file ifr_adding_visitor.cpp. References ACE_ERROR_RETURN, ACE_TEXT(), be_global, create_event_def(), BE_GlobalData::do_included_files(), fill_abstract_base_values(), fill_base_value(), fill_initializers(), fill_supported_interfaces(), BE_GlobalData::ifr_scopes(), ir_current_, CORBA::is_nil(), LM_ERROR, BE_GlobalData::repository(), and visit_scope().
01139 { 01140 if (node->imported () && !be_global->do_included_files ()) 01141 { 01142 return 0; 01143 } 01144 01145 try 01146 { 01147 // Is this interface already in the respository? 01148 CORBA::Contained_var prev_def = 01149 be_global->repository ()->lookup_id (node->repoID ()); 01150 01151 // If not, create a new entry. 01152 if (CORBA::is_nil (prev_def.in ())) 01153 { 01154 int status = this->create_event_def (node); 01155 01156 return status; 01157 } 01158 else 01159 { 01160 // There is already an entry in the repository. If the interface is 01161 // defined and has not already been populated, we do so 01162 // now. If it is not yet defined or the full definition has already 01163 // been added to the repository, we just update the current IR object 01164 // holder. 01165 if (node->is_defined () && !node->ifr_added ()) 01166 { 01167 // If we are here and the line below is true, then either 01168 // 1. We are defining an undefined forward declaration 01169 // from a previously processed IDL file, or 01170 // 2. We are clobbering a previous definition, either of the 01171 // node type or of some other type. 01172 // If prev_def would narrow successfully to the node type, we 01173 // have NO WAY of knowing if we are defining or clobbering. So 01174 // we destroy the contents of the previous entry (we don't want 01175 // to destroy the entry itself, since it may have already been 01176 // made a member of some other entry, and destroying it would 01177 // make the containing entry's section key invalid) and repopulate. 01178 // On the other hand, if prev_def is NOT the node type, we go 01179 // ahead an attempt to create an interface, which will get an 01180 // exception from the IFR, as the spec requires. 01181 if (!node->ifr_fwd_added ()) 01182 { 01183 CORBA::DefinitionKind kind = 01184 prev_def->def_kind (); 01185 01186 if (kind == CORBA::dk_Value) 01187 { 01188 CORBA::ComponentIR::EventDef_var event = 01189 CORBA::ComponentIR::EventDef::_narrow ( 01190 prev_def.in () 01191 ); 01192 01193 CORBA::ContainedSeq_var contents = 01194 event->contents (CORBA::dk_all, 01195 1); 01196 01197 CORBA::ULong length = contents->length (); 01198 01199 for (CORBA::ULong i = 0; i < length; ++i) 01200 { 01201 contents[i]->destroy (); 01202 } 01203 } 01204 else 01205 { 01206 prev_def->destroy (); 01207 01208 int status = 01209 this->create_event_def (node); 01210 01211 return status; 01212 } 01213 } 01214 01215 // Our previous definition is a valuetype, so narrow it here, 01216 // then populate it. 01217 CORBA::ComponentIR::EventDef_var extant_def = 01218 CORBA::ComponentIR::EventDef::_narrow (prev_def. in ()); 01219 01220 // Concrete base value. 01221 01222 CORBA::ValueDef_var base_vt; 01223 this->fill_base_value (base_vt.out (), 01224 node); 01225 01226 extant_def->base_value (base_vt.in ()); 01227 01228 // Abstract base values. 01229 01230 CORBA::ValueDefSeq abstract_base_values; 01231 this->fill_abstract_base_values (abstract_base_values, 01232 node); 01233 01234 extant_def->abstract_base_values (abstract_base_values); 01235 01236 // Supported interfaces. 01237 01238 CORBA::InterfaceDefSeq supported; 01239 this->fill_supported_interfaces (supported, 01240 node); 01241 01242 extant_def->supported_interfaces (supported); 01243 01244 // Intializers. 01245 01246 CORBA::ExtInitializerSeq initializers; 01247 this->fill_initializers (initializers, 01248 node); 01249 01250 extant_def->ext_initializers (initializers); 01251 01252 // Truncatable, abstract, custom. 01253 01254 extant_def->is_abstract (static_cast<CORBA::Boolean> (node->is_abstract ())); 01255 01256 extant_def->is_truncatable (static_cast<CORBA::Boolean> (node->truncatable ())); 01257 01258 extant_def->is_custom (static_cast<CORBA::Boolean> (node->custom ())); 01259 01260 node->ifr_added (true); 01261 01262 // Push the new IR object onto the scope stack before visiting 01263 // the new object's scope. 01264 if (be_global->ifr_scopes ().push (extant_def.in ()) != 0) 01265 { 01266 ACE_ERROR_RETURN (( 01267 LM_ERROR, 01268 ACE_TEXT ("(%N:%l) ifr_adding_visitor::") 01269 ACE_TEXT ("visit_eventtype -") 01270 ACE_TEXT (" scope push failed\n") 01271 ), 01272 -1 01273 ); 01274 } 01275 01276 // Visit the members, if any. 01277 if (this->visit_scope (node) == -1) 01278 { 01279 ACE_ERROR_RETURN (( 01280 LM_ERROR, 01281 ACE_TEXT ("(%N:%l) ifr_adding_visitor::") 01282 ACE_TEXT ("visit_eventtype -") 01283 ACE_TEXT (" visit_scope failed\n") 01284 ), 01285 -1 01286 ); 01287 } 01288 01289 // This spot in the AST doesn't necessarily have to be the 01290 // interface definition - it could be any reference to it. 01291 // The front end will already have fully defined it, so all 01292 // the info is available anywhere. So it's a good idea to 01293 // update the current IR object holder now. 01294 this->ir_current_ = 01295 CORBA::IDLType::_duplicate (extant_def.in ()); 01296 01297 CORBA::Container_ptr used_scope = 01298 CORBA::Container::_nil (); 01299 01300 // Pop the new IR object back off the scope stack. 01301 if (be_global->ifr_scopes ().pop (used_scope) != 0) 01302 { 01303 ACE_ERROR_RETURN (( 01304 LM_ERROR, 01305 ACE_TEXT ("(%N:%l) ifr_adding_visitor::") 01306 ACE_TEXT ("visit_eventtype -") 01307 ACE_TEXT (" scope pop failed\n") 01308 ), 01309 -1 01310 ); 01311 } 01312 } 01313 else 01314 { 01315 // @@ (JP) I think we're ok here without a check: 01316 // not defined/not added - visit_valuetype_fwd will have 01317 // detected a clobber. 01318 // not defined/added - not possible. 01319 // defined/not added - takes the other branch. 01320 // defined/added - we're ok. 01321 this->ir_current_ = 01322 CORBA::IDLType::_narrow (prev_def.in ()); 01323 } 01324 } 01325 } 01326 catch (const CORBA::Exception& ex) 01327 { 01328 ex._tao_print_exception (ACE_TEXT ("visit_eventtype")); 01329 01330 return -1; 01331 } 01332 01333 return 0; 01334 } |
|
Reimplemented from ifr_visitor. Definition at line 1337 of file ifr_adding_visitor.cpp. References ACE_ERROR_RETURN, ACE_TEXT(), be_global, BE_GlobalData::do_included_files(), BE_GlobalData::ifr_scopes(), ir_current_, CORBA::is_nil(), LM_ERROR, and BE_GlobalData::repository().
01338 { 01339 if (node->imported () && !be_global->do_included_files ()) 01340 { 01341 return 0; 01342 } 01343 01344 AST_Interface *v = node->full_definition (); 01345 01346 try 01347 { 01348 // Is this interface already in the respository? 01349 CORBA::Contained_var prev_def = 01350 be_global->repository ()->lookup_id (v->repoID ()); 01351 01352 if (CORBA::is_nil (prev_def.in ())) 01353 { 01354 // If our full definition is found in this IDL file, we go 01355 // ahead and create the full entry now. 01356 // The forward declared valuetype is not defined anywhere 01357 // in this IDL file, so we just create an empty entry to 01358 // be replaced by a full definition in some other IDL file. 01359 CORBA::ValueDefSeq abstract_bases (0); 01360 abstract_bases.length (0); 01361 CORBA::InterfaceDefSeq supported (0); 01362 supported.length (0); 01363 CORBA::ExtInitializerSeq initializers (0); 01364 initializers.length (0); 01365 01366 CORBA::Container_ptr current_scope = 01367 CORBA::Container::_nil (); 01368 01369 if (be_global->ifr_scopes ().top (current_scope) == 0) 01370 { 01371 CORBA::ComponentIR::Container_var ccm_scope = 01372 CORBA::ComponentIR::Container::_narrow ( 01373 current_scope 01374 ); 01375 01376 CORBA::Boolean abstract = 01377 static_cast<CORBA::Boolean> (v->is_abstract ()); 01378 01379 this->ir_current_ = 01380 ccm_scope->create_event ( 01381 v->repoID (), 01382 v->local_name ()->get_string (), 01383 v->version (), 01384 0, // 'custom' not handled yet 01385 abstract, 01386 CORBA::ValueDef::_nil (), 01387 0, // 'truncatable' not handled yet 01388 abstract_bases, 01389 supported, 01390 initializers 01391 ); 01392 } 01393 else 01394 { 01395 ACE_ERROR_RETURN (( 01396 LM_ERROR, 01397 ACE_TEXT ("(%N:%l) ifr_adding_visitor::") 01398 ACE_TEXT ("visit_eventtype_fwd -") 01399 ACE_TEXT (" scope stack is empty\n") 01400 ), 01401 -1 01402 ); 01403 } 01404 01405 node->ifr_added (true); 01406 v->ifr_fwd_added (true); 01407 } 01408 } 01409 catch (const CORBA::Exception& ex) 01410 { 01411 ex._tao_print_exception (ACE_TEXT ("visit_eventtype_fwd")); 01412 01413 return -1; 01414 } 01415 01416 return 0; 01417 } |
|
Reimplemented from ifr_visitor. Reimplemented in ifr_adding_visitor_exception. Definition at line 1638 of file ifr_adding_visitor.cpp. References be_global, BE_GlobalData::do_included_files(), and ifr_adding_visitor_exception::visit_exception().
01639 { 01640 if (node->imported () && !be_global->do_included_files ()) 01641 { 01642 return 0; 01643 } 01644 01645 ifr_adding_visitor_exception visitor (node, 01646 this->in_reopened_); 01647 01648 // No point in updating ir_current_ here because 01649 // ExceptionDef is not an IDLType. 01650 01651 return visitor.visit_exception (node); 01652 } |
|
Reimplemented from ifr_visitor. Definition at line 1524 of file ifr_adding_visitor.cpp.
01525 {
01526 return 0;
01527 }
|
|
Reimplemented from ifr_visitor. Definition at line 1754 of file ifr_adding_visitor.cpp. References ACE_ERROR_RETURN, ACE_TEXT(), create_value_member(), and LM_ERROR.
01755 { 01756 AST_Decl *scope = ScopeAsDecl (node->defined_in ()); 01757 AST_Decl::NodeType nt = scope->node_type (); 01758 01759 if (nt == AST_Decl::NT_valuetype || nt == AST_Decl::NT_eventtype) 01760 { 01761 return this->create_value_member (node); 01762 } 01763 01764 AST_Type *ft = AST_Type::narrow_from_decl (node->field_type ()); 01765 01766 if (ft == 0) 01767 { 01768 ACE_ERROR_RETURN (( 01769 LM_ERROR, 01770 ACE_TEXT ("(%N:%l) ifr_adding_visitor::") 01771 ACE_TEXT ("visit_field - ") 01772 ACE_TEXT ("Bad field type\n") 01773 ), 01774 -1 01775 ); 01776 } 01777 01778 if (ft->ast_accept (this) == -1) 01779 { 01780 ACE_ERROR_RETURN (( 01781 LM_ERROR, 01782 ACE_TEXT ("(%N:%l) ifr_adding_visitor::") 01783 ACE_TEXT ("visit_field - ") 01784 ACE_TEXT ("failed to accept visitor\n") 01785 ), 01786 -1 01787 ); 01788 } 01789 01790 return 0; 01791 } |
|
Reimplemented from ifr_visitor. Definition at line 1420 of file ifr_adding_visitor.cpp. References ACE_TEXT(), be_global, create_home_def(), BE_GlobalData::do_included_files(), ir_current_, CORBA::is_nil(), and BE_GlobalData::repository().
01421 { 01422 if (node->imported () && !be_global->do_included_files ()) 01423 { 01424 return 0; 01425 } 01426 01427 try 01428 { 01429 // Is this interface already in the respository? 01430 CORBA::Contained_var prev_def = 01431 be_global->repository ()->lookup_id (node->repoID ()); 01432 01433 // If not, create a new entry. 01434 if (CORBA::is_nil (prev_def.in ())) 01435 { 01436 int status = this->create_home_def (node); 01437 01438 return status; 01439 } 01440 else 01441 { 01442 // There is already an entry in the repository. If the interface is 01443 // defined and has not already been populated, we do so 01444 // now. If it is not yet defined or the full definition has already 01445 // been added to the repository, we just update the current IR object 01446 // holder. 01447 if (node->is_defined () && !node->ifr_added ()) 01448 { 01449 // If we are here and the line below is true, then either 01450 // 1. We are defining an undefined forward declaration 01451 // from a previously processed IDL file, or 01452 // 2. We are clobbering a previous definition, either of the 01453 // node type or of some other type. 01454 // If prev_def would narrow successfully to the node type, we 01455 // have NO WAY of knowing if we are defining or clobbering. So 01456 // we destroy the contents of the previous entry (we don't want 01457 // to destroy the entry itself, since it may have already been 01458 // made a member of some other entry, and destroying it would 01459 // make the containing entry's section key invalid) and repopulate. 01460 // On the other hand, if prev_def is NOT the node type, we go 01461 // ahead an attempt to create an interface, which will get an 01462 // exception from the IFR, as the spec requires. 01463 if (!node->ifr_fwd_added ()) 01464 { 01465 CORBA::DefinitionKind kind = 01466 prev_def->def_kind (); 01467 01468 if (kind == CORBA::dk_Component) 01469 { 01470 CORBA::ComponentIR::HomeDef_var value = 01471 CORBA::ComponentIR::HomeDef::_narrow ( 01472 prev_def.in () 01473 ); 01474 01475 CORBA::ContainedSeq_var contents = 01476 value->contents (CORBA::dk_all, 01477 1); 01478 01479 CORBA::ULong length = contents->length (); 01480 01481 for (CORBA::ULong i = 0; i < length; ++i) 01482 { 01483 contents[i]->destroy (); 01484 } 01485 } 01486 else 01487 { 01488 prev_def->destroy (); 01489 01490 int status = 01491 this->create_home_def (node); 01492 01493 return status; 01494 } 01495 } 01496 01497 // Re-populate the repository entry. 01498 01499 } 01500 else 01501 { 01502 // @@ (JP) I think we're ok here without a check: 01503 // not defined/not added - visit_interface_fwd will have 01504 // detected a clobber. 01505 // not defined/added - not possible. 01506 // defined/not added - takes the other branch. 01507 // defined/added - we're ok. 01508 this->ir_current_ = 01509 CORBA::IDLType::_narrow (prev_def.in ()); 01510 } 01511 } 01512 } 01513 catch (const CORBA::Exception& ex) 01514 { 01515 ex._tao_print_exception (ACE_TEXT ("visit_home")); 01516 01517 return -1; 01518 } 01519 01520 return 0; 01521 } |
|
Reimplemented from ifr_visitor. Definition at line 247 of file ifr_adding_visitor.cpp. References ACE_ERROR_RETURN, ACE_TEXT(), be_global, create_interface_def(), BE_GlobalData::do_included_files(), BE_GlobalData::ifr_scopes(), ir_current_, CORBA::is_nil(), LM_ERROR, BE_GlobalData::repository(), and visit_scope().
00248 { 00249 if (node->imported () && !be_global->do_included_files ()) 00250 { 00251 return 0; 00252 } 00253 00254 try 00255 { 00256 // Is this interface already in the respository? 00257 CORBA::Contained_var prev_def = 00258 be_global->repository ()->lookup_id (node->repoID ()); 00259 00260 // If not, create a new entry. 00261 if (CORBA::is_nil (prev_def.in ())) 00262 { 00263 int status = this->create_interface_def (node); 00264 00265 return status; 00266 } 00267 else 00268 { 00269 // There is already an entry in the repository. If the interface is 00270 // defined and has not already been populated, we do so 00271 // now. If it is not yet defined or the full definition has already 00272 // been added to the repository, we just update the current IR object 00273 // holder. 00274 if (node->is_defined () && !node->ifr_added ()) 00275 { 00276 // If we are here and the line below is true, then either 00277 // 1. We are defining an undefined forward declaration 00278 // from a previously processed IDL file, or 00279 // 2. We are clobbering a previous definition, either of the 00280 // node type or of some other type. 00281 // If prev_def would narrow successfully to the node type, we 00282 // have NO WAY of knowing if we are defining or clobbering. So 00283 // we destroy the contents of the previous entry (we don't want 00284 // to destroy the entry itself, since it may have already been 00285 // made a member of some other entry, and destroying it would 00286 // make the containing entry's section key invalid) and repopulate. 00287 // On the other hand, if prev_def is NOT the node type, we go 00288 // ahead an attempt to create an interface, which will get an 00289 // exception from the IFR, as the spec requires. 00290 if (!node->ifr_fwd_added ()) 00291 { 00292 CORBA::DefinitionKind kind = prev_def->def_kind (); 00293 00294 if (kind == CORBA::dk_Interface) 00295 { 00296 CORBA::InterfaceDef_var iface = 00297 CORBA::InterfaceDef::_narrow (prev_def.in ()); 00298 00299 CORBA::ContainedSeq_var contents = 00300 iface->contents (CORBA::dk_all, true); 00301 00302 for (CORBA::ULong i = 0; i < contents->length (); ++i) 00303 { 00304 contents[i]->destroy (); 00305 } 00306 } 00307 else 00308 { 00309 // This will cause the IFR to throw an exception, 00310 // as it should. 00311 return this->create_interface_def (node); 00312 } 00313 } 00314 00315 CORBA::ULong n_parents = static_cast<CORBA::ULong> (node->n_inherits ()); 00316 00317 CORBA::InterfaceDefSeq bases (n_parents); 00318 bases.length (n_parents); 00319 CORBA::Contained_var result; 00320 00321 AST_Interface **parents = node->inherits (); 00322 00323 // Construct a list of the parents. 00324 for (CORBA::ULong i = 0; i < n_parents; ++i) 00325 { 00326 result = 00327 be_global->repository ()->lookup_id (parents[i]->repoID ()); 00328 00329 // If one of our interface's parents is not in the repository, 00330 // that means that it has not yet been seen (even as a 00331 // forward declaration) in the IDL file, and we will have to 00332 // postpone the populating of our interface until they are all 00333 // added. 00334 if (CORBA::is_nil (result.in ())) 00335 { 00336 this->ir_current_ = 00337 CORBA::IDLType::_narrow (prev_def.in ()); 00338 00339 return 0; 00340 } 00341 00342 bases[i] = 00343 CORBA::InterfaceDef::_narrow (result.in ()); 00344 00345 if (CORBA::is_nil (bases[i])) 00346 { 00347 ACE_ERROR_RETURN (( 00348 LM_ERROR, 00349 ACE_TEXT ("(%N:%l) ifr_adding_visitor::") 00350 ACE_TEXT ("visit_interface -") 00351 ACE_TEXT (" CORBA::InterfaceDef::_narrow failed\n") 00352 ), 00353 -1 00354 ); 00355 } 00356 } 00357 00358 CORBA::InterfaceDef_var extant_def = 00359 CORBA::InterfaceDef::_narrow (prev_def. in ()); 00360 00361 extant_def->base_interfaces (bases); 00362 00363 node->ifr_added (true); 00364 00365 // Push the new IR object onto the scope stack. 00366 if (be_global->ifr_scopes ().push (extant_def.in ()) != 0) 00367 { 00368 ACE_ERROR_RETURN (( 00369 LM_ERROR, 00370 ACE_TEXT ("(%N:%l) ifr_adding_visitor::") 00371 ACE_TEXT ("visit_interface -") 00372 ACE_TEXT (" scope push failed\n") 00373 ), 00374 -1 00375 ); 00376 } 00377 00378 // Visit the members, if any. 00379 if (this->visit_scope (node) == -1) 00380 { 00381 ACE_ERROR_RETURN (( 00382 LM_ERROR, 00383 ACE_TEXT ("(%N:%l) ifr_adding_visitor::") 00384 ACE_TEXT ("visit_interface -") 00385 ACE_TEXT (" visit_scope failed\n") 00386 ), 00387 -1 00388 ); 00389 } 00390 00391 // This spot in the AST doesn't necessarily have to be the 00392 // interface definition - it could be any reference to it. 00393 // The front end will already have fully defined it, so all 00394 // the info is available anywhere. So it's a good idea to 00395 // update the current IR object holder now. 00396 this->ir_current_ = 00397 CORBA::IDLType::_duplicate (extant_def.in ()); 00398 00399 CORBA::Container_ptr used_scope = 00400 CORBA::Container::_nil (); 00401 00402 // Pop the new IR object back off the scope stack. 00403 if (be_global->ifr_scopes ().pop (used_scope) != 0) 00404 { 00405 ACE_ERROR_RETURN (( 00406 LM_ERROR, 00407 ACE_TEXT ("(%N:%l) ifr_adding_visitor::") 00408 ACE_TEXT ("visit_interface -") 00409 ACE_TEXT (" scope pop failed\n") 00410 ), 00411 -1 00412 ); 00413 } 00414 } 00415 else 00416 { 00417 // @@ (JP) I think we're ok here without a check: 00418 // not defined/not added - visit_interface_fwd will have 00419 // detected a clobber. 00420 // not defined/added - not possible. 00421 // defined/not added - takes the other branch. 00422 // defined/added - we're ok. 00423 this->ir_current_ = 00424 CORBA::IDLType::_narrow (prev_def.in ()); 00425 } 00426 } 00427 } 00428 catch (const CORBA::Exception& ex) 00429 { 00430 ex._tao_print_exception (ACE_TEXT ("visit_interface")); 00431 00432 return -1; 00433 } 00434 00435 return 0; 00436 } |
|
Reimplemented from ifr_visitor. Definition at line 439 of file ifr_adding_visitor.cpp. References ACE_ERROR_RETURN, ACE_TEXT(), be_global, BE_GlobalData::do_included_files(), BE_GlobalData::ifr_scopes(), ir_current_, CORBA::is_nil(), LM_ERROR, and BE_GlobalData::repository().
00440 { 00441 if (node->imported () && !be_global->do_included_files ()) 00442 { 00443 return 0; 00444 } 00445 00446 AST_Interface *i = node->full_definition (); 00447 00448 try 00449 { 00450 // Is this interface already in the respository? 00451 CORBA::Contained_var prev_def = 00452 be_global->repository ()->lookup_id (i->repoID ()); 00453 00454 if (CORBA::is_nil (prev_def.in ())) 00455 { 00456 // If our full definition is found in this IDL file, we go 00457 // ahead and create the full entry now. 00458 // The forward declared interface is not defined anywhere 00459 // in this IDL file, so we just create an empty entry to 00460 // be replaced by a full definition in some other IDL file. 00461 CORBA::InterfaceDefSeq bases (0); 00462 bases.length (0); 00463 00464 CORBA::Container_ptr current_scope = 00465 CORBA::Container::_nil (); 00466 00467 if (be_global->ifr_scopes ().top (current_scope) == 0) 00468 { 00469 if (i->is_local ()) 00470 { 00471 this->ir_current_ = 00472 current_scope->create_local_interface ( 00473 i->repoID (), 00474 i->local_name ()->get_string (), 00475 i->version (), 00476 bases 00477 ); 00478 } 00479 else 00480 { 00481 this->ir_current_ = 00482 current_scope->create_interface ( 00483 i->repoID (), 00484 i->local_name ()->get_string (), 00485 i->version (), 00486 bases 00487 ); 00488 } 00489 00490 } 00491 else 00492 { 00493 ACE_ERROR_RETURN (( 00494 LM_ERROR, 00495 ACE_TEXT ("(%N:%l) ifr_adding_visitor::") 00496 ACE_TEXT ("visit_interface_fwd -") 00497 ACE_TEXT (" scope stack is empty\n") 00498 ), 00499 -1 00500 ); 00501 } 00502 00503 node->ifr_added (true); 00504 i->ifr_fwd_added (true); 00505 } 00506 00507 } 00508 catch (const CORBA::Exception& ex) 00509 { 00510 ex._tao_print_exception (ACE_TEXT ("visit_interface_fwd")); 00511 00512 return -1; 00513 } 00514 00515 return 0; 00516 } |
|
Reimplemented from ifr_visitor. Definition at line 138 of file ifr_adding_visitor.cpp. References ACE_ERROR_RETURN, ACE_TEXT(), be_global, BE_GlobalData::do_included_files(), BE_GlobalData::ifr_scopes(), in_reopened_, CORBA::is_nil(), LM_ERROR, BE_GlobalData::repository(), and visit_scope().
00139 { 00140 if (node->imported () && !be_global->do_included_files ()) 00141 { 00142 return 0; 00143 } 00144 00145 CORBA::Container_var new_def; 00146 00147 try 00148 { 00149 // If this module been opened before, it will already be in 00150 // the repository. 00151 CORBA::Contained_var prev_def = 00152 be_global->repository ()->lookup_id (node->repoID ()); 00153 00154 if (CORBA::is_nil (prev_def.in ())) 00155 { 00156 // New module. 00157 CORBA::Container_ptr container = 00158 CORBA::Container::_nil (); 00159 00160 if (be_global->ifr_scopes ().top (container) == 0) 00161 { 00162 new_def = container->create_module ( 00163 node->repoID (), 00164 node->local_name ()->get_string (), 00165 node->version () 00166 ); 00167 } 00168 else 00169 { 00170 ACE_ERROR_RETURN (( 00171 LM_ERROR, 00172 ACE_TEXT ("(%N:%l) ifr_adding_visitor::visit_module -") 00173 ACE_TEXT (" scope stack is empty\n") 00174 ), 00175 -1 00176 ); 00177 } 00178 } 00179 else 00180 { 00181 CORBA::DefinitionKind kind = 00182 prev_def->def_kind (); 00183 00184 if (kind == CORBA::dk_Module) 00185 { 00186 // We are either in a reopened module, are processing an IDL 00187 // IDL file for the second time, or are in a module whose 00188 // name already exists by coincidence - there is no way to 00189 // tell the difference. So any members whose repository ID 00190 // already exists in this case will throw BAD_PARAM 00191 // when we attempt to add them to the repository. 00192 this->in_reopened_ = true; 00193 00194 new_def = 00195 CORBA::ComponentIR::Container::_narrow (prev_def.in ()); 00196 } 00197 } 00198 00199 if (be_global->ifr_scopes ().push (new_def.in ()) != 0) 00200 { 00201 ACE_ERROR_RETURN (( 00202 LM_ERROR, 00203 ACE_TEXT ("(%N:%l) ifr_adding_visitor::visit_module -") 00204 ACE_TEXT (" scope push failed\n") 00205 ), 00206 -1 00207 ); 00208 } 00209 00210 if (this->visit_scope (node) == -1) 00211 { 00212 ACE_ERROR_RETURN (( 00213 LM_ERROR, 00214 ACE_TEXT ("(%N:%l) ifr_adding_visitor::visit_module -") 00215 ACE_TEXT (" visit_scope failed\n") 00216 ), 00217 -1 00218 ); 00219 } 00220 00221 this->in_reopened_ = false; 00222 CORBA::Container_ptr tmp = 00223 CORBA::Container::_nil (); 00224 00225 if (be_global->ifr_scopes ().pop (tmp) != 0) 00226 { 00227 ACE_ERROR_RETURN (( 00228 LM_ERROR, 00229 ACE_TEXT ("(%N:%l) ifr_adding_visitor::visit_module -") 00230 ACE_TEXT (" scope pop failed\n") 00231 ), 00232 -1 00233 ); 00234 } 00235 } 00236 catch (const CORBA::Exception& ex) 00237 { 00238 ex._tao_print_exception (ACE_TEXT ("visit_module")); 00239 00240 return -1; 00241 } 00242 00243 return 0; 00244 } |
|
Reimplemented from ifr_visitor. Definition at line 2258 of file ifr_adding_visitor.cpp. References ACE_ERROR_RETURN, ACE_TEXT(), be_global, BE_GlobalData::do_included_files(), BE_GlobalData::ifr_scopes(), ir_current_, CORBA::is_nil(), LM_ERROR, and BE_GlobalData::repository().
02259 { 02260 if (node->imported () && !be_global->do_included_files ()) 02261 { 02262 return 0; 02263 } 02264 02265 try 02266 { 02267 CORBA::Contained_var prev_def = 02268 be_global->repository ()->lookup_id (node->repoID ()); 02269 02270 if (CORBA::is_nil (prev_def.in ())) 02271 { 02272 CORBA::Container_ptr current_scope = 02273 CORBA::Container::_nil (); 02274 02275 if (be_global->ifr_scopes ().top (current_scope) == 0) 02276 { 02277 this->ir_current_ = 02278 current_scope->create_native ( 02279 node->repoID (), 02280 node->local_name ()->get_string (), 02281 node->version () 02282 ); 02283 } 02284 else 02285 { 02286 ACE_ERROR_RETURN (( 02287 LM_ERROR, 02288 ACE_TEXT ("(%N:%l) ifr_adding_visitor::visit_native -") 02289 ACE_TEXT (" scope stack is empty\n") 02290 ), 02291 -1 02292 ); 02293 } 02294 02295 node->ifr_added (true); 02296 } 02297 else 02298 { 02299 // If the line below is true, we are clobbering a previous 02300 // entry (from another IDL file) of another type. In that 02301 // case we do what other ORB vendors do, and destroy the 02302 // original entry, create the new one, and let the user beware. 02303 if (!node->ifr_added ()) 02304 { 02305 prev_def->destroy (); 02306 02307 // This call will take the other branch. 02308 return this->visit_native (node); 02309 } 02310 02311 this->ir_current_ = 02312 CORBA::NativeDef::_narrow (prev_def.in ()); 02313 } 02314 } 02315 catch (const CORBA::Exception& ex) 02316 { 02317 ex._tao_print_exception (ACE_TEXT ("visit_native")); 02318 02319 return -1; 02320 } 02321 02322 return 0; 02323 } |
|
Reimplemented from ifr_visitor. Reimplemented in ifr_adding_visitor_operation. Definition at line 1746 of file ifr_adding_visitor.cpp. References ifr_adding_visitor_operation::visit_operation().
01747 { 01748 ifr_adding_visitor_operation visitor (node); 01749 01750 return visitor.visit_operation (node); 01751 } |
|
Reimplemented from ifr_visitor. Definition at line 118 of file ifr_adding_visitor.cpp. References ACE_TEXT(), be_global, ir_current_, and BE_GlobalData::repository().
00119 { 00120 try 00121 { 00122 this->ir_current_ = 00123 be_global->repository ()->get_primitive ( 00124 this->predefined_type_to_pkind (node) 00125 ); 00126 } 00127 catch (const CORBA::Exception& ex) 00128 { 00129 ex._tao_print_exception (ACE_TEXT ("visit_predefined_type")); 00130 00131 return -1; 00132 } 00133 00134 return 0; 00135 } |
|
Reimplemented from ifr_visitor. Definition at line 2216 of file ifr_adding_visitor.cpp. References ACE_ERROR_RETURN, ACE_TEXT(), be_global, BE_GlobalData::ifr_scopes(), LM_ERROR, BE_GlobalData::repository(), and visit_scope().
02217 { 02218 if (be_global->ifr_scopes ().push (be_global->repository ()) != 0) 02219 { 02220 ACE_ERROR_RETURN (( 02221 LM_ERROR, 02222 ACE_TEXT ("(%N:%l) ifr_adding_visitor::visit_root -") 02223 ACE_TEXT (" scope push failed\n") 02224 ), 02225 -1 02226 ); 02227 } 02228 02229 if (this->visit_scope (node) == -1) 02230 { 02231 ACE_ERROR_RETURN (( 02232 LM_ERROR, 02233 ACE_TEXT ("(%N:%l) ifr_adding_visitor::visit_root -") 02234 ACE_TEXT (" visit_scope failed\n") 02235 ), 02236 -1 02237 ); 02238 } 02239 02240 CORBA::Container_ptr tmp = 02241 CORBA::Container::_nil (); 02242 02243 if (be_global->ifr_scopes ().pop (tmp) != 0) 02244 { 02245 ACE_ERROR_RETURN (( 02246 LM_ERROR, 02247 ACE_TEXT ("(%N:%l) ifr_adding_visitor::visit_root -") 02248 ACE_TEXT (" scope pop failed\n") 02249 ), 02250 -1 02251 ); 02252 } 02253 02254 return 0; 02255 } |
|
Reimplemented from ifr_visitor. Reimplemented in ifr_adding_visitor_exception, ifr_adding_visitor_structure, and ifr_adding_visitor_union. Definition at line 64 of file ifr_adding_visitor.cpp. References ACE_ERROR_RETURN, ACE_TEXT(), and LM_ERROR. Referenced by create_component_def(), create_event_def(), create_home_def(), create_interface_def(), create_value_def(), visit_component(), visit_eventtype(), visit_interface(), visit_module(), ifr_adding_visitor_operation::visit_operation(), visit_root(), ifr_adding_visitor_union::visit_scope(), ifr_adding_visitor_structure::visit_scope(), ifr_adding_visitor_exception::visit_scope(), and visit_valuetype().
00065 { 00066 // Proceed if the number of members in our scope is greater than 0. 00067 if (node->nmembers () > 0) 00068 { 00069 // Initialize an iterator to iterate over our scope. 00070 UTL_ScopeActiveIterator si (node, 00071 UTL_Scope::IK_decls); 00072 00073 AST_Decl *d = 0; 00074 00075 // Continue until each element is visited. 00076 while (!si.is_done ()) 00077 { 00078 d = si.item (); 00079 00080 if (d == 0) 00081 { 00082 ACE_ERROR_RETURN (( 00083 LM_ERROR, 00084 ACE_TEXT ("(%N:%l) ifr_adding_visitor::visit_scope -") 00085 ACE_TEXT (" bad node in this scope\n") 00086 ), 00087 -1 00088 ); 00089 } 00090 00091 // These are created at startup in the repository, and 00092 // need not be dealt with here. 00093 if (d->node_type () == AST_Decl::NT_pre_defined) 00094 { 00095 si.next (); 00096 continue; 00097 } 00098 00099 if (d->ast_accept (this) == -1) 00100 { 00101 ACE_ERROR_RETURN (( 00102 LM_ERROR, 00103 ACE_TEXT ("(%N:%l) ifr_adding_visitor::visit_scope -") 00104 ACE_TEXT (" failed to accept visitor\n") 00105 ), 00106 -1 00107 ); 00108 } 00109 00110 si.next (); 00111 } 00112 } 00113 00114 return 0; 00115 } |
|
Reimplemented from ifr_visitor. Definition at line 2112 of file ifr_adding_visitor.cpp. References ACE_TEXT(), be_global, element_type(), ir_current_, and BE_GlobalData::repository().
02113 { 02114 try 02115 { 02116 this->element_type (node->base_type ()); 02117 02118 this->ir_current_ = 02119 be_global->repository ()->create_sequence ( 02120 node->max_size ()->ev ()->u.ulval, 02121 this->ir_current_.in () 02122 ); 02123 } 02124 catch (const CORBA::Exception& ex) 02125 { 02126 ex._tao_print_exception (ACE_TEXT ("visit_sequence")); 02127 02128 return -1; 02129 } 02130 02131 return 0; 02132 } |
|
Reimplemented from ifr_visitor. Definition at line 2135 of file ifr_adding_visitor.cpp. References ACE_TEXT(), be_global, ir_current_, and BE_GlobalData::repository().
02136 { 02137 AST_Expression *ex = node->max_size (); 02138 02139 AST_Expression::AST_ExprValue *ev = ex->ev (); 02140 02141 CORBA::ULong bound = static_cast<CORBA::ULong> (ev->u.ulval); 02142 02143 try 02144 { 02145 if (node->node_type () == AST_Decl::NT_string) 02146 { 02147 this->ir_current_ = 02148 be_global->repository ()->create_string (bound); 02149 } 02150 else 02151 { 02152 this->ir_current_ = 02153 be_global->repository ()->create_wstring (bound); 02154 } 02155 02156 } 02157 catch (const CORBA::Exception& ex) 02158 { 02159 ex._tao_print_exception (ACE_TEXT ("visit_string")); 02160 02161 return -1; 02162 } 02163 02164 return 0; 02165 } |
|
Reimplemented from ifr_visitor. Reimplemented in ifr_adding_visitor_exception, ifr_adding_visitor_structure, and ifr_adding_visitor_union. Definition at line 1530 of file ifr_adding_visitor.cpp. References ACE_TEXT(), be_global, BE_GlobalData::do_included_files(), ifr_adding_visitor_structure::ir_current(), ir_current_, CORBA::is_nil(), BE_GlobalData::repository(), and ifr_adding_visitor_structure::visit_structure().
01531 { 01532 if (node->imported () && !be_global->do_included_files ()) 01533 { 01534 return 0; 01535 } 01536 01537 try 01538 { 01539 CORBA::Contained_var prev_def = 01540 be_global->repository ()->lookup_id (node->repoID ()); 01541 01542 if (CORBA::is_nil (prev_def.in ())) 01543 { 01544 ifr_adding_visitor_structure visitor (node, false); 01545 int retval = visitor.visit_structure (node); 01546 01547 if (retval == 0) 01548 { 01549 this->ir_current_ = 01550 CORBA::IDLType::_duplicate (visitor.ir_current ()); 01551 } 01552 01553 return retval; 01554 } 01555 else 01556 { 01557 // If the line below is true, we are clobbering a previous 01558 // entry (from another IDL file) of another type. In that 01559 // case we do what other ORB vendors do, and destroy the 01560 // original entry, create the new one, and let the user beware. 01561 if (!node->ifr_added ()) 01562 { 01563 prev_def->destroy (); 01564 01565 return this->visit_structure (node); 01566 } 01567 01568 this->ir_current_ = 01569 CORBA::IDLType::_narrow (prev_def.in ()); 01570 } 01571 } 01572 catch (const CORBA::Exception& ex) 01573 { 01574 ex._tao_print_exception ( 01575 ACE_TEXT ( 01576 "ifr_adding_visitor::visit_structure")); 01577 01578 return -1; 01579 } 01580 01581 return 0; 01582 } |
|
Reimplemented from ifr_visitor. Definition at line 1585 of file ifr_adding_visitor.cpp. References ACE_ERROR_RETURN, ACE_TEXT(), be_global, BE_GlobalData::do_included_files(), BE_GlobalData::ifr_scopes(), CORBA::is_nil(), LM_ERROR, and BE_GlobalData::repository().
01586 { 01587 if (node->imported () && !be_global->do_included_files ()) 01588 { 01589 return 0; 01590 } 01591 01592 try 01593 { 01594 CORBA::Contained_var prev_def = 01595 be_global->repository ()->lookup_id (node->repoID ()); 01596 01597 if (CORBA::is_nil (prev_def.in ())) 01598 { 01599 CORBA::StructMemberSeq dummyMembers; 01600 dummyMembers.length (0); 01601 CORBA::Container_ptr current_scope = CORBA::Container::_nil (); 01602 01603 if (be_global->ifr_scopes ().top (current_scope) != 0) 01604 { 01605 ACE_ERROR_RETURN (( 01606 LM_ERROR, 01607 ACE_TEXT ("(%N:%l) ifr_adding_visitor::") 01608 ACE_TEXT ("visit_structure_fwd -") 01609 ACE_TEXT (" scope stack is empty\n") 01610 ), 01611 -1 01612 ); 01613 } 01614 01615 CORBA::StructDef_var struct_def = 01616 current_scope->create_struct ( 01617 node->repoID (), 01618 node->local_name ()->get_string (), 01619 node->version (), 01620 dummyMembers 01621 ); 01622 01623 node->full_definition ()->ifr_fwd_added (true); 01624 } 01625 } 01626 catch (const CORBA::Exception& ex) 01627 { 01628 ex._tao_print_exception (ACE_TEXT ("ifr_adding_visitor::") 01629 ACE_TEXT ("visit_structure_fwd")); 01630 01631 return -1; 01632 } 01633 01634 return 0; 01635 } |
|
Reimplemented from ifr_visitor. Definition at line 2168 of file ifr_adding_visitor.cpp. References ACE_ERROR_RETURN, ACE_TEXT(), be_global, BE_GlobalData::do_included_files(), element_type(), BE_GlobalData::ifr_scopes(), ir_current_, and LM_ERROR.
02169 { 02170 if (node->imported () && !be_global->do_included_files ()) 02171 { 02172 return 0; 02173 } 02174 02175 try 02176 { 02177 this->element_type (node->base_type (), node->owns_base_type ()); 02178 02179 CORBA::Container_ptr current_scope = 02180 CORBA::Container::_nil (); 02181 02182 if (be_global->ifr_scopes ().top (current_scope) == 0) 02183 { 02184 this->ir_current_ = 02185 current_scope->create_alias ( 02186 node->repoID (), 02187 node->local_name ()->get_string (), 02188 node->version (), 02189 this->ir_current_.in () 02190 ); 02191 } 02192 else 02193 { 02194 ACE_ERROR_RETURN (( 02195 LM_ERROR, 02196 ACE_TEXT ("(%N:%l) ifr_adding_visitor::visit_typedef -") 02197 ACE_TEXT (" scope stack is empty\n") 02198 ), 02199 -1 02200 ); 02201 } 02202 02203 node->ifr_added (true); 02204 } 02205 catch (const CORBA::Exception& ex) 02206 { 02207 ex._tao_print_exception (ACE_TEXT ("visit_typedef")); 02208 02209 return -1; 02210 } 02211 02212 return 0; 02213 } |
|
Reimplemented from ifr_visitor. Reimplemented in ifr_adding_visitor_exception, ifr_adding_visitor_structure, and ifr_adding_visitor_union. Definition at line 1879 of file ifr_adding_visitor.cpp. References ACE_TEXT(), be_global, BE_GlobalData::do_included_files(), ifr_adding_visitor_union::ir_current(), ir_current_, CORBA::is_nil(), BE_GlobalData::repository(), and ifr_adding_visitor_union::visit_union().
01880 { 01881 if (node->imported () && !be_global->do_included_files ()) 01882 { 01883 return 0; 01884 } 01885 01886 try 01887 { 01888 CORBA::Contained_var prev_def = 01889 be_global->repository ()->lookup_id (node->repoID ()); 01890 01891 if (CORBA::is_nil (prev_def.in ())) 01892 { 01893 ifr_adding_visitor_union visitor (node, 01894 0); 01895 01896 int retval = visitor.visit_union (node); 01897 01898 if (retval == 0) 01899 { 01900 this->ir_current_ = 01901 CORBA::IDLType::_duplicate (visitor.ir_current ()); 01902 } 01903 01904 return retval; 01905 } 01906 else 01907 { 01908 // If the line below is true, we are clobbering a previous 01909 // entry (from another IDL file) of another type. In that 01910 // case we do what other ORB vendors do, and destroy the 01911 // original entry, create the new one, and let the user beware. 01912 if (!node->ifr_added ()) 01913 { 01914 prev_def->destroy (); 01915 01916 return this->visit_union (node); 01917 } 01918 01919 this->ir_current_ = 01920 CORBA::UnionDef::_narrow (prev_def.in ()); 01921 } 01922 } 01923 catch (const CORBA::Exception& ex) 01924 { 01925 ex._tao_print_exception (ACE_TEXT ("ifr_adding_visitor::visit_union")); 01926 01927 return -1; 01928 } 01929 01930 return 0; 01931 } |
|
Reimplemented from ifr_visitor. Definition at line 1934 of file ifr_adding_visitor.cpp. References ACE_ERROR_RETURN, ACE_TEXT(), be_global, BE_GlobalData::do_included_files(), BE_GlobalData::ifr_scopes(), CORBA::is_nil(), LM_ERROR, and BE_GlobalData::repository().
01935 { 01936 if (node->imported () && !be_global->do_included_files ()) 01937 { 01938 return 0; 01939 } 01940 01941 try 01942 { 01943 CORBA::Contained_var prev_def = 01944 be_global->repository ()->lookup_id (node->repoID ()); 01945 01946 if (CORBA::is_nil (prev_def.in ())) 01947 { 01948 CORBA::UnionMemberSeq dummyMembers; 01949 dummyMembers.length (0); 01950 CORBA::Container_ptr current_scope = CORBA::Container::_nil (); 01951 01952 if (be_global->ifr_scopes ().top (current_scope) != 0) 01953 { 01954 ACE_ERROR_RETURN (( 01955 LM_ERROR, 01956 ACE_TEXT ("(%N:%l) ifr_adding_visitor::") 01957 ACE_TEXT ("visit_union_fwd -") 01958 ACE_TEXT (" scope stack is empty\n") 01959 ), 01960 -1 01961 ); 01962 } 01963 01964 CORBA::UnionDef_var union_def = 01965 current_scope->create_union ( 01966 node->repoID (), 01967 node->local_name ()->get_string (), 01968 node->version (), 01969 CORBA::IDLType::_nil (), 01970 dummyMembers 01971 ); 01972 01973 node->full_definition ()->ifr_fwd_added (true); 01974 } 01975 } 01976 catch (const CORBA::Exception& ex) 01977 { 01978 ex._tao_print_exception (ACE_TEXT ("ifr_adding_visitor::") 01979 ACE_TEXT ("visit_union_fwd")); 01980 01981 return -1; 01982 } 01983 01984 return 0; 01985 } |
|
Reimplemented from ifr_visitor. Definition at line 519 of file ifr_adding_visitor.cpp. References ACE_ERROR_RETURN, ACE_TEXT(), be_global, BE_GlobalData::do_included_files(), element_type(), BE_GlobalData::ifr_scopes(), ir_current_, and LM_ERROR.
00520 { 00521 if (node->imported () && !be_global->do_included_files ()) 00522 { 00523 return 0; 00524 } 00525 00526 try 00527 { 00528 this->element_type (node->boxed_type ()); 00529 00530 CORBA::Container_ptr current_scope = 00531 CORBA::Container::_nil (); 00532 00533 if (be_global->ifr_scopes ().top (current_scope) == 0) 00534 { 00535 this->ir_current_ = 00536 current_scope->create_value_box ( 00537 node->repoID (), 00538 node->local_name ()->get_string (), 00539 node->version (), 00540 this->ir_current_.in () 00541 ); 00542 } 00543 else 00544 { 00545 ACE_ERROR_RETURN (( 00546 LM_ERROR, 00547 ACE_TEXT ("(%N:%l) ifr_adding_visitor::visit_valuebox -") 00548 ACE_TEXT (" scope stack is empty\n") 00549 ), 00550 -1 00551 ); 00552 } 00553 00554 node->ifr_added (true); 00555 } 00556 catch (const CORBA::Exception& ex) 00557 { 00558 ex._tao_print_exception (ACE_TEXT ("visit_valuebox")); 00559 00560 return -1; 00561 } 00562 00563 return 0; 00564 } |
|
Reimplemented from ifr_visitor. Definition at line 567 of file ifr_adding_visitor.cpp. References ACE_ERROR_RETURN, ACE_TEXT(), be_global, create_value_def(), BE_GlobalData::do_included_files(), fill_abstract_base_values(), fill_base_value(), fill_initializers(), fill_supported_interfaces(), BE_GlobalData::ifr_scopes(), ir_current_, CORBA::is_nil(), LM_ERROR, BE_GlobalData::repository(), and visit_scope().
00568 { 00569 if (node->imported () && !be_global->do_included_files ()) 00570 { 00571 return 0; 00572 } 00573 00574 try 00575 { 00576 // Is this interface already in the respository? 00577 CORBA::Contained_var prev_def = 00578 be_global->repository ()->lookup_id (node->repoID ()); 00579 00580 // If not, create a new entry. 00581 if (CORBA::is_nil (prev_def.in ())) 00582 { 00583 int status = this->create_value_def (node); 00584 00585 return status; 00586 } 00587 else 00588 { 00589 // There is already an entry in the repository. If the interface is 00590 // defined and has not already been populated, we do so 00591 // now. If it is not yet defined or the full definition has already 00592 // been added to the repository, we just update the current IR object 00593 // holder. 00594 if (node->is_defined () && !node->ifr_added ()) 00595 { 00596 // If we are here and the line below is true, then either 00597 // 1. We are defining an undefined forward declaration 00598 // from a previously processed IDL file, or 00599 // 2. We are clobbering a previous definition, either of the 00600 // node type or of some other type. 00601 // If prev_def would narrow successfully to the node type, we 00602 // have NO WAY of knowing if we are defining or clobbering. So 00603 // we destroy the contents of the previous entry (we don't want 00604 // to destroy the entry itself, since it may have already been 00605 // made a member of some other entry, and destroying it would 00606 // make the containing entry's section key invalid) and repopulate. 00607 // On the other hand, if prev_def is NOT the node type, we go 00608 // ahead an attempt to create an interface, which will get an 00609 // exception from the IFR, as the spec requires. 00610 if (!node->ifr_fwd_added ()) 00611 { 00612 CORBA::DefinitionKind kind = 00613 prev_def->def_kind (); 00614 00615 if (kind == CORBA::dk_Value) 00616 { 00617 CORBA::ValueDef_var value = 00618 CORBA::ValueDef::_narrow (prev_def.in ()); 00619 00620 CORBA::ContainedSeq_var contents = 00621 value->contents (CORBA::dk_all, 00622 1); 00623 00624 CORBA::ULong length = contents->length (); 00625 00626 for (CORBA::ULong i = 0; i < length; ++i) 00627 { 00628 contents[i]->destroy (); 00629 } 00630 } 00631 else 00632 { 00633 prev_def->destroy (); 00634 00635 int status = 00636 this->create_value_def (node); 00637 00638 return status; 00639 } 00640 } 00641 00642 // Our previous definition is a valuetype, so narrow it here, 00643 // then populate it. 00644 CORBA::ExtValueDef_var extant_def = 00645 CORBA::ExtValueDef::_narrow (prev_def. in ()); 00646 00647 // Concrete base value. 00648 00649 CORBA::ValueDef_var base_vt; 00650 this->fill_base_value (base_vt.out (), 00651 node); 00652 00653 extant_def->base_value (base_vt.in ()); 00654 00655 // Abstract base values. 00656 00657 CORBA::ValueDefSeq abstract_base_values; 00658 this->fill_abstract_base_values (abstract_base_values, 00659 node); 00660 00661 extant_def->abstract_base_values (abstract_base_values); 00662 00663 // Supported interfaces. 00664 00665 CORBA::InterfaceDefSeq supported; 00666 this->fill_supported_interfaces (supported, 00667 node); 00668 00669 extant_def->supported_interfaces (supported); 00670 00671 // Intializers. 00672 00673 CORBA::ExtInitializerSeq initializers; 00674 this->fill_initializers (initializers, 00675 node); 00676 00677 extant_def->ext_initializers (initializers); 00678 00679 // Truncatable, abstract, custom. 00680 00681 extant_def->is_abstract (static_cast<CORBA::Boolean> (node->is_abstract ())); 00682 00683 extant_def->is_truncatable (static_cast<CORBA::Boolean> (node->truncatable ())); 00684 00685 extant_def->is_custom (static_cast<CORBA::Boolean> (node->custom ())); 00686 00687 node->ifr_added (true); 00688 00689 // Push the new IR object onto the scope stack before visiting 00690 // the new object's scope. 00691 if (be_global->ifr_scopes ().push (extant_def.in ()) != 0) 00692 { 00693 ACE_ERROR_RETURN (( 00694 LM_ERROR, 00695 ACE_TEXT ("(%N:%l) ifr_adding_visitor::") 00696 ACE_TEXT ("visit_valuetype -") 00697 ACE_TEXT (" scope push failed\n") 00698 ), 00699 -1 00700 ); 00701 } 00702 00703 // Visit the members, if any. 00704 if (this->visit_scope (node) == -1) 00705 { 00706 ACE_ERROR_RETURN (( 00707 LM_ERROR, 00708 ACE_TEXT ("(%N:%l) ifr_adding_visitor::") 00709 ACE_TEXT ("visit_valuetype -") 00710 ACE_TEXT (" visit_scope failed\n") 00711 ), 00712 -1 00713 ); 00714 } 00715 00716 // This spot in the AST doesn't necessarily have to be the 00717 // interface definition - it could be any reference to it. 00718 // The front end will already have fully defined it, so all 00719 // the info is available anywhere. So it's a good idea to 00720 // update the current IR object holder now. 00721 this->ir_current_ = 00722 CORBA::IDLType::_duplicate (extant_def.in ()); 00723 00724 CORBA::Container_ptr used_scope = 00725 CORBA::Container::_nil (); 00726 00727 // Pop the new IR object back off the scope stack. 00728 if (be_global->ifr_scopes ().pop (used_scope) != 0) 00729 { 00730 ACE_ERROR_RETURN (( 00731 LM_ERROR, 00732 ACE_TEXT ("(%N:%l) ifr_adding_visitor::") 00733 ACE_TEXT ("visit_valuetype -") 00734 ACE_TEXT (" scope pop failed\n") 00735 ), 00736 -1 00737 ); 00738 } 00739 } 00740 else 00741 { 00742 // @@ (JP) I think we're ok here without a check: 00743 // not defined/not added - visit_valuetype_fwd will have 00744 // detected a clobber. 00745 // not defined/added - not possible. 00746 // defined/not added - takes the other branch. 00747 // defined/added - we're ok. 00748 this->ir_current_ = 00749 CORBA::IDLType::_narrow (prev_def.in ()); 00750 } 00751 } 00752 } 00753 catch (const CORBA::Exception& ex) 00754 { 00755 ex._tao_print_exception (ACE_TEXT ("visit_valuetype")); 00756 00757 return -1; 00758 } 00759 00760 return 0; 00761 } |
|
Reimplemented from ifr_visitor. Definition at line 764 of file ifr_adding_visitor.cpp. References ACE_ERROR_RETURN, ACE_TEXT(), be_global, BE_GlobalData::do_included_files(), BE_GlobalData::ifr_scopes(), ir_current_, CORBA::is_nil(), LM_ERROR, and BE_GlobalData::repository().
00765 { 00766 if (node->imported () && !be_global->do_included_files ()) 00767 { 00768 return 0; 00769 } 00770 00771 AST_Interface *v = node->full_definition (); 00772 00773 try 00774 { 00775 // Is this interface already in the respository? 00776 CORBA::Contained_var prev_def = 00777 be_global->repository ()->lookup_id (v->repoID ()); 00778 00779 if (CORBA::is_nil (prev_def.in ())) 00780 { 00781 // If our full definition is found in this IDL file, we go 00782 // ahead and create the full entry now. 00783 // The forward declared valuetype is not defined anywhere 00784 // in this IDL file, so we just create an empty entry to 00785 // be replaced by a full definition in some other IDL file. 00786 CORBA::ValueDefSeq abstract_bases (0); 00787 abstract_bases.length (0); 00788 CORBA::InterfaceDefSeq supported (0); 00789 supported.length (0); 00790 CORBA::InitializerSeq initializers (0); 00791 initializers.length (0); 00792 00793 CORBA::Container_ptr current_scope = 00794 CORBA::Container::_nil (); 00795 00796 CORBA::Boolean abstract = 00797 static_cast<CORBA::Boolean> (v->is_abstract ()); 00798 00799 if (be_global->ifr_scopes ().top (current_scope) == 0) 00800 { 00801 this->ir_current_ = 00802 current_scope->create_value ( 00803 v->repoID (), 00804 v->local_name ()->get_string (), 00805 v->version (), 00806 0, // 'custom' not handled yet 00807 abstract, 00808 CORBA::ValueDef::_nil (), 00809 0, // 'truncatable' not handled yet 00810 abstract_bases, 00811 supported, 00812 initializers 00813 ); 00814 } 00815 else 00816 { 00817 ACE_ERROR_RETURN (( 00818 LM_ERROR, 00819 ACE_TEXT ("(%N:%l) ifr_adding_visitor::") 00820 ACE_TEXT ("visit_valuetype_fwd -") 00821 ACE_TEXT (" scope stack is empty\n") 00822 ), 00823 -1 00824 ); 00825 } 00826 00827 node->ifr_added (true); 00828 v->ifr_fwd_added (true); 00829 } 00830 } 00831 catch (const CORBA::Exception& ex) 00832 { 00833 ex._tao_print_exception (ACE_TEXT ("visit_valuetype_fwd")); 00834 00835 return -1; 00836 } 00837 00838 return 0; 00839 } |
|
Definition at line 194 of file ifr_adding_visitor.h. Referenced by visit_module(). |
|
|
Definition at line 191 of file ifr_adding_visitor.h. |