Compare commits

..

11 Commits

Author SHA1 Message Date
Landon Curt Noll
a1c96f95a6 Release calc version 2.12.4.8 2017-05-21 15:38:56 -07:00
Landon Curt Noll
5e6b3cbd3f Release calc version 2.12.4.7 2017-05-21 15:38:55 -07:00
Landon Curt Noll
5bada5fefd Release calc version 2.12.4.6 2017-05-21 15:38:55 -07:00
Landon Curt Noll
0c20c96a7e Release calc version 2.12.4.4 2017-05-21 15:38:54 -07:00
Landon Curt Noll
e054ea87f2 Release calc version 2.12.4.3 2017-05-21 15:38:54 -07:00
Landon Curt Noll
e229393250 Release calc version 2.12.4.2 2017-05-21 15:38:53 -07:00
Landon Curt Noll
a407c7d197 Release calc version 2.12.3.3 2017-05-21 15:38:53 -07:00
Landon Curt Noll
9ea569152a Release calc version 2.12.3.2 2017-05-21 15:38:52 -07:00
Landon Curt Noll
cbcb5801fb Release calc version 2.12.3.1 2017-05-21 15:38:52 -07:00
Landon Curt Noll
bdf495150e Release calc version 2.12.3.0 2017-05-21 15:38:52 -07:00
Landon Curt Noll
b3648f030f Release calc version 2.12.2.2 2017-05-21 15:38:51 -07:00
549 changed files with 3181 additions and 1177 deletions

2
BUGS
View File

@@ -147,7 +147,7 @@ mis-features in calc:
##
## @(#) $Revision: 30.1 $
## @(#) $Id: BUGS,v 30.1 2007/03/16 11:09:46 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/RCS/BUGS,v $
## @(#) $Source: /usr/local/src/bin/calc/RCS/BUGS,v $
##
## Under source code control: 1994/03/18 14:06:13
## File existed as early as: 1994

207
CHANGES
View File

@@ -1,4 +1,143 @@
The following are the changes from calc version 2.12.1.1 to date:
The following are the changes from calc version 2.12.4.6 to date:
Updated RPM build process to remove use of deprecated flags.
Applied a number of fixes to calc.spec and rpm.mk file.
See calc.spec.in for details. Changed rpm release to 2.1.
Set MACOSX_DEPLOYMENT_TARGET=10.8 as we upgraded all of
our development Mac OS X to 10.8.
Libraries are chmodded as 0644 to allow for building rpms
without root.
Silenced annoying warning about unused variable 'intp'
while compiline endian.c under some circumstances.
The following are the changes from calc version 2.12.4.3 to 2.12.4.5:
Added gvec.cal resource script.
Added calc-symlink make rule to setup symlinks from stardard locations
into a tree specified by a non-empty ${T} makefile variable. Added
calc-unsymlink to remove any symlinks that may have been created by
the calc-symlink rule.
If is OK for the calc-symlink make rule to pre-remove a symlink.
Fixed bug was uncovered in calc that caused script failures when calc
is called within a while loop in BASH if the while loop is fed from
stdin due to calc's redirection/inheritance of stdin and no option
to change this behavior. Thanks gores to David C. Rankin
<drankinatty at gmail dot com> for the bug fix and to David Haller
<dnh at opensuse dot org> for helping debug this problem.
The following are the changes from calc version 2.12.4.0 to 2.12.4.2:
Fixed a documentation bug for the sgn() builtin.
Added the 1<<8/2 evaluation example to "help unexpected". That
expression evalutes to 128, not 16 as some C programmers might expect.
Fixed a bug in solve.cal where high was not returned in some situations.
Fixed a bug reported by Paul & Karen Tomlinson (paulnkaz at pktomlinson
dot fsnet dot co dot uk) where calling log multiple times with different
values of epsilon resulted in an incorrect value.
Removed cvd rule from Makefiles.
The Makefile used in the source rpm (calc-*.src.rpm) no longer uses
the -Werror compile flag. This is to help those distributions with
compilers that make produce (hopefully) complination warnings.
NOTE: For testing and calc build purposes will recommend and will
continue to use the -Werror flag.
Fixed a typo in the Makefile where the make variable ${SAMPLE_OBJ}
was misspelled as ${SAMPLE_OBJS}.
Added prep makefile rule to make is easier to compile calc without
an optimizer. By doing:
make clobber prep
one may build a calc binary that is easier to debug.
Fixed a bug where an certains typos (e.g., calling an unknown
function) would previously cause calc to exit.
Updated the COPYING file to reflect the new filenames associated
with the SHA1 hash function, and removed mention of files related
to the SHA (SHA0, not SHA1) and the MD5 hash functions (which is
no longer supported in calc).
Fixed a bug where a calling vsnprintf() twice created problems.
The thanks for this fix goes to Matthew Miller (mattdm at mattdm
dot org) for this patch.
Michael Penk (mpenk at wuska dot com) reported success in installs
under windoz via Cygwin by making a change to the Cygwin target.
These changes have been folded into the main calc Makefile.
The old recommendation of using 'make win32_hsrc' is no longer
required for Cygwin. See the README.WINDOWS file for details.
Added dms.cal and hms.cal resource files. The dms.cal is a more
functional version of deg.cal. It is a superset except that increment
and decrement is on the arc second level. The hms.cal is for
24-hour cycle instread of the 360 degree cycle of dms.cal.
Changed deg.cal object name from dms to deg so that the more functional
dms.cal can own the dms object name.
Updated 'help obj' to reflect changes to 'show objfunctions' and
resource file example list since 1999.
Fixed problem where CALC_BYTE_ORDER refering to CALC_BIG_ENDIAN
and CALC_LITTLE_ENDIAN instead of BIG_ENDIAN and LITTLE_ENDIAN.
The following are the changes from calc version 2.12.3.0 to 2.12.3.3:
Fixed the Jacobi function where it returned 1 when it should have
returned 0. Thanks goes to Kevin Sopp (baraclese at googlemail dot com)
for discovering the problem and suggesting the nature if the fix.
Calc versions will always be of the form x.y.z.w even when the
MINOR_PATCH (w) is 0. Thus, 2.12.3.0 will be printed as 2.12.3.0
instread of just 2.12.3.
Added MINGW32_NT-5.0 compile target based on a patch from
Brian L. Angus (angus at eng dot utah dot edu).
Removed the use of rpm.release in the Makefile.
Mac OS Darwin targets no longer attempt to use ldconfig. Under the
Darwin target, the LDCONFIG make variable is redefined to be
an empty value. Thanks goes to Ralf Trinler (art at infra dot de)
for reporting this problem.
The ${CALC_INCDIR}/custom is no longer being removed at install time
if it is empty. Now when ${ALLOW_CUSTOM} make variable is empty,
an empty ${CALC_INCDIR}/custom may be left hehind.
Fixed a problem where a "make clobber" would remove custom/Makefile
and fail to rebuilt it.
The following are the changes from calc version 2.12.2.3 to 2.12.2.4:
Added OpenBSD target.
Using the -r test instead of the -e test in Makefiles because some
out of date shells still do not have the -e test.
The Makefile now avoids the use of if ! command because some out of
date shells to not support the ! construct.
The following are the changes from calc version 2.12.1.1 to 2.12.2.2:
Added an explicit Solaris target.
@@ -40,6 +179,66 @@ The following are the changes from calc version 2.12.1.1 to date:
purposes. By default, the calc rpm installed stripped binaries
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:
@@ -6635,9 +6834,9 @@ 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.
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
##
## @(#) $Revision: 30.10 $
## @(#) $Id: CHANGES,v 30.10 2007/09/06 08:10:54 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/RCS/CHANGES,v $
## @(#) $Revision: 30.26 $
## @(#) $Id: CHANGES,v 30.26 2013/05/19 22:10:34 chongo Exp $
## @(#) $Source: /usr/local/src/bin/calc/RCS/CHANGES,v $
##
## Under source code control: 1993/06/02 18:12:57
## File existed as early as: 1989

20
COPYING
View File

@@ -6,15 +6,15 @@ This file is Copyrighted
This file is covered under the following Copyright:
Copyright (C) 1999 Landon Curt Noll
Copyright (C) 1999-2008 Landon Curt Noll
All rights reserved.
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
# @(#) $Revision: 30.1 $
# @(#) $Id: COPYING,v 30.1 2007/03/16 11:09:46 chongo Exp $
# @(#) $Source: /usr/local/src/cmd/calc/RCS/COPYING,v $
# @(#) $Revision: 30.2 $
# @(#) $Id: COPYING,v 30.2 2008/10/24 10:46:52 chongo Exp $
# @(#) $Source: /usr/local/src/bin/calc/RCS/COPYING,v $
=-=
@@ -168,9 +168,8 @@ Calc copyrights and exception files
These files are not covered under one of the Copyrights listed above:
shs1.c shs1.h shs.c shs.h
md5.c md5.h COPYING COPYING-LGPL
cal/qtime.cal cal/screen.cal
sha1.c sha1.h COPYING
COPYING-LGPL cal/qtime.cal cal/screen.cal
The file COPYING-LGPL, which contains a copy of the version 2.1
GNU Lesser General Public License, is itself Copyrighted by the
@@ -182,11 +181,8 @@ Calc copyrights and exception files
top of this file. It is important to note that you may distribute
verbatim copies of this file but you may not modify this file.
Some of these exception files are in the public domain. The md5.c
and md5.h files were "derived from the RSA Data Security, Inc. MD5
Message-Digest Algorithm" and are under a copyright that allows these
two files to be freely used and distributed. Other files are under
the LGPL but have different authors that those listed above.
Some of these exception files are in the public domain. Other files
are under the LGPL but have different authors that those listed above.
In all cases one may use and distribute these exception files freely.
And because one may freely distribute the LGPL covered files, the

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:
@@ -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:
gunzip -c calc-*.tar.gz | tar -xvf -
bunzip2 -c calc-*.tar.bz2 | tar -xvf -
or from:
rpm -ivh calc-*.src.rpm
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.
@@ -204,9 +204,9 @@ the calc help subsystem. See the README file for details.
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
##
## @(#) $Revision: 30.5 $
## @(#) $Id: HOWTO.INSTALL,v 30.5 2007/09/01 19:54:03 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/RCS/HOWTO.INSTALL,v $
## @(#) $Revision: 30.6 $
## @(#) $Id: HOWTO.INSTALL,v 30.6 2007/10/16 12:22:22 chongo Exp $
## @(#) $Source: /usr/local/src/bin/calc/RCS/HOWTO.INSTALL,v $
##
## Under source code control: 1999/09/27 20:48:44
## File existed as early as: 1999

View File

@@ -640,7 +640,7 @@ need call libcalc_call_me_last() only once.
##
## @(#) $Revision: 30.1 $
## @(#) $Id: LIBRARY,v 30.1 2007/03/16 11:09:46 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/RCS/LIBRARY,v $
## @(#) $Source: /usr/local/src/bin/calc/RCS/LIBRARY,v $
##
## Under source code control: 1993/07/30 19:44:49
## File existed as early as: 1993

506
Makefile
View File

@@ -11,7 +11,7 @@
# (Generic calc makefile)
#
# 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
# or less. It compiles with gcc -O3 -g3 as well. You can change all
# this by modifying the Makefile variables below.
@@ -20,9 +20,10 @@
# has the GNU readline headers and libaraies:
#
# 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-2008 Landon Curt Noll
#
# Calc is open software; you can redistribute it and/or modify it under
# the terms of the version 2.1 of the GNU Lesser General Public License
@@ -38,9 +39,9 @@
# received a copy with calc; if not, write to Free Software Foundation, Inc.
# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
#
MAKEFILE_REV= $$Revision: 30.21 $$
# @(#) $Id: Makefile.ship,v 30.21 2007/09/06 08:08:39 chongo Exp $
# @(#) $Source: /usr/local/src/cmd/calc/RCS/Makefile.ship,v $
MAKEFILE_REV= $$Revision: 30.51 $$
# @(#) $Id: Makefile.ship,v 30.51 2013/05/05 13:52:39 chongo Exp $
# @(#) $Source: /usr/local/src/bin/calc/RCS/Makefile.ship,v $
#
# Under source code control: 1990/02/15 01:48:41
# File existed as early as: before 1990
@@ -120,19 +121,19 @@ HAVE_VSPRINTF=
# Big Endian: Amdahl, 68k, Pyramid, Mips, Sparc, ...
# Little Endian: Vax, 32k, Spim (Dec Mips), i386, i486, ...
#
# If in doubt, leave BYTE_ORDER empty. This Makefile will attempt to
# If in doubt, leave CALC_BYTE_ORDER empty. This Makefile will attempt to
# use BYTE_ORDER in <machine/endian.h> or it will attempt to run
# the endian program. If you get syntax errors when you compile,
# try forcing the value to be -DBIG_ENDIAN and run the calc regression
# 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.
#
# Select BYTE_ORDER= -DLITTLE_ENDIAN for DJGPP.
# Select CALC_BYTE_ORDER= -DCALC_LITTLE_ENDIAN for DJGPP.
#
BYTE_ORDER=
#BYTE_ORDER= -DBIG_ENDIAN
#BYTE_ORDER= -DLITTLE_ENDIAN
CALC_BYTE_ORDER=
#CALC_BYTE_ORDER= -DBIG_ENDIAN
#CALC_BYTE_ORDER= -DLITTLE_ENDIAN
# Determine the number of bits in a long
#
@@ -597,6 +598,18 @@ INCDIR= /usr/include
# by default is empty. If ${T} is non-empty, then installation
# locations will be relative to the ${T} directory.
#
# NOTE: If you change LIBDIR to a non-standard location, you will need
# to make changes to your execution environment so that executables
# will search LIBDIR when they are resolving dynamic shared libraries.
#
# On OS X, this means you need to export $DYLD_LIBRARY_PATH
# to include the LIBDIR path in the value.
#
# On Linux and BSD, this means you need to export $LD_LIBRARY_PATH
# to include the LIBDIR path in the value.
#
# You might be better off not changing LIBDIR in the first place.
#
# For DJGPP, select:
#
# BINDIR= /dev/env/DJDIR/bin
@@ -767,13 +780,33 @@ MANMAKE= /usr/local/bin/manmake
MANMODE= 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
# path will be search for calc resource file routines.
#
# 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}
#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
# path will be search for calc resource files.
@@ -793,6 +826,8 @@ CALCRC= ${CALC_SHAREDIR}/startup:~/.calcrc:./.calcinit
#
# READLINE_LIB The flags needed to link in the readline
# 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
# (leave blank if they are /usr/include/readline)
#
@@ -806,14 +841,22 @@ USE_READLINE=
#USE_READLINE= -DUSE_READLINE
#
READLINE_LIB=
#READLINE_LIB= -lreadline -lhistory -lncurses
#READLINE_LIB= -L/usr/gnu/lib -lreadline -lhistory -lncurses
#READLINE_LIB= -L/usr/local/lib -lreadline -lhistory -lncurses
READLINE_EXTRAS=
#
#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
# 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= -I/usr/gnu/include
@@ -923,18 +966,6 @@ CALC_ENV= CALCPATH=./cal LD_LIBRARY_PATH=.
# MALLOC_FASTCHK=1 MALLOC_FULLWARN=1 MALLOC_CLEAR_FREE=1 \
# 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:
#
@@ -952,11 +983,12 @@ MKDIR_ARG= -p
# Some out of date operating systems require / want an executable to
# end with a certain file extension. Some compile systems such as
# Cygwin build calc as calc.exe. The EXT variable is used to denote
# the extension required by such.
# windoz build calc as calc.exe. The EXT variable is used to denote
# the extension required by such. Note that Cygwin requires EXT to be
# the same as Linux/Un*x/GNU, even though it runs under windoz.
#
# EXT= # normal Un*x / Linux / GNU/Linux systems
# EXT=.exe # windoz / Cygwin
# EXT= # normal Un*x / Linux / GNU/Linux / Cygwin
# EXT=.exe # windoz
#
# If in doubt, use EXT=
#
@@ -965,8 +997,8 @@ EXT=
# The default calc versions
#
VERSION= 2.12.2.1
VERS= 2.12.2
VERSION= 2.12.4.8
VERS= 2.12.4
VER= 2.12
VE= 2
@@ -1036,7 +1068,15 @@ EXTRA_LDFLAGS=
# COMMON_CFLAGS are the common ${CC} flags used for all progs, both
# 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}
#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
# intermediate and final calc and calc related progs
@@ -1108,7 +1148,11 @@ DEFAULT_LIB_INSTALL_PATH= ${PWD}:/lib:/usr/lib:${LIBDIR}:/usr/local/lib
LD_SHARE= "-Wl,-rpath,${DEFAULT_LIB_INSTALL_PATH}" \
"-Wl,-rpath-link,${DEFAULT_LIB_INSTALL_PATH}"
LIBCALC_SHLIB= -shared "-Wl,-soname,libcalc${LIB_EXT_VERSION}"
ifdef ALLOW_CUSTOM
LIBCUSTCALC_SHLIB= -shared "-Wl,-soname,libcustcalc${LIB_EXT_VERSION}"
else
LIBCUSTCALC_SHLIB=
endif
#
CC_STATIC=
LD_STATIC=
@@ -1137,7 +1181,11 @@ CC_SHARE= -fPIC
DEFAULT_LIB_INSTALL_PATH= ${PWD}:${LIBDIR}:/usr/local/lib
LD_SHARE= ${DARWIN_ARCH}
LIBCALC_SHLIB= -single_module -undefined dynamic_lookup -dynamiclib
ifdef ALLOW_CUSTOM
LIBCUSTCALC_SHLIB= -single_module -undefined dynamic_lookup -dynamiclib
else
LIBCUSTCALC_SHLIB=
endif
#
CC_STATIC=
LD_STATIC= ${DARWIN_ARCH}
@@ -1158,11 +1206,13 @@ LIB_EXT_VERSION:= .${VERSION}${LIB_EXT}
LIB_EXT_VERS:= .${VERS}${LIB_EXT}
LIB_EXT_VER:= .${VER}${LIB_EXT}
LIB_EXT_VE:= .${VE}${LIB_EXT}
# LDCONFIG not required on this platform, so we redefine it to an empty string
LDCONFIG:=
# DARWIN_ARCH= -arch i386 -arch ppc # Universal binary
# DARWIN_ARCH= -arch i386 # Intel binary
# DARWIN_ARCH= -arch ppc # PPC binary
DARWIN_ARCH= # native binary
MACOSX_DEPLOYMENT_TARGET=10.4
MACOSX_DEPLOYMENT_TARGET=10.8
#
endif
@@ -1185,7 +1235,11 @@ DEFAULT_LIB_INSTALL_PATH= ${PWD}:/lib:/usr/lib:${LIBDIR}:/usr/local/lib
LD_SHARE= "-Wl,-rpath,${DEFAULT_LIB_INSTALL_PATH}" \
"-Wl,-rpath-link,${DEFAULT_LIB_INSTALL_PATH}"
LIBCALC_SHLIB= -shared "-Wl,-soname,libcalc${LIB_EXT_VERSION}"
ifdef ALLOW_CUSTOM
LIBCUSTCALC_SHLIB= -shared "-Wl,-soname,libcustcalc${LIB_EXT_VERSION}"
else
LIBCUSTCALC_SHLIB=
endif
#
CC_STATIC=
LD_STATIC=
@@ -1204,12 +1258,17 @@ MAKE= gmake
#
endif
######################
# Sun Solaris target #
######################
##################
# OpenBSD target #
##################
# XXX - this needs to be tested
ifeq ($(target),solaris)
########################################################################
# NOTE: You MUST either use gmake (GNU Make) or you must try your luck #
# with Makefile.simple and custom/Makefile.simple versions. #
# See HOWTO.INSTALL for more information. #
########################################################################
ifeq ($(target),OpenBSD)
#
BLD_TYPE= calc-dynamic-only
#
@@ -1218,7 +1277,82 @@ DEFAULT_LIB_INSTALL_PATH= ${PWD}:/lib:/usr/lib:${LIBDIR}:/usr/local/lib
LD_SHARE= "-Wl,-rpath,${DEFAULT_LIB_INSTALL_PATH}" \
"-Wl,-rpath-link,${DEFAULT_LIB_INSTALL_PATH}"
LIBCALC_SHLIB= -shared "-Wl,-soname,libcalc${LIB_EXT_VERSION}"
ifdef ALLOW_CUSTOM
LIBCUSTCALC_SHLIB= -shared "-Wl,-soname,libcustcalc${LIB_EXT_VERSION}"
else
LIBCUSTCALC_SHLIB=
endif
#
CC_STATIC=
LD_STATIC=
LIBCALC_STATIC=
LIBCUSTCALC_STATIC=
#
CCWARN= -Wall
CCWERR=
CCOPT= ${DEBUG}
CCMISC=
#
LCC= gcc
CC= ${PURIFY} ${LCC} ${CCWERR}
#
MAKE= gmake
#
endif
################
# SunOS target #
################
# XXX - this needs to be tested
ifeq ($(target),SunOS)
#
BLD_TYPE= calc-dynamic-only
#
CC_SHARE= -fPIC
DEFAULT_LIB_INSTALL_PATH= ${PWD}:/lib:/usr/lib:${LIBDIR}:/usr/local/lib
LD_SHARE= "-Wl,-rpath,${DEFAULT_LIB_INSTALL_PATH}" \
"-Wl,-rpath-link,${DEFAULT_LIB_INSTALL_PATH}"
LIBCALC_SHLIB= -shared "-Wl,-soname,libcalc${LIB_EXT_VERSION}"
ifdef ALLOW_CUSTOM
LIBCUSTCALC_SHLIB= -shared "-Wl,-soname,libcustcalc${LIB_EXT_VERSION}"
else
LIBCUSTCALC_SHLIB=
endif
#
CC_STATIC=
LIBCALC_STATIC=
LIBCUSTCALC_STATIC=
LD_STATIC=
#
CCWARN= -Wall -W -Wno-comment
CCWERR=
CCOPT= ${DEBUG}
CCMISC=
#
LCC= gcc
CC= ${PURIFY} ${LCC} ${CCWERR}
#
endif
#################
# Cygwin target #
#################
ifeq ($(target),Cygwin)
#
BLD_TYPE= calc-static-only
#
CC_SHARE= -fPIC
DEFAULT_LIB_INSTALL_PATH= ${PWD}:/lib:/usr/lib:${LIBDIR}:/usr/local/lib
LD_SHARE= "-Wl,-rpath,${DEFAULT_LIB_INSTALL_PATH}" \
"-Wl,-rpath-link,${DEFAULT_LIB_INSTALL_PATH}"
LIBCALC_SHLIB= -shared "-Wl,-soname,libcalc${LIB_EXT_VERSION}"
ifdef ALLOW_CUSTOM
LIBCUSTCALC_SHLIB= -shared "-Wl,-soname,libcustcalc${LIB_EXT_VERSION}"
else
LIBCUSTCALC_SHLIB=
endif
#
CC_STATIC=
LIBCALC_STATIC=
@@ -1283,6 +1417,52 @@ LDFLAGS= ${LD_DEBUG} ${ILDFLAGS} ${LIBCALC_STATIC} ${LIBCUSTCALC_STATIC}
#if 0 /* start of skip for non-Gnu makefiles */
endif
###################################################
# MINGW32_NT-5.0 target #
###################################################
ifeq ($(target),MINGW32_NT-5.0)
EXT=.exe
TERMCONTROL= -DUSE_WIN32
ifdef ALLOW_CUSTOM
#endif /* end of skip for non-Gnu makefiles */
CALCPATH= .;./cal;~/.cal;${CALC_SHAREDIR};${CUSTOMCALDIR}
#if 0 /* start of skip for non-Gnu makefiles */
else
CALCPATH= .;./cal;~/.cal;${CALC_SHAREDIR}
endif
CALCRC= ${CALC_SHAREDIR}/startup;~/.calcrc;./.calcinit
#
BLD_TYPE= calc-static-only
#
CC_SHARE= -fPIC
DEFAULT_LIB_INSTALL_PATH= ${PWD}:/lib:/usr/lib:${LIBDIR}:/usr/local/lib
LD_SHARE= "-Wl,-rpath,${DEFAULT_LIB_INSTALL_PATH}" \
"-Wl,-rpath-link,${DEFAULT_LIB_INSTALL_PATH}"
LIBCALC_SHLIB= -shared "-Wl,-soname,libcalc${LIB_EXT_VERSION}"
ifdef ALLOW_CUSTOM
LIBCUSTCALC_SHLIB= -shared "-Wl,-soname,libcustcalc${LIB_EXT_VERSION}"
else
LIBCUSTCALC_SHLIB=
endif
#
CC_STATIC= -DSTATIC_ONLY
LIBCALC_STATIC=
LIBCUSTCALC_STATIC=
LD_STATIC=
#
CCWARN= -Wall -W -Wno-comment
CCWERR=
CCOPT= ${DEBUG}
CCMISC= -DNOTCYGWIN
#
LCC= gcc
CC= ${PURIFY} ${LCC} ${CCWERR}
#
endif
###################################################
# default target - when no specific target exists #
###################################################
@@ -1299,7 +1479,11 @@ DEFAULT_LIB_INSTALL_PATH= ${PWD}:/lib:/usr/lib:${LIBDIR}:/usr/local/lib
LD_SHARE= "-Wl,-rpath,${DEFAULT_LIB_INSTALL_PATH}" \
"-Wl,-rpath-link,${DEFAULT_LIB_INSTALL_PATH}"
LIBCALC_SHLIB= -shared "-Wl,-soname,libcalc${LIB_EXT_VERSION}"
ifdef ALLOW_CUSTOM
LIBCUSTCALC_SHLIB= -shared "-Wl,-soname,libcustcalc${LIB_EXT_VERSION}"
else
LIBCUSTCALC_SHLIB=
endif
#
CC_STATIC=
LIBCALC_STATIC=
@@ -1341,7 +1525,6 @@ CFLAGS= ${ICFLAGS} ${CCOPT}
#
ILDFLAGS= ${COMMON_LDFLAGS}
LDFLAGS= ${LD_DEBUG} ${ILDFLAGS}
#endif /* end of skip for non-Gnu makefiles */
#######################################################################
@@ -1462,7 +1645,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 \
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
#
UTIL_PROGS= align32${EXT} fposval${EXT} have_uid_t${EXT} have_const${EXT} \
@@ -1572,9 +1755,6 @@ HELP_PASSDOWN= \
COMMON_CFLAGS="${COMMON_CFLAGS}" \
COMMON_LDFLAGS="${COMMON_LDFLAGS}" \
CP=${CP} \
CUSTOMCALDIR="${CUSTOMCALDIR}" \
CUSTOMHELPDIR="${CUSTOMHELPDIR}" \
CUSTOMINCDIR="${CUSTOMINCDIR}" \
EXT=${EXT} \
FMT=${FMT} \
HELPDIR="${HELPDIR}" \
@@ -1609,9 +1789,6 @@ CAL_PASSDOWN= \
CMP=${CMP} \
CO=${CO} \
CP=${CP} \
CUSTOMCALDIR="${CUSTOMCALDIR}" \
CUSTOMHELPDIR="${CUSTOMHELPDIR}" \
CUSTOMINCDIR="${CUSTOMINCDIR}" \
HELPDIR="${HELPDIR}" \
INCDIR="${INCDIR}" \
LANG=${LANG} \
@@ -1640,9 +1817,6 @@ CSCRIPT_PASSDOWN= \
CMP=${CMP} \
CO=${CO} \
CP=${CP} \
CUSTOMCALDIR="${CUSTOMCALDIR}" \
CUSTOMHELPDIR="${CUSTOMHELPDIR}" \
CUSTOMINCDIR="${CUSTOMINCDIR}" \
FMT=${FMT} \
HELPDIR="${HELPDIR}" \
INCDIR="${INCDIR}" \
@@ -1687,22 +1861,47 @@ CALCLIBLIST= ${LIBSRC} ${UTIL_C_SRC} ${LIB_H_SRC} ${MAKE_FILE} \
# complete list of .o files
#
OBJS= ${LIBOBJS} ${CALCOBJS} ${UTIL_OBJS} ${SAMPLE_OBJS}
OBJS= ${LIBOBJS} ${CALCOBJS} ${UTIL_OBJS} ${SAMPLE_OBJ}
# 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
#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
#
#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}
#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
#
#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} \
libcalc${LIB_EXT_VERS} libcustcalc${LIB_EXT_VERSION} \
libcustcalc${LIB_EXT_VERS} libcustcalc${LIB_EXT_VER} \
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
#
@@ -1733,7 +1932,15 @@ STATIC_FIRST_TARGETS= ${LICENSE} .static
# 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
#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
#
@@ -1753,6 +1960,9 @@ TARGETS= ${EARLY_TARGETS} ${BLD_TYPE} ${LATE_TARGETS}
all: ${BLD_TYPE} CHANGES
prep:
${Q} ${MAKE} -f ${MAKE_FILE} all DEBUG='-g3'
calc-dynamic-only: ${DYNAMIC_FIRST_TARGETS} ${EARLY_TARGETS} \
${CALC_DYNAMIC_LIBS} ${SYM_DYNAMIC_LIBS} calc${EXT} \
${SAMPLE_TARGETS} ${LATE_TARGETS}
@@ -1777,7 +1987,7 @@ calc-dynamic-only: ${DYNAMIC_FIRST_TARGETS} ${EARLY_TARGETS} \
${Q} for i in .static calc-static${EXT} ${SAMPLE_STATIC_TARGETS} \
libcalc.a custom/libcustcalc.a; do \
r="calc-dynamic-only"; \
if [ -e "$$i" ]; then \
if [ -r "$$i" ]; then \
echo "Found the static target $$i file. You must:" 1>&2; \
echo "" 1>&2; \
echo " ${MAKE} -f ${MAKE_FILE} clobber" 1>&2; \
@@ -1795,7 +2005,9 @@ calc-static-only: ${STATIC_FIRST_TARGETS} ${EARLY_TARGETS} \
${CALC_STATIC_LIBS} calc-static${EXT} \
${SAMPLE_STATIC_TARGETS} ${LATE_TARGETS}
${Q} for i in calc${EXT} ${SAMPLE_TARGETS}; do \
if ! ${CMP} -s "$$i-static" "$$i"; then \
if ${CMP} -s "$$i-static" "$$i"; then \
${TRUE}; \
else \
${RM} -f "$$i"; \
${LN} "$$i-static" "$$i"; \
fi; \
@@ -1821,7 +2033,7 @@ calc-static-only: ${STATIC_FIRST_TARGETS} ${EARLY_TARGETS} \
${Q} for i in .dynamic ${CALC_DYNAMIC_LIBS} ${SYM_DYNAMIC_LIBS} \
custom/libcustcalc${LIB_EXT_VERSION}; do \
r="calc-static-only"; \
if [ -e "$$i" ]; then \
if [ -r "$$i" ]; then \
echo "Found the dynamic target $$i file. You must:" 1>&2; \
echo "" 1>&2; \
echo " ${MAKE} -f ${MAKE_FILE} clobber" 1>&2; \
@@ -1838,10 +2050,11 @@ calc-static-only: ${STATIC_FIRST_TARGETS} ${EARLY_TARGETS} \
calc${EXT}: .hsrc ${CALCOBJS} ${CALC_DYNAMIC_LIBS} ${MAKE_FILE}
${RM} -f $@
${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}
${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}
${Q} ${RM} -f $@
@@ -1900,11 +2113,11 @@ sample: ${SAMPLE_TARGETS}
sample_rand${EXT}: sample_rand.o ${CALC_DYNAMIC_LIBS} ${MAKE_FILE}
${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}
${CC} sample_many.o ${CLDFALGS} ${LD_SHARE} ${CALC_DYNAMIC_LIBS} \
${READLINE_LIB} -o $@
${READLINE_LIB} ${READLINE_EXTRAS} -o $@
###
#
@@ -1968,11 +2181,17 @@ conf.h: ${MAKE_FILE}
${Q} echo '#define HELPDIR "${HELPDIR}"' >> conf.h
${Q} echo '#endif /* HELPDIR */' >> 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 '#if !defined(CUSTOMHELPDIR)' >> conf.h
${Q} echo '#define CUSTOMHELPDIR "${CUSTOMHELPDIR}"' >> conf.h
${Q} echo '#endif /* CUSTOMHELPDIR */' >> 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 '#if !defined(DEFAULTCALCPAGER)' >> conf.h
${Q} echo '#define DEFAULTCALCPAGER "${CALCPAGER}"' >> conf.h
@@ -2004,7 +2223,7 @@ endian_calc.h: endian${EXT} ${MAKE_FILE}
${Q} echo '' >> endian_calc.h
${Q} echo '' >> 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 \
echo '#include <endian.h>' >> endian_calc.h; \
echo '#define CALC_BYTE_ORDER BYTE_ORDER' >> endian_calc.h; \
@@ -2950,7 +3169,7 @@ have_urandom.h: ${MAKE_FILE}
echo '#define HAVE_URANDOM_H /* yes */' >> have_urandom.h; \
elif [ X"${HAVE_URANDOM_H}" = X"NO" ]; then \
echo '#undef HAVE_URANDOM_H /* no */' >> have_urandom.h; \
elif [ -e /dev/urandom ] 2>/dev/null; then \
elif [ -r /dev/urandom ] 2>/dev/null; then \
echo '#define HAVE_URANDOM_H /* yes */' >> have_urandom.h; \
else \
echo '#undef HAVE_URANDOM_H /* no */' >> have_urandom.h; \
@@ -3260,7 +3479,7 @@ win32_hsrc: win32.mkdef ${MAKE_FILE}
###
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
${RM} -f $@
@@ -3315,6 +3534,9 @@ ${CSCRIPT_TARGETS}: cscript/Makefile
${V} echo '=-=-=-=-= Back to the main Makefile for $@ 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
${V} echo '=-=-=-=-= ${MAKE_FILE} start of $@ rule =-=-=-=-='
${V} echo '=-=-=-=-= Invoking all rule for custom =-=-=-=-='
@@ -3349,6 +3571,9 @@ libcustcalc${LIB_EXT_VE}: libcustcalc${LIB_EXT_VERSION}
libcustcalc${LIB_EXT}: libcustcalc${LIB_EXT_VERSION}
${Q} ${RM} -f $@
${LN} -s $? $@
#if 0 /* start of skip for non-Gnu makefiles */
endif
#endif /* end of skip for non-Gnu makefiles */
###
#
@@ -3360,7 +3585,7 @@ calc-static${EXT}: .hsrc ${CALCOBJS} \
${CALC_STATIC_LIBS} ${MAKE_FILE}
${RM} -f $@
${CC} ${LDFLAGS} ${CALCOBJS} ${LD_STATIC} ${CALC_STATIC_LIBS} \
${READLINE_LIB} -o $@
${READLINE_LIB} ${READLINE_EXTRAS} -o $@
libcustcalc.a: custom/libcustcalc.a
${Q} ${RM} -f $@
@@ -3372,16 +3597,22 @@ libcalc.a: ${LIBOBJS} ${MAKE_FILE}
${RANLIB} 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
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}
${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}
${CC} ${LDFLAGS} sample_many.o ${LD_STATIC} \
${CALC_STATIC_LIBS} ${READLINE_LIB} -o $@
${CALC_STATIC_LIBS} ${READLINE_LIB} ${READLINE_EXTRAS} -o $@
###
#
@@ -3785,6 +4016,7 @@ env:
@echo 'PURIFY=${PURIFY}'; echo ''
@echo 'Q=${Q}'; echo ''
@echo 'RANLIB=${RANLIB}'; echo ''
@echo 'READLINE_EXTRAS=${READLINE_EXTRAS}'; echo ''
@echo 'READLINE_INCLUDE=${READLINE_INCLUDE}'; echo ''
@echo 'READLINE_LIB=${READLINE_LIB}'; echo ''
@echo 'RM=${RM}'; echo ''
@@ -3822,12 +4054,11 @@ env:
@echo 'target=${target}'; echo ''
@echo '=-=-=-=-= ${MAKE_FILE} end of major make variable dump =-=-=-=-='
mkdebug: env version.c rpm.release
mkdebug: env version.c
@echo '=-=-=-=-= ${MAKE_FILE} start of $@ rule =-=-=-=-='
@echo '=-=-=-=-= Determining the source version =-=-=-=-='
@${MAKE} -f Makefile Q= V=@ ver_calc${EXT}
-@./ver_calc${EXT}
-@./ver_calc${EXT} -r rpm.release
@echo '=-=-=-=-= Invoking ${MAKE} -f Makefile Q= V=@ all =-=-=-=-='
@${MAKE} -f Makefile Q= V=@ all
@echo '=-=-=-=-= Back to the main Makefile for $@ rule =-=-=-=-='
@@ -3836,7 +4067,7 @@ mkdebug: env version.c rpm.release
@echo '=-=-=-=-= Back to the main Makefile for $@ rule =-=-=-=-='
@echo '=-=-=-=-= ${MAKE_FILE} end of $@ rule =-=-=-=-='
debug: env rpm.release
debug: env
@echo '=-=-=-=-= ${MAKE_FILE} start of $@ rule =-=-=-=-='
@echo '=-=-=-=-= Invoking ${MAKE} -f Makefile Q= V=@ clobber =-=-=-=-='
@${MAKE} -f Makefile Q= V=@ clobber
@@ -3844,7 +4075,6 @@ debug: env rpm.release
@echo '=-=-=-=-= Determining the source version =-=-=-=-='
@${MAKE} -f Makefile Q= V=@ ver_calc${EXT}
-@./ver_calc${EXT}
-@./ver_calc${EXT} -r rpm.release
@echo '=-=-=-=-= Invoking ${MAKE} -f Makefile Q= V=@ all =-=-=-=-='
@${MAKE} -f Makefile Q= V=@ all
@echo '=-=-=-=-= Determining the binary version =-=-=-=-='
@@ -3863,9 +4093,6 @@ debug: env rpm.release
# make run
# * only run calc interactively with the ${CALC_ENV} environment
#
# make cvd
# * run the SGI WorkShop debugger on calc with the ${CALC_ENV} environment
#
# make dbx
# * run the dbx debugger on calc with the ${CALC_ENV} environment
#
@@ -3877,9 +4104,6 @@ debug: env rpm.release
run:
${CALC_ENV} ./calc${EXT}
cvd:
${CALC_ENV} cvd ./calc${EXT}
dbx:
${CALC_ENV} dbx ./calc${EXT}
@@ -3892,9 +4116,14 @@ gdb:
#
###
rpm: clobber rpm.mk calc.spec.in
rpm: clobber rpm-preclean rpm.mk calc.spec.in
${V} echo '=-=-=-=-= ${MAKE_FILE} start of $@ rule =-=-=-=-='
${MAKE} -f rpm.mk V=${V}
${MAKE} -f rpm.mk all V=${V} RPM_TOP="${RPM_TOP}"
${V} echo '=-=-=-=-= ${MAKE_FILE} end of $@ rule =-=-=-=-='
rpm-preclean:
${V} echo '=-=-=-=-= ${MAKE_FILE} start of $@ rule =-=-=-=-='
${MAKE} -f rpm.mk $@ V=${V} RPM_TOP="${RPM_TOP}"
${V} echo '=-=-=-=-= ${MAKE_FILE} end of $@ rule =-=-=-=-='
# rpm static rules
@@ -4058,25 +4287,27 @@ clobber: custom/Makefile clean
${RM} -f libcustcalc.a
${RM} -f calc-static${EXT}
${RM} -f ${CALC_STATIC_LIBS}
${RM} -f all
${V} echo '=-=-=-=-= Invoking $@ rule for help =-=-=-=-='
-cd help; ${MAKE} -f Makefile ${HELP_PASSDOWN} clobber
-cd help; ${RM} -f all; ${MAKE} -f Makefile ${HELP_PASSDOWN} $@
${V} echo '=-=-=-=-= Back to the main Makefile for $@ rule =-=-=-=-='
${V} echo '=-=-=-=-= Invoking $@ rule for cal =-=-=-=-='
-cd cal; ${MAKE} -f Makefile ${CAL_PASSDOWN} clobber
-cd cal; ${RM} -f all; ${MAKE} -f Makefile ${CAL_PASSDOWN} $@
${V} echo '=-=-=-=-= Back to the main Makefile for $@ rule =-=-=-=-='
${V} echo '=-=-=-=-= Invoking $@ rule for custom =-=-=-=-='
cd custom; ${MAKE} -f Makefile ${CUSTOM_PASSDOWN} clobber
cd custom; ${RM} -f all; ${MAKE} -f Makefile ${CUSTOM_PASSDOWN} $@
${V} echo '=-=-=-=-= Back to the main Makefile for $@ rule =-=-=-=-='
${V} echo '=-=-=-=-= Invoking $@ rule for cscript =-=-=-=-='
cd cscript; ${MAKE} -f Makefile ${CSCRIPT_PASSDOWN} clobber
cd cscript; ${RM} -f all; ${MAKE} -f Makefile ${CSCRIPT_PASSDOWN} $@
${V} echo '=-=-=-=-= Back to the main Makefile for $@ rule =-=-=-=-='
${V} echo remove files that are obsolete
${RM} -rf win32 build
#if 0 /* start of skip for non-Gnu makefiles */
${RM} -f Makefile.simple
${RM} -f custom/Makefile
-${MAKE} -f ${MAKE_FILE} custom/Makefile
#endif /* end of skip for non-Gnu makefiles */
${RM} -f .static .dynamic
${RM} -f .static .dynamic calc-dynamic-only calc-static-only
${V} echo '=-=-=-=-= ${MAKE_FILE} end of $@ rule =-=-=-=-='
# install everything
@@ -4141,6 +4372,9 @@ install: custom/Makefile ${LIB_H_SRC} ${BUILD_H_SRC} calc.1 all
else \
${TRUE}; \
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 \
echo ${MKDIR} ${MKDIR_ARG} ${T}${CUSTOMCALDIR}; \
${MKDIR} ${MKDIR_ARG} ${T}${CUSTOMCALDIR}; \
@@ -4165,6 +4399,9 @@ install: custom/Makefile ${LIB_H_SRC} ${BUILD_H_SRC} calc.1 all
else \
${TRUE}; \
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 \
echo ${MKDIR} ${MKDIR_ARG} ${T}${SCRIPTDIR}; \
${MKDIR} ${MKDIR_ARG} ${T}${SCRIPTDIR}; \
@@ -4226,9 +4463,15 @@ install: custom/Makefile ${LIB_H_SRC} ${BUILD_H_SRC} calc.1 all
${V} echo '=-=-=-=-= Invoking $@ rule for cal =-=-=-=-='
${Q} cd cal; ${MAKE} -f Makefile ${CAL_PASSDOWN} install
${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 =-=-=-=-='
${Q} cd custom; ${MAKE} -f Makefile ${CUSTOM_PASSDOWN} install
${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 =-=-=-=-='
${Q} cd cscript; ${MAKE} -f Makefile ${CSCRIPT_PASSDOWN} install
${V} echo '=-=-=-=-= Back to the main Makefile for $@ rule =-=-=-=-='
@@ -4238,9 +4481,9 @@ install: custom/Makefile ${LIB_H_SRC} ${BUILD_H_SRC} calc.1 all
else \
${RM} -f ${T}${LIBDIR}/libcalc.a.new; \
${CP} -f libcalc.a ${T}${LIBDIR}/libcalc.a.new; \
${CHMOD} 0644 ${T}${LIBDIR}/libcalc.a.new; \
${MV} -f ${T}${LIBDIR}/libcalc.a.new ${T}${LIBDIR}/libcalc.a; \
${RANLIB} ${T}${LIBDIR}/libcalc.a; \
${CHMOD} 0444 ${T}${LIBDIR}/libcalc.a; \
echo "installed ${T}${LIBDIR}/libcalc.a"; \
fi; \
fi
@@ -4256,6 +4499,7 @@ install: custom/Makefile ${LIB_H_SRC} ${BUILD_H_SRC} calc.1 all
${RM} -f ${T}${LIBDIR}/libcalc${LIB_EXT_VERSION}.new; \
${CP} -f libcalc${LIB_EXT_VERSION} \
${T}${LIBDIR}/libcalc${LIB_EXT_VERSION}.new; \
${CHMOD} 0644 ${T}${LIBDIR}/libcalc${LIB_EXT_VERSION}.new; \
${MV} -f ${T}${LIBDIR}/libcalc${LIB_EXT_VERSION}.new \
${T}${LIBDIR}/libcalc${LIB_EXT_VERSION}; \
echo "installed ${T}${LIBDIR}/libcalc${LIB_EXT_VERSION}"; \
@@ -4274,6 +4518,7 @@ install: custom/Makefile ${LIB_H_SRC} ${BUILD_H_SRC} calc.1 all
${RM} -f ${T}${LIBDIR}/libcustcalc${LIB_EXT_VERSION}.new; \
${CP} -f custom/libcustcalc${LIB_EXT_VERSION} \
${T}${LIBDIR}/libcustcalc${LIB_EXT_VERSION}.new; \
${CHMOD} 0644 ${T}${LIBDIR}/libcustcalc${LIB_EXT_VERSION}.new; \
${MV} -f ${T}${LIBDIR}/libcustcalc${LIB_EXT_VERSION}.new \
${T}${LIBDIR}/libcustcalc${LIB_EXT_VERSION}; \
echo "installed ${T}${LIBDIR}/libcustcalc${LIB_EXT_VERSION}"; \
@@ -4290,9 +4535,11 @@ install: custom/Makefile ${LIB_H_SRC} ${BUILD_H_SRC} calc.1 all
${T}${LIBDIR}/libcustcalc${LIB_EXT}; \
echo "installed ${T}${LIBDIR}/libcalc${LIB_EXT}"; \
if [ -z "${T}" -o "/" = "${T}" ]; then \
echo "running ${LDCONFIG}"; \
${LDCONFIG}; \
echo "finished ${LDCONFIG}"; \
if [ ! -z "${LDCONFIG}" ]; then \
echo "running ${LDCONFIG}"; \
${LDCONFIG} -v; \
echo "finished ${LDCONFIG}"; \
fi; \
fi; \
fi
-${Q} for i in ${LIB_H_SRC} ${BUILD_H_SRC} /dev/null; do \
@@ -4365,8 +4612,6 @@ install: custom/Makefile ${LIB_H_SRC} ${BUILD_H_SRC} calc.1 all
fi; \
fi; \
fi
${V} # NOTE: remove ${T}${CALC_INCDIR}/custom if it is empty
-${Q} ${RMDIR} ${T}${CALC_INCDIR}/custom 2>/dev/null
${V} # NOTE: misc install cleanup
${Q} ${RM} -f tmp
${V} echo '=-=-=-=-= ${MAKE_FILE} end of $@ rule =-=-=-=-='
@@ -4495,9 +4740,11 @@ uninstall: custom/Makefile
fi; \
fi
-${Q} if [ -z "${T}" -o "/" = "${T}" ]; then \
echo "running ${LDCONFIG}"; \
${LDCONFIG}; \
echo "finished ${LDCONFIG}"; \
if [ ! -z "${LDCONFIG}" ]; then \
echo "running ${LDCONFIG}"; \
${LDCONFIG} -v; \
echo "finished ${LDCONFIG}"; \
fi; \
fi
-${Q} if [ -f "${T}${LIBDIR}/libcalc.a" ]; then \
${RM} -f "${T}${LIBDIR}/libcalc.a"; \
@@ -4571,6 +4818,81 @@ strip:
done
${V} echo '=-=-=-=-= ${MAKE_FILE} end of $@ rule =-=-=-=-='
# calc-symlink - setup symlinks from stardard locations into the ${T} tree
#
calc-symlink:
${Q}if [ -z "${T}" ]; then \
echo "cannot use $@ make rule when T make var is empty" 1>&2; \
echo "aborting" 1>&2; \
exit 1; \
fi
-${Q} for i in ${BINDIR}/calc${EXT} \
${BINDIR}/calc-static${EXT} \
${SCRIPTDIR} \
${LIBDIR}/libcalc${LIB_EXT_VERSION} \
${LIBDIR}/libcustcalc${LIB_EXT_VERSION} \
${MANDIR}/calc.${MANEXT} \
${CALC_SHAREDIR} \
${CALC_INCDIR} \
; do \
if [ -e "${T}$$i" ]; then \
if [ ! -L "$$i" -a "${T}$$i" -ef "$$i" ]; then \
echo "ERROR: ${T}$$i is the same as $$i" 1>&2; \
else \
if [ -e "$$i" ]; then \
echo ${RM} -f "$$i"; \
${RM} -f "$$i"; \
fi; \
echo ${LN} -s "${T}$$i" "$$i"; \
${LN} -s "${T}$$i" "$$i"; \
fi; \
else \
echo "Warning: not found: ${T}$$i" 1>&2; \
fi; \
done
-${Q} if [ -n "${CATDIR}" ]; then \
if [ -e "${T}${CATDIR}/calc.${CATEXT}" ]; then \
if [ ! -L "${CATDIR}/calc.${CATEXT}" -a "${T}${CATDIR}/calc.${CATEXT}" -ef "${CATDIR}/calc.${CATEXT}" ]; then \
echo "ERROR: ${T}${CATDIR}/calc.${CATEXT} is the same as ${CATDIR}/calc.${CATEXT}" 1>&2; \
else \
if [ -e "${CATDIR}/calc.${CATEXT}" ]; then \
echo ${RM} -f "${CATDIR}/calc.${CATEXT}"; \
${RM} -f "${CATDIR}/calc.${CATEXT}"; \
fi; \
echo ${LN} -s "${T}${CATDIR}/calc.${CATEXT}" "${CATDIR}/calc.${CATEXT}"; \
${LN} -s "${T}${CATDIR}/calc.${CATEXT}" "${CATDIR}/calc.${CATEXT}"; \
fi; \
fi; \
fi
# remove any symlinks that may have been created by calc-symlink
#
calc-unsymlink:
-${Q} for i in ${BINDIR}/calc${EXT} \
${BINDIR}/calc-static${EXT} \
${SCRIPTDIR} \
${LIBDIR}/libcalc${LIB_EXT_VERSION} \
${LIBDIR}/libcustcalc${LIB_EXT_VERSION} \
${MANDIR}/calc.${MANEXT} \
${CALC_SHAREDIR} \
${CALC_INCDIR} \
; do \
if [ -L "$$i" ]; then \
echo ${RM} -f "$$i"; \
${RM} -f "$$i"; \
else \
echo "Warning: ignoring non-symlink: $$i" 1>&2; \
fi; \
done
-${Q} if [ -n "${CATDIR}" ]; then \
if [ -L "${CATDIR}/calc.${CATEXT}" ]; then \
echo ${RM} -f "${CATDIR}/calc.${CATEXT}"; \
${RM} -f "${CATDIR}/calc.${CATEXT}"; \
else \
echo "Warning: ignoring non-symlink: ${CATDIR}/calc.${CATEXT}" 1>&2; \
fi; \
fi
###
#
# make depend stuff

View File

@@ -11,7 +11,7 @@
# (Generic calc makefile)
#
# 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
# or less. It compiles with gcc -O3 -g3 as well. You can change all
# this by modifying the Makefile variables below.
@@ -20,9 +20,10 @@
# has the GNU readline headers and libaraies:
#
# 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-2008 Landon Curt Noll
#
# Calc is open software; you can redistribute it and/or modify it under
# the terms of the version 2.1 of the GNU Lesser General Public License
@@ -38,9 +39,9 @@
# received a copy with calc; if not, write to Free Software Foundation, Inc.
# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
#
MAKEFILE_REV= $$Revision: 30.21 $$
# @(#) $Id: Makefile.ship,v 30.21 2007/09/06 08:08:39 chongo Exp $
# @(#) $Source: /usr/local/src/cmd/calc/RCS/Makefile.ship,v $
MAKEFILE_REV= $$Revision: 30.51 $$
# @(#) $Id: Makefile.ship,v 30.51 2013/05/05 13:52:39 chongo Exp $
# @(#) $Source: /usr/local/src/bin/calc/RCS/Makefile.ship,v $
#
# Under source code control: 1990/02/15 01:48:41
# File existed as early as: before 1990
@@ -105,19 +106,19 @@ HAVE_VSPRINTF=
# Big Endian: Amdahl, 68k, Pyramid, Mips, Sparc, ...
# Little Endian: Vax, 32k, Spim (Dec Mips), i386, i486, ...
#
# If in doubt, leave BYTE_ORDER empty. This Makefile will attempt to
# If in doubt, leave CALC_BYTE_ORDER empty. This Makefile will attempt to
# use BYTE_ORDER in <machine/endian.h> or it will attempt to run
# the endian program. If you get syntax errors when you compile,
# try forcing the value to be -DBIG_ENDIAN and run the calc regression
# 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.
#
# Select BYTE_ORDER= -DLITTLE_ENDIAN for DJGPP.
# Select CALC_BYTE_ORDER= -DCALC_LITTLE_ENDIAN for DJGPP.
#
BYTE_ORDER=
#BYTE_ORDER= -DBIG_ENDIAN
#BYTE_ORDER= -DLITTLE_ENDIAN
CALC_BYTE_ORDER=
#CALC_BYTE_ORDER= -DBIG_ENDIAN
#CALC_BYTE_ORDER= -DLITTLE_ENDIAN
# Determine the number of bits in a long
#
@@ -582,6 +583,18 @@ INCDIR= /usr/include
# by default is empty. If ${T} is non-empty, then installation
# locations will be relative to the ${T} directory.
#
# NOTE: If you change LIBDIR to a non-standard location, you will need
# to make changes to your execution environment so that executables
# will search LIBDIR when they are resolving dynamic shared libraries.
#
# On OS X, this means you need to export $DYLD_LIBRARY_PATH
# to include the LIBDIR path in the value.
#
# On Linux and BSD, this means you need to export $LD_LIBRARY_PATH
# to include the LIBDIR path in the value.
#
# You might be better off not changing LIBDIR in the first place.
#
# For DJGPP, select:
#
# BINDIR= /dev/env/DJDIR/bin
@@ -752,13 +765,25 @@ MANMAKE= /usr/local/bin/manmake
MANMODE= 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
# path will be search for calc resource file routines.
#
# Select CALCPATH= .;./cal;~/.cal;${CALC_SHAREDIR};${CUSTOMCALDIR} for DJGPP.
#
CALCPATH= .:./cal:~/.cal:${CALC_SHAREDIR}:${CUSTOMCALDIR}
#CALCPATH= .;./cal;~/.cal;${CALC_SHAREDIR};${CUSTOMCALDIR}
# If the $CALCRC environment variable is not defined, then the following
# path will be search for calc resource files.
@@ -778,6 +803,8 @@ CALCRC= ${CALC_SHAREDIR}/startup:~/.calcrc:./.calcinit
#
# READLINE_LIB The flags needed to link in the readline
# 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
# (leave blank if they are /usr/include/readline)
#
@@ -791,14 +818,22 @@ USE_READLINE=
#USE_READLINE= -DUSE_READLINE
#
READLINE_LIB=
#READLINE_LIB= -lreadline -lhistory -lncurses
#READLINE_LIB= -L/usr/gnu/lib -lreadline -lhistory -lncurses
#READLINE_LIB= -L/usr/local/lib -lreadline -lhistory -lncurses
READLINE_EXTRAS=
#
#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
# 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= -I/usr/gnu/include
@@ -908,18 +943,6 @@ CALC_ENV= CALCPATH=./cal LD_LIBRARY_PATH=.
# MALLOC_FASTCHK=1 MALLOC_FULLWARN=1 MALLOC_CLEAR_FREE=1 \
# 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:
#
@@ -937,11 +960,12 @@ MKDIR_ARG= -p
# Some out of date operating systems require / want an executable to
# end with a certain file extension. Some compile systems such as
# Cygwin build calc as calc.exe. The EXT variable is used to denote
# the extension required by such.
# windoz build calc as calc.exe. The EXT variable is used to denote
# the extension required by such. Note that Cygwin requires EXT to be
# the same as Linux/Un*x/GNU, even though it runs under windoz.
#
# EXT= # normal Un*x / Linux / GNU/Linux systems
# EXT=.exe # windoz / Cygwin
# EXT= # normal Un*x / Linux / GNU/Linux / Cygwin
# EXT=.exe # windoz
#
# If in doubt, use EXT=
#
@@ -950,8 +974,8 @@ EXT=
# The default calc versions
#
VERSION= 2.12.2.1
VERS= 2.12.2
VERSION= 2.12.4.8
VERS= 2.12.4
VER= 2.12
VE= 2
@@ -1115,6 +1139,7 @@ CFLAGS= ${ICFLAGS} ${CCOPT}
ILDFLAGS= ${COMMON_LDFLAGS} ${LD_STATIC}
LDFLAGS= ${LD_DEBUG} ${ILDFLAGS} ${LIBCALC_STATIC} ${LIBCUSTCALC_STATIC}
#
CALCPATH= .;./cal;~/.cal;${CALC_SHAREDIR};${CUSTOMCALDIR}
#######################################################################
#-=-=-=-=-=- end of target section - only make rules below -=-=-=-=-=-#
@@ -1234,7 +1259,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 \
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
#
UTIL_PROGS= align32${EXT} fposval${EXT} have_uid_t${EXT} have_const${EXT} \
@@ -1344,9 +1369,6 @@ HELP_PASSDOWN= \
COMMON_CFLAGS="${COMMON_CFLAGS}" \
COMMON_LDFLAGS="${COMMON_LDFLAGS}" \
CP=${CP} \
CUSTOMCALDIR="${CUSTOMCALDIR}" \
CUSTOMHELPDIR="${CUSTOMHELPDIR}" \
CUSTOMINCDIR="${CUSTOMINCDIR}" \
EXT=${EXT} \
FMT=${FMT} \
HELPDIR="${HELPDIR}" \
@@ -1381,9 +1403,6 @@ CAL_PASSDOWN= \
CMP=${CMP} \
CO=${CO} \
CP=${CP} \
CUSTOMCALDIR="${CUSTOMCALDIR}" \
CUSTOMHELPDIR="${CUSTOMHELPDIR}" \
CUSTOMINCDIR="${CUSTOMINCDIR}" \
HELPDIR="${HELPDIR}" \
INCDIR="${INCDIR}" \
LANG=${LANG} \
@@ -1412,9 +1431,6 @@ CSCRIPT_PASSDOWN= \
CMP=${CMP} \
CO=${CO} \
CP=${CP} \
CUSTOMCALDIR="${CUSTOMCALDIR}" \
CUSTOMHELPDIR="${CUSTOMHELPDIR}" \
CUSTOMINCDIR="${CUSTOMINCDIR}" \
FMT=${FMT} \
HELPDIR="${HELPDIR}" \
INCDIR="${INCDIR}" \
@@ -1459,7 +1475,7 @@ CALCLIBLIST= ${LIBSRC} ${UTIL_C_SRC} ${LIB_H_SRC} ${MAKE_FILE} \
# complete list of .o files
#
OBJS= ${LIBOBJS} ${CALCOBJS} ${UTIL_OBJS} ${SAMPLE_OBJS}
OBJS= ${LIBOBJS} ${CALCOBJS} ${UTIL_OBJS} ${SAMPLE_OBJ}
# static library build
#
@@ -1525,6 +1541,9 @@ TARGETS= ${EARLY_TARGETS} ${BLD_TYPE} ${LATE_TARGETS}
all: ${BLD_TYPE} CHANGES
prep:
${Q} ${MAKE} -f ${MAKE_FILE} all DEBUG='-g3'
calc-dynamic-only: ${DYNAMIC_FIRST_TARGETS} ${EARLY_TARGETS} \
${CALC_DYNAMIC_LIBS} ${SYM_DYNAMIC_LIBS} calc${EXT} \
${SAMPLE_TARGETS} ${LATE_TARGETS}
@@ -1549,7 +1568,7 @@ calc-dynamic-only: ${DYNAMIC_FIRST_TARGETS} ${EARLY_TARGETS} \
${Q} for i in .static calc-static${EXT} ${SAMPLE_STATIC_TARGETS} \
libcalc.a custom/libcustcalc.a; do \
r="calc-dynamic-only"; \
if [ -e "$$i" ]; then \
if [ -r "$$i" ]; then \
echo "Found the static target $$i file. You must:" 1>&2; \
echo "" 1>&2; \
echo " ${MAKE} -f ${MAKE_FILE} clobber" 1>&2; \
@@ -1567,7 +1586,9 @@ calc-static-only: ${STATIC_FIRST_TARGETS} ${EARLY_TARGETS} \
${CALC_STATIC_LIBS} calc-static${EXT} \
${SAMPLE_STATIC_TARGETS} ${LATE_TARGETS}
${Q} for i in calc${EXT} ${SAMPLE_TARGETS}; do \
if ! ${CMP} -s "$$i-static" "$$i"; then \
if ${CMP} -s "$$i-static" "$$i"; then \
${TRUE}; \
else \
${RM} -f "$$i"; \
${LN} "$$i-static" "$$i"; \
fi; \
@@ -1593,7 +1614,7 @@ calc-static-only: ${STATIC_FIRST_TARGETS} ${EARLY_TARGETS} \
${Q} for i in .dynamic ${CALC_DYNAMIC_LIBS} ${SYM_DYNAMIC_LIBS} \
custom/libcustcalc${LIB_EXT_VERSION}; do \
r="calc-static-only"; \
if [ -e "$$i" ]; then \
if [ -r "$$i" ]; then \
echo "Found the dynamic target $$i file. You must:" 1>&2; \
echo "" 1>&2; \
echo " ${MAKE} -f ${MAKE_FILE} clobber" 1>&2; \
@@ -1610,10 +1631,11 @@ calc-static-only: ${STATIC_FIRST_TARGETS} ${EARLY_TARGETS} \
calc${EXT}: .hsrc ${CALCOBJS} ${CALC_DYNAMIC_LIBS} ${MAKE_FILE}
${RM} -f $@
${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}
${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}
${Q} ${RM} -f $@
@@ -1672,11 +1694,11 @@ sample: ${SAMPLE_TARGETS}
sample_rand${EXT}: sample_rand.o ${CALC_DYNAMIC_LIBS} ${MAKE_FILE}
${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}
${CC} sample_many.o ${CLDFALGS} ${LD_SHARE} ${CALC_DYNAMIC_LIBS} \
${READLINE_LIB} -o $@
${READLINE_LIB} ${READLINE_EXTRAS} -o $@
###
#
@@ -1776,7 +1798,7 @@ endian_calc.h: endian${EXT} ${MAKE_FILE}
${Q} echo '' >> endian_calc.h
${Q} echo '' >> 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 \
echo '#include <endian.h>' >> endian_calc.h; \
echo '#define CALC_BYTE_ORDER BYTE_ORDER' >> endian_calc.h; \
@@ -2722,7 +2744,7 @@ have_urandom.h: ${MAKE_FILE}
echo '#define HAVE_URANDOM_H /* yes */' >> have_urandom.h; \
elif [ X"${HAVE_URANDOM_H}" = X"NO" ]; then \
echo '#undef HAVE_URANDOM_H /* no */' >> have_urandom.h; \
elif [ -e /dev/urandom ] 2>/dev/null; then \
elif [ -r /dev/urandom ] 2>/dev/null; then \
echo '#define HAVE_URANDOM_H /* yes */' >> have_urandom.h; \
else \
echo '#undef HAVE_URANDOM_H /* no */' >> have_urandom.h; \
@@ -3032,7 +3054,7 @@ win32_hsrc: win32.mkdef ${MAKE_FILE}
###
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
${RM} -f $@
@@ -3132,7 +3154,7 @@ calc-static${EXT}: .hsrc ${CALCOBJS} \
${CALC_STATIC_LIBS} ${MAKE_FILE}
${RM} -f $@
${CC} ${LDFLAGS} ${CALCOBJS} ${LD_STATIC} ${CALC_STATIC_LIBS} \
${READLINE_LIB} -o $@
${READLINE_LIB} ${READLINE_EXTRAS} -o $@
libcustcalc.a: custom/libcustcalc.a
${Q} ${RM} -f $@
@@ -3149,11 +3171,11 @@ custom/libcustcalc.a: custom/Makefile
sample_rand-static${EXT}: sample_rand.o ${CALC_STATIC_LIBS} ${MAKE_FILE}
${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}
${CC} ${LDFLAGS} sample_many.o ${LD_STATIC} \
${CALC_STATIC_LIBS} ${READLINE_LIB} -o $@
${CALC_STATIC_LIBS} ${READLINE_LIB} ${READLINE_EXTRAS} -o $@
###
#
@@ -3531,6 +3553,7 @@ env:
@echo 'PURIFY=${PURIFY}'; echo ''
@echo 'Q=${Q}'; echo ''
@echo 'RANLIB=${RANLIB}'; echo ''
@echo 'READLINE_EXTRAS=${READLINE_EXTRAS}'; echo ''
@echo 'READLINE_INCLUDE=${READLINE_INCLUDE}'; echo ''
@echo 'READLINE_LIB=${READLINE_LIB}'; echo ''
@echo 'RM=${RM}'; echo ''
@@ -3568,12 +3591,11 @@ env:
@echo 'target=${target}'; echo ''
@echo '=-=-=-=-= ${MAKE_FILE} end of major make variable dump =-=-=-=-='
mkdebug: env version.c rpm.release
mkdebug: env version.c
@echo '=-=-=-=-= ${MAKE_FILE} start of $@ rule =-=-=-=-='
@echo '=-=-=-=-= Determining the source version =-=-=-=-='
@${MAKE} -f Makefile Q= V=@ ver_calc${EXT}
-@./ver_calc${EXT}
-@./ver_calc${EXT} -r rpm.release
@echo '=-=-=-=-= Invoking ${MAKE} -f Makefile Q= V=@ all =-=-=-=-='
@${MAKE} -f Makefile Q= V=@ all
@echo '=-=-=-=-= Back to the main Makefile for $@ rule =-=-=-=-='
@@ -3582,7 +3604,7 @@ mkdebug: env version.c rpm.release
@echo '=-=-=-=-= Back to the main Makefile for $@ rule =-=-=-=-='
@echo '=-=-=-=-= ${MAKE_FILE} end of $@ rule =-=-=-=-='
debug: env rpm.release
debug: env
@echo '=-=-=-=-= ${MAKE_FILE} start of $@ rule =-=-=-=-='
@echo '=-=-=-=-= Invoking ${MAKE} -f Makefile Q= V=@ clobber =-=-=-=-='
@${MAKE} -f Makefile Q= V=@ clobber
@@ -3590,7 +3612,6 @@ debug: env rpm.release
@echo '=-=-=-=-= Determining the source version =-=-=-=-='
@${MAKE} -f Makefile Q= V=@ ver_calc${EXT}
-@./ver_calc${EXT}
-@./ver_calc${EXT} -r rpm.release
@echo '=-=-=-=-= Invoking ${MAKE} -f Makefile Q= V=@ all =-=-=-=-='
@${MAKE} -f Makefile Q= V=@ all
@echo '=-=-=-=-= Determining the binary version =-=-=-=-='
@@ -3609,9 +3630,6 @@ debug: env rpm.release
# make run
# * only run calc interactively with the ${CALC_ENV} environment
#
# make cvd
# * run the SGI WorkShop debugger on calc with the ${CALC_ENV} environment
#
# make dbx
# * run the dbx debugger on calc with the ${CALC_ENV} environment
#
@@ -3623,9 +3641,6 @@ debug: env rpm.release
run:
${CALC_ENV} ./calc${EXT}
cvd:
${CALC_ENV} cvd ./calc${EXT}
dbx:
${CALC_ENV} dbx ./calc${EXT}
@@ -3638,9 +3653,14 @@ gdb:
#
###
rpm: clobber rpm.mk calc.spec.in
rpm: clobber rpm-preclean rpm.mk calc.spec.in
${V} echo '=-=-=-=-= ${MAKE_FILE} start of $@ rule =-=-=-=-='
${MAKE} -f rpm.mk V=${V}
${MAKE} -f rpm.mk all V=${V} RPM_TOP="${RPM_TOP}"
${V} echo '=-=-=-=-= ${MAKE_FILE} end of $@ rule =-=-=-=-='
rpm-preclean:
${V} echo '=-=-=-=-= ${MAKE_FILE} start of $@ rule =-=-=-=-='
${MAKE} -f rpm.mk $@ V=${V} RPM_TOP="${RPM_TOP}"
${V} echo '=-=-=-=-= ${MAKE_FILE} end of $@ rule =-=-=-=-='
# rpm static rules
@@ -3804,21 +3824,22 @@ clobber: custom/Makefile clean
${RM} -f libcustcalc.a
${RM} -f calc-static${EXT}
${RM} -f ${CALC_STATIC_LIBS}
${RM} -f all
${V} echo '=-=-=-=-= Invoking $@ rule for help =-=-=-=-='
-cd help; ${MAKE} -f Makefile ${HELP_PASSDOWN} clobber
-cd help; ${RM} -f all; ${MAKE} -f Makefile ${HELP_PASSDOWN} $@
${V} echo '=-=-=-=-= Back to the main Makefile for $@ rule =-=-=-=-='
${V} echo '=-=-=-=-= Invoking $@ rule for cal =-=-=-=-='
-cd cal; ${MAKE} -f Makefile ${CAL_PASSDOWN} clobber
-cd cal; ${RM} -f all; ${MAKE} -f Makefile ${CAL_PASSDOWN} $@
${V} echo '=-=-=-=-= Back to the main Makefile for $@ rule =-=-=-=-='
${V} echo '=-=-=-=-= Invoking $@ rule for custom =-=-=-=-='
cd custom; ${MAKE} -f Makefile.simple ${CUSTOM_PASSDOWN} clobber
cd custom; ${RM} -f all; ${MAKE} -f Makefile ${CUSTOM_PASSDOWN} $@
${V} echo '=-=-=-=-= Back to the main Makefile for $@ rule =-=-=-=-='
${V} echo '=-=-=-=-= Invoking $@ rule for cscript =-=-=-=-='
cd cscript; ${MAKE} -f Makefile ${CSCRIPT_PASSDOWN} clobber
cd cscript; ${RM} -f all; ${MAKE} -f Makefile ${CSCRIPT_PASSDOWN} $@
${V} echo '=-=-=-=-= Back to the main Makefile for $@ rule =-=-=-=-='
${V} echo remove files that are obsolete
${RM} -rf win32 build
${RM} -f .static .dynamic
${RM} -f .static .dynamic calc-dynamic-only calc-static-only
${V} echo '=-=-=-=-= ${MAKE_FILE} end of $@ rule =-=-=-=-='
# install everything
@@ -3980,9 +4001,9 @@ install: custom/Makefile ${LIB_H_SRC} ${BUILD_H_SRC} calc.1 all
else \
${RM} -f ${T}${LIBDIR}/libcalc.a.new; \
${CP} -f libcalc.a ${T}${LIBDIR}/libcalc.a.new; \
${CHMOD} 0644 ${T}${LIBDIR}/libcalc.a.new; \
${MV} -f ${T}${LIBDIR}/libcalc.a.new ${T}${LIBDIR}/libcalc.a; \
${RANLIB} ${T}${LIBDIR}/libcalc.a; \
${CHMOD} 0444 ${T}${LIBDIR}/libcalc.a; \
echo "installed ${T}${LIBDIR}/libcalc.a"; \
fi; \
fi
@@ -3998,6 +4019,7 @@ install: custom/Makefile ${LIB_H_SRC} ${BUILD_H_SRC} calc.1 all
${RM} -f ${T}${LIBDIR}/libcalc${LIB_EXT_VERSION}.new; \
${CP} -f libcalc${LIB_EXT_VERSION} \
${T}${LIBDIR}/libcalc${LIB_EXT_VERSION}.new; \
${CHMOD} 0644 ${T}${LIBDIR}/libcalc${LIB_EXT_VERSION}.new; \
${MV} -f ${T}${LIBDIR}/libcalc${LIB_EXT_VERSION}.new \
${T}${LIBDIR}/libcalc${LIB_EXT_VERSION}; \
echo "installed ${T}${LIBDIR}/libcalc${LIB_EXT_VERSION}"; \
@@ -4016,6 +4038,7 @@ install: custom/Makefile ${LIB_H_SRC} ${BUILD_H_SRC} calc.1 all
${RM} -f ${T}${LIBDIR}/libcustcalc${LIB_EXT_VERSION}.new; \
${CP} -f custom/libcustcalc${LIB_EXT_VERSION} \
${T}${LIBDIR}/libcustcalc${LIB_EXT_VERSION}.new; \
${CHMOD} 0644 ${T}${LIBDIR}/libcustcalc${LIB_EXT_VERSION}.new; \
${MV} -f ${T}${LIBDIR}/libcustcalc${LIB_EXT_VERSION}.new \
${T}${LIBDIR}/libcustcalc${LIB_EXT_VERSION}; \
echo "installed ${T}${LIBDIR}/libcustcalc${LIB_EXT_VERSION}"; \
@@ -4032,9 +4055,11 @@ install: custom/Makefile ${LIB_H_SRC} ${BUILD_H_SRC} calc.1 all
${T}${LIBDIR}/libcustcalc${LIB_EXT}; \
echo "installed ${T}${LIBDIR}/libcalc${LIB_EXT}"; \
if [ -z "${T}" -o "/" = "${T}" ]; then \
echo "running ${LDCONFIG}"; \
${LDCONFIG}; \
echo "finished ${LDCONFIG}"; \
if [ ! -z "${LDCONFIG}" ]; then \
echo "running ${LDCONFIG}"; \
${LDCONFIG} -v; \
echo "finished ${LDCONFIG}"; \
fi; \
fi; \
fi
-${Q} for i in ${LIB_H_SRC} ${BUILD_H_SRC} /dev/null; do \
@@ -4107,8 +4132,6 @@ install: custom/Makefile ${LIB_H_SRC} ${BUILD_H_SRC} calc.1 all
fi; \
fi; \
fi
${V} # NOTE: remove ${T}${CALC_INCDIR}/custom if it is empty
-${Q} ${RMDIR} ${T}${CALC_INCDIR}/custom 2>/dev/null
${V} # NOTE: misc install cleanup
${Q} ${RM} -f tmp
${V} echo '=-=-=-=-= ${MAKE_FILE} end of $@ rule =-=-=-=-='
@@ -4237,9 +4260,11 @@ uninstall: custom/Makefile
fi; \
fi
-${Q} if [ -z "${T}" -o "/" = "${T}" ]; then \
echo "running ${LDCONFIG}"; \
${LDCONFIG}; \
echo "finished ${LDCONFIG}"; \
if [ ! -z "${LDCONFIG}" ]; then \
echo "running ${LDCONFIG}"; \
${LDCONFIG} -v; \
echo "finished ${LDCONFIG}"; \
fi; \
fi
-${Q} if [ -f "${T}${LIBDIR}/libcalc.a" ]; then \
${RM} -f "${T}${LIBDIR}/libcalc.a"; \
@@ -4313,6 +4338,81 @@ strip:
done
${V} echo '=-=-=-=-= ${MAKE_FILE} end of $@ rule =-=-=-=-='
# calc-symlink - setup symlinks from stardard locations into the ${T} tree
#
calc-symlink:
${Q}if [ -z "${T}" ]; then \
echo "cannot use $@ make rule when T make var is empty" 1>&2; \
echo "aborting" 1>&2; \
exit 1; \
fi
-${Q} for i in ${BINDIR}/calc${EXT} \
${BINDIR}/calc-static${EXT} \
${SCRIPTDIR} \
${LIBDIR}/libcalc${LIB_EXT_VERSION} \
${LIBDIR}/libcustcalc${LIB_EXT_VERSION} \
${MANDIR}/calc.${MANEXT} \
${CALC_SHAREDIR} \
${CALC_INCDIR} \
; do \
if [ -e "${T}$$i" ]; then \
if [ ! -L "$$i" -a "${T}$$i" -ef "$$i" ]; then \
echo "ERROR: ${T}$$i is the same as $$i" 1>&2; \
else \
if [ -e "$$i" ]; then \
echo ${RM} -f "$$i"; \
${RM} -f "$$i"; \
fi; \
echo ${LN} -s "${T}$$i" "$$i"; \
${LN} -s "${T}$$i" "$$i"; \
fi; \
else \
echo "Warning: not found: ${T}$$i" 1>&2; \
fi; \
done
-${Q} if [ -n "${CATDIR}" ]; then \
if [ -e "${T}${CATDIR}/calc.${CATEXT}" ]; then \
if [ ! -L "${CATDIR}/calc.${CATEXT}" -a "${T}${CATDIR}/calc.${CATEXT}" -ef "${CATDIR}/calc.${CATEXT}" ]; then \
echo "ERROR: ${T}${CATDIR}/calc.${CATEXT} is the same as ${CATDIR}/calc.${CATEXT}" 1>&2; \
else \
if [ -e "${CATDIR}/calc.${CATEXT}" ]; then \
echo ${RM} -f "${CATDIR}/calc.${CATEXT}"; \
${RM} -f "${CATDIR}/calc.${CATEXT}"; \
fi; \
echo ${LN} -s "${T}${CATDIR}/calc.${CATEXT}" "${CATDIR}/calc.${CATEXT}"; \
${LN} -s "${T}${CATDIR}/calc.${CATEXT}" "${CATDIR}/calc.${CATEXT}"; \
fi; \
fi; \
fi
# remove any symlinks that may have been created by calc-symlink
#
calc-unsymlink:
-${Q} for i in ${BINDIR}/calc${EXT} \
${BINDIR}/calc-static${EXT} \
${SCRIPTDIR} \
${LIBDIR}/libcalc${LIB_EXT_VERSION} \
${LIBDIR}/libcustcalc${LIB_EXT_VERSION} \
${MANDIR}/calc.${MANEXT} \
${CALC_SHAREDIR} \
${CALC_INCDIR} \
; do \
if [ -L "$$i" ]; then \
echo ${RM} -f "$$i"; \
${RM} -f "$$i"; \
else \
echo "Warning: ignoring non-symlink: $$i" 1>&2; \
fi; \
done
-${Q} if [ -n "${CATDIR}" ]; then \
if [ -L "${CATDIR}/calc.${CATEXT}" ]; then \
echo ${RM} -f "${CATDIR}/calc.${CATEXT}"; \
${RM} -f "${CATDIR}/calc.${CATEXT}"; \
else \
echo "Warning: ignoring non-symlink: ${CATDIR}/calc.${CATEXT}" 1>&2; \
fi; \
fi
###
#
# make depend stuff

2
README
View File

@@ -136,7 +136,7 @@ The calc web site is located at:
##
## @(#) $Revision: 30.1 $
## @(#) $Id: README,v 30.1 2007/03/16 11:09:46 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/RCS/README,v $
## @(#) $Source: /usr/local/src/bin/calc/RCS/README,v $
##
## Under source code control: 1995/10/25 05:27:59
## File existed as early as: 1995

View File

@@ -10,6 +10,63 @@ NOTE: The main developers do not have access to a Windoz based platform.
Of course you are welcome to send us any patches that fix your
Windoz build environment.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
=-= compiling with Cygwin =-=
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
An effort is being made to allow windows users to compile calc using the
Cygwin project (http://sources.redhat.com/cygwin/) with the GCC compiler
and Un*x tools for Windows.
The major porting work for Cygwin was performed by Thomas Jones-Low
(tjoneslo at softstart dot com).
In March 2009, Michael Penk (mpenk at wuska dot com) reported success in
installs under Cygwin:
On my fairly complete Cygwin installs, everything compiles,
checks, and installs correctly. My Cygwin is configured
in a very standard way (out of the box, using all of Cygwin's
defaults). The install worked on 5 different machines with
Cygwin on them: one XP home, one XP professional, and three
Vista professionals.
Using the calc Makefile, he did the following:
make all target=Cygwin
make check
make install
He also reports:
Of course, one should be logged in as an Administrator when
one builds and installs calc.
He was compiling calc 2.12.4.0 with Cygwin version 1.5.25-15.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
=-= If all else fails, for Cygwin =-=
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Much earlier (2001?) Thomas Jones-Low (tjoneslo at softstart dot com)
recommended that you generate by hand all of the header files that
by the Makefile. This has been done for you via the makefile rule:
make win32_hsrc
which uses the Makefile variables in win32.mkdef to form these header
files under win32 directory.
You will find generated versions of these files located in the win32
sub-directory. These files may be appropriate for your Cygwin building
needs.
In particular:
Just copy the win32/*.[ch] files up into the top level calc
source directory, edit them (if needed) and build using the
Cygwin GCC compiler and Cygwin build environment.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
=-= compiling under DJGPP =-=
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
@@ -68,52 +125,8 @@ Look for Makefile comments of the form:
Follow those recommendations. In cases where they conflict with
the above Makefile list, follow the recommendation in the Makefile.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
=-= compiling with Cygwin =-=
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
An effort is being made to allow windows users to compile calc using the
Cygwin project (http://sources.redhat.com/cygwin/) with the GCC compiler
and Un*x tools for Windows.
The major porting work was performed by Thomas Jones-Low
(tjoneslo at softstart dot com). He said:
I had previous stated to this group that I have successfully managed
to port a version of Calc to Windows, and promised some point to
post what was required, so here it is.
One obvious manner of doing this port is to get the latest version
of the Cygwin project (http://sources.redhat.com/cygwin/) with the
GCC compiler and Un*x tools for Windows and recompile.
I built my working version using Calc ... I am using Visual C++
version 7.0, which is an older version of the Microsoft development
tools. The make file provided with Calc is not compatible with
NMAKE, so I used the Visual Studio tools to generate another one
(not included). Calc is built in two parts, calc.dll, which is the
library, and calc.exe which is the command line interface.
He recommended that you generate by hand all of the header files that
by the Makefile. This has been done for you via the makefile rule:
make win32_hsrc
which uses the Makefile variables in win32.mkdef to form these header
files under win32 directory.
You will find generated versions of these files located in the win32
sub-directory. These files may be appropriate for your Cygwin building
needs.
In particular:
Just copy the win32/*.[ch] files up into the top level calc
source directory, edit them (if needed) and build using the
Cygwin GCC compiler and Cygwin build environment.
## Copyright (C) 2002-2007 Landon Curt Noll and Thomas Jones-Low
## Copyright (C) 2002-2009 Landon Curt Noll and Thomas Jones-Low
##
## 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
@@ -129,9 +142,9 @@ In particular:
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
##
## @(#) $Revision: 30.1 $
## @(#) $Id: README.WINDOWS,v 30.1 2007/03/16 11:09:46 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/RCS/README.WINDOWS,v $
## @(#) $Revision: 30.2 $
## @(#) $Id: README.WINDOWS,v 30.2 2009/03/14 02:29:31 chongo Exp $
## @(#) $Source: /usr/local/src/bin/calc/RCS/README.WINDOWS,v $
##
## Under source code control: 2001/02/25 14:00:05
## File existed as early as: 2001

View File

@@ -21,7 +21,7 @@
*
* @(#) $Revision: 30.1 $
* @(#) $Id: addop.c,v 30.1 2007/03/16 11:09:46 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/addop.c,v $
* @(#) $Source: /usr/local/src/bin/calc/RCS/addop.c,v $
*
* Under source code control: 1990/02/15 01:48:10
* File existed as early as: before 1990

View File

@@ -19,7 +19,7 @@
*
* @(#) $Revision: 30.1 $
* @(#) $Id: align32.c,v 30.1 2007/03/16 11:09:46 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/align32.c,v $
* @(#) $Source: /usr/local/src/bin/calc/RCS/align32.c,v $
*
* Under source code control: 1995/11/23 05:18:06
* File existed as early as: 1995

View File

@@ -17,9 +17,9 @@
* received a copy with calc; if not, write to Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* @(#) $Revision: 30.1 $
* @(#) $Id: alloc.h,v 30.1 2007/03/16 11:09:46 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/alloc.h,v $
* @(#) $Revision: 30.2 $
* @(#) $Id: alloc.h,v 30.2 2008/04/15 21:17:57 chongo Exp $
* @(#) $Source: /usr/local/src/bin/calc/RCS/alloc.h,v $
*
* Under source code control: 1990/02/15 01:48:29
* File existed as early as: before 1990
@@ -46,6 +46,9 @@
# include <string.h>
#else
#if defined(_WIN32) && defined(NOTCYGWIN)
#include <stdio.h>
#endif
# if defined(HAVE_NEWSTR)
E_FUNC void *memcpy();

View File

@@ -19,7 +19,7 @@
*
* @(#) $Revision: 30.1 $
* @(#) $Id: assocfunc.c,v 30.1 2007/03/16 11:09:46 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/assocfunc.c,v $
* @(#) $Source: /usr/local/src/bin/calc/RCS/assocfunc.c,v $
*
* Under source code control: 1993/07/20 23:04:27
* File existed as early as: 1993

View File

@@ -21,7 +21,7 @@
*
* @(#) $Revision: 30.1 $
* @(#) $Id: blkcpy.c,v 30.1 2007/03/16 11:09:46 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/blkcpy.c,v $
* @(#) $Source: /usr/local/src/bin/calc/RCS/blkcpy.c,v $
*
* Under source code control: 1997/04/18 20:41:26
* File existed as early as: 1997

View File

@@ -21,7 +21,7 @@
*
* @(#) $Revision: 30.1 $
* @(#) $Id: blkcpy.h,v 30.1 2007/03/16 11:09:46 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/blkcpy.h,v $
* @(#) $Source: /usr/local/src/bin/calc/RCS/blkcpy.h,v $
*
* Under source code control: 1997/04/18 20:41:25
* File existed as early as: 1997

View File

@@ -21,7 +21,7 @@
*
* @(#) $Revision: 30.1 $
* @(#) $Id: block.c,v 30.1 2007/03/16 11:09:46 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/block.c,v $
* @(#) $Source: /usr/local/src/bin/calc/RCS/block.c,v $
*
* Under source code control: 1997/02/27 00:29:40
* File existed as early as: 1997

View File

@@ -21,7 +21,7 @@
*
* @(#) $Revision: 30.1 $
* @(#) $Id: block.h,v 30.1 2007/03/16 11:09:46 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/block.h,v $
* @(#) $Source: /usr/local/src/bin/calc/RCS/block.h,v $
*
* Under source code control: 1997/02/21 05:03:39
* File existed as early as: 1997

View File

@@ -19,7 +19,7 @@
*
* @(#) $Revision: 30.1 $
* @(#) $Id: byteswap.c,v 30.1 2007/03/16 11:09:46 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/byteswap.c,v $
* @(#) $Source: /usr/local/src/bin/calc/RCS/byteswap.c,v $
*
* Under source code control: 1995/10/11 04:44:01
* File existed as early as: 1995

View File

@@ -19,7 +19,7 @@
*
* @(#) $Revision: 30.1 $
* @(#) $Id: byteswap.h,v 30.1 2007/03/16 11:09:46 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/byteswap.h,v $
* @(#) $Source: /usr/local/src/bin/calc/RCS/byteswap.h,v $
*
* Under source code control: 1995/10/11 04:44:01
* File existed as early as: 1995

View File

@@ -18,9 +18,9 @@
# received a copy with calc; if not, write to Free Software Foundation, Inc.
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# @(#) $Revision: 30.2 $
# @(#) $Id: Makefile,v 30.2 2007/03/22 07:34:47 chongo Exp $
# @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/Makefile,v $
# @(#) $Revision: 30.5 $
# @(#) $Id: Makefile,v 30.5 2011/05/23 22:50:18 chongo Exp $
# @(#) $Source: /usr/local/src/bin/calc/cal/RCS/Makefile,v $
#
# Under source code control: 1991/07/21 05:00:54
# File existed as early as: 1991
@@ -111,9 +111,6 @@ CALC_SHAREDIR= /usr/share/calc
# ---------------------------------------------------------------
# ${HELPDIR} where the help directory is installed
# ${CALC_INCDIR} where the calc include files are installed
# ${CUSTOMCALDIR} where custom *.cal files are installed
# ${CUSTOMHELPDIR} where custom help files are installed
# ${CUSTOMINCDIR} where custom .h files are installed
# ${SCRIPTDIR} where calc shell scripts are installed
#
# NOTE: The install rule prepends installation paths with ${T}, which
@@ -124,16 +121,10 @@ CALC_SHAREDIR= /usr/share/calc
#
# HELPDIR= ${CALC_SHAREDIR}/help
# CALC_INCDIR= ${INCDIR}/calc
# CUSTOMCALDIR= ${CALC_SHAREDIR}/custom
# CUSTOMHELPDIR= ${CALC_SHAREDIR}/custhelp
# CUSTOMINCDIR= ${CALC_INCDIR}/custom
# SCRIPTDIR= ${BINDIR}/cscript
#
HELPDIR= ${CALC_SHAREDIR}/help
CALC_INCDIR= ${INCDIR}/calc
CUSTOMCALDIR= ${CALC_SHAREDIR}/custom
CUSTOMHELPDIR= ${CALC_SHAREDIR}/custhelp
CUSTOMINCDIR= ${CALC_INCDIR}/custom
SCRIPTDIR= ${BINDIR}/cscript
# T - top level directory under which calc will be installed
@@ -202,7 +193,8 @@ CALC_FILES= README bigprime.cal deg.cal ellip.cal lucas.cal lucas_chk.cal \
beer.cal hello.cal test5100.cal test5200.cal randombitrun.cal \
randomrun.cal repeat.cal xx_print.cal natnumset.cal qtime.cal \
test8400.cal test8500.cal test8600.cal chi.cal intfile.cal screen.cal \
dotest.cal set8700.cal set8700.line alg_config.cal sumtimes.cal
dotest.cal set8700.cal set8700.line alg_config.cal sumtimes.cal \
dms.cal hms.cal gvec.cal
# These files are found (but not built) in the distribution
#

View File

@@ -226,14 +226,37 @@ chrem.cal
deg.cal
deg(deg, min, sec)
deg_add(a, b)
deg_neg(a)
deg_sub(a, b)
deg_mul(a, b)
deg_print(a)
Calculate in degrees, minutes, and seconds. For a more functional
version see dms.cal.
dms.cal
dms(deg, min, sec)
dms_add(a, b)
dms_neg(a)
dms_sub(a, b)
dms_mul(a, b)
dms_print(a)
dms_abs(a)
dms_norm(a)
dms_test(a)
dms_int(a)
dms_frac(a)
dms_rel(a,b)
dms_cmp(a,b)
dms_inc(a)
dms_dec(a)
Calculate in degrees, minutes, and seconds.
Calculate in degrees, minutes, and seconds. Unlike deg.cal, increments
are on the arc second level. See also hms.cal.
dotest.cal
@@ -275,6 +298,13 @@ ellip.cal
Attempt to factor using the elliptic functions: y^2 = x^3 + a*x + b.
gvec.cal
gvec(function, vector)
Vectorize any single-input function or trailing operator.
hello.cal
Calc's contribution to the Hello World! page:
@@ -285,6 +315,27 @@ hello.cal
NOTE: This resource produces a lot of output. :-)
hms.cal
hms(hour, min, sec)
hms_add(a, b)
hms_neg(a)
hms_sub(a, b)
hms_mul(a, b)
hms_print(a)
hms_abs(a)
hms_norm(a)
hms_test(a)
hms_int(a)
hms_frac(a)
hms_rel(a,b)
hms_cmp(a,b)
hms_inc(a)
hms_dec(a)
Calculate in hours, minutes, and seconds. See also dmscal.
intfile.cal
file2be(filename)
@@ -1014,9 +1065,9 @@ xx_print.cal
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
##
## @(#) $Revision: 30.1 $
## @(#) $Id: README,v 30.1 2007/03/16 11:09:54 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/README,v $
## @(#) $Revision: 30.3 $
## @(#) $Id: README,v 30.3 2011/05/23 22:50:32 chongo Exp $
## @(#) $Source: /usr/local/src/bin/calc/cal/RCS/README,v $
##
## Under source code control: 1990/02/15 01:50:32
## File existed as early as: before 1990

View File

@@ -19,7 +19,7 @@
*
* @(#) $Revision: 30.1 $
* @(#) $Id: alg_config.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/alg_config.cal,v $
* @(#) $Source: /usr/local/src/bin/calc/cal/RCS/alg_config.cal,v $
*
* Under source code control: 2006/06/07 14:10:11
* File existed as early as: 2006

View File

@@ -19,7 +19,7 @@
*
* @(#) $Revision: 30.1 $
* @(#) $Id: beer.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/beer.cal,v $
* @(#) $Source: /usr/local/src/bin/calc/cal/RCS/beer.cal,v $
*
* Under source code control: 1996/11/13 13:21:05
* File existed as early as: 1996

View File

@@ -19,7 +19,7 @@
*
* @(#) $Revision: 30.1 $
* @(#) $Id: bernoulli.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/bernoulli.cal,v $
* @(#) $Source: /usr/local/src/bin/calc/cal/RCS/bernoulli.cal,v $
*
* Under source code control: 1991/09/30 11:18:41
* File existed as early as: 1991

View File

@@ -19,7 +19,7 @@
*
* @(#) $Revision: 30.1 $
* @(#) $Id: bigprime.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/bigprime.cal,v $
* @(#) $Source: /usr/local/src/bin/calc/cal/RCS/bigprime.cal,v $
*
* Under source code control: 1991/05/22 21:56:32
* File existed as early as: 1991

View File

@@ -18,7 +18,7 @@
#
# @(#) $Revision: 30.1 $
# @(#) $Id: bindings,v 30.1 2007/03/16 11:09:54 chongo Exp $
# @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/bindings,v $
# @(#) $Source: /usr/local/src/bin/calc/cal/RCS/bindings,v $
#
# Under source code control: 1993/05/02 20:09:19
# File existed as early as: 1993

View File

@@ -19,7 +19,7 @@
*
* @(#) $Revision: 30.1 $
* @(#) $Id: chi.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/chi.cal,v $
* @(#) $Source: /usr/local/src/bin/calc/cal/RCS/chi.cal,v $
*
* Under source code control: 2001/03/27 14:10:11
* File existed as early as: 2001

View File

@@ -21,7 +21,7 @@
*
* @(#) $Revision: 30.1 $
* @(#) $Id: chrem.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/chrem.cal,v $
* @(#) $Source: /usr/local/src/bin/calc/cal/RCS/chrem.cal,v $
*
* Under source code control: 1992/09/26 01:00:47
* File existed as early as: 1992

View File

@@ -17,9 +17,9 @@
* received a copy with calc; if not, write to Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* @(#) $Revision: 30.1 $
* @(#) $Id: deg.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/deg.cal,v $
* @(#) $Revision: 30.2 $
* @(#) $Id: deg.cal,v 30.2 2010/09/02 06:01:14 chongo Exp $
* @(#) $Source: /usr/local/src/bin/calc/cal/RCS/deg.cal,v $
*
* Under source code control: 1990/02/15 01:50:33
* File existed as early as: before 1990
@@ -28,9 +28,9 @@
*/
obj dms {deg, min, sec};
obj deg {deg, min, sec};
define dms(deg, min, sec)
define deg(deg, min, sec)
{
local ans;
@@ -38,18 +38,18 @@ define dms(deg, min, sec)
sec = 0;
if (isnull(min))
min = 0;
obj dms ans;
obj deg ans;
ans.deg = deg;
ans.min = min;
ans.sec = sec;
fixdms(ans);
fixdeg(ans);
return ans;
}
define dms_add(a, b)
define deg_add(a, b)
{
local obj dms ans;
local obj deg ans;
ans.deg = 0;
ans.min = 0;
@@ -66,14 +66,14 @@ define dms_add(a, b)
ans.sec += b.sec;
} else
ans.deg += b;
fixdms(ans);
fixdeg(ans);
return ans;
}
define dms_neg(a)
define deg_neg(a)
{
local obj dms ans;
local obj deg ans;
ans.deg = -a.deg;
ans.min = -a.min;
@@ -82,15 +82,15 @@ define dms_neg(a)
}
define dms_sub(a, b)
define deg_sub(a, b)
{
return a - b;
}
define dms_mul(a, b)
define deg_mul(a, b)
{
local obj dms ans;
local obj deg ans;
if (istype(a, ans) && istype(b, ans))
quit "Cannot multiply degrees together";
@@ -103,24 +103,24 @@ define dms_mul(a, b)
ans.min = b.min * a;
ans.sec = b.sec * a;
}
fixdms(ans);
fixdeg(ans);
return ans;
}
define dms_print(a)
define deg_print(a)
{
print a.deg : 'd' : a.min : 'm' : a.sec : 's' :;
}
define dms_abs(a)
define deg_abs(a)
{
return a.deg + a.min / 60 + a.sec / 3600;
}
define fixdms(a)
define fixdeg(a)
{
a.min += frac(a.deg) * 60;
a.deg = int(a.deg);
@@ -134,5 +134,5 @@ define fixdms(a)
}
if (config("resource_debug") & 3) {
print "obj dms {deg, min, sec} defined";
print "obj deg {deg, min, sec} defined";
}

384
cal/dms.cal Normal file
View File

@@ -0,0 +1,384 @@
/*
* dms - calculate in degrees, minutes, and seconds (based on deg)
*
* Copyright (C) 1999,2010 David I. Bell and Landon Curt Noll
*
* Calc is open software; you can redistribute it and/or modify it under
* the terms of the version 2.1 of the GNU Lesser General Public License
* as published by the Free Software Foundation.
*
* Calc is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
* Public License for more details.
*
* A copy of version 2.1 of the GNU Lesser General Public License is
* distributed with calc under the filename COPYING-LGPL. You should have
* received a copy with calc; if not, write to Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* @(#) $Revision: 30.2 $
* @(#) $Id: dms.cal,v 30.2 2010/09/02 06:14:16 chongo Exp $
* @(#) $Source: /usr/local/src/bin/calc/cal/RCS/dms.cal,v $
*
* Under source code control: 1990/02/15 01:50:33
* File existed as early as: before 1990
*
* Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
*/
obj dms {deg, min, sec};
define dms(deg, min, sec)
{
local obj dms ans; /* return value */
/* default missing args to 0 */
if (isnull(sec)) {
sec = 0;
}
if (isnull(min)) {
min = 0;
}
/* load object */
ans.deg = deg;
ans.min = min;
ans.sec = sec;
/* return properly formed object */
ans = fixdms(ans);
return ans;
}
define dms_add(a, b)
{
local obj dms ans; /* return value */
/* initalize value to 1st arg */
if (istype(a, ans)) {
/* 1st arg is dms object, load it */
ans.deg = a.deg;
ans.min = a.min;
ans.sec = a.sec;
} else {
/* 1st arg is not dms, assume scalar degrees */
ans.deg = a;
ans.min = 0;
ans.sec = 0;
}
/* add value of 2nd arg */
if (istype(b, ans)) {
/* 2nd arg is dms object, add it */
ans.deg += b.deg;
ans.min += b.min;
ans.sec += b.sec;
} else {
/* 2nd arg is not dms, add scalar degrees */
ans.deg += b;
}
/* return normalized result */
ans = fixdms(ans);
return ans;
}
define dms_neg(a)
{
local obj dms ans; /* return value */
/* negate argument */
if (istype(a, ans)) {
/* 1st arg is dms object, load it */
ans.deg = -a.deg;
ans.min = -a.min;
ans.sec = -a.sec;
} else {
/* 2nd arg is not dms, negate scalar degrees */
ans.deg = -a;
ans.min = 0;
ans.sec = 0;
}
/* return normalized result */
ans = fixdms(ans);
return ans;
}
define dms_sub(a, b)
{
local obj dms ans; /* return value */
/* initalize value to 1st arg */
if (istype(a, ans)) {
/* 1st arg is dms object, load it */
ans.deg = a.deg;
ans.min = a.min;
ans.sec = a.sec;
} else {
/* 1st arg is not dms, assume scalar degrees */
ans.deg = a;
ans.min = 0;
ans.sec = 0;
}
/* subtract value of 2nd arg */
if (istype(b, ans)) {
/* 2nd arg is dms object, subtract it */
ans.deg -= b.deg;
ans.min -= b.min;
ans.sec -= b.sec;
} else {
/* 2nd arg is not dms, subtract scalar degrees */
ans.deg -= b;
}
/* return normalized result */
ans = fixdms(ans);
return ans;
}
define dms_mul(a, b)
{
local obj dms ans; /* return value */
/* dms object multiplication */
if (istype(a, ans) && istype(b, ans)) {
ans.deg = dms_abs(a) * dms_abs(b);
ans.min = 0;
ans.sec = 0;
/* scalar multiplication */
} else if (istype(a, ans)) {
ans.deg = a.deg * b;
ans.min = a.min * b;
ans.sec = a.sec * b;
} else {
ans.deg = b.deg * a;
ans.min = b.min * a;
ans.sec = b.sec * a;
}
/* return normalized result */
ans = fixdms(ans);
return ans;
}
define dms_print(a)
{
local obj dms ans; /* temp object for dms type testing */
/* firewall - arg must be a dms object */
if (! istype(a, ans)) {
quit "dms_print called with non dms object";
}
/* print in dms form */
print a.deg : 'd' : a.min : 'm' : a.sec : 's' :;
}
define dms_abs(a)
{
local obj dms ans; /* temp object for dms type testing */
local deg; /* return scalar value */
/* firewall - just absolute value non dms objects */
if (! istype(a, ans)) {
return abs(a);
}
/* compute degrees */
deg = a.deg + a.min / 60 + a.sec / 3600;
/* return degrees */
return deg;
}
define dms_norm(a)
{
local obj dms ans; /* temp object for dms type testing */
local deg; /* degrees */
/* firewall - arg must be a dms object */
if (! istype(a, ans)) {
quit "dms_norm called with non dms object";
}
/* square degrees (norm is the square of absolute value */
deg = dms_abs(a);
/* return degrees */
return deg*deg;
}
define dms_test(a)
{
local obj dms ans; /* temp value */
/* firewall - arg must be a dms object */
if (! istype(a, ans)) {
quit "dms_test called with non dms object";
}
/* return false of non-zero */
ans = fixdms(a);
if (ans.deg == 0 && ans.min == 0 && ans.sec == 0) {
/* false */
return 0;
}
/* true */
return 1;
}
define dms_int(a)
{
local obj dms ans; /* return value */
/* firewall - arg must be a dms object */
if (! istype(a, ans)) {
quit "dms_int called with non dms object";
}
/* normalize the argument */
ans = fixdms(a);
/* truncate to the nearest second */
ans.sec = int(ans.sec);
/* return value to the nearest second */
return ans;
}
define dms_frac(a)
{
local obj dms ans; /* return value */
/* firewall - arg must be a dms object */
if (! istype(a, ans)) {
quit "dms_frac called with non dms object";
}
/* normalize the argument */
ans = fixdms(a);
/* remove all but fractional seconds */
ans.deg = 0;
ans.min = 0;
ans.sec = frac(ans.sec);
/* return value to the second fraction */
return ans;
}
define dms_rel(a,b)
{
local abs_a, abs_b; /* scalars of the arguments */
/* compute scalars of the arguments */
abs_a = dms_abs(a);
abs_b = dms_abs(b);
/* return the comparison */
return cmp(abs_a, abs_b);
}
define dms_cmp(a,b)
{
local abs_a, abs_b; /* scalars of the arguments */
/* compute scalars of the arguments */
abs_a = dms_abs(a);
abs_b = dms_abs(b);
/* return the equality comparison */
return (abs_a == abs_b);
}
define dms_inc(a)
{
local obj dms ans; /* return value */
/* increment a dms object */
if (istype(a, ans)) {
ans = a;
++ans.sec;
/* return normalized result */
ans = fixdms(ans);
return ans;
}
/* increment a scalar */
return a+1;
}
define dms_dec(a)
{
local obj dms ans; /* return value */
/* decrement a dms object */
if (istype(a, ans)) {
ans = a;
--ans.sec;
/* return normalized result */
ans = fixdms(ans);
return ans;
}
/* decrement a scalar */
return a-1;
}
define fixdms(a)
{
local obj dms ans; /* temp value */
/* firewall */
if (! istype(a, ans)) {
quit "attempt to fix a non dms object";
}
/* force minutes to be intergral */
a.min += frac(a.deg) * 60;
a.deg = int(a.deg);
/* force degrees to be intergral */
a.sec += frac(a.min) * 60;
a.min = int(a.min);
/* carry excess seconds into minutes */
a.min += a.sec // 60;
a.sec %= 60;
/* carry excess minutes into degrees */
a.deg += a.min // 60;
a.min %= 60;
/* round degrees :-) */
a.deg %= 360;
/* return normalized result */
return a;
}
if (config("resource_debug") & 3) {
print "obj dms {deg, min, sec} defined";
}

View File

@@ -18,7 +18,7 @@
*
* @(#) $Revision: 30.2 $
* @(#) $Id: dotest.cal,v 30.2 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/dotest.cal,v $
* @(#) $Source: /usr/local/src/bin/calc/cal/RCS/dotest.cal,v $
*
* This file is not covered under version 2.1 of the GNU LGPL.
*

View File

@@ -19,7 +19,7 @@
*
* @(#) $Revision: 30.1 $
* @(#) $Id: ellip.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/ellip.cal,v $
* @(#) $Source: /usr/local/src/bin/calc/cal/RCS/ellip.cal,v $
*
* Under source code control: 1990/02/15 01:50:33
* File existed as early as: before 1990

107
cal/gvec.cal Normal file
View File

@@ -0,0 +1,107 @@
/*
* gvec - vectorize any single-input function or trailing operator
*
* This version accepts arbitrary number of arguments, but of course
* they must all be same length vectors.
*
* The gvec function is for use in either a two-arg function or a two-arg
* operation "function" must be first; calc doesn't care how many more
* arguments there actually are.
*
* @(#) $Revision: 30.3 $
* @(#) $Id: gvec.cal,v 30.3 2011/05/23 23:00:55 chongo Exp $
* @(#) $Source: /usr/local/src/bin/calc/cal/RCS/gvec.cal,v $
*
* Under source code control: 2011/03/31 17:54:55
* File existed as early as: 2010
*
* By Carl Witthoft carl at witthoft dot com
*/
define gvec(function, vector)
{
local xlen,y,foo;
local precx = 1e-50; /* default for now */
local argc = param(0)-1;
local old_tilde; /* previous config("tilde") */
/*
* parse args
*/
local plist = mat[argc];
if (config("resource_debug") & 8) {
print "plist=", plist;
print "argc=", argc;
}
for(local i = 0; i< argc; i++) {
local ii = i + 2;
if (config("resource_debug") & 8) {
print "ii=", ii;
print "param(" : ii : "}=", param(ii);
print "size(param(" : ii : ")=", size(param(ii));
}
plist[i] = size(param(ii));
}
local slist=sort(plist);
if (config("resource_debug") & 8) {
print "plist=", plist;
}
local argm = argc-1;
if (config("resource_debug") & 8) {
print "argm=", argm;
}
if (slist[0] != slist[argm]) {
quit "lengths don't match";
}
xlen = size(vector);
y = mat[xlen];
/*
* We can't do str(vector[j]) outside loop, eval() petulantly refuses to
* look at local variables.
*
* Also we need to config("tilde",0) to turn off lead tilde
* (so str(vector[j]) looks like a number.
*/
old_tilde = config("tilde",0);
/*
* Ok, now check to see if "function" is a function. If not, it's an
* operation and it's up to user to make it valid
*/
if (isdefined(function)) {
/* yep, it's a function, either builtin or user-defined */
for (local j=0; j<xlen; j++) {
/* build the function call */
foo = strcat(function, "(");
for (local jj = 0; jj<argc; jj++) {
foo = strcat(foo , str(param(jj+2)[j]), ",");
}
foo = strcat(foo, str(precx), ")");
if (config("resource_debug") & 8) {
print "foo=", foo;
}
y[j] = eval(foo);
}
/*
* it is an operator -- multi-argument operator makes no sense
*/
} else {
if (argc > 1) {
quit "Error: operator can accept only one argument";
}
for (j=0; j<xlen; j++) {
foo = strcat(str(vector[j]), function);
y[j] = eval(foo);
}
}
/* restore tilde mode if needed */
config("tilde", old_tilde);
/* return result */
return y;
}

View File

@@ -19,7 +19,7 @@
*
* @(#) $Revision: 30.1 $
* @(#) $Id: hello.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/hello.cal,v $
* @(#) $Source: /usr/local/src/bin/calc/cal/RCS/hello.cal,v $
*
* Under source code control: 1996/11/13 13:25:43
* File existed as early as: 1996

384
cal/hms.cal Normal file
View File

@@ -0,0 +1,384 @@
/*
* hms - calculate in hours, minutes, and seconds
*
* Copyright (C) 2010 Landon Curt Noll
*
* Calc is open software; you can redistribute it and/or modify it under
* the terms of the version 2.1 of the GNU Lesser General Public License
* as published by the Free Software Foundation.
*
* Calc is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
* Public License for more details.
*
* A copy of version 2.1 of the GNU Lesser General Public License is
* distributed with calc under the filename COPYING-LGPL. You should have
* received a copy with calc; if not, write to Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* @(#) $Revision: 30.2 $
* @(#) $Id: hms.cal,v 30.2 2010/09/02 06:14:16 chongo Exp $
* @(#) $Source: /usr/local/src/bin/calc/cal/RCS/hms.cal,v $
*
* Under source code control: 2010/09/01 17:14:55
* File existed as early as: 2010
*
* Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
*/
obj hms {hour, min, sec};
define hms(hour, min, sec)
{
local obj hms ans; /* return value */
/* default missing args to 0 */
if (isnull(sec)) {
sec = 0;
}
if (isnull(min)) {
min = 0;
}
/* load object */
ans.hour = hour;
ans.min = min;
ans.sec = sec;
/* return properly formed object */
ans = fixhms(ans);
return ans;
}
define hms_add(a, b)
{
local obj hms ans; /* return value */
/* initalize value to 1st arg */
if (istype(a, ans)) {
/* 1st arg is hms object, load it */
ans.hour = a.hour;
ans.min = a.min;
ans.sec = a.sec;
} else {
/* 1st arg is not hms, assume scalar hours */
ans.hour = a;
ans.min = 0;
ans.sec = 0;
}
/* add value of 2nd arg */
if (istype(b, ans)) {
/* 2nd arg is hms object, add it */
ans.hour += b.hour;
ans.min += b.min;
ans.sec += b.sec;
} else {
/* 2nd arg is not hms, add scalar hours */
ans.hour += b;
}
/* return normalized result */
ans = fixhms(ans);
return ans;
}
define hms_neg(a)
{
local obj hms ans; /* return value */
/* negate argument */
if (istype(a, ans)) {
/* 1st arg is hms object, load it */
ans.hour = -a.hour;
ans.min = -a.min;
ans.sec = -a.sec;
} else {
/* 2nd arg is not hms, negate scalar hours */
ans.hour = -a;
ans.min = 0;
ans.sec = 0;
}
/* return normalized result */
ans = fixhms(ans);
return ans;
}
define hms_sub(a, b)
{
local obj hms ans; /* return value */
/* initalize value to 1st arg */
if (istype(a, ans)) {
/* 1st arg is hms object, load it */
ans.hour = a.hour;
ans.min = a.min;
ans.sec = a.sec;
} else {
/* 1st arg is not hms, assume scalar hours */
ans.hour = a;
ans.min = 0;
ans.sec = 0;
}
/* subtract value of 2nd arg */
if (istype(b, ans)) {
/* 2nd arg is hms object, subtract it */
ans.hour -= b.hour;
ans.min -= b.min;
ans.sec -= b.sec;
} else {
/* 2nd arg is not hms, subtract scalar hours */
ans.hour -= b;
}
/* return normalized result */
ans = fixhms(ans);
return ans;
}
define hms_mul(a, b)
{
local obj hms ans; /* return value */
/* hms object multiplication */
if (istype(a, ans) && istype(b, ans)) {
ans.hour = hms_abs(a) * hms_abs(b);
ans.min = 0;
ans.sec = 0;
/* scalar multiplication */
} else if (istype(a, ans)) {
ans.hour = a.hour * b;
ans.min = a.min * b;
ans.sec = a.sec * b;
} else {
ans.hour = b.hour * a;
ans.min = b.min * a;
ans.sec = b.sec * a;
}
/* return normalized result */
ans = fixhms(ans);
return ans;
}
define hms_print(a)
{
local obj hms ans; /* temp object for hms type testing */
/* firewall - arg must be a hms object */
if (! istype(a, ans)) {
quit "hms_print called with non hms object";
}
/* print in hms form */
print a.hour : ':' : a.min : ':' : a.sec :;
}
define hms_abs(a)
{
local obj hms ans; /* temp object for hms type testing */
local hour; /* return scalar value */
/* firewall - just absolute value non hms objects */
if (! istype(a, ans)) {
return abs(a);
}
/* compute hours */
hour = a.hour + a.min / 60 + a.sec / 3600;
/* return hours */
return hour;
}
define hms_norm(a)
{
local obj hms ans; /* temp object for hms type testing */
local hour; /* hours */
/* firewall - arg must be a hms object */
if (! istype(a, ans)) {
quit "hms_norm called with non hms object";
}
/* square hours (norm is the square of absolute value */
hour = hms_abs(a);
/* return hours */
return hour*hour;
}
define hms_test(a)
{
local obj hms ans; /* temp value */
/* firewall - arg must be a hms object */
if (! istype(a, ans)) {
quit "hms_test called with non hms object";
}
/* return false of non-zero */
ans = fixhms(a);
if (ans.hour == 0 && ans.min == 0 && ans.sec == 0) {
/* false */
return 0;
}
/* true */
return 1;
}
define hms_int(a)
{
local obj hms ans; /* return value */
/* firewall - arg must be a hms object */
if (! istype(a, ans)) {
quit "hms_int called with non hms object";
}
/* normalize the argument */
ans = fixhms(a);
/* truncate to the nearest second */
ans.sec = int(ans.sec);
/* return value to the nearest second */
return ans;
}
define hms_frac(a)
{
local obj hms ans; /* return value */
/* firewall - arg must be a hms object */
if (! istype(a, ans)) {
quit "hms_frac called with non hms object";
}
/* normalize the argument */
ans = fixhms(a);
/* remove all but fractional seconds */
ans.hour = 0;
ans.min = 0;
ans.sec = frac(ans.sec);
/* return value to the second fraction */
return ans;
}
define hms_rel(a,b)
{
local abs_a, abs_b; /* scalars of the arguments */
/* compute scalars of the arguments */
abs_a = hms_abs(a);
abs_b = hms_abs(b);
/* return the comparison */
return cmp(abs_a, abs_b);
}
define hms_cmp(a,b)
{
local abs_a, abs_b; /* scalars of the arguments */
/* compute scalars of the arguments */
abs_a = hms_abs(a);
abs_b = hms_abs(b);
/* return the equality comparison */
return (abs_a == abs_b);
}
define hms_inc(a)
{
local obj hms ans; /* return value */
/* increment a hms object */
if (istype(a, ans)) {
ans = a;
++ans.sec;
/* return normalized result */
ans = fixhms(ans);
return ans;
}
/* increment a scalar */
return a+1;
}
define hms_dec(a)
{
local obj hms ans; /* return value */
/* decrement a hms object */
if (istype(a, ans)) {
ans = a;
--ans.sec;
/* return normalized result */
ans = fixhms(ans);
return ans;
}
/* decrement a scalar */
return a-1;
}
define fixhms(a)
{
local obj hms ans; /* temp value */
/* firewall */
if (! istype(a, ans)) {
quit "attempt to fix a non hms object";
}
/* force minutes to be intergral */
a.min += frac(a.hour) * 60;
a.hour = int(a.hour);
/* force hours to be intergral */
a.sec += frac(a.min) * 60;
a.min = int(a.min);
/* carry excess seconds into minutes */
a.min += a.sec // 60;
a.sec %= 60;
/* carry excess minutes into hours */
a.hour += a.min // 60;
a.min %= 60;
/* round hours by day */
a.hour %= 24;
/* return normalized result */
return a;
}
if (config("resource_debug") & 3) {
print "obj hms {hour, min, sec} defined";
}

View File

@@ -19,7 +19,7 @@
*
* @(#) $Revision: 30.1 $
* @(#) $Id: intfile.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/intfile.cal,v $
* @(#) $Source: /usr/local/src/bin/calc/cal/RCS/intfile.cal,v $
*
* Under source code control: 2001/03/31 08:13:11
* File existed as early as: 2001

View File

@@ -19,7 +19,7 @@
*
* @(#) $Revision: 30.2 $
* @(#) $Id: linear.cal,v 30.2 2007/03/17 05:57:42 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/linear.cal,v $
* @(#) $Source: /usr/local/src/bin/calc/cal/RCS/linear.cal,v $
*
* Under source code control: 2005/12/12 06:41:50
* File existed as early as: 2005

View File

@@ -19,7 +19,7 @@
*
* @(#) $Revision: 30.1 $
* @(#) $Id: lucas.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/lucas.cal,v $
* @(#) $Source: /usr/local/src/bin/calc/cal/RCS/lucas.cal,v $
*
* Under source code control: 1990/05/03 16:49:51
* File existed as early as: 1990

View File

@@ -19,7 +19,7 @@
*
* @(#) $Revision: 30.1 $
* @(#) $Id: lucas_chk.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/lucas_chk.cal,v $
* @(#) $Source: /usr/local/src/bin/calc/cal/RCS/lucas_chk.cal,v $
*
* Under source code control: 1991/01/11 05:41:43
* File existed as early as: 1991

View File

@@ -19,7 +19,7 @@
*
* @(#) $Revision: 30.1 $
* @(#) $Id: lucas_tbl.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/lucas_tbl.cal,v $
* @(#) $Source: /usr/local/src/bin/calc/cal/RCS/lucas_tbl.cal,v $
*
* Under source code control: 1991/01/26 02:43:43
* File existed as early as: 1991

View File

@@ -21,7 +21,7 @@
*
* @(#) $Revision: 30.1 $
* @(#) $Id: mersenne.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/mersenne.cal,v $
* @(#) $Source: /usr/local/src/bin/calc/cal/RCS/mersenne.cal,v $
*
* Under source code control: 1991/05/22 21:56:36
* File existed as early as: 1991

View File

@@ -19,7 +19,7 @@
*
* @(#) $Revision: 30.1 $
* @(#) $Id: mfactor.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/mfactor.cal,v $
* @(#) $Source: /usr/local/src/bin/calc/cal/RCS/mfactor.cal,v $
*
* Under source code control: 1996/07/06 06:09:40
* File existed as early as: 1996

View File

@@ -19,7 +19,7 @@
*
* @(#) $Revision: 30.1 $
* @(#) $Id: mod.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/mod.cal,v $
* @(#) $Source: /usr/local/src/bin/calc/cal/RCS/mod.cal,v $
*
* Under source code control: 1990/02/15 01:50:34
* File existed as early as: before 1990

View File

@@ -19,7 +19,7 @@
*
* @(#) $Revision: 30.1 $
* @(#) $Id: natnumset.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/natnumset.cal,v $
* @(#) $Source: /usr/local/src/bin/calc/cal/RCS/natnumset.cal,v $
*
* Under source code control: 1997/09/07 23:53:51
* File existed as early as: 1997

View File

@@ -19,7 +19,7 @@
*
* @(#) $Revision: 30.1 $
* @(#) $Id: pell.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/pell.cal,v $
* @(#) $Source: /usr/local/src/bin/calc/cal/RCS/pell.cal,v $
*
* Under source code control: 1990/02/15 01:50:34
* File existed as early as: before 1990

View File

@@ -19,7 +19,7 @@
*
* @(#) $Revision: 30.1 $
* @(#) $Id: pi.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/pi.cal,v $
* @(#) $Source: /usr/local/src/bin/calc/cal/RCS/pi.cal,v $
*
* Under source code control: 1991/05/22 21:56:37
* File existed as early as: 1991

View File

@@ -19,7 +19,7 @@
*
* @(#) $Revision: 30.1 $
* @(#) $Id: pix.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/pix.cal,v $
* @(#) $Source: /usr/local/src/bin/calc/cal/RCS/pix.cal,v $
*
* Under source code control: 1996/07/09 03:14:14
* File existed as early as: 1996

View File

@@ -19,7 +19,7 @@
*
* @(#) $Revision: 30.1 $
* @(#) $Id: pollard.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/pollard.cal,v $
* @(#) $Source: /usr/local/src/bin/calc/cal/RCS/pollard.cal,v $
*
* Under source code control: 1991/05/22 21:56:37
* File existed as early as: 1991

View File

@@ -19,7 +19,7 @@
*
* @(#) $Revision: 30.1 $
* @(#) $Id: poly.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/poly.cal,v $
* @(#) $Source: /usr/local/src/bin/calc/cal/RCS/poly.cal,v $
*
* Under source code control: 1990/02/15 01:50:35
* File existed as early as: before 1990

View File

@@ -19,7 +19,7 @@
*
* @(#) $Revision: 30.1 $
* @(#) $Id: prompt.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/prompt.cal,v $
* @(#) $Source: /usr/local/src/bin/calc/cal/RCS/prompt.cal,v $
*
* Under source code control: 1995/12/18 04:43:25
* File existed as early as: 1995

View File

@@ -19,7 +19,7 @@
*
* @(#) $Revision: 30.1 $
* @(#) $Id: psqrt.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/psqrt.cal,v $
* @(#) $Source: /usr/local/src/bin/calc/cal/RCS/psqrt.cal,v $
*
* Under source code control: 1990/02/15 01:50:35
* File existed as early as: before 1990

View File

@@ -22,7 +22,7 @@
*
* @(#) $Revision: 30.1 $
* @(#) $Id: qtime.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/qtime.cal,v $
* @(#) $Source: /usr/local/src/bin/calc/cal/RCS/qtime.cal,v $
*
* Under source code control: 1999/10/13 04:10:33
* File existed as early as: 1999

View File

@@ -19,7 +19,7 @@
*
* @(#) $Revision: 30.1 $
* @(#) $Id: quat.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/quat.cal,v $
* @(#) $Source: /usr/local/src/bin/calc/cal/RCS/quat.cal,v $
*
* Under source code control: 1990/02/15 01:50:35
* File existed as early as: before 1990

View File

@@ -19,7 +19,7 @@
*
* @(#) $Revision: 30.1 $
* @(#) $Id: randbitrun.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/randbitrun.cal,v $
* @(#) $Source: /usr/local/src/bin/calc/cal/RCS/randbitrun.cal,v $
*
* Under source code control: 1995/02/13 03:43:11
* File existed as early as: 1995

View File

@@ -19,7 +19,7 @@
*
* @(#) $Revision: 30.1 $
* @(#) $Id: randmprime.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/randmprime.cal,v $
* @(#) $Source: /usr/local/src/bin/calc/cal/RCS/randmprime.cal,v $
*
* Under source code control: 1994/03/14 23:11:21
* File existed as early as: 1994

View File

@@ -19,7 +19,7 @@
*
* @(#) $Revision: 30.1 $
* @(#) $Id: randombitrun.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/randombitrun.cal,v $
* @(#) $Source: /usr/local/src/bin/calc/cal/RCS/randombitrun.cal,v $
*
* Under source code control: 1995/02/13 03:43:11
* File existed as early as: 1995

View File

@@ -19,7 +19,7 @@
*
* @(#) $Revision: 30.1 $
* @(#) $Id: randomrun.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/randomrun.cal,v $
* @(#) $Source: /usr/local/src/bin/calc/cal/RCS/randomrun.cal,v $
*
* Under source code control: 1997/02/19 03:35:59
* File existed as early as: 1997

View File

@@ -19,7 +19,7 @@
*
* @(#) $Revision: 30.1 $
* @(#) $Id: randrun.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/randrun.cal,v $
* @(#) $Source: /usr/local/src/bin/calc/cal/RCS/randrun.cal,v $
*
* Under source code control: 1995/02/12 20:00:06
* File existed as early as: 1995

View File

@@ -17,9 +17,9 @@
* received a copy with calc; if not, write to Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* @(#) $Revision: 30.3 $
* @(#) $Id: regress.cal,v 30.3 2007/07/11 22:58:26 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/regress.cal,v $
* @(#) $Revision: 30.6 $
* @(#) $Id: regress.cal,v 30.6 2010/09/02 06:09:06 chongo Exp $
* @(#) $Source: /usr/local/src/bin/calc/cal/RCS/regress.cal,v $
*
* Under source code control: 1990/02/15 01:50:36
* File existed as early as: before 1990
@@ -1412,7 +1412,39 @@ define test_functions()
vrfy(isnum(systime()), '1206: isnum(systime())');
vrfy(isnum(usertime()), '1207: isnum(usertime())');
print '1208: Ending test_functions';
/* more jacobi tests */
vrfy(jacobi(987897,987) == 0, '1208: jacobi(987897,987) == 0');
vrfy(jacobi(897,987) == 0, '1209: jacobi(897,987) == 0');
vrfy(jacobi(987,897) == 0, '1210: jacobi(987,897) == 0');
vrfy(jacobi(90,897) == 0, '1211: jacobi(90,897) == 0');
vrfy(jacobi(45,897) == 0, '1212: jacobi(45,897) == 0');
vrfy(jacobi(897,45) == 0, '1213: jacobi(897,45) == 0');
vrfy(jacobi(42,45) == 0, '1214: jacobi(42,45) == 0');
vrfy(jacobi(21,45) == 0, '1215: jacobi(21,45) == 0');
vrfy(jacobi(45,21) == 0, '1216: jacobi(45,21) == 0');
vrfy(jacobi(3,21) == 0, '1217: jacobi(3,21) == 0');
vrfy(jacobi(0,21) == 0, '1218: jacobi(0,21) == 0');
vrfy(jacobi(0,20003) == 0, '1219: jacobi(0,20003) == 0');
vrfy(jacobi(1,20003) == 1, '1220: jacobi(1,20003) == 1');
vrfy(jacobi(1236,20003) == 1, '1221: jacobi(1236,20003) == 1');
vrfy(jacobi(618,20003) == -1, '1222: jacobi(618,20003) == -1');
vrfy(jacobi(309,20003) == 1, '1223: jacobi(309,20003) == 1');
vrfy(jacobi(227,309) == 1, '1224: jacobi(227,309) == 1');
vrfy(jacobi(82,227) == 1, '1225: jacobi(82,227) == 1');
vrfy(jacobi(41,227) == -1, '1226: jacobi(41,227) == -1');
vrfy(jacobi(22,41) == -1, '1227: jacobi(22,41) == -1');
vrfy(jacobi(11,41) == -1, '1228: jacobi(11,41) == -1');
vrfy(jacobi(8,11) == -1, '1229: jacobi(8,11) == -1');
vrfy(jacobi(4,11) == 1, '1230: jacobi(4,11) == 1');
vrfy(jacobi(2,11) == -1, '1231: jacobi(2,11) == -1');
vrfy(jacobi(1,11) == 1, '1232: jacobi(1,11) == 1');
vrfy(jacobi(0,11) == 0, '1233: jacobi(0,11) == 0');
vrfy(jacobi(0,0) == 0, '1234: jacobi(0,0) == 0');
vrfy(jacobi(-1,0) == 0, '1235: jacobi(-1,0) == 0');
vrfy(jacobi(-1,-1) == 0, '1236: jacobi(-1,-1) == 0');
vrfy(jacobi(0,-1) == 0, '1237: jacobi(0,-1) == 0');
print '1238: Ending test_functions';
}
print '017: parsed test_functions()';
@@ -2706,11 +2738,24 @@ define test_2600()
vrfy(log(1e127) == 127,
strcat(str(tnum++), ': log(1e127)) == 127'));
vrfy(round(log(17^47),10) == 57.8310993048,
strcat(str(tnum++),
': round(log(17^47),10) == 57.8310993048'));
strcat(str(tnum++),
': round(log(17^47),10) == 57.8310993048'));
vrfy(round(log(127),10) == 2.103803721,
strcat(str(tnum++),
': round(log(127),10) == 2.103803721'));
strcat(str(tnum++),
': round(log(127),10) == 2.103803721'));
vrfy(round(log(0.25,0.00001),5) == -0.60206,
strcat(str(tnum++),
': round(log(0.25,0.00001),5) == -0.60206'));
vrfy(round(log(0.25,1e-10),10) == -0.6020599913,
strcat(str(tnum++),
': round(log(0.25,1e-10),10) == -0.6020599913'));
vrfy(round( log(1.2+1.2i,1e-5),5) == 0.2297+0.34109i,
strcat(str(tnum++),
': round(log(1.2+1.2i,1e-5),5) == 0.2297+0.34109i'));
vrfy(round( log(1.2+1.2i,1e-10),10) == 0.2296962439+0.3410940885i,
strcat(str(tnum++),
': round(log(1.2+1.2i,1e-10),10) == ',
'0.2296962439+0.3410940885i'));
epsilon(i),;
print tnum++: ': epsilon(i),;';
@@ -7967,7 +8012,11 @@ print '9838: skipping read -once hello.cal because it is an infinite loop';
print '9839: skipping read -once xx_print.cal because it is a printing demo';
read -once sumtimes;
print '9840: read -once sumtimes';
print '9841: Ending read of selected calc resource files';
read -once dms;
print '9841: read -once dms';
read -once hms;
print '9842: read -once hms';
print '9843: Ending read of selected calc resource files';
/*

View File

@@ -19,7 +19,7 @@
*
* @(#) $Revision: 30.1 $
* @(#) $Id: repeat.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/repeat.cal,v $
* @(#) $Source: /usr/local/src/bin/calc/cal/RCS/repeat.cal,v $
*
* Under source code control: 2003/01/05 00:00:01
* File existed as early as: 2003

View File

@@ -17,7 +17,7 @@
*
* @(#) $Revision: 30.2 $
* @(#) $Id: screen.cal,v 30.2 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/screen.cal,v $
* @(#) $Source: /usr/local/src/bin/calc/cal/RCS/screen.cal,v $
*
* This file is not covered under version 2.1 of the GNU LGPL.
*

View File

@@ -19,7 +19,7 @@
*
* @(#) $Revision: 30.1 $
* @(#) $Id: seedrandom.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/seedrandom.cal,v $
* @(#) $Source: /usr/local/src/bin/calc/cal/RCS/seedrandom.cal,v $
*
* Under source code control: 1996/01/01 08:21:00
* File existed as early as: 1996

View File

@@ -19,7 +19,7 @@
*
* @(#) $Revision: 30.1 $
* @(#) $Id: set8700.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/set8700.cal,v $
* @(#) $Source: /usr/local/src/bin/calc/cal/RCS/set8700.cal,v $
*
* Under source code control: 2006/05/20 14:10:11
* File existed as early as: 2006

View File

@@ -19,7 +19,7 @@
##
## @(#) $Revision: 30.1 $
## @(#) $Id: set8700.line,v 30.1 2007/03/16 11:09:54 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/set8700.line,v $
## @(#) $Source: /usr/local/src/bin/calc/cal/RCS/set8700.line,v $
##
## Under source code control: 2006/05/20 14:10:11
## File existed as early as: 2006

View File

@@ -17,9 +17,9 @@
* received a copy with calc; if not, write to Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* @(#) $Revision: 30.1 $
* @(#) $Id: solve.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/solve.cal,v $
* @(#) $Revision: 30.2 $
* @(#) $Id: solve.cal,v 30.2 2008/05/10 13:30:00 chongo Exp $
* @(#) $Source: /usr/local/src/bin/calc/cal/RCS/solve.cal,v $
*
* Under source code control: 1990/02/15 01:50:37
* File existed as early as: before 1990
@@ -47,7 +47,7 @@ define solve(low, high, epsilon)
if (abs(flow) < epsilon)
return low;
fhigh = f(high);
if (abs(flow) < epsilon)
if (abs(fhigh) < epsilon)
return high;
if (sgn(flow) == sgn(fhigh))
quit "Non-opposite signs";

View File

@@ -19,7 +19,7 @@
*
* @(#) $Revision: 30.1 $
* @(#) $Id: sumsq.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/sumsq.cal,v $
* @(#) $Source: /usr/local/src/bin/calc/cal/RCS/sumsq.cal,v $
*
* Under source code control: 1990/02/15 01:50:37
* File existed as early as: before 1990

View File

@@ -19,7 +19,7 @@
*
* @(#) $Revision: 30.1 $
* @(#) $Id: sumtimes.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/sumtimes.cal,v $
* @(#) $Source: /usr/local/src/bin/calc/cal/RCS/sumtimes.cal,v $
*
* Under source code control: 2006/06/22 17:29
* File existed as early as: 2006

View File

@@ -19,7 +19,7 @@
*
* @(#) $Revision: 30.1 $
* @(#) $Id: surd.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/surd.cal,v $
* @(#) $Source: /usr/local/src/bin/calc/cal/RCS/surd.cal,v $
*
* Under source code control: 1990/02/15 01:50:38
* File existed as early as: before 1990

View File

@@ -19,7 +19,7 @@
*
* @(#) $Revision: 30.1 $
* @(#) $Id: test1700.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/test1700.cal,v $
* @(#) $Source: /usr/local/src/bin/calc/cal/RCS/test1700.cal,v $
*
* Under source code control: 1994/03/14 23:12:51
* File existed as early as: 1994

View File

@@ -19,7 +19,7 @@
*
* @(#) $Revision: 30.1 $
* @(#) $Id: test2300.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/test2300.cal,v $
* @(#) $Source: /usr/local/src/bin/calc/cal/RCS/test2300.cal,v $
*
* Under source code control: 1995/07/09 06:12:13
* File existed as early as: 1995

View File

@@ -21,7 +21,7 @@
*
* @(#) $Revision: 30.2 $
* @(#) $Id: test2600.cal,v 30.2 2007/07/11 22:57:23 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/test2600.cal,v $
* @(#) $Source: /usr/local/src/bin/calc/cal/RCS/test2600.cal,v $
*
* Under source code control: 1995/10/13 00:13:14
* File existed as early as: 1995

View File

@@ -21,7 +21,7 @@
*
* @(#) $Revision: 30.1 $
* @(#) $Id: test2700.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/test2700.cal,v $
* @(#) $Source: /usr/local/src/bin/calc/cal/RCS/test2700.cal,v $
*
* Under source code control: 1995/11/01 22:52:25
* File existed as early as: 1995

View File

@@ -21,7 +21,7 @@
*
* @(#) $Revision: 30.1 $
* @(#) $Id: test3100.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/test3100.cal,v $
* @(#) $Source: /usr/local/src/bin/calc/cal/RCS/test3100.cal,v $
*
* Under source code control: 1995/11/28 11:56:57
* File existed as early as: 1995

View File

@@ -21,7 +21,7 @@
*
* @(#) $Revision: 30.1 $
* @(#) $Id: test3300.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/test3300.cal,v $
* @(#) $Source: /usr/local/src/bin/calc/cal/RCS/test3300.cal,v $
*
* Under source code control: 1995/12/02 04:27:41
* File existed as early as: 1995

View File

@@ -21,7 +21,7 @@
*
* @(#) $Revision: 30.1 $
* @(#) $Id: test3400.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/test3400.cal,v $
* @(#) $Source: /usr/local/src/bin/calc/cal/RCS/test3400.cal,v $
*
* Under source code control: 1995/12/02 05:20:11
* File existed as early as: 1995

View File

@@ -21,7 +21,7 @@
*
* @(#) $Revision: 30.1 $
* @(#) $Id: test3500.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/test3500.cal,v $
* @(#) $Source: /usr/local/src/bin/calc/cal/RCS/test3500.cal,v $
*
* Under source code control: 1995/12/18 22:50:46
* File existed as early as: 1995

View File

@@ -21,7 +21,7 @@
*
* @(#) $Revision: 30.1 $
* @(#) $Id: test4000.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/test4000.cal,v $
* @(#) $Source: /usr/local/src/bin/calc/cal/RCS/test4000.cal,v $
*
* Under source code control: 1996/03/13 02:38:45
* File existed as early as: 1996

View File

@@ -21,7 +21,7 @@
*
* @(#) $Revision: 30.1 $
* @(#) $Id: test4100.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/test4100.cal,v $
* @(#) $Source: /usr/local/src/bin/calc/cal/RCS/test4100.cal,v $
*
* Under source code control: 1996/03/13 03:53:22
* File existed as early as: 1996

View File

@@ -21,7 +21,7 @@
*
* @(#) $Revision: 30.1 $
* @(#) $Id: test4600.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/test4600.cal,v $
* @(#) $Source: /usr/local/src/bin/calc/cal/RCS/test4600.cal,v $
*
* Under source code control: 1996/07/02 20:04:40
* File existed as early as: 1996

View File

@@ -21,7 +21,7 @@
*
* @(#) $Revision: 30.1 $
* @(#) $Id: test5100.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/test5100.cal,v $
* @(#) $Source: /usr/local/src/bin/calc/cal/RCS/test5100.cal,v $
*
* Under source code control: 1996/12/02 23:57:10
* File existed as early as: 1996

View File

@@ -21,7 +21,7 @@
*
* @(#) $Revision: 30.1 $
* @(#) $Id: test5200.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/test5200.cal,v $
* @(#) $Source: /usr/local/src/bin/calc/cal/RCS/test5200.cal,v $
*
* Under source code control: 1997/02/07 02:48:10
* File existed as early as: 1997

View File

@@ -19,7 +19,7 @@
*
* @(#) $Revision: 30.1 $
* @(#) $Id: test8400.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/test8400.cal,v $
* @(#) $Source: /usr/local/src/bin/calc/cal/RCS/test8400.cal,v $
*
* Under source code control: 1999/10/31 01:00:03
* File existed as early as: 1999

View File

@@ -21,7 +21,7 @@
*
* @(#) $Revision: 30.1 $
* @(#) $Id: test8500.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/test8500.cal,v $
* @(#) $Source: /usr/local/src/bin/calc/cal/RCS/test8500.cal,v $
*
* Under source code control: 1999/11/12 20:59:59
* File existed as early as: 1999

View File

@@ -21,7 +21,7 @@
*
* @(#) $Revision: 30.1 $
* @(#) $Id: test8600.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/test8600.cal,v $
* @(#) $Source: /usr/local/src/bin/calc/cal/RCS/test8600.cal,v $
*
* Under source code control: 2000/12/04 19:57:02
* File existed as early as: 2000

View File

@@ -19,7 +19,7 @@
*
* @(#) $Revision: 30.1 $
* @(#) $Id: unitfrac.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/unitfrac.cal,v $
* @(#) $Source: /usr/local/src/bin/calc/cal/RCS/unitfrac.cal,v $
*
* Under source code control: 1990/02/15 01:50:38
* File existed as early as: before 1990

View File

@@ -19,7 +19,7 @@
*
* @(#) $Revision: 30.1 $
* @(#) $Id: varargs.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/varargs.cal,v $
* @(#) $Source: /usr/local/src/bin/calc/cal/RCS/varargs.cal,v $
*
* Under source code control: 1991/05/22 21:56:34
* File existed as early as: 1991

View File

@@ -19,7 +19,7 @@
*
* @(#) $Revision: 30.1 $
* @(#) $Id: xx_print.cal,v 30.1 2007/03/16 11:09:54 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/xx_print.cal,v $
* @(#) $Source: /usr/local/src/bin/calc/cal/RCS/xx_print.cal,v $
*
* Under source code control: 1997/04/17 00:08:50
* File existed as early as: 1997

13
calc.c
View File

@@ -1,7 +1,7 @@
/*
* calc - arbitrary precision calculator
*
* Copyright (C) 1999-2007 David I. Bell, Landon Curt Noll and Ernest Bowen
* Copyright (C) 1999-2013 David I. Bell, Landon Curt Noll and Ernest Bowen
*
* Primary author: David I. Bell
*
@@ -19,9 +19,9 @@
* received a copy with calc; if not, write to Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* @(#) $Revision: 30.3 $
* @(#) $Id: calc.c,v 30.3 2007/07/15 02:03:42 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/calc.c,v $
* @(#) $Revision: 30.6 $
* @(#) $Id: calc.c,v 30.6 2013/03/25 21:39:57 chongo Exp $
* @(#) $Source: /usr/local/src/bin/calc/RCS/calc.c,v $
*
* Under source code control: 1990/02/15 01:48:11
* File existed as early as: before 1990
@@ -42,6 +42,7 @@
#if defined(_WIN32)
# include <io.h>
# if !defined(NOTCYGWIN)
/*
* getopt.h file is from the Cygwin GNU library
*
@@ -49,6 +50,7 @@
* http://sources.redhat.com/cygwin/
*/
# include "../getopt/getopt.h"
# endif
# define strdup _strdup
# define isatty _isatty
#endif /* Windoz */
@@ -485,6 +487,9 @@ main(int argc, char **argv)
if (havecommands) {
cmdbuf[cmdlen++] = '\n';
cmdbuf[cmdlen] = '\0';
if (fclose(stdin)) {
perror("main(): fclose(stdin) failed:");
}
}
argc_value = argc - maxindex;

2
calc.h
View File

@@ -19,7 +19,7 @@
*
* @(#) $Revision: 30.2 $
* @(#) $Id: calc.h,v 30.2 2007/07/10 17:44:52 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/calc.h,v $
* @(#) $Source: /usr/local/src/bin/calc/RCS/calc.h,v $
*
* Under source code control: 1990/02/15 01:48:31
* File existed as early as: before 1990

View File

@@ -15,9 +15,9 @@
.\" received a copy with calc; if not, write to Free Software Foundation, Inc.
.\" 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
.\"
.\" @(#) $Revision: 30.2 $
.\" @(#) $Id: calc.man,v 30.2 2007/08/18 17:28:29 chongo Exp $
.\" @(#) $Source: /usr/local/src/cmd/calc/RCS/calc.man,v $
.\" @(#) $Revision: 30.3 $
.\" @(#) $Id: calc.man,v 30.3 2007/09/08 02:53:09 chongo Exp $
.\" @(#) $Source: /usr/local/src/bin/calc/RCS/calc.man,v $
.\"
.\" Under source code control: 1991/07/23 05:48:26
.\" File existed as early as: 1991
@@ -275,18 +275,14 @@ See
.TP
.B \-i
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
.B calc
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
For example:
.sp 1

View File

@@ -2,7 +2,7 @@
#
# calc.spec.in - template specfile for calc
#
# Copyright (C) 2003-2007 Petteri Kettunen and Landon Curt Noll
# Copyright (C) 2003-2013 Petteri Kettunen and Landon Curt Noll
#
# Calc is open software; you can redistribute it and/or modify it under
# the terms of the version 2.1 of the GNU Lesser General Public License
@@ -18,9 +18,9 @@
# received a copy with calc; if not, write to Free Software Foundation, Inc.
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# @(#) $Revision: 30.5 $
# @(#) $Id: calc.spec.in,v 30.5 2007/09/06 06:13:46 chongo Exp $
# @(#) $Source: /usr/local/src/cmd/calc/RCS/calc.spec.in,v $
# @(#) $Revision: 30.10 $
# @(#) $Id: calc.spec.in,v 30.10 2013/05/05 11:57:44 chongo Exp $
# @(#) $Source: /usr/local/src/bin/calc/RCS/calc.spec.in,v $
#
# Under source code control: 2003/02/16 20:21:39
# File existed as early as: 2003
@@ -37,14 +37,16 @@
Summary: Arbitrary precision calculator.
Name: calc
Version: <<<PROJECT_VERSION>>>
Release: 1.1
Release: 10
License: LGPL
Group: Applications/Engineering
Source: %{name}-%{version}.tar.gz
Source: http://www.isthe.com/chongo/src/calc/%{name}-%{version}.tar.bz2
URL: http://www.isthe.com/chongo/tech/comp/calc/index.html
Requires: ncurses >= 5.2-26, readline >= 4.2, less >= 358
BuildRequires: ncurses-devel >= 5.2-26, readline-devel >= 4.2
BuildRoot: %{_tmppath}/%{name}-root
Vendor: Landon Noll and Associates
Packager: Landon Noll and Associates (http://www.isthe.com/chongo/index.html)
Requires: ncurses >= 5.5-24, readline >= 5.1-3, less >= 358
BuildRequires: ncurses-devel >= 5.5-24, readline-devel >= 5.1-3
BuildRoot: %{_tmppath}/build-root
%description
Calc is arbitrary precision C-like arithmetic system that is a
@@ -58,8 +60,8 @@ For the latest calc release, see the calc project home page:
%package devel
Summary: Development files and documentation for calc.
Group: Development/Libraries
PreReq: %{name} = %{version}-%{release}
Group: Applications/Engineering
Requires: calc = %{version}-%{release}
%description devel
This package contains the header files and static libraries for developing
@@ -70,46 +72,46 @@ For the latest calc release, see the project home page:
http://www.isthe.com/chongo/tech/comp/calc/index.html
%prep
%setup -q
%setup -T -b 0
%build
echo '-=- calc.spec beginning make clobber -=-'
make %{?_smp_mflags} T=%{buildroot} BINDIR=%{_bindir} LIBDIR=%{_libdir} CALC_SHAREDIR=%{_datadir}/%{name} CALC_INCDIR=%{_includedir}/calc MANDIR=%{_mandir}/man1 EXT= V=@ clobber
make %{?_smp_mflags} T=%{_buildroot} BINDIR=%{_bindir} LIBDIR=%{_libdir} CALC_SHAREDIR=%{_datadir}/%{name} CALC_INCDIR=%{_includedir}/calc MANDIR=%{_mandir}/man1 EXT= V=@ clobber
echo '-=- calc.spec ending make clobber -=-'
echo '-=- calc.spec beginning make calc-static-only -=-'
make %{?_smp_mflags} T=%{buildroot} BINDIR=%{_bindir} LIBDIR=%{_libdir} CALC_SHAREDIR=%{_datadir}/%{name} CALC_INCDIR=%{_includedir}/calc MANDIR=%{_mandir}/man1 EXT= V=@ calc-static-only BLD_TYPE=calc-static-only
make %{?_smp_mflags} T=%{_buildroot} BINDIR=%{_bindir} LIBDIR=%{_libdir} CALC_SHAREDIR=%{_datadir}/%{name} CALC_INCDIR=%{_includedir}/calc MANDIR=%{_mandir}/man1 EXT= V=@ calc-static-only BLD_TYPE=calc-static-only
echo '-=- calc.spec ending make calc-static-only -=-'
echo '-=- calc.spec beginning make rpm-hide-static -=-'
make %{?_smp_mflags} T=%{buildroot} BINDIR=%{_bindir} LIBDIR=%{_libdir} CALC_SHAREDIR=%{_datadir}/%{name} CALC_INCDIR=%{_includedir}/calc MANDIR=%{_mandir}/man1 EXT= V=@ rpm-hide-static
make %{?_smp_mflags} T=%{_buildroot} BINDIR=%{_bindir} LIBDIR=%{_libdir} CALC_SHAREDIR=%{_datadir}/%{name} CALC_INCDIR=%{_includedir}/calc MANDIR=%{_mandir}/man1 EXT= V=@ rpm-hide-static
echo '-=- calc.spec ending make rpm-hide-static -=-'
echo '-=- calc.spec beginning make clobber (again) -=-'
make %{?_smp_mflags} T=%{buildroot} BINDIR=%{_bindir} LIBDIR=%{_libdir} CALC_SHAREDIR=%{_datadir}/%{name} CALC_INCDIR=%{_includedir}/calc MANDIR=%{_mandir}/man1 EXT= V=@ clobber
make %{?_smp_mflags} T=%{_buildroot} BINDIR=%{_bindir} LIBDIR=%{_libdir} CALC_SHAREDIR=%{_datadir}/%{name} CALC_INCDIR=%{_includedir}/calc MANDIR=%{_mandir}/man1 EXT= V=@ clobber
echo '-=- calc.spec ending make clobber (again) -=-'
echo '-=- calc.spec beginning make calc-dynamic-only -=-'
make %{?_smp_mflags} T=%{buildroot} BINDIR=%{_bindir} LIBDIR=%{_libdir} CALC_SHAREDIR=%{_datadir}/%{name} CALC_INCDIR=%{_includedir}/calc MANDIR=%{_mandir}/man1 EXT= V=@ calc-dynamic-only BLD_TYPE=calc-dynamic-only LD_SHARE=
make %{?_smp_mflags} T=%{_buildroot} BINDIR=%{_bindir} LIBDIR=%{_libdir} CALC_SHAREDIR=%{_datadir}/%{name} CALC_INCDIR=%{_includedir}/calc MANDIR=%{_mandir}/man1 EXT= V=@ calc-dynamic-only BLD_TYPE=calc-dynamic-only LD_SHARE=
echo '-=- calc.spec ending make calc-dynamic-only -=-'
echo '-=- calc.spec beginning make chk -=-'
make %{?_smp_mflags} T=%{buildroot} BINDIR=%{_bindir} LIBDIR=%{_libdir} CALC_SHAREDIR=%{_datadir}/%{name} CALC_INCDIR=%{_includedir}/calc MANDIR=%{_mandir}/man1 EXT= V=@ chk
make %{?_smp_mflags} T=%{_buildroot} BINDIR=%{_bindir} LIBDIR=%{_libdir} CALC_SHAREDIR=%{_datadir}/%{name} CALC_INCDIR=%{_includedir}/calc MANDIR=%{_mandir}/man1 EXT= V=@ chk
echo '-=- calc.spec ending make chk -=-'
echo '-=- calc.spec beginning make rpm-unhide-static -=-'
make %{?_smp_mflags} T=%{buildroot} BINDIR=%{_bindir} LIBDIR=%{_libdir} CALC_SHAREDIR=%{_datadir}/%{name} CALC_INCDIR=%{_includedir}/calc MANDIR=%{_mandir}/man1 EXT= V=@ rpm-unhide-static
make %{?_smp_mflags} T=%{_buildroot} BINDIR=%{_bindir} LIBDIR=%{_libdir} CALC_SHAREDIR=%{_datadir}/%{name} CALC_INCDIR=%{_includedir}/calc MANDIR=%{_mandir}/man1 EXT= V=@ rpm-unhide-static
echo '-=- calc.spec ending make rpm-unhide-static -=-'
echo '-=- calc.spec beginning make rpm-clean-static -=-'
make %{?_smp_mflags} T=%{buildroot} BINDIR=%{_bindir} LIBDIR=%{_libdir} CALC_SHAREDIR=%{_datadir}/%{name} CALC_INCDIR=%{_includedir}/calc MANDIR=%{_mandir}/man1 EXT= V=@ rpm-clean-static
make %{?_smp_mflags} T=%{_buildroot} BINDIR=%{_bindir} LIBDIR=%{_libdir} CALC_SHAREDIR=%{_datadir}/%{name} CALC_INCDIR=%{_includedir}/calc MANDIR=%{_mandir}/man1 EXT= V=@ rpm-clean-static
echo '-=- calc.spec ending make rpm-clean-static -=-'
echo '-=- calc.spec beginning make rpm-chk-static -=-'
make %{?_smp_mflags} T=%{buildroot} BINDIR=%{_bindir} LIBDIR=%{_libdir} CALC_SHAREDIR=%{_datadir}/%{name} CALC_INCDIR=%{_includedir}/calc MANDIR=%{_mandir}/man1 EXT= V=@ rpm-chk-static
make %{?_smp_mflags} T=%{_buildroot} BINDIR=%{_bindir} LIBDIR=%{_libdir} CALC_SHAREDIR=%{_datadir}/%{name} CALC_INCDIR=%{_includedir}/calc MANDIR=%{_mandir}/man1 EXT= V=@ rpm-chk-static
echo '-=- calc.spec ending make rpm-chk-static -=-'
%install
rm -rf %{buildroot}
mkdir -p %{buildroot}
echo '-=- calc.spec beginning make install -=-'
make T=%{buildroot} BINDIR=%{_bindir} LIBDIR=%{_libdir} CALC_SHAREDIR=%{_datadir}/%{name} CALC_INCDIR=%{_includedir}/calc MANDIR=%{_mandir}/man1 EXT= V=@ install
rm -rf %{_buildroot}
mkdir -p %{_buildroot}
make T=%{_buildroot} BINDIR=%{_bindir} LIBDIR=%{_libdir} CALC_SHAREDIR=%{_datadir}/%{name} CALC_INCDIR=%{_includedir}/calc MANDIR=%{_mandir}/man1 EXT= V=@ install
echo '-=- calc.spec ending make install -=-'
%clean
rm -rf %{buildroot}
rm -rf %{_buildroot}
%files
%defattr(-, root, root)
@@ -124,8 +126,10 @@ rm -rf %{buildroot}
%attr(644, root, root) %{_datadir}/%{name}/help/*
%attr(644, root, root) %{_datadir}/%{name}/*.cal
%attr(644, root, root) %{_datadir}/%{name}/*.line
%attr(644, root, root) %{_libdir}/libcalc.so.%{version}
%attr(644, root, root) %{_libdir}/libcustcalc.so.%{version}
%attr(644, root, root) %{_libdir}/libcalc.so
%attr(644, root, root) %{_libdir}/libcalc.so.*
%attr(644, root, root) %{_libdir}/libcustcalc.so
%attr(644, root, root) %{_libdir}/libcustcalc.so.*
%files devel
%defattr(-, root, root)
@@ -136,28 +140,49 @@ rm -rf %{buildroot}
%attr(644, root, root) %{_libdir}/libcustcalc.a
%changelog
* Sat May 05 2013 Landon Curt Noll http://www.isthe.com/chongo
- Release: 10
- Major bug rpm build process bug fix
- Source: is a URL as per rpm requirements
- Requires: ncurses >= 5.5-24, readline >= 5.1-3, less >= 358
- BuildRequires: ncurses-devel >= 5.5-24, readline-devel >= 5.1-3
- BuildRoot: %{_tmppath}/build-root
- Fixed use of %{_buildroot}
- Fixed permissions so that rpm build services can modify libraries
- Added missing files to files section
* Mon Mar 25 2013 Landon Curt Noll http://www.isthe.com/chongo
- Release: 9 (was 1.1)
- Removed deprecated PreReq for calc-devel, using Requires
* Sun Sep 01 2007 Landon Curt Noll http://www.isthe.com/chongo
- Release: 8
- Release of calc-2.12.2
- Calc builds with shared libraries
* Sun Jun 25 2006 Landon Curt Noll http://www.isthe.com/chongo
- Release: 7
- Changed Copyright to License as per new rpm v4.4 syntax
* Sun May 20 2006 Landon Curt Noll http://www.isthe.com/chongo
- Release: 6
- Release of calc-2.12.0
- Added *.line set files to the list of packaged files
* Sun Dec 11 2005 Landon Curt Noll http://www.isthe.com/chongo
- Release: 5
- Release of calc-2.11.11
- Fixed description in spec file
* Wed Feb 26 2003 Landon Curt Noll http://www.isthe.com/chongo
- Release: 4
- Release of calc-2.11.7-2
- Fixed attributes on include and lib calc-devel files
- Added BUGS to calc-devel as well as calc
* Tue Feb 25 2003 Landon Curt Noll http://www.isthe.com/chongo
- Release: 3
- Release of calc-2.11.7-1
- Require ncurses, readline and less to install.
- Require ncurses-devel and readline-devel to build.
* Tue Feb 18 2003 Landon Curt Noll http://www.isthe.com/chongo
- Release: 2
- Misc changes to fit local directory setup
* Sun Feb 16 2003 Petteri Kettunen <petterik@users.sourceforge.net>
- Release: 1
- initial RPM build
#****

View File

@@ -19,7 +19,7 @@
#
# @(#) $Revision: 30.1 $
# @(#) $Id: calcerr.tbl,v 30.1 2007/03/16 11:09:46 chongo Exp $
# @(#) $Source: /usr/local/src/cmd/calc/RCS/calcerr.tbl,v $
# @(#) $Source: /usr/local/src/bin/calc/RCS/calcerr.tbl,v $
#
# Under source code control: 1996/05/23 17:38:44
# File existed as early as: 1996

View File

@@ -20,7 +20,7 @@
#
# @(#) $Revision: 30.1 $
# @(#) $Id: calcerr_c.awk,v 30.1 2007/03/16 11:09:46 chongo Exp $
# @(#) $Source: /usr/local/src/cmd/calc/RCS/calcerr_c.awk,v $
# @(#) $Source: /usr/local/src/bin/calc/RCS/calcerr_c.awk,v $
#
# Under source code control: 1996/05/24 03:15:35
# File existed as early as: 1996

View File

@@ -20,7 +20,7 @@
#
# @(#) $Revision: 30.1 $
# @(#) $Id: calcerr_c.sed,v 30.1 2007/03/16 11:09:46 chongo Exp $
# @(#) $Source: /usr/local/src/cmd/calc/RCS/calcerr_c.sed,v $
# @(#) $Source: /usr/local/src/bin/calc/RCS/calcerr_c.sed,v $
#
# Under source code control: 1996/05/24 03:15:35
# File existed as early as: 1996

View File

@@ -20,7 +20,7 @@
#
# @(#) $Revision: 30.1 $
# @(#) $Id: calcerr_h.awk,v 30.1 2007/03/16 11:09:46 chongo Exp $
# @(#) $Source: /usr/local/src/cmd/calc/RCS/calcerr_h.awk,v $
# @(#) $Source: /usr/local/src/bin/calc/RCS/calcerr_h.awk,v $
#
# Under source code control: 1996/05/23 17:38:44
# File existed as early as: 1996

View File

@@ -20,7 +20,7 @@
#
# @(#) $Revision: 30.1 $
# @(#) $Id: calcerr_h.sed,v 30.1 2007/03/16 11:09:46 chongo Exp $
# @(#) $Source: /usr/local/src/cmd/calc/RCS/calcerr_h.sed,v $
# @(#) $Source: /usr/local/src/bin/calc/RCS/calcerr_h.sed,v $
#
# Under source code control: 1996/05/23 17:38:44
# File existed as early as: 1996

View File

@@ -20,7 +20,7 @@
#
# @(#) $Revision: 30.1 $
# @(#) $Id: check.awk,v 30.1 2007/03/16 11:09:46 chongo Exp $
# @(#) $Source: /usr/local/src/cmd/calc/RCS/check.awk,v $
# @(#) $Source: /usr/local/src/bin/calc/RCS/check.awk,v $
#
# Under source code control: 1996/05/25 22:07:58
# File existed as early as: 1996

View File

@@ -19,7 +19,7 @@
*
* @(#) $Revision: 30.1 $
* @(#) $Id: cmath.h,v 30.1 2007/03/16 11:09:46 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/cmath.h,v $
* @(#) $Source: /usr/local/src/bin/calc/RCS/cmath.h,v $
*
* Under source code control: 1993/07/30 19:42:45
* File existed as early as: 1993

View File

@@ -21,7 +21,7 @@
*
* @(#) $Revision: 30.2 $
* @(#) $Id: codegen.c,v 30.2 2007/07/05 13:30:38 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/codegen.c,v $
* @(#) $Source: /usr/local/src/bin/calc/RCS/codegen.c,v $
*
* Under source code control: 1990/02/15 01:48:13
* File existed as early as: before 1990

View File

@@ -19,9 +19,9 @@
* received a copy with calc; if not, write to Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* @(#) $Revision: 30.2 $
* @(#) $Id: comfunc.c,v 30.2 2007/07/11 23:05:49 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/comfunc.c,v $
* @(#) $Revision: 30.3 $
* @(#) $Id: comfunc.c,v 30.3 2008/10/24 07:09:41 chongo Exp $
* @(#) $Source: /usr/local/src/bin/calc/RCS/comfunc.c,v $
*
* Under source code control: 1990/02/15 01:48:13
* File existed as early as: before 1990
@@ -556,7 +556,7 @@ c_log(COMPLEX *c, NUMBER *epsilon)
if (cln_10_epsilon == NULL) {
/* first time call */
cln_10_epsilon = qcopy(epsilon);
} else if (qcmp(cln_10_epsilon, epsilon) == FALSE) {
} else if (qcmp(cln_10_epsilon, epsilon) == TRUE) {
/* replaced cacheed value with epsilon arg */
qfree(cln_10_epsilon);
cln_10_epsilon = qcopy(epsilon);

Some files were not shown because too many files have changed in this diff Show More