Re: [sc-dev] Add a new Calc spreadsheet function

2010-08-13 Thread Eike Rathke
Hi Marina,

On Thursday, 2010-08-12 15:13:24 +0200, Marina Plakalovic wrote:

 Working with ranges inside the functions is not the issue, but registering
 function is.

I'm not sure I understand what you mean with registering. Are you
referring to parclass.cxx?

 I followed steps described in
 http://wiki.services.openoffice.org/wiki/Calc/Implementation/Spreadsheet_Functions,
 and it seems that some additional changes must be made for functions that
 take range as a parameter.

I just added some details to
http://wiki.services.openoffice.org/wiki/Calc/Implementation/Spreadsheet_Functions#The_not_so_easy_case_of_non-scalar_arguments
and hope that helps. If not, please ask your questions ;-)

  Eike

-- 
 OOo Calc core developer. Number formatter stricken i18n transpositionizer.
 Signature key 0x87F8D412 : 2F58 5236 DB02 F335 8304  7D6C 65C9 F9B5 87F8 D412
 OpenOffice.org Engineering at Oracle: http://blogs.sun.com/GullFOSS
 --
 Please don't send mail to the old e...@sun.com account that I used for mailing
 lists, it phased out. Use eike.rat...@oracle.com instead. Thanks.


pgpK3g0Ufjxfh.pgp
Description: PGP signature


Re: [sc-dev] Add a new Calc spreadsheet function

2010-08-12 Thread Eike Rathke
Hi Marina,

On Monday, 2010-08-09 15:21:39 +0200, Marina Plakalovic wrote:

 I have added new function by following the tutorial:
 http://wiki.services.openoffice.org/wiki/Calc/Implementation/Spreadsheet_Functions
 
 This works fine when the arguments of the function are scalar, but if I want
 to pass the range of values to the function, additional steps are needed.

You need to differentiate according to the data type that is on the
stack, e.g. svDoubleRef for a range reference. See for example
ScInterpreter::ScMax() how that is handled in a simple case. For your
implementation also ScInterpreter::ScCountIf() and
ScInterpreter::ScSumIf() may be of interest.

  Eike

-- 
 OOo Calc core developer. Number formatter stricken i18n transpositionizer.
 Signature key 0x87F8D412 : 2F58 5236 DB02 F335 8304  7D6C 65C9 F9B5 87F8 D412
 OpenOffice.org Engineering at Oracle: http://blogs.sun.com/GullFOSS
 --
 Please don't send mail to the old e...@sun.com account that I used for mailing
 lists, it phased out. Use eike.rat...@oracle.com instead. Thanks.


pgpFNaaUSjveN.pgp
Description: PGP signature


Re: [sc-dev] Add a new Calc spreadsheet function

2010-08-12 Thread Marina Plakalovic
Hi Eike,

Working with ranges inside the functions is not the issue, but registering
function is. I followed steps described in
http://wiki.services.openoffice.org/wiki/Calc/Implementation/Spreadsheet_Functions,
and it seems that some additional changes must be made for functions that
take range as a parameter.

Thanks,
Marina


2010/8/12 Eike Rathke eike.rat...@oracle.com

 Hi Marina,

 On Monday, 2010-08-09 15:21:39 +0200, Marina Plakalovic wrote:

  I have added new function by following the tutorial:
 
 http://wiki.services.openoffice.org/wiki/Calc/Implementation/Spreadsheet_Functions
 
  This works fine when the arguments of the function are scalar, but if I
 want
  to pass the range of values to the function, additional steps are needed.

 You need to differentiate according to the data type that is on the
 stack, e.g. svDoubleRef for a range reference. See for example
 ScInterpreter::ScMax() how that is handled in a simple case. For your
 implementation also ScInterpreter::ScCountIf() and
 ScInterpreter::ScSumIf() may be of interest.

  Eike

 --
  OOo Calc core developer. Number formatter stricken i18n transpositionizer.
  Signature key 0x87F8D412 : 2F58 5236 DB02 F335 8304  7D6C 65C9 F9B5 87F8
 D412
  OpenOffice.org Engineering at Oracle: http://blogs.sun.com/GullFOSS
  --
  Please don't send mail to the old e...@sun.com account that I used for
 mailing
  lists, it phased out. Use eike.rat...@oracle.com instead. Thanks.