← Back to team overview

zorba-coders team mailing list archive

[Merge] lp:~zorba-coders/zorba/bug-1189785-core into lp:zorba

 

Chris Hillery has proposed merging lp:~zorba-coders/zorba/bug-1189785-core into lp:zorba.

Commit message:
Update base64 module to Zorba 3.0 standards.

Requested reviews:
  Chris Hillery (ceejatec)

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/bug-1189785-core/+merge/175204

https://code.launchpad.net/~zorba-coders/zorba/csv-module/+merge/175205
-- 
https://code.launchpad.net/~zorba-coders/zorba/bug-1189785-core/+merge/175204
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'modules/CMakeLists.txt'
--- modules/CMakeLists.txt	2013-07-11 00:55:07 +0000
+++ modules/CMakeLists.txt	2013-07-17 07:25:44 +0000
@@ -20,6 +20,7 @@
 ADD_SUBDIRECTORY(full-text)
 ADD_SUBDIRECTORY(json)
 ADD_SUBDIRECTORY(nodes)
+ADD_SUBDIRECTORY(base64)
 
 # Add external module projects - any subdirectories of a directory
 # named "zorba_modules" as a sibling to the main Zorba source

=== added directory 'modules/base64'
=== added file 'modules/base64/CMakeLists.txt'
--- modules/base64/CMakeLists.txt	1970-01-01 00:00:00 +0000
+++ modules/base64/CMakeLists.txt	2013-07-17 07:25:44 +0000
@@ -0,0 +1,16 @@
+# Copyright 2013 The FLWOR Foundation.
+# 
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# 
+# http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+DECLARE_ZORBA_MODULE(FILE base64.xq VERSION 1.0
+  URI "http://zorba.io/modules/base64";)

=== renamed file 'modules/com/zorba-xquery/www/modules/converters/base64.xq' => 'modules/base64/base64.xq'
--- modules/com/zorba-xquery/www/modules/converters/base64.xq	2013-06-25 03:55:20 +0000
+++ modules/base64/base64.xq	2013-07-17 07:25:44 +0000
@@ -1,4 +1,4 @@
-xquery version "1.0";
+jsoniq version "1.0";
 
 (:
  : Copyright 2006-2009 The FLWOR Foundation.
@@ -17,58 +17,58 @@
 :)
 
 (:~
- : Base64 encoding and decoding
+ : <p>Base64 encoding and decoding.</p>
  :
  : @author Matthias Brantner
  :
  : @project Zorba/Data Converters/Base 64
  :)
-module namespace base64 = "http://www.zorba-xquery.com/modules/converters/base64";;
+module namespace base64 = "http://zorba.io/modules/base64";;
 
 declare namespace zerr = "http://zorba.io/modules/zorba-errors";;
 
 declare namespace ver = "http://www.zorba-xquery.com/options/versioning";;
-declare option ver:module-version "2.0";
+declare option ver:module-version "1.0";
 
 (:~
- : Decode a xs:base64Binary.
- :
- : The function assumes that the content after decoding is valid
- : UTF-8.
- :
- : @param $base64 The xs:base64Binary item to decode
+ : <p>Decode a base64Binary.</p>
+ :
+ : <p>The function assumes that the content after decoding is valid
+ : UTF-8.</p>
+ :
+ : @param $base64 The base64Binary item to decode
  : @return the base64-decoded value as string
- * @error zerr:ZOSE0006 if $base64 contains invalid base-64 data.
+ : @error zerr:ZOSE0006 if $base64 contains invalid base-64 data.
  :)
-declare function base64:decode($base64 as xs:base64Binary)
-as xs:string external;
+declare function base64:decode($base64 as base64Binary)
+as string external;
 
 (:~
- : Decode a xs:base64Binary.
- :
- : The function assumes that the content after decoding has
- : the given encoding.
- :
- : @param $base64 The xs:base64Binary item to decode
+ : <p>Decode a base64Binary.</p>
+ :
+ : <>The function assumes that the content after decoding has
+ : the given encoding.</p>
+ :
+ : @param $base64 The base64Binary item to decode
  : @param $encoding The encoding of the string after base64-decoding it.
- : If compiled with ICU, then Zorba supports any encoding that ICU supports;
- : otherwise Zorba only supports ASCII and UTF-8.
  : The encoding parameter is case insensitive.
  :
  : @return the base64-decoded value as a string
  :
  : @error zerr:ZXQP0006 if the given encoding is invalid or not supported.
- * @error zerr:ZOSE0006 if $base64 contains invalid base-64 data.
+ : "ASCII" and "UTF-8" are guaranteed to be supported; other encodings
+ : may be supported depending on the installation.
+ : @error zerr:ZOSE0006 if $base64 contains invalid base-64 data.
  :)
 declare function base64:decode(
-  $base64 as xs:base64Binary,
-  $encoding as xs:string)
-as xs:string external;
+  $base64 as base64Binary,
+  $encoding as string)
+as string external;
 
 (:~
- : Encode a xs:string as xs:base64Binary.
+ : <p>Encode a string as base64Binary.</p>
  :
  : @param $string The item whose string-value should be encoded
  : @return the base64-encoded string-value of the item parameter
  :)
-declare function base64:encode($string as xs:string) as xs:base64Binary external;
+declare function base64:encode($string as string) as base64Binary external;

=== modified file 'modules/com/zorba-xquery/www/modules/CMakeLists.txt'
--- modules/com/zorba-xquery/www/modules/CMakeLists.txt	2013-07-11 00:55:07 +0000
+++ modules/com/zorba-xquery/www/modules/CMakeLists.txt	2013-07-17 07:25:44 +0000
@@ -86,8 +86,6 @@
   URI "http://www.zorba-xquery.com/modules/xqdoc-options";) 
 
 # Subdirectories
-DECLARE_ZORBA_MODULE(FILE converters/base64.xq VERSION 2.0
-  URI "http://www.zorba-xquery.com/modules/converters/base64";)
 DECLARE_ZORBA_MODULE(FILE introspection/sctx.xq VERSION 2.0
   URI "http://www.zorba-xquery.com/modules/introspection/sctx";)
 

=== removed directory 'modules/com/zorba-xquery/www/modules/converters'
=== modified file 'modules/com/zorba-xquery/www/modules/debugger/dbgp-message-handler.xq'
--- modules/com/zorba-xquery/www/modules/debugger/dbgp-message-handler.xq	2013-06-15 20:57:44 +0000
+++ modules/com/zorba-xquery/www/modules/debugger/dbgp-message-handler.xq	2013-07-17 07:25:44 +0000
@@ -24,7 +24,7 @@
  :)
 module namespace dmh = "http://www.zorba-xquery.com/modules/debugger/dbgp-message-handler";;
 
-import module namespace base64 = "http://www.zorba-xquery.com/modules/converters/base64";;
+import module namespace base64 = "http://zorba.io/modules/base64";;
 
 declare namespace ver = "http://www.zorba-xquery.com/options/versioning";;
 declare option ver:module-version "1.0";

=== modified file 'src/context/static_context.cpp'
--- src/context/static_context.cpp	2013-07-11 22:46:20 +0000
+++ src/context/static_context.cpp	2013-07-17 07:25:44 +0000
@@ -357,7 +357,7 @@
 
 const char*
 static_context::ZORBA_BASE64_FN_NS =
-"http://www.zorba-xquery.com/modules/converters/base64";;
+"http://zorba.io/modules/base64";;
 
 const char*
 static_context::ZORBA_JSON_FN_NS =

=== modified file 'src/functions/pregenerated/func_base64.cpp'
--- src/functions/pregenerated/func_base64.cpp	2013-03-05 23:11:50 +0000
+++ src/functions/pregenerated/func_base64.cpp	2013-07-17 07:25:44 +0000
@@ -57,7 +57,7 @@
 
       {
     DECL_WITH_KIND(sctx, fn_zorba_base64_decode,
-        (createQName("http://www.zorba-xquery.com/modules/converters/base64","","decode";), 
+        (createQName("http://zorba.io/modules/base64","","decode";), 
         GENV_TYPESYSTEM.BASE64BINARY_TYPE_ONE, 
         GENV_TYPESYSTEM.STRING_TYPE_ONE),
         FunctionConsts::FN_ZORBA_BASE64_DECODE_1);
@@ -69,7 +69,7 @@
 
       {
     DECL_WITH_KIND(sctx, fn_zorba_base64_decode,
-        (createQName("http://www.zorba-xquery.com/modules/converters/base64","","decode";), 
+        (createQName("http://zorba.io/modules/base64","","decode";), 
         GENV_TYPESYSTEM.BASE64BINARY_TYPE_ONE, 
         GENV_TYPESYSTEM.STRING_TYPE_ONE, 
         GENV_TYPESYSTEM.STRING_TYPE_ONE),
@@ -82,7 +82,7 @@
 
       {
     DECL_WITH_KIND(sctx, fn_zorba_base64_encode,
-        (createQName("http://www.zorba-xquery.com/modules/converters/base64","","encode";), 
+        (createQName("http://zorba.io/modules/base64","","encode";), 
         GENV_TYPESYSTEM.STRING_TYPE_ONE, 
         GENV_TYPESYSTEM.BASE64BINARY_TYPE_ONE),
         FunctionConsts::FN_ZORBA_BASE64_ENCODE_1);

=== modified file 'src/runtime/spec/mappings.xml'
--- src/runtime/spec/mappings.xml	2013-07-11 00:55:07 +0000
+++ src/runtime/spec/mappings.xml	2013-07-17 07:25:44 +0000
@@ -16,7 +16,7 @@
                      define="ZORBA_MATH_FN_NS"
                      prefix="fn-zorba-math"/>
 
-    <zorba:namespace uri="http://www.zorba-xquery.com/modules/converters/base64";
+    <zorba:namespace uri="http://zorba.io/modules/base64";
                      define="ZORBA_BASE64_FN_NS"
                      prefix="fn-zorba-base64"/>
 

=== modified file 'test/rbkt/Queries/zorba/base64/decode_iso-8859-1.xq'
--- test/rbkt/Queries/zorba/base64/decode_iso-8859-1.xq	2012-05-08 03:17:32 +0000
+++ test/rbkt/Queries/zorba/base64/decode_iso-8859-1.xq	2013-07-17 07:25:44 +0000
@@ -1,3 +1,3 @@
-import module namespace b = "http://www.zorba-xquery.com/modules/converters/base64";;
+import module namespace b = "http://zorba.io/modules/base64";;
 
 b:decode(xs:base64Binary("5Pb8Cg=="), "ISO-8859-1")

=== modified file 'test/rbkt/Queries/zorba/base64/decode_iso-8859-1_file.xq'
--- test/rbkt/Queries/zorba/base64/decode_iso-8859-1_file.xq	2012-05-08 03:17:32 +0000
+++ test/rbkt/Queries/zorba/base64/decode_iso-8859-1_file.xq	2013-07-17 07:25:44 +0000
@@ -1,5 +1,5 @@
 import module namespace f = "http://expath.org/ns/file";;
-import module namespace b = "http://www.zorba-xquery.com/modules/converters/base64";;
+import module namespace b = "http://zorba.io/modules/base64";;
 
 b:decode(xs:base64Binary(f:read-text(resolve-uri("iso-8859-1.txt"))), "ISO-8859-1")
 

=== modified file 'test/rbkt/Queries/zorba/base64/file_read_2.xq'
--- test/rbkt/Queries/zorba/base64/file_read_2.xq	2012-02-22 01:31:08 +0000
+++ test/rbkt/Queries/zorba/base64/file_read_2.xq	2013-07-17 07:25:44 +0000
@@ -1,5 +1,5 @@
 import module namespace f = "http://expath.org/ns/file";;
-import module namespace b = "http://www.zorba-xquery.com/modules/converters/base64";;
+import module namespace b = "http://zorba.io/modules/base64";;
 
 variable $enc-file-name := resolve-uri("encoded-text");
 variable $dec-file-name := resolve-uri("decoded-text");

=== modified file 'test/rbkt/Queries/zorba/fetch/fetch_seekable_binary.xq'
--- test/rbkt/Queries/zorba/fetch/fetch_seekable_binary.xq	2012-05-09 21:48:57 +0000
+++ test/rbkt/Queries/zorba/fetch/fetch_seekable_binary.xq	2013-07-17 07:25:44 +0000
@@ -1,6 +1,6 @@
 import module namespace fetch = "http://www.zorba-xquery.com/modules/fetch";;
 
-import module namespace b = "http://www.zorba-xquery.com/modules/converters/base64";;
+import module namespace b = "http://zorba.io/modules/base64";;
 
 (: make sure the returned string is streamable and can be consumed twice, i.e. is seekable :)
 let $x := fetch:content-binary(fn:resolve-uri("iso-8859-1.txt"))

=== modified file 'test/rbkt/Queries/zorba/string/AnalyzeString/http-client-doc.htm'
--- test/rbkt/Queries/zorba/string/AnalyzeString/http-client-doc.htm	2013-06-25 03:55:20 +0000
+++ test/rbkt/Queries/zorba/string/AnalyzeString/http-client-doc.htm	2013-07-17 07:25:44 +0000
@@ -495,7 +495,7 @@
                   <span>data converters</span>
                   <ul>
                     <li>
-                      <a href="www.zorba-xquery.com_modules_converters_base64.html" title="http://www.zorba-xquery.com/modules/converters/base64";>base64</a>
+                      <a href="www.zorba-xquery.com_modules_converters_base64.html" title="http://zorba.io/modules/base64";>base64</a>
                       <sup>
                         <a href="http://www.w3.org/TR/xquery-30/#dt-external-function"; target="_blank" title="There are external functions (either private or public) declared in this module.">(E)</a>
                       </sup>


Follow ups