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

Modified Files:
        physdebug.c 
Log Message:
-- Implemented generic function application facility (for the physical algebra).

   Generic functions can now be implemented in the physical algebra using
   the 4 operators pa_fun_call, pa_fun_param, pa_fun_frag_param, and
   pa_frag_extract.  Their semantics is identical to the logical operators
   (see yesterdays checkin message).

-- Added special case for XRPC function calls whose arguments are now
   always sorted by iter, post.

   NOTE: The output order of XRPC function calls is not defined yet.
         If XRPC functions return the results always in a defined order
         the fun_call constructor in physical.c has to be adjusted accordingly.

-- Added function call stub in milgen.brg.

   The implementation of function calls only has to replace the dummy action 
code
   (variable assignments to nil) AND has to enrich the variable environment 
correctly
   (instead of adding dummy variables to it).

   NOTE: The variable environments of the function arguments do not necessarily
         provide all references to BATs that are required by the function 
signature.
         The compilation fills only the BATs for the existing types. This can 
happen
         if the function expects an argument of type item* and the function 
argument
         consists of strings only. The function definition (e.g., the XRPC 
receiver)
         then has to cope with all non-existing BATs.

         The function application operator furthermore needs to fill the 
environment
         for all possible result types. All result BATs therefore have to exist
         (even if they only contains nil values). If the function specifies its
         return type to be item* and the function returns only strings then 
additional
         BATs for integer, double, decimal, untypedAtomic, ... filled with nil 
values
         are also needed.



Index: physdebug.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/debug/physdebug.c,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -d -r1.45 -r1.46
--- physdebug.c 11 Dec 2007 14:25:55 -0000      1.45
+++ physdebug.c 14 Dec 2007 12:02:34 -0000      1.46
@@ -119,6 +119,7 @@
     , [pa_merge_adjacent]  = "#pf:merge-adjacent-text-nodes"
     , [pa_roots]           = "ROOTS"
     , [pa_fragment]        = "FRAGs"
+    , [pa_frag_extract]    = "FRAG EXTRACT"
     , [pa_frag_union]      = "FRAG_UNION"
     , [pa_empty_frag]      = "EMPTY_FRAG"
     , [pa_error]           = "!ERROR"
@@ -132,6 +133,9 @@
     , [pa_rec_arg]         = "rec arg"
     , [pa_rec_base]        = "rec base"
     , [pa_rec_border]      = "rec border"
+    , [pa_fun_call]        = "fun call"
+    , [pa_fun_param]       = "fun param"
+    , [pa_fun_frag_param]  = "fun frag param"
     , [pa_string_join]     = "fn:string-join"
 };
 
@@ -204,6 +208,7 @@
     , [pa_merge_adjacent]  = "#pf:merge-adjacent-text-nodes"
     , [pa_roots]           = "roots"
     , [pa_fragment]        = "frags"
+    , [pa_frag_extract]    = "frag extract"
     , [pa_frag_union]      = "frag_union"
     , [pa_empty_frag]      = "empty_frag"
     , [pa_error]           = "!ERROR"
@@ -217,6 +222,9 @@
     , [pa_rec_arg]         = "rec_arg"
     , [pa_rec_base]        = "rec_base"
     , [pa_rec_border]      = "rec_border"
+    , [pa_fun_call]        = "function call"
+    , [pa_fun_param]       = "function call parameter"
+    , [pa_fun_frag_param]  = "function call fragment parameter"
     , [pa_string_join]     = "fn:string-join"
 };
 
@@ -403,6 +411,7 @@
         , [pa_merge_adjacent]  = "\"#00D000\""
         , [pa_roots]           = "\"#E0E0E0\""
         , [pa_fragment]        = "\"#E0E0E0\""
+        , [pa_frag_extract]    = "\"#DD22DD\""
         , [pa_frag_union]      = "\"#E0E0E0\""
         , [pa_empty_frag]      = "\"#E0E0E0\""
         , [pa_error]           = "\"#C0C0C0\""
@@ -416,6 +425,9 @@
         , [pa_rec_arg]         = "\"#BB00BB\""
         , [pa_rec_base]        = "\"#BB00BB\""
         , [pa_rec_border]      = "\"#BB00BB\""
+        , [pa_fun_call]        = "\"#BB00BB\""
+        , [pa_fun_param]       = "\"#BB00BB\""
+        , [pa_fun_frag_param]  = "\"#BB00BB\""
         , [pa_string_join]     = "\"#C0C0C0\""
     };
 
@@ -746,6 +758,35 @@
                             PFatt_str (n->sem.trace_map.outer));
             break;
         
+        case pa_fun_call:
+            PFarray_printf (dot,
+                            "%s function \\\"%s\\\" (",
+                            PFalg_fun_call_kind_str (n->sem.fun_call.kind),
+                            PFqname_uri_str (n->sem.fun_call.qname));
+            for (unsigned int i = 0; i < n->schema.count; i++)
+                PFarray_printf (dot, "%s%s",
+                                i?", ":"",
+                                PFatt_str (n->schema.items[i].name));
+            PFarray_printf (dot,
+                            ")\\n(loop: %s)",
+                            PFatt_str (n->sem.fun_call.iter));
+            break;
+            
+        case pa_fun_param:
+            PFarray_printf (dot, "%s (", a_id[n->kind]);
+            for (unsigned int i = 0; i < n->schema.count; i++)
+                PFarray_printf (dot, "%s%s",
+                                i?", ":"",
+                                PFatt_str (n->schema.items[i].name));
+            PFarray_printf (dot, ")");
+            break;
+            
+        case pa_frag_extract:
+        case pa_fun_frag_param:
+            PFarray_printf (dot, "%s (referencing column %i)",
+                            a_id[n->kind], n->sem.col_ref.pos);
+            break;
+            
         case pa_serialize:
         case pa_cross:
         case pa_append_union:
@@ -1648,6 +1689,37 @@
                             PFstrdup (n->sem.err.str));
             break;
 
+        case pa_fun_call:
+            PFarray_printf (xml,
+                            "    <content>\n"
+                            "      <function uri=\"%s\" name=\"%s\"/>\n"
+                            "      <kind name=\"%s\"/>\n"
+                            "      <column name=\"%s\" function=\"iter\"/>\n"
+                            "    </content>\n",
+                            PFqname_uri (n->sem.fun_call.qname),
+                            PFqname_loc (n->sem.fun_call.qname),
+                            PFalg_fun_call_kind_str (n->sem.fun_call.kind),
+                            PFatt_str (n->sem.fun_call.iter));
+            break;
+            
+        case pa_fun_param:
+            PFarray_printf (xml, "    <content>\n"); 
+            for (c = 0; c < n->schema.count; c++)
+                PFarray_printf (xml, 
+                                "      <column name=\"%s\" 
position=\"%u\"/>\n",
+                                PFatt_str (n->schema.items[c].name), c);
+            PFarray_printf (xml, "    </content>\n");
+            break;
+
+        case pa_frag_extract:
+        case pa_fun_frag_param:
+            PFarray_printf (xml,
+                            "    <content>\n"
+                            "      <column reference=\"%i\"/>\n"
+                            "    </content>\n",
+                            n->sem.col_ref.pos);
+            break;
+
         case pa_string_join:
             PFarray_printf (xml,
                             "    <content>\n"


-------------------------------------------------------------------------
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://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Monetdb-pf-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins

Reply via email to