In Tcl, square brackets indicate "evaluate the code between the square brackets". The result of that evaluation is substituted for the entire square-bracketed expression. So, the first line invokes the function true_test_sfm
with a single argument $run_dir
; the result of that function call is then assigned to the variable rtn
. Unfortunately, true_test_sfm
is not a built-in Tcl function, which means it's user-defined, which means there's no way we can tell you what the effect of that function call will be based on the information you've provided here.
glob
is a built-in Tcl function which takes a file pattern as an argument and then lists files that match that pattern. For example, if a directory contains files "foo", "bar" and "baz", glob b*
would return a list of two files, "bar" and "baz". Therefore the second line is looking for any files that match the pattern given by $run_dir
, then using the cd
command (another Tcl built-in) to change to the directory found by glob
. Probably $run_dir
is not actually a file pattern, but an explicit file name (ie, no globbing characters like * or ? in the string), otherwise this code may break unexpectedly. On Windows, some combination of FindFirstFile
/FindNextFile
in C++ could be used as a substitute for glob
in Tcl, and SetCurrentDirectory
could substitute for cd
.
pwd
is another built-in Tcl function which returns the process current working directory as an absolute path. So the last line is querying the current working directory and saving the result in a variable named pwd
. Here you could use GetCurrentDirectory
as a substitute for pwd
.