Re: Accessing code for Calc functions
Hi Steve, On 26.11.2019 17:15, Steve Fanning wrote: I am currently working as a member of the Documentation Team, updating Chapter 18 of the Calc Guide (Description of Functions). From time to time during this task, I would benefit from viewing the code that implements individual functions but have not been able to find that code. Could somebody give me some hints please? The code of most Calc functions is in sc/source/core/tool/interpr#.cxx, with # ranging from 1 to 8. In sc/source/core/tool/interpr4.cxx is a function ScInterpreter::Interpret() with a large switch statement which handles the function calls. E.g. 'case ocSum : ScSum(); break;' shows that the SUM function is ScSum, which git grep (or opengrok) tells you is in sc/source/core/tool/interpr6.cxx. Some functions belong to a group 'Add-in functions' and are essentially functions that Excel had as a special package. These are handled quite differently and in scaddins/source/analysis and scaddins/source/financial. HTH, Winfried ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice
Re[2]: Accessing code for Calc functions
Mike, Many thanks for that useful information. Regards, Steve -- Original Message -- From: "Kaganski Mike" To: "Steve Fanning" ; "libreoffice@lists.freedesktop.org" Sent: 26/11/2019 14:37:43 Subject: Re: Accessing code for Calc functions Hi Steve, On 26.11.2019 17:15, Steve Fanning wrote: I am currently working as a member of the Documentation Team, updating Chapter 18 of the Calc Guide (Description of Functions). From time to time during this task, I would benefit from viewing the code that implements individual functions but have not been able to find that code. Could somebody give me some hints please? E.g., given the function CHITEST [1]: 1. I git grep for the function's name: https://opengrok.libreoffice.org/search?project=core&full=CHITEST 2. I see opcode, like "{ "CHITEST" , SC_OPCODE_CHI_TEST },", and grep for the opcode: https://opengrok.libreoffice.org/search?project=core&full=SC_OPCODE_CHI_TEST 3. I see "ocChiTest = SC_OPCODE_CHI_TEST," in opcode.hxx, and grep gain for it: https://opengrok.libreoffice.org/search?project=core&full=ocChiTest 4. In an interprN.cxx, I see "case ocChiTest :", and go there to see the name of function called when that opcode arrives: https://opengrok.libreoffice.org/xref/core/sc/source/core/tool/interpr4.cxx?r=0ef5c475#4392 5. So I see the function name is ScChiTest: https://opengrok.libreoffice.org/xref/core/sc/source/core/tool/interpr3.cxx?r=f853ec31#2797 This is possibly too long, but that's from the PoV of not knowing where to look initially. Of course, you could also try shortcut searching for ScFoo when looking for FOO function... (not always helpful). Anyway, this shows the relevant pieces. It would also help if I could view the code for the Function Wizard. For any dialog, you look into its English UI, and grep for the strings in it (choose specific enough): https://opengrok.libreoffice.org/search?project=core&full=%22Function+result%22 Find the .ui file, and then grep for its name in .cxx files - you will find the constructor creating the dialog or one of its tabs: https://opengrok.libreoffice.org/search?project=core&full=%22formuladialog.ui%22 So likely you need to look in formula/source/ui/dlg/formula.cxx That's how I do that. HTH. [1] https://help.libreoffice.org/latest/en-US/text/scalc/01/04060181.html?DbPAR=CALC#bm_id3154260 -- Best regards, Mike Kaganski ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice
Re: Accessing code for Calc functions
Hi Steve, On 26.11.2019 17:15, Steve Fanning wrote: > I am currently working as a member of the Documentation Team, updating > Chapter 18 of the Calc Guide (Description of Functions). From time to > time during this task, I would benefit from viewing the code that > implements individual functions but have not been able to find that > code. Could somebody give me some hints please? E.g., given the function CHITEST [1]: 1. I git grep for the function's name: https://opengrok.libreoffice.org/search?project=core&full=CHITEST 2. I see opcode, like "{ "CHITEST" , SC_OPCODE_CHI_TEST },", and grep for the opcode: https://opengrok.libreoffice.org/search?project=core&full=SC_OPCODE_CHI_TEST 3. I see "ocChiTest = SC_OPCODE_CHI_TEST," in opcode.hxx, and grep gain for it: https://opengrok.libreoffice.org/search?project=core&full=ocChiTest 4. In an interprN.cxx, I see "case ocChiTest :", and go there to see the name of function called when that opcode arrives: https://opengrok.libreoffice.org/xref/core/sc/source/core/tool/interpr4.cxx?r=0ef5c475#4392 5. So I see the function name is ScChiTest: https://opengrok.libreoffice.org/xref/core/sc/source/core/tool/interpr3.cxx?r=f853ec31#2797 This is possibly too long, but that's from the PoV of not knowing where to look initially. Of course, you could also try shortcut searching for ScFoo when looking for FOO function... (not always helpful). Anyway, this shows the relevant pieces. > It would also help if I could view the code for the Function Wizard. For any dialog, you look into its English UI, and grep for the strings in it (choose specific enough): https://opengrok.libreoffice.org/search?project=core&full=%22Function+result%22 Find the .ui file, and then grep for its name in .cxx files - you will find the constructor creating the dialog or one of its tabs: https://opengrok.libreoffice.org/search?project=core&full=%22formuladialog.ui%22 So likely you need to look in formula/source/ui/dlg/formula.cxx That's how I do that. HTH. [1] https://help.libreoffice.org/latest/en-US/text/scalc/01/04060181.html?DbPAR=CALC#bm_id3154260 -- Best regards, Mike Kaganski ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice
Accessing code for Calc functions
All, My apologies if this is a daft question but I need some guidance! I’ve done plenty of software development in the past but don’t know my way around the LO code. I am currently working as a member of the Documentation Team, updating Chapter 18 of the Calc Guide (Description of Functions). From time to time during this task, I would benefit from viewing the code that implements individual functions but have not been able to find that code. Could somebody give me some hints please? If you could just pick any function and tell me how best to locate the source file, that would be great. I've already downloaded a copy of the latest sources. It would also help if I could view the code for the Function Wizard. Thanks in advance. Regards, Steve Fanning ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice