Hello community,
here is the log from the commit of package yast2-core
checked in at Wed Apr 9 22:14:12 CEST 2008.
--------
--- yast2-core/yast2-core.changes 2008-04-08 18:15:29.000000000 +0200
+++ /mounts/work_src_done/STABLE/yast2-core/yast2-core.changes 2008-04-09 11:22:17.060757000 +0200
@@ -1,0 +2,6 @@
+Wed Apr 09 11:16:34 CEST 2008 - aschnell@suse.de
+
+- added new builtin sublist
+- 2.16.46
+
+-------------------------------------------------------------------
Old:
----
yast2-core-2.16.45.tar.bz2
New:
----
yast2-core-2.16.46.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ yast2-core.spec ++++++
--- /var/tmp/diff_new_pack.Ci4015/_old 2008-04-09 22:12:54.000000000 +0200
+++ /var/tmp/diff_new_pack.Ci4015/_new 2008-04-09 22:12:54.000000000 +0200
@@ -1,5 +1,5 @@
#
-# spec file for package yast2-core (Version 2.16.45)
+# spec file for package yast2-core (Version 2.16.46)
#
# Copyright (c) 2008 SUSE LINUX Products GmbH, Nuernberg, Germany.
# This file and all modifications and additions to the pristine
@@ -12,12 +12,12 @@
Name: yast2-core
-Version: 2.16.45
+Version: 2.16.46
Release: 1
License: GPL v2 or later
Group: System/YaST
BuildRoot: %{_tmppath}/%{name}-%{version}-build
-Source0: yast2-core-2.16.45.tar.bz2
+Source0: yast2-core-2.16.46.tar.bz2
Prefix: /usr
# obviously
BuildRequires: gcc-c++
@@ -84,7 +84,7 @@
Stanislav Visnovsky
%prep
-%setup -n yast2-core-2.16.45
+%setup -n yast2-core-2.16.46
%build
%{prefix}/bin/y2tool y2autoconf
@@ -161,6 +161,9 @@
%doc %{prefix}/share/doc/packages/yast2-core
/usr/share/YaST2/data/devtools/bin/generateYCPWrappers
%changelog
+* Wed Apr 09 2008 aschnell@suse.de
+- added new builtin sublist
+- 2.16.46
* Tue Apr 08 2008 mvidner@suse.cz
- Compress (gzip) the rotated y2logs, in the background (fate#300637).
- y2base: Added -I and -M options to add search paths for includes and
++++++ yast2-core-2.16.45.tar.bz2 -> yast2-core-2.16.46.tar.bz2 ++++++
++++ 14652 lines of diff (skipped)
++++ retrying with extended exclude list
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/yast2-core-2.16.45/agent-modules/testsuite/tests/dir.scr new/yast2-core-2.16.46/agent-modules/testsuite/tests/dir.scr
--- old/yast2-core-2.16.45/agent-modules/testsuite/tests/dir.scr 2008-02-08 14:18:50.000000000 +0100
+++ new/yast2-core-2.16.46/agent-modules/testsuite/tests/dir.scr 1970-01-01 01:00:00.000000000 +0100
@@ -1,6 +0,0 @@
-.
-
-`ag_modules(
- `ModulesConf("tests/dir.in.test")
-)
-
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/yast2-core-2.16.45/agent-modules/testsuite/tests/missing.scr new/yast2-core-2.16.46/agent-modules/testsuite/tests/missing.scr
--- old/yast2-core-2.16.45/agent-modules/testsuite/tests/missing.scr 2008-02-08 14:18:48.000000000 +0100
+++ new/yast2-core-2.16.46/agent-modules/testsuite/tests/missing.scr 1970-01-01 01:00:00.000000000 +0100
@@ -1,6 +0,0 @@
-.
-
-`ag_modules(
- `ModulesConf("tests/missing.in.test")
-)
-
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/yast2-core-2.16.45/agent-modules/testsuite/tests/read1.scr new/yast2-core-2.16.46/agent-modules/testsuite/tests/read1.scr
--- old/yast2-core-2.16.45/agent-modules/testsuite/tests/read1.scr 2008-02-08 14:18:48.000000000 +0100
+++ new/yast2-core-2.16.46/agent-modules/testsuite/tests/read1.scr 1970-01-01 01:00:00.000000000 +0100
@@ -1,6 +0,0 @@
-.
-
-`ag_modules(
- `ModulesConf("tests/read1.in.test")
-)
-
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/yast2-core-2.16.45/agent-modules/testsuite/tests/write1.scr new/yast2-core-2.16.46/agent-modules/testsuite/tests/write1.scr
--- old/yast2-core-2.16.45/agent-modules/testsuite/tests/write1.scr 2008-02-08 14:18:49.000000000 +0100
+++ new/yast2-core-2.16.46/agent-modules/testsuite/tests/write1.scr 1970-01-01 01:00:00.000000000 +0100
@@ -1,6 +0,0 @@
-.
-
-`ag_modules(
- `ModulesConf("tests/write1.in.test")
-)
-
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/yast2-core-2.16.45/agent-modules/testsuite/tests/write2.scr new/yast2-core-2.16.46/agent-modules/testsuite/tests/write2.scr
--- old/yast2-core-2.16.45/agent-modules/testsuite/tests/write2.scr 2008-02-08 14:18:50.000000000 +0100
+++ new/yast2-core-2.16.46/agent-modules/testsuite/tests/write2.scr 1970-01-01 01:00:00.000000000 +0100
@@ -1,6 +0,0 @@
-.
-
-`ag_modules(
- `ModulesConf("tests/write2.in.test")
-)
-
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/yast2-core-2.16.45/agent-modules/testsuite/tests/write3.scr new/yast2-core-2.16.46/agent-modules/testsuite/tests/write3.scr
--- old/yast2-core-2.16.45/agent-modules/testsuite/tests/write3.scr 2008-02-08 14:18:48.000000000 +0100
+++ new/yast2-core-2.16.46/agent-modules/testsuite/tests/write3.scr 1970-01-01 01:00:00.000000000 +0100
@@ -1,6 +0,0 @@
-.
-
-`ag_modules(
- `ModulesConf("tests/write3.in.test")
-)
-
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/yast2-core-2.16.45/configure.in new/yast2-core-2.16.46/configure.in
--- old/yast2-core-2.16.45/configure.in 2008-04-08 18:21:18.000000000 +0200
+++ new/yast2-core-2.16.46/configure.in 2008-04-09 11:16:08.000000000 +0200
@@ -3,7 +3,7 @@
dnl -- This file is generated by y2autoconf 2.16.8 - DO NOT EDIT! --
dnl (edit configure.in.in instead)
-AC_INIT(yast2-core, 2.16.45, http://bugs.opensuse.org/, yast2-core)
+AC_INIT(yast2-core, 2.16.46, http://bugs.opensuse.org/, yast2-core)
dnl Check for presence of file 'RPMNAME'
AC_CONFIG_SRCDIR([RPMNAME])
@@ -18,7 +18,7 @@
AM_INIT_AUTOMAKE(tar-ustar -Wno-portability)
dnl Important YaST2 variables
-VERSION="2.16.45"
+VERSION="2.16.46"
RPMNAME="yast2-core"
MAINTAINER="Martin Vidner "
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/yast2-core-2.16.45/libycp/src/YCPBuiltinList.cc new/yast2-core-2.16.46/libycp/src/YCPBuiltinList.cc
--- old/yast2-core-2.16.45/libycp/src/YCPBuiltinList.cc 2007-02-08 18:25:15.000000000 +0100
+++ new/yast2-core-2.16.46/libycp/src/YCPBuiltinList.cc 2008-04-09 11:07:50.000000000 +0200
@@ -56,12 +56,12 @@
* Searches for a certain item in the list. It applies the expression
* <tt>EXPR</tt> to each element in the list and returns the first element
* the makes the expression evaluate to true, if <tt>VAR</tt> is bound to
- * that element.
+ * that element.
*
* @return any Returns nil, if nothing is found.
* @usage find (integer n, [3,5,6,4], ``(n >= 5)) -> 5
*/
-
+
if (list.isNull ())
{
return YCPNull ();
@@ -83,7 +83,7 @@
ycp2error ("Bad find expression %s", expr->toString ().c_str ());
break;
}
- // nil == false
+ // nil == false
if (v->isVoid ())
{
ycp2error ("The expression for 'find' returned 'nil'");
@@ -105,7 +105,7 @@
l_prepend (const YCPList &list, const YCPValue &value)
{
/**
- * @builtin prepend
+ * @builtin prepend
* @short Prepends a list with a new element
* @param list LIST List
* @param any ELEMENT Element to prepend
@@ -130,7 +130,7 @@
l_contains (const YCPList &list, const YCPValue &value)
{
/**
- * @builtin contains
+ * @builtin contains
* @short Checks if a list contains an element
* @param list LIST List
* @param any ELEMENT Element
@@ -138,7 +138,7 @@
* @description
*
* Determines, if a certain value <tt>ELEMENT</tt> is contained in
- * a list <tt>LIST</tt>.
+ * a list <tt>LIST</tt>.
*
* @usage contains ([1, 2, 5], 2) -> true
*/
@@ -218,14 +218,14 @@
* @short Unions of lists
* @param list LIST1 First List
* @param list LIST2 Second List
- * @return list
+ * @return list
*
* @description
* Interprets two lists as sets and returns a new list that has
* all elements of the first list and all of the second list. Identical
* elements are merged. The order of the elements in the new list is
* preserved. Elements of <tt>l1</tt> are prior to elements from <tt>l2</tt>.
- *
+ *
* WARNING: quadratic complexity so far
*
* @see merge
@@ -275,11 +275,11 @@
l_mergelist (const YCPList &list1, const YCPList &list2)
{
/**
- * @builtin merge
+ * @builtin merge
* @short Merges two lists into one
* @param list LIST1 First List
* @param list LIST2 Second List
- * @return list
+ * @return list
*
* @description
* Interprets two lists as sets and returns a new list that has
@@ -314,6 +314,98 @@
static YCPValue
+l_sublist1(const YCPList &list, const YCPInteger &offset)
+{
+ /**
+ * @builtin sublist
+ * @short Extracts a sublist
+ *
+ * @description
+ * Extracts a sublist of the list <tt>LIST</tt> starting at
+ * <tt>OFFSET</tt>. The <tt>OFFSET</tt> starts with 0.
+ *
+ * @param list LIST
+ * @param integer OFFSET
+ * @return list
+ *
+ * @usage sublist ([ "a", "b", "c"], 0) -> [ "a", "b", "c" ]
+ * @usage sublist ([ "a", "b", "c"], 2) -> [ "c" ]
+ */
+
+ if (list.isNull () || offset.isNull())
+ return YCPNull ();
+
+ int i1 = offset->value();
+ int i2 = list->size();
+
+ if (i1 < 0 || i1 >= list->size ())
+ {
+ ycp2error ("Offset %s for sublist () out of range", toString (i1).c_str ());
+ return YCPNull ();
+ }
+
+ YCPList newlist;
+
+ for (int i = i1; i < i2; i++)
+ {
+ newlist->add (list->value(i));
+ }
+
+ return newlist;
+}
+
+
+static YCPValue
+l_sublist2(const YCPList &list, const YCPInteger &offset, const YCPInteger &length)
+{
+ /**
+ * @builtin sublist
+ * @short Extracts a sublist
+ *
+ * @description
+ * Extracts a sublist of the list <tt>LIST</tt> starting at
+ * <tt>OFFSET</tt> with length <tt>LENGTH</tt>. The <tt>OFFSET</tt>
+ * starts with 0.
+ *
+ * @param list LIST
+ * @param integer OFFSET
+ * @param integer LENGTH
+ * @return list
+ *
+ * @usage sublist ([ "a", "b", "c"], 0, 2) -> [ "a", "b" ]
+ * @usage sublist ([ "a", "b", "c"], 1, 1) -> [ "b" ]
+ */
+
+ if (list.isNull () || offset.isNull() || length.isNull ())
+ return YCPNull ();
+
+ int i1 = offset->value();
+ int i2 = i1 + length->value();
+
+ if (i1 < 0 || i1 >= list->size ())
+ {
+ ycp2error ("Offset %s for sublist () out of range", toString (i1).c_str ());
+ return YCPNull ();
+ }
+
+ if (i2 < i1 || i2 > list->size ())
+ {
+ ycp2error ("Length %s for sublist () out of range", toString (i2).c_str ());
+ return YCPNull ();
+ }
+
+ YCPList newlist;
+
+ for (int i = i1; i < i2; i++)
+ {
+ newlist->add (list->value(i));
+ }
+
+ return newlist;
+}
+
+
+static YCPValue
l_filter (const YCPSymbol &symbol, const YCPList &list, const YCPCode &expr)
{
/**
@@ -322,7 +414,7 @@
* @param any VAR Variable
* @param list LIST List to be filtered
* @param block<boolean> EXPR Block
- * @return list
+ * @return list
* @description
* For each element of the list <tt>LIST</tt> the expression <tt>expr</tt>
* is executed in a new block, where the variable <tt>VAR</tt>
@@ -353,7 +445,7 @@
ycp2error ("Bad filter expression %s", expr->toString ().c_str ());
return YCPNull ();
}
- // nil == false
+ // nil == false
if (v->isVoid ())
{
ycp2error ("The expression for 'filter' returned 'nil'");
@@ -475,7 +567,7 @@
}
else if (! curr_value ->isMap () )
{
- ycp2error("listmap() expression has to deliver a single entry map! You have produced the following value: %s",
+ ycp2error("listmap() expression has to deliver a single entry map! You have produced the following value: %s",
curr_value->toString().c_str());
return YCPNull ();
}
@@ -489,7 +581,7 @@
}
else
{
- ycp2error("listmap() expression has to deliver a single entry map! You have produced the following value: %s",
+ ycp2error("listmap() expression has to deliver a single entry map! You have produced the following value: %s",
curr_map->toString().c_str());
return YCPNull ();
}
@@ -616,7 +708,7 @@
* @id sort_2
* @short Sort list using an expression
* @param any x
- * @param any y
+ * @param any y
* @param list LIST
* @param block EXPR
* @return list
@@ -711,7 +803,7 @@
{
return YCPNull ();
}
-
+
if (c.isNull ())
{
ycp2error ("Cannot split string using 'nil'");
@@ -817,7 +909,7 @@
l_size (const YCPValue &list)
{
/**
- * @builtin size
+ * @builtin size
* @short Returns size of list
* @param list LIST
* @return integer size of the list
@@ -857,7 +949,7 @@
{
return YCPNull ();
}
-
+
if (i.isNull ())
{
ycp2error ("Cannot remove item at index 'nil'");
@@ -916,7 +1008,7 @@
{
return def;
}
-
+
// FIXME: runtime type check, because of the term variant of select
// ensure, that it is really a list
YCPValue tmp = list;
@@ -931,9 +1023,9 @@
ycp2error ("Incorrect builtin called, %s is not a list", tmp->toString ().c_str ());
return def;
}
-
+
YCPValue v = list->asList()->value (idx);
-
+
return v;
}
@@ -943,7 +1035,7 @@
{
/**
* @builtin foreach
- * @short Processes the content of a list
+ * @short Processes the content of a list
* @param any VAR
* @param list LIST
* @param block EXPR
@@ -962,7 +1054,7 @@
{
return YCPNull ();
}
-
+
SymbolEntryPtr s = sym->asEntry()->entry();
YCPValue ret = YCPVoid();
@@ -1024,6 +1116,8 @@
{ "union", "list <any> (const list <any>, const list <any>)", (void *)l_unionlist },
{ "+", "list <flex> (const list <flex>, const list <flex>)", (void *)l_unionlist, DECL_FLEX },
{ "merge", "list <any> (const list <any>, const list <any>)", (void *)l_mergelist },
+ { "sublist", "list <flex> (const list <flex>, integer)", (void *)l_sublist1, DECL_FLEX },
+ { "sublist", "list <flex> (const list <flex>, integer, integer)", (void *)l_sublist2, DECL_FLEX },
{ "filter", "list <flex> (variable <flex>, const list <flex>, const block <boolean>)", (void *)l_filter, DECL_LOOP|DECL_SYMBOL|DECL_FLEX },
{ "maplist", "list <flex1> (variable <flex2>, const list <flex2>, const block <flex1>)", (void *)l_maplist, DECL_LOOP|DECL_SYMBOL|DECL_FLEX },
{ "listmap", "map (variable <flex3>, const list <flex3>, const block