# HG changeset patch # User John W. Eaton # Date 1629445640 14400 # Node ID 77bfbb7d809430606ca49173df86c6bf5b12cda0 # Parent cd3b48c30641190d8a62c8fcc7d01627e25426ab patches for recent Octave namespace changes * of-control-1-deprecated-warnings.patch, of-image-1-namespace.patch, of-signal-1-deprecated-warnings.patch: New files. * dist-files.mk: Upate. diff -r cd3b48c30641 -r 77bfbb7d8094 dist-files.mk --- a/dist-files.mk Tue Aug 17 19:34:07 2021 -0400 +++ b/dist-files.mk Fri Aug 20 03:47:20 2021 -0400 @@ -477,6 +477,7 @@ of-audio.mk \ of-communications-1-catop.patch \ of-communications.mk \ + of-control-1-deprecated-warnings.patch \ of-control.mk \ of-data-smoothing.mk \ of-database.mk \ @@ -496,6 +497,7 @@ of-geometry.mk \ of-gsl-1-cross-fixes.patch \ of-gsl.mk \ + of-image-1-namespace.patch \ of-image-1-no-jit.patch \ of-image.mk \ of-instrument-control.mk \ @@ -531,6 +533,7 @@ of-quaternion-2-dev-fixes.patch \ of-quaternion.mk \ of-queueing.mk \ + of-signal-1-deprecated-warnings.patch \ of-signal.mk \ of-sockets.mk \ of-sparsersb.mk \ @@ -1123,5 +1126,3 @@ $(TOOLS_FILES) \ $(FILES) \ $(INSTALL_FILES) - - diff -r cd3b48c30641 -r 77bfbb7d8094 src/of-control-1-deprecated-warnings.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/of-control-1-deprecated-warnings.patch Fri Aug 20 03:47:20 2021 -0400 @@ -0,0 +1,12 @@ +diff -uNr a/src/Makefile b/src/Makefile +--- a/src/Makefile 2021-07-05 01:05:54.000000000 -0400 ++++ b/src/Makefile 2021-08-20 00:58:10.329056319 -0400 +@@ -15,7 +15,7 @@ + + AR := $(shell $(MKOCTFILE) -p AR) + +-PKG_CXXFLAGS := -Wall -Wno-deprecated-declarations $(PKG_CXXFLAGS_APPEND) ++PKG_CXXFLAGS := -Wall $(PKG_CXXFLAGS_APPEND) + + all: __control_slicot_functions__.oct \ + __control_helper_functions__.oct diff -r cd3b48c30641 -r 77bfbb7d8094 src/of-image-1-namespace.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/of-image-1-namespace.patch Fri Aug 20 03:47:20 2021 -0400 @@ -0,0 +1,535 @@ +diff -uNr a/src/bwconncomp.cc b/src/bwconncomp.cc +--- a/src/bwconncomp.cc 2020-02-02 08:20:08.000000000 -0500 ++++ b/src/bwconncomp.cc 2021-08-20 03:40:55.040903123 -0400 +@@ -30,7 +30,7 @@ + #include + + #include "connectivity.h" +-using namespace octave::image; ++using namespace octave_image; + + static std::vector> + connected_components (const boolNDArray& BW, const connectivity& conn) +diff -uNr a/src/bwlabeln.cc b/src/bwlabeln.cc +--- a/src/bwlabeln.cc 2020-02-02 08:20:08.000000000 -0500 ++++ b/src/bwlabeln.cc 2021-08-20 03:41:02.785032122 -0400 +@@ -32,7 +32,7 @@ + #define WANTS_OCTAVE_IMAGE_VALUE 1 + #include "octave-wrappers.h" + +-using namespace octave::image; ++using namespace octave_image; + + static union_find + pre_label (NDArray& L, const connectivity& conn) +diff -uNr a/src/conndef.cc b/src/conndef.cc +--- a/src/conndef.cc 2020-02-02 08:20:08.000000000 -0500 ++++ b/src/conndef.cc 2021-08-20 03:41:12.149188253 -0400 +@@ -19,7 +19,7 @@ + #include "config.h" + + #include "connectivity.h" +-using namespace octave::image; ++using namespace octave_image; + + // The conndef() function is really really simple and could have easily + // been a m file (actually it once was, check the hg log if it ever needs +diff -uNr a/src/connectivity.cc b/src/connectivity.cc +--- a/src/connectivity.cc 2020-02-02 08:20:08.000000000 -0500 ++++ b/src/connectivity.cc 2021-08-20 03:41:18.001285906 -0400 +@@ -25,7 +25,7 @@ + #define WANTS_OCTAVE_IMAGE_VALUE 1 + #include "octave-wrappers.h" + +-using namespace octave::image; ++using namespace octave_image; + + + connectivity::connectivity (const boolNDArray& mask_arg) +@@ -296,7 +296,7 @@ + + + connectivity +-octave::image::conndef (const octave_value& _val) ++octave_image::conndef (const octave_value& _val) + { + octave_image::value val (_val); + +diff -uNr a/src/connectivity.h b/src/connectivity.h +--- a/src/connectivity.h 2020-02-02 08:20:08.000000000 -0500 ++++ b/src/connectivity.h 2021-08-20 03:41:28.897467898 -0400 +@@ -29,10 +29,8 @@ + + #include + +-namespace octave ++namespace octave_image + { +- namespace image +- { + class connectivity + { + public: +@@ -89,14 +87,13 @@ + }; + + connectivity conndef (const octave_value& val); +- } + } + + // Templated methods + + template + T +-octave::image::connectivity::create_padded (const T& image, const P& val) const ++octave_image::connectivity::create_padded (const T& image, const P& val) const + { + const octave_idx_type pad_ndims = std::min (mask.ndims (), image.ndims ()); + +@@ -117,7 +114,7 @@ + + template + void +-octave::image::connectivity::unpad (T& image) const ++octave_image::connectivity::unpad (T& image) const + { + const octave_idx_type pad_ndims = std::min (mask.ndims (), image.ndims ()); + const dim_vector padded_size = image.dims (); +@@ -134,7 +131,7 @@ + + template + P +-octave::image::connectivity::min_value (void) ++octave_image::connectivity::min_value (void) + { + if (typeid (P) == typeid (bool)) + return false; +@@ -144,7 +141,7 @@ + + template + void +-octave::image::connectivity::set_padding (const dim_vector& size, ++octave_image::connectivity::set_padding (const dim_vector& size, + const dim_vector& padded_size, + T& im, const P& val) + { +diff -uNr a/src/connectivity.h.orig b/src/connectivity.h.orig +--- a/src/connectivity.h.orig 1969-12-31 19:00:00.000000000 -0500 ++++ b/src/connectivity.h.orig 2021-08-20 03:41:55.317910045 -0400 +@@ -0,0 +1,174 @@ ++// Copyright (C) 2014 Carnë Draug ++// ++// 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 ++// . ++ ++#ifndef OCTAVE_IMAGE_CONNDEF ++#define OCTAVE_IMAGE_CONNDEF ++ ++#include ++#include ++#include ++ ++#include ++#include ++#include ++#include ++#include // octave_Inf ++ ++#include ++ ++namespace octave_image ++{ ++ class connectivity ++ { ++ public: ++ connectivity () = default; ++ ++ //! Will throw if val is bad ++ explicit connectivity (const boolNDArray& mask_arg); ++ explicit connectivity (const unsigned int conn); ++ connectivity (const octave_idx_type& ndims, const std::string& type); ++ ++ boolNDArray mask; ++ ++ // For a matrix of size `size', what are the offsets for all of its ++ // connected elements (will have negative and positive values). ++ Array neighbourhood (const dim_vector& size) const; ++ Array deleted_neighbourhood (const dim_vector& size) const; ++ Array positive_neighbourhood (const dim_vector& size) const; ++ Array negative_neighbourhood (const dim_vector& size) const; ++ ++ template ++ T create_padded (const T& image, const P& val) const; ++ ++ template ++ void unpad (T& image) const; ++ ++ //! Return a logical mask of elements that are part of the padding. ++ static boolNDArray padding_mask (const dim_vector& size, ++ const dim_vector& padded_size); ++ ++ //! Set the padding elements to a specific value. ++ template ++ static void set_padding (const dim_vector& size, ++ const dim_vector& padded_size, ++ T& im, const P& val); ++ ++ template ++ static P min_value (void); ++ ++ static Array padding_lengths (const dim_vector& size, ++ const dim_vector& padded_size); ++ ++ private: ++ //! Like Array::ndims() but will return 1 dimension for ColumnVector ++ static octave_idx_type ndims (const dim_vector& d); ++ template ++ static octave_idx_type ndims (const Array& a); ++ }; ++ ++ class invalid_connectivity : public std::invalid_argument ++ { ++ public: ++ invalid_connectivity (const std::string& what_arg) ++ : std::invalid_argument (what_arg) { } ++ }; ++ ++ connectivity conndef (const octave_value& val); ++} ++ ++// Templated methods ++ ++template ++T ++octave_image::connectivity::create_padded (const T& image, const P& val) const ++{ ++ const octave_idx_type pad_ndims = std::min (mask.ndims (), image.ndims ()); ++ ++ Array idx (dim_vector (image.ndims (), 1), 0); ++ dim_vector padded_size = image.dims (); ++ for (octave_idx_type i = 0; i < pad_ndims; i++) ++ { ++ padded_size(i) += 2; ++ idx(i) = 1; ++ } ++ ++ T padded (padded_size, val); ++ ++ // padded(2:end-1, 2:end-1, ..., 2:end-1) = BW ++ padded.insert (image, idx); ++ return padded; ++} ++ ++template ++void ++octave_image::connectivity::unpad (T& image) const ++{ ++ const octave_idx_type pad_ndims = std::min (mask.ndims (), image.ndims ()); ++ const dim_vector padded_size = image.dims (); ++ ++ Array inner_slice (dim_vector (image.ndims (), 1)); ++ for (octave_idx_type i = 0; i < pad_ndims ; i++) ++ inner_slice(i) = idx_vector (1, padded_size(i) - 1); ++ for (octave_idx_type i = pad_ndims; i < image.ndims (); i++) ++ inner_slice(i) = idx_vector (0, padded_size(i)); ++ ++ image = image.index (inner_slice); ++ return; ++} ++ ++template ++P ++octave_image::connectivity::min_value (void) ++{ ++ if (typeid (P) == typeid (bool)) ++ return false; ++ else ++ return P(-octave_Inf); ++} ++ ++template ++void ++octave_image::connectivity::set_padding (const dim_vector& size, ++ const dim_vector& padded_size, ++ T& im, const P& val) ++{ ++ P* im_v = im.fortran_vec (); ++ ++ const Array lengths = padding_lengths (size, padded_size); ++ const octave_idx_type* lengths_v = lengths.fortran_vec (); ++ ++ const octave_idx_type* strides_v = size.to_jit (); ++ const octave_idx_type row_stride = strides_v[0]; ++ ++ std::function fill; ++ fill = [&] (const octave_idx_type dim) -> void ++ { ++ for (octave_idx_type i = 0; i < lengths_v[dim]; i++, im_v++) ++ *im_v = val; ++ ++ if (dim == 0) ++ im_v += row_stride; ++ else ++ for (octave_idx_type i = 0; i < strides_v[dim]; i++) ++ fill (dim -1); ++ ++ for (octave_idx_type i = 0; i < lengths_v[dim]; i++, im_v++) ++ *im_v = val; ++ }; ++ fill (im.ndims () -1); ++} ++ ++#endif +diff -uNr a/src/imerode.cc b/src/imerode.cc +--- a/src/imerode.cc 2020-02-02 08:20:08.000000000 -0500 ++++ b/src/imerode.cc 2021-08-20 03:42:06.186092277 -0400 +@@ -32,7 +32,7 @@ + #define WANTS_OCTAVE_IMAGE_VALUE 1 + #include "octave-wrappers.h" + +-using namespace octave::image; ++using namespace octave_image; + + // How this works: + // +diff -uNr a/src/imreconstruct.cc b/src/imreconstruct.cc +--- a/src/imreconstruct.cc 2020-02-02 08:20:08.000000000 -0500 ++++ b/src/imreconstruct.cc 2021-08-20 03:42:11.690184639 -0400 +@@ -36,7 +36,7 @@ + + #include "connectivity.h" + +-using namespace octave::image; ++using namespace octave_image; + + #define WANTS_OCTAVE_IMAGE_VALUE 1 + #include "octave-wrappers.h" +diff -uNr a/src/strel.cc b/src/strel.cc +--- a/src/strel.cc 2020-02-02 08:20:08.000000000 -0500 ++++ b/src/strel.cc 2021-08-20 03:39:35.059577831 -0400 +@@ -35,7 +35,7 @@ + + // Expects a @strel object, or a boolean matrix (or something + // that can be converted into one with bool_matrix_value() +-octave::image::strel::strel (const octave_value& arg) ++octave_image::strel::strel (const octave_value& arg) + { + octave_value se = arg; + // We are only creating a strel object here so that we can use +@@ -105,7 +105,7 @@ + return; + } + +-octave::image::strel::strel (const boolNDArray& nhood, const NDArray& height) ++octave_image::strel::strel (const boolNDArray& nhood, const NDArray& height) + : nhood (nhood), height (height) + { + ini_ctor (); +@@ -114,7 +114,7 @@ + return; + } + +-octave::image::strel::strel (const boolNDArray& nhood, const NDArray& height, ++octave_image::strel::strel (const boolNDArray& nhood, const NDArray& height, + const Array& origin) + : nhood (nhood), height (height), origin (origin) + { +@@ -125,25 +125,25 @@ + } + + boolNDArray +-octave::image::strel::get_nhood (void) const ++octave_image::strel::get_nhood (void) const + { + return nhood; + } + + octave_idx_type +-octave::image::strel::get_nnz (void) const ++octave_image::strel::get_nnz (void) const + { + return nnz; + } + + Array +-octave::image::strel::get_origin (void) const ++octave_image::strel::get_origin (void) const + { + return origin; + } + +-octave::image::strel +-octave::image::strel::operator () (const octave_idx_type& i) const ++octave_image::strel ++octave_image::strel::operator () (const octave_idx_type& i) const + { + assert (i >= 0 && i < octave_idx_type (decomposition.size ())); + return decomposition[i]; +@@ -151,7 +151,7 @@ + + // Number of strel elements after decomposition + octave_idx_type +-octave::image::strel::numel (void) const ++octave_image::strel::numel (void) const + { + return octave_idx_type (decomposition.size ()); + } +@@ -163,8 +163,8 @@ + // center of the matrix, there will be no change. + // The reason for this is so that we can keep the origin in matrices with + // sides with an even length. +-octave::image::strel +-octave::image::strel::reflect (void) const ++octave_image::strel ++octave_image::strel::reflect (void) const + { + boolNDArray ref_nhood (size); + NDArray ref_height (size); +@@ -178,11 +178,11 @@ + for (octave_idx_type dim = 0; dim < ndims; dim++) + ref_origin(dim) = size(dim) - origin(dim) -1; + +- return octave::image::strel (ref_nhood, ref_height, ref_origin); ++ return octave_image::strel (ref_nhood, ref_height, ref_origin); + } + + void +-octave::image::strel::set_origin (const Array& sub) ++octave_image::strel::set_origin (const Array& sub) + { + origin = sub; + validate_origin (); +@@ -190,7 +190,7 @@ + } + + bool +-octave::image::strel::flat (void) const ++octave_image::strel::flat (void) const + { + bool flat = true; + if (! height.all_elements_are_zero ()) +@@ -220,7 +220,7 @@ + // linear shift is [0 1 11 21 22] + // The second element is the matching height for each. + Array +-octave::image::strel::offsets (const dim_vector& cum_size) const ++octave_image::strel::offsets (const dim_vector& cum_size) const + { + Array sub (dim_vector (ndims, 1), 0); + Array offsets (dim_vector (nnz, 1)); +@@ -244,7 +244,7 @@ + // at coordinates (0,0) of the input matrix and we need enough padding for + // it. If the shape is "full", then we add the double. + Array +-octave::image::strel::pre_pad (const octave_idx_type& mt_ndims, ++octave_image::strel::pre_pad (const octave_idx_type& mt_ndims, + const std::string& shape) const + { + Array pad (dim_vector (mt_ndims, 1), 0); +@@ -274,7 +274,7 @@ + } + + Array +-octave::image::strel::post_pad (const octave_idx_type& mt_ndims, ++octave_image::strel::post_pad (const octave_idx_type& mt_ndims, + const std::string& shape) const + { + Array pad (dim_vector (mt_ndims, 1), 0); +@@ -304,7 +304,7 @@ + } + + void +-octave::image::strel::ini_ctor () ++octave_image::strel::ini_ctor () + { + size = nhood.dims (); + ndims = nhood.ndims (); +@@ -313,7 +313,7 @@ + } + + Array +-octave::image::strel::default_origin () ++octave_image::strel::default_origin () + { + Array origin (dim_vector (ndims, 1)); + for (octave_idx_type dim = 0; dim < ndims; dim++) +@@ -323,14 +323,14 @@ + } + + void +-octave::image::strel::end_ctor (void) ++octave_image::strel::end_ctor (void) + { + if (decomposition.empty ()) + decomposition.push_back (*this); + } + + void +-octave::image::strel::validate_origin (void) ++octave_image::strel::validate_origin (void) + { + assert (ndims == origin.numel ()); + for (octave_idx_type dim = 0; dim < ndims; dim++) +diff -uNr a/src/strel.h b/src/strel.h +--- a/src/strel.h 2020-02-02 08:20:08.000000000 -0500 ++++ b/src/strel.h 2021-08-20 03:40:39.204639691 -0400 +@@ -45,10 +45,8 @@ + + #include + +-namespace octave ++namespace octave_image + { +- namespace image +- { + class strel + { + public: +@@ -109,14 +107,13 @@ + void validate_origin (void); + + }; +- } + } + + // Define it on header or we we need to instantiate it for all + // possible classes in strel.cc + template + Array

+-octave::image::strel::true_heights (void) const ++octave_image::strel::true_heights (void) const + { + Array

true_heights (dim_vector (nnz, 1)); + for (octave_idx_type ind = 0, found = 0; found < nnz; ind++) +diff -uNr a/src/watershed.cc b/src/watershed.cc +--- a/src/watershed.cc 2020-02-02 08:20:08.000000000 -0500 ++++ b/src/watershed.cc 2021-08-20 03:40:18.700299337 -0400 +@@ -26,7 +26,7 @@ + #include "octave-wrappers.h" + + #include "connectivity.h" +-using namespace octave::image; ++using namespace octave_image; + + template + static boolNDArray +@@ -297,7 +297,7 @@ + + connectivity conn; + if (nargin > 1) +- conn = octave::image::conndef (args(1)); ++ conn = octave_image::conndef (args(1)); + else + { + try diff -r cd3b48c30641 -r 77bfbb7d8094 src/of-signal-1-deprecated-warnings.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/of-signal-1-deprecated-warnings.patch Fri Aug 20 03:47:20 2021 -0400 @@ -0,0 +1,12 @@ +diff -uNr a/src/Makefile b/src/Makefile +--- a/src/Makefile 2019-02-08 17:00:37.000000000 -0500 ++++ b/src/Makefile 2021-08-20 01:01:13.437770211 -0400 +@@ -19,7 +19,7 @@ + MKOCTFILE ?= mkoctfile + SED ?= sed + +-PKG_CXXFLAGS := -Wall -Wno-deprecated-declarations $(PKG_CXXFLAGS_APPEND) ++PKG_CXXFLAGS := -Wall $(PKG_CXXFLAGS_APPEND) + + OCT_FILES = \ + __fwht__.oct \