mirror of
https://github.com/lcn2/calc.git
synced 2025-08-19 01:13:27 +03:00
Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
3d55811205 | ||
|
296aa50ac7 | ||
|
5e098d2adf |
48
CHANGES
48
CHANGES
@@ -1,4 +1,44 @@
|
||||
The following are the changes from calc version 2.11.3t0 to date:
|
||||
The following are the changes from calc version 2.11.4t1 to date:
|
||||
|
||||
Added missing test8600.cal test file.
|
||||
|
||||
Fixes cscript files to deal with the -S flag being replaced by
|
||||
-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:
|
||||
|
||||
Increased the maximum number of args for functions from 100 to 1024.
|
||||
Increased calc's internal evaluation stack from 1024 to 2048 args.
|
||||
Added test8600.cal to the regression suite to test these new limits.
|
||||
|
||||
Updated and fixed misc typos in calc/README.
|
||||
|
||||
Clarified in the COPYING file that ALL calc source files, both
|
||||
LGPL covered and exceptions to the LGPL files may be freely used
|
||||
and distributed.
|
||||
|
||||
Added help files or updated for: bernoulli, calc_tty, catalan,
|
||||
digit, digits, euler, freeeuler, places and sleep.
|
||||
|
||||
A collection of 18 patches from Ernest Bowen
|
||||
<ernie at turing dot une dot edu dot au>:
|
||||
@@ -167,7 +207,7 @@ The following are the changes from calc version 2.11.3t0 to date:
|
||||
size of n in digit(x, n, b), for example, digit(1/7, -1e100) which
|
||||
would not work before can now be handled.
|
||||
|
||||
(13) The function, digits(x)m which returns the number of decimal
|
||||
(13) The function, digits(x), which returns the number of decimal
|
||||
digits in the integer part of x has been changed so that if abs(x) <
|
||||
1, it returns 0 rather than 1. This also now applies to digits(x,b).
|
||||
|
||||
@@ -4998,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.
|
||||
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
##
|
||||
## @(#) $Revision: 29.11 $
|
||||
## @(#) $Id: CHANGES,v 29.11 2000/06/07 15:51:35 chongo Exp chongo $
|
||||
## @(#) $Revision: 29.16 $
|
||||
## @(#) $Id: CHANGES,v 29.16 2000/12/17 13:07:54 chongo Exp $
|
||||
## @(#) $Source: /usr/local/src/cmd/calc/RCS/CHANGES,v $
|
||||
##
|
||||
## Under source code control: 1993/06/02 18:12:57
|
||||
|
10
COPYING
10
COPYING
@@ -12,8 +12,8 @@ This file is Copyrighted
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
# @(#) $Revision: 29.2 $
|
||||
# @(#) $Id: COPYING,v 29.2 2000/06/07 14:02:13 chongo Exp $
|
||||
# @(#) $Revision: 29.3 $
|
||||
# @(#) $Id: COPYING,v 29.3 2000/12/14 09:18:06 chongo Exp $
|
||||
# @(#) $Source: /usr/local/src/cmd/calc/RCS/COPYING,v $
|
||||
|
||||
=-=
|
||||
@@ -167,6 +167,12 @@ Calc copyrights and exception files
|
||||
top of this file. It is important to note that you may distribute
|
||||
verbatim copies of this file but you may not modify this file.
|
||||
|
||||
Some of these exception files are in the public domain. Other
|
||||
exception files have non-LGPL Copyrights. In all cases one may
|
||||
use and distribute these exception files freely. And because one
|
||||
may freely distribute the LGPL covered files, the entire calc
|
||||
source may be freely used and distributed.
|
||||
|
||||
=-=
|
||||
|
||||
General Copyleft and License info
|
||||
|
135
Makefile
135
Makefile
@@ -20,8 +20,8 @@
|
||||
# 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.9 $
|
||||
# @(#) $Id: Makefile.ship,v 29.9 2000/06/07 15:50:19 chongo Exp $
|
||||
# @(#) $Revision: 29.10 $
|
||||
# @(#) $Id: Makefile.ship,v 29.10 2000/12/17 12:23:29 chongo Exp $
|
||||
# @(#) $Source: /usr/local/src/cmd/calc/RCS/Makefile.ship,v $
|
||||
#
|
||||
# Under source code control: 1990/02/15 01:48:41
|
||||
@@ -42,7 +42,7 @@
|
||||
#
|
||||
# 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_TERMIO use struct termios from <termio.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
|
||||
# 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_VSPRINTF is set to -DDONT_HAVE_VSPRINTF then calc will hope that
|
||||
# sprintf() will work.
|
||||
@@ -78,7 +78,7 @@ HAVE_VSPRINTF=
|
||||
# Big Endian: Amdahl, 68k, Pyramid, Mips, Sparc, ...
|
||||
# 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
|
||||
# the endian program. If you get syntax errors when you compile,
|
||||
# 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
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# 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
|
||||
# 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
|
||||
# is set to -DHAVE_NO_FPOS, then calc will use ftell() and fseek().
|
||||
#
|
||||
@@ -134,11 +134,22 @@ LONGLONG_BITS=
|
||||
HAVE_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,
|
||||
# assignments and comparisons. On some systems off_t is some sort of union
|
||||
# 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
|
||||
# -DOFF_T_NON_SCALAR when calc will assume that off_t some sort of
|
||||
# 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
|
||||
# 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
|
||||
# (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
|
||||
@@ -166,7 +177,7 @@ HAVE_POSSCL=
|
||||
|
||||
# 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,
|
||||
# then calc will not use const.
|
||||
#
|
||||
@@ -177,7 +188,7 @@ HAVE_CONST=
|
||||
|
||||
# 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,
|
||||
# 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.
|
||||
@@ -189,7 +200,7 @@ HAVE_UID_T=
|
||||
|
||||
# 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
|
||||
# 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
|
||||
@@ -202,7 +213,7 @@ HAVE_NEWSTR=
|
||||
|
||||
# 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
|
||||
# -DHAVE_NO_MEMMOVE, then calc will use internal functions to simulate
|
||||
# the memory move function that does correct overlapping memory modes.
|
||||
@@ -214,7 +225,7 @@ HAVE_MEMMOVE=
|
||||
|
||||
# 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
|
||||
# -DHAVE_NO_USTAT, then calc will use internal functions to simulate
|
||||
# the memory move function that does correct overlapping memory modes.
|
||||
@@ -226,7 +237,7 @@ HAVE_USTAT=
|
||||
|
||||
# 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
|
||||
# -DHAVE_NO_GETSID, then calc will use internal functions to simulate
|
||||
# the memory move function that does correct overlapping memory modes.
|
||||
@@ -238,7 +249,7 @@ HAVE_GETSID=
|
||||
|
||||
# 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
|
||||
# -DHAVE_NO_GETPGID, then calc will use internal functions to simulate
|
||||
# the memory move function that does correct overlapping memory modes.
|
||||
@@ -250,7 +261,7 @@ HAVE_GETPGID=
|
||||
|
||||
# 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
|
||||
# -DHAVE_NO_GETTIME, then calc will use internal functions to simulate
|
||||
# the memory move function that does correct overlapping memory modes.
|
||||
@@ -262,7 +273,7 @@ HAVE_GETTIME=
|
||||
|
||||
# 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
|
||||
# -DHAVE_NO_GETPRID, then calc will use internal functions to simulate
|
||||
# the memory move function that does correct overlapping memory modes.
|
||||
@@ -274,7 +285,7 @@ HAVE_GETPRID=
|
||||
|
||||
# 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
|
||||
# -DHAVE_NO_URANDOM, then calc will use internal functions to simulate
|
||||
# the memory move function that does correct overlapping memory modes.
|
||||
@@ -286,7 +297,7 @@ HAVE_URANDOM=
|
||||
|
||||
# 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
|
||||
# -DHAVE_NO_GETRUSAGE, then calc will use internal functions to simulate
|
||||
# the memory move function that does correct overlapping memory modes.
|
||||
@@ -298,7 +309,7 @@ HAVE_GETRUSAGE=
|
||||
|
||||
# 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
|
||||
# -DHAVE_NO_STRDUP, then calc will use internal functions to simulate
|
||||
# the memory move function that does correct overlapping memory modes.
|
||||
@@ -824,8 +835,8 @@ ECHO= /bin/echo
|
||||
|
||||
# Makefile debug
|
||||
#
|
||||
# Q=@ do not echo internal makefile actions (quiet mode)
|
||||
# Q= echo internal makefile actions (debug / verbose mode)
|
||||
# Q=@ do not echo internal Makefile actions (quiet mode)
|
||||
# Q= echo internal Makefile actions (debug / verbose mode)
|
||||
#
|
||||
# V=@: do not echo debug statements (quiet 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
|
||||
#
|
||||
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_stdlib.h have_string.h have_times.h have_uid_t.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 \
|
||||
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_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.
|
||||
#
|
||||
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_stdvs.o have_varvs.o have_posscl.o have_memmv.o \
|
||||
have_const.o fposval.o have_fpos.o have_fpos_pos.o longlong.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_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_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}" \
|
||||
TOPDIR="${TOPDIR}" \
|
||||
@@ -964,7 +975,7 @@ CUSTOM_PASSDOWN= Q="${Q}" \
|
||||
MAKEDEPEND=${MAKEDEPEND} \
|
||||
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}" \
|
||||
TOPDIR="${TOPDIR}" \
|
||||
@@ -991,7 +1002,7 @@ SAMPLE_PASSDOWN= Q="${Q}" \
|
||||
CHMOD=${CHMOD} \
|
||||
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}" \
|
||||
TOPDIR="${TOPDIR}" \
|
||||
@@ -1005,7 +1016,7 @@ HELP_PASSDOWN= Q="${Q}" \
|
||||
CHMOD=${CHMOD} \
|
||||
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}" \
|
||||
TOPDIR="${TOPDIR}" \
|
||||
@@ -1013,7 +1024,7 @@ CAL_PASSDOWN= Q="${Q}" \
|
||||
MAKE_FILE=${MAKE_FILE} \
|
||||
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}" \
|
||||
BINDIR="${BINDIR}" \
|
||||
@@ -1559,7 +1570,51 @@ have_fpos.h: have_fpos.c ${MAKE_FILE}
|
||||
true; \
|
||||
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}
|
||||
-${Q}rm -f fposv_tmp fposval fposval.o 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
|
||||
# be shipped off to BSDI. You can ignore this rule.
|
||||
#
|
||||
@@ -2591,15 +2646,15 @@ chk: ./cal/regress.cal
|
||||
# debug
|
||||
#
|
||||
# make env:
|
||||
# * print major makefile variables
|
||||
# * print major Makefile variables
|
||||
#
|
||||
# make mkdebug:
|
||||
# * print major makefile variables
|
||||
# * print major Makefile variables
|
||||
# * build anything not yet built
|
||||
#
|
||||
# make debug:
|
||||
# * remove everything that was previously built
|
||||
# * print major makefile variables
|
||||
# * print major Makefile variables
|
||||
# * make everything
|
||||
# * run the regression tests
|
||||
##
|
||||
@@ -2612,6 +2667,7 @@ env:
|
||||
@echo "LONG_BITS=${LONG_BITS}"; echo ""
|
||||
@echo "LONGLONG_BITS=${LONGLONG_BITS}"; echo ""
|
||||
@echo "HAVE_FPOS=${HAVE_FPOS}"; echo ""
|
||||
@echo "HAVE_FPOS_POS=${HAVE_FPOS_POS}"; echo ""
|
||||
@echo "HAVE_OFFSCL=${HAVE_OFFSCL}"; echo ""
|
||||
@echo "HAVE_POSSCL=${HAVE_POSSCL}"; echo ""
|
||||
@echo "HAVE_CONST=${HAVE_CONST}"; echo ""
|
||||
@@ -3282,6 +3338,7 @@ file.o: fposval.h
|
||||
file.o: hash.h
|
||||
file.o: have_const.h
|
||||
file.o: have_fpos.h
|
||||
file.o: have_fpos_pos.h
|
||||
file.o: have_malloc.h
|
||||
file.o: have_memmv.h
|
||||
file.o: have_newstr.h
|
||||
@@ -3299,6 +3356,7 @@ file.o: zmath.h
|
||||
fposval.o: endian_calc.h
|
||||
fposval.o: fposval.c
|
||||
fposval.o: have_fpos.h
|
||||
fposval.o: have_fpos_pos.h
|
||||
fposval.o: have_offscl.h
|
||||
fposval.o: have_posscl.h
|
||||
func.o: alloc.h
|
||||
@@ -3369,6 +3427,9 @@ hash.o: zrand.h
|
||||
hash.o: zrandom.h
|
||||
have_const.o: have_const.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_getprid.o: have_getprid.c
|
||||
have_getsid.o: have_getsid.c
|
||||
|
4
addop.c
4
addop.c
@@ -19,8 +19,8 @@
|
||||
* 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.2 $
|
||||
* @(#) $Id: addop.c,v 29.2 2000/06/07 14:02:13 chongo Exp chongo $
|
||||
* @(#) $Revision: 29.3 $
|
||||
* @(#) $Id: addop.c,v 29.3 2000/07/17 15:35:49 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/addop.c,v $
|
||||
*
|
||||
* Under source code control: 1990/02/15 01:48:10
|
||||
|
@@ -18,8 +18,8 @@
|
||||
# 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.2 $
|
||||
# @(#) $Id: Makefile,v 29.2 2000/06/07 14:02:25 chongo Exp $
|
||||
# @(#) $Revision: 29.3 $
|
||||
# @(#) $Id: Makefile,v 29.3 2000/12/15 14:42:52 chongo Exp $
|
||||
# @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/Makefile,v $
|
||||
#
|
||||
# Under source code control: 1991/07/21 05:00:54
|
||||
@@ -70,7 +70,7 @@ CALC_FILES= README bigprime.cal deg.cal ellip.cal lucas.cal lucas_chk.cal \
|
||||
test3500.cal seedrandom.cal test4000.cal test4100.cal test4600.cal \
|
||||
beer.cal hello.cal test5100.cal test5200.cal randombitrun.cal \
|
||||
randomrun.cal xx_print.cal natnumset.cal qtime.cal test8400.cal \
|
||||
test8500.cal
|
||||
test8500.cal test8600.cal
|
||||
|
||||
# These files are found (but not built) in the distribution
|
||||
#
|
||||
|
59
cal/README
59
cal/README
@@ -1,7 +1,7 @@
|
||||
Calc standard resource files
|
||||
----------------------------
|
||||
|
||||
To load a reosurce file, try:
|
||||
To load a resource file, try:
|
||||
|
||||
read filename
|
||||
|
||||
@@ -59,7 +59,7 @@ files have already been read, the read -once will act as a noop.
|
||||
|
||||
The "resource_debug" parameter is intended for controlling the possible
|
||||
display of special information relating to functions, objects, and
|
||||
other structures created by instructions in calc resoure files.
|
||||
other structures created by instructions in calc resource files.
|
||||
Zero value of config("resource_debug") means that no such information
|
||||
is displayed. For other values, the non-zero bits which currently
|
||||
have meanings are as follows:
|
||||
@@ -116,6 +116,10 @@ bernoulli.cal
|
||||
|
||||
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
|
||||
|
||||
@@ -274,7 +278,7 @@ pell.cal
|
||||
pell(D)
|
||||
|
||||
Solve Pell's equation; Returns the solution X to: X^2 - D * Y^2 = 1.
|
||||
Type the solution to pells equation for a particular D.
|
||||
Type the solution to Pell's equation for a particular D.
|
||||
|
||||
|
||||
pi.cal
|
||||
@@ -288,7 +292,7 @@ pi.cal
|
||||
The piforever() prints digits of pi, nicely formatted, for as long
|
||||
as your free memory space and system up time allows.
|
||||
|
||||
The piforever() funcion (written by Klaus Alexander Seistrup
|
||||
The piforever() function (written by Klaus Alexander Seistrup
|
||||
<klaus@seistrup.dk>) was inspired by an algorithm conceived by
|
||||
Lambert Meertens. See also the ABC Programmer's Handbook, by Geurts,
|
||||
Meertens & Pemberton, published by Prentice-Hall (UK) Ltd., 1990.
|
||||
@@ -356,7 +360,7 @@ quat.cal
|
||||
quat_shift(a, b)
|
||||
|
||||
Calculate using quaternions of the form: a + bi + cj + dk. In these
|
||||
functions, quaternians are manipulated in the form: s + v, where
|
||||
functions, quaternions are manipulated in the form: s + v, where
|
||||
s is a scalar and v is a vector of size 3.
|
||||
|
||||
|
||||
@@ -386,7 +390,7 @@ randombitrun.cal
|
||||
randombitrun([run_cnt])
|
||||
|
||||
Using randombit(1) to generate a sequence of random bits, determine if
|
||||
the number and kength of identical bits runs match what is expected.
|
||||
the number and length of identical bits runs match what is expected.
|
||||
By default, run_cnt is to test the next 65536 random values.
|
||||
|
||||
This tests the Blum-Blum-Shub generator.
|
||||
@@ -489,7 +493,7 @@ test1700.cal
|
||||
|
||||
value
|
||||
|
||||
This resoure files is used by regress.cal to test the read and use keywords.
|
||||
This resource files is used by regress.cal to test the read and use keywords.
|
||||
|
||||
|
||||
test2600.cal
|
||||
@@ -514,7 +518,7 @@ test2600.cal
|
||||
checkresult(x, y, z, a)
|
||||
test2600(verbose, tnum)
|
||||
|
||||
This resoure files is used by regress.cal to test some of builtin functions
|
||||
This resource files is used by regress.cal to test some of builtin functions
|
||||
in terms of accuracy and roundoff.
|
||||
|
||||
|
||||
@@ -537,7 +541,7 @@ test2700.cal
|
||||
iscomsq(x)
|
||||
test2700(verbose, tnum)
|
||||
|
||||
This resoure files is used by regress.cal to test sqrt() for real and
|
||||
This resource files is used by regress.cal to test sqrt() for real and
|
||||
complex values.
|
||||
|
||||
|
||||
@@ -625,7 +629,7 @@ test4000.cal
|
||||
test4000(verbose, tnum) defined
|
||||
|
||||
This resource file is used by regress.cal to test ptest, nextcand and
|
||||
prevcand buildins.
|
||||
prevcand builtins.
|
||||
|
||||
test4100.cal
|
||||
|
||||
@@ -677,6 +681,35 @@ test5200.cal
|
||||
This resource file is used by regress.cal to test the fix of a
|
||||
global/static bug.
|
||||
|
||||
test8400.cal
|
||||
|
||||
test8400() defined
|
||||
|
||||
This resource file is used by regress.cal to check for quit-based
|
||||
memory leaks.
|
||||
|
||||
test8500.cal
|
||||
|
||||
global err_8500
|
||||
global L_8500
|
||||
global ver_8500
|
||||
global old_seed_8500
|
||||
global cfg_8500
|
||||
onetest_8500(a,b,rnd) defined
|
||||
divmod_8500(N, M1, M2, testnum) defined
|
||||
|
||||
This resource file is used by regress.cal to the // and % operators.
|
||||
|
||||
test8600.cal
|
||||
|
||||
global min_8600
|
||||
global max_8600
|
||||
global hash_8600
|
||||
global hmean_8600
|
||||
|
||||
This resource file is used by regress.cal to test a change of
|
||||
allowing up to 1024 args to be passed to a builtin function.
|
||||
|
||||
unitfrac.cal
|
||||
|
||||
unitfrac(x)
|
||||
@@ -705,7 +738,7 @@ xx_print.cal
|
||||
|
||||
Demo for the xx_print object routines.
|
||||
|
||||
## Copyright (C) 1999 David I. Bell and Landon Curt Noll
|
||||
## Copyright (C) 2000 David I. Bell and Landon Curt Noll
|
||||
##
|
||||
## Primary author: Landon Curt Noll
|
||||
##
|
||||
@@ -723,8 +756,8 @@ xx_print.cal
|
||||
## 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.2 $
|
||||
## @(#) $Id: README,v 29.2 2000/06/07 14:02:25 chongo Exp $
|
||||
## @(#) $Revision: 29.4 $
|
||||
## @(#) $Id: README,v 29.4 2000/12/17 12:26:04 chongo Exp $
|
||||
## @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/README,v $
|
||||
##
|
||||
## Under source code control: 1990/02/15 01:50:32
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* 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
|
||||
* 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.
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* @(#) $Revision: 29.2 $
|
||||
* @(#) $Id: bernoulli.cal,v 29.2 2000/06/07 14:02:25 chongo Exp $
|
||||
* @(#) $Revision: 29.3 $
|
||||
* @(#) $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 $
|
||||
*
|
||||
* Under source code control: 1991/09/30 11:18:41
|
||||
@@ -29,12 +29,16 @@
|
||||
|
||||
/*
|
||||
* 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
|
||||
*
|
||||
* where b is a dummy value, and each power b^i gets replaced by B(i).
|
||||
* For example, for n = 3:
|
||||
*
|
||||
* (b+1)^4 - 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
|
||||
@@ -48,11 +52,14 @@
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
static Bnmax;
|
||||
static mat Bn[1001];
|
||||
*/
|
||||
|
||||
define B(n)
|
||||
{
|
||||
/*
|
||||
local nn, np1, i, sum, mulval, divval, combval;
|
||||
|
||||
if (!isint(n) || (n < 0))
|
||||
@@ -85,4 +92,6 @@ define B(n)
|
||||
}
|
||||
Bnmax = n;
|
||||
return Bn[n];
|
||||
*/
|
||||
return bernoulli(n);
|
||||
}
|
||||
|
@@ -17,8 +17,8 @@
|
||||
* 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.3 $
|
||||
* @(#) $Id: regress.cal,v 29.3 2000/06/07 14:02:25 chongo Exp chongo $
|
||||
* @(#) $Revision: 29.6 $
|
||||
* @(#) $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 $
|
||||
*
|
||||
* 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),
|
||||
'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()';
|
||||
|
||||
@@ -7538,6 +7616,15 @@ read -once "test8500";
|
||||
/* 85xx: Ending test_divmod is printed by test8500.cal */
|
||||
|
||||
|
||||
/*
|
||||
* test_maxargs - test up to 1024 args being passed to a builtin function
|
||||
*/
|
||||
print;
|
||||
print '8600: Starting test_1024args'
|
||||
read -once "test8600";
|
||||
/* 86xx: Ending test_1024args is printed by test8600.cal */
|
||||
|
||||
|
||||
/*
|
||||
* read various calc resource files
|
||||
*
|
||||
|
1406
cal/test8600.cal
Normal file
1406
cal/test8600.cal
Normal file
File diff suppressed because it is too large
Load Diff
4
calc.c
4
calc.c
@@ -19,8 +19,8 @@
|
||||
* 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.4 $
|
||||
* @(#) $Id: calc.c,v 29.4 2000/06/07 14:02:13 chongo Exp chongo $
|
||||
* @(#) $Revision: 29.5 $
|
||||
* @(#) $Id: calc.c,v 29.5 2000/07/17 15:35:49 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/calc.c,v $
|
||||
*
|
||||
* Under source code control: 1990/02/15 01:48:11
|
||||
|
6
calc.h
6
calc.h
@@ -17,8 +17,8 @@
|
||||
* 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.3 $
|
||||
* @(#) $Id: calc.h,v 29.3 2000/06/07 14:02:13 chongo Exp chongo $
|
||||
* @(#) $Revision: 29.5 $
|
||||
* @(#) $Id: calc.h,v 29.5 2000/12/04 19:32:33 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/calc.h,v $
|
||||
*
|
||||
* Under source code control: 1990/02/15 01:48:31
|
||||
@@ -62,7 +62,7 @@
|
||||
#define SYMBOLSIZE 256 /* maximum symbol name size */
|
||||
#define MAXLABELS 100 /* maximum number of user labels in function */
|
||||
#define MAXSTRING 1024 /* maximum size of string constant */
|
||||
#define MAXSTACK 1000 /* maximum depth of evaluation stack */
|
||||
#define MAXSTACK 2048 /* maximum depth of evaluation stack */
|
||||
#define MAXFILES 20 /* maximum number of opened files */
|
||||
#define PROMPT1 "> " /* default normal prompt*/
|
||||
#define PROMPT2 ">> " /* default prompt inside multi-line input */
|
||||
|
@@ -17,8 +17,8 @@
|
||||
# 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.2 $
|
||||
# @(#) $Id: calcerr.tbl,v 29.2 2000/06/07 14:02:13 chongo Exp chongo $
|
||||
# @(#) $Revision: 29.3 $
|
||||
# @(#) $Id: calcerr.tbl,v 29.3 2000/07/17 15:35:49 chongo Exp $
|
||||
# @(#) $Source: /usr/local/src/cmd/calc/RCS/calcerr.tbl,v $
|
||||
#
|
||||
# Under source code control: 1996/05/23 17:38:44
|
||||
|
4
cmath.h
4
cmath.h
@@ -17,8 +17,8 @@
|
||||
* 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.2 $
|
||||
* @(#) $Id: cmath.h,v 29.2 2000/06/07 14:02:13 chongo Exp chongo $
|
||||
* @(#) $Revision: 29.3 $
|
||||
* @(#) $Id: cmath.h,v 29.3 2000/07/17 15:35:49 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/cmath.h,v $
|
||||
*
|
||||
* Under source code control: 1993/07/30 19:42:45
|
||||
|
@@ -19,8 +19,8 @@
|
||||
* 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.2 $
|
||||
* @(#) $Id: codegen.c,v 29.2 2000/06/07 14:02:13 chongo Exp chongo $
|
||||
* @(#) $Revision: 29.3 $
|
||||
* @(#) $Id: codegen.c,v 29.3 2000/07/17 15:35:49 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/codegen.c,v $
|
||||
*
|
||||
* Under source code control: 1990/02/15 01:48:13
|
||||
@@ -162,6 +162,7 @@ getcommands(BOOL toplevel)
|
||||
}
|
||||
for (;;) {
|
||||
if (getfilename(name, &rdonce))
|
||||
break;
|
||||
switch (opensearchfile(name,calcpath,
|
||||
CALCEXT,rdonce)) {
|
||||
case 0:
|
||||
|
@@ -19,8 +19,8 @@
|
||||
* 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.2 $
|
||||
* @(#) $Id: comfunc.c,v 29.2 2000/06/07 14:02:13 chongo Exp chongo $
|
||||
* @(#) $Revision: 29.3 $
|
||||
* @(#) $Id: comfunc.c,v 29.3 2000/07/17 15:35:49 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/comfunc.c,v $
|
||||
*
|
||||
* Under source code control: 1990/02/15 01:48:13
|
||||
|
4
config.c
4
config.c
@@ -19,8 +19,8 @@
|
||||
* 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.3 $
|
||||
* @(#) $Id: config.c,v 29.3 2000/06/07 14:02:13 chongo Exp chongo $
|
||||
* @(#) $Revision: 29.4 $
|
||||
* @(#) $Id: config.c,v 29.4 2000/07/17 15:35:49 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/config.c,v $
|
||||
*
|
||||
* Under source code control: 1991/07/20 00:21:56
|
||||
|
4
config.h
4
config.h
@@ -19,8 +19,8 @@
|
||||
* 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.3 $
|
||||
* @(#) $Id: config.h,v 29.3 2000/06/07 14:02:13 chongo Exp chongo $
|
||||
* @(#) $Revision: 29.4 $
|
||||
* @(#) $Id: config.h,v 29.4 2000/07/17 15:35:49 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/config.h,v $
|
||||
*
|
||||
* Under source code control: 1995/11/01 22:20:17
|
||||
|
@@ -17,8 +17,8 @@
|
||||
# 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.5 $
|
||||
# @(#) $Id: Makefile,v 29.5 2000/06/07 14:02:59 chongo Exp $
|
||||
# @(#) $Revision: 29.6 $
|
||||
# @(#) $Id: Makefile,v 29.6 2000/12/15 14:56:14 chongo Exp $
|
||||
# @(#) $Source: /usr/local/src/cmd/calc/cscript/RCS/Makefile,v $
|
||||
#
|
||||
# Under source code control: 1999/11/29 11:10:26
|
||||
@@ -65,7 +65,7 @@ FMT= fmt
|
||||
#
|
||||
# The ${SCRIPT_SRC} is built from ${SCRIPT} and has the .calc extensions.
|
||||
#
|
||||
# This list is prodiced by the detaillist rule when no WARNINGS are detected.
|
||||
# This list is produced by the detaillist rule when no WARNINGS are detected.
|
||||
# To add a script:
|
||||
#
|
||||
# 1) Name the file with a .calc filename extension
|
||||
@@ -76,15 +76,15 @@ FMT= fmt
|
||||
#
|
||||
# make detaillist
|
||||
#
|
||||
SCRIPT= mersenne piforever plus simple
|
||||
SCRIPT= mersenne piforever plus simple square
|
||||
|
||||
SCRIPT_SRC= mersenne.calc piforever.calc plus.calc simple.calc
|
||||
SCRIPT_SRC= mersenne.calc piforever.calc plus.calc simple.calc square.calc
|
||||
|
||||
# These files are found (but not built) in the distribution
|
||||
#
|
||||
DISTLIST= ${SCRIPT_SRC} ${MAKE_FILE} README
|
||||
|
||||
# These files are used to make (but not built) a calc .a library
|
||||
# These files are used to make (but not build) a calc .a library
|
||||
#
|
||||
CALCLIBLIST=
|
||||
|
||||
@@ -92,10 +92,10 @@ CALCLIBLIST=
|
||||
#
|
||||
all: ${SCRIPT} ${SCRIPT_SRC} .all
|
||||
|
||||
# used by the upper level Makefile to determine of we have done all
|
||||
# used by the upper level Makefile to determine if we have done all
|
||||
#
|
||||
# NOTE: Due to bogus shells found on one common system we must have
|
||||
# an non-emoty else clause for every if condition. *sigh*
|
||||
# a non-empty else clause for every if condition. *sigh*
|
||||
#
|
||||
.all:
|
||||
rm -f .all
|
||||
@@ -245,3 +245,7 @@ simple: simple.calc
|
||||
rm -f $@
|
||||
${SED} -e "1s:^#!/usr/local/src/cmd/calc/calc:#!${BINDIR}/calc:" $?>$@
|
||||
${CHMOD} +x $@
|
||||
square: square.calc
|
||||
rm -f $@
|
||||
${SED} -e "1s:^#!/usr/local/src/cmd/calc/calc:#!${BINDIR}/calc:" $?>$@
|
||||
${CHMOD} +x $@
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#!/usr/local/src/cmd/calc/calc -S
|
||||
#!/usr/local/src/cmd/calc/calc -q -s -f
|
||||
#
|
||||
# mersenne - print the value of a mersenne number
|
||||
#
|
||||
@@ -18,8 +18,8 @@
|
||||
# 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.2 $
|
||||
# @(#) $Id: mersenne.calc,v 29.2 2000/06/07 14:02:59 chongo Exp $
|
||||
# @(#) $Revision: 29.3 $
|
||||
# @(#) $Id: mersenne.calc,v 29.3 2000/12/15 14:56:54 chongo Exp $
|
||||
# @(#) $Source: /usr/local/src/cmd/calc/cscript/RCS/mersenne.calc,v $
|
||||
#
|
||||
# Under source code control: 1999/11/30 00:09:01;
|
||||
@@ -35,13 +35,19 @@
|
||||
/*
|
||||
* parse args
|
||||
*/
|
||||
if (argv() != 1) {
|
||||
if (argv() != 2) {
|
||||
/* we include the name of this script in the error message */
|
||||
fprintf(files(2), "usage: %s exp\n", config("program"));
|
||||
abort "wrong number of args";
|
||||
}
|
||||
|
||||
global n = eval(argv(1));
|
||||
|
||||
if (!isint(n) || n <= 0) {
|
||||
quit "Argument to be a positive integer";
|
||||
}
|
||||
|
||||
/*
|
||||
* print the decimal value of 2^n-1
|
||||
*/
|
||||
print "2^": argv(0) : "-1 =", 2^eval(argv(0))-1;
|
||||
print "2^": n : "-1 =", 2^n-1;
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#!/usr/local/src/cmd/calc/calc -S
|
||||
#!/usr/local/src/cmd/calc/calc -q -f
|
||||
#
|
||||
# piforever - print digits of pi forever (or as long as your mem/cpu allow)
|
||||
#
|
||||
@@ -18,8 +18,8 @@
|
||||
# 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.2 $
|
||||
# @(#) $Id: piforever.calc,v 29.2 2000/06/07 14:02:59 chongo Exp $
|
||||
# @(#) $Revision: 29.3 $
|
||||
# @(#) $Id: piforever.calc,v 29.3 2000/12/15 14:56:54 chongo Exp $
|
||||
# @(#) $Source: /usr/local/src/cmd/calc/cscript/RCS/piforever.calc,v $
|
||||
#
|
||||
# Under source code control: 1999/11/30 00:11:36
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#!/usr/local/src/cmd/calc/calc -S
|
||||
#!/usr/local/src/cmd/calc/calc -q -s -f
|
||||
#
|
||||
# plus - add two or more arguments together
|
||||
#
|
||||
@@ -18,8 +18,8 @@
|
||||
# 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.2 $
|
||||
# @(#) $Id: plus.calc,v 29.2 2000/06/07 14:02:59 chongo Exp $
|
||||
# @(#) $Revision: 29.3 $
|
||||
# @(#) $Id: plus.calc,v 29.3 2000/12/15 14:56:54 chongo Exp $
|
||||
# @(#) $Source: /usr/local/src/cmd/calc/cscript/RCS/plus.calc,v $
|
||||
#
|
||||
# Under source code control: 1999/11/29 10:22:37
|
||||
@@ -35,19 +35,19 @@
|
||||
/*
|
||||
* parse args
|
||||
*/
|
||||
if (argv() < 1) {
|
||||
if (argv() < 2) {
|
||||
/* we include the name of this script in the error message */
|
||||
fprintf(files(2), "usage: %s value ...\n", config("program"));
|
||||
abort "not enough args";
|
||||
}
|
||||
|
||||
/*
|
||||
* print the sum of the 2 args
|
||||
* print the sum of the args
|
||||
*
|
||||
* Since args are strings, we must eval them before using them numerically.
|
||||
*/
|
||||
sum = 0;
|
||||
for (i=0; i < argv(); ++i) {
|
||||
for (i=1; i < argv(); ++i) {
|
||||
sum += eval(argv(i));
|
||||
}
|
||||
print sum;
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#!/usr/local/src/cmd/calc/calc -S
|
||||
#!/usr/local/src/cmd/calc/calc -q -f
|
||||
#
|
||||
# simple - an example of a simple calc shell script
|
||||
#
|
||||
@@ -18,8 +18,8 @@
|
||||
# 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.2 $
|
||||
# @(#) $Id: simple.calc,v 29.2 2000/06/07 14:02:59 chongo Exp $
|
||||
# @(#) $Revision: 29.3 $
|
||||
# @(#) $Id: simple.calc,v 29.3 2000/12/15 14:56:54 chongo Exp $
|
||||
# @(#) $Source: /usr/local/src/cmd/calc/cscript/RCS/simple.calc,v $
|
||||
#
|
||||
# Under source code control: 1999/11/29 10:22:37
|
||||
@@ -32,4 +32,4 @@
|
||||
/*
|
||||
* This is an example of a simple calc shell script.
|
||||
*/
|
||||
print "The simple calc shell script works!"
|
||||
print "This simple calc shell script works!"
|
||||
|
35
cscript/square.calc
Normal file
35
cscript/square.calc
Normal file
@@ -0,0 +1,35 @@
|
||||
#!/usr/local/src/cmd/calc/calc -q -f
|
||||
#
|
||||
# sqaure - print the squares of input values
|
||||
#
|
||||
# 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: square.calc,v 29.1 2000/12/15 14:55:59 chongo Exp $
|
||||
# @(#) $Source: /usr/local/src/cmd/calc/cscript/RCS/square.calc,v $
|
||||
#
|
||||
# Under source code control: 2000/12/15 06:52:01
|
||||
# File existed as early as: 2000
|
||||
#
|
||||
# Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
||||
# usage:
|
||||
# mersenne exp
|
||||
|
||||
global s;
|
||||
while ((s = prompt("")))
|
||||
print "\t":eval(s)^2;
|
@@ -18,8 +18,8 @@
|
||||
# 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.2 $
|
||||
# @(#) $Id: Makefile,v 29.2 2000/06/07 14:03:03 chongo Exp $
|
||||
# @(#) $Revision: 29.3 $
|
||||
# @(#) $Id: Makefile,v 29.3 2000/12/17 12:28:15 chongo Exp $
|
||||
# @(#) $Source: /usr/local/src/cmd/calc/custom/RCS/Makefile,v $
|
||||
#
|
||||
# Under source code control: 1997/03/09 02:28:54
|
||||
@@ -406,7 +406,10 @@ depend:
|
||||
echo '#endif /* '"$$tag"' */' >> "skel/custom/$$i"; \
|
||||
done
|
||||
${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'`"; \
|
||||
echo "#if !defined($$tag)" > "skel/$$i"; \
|
||||
echo "#define $$tag" >> "skel/$$i"; \
|
||||
|
@@ -17,8 +17,8 @@
|
||||
* 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.3 $
|
||||
* @(#) $Id: c_sysinfo.c,v 29.3 2000/06/07 14:03:03 chongo Exp chongo $
|
||||
* @(#) $Revision: 29.4 $
|
||||
* @(#) $Id: c_sysinfo.c,v 29.4 2000/07/17 15:37:12 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/custom/RCS/c_sysinfo.c,v $
|
||||
*
|
||||
* Under source code control: 1997/03/09 23:14:40
|
||||
|
10
file.c
10
file.c
@@ -19,8 +19,8 @@
|
||||
* 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.2 $
|
||||
* @(#) $Id: file.c,v 29.2 2000/06/07 14:02:13 chongo Exp $
|
||||
* @(#) $Revision: 29.3 $
|
||||
* @(#) $Id: file.c,v 29.3 2000/12/17 12:24:42 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/file.c,v $
|
||||
*
|
||||
* Under source code control: 1991/07/20 00:21:56
|
||||
@@ -40,6 +40,7 @@
|
||||
#include "calc.h"
|
||||
#include "longbits.h"
|
||||
#include "have_fpos.h"
|
||||
#include "have_fpos_pos.h"
|
||||
#include "fposval.h"
|
||||
#include "file.h"
|
||||
#include "calcerr.h"
|
||||
@@ -1239,7 +1240,8 @@ z2filepos(ZVALUE zpos)
|
||||
if (!zgtmaxfull(zpos)) {
|
||||
/* ztofull puts the value into native byte order */
|
||||
pos = ztofull(zpos);
|
||||
ret = pos;
|
||||
memset(&ret, 0, sizeof(FILEPOS));
|
||||
memcpy((void *)&ret, (void *)&pos, sizeof(pos));
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -1251,7 +1253,7 @@ z2filepos(ZVALUE zpos)
|
||||
memcpy(&tmp, zpos.v, sizeof(FILEPOS));
|
||||
} else {
|
||||
/* copy what bits we can into the temp value */
|
||||
tmp = 0;
|
||||
memset(&tmp, 0, sizeof(FILEPOS));
|
||||
memcpy(&tmp, zpos.v, zpos.len*BASEB/8);
|
||||
}
|
||||
/* swap into native byte order */
|
||||
|
14
fposval.c
14
fposval.c
@@ -17,8 +17,8 @@
|
||||
* 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.2 $
|
||||
* @(#) $Id: fposval.c,v 29.2 2000/06/07 14:02:13 chongo Exp $
|
||||
* @(#) $Revision: 29.3 $
|
||||
* @(#) $Id: fposval.c,v 29.3 2000/12/17 12:25:36 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/fposval.c,v $
|
||||
*
|
||||
* Under source code control: 1994/11/05 03:19:52
|
||||
@@ -63,6 +63,7 @@
|
||||
#include "endian_calc.h"
|
||||
#include "have_offscl.h"
|
||||
#include "have_posscl.h"
|
||||
#include "have_fpos_pos.h"
|
||||
|
||||
char *program; /* our name */
|
||||
|
||||
@@ -83,9 +84,14 @@ main(int argc, char **argv)
|
||||
/*
|
||||
* 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;
|
||||
printf("#undef FILEPOS_BITS\n");
|
||||
printf("#define FILEPOS_BITS %d\n", fileposlen);
|
||||
#endif /* ! HAVE_FPOS_POS */
|
||||
#if CALC_BYTE_ORDER == BIG_ENDIAN
|
||||
/*
|
||||
* Big Endian
|
||||
@@ -113,8 +119,8 @@ main(int argc, char **argv)
|
||||
* Normally a "(*(dest) = *(src))" would do, but on some
|
||||
* systems a FILEPOS is not a scalar hince we must memcpy.
|
||||
*/
|
||||
printf("#define SWAP_HALF_IN_FILEPOS(dest, src)\t%s%d%s\n",
|
||||
"memcpy((void *)(dest), (void *)(src), sizeof(",fileposlen,"))");
|
||||
printf("#define SWAP_HALF_IN_FILEPOS(dest, src)\t%s\n",
|
||||
"memcpy((void *)(dest), (void *)(src), sizeof(FPOS_POS_BITS))");
|
||||
#endif /* HAVE_FILEPOS_SCALAR */
|
||||
#endif /* CALC_BYTE_ORDER == BIG_ENDIAN */
|
||||
putchar('\n');
|
||||
|
6
func.c
6
func.c
@@ -19,8 +19,8 @@
|
||||
* 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.3 $
|
||||
* @(#) $Id: func.c,v 29.3 2000/06/07 14:02:13 chongo Exp chongo $
|
||||
* @(#) $Revision: 29.5 $
|
||||
* @(#) $Id: func.c,v 29.5 2000/12/04 19:32:33 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/func.c,v $
|
||||
*
|
||||
* Under source code control: 1990/02/15 01:48:15
|
||||
@@ -162,7 +162,7 @@ static STRINGHEAD newerrorstr;
|
||||
/*
|
||||
* arg count definitions
|
||||
*/
|
||||
#define IN 100 /* maximum number of arguments */
|
||||
#define IN 1024 /* maximum number of arguments */
|
||||
#define FE 0x01 /* flag to indicate default epsilon argument */
|
||||
#define FA 0x02 /* preserve addresses of variables */
|
||||
|
||||
|
59
have_fpos_pos.c
Normal file
59
have_fpos_pos.c
Normal 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;
|
||||
}
|
@@ -18,8 +18,8 @@
|
||||
# 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.3 $
|
||||
# @(#) $Id: Makefile,v 29.3 2000/06/07 14:02:33 chongo Exp chongo $
|
||||
# @(#) $Revision: 29.5 $
|
||||
# @(#) $Id: Makefile,v 29.5 2000/12/14 10:33:06 chongo Exp $
|
||||
# @(#) $Source: /usr/local/src/cmd/calc/help/RCS/Makefile,v $
|
||||
#
|
||||
# Under source code control: 1991/07/23 06:47:57
|
||||
@@ -140,31 +140,31 @@ BLT_HELP_FILES= ${BLT_HELP_FILES_3} ${BLT_HELP_FILES_5} \
|
||||
# This list is prodiced by the detaillist rule when no WARNINGS are detected.
|
||||
#
|
||||
DETAIL_HELP= abs access acos acosh acot acoth acsc acsch address agd append \
|
||||
appr arg argv arrow asec asech asin asinh assign atan atan2 atanh \
|
||||
avg base bernoulli bit blk blkcpy blkfree blocks bround btrunc \
|
||||
calclevel ceil cfappr cfsim char cmdbuf cmp comb conj cos cosh \
|
||||
cot coth count cp csc csch ctime delete den dereference det digit \
|
||||
digits dp epsilon errcount errmax errno error eval exp fact factor \
|
||||
fclose fcnt feof ferror fflush fgetc fgetfield fgetline fgets fgetstr \
|
||||
fib files floor fopen forall fprintf fputc fputs fputstr frac free \
|
||||
freebernoulli freeglobals freeredc freestatics frem freopen fscan \
|
||||
fscanf fseek fsize ftell gcd gcdrem gd getenv hash head highbit \
|
||||
hmean hnrmod hypot ilog ilog10 ilog2 im indices inputlevel insert \
|
||||
int inverse iroot isassoc isatty isblk isconfig isdefined iserror \
|
||||
iseven isfile ishash isident isint islist ismat ismult isnull isnum \
|
||||
isobj isobjtype isodd isprime isptr isqrt isrand israndom isreal \
|
||||
isrel issimple issq isstr istype jacobi join lcm lcmfact lfactor ln \
|
||||
lowbit ltol makelist matdim matfill matmax matmin matsum mattrace \
|
||||
mattrans max md5 memsize meq min minv mmin mne mod modify name \
|
||||
near newerror nextcand nextprime norm null num oldvalue ord param \
|
||||
perm pfact pi pix places pmod polar poly pop popcnt power prevcand \
|
||||
prevprime printf prompt protect ptest push putenv quo quomod rand \
|
||||
randbit random randombit randperm rcin rcmul rcout rcpow rcsq re \
|
||||
remove reverse rewind rm root round rsearch runtime saveval scale \
|
||||
scan scanf search sec sech seed segment select sgn sha sha1 sin \
|
||||
sinh size sizeof sort sqrt srand srandom ssq str strcat strerror \
|
||||
strlen strpos strprintf strscan strscanf substr sum swap system \
|
||||
tail tan tanh test time trunc xor
|
||||
appr arg argv arrow asec asech asin asinh assign atan atan2 atanh avg \
|
||||
base bernoulli bit blk blkcpy blkfree blocks bround btrunc calc_tty \
|
||||
calclevel catalan ceil cfappr cfsim char cmdbuf cmp comb conj cos \
|
||||
cosh cot coth count cp csc csch ctime delete den dereference det \
|
||||
digit digits dp epsilon errcount errmax errno error euler eval \
|
||||
exp fact factor fclose fcnt feof ferror fflush fgetc fgetfield \
|
||||
fgetline fgets fgetstr fib files floor fopen forall fprintf fputc \
|
||||
fputs fputstr frac free freebernoulli freeeuler freeglobals freeredc \
|
||||
freestatics frem freopen fscan fscanf fseek fsize ftell gcd gcdrem \
|
||||
gd getenv hash head highbit hmean hnrmod hypot ilog ilog10 ilog2 \
|
||||
im indices inputlevel insert int inverse iroot isassoc isatty isblk \
|
||||
isconfig isdefined iserror iseven isfile ishash isident isint islist \
|
||||
ismat ismult isnull isnum isobj isobjtype isodd isprime isptr isqrt \
|
||||
isrand israndom isreal isrel issimple issq isstr istype jacobi join \
|
||||
lcm lcmfact lfactor ln lowbit ltol makelist matdim matfill matmax \
|
||||
matmin matsum mattrace mattrans max md5 memsize meq min minv mmin \
|
||||
mne mod modify name near newerror nextcand nextprime norm null \
|
||||
num oldvalue ord param perm pfact pi pix places pmod polar poly \
|
||||
pop popcnt power prevcand prevprime printf prompt protect ptest \
|
||||
push putenv quo quomod rand randbit random randombit randperm rcin \
|
||||
rcmul rcout rcpow rcsq re remove reverse rewind rm root round rsearch \
|
||||
runtime saveval scale scan scanf search sec sech seed segment select \
|
||||
sgn sha sha1 sin sinh size sizeof sleep sort sqrt srand srandom \
|
||||
ssq str strcat strerror strlen strpos strprintf strscan strscanf \
|
||||
substr sum swap system tail tan tanh test time trunc xor
|
||||
|
||||
# This list is of files that are clones of DETAIL_HELP files. They are
|
||||
# built from DETAIL_HELP files.
|
||||
|
@@ -35,11 +35,11 @@ EXAMPLE
|
||||
LIMITS
|
||||
n < 2^31-1
|
||||
|
||||
LINK LIBRARY
|
||||
LIBRARY
|
||||
NUMBER *qbernoulli(long n)
|
||||
|
||||
SEE ALSO
|
||||
euler, freebernoulli, catalan, comb, fact, perm
|
||||
euler, catalan, comb, fact, perm
|
||||
|
||||
## Copyright (C) 2000 Ernest Bowen
|
||||
##
|
||||
@@ -57,11 +57,11 @@ SEE ALSO
|
||||
## 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.2 $
|
||||
## @(#) $Id: sin,v 29.2 2000/06/07 14:02:33 chongo Exp $
|
||||
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/sin,v $
|
||||
## @(#) $Revision: 29.4 $
|
||||
## @(#) $Id: bernoulli,v 29.4 2000/12/17 12:27:58 chongo Exp $
|
||||
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/bernoulli,v $
|
||||
##
|
||||
## Under source code control: 2000/07/13
|
||||
## Under source code control: 2000/07/13 01:33:00
|
||||
## File existed as early as: 2000
|
||||
##
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
|
52
help/calc_tty
Normal file
52
help/calc_tty
Normal file
@@ -0,0 +1,52 @@
|
||||
NAME
|
||||
calc_tty - restore normal input conditions for interactive use
|
||||
|
||||
SYNOPSIS
|
||||
calc_tty()
|
||||
|
||||
TYPES
|
||||
return none if appears to be successful, error-value otherwise
|
||||
|
||||
DESCRIPTION
|
||||
This may enable a return to normal operation if abnormal activity
|
||||
results from a change of one or more terminal characteristics, as
|
||||
may occur when activity is resumed by an fg command after a ctrl-Z
|
||||
interrupt, or by any of the three commands:
|
||||
|
||||
> !stty echo
|
||||
> !stty -cbreak
|
||||
> !stty echo -cbreak
|
||||
|
||||
EXAMPLE
|
||||
> calc_tty();
|
||||
|
||||
LIBRARY
|
||||
none
|
||||
|
||||
SEE ALSO
|
||||
none
|
||||
|
||||
## Copyright (C) 2000 Ernest Bowen
|
||||
##
|
||||
## 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: calc_tty,v 29.1 2000/12/14 10:31:45 chongo Exp $
|
||||
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/calc_tty,v $
|
||||
##
|
||||
## Under source code control: 2000/12/14 01:33:00
|
||||
## File existed as early as: 2000
|
||||
##
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
63
help/catalan
Normal file
63
help/catalan
Normal file
@@ -0,0 +1,63 @@
|
||||
NAME
|
||||
catalan - Catalan number
|
||||
|
||||
SYNOPSIS
|
||||
catalan(n)
|
||||
|
||||
TYPES
|
||||
n integer
|
||||
|
||||
return integer
|
||||
|
||||
DESCRIPTION
|
||||
If n >= 0, this returns the Catalan number for index n:
|
||||
|
||||
catalan(n) = comb(2*n,n)/(n + 1)
|
||||
|
||||
Zero is returned for negative n.
|
||||
|
||||
The Catalan numbers occur in solutions of several elementary
|
||||
combinatorial problems, e.g. for n >= 1, catalan(n) is the number of
|
||||
ways of using parentheses to express a product of n + 1 letters in
|
||||
terms of binary products; it is the number of ways of dissecting a
|
||||
convex polygon with n + 2 sides into triangles by nonintersecting
|
||||
diagonals; it is the number of integer-component-incrementing paths
|
||||
from (x,y) = (0,0) to (x,y) = (n,n) for which always y <= x.
|
||||
|
||||
EXAMPLE
|
||||
> print catalan(2), catalan(3), catalan(4), catalan(20)
|
||||
2 5 14 6564120420
|
||||
|
||||
LIMITS
|
||||
none
|
||||
|
||||
LINK LIBRARY
|
||||
NUMBER *qcatalan(NUMBER *n)
|
||||
|
||||
SEE ALSO
|
||||
comb, fact, perm
|
||||
|
||||
## Copyright (C) 2000 Ernest Bowen
|
||||
##
|
||||
## 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.2 $
|
||||
## @(#) $Id: catalan,v 29.2 2000/12/17 12:27:58 chongo Exp $
|
||||
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/catalan,v $
|
||||
##
|
||||
## Under source code control: 2000/12/14 01:33:00
|
||||
## File existed as early as: 2000
|
||||
##
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
@@ -207,9 +207,9 @@ SEE ALSO
|
||||
## 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.2 $
|
||||
## @(#) $Id: sin,v 29.2 2000/06/07 14:02:33 chongo Exp $
|
||||
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/sin,v $
|
||||
## @(#) $Revision: 29.3 $
|
||||
## @(#) $Id: define,v 29.3 2000/07/17 15:36:26 chongo Exp $
|
||||
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/define,v $
|
||||
##
|
||||
##
|
||||
## Under source code control: 1991/07/21 04:37:18
|
||||
|
91
help/digit
91
help/digit
@@ -1,38 +1,93 @@
|
||||
NAME
|
||||
digit - digit at specified position in a decimal representation
|
||||
digit - digit at specified position in a "decimal" representation
|
||||
|
||||
SYNOPSIS
|
||||
digit(x, y)
|
||||
digit(x, n [, b])
|
||||
|
||||
TYPES
|
||||
x real
|
||||
y integer
|
||||
n integer
|
||||
b integer >= 2, default = 10
|
||||
|
||||
return integer
|
||||
|
||||
DESCRIPTION
|
||||
By extending the digits on the left, and if necessary, the digits
|
||||
on the right, by infinite strings of zeros, abs(x) may be considered
|
||||
to have the decimal representation:
|
||||
|
||||
... d_2 d_1 d_0.d_-1 d_-2 ...
|
||||
d(x,n,b) returns the digit with index n in a standard base-b "decimal"
|
||||
representation of x, which may be described as follows:
|
||||
|
||||
For an arbitrary base b >= 2, following the pattern of decimal (base 10)
|
||||
notation in elementary arithmetic, a base-b "decimal" representation of
|
||||
a positive real number may be considered to be specified by a finite or
|
||||
infinite sequence of "digits" with possibly a "decimal" point
|
||||
to indicate where the fractional part of the representation begins.
|
||||
Just as the digits for base 10 are the integers 0, 1, 2, ..., 9, the
|
||||
digits for a base-b representation are the integers d for which
|
||||
0 <= d < b. The index for a digit position is the count, positively to
|
||||
the left, of the number from the "units" position immediately to the
|
||||
left of the "decimal" point; the digit d_n at position n contributes
|
||||
additively d_n * b^n to the value of x. For example,
|
||||
|
||||
d_2 d_1 d_0 . d_-1 d_-2
|
||||
|
||||
represents the number
|
||||
|
||||
d_2 * b^2 + d_1 * b + d0 + d_-1 * b^-1 + d_-2 * b^-2
|
||||
|
||||
The sequence of digits has to be infinite if den(x) has a prime factor
|
||||
which is not a factor of the base b. In cases where the representation
|
||||
may terminate, the digits are considered to continue with an infinite
|
||||
string of zeros rather than the other possibility of an infinite
|
||||
sequence of (b - 1)s. Thus, for the above example, d_n = 0 for
|
||||
n = -3, -4, ... Similarly, a representation may be considered to
|
||||
continue with an infinite string of zeros on the left, so that in the
|
||||
above example d_n = 0 also for n >= 3.
|
||||
|
||||
For negative x, digit(x,n,b) is given by digit(abs(x),n,b); the
|
||||
standard "decimal" representation of this x is a - sign followed by
|
||||
the representation of abs(x).
|
||||
|
||||
In calc, the "real" numbers are all rational and for these the
|
||||
digits following the decimal point eventually form a recurring sequence.
|
||||
|
||||
With base-b digits for x as explained above, the integer whose base-b
|
||||
representation is
|
||||
|
||||
b_n+k-1 b_n_k-2 ... b_n,
|
||||
|
||||
i.e. the k digits with last digit b_n, is given by
|
||||
|
||||
digit(b^-r * x, q, b^k)
|
||||
|
||||
if r and q satisfy n = q * b + r.
|
||||
|
||||
digit(x,y) then returns the digit d_y.
|
||||
|
||||
EXAMPLE
|
||||
> x = 12.34
|
||||
> print digit(x,2), digit(x,1), digit(x,0), digit(x,-1), digit(x,-2)
|
||||
0 1 2 3 4
|
||||
> a = 123456.789
|
||||
> for (n = 6; n >= -6; n++) print digit(a, n),; print
|
||||
0 1 2 3 4 5 6 7 8 9 0 0 0
|
||||
|
||||
> x = 10/7
|
||||
> print digit(x,1), digit(x,0), digit(x,-1), digit(x,-2), digit(x,-3)
|
||||
0 1 4 2 8
|
||||
> for (n = 6; n >= -6; n--) print digit(a, n, 100),; print
|
||||
0 0 0 0 12 34 56 78 90 0 0 0 0
|
||||
|
||||
> for (n = 6; n >= -6; n--) print digit(a, n, 256),; print
|
||||
0 0 0 0 1 226 64 201 251 231 108 139 67
|
||||
|
||||
> for (n = 1; n >= -12; n++) print digit(10/7, n),; print
|
||||
> 0 1 4 2 8 5 7 1 4 2 8 5 7 1
|
||||
|
||||
> print digit(10/7, -7e1000, 1e6)
|
||||
428571
|
||||
|
||||
LIMITS
|
||||
If x is not an integer, y > -2^31
|
||||
|
||||
The absolute value of the integral part of x is assumed to be less
|
||||
than 2^2^31, ensuring that digit(x, n, b) will be zero if n >= 2^31.
|
||||
The size of negative n is limited only by the capacity of the computer
|
||||
being used.
|
||||
|
||||
LINK LIBRARY
|
||||
long qdigit(NUMBER *x, long y)
|
||||
NUMBER * qdigit(NUMBER *q, ZVALUE dpos, ZVALUE base)
|
||||
|
||||
SEE ALSO
|
||||
bit
|
||||
@@ -53,8 +108,8 @@ SEE ALSO
|
||||
## 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.2 $
|
||||
## @(#) $Id: digit,v 29.2 2000/06/07 14:02:33 chongo Exp $
|
||||
## @(#) $Revision: 29.4 $
|
||||
## @(#) $Id: digit,v 29.4 2000/12/17 12:27:58 chongo Exp $
|
||||
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/digit,v $
|
||||
##
|
||||
## Under source code control: 1995/10/03 10:40:01
|
||||
|
24
help/digits
24
help/digits
@@ -1,30 +1,36 @@
|
||||
NAME
|
||||
digits - return number of digits in an integer or integer part
|
||||
digits - return number of "decimal" digits in an integral part
|
||||
|
||||
SYNOPSIS
|
||||
digits(x)
|
||||
digits(x [,b])
|
||||
|
||||
TYPES
|
||||
x real
|
||||
b integer >= 2, defaults to 10
|
||||
|
||||
return integer
|
||||
|
||||
DESCRIPTION
|
||||
For real x, digits(x) returns the number of digits in the decimal
|
||||
representation of int(abs(x)). If x >= 1, digits(x) = 1 + ilog10(x).
|
||||
Returns the least non-negative integer n for which abs(x) < b^n.
|
||||
|
||||
digits(x, b) = 0 if and only if abs(x) < 1.
|
||||
|
||||
For real x with absolute value >= 1, digits(x, b) is the number
|
||||
of digits in the standard base-b "decimal" representation of int(abs(x));
|
||||
this is also given by 1 + ilog(x, b).
|
||||
|
||||
EXAMPLE
|
||||
> print digits(0), digits(0.0123), digits(3.7), digits(-27), digits(-99.7)
|
||||
1 1 1 2 2
|
||||
0 0 1 2 2
|
||||
|
||||
LIMITS
|
||||
none
|
||||
|
||||
LINK LIBRARY
|
||||
long qdigits(NUMBER *x)
|
||||
long qdigits(NUMBER *q, ZVALUE base)
|
||||
|
||||
SEE ALSO
|
||||
places
|
||||
digit, places
|
||||
|
||||
## Copyright (C) 1999 Landon Curt Noll
|
||||
##
|
||||
@@ -42,8 +48,8 @@ SEE ALSO
|
||||
## 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.2 $
|
||||
## @(#) $Id: digits,v 29.2 2000/06/07 14:02:33 chongo Exp $
|
||||
## @(#) $Revision: 29.3 $
|
||||
## @(#) $Id: digits,v 29.3 2000/12/14 10:32:24 chongo Exp $
|
||||
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/digits,v $
|
||||
##
|
||||
## Under source code control: 1995/10/03 10:40:01
|
||||
|
63
help/euler
Normal file
63
help/euler
Normal file
@@ -0,0 +1,63 @@
|
||||
NAME
|
||||
euler - Euler number
|
||||
|
||||
SYNOPSIS
|
||||
euler(n)
|
||||
|
||||
TYPES
|
||||
n integer, n <= 1000000 if even
|
||||
|
||||
return integer
|
||||
|
||||
DESCRIPTION
|
||||
Returns the Euler number with index n, i.e. the coefficient E_n in
|
||||
the expansion
|
||||
|
||||
sech(t) = Sigma E_n * t^n/n!
|
||||
|
||||
When euler(n) is computed for positive even n, the values for
|
||||
n and smaller positive even indices are stored in a table so that
|
||||
a later call to euler(k) with 0 <= k <= n will be executed quickly.
|
||||
If euler(k) is called with negative k, zero is returned and the
|
||||
memory used by the table iu freed.
|
||||
|
||||
Considerable runtime and memery are required for calculating
|
||||
euler(n) for large even n.
|
||||
|
||||
EXAMPLE
|
||||
> for (n = 0; n <= 6; n++) print euler(n),; print;
|
||||
1 0 -1 0 5 0 -61
|
||||
|
||||
LIMITS
|
||||
none
|
||||
|
||||
LINK LIBRARY
|
||||
NUMBER *qeuler(long n)
|
||||
|
||||
SEE ALSO
|
||||
bernoulli, bell, catalan, comb, fact, perm
|
||||
|
||||
## Copyright (C) 2000 Ernest Bowen
|
||||
##
|
||||
## 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.2 $
|
||||
## @(#) $Id: euler,v 29.2 2000/12/17 12:27:58 chongo Exp $
|
||||
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/euler,v $
|
||||
##
|
||||
## Under source code control: 2000/12/14 01:33:00
|
||||
## File existed as early as: 2000
|
||||
##
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
@@ -40,8 +40,8 @@ SEE ALSO
|
||||
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
##
|
||||
## @(#) $Revision: 29.2 $
|
||||
## @(#) $Id: sin,v 29.2 2000/06/07 14:02:33 chongo Exp $
|
||||
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/sin,v $
|
||||
## @(#) $Id: freebernoulli,v 29.2 2000/07/17 15:36:26 chongo Exp $
|
||||
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/freebernoulli,v $
|
||||
##
|
||||
## Under source code control: 2000/07/13
|
||||
## File existed as early as: 2000
|
||||
|
49
help/freeeuler
Normal file
49
help/freeeuler
Normal file
@@ -0,0 +1,49 @@
|
||||
NAME
|
||||
freeeuler - free stored Euler numbers
|
||||
|
||||
SYNOPSIS
|
||||
freeeuler()
|
||||
|
||||
TYPES
|
||||
return none
|
||||
|
||||
DESCRIPTION
|
||||
The memory used to store calculated Euler numbers is freed by
|
||||
freeeuler().
|
||||
|
||||
EXAMPLE
|
||||
> freeeuler();
|
||||
|
||||
LIMITS
|
||||
none
|
||||
|
||||
LINK LIBRARY
|
||||
void qfreeeuler(void);
|
||||
|
||||
SEE ALSO
|
||||
euler, bernoulli, freebernoulli
|
||||
|
||||
## Copyright (C) 2000 Ernest Bowen
|
||||
##
|
||||
## 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: freeeuler,v 29.1 2000/12/14 10:31:45 chongo Exp $
|
||||
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/freeeuler,v $
|
||||
##
|
||||
## Under source code control: 2000/12/14 01:33:00
|
||||
## File existed as early as: 2000
|
||||
##
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
@@ -36,7 +36,7 @@ ABORT opcodes
|
||||
various places in the opcodes for evaluation of command lines
|
||||
and functions defined by "define ... { ... }" commands. In the
|
||||
following, config("trace") has been set equal to 8 so that opcodes
|
||||
are displayed when a function is defined. The function f(x)
|
||||
are displayed when a function is defined. The function f(x)
|
||||
evaluates x + (x - 1) + (x - 2) + ... until a zero term is
|
||||
encountered. If f() is called with a negative or fractional x,
|
||||
the calculation is never completed and to stop it, an interruption
|
||||
@@ -64,7 +64,7 @@ ABORT opcodes
|
||||
(The line number following DEBUG refers to the line in the file
|
||||
from which the definition is read.) If an attempt is made to
|
||||
evaluate f(-1), the effect of the DEBUG at opcode 6 ensures that
|
||||
a single SIGINT will stop the calculation at a start of
|
||||
a single SIGINT will stop the calculation at a start of
|
||||
{s += x--} loop. In interactive mode, with ^C indicating
|
||||
input of ctrl-C, the displayed output is as in:
|
||||
|
||||
@@ -115,8 +115,8 @@ ABORT opcodes
|
||||
## 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.2 $
|
||||
## @(#) $Id: interrupt,v 29.2 2000/06/07 14:02:33 chongo Exp chongo $
|
||||
## @(#) $Revision: 29.4 $
|
||||
## @(#) $Id: interrupt,v 29.4 2000/07/17 15:38:52 chongo Exp $
|
||||
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/interrupt,v $
|
||||
##
|
||||
## Under source code control: 1991/07/21 04:37:21
|
||||
|
29
help/places
29
help/places
@@ -1,34 +1,41 @@
|
||||
NAME
|
||||
places - return number of decimal places
|
||||
places - return number of "decimal" places in a fractional part
|
||||
|
||||
SYNOPSIS
|
||||
places(x)
|
||||
places(x [,b])
|
||||
|
||||
TYPES
|
||||
x real
|
||||
b integer >= 2, defaults to 10
|
||||
|
||||
return integer
|
||||
|
||||
DESCRIPTION
|
||||
If x has a finite decimal representation (with nonzero last digit),
|
||||
places(x) returns the number of digits after the decimal point in this
|
||||
representation; this is the least non-negative integer n for which
|
||||
10^n * x is an integer.
|
||||
Returns the least non-negative integer n for which b^n * x is an
|
||||
integer, or -1 if there is no such integer.
|
||||
|
||||
If x does not have a finite decimal representation, places(x) returns -1.
|
||||
places(x,b) = 0 if and only if x is an integer.
|
||||
|
||||
places(x,b) = n > 0 if and only if the fractional part of abs(x)
|
||||
has a finite base-b "decimal" representation with n digits of which
|
||||
the last digit is nonzero. This occurs if and only if every prime
|
||||
factor of den(x) is a factor of b.
|
||||
|
||||
EXAMPLE
|
||||
> print places(3), places(0.0123), places(3.70), places(1e-10), places(3/7)
|
||||
0 4 1 10 -1
|
||||
|
||||
> print places(0.0123, 2), places(.625, 2), places(.625, 8)
|
||||
-1 3 1
|
||||
|
||||
LIMITS
|
||||
none
|
||||
|
||||
LINK LIBRARY
|
||||
long qplaces(NUMBER *x)
|
||||
long qplaces(NUMBER *q, ZVALUE base)
|
||||
|
||||
SEE ALSO
|
||||
digits
|
||||
digit, digits
|
||||
|
||||
## Copyright (C) 1999 Landon Curt Noll
|
||||
##
|
||||
@@ -46,8 +53,8 @@ SEE ALSO
|
||||
## 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.2 $
|
||||
## @(#) $Id: places,v 29.2 2000/06/07 14:02:33 chongo Exp $
|
||||
## @(#) $Revision: 29.4 $
|
||||
## @(#) $Id: places,v 29.4 2000/12/17 12:27:58 chongo Exp $
|
||||
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/places,v $
|
||||
##
|
||||
## Under source code control: 1995/10/03 10:40:02
|
||||
|
@@ -283,8 +283,8 @@ For more information use the following calc commands:
|
||||
## 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.3 $
|
||||
## @(#) $Id: script,v 29.3 2000/06/07 14:02:33 chongo Exp chongo $
|
||||
## @(#) $Revision: 29.4 $
|
||||
## @(#) $Id: script,v 29.4 2000/07/17 15:36:26 chongo Exp $
|
||||
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/script,v $
|
||||
##
|
||||
## Under source code control: 1999/11/30 05:29:48
|
||||
|
68
help/sleep
Normal file
68
help/sleep
Normal file
@@ -0,0 +1,68 @@
|
||||
NAME
|
||||
sleep - suspend operation for a specified time
|
||||
|
||||
SYNOPSIS
|
||||
sleep([n])
|
||||
|
||||
TYPES
|
||||
n non-negative real, defaults to 1
|
||||
|
||||
return integer or null value
|
||||
|
||||
DESCRIPTION
|
||||
This uses the C-library sleep (if n is integral) or usleep (for
|
||||
non-integral n) to suspend operation for n seconds. If n is an
|
||||
integer and the sleep is stopped by an interruption, the number
|
||||
of seconds remaining is returned.
|
||||
|
||||
One kind of use is to slow down output to permit easier reading of
|
||||
results, as in:
|
||||
|
||||
> for (i = 0; i < 100; i++) {
|
||||
print sqrt(i);
|
||||
sleep(1/2);
|
||||
}
|
||||
|
||||
The following illustrates what happens if ctrl-C is hit 5 seconds
|
||||
after the first command:
|
||||
|
||||
> print sleep(20)
|
||||
|
||||
[Abort level 1]
|
||||
15
|
||||
>
|
||||
|
||||
EXAMPLE
|
||||
> sleep(1/3);
|
||||
> sleep(20);
|
||||
|
||||
LIBRARY
|
||||
none
|
||||
|
||||
SEE ALSO
|
||||
none
|
||||
|
||||
## Copyright (C) 2000 Ernest Bowen
|
||||
##
|
||||
## 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.2 $
|
||||
## @(#) $Id: sleep,v 29.2 2000/12/17 12:27:58 chongo Exp $
|
||||
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/sleep,v $
|
||||
##
|
||||
## Under source code control: 2000/12/14 01:33:00
|
||||
## File existed as early as: 2000
|
||||
##
|
||||
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
4
input.c
4
input.c
@@ -17,8 +17,8 @@
|
||||
* 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.2 $
|
||||
* @(#) $Id: input.c,v 29.2 2000/06/07 14:02:13 chongo Exp chongo $
|
||||
* @(#) $Revision: 29.3 $
|
||||
* @(#) $Id: input.c,v 29.3 2000/07/17 15:35:49 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/input.c,v $
|
||||
*
|
||||
* Under source code control: 1990/02/15 01:48:16
|
||||
|
@@ -17,8 +17,8 @@
|
||||
* 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.3 $
|
||||
* @(#) $Id: lib_calc.c,v 29.3 2000/06/07 14:02:13 chongo Exp chongo $
|
||||
* @(#) $Revision: 29.4 $
|
||||
* @(#) $Id: lib_calc.c,v 29.4 2000/07/17 15:35:49 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/lib_calc.c,v $
|
||||
*
|
||||
* Under source code control: 1996/06/17 18:06:19
|
||||
|
@@ -19,8 +19,8 @@
|
||||
* 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.2 $
|
||||
* @(#) $Id: opcodes.c,v 29.2 2000/06/07 14:02:13 chongo Exp chongo $
|
||||
* @(#) $Revision: 29.3 $
|
||||
* @(#) $Id: opcodes.c,v 29.3 2000/07/17 15:35:49 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/opcodes.c,v $
|
||||
*
|
||||
* Under source code control: 1990/02/15 01:48:19
|
||||
|
34
qfunc.c
34
qfunc.c
@@ -19,8 +19,8 @@
|
||||
* 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.2 $
|
||||
* @(#) $Id: qfunc.c,v 29.2 2000/06/07 14:02:13 chongo Exp chongo $
|
||||
* @(#) $Revision: 29.4 $
|
||||
* @(#) $Id: qfunc.c,v 29.4 2000/12/17 13:07:32 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/qfunc.c,v $
|
||||
*
|
||||
* Under source code control: 1990/02/15 01:48:20
|
||||
@@ -976,6 +976,7 @@ qbern(ZVALUE z)
|
||||
long n, i, k, m, nn, dd;
|
||||
NUMBER **p;
|
||||
NUMBER *s, *s1, *c, *c1, *t;
|
||||
size_t sz;
|
||||
|
||||
if (zisone(z))
|
||||
return qlink(&_qneghalf_);
|
||||
@@ -999,15 +1000,15 @@ qbern(ZVALUE z)
|
||||
|
||||
if (m >= B_allocnum) {
|
||||
k = (m/QALLOCNUM + 1) * QALLOCNUM;
|
||||
sz = k * sizeof(NUMBER *);
|
||||
if (sz < (size_t) k)
|
||||
return NULL;
|
||||
if (B_allocnum == 0)
|
||||
p = (NUMBER **) malloc(k * sizeof(NUMBER *));
|
||||
p = (NUMBER **) malloc(sz);
|
||||
else
|
||||
p = (NUMBER **) realloc(B_table,
|
||||
k * sizeof(NUMBER *));
|
||||
if (p == NULL) {
|
||||
math_error("Not enough memory for Bernoulli numbers");
|
||||
/*NOTREACHED*/
|
||||
}
|
||||
p = (NUMBER **) realloc(B_table, sz);
|
||||
if (p == NULL)
|
||||
return NULL;
|
||||
B_allocnum = k;
|
||||
B_table = p;
|
||||
}
|
||||
@@ -1069,6 +1070,7 @@ qeuler(ZVALUE z)
|
||||
long i, k, m, n, nn, dd;
|
||||
NUMBER **p;
|
||||
NUMBER *s, *s1, *c, *c1, *t;
|
||||
size_t sz;
|
||||
|
||||
|
||||
if (ziszero(z))
|
||||
@@ -1081,11 +1083,15 @@ qeuler(ZVALUE z)
|
||||
m = (n >> 1) - 1;
|
||||
if (m < E_num)
|
||||
return qlink(E_table[m]);
|
||||
p = (NUMBER **) realloc(E_table, (m + 1) * sizeof(NUMBER *));
|
||||
if (p == NULL) {
|
||||
math_error("Unable to allocate memory for Euler numbers");
|
||||
/*NOTREACHED*/
|
||||
}
|
||||
sz = (m + 1) * sizeof(NUMBER *);
|
||||
if (sz < (size_t) m + 1)
|
||||
return NULL;
|
||||
if (E_num)
|
||||
p = (NUMBER **) realloc(E_table, sz);
|
||||
else
|
||||
p = (NUMBER **) malloc(sz);
|
||||
if (p == NULL)
|
||||
return NULL;
|
||||
E_table = p;
|
||||
for (k = E_num; k <= m; k++) {
|
||||
nn = 2 * k + 2;
|
||||
|
4
qio.c
4
qio.c
@@ -17,8 +17,8 @@
|
||||
* 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.2 $
|
||||
* @(#) $Id: qio.c,v 29.2 2000/06/07 14:02:13 chongo Exp chongo $
|
||||
* @(#) $Revision: 29.3 $
|
||||
* @(#) $Id: qio.c,v 29.3 2000/07/17 15:35:49 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/qio.c,v $
|
||||
*
|
||||
* Under source code control: 1993/07/30 19:42:46
|
||||
|
4
qmath.c
4
qmath.c
@@ -19,8 +19,8 @@
|
||||
* 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.2 $
|
||||
* @(#) $Id: qmath.c,v 29.2 2000/06/07 14:02:13 chongo Exp chongo $
|
||||
* @(#) $Revision: 29.3 $
|
||||
* @(#) $Id: qmath.c,v 29.3 2000/07/17 15:35:49 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/qmath.c,v $
|
||||
*
|
||||
* Under source code control: 1990/02/15 01:48:21
|
||||
|
4
qmath.h
4
qmath.h
@@ -17,8 +17,8 @@
|
||||
* 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.2 $
|
||||
* @(#) $Id: qmath.h,v 29.2 2000/06/07 14:02:13 chongo Exp chongo $
|
||||
* @(#) $Revision: 29.3 $
|
||||
* @(#) $Id: qmath.h,v 29.3 2000/07/17 15:35:49 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/qmath.h,v $
|
||||
*
|
||||
* Under source code control: 1993/07/30 19:42:47
|
||||
|
@@ -17,8 +17,8 @@
|
||||
# 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.2 $
|
||||
# @(#) $Id: Makefile,v 29.2 2000/06/07 14:02:54 chongo Exp $
|
||||
# @(#) $Revision: 29.3 $
|
||||
# @(#) $Id: Makefile,v 29.3 2000/12/17 12:28:31 chongo Exp $
|
||||
# @(#) $Source: /usr/local/src/cmd/calc/sample/RCS/Makefile,v $
|
||||
#
|
||||
# Under source code control: 1997/04/19 22:46:49
|
||||
@@ -378,7 +378,10 @@ depend:
|
||||
fi; \
|
||||
done
|
||||
${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'`"; \
|
||||
echo "#if !defined($$tag)" > "skel/$$i"; \
|
||||
echo "#define $$tag" >> "skel/$$i"; \
|
||||
|
4
token.c
4
token.c
@@ -19,8 +19,8 @@
|
||||
* 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.3 $
|
||||
* @(#) $Id: token.c,v 29.3 2000/06/07 14:02:13 chongo Exp chongo $
|
||||
* @(#) $Revision: 29.4 $
|
||||
* @(#) $Id: token.c,v 29.4 2000/07/17 15:35:49 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/token.c,v $
|
||||
*
|
||||
* Under source code control: 1990/02/15 01:48:25
|
||||
|
4
value.c
4
value.c
@@ -17,8 +17,8 @@
|
||||
* 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.2 $
|
||||
* @(#) $Id: value.c,v 29.2 2000/06/07 14:02:13 chongo Exp chongo $
|
||||
* @(#) $Revision: 29.3 $
|
||||
* @(#) $Id: value.c,v 29.3 2000/07/17 15:35:49 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/value.c,v $
|
||||
*
|
||||
* Under source code control: 1990/02/15 01:48:25
|
||||
|
4
value.h
4
value.h
@@ -17,8 +17,8 @@
|
||||
* 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.2 $
|
||||
* @(#) $Id: value.h,v 29.2 2000/06/07 14:02:13 chongo Exp chongo $
|
||||
* @(#) $Revision: 29.3 $
|
||||
* @(#) $Id: value.h,v 29.3 2000/07/17 15:35:49 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/value.h,v $
|
||||
*
|
||||
* Under source code control: 1993/07/30 19:42:47
|
||||
|
@@ -19,8 +19,8 @@
|
||||
* 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.14 $
|
||||
* @(#) $Id: version.c,v 29.14 2000/07/14 07:20:42 chongo Exp chongo $
|
||||
* @(#) $Revision: 29.18 $
|
||||
* @(#) $Id: version.c,v 29.18 2000/12/17 12:31:05 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/version.c,v $
|
||||
*
|
||||
* Under source code control: 1990/05/22 11:00:58
|
||||
@@ -42,8 +42,8 @@ static char *program;
|
||||
|
||||
#define MAJOR_VER 2 /* major version */
|
||||
#define MINOR_VER 11 /* minor version */
|
||||
#define MAJOR_PATCH 3 /* patch level or 0 if no patch */
|
||||
#define MINOR_PATCH "0" /* test number or empty string if no patch */
|
||||
#define MAJOR_PATCH 4 /* patch level or 0 if no patch */
|
||||
#define MINOR_PATCH "2" /* test number or empty string if no patch */
|
||||
|
||||
/*
|
||||
* calc version constants
|
||||
|
4
zfunc.c
4
zfunc.c
@@ -19,8 +19,8 @@
|
||||
* 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.2 $
|
||||
* @(#) $Id: zfunc.c,v 29.2 2000/06/07 14:02:13 chongo Exp chongo $
|
||||
* @(#) $Revision: 29.3 $
|
||||
* @(#) $Id: zfunc.c,v 29.3 2000/07/17 15:35:49 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/zfunc.c,v $
|
||||
*
|
||||
* Under source code control: 1990/02/15 01:48:27
|
||||
|
4
zio.c
4
zio.c
@@ -17,8 +17,8 @@
|
||||
* 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.2 $
|
||||
* @(#) $Id: zio.c,v 29.2 2000/06/07 14:02:13 chongo Exp chongo $
|
||||
* @(#) $Revision: 29.3 $
|
||||
* @(#) $Id: zio.c,v 29.3 2000/07/17 15:35:49 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/zio.c,v $
|
||||
*
|
||||
* Under source code control: 1993/07/30 19:42:48
|
||||
|
4
zmath.h
4
zmath.h
@@ -17,8 +17,8 @@
|
||||
* 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.2 $
|
||||
* @(#) $Id: zmath.h,v 29.2 2000/06/07 14:02:13 chongo Exp chongo $
|
||||
* @(#) $Revision: 29.3 $
|
||||
* @(#) $Id: zmath.h,v 29.3 2000/07/17 15:35:49 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/zmath.h,v $
|
||||
*
|
||||
* Under source code control: 1993/07/30 19:42:48
|
||||
|
7
zmod.c
7
zmod.c
@@ -19,8 +19,8 @@
|
||||
* 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.2 $
|
||||
* @(#) $Id: zmod.c,v 29.2 2000/06/07 14:02:13 chongo Exp $
|
||||
* @(#) $Revision: 29.3 $
|
||||
* @(#) $Id: zmod.c,v 29.3 2000/07/17 15:35:49 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/zmod.c,v $
|
||||
*
|
||||
* Under source code control: 1991/05/22 23:03:55
|
||||
@@ -544,10 +544,9 @@ zpowermod(ZVALUE z1, ZVALUE z2, ZVALUE z3, ZVALUE *res)
|
||||
*res = _zero_;
|
||||
return;
|
||||
}
|
||||
if (zisone(z1) && ziseven(z2)) {
|
||||
if (zisone(z1)) {
|
||||
if (ztmp.len)
|
||||
zfree(ztmp);
|
||||
zfree(z1);
|
||||
*res = _one_;
|
||||
return;
|
||||
}
|
||||
|
Reference in New Issue
Block a user