Hello community,
here is the log from the commit of package yast2-core
checked in at Fri Sep 26 16:58:01 CEST 2008.
--------
--- yast2-core/yast2-core.changes 2008-09-26 12:54:20.000000000 +0200
+++ /mounts/work_src_done/STABLE/yast2-core/yast2-core.changes 2008-09-26 16:13:44.418407000 +0200
@@ -1,0 +2,7 @@
+Fri Sep 26 16:09:22 CEST 2008 - visnov@suse.cz
+
+- new builtins: list::difference, list::symmetric_difference,
+ list::intersection, list::union (aschnell, bnc #58844)
+- 2.17.15
+
+-------------------------------------------------------------------
Old:
----
yast2-core-2.17.14.tar.bz2
New:
----
yast2-core-2.17.15.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ yast2-core.spec ++++++
--- /var/tmp/diff_new_pack.u26203/_old 2008-09-26 16:57:49.000000000 +0200
+++ /var/tmp/diff_new_pack.u26203/_new 2008-09-26 16:57:49.000000000 +0200
@@ -1,5 +1,5 @@
#
-# spec file for package yast2-core (Version 2.17.14)
+# spec file for package yast2-core (Version 2.17.15)
#
# Copyright (c) 2008 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
@@ -19,12 +19,12 @@
Name: yast2-core
-Version: 2.17.14
+Version: 2.17.15
Release: 1
License: GPL v2 or later
Group: System/YaST
BuildRoot: %{_tmppath}/%{name}-%{version}-build
-Source0: yast2-core-2.17.14.tar.bz2
+Source0: yast2-core-2.17.15.tar.bz2
Prefix: /usr
# obviously
BuildRequires: gcc-c++
@@ -95,7 +95,7 @@
Stanislav Visnovsky
%prep
-%setup -n yast2-core-2.17.14
+%setup -n yast2-core-2.17.15
%build
%{prefix}/bin/y2tool y2autoconf
@@ -179,6 +179,10 @@
/usr/share/YaST2/data/devtools/bin/generateYCPWrappers
%changelog
* Fri Sep 26 2008 visnov@suse.cz
+- new builtins: list::difference, list::symmetric_difference,
+ list::intersection, list::union (aschnell, bnc #58844)
+- 2.17.15
+* Fri Sep 26 2008 visnov@suse.cz
- allow clients to return exit code (bnc #350740)
- clean up documentation in liby2
- 2.17.14
++++++ yast2-core-2.17.14.tar.bz2 -> yast2-core-2.17.15.tar.bz2 ++++++
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-core-2.17.14/libycp/src/include/ycp/YCPList.h new/yast2-core-2.17.15/libycp/src/include/ycp/YCPList.h
--- old/yast2-core-2.17.14/libycp/src/include/ycp/YCPList.h 2008-09-26 09:35:32.000000000 +0200
+++ new/yast2-core-2.17.15/libycp/src/include/ycp/YCPList.h 2008-09-26 13:05:02.000000000 +0200
@@ -22,12 +22,15 @@
#define YCPList_h
+#include <iterator>
#include "YCPValue.h"
-
+typedef vector<YCPValue> YCPValueList;
+class YCPListIterator;
class YCPCodeCompare;
+
/**
* @short List of YCPValues that is a value itself
* In YCP there is no distinction between lists, tuples and structs.
@@ -42,7 +45,7 @@
*/
class YCPListRep : public YCPValueRep
{
- vector<YCPValue> elements;
+ YCPValueList elements;
protected:
friend class YCPList;
@@ -141,6 +144,20 @@
YCPValue value(int n) const;
/**
+ * Returns a bidirectional STL iterator for the YCPList that
+ * is positioned at the first value pair in the list.
+ * (suitable for iterating over all entries)
+ */
+ YCPListIterator begin() const;
+
+ /**
+ * Returns a bidirectional STL iterator for the YCPList that
+ * is positioned BEHIND the last value pair in the list.
+ * (suitable for iterating over all entries)
+ */
+ YCPListIterator end() const;
+
+ /**
* Compares two YCPLists for equality, greaterness or smallerness.
* The relation is lexicographically with respect to the list elements,
* i.e. elementwise comparison up to the shorter length.
@@ -186,6 +203,59 @@
string commaList() const;
};
+
+/**
+ * @short Iterator for YCPList values.
+ */
+class YCPListIterator
+{
+ friend class YCPListRep;
+
+ YCPValueList::const_iterator position;
+
+public:
+
+ typedef std::bidirectional_iterator_tag iterator_category;
+ typedef ptrdiff_t difference_type;
+ typedef const YCPValue value_type;
+ typedef const YCPValue* pointer;
+ typedef const YCPValue& reference;
+
+protected:
+
+ YCPListIterator(YCPValueList::const_iterator position)
+ : position(position) {}
+
+public:
+
+ /**
+ * Return the value of the current position.
+ */
+ reference operator*() const { return position.operator*(); }
+
+ /**
+ * Check for equality.
+ */
+ friend bool operator==(const YCPListIterator &x, const YCPListIterator &y) {
+ return x.position == y.position;
+ }
+
+ /**
+ * Check for inequality.
+ */
+ friend bool operator!=(const YCPListIterator &x, const YCPListIterator &y) {
+ return !(x == y);
+ }
+
+ /**
+ * Advance to the next position.
+ */
+ void operator++() { ++position; }
+ void operator++(int) { ++position; }
+
+};
+
+
#define CONST_ELEMENT (static_cast(element))
#define ELEMENT (const_cast(static_cast(this->writeCopy())))
@@ -217,6 +287,8 @@
YCPList functionalAdd(const YCPValue& value, bool prepend = false) const
{ return CONST_ELEMENT->functionalAdd (value, prepend); }
YCPValue value(int n) const { return CONST_ELEMENT->value (n); }
+ YCPListIterator begin() const { return CONST_ELEMENT->begin(); }
+ YCPListIterator end() const { return CONST_ELEMENT->end(); }
string commaList() const { return CONST_ELEMENT->commaList (); }
};
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-core-2.17.14/libycp/src/YCPBuiltinList.cc new/yast2-core-2.17.15/libycp/src/YCPBuiltinList.cc
--- old/yast2-core-2.17.14/libycp/src/YCPBuiltinList.cc 2008-08-19 13:20:22.000000000 +0200
+++ new/yast2-core-2.17.15/libycp/src/YCPBuiltinList.cc 2008-09-26 13:24:45.000000000 +0200
@@ -1256,6 +1256,72 @@
return YCPNull();
}
+bool haha(YCPValue a, YCPValue b)
+{
+ YCPOrder comp = a->compare (b);
+ return comp == YO_LESS;
+}
+
+
+static YCPValue
+s_difference(const YCPList& a, const YCPList& b)
+{
+ vector<YCPValue> r;
+ back_insert_iterator< vector<YCPValue> > bii(r);
+
+ set_difference(a->begin(), a->end(), b->begin(), b->end(), bii, haha);
+
+ YCPList ret;
+ for(vector<YCPValue>::iterator it = r.begin(); it != r.end(); it++)
+ ret->add(*it);
+ return ret;
+}
+
+
+static YCPValue
+s_symmetric_difference(const YCPList& a, const YCPList& b)
+{
+ vector<YCPValue> r;
+ back_insert_iterator< vector<YCPValue> > bii(r);
+
+ set_symmetric_difference(a->begin(), a->end(), b->begin(), b->end(), bii, haha);
+
+ YCPList ret;
+ for(vector<YCPValue>::iterator it = r.begin(); it != r.end(); it++)
+ ret->add(*it);
+ return ret;
+}
+
+
+static YCPValue
+s_intersection(const YCPList& a, const YCPList& b)
+{
+ vector<YCPValue> r;
+ back_insert_iterator< vector<YCPValue> > bii(r);
+
+ set_intersection(a->begin(), a->end(), b->begin(), b->end(), bii, haha);
+
+ YCPList ret;
+ for(vector<YCPValue>::iterator it = r.begin(); it != r.end(); it++)
+ ret->add(*it);
+ return ret;
+}
+
+
+static YCPValue
+s_union(const YCPList& a, const YCPList& b)
+{
+ vector<YCPValue> r;
+ back_insert_iterator< vector<YCPValue> > bii(r);
+
+ set_union(a->begin(), a->end(), b->begin(), b->end(), bii, haha);
+
+ YCPList ret;
+ for(vector<YCPValue>::iterator it = r.begin(); it != r.end(); it++)
+ ret->add(*it);
+ return ret;
+}
+
YCPBuiltinList::YCPBuiltinList ()
{
@@ -1296,6 +1362,10 @@
{ "list", "", NULL, DECL_NAMESPACE },
{ "reduce", "flex1 (variable <flex1>, variable <flex1>, const list <flex1>, const block <flex1>)", (void *)l_reduce1, DECL_LOOP|DECL_SYMBOL|DECL_FLEX },
{ "reduce", "flex1 (variable <flex1>, variable <flex2>, const flex1, const list <flex2>, const block <flex1>)", (void *)l_reduce2, DECL_LOOP|DECL_SYMBOL|DECL_FLEX },
+ { "difference", "list <flex> (const list <flex>, const list <flex>)", (void *)s_difference, DECL_FLEX },
+ { "symmetric_difference", "list <flex> (const list <flex>, const list <flex>)", (void *)s_symmetric_difference, DECL_FLEX },
+ { "intersection", "list <flex> (const list <flex>, const list <flex>)", (void *)s_intersection, DECL_FLEX },
+ { "union", "list <flex> (const list <flex>, const list <flex>)", (void *)s_union, DECL_FLEX },
{ 0 }
};
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-core-2.17.14/libycp/src/YCPList.cc new/yast2-core-2.17.15/libycp/src/YCPList.cc
--- old/yast2-core-2.17.14/libycp/src/YCPList.cc 2008-09-26 09:35:04.000000000 +0200
+++ new/yast2-core-2.17.15/libycp/src/YCPList.cc 2008-09-26 13:05:01.000000000 +0200
@@ -193,6 +193,20 @@
}
+YCPListIterator
+YCPListRep::begin() const
+{
+ return elements.begin();
+}
+
+
+YCPListIterator
+YCPListRep::end() const
+{
+ return elements.end();
+}
+
+
YCPOrder
YCPListRep::compare(const YCPList& l) const
{
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-core-2.17.14/VERSION new/yast2-core-2.17.15/VERSION
--- old/yast2-core-2.17.14/VERSION 2008-09-26 12:19:00.000000000 +0200
+++ new/yast2-core-2.17.15/VERSION 2008-09-26 16:11:25.000000000 +0200
@@ -1 +1 @@
-2.17.14
+2.17.15
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
--
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org