[gnumeric] Auto-format: fix various functions' tagging.



commit 18f705264ca2352620f62502a73c2602f315a300
Author: Morten Welinder <terra gnome org>
Date:   Wed Nov 22 19:18:12 2017 -0500

    Auto-format: fix various functions' tagging.

 NEWS                                  |    1 +
 plugins/fn-christian-date/ChangeLog   |    6 ++++++
 plugins/fn-christian-date/functions.c |    9 +--------
 plugins/fn-date/ChangeLog             |    4 ++++
 plugins/fn-date/functions.c           |    2 +-
 plugins/fn-hebrew-date/ChangeLog      |    6 ++++++
 plugins/fn-hebrew-date/functions.c    |   18 +++++++++---------
 plugins/fn-logical/ChangeLog          |    5 +++++
 plugins/fn-logical/functions.c        |    6 ++++--
 plugins/fn-math/ChangeLog             |    5 +++++
 plugins/fn-math/functions.c           |   11 +++++++----
 plugins/fn-stat/ChangeLog             |    5 +++++
 plugins/fn-stat/functions.c           |   12 ++++++++----
 13 files changed, 62 insertions(+), 28 deletions(-)
---
diff --git a/NEWS b/NEWS
index a8f14fb..5ecd3fa 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,7 @@ Gnumeric 1.12.37
 
 Morten:
        * Test suite improvements.
+       * Improve format guessing for newly entered formulas.
 
 --------------------------------------------------------------------------
 Gnumeric 1.12.36
diff --git a/plugins/fn-christian-date/ChangeLog b/plugins/fn-christian-date/ChangeLog
index f12e6d2..af1a201 100644
--- a/plugins/fn-christian-date/ChangeLog
+++ b/plugins/fn-christian-date/ChangeLog
@@ -1,3 +1,9 @@
+2017-11-22  Morten Welinder  <terra gnome org>
+
+       * functions.c (make_date): Eliminate.  auto-format already give
+       the cells a date format, so no need to tag a specific date format
+       onto the value.
+
 2017-11-18  Morten Welinder <terra gnome org>
 
        * Release 1.12.36
diff --git a/plugins/fn-christian-date/functions.c b/plugins/fn-christian-date/functions.c
index 73ce8a1..8df9376 100644
--- a/plugins/fn-christian-date/functions.c
+++ b/plugins/fn-christian-date/functions.c
@@ -42,13 +42,6 @@ GNM_PLUGIN_MODULE_HEADER;
 
 #define DATE_CONV(ep)          workbook_date_conv ((ep)->sheet->workbook)
 
-static GnmValue *
-make_date (GnmValue *res)
-{
-       value_set_fmt (res, go_format_default_date ());
-       return res;
-}
-
 static void
 eastersunday_calc_for_year (int year, GDate *date)
 {
@@ -130,7 +123,7 @@ eastersunday_calc (GnmValue const *val, GnmFuncEvalInfo *ei, int diff)
                serial--;
        }
 
-       return make_date (value_new_int (serial));
+       return value_new_int (serial);
 }
 
 /***************************************************************************/
diff --git a/plugins/fn-date/ChangeLog b/plugins/fn-date/ChangeLog
index 0e81d1e..ed24e1e 100644
--- a/plugins/fn-date/ChangeLog
+++ b/plugins/fn-date/ChangeLog
@@ -1,3 +1,7 @@
+2017-11-22  Morten Welinder  <terra gnome org>
+
+       * functions.c (gnumeric_time): Don't format this as a date.
+
 2017-11-18  Morten Welinder <terra gnome org>
 
        * Release 1.12.36
diff --git a/plugins/fn-date/functions.c b/plugins/fn-date/functions.c
index c5ae148..eefbd39 100644
--- a/plugins/fn-date/functions.c
+++ b/plugins/fn-date/functions.c
@@ -448,7 +448,7 @@ gnumeric_time (GnmFuncEvalInfo *ei, GnmValue const * const *argv)
        time = (hours * 3600 + minutes * 60 + seconds) / DAY_SECONDS;
        time -= gnm_fake_floor (time);
 
-       return make_date (value_new_float (time));
+       return value_new_float (time);
 }
 
 /***************************************************************************/
diff --git a/plugins/fn-hebrew-date/ChangeLog b/plugins/fn-hebrew-date/ChangeLog
index b98dd10..58fa6bd 100644
--- a/plugins/fn-hebrew-date/ChangeLog
+++ b/plugins/fn-hebrew-date/ChangeLog
@@ -1,3 +1,9 @@
+2017-11-22  Morten Welinder  <terra gnome org>
+
+       * functions.c (hebrew_datetime_functions): Adjust function
+       attributes.  These are all volatile because, for no good reason,
+       they default to current date.
+
 2017-11-18  Morten Welinder <terra gnome org>
 
        * Release 1.12.36
diff --git a/plugins/fn-hebrew-date/functions.c b/plugins/fn-hebrew-date/functions.c
index e34e72c..92c3181 100644
--- a/plugins/fn-hebrew-date/functions.c
+++ b/plugins/fn-hebrew-date/functions.c
@@ -366,47 +366,47 @@ gnumeric_date2julian (GnmFuncEvalInfo * ei, GnmValue const * const *argv)
 GnmFuncDescriptor const hebrew_datetime_functions[] = {
        {"hdate", "|fff", help_hdate,
         gnumeric_hdate, NULL, NULL, NULL,
-        GNM_FUNC_SIMPLE + GNM_FUNC_AUTO_UNITLESS,
+        GNM_FUNC_SIMPLE + GNM_FUNC_VOLATILE,
         GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC,
         GNM_FUNC_TEST_STATUS_NO_TESTSUITE},
        {"hdate_heb", "|fff", help_hdate_heb,
         gnumeric_hdate_heb, NULL, NULL, NULL,
-        GNM_FUNC_SIMPLE + GNM_FUNC_AUTO_UNITLESS,
+        GNM_FUNC_SIMPLE + GNM_FUNC_VOLATILE,
         GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC,
         GNM_FUNC_TEST_STATUS_NO_TESTSUITE},
         {"hdate_day", "|fff", help_hdate_day,
         gnumeric_hdate_day, NULL, NULL, NULL,
-        GNM_FUNC_SIMPLE + GNM_FUNC_AUTO_UNITLESS,
+        GNM_FUNC_SIMPLE + GNM_FUNC_VOLATILE + GNM_FUNC_AUTO_UNITLESS,
         GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC,
         GNM_FUNC_TEST_STATUS_NO_TESTSUITE},
         {"hdate_month", "|fff", help_hdate_month,
         gnumeric_hdate_month, NULL, NULL, NULL,
-        GNM_FUNC_SIMPLE + GNM_FUNC_AUTO_UNITLESS,
+        GNM_FUNC_SIMPLE + GNM_FUNC_VOLATILE + GNM_FUNC_AUTO_UNITLESS,
         GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC,
         GNM_FUNC_TEST_STATUS_NO_TESTSUITE},
         {"hdate_year", "|fff", help_hdate_year,
         gnumeric_hdate_year, NULL, NULL, NULL,
-        GNM_FUNC_SIMPLE + GNM_FUNC_AUTO_UNITLESS,
+        GNM_FUNC_SIMPLE + GNM_FUNC_VOLATILE + GNM_FUNC_AUTO_UNITLESS,
         GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC,
         GNM_FUNC_TEST_STATUS_NO_TESTSUITE},
         {"hdate_julian", "|fff", help_hdate_julian,
         gnumeric_hdate_julian, NULL, NULL, NULL,
-        GNM_FUNC_SIMPLE + GNM_FUNC_AUTO_UNITLESS,
+        GNM_FUNC_SIMPLE + GNM_FUNC_VOLATILE + GNM_FUNC_AUTO_UNITLESS,
         GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC,
         GNM_FUNC_TEST_STATUS_NO_TESTSUITE},
         {"date2hdate", "|f", help_date2hdate,
         gnumeric_date2hdate, NULL, NULL, NULL,
-        GNM_FUNC_SIMPLE + GNM_FUNC_AUTO_UNITLESS,
+        GNM_FUNC_SIMPLE + GNM_FUNC_VOLATILE,
         GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC,
         GNM_FUNC_TEST_STATUS_NO_TESTSUITE},
         {"date2hdate_heb", "|f", help_date2hdate_heb,
         gnumeric_date2hdate_heb, NULL, NULL, NULL,
-        GNM_FUNC_SIMPLE + GNM_FUNC_AUTO_UNITLESS,
+        GNM_FUNC_SIMPLE + GNM_FUNC_VOLATILE,
         GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC,
         GNM_FUNC_TEST_STATUS_NO_TESTSUITE},
         {"date2julian", "|f", help_date2julian,
         gnumeric_date2julian, NULL, NULL, NULL,
-        GNM_FUNC_SIMPLE + GNM_FUNC_AUTO_UNITLESS,
+        GNM_FUNC_SIMPLE + GNM_FUNC_VOLATILE + GNM_FUNC_AUTO_UNITLESS,
         GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC,
         GNM_FUNC_TEST_STATUS_NO_TESTSUITE},
        {NULL}
diff --git a/plugins/fn-logical/ChangeLog b/plugins/fn-logical/ChangeLog
index 10433aa..291b512 100644
--- a/plugins/fn-logical/ChangeLog
+++ b/plugins/fn-logical/ChangeLog
@@ -1,3 +1,8 @@
+2017-11-22  Morten Welinder  <terra gnome org>
+
+       * functions.c (logical_functions): add auto-format hints for
+       iferror and ifna.
+
 2017-11-18  Morten Welinder <terra gnome org>
 
        * Release 1.12.36
diff --git a/plugins/fn-logical/functions.c b/plugins/fn-logical/functions.c
index 672256b..5c22b4b 100644
--- a/plugins/fn-logical/functions.c
+++ b/plugins/fn-logical/functions.c
@@ -417,10 +417,12 @@ GnmFuncDescriptor const logical_functions[] = {
          GNM_FUNC_IMPL_STATUS_COMPLETE, GNM_FUNC_TEST_STATUS_BASIC },
        { "iferror", "EE",  help_iferror,
          gnumeric_iferror, NULL, NULL, NULL,
-         GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_COMPLETE, GNM_FUNC_TEST_STATUS_NO_TESTSUITE },
+         GNM_FUNC_SIMPLE + GNM_FUNC_AUTO_SECOND,
+         GNM_FUNC_IMPL_STATUS_COMPLETE, GNM_FUNC_TEST_STATUS_NO_TESTSUITE },
        { "ifna", "EE",  help_ifna,
          gnumeric_ifna, NULL, NULL, NULL,
-         GNM_FUNC_SIMPLE,  GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC,
+         GNM_FUNC_SIMPLE + GNM_FUNC_AUTO_SECOND,
+         GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC,
          GNM_FUNC_TEST_STATUS_NO_TESTSUITE},
        { "ifs", NULL,  help_ifs,
          NULL, gnumeric_ifs, NULL, NULL,
diff --git a/plugins/fn-math/ChangeLog b/plugins/fn-math/ChangeLog
index 8ddc95d..b025142 100644
--- a/plugins/fn-math/ChangeLog
+++ b/plugins/fn-math/ChangeLog
@@ -1,3 +1,8 @@
+2017-11-22  Morten Welinder  <terra gnome org>
+
+       * functions.c (math_functions): Mark COUNTIF, COUNTIFS, COMBIN,
+       and COMBINA as unitless.
+
 2017-11-18  Morten Welinder <terra gnome org>
 
        * Release 1.12.36
diff --git a/plugins/fn-math/functions.c b/plugins/fn-math/functions.c
index 5197022..da9490d 100644
--- a/plugins/fn-math/functions.c
+++ b/plugins/fn-math/functions.c
@@ -3479,10 +3479,11 @@ GnmFuncDescriptor const math_functions[] = {
 
        { "countif", "rS",  help_countif,
          gnumeric_countif, NULL, NULL, NULL,
-         GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_COMPLETE, GNM_FUNC_TEST_STATUS_BASIC },
+         GNM_FUNC_SIMPLE + GNM_FUNC_AUTO_UNITLESS,
+         GNM_FUNC_IMPL_STATUS_COMPLETE, GNM_FUNC_TEST_STATUS_BASIC },
        { "countifs", NULL,  help_countifs,
          NULL, gnumeric_countifs, NULL, NULL,
-         GNM_FUNC_SIMPLE,
+         GNM_FUNC_SIMPLE + GNM_FUNC_AUTO_UNITLESS,
          GNM_FUNC_IMPL_STATUS_COMPLETE, GNM_FUNC_TEST_STATUS_BASIC },
 
        { "ceil",    "f",     help_ceil,
@@ -3519,10 +3520,12 @@ GnmFuncDescriptor const math_functions[] = {
          GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_COMPLETE, GNM_FUNC_TEST_STATUS_BASIC },
        { "combin",  "ff",       help_combin,
          gnumeric_combin, NULL, NULL, NULL,
-         GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_COMPLETE, GNM_FUNC_TEST_STATUS_EXHAUSTIVE },
+         GNM_FUNC_SIMPLE + GNM_FUNC_AUTO_UNITLESS,
+         GNM_FUNC_IMPL_STATUS_COMPLETE, GNM_FUNC_TEST_STATUS_EXHAUSTIVE },
        { "combina",  "ff",       help_combina,
          gnumeric_combina, NULL, NULL, NULL,
-         GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_COMPLETE, GNM_FUNC_TEST_STATUS_NO_TESTSUITE },
+         GNM_FUNC_SIMPLE + GNM_FUNC_AUTO_UNITLESS,
+         GNM_FUNC_IMPL_STATUS_COMPLETE, GNM_FUNC_TEST_STATUS_NO_TESTSUITE },
        { "csc",     "f",     help_csc,
          gnumeric_csc, NULL, NULL, NULL,
          GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC, GNM_FUNC_TEST_STATUS_NO_TESTSUITE },
diff --git a/plugins/fn-stat/ChangeLog b/plugins/fn-stat/ChangeLog
index cf4bed7..186bdc4 100644
--- a/plugins/fn-stat/ChangeLog
+++ b/plugins/fn-stat/ChangeLog
@@ -1,3 +1,8 @@
+2017-11-22  Morten Welinder  <terra gnome org>
+
+       * functions.c (math_functions): Mark COUNT, COUNTA, PERMUT, and
+       PERMUTATIONA as unitless.
+
 2017-11-20  Morten Welinder  <terra gnome org>
 
        * functions.c (gnumeric_mode_mult): Plug leak.
diff --git a/plugins/fn-stat/functions.c b/plugins/fn-stat/functions.c
index e23f973..01b0c84 100644
--- a/plugins/fn-stat/functions.c
+++ b/plugins/fn-stat/functions.c
@@ -5406,10 +5406,12 @@ GnmFuncDescriptor const stat_functions[] = {
          GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_COMPLETE, GNM_FUNC_TEST_STATUS_BASIC },
        { "count", NULL,
          help_count, NULL, gnumeric_count, NULL, NULL,
-         GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_COMPLETE, GNM_FUNC_TEST_STATUS_BASIC },
+         GNM_FUNC_SIMPLE + GNM_FUNC_AUTO_UNITLESS,
+         GNM_FUNC_IMPL_STATUS_COMPLETE, GNM_FUNC_TEST_STATUS_BASIC },
        { "counta", NULL,
          help_counta, NULL, gnumeric_counta, NULL, NULL,
-         GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_COMPLETE, GNM_FUNC_TEST_STATUS_BASIC },
+         GNM_FUNC_SIMPLE + GNM_FUNC_AUTO_UNITLESS,
+         GNM_FUNC_IMPL_STATUS_COMPLETE, GNM_FUNC_TEST_STATUS_BASIC },
        { "covar",        "AA",
          help_covar, gnumeric_covar, NULL, NULL, NULL,
          GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_COMPLETE, GNM_FUNC_TEST_STATUS_BASIC },
@@ -5564,7 +5566,8 @@ GnmFuncDescriptor const stat_functions[] = {
          GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_COMPLETE, GNM_FUNC_TEST_STATUS_NO_TESTSUITE},
        { "permut",       "ff",
          help_permut, gnumeric_permut, NULL, NULL, NULL,
-         GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_COMPLETE, GNM_FUNC_TEST_STATUS_BASIC },
+         GNM_FUNC_SIMPLE + GNM_FUNC_AUTO_UNITLESS,
+         GNM_FUNC_IMPL_STATUS_COMPLETE, GNM_FUNC_TEST_STATUS_BASIC },
        { "poisson",      "ffb",
          help_poisson, gnumeric_poisson, NULL, NULL, NULL,
          GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_COMPLETE, GNM_FUNC_TEST_STATUS_BASIC },
@@ -5694,7 +5697,8 @@ GnmFuncDescriptor const stat_functions[] = {
          GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC, GNM_FUNC_TEST_STATUS_NO_TESTSUITE },
        { "permutationa",   "ff",       help_permutationa,
          gnumeric_permutationa, NULL, NULL, NULL,
-         GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_COMPLETE, GNM_FUNC_TEST_STATUS_NO_TESTSUITE },
+         GNM_FUNC_SIMPLE + GNM_FUNC_AUTO_UNITLESS,
+         GNM_FUNC_IMPL_STATUS_COMPLETE, GNM_FUNC_TEST_STATUS_NO_TESTSUITE },
 
        {NULL}
 };


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]