Compare commits

...

2 Commits

Author SHA1 Message Date
Landon Curt Noll
b60eec99bb Release calc version 2.11.6 2017-05-21 15:38:42 -07:00
Landon Curt Noll
383290a844 Release calc version 2.11.5.8 2017-05-21 15:38:42 -07:00
43 changed files with 1380 additions and 542 deletions

60
CHANGES
View File

@@ -1,4 +1,48 @@
The following are the changes from calc version 2.11.5.5 to date:
The following are the changes from calc version 2.11.6.0 to date:
Clarified remark in lucas.cal about use of n mod 2^n == 0.
Fixed help typos reported by Marc Mezzarobba <mm at mm dot ovh dot org>.
Forced system("") to return 0 under windoz.
The direct.h include file is not used when compiling under Cygwin.
Fixed bug where random(10,11) caused calc to dump core when issued
the 2nd time.
Moved the setting of the Makefile variable ${CALC_INCDIR} to
the section where things like ${BINDIR} and ${LIBDIR} are set.
Idea from Clifford Kite <kite_public1 at ev1 dot net>.
The Makefile is shipped mode 0644 since a number of folks
edit it (to build and check calc) as a non-root user and later
on su to root to install. Idea from Clifford Kite <kite_public1
at ev1 dot net>.
Added base2() builtin function to calc. Normally calc prints
values according to base(). Frequently some users want to see
a value in two bases. Flipping back and forth between to bases
is a bit of a pain. With base2(), calc will output a value twice:
; 234567
234567
; base2(16),
; 234567
234567 /* 0x39447 */
; 131072
131072 /* 0x20000 */
; base2(0),
; 131072
131072
By default, base2() is disabled. Calling base2(0) will also turn
off the double base mode. Thanks goes to Erik Anggard
<eriki dot anggardi at packetfronti dot com> for his idea and
his initial patch.
The following are the changes from calc version 2.11.5.5 to 2.11.5.9:
Now using version numbers of one of these forms:
@@ -20,6 +64,7 @@ The following are the changes from calc version 2.11.5.5 to date:
Removed an obsolete reference to TOPDIR. This was fixed thanks to
a bug report by Clifford Kite <kite_public1 at ev1 dot net>.
Fixed other inconsistencies related to things like BINDIR.
Fixed calc man page so that is refers to -f instead of the old -S flag.
Fixed thanks to Clifford Kite <kite_public1 at ev1 dot net> for
@@ -50,6 +95,15 @@ The following are the changes from calc version 2.11.5.5 to date:
We appreciate their work in this regard. In the next release, we
plan to also build and release our own RPMs based on their efforts.
Changed the Makefile variable CUSTOMLIBDIR to CUSTOMCALDIR.
Changed the Makefile variable CSHAREDIR to CALC_SHAREDIR.
Changed the Makefile variable INCDIRCALC to CALC_INCDIR.
Removed the Makefile variable SHAREDIR.
Updated the HOWTO.INSTALL and README.WINDOWS files.
Fixed definition of MAXUFULL. Thanks to a bus report from
Jill Poland <jpoland at cadence dot com>.
The following are the changes from calc version 2.11.5t4.1 to 2.11.5t4.4:
@@ -5411,8 +5465,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.46 $
## @(#) $Id: CHANGES,v 29.46 2002/03/12 10:58:31 chongo Exp $
## @(#) $Revision: 29.50 $
## @(#) $Id: CHANGES,v 29.50 2002/12/29 09:22:43 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/RCS/CHANGES,v $
##
## Under source code control: 1993/06/02 18:12:57

View File

@@ -1,50 +1,105 @@
Installing calc in 4 easy steps:
1) Look at the makefile, and adjust it to suit your needs.
1) Look at the makefile, and adjust it to suit your needs.
Here are some Makefile hints:
The Makefile, as shipped, is suitable for installation under
Linux and Un*x-like environments. For the most part, the default
values should work. If in doubt, follow the 'When in doubt'
suggestion.
Select a compiler set by commenting in the appropriate set
of cc options. As shipped the Makefile assumes a gcc-like
environment such as Linux. If a more appropriate cc set if
found below, comment out the Linux set and comment in that
set or edit the gcc set or the common cc set as needed.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! If you are building under Windoz or a Windoz-like environment !
! (such as Cygwin or DJGPP), read the README.WINDOWS file. !
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
You may or may not need RANLIB when building libraries.
As shipped the Makefile assumes RANLIB is needed.
Comment the in/out the RANLIB value if ranlib does
not work or does not exist.
You should determine if these Makefile variables are reasonable:
You may want to change the default pager used by calc.
As shipped the Makefile assumes 'more'. On your system
you may find 'less' to be a better pager.
INCDIR Where the system include (.h) files are kept.
BINDIR Where to install calc binary files.
LIBDIR Where to install calc link library (*.a) files.
CALC_SHAREDIR Where to install calc help, .cal, startup, and
config files.
Set BINDIR to the directory where calc is installed.
As shipped the Makefile assumes BINDIR is /usr/local/bin.
You may want to change the default installation locations for
these values, which are based on the 4 values listed above:
Set SHAREDIR to the place where shared files are kept.
As shipped the Makefile assumes that SHAREDIR is /usr/share.
Calc places its shared files under ${SHAREDIR}/calc.
HELPDIR where the help directory is installed
CALC_INCDIR where the calc include files are installed
CUSTOMCALDIR where custom *.cal files are installed
CUSTOMHELPDIR where custom help files are installed
CUSTOMINCPDIR where custom .h files are installed
SCRIPTDIR where calc shell scripts are installed
Set INCDIR to the place where .h header files are kept.
As shipped the Makefile assumes that INCDIR is /usr/include.
Calc places its .h header files under ${INCDIR}/calc.
If you want to install calc files under a top level directory,
then set the T value:
Set LIBDIR to be the place under which help files, calc,
include files and calc libs are to be installed.
As shipped the Makefile assumes a LIBDIR of /usr/lib.
The calc library is installed as ${LIBDIR}/libcalc.a.
The calc install is performed under $T, the calc build is
performed under /. The purpose for $T is to allow someone
to install calc somewhere other than into the system area.
Some compilers (to put it mildly) have bugs. Sometimes the
DEBUG Makefile variable causes the compiler / optimizer to
produce bad code. Other compilers do just fine. If possible
try to use DEBUG=-O3 -g3 (maximum optimization and debug symbols).
If the calc test fails (see step 3), try lowering either the
-O value and/or the -g3. Also try using -Osomething without -g.
For example, if:
BINDIR= /usr/bin
LIBDIR= /usr/lib
CALC_SHAREDIR= /usr/share/calc
and if:
T= /var/tmp/testing
Then the installation locations will be:
calc binary files: /var/tmp/testing/usr/bin
calc link library: /var/tmp/testing/usr/lib
calc help, .cal ...: /var/tmp/testing/usr/share/calc
... etc ... /var/tmp/testing/...
If $T is empty, calc is installed under /, which is the same
top of tree for which it was built. If $T is non-empty, then
calc is installed under $T, as if one had to chroot under
$T for calc to operate.
Look for the section that starts:
################
# compiler set #
################
Select a compiler set by commenting in the appropriate set
of cc options. As shipped the Makefile assumes a gcc-like
environment such as Linux. If a more appropriate cc set if
found below, comment out the Linux set and comment in that
set or edit the gcc set or the common cc set as needed.
You may want to change these Makrfile variables from their defaults:
RANLIB
You may or may not need RANLIB when building libraries.
As shipped the Makefile assumes RANLIB is needed.
Comment the in/out the RANLIB value if ranlib does
not work or does not exist.
CALCPAGER
You may want to change the default pager used by calc.
As shipped the Makefile assumes 'more'. On your system
you may find 'less' to be a better pager.
DEBUG
Some compilers (to put it mildly) have bugs. Sometimes the
DEBUG Makefile variable causes the compiler / optimizer to
produce bad code. Other compilers do just fine.
If possible try to use DEBUG=-O3 -g3 (maximum optimization
and debug symbols). If the calc test fails (see step 3),
try lowering either the -O value and/or the -g3. Also try
using -Osomething without -g.
Adjust other Makefile variables as needed.
2) build calc:
2) build calc:
make all
@@ -52,13 +107,14 @@ Installing calc in 4 easy steps:
you may find. See the BUGS file if you find any compiler
warning or errors.
3) test calc:
3) test calc:
make check
==> If you run into problems, follow the BUGS file instructions.
==> If you run into problems, read the BUGS file and follow
the instructions found in there.
4) install calc:
4) install calc:
make install
@@ -81,8 +137,8 @@ the calc help subsystem. See the README file for details.
## 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: HOWTO.INSTALL,v 29.4 2002/03/12 09:03:17 chongo Exp $
## @(#) $Revision: 29.6 $
## @(#) $Id: HOWTO.INSTALL,v 29.6 2002/03/14 00:28:28 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/RCS/HOWTO.INSTALL,v $
##
## Under source code control: 1999/09/27 20:48:44

331
Makefile
View File

@@ -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.
#
MAKEFILE_REV= $$Revision: 29.46 $$
# @(#) $Id: Makefile.ship,v 29.46 2002/03/12 10:43:05 chongo Exp $
MAKEFILE_REV= $$Revision: 29.48 $$
# @(#) $Id: Makefile.ship,v 29.48 2002/12/29 07:13:50 chongo Exp $
# @(#) $Source: /usr/local/src/cmd/calc/RCS/Makefile.ship,v $
#
# Under source code control: 1990/02/15 01:48:41
@@ -541,89 +541,117 @@ HAVE_UNISTD_H=
#HAVE_UNISTD_H= YES
#HAVE_UNISTD_H= NO
# where to install the *.cal, *.h and *.a files
# System include files
#
# These 4 values control where things are installed
# -------------------------------------------------
# ${BINDIR} where to install binary files
# ${SHAREDIR} where most common shared files are kept
# ${INCDIR} where most .h files are kept
# ${LIBDIR} where *.a files are installed
# ${INCDIR} where the system include (.h) files are kept
#
# For DJGPP, select:
#
# BINDIR= /dev/env/DJDIR/bin
# SHAREDIR= /dev/env/DJDIR/share
# INCDIR= /dev/env/DJDIR/include
# LIBDIR= /dev/env/DJDIR/lib
#
# If in doubt, set:
#
# BINDIR= /usr/bin
# SHAREDIR= /usr/share
# INCDIR= /usr/include
# LIBDIR= /usr/lib
#
#BINDIR= /usr/local/bin
#BINDIR= /dev/env/DJDIR/bin
BINDIR= /usr/bin
#SHAREDIR= /usr/local/lib
#SHAREDIR= /dev/env/DJDIR/share
SHAREDIR= /usr/share
#INCDIR= /usr/local/include
#INCDIR= /dev/env/DJDIR/include
INCDIR= /usr/include
# Where to install calc realted things
#
# ${BINDIR} where to install calc binary files
# ${LIBDIR} where calc link library (*.a) files are installed
# ${CALC_SHAREDIR} where to install calc help, .cal, startup, config files
# ${CALC_INCDIR} where the calc include files are installed
#
# NOTE: The install rule prepends installation paths with $T, which
# by default is empty. If $T is non-empty, then installation
# locations will be relative to the $T directory.
#
# For DJGPP, select:
#
# BINDIR= /dev/env/DJDIR/bin
# LIBDIR= /dev/env/DJDIR/lib
# CALC_SHAREDIR= /dev/env/DJDIR/share/calc
#
# If in doubt, set:
#
# BINDIR= /usr/bin
# LIBDIR= /usr/lib
# CALC_SHAREDIR= /usr/share/calc
#
#BINDIR= /usr/local/bin
#BINDIR= /dev/env/DJDIR/bin
BINDIR= /usr/bin
#LIBDIR= /usr/local/lib
#LIBDIR= /dev/env/DJDIR/lib
LIBDIR= /usr/lib
# By default, these values are based on the above 4 values
# --------------------------------------------------------
# ${CSHAREDIR} where most common shared calc files are kept
#CALC_SHAREDIR= /usr/local/lib/calc
#CALC_SHAREDIR= /dev/env/DJDIR/share/calc
CALC_SHAREDIR= /usr/share/calc
#CALC_INCDIR= /usr/local/include/calc
#CALC_INCDIR= /dev/env/DJDIR/include/calc
CALC_INCDIR= ${INCDIR}/calc
# By default, these values are based CALC_SHAREDIR, INCDIR, BINDIR
# ---------------------------------------------------------------
# ${HELPDIR} where the help directory is installed
# ${INCDIRCALC} where the calc include files are installed
# ${CUSTOMLIBDIR} where custom *.cal files are installed
# ${CUSTOMCALDIR} where custom *.cal files are installed
# ${CUSTOMHELPDIR} where custom help files are installed
# ${CUSTOMINCPDIR} where custom .h files are installed
# ${SCRIPTDIR} where calc shell scripts are installed
#
# NOTE: The install rule prepends installation paths with $T, which
# by default is empty. If $T is non-empty, then installation
# locations will be relative to the $T directory.
#
# If in doubt, set:
#
# CSHAREDIR= ${SHAREDIR}/calc
# HELPDIR= ${CSHAREDIR}/help
# INCDIRCALC= ${INCDIR}/calc
# CUSTOMLIBDIR= ${CSHAREDIR}/custom
# CUSTOMHELPDIR= ${CSHAREDIR}/custhelp
# CUSTOMINCDIR= ${INCDIRCALC}/custom
# HELPDIR= ${CALC_SHAREDIR}/help
# CALC_INCDIR= ${INCDIR}/calc
# CUSTOMCALDIR= ${CALC_SHAREDIR}/custom
# CUSTOMHELPDIR= ${CALC_SHAREDIR}/custhelp
# CUSTOMINCDIR= ${CALC_INCDIR}/custom
# SCRIPTDIR= ${BINDIR}/cscript
#
CSHAREDIR= ${SHAREDIR}/calc
HELPDIR= ${CSHAREDIR}/help
INCDIRCALC= ${INCDIR}/calc
CUSTOMLIBDIR= ${CSHAREDIR}/custom
CUSTOMHELPDIR= ${CSHAREDIR}/custhelp
CUSTOMINCDIR= ${INCDIRCALC}/custom
HELPDIR= ${CALC_SHAREDIR}/help
CUSTOMCALDIR= ${CALC_SHAREDIR}/custom
CUSTOMHELPDIR= ${CALC_SHAREDIR}/custhelp
CUSTOMINCDIR= ${CALC_INCDIR}/custom
SCRIPTDIR= ${BINDIR}/cscript
# T - top level directory under which calc will be installed
#
# The calc install is performed under $T, the calc build is
# performed under /. For example, calc is built with its help
# directory being ${HELPDIR}. Howeever calc help files are
# installed under $T${HELPDIR}.
# performed under /. The purpose for $T is to allow someone
# to install calc somewhere other than into the system area.
#
# For example, if:
#
# BINDIR= /usr/bin
# LIBDIR= /usr/lib
# CALC_SHAREDIR= /usr/share/calc
#
# and if:
#
# T= /var/tmp/testing
#
# Then the installation locations will be:
#
# calc binary files: /var/tmp/testing/usr/bin
# calc link library: /var/tmp/testing/usr/lib
# calc help, .cal ...: /var/tmp/testing/usr/share/calc
# ... etc ... /var/tmp/testing/...
#
# If $T is empty, calc is installed under /, which is the same
# top of tree for which it was built. If $T is non-empty, then
# calc is installed under $T, as if one had to chroot under
# $T for calc to operate.
#
# The purpose for $T is to allow someone to install calc
# somewhere other than into the system area. For example when
# forming the calc rpm, the Makefile is called with T=$RPM_BUILD_ROOT.
#
# If in doubt, use T=
#
T=
@@ -710,18 +738,18 @@ CATMODE= 0444
# If the $CALCPATH environment variable is not defined, then the following
# path will be search for calc resource file routines.
#
# Select CALCPATH= .;./cal;~/.cal;${CSHAREDIR};${CUSTOMLIBDIR} for DJGPP.
# Select CALCPATH= .;./cal;~/.cal;${CALC_SHAREDIR};${CUSTOMCALDIR} for DJGPP.
#
CALCPATH= .:./cal:~/.cal:${CSHAREDIR}:${CUSTOMLIBDIR}
#CALCPATH= .;./cal;~/.cal;${CSHAREDIR};${CUSTOMLIBDIR}
CALCPATH= .:./cal:~/.cal:${CALC_SHAREDIR}:${CUSTOMCALDIR}
#CALCPATH= .;./cal;~/.cal;${CALC_SHAREDIR};${CUSTOMCALDIR}
# If the $CALCRC environment variable is not defined, then the following
# path will be search for calc resource files.
#
# Select CALCRC= ${CSHAREDIR}/startup;~/.calcrc;./.calcinit for DJGPP.
# Select CALCRC= ${CALC_SHAREDIR}/startup;~/.calcrc;./.calcinit for DJGPP.
#
CALCRC= ${CSHAREDIR}/startup:~/.calcrc:./.calcinit
#CALCRC= ${CSHAREDIR}/startup;~/.calcrc;./.calcinit
CALCRC= ${CALC_SHAREDIR}/startup:~/.calcrc:./.calcinit
#CALCRC= ${CALC_SHAREDIR}/startup;~/.calcrc;./.calcinit
# Determine of the GNU-readline facility will be used instead of the
# built-in calc binding method.
@@ -899,7 +927,9 @@ CALC_ENV= CALCPATH=./cal
ALLOW_CUSTOM= -DCUSTOM
#ALLOW_CUSTOM=
###
################
# compiler set #
################
#
# Select your compiler type by commenting out one of the cc sets below:
#
@@ -1253,14 +1283,16 @@ UTIL_PROGS= align32 fposval have_uid_t longlong have_const \
# The complete list of Makefile vars passed down to custom/Makefile.
#
CUSTOM_PASSDOWN= Q="${Q}" \
SHAREDIR="${SHAREDIR}" \
INCDIR="${INCDIR}" \
CSHAREDIR="${CSHAREDIR}" \
BINDIR="${BINDIR}" \
LIBDIR="${LIBDIR}" \
CALC_SHAREDIR="${CALC_SHAREDIR}" \
HELPDIR="${HELPDIR}" \
INCDIRCALC="${INCDIRCALC}" \
CUSTOMLIBDIR="${CUSTOMLIBDIR}" \
CALC_INCDIR="${CALC_INCDIR}" \
CUSTOMCALDIR="${CUSTOMCALDIR}" \
CUSTOMHELPDIR="${CUSTOMHELPDIR}" \
CUSTOMINCDIR="${CUSTOMINCDIR}" \
SCRIPTDIR="${SCRIPTDIR}" \
DEBUG="${DEBUG}" \
NO_SHARED="${NO_SHARED}" \
RANLIB="${RANLIB}" \
@@ -1287,12 +1319,16 @@ CUSTOM_PASSDOWN= Q="${Q}" \
# The complete list of Makefile vars passed down to sample/Makefile.
#
SAMPLE_PASSDOWN= Q="${Q}" \
BINDIR="${BINDIR}" \
SHAREDIR="${SHAREDIR}" \
INCDIR="${INCDIR}" \
BINDIR="${BINDIR}" \
LIBDIR="${LIBDIR}" \
CSHAREDIR="${CSHAREDIR}" \
CALC_SHAREDIR="${CALC_SHAREDIR}" \
HELPDIR="${HELPDIR}" \
CALC_INCDIR="${CALC_INCDIR}" \
CUSTOMCALDIR="${CUSTOMCALDIR}" \
CUSTOMHELPDIR="${CUSTOMHELPDIR}" \
CUSTOMINCDIR="${CUSTOMINCDIR}" \
SCRIPTDIR="${SCRIPTDIR}" \
DEBUG="${DEBUG}" \
NO_SHARED="${NO_SHARED}" \
RANLIB="${RANLIB}" \
@@ -1320,12 +1356,16 @@ SAMPLE_PASSDOWN= Q="${Q}" \
# The compelte list of Makefile vars passed down to help/Makefile.
#
HELP_PASSDOWN= Q="${Q}" \
SHAREDIR="${SHAREDIR}" \
INCDIR="${INCDIR}" \
BINDIR="${BINDIR}" \
LIBDIR="${LIBDIR}" \
CSHAREDIR="${CSHAREDIR}" \
CALC_SHAREDIR="${CALC_SHAREDIR}" \
HELPDIR="${HELPDIR}" \
INCDIRCALC="${INCDIRCALC}" \
CALC_INCDIR="${CALC_INCDIR}" \
CUSTOMCALDIR="${CUSTOMCALDIR}" \
CUSTOMHELPDIR="${CUSTOMHELPDIR}" \
CUSTOMINCDIR="${CUSTOMINCDIR}" \
SCRIPTDIR="${SCRIPTDIR}" \
ICFLAGS="${ICFLAGS}" \
ILDFLAGS="${ILDFLAGS}" \
LCC="${LCC}" \
@@ -1340,8 +1380,16 @@ HELP_PASSDOWN= Q="${Q}" \
# The compelte list of Makefile vars passed down to cal/Makefile.
#
CAL_PASSDOWN= Q="${Q}" \
SHAREDIR="${SHAREDIR}" \
CSHAREDIR="${CSHAREDIR}" \
INCDIR="${INCDIR}" \
BINDIR="${BINDIR}" \
LIBDIR="${LIBDIR}" \
CALC_SHAREDIR="${CALC_SHAREDIR}" \
HELPDIR="${HELPDIR}" \
CALC_INCDIR="${CALC_INCDIR}" \
CUSTOMCALDIR="${CUSTOMCALDIR}" \
CUSTOMHELPDIR="${CUSTOMHELPDIR}" \
CUSTOMINCDIR="${CUSTOMINCDIR}" \
SCRIPTDIR="${SCRIPTDIR}" \
MAKE_FILE=${MAKE_FILE} \
CHMOD=${CHMOD} \
CMP=${CMP} \
@@ -1351,7 +1399,15 @@ CAL_PASSDOWN= Q="${Q}" \
# The compelte list of Makefile vars passed down to cscript/Makefile.
#
CSCRIPT_PASSDOWN= Q="${Q}" \
INCDIR="${INCDIR}" \
BINDIR="${BINDIR}" \
LIBDIR="${LIBDIR}" \
CALC_SHAREDIR="${CALC_SHAREDIR}" \
HELPDIR="${HELPDIR}" \
CALC_INCDIR="${CALC_INCDIR}" \
CUSTOMCALDIR="${CUSTOMCALDIR}" \
CUSTOMHELPDIR="${CUSTOMHELPDIR}" \
CUSTOMINCDIR="${CUSTOMINCDIR}" \
SCRIPTDIR="${SCRIPTDIR}" \
MAKE_FILE=${MAKE_FILE} \
CHMOD=${CHMOD} \
@@ -1445,8 +1501,8 @@ calc.1: calc.man ${MAKE_FILE}
-e 's,$${BINDIR},${BINDIR},g' \
-e 's,$${CALCPATH},${CALCPATH},g' \
-e 's,$${SCRIPTDIR},${SCRIPTDIR},g' \
-e 's,$${INCDIRCALC},${INCDIRCALC},g' \
-e 's,$${CUSTOMLIBDIR},${CUSTOMLIBDIR},g' \
-e 's,$${CALC_INCDIR},${CALC_INCDIR},g' \
-e 's,$${CUSTOMCALDIR},${CUSTOMCALDIR},g' \
-e 's,$${CUSTOMINCDIR},${CUSTOMINCDIR},g' \
-e 's,$${CUSTOMHELPDIR},${CUSTOMHELPDIR},g' \
-e 's,$${CALCRC},${CALCRC},g' < calc.man > calc.1
@@ -1569,6 +1625,15 @@ endian_calc.h: endian ${MAKE_FILE}
elif [ -f ${INCDIR}/sys/endian.h ]; then \
echo '#include <sys/endian.h>' >> endian_calc.h; \
echo '#define CALC_BYTE_ORDER BYTE_ORDER' >> endian_calc.h; \
elif [ -f /usr/include/endian.h ]; then \
echo '#include <endian.h>' >> endian_calc.h; \
echo '#define CALC_BYTE_ORDER BYTE_ORDER' >> endian_calc.h; \
elif [ -f /usr/include/machine/endian.h ]; then \
echo '#include <machine/endian.h>' >> endian_calc.h; \
echo '#define CALC_BYTE_ORDER BYTE_ORDER' >> endian_calc.h; \
elif [ -f /usr/include/sys/endian.h ]; then \
echo '#include <sys/endian.h>' >> endian_calc.h; \
echo '#define CALC_BYTE_ORDER BYTE_ORDER' >> endian_calc.h; \
else \
./endian >> endian_calc.h; \
fi; \
@@ -1628,13 +1693,15 @@ have_malloc.h: ${MAKE_FILE}
${Q}echo '#define __HAVE_MALLOC_H__' >> have_malloc.h
${Q}echo '' >> have_malloc.h
${Q}echo '' >> have_malloc.h
${Q}echo '/* do we have ${INCDIR}/malloc.h? */' >> have_malloc.h
${Q}echo '/* do we have <malloc.h>? */' >> have_malloc.h
-${Q}if [ X"${HAVE_MALLOC_H}" = X"YES" ]; then \
echo '#define HAVE_MALLOC_H /* yes */' >> have_malloc.h; \
elif [ X"${HAVE_MALLOC_H}" = X"NO" ]; then \
echo '#undef HAVE_MALLOC_H /* no */' >> have_malloc.h; \
elif [ -f ${INCDIR}/malloc.h ]; then \
echo '#define HAVE_MALLOC_H /* yes */' >> have_malloc.h; \
elif [ -f /usr/include/malloc.h ]; then \
echo '#define HAVE_MALLOC_H /* yes */' >> have_malloc.h; \
else \
echo '#undef HAVE_MALLOC_H /* no */' >> have_malloc.h; \
fi
@@ -1664,13 +1731,15 @@ have_times.h: ${MAKE_FILE}
${Q}echo '#define __HAVE_TIMES_H__' >> have_times.h
${Q}echo '' >> have_times.h
${Q}echo '' >> have_times.h
${Q}echo '/* do we have ${INCDIR}/times.h? */' >> have_times.h
${Q}echo '/* do we have <times.h>? */' >> have_times.h
-${Q}if [ X"${HAVE_TIMES_H}" = X"YES" ]; then \
echo '#define HAVE_TIMES_H /* yes */' >> have_times.h; \
elif [ X"${HAVE_TIMES_H}" = X"NO" ]; then \
echo '#undef HAVE_TIMES_H /* no */' >> have_times.h; \
elif [ -f ${INCDIR}/times.h ]; then \
echo '#define HAVE_TIMES_H /* yes */' >> have_times.h; \
elif [ -f /usr/include/times.h ]; then \
echo '#define HAVE_TIMES_H /* yes */' >> have_times.h; \
else \
echo '#undef HAVE_TIMES_H /* no */' >> have_times.h; \
fi
@@ -1680,6 +1749,8 @@ have_times.h: ${MAKE_FILE}
echo '#undef HAVE_SYS_TIMES_H /* no */' >> have_times.h; \
elif [ -f ${INCDIR}/sys/times.h ]; then \
echo '#define HAVE_SYS_TIMES_H /* yes */' >> have_times.h; \
elif [ -f /usr/include/sys/times.h ]; then \
echo '#define HAVE_SYS_TIMES_H /* yes */' >> have_times.h; \
else \
echo '#undef HAVE_SYS_TIMES_H /* no */' >> have_times.h; \
fi
@@ -1689,6 +1760,8 @@ have_times.h: ${MAKE_FILE}
echo '#undef HAVE_TIME_H /* no */' >> have_times.h; \
elif [ -f ${INCDIR}/time.h ]; then \
echo '#define HAVE_TIME_H /* yes */' >> have_times.h; \
elif [ -f /usr/include/time.h ]; then \
echo '#define HAVE_TIME_H /* yes */' >> have_times.h; \
else \
echo '#undef HAVE_TIME_H /* no */' >> have_times.h; \
fi
@@ -1698,6 +1771,8 @@ have_times.h: ${MAKE_FILE}
echo '#undef HAVE_SYS_TIME_H /* no */' >> have_times.h; \
elif [ -f ${INCDIR}/sys/time.h ]; then \
echo '#define HAVE_SYS_TIME_H /* yes */' >> have_times.h; \
elif [ -f /usr/include/sys/time.h ]; then \
echo '#define HAVE_SYS_TIME_H /* yes */' >> have_times.h; \
else \
echo '#undef HAVE_SYS_TIME_H /* no */' >> have_times.h; \
fi
@@ -1727,13 +1802,15 @@ have_stdlib.h: ${MAKE_FILE}
${Q}echo '#define __HAVE_STDLIB_H__' >> have_stdlib.h
${Q}echo '' >> have_stdlib.h
${Q}echo '' >> have_stdlib.h
${Q}echo '/* do we have ${INCDIR}/stdlib.h? */' >> have_stdlib.h
${Q}echo '/* do we have <stdlib.h>? */' >> have_stdlib.h
-${Q}if [ X"${HAVE_STDLIB_H}" = X"YES" ]; then \
echo '#define HAVE_STDLIB_H /* yes */' >> have_stdlib.h; \
elif [ X"${HAVE_STDLIB_H}" = X"NO" ]; then \
echo '#undef HAVE_STDLIB_H /* no */' >> have_stdlib.h; \
elif [ -f ${INCDIR}/stdlib.h ]; then \
echo '#define HAVE_STDLIB_H /* yes */' >> have_stdlib.h; \
elif [ -f /usr/include/stdlib.h ]; then \
echo '#define HAVE_STDLIB_H /* yes */' >> have_stdlib.h; \
else \
echo '#undef HAVE_STDLIB_H /* no */' >> have_stdlib.h; \
fi
@@ -1763,13 +1840,15 @@ have_unistd.h: ${MAKE_FILE}
${Q}echo '#define __HAVE_UNISTD_H__' >> have_unistd.h
${Q}echo '' >> have_unistd.h
${Q}echo '' >> have_unistd.h
${Q}echo '/* do we have ${INCDIR}/unistd.h? */' >> have_unistd.h
${Q}echo '/* do we have <unistd.h>? */' >> have_unistd.h
-${Q}if [ X"${HAVE_UNISTD_H}" = X"YES" ]; then \
echo '#define HAVE_UNISTD_H /* yes */' >> have_unistd.h; \
elif [ X"${HAVE_UNISTD_H}" = X"NO" ]; then \
echo '#undef HAVE_UNISTD_H /* no */' >> have_unistd.h; \
elif [ -f ${INCDIR}/unistd.h ]; then \
echo '#define HAVE_UNISTD_H /* yes */' >> have_unistd.h; \
elif [ -f /usr/include/unistd.h ]; then \
echo '#define HAVE_UNISTD_H /* yes */' >> have_unistd.h; \
else \
echo '#undef HAVE_UNISTD_H /* no */' >> have_unistd.h; \
fi
@@ -1799,13 +1878,15 @@ have_string.h: ${MAKE_FILE}
${Q}echo '#define __HAVE_STRING_H__' >> have_string.h
${Q}echo '' >> have_string.h
${Q}echo '' >> have_string.h
${Q}echo '/* do we have ${INCDIR}/string.h? */' >> have_string.h
${Q}echo '/* do we have <string.h>? */' >> have_string.h
-${Q}if [ X"${HAVE_STRING_H}" = X"YES" ]; then \
echo '#define HAVE_STRING_H /* yes */' >> have_string.h; \
elif [ X"${HAVE_STRING_H}" = X"NO" ]; then \
echo '#undef HAVE_STRING_H /* no */' >> have_string.h; \
elif [ -f ${INCDIR}/string.h ]; then \
echo '#define HAVE_STRING_H /* yes */' >> have_string.h; \
elif [ -f /usr/include/string.h ]; then \
echo '#define HAVE_STRING_H /* yes */' >> have_string.h; \
else \
echo '#undef HAVE_STRING_H /* no */' >> have_string.h; \
fi
@@ -1854,6 +1935,16 @@ terminal.h: ${MAKE_FILE}
echo '#undef USE_TERMIOS /* <termios.h> */' >> terminal.h; \
echo '#define USE_TERMIO /* <termio.h> */' >> terminal.h; \
echo '#undef USE_SGTTY /* <sys/ioctl.h> */' >> terminal.h; \
elif [ -f /usr/include/termios.h ]; then \
echo '/* use termios */' >> terminal.h; \
echo '#define USE_TERMIOS /* <termios.h> */' >> terminal.h; \
echo '#undef USE_TERMIO /* <termio.h> */' >> terminal.h; \
echo '#undef USE_SGTTY /* <sys/ioctl.h> */' >> terminal.h; \
elif [ -f /usr/include/termio.h ]; then \
echo '/* use termio */' >> terminal.h; \
echo '#undef USE_TERMIOS /* <termios.h> */' >> terminal.h; \
echo '#define USE_TERMIO /* <termio.h> */' >> terminal.h; \
echo '#undef USE_SGTTY /* <sys/ioctl.h> */' >> terminal.h; \
else \
echo '/* use sgtty */' >> terminal.h; \
echo '#undef USE_TERMIOS /* <termios.h> */' >> terminal.h; \
@@ -3108,11 +3199,10 @@ env:
@echo 'HAVE_URANDOM=${HAVE_URANDOM}'; echo ''
@echo 'ALIGN32=${ALIGN32}'; echo ''
@echo 'BINDIR=${BINDIR}'; echo ''
@echo 'SHAREDIR=${SHAREDIR}'; echo ''
@echo 'CSHAREDIR=${CSHAREDIR}'; echo ''
@echo 'CALC_SHAREDIR=${CALC_SHAREDIR}'; echo ''
@echo 'LIBDIR=${LIBDIR}'; echo ''
@echo 'HELPDIR=${HELPDIR}'; echo ''
@echo 'CUSTOMLIBDIR=${CUSTOMLIBDIR}'; echo ''
@echo 'CUSTOMCALDIR=${CUSTOMCALDIR}'; echo ''
@echo 'CUSTOMINCDIR=${CUSTOMINCDIR}'; echo ''
@echo 'CUSTOMHELPDIR=${CUSTOMHELPDIR}'; echo ''
@echo 'SCRIPTDIR=${SCRIPTDIR}'; echo ''
@@ -3260,13 +3350,12 @@ calc.spec: spec-template ${MAKE_FILE} help/Makefile cal/Makefile \
${V} echo '=-=-=-=-= start of $@ rule =-=-=-=-='
${Q}rm -f calc.spec calc.spec.sed
${Q}echo 's,$${BINDIR},${BINDIR},g' >> calc.spec.sed
${Q}echo 's:$${SHAREDIR}:${SHAREDIR}:g' >> calc.spec.sed
${Q}echo 's,$${INCDIR},${INCDIR},g' >> calc.spec.sed
${Q}echo 's:$${LIBDIR}:${LIBDIR}:g' >> calc.spec.sed
${Q}echo 's:$${CSHAREDIR}:${CSHAREDIR}:g' >> calc.spec.sed
${Q}echo 's:$${CALC_SHAREDIR}:${CALC_SHAREDIR}:g' >> calc.spec.sed
${Q}echo 's,$${HELPDIR},${HELPDIR},g' >> calc.spec.sed
${Q}echo 's,$${INCDIRCALC},${INCDIRCALC},g' >> calc.spec.sed
${Q}echo 's,$${CUSTOMLIBDIR},${CUSTOMLIBDIR},g' >> calc.spec.sed
${Q}echo 's,$${CALC_INCDIR},${CALC_INCDIR},g' >> calc.spec.sed
${Q}echo 's,$${CUSTOMCALDIR},${CUSTOMCALDIR},g' >> calc.spec.sed
${Q}echo 's,$${CUSTOMINCDIR},${CUSTOMINCDIR},g' >> calc.spec.sed
${Q}echo 's,$${CUSTOMHELPDIR},${CUSTOMHELPDIR},g' >> calc.spec.sed
${Q}echo 's,$${SCRIPTDIR},${SCRIPTDIR},g' >> calc.spec.sed
@@ -3312,7 +3401,7 @@ inst_files: ${MAKE_FILE} help/Makefile cal/Makefile custom/Makefile \
${Q}echo ${LIBDIR}/libcalc.a >> inst_files
${Q}for i in ${LIB_H_SRC} ${BUILD_H_SRC} /dev/null; do \
if [ X"$$i" != X"/dev/null" ]; then \
echo ${INCDIRCALC}/$$i; \
echo ${CALC_INCDIR}/$$i; \
fi; \
done >> inst_files
${Q}if [ ! -z "${MANDIR}" ]; then \
@@ -3350,7 +3439,7 @@ rpm.mk.patch: Makefile.linux ${MAKE_FILE}
# The olduninstall rule will remove calc files from the older, histroic
# locations under the /usr/local directory. If you are using the
# new default values for ${BINDIR}, ${SHAREDIR}, ${INCDIR} and ${LIBDIR}
# new default values for ${BINDIR}, ${CALC_SHAREDIR}, ${INCDIR} and ${LIBDIR}
# then you can use this rule to clean out the older calc stuff under
# the /usr/local directory.
#
@@ -3358,13 +3447,12 @@ olduninstall:
-rm -f inst_files
${MAKE} -f Makefile \
BINDIR=/usr/local/bin \
SHAREDIR=/usr/local/lib \
INCDIR=/usr/local/include \
LIBDIR=/usr/local/lib/calc \
CSHAREDIR=/usr/local/lib/calc \
CALC_SHAREDIR=/usr/local/lib/calc \
HELPDIR=/usr/local/lib/calc/help \
INCDIRCALC=/usr/local/include/calc \
CUSTOMLIBDIR=/usr/local/lib/calc/custom \
CALC_INCDIR=/usr/local/include/calc \
CUSTOMCALDIR=/usr/local/lib/calc/custom \
CUSTOMHELPDIR=/usr/local/lib/calc/help/custhelp \
CUSTOMINCDIR=/usr/local/lib/calc/custom \
SCRIPTDIR=/usr/local/bin/cscript \
@@ -3478,18 +3566,6 @@ install: calc libcalc.a ${LIB_H_SRC} ${BUILD_H_SRC} calc.1
else \
true; \
fi
-${Q}if [ ! -d $T${SHAREDIR} ]; then \
echo mkdir $T${SHAREDIR}; \
mkdir $T${SHAREDIR}; \
if [ ! -d "$T${SHAREDIR}" ]; then \
echo mkdir -p "$T${SHAREDIR}"; \
mkdir -p "$T${SHAREDIR}"; \
fi; \
echo ${CHMOD} 0755 $T${SHAREDIR}; \
${CHMOD} 0755 $T${SHAREDIR}; \
else \
true; \
fi
-${Q}if [ ! -d $T${INCDIR} ]; then \
echo mkdir $T${INCDIR}; \
mkdir $T${INCDIR}; \
@@ -3514,16 +3590,15 @@ install: calc libcalc.a ${LIB_H_SRC} ${BUILD_H_SRC} calc.1
else \
true; \
fi
-${Q}if [ ! -d $T${CSHAREDIR} ]; then \
mkdir $T${CSHAREDIR}; \
echo mkdir $T${CSHAREDIR}; \
if [ ! -d "$T${CSHAREDIR}" ]; then \
echo mkdir -p "$T${CSHAREDIR}"; \
mkdir -p "$T${CSHAREDIR}"; \
-${Q}if [ ! -d $T${CALC_SHAREDIR} ]; then \
mkdir $T${CALC_SHAREDIR}; \
echo mkdir $T${CALC_SHAREDIR}; \
if [ ! -d "$T${CALC_SHAREDIR}" ]; then \
echo mkdir -p "$T${CALC_SHAREDIR}"; \
mkdir -p "$T${CALC_SHAREDIR}"; \
fi; \
mkdir $T${CSHAREDIR}; \
echo ${CHMOD} 0755 $T${CSHAREDIR}; \
${CHMOD} 0755 $T${CSHAREDIR}; \
echo ${CHMOD} 0755 $T${CALC_SHAREDIR}; \
${CHMOD} 0755 $T${CALC_SHAREDIR}; \
else \
true; \
fi
@@ -3539,27 +3614,27 @@ install: calc libcalc.a ${LIB_H_SRC} ${BUILD_H_SRC} calc.1
else \
true; \
fi
-${Q}if [ ! -d $T${INCDIRCALC} ]; then \
echo mkdir $T${INCDIRCALC}; \
mkdir $T${INCDIRCALC}; \
if [ ! -d "$T${INCDIRCALC}" ]; then \
echo mkdir -p "$T${INCDIRCALC}"; \
mkdir -p "$T${INCDIRCALC}"; \
-${Q}if [ ! -d $T${CALC_INCDIR} ]; then \
echo mkdir $T${CALC_INCDIR}; \
mkdir $T${CALC_INCDIR}; \
if [ ! -d "$T${CALC_INCDIR}" ]; then \
echo mkdir -p "$T${CALC_INCDIR}"; \
mkdir -p "$T${CALC_INCDIR}"; \
fi; \
echo ${CHMOD} 0755 $T${INCDIRCALC}; \
${CHMOD} 0755 $T${INCDIRCALC}; \
echo ${CHMOD} 0755 $T${CALC_INCDIR}; \
${CHMOD} 0755 $T${CALC_INCDIR}; \
else \
true; \
fi
-${Q}if [ ! -d $T${CUSTOMLIBDIR} ]; then \
echo mkdir $T${CUSTOMLIBDIR}; \
mkdir $T${CUSTOMLIBDIR}; \
if [ ! -d "$T${CUSTOMLIBDIR}" ]; then \
echo mkdir -p "$T${CUSTOMLIBDIR}"; \
mkdir -p "$T${CUSTOMLIBDIR}"; \
-${Q}if [ ! -d $T${CUSTOMCALDIR} ]; then \
echo mkdir $T${CUSTOMCALDIR}; \
mkdir $T${CUSTOMCALDIR}; \
if [ ! -d "$T${CUSTOMCALDIR}" ]; then \
echo mkdir -p "$T${CUSTOMCALDIR}"; \
mkdir -p "$T${CUSTOMCALDIR}"; \
fi; \
echo ${CHMOD} 0755 $T${CUSTOMLIBDIR}; \
${CHMOD} 0755 $T${CUSTOMLIBDIR}; \
echo ${CHMOD} 0755 $T${CUSTOMCALDIR}; \
${CHMOD} 0755 $T${CUSTOMCALDIR}; \
else \
true; \
fi
@@ -3671,14 +3746,14 @@ install: calc libcalc.a ${LIB_H_SRC} ${BUILD_H_SRC} calc.1
fi; \
rm -f tmp; \
${SED} -e 's/^\(#[ ]*include[ ][ ]*\)"/\1"calc\//' $$i > tmp; \
if ${CMP} -s tmp $T${INCDIRCALC}/$$i; then \
if ${CMP} -s tmp $T${CALC_INCDIR}/$$i; then \
true; \
else \
rm -f $T${INCDIRCALC}/$$i.new; \
cp -f tmp $T${INCDIRCALC}/$$i.new; \
${CHMOD} 0444 $T${INCDIRCALC}/$$i.new; \
mv -f $T${INCDIRCALC}/$$i.new $T${INCDIRCALC}/$$i; \
echo "installed $T${INCDIRCALC}/$$i"; \
rm -f $T${CALC_INCDIR}/$$i.new; \
cp -f tmp $T${CALC_INCDIR}/$$i.new; \
${CHMOD} 0444 $T${CALC_INCDIR}/$$i.new; \
mv -f $T${CALC_INCDIR}/$$i.new $T${CALC_INCDIR}/$$i; \
echo "installed $T${CALC_INCDIR}/$$i"; \
fi; \
done
${Q}rm -f tmp

View File

@@ -10,9 +10,68 @@ NOTE: The main developers do not have access to a Windoz based platform.
Of course you are welcome to send us any patches that fix your
Windoz build environment.
=-=-=-=-=
=-=-=-=-=
=-=-=-=-=
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
=-= compiling under DJGPP =-=
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
You might want to try using the DJGPP system to compile calc. See:
http://www.delorie.com/djgpp/
for DJGPP details and availability.
To compile with DJGPP, one needs to select a number of Makefile
variable changes. Eli Zaretskii <eliz at is dot elta dot co dot il>
recommends the following settings:
TERMCONTROL= -DUSE_TERMIOS
BYTE_ORDER= -DLITTLE_ENDIAN
LONG_BITS= 32
LONGLONG_BITS= 64
HAVE_FPOS_POS= -DHAVE_NO_FPOS_POS
FPOS_BITS= 32
OFF_T_BITS= 32
DEV_BITS= 32
INODE_BITS= 32
HAVE_USTAT= -DHAVE_NO_USTAT
HAVE_GETSID= -DHAVE_NO_GETSID
HAVE_GETPGID= -DHAVE_NO_GETPGID
HAVE_GETTIME= -DHAVE_NO_GETTIME
HAVE_GETPRID= -DHAVE_NO_GETPRID
HAVE_URANDOM_H= NO
ALIGN32= -UMUST_ALIGN32
HAVE_MALLOC_H= YES
HAVE_STDLIB_H= YES
HAVE_STRING_H= YES
HAVE_TIMES_H= NO
HAVE_SYS_TIMES_H= YES
HAVE_TIME_H= YES
HAVE_SYS_TIME_H= YES
HAVE_UNISTD_H= YES
BINDIR= /dev/env/DJDIR/bin
INCDIR= /dev/env/DJDIR/include
LIBDIR= /dev/env/DJDIR/lib
MANDIR= /dev/env/DJDIR/man/man1
CATDIR= /dev/env/DJDIR/man/cat1
NROFF= groff
CALCPATH= .;./cal;~/.cal;${CALC_SHAREDIR};${CUSTOMCALDIR}
CALCRC= ${CALC_SHAREDIR}/startup;~/.calcrc;./.calcinit
CALCPAGER= less.exe -ci
DEBUG= -O2 -gstabs+
The 'Linux set' or 'gcc set' (see the Select your compiler type section)
should work for DJGPP systems if you set the above Makefile variables.
Look for Makefile comments of the form:
# Select ...something... for DJGPP.
Follow those recommendations. In cases where they conflict with
the above Makefile list, follow the recommendation in the Makefile.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
=-= compiling with Cygwin =-=
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
An effort is being made to allow windows users to compile calc using the
Cygwin project (http://sources.redhat.com/cygwin/) with the GCC compiler
@@ -79,69 +138,6 @@ was changed to:
DLL extern int configtype(char*);
=-=-=-=-=
=-=-=-=-=
=-=-=-=-=
There is a different approach to the Cygwin approach above
----------------------------------------------------------
You might want to try using the DJGPP system to compile calc. See:
http://www.delorie.com/djgpp/
for DJGPP details and availability.
To compile with DJGPP, one needs to select a number of Makefile
variable changes. Eli Zaretskii <eliz at is dot elta dot co dot il>
recommends the following settings:
TERMCONTROL= -DUSE_TERMIOS
BYTE_ORDER= -DLITTLE_ENDIAN
LONG_BITS= 32
LONGLONG_BITS= 64
HAVE_FPOS_POS= -DHAVE_NO_FPOS_POS
FPOS_BITS= 32
OFF_T_BITS= 32
DEV_BITS= 32
INODE_BITS= 32
HAVE_USTAT= -DHAVE_NO_USTAT
HAVE_GETSID= -DHAVE_NO_GETSID
HAVE_GETPGID= -DHAVE_NO_GETPGID
HAVE_GETTIME= -DHAVE_NO_GETTIME
HAVE_GETPRID= -DHAVE_NO_GETPRID
HAVE_URANDOM_H= NO
ALIGN32= -UMUST_ALIGN32
HAVE_MALLOC_H= YES
HAVE_STDLIB_H= YES
HAVE_STRING_H= YES
HAVE_TIMES_H= NO
HAVE_SYS_TIMES_H= YES
HAVE_TIME_H= YES
HAVE_SYS_TIME_H= YES
HAVE_UNISTD_H= YES
BINDIR= /dev/env/DJDIR/bin
SHAREDIR= /dev/env/DJDIR/share
INCDIR= /dev/env/DJDIR/include
LIBDIR= /dev/env/DJDIR/lib
MANDIR= /dev/env/DJDIR/man/man1
CATDIR= /dev/env/DJDIR/man/cat1
NROFF= groff
CALCPATH= .;./cal;~/.cal;${CSHAREDIR};${CUSTOMLIBDIR}
CALCRC= ${CSHAREDIR}/startup;~/.calcrc;./.calcinit
CALCPAGER= less.exe -ci
DEBUG= -O2 -gstabs+
The 'Linux set' or 'gcc set' (see the Select your compiler type section)
should work for DJGPP systems if you set the above Makefile variables.
Look for Makefile comments of the form:
# Select ...something... for DJGPP.
Follow those recommendations. In cases where they conflict with
the above Makefile list, follow the recommendation in the Makefile.
## Copyright (C) 2002 Landon Curt Noll and Thomas Jones-Low
##
@@ -159,8 +155,8 @@ the above Makefile list, follow the recommendation in the Makefile.
## 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.7 $
## @(#) $Id: README.WINDOWS,v 29.7 2002/03/12 10:50:25 chongo Exp $
## @(#) $Revision: 29.8 $
## @(#) $Id: README.WINDOWS,v 29.8 2002/03/14 00:28:28 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/RCS/README.WINDOWS,v $
##
## Under source code control: 2001/02/25 14:00:05

View File

@@ -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.13 $
# @(#) $Id: Makefile,v 29.13 2002/03/12 08:32:35 chongo Exp $
# @(#) $Revision: 29.14 $
# @(#) $Id: Makefile,v 29.14 2002/03/14 00:28:28 chongo Exp $
# @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/Makefile,v $
#
# Under source code control: 1991/07/21 05:00:54
@@ -36,23 +36,111 @@
SHELL = /bin/sh
MAKE_FILE = Makefile
####
# Normally, the upper level makefile will set these values. We provide
# a default here just in case you want to build from this directory.
#
# where to install things
#SHAREDIR= /usr/local/lib
#SHAREDIR= /usr/lib
SHAREDIR= /usr/share
#SHAREDIR= /usr/libdata
####
CSHAREDIR= ${SHAREDIR}/calc
# Where the system include (.h) files are kept
#
# For DJGPP, select:
#
# INCDIR= /dev/env/DJDIR/include
#
# If in doubt, set:
#
# INCDIR= /usr/include
#
#INCDIR= /usr/local/include
#INCDIR= /dev/env/DJDIR/include
INCDIR= /usr/include
# where to install calc realted things
#
# ${BINDIR} where to install calc binary files
# ${LIBDIR} where calc link library (*.a) files are installed
# ${CALC_SHAREDIR} where to install calc help, .cal, startup, config files
#
# NOTE: The install rule prepends installation paths with $T, which
# by default is empty. If $T is non-empty, then installation
# locations will be relative to the $T directory.
#
# For DJGPP, select:
#
# BINDIR= /dev/env/DJDIR/bin
# LIBDIR= /dev/env/DJDIR/lib
# CALC_SHAREDIR= /dev/env/DJDIR/share/calc
#
# If in doubt, set:
#
# BINDIR= /usr/bin
# LIBDIR= /usr/lib
# CALC_SHAREDIR= /usr/share/calc
#
#BINDIR= /usr/local/bin
#BINDIR= /dev/env/DJDIR/bin
BINDIR= /usr/bin
#LIBDIR= /usr/local/lib
#LIBDIR= /dev/env/DJDIR/lib
LIBDIR= /usr/lib
#CALC_SHAREDIR= /usr/local/lib/calc
#CALC_SHAREDIR= /dev/env/DJDIR/share/calc
CALC_SHAREDIR= /usr/share/calc
# By default, these values are based CALC_SHAREDIR, INCDIR, BINDIR
# ---------------------------------------------------------------
# ${HELPDIR} where the help directory is installed
# ${CALC_INCDIR} where the calc include files are installed
# ${CUSTOMCALDIR} where custom *.cal files are installed
# ${CUSTOMHELPDIR} where custom help files are installed
# ${CUSTOMINCPDIR} where custom .h files are installed
# ${SCRIPTDIR} where calc shell scripts are installed
#
# NOTE: The install rule prepends installation paths with $T, which
# by default is empty. If $T is non-empty, then installation
# locations will be relative to the $T directory.
#
# If in doubt, set:
#
# HELPDIR= ${CALC_SHAREDIR}/help
# CALC_INCDIR= ${INCDIR}/calc
# CUSTOMCALDIR= ${CALC_SHAREDIR}/custom
# CUSTOMHELPDIR= ${CALC_SHAREDIR}/custhelp
# CUSTOMINCDIR= ${CALC_INCDIR}/custom
# SCRIPTDIR= ${BINDIR}/cscript
#
HELPDIR= ${CALC_SHAREDIR}/help
CALC_INCDIR= ${INCDIR}/calc
CUSTOMCALDIR= ${CALC_SHAREDIR}/custom
CUSTOMHELPDIR= ${CALC_SHAREDIR}/custhelp
CUSTOMINCDIR= ${CALC_INCDIR}/custom
SCRIPTDIR= ${BINDIR}/cscript
# T - top level directory under which calc will be installed
#
# The calc install is performed under $T, the calc build is
# performed under /. The purpose for $T is to allow someone to
# install calc somewhere other than into the system area. For example
# when forming the calc rpm, the Makefile is called with T=$RPM_BUILD_ROOT.
# performed under /. The purpose for $T is to allow someone
# to install calc somewhere other than into the system area.
#
# For example, if:
#
# BINDIR= /usr/bin
# LIBDIR= /usr/lib
# CALC_SHAREDIR= /usr/share/calc
#
# and if:
#
# T= /var/tmp/testing
#
# Then the installation locations will be:
#
# calc binary files: /var/tmp/testing/usr/bin
# calc link library: /var/tmp/testing/usr/lib
# calc help, .cal ...: /var/tmp/testing/usr/share/calc
# ... etc ... /var/tmp/testing/...
#
# If $T is empty, calc is installed under /, which is the same
# top of tree for which it was built. If $T is non-empty, then
@@ -145,7 +233,7 @@ calcliblist:
echo_inst_files:
${Q}for i in ${CALC_FILES} /dev/null; do \
if [ X"$$i" != X"/dev/null" ]; then \
echo __file__ ${CSHAREDIR}/$$i; \
echo __file__ ${CALC_SHAREDIR}/$$i; \
fi; \
done
@@ -161,27 +249,15 @@ clobber:
rm -f .all
install: all
-${Q}if [ ! -d $T${SHAREDIR} ]; then \
echo mkdir $T${SHAREDIR}; \
mkdir $T${SHAREDIR}; \
if [ ! -d "$T${SHAREDIR}" ]; then \
echo mkdir -p "$T${SHAREDIR}"; \
mkdir -p "$T${SHAREDIR}"; \
-${Q}if [ ! -d $T${CALC_SHAREDIR} ]; then \
echo mkdir $T${CALC_SHAREDIR}; \
mkdir $T${CALC_SHAREDIR}; \
if [ ! -d "$T${CALC_SHAREDIR}" ]; then \
echo mkdir -p "$T${CALC_SHAREDIR}"; \
mkdir -p "$T${CALC_SHAREDIR}"; \
fi; \
echo ${CHMOD} 0755 $T${SHAREDIR}; \
${CHMOD} 0755 $T${SHAREDIR}; \
else \
true; \
fi
-${Q}if [ ! -d $T${CSHAREDIR} ]; then \
echo mkdir $T${CSHAREDIR}; \
mkdir $T${CSHAREDIR}; \
if [ ! -d "$T${CSHAREDIR}" ]; then \
echo mkdir -p "$T${CSHAREDIR}"; \
mkdir -p "$T${CSHAREDIR}"; \
fi; \
echo ${CHMOD} 0755 $T${CSHAREDIR}; \
${CHMOD} 0755 $T${CSHAREDIR}; \
echo ${CHMOD} 0755 $T${CALC_SHAREDIR}; \
${CHMOD} 0755 $T${CALC_SHAREDIR}; \
else \
true; \
fi
@@ -189,13 +265,13 @@ install: all
if [ "$$i" = "/dev/null" ]; then \
continue; \
fi; \
if ${CMP} -s $$i $T${CSHAREDIR}/$$i; then \
if ${CMP} -s $$i $T${CALC_SHAREDIR}/$$i; then \
true; \
else \
rm -f $T${CSHAREDIR}/$$i.new; \
cp -f $$i $T${CSHAREDIR}/$$i.new; \
${CHMOD} 0444 $T${CSHAREDIR}/$$i.new; \
mv -f $T${CSHAREDIR}/$$i.new $T${CSHAREDIR}/$$i; \
echo "installed $T${CSHAREDIR}/$$i"; \
rm -f $T${CALC_SHAREDIR}/$$i.new; \
cp -f $$i $T${CALC_SHAREDIR}/$$i.new; \
${CHMOD} 0444 $T${CALC_SHAREDIR}/$$i.new; \
mv -f $T${CALC_SHAREDIR}/$$i.new $T${CALC_SHAREDIR}/$$i; \
echo "installed $T${CALC_SHAREDIR}/$$i"; \
fi; \
done

View File

@@ -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: lucas.cal,v 29.5 2001/06/08 20:07:29 chongo Exp $
* @(#) $Revision: 29.6 $
* @(#) $Id: lucas.cal,v 29.6 2002/07/10 09:43:46 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/lucas.cal,v $
*
* Under source code control: 1990/05/03 16:49:51
@@ -90,7 +90,7 @@
*
* test numbers of the form h*2^n-1
* fix a value of n and vary the value h
* n mod 128 == 0
* n mod 2^x == 0 for some value of x, say > 7 or more
* h*2^n-1 is not divisible by any small prime < 2^40
* 0 < h < 2^39
* h*2^n+1 is not divisible by any small prime < 2^40

View File

@@ -1,7 +1,7 @@
/*
* regress - calc regression and correctness test suite
*
* Copyright (C) 1999 David I. Bell
* Copyright (C) 1999-2002 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.10 $
* @(#) $Id: regress.cal,v 29.10 2001/04/14 22:53:57 chongo Exp $
* @(#) $Revision: 29.14 $
* @(#) $Id: regress.cal,v 29.14 2002/12/29 09:16:07 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/regress.cal,v $
*
* Under source code control: 1990/02/15 01:50:36
@@ -492,7 +492,11 @@ define test_config()
vrfy(strlen(config("version")) > 0,
'555: strlen(config("version")) > 0');
print '556: Ending test_config';
/* mode2 is off by default */
vrfy(config("mode2") == "off",
'556: config("mode2") == "off"');
print '557: Ending test_config';
}
print '010: parsed test_config()';
@@ -1793,7 +1797,23 @@ define test_mode()
vrfy(str(3e9) == "3000000000", \
'1650: str(3e9) == \"3000000000\"');
print '1651: Ending mode/base test';
/* test base2() functionality */
vrfy(base2() == 0, '1651: base2() == 0');
vrfy(base2(0) == 0, '1652: base2(0) == 0');
vrfy(base2() == 0, '1653: base2() == 0');
vrfy(base2(16) == 0, '1654: base2(16) == 0');
vrfy(base2() == 16, '1655: base2() == 16');
vrfy(str(3e9) == "3000000000 /* 0xb2d05e00 */",
'1656: str(3e9) == "3000000000 /* 0xb2d05e00 */"');
vrfy(base2(1/3) == 16, '1657: base2(16) == 16');
vrfy(str(23209) == "23209 /* 23209 */",
'1658: str(23209) == "23209 /* 23209 */"');
vrfy(str(3/2) == "1.5 /* 3/2 */",
'1659: str(3/2) == "1.5 /* 3/2 */"');
vrfy(base() == 10, '1660: base() == 10');
vrfy(base2(0) == 1/3, '1661: base2(0) == 1/3');
print '1662: Ending mode/base test';
}
print '026: parsed test_mode()';
@@ -4547,7 +4567,14 @@ define test_random()
vrfy(seed() < 2^64, '5465: seed() < 2^64');
vrfy(israndom(srandom(seed())), '5466: israndom(srandom(seed()))');
print '5467: Ending test_random';
/* verify random(10,11) double bug fix */
vrfy(random(10,11) == 10, '5467: random(10,11) == 10');
vrfy(random(10,11) == 10, '5468: random(10,11) == 10');
vrfy(random(10,11) == 10, '5469: random(10,11) == 10');
vrfy(random(0,1) == 0, '5470: random(0,1) == 0');
vrfy(random(0,1) == 0, '5471: random(0,1) == 0');
print '5472: Ending test_random';
}
print '137: parsed test_random()';

View File

@@ -15,8 +15,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.8 $
.\" @(#) $Id: calc.man,v 29.8 2002/03/12 09:02:58 chongo Exp $
.\" @(#) $Revision: 29.9 $
.\" @(#) $Id: calc.man,v 29.9 2002/03/14 00:28:28 chongo Exp $
.\" @(#) $Source: /usr/local/src/cmd/calc/RCS/calc.man,v $
.\"
.\" Under source code control: 1991/07/23 05:48:26
@@ -514,8 +514,8 @@ searches in succession:
./myfile.cal
${LIBDIR}/myfile
${LIBDIR}/myfile.cal
${CUSTOMLIBDIR}/myfile
${CUSTOMLIBDIR}/myfile.cal
${CUSTOMCALDIR}/myfile
${CUSTOMCALDIR}/myfile.cal
.fi
.in -5n
.sp 1
@@ -837,7 +837,7 @@ ${LIBDIR}/bindings
non-GNU-readline command line editor bindings
.sp 1
.TP 5
${INCDIRCALC}/*.h
${CALC_INCDIR}/*.h
include files for C interface use
.sp 1
.TP 5
@@ -849,7 +849,7 @@ ${LIBDIR}/libcustcalc.a
custom binary link library
.sp 1
.TP 5
${CUSTOMLIBDIR}/*.cal
${CUSTOMCALDIR}/*.cal
custom resource files
.sp 1
.TP 5

View File

@@ -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.6 $
* @(#) $Id: codegen.c,v 29.6 2001/05/08 06:29:24 chongo Exp $
* @(#) $Revision: 29.7 $
* @(#) $Id: codegen.c,v 29.7 2002/07/10 11:51:51 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/codegen.c,v $
*
* Under source code control: 1990/02/15 01:48:13
@@ -45,7 +45,7 @@
#include "func.h"
#include "conf.h"
#if defined(_WIN32)
#if defined(_WIN32) && !defined(__CYGWIN__)
# include <direct.h>
#endif

View File

@@ -1,7 +1,7 @@
/*
* config - configuration routines
*
* Copyright (C) 1999 David I. Bell and Landon Curt Noll
* Copyright (C) 1999-2002 David I. Bell and Landon Curt Noll
*
* Primary author: David I. Bell
*
@@ -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.7 $
* @(#) $Id: config.c,v 29.7 2001/04/25 07:15:22 chongo Exp $
* @(#) $Revision: 29.8 $
* @(#) $Id: config.c,v 29.8 2002/12/29 09:20:25 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/config.c,v $
*
* Under source code control: 1991/07/20 00:21:56
@@ -51,6 +51,7 @@
NAMETYPE configs[] = {
{"all", CONFIG_ALL},
{"mode", CONFIG_MODE},
{"mode2", CONFIG_MODE2},
{"display", CONFIG_DISPLAY},
{"epsilon", CONFIG_EPSILON},
/*epsilonprec -- tied to epsilon not a configuration type*/
@@ -101,6 +102,7 @@ NAMETYPE configs[] = {
*/
CONFIG oldstd = { /* backward compatible standard configuration */
MODE_INITIAL, /* current output mode */
MODE2_INITIAL, /* current secondary output mode */
20, /* current output digits for float or exp */
NULL, /* loaded in at startup - default error for real functions */
EPSILONPREC_DEFAULT, /* binary precision of epsilon */
@@ -146,6 +148,7 @@ CONFIG oldstd = { /* backward compatible standard configuration */
};
CONFIG newstd = { /* new non-backward compatible configuration */
MODE_INITIAL, /* current output mode */
MODE2_INITIAL, /* current output mode */
10, /* current output digits for float or exp */
NULL, /* loaded in at startup - default error for real functions */
NEW_EPSILONPREC_DEFAULT, /* binary precision of epsilon */
@@ -212,6 +215,7 @@ static NAMETYPE modes[] = {
{"oct", MODE_OCTAL},
{"binary", MODE_BINARY},
{"bin", MODE_BINARY},
{"off", MODE2_OFF},
{NULL, 0}
};
@@ -467,6 +471,19 @@ setconfig(int type, VALUE *vp)
math_setmode((int) temp);
break;
case CONFIG_MODE2:
if (vp->v_type != V_STR) {
math_error("Non-string for mode");
/*NOTREACHED*/
}
temp = lookup_long(modes, vp->v_str->s_str);
if (temp < 0) {
math_error("Unknown mode \"%s\"", vp->v_str);
/*NOTREACHED*/
}
math_setmode2((int) temp);
break;
case CONFIG_EPSILON:
if (vp->v_type != V_NUM) {
math_error("Non-numeric for epsilon");
@@ -1018,6 +1035,16 @@ config_value(CONFIG *cfg, int type, VALUE *vp)
vp->v_str = makenewstring(p);
return;
case CONFIG_MODE2:
vp->v_type = V_STR;
p = lookup_name(modes, cfg->outmode2);
if (p == NULL) {
math_error("invalid secondary output mode: %d", cfg->outmode2);
/*NOTREACHED*/
}
vp->v_str = makenewstring(p);
return;
case CONFIG_EPSILON:
vp->v_num = qlink(cfg->epsilon);
return;
@@ -1267,6 +1294,7 @@ config_cmp(CONFIG *cfg1, CONFIG *cfg2)
return cfg1->traceflags != cfg2->traceflags ||
cfg1->outdigits != cfg2->outdigits ||
cfg1->outmode != cfg2->outmode ||
cfg1->outmode2 != cfg2->outmode2 ||
qcmp(cfg1->epsilon, cfg2->epsilon) ||
cfg1->epsilonprec != cfg2->epsilonprec ||
cfg1->maxprint != cfg2->maxprint ||

View File

@@ -1,7 +1,7 @@
/*
* config - configuration routines
*
* Copyright (C) 1999 Landon Curt Noll and David I. Bell
* Copyright (C) 1999-2002 Landon Curt Noll and David I. Bell
*
* Primary author: Landon Curt Noll
*
@@ -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.11 $
* @(#) $Id: config.h,v 29.11 2001/06/08 21:00:58 chongo Exp $
* @(#) $Revision: 29.12 $
* @(#) $Id: config.h,v 29.12 2002/12/29 09:20:25 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/config.h,v $
*
* Under source code control: 1995/11/01 22:20:17
@@ -90,6 +90,7 @@
#define CONFIG_BASENAME 36
#define CONFIG_VERSION 37
#define CONFIG_WINDOWS 38
#define CONFIG_MODE2 39
/*
@@ -118,6 +119,7 @@
*/
struct config {
int outmode; /* current output mode */
int outmode2; /* current secondary output mode */
LEN outdigits; /* current output digits for float or exp */
NUMBER *epsilon; /* default error for real functions */
long epsilonprec; /* epsilon binary precision (tied to epsilon) */

View File

@@ -17,9 +17,9 @@
# 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.21 $
# @(#) $Id: Makefile,v 29.21 2002/03/12 08:36:11 chongo Exp $
# @(#) $Source: /usr/local/src/cmd/calc/cal/../cscript/RCS/Makefile,v $
# @(#) $Revision: 29.22 $
# @(#) $Id: Makefile,v 29.22 2002/03/14 00:28:28 chongo Exp $
# @(#) $Source: /usr/local/src/cmd/calc/cscript/RCS/Makefile,v $
#
# Under source code control: 1999/11/29 11:10:26
# File existed as early as: 1999
@@ -36,21 +36,111 @@
SHELL= /bin/sh
MAKE_FILE = Makefile
####
# Normally, the upper level makefile will set these values. We provide
# a default here just in case you want to build from this directory.
####
# Where the system include (.h) files are kept
#
# For DJGPP, select:
#
# INCDIR= /dev/env/DJDIR/include
#
# If in doubt, set:
#
# INCDIR= /usr/include
#
#INCDIR= /usr/local/include
#INCDIR= /dev/env/DJDIR/include
INCDIR= /usr/include
# where to install calc realted things
#
# ${BINDIR} where to install calc binary files
# ${LIBDIR} where calc link library (*.a) files are installed
# ${CALC_SHAREDIR} where to install calc help, .cal, startup, config files
#
# NOTE: The install rule prepends installation paths with $T, which
# by default is empty. If $T is non-empty, then installation
# locations will be relative to the $T directory.
#
# For DJGPP, select:
#
# BINDIR= /dev/env/DJDIR/bin
# LIBDIR= /dev/env/DJDIR/lib
# CALC_SHAREDIR= /dev/env/DJDIR/share/calc
#
# If in doubt, set:
#
# BINDIR= /usr/bin
# LIBDIR= /usr/lib
# CALC_SHAREDIR= /usr/share/calc
#
#BINDIR= /usr/local/bin
#BINDIR= /dev/env/DJDIR/bin
BINDIR= /usr/bin
#BINDIR= /usr/contrib/bin
#LIBDIR= /usr/local/lib
#LIBDIR= /dev/env/DJDIR/lib
LIBDIR= /usr/lib
#CALC_SHAREDIR= /usr/local/lib/calc
#CALC_SHAREDIR= /dev/env/DJDIR/share/calc
CALC_SHAREDIR= /usr/share/calc
# By default, these values are based CALC_SHAREDIR, INCDIR, BINDIR
# ---------------------------------------------------------------
# ${HELPDIR} where the help directory is installed
# ${CALC_INCDIR} where the calc include files are installed
# ${CUSTOMCALDIR} where custom *.cal files are installed
# ${CUSTOMHELPDIR} where custom help files are installed
# ${CUSTOMINCPDIR} where custom .h files are installed
# ${SCRIPTDIR} where calc shell scripts are installed
#
# NOTE: The install rule prepends installation paths with $T, which
# by default is empty. If $T is non-empty, then installation
# locations will be relative to the $T directory.
#
# If in doubt, set:
#
# HELPDIR= ${CALC_SHAREDIR}/help
# CALC_INCDIR= ${INCDIR}/calc
# CUSTOMCALDIR= ${CALC_SHAREDIR}/custom
# CUSTOMHELPDIR= ${CALC_SHAREDIR}/custhelp
# CUSTOMINCDIR= ${CALC_INCDIR}/custom
# SCRIPTDIR= ${BINDIR}/cscript
#
HELPDIR= ${CALC_SHAREDIR}/help
CALC_INCDIR= ${INCDIR}/calc
CUSTOMCALDIR= ${CALC_SHAREDIR}/custom
CUSTOMHELPDIR= ${CALC_SHAREDIR}/custhelp
CUSTOMINCDIR= ${CALC_INCDIR}/custom
SCRIPTDIR= ${BINDIR}/cscript
# T - top level directory under which calc will be installed
#
# The calc install is performed under $T, the calc build is
# performed under /. The purpose for $T is to allow someone to
# install calc somewhere other than into the system area. For example
# when forming the calc rpm, the Makefile is called with T=$RPM_BUILD_ROOT.
# performed under /. The purpose for $T is to allow someone
# to install calc somewhere other than into the system area.
#
# For example, if:
#
# BINDIR= /usr/bin
# LIBDIR= /usr/lib
# CALC_SHAREDIR= /usr/share/calc
#
# and if:
#
# T= /var/tmp/testing
#
# Then the installation locations will be:
#
# calc binary files: /var/tmp/testing/usr/bin
# calc link library: /var/tmp/testing/usr/lib
# calc help, .cal ...: /var/tmp/testing/usr/share/calc
# ... etc ... /var/tmp/testing/...
#
# If $T is empty, calc is installed under /, which is the same
# top of tree for which it was built. If $T is non-empty, then

View File

@@ -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.18 $
# @(#) $Id: Makefile,v 29.18 2002/03/12 08:30:43 chongo Exp $
# @(#) $Revision: 29.19 $
# @(#) $Id: Makefile,v 29.19 2002/03/14 00:28:28 chongo Exp $
# @(#) $Source: /usr/local/src/cmd/calc/custom/RCS/Makefile,v $
#
# Under source code control: 1997/03/09 02:28:54
@@ -88,40 +88,111 @@ CUSTOM_OBJ= c_argv.o c_devnull.o c_help.o c_sysinfo.o c_pzasusb8.o
#Q=
Q=@
####
# Normally, the upper level makefile will set these values. We provide
# a default here just in case you want to build from this directory.
####
# Where the system include (.h) files are kept
#
# where to install things
# For DJGPP, select:
#
# ${SHAREDIR} where most common shared files are kept
# ${INCDIR} where most .h files are kept
# INCDIR= /dev/env/DJDIR/include
#
# ${CSHAREDIR} where most common shared calc files are kept
# ${HELPDIR} where the help directory is installed.
# ${INCDIRCALC} where the calc include files are installed
# ${CUSTOMLIBDIR} where custom *.cal files & libcustcalc.a are installed.
# ${CUSTOMHELPDIR} where custom help files are installed.
# ${CUSTOMINCPDIR} where custom .h files are installed.
# If in doubt, set:
#
#SHAREDIR= /usr/local/lib
SHAREDIR= /usr/share
# INCDIR= /usr/include
#
#INCDIR= /usr/local/include
#INCDIR= /dev/env/DJDIR/include
INCDIR= /usr/include
# where to install calc realted things
#
CSHAREDIR= ${SHAREDIR}/calc
HELPDIR= ${CSHAREDIR}/help
INCDIRCALC= ${INCDIR}/calc
CUSTOMLIBDIR= ${CSHAREDIR}/custom
CUSTOMHELPDIR= ${CSHAREDIR}/custhelp
CUSTOMINCDIR= ${INCDIRCALC}/custom
# ${BINDIR} where to install calc binary files
# ${LIBDIR} where calc link library (*.a) files are installed
# ${CALC_SHAREDIR} where to install calc help, .cal, startup, config files
#
# NOTE: The install rule prepends installation paths with $T, which
# by default is empty. If $T is non-empty, then installation
# locations will be relative to the $T directory.
#
# For DJGPP, select:
#
# BINDIR= /dev/env/DJDIR/bin
# LIBDIR= /dev/env/DJDIR/lib
# CALC_SHAREDIR= /dev/env/DJDIR/share/calc
#
# If in doubt, set:
#
# BINDIR= /usr/bin
# LIBDIR= /usr/lib
# CALC_SHAREDIR= /usr/share/calc
#
#BINDIR= /usr/local/bin
#BINDIR= /dev/env/DJDIR/bin
BINDIR= /usr/bin
#LIBDIR= /usr/local/lib
#LIBDIR= /dev/env/DJDIR/lib
LIBDIR= /usr/lib
#CALC_SHAREDIR= /usr/local/lib/calc
#CALC_SHAREDIR= /dev/env/DJDIR/share/calc
CALC_SHAREDIR= /usr/share/calc
# By default, these values are based CALC_SHAREDIR, INCDIR, BINDIR
# ---------------------------------------------------------------
# ${HELPDIR} where the help directory is installed
# ${CALC_INCDIR} where the calc include files are installed
# ${CUSTOMCALDIR} where custom *.cal files are installed
# ${CUSTOMHELPDIR} where custom help files are installed
# ${CUSTOMINCPDIR} where custom .h files are installed
# ${SCRIPTDIR} where calc shell scripts are installed
#
# NOTE: The install rule prepends installation paths with $T, which
# by default is empty. If $T is non-empty, then installation
# locations will be relative to the $T directory.
#
# If in doubt, set:
#
# HELPDIR= ${CALC_SHAREDIR}/help
# CALC_INCDIR= ${INCDIR}/calc
# CUSTOMCALDIR= ${CALC_SHAREDIR}/custom
# CUSTOMHELPDIR= ${CALC_SHAREDIR}/custhelp
# CUSTOMINCDIR= ${CALC_INCDIR}/custom
# SCRIPTDIR= ${BINDIR}/cscript
#
HELPDIR= ${CALC_SHAREDIR}/help
CALC_INCDIR= ${INCDIR}/calc
CUSTOMCALDIR= ${CALC_SHAREDIR}/custom
CUSTOMHELPDIR= ${CALC_SHAREDIR}/custhelp
CUSTOMINCDIR= ${CALC_INCDIR}/custom
SCRIPTDIR= ${BINDIR}/cscript
# T - top level directory under which calc will be installed
#
# The calc install is performed under $T, the calc build is
# performed under /. The purpose for $T is to allow someone to
# install calc somewhere other than into the system area. For example
# when forming the calc rpm, the Makefile is called with T=$RPM_BUILD_ROOT.
# performed under /. The purpose for $T is to allow someone
# to install calc somewhere other than into the system area.
#
# For example, if:
#
# BINDIR= /usr/bin
# LIBDIR= /usr/lib
# CALC_SHAREDIR= /usr/share/calc
#
# and if:
#
# T= /var/tmp/testing
#
# Then the installation locations will be:
#
# calc binary files: /var/tmp/testing/usr/bin
# calc link library: /var/tmp/testing/usr/lib
# calc help, .cal ...: /var/tmp/testing/usr/share/calc
# ... etc ... /var/tmp/testing/...
#
# If $T is empty, calc is installed under /, which is the same
# top of tree for which it was built. If $T is non-empty, then
@@ -279,7 +350,7 @@ REQUIRED_SRC= custtbl.c
#
REQUIRED_OBJ= custtbl.o
# These .h files are installed under ${CUSTOMLIBDIR} by the install rule.
# These .h files are installed under ${CUSTOMCALDIR} by the install rule.
#
INSTALL_H_SRC= ${CUSTOM_H_SRC}
@@ -506,12 +577,12 @@ echo_inst_files:
done
${Q}for i in ${CUSTOM_CALC_FILES} /dev/null; do \
if [ X"$$i" != X"/dev/null" ]; then \
echo __file__ ${CUSTOMLIBDIR}/$$i; \
echo __file__ ${CUSTOMCALDIR}/$$i; \
fi; \
done
${Q}for i in ${CALC_LIBCUSTOM} /dev/null; do \
if [ X"$$i" != X"/dev/null" ]; then \
echo __file__ ${CUSTOMLIBDIR}/$$i; \
echo __file__ ${CUSTOMCALDIR}/$$i; \
fi; \
done
@@ -529,18 +600,6 @@ clobber:
rm -f .all Makefile.tmp Makefile.bak
install: all
-${Q}if [ ! -d $T${SHAREDIR} ]; then \
echo mkdir $T${SHAREDIR}; \
mkdir $T${SHAREDIR}; \
if [ ! -d "$T${SHAREDIR}" ]; then \
echo mkdir -p "$T${SHAREDIR}"; \
mkdir -p "$T${SHAREDIR}"; \
fi; \
echo ${CHMOD} 0755 $T${SHAREDIR}; \
${CHMOD} 0755 $T${SHAREDIR}; \
else \
true; \
fi
-${Q}if [ ! -d $T${INCDIR} ]; then \
echo mkdir $T${INCDIR}; \
mkdir $T${INCDIR}; \
@@ -553,27 +612,27 @@ install: all
else \
true; \
fi
-${Q}if [ ! -d $T${CSHAREDIR} ]; then \
echo mkdir $T${CSHAREDIR}; \
mkdir $T${CSHAREDIR}; \
if [ ! -d "$T${CSHAREDIR}" ]; then \
echo mkdir -p "$T${CSHAREDIR}"; \
mkdir -p "$T${CSHAREDIR}"; \
-${Q}if [ ! -d $T${CALC_SHAREDIR} ]; then \
echo mkdir $T${CALC_SHAREDIR}; \
mkdir $T${CALC_SHAREDIR}; \
if [ ! -d "$T${CALC_SHAREDIR}" ]; then \
echo mkdir -p "$T${CALC_SHAREDIR}"; \
mkdir -p "$T${CALC_SHAREDIR}"; \
fi; \
echo ${CHMOD} 0755 $T${CSHAREDIR}; \
${CHMOD} 0755 $T${CSHAREDIR}; \
echo ${CHMOD} 0755 $T${CALC_SHAREDIR}; \
${CHMOD} 0755 $T${CALC_SHAREDIR}; \
else \
true; \
fi
-${Q}if [ ! -d $T${INCDIRCALC} ]; then \
echo mkdir $T${INCDIRCALC}; \
mkdir $T${INCDIRCALC}; \
if [ ! -d "$T${INCDIRCALC}" ]; then \
echo mkdir -p "$T${INCDIRCALC}"; \
mkdir -p "$T${INCDIRCALC}"; \
-${Q}if [ ! -d $T${CALC_INCDIR} ]; then \
echo mkdir $T${CALC_INCDIR}; \
mkdir $T${CALC_INCDIR}; \
if [ ! -d "$T${CALC_INCDIR}" ]; then \
echo mkdir -p "$T${CALC_INCDIR}"; \
mkdir -p "$T${CALC_INCDIR}"; \
fi; \
echo ${CHMOD} 0755 $T${INCDIRCALC}; \
${CHMOD} 0755 $T${INCDIRCALC}; \
echo ${CHMOD} 0755 $T${CALC_INCDIR}; \
${CHMOD} 0755 $T${CALC_INCDIR}; \
else \
true; \
fi
@@ -589,15 +648,15 @@ install: all
else \
true; \
fi
-${Q}if [ ! -d $T${CUSTOMLIBDIR} ]; then \
echo mkdir $T${CUSTOMLIBDIR}; \
mkdir $T${CUSTOMLIBDIR}; \
if [ ! -d "$T${CUSTOMLIBDIR}" ]; then \
echo mkdir -p "$T${CUSTOMLIBDIR}"; \
mkdir -p "$T${CUSTOMLIBDIR}"; \
-${Q}if [ ! -d $T${CUSTOMCALDIR} ]; then \
echo mkdir $T${CUSTOMCALDIR}; \
mkdir $T${CUSTOMCALDIR}; \
if [ ! -d "$T${CUSTOMCALDIR}" ]; then \
echo mkdir -p "$T${CUSTOMCALDIR}"; \
mkdir -p "$T${CUSTOMCALDIR}"; \
fi; \
echo ${CHMOD} 0755 $T${CUSTOMLIBDIR}; \
${CHMOD} 0755 $T${CUSTOMLIBDIR}; \
echo ${CHMOD} 0755 $T${CUSTOMCALDIR}; \
${CHMOD} 0755 $T${CUSTOMCALDIR}; \
else \
true; \
fi
@@ -644,14 +703,14 @@ install: all
if [ "$$i" = "/dev/null" ]; then \
continue; \
fi; \
if ${CMP} -s $$i $T${CUSTOMLIBDIR}/$$i; then \
if ${CMP} -s $$i $T${CUSTOMCALDIR}/$$i; then \
true; \
else \
rm -f $T${CUSTOMLIBDIR}/$$i.new; \
cp -f $$i $T${CUSTOMLIBDIR}/$$i.new; \
${CHMOD} 0444 $T${CUSTOMLIBDIR}/$$i.new; \
mv -f $T${CUSTOMLIBDIR}/$$i.new $T${CUSTOMLIBDIR}/$$i; \
echo "installed $T${CUSTOMLIBDIR}/$$i"; \
rm -f $T${CUSTOMCALDIR}/$$i.new; \
cp -f $$i $T${CUSTOMCALDIR}/$$i.new; \
${CHMOD} 0444 $T${CUSTOMCALDIR}/$$i.new; \
mv -f $T${CUSTOMCALDIR}/$$i.new $T${CUSTOMCALDIR}/$$i; \
echo "installed $T${CUSTOMCALDIR}/$$i"; \
fi; \
done
-${Q}for i in ${CUSTOM_HELP} /dev/null; do \
@@ -669,16 +728,16 @@ install: all
fi; \
done
-${Q}if [ ! -z ${ALLOW_CUSTOM} ]; then \
if ${CMP} -s libcustcalc.a $T${CUSTOMLIBDIR}/libcustcalc.a; then \
if ${CMP} -s libcustcalc.a $T${CUSTOMCALDIR}/libcustcalc.a; then \
true; \
else \
rm -f $T${CUSTOMLIBDIR}/libcustcalc.a.new; \
cp -f libcustcalc.a $T${CUSTOMLIBDIR}/libcustcalc.a.new; \
${CHMOD} 0644 $T${CUSTOMLIBDIR}/libcustcalc.a.new; \
mv -f $T${CUSTOMLIBDIR}/libcustcalc.a.new \
$T${CUSTOMLIBDIR}/libcustcalc.a; \
${RANLIB} $T${CUSTOMLIBDIR}/libcustcalc.a; \
echo "installed $T${CUSTOMLIBDIR}/libcustcalc.a"; \
rm -f $T${CUSTOMCALDIR}/libcustcalc.a.new; \
cp -f libcustcalc.a $T${CUSTOMCALDIR}/libcustcalc.a.new; \
${CHMOD} 0644 $T${CUSTOMCALDIR}/libcustcalc.a.new; \
mv -f $T${CUSTOMCALDIR}/libcustcalc.a.new \
$T${CUSTOMCALDIR}/libcustcalc.a; \
${RANLIB} $T${CUSTOMCALDIR}/libcustcalc.a; \
echo "installed $T${CUSTOMCALDIR}/libcustcalc.a"; \
fi; \
fi

86
func.c
View File

@@ -1,7 +1,7 @@
/*
* func - built-in functions implemented here
*
* Copyright (C) 1999 David I. Bell, Landon Curt Noll and Ernest Bowen
* Copyright (C) 1999-2002 David I. Bell, Landon Curt Noll and Ernest Bowen
*
* Primary author: David I. Bell
*
@@ -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.10 $
* @(#) $Id: func.c,v 29.10 2001/05/29 00:41:22 chongo Exp $
* @(#) $Revision: 29.12 $
* @(#) $Id: func.c,v 29.12 2002/12/29 09:20:25 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/func.c,v $
*
* Under source code control: 1990/02/15 01:48:15
@@ -107,7 +107,7 @@
/*
* forward declarations
*/
static NUMBER *base_value(long mode);
static NUMBER *base_value(long mode, int defval);
static int strscan(char *s, int count, VALUE **vals);
static int filescan(FILEID id, int count, VALUE **vals);
static VALUE f_eval(VALUE *vp);
@@ -6910,9 +6910,9 @@ f_system(VALUE *vp)
printf("%s\n", vp->v_str->s_str);
}
#if defined(_WIN32)
/* if the execute length is 0 then use NULL in system call */
/* if the execute length is 0 then just return 0 */
if (strlen(vp->v_str->s_str) == 0) {
result.v_num = itoq((long)system(NULL));
result.v_num = itoq((long)0);
} else {
result.v_num = itoq((long)system(vp->v_str->s_str));
}
@@ -6978,15 +6978,15 @@ f_base(int count, NUMBER **vals)
/* deal with just a query */
if (count != 1) {
return base_value(conf->outmode);
return base_value(conf->outmode, conf->outmode);
}
/* deal with the specal modes first */
if (qisfrac(vals[0])) {
return base_value(math_setmode(MODE_FRAC));
return base_value(math_setmode(MODE_FRAC), conf->outmode);
}
if (vals[0]->num.len > 64/BASEB) {
return base_value(math_setmode(MODE_EXP));
return base_value(math_setmode(MODE_EXP), conf->outmode);
}
/* set the base, if possible */
@@ -7014,7 +7014,61 @@ f_base(int count, NUMBER **vals)
}
/* return the old base */
return base_value(oldbase);
return base_value(oldbase, conf->outmode);
}
/*
* set the default secondary output base/mode
*/
static NUMBER *
f_base2(int count, NUMBER **vals)
{
long base; /* output base/mode */
long oldbase=0; /* output base/mode */
/* deal with just a query */
if (count != 1) {
return base_value(conf->outmode2, conf->outmode2);
}
/* deal with the specal modes first */
if (qisfrac(vals[0])) {
return base_value(math_setmode2(MODE_FRAC), conf->outmode2);
}
if (vals[0]->num.len > 64/BASEB) {
return base_value(math_setmode2(MODE_EXP), conf->outmode2);
}
/* set the base, if possible */
base = qtoi(vals[0]);
switch (base) {
case 0:
oldbase = math_setmode2(MODE2_OFF);
break;
case -10:
oldbase = math_setmode2(MODE_INT);
break;
case 2:
oldbase = math_setmode2(MODE_BINARY);
break;
case 8:
oldbase = math_setmode2(MODE_OCTAL);
break;
case 10:
oldbase = math_setmode2(MODE_REAL);
break;
case 16:
oldbase = math_setmode2(MODE_HEX);
break;
default:
math_error("Unsupported base");
/*NOTREACHED*/
break;
}
/* return the old base */
return base_value(oldbase, conf->outmode2);
}
@@ -7022,14 +7076,14 @@ f_base(int count, NUMBER **vals)
* return a numerical 'value' of the mode/base
*/
static NUMBER *
base_value(long mode)
base_value(long mode, int defval)
{
NUMBER *result;
/* return the old base */
switch (mode) {
case MODE_DEFAULT:
switch (conf->outmode) {
switch (defval) {
case MODE_DEFAULT:
result = itoq(10);
break;
@@ -7056,6 +7110,9 @@ base_value(long mode)
case MODE_BINARY:
result = itoq(2);
break;
case MODE2_OFF:
result = itoq(0);
break;
default:
result = itoq(0);
break;
@@ -7084,6 +7141,9 @@ base_value(long mode)
case MODE_BINARY:
result = itoq(2);
break;
case MODE2_OFF:
result = itoq(0);
break;
default:
result = itoq(0);
break;
@@ -7825,6 +7885,8 @@ static CONST struct builtin builtins[] = {
"arithmetic mean of values"},
{"base", 0, 1, 0, OP_NOP, f_base, 0,
"set default output base"},
{"base2", 0, 1, 0, OP_NOP, f_base2, 0,
"set default secondary output base"},
{"bernoulli", 1, 1, 0, OP_NOP, 0, f_bern,
"Bernoulli number for index a"},
{"bit", 2, 2, 0, OP_BIT, 0, 0,

7
hash.c
View File

@@ -1,7 +1,7 @@
/*
* hash - one-way hash routines
*
* Copyright (C) 1999 Landon Curt Noll
* Copyright (C) 1999-2002 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.4 $
* @(#) $Id: hash.c,v 29.4 2001/04/14 22:47:21 chongo Exp $
* @(#) $Revision: 29.5 $
* @(#) $Id: hash.c,v 29.5 2002/12/29 09:20:25 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/hash.c,v $
*
* Under source code control: 1995/11/23 05:13:11
@@ -941,6 +941,7 @@ hash_value(int type, void *v, HASH *state)
/* hash the CONFIG state */
state = hash_int(type, value->v_config->outmode, state);
state = hash_int(type, value->v_config->outmode2, state);
state = hash_long(type,(long)value->v_config->outdigits, state);
state = hash_number(type, value->v_config->epsilon, state);
state = hash_long(type,

View File

@@ -2,7 +2,7 @@
#
# help - makefile for calc help files
#
# Copyright (C) 1999 Landon Curt Noll
# Copyright (C) 1999-2002 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
@@ -18,9 +18,9 @@
# 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.19 $
# @(#) $Id: Makefile,v 29.19 2002/03/12 08:39:14 chongo Exp $
# @(#) $Source: /usr/local/src/cmd/calc/cal/../help/RCS/Makefile,v $
# @(#) $Revision: 29.22 $
# @(#) $Id: Makefile,v 29.22 2002/12/29 08:43:37 chongo Exp $
# @(#) $Source: /usr/local/src/cmd/calc/help/RCS/Makefile,v $
#
# Under source code control: 1991/07/23 06:47:57
# File existed as early as: 1991
@@ -36,33 +36,111 @@
SHELL= /bin/sh
MAKE_FILE = Makefile
# ${SHAREDIR} where most common shared files are kept
# ${INCDIR} where most .h files are kept
# ${LIBDIR} where *.a files are installed
####
# Normally, the upper level makefile will set these values. We provide
# a default here just in case you want to build from this directory.
####
# Where the system include (.h) files are kept
#
# ${CSHAREDIR} where most common shared calc files are kept
# ${HELPDIR} where the help directory is installed.
# ${INCDIRCALC} where the calc include files are installed
# For DJGPP, select:
#
# INCDIR= /dev/env/DJDIR/include
#
# If in doubt, set:
#
# INCDIR= /usr/include
#
#SHAREDIR= /usr/local/lib
SHAREDIR= /usr/share
#INCDIR= /usr/local/include
#INCDIR= /dev/env/DJDIR/include
INCDIR= /usr/include
# where to install calc realted things
#
# ${BINDIR} where to install calc binary files
# ${LIBDIR} where calc link library (*.a) files are installed
# ${CALC_SHAREDIR} where to install calc help, .cal, startup, config files
#
# NOTE: The install rule prepends installation paths with $T, which
# by default is empty. If $T is non-empty, then installation
# locations will be relative to the $T directory.
#
# For DJGPP, select:
#
# BINDIR= /dev/env/DJDIR/bin
# LIBDIR= /dev/env/DJDIR/lib
# CALC_SHAREDIR= /dev/env/DJDIR/share/calc
#
# If in doubt, set:
#
# BINDIR= /usr/bin
# LIBDIR= /usr/lib
# CALC_SHAREDIR= /usr/share/calc
#
#BINDIR= /usr/local/bin
#BINDIR= /dev/env/DJDIR/bin
BINDIR= /usr/bin
#LIBDIR= /usr/local/lib
#LIBDIR= /dev/env/DJDIR/lib
LIBDIR= /usr/lib
CSHAREDIR= ${SHAREDIR}/calc
HELPDIR= ${CSHAREDIR}/help
INCDIRCALC= ${INCDIR}/calc
#CALC_SHAREDIR= /usr/local/lib/calc
#CALC_SHAREDIR= /dev/env/DJDIR/share/calc
CALC_SHAREDIR= /usr/share/calc
# By default, these values are based CALC_SHAREDIR, INCDIR, BINDIR
# ---------------------------------------------------------------
# ${HELPDIR} where the help directory is installed
# ${CALC_INCDIR} where the calc include files are installed
# ${CUSTOMCALDIR} where custom *.cal files are installed
# ${CUSTOMHELPDIR} where custom help files are installed
# ${CUSTOMINCPDIR} where custom .h files are installed
# ${SCRIPTDIR} where calc shell scripts are installed
#
# NOTE: The install rule prepends installation paths with $T, which
# by default is empty. If $T is non-empty, then installation
# locations will be relative to the $T directory.
#
# If in doubt, set:
#
# HELPDIR= ${CALC_SHAREDIR}/help
# CALC_INCDIR= ${INCDIR}/calc
# CUSTOMCALDIR= ${CALC_SHAREDIR}/custom
# CUSTOMHELPDIR= ${CALC_SHAREDIR}/custhelp
# CUSTOMINCDIR= ${CALC_INCDIR}/custom
# SCRIPTDIR= ${BINDIR}/cscript
#
HELPDIR= ${CALC_SHAREDIR}/help
CALC_INCDIR= ${INCDIR}/calc
CUSTOMCALDIR= ${CALC_SHAREDIR}/custom
CUSTOMHELPDIR= ${CALC_SHAREDIR}/custhelp
CUSTOMINCDIR= ${CALC_INCDIR}/custom
SCRIPTDIR= ${BINDIR}/cscript
# T - top level directory under which calc will be installed
#
# The calc install is performed under $T, the calc build is
# performed under /. The purpose for $T is to allow someone to
# install calc somewhere other than into the system area. For example
# when forming the calc rpm, the Makefile is called with T=$RPM_BUILD_ROOT.
# performed under /. The purpose for $T is to allow someone
# to install calc somewhere other than into the system area.
#
# For example, if:
#
# BINDIR= /usr/bin
# LIBDIR= /usr/lib
# CALC_SHAREDIR= /usr/share/calc
#
# and if:
#
# T= /var/tmp/testing
#
# Then the installation locations will be:
#
# calc binary files: /var/tmp/testing/usr/bin
# calc link library: /var/tmp/testing/usr/lib
# calc help, .cal ...: /var/tmp/testing/usr/share/calc
# ... etc ... /var/tmp/testing/...
#
# If $T is empty, calc is installed under /, which is the same
# top of tree for which it was built. If $T is non-empty, then
@@ -168,11 +246,11 @@ 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 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 \
appr arg argv arrow asec asech asin asinh assign atan atan2 atanh \
avg base base2 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 \
@@ -267,7 +345,7 @@ changes: ../CHANGES
libcalc: ../LIBRARY
rm -f $@
${SED} -e 's:$${LIBDIR}:${LIBDIR}:g' \
-e 's:$${INCDIRCALC}:${INCDIRCALC}:g' < ../LIBRARY > $@
-e 's:$${CALC_INCDIR}:${CALC_INCDIR}:g' < ../LIBRARY > $@
${CHMOD} 0444 $@
-@if [ -z "${Q}" ]; then \
echo ''; \
@@ -556,27 +634,15 @@ clobber:
rm -f ${SINGULAR_FILES} ${DETAIL_CLONE}
install: all
-${Q}if [ ! -d ${SHAREDIR} ]; then \
echo mkdir $T${SHAREDIR}; \
mkdir $T${SHAREDIR}; \
if [ ! -d "$T${SHAREDIR}" ]; then \
echo mkdir -p "$T${SHAREDIR}"; \
mkdir -p "$T${SHAREDIR}"; \
-${Q}if [ ! -d $T${CALC_SHAREDIR} ]; then \
echo mkdir $T${CALC_SHAREDIR}; \
mkdir $T${CALC_SHAREDIR}; \
if [ ! -d "$T${CALC_SHAREDIR}" ]; then \
echo mkdir -p "$T${CALC_SHAREDIR}"; \
mkdir -p "$T${CALC_SHAREDIR}"; \
fi; \
echo ${CHMOD} 0755 $T${SHAREDIR}; \
${CHMOD} 0755 $T${SHAREDIR}; \
else \
true; \
fi
-${Q}if [ ! -d $T${CSHAREDIR} ]; then \
echo mkdir $T${CSHAREDIR}; \
mkdir $T${CSHAREDIR}; \
if [ ! -d "$T${CSHAREDIR}" ]; then \
echo mkdir -p "$T${CSHAREDIR}"; \
mkdir -p "$T${CSHAREDIR}"; \
fi; \
echo ${CHMOD} 0755 $T${CSHAREDIR}; \
${CHMOD} 0755 $T${CSHAREDIR}; \
echo ${CHMOD} 0755 $T${CALC_SHAREDIR}; \
${CHMOD} 0755 $T${CALC_SHAREDIR}; \
else \
true; \
fi

View File

@@ -23,7 +23,7 @@ DESCRIPTION
0 <= i < sizeof(B). &B[i] then returns the address at which this
octet is located until the block is freed or relocated. Freeing
of an unnamed block B occurs when a new value is assigned to B or
when B ceases to exist; a named block B is freed by blkfree(B().
when B ceases to exist; a named block B is freed by blkfree(B).
A block is relocated when an operation like copying to B requires
a change of sizeof(B).
@@ -70,18 +70,18 @@ DESCRIPTION
> p = &"abc"
> A = "abc"
The address &*A of the value of A will be equal to p.
the address &*A of the value of A will be equal to p.
Except in cases like strcat(A, "") when *A identified with a literal
string as above, definitions of string values using strcat() or substr()
will copy the relevant strings to newly allocated addresses which will
be useable only while the variables retain these defined values.
For example,
For example, after
> B = C = strcat("a", "bc");
&*B and &*C will be different. If p is defined by p = &*B, p should
not be used after a mew value is assigned to B, or B ceases to exist,
not be used after a new value is assigned to B, or B ceases to exist,
etc.
When compilation of a function encounters for the first time a particular
@@ -117,7 +117,7 @@ DESCRIPTION
> A = B = C = f(2);
which, not only performs the addition n f() only once, but stores the
which, not only performs the addition in f() only once, but stores the
number values for A, B and C at the same address.
Whether a value V is a pointer and if so, its type, is indicated by the
@@ -176,8 +176,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: address,v 29.2 2000/06/07 14:02:33 chongo Exp $
## @(#) $Revision: 29.3 $
## @(#) $Id: address,v 29.3 2002/07/10 11:47:04 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/address,v $
##
## Under source code control: 1997/09/06 20:03:34

View File

@@ -13,7 +13,7 @@ TYPES
DESCRIPTION
p->X returns the same as (*p).X. Thus the current value of *p is
to be an object of a type for which X identifies one element.
p->X then returns the lvalue corresponding to that element of of the
p->X then returns the lvalue corresponding to that element of the
value of *p.
The expression *p.X will cause a runtime error since this is
@@ -66,8 +66,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: arrow,v 29.2 2000/06/07 14:02:33 chongo Exp $
## @(#) $Revision: 29.3 $
## @(#) $Id: arrow,v 29.3 2002/07/10 11:47:04 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/arrow,v $
##
## Under source code control: 1997/09/06 20:03:34

View File

@@ -14,7 +14,7 @@ DESCRIPTION
Returns the asin of x to a multiple of eps with error less in
absolute value than .75 * eps.
v = asin(x) is the number in [-p1/2, pi/2] for which sin(v) = x.
v = asin(x) is the number in [-pi/2, pi/2] for which sin(v) = x.
EXAMPLE
> print asin(.5, 1e-5), asin(.5, 1e-10), asin(.5, 1e-15), asin(.5, 1e-20)
@@ -45,8 +45,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: asin,v 29.2 2000/06/07 14:02:33 chongo Exp $
## @(#) $Revision: 29.3 $
## @(#) $Id: asin,v 29.3 2002/07/10 11:47:04 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/asin,v $
##
## Under source code control: 1994/03/19 01:40:24

View File

@@ -32,10 +32,9 @@ DESCRIPTION
may have different numbers (between 1 and 4 inclusive) of indices,
and these indices need not be integers in specified ranges.
Assignments of a null value
to an element of an association does not delete the element, but
a later reference to that element will return the null value as if
the element is undefined.
Assignment of a null value to an element of an association does not
delete the element, but a later reference to that element will return
the null value as if the element is undefined.
The elements of an association are stored in a hash table for
quick access. The index values are hashed to select the correct
@@ -99,8 +98,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: assoc,v 29.2 2000/06/07 14:02:33 chongo Exp $
## @(#) $Revision: 29.3 $
## @(#) $Id: assoc,v 29.3 2002/07/10 11:47:04 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/assoc,v $
##
## Under source code control: 1994/09/25 20:22:31

View File

@@ -14,7 +14,7 @@ DESCRIPTION
Returns the atan of x to a multiple of eps with error less in
absolute value than .75 * eps.
v = atan(x) is the number in (-p1/2, pi/2) for which tan(v) = x.
v = atan(x) is the number in (-pi/2, pi/2) for which tan(v) = x.
EXAMPLE
> print atan(2, 1e-5), atan(2, 1e-10), atan(2, 1e-15), atan(2, 1e-20)
@@ -45,8 +45,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: atan,v 29.2 2000/06/07 14:02:33 chongo Exp $
## @(#) $Revision: 29.3 $
## @(#) $Id: atan,v 29.3 2002/07/10 11:47:04 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/atan,v $
##
## Under source code control: 1994/03/19 01:40:25

View File

@@ -57,7 +57,7 @@ DESCRIPTION
base(1e20) base(2^64) base(2^8191-1)
However the base() function will only return one of the base values
lised in the table above.
listed in the table above.
EXAMPLE
> base()
@@ -79,7 +79,7 @@ LINK LIBRARY
MODE_REAL, MODE_EXP, MODE_HEX, MODE_OCTAL, MODE_BINARY
SEE ALSO
config
base2, config, str
## Copyright (C) 1999 Landon Curt Noll
##
@@ -97,8 +97,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: base,v 29.2 2000/06/07 14:02:33 chongo Exp $
## @(#) $Revision: 29.5 $
## @(#) $Id: base,v 29.5 2002/12/29 09:17:54 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/base,v $
##
## Under source code control: 1994/09/30 00:09:39

120
help/base2 Normal file
View File

@@ -0,0 +1,120 @@
NAME
base2 - set 2nd output base
SYNOPSIS
base2([mode])
TYPES
mode real
return real
DESCRIPTION
By default, calc will output values according to the default base
as controlled by the base() builtin function.
The base2() builtin function, if given a non-zero argument, enables
double base output mode. In double base output mode, calc values
are displayed twice, once according to base() and again according
to base2(). In double base output mode, the second time a value is
displayed, it is displayed within comments:
21701 /* 0x54c5 */
The arguments for base2() are identical to base() with the addition
of the 0 value:
base2 equivalent
config("mode2")'s
2 "binary" base 2 fractions
"bin"
8 "octal" base 8 fractions
"oct"
10 "real" base 10 floating point
"float"
"default"
-10 "integer" base 10 integers
"int"
16 "hexadecimal" base 16 fractions
"hex"
1/3 "fraction" base 10 fractions
"frac"
1e20 "scientific" base 10 scientific notation
"sci"
"exp"
0 "off" disable double base output
For convenience, any non-integer non-zero value is assumed to mean
base 10 fractions and any integer >= 2^64 is assumed to mean base 10
scientific notation.
These base2() calls have the same meaning as config("mode2", "fraction"):
base2(1/3) base2(0.1415) base2(16/37)
These base2() calls have the same meaning as config("mode2", "scientific"):
base2(1e20) base2(2^64) base2(2^8191-1)
However the base2() function will only return one of the base values
listed in the table above.
EXAMPLE
> base2()
0
> base2(8)
0 /* 0 */
> print 10
10 /* 012 */
> base2(16),
> 131072
131072 /* 0x20000 */
> 2345
2345 /* 0x929 */
LIMITS
none
LINK LIBRARY
int math_setmode2(int newmode)
NOTE: newmode must be one of MODE_DEFAULT, MODE_FRAC, MODE_INT,
MODE_REAL, MODE_EXP, MODE_HEX, MODE_OCTAL, MODE_BINARY,
MODE2_OFF
SEE ALSO
base, config, str
## Copyright (C) 2002 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: 1.3 $
## @(#) $Id: base2,v 1.3 2002/12/29 09:17:54 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/base2,v $
##
## Under source code control: 2002/12/29 00:21:07
## File existed as early as: 2002
##
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/

View File

@@ -15,7 +15,7 @@ DESCRIPTION
t/(exp(t) - 1) = Sum B_n * t^n/n!
bernouuli(n) is zero both for n < 0 and for n odd and > 2.
bernoulli(n) is zero both for n < 0 and for n odd and > 2.
When bernoulli(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 bernoulli(k) with 0 <= k < n will be executed quickly.
@@ -57,8 +57,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.4 $
## @(#) $Id: bernoulli,v 29.4 2000/12/17 12:27:58 chongo Exp $
## @(#) $Revision: 29.5 $
## @(#) $Id: bernoulli,v 29.5 2002/07/10 11:47:04 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/bernoulli,v $
##
## Under source code control: 2000/07/13 01:33:00

View File

@@ -122,7 +122,7 @@ DESCRIPTION
Named blocks are assigned index numbers 0, 1, 2, ..., in the order
of their creation. The block with index id is returned by blocks(id).
With no argument, blocks() returns the number of current unfreed
named blocks. A named block may be used
named blocks.
The memory allocated to a named block is freed by the blkfree()
function with argument the named block, its name, or its id number.
@@ -234,8 +234,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: blk,v 29.2 2000/06/07 14:02:33 chongo Exp $
## @(#) $Revision: 29.3 $
## @(#) $Id: blk,v 29.3 2002/07/10 11:47:04 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/blk,v $
##
## Under source code control: 1997/04/05 13:07:13

View File

@@ -1,5 +1,5 @@
NAME
blocks - return a named file or number of unfreed named blocks
blocks - return a named block or number of unfreed named blocks
SYNOPSIS
blocks([id])
@@ -58,8 +58,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: blocks,v 29.2 2000/06/07 14:02:33 chongo Exp $
## @(#) $Revision: 29.3 $
## @(#) $Id: blocks,v 29.3 2002/07/10 11:47:04 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/blocks,v $
##
## Under source code control: 1997/04/05 13:07:13

View File

@@ -16,6 +16,7 @@ Configuration parameters
"epsilon" sets error value for transcendentals.
"maxprint" sets maximum number of elements printed.
"mode" sets printout mode.
"mode2" sets 2nd base printout mode.
"mul2" sets size for alternative multiply.
"sq2" sets size for alternative squaring.
"pow2" sets size for alternate powering.
@@ -184,6 +185,7 @@ Detailed config descriptions
=-=
config("mode", "mode_string")
config("mode2", "mode_string")
The "mode" parameter is a string specifying the mode for printing of
numbers by the unformatted print functions, and the default
@@ -219,7 +221,17 @@ Detailed config descriptions
Where multiple strings are given, the first string listed is what
config("mode") will return.
The default "mode" is "real".
The "mode2" controls the double base output. When set to a value
other than "off", calc outputs files in both the "base" mode as
well as the "base2" mode. The "mode2" value may be any of the
"mode" values with the addition of:
"off" disable 2nd base output mode base2(0)
The base() builtin function sets and returns the "mode" value.
The base2() builtin function sets and returns the "mode2" value.
The default "mode" is "real". The default "mode2" is "off".
=-=
@@ -713,8 +725,8 @@ Detailed config descriptions
## 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.6 $
## @(#) $Id: config,v 29.6 2001/04/25 07:17:38 chongo Exp $
## @(#) $Revision: 29.7 $
## @(#) $Id: config,v 29.7 2002/12/29 08:32:04 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/config,v $
##
## Under source code control: 1991/07/21 04:37:17

View File

@@ -18,7 +18,7 @@ DESCRIPTION
For real or complex x, str(x) returns the string representing x
in the current printing mode; configuration parameters affecting
this are "mode", "display", "outround", "tilde", "leadzero",
this are "mode", "mode2", "display", "outround", "tilde", "leadzero",
EXAMPLE
> str("")
@@ -28,6 +28,10 @@ EXAMPLE
> print str(123), str("+"), str(4i), str("is the same as"), str(123+4i)
123 + 4i is the same as 3+4i
> base2(16),
> print str(23209)
23209 /* 0x5aa9 */
LIMITS
none
@@ -41,9 +45,9 @@ LINK LIBRARY
char *math_getdivertedio();
SEE ALSO
XXX - fill in
base, base2, config
## Copyright (C) 1999 Landon Curt Noll
## Copyright (C) 1999-2002 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
@@ -59,8 +63,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: str,v 29.2 2000/06/07 14:02:33 chongo Exp $
## @(#) $Revision: 29.3 $
## @(#) $Id: str,v 29.3 2002/12/29 09:19:56 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/str,v $
##
## Under source code control: 1995/10/05 04:52:27

View File

@@ -59,6 +59,13 @@ Very High priority items:
* Fix any 'Known bugs' as noted in the BUGS file or as
displayed by 'calc help bugs'.
* Internationalize calc by converting calc error messages and
text strings (e.g., calc startup banner, show output, etc.)
into calls to the GNU gettext internationalization facility.
If somebody translated these strings into another language,
setting $LANG would allow calc to produce error messages
and text strings in that language.
=-=
High priority items:
@@ -133,8 +140,8 @@ Medium priority items:
## 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: todo,v 29.2 2000/06/07 14:02:33 chongo Exp $
## @(#) $Revision: 29.4 $
## @(#) $Id: todo,v 29.4 2002/07/10 17:30:28 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/todo,v $
##
## Under source code control: 1999/10/20 07:42:55

View File

@@ -249,8 +249,8 @@ Calc command line
./myfile.cal
${LIBDIR}/myfile
${LIBDIR}/myfile.cal
${CUSTOMLIBDIR}/myfile
${CUSTOMLIBDIR}/myfile.cal
${CUSTOMCALDIR}/myfile
${CUSTOMCALDIR}/myfile.cal
If the file is found, the search stops and the commands in
the file are executed. It is an error if no readable file
@@ -353,8 +353,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: usage,v 29.3 2000/06/07 14:02:33 chongo Exp $
## @(#) $Revision: 29.4 $
## @(#) $Id: usage,v 29.4 2002/07/10 11:47:04 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/usage,v $
##
## Under source code control: 1991/07/21 04:37:25

17
qio.c
View File

@@ -1,7 +1,7 @@
/*
* qio - scanf and printf routines for arbitrary precision rational numbers
*
* Copyright (C) 1999 David I. Bell
* Copyright (C) 1999-2002 David I. Bell
*
* 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.3 $
* @(#) $Id: qio.c,v 29.3 2000/07/17 15:35:49 chongo Exp $
* @(#) $Revision: 29.4 $
* @(#) $Id: qio.c,v 29.4 2002/12/29 09:20:25 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/qio.c,v $
*
* Under source code control: 1993/07/30 19:42:46
@@ -180,9 +180,12 @@ qprintnum(NUMBER *q, int outmode)
{
NUMBER tmpval;
long prec, exp;
int outmode2 = MODE2_OFF;
if (outmode == MODE_DEFAULT)
if (outmode == MODE_DEFAULT) {
outmode = conf->outmode;
outmode2 = conf->outmode2;
}
switch (outmode) {
case MODE_INT:
if (conf->tilde_ok && qisfrac(q))
@@ -248,6 +251,12 @@ qprintnum(NUMBER *q, int outmode)
math_error("Bad mode for print");
/*NOTREACHED*/
}
if (outmode2 != MODE2_OFF) {
PUTSTR(" /* ");
qprintnum(q, outmode2);
PUTSTR(" */");
}
}

View File

@@ -1,7 +1,7 @@
/*
* quickhash - quickly hash a calc value using a partial Fowler/Noll/Vo hash
*
* Copyright (C) 1999 Landon Curt Noll
* Copyright (C) 1999-2002 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.4 $
* @(#) $Id: quickhash.c,v 29.4 2001/04/14 22:47:21 chongo Exp $
* @(#) $Revision: 29.5 $
* @(#) $Id: quickhash.c,v 29.5 2002/12/29 09:20:25 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/quickhash.c,v $
*
* Under source code control: 1995/03/04 11:34:23
@@ -382,6 +382,7 @@ config_hash(CONFIG *cfg, QCKHASH val)
*/
value = cfg->outmode;
value = (((value>>5) | (value<<27)) ^ (USB32)cfg->outmode);
value = (((value>>5) | (value<<27)) ^ (USB32)cfg->outmode2);
value = (((value>>5) | (value<<27)) ^ (USB32)cfg->outdigits);
/* epsilon is handeled out of order */
value = (((value>>5) | (value<<27)) ^ (USB32)cfg->epsilonprec);

View File

@@ -17,9 +17,9 @@
# 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.15 $
# @(#) $Id: Makefile,v 29.15 2002/03/12 08:41:05 chongo Exp $
# @(#) $Source: /usr/local/src/cmd/calc/cal/../sample/RCS/Makefile,v $
# @(#) $Revision: 29.16 $
# @(#) $Id: Makefile,v 29.16 2002/03/14 00:28:28 chongo Exp $
# @(#) $Source: /usr/local/src/cmd/calc/sample/RCS/Makefile,v $
#
# Under source code control: 1997/04/19 22:46:49
# File existed as early as: 1997
@@ -75,41 +75,111 @@ SAMPLE_OBJ= many_random.o test_random.o
#Q=
Q=@
####
# Normally, the upper level makefile will set these values. We provide
# a default here just in case you want to build from this directory.
####
# Where the system include (.h) files are kept
#
# where things go
# For DJGPP, select:
#
# ${BINDIR} where to install binary files
# ${SHAREDIR} where most common shared files are kept
# ${INCDIR} where most .h files are kept
# ${LIBDIR} where *.a files are installed
# INCDIR= /dev/env/DJDIR/include
#
# ${CSHAREDIR} where most common shared calc files are kept
# ${HELPDIR} where the help directory is installed.
# If in doubt, set:
#
# INCDIR= /usr/include
#
#INCDIR= /usr/local/include
#INCDIR= /dev/env/DJDIR/include
INCDIR= /usr/include
# where to install calc realted things
#
# ${BINDIR} where to install calc binary files
# ${LIBDIR} where calc link library (*.a) files are installed
# ${CALC_SHAREDIR} where to install calc help, .cal, startup, config files
#
# NOTE: The install rule prepends installation paths with $T, which
# by default is empty. If $T is non-empty, then installation
# locations will be relative to the $T directory.
#
# For DJGPP, select:
#
# BINDIR= /dev/env/DJDIR/bin
# LIBDIR= /dev/env/DJDIR/lib
# CALC_SHAREDIR= /dev/env/DJDIR/share/calc
#
# If in doubt, set:
#
# BINDIR= /usr/bin
# LIBDIR= /usr/lib
# CALC_SHAREDIR= /usr/share/calc
#
#BINDIR= /usr/local/bin
#BINDIR= /dev/env/DJDIR/bin
BINDIR= /usr/bin
#BINDIR= /usr/contrib/bin
#
#SHAREDIR= /usr/local/lib
SHAREDIR= /usr/share
#
#INCDIR= /usr/local/include
INCDIR= /usr/include
#
#LIBDIR= /usr/local/lib
#LIBDIR= /dev/env/DJDIR/lib
LIBDIR= /usr/lib
CSHAREDIR= ${SHAREDIR}/calc
HELPDIR= ${LIBDIR}/help
#CALC_SHAREDIR= /usr/local/lib/calc
#CALC_SHAREDIR= /dev/env/DJDIR/share/calc
CALC_SHAREDIR= /usr/share/calc
# By default, these values are based CALC_SHAREDIR, INCDIR, BINDIR
# ---------------------------------------------------------------
# ${HELPDIR} where the help directory is installed
# ${CALC_INCDIR} where the calc include files are installed
# ${CUSTOMCALDIR} where custom *.cal files are installed
# ${CUSTOMHELPDIR} where custom help files are installed
# ${CUSTOMINCPDIR} where custom .h files are installed
# ${SCRIPTDIR} where calc shell scripts are installed
#
# NOTE: The install rule prepends installation paths with $T, which
# by default is empty. If $T is non-empty, then installation
# locations will be relative to the $T directory.
#
# If in doubt, set:
#
# HELPDIR= ${CALC_SHAREDIR}/help
# CALC_INCDIR= ${INCDIR}/calc
# CUSTOMCALDIR= ${CALC_SHAREDIR}/custom
# CUSTOMHELPDIR= ${CALC_SHAREDIR}/custhelp
# CUSTOMINCDIR= ${CALC_INCDIR}/custom
# SCRIPTDIR= ${BINDIR}/cscript
#
HELPDIR= ${CALC_SHAREDIR}/help
CALC_INCDIR= ${INCDIR}/calc
CUSTOMCALDIR= ${CALC_SHAREDIR}/custom
CUSTOMHELPDIR= ${CALC_SHAREDIR}/custhelp
CUSTOMINCDIR= ${CALC_INCDIR}/custom
SCRIPTDIR= ${BINDIR}/cscript
# T - top level directory under which calc will be installed
#
# The calc install is performed under $T, the calc build is
# performed under /. The purpose for $T is to allow someone to
# install calc somewhere other than into the system area. For example
# when forming the calc rpm, the Makefile is called with T=$RPM_BUILD_ROOT.
# performed under /. The purpose for $T is to allow someone
# to install calc somewhere other than into the system area.
#
# For example, if:
#
# BINDIR= /usr/bin
# LIBDIR= /usr/lib
# CALC_SHAREDIR= /usr/share/calc
#
# and if:
#
# T= /var/tmp/testing
#
# Then the installation locations will be:
#
# calc binary files: /var/tmp/testing/usr/bin
# calc link library: /var/tmp/testing/usr/lib
# calc help, .cal ...: /var/tmp/testing/usr/share/calc
# ... etc ... /var/tmp/testing/...
#
# If $T is empty, calc is installed under /, which is the same
# top of tree for which it was built. If $T is non-empty, then

View File

@@ -1,7 +1,7 @@
/*
* version - determine the version of calc
*
* Copyright (C) 1999 David I. Bell and Landon Curt Noll
* Copyright (C) 1999-2002 David I. Bell and Landon Curt Noll
*
* Primary author: David I. Bell
*
@@ -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.38 $
* @(#) $Id: version.c,v 29.38 2002/03/12 11:00:08 chongo Exp $
* @(#) $Revision: 29.41 $
* @(#) $Id: version.c,v 29.41 2002/12/29 09:22:43 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/version.c,v $
*
* Under source code control: 1990/05/22 11:00:58
@@ -45,8 +45,8 @@ static char *program;
#define MAJOR_VER 2 /* major version */
#define MINOR_VER 11 /* minor version */
#define MAJOR_PATCH 5 /* patch level or 0 if no patch */
#define MINOR_PATCH 7 /* test number or 0 if no minor patch */
#define MAJOR_PATCH 6 /* patch level or 0 if no patch */
#define MINOR_PATCH 0 /* test number or 0 if no minor patch */
/*

View File

@@ -36,8 +36,8 @@ HAVE_UNISTD_H=NO
LIBDIR=/lib/calc
HELPDIR=/lib/calc/help
INCDIRCALC=/include/calc
CUSTOMLIBDIR=/lib/calc/custom
CALC_INCDIR=/include/calc
CUSTOMCALDIR=/lib/calc/custom
CUSTOMHELPDIR=/lib/calc/help/custhelp
SCRIPTDIR=/lib/calc/cscript
MANDIR=

View File

@@ -7,7 +7,7 @@
#define __HAVE_MALLOC_H__
/* do we have /usr/include/malloc.h? */
/* do we have <malloc.h>? */
#define HAVE_MALLOC_H /* yes */

View File

@@ -7,7 +7,7 @@
#define __HAVE_STDLIB_H__
/* do we have /usr/include/stdlib.h? */
/* do we have <stdlib.h>? */
#define HAVE_STDLIB_H /* yes */

View File

@@ -7,7 +7,7 @@
#define __HAVE_STRING_H__
/* do we have /usr/include/string.h? */
/* do we have <string.h>? */
#define HAVE_STRING_H /* yes */

View File

@@ -7,7 +7,7 @@
#define __HAVE_TIMES_H__
/* do we have /usr/include/times.h? */
/* do we have <times.h>? */
#undef HAVE_TIMES_H /* no */
#undef HAVE_SYS_TIMES_H /* no */
#define HAVE_TIME_H /* yes */

View File

@@ -7,7 +7,7 @@
#define __HAVE_UNISTD_H__
/* do we have /usr/include/unistd.h? */
/* do we have <unistd.h>? */
#undef HAVE_UNISTD_H /* no */

28
zio.c
View File

@@ -1,7 +1,7 @@
/*
* zio - scanf and printf routines for arbitrary precision integers
*
* Copyright (C) 1999 David I. Bell
* Copyright (C) 1999-2002 David I. Bell
*
* 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.3 $
* @(#) $Id: zio.c,v 29.3 2000/07/17 15:35:49 chongo Exp $
* @(#) $Revision: 29.4 $
* @(#) $Id: zio.c,v 29.4 2002/12/29 09:20:25 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/zio.c,v $
*
* Under source code control: 1993/07/30 19:42:48
@@ -52,6 +52,7 @@ struct iostate {
IOSTATE *oldiostates; /* previous saved state */
long outdigits; /* digits for output */
int outmode; /* output mode */
int outmode2; /* secondary output mode */
FILE *outfp; /* file unit for output (if any) */
char *outbuf; /* output string buffer (if any) */
long outbufsize; /* current size of string buffer */
@@ -214,6 +215,7 @@ math_divertio(void)
sp->oldiostates = oldiostates;
sp->outdigits = conf->outdigits;
sp->outmode = conf->outmode;
sp->outmode2 = conf->outmode2;
sp->outfp = outfp;
sp->outbuf = outbuf;
sp->outbufsize = outbufsize;
@@ -254,6 +256,7 @@ math_getdivertedio(void)
oldiostates = sp->oldiostates;
conf->outdigits = sp->outdigits;
conf->outmode = sp->outmode;
conf->outmode2 = sp->outmode2;
outfp = sp->outfp;
outbuf = sp->outbuf;
outbufsize = sp->outbufsize;
@@ -314,6 +317,25 @@ math_setmode(int newmode)
}
/*
* Set the secondary output mode for numeric output.
* This also returns the previous mode.
*/
int
math_setmode2(int newmode)
{
int oldmode;
if (newmode != MODE2_OFF && ((newmode <= MODE_DEFAULT) || (newmode > MODE_MAX))) {
math_error("Setting illegal secondary output mode");
/*NOTREACHED*/
}
oldmode = conf->outmode2;
conf->outmode2 = newmode;
return oldmode;
}
/*
* Set the number of digits for float or exponential output.
* This also returns the previous number of digits.

10
zmath.h
View File

@@ -1,7 +1,7 @@
/*
* zmath - declarations for extended precision integer arithmetic
*
* Copyright (C) 1999 David I. Bell
* Copyright (C) 1999-2002 David I. Bell
*
* 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.7 $
* @(#) $Id: zmath.h,v 29.7 2001/06/08 21:00:58 chongo Exp $
* @(#) $Revision: 29.9 $
* @(#) $Id: zmath.h,v 29.9 2002/12/29 09:20:25 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/zmath.h,v $
*
* Under source code control: 1993/07/30 19:42:48
@@ -131,7 +131,7 @@ typedef SB32 SFULL; /* signed FULL */
#define TOPFULL ((FULL)1 << (FULL_BITS-1)) /* highest bit in FULL */
#define MAXFULL (TOPFULL - (FULL)1) /* largest SFULL value */
#define MAXUFULL (MAXFULL | TOPHALF) /* largest FULL value */
#define MAXUFULL (MAXFULL | TOPFULL) /* largest FULL value */
#define TOPLONG ((unsigned long)1 << (LONG_BITS-1)) /* top long bit */
#define MAXLONG ((long) (TOPLONG - (unsigned long)1)) /* largest long val */
@@ -552,8 +552,10 @@ extern DLL void zredcpower(REDC *rp, ZVALUE z1, ZVALUE z2, ZVALUE *res);
#define MODE_OCTAL 6
#define MODE_BINARY 7
#define MODE_MAX 7
#define MODE2_OFF (MODE_MAX+1)
#define MODE_INITIAL MODE_REAL
#define MODE2_INITIAL MODE2_OFF
/*

View File

@@ -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: zrandom.c,v 29.3 2001/05/08 06:44:29 chongo Exp $
* @(#) $Revision: 29.4 $
* @(#) $Id: zrandom.c,v 29.4 2002/12/29 06:35:08 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/zrandom.c,v $
*
* Under source code control: 1997/02/15 04:01:56
@@ -2280,7 +2280,7 @@ zrandomrange(CONST ZVALUE low, CONST ZVALUE high, ZVALUE *res)
zsub(high, low, &range);
if (zisone(range)) {
zfree_random(range);
*res = low;
zcopy(low, res);
return;
}
zsub(range, _one_, &rangem1);