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