On Sat, 28 Jan 2017, Allin Cottrell wrote:
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>
Well, I had thought of something like that too, but couldn't be bothered
to check all the po files if that would be robust to translations, so I
just assumed the number would come last.
-------------------------------------------------------
Riccardo (Jack) Lucchetti
Dipartimento di Scienze Economiche e Sociali (DiSES)
Università Politecnica delle Marche
(formerly known as Università di Ancona)
r.lucchetti(a)univpm.it
http://www2.econ.univpm.it/servizi/hpp/lucchetti
-------------------------------------------------------