Release calc version 2.12.2.2

This commit is contained in:
Landon Curt Noll
2007-10-16 05:26:19 -07:00
parent 71e88bdc91
commit b3648f030f
28 changed files with 531 additions and 257 deletions

64
CHANGES
View File

@@ -40,6 +40,66 @@ The following are the changes from calc version 2.12.1.1 to date:
purposes. By default, the calc rpm installed stripped binaries purposes. By default, the calc rpm installed stripped binaries
and libraries. and libraries.
Added this high priority item to the calc help/todo list:
It is overkill to have nearly everything wind up in libcalc.
Form a libcalcmath and a libcalclang so that an application
that just wants to link with the calc math libs can use them
without dragging in all of the other calc language, I/O,
and builtin functions.
Fixed the wording for the -i flag in the calc man page.
Added some notes to the help/unexpected file regarding calc
and interactice shells.
Fixed bug where a FILEPOS was copied FPOS_POS_BITS octets instead of
FPOS_POS_LEN octets.
Split out ${READLINE_EXTRAS} Makefile variables from ${READLINE_LIB}
to better deal with Fedora rpm requirements.
Bit 8 (0x80) of calc_debug is reserved for custom debugging.
See help/config and custom/HOW_TO_ADD for details.
When the Makefile variable ${ALLOW_CUSTOM} is not defined or empty,
the libcustcalc library is not built or linked against, certain make
rules skip going into the custom sub-directory, the install
rule skips certain custom installation actions, and the common
C flags (${COMMON_CFLAGS}) is given -UCUSTOM. Other make rules such
as "make clean" and "make clobber" still work as before. Also
the Makefile.simple assumes that the Makefile variable ${ALLOW_CUSTOM}
is -DCUSTOM.
Clarified that the calc builtin functions rand() and random()
operate over a half closed interval. The help/rand and help/random
refer to the top of the interval as "beyond" instead of "max".
Releaseing source tar balls using bzip2 instead of with gzip. So
what was calc-something.tar.gz is now calc-something.tar.bz2.
To "uncompress" use:
bunzip2 calc-something.tar.bz2
On some systems, one may untar directly by:
tar -jxvf calc-something.tar.bz2
The Makefile variable ${BYTE_ORDER} was replaced by ${CALC_BYTE_ORDER}.
Changed the way the Makefile can force the calc byte order. If you set
the Makefile variable ${CALC_BYTE_ORDER} to be -DCALC_BIG_ENDIAN then
endian.h will force the CPP symbol CALC_BYTE_ORDER to be BIG_ENDIAN.
If you set ${CALC_BYTE_ORDER} to be -DCALC_LITTLE_ENDIAN then endian.h
will force the CPP symbol CALC_BYTE_ORDER to be LITTLE_ENDIAN.
If the Makefile variable ${CALC_BYTE_ORDER} is empty, then the CPP
symbol CALC_BYTE_ORDER will set to the CPP symbol BYTE_ORDER as
defined by some system include file (if the Makefile can find such
an include file), or the Makefile compiling endian.c and hopefully
using that result to set CPP symbol CALC_BYTE_ORDER. Regardless of
how it happens, the CPP symbol CALC_BYTE_ORDER should end up set in
endian_calc.h include file.
The following are the changes from calc version 2.12.1.10 to 2.12.2: The following are the changes from calc version 2.12.1.10 to 2.12.2:
@@ -6635,8 +6695,8 @@ Following is a list of visible changes to calc from version 1.24.7 to 1.26.1:
## received a copy with calc; if not, write to Free Software Foundation, Inc. ## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
## ##
## @(#) $Revision: 30.10 $ ## @(#) $Revision: 30.11 $
## @(#) $Id: CHANGES,v 30.10 2007/09/06 08:10:54 chongo Exp $ ## @(#) $Id: CHANGES,v 30.11 2007/10/16 12:22:22 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/RCS/CHANGES,v $ ## @(#) $Source: /usr/local/src/cmd/calc/RCS/CHANGES,v $
## ##
## Under source code control: 1993/06/02 18:12:57 ## Under source code control: 1993/06/02 18:12:57

View File

@@ -1,4 +1,4 @@
Installing calc from the gziped tarball in 4 easy steps: Installing calc from the bzip2-ed tarball in 4 easy steps:
0) If your platform supports i686 RPMs, you may want to go to: 0) If your platform supports i686 RPMs, you may want to go to:
@@ -17,13 +17,13 @@ Installing calc from the gziped tarball in 4 easy steps:
The following 4 steps apply to calc source tree that comes from either: The following 4 steps apply to calc source tree that comes from either:
gunzip -c calc-*.tar.gz | tar -xvf - bunzip2 -c calc-*.tar.bz2 | tar -xvf -
or from: or from:
rpm -ivh calc-*.src.rpm rpm -ivh calc-*.src.rpm
cd /var/tmp cd /var/tmp
gunzip -c /usr/src/redhat/SOURCES/calc-*.tar.gz | tar -xvf - bunzip2 -c /usr/src/redhat/SOURCES/calc-*.tar.bz2 | tar -xvf -
1) Look at the makefile, and adjust it to suit your needs. 1) Look at the makefile, and adjust it to suit your needs.
@@ -204,8 +204,8 @@ the calc help subsystem. See the README file for details.
## received a copy with calc; if not, write to Free Software Foundation, Inc. ## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
## ##
## @(#) $Revision: 30.5 $ ## @(#) $Revision: 30.6 $
## @(#) $Id: HOWTO.INSTALL,v 30.5 2007/09/01 19:54:03 chongo Exp $ ## @(#) $Id: HOWTO.INSTALL,v 30.6 2007/10/16 12:22:22 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/RCS/HOWTO.INSTALL,v $ ## @(#) $Source: /usr/local/src/cmd/calc/RCS/HOWTO.INSTALL,v $
## ##
## Under source code control: 1999/09/27 20:48:44 ## Under source code control: 1999/09/27 20:48:44

206
Makefile
View File

@@ -11,7 +11,7 @@
# (Generic calc makefile) # (Generic calc makefile)
# #
# NOTE: This is NOT the calc rpm Makefile. This Makefile is a generic # NOTE: This is NOT the calc rpm Makefile. This Makefile is a generic
# Makefile for the people who build calc from the gziped tarball. # Makefile for the people who build calc from the bzip2-ed tarball.
# Without modification, it not assume the system has readline, ncurses # Without modification, it not assume the system has readline, ncurses
# or less. It compiles with gcc -O3 -g3 as well. You can change all # or less. It compiles with gcc -O3 -g3 as well. You can change all
# this by modifying the Makefile variables below. # this by modifying the Makefile variables below.
@@ -20,7 +20,8 @@
# has the GNU readline headers and libaraies: # has the GNU readline headers and libaraies:
# #
# USE_READLINE= -DUSE_READLINE # USE_READLINE= -DUSE_READLINE
# READLINE_LIB= -lreadline -lhistory -lncurses # READLINE_LIB= -lreadline
# READLINE_EXTRAS= -lhistory -lncurses
# #
# Copyright (C) 1999-2007 Landon Curt Noll # Copyright (C) 1999-2007 Landon Curt Noll
# #
@@ -38,8 +39,8 @@
# received a copy with calc; if not, write to Free Software Foundation, Inc. # received a copy with calc; if not, write to Free Software Foundation, Inc.
# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
# #
MAKEFILE_REV= $$Revision: 30.21 $$ MAKEFILE_REV= $$Revision: 30.25 $$
# @(#) $Id: Makefile.ship,v 30.21 2007/09/06 08:08:39 chongo Exp $ # @(#) $Id: Makefile.ship,v 30.25 2007/09/29 16:57:48 chongo Exp $
# @(#) $Source: /usr/local/src/cmd/calc/RCS/Makefile.ship,v $ # @(#) $Source: /usr/local/src/cmd/calc/RCS/Makefile.ship,v $
# #
# Under source code control: 1990/02/15 01:48:41 # Under source code control: 1990/02/15 01:48:41
@@ -120,19 +121,19 @@ HAVE_VSPRINTF=
# Big Endian: Amdahl, 68k, Pyramid, Mips, Sparc, ... # Big Endian: Amdahl, 68k, Pyramid, Mips, Sparc, ...
# Little Endian: Vax, 32k, Spim (Dec Mips), i386, i486, ... # Little Endian: Vax, 32k, Spim (Dec Mips), i386, i486, ...
# #
# If in doubt, leave BYTE_ORDER empty. This Makefile will attempt to # If in doubt, leave CALC_BYTE_ORDER empty. This Makefile will attempt to
# use BYTE_ORDER in <machine/endian.h> or it will attempt to run # use BYTE_ORDER in <machine/endian.h> or it will attempt to run
# the endian program. If you get syntax errors when you compile, # the endian program. If you get syntax errors when you compile,
# try forcing the value to be -DBIG_ENDIAN and run the calc regression # try forcing the value to be -DBIG_ENDIAN and run the calc regression
# tests. (see the README file) If the calc regression tests fail, do # tests. (see the README file) If the calc regression tests fail, do
# a make clobber and try -DLITTLE_ENDIAN. If that fails, ask a wizard # a make clobber and try -DCALC_LITTLE_ENDIAN. If that fails, ask a wizard
# for help. # for help.
# #
# Select BYTE_ORDER= -DLITTLE_ENDIAN for DJGPP. # Select CALC_BYTE_ORDER= -DCALC_LITTLE_ENDIAN for DJGPP.
# #
BYTE_ORDER= CALC_BYTE_ORDER=
#BYTE_ORDER= -DBIG_ENDIAN #CALC_BYTE_ORDER= -DCALC_BIG_ENDIAN
#BYTE_ORDER= -DLITTLE_ENDIAN #CALC_BYTE_ORDER= -DCALC_LITTLE_ENDIAN
# Determine the number of bits in a long # Determine the number of bits in a long
# #
@@ -767,13 +768,33 @@ MANMAKE= /usr/local/bin/manmake
MANMODE= 0444 MANMODE= 0444
CATMODE= 0444 CATMODE= 0444
# By default, custom builtin functions may only be executed if calc
# is given the -C option. This is because custom builtin functions
# may invoke non-standard or non-portable code. One may completely
# disable custom builtin functions by not compiling any of code
#
# ALLOW_CUSTOM= -DCUSTOM # allow custom only if -C is given
# ALLOW_CUSTOM= # disable custom even if -C is given
#
# If in doubt, use ALLOW_CUSTOM= -DCUSTOM
#
ALLOW_CUSTOM= -DCUSTOM
#ALLOW_CUSTOM=
# If the $CALCPATH environment variable is not defined, then the following # If the $CALCPATH environment variable is not defined, then the following
# path will be search for calc resource file routines. # path will be search for calc resource file routines.
# #
# Select CALCPATH= .;./cal;~/.cal;${CALC_SHAREDIR};${CUSTOMCALDIR} for DJGPP. # Select CALCPATH= .;./cal;~/.cal;${CALC_SHAREDIR};${CUSTOMCALDIR} for DJGPP.
# #
#if 0 /* start of skip for non-Gnu makefiles */
ifdef ALLOW_CUSTOM
#endif /* end of skip for non-Gnu makefiles */
CALCPATH= .:./cal:~/.cal:${CALC_SHAREDIR}:${CUSTOMCALDIR} CALCPATH= .:./cal:~/.cal:${CALC_SHAREDIR}:${CUSTOMCALDIR}
#CALCPATH= .;./cal;~/.cal;${CALC_SHAREDIR};${CUSTOMCALDIR} #if 0 /* start of skip for non-Gnu makefiles */
else
CALCPATH= .:./cal:~/.cal:${CALC_SHAREDIR}
endif
#endif /* end of skip for non-Gnu makefiles */
# If the $CALCRC environment variable is not defined, then the following # If the $CALCRC environment variable is not defined, then the following
# path will be search for calc resource files. # path will be search for calc resource files.
@@ -793,6 +814,8 @@ CALCRC= ${CALC_SHAREDIR}/startup:~/.calcrc:./.calcinit
# #
# READLINE_LIB The flags needed to link in the readline # READLINE_LIB The flags needed to link in the readline
# and history link libraries # and history link libraries
# READLINE_EXTRAS Flags and libs needed to use the readline
# and history link libraries
# READLINE_INCLUDE Where the readline include files reside # READLINE_INCLUDE Where the readline include files reside
# (leave blank if they are /usr/include/readline) # (leave blank if they are /usr/include/readline)
# #
@@ -806,14 +829,22 @@ USE_READLINE=
#USE_READLINE= -DUSE_READLINE #USE_READLINE= -DUSE_READLINE
# #
READLINE_LIB= READLINE_LIB=
#READLINE_LIB= -lreadline -lhistory -lncurses READLINE_EXTRAS=
#READLINE_LIB= -L/usr/gnu/lib -lreadline -lhistory -lncurses #
#READLINE_LIB= -L/usr/local/lib -lreadline -lhistory -lncurses #READLINE_LIB= -lreadline
#READLINE_EXTRAS= -lhistory -lncurses
#
#READLINE_LIB= -L/usr/gnu/lib -lreadline
#READLINE_EXTRAS= -lhistory -lncurses
#
#READLINE_LIB= -L/usr/local/lib -lreadline
#READLINE_EXTRAS= -lhistory -lncurses
# #
# For Apple OS X: install fink from http://fink.sourceforge.net # For Apple OS X: install fink from http://fink.sourceforge.net
# and then do a 'fink install readline' and then use: # and then do a 'fink install readline' and then use:
# #
#READLINE_LIB= -L/sw/lib -lreadline -lhistory -lncurses #READLINE_LIB= -L/sw/lib -lreadline
#READLINE_EXTRAS= -lhistory -lncurses
# #
READLINE_INCLUDE= READLINE_INCLUDE=
#READLINE_INCLUDE= -I/usr/gnu/include #READLINE_INCLUDE= -I/usr/gnu/include
@@ -923,18 +954,6 @@ CALC_ENV= CALCPATH=./cal LD_LIBRARY_PATH=.
# MALLOC_FASTCHK=1 MALLOC_FULLWARN=1 MALLOC_CLEAR_FREE=1 \ # MALLOC_FASTCHK=1 MALLOC_FULLWARN=1 MALLOC_CLEAR_FREE=1 \
# MALLOC_CLEAR_MALLOC=1 LD_LIBRARY_PATH=.:./custom # MALLOC_CLEAR_MALLOC=1 LD_LIBRARY_PATH=.:./custom
# By default, custom builtin functions may only be executed if calc
# is given the -C option. This is because custom builtin functions
# may invoke non-standard or non-portable code. One may completely
# disable custom builtin functions by not compiling any of code
#
# ALLOW_CUSTOM= -DCUSTOM # allow custom only if -C is given
# ALLOW_CUSTOM= # disable custom even if -C is given
#
# If in doubt, use ALLOW_CUSTOM= -DCUSTOM
#
ALLOW_CUSTOM= -DCUSTOM
#ALLOW_CUSTOM=
# The install rule uses: # The install rule uses:
# #
@@ -965,7 +984,7 @@ EXT=
# The default calc versions # The default calc versions
# #
VERSION= 2.12.2.1 VERSION= 2.12.2.2
VERS= 2.12.2 VERS= 2.12.2
VER= 2.12 VER= 2.12
VE= 2 VE= 2
@@ -1036,7 +1055,15 @@ EXTRA_LDFLAGS=
# COMMON_CFLAGS are the common ${CC} flags used for all progs, both # COMMON_CFLAGS are the common ${CC} flags used for all progs, both
# intermediate and final calc and calc related progs # intermediate and final calc and calc related progs
# #
#if 0 /* start of skip for non-Gnu makefiles */
ifdef ALLOW_CUSTOM
#endif /* end of skip for non-Gnu makefiles */
COMMON_CFLAGS= -DCALC_SRC ${ALLOW_CUSTOM} ${CCWARN} ${CCMISC} ${EXTRA_CFLAGS} COMMON_CFLAGS= -DCALC_SRC ${ALLOW_CUSTOM} ${CCWARN} ${CCMISC} ${EXTRA_CFLAGS}
#if 0 /* start of skip for non-Gnu makefiles */
else
COMMON_CFLAGS= -DCALC_SRC -UCUSTOM ${CCWARN} ${CCMISC} ${EXTRA_CFLAGS}
endif
#endif /* end of skip for non-Gnu makefiles */
# COMMON_LDFLAGS are the common flags used for linking all progs, both # COMMON_LDFLAGS are the common flags used for linking all progs, both
# intermediate and final calc and calc related progs # intermediate and final calc and calc related progs
@@ -1108,7 +1135,11 @@ DEFAULT_LIB_INSTALL_PATH= ${PWD}:/lib:/usr/lib:${LIBDIR}:/usr/local/lib
LD_SHARE= "-Wl,-rpath,${DEFAULT_LIB_INSTALL_PATH}" \ LD_SHARE= "-Wl,-rpath,${DEFAULT_LIB_INSTALL_PATH}" \
"-Wl,-rpath-link,${DEFAULT_LIB_INSTALL_PATH}" "-Wl,-rpath-link,${DEFAULT_LIB_INSTALL_PATH}"
LIBCALC_SHLIB= -shared "-Wl,-soname,libcalc${LIB_EXT_VERSION}" LIBCALC_SHLIB= -shared "-Wl,-soname,libcalc${LIB_EXT_VERSION}"
ifdef ALLOW_CUSTOM
LIBCUSTCALC_SHLIB= -shared "-Wl,-soname,libcustcalc${LIB_EXT_VERSION}" LIBCUSTCALC_SHLIB= -shared "-Wl,-soname,libcustcalc${LIB_EXT_VERSION}"
else
LIBCUSTCALC_SHLIB=
endif
# #
CC_STATIC= CC_STATIC=
LD_STATIC= LD_STATIC=
@@ -1137,7 +1168,11 @@ CC_SHARE= -fPIC
DEFAULT_LIB_INSTALL_PATH= ${PWD}:${LIBDIR}:/usr/local/lib DEFAULT_LIB_INSTALL_PATH= ${PWD}:${LIBDIR}:/usr/local/lib
LD_SHARE= ${DARWIN_ARCH} LD_SHARE= ${DARWIN_ARCH}
LIBCALC_SHLIB= -single_module -undefined dynamic_lookup -dynamiclib LIBCALC_SHLIB= -single_module -undefined dynamic_lookup -dynamiclib
ifdef ALLOW_CUSTOM
LIBCUSTCALC_SHLIB= -single_module -undefined dynamic_lookup -dynamiclib LIBCUSTCALC_SHLIB= -single_module -undefined dynamic_lookup -dynamiclib
else
LIBCUSTCALC_SHLIB=
endif
# #
CC_STATIC= CC_STATIC=
LD_STATIC= ${DARWIN_ARCH} LD_STATIC= ${DARWIN_ARCH}
@@ -1185,7 +1220,11 @@ DEFAULT_LIB_INSTALL_PATH= ${PWD}:/lib:/usr/lib:${LIBDIR}:/usr/local/lib
LD_SHARE= "-Wl,-rpath,${DEFAULT_LIB_INSTALL_PATH}" \ LD_SHARE= "-Wl,-rpath,${DEFAULT_LIB_INSTALL_PATH}" \
"-Wl,-rpath-link,${DEFAULT_LIB_INSTALL_PATH}" "-Wl,-rpath-link,${DEFAULT_LIB_INSTALL_PATH}"
LIBCALC_SHLIB= -shared "-Wl,-soname,libcalc${LIB_EXT_VERSION}" LIBCALC_SHLIB= -shared "-Wl,-soname,libcalc${LIB_EXT_VERSION}"
ifdef ALLOW_CUSTOM
LIBCUSTCALC_SHLIB= -shared "-Wl,-soname,libcustcalc${LIB_EXT_VERSION}" LIBCUSTCALC_SHLIB= -shared "-Wl,-soname,libcustcalc${LIB_EXT_VERSION}"
else
LIBCUSTCALC_SHLIB=
endif
# #
CC_STATIC= CC_STATIC=
LD_STATIC= LD_STATIC=
@@ -1204,12 +1243,12 @@ MAKE= gmake
# #
endif endif
###################### ################
# Sun Solaris target # # SunOS target #
###################### ################
# XXX - this needs to be tested # XXX - this needs to be tested
ifeq ($(target),solaris) ifeq ($(target),SunOS)
# #
BLD_TYPE= calc-dynamic-only BLD_TYPE= calc-dynamic-only
# #
@@ -1218,7 +1257,11 @@ DEFAULT_LIB_INSTALL_PATH= ${PWD}:/lib:/usr/lib:${LIBDIR}:/usr/local/lib
LD_SHARE= "-Wl,-rpath,${DEFAULT_LIB_INSTALL_PATH}" \ LD_SHARE= "-Wl,-rpath,${DEFAULT_LIB_INSTALL_PATH}" \
"-Wl,-rpath-link,${DEFAULT_LIB_INSTALL_PATH}" "-Wl,-rpath-link,${DEFAULT_LIB_INSTALL_PATH}"
LIBCALC_SHLIB= -shared "-Wl,-soname,libcalc${LIB_EXT_VERSION}" LIBCALC_SHLIB= -shared "-Wl,-soname,libcalc${LIB_EXT_VERSION}"
ifdef ALLOW_CUSTOM
LIBCUSTCALC_SHLIB= -shared "-Wl,-soname,libcustcalc${LIB_EXT_VERSION}" LIBCUSTCALC_SHLIB= -shared "-Wl,-soname,libcustcalc${LIB_EXT_VERSION}"
else
LIBCUSTCALC_SHLIB=
endif
# #
CC_STATIC= CC_STATIC=
LIBCALC_STATIC= LIBCALC_STATIC=
@@ -1299,7 +1342,11 @@ DEFAULT_LIB_INSTALL_PATH= ${PWD}:/lib:/usr/lib:${LIBDIR}:/usr/local/lib
LD_SHARE= "-Wl,-rpath,${DEFAULT_LIB_INSTALL_PATH}" \ LD_SHARE= "-Wl,-rpath,${DEFAULT_LIB_INSTALL_PATH}" \
"-Wl,-rpath-link,${DEFAULT_LIB_INSTALL_PATH}" "-Wl,-rpath-link,${DEFAULT_LIB_INSTALL_PATH}"
LIBCALC_SHLIB= -shared "-Wl,-soname,libcalc${LIB_EXT_VERSION}" LIBCALC_SHLIB= -shared "-Wl,-soname,libcalc${LIB_EXT_VERSION}"
ifdef ALLOW_CUSTOM
LIBCUSTCALC_SHLIB= -shared "-Wl,-soname,libcustcalc${LIB_EXT_VERSION}" LIBCUSTCALC_SHLIB= -shared "-Wl,-soname,libcustcalc${LIB_EXT_VERSION}"
else
LIBCUSTCALC_SHLIB=
endif
# #
CC_STATIC= CC_STATIC=
LIBCALC_STATIC= LIBCALC_STATIC=
@@ -1341,7 +1388,6 @@ CFLAGS= ${ICFLAGS} ${CCOPT}
# #
ILDFLAGS= ${COMMON_LDFLAGS} ILDFLAGS= ${COMMON_LDFLAGS}
LDFLAGS= ${LD_DEBUG} ${ILDFLAGS} LDFLAGS= ${LD_DEBUG} ${ILDFLAGS}
#endif /* end of skip for non-Gnu makefiles */ #endif /* end of skip for non-Gnu makefiles */
####################################################################### #######################################################################
@@ -1462,7 +1508,7 @@ UTIL_TMP= ll_tmp fpos_tmp fposv_tmp const_tmp uid_tmp newstr_tmp vs_tmp \
memmv_tmp offscl_tmp posscl_tmp newstr_tmp \ memmv_tmp offscl_tmp posscl_tmp newstr_tmp \
getsid_tmp gettime_tmp getprid_tmp rusage_tmp strdup_tmp getsid_tmp gettime_tmp getprid_tmp rusage_tmp strdup_tmp
# these utility executables may be created in the process of # these utility executables may be created in the process of
# building the BUILD_H_SRC file set # building the BUILD_H_SRC file set
# #
UTIL_PROGS= align32${EXT} fposval${EXT} have_uid_t${EXT} have_const${EXT} \ UTIL_PROGS= align32${EXT} fposval${EXT} have_uid_t${EXT} have_const${EXT} \
@@ -1572,9 +1618,6 @@ HELP_PASSDOWN= \
COMMON_CFLAGS="${COMMON_CFLAGS}" \ COMMON_CFLAGS="${COMMON_CFLAGS}" \
COMMON_LDFLAGS="${COMMON_LDFLAGS}" \ COMMON_LDFLAGS="${COMMON_LDFLAGS}" \
CP=${CP} \ CP=${CP} \
CUSTOMCALDIR="${CUSTOMCALDIR}" \
CUSTOMHELPDIR="${CUSTOMHELPDIR}" \
CUSTOMINCDIR="${CUSTOMINCDIR}" \
EXT=${EXT} \ EXT=${EXT} \
FMT=${FMT} \ FMT=${FMT} \
HELPDIR="${HELPDIR}" \ HELPDIR="${HELPDIR}" \
@@ -1609,9 +1652,6 @@ CAL_PASSDOWN= \
CMP=${CMP} \ CMP=${CMP} \
CO=${CO} \ CO=${CO} \
CP=${CP} \ CP=${CP} \
CUSTOMCALDIR="${CUSTOMCALDIR}" \
CUSTOMHELPDIR="${CUSTOMHELPDIR}" \
CUSTOMINCDIR="${CUSTOMINCDIR}" \
HELPDIR="${HELPDIR}" \ HELPDIR="${HELPDIR}" \
INCDIR="${INCDIR}" \ INCDIR="${INCDIR}" \
LANG=${LANG} \ LANG=${LANG} \
@@ -1640,9 +1680,6 @@ CSCRIPT_PASSDOWN= \
CMP=${CMP} \ CMP=${CMP} \
CO=${CO} \ CO=${CO} \
CP=${CP} \ CP=${CP} \
CUSTOMCALDIR="${CUSTOMCALDIR}" \
CUSTOMHELPDIR="${CUSTOMHELPDIR}" \
CUSTOMINCDIR="${CUSTOMINCDIR}" \
FMT=${FMT} \ FMT=${FMT} \
HELPDIR="${HELPDIR}" \ HELPDIR="${HELPDIR}" \
INCDIR="${INCDIR}" \ INCDIR="${INCDIR}" \
@@ -1691,18 +1728,43 @@ OBJS= ${LIBOBJS} ${CALCOBJS} ${UTIL_OBJS} ${SAMPLE_OBJS}
# static library build # static library build
# #
#if 0 /* start of skip for non-Gnu makefiles */
ifdef ALLOW_CUSTOM
#endif /* end of skip for non-Gnu makefiles */
CALC_STATIC_LIBS= libcalc.a libcustcalc.a CALC_STATIC_LIBS= libcalc.a libcustcalc.a
#if 0 /* start of skip for non-Gnu makefiles */
else
CALC_STATIC_LIBS= libcalc.a
endif
#endif /* end of skip for non-Gnu makefiles */
# Libaraies created and used to build calc # Libaraies created and used to build calc
# #
#if 0 /* start of skip for non-Gnu makefiles */
ifdef ALLOW_CUSTOM
#endif /* end of skip for non-Gnu makefiles */
CALC_DYNAMIC_LIBS= libcalc${LIB_EXT_VERSION} libcustcalc${LIB_EXT_VERSION} CALC_DYNAMIC_LIBS= libcalc${LIB_EXT_VERSION} libcustcalc${LIB_EXT_VERSION}
#if 0 /* start of skip for non-Gnu makefiles */
else
CALC_DYNAMIC_LIBS= libcalc${LIB_EXT_VERSION}
endif
#endif /* end of skip for non-Gnu makefiles */
# Symlinks of dymanic shared libraries # Symlinks of dymanic shared libraries
# #
#if 0 /* start of skip for non-Gnu makefiles */
ifdef ALLOW_CUSTOM
#endif /* end of skip for non-Gnu makefiles */
SYM_DYNAMIC_LIBS= libcalc${LIB_EXT_VER} libcalc${LIB_EXT_VE} libcalc${LIB_EXT} \ SYM_DYNAMIC_LIBS= libcalc${LIB_EXT_VER} libcalc${LIB_EXT_VE} libcalc${LIB_EXT} \
libcalc${LIB_EXT_VERS} libcustcalc${LIB_EXT_VERSION} \ libcalc${LIB_EXT_VERS} libcustcalc${LIB_EXT_VERSION} \
libcustcalc${LIB_EXT_VERS} libcustcalc${LIB_EXT_VER} \ libcustcalc${LIB_EXT_VERS} libcustcalc${LIB_EXT_VER} \
libcustcalc${LIB_EXT_VE} libcustcalc${LIB_EXT} libcustcalc${LIB_EXT_VE} libcustcalc${LIB_EXT}
#if 0 /* start of skip for non-Gnu makefiles */
else
SYM_DYNAMIC_LIBS= libcalc${LIB_EXT_VER} libcalc${LIB_EXT_VE} libcalc${LIB_EXT} \
libcalc${LIB_EXT_VERS}
endif
#endif /* end of skip for non-Gnu makefiles */
# list of sample programs to that need to be built to satisfy sample rule # list of sample programs to that need to be built to satisfy sample rule
# #
@@ -1733,7 +1795,15 @@ STATIC_FIRST_TARGETS= ${LICENSE} .static
# early targets - things needed before the main build phase can begin # early targets - things needed before the main build phase can begin
# #
#if 0 /* start of skip for non-Gnu makefiles */
ifdef ALLOW_CUSTOM
#endif /* end of skip for non-Gnu makefiles */
EARLY_TARGETS= custom/Makefile hsrc .hsrc custom/.all EARLY_TARGETS= custom/Makefile hsrc .hsrc custom/.all
#if 0 /* start of skip for non-Gnu makefiles */
else
EARLY_TARGETS= hsrc .hsrc
endif
#endif /* end of skip for non-Gnu makefiles */
# late targets - things needed after the main build phase is complete # late targets - things needed after the main build phase is complete
# #
@@ -1838,10 +1908,11 @@ calc-static-only: ${STATIC_FIRST_TARGETS} ${EARLY_TARGETS} \
calc${EXT}: .hsrc ${CALCOBJS} ${CALC_DYNAMIC_LIBS} ${MAKE_FILE} calc${EXT}: .hsrc ${CALCOBJS} ${CALC_DYNAMIC_LIBS} ${MAKE_FILE}
${RM} -f $@ ${RM} -f $@
${CC} ${CALCOBJS} ${LDFLAGS} ${LD_SHARE} ${CALC_DYNAMIC_LIBS} \ ${CC} ${CALCOBJS} ${LDFLAGS} ${LD_SHARE} ${CALC_DYNAMIC_LIBS} \
${READLINE_LIB} -o $@ ${READLINE_LIB} ${READLINE_EXTRAS} -o $@
libcalc${LIB_EXT_VERSION}: ${LIBOBJS} ver_calc${EXT} ${MAKE_FILE} libcalc${LIB_EXT_VERSION}: ${LIBOBJS} ver_calc${EXT} ${MAKE_FILE}
${CC} ${LIBCALC_SHLIB} ${LIBOBJS} -o libcalc${LIB_EXT_VERSION} ${CC} ${LIBCALC_SHLIB} ${LIBOBJS} \
${READLINE_LIB} ${READLINE_EXTRAS} -o libcalc${LIB_EXT_VERSION}
libcalc${LIB_EXT_VERS}: libcalc${LIB_EXT_VERSION} libcalc${LIB_EXT_VERS}: libcalc${LIB_EXT_VERSION}
${Q} ${RM} -f $@ ${Q} ${RM} -f $@
@@ -1900,11 +1971,11 @@ sample: ${SAMPLE_TARGETS}
sample_rand${EXT}: sample_rand.o ${CALC_DYNAMIC_LIBS} ${MAKE_FILE} sample_rand${EXT}: sample_rand.o ${CALC_DYNAMIC_LIBS} ${MAKE_FILE}
${CC} sample_rand.o ${CLDFALGS} ${LD_SHARE} ${CALC_DYNAMIC_LIBS} \ ${CC} sample_rand.o ${CLDFALGS} ${LD_SHARE} ${CALC_DYNAMIC_LIBS} \
${READLINE_LIB} -o $@ ${READLINE_LIB} ${READLINE_EXTRAS} -o $@
sample_many${EXT}: sample_many.o ${CALC_DYNAMIC_LIBS} ${MAKE_FILE} sample_many${EXT}: sample_many.o ${CALC_DYNAMIC_LIBS} ${MAKE_FILE}
${CC} sample_many.o ${CLDFALGS} ${LD_SHARE} ${CALC_DYNAMIC_LIBS} \ ${CC} sample_many.o ${CLDFALGS} ${LD_SHARE} ${CALC_DYNAMIC_LIBS} \
${READLINE_LIB} -o $@ ${READLINE_LIB} ${READLINE_EXTRAS} -o $@
### ###
# #
@@ -1968,11 +2039,17 @@ conf.h: ${MAKE_FILE}
${Q} echo '#define HELPDIR "${HELPDIR}"' >> conf.h ${Q} echo '#define HELPDIR "${HELPDIR}"' >> conf.h
${Q} echo '#endif /* HELPDIR */' >> conf.h ${Q} echo '#endif /* HELPDIR */' >> conf.h
${Q} echo '' >> conf.h ${Q} echo '' >> conf.h
#if 0 /* start of skip for non-Gnu makefiles */
ifdef ALLOW_CUSTOM
#endif /* end of skip for non-Gnu makefiles */
${Q} echo '/* the location of the custom help directory */' >> conf.h ${Q} echo '/* the location of the custom help directory */' >> conf.h
${Q} echo '#if !defined(CUSTOMHELPDIR)' >> conf.h ${Q} echo '#if !defined(CUSTOMHELPDIR)' >> conf.h
${Q} echo '#define CUSTOMHELPDIR "${CUSTOMHELPDIR}"' >> conf.h ${Q} echo '#define CUSTOMHELPDIR "${CUSTOMHELPDIR}"' >> conf.h
${Q} echo '#endif /* CUSTOMHELPDIR */' >> conf.h ${Q} echo '#endif /* CUSTOMHELPDIR */' >> conf.h
${Q} echo '' >> conf.h ${Q} echo '' >> conf.h
#if 0 /* start of skip for non-Gnu makefiles */
endif
#endif /* end of skip for non-Gnu makefiles */
${Q} echo '/* the default pager to use */' >> conf.h ${Q} echo '/* the default pager to use */' >> conf.h
${Q} echo '#if !defined(DEFAULTCALCPAGER)' >> conf.h ${Q} echo '#if !defined(DEFAULTCALCPAGER)' >> conf.h
${Q} echo '#define DEFAULTCALCPAGER "${CALCPAGER}"' >> conf.h ${Q} echo '#define DEFAULTCALCPAGER "${CALCPAGER}"' >> conf.h
@@ -2004,7 +2081,7 @@ endian_calc.h: endian${EXT} ${MAKE_FILE}
${Q} echo '' >> endian_calc.h ${Q} echo '' >> endian_calc.h
${Q} echo '' >> endian_calc.h ${Q} echo '' >> endian_calc.h
${Q} echo '/* what byte order are we? */' >> endian_calc.h ${Q} echo '/* what byte order are we? */' >> endian_calc.h
-${Q} if [ X"${BYTE_ORDER}" = X ]; then \ -${Q} if [ X"${CALC_BYTE_ORDER}" = X ]; then \
if [ -f ${INCDIR}/endian.h ]; then \ if [ -f ${INCDIR}/endian.h ]; then \
echo '#include <endian.h>' >> endian_calc.h; \ echo '#include <endian.h>' >> endian_calc.h; \
echo '#define CALC_BYTE_ORDER BYTE_ORDER' >> endian_calc.h; \ echo '#define CALC_BYTE_ORDER BYTE_ORDER' >> endian_calc.h; \
@@ -3260,7 +3337,7 @@ win32_hsrc: win32.mkdef ${MAKE_FILE}
### ###
endian.o: endian.c have_unistd.h endian.o: endian.c have_unistd.h
${LCC} ${ICFLAGS} ${BYTE_ORDER} endian.c -c ${LCC} ${ICFLAGS} ${CALC_BYTE_ORDER} endian.c -c
endian${EXT}: endian.o endian${EXT}: endian.o
${RM} -f $@ ${RM} -f $@
@@ -3315,6 +3392,9 @@ ${CSCRIPT_TARGETS}: cscript/Makefile
${V} echo '=-=-=-=-= Back to the main Makefile for $@ rule =-=-=-=-=' ${V} echo '=-=-=-=-= Back to the main Makefile for $@ rule =-=-=-=-='
${V} echo '=-=-=-=-= ${MAKE_FILE} end of $@ rule =-=-=-=-=' ${V} echo '=-=-=-=-= ${MAKE_FILE} end of $@ rule =-=-=-=-='
#if 0 /* start of skip for non-Gnu makefiles */
ifdef ALLOW_CUSTOM
#endif /* end of skip for non-Gnu makefiles */
custom/.all: custom/Makefile custom/.all: custom/Makefile
${V} echo '=-=-=-=-= ${MAKE_FILE} start of $@ rule =-=-=-=-=' ${V} echo '=-=-=-=-= ${MAKE_FILE} start of $@ rule =-=-=-=-='
${V} echo '=-=-=-=-= Invoking all rule for custom =-=-=-=-=' ${V} echo '=-=-=-=-= Invoking all rule for custom =-=-=-=-='
@@ -3349,6 +3429,9 @@ libcustcalc${LIB_EXT_VE}: libcustcalc${LIB_EXT_VERSION}
libcustcalc${LIB_EXT}: libcustcalc${LIB_EXT_VERSION} libcustcalc${LIB_EXT}: libcustcalc${LIB_EXT_VERSION}
${Q} ${RM} -f $@ ${Q} ${RM} -f $@
${LN} -s $? $@ ${LN} -s $? $@
#if 0 /* start of skip for non-Gnu makefiles */
endif
#endif /* end of skip for non-Gnu makefiles */
### ###
# #
@@ -3360,7 +3443,7 @@ calc-static${EXT}: .hsrc ${CALCOBJS} \
${CALC_STATIC_LIBS} ${MAKE_FILE} ${CALC_STATIC_LIBS} ${MAKE_FILE}
${RM} -f $@ ${RM} -f $@
${CC} ${LDFLAGS} ${CALCOBJS} ${LD_STATIC} ${CALC_STATIC_LIBS} \ ${CC} ${LDFLAGS} ${CALCOBJS} ${LD_STATIC} ${CALC_STATIC_LIBS} \
${READLINE_LIB} -o $@ ${READLINE_LIB} ${READLINE_EXTRAS} -o $@
libcustcalc.a: custom/libcustcalc.a libcustcalc.a: custom/libcustcalc.a
${Q} ${RM} -f $@ ${Q} ${RM} -f $@
@@ -3372,16 +3455,22 @@ libcalc.a: ${LIBOBJS} ${MAKE_FILE}
${RANLIB} libcalc.a ${RANLIB} libcalc.a
${CHMOD} 0644 libcalc.a ${CHMOD} 0644 libcalc.a
#if 0 /* start of skip for non-Gnu makefiles */
ifdef ALLOW_CUSTOM
#endif /* end of skip for non-Gnu makefiles */
custom/libcustcalc.a: custom/Makefile custom/libcustcalc.a: custom/Makefile
cd custom; ${MAKE} -f Makefile ${CUSTOM_PASSDOWN} libcustcalc.a cd custom; ${MAKE} -f Makefile ${CUSTOM_PASSDOWN} libcustcalc.a
#if 0 /* start of skip for non-Gnu makefiles */
endif
#endif /* end of skip for non-Gnu makefiles */
sample_rand-static${EXT}: sample_rand.o ${CALC_STATIC_LIBS} ${MAKE_FILE} sample_rand-static${EXT}: sample_rand.o ${CALC_STATIC_LIBS} ${MAKE_FILE}
${CC} ${LDFLAGS} sample_rand.o ${LD_STATIC} \ ${CC} ${LDFLAGS} sample_rand.o ${LD_STATIC} \
${CALC_STATIC_LIBS} ${READLINE_LIB} -o $@ ${CALC_STATIC_LIBS} ${READLINE_LIB} ${READLINE_EXTRAS} -o $@
sample_many-static${EXT}: sample_many.o ${CALC_STATIC_LIBS} ${MAKE_FILE} sample_many-static${EXT}: sample_many.o ${CALC_STATIC_LIBS} ${MAKE_FILE}
${CC} ${LDFLAGS} sample_many.o ${LD_STATIC} \ ${CC} ${LDFLAGS} sample_many.o ${LD_STATIC} \
${CALC_STATIC_LIBS} ${READLINE_LIB} -o $@ ${CALC_STATIC_LIBS} ${READLINE_LIB} ${READLINE_EXTRAS} -o $@
### ###
# #
@@ -3785,6 +3874,7 @@ env:
@echo 'PURIFY=${PURIFY}'; echo '' @echo 'PURIFY=${PURIFY}'; echo ''
@echo 'Q=${Q}'; echo '' @echo 'Q=${Q}'; echo ''
@echo 'RANLIB=${RANLIB}'; echo '' @echo 'RANLIB=${RANLIB}'; echo ''
@echo 'READLINE_EXTRAS=${READLINE_EXTRAS}'; echo ''
@echo 'READLINE_INCLUDE=${READLINE_INCLUDE}'; echo '' @echo 'READLINE_INCLUDE=${READLINE_INCLUDE}'; echo ''
@echo 'READLINE_LIB=${READLINE_LIB}'; echo '' @echo 'READLINE_LIB=${READLINE_LIB}'; echo ''
@echo 'RM=${RM}'; echo '' @echo 'RM=${RM}'; echo ''
@@ -4141,6 +4231,9 @@ install: custom/Makefile ${LIB_H_SRC} ${BUILD_H_SRC} calc.1 all
else \ else \
${TRUE}; \ ${TRUE}; \
fi fi
#if 0 /* start of skip for non-Gnu makefiles */
ifdef ALLOW_CUSTOM
#endif /* end of skip for non-Gnu makefiles */
-${Q} if [ ! -d ${T}${CUSTOMCALDIR} ]; then \ -${Q} if [ ! -d ${T}${CUSTOMCALDIR} ]; then \
echo ${MKDIR} ${MKDIR_ARG} ${T}${CUSTOMCALDIR}; \ echo ${MKDIR} ${MKDIR_ARG} ${T}${CUSTOMCALDIR}; \
${MKDIR} ${MKDIR_ARG} ${T}${CUSTOMCALDIR}; \ ${MKDIR} ${MKDIR_ARG} ${T}${CUSTOMCALDIR}; \
@@ -4165,6 +4258,9 @@ install: custom/Makefile ${LIB_H_SRC} ${BUILD_H_SRC} calc.1 all
else \ else \
${TRUE}; \ ${TRUE}; \
fi fi
#if 0 /* start of skip for non-Gnu makefiles */
endif
#endif /* end of skip for non-Gnu makefiles */
-${Q} if [ ! -d ${T}${SCRIPTDIR} ]; then \ -${Q} if [ ! -d ${T}${SCRIPTDIR} ]; then \
echo ${MKDIR} ${MKDIR_ARG} ${T}${SCRIPTDIR}; \ echo ${MKDIR} ${MKDIR_ARG} ${T}${SCRIPTDIR}; \
${MKDIR} ${MKDIR_ARG} ${T}${SCRIPTDIR}; \ ${MKDIR} ${MKDIR_ARG} ${T}${SCRIPTDIR}; \
@@ -4226,9 +4322,15 @@ install: custom/Makefile ${LIB_H_SRC} ${BUILD_H_SRC} calc.1 all
${V} echo '=-=-=-=-= Invoking $@ rule for cal =-=-=-=-=' ${V} echo '=-=-=-=-= Invoking $@ rule for cal =-=-=-=-='
${Q} cd cal; ${MAKE} -f Makefile ${CAL_PASSDOWN} install ${Q} cd cal; ${MAKE} -f Makefile ${CAL_PASSDOWN} install
${V} echo '=-=-=-=-= Back to the main Makefile for $@ rule =-=-=-=-=' ${V} echo '=-=-=-=-= Back to the main Makefile for $@ rule =-=-=-=-='
#if 0 /* start of skip for non-Gnu makefiles */
ifdef ALLOW_CUSTOM
#endif /* end of skip for non-Gnu makefiles */
${V} echo '=-=-=-=-= Invoking $@ rule for custom =-=-=-=-=' ${V} echo '=-=-=-=-= Invoking $@ rule for custom =-=-=-=-='
${Q} cd custom; ${MAKE} -f Makefile ${CUSTOM_PASSDOWN} install ${Q} cd custom; ${MAKE} -f Makefile ${CUSTOM_PASSDOWN} install
${V} echo '=-=-=-=-= Back to the main Makefile for $@ rule =-=-=-=-=' ${V} echo '=-=-=-=-= Back to the main Makefile for $@ rule =-=-=-=-='
#if 0 /* start of skip for non-Gnu makefiles */
endif
#endif /* end of skip for non-Gnu makefiles */
${V} echo '=-=-=-=-= Invoking $@ rule for cscript =-=-=-=-=' ${V} echo '=-=-=-=-= Invoking $@ rule for cscript =-=-=-=-='
${Q} cd cscript; ${MAKE} -f Makefile ${CSCRIPT_PASSDOWN} install ${Q} cd cscript; ${MAKE} -f Makefile ${CSCRIPT_PASSDOWN} install
${V} echo '=-=-=-=-= Back to the main Makefile for $@ rule =-=-=-=-=' ${V} echo '=-=-=-=-= Back to the main Makefile for $@ rule =-=-=-=-='

View File

@@ -11,7 +11,7 @@
# (Generic calc makefile) # (Generic calc makefile)
# #
# NOTE: This is NOT the calc rpm Makefile. This Makefile is a generic # NOTE: This is NOT the calc rpm Makefile. This Makefile is a generic
# Makefile for the people who build calc from the gziped tarball. # Makefile for the people who build calc from the bzip2-ed tarball.
# Without modification, it not assume the system has readline, ncurses # Without modification, it not assume the system has readline, ncurses
# or less. It compiles with gcc -O3 -g3 as well. You can change all # or less. It compiles with gcc -O3 -g3 as well. You can change all
# this by modifying the Makefile variables below. # this by modifying the Makefile variables below.
@@ -20,7 +20,8 @@
# has the GNU readline headers and libaraies: # has the GNU readline headers and libaraies:
# #
# USE_READLINE= -DUSE_READLINE # USE_READLINE= -DUSE_READLINE
# READLINE_LIB= -lreadline -lhistory -lncurses # READLINE_LIB= -lreadline
# READLINE_EXTRAS= -lhistory -lncurses
# #
# Copyright (C) 1999-2007 Landon Curt Noll # Copyright (C) 1999-2007 Landon Curt Noll
# #
@@ -38,8 +39,8 @@
# received a copy with calc; if not, write to Free Software Foundation, Inc. # received a copy with calc; if not, write to Free Software Foundation, Inc.
# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
# #
MAKEFILE_REV= $$Revision: 30.21 $$ MAKEFILE_REV= $$Revision: 30.25 $$
# @(#) $Id: Makefile.ship,v 30.21 2007/09/06 08:08:39 chongo Exp $ # @(#) $Id: Makefile.ship,v 30.25 2007/09/29 16:57:48 chongo Exp $
# @(#) $Source: /usr/local/src/cmd/calc/RCS/Makefile.ship,v $ # @(#) $Source: /usr/local/src/cmd/calc/RCS/Makefile.ship,v $
# #
# Under source code control: 1990/02/15 01:48:41 # Under source code control: 1990/02/15 01:48:41
@@ -105,19 +106,19 @@ HAVE_VSPRINTF=
# Big Endian: Amdahl, 68k, Pyramid, Mips, Sparc, ... # Big Endian: Amdahl, 68k, Pyramid, Mips, Sparc, ...
# Little Endian: Vax, 32k, Spim (Dec Mips), i386, i486, ... # Little Endian: Vax, 32k, Spim (Dec Mips), i386, i486, ...
# #
# If in doubt, leave BYTE_ORDER empty. This Makefile will attempt to # If in doubt, leave CALC_BYTE_ORDER empty. This Makefile will attempt to
# use BYTE_ORDER in <machine/endian.h> or it will attempt to run # use BYTE_ORDER in <machine/endian.h> or it will attempt to run
# the endian program. If you get syntax errors when you compile, # the endian program. If you get syntax errors when you compile,
# try forcing the value to be -DBIG_ENDIAN and run the calc regression # try forcing the value to be -DBIG_ENDIAN and run the calc regression
# tests. (see the README file) If the calc regression tests fail, do # tests. (see the README file) If the calc regression tests fail, do
# a make clobber and try -DLITTLE_ENDIAN. If that fails, ask a wizard # a make clobber and try -DCALC_LITTLE_ENDIAN. If that fails, ask a wizard
# for help. # for help.
# #
# Select BYTE_ORDER= -DLITTLE_ENDIAN for DJGPP. # Select CALC_BYTE_ORDER= -DCALC_LITTLE_ENDIAN for DJGPP.
# #
BYTE_ORDER= CALC_BYTE_ORDER=
#BYTE_ORDER= -DBIG_ENDIAN #CALC_BYTE_ORDER= -DCALC_BIG_ENDIAN
#BYTE_ORDER= -DLITTLE_ENDIAN #CALC_BYTE_ORDER= -DCALC_LITTLE_ENDIAN
# Determine the number of bits in a long # Determine the number of bits in a long
# #
@@ -752,13 +753,25 @@ MANMAKE= /usr/local/bin/manmake
MANMODE= 0444 MANMODE= 0444
CATMODE= 0444 CATMODE= 0444
# By default, custom builtin functions may only be executed if calc
# is given the -C option. This is because custom builtin functions
# may invoke non-standard or non-portable code. One may completely
# disable custom builtin functions by not compiling any of code
#
# ALLOW_CUSTOM= -DCUSTOM # allow custom only if -C is given
# ALLOW_CUSTOM= # disable custom even if -C is given
#
# If in doubt, use ALLOW_CUSTOM= -DCUSTOM
#
ALLOW_CUSTOM= -DCUSTOM
#ALLOW_CUSTOM=
# If the $CALCPATH environment variable is not defined, then the following # If the $CALCPATH environment variable is not defined, then the following
# path will be search for calc resource file routines. # path will be search for calc resource file routines.
# #
# Select CALCPATH= .;./cal;~/.cal;${CALC_SHAREDIR};${CUSTOMCALDIR} for DJGPP. # Select CALCPATH= .;./cal;~/.cal;${CALC_SHAREDIR};${CUSTOMCALDIR} for DJGPP.
# #
CALCPATH= .:./cal:~/.cal:${CALC_SHAREDIR}:${CUSTOMCALDIR} CALCPATH= .:./cal:~/.cal:${CALC_SHAREDIR}:${CUSTOMCALDIR}
#CALCPATH= .;./cal;~/.cal;${CALC_SHAREDIR};${CUSTOMCALDIR}
# If the $CALCRC environment variable is not defined, then the following # If the $CALCRC environment variable is not defined, then the following
# path will be search for calc resource files. # path will be search for calc resource files.
@@ -778,6 +791,8 @@ CALCRC= ${CALC_SHAREDIR}/startup:~/.calcrc:./.calcinit
# #
# READLINE_LIB The flags needed to link in the readline # READLINE_LIB The flags needed to link in the readline
# and history link libraries # and history link libraries
# READLINE_EXTRAS Flags and libs needed to use the readline
# and history link libraries
# READLINE_INCLUDE Where the readline include files reside # READLINE_INCLUDE Where the readline include files reside
# (leave blank if they are /usr/include/readline) # (leave blank if they are /usr/include/readline)
# #
@@ -791,14 +806,22 @@ USE_READLINE=
#USE_READLINE= -DUSE_READLINE #USE_READLINE= -DUSE_READLINE
# #
READLINE_LIB= READLINE_LIB=
#READLINE_LIB= -lreadline -lhistory -lncurses READLINE_EXTRAS=
#READLINE_LIB= -L/usr/gnu/lib -lreadline -lhistory -lncurses #
#READLINE_LIB= -L/usr/local/lib -lreadline -lhistory -lncurses #READLINE_LIB= -lreadline
#READLINE_EXTRAS= -lhistory -lncurses
#
#READLINE_LIB= -L/usr/gnu/lib -lreadline
#READLINE_EXTRAS= -lhistory -lncurses
#
#READLINE_LIB= -L/usr/local/lib -lreadline
#READLINE_EXTRAS= -lhistory -lncurses
# #
# For Apple OS X: install fink from http://fink.sourceforge.net # For Apple OS X: install fink from http://fink.sourceforge.net
# and then do a 'fink install readline' and then use: # and then do a 'fink install readline' and then use:
# #
#READLINE_LIB= -L/sw/lib -lreadline -lhistory -lncurses #READLINE_LIB= -L/sw/lib -lreadline
#READLINE_EXTRAS= -lhistory -lncurses
# #
READLINE_INCLUDE= READLINE_INCLUDE=
#READLINE_INCLUDE= -I/usr/gnu/include #READLINE_INCLUDE= -I/usr/gnu/include
@@ -908,18 +931,6 @@ CALC_ENV= CALCPATH=./cal LD_LIBRARY_PATH=.
# MALLOC_FASTCHK=1 MALLOC_FULLWARN=1 MALLOC_CLEAR_FREE=1 \ # MALLOC_FASTCHK=1 MALLOC_FULLWARN=1 MALLOC_CLEAR_FREE=1 \
# MALLOC_CLEAR_MALLOC=1 LD_LIBRARY_PATH=.:./custom # MALLOC_CLEAR_MALLOC=1 LD_LIBRARY_PATH=.:./custom
# By default, custom builtin functions may only be executed if calc
# is given the -C option. This is because custom builtin functions
# may invoke non-standard or non-portable code. One may completely
# disable custom builtin functions by not compiling any of code
#
# ALLOW_CUSTOM= -DCUSTOM # allow custom only if -C is given
# ALLOW_CUSTOM= # disable custom even if -C is given
#
# If in doubt, use ALLOW_CUSTOM= -DCUSTOM
#
ALLOW_CUSTOM= -DCUSTOM
#ALLOW_CUSTOM=
# The install rule uses: # The install rule uses:
# #
@@ -950,7 +961,7 @@ EXT=
# The default calc versions # The default calc versions
# #
VERSION= 2.12.2.1 VERSION= 2.12.2.2
VERS= 2.12.2 VERS= 2.12.2
VER= 2.12 VER= 2.12
VE= 2 VE= 2
@@ -1234,7 +1245,7 @@ UTIL_TMP= ll_tmp fpos_tmp fposv_tmp const_tmp uid_tmp newstr_tmp vs_tmp \
memmv_tmp offscl_tmp posscl_tmp newstr_tmp \ memmv_tmp offscl_tmp posscl_tmp newstr_tmp \
getsid_tmp gettime_tmp getprid_tmp rusage_tmp strdup_tmp getsid_tmp gettime_tmp getprid_tmp rusage_tmp strdup_tmp
# these utility executables may be created in the process of # these utility executables may be created in the process of
# building the BUILD_H_SRC file set # building the BUILD_H_SRC file set
# #
UTIL_PROGS= align32${EXT} fposval${EXT} have_uid_t${EXT} have_const${EXT} \ UTIL_PROGS= align32${EXT} fposval${EXT} have_uid_t${EXT} have_const${EXT} \
@@ -1344,9 +1355,6 @@ HELP_PASSDOWN= \
COMMON_CFLAGS="${COMMON_CFLAGS}" \ COMMON_CFLAGS="${COMMON_CFLAGS}" \
COMMON_LDFLAGS="${COMMON_LDFLAGS}" \ COMMON_LDFLAGS="${COMMON_LDFLAGS}" \
CP=${CP} \ CP=${CP} \
CUSTOMCALDIR="${CUSTOMCALDIR}" \
CUSTOMHELPDIR="${CUSTOMHELPDIR}" \
CUSTOMINCDIR="${CUSTOMINCDIR}" \
EXT=${EXT} \ EXT=${EXT} \
FMT=${FMT} \ FMT=${FMT} \
HELPDIR="${HELPDIR}" \ HELPDIR="${HELPDIR}" \
@@ -1381,9 +1389,6 @@ CAL_PASSDOWN= \
CMP=${CMP} \ CMP=${CMP} \
CO=${CO} \ CO=${CO} \
CP=${CP} \ CP=${CP} \
CUSTOMCALDIR="${CUSTOMCALDIR}" \
CUSTOMHELPDIR="${CUSTOMHELPDIR}" \
CUSTOMINCDIR="${CUSTOMINCDIR}" \
HELPDIR="${HELPDIR}" \ HELPDIR="${HELPDIR}" \
INCDIR="${INCDIR}" \ INCDIR="${INCDIR}" \
LANG=${LANG} \ LANG=${LANG} \
@@ -1412,9 +1417,6 @@ CSCRIPT_PASSDOWN= \
CMP=${CMP} \ CMP=${CMP} \
CO=${CO} \ CO=${CO} \
CP=${CP} \ CP=${CP} \
CUSTOMCALDIR="${CUSTOMCALDIR}" \
CUSTOMHELPDIR="${CUSTOMHELPDIR}" \
CUSTOMINCDIR="${CUSTOMINCDIR}" \
FMT=${FMT} \ FMT=${FMT} \
HELPDIR="${HELPDIR}" \ HELPDIR="${HELPDIR}" \
INCDIR="${INCDIR}" \ INCDIR="${INCDIR}" \
@@ -1610,10 +1612,11 @@ calc-static-only: ${STATIC_FIRST_TARGETS} ${EARLY_TARGETS} \
calc${EXT}: .hsrc ${CALCOBJS} ${CALC_DYNAMIC_LIBS} ${MAKE_FILE} calc${EXT}: .hsrc ${CALCOBJS} ${CALC_DYNAMIC_LIBS} ${MAKE_FILE}
${RM} -f $@ ${RM} -f $@
${CC} ${CALCOBJS} ${LDFLAGS} ${LD_SHARE} ${CALC_DYNAMIC_LIBS} \ ${CC} ${CALCOBJS} ${LDFLAGS} ${LD_SHARE} ${CALC_DYNAMIC_LIBS} \
${READLINE_LIB} -o $@ ${READLINE_LIB} ${READLINE_EXTRAS} -o $@
libcalc${LIB_EXT_VERSION}: ${LIBOBJS} ver_calc${EXT} ${MAKE_FILE} libcalc${LIB_EXT_VERSION}: ${LIBOBJS} ver_calc${EXT} ${MAKE_FILE}
${CC} ${LIBCALC_SHLIB} ${LIBOBJS} -o libcalc${LIB_EXT_VERSION} ${CC} ${LIBCALC_SHLIB} ${LIBOBJS} \
${READLINE_LIB} ${READLINE_EXTRAS} -o libcalc${LIB_EXT_VERSION}
libcalc${LIB_EXT_VERS}: libcalc${LIB_EXT_VERSION} libcalc${LIB_EXT_VERS}: libcalc${LIB_EXT_VERSION}
${Q} ${RM} -f $@ ${Q} ${RM} -f $@
@@ -1672,11 +1675,11 @@ sample: ${SAMPLE_TARGETS}
sample_rand${EXT}: sample_rand.o ${CALC_DYNAMIC_LIBS} ${MAKE_FILE} sample_rand${EXT}: sample_rand.o ${CALC_DYNAMIC_LIBS} ${MAKE_FILE}
${CC} sample_rand.o ${CLDFALGS} ${LD_SHARE} ${CALC_DYNAMIC_LIBS} \ ${CC} sample_rand.o ${CLDFALGS} ${LD_SHARE} ${CALC_DYNAMIC_LIBS} \
${READLINE_LIB} -o $@ ${READLINE_LIB} ${READLINE_EXTRAS} -o $@
sample_many${EXT}: sample_many.o ${CALC_DYNAMIC_LIBS} ${MAKE_FILE} sample_many${EXT}: sample_many.o ${CALC_DYNAMIC_LIBS} ${MAKE_FILE}
${CC} sample_many.o ${CLDFALGS} ${LD_SHARE} ${CALC_DYNAMIC_LIBS} \ ${CC} sample_many.o ${CLDFALGS} ${LD_SHARE} ${CALC_DYNAMIC_LIBS} \
${READLINE_LIB} -o $@ ${READLINE_LIB} ${READLINE_EXTRAS} -o $@
### ###
# #
@@ -1776,7 +1779,7 @@ endian_calc.h: endian${EXT} ${MAKE_FILE}
${Q} echo '' >> endian_calc.h ${Q} echo '' >> endian_calc.h
${Q} echo '' >> endian_calc.h ${Q} echo '' >> endian_calc.h
${Q} echo '/* what byte order are we? */' >> endian_calc.h ${Q} echo '/* what byte order are we? */' >> endian_calc.h
-${Q} if [ X"${BYTE_ORDER}" = X ]; then \ -${Q} if [ X"${CALC_BYTE_ORDER}" = X ]; then \
if [ -f ${INCDIR}/endian.h ]; then \ if [ -f ${INCDIR}/endian.h ]; then \
echo '#include <endian.h>' >> endian_calc.h; \ echo '#include <endian.h>' >> endian_calc.h; \
echo '#define CALC_BYTE_ORDER BYTE_ORDER' >> endian_calc.h; \ echo '#define CALC_BYTE_ORDER BYTE_ORDER' >> endian_calc.h; \
@@ -3032,7 +3035,7 @@ win32_hsrc: win32.mkdef ${MAKE_FILE}
### ###
endian.o: endian.c have_unistd.h endian.o: endian.c have_unistd.h
${LCC} ${ICFLAGS} ${BYTE_ORDER} endian.c -c ${LCC} ${ICFLAGS} ${CALC_BYTE_ORDER} endian.c -c
endian${EXT}: endian.o endian${EXT}: endian.o
${RM} -f $@ ${RM} -f $@
@@ -3132,7 +3135,7 @@ calc-static${EXT}: .hsrc ${CALCOBJS} \
${CALC_STATIC_LIBS} ${MAKE_FILE} ${CALC_STATIC_LIBS} ${MAKE_FILE}
${RM} -f $@ ${RM} -f $@
${CC} ${LDFLAGS} ${CALCOBJS} ${LD_STATIC} ${CALC_STATIC_LIBS} \ ${CC} ${LDFLAGS} ${CALCOBJS} ${LD_STATIC} ${CALC_STATIC_LIBS} \
${READLINE_LIB} -o $@ ${READLINE_LIB} ${READLINE_EXTRAS} -o $@
libcustcalc.a: custom/libcustcalc.a libcustcalc.a: custom/libcustcalc.a
${Q} ${RM} -f $@ ${Q} ${RM} -f $@
@@ -3149,11 +3152,11 @@ custom/libcustcalc.a: custom/Makefile
sample_rand-static${EXT}: sample_rand.o ${CALC_STATIC_LIBS} ${MAKE_FILE} sample_rand-static${EXT}: sample_rand.o ${CALC_STATIC_LIBS} ${MAKE_FILE}
${CC} ${LDFLAGS} sample_rand.o ${LD_STATIC} \ ${CC} ${LDFLAGS} sample_rand.o ${LD_STATIC} \
${CALC_STATIC_LIBS} ${READLINE_LIB} -o $@ ${CALC_STATIC_LIBS} ${READLINE_LIB} ${READLINE_EXTRAS} -o $@
sample_many-static${EXT}: sample_many.o ${CALC_STATIC_LIBS} ${MAKE_FILE} sample_many-static${EXT}: sample_many.o ${CALC_STATIC_LIBS} ${MAKE_FILE}
${CC} ${LDFLAGS} sample_many.o ${LD_STATIC} \ ${CC} ${LDFLAGS} sample_many.o ${LD_STATIC} \
${CALC_STATIC_LIBS} ${READLINE_LIB} -o $@ ${CALC_STATIC_LIBS} ${READLINE_LIB} ${READLINE_EXTRAS} -o $@
### ###
# #
@@ -3531,6 +3534,7 @@ env:
@echo 'PURIFY=${PURIFY}'; echo '' @echo 'PURIFY=${PURIFY}'; echo ''
@echo 'Q=${Q}'; echo '' @echo 'Q=${Q}'; echo ''
@echo 'RANLIB=${RANLIB}'; echo '' @echo 'RANLIB=${RANLIB}'; echo ''
@echo 'READLINE_EXTRAS=${READLINE_EXTRAS}'; echo ''
@echo 'READLINE_INCLUDE=${READLINE_INCLUDE}'; echo '' @echo 'READLINE_INCLUDE=${READLINE_INCLUDE}'; echo ''
@echo 'READLINE_LIB=${READLINE_LIB}'; echo '' @echo 'READLINE_LIB=${READLINE_LIB}'; echo ''
@echo 'RM=${RM}'; echo '' @echo 'RM=${RM}'; echo ''

View File

@@ -18,8 +18,8 @@
# received a copy with calc; if not, write to Free Software Foundation, Inc. # received a copy with calc; if not, write to Free Software Foundation, Inc.
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# #
# @(#) $Revision: 30.2 $ # @(#) $Revision: 30.3 $
# @(#) $Id: Makefile,v 30.2 2007/03/22 07:34:47 chongo Exp $ # @(#) $Id: Makefile,v 30.3 2007/09/21 01:27:27 chongo Exp $
# @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/Makefile,v $ # @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/Makefile,v $
# #
# Under source code control: 1991/07/21 05:00:54 # Under source code control: 1991/07/21 05:00:54
@@ -111,9 +111,6 @@ CALC_SHAREDIR= /usr/share/calc
# --------------------------------------------------------------- # ---------------------------------------------------------------
# ${HELPDIR} where the help directory is installed # ${HELPDIR} where the help directory is installed
# ${CALC_INCDIR} where the calc include files are installed # ${CALC_INCDIR} where the calc include files are installed
# ${CUSTOMCALDIR} where custom *.cal files are installed
# ${CUSTOMHELPDIR} where custom help files are installed
# ${CUSTOMINCDIR} where custom .h files are installed
# ${SCRIPTDIR} where calc shell scripts are installed # ${SCRIPTDIR} where calc shell scripts are installed
# #
# NOTE: The install rule prepends installation paths with ${T}, which # NOTE: The install rule prepends installation paths with ${T}, which
@@ -124,16 +121,10 @@ CALC_SHAREDIR= /usr/share/calc
# #
# HELPDIR= ${CALC_SHAREDIR}/help # HELPDIR= ${CALC_SHAREDIR}/help
# CALC_INCDIR= ${INCDIR}/calc # CALC_INCDIR= ${INCDIR}/calc
# CUSTOMCALDIR= ${CALC_SHAREDIR}/custom
# CUSTOMHELPDIR= ${CALC_SHAREDIR}/custhelp
# CUSTOMINCDIR= ${CALC_INCDIR}/custom
# SCRIPTDIR= ${BINDIR}/cscript # SCRIPTDIR= ${BINDIR}/cscript
# #
HELPDIR= ${CALC_SHAREDIR}/help HELPDIR= ${CALC_SHAREDIR}/help
CALC_INCDIR= ${INCDIR}/calc CALC_INCDIR= ${INCDIR}/calc
CUSTOMCALDIR= ${CALC_SHAREDIR}/custom
CUSTOMHELPDIR= ${CALC_SHAREDIR}/custhelp
CUSTOMINCDIR= ${CALC_INCDIR}/custom
SCRIPTDIR= ${BINDIR}/cscript SCRIPTDIR= ${BINDIR}/cscript
# T - top level directory under which calc will be installed # T - top level directory under which calc will be installed

View File

@@ -15,8 +15,8 @@
.\" received a copy with calc; if not, write to Free Software Foundation, Inc. .\" received a copy with calc; if not, write to Free Software Foundation, Inc.
.\" 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. .\" 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
.\" .\"
.\" @(#) $Revision: 30.2 $ .\" @(#) $Revision: 30.3 $
.\" @(#) $Id: calc.man,v 30.2 2007/08/18 17:28:29 chongo Exp $ .\" @(#) $Id: calc.man,v 30.3 2007/09/08 02:53:09 chongo Exp $
.\" @(#) $Source: /usr/local/src/cmd/calc/RCS/calc.man,v $ .\" @(#) $Source: /usr/local/src/cmd/calc/RCS/calc.man,v $
.\" .\"
.\" Under source code control: 1991/07/23 05:48:26 .\" Under source code control: 1991/07/23 05:48:26
@@ -275,18 +275,14 @@ See
.TP .TP
.B \-i .B \-i
Become interactive if possible. Become interactive if possible.
If
.I calc_cmd
args are given,
.B calc
by default, calc will execute them and exit.
This flag causes
.B calc
to drop into interactive mode after the commands are executed.
This flag will cause This flag will cause
.B calc .B calc
to drop into interactive mode after the to drop into interactive mode after the
commands are executed. .I calc_cmd
arguments on the command line are evaluated.
Without this flag,
.B calc
will exit after they are evaluated.
.sp 1 .sp 1
For example: For example:
.sp 1 .sp 1

View File

@@ -18,8 +18,8 @@
# received a copy with calc; if not, write to Free Software Foundation, Inc. # received a copy with calc; if not, write to Free Software Foundation, Inc.
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# #
# @(#) $Revision: 30.5 $ # @(#) $Revision: 30.6 $
# @(#) $Id: calc.spec.in,v 30.5 2007/09/06 06:13:46 chongo Exp $ # @(#) $Id: calc.spec.in,v 30.6 2007/10/16 12:22:22 chongo Exp $
# @(#) $Source: /usr/local/src/cmd/calc/RCS/calc.spec.in,v $ # @(#) $Source: /usr/local/src/cmd/calc/RCS/calc.spec.in,v $
# #
# Under source code control: 2003/02/16 20:21:39 # Under source code control: 2003/02/16 20:21:39
@@ -40,7 +40,7 @@ Version: <<<PROJECT_VERSION>>>
Release: 1.1 Release: 1.1
License: LGPL License: LGPL
Group: Applications/Engineering Group: Applications/Engineering
Source: %{name}-%{version}.tar.gz Source: %{name}-%{version}.tar.bz2
URL: http://www.isthe.com/chongo/tech/comp/calc/index.html URL: http://www.isthe.com/chongo/tech/comp/calc/index.html
Requires: ncurses >= 5.2-26, readline >= 4.2, less >= 358 Requires: ncurses >= 5.2-26, readline >= 4.2, less >= 358
BuildRequires: ncurses-devel >= 5.2-26, readline-devel >= 4.2 BuildRequires: ncurses-devel >= 5.2-26, readline-devel >= 4.2

View File

@@ -19,8 +19,8 @@
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @(#) $Revision: 30.1 $ * @(#) $Revision: 30.2 $
* @(#) $Id: config.h,v 30.1 2007/03/16 11:09:46 chongo Exp $ * @(#) $Id: config.h,v 30.2 2007/09/21 01:27:27 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/config.h,v $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/config.h,v $
* *
* Under source code control: 1995/11/01 22:20:17 * Under source code control: 1995/11/01 22:20:17
@@ -193,7 +193,8 @@ typedef struct config CONFIG;
#define CALCDBG_TTY (0x00000010) /* report TTY state changes */ #define CALCDBG_TTY (0x00000010) /* report TTY state changes */
#define CALCDBG_RUNSTATE (0x00000020) /* report run_state changes */ #define CALCDBG_RUNSTATE (0x00000020) /* report run_state changes */
#define CALCDBG_RAND (0x00000040) /* report rand() activity */ #define CALCDBG_RAND (0x00000040) /* report rand() activity */
#define CALCDBG_MASK (0x0000007f) #define CALCDBG_CUSTOM (0x00000080) /* custom function debug */
#define CALCDBG_MASK (0x000000ff)
/* /*
* ctrl-d meanings * ctrl-d meanings

View File

@@ -17,8 +17,8 @@
# received a copy with calc; if not, write to Free Software Foundation, Inc. # received a copy with calc; if not, write to Free Software Foundation, Inc.
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# #
# @(#) $Revision: 30.2 $ # @(#) $Revision: 30.3 $
# @(#) $Id: Makefile,v 30.2 2007/03/22 07:34:47 chongo Exp $ # @(#) $Id: Makefile,v 30.3 2007/09/21 01:27:27 chongo Exp $
# @(#) $Source: /usr/local/src/cmd/calc/cscript/RCS/Makefile,v $ # @(#) $Source: /usr/local/src/cmd/calc/cscript/RCS/Makefile,v $
# #
# Under source code control: 1999/11/29 11:10:26 # Under source code control: 1999/11/29 11:10:26
@@ -111,9 +111,6 @@ CALC_SHAREDIR= /usr/share/calc
# --------------------------------------------------------------- # ---------------------------------------------------------------
# ${HELPDIR} where the help directory is installed # ${HELPDIR} where the help directory is installed
# ${CALC_INCDIR} where the calc include files are installed # ${CALC_INCDIR} where the calc include files are installed
# ${CUSTOMCALDIR} where custom *.cal files are installed
# ${CUSTOMHELPDIR} where custom help files are installed
# ${CUSTOMINCDIR} where custom .h files are installed
# ${SCRIPTDIR} where calc shell scripts are installed # ${SCRIPTDIR} where calc shell scripts are installed
# #
# NOTE: The install rule prepends installation paths with ${T}, which # NOTE: The install rule prepends installation paths with ${T}, which
@@ -124,16 +121,10 @@ CALC_SHAREDIR= /usr/share/calc
# #
# HELPDIR= ${CALC_SHAREDIR}/help # HELPDIR= ${CALC_SHAREDIR}/help
# CALC_INCDIR= ${INCDIR}/calc # CALC_INCDIR= ${INCDIR}/calc
# CUSTOMCALDIR= ${CALC_SHAREDIR}/custom
# CUSTOMHELPDIR= ${CALC_SHAREDIR}/custhelp
# CUSTOMINCDIR= ${CALC_INCDIR}/custom
# SCRIPTDIR= ${BINDIR}/cscript # SCRIPTDIR= ${BINDIR}/cscript
# #
HELPDIR= ${CALC_SHAREDIR}/help HELPDIR= ${CALC_SHAREDIR}/help
CALC_INCDIR= ${INCDIR}/calc CALC_INCDIR= ${INCDIR}/calc
CUSTOMCALDIR= ${CALC_SHAREDIR}/custom
CUSTOMHELPDIR= ${CALC_SHAREDIR}/custhelp
CUSTOMINCDIR= ${CALC_INCDIR}/custom
SCRIPTDIR= ${BINDIR}/cscript SCRIPTDIR= ${BINDIR}/cscript
# T - top level directory under which calc will be installed # T - top level directory under which calc will be installed

View File

@@ -17,8 +17,8 @@
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @(#) $Revision: 30.1 $ * @(#) $Revision: 30.2 $
* @(#) $Id: custom.c,v 30.1 2007/03/16 11:09:46 chongo Exp $ * @(#) $Id: custom.c,v 30.2 2007/09/21 01:27:27 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/custom.c,v $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/custom.c,v $
* *
* Under source code control: 1997/03/03 04:53:08 * Under source code control: 1997/03/03 04:53:08
@@ -100,6 +100,12 @@ custom(char *name, int count, VALUE **vals)
fprintf(stderr, fprintf(stderr,
"%sCalc was built with custom functions disabled\n", "%sCalc was built with custom functions disabled\n",
(conf->tab_ok ? "\t" : "")); (conf->tab_ok ? "\t" : ""));
if (conf->calc_debug & CALCDBG_CUSTOM) {
fprintf(stderr,
"%scustom function %s with %d args, %s vals not executed\n",
(conf->tab_ok ? "\t" : ""), name, count,
(vals == NULL) ? "NULL" : "non-NULL");
}
return error_value(E_NO_CUSTOM); return error_value(E_NO_CUSTOM);
#endif /* CUSTOM */ #endif /* CUSTOM */
@@ -211,6 +217,11 @@ customhelp(char *name)
fprintf(stderr, fprintf(stderr,
"%sCalc was built with custom functions disabled\n", "%sCalc was built with custom functions disabled\n",
(conf->tab_ok ? "\t" : "")); (conf->tab_ok ? "\t" : ""));
if (conf->calc_debug & CALCDBG_CUSTOM) {
fprintf(stderr, "%scustom help for %s unavailable\n",
(conf->tab_ok ? "\t" : ""),
((name == NULL) ? "((NULL))" : name));
}
#endif /* CUSTOM */ #endif /* CUSTOM */
} }

View File

@@ -363,6 +363,25 @@ Step 5: Write your custom function
very_tiny_variable = z1tol(z_num); very_tiny_variable = z1tol(z_num);
} }
You can (and should) add debugging statements to your custom code
by examining bit 8 of the calc_debug config flag:
if (conf->calc_debug & CALCDBG_CUSTOM) {
fprintf(stderr, "%ssome custom debug note: msg\n",
(conf->tab_ok ? "\t" : ""),
((msg == NULL) ? "((NULL))" : msg));
}
One is able to set bit 8 by way of the calc command line:
calc -D 128
See the calc man page for details. One may also set that bit
while running calc by way of the config() builtin function:
config("calc_debug", 128);
See the help/config file for details on calc_debug.
Step 6: Register the function in the custom interface table Step 6: Register the function in the custom interface table
@@ -642,8 +661,8 @@ Step 12: Contribute
## received a copy with calc; if not, write to Free Software Foundation, Inc. ## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
## ##
## @(#) $Revision: 30.3 $ ## @(#) $Revision: 30.4 $
## @(#) $Id: HOW_TO_ADD,v 30.3 2007/07/13 23:45:54 chongo Exp $ ## @(#) $Id: HOW_TO_ADD,v 30.4 2007/09/21 01:27:27 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/custom/RCS/HOW_TO_ADD,v $ ## @(#) $Source: /usr/local/src/cmd/calc/custom/RCS/HOW_TO_ADD,v $
## ##
## Under source code control: 1997/03/10 03:03:21 ## Under source code control: 1997/03/10 03:03:21

View File

@@ -524,7 +524,11 @@ DEFAULT_LIB_INSTALL_PATH= ${PWD}:/lib:/usr/lib:${LIBDIR}:/usr/local/lib
LD_SHARE= "-Wl,-rpath,${DEFAULT_LIB_INSTALL_PATH}" \ LD_SHARE= "-Wl,-rpath,${DEFAULT_LIB_INSTALL_PATH}" \
"-Wl,-rpath-link,${DEFAULT_LIB_INSTALL_PATH}" "-Wl,-rpath-link,${DEFAULT_LIB_INSTALL_PATH}"
LIBCALC_SHLIB= -shared "-Wl,-soname,libcalc${LIB_EXT_VERSION}" LIBCALC_SHLIB= -shared "-Wl,-soname,libcalc${LIB_EXT_VERSION}"
ifdef ALLOW_CUSTOM
LIBCUSTCALC_SHLIB= -shared "-Wl,-soname,libcustcalc${LIB_EXT_VERSION}" LIBCUSTCALC_SHLIB= -shared "-Wl,-soname,libcustcalc${LIB_EXT_VERSION}"
else
LIBCUSTCALC_SHLIB=
endif
# #
CC_STATIC= CC_STATIC=
LD_STATIC= LD_STATIC=
@@ -553,7 +557,11 @@ CC_SHARE= -fPIC
DEFAULT_LIB_INSTALL_PATH= ${PWD}:${LIBDIR}:/usr/local/lib DEFAULT_LIB_INSTALL_PATH= ${PWD}:${LIBDIR}:/usr/local/lib
LD_SHARE= ${DARWIN_ARCH} LD_SHARE= ${DARWIN_ARCH}
LIBCALC_SHLIB= -single_module -undefined dynamic_lookup -dynamiclib LIBCALC_SHLIB= -single_module -undefined dynamic_lookup -dynamiclib
ifdef ALLOW_CUSTOM
LIBCUSTCALC_SHLIB= -single_module -undefined dynamic_lookup -dynamiclib LIBCUSTCALC_SHLIB= -single_module -undefined dynamic_lookup -dynamiclib
else
LIBCUSTCALC_SHLIB=
endif
# #
CC_STATIC= CC_STATIC=
LD_STATIC= ${DARWIN_ARCH} LD_STATIC= ${DARWIN_ARCH}
@@ -601,7 +609,11 @@ DEFAULT_LIB_INSTALL_PATH= ${PWD}:/lib:/usr/lib:${LIBDIR}:/usr/local/lib
LD_SHARE= "-Wl,-rpath,${DEFAULT_LIB_INSTALL_PATH}" \ LD_SHARE= "-Wl,-rpath,${DEFAULT_LIB_INSTALL_PATH}" \
"-Wl,-rpath-link,${DEFAULT_LIB_INSTALL_PATH}" "-Wl,-rpath-link,${DEFAULT_LIB_INSTALL_PATH}"
LIBCALC_SHLIB= -shared "-Wl,-soname,libcalc${LIB_EXT_VERSION}" LIBCALC_SHLIB= -shared "-Wl,-soname,libcalc${LIB_EXT_VERSION}"
ifdef ALLOW_CUSTOM
LIBCUSTCALC_SHLIB= -shared "-Wl,-soname,libcustcalc${LIB_EXT_VERSION}" LIBCUSTCALC_SHLIB= -shared "-Wl,-soname,libcustcalc${LIB_EXT_VERSION}"
else
LIBCUSTCALC_SHLIB=
endif
# #
CC_STATIC= CC_STATIC=
LD_STATIC= LD_STATIC=
@@ -620,12 +632,12 @@ MAKE= gmake
# #
endif endif
###################### ################
# Sun Solaris target # # SunOS target #
###################### ################
# XXX - this needs to be tested # XXX - this needs to be tested
ifeq ($(target),solaris) ifeq ($(target),SunOS)
# #
BLD_TYPE= calc-dynamic-only BLD_TYPE= calc-dynamic-only
# #
@@ -634,7 +646,11 @@ DEFAULT_LIB_INSTALL_PATH= ${PWD}:/lib:/usr/lib:${LIBDIR}:/usr/local/lib
LD_SHARE= "-Wl,-rpath,${DEFAULT_LIB_INSTALL_PATH}" \ LD_SHARE= "-Wl,-rpath,${DEFAULT_LIB_INSTALL_PATH}" \
"-Wl,-rpath-link,${DEFAULT_LIB_INSTALL_PATH}" "-Wl,-rpath-link,${DEFAULT_LIB_INSTALL_PATH}"
LIBCALC_SHLIB= -shared "-Wl,-soname,libcalc${LIB_EXT_VERSION}" LIBCALC_SHLIB= -shared "-Wl,-soname,libcalc${LIB_EXT_VERSION}"
ifdef ALLOW_CUSTOM
LIBCUSTCALC_SHLIB= -shared "-Wl,-soname,libcustcalc${LIB_EXT_VERSION}" LIBCUSTCALC_SHLIB= -shared "-Wl,-soname,libcustcalc${LIB_EXT_VERSION}"
else
LIBCUSTCALC_SHLIB=
endif
# #
CC_STATIC= CC_STATIC=
LIBCALC_STATIC= LIBCALC_STATIC=
@@ -715,7 +731,11 @@ DEFAULT_LIB_INSTALL_PATH= ${PWD}:/lib:/usr/lib:${LIBDIR}:/usr/local/lib
LD_SHARE= "-Wl,-rpath,${DEFAULT_LIB_INSTALL_PATH}" \ LD_SHARE= "-Wl,-rpath,${DEFAULT_LIB_INSTALL_PATH}" \
"-Wl,-rpath-link,${DEFAULT_LIB_INSTALL_PATH}" "-Wl,-rpath-link,${DEFAULT_LIB_INSTALL_PATH}"
LIBCALC_SHLIB= -shared "-Wl,-soname,libcalc${LIB_EXT_VERSION}" LIBCALC_SHLIB= -shared "-Wl,-soname,libcalc${LIB_EXT_VERSION}"
ifdef ALLOW_CUSTOM
LIBCUSTCALC_SHLIB= -shared "-Wl,-soname,libcustcalc${LIB_EXT_VERSION}" LIBCUSTCALC_SHLIB= -shared "-Wl,-soname,libcustcalc${LIB_EXT_VERSION}"
else
LIBCUSTCALC_SHLIB=
endif
# #
CC_STATIC= CC_STATIC=
LIBCALC_STATIC= LIBCALC_STATIC=
@@ -757,7 +777,6 @@ CFLAGS= ${ICFLAGS} ${CCOPT}
# #
ILDFLAGS= ${COMMON_LDFLAGS} ILDFLAGS= ${COMMON_LDFLAGS}
LDFLAGS= ${LD_DEBUG} ${ILDFLAGS} LDFLAGS= ${LD_DEBUG} ${ILDFLAGS}
#endif /* end of skip for non-Gnu makefiles */ #endif /* end of skip for non-Gnu makefiles */
####################################################################### #######################################################################

View File

@@ -17,8 +17,8 @@
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @(#) $Revision: 30.1 $ * @(#) $Revision: 30.2 $
* @(#) $Id: endian.c,v 30.1 2007/03/16 11:09:46 chongo Exp $ * @(#) $Id: endian.c,v 30.2 2007/09/29 16:56:40 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/endian.c,v $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/endian.c,v $
* *
* Under source code control: 1993/11/15 04:32:58 * Under source code control: 1993/11/15 04:32:58
@@ -53,10 +53,8 @@ char byte[8] = { (char)0x12, (char)0x36, (char)0x48, (char)0x59,
int int
main(void) main(void)
{ {
#if !defined(LITTLE_ENDIAN) && !defined(BIG_ENDIAN)
/* pointers into the byte order array */ /* pointers into the byte order array */
int *intp = (int *)byte; int *intp = (int *)byte;
#endif
#if defined(DEBUG) #if defined(DEBUG)
short *shortp = (short *)byte; short *shortp = (short *)byte;
long *longp = (long *)byte; long *longp = (long *)byte;
@@ -73,13 +71,16 @@ main(void)
#endif #endif
/* Print the standard <machine/endian.h> defines */ /* Print the standard <machine/endian.h> defines */
printf("#undef BIG_ENDIAN\n");
printf("#define BIG_ENDIAN\t4321\n"); printf("#define BIG_ENDIAN\t4321\n");
printf("#undef LITTLE_ENDIAN\n");
printf("#define LITTLE_ENDIAN\t1234\n"); printf("#define LITTLE_ENDIAN\t1234\n");
printf("#undef CALC_BYTE_ORDER\n");
#if defined(LITTLE_ENDIAN) #if defined(CALC_BIG_ENDIAN)
printf("#define CALC_BYTE_ORDER\tLITTLE_ENDIAN\n");
#elif defined(BIG_ENDIAN)
printf("#define CALC_BYTE_ORDER\tBIG_ENDIAN\n"); printf("#define CALC_BYTE_ORDER\tBIG_ENDIAN\n");
#elif defined(CALC_LITTLE_ENDIAN)
printf("#define CALC_BYTE_ORDER\tLITTLW_ENDIAN\n");
#else #else
/* Determine byte order */ /* Determine byte order */
if (intp[0] == 0x12364859) { if (intp[0] == 0x12364859) {
@@ -89,8 +90,11 @@ main(void)
/* Least Significant Byte first */ /* Least Significant Byte first */
printf("#define CALC_BYTE_ORDER\tLITTLE_ENDIAN\n"); printf("#define CALC_BYTE_ORDER\tLITTLE_ENDIAN\n");
} else { } else {
fprintf(stderr, fprintf(stderr, "@=-=@ Fatal build error - cannot @=-=@\n");
"Unknown int Byte Order, set CALC_BYTE_ORDER in Makefile\n"); fprintf(stderr, "@=-=@ determine byte order. Set @=-=@\n");
fprintf(stderr, "@=-=@ ${CALC_BYTE_ORDER} in the Makefile @=-=@\n");
fprintf(stderr, "@=-=@ to be either -DCALC_BIG_ENDIAN or @=-=@\n");
fprintf(stderr, "@=-=@ to be -DCALC_LITTLE_ENDIAN @=-=@\n");
exit(1); exit(1);
} }
#endif #endif

View File

@@ -17,8 +17,8 @@
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @(#) $Revision: 30.1 $ * @(#) $Revision: 30.2 $
* @(#) $Id: fposval.c,v 30.1 2007/03/16 11:09:46 chongo Exp $ * @(#) $Id: fposval.c,v 30.2 2007/09/19 22:34:22 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/fposval.c,v $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/fposval.c,v $
* *
* Under source code control: 1994/11/05 03:19:52 * Under source code control: 1994/11/05 03:19:52
@@ -129,7 +129,7 @@ main(int argc, char **argv)
* systems a FILEPOS is not a scalar hince we must memcpy. * systems a FILEPOS is not a scalar hince we must memcpy.
*/ */
printf("#define SWAP_HALF_IN_FILEPOS(dest, src)\t%s\n", printf("#define SWAP_HALF_IN_FILEPOS(dest, src)\t%s\n",
"memcpy((void *)(dest), (void *)(src), sizeof(FPOS_POS_BITS))"); "memcpy((void *)(dest), (void *)(src), sizeof(FPOS_POS_LEN))");
#endif /* HAVE_FILEPOS_SCALAR */ #endif /* HAVE_FILEPOS_SCALAR */
#endif /* CALC_BYTE_ORDER == BIG_ENDIAN */ #endif /* CALC_BYTE_ORDER == BIG_ENDIAN */
putchar('\n'); putchar('\n');

View File

@@ -17,8 +17,8 @@
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @(#) $Revision: 30.1 $ * @(#) $Revision: 30.2 $
* @(#) $Id: have_fpos_pos.c,v 30.1 2007/03/16 11:09:46 chongo Exp $ * @(#) $Id: have_fpos_pos.c,v 30.2 2007/09/19 22:34:22 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/have_fpos_pos.c,v $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/have_fpos_pos.c,v $
* *
* Under source code control: 2000/12/17 01:23 * Under source code control: 2000/12/17 01:23
@@ -51,17 +51,21 @@ main(void)
printf("#define HAVE_FPOS_POS 1 /* yes */\n\n"); printf("#define HAVE_FPOS_POS 1 /* yes */\n\n");
/* determine __pos element size */ /* determine __pos element size */
printf("#undef FPOS_POS_BITS\t/* no */\n"); printf("#undef FPOS_POS_BITS\n");
printf("#undef FPOS_POS_LEN\n");
# if defined(FPOS_POS_BITS) # if defined(FPOS_POS_BITS)
printf("#define FPOS_POS_BITS %d\n\n", FPOS_POS_BITS); printf("#define FPOS_POS_BITS %d\n", FPOS_POS_BITS);
printf("#define FPOS_POS_LEN %d\n", int(FPOS_POS_BITS/8));
# else # else
printf("#define FPOS_POS_BITS %d\n\n", sizeof(pos.__pos)*8); printf("#define FPOS_POS_BITS %d\n", sizeof(pos.__pos)*8);
printf("#define FPOS_POS_LEN %d\n", sizeof(pos.__pos));
# endif # endif
#else #else
/* we have no __pos element */ /* we have no __pos element */
printf("#undef HAVE_FPOS_POS\t/* no */\n"); printf("#undef HAVE_FPOS_POS\t/* no */\n");
printf("#undef FPOS_POS_BITS\n"); printf("#undef FPOS_POS_BITS\n");
printf("#undef FPOS_POS_LEN\n");
#endif #endif
/* exit(0); */ /* exit(0); */
return 0; return 0;

10
help.c
View File

@@ -17,8 +17,8 @@
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @(#) $Revision: 30.1 $ * @(#) $Revision: 30.2 $
* @(#) $Id: help.c,v 30.1 2007/03/16 11:09:46 chongo Exp $ * @(#) $Id: help.c,v 30.2 2007/09/21 01:27:27 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/help.c,v $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/help.c,v $
* *
* Under source code control: 1997/09/14 10:58:30 * Under source code control: 1997/09/14 10:58:30
@@ -249,11 +249,15 @@ givehelp(char *type)
/* /*
* open the helpfile (looking in HELPDIR first) * open the helpfile (looking in HELPDIR first)
*/ */
#if defined(CUSTOM)
if (sizeof(CUSTOMHELPDIR) > sizeof(HELPDIR)) { if (sizeof(CUSTOMHELPDIR) > sizeof(HELPDIR)) {
helppath = (char *)malloc(sizeof(CUSTOMHELPDIR)+1+strlen(type)); helppath = (char *)malloc(sizeof(CUSTOMHELPDIR)+1+strlen(type));
} else { } else {
helppath = (char *)malloc(sizeof(HELPDIR)+1+strlen(type)); helppath = (char *)malloc(sizeof(HELPDIR)+1+strlen(type));
} }
#else /* CUSTOM */
helppath = (char *)malloc(sizeof(HELPDIR)+1+strlen(type));
#endif /* CUSTOM */
if (helppath == NULL) { if (helppath == NULL) {
fprintf(stderr, "malloc failure in givehelp()\n"); fprintf(stderr, "malloc failure in givehelp()\n");
return; return;
@@ -268,6 +272,7 @@ givehelp(char *type)
page_file(stream); page_file(stream);
(void) fclose(stream); (void) fclose(stream);
#if defined(CUSTOM)
/* /*
* open the the helpfile (looking in CUSTOMHELPDIR last) * open the the helpfile (looking in CUSTOMHELPDIR last)
*/ */
@@ -287,6 +292,7 @@ givehelp(char *type)
page_file(stream); page_file(stream);
(void) fclose(stream); (void) fclose(stream);
} }
#endif /* CUSTOM */
} }
/* /*

View File

@@ -18,8 +18,8 @@
# received a copy with calc; if not, write to Free Software Foundation, Inc. # received a copy with calc; if not, write to Free Software Foundation, Inc.
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# #
# @(#) $Revision: 30.4 $ # @(#) $Revision: 30.5 $
# @(#) $Id: Makefile,v 30.4 2007/09/02 05:49:56 chongo Exp $ # @(#) $Id: Makefile,v 30.5 2007/09/21 01:27:27 chongo Exp $
# @(#) $Source: /usr/local/src/cmd/calc/help/RCS/Makefile,v $ # @(#) $Source: /usr/local/src/cmd/calc/help/RCS/Makefile,v $
# #
# Under source code control: 1991/07/23 06:47:57 # Under source code control: 1991/07/23 06:47:57
@@ -111,9 +111,6 @@ CALC_SHAREDIR= /usr/share/calc
# --------------------------------------------------------------- # ---------------------------------------------------------------
# ${HELPDIR} where the help directory is installed # ${HELPDIR} where the help directory is installed
# ${CALC_INCDIR} where the calc include files are 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 # ${SCRIPTDIR} where calc shell scripts are installed
# #
# NOTE: The install rule prepends installation paths with ${T}, which # NOTE: The install rule prepends installation paths with ${T}, which
@@ -124,16 +121,10 @@ CALC_SHAREDIR= /usr/share/calc
# #
# HELPDIR= ${CALC_SHAREDIR}/help # HELPDIR= ${CALC_SHAREDIR}/help
# CALC_INCDIR= ${INCDIR}/calc # CALC_INCDIR= ${INCDIR}/calc
# CUSTOMCALDIR= ${CALC_SHAREDIR}/custom
# CUSTOMHELPDIR= ${CALC_SHAREDIR}/custhelp
# CUSTOMINCDIR= ${CALC_INCDIR}/custom
# SCRIPTDIR= ${BINDIR}/cscript # SCRIPTDIR= ${BINDIR}/cscript
# #
HELPDIR= ${CALC_SHAREDIR}/help HELPDIR= ${CALC_SHAREDIR}/help
CALC_INCDIR= ${INCDIR}/calc CALC_INCDIR= ${INCDIR}/calc
CUSTOMCALDIR= ${CALC_SHAREDIR}/custom
CUSTOMHELPDIR= ${CALC_SHAREDIR}/custhelp
CUSTOMINCDIR= ${CALC_INCDIR}/custom
SCRIPTDIR= ${BINDIR}/cscript SCRIPTDIR= ${BINDIR}/cscript
# T - top level directory under which calc will be installed # T - top level directory under which calc will be installed

View File

@@ -600,7 +600,9 @@ DESCRIPTION
6 Report on rand() subtractive 100 shuffle generator issues. 6 Report on rand() subtractive 100 shuffle generator issues.
Bits >= 7 are reserved for future use and should not be used at this time. 7 Report on custom function issues.
Bits >= 8 are reserved for future use and should not be used at this time.
By default, "calc_debug" is 0. The initial value may be overridden By default, "calc_debug" is 0. The initial value may be overridden
by the -D command line option. by the -D command line option.
@@ -972,8 +974,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc. ## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
## ##
## @(#) $Revision: 30.2 $ ## @(#) $Revision: 30.3 $
## @(#) $Id: config,v 30.2 2007/07/05 17:37:41 chongo Exp $ ## @(#) $Id: config,v 30.3 2007/09/21 01:27:27 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/config,v $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/config,v $
## ##
## Under source code control: 1991/07/21 04:37:17 ## Under source code control: 1991/07/21 04:37:17

View File

@@ -2,18 +2,21 @@ NAME
rand - subtractive 100 shuffle pseudo-random number generator rand - subtractive 100 shuffle pseudo-random number generator
SYNOPSIS SYNOPSIS
rand([[min, ] max]) rand([[min, ] beyond])
TYPES TYPES
min integer min integer
max integer beyond integer
return integer return integer
DESCRIPTION DESCRIPTION
Generate a pseudo-random number using an subtractive 100 shuffle generator. Generate a pseudo-random number using an subtractive 100 shuffle generator.
We return a pseudo-random number over the half closed interval [min,max). We return a pseudo-random number over the half closed interval:
By default, min is 0 and max is 2^64.
[min,beyond) ((min <= return < beyond))
By default, min is 0 and beyond is 2^64.
The shuffle method is fast and serves as a fairly good standard The shuffle method is fast and serves as a fairly good standard
pseudo-random generator. If you need a fast generator and do not pseudo-random generator. If you need a fast generator and do not
@@ -26,7 +29,7 @@ DESCRIPTION
Other arg forms: Other arg forms:
rand() Same as rand(0, 2^64) rand() Same as rand(0, 2^64)
rand(max) Same as rand(0, max) rand(beyond) Same as rand(0, beyond)
The rand generator generates the highest order bit first. Thus: The rand generator generates the highest order bit first. Thus:
@@ -230,17 +233,17 @@ EXAMPLE
2 658186291252503497642116 1 -324097 2 658186291252503497642116 1 -324097
LIMITS LIMITS
min < max min < beyond
LINK LIBRARY LINK LIBRARY
void zrand(long cnt, ZVALUE *res) void zrand(long cnt, ZVALUE *res)
void zrandrange(ZVALUE low, ZVALUE high, ZVALUE *res) void zrandrange(ZVALUE low, ZVALUE beyond, ZVALUE *res)
long irand(long max) long irand(long beyond)
SEE ALSO SEE ALSO
seed, srand, randbit, isrand, random, srandom, israndom seed, srand, randbit, isrand, random, srandom, israndom
## Copyright (C) 1999 Landon Curt Noll ## Copyright (C) 1999-2007 Landon Curt Noll
## ##
## Calc is open software; you can redistribute it and/or modify it under ## Calc is open software; you can redistribute it and/or modify it under
## the terms of the version 2.1 of the GNU Lesser General Public License ## the terms of the version 2.1 of the GNU Lesser General Public License
@@ -256,8 +259,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc. ## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
## ##
## @(#) $Revision: 30.1 $ ## @(#) $Revision: 30.3 $
## @(#) $Id: rand,v 30.1 2007/03/16 11:10:42 chongo Exp $ ## @(#) $Id: rand,v 30.3 2007/09/21 02:16:29 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/rand,v $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/rand,v $
## ##
## Under source code control: 1996/01/01 02:16:09 ## Under source code control: 1996/01/01 02:16:09

View File

@@ -2,18 +2,21 @@ NAME
random - Blum-Blum-Shub pseudo-random number generator random - Blum-Blum-Shub pseudo-random number generator
SYNOPSIS SYNOPSIS
random([[min, ] max]) random([[min, ] beyond])
TYPES TYPES
min integer min integer
max integer beyond integer
return integer return integer
DESCRIPTION DESCRIPTION
Generate a pseudo-random number using a Blum-Blum-Shub generator. Generate a pseudo-random number using a Blum-Blum-Shub generator.
We return a pseudo-random number over the half closed interval [min,max). We return a pseudo-random number over the half closed interval:
By default, min is 0 and max is 2^64.
[min,beyond) ((min <= return < beyond))
By default, min is 0 and beyond is 2^64.
While the Blum-Blum-Shub generator is not painfully slow, it is not While the Blum-Blum-Shub generator is not painfully slow, it is not
a fast generator. For a faster, but lesser quality generator a fast generator. For a faster, but lesser quality generator
@@ -22,8 +25,8 @@ DESCRIPTION
Other arg forms: Other arg forms:
random() Same as rand(0, 2^64) random() Same as random(0, 2^64)
random(max) Same as rand(0, max) random(beyond) Same as random(0, beyond)
The random generator generates the highest order bit first. Thus: The random generator generates the highest order bit first. Thus:
@@ -146,17 +149,17 @@ EXAMPLE
10 483381144668580304003305 0 -70235 10 483381144668580304003305 0 -70235
LIMITS LIMITS
min < max min < beyond
LINK LIBRARY LINK LIBRARY
void zrandom(long cnt, ZVALUE *res) void zrandom(long cnt, ZVALUE *res)
void zrandomrange(ZVALUE low, ZVALUE high, ZVALUE *res) void zrandomrange(ZVALUE low, ZVALUE beyond, ZVALUE *res)
long irandom(long max) long irandom(long beyond)
SEE ALSO SEE ALSO
seed, srand, randbit, isrand, rand, srandom, israndom seed, srand, randbit, isrand, rand, srandom, israndom
## Copyright (C) 1999 Landon Curt Noll ## Copyright (C) 1999-2007 Landon Curt Noll
## ##
## Calc is open software; you can redistribute it and/or modify it under ## Calc is open software; you can redistribute it and/or modify it under
## the terms of the version 2.1 of the GNU Lesser General Public License ## the terms of the version 2.1 of the GNU Lesser General Public License
@@ -172,8 +175,8 @@ SEE ALSO
## received a copy with calc; if not, write to Free Software Foundation, Inc. ## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
## ##
## @(#) $Revision: 30.1 $ ## @(#) $Revision: 30.3 $
## @(#) $Id: random,v 30.1 2007/03/16 11:10:42 chongo Exp $ ## @(#) $Id: random,v 30.3 2007/09/21 02:16:29 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/random,v $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/random,v $
## ##
## Under source code control: 1997/02/17 01:18:22 ## Under source code control: 1997/02/17 01:18:22

View File

@@ -51,6 +51,12 @@ Very High priority items:
* Consider using GNU autoconf / configure to build calc. * Consider using GNU autoconf / configure to build calc.
* It is overkill to have nearly everything wind up in libcalc.
Form a libcalcmath and a libcalclang so that an application
that just wants to link with the calc math libs can use them
without dragging in all of the other calc language, I/O,
and builtin functions.
* Fix any 'Known bugs' as noted in the BUGS file or as * Fix any 'Known bugs' as noted in the BUGS file or as
displayed by 'calc help bugs'. displayed by 'calc help bugs'.
@@ -102,8 +108,6 @@ Medium priority items:
at by 'fizbin' and the HALF array pointer at by 'data' should be at by 'fizbin' and the HALF array pointer at by 'data' should be
treated as read-only. treated as read-only.
* It is overkill to have nearly everything wind up in libcalc.a.
One should make available a the fundamental math operations One should make available a the fundamental math operations
on ZVALUE, NUMBER and perhaps COMPLEX (without all of the on ZVALUE, NUMBER and perhaps COMPLEX (without all of the
other stuff) in a separate library. other stuff) in a separate library.
@@ -113,7 +117,7 @@ Medium priority items:
* Add a builtin function to access the 64 bit FNV hash which * Add a builtin function to access the 64 bit FNV hash which
is currently being used internally in seed.c. is currently being used internally in seed.c.
## Copyright (C) 1999-2006 Landon Curt Noll ## Copyright (C) 1999-2007 Landon Curt Noll
## ##
## Calc is open software; you can redistribute it and/or modify it under ## Calc is open software; you can redistribute it and/or modify it under
## the terms of the version 2.1 of the GNU Lesser General Public License ## the terms of the version 2.1 of the GNU Lesser General Public License
@@ -129,8 +133,8 @@ Medium priority items:
## received a copy with calc; if not, write to Free Software Foundation, Inc. ## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
## ##
## @(#) $Revision: 30.1 $ ## @(#) $Revision: 30.2 $
## @(#) $Id: todo,v 30.1 2007/03/16 11:10:42 chongo Exp $ ## @(#) $Id: todo,v 30.2 2007/09/08 02:52:42 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/todo,v $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/todo,v $
## ##
## Under source code control: 1999/10/20 07:42:55 ## Under source code control: 1999/10/20 07:42:55

View File

@@ -4,6 +4,10 @@ Unexpected
surprises in calc syntax and usage. Persons familiar with C should surprises in calc syntax and usage. Persons familiar with C should
review this file. review this file.
Persons familiar with shell scripting may want to review this file
as well, particularly notes dealing with command line evaluation
and execution.
The Comma The Comma
========= =========
@@ -75,7 +79,7 @@ Unexpected
(-1) ^ 0.5 == 1i (-1) ^ 0.5 == 1i
because the above expresssion in parsed as: because the above expression in parsed as:
-(1 ^ 0.5) == -1 -(1 ^ 0.5) == -1
@@ -335,7 +339,66 @@ Unexpected
NOTE: See "help statement", "help todo", and "help bugs". NOTE: See "help statement", "help todo", and "help bugs".
## Copyright (C) 1999-2006 Landon Curt Noll Shell evaluation of command line arguments
==========================================
In most interactive shells:
calc 2 * 3
will frequently produce a "Missing operator" error because the '*' is
evaluated as a "shell glob". To avoid this you must quote or escape
argument with characters that your interactive shell interprets.
For example, bash / ksh / sh shell users should use:
calc '2 * 3'
or:
calc 2 \* 3
or some other form of shell meta-character escaping.
Calc reads standard input after processing command line args
============================================================
The shell command:
seq 5 | while read i; do calc "($i+3)^2"; done
FYI: The command "seq 5" will write 1 through 5 on separate
lines on standard output, while read i sets $i to
the value of each line that is read from stdin.
will produce:
16
2
3
4
5
The reason why the last 4 lines of output are 2 through 5 is
that after calc evaluates the first line and prints (1+3)^2
(i.e., 16), calc continues to read stdin and slurps up all
of the remaining data on the pipe.
To avoid this problem, use:
seq 5 | while read i; do calc "($i+3)^2" </dev/null; done
which produces the expected results:
16
25
36
49
64
## Copyright (C) 1999-2007 Landon Curt Noll
## ##
## Calc is open software; you can redistribute it and/or modify it under ## Calc is open software; you can redistribute it and/or modify it under
## the terms of the version 2.1 of the GNU Lesser General Public License ## the terms of the version 2.1 of the GNU Lesser General Public License
@@ -351,8 +414,8 @@ Unexpected
## received a copy with calc; if not, write to Free Software Foundation, Inc. ## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
## ##
## @(#) $Revision: 30.2 $ ## @(#) $Revision: 30.3 $
## @(#) $Id: unexpected,v 30.2 2007/07/11 23:00:39 chongo Exp $ ## @(#) $Id: unexpected,v 30.3 2007/09/08 02:48:45 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/unexpected,v $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/unexpected,v $
## ##
## Under source code control: 1997/03/21 13:15:18 ## Under source code control: 1997/03/21 13:15:18

18
rpm.mk
View File

@@ -19,8 +19,8 @@
# received a copy with calc; if not, write to Free Software Foundation, Inc. # received a copy with calc; if not, write to Free Software Foundation, Inc.
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# #
MAKEFILE_REV= $$Revision: 30.3 $$ MAKEFILE_REV= $$Revision: 30.4 $$
# @(#) $Id: rpm.mk,v 30.3 2007/09/02 09:30:11 chongo Exp $ # @(#) $Id: rpm.mk,v 30.4 2007/10/16 12:22:22 chongo Exp $
# @(#) $Source: /usr/local/src/cmd/calc/RCS/rpm.mk,v $ # @(#) $Source: /usr/local/src/cmd/calc/RCS/rpm.mk,v $
# #
# Under source code control: 2003/02/16 20:21:39 # Under source code control: 2003/02/16 20:21:39
@@ -43,7 +43,7 @@ MD5SUM= md5sum
SHA1SUM= sha1sum SHA1SUM= sha1sum
SED= sed SED= sed
FIND= find FIND= find
GZIP_PROG= gzip BZIP2_PROG= bzip2
TAR= tar TAR= tar
RM= rm RM= rm
LS= ls LS= ls
@@ -61,7 +61,7 @@ PROJECT_VERSION=
PROJECT_RELEASE= PROJECT_RELEASE=
PROJECT= $(PROJECT_NAME)-$(PROJECT_VERSION) PROJECT= $(PROJECT_NAME)-$(PROJECT_VERSION)
SPECFILE= $(PROJECT_NAME).spec SPECFILE= $(PROJECT_NAME).spec
TARBALL= $(PROJECT).${TAR}.gz TARBALL= $(PROJECT).${TAR}.bz2
RPM686= $(PROJECT)-$(PROJECT_RELEASE).${TARCH}.rpm RPM686= $(PROJECT)-$(PROJECT_RELEASE).${TARCH}.rpm
DRPM686= $(PROJECT_NAME)-devel-$(PROJECT_VERSION)-$(PROJECT_RELEASE).${TARCH}.rpm DRPM686= $(PROJECT_NAME)-devel-$(PROJECT_VERSION)-$(PROJECT_RELEASE).${TARCH}.rpm
SRPM= $(PROJECT)-$(PROJECT_RELEASE).src.rpm SRPM= $(PROJECT)-$(PROJECT_RELEASE).src.rpm
@@ -88,7 +88,7 @@ all: calc.spec ver_calc
calc.spec.in`" rpm calc.spec.in`" rpm
${V} echo '=-=-=-=-= rpm.mk end of $@ rule =-=-=-=-=' ${V} echo '=-=-=-=-= rpm.mk end of $@ rule =-=-=-=-='
pkgme: $(PROJECT_NAME)-spec.${TAR}.gz pkgme: $(PROJECT_NAME)-spec.${TAR}.bz2
ver_calc: ver_calc:
${V} echo '=-=-=-=-= rpm.mk start of $@ rule =-=-=-=-=' ${V} echo '=-=-=-=-= rpm.mk start of $@ rule =-=-=-=-='
@@ -112,12 +112,12 @@ calc.spec: calc.spec.in ver_calc
srcpkg: make_rhdir srcpkg: make_rhdir
${V} echo '=-=-=-=-= rpm.mk start of $@ rule =-=-=-=-=' ${V} echo '=-=-=-=-= rpm.mk start of $@ rule =-=-=-=-='
${FIND} . -depth -print | \ ${FIND} . -depth -print | \
${EGREP} -v '/RCS|/CVS|/NOTES|/\.|\.out$$|\.safe$$' | \ ${EGREP} -v '/RCS|/CVS|/NOTES|/\.|\.out$$|\.safe$$\.tar\.bz2$$' | \
${EGREP} -v '/old[._-]|\.old$$|\.tar\.gz$$|/ver_calc$$' | \ ${EGREP} -v '/old[._-]|\.old$$|\.tar\.gz$$|/ver_calc$$' | \
LANG=C ${SORT} | \ LANG=C ${SORT} | \
${CPIO} -dumpv "$(TMPDIR)/$(PROJECT)" ${CPIO} -dumpv "$(TMPDIR)/$(PROJECT)"
(cd "$(TMPDIR)"; ${TAR} cf - "$(PROJECT)") | \ (cd "$(TMPDIR)"; ${TAR} cf - "$(PROJECT)") | \
${GZIP_PROG} -c > "$(RPMDIR)/SOURCES/$(TARBALL)" ${BZIP2_PROG} --best -c -z > "$(RPMDIR)/SOURCES/$(TARBALL)"
${RM} -fr "$(TMPDIR)/$(PROJECT)" ${RM} -fr "$(TMPDIR)/$(PROJECT)"
${V} echo '=-=-=-=-= rpm.mk end of $@ rule =-=-=-=-=' ${V} echo '=-=-=-=-= rpm.mk end of $@ rule =-=-=-=-='
@@ -228,10 +228,10 @@ uninstallrpm:
${RPM_TOOL} -e "$(PROJECT_NAME)" ${RPM_TOOL} -e "$(PROJECT_NAME)"
${V} echo '=-=-=-=-= rpm.mk end of $@ rule =-=-=-=-=' ${V} echo '=-=-=-=-= rpm.mk end of $@ rule =-=-=-=-='
$(PROJECT_NAME)-spec.${TAR}.gz: rpm.mk $(PROJECT_NAME).spec.in $(PROJECT_NAME)-spec.${TAR}.bz2: rpm.mk $(PROJECT_NAME).spec.in
${V} echo '=-=-=-=-= rpm.mk start of $@ rule =-=-=-=-=' ${V} echo '=-=-=-=-= rpm.mk start of $@ rule =-=-=-=-='
${RM} -f "$@" ${RM} -f "$@"
${TAR} cf - "$^" | ${GZIP_PROG} -c > "$@" ${TAR} cf - "$^" | ${BZIP2_PROG} --best -c -z > "$@"
${V} echo '=-=-=-=-= rpm.mk end of $@ rule =-=-=-=-=' ${V} echo '=-=-=-=-= rpm.mk end of $@ rule =-=-=-=-='
#**** #****

View File

@@ -19,8 +19,8 @@
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @(#) $Revision: 30.4 $ * @(#) $Revision: 30.5 $
* @(#) $Id: version.c,v 30.4 2007/09/06 06:14:11 chongo Exp $ * @(#) $Id: version.c,v 30.5 2007/10/16 12:22:22 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/version.c,v $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/version.c,v $
* *
* Under source code control: 1990/05/22 11:00:58 * Under source code control: 1990/05/22 11:00:58
@@ -49,7 +49,7 @@ static char *program;
#define MAJOR_VER 2 /* major library version */ #define MAJOR_VER 2 /* major library version */
#define MINOR_VER 12 /* minor library version */ #define MINOR_VER 12 /* minor library version */
#define MAJOR_PATCH 2 /* major software level under library version */ #define MAJOR_PATCH 2 /* major software level under library version */
#define MINOR_PATCH 1 /* minor software level or 0 if none */ #define MINOR_PATCH 2 /* minor software level or 0 if none */
/* /*

View File

@@ -8,9 +8,8 @@
/* what byte order are we? */ /* what byte order are we? */
#define BIG_ENDIAN 4321 #include <endian.h>
#define LITTLE_ENDIAN 1234 #define CALC_BYTE_ORDER BYTE_ORDER
#define CALC_BYTE_ORDER LITTLE_ENDIAN
#endif /* !__ENDIAN_CALC_H__ */ #endif /* !__ENDIAN_CALC_H__ */

View File

@@ -10,6 +10,7 @@
/* do we have fgetpos & fsetpos functions? */ /* do we have fgetpos & fsetpos functions? */
#undef HAVE_FPOS_POS /* no */ #undef HAVE_FPOS_POS /* no */
#undef FPOS_POS_BITS #undef FPOS_POS_BITS
#undef FPOS_POS_LEN
#endif /* !__HAVE_FPOS_POS_H__ */ #endif /* !__HAVE_FPOS_POS_H__ */

22
zrand.c
View File

@@ -17,8 +17,8 @@
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @(#) $Revision: 30.1 $ * @(#) $Revision: 30.2 $
* @(#) $Id: zrand.c,v 30.1 2007/03/16 11:09:46 chongo Exp $ * @(#) $Id: zrand.c,v 30.2 2007/09/21 01:47:34 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/zrand.c,v $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/zrand.c,v $
* *
* Under source code control: 1995/01/07 09:45:25 * Under source code control: 1995/01/07 09:45:25
@@ -123,7 +123,7 @@
* *
* The s100 generator as the following calc interfaces: * The s100 generator as the following calc interfaces:
* *
* rand(min,max) (where min < max) * rand(min,beyond) (where min < beyond)
* *
* Print an s100 generator random value over interval [a,b). * Print an s100 generator random value over interval [a,b).
* *
@@ -2171,17 +2171,17 @@ zrand(long cnt, ZVALUE *res)
/* /*
* zrandrange - generate an s100 random value in the range [low, high) * zrandrange - generate an s100 random value in the range [low, beyond)
* *
* given: * given:
* low - low value of range * low - low value of range
* high - beyond end of range * beyond - beyond end of range
* res - where to place the random bits as ZVALUE * res - where to place the random bits as ZVALUE
*/ */
void void
zrandrange(CONST ZVALUE low, CONST ZVALUE high, ZVALUE *res) zrandrange(CONST ZVALUE low, CONST ZVALUE beyond, ZVALUE *res)
{ {
ZVALUE range; /* high-low */ ZVALUE range; /* beyond-low */
ZVALUE rval; /* random value [0, 2^bitlen) */ ZVALUE rval; /* random value [0, 2^bitlen) */
ZVALUE rangem1; /* range - 1 */ ZVALUE rangem1; /* range - 1 */
long bitlen; /* smallest power of 2 >= diff */ long bitlen; /* smallest power of 2 >= diff */
@@ -2189,15 +2189,15 @@ zrandrange(CONST ZVALUE low, CONST ZVALUE high, ZVALUE *res)
/* /*
* firewall * firewall
*/ */
if (zrel(low, high) >= 0) { if (zrel(low, beyond) >= 0) {
math_error("srand low range >= high range"); math_error("srand low range >= beyond range");
/*NOTREACHED*/ /*NOTREACHED*/
} }
/* /*
* determine the size of the random number needed * determine the size of the random number needed
*/ */
zsub(high, low, &range); zsub(beyond, low, &range);
if (zisone(range)) { if (zisone(range)) {
zfree(range); zfree(range);
*res = low; *res = low;
@@ -2226,7 +2226,7 @@ zrandrange(CONST ZVALUE low, CONST ZVALUE high, ZVALUE *res)
/* /*
* add in low value to produce the range [0+low, diff+low) * add in low value to produce the range [0+low, diff+low)
* which is the range [low, high) * which is the range [low, beyond)
*/ */
zadd(rval, low, res); zadd(rval, low, res);
zfree(rval); zfree(rval);

View File

@@ -17,8 +17,8 @@
* received a copy with calc; if not, write to Free Software Foundation, Inc. * received a copy with calc; if not, write to Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* @(#) $Revision: 30.1 $ * @(#) $Revision: 30.2 $
* @(#) $Id: zrandom.c,v 30.1 2007/03/16 11:09:46 chongo Exp $ * @(#) $Id: zrandom.c,v 30.2 2007/09/21 01:47:34 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/zrandom.c,v $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/zrandom.c,v $
* *
* Under source code control: 1997/02/15 04:01:56 * Under source code control: 1997/02/15 04:01:56
@@ -133,9 +133,9 @@
* *
* The Blum generator as the following calc interfaces: * The Blum generator as the following calc interfaces:
* *
* random(min, max) (where min < max) * random(min, beyond) (where min < beyond)
* *
* Print a Blum generator random value over interval [min,max). * Print a Blum generator random value over interval [min,beyond).
* *
* random() * random()
* *
@@ -2904,17 +2904,17 @@ zrandom(long cnt, ZVALUE *res)
/* /*
* zrandomrange - generate a Blum-Blum-Shub random value in [low, high) * zrandomrange - generate a Blum-Blum-Shub random value in [low, beyond)
* *
* given: * given:
* low - low value of range * low - low value of range
* high - beyond end of range * beyond - beyond end of range
* res - where to place the random bits as ZVALUE * res - where to place the random bits as ZVALUE
*/ */
void void
zrandomrange(CONST ZVALUE low, CONST ZVALUE high, ZVALUE *res) zrandomrange(CONST ZVALUE low, CONST ZVALUE beyond, ZVALUE *res)
{ {
ZVALUE range; /* high-low */ ZVALUE range; /* beyond-low */
ZVALUE rval; /* random value [0, 2^bitlen) */ ZVALUE rval; /* random value [0, 2^bitlen) */
ZVALUE rangem1; /* range - 1 */ ZVALUE rangem1; /* range - 1 */
long bitlen; /* smallest power of 2 >= diff */ long bitlen; /* smallest power of 2 >= diff */
@@ -2922,15 +2922,15 @@ zrandomrange(CONST ZVALUE low, CONST ZVALUE high, ZVALUE *res)
/* /*
* firewall * firewall
*/ */
if (zrel(low, high) >= 0) { if (zrel(low, beyond) >= 0) {
math_error("srand low range >= high range"); math_error("srand low range >= beyond range");
/*NOTREACHED*/ /*NOTREACHED*/
} }
/* /*
* determine the size of the random number needed * determine the size of the random number needed
*/ */
zsub(high, low, &range); zsub(beyond, low, &range);
if (zisone(range)) { if (zisone(range)) {
zfree_random(range); zfree_random(range);
zcopy(low, res); zcopy(low, res);
@@ -2959,7 +2959,7 @@ zrandomrange(CONST ZVALUE low, CONST ZVALUE high, ZVALUE *res)
/* /*
* add in low value to produce the range [0+low, diff+low) * add in low value to produce the range [0+low, diff+low)
* which is the range [low, high) * which is the range [low, beyond)
*/ */
zadd(rval, low, res); zadd(rval, low, res);
zfree_random(rval); zfree_random(rval);