[gnumeric] Fnuc doc: improve testing and fix issues found.
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] Fnuc doc: improve testing and fix issues found.
- Date: Fri, 4 Jan 2019 23:49:11 +0000 (UTC)
commit 473f6a6c805a3a74790bd50463acd50a1886bf38
Author: Morten Welinder <terra gnome org>
Date: Fri Jan 4 18:48:29 2019 -0500
Fnuc doc: improve testing and fix issues found.
plugins/fn-complex/functions.c | 6 +++---
plugins/fn-financial/functions.c | 2 +-
plugins/fn-numtheory/numtheory.c | 2 +-
plugins/fn-stat/functions.c | 4 ++--
plugins/fn-string/functions.c | 2 +-
src/func-builtin.c | 2 --
src/sstest.c | 44 ++++++++++++++++++++++++++++++++++++++--
7 files changed, 50 insertions(+), 12 deletions(-)
---
diff --git a/plugins/fn-complex/functions.c b/plugins/fn-complex/functions.c
index 2a7fcef38..1899ba78e 100644
--- a/plugins/fn-complex/functions.c
+++ b/plugins/fn-complex/functions.c
@@ -402,7 +402,7 @@ gnumeric_imexp (GnmFuncEvalInfo *ei, GnmValue const * const *argv)
/***************************************************************************/
static GnmFuncHelp const help_imargument[] = {
- { GNM_FUNC_HELP_NAME, F_("IMARGUMENT:the argument theta of the complex number @{z} ") },
+ { GNM_FUNC_HELP_NAME, F_("IMARGUMENT:the argument theta of the complex number @{z}") },
{ GNM_FUNC_HELP_ARG, F_("z:a complex number") },
{ GNM_FUNC_HELP_DESCRIPTION, F_("The argument theta of a complex number is its angle in radians from
the real axis.") },
{ GNM_FUNC_HELP_NOTE, F_("If @{z} is not a valid complex number, #VALUE! is returned.") },
@@ -757,7 +757,7 @@ gnumeric_imarcsin (GnmFuncEvalInfo *ei, GnmValue const * const *argv)
/***************************************************************************/
static GnmFuncHelp const help_imarccos[] = {
- { GNM_FUNC_HELP_NAME, F_("IMARCCOS:the complex arccosine of the complex number ") },
+ { GNM_FUNC_HELP_NAME, F_("IMARCCOS:the complex arccosine of the complex number") },
{ GNM_FUNC_HELP_ARG, F_("z:a complex number") },
{ GNM_FUNC_HELP_DESCRIPTION, F_("IMARCCOS returns the complex arccosine of the complex number "
"@{z}. The branch cuts are on the real axis, less than -1 and greater than 1.") },
@@ -783,7 +783,7 @@ gnumeric_imarccos (GnmFuncEvalInfo *ei, GnmValue const * const *argv)
/***************************************************************************/
static GnmFuncHelp const help_imarctan[] = {
- { GNM_FUNC_HELP_NAME, F_("IMARCTAN:the complex arctangent of the complex number ") },
+ { GNM_FUNC_HELP_NAME, F_("IMARCTAN:the complex arctangent of the complex number") },
{ GNM_FUNC_HELP_ARG, F_("z:a complex number") },
{ GNM_FUNC_HELP_DESCRIPTION, F_("IMARCTAN returns the complex arctangent of the complex number "
"@{z}. The branch cuts are on the imaginary axis, below -i and above i.") },
diff --git a/plugins/fn-financial/functions.c b/plugins/fn-financial/functions.c
index 75ac9cee3..3c50554ff 100644
--- a/plugins/fn-financial/functions.c
+++ b/plugins/fn-financial/functions.c
@@ -1898,7 +1898,7 @@ static GnmFuncHelp const help_duration[] = {
GNM_DATE_BASIS_HELP
{ GNM_FUNC_HELP_EXAMPLES, "=DURATION(TODAY(),TODAY()+365,0.05,0.08,4)"},
{ GNM_FUNC_HELP_EXAMPLES, "=DURATION(TODAY(),TODAY()+366,0.05,0.08,4)"},
- { GNM_FUNC_HELP_SEEALSO, "MDURATION, G_DURATION"},
+ { GNM_FUNC_HELP_SEEALSO, "MDURATION,G_DURATION"},
{ GNM_FUNC_HELP_END }
};
diff --git a/plugins/fn-numtheory/numtheory.c b/plugins/fn-numtheory/numtheory.c
index 247fb05b7..216aab83f 100644
--- a/plugins/fn-numtheory/numtheory.c
+++ b/plugins/fn-numtheory/numtheory.c
@@ -491,7 +491,7 @@ static GnmFuncHelp const help_isprime[] = {
{ GNM_FUNC_HELP_ARG, F_("n:positive integer")},
{ GNM_FUNC_HELP_DESCRIPTION, F_("ISPRIME returns TRUE if @{n} is prime and FALSE otherwise.")},
{ GNM_FUNC_HELP_EXAMPLES, "=ISPRIME(57)" },
- { GNM_FUNC_HELP_SEEALSO, "NT_D, NT_SIGMA"},
+ { GNM_FUNC_HELP_SEEALSO, "NT_D,NT_SIGMA"},
{ GNM_FUNC_HELP_EXTREF, F_("wolfram:PrimeNumber.html") },
{ GNM_FUNC_HELP_END }
};
diff --git a/plugins/fn-stat/functions.c b/plugins/fn-stat/functions.c
index 945f2f30b..2672503e8 100644
--- a/plugins/fn-stat/functions.c
+++ b/plugins/fn-stat/functions.c
@@ -835,7 +835,7 @@ static GnmFuncHelp const help_average[] = {
{ GNM_FUNC_HELP_ARG, F_("number2:second value")},
{ GNM_FUNC_HELP_EXCEL, F_("This function is Excel compatible.") },
{ GNM_FUNC_HELP_EXAMPLES, "=AVERAGE(11.4,17.3,21.3,25.9,40.1)" },
- { GNM_FUNC_HELP_SEEALSO, ("SUM, COUNT")},
+ { GNM_FUNC_HELP_SEEALSO, ("SUM,COUNT")},
{ GNM_FUNC_HELP_EXTREF, F_("wiki:en:Arithmetic_mean") },
{ GNM_FUNC_HELP_EXTREF, F_("wolfram:ArithmeticMean.html") },
{ GNM_FUNC_HELP_END }
@@ -1260,7 +1260,7 @@ static GnmFuncHelp const help_betadist[] = {
{ GNM_FUNC_HELP_NOTE, F_("If @{a} >= @{b} this function returns a #NUM! error.")},
{ GNM_FUNC_HELP_EXCEL, F_("This function is Excel compatible.") },
{ GNM_FUNC_HELP_EXAMPLES, "=BETADIST(0.12,2,3)" },
- { GNM_FUNC_HELP_SEEALSO, "BETAINV, BETA.DIST"},
+ { GNM_FUNC_HELP_SEEALSO, "BETAINV,BETA.DIST"},
{ GNM_FUNC_HELP_END }
};
diff --git a/plugins/fn-string/functions.c b/plugins/fn-string/functions.c
index 5789eeced..c07287039 100644
--- a/plugins/fn-string/functions.c
+++ b/plugins/fn-string/functions.c
@@ -285,7 +285,7 @@ static GnmFuncHelp const help_lenb[] = {
{ GNM_FUNC_HELP_EXCEL, F_("This function is Excel compatible.") },
{ GNM_FUNC_HELP_EXAMPLES, "=LENB(\"Helsinki\")" },
{ GNM_FUNC_HELP_EXAMPLES, "=LENB(\"L\xc3\xa9vy\")" },
- { GNM_FUNC_HELP_SEEALSO, "CHAR, CODE, LEN"},
+ { GNM_FUNC_HELP_SEEALSO, "CHAR,CODE,LEN"},
{ GNM_FUNC_HELP_END}
};
diff --git a/src/func-builtin.c b/src/func-builtin.c
index 06b671ac5..ae66b59f6 100644
--- a/src/func-builtin.c
+++ b/src/func-builtin.c
@@ -136,7 +136,6 @@ static GnmFuncHelp const help_gnumeric_version[] = {
{ GNM_FUNC_HELP_NAME, N_("GNUMERIC_VERSION:the current version of Gnumeric")},
{ GNM_FUNC_HELP_DESCRIPTION, N_("GNUMERIC_VERSION returns the version of gnumeric as a string.")},
{ GNM_FUNC_HELP_EXAMPLES, "=GNUMERIC_VERSION()" },
- { GNM_FUNC_HELP_SEEALSO, ""},
{ GNM_FUNC_HELP_END }
};
@@ -151,7 +150,6 @@ gnumeric_version (GnmFuncEvalInfo *ei, GnmValue const * const *argv)
static GnmFuncHelp const help_table[] = {
{ GNM_FUNC_HELP_NAME, N_("TABLE:internal function for data tables")},
{ GNM_FUNC_HELP_DESCRIPTION, N_("This function should not be called directly.")},
- { GNM_FUNC_HELP_SEEALSO, ""},
{ GNM_FUNC_HELP_END }
};
diff --git a/src/sstest.c b/src/sstest.c
index 3b2d7b796..5eb64432e 100644
--- a/src/sstest.c
+++ b/src/sstest.c
@@ -985,6 +985,8 @@ gnm_func_sanity_check1 (GnmFunc *fd)
memset (counts, 0, sizeof (counts));
for (h = help; n-- > 0; h++) {
+ unsigned len;
+
g_assert (h->type <= GNM_FUNC_HELP_ODF);
counts[h->type]++;
@@ -995,6 +997,7 @@ gnm_func_sanity_check1 (GnmFunc *fd)
continue;
}
+ len = h->text ? strlen (h->text) : 0;
switch (h->type) {
case GNM_FUNC_HELP_NAME:
if (g_ascii_strncasecmp (fd->name, h->text, nlen) ||
@@ -1002,11 +1005,12 @@ gnm_func_sanity_check1 (GnmFunc *fd)
g_printerr ("%s: Invalid NAME record\n",
fd->name);
res = 1;
- } else if (h->text[nlen + 1] == ' ') {
+ } else if (h->text[nlen + 1] == ' ' ||
+ h->text[len - 1] == ' ') {
g_printerr ("%s: Unwanted space in NAME record\n",
fd->name);
res = 1;
- } else if (h->text[strlen (h->text) - 1] == '.') {
+ } else if (h->text[len - 1] == '.') {
g_printerr ("%s: Unwanted period in NAME record\n",
fd->name);
res = 1;
@@ -1090,6 +1094,36 @@ gnm_func_sanity_check1 (GnmFunc *fd)
}
}
break;
+
+ case GNM_FUNC_HELP_SEEALSO: {
+ const char *p = h->text;
+ if (len == 0 || strchr (p, ' ')) {
+ g_printerr ("%s: Invalid SEEALSO record\n",
+ fd->name);
+ res = 1;
+ break;
+ }
+
+ while (p) {
+ char *ref;
+ const char *e = strchr (p, ',');
+ if (!e) e = p + strlen (p);
+
+ ref = g_strndup (p, e - p);
+ if (!gnm_func_lookup (ref, NULL)) {
+ g_printerr ("%s: unknown SEEALSO record\reference %s",
+ fd->name, ref);
+ res = 1;
+ }
+ g_free (ref);
+ if (*e == 0)
+ break;
+ else
+ p = e + 1;
+ }
+
+ break;
+ }
default:
; /* Nothing */
}
@@ -1134,6 +1168,12 @@ gnm_func_sanity_check1 (GnmFunc *fd)
res = 1;
}
+ if (counts[GNM_FUNC_HELP_SEEALSO] > 1) {
+ g_printerr ("%s: Help has %d SEEALSO notes.\n",
+ fd->name, counts[GNM_FUNC_HELP_SEEALSO]);
+ res = 1;
+ }
+
return res;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]