OSSP CVS Repository

ossp - Check-in [2110]
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Patchset]  [Tagging/Branching

Check-in Number: 2110
Date: 2002-Apr-28 15:22:49 (local)
2002-Apr-28 13:22:49 (UTC)
User:rse
Branch:
Comment: Add first cut of OSSP ui64, a new (sub-)library which allows us to perform 64-bit unsigned integer arithmetic in a portable way without requiring the machine to support C99's 64-bit type "unsigned long long". Basically a ui64_t is an 8 byte array of "unsigned char" elements and hence the library internally stores 64-bit values as 8 digits to the base 2^8 and also performs the mathematical operations this way.
Tickets:
Inspections:
Files:
ossp-pkg/ui64/Makefile.in      added-> 1.1
ossp-pkg/ui64/README      added-> 1.1
ossp-pkg/ui64/TODO      added-> 1.1
ossp-pkg/ui64/VERSION      added-> 1.1
ossp-pkg/ui64/aclocal.m4      added-> 1.1
ossp-pkg/ui64/configure.ac      added-> 1.1
ossp-pkg/ui64/devtool      added-> 1.1
ossp-pkg/ui64/devtool.conf      added-> 1.1
ossp-pkg/ui64/devtool.func      added-> 1.1
ossp-pkg/ui64/ts.c      added-> 1.1
ossp-pkg/ui64/ts.h      added-> 1.1
ossp-pkg/ui64/ui64-config.in      added-> 1.1
ossp-pkg/ui64/ui64.c      added-> 1.1
ossp-pkg/ui64/ui64.h      added-> 1.1
ossp-pkg/ui64/ui64.pod      added-> 1.1
ossp-pkg/ui64/ui64_test.c      added-> 1.1

ossp-pkg/ui64/Makefile.in -> 1.1

*** /dev/null    Mon Apr 29 04:37:12 2024
--- -    Mon Apr 29 04:41:41 2024
***************
*** 0 ****
--- 1,132 ----
+ ##
+ ##  OSSP ui64 - 64-Bit Arithmetic
+ ##  Copyright (c) 2002 Ralf S. Engelschall <rse@engelschall.com>
+ ##  Copyright (c) 2002 The OSSP Project <http://www.ossp.org/>
+ ##  Copyright (c) 2002 Cable & Wireless Deutschland <http://www.cw.com/de/>
+ ##
+ ##  This file is part of OSSP ui64, a 64-bit arithmetic library
+ ##  which can be found at http://www.ossp.org/pkg/lib/ui64/.
+ ##
+ ##  Permission to use, copy, modify, and distribute this software for
+ ##  any purpose with or without fee is hereby granted, provided that
+ ##  the above copyright notice and this permission notice appear in all
+ ##  copies.
+ ##
+ ##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ ##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ ##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ ##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
+ ##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ ##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ ##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ ##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ ##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ ##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ ##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ ##  SUCH DAMAGE.
+ ##
+ ##  Makefile.in: make(1) build procedure
+ ##
+ 
+ @SET_MAKE@
+ 
+ DESTDIR     =
+ prefix      = @prefix@
+ exec_prefix = @exec_prefix@
+ bindir      = @bindir@
+ libdir      = @libdir@
+ includedir  = @includedir@
+ mandir      = @mandir@
+ 
+ CC          = @CC@
+ CPPFLAGS    = @CPPFLAGS@
+ CFLAGS      = @DEFS@ @CFLAGS@
+ LDFLAGS     = @LDFLAGS@
+ LIBS        = @LIBS@
+ RM          = rm -f
+ RMDIR       = rmdir
+ SHTOOL      = ./shtool
+ LIBTOOL     = ./libtool
+ TRUE        = true
+ POD2MAN     = pod2man
+ 
+ LIB_NAME    = libui64.la
+ LIB_OBJS    = ui64.lo
+ 
+ TST_NAME    = ui64_test
+ TST_OBJS    = ui64_test.o ts.o
+ 
+ .SUFFIXES:
+ .SUFFIXES: .c .o .lo
+ 
+ all: $(LIB_NAME) $(TST_NAME)
+ 
+ .c.o:
+        $(CC) $(CPPFLAGS) $(CFLAGS) -c $<
+ 
+ .c.lo:
+        @$(LIBTOOL) --mode=compile $(CC) $(CPPFLAGS) $(CFLAGS) -c $<
+ 
+ $(LIB_OBJS): Makefile
+ $(TST_OBJS): Makefile
+ 
+ $(LIB_NAME): $(LIB_OBJS)
+        @$(LIBTOOL) --mode=link $(CC) -o $(LIB_NAME) $(LIB_OBJS) -rpath $(libdir) \
+            -version-info `$(SHTOOL) version -l txt -d libtool VERSION`
+ 
+ $(TST_NAME): $(TST_OBJS) $(LIB_NAME)
+        @$(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o $(TST_NAME) $(TST_OBJS) $(LIB_NAME) $(LIBS)
+ 
+ man: ui64.3
+ ui64.3: ui64.pod
+        V1=`$(SHTOOL) version -l txt -d short VERSION`; \
+        V2=`$(SHTOOL) version -l txt -d long VERSION`; \
+        D=`$(SHTOOL) version -l txt -d long VERSION | sed -e 's;.*(;;' -e 's;).*;;'`; \
+        $(POD2MAN) --quotes=none \
+                   --section=3 --center="64-Bit Arithmetic" \
+                   --release="$$D" --date="OSSP ui64 $$V1" ui64.pod | \
+        sed -e "s;UI64_VERSION_STR;$$V2;" >ui64.3
+ 
+ check: $(TST_NAME)
+        @$(LIBTOOL) --mode=execute ./$(TST_NAME)
+ 
+ install:
+        $(SHTOOL) mkdir -f -p -m 755 $(DESTDIR)$(prefix)
+        $(SHTOOL) mkdir -f -p -m 755 $(DESTDIR)$(bindir)
+        $(SHTOOL) mkdir -f -p -m 755 $(DESTDIR)$(includedir)
+        $(SHTOOL) mkdir -f -p -m 755 $(DESTDIR)$(libdir)
+        $(SHTOOL) mkdir -f -p -m 755 $(DESTDIR)$(mandir)/man3
+        $(SHTOOL) install -c -m 755 ui64-config $(DESTDIR)$(bindir)/
+        $(SHTOOL) install -c -m 644 ui64.h $(DESTDIR)$(includedir)/
+        $(SHTOOL) install -c -m 644 ui64.3 $(DESTDIR)$(mandir)/man3/
+        @$(LIBTOOL) --mode=install $(SHTOOL) install -c -m 644 libui64.la $(DESTDIR)$(libdir)/
+ 
+ uninstall:
+        @$(LIBTOOL) --mode=uninstall $(RM) $(DESTDIR)$(libdir)/libui64.la
+        -$(RM) $(DESTDIR)$(mandir)/man3/ui64.3
+        -$(RM) $(DESTDIR)$(includedir)/ui64.h
+        -$(RM) $(DESTDIR)$(bindir)/ui64-config
+        -$(RMDIR) $(DESTDIR)$(mandir)/man3 >/dev/null 2>&1 || $(TRUE)
+        -$(RMDIR) $(DESTDIR)$(mandir) >/dev/null 2>&1 || $(TRUE)
+        -$(RMDIR) $(DESTDIR)$(libdir) >/dev/null 2>&1 || $(TRUE)
+        -$(RMDIR) $(DESTDIR)$(includedir) >/dev/null 2>&1 || $(TRUE)
+        -$(RMDIR) $(DESTDIR)$(bindir) >/dev/null 2>&1 || $(TRUE)
+        -$(RMDIR) $(DESTDIR)$(prefix) >/dev/null 2>&1 || $(TRUE)
+ 
+ clean:
+        -$(RM) $(LIB_NAME) $(LIB_OBJS)
+        -$(RM) $(TST_NAME) $(TST_OBJS)
+        -$(RM) -r .libs >/dev/null 2>&1 || $(TRUE)
+        -$(RM) *.o *.lo
+ 
+ distclean: clean
+        -$(RM) config.log config.status config.cache
+        -$(RM) Makefile config.h ui64-config
+        -$(RM) libtool
+ 
+ realclean: distclean
+        -$(RM) ui64.3
+        -$(RM) configure config.h.in
+        -$(RM) shtool
+        -$(RM) ltmain.sh libtool.m4 config.guess config.sub
+ 


ossp-pkg/ui64/README -> 1.1

*** /dev/null    Mon Apr 29 04:37:12 2024
--- -    Mon Apr 29 04:41:41 2024
***************
*** 0 ****
--- 1,47 ----
+          _  __   _  _   
+    _   _(_)/ /_ | || |  
+   | | | | | '_ \| || |_ 
+   | |_| | | (_) |__   _|
+    \__,_|_|\___/   |_|  
+                       
+   OSSP ui64 - 64-Bit Aithmetic
+   Version 0.1.0 (28-Apr-2002)
+ 
+   ABSTRACT
+ 
+   OSSP ui64 is ...
+ 
+   COPYRIGHT AND LICENSE
+ 
+   Copyright (c) 2002 Ralf S. Engelschall <rse@engelschall.com>
+   Copyright (c) 2002 The OSSP Project <http://www.ossp.org/>
+   Copyright (c) 2002 Cable & Wireless Deutschland <http://www.cw.com/de/>
+ 
+   This file is part of OSSP ui64, a 64-bit arithmetic which
+   can be found at http://www.ossp.org/pkg/lib/ui64/.
+ 
+   Permission to use, copy, modify, and distribute this software for
+   any purpose with or without fee is hereby granted, provided that
+   the above copyright notice and this permission notice appear in all
+   copies.
+ 
+   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+   WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+   MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+   IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
+   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+   USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+   ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+   OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+   OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+   SUCH DAMAGE.
+ 
+   HOME AND DOCUMENTATION
+ 
+   The documentation and latest release can be found on
+ 
+   o http://www.ossp.org/pkg/lib/ui64/
+   o  ftp://ftp.ossp.org/pkg/lib/ui64/
+ 


ossp-pkg/ui64/TODO -> 1.1

*** /dev/null    Mon Apr 29 04:37:12 2024
--- -    Mon Apr 29 04:41:41 2024
***************
*** 0 ****
--- 1,2 ----
+ - autoconf support for unsigned long long
+ - portable import export of 8 bytes?


ossp-pkg/ui64/VERSION -> 1.1

*** /dev/null    Mon Apr 29 04:37:12 2024
--- -    Mon Apr 29 04:41:41 2024
***************
*** 0 ****
--- 1,6 ----
+ 
+   VERSION -- Version Information for OSSP ui64 (syntax: Text)
+   [automatically generated and maintained by GNU shtool]
+ 
+   This is OSSP ui64, Version 0.1.0 (28-Apr-2002)
+ 


ossp-pkg/ui64/aclocal.m4 -> 1.1

*** /dev/null    Mon Apr 29 04:37:12 2024
--- -    Mon Apr 29 04:41:41 2024
***************
*** 0 ****
--- 1,117 ----
+ dnl ##
+ dnl ##  OSSP ui64 - 64-Bit Arithmetic
+ dnl ##  Copyright (c) 2002 Ralf S. Engelschall <rse@engelschall.com>
+ dnl ##  Copyright (c) 2002 The OSSP Project <http://www.ossp.org/>
+ dnl ##  Copyright (c) 2002 Cable & Wireless Deutschland <http://www.cw.com/de/>
+ dnl ##
+ dnl ##  This file is part of OSSP ui64, a 64-bit arithmetic library
+ dnl ##  which can be found at http://www.ossp.org/pkg/lib/ui64/.
+ dnl ##
+ dnl ##  Permission to use, copy, modify, and distribute this software for
+ dnl ##  any purpose with or without fee is hereby granted, provided that
+ dnl ##  the above copyright notice and this permission notice appear in all
+ dnl ##  copies.
+ dnl ##
+ dnl ##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ dnl ##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ dnl ##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ dnl ##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
+ dnl ##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ dnl ##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ dnl ##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ dnl ##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ dnl ##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ dnl ##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ dnl ##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ dnl ##  SUCH DAMAGE.
+ dnl ##
+ dnl ##  aclocal.m4: GNU Autoconf local macro definitions
+ dnl ##
+ 
+ dnl ##
+ dnl ##  Check whether compiler option works
+ dnl ##
+ dnl ##  configure.in:
+ dnl ##    AC_COMPILER_OPTION(<name>, <display>, <option>,
+ dnl ##                       <action-success>, <action-failure>)
+ dnl ##
+ 
+ AC_DEFUN(AC_COMPILER_OPTION,[dnl
+ AC_MSG_CHECKING(whether compiler option(s) $2 work)
+ AC_CACHE_VAL(ac_cv_compiler_option_$1,[
+ SAVE_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS $3"
+ AC_TRY_COMPILE([],[], ac_cv_compiler_option_$1=yes, ac_cv_compiler_option_$1=no)
+ CFLAGS="$SAVE_CFLAGS"
+ ])dnl
+ if test ".$ac_cv_compiler_option_$1" = .yes; then
+     ifelse([$4], , :, [$4])
+ else
+     ifelse([$5], , :, [$5])
+ fi
+ AC_MSG_RESULT([$ac_cv_compiler_option_$1])
+ ])dnl
+ 
+ dnl ##
+ dnl ##  Debugging Support
+ dnl ##
+ dnl ##  configure.in:
+ dnl ##    AC_CHECK_DEBUGGING
+ dnl ##
+ 
+ AC_DEFUN(AC_CHECK_DEBUGGING,[dnl
+ AC_ARG_ENABLE(debug,dnl
+ [  --enable-debug          build for debugging (default=no)],
+ [dnl
+ if test ".$ac_cv_prog_gcc" = ".yes"; then
+     case "$CFLAGS" in
+         *-O* ) ;;
+            * ) CFLAGS="$CFLAGS -O2" ;;
+     esac
+     case "$CFLAGS" in
+         *-g* ) ;;
+            * ) CFLAGS="$CFLAGS -g" ;;
+     esac
+     case "$CFLAGS" in
+         *-pipe* ) ;;
+               * ) AC_COMPILER_OPTION(pipe, -pipe, -pipe, CFLAGS="$CFLAGS -pipe") ;;
+     esac
+     AC_COMPILER_OPTION(defdbg, -DDEBUG, -DDEBUG, CFLAGS="$CFLAGS -DDEBUG")
+     AC_COMPILER_OPTION(ggdb3, -ggdb3, -ggdb3, CFLAGS="$CFLAGS -ggdb3")
+     CFLAGS="$CFLAGS -pedantic"
+     CFLAGS="$CFLAGS -Wall"
+     WMORE="-Wshadow -Wpointer-arith -Wcast-align -Winline"
+     WMORE="$WMORE -Wmissing-prototypes -Wmissing-declarations -Wnested-externs"
+     AC_COMPILER_OPTION(wmore, -W<xxx>, $WMORE, CFLAGS="$CFLAGS $WMORE")
+     AC_COMPILER_OPTION(wnolonglong, -Wno-long-long, -Wno-long-long, CFLAGS="$CFLAGS -Wno-long-long")
+ else
+     case "$CFLAGS" in
+         *-g* ) ;;
+            * ) CFLAGS="$CFLAGS -g" ;;
+     esac
+ fi
+ msg="enabled"
+ ],[
+ if test ".$ac_cv_prog_gcc" = ".yes"; then
+ case "$CFLAGS" in
+     *-pipe* ) ;;
+           * ) AC_COMPILER_OPTION(pipe, -pipe, -pipe, CFLAGS="$CFLAGS -pipe") ;;
+ esac
+ fi
+ case "$CFLAGS" in
+     *-g* ) CFLAGS=`echo "$CFLAGS" |\
+                    sed -e 's/ -g / /g' -e 's/ -g$//' -e 's/^-g //g' -e 's/^-g$//'` ;;
+ esac
+ case "$CXXFLAGS" in
+     *-g* ) CXXFLAGS=`echo "$CXXFLAGS" |\
+                      sed -e 's/ -g / /g' -e 's/ -g$//' -e 's/^-g //g' -e 's/^-g$//'` ;;
+ esac
+ msg=disabled
+ ])dnl
+ AC_MSG_CHECKING(for compilation debug mode)
+ AC_MSG_RESULT([$msg])
+ if test ".$msg" = .enabled; then
+     enable_shared=no
+ fi
+ ])
+ 


ossp-pkg/ui64/configure.ac -> 1.1

*** /dev/null    Mon Apr 29 04:37:12 2024
--- -    Mon Apr 29 04:41:41 2024
***************
*** 0 ****
--- 1,48 ----
+ dnl ##
+ dnl ##  OSSP ui64 - 64-Bit Arithmetic
+ dnl ##  Copyright (c) 2002 Ralf S. Engelschall <rse@engelschall.com>
+ dnl ##  Copyright (c) 2002 The OSSP Project <http://www.ossp.org/>
+ dnl ##  Copyright (c) 2002 Cable & Wireless Deutschland <http://www.cw.com/de/>
+ dnl ##
+ dnl ##  This file is part of OSSP ui64, a 64-bit arithmetic library
+ dnl ##  which can be found at http://www.ossp.org/pkg/lib/ui64/.
+ dnl ##
+ dnl ##  Permission to use, copy, modify, and distribute this software for
+ dnl ##  any purpose with or without fee is hereby granted, provided that
+ dnl ##  the above copyright notice and this permission notice appear in all
+ dnl ##  copies.
+ dnl ##
+ dnl ##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ dnl ##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ dnl ##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ dnl ##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
+ dnl ##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ dnl ##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ dnl ##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ dnl ##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ dnl ##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ dnl ##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ dnl ##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ dnl ##  SUCH DAMAGE.
+ dnl ##
+ dnl ##  configure.ac: GNU Autoconf source script
+ dnl ##
+ 
+ AC_PREREQ(2.53)
+ AC_INIT
+ UI64_VERSION_STR=`./shtool version -l txt -d long VERSION`
+ ./shtool echo -e "Configuring %BOSSP ui64%b (64-Bit Arithmetic), version %B${UI64_VERSION_STR}%b"
+ AC_SUBST(UI64_VERSION_STR)
+ AC_CONFIG_SRCDIR(ui64.h)
+ 
+ AC_PROG_MAKE_SET
+ AC_PROG_CC
+ AC_CHECK_DEBUGGING
+ sinclude(libtool.m4)
+ AC_PROG_LIBTOOL
+ 
+ AC_CONFIG_HEADERS(config.h)
+ AC_CONFIG_FILES([Makefile ui64-config])
+ AC_CONFIG_COMMANDS([adjustment], [chmod a+x ui64-config])
+ AC_OUTPUT
+ 


ossp-pkg/ui64/devtool -> 1.1

*** /dev/null    Mon Apr 29 04:37:12 2024
--- -    Mon Apr 29 04:41:41 2024
***************
*** 0 ****
--- 1,47 ----
+ #!/bin/sh
+ ##
+ ##  devtool -- Development Tool
+ ##  Copyright (c) 2001 Ralf S. Engelschall <rse@engelschall.com> 
+ ##
+ 
+ if [ $# -eq 0 ]; then
+     echo "devtool:USAGE: devtool <command> [<arg> ...]" 1>&2
+     exit 1
+ fi
+ 
+ cmd="$1"
+ shift
+ 
+ devtoolfunc="./devtool.func"
+ 
+ if [ ! -f devtool.conf ]; then
+     echo "devtool:ERROR: no devtool.conf in current directory" 1>&2
+     exit 1
+ fi
+ 
+ cmdline=`grep "^%$cmd" devtool.conf`
+ if [ ".$cmdline" = . ]; then
+     echo "devtool:ERROR: command $cmd not found in devtool.conf" 1>&2
+     exit 1
+ fi
+ 
+ if [ ".$TMPDIR" != . ]; then
+     tmpdir="$TMPDIR"
+ elif [ ".$TEMPDIR" != . ]; then
+     tmpdir="$TEMPDIR"
+ else
+     tmpdir="/tmp"
+ fi
+ tmpfile="$tmpdir/rc.$$.tmp"
+ 
+ rm -f $tmpfile
+ touch $tmpfile
+ echo ". $devtoolfunc" >>$tmpfile
+ ( sed <devtool.conf -e "1,/^%common/d" -e '/^%.*/,$d'
+   sed <devtool.conf -e "1,/^%$cmd/d" -e '/^%.*/,$d' ) |\
+ sed -e 's;\([  ]\)@\([a-zA-Z_][a-zA-Z0-9_]*\);\1devtool_\2;' >>$tmpfile
+ 
+ sh $tmpfile "$@"
+ 
+ rm -f $tmpfile >/dev/null 2>&1 || true
+ 


ossp-pkg/ui64/devtool.conf -> 1.1

*** /dev/null    Mon Apr 29 04:37:12 2024
--- -    Mon Apr 29 04:41:41 2024
***************
*** 0 ****
--- 1,51 ----
+ ##
+ ##  devtool.conf -- Development Tool Configuration
+ ##
+ 
+ %autogen
+     @autogen shtool   1.6.0 "1.6.*" all
+     @autogen libtool  1.4.2 "1.4*"
+     @autogen autoconf 2.53  "2.5[3-9]*"
+ 
+ %autoclean
+     @autoclean shtool
+     @autoclean libtool
+     @autoclean autoconf
+ 
+ %configure
+     ./configure \
+         --prefix=/tmp/ui64 \
+         --disable-shared \
+         --enable-debug \
+         "$@"
+ 
+ %version
+     ./shtool version -l txt -n "OSSP ui64" -e VERSION
+     V=`./shtool version -l txt -d long VERSION`
+     sed -e "s/Version .*(.*)/Version $V/g" <README >README.n 
+     mv README.n README
+ 
+ %dist
+     echo "+++ generating"
+     ./devtool autoclean
+     ./devtool autogen
+     echo "+++ configuring"
+     ./configure
+     echo "+++ building"
+     make clean all man
+     echo "+++ cleaning"
+     make distclean
+     echo "+++ fixing"
+     ./shtool fixperm -v .
+     echo "+++ rolling"
+     V=`./shtool version -l txt -d short VERSION`
+     ./shtool tarball -o ui64-${V}.tar.gz -d ui64-${V} -u ossp -g ossp \
+                      -e 'CVS,\.cvsignore,\.[ao],^\.,devtool*,*.tar.gz,00TODO' -c 'gzip --best' .
+     ls -l ui64-${V}.tar.gz
+     echo "+++ testing"
+     gunzip <ui64-${V}.tar.gz | tar tvf -
+ 
+ %release
+     echo "+++ copying to ftp://ftp.ossp.org/pkg/lib/ui64/"
+     scp ui64-*.tar.gz master.ossp.org:/e/ossp/ftp/pkg/lib/ui64/
+ 


ossp-pkg/ui64/devtool.func -> 1.1

*** /dev/null    Mon Apr 29 04:37:12 2024
--- -    Mon Apr 29 04:41:41 2024
***************
*** 0 ****
--- 1,73 ----
+ ##
+ ##  devtool.func -- Development Tool Functions
+ ##  Copyright (c) 2001-2002 Ralf S. Engelschall <rse@engelschall.com> 
+ ##
+ 
+ devtool_require () {
+     t="$1"; o="$2"; p="$3"; e="$4"; a="$5"
+     v=`($t $o | head -1 | awk "{ print \\\$$p; }") 2>/dev/null`
+     if [ ".$v" = . ]; then
+         echo "devtool:ERROR: unable to determine version of $t" 1>&2
+         exit 1
+     fi
+     case "$v" in
+         $e )
+             ;;
+         $a )
+             echo "devtool:WARNING: $t version $v still accepted, although expected $e." 1>&2
+             ;;
+         * )
+             echo "devtool:ERROR: $t version $e expected, but found $v." 1>&2
+             exit 1
+             ;;
+     esac
+     echo "$v"
+ }
+ 
+ devtool_autogen () {
+     tool=$1
+     shift
+     case $tool in
+         autoconf )
+             autoconf_version=`devtool_require autoconf --version 4 "$1" "$2"`
+             echo "generating (GNU Autoconf $autoconf_version): configure config.h.in"
+             autoconf
+             autoheader 2>&1 | grep -v "is unchanged"
+             rm -rf autom4te.cache >/dev/null 2>&1
+             ;;
+         libtool )
+             libtoolize_version=`devtool_require libtoolize --version 4 "$1" "$2"`
+             echo "generating (GNU Libtool $libtoolize_version): ltmain.sh, libtool.m4, config.guess, config.sub"
+             libtoolize --force --copy >/dev/null 2>&1
+             cp `libtoolize --force --copy --dry-run | grep "add the contents of" |\
+                 sed -e 's;^[^\`]*\`;;' -e "s;'.*;;"` libtool.m4
+             ;;
+         shtool )
+             shtoolize_version=`devtool_require shtoolize -v 3 "$1" "$2"`
+             echo "generating (GNU Shtool $shtoolize_version): shtool"
+             shift
+             shift
+             shtoolize -q "$@"
+             ;;
+     esac
+ }
+ 
+ devtool_autoclean () {
+     tool=$1
+     shift
+     case $tool in
+         autoconf )
+             echo "removing: configure config.h.in"
+             rm -f configure config.h.in
+             ;;
+         libtool )
+             echo "removing: ltmain.sh libtool.m4 config.guess config.sub"
+             rm -f ltmain.sh libtool.m4 config.guess config.sub
+             ;;
+         shtool )
+             echo "removing: shtool"
+             rm -f shtool
+             ;;
+     esac
+ }
+ 


ossp-pkg/ui64/ts.c -> 1.1

*** /dev/null    Mon Apr 29 04:37:12 2024
--- -    Mon Apr 29 04:41:41 2024
***************
*** 0 ****
--- 1,468 ----
+ /*
+ **  TS - OSSP Test Suite Library
+ **  Copyright (c) 2001-2002 Ralf S. Engelschall <rse@engelschall.com>
+ **  Copyright (c) 2001-2002 The OSSP Project <http://www.ossp.org/>
+ **  Copyright (c) 2001-2002 Cable & Wireless Deutschland <http://www.cw.com/de/>
+ **
+ **  This file is part of OSSP TS, a small test suite library which
+ **  can be found at http://www.ossp.org/pkg/ts/.
+ **
+ **  Permission to use, copy, modify, and distribute this software for
+ **  any purpose with or without fee is hereby granted, provided that
+ **  the above copyright notice and this permission notice appear in all
+ **  copies.
+ **
+ **  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ **  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ **  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ **  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
+ **  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ **  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ **  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ **  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ **  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ **  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ **  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ **  SUCH DAMAGE.
+ **
+ **  ts.c: test suite library
+ */
+ 
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
+ #include <stdarg.h>
+ 
+ #include "config.h"
+ #if defined(HAVE_DMALLOC_H) && defined(WITH_DMALLOC)
+ #include "dmalloc.h"
+ #endif
+ 
+ #include "ts.h"
+ 
+ /* embedded ring data structure library */
+ #define RING_ENTRY(elem) \
+     struct { elem *next; elem *prev; }
+ #define RING_HEAD(elem) \
+     struct { elem *next; elem *prev; }
+ #define RING_SENTINEL(hp, elem, link) \
+     (elem *)((char *)(hp) - ((size_t)(&((elem *)0)->link)))
+ #define RING_FIRST(hp) \
+     (hp)->next
+ #define RING_LAST(hp) \
+     (hp)->prev
+ #define RING_NEXT(ep, link) \
+     (ep)->link.next
+ #define RING_PREV(ep, link) \
+     (ep)->link.prev
+ #define RING_INIT(hp, elem, link) \
+     do { RING_FIRST((hp)) = RING_SENTINEL((hp), elem, link); \
+          RING_LAST((hp))  = RING_SENTINEL((hp), elem, link); } while (0)
+ #define RING_EMPTY(hp, elem, link) \
+     (RING_FIRST((hp)) == RING_SENTINEL((hp), elem, link))
+ #define RING_ELEM_INIT(ep, link) \
+     do { RING_NEXT((ep), link) = (ep); \
+          RING_PREV((ep), link) = (ep); } while (0)
+ #define RING_SPLICE_BEFORE(lep, ep1, epN, link) \
+     do { RING_NEXT((epN), link) = (lep); \
+          RING_PREV((ep1), link) = RING_PREV((lep), link); \
+          RING_NEXT(RING_PREV((lep), link), link) = (ep1); \
+          RING_PREV((lep), link) = (epN); } while (0)
+ #define RING_SPLICE_TAIL(hp, ep1, epN, elem, link) \
+     RING_SPLICE_BEFORE(RING_SENTINEL((hp), elem, link), (ep1), (epN), link)
+ #define RING_INSERT_TAIL(hp, nep, elem, link) \
+     RING_SPLICE_TAIL((hp), (nep), (nep), elem, link)
+ #define RING_FOREACH(ep, hp, elem, link) \
+     for ((ep)  = RING_FIRST((hp)); \
+          (ep) != RING_SENTINEL((hp), elem, link); \
+          (ep)  = RING_NEXT((ep), link))
+ 
+ /* test suite test log */
+ struct tstl_st;
+ typedef struct tstl_st tstl_t;
+ struct tstl_st {
+     RING_ENTRY(tstl_t) next;
+     char              *text;
+     const char        *file;
+     int                line;
+ };
+ 
+ /* test suite test check */
+ struct tstc_st;
+ typedef struct tstc_st tstc_t;
+ struct tstc_st {
+     RING_ENTRY(tstc_t) next;
+     char              *title;
+     int                failed;
+     const char        *file;
+     int                line;
+     RING_HEAD(tstl_t)  logs;
+ };
+ 
+ /* test suite test */
+ struct ts_test_st {
+     RING_ENTRY(ts_test_t)  next;
+     char              *title;
+     ts_test_cb_t         func;
+     const char        *file;
+     int                line;
+     RING_HEAD(tstc_t)  checks;
+ };
+ 
+ /* test suite */
+ struct ts_suite_st {
+     char              *title;
+     RING_HEAD(ts_test_t)   tests;
+ };
+ 
+ /* minimal output-independent vprintf(3) variant which supports %{c,s,d,%} only */
+ static int ts_suite_mvxprintf(char *buffer, size_t bufsize, const char *format, va_list ap)
+ {
+     /* sufficient integer buffer: <available-bits> x log_10(2) + safety */
+     char ibuf[((sizeof(int)*8)/3)+10]; 
+     char *cp;
+     char c;
+     int d;
+     int n;
+     int bytes;
+ 
+     if (format == NULL || ap == NULL)
+         return -1;
+     bytes = 0;
+     while (*format != '\0') {
+         if (*format == '%') {
+             c = *(format+1);
+             if (c == '%') {
+                 /* expand "%%" */
+                 cp = &c;
+                 n = sizeof(char);
+             }
+             else if (c == 'c') {
+                 /* expand "%c" */
+                 c = (char)va_arg(ap, int);
+                 cp = &c;
+                 n = sizeof(char);
+             }
+             else if (c == 's') {
+                 /* expand "%s" */
+                 if ((cp = (char *)va_arg(ap, char *)) == NULL)
+                     cp = "(null)";
+                 n = strlen(cp);
+             }
+             else if (c == 'd') {
+                 /* expand "%d" */
+                 d = (int)va_arg(ap, int);
+ #ifdef HAVE_SNPRINTF
+                 snprintf(ibuf, sizeof(ibuf), "%d", d); /* explicitly secure */
+ #else
+                 sprintf(ibuf, "%d", d);                /* implicitly secure */
+ #endif
+                 cp = ibuf;
+                 n = strlen(cp);
+             }
+             else {
+                 /* any other "%X" */
+                 cp = (char *)format;
+                 n  = 2;
+             }
+             format += 2;
+         }
+         else {
+             /* plain text */
+             cp = (char *)format;
+             if ((format = strchr(cp, '%')) == NULL)
+                 format = strchr(cp, '\0');
+             n = format - cp;
+         }
+         /* perform output operation */
+         if (buffer != NULL) {
+             if (n > bufsize)
+                 return -1;
+             memcpy(buffer, cp, n);
+             buffer  += n;
+             bufsize -= n;
+         }
+         bytes += n;
+     }
+     /* nul-terminate output */
+     if (buffer != NULL) {
+         if (bufsize == 0)
+             return -1;
+         *buffer = '\0';
+     }
+     return bytes;
+ }
+ 
+ /* minimal vasprintf(3) variant which supports %{c,s,d} only */
+ static char *ts_suite_mvasprintf(const char *format, va_list ap)
+ {
+     char *buffer;
+     int n;
+     va_list ap2;
+ 
+     if (format == NULL || ap == NULL)
+         return NULL;
+     ap2 = ap;
+     if ((n = ts_suite_mvxprintf(NULL, 0, format, ap)) == -1)
+         return NULL;
+     if ((buffer = (char *)malloc(n+1)) == NULL)
+         return NULL;
+     ts_suite_mvxprintf(buffer, n+1, format, ap2);
+     return buffer;
+ }
+ 
+ /* minimal asprintf(3) variant which supports %{c,s,d} only */
+ static char *ts_suite_masprintf(const char *format, ...)
+ {
+     va_list ap;
+     char *cp;
+ 
+     va_start(ap, format);
+     cp = ts_suite_mvasprintf(format, ap);
+     va_end(ap);
+     return cp;
+ }
+ 
+ /* create test suite */
+ ts_suite_t *ts_suite_new(const char *fmt, ...)
+ {
+     ts_suite_t *ts;
+     va_list ap;
+ 
+     if ((ts = (ts_suite_t *)malloc(sizeof(ts_suite_t))) == NULL)
+         return NULL;
+     va_start(ap, fmt);
+     ts->title = ts_suite_mvasprintf(fmt, ap);
+     RING_INIT(&ts->tests, ts_test_t, next);
+     va_end(ap);
+     return ts;
+ }
+ 
+ /* add test case to test suite */
+ void ts_suite_test(ts_suite_t *ts, ts_test_cb_t func, const char *fmt, ...)
+ {
+     ts_test_t *tst;
+     va_list ap;
+ 
+     if (ts == NULL || func == NULL || fmt == NULL)
+         return;
+     if ((tst = (ts_test_t *)malloc(sizeof(ts_test_t))) == NULL)
+         return;
+     RING_ELEM_INIT(tst, next);
+     va_start(ap, fmt);
+     tst->title = ts_suite_mvasprintf(fmt, ap);
+     va_end(ap);
+     tst->func = func;
+     tst->file = NULL;
+     tst->line = 0;
+     RING_INIT(&tst->checks, tstc_t, next);
+     RING_INSERT_TAIL(&ts->tests, tst, ts_test_t, next);
+     return;
+ }
+ 
+ /* run test suite */
+ int ts_suite_run(ts_suite_t *ts)
+ {
+     ts_test_t *tst;
+     tstc_t *tstc;
+     tstl_t *tstl;
+     int total_tests, total_tests_suite_failed;
+     int total_checks, total_checks_failed;
+     int test_checks, test_checks_failed;
+     const char *file;
+     int line;
+     char *cp;
+ 
+     if (ts == NULL)
+         return 0;
+ 
+     /* init total counters */
+     total_tests         = 0;
+     total_tests_suite_failed  = 0;
+     total_checks        = 0;
+     total_checks_failed = 0;
+ 
+     fprintf(stdout, "\n");
+     fprintf(stdout, " Test Suite: %s\n", ts->title);
+     fprintf(stdout, " __________________________________________________________________\n");
+     fprintf(stdout, "\n");
+     fflush(stdout);
+ 
+     /* iterate through all test cases */
+     RING_FOREACH(tst, &ts->tests, ts_test_t, next) {
+         cp = ts_suite_masprintf(" Test: %s ........................................"
+                                 "........................................", tst->title);
+         cp[60] = '\0';
+         fprintf(stdout, "%s", cp);
+         free(cp);
+         fflush(stdout);
+ 
+         /* init test case counters */
+         test_checks        = 0;
+         test_checks_failed = 0;
+ 
+         /* run the test case function */
+         tst->func(tst);
+ 
+         /* iterate through all performed checks to determine status */
+         RING_FOREACH(tstc, &tst->checks, tstc_t, next) {
+             test_checks++;
+             if (tstc->failed)
+                 test_checks_failed++;
+         }
+ 
+         if (test_checks_failed > 0) {
+             /* some checks failed, so do detailed reporting of test case */
+             fprintf(stdout, " FAILED\n");
+             fprintf(stdout, "       Ops, %d/%d checks failed! Detailed report follows:\n",
+                     test_checks_failed, test_checks);
+             RING_FOREACH(tstc, &tst->checks, tstc_t, next) {
+                 file = (tstc->file != NULL ? tstc->file : tst->file);
+                 line = (tstc->line != 0    ? tstc->line : tst->line);
+                 if (file != NULL)
+                     fprintf(stdout, "       Check: %s [%s:%d]\n", tstc->title, file, line);
+                 else
+                     fprintf(stdout, "       Check: %s\n", tstc->title);
+                 RING_FOREACH(tstl, &tstc->logs, tstl_t, next) {
+                     file = (tstl->file != NULL ? tstl->file : file);
+                     line = (tstl->line != 0    ? tstl->line : line);
+                     if (file != NULL)
+                         fprintf(stdout, "              Log: %s [%s:%d]\n", tstl->text, file, line);
+                     else
+                         fprintf(stdout, "              Log: %s\n", tstl->text);
+                 }
+             }
+         }
+         else {
+             /* test case ran successfully */
+             fprintf(stdout, ".... OK\n");
+         }
+         fflush(stdout);
+ 
+         /* accumulate counters */
+         total_checks += test_checks;
+         total_tests++;
+         if (test_checks_failed > 0) {
+             total_checks_failed += test_checks_failed;
+             total_tests_suite_failed++;
+         }
+     }
+ 
+     /* print test suite summary */
+     fprintf(stdout, " __________________________________________________________________\n");
+     fprintf(stdout, "\n");
+     fprintf(stdout, " Test Summary: %d tests (%d ok, %d failed), %d checks (%d ok, %d failed)\n", 
+             total_tests, (total_tests - total_tests_suite_failed), total_tests_suite_failed, 
+             total_checks, (total_checks - total_checks_failed), total_checks_failed); 
+     if (total_tests_suite_failed > 0)
+         fprintf(stdout, " Test Suite: FAILED\n");
+     else
+         fprintf(stdout, " Test Suite: OK\n");
+     fprintf(stdout, "\n");
+     fflush(stdout);
+ 
+     return total_checks_failed;
+ }
+ 
+ /* destroy test suite */
+ void ts_suite_free(ts_suite_t *ts)
+ {
+     ts_test_t *tst;
+     tstc_t *tstc;
+     tstl_t *tstl;
+ 
+     if (ts == NULL)
+         return;
+     RING_FOREACH(tst, &ts->tests, ts_test_t, next) {
+         RING_FOREACH(tstc, &tst->checks, tstc_t, next) {
+             RING_FOREACH(tstl, &tstc->logs, tstl_t, next) {
+                 free(tstl->text);
+             }
+             free(tstc->title);
+             free(tstc);
+         }
+         free(tst->title);
+         free(tst);
+     }
+     free(ts->title);
+     free(ts);
+     return;
+ }
+ 
+ /* annotate test case with file name and line number */
+ ts_test_t *ts_test_ctx(ts_test_t *tst, const char *file, int line)
+ {
+     if (tst != NULL && file != NULL) {
+         tst->file = file;
+         tst->line = line;
+     }
+     return tst;
+ }
+ 
+ /* annotate test case with check */
+ void ts_test_check(ts_test_t *tst, const char *fmt, ...)
+ {
+     tstc_t *tstc;
+     va_list ap;
+ 
+     if (tst == NULL || fmt == NULL)
+         return;
+     if ((tstc = (tstc_t *)malloc(sizeof(tstc_t))) == NULL)
+         return;
+     va_start(ap, fmt);
+     RING_ELEM_INIT(tstc, next);
+     tstc->title = ts_suite_mvasprintf(fmt, ap);
+     tstc->failed = 0;
+     tstc->file = tst->file;
+     tstc->line = tst->line;
+     RING_INIT(&tstc->logs, tstl_t, next);
+     RING_INSERT_TAIL(&tst->checks, tstc, tstc_t, next);
+     va_end(ap);
+     return;
+ }
+ 
+ /* annotate test case with log message and failure */
+ void ts_test_fail(ts_test_t *tst, const char *fmt, ...)
+ {
+     tstc_t *tstc;
+     tstl_t *tstl;
+     va_list ap;
+ 
+     if (tst == NULL || fmt == NULL)
+         return;
+     if ((tstl = (tstl_t *)malloc(sizeof(tstl_t))) == NULL)
+         return;
+     va_start(ap, fmt);
+     tstl->text = ts_suite_mvasprintf(fmt, ap);
+     tstl->file = tst->file;
+     tstl->line = tst->line;
+     RING_ELEM_INIT(tstl, next);
+     tstc = RING_LAST(&tst->checks);
+     RING_INSERT_TAIL(&tstc->logs, tstl, tstl_t, next);
+     tstc->failed = 1;
+     va_end(ap);
+     return;
+ }
+ 
+ /* annotate test case with log message only */
+ void ts_test_log(ts_test_t *tst, const char *fmt, ...)
+ {
+     tstc_t *tstc;
+     tstl_t *tstl;
+     va_list ap;
+ 
+     if (tst == NULL || fmt == NULL)
+         return;
+     if ((tstl = (tstl_t *)malloc(sizeof(tstl_t))) == NULL)
+         return;
+     va_start(ap, fmt);
+     tstl->text = ts_suite_mvasprintf(fmt, ap);
+     tstl->file = tst->file;
+     tstl->line = tst->line;
+     RING_ELEM_INIT(tstl, next);
+     tstc = RING_LAST(&tst->checks);
+     RING_INSERT_TAIL(&tstc->logs, tstl, tstl_t, next);
+     va_end(ap);
+     return;
+ }
+ 


ossp-pkg/ui64/ts.h -> 1.1

*** /dev/null    Mon Apr 29 04:37:12 2024
--- -    Mon Apr 29 04:41:41 2024
***************
*** 0 ****
--- 1,64 ----
+ /*
+ **  TS - OSSP Test Suite Library
+ **  Copyright (c) 2001-2002 Ralf S. Engelschall <rse@engelschall.com>
+ **  Copyright (c) 2001-2002 The OSSP Project <http://www.ossp.org/>
+ **  Copyright (c) 2001-2002 Cable & Wireless Deutschland <http://www.cw.com/de/>
+ **
+ **  This file is part of OSSP TS, a small test suite library which
+ **  can be found at http://www.ossp.org/pkg/ts/.
+ **
+ **  Permission to use, copy, modify, and distribute this software for
+ **  any purpose with or without fee is hereby granted, provided that
+ **  the above copyright notice and this permission notice appear in all
+ **  copies.
+ **
+ **  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ **  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ **  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ **  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
+ **  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ **  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ **  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ **  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ **  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ **  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ **  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ **  SUCH DAMAGE.
+ **
+ **  ts.h: test suite library API
+ */
+ 
+ #ifndef _TS_H_
+ #define _TS_H_
+ 
+ /* test suite object type */
+ struct ts_suite_st;
+ typedef struct ts_suite_st ts_suite_t;
+ 
+ /* test object type */
+ struct ts_test_st;
+ typedef struct ts_test_st ts_test_t;
+ 
+ /* test callback function type */
+ typedef void (*ts_test_cb_t)(ts_test_t *);
+ 
+ /* test suite operations */
+ ts_suite_t *ts_suite_new  (const char *fmt, ...);
+ void        ts_suite_test (ts_suite_t *s, ts_test_cb_t func, const char *fmt, ...);
+ int         ts_suite_run  (ts_suite_t *s);
+ void        ts_suite_free (ts_suite_t *s);
+ 
+ /* test operations */
+ ts_test_t  *ts_test_ctx   (ts_test_t *t, const char *file, int line);
+ void        ts_test_check (ts_test_t *t, const char *fmt, ...);
+ void        ts_test_fail  (ts_test_t *t, const char *fmt, ...);
+ void        ts_test_log   (ts_test_t *t, const char *fmt, ...);
+ 
+ /* test suite short-cut macros */
+ #define TS_TEST(name) \
+     static void name(ts_test_t *_t)
+ #define TS_CTX \
+     ts_test_ctx(_t, __FILE__, __LINE__)
+ 
+ #endif /* _TS_H_ */
+ 


ossp-pkg/ui64/ui64-config.in -> 1.1

*** /dev/null    Mon Apr 29 04:37:12 2024
--- -    Mon Apr 29 04:41:41 2024
***************
*** 0 ****
--- 1,148 ----
+ #!/bin/sh
+ ##
+ ##  OSSP ui64 - 64-Bit Arithmetic
+ ##  Copyright (c) 2002 Ralf S. Engelschall <rse@engelschall.com>
+ ##  Copyright (c) 2002 The OSSP Project <http://www.ossp.org/>
+ ##  Copyright (c) 2002 Cable & Wireless Deutschland <http://www.cw.com/de/>
+ ##
+ ##  This file is part of OSSP ui64, a 64-bit arithmetic library
+ ##  which can be found at http://www.ossp.org/pkg/lib/ui64/.
+ ##
+ ##  Permission to use, copy, modify, and distribute this software for
+ ##  any purpose with or without fee is hereby granted, provided that
+ ##  the above copyright notice and this permission notice appear in all
+ ##  copies.
+ ##
+ ##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ ##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ ##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ ##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
+ ##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ ##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ ##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ ##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ ##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ ##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ ##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ ##  SUCH DAMAGE.
+ ##
+ ##  ui64-config.in: library build utility
+ ##
+ 
+ DIFS=' 
+ '
+ 
+ #   tool
+ tool_name="ui64-config"
+ 
+ #   library version
+ lib_name="OSSP ui64"
+ lib_version="@UI64_VERSION_STR@"
+ 
+ #   build paths
+ prefix="@prefix@"
+ exec_prefix="@exec_prefix@"
+ bindir="@bindir@"
+ libdir="@libdir@"
+ includedir="@includedir@"
+ mandir="@mandir@"
+ datadir="@datadir@"
+ 
+ #   build options
+ cflags="@CFLAGS@"
+ ldflags="@LDFLAGS@"
+ libs="@LIBS@"
+ 
+ #   option defaults
+ help=no
+ version=no
+ 
+ usage="$tool_name"
+ usage="$usage [--help] [--version] [--all]"
+ usage="$usage [--prefix] [--exec-prefix] [--bindir] [--libdir] [--includedir] [--mandir] [--datadir]"
+ usage="$usage [--cflags] [--ldflags] [--libs]"
+ if [ $# -eq 0 ]; then
+     echo "$tool_name:Error: Invalid option" 1>&2
+     echo "$tool_name:Usage: $usage" 1>&2
+     exit 1
+ fi
+ output=''
+ output_extra=''
+ all=no
+ prev=''
+ OIFS="$IFS" IFS="$DIFS"
+ for option
+ do
+     if [ ".$prev" != . ]; then
+         eval "$prev=\$option"
+         prev=''
+         continue
+     fi
+     case "$option" in
+         -*=*) optarg=`echo "$option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
+            *) optarg='' ;;
+     esac
+     case "$option" in
+         --help|-h)
+             echo "Usage: $usage"
+             exit 0
+             ;;
+         --version|-v)
+             echo "$lib_name $lib_version"
+             exit 0
+             ;;
+         --all)
+             all=yes
+             ;;
+         --prefix)
+             output="$output $prefix"
+             ;;
+         --exec-prefix)
+             output="$output $exec_prefix"
+             ;;
+         --bindir)
+             output="$output $bindir"
+             ;;
+         --libdir)
+             output="$output $libdir"
+             ;;
+         --includedir)
+             output="$output $includedir"
+             ;;
+         --mandir)
+             output="$output $mandir"
+             ;;
+         --datadir)
+             output="$output $datadir"
+             ;;
+         --cflags)
+             output="$output -I$includedir"
+             output_extra="$output_extra $cflags"
+             ;;
+         --ldflags)
+             output="$output -L$libdir"
+             output_extra="$output_extra $ldflags"
+             ;;
+         --libs)
+             output="$output -lui64"
+             output_extra="$output_extra $libs"
+             ;;
+         * )
+             echo "$tool_name:Error: Invalid option" 1>&2
+             echo "$tool_name:Usage: $usage" 1>&2
+             exit 1;
+             ;;
+     esac
+ done
+ IFS="$OIFS"
+ if [ ".$prev" != . ]; then
+     echo "$tool_name:Error: missing argument to --`echo $prev | sed 's/_/-/g'`" 1>&2
+     exit 1
+ fi
+ if [ ".$output" != . ]; then
+     if [ ".$all" = .yes ]; then
+         output="$output $output_extra"
+     fi
+     echo $output
+ fi
+ 


ossp-pkg/ui64/ui64.c -> 1.1

*** /dev/null    Mon Apr 29 04:37:12 2024
--- -    Mon Apr 29 04:41:41 2024
***************
*** 0 ****
--- 1,578 ----
+ /*
+ **  OSSP ui64 - 64-Bit Arithmetic
+ **  Copyright (c) 2002 Ralf S. Engelschall <rse@engelschall.com>
+ **  Copyright (c) 2002 The OSSP Project <http://www.ossp.org/>
+ **  Copyright (c) 2002 Cable & Wireless Deutschland <http://www.cw.com/de/>
+ **
+ **  This file is part of OSSP ui64, a 64-bit arithmetic library
+ **  which can be found at http://www.ossp.org/pkg/lib/ui64/.
+ **
+ **  Permission to use, copy, modify, and distribute this software for
+ **  any purpose with or without fee is hereby granted, provided that
+ **  the above copyright notice and this permission notice appear in all
+ **  copies.
+ **
+ **  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ **  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ **  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ **  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
+ **  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ **  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ **  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ **  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ **  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ **  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ **  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ **  SUCH DAMAGE.
+ **
+ **  ui64.c: implementation of 64-bit unsigned integer arithmetic
+ */
+ 
+ #include <string.h>
+ #include <ctype.h>
+ 
+ #include "ui64.h"
+ 
+ #define UI64_BASE   256 /* 2^8 */
+ #define UI64_DIGITS 8   /* 8*8 = 64 bit */
+ #define UIXX_T(n) struct { unsigned char x[n]; }
+ 
+ #define ui64_fill(__x, __n) \
+     do { int __i; \
+       for (__i = 0; __i < UI64_DIGITS; __i++) \
+           (__x).x[__i] = (__n); \
+     } while(0)
+ 
+ /* the value zero */
+ ui64_t ui64_zero(void)
+ {
+     ui64_t z;
+ 
+     ui64_fill(z, 0);
+     return z;
+ }
+ 
+ /* the maximum value */
+ ui64_t ui64_max(void)
+ {
+     ui64_t z;
+ 
+     ui64_fill(z, UI64_BASE-1);
+     return z;
+ }
+ 
+ /* convert ISO-C "unsigned long" into internal format */
+ ui64_t ui64_n2i(unsigned long n)
+ {
+     ui64_t z;
+     int i;
+ 
+     i = 0;
+     do {
+         z.x[i++] = (n % UI64_BASE);
+     } while ((n /= UI64_BASE) > 0 && i < UI64_DIGITS);
+     for ( ; i < UI64_DIGITS; i++)
+         z.x[i] = 0;
+     return z;
+ }
+ 
+ /* convert internal format into ISO-C "unsigned long";
+    truncates if sizeof(unsigned long) is less than 8!) */
+ unsigned long ui64_i2n(ui64_t x)
+ {
+     unsigned long n;
+     int i;
+ 
+     n = 0;
+     i = (int)sizeof(n);
+     if (i > UI64_DIGITS)
+         i = UI64_DIGITS;
+     while (--i >= 0) {
+         n = (n * UI64_BASE) + x.x[i];
+     }
+     return n;
+ }
+ 
+ /* convert string representation of arbitrary base into internal format */
+ ui64_t ui64_s2i(const char *str, char **end, int base)
+ {
+     ui64_t z;
+     const char *cp;
+     int carry;
+     static char map[] = {
+          0,  1,  2,  3,  4,  5,  6,  7,  8,  9,             /* 0...9 */
+         36, 36, 36, 36, 36, 36, 36,                         /* illegal chars */
+         10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, /* A...M */
+         23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, /* N...Z */
+         36, 36, 36, 36, 36, 36,                             /* illegal chars */
+         10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, /* a...m */
+         23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35  /* m...z */
+     };
+     
+     ui64_fill(z, 0);
+     if (str == NULL || (base < 2 || base > 36))
+         return z;
+     cp = str;
+     while (*cp != '\0' && isspace((int)(*cp)))
+         cp++;
+     while (   *cp != '\0' 
+            && isalnum((int)(*cp)) 
+            && map[(int)(*cp)-'0'] < base) {
+         z = ui64_muln(z, base, &carry);
+         if (carry)
+             break;
+         z = ui64_addn(z, map[(int)(*cp)-'0'], &carry);
+         if (carry)
+             break;
+         cp++;
+     }
+     if (end != NULL)
+         *end = (char *)cp;
+     return z;
+ }
+ 
+ /* convert internal format into string representation of arbitrary base */
+ char *ui64_i2s(ui64_t x, char *str, size_t len, int base)
+ {
+     static char map[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
+     char c;
+     int r;
+     int n;
+     int i, j;
+ 
+     if (str == NULL || len < 2 || (base < 2 || base > 36))
+         return NULL;
+     n = ui64_len(x);
+     i = 0;
+        do {
+                x = ui64_divn(x, base, &r);
+                str[i++] = map[r];
+                while (n > 1 && x.x[n-1] == 0)
+                        n--;
+        } while (i < (len-1) && (n > 1 || x.x[0] != 0));
+        str[i] = '\0';
+     for (j = 0; j < --i; j++) {
+         c = str[j];
+         str[j] = str[i];
+         str[i] = c;
+     }
+        return str;
+ }
+ 
+ ui64_t ui64_add(ui64_t x, ui64_t y, ui64_t *ov)
+ {
+     ui64_t z;
+     int carry;
+     int i;
+ 
+     carry = 0;
+     for (i = 0; i < UI64_DIGITS; i++) {
+         carry += (x.x[i] + y.x[i]);
+         z.x[i] = (carry % UI64_BASE);
+         carry /= UI64_BASE;
+     }
+     if (ov != NULL)
+         *ov = ui64_n2i((unsigned long)carry);
+     return z;
+ }
+ 
+ ui64_t ui64_addn(ui64_t x, int y, int *ov)
+ {
+     ui64_t z;
+     int i;
+ 
+     for (i = 0; i < UI64_DIGITS; i++) {
+         y += x.x[i];
+         z.x[i] = (y % UI64_BASE);
+         y /= UI64_BASE;
+     }
+     if (ov != NULL)
+         *ov = y;
+     return z;
+ }
+ 
+ ui64_t ui64_sub(ui64_t x, ui64_t y, ui64_t *ov)
+ {
+     ui64_t z;
+     int borrow;
+     int i;
+     int d;
+ 
+     borrow = 0;
+     for (i = 0; i < UI64_DIGITS; i++) {
+         d = ((x.x[i] + UI64_BASE) - borrow - y.x[i]);
+         z.x[i] = (d % UI64_BASE);
+         borrow = (1 - (d/UI64_BASE));
+     }
+     if (ov != NULL)
+         *ov = ui64_n2i((unsigned long)borrow);
+     return z;
+ }
+ 
+ ui64_t ui64_subn(ui64_t x, int y, int *ov)
+ {
+     ui64_t z;
+     int i;
+     int d;
+ 
+     for (i = 0; i < UI64_DIGITS; i++) {
+         d = (x.x[i] + UI64_BASE) - y;
+         z.x[i] = (d % UI64_BASE);
+         y = (1 - (d/UI64_BASE));
+     }
+     if (ov != NULL)
+         *ov = y;
+     return z;
+ }
+ 
+ /*
+              7 3 2
+          * 9 4 2 8
+          ---------
+            5 8 5 6
+    +     1 4 6 4
+    +   2 9 2 8
+    + 6 5 8 8
+    ---------------
+    = 6 9 0 1 2 9 6
+ */
+ 
+ ui64_t ui64_mul(ui64_t x, ui64_t y, ui64_t *ov)
+ {
+     UIXX_T(UI64_DIGITS+UI64_DIGITS) zx;
+     ui64_t z;
+     int carry;
+     int i, j;
+ 
+     /* clear temporary result buffer */
+     for (i = 0; i < (UI64_DIGITS+UI64_DIGITS); i++)
+         zx.x[i] = 0;
+ 
+     /* perform multiplication operation */
+     for (i = 0; i < UI64_DIGITS; i++) {
+         /* calculate partial product and immediately add to z */
+         carry = 0;
+         for (j = 0; j < UI64_DIGITS; j++) {
+             carry += (x.x[i] * y.x[j]) + zx.x[i+j];
+             zx.x[i+j] = (carry % UI64_BASE);
+             carry /= UI64_BASE;
+         }
+         /* add carry to remaining digits in z */
+         for ( ; j < UI64_DIGITS + UI64_DIGITS - i; j++) {
+             carry += zx.x[i+j];
+             zx.x[i+j] = (carry % UI64_BASE);
+             carry /= UI64_BASE;
+         }
+     }
+ 
+     /* provide result by splitting zx into z and ov */
+     memcpy(z.x, zx.x, UI64_DIGITS);
+     if (ov != NULL)
+         memcpy((*ov).x, &zx.x[UI64_DIGITS], UI64_DIGITS);
+ 
+     return z;
+ }
+ 
+ ui64_t ui64_muln(ui64_t x, int y, int *ov)
+ {
+     ui64_t z;
+     int carry;
+     int i;
+ 
+     carry = 0;
+     for (i = 0; i < UI64_DIGITS; i++) {
+         carry += (x.x[i] * y);
+         z.x[i] = (carry % UI64_BASE);
+         carry /= UI64_BASE;
+     }
+     if (ov != NULL)
+         *ov = carry;
+     return z;
+ }
+ 
+ /*
+   =   2078 [q]
+    0615367 [x] : 296 [y]
+   -0592    [dq]
+   -----
+   = 0233
+    -0000   [dq]
+    -----
+    = 2336
+     -2072  [dq]
+     -----
+     = 2647
+      -2308 [dq]
+      -----
+      = 279 [r]
+  */
+ ui64_t ui64_div(ui64_t x, ui64_t y, ui64_t *ov)
+ {
+     ui64_t q;
+     ui64_t r;
+     int i;
+     int n, m;
+     int ovn;
+     
+     /* determine actual number of involved digits */
+     n = ui64_len(x);
+     m = ui64_len(y);
+ 
+     if (m == 1) {
+         /* simple case #1: reduceable to ui64_divn() */
+         if (y.x[0] == 0) {
+             /* error case: division by zero! */
+             ui64_fill(q, 0);
+             ui64_fill(r, 0);
+         }
+         else {
+             q = ui64_divn(x, y.x[0], &ovn);
+             ui64_fill(r, 0);
+             r.x[0] = (unsigned char)ovn;
+         }
+ 
+     } else if (n < m) {
+         /* simple case #2: everything is in the remainder */
+         ui64_fill(q, 0);
+         r = x;
+ 
+     } else { /* n >= m, m > 1 */
+         /* standard case: x[0..n] / y[0..m] */
+         UIXX_T(UI64_DIGITS+1) rx;
+         UIXX_T(UI64_DIGITS+1) dq;
+         ui64_t t;
+         int km;
+         int k;
+         int qk;
+         unsigned long y2;
+         unsigned long r3;
+         int borrow;
+         int d;
+ 
+         /* rx is x with a leading zero in order to make
+            sure that n > m and not just n >= m */
+         memcpy(rx.x, x.x, UI64_DIGITS);
+         rx.x[UI64_DIGITS] = 0;
+ 
+         for (k = n - m; k >= 0; k--) {
+             /* efficiently compute qk by guessing
+                qk := rx[k+m-2...k+m]/y[m-2...m-1] */
+             km = k + m;
+             y2 = (y.x[m-1]*UI64_BASE) + y.x[m-2];
+             r3 = (rx.x[km]*(UI64_BASE*UI64_BASE)) + 
+                  (rx.x[km-1]*UI64_BASE) + rx.x[km-2];
+             qk = r3 / y2;
+             if (qk >= UI64_BASE)
+                 qk = UI64_BASE - 1;
+ 
+             /* dq := y*qk (post-adjust qk if guessed incorrectly) */
+             t = ui64_muln(y, qk, &ovn);
+             memcpy(dq.x, t.x, UI64_DIGITS);
+             dq.x[m] = (unsigned char)ovn;
+             for (i = m; i > 0; i--)
+                 if (rx.x[i+k] != dq.x[i])
+                     break;
+             if (rx.x[i+k] < dq.x[i]) {
+                 t = ui64_muln(y, --qk, &ovn);
+                 memcpy(dq.x, t.x, UI64_DIGITS);
+                 dq.x[m] = (unsigned char)ovn;
+             }
+ 
+             /* store qk */
+             q.x[k] = (unsigned char)qk;
+ 
+             /* rx := rx - dq*(b^k) */
+             borrow = 0;
+             for (i = 0; i < m+1; i++) {
+                 d = ((rx.x[k+i] + UI64_BASE) - borrow - dq.x[i]);
+                 rx.x[k+i] = (d % UI64_BASE);
+                 borrow = (1 - (d/UI64_BASE));
+             }
+         }
+         memcpy(r.x, rx.x, m);
+ 
+         /* fill out results with leading zeros */
+         for (i = n-m+1; i < UI64_DIGITS; i++)
+             q.x[i] = 0;
+         for (i = m; i < UI64_DIGITS; i++)
+             r.x[i] = 0;
+     }
+ 
+     /* provide results */
+     if (ov != NULL)
+         *ov = r;
+     return q;
+ }
+ 
+ ui64_t ui64_divn(ui64_t x, int y, int *ov)
+ {
+     ui64_t z;
+     unsigned int carry;
+     int i;
+ 
+     carry = 0;
+     for (i = (UI64_DIGITS - 1); i >= 0; i--) {
+         carry = (carry * UI64_BASE) + x.x[i];
+         z.x[i] = (carry / y);
+         carry %= y;
+     }
+     if (ov != NULL)
+         *ov = carry;
+     return z;
+ }
+ 
+ ui64_t ui64_and(ui64_t x, ui64_t y)
+ {
+     ui64_t z;
+     int i;
+ 
+     for (i = 0; i < UI64_DIGITS; i++)
+         z.x[i] = (x.x[i] & y.x[i]);
+     return z;
+ }
+ 
+ ui64_t ui64_or(ui64_t x, ui64_t y)
+ {
+     ui64_t z;
+     int i;
+ 
+     for (i = 0; i < UI64_DIGITS; i++)
+         z.x[i] = (x.x[i] | y.x[i]);
+     return z;
+ }
+ 
+ ui64_t ui64_xor(ui64_t x, ui64_t y)
+ {
+     ui64_t z;
+     int i;
+ 
+     for (i = 0; i < UI64_DIGITS; i++)
+         z.x[i] = ((x.x[i] & ~(y.x[i])) | (~(x.x[i]) & (y.x[i])));
+     return z;
+ }
+ 
+ ui64_t ui64_not(ui64_t x)
+ {
+     ui64_t z;
+     int i;
+ 
+     for (i = 0; i < UI64_DIGITS; i++)
+         z.x[i] = ~(x.x[i]);
+     return z;
+ }
+ 
+ ui64_t ui64_rol(ui64_t x, int s, ui64_t *ov)
+ {
+     UIXX_T(UI64_DIGITS+UI64_DIGITS) zx;
+     ui64_t z;
+        int i;
+     int carry;
+ 
+     if (s <= 0) {
+         /* no shift at all */
+         if (ov != NULL)
+             *ov = ui64_zero();
+         return x;
+     }
+     else if (s > 64) {
+         /* too large shift */
+         if (ov != NULL)
+             *ov = ui64_zero();
+         return ui64_zero();
+     }
+     else if (s == 64) {
+         /* maximum shift */
+         if (ov != NULL)
+             *ov = x;
+         return ui64_zero();
+     }
+     else { /* regular shift */
+         /* shift (logically) left by s/8 bytes */
+         for (i = 0; i < UI64_DIGITS+UI64_DIGITS; i++)
+             zx.x[i] = 0;
+         for (i = 0; i < UI64_DIGITS; i++)
+             zx.x[i+(s/8)] = x.x[i];
+         /* shift (logically) left by remaining s%8 bits */
+         s %= 8;
+         if (s > 0) {
+             carry = 0;
+             for (i = 0; i < UI64_DIGITS+UI64_DIGITS; i++) {
+                 carry += (zx.x[i] * (1 << s));
+                 zx.x[i] = (carry % UI64_BASE);
+                 carry /= UI64_BASE;
+             }
+         }
+         memcpy(z.x, zx.x, UI64_DIGITS);
+         if (ov != NULL)
+             memcpy((*ov).x, &zx.x[UI64_DIGITS], UI64_DIGITS);
+     }
+     return z;
+ }
+ 
+ ui64_t ui64_ror(ui64_t x, int s, ui64_t *ov)
+ {
+     UIXX_T(UI64_DIGITS+UI64_DIGITS) zx;
+     ui64_t z;
+        int i;
+     int carry;
+ 
+     if (s <= 0) {
+         /* no shift at all */
+         if (ov != NULL)
+             *ov = ui64_zero();
+         return x;
+     }
+     else if (s > 64) {
+         /* too large shift */
+         if (ov != NULL)
+             *ov = ui64_zero();
+         return ui64_zero();
+     }
+     else if (s == 64) {
+         /* maximum shift */
+         if (ov != NULL)
+             *ov = x;
+         return ui64_zero();
+     }
+     else { /* regular shift */
+         /* shift (logically) right by s/8 bytes */
+         for (i = 0; i < UI64_DIGITS+UI64_DIGITS; i++)
+             zx.x[i] = 0;
+         for (i = 0; i < UI64_DIGITS; i++)
+             zx.x[UI64_DIGITS+i-(s/8)] = x.x[i];
+         /* shift (logically) right by remaining s%8 bits */
+         s %= 8;
+         if (s > 0) {
+             carry = 0;
+             for (i = (UI64_DIGITS+UI64_DIGITS - 1); i >= 0; i--) {
+                 carry = (carry * UI64_BASE) + zx.x[i];
+                 zx.x[i] = (carry / (1 << s));
+                 carry %= (1 << s);
+             }
+         }
+         memcpy(z.x, &zx.x[UI64_DIGITS], UI64_DIGITS);
+         if (ov != NULL)
+             memcpy((*ov).x, zx.x, UI64_DIGITS);
+     }
+     return z;
+ }
+ 
+ int ui64_cmp(ui64_t x, ui64_t y)
+ {
+     int i;
+ 
+     i = UI64_DIGITS - 1;
+     while (i > 0 && x.x[i] == y.x[i])
+         i--;
+     return (x.x[i] - y.x[i]);
+ }
+ 
+ int ui64_len(ui64_t x)
+ {
+     int i;
+ 
+     for (i = UI64_DIGITS; i > 1 && x.x[i-1] == 0; i--)
+         ;
+     return i;
+ }
+ 


ossp-pkg/ui64/ui64.h -> 1.1

*** /dev/null    Mon Apr 29 04:37:12 2024
--- -    Mon Apr 29 04:41:41 2024
***************
*** 0 ****
--- 1,75 ----
+ /*
+ **  OSSP ui64 - 64-Bit Arithmetic
+ **  Copyright (c) 2002 Ralf S. Engelschall <rse@engelschall.com>
+ **  Copyright (c) 2002 The OSSP Project <http://www.ossp.org/>
+ **  Copyright (c) 2002 Cable & Wireless Deutschland <http://www.cw.com/de/>
+ **
+ **  This file is part of OSSP ui64, a 64-bit arithmetic library
+ **  which can be found at http://www.ossp.org/pkg/lib/ui64/.
+ **
+ **  Permission to use, copy, modify, and distribute this software for
+ **  any purpose with or without fee is hereby granted, provided that
+ **  the above copyright notice and this permission notice appear in all
+ **  copies.
+ **
+ **  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ **  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ **  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ **  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
+ **  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ **  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ **  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ **  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ **  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ **  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ **  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ **  SUCH DAMAGE.
+ **
+ **  ui64.h: API declaration
+ */
+ 
+ #ifndef __UI64_H__
+ #define __UI64_H__
+ 
+ #include <string.h>
+ 
+ typedef struct {
+     unsigned char x[8]; /* x_0, ..., x_7 */
+ } ui64_t;
+ 
+ /* minimum/maximum values */
+ extern ui64_t        ui64_zero (void);
+ extern ui64_t        ui64_max  (void);
+ 
+ /* import and export via ISO-C "unsigned long" */
+ extern ui64_t        ui64_n2i  (unsigned long n);
+ extern unsigned long ui64_i2n  (ui64_t x);
+ 
+ /* import and export via ISO-C string of arbitrary base */
+ extern ui64_t        ui64_s2i  (const char *str, char **end, int base);
+ extern char *        ui64_i2s  (ui64_t x, char *str, size_t len, int base);
+ 
+ /* arithmetical operations */
+ extern ui64_t        ui64_add  (ui64_t x, ui64_t y, ui64_t *ov);
+ extern ui64_t        ui64_addn (ui64_t x, int    y, int    *ov);
+ extern ui64_t        ui64_sub  (ui64_t x, ui64_t y, ui64_t *ov);
+ extern ui64_t        ui64_subn (ui64_t x, int    y, int    *ov);
+ extern ui64_t        ui64_mul  (ui64_t x, ui64_t y, ui64_t *ov);
+ extern ui64_t        ui64_muln (ui64_t x, int    y, int    *ov);
+ extern ui64_t        ui64_div  (ui64_t x, ui64_t y, ui64_t *ov);
+ extern ui64_t        ui64_divn (ui64_t x, int    y, int    *ov);
+ 
+ /* bit operations */
+ extern ui64_t        ui64_and  (ui64_t x, ui64_t y);
+ extern ui64_t        ui64_or   (ui64_t x, ui64_t y);
+ extern ui64_t        ui64_xor  (ui64_t x, ui64_t y);
+ extern ui64_t        ui64_not  (ui64_t x);
+ extern ui64_t        ui64_rol  (ui64_t x, int s, ui64_t *ov);
+ extern ui64_t        ui64_ror  (ui64_t x, int s, ui64_t *ov);
+ 
+ /* other operations */
+ extern int           ui64_len  (ui64_t x);
+ extern int           ui64_cmp  (ui64_t x, ui64_t y);
+ 
+ #endif /* __UI64_H__ */
+ 


ossp-pkg/ui64/ui64.pod -> 1.1

*** /dev/null    Mon Apr 29 04:37:12 2024
--- -    Mon Apr 29 04:41:41 2024
***************
*** 0 ****
--- 1,71 ----
+ ##
+ ##  OSSP ui64 - 64-Bit Arithmetic
+ ##  Copyright (c) 2002 Ralf S. Engelschall <rse@engelschall.com>
+ ##  Copyright (c) 2002 The OSSP Project <http://www.ossp.org/>
+ ##  Copyright (c) 2002 Cable & Wireless Deutschland <http://www.cw.com/de/>
+ ##
+ ##  This file is part of OSSP ui64, a 64-bit arithmetic library
+ ##  which can be found at http://www.ossp.org/pkg/lib/ui64/.
+ ##
+ ##  Permission to use, copy, modify, and distribute this software for
+ ##  any purpose with or without fee is hereby granted, provided that
+ ##  the above copyright notice and this permission notice appear in all
+ ##  copies.
+ ##
+ ##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ ##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ ##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ ##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
+ ##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ ##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ ##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ ##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ ##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ ##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ ##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ ##  SUCH DAMAGE.
+ ##
+ ##  ui64.pod: library manual page
+ ##
+ 
+ =pod
+ 
+ =head1 NAME
+ 
+ B<OSSP ui64> - 64-Bit Arithmetic
+ 
+ =head1 VERSION
+ 
+ B<OSSP ui64 UI64_VERSION_STR>
+ 
+ =head1 SYNOPSIS
+ 
+ ...
+ 
+ =head1 DESCRIPTION
+ 
+ B<OSSP ui64> is a ...
+ 
+ =head2 APPLICATION PROGRAMMER INTERFACE (API)
+ 
+ =head1 EXAMPLE
+ 
+ =head1 SEE ALSO
+ 
+ B<ISO-C> unsigned long long.
+ 
+ =head1 HISTORY
+ 
+ B<OSSP ui64> was invented in April 2002 by Ralf S. Engelschall
+ E<lt>rse@engelschall.comE<gt> for use inside the B<OSSP> project. Its
+ creation was prompted by the requirement to calculate with 64-bit
+ integers inside B<OSSP tai>.
+ 
+ =head1 AUTHORS
+ 
+  Ralf S. Engelschall
+  rse@engelschall.com
+  www.engelschall.com
+ 
+ =cut
+ 


ossp-pkg/ui64/ui64_test.c -> 1.1

*** /dev/null    Mon Apr 29 04:37:12 2024
--- -    Mon Apr 29 04:41:41 2024
***************
*** 0 ****
--- 1,274 ----
+ /*
+ **  OSSP ui64 - 64-Bit Arithmetic
+ **  Copyright (c) 2002 Ralf S. Engelschall <rse@engelschall.com>
+ **  Copyright (c) 2002 The OSSP Project <http://www.ossp.org/>
+ **  Copyright (c) 2002 Cable & Wireless Deutschland <http://www.cw.com/de/>
+ **
+ **  This file is part of OSSP ui64, a 64-bit arithmetic library
+ **  which can be found at http://www.ossp.org/pkg/lib/ui64/.
+ **
+ **  Permission to use, copy, modify, and distribute this software for
+ **  any purpose with or without fee is hereby granted, provided that
+ **  the above copyright notice and this permission notice appear in all
+ **  copies.
+ **
+ **  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ **  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ **  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ **  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
+ **  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ **  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ **  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ **  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ **  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ **  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ **  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ **  SUCH DAMAGE.
+ **
+ **  ui64_test.c: test suite
+ */
+ 
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <time.h>
+ 
+ #include "ts.h"
+ #include "ui64.h"
+ 
+ TS_TEST(test_imex_num)
+ {
+     struct {
+         unsigned int num;
+     } table[] = {
+         { 0           }, /* minimum value */
+         { 255         }, /* 2^8 - 1       */
+         { 256         }, /* 2^8           */
+         { 257         }, /* 2^8 + 1       */
+         { 4294967295U }, /* 2^32 - 1      */
+     };
+     int i;
+     ui64_t x;
+     unsigned long n;
+ 
+     ts_test_check(TS_CTX, "import/export via number");
+     for (i = 0; i < sizeof(table)/sizeof(table[0]); i++) {
+         x = ui64_n2i(table[i].num);
+         n = ui64_i2n(x);
+         if (n != table[i].num) {
+             ts_test_fail(TS_CTX, "input %d, "
+                          "expected output %d, got output %d", 
+                          table[i].num, table[i].num, n);
+         }
+     }
+ }
+ 
+ TS_TEST(test_imex_str)
+ {
+     struct {
+         int   in_base;
+         char *in_str;
+         int   out_base;
+         char *out_str;
+     } table[] = {
+         { 16, "0",                10, "0"                    }, /* minimum value */
+         { 16, "ff",               10, "255"                  }, /* 2^8 - 1       */
+         { 16, "100",              10, "256"                  }, /* 2^8           */
+         { 16, "101",              10, "257"                  }, /* 2^8 + 1       */
+         { 16, "ffffffff",         10, "4294967295"           }, /* 2^32 - 1      */
+         { 16, "100000000",        10, "4294967296"           }, /* 2^32          */
+         { 16, "100000001",        10, "4294967297"           }, /* 2^32 + 1      */
+         { 16, "ffffffffffffffff", 10, "18446744073709551615" }  /* 2^64 - 1      */
+     };
+     int i;
+     ui64_t x;
+     char buf[128];
+     char *cp;
+ 
+     ts_test_check(TS_CTX, "import/export via string");
+     for (i = 0; i < sizeof(table)/sizeof(table[0]); i++) {
+ 
+         /* import/export input */
+         x = ui64_s2i(table[i].in_str, NULL, table[i].in_base);
+         cp = ui64_i2s(x, buf, sizeof(buf), table[i].in_base);
+         if (strcasecmp(table[i].in_str, cp) != 0) {
+             ts_test_fail(TS_CTX, "input \"%s\" (%d), "
+                          "expected output \"%s\" (%d), got output \"%s\" (%d)", 
+                          table[i].in_str, table[i].in_base, 
+                          table[i].in_str, table[i].in_base, 
+                          cp, table[i].in_base);
+         }
+ 
+         /* import/export output */
+         x = ui64_s2i(table[i].out_str, NULL, table[i].out_base);
+         cp = ui64_i2s(x, buf, sizeof(buf), table[i].out_base);
+         if (strcasecmp(table[i].out_str, cp) != 0) {
+             ts_test_fail(TS_CTX, "input \"%s\" (%d), "
+                          "expected output \"%s\" (%d), got output \"%s\" (%d)", 
+                          table[i].out_str, table[i].out_base, 
+                          table[i].out_str, table[i].out_base, 
+                          cp, table[i].out_base);
+         }
+ 
+         /* import input, export output */
+         x = ui64_s2i(table[i].in_str, NULL, table[i].in_base);
+         cp = ui64_i2s(x, buf, sizeof(buf), table[i].out_base);
+         if (strcasecmp(table[i].out_str, cp) != 0) {
+             ts_test_fail(TS_CTX, "input \"%s\" (%d), "
+                          "expected output \"%s\" (%d), got output \"%s\" (%d)", 
+                          table[i].in_str, table[i].in_base, 
+                          table[i].out_str, table[i].out_base, 
+                          cp, table[i].out_base);
+         }
+     }
+ }
+ 
+ TS_TEST(test_arithmetic)
+ {
+     int i;
+     ui64_t a1, a2, re, ov;
+     char re_a[128];
+     char *re_s;
+     char ov_a[128];
+     char *ov_s;
+     struct {
+         char *a1; 
+         char *op;
+         char *a2; 
+         char *re; 
+         char *ov; 
+     } table[] = {
+         /* addition */
+         { "0", "+", "0", "0", "0" },
+         { "1", "+", "2", "3", "0" },
+         { "255", "+", "1", "256", "0" },
+         { "255", "+", "2", "257", "0" },
+         { "4294967296", "+", "4294967295", "8589934591", "0" },
+         { "4294967296", "+", "4294967296", "8589934592", "0" },
+         { "18446744073709551615", "+", "0", "18446744073709551615", "0" },
+         { "18446744073709551615", "+", "1", "0", "1" },
+         { "18446744073709551615", "+", "18446744073709551615", "18446744073709551614", "1" },
+         /* subtraction */
+         { "0", "-", "0", "0", "0" },
+         { "3", "-", "2", "1", "0" },
+         { "4294967296", "-", "4294967296", "0", "0" },
+         { "18446744073709551615", "-", "0", "18446744073709551615", "0" },
+         { "18446744073709551615", "-", "18446744073709551615", "0", "0" },
+         { "0", "-", "1", "18446744073709551615", "1" },
+         { "0", "-", "18446744073709551615", "1", "1" },
+         /* multiplication */
+         { "0", "*", "0", "0", "0" },
+         { "7", "*", "7", "49", "0" },
+         { "4294967296", "*", "4294967295", "18446744069414584320", "0" },
+         { "4294967296", "*", "4294967296", "0", "1" },
+         { "4294967296", "*", "4294967297", "4294967296", "1" },
+         { "1", "*", "18446744073709551615", "18446744073709551615", "0" },
+         { "18446744073709551615", "*", "1", "18446744073709551615", "0" },
+         { "2", "*", "18446744073709551615", "18446744073709551614", "1" },
+         { "3", "*", "18446744073709551615", "18446744073709551613", "2" },
+         { "4", "*", "18446744073709551615", "18446744073709551612", "3" },
+         /* division */
+         { "0", "/", "0", "0", "0" },
+         { "0", "/", "7", "0", "0" },
+         { "1", "/", "1", "1", "0" },
+         { "6", "/", "3", "2", "0" },
+         { "7", "/", "3", "2", "1" },
+         { "4096", "/", "8192", "0", "4096" },
+         { "65536", "/", "252", "260", "16" },
+         { "4294967296", "/", "4294967296", "1", "0" },
+         { "18446744073709551615", "/", "1", "18446744073709551615", "0" },
+         { "18446744073709551615", "/", "18446744073709551615", "1", "0" },
+         { "18000000000000000000", "/", "9000000000000000000", "2", "0" },
+         { "18000000000000000000", "/", "42", "428571428571428571", "18" },
+         { "18446744073709551615", "/", "4294967295", "4294967297", "0" },
+         { "18446744073709551615", "/", "4294967296", "4294967295", "4294967295" }
+     };
+ 
+     ts_test_check(TS_CTX, "arithmetic operations");
+     for (i = 0; i < sizeof(table)/sizeof(table[0]); i++) {
+         a1 = ui64_s2i(table[i].a1, NULL, 10);
+         a2 = ui64_s2i(table[i].a2, NULL, 10);
+         switch (table[i].op[0]) {
+             case '+': re = ui64_add(a1, a2, &ov); break;
+             case '-': re = ui64_sub(a1, a2, &ov); break;
+             case '*': re = ui64_mul(a1, a2, &ov); break;
+             case '/': re = ui64_div(a1, a2, &ov); break;
+             default: break;
+         }
+         re_s = ui64_i2s(re, re_a, sizeof(re_a), 10);
+         ov_s = ui64_i2s(ov, ov_a, sizeof(ov_a), 10);
+         if (   strcasecmp(re_s, table[i].re) != 0
+             || strcasecmp(ov_s, table[i].ov) != 0) {
+             ts_test_fail(TS_CTX, "%s %s %s = (expected) %s [%s] != %s [%s] (got)",
+                           table[i].a1, table[i].op, table[i].a2, 
+                           table[i].re, table[i].ov, re_s, ov_s);
+         }
+     }
+ }
+ 
+ TS_TEST(test_rotate)
+ {
+     int i;
+     ui64_t a1, re, ov;
+     int a2;
+     char re_a[128];
+     char *re_s;
+     char ov_a[128];
+     char *ov_s;
+     struct {
+         char *a1; 
+         char *op;
+         int a2; 
+         char *re; 
+         char *ov; 
+     } table[] = {
+         /* rotate left */
+         { "0", "<", 0, "0", "0" },
+         { "1", "<", 1, "2", "0" },
+         { "2", "<", 2, "8", "0" },
+         { "4294967296", "<", 16, "281474976710656", "0" },
+         { "4294967296", "<", 17, "562949953421312", "0" },
+         { "4294967296", "<", 18, "1125899906842624", "0" },
+         { "18446744073709551615", "<", 64, "0", "18446744073709551615" },
+         { "18446744073709551615", "<", 32, "18446744069414584320", "4294967295" },
+         /* rotate right */
+         { "0", ">", 0, "0", "0" },
+         { "1", ">", 1, "0", "9223372036854775808" },
+         { "4", ">", 2, "1", "0" },
+         { "4294967296", ">", 16, "65536", "0" },
+         { "4294967295", ">", 16, "65535", "18446462598732840960" }
+     };
+ 
+     ts_test_check(TS_CTX, "rotate operations");
+     for (i = 0; i < sizeof(table)/sizeof(table[0]); i++) {
+         a1 = ui64_s2i(table[i].a1, NULL, 10);
+         a2 = table[i].a2;
+         switch (table[i].op[0]) {
+             case '<': re = ui64_rol(a1, a2, &ov); break;
+             case '>': re = ui64_ror(a1, a2, &ov); break;
+             default: break;
+         }
+         re_s = ui64_i2s(re, re_a, sizeof(re_a), 10);
+         ov_s = ui64_i2s(ov, ov_a, sizeof(ov_a), 10);
+         if (   strcasecmp(re_s, table[i].re) != 0
+             || strcasecmp(ov_s, table[i].ov) != 0) {
+             ts_test_fail(TS_CTX, "%s %s %d = (expected) %s [%s] != %s [%s] (got)",
+                           table[i].a1, table[i].op, table[i].a2, 
+                           table[i].re, table[i].ov, re_s, ov_s);
+         }
+     }
+ }
+ 
+ int main(int argc, char *argv[])
+ {
+     ts_suite_t *ts;
+     int n;
+     ts = ts_suite_new("OSSP ui64 (64-Bit Arithmetic)");
+     ts_suite_test(ts, test_imex_num, "import/export via number");
+     ts_suite_test(ts, test_imex_str, "import/export via string");
+     ts_suite_test(ts, test_arithmetic, "arithmetical operations");
+     ts_suite_test(ts, test_rotate, "bit-wise rotation");
+     n = ts_suite_run(ts);
+     ts_suite_free(ts);
+     return n;
+ }
+ 

CVSTrac 2.0.1