On Sat, 28 Jan 2017, Riccardo (Jack) Lucchetti wrote:
On Sat, 28 Jan 2017, Marcin Błażejowski wrote:
> Or can I do something like "eval set omp_num_threads" [of course not in
> the current sence of eval] to get string "omp_num_threads: positive
> integer, currently 4" which I could parse next?
This is a bit baroque, but seems to work:
<hansl>
set echo off
set messages off
function scalar ompthds(void)
scalar ret
outfile s --buffer --quiet
set omp_num_threads
outfile --close
l = strlen(s)
c = ""
loop while c != " " --quiet
c = substr(s, l, l)
l--
endloop
sscanf(s+l, " %d", ret)
return ret
end function
n = ompthds()
printf "As of now, %d\n", n
</hansl>
Slightly less baroque:
<hansl>
function scalar ompthds(void)
scalar ret
outfile s --buffer --quiet
set omp_num_threads
outfile --close
sscanf(strstr(s, ",") + 1, "%*s %d", ret)
return ret
end function
</hansl>
Allin