Add requested argument to execute-modulefile

Update execute-modulefile procedure to add requested argument. This
piece of information tells if the evaluation has been requested by user
or if it is an automatically triggered evaluation.

Internal evaluation (refresh, scan and whatis) are considered auto
evaluations.
This commit is contained in:
Xavier Delaruelle
2024-04-24 07:47:07 +02:00
parent ebc21a40b6
commit 70ecd34698
4 changed files with 16 additions and 15 deletions

View File

@@ -1068,7 +1068,7 @@ tcl/syntaxdb.tcl: modulecmd.tcl $(NAGELFAR)
set tcl_interactive 1;\
source $(NAGELFAR_RELEASE)/syntaxbuild.tcl;\
set ::syntax(appendNoDupToList) {n x*};\
set ::syntax(execute-modulefile) {x x n x x? x? x?};\
set ::syntax(execute-modulefile) {x x n x x x? x? x?};\
set ::syntax(filterExtraMatchSearch) {x x n n};\
set ::syntax(findModulesFromDirsAndFiles) {x x x x n n? n? n? n?};\
set ::syntax(getArrayKey) {n x x};\

View File

@@ -228,8 +228,8 @@ proc skipUnloadIfSticky {mode modname modfile} {
return 0
}
proc execute-modulefile {modfile modname modnamevrvar modspec {up_namevr 1}\
{fetch_tags 1} {modpath {}}} {
proc execute-modulefile {modfile modname modnamevrvar modspec requested\
{up_namevr 1} {fetch_tags 1} {modpath {}}} {
# link to modnamevr variable name from calling ctx if content update asked
if {$up_namevr} {
upvar $modnamevrvar modnamevr

View File

@@ -378,7 +378,7 @@ proc filterExtraMatchSearch {modpath mod res_arrname versmod_arrname} {
$found_list($elt) 2]]} {
##nagelfar ignore Suspicious variable name
execute-modulefile [lindex $found_list($elt) 2] $elt $elt\
$elt 0 0 $modpath
$elt 0 0 0 $modpath
}
}
}

View File

@@ -149,7 +149,7 @@ proc cmdModuleDisplay {args} {
set first_report 0
}
report [sgr hi $modfile]:\n
execute-modulefile $modfile $modname modnamevr $mod
execute-modulefile $modfile $modname modnamevr $mod 1
displaySeparatorLine
}
}
@@ -392,7 +392,7 @@ proc cmdModuleSearch {{mod {}} {search {}}} {
foreach elt [lsort -dictionary [array names interp_list]] {
set ::g_whatis {}
##nagelfar ignore Suspicious variable name
execute-modulefile $interp_list($elt) $elt $elt $elt 0
execute-modulefile $interp_list($elt) $elt $elt $elt 0 0
# treat whatis as a multi-line text
if {$search eq {} || [regexp -nocase $search $::g_whatis]} {
@@ -1007,7 +1007,7 @@ proc cmdModuleSource {mode args} {
lappendState mode $mode
# sourced file must also have a magic cookie set at their start
##nagelfar ignore Suspicious variable name
execute-modulefile $modfile $modname $modnamevr $mod 0 0
execute-modulefile $modfile $modname $modnamevr $mod 1 0 0
##nagelfar ignore Found constant
lpopState mode
}
@@ -1277,7 +1277,7 @@ proc cmdModuleLoad {context uasked tryload loadany tag_list modulepath_list\
}
}
if {[execute-modulefile $modfile $modname modnamevr $mod]} {
if {[execute-modulefile $modfile $modname modnamevr $mod $uasked]} {
break
}
@@ -1639,19 +1639,20 @@ proc cmdModuleUnload {context match auto force onlyureq onlyndep args} {
# unload evaluation to report correct order with other evaluations)
registerModuleEval $context $msgrecid
# module was asked by user if tagged loaded instead of auto-loaded
set uasked [isModuleTagged $modname loaded 1]
# no need to update modnamevr and tags after evaluation as these
# information were already complete in persistent environment
##nagelfar ignore Suspicious variable name
if {[execute-modulefile $modfile $modname $modnamevr $mod 0 0]} {
if {[execute-modulefile $modfile $modname $modnamevr $mod $uasked 0\
0]} {
break
}
# unloading visibility depends on hidden-loaded tag
set hidden [isModuleTagged $modname hidden-loaded 1]
# module was asked by user if tagged loaded instead of auto-loaded
set uasked [isModuleTagged $modname loaded 1]
# unset module from list of loaded modules qualified for refresh eval
if {[isModuleRefreshQualified $modname]} {
remove-path __MODULES_LMREFRESH $modname
@@ -2362,7 +2363,7 @@ proc cmdModuleTest {args} {
set first_report 0
}
report "Module Specific Test for [sgr hi $modfile]:\n"
execute-modulefile $modfile $modname modnamevr $mod
execute-modulefile $modfile $modname modnamevr $mod 1
displaySeparatorLine
}
}
@@ -2686,7 +2687,7 @@ proc cmdModuleRefresh {} {
# continue to evaluate the remaining loaded modules
pushSettings
if {[set errCode [catch {
if {[execute-modulefile $lmfile $lm lmvr $lm]} {
if {[execute-modulefile $lmfile $lm lmvr $lm 0]} {
break
}
@@ -2724,7 +2725,7 @@ proc cmdModuleHelp {args} {
set first_report 0
}
report "Module Specific Help for [sgr hi $modfile]:\n"
execute-modulefile $modfile $modname modnamevr $arg
execute-modulefile $modfile $modname modnamevr $arg 1
displaySeparatorLine
}
}