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

Modified Files:
        load_stats.c 
Log Message:
-- Extended guide loading to cope with QNames (instead of strings).

-- Cleaned up and simplified guide property inference.

-- Extended guide property inference. (QName support; Steps evaluated
   on the guide without result nodes now get an empty guide mapping
   ---instead of no mapping.)


U load_stats.c
Index: load_stats.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/algebra/load_stats.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- load_stats.c        17 Mar 2008 17:41:09 -0000      1.13
+++ load_stats.c        26 Mar 2008 11:41:15 -0000      1.14
@@ -80,6 +80,7 @@
                                        of the same nodes */
     unsigned int   kind_int = 0;    /* read kind as integer */
     PFguide_kind_t kind     = text; /* kind if the guide node */
+    char          *tag_uri  = NULL; /* tag uri of the guide node */
     char          *tag_name = NULL; /* tag name of the guide node */
     char          *attribute_name; 
 
@@ -117,6 +118,9 @@
                 }
             }
     
+            if (strcmp (attribute_name, "uri") == 0)
+                tag_uri = (char*) atts[1];
+    
             if (strcmp (attribute_name, "name") == 0)
                 tag_name = (char*) atts[1];
     
@@ -124,9 +128,13 @@
         }
     }
     
+    /* consistency checks */
     switch (kind) {
         case elem:
         case attr:
+            if (!tag_uri)
+                 PFoops (OOPS_FATAL, "Guide optimization - "
+                        "uri of a guide is NULL when it is required\n");
         case doc:
         case pi:
             if (!tag_name)
@@ -146,18 +154,31 @@
         .max   = max,
         .level = level,
         .kind  = kind,
-        .tag_name = tag_name != NULL ? 
-            (char*)PFmalloc(sizeof(char)*(strlen(tag_name)+1)) : 
-            NULL,
+        .name  = PFqname (PFns_wild, NULL),
         .parent = current_guide_node,
         .child_list = NULL,
     };
 
-    /* copy the string, otherwise it will be lost */
-    if (new_guide_node->tag_name != NULL)
-        new_guide_node->tag_name = strncpy(new_guide_node->tag_name,
-                                           tag_name,
-                                           strlen(tag_name));
+    /* copy the strings, otherwise they will be lost */
+    if (tag_name != NULL) {
+        PFns_t ns;
+        char *name_copy;
+        name_copy = (char *) PFmalloc (sizeof (char) * (strlen (tag_name) + 
1));
+        name_copy = strncpy (name_copy, tag_name, strlen (tag_name));
+
+        if (tag_uri) {
+            ns.prefix = "";
+            char *uri_copy;
+            uri_copy = (char *) PFmalloc (sizeof (char) *
+                                          (strlen (tag_uri) + 1));
+            uri_copy = strncpy (uri_copy, tag_uri, strlen (tag_uri));
+            ns.uri = uri_copy;
+        }
+        else
+            ns = PFns_wild;
+    
+        new_guide_node->name = PFqname (ns, name_copy);
+    }
 
     /* create association between parent and child */
     if (current_guide_node) {
@@ -253,6 +274,7 @@
                 "<!ATTLIST node min CDATA #REQUIRED>"
                 "<!ATTLIST node max CDATA #REQUIRED>"
                 "<!ATTLIST node kind (1|2|3|4|5|6) #REQUIRED>"
+                "<!ATTLIST node uri CDATA #IMPLIED>"
                 "<!ATTLIST node name CDATA #IMPLIED>";
 
     /* Context pointer */


-------------------------------------------------------------------------
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