File: check_gui

package info (click to toggle)
espresso 6.7-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 311,068 kB
  • sloc: f90: 447,429; ansic: 52,566; sh: 40,631; xml: 37,561; tcl: 20,077; lisp: 5,923; makefile: 4,503; python: 4,379; perl: 1,219; cpp: 761; fortran: 618; java: 568; awk: 128
file content (128 lines) | stat: -rwxr-xr-x 2,976 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#!/bin/sh
# the next line restarts using tclsh \
exec tclsh "$0" "$@"

#
# Usage:   check_gui module
#          ( module = pw, neb, ph, pp, projwfc, bands, dos, atomic )
#
# Purpose: check the PWgui modules wrt corresponding INPUT_*.def
#          files and create a PWgui help files.
#

if { ! [info exists env(PWGUI)] } {
    # try with: ../GUI/PWgui
    set env(PWGUI) [file normalize [file join .. GUI PWgui]]
}
if { ! [info exists env(GUIB)] } {
    # try with: ../GUI/Guib
    set env(GUIB) [file normalize [file join .. GUI Guib]]
}

set basedir [file normalize [file dirname [info script]]]
set topdir  [file normalize [file join $basedir ..]]
set helpdocdir [file join $basedir helpdoc.d]

source [file join $helpdocdir modules.tcl]; # load which modules do we support

if { $argc != 1 } {
    helpdoc::prog_module_usage
}

set module [lindex $argv 0]

# load helpdoc

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 deffile    [helpdoc::get_def_filename $module]
set modulefile [helpdoc::get_gui_module_filename $module]

# compile the $deffile

cd [file dirname $deffile]
catch {exec make [file rootname [file tail $deffile]].html}
cd $basedir
	
# output info

puts "
Checking PWgui module: $module

    *     module file: $modulefile
    * definition file: $deffile
"

# the current $module-help.tcl file will interfere the process, rename it:	

if { [file exists [file join $moduledir $module $module-help.tcl]] } {
    puts "Renaming the current $module-help.tcl file to $module-help.tcl.bak"
    file rename -force [file join $moduledir $module $module-help.tcl] [file join $moduledir $module $module-help.tcl.bak]
}

# make a blanck $module-help.tcl file

close [open [file join $moduledir $module $module-help.tcl] w]


# 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

if { [file exists [file join $moduledir $module $module-help.tcl.bak]] } {
    puts "Renaming back the $module-help.tcl.bak file to $module-help.tcl"
    file rename -force [file join $moduledir $module $module-help.tcl.bak] [file join $moduledir $module $module-help.tcl]
}

if { [info exists ::helpdoc::moduleNewCode] } {
    puts "
###
### Tentative new code for the missing DEF variables:
###
"
    puts $::helpdoc::moduleNewCode

    puts "### end-of-tentative-new-code
"
}
	  
# ok, we are done; since we loaded Tk, we need an explicit exit !!!

exit 0