Mailinglist Archive: yast-commit (819 mails)

< Previous Next >
[yast-commit] r54478 - in /trunk/core: libycp/src/ libycp/src/include/ycp/ libycp/testsuite/tests/builtin/ package/
  • From: aschnell@xxxxxxxxxxxxxxxx
  • Date: Thu, 08 Jan 2009 17:29:39 -0000
  • Message-id: <E1LKyhQ-0005rL-0l@xxxxxxxxxxxxxxxx>
Author: aschnell
Date: Thu Jan 8 18:29:39 2009
New Revision: 54478

URL: http://svn.opensuse.org/viewcvs/yast?rev=54478&view=rev
Log:
- added namespace multiset with
1. some list function,
2. some new functions and
3. extended testsuite

Added:
trunk/core/libycp/src/YCPBuiltinMultiset.cc
trunk/core/libycp/src/include/ycp/YCPBuiltinMultiset.h
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/Makefile.am
trunk/core/libycp/src/YBuiltin.cc
trunk/core/libycp/src/YCPBuiltinList.cc
trunk/core/libycp/src/include/ycp/Makefile.am
trunk/core/libycp/testsuite/tests/builtin/Builtin-List.err
trunk/core/libycp/testsuite/tests/builtin/Builtin-List.out
trunk/core/libycp/testsuite/tests/builtin/Builtin-List.ycp
trunk/core/package/yast2-core.changes

Modified: trunk/core/libycp/src/Makefile.am
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/core/libycp/src/Makefile.am?rev=54478&r1=54477&r2=54478&view=diff
==============================================================================
--- trunk/core/libycp/src/Makefile.am (original)
+++ trunk/core/libycp/src/Makefile.am Thu Jan 8 18:29:39 2009
@@ -46,6 +46,7 @@
YCPBuiltinString.cc YCPBuiltinTerm.cc \
YCPBuiltinVoid.cc YCPBuiltinMap.cc \
YCPBuiltinMisc.cc YCPBuiltinSymbol.cc \
+ YCPBuiltinMultiset.cc \
YSymbolEntry.cc \
TypeStatics.cc \
y2string.cc \

Modified: trunk/core/libycp/src/YBuiltin.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/core/libycp/src/YBuiltin.cc?rev=54478&r1=54477&r2=54478&view=diff
==============================================================================
--- trunk/core/libycp/src/YBuiltin.cc (original)
+++ trunk/core/libycp/src/YBuiltin.cc Thu Jan 8 18:29:39 2009
@@ -50,6 +50,9 @@
#include "ycp/YCPBuiltinList.h"
static YCPBuiltinList builtin_list; // trigger constructor

+#include "ycp/YCPBuiltinMultiset.h"
+static YCPBuiltinMultiset builtin_multiset; // trigger constructor
+
#include "ycp/YCPBuiltinSymbol.h"
static YCPBuiltinSymbol builtin_symbol; // trigger constructor


Modified: trunk/core/libycp/src/YCPBuiltinList.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/core/libycp/src/YCPBuiltinList.cc?rev=54478&r1=54477&r2=54478&view=diff
==============================================================================
--- trunk/core/libycp/src/YCPBuiltinList.cc (original)
+++ trunk/core/libycp/src/YCPBuiltinList.cc Thu Jan 8 18:29:39 2009
@@ -1205,54 +1205,6 @@
}


-static YCPValue
-s_difference(const YCPList& a, const YCPList& b)
-{
- // see http://www.sgi.com/tech/stl/set_difference.html
-
- YCPList ret;
- back_insert_iterator<YCPList> bii(ret);
- set_difference(a->begin(), a->end(), b->begin(), b->end(), bii, ycpless());
- return ret;
-}
-
-
-static YCPValue
-s_symmetric_difference(const YCPList& a, const YCPList& b)
-{
- // see http://www.sgi.com/tech/stl/set_symmetric_difference.html
-
- YCPList ret;
- back_insert_iterator<YCPList> bii(ret);
- set_symmetric_difference(a->begin(), a->end(), b->begin(), b->end(), bii,
ycpless());
- return ret;
-}
-
-
-static YCPValue
-s_intersection(const YCPList& a, const YCPList& b)
-{
- // see http://www.sgi.com/tech/stl/set_intersection.html
-
- YCPList ret;
- back_insert_iterator<YCPList> bii(ret);
- set_intersection(a->begin(), a->end(), b->begin(), b->end(), bii,
ycpless());
- return ret;
-}
-
-
-static YCPValue
-s_union(const YCPList& a, const YCPList& b)
-{
- // see http://www.sgi.com/tech/stl/set_union.html
-
- YCPList ret;
- back_insert_iterator<YCPList> bii(ret);
- set_union(a->begin(), a->end(), b->begin(), b->end(), bii, ycpless());
- return ret;
-}
-
-
YCPBuiltinList::YCPBuiltinList ()
{
// must be static, registerDeclarations saves a pointer to it!
@@ -1293,10 +1245,6 @@
{ "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 }
};


Added: trunk/core/libycp/src/YCPBuiltinMultiset.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/core/libycp/src/YCPBuiltinMultiset.cc?rev=54478&view=auto
==============================================================================
--- trunk/core/libycp/src/YCPBuiltinMultiset.cc (added)
+++ trunk/core/libycp/src/YCPBuiltinMultiset.cc Thu Jan 8 18:29:39 2009
@@ -0,0 +1,107 @@
+/*---------------------------------------------------------------------\
+| |
+| __ __ ____ _____ ____ |
+| \ \ / /_ _/ ___|_ _|___ \ |
+| \ V / _` \___ \ | | __) | |
+| | | (_| |___) || | / __/ |
+| |_|\__,_|____/ |_| |_____| |
+| |
+| core system |
+| (C) SuSE Linux GmbH |
+\----------------------------------------------------------------------/
+
+ File: YCPBuiltinMultiset.cc
+ Summary: YCP Multiset Builtins
+
+ Authors: Arvin Schnell <aschnell@xxxxxxx>
+ Maintainer: Arvin Schnell <aschnell@xxxxxxx>
+
+/-*/
+
+#include <algorithm>
+
+#include "ycp/YCPBuiltinMultiset.h"
+#include "ycp/YCPList.h"
+#include "ycp/YCPBoolean.h"
+#include "ycp/YCPVoid.h"
+#include "ycp/YCPCode.h"
+#include "ycp/YCPCodeCompare.h"
+#include "ycp/StaticDeclaration.h"
+
+#include "ycp/y2log.h"
+
+extern StaticDeclaration static_declarations;
+
+
+static YCPValue
+ms_includes(const YCPList& a, const YCPList& b)
+{
+ // see http://www.sgi.com/tech/stl/includes.html
+
+ return YCPBoolean(includes(a->begin(), a->end(), b->begin(), b->end(),
ycpless()));
+}
+
+
+static YCPValue
+ms_difference(const YCPList& a, const YCPList& b)
+{
+ // see http://www.sgi.com/tech/stl/set_difference.html
+
+ YCPList ret;
+ back_insert_iterator<YCPList> bii(ret);
+ set_difference(a->begin(), a->end(), b->begin(), b->end(), bii, ycpless());
+ return ret;
+}
+
+
+static YCPValue
+ms_symmetric_difference(const YCPList& a, const YCPList& b)
+{
+ // see http://www.sgi.com/tech/stl/set_symmetric_difference.html
+
+ YCPList ret;
+ back_insert_iterator<YCPList> bii(ret);
+ set_symmetric_difference(a->begin(), a->end(), b->begin(), b->end(), bii,
ycpless());
+ return ret;
+}
+
+
+static YCPValue
+ms_intersection(const YCPList& a, const YCPList& b)
+{
+ // see http://www.sgi.com/tech/stl/set_intersection.html
+
+ YCPList ret;
+ back_insert_iterator<YCPList> bii(ret);
+ set_intersection(a->begin(), a->end(), b->begin(), b->end(), bii,
ycpless());
+ return ret;
+}
+
+
+static YCPValue
+ms_union(const YCPList& a, const YCPList& b)
+{
+ // see http://www.sgi.com/tech/stl/set_union.html
+
+ YCPList ret;
+ back_insert_iterator<YCPList> bii(ret);
+ set_union(a->begin(), a->end(), b->begin(), b->end(), bii, ycpless());
+ return ret;
+}
+
+
+YCPBuiltinMultiset::YCPBuiltinMultiset()
+{
+ // must be static, registerDeclarations saves a pointer to it!
+ static declaration_t declarations_ns[] = {
+ { "multiset", "",
NULL, DECL_NAMESPACE },
+ { "includes", "boolean (const list <flex>, const list
<flex>)", (void*) ms_includes, DECL_FLEX },
+ { "difference", "list <flex> (const list <flex>, const list
<flex>)", (void*) ms_difference, DECL_FLEX },
+ { "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 },
+ { 0 }
+ };
+
+ static_declarations.registerDeclarations("YCPBuiltinMultiset",
declarations_ns);
+}

Modified: trunk/core/libycp/src/include/ycp/Makefile.am
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/core/libycp/src/include/ycp/Makefile.am?rev=54478&r1=54477&r2=54478&view=diff
==============================================================================
--- trunk/core/libycp/src/include/ycp/Makefile.am (original)
+++ trunk/core/libycp/src/include/ycp/Makefile.am Thu Jan 8 18:29:39 2009
@@ -24,6 +24,7 @@
YCPBuiltinMap.h YCPBuiltinMisc.h \
YCPBuiltinPath.h YCPBuiltinString.h \
YCPBuiltinTerm.h YCPBuiltinVoid.h \
+ YCPBuiltinMultiset.h \
StaticDeclaration.h \
YCode.h YCodePtr.h \
YCPCode.h \

Added: trunk/core/libycp/src/include/ycp/YCPBuiltinMultiset.h
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/core/libycp/src/include/ycp/YCPBuiltinMultiset.h?rev=54478&view=auto
==============================================================================
--- trunk/core/libycp/src/include/ycp/YCPBuiltinMultiset.h (added)
+++ trunk/core/libycp/src/include/ycp/YCPBuiltinMultiset.h Thu Jan 8 18:29:39
2009
@@ -0,0 +1,34 @@
+/*---------------------------------------------------------------------\
+| |
+| __ __ ____ _____ ____ |
+| \ \ / /_ _/ ___|_ _|___ \ |
+| \ V / _` \___ \ | | __) | |
+| | | (_| |___) || | / __/ |
+| |_|\__,_|____/ |_| |_____| |
+| |
+| core system |
+| (C) SuSE Linux GmbH |
+\----------------------------------------------------------------------/
+
+ File: YCPBuiltinMultiset.h
+
+ Author: Arvin Schnell <aschnell@xxxxxxx>
+ Maintainer: Arvin Schnell <aschnell@xxxxxxx>
+
+/-*/
+
+
+#ifndef YCPBuiltinMultiset_h
+#define YCPBuiltinMultiset_h
+
+class YCPBuiltinMultiset
+{
+
+public:
+
+ YCPBuiltinMultiset();
+
+};
+
+
+#endif // YCPBuiltinMultiset_h

Modified: trunk/core/libycp/testsuite/tests/builtin/Builtin-List.err
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/core/libycp/testsuite/tests/builtin/Builtin-List.err?rev=54478&r1=54477&r2=54478&view=diff
==============================================================================
--- trunk/core/libycp/testsuite/tests/builtin/Builtin-List.err (original)
+++ trunk/core/libycp/testsuite/tests/builtin/Builtin-List.err Thu Jan 8
18:29:39 2009
@@ -179,15 +179,3 @@
----------------------------------------------------------------------
list::reduce (term t, float f, `item (`id (`dummy)), [3.14, 2.71], { return
add (t, tostring (f)); })
----------------------------------------------------------------------
-Parsed:
-----------------------------------------------------------------------
-"** difference **"
-----------------------------------------------------------------------
-Parsed:
-----------------------------------------------------------------------
-list::difference ([1, 2, 3], [2, 3, 4])
-----------------------------------------------------------------------
-Parsed:
-----------------------------------------------------------------------
-list::difference ([2, 3, 4], [1, 2, 3])
-----------------------------------------------------------------------

Modified: trunk/core/libycp/testsuite/tests/builtin/Builtin-List.out
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/core/libycp/testsuite/tests/builtin/Builtin-List.out?rev=54478&r1=54477&r2=54478&view=diff
==============================================================================
--- trunk/core/libycp/testsuite/tests/builtin/Builtin-List.out (original)
+++ trunk/core/libycp/testsuite/tests/builtin/Builtin-List.out Thu Jan 8
18:29:39 2009
@@ -39,6 +39,3 @@
(48)
(`item (`id (`dummy)))
(`item (`id (`dummy), "3.14", "2.71"))
-("** difference **")
-([1])
-([4])

Modified: trunk/core/libycp/testsuite/tests/builtin/Builtin-List.ycp
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/core/libycp/testsuite/tests/builtin/Builtin-List.ycp?rev=54478&r1=54477&r2=54478&view=diff
==============================================================================
--- trunk/core/libycp/testsuite/tests/builtin/Builtin-List.ycp (original)
+++ trunk/core/libycp/testsuite/tests/builtin/Builtin-List.ycp Thu Jan 8
18:29:39 2009
@@ -84,8 +84,3 @@
(list::reduce (term t, float f, `item(`id(`dummy)), [3.14, 2.71], { return
add(t, tostring(f)); }))


-("** difference **")
-
-(list::difference ([1, 2, 3], [2, 3, 4]))
-(list::difference ([2, 3, 4], [1, 2, 3]))
-

Added: 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=54478&view=auto
==============================================================================
--- trunk/core/libycp/testsuite/tests/builtin/Builtin-Multiset.err (added)
+++ trunk/core/libycp/testsuite/tests/builtin/Builtin-Multiset.err Thu Jan 8
18:29:39 2009
@@ -0,0 +1,56 @@
+Parsed:
+----------------------------------------------------------------------
+"** includes **"
+----------------------------------------------------------------------
+Parsed:
+----------------------------------------------------------------------
+multiset::includes ([1, 2, 3, 4, 5], [2, 3, 4])
+----------------------------------------------------------------------
+Parsed:
+----------------------------------------------------------------------
+multiset::includes ([1, 2, 3, 4, 5], [4, 5, 6])
+----------------------------------------------------------------------
+Parsed:
+----------------------------------------------------------------------
+"** difference **"
+----------------------------------------------------------------------
+Parsed:
+----------------------------------------------------------------------
+multiset::difference ([1, 2, 3], [2, 3, 4])
+----------------------------------------------------------------------
+Parsed:
+----------------------------------------------------------------------
+multiset::difference ([2, 3, 4], [1, 2, 3])
+----------------------------------------------------------------------
+Parsed:
+----------------------------------------------------------------------
+"** symmetric_difference **"
+----------------------------------------------------------------------
+Parsed:
+----------------------------------------------------------------------
+multiset::symmetric_difference ([1, 2, 3], [2, 3, 4])
+----------------------------------------------------------------------
+Parsed:
+----------------------------------------------------------------------
+multiset::symmetric_difference ([2, 3, 4], [1, 2, 3])
+----------------------------------------------------------------------
+Parsed:
+----------------------------------------------------------------------
+"** intersection **"
+----------------------------------------------------------------------
+Parsed:
+----------------------------------------------------------------------
+multiset::intersection ([1, 2, 3], [2, 3, 4])
+----------------------------------------------------------------------
+Parsed:
+----------------------------------------------------------------------
+multiset::intersection ([2, 3, 4], [1, 2, 3])
+----------------------------------------------------------------------
+Parsed:
+----------------------------------------------------------------------
+"** union **"
+----------------------------------------------------------------------
+Parsed:
+----------------------------------------------------------------------
+multiset::union ([1, 3, 5], [2, 3, 4])
+----------------------------------------------------------------------

Added: 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=54478&view=auto
==============================================================================
--- trunk/core/libycp/testsuite/tests/builtin/Builtin-Multiset.out (added)
+++ trunk/core/libycp/testsuite/tests/builtin/Builtin-Multiset.out Thu Jan 8
18:29:39 2009
@@ -0,0 +1,14 @@
+("** includes **")
+(true)
+(false)
+("** difference **")
+([1])
+([4])
+("** symmetric_difference **")
+([1, 4])
+([1, 4])
+("** intersection **")
+([2, 3])
+([2, 3])
+("** union **")
+([1, 2, 3, 4, 5])

Added: 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=54478&view=auto
==============================================================================
--- trunk/core/libycp/testsuite/tests/builtin/Builtin-Multiset.ycp (added)
+++ trunk/core/libycp/testsuite/tests/builtin/Builtin-Multiset.ycp Thu Jan 8
18:29:39 2009
@@ -0,0 +1,38 @@
+
+# ---------------------------------------------------------
+#
+# Filename: Builtin-Multiset.ycp
+#
+# Purpose: test cases for all multiset builtins
+#
+# ---------------------------------------------------------
+
+
+("** includes **")
+
+(multiset::includes ([1, 2, 3, 4, 5], [2, 3, 4]))
+(multiset::includes ([1, 2, 3, 4, 5], [4, 5, 6]))
+
+
+("** difference **")
+
+(multiset::difference ([1, 2, 3], [2, 3, 4]))
+(multiset::difference ([2, 3, 4], [1, 2, 3]))
+
+
+("** symmetric_difference **")
+
+(multiset::symmetric_difference ([1, 2, 3], [2, 3, 4]))
+(multiset::symmetric_difference ([2, 3, 4], [1, 2, 3]))
+
+
+("** intersection **")
+
+(multiset::intersection ([1, 2, 3], [2, 3, 4]))
+(multiset::intersection ([2, 3, 4], [1, 2, 3]))
+
+
+("** union **")
+
+(multiset::union ([1, 3, 5], [2, 3, 4]))
+

Modified: trunk/core/package/yast2-core.changes
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/core/package/yast2-core.changes?rev=54478&r1=54477&r2=54478&view=diff
==============================================================================
--- trunk/core/package/yast2-core.changes (original)
+++ trunk/core/package/yast2-core.changes Thu Jan 8 18:29:39 2009
@@ -1,8 +1,14 @@
-------------------------------------------------------------------
+Thu Jan 08 19:01:01 CET 2009 - aschnell@xxxxxxx
+
+- added namespace multiset with 1. some list function, 2. some new
+ functions and 3. extended testsuite
+- 2.18.1
+
+-------------------------------------------------------------------
Wed Jan 07 15:17:23 CET 2009 - aschnell@xxxxxxx

- improved YCPList and YCPMap iterators
-- 2.18.1

-------------------------------------------------------------------
Mon Jan 5 15:20:56 CET 2009 - visnov@xxxxxxx

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

< Previous Next >
This Thread
  • No further messages