[gnumeric] add chisq.inv xls import and xlsx import/export



commit 5436074c5eefa7d9e56df55055573352fc2af986
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date:   Fri Jun 21 17:26:34 2013 -0600

    add chisq.inv xls import and xlsx import/export
    
    2013-06-21  Andreas J. Guelzow <aguelzow pyrshep ca>
    
        * ms-formula-read.c (ms-formula-read.c): add
        "chisq.inv" --> "r.qchisq"
        * xlsx-utils.c (xlsx_func_chisqinv_output_handler): new
        (xlsx_conventions_new): connect new handler and add
        "chisq.inv" --> "r.qchisq" translation
    
    2

 plugins/excel/ChangeLog         |    8 ++++++++
 plugins/excel/ms-formula-read.c |    1 +
 plugins/excel/xlsx-utils.c      |   17 +++++++++++++++++
 3 files changed, 26 insertions(+), 0 deletions(-)
---
diff --git a/plugins/excel/ChangeLog b/plugins/excel/ChangeLog
index 5853d7b..dced50c 100644
--- a/plugins/excel/ChangeLog
+++ b/plugins/excel/ChangeLog
@@ -1,5 +1,13 @@
 2013-06-21  Andreas J. Guelzow <aguelzow pyrshep ca>
 
+       * ms-formula-read.c (ms-formula-read.c): add
+       "chisq.inv" --> "r.qchisq"
+       * xlsx-utils.c (xlsx_func_chisqinv_output_handler): new
+       (xlsx_conventions_new): connect new handler and add
+       "chisq.inv" --> "r.qchisq" translation
+
+2013-06-21  Andreas J. Guelzow <aguelzow pyrshep ca>
+
        * xlsx-utils.h: remove duplicates
        (xlsx_conventions_new): add argument
        * xlsx-read.c (xlsx_file_open): add argument to
diff --git a/plugins/excel/ms-formula-read.c b/plugins/excel/ms-formula-read.c
index f5d7d80..fda34e1 100644
--- a/plugins/excel/ms-formula-read.c
+++ b/plugins/excel/ms-formula-read.c
@@ -481,6 +481,7 @@ xl2010_synonyms (const char *name)
                { "beta.inv", "betainv" },
                { "binom.dist", "binomdist" },
                { "chisq.dist.rt", "chidist" },
+               { "chisq.inv", "r.qchisq" },
                { "chisq.inv.rt", "chiinv" },
                { "chisq.test", "chitest" },
                { "confidence.norm", "confidence" },
diff --git a/plugins/excel/xlsx-utils.c b/plugins/excel/xlsx-utils.c
index 58a8293..8229a92 100644
--- a/plugins/excel/xlsx-utils.c
+++ b/plugins/excel/xlsx-utils.c
@@ -211,6 +211,7 @@ xlsx_func_binominv_handler (G_GNUC_UNUSED GnmConventions const *convs, G_GNUC_UN
 
 static gboolean
 xlsx_func_binominv_output_handler (GnmConventionsOut *out, GnmExprFunction const *func)
+/* R.QBINOM(c,a,b) --> BINOM.INV(a,b,c) */
 {
        if (func->argc == 3) {
                GString *target = out->accum;
@@ -227,6 +228,19 @@ xlsx_func_binominv_output_handler (GnmConventionsOut *out, GnmExprFunction const
        return FALSE;
 }
 
+static gboolean
+xlsx_func_chisqinv_output_handler (GnmConventionsOut *out, GnmExprFunction const *func)
+/* R.QCHISQ(a,b) --> CHISQ.INV(a,b) */
+{
+       if (func->argc == 3) {
+               GString *target = out->accum;
+               g_string_append (target, "_xlfn.CHISQ.INV");
+               gnm_expr_list_as_string (func->argc, func->argv, out);
+               return TRUE;
+       }
+       return FALSE;
+}
+
 
 GnmConventions *
 xlsx_conventions_new (gboolean output)
@@ -244,6 +258,7 @@ xlsx_conventions_new (gboolean output)
                gpointer handler;
        } const xlfn_func_output_handlers[] = {
                {"R.QBINOM", xlsx_func_binominv_output_handler},
+               {"R.QCHISQ", xlsx_func_chisqinv_output_handler},
                {NULL, NULL}
        };
        
@@ -253,7 +268,9 @@ xlsx_conventions_new (gboolean output)
        } const xlfn_func_renames[] = {
                { "BETA.INV", "BETAINV" },
                { "BINOM.DIST", "BINOMDIST" },
+               /* { "BINOM.INV", "R.QBINOM" }, see handlers */
                { "CHISQ.DIST.RT", "CHIDIST" },
+               { "CHISQ.INV", "R.QCHISQ" }, /* see output handler */
                { "CHISQ.INV.RT", "CHIINV" },
                { "CHISQ.TEST", "CHITEST" },
                { "CONFIDENCE.NORM", "CONFIDENCE" },


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