Hello community,
here is the log from the commit of package octave-forge-general for
openSUSE:Factory checked in at 2018-06-29 22:25:52
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/octave-forge-general (Old)
and /work/SRC/openSUSE:Factory/.octave-forge-general.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "octave-forge-general"
Fri Jun 29 22:25:52 2018 rev:2 rq:616560 version:2.1.0
Changes:
--------
---
/work/SRC/openSUSE:Factory/octave-forge-general/octave-forge-general.changes
2015-06-16 15:11:36.000000000 +0200
+++
/work/SRC/openSUSE:Factory/.octave-forge-general.new/octave-forge-general.changes
2018-06-29 22:25:54.162506136 +0200
@@ -1,0 +2,10 @@
+Wed Jun 6 08:16:58 UTC 2018 - [email protected]
+
+- Update to version 2.1.0:
+ * added configure script to detect function names for various
+ octave versions.
+ * updated depreciated functions for octave 4.4
+ * SHA1 uses nettle library as its underlying implementatiom
+ * package installs BIST .cc tests
+
+-------------------------------------------------------------------
Old:
----
general-2.0.0.tar.gz
New:
----
general-2.1.0.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ octave-forge-general.spec ++++++
--- /var/tmp/diff_new_pack.1b8nN6/_old 2018-06-29 22:25:54.838505626 +0200
+++ /var/tmp/diff_new_pack.1b8nN6/_new 2018-06-29 22:25:54.838505626 +0200
@@ -1,7 +1,7 @@
#
# spec file for package octave-forge-general
#
-# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2018 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,10 +18,10 @@
%define octpkg general
Name: octave-forge-%{octpkg}
-Version: 2.0.0
+Version: 2.1.0
Release: 0
Summary: General tools for Octave
-License: GPL-3.0+ and BSD-3-Clause
+License: GPL-3.0-or-later AND BSD-3-Clause
Group: Productivity/Scientific/Math
Url: http://octave.sourceforge.net
Source0:
http://downloads.sourceforge.net/octave/%{octpkg}-%{version}.tar.gz
++++++ general-2.0.0.tar.gz -> general-2.1.0.tar.gz ++++++
++++ 5729 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/general-2.0.0/DESCRIPTION new/general-2.1.0/DESCRIPTION
--- old/general-2.0.0/DESCRIPTION 2015-05-27 17:43:57.000000000 +0200
+++ new/general-2.1.0/DESCRIPTION 2018-05-13 23:01:51.400133935 +0200
@@ -1,10 +1,11 @@
Name: general
-Version: 2.0.0
-Date: 2015-05-27
+Version: 2.1.0
+Date: 2018-05-11
Author: various authors
Maintainer: Octave-Forge community <[email protected]>
Title: General
Description: General tools for Octave.
Depends: octave (>= 4.0.0)
+BuildRequire: nettle-devel
License: GPLv3+, modified BSD, public domain
Url: http://octave.sf.net
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/general-2.0.0/Makefile new/general-2.1.0/Makefile
--- old/general-2.0.0/Makefile 1970-01-01 01:00:00.000000000 +0100
+++ new/general-2.1.0/Makefile 2018-05-13 23:01:51.400133935 +0200
@@ -0,0 +1,240 @@
+## Copyright 2015-2016 Carnë Draug
+## Copyright 2015-2016 Oliver Heimlich
+## Copyright 2017 Julien Bect <[email protected]>
+## Copyright 2017 Olaf Till <[email protected]>
+## Copyright 2018 John Donoghue <[email protected]>
+##
+## 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.
+
+## Some basic tools (can be overriden using environment variables)
+SED ?= sed
+TAR ?= tar
+GREP ?= grep
+CUT ?= cut
+TR ?= tr
+
+## Note the use of ':=' (immediate set) and not just '=' (lazy set).
+## http://stackoverflow.com/a/448939/1609556
+package := $(shell $(GREP) "^Name: " DESCRIPTION | $(CUT) -f2 -d" " | \
+$(TR) '[:upper:]' '[:lower:]')
+version := $(shell $(GREP) "^Version: " DESCRIPTION | $(CUT) -f2 -d" ")
+
+## These are the paths that will be created for the releases.
+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
+## Using $(realpath ...) avoids problems with symlinks due to bug
+## #50994 in Octaves scripts/pkg/private/install.m. But at least the
+## release directory above is needed in the relative form, for 'git
+## archive --format=tar --prefix=$(release_dir).
+real_target_dir := $(realpath .)/$(target_dir)
+installation_dir := $(real_target_dir)/.installation
+package_list := $(installation_dir)/.octave_packages
+install_stamp := $(installation_dir)/.install_stamp
+
+## These can be set by environment variables which allow to easily
+## test with different Octave versions.
+ifndef OCTAVE
+OCTAVE := octave
+endif
+OCTAVE := $(OCTAVE) --no-gui --silent --norc
+MKOCTFILE ?= mkoctfile
+
+## Command used to set permissions before creating tarballs
+FIX_PERMISSIONS ?= chmod -R a+rX,u+w,go-w,ug-s
+
+## Detect which VCS is used
+vcs := $(if $(wildcard .hg),hg,$(if $(wildcard .git),git,unknown))
+ifeq ($(vcs),hg)
+release_dir_dep := .hg/dirstate
+endif
+ifeq ($(vcs),git)
+release_dir_dep := .git/index
+endif
+
+
+## .PHONY indicates targets that are not filenames
+## (https://www.gnu.org/software/make/manual/html_node/Phony-Targets.html)
+.PHONY: help
+
+## make will display the command before runnning them. Use @command
+## to not display it (makes specially sense for echo).
+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 " install - Install the package in $(installation_dir), where
it is not visible in a normal Octave session."
+ @echo " check - Execute package tests."
+ @echo " doctest - Test the help texts with the doctest package."
+ @echo " run - Run Octave with the package installed in
$(installation_dir) in the path."
+ @echo " clean - Remove everything made with this Makefile."
+
+
+##
+## Recipes for release tarballs (package + html)
+##
+
+.PHONY: release dist html clean-tarballs clean-unpacked-release
+
+## To make a release, build the distribution and html tarballs.
+release: dist html
+ md5sum $(release_tarball) $(html_tarball)
+ @echo "Upload @ https://sourceforge.net/p/octave/package-releases/new/"
+ @echo " and note the changeset the release corresponds to"
+
+## dist and html targets are only PHONY/alias targets to the release
+## and html tarballs.
+dist: $(release_tarball)
+html: $(html_tarball)
+
+## An implicit rule with a recipe to build the tarballs correctly.
+%.tar.gz: %
+ $(TAR) -c -f - --posix -C "$(target_dir)/" "$(notdir $<)" | gzip -9n >
"$@"
+
+clean-tarballs:
+ @echo "## Cleaning release tarballs (package + html)..."
+ -$(RM) $(release_tarball) $(html_tarball)
+ @echo
+
+## Create the unpacked package.
+##
+## Notes:
+## * having ".hg/dirstate" (or ".git/index") as a prerequesite means it is
+## only rebuilt if we are at a different commit.
+## * the variable RM usually defaults to "rm -f"
+## * having this recipe separate from the one that makes the tarball
+## makes it easy to have packages in alternative formats (such as zip)
+## * note that if a commands needs to be run in a specific directory,
+## the command to "cd" needs to be on the same line. Each line restores
+## the original working directory.
+$(release_dir): $(release_dir_dep)
+ -$(RM) -r "$@"
+ifeq (${vcs},hg)
+ hg archive --exclude ".hg*" --type files "$@"
+endif
+ifeq (${vcs},git)
+ git archive --format=tar --prefix="$@/" HEAD | $(TAR) -x
+ $(RM) "$@/.gitignore"
+endif
+## Don't fall back to run the supposed necessary contents of
+## 'bootstrap' here. Users are better off if they provide
+## 'bootstrap'. Administrators, checking build reproducibility, can
+## put in the missing 'bootstrap' file if they feel they know its
+## necessary contents.
+ifneq (,$(wildcard src/bootstrap))
+ cd "$@/src" && ./bootstrap && $(RM) -r "autom4te.cache"
+endif
+## Uncomment this if your src/Makefile.in has these targets for
+## pre-building something for the release (e.g. documentation).
+# cd "$@/src" && ./configure && $(MAKE) prebuild && \
+# $(MAKE) distclean && $(RM) Makefile
+##
+ ${FIX_PERMISSIONS} "$@"
+
+run_in_place = $(OCTAVE) --eval ' pkg ("local_list", "$(package_list)"); ' \
+ --eval ' pkg ("load", "$(package)"); '
+
+# html_options = --eval 'options = get_html_options ("octave-forge");'
+## Uncomment this for package documentation.
+html_options = --eval 'options = get_html_options ("octave-forge");'
+$(html_dir): $(install_stamp)
+ $(RM) -r "$@";
+ $(run_in_place) \
+ --eval ' pkg load generate_html; ' \
+ $(html_options) \
+ --eval ' generate_package_html ("$(package)", "$@", options); ';
+ $(FIX_PERMISSIONS) "$@";
+
+clean-unpacked-release:
+ @echo "## Cleaning unpacked release tarballs (package + html)..."
+ -$(RM) -r $(release_dir) $(html_dir)
+ @echo
+
+##
+## Recipes for installing the package.
+##
+
+.PHONY: install clean-install
+
+octave_install_commands = \
+' llist_path = pkg ("local_list"); \
+ mkdir ("$(installation_dir)"); \
+ load (llist_path); \
+ local_packages(cellfun (@ (x) strcmp ("$(package)", x.name),
local_packages)) = []; \
+ save ("$(package_list)", "local_packages"); \
+ pkg ("local_list", "$(package_list)"); \
+ pkg ("prefix", "$(installation_dir)", "$(installation_dir)"); \
+ pkg ("install", "-local", "-verbose", "$(release_tarball)"); '
+
+## Install unconditionally. Maybe useful for testing installation with
+## different versions of Octave.
+install: $(release_tarball)
+ @echo "Installing package under $(installation_dir) ..."
+ $(OCTAVE) --eval $(octave_install_commands)
+ touch $(install_stamp)
+
+## Install only if installation (under target/...) is not current.
+$(install_stamp): $(release_tarball)
+ @echo "Installing package under $(installation_dir) ..."
+ $(OCTAVE) --eval $(octave_install_commands)
+ touch $(install_stamp)
+
+clean-install:
+ @echo "## Cleaning installation under $(installation_dir) ..."
+ -$(RM) -r $(installation_dir)
+ @echo
+
+
+##
+## Recipes for testing purposes
+##
+
+.PHONY: run doctest check
+
+## Start an Octave session with the package directories on the path for
+## interactice test of development sources.
+run: $(install_stamp)
+ $(run_in_place) --persist
+
+## Test example blocks in the documentation. Needs doctest package
+## https://octave.sourceforge.io/doctest/index.html
+doctest: $(install_stamp)
+ $(run_in_place) --eval 'pkg load doctest;'
\
+ --eval "targets = '$(shell (ls inst; ls src | $(GREP) .oct) | $(CUT)
-f2 -d@ | $(CUT) -f1 -d.)';" \
+ --eval "targets = strsplit (targets, ' '); doctest (targets);"
+
+
+## Test package.
+octave_test_commands = \
+' pkgs = pkg("list","general"); cd (pkgs{1}.dir); dirs = { "." }; \
+ dirs(cellfun (@ (x) ! isdir (x), dirs)) = []; \
+ if (isempty (dirs)) error ("no \"inst\" or \"src\" directory"); exit (1); \
+ else __run_test_suite__ (dirs, {}); endif '
+## the following works, too, but provides no overall summary output as
+## __run_test_suite__ does:
+##
+## else cellfun (@runtests, horzcat (cellfun (@ (dir) ostrsplit (([~, dirs]
= system (sprintf ("find %s -type d", dir))), "\n\r", true), dirs,
"UniformOutput", false){:})); endif '
+check: $(install_stamp)
+ $(run_in_place) --eval $(octave_test_commands)
+
+
+##
+## CLEAN
+##
+
+.PHONY: clean
+
+clean: clean-tarballs clean-unpacked-release clean-install
+ @echo "## Removing target directory (if empty)..."
+ test -e $(target_dir) && rmdir $(target_dir) || true
+ test -e inst/test && rm -rf inst/test || true
+ @echo
+ @echo "## Cleaning done"
+ @echo
+
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/general-2.0.0/NEWS new/general-2.1.0/NEWS
--- old/general-2.0.0/NEWS 2015-05-27 17:43:57.000000000 +0200
+++ new/general-2.1.0/NEWS 2018-05-13 23:01:51.400133935 +0200
@@ -1,8 +1,19 @@
+Summary of important user-visible changes for general 2.1.0:
+-------------------------------------------------------------------
+
+ ** added configure script to detect function names for various
+ octave versions.
+
+ ** updated depreciated functions for octave 4.4
+
+ ** SHA1 uses nettle library as its underlying implementatiom
+
+ ** package installs BIST .cc tests
+
Summary of important user-visible changes for general 2.0.0:
-------------------------------------------------------------------
- ** Package is now dependent on Octave version 4.0.0 to avoid
- conflicts with missing inputParser.
+ ** Package is now dependent on Octave version 4.0.0 or later.
** The @inputParser has been removed since it is now part of
Octave core and has a completely Matlab compatible syntax.
@@ -17,9 +28,6 @@
## use Octave core inputParser implementation
endif
- ** The `cauchy' function is new on the general package. It has
- been moved from the optim package.
-
Summary of important user-visible changes for general 1.3.4:
-------------------------------------------------------------------
@@ -39,7 +47,6 @@
-------------------------------------------------------------------
** The following functions are new:
-
tablify
Summary of important user-visible changes for general 1.3.1:
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/general-2.0.0/src/Makefile new/general-2.1.0/src/Makefile
--- old/general-2.0.0/src/Makefile 2015-05-27 17:43:57.000000000 +0200
+++ new/general-2.1.0/src/Makefile 1970-01-01 01:00:00.000000000 +0100
@@ -1,13 +0,0 @@
-ifndef MKOCTFILE
-MKOCTFILE := mkoctfile -Wall
-endif
-
-PROGS = $(patsubst %.cc,%.oct,$(wildcard *.cc))
-
-all: $(PROGS)
-
-%.oct: %.cc
- $(MKOCTFILE) $<
-
-clean:
- rm -f *.o octave-core core *.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/general-2.0.0/src/SHA1.cc new/general-2.1.0/src/SHA1.cc
--- old/general-2.0.0/src/SHA1.cc 2015-05-27 17:43:57.000000000 +0200
+++ new/general-2.1.0/src/SHA1.cc 2018-05-13 23:01:51.408133896 +0200
@@ -1,4 +1,5 @@
// Copyright (C) 1999 Andy Adler <[email protected]>
+// Copyright (C) 2018 John Donoghue <[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
@@ -18,25 +19,14 @@
#include <octave/oct.h>
-/*
- * defines for SHA1.c code
- */
-
-#define HW 5
-#define LITTLE_ENDIAN_DEF 5
-
-typedef struct {
- unsigned long state[5];
- unsigned long count[2];
- unsigned char buffer[64];
-} hash_context;
-
-static void
-hash_initial( hash_context * c );
-static void
-hash_process( hash_context * c, unsigned char * data, unsigned len );
-static void
-hash_final( hash_context * c, unsigned long[HW] );
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#ifdef HAVE_NETTLE
+ #include <nettle/sha1.h>
+#endif
+
DEFUN_DLD (SHA1, args, ,
"hash = SHA1 (...)\n\
@@ -54,230 +44,66 @@
\n\
HMAC= SHA1( [ passcode, SHA1( [passcode, data ] ) ); ")
{
+#ifndef HAVE_NETTLE
+ error ("SHA1: Your system doesn't support or wasnt compiled with the SHA1
interface");
+ return octave_value ();
+#else
octave_value_list retval;
- octave_value tmp;
- int nargin = args.length ();
- hash_context c;
+ struct sha1_ctx ctx;
+ uint8_t digest[SHA1_DIGEST_SIZE];
- if (nargin >2 || nargin ==0) {
- usage("SHA1");
+ int nargin = args.length ();
+ if (nargin > 2 || nargin == 0) {
+ print_usage ();
return retval;
}
- else if (nargin ==2 ){
+ else if (nargin == 2 ) {
ColumnVector init( args(1).vector_value() );
- if (init.length() != 20)
- error("hash initializer must have 20 bytes");
+ if (init.numel() != SHA1_DIGEST_SIZE) {
+ error("hash initializer must have %d bytes", SHA1_DIGEST_SIZE);
+ }
- for( int i=0,k=0; i<5; i++) {
- c.state[i]= 0;
+ sha1_init (&ctx);
+ for ( int i=0,k=0; i<5; i++) {
+ ctx.state[i]= 0;
for( int j=0; j<4; j++)
- c.state[i]|= ( (unsigned char) init(k++) ) << (24 - 8*j);
-// printf("state=%d v=%08lX\n", i, c.state[i]);
+ ctx.state[i]|= ( (uint8_t) init(k++) ) << (24 - 8*j);
}
- c.count[0]= c.count[1]=0;
}
else {
- hash_initial( &c);
+ sha1_init (&ctx);
}
-
+
ColumnVector data( args(0).vector_value() );
- int len=data.length();
+ int len=data.numel();
- for( int i=0; i< len; i++) {
- unsigned char d= (unsigned char) data(i);
- hash_process( &c, &d, 1);
+ for ( int i=0; i< len; i++) {
+ uint8_t d = (uint8_t) data(i);
+ sha1_update( &ctx, 1, &d);
}
- unsigned long digest[5];
- hash_final( &c, digest);
+ sha1_digest(&ctx, SHA1_DIGEST_SIZE, digest);
- RowVector hash(20);
- for( int i=0; i<5; i++) {
- hash(4*i+0)= (digest[i] & 0xFF000000)>>24;
- hash(4*i+1)= (digest[i] & 0x00FF0000)>>16;
- hash(4*i+2)= (digest[i] & 0x0000FF00)>> 8;
- hash(4*i+3)= (digest[i] & 0x000000FF);
+ RowVector hash(SHA1_DIGEST_SIZE);
+ for ( int i=0; i<SHA1_DIGEST_SIZE; i++) {
+ hash(i) = digest[i];
}
retval(0)= hash;
- return retval;
-}
-
-/*
- * NOTE: The following code is not mine and has
- * the following copyright
- */
-
-/*
-This code is available from:
- http://ds.dial.pipex.com/george.barwood/v8/pegwit.htm
-SHA-1 in C
-By Steve Reid <[email protected]>
-100% Public Domain
-
-Test Vectors (from FIPS PUB 180-1)
-"abc"
- A9993E36 4706816A BA3E2571 7850C26C 9CD0D89D
-"abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"
- 84983E44 1C3BD26E BAAE4AA1 F95129E5 E54670F1
-A million repetitions of "a"
- 34AA973C D4C4DAA4 F61EEB2B DBAD2731 6534016F
-*/
-
-
-#if !defined(LITTLE_ENDIAN_DEF) && !defined(BIG_ENDIAN_DEF)
- #if defined(_M_IX86) || defined(_M_I86) || defined(__alpha)
- #define LITTLE_ENDIAN_DEF
- #else
- #error "LITTLE_ENDIAN_DEF or BIG_ENDIAN_DEF must be defined"
- #endif
-#endif
-
-/* #define SHA1HANDSOFF * Copies data before messing with it. */
-
-
-#define rol(value, bits) (((value) << (bits)) | ((value) >> (32 - (bits))))
-
-/* blk0() and blk() perform the initial expand. */
-/* I got the idea of expanding during the round function from SSLeay */
-#ifdef LITTLE_ENDIAN_DEF
-#define blk0(i) (block->l[i] = (rol(block->l[i],24)&0xFF00FF00) \
- |(rol(block->l[i],8)&0x00FF00FF))
-#else
-#define blk0(i) block->l[i]
-#endif
-#define blk(i) (block->l[i&15] = rol(block->l[(i+13)&15]^block->l[(i+8)&15] \
- ^block->l[(i+2)&15]^block->l[i&15],1))
-
-/* (R0+R1), R2, R3, R4 are the different operations used in SHA1 */
-#define R0(v,w,x,y,z,i)
z+=((w&(x^y))^y)+blk0(i)+0x5A827999+rol(v,5);w=rol(w,30);
-#define R1(v,w,x,y,z,i)
z+=((w&(x^y))^y)+blk(i)+0x5A827999+rol(v,5);w=rol(w,30);
-#define R2(v,w,x,y,z,i) z+=(w^x^y)+blk(i)+0x6ED9EBA1+rol(v,5);w=rol(w,30);
-#define R3(v,w,x,y,z,i)
z+=(((w|x)&y)|(w&x))+blk(i)+0x8F1BBCDC+rol(v,5);w=rol(w,30);
-#define R4(v,w,x,y,z,i) z+=(w^x^y)+blk(i)+0xCA62C1D6+rol(v,5);w=rol(w,30);
-
-/* Hash a single 512-bit block. This is the core of the algorithm. */
-
-static
-void SHA1Transform(unsigned long state[5], unsigned char buffer[64])
-{
-unsigned long a, b, c, d, e;
-typedef union {
- unsigned char c[64];
- unsigned long l[16];
-} CHAR64LONG16;
-CHAR64LONG16* block;
-#ifdef SHA1HANDSOFF
-static unsigned char workspace[64];
- block = (CHAR64LONG16*)workspace;
- memcpy(block, buffer, 64);
-#else
- block = (CHAR64LONG16*)buffer;
+ return retval;
#endif
- /* Copy context->state[] to working vars */
- a = state[0];
- b = state[1];
- c = state[2];
- d = state[3];
- e = state[4];
- /* 4 rounds of 20 operations each. Loop unrolled. */
- R0(a,b,c,d,e, 0); R0(e,a,b,c,d, 1); R0(d,e,a,b,c, 2); R0(c,d,e,a,b, 3);
- R0(b,c,d,e,a, 4); R0(a,b,c,d,e, 5); R0(e,a,b,c,d, 6); R0(d,e,a,b,c, 7);
- R0(c,d,e,a,b, 8); R0(b,c,d,e,a, 9); R0(a,b,c,d,e,10); R0(e,a,b,c,d,11);
- R0(d,e,a,b,c,12); R0(c,d,e,a,b,13); R0(b,c,d,e,a,14); R0(a,b,c,d,e,15);
- R1(e,a,b,c,d,16); R1(d,e,a,b,c,17); R1(c,d,e,a,b,18); R1(b,c,d,e,a,19);
- R2(a,b,c,d,e,20); R2(e,a,b,c,d,21); R2(d,e,a,b,c,22); R2(c,d,e,a,b,23);
- R2(b,c,d,e,a,24); R2(a,b,c,d,e,25); R2(e,a,b,c,d,26); R2(d,e,a,b,c,27);
- R2(c,d,e,a,b,28); R2(b,c,d,e,a,29); R2(a,b,c,d,e,30); R2(e,a,b,c,d,31);
- R2(d,e,a,b,c,32); R2(c,d,e,a,b,33); R2(b,c,d,e,a,34); R2(a,b,c,d,e,35);
- R2(e,a,b,c,d,36); R2(d,e,a,b,c,37); R2(c,d,e,a,b,38); R2(b,c,d,e,a,39);
- R3(a,b,c,d,e,40); R3(e,a,b,c,d,41); R3(d,e,a,b,c,42); R3(c,d,e,a,b,43);
- R3(b,c,d,e,a,44); R3(a,b,c,d,e,45); R3(e,a,b,c,d,46); R3(d,e,a,b,c,47);
- R3(c,d,e,a,b,48); R3(b,c,d,e,a,49); R3(a,b,c,d,e,50); R3(e,a,b,c,d,51);
- R3(d,e,a,b,c,52); R3(c,d,e,a,b,53); R3(b,c,d,e,a,54); R3(a,b,c,d,e,55);
- R3(e,a,b,c,d,56); R3(d,e,a,b,c,57); R3(c,d,e,a,b,58); R3(b,c,d,e,a,59);
- R4(a,b,c,d,e,60); R4(e,a,b,c,d,61); R4(d,e,a,b,c,62); R4(c,d,e,a,b,63);
- R4(b,c,d,e,a,64); R4(a,b,c,d,e,65); R4(e,a,b,c,d,66); R4(d,e,a,b,c,67);
- R4(c,d,e,a,b,68); R4(b,c,d,e,a,69); R4(a,b,c,d,e,70); R4(e,a,b,c,d,71);
- R4(d,e,a,b,c,72); R4(c,d,e,a,b,73); R4(b,c,d,e,a,74); R4(a,b,c,d,e,75);
- R4(e,a,b,c,d,76); R4(d,e,a,b,c,77); R4(c,d,e,a,b,78); R4(b,c,d,e,a,79);
- /* Add the working vars back into context.state[] */
- state[0] += a;
- state[1] += b;
- state[2] += c;
- state[3] += d;
- state[4] += e;
- /* Wipe variables */
- a = b = c = d = e = 0;
-}
-
-
-/* Initialize new context */
-
-static
-void hash_initial(hash_context* context)
-{
- /* SHA1 initialization constants */
- context->state[0] = 0x67452301;
- context->state[1] = 0xEFCDAB89;
- context->state[2] = 0x98BADCFE;
- context->state[3] = 0x10325476;
- context->state[4] = 0xC3D2E1F0;
- context->count[0] = context->count[1] = 0;
-}
-
-
-/* Run your data through this. */
-static
-void hash_process( hash_context * context, unsigned char * data, unsigned len )
-{
-unsigned int i, j;
-unsigned long blen = ((unsigned long)len)<<3;
-
- j = (context->count[0] >> 3) & 63;
- if ((context->count[0] += blen) < blen ) context->count[1]++;
- context->count[1] += (len >> 29);
- if ((j + len) > 63) {
- memcpy(&context->buffer[j], data, (i = 64-j));
- SHA1Transform(context->state, context->buffer);
- for ( ; i + 63 < len; i += 64) {
- SHA1Transform(context->state, &data[i]);
- }
- j = 0;
- }
- else i = 0;
- memcpy(&context->buffer[j], &data[i], len - i);
}
-
-/* Add padding and return the message digest. */
-
-static
-void hash_final( hash_context* context, unsigned long digest[5] )
-{
-unsigned long i, j;
-unsigned char finalcount[8];
-
- for (i = 0; i < 8; i++) {
- finalcount[i] = (unsigned char)((context->count[(i >= 4 ? 0 : 1)]
- >> ((3-(i & 3)) * 8) ) & 255); /* Endian independent */
- }
- hash_process(context, (unsigned char *)"\200", 1);
- while ((context->count[0] & 504) != 448) {
- hash_process(context, (unsigned char *)"\0", 1);
- }
- hash_process(context, finalcount, 8); /* Should cause a SHA1Transform() */
- for (i = 0; i < 5; i++) {
- digest[i] = context->state[i];
- }
- /* Wipe variables */
- i = j = 0;
- memset(context->buffer, 0, 64);
- memset(context->state, 0, 20);
- memset(context->count, 0, 8);
- memset(&finalcount, 0, 8);
-#ifdef SHA1HANDSOFF /* make SHA1Transform overwrite it's own static vars */
- SHA1Transform(context->state, context->buffer);
+#if 0
+%!test
+%! expected = [
+%! 0xA9 0x99 0x3E 0x36 ...
+%! 0x47 0x06 0x81 0x6A ...
+%! 0xBA 0x3E 0x25 0x71 ...
+%! 0x78 0x50 0xC2 0x6C ...
+%! 0x9C 0xD0 0xD8 0x9D ];
+%! result = SHA1(uint8("abc"));
+%! assert (result, expected)
#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/general-2.0.0/src/bootstrap new/general-2.1.0/src/bootstrap
--- old/general-2.0.0/src/bootstrap 1970-01-01 01:00:00.000000000 +0100
+++ new/general-2.1.0/src/bootstrap 2018-05-13 23:01:51.408133896 +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/general-2.0.0/src/config.h.in new/general-2.1.0/src/config.h.in
--- old/general-2.0.0/src/config.h.in 1970-01-01 01:00:00.000000000 +0100
+++ new/general-2.1.0/src/config.h.in 2018-05-13 23:01:52.076130613 +0200
@@ -0,0 +1,32 @@
+/* config.h.in. Generated from configure.ac by autoheader. */
+
+#include "undef-ah-octave.h"
+
+/* Have nettle */
+#undef HAVE_NETTLE
+
+/* Define to 1 if you have the <octave/interpreter.h> header file. */
+#undef HAVE_OCTAVE_INTERPRETER_H
+
+/* macro for alternative Octave symbols */
+#undef OV_ISMAP
+
+/* 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/general-2.0.0/src/configure.ac new/general-2.1.0/src/configure.ac
--- old/general-2.0.0/src/configure.ac 1970-01-01 01:00:00.000000000 +0100
+++ new/general-2.1.0/src/configure.ac 2018-05-13 23:01:51.408133896 +0200
@@ -0,0 +1,110 @@
+# -*- Autoconf -*-
+# Process this file with autoconf to produce a configure script.
+#
+### Copyright (C) 2015-2017 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.67])
+AC_INIT([general], [2.1.0])
+AC_CONFIG_SRCDIR([packfields.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_PROG_AWK
+if test -z "$ac_cv_prog_AWK"; then
+AC_MSG_ERROR([AWK not found], 1);
+fi
+
+AC_PROG_GREP
+
+# 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
+
+# Checks for libraries.
+PKG_CHECK_MODULES([NETTLE],[nettle],
+ [AC_DEFINE([HAVE_NETTLE],[1], [Have nettle])],
+ [AC_MSG_WARN([Nettle not found, SHA1 disabled])]
+)
+
+# Checks for typedefs, structures, and compiler characteristics.
+
+# Checks for library functions.
+
+# 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
+ [is_map],
+ [isstruct],
+ [[octave_value ().isstruct ();]],
+ [OV_ISMAP],
+ [],
+ []
+]
+
+],
+ [oct-alt-includes.h])
+
+AC_CHECK_HEADERS([octave/interpreter.h],
+ [],
+ [],
+ [#include <octave/oct.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/general-2.0.0/src/m4/octave-forge.m4
new/general-2.1.0/src/m4/octave-forge.m4
--- old/general-2.0.0/src/m4/octave-forge.m4 1970-01-01 01:00:00.000000000
+0100
+++ new/general-2.1.0/src/m4/octave-forge.m4 2018-05-13 23:01:51.408133896
+0200
@@ -0,0 +1,93 @@
+# Copyright (C) 2017 Olaf Till <[email protected]>
+# 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/general-2.0.0/src/packfields.cc new/general-2.1.0/src/packfields.cc
--- old/general-2.0.0/src/packfields.cc 2015-05-27 17:43:57.000000000 +0200
+++ new/general-2.1.0/src/packfields.cc 2018-05-13 23:01:51.408133896 +0200
@@ -1,4 +1,5 @@
// Copyright (C) 2009 VZLU Prague
+// Copyright (C) 2018 John Donoghue <[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
@@ -14,11 +15,23 @@
// this program; if not, see <http://www.gnu.org/licenses/>.
#include <octave/oct.h>
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include <octave/utils.h>
+#ifdef HAVE_OCTAVE_INTERPRETER_H
+# include <octave/interpreter.h>
+#endif
#include <octave/symtab.h>
#include <octave/oct-map.h>
+#ifdef DEFMETHOD_DLD
+DEFMETHOD_DLD (packfields, interp, args, ,
+#else
DEFUN_DLD (packfields, args, ,
+#endif
"-*- texinfo -*-\n\
@deftypefn {Loadable Function} {} packfields (@var{s_name}, @var{var1},
@var{var2}, @dots{})\n\
Create struct from variables.\n\
@@ -44,6 +57,11 @@
if (nargin > 0)
{
+#ifdef DEFMETHOD_DLD
+ octave::symbol_table::scope curr_scope
+ = interp.require_current_scope ("packfields");
+#endif
+
std::string struct_name = args (0).string_value ();
string_vector fld_names(nargin-1);
octave_value_list fld_vals(nargin-1);
@@ -64,7 +82,12 @@
if (valid_identifier (fld_name))
{
fld_names(i) = fld_name;
+
+#ifdef DEFMETHOD_DLD
+ octave_value fld_val = curr_scope.varval (fld_name);
+#else
octave_value fld_val = symbol_table::varval (fld_name);
+#endif
if (fld_val.is_defined ())
fld_vals(i) = fld_val;
else
@@ -76,46 +99,27 @@
if (! error_state)
{
- // Force the symbol to be inserted in caller's scope.
- symbol_table::symbol_record& rec = symbol_table::insert
(struct_name);
-
- octave_value& struct_ref = rec.varref ();
-
- // If not defined, use struct ().
- if (! struct_ref.is_defined ())
- struct_ref = octave_scalar_map ();
-
- if (struct_ref.is_map ())
- {
- // Fast code for a built-in struct.
- octave_scalar_map map = struct_ref.scalar_map_value ();
-
- if (! error_state)
- {
- // Do the actual work.
- struct_ref = octave_value (); // Unshare map.
- for (octave_idx_type i = 0; i < nargin-1; i++)
- map.assign (fld_names(i), fld_vals(i));
- struct_ref = map;
- }
- else
- error ("packfields: structure must have singleton dimensions");
- }
- else
- {
- // General case.
- struct_ref.make_unique ();
- std::list<octave_value_list> idx (1);
-
- for (octave_idx_type i = 0; i < nargin-1; i++)
- {
- idx.front () = args(i+1); // Save one string->octave_value
conversion.
- struct_ref = struct_ref.subsasgn (".", idx, fld_vals (i));
-
- if (error_state)
- break;
- }
- }
+#ifdef DEFMETHOD_DLD
+ octave_value struct_val = curr_scope.varval (struct_name);
+#else
+ octave_value struct_val = symbol_table::varval (struct_name);
+#endif
+
+ octave_scalar_map map;
+
+ if (struct_val.is_defined () && struct_val.OV_ISMAP ())
+ map = struct_val.scalar_map_value ();
+
+ for (octave_idx_type i = 0; i < nargin-1; i++)
+ map.assign (fld_names(i), fld_vals(i));
+
+ struct_val = map;
+
+#ifdef DEFMETHOD_DLD
+ curr_scope.assign (struct_name, struct_val);
+#else
+ symbol_table::assign (struct_name, struct_val);
+#endif
}
}
else
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/general-2.0.0/src/undef-ah-octave.h new/general-2.1.0/src/undef-ah-octave.h
--- old/general-2.0.0/src/undef-ah-octave.h 1970-01-01 01:00:00.000000000
+0100
+++ new/general-2.1.0/src/undef-ah-octave.h 2018-05-13 23:01:51.408133896
+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
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/general-2.0.0/src/unpackfields.cc new/general-2.1.0/src/unpackfields.cc
--- old/general-2.0.0/src/unpackfields.cc 2015-05-27 17:43:57.000000000
+0200
+++ new/general-2.1.0/src/unpackfields.cc 2018-05-13 23:01:51.408133896
+0200
@@ -1,4 +1,5 @@
// Copyright (C) 2009 VZLU Prague
+// Copyright (C) 2018 John Donoghue <[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
@@ -14,11 +15,23 @@
// this program; if not, see <http://www.gnu.org/licenses/>.
#include <octave/oct.h>
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include <octave/utils.h>
+#ifdef HAVE_OCTAVE_INTERPRETER_H
+# include <octave/interpreter.h>
+#endif
#include <octave/symtab.h>
#include <octave/oct-map.h>
+#ifdef DEFMETHOD_DLD
+DEFMETHOD_DLD (unpackfields, interp, args, ,
+#else
DEFUN_DLD (unpackfields, args, ,
+#endif
"-*- texinfo -*-\n\
@deftypefn {Loadable Function} {} unpackfields (@var{s_name}, @var{fld1},
@var{fld2}, @dots{})\n\
Create variables from fields of a struct.\n\
@@ -50,6 +63,11 @@
if (nargin > 0)
{
+#ifdef DEFMETHOD_DLD
+ octave::symbol_table::scope curr_scope
+ = interp.require_current_scope ("unpackfields");
+#endif
+
std::string struct_name = args (0).string_value ();
string_vector fld_names(nargin-1);
@@ -75,9 +93,12 @@
if (! error_state)
{
// Force the symbol to be inserted in caller's scope.
+#ifdef DEFMETHOD_DLD
+ octave_value struct_val = curr_scope.varval (struct_name);
+#else
octave_value struct_val = symbol_table::varval (struct_name);
-
- if (struct_val.is_map ())
+#endif
+ if (struct_val.OV_ISMAP ())
{
// Fast code for a built-in struct.
const octave_scalar_map map = struct_val.scalar_map_value ();
@@ -89,7 +110,11 @@
{
octave_scalar_map::const_iterator iter = map.seek
(fld_names(i));
if (iter != map.end ())
+#ifdef DEFMETHOD_DLD
+ curr_scope.assign (fld_names(i), map.contents (iter));
+#else
symbol_table::assign (fld_names(i), map.contents
(iter));
+#endif
else
{
error ("unpackfields: field %s does not exist",
fld_names(i).c_str ());
@@ -114,7 +139,11 @@
break;
if (val.is_defined ())
+#ifdef DEFMETHOD_DLD
+ curr_scope.assign (fld_names(i), val);
+#else
symbol_table::assign (fld_names(i), val);
+#endif
}
}
}