Dirty fix: reintroducing the getDescendantText and getDescendantAttribute routines that are needed to build the QE-modes.

In future these two should be merged with getTextFromDescendant and getAttributeFromDescendantPath.



git-svn-id: http://qeforge.qe-forge.org/svn/q-e/trunk/espresso@13066 c92efa57-630b-4861-b058-cf58834340f0
This commit is contained in:
kokalj 2016-10-02 16:58:02 +00:00
parent 963cf40611
commit 187c224a08
2 changed files with 69 additions and 0 deletions

View File

@ -18,6 +18,7 @@ set auto_index(::helpdoc::xml_http) [list source [file join $dir xml.tcl]]
set auto_index(::helpdoc::xml_doi) [list source [file join $dir xml.tcl]]
set auto_index(::helpdoc::xml_prb) [list source [file join $dir xml.tcl]]
set auto_index(::helpdoc::xml_prl) [list source [file join $dir xml.tcl]]
set auto_index(::helpdoc::xml_arxiv) [list source [file join $dir xml.tcl]]
set auto_index(::helpdoc::xml_ref) [list source [file join $dir xml.tcl]]
set auto_index(::helpdoc::xml_link) [list source [file join $dir xml.tcl]]
set auto_index(::helpdoc::xml_tag_enter) [list source [file join $dir xml.tcl]]
@ -92,8 +93,11 @@ set auto_index(::helpdoc::getFromTree) [list source [file join $dir tree.tcl]]
set auto_index(::helpdoc::getDescendantNodes) [list source [file join $dir tree.tcl]]
set auto_index(::helpdoc::getTextFromDescendant) [list source [file join $dir tree.tcl]]
set auto_index(::helpdoc::getAttributeFromDescendantPath) [list source [file join $dir tree.tcl]]
set auto_index(::helpdoc::getDescendantText) [list source [file join $dir tree.tcl]]
set auto_index(::helpdoc::getDescendantAttribute) [list source [file join $dir tree.tcl]]
set auto_index(::helpdoc::gui_help::printHelp_) [list source [file join $dir guihelp.tcl]]
set auto_index(::helpdoc::gui_help::addHelp_) [list source [file join $dir guihelp.tcl]]
set auto_index(::helpdoc::gui_help::if_exists_addHelp_) [list source [file join $dir guihelp.tcl]]
set auto_index(::helpdoc::gui_help::grouphelp) [list source [file join $dir guihelp.tcl]]
set auto_index(::helpdoc::gui_help::help) [list source [file join $dir guihelp.tcl]]
set auto_index(::helpdoc::checkGui_makeHelpFile) [list source [file join $dir guihelp.tcl]]

View File

@ -96,3 +96,68 @@ proc ::helpdoc::getAttributeFromDescendantPath {tree node args} {
return $result
}
proc ::helpdoc::getDescendantText {tree node args} {
# Usage: getDescendantText $tree $node tag1 tag2 last_tag
# Beware: it will get the text from all tags that matches
set result ""
set tag [lindex $args 0]
foreach child [$tree children $node] {
set _tag [getFromTree $tree $child tag]
if { $tag == $_tag } {
if { $tag == $args } {
append result "[getFromTree $tree $child text] "
} else {
set args1 [lrange $args 1 end]
return [getDescendantText $tree $child $args1]
}
}
}
return $result
}
proc ::helpdoc::getDescendantAttribute {tree node args} {
# Usage: getDescendantText $tree $node tag1 tag2 last_tag attribute_of_last_tag
# Beware: it will get the requested attribute from all tags that matches
set result ""
set tag [lindex $args 0]
set att [lindex $args end]
foreach child [$tree children $node] {
set _tag [getFromTree $tree $child tag]
if { $tag == $_tag } {
if { [llength $args] == 2 } {
# ok _tag is the attribute
set attr [getFromTree $tree $child attributes]
attr2array_ arr $attr
if { [info exists arr($att)] } {
append result $arr($att)
}
} else {
set args1 [lrange $args 1 end]
return [getDescendantAttribute $tree $child $args1]
}
}
}
return $result
}