Update of /cvsroot/monetdb/pathfinder/compiler/xmlimport
In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv16065/xmlimport

Modified Files:
        xml2lalg.c xml2lalg_converters.c 
Log Message:
-- print all fun_call information to the XML output.

-- Extend XML import to cope with fun_calls.


U xml2lalg.c
Index: xml2lalg.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/xmlimport/xml2lalg.c,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- xml2lalg.c  8 Apr 2009 07:47:13 -0000       1.32
+++ xml2lalg.c  6 May 2009 21:32:42 -0000       1.33
@@ -214,6 +214,15 @@
                     PFxml2la_xpath_getNthNode(XPATH(xpath), 0)))
 
 /**              
+ * Macro return-type:  PFalg_fun_call_t 
+ * XPath return-type:  attribute(){1}
+ */
+#define PFLA_FUNCALLKIND(xpath) \
+            PFxml2la_conv_2PFLA_fun_callkind( \
+                PFxml2la_xpath_getAttributeValueFromAttributeNode( \
+                    PFxml2la_xpath_getNthNode(XPATH(xpath), 0)))
+
+/**              
  * Macro return-type:  PFalg_simple_type_t 
  * XPath return-type:  attribute(){1}
  */
@@ -1905,7 +1914,7 @@
             newAlgNode = PFla_frag_extract
              (
              CHILDNODE(0),
-             PFLA_ATT("/content/column/@reference")
+             A2INT_O("/content/column/@reference", -1)
              );
         }  
         break;
@@ -2079,8 +2088,30 @@
     case la_fun_call             : 
 
         {
-            PFoops (OOPS_FATAL,
-                    "Import of la_fun_call operator is not implemented yet");
+            /* get occurrence indicator */
+            unsigned int    min = A2INT_O("/content/output/@min",0),
+                            max = A2INT_O("/content/output/@min",2);
+            PFalg_occ_ind_t occ_ind;
+
+            if (min == 1) { if (max == 1) occ_ind = alg_occ_exactly_one;
+                            else          occ_ind = alg_occ_one_or_more; }
+            else {          if (max == 1) occ_ind = alg_occ_zero_or_one;
+                            else          occ_ind = alg_occ_unknown; }
+
+            newAlgNode = PFla_fun_call
+             (
+             CHILDNODE(0), CHILDNODE(1),
+             PFLA_SCHEMA("/content/output/column"),
+             PFLA_FUNCALLKIND("/content/kind/@name"),
+             PFqname (
+                 (PFns_t)
+                 { .prefix = NULL,
+                   .uri    = A2STR_O("/content/function/@uri", NULL) },
+                 A2STR_O("/content/function/@name", NULL)),
+             NULL,
+             PFLA_ATT("/content/colu...@function='iter']/@name"),
+             occ_ind
+             );
         }  
         break;
 
@@ -2090,8 +2121,11 @@
     case la_fun_param            : 
 
         {
-            PFoops (OOPS_FATAL,
-                    "Import of la_fun_param operator is not implemented yet");
+            newAlgNode = PFla_fun_param
+             (
+             CHILDNODE(0), CHILDNODE(1),
+             PFLA_SCHEMA("/content/column")
+             );
         }  
         break;
 
@@ -2101,9 +2135,11 @@
     case la_fun_frag_param       : 
 
         {
-            PFoops (OOPS_FATAL,
-                    "Import of la_fun_frag_param operator "
-                    "is not implemented yet");
+            newAlgNode = PFla_fun_frag_param
+             (
+             CHILDNODE(0), CHILDNODE(1),
+             A2INT_O("/content/column/@reference", -1)
+             );
         }  
         break;
 
@@ -2491,9 +2527,19 @@
         PFalg_simple_type_t columnType = PFxml2la_conv_2PFLA_atomType(
             PFxml2la_xpath_getAttributeValueFromElementNode(
                 column_xml, "type"));
+
+        /* in case we have a schema in a fixed order
+           we respect that order */
+        unsigned int pos = i;
+        char *pos_str = 
+            PFxml2la_xpath_getAttributeValueFromElementNode(
+                column_xml, "pos");
     
-        schema.items[i].name = columnName;
-        schema.items[i].type = columnType; 
+        if (pos_str)
+            pos = atoi (pos_str);
+
+        schema.items[pos].name = columnName;
+        schema.items[pos].type = columnType; 
     }
     
     return  schema;

U xml2lalg_converters.c
Index: xml2lalg_converters.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/xmlimport/xml2lalg_converters.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- xml2lalg_converters.c       8 Apr 2009 07:54:08 -0000       1.26
+++ xml2lalg_converters.c       6 May 2009 21:32:43 -0000       1.27
@@ -424,6 +424,30 @@
     return node_kind_node;
 }
 
+PFalg_fun_call_t 
+PFxml2la_conv_2PFLA_fun_callkind(char* s) 
+{
+    if (false) return node_kind_node; /* discard first case */
+#define mapto_fun_call_kind(kind)                              \
+    else if (strcmp (s, PFalg_fun_call_kind_str((kind))) == 0) \
+        return (kind);
+    /* the kind was copied from algebra.c:PFalg_node_kind_str()
+       (and should stay aligned) */
+    mapto_fun_call_kind (alg_fun_call_pf_documents)
+    mapto_fun_call_kind (alg_fun_call_pf_documents_unsafe)
+    mapto_fun_call_kind (alg_fun_call_pf_documents_str)
+    mapto_fun_call_kind (alg_fun_call_pf_documents_str_unsafe)
+    mapto_fun_call_kind (alg_fun_call_pf_collections)
+    mapto_fun_call_kind (alg_fun_call_pf_collections_unsafe)
+    mapto_fun_call_kind (alg_fun_call_xrpc)
+    mapto_fun_call_kind (alg_fun_call_xrpc_helpers)
+    mapto_fun_call_kind (alg_fun_call_tijah)
+
+    PFoops (OOPS_FATAL, "don't know what to do (%s)", s);
+    /* pacify picky compilers */
+    return node_kind_node;
+}
+
 PFalg_doc_t 
 PFxml2la_conv_2PFLA_docType(char* s) 
 {


------------------------------------------------------------------------------
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image 
processing features enabled. http://p.sf.net/sfu/kodak-com
_______________________________________________
Monetdb-pf-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins

Reply via email to