[Scilab-Dev] How to list every variables inside the SciLab stack ?

Serge Steer Serge.Steer at inria.fr
Sat May 23 09:02:25 CEST 2009


Vincent Lejeune a écrit :
> Hi,
>  
> I was wondering if there was a way to list the content of the stack,
> in C, ie functions like "get_from_stack" and "get_next_from_stack" or
> something like that.
> When I have a memory error from the GPU side, I'd like to have a look
> at every pointer from the stack. I would have a custom stack of my
> own, containing every pointer holding a reference to a matrix in GPU
> memory. To be able to look in the stack would allow me to free
> unecessary matrix that eat space on the GPU.
Hello

I think there is no  C function available to do so, but it is quite easy
to write:

The varaiable names are stored in the integer array named idstk located
in the C structure named C2F(vstk) . If k is the variable index the name
is stored in C2F(vstk).idstk[k * nsiz]) to C2F(vstk).idstk[(k+1) *
nsiz-1]) where nsiz=6;
in a coded way. To decode it on can use the C2F(cvname) function:
 C2F(cvname)(C2F(vstk).idstk[k * nsiz]) ,str,(int job=1,&job))
The valid values for the index k are in the interval
[C2F(vstk).bot-1,C2F(vstk).isiz-1] for the regular variables and in
[C2F(vstk).gtop-1,C2F(vstk).gbot-1] for the global ones.

Regards,
Serge Steer



More information about the dev mailing list