Skip to content

Commit 1844469

Browse files
committed
Simplify recordScanModuleElt procedure
Current module name version designation can be guessed within recordScanModuleElt procedure. No need to pass it as an argument.
1 parent 4306e07 commit 1844469

File tree

1 file changed

+23
-29
lines changed

1 file changed

+23
-29
lines changed

tcl/modscan.tcl

Lines changed: 23 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ proc variant-sc {itrp args} {
3434
}
3535
}
3636

37-
recordScanModuleElt [currentState modulename] $name variant
37+
recordScanModuleElt $name variant
3838

3939
lappend ::g_scanModuleVariant([currentState modulename]) [list $name\
4040
$values $defdflvalue $dflvalue $isboolean]
@@ -47,7 +47,7 @@ proc variant-sc {itrp args} {
4747
proc setenv-sc {args} {
4848
lassign [parseSetenvCommandArgs load set {*}$args] bhv var val
4949

50-
recordScanModuleElt [currentState modulename] $var setenv envvar
50+
recordScanModuleElt $var setenv envvar
5151

5252
if {![info exists ::env($var)]} {
5353
set ::env($var) {}
@@ -59,7 +59,7 @@ proc edit-path-sc {cmd args} {
5959
lassign [parsePathCommandArgs $cmd load noop {*}$args] separator allow_dup\
6060
idx_val ign_refcount bhv var path_list
6161

62-
recordScanModuleElt [currentState modulename] $var $cmd envvar
62+
recordScanModuleElt $var $cmd envvar
6363

6464
if {![info exists ::env($var)]} {
6565
set ::env($var) {}
@@ -68,7 +68,7 @@ proc edit-path-sc {cmd args} {
6868
}
6969

7070
proc pushenv-sc {var val} {
71-
recordScanModuleElt [currentState modulename] $var pushenv envvar
71+
recordScanModuleElt $var pushenv envvar
7272

7373
if {![info exists ::env($var)]} {
7474
set ::env($var) {}
@@ -79,7 +79,7 @@ proc pushenv-sc {var val} {
7979
proc unsetenv-sc {args} {
8080
lassign [parseUnsetenvCommandArgs load noop {*}$args] bhv var val
8181

82-
recordScanModuleElt [currentState modulename] $var unsetenv envvar
82+
recordScanModuleElt $var unsetenv envvar
8383

8484
if {![info exists ::env($var)]} {
8585
set ::env($var) {}
@@ -92,51 +92,50 @@ proc complete-sc {shell name body} {
9292
knerror "Invalid command name '$name'"
9393
}
9494

95-
recordScanModuleElt [currentState modulename] $name complete
95+
recordScanModuleElt $name complete
9696
}
9797

9898
proc uncomplete-sc {name} {
9999
if {[string length $name] == 0} {
100100
knerror "Invalid command name '$name'"
101101
}
102102

103-
recordScanModuleElt [currentState modulename] $name uncomplete
103+
recordScanModuleElt $name uncomplete
104104
}
105105

106106
proc set-alias-sc {alias what} {
107-
recordScanModuleElt [currentState modulename] $alias set-alias
107+
recordScanModuleElt $alias set-alias
108108
}
109109

110110
proc unset-alias-sc {alias} {
111-
recordScanModuleElt [currentState modulename] $alias unset-alias
111+
recordScanModuleElt $alias unset-alias
112112
}
113113

114114
proc set-function-sc {function what} {
115-
recordScanModuleElt [currentState modulename] $function set-function
115+
recordScanModuleElt $function set-function
116116
}
117117

118118
proc unset-function-sc {function} {
119-
recordScanModuleElt [currentState modulename] $function unset-function
119+
recordScanModuleElt $function unset-function
120120
}
121121

122122
proc chdir-sc {dir} {
123-
recordScanModuleElt [currentState modulename] $dir chdir
123+
recordScanModuleElt $dir chdir
124124
}
125125

126126
proc family-sc {name} {
127127
if {[string length $name] == 0 || ![regexp {^[A-Za-z0-9_]*$} $name]} {
128128
knerror "Invalid family name '$name'"
129129
}
130-
recordScanModuleElt [currentState modulename] $name family
130+
recordScanModuleElt $name family
131131
}
132132

133133
proc prereq-sc {args} {
134134
lassign [parsePrereqCommandArgs prereq {*}$args] tag_list optional\
135135
opt_list args
136136

137137
foreach modspec [parseModuleSpecification 0 0 0 0 {*}$args] {
138-
recordScanModuleElt [currentState modulename] $modspec prereq\
139-
prereq-any require
138+
recordScanModuleElt $modspec prereq prereq-any require
140139
}
141140
}
142141

@@ -145,8 +144,7 @@ proc prereq-all-sc {args} {
145144
opt_list args
146145

147146
foreach modspec [parseModuleSpecification 0 0 0 0 {*}$args] {
148-
recordScanModuleElt [currentState modulename] $modspec prereq-all\
149-
depends-on require
147+
recordScanModuleElt $modspec prereq-all depends-on require
150148
}
151149
}
152150

@@ -155,14 +153,13 @@ proc always-load-sc {args} {
155153
opt_list args
156154

157155
foreach modspec [parseModuleSpecification 0 0 0 0 {*}$args] {
158-
recordScanModuleElt [currentState modulename] $modspec always-load\
159-
require
156+
recordScanModuleElt $modspec always-load require
160157
}
161158
}
162159

163160
proc conflict-sc {args} {
164161
foreach modspec [parseModuleSpecification 0 0 0 0 {*}$args] {
165-
recordScanModuleElt [currentState modulename] $modspec conflict incompat
162+
recordScanModuleElt $modspec conflict incompat
166163
}
167164
}
168165

@@ -181,29 +178,26 @@ proc module-sc {command args} {
181178
switch -- [llength $modspeclist] {
182179
{1} {
183180
# no switched-off module with one-arg form
184-
recordScanModuleElt [currentState modulename] $modspeclist\
185-
switch switch-on require
181+
recordScanModuleElt $modspeclist switch switch-on require
186182
}
187183
{2} {
188184
lassign $modspeclist swoffarg swonarg
189-
recordScanModuleElt [currentState modulename] $swoffarg switch\
190-
switch-off incompat
191-
recordScanModuleElt [currentState modulename] $swonarg switch\
192-
switch-on require
185+
recordScanModuleElt $swoffarg switch switch-off incompat
186+
recordScanModuleElt $swonarg switch switch-on require
193187
}
194188
}
195189
} else {
196190
set xtalias [expr {$command eq {unload} ? {incompat} : {require}}]
197191
# record each module spec
198192
foreach modspec $modspeclist {
199-
recordScanModuleElt [currentState modulename] $modspec $command\
200-
$xtalias
193+
recordScanModuleElt $modspec $command $xtalias
201194
}
202195
}
203196
}
204197
}
205198

206-
proc recordScanModuleElt {mod name args} {
199+
proc recordScanModuleElt {name args} {
200+
set mod [currentState modulename]
207201
if {![info exists ::g_scanModuleElt]} {
208202
set ::g_scanModuleElt [dict create]
209203
}

0 commit comments

Comments
 (0)