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

Modified Files:
      Tag: PF_ROX
        opt_algebra_cse.c opt_complex.c opt_const.c opt_dom.c 
        opt_general.brg opt_guide.c opt_icol.c opt_join_graph.c 
        opt_join_pd.c opt_key.c opt_mvd.c opt_reqval.c opt_set.c 
        opt_thetajoin.c 
Log Message:
propagated changes of Friday 15 Feb 2008 - Monday Feb 18 2008
from the development trunk to the PF_ROX branch


Index: opt_algebra_cse.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/opt/opt_algebra_cse.c,v
retrieving revision 1.11.4.1
retrieving revision 1.11.4.2
diff -u -d -r1.11.4.1 -r1.11.4.2
--- opt_algebra_cse.c   9 Feb 2008 08:40:18 -0000       1.11.4.1
+++ opt_algebra_cse.c   18 Feb 2008 16:57:18 -0000      1.11.4.2
@@ -42,21 +42,12 @@
 #include "logical_mnemonic.h"
 #include "ordering.h"
 
-/* compare types in staircase join operator nodes */
-#include "subtyping.h"
-
 #include <assert.h>
 #include <string.h> /* strcmp */
 #include <stdio.h>
 
-/*
- * Easily access subtree-parts.
- */
-
-/* starting from p, make a step left     */
-#define L(p)         ((p)->child[0])
-/* starting from p, make a right step    */
-#define R(p)         ((p)->child[1])
+/* Easily access subtree-parts */
+#include "child_mnemonic.h"
 
 /* prune already checked nodes           */
 #define SEEN(p)      ((p)->bit_dag)
@@ -674,68 +665,6 @@
 }
 
 /**
- * Check the equivalence of two atoms.
- */
-static bool
-atom_eq (PFalg_atom_t a, PFalg_atom_t b)
-{
-    if (a.type != b.type)
-        return false;
-
-    switch (a.type) {
-        /* if type is nat, compare nat member of union */
-        case aat_nat:
-            if (a.val.nat_ == b.val.nat_)
-                return true;
-            break;
-        /* if type is int, compare int member of union */
-        case aat_int:
-            if (a.val.int_ == b.val.int_)
-                return true;
-            break;
-        /* if type is str, compare str member of union */
-        case aat_uA:
-        case aat_str:
-            if (!strcmp (a.val.str,
-                         b.val.str))
-                return true;
-            break;
-        /* if type is float, compare float member of union */
-        case aat_dec:
-            if (a.val.dec_ == b.val.dec_)
-                return true;
-            break;
-        /* if type is double, compare double member of union */
-        case aat_dbl:
-            if (a.val.dbl == b.val.dbl)
-                return true;
-            break;
-        /* if type is boolean, compare double member of union */
-        case aat_bln:
-            if ((a.val.bln &&
-                 b.val.bln) ||
-                (!a.val.bln
-                  && !b.val.bln))
-                return true;
-            break;
-        case aat_qname:
-            if (!PFqname_eq (a.val.qname, b.val.qname))
-                return true;
-            break;
-        /* anything else is actually bogus (e.g. there are no
-         * literal nodes */
-        default:
-        {
-            PFinfo (OOPS_WARNING, "literal value that do not make sense");
-            return true;
-        } break;
-    }
- 
-    /* if you get there every test failed */
-    return false;
-}
-
-/**
  * Test the equality of two literal table tuples.
  *
  * @param a Tuple to test against tuple @a b.
@@ -755,7 +684,8 @@
 
     for (i = 0; i < a.count; i++) {
         /* check the equivalence */
-        mismatch = atom_eq (a.atoms[i], b.atoms[i])?false:true; 
+        mismatch = !(PFalg_atom_comparable (a.atoms[i], b.atoms[i]) && 
+                     (PFalg_atom_cmp (a.atoms[i], b.atoms[i]) == 0)); 
         
         if (mismatch)
             break;
@@ -892,8 +822,8 @@
                                         b->sem.attach.value))
                 return false;
 
-            if (!atom_eq (a->sem.attach.value,
-                          b->sem.attach.value))
+            if (PFalg_atom_cmp (a->sem.attach.value,
+                                b->sem.attach.value) != 0)
                 return false;
             
             return true;
@@ -1114,8 +1044,10 @@
                  ACTATT (R(b), b->sem.step.iter)) &&
                 (ACTATT (R(a), a->sem.step.item) ==
                  ACTATT (R(b), b->sem.step.item))  &&
-                PFty_eq (a->sem.step.ty, b->sem.step.ty) &&
-                (a->sem.step.axis == b->sem.step.axis) &&
+                (a->sem.step.spec.axis == b->sem.step.spec.axis) &&
+                (a->sem.step.spec.kind == b->sem.step.spec.kind) &&
+                (!PFqname_eq (a->sem.step.spec.qname,
+                              b->sem.step.spec.qname)) &&
                 (a->sem.step.level == b->sem.step.level))
                 return true;
 
@@ -1127,8 +1059,10 @@
                  ACTATT (R(b), b->sem.step.iter)) &&
                 (ACTATT (R(a), a->sem.step.item) ==
                  ACTATT (R(b), b->sem.step.item))  &&
-                PFty_eq (a->sem.step.ty, b->sem.step.ty) &&
-                (a->sem.step.axis == b->sem.step.axis) &&
+                (a->sem.step.spec.axis == b->sem.step.spec.axis) &&
+                (a->sem.step.spec.kind == b->sem.step.spec.kind) &&
+                (!PFqname_eq (a->sem.step.spec.qname,
+                              b->sem.step.spec.qname)) &&
                 (a->sem.step.level == b->sem.step.level) &&
                 (a->sem.step.guide_count == b->sem.step.guide_count)))
                 return false;
@@ -1281,7 +1215,8 @@
 
     /* check every item of the column */
     for (i = 0; i < littbl1->sem.lit_tbl.count; i++) {
-        if (!atom_eq (a[i].atoms[col1], b[i].atoms[col2]))
+        if (!(PFalg_atom_comparable (a[i].atoms[col1], b[i].atoms[col2]) &&
+              (PFalg_atom_cmp (a[i].atoms[col1], b[i].atoms[col2]) == 0)))
             return false;
     } 
     return true;
@@ -1813,8 +1748,7 @@
 
         case la_step:
             return PFla_step (CSE(L(n)), CSE(R(n)),
-                              n->sem.step.axis,
-                              n->sem.step.ty,
+                              n->sem.step.spec,
                               n->sem.step.level,
                               ACTATT (R(n), n->sem.step.iter),
                               ACTATT (R(n), n->sem.step.item),
@@ -1822,8 +1756,7 @@
 
         case la_step_join:
             return PFla_step_join (CSE(L(n)), CSE(R(n)),
-                                   n->sem.step.axis,
-                                   n->sem.step.ty,
+                                   n->sem.step.spec,
                                    n->sem.step.level,
                                    ACTATT (R(n), n->sem.step.item),
                                    create_unq_name (CSE(R(n))->schema,
@@ -1831,8 +1764,7 @@
 
         case la_guide_step:
             return PFla_guide_step (CSE(L(n)), CSE(R(n)),
-                                    n->sem.step.axis,
-                                    n->sem.step.ty,
+                                    n->sem.step.spec,
                                     n->sem.step.guide_count,
                                     n->sem.step.guides,
                                     n->sem.step.level,
@@ -1842,8 +1774,7 @@
 
         case la_guide_step_join:
             return PFla_guide_step_join (CSE(L(n)), CSE(R(n)),
-                                         n->sem.step.axis,
-                                         n->sem.step.ty,
+                                         n->sem.step.spec,
                                          n->sem.step.guide_count,
                                          n->sem.step.guides,
                                          n->sem.step.level,

Index: opt_join_pd.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/opt/opt_join_pd.c,v
retrieving revision 1.37.4.1
retrieving revision 1.37.4.2
diff -u -d -r1.37.4.1 -r1.37.4.2
--- opt_join_pd.c       9 Feb 2008 08:40:23 -0000       1.37.4.1
+++ opt_join_pd.c       18 Feb 2008 16:57:19 -0000      1.37.4.2
@@ -82,21 +82,8 @@
 /* mnemonic algebra constructors */
 #include "logical_mnemonic.h"
 
-/*
- * Easily access subtree-parts.
- */
-/** starting from p, make a step left */
-#define L(p) ((p)->child[0])
-/** starting from p, make a step right */
-#define R(p) ((p)->child[1])
-/** starting from p, make two steps left */
-#define LL(p) L(L(p))
-/** starting from p, make a step left, then a step right */
-#define LR(p) R(L(p))
-/** starting from p, make a step right, then a step left */
-#define RL(p) L(R(p))
-/** starting from p, make two steps right */
-#define RR(p) R(R(p))
+/* Easily access subtree-parts */
+#include "child_mnemonic.h"
 
 #define SEEN(p) ((p)->bit_dag)
 #define LEFT(p) ((p)->bit_in)
@@ -1636,8 +1623,7 @@
                                L(lp),
                                eqjoin_unq (R(lp), rp, latt, ratt,
                                            p->sem.eqjoin_unq.res),
-                               lp->sem.step.axis,
-                               lp->sem.step.ty,
+                               lp->sem.step.spec,
                                lp->sem.step.level,
                                is_join_att(p, lp->sem.step.item)
                                   ? p->sem.eqjoin_unq.res
@@ -1653,8 +1639,7 @@
                                L(lp),
                                eqjoin_unq (R(lp), rp, latt, ratt,
                                            p->sem.eqjoin_unq.res),
-                               lp->sem.step.axis,
-                               lp->sem.step.ty,
+                               lp->sem.step.spec,
                                lp->sem.step.guide_count,
                                lp->sem.step.guides,
                                lp->sem.step.level,

Index: opt_icol.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/opt/opt_icol.c,v
retrieving revision 1.20.4.1
retrieving revision 1.20.4.2
diff -u -d -r1.20.4.1 -r1.20.4.2
--- opt_icol.c  9 Feb 2008 08:40:23 -0000       1.20.4.1
+++ opt_icol.c  18 Feb 2008 16:57:19 -0000      1.20.4.2
@@ -43,20 +43,8 @@
 #include "alg_dag.h"
 #include "mem.h"          /* PFmalloc() */
 
-/*
- * Easily access subtree-parts.
- */
-/** starting from p, make a step left */
-#define L(p) ((p)->child[0])
-/** starting from p, make a step right */
-#define R(p) ((p)->child[1])
-/** starting from p, make two steps left */
-#define LL(p) L(L(p))
-/** and so on... */
-#define RL(p) L(R(p))
-#define LRL(p) L(R(L(p)))
-#define LLL(p) L(L(L(p)))
-#define LLR(p) R(L(L(p)))
+/* Easily access subtree-parts */
+#include "child_mnemonic.h"
 
 #define SEEN(p) ((p)->bit_dag)
 

Index: opt_reqval.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/opt/opt_reqval.c,v
retrieving revision 1.13
retrieving revision 1.13.2.1
diff -u -d -r1.13 -r1.13.2.1
--- opt_reqval.c        14 Jan 2008 14:03:25 -0000      1.13
+++ opt_reqval.c        18 Feb 2008 16:57:19 -0000      1.13.2.1
@@ -43,17 +43,8 @@
 #include "alg_dag.h"
 #include "mem.h"          /* PFmalloc() */
 
-/*
- * Easily access subtree-parts.
- */
-/** starting from p, make a step left */
-#define L(p) ((p)->child[0])
-/** starting from p, make a step right */
-#define R(p) ((p)->child[1])
-#define LL(p) (L(L(p)))
-#define RL(p) (L(R(p)))
-#define LR(p) (R(L(p)))
-#define RR(p) (R(R(p)))
+/* Easily access subtree-parts */
+#include "child_mnemonic.h"
 
 /* worker for PFalgopt_reqval */
 static void

Index: opt_guide.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/opt/opt_guide.c,v
retrieving revision 1.12
retrieving revision 1.12.4.1
diff -u -d -r1.12 -r1.12.4.1
--- opt_guide.c 11 Jan 2008 10:46:58 -0000      1.12
+++ opt_guide.c 18 Feb 2008 16:57:18 -0000      1.12.4.1
@@ -41,20 +41,14 @@
 #include "properties.h"
 #include "alg_dag.h"
 
+/* Easily access subtree-parts */
+#include "child_mnemonic.h"
+
 #define SEEN(n) ((n)->bit_dag)
 /* prop of n */
 #define PROP(n) ((n)->prop)
 /* axis of n, n must be a step */
-#define AXIS(n) ((n)->sem.step.axis)
-/*
- * Easily access subtree-parts.
- */
-/** starting from p, make a step left */
-#define L(p) ((p)->child[0])
-/** starting from p, make a step right */
-#define R(p) ((p)->child[1])
-/** starting from p, make two steps right */
-#define RR(p) (((p)->child[1])->child[1])
+#define AXIS(n) ((n)->sem.step.spec.axis)
 
 /* Merge 2 guide_steps if it is possible */
 static void
@@ -261,15 +255,15 @@
                 /* create new step operator */
                 if (n->kind == la_step) {
                     ret = PFla_guide_step (
-                              L(n), R(n), n->sem.step.axis,
-                              n->sem.step.ty, count, guides,
+                              L(n), R(n), n->sem.step.spec,
+                              count, guides,
                               n->sem.step.level,
                               n->sem.step.iter, n->sem.step.item,
                               n->sem.step.item_res);
                 } else {
                     ret = PFla_guide_step_join (
-                              L(n), R(n), n->sem.step.axis,
-                              n->sem.step.ty, count, guides,
+                              L(n), R(n), n->sem.step.spec,
+                              count, guides,
                               n->sem.step.level,
                               n->sem.step.item,
                               n->sem.step.item_res);
@@ -286,9 +280,9 @@
 
         case la_guide_step_join:
             if ((PFprop_set (n->prop) ||
-                ((n->sem.step.axis == alg_chld ||
-                  n->sem.step.axis == alg_attr ||
-                  n->sem.step.axis == alg_self) &&
+                ((n->sem.step.spec.axis == alg_chld ||
+                  n->sem.step.spec.axis == alg_attr ||
+                  n->sem.step.spec.axis == alg_self) &&
                  find_guide_max (n->sem.step.guide_count,
                                  n->sem.step.guides) <= 1)) &&
                 !PFprop_icol (n->prop, n->sem.step.item))

Index: opt_const.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/opt/opt_const.c,v
retrieving revision 1.28
retrieving revision 1.28.4.1
diff -u -d -r1.28 -r1.28.4.1
--- opt_const.c 11 Jan 2008 10:46:57 -0000      1.28
+++ opt_const.c 18 Feb 2008 16:57:18 -0000      1.28.4.1
@@ -43,13 +43,8 @@
 #include "alg_dag.h"
 #include "mem.h"          /* PFmalloc() */
 
-/*
- * Easily access subtree-parts.
- */
-/** starting from p, make a step left */
-#define L(p) ((p)->child[0])
-/** starting from p, make a step right */
-#define R(p) ((p)->child[1])
+/* Easily access subtree-parts */
+#include "child_mnemonic.h"
 
 #define SEEN(p) ((p)->bit_dag)
 

Index: opt_set.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/opt/opt_set.c,v
retrieving revision 1.8
retrieving revision 1.8.4.1
diff -u -d -r1.8 -r1.8.4.1
--- opt_set.c   11 Jan 2008 10:46:58 -0000      1.8
+++ opt_set.c   18 Feb 2008 16:57:19 -0000      1.8.4.1
@@ -43,18 +43,8 @@
 #include "alg_dag.h"
 #include "mem.h"          /* PFmalloc() */
 
-/*
- * Easily access subtree-parts.
- */
-/** starting from p, make a step left */
-#define L(p) ((p)->child[0])
-/** starting from p, make a step right */
-#define R(p) ((p)->child[1])
-/** and so on ... */
-#define LL(p) (L(L(p)))
-#define LR(p) (R(L(p)))
-#define RL(p) (L(R(p)))
-#define RR(p) (R(R(p)))
+/* Easily access subtree-parts */
+#include "child_mnemonic.h"
 
 #define SEEN(p) ((p)->bit_dag)
 
@@ -92,8 +82,7 @@
                              PFla_step_join (
                                  LL(p),
                                  LR(p),
-                                 L(p)->sem.step.axis,
-                                 L(p)->sem.step.ty,
+                                 L(p)->sem.step.spec,
                                  L(p)->sem.step.level,
                                  L(p)->sem.step.item,
                                  item_res),
@@ -115,8 +104,7 @@
                              PFla_step_join (
                                  RL(p),
                                  RR(p),
-                                 R(p)->sem.step.axis,
-                                 R(p)->sem.step.ty,
+                                 R(p)->sem.step.spec,
                                  R(p)->sem.step.level,
                                  R(p)->sem.step.item,
                                  item_res),
@@ -147,8 +135,7 @@
                                       p->sem.step.item)),
                               p->sem.step.iter,
                               PFalg_lit_nat (1)),
-                          p->sem.step.axis,
-                          p->sem.step.ty,
+                          p->sem.step.spec,
                           p->sem.step.level,
                           p->sem.step.iter,
                           p->sem.step.item,
@@ -180,8 +167,7 @@
                               PFalg_proj (p->sem.step.item_res,
                                           p->sem.step.item),
                               PFalg_proj (iter, iter)),
-                          p->sem.step.axis,
-                          p->sem.step.ty,
+                          p->sem.step.spec,
                           p->sem.step.level,
                           iter,
                           p->sem.step.item_res,
@@ -203,8 +189,7 @@
                                       p->sem.step.item)),
                               p->sem.step.iter,
                               PFalg_lit_nat (1)),
-                          p->sem.step.axis,
-                          p->sem.step.ty,
+                          p->sem.step.spec,
                           p->sem.step.guide_count,
                           p->sem.step.guides,
                           p->sem.step.level,

Index: opt_general.brg
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/opt/opt_general.brg,v
retrieving revision 1.45.4.1
retrieving revision 1.45.4.2
diff -u -d -r1.45.4.1 -r1.45.4.2
--- opt_general.brg     9 Feb 2008 08:40:22 -0000       1.45.4.1
+++ opt_general.brg     18 Feb 2008 16:57:18 -0000      1.45.4.2
@@ -42,7 +42,9 @@
 #include "alg_dag.h"
 #include "oops.h"         /* PFoops() */
 #include "mem.h"          /* PFmalloc() */
-#include "subtyping.h"
+
+/* Easily access subtree-parts */
+#include "child_mnemonic.h"
 
 /*
  * Accessors for the burg matcher
@@ -335,22 +337,6 @@
 
 #include "algebra_mnemonic.h"
 
-/*
- * Easily access subtree-parts.
- */
-/** starting from p, make a step left */
-#define L(p) (LEFT_CHILD(p))
-/** starting from p, make a step right */
-#define R(p) (RIGHT_CHILD(p))
-/** starting from p, make two steps left */
-#define LL(p) L(L(p))
-/** starting from p, make two steps right */
-#define RR(p) R(R(p))
-/** and so on... */
-#define RL(p) (L(R(p)))
-#define LLL(p) (LL(L(p)))
-#define RLL(p) (LL(R(p)))
-
 #define MAX_KIDS 10
 
 #define SEEN(p) ((p)->bit_dag)
@@ -1134,14 +1120,15 @@
         case 63:
             /* combine steps if they are of the form:
                ``/descandent-or-self::node()/child::element()'' */
-            if (R(p)->sem.step.axis == alg_desc_s &&
-                PFty_equality (R(p)->sem.step.ty, PFty_xs_anyNode ()) &&
-                p->sem.step.axis == alg_chld) {
+            if (R(p)->sem.step.spec.axis == alg_desc_s &&
+                R(p)->sem.step.spec.kind == node_kind_node &&
+                p->sem.step.spec.axis == alg_chld) {
+                PFalg_step_spec_t spec = p->sem.step.spec;
+                spec.axis = alg_desc,
                 /* rewrite child into descendant
                    and discard descendant-or-self step */
                 *p = *PFla_step_simple (
-                          L(p), RR(p),
-                          alg_desc, p->sem.step.ty,
+                          L(p), RR(p), spec,
                           p->sem.step.iter, R(p)->sem.step.item,
                           p->sem.step.item_res);
                 SEEN(p) = false;

Index: opt_complex.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/opt/opt_complex.c,v
retrieving revision 1.39.2.1
retrieving revision 1.39.2.2
diff -u -d -r1.39.2.1 -r1.39.2.2
--- opt_complex.c       9 Feb 2008 08:40:18 -0000       1.39.2.1
+++ opt_complex.c       18 Feb 2008 16:57:18 -0000      1.39.2.2
@@ -43,21 +43,8 @@
 #include "alg_dag.h"
 #include "mem.h"          /* PFmalloc() */
 
-/*
- * Easily access subtree-parts.
- */
-/** starting from p, make a step left */
-#define L(p) ((p)->child[0])
-/** starting from p, make a step right */
-#define R(p) ((p)->child[1])
-#define LL(p) (L(L(p)))
-#define RL(p) (L(R(p)))
-#define LR(p) (R(L(p)))
-#define LLL(p) (LL(L(p)))
-#define LLR(p) (R(LL(p)))
-#define LRL(p) (L(LR(p)))
-#define LRLL(p) (LL(LR(p)))
-#define LLRL(p) (RL(LL(p)))
+/* Easily access subtree-parts */
+#include "child_mnemonic.h"
 
 #define SEEN(p) ((p)->bit_dag)
 
@@ -1205,12 +1192,12 @@
                 p->sem.step.level = PFprop_level (p->prop,
                                                   p->sem.step.item_res);
 
-            if ((p->sem.step.axis == alg_desc ||
-                 p->sem.step.axis == alg_desc_s) &&
+            if ((p->sem.step.spec.axis == alg_desc ||
+                 p->sem.step.spec.axis == alg_desc_s) &&
                 p->sem.step.level >= 1 &&
                 p->sem.step.level - 1 == PFprop_level (R(p)->prop,
                                                        p->sem.step.item))
-                p->sem.step.axis = alg_chld;
+                p->sem.step.spec.axis = alg_chld;
 
             if (R(p)->kind == la_project &&
                 RL(p)->kind == la_step) {
@@ -1233,8 +1220,7 @@
                     *p = *PFla_project (PFla_step (
                                             L(p),
                                             RL(p),
-                                            p->sem.step.axis,
-                                            p->sem.step.ty,
+                                            p->sem.step.spec,
                                             p->sem.step.level,
                                             RL(p)->sem.step.iter,
                                             RL(p)->sem.step.item,
@@ -1244,7 +1230,7 @@
                 break;
             }
             else if (R(p)->kind == la_rowid &&
-                     p->sem.step.axis == alg_chld &&
+                     p->sem.step.spec.axis == alg_chld &&
                      p->sem.step.iter == R(p)->sem.rowid.res &&
                      !PFprop_icol (p->prop, p->sem.step.iter) &&
                      PFprop_key (p->prop, p->sem.step.item)) {
@@ -1265,12 +1251,12 @@
                 p->sem.step.level = level;
             }
 
-            if ((p->sem.step.axis == alg_desc ||
-                 p->sem.step.axis == alg_desc_s) &&
+            if ((p->sem.step.spec.axis == alg_desc ||
+                 p->sem.step.spec.axis == alg_desc_s) &&
                 p->sem.step.level >= 1 &&
                 p->sem.step.level - 1 == PFprop_level (R(p)->prop,
                                                        p->sem.step.item))
-                p->sem.step.axis = alg_chld;
+                p->sem.step.spec.axis = alg_chld;
             break;
 
         case la_step_join:
@@ -1278,12 +1264,12 @@
                 p->sem.step.level = PFprop_level (p->prop,
                                                   p->sem.step.item_res);
 
-            if ((p->sem.step.axis == alg_desc ||
-                 p->sem.step.axis == alg_desc_s) &&
+            if ((p->sem.step.spec.axis == alg_desc ||
+                 p->sem.step.spec.axis == alg_desc_s) &&
                 p->sem.step.level >= 1 &&
                 p->sem.step.level - 1 == PFprop_level (R(p)->prop,
                                                        p->sem.step.item))
-                p->sem.step.axis = alg_chld;
+                p->sem.step.spec.axis = alg_chld;
             break;
 
         case la_fcns:

Index: opt_thetajoin.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/opt/opt_thetajoin.c,v
retrieving revision 1.16.2.1
retrieving revision 1.16.2.2
diff -u -d -r1.16.2.1 -r1.16.2.2
--- opt_thetajoin.c     9 Feb 2008 08:40:26 -0000       1.16.2.1
+++ opt_thetajoin.c     18 Feb 2008 16:57:19 -0000      1.16.2.2
@@ -61,26 +61,8 @@
 /* mnemonic algebra constructors */
 #include "logical_mnemonic.h"
 
-/*
- * Easily access subtree-parts.
- */
-/** starting from p, make a step left */
-#define L(p) ((p)->child[0])
-/** starting from p, make a step right */
-#define R(p) ((p)->child[1])
-/** starting from p, make two steps left */
-#define LL(p) L(L(p))
-/** starting from p, make a step left, then a step right */
-#define LR(p) R(L(p))
-/** starting from p, make a step right, then a step left */
-#define RL(p) L(R(p))
-/** starting from p, make two steps right */
-#define RR(p) R(R(p))
-/** and so on ... */
-#define LLL(p) L(L(L(p)))
-#define LRL(p) L(R(L(p)))
-#define RLL(p) L(L(R(p)))
-#define RRL(p) L(R(R(p)))
+/* Easily access subtree-parts */
+#include "child_mnemonic.h"
 
 #define SEEN(p) ((p)->bit_dag)
 
@@ -1695,16 +1677,14 @@
                     *p = *(thetajoin_opt (step_join (
                                                 L(p),
                                                 RL(p),
-                                                p->sem.step.axis,
-                                                p->sem.step.ty,
+                                                p->sem.step.spec,
                                                 p->sem.step.level,
                                                 p->sem.step.item,
                                                 p->sem.step.item_res),
                                           step_join (
                                                 L(p),
                                                 RR(p),
-                                                p->sem.step.axis,
-                                                p->sem.step.ty,
+                                                p->sem.step.spec,
                                                 p->sem.step.level,
                                                 p->sem.step.item,
                                                 p->sem.step.item_res),
@@ -1715,8 +1695,7 @@
                     resolve_name_conflict (R(p), p->sem.step.item_res);
                     *p = *(thetajoin_opt (step_join (
                                                 L(p), RL(p),
-                                                p->sem.step.axis,
-                                                p->sem.step.ty,
+                                                p->sem.step.spec,
                                                 p->sem.step.level,
                                                 p->sem.step.item,
                                                 p->sem.step.item_res),
@@ -1730,8 +1709,7 @@
                                           step_join (
                                                 L(p),
                                                 RR(p),
-                                                p->sem.step.axis,
-                                                p->sem.step.ty,
+                                                p->sem.step.spec,
                                                 p->sem.step.level,
                                                 p->sem.step.item,
                                                 p->sem.step.item_res),
@@ -1751,8 +1729,7 @@
                     *p = *(thetajoin_opt (guide_step_join (
                                                 L(p),
                                                 RL(p),
-                                                p->sem.step.axis,
-                                                p->sem.step.ty,
+                                                p->sem.step.spec,
                                                 p->sem.step.guide_count,
                                                 p->sem.step.guides,
                                                 p->sem.step.level,
@@ -1761,8 +1738,7 @@
                                           guide_step_join (
                                                 L(p),
                                                 RR(p),
-                                                p->sem.step.axis,
-                                                p->sem.step.ty,
+                                                p->sem.step.spec,
                                                 p->sem.step.guide_count,
                                                 p->sem.step.guides,
                                                 p->sem.step.level,
@@ -1775,8 +1751,7 @@
                     resolve_name_conflict (R(p), p->sem.step.item_res);
                     *p = *(thetajoin_opt (guide_step_join (
                                                 L(p), RL(p),
-                                                p->sem.step.axis,
-                                                p->sem.step.ty,
+                                                p->sem.step.spec,
                                                 p->sem.step.guide_count,
                                                 p->sem.step.guides,
                                                 p->sem.step.level,
@@ -1792,8 +1767,7 @@
                                           guide_step_join (
                                                 L(p),
                                                 RR(p),
-                                                p->sem.step.axis,
-                                                p->sem.step.ty,
+                                                p->sem.step.spec,
                                                 p->sem.step.guide_count,
                                                 p->sem.step.guides,
                                                 p->sem.step.level,

Index: opt_mvd.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/opt/opt_mvd.c,v
retrieving revision 1.32.4.1
retrieving revision 1.32.4.2
diff -u -d -r1.32.4.1 -r1.32.4.2
--- opt_mvd.c   9 Feb 2008 08:40:25 -0000       1.32.4.1
+++ opt_mvd.c   18 Feb 2008 16:57:19 -0000      1.32.4.2
@@ -56,26 +56,8 @@
 /* mnemonic algebra constructors */
 #include "logical_mnemonic.h"
 
-/*
- * Easily access subtree-parts.
- */
-/** starting from p, make a step left */
-#define L(p) ((p)->child[0])
-/** starting from p, make a step right */
-#define R(p) ((p)->child[1])
-/** starting from p, make two steps left */
-#define LL(p) L(L(p))
-/** starting from p, make a step left, then a step right */
-#define LR(p) R(L(p))
-/** starting from p, make a step right, then a step left */
-#define RL(p) L(R(p))
-/** starting from p, make two steps right */
-#define RR(p) R(R(p))
-/** and so on ... */
-#define LLL(p) L(L(L(p)))
-#define LRL(p) L(R(L(p)))
-#define RLL(p) L(L(R(p)))
-#define RRL(p) L(R(R(p)))
+/* Easily access subtree-parts */
+#include "child_mnemonic.h"
 
 #define SEEN(p) ((p)->bit_dag)
 
@@ -1222,8 +1204,7 @@
                                             attach (RL(p),
                                                     p->sem.step.iter,
                                                     lit_nat(1)),
-                                            p->sem.step.axis,
-                                            p->sem.step.ty,
+                                            p->sem.step.spec,
                                             p->sem.step.level,
                                             p->sem.step.iter,
                                             p->sem.step.item,
@@ -1237,8 +1218,7 @@
                                             attach (RR(p),
                                                     p->sem.step.iter,
                                                     lit_nat(1)),
-                                            p->sem.step.axis,
-                                            p->sem.step.ty,
+                                            p->sem.step.spec,
                                             p->sem.step.level,
                                             p->sem.step.iter,
                                             p->sem.step.item,
@@ -1259,16 +1239,14 @@
                 *p = *(cross_can (step_join (
                                         L(p),
                                         RL(p),
-                                        p->sem.step.axis,
-                                        p->sem.step.ty,
+                                        p->sem.step.spec,
                                         p->sem.step.level,
                                         p->sem.step.item,
                                         p->sem.step.item_res),
                                   step_join (
                                         L(p),
                                         RR(p),
-                                        p->sem.step.axis,
-                                        p->sem.step.ty,
+                                        p->sem.step.spec,
                                         p->sem.step.level,
                                         p->sem.step.item,
                                         p->sem.step.item_res)));
@@ -1277,8 +1255,7 @@
             else if (switch_left) {
                 *p = *(cross_can (step_join (
                                         L(p), RL(p),
-                                        p->sem.step.axis,
-                                        p->sem.step.ty,
+                                        p->sem.step.spec,
                                         p->sem.step.level,
                                         p->sem.step.item,
                                         p->sem.step.item_res),
@@ -1290,8 +1267,7 @@
                                   step_join (
                                         L(p),
                                         RR(p),
-                                        p->sem.step.axis,
-                                        p->sem.step.ty,
+                                        p->sem.step.spec,
                                         p->sem.step.level,
                                         p->sem.step.item,
                                         p->sem.step.item_res)));
@@ -1310,8 +1286,7 @@
                                         attach (RL(p),
                                                 p->sem.step.iter,
                                                 lit_nat(1)),
-                                        p->sem.step.axis,
-                                        p->sem.step.ty,
+                                        p->sem.step.spec,
                                         p->sem.step.guide_count,
                                         p->sem.step.guides,
                                         p->sem.step.level,
@@ -1328,8 +1303,7 @@
                                         attach (RR(p),
                                                 p->sem.step.iter,
                                                 lit_nat(1)),
-                                        p->sem.step.axis,
-                                        p->sem.step.ty,
+                                        p->sem.step.spec,
                                         p->sem.step.guide_count,
                                         p->sem.step.guides,
                                         p->sem.step.level,
@@ -1352,8 +1326,7 @@
                 *p = *(cross_can (guide_step_join (
                                         L(p),
                                         RL(p),
-                                        p->sem.step.axis,
-                                        p->sem.step.ty,
+                                        p->sem.step.spec,
                                         p->sem.step.guide_count,
                                         p->sem.step.guides,
                                         p->sem.step.level,
@@ -1362,8 +1335,7 @@
                                   guide_step_join (
                                         L(p),
                                         RR(p),
-                                        p->sem.step.axis,
-                                        p->sem.step.ty,
+                                        p->sem.step.spec,
                                         p->sem.step.guide_count,
                                         p->sem.step.guides,
                                         p->sem.step.level,
@@ -1374,8 +1346,7 @@
             else if (switch_left) {
                 *p = *(cross_can (guide_step_join (
                                         L(p), RL(p),
-                                        p->sem.step.axis,
-                                        p->sem.step.ty,
+                                        p->sem.step.spec,
                                         p->sem.step.guide_count,
                                         p->sem.step.guides,
                                         p->sem.step.level,
@@ -1389,8 +1360,7 @@
                                   guide_step_join (
                                         L(p),
                                         RR(p),
-                                        p->sem.step.axis,
-                                        p->sem.step.ty,
+                                        p->sem.step.spec,
                                         p->sem.step.guide_count,
                                         p->sem.step.guides,
                                         p->sem.step.level,

Index: opt_dom.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/opt/opt_dom.c,v
retrieving revision 1.10
retrieving revision 1.10.4.1
diff -u -d -r1.10 -r1.10.4.1
--- opt_dom.c   11 Jan 2008 10:46:57 -0000      1.10
+++ opt_dom.c   18 Feb 2008 16:57:18 -0000      1.10.4.1
@@ -43,13 +43,8 @@
 #include "alg_dag.h"
 #include "mem.h"          /* PFmalloc() */
 
-/*
- * Easily access subtree-parts.
- */
-/** starting from p, make a step left */
-#define L(p) ((p)->child[0])
-/** starting from p, make a step right */
-#define R(p) ((p)->child[1])
+/* Easily access subtree-parts */
+#include "child_mnemonic.h"
 
 #define SEEN(p) ((p)->bit_dag)
 

Index: opt_join_graph.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/opt/opt_join_graph.c,v
retrieving revision 1.9.4.1
retrieving revision 1.9.4.2
diff -u -d -r1.9.4.1 -r1.9.4.2
--- opt_join_graph.c    9 Feb 2008 08:40:23 -0000       1.9.4.1
+++ opt_join_graph.c    18 Feb 2008 16:57:19 -0000      1.9.4.2
@@ -49,16 +49,8 @@
 #include "alg_dag.h"
 #include "mem.h"          /* PFmalloc() */
 
-/*
- * Easily access subtree-parts.
- */
-/** starting from p, make a step left */
-#define L(p) ((p)->child[0])
-/** starting from p, make a step right */
-#define R(p) ((p)->child[1])
-#define LL(p) (L(L(p)))
-#define RL(p) (L(R(p)))
-#define LR(p) (R(L(p)))
+/* Easily access subtree-parts */
+#include "child_mnemonic.h"
 
 #define SEEN(p) ((p)->bit_dag)
 
@@ -186,13 +178,13 @@
            of unnecessary eqjoin and rowid operators */
         case la_step:
             if ((PFprop_key_right (p->prop, p->sem.step.item) &&
-                 (p->sem.step.axis == alg_attr ||
-                  p->sem.step.axis == alg_chld ||
-                  p->sem.step.axis == alg_self)) ||
+                 (p->sem.step.spec.axis == alg_attr ||
+                  p->sem.step.spec.axis == alg_chld ||
+                  p->sem.step.spec.axis == alg_self)) ||
                 (PFprop_key_right (p->prop, p->sem.step.item) &&
                  PFprop_level_right (p->prop, p->sem.step.item) >= 0 &&
-                 (p->sem.step.axis == alg_desc ||
-                  p->sem.step.axis == alg_desc_s))) {
+                 (p->sem.step.spec.axis == alg_desc ||
+                  p->sem.step.spec.axis == alg_desc_s))) {
 
                 PFalg_att_t item_res;
                 item_res = PFalg_ori_name (
@@ -204,8 +196,7 @@
                              PFla_step_join (
                                  L(p),
                                  R(p),
-                                 p->sem.step.axis,
-                                 p->sem.step.ty,
+                                 p->sem.step.spec,
                                  p->sem.step.level,
                                  p->sem.step.item,
                                  item_res),
@@ -223,14 +214,14 @@
         case la_guide_step:
             if (((PFprop_key_right (p->prop, p->sem.step.item) ||
                   PFprop_ckey (R(p)->prop, p->schema)) &&
-                 (p->sem.step.axis == alg_attr ||
-                  p->sem.step.axis == alg_chld ||
-                  p->sem.step.axis == alg_self)) ||
+                 (p->sem.step.spec.axis == alg_attr ||
+                  p->sem.step.spec.axis == alg_chld ||
+                  p->sem.step.spec.axis == alg_self)) ||
                 ((PFprop_key_right (p->prop, p->sem.step.item) ||
                   PFprop_ckey (R(p)->prop, p->schema)) &&
                  PFprop_level_right (p->prop, p->sem.step.item) >= 0 &&
-                 (p->sem.step.axis == alg_desc ||
-                  p->sem.step.axis == alg_desc_s))) {
+                 (p->sem.step.spec.axis == alg_desc ||
+                  p->sem.step.spec.axis == alg_desc_s))) {
 
                 PFalg_att_t item_res;
                 item_res = PFalg_ori_name (
@@ -242,8 +233,7 @@
                              PFla_guide_step_join (
                                  L(p),
                                  R(p),
-                                 p->sem.step.axis,
-                                 p->sem.step.ty,
+                                 p->sem.step.spec,
                                  p->sem.step.guide_count,
                                  p->sem.step.guides,
                                  p->sem.step.level,
@@ -358,8 +348,7 @@
                              PFla_step_join (
                                  L(p),
                                  R(p),
-                                 p->sem.step.axis,
-                                 p->sem.step.ty,
+                                 p->sem.step.spec,
                                  p->sem.step.level,
                                  p->sem.step.item,
                                  item_res),
@@ -387,8 +376,7 @@
                              PFla_guide_step_join (
                                  L(p),
                                  R(p),
-                                 p->sem.step.axis,
-                                 p->sem.step.ty,
+                                 p->sem.step.spec,
                                  p->sem.step.guide_count,
                                  p->sem.step.guides,
                                  p->sem.step.level,

Index: opt_key.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/opt/opt_key.c,v
retrieving revision 1.18
retrieving revision 1.18.4.1
diff -u -d -r1.18 -r1.18.4.1
--- opt_key.c   11 Jan 2008 10:46:58 -0000      1.18
+++ opt_key.c   18 Feb 2008 16:57:19 -0000      1.18.4.1
@@ -43,13 +43,8 @@
 #include "alg_dag.h"
 #include "mem.h"          /* PFmalloc() */
 
-/*
- * Easily access subtree-parts.
- */
-/** starting from p, make a step left */
-#define L(p) ((p)->child[0])
-/** starting from p, make a step right */
-#define R(p) ((p)->child[1])
+/* Easily access subtree-parts */
+#include "child_mnemonic.h"
 
 #define SEEN(p) ((p)->bit_dag)
 


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Monetdb-pf-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins

Reply via email to