Release calc version 2.12.3.0

This commit is contained in:
Landon Curt Noll
2008-02-24 00:02:29 -08:00
parent b3648f030f
commit bdf495150e
9 changed files with 228 additions and 75 deletions

28
CHANGES
View File

@@ -1,4 +1,26 @@
The following are the changes from calc version 2.12.1.1 to date: The following are the changes from calc version 2.12.3.0 to date:
Fixed the Jacobi function where it returned 1 when it should have
returned 0. Thanks goes to Kevin Sopp (baraclese at googlemail dot com)
for discovering the problem and suggesting the nature if the fix.
Calc versions will always be of the form x.y.z.w even when the
MINOR_PATCH (w) is 0. Thus, 2.12.3.0 will be printed as 2.12.3.0
instread of just 2.12.3.
The following are the changes from calc version 2.12.2.3 to 2.12.2.4:
Added OpenBSD target.
Using the -r test instead of the -e test in Makefiles because some
out of date shells still do not have the -e test.
The Makefile now avoids the use of if ! command because some out of
date shells to not support the ! construct.
The following are the changes from calc version 2.12.1.1 to 2.12.2.2:
Added an explicit Solaris target. Added an explicit Solaris target.
@@ -6695,8 +6717,8 @@ Following is a list of visible changes to calc from version 1.24.7 to 1.26.1:
## received a copy with calc; if not, write to Free Software Foundation, Inc. ## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
## ##
## @(#) $Revision: 30.11 $ ## @(#) $Revision: 30.13 $
## @(#) $Id: CHANGES,v 30.11 2007/10/16 12:22:22 chongo Exp $ ## @(#) $Id: CHANGES,v 30.13 2008/02/24 07:58:36 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/RCS/CHANGES,v $ ## @(#) $Source: /usr/local/src/cmd/calc/RCS/CHANGES,v $
## ##
## Under source code control: 1993/06/02 18:12:57 ## Under source code control: 1993/06/02 18:12:57

View File

@@ -39,8 +39,8 @@
# received a copy with calc; if not, write to Free Software Foundation, Inc. # received a copy with calc; if not, write to Free Software Foundation, Inc.
# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
# #
MAKEFILE_REV= $$Revision: 30.25 $$ MAKEFILE_REV= $$Revision: 30.27 $$
# @(#) $Id: Makefile.ship,v 30.25 2007/09/29 16:57:48 chongo Exp $ # @(#) $Id: Makefile.ship,v 30.27 2008/02/24 07:58:36 chongo Exp $
# @(#) $Source: /usr/local/src/cmd/calc/RCS/Makefile.ship,v $ # @(#) $Source: /usr/local/src/cmd/calc/RCS/Makefile.ship,v $
# #
# Under source code control: 1990/02/15 01:48:41 # Under source code control: 1990/02/15 01:48:41
@@ -984,8 +984,8 @@ EXT=
# The default calc versions # The default calc versions
# #
VERSION= 2.12.2.2 VERSION= 2.12.3.0
VERS= 2.12.2 VERS= 2.12.3
VER= 2.12 VER= 2.12
VE= 2 VE= 2
@@ -1243,6 +1243,48 @@ MAKE= gmake
# #
endif endif
##################
# OpenBSD target #
##################
########################################################################
# NOTE: You MUST either use gmake (GNU Make) or you must try your luck #
# with Makefile.simple and custom/Makefile.simple versions. #
# See HOWTO.INSTALL for more information. #
########################################################################
ifeq ($(target),OpenBSD)
#
BLD_TYPE= calc-dynamic-only
#
CC_SHARE= -fPIC
DEFAULT_LIB_INSTALL_PATH= ${PWD}:/lib:/usr/lib:${LIBDIR}:/usr/local/lib
LD_SHARE= "-Wl,-rpath,${DEFAULT_LIB_INSTALL_PATH}" \
"-Wl,-rpath-link,${DEFAULT_LIB_INSTALL_PATH}"
LIBCALC_SHLIB= -shared "-Wl,-soname,libcalc${LIB_EXT_VERSION}"
ifdef ALLOW_CUSTOM
LIBCUSTCALC_SHLIB= -shared "-Wl,-soname,libcustcalc${LIB_EXT_VERSION}"
else
LIBCUSTCALC_SHLIB=
endif
#
CC_STATIC=
LD_STATIC=
LIBCALC_STATIC=
LIBCUSTCALC_STATIC=
#
CCWARN= -Wall
CCWERR=
CCOPT= ${DEBUG}
CCMISC=
#
LCC= gcc
CC= ${PURIFY} ${LCC} ${CCWERR}
#
MAKE= gmake
#
endif
################ ################
# SunOS target # # SunOS target #
################ ################
@@ -1847,7 +1889,7 @@ calc-dynamic-only: ${DYNAMIC_FIRST_TARGETS} ${EARLY_TARGETS} \
${Q} for i in .static calc-static${EXT} ${SAMPLE_STATIC_TARGETS} \ ${Q} for i in .static calc-static${EXT} ${SAMPLE_STATIC_TARGETS} \
libcalc.a custom/libcustcalc.a; do \ libcalc.a custom/libcustcalc.a; do \
r="calc-dynamic-only"; \ r="calc-dynamic-only"; \
if [ -e "$$i" ]; then \ if [ -r "$$i" ]; then \
echo "Found the static target $$i file. You must:" 1>&2; \ echo "Found the static target $$i file. You must:" 1>&2; \
echo "" 1>&2; \ echo "" 1>&2; \
echo " ${MAKE} -f ${MAKE_FILE} clobber" 1>&2; \ echo " ${MAKE} -f ${MAKE_FILE} clobber" 1>&2; \
@@ -1865,7 +1907,9 @@ calc-static-only: ${STATIC_FIRST_TARGETS} ${EARLY_TARGETS} \
${CALC_STATIC_LIBS} calc-static${EXT} \ ${CALC_STATIC_LIBS} calc-static${EXT} \
${SAMPLE_STATIC_TARGETS} ${LATE_TARGETS} ${SAMPLE_STATIC_TARGETS} ${LATE_TARGETS}
${Q} for i in calc${EXT} ${SAMPLE_TARGETS}; do \ ${Q} for i in calc${EXT} ${SAMPLE_TARGETS}; do \
if ! ${CMP} -s "$$i-static" "$$i"; then \ if ${CMP} -s "$$i-static" "$$i"; then \
${TRUE}; \
else \
${RM} -f "$$i"; \ ${RM} -f "$$i"; \
${LN} "$$i-static" "$$i"; \ ${LN} "$$i-static" "$$i"; \
fi; \ fi; \
@@ -1891,7 +1935,7 @@ calc-static-only: ${STATIC_FIRST_TARGETS} ${EARLY_TARGETS} \
${Q} for i in .dynamic ${CALC_DYNAMIC_LIBS} ${SYM_DYNAMIC_LIBS} \ ${Q} for i in .dynamic ${CALC_DYNAMIC_LIBS} ${SYM_DYNAMIC_LIBS} \
custom/libcustcalc${LIB_EXT_VERSION}; do \ custom/libcustcalc${LIB_EXT_VERSION}; do \
r="calc-static-only"; \ r="calc-static-only"; \
if [ -e "$$i" ]; then \ if [ -r "$$i" ]; then \
echo "Found the dynamic target $$i file. You must:" 1>&2; \ echo "Found the dynamic target $$i file. You must:" 1>&2; \
echo "" 1>&2; \ echo "" 1>&2; \
echo " ${MAKE} -f ${MAKE_FILE} clobber" 1>&2; \ echo " ${MAKE} -f ${MAKE_FILE} clobber" 1>&2; \
@@ -3027,7 +3071,7 @@ have_urandom.h: ${MAKE_FILE}
echo '#define HAVE_URANDOM_H /* yes */' >> have_urandom.h; \ echo '#define HAVE_URANDOM_H /* yes */' >> have_urandom.h; \
elif [ X"${HAVE_URANDOM_H}" = X"NO" ]; then \ elif [ X"${HAVE_URANDOM_H}" = X"NO" ]; then \
echo '#undef HAVE_URANDOM_H /* no */' >> have_urandom.h; \ echo '#undef HAVE_URANDOM_H /* no */' >> have_urandom.h; \
elif [ -e /dev/urandom ] 2>/dev/null; then \ elif [ -r /dev/urandom ] 2>/dev/null; then \
echo '#define HAVE_URANDOM_H /* yes */' >> have_urandom.h; \ echo '#define HAVE_URANDOM_H /* yes */' >> have_urandom.h; \
else \ else \
echo '#undef HAVE_URANDOM_H /* no */' >> have_urandom.h; \ echo '#undef HAVE_URANDOM_H /* no */' >> have_urandom.h; \
@@ -4148,17 +4192,18 @@ clobber: custom/Makefile clean
${RM} -f libcustcalc.a ${RM} -f libcustcalc.a
${RM} -f calc-static${EXT} ${RM} -f calc-static${EXT}
${RM} -f ${CALC_STATIC_LIBS} ${RM} -f ${CALC_STATIC_LIBS}
${RM} -f all
${V} echo '=-=-=-=-= Invoking $@ rule for help =-=-=-=-=' ${V} echo '=-=-=-=-= Invoking $@ rule for help =-=-=-=-='
-cd help; ${MAKE} -f Makefile ${HELP_PASSDOWN} clobber -cd help; ${RM} -f all; ${MAKE} -f Makefile ${HELP_PASSDOWN} $@
${V} echo '=-=-=-=-= Back to the main Makefile for $@ rule =-=-=-=-=' ${V} echo '=-=-=-=-= Back to the main Makefile for $@ rule =-=-=-=-='
${V} echo '=-=-=-=-= Invoking $@ rule for cal =-=-=-=-=' ${V} echo '=-=-=-=-= Invoking $@ rule for cal =-=-=-=-='
-cd cal; ${MAKE} -f Makefile ${CAL_PASSDOWN} clobber -cd cal; ${RM} -f all; ${MAKE} -f Makefile ${CAL_PASSDOWN} $@
${V} echo '=-=-=-=-= Back to the main Makefile for $@ rule =-=-=-=-=' ${V} echo '=-=-=-=-= Back to the main Makefile for $@ rule =-=-=-=-='
${V} echo '=-=-=-=-= Invoking $@ rule for custom =-=-=-=-=' ${V} echo '=-=-=-=-= Invoking $@ rule for custom =-=-=-=-='
cd custom; ${MAKE} -f Makefile ${CUSTOM_PASSDOWN} clobber cd custom; ${RM} -f all; ${MAKE} -f Makefile ${CUSTOM_PASSDOWN} $@
${V} echo '=-=-=-=-= Back to the main Makefile for $@ rule =-=-=-=-=' ${V} echo '=-=-=-=-= Back to the main Makefile for $@ rule =-=-=-=-='
${V} echo '=-=-=-=-= Invoking $@ rule for cscript =-=-=-=-=' ${V} echo '=-=-=-=-= Invoking $@ rule for cscript =-=-=-=-='
cd cscript; ${MAKE} -f Makefile ${CSCRIPT_PASSDOWN} clobber cd cscript; ${RM} -f all; ${MAKE} -f Makefile ${CSCRIPT_PASSDOWN} $@
${V} echo '=-=-=-=-= Back to the main Makefile for $@ rule =-=-=-=-=' ${V} echo '=-=-=-=-= Back to the main Makefile for $@ rule =-=-=-=-='
${V} echo remove files that are obsolete ${V} echo remove files that are obsolete
${RM} -rf win32 build ${RM} -rf win32 build
@@ -4166,7 +4211,7 @@ clobber: custom/Makefile clean
${RM} -f Makefile.simple ${RM} -f Makefile.simple
${RM} -f custom/Makefile ${RM} -f custom/Makefile
#endif /* end of skip for non-Gnu makefiles */ #endif /* end of skip for non-Gnu makefiles */
${RM} -f .static .dynamic ${RM} -f .static .dynamic calc-dynamic-only calc-static-only
${V} echo '=-=-=-=-= ${MAKE_FILE} end of $@ rule =-=-=-=-=' ${V} echo '=-=-=-=-= ${MAKE_FILE} end of $@ rule =-=-=-=-='
# install everything # install everything

View File

@@ -39,8 +39,8 @@
# received a copy with calc; if not, write to Free Software Foundation, Inc. # received a copy with calc; if not, write to Free Software Foundation, Inc.
# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
# #
MAKEFILE_REV= $$Revision: 30.25 $$ MAKEFILE_REV= $$Revision: 30.27 $$
# @(#) $Id: Makefile.ship,v 30.25 2007/09/29 16:57:48 chongo Exp $ # @(#) $Id: Makefile.ship,v 30.27 2008/02/24 07:58:36 chongo Exp $
# @(#) $Source: /usr/local/src/cmd/calc/RCS/Makefile.ship,v $ # @(#) $Source: /usr/local/src/cmd/calc/RCS/Makefile.ship,v $
# #
# Under source code control: 1990/02/15 01:48:41 # Under source code control: 1990/02/15 01:48:41
@@ -961,8 +961,8 @@ EXT=
# The default calc versions # The default calc versions
# #
VERSION= 2.12.2.2 VERSION= 2.12.3.0
VERS= 2.12.2 VERS= 2.12.3
VER= 2.12 VER= 2.12
VE= 2 VE= 2
@@ -1551,7 +1551,7 @@ calc-dynamic-only: ${DYNAMIC_FIRST_TARGETS} ${EARLY_TARGETS} \
${Q} for i in .static calc-static${EXT} ${SAMPLE_STATIC_TARGETS} \ ${Q} for i in .static calc-static${EXT} ${SAMPLE_STATIC_TARGETS} \
libcalc.a custom/libcustcalc.a; do \ libcalc.a custom/libcustcalc.a; do \
r="calc-dynamic-only"; \ r="calc-dynamic-only"; \
if [ -e "$$i" ]; then \ if [ -r "$$i" ]; then \
echo "Found the static target $$i file. You must:" 1>&2; \ echo "Found the static target $$i file. You must:" 1>&2; \
echo "" 1>&2; \ echo "" 1>&2; \
echo " ${MAKE} -f ${MAKE_FILE} clobber" 1>&2; \ echo " ${MAKE} -f ${MAKE_FILE} clobber" 1>&2; \
@@ -1569,7 +1569,9 @@ calc-static-only: ${STATIC_FIRST_TARGETS} ${EARLY_TARGETS} \
${CALC_STATIC_LIBS} calc-static${EXT} \ ${CALC_STATIC_LIBS} calc-static${EXT} \
${SAMPLE_STATIC_TARGETS} ${LATE_TARGETS} ${SAMPLE_STATIC_TARGETS} ${LATE_TARGETS}
${Q} for i in calc${EXT} ${SAMPLE_TARGETS}; do \ ${Q} for i in calc${EXT} ${SAMPLE_TARGETS}; do \
if ! ${CMP} -s "$$i-static" "$$i"; then \ if ${CMP} -s "$$i-static" "$$i"; then \
${TRUE}; \
else \
${RM} -f "$$i"; \ ${RM} -f "$$i"; \
${LN} "$$i-static" "$$i"; \ ${LN} "$$i-static" "$$i"; \
fi; \ fi; \
@@ -1595,7 +1597,7 @@ calc-static-only: ${STATIC_FIRST_TARGETS} ${EARLY_TARGETS} \
${Q} for i in .dynamic ${CALC_DYNAMIC_LIBS} ${SYM_DYNAMIC_LIBS} \ ${Q} for i in .dynamic ${CALC_DYNAMIC_LIBS} ${SYM_DYNAMIC_LIBS} \
custom/libcustcalc${LIB_EXT_VERSION}; do \ custom/libcustcalc${LIB_EXT_VERSION}; do \
r="calc-static-only"; \ r="calc-static-only"; \
if [ -e "$$i" ]; then \ if [ -r "$$i" ]; then \
echo "Found the dynamic target $$i file. You must:" 1>&2; \ echo "Found the dynamic target $$i file. You must:" 1>&2; \
echo "" 1>&2; \ echo "" 1>&2; \
echo " ${MAKE} -f ${MAKE_FILE} clobber" 1>&2; \ echo " ${MAKE} -f ${MAKE_FILE} clobber" 1>&2; \
@@ -2725,7 +2727,7 @@ have_urandom.h: ${MAKE_FILE}
echo '#define HAVE_URANDOM_H /* yes */' >> have_urandom.h; \ echo '#define HAVE_URANDOM_H /* yes */' >> have_urandom.h; \
elif [ X"${HAVE_URANDOM_H}" = X"NO" ]; then \ elif [ X"${HAVE_URANDOM_H}" = X"NO" ]; then \
echo '#undef HAVE_URANDOM_H /* no */' >> have_urandom.h; \ echo '#undef HAVE_URANDOM_H /* no */' >> have_urandom.h; \
elif [ -e /dev/urandom ] 2>/dev/null; then \ elif [ -r /dev/urandom ] 2>/dev/null; then \
echo '#define HAVE_URANDOM_H /* yes */' >> have_urandom.h; \ echo '#define HAVE_URANDOM_H /* yes */' >> have_urandom.h; \
else \ else \
echo '#undef HAVE_URANDOM_H /* no */' >> have_urandom.h; \ echo '#undef HAVE_URANDOM_H /* no */' >> have_urandom.h; \
@@ -3808,21 +3810,22 @@ clobber: custom/Makefile clean
${RM} -f libcustcalc.a ${RM} -f libcustcalc.a
${RM} -f calc-static${EXT} ${RM} -f calc-static${EXT}
${RM} -f ${CALC_STATIC_LIBS} ${RM} -f ${CALC_STATIC_LIBS}
${RM} -f all
${V} echo '=-=-=-=-= Invoking $@ rule for help =-=-=-=-=' ${V} echo '=-=-=-=-= Invoking $@ rule for help =-=-=-=-='
-cd help; ${MAKE} -f Makefile ${HELP_PASSDOWN} clobber -cd help; ${RM} -f all; ${MAKE} -f Makefile ${HELP_PASSDOWN} $@
${V} echo '=-=-=-=-= Back to the main Makefile for $@ rule =-=-=-=-=' ${V} echo '=-=-=-=-= Back to the main Makefile for $@ rule =-=-=-=-='
${V} echo '=-=-=-=-= Invoking $@ rule for cal =-=-=-=-=' ${V} echo '=-=-=-=-= Invoking $@ rule for cal =-=-=-=-='
-cd cal; ${MAKE} -f Makefile ${CAL_PASSDOWN} clobber -cd cal; ${RM} -f all; ${MAKE} -f Makefile ${CAL_PASSDOWN} $@
${V} echo '=-=-=-=-= Back to the main Makefile for $@ rule =-=-=-=-=' ${V} echo '=-=-=-=-= Back to the main Makefile for $@ rule =-=-=-=-='
${V} echo '=-=-=-=-= Invoking $@ rule for custom =-=-=-=-=' ${V} echo '=-=-=-=-= Invoking $@ rule for custom =-=-=-=-='
cd custom; ${MAKE} -f Makefile.simple ${CUSTOM_PASSDOWN} clobber cd custom; ${RM} -f all; ${MAKE} -f Makefile ${CUSTOM_PASSDOWN} $@
${V} echo '=-=-=-=-= Back to the main Makefile for $@ rule =-=-=-=-=' ${V} echo '=-=-=-=-= Back to the main Makefile for $@ rule =-=-=-=-='
${V} echo '=-=-=-=-= Invoking $@ rule for cscript =-=-=-=-=' ${V} echo '=-=-=-=-= Invoking $@ rule for cscript =-=-=-=-='
cd cscript; ${MAKE} -f Makefile ${CSCRIPT_PASSDOWN} clobber cd cscript; ${RM} -f all; ${MAKE} -f Makefile ${CSCRIPT_PASSDOWN} $@
${V} echo '=-=-=-=-= Back to the main Makefile for $@ rule =-=-=-=-=' ${V} echo '=-=-=-=-= Back to the main Makefile for $@ rule =-=-=-=-='
${V} echo remove files that are obsolete ${V} echo remove files that are obsolete
${RM} -rf win32 build ${RM} -rf win32 build
${RM} -f .static .dynamic ${RM} -f .static .dynamic calc-dynamic-only calc-static-only
${V} echo '=-=-=-=-= ${MAKE_FILE} end of $@ rule =-=-=-=-=' ${V} echo '=-=-=-=-= ${MAKE_FILE} end of $@ rule =-=-=-=-='
# install everything # install everything

View File

@@ -17,8 +17,8 @@
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @(#) $Revision: 30.3 $ * @(#) $Revision: 30.4 $
* @(#) $Id: regress.cal,v 30.3 2007/07/11 22:58:26 chongo Exp $ * @(#) $Id: regress.cal,v 30.4 2008/02/24 07:41:49 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/regress.cal,v $ * @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/regress.cal,v $
* *
* Under source code control: 1990/02/15 01:50:36 * Under source code control: 1990/02/15 01:50:36
@@ -1412,7 +1412,39 @@ define test_functions()
vrfy(isnum(systime()), '1206: isnum(systime())'); vrfy(isnum(systime()), '1206: isnum(systime())');
vrfy(isnum(usertime()), '1207: isnum(usertime())'); vrfy(isnum(usertime()), '1207: isnum(usertime())');
print '1208: Ending test_functions'; /* more jacobi tests */
vrfy(jacobi(987897,987) == 0, '1208: jacobi(987897,987) == 0');
vrfy(jacobi(897,987) == 0, '1209: jacobi(897,987) == 0');
vrfy(jacobi(987,897) == 0, '1210: jacobi(987,897) == 0');
vrfy(jacobi(90,897) == 0, '1211: jacobi(90,897) == 0');
vrfy(jacobi(45,897) == 0, '1212: jacobi(45,897) == 0');
vrfy(jacobi(897,45) == 0, '1213: jacobi(897,45) == 0');
vrfy(jacobi(42,45) == 0, '1214: jacobi(42,45) == 0');
vrfy(jacobi(21,45) == 0, '1215: jacobi(21,45) == 0');
vrfy(jacobi(45,21) == 0, '1216: jacobi(45,21) == 0');
vrfy(jacobi(3,21) == 0, '1217: jacobi(3,21) == 0');
vrfy(jacobi(0,21) == 0, '1218: jacobi(0,21) == 0');
vrfy(jacobi(0,20003) == 0, '1219: jacobi(0,20003) == 0');
vrfy(jacobi(1,20003) == 1, '1220: jacobi(1,20003) == 1');
vrfy(jacobi(1236,20003) == 1, '1221: jacobi(1236,20003) == 1');
vrfy(jacobi(618,20003) == -1, '1222: jacobi(618,20003) == -1');
vrfy(jacobi(309,20003) == 1, '1223: jacobi(309,20003) == 1');
vrfy(jacobi(227,309) == 1, '1224: jacobi(227,309) == 1');
vrfy(jacobi(82,227) == 1, '1225: jacobi(82,227) == 1');
vrfy(jacobi(41,227) == -1, '1226: jacobi(41,227) == -1');
vrfy(jacobi(22,41) == -1, '1227: jacobi(22,41) == -1');
vrfy(jacobi(11,41) == -1, '1228: jacobi(11,41) == -1');
vrfy(jacobi(8,11) == -1, '1229: jacobi(8,11) == -1');
vrfy(jacobi(4,11) == 1, '1230: jacobi(4,11) == 1');
vrfy(jacobi(2,11) == -1, '1231: jacobi(2,11) == -1');
vrfy(jacobi(1,11) == 1, '1232: jacobi(1,11) == 1');
vrfy(jacobi(0,11) == 0, '1233: jacobi(0,11) == 0');
vrfy(jacobi(0,0) == 0, '1234: jacobi(0,0) == 0');
vrfy(jacobi(-1,0) == 0, '1235: jacobi(-1,0) == 0');
vrfy(jacobi(-1,-1) == 0, '1236: jacobi(-1,-1) == 0');
vrfy(jacobi(0,-1) == 0, '1237: jacobi(0,-1) == 0');
print '1238: Ending test_functions';
} }
print '017: parsed test_functions()'; print '017: parsed test_functions()';

View File

@@ -18,8 +18,8 @@
# received a copy with calc; if not, write to Free Software Foundation, Inc. # received a copy with calc; if not, write to Free Software Foundation, Inc.
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# #
# @(#) $Revision: 30.14 $ # @(#) $Revision: 30.16 $
# @(#) $Id: Makefile.head,v 30.14 2007/09/06 08:08:39 chongo Exp $ # @(#) $Id: Makefile.head,v 30.16 2008/02/24 07:58:36 chongo Exp $
# @(#) $Source: /usr/local/src/cmd/calc/custom/RCS/Makefile.head,v $ # @(#) $Source: /usr/local/src/cmd/calc/custom/RCS/Makefile.head,v $
# #
# Under source code control: 1997/03/09 02:28:54 # Under source code control: 1997/03/09 02:28:54
@@ -366,8 +366,8 @@ EXT=
# The default calc versions # The default calc versions
# #
VERSION= 2.12.2.1 VERSION= 2.12.3.0
VERS= 2.12.2 VERS= 2.12.3
VER= 2.12 VER= 2.12
VE= 2 VE= 2
@@ -632,6 +632,48 @@ MAKE= gmake
# #
endif endif
##################
# OpenBSD target #
##################
########################################################################
# NOTE: You MUST either use gmake (GNU Make) or you must try your luck #
# with Makefile.simple and custom/Makefile.simple versions. #
# See HOWTO.INSTALL for more information. #
########################################################################
ifeq ($(target),OpenBSD)
#
BLD_TYPE= calc-dynamic-only
#
CC_SHARE= -fPIC
DEFAULT_LIB_INSTALL_PATH= ${PWD}:/lib:/usr/lib:${LIBDIR}:/usr/local/lib
LD_SHARE= "-Wl,-rpath,${DEFAULT_LIB_INSTALL_PATH}" \
"-Wl,-rpath-link,${DEFAULT_LIB_INSTALL_PATH}"
LIBCALC_SHLIB= -shared "-Wl,-soname,libcalc${LIB_EXT_VERSION}"
ifdef ALLOW_CUSTOM
LIBCUSTCALC_SHLIB= -shared "-Wl,-soname,libcustcalc${LIB_EXT_VERSION}"
else
LIBCUSTCALC_SHLIB=
endif
#
CC_STATIC=
LD_STATIC=
LIBCALC_STATIC=
LIBCUSTCALC_STATIC=
#
CCWARN= -Wall
CCWERR=
CCOPT= ${DEBUG}
CCMISC=
#
LCC= gcc
CC= ${PURIFY} ${LCC} ${CCWERR}
#
MAKE= gmake
#
endif
################ ################
# SunOS target # # SunOS target #
################ ################

View File

@@ -18,8 +18,8 @@
# received a copy with calc; if not, write to Free Software Foundation, Inc. # received a copy with calc; if not, write to Free Software Foundation, Inc.
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# #
# @(#) $Revision: 30.14 $ # @(#) $Revision: 30.16 $
# @(#) $Id: Makefile.head,v 30.14 2007/09/06 08:08:39 chongo Exp $ # @(#) $Id: Makefile.head,v 30.16 2008/02/24 07:58:36 chongo Exp $
# @(#) $Source: /usr/local/src/cmd/calc/custom/RCS/Makefile.head,v $ # @(#) $Source: /usr/local/src/cmd/calc/custom/RCS/Makefile.head,v $
# #
# Under source code control: 1997/03/09 02:28:54 # Under source code control: 1997/03/09 02:28:54
@@ -366,8 +366,8 @@ EXT=
# The default calc versions # The default calc versions
# #
VERSION= 2.12.2.1 VERSION= 2.12.3.0
VERS= 2.12.2 VERS= 2.12.3
VER= 2.12 VER= 2.12
VE= 2 VE= 2

View File

@@ -18,8 +18,8 @@
# received a copy with calc; if not, write to Free Software Foundation, Inc. # received a copy with calc; if not, write to Free Software Foundation, Inc.
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# #
# @(#) $Revision: 30.14 $ # @(#) $Revision: 30.16 $
# @(#) $Id: Makefile.head,v 30.14 2007/09/06 08:08:39 chongo Exp $ # @(#) $Id: Makefile.head,v 30.16 2008/02/24 07:58:36 chongo Exp $
# @(#) $Source: /usr/local/src/cmd/calc/custom/RCS/Makefile.head,v $ # @(#) $Source: /usr/local/src/cmd/calc/custom/RCS/Makefile.head,v $
# #
# Under source code control: 1997/03/09 02:28:54 # Under source code control: 1997/03/09 02:28:54
@@ -351,8 +351,8 @@ EXT=
# The default calc versions # The default calc versions
# #
VERSION= 2.12.2.1 VERSION= 2.12.3.0
VERS= 2.12.2 VERS= 2.12.3
VER= 2.12 VER= 2.12
VE= 2 VE= 2

View File

@@ -19,8 +19,8 @@
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @(#) $Revision: 30.5 $ * @(#) $Revision: 30.6 $
* @(#) $Id: version.c,v 30.5 2007/10/16 12:22:22 chongo Exp $ * @(#) $Id: version.c,v 30.6 2008/02/24 07:58:36 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/version.c,v $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/version.c,v $
* *
* Under source code control: 1990/05/22 11:00:58 * Under source code control: 1990/05/22 11:00:58
@@ -48,8 +48,8 @@ static char *program;
#define MAJOR_VER 2 /* major library version */ #define MAJOR_VER 2 /* major library version */
#define MINOR_VER 12 /* minor library version */ #define MINOR_VER 12 /* minor library version */
#define MAJOR_PATCH 2 /* major software level under library version */ #define MAJOR_PATCH 3 /* major software level under library version */
#define MINOR_PATCH 2 /* minor software level or 0 if none */ #define MINOR_PATCH 0 /* minor software level or 0 if not patched */
/* /*
@@ -103,8 +103,6 @@ char *Copyright = "\n"
* string does not contain the title, just: * string does not contain the title, just:
* *
* x.y.z.w * x.y.z.w
* x.y.z
* x.y
*/ */
char * char *
version(void) version(void)
@@ -121,15 +119,9 @@ version(void)
/* /*
* form the version buffer * form the version buffer
*/ */
if (MINOR_PATCH > 0) { snprintf(verbuf, BUFSIZ,
snprintf(verbuf, BUFSIZ, "%d.%d.%d.%d", calc_major_ver, calc_minor_ver,
"%d.%d.%d.%d", calc_major_ver, calc_minor_ver, calc_major_patch, calc_minor_patch);
calc_major_patch, calc_minor_patch);
} else {
snprintf(verbuf, BUFSIZ,
"%d.%d.%d", calc_major_ver,
calc_minor_ver, calc_major_patch);
}
/* /*
* save the versions string into a newly malloced buffer * save the versions string into a newly malloced buffer

49
zfunc.c
View File

@@ -19,8 +19,8 @@
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @(#) $Revision: 30.1 $ * @(#) $Revision: 30.2 $
* @(#) $Id: zfunc.c,v 30.1 2007/03/16 11:09:46 chongo Exp $ * @(#) $Id: zfunc.c,v 30.2 2008/02/24 07:41:49 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/zfunc.c,v $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/zfunc.c,v $
* *
* Under source code control: 1990/02/15 01:48:27 * Under source code control: 1990/02/15 01:48:27
@@ -374,12 +374,28 @@ zcomb(ZVALUE z1, ZVALUE z2, ZVALUE *res)
/* /*
* Compute the Jacobi function (p / q) for odd q. * Compute the Jacobi function (m / n) for odd n.
* If q is prime then the result is: *
* 1 if p == x^2 (mod q) for some x. * The property of the Jacobi function is: If n>2 is prime then
* -1 otherwise. *
* If q is not prime, then the result is not meaningful if it is 1. * the result is 1 if m == x^2 (mod n) for some x.
* This function returns 0 if q is even or q < 0. * otherwise the result is -1.
*
* If n is not prime, then the result does not prove that n is not prine
* when the value of the Jacobi is 1.
*
* Jacobi evaluation of (m / n), where n > 0 is odd AND m > 0 is odd:
*
* rule 0: (0 / n) == 0
* rule 1: (1 / n) == 1
* rule 2: (m / n) == (a / n) if m == a % n
* rule 3: (m / n) == (2*m / n) if n == 1 % 8 OR n == 7 % 8
* rule 4: (m / n) == -(2*m / n) if n != 1 & 8 AND n != 7 % 8
* rule 5: (m / n) == (n / m) if m == 3 % 4 AND n == 3 % 4
* rule 6: (m / n) == -(n / m) if m != 3 % 4 OR n != 3 % 4
*
* NOTE: This function returns 0 in invalid Jacobi parameters:
* m < 0 OR n is even OR n < 1.
*/ */
FLAG FLAG
zjacobi(ZVALUE z1, ZVALUE z2) zjacobi(ZVALUE z1, ZVALUE z2)
@@ -388,16 +404,16 @@ zjacobi(ZVALUE z1, ZVALUE z2)
long lowbit; long lowbit;
int val; int val;
/* firewall */
if (ziszero(z1) || zisneg(z1))
return 0;
if (ziseven(z2) || zisneg(z2)) if (ziseven(z2) || zisneg(z2))
return 0; return 0;
/* assume a value of 1 unless we find otherwise */
if (zisone(z1))
return 1;
val = 1; val = 1;
if (ziszero(z1) || zisone(z1))
return val;
if (zisunit(z1)) {
if ((*z2.v - 1) & 0x2)
val = -val;
return val;
}
zcopy(z1, &p); zcopy(z1, &p);
zcopy(z2, &q); zcopy(z2, &q);
for (;;) { for (;;) {
@@ -406,7 +422,8 @@ zjacobi(ZVALUE z1, ZVALUE z2)
p = tmp; p = tmp;
if (ziszero(p)) { if (ziszero(p)) {
zfree(p); zfree(p);
p = _one_; zfree(q);
return 0;
} }
if (ziseven(p)) { if (ziseven(p)) {
lowbit = zlowbit(p); lowbit = zlowbit(p);