Release calc version 2.12.4.2

This commit is contained in:
Landon Curt Noll
2010-09-01 23:40:12 -07:00
parent a407c7d197
commit e229393250
26 changed files with 1253 additions and 208 deletions

67
CHANGES
View File

@@ -1,4 +1,65 @@
The following are the changes from calc version 2.12.3.0 to date:
The following are the changes from calc version 2.12.4.0 to date:
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.
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)
@@ -6734,8 +6795,8 @@ Following is a list of visible changes to calc from version 1.24.7 to 1.26.1:
## received a copy with calc; if not, write to Free Software Foundation, Inc.
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
##
## @(#) $Revision: 30.17 $
## @(#) $Id: CHANGES,v 30.17 2008/05/10 10:53:34 chongo Exp $
## @(#) $Revision: 30.20 $
## @(#) $Id: CHANGES,v 30.20 2010/09/02 06:36:48 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/RCS/CHANGES,v $
##
## Under source code control: 1993/06/02 18:12:57

18
COPYING
View File

@@ -6,14 +6,14 @@ 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 $
# @(#) $Revision: 30.2 $
# @(#) $Id: COPYING,v 30.2 2008/10/24 10:46:52 chongo Exp $
# @(#) $Source: /usr/local/src/cmd/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

@@ -23,7 +23,7 @@
# 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
@@ -39,8 +39,8 @@
# received a copy with calc; if not, write to Free Software Foundation, Inc.
# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
#
MAKEFILE_REV= $$Revision: 30.35 $$
# @(#) $Id: Makefile.ship,v 30.35 2008/05/10 11:58:05 chongo Exp $
MAKEFILE_REV= $$Revision: 30.44 $$
# @(#) $Id: Makefile.ship,v 30.44 2010/09/02 06:07:07 chongo Exp $
# @(#) $Source: /usr/local/src/cmd/calc/RCS/Makefile.ship,v $
#
# Under source code control: 1990/02/15 01:48:41
@@ -598,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
@@ -971,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=
#
@@ -984,8 +997,8 @@ EXT=
# The default calc versions
#
VERSION= 2.12.3.3
VERS= 2.12.3
VERSION= 2.12.4.2
VERS= 2.12.4
VER= 2.12
VE= 2
@@ -1322,6 +1335,40 @@ 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=
LIBCUSTCALC_STATIC=
LD_STATIC=
#
CCWARN= -Wall -W -Wno-comment
CCWERR=
CCOPT= ${DEBUG}
CCMISC=
#
LCC= gcc
CC= ${PURIFY} ${LCC} ${CCWERR}
#
endif
#######################################################
# simple target - values used to form Makefile.simple #
#######################################################
@@ -1814,7 +1861,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
#
@@ -1913,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}
@@ -4043,9 +4093,6 @@ debug: env
# 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
#
@@ -4057,9 +4104,6 @@ debug: env
run:
${CALC_ENV} ./calc${EXT}
cvd:
${CALC_ENV} cvd ./calc${EXT}
dbx:
${CALC_ENV} dbx ./calc${EXT}

View File

@@ -23,7 +23,7 @@
# 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
@@ -39,8 +39,8 @@
# received a copy with calc; if not, write to Free Software Foundation, Inc.
# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
#
MAKEFILE_REV= $$Revision: 30.35 $$
# @(#) $Id: Makefile.ship,v 30.35 2008/05/10 11:58:05 chongo Exp $
MAKEFILE_REV= $$Revision: 30.44 $$
# @(#) $Id: Makefile.ship,v 30.44 2010/09/02 06:07:07 chongo Exp $
# @(#) $Source: /usr/local/src/cmd/calc/RCS/Makefile.ship,v $
#
# Under source code control: 1990/02/15 01:48:41
@@ -583,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
@@ -948,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=
#
@@ -961,8 +974,8 @@ EXT=
# The default calc versions
#
VERSION= 2.12.3.3
VERS= 2.12.3
VERSION= 2.12.4.2
VERS= 2.12.4
VER= 2.12
VE= 2
@@ -1462,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
#
@@ -1528,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}
@@ -3614,9 +3630,6 @@ debug: env
# 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
#
@@ -3628,9 +3641,6 @@ debug: env
run:
${CALC_ENV} ./calc${EXT}
cvd:
${CALC_ENV} cvd ./calc${EXT}
dbx:
${CALC_ENV} dbx ./calc${EXT}

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,8 +142,8 @@ 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 $
## @(#) $Revision: 30.2 $
## @(#) $Id: README.WINDOWS,v 30.2 2009/03/14 02:29:31 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/RCS/README.WINDOWS,v $
##
## Under source code control: 2001/02/25 14:00:05

View File

@@ -18,8 +18,8 @@
# received a copy with calc; if not, write to Free Software Foundation, Inc.
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# @(#) $Revision: 30.3 $
# @(#) $Id: Makefile,v 30.3 2007/09/21 01:27:27 chongo Exp $
# @(#) $Revision: 30.4 $
# @(#) $Id: Makefile,v 30.4 2010/09/02 06:01:39 chongo Exp $
# @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/Makefile,v $
#
# Under source code control: 1991/07/21 05:00:54
@@ -193,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
# 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
@@ -285,6 +308,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,8 +1058,8 @@ 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 $
## @(#) $Revision: 30.2 $
## @(#) $Id: README,v 30.2 2010/09/02 06:01:39 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/README,v $
##
## Under source code control: 1990/02/15 01:50:32

View File

@@ -17,8 +17,8 @@
* 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 $
* @(#) $Revision: 30.2 $
* @(#) $Id: deg.cal,v 30.2 2010/09/02 06:01:14 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/deg.cal,v $
*
* Under source code control: 1990/02/15 01:50:33
@@ -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/cmd/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";
}

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/cmd/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

@@ -17,8 +17,8 @@
* 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.4 $
* @(#) $Id: regress.cal,v 30.4 2008/02/24 07:41:49 chongo Exp $
* @(#) $Revision: 30.6 $
* @(#) $Id: regress.cal,v 30.6 2010/09/02 06:09:06 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/regress.cal,v $
*
* Under source code control: 1990/02/15 01:50:36
@@ -2738,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),;';
@@ -7999,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

@@ -17,8 +17,8 @@
* 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 $
* @(#) $Revision: 30.2 $
* @(#) $Id: solve.cal,v 30.2 2008/05/10 13:30:00 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/solve.cal,v $
*
* Under source code control: 1990/02/15 01:50:37
@@ -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,8 +19,8 @@
* 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 $
* @(#) $Revision: 30.3 $
* @(#) $Id: comfunc.c,v 30.3 2008/10/24 07:09:41 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/comfunc.c,v $
*
* Under source code control: 1990/02/15 01:48:13
@@ -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);

View File

@@ -18,8 +18,8 @@
# 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.18 $
# @(#) $Id: Makefile.head,v 30.18 2008/05/10 11:58:05 chongo Exp $
# @(#) $Revision: 30.21 $
# @(#) $Id: Makefile.head,v 30.21 2008/11/05 17:38:01 chongo Exp $
# @(#) $Source: /usr/local/src/cmd/calc/custom/RCS/Makefile.head,v $
#
# Under source code control: 1997/03/09 02:28:54
@@ -366,8 +366,8 @@ EXT=
# The default calc versions
#
VERSION= 2.12.3.3
VERS= 2.12.3
VERSION= 2.12.4.2
VERS= 2.12.4
VER= 2.12
VE= 2
@@ -711,6 +711,40 @@ 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=
LIBCUSTCALC_STATIC=
LD_STATIC=
#
CCWARN= -Wall -W -Wno-comment
CCWERR=
CCOPT= ${DEBUG}
CCMISC=
#
LCC= gcc
CC= ${PURIFY} ${LCC} ${CCWERR}
#
endif
#######################################################
# simple target - values used to form Makefile.simple #
#######################################################

View File

@@ -18,8 +18,8 @@
# 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.18 $
# @(#) $Id: Makefile.head,v 30.18 2008/05/10 11:58:05 chongo Exp $
# @(#) $Revision: 30.21 $
# @(#) $Id: Makefile.head,v 30.21 2008/11/05 17:38:01 chongo Exp $
# @(#) $Source: /usr/local/src/cmd/calc/custom/RCS/Makefile.head,v $
#
# Under source code control: 1997/03/09 02:28:54
@@ -366,8 +366,8 @@ EXT=
# The default calc versions
#
VERSION= 2.12.3.3
VERS= 2.12.3
VERSION= 2.12.4.2
VERS= 2.12.4
VER= 2.12
VE= 2

View File

@@ -18,8 +18,8 @@
# 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.18 $
# @(#) $Id: Makefile.head,v 30.18 2008/05/10 11:58:05 chongo Exp $
# @(#) $Revision: 30.21 $
# @(#) $Id: Makefile.head,v 30.21 2008/11/05 17:38:01 chongo Exp $
# @(#) $Source: /usr/local/src/cmd/calc/custom/RCS/Makefile.head,v $
#
# Under source code control: 1997/03/09 02:28:54
@@ -351,8 +351,8 @@ EXT=
# The default calc versions
#
VERSION= 2.12.3.3
VERS= 2.12.3
VERSION= 2.12.4.2
VERS= 2.12.4
VER= 2.12
VE= 2

View File

@@ -128,58 +128,72 @@ Using objects
The following is a list of the operations possible for objects.
The 'xx' in each function name is replaced with the actual object
type name. This table is displayed by the 'show objfuncs' command.
type name. This table is displayed by the 'show objfunctions' command.
Name Args Comments
xx_print 1 print value, default prints elements
xx_one 1 multiplicative identity, default is 1
xx_test 1 logical test (false,true => 0,1),
default tests elements
xx_add 2
xx_sub 2 subtraction, default adds negative
xx_neg 1 negative
xx_mul 2
xx_div 2 non-integral division, default multiplies
by inverse
xx_inv 1 multiplicative inverse
xx_abs 2 absolute value within given error
xx_norm 1 square of absolute value
xx_conj 1 conjugate
xx_pow 2 integer power, default does multiply,
square, inverse
xx_sgn 1 sign of value (-1, 0, 1)
xx_cmp 2 equality (equal,non-equal => 0,1),
default tests elements
xx_rel 2 inequality (less,equal,greater => -1,0,1)
xx_quo 2 integer quotient
xx_mod 2 remainder of division
xx_int 1 integer part
xx_frac 1 fractional part
xx_inc 1 increment, default adds 1
xx_dec 1 decrement, default subtracts 1
xx_square 1 default multiplies by itself
xx_scale 2 multiply by power of 2
xx_shift 2 shift left by n bits (right if negative)
xx_round 2 round to given number of decimal places
xx_bround 2 round to given number of binary places
xx_root 3 root of value within given error
xx_sqrt 2 square root within given error
xx_or 2 boolean or
xx_and 2 boolean and
xx_not 1 boolean not
xx_fact 1 factorial
xx_print 1 print value, default prints elements
xx_one 1 multiplicative identity, default is 1
xx_test 1 logical test (false,true => 0,1), default tests elements
xx_add 2
xx_sub 2
xx_neg 1 negative
xx_mul 2
xx_div 2 non-integral division
xx_inv 1 multiplicative inverse
xx_abs 2 absolute value within given error
xx_norm 1 square of absolute value
xx_conj 1 conjugate
xx_pow 2 integer power, default does multiply, square, inverse
xx_sgn 1 sign of value (-1, 0, 1)
xx_cmp 2 equality (equal,nonequal => 0,1), default tests elements
xx_rel 2 relative order, positive for >, etc.
xx_quo 3 integer quotient
xx_mod 3 remainder of division
xx_int 1 integer part
xx_frac 1 fractional part
xx_inc 1 increment, default adds 1
xx_dec 1 decrement, default subtracts 1
xx_square 1 default multiplies by itself
xx_scale 2 multiply by power of 2
xx_shift 2 shift left by n bits (right if negative)
xx_round 3 round to given number of decimal places
xx_bround 3 round to given number of binary places
xx_root 3 root of value within given error
xx_sqrt 3 square root within given error
xx_or 2 bitwise or
xx_and 2 bitwise and
xx_not 1 logical not
xx_fact 1 factorial or postfix !
xx_min 1 value for min(...)
xx_max 1 value for max(...)
xx_sum 1 value for sum(...)
xx_assign 2 assign, defaults to a = b
xx_xor 2 value for binary ~
xx_comp 1 value for unary ~
xx_content 1 unary hash op
xx_hashop 2 binary hash op
xx_backslash 1 unary backslash op
xx_setminus 2 binary backslash op
xx_plus 1 unary + op
Also see the standard resource files:
deg.cal
dms.cal
ellip.cal
hms.cal
mod.cal
natnumset.cal
poly.cal
quat.cal
regress.cal
set8700.cal
surd.cal
test2300.cal
test3100.cal
## Copyright (C) 1999 Landon Curt Noll
## Copyright (C) 1999,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
@@ -195,8 +209,8 @@ Using objects
## 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: obj.file,v 30.1 2007/03/16 11:10:42 chongo Exp $
## @(#) $Revision: 30.3 $
## @(#) $Id: obj.file,v 30.3 2010/09/02 06:36:21 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/obj.file,v $
##
## Under source code control: 1991/07/21 04:37:22

View File

@@ -1,5 +1,5 @@
NAME
sign - indicator of sign of a real or complex number
sgn - indicator of sign of a real or complex number
SYNOPSIS
sgn(x)
@@ -55,8 +55,8 @@ SEE ALSO
## 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: sgn,v 30.1 2007/03/16 11:10:42 chongo Exp $
## @(#) $Revision: 30.2 $
## @(#) $Id: sgn,v 30.2 2008/05/10 13:23:57 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/sgn,v $
##
## Under source code control: 1995/10/25 04:03:46

View File

@@ -224,6 +224,12 @@ Unexpected
and increments x three times.
In an other example, this expression:
1<<8/2
evalues to 128, not 16, because <<8 is performed before the /2.
&A[0] and A are different things in calc
========================================
@@ -414,8 +420,8 @@ Unexpected
## 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: unexpected,v 30.3 2007/09/08 02:48:45 chongo Exp $
## @(#) $Revision: 30.4 $
## @(#) $Id: unexpected,v 30.4 2008/05/10 13:18:09 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/unexpected,v $
##
## Under source code control: 1997/03/21 13:15:18

View File

@@ -17,8 +17,8 @@
* 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: math_error.c,v 30.1 2007/03/16 11:09:46 chongo Exp $
* @(#) $Revision: 30.2 $
* @(#) $Id: math_error.c,v 30.2 2008/10/24 09:49:20 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/math_error.c,v $
*
* Under source code control: 1994/08/03 05:08:22
@@ -93,6 +93,8 @@ math_error(char *fmt, ...)
* if we should longjmp, so do
*/
if (calc_use_matherr_jmpbuf != 0) {
if (conf->calc_debug & CALCDBG_RUNSTATE)
printf("math_error: longjmp calc_matherr_jmpbuf\n");
longjmp(calc_matherr_jmpbuf, calc_use_matherr_jmpbuf);
}
@@ -102,6 +104,21 @@ math_error(char *fmt, ...)
(void) fflush(stdout);
(void) fflush(stderr);
fprintf(stderr, "%s\n\n", calc_err_msg);
/*
* if interactive, return to main via longjmp()
*/
if (calc_use_scanerr_jmpbuf != 0) {
if (conf->calc_debug & CALCDBG_RUNSTATE)
printf("math_error: longjmp calc_scanerr_jmpbuf\n");
longjmp(calc_scanerr_jmpbuf, calc_use_scanerr_jmpbuf);
}
/*
* exit
*/
if (conf->calc_debug & CALCDBG_RUNSTATE)
printf("math_error: about to exit\n");
libcalc_call_me_last();
exit(40);
}

View File

@@ -19,8 +19,8 @@
* 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: opcodes.c,v 30.2 2007/07/10 21:18:08 chongo Exp $
* @(#) $Revision: 30.4 $
* @(#) $Id: opcodes.c,v 30.4 2008/05/10 13:51:32 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/opcodes.c,v $
*
* Under source code control: 1990/02/15 01:48:19
@@ -3120,8 +3120,18 @@ o_printresult(void)
VALUE *vp;
vp = stack;
/* firewall */
if (vp == NULL)
return;
if (vp->v_type == V_ADDR)
vp = vp->v_addr;
/* firewall */
if (vp == NULL)
return;
if (vp->v_type != V_NULL) {
if (conf->tab_ok)
math_chr('\t');

View File

@@ -19,8 +19,8 @@
* 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: qtrans.c,v 30.1 2007/03/16 11:09:46 chongo Exp $
* @(#) $Revision: 30.2 $
* @(#) $Id: qtrans.c,v 30.2 2008/10/24 07:09:41 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/qtrans.c,v $
*
* Under source code control: 1990/02/15 01:48:22
@@ -1062,7 +1062,7 @@ qlog(NUMBER *q, NUMBER *epsilon)
if (ln_10_epsilon == NULL) {
/* first time call */
ln_10_epsilon = qcopy(epsilon);
} else if (qcmp(ln_10_epsilon, epsilon) == FALSE) {
} else if (qcmp(ln_10_epsilon, epsilon) == TRUE) {
/* replaced cacheed value with epsilon arg */
qfree(ln_10_epsilon);
ln_10_epsilon = qcopy(epsilon);

11
rpm.mk
View File

@@ -19,8 +19,8 @@
# received a copy with calc; if not, write to Free Software Foundation, Inc.
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
MAKEFILE_REV= $$Revision: 30.4 $$
# @(#) $Id: rpm.mk,v 30.4 2007/10/16 12:22:22 chongo Exp $
MAKEFILE_REV= $$Revision: 30.5 $$
# @(#) $Id: rpm.mk,v 30.5 2008/10/24 08:44:00 chongo Exp $
# @(#) $Source: /usr/local/src/cmd/calc/RCS/rpm.mk,v $
#
# Under source code control: 2003/02/16 20:21:39
@@ -53,6 +53,7 @@ EGREP= egrep
MKDIR= mkdir
GREP= grep
SORT= sort
CHMOD= chmod
# rpm-related parameters
#
@@ -116,6 +117,12 @@ srcpkg: make_rhdir
${EGREP} -v '/old[._-]|\.old$$|\.tar\.gz$$|/ver_calc$$' | \
LANG=C ${SORT} | \
${CPIO} -dumpv "$(TMPDIR)/$(PROJECT)"
${RM} -f "$(TMPDIR)/$(PROJECT)/Makefile"
${SED} -e 's/^CCWERR=[ ]*-Werror/CCWERR=/' \
-e 's/^#.*CCWERR=.*-Werror$$/#/' \
-e 's/^CHECK= check/CHECK= true/' \
Makefile > "$(TMPDIR)/$(PROJECT)/Makefile"
${CHMOD} 0444 "$(TMPDIR)/$(PROJECT)/Makefile"
(cd "$(TMPDIR)"; ${TAR} cf - "$(PROJECT)") | \
${BZIP2_PROG} --best -c -z > "$(RPMDIR)/SOURCES/$(TARBALL)"
${RM} -fr "$(TMPDIR)/$(PROJECT)"

View File

@@ -19,8 +19,8 @@
* 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: token.c,v 30.1 2007/03/16 11:09:46 chongo Exp $
* @(#) $Revision: 30.2 $
* @(#) $Id: token.c,v 30.2 2008/11/05 17:32:19 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/token.c,v $
*
* Under source code control: 1990/02/15 01:48:25
@@ -823,7 +823,6 @@ warning(char *fmt, ...)
/* form the error message */
name = inputname();
va_start(ap, fmt);
vsnprintf(calc_warn_msg, MAXERROR, fmt, ap);
if (name) {
snprintf(calc_warn_msg, MAXERROR, "\"%s\", line %ld: ",
name, linenumber());

View File

@@ -17,8 +17,8 @@
* 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: value.c,v 30.3 2007/07/11 23:09:01 chongo Exp $
* @(#) $Revision: 30.4 $
* @(#) $Id: value.c,v 30.4 2008/05/10 13:44:28 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/value.c,v $
*
* Under source code control: 1990/02/15 01:48:25
@@ -179,6 +179,10 @@ protecttodepth(VALUE *vp, int sts, int depth)
void
copyvalue(VALUE *oldvp, VALUE *newvp)
{
/* firewall */
if (oldvp == NULL)
return;
newvp->v_type = oldvp->v_type;
if (oldvp->v_type >= 0) {
switch (oldvp->v_type) {

View File

@@ -19,8 +19,8 @@
* 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.9 $
* @(#) $Id: version.c,v 30.9 2008/05/10 10:53:34 chongo Exp $
* @(#) $Revision: 30.12 $
* @(#) $Id: version.c,v 30.12 2010/09/02 06:36:48 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/version.c,v $
*
* Under source code control: 1990/05/22 11:00:58
@@ -48,8 +48,8 @@ static char *program;
#define MAJOR_VER 2 /* major library version */
#define MINOR_VER 12 /* minor library version */
#define MAJOR_PATCH 3 /* major software level under library version */
#define MINOR_PATCH 3 /* minor software level or 0 if not patched */
#define MAJOR_PATCH 4 /* major software level under library version */
#define MINOR_PATCH 2 /* minor software level or 0 if not patched */
/*