Mailinglist Archive: yast-commit (819 mails)

< Previous Next >
[yast-commit] r54485 - in /trunk/core/libycp: src/YCPBuiltinMultiset.cc testsuite/tests/builtin/Builtin-Multiset.err testsuite/tests/builtin/Builtin-Multiset.out testsuite/tests/builtin/Builtin-Multiset.ycp
  • From: aschnell@xxxxxxxxxxxxxxxx
  • Date: Fri, 09 Jan 2009 09:15:15 -0000
  • Message-id: <E1LLDSV-0006ZT-VR@xxxxxxxxxxxxxxxx>
Author: aschnell
Date: Fri Jan 9 10:15:15 2009
New Revision: 54485

URL: http://svn.opensuse.org/viewcvs/yast?rev=54485&view=rev
Log:
- added multiset::merge

Modified:
trunk/core/libycp/src/YCPBuiltinMultiset.cc
trunk/core/libycp/testsuite/tests/builtin/Builtin-Multiset.err
trunk/core/libycp/testsuite/tests/builtin/Builtin-Multiset.out
trunk/core/libycp/testsuite/tests/builtin/Builtin-Multiset.ycp

Modified: trunk/core/libycp/src/YCPBuiltinMultiset.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/core/libycp/src/YCPBuiltinMultiset.cc?rev=54485&r1=54484&r2=54485&view=diff
==============================================================================
--- trunk/core/libycp/src/YCPBuiltinMultiset.cc (original)
+++ trunk/core/libycp/src/YCPBuiltinMultiset.cc Fri Jan 9 10:15:15 2009
@@ -90,6 +90,18 @@
}


+static YCPValue
+ms_merge(const YCPList& a, const YCPList& b)
+{
+ // see http://www.sgi.com/tech/stl/merge.html
+
+ YCPList ret;
+ back_insert_iterator<YCPList> bii(ret);
+ merge(a->begin(), a->end(), b->begin(), b->end(), bii, ycpless());
+ return ret;
+}
+
+
YCPBuiltinMultiset::YCPBuiltinMultiset()
{
// must be static, registerDeclarations saves a pointer to it!
@@ -100,6 +112,7 @@
{ "symmetric_difference", "list <flex> (const list <flex>, const list
<flex>)", (void*) ms_symmetric_difference, DECL_FLEX },
{ "intersection", "list <flex> (const list <flex>, const list
<flex>)", (void*) ms_intersection, DECL_FLEX },
{ "union", "list <flex> (const list <flex>, const list
<flex>)", (void*) ms_union, DECL_FLEX },
+ { "merge", "list <flex> (const list <flex>, const list
<flex>)", (void*) ms_merge, DECL_FLEX },
{ 0 }
};


Modified: trunk/core/libycp/testsuite/tests/builtin/Builtin-Multiset.err
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/core/libycp/testsuite/tests/builtin/Builtin-Multiset.err?rev=54485&r1=54484&r2=54485&view=diff
==============================================================================
--- trunk/core/libycp/testsuite/tests/builtin/Builtin-Multiset.err (original)
+++ trunk/core/libycp/testsuite/tests/builtin/Builtin-Multiset.err Fri Jan 9
10:15:15 2009
@@ -54,3 +54,11 @@
----------------------------------------------------------------------
multiset::union ([1, 3, 5], [2, 3, 4])
----------------------------------------------------------------------
+Parsed:
+----------------------------------------------------------------------
+"** merge **"
+----------------------------------------------------------------------
+Parsed:
+----------------------------------------------------------------------
+multiset::merge ([1, 3, 5], [2, 3, 4])
+----------------------------------------------------------------------

Modified: trunk/core/libycp/testsuite/tests/builtin/Builtin-Multiset.out
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/core/libycp/testsuite/tests/builtin/Builtin-Multiset.out?rev=54485&r1=54484&r2=54485&view=diff
==============================================================================
--- trunk/core/libycp/testsuite/tests/builtin/Builtin-Multiset.out (original)
+++ trunk/core/libycp/testsuite/tests/builtin/Builtin-Multiset.out Fri Jan 9
10:15:15 2009
@@ -12,3 +12,5 @@
([2, 3])
("** union **")
([1, 2, 3, 4, 5])
+("** merge **")
+([1, 2, 3, 3, 4, 5])

Modified: trunk/core/libycp/testsuite/tests/builtin/Builtin-Multiset.ycp
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/core/libycp/testsuite/tests/builtin/Builtin-Multiset.ycp?rev=54485&r1=54484&r2=54485&view=diff
==============================================================================
--- trunk/core/libycp/testsuite/tests/builtin/Builtin-Multiset.ycp (original)
+++ trunk/core/libycp/testsuite/tests/builtin/Builtin-Multiset.ycp Fri Jan 9
10:15:15 2009
@@ -36,3 +36,8 @@

(multiset::union ([1, 3, 5], [2, 3, 4]))

+
+("** merge **")
+
+(multiset::merge ([1, 3, 5], [2, 3, 4]))
+

--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages