Compare commits

...

2 Commits

Author SHA1 Message Date
Landon Curt Noll
3d55811205 Release calc version 2.11.4t2 2017-05-21 15:38:39 -07:00
Landon Curt Noll
296aa50ac7 Release calc version 2.11.2t1 2017-05-21 15:38:38 -07:00
18 changed files with 353 additions and 103 deletions

23
CHANGES
View File

@@ -5,6 +5,25 @@ The following are the changes from calc version 2.11.4t1 to date:
Fixes cscript files to deal with the -S flag being replaced by Fixes cscript files to deal with the -S flag being replaced by
-f and possibly other flags. -f and possibly other flags.
Added regression tests for builtin functions bernoulli, catalan,
euler, freeeuler, and sleep. Added non-base 10 regression tests
for digit, digits and places.
The bernoulli.cal script now just calls the bernoulli() builtin
function. It remains for backward compatibility.
The Makefile now builds have_fpos_pos.h to determine if the
a non-scalar FILEPOS has a __pos stucture element. If it does,
the FILEPOS_BITS is taken to be the size of just the __pos element.
Misc fixes related to non-scalar (e.g., structure) FILEPOS. Fixed
a compile problems where non-scalar FILEPOS were incorrectly assigned.
Fixed make depend rule.
Return an error on malloc / realloc failures for bernoulli and
euler functions.
The following are the changes from calc version 2.11.3t0 to 2.11.4: The following are the changes from calc version 2.11.3t0 to 2.11.4:
@@ -5019,8 +5038,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.
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. ## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
## ##
## @(#) $Revision: 29.14 $ ## @(#) $Revision: 29.16 $
## @(#) $Id: CHANGES,v 29.14 2000/12/15 14:58:20 chongo Exp $ ## @(#) $Id: CHANGES,v 29.16 2000/12/17 13:07:54 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

135
Makefile
View File

@@ -20,8 +20,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.
# #
# @(#) $Revision: 29.9 $ # @(#) $Revision: 29.10 $
# @(#) $Id: Makefile.ship,v 29.9 2000/06/07 15:50:19 chongo Exp $ # @(#) $Id: Makefile.ship,v 29.10 2000/12/17 12:23:29 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
@@ -42,7 +42,7 @@
# #
# value meaning # value meaning
# -------- ------- # -------- -------
# (nothing) let the makefile guess at what you need # (nothing) let the Makefile guess at what you need
# -DUSE_TERMIOS use struct termios from <termios.h> # -DUSE_TERMIOS use struct termios from <termios.h>
# -DUSE_TERMIO use struct termios from <termio.h> # -DUSE_TERMIO use struct termios from <termio.h>
# -DUSE_SGTTY use struct sgttyb from <sys/ioctl.h> # -DUSE_SGTTY use struct sgttyb from <sys/ioctl.h>
@@ -63,7 +63,7 @@ TERMCONTROL=
# If you do not have vsprintf(), then calc will try sprintf() and hope # If you do not have vsprintf(), then calc will try sprintf() and hope
# for the best. # for the best.
# #
# If HAVE_VSPRINTF is empty, this makefile will run the have_stdvs.c and/or # If HAVE_VSPRINTF is empty, this Makefile will run the have_stdvs.c and/or
# have_varvs.c program to determine if vsprintf() is supported. If # have_varvs.c program to determine if vsprintf() is supported. If
# HAVE_VSPRINTF is set to -DDONT_HAVE_VSPRINTF then calc will hope that # HAVE_VSPRINTF is set to -DDONT_HAVE_VSPRINTF then calc will hope that
# sprintf() will work. # sprintf() will work.
@@ -78,7 +78,7 @@ HAVE_VSPRINTF=
# Big Endian: Amdahl, 68k, Pyramid, Mips, Sparc, ... # Big Endian: Amdahl, 68k, Pyramid, Mips, Sparc, ...
# Little Endian: Vax, 32k, Spim (Dec Mips), i386, i486, ... # Little Endian: Vax, 32k, Spim (Dec Mips), i386, i486, ...
# #
# If in doubt, leave BYTE_ORDER empty. This makefile will attempt to # If in doubt, leave BYTE_ORDER empty. This Makefile will attempt to
# use BYTE_ORDER in <machine/endian.h> or it will attempt to run # use BYTE_ORDER in <machine/endian.h> or it will attempt to run
# the endian program. If you get syntax errors when you compile, # the endian program. If you get syntax errors when you compile,
# try forcing the value to be BIG_ENDIAN and run the calc regression # try forcing the value to be BIG_ENDIAN and run the calc regression
@@ -92,7 +92,7 @@ BYTE_ORDER=
# Determine the number of bits in a long # Determine the number of bits in a long
# #
# If in doubt, leave LONG_BITS empty. This makefile will run # If in doubt, leave LONG_BITS empty. This Makefile will run
# the longbits program to determine the length. # the longbits program to determine the length.
# #
# In order to avoid make brain damage in some systems, we avoid placing # In order to avoid make brain damage in some systems, we avoid placing
@@ -125,7 +125,7 @@ LONGLONG_BITS=
# Determine if we have the ANSI C fgetpos and fsetpos alternate interface # Determine if we have the ANSI C fgetpos and fsetpos alternate interface
# to the ftell() and fseek() (with whence set to SEEK_SET) functions. # to the ftell() and fseek() (with whence set to SEEK_SET) functions.
# #
# If HAVE_FPOS is empty, this makefile will run the have_fpos program # If HAVE_FPOS is empty, this Makefile will run the have_fpos program
# to determine if there is are fgetpos and fsetpos functions. If HAVE_FPOS # to determine if there is are fgetpos and fsetpos functions. If HAVE_FPOS
# is set to -DHAVE_NO_FPOS, then calc will use ftell() and fseek(). # is set to -DHAVE_NO_FPOS, then calc will use ftell() and fseek().
# #
@@ -134,11 +134,22 @@ LONGLONG_BITS=
HAVE_FPOS= HAVE_FPOS=
#HAVE_FPOS= -DHAVE_NO_FPOS #HAVE_FPOS= -DHAVE_NO_FPOS
# Determine if we have an __pos element of a file position (fpos_t) structure.
#
# If HAVE_FPOS_POS is empty, this Makefile will run the have_fpos_pos program
# to determine if fpos_t has a __pos structure element. If HAVE_FPOS_POS
# is set to -DHAVE_NO_FPOS_POS, then calc assume there is no __pos element.
#
# If in doubt, leave HAVE_FPOS_POS empty and this Makefile will figure it out.
#
HAVE_FPOS_POS=
#HAVE_FPOS= -DHAVE_NO_FPOS_POS
# Determine if we have an off_t which one can perform arithmetic operations, # Determine if we have an off_t which one can perform arithmetic operations,
# assignments and comparisons. On some systems off_t is some sort of union # assignments and comparisons. On some systems off_t is some sort of union
# or struct. # or struct.
# #
# If HAVE_OFFSCL is empty, this makefile will run the have_offscl program # If HAVE_OFFSCL is empty, this Makefile will run the have_offscl program
# to determine if off_t is a scalar. If HAVE_OFFSCL is set to the value # to determine if off_t is a scalar. If HAVE_OFFSCL is set to the value
# -DOFF_T_NON_SCALAR when calc will assume that off_t some sort of # -DOFF_T_NON_SCALAR when calc will assume that off_t some sort of
# union or struct which. # union or struct which.
@@ -153,7 +164,7 @@ HAVE_OFFSCL=
# or struct. Some systems do not have an fpos_t and long is as a file # or struct. Some systems do not have an fpos_t and long is as a file
# offset instead. # offset instead.
# #
# If HAVE_POSSCL is empty, this makefile will run the have_offscl program # If HAVE_POSSCL is empty, this Makefile will run the have_offscl program
# to determine if off_t is a scalar, or if there is no off_t and long # to determine if off_t is a scalar, or if there is no off_t and long
# (a scalar) should be used instead. If HAVE_POSSCL is set to the value # (a scalar) should be used instead. If HAVE_POSSCL is set to the value
# -DFILEPOS_NON_SCALAR when calc will assume that fpos_t exists and is # -DFILEPOS_NON_SCALAR when calc will assume that fpos_t exists and is
@@ -166,7 +177,7 @@ HAVE_POSSCL=
# Determine if we have ANSI C const. # Determine if we have ANSI C const.
# #
# If HAVE_CONST is empty, this makefile will run the have_const program # If HAVE_CONST is empty, this Makefile will run the have_const program
# to determine if const is supported. If HAVE_CONST is set to -DHAVE_NO_CONST, # to determine if const is supported. If HAVE_CONST is set to -DHAVE_NO_CONST,
# then calc will not use const. # then calc will not use const.
# #
@@ -177,7 +188,7 @@ HAVE_CONST=
# Determine if we have uid_t # Determine if we have uid_t
# #
# If HAVE_UID_T is empty, this makefile will run the have_uid_t program # If HAVE_UID_T is empty, this Makefile will run the have_uid_t program
# to determine if const is supported. If HAVE_UID_T is set to -DHAVE_NO_UID_T, # to determine if const is supported. If HAVE_UID_T is set to -DHAVE_NO_UID_T,
# then calc will treat uid_t as an unsigned short. This only matters if # then calc will treat uid_t as an unsigned short. This only matters if
# $HOME is not set and calc must look up the home directory in /etc/passwd. # $HOME is not set and calc must look up the home directory in /etc/passwd.
@@ -189,7 +200,7 @@ HAVE_UID_T=
# Determine if we have memcpy(), memset() and strchr() # Determine if we have memcpy(), memset() and strchr()
# #
# If HAVE_NEWSTR is empty, this makefile will run the have_newstr program # If HAVE_NEWSTR is empty, this Makefile will run the have_newstr program
# to determine if memcpy(), memset() and strchr() are supported. If # to determine if memcpy(), memset() and strchr() are supported. If
# HAVE_NEWSTR is set to -DHAVE_NO_NEWSTR, then calc will use bcopy() instead # HAVE_NEWSTR is set to -DHAVE_NO_NEWSTR, then calc will use bcopy() instead
# of memcpy(), use bfill() instead of memset(), and use index() instead of # of memcpy(), use bfill() instead of memset(), and use index() instead of
@@ -202,7 +213,7 @@ HAVE_NEWSTR=
# Determine if we have memmove() # Determine if we have memmove()
# #
# If HAVE_MEMMOVE is empty, this makefile will run the have_memmv program # If HAVE_MEMMOVE is empty, this Makefile will run the have_memmv program
# to determine if memmove() is supported. If HAVE_MEMMOVE is set to # to determine if memmove() is supported. If HAVE_MEMMOVE is set to
# -DHAVE_NO_MEMMOVE, then calc will use internal functions to simulate # -DHAVE_NO_MEMMOVE, then calc will use internal functions to simulate
# the memory move function that does correct overlapping memory modes. # the memory move function that does correct overlapping memory modes.
@@ -214,7 +225,7 @@ HAVE_MEMMOVE=
# Determine if we have ustat() # Determine if we have ustat()
# #
# If HAVE_USTAT is empty, this makefile will run the have_memmv program # If HAVE_USTAT is empty, this Makefile will run the have_memmv program
# to determine if ustat() is supported. If HAVE_USTAT is set to # to determine if ustat() is supported. If HAVE_USTAT is set to
# -DHAVE_NO_USTAT, then calc will use internal functions to simulate # -DHAVE_NO_USTAT, then calc will use internal functions to simulate
# the memory move function that does correct overlapping memory modes. # the memory move function that does correct overlapping memory modes.
@@ -226,7 +237,7 @@ HAVE_USTAT=
# Determine if we have getsid() # Determine if we have getsid()
# #
# If HAVE_GETSID is empty, this makefile will run the have_memmv program # If HAVE_GETSID is empty, this Makefile will run the have_memmv program
# to determine if getsid() is supported. If HAVE_GETSID is set to # to determine if getsid() is supported. If HAVE_GETSID is set to
# -DHAVE_NO_GETSID, then calc will use internal functions to simulate # -DHAVE_NO_GETSID, then calc will use internal functions to simulate
# the memory move function that does correct overlapping memory modes. # the memory move function that does correct overlapping memory modes.
@@ -238,7 +249,7 @@ HAVE_GETSID=
# Determine if we have getpgid() # Determine if we have getpgid()
# #
# If HAVE_GETPGID is empty, this makefile will run the have_memmv program # If HAVE_GETPGID is empty, this Makefile will run the have_memmv program
# to determine if getpgid() is supported. If HAVE_GETPGID is set to # to determine if getpgid() is supported. If HAVE_GETPGID is set to
# -DHAVE_NO_GETPGID, then calc will use internal functions to simulate # -DHAVE_NO_GETPGID, then calc will use internal functions to simulate
# the memory move function that does correct overlapping memory modes. # the memory move function that does correct overlapping memory modes.
@@ -250,7 +261,7 @@ HAVE_GETPGID=
# Determine if we have clock_gettime() # Determine if we have clock_gettime()
# #
# If HAVE_GETTIME is empty, this makefile will run the have_memmv program # If HAVE_GETTIME is empty, this Makefile will run the have_memmv program
# to determine if clock_gettime() is supported. If HAVE_GETTIME is set to # to determine if clock_gettime() is supported. If HAVE_GETTIME is set to
# -DHAVE_NO_GETTIME, then calc will use internal functions to simulate # -DHAVE_NO_GETTIME, then calc will use internal functions to simulate
# the memory move function that does correct overlapping memory modes. # the memory move function that does correct overlapping memory modes.
@@ -262,7 +273,7 @@ HAVE_GETTIME=
# Determine if we have getprid() # Determine if we have getprid()
# #
# If HAVE_GETPRID is empty, this makefile will run the have_memmv program # If HAVE_GETPRID is empty, this Makefile will run the have_memmv program
# to determine if getprid() is supported. If HAVE_GETPRID is set to # to determine if getprid() is supported. If HAVE_GETPRID is set to
# -DHAVE_NO_GETPRID, then calc will use internal functions to simulate # -DHAVE_NO_GETPRID, then calc will use internal functions to simulate
# the memory move function that does correct overlapping memory modes. # the memory move function that does correct overlapping memory modes.
@@ -274,7 +285,7 @@ HAVE_GETPRID=
# Determine if we have /dev/urandom # Determine if we have /dev/urandom
# #
# If HAVE_URANDOM is empty, this makefile will run the have_memmv program # If HAVE_URANDOM is empty, this Makefile will run the have_memmv program
# to determine if /dev/urandom is supported. If HAVE_URANDOM is set to # to determine if /dev/urandom is supported. If HAVE_URANDOM is set to
# -DHAVE_NO_URANDOM, then calc will use internal functions to simulate # -DHAVE_NO_URANDOM, then calc will use internal functions to simulate
# the memory move function that does correct overlapping memory modes. # the memory move function that does correct overlapping memory modes.
@@ -286,7 +297,7 @@ HAVE_URANDOM=
# Determine if we have getrusage() # Determine if we have getrusage()
# #
# If HAVE_GETRUSAGE is empty, this makefile will run the have_memmv program # If HAVE_GETRUSAGE is empty, this Makefile will run the have_memmv program
# to determine if getrusage() is supported. If HAVE_GETRUSAGE is set to # to determine if getrusage() is supported. If HAVE_GETRUSAGE is set to
# -DHAVE_NO_GETRUSAGE, then calc will use internal functions to simulate # -DHAVE_NO_GETRUSAGE, then calc will use internal functions to simulate
# the memory move function that does correct overlapping memory modes. # the memory move function that does correct overlapping memory modes.
@@ -298,7 +309,7 @@ HAVE_GETRUSAGE=
# Determine if we have strdup() # Determine if we have strdup()
# #
# If HAVE_STRDUP is empty, this makefile will run the have_memmv program # If HAVE_STRDUP is empty, this Makefile will run the have_memmv program
# to determine if strdup() is supported. If HAVE_STRDUP is set to # to determine if strdup() is supported. If HAVE_STRDUP is set to
# -DHAVE_NO_STRDUP, then calc will use internal functions to simulate # -DHAVE_NO_STRDUP, then calc will use internal functions to simulate
# the memory move function that does correct overlapping memory modes. # the memory move function that does correct overlapping memory modes.
@@ -824,8 +835,8 @@ ECHO= /bin/echo
# Makefile debug # Makefile debug
# #
# Q=@ do not echo internal makefile actions (quiet mode) # Q=@ do not echo internal Makefile actions (quiet mode)
# Q= echo internal makefile actions (debug / verbose mode) # Q= echo internal Makefile actions (debug / verbose mode)
# #
# V=@: do not echo debug statements (quiet mode) # V=@: do not echo debug statements (quiet mode)
# V=@ do echo debug statements (debug / verbose mode) # V=@ do echo debug statements (debug / verbose mode)
@@ -885,7 +896,7 @@ LIB_H_SRC= alloc.h blkcpy.h block.h byteswap.h calc.h cmath.h \
# we build these .h files during the make # we build these .h files during the make
# #
BUILD_H_SRC= align32.h args.h calcerr.h conf.h endian_calc.h \ BUILD_H_SRC= align32.h args.h calcerr.h conf.h endian_calc.h \
fposval.h have_const.h have_fpos.h have_malloc.h \ fposval.h have_const.h have_fpos.h have_fpos_pos.h have_malloc.h \
have_memmv.h have_newstr.h have_offscl.h have_posscl.h \ have_memmv.h have_newstr.h have_offscl.h have_posscl.h \
have_stdlib.h have_string.h have_times.h have_uid_t.h \ have_stdlib.h have_string.h have_times.h have_uid_t.h \
have_unistd.h longbits.h longlong.h terminal.h \ have_unistd.h longbits.h longlong.h terminal.h \
@@ -903,7 +914,7 @@ BUILD_C_SRC= calcerr.c
# #
UTIL_C_SRC= align32.c endian.c longbits.c have_newstr.c have_uid_t.c \ UTIL_C_SRC= align32.c endian.c longbits.c have_newstr.c have_uid_t.c \
have_const.c have_stdvs.c have_varvs.c fposval.c have_fpos.c \ have_const.c have_stdvs.c have_varvs.c fposval.c have_fpos.c \
longlong.c have_offscl.c have_posscl.c have_memmv.c \ have_fpos_pos.c longlong.c have_offscl.c have_posscl.c have_memmv.c \
have_ustat.c have_getsid.c have_getpgid.c \ have_ustat.c have_getsid.c have_getpgid.c \
have_gettime.c have_getprid.c have_rusage.c have_strdup.c have_gettime.c have_getprid.c have_rusage.c have_strdup.c
@@ -918,8 +929,8 @@ UTIL_MISC_SRC= calcerr_h.sed calcerr_h.awk calcerr_c.sed calcerr_c.awk \
# There MUST be a .o for every .c in UTIL_C_SRC. # There MUST be a .o for every .c in UTIL_C_SRC.
# #
UTIL_OBJS= endian.o longbits.o have_newstr.o have_uid_t.o \ UTIL_OBJS= endian.o longbits.o have_newstr.o have_uid_t.o \
have_const.o fposval.o have_fpos.o longlong.o try_strarg.o \ have_const.o fposval.o have_fpos.o have_fpos_pos.o longlong.o \
have_stdvs.o have_varvs.o have_posscl.o have_memmv.o \ try_strarg.o have_stdvs.o have_varvs.o have_posscl.o have_memmv.o \
have_ustat.o have_getsid.o have_getpgid.o \ have_ustat.o have_getsid.o have_getpgid.o \
have_gettime.o have_getprid.o ver_calc.o have_rusage.o have_strdup.o have_gettime.o have_getprid.o ver_calc.o have_rusage.o have_strdup.o
@@ -936,7 +947,7 @@ UTIL_PROGS= align32 fposval have_uid_t longlong have_const \
have_ustat have_getsid have_getpgid \ have_ustat have_getsid have_getpgid \
have_gettime have_getprid ver_calc have_strdup have_gettime have_getprid ver_calc have_strdup
# The complete list of makefile vars passed down to custom/Makefile. # The complete list of Makefile vars passed down to custom/Makefile.
# #
CUSTOM_PASSDOWN= Q="${Q}" \ CUSTOM_PASSDOWN= Q="${Q}" \
TOPDIR="${TOPDIR}" \ TOPDIR="${TOPDIR}" \
@@ -964,7 +975,7 @@ CUSTOM_PASSDOWN= Q="${Q}" \
MAKEDEPEND=${MAKEDEPEND} \ MAKEDEPEND=${MAKEDEPEND} \
SORT=${SORT} SORT=${SORT}
# The complete list of makefile vars passed down to sample/Makefile. # The complete list of Makefile vars passed down to sample/Makefile.
# #
SAMPLE_PASSDOWN= Q="${Q}" \ SAMPLE_PASSDOWN= Q="${Q}" \
TOPDIR="${TOPDIR}" \ TOPDIR="${TOPDIR}" \
@@ -991,7 +1002,7 @@ SAMPLE_PASSDOWN= Q="${Q}" \
CHMOD=${CHMOD} \ CHMOD=${CHMOD} \
SORT=${SORT} SORT=${SORT}
# The compelte list of makefile vars passed down to help/Makefile. # The compelte list of Makefile vars passed down to help/Makefile.
# #
HELP_PASSDOWN= Q="${Q}" \ HELP_PASSDOWN= Q="${Q}" \
TOPDIR="${TOPDIR}" \ TOPDIR="${TOPDIR}" \
@@ -1005,7 +1016,7 @@ HELP_PASSDOWN= Q="${Q}" \
CHMOD=${CHMOD} \ CHMOD=${CHMOD} \
FMT=${FMT} FMT=${FMT}
# The compelte list of makefile vars passed down to cal/Makefile. # The compelte list of Makefile vars passed down to cal/Makefile.
# #
CAL_PASSDOWN= Q="${Q}" \ CAL_PASSDOWN= Q="${Q}" \
TOPDIR="${TOPDIR}" \ TOPDIR="${TOPDIR}" \
@@ -1013,7 +1024,7 @@ CAL_PASSDOWN= Q="${Q}" \
MAKE_FILE=${MAKE_FILE} \ MAKE_FILE=${MAKE_FILE} \
CHMOD=${CHMOD} CHMOD=${CHMOD}
# The compelte list of makefile vars passed down to cscript/Makefile. # The compelte list of Makefile vars passed down to cscript/Makefile.
# #
CSCRIPT_PASSDOWN= Q="${Q}" \ CSCRIPT_PASSDOWN= Q="${Q}" \
BINDIR="${BINDIR}" \ BINDIR="${BINDIR}" \
@@ -1559,7 +1570,51 @@ have_fpos.h: have_fpos.c ${MAKE_FILE}
true; \ true; \
fi fi
fposval.h: fposval.c have_fpos.h have_offscl.h have_posscl.h \ have_fpos_pos.h: have_fpos_pos.c have_fpos.h have_posscl.h ${MAKE_FILE}
-${Q}rm -f have_fpos_pos have_fpos_pos.o fpos_tmp have_fpos_pos.h
${Q}echo 'forming have_fpos_pos.h'
${Q}echo '/*' > have_fpos_pos.h
${Q}echo ' * DO NOT EDIT -- generated by the Makefile' \
>> have_fpos_pos.h
${Q}echo ' */' >> have_fpos_pos.h
${Q}echo '' >> have_fpos_pos.h
${Q}echo '' >> have_fpos_pos.h
${Q}echo '#if !defined(__HAVE_FPOS_POS_H__)' >> have_fpos_pos.h
${Q}echo '#define __HAVE_FPOS_POS_H__' >> have_fpos_pos.h
${Q}echo '' >> have_fpos_pos.h
${Q}echo '' >> have_fpos_pos.h
${Q}echo '/* do we have fgetpos & fsetpos functions? */' \
>> have_fpos_pos.h
-${Q}rm -f have_fpos_pos.o have_fpos_pos
-${Q}${LCC} ${HAVE_FPOS_POS} ${ICFLAGS} have_fpos_pos.c -c \
2>/dev/null; true
-${Q}${LCC} ${ILDFLAGS} have_fpos_pos.o -o have_fpos_pos \
2>/dev/null; true
-${Q}${SHELL} -c "./have_fpos_pos > fpos_tmp 2>/dev/null" \
>/dev/null 2>&1; true
-${Q}if [ -s fpos_tmp ]; then \
cat fpos_tmp >> have_fpos_pos.h; \
else \
echo '#undef HAVE_FPOS_POS /* no */' >> have_fpos_pos.h; \
echo '' >> have_fpos_pos.h; \
echo '#undef FPOS_POS_BITS' >> have_fpos_pos.h; \
fi
${Q}echo '' >> have_fpos_pos.h
${Q}echo '' >> have_fpos_pos.h
${Q}echo '#endif /* !__HAVE_FPOS_POS_H__ */' >> have_fpos_pos.h
-${Q}rm -f have_fpos_pos have_fpos_pos.o fpos_tmp
${Q}echo 'have_fpos_pos.h formed'
-@if [ -z "${Q}" ]; then \
echo ''; \
echo '=-=-= start of $@ =-=-='; \
cat $@; \
echo '=-=-= end of $@ =-=-='; \
echo ''; \
else \
true; \
fi
fposval.h: fposval.c have_fpos.h have_fpos_pos.h have_offscl.h have_posscl.h \
endian_calc.h ${MAKE_FILE} endian_calc.h ${MAKE_FILE}
-${Q}rm -f fposv_tmp fposval fposval.o fposval.h -${Q}rm -f fposv_tmp fposval fposval.o fposval.h
${Q}echo 'forming fposval.h' ${Q}echo 'forming fposval.h'
@@ -2423,7 +2478,7 @@ sample/all:
## ##
# #
# The BSDI cdrom makefile expects certain files to be pre-built in a sub-dir # The BSDI cdrom Makefile expects certain files to be pre-built in a sub-dir
# called gen_h. This rule creats this sub-directory so that the release can # called gen_h. This rule creats this sub-directory so that the release can
# be shipped off to BSDI. You can ignore this rule. # be shipped off to BSDI. You can ignore this rule.
# #
@@ -2591,15 +2646,15 @@ chk: ./cal/regress.cal
# debug # debug
# #
# make env: # make env:
# * print major makefile variables # * print major Makefile variables
# #
# make mkdebug: # make mkdebug:
# * print major makefile variables # * print major Makefile variables
# * build anything not yet built # * build anything not yet built
# #
# make debug: # make debug:
# * remove everything that was previously built # * remove everything that was previously built
# * print major makefile variables # * print major Makefile variables
# * make everything # * make everything
# * run the regression tests # * run the regression tests
## ##
@@ -2612,6 +2667,7 @@ env:
@echo "LONG_BITS=${LONG_BITS}"; echo "" @echo "LONG_BITS=${LONG_BITS}"; echo ""
@echo "LONGLONG_BITS=${LONGLONG_BITS}"; echo "" @echo "LONGLONG_BITS=${LONGLONG_BITS}"; echo ""
@echo "HAVE_FPOS=${HAVE_FPOS}"; echo "" @echo "HAVE_FPOS=${HAVE_FPOS}"; echo ""
@echo "HAVE_FPOS_POS=${HAVE_FPOS_POS}"; echo ""
@echo "HAVE_OFFSCL=${HAVE_OFFSCL}"; echo "" @echo "HAVE_OFFSCL=${HAVE_OFFSCL}"; echo ""
@echo "HAVE_POSSCL=${HAVE_POSSCL}"; echo "" @echo "HAVE_POSSCL=${HAVE_POSSCL}"; echo ""
@echo "HAVE_CONST=${HAVE_CONST}"; echo "" @echo "HAVE_CONST=${HAVE_CONST}"; echo ""
@@ -3282,6 +3338,7 @@ file.o: fposval.h
file.o: hash.h file.o: hash.h
file.o: have_const.h file.o: have_const.h
file.o: have_fpos.h file.o: have_fpos.h
file.o: have_fpos_pos.h
file.o: have_malloc.h file.o: have_malloc.h
file.o: have_memmv.h file.o: have_memmv.h
file.o: have_newstr.h file.o: have_newstr.h
@@ -3299,6 +3356,7 @@ file.o: zmath.h
fposval.o: endian_calc.h fposval.o: endian_calc.h
fposval.o: fposval.c fposval.o: fposval.c
fposval.o: have_fpos.h fposval.o: have_fpos.h
fposval.o: have_fpos_pos.h
fposval.o: have_offscl.h fposval.o: have_offscl.h
fposval.o: have_posscl.h fposval.o: have_posscl.h
func.o: alloc.h func.o: alloc.h
@@ -3369,6 +3427,9 @@ hash.o: zrand.h
hash.o: zrandom.h hash.o: zrandom.h
have_const.o: have_const.c have_const.o: have_const.c
have_fpos.o: have_fpos.c have_fpos.o: have_fpos.c
have_fpos_pos.o: have_fpos.h
have_fpos_pos.o: have_fpos_pos.c
have_fpos_pos.o: have_posscl.h
have_getpgid.o: have_getpgid.c have_getpgid.o: have_getpgid.c
have_getprid.o: have_getprid.c have_getprid.o: have_getprid.c
have_getsid.o: have_getsid.c have_getsid.o: have_getsid.c

View File

@@ -116,6 +116,10 @@ bernoulli.cal
Calculate the nth Bernoulli number. Calculate the nth Bernoulli number.
NOTE: There is now a bernoulli() builtin function. This file is
left here for backward compatibility and now simply returns
the buildin function.
bigprime.cal bigprime.cal
@@ -752,8 +756,8 @@ xx_print.cal
## 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.
## ##
## @(#) $Revision: 29.3 $ ## @(#) $Revision: 29.4 $
## @(#) $Id: README,v 29.3 2000/12/04 20:11:52 chongo Exp $ ## @(#) $Id: README,v 29.4 2000/12/17 12:26:04 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/README,v $ ## @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/README,v $
## ##
## Under source code control: 1990/02/15 01:50:32 ## Under source code control: 1990/02/15 01:50:32

View File

@@ -1,7 +1,7 @@
/* /*
* bernoulli - clculate the Nth Bernoulli number B(n) * bernoulli - clculate the Nth Bernoulli number B(n)
* *
* Copyright (C) 1999 David I. Bell * Copyright (C) 2000 David I. Bell and Landon Curt Noll
* *
* Calc is open software; you can redistribute it and/or modify it under * Calc is open software; you can redistribute it and/or modify it under
* the terms of the version 2.1 of the GNU Lesser General Public License * the terms of the version 2.1 of the GNU Lesser General Public License
@@ -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.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
* *
* @(#) $Revision: 29.2 $ * @(#) $Revision: 29.3 $
* @(#) $Id: bernoulli.cal,v 29.2 2000/06/07 14:02:25 chongo Exp $ * @(#) $Id: bernoulli.cal,v 29.3 2000/12/17 12:26:04 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/bernoulli.cal,v $ * @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/bernoulli.cal,v $
* *
* Under source code control: 1991/09/30 11:18:41 * Under source code control: 1991/09/30 11:18:41
@@ -29,12 +29,16 @@
/* /*
* Calculate the Nth Bernoulli number B(n). * Calculate the Nth Bernoulli number B(n).
* This uses the following symbolic formula to calculate B(n): *
* NOTE: This is now a bulitin function.
*
* The non-buildin code used the following symbolic formula to calculate B(n):
* *
* (b+1)^(n+1) - b^(n+1) = 0 * (b+1)^(n+1) - b^(n+1) = 0
* *
* where b is a dummy value, and each power b^i gets replaced by B(i). * where b is a dummy value, and each power b^i gets replaced by B(i).
* For example, for n = 3: * For example, for n = 3:
*
* (b+1)^4 - b^4 = 0 * (b+1)^4 - b^4 = 0
* b^4 + 4*b^3 + 6*b^2 + 4*b + 1 - b^4 = 0 * b^4 + 4*b^3 + 6*b^2 + 4*b + 1 - b^4 = 0
* 4*b^3 + 6*b^2 + 4*b + 1 = 0 * 4*b^3 + 6*b^2 + 4*b + 1 = 0
@@ -48,11 +52,14 @@
*/ */
/*
static Bnmax; static Bnmax;
static mat Bn[1001]; static mat Bn[1001];
*/
define B(n) define B(n)
{ {
/*
local nn, np1, i, sum, mulval, divval, combval; local nn, np1, i, sum, mulval, divval, combval;
if (!isint(n) || (n < 0)) if (!isint(n) || (n < 0))
@@ -85,4 +92,6 @@ define B(n)
} }
Bnmax = n; Bnmax = n;
return Bn[n]; return Bn[n];
*/
return bernoulli(n);
} }

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.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
* *
* @(#) $Revision: 29.5 $ * @(#) $Revision: 29.6 $
* @(#) $Id: regress.cal,v 29.5 2000/12/04 20:00:53 chongo Exp $ * @(#) $Id: regress.cal,v 29.6 2000/12/17 12:26:42 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
@@ -1223,7 +1223,85 @@ define test_functions()
vrfy(hnrmod(21<<500+7,3,500,-1) == (21<<500+7)%(3<<500-1), vrfy(hnrmod(21<<500+7,3,500,-1) == (21<<500+7)%(3<<500-1),
'1112: hnrmod(21<<500+7,3,500,-1) == (21<<500+7)%(3<<500-1)'); '1112: hnrmod(21<<500+7,3,500,-1) == (21<<500+7)%(3<<500-1)');
print '1113: Ending test_functions'; /*
* catalan testing
*/
vrfy(catalan(2) == 2, '1113: catalan(2) == 2');
vrfy(catalan(3) == 5, '1114: catalan(3) == 5');
vrfy(catalan(4) == 14, '1115: catalan(4) == 14');
vrfy(catalan(20) == 6564120420, '1116: catalan(20) == 6564120420');
/*
* bernoulli builtin function testing
*/
vrfy(bernoulli(0) == 1, '1117: bernoulli(0) == 1');
vrfy(bernoulli(1) == -1/2, '1118: bernoulli(1) == -1/2');
vrfy(bernoulli(2) == 1/6, '1119: bernoulli(2) == 1/6');
vrfy(bernoulli(3) == 0, '1120: bernoulli(3) == 0');
vrfy(bernoulli(4) == -1/30, '1121: bernoulli(4) == -1/30');
vrfy(bernoulli(5) == 0, '1122: bernoulli(5) == 0');
vrfy(bernoulli(6) == 1/42, '1123: bernoulli(6) == 1/42');
vrfy(bernoulli(32) == -7709321041217/510,
'1124: bernoulli(32) == -7709321041217/510');
/*
* euler function testing
*/
vrfy(euler(0) == 1, '1125: euler(0) == 1');
vrfy(euler(1) == 0, '1126: euler(1) == 0');
vrfy(euler(2) == -1, '1127: euler(2) == -1');
vrfy(euler(3) == 0, '1128: euler(3) == 0');
vrfy(freeeuler() == null(), '1129: freeeuler() == null()');
vrfy(euler(4) == 5, '1130: euler(4) == 5');
vrfy(euler(5) == 0, '1131: euler(5) == 0');
vrfy(euler(6) == -61, '1132: euler(6) == -61');
vrfy(euler(32) == 177519391579539289436664789665,
'1130: euler(32) == 177519391579539289436664789665');
vrfy(freeeuler() == null(), '1133: freeeuler() == null()');
/*
* digit with non-10 base
*/
a = 123456.789;
print '1134: a = 123456.789';
vrfy(digit(a, 6, 100) == 0, '1135: digit(a, 6, 100) == 0');
vrfy(digit(a, 5, 100) == 0, '1136: digit(a, 5, 100) == 0');
vrfy(digit(a, 4, 100) == 0, '1137: digit(a, 4, 100) == 0');
vrfy(digit(a, 3, 100) == 0, '1138: digit(a, 3, 100) == 0');
vrfy(digit(a, 2, 100) == 12, '1139: digit(a, 2, 100) == 12');
vrfy(digit(a, 1, 100) == 34, '1140: digit(a, 1, 100) == 34');
vrfy(digit(a, 0, 100) == 56, '1141: digit(a, 0, 100) == 56');
vrfy(digit(a, -1, 100) == 78, '1142: digit(a, -1, 100) == 78');
vrfy(digit(a, -2, 100) == 90, '1143: digit(a, -2, 100) == 90');
vrfy(digit(a, -3, 100) == 0, '1144: digit(a, -3, 100) == 0');
vrfy(digit(a, -4, 100) == 0, '1145: digit(a, -4, 100) == 0');
vrfy(digit(a, -5, 100) == 0, '1146: digit(a, -5, 100) == 0');
vrfy(digit(a, -6, 100) == 0, '1146: digit(a, -6, 100) == 0');
/*
* digits with a non-10 base
*/
vrfy(digits(a, 100) == 3, '1147: digits(a, 100) == 3');
vrfy(digits(2^256-1, 256) == 32,'1148: digits(2^256-1, 256) == 32');
/*
* places with a non-10 base
*/
vrfy(places(0.0123, 2) == -1, '1149: places(0.0123, 2) == -1');
vrfy(places(0.625, 2) == 3, '1150: places(0.625, 2) == 3');
vrfy(places(0.625, 8) == 1, '1151: places(0.625, 8) == 1');
vrfy(places(171/2^712, 2) == 712,
'1152: places(171/2^7120.625, 2) == 712');
vrfy(places(171/2^712, 64) == 119,
'1152: places(171/2^7120.625, 64) == 119');
/*
* verify sleep
*/
vrfy(sleep(1/5) == null(), '1153: sleep(1/5) == null()');
vrfy(sleep(1) == null(), '1154: sleep(1) == null()');
print '1155: 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.
# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
# #
# @(#) $Revision: 29.2 $ # @(#) $Revision: 29.3 $
# @(#) $Id: Makefile,v 29.2 2000/06/07 14:03:03 chongo Exp $ # @(#) $Id: Makefile,v 29.3 2000/12/17 12:28:15 chongo Exp $
# @(#) $Source: /usr/local/src/cmd/calc/custom/RCS/Makefile,v $ # @(#) $Source: /usr/local/src/cmd/calc/custom/RCS/Makefile,v $
# #
# Under source code control: 1997/03/09 02:28:54 # Under source code control: 1997/03/09 02:28:54
@@ -406,7 +406,10 @@ depend:
echo '#endif /* '"$$tag"' */' >> "skel/custom/$$i"; \ echo '#endif /* '"$$tag"' */' >> "skel/custom/$$i"; \
done done
${Q}(cd ..; ${MAKE} hsrc) ${Q}(cd ..; ${MAKE} hsrc)
${Q}for i in `cd ..; ${MAKE} h_list`; do \ ${Q}for i in `cd ..; ${MAKE} h_list 2>&1 | \
${SED} -e '/Entering directory/d' \
-e '/Nothing to be done/d' \
-e '/Leaving directory/d'`; do \
tag="`echo $$i | ${SED} 's/[\.+,:]/_/g'`"; \ tag="`echo $$i | ${SED} 's/[\.+,:]/_/g'`"; \
echo "#if !defined($$tag)" > "skel/$$i"; \ echo "#if !defined($$tag)" > "skel/$$i"; \
echo "#define $$tag" >> "skel/$$i"; \ echo "#define $$tag" >> "skel/$$i"; \

10
file.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.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
* *
* @(#) $Revision: 29.2 $ * @(#) $Revision: 29.3 $
* @(#) $Id: file.c,v 29.2 2000/06/07 14:02:13 chongo Exp $ * @(#) $Id: file.c,v 29.3 2000/12/17 12:24:42 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/file.c,v $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/file.c,v $
* *
* Under source code control: 1991/07/20 00:21:56 * Under source code control: 1991/07/20 00:21:56
@@ -40,6 +40,7 @@
#include "calc.h" #include "calc.h"
#include "longbits.h" #include "longbits.h"
#include "have_fpos.h" #include "have_fpos.h"
#include "have_fpos_pos.h"
#include "fposval.h" #include "fposval.h"
#include "file.h" #include "file.h"
#include "calcerr.h" #include "calcerr.h"
@@ -1239,7 +1240,8 @@ z2filepos(ZVALUE zpos)
if (!zgtmaxfull(zpos)) { if (!zgtmaxfull(zpos)) {
/* ztofull puts the value into native byte order */ /* ztofull puts the value into native byte order */
pos = ztofull(zpos); pos = ztofull(zpos);
ret = pos; memset(&ret, 0, sizeof(FILEPOS));
memcpy((void *)&ret, (void *)&pos, sizeof(pos));
return ret; return ret;
} }
@@ -1251,7 +1253,7 @@ z2filepos(ZVALUE zpos)
memcpy(&tmp, zpos.v, sizeof(FILEPOS)); memcpy(&tmp, zpos.v, sizeof(FILEPOS));
} else { } else {
/* copy what bits we can into the temp value */ /* copy what bits we can into the temp value */
tmp = 0; memset(&tmp, 0, sizeof(FILEPOS));
memcpy(&tmp, zpos.v, zpos.len*BASEB/8); memcpy(&tmp, zpos.v, zpos.len*BASEB/8);
} }
/* swap into native byte order */ /* swap into native byte order */

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.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
* *
* @(#) $Revision: 29.2 $ * @(#) $Revision: 29.3 $
* @(#) $Id: fposval.c,v 29.2 2000/06/07 14:02:13 chongo Exp $ * @(#) $Id: fposval.c,v 29.3 2000/12/17 12:25:36 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/fposval.c,v $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/fposval.c,v $
* *
* Under source code control: 1994/11/05 03:19:52 * Under source code control: 1994/11/05 03:19:52
@@ -63,6 +63,7 @@
#include "endian_calc.h" #include "endian_calc.h"
#include "have_offscl.h" #include "have_offscl.h"
#include "have_posscl.h" #include "have_posscl.h"
#include "have_fpos_pos.h"
char *program; /* our name */ char *program; /* our name */
@@ -83,9 +84,14 @@ main(int argc, char **argv)
/* /*
* print the file position information * print the file position information
*/ */
#if defined(HAVE_FPOS_POS)
printf("#undef FILEPOS_BITS\n");
printf("#define FILEPOS_BITS %d\n", FPOS_POS_BITS);
#else /* ! HAVE_FPOS_POS */
fileposlen = sizeof(FILEPOS)*8; fileposlen = sizeof(FILEPOS)*8;
printf("#undef FILEPOS_BITS\n"); printf("#undef FILEPOS_BITS\n");
printf("#define FILEPOS_BITS %d\n", fileposlen); printf("#define FILEPOS_BITS %d\n", fileposlen);
#endif /* ! HAVE_FPOS_POS */
#if CALC_BYTE_ORDER == BIG_ENDIAN #if CALC_BYTE_ORDER == BIG_ENDIAN
/* /*
* Big Endian * Big Endian
@@ -113,8 +119,8 @@ main(int argc, char **argv)
* Normally a "(*(dest) = *(src))" would do, but on some * Normally a "(*(dest) = *(src))" would do, but on some
* systems a FILEPOS is not a scalar hince we must memcpy. * systems a FILEPOS is not a scalar hince we must memcpy.
*/ */
printf("#define SWAP_HALF_IN_FILEPOS(dest, src)\t%s%d%s\n", printf("#define SWAP_HALF_IN_FILEPOS(dest, src)\t%s\n",
"memcpy((void *)(dest), (void *)(src), sizeof(",fileposlen,"))"); "memcpy((void *)(dest), (void *)(src), sizeof(FPOS_POS_BITS))");
#endif /* HAVE_FILEPOS_SCALAR */ #endif /* HAVE_FILEPOS_SCALAR */
#endif /* CALC_BYTE_ORDER == BIG_ENDIAN */ #endif /* CALC_BYTE_ORDER == BIG_ENDIAN */
putchar('\n'); putchar('\n');

59
have_fpos_pos.c Normal file
View File

@@ -0,0 +1,59 @@
/*
* have_fpos_pos - Determine if a __pos element in FILEPOS
*
* Copyright (C) 2000 Landon Curt Noll
*
* Calc is open software; you can redistribute it and/or modify it under
* the terms of the version 2.1 of the GNU Lesser General Public License
* as published by the Free Software Foundation.
*
* Calc is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
* Public License for more details.
*
* A copy of version 2.1 of the GNU Lesser General Public License is
* distributed with calc under the filename COPYING-LGPL. You should have
* received a copy with calc; if not, write to Free Software Foundation, Inc.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*
* @(#) $Revision: 29.1 $
* @(#) $Id: have_fpos_pos.c,v 29.1 2000/12/17 11:25:22 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/have_fpos_pos.c,v $
*
* Under source code control: 2000/12/17 01:23
* File existed as early as: 2000
*
* chongo <was here> /\oo/\ http://www.isthe.com/chongo/
* Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
*/
/*
* If the symbol HAVE_NO_FPOS is defined, we will output nothing.
* If the HAVE_FILEPOS_SCALAR is defuned, we will output nothing.
* If we are able to compile this program, then we must have the
* __pos element in a non-scalar FILEPOS.
*/
#include <stdio.h>
#include "have_fpos.h"
#include "have_posscl.h"
int
main(void)
{
#if !defined(HAVE_NO_FPOS) && !defined(HAVE_FILEPOS_SCALAR)
fpos_t pos; /* file position */
/* print a __pos element in fpos_t */
printf("#undef HAVE_FPOS_POS\n");
printf("#define HAVE_FPOS_POS 1 /* yes */\n\n");
/* determine __pos element size */
printf("#undef FPOS_POS_BITS\n");
printf("#define FPOS_POS_BITS %d\n\n", sizeof(pos.__pos)*8);
#endif
/* exit(0); */
return 0;
}

View File

@@ -57,8 +57,8 @@ SEE ALSO
## 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.
## ##
## @(#) $Revision: 29.3 $ ## @(#) $Revision: 29.4 $
## @(#) $Id: bernoulli,v 29.3 2000/12/14 10:32:24 chongo Exp $ ## @(#) $Id: bernoulli,v 29.4 2000/12/17 12:27:58 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/bernoulli,v $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/bernoulli,v $
## ##
## Under source code control: 2000/07/13 01:33:00 ## Under source code control: 2000/07/13 01:33:00

View File

@@ -53,8 +53,8 @@ SEE ALSO
## 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.
## ##
## @(#) $Revision: 29.1 $ ## @(#) $Revision: 29.2 $
## @(#) $Id: catalan,v 29.1 2000/12/14 10:31:45 chongo Exp $ ## @(#) $Id: catalan,v 29.2 2000/12/17 12:27:58 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/catalan,v $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/catalan,v $
## ##
## Under source code control: 2000/12/14 01:33:00 ## Under source code control: 2000/12/14 01:33:00

View File

@@ -108,8 +108,8 @@ SEE ALSO
## 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.
## ##
## @(#) $Revision: 29.3 $ ## @(#) $Revision: 29.4 $
## @(#) $Id: digit,v 29.3 2000/12/14 10:32:24 chongo Exp $ ## @(#) $Id: digit,v 29.4 2000/12/17 12:27:58 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/digit,v $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/digit,v $
## ##
## Under source code control: 1995/10/03 10:40:01 ## Under source code control: 1995/10/03 10:40:01

View File

@@ -53,8 +53,8 @@ SEE ALSO
## 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.
## ##
## @(#) $Revision: 29.1 $ ## @(#) $Revision: 29.2 $
## @(#) $Id: euler,v 29.1 2000/12/14 10:31:45 chongo Exp $ ## @(#) $Id: euler,v 29.2 2000/12/17 12:27:58 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/euler,v $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/euler,v $
## ##
## Under source code control: 2000/12/14 01:33:00 ## Under source code control: 2000/12/14 01:33:00

View File

@@ -53,8 +53,8 @@ SEE ALSO
## 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.
## ##
## @(#) $Revision: 29.3 $ ## @(#) $Revision: 29.4 $
## @(#) $Id: places,v 29.3 2000/12/14 10:32:24 chongo Exp $ ## @(#) $Id: places,v 29.4 2000/12/17 12:27:58 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/places,v $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/places,v $
## ##
## Under source code control: 1995/10/03 10:40:02 ## Under source code control: 1995/10/03 10:40:02

View File

@@ -58,8 +58,8 @@ SEE ALSO
## 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.
## ##
## @(#) $Revision: 29.1 $ ## @(#) $Revision: 29.2 $
## @(#) $Id: sleep,v 29.1 2000/12/14 10:31:45 chongo Exp $ ## @(#) $Id: sleep,v 29.2 2000/12/17 12:27:58 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/sleep,v $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/sleep,v $
## ##
## Under source code control: 2000/12/14 01:33:00 ## Under source code control: 2000/12/14 01:33:00

34
qfunc.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.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
* *
* @(#) $Revision: 29.3 $ * @(#) $Revision: 29.4 $
* @(#) $Id: qfunc.c,v 29.3 2000/07/17 15:35:49 chongo Exp $ * @(#) $Id: qfunc.c,v 29.4 2000/12/17 13:07:32 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/qfunc.c,v $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/qfunc.c,v $
* *
* Under source code control: 1990/02/15 01:48:20 * Under source code control: 1990/02/15 01:48:20
@@ -976,6 +976,7 @@ qbern(ZVALUE z)
long n, i, k, m, nn, dd; long n, i, k, m, nn, dd;
NUMBER **p; NUMBER **p;
NUMBER *s, *s1, *c, *c1, *t; NUMBER *s, *s1, *c, *c1, *t;
size_t sz;
if (zisone(z)) if (zisone(z))
return qlink(&_qneghalf_); return qlink(&_qneghalf_);
@@ -999,15 +1000,15 @@ qbern(ZVALUE z)
if (m >= B_allocnum) { if (m >= B_allocnum) {
k = (m/QALLOCNUM + 1) * QALLOCNUM; k = (m/QALLOCNUM + 1) * QALLOCNUM;
sz = k * sizeof(NUMBER *);
if (sz < (size_t) k)
return NULL;
if (B_allocnum == 0) if (B_allocnum == 0)
p = (NUMBER **) malloc(k * sizeof(NUMBER *)); p = (NUMBER **) malloc(sz);
else else
p = (NUMBER **) realloc(B_table, p = (NUMBER **) realloc(B_table, sz);
k * sizeof(NUMBER *)); if (p == NULL)
if (p == NULL) { return NULL;
math_error("Not enough memory for Bernoulli numbers");
/*NOTREACHED*/
}
B_allocnum = k; B_allocnum = k;
B_table = p; B_table = p;
} }
@@ -1069,6 +1070,7 @@ qeuler(ZVALUE z)
long i, k, m, n, nn, dd; long i, k, m, n, nn, dd;
NUMBER **p; NUMBER **p;
NUMBER *s, *s1, *c, *c1, *t; NUMBER *s, *s1, *c, *c1, *t;
size_t sz;
if (ziszero(z)) if (ziszero(z))
@@ -1081,11 +1083,15 @@ qeuler(ZVALUE z)
m = (n >> 1) - 1; m = (n >> 1) - 1;
if (m < E_num) if (m < E_num)
return qlink(E_table[m]); return qlink(E_table[m]);
p = (NUMBER **) realloc(E_table, (m + 1) * sizeof(NUMBER *)); sz = (m + 1) * sizeof(NUMBER *);
if (p == NULL) { if (sz < (size_t) m + 1)
math_error("Unable to allocate memory for Euler numbers"); return NULL;
/*NOTREACHED*/ if (E_num)
} p = (NUMBER **) realloc(E_table, sz);
else
p = (NUMBER **) malloc(sz);
if (p == NULL)
return NULL;
E_table = p; E_table = p;
for (k = E_num; k <= m; k++) { for (k = E_num; k <= m; k++) {
nn = 2 * k + 2; nn = 2 * k + 2;

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.
# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
# #
# @(#) $Revision: 29.2 $ # @(#) $Revision: 29.3 $
# @(#) $Id: Makefile,v 29.2 2000/06/07 14:02:54 chongo Exp $ # @(#) $Id: Makefile,v 29.3 2000/12/17 12:28:31 chongo Exp $
# @(#) $Source: /usr/local/src/cmd/calc/sample/RCS/Makefile,v $ # @(#) $Source: /usr/local/src/cmd/calc/sample/RCS/Makefile,v $
# #
# Under source code control: 1997/04/19 22:46:49 # Under source code control: 1997/04/19 22:46:49
@@ -378,7 +378,10 @@ depend:
fi; \ fi; \
done done
${Q}(cd ..; ${MAKE} hsrc) ${Q}(cd ..; ${MAKE} hsrc)
${Q}for i in `cd ..; ${MAKE} h_list`; do \ ${Q}for i in `cd ..; ${MAKE} h_list 2>&1 | \
${SED} -e '/Entering directory/d' \
-e '/Nothing to be done/d' \
-e '/Leaving directory/d'`; do \
tag="`echo $$i | ${SED} 's/[\.+,:]/_/g'`"; \ tag="`echo $$i | ${SED} 's/[\.+,:]/_/g'`"; \
echo "#if !defined($$tag)" > "skel/$$i"; \ echo "#if !defined($$tag)" > "skel/$$i"; \
echo "#define $$tag" >> "skel/$$i"; \ echo "#define $$tag" >> "skel/$$i"; \

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.
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
* *
* @(#) $Revision: 29.17 $ * @(#) $Revision: 29.18 $
* @(#) $Id: version.c,v 29.17 2000/12/15 14:58:20 chongo Exp $ * @(#) $Id: version.c,v 29.18 2000/12/17 12:31:05 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
@@ -43,7 +43,7 @@ static char *program;
#define MAJOR_VER 2 /* major version */ #define MAJOR_VER 2 /* major version */
#define MINOR_VER 11 /* minor version */ #define MINOR_VER 11 /* minor version */
#define MAJOR_PATCH 4 /* patch level or 0 if no patch */ #define MAJOR_PATCH 4 /* patch level or 0 if no patch */
#define MINOR_PATCH "1" /* test number or empty string if no patch */ #define MINOR_PATCH "2" /* test number or empty string if no patch */
/* /*
* calc version constants * calc version constants