tdf124710 convert Calc functions IFS and SWITCH to jump functions

Winfried Donkers winfried.libreoffice at gmail.com
Tue May 7 14:09:01 UTC 2019


Hi Eike, all,

I have been concentrating on converting IFS functions to their 
equivalent with nested IF functions, e.g. IFS(b1;r1;b2;r2) to 
IF(b1;r1;IF(b2;r2;#NA)).

I now think I know where to insert ocIf tokens in the IFS-function 
string when looking at FormulaCompiler::Factor(), but I don't know how 
to insert a FormulaTokenRef in the code and not destroy the stack, jump 
array or other at the same time.

For some time thought that FormulaTokenArray::RewriteMissing(...) might 
be a better and easier place, but this function is only called after 
ScInterpreter::Interpret(), so that has no use.


Do you have any suggestions where and how I might try to insert these 
extra ocIf, ocSep and #NA tokens (and replace ocIfs with ocIf).

With ocSwitch I also must be able to copy (the result of) the first 
argument on top of the stack before the next ocIf is executed. The 
equivalent in those case would be SWITCH(x;b1;r1;b2;r2) converted to 
IF(x=b1;r1;IF(x=b2;r2;#NA)).

Winfried

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice/attachments/20190507/9567d921/attachment.html>


More information about the LibreOffice mailing list