Date: prev next · Thread: first prev next last
2015 Archives by date, by thread · List index


Hi Winfried,

On Thursday, 2015-09-17 12:07:59 +0200, Winfried Donkers wrote:

I want to change the opcode from ocIsoWeeknum to ocWeek when it is an ODF-document and when the 
number of arguments is 2. 
I currently tried formula/source/core/api/token.cxx because there I can get type (ODF), opcode 
and argument count. But I can't change the opcode. I tried the dirty FormulaToken;;NewOpCode(), 
but encounter problems with the const PrivateAccess& argument.

As the comment says "only the compiler should use it" and that's why the
PrivateAccess parameter is there ;-) Modifying the OpCode within the
token array could have nasty side effects. It *might* be ok in this
case, but..

The proper place to use that if the formula string is already compiled
is in the RPN code generation
formula/source/core/api/FormulaCompiler.cxx FormulaCompiler::Factor()
where in line 1177 there's also an example of the NewOpCode() usage

    pFacToken->NewOpCode( ocUnion, FormulaToken::PrivateAccess());

In the long else{} branch there's

    else if ((SC_OPCODE_START_2_PAR <= eOp && eOp < SC_OPCODE_STOP_2_PAR)
        ...

and there at the end a pFacToken->SetByte( nSepCount ); followed by a
PutCode( pFacToken );
Before the PutCode(), when compiling ODFF and the pFacToken's OpCode is
ocIsoWeeknum and nSepCount==2 (actually nSepCount is the argument count)
you could do
    pFacToken->NewOpCode( ocWeek, FormulaToken::PrivateAccess());

All untried..

Hope that helps

  Eike

-- 
LibreOffice Calc developer. Number formatter stricken i18n transpositionizer.
GPG key "ID" 0x65632D3A - 2265 D7F3 A7B0 95CC 3918  630B 6A6C D5B7 6563 2D3A
Better use 64-bit 0x6A6CD5B765632D3A here is why: https://evil32.com/
Care about Free Software, support the FSFE https://fsfe.org/support/?erack

Attachment: signature.asc
Description: PGP signature


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.