/* ------- code automatically created by ../scripts/adms_build_object.pl -------------- */ #include #include inline void adms_branch_free(p_branch mybranch) { if(!mybranch) return; {p_slist l=mybranch->_attribute;for(;l;l=l->next) adms_attribute_free(adms_attribute(l->data));} adms_slist_free(mybranch->_attribute); adms_enumeration_free(mybranch->_grounded); adms_global_increment_nbbranchdestroy(); free(mybranch); } int adms_branch_cmp (p_branch mybranch,p_branch refbranch) { int status; status = ( (adms_branch_valueof_module (mybranch) != adms_branch_valueof_module (refbranch)) || (adms_branch_valueof_pnode (mybranch) != adms_branch_valueof_pnode (refbranch)) || (adms_branch_valueof_nnode (mybranch) != adms_branch_valueof_nnode (refbranch)) ); return status; } p_branch adms_branch_new(p_module mymodule,p_node mypnode,p_node mynnode) { p_branch mynewbranch=(p_branch) calloc(1,(size_t)sizeof(t_branch)); adms_global_increment_nbbranchnew(); mynewbranch->_adms._datatypename=adms_adms_enumeration_datatypename_branch; mynewbranch->_adms._seen=adms_adms_enumeration_seen_no; mynewbranch->_module_isdefault=-1; adms_branch_valueto_module (mynewbranch,mymodule); mynewbranch->_module_isdefault=1; mynewbranch->_pnode_isdefault=-1; adms_branch_valueto_pnode (mynewbranch,mypnode); mynewbranch->_pnode_isdefault=1; mynewbranch->_nnode_isdefault=-1; adms_branch_valueto_nnode (mynewbranch,mynnode); mynewbranch->_nnode_isdefault=1; mynewbranch->_discipline_isdefault=-1; mynewbranch->_grounded_isdefault=-1; adms_branch_valueto_grounded(mynewbranch,adms_enumeration_new(adms_branch_enumeration_grounded_no,adms_branch_fromstring_grounded_impl,adms_branch_tostring_grounded_impl)); mynewbranch->_grounded_isdefault=1; mynewbranch->_attribute_isdefault=-1; return mynewbranch; } p_adms adms_branch_new_impl (p_adms arguments[]) { p_branch mynewbranch; p_module mymodule=(p_module)arguments[0]; p_node mypnode=(p_node)arguments[1]; p_node mynnode=(p_node)arguments[2]; mynewbranch=adms_branch_new(mymodule,mypnode,mynnode); return adms_adms(mynewbranch); } /*$2:$3*/ char*adms_branch_uid (p_branch mynewbranch) { char*myuid=NULL; char*myuid0=adms_node_uid(mynewbranch->_pnode); char*myuid1=adms_node_uid(mynewbranch->_nnode); adms_strconcat(&myuid,myuid0); adms_strconcat2(&myuid,":"); adms_strconcat(&myuid,myuid1); return myuid; } inline void adms_branch_valueto_module (p_branch mybranch,p_module _module) { mybranch->_module=_module; mybranch->_module_isdefault=0; } inline void adms_branch_valueto_pnode (p_branch mybranch,p_node _pnode) { mybranch->_pnode=_pnode; mybranch->_pnode_isdefault=0; } inline void adms_branch_valueto_nnode (p_branch mybranch,p_node _nnode) { mybranch->_nnode=_nnode; mybranch->_nnode_isdefault=0; } inline void adms_branch_valueto_discipline (p_branch mybranch,p_discipline _discipline) { mybranch->_discipline=_discipline; mybranch->_discipline_isdefault=0; } inline void adms_branch_valueto_grounded (p_branch mybranch,p_enumeration _grounded) { mybranch->_grounded=_grounded; mybranch->_grounded_isdefault=0; } inline void adms_branch_valueto_attribute (p_branch mybranch,p_slist _attribute) { mybranch->_attribute=_attribute; mybranch->_attribute_isdefault=0; } p_attribute adms_branch_list_attribute_lookup_by_id (p_branch mymybranch,p_quark myname) { p_slist list=adms_branch_valueof_attribute(mymybranch); while(list) { p_attribute refattribute=adms_attribute(list->data); if(!strcmp(adms_attribute_valueof_name(refattribute)->_value,myname->_value)) return refattribute; list=list->next; } return NULL; } p_attribute adms_branch_list_attribute_prepend_by_id (p_branch mymybranch,p_quark myname) { p_attribute refattribute=adms_attribute_new(myname); adms_slist_push(&adms_branch_valueof_attribute(mymybranch),adms_adms(refattribute)); return refattribute; } p_attribute adms_branch_list_attribute_prepend_by_id_once_or_ignore (p_branch mymybranch,p_quark myname) { p_attribute refattribute=adms_attribute_new(myname); adms_slist_push(&adms_branch_valueof_attribute(mymybranch),adms_adms(refattribute)); return refattribute; } void adms_branch_list_attribute_prepend (p_branch mymybranch,p_attribute myattribute) { adms_slist_push(&adms_branch_valueof_attribute(mymybranch),adms_adms(myattribute)); } e_branch_grounded adms_branch_fromstring_grounded_impl (p_admsttransform myadmsttransform,char*token) { if(!strcmp(token,"no")) return adms_branch_enumeration_grounded_no; if(!strcmp(token,"yes")) return adms_branch_enumeration_grounded_yes; adms_message_fatal_continue(("select='branch/grounded': possible values:\n")) adms_message_fatal_continue(("no|yes\n")) adms_message_fatal(("see %s\n",adms_admsttransform_uid(myadmsttransform))) return 0; } char* adms_branch_tostring_grounded_impl (p_admsttransform myadmsttransform,p_enumeration myenumeration) { e_branch_grounded e=myenumeration->_value; if(e==adms_branch_enumeration_grounded_no) return "no"; if(e==adms_branch_enumeration_grounded_yes) return "yes"; adms_message_fatal_continue(("select='branch/grounded': possible values:\n")) adms_message_fatal_continue(("no|yes\n")) adms_message_fatal(("see %s\n",adms_admsttransform_uid(myadmsttransform))) return NULL; }