converting Calc functions to jump functions
W.Donkers at dci-electronics.nl
Mon Jun 6 08:30:25 UTC 2016
> > And that is where I get stuck.
> I can imagine..
I wasn't surprised either ;-)
> > The first argument is on the stack, i.e. GetStackType() returns a type
> and ScInterpreter::sp is 1.
> > When I jump to the next argument to be evaluated, with aCode.Jump(
> pJump[ nIdx ], pJump[ pJump[ 0 ] ] ), ScInterpreter::sp is 0 afterwards.
> Apart from that, aCode.Jump( pJump[ nIdx ], pJump[ pJump[ 0 ] ] ) looks
> wrong to me, pJump returns an offset into the RPN array, which can't be
> used as an index for another pJump.
I changed the code in my mail, the actual line reads
aCode.Jump( pJump[ nIdx ], pJump[ nJumpCount ] );
and nJumpCount has the value of pJump[ 0 ].
> See also the description of formula::FormulaTokenIterator::Jump() in
> For understanding it helps to step into such Jump() and see what it does
> to the counters and on the subsequent iteration of the while loop in
> ScInterpreter::Interpret() step into its condition where aCode.Next() is
> executed and analyze what happens to the token array and counters.
> > How do I get the argument I jumped to (that part works) on the stack to
> be evaluated?
> I'm not sure at the moment.
> Basically both approaches would work, the latter might be even "easier"
> (I know it's not easy at all) to code with what is already implemented.
I will start digging and experimenting, which may take some time.
More information about the LibreOffice