Skip to content

Commit

Permalink
Filter alias/sym on list output when reported
Browse files Browse the repository at this point in the history
When module aliases or symbolic versions are reported independently from
the loaded module they are attached to, apply pattern search also to
these alternative names.

Update modEq procedures to be able to match pattern to module name and
only its symbols or only its aliases. As pattern match is made over the
independent symbol or alias designation when reported.
  • Loading branch information
xdelaruelle committed Jul 2, 2023
1 parent 0f9d91c commit 77ad34a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
8 changes: 8 additions & 0 deletions tcl/modspec.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,8 @@ proc modEqProc {pattern mod {test equal} {trspec 1} {ismodlo 0} {vrcmp 0}\
}
# get alternative names if mod is loading(1) or loaded(2)
set altlist [switch -- $ismodlo {
7 {getLoadedAltname $mod 0 {alias}}
6 {getLoadedAltname $mod 0 {sym autosym}}
5 {getAvailListFromVersSpec $mod}
4 {getAllModuleResolvedName $mod 0 {} 1}
3 {getLoadedAltAndSimplifiedName $mod}
Expand Down Expand Up @@ -762,6 +764,8 @@ proc modEqProcIcase {pattern mod {test equal} {trspec 1} {ismodlo 0} {vrcmp\
set endwslash 0
}
set altlist [switch -- $ismodlo {
7 {getLoadedAltname $mod 0 {alias}}
6 {getLoadedAltname $mod 0 {sym autosym}}
5 {getAvailListFromVersSpec $mod}
4 {getAllModuleResolvedName $mod 0 {} 1}
3 {getLoadedAltAndSimplifiedName $mod}
Expand Down Expand Up @@ -881,6 +885,8 @@ proc modEqProcExtdfl {pattern mod {test equal} {trspec 1} {ismodlo 0} {vrcmp\
set endwslash 0
}
set altlist [switch -- $ismodlo {
7 {getLoadedAltname $mod 0 {alias}}
6 {getLoadedAltname $mod 0 {sym autosym}}
5 {getAvailListFromVersSpec $mod}
4 {getAllModuleResolvedName $mod 0 {} 1}
3 {getLoadedAltAndSimplifiedName $mod}
Expand Down Expand Up @@ -1016,6 +1022,8 @@ proc modEqProcIcaseExtdfl {pattern mod {test equal} {trspec 1} {ismodlo 0}\
set endwslash 0
}
set altlist [switch -- $ismodlo {
7 {getLoadedAltname $mod 0 {alias}}
6 {getLoadedAltname $mod 0 {sym autosym}}
5 {getAvailListFromVersSpec $mod}
4 {getAllModuleResolvedName $mod 0 {} 1}
3 {getLoadedAltAndSimplifiedName $mod}
Expand Down
10 changes: 9 additions & 1 deletion tcl/subcmd.tcl.in
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,20 @@ proc cmdModuleList {show_oneperline show_mtime search_match args} {

# filter loaded modules not matching any of the mod spec passed
if {[llength $args] > 0} {
# include alt name comparison (alias/sym) when checking module name
# depends if alias and/or sym are reported independently
set modeq_altname_mode [switch -- $report_indesym$report_alias {
11 {expr {0}}
10 {expr {7}}
01 {expr {6}}
00 {expr {2}}
}]
set matchlist [list]
foreach mod $loadedmodlist {
foreach pattern $args {
# compare pattern against loaded module, its variant set and its
# alternative names
if {[modEq $pattern $mod $mtest 1 2 1 0 *]} {
if {[modEq $pattern $mod $mtest 1 $modeq_altname_mode 1 0 *]} {
lappend matchlist $mod
break
}
Expand Down

0 comments on commit 77ad34a

Please sign in to comment.