|
|
|
@ -436,7 +436,7 @@ namespace eval punk {
|
|
|
|
|
scan $s %${p}s%s |
|
|
|
|
} |
|
|
|
|
proc _split_patterns {varspecs} { |
|
|
|
|
set name_mapped [pipecmd_rhsmapping $varspecs] |
|
|
|
|
set name_mapped [pipecmd_namemapping $varspecs] |
|
|
|
|
set cmdname ::punk::pipecmds::split_patterns_$name_mapped |
|
|
|
|
if {$cmdname in [info commands $cmdname]} { |
|
|
|
|
return [$cmdname] |
|
|
|
@ -1876,7 +1876,7 @@ namespace eval punk {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
proc _var_classify {multivar} { |
|
|
|
|
set cmdname ::punk::pipecmds::var_classify_$multivar |
|
|
|
|
set cmdname ::punk::pipecmds::var_classify_[pipecmd_namemapping $multivar] |
|
|
|
|
if {$cmdname in [info commands $cmdname]} { |
|
|
|
|
return [$cmdname] |
|
|
|
|
} |
|
|
|
@ -2848,8 +2848,10 @@ namespace eval punk {
|
|
|
|
|
|
|
|
|
|
#map rhs to names suitable to use in pipemcd proc name (whitespace mapping) |
|
|
|
|
# (for .= and = pipecmds) |
|
|
|
|
proc pipecmd_rhsmapping {rhs} { |
|
|
|
|
return [string map [list " " "<sp>" \t "<tab>"] $rhs] |
|
|
|
|
proc pipecmd_namemapping {rhs} { |
|
|
|
|
set rhs [string trim $rhs];#ignore all leading & trailing whitespace |
|
|
|
|
set rhs [regsub -all {\s{1,}} $rhs {<sp>}] ;#collapse all internal whitespace to a single <sp> token |
|
|
|
|
return $rhs |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#same as used in unknown func for initial launch |
|
|
|
@ -2865,16 +2867,16 @@ namespace eval punk {
|
|
|
|
|
} |
|
|
|
|
#puts stderr ">> match_assign '$scopepattern=$equalsrhs' $args" |
|
|
|
|
set fulltail $args |
|
|
|
|
set homens ::punk::pipecmds |
|
|
|
|
set rhsmapping [pipecmd_rhsmapping $equalsrhs] |
|
|
|
|
set pipecmd ${homens}::$scopepattern=$rhsmapping |
|
|
|
|
set cmdns ::punk::pipecmds |
|
|
|
|
set namemapping [pipecmd_namemapping $equalsrhs] |
|
|
|
|
set pipecmd ${cmdns}::$scopepattern=$namemapping |
|
|
|
|
#pipecmd could have glob chars - test $pipcmd in the list - not just that info commands returns results. |
|
|
|
|
if {$pipecmd in [info commands $pipecmd]} { |
|
|
|
|
#puts "==nscaller: '[uplevel 1 [list namespace current]]'" |
|
|
|
|
#uplevel 1 [list ::namespace import $pipecmd] |
|
|
|
|
set existing_path [uplevel 1 [list ::namespace path]] |
|
|
|
|
if {$homens ni $existing_path} { |
|
|
|
|
uplevel 1 [list ::namespace path [concat $existing_path $homens]] |
|
|
|
|
if {$cmdns ni $existing_path} { |
|
|
|
|
uplevel 1 [list ::namespace path [concat $existing_path $cmdns]] |
|
|
|
|
} |
|
|
|
|
tailcall $pipecmd {*}$args |
|
|
|
|
} |
|
|
|
@ -3037,8 +3039,8 @@ namespace eval punk {
|
|
|
|
|
debug.punk.pipe.compile {match_assign creating proc $pipecmd} 2 |
|
|
|
|
uplevel 1 [list ::proc $pipecmd args $script] |
|
|
|
|
set existing_path [uplevel 1 [list ::namespace path]] |
|
|
|
|
if {$homens ni $existing_path} { |
|
|
|
|
uplevel 1 [list ::namespace path [concat $existing_path $homens]] |
|
|
|
|
if {$cmdns ni $existing_path} { |
|
|
|
|
uplevel 1 [list ::namespace path [concat $existing_path $cmdns]] |
|
|
|
|
} |
|
|
|
|
tailcall $pipecmd {*}$args |
|
|
|
|
} |
|
|
|
@ -3683,7 +3685,7 @@ namespace eval punk {
|
|
|
|
|
set segment_members_filled [list] |
|
|
|
|
set segmenttail $segment_members ;# todo - change to segment_members here to match punk::match_assign |
|
|
|
|
|
|
|
|
|
set rhsmapped [pipecmd_rhsmapping $rhs] |
|
|
|
|
set rhsmapped [pipecmd_namemapping $rhs] |
|
|
|
|
set cmdname "::punk::pipecmds::insertion_$rhsmapped" |
|
|
|
|
#commandname can contain glob chars - must search for exact membership in 'info commands' result. |
|
|
|
|
if {$cmdname ni [info commands $cmdname]} { |
|
|
|
@ -4227,7 +4229,7 @@ namespace eval punk {
|
|
|
|
|
} else { |
|
|
|
|
set nscaller [uplevel 1 [list ::namespace current]] |
|
|
|
|
#jmn |
|
|
|
|
set rhsmapped [pipecmd_rhsmapping $equalsrhs] |
|
|
|
|
set rhsmapped [pipecmd_namemapping $equalsrhs] |
|
|
|
|
set commands [uplevel 1 [list ::info commands $pattern=$rhsmapped]] ;#uplevel - or else we are checking from perspective of this namespace ::punk |
|
|
|
|
#we must check for exact match of the command in the list - because command could have glob chars. |
|
|
|
|
if {"$pattern=$rhsmapped" in $commands} { |
|
|
|
|