2008-05-09 02:26:26 +08:00
|
|
|
#!/bin/sh
|
|
|
|
# the next line restarts using tclsh \
|
|
|
|
exec tclsh "$0" "$@"
|
|
|
|
|
|
|
|
#
|
|
|
|
# Usage: check_gui module
|
|
|
|
# ( module = pw, ph, pp, projwfc, atomic, or d3 )
|
|
|
|
#
|
|
|
|
# Purpose: check the PWgui modules wrt coprresponding INPUT_*.def
|
|
|
|
# files and create a PWgui help files.
|
|
|
|
#
|
|
|
|
|
|
|
|
proc Usage {} {
|
|
|
|
global argv0
|
|
|
|
|
|
|
|
puts stderr [subst {
|
|
|
|
Usage: $argv0 module
|
|
|
|
|
|
|
|
Where module is one of:
|
|
|
|
|
|
|
|
\tpw
|
|
|
|
\tph
|
|
|
|
\tpp
|
|
|
|
\tprojwfc
|
|
|
|
\tatomic
|
|
|
|
\td3
|
|
|
|
}]
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
if { $argc != 1 } {
|
|
|
|
Usage
|
|
|
|
}
|
|
|
|
|
|
|
|
set module [lindex $argv 0]
|
|
|
|
|
|
|
|
set basedir [file normalize [file dirname [info script]]]
|
|
|
|
set topdir [file normalize [file join $basedir ..]]
|
|
|
|
|
|
|
|
# load helpdoc
|
|
|
|
|
|
|
|
set helpdocdir [file join $basedir helpdoc.d]
|
|
|
|
source [file join $helpdocdir helpdoc.tcl]
|
|
|
|
|
|
|
|
|
|
|
|
# load Guib
|
|
|
|
|
|
|
|
set guibdir [file join $topdir GUI Guib]
|
|
|
|
lappend auto_path $guibdir
|
|
|
|
package require Guib
|
|
|
|
wm withdraw .
|
|
|
|
|
|
|
|
|
|
|
|
# PWgui's modules dir
|
|
|
|
|
|
|
|
set pwguidir [file join $topdir GUI PWgui]
|
|
|
|
set moduledir [file join $pwguidir modules]
|
|
|
|
source [file join $pwguidir init.tcl]
|
|
|
|
|
|
|
|
|
|
|
|
# map from module to def- and module-file
|
|
|
|
|
|
|
|
set mappings {
|
2008-05-13 21:31:02 +08:00
|
|
|
pw doc-def INPUT_PW
|
|
|
|
ph doc-def INPUT_PH
|
|
|
|
pp doc-def INPUT_PP
|
|
|
|
projwfc doc-def INPUT_PROJWFC
|
|
|
|
atomic doc-def INPUT_LD1
|
|
|
|
d3 doc-def INPUT_D3
|
2008-05-09 02:26:26 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
foreach {mod subdir def_prefix} $mappings {
|
|
|
|
if { $mod == $module } {
|
|
|
|
set deffile [file join $topdir $subdir $def_prefix.def]
|
|
|
|
set modulefile [file join $moduledir $mod $mod.tcl]
|
|
|
|
|
|
|
|
puts "Checking PWgui module: $mod"
|
|
|
|
puts " * module file: $modulefile"
|
|
|
|
puts " * definition file: $deffile"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if { ! [info exists deffile] } {
|
|
|
|
Usage
|
|
|
|
}
|
|
|
|
|
|
|
|
# read & load both the def & module file
|
|
|
|
|
|
|
|
set def [::helpdoc::def_loadDef $deffile]
|
|
|
|
set obj [::guib::loadModule $modulefile]; $obj storeModuleItems
|
|
|
|
|
|
|
|
#
|
|
|
|
# check DEF vs. MODULE file
|
|
|
|
#
|
|
|
|
|
|
|
|
::helpdoc::checkGui_def_vs_module
|
|
|
|
|
|
|
|
#
|
|
|
|
# check MODULE vs. DEF file
|
|
|
|
#
|
|
|
|
|
|
|
|
::helpdoc::checkGui_module_vs_def
|
|
|
|
|
|
|
|
#
|
|
|
|
# Create a HELP file
|
|
|
|
#
|
|
|
|
|
|
|
|
::helpdoc::checkGui_makeHelpFile $deffile $modulefile
|
|
|
|
|
|
|
|
# ok, we are done; since we loaded Tk, we need an explicit exit !!!
|
|
|
|
exit 0
|