[gnumeric] ODF handling of PHI



commit 0736395335da2434736f19a0dac49d9dc940332a
Author: Andreas J. Guelzow <aguelzow pyrshep ca>
Date:   Sun Aug 23 22:30:12 2009 -0600

    ODF handling of PHI
    
    2009-08-23  Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* openoffice-read.c (odf_func_phi_handler): new
    	(oo_func_map_in): map PHI to NORMDIST

 plugins/openoffice/ChangeLog         |    5 +++++
 plugins/openoffice/openoffice-read.c |   20 +++++++++++++++++++-
 2 files changed, 24 insertions(+), 1 deletions(-)
---
diff --git a/plugins/openoffice/ChangeLog b/plugins/openoffice/ChangeLog
index fa797a2..f55da7f 100644
--- a/plugins/openoffice/ChangeLog
+++ b/plugins/openoffice/ChangeLog
@@ -1,5 +1,10 @@
 2009-08-23  Andreas J. Guelzow <aguelzow pyrshep ca>
 
+	* openoffice-read.c (odf_func_phi_handler): new
+	(oo_func_map_in): map PHI to NORMDIST
+
+2009-08-23  Andreas J. Guelzow <aguelzow pyrshep ca>
+
 	* openoffice-read.c (oo_func_map_in): no need to map SEARCHB
 	* openoffice-write.c (odf_expr_func_handler): we now have 
 	  SEARCHB
diff --git a/plugins/openoffice/openoffice-read.c b/plugins/openoffice/openoffice-read.c
index df268dd..90d09c4 100644
--- a/plugins/openoffice/openoffice-read.c
+++ b/plugins/openoffice/openoffice-read.c
@@ -4323,6 +4323,23 @@ odf_func_address_handler (GnmConventions const *convs, Workbook *scope, GnmExprL
 }
 
 static GnmExpr const *
+odf_func_phi_handler (GnmConventions const *convs, Workbook *scope, GnmExprList *args)
+{
+	GnmFunc  *f = gnm_func_lookup_or_add_placeholder ("NORMDIST", scope, FALSE);
+	
+	args = g_slist_append ((GSList *) args,
+			       (gpointer) gnm_expr_new_constant (value_new_int (0)));
+	args = g_slist_append ((GSList *) args,
+			       (gpointer) gnm_expr_new_constant (value_new_int (1)));
+
+	args = g_slist_append ((GSList *) args,
+			       (gpointer) gnm_expr_new_funcall 
+			       (gnm_func_lookup_or_add_placeholder ("FALSE", scope, FALSE), NULL));
+	
+	return gnm_expr_new_funcall (f, args);
+}
+
+static GnmExpr const *
 odf_func_floor_handler (GnmConventions const *convs, Workbook *scope, GnmExprList *args)
 {
 	guint argc = gnm_expr_list_length (args);
@@ -4548,6 +4565,7 @@ oo_func_map_in (GnmConventions const *convs, Workbook *scope,
 		{"CEILING", odf_func_ceiling_handler},
 		{"FLOOR", odf_func_floor_handler},
 		{"ADDRESS", odf_func_address_handler},
+		{"PHI", odf_func_phi_handler},
 		{NULL, NULL}
 	};
 	
@@ -4578,7 +4596,6 @@ oo_func_map_in (GnmConventions const *convs, Workbook *scope,
 		{ "MUNIT","ODF.MUNIT" },
 		{ "NUMBERVALUE","ODF.NUMBERVALUE" },
 		{ "PDURATION","ODF.PDURATION" },
-		{ "PHI","ODF.PHI" },
 		{ "RRI","ODF.RRI" },
 		{ "SHEET","ODF.SHEET" },
 		{ "SHEETS","ODF.SHEETS" },
@@ -4599,6 +4616,7 @@ oo_func_map_in (GnmConventions const *convs, Workbook *scope,
 		{ "LEGACY.FINV","FINV" },
 		{ "LEGACY.NORMSDIST","NORMSDIST" },
 		{ "LEGACY.NORMSINV","NORMSINV" },
+		{ "PHI","NORMDIST" },              /* see handler */
 		{ "USDOLLAR","DOLLAR" },
 
 /* { "ADDRESS","ADDRESS" },       also  see handler */



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