Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package octave-forge-strings for 
openSUSE:Factory checked in at 2022-07-12 11:12:44
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/octave-forge-strings (Old)
 and      /work/SRC/openSUSE:Factory/.octave-forge-strings.new.1523 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "octave-forge-strings"

Tue Jul 12 11:12:44 2022 rev:3 rq:988498 version:1.3.0

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/octave-forge-strings/octave-forge-strings.changes    
    2019-03-26 15:41:15.792280638 +0100
+++ 
/work/SRC/openSUSE:Factory/.octave-forge-strings.new.1523/octave-forge-strings.changes
      2022-07-12 11:12:57.551739259 +0200
@@ -1,0 +2,7 @@
+Fri Jul  8 17:50:11 UTC 2022 - Atri Bhattacharya <badshah...@gmail.com>
+
+- Update to version 1.3.0:
+  * Update package to compile in GNU Octave 5+
+  * Add detection and use of pcre2 if available
+
+-------------------------------------------------------------------

Old:
----
  strings-1.2.0.tar.gz

New:
----
  strings-1.3.0.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ octave-forge-strings.spec ++++++
--- /var/tmp/diff_new_pack.9YUcH5/_old  2022-07-12 11:12:57.987739830 +0200
+++ /var/tmp/diff_new_pack.9YUcH5/_new  2022-07-12 11:12:57.991739835 +0200
@@ -18,7 +18,7 @@
 
 %define octpkg  strings
 Name:           octave-forge-%{octpkg}
-Version:        1.2.0
+Version:        1.3.0
 Release:        0
 Summary:        Additional manipulation functions for Octave
 License:        GPL-3.0-or-later AND BSD-2-Clause

++++++ strings-1.2.0.tar.gz -> strings-1.3.0.tar.gz ++++++
++++ 5581 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/strings-1.2.0/DESCRIPTION new/strings-1.3.0/DESCRIPTION
--- old/strings-1.2.0/DESCRIPTION       2015-06-06 23:40:45.000000000 +0200
+++ new/strings-1.3.0/DESCRIPTION       2022-06-28 14:21:04.000000000 +0200
@@ -1,8 +1,8 @@
 Name: strings
-Version: 1.2.0
-Date: 2015-06-06
+Version: 1.3.0
+Date: 2022-06-28
 Author: various authors
-Maintainer: Oliver Heimlich <oh...@posteo.de>
+Maintainer: John Donoghue <john.donog...@ieee.org>
 Title: String Handling.
 Description: Additional functions for manipulation and analysis of strings.
 Depends: octave (>= 3.8.0)
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/strings-1.2.0/Makefile new/strings-1.3.0/Makefile
--- old/strings-1.2.0/Makefile  1970-01-01 01:00:00.000000000 +0100
+++ new/strings-1.3.0/Makefile  2022-06-28 14:21:04.000000000 +0200
@@ -0,0 +1,141 @@
+## Copyright 2015-2016 Carn?? Draug
+## Copyright 2015-2016 Oliver Heimlich
+## Copyright 2018-2019 John Donoghue
+##
+## Copying and distribution of this file, with or without modification,
+## are permitted in any medium without royalty provided the copyright
+## notice and this notice are preserved.  This file is offered as-is,
+## without any warranty.
+TOPDIR := $(shell pwd)
+
+## Some shell programs
+MD5SUM    ?= md5sum
+SED       ?= sed
+GREP      ?= grep
+TAR       ?= tar
+GZIP      ?= gzip
+CUT       ?= cut
+TR        ?= tr
+TEXI2PDF  ?= texi2pdf -q
+
+PACKAGE := $(shell $(GREP) "^Name: " DESCRIPTION | $(CUT) -f2 -d" " | \
+$(TR) '[:upper:]' '[:lower:]')
+VERSION := $(shell $(GREP) "^Version: " DESCRIPTION | $(CUT) -f2 -d" ")
+
+HG           := hg
+HG_CMD        = $(HG) --config alias.$(1)=$(1) --config defaults.$(1)= $(1)
+HG_ID        := $(shell $(call HG_CMD,identify) --id | sed -e 's/+//' )
+HG_TIMESTAMP := $(firstword $(shell $(call HG_CMD,log) --rev $(HG_ID) 
--template '{date|hgdate}'))
+
+TAR_REPRODUCIBLE_OPTIONS := --sort=name --mtime="@$(HG_TIMESTAMP)" --owner=0 
--group=0 --numeric-owner
+TAR_OPTIONS  := --format=ustar $(TAR_REPRODUCIBLE_OPTIONS)
+
+TARGET_DIR      := target
+RELEASE_DIR     := $(TARGET_DIR)/$(PACKAGE)-$(VERSION)
+RELEASE_TARBALL := $(TARGET_DIR)/$(PACKAGE)-$(VERSION).tar.gz
+HTML_DIR        := $(TARGET_DIR)/$(PACKAGE)-html
+HTML_TARBALL    := $(TARGET_DIR)/$(PACKAGE)-html.tar.gz
+
+PKG_ADD     := 
+
+OCTAVE ?= octave --no-window-system --silent
+MKOCTFILE ?= mkoctfile
+
+.PHONY: help dist html release install all check run clean test_files
+
+help:
+       @echo "Targets:"
+       @echo "   dist    - Create $(RELEASE_TARBALL) for release"
+       @echo "   html    - Create $(HTML_TARBALL) for release"
+       @echo "   release - Create both of the above and show md5sums"
+       @echo
+       @echo "   install - Install the package in GNU Octave"
+       @echo "   all     - Build all oct files"
+       @echo "   check   - Execute package tests (w/o install)"
+       @echo "   run     - Run Octave with development in PATH (no install)"
+       @echo
+       @echo "   clean   - Remove releases, html documentation, and oct files"
+
+%.tar.gz: %
+       $(TAR) -cf - $(TAR_OPTIONS) -C "$(TARGET_DIR)/" "$(notdir $<)" | gzip 
-9n > $@
+       -rm -rf $<
+
+.PHONY: docs
+docs: doc/$(PACKAGE).pdf
+
+.PHONY: clean-docs
+clean-docs:
+       $(RM) -f doc/$(PACKAGE).info
+       $(RM) -f doc/$(PACKAGE).pdf
+       $(RM) -f doc/functions.texi
+
+doc/$(PACKAGE).pdf: doc/$(PACKAGE).texi doc/functions.texi
+       cd doc && SOURCE_DATE_EPOCH=$(HG_TIMESTAMP) $(TEXI2PDF) $(PACKAGE).texi
+       # remove temp files
+       cd doc && $(RM) -f $(PACKAGE).aux $(PACKAGE).cp $(PACKAGE).cps 
$(PACKAGE).fn  $(PACKAGE).fns $(PACKAGE).log $(PACKAGE).toc
+
+doc/functions.texi:
+       cd doc && ./mkfuncdocs.py --src-dir=../inst/ --src-dir=../src/ ../INDEX 
| $(SED) 's/@seealso/@xseealso/g' > functions.texi
+
+
+$(RELEASE_DIR): .hg/dirstate
+       @echo "Creating package version $(VERSION) release ..."
+       $(RM) -r "$@"
+       $(call HG_CMD,archive) --exclude ".hg*" --type files --rev $(HG_ID) "$@"
+       cd "$@/src" && ./bootstrap && $(RM) -r "autom4te.cache"
+       # build docs
+#      $(MAKE) -C "$@" docs
+       chmod -R a+rX,u+w,go-w "$@"
+
+html_options = --eval 'options = get_html_options ("octave-forge");'
+#html_options = --eval 'options = get_html_options ("octave-forge");' \
+#               --eval 'options.package_doc = "$(PACKAGE).texi";'
+$(HTML_DIR): install
+       @echo "Generating HTML documentation. This may take a while ..."
+       $(RM) -r "$@"
+       $(OCTAVE) --no-window-system --silent \
+         --eval "pkg load generate_html; "   \
+         --eval "pkg load $(PACKAGE);"       \
+         $(html_options)                     \
+         --eval 'generate_package_html ("${PACKAGE}", "$@", options);'
+       chmod -R a+rX,u+w,go-w $@
+       -rm -rf $<
+
+dist: $(RELEASE_TARBALL)
+html: $(HTML_TARBALL)
+
+release: dist html
+       md5sum $(RELEASE_TARBALL) $(HTML_TARBALL)
+       @echo "Upload @ https://sourceforge.net/p/octave/package-releases/new/";
+       @echo 'Execute: hg tag "release-${VERSION}"'
+
+install: $(RELEASE_TARBALL)
+       @echo "Installing package locally ..."
+       $(OCTAVE) --eval 'pkg ("install", "-verbose", "${RELEASE_TARBALL}")'
+
+all: $(CC_SOURCES)
+       cd src/ && ./bootstrap && ./configure
+       $(MAKE) -C src/
+
+check: all
+       $(OCTAVE) --path "$(TOPDIR)/inst/" --path "$(TOPDIR)/src/" \
+         --eval '${PKG_ADD}' \
+         --eval '__run_test_suite__ ({"$(TOPDIR)/inst"}, {})'
+
+run: all
+       $(OCTAVE) --persist --path "$(TOPDIR)/inst/" --path "$(TOPDIR)/src/" \
+         --eval '${PKG_ADD}'
+
+doctest: all
+       $(OCTAVE) --path "$(TOPDIR)/inst" --path "$(TOPDIR)/src" \
+         --eval '${PKG_ADD}' \
+         --eval 'pkg load doctest;' \
+         --eval "targets = {'$(TOPDIR)/inst', '$(TOPDIR)/src'};" \
+         --eval "doctest (targets);"
+
+clean: clean-docs
+       $(RM) -r $(TARGET_DIR) fntests.log
+       test ! -e src/Makefile || $(MAKE) -C src clean
+
+distclean: clean
+       test ! -e src/Makefile || $(MAKE) -C src distclean
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/strings-1.2.0/NEWS new/strings-1.3.0/NEWS
--- old/strings-1.2.0/NEWS      2015-06-06 23:40:45.000000000 +0200
+++ new/strings-1.3.0/NEWS      2022-06-28 14:21:04.000000000 +0200
@@ -1,3 +1,17 @@
+Summary of important user-visible changes for strings 1.3.0:
+-------------------------------------------------------------------
+
+ ** Update package to compile in GNU Octave 5+
+
+ ** Add detection and use of pcre2 if available
+
+Summary of important user-visible changes for strings 1.2.1:
+-------------------------------------------------------------------
+
+ ** The function base64decode has been almost rewritten and no longer returns
+    trailing zeros which have been introduced by padding (bug #38974), returns
+    uint8 vectors instead of binary64 vectors, and should perform faster.
+
 Summary of important user-visible changes for strings 1.2.0:
 -------------------------------------------------------------------
 
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/strings-1.2.0/inst/base64decode.m new/strings-1.3.0/inst/base64decode.m
--- old/strings-1.2.0/inst/base64decode.m       2015-06-06 23:40:45.000000000 
+0200
+++ new/strings-1.3.0/inst/base64decode.m       2022-06-28 14:21:04.000000000 
+0200
@@ -1,4 +1,5 @@
 ## Copyright (C) 2007 Muthiah Annamalai <muthiah.annama...@uta.edu>
+## Copyright (C) 2015 Oliver Heimlich <oh...@posteo.de>
 ##
 ## 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
@@ -18,7 +19,8 @@
 ## @deftypefnx {Function File} {@var{rval} =} base64decode (@var{code}, 
@var{as_string})
 ## Convert a base64 @var{code}  (a string of printable characters according to 
RFC 2045) 
 ## into the original ASCII data set of range 0-255. If option @var{as_string} 
is 
-## passed, the return value is converted into a string.
+## passed, the return value is converted into a string. Otherwise, the return
+## value is a uint8 row vector.
 ##
 ## @example
 ## @group
@@ -32,125 +34,84 @@
 ## @seealso {base64encode}
 ## @end deftypefn
 
-function z = base64decode (X, as_string)
-  if (nargin < 1 )
+function Z = base64decode (X, as_string)
+  if (nargin < 1 || nargin > 2)
     print_usage;
-  elseif nargin == 1
-    as_string=false;
+  elseif (nargin == 1)
+    as_string = false;
   endif
 
-  if ( any(X(:) < 0) || any(X(:) > 255))
-    error("base64decode is expecting integers in the range 0 .. 255");
-  endif
-
-  ## decompose strings into the 4xN matrices 
-  ## formatting issues.
-  if( rows(X) == 1 )
-    Y=[];
-    L=length(X);
-    for z=4:4:L
-        Y=[Y X(z-3:z)']; #keep adding columns
-    end
-    if min(size(Y))==1
-        Y=reshape(Y,[L, 1]);
-    else
-        Y=reshape(Y,[4,L/4]);
-    end
-    X=Y;
-    Y=[];
-  end
+  ## strip white space
+  X((X == ' ') | (X == "\n") | (X == "\r")) = [];
 
-  X = toascii(X);
-  Xa= X;
-
-  ## Work backwards. Starting at step in table,
-  ## lookup the index of the element in the table.
+  if (any (X(:) < 0) || any(X(:) > 255))
+    error ("base64decode is expecting integers in the range 0 .. 255");
+  endif
 
-  ## 6-bit encoding table, plus 1 for padding
-  ## 26*2 + 10 + 2 + 1  = 64 + 1, '=' is EOF stop mark.
-  table = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
-
-  S=size(X);
-  SRows=S(1);
-  SCols=S(2);
-  Y=zeros(S);
+  ## convert into ascii code and 8 bit integers to save memory
+  X = uint8 (X);
 
-  ## decode the incoming matrix & 
+  ## decompose into the 4xN matrices - separation of encoded 3 byte blocks
+  if (rows (X) ~= 4)
+    if (rem (numel (X), 4) ~= 0)
+      error ("base64decode is expecting blocks of 4 characters to decode");
+    endif
+    X = reshape (X, [4, numel(X)./4]);
+  endif
+  
+  ## decode 6-bit values from the incoming matrix & 
   ## write the values into Va matrix.
-  Va = -1*ones(size(Xa));
+  Va = ones (size(X), 'uint8') .* 65;
 
-  iAZ = (Xa >= 'A').*(Xa <= 'Z') > 0; 
-  Va(iAZ)=Xa(iAZ)-'A';
+  iAZ = ((X >= 'A') & (X <= 'Z'));
+  Va(iAZ) = X(iAZ) - 'A';
 
-  iaz = (Xa >= 'a').*(Xa <= 'z') > 0;
-  Va(iaz)=Xa(iaz)-'a'+26;
+  iaz = ((X >= 'a') & (X <= 'z'));
+  Va(iaz) = X(iaz) - 'a' + 26;
 
-  i09 = (Xa >= '0').*(Xa <= '9') > 0;
-  Va(i09)=Xa(i09)-'0'+52;
-
-  is = (Xa == '/') ;  Va(is) = 63;
-  ip = (Xa == '+') ;  Va(ip) = 62;
-  ieq = (Xa == '=') ;  Va(ieq) = 0;
-  clear is; clear ieq; clear ip; clear i09;
-  clear iaz; clear iAZ;  clear Xa; clear X;
-
-  Y=Va; clear Va;
-  Y1=Y(1,:);
-  if (SRows > 1)
-     Y2=Y(2,:);
-  else 
-     Y2=zeros(1,SCols);
-  end;
-
-  if (SRows > 2)
-     Y3=Y(3,:);
-  else 
-     Y3=zeros(1,SCols);
-  end;
-
-  if (SRows > 3)
-     Y4=Y(4,:);
-  else 
-     Y4=zeros(1,SCols);
-  end;
-
-  ## +1 not required due to ASCII subtraction
-  ## actual decoding work
-  b1 = Y1*4 + fix(Y2/16);
-  b2 = mod(Y2,16)*16+fix(Y3/4);
-  b3 = mod(Y3,4)*64 + Y4;
-
-  ZEROS=sum(sum(Y==0));
-  L=length(b1)*3;
-  z=zeros(1,L);
-  z(1:3:end)=b1;
-  if (SRows > 1)
-     z(2:3:end)=b2;
-  else
-     z(2:3:end)=[];
-  end;
-
-  if (SRows > 2)
-     z(3:3:end)=b3;
-  else
-     z(3:3:end)=[];
-  end
-
-  ## FIXME
-  ## is this expected behaviour?
-  if ( as_string )
-    L=length(z);
-    while ( ( L > 0) && ( z(L)==0 ) )
-      L=L-1;
-    end
-    z=char(z(1:L));
+  i09 = ((X >= '0') & (X <= '9'));
+  Va(i09) = X(i09) - '0' + 52;
+
+  Va(X == '+') = 62;
+  Va(X == '/') = 63;
+  
+  padding = (X == '=');
+  Va(padding) = 0;
+  
+  if (any (any (Va == 65)))
+    error ('base64decode is expecting valid characters A..Za..z0..9+/=');
+  endif
+  
+  if (not (isempty (X)) && ...
+      (find (padding, 1) < numel (X) - 1 || ...
+        (X(end - 1) == '=' && X(end) ~= '=')))
+    error ('base64decode is expecting max two padding characters at the end');
+  endif
+  
+  ## decode 4x6 bit into 3x8 bit
+  B = vertcat (...
+        Va(1, :) .* 4 + (Va(2, :) - rem (Va(2, :), 16)) ./ 16, ...
+        rem (Va(2, :), 16) .* 16 + (Va(3, :) - rem (Va(3, :), 4)) ./ 4, ...
+        rem (Va(3, :), 4) .* 64 + Va(4, :));
+
+  ## Convert blocks into row vector
+  Z = B(:).';
+  
+  ## Remove byte blocks which have been introduced by padding
+  if (not (isempty (X)))
+    Z(end - sum (padding(end - 1 : end)) + 1 : end) = [];
+  endif
+  
+  if (as_string)
+    Z = char (Z);
   end
 
 endfunction
 
 %!assert(base64decode(base64encode('Hakuna Matata'),true),'Hakuna Matata')
-%!assert(base64decode(base64encode([1:255])),[1:255])
+%!assert(base64decode(base64encode([1:255])),uint8([1:255]))
 %!assert(base64decode(base64encode('taken'),true),'taken')
 %!assert(base64decode(base64encode('sax'),true),'sax')
 %!assert(base64decode(base64encode('H'),true),'H')
+%!assert(base64decode(base64encode('H'),false),uint8('H'))
 %!assert(base64decode(base64encode('Ta'),true),'Ta')
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/strings-1.2.0/inst/base64encode.m new/strings-1.3.0/inst/base64encode.m
--- old/strings-1.2.0/inst/base64encode.m       2015-06-06 23:40:45.000000000 
+0200
+++ new/strings-1.3.0/inst/base64encode.m       2022-06-28 14:21:04.000000000 
+0200
@@ -46,7 +46,7 @@
   endif
   
   if (ischar (X))
-    X = toascii (X);
+    X = double (X);
   endif
   
   if (any (X != fix (X)) || any (X < 0 | X > 255))
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/strings-1.2.0/inst/test/pcregexp.cc-tst 
new/strings-1.3.0/inst/test/pcregexp.cc-tst
--- old/strings-1.2.0/inst/test/pcregexp.cc-tst 2015-06-06 23:40:54.000000000 
+0200
+++ new/strings-1.3.0/inst/test/pcregexp.cc-tst 1970-01-01 01:00:00.000000000 
+0100
@@ -1,19 +0,0 @@
-## DO NOT EDIT!  Generated automatically from src/pcregexp.cc
-%!assert(pcregexp("f(.*)uck"," firetruck "),[2,10;3,7]);
-%!test
-%! [m,b]=pcregexp("f(.*)uck"," firetruck ");
-%! assert(m,[2,10;3,7]);
-%! assert(b, "iretr")
-%!test
-%! [m,b] = pcregexp("a(.*?)d", "asd asd");
-%! assert(m, [1,3;2,2]);
-%! assert(b, "s");
-%!test
-%! [m,b] = pcregexp("a", "A");
-%! assert(isempty(m))
-%! assert(b, "")
-%!fail("[m,b] = pcregexp('a', 'a')", "pcregexp")
-%!fail("pcregexp('(', '')", "pcregexp")
-%!
-%!demo
-%! [m, s1] = pcregexp("(a.*?(d))", "asd asd")
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/strings-1.2.0/src/Makefile new/strings-1.3.0/src/Makefile
--- old/strings-1.2.0/src/Makefile      2015-06-06 23:40:45.000000000 +0200
+++ new/strings-1.3.0/src/Makefile      1970-01-01 01:00:00.000000000 +0100
@@ -1,11 +0,0 @@
-OCTAVE ?= octave
-MKOCTFILE ?= mkoctfile -Wall
-
-PCRE_SWITCHES := $(shell $(OCTAVE) \
-       --no-gui --no-init-file --no-site-file --silent --no-history \
-       --eval 'disp (octave_config_info ("PCRE_LIBS"));' \
-       --eval 'disp (octave_config_info ("PCRE_CPPFLAGS"));' \
-       )
-
-pcregexp.oct: %.oct: %.cc
-       $(MKOCTFILE) $(PCRE_SWITCHES) -o $@ $<
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/strings-1.2.0/src/bootstrap new/strings-1.3.0/src/bootstrap
--- old/strings-1.2.0/src/bootstrap     1970-01-01 01:00:00.000000000 +0100
+++ new/strings-1.3.0/src/bootstrap     2022-06-28 14:21:04.000000000 +0200
@@ -0,0 +1,7 @@
+#! /bin/sh
+
+aclocal
+
+autoconf
+
+autoheader -f
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/strings-1.2.0/src/config.h.in new/strings-1.3.0/src/config.h.in
--- old/strings-1.2.0/src/config.h.in   1970-01-01 01:00:00.000000000 +0100
+++ new/strings-1.3.0/src/config.h.in   2022-06-28 14:21:04.000000000 +0200
@@ -0,0 +1,26 @@
+/* config.h.in.  Generated from configure.ac by autoheader.  */
+
+#include "undef-ah-octave.h"
+
+/* macro for alternative Octave symbols */
+#undef OCTAVE__WRONG_TYPE_ARG
+
+/* Define to the address where bug reports for this package should be sent. */
+#undef PACKAGE_BUGREPORT
+
+/* Define to the full name of this package. */
+#undef PACKAGE_NAME
+
+/* Define to the full name and version of this package. */
+#undef PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+#undef PACKAGE_TARNAME
+
+/* Define to the home page for this package. */
+#undef PACKAGE_URL
+
+/* Define to the version of this package. */
+#undef PACKAGE_VERSION
+
+#include "oct-alt-includes.h"
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/strings-1.2.0/src/configure.ac new/strings-1.3.0/src/configure.ac
--- old/strings-1.2.0/src/configure.ac  1970-01-01 01:00:00.000000000 +0100
+++ new/strings-1.3.0/src/configure.ac  2022-06-28 14:21:04.000000000 +0200
@@ -0,0 +1,114 @@
+#                                               -*- Autoconf -*-
+# Process this file with autoconf to produce a configure script.
+#
+### Copyright (C) 2015-2018 Olaf Till <i7t...@t-online.de>
+### Copyright (C) 2019-2022 John Donoghue <john.donog...@ieee.org>
+###
+### 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.67])
+AC_INIT([strings], [1.3.0])
+AC_CONFIG_SRCDIR([pcregexp.cc])
+AC_CONFIG_HEADERS([config.h])
+
+# Avoid warnings for redefining AH-generated preprocessor symbols of
+# Octave.
+AH_TOP([#include "undef-ah-octave.h"])
+
+AC_CONFIG_MACRO_DIRS([m4])
+
+# 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
+
+#AC_CHECK_TOOL(PKG_CONFIG, pkg-config, [])
+#if test -z "$PKG_CONFIG"; then
+#    AC_MSG_ERROR([pkg-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
+  
+AC_PROG_CXXCPP
+
+AC_PROG_GREP
+
+# Checks for typedefs, structures, and compiler characteristics.
+
+# Checks for library functions.
+USE_PCRE2=no
+PKG_CHECK_MODULES([PCRE2],[libpcre2-8],
+ [USE_PCRE2=yes],
+ [
+  PKG_CHECK_MODULES([PCRE],[libpcre],
+   [],
+   [AC_MSG_ERROR([libpcre and libpre2 not found])])
+ ]
+)
+if test x$USE_PCRE2 == xyes; then
+PCRE_CFLAGS="$PCRE2_CFLAGS -DUSE_PCRE2"
+PCRE_LIBS=$PCRE2_LIBS
+fi
+
+
+
+# Start of checks for Octave features, preparations for checks.
+OCTLIBDIR=${OCTLIBDIR:-`$OCTAVE_CONFIG -p OCTLIBDIR`}
+## We need Octaves include path both with and without '/octave'
+## appended. The path without '/octave' is needed to selectively test
+## for Octave headers, like octave/....h. The path with '/octave' is
+## needed since some Octave headers contain include directives for
+## other Octave headers with <> instead of "".
+OCTINCLUDEDIR=${OCTINCLUDEDIR:-`$MKOCTFILE -p INCFLAGS`}
+AC_LANG_PUSH([C++])
+TCXXFLAGS=$CXXFLAGS
+TLDFLAGS=$LDFLAGS
+TLIBS=$LIBS
+TCPPFLAGS=$CPPFLAGS
+LDFLAGS="-L$OCTLIBDIR $LDFLAGS"
+LIBS="-loctinterp $LIBS"
+# CXXFLAGS=
+CPPFLAGS="$OCTINCLUDEDIR $CPPFLAGS"
+
+## Simple symbol alternatives of different Octave versions.
+OF_OCTAVE_LIST_ALT_SYMS([
+[dnl
+  [gripe_wrong_type_arg],
+  [err_wrong_type_arg],
+  [[err_wrong_type_arg("test");]],
+  [OCTAVE__WRONG_TYPE_ARG],
+  [],
+  []
+]
+],
+   [oct-alt-includes.h])
+
+LIBS=$TLIBS
+LDFLAGS=$TLDFLAGS
+CXXFLAGS=$TCXXFLAGS
+CPPFLAGS=$TCPPFLAGS
+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/strings-1.2.0/src/m4/octave-forge.m4 
new/strings-1.3.0/src/m4/octave-forge.m4
--- old/strings-1.2.0/src/m4/octave-forge.m4    1970-01-01 01:00:00.000000000 
+0100
+++ new/strings-1.3.0/src/m4/octave-forge.m4    2022-06-28 14:21:04.000000000 
+0200
@@ -0,0 +1,93 @@
+# Copyright (C) 2017-2018 Olaf Till <i7t...@t-online.de>
+# Modifications to print what is searching for by JohnD
+#
+# 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/>.
+
+# arguments of OF_OCTAVE_ALT_SYMS (see also description of
+# OF_OCTAVE_LIST_ALT_SYMS below):
+#
+# $1: symbol version 1
+# $2: symbol version 2
+# $3: test for symbol version 2
+# $4: macro name to access alternative symbols
+# $5: include directives for symbol version 1
+# $6: include directives for symbol version 2
+# (a list of lists of args 1--6 is $1 of OF_OCTAVE_LIST_ALT_SYMS)
+# $7: name of generated include file with alternatives of Octave headers
+# (arg7 is $2 of OF_OCTAVE_LIST_ALT_SYMS)
+AC_DEFUN([OF_OCTAVE_ALT_SYMS], [
+AC_MSG_CHECKING([$1 or $2])
+  AC_COMPILE_IFELSE(
+    [AC_LANG_PROGRAM([[#include <octave/oct.h>]
+                      $6],
+                     [$3])],
+    [AC_DEFINE($4,
+               [[$2]],
+               [macro for alternative Octave symbols])
+     AC_MSG_RESULT([$2])
+     echo '$6' >> $7],
+    [AC_DEFINE($4,
+               [[$1]],
+               [macro for alternative Octave symbols])
+     AC_MSG_RESULT([$1])
+     echo '$5' >> $7]
+)
+])
+
+
+# OF_OCTAVE_LIST_ALT_SYMS is called in the following way:
+#
+# OF_OCTAVE_LIST_ALT_SYMS([
+# [dnl
+#   [old_octave_symbol],
+#   [new_octave_symbol],
+#   [[compilation test]
+#    [for new_octave_symbol]],
+#   [NAME_OF_GENERATED_MACRO____WILL_EXPAND_TO_OLD_OR_NEW_SYMBOL],
+#   [[include directives]
+#    [except #include <octave/oct.h>]
+#    [necessary to compile with old_octave_symbol]],
+#   [[include directives]
+#    [except #include <octave/oct.h>]
+#    [nessary to compile with new_octave_symbol]
+#    [and to compile the test]]
+# ],
+#
+# ... further such lists as the above
+#
+# ],
+#
+# [name-of-header-file-for-alternative-octave-iclude-directives.h])
+#
+#
+# This file should be put into src/m4/, and the line
+#
+# AC_CONFIG_MACRO_DIRS([m4])
+#
+# should be put into src/configure.ac. The package should use
+# autoheader to generate config.h.in (src/bootstrap should contain the
+# lines 'aclocal', 'autoconf', and 'autoheader -f'). Package code
+# should include config.h and use the generated macros to access the
+# alternative symbols of Octave. An example of a call to
+# OF_OCTAVE_LIST_ALT_SYMS in src/configure.ac is available together
+# with this file.
+AC_DEFUN([OF_OCTAVE_LIST_ALT_SYMS], [
+
+echo '/* generated by configure */' > $2
+
+m4_foreach([it], [$1], [m4_apply([OF_OCTAVE_ALT_SYMS], [it, $2])])
+
+AH_BOTTOM([#include "$2"])
+
+])
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/strings-1.2.0/src/pcregexp.cc new/strings-1.3.0/src/pcregexp.cc
--- old/strings-1.2.0/src/pcregexp.cc   2015-06-06 23:40:45.000000000 +0200
+++ new/strings-1.3.0/src/pcregexp.cc   2022-06-28 14:21:04.000000000 +0200
@@ -1,4 +1,4 @@
-// Copyright (C) 2004 Stefan van der Walt <ste...@sun.ac.za>
+// Copyright (C) 2004-2022 Stefan van der Walt <ste...@sun.ac.za>
 // All rights reserved.
 //
 // Redistribution and use in source and binary forms, with or without
@@ -22,10 +22,18 @@
 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 #include <octave/oct.h>
+#ifdef USE_PCRE2
+#define PCRE2_DATA_WIDTH 8
+#define PCRE2_CODE_UNIT_WIDTH 8
+#include <pcre2.h>
+#else
 #include <pcre.h>
+#endif
 #include <iostream>
 #include <vector>
 
+#include "config.h"
+
 //FIXME This function needs some documentation
 DEFUN_DLD(pcregexp, args, nargout, "\
 -*- texinfo -*-\n\
@@ -48,12 +56,59 @@
 
     std::string pattern = args(0).string_value();
     std::string input = args(1).string_value();
-    if (error_state) {
-        gripe_wrong_type_arg("pcregexp", args(0));
+
+    // Compile expression
+#ifdef USE_PCRE2
+    pcre2_code *re;
+    PCRE2_UCHAR err[128];
+    PCRE2_SIZE erroffset;
+    int errnumber;
+
+    re = pcre2_compile((PCRE2_SPTR)pattern.c_str(), PCRE2_ZERO_TERMINATED, 0, 
&errnumber, &erroffset, NULL);
+     
+    if (re == NULL) {
+        pcre2_get_error_message(errnumber, err, sizeof(err));
+        error("pcregexp: %s at position %ld of expression", err, erroffset);
         return retval;
     }
+    // Get nr of subpatterns
+    pcre2_match_data *match_data;
+    PCRE2_SIZE *ovector;
+    match_data = pcre2_match_data_create_from_pattern(re, NULL);
+    int matches = pcre2_match(re, (PCRE2_SPTR)input.c_str(), input.length(), 
0, 0, match_data, NULL);
+   
+    if (matches == PCRE2_ERROR_NOMATCH) {
+        for (int i=nargout-1; i>=0; i--) retval(i) = "";
+            retval(0) = Matrix();
+        pcre2_code_free(re);
+        return retval;
+    } else if (matches < -1) {
+       error("pcregexp: internal error calling pcre_exec");
+       return retval;
+    }
+ 
+    ovector = pcre2_get_ovector_pointer(match_data);
+ 
+    // Pack indeces
+    Matrix indeces = Matrix(matches, 2);
+    for (int i = 0; i < matches; i++) {
+        indeces(i, 0) = ovector[2*i]+1;
+        indeces(i, 1) = ovector[2*i+1];
+        if (indeces(i, 0) == 0) indeces(i, 1) = 0;
+    }
+    retval(0) = indeces;
 
-    // Compile expression
+    // Pack substrings
+    retval.resize(nargout + 1);
+    for (int i = 1; i < matches; i++)
+        retval(i) = std::string(input.c_str() + ovector[2*i],
+                                ovector[2*i+1] - ovector[2*i]);
+ 
+     // Free memory
+    pcre2_match_data_free(match_data);
+    pcre2_code_free(re);
+ 
+#else
     pcre *re;
     const char *err;
     int erroffset;
@@ -109,6 +164,7 @@
     // Free memory
     pcre_free_substring_list(listptr);
     pcre_free(re);
+#endif
 
     if (nargout > matches) {
         error("pcregexp: too many return values requested");
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/strings-1.2.0/src/undef-ah-octave.h new/strings-1.3.0/src/undef-ah-octave.h
--- old/strings-1.2.0/src/undef-ah-octave.h     1970-01-01 01:00:00.000000000 
+0100
+++ new/strings-1.3.0/src/undef-ah-octave.h     2022-06-28 14:21:04.000000000 
+0200
@@ -0,0 +1,27 @@
+/* To be included at the top of config.h (by autoheader). Avoid
+   warnings for redefining AH-generated preprocessor symbols of
+   Octave. */
+
+#ifdef PACKAGE_BUGREPORT
+#undef PACKAGE_BUGREPORT
+#endif
+
+#ifdef PACKAGE_NAME
+#undef PACKAGE_NAME
+#endif
+
+#ifdef PACKAGE_STRING
+#undef PACKAGE_STRING
+#endif
+
+#ifdef PACKAGE_TARNAME
+#undef PACKAGE_TARNAME
+#endif
+
+#ifdef PACKAGE_URL
+#undef PACKAGE_URL
+#endif
+
+#ifdef PACKAGE_VERSION
+#undef PACKAGE_VERSION
+#endif

Reply via email to