[gnumeric] Handle ODF import/export of FORMULA and CHISQINV
- From: Andreas J. Guelzow <guelzow src gnome org>
- To: svn-commits-list gnome org
- Subject: [gnumeric] Handle ODF import/export of FORMULA and CHISQINV
- Date: Thu, 18 Jun 2009 02:02:14 -0400 (EDT)
commit 18f1a5fcafda77f1cb9206b9215732483b158e51
Author: Andreas J. Guelzow <aguelzow pyrshep ca>
Date: Thu Jun 18 00:01:29 2009 -0600
Handle ODF import/export of FORMULA and CHISQINV
2009-06-18 Andreas J. Guelzow <aguelzow pyrshep ca>
* openoffice-write.c (odf_func_r_qchisq_handler): new
(odf_expr_func_handler): add hash of individual handlers, map
GET.FORMULA to FORMULA and 2-argument instances of R.QCHISQ to
CHISQINV
* openoffice-read.c (oo_func_map_in): map FORMULA to GET.FORMULA
and CHISQINV to R.QCHISQ
plugins/openoffice/ChangeLog | 9 +
plugins/openoffice/openoffice-read.c | 4 +-
plugins/openoffice/openoffice-write.c | 428 ++++++++++++++++++---------------
3 files changed, 239 insertions(+), 202 deletions(-)
---
diff --git a/plugins/openoffice/ChangeLog b/plugins/openoffice/ChangeLog
index fe16f1e..db63f22 100644
--- a/plugins/openoffice/ChangeLog
+++ b/plugins/openoffice/ChangeLog
@@ -1,3 +1,12 @@
+2009-06-18 Andreas J. Guelzow <aguelzow pyrshep ca>
+
+ * openoffice-write.c (odf_func_r_qchisq_handler): new
+ (odf_expr_func_handler): add hash of individual handlers, map
+ GET.FORMULA to FORMULA and 2-argument instances of R.QCHISQ to
+ CHISQINV
+ * openoffice-read.c (oo_func_map_in): map FORMULA to GET.FORMULA
+ and CHISQINV to R.QCHISQ
+
2009-06-17 Andreas J. Guelzow <aguelzow pyrshep ca>
* openoffice-write.c (xl_find_format): use easier to follow style
diff --git a/plugins/openoffice/openoffice-read.c b/plugins/openoffice/openoffice-read.c
index b346ca8..7fbd9da 100644
--- a/plugins/openoffice/openoffice-read.c
+++ b/plugins/openoffice/openoffice-read.c
@@ -3629,7 +3629,6 @@ oo_func_map_in (GnmConventions const *convs, Workbook *scope,
/* { "DAYS","DAYS" }, */
/* { "DDE","DDE" }, */
/* { "FINDB","FINDB" }, */
-/* { "FORMULA","FORMULA" }, */
/* { "GAMMA","GAMMA" }, */
/* { "GAUSS","GAUSS" }, */
/* { "IFNA","IFNA" }, */
@@ -3661,6 +3660,8 @@ oo_func_map_in (GnmConventions const *convs, Workbook *scope,
{ "LEGACY.FINV","FINV" },
{ "LEGACY.NORMSDIST","NORMSDIST" },
{ "LEGACY.NORMSINV","NORMSINV" },
+ { "CHISQINV","R.QCHISQ" },
+ { "FORMULA","GET.FORMULA" },
/* { "ABS","ABS" }, */
/* { "ACCRINT","ACCRINT" }, */
@@ -3795,7 +3796,6 @@ oo_func_map_in (GnmConventions const *convs, Workbook *scope,
/* { "FIXED","FIXED" }, */
/* { "FLOOR","FLOOR" }, */
/* { "FORECAST","FORECAST" }, */
-/* { "FORMULA","FORMULA" }, */
/* { "FREQUENCY","FREQUENCY" }, */
/* { "FTEST","FTEST" }, */
/* { "FV","FV" }, */
diff --git a/plugins/openoffice/openoffice-write.c b/plugins/openoffice/openoffice-write.c
index 5f96b27..1f78726 100644
--- a/plugins/openoffice/openoffice-write.c
+++ b/plugins/openoffice/openoffice-write.c
@@ -1283,11 +1283,31 @@ odf_rangeref_as_string (GnmConventionsOut *out, GnmRangeRef const *ref)
g_string_append (out->accum, "]");
}
+static gboolean
+odf_func_r_qchisq_handler (GnmConventionsOut *out, GnmExprFunction const *func)
+{
+ if (func->argc == 2) {
+ GString *target = out->accum;
+ g_string_append (target, "CHISQINV");
+ gnm_expr_list_as_string (func->argc, func->argv, out);
+ return TRUE;
+ }
+ return FALSE;
+}
+
static void
odf_expr_func_handler (GnmConventionsOut *out, GnmExprFunction const *func)
{
static struct {
char const *gnm_name;
+ gpointer handler;
+ } const sc_func_handlers[] = {
+ {"R.QCHISQ", odf_func_r_qchisq_handler},
+ {NULL, NULL}
+ };
+
+ static struct {
+ char const *gnm_name;
char const *odf_name;
} const sc_func_renames[] = {
{ "CEIL", "CEILING" },
@@ -1298,189 +1318,184 @@ odf_expr_func_handler (GnmConventionsOut *out, GnmExprFunction const *func)
{ "FINV","LEGACY.FINV" },
{ "NORMSDIST","LEGACY.NORMSDIST" },
{ "NORMSINV","LEGACY.NORMSINV" },
-
+ { "GET.FORMULA","FORMULA" },
+
/* The following Gnumeric specific functions should be preceded by ORG.GNUMERIC.*/
-
-{ "ATL_LAST","ORG.GNUMERIC.ATL_LAST" },
-{ "BERNOULLI","ORG.GNUMERIC.BERNOULLI" },
-{ "BETA","ORG.GNUMERIC.BETA" },
-{ "BETALN","ORG.GNUMERIC.BETALN" },
-{ "CAUCHY","ORG.GNUMERIC.CAUCHY" },
-{ "COLUMNNUMBER","ORG.GNUMERIC.COLUMNNUMBER" },
-{ "CRONBACH","ORG.GNUMERIC.CRONBACH" },
-{ "CUM_BIV_NORM_DIST","ORG.GNUMERIC.CUM_BIV_NORM_DIST" },
-{ "DATE2UNIX","ORG.GNUMERIC.DATE2UNIX" },
-{ "DAYS360","ORG.GNUMERIC.DAYS360" },
-{ "DIMCIRC","ORG.GNUMERIC.DIMCIRC" },
-{ "ERROR","ORG.GNUMERIC.ERROR" },
-{ "EURO","ORG.GNUMERIC.EURO" },
-{ "EXECSQL","ORG.GNUMERIC.EXECSQL" },
-{ "EXPM1","ORG.GNUMERIC.EXPM1" },
-{ "EXPPOWDIST","ORG.GNUMERIC.EXPPOWDIST" },
-{ "EXPRESSION","ORG.GNUMERIC.EXPRESSION" },
-{ "FIB","ORG.GNUMERIC.FIB" },
-{ "G_DURATION","ORG.GNUMERIC.G_DURATION" },
-{ "GEOMDIST","ORG.GNUMERIC.GEOMDIST" },
-{ "GETENV","ORG.GNUMERIC.GETENV" },
-{ "GET.FORMULA","ORG.GNUMERIC.GET.FORMULA" },
-{ "G_PRODUCT","ORG.GNUMERIC.G_PRODUCT" },
-{ "HYPOT","ORG.GNUMERIC.HYPOT" },
-{ "IMARCCOS","ORG.GNUMERIC.IMARCCOS" },
-{ "IMARCCOSH","ORG.GNUMERIC.IMARCCOSH" },
-{ "IMARCCOT","ORG.GNUMERIC.IMARCCOT" },
-{ "IMARCCOTH","ORG.GNUMERIC.IMARCCOTH" },
-{ "IMARCCSC","ORG.GNUMERIC.IMARCCSC" },
-{ "IMARCCSCH","ORG.GNUMERIC.IMARCCSCH" },
-{ "IMARCSEC","ORG.GNUMERIC.IMARCSEC" },
-{ "IMARCSECH","ORG.GNUMERIC.IMARCSECH" },
-{ "IMARCSIN","ORG.GNUMERIC.IMARCSIN" },
-{ "IMARCSINH","ORG.GNUMERIC.IMARCSINH" },
-{ "IMARCTAN","ORG.GNUMERIC.IMARCTAN" },
-{ "IMARCTANH","ORG.GNUMERIC.IMARCTANH" },
-{ "IMCOSH","ORG.GNUMERIC.IMCOSH" },
-{ "IMCOTH","ORG.GNUMERIC.IMCOTH" },
-{ "IMINV","ORG.GNUMERIC.IMINV" },
-{ "IMNEG","ORG.GNUMERIC.IMNEG" },
-{ "IMSINH","ORG.GNUMERIC.IMSINH" },
-{ "IMTANH","ORG.GNUMERIC.IMTANH" },
-{ "INTERPOLATION","ORG.GNUMERIC.INTERPOLATION" },
-{ "INVSUMINV","ORG.GNUMERIC.INVSUMINV" },
-{ "ISOYEAR","ORG.GNUMERIC.ISOYEAR" },
-{ "ISPRIME","ORG.GNUMERIC.ISPRIME" },
-{ "ITHPRIME","ORG.GNUMERIC.ITHPRIME" },
-{ "KURTP","ORG.GNUMERIC.KURTP" },
-{ "LANDAU","ORG.GNUMERIC.LANDAU" },
-{ "LAPLACE","ORG.GNUMERIC.LAPLACE" },
-{ "LN1P","ORG.GNUMERIC.LN1P" },
-{ "LOG2","ORG.GNUMERIC.LOG2" },
-{ "LOGFIT","ORG.GNUMERIC.LOGFIT" },
-{ "LOGISTIC","ORG.GNUMERIC.LOGISTIC" },
-{ "LOGREG","ORG.GNUMERIC.LOGREG" },
-{ "NT_D","ORG.GNUMERIC.NT_D" },
-{ "NT_MU","ORG.GNUMERIC.NT_MU" },
-{ "NT_PHI","ORG.GNUMERIC.NT_PHI" },
-{ "NT_PI","ORG.GNUMERIC.NT_PI" },
-{ "NT_SIGMA","ORG.GNUMERIC.NT_SIGMA" },
-{ "OFFCAP","ORG.GNUMERIC.OFFCAP" },
-{ "OFFTRAF","ORG.GNUMERIC.OFFTRAF" },
-{ "OPT_2_ASSET_CORRELATION","ORG.GNUMERIC.OPT_2_ASSET_CORRELATION" },
-{ "OPT_AMER_EXCHANGE","ORG.GNUMERIC.OPT_AMER_EXCHANGE" },
-{ "OPT_BAW_AMER","ORG.GNUMERIC.OPT_BAW_AMER" },
-{ "OPT_BINOMIAL","ORG.GNUMERIC.OPT_BINOMIAL" },
-{ "OPT_BJER_STENS","ORG.GNUMERIC.OPT_BJER_STENS" },
-{ "OPT_BS","ORG.GNUMERIC.OPT_BS" },
-{ "OPT_BS_CARRYCOST","ORG.GNUMERIC.OPT_BS_CARRYCOST" },
-{ "OPT_BS_DELTA","ORG.GNUMERIC.OPT_BS_DELTA" },
-{ "OPT_BS_GAMMA","ORG.GNUMERIC.OPT_BS_GAMMA" },
-{ "OPT_BS_RHO","ORG.GNUMERIC.OPT_BS_RHO" },
-{ "OPT_BS_THETA","ORG.GNUMERIC.OPT_BS_THETA" },
-{ "OPT_BS_VEGA","ORG.GNUMERIC.OPT_BS_VEGA" },
-{ "OPT_COMPLEX_CHOOSER","ORG.GNUMERIC.OPT_COMPLEX_CHOOSER" },
-{ "OPT_EURO_EXCHANGE","ORG.GNUMERIC.OPT_EURO_EXCHANGE" },
-{ "OPT_EXEC","ORG.GNUMERIC.OPT_EXEC" },
-{ "OPT_EXTENDIBLE_WRITER","ORG.GNUMERIC.OPT_EXTENDIBLE_WRITER" },
-{ "OPT_FIXED_STRK_LKBK","ORG.GNUMERIC.OPT_FIXED_STRK_LKBK" },
-{ "OPT_FLOAT_STRK_LKBK","ORG.GNUMERIC.OPT_FLOAT_STRK_LKBK" },
-{ "OPT_FORWARD_START","ORG.GNUMERIC.OPT_FORWARD_START" },
-{ "OPT_FRENCH","ORG.GNUMERIC.OPT_FRENCH" },
-{ "OPT_GARMAN_KOHLHAGEN","ORG.GNUMERIC.OPT_GARMAN_KOHLHAGEN" },
-{ "OPT_JUMP_DIFF","ORG.GNUMERIC.OPT_JUMP_DIFF" },
-{ "OPT_MILTERSEN_SCHWARTZ","ORG.GNUMERIC.OPT_MILTERSEN_SCHWARTZ" },
-{ "OPT_ON_OPTIONS","ORG.GNUMERIC.OPT_ON_OPTIONS" },
-{ "OPT_RGW","ORG.GNUMERIC.OPT_RGW" },
-{ "OPT_SIMPLE_CHOOSER","ORG.GNUMERIC.OPT_SIMPLE_CHOOSER" },
-{ "OPT_SPREAD_APPROX","ORG.GNUMERIC.OPT_SPREAD_APPROX" },
-{ "OPT_TIME_SWITCH","ORG.GNUMERIC.OPT_TIME_SWITCH" },
-{ "PARETO","ORG.GNUMERIC.PARETO" },
-{ "periodogram","ORG.GNUMERIC.periodogram" },
-{ "PFACTOR","ORG.GNUMERIC.PFACTOR" },
-{ "PROBBLOCK","ORG.GNUMERIC.PROBBLOCK" },
-{ "RANDBERNOULLI","ORG.GNUMERIC.RANDBERNOULLI" },
-{ "RANDBETA","ORG.GNUMERIC.RANDBETA" },
-{ "RANDBINOM","ORG.GNUMERIC.RANDBINOM" },
-{ "RANDCAUCHY","ORG.GNUMERIC.RANDCAUCHY" },
-{ "RANDCHISQ","ORG.GNUMERIC.RANDCHISQ" },
-{ "RANDDISCRETE","ORG.GNUMERIC.RANDDISCRETE" },
-{ "RANDEXP","ORG.GNUMERIC.RANDEXP" },
-{ "RANDEXPPOW","ORG.GNUMERIC.RANDEXPPOW" },
-{ "RANDFDIST","ORG.GNUMERIC.RANDFDIST" },
-{ "RANDGAMMA","ORG.GNUMERIC.RANDGAMMA" },
-{ "RANDGEOM","ORG.GNUMERIC.RANDGEOM" },
-{ "RANDGUMBEL","ORG.GNUMERIC.RANDGUMBEL" },
-{ "RANDHYPERG","ORG.GNUMERIC.RANDHYPERG" },
-{ "RANDLANDAU","ORG.GNUMERIC.RANDLANDAU" },
-{ "RANDLAPLACE","ORG.GNUMERIC.RANDLAPLACE" },
-{ "RANDLEVY","ORG.GNUMERIC.RANDLEVY" },
-{ "RANDLOG","ORG.GNUMERIC.RANDLOG" },
-{ "RANDLOGISTIC","ORG.GNUMERIC.RANDLOGISTIC" },
-{ "RANDLOGNORM","ORG.GNUMERIC.RANDLOGNORM" },
-{ "RANDNEGBINOM","ORG.GNUMERIC.RANDNEGBINOM" },
-{ "RANDNORM","ORG.GNUMERIC.RANDNORM" },
-{ "RANDNORMTAIL","ORG.GNUMERIC.RANDNORMTAIL" },
-{ "RANDPARETO","ORG.GNUMERIC.RANDPARETO" },
-{ "RANDPOISSON","ORG.GNUMERIC.RANDPOISSON" },
-{ "RANDRAYLEIGH","ORG.GNUMERIC.RANDRAYLEIGH" },
-{ "RANDRAYLEIGHTAIL","ORG.GNUMERIC.RANDRAYLEIGHTAIL" },
-{ "RANDTDIST","ORG.GNUMERIC.RANDTDIST" },
-{ "RANDUNIFORM","ORG.GNUMERIC.RANDUNIFORM" },
-{ "RANDWEIBULL","ORG.GNUMERIC.RANDWEIBULL" },
-{ "RAYLEIGH","ORG.GNUMERIC.RAYLEIGH" },
-{ "RAYLEIGHTAIL","ORG.GNUMERIC.RAYLEIGHTAIL" },
-{ "READDBTABLE","ORG.GNUMERIC.READDBTABLE" },
-{ "R.DBETA","ORG.GNUMERIC.R.DBETA" },
-{ "R.DBINOM","ORG.GNUMERIC.R.DBINOM" },
-{ "R.DCAUCHY","ORG.GNUMERIC.R.DCAUCHY" },
-{ "R.DCHISQ","ORG.GNUMERIC.R.DCHISQ" },
-{ "R.DEXP","ORG.GNUMERIC.R.DEXP" },
-{ "R.DF","ORG.GNUMERIC.R.DF" },
-{ "R.DGAMMA","ORG.GNUMERIC.R.DGAMMA" },
-{ "R.DGEOM","ORG.GNUMERIC.R.DGEOM" },
-{ "R.DHYPER","ORG.GNUMERIC.R.DHYPER" },
-{ "R.DLNORM","ORG.GNUMERIC.R.DLNORM" },
-{ "R.DNBINOM","ORG.GNUMERIC.R.DNBINOM" },
-{ "R.DNORM","ORG.GNUMERIC.R.DNORM" },
-{ "R.DPOIS","ORG.GNUMERIC.R.DPOIS" },
-{ "R.DT","ORG.GNUMERIC.R.DT" },
-{ "R.DWEIBULL","ORG.GNUMERIC.R.DWEIBULL" },
-{ "R.PBETA","ORG.GNUMERIC.R.PBETA" },
-{ "R.PBINOM","ORG.GNUMERIC.R.PBINOM" },
-{ "R.PCAUCHY","ORG.GNUMERIC.R.PCAUCHY" },
-{ "R.PCHISQ","ORG.GNUMERIC.R.PCHISQ" },
-{ "R.PEXP","ORG.GNUMERIC.R.PEXP" },
-{ "R.PF","ORG.GNUMERIC.R.PF" },
-{ "R.PGAMMA","ORG.GNUMERIC.R.PGAMMA" },
-{ "R.PGEOM","ORG.GNUMERIC.R.PGEOM" },
-{ "R.PHYPER","ORG.GNUMERIC.R.PHYPER" },
-{ "R.PLNORM","ORG.GNUMERIC.R.PLNORM" },
-{ "R.PNBINOM","ORG.GNUMERIC.R.PNBINOM" },
-{ "R.PNORM","ORG.GNUMERIC.R.PNORM" },
-{ "R.PPOIS","ORG.GNUMERIC.R.PPOIS" },
-{ "R.PT","ORG.GNUMERIC.R.PT" },
-{ "R.PWEIBULL","ORG.GNUMERIC.R.PWEIBULL" },
-{ "R.QBETA","ORG.GNUMERIC.R.QBETA" },
-{ "R.QBINOM","ORG.GNUMERIC.R.QBINOM" },
-{ "R.QCAUCHY","ORG.GNUMERIC.R.QCAUCHY" },
-{ "R.QCHISQ","ORG.GNUMERIC.R.QCHISQ" },
-{ "R.QEXP","ORG.GNUMERIC.R.QEXP" },
-{ "R.QF","ORG.GNUMERIC.R.QF" },
-{ "R.QGAMMA","ORG.GNUMERIC.R.QGAMMA" },
-{ "R.QGEOM","ORG.GNUMERIC.R.QGEOM" },
-{ "R.QHYPER","ORG.GNUMERIC.R.QHYPER" },
-{ "R.QLNORM","ORG.GNUMERIC.R.QLNORM" },
-{ "R.QNBINOM","ORG.GNUMERIC.R.QNBINOM" },
-{ "R.QNORM","ORG.GNUMERIC.R.QNORM" },
-{ "R.QPOIS","ORG.GNUMERIC.R.QPOIS" },
-{ "R.QT","ORG.GNUMERIC.R.QT" },
-{ "R.QWEIBULL","ORG.GNUMERIC.R.QWEIBULL" },
-{ "SIMTABLE","ORG.GNUMERIC.SIMTABLE" },
-{ "SSMEDIAN","ORG.GNUMERIC.SSMEDIAN" },
-{ "SUMA","ORG.GNUMERIC.SUMA" },
-{ "UNIX2DATE","ORG.GNUMERIC.UNIX2DATE" },
-
-
-/* The following is a complete list of the functions defined in ODF OpenFormula draft 20090508 */
-/* We should comment out any functions we do not provide or for which our function of the same name */
-/* behaves differently and should have the Gnumeric prefix. */
+
+ { "ATL_LAST","ORG.GNUMERIC.ATL_LAST" },
+ { "BERNOULLI","ORG.GNUMERIC.BERNOULLI" },
+ { "BETA","ORG.GNUMERIC.BETA" },
+ { "BETALN","ORG.GNUMERIC.BETALN" },
+ { "CAUCHY","ORG.GNUMERIC.CAUCHY" },
+ { "COLUMNNUMBER","ORG.GNUMERIC.COLUMNNUMBER" },
+ { "CRONBACH","ORG.GNUMERIC.CRONBACH" },
+ { "CUM_BIV_NORM_DIST","ORG.GNUMERIC.CUM_BIV_NORM_DIST" },
+ { "DATE2UNIX","ORG.GNUMERIC.DATE2UNIX" },
+ { "DAYS360","ORG.GNUMERIC.DAYS360" },
+ { "DIMCIRC","ORG.GNUMERIC.DIMCIRC" },
+ { "ERROR","ORG.GNUMERIC.ERROR" },
+ { "EURO","ORG.GNUMERIC.EURO" },
+ { "EXECSQL","ORG.GNUMERIC.EXECSQL" },
+ { "EXPM1","ORG.GNUMERIC.EXPM1" },
+ { "EXPPOWDIST","ORG.GNUMERIC.EXPPOWDIST" },
+ { "EXPRESSION","ORG.GNUMERIC.EXPRESSION" },
+ { "FIB","ORG.GNUMERIC.FIB" },
+ { "G_DURATION","ORG.GNUMERIC.G_DURATION" },
+ { "GEOMDIST","ORG.GNUMERIC.GEOMDIST" },
+ { "GETENV","ORG.GNUMERIC.GETENV" },
+ { "G_PRODUCT","ORG.GNUMERIC.G_PRODUCT" },
+ { "HYPOT","ORG.GNUMERIC.HYPOT" },
+ { "IMARCCOS","ORG.GNUMERIC.IMARCCOS" },
+ { "IMARCCOSH","ORG.GNUMERIC.IMARCCOSH" },
+ { "IMARCCOT","ORG.GNUMERIC.IMARCCOT" },
+ { "IMARCCOTH","ORG.GNUMERIC.IMARCCOTH" },
+ { "IMARCCSC","ORG.GNUMERIC.IMARCCSC" },
+ { "IMARCCSCH","ORG.GNUMERIC.IMARCCSCH" },
+ { "IMARCSEC","ORG.GNUMERIC.IMARCSEC" },
+ { "IMARCSECH","ORG.GNUMERIC.IMARCSECH" },
+ { "IMARCSIN","ORG.GNUMERIC.IMARCSIN" },
+ { "IMARCSINH","ORG.GNUMERIC.IMARCSINH" },
+ { "IMARCTAN","ORG.GNUMERIC.IMARCTAN" },
+ { "IMARCTANH","ORG.GNUMERIC.IMARCTANH" },
+ { "IMCOSH","ORG.GNUMERIC.IMCOSH" },
+ { "IMCOTH","ORG.GNUMERIC.IMCOTH" },
+ { "IMINV","ORG.GNUMERIC.IMINV" },
+ { "IMNEG","ORG.GNUMERIC.IMNEG" },
+ { "IMSINH","ORG.GNUMERIC.IMSINH" },
+ { "IMTANH","ORG.GNUMERIC.IMTANH" },
+ { "INTERPOLATION","ORG.GNUMERIC.INTERPOLATION" },
+ { "INVSUMINV","ORG.GNUMERIC.INVSUMINV" },
+ { "ISOYEAR","ORG.GNUMERIC.ISOYEAR" },
+ { "ISPRIME","ORG.GNUMERIC.ISPRIME" },
+ { "ITHPRIME","ORG.GNUMERIC.ITHPRIME" },
+ { "KURTP","ORG.GNUMERIC.KURTP" },
+ { "LANDAU","ORG.GNUMERIC.LANDAU" },
+ { "LAPLACE","ORG.GNUMERIC.LAPLACE" },
+ { "LN1P","ORG.GNUMERIC.LN1P" },
+ { "LOG2","ORG.GNUMERIC.LOG2" },
+ { "LOGFIT","ORG.GNUMERIC.LOGFIT" },
+ { "LOGISTIC","ORG.GNUMERIC.LOGISTIC" },
+ { "LOGREG","ORG.GNUMERIC.LOGREG" },
+ { "NT_D","ORG.GNUMERIC.NT_D" },
+ { "NT_MU","ORG.GNUMERIC.NT_MU" },
+ { "NT_PHI","ORG.GNUMERIC.NT_PHI" },
+ { "NT_PI","ORG.GNUMERIC.NT_PI" },
+ { "NT_SIGMA","ORG.GNUMERIC.NT_SIGMA" },
+ { "OFFCAP","ORG.GNUMERIC.OFFCAP" },
+ { "OFFTRAF","ORG.GNUMERIC.OFFTRAF" },
+ { "OPT_2_ASSET_CORRELATION","ORG.GNUMERIC.OPT_2_ASSET_CORRELATION" },
+ { "OPT_AMER_EXCHANGE","ORG.GNUMERIC.OPT_AMER_EXCHANGE" },
+ { "OPT_BAW_AMER","ORG.GNUMERIC.OPT_BAW_AMER" },
+ { "OPT_BINOMIAL","ORG.GNUMERIC.OPT_BINOMIAL" },
+ { "OPT_BJER_STENS","ORG.GNUMERIC.OPT_BJER_STENS" },
+ { "OPT_BS","ORG.GNUMERIC.OPT_BS" },
+ { "OPT_BS_CARRYCOST","ORG.GNUMERIC.OPT_BS_CARRYCOST" },
+ { "OPT_BS_DELTA","ORG.GNUMERIC.OPT_BS_DELTA" },
+ { "OPT_BS_GAMMA","ORG.GNUMERIC.OPT_BS_GAMMA" },
+ { "OPT_BS_RHO","ORG.GNUMERIC.OPT_BS_RHO" },
+ { "OPT_BS_THETA","ORG.GNUMERIC.OPT_BS_THETA" },
+ { "OPT_BS_VEGA","ORG.GNUMERIC.OPT_BS_VEGA" },
+ { "OPT_COMPLEX_CHOOSER","ORG.GNUMERIC.OPT_COMPLEX_CHOOSER" },
+ { "OPT_EURO_EXCHANGE","ORG.GNUMERIC.OPT_EURO_EXCHANGE" },
+ { "OPT_EXEC","ORG.GNUMERIC.OPT_EXEC" },
+ { "OPT_EXTENDIBLE_WRITER","ORG.GNUMERIC.OPT_EXTENDIBLE_WRITER" },
+ { "OPT_FIXED_STRK_LKBK","ORG.GNUMERIC.OPT_FIXED_STRK_LKBK" },
+ { "OPT_FLOAT_STRK_LKBK","ORG.GNUMERIC.OPT_FLOAT_STRK_LKBK" },
+ { "OPT_FORWARD_START","ORG.GNUMERIC.OPT_FORWARD_START" },
+ { "OPT_FRENCH","ORG.GNUMERIC.OPT_FRENCH" },
+ { "OPT_GARMAN_KOHLHAGEN","ORG.GNUMERIC.OPT_GARMAN_KOHLHAGEN" },
+ { "OPT_JUMP_DIFF","ORG.GNUMERIC.OPT_JUMP_DIFF" },
+ { "OPT_MILTERSEN_SCHWARTZ","ORG.GNUMERIC.OPT_MILTERSEN_SCHWARTZ" },
+ { "OPT_ON_OPTIONS","ORG.GNUMERIC.OPT_ON_OPTIONS" },
+ { "OPT_RGW","ORG.GNUMERIC.OPT_RGW" },
+ { "OPT_SIMPLE_CHOOSER","ORG.GNUMERIC.OPT_SIMPLE_CHOOSER" },
+ { "OPT_SPREAD_APPROX","ORG.GNUMERIC.OPT_SPREAD_APPROX" },
+ { "OPT_TIME_SWITCH","ORG.GNUMERIC.OPT_TIME_SWITCH" },
+ { "PARETO","ORG.GNUMERIC.PARETO" },
+ { "periodogram","ORG.GNUMERIC.periodogram" },
+ { "PFACTOR","ORG.GNUMERIC.PFACTOR" },
+ { "PROBBLOCK","ORG.GNUMERIC.PROBBLOCK" },
+ { "RANDBERNOULLI","ORG.GNUMERIC.RANDBERNOULLI" },
+ { "RANDBETA","ORG.GNUMERIC.RANDBETA" },
+ { "RANDBINOM","ORG.GNUMERIC.RANDBINOM" },
+ { "RANDCAUCHY","ORG.GNUMERIC.RANDCAUCHY" },
+ { "RANDCHISQ","ORG.GNUMERIC.RANDCHISQ" },
+ { "RANDDISCRETE","ORG.GNUMERIC.RANDDISCRETE" },
+ { "RANDEXP","ORG.GNUMERIC.RANDEXP" },
+ { "RANDEXPPOW","ORG.GNUMERIC.RANDEXPPOW" },
+ { "RANDFDIST","ORG.GNUMERIC.RANDFDIST" },
+ { "RANDGAMMA","ORG.GNUMERIC.RANDGAMMA" },
+ { "RANDGEOM","ORG.GNUMERIC.RANDGEOM" },
+ { "RANDGUMBEL","ORG.GNUMERIC.RANDGUMBEL" },
+ { "RANDHYPERG","ORG.GNUMERIC.RANDHYPERG" },
+ { "RANDLANDAU","ORG.GNUMERIC.RANDLANDAU" },
+ { "RANDLAPLACE","ORG.GNUMERIC.RANDLAPLACE" },
+ { "RANDLEVY","ORG.GNUMERIC.RANDLEVY" },
+ { "RANDLOG","ORG.GNUMERIC.RANDLOG" },
+ { "RANDLOGISTIC","ORG.GNUMERIC.RANDLOGISTIC" },
+ { "RANDLOGNORM","ORG.GNUMERIC.RANDLOGNORM" },
+ { "RANDNEGBINOM","ORG.GNUMERIC.RANDNEGBINOM" },
+ { "RANDNORM","ORG.GNUMERIC.RANDNORM" },
+ { "RANDNORMTAIL","ORG.GNUMERIC.RANDNORMTAIL" },
+ { "RANDPARETO","ORG.GNUMERIC.RANDPARETO" },
+ { "RANDPOISSON","ORG.GNUMERIC.RANDPOISSON" },
+ { "RANDRAYLEIGH","ORG.GNUMERIC.RANDRAYLEIGH" },
+ { "RANDRAYLEIGHTAIL","ORG.GNUMERIC.RANDRAYLEIGHTAIL" },
+ { "RANDTDIST","ORG.GNUMERIC.RANDTDIST" },
+ { "RANDUNIFORM","ORG.GNUMERIC.RANDUNIFORM" },
+ { "RANDWEIBULL","ORG.GNUMERIC.RANDWEIBULL" },
+ { "RAYLEIGH","ORG.GNUMERIC.RAYLEIGH" },
+ { "RAYLEIGHTAIL","ORG.GNUMERIC.RAYLEIGHTAIL" },
+ { "READDBTABLE","ORG.GNUMERIC.READDBTABLE" },
+ { "R.DBETA","ORG.GNUMERIC.R.DBETA" },
+ { "R.DBINOM","ORG.GNUMERIC.R.DBINOM" },
+ { "R.DCAUCHY","ORG.GNUMERIC.R.DCAUCHY" },
+ { "R.DCHISQ","ORG.GNUMERIC.R.DCHISQ" },
+ { "R.DEXP","ORG.GNUMERIC.R.DEXP" },
+ { "R.DF","ORG.GNUMERIC.R.DF" },
+ { "R.DGAMMA","ORG.GNUMERIC.R.DGAMMA" },
+ { "R.DGEOM","ORG.GNUMERIC.R.DGEOM" },
+ { "R.DHYPER","ORG.GNUMERIC.R.DHYPER" },
+ { "R.DLNORM","ORG.GNUMERIC.R.DLNORM" },
+ { "R.DNBINOM","ORG.GNUMERIC.R.DNBINOM" },
+ { "R.DNORM","ORG.GNUMERIC.R.DNORM" },
+ { "R.DPOIS","ORG.GNUMERIC.R.DPOIS" },
+ { "R.DT","ORG.GNUMERIC.R.DT" },
+ { "R.DWEIBULL","ORG.GNUMERIC.R.DWEIBULL" },
+ { "R.PBETA","ORG.GNUMERIC.R.PBETA" },
+ { "R.PBINOM","ORG.GNUMERIC.R.PBINOM" },
+ { "R.PCAUCHY","ORG.GNUMERIC.R.PCAUCHY" },
+ { "R.PCHISQ","ORG.GNUMERIC.R.PCHISQ" },
+ { "R.PEXP","ORG.GNUMERIC.R.PEXP" },
+ { "R.PF","ORG.GNUMERIC.R.PF" },
+ { "R.PGAMMA","ORG.GNUMERIC.R.PGAMMA" },
+ { "R.PGEOM","ORG.GNUMERIC.R.PGEOM" },
+ { "R.PHYPER","ORG.GNUMERIC.R.PHYPER" },
+ { "R.PLNORM","ORG.GNUMERIC.R.PLNORM" },
+ { "R.PNBINOM","ORG.GNUMERIC.R.PNBINOM" },
+ { "R.PNORM","ORG.GNUMERIC.R.PNORM" },
+ { "R.PPOIS","ORG.GNUMERIC.R.PPOIS" },
+ { "R.PT","ORG.GNUMERIC.R.PT" },
+ { "R.PWEIBULL","ORG.GNUMERIC.R.PWEIBULL" },
+ { "R.QBETA","ORG.GNUMERIC.R.QBETA" },
+ { "R.QBINOM","ORG.GNUMERIC.R.QBINOM" },
+ { "R.QCAUCHY","ORG.GNUMERIC.R.QCAUCHY" },
+ { "R.QCHISQ","ORG.GNUMERIC.R.QCHISQ" },
+ { "R.QEXP","ORG.GNUMERIC.R.QEXP" },
+ { "R.QF","ORG.GNUMERIC.R.QF" },
+ { "R.QGAMMA","ORG.GNUMERIC.R.QGAMMA" },
+ { "R.QGEOM","ORG.GNUMERIC.R.QGEOM" },
+ { "R.QHYPER","ORG.GNUMERIC.R.QHYPER" },
+ { "R.QLNORM","ORG.GNUMERIC.R.QLNORM" },
+ { "R.QNBINOM","ORG.GNUMERIC.R.QNBINOM" },
+ { "R.QNORM","ORG.GNUMERIC.R.QNORM" },
+ { "R.QPOIS","ORG.GNUMERIC.R.QPOIS" },
+ { "R.QT","ORG.GNUMERIC.R.QT" },
+ { "R.QWEIBULL","ORG.GNUMERIC.R.QWEIBULL" },
+ { "SIMTABLE","ORG.GNUMERIC.SIMTABLE" },
+ { "SSMEDIAN","ORG.GNUMERIC.SSMEDIAN" },
+ { "SUMA","ORG.GNUMERIC.SUMA" },
+ { "UNIX2DATE","ORG.GNUMERIC.UNIX2DATE" },
/* { "ABS","ABS" }, */
/* { "ACCRINT","ACCRINT" }, */
@@ -1607,10 +1622,8 @@ odf_expr_func_handler (GnmConventionsOut *out, GnmExprFunction const *func)
/* { "FACT","FACT" }, */
/* { "FACTDOUBLE","FACTDOUBLE" }, */
/* { "FALSE","FALSE" }, */
-/* { "FDIST","FDIST" }, different definition */
/* { "FIND","FIND" }, */
/* /\* { "FINDB","FINDB" }, *\/ */
-/* { "FINV","FINV" }, different definition*/
/* { "FISHER","FISHER" }, */
/* { "FISHERINV","FISHERINV" }, */
/* { "FIXED","FIXED" }, */
@@ -1876,11 +1889,11 @@ odf_expr_func_handler (GnmConventionsOut *out, GnmExprFunction const *func)
{ NULL, NULL }
};
static GHashTable *namemap = NULL;
-
+ static GHashTable *handlermap = NULL;
+
char const *name = gnm_func_get_name (func->func);
- char const *new_name;
- GString *target = out->accum;
-
+ gboolean (*handler) (GnmConventionsOut *out, GnmExprFunction const *func);
+
if (NULL == namemap) {
guint i;
namemap = g_hash_table_new (go_ascii_strcase_hash,
@@ -1890,20 +1903,35 @@ odf_expr_func_handler (GnmConventionsOut *out, GnmExprFunction const *func)
(gchar *) sc_func_renames[i].gnm_name,
(gchar *) sc_func_renames[i].odf_name);
}
+ if (NULL == handlermap) {
+ guint i;
+ handlermap = g_hash_table_new (go_ascii_strcase_hash,
+ go_ascii_strcase_equal);
+ for (i = 0; sc_func_handlers[i].gnm_name; i++)
+ g_hash_table_insert (handlermap,
+ (gchar *) sc_func_handlers[i].gnm_name,
+ sc_func_handlers[i].handler);
+ }
- new_name = g_hash_table_lookup (namemap, name);
-
- if (new_name == NULL) {
- char *new_u_name;
- if (*(name + 1) == '.')
- g_string_append (target, "ORG.GNUMERIC.");
- new_u_name = g_ascii_strup (name, -1);
- g_string_append (target, new_u_name);
- g_free (new_u_name);
- } else
- g_string_append (target, new_name);
+ handler = g_hash_table_lookup (handlermap, name);
- gnm_expr_list_as_string (func->argc, func->argv, out);
+ if (handler == NULL || !handler (out, func)) {
+ char const *new_name = g_hash_table_lookup (namemap, name);
+ GString *target = out->accum;
+
+ if (new_name == NULL) {
+ char *new_u_name;
+ if (*(name + 1) == '.')
+ g_string_append (target, "ORG.GNUMERIC.");
+ new_u_name = g_ascii_strup (name, -1);
+ g_string_append (target, new_u_name);
+ g_free (new_u_name);
+ }
+ else
+ g_string_append (target, new_name);
+
+ gnm_expr_list_as_string (func->argc, func->argv, out);
+ }
return;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]