Re: Calling Func/Proc
- Posted by c.k.lester <euphoric at ckl?ster.com> Jul 11, 2007
- 639 views
CChris wrote: > > c.k.lester wrote: > > I would really like to have a function that returns the name of the > > calling func/proc. > The SymTab index of the callee is computed when calling a routine, but not > kept > (sub is a local var in the big switch routine in be_execute.c). It doesn't seem to me like you'd need to store anything extra. Doesn't the interpreter already know what routine called another routine? proc A calls +- proc B which calls +- proc C which calls +- proc D Is there a list kept like this by the interpreter? If so, then when I'm in proc D and want to know the parent, I just return parent_proc( current_proc ). > You could get a full image of the call stack by keeping a "sequence", which > doesn't exist in C, of indexes of called routines, and your routine would > query > the symtab image for routine names. I would be surprised if the interpreter couldn't already provide this information, quickly and easily.