Markos Zaharioudakis has proposed merging lp:~zorba-coders/zorba/markos-scratch 
into lp:zorba.

Commit message:
in jsoniq mode, using null and atomic as type names (without prefix)

Requested reviews:
  Markos Zaharioudakis (markos-za)

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/markos-scratch/+merge/154479

in jsoniq mode, using null and atomic as type names (without prefix)
-- 
https://code.launchpad.net/~zorba-coders/zorba/markos-scratch/+merge/154479
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'ChangeLog'
--- ChangeLog	2013-03-18 21:35:13 +0000
+++ ChangeLog	2013-03-20 18:42:39 +0000
@@ -24,6 +24,7 @@
   * Extended optimization rules for subsequence function (pushing $startingLoc
     parameter into collection skip if $sourceSeq parameter is from a
     collection).
+  * Optimized fn:index-of function
   * Extented index join  rule to general flwor expressions. 
 
 Bug Fixes/Other Changes:

=== modified file 'src/compiler/translator/translator.cpp'
--- src/compiler/translator/translator.cpp	2013-03-20 01:19:04 +0000
+++ src/compiler/translator/translator.cpp	2013-03-20 18:42:39 +0000
@@ -1053,6 +1053,42 @@
 
 
 /*******************************************************************************
+
+********************************************************************************/
+void expand_type_qname(
+    store::Item_t& qnameItem,
+    const QName* qname,
+    const QueryLoc& loc) const
+{
+  if (!qname->get_prefix().empty() || !theCCB->theConfig.jsoniq_mode)
+  {
+    expand_elem_qname(qnameItem, qname, loc);
+  }
+  else
+  {
+    zstring local = qname->get_localname();
+    zstring ns;
+
+    if (local == "null")
+    {
+      ns = static_context::JSONIQ_DM_NS;
+    }
+    else if (local == "atomic")
+    {
+      ns = XML_SCHEMA_NS;
+      local = "anyAtomicType";
+    }
+    else
+    {
+      ns = XML_SCHEMA_NS;
+    }
+
+    GENV_ITEMFACTORY->createQName(qnameItem, ns, "", local);
+  }
+}
+
+
+/*******************************************************************************
   Convert a lexical qname representing an element tag name or a type name to an
   expanded qname item. If the lexical qname does not have a prefix, the default
   element namespace (if any) will be used to build the expanded qname item.
@@ -8648,16 +8684,7 @@
 
   rchandle<QName> qname = v.get_qname();
   store::Item_t qnameItem;
-
-  if (!qname->get_prefix().empty() || !theCCB->theConfig.jsoniq_mode)
-  {
-    expand_elem_qname(qnameItem, qname, loc);
-  }
-  else
-  {
-    GENV_ITEMFACTORY->
-    createQName(qnameItem, XML_SCHEMA_NS, "", qname->get_localname());
-  }
+  expand_type_qname(qnameItem, qname, loc);
 
   xqtref_t t = CTX_TM->create_named_simple_type(qnameItem);
 
@@ -10793,7 +10820,7 @@
   else
   {
     // Check if this is a call to a type constructor function
-    expand_function_qname(qnameItem, qname, loc);
+    expand_type_qname(qnameItem, qname, loc);
 
     xqtref_t type = CTX_TM->create_named_type(qnameItem,
                                               TypeConstants::QUANT_QUESTION,
@@ -13103,16 +13130,7 @@
 
   rchandle<QName> qname = v.get_qname();
   store::Item_t qnameItem;
-
-  if (!qname->get_prefix().empty() || !theCCB->theConfig.jsoniq_mode)
-  {
-    expand_elem_qname(qnameItem, qname, loc);
-  }
-  else
-  {
-    GENV_ITEMFACTORY->
-    createQName(qnameItem, XML_SCHEMA_NS, "", qname->get_localname());
-  }
+  expand_type_qname(qnameItem, qname, loc);
 
   xqtref_t t = CTX_TM->create_named_simple_type(qnameItem);
 

=== modified file 'src/store/naive/store.cpp'
--- src/store/naive/store.cpp	2013-03-12 17:03:31 +0000
+++ src/store/naive/store.cpp	2013-03-20 18:42:39 +0000
@@ -250,7 +250,7 @@
   theSchemaTypeNames[store::XS_HEXBINARY] = theQNamePool->insert(ns, "xs", "hexBinary");
   theSchemaTypeNames[store::XS_BOOLEAN] = theQNamePool->insert(ns, "xs", "boolean");
 
-  for (ulong i = 0; i < store::XS_LAST; ++i)
+  for (csize i = 0; i < store::XS_LAST; ++i)
   {
     theSchemaTypeCodes[theSchemaTypeNames[i].getp()] = 
     static_cast<store::SchemaTypeCode>(i);

=== modified file 'src/types/root_typemanager.cpp'
--- src/types/root_typemanager.cpp	2013-03-18 17:59:14 +0000
+++ src/types/root_typemanager.cpp	2013-03-20 18:42:39 +0000
@@ -291,7 +291,7 @@
 #ifdef ZORBA_WITH_JSON
   GENV_STORE.getItemFactory()->createQName(JS_NULL_QNAME,
                                            static_context::JSONIQ_DM_NS,
-                                           "jn",
+                                           "js",
                                            "null");
 #endif
 

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to     : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp

Reply via email to