Update of /cvsroot/monetdb/pathfinder/compiler/mil
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv14873/compiler/mil
Modified Files:
milprint_summer.c
Log Message:
The XQuery functions and operators lack several mathematical functions. I added
natural logarithm (log) and square root (sqrt) as part of the "pf" namespace.
Index: milprint_summer.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/mil/milprint_summer.c,v
retrieving revision 1.382
retrieving revision 1.383
diff -u -d -r1.382 -r1.383
--- milprint_summer.c 19 May 2007 01:43:59 -0000 1.382
+++ milprint_summer.c 24 May 2007 09:59:07 -0000 1.383
@@ -4684,7 +4684,7 @@
/**
* fn_abs translates the builtin functions fn:abs, fn:ceiling, fn:floor,
- * and fn:round
+ * fn:round, pf:log, and pf:sqrt.
*
* @param f the Stream the MIL code is printed to
* @param code the number indicating, which result interface is preferred
@@ -7524,6 +7524,31 @@
fn_abs (f, code, rc, "round_up");
return rc;
}
+ else if (!PFqname_eq(fnQname,PFqname (PFns_lib,"log")))
+ {
+ rc = translate2MIL (f, VALUES, cur_level, counter, L(args));
+ if (rc == NORMAL)
+ {
+ assert (fun->sig_count == 1);
+ rc = get_kind(fun->sigs[0].ret_ty);
+ milprintf(f, "item%s := item%s;\n", kind_str(rc), val_join(rc));
+ }
+ fn_abs (f, code, rc, "log");
+ return rc;
+ }
+ else if (!PFqname_eq(fnQname,PFqname (PFns_lib,"sqrt")))
+ {
+ rc = translate2MIL (f, VALUES, cur_level, counter, L(args));
+ if (rc == NORMAL)
+ {
+ assert (fun->sig_count == 1);
+ rc = get_kind(fun->sigs[0].ret_ty);
+ milprintf(f, "item%s := item%s;\n", kind_str(rc), val_join(rc));
+ }
+ fn_abs (f, code, rc, "sqrt");
+ return rc;
+ }
+
/* calculation functions just call an extra function with
their operator argument to avoid code duplication */
else if (!PFqname_eq(fnQname,PFqname (PFns_op,"plus")))
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Monetdb-pf-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins