[Libreoffice-commits] core.git: formula/source include/formula sc/inc sc/qa sc/source

Winfried Donkers winfrieddonkers at libreoffice.org
Fri Apr 11 06:43:47 PDT 2014


 formula/source/core/resource/core_resource.src |   14 +++++++
 include/formula/compiler.hrc                   |    4 +-
 include/formula/opcode.hxx                     |    2 +
 sc/inc/helpids.h                               |    2 +
 sc/qa/unit/subsequent_filters-test.cxx         |    4 +-
 sc/qa/unit/ucalc.cxx                           |    2 +
 sc/source/core/inc/interpre.hxx                |    2 +
 sc/source/core/tool/interpr4.cxx               |    2 +
 sc/source/core/tool/interpr7.cxx               |   20 ++++++++++
 sc/source/filter/excel/xlformula.cxx           |    2 +
 sc/source/filter/oox/formulabase.cxx           |    2 +
 sc/source/ui/src/scfuncs.src                   |   46 +++++++++++++++++++++++++
 12 files changed, 99 insertions(+), 3 deletions(-)

New commits:
commit 56deaabb32346e0cc9c6946d7d53ba251f4450b2
Author: Winfried Donkers <winfrieddonkers at libreoffice.org>
Date:   Fri Apr 11 09:46:51 2014 +0200

    fdo#73149 add Excel 2010 functions ERF.PRECISE and ERFC.PRECISE
    
    Change-Id: I3199470ec92923e8cc12156f21dd397d870cc1e0
    Reviewed-on: https://gerrit.libreoffice.org/8930
    Reviewed-by: Eike Rathke <erack at redhat.com>
    Tested-by: Eike Rathke <erack at redhat.com>

diff --git a/formula/source/core/resource/core_resource.src b/formula/source/core/resource/core_resource.src
index 4f5b91d..90544a4 100644
--- a/formula/source/core/resource/core_resource.src
+++ b/formula/source/core/resource/core_resource.src
@@ -422,6 +422,8 @@ Resource RID_STRLIST_FUNCTION_NAMES_ENGLISH_ODFF
     /* END defined ERROR.TYPE() values. */
     String SC_OPCODE_FILTERXML     { Text = "COM.MICROSOFT.FILTERXML";};
     String SC_OPCODE_WEBSERVICE    { Text = "COM.MICROSOFT.WEBSERVICE"; };
+    String SC_OPCODE_ERF_MS { Text = "COM.MICROSOFT.ERF.PRECISE" ; };
+    String SC_OPCODE_ERFC_MS { Text = "COM.MICROSOFT.ERFC.PRECISE" ; };
 };
 
 /** These function names are used only in the XLSX import. */
@@ -825,6 +827,8 @@ Resource RID_STRLIST_FUNCTION_NAMES_ENGLISH_OOXML
     /* END defined ERROR.TYPE() values. */
     String SC_OPCODE_FILTERXML     { Text = "_xlfn.FILTERXML";};
     String SC_OPCODE_WEBSERVICE    { Text = "_xlfn.WEBSERVICE"; };
+    String SC_OPCODE_ERF_MS { Text = "_xlfn.ERF.PRECISE" ; };
+    String SC_OPCODE_ERFC_MS { Text = "_xlfn.ERFC.PRECISE" ; };
 };
 
 // DO NOT CHANGE NAMES! Only add functions.
@@ -1230,6 +1234,8 @@ Resource RID_STRLIST_FUNCTION_NAMES_ENGLISH
     /* END defined ERROR.TYPE() values. */
     String SC_OPCODE_FILTERXML     { Text = "FILTERXML";};
     String SC_OPCODE_WEBSERVICE    { Text = "WEBSERVICE"; };
+    String SC_OPCODE_ERF_MS { Text = "ERF.PRECISE" ; };
+    String SC_OPCODE_ERFC_MS { Text = "ERFC.PRECISE" ; };
 };
 
 Resource RID_STRLIST_FUNCTION_NAMES
@@ -2758,6 +2764,14 @@ Resource RID_STRLIST_FUNCTION_NAMES
     {
         Text [ en-US ] = "WEBSERVICE";
     };
+    String SC_OPCODE_ERF_MS
+    {
+        Text [en-US ] = "ERF.PRECISE" ;
+    };
+    String SC_OPCODE_ERFC_MS
+    {
+        Text [en-US ] = "ERFC.PRECISE" ;
+    };
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/formula/compiler.hrc b/include/formula/compiler.hrc
index 47d22aa..96ea885 100644
--- a/include/formula/compiler.hrc
+++ b/include/formula/compiler.hrc
@@ -192,7 +192,9 @@
 #define SC_OPCODE_UNICHAR           160
 #define SC_OPCODE_GAMMA             161
 #define SC_OPCODE_GAMMA_LN_MS       162
-#define SC_OPCODE_STOP_1_PAR        163
+#define SC_OPCODE_ERF_MS            163
+#define SC_OPCODE_ERFC_MS           164
+#define SC_OPCODE_STOP_1_PAR        165
 
 /*** Functions with more than one parameters ***/
 #define SC_OPCODE_START_2_PAR       201
diff --git a/include/formula/opcode.hxx b/include/formula/opcode.hxx
index 4239c53..f5afa19 100644
--- a/include/formula/opcode.hxx
+++ b/include/formula/opcode.hxx
@@ -460,6 +460,8 @@ enum OpCodeEnum
         ocEuroConvert       = SC_OPCODE_EUROCONVERT,
         ocFilterXML         = SC_OPCODE_FILTERXML,
         ocWebservice        = SC_OPCODE_WEBSERVICE,
+        ocErf_MS            = SC_OPCODE_ERF_MS,
+        ocErfc_MS           = SC_OPCODE_ERFC_MS,
     // internal stuff
         ocInternalBegin     = SC_OPCODE_INTERNAL_BEGIN,
         ocTTT               = SC_OPCODE_TTT,
diff --git a/sc/inc/helpids.h b/sc/inc/helpids.h
index 2aa8e60..2f73f3f 100644
--- a/sc/inc/helpids.h
+++ b/sc/inc/helpids.h
@@ -704,5 +704,7 @@
 #define HID_FUNC_FLOOR_MS                                       "SC_HID_FUNC_FLOOR_MS"
 #define HID_FUNC_NETWORKDAYS_MS                                 "SC_HID_FUNC_NETWORKDAYS_MS"
 #define HID_FUNC_WORKDAY_MS                                     "SC_HID_FUNC_WORKDAY_MS"
+#define HID_FUNC_ERF_MS                                         "SC_HID_FUNC_EFR_MS"
+#define HID_FUNC_ERFC_MS                                        "SC_HID_FUNC_ERFC_MS"
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx
index 86699888..4411d32 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -450,8 +450,8 @@ void ScFiltersTest::testFunctionsExcel2010()
         { 17, true  },
         { 18, true  },
         { 19, true  },
-        { 20, false },
-        { 21, false },
+        { 20, true  },
+        { 21, true  },
         { 22, true  },
         { 23, true  },
         { 24, true  },
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 6ee5a4e..09b3880 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -2577,6 +2577,8 @@ void Test::testFunctionLists()
         "COVARIANCE.S",
         "CRITBINOM",
         "DEVSQ",
+        "ERF.PRECISE",
+        "ERFC.PRECISE",
         "EXPON.DIST",
         "EXPONDIST",
         "F.DIST",
diff --git a/sc/source/core/inc/interpre.hxx b/sc/source/core/inc/interpre.hxx
index 7f2eb64..e604e67a 100644
--- a/sc/source/core/inc/interpre.hxx
+++ b/sc/source/core/inc/interpre.hxx
@@ -832,6 +832,8 @@ void ScMidB();
 
 void ScFilterXML();
 void ScWebservice();
+void ScErf();
+void ScErfc();
 
 static const double fMaxGammaArgument;
 
diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index f2ff1d6..038c649 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -4086,6 +4086,8 @@ StackVar ScInterpreter::Interpret()
                 case ocZins             : ScZins();                     break;
                 case ocFilterXML        : ScFilterXML();                break;
                 case ocWebservice       : ScWebservice();               break;
+                case ocErf_MS           : ScErf();                      break;
+                case ocErfc_MS          : ScErfc();                     break;
                 case ocZinsZ            : ScZinsZ();                    break;
                 case ocKapz             : ScKapz();                     break;
                 case ocKumZinsZ         : ScKumZinsZ();                 break;
diff --git a/sc/source/core/tool/interpr7.cxx b/sc/source/core/tool/interpr7.cxx
index a683f15..5a266f2 100644
--- a/sc/source/core/tool/interpr7.cxx
+++ b/sc/source/core/tool/interpr7.cxx
@@ -265,4 +265,24 @@ void ScInterpreter::ScDebugVar()
         PushIllegalParameter();
 }
 
+void ScInterpreter::ScErf()
+{
+    sal_uInt8 nParamCount = GetByte();
+    if (MustHaveParamCount( nParamCount, 1 ) )
+    {
+        double x = GetDouble();
+        PushDouble( ::rtl::math::erf( x ) );
+    }
+}
+
+void ScInterpreter::ScErfc()
+{
+    sal_uInt8 nParamCount = GetByte();
+    if (MustHaveParamCount( nParamCount, 1 ) )
+    {
+        double x = GetDouble();
+        PushDouble( ::rtl::math::erfc( x ) );
+    }
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/filter/excel/xlformula.cxx b/sc/source/filter/excel/xlformula.cxx
index b15cb42..9e20985 100644
--- a/sc/source/filter/excel/xlformula.cxx
+++ b/sc/source/filter/excel/xlformula.cxx
@@ -490,6 +490,8 @@ static const XclFunctionInfo saFuncTable_2010[] =
     EXC_FUNCENTRY_V_VR( ocZTest_MS,         2,  3,  0,  "Z.TEST" ),
     EXC_FUNCENTRY_V_VR( ocCeil_MS,          2,  2,  0,  "CEILING.PRECISE" ),
     EXC_FUNCENTRY_V_VR( ocFloor_MS,         2,  2,  0,  "FLOOR.PRECISE" ),
+    EXC_FUNCENTRY_V_VR( ocErf_MS,           1,  1,  0,  "ERF.PRECISE" ),
+    EXC_FUNCENTRY_V_VR( ocErfc_MS,          1,  1,  0,  "ERFC.PRECISE" ),
 };
 
 /** Functions new in Excel 2013.
diff --git a/sc/source/filter/oox/formulabase.cxx b/sc/source/filter/oox/formulabase.cxx
index 64270d2..bb38d62 100644
--- a/sc/source/filter/oox/formulabase.cxx
+++ b/sc/source/filter/oox/formulabase.cxx
@@ -801,6 +801,8 @@ static const FunctionData saFuncTable2010[] =
     { "COM.MICROSOFT.Z.TEST",                 "Z.TEST",              NOID,   NOID,    2,  3,  V, { RX, VR }, FUNCFLAG_MACROCALL_NEW },
     { "COM.MICROSOFT.CEILING.PRECISE",        "CEILING.PRECISE",     NOID,   NOID,    2,  2,  V, { VR }, FUNCFLAG_MACROCALL_NEW },
     { "COM.MICROSOFT.FLOOR.PRECISE",          "FLOOR.PRECISE",       NOID,   NOID,    2,  2,  V, { VR }, FUNCFLAG_MACROCALL_NEW },
+    { "COM.MICROSOFT.ERF.PRECISE",            "ERF.PRECISE",         NOID,   NOID,    1,  1,  V, { VR }, FUNCFLAG_MACROCALL_NEW },
+    { "COM.MICROSOFT.ERFC.PRECISE",           "ERFC.PRECISE",        NOID,   NOID,    1,  1,  V, { VR }, FUNCFLAG_MACROCALL_NEW },
 };
 
 /** Functions new in Excel 2013.
diff --git a/sc/source/ui/src/scfuncs.src b/sc/source/ui/src/scfuncs.src
index 3e35e79..a248d72 100644
--- a/sc/source/ui/src/scfuncs.src
+++ b/sc/source/ui/src/scfuncs.src
@@ -11974,6 +11974,52 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS2
             Text [ en-US ] = "URI of the webservice";
         };
     };
+    Resource SC_OPCODE_ERF_MS
+    {
+        String 1 // Description
+        {
+            Text [ en-US] = "Returns the error function.";
+        };
+        ExtraData =
+        {
+            0;
+            ID_FUNCTION_GRP_STATISTIC;
+            U2S( HID_FUNC_ERF_MS );
+            1; 0;
+            0;
+        };
+        String 2 // Name of Parameter 1
+        {
+            Text [ en-US ] = "Lower Limit";
+        };
+        String 3 // Description of Parameter 1
+        {
+            Text [ en-US ] = "The lower limit for integration";
+        };
+    };
+    Resource SC_OPCODE_ERFC_MS
+    {
+        String 1 // Description
+        {
+            Text [ en-US] = "Returns the complementary error function.";
+        };
+        ExtraData =
+        {
+            0;
+            ID_FUNCTION_GRP_STATISTIC;
+            U2S( HID_FUNC_ERFC_MS );
+            1; 0;
+            0;
+        };
+        String 2 // Name of Parameter 1
+        {
+            Text [ en-US ] = "Lower Limit";
+        };
+        String 3 // Description of Parameter 1
+        {
+            Text [ en-US ] = "The lower limit for integration";
+        };
+    };
 };
 
 #if defined(U2S)


More information about the Libreoffice-commits mailing list