Hello community,
here is the log from the commit of package octave-forge-struct for
openSUSE:Factory checked in at 2016-06-14 23:07:51
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/octave-forge-struct (Old)
and /work/SRC/openSUSE:Factory/.octave-forge-struct.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "octave-forge-struct"
Changes:
--------
--- /work/SRC/openSUSE:Factory/octave-forge-struct/octave-forge-struct.changes
2015-06-16 15:14:11.000000000 +0200
+++
/work/SRC/openSUSE:Factory/.octave-forge-struct.new/octave-forge-struct.changes
2016-06-14 23:07:53.000000000 +0200
@@ -1,0 +2,6 @@
+Fri Jun 10 16:10:45 UTC 2016 - [email protected]
+
+- Update to version 1.0.13
+ * Bugfix release
+
+-------------------------------------------------------------------
Old:
----
struct-1.0.11.tar.gz
New:
----
struct-1.0.13.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ octave-forge-struct.spec ++++++
--- /var/tmp/diff_new_pack.dUFJ9N/_old 2016-06-14 23:07:54.000000000 +0200
+++ /var/tmp/diff_new_pack.dUFJ9N/_new 2016-06-14 23:07:54.000000000 +0200
@@ -1,7 +1,7 @@
#
# spec file for package octave-forge-struct
#
-# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -18,7 +18,7 @@
%define octpkg struct
Name: octave-forge-%{octpkg}
-Version: 1.0.11
+Version: 1.0.13
Release: 0
Summary: Additional Structure manipulations functions for Octave
License: GPL-3.0+
++++++ struct-1.0.11.tar.gz -> struct-1.0.13.tar.gz ++++++
++++ 5911 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/struct-1.0.11/DESCRIPTION new/struct-1.0.13/DESCRIPTION
--- old/struct-1.0.11/DESCRIPTION 2015-03-06 15:52:09.000000000 +0100
+++ new/struct-1.0.13/DESCRIPTION 2016-04-22 10:49:34.000000000 +0200
@@ -1,6 +1,6 @@
-Name: Struct
-Version: 1.0.11
-Date: 2015-03-06
+Name: struct
+Version: 1.0.13
+Date: 2016-04-21
Author: Etienne Grossmann <[email protected]>, Olaf Till <[email protected]>
Maintainer: Olaf Till <[email protected]>
Title: Structure Handling.
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/struct-1.0.11/NEWS new/struct-1.0.13/NEWS
--- old/struct-1.0.11/NEWS 2015-03-06 15:52:09.000000000 +0100
+++ new/struct-1.0.13/NEWS 2016-04-22 10:49:34.000000000 +0200
@@ -1,3 +1,15 @@
+Summary of important user-visible changes for struct 1.0.13:
+-------------------------------------------------------------------
+
+ ** Build fixes for new Octave versions.
+
+Summary of important user-visible changes for struct 1.0.12:
+-------------------------------------------------------------------
+
+ ** Make compatible with Octaves new exception-based error
+ handling. Compatibility with old error handling up to Octave-4.0
+ is retained.
+
Summary of important user-visible changes for struct 1.0.11:
-------------------------------------------------------------------
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/struct-1.0.11/inst/getfields.m new/struct-1.0.13/inst/getfields.m
--- old/struct-1.0.11/inst/getfields.m 2015-03-06 15:52:09.000000000 +0100
+++ new/struct-1.0.13/inst/getfields.m 2016-04-22 10:49:34.000000000 +0200
@@ -1,5 +1,5 @@
## Copyright (C) 2000 Etienne Grossmann <[email protected]>
-## Copyright (C) 2012 Olaf Till <[email protected]>
+## Copyright (C) 2012-2016 Olaf Till <[email protected]>
##
## This program is free software; you can redistribute it and/or modify it
under
## the terms of the GNU General Public License as published by the Free
Software
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/struct-1.0.11/inst/setfields.m new/struct-1.0.13/inst/setfields.m
--- old/struct-1.0.11/inst/setfields.m 2015-03-06 15:52:09.000000000 +0100
+++ new/struct-1.0.13/inst/setfields.m 2016-04-22 10:49:34.000000000 +0200
@@ -1,6 +1,6 @@
## Copyright (C) 2000 Etienne Grossmann <[email protected]>
## Copyright (C) 2000 Paul Kienzle <[email protected]>
-## Copyright (C) 2012 Olaf Till <[email protected]>
+## Copyright (C) 2012-2016 Olaf Till <[email protected]>
##
## This program is free software; you can redistribute it and/or modify it
under
## the terms of the GNU General Public License as published by the Free
Software
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/struct-1.0.11/inst/tars.m new/struct-1.0.13/inst/tars.m
--- old/struct-1.0.11/inst/tars.m 2015-03-06 15:52:09.000000000 +0100
+++ new/struct-1.0.13/inst/tars.m 2016-04-22 10:49:34.000000000 +0200
@@ -1,5 +1,5 @@
## Copyright (C) 2000 Etienne Grossmann <[email protected]>
-## Copyright (C) 2012 Olaf Till <[email protected]>
+## Copyright (C) 2012-2016 Olaf Till <[email protected]>
##
## This program is free software; you can redistribute it and/or modify it
under
## the terms of the GNU General Public License as published by the Free
Software
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/struct-1.0.11/src/Makefile new/struct-1.0.13/src/Makefile
--- old/struct-1.0.11/src/Makefile 2015-03-06 15:52:09.000000000 +0100
+++ new/struct-1.0.13/src/Makefile 1970-01-01 01:00:00.000000000 +0100
@@ -1,12 +0,0 @@
-ifndef MKOCTFILE
-MKOCTFILE := mkoctfile
-endif
-
-OCTS = fields2cell.oct fieldempty.oct structcat.oct cell2fields.oct
-
-all: $(OCTS)
-
-%.oct: %.cc
- $(MKOCTFILE) -s $<
-
-clean: ; rm *.o *.oct
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/struct-1.0.11/src/bootstrap new/struct-1.0.13/src/bootstrap
--- old/struct-1.0.11/src/bootstrap 1970-01-01 01:00:00.000000000 +0100
+++ new/struct-1.0.13/src/bootstrap 2016-04-22 10:49:34.000000000 +0200
@@ -0,0 +1,3 @@
+#! /bin/sh
+
+autoconf
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/struct-1.0.11/src/cell2fields.cc new/struct-1.0.13/src/cell2fields.cc
--- old/struct-1.0.11/src/cell2fields.cc 2015-03-06 15:52:09.000000000
+0100
+++ new/struct-1.0.13/src/cell2fields.cc 2016-04-22 10:49:34.000000000
+0200
@@ -1,6 +1,6 @@
/*
-Copyright (C) 2010 Olaf Till
+Copyright (C) 2010-2016 Olaf Till
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -20,6 +20,8 @@
#include <octave/oct.h>
#include <octave/ov-struct.h>
+#include "error-helpers.h"
+
DEFUN_DLD (cell2fields, args, ,
"-*- texinfo -*-\n\
@deftypefn {Loadable Function} {} cell2fields (@var{c}, @var{fields},
@var{dim}, @var{s})\n\
@@ -28,25 +30,22 @@
{
std::string fname ("cell2fields");
+ octave_value_list err_retval;
+
if (args.length () != 4)
{
print_usage ();
- return octave_value_list ();
+ return err_retval;
}
- Cell c = args(0).cell_value ();
- if (error_state)
- {
- error ("%s: first argument must be a cell array", fname.c_str ());
- return octave_value_list ();
- }
+ Cell c;
+ CHECK_ERROR (c = args(0).cell_value (), err_retval,
+ "%s: first argument must be a cell array", fname.c_str ());
- Array<std::string> names = args(1).cellstr_value ();
- if (error_state)
- {
- error ("%s: second argument must be a cell array of strings",
fname.c_str ());
- return octave_value_list ();
- }
+ Array<std::string> names;
+ CHECK_ERROR (names = args(1).cellstr_value (), err_retval,
+ "%s: second argument must be a cell array of strings",
+ fname.c_str ());
// do not reject if ndims == [0, 0]
dim_vector ndims = names.dims ();
@@ -54,23 +53,16 @@
{
error ("%s: second argument must be a one-dimensional cell array",
fname.c_str ());
- return octave_value_list ();
+ return err_retval;
}
- octave_idx_type dim = args(2).int_value ();
- if (error_state)
- {
- error ("%s: third argument must be an integer",
- fname.c_str ());
- return octave_value_list ();
- }
+ octave_idx_type dim;
+ CHECK_ERROR (dim = args(2).int_value (), err_retval,
+ "%s: third argument must be an integer", fname.c_str ());
- octave_map s = args(3).map_value ();
- if (error_state)
- {
- error ("%s: fourth argument must be a structure", fname.c_str ());
- return octave_value_list ();
- }
+ octave_map s;
+ CHECK_ERROR (s = args(3).map_value (), err_retval,
+ "%s: fourth argument must be a structure", fname.c_str ());
octave_idx_type i, j;
@@ -95,12 +87,12 @@
{
error ("%s: second argument has incorrect length", fname.c_str ());
- return octave_value_list ();
+ return err_retval;
}
octave_map retval;
- if (s.keys (). length () == 0)
+ if (s.keys (). numel () == 0)
retval.resize (tdims);
else
{
@@ -108,7 +100,7 @@
{
error ("%s: structure has incorrect dimensions", fname.c_str ());
- return octave_value_list ();
+ return err_retval;
}
retval = (s);
}
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/struct-1.0.11/src/config.h.in new/struct-1.0.13/src/config.h.in
--- old/struct-1.0.11/src/config.h.in 1970-01-01 01:00:00.000000000 +0100
+++ new/struct-1.0.13/src/config.h.in 2016-04-22 10:49:34.000000000 +0200
@@ -0,0 +1,6 @@
+/* Define as 1 if liboctinterp is old enough to provide error_state. */
+#undef HAVE_OCTAVE_ERROR_STATE
+
+/* Define as 1 if liboctinterp has
+'verror (octave_execution_exception&, const char *, va_list)'. */
+#undef HAVE_OCTAVE_VERROR_ARG_EXC
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/struct-1.0.11/src/configure.ac new/struct-1.0.13/src/configure.ac
--- old/struct-1.0.11/src/configure.ac 1970-01-01 01:00:00.000000000 +0100
+++ new/struct-1.0.13/src/configure.ac 2016-04-22 10:49:34.000000000 +0200
@@ -0,0 +1,84 @@
+# -*- Autoconf -*-
+# Process this file with autoconf to produce a configure script.
+#
+### Copyright (C) 2015, 2016 Olaf Till <[email protected]>
+###
+### This program is free software; you can redistribute it and/or
+### modify it under the terms of the GNU General Public License as
+### published by the Free Software Foundation; either version 3 of the
+### License, or (at your option) any later version.
+###
+### This program is distributed in the hope that it will be useful,
+### but WITHOUT ANY WARRANTY; without even the implied warranty of
+### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+### General Public License for more details.
+###
+### You should have received a copy of the GNU General Public License
+### along with this program; if not, see
+### <http://www.gnu.org/licenses/>.
+
+AC_PREREQ([2.62])
+AC_INIT([struct], [1.0.13], [[email protected]])
+AC_CONFIG_SRCDIR([cell2fields.cc])
+AC_CONFIG_HEADERS([config.h])
+
+# Checks for programs.
+AC_CHECK_PROG(MKOCTFILE, mkoctfile, mkoctfile)
+if test -z "$MKOCTFILE"; then
+AC_MSG_ERROR([mkoctfile not found], 1);
+fi
+AC_CHECK_PROG(OCTAVE_CONFIG, octave-config, octave-config)
+if test -z "$OCTAVE_CONFIG"; then
+AC_MSG_ERROR([octave-config not found], 1);
+fi
+
+# The same value of CXX as Octave was compiled with is supposed to be used.
+CXX=${CXX:-`${MKOCTFILE} -p CXX`}
+AC_PROG_CXX
+
+# Checks for libraries.
+
+# Checks for header files.
+
+# Checks for typedefs, structures, and compiler characteristics.
+AC_CHECK_HEADER_STDBOOL
+
+# Checks for library functions.
+AC_FUNC_ERROR_AT_LINE
+
+# Start of checks for Octave features, preparations for checks.
+OCTLIBDIR=${OCTLIBDIR:-`$OCTAVE_CONFIG -p OCTLIBDIR`}
+OCTINCLUDEDIR=${OCTINCLUDEDIR:-`$OCTAVE_CONFIG -p OCTINCLUDEDIR`}
+AC_LANG_PUSH([C++])
+TCXXFLAGS=$CXXFLAGS
+TLDFLAGS=$LDFLAGS
+TLIBS=$LIBS
+LDFLAGS="-L$OCTLIBDIR $LDFLAGS"
+LIBS="-loctinterp $LIBS"
+CXXFLAGS="-I$OCTINCLUDEDIR $CXXFLAGS"
+
+## Presence of 'error_state' -- does _not_ indicate no exceptions are
+## used.
+AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM([[#include <oct.h>]
+ [#include <stdio.h>]],
+ [[printf ("%i", error_state);]])],
+ [AC_DEFINE([HAVE_OCTAVE_ERROR_STATE], 1)])
+
+## Presence of 'verror (octave_execution_exception&, const char *,
+## va_list)'
+AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM([[#include <oct.h>]],
+ [[octave_execution_exception e;]
+ [va_list args;]
+ [verror (e, "test", args);]])],
+ [AC_DEFINE([HAVE_OCTAVE_VERROR_ARG_EXC], 1)])
+
+LIBS=$TLIBS
+LDFLAGS=$TLDFLAGS
+CXXFLAGS=$TCXXFLAGS
+AC_LANG_POP([C++])
+# End of checks for Octave features.
+
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
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/struct-1.0.11/src/error-helpers.cc new/struct-1.0.13/src/error-helpers.cc
--- old/struct-1.0.11/src/error-helpers.cc 1970-01-01 01:00:00.000000000
+0100
+++ new/struct-1.0.13/src/error-helpers.cc 2016-04-22 10:49:34.000000000
+0200
@@ -0,0 +1,53 @@
+/*
+
+Copyright (C) 2016 Olaf Till <[email protected]>
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+#include <octave/oct.h>
+
+#include "error-helpers.h"
+
+// call verror
+#ifdef HAVE_OCTAVE_VERROR_ARG_EXC
+void
+c_verror (octave_execution_exception& e, const char *fmt, ...)
+{
+ va_list args;
+ va_start (args, fmt);
+ verror (e, fmt, args);
+ va_end (args);
+}
+#else
+void
+c_verror (const octave_execution_exception&, const char *fmt, ...)
+{
+ va_list args;
+ va_start (args, fmt);
+ verror (fmt, args);
+ va_end (args);
+}
+#endif
+
+// call verror
+void
+c_verror (const char *fmt, ...)
+{
+ va_list args;
+ va_start (args, fmt);
+ verror (fmt, args);
+ va_end (args);
+}
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/struct-1.0.11/src/error-helpers.h new/struct-1.0.13/src/error-helpers.h
--- old/struct-1.0.11/src/error-helpers.h 1970-01-01 01:00:00.000000000
+0100
+++ new/struct-1.0.13/src/error-helpers.h 2016-04-22 10:49:34.000000000
+0200
@@ -0,0 +1,137 @@
+/*
+
+Copyright (C) 2016 Olaf Till <[email protected]>
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+#include "config.h"
+
+// call verror
+#ifdef HAVE_OCTAVE_VERROR_ARG_EXC
+void c_verror (octave_execution_exception&, const char *, ...);
+#else
+void c_verror (const octave_execution_exception&, const char *, ...);
+#endif
+
+// call verror
+void c_verror (const char *fmt, ...);
+
+// Print a message if 'code' causes an error and raise an error again,
+// both if Octave uses exceptions for errors and if it still uses
+// error_state. In the latter case return 'retval'.
+#ifdef HAVE_OCTAVE_ERROR_STATE
+ // can throw octave_execution_exception despite of this
+ #define CHECK_ERROR(code, retval, ...) \
+ try \
+ { \
+ code ; \
+ \
+ if (error_state) \
+ { \
+ error (__VA_ARGS__); \
+ \
+ return retval; \
+ } \
+ } \
+ catch (octave_execution_exception& e) \
+ { \
+ c_verror (e, __VA_ARGS__); \
+ \
+ throw e; \
+ }
+#else
+ #define CHECK_ERROR(code, retval, ...) \
+ try \
+ { \
+ code ; \
+ } \
+ catch (octave_execution_exception& e) \
+ { \
+ c_verror (e, __VA_ARGS__); \
+ \
+ throw e; \
+ }
+#endif
+
+// If 'code' causes an error, print a message and call exit(1) if
+// Octave doesn't throw exceptions for errors but still uses
+// error_state.
+#ifdef HAVE_OCTAVE_ERROR_STATE
+ // can throw octave_execution_exception despite of this
+ #define CHECK_ERROR_EXIT1(code, ...) \
+ try \
+ { \
+ code ; \
+ \
+ if (error_state) \
+ { \
+ c_verror (__VA_ARGS__); \
+ \
+ exit (1); \
+ } \
+ } \
+ catch (octave_execution_exception& e) \
+ { \
+ c_verror (e, __VA_ARGS__); \
+ \
+ exit (1); \
+ }
+#else
+ #define CHECK_ERROR_EXIT1(code, ...) \
+ try \
+ { \
+ code ; \
+ } \
+ catch (octave_execution_exception& e) \
+ { \
+ c_verror (e, __VA_ARGS__); \
+ \
+ exit (1); \
+ }
+#endif
+
+// Set 'err' to true if 'code' causes an error, else to false; both if
+// Octave uses exceptions for errors and if it still uses
+// error_state. In the latter case reset error_state to 0.
+#ifdef HAVE_OCTAVE_ERROR_STATE
+ // can throw octave_execution_exception despite of this
+ #define SET_ERR(code, err) \
+ err = false; \
+ \
+ try \
+ { \
+ code ; \
+ if (error_state) \
+ { \
+ error_state = 0; \
+ err = true; \
+ } \
+ } \
+ catch (octave_execution_exception&) \
+ { \
+ err = true; \
+ }
+#else
+ #define SET_ERR(code, err) \
+ try \
+ { \
+ code ; \
+ } \
+ catch (octave_execution_exception&) \
+ { \
+ err = true; \
+ }
+#endif
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/struct-1.0.11/src/fieldempty.cc new/struct-1.0.13/src/fieldempty.cc
--- old/struct-1.0.11/src/fieldempty.cc 2015-03-06 15:52:09.000000000 +0100
+++ new/struct-1.0.13/src/fieldempty.cc 2016-04-22 10:49:34.000000000 +0200
@@ -1,6 +1,6 @@
/*
-Copyright (C) 2010 Olaf Till
+Copyright (C) 2010-2016 Olaf Till
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -20,6 +20,8 @@
#include <octave/oct.h>
#include <octave/ov-struct.h>
+#include "error-helpers.h"
+
DEFUN_DLD (fieldempty, args, ,
"-*- texinfo -*-\n\
@deftypefn {Loadable Function} {} fieldempty (@var{s}, @var{name})\n\
@@ -28,30 +30,26 @@
{
std::string fname ("fieldempty");
+ octave_value_list err_retval;
+
if (args.length () != 2)
{
print_usage ();
- return octave_value_list ();
+ return err_retval;
}
- octave_map s = args(0).map_value ();
- if (error_state)
- {
- error ("%s: first argument must be a structure", fname.c_str ());
- return octave_value_list ();
- }
-
- std::string name = args(1).string_value ();
- if (error_state)
- {
- error ("%s: second argument must be a string", fname.c_str ());
- return octave_value_list ();
- }
+ octave_map s;
+ CHECK_ERROR (s = args(0).map_value (), err_retval,
+ "%s: first argument must be a structure", fname.c_str ());
+
+ std::string name;
+ CHECK_ERROR (name = args(1).string_value (), err_retval,
+ "%s: second argument must be a string", fname.c_str ());
if (! s.contains (name))
{
error ("%s: no such field", fname.c_str ());
- return octave_value_list ();
+ return err_retval;
}
dim_vector sdims = s.dims ();
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/struct-1.0.11/src/fields2cell.cc new/struct-1.0.13/src/fields2cell.cc
--- old/struct-1.0.11/src/fields2cell.cc 2015-03-06 15:52:09.000000000
+0100
+++ new/struct-1.0.13/src/fields2cell.cc 2016-04-22 10:49:34.000000000
+0200
@@ -1,6 +1,6 @@
/*
-Copyright (C) 2010 Olaf Till
+Copyright (C) 2010-2016 Olaf Till
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -20,6 +20,8 @@
#include <octave/oct.h>
#include <octave/ov-struct.h>
+#include "error-helpers.h"
+
DEFUN_DLD (fields2cell, args, ,
"-*- texinfo -*-\n\
@deftypefn {Loadable Function} {} fields2cell (@var{s}, @var{names})\n\
@@ -28,36 +30,32 @@
{
std::string fname ("fields2cell");
+ octave_value_list err_retval;
+
if (args.length () != 2)
{
print_usage ();
- return octave_value_list ();
- }
-
- octave_map s = args(0).map_value ();
- if (error_state)
- {
- error ("%s: first argument must be a structure", fname.c_str ());
- return octave_value_list ();
+ return err_retval;
}
- Array<std::string> names = args(1).cellstr_value ();
- if (error_state)
- {
- error ("%s: second argument must be a cell array of strings",
- fname.c_str ());
- return octave_value_list ();
- }
+ octave_map s;
+ CHECK_ERROR (s = args(0).map_value (), err_retval,
+ "%s: first argument must be a structure", fname.c_str ());
+
+ Array<std::string> names;
+ CHECK_ERROR (names = args(1).cellstr_value (), err_retval,
+ "%s: second argument must be a cell array of strings",
+ fname.c_str ());
dim_vector ndims = names.dims ();
if (ndims.length () > 2 || (ndims(0) > 1 && ndims(1) > 1))
{
error ("%s: second argument must be a one-dimensional cell array",
fname.c_str ());
- return octave_value_list ();
+ return err_retval;
}
- octave_idx_type n = names.length ();
+ octave_idx_type n = names.numel ();
dim_vector sdims = s.dims ();
@@ -82,7 +80,7 @@
if (! s.contains (names(i)))
{
error ("%s: some fields not present", fname.c_str ());
- return octave_value_list ();
+ return err_retval;
}
Cell tp = s.contents (names(i));
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/struct-1.0.11/src/structcat.cc new/struct-1.0.13/src/structcat.cc
--- old/struct-1.0.11/src/structcat.cc 2015-03-06 15:52:09.000000000 +0100
+++ new/struct-1.0.13/src/structcat.cc 2016-04-22 10:49:34.000000000 +0200
@@ -1,6 +1,6 @@
/*
-Copyright (C) 2010, 2011, 2012 Olaf Till
+Copyright (C) 2010-2016 Olaf Till
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -25,6 +25,8 @@
#include <octave/oct.h>
#include <octave/ov-struct.h>
+#include "error-helpers.h"
+
static octave_map
structcat_op_fcn (const octave_map& m1, const octave_map& m2,
const dim_vector& dv,
@@ -73,79 +75,87 @@
@deftypefn {Loadable Function} {} structcat (@var{dim}, @var{struct1},
@dots{}, @var{structn})\n\
@deftypefnx {Loadable Function} {} structcat (@var{dim}, @var{default},
@var{struct1}, @dots{}, @var{structn})\n\
Return the concatenation of N-d structures @var{struct1}, @dots{},
@var{structn} along dimension @var{dim}. Differently to @code{cat}, fields need
not match --- missing fields get an empty matrix value. Without structure
arguments, an empty structure array is returned. If a scalar argument
@var{default} is given, missing fields get its value instead of an empty matrix
value.\n\
-\n\
-@seealso{structcat_default}\n\
@end deftypefn")
{
std::string fname ("structcat");
octave_map retval;
+ octave_value_list err_retval;
+
octave_idx_type n_args = args.length ();
if (n_args == 0)
- print_usage ();
- else
{
- octave_idx_type dim = args(0).int_value () - 1;
+ print_usage ();
- if (error_state || dim < 0)
- {
- error ("%s: first argument must be a positive integer",
- fname.c_str ());
- return octave_value ();
- }
+ return err_retval;
+ }
+
+ octave_idx_type dim;
- octave_idx_type m1_id;
- octave_value fillv;
+ CHECK_ERROR (dim = args(0).int_value () - 1, err_retval,
+ "%s: first argument must be an integer",
+ fname.c_str ());
- if (n_args > 1 && args(1).is_scalar_type ())
- {
- m1_id = 2;
+ if (dim < 0)
+ {
+ error ("%s: first argument must be a positive integer",
+ fname.c_str ());
- fillv = args(1);
- }
- else
- {
- m1_id = 1;
+ return err_retval;
+ }
- fillv = Matrix ();
- }
+ octave_idx_type m1_id;
+ octave_value fillv;
- dim_vector dv;
+ if (n_args > 1 && args(1).is_scalar_type ())
+ {
+ m1_id = 2;
- octave_idx_type idx_len = dv.length ();
+ fillv = args(1);
+ }
+ else
+ {
+ m1_id = 1;
+
+ fillv = Matrix ();
+ }
+
+ dim_vector dv;
+
+ octave_idx_type idx_len = dv.length ();
- if (dim >= idx_len) idx_len = dim + 1;
+ if (dim >= idx_len) idx_len = dim + 1;
- Array<octave_idx_type> ra_idx (dim_vector (idx_len, 1), 0);
+ Array<octave_idx_type> ra_idx (dim_vector (idx_len, 1), 0);
- for (octave_idx_type i = m1_id; i < n_args; i++)
+ for (octave_idx_type i = m1_id; i < n_args; i++)
+ {
+ if (! args(i).is_map ())
{
- if (! args(i).is_map ())
- {
- error ("%s: some argument not a structure", fname.c_str ());
+ error ("%s: some argument not a structure", fname.c_str ());
- return octave_value ();
- }
+ return err_retval;
+ }
- dim_vector dvi = args(i).dims (), old_dv = dv;
+ dim_vector dvi = args(i).dims (), old_dv = dv;
- if (! dv.concat (dvi, dim))
- {
- error ("%s: dimension mismatch", fname.c_str ());
+ if (! dv.concat (dvi, dim))
+ {
+ error ("%s: dimension mismatch", fname.c_str ());
- return octave_value ();
- }
+ return err_retval;
+ }
- if (! dvi.all_zero ())
- {
- retval = structcat_op_fcn (retval, args(i).map_value (),
- dv, ra_idx, fillv);
+ if (! dvi.all_zero ())
+ {
+ retval = structcat_op_fcn (retval, args(i).map_value (),
+ dv, ra_idx, fillv);
- ra_idx(dim) += (dim < dvi.length () ? dvi(dim) : 1);
- }
+ ra_idx(dim) += (dim < dvi.length () ? dvi(dim) : 1);
}
}
+
return octave_value (retval);
}