tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jsdelf...@apache.org
Subject svn commit: r826543 - in /tuscany/cpp/sca: kernel/ modules/eval/ test/store-function/ test/store-object/
Date Sun, 18 Oct 2009 22:25:00 GMT
Author: jsdelfino
Date: Sun Oct 18 22:24:59 2009
New Revision: 826543

URL: http://svn.apache.org/viewvc?rev=826543&view=rev
Log:
Minor code cleanup, refactored list functions and cleaned up function names, moved support for elements to a new header file.

Added:
    tuscany/cpp/sca/kernel/element.hpp
Modified:
    tuscany/cpp/sca/kernel/function.hpp
    tuscany/cpp/sca/kernel/kernel-test.cpp
    tuscany/cpp/sca/kernel/list.hpp
    tuscany/cpp/sca/kernel/monad.hpp
    tuscany/cpp/sca/kernel/parallel.hpp
    tuscany/cpp/sca/kernel/slist.hpp
    tuscany/cpp/sca/kernel/value.hpp
    tuscany/cpp/sca/kernel/xml.hpp
    tuscany/cpp/sca/modules/eval/driver.hpp
    tuscany/cpp/sca/modules/eval/environment.hpp
    tuscany/cpp/sca/modules/eval/eval-test.cpp
    tuscany/cpp/sca/modules/eval/eval.hpp
    tuscany/cpp/sca/modules/eval/primitive.hpp
    tuscany/cpp/sca/modules/eval/read.hpp
    tuscany/cpp/sca/test/store-function/catalog.hpp
    tuscany/cpp/sca/test/store-function/item.hpp
    tuscany/cpp/sca/test/store-function/store-function-test.cpp
    tuscany/cpp/sca/test/store-function/store-ui.hpp
    tuscany/cpp/sca/test/store-object/catalog.hpp

Added: tuscany/cpp/sca/kernel/element.hpp
URL: http://svn.apache.org/viewvc/tuscany/cpp/sca/kernel/element.hpp?rev=826543&view=auto
==============================================================================
--- tuscany/cpp/sca/kernel/element.hpp (added)
+++ tuscany/cpp/sca/kernel/element.hpp Sun Oct 18 22:24:59 2009
@@ -0,0 +1,154 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+
+/* $Rev$ $Date$ */
+
+#ifndef tuscany_element_hpp
+#define tuscany_element_hpp
+
+/**
+ * Functions to help represent data as lists of elements and attributes.
+ */
+
+#include "list.hpp"
+#include "value.hpp"
+
+namespace tuscany
+{
+
+/**
+ * Tags used to tag lists of elements and attributes.
+ */
+const value attribute("attribute");
+const value element("element");
+
+/**
+ * Returns the name of an attribute.
+ */
+const value attributeName(const list<value>& l) {
+    return cadr(l);
+}
+
+/**
+ * Returns the value of an attribute.
+ */
+const value attributeValue(const list<value>& l) {
+    return caddr(l);
+}
+
+/**
+ * Returns the name of an element.
+ */
+const value elementName(const list<value>& l) {
+    return cadr(l);
+}
+
+/**
+ * Returns the children of an element.
+ */
+const list<value> elementChildren(const list<value>& l) {
+    return cddr(l);
+}
+
+/**
+ * Returns true if an element has a value.
+ */
+const value elementHasValue(const list<value>& l) {
+    if (isNil(cddr(l)))
+        return false;
+    const list<value> r = reverse(l);
+    if(isList(car(r))) {
+        const list<value> v = car(r);
+        if(isSymbol(car(v))) {
+            return false;
+        }
+    }
+    return true;
+}
+
+/**
+ * Returns the value of an element.
+ */
+const value elementValue(const list<value>& l) {
+    return car(reverse(l));
+}
+
+/**
+ * Converts a list of elements to a list of values.
+ */
+const list<value> elementsToValues(const list<value>& e) {
+    if (isNil(e))
+        return list<value>();
+    const value t = car(e);
+    if (isTaggedList(t, attribute))
+        return cons<value>(mklist(attributeName(t), attributeValue(t)), elementsToValues(cdr(e)));
+    if (isTaggedList(t, element)) {
+        if (elementHasValue(t))
+            return cons<value>(mklist(elementName(t), elementValue(t)), elementsToValues(cdr(e)));
+        return cons<value>(cons(elementName(t), elementsToValues(elementChildren(t))), elementsToValues(cdr(e)));
+    }
+    return cons(t, elementsToValues(cdr(e)));
+}
+
+/**
+ * Converts a list of values to a list of elements.
+ */
+const list<value> valuesToElements(const list<value>& e) {
+    if (isNil(e))
+        return list<value>();
+    const value t = car(e);
+    if (isList(t)) {
+        const value v = cadr<value>(t);
+        if (!isList(v))
+            return cons<value>(mklist(attribute, car<value>(t), v), valuesToElements(cdr(e)));
+        return cons<value>(cons(element, cons(car<value>(t), valuesToElements(cdr<value>(t)))), valuesToElements(cdr(e)));
+    }
+    return cons(t, valuesToElements(cdr(e)));
+}
+
+/**
+ * Returns a selector lambda function which can be used to filter
+ * elements against the given element pattern.
+ */
+struct selectorLambda {
+    const list<value> select;
+    selectorLambda(const list<value>& s) : select(s) {
+    }
+    const bool eval(const list<value>& s, const list<value> v) const {
+        if (isNil(s))
+            return true;
+        if (isNil(v))
+            return false;
+        if (car(s) != car(v))
+            return false;
+        return eval(cdr(s), cdr(v));
+    }
+    const bool operator()(const value& v) const {
+        if (!isList(v))
+            return false;
+        return eval(select, v);
+    }
+};
+
+const lambda<bool(value)> selector(const list<value> s) {
+    return selectorLambda(s);
+}
+
+}
+#endif /* tuscany_element_hpp */

Modified: tuscany/cpp/sca/kernel/function.hpp
URL: http://svn.apache.org/viewvc/tuscany/cpp/sca/kernel/function.hpp?rev=826543&r1=826542&r2=826543&view=diff
==============================================================================
--- tuscany/cpp/sca/kernel/function.hpp (original)
+++ tuscany/cpp/sca/kernel/function.hpp Sun Oct 18 22:24:59 2009
@@ -163,6 +163,7 @@
     }
 
     template<typename S> friend std::ostream& operator<<(std::ostream&, const lambda<S>&);
+    template<typename S> friend const bool isNil(const lambda<S>& l);
 
 private:
     typedef Callable<R,P...> CallableType;
@@ -174,6 +175,13 @@
 }
 
 /**
+ * Return true if a lambda is nil.
+ */
+template<typename S> const bool isNil(const lambda<S>& l) {
+    return ((void*)l.callable) == 0;
+}
+
+/**
  * Curry a lambda function.
  */
 template<typename R, typename T, typename... P> class curried {

Modified: tuscany/cpp/sca/kernel/kernel-test.cpp
URL: http://svn.apache.org/viewvc/tuscany/cpp/sca/kernel/kernel-test.cpp?rev=826543&r1=826542&r2=826543&view=diff
==============================================================================
--- tuscany/cpp/sca/kernel/kernel-test.cpp (original)
+++ tuscany/cpp/sca/kernel/kernel-test.cpp Sun Oct 18 22:24:59 2009
@@ -107,11 +107,11 @@
 };
 
 bool testCons() {
-    assert(car(cons(2, makeList(3))) == 2);
-    assert(car(cdr(cons(2, makeList(3)))) == 3);
-    assert(isNil(cdr(cdr(cons(2, makeList(3))))));
+    assert(car(cons(2, mklist(3))) == 2);
+    assert(car(cdr(cons(2, mklist(3)))) == 3);
+    assert(isNil(cdr(cdr(cons(2, mklist(3))))));
 
-    assert(cons(Element(1), makeList(Element(2))) == makeList(Element(1), Element(2)));
+    assert(cons(Element(1), mklist(Element(2))) == mklist(Element(1), Element(2)));
     return true;
 }
 
@@ -132,32 +132,37 @@
     assert(os1.str() == "()");
 
     std::ostringstream os2;
-    os2 << makeList(1, 2, 3);
+    os2 << mklist(1, 2, 3);
     assert(os2.str() == "(1, (2, (3, ())))");
     return true;
 }
 
 bool testEquals() {
     assert(list<int>() == list<int>());
-    assert(makeList(1, 2) == makeList(1, 2));
-    assert(list<int>() != makeList(1, 2));
-    assert(makeList(1, 2, 3) == makeList(1, 2, 3));
-    assert(makeList(1, 2) != makeList(1, 2, 3));
+    assert(mklist(1, 2) == mklist(1, 2));
+    assert(list<int>() != mklist(1, 2));
+    assert(mklist(1, 2, 3) == mklist(1, 2, 3));
+    assert(mklist(1, 2) != mklist(1, 2, 3));
     return true;
 }
 
 bool testLength() {
     assert(0 == length(list<int>()));
-    assert(1 == length(makeList(1)));
-    assert(2 == length(cons(1, makeList(2))));
+    assert(1 == length(mklist(1)));
+    assert(2 == length(cons(1, mklist(2))));
     return true;
 }
 
 bool testAppend() {
-    assert(car(append(makeList(1), makeList(2))) == 1);
-    assert(car(cdr(append(makeList(1), makeList(2)))) == 2);
-    assert(car(cdr(cdr(append(makeList(1), makeList(2, 3))))) == 3);
-    assert(isNil(cdr(cdr(cdr(append(makeList(1), makeList(2, 3)))))));
+    assert(car(append(mklist(1), mklist(2))) == 1);
+    assert(car(cdr(append(mklist(1), mklist(2)))) == 2);
+    assert(car(cdr(cdr(append(mklist(1), mklist(2, 3))))) == 3);
+    assert(isNil(cdr(cdr(cdr(append(mklist(1), mklist(2, 3)))))));
+
+    list<int> l;
+    l << 1 << 2 << 3;
+    assert(l == mklist(1, 2, 3));
+    assert(list<int>() << 1 << 2 << 3 == mklist(1, 2, 3));
     return true;
 }
 
@@ -172,7 +177,7 @@
 };
 
 bool testComplex() {
-    const list<Complex> p = makeList(Complex(1, 2), Complex(3, 4));
+    const list<Complex> p = mklist(Complex(1, 2), Complex(3, 4));
     assert(car(p).x == 1);
     assert(car(cdr(p)).x == 3);
     assert(isNil(cdr(cdr(p))));
@@ -182,7 +187,7 @@
 bool testMap() {
     assert(isNil(map<int, int>(square, list<int>())));
 
-    const list<int> m = map<int, int>(square, makeList(2, 3));
+    const list<int> m = map<int, int>(square, mklist(2, 3));
     assert(car(m) == 4);
     assert(car(cdr(m)) == 9);
 
@@ -195,7 +200,7 @@
 
 bool testReduce() {
     const lambda<int(int, int)> r(add);
-    assert(reduce(r, 0, makeList(1, 2, 3)) == 6);
+    assert(reduce(r, 0, mklist(1, 2, 3)) == 6);
     return true;
 }
 
@@ -207,49 +212,63 @@
 }
 
 bool testFilter() {
-    assert(car(filter<int>(isPositive, makeList(1, -1, 2, -2))) == 1);
-    assert(cadr(filter<int>(isPositive, makeList(1, -1, 2, -2))) == 2);
+    assert(car(filter<int>(isPositive, mklist(1, -1, 2, -2))) == 1);
+    assert(cadr(filter<int>(isPositive, mklist(1, -1, 2, -2))) == 2);
     return true;
 }
 
 bool testMember() {
-    assert(isNil(member(4, makeList(1, 2, 3))));
-    assert(car(member(1, makeList(1, 2, 3))) == 1);
-    assert(car(member(2, makeList(1, 2, 3))) == 2);
-    assert(car(member(3, makeList(1, 2, 3))) == 3);
+    assert(isNil(member(4, mklist(1, 2, 3))));
+    assert(car(member(1, mklist(1, 2, 3))) == 1);
+    assert(car(member(2, mklist(1, 2, 3))) == 2);
+    assert(car(member(3, mklist(1, 2, 3))) == 3);
     return true;
 }
 
 bool testReverse() {
     assert(isNil(reverse(list<int>())));
-    assert(car(reverse(makeList(1, 2, 3))) == 3);
-    assert(cadr(reverse(makeList(1, 2, 3))) == 2);
+    assert(car(reverse(mklist(1, 2, 3))) == 3);
+    assert(cadr(reverse(mklist(1, 2, 3))) == 2);
+    return true;
+}
+
+bool testListRef() {
+    assert(listRef(mklist(1), 0) == 1);
+    assert(listRef(mklist(1, 2, 3), 0) == 1);
+    assert(listRef(mklist(1, 2, 3), 1) == 2);
+    assert(listRef(mklist(1, 2, 3), 2) == 3);
     return true;
 }
 
 bool testAssoc() {
-    const list<list<std::string> > l = makeList(makeList<std::string>("x", "X"), makeList<std::string>("a", "A"), makeList<std::string>("y", "Y"), makeList<std::string>("a", "AA"));
-    assert(assoc<std::string>("a", l) == makeList<std::string>("a", "A"));
+    const list<list<std::string> > l = mklist(mklist<std::string>("x", "X"), mklist<std::string>("a", "A"), mklist<std::string>("y", "Y"), mklist<std::string>("a", "AA"));
+    assert(assoc<std::string>("a", l) == mklist<std::string>("a", "A"));
     assert(isNil(assoc<std::string>("z", l)));
+
+    const list<list<value> > u = mklist(mklist<value>("x", "X"), mklist<value>("a", "A"), mklist<value>("y", "Y"), mklist<value>("a", "AA"));
+    assert(assoc<value>("a", u) == mklist<value>("a", "A"));
+
+    const list<value> v = mklist<value>(mklist<value>("x", "X"), mklist<value>("a", "A"), mklist<value>("y", "Y"), mklist<value>("a", "AA"));
+    assert(assoc<value>("a", v) == mklist<value>("a", "A"));
     return true;
 }
 
 bool testZip() {
-    const list<std::string> k = makeList<std::string>("x", "a", "y", "a");
-    const list<std::string> v = makeList<std::string>("X", "A", "Y", "AA");
-    const list<list<std::string> > z = makeList(k, v);
-    const list<list<std::string> > u = makeList(makeList<std::string>("x", "X"), makeList<std::string>("a", "A"), makeList<std::string>("y", "Y"), makeList<std::string>("a", "AA"));
+    const list<std::string> k = mklist<std::string>("x", "a", "y", "a");
+    const list<std::string> v = mklist<std::string>("X", "A", "Y", "AA");
+    const list<list<std::string> > z = mklist(k, v);
+    const list<list<std::string> > u = mklist(mklist<std::string>("x", "X"), mklist<std::string>("a", "A"), mklist<std::string>("y", "Y"), mklist<std::string>("a", "AA"));
     assert(zip(k, v) == u);
     assert(unzip(u) == z);
     return true;
 }
 
 bool testTokenize() {
-    assert(tokenize("/", "aaa/bbb/ccc/ddd") == makeList<std::string>("aaa", "bbb", "ccc", "ddd"));
-    assert(tokenize("/", "/bbb/ccc/ddd") == makeList<std::string>("", "bbb", "ccc", "ddd"));
-    assert(tokenize("/", "/bbb/ccc/") == makeList<std::string>("", "bbb", "ccc"));
-    assert(tokenize("/", "/bbb//ccc/") == makeList<std::string>("", "bbb", "", "ccc"));
-    assert(tokenize("/", "abc/def/") == makeList<std::string>("abc", "def"));
+    assert(tokenize("/", "aaa/bbb/ccc/ddd") == mklist<std::string>("aaa", "bbb", "ccc", "ddd"));
+    assert(tokenize("/", "/bbb/ccc/ddd") == mklist<std::string>("", "bbb", "ccc", "ddd"));
+    assert(tokenize("/", "/bbb/ccc/") == mklist<std::string>("", "bbb", "ccc"));
+    assert(tokenize("/", "/bbb//ccc/") == mklist<std::string>("", "bbb", "", "ccc"));
+    assert(tokenize("/", "abc/def/") == mklist<std::string>("abc", "def"));
     return true;
 }
 
@@ -292,7 +311,10 @@
     assert(value("abcd") == value("abcd"));
     lambda<value(list<value>&)> vl(valueSquare);
     assert(value(vl) == value(vl));
-    assert(value(makeList<value>(1, 2)) == value(makeList<value>(1, 2)));
+    assert(value(mklist<value>(1, 2)) == value(mklist<value>(1, 2)));
+
+    const list<value> v = mklist<value>(mklist<value>("x", "X"), mklist<value>("a", "A"), mklist<value>("y", "Y"));
+    assert(cadr((list<list<value> >)value(v)) == mklist<value>("a", "A"));
     return true;
 }
 
@@ -307,6 +329,18 @@
     return true;
 }
 
+bool testElement() {
+    const list<value> ad = mklist<value>(mklist<value>(attribute, "city", std::string("san francisco")), mklist<value>(attribute, "state", std::string("ca")));
+    const list<value> ac = mklist<value>(mklist<value>(attribute, "id", std::string("1234")), mklist<value>(attribute, "balance", 1000));
+    const list<value> cr = mklist<value>(mklist<value> (attribute, "name", std::string("jdoe")), cons<value>(element, cons<value>("address", ad)), cons<value>(element, cons<value>("account", ac)));
+    const list<value> c = mklist<value>(cons<value>(element, cons<value>("customer", cr)));
+
+    const list<value> v = elementsToValues(c);
+    const list<value> e = valuesToElements(v);
+    assert(e == c);
+    return true;
+}
+
 double fib_aux(double n, double a, double b) {
     if(n == 0.0)
         return a;
@@ -442,24 +476,38 @@
 "<service name=\"CurrencyConverter2\">"
 "<binding.atom/>"
 "</service>"
+"<property name=\"currency\">US</property>"
 "</component>"
 "</composite>"
 "\n";
 
+const std::string customerXML =
+"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+"<customer>"
+"<name>jdoe</name>"
+"<address><city>san francisco</city><state>ca</state></address>"
+"<account><id>1234</id><balance>1000</balance></account>"
+"</customer>"
+"\n";
+
 const bool isName(const value& token) {
-    return isAttribute(token) && attributeName(token) == "name";
+    return isTaggedList(token, attribute) && attributeName(token) == "name";
 }
 
 bool testReadXML() {
-    std::istringstream is(currencyXML);
-    const list<value> currency = readXML(makeStreamList(is));
-
-    const value composite = car(currency);
-    assert(isElement(composite));
-    assert(elementName(composite) == "composite");
-    assert(!elementHasText(composite));
+    {
+        std::istringstream is(customerXML);
+        const list<value> c = readXML(streamList(is));
+    }
+    {
+        std::istringstream is(currencyXML);
+        const list<value> c = readXML(streamList(is));
 
-    assert(attributeText(car(filter<value>(isName, elementChildren(composite)))) == "currency");
+        const value composite = car(c);
+        assert(isTaggedList(composite, element));
+        assert(elementName(composite) == "composite");
+        assert(attributeValue(car(filter<value>(isName, elementChildren(composite)))) == std::string("currency"));
+    }
     return true;
 }
 
@@ -469,15 +517,20 @@
 }
 
 bool testWriteXML() {
-    std::istringstream is(currencyXML);
-    const list<std::string> il = makeStreamList(is);
-
-    const list<value> currency = readXML(il);
-    std::ostringstream os;
-    writeXML<std::ostringstream*>(xmlWriter, &os, currency);
-    assert(os.str() == currencyXML);
-
-    assert(writeXML(currency) == il);
+    {
+        std::istringstream is(customerXML);
+        const list<value> c = readXML(streamList(is));
+        std::ostringstream os;
+        writeXML<std::ostringstream*>(xmlWriter, &os, c);
+        assert(os.str() == customerXML);
+    }
+    {
+        std::istringstream is(currencyXML);
+        const list<value> c = readXML(streamList(is));
+        std::ostringstream os;
+        writeXML<std::ostringstream*>(xmlWriter, &os, c);
+        assert(os.str() == currencyXML);
+    }
     return true;
 }
 
@@ -602,12 +655,14 @@
     tuscany::testFilter();
     tuscany::testMember();
     tuscany::testReverse();
+    tuscany::testListRef();
     tuscany::testAssoc();
     tuscany::testZip();
     tuscany::testTokenize();
     tuscany::testSeq();
     tuscany::testValue();
     tuscany::testValueGC();
+    tuscany::testElement();
     tuscany::testCppPerf();
     tuscany::testAtomicPerf();
     tuscany::testWorker();

Modified: tuscany/cpp/sca/kernel/list.hpp
URL: http://svn.apache.org/viewvc/tuscany/cpp/sca/kernel/list.hpp?rev=826543&r1=826542&r2=826543&view=diff
==============================================================================
--- tuscany/cpp/sca/kernel/list.hpp (original)
+++ tuscany/cpp/sca/kernel/list.hpp Sun Oct 18 22:24:59 2009
@@ -56,20 +56,19 @@
 template<typename T> class list {
 public:
 
-    list(const T car, const lambda<list<T> ()>& cdr) :
-        nil(false), car(car), cdr(cdr) {
+    list() {
         countlists++;
-        countIlists++;
+        countElists++;
     }
 
-    list() :
-        nil(true) {
+    list(const T car, const lambda<list<T> ()>& cdr) :
+        car(car), cdr(cdr) {
         countlists++;
-        countElists++;
+        countIlists++;
     }
 
     list(const list& p) :
-        nil(p.nil), car(p.car), cdr(p.cdr) {
+        car(p.car), cdr(p.cdr) {
         countlists++;
         countClists++;
     }
@@ -77,7 +76,6 @@
     const list& operator=(const list<T>& p) {
         if(this == &p)
             return *this;
-        nil = p.nil;
         car = p.car;
         cdr = p.cdr;
         return *this;
@@ -90,9 +88,9 @@
     const bool operator==(const list<T>& p) const {
         if(this == &p)
             return true;
-        if(nil)
-            return p.nil;
-        if(p.nil)
+        if(isNil(cdr))
+            return isNil(p.cdr);
+        if(isNil(p.cdr))
             return false;
         if(!(car == p.car))
             return false;
@@ -105,9 +103,20 @@
         return !this->operator==(p);
     }
 
-    template<typename X> friend std::ostream& operator<<(std::ostream&, const list<X>&);
+    operator const list<list<T> >() const {
+        return (list<list<T> >)T(*this);
+    }
 
-    bool nil;
+    list<T>& operator<<(const T& v) {
+        *this = append(*this, mklist(v));
+        return *this;
+    }
+
+    template<typename X> friend const bool isNil(const list<X>& p);
+    template<typename X> friend const X car(const list<X>& p);
+    template<typename X> friend list<X> const cdr(const list<X>& p);
+
+private:
     T car;
     lambda<list<T> ()> cdr;
 };
@@ -116,7 +125,7 @@
  * Returns true if the given list is nil.
  */
 template<typename T> const bool isNil(const list<T>& p) {
-    return p.nil;
+    return isNil(p.cdr);
 }
 
 /**
@@ -143,31 +152,45 @@
 }
 
 /**
- * Construct a list of one value.
+ * Construct a list from a single value.
  */
-template<typename T> const list<T> makeList(const T& car) {
+template<typename T> const list<T> cons(const T& car) {
     return list<T> (car, result(list<T> ()));
 }
 
 /**
+ * Construct a list of one value.
+ */
+template<typename T> const list<T> mklist(const T& car) {
+    return cons<T>(car);
+}
+
+/**
  * Construct a list of two values.
  */
-template<typename T> const list<T> makeList(const T& a, const T& b) {
-    return cons(a, makeList(b));
+template<typename T> const list<T> mklist(const T& a, const T& b) {
+    return cons(a, mklist(b));
 }
 
 /**
  * Construct a list of three values.
  */
-template<typename T> const list<T> makeList(const T& a, const T& b, const T& c) {
-    return cons(a, cons(b, makeList(c)));
+template<typename T> const list<T> mklist(const T& a, const T& b, const T& c) {
+    return cons(a, cons(b, mklist(c)));
 }
 
 /**
  * Construct a list of four values.
  */
-template<typename T> const list<T> makeList(const T& a, const T& b, const T& c, const T& d) {
-    return cons(a, cons(b, cons(c, makeList(d))));
+template<typename T> const list<T> mklist(const T& a, const T& b, const T& c, const T& d) {
+    return cons(a, cons(b, cons(c, mklist(d))));
+}
+
+/**
+ * Construct a list of five values.
+ */
+template<typename T> const list<T> mklist(const T& a, const T& b, const T& c, const T& d, const T& e) {
+    return cons(a, cons(b, cons(c, cons(d, mklist(e)))));
 }
 
 /**
@@ -338,13 +361,22 @@
  */
 template<typename T> const list<T> seq(const T& start, const T& end) {
     if(start == end)
-        return makeList(start);
+        return mklist(start);
     if(start < end)
         return cons<T>(start, seqGenerate<T> (start + 1, end));
     return cons<T>(start, seqGenerate<T> (start - 1, end));
 }
 
 /**
+ * Returns the i-th element of a list.
+ */
+template<typename T> const T listRef(const list<T>& l, const int i) {
+    if (i == 0)
+        return car(l);
+    return listRef(cdr(l), i - 1);
+}
+
+/**
  * Returns the first pair matching a key from a list of key value pairs.
  */
 template<typename T> const list<T> assoc(const T& k, const list<list<T> >& p) {
@@ -361,7 +393,7 @@
 template<typename T> const list<list<T> > zip(const list<T>& a, const list<T>& b) {
     if (isNil(a) || isNil(b))
         return list<list<T> >();
-    return cons<list<T> >(makeList<T>(car(a), car(b)), zip(cdr(a), cdr(b)));
+    return cons<list<T> >(mklist<T>(car(a), car(b)), zip(cdr(a), cdr(b)));
 }
 
 /**
@@ -380,7 +412,7 @@
 }
 
 template<typename T> const list<list<T> > unzip(const list<list<T> >& l) {
-    return makeList<list<T> >(unzipKeys(l), unzipValues(l));
+    return mklist<list<T> >(unzipKeys(l), unzipValues(l));
 }
 
 /**

Modified: tuscany/cpp/sca/kernel/monad.hpp
URL: http://svn.apache.org/viewvc/tuscany/cpp/sca/kernel/monad.hpp?rev=826543&r1=826542&r2=826543&view=diff
==============================================================================
--- tuscany/cpp/sca/kernel/monad.hpp (original)
+++ tuscany/cpp/sca/kernel/monad.hpp Sun Oct 18 22:24:59 2009
@@ -70,12 +70,12 @@
 /**
  * Return an identity monad from a value.
  */
-template<typename V> const id<V> makeUnit(const V& v) {
+template<typename V> const id<V> mkunit(const V& v) {
     return id<V>(v);
 }
 
 template<typename V> const lambda<id<V>(V)> unit() {
-    return makeUnit<V>;
+    return mkunit<V>;
 }
 
 /**
@@ -136,12 +136,12 @@
 /**
  * Return a maybe monad with a value in it.
  */
-template<typename V> const maybe<V> makeJust(const V& v) {
+template<typename V> const maybe<V> mkjust(const V& v) {
     return maybe<V>(v);
 }
 
 template<typename V> const lambda<maybe<V>(V)> just() {
-    return makeJust<V>;
+    return mkjust<V>;
 }
 
 /**
@@ -222,12 +222,12 @@
 /**
  * Returns a failable monad with a success value in it.
  */
-template<typename V, typename F> const failable<V, F> makeSuccess(const V& v) {
+template<typename V, typename F> const failable<V, F> mksuccess(const V& v) {
     return failable<V, F>(v);
 }
 
 template<typename V, typename F> const lambda<failable<V, F>(V)> success() {
-    return makeSuccess<V, F>;
+    return mksuccess<V, F>;
 }
 
 /**

Modified: tuscany/cpp/sca/kernel/parallel.hpp
URL: http://svn.apache.org/viewvc/tuscany/cpp/sca/kernel/parallel.hpp?rev=826543&r1=826542&r2=826543&view=diff
==============================================================================
--- tuscany/cpp/sca/kernel/parallel.hpp (original)
+++ tuscany/cpp/sca/kernel/parallel.hpp Sun Oct 18 22:24:59 2009
@@ -208,12 +208,12 @@
 /**
  * Returns a list of worker threads.
  */
-const list<pthread_t> makeWorkerThreads(queue<lambda<bool()> >& queue, const int count) {
+const list<pthread_t> workerThreads(queue<lambda<bool()> >& queue, const int count) {
     if (count == 0)
         return list<pthread_t>();
     pthread_t thread;
     pthread_create(&thread, NULL, workerThreadFunc, &queue);
-    return cons(thread, makeWorkerThreads(queue, count - 1));
+    return cons(thread, workerThreads(queue, count - 1));
 }
 
 /**
@@ -221,7 +221,7 @@
  */
 class worker {
 public:
-    worker(int max) : work(queue<lambda<bool()> >(max)), threads(makeWorkerThreads(work, max)) {
+    worker(int max) : work(queue<lambda<bool()> >(max)), threads(workerThreads(work, max)) {
     }
 
 private:

Modified: tuscany/cpp/sca/kernel/slist.hpp
URL: http://svn.apache.org/viewvc/tuscany/cpp/sca/kernel/slist.hpp?rev=826543&r1=826542&r2=826543&view=diff
==============================================================================
--- tuscany/cpp/sca/kernel/slist.hpp (original)
+++ tuscany/cpp/sca/kernel/slist.hpp Sun Oct 18 22:24:59 2009
@@ -43,7 +43,7 @@
                 return list<std::string>();
             const unsigned int i = str.find_first_of(sep, start);
             if (i == std::string::npos)
-                return makeList(str.substr(start));
+                return mklist(str.substr(start));
             return cons(str.substr(start, i - start), tokenize(sep, str, i + 1));
         }
     };
@@ -67,7 +67,7 @@
     }
 };
 
-const list<std::string> makeStreamList(std::istream& is) {
+const list<std::string> streamList(std::istream& is) {
     return ilistRead(is)();
 }
 

Modified: tuscany/cpp/sca/kernel/value.hpp
URL: http://svn.apache.org/viewvc/tuscany/cpp/sca/kernel/value.hpp?rev=826543&r1=826542&r2=826543&view=diff
==============================================================================
--- tuscany/cpp/sca/kernel/value.hpp (original)
+++ tuscany/cpp/sca/kernel/value.hpp Sun Oct 18 22:24:59 2009
@@ -28,6 +28,7 @@
 
 #include <string>
 #include <iostream>
+#include <sstream>
 #include "gc.hpp"
 #include "function.hpp"
 #include "list.hpp"
@@ -145,6 +146,12 @@
         countVValues++;
     }
 
+    value(const list<list<value> >& l) :
+        type(value::List), data(vdata(result(listOfValues(l)))) {
+        countValues++;
+        countVValues++;
+    }
+
     value(const double num) :
         type(value::Number), data(vdata(result(num))) {
         countValues++;
@@ -205,7 +212,32 @@
     }
 
     operator const std::string() const {
-        return str()();
+        switch(type) {
+        case value::List:
+        case value::Lambda:
+            return "";
+        case value::Symbol:
+        case value::String:
+            return str()();
+        case value::Number: {
+            std::ostringstream sos;
+            sos << num()();
+            return sos.str();
+        }
+        case value::Boolean: {
+            if(boo()())
+                return "true";
+            else
+                return "false";
+        }
+        case value::Character: {
+            std::ostringstream sos;
+            sos << chr()();
+            return sos.str();
+        }
+        default:
+            return "";
+        }
     }
 
     operator const double() const {
@@ -228,6 +260,10 @@
         return lst()();
     }
 
+    operator const list<list<value> >() const {
+        return listOfListOfValues(lst()());
+    }
+
     operator const lambda<value(list<value>&)>() const {
         return func();
     }
@@ -270,8 +306,21 @@
         return vdata<value(list<value>&)> ();
     }
 
+    const list<value> listOfValues(const list<list<value> >& l) const {
+        if (isNil(l))
+            return list<value>();
+        return cons<value>(car(l), listOfValues(cdr(l)));
+    }
+
+    const list<list<value> > listOfListOfValues(const list<value>& l) const {
+        if (isNil(l))
+            return list<list<value> >();
+        return cons<list<value> >(list<value>(car(l)), listOfListOfValues(cdr(l)));
+    }
+
 };
 
+
 std::ostream& operator<<(std::ostream& out, const value& v) {
     switch(v.type) {
     case value::List:
@@ -329,8 +378,8 @@
 }
 
 const bool isTaggedList(const value& exp, value tag) {
-    if(isList(exp))
-        return car((list<value> )exp) == tag;
+    if(isList(exp) && !isNil((list<value>)exp))
+        return car((list<value>)exp) == tag;
     return false;
 }
 

Modified: tuscany/cpp/sca/kernel/xml.hpp
URL: http://svn.apache.org/viewvc/tuscany/cpp/sca/kernel/xml.hpp?rev=826543&r1=826542&r2=826543&view=diff
==============================================================================
--- tuscany/cpp/sca/kernel/xml.hpp (original)
+++ tuscany/cpp/sca/kernel/xml.hpp Sun Oct 18 22:24:59 2009
@@ -32,6 +32,8 @@
 #include <libxml/globals.h>
 #include <string>
 #include "list.hpp"
+#include "value.hpp"
+#include "element.hpp"
 #include "monad.hpp"
 
 namespace tuscany {
@@ -42,7 +44,7 @@
 class XMLReader {
 public:
     enum TokenType {
-        None = 0, Element = 1, Attribute = 2, EndElement = 15, Identifier = 100, Text = 101, End = 103
+        None = 0, Element = 1, Attribute = 2, Text = 3, EndElement = 15, Identifier = 100, End = 101
     };
 
     XMLReader(xmlTextReaderPtr xml) : xml(xml), tokenType(None) {
@@ -55,24 +57,21 @@
     }
 
     /**
-     * Read the next token and return its type.
+     * Read the next XML token and return its type.
      */
     int read() {
         if (tokenType == End)
             return tokenType;
         if (tokenType == Element) {
             isEmptyElement = xmlTextReaderIsEmptyElement(xml);
-            hasValue = xmlTextReaderHasValue(xml);
             hasAttributes = xmlTextReaderHasAttributes(xml);
             return tokenType = Identifier;
         }
-        if (hasValue && tokenType == Identifier)
-            return tokenType = Text;
-        if (hasAttributes && (tokenType == Identifier || tokenType == Text) && xmlTextReaderMoveToFirstAttribute(xml) == 1)
+        if (tokenType == Identifier && hasAttributes && xmlTextReaderMoveToFirstAttribute(xml) == 1)
             return tokenType = Attribute;
         if (tokenType == Attribute && xmlTextReaderMoveToNextAttribute(xml) == 1)
             return tokenType = Attribute;
-        if (isEmptyElement && (tokenType == Identifier || tokenType == Text || tokenType == Attribute))
+        if (isEmptyElement && (tokenType == Identifier || tokenType == Attribute))
             return tokenType = EndElement;
         if (!xmlTextReaderRead(xml))
             return tokenType = End;
@@ -96,15 +95,13 @@
  */
 const value endElement("<");
 const value startElement(">");
-const value attribute("attribute");
-const value element("element");
 
 /**
  * Read an XML identifier.
  */
 const value readIdentifier(XMLReader& reader) {
     const char* name = (const char*)xmlTextReaderConstName(reader);
-    return value(name);
+    return name;
 }
 
 /**
@@ -112,7 +109,7 @@
  */
 const value readText(XMLReader& reader) {
     const char *val = (const char*)xmlTextReaderConstValue(reader);
-    return value(std::string(val));
+    return std::string(val);
 }
 
 /**
@@ -121,7 +118,7 @@
 const value readAttribute(XMLReader& reader) {
     const char *name = (const char*)xmlTextReaderConstName(reader);
     const char *val = (const char*)xmlTextReaderConstValue(reader);
-    return value(makeList(attribute, value(name), value(std::string(val))));
+    return mklist<value>(attribute, name, std::string(val));
 }
 
 /**
@@ -145,14 +142,14 @@
 }
 
 /**
- * Read a list of XML tokens.
+ * Read a list of values from XML tokens.
  */
 const list<value> readList(const list<value>& listSoFar, XMLReader& reader) {
     const value token = readToken(reader);
     if(isNil(token) || endElement == token)
         return reverse(listSoFar);
     if(startElement == token)
-        return readList(cons(value(readList(makeList(element), reader)), listSoFar), reader);
+        return readList(cons<value>(readList(mklist(element), reader), listSoFar), reader);
     return readList(cons(token, listSoFar), reader);
 }
 
@@ -162,7 +159,7 @@
 const list<value> read(XMLReader& reader) {
     value nextToken = readToken(reader);
     if (startElement == nextToken)
-        return makeList(value(readList(makeList(element), reader)));
+        return mklist<value>(readList(mklist(element), reader));
     return list<value>();
 }
 
@@ -203,64 +200,6 @@
 }
 
 /**
- * Returns true if a value is an XML attribute.
- */
-const bool isAttribute(const list<value>& l) {
-    return !isNil(l) && car(l) == attribute;
-}
-
-/**
- * Returns the name of an XML attribute.
- */
-const std::string attributeName(const list<value>& l) {
-    return cadr(l);
-}
-
-/**
- * Returns the text value of an XML attribute.
- */
-const std::string attributeText(const list<value>& l) {
-    return caddr(l);
-}
-
-/**
- * Returns true if a value is an XML element.
- */
-const bool isElement(const list<value>& l) {
-    return !isNil(l) && car(l) == element;
-}
-
-/**
- * Returns the name of an XML element.
- */
-const std::string elementName(const list<value>& l) {
-    return cadr(l);
-}
-
-/**
- * Returns true if an XML element contains text content.
- */
-const bool elementHasText(const list<value>& l) {
-    if (isNil(cddr(l)))
-        return false;
-    return isString(caddr(l));
-}
-
-/**
- * Returns the text content of an XML element.
- */
-const std::string elementText(const list<value>& l) {
-    return caddr(l);
-}
-
-/**
- * Returns the children of an XML element.
- */
-const list<value> elementChildren(const list<value>& l) {
-    return cddr(l);
-}
-
-/**
  * Default encoding used to write XML documents.
  */
 const char* encoding = "UTF-8";
@@ -273,18 +212,16 @@
         return true;
 
     // Write an attribute
-    const list<value> token(car(l));
-    if (isAttribute(token)) {
-        if (xmlTextWriterWriteAttribute(xml, (const xmlChar*)attributeName(token).c_str(), (const xmlChar*)attributeText(token).c_str()) < 0)
+    const value token(car(l));
+    if (isTaggedList(token, attribute)) {
+        if (xmlTextWriterWriteAttribute(xml, (const xmlChar*)std::string(attributeName(token)).c_str(), (const xmlChar*)std::string(attributeValue(token)).c_str()) < 0)
             return std::string("xmlTextWriterWriteAttribute failed");
 
-    } else if (isElement(token)) {
+    } else if (isTaggedList(token, element)) {
 
         // Write an element
-        if (xmlTextWriterStartElement(xml, (const xmlChar*)elementName(token).c_str()) < 0)
+        if (xmlTextWriterStartElement(xml, (const xmlChar*)std::string(elementName(token)).c_str()) < 0)
             return std::string("xmlTextWriterStartElement failed");
-        if (elementHasText(token) && xmlTextWriterWriteString(xml, (const xmlChar*)elementText(token).c_str()) < 0)
-            return std::string("xmlTextWriterWriteString failed");
 
         // Write its children
         const failable<bool, std::string> w = writeList(elementChildren(token), xml);
@@ -293,6 +230,12 @@
 
         if (xmlTextWriterEndElement(xml) < 0)
             return std::string("xmlTextWriterEndElement failed");
+
+    } else {
+
+        // Write XML text
+        if (xmlTextWriterWriteString(xml, (const xmlChar*)std::string(token).c_str()) < 0)
+            return std::string("xmlTextWriterWriteString failed");
     }
 
     // Go on
@@ -336,7 +279,7 @@
 }
 
 /**
- * Write a list of values as an XML document.
+ * Convert a list of values to an XML document.
  */
 template<typename R> const failable<R, std::string> writeXML(const lambda<R(R, std::string)>& reduce, const R& initial, const list<value>& l) {
     XMLWriteContext<R> cx(reduce, initial);
@@ -352,13 +295,13 @@
     return cx.accum;
 }
 
+/**
+ * Convert a list of values to a list of strings representing an XML document.
+ */
 const list<std::string> writeXMLList(const list<std::string>& listSoFar, const std::string& s) {
     return cons(s, listSoFar);
 }
 
-/**
- * Write a list of values as an XML document represented as a list of strings.
- */
 const failable<list<std::string>, std::string> writeXML(const list<value>& l) {
     const failable<list<std::string>, std::string> ls = writeXML<list<std::string> >(writeXMLList, list<std::string>(), l);
     if (!hasValue(ls))

Modified: tuscany/cpp/sca/modules/eval/driver.hpp
URL: http://svn.apache.org/viewvc/tuscany/cpp/sca/modules/eval/driver.hpp?rev=826543&r1=826542&r2=826543&view=diff
==============================================================================
--- tuscany/cpp/sca/modules/eval/driver.hpp (original)
+++ tuscany/cpp/sca/modules/eval/driver.hpp Sun Oct 18 22:24:59 2009
@@ -47,7 +47,7 @@
 
 const bool userPrint(std::ostream& out, const value object) {
     if(isCompoundProcedure(object))
-        out << makeList<value>(compoundProcedureSymbol, procedureParameters(object), procedureBody(object), "<procedure-env>");
+        out << mklist<value>(compoundProcedureSymbol, procedureParameters(object), procedureBody(object), "<procedure-env>");
     out << object;
     return true;
 }

Modified: tuscany/cpp/sca/modules/eval/environment.hpp
URL: http://svn.apache.org/viewvc/tuscany/cpp/sca/modules/eval/environment.hpp?rev=826543&r1=826542&r2=826543&view=diff
==============================================================================
--- tuscany/cpp/sca/modules/eval/environment.hpp (original)
+++ tuscany/cpp/sca/modules/eval/environment.hpp Sun Oct 18 22:24:59 2009
@@ -86,7 +86,7 @@
         return frameSoFar;
     }
     if (isDotVariable(car(variables)))
-        return makeBinding(frameSoFar, cdr(variables), makeList<value>(values));
+        return makeBinding(frameSoFar, cdr(variables), mklist<value>(values));
 
     if (isNil(values)) {
         if (!isNil(variables))

Modified: tuscany/cpp/sca/modules/eval/eval-test.cpp
URL: http://svn.apache.org/viewvc/tuscany/cpp/sca/modules/eval/eval-test.cpp?rev=826543&r1=826542&r2=826543&view=diff
==============================================================================
--- tuscany/cpp/sca/modules/eval/eval-test.cpp (original)
+++ tuscany/cpp/sca/modules/eval/eval-test.cpp Sun Oct 18 22:24:59 2009
@@ -33,7 +33,7 @@
 
 bool testEnv() {
     Env globalEnv = list<value>();
-    Env env = extendEnvironment(makeList<value>("a"), makeList<value>(1), globalEnv);
+    Env env = extendEnvironment(mklist<value>("a"), mklist<value>(1), globalEnv);
     defineVariable("x", env, env);
     //assert(lookupVariableValue(value("x"), env) == env);
     assert(lookupVariableValue("a", env) == value(1));
@@ -62,13 +62,13 @@
     assert(read(is2) == value(123));
 
     std::istringstream is3("(abcd)");
-    assert(read(is3) == makeList(value("abcd")));
+    assert(read(is3) == mklist(value("abcd")));
 
     std::istringstream is4("(abcd xyz)");
-    assert(read(is4) == makeList<value>("abcd", "xyz"));
+    assert(read(is4) == mklist<value>("abcd", "xyz"));
 
     std::istringstream is5("(abcd (xyz tuv))");
-    assert(read(is5) == makeList<value>("abcd", makeList<value>("xyz", "tuv")));
+    assert(read(is5) == mklist<value>("abcd", mklist<value>("xyz", "tuv")));
 
     return true;
 }
@@ -133,7 +133,7 @@
 }
 
 bool testEvalExpr() {
-    const value exp = makeList<value>("+", 2, 3);
+    const value exp = mklist<value>("+", 2, 3);
     Env env = setupEnvironment();
     const value r = eval(exp, env);
     assert(r == value(5));
@@ -172,8 +172,5 @@
     tuscany::testEvalGC();
 
     std::cout << "OK" << std::endl;
-
-    tuscany::testEvalRun();
-
     return 0;
 }

Modified: tuscany/cpp/sca/modules/eval/eval.hpp
URL: http://svn.apache.org/viewvc/tuscany/cpp/sca/modules/eval/eval.hpp?rev=826543&r1=826542&r2=826543&view=diff
==============================================================================
--- tuscany/cpp/sca/modules/eval/eval.hpp (original)
+++ tuscany/cpp/sca/modules/eval/eval.hpp Sun Oct 18 22:24:59 2009
@@ -67,7 +67,7 @@
 }
 
 const value makeProcedure(const list<value>& parameters, const value& body, const Env& env) {
-    return makeList<value>(procedureSymbol, parameters, body, env);
+    return mklist<value>(procedureSymbol, parameters, body, env);
 }
 
 const bool isApply(const value& exp) {
@@ -197,7 +197,7 @@
 }
 
 const value makeIf(value predicate, value consequent, value alternative) {
-    return makeList(ifSymbol, predicate, consequent, alternative);
+    return mklist(ifSymbol, predicate, consequent, alternative);
 }
 
 const value expandClauses(const list<value>& clauses) {

Modified: tuscany/cpp/sca/modules/eval/primitive.hpp
URL: http://svn.apache.org/viewvc/tuscany/cpp/sca/modules/eval/primitive.hpp?rev=826543&r1=826542&r2=826543&view=diff
==============================================================================
--- tuscany/cpp/sca/modules/eval/primitive.hpp (original)
+++ tuscany/cpp/sca/modules/eval/primitive.hpp Sun Oct 18 22:24:59 2009
@@ -132,11 +132,11 @@
 }
 
 template<typename F> const value primitiveProcedure(const F& f) {
-    return makeList<value>(primitiveSymbol, (lambda<value(list<value>&)>)f);
+    return mklist<value>(primitiveSymbol, (lambda<value(list<value>&)>)f);
 }
 
 const list<value> primitiveProcedureNames() {
-    list<value> l = makeList<value>("car");
+    list<value> l = mklist<value>("car");
     l = cons<value>("cdr", l);
     l = cons<value>("cons", l);
     l = cons<value>("list", l);
@@ -153,7 +153,7 @@
 }
 
 const list<value> primitiveProcedureObjects() {
-    list<value> l = makeList(primitiveProcedure(valueCar));
+    list<value> l = mklist(primitiveProcedure(valueCar));
     l = cons(primitiveProcedure(valueCdr), l);
     l = cons(primitiveProcedure(valueCons), l);
     l = cons(primitiveProcedure(valueList), l);

Modified: tuscany/cpp/sca/modules/eval/read.hpp
URL: http://svn.apache.org/viewvc/tuscany/cpp/sca/modules/eval/read.hpp?rev=826543&r1=826542&r2=826543&view=diff
==============================================================================
--- tuscany/cpp/sca/modules/eval/read.hpp (original)
+++ tuscany/cpp/sca/modules/eval/read.hpp Sun Oct 18 22:24:59 2009
@@ -38,9 +38,9 @@
 namespace tuscany
 {
 
-const value rightParenthesis(makeList<value>(")"));
-const value leftParenthesis(makeList<value>("("));
-const value comment(makeList<value>(";"));
+const value rightParenthesis(mklist<value>(")"));
+const value leftParenthesis(mklist<value>("("));
+const value comment(mklist<value>(";"));
 
 const double stringToNumber(const std::string& str) {
     double d;
@@ -121,7 +121,7 @@
 }
 
 const value readQuoted(std::istream& in) {
-    return makeList(quoteSymbol, read(in));
+    return mklist(quoteSymbol, read(in));
 }
 
 const list<value> readList(const list<value>& listSoFar, std::istream& in) {
@@ -147,7 +147,7 @@
 }
 
 const value readIdentifier(const char chr, std::istream& in) {
-    return listToString(readIdentifierHelper(makeList(chr), in)).c_str();
+    return listToString(readIdentifierHelper(mklist(chr), in)).c_str();
 }
 
 const list<char> readStringHelper(const list<char>& listSoFar, std::istream& in) {
@@ -169,7 +169,7 @@
 }
 
 const value readNumber(const char chr, std::istream& in) {
-    return stringToNumber(listToString(readNumberHelper(makeList(chr), in)));
+    return stringToNumber(listToString(readNumberHelper(mklist(chr), in)));
 }
 
 const value read(std::istream& in) {

Modified: tuscany/cpp/sca/test/store-function/catalog.hpp
URL: http://svn.apache.org/viewvc/tuscany/cpp/sca/test/store-function/catalog.hpp?rev=826543&r1=826542&r2=826543&view=diff
==============================================================================
--- tuscany/cpp/sca/test/store-function/catalog.hpp (original)
+++ tuscany/cpp/sca/test/store-function/catalog.hpp Sun Oct 18 22:24:59 2009
@@ -33,15 +33,15 @@
 std::string catalog_currencyCode = "USD";
 
 double catalog_convert(const service& currencyConverter, const double price) {
-    return currencyConverter(tuscany::makeList<tuscany::value>("convert", "USD", catalog_currencyCode, price));
+    return currencyConverter(tuscany::mklist<tuscany::value>("convert", "USD", catalog_currencyCode, price));
 }
 
 const tuscany::list<ItemType> catalog_get(const service& currencyConverter) {
-    const std::string currencySymbol = currencyConverter_service(tuscany::makeList<tuscany::value>("getSymbol", catalog_currencyCode));
-    return tuscany::makeList(
-            makeItem("Apple", catalog_currencyCode, currencySymbol, catalog_convert(currencyConverter, 2.99)),
-            makeItem("Orange", catalog_currencyCode, currencySymbol, catalog_convert(currencyConverter, 3.55)),
-            makeItem("Pear", catalog_currencyCode, currencySymbol, catalog_convert(currencyConverter, 1.55)));
+    const std::string currencySymbol = currencyConverter_service(tuscany::mklist<tuscany::value>("getSymbol", catalog_currencyCode));
+    return tuscany::mklist(
+            item("Apple", catalog_currencyCode, currencySymbol, catalog_convert(currencyConverter, 2.99)),
+            item("Orange", catalog_currencyCode, currencySymbol, catalog_convert(currencyConverter, 3.55)),
+            item("Pear", catalog_currencyCode, currencySymbol, catalog_convert(currencyConverter, 1.55)));
 }
 
 const tuscany::value catalog_service(const service& currencyConverter, const tuscany::list<tuscany::value>& args) {

Modified: tuscany/cpp/sca/test/store-function/item.hpp
URL: http://svn.apache.org/viewvc/tuscany/cpp/sca/test/store-function/item.hpp?rev=826543&r1=826542&r2=826543&view=diff
==============================================================================
--- tuscany/cpp/sca/test/store-function/item.hpp (original)
+++ tuscany/cpp/sca/test/store-function/item.hpp Sun Oct 18 22:24:59 2009
@@ -30,8 +30,8 @@
 
 typedef tuscany::value ItemType;
 
-const ItemType makeItem(const std::string& name, const std::string& currencyCode, const std::string& currencySymbol, const double price) {
-    return tuscany::makeList<tuscany::value>(name, currencyCode, currencySymbol, price);
+const ItemType item(const std::string& name, const std::string& currencyCode, const std::string& currencySymbol, const double price) {
+    return tuscany::mklist<tuscany::value>(name, currencyCode, currencySymbol, price);
 }
 
 const std::string itemName(const ItemType& item) {

Modified: tuscany/cpp/sca/test/store-function/store-function-test.cpp
URL: http://svn.apache.org/viewvc/tuscany/cpp/sca/test/store-function/store-function-test.cpp?rev=826543&r1=826542&r2=826543&view=diff
==============================================================================
--- tuscany/cpp/sca/test/store-function/store-function-test.cpp (original)
+++ tuscany/cpp/sca/test/store-function/store-function-test.cpp Sun Oct 18 22:24:59 2009
@@ -33,7 +33,7 @@
 
 bool testComponentAssembly() {
     const service store(storeSolution_service);
-    assert(length((tuscany::list<tuscany::value>)store(tuscany::makeList<tuscany::value>("getCatalog"))) == 3);
+    assert(length((tuscany::list<tuscany::value>)store(tuscany::mklist<tuscany::value>("getCatalog"))) == 3);
     return true;
 }
 

Modified: tuscany/cpp/sca/test/store-function/store-ui.hpp
URL: http://svn.apache.org/viewvc/tuscany/cpp/sca/test/store-function/store-ui.hpp?rev=826543&r1=826542&r2=826543&view=diff
==============================================================================
--- tuscany/cpp/sca/test/store-function/store-ui.hpp (original)
+++ tuscany/cpp/sca/test/store-function/store-ui.hpp Sun Oct 18 22:24:59 2009
@@ -33,19 +33,19 @@
 {
 
 const tuscany::list<ItemType> storeUI_getCatalog(const service& catalog) {
-    return catalog(tuscany::makeList<tuscany::value>("get"));
+    return catalog(tuscany::mklist<tuscany::value>("get"));
 }
 
 const tuscany::list<ItemType> storeUI_getCart(const service& cart) {
-    return cart(tuscany::makeList<tuscany::value>("getAll"));
+    return cart(tuscany::mklist<tuscany::value>("getAll"));
 }
 
 const double storeUI_getTotal(const service& cart) {
-    return cart(tuscany::makeList<tuscany::value>("getTotal"));
+    return cart(tuscany::mklist<tuscany::value>("getTotal"));
 }
 
 const bool storeUI_post(const service& cart, const ItemType& item) {
-    return cart(tuscany::makeList<tuscany::value>("post", item));
+    return cart(tuscany::mklist<tuscany::value>("post", item));
 }
 
 const tuscany::value storeUI_service(const service& catalog, const service& cart, const tuscany::list<tuscany::value>& args) {

Modified: tuscany/cpp/sca/test/store-object/catalog.hpp
URL: http://svn.apache.org/viewvc/tuscany/cpp/sca/test/store-object/catalog.hpp?rev=826543&r1=826542&r2=826543&view=diff
==============================================================================
--- tuscany/cpp/sca/test/store-object/catalog.hpp (original)
+++ tuscany/cpp/sca/test/store-object/catalog.hpp Sun Oct 18 22:24:59 2009
@@ -54,7 +54,7 @@
 
     virtual const tuscany::list<Item> get() const {
         const std::string currencySymbol = currencyConverter.getSymbol(currencyCode);
-        return tuscany::makeList(
+        return tuscany::mklist(
                 Item("Apple", currencyCode, currencySymbol, convert(2.99)),
                 Item("Orange", currencyCode, currencySymbol, convert(3.55)),
                 Item("Pear", currencyCode, currencySymbol, convert(1.55)));



Mime
View raw message