Page 1 of 1

Function source code

PostPosted: Sun Nov 17, 2019 9:29 pm
by dimos19
Where can i find the function's implementation of calc Examp. countif() ?

Re: Function source code

PostPosted: Sun Nov 17, 2019 9:42 pm
by Zizi64
Do you want to modify the source code of the AOO or LO?

Or do you want call the COUNTIF function from a cell or from a macro code?

You can find the description of the function in the HELP of the AOO or LO.

COUNTIF.png

Re: Function source code

PostPosted: Sun Nov 17, 2019 10:26 pm
by dimos19
I want to see all the code of the function. The loops ,while, and the variables.

Re: Function source code

PostPosted: Sun Nov 17, 2019 10:29 pm
by RoryOF
Then you will have to investigate the OpenOffice source code at
http://www.apache.org/dyn/aoo-closer.cgi/openoffice/

Re: Function source code

PostPosted: Mon Nov 18, 2019 12:42 am
by robleyd
Or download the source in several formats from https://openoffice.apache.org/downloads.html

Re: Function source code

PostPosted: Tue Nov 19, 2019 9:37 pm
by dimos19
I have downloaded the code of openoffice site and i want to ask how can i see the code inside of the files. How can i open these files?

Re: Function source code

PostPosted: Tue Nov 19, 2019 9:41 pm
by dimos19
ok! i managed to open it with notepad.
Thanks a lot!

Re: Function source code

PostPosted: Tue Nov 19, 2019 9:43 pm
by RoryOF
All the source files should open with a plain text editor.

It may be that there are specialised IDEs (Integrated Development Environments) for C++ which will also open the files. Which of these you find and choose is up to you.

Re: Function source code

PostPosted: Tue Nov 19, 2019 9:45 pm
by Zizi64
Sorry, we are not developers of the AOO/LO).
I never tried to browse the source code of the LibreOffice... I do not know where the code of the Calc functions are located.

Re: Function source code

PostPosted: Tue Nov 19, 2019 10:42 pm
by Zizi64
If you want to write your own routines and functions, here isa possible solution (written in StarBasic) for your example task (COUNTIF()):

Code: Select all   Expand viewCollapse view
REM  *****  BASIC  *****
Option explicit

Function MyCountif(TheRange as variant, TheCondition as Variant) as long

Dim Counter as long
Dim ArrayValue as Variant

   Counter = 0
   If isarray(TheRange) then
      For each ArrayValue in TheRange
         If ArrayValue = TheCondition then Counter = Counter + 1
      next ArrayValue
   else
      If TheRange = TheCondition then Counter = Counter + 1
   end if
   
MyCountif = Counter
End function


Note: the 5 (string) and the 5 (integer) are not equal.