Skip to content

Commit aac27e7

Browse files
committed
Add getCurrentModfileInterpName proc
Add getCurrentModfileInterpName procedure to return identifier name of current Tcl modulefile interpreter.
1 parent d76f044 commit aac27e7

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

tcl/mfinterp.tcl.in

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,13 @@ proc nimp {cmd args} {
3232
reportWarning "'$cmd' command not implemented"
3333
}
3434

35+
36+
# Get identifier name of current Tcl modulefile interpreter. An interp is
37+
# dedicated to each mode/depth level of modulefile interpretation
38+
proc getCurrentModfileInterpName {} {
39+
return __modfile_[currentState mode]_[depthState modulename]
40+
}
41+
3542
# synchronize environment variable change over all started sub interpreters
3643
proc interp-sync-env {op var {val {}}} {
3744
set envvar ::env($var)
@@ -229,7 +236,7 @@ proc execute-modulefile {modfile modname modnamevrvar modspec {up_namevr 1}\
229236
}
230237
# dedicate an interpreter per mode and per level of interpretation to have
231238
# a dedicated interpreter in case of cascaded multi-mode interpretations
232-
set itrp __modfile_${mode}_[depthState modulename]
239+
set itrp [getCurrentModfileInterpName]
233240

234241
# evaluation mode-specific configuration
235242
set dumpCommandsVN g_modfile${mode}Commands
@@ -2271,7 +2278,7 @@ proc source-sh {shell script args} {
22712278
{*}$modcontent]
22722279
22732280
# get name of current module Tcl interp
2274-
set itrp __modfile_[currentState mode]_[depthState modulename]
2281+
set itrp [getCurrentModfileInterpName]
22752282
22762283
# evaluate resulting modulefile commands through current Tcl interp
22772284
foreach modcmd $modcontent {
@@ -2292,7 +2299,7 @@ proc source-sh-un {shell script args} {
22922299
}
22932300
22942301
# get name of current module unload Tcl interp
2295-
set itrp __modfile_[currentState mode]_[depthState modulename]
2302+
set itrp [getCurrentModfileInterpName]
22962303
22972304
# evaluate each recorded command in unload Tcl interp to get them reversed
22982305
foreach modcmd $modcontent {
@@ -2363,7 +2370,7 @@ proc source-sh-di {shell script args} {
23632370
}
23642371
23652372
# get name of current module unload Tcl interp
2366-
set itrp __modfile_[currentState mode]_[depthState modulename]
2373+
set itrp [getCurrentModfileInterpName]
23672374
23682375
# evaluate each recorded command in display Tcl interp to get them printed
23692376
foreach modcmd $modcontent {

0 commit comments

Comments
 (0)