← Back to team overview

zorba-coders team mailing list archive

[Merge] lp:~zorba-coders/zorba/markos-scratch into lp:zorba

 

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

Commit message:
if context item is set via the api, implictly set the context size and position as well (to 1)


Requested reviews:
  Markos Zaharioudakis (markos-za)

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

if context item is set via the api, implictly set the context size and position as well (to 1)

-- 
https://code.launchpad.net/~zorba-coders/zorba/markos-scratch/+merge/161013
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'src/api/dynamiccontextimpl.cpp'
--- src/api/dynamiccontextimpl.cpp	2013-03-13 16:17:38 +0000
+++ src/api/dynamiccontextimpl.cpp	2013-04-25 20:48:27 +0000
@@ -395,7 +395,28 @@
 bool DynamicContextImpl::setContextItem(const Item& inValue)
 {
   String varName = Unmarshaller::newString(static_context::DOT_VAR_NAME);
-  return setVariable(varName, inValue);
+  bool res = setVariable(varName, inValue);
+
+  store::Item_t one;
+
+  if (!theCtx->is_set_variable(dynamic_context::IDVAR_CONTEXT_ITEM_POSITION))
+  {
+    GENV_ITEMFACTORY->createInteger(one, xs_integer(1));
+
+    varName = Unmarshaller::newString(static_context::DOT_POS_VAR_NAME);
+    setVariable(varName, Item(one));
+  }
+
+  if (!theCtx->is_set_variable(dynamic_context::IDVAR_CONTEXT_ITEM_SIZE))
+  {
+    if (!one)
+      GENV_ITEMFACTORY->createInteger(one, xs_integer(1));
+
+    varName = Unmarshaller::newString(static_context::DOT_SIZE_VAR_NAME);
+    setVariable(varName, Item(one));
+  }
+
+  return res;
 }
 
 

=== modified file 'test/fots/CMakeLists.txt'
--- test/fots/CMakeLists.txt	2013-04-25 01:27:33 +0000
+++ test/fots/CMakeLists.txt	2013-04-25 20:48:27 +0000
@@ -184,7 +184,6 @@
 EXPECTED_FOTS_FAILURE (fn-generate-id generate-id-014 0)
 EXPECTED_FOTS_FAILURE (fn-generate-id generate-id-015 0)
 EXPECTED_FOTS_FAILURE (fn-generate-id generate-id-017 0)
-EXPECTED_FOTS_FAILURE (fn-last last-24 0)
 EXPECTED_FOTS_FAILURE (fn-matches cbcl-matches-038 1131304)
 EXPECTED_FOTS_FAILURE (fn-nilled fn-nilled-33 0)
 EXPECTED_FOTS_FAILURE (fn-nilled fn-nilled-35 0)
@@ -212,7 +211,6 @@
 EXPECTED_FOTS_FAILURE (fn-parse-xml-fragment parse-xml-fragment-016 0)
 EXPECTED_FOTS_FAILURE (fn-parse-xml-fragment parse-xml-fragment-017 0)
 EXPECTED_FOTS_FAILURE (fn-parse-xml-fragment parse-xml-fragment-020 0)
-EXPECTED_FOTS_FAILURE (fn-position position-23 0)
 EXPECTED_FOTS_FAILURE (fn-replace fn-replace-42 0)
 EXPECTED_FOTS_FAILURE (fn-resolve-uri fn-resolve-uri-26 0)
 EXPECTED_FOTS_FAILURE (fn-resolve-uri fn-resolve-uri-28 0)


Follow ups