Update of /cvsroot/monetdb/pathfinder/compiler/algebra
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv20201/compiler/algebra

Modified Files:
        algebra_cse.c builtins.c logical.c 
Log Message:
Basic Algebra implementation for the fn:error functions (32 files edited).
Introduced a new operator on the logical level, namely la_error.
Operator la_error takes a BAT of strings as parameter (containing the error
message) and carry it all the way until the MIL level where the conditions are
checked and the mil if-statement is printed.

Disclaimer:
Most likely the switch-case clauses on the prop/ and opt/ directories
are not always treated correctly for the la_error operator, but a man has
to start from somewhere.


Index: algebra_cse.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/algebra_cse.c,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -d -r1.60 -r1.61
--- algebra_cse.c       6 Dec 2007 08:42:09 -0000       1.60
+++ algebra_cse.c       10 Dec 2007 15:09:59 -0000      1.61
@@ -455,6 +455,9 @@
             return false;
             break;
 
+        case la_error:
+            return false;
+            break;
         case la_cond_err:
             return (a->sem.err.att == b->sem.err.att
                     && a->sem.err.str == b->sem.err.str);

Index: logical.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/logical.c,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -d -r1.69 -r1.70
--- logical.c   6 Dec 2007 22:41:33 -0000       1.69
+++ logical.c   10 Dec 2007 15:10:00 -0000      1.70
@@ -3440,6 +3440,31 @@
     return ret;
 }
 
+/**
+ * Construct for an error message.
+ *
+ */
+PFla_op_t *
+PFla_error (const PFla_op_t *n)
+{
+    PFla_op_t    *ret;
+    unsigned int i;
+
+    assert(n);
+
+    ret = la_op_wire1 (la_error, n);
+
+    /* allocate memory for the result schema; it's the same schema as n's */
+    ret->schema.count = n->schema.count;
+    ret->schema.items
+        = PFmalloc (ret->schema.count * sizeof (*(ret->schema.items)));
+
+    /* copy schema from argument 'n' */
+    for (i = 0; i < n->schema.count; i++)
+        ret->schema.items[i] = n->schema.items[i];
+
+    return ret;
+}
 
 /**
  * Constructor for a conditional error message.
@@ -4235,6 +4260,9 @@
         case la_empty_frag:
             return PFla_empty_frag ();
 
+        case la_error:
+            return PFla_error (left);
+
         case la_cond_err:
             return PFla_cond_err (left, right,
                                   n->sem.err.att,

Index: builtins.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/builtins.c,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -d -r1.65 -r1.66
--- builtins.c  6 Dec 2007 08:42:12 -0000       1.65
+++ builtins.c  10 Dec 2007 15:09:59 -0000      1.66
@@ -637,7 +637,9 @@
     (void) loop; (void) ordering; (void) args;
 
     return (struct PFla_pair_t) {
-        .rel  = NULL,
+        .rel  = error( project (args[0].rel,
+                                proj (att_iter, att_iter),
+                                proj (att_item, att_item))),
         .frag = PFla_empty_set ()};
 }
 


-------------------------------------------------------------------------
SF.Net email is sponsored by: 
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Monetdb-pf-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins

Reply via email to