Update of /cvsroot/monetdb/pathfinder/compiler/algebra
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv4225/algebra
Modified Files:
logical.c
Log Message:
-- Remove debug printing (icc was complaining about).
-- Clean up constructor for the negation operator (not).
U logical.c
Index: logical.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/logical.c,v
retrieving revision 1.92
retrieving revision 1.93
diff -u -d -r1.92 -r1.93
--- logical.c 7 Apr 2008 11:01:04 -0000 1.92
+++ logical.c 9 Apr 2008 07:11:45 -0000 1.93
@@ -68,12 +68,6 @@
boolean_op (PFla_op_kind_t kind, const PFla_op_t *n, PFalg_att_t att1,
PFalg_att_t att2, PFalg_att_t res);
-/* Encapsulates initialization stuff common to unary operators. */
-static PFla_op_t *
-unary_op (PFla_op_kind_t kind, const PFla_op_t *n, PFalg_att_t att,
- PFalg_att_t res);
-
-
/**
* Create a logical algebra operator (leaf) node.
*
@@ -991,8 +985,8 @@
fprintf (stderr,
"\nThe following error is triggered"
" in line %i of function %s() in file %s\n"
- "The input is of kind %d and has the schema (",
- line, func, file, n->kind);
+ "The input has the schema (",
+ line, func, file);
for (unsigned int k = 0; k < n->schema.count; k++)
fprintf (stderr, "%s%s",
k ? ", " : "",
@@ -1019,8 +1013,8 @@
fprintf (stderr,
"\nThe following error is triggered"
" in line %i of function %s() in file %s\n"
- "The input is of kind %d and has the schema (",
- line, func, file, n->kind);
+ "The input has the schema (",
+ line, func, file);
for (unsigned int k = 0; k < n->schema.count; k++)
fprintf (stderr, "%s%s",
k ? ", " : "",
@@ -1737,7 +1731,47 @@
PFla_op_t *
PFla_not (const PFla_op_t *n, PFalg_att_t res, PFalg_att_t att)
{
- return unary_op (la_bool_not, n, res, att);
+ PFla_op_t *ret;
+ unsigned int i;
+
+ assert (n);
+
+ /* verify that 'att' is an attribute of n ... */
+ if (!PFprop_ocol (n, att))
+ PFoops (OOPS_FATAL,
+ "attribute `%s' referenced in not operation not found",
+ PFatt_str (att));
+
+ assert (!PFprop_ocol (n, res));
+
+ /* assert that 'att' is of correct type */
+ assert (PFprop_type_of (n, att) == aat_bln);
+
+ /* create new unary operator node */
+ ret = la_op_wire1 (la_bool_not, n);
+
+ /* insert semantic value (operand attribute and result attribute)
+ * into the result
+ */
+ ret->sem.unary.att = att;
+ ret->sem.unary.res = res;
+
+ /* allocate memory for the result schema (schema(n) + 'res') */
+ ret->schema.count = n->schema.count + 1;
+ ret->schema.items
+ = PFmalloc (ret->schema.count * sizeof (*(ret->schema.items)));
+
+ /* copy schema from 'n' argument */
+ for (i = 0; i < n->schema.count; i++)
+ ret->schema.items[i] = n->schema.items[i];
+
+ /* add the information on the 'res' attribute; it has the same type
+ * as attribute 'att', but a different name
+ */
+ ret->schema.items[ret->schema.count - 1].name = res;
+ ret->schema.items[ret->schema.count - 1].type = aat_bln;
+
+ return ret;
}
@@ -1887,69 +1921,6 @@
/**
- * Encapsulates initialization stuff common to unary operators.
- *
- * Depending on the @a kind parameter, we process the value of
- * column @a att and stores the result in newly created attribute
- * @a res. @a res gets the same data type as @a att. The result
- * schema corresponds to the schema of the input relation @a n plus
- * @a res.
- */
-static PFla_op_t *
-unary_op(PFla_op_kind_t kind, const PFla_op_t *n, PFalg_att_t res,
- PFalg_att_t att)
-{
- PFla_op_t *ret;
- unsigned int i;
- unsigned int ix = 0;
-
- assert (n);
-
- /* verify that 'att' is an attribute of n ... */
- for (i = 0; i < n->schema.count; i++)
- if (att == n->schema.items[i].name) {
- ix = i; /* remember array index of att */
- break;
- }
-
- /* did we find attribute 'att'? */
- if (i >= n->schema.count)
- PFoops (OOPS_FATAL,
- "attribute `%s' referenced in unary operation not found",
- PFatt_str (att));
-
- /* assert that 'att' is of correct type */
- if (kind == la_bool_not)
- assert (n->schema.items[ix].type == aat_bln);
-
- /* create new unary operator node */
- ret = la_op_wire1 (kind, n);
-
- /* insert semantic value (operand attribute and result attribute)
- * into the result
- */
- ret->sem.unary.att = att;
- ret->sem.unary.res = res;
-
- /* allocate memory for the result schema (schema(n) + 'res') */
- ret->schema.count = n->schema.count + 1;
- ret->schema.items
- = PFmalloc (ret->schema.count * sizeof (*(ret->schema.items)));
-
- /* copy schema from 'n' argument */
- for (i = 0; i < n->schema.count; i++)
- ret->schema.items[i] = n->schema.items[i];
-
- /* add the information on the 'res' attribute; it has the same type
- * as attribute 'att', but a different name
- */
- ret->schema.items[ret->schema.count - 1] = n->schema.items[ix];
- ret->schema.items[ret->schema.count - 1].name = res;
-
- return ret;
-}
-
-/**
* Constructor for op:to operator
*/
PFla_op_t *
@@ -4308,7 +4279,7 @@
n->sem.binary.att2);
case la_bool_not:
- return unary_op (n->kind, left,
+ return PFla_not (left,
n->sem.unary.res,
n->sem.unary.att);
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Monetdb-pf-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins