mirror of
https://github.com/lcn2/calc.git
synced 2025-08-19 01:13:27 +03:00
Compare commits
8 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
e054ea87f2 | ||
|
e229393250 | ||
|
a407c7d197 | ||
|
9ea569152a | ||
|
cbcb5801fb | ||
|
bdf495150e | ||
|
b3648f030f | ||
|
71e88bdc91 |
212
CHANGES
212
CHANGES
@@ -1,4 +1,210 @@
|
||||
The following are the changes from calc version 2.12.1.10 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.
|
||||
|
||||
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.
|
||||
|
||||
Fixed confusion in Makefile where some uses of ${EXT} were misnamed ${EXE}.
|
||||
|
||||
Added a "make strip" rule, per suggestion from Igor Furlan <primorec
|
||||
at sbcglobal dot net>, to allow one to strip previously built binary
|
||||
executables and libraries.
|
||||
|
||||
Under the Darwin / OS X target, ${DARWIN_ARCH} is left empty meaning
|
||||
that calc is compiled for the native CPU type instead of Universal
|
||||
Binary (Intel and PPC).
|
||||
|
||||
By default, the calc binary that is built for the rpm forces
|
||||
${LD_SHARE} to be empty. An empty ${LD_SHARE} means that the calc
|
||||
from the rpm does not set rpath. This in turn causes the default
|
||||
system path to be searched when looking for libcalc and libcustcalc.
|
||||
|
||||
The Makefile shipped with calc still sets ${LD_SHARE} for host targets.
|
||||
By default, the dynamic shared library search path for all targets
|
||||
starts with the source directory. Starting the search in the source
|
||||
directory is convenient for testing and debugging but is not appropriate
|
||||
for installation on a production system. To get the same effect
|
||||
as the calc binary in the calc rpm, try:
|
||||
|
||||
make clobber
|
||||
make calc-dynamic-only BLD_TYPE=calc-dynamic-only LD_SHARE=
|
||||
make install
|
||||
|
||||
The libcalc and libcustcalc shared libraries are now tied to
|
||||
the 4 level calc version instead of just 3 levels. For example,
|
||||
under Linux calc version 2.12.2.1 uses /usr/lib/libcalc.so.2.12.2.1
|
||||
instead of just the /usr/lib/libcalc.so.2.12.2 file. This change
|
||||
was made so that calc produced by 'make clobber; make all install'
|
||||
is consistent with the calc rpm.
|
||||
|
||||
Calc is now releasing the calc-debuginfo rpm for those RPM users who
|
||||
which to use non-stripped libraries and binaries for debugging
|
||||
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:
|
||||
|
||||
Put back the missing -s flags on the cscripts: mersenne, 4dsphere,
|
||||
fprodcut, plus, and powerterm. Thanks goes to Bradley Reed
|
||||
@@ -6592,8 +6798,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.8 $
|
||||
## @(#) $Id: CHANGES,v 30.8 2007/09/02 06:26:38 chongo Exp $
|
||||
## @(#) $Revision: 30.21 $
|
||||
## @(#) $Id: CHANGES,v 30.21 2010/09/02 09:50:19 chongo Exp $
|
||||
## @(#) $Source: /usr/local/src/cmd/calc/RCS/CHANGES,v $
|
||||
##
|
||||
## Under source code control: 1993/06/02 18:12:57
|
||||
|
18
COPYING
18
COPYING
@@ -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
|
||||
|
@@ -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,8 +204,8 @@ the calc help subsystem. See the README file for details.
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 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 $
|
||||
## @(#) $Revision: 30.6 $
|
||||
## @(#) $Id: HOWTO.INSTALL,v 30.6 2007/10/16 12:22:22 chongo Exp $
|
||||
## @(#) $Source: /usr/local/src/cmd/calc/RCS/HOWTO.INSTALL,v $
|
||||
##
|
||||
## Under source code control: 1999/09/27 20:48:44
|
||||
|
327
Makefile.simple
327
Makefile.simple
@@ -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,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.18 $$
|
||||
# @(#) $Id: Makefile.ship,v 30.18 2007/09/02 05:38:34 chongo Exp $
|
||||
MAKEFILE_REV= $$Revision: 30.46 $$
|
||||
# @(#) $Id: Makefile.ship,v 30.46 2010/09/02 09:48:41 chongo Exp $
|
||||
# @(#) $Source: /usr/local/src/cmd/calc/RCS/Makefile.ship,v $
|
||||
#
|
||||
# Under source code control: 1990/02/15 01:48:41
|
||||
@@ -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,14 +974,15 @@ EXT=
|
||||
|
||||
# The default calc versions
|
||||
#
|
||||
VERSION= 2.12.2
|
||||
VERS= 2.12.2
|
||||
VERSION= 2.12.4.3
|
||||
VERS= 2.12.4
|
||||
VER= 2.12
|
||||
VE= 2
|
||||
|
||||
# Names of shared libraries with versions
|
||||
#
|
||||
LIB_EXT= .so
|
||||
LIB_EXT_VERSION= ${LIB_EXT}.${VERSION}
|
||||
LIB_EXT_VERS= ${LIB_EXT}.${VERS}
|
||||
LIB_EXT_VER= ${LIB_EXT}.${VER}
|
||||
LIB_EXT_VE= ${LIB_EXT}.${VE}
|
||||
@@ -995,6 +1020,7 @@ LN= ln
|
||||
LDCONFIG= ldconfig
|
||||
# assume the X11 makedepend tool for the depend rule
|
||||
MAKEDEPEND= makedepend
|
||||
STRIP= strip
|
||||
|
||||
# Extra compiling and linking flags
|
||||
#
|
||||
@@ -1084,8 +1110,8 @@ 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_VERS}"
|
||||
LIBCUSTCALC_SHLIB= -shared "-Wl,-soname,libcustcalc${LIB_EXT_VERS}"
|
||||
LIBCALC_SHLIB= -shared "-Wl,-soname,libcalc${LIB_EXT_VERSION}"
|
||||
LIBCUSTCALC_SHLIB= -shared "-Wl,-soname,libcustcalc${LIB_EXT_VERSION}"
|
||||
#
|
||||
CC_STATIC=
|
||||
LD_STATIC=
|
||||
@@ -1113,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 -=-=-=-=-=-#
|
||||
@@ -1232,15 +1259,21 @@ 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 progs may be created in the process of building BUILD_H_SRC
|
||||
# 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} \
|
||||
endian${EXT} longbits${EXT} have_newstr${EXT} have_stdvs${EXT} \
|
||||
have_varvs${EXT} have_ustat${EXT} have_getsid${EXT} \
|
||||
have_getpgid${EXT} have_gettime${EXT} have_getprid${EXT} \
|
||||
ver_calc${EXT} have_strdup${EXT} no_implicit${EXT} no_implicit.arg \
|
||||
ver_calc${EXT} have_strdup${EXT} no_implicit${EXT} \
|
||||
have_unused${EXT} have_fpos${EXT} have_fpos_pos${EXT} \
|
||||
have_offscl${EXT} have_rusage${EXT} have_args.sh
|
||||
have_offscl${EXT} have_rusage${EXT}
|
||||
|
||||
# these utility files and scripts may be created in the process of building
|
||||
# the BUILD_H_SRC file set
|
||||
#
|
||||
UTIL_FILES= no_implicit.arg have_args.sh
|
||||
|
||||
# Any .h files that are needed to compile sample code.
|
||||
#
|
||||
@@ -1336,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}" \
|
||||
@@ -1373,9 +1403,6 @@ CAL_PASSDOWN= \
|
||||
CMP=${CMP} \
|
||||
CO=${CO} \
|
||||
CP=${CP} \
|
||||
CUSTOMCALDIR="${CUSTOMCALDIR}" \
|
||||
CUSTOMHELPDIR="${CUSTOMHELPDIR}" \
|
||||
CUSTOMINCDIR="${CUSTOMINCDIR}" \
|
||||
HELPDIR="${HELPDIR}" \
|
||||
INCDIR="${INCDIR}" \
|
||||
LANG=${LANG} \
|
||||
@@ -1404,9 +1431,6 @@ CSCRIPT_PASSDOWN= \
|
||||
CMP=${CMP} \
|
||||
CO=${CO} \
|
||||
CP=${CP} \
|
||||
CUSTOMCALDIR="${CUSTOMCALDIR}" \
|
||||
CUSTOMHELPDIR="${CUSTOMHELPDIR}" \
|
||||
CUSTOMINCDIR="${CUSTOMINCDIR}" \
|
||||
FMT=${FMT} \
|
||||
HELPDIR="${HELPDIR}" \
|
||||
INCDIR="${INCDIR}" \
|
||||
@@ -1451,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
|
||||
#
|
||||
@@ -1459,11 +1483,12 @@ CALC_STATIC_LIBS= libcalc.a libcustcalc.a
|
||||
|
||||
# Libaraies created and used to build calc
|
||||
#
|
||||
CALC_DYNAMIC_LIBS= libcalc${LIB_EXT_VERS} libcustcalc${LIB_EXT_VERS}
|
||||
CALC_DYNAMIC_LIBS= libcalc${LIB_EXT_VERSION} libcustcalc${LIB_EXT_VERSION}
|
||||
|
||||
# Symlinks of dymanic shared libraries
|
||||
#
|
||||
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}
|
||||
|
||||
@@ -1472,11 +1497,11 @@ SYM_DYNAMIC_LIBS= libcalc${LIB_EXT_VER} libcalc${LIB_EXT_VE} libcalc${LIB_EXT} \
|
||||
# NOTE: The ${SAMPLE_TARGETS} and ${SAMPLE_STATIC_TARGETS} are built but
|
||||
# not installed at this time.
|
||||
#
|
||||
# NOTE: There must be a foo-static${EXE} in SAMPLE_STATIC_TARGETS for
|
||||
# every foo${EXE} in ${SAMPLE_TARGETS}.
|
||||
# NOTE: There must be a foo-static${EXT} in SAMPLE_STATIC_TARGETS for
|
||||
# every foo${EXT} in ${SAMPLE_TARGETS}.
|
||||
#
|
||||
SAMPLE_TARGETS= sample_rand${EXE} sample_many${EXE}
|
||||
SAMPLE_STATIC_TARGETS= sample_rand-static${EXE} sample_many-static${EXE}
|
||||
SAMPLE_TARGETS= sample_rand${EXT} sample_many${EXT}
|
||||
SAMPLE_STATIC_TARGETS= sample_rand-static${EXT} sample_many-static${EXT}
|
||||
|
||||
# list of cscript programs to that need to be built to satisfy cscript/.all
|
||||
#
|
||||
@@ -1516,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}
|
||||
@@ -1540,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; \
|
||||
@@ -1558,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; \
|
||||
@@ -1582,9 +1612,9 @@ calc-static-only: ${STATIC_FIRST_TARGETS} ${EARLY_TARGETS} \
|
||||
exit 3; \
|
||||
fi
|
||||
${Q} for i in .dynamic ${CALC_DYNAMIC_LIBS} ${SYM_DYNAMIC_LIBS} \
|
||||
custom/libcustcalc${LIB_EXT_VERS}; do \
|
||||
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; \
|
||||
@@ -1601,20 +1631,25 @@ 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_VERS}: ${LIBOBJS} ver_calc${EXE} ${MAKE_FILE}
|
||||
${CC} ${LIBCALC_SHLIB} ${LIBOBJS} -o libcalc${LIB_EXT_VERS}
|
||||
libcalc${LIB_EXT_VERSION}: ${LIBOBJS} ver_calc${EXT} ${MAKE_FILE}
|
||||
${CC} ${LIBCALC_SHLIB} ${LIBOBJS} \
|
||||
${READLINE_LIB} ${READLINE_EXTRAS} -o libcalc${LIB_EXT_VERSION}
|
||||
|
||||
libcalc${LIB_EXT_VER}: libcalc${LIB_EXT_VERS}
|
||||
libcalc${LIB_EXT_VERS}: libcalc${LIB_EXT_VERSION}
|
||||
${Q} ${RM} -f $@
|
||||
${LN} -s $? $@
|
||||
|
||||
libcalc${LIB_EXT_VE}: libcalc${LIB_EXT_VERS}
|
||||
libcalc${LIB_EXT_VER}: libcalc${LIB_EXT_VERSION}
|
||||
${Q} ${RM} -f $@
|
||||
${LN} -s $? $@
|
||||
|
||||
libcalc${LIB_EXT}: libcalc${LIB_EXT_VERS}
|
||||
libcalc${LIB_EXT_VE}: libcalc${LIB_EXT_VERSION}
|
||||
${Q} ${RM} -f $@
|
||||
${LN} -s $? $@
|
||||
|
||||
libcalc${LIB_EXT}: libcalc${LIB_EXT_VERSION}
|
||||
${Q} ${RM} -f $@
|
||||
${LN} -s $? $@
|
||||
|
||||
@@ -1657,13 +1692,13 @@ calc.usage: calc.1 ${MAKE_FILE}
|
||||
|
||||
sample: ${SAMPLE_TARGETS}
|
||||
|
||||
sample_rand${EXE}: sample_rand.o ${CALC_DYNAMIC_LIBS} ${MAKE_FILE}
|
||||
sample_rand${EXT}: sample_rand.o ${CALC_DYNAMIC_LIBS} ${MAKE_FILE}
|
||||
${CC} sample_rand.o ${CLDFALGS} ${LD_SHARE} ${CALC_DYNAMIC_LIBS} \
|
||||
${READLINE_LIB} -o $@
|
||||
${READLINE_LIB} ${READLINE_EXTRAS} -o $@
|
||||
|
||||
sample_many${EXE}: sample_many.o ${CALC_DYNAMIC_LIBS} ${MAKE_FILE}
|
||||
sample_many${EXT}: sample_many.o ${CALC_DYNAMIC_LIBS} ${MAKE_FILE}
|
||||
${CC} sample_many.o ${CLDFALGS} ${LD_SHARE} ${CALC_DYNAMIC_LIBS} \
|
||||
${READLINE_LIB} -o $@
|
||||
${READLINE_LIB} ${READLINE_EXTRAS} -o $@
|
||||
|
||||
###
|
||||
#
|
||||
@@ -1763,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; \
|
||||
@@ -2709,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; \
|
||||
@@ -3008,6 +3043,7 @@ win32_hsrc: win32.mkdef ${MAKE_FILE}
|
||||
${RM} -f ${UTIL_MISC_SRC}; \
|
||||
${RM} -f ${UTIL_OBJS}; \
|
||||
${RM} -f ${UTIL_PROGS}; \
|
||||
${RM} -f ${UTIL_FILES}; \
|
||||
${RM} -f ${MAKE_FILE})
|
||||
${Q} echo 'win32 directory formed'
|
||||
|
||||
@@ -3018,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 $@
|
||||
@@ -3081,26 +3117,30 @@ custom/.all: custom/Makefile
|
||||
${V} echo '=-=-=-=-= Back to the main Makefile for $@ rule =-=-=-=-='
|
||||
${V} echo '=-=-=-=-= ${MAKE_FILE} end of $@ rule =-=-=-=-='
|
||||
|
||||
custom/libcustcalc${LIB_EXT_VERS}: custom/Makefile
|
||||
custom/libcustcalc${LIB_EXT_VERSION}: custom/Makefile
|
||||
${V} echo '=-=-=-=-= ${MAKE_FILE} start of $@ rule =-=-=-=-='
|
||||
${V} echo '=-=-=-=-= Invoking all rule for custom =-=-=-=-='
|
||||
cd custom; ${MAKE} -f Makefile.simple ${CUSTOM_PASSDOWN} $@
|
||||
${V} echo '=-=-=-=-= Back to the main Makefile for $@ rule =-=-=-=-='
|
||||
${V} echo '=-=-=-=-= ${MAKE_FILE} end of $@ rule =-=-=-=-='
|
||||
|
||||
libcustcalc${LIB_EXT_VERS}: custom/libcustcalc${LIB_EXT_VERS}
|
||||
libcustcalc${LIB_EXT_VERSION}: custom/libcustcalc${LIB_EXT_VERSION}
|
||||
${Q} ${RM} -f $@
|
||||
${CP} -p $? $@
|
||||
|
||||
libcustcalc${LIB_EXT_VER}: libcustcalc${LIB_EXT_VERS}
|
||||
libcustcalc${LIB_EXT_VERS}: custom/libcustcalc${LIB_EXT_VERSION}
|
||||
${Q} ${RM} -f $@
|
||||
${LN} -s $? $@
|
||||
|
||||
libcustcalc${LIB_EXT_VE}: libcustcalc${LIB_EXT_VERS}
|
||||
libcustcalc${LIB_EXT_VER}: libcustcalc${LIB_EXT_VERSION}
|
||||
${Q} ${RM} -f $@
|
||||
${LN} -s $? $@
|
||||
|
||||
libcustcalc${LIB_EXT}: libcustcalc${LIB_EXT_VERS}
|
||||
libcustcalc${LIB_EXT_VE}: libcustcalc${LIB_EXT_VERSION}
|
||||
${Q} ${RM} -f $@
|
||||
${LN} -s $? $@
|
||||
|
||||
libcustcalc${LIB_EXT}: libcustcalc${LIB_EXT_VERSION}
|
||||
${Q} ${RM} -f $@
|
||||
${LN} -s $? $@
|
||||
|
||||
@@ -3114,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 $@
|
||||
@@ -3129,13 +3169,13 @@ libcalc.a: ${LIBOBJS} ${MAKE_FILE}
|
||||
custom/libcustcalc.a: custom/Makefile
|
||||
cd custom; ${MAKE} -f Makefile.simple ${CUSTOM_PASSDOWN} libcustcalc.a
|
||||
|
||||
sample_rand-static${EXE}: sample_rand.o ${CALC_STATIC_LIBS} ${MAKE_FILE}
|
||||
sample_rand-static${EXT}: sample_rand.o ${CALC_STATIC_LIBS} ${MAKE_FILE}
|
||||
${CC} ${LDFLAGS} sample_rand.o ${LD_STATIC} \
|
||||
${CALC_STATIC_LIBS} ${READLINE_LIB} -o $@
|
||||
${CALC_STATIC_LIBS} ${READLINE_LIB} ${READLINE_EXTRAS} -o $@
|
||||
|
||||
sample_many-static${EXE}: sample_many.o ${CALC_STATIC_LIBS} ${MAKE_FILE}
|
||||
sample_many-static${EXT}: sample_many.o ${CALC_STATIC_LIBS} ${MAKE_FILE}
|
||||
${CC} ${LDFLAGS} sample_many.o ${LD_STATIC} \
|
||||
${CALC_STATIC_LIBS} ${READLINE_LIB} -o $@
|
||||
${CALC_STATIC_LIBS} ${READLINE_LIB} ${READLINE_EXTRAS} -o $@
|
||||
|
||||
###
|
||||
#
|
||||
@@ -3513,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 ''
|
||||
@@ -3540,6 +3581,7 @@ env:
|
||||
@echo 'UTIL_C_SRC=${UTIL_C_SRC}'; echo ''
|
||||
@echo 'UTIL_MISC_SRC=${UTIL_MISC_SRC}'; echo ''
|
||||
@echo 'UTIL_OBJS=${UTIL_OBJS}'; echo ''
|
||||
@echo 'UTIL_FILES=${UTIL_FILES}'; echo ''
|
||||
@echo 'UTIL_PROGS=${UTIL_PROGS}'; echo ''
|
||||
@echo 'UTIL_TMP=${UTIL_TMP}'; echo ''
|
||||
@echo 'V=${V}'; echo ''
|
||||
@@ -3549,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 =-=-=-=-='
|
||||
@@ -3563,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
|
||||
@@ -3571,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 =-=-=-=-='
|
||||
@@ -3590,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
|
||||
#
|
||||
@@ -3604,9 +3641,6 @@ debug: env rpm.release
|
||||
run:
|
||||
${CALC_ENV} ./calc${EXT}
|
||||
|
||||
cvd:
|
||||
${CALC_ENV} cvd ./calc${EXT}
|
||||
|
||||
dbx:
|
||||
${CALC_ENV} dbx ./calc${EXT}
|
||||
|
||||
@@ -3621,8 +3655,7 @@ gdb:
|
||||
|
||||
rpm: clobber rpm.mk calc.spec.in
|
||||
${V} echo '=-=-=-=-= ${MAKE_FILE} start of $@ rule =-=-=-=-='
|
||||
${RM} -rf /var/tmp/redhat /var/tmp/calc-root
|
||||
${MAKE} -f rpm.mk RHDIR=/var/tmp/redhat TMPDIR=/var/tmp/redhat V=${V}
|
||||
${MAKE} -f rpm.mk V=${V}
|
||||
${V} echo '=-=-=-=-= ${MAKE_FILE} end of $@ rule =-=-=-=-='
|
||||
|
||||
# rpm static rules
|
||||
@@ -3733,6 +3766,7 @@ clean: custom/Makefile
|
||||
${RM} -f ${UTIL_OBJS}
|
||||
${RM} -f ${UTIL_TMP}
|
||||
${RM} -f ${UTIL_PROGS}
|
||||
${RM} -f ${UTIL_FILES}
|
||||
${RM} -f ${SAMPLE_OBJ}
|
||||
${RM} -f .libcustcalc_error
|
||||
${RM} -f calc.spec.sed
|
||||
@@ -3772,32 +3806,35 @@ clobber: custom/Makefile clean
|
||||
${RM} -f calc.pixie calc.rf calc.Counts calc.cord
|
||||
${RM} -rf gen_h skel Makefile.bak tmp.patch
|
||||
${RM} -f calc.spec inst_files rpm.mk.patch tmp
|
||||
${RM} -f libcalc${LIB_EXT_VERSION}
|
||||
${RM} -f libcalc${LIB_EXT_VERS}
|
||||
${RM} -f libcalc${LIB_EXT_VER}
|
||||
${RM} -f libcalc${LIB_EXT_VE}
|
||||
${RM} -f libcalc*${LIB_EXT}
|
||||
${RM} -f libcustcalc${LIB_EXT_VERSION}
|
||||
${RM} -f libcustcalc${LIB_EXT_VERS}
|
||||
${RM} -f libcustcalc${LIB_EXT_VER}
|
||||
${RM} -f libcustcalc${LIB_EXT_VE}
|
||||
${RM} -f libcustcalc*${LIB_EXT}
|
||||
${RM} -f libcustcalc.a
|
||||
${RM} -f calc-static${EXE}
|
||||
${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
|
||||
@@ -3927,7 +3964,7 @@ install: custom/Makefile ${LIB_H_SRC} ${BUILD_H_SRC} calc.1 all
|
||||
${MV} -f ${T}${BINDIR}/calc.new${EXT} ${T}${BINDIR}/calc${EXT}; \
|
||||
echo "installed ${T}${BINDIR}/calc${EXT}"; \
|
||||
fi
|
||||
-${Q} if [ -f calc-static${EXE} ]; then \
|
||||
-${Q} if [ -f calc-static${EXT} ]; then \
|
||||
if ${CMP} -s calc-static${EXT} \
|
||||
${T}${BINDIR}/calc-static${EXT}; then \
|
||||
${TRUE}; \
|
||||
@@ -3965,50 +4002,58 @@ install: custom/Makefile ${LIB_H_SRC} ${BUILD_H_SRC} calc.1 all
|
||||
echo "installed ${T}${LIBDIR}/libcalc.a"; \
|
||||
fi; \
|
||||
fi
|
||||
${Q}# NOTE: The this makefile installs libcustcalc${LIB_EXT_VERS}
|
||||
${Q}# NOTE: The this makefile installs libcustcalc${LIB_EXT_VERSION}
|
||||
${Q}# because we only want to perform one ${LDCONFIG} for both
|
||||
${Q}# libcalc${LIB_EXT_VERS} and libcustcalc${LIB_EXT_VERS}.
|
||||
-${Q} if ${CMP} -s libcalc${LIB_EXT_VERS} \
|
||||
${T}${LIBDIR}/libcalc${LIB_EXT_VERS} && \
|
||||
${CMP} -s custom/libcustcalc${LIB_EXT_VERS} \
|
||||
${T}${LIBDIR}/libcustcalc${LIB_EXT_VERS}; then \
|
||||
${Q}# libcalc${LIB_EXT_VERSION} and libcustcalc${LIB_EXT_VERSION}.
|
||||
-${Q} if ${CMP} -s libcalc${LIB_EXT_VERSION} \
|
||||
${T}${LIBDIR}/libcalc${LIB_EXT_VERSION} && \
|
||||
${CMP} -s custom/libcustcalc${LIB_EXT_VERSION} \
|
||||
${T}${LIBDIR}/libcustcalc${LIB_EXT_VERSION}; then \
|
||||
${TRUE}; \
|
||||
else \
|
||||
${RM} -f ${T}${LIBDIR}/libcalc${LIB_EXT_VERS}.new; \
|
||||
${CP} -f libcalc${LIB_EXT_VERS} \
|
||||
${T}${LIBDIR}/libcalc${LIB_EXT_VERS}.new; \
|
||||
${MV} -f ${T}${LIBDIR}/libcalc${LIB_EXT_VERS}.new \
|
||||
${RM} -f ${T}${LIBDIR}/libcalc${LIB_EXT_VERSION}.new; \
|
||||
${CP} -f libcalc${LIB_EXT_VERSION} \
|
||||
${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}"; \
|
||||
${LN} -f -s libcalc${LIB_EXT_VERSION} \
|
||||
${T}${LIBDIR}/libcalc${LIB_EXT_VERS}; \
|
||||
echo "installed ${T}${LIBDIR}/libcalc${LIB_EXT_VERS}"; \
|
||||
${LN} -f -s libcalc${LIB_EXT_VERS} \
|
||||
${LN} -f -s libcalc${LIB_EXT_VERSION} \
|
||||
${T}${LIBDIR}/libcalc${LIB_EXT_VER}; \
|
||||
echo "installed ${T}${LIBDIR}/libcalc${LIB_EXT_VER}"; \
|
||||
${LN} -f -s libcalc${LIB_EXT_VERS} \
|
||||
${LN} -f -s libcalc${LIB_EXT_VERSION} \
|
||||
${T}${LIBDIR}/libcalc${LIB_EXT_VE}; \
|
||||
echo "installed ${T}${LIBDIR}/libcalc${LIB_EXT_VE}"; \
|
||||
${LN} -f -s libcalc${LIB_EXT_VERS} \
|
||||
${LN} -f -s libcalc${LIB_EXT_VERSION} \
|
||||
${T}${LIBDIR}/libcalc${LIB_EXT}; \
|
||||
echo "installed ${T}${LIBDIR}/libcalc${LIB_EXT}"; \
|
||||
${RM} -f ${T}${LIBDIR}/libcustcalc${LIB_EXT_VERS}.new; \
|
||||
${CP} -f custom/libcustcalc${LIB_EXT_VERS} \
|
||||
${T}${LIBDIR}/libcustcalc${LIB_EXT_VERS}.new; \
|
||||
${MV} -f ${T}${LIBDIR}/libcustcalc${LIB_EXT_VERS}.new \
|
||||
${RM} -f ${T}${LIBDIR}/libcustcalc${LIB_EXT_VERSION}.new; \
|
||||
${CP} -f custom/libcustcalc${LIB_EXT_VERSION} \
|
||||
${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}"; \
|
||||
${LN} -f -s libcustcalc${LIB_EXT_VERSION} \
|
||||
${T}${LIBDIR}/libcustcalc${LIB_EXT_VERS}; \
|
||||
echo "installed ${T}${LIBDIR}/libcustcalc${LIB_EXT_VERS}"; \
|
||||
${LN} -f -s libcustcalc${LIB_EXT_VERS} \
|
||||
${LN} -f -s libcustcalc${LIB_EXT_VERSION} \
|
||||
${T}${LIBDIR}/libcustcalc${LIB_EXT_VER}; \
|
||||
echo "installed ${T}${LIBDIR}/libcustcalc${LIB_EXT_VER}"; \
|
||||
${LN} -f -s libcustcalc${LIB_EXT_VERS} \
|
||||
${LN} -f -s libcustcalc${LIB_EXT_VERSION} \
|
||||
${T}${LIBDIR}/libcustcalc${LIB_EXT_VE}; \
|
||||
echo "installed ${T}${LIBDIR}/libcalc${LIB_EXT_VE}"; \
|
||||
${LN} -f -s libcustcalc${LIB_EXT_VERS} \
|
||||
${LN} -f -s libcustcalc${LIB_EXT_VERSION} \
|
||||
${T}${LIBDIR}/libcustcalc${LIB_EXT}; \
|
||||
echo "installed ${T}${LIBDIR}/libcalc${LIB_EXT}"; \
|
||||
if [ -z "${T}" -o "/" = "${T}" ]; then \
|
||||
if [ ! -z "${LDCONFIG}" ]; then \
|
||||
echo "running ${LDCONFIG}"; \
|
||||
${LDCONFIG}; \
|
||||
${LDCONFIG} -v; \
|
||||
echo "finished ${LDCONFIG}"; \
|
||||
fi; \
|
||||
fi; \
|
||||
fi
|
||||
-${Q} for i in ${LIB_H_SRC} ${BUILD_H_SRC} /dev/null; do \
|
||||
if [ "$$i" = "/dev/null" ]; then \
|
||||
@@ -4080,8 +4125,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 =-=-=-=-='
|
||||
@@ -4161,12 +4204,12 @@ uninstall: custom/Makefile
|
||||
echo "uninstalled ${T}${LIBDIR}/libcustcalc${LIB_EXT_VERS}"; \
|
||||
fi; \
|
||||
fi
|
||||
-${Q} if [ -f "${T}${LIBDIR}/libcustcalc${LIB_EXT_VERS}" ]; then \
|
||||
${RM} -f "${T}${LIBDIR}/libcustcalc${LIB_EXT_VERS}"; \
|
||||
if [ -f "${T}${LIBDIR}/libcustcalc${LIB_EXT_VERS}" ]; then \
|
||||
echo "cannot uninstall ${T}${LIBDIR}/libcustcalc${LIB_EXT_VERS}"; \
|
||||
-${Q} if [ -f "${T}${LIBDIR}/libcustcalc${LIB_EXT_VERSION}" ]; then \
|
||||
${RM} -f "${T}${LIBDIR}/libcustcalc${LIB_EXT_VERSION}"; \
|
||||
if [ -f "${T}${LIBDIR}/libcustcalc${LIB_EXT_VERSION}" ]; then \
|
||||
echo "cannot uninstall ${T}${LIBDIR}/libcustcalc${LIB_EXT_VERSION}"; \
|
||||
else \
|
||||
echo "uninstalled ${T}${LIBDIR}/libcustcalc${LIB_EXT_VERS}"; \
|
||||
echo "uninstalled ${T}${LIBDIR}/libcustcalc${LIB_EXT_VERSION}"; \
|
||||
fi; \
|
||||
fi
|
||||
-${Q} if [ -f "${T}${LIBDIR}/libcalc${LIB_EXT}" ]; then \
|
||||
@@ -4201,18 +4244,20 @@ uninstall: custom/Makefile
|
||||
echo "uninstalled ${T}${LIBDIR}/libcalc${LIB_EXT_VERS}"; \
|
||||
fi; \
|
||||
fi
|
||||
-${Q} if [ -f "${T}${LIBDIR}/libcalc${LIB_EXT_VERS}" ]; then \
|
||||
${RM} -f "${T}${LIBDIR}/libcalc${LIB_EXT_VERS}"; \
|
||||
if [ -f "${T}${LIBDIR}/libcalc${LIB_EXT_VERS}" ]; then \
|
||||
echo "cannot uninstall ${T}${LIBDIR}/libcalc${LIB_EXT_VERS}"; \
|
||||
-${Q} if [ -f "${T}${LIBDIR}/libcalc${LIB_EXT_VERSION}" ]; then \
|
||||
${RM} -f "${T}${LIBDIR}/libcalc${LIB_EXT_VERSION}"; \
|
||||
if [ -f "${T}${LIBDIR}/libcalc${LIB_EXT_VERSION}" ]; then \
|
||||
echo "cannot uninstall ${T}${LIBDIR}/libcalc${LIB_EXT_VERSION}"; \
|
||||
else \
|
||||
echo "uninstalled ${T}${LIBDIR}/libcalc${LIB_EXT_VERS}"; \
|
||||
echo "uninstalled ${T}${LIBDIR}/libcalc${LIB_EXT_VERSION}"; \
|
||||
fi; \
|
||||
fi
|
||||
-${Q} if [ -z "${T}" -o "/" = "${T}" ]; then \
|
||||
if [ ! -z "${LDCONFIG}" ]; then \
|
||||
echo "running ${LDCONFIG}"; \
|
||||
${LDCONFIG}; \
|
||||
${LDCONFIG} -v; \
|
||||
echo "finished ${LDCONFIG}"; \
|
||||
fi; \
|
||||
fi
|
||||
-${Q} if [ -f "${T}${LIBDIR}/libcalc.a" ]; then \
|
||||
${RM} -f "${T}${LIBDIR}/libcalc.a"; \
|
||||
@@ -4272,6 +4317,20 @@ splint: #hsrc
|
||||
${SPLINT} ${SPLINT_OPTS} -DCALC_SRC -I. \
|
||||
${CALCSRC} ${LIBSRC} ${BUILD_C_SRC} ${UTIL_C_SRC}
|
||||
|
||||
# strip - for reducing the size of the binary files
|
||||
#
|
||||
strip:
|
||||
${V} echo '=-=-=-=-= ${MAKE_FILE} start of $@ rule =-=-=-=-='
|
||||
${Q} for i in ${UTIL_PROGS} ${SAMPLE_TARGETS} ${SAMPLE_STATIC_TARGETS} \
|
||||
calc${EXT} calc-static${EXT} ${CALC_DYNAMIC_LIBS} \
|
||||
${CALC_STATIC_LIBS}; do \
|
||||
if [ -s "$$i" -a -w "$$i" ]; then \
|
||||
${STRIP} "$$i"; \
|
||||
echo "stripped $$i"; \
|
||||
fi; \
|
||||
done
|
||||
${V} echo '=-=-=-=-= ${MAKE_FILE} end of $@ rule =-=-=-=-='
|
||||
|
||||
###
|
||||
#
|
||||
# make depend stuff
|
||||
|
107
README.WINDOWS
107
README.WINDOWS
@@ -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
|
||||
|
7
alloc.h
7
alloc.h
@@ -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: alloc.h,v 30.1 2007/03/16 11:09:46 chongo Exp $
|
||||
* @(#) $Revision: 30.2 $
|
||||
* @(#) $Id: alloc.h,v 30.2 2008/04/15 21:17:57 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/alloc.h,v $
|
||||
*
|
||||
* Under source code control: 1990/02/15 01:48:29
|
||||
@@ -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();
|
||||
|
16
cal/Makefile
16
cal/Makefile
@@ -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.2 $
|
||||
# @(#) $Id: Makefile,v 30.2 2007/03/22 07:34:47 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
|
||||
@@ -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
|
||||
|
||||
# These files are found (but not built) in the distribution
|
||||
#
|
||||
|
50
cal/README
50
cal/README
@@ -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
|
||||
|
38
cal/deg.cal
38
cal/deg.cal
@@ -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
384
cal/dms.cal
Normal 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
384
cal/hms.cal
Normal 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";
|
||||
}
|
@@ -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: regress.cal,v 30.3 2007/07/11 22:58:26 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
|
||||
@@ -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()';
|
||||
|
||||
@@ -2711,6 +2743,19 @@ define test_2600()
|
||||
vrfy(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';
|
||||
|
||||
|
||||
/*
|
||||
|
@@ -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";
|
||||
|
6
calc.c
6
calc.c
@@ -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.3 $
|
||||
* @(#) $Id: calc.c,v 30.3 2007/07/15 02:03:42 chongo Exp $
|
||||
* @(#) $Revision: 30.4 $
|
||||
* @(#) $Id: calc.c,v 30.4 2008/04/15 21:17:57 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/calc.c,v $
|
||||
*
|
||||
* Under source code control: 1990/02/15 01:48:11
|
||||
@@ -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 */
|
||||
|
18
calc.man
18
calc.man
@@ -15,8 +15,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: calc.man,v 30.2 2007/08/18 17:28:29 chongo Exp $
|
||||
.\" @(#) $Revision: 30.3 $
|
||||
.\" @(#) $Id: calc.man,v 30.3 2007/09/08 02:53:09 chongo Exp $
|
||||
.\" @(#) $Source: /usr/local/src/cmd/calc/RCS/calc.man,v $
|
||||
.\"
|
||||
.\" Under source code control: 1991/07/23 05:48:26
|
||||
@@ -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
|
||||
|
10
calc.spec.in
10
calc.spec.in
@@ -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.4 $
|
||||
# @(#) $Id: calc.spec.in,v 30.4 2007/09/02 05:38:34 chongo Exp $
|
||||
# @(#) $Revision: 30.6 $
|
||||
# @(#) $Id: calc.spec.in,v 30.6 2007/10/16 12:22:22 chongo Exp $
|
||||
# @(#) $Source: /usr/local/src/cmd/calc/RCS/calc.spec.in,v $
|
||||
#
|
||||
# Under source code control: 2003/02/16 20:21:39
|
||||
@@ -37,10 +37,10 @@
|
||||
Summary: Arbitrary precision calculator.
|
||||
Name: calc
|
||||
Version: <<<PROJECT_VERSION>>>
|
||||
Release: 1.0
|
||||
Release: 1.1
|
||||
License: LGPL
|
||||
Group: Applications/Engineering
|
||||
Source: %{name}-%{version}.tar.gz
|
||||
Source: %{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
|
||||
@@ -86,7 +86,7 @@ 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
|
||||
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
|
||||
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
|
||||
|
@@ -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);
|
||||
|
7
config.h
7
config.h
@@ -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: config.h,v 30.1 2007/03/16 11:09:46 chongo Exp $
|
||||
* @(#) $Revision: 30.2 $
|
||||
* @(#) $Id: config.h,v 30.2 2007/09/21 01:27:27 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/config.h,v $
|
||||
*
|
||||
* Under source code control: 1995/11/01 22:20:17
|
||||
@@ -193,7 +193,8 @@ typedef struct config CONFIG;
|
||||
#define CALCDBG_TTY (0x00000010) /* report TTY state changes */
|
||||
#define CALCDBG_RUNSTATE (0x00000020) /* report run_state changes */
|
||||
#define CALCDBG_RAND (0x00000040) /* report rand() activity */
|
||||
#define CALCDBG_MASK (0x0000007f)
|
||||
#define CALCDBG_CUSTOM (0x00000080) /* custom function debug */
|
||||
#define CALCDBG_MASK (0x000000ff)
|
||||
|
||||
/*
|
||||
* ctrl-d meanings
|
||||
|
@@ -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.2 $
|
||||
# @(#) $Id: Makefile,v 30.2 2007/03/22 07:34:47 chongo Exp $
|
||||
# @(#) $Revision: 30.3 $
|
||||
# @(#) $Id: Makefile,v 30.3 2007/09/21 01:27:27 chongo Exp $
|
||||
# @(#) $Source: /usr/local/src/cmd/calc/cscript/RCS/Makefile,v $
|
||||
#
|
||||
# Under source code control: 1999/11/29 11:10:26
|
||||
@@ -111,9 +111,6 @@ CALC_SHAREDIR= /usr/share/calc
|
||||
# ---------------------------------------------------------------
|
||||
# ${HELPDIR} where the help directory is installed
|
||||
# ${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
|
||||
|
15
custom.c
15
custom.c
@@ -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: custom.c,v 30.1 2007/03/16 11:09:46 chongo Exp $
|
||||
* @(#) $Revision: 30.2 $
|
||||
* @(#) $Id: custom.c,v 30.2 2007/09/21 01:27:27 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/custom.c,v $
|
||||
*
|
||||
* Under source code control: 1997/03/03 04:53:08
|
||||
@@ -100,6 +100,12 @@ custom(char *name, int count, VALUE **vals)
|
||||
fprintf(stderr,
|
||||
"%sCalc was built with custom functions disabled\n",
|
||||
(conf->tab_ok ? "\t" : ""));
|
||||
if (conf->calc_debug & CALCDBG_CUSTOM) {
|
||||
fprintf(stderr,
|
||||
"%scustom function %s with %d args, %s vals not executed\n",
|
||||
(conf->tab_ok ? "\t" : ""), name, count,
|
||||
(vals == NULL) ? "NULL" : "non-NULL");
|
||||
}
|
||||
return error_value(E_NO_CUSTOM);
|
||||
|
||||
#endif /* CUSTOM */
|
||||
@@ -211,6 +217,11 @@ customhelp(char *name)
|
||||
fprintf(stderr,
|
||||
"%sCalc was built with custom functions disabled\n",
|
||||
(conf->tab_ok ? "\t" : ""));
|
||||
if (conf->calc_debug & CALCDBG_CUSTOM) {
|
||||
fprintf(stderr, "%scustom help for %s unavailable\n",
|
||||
(conf->tab_ok ? "\t" : ""),
|
||||
((name == NULL) ? "((NULL))" : name));
|
||||
}
|
||||
|
||||
#endif /* CUSTOM */
|
||||
}
|
||||
|
@@ -363,6 +363,25 @@ Step 5: Write your custom function
|
||||
very_tiny_variable = z1tol(z_num);
|
||||
}
|
||||
|
||||
You can (and should) add debugging statements to your custom code
|
||||
by examining bit 8 of the calc_debug config flag:
|
||||
|
||||
if (conf->calc_debug & CALCDBG_CUSTOM) {
|
||||
fprintf(stderr, "%ssome custom debug note: msg\n",
|
||||
(conf->tab_ok ? "\t" : ""),
|
||||
((msg == NULL) ? "((NULL))" : msg));
|
||||
}
|
||||
|
||||
One is able to set bit 8 by way of the calc command line:
|
||||
|
||||
calc -D 128
|
||||
|
||||
See the calc man page for details. One may also set that bit
|
||||
while running calc by way of the config() builtin function:
|
||||
|
||||
config("calc_debug", 128);
|
||||
|
||||
See the help/config file for details on calc_debug.
|
||||
|
||||
Step 6: Register the function in the custom interface table
|
||||
|
||||
@@ -642,8 +661,8 @@ Step 12: Contribute
|
||||
## 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: HOW_TO_ADD,v 30.3 2007/07/13 23:45:54 chongo Exp $
|
||||
## @(#) $Revision: 30.4 $
|
||||
## @(#) $Id: HOW_TO_ADD,v 30.4 2007/09/21 01:27:27 chongo Exp $
|
||||
## @(#) $Source: /usr/local/src/cmd/calc/custom/RCS/HOW_TO_ADD,v $
|
||||
##
|
||||
## Under source code control: 1997/03/10 03:03:21
|
||||
|
242
custom/Makefile
242
custom/Makefile
@@ -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.12 $
|
||||
# @(#) $Id: Makefile.head,v 30.12 2007/09/01 19:54:03 chongo Exp $
|
||||
# @(#) $Revision: 30.22 $
|
||||
# @(#) $Id: Makefile.head,v 30.22 2010/09/02 09:48:42 chongo Exp $
|
||||
# @(#) $Source: /usr/local/src/cmd/calc/custom/RCS/Makefile.head,v $
|
||||
#
|
||||
# Under source code control: 1997/03/09 02:28:54
|
||||
@@ -63,14 +63,16 @@ CUSTOM_CALC_FILES= argv.cal halflen.cal pzasusb8.cal pmodm127.cal register.cal
|
||||
#
|
||||
CUSTOM_HELP= argv devnull help sysinfo pzasusb8 pmodm127 register
|
||||
|
||||
# Any .h files that are needed by programs that use libcustcalc${LIB_EXT_VERS}
|
||||
# Any .h files that are needed by programs that use
|
||||
# libcustcalc${LIB_EXT_VERSION}
|
||||
#
|
||||
# Put any .h files that you add which might be useful to other
|
||||
# programs here.
|
||||
#
|
||||
CUSTOM_H_SRC=
|
||||
|
||||
# Any .c files that are needed to build libcustcalc${LIB_EXT_VERS}.
|
||||
# Any .c files that are needed to build libcustcalc${LIB_EXT_VERSION}.
|
||||
#
|
||||
# Don't put ${REQUIRED_SRC} files in this list.
|
||||
#
|
||||
# There MUST be a .c in CUSTOM_SRC for every .o in CUSTOM_OBJ.
|
||||
@@ -80,7 +82,9 @@ CUSTOM_H_SRC=
|
||||
CUSTOM_SRC= c_argv.c c_devnull.c c_help.c c_sysinfo.c c_pzasusb8.c \
|
||||
c_pmodm127.c c_register.c
|
||||
|
||||
# Any .o files that are needed by program that use libcustcalc${LIB_EXT_VERS}.
|
||||
# Any .o files that are needed by program that use
|
||||
# libcustcalc${LIB_EXT_VERSION}.
|
||||
#
|
||||
# Don't put ${REQUIRED_OBJ} files in this list.
|
||||
#
|
||||
# There MUST be a .c in CUSTOM_SRC for every .o in CUSTOM_OBJ.
|
||||
@@ -362,14 +366,15 @@ EXT=
|
||||
|
||||
# The default calc versions
|
||||
#
|
||||
VERSION= 2.12.2
|
||||
VERS= 2.12.2
|
||||
VERSION= 2.12.4.3
|
||||
VERS= 2.12.4
|
||||
VER= 2.12
|
||||
VE= 2
|
||||
|
||||
# Names of shared libraries with versions
|
||||
#
|
||||
LIB_EXT= .so
|
||||
LIB_EXT_VERSION= ${LIB_EXT}.${VERSION}
|
||||
LIB_EXT_VERS= ${LIB_EXT}.${VERS}
|
||||
LIB_EXT_VER= ${LIB_EXT}.${VER}
|
||||
LIB_EXT_VE= ${LIB_EXT}.${VE}
|
||||
@@ -518,8 +523,12 @@ 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_VERS}"
|
||||
LIBCUSTCALC_SHLIB= -shared "-Wl,-soname,libcustcalc${LIB_EXT_VERS}"
|
||||
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=
|
||||
@@ -545,10 +554,14 @@ ifeq ($(target),Darwin)
|
||||
BLD_TYPE= calc-dynamic-only
|
||||
#
|
||||
CC_SHARE= -fPIC
|
||||
DEFAULT_LIB_INSTALL_PATH= ${PWD}:/sw/lib:/usr/lib:${LIBDIR}:/usr/local/lib
|
||||
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}
|
||||
@@ -565,11 +578,16 @@ CC= ${PURIFY} ${LCC} ${CCWERR}
|
||||
#
|
||||
# Darmin dynamic shared lib filenames
|
||||
LIB_EXT:= .dylib
|
||||
LIB_EXT_VERSION:= .${VERSION}${LIB_EXT}
|
||||
LIB_EXT_VERS:= .${VERS}${LIB_EXT}
|
||||
LIB_EXT_VER:= .${VER}${LIB_EXT}
|
||||
LIB_EXT_VE:= .${VE}${LIB_EXT}
|
||||
# compile Universal by default
|
||||
DARWIN_ARCH= -arch i386 -arch ppc
|
||||
# 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
|
||||
#
|
||||
endif
|
||||
@@ -592,8 +610,12 @@ 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_VERS}"
|
||||
LIBCUSTCALC_SHLIB= -shared "-Wl,-soname,libcustcalc${LIB_EXT_VERS}"
|
||||
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=
|
||||
@@ -612,6 +634,117 @@ MAKE= gmake
|
||||
#
|
||||
endif
|
||||
|
||||
##################
|
||||
# OpenBSD target #
|
||||
##################
|
||||
|
||||
########################################################################
|
||||
# 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
|
||||
#
|
||||
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=
|
||||
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=
|
||||
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 #
|
||||
#######################################################
|
||||
@@ -628,8 +761,8 @@ 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_VERS}"
|
||||
LIBCUSTCALC_SHLIB= -shared "-Wl,-soname,libcustcalc${LIB_EXT_VERS}"
|
||||
LIBCALC_SHLIB= -shared "-Wl,-soname,libcalc${LIB_EXT_VERSION}"
|
||||
LIBCUSTCALC_SHLIB= -shared "-Wl,-soname,libcustcalc${LIB_EXT_VERSION}"
|
||||
#
|
||||
CC_STATIC=
|
||||
LD_STATIC=
|
||||
@@ -660,6 +793,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 #
|
||||
###################################################
|
||||
@@ -675,8 +854,12 @@ 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_VERS}"
|
||||
LIBCUSTCALC_SHLIB= -shared "-Wl,-soname,libcustcalc${LIB_EXT_VERS}"
|
||||
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=
|
||||
@@ -718,7 +901,6 @@ CFLAGS= ${ICFLAGS} ${CCOPT}
|
||||
#
|
||||
ILDFLAGS= ${COMMON_LDFLAGS}
|
||||
LDFLAGS= ${LD_DEBUG} ${ILDFLAGS}
|
||||
|
||||
#endif /* end of skip for non-Gnu makefiles */
|
||||
|
||||
#######################################################################
|
||||
@@ -730,14 +912,14 @@ LDFLAGS= ${LD_DEBUG} ${ILDFLAGS}
|
||||
##############################################################################
|
||||
|
||||
# These .c files are required for the main custom interface and
|
||||
# for the custom support functions for libcustcalc${LIB_EXT_VERS}.
|
||||
# for the custom support functions for libcustcalc${LIB_EXT_VERSION}.
|
||||
#
|
||||
# There MUST be a .c for every .o in REQUIRED_OBJ.
|
||||
#
|
||||
REQUIRED_SRC= custtbl.c
|
||||
|
||||
# These .o files correspond to the .c files in REQUIRED_SRC
|
||||
# for libcustcalc${LIB_EXT_VERS}.
|
||||
# for libcustcalc${LIB_EXT_VERSION}.
|
||||
#
|
||||
# There MUST be a .o for every .c in REQUIRED_SRC.
|
||||
#
|
||||
@@ -747,11 +929,11 @@ REQUIRED_OBJ= custtbl.o
|
||||
#
|
||||
INSTALL_H_SRC= ${CUSTOM_H_SRC}
|
||||
|
||||
# These .c files are used to form libcustcalc${LIB_EXT_VERS}.
|
||||
# These .c files are used to form libcustcalc${LIB_EXT_VERSION}.
|
||||
#
|
||||
CUSTCALC_SRC= ${REQUIRED_SRC} ${CUSTOM_SRC}
|
||||
|
||||
# These .o files are used to form libcustcalc${LIB_EXT_VERS}.
|
||||
# These .o files are used to form libcustcalc${LIB_EXT_VERSION}.
|
||||
#
|
||||
CUSTCALC_OBJ= ${REQUIRED_OBJ} ${CUSTOM_OBJ}
|
||||
|
||||
@@ -778,7 +960,7 @@ CALCLIBLIST= ${CUSTCALC_SRC} ${INSTALL_H_SRC} ${MAKE_FILE} HOW_TO_ADD
|
||||
|
||||
# This is the custom dynbamic shared library that is build
|
||||
#
|
||||
CALC_DYNAMIC_LIBCUSTCALC= libcustcalc${LIB_EXT_VERS}
|
||||
CALC_DYNAMIC_LIBCUSTCALC= libcustcalc${LIB_EXT_VERSION}
|
||||
|
||||
# This is the custom static library that is build
|
||||
#
|
||||
@@ -801,10 +983,10 @@ calc-dynamic-only: ${CUSTCALC_OBJ} ${CALC_DYNAMIC_LIBCUSTCALC}
|
||||
|
||||
calc-static-only: ${CUSTCALC_OBJ} ${CALC_STATIC_LIBCUSTCALC}
|
||||
|
||||
custom/libcustcalc${LIB_EXT_VERS}: libcustcalc${LIB_EXT_VERS} \
|
||||
custom/libcustcalc${LIB_EXT_VERSION}: libcustcalc${LIB_EXT_VERSION} \
|
||||
${CALC_STATIC_LIBCUSTCALC}
|
||||
|
||||
libcustcalc${LIB_EXT_VERS}: ${CUSTCALC_OBJ} ${MAKE_FILE}
|
||||
libcustcalc${LIB_EXT_VERSION}: ${CUSTCALC_OBJ} ${MAKE_FILE}
|
||||
${CC} ${LIBCUSTCALC_SHLIB} ${CUSTCALC_OBJ} -o $@
|
||||
|
||||
##
|
||||
@@ -1014,6 +1196,7 @@ clean:
|
||||
clobber: clean
|
||||
${RM} -f ${BLD_TYPE}
|
||||
${RM} -f .all ${MAKE_FILE}.tmp ${MAKE_FILE}.bak
|
||||
${RM} -f libcustcalc${LIB_EXT_VERSION}
|
||||
${RM} -f libcustcalc${LIB_EXT_VERS}
|
||||
${RM} -f libcustcalc${LIB_EXT_VER}
|
||||
${RM} -f libcustcalc${LIB_EXT_VE}
|
||||
@@ -1173,9 +1356,10 @@ install: all
|
||||
fi; \
|
||||
fi; \
|
||||
fi
|
||||
${Q}# NOTE: The upper level makefile installs libcustcalc${LIB_EXT_VERS}
|
||||
${Q}# because we only want to perform one ${LDCONFIG} for both
|
||||
${Q}# libcalc${LIB_EXT_VERS} and libcustcalc${LIB_EXT_VERS}.
|
||||
${Q}# NOTE: The upper level makefile installs the file
|
||||
${Q}# libcustcalc${LIB_EXT_VERSION} because we only want to
|
||||
${Q}# perform one ${LDCONFIG} for both libcalc${LIB_EXT_VERSION}
|
||||
${Q}# and libcustcalc${LIB_EXT_VERSION}.
|
||||
|
||||
# Try to remove everything that was installed
|
||||
#
|
||||
|
@@ -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.12 $
|
||||
# @(#) $Id: Makefile.head,v 30.12 2007/09/01 19:54:03 chongo Exp $
|
||||
# @(#) $Revision: 30.22 $
|
||||
# @(#) $Id: Makefile.head,v 30.22 2010/09/02 09:48:42 chongo Exp $
|
||||
# @(#) $Source: /usr/local/src/cmd/calc/custom/RCS/Makefile.head,v $
|
||||
#
|
||||
# Under source code control: 1997/03/09 02:28:54
|
||||
@@ -63,14 +63,16 @@ CUSTOM_CALC_FILES= argv.cal halflen.cal pzasusb8.cal pmodm127.cal register.cal
|
||||
#
|
||||
CUSTOM_HELP= argv devnull help sysinfo pzasusb8 pmodm127 register
|
||||
|
||||
# Any .h files that are needed by programs that use libcustcalc${LIB_EXT_VERS}
|
||||
# Any .h files that are needed by programs that use
|
||||
# libcustcalc${LIB_EXT_VERSION}
|
||||
#
|
||||
# Put any .h files that you add which might be useful to other
|
||||
# programs here.
|
||||
#
|
||||
CUSTOM_H_SRC=
|
||||
|
||||
# Any .c files that are needed to build libcustcalc${LIB_EXT_VERS}.
|
||||
# Any .c files that are needed to build libcustcalc${LIB_EXT_VERSION}.
|
||||
#
|
||||
# Don't put ${REQUIRED_SRC} files in this list.
|
||||
#
|
||||
# There MUST be a .c in CUSTOM_SRC for every .o in CUSTOM_OBJ.
|
||||
@@ -80,7 +82,9 @@ CUSTOM_H_SRC=
|
||||
CUSTOM_SRC= c_argv.c c_devnull.c c_help.c c_sysinfo.c c_pzasusb8.c \
|
||||
c_pmodm127.c c_register.c
|
||||
|
||||
# Any .o files that are needed by program that use libcustcalc${LIB_EXT_VERS}.
|
||||
# Any .o files that are needed by program that use
|
||||
# libcustcalc${LIB_EXT_VERSION}.
|
||||
#
|
||||
# Don't put ${REQUIRED_OBJ} files in this list.
|
||||
#
|
||||
# There MUST be a .c in CUSTOM_SRC for every .o in CUSTOM_OBJ.
|
||||
@@ -362,14 +366,15 @@ EXT=
|
||||
|
||||
# The default calc versions
|
||||
#
|
||||
VERSION= 2.12.2
|
||||
VERS= 2.12.2
|
||||
VERSION= 2.12.4.3
|
||||
VERS= 2.12.4
|
||||
VER= 2.12
|
||||
VE= 2
|
||||
|
||||
# Names of shared libraries with versions
|
||||
#
|
||||
LIB_EXT= .so
|
||||
LIB_EXT_VERSION= ${LIB_EXT}.${VERSION}
|
||||
LIB_EXT_VERS= ${LIB_EXT}.${VERS}
|
||||
LIB_EXT_VER= ${LIB_EXT}.${VER}
|
||||
LIB_EXT_VE= ${LIB_EXT}.${VE}
|
||||
|
@@ -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.12 $
|
||||
# @(#) $Id: Makefile.head,v 30.12 2007/09/01 19:54:03 chongo Exp $
|
||||
# @(#) $Revision: 30.22 $
|
||||
# @(#) $Id: Makefile.head,v 30.22 2010/09/02 09:48:42 chongo Exp $
|
||||
# @(#) $Source: /usr/local/src/cmd/calc/custom/RCS/Makefile.head,v $
|
||||
#
|
||||
# Under source code control: 1997/03/09 02:28:54
|
||||
@@ -48,14 +48,16 @@ CUSTOM_CALC_FILES= argv.cal halflen.cal pzasusb8.cal pmodm127.cal register.cal
|
||||
#
|
||||
CUSTOM_HELP= argv devnull help sysinfo pzasusb8 pmodm127 register
|
||||
|
||||
# Any .h files that are needed by programs that use libcustcalc${LIB_EXT_VERS}
|
||||
# Any .h files that are needed by programs that use
|
||||
# libcustcalc${LIB_EXT_VERSION}
|
||||
#
|
||||
# Put any .h files that you add which might be useful to other
|
||||
# programs here.
|
||||
#
|
||||
CUSTOM_H_SRC=
|
||||
|
||||
# Any .c files that are needed to build libcustcalc${LIB_EXT_VERS}.
|
||||
# Any .c files that are needed to build libcustcalc${LIB_EXT_VERSION}.
|
||||
#
|
||||
# Don't put ${REQUIRED_SRC} files in this list.
|
||||
#
|
||||
# There MUST be a .c in CUSTOM_SRC for every .o in CUSTOM_OBJ.
|
||||
@@ -65,7 +67,9 @@ CUSTOM_H_SRC=
|
||||
CUSTOM_SRC= c_argv.c c_devnull.c c_help.c c_sysinfo.c c_pzasusb8.c \
|
||||
c_pmodm127.c c_register.c
|
||||
|
||||
# Any .o files that are needed by program that use libcustcalc${LIB_EXT_VERS}.
|
||||
# Any .o files that are needed by program that use
|
||||
# libcustcalc${LIB_EXT_VERSION}.
|
||||
#
|
||||
# Don't put ${REQUIRED_OBJ} files in this list.
|
||||
#
|
||||
# There MUST be a .c in CUSTOM_SRC for every .o in CUSTOM_OBJ.
|
||||
@@ -347,14 +351,15 @@ EXT=
|
||||
|
||||
# The default calc versions
|
||||
#
|
||||
VERSION= 2.12.2
|
||||
VERS= 2.12.2
|
||||
VERSION= 2.12.4.3
|
||||
VERS= 2.12.4
|
||||
VER= 2.12
|
||||
VE= 2
|
||||
|
||||
# Names of shared libraries with versions
|
||||
#
|
||||
LIB_EXT= .so
|
||||
LIB_EXT_VERSION= ${LIB_EXT}.${VERSION}
|
||||
LIB_EXT_VERS= ${LIB_EXT}.${VERS}
|
||||
LIB_EXT_VER= ${LIB_EXT}.${VER}
|
||||
LIB_EXT_VE= ${LIB_EXT}.${VE}
|
||||
@@ -472,8 +477,8 @@ 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_VERS}"
|
||||
LIBCUSTCALC_SHLIB= -shared "-Wl,-soname,libcustcalc${LIB_EXT_VERS}"
|
||||
LIBCALC_SHLIB= -shared "-Wl,-soname,libcalc${LIB_EXT_VERSION}"
|
||||
LIBCUSTCALC_SHLIB= -shared "-Wl,-soname,libcustcalc${LIB_EXT_VERSION}"
|
||||
#
|
||||
CC_STATIC=
|
||||
LD_STATIC=
|
||||
@@ -501,6 +506,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 -=-=-=-=-=-#
|
||||
@@ -511,14 +517,14 @@ LDFLAGS= ${LD_DEBUG} ${ILDFLAGS} ${LIBCALC_STATIC} ${LIBCUSTCALC_STATIC}
|
||||
##############################################################################
|
||||
|
||||
# These .c files are required for the main custom interface and
|
||||
# for the custom support functions for libcustcalc${LIB_EXT_VERS}.
|
||||
# for the custom support functions for libcustcalc${LIB_EXT_VERSION}.
|
||||
#
|
||||
# There MUST be a .c for every .o in REQUIRED_OBJ.
|
||||
#
|
||||
REQUIRED_SRC= custtbl.c
|
||||
|
||||
# These .o files correspond to the .c files in REQUIRED_SRC
|
||||
# for libcustcalc${LIB_EXT_VERS}.
|
||||
# for libcustcalc${LIB_EXT_VERSION}.
|
||||
#
|
||||
# There MUST be a .o for every .c in REQUIRED_SRC.
|
||||
#
|
||||
@@ -528,11 +534,11 @@ REQUIRED_OBJ= custtbl.o
|
||||
#
|
||||
INSTALL_H_SRC= ${CUSTOM_H_SRC}
|
||||
|
||||
# These .c files are used to form libcustcalc${LIB_EXT_VERS}.
|
||||
# These .c files are used to form libcustcalc${LIB_EXT_VERSION}.
|
||||
#
|
||||
CUSTCALC_SRC= ${REQUIRED_SRC} ${CUSTOM_SRC}
|
||||
|
||||
# These .o files are used to form libcustcalc${LIB_EXT_VERS}.
|
||||
# These .o files are used to form libcustcalc${LIB_EXT_VERSION}.
|
||||
#
|
||||
CUSTCALC_OBJ= ${REQUIRED_OBJ} ${CUSTOM_OBJ}
|
||||
|
||||
@@ -559,7 +565,7 @@ CALCLIBLIST= ${CUSTCALC_SRC} ${INSTALL_H_SRC} ${MAKE_FILE} HOW_TO_ADD
|
||||
|
||||
# This is the custom dynbamic shared library that is build
|
||||
#
|
||||
CALC_DYNAMIC_LIBCUSTCALC= libcustcalc${LIB_EXT_VERS}
|
||||
CALC_DYNAMIC_LIBCUSTCALC= libcustcalc${LIB_EXT_VERSION}
|
||||
|
||||
# This is the custom static library that is build
|
||||
#
|
||||
@@ -582,10 +588,10 @@ calc-dynamic-only: ${CUSTCALC_OBJ} ${CALC_DYNAMIC_LIBCUSTCALC}
|
||||
|
||||
calc-static-only: ${CUSTCALC_OBJ} ${CALC_STATIC_LIBCUSTCALC}
|
||||
|
||||
custom/libcustcalc${LIB_EXT_VERS}: libcustcalc${LIB_EXT_VERS} \
|
||||
custom/libcustcalc${LIB_EXT_VERSION}: libcustcalc${LIB_EXT_VERSION} \
|
||||
${CALC_STATIC_LIBCUSTCALC}
|
||||
|
||||
libcustcalc${LIB_EXT_VERS}: ${CUSTCALC_OBJ} ${MAKE_FILE}
|
||||
libcustcalc${LIB_EXT_VERSION}: ${CUSTCALC_OBJ} ${MAKE_FILE}
|
||||
${CC} ${LIBCUSTCALC_SHLIB} ${CUSTCALC_OBJ} -o $@
|
||||
|
||||
##
|
||||
@@ -783,6 +789,7 @@ clean:
|
||||
clobber: clean
|
||||
${RM} -f ${BLD_TYPE}
|
||||
${RM} -f .all ${MAKE_FILE}.tmp ${MAKE_FILE}.bak
|
||||
${RM} -f libcustcalc${LIB_EXT_VERSION}
|
||||
${RM} -f libcustcalc${LIB_EXT_VERS}
|
||||
${RM} -f libcustcalc${LIB_EXT_VER}
|
||||
${RM} -f libcustcalc${LIB_EXT_VE}
|
||||
@@ -939,9 +946,10 @@ install: all
|
||||
fi; \
|
||||
fi; \
|
||||
fi
|
||||
${Q}# NOTE: The upper level makefile installs libcustcalc${LIB_EXT_VERS}
|
||||
${Q}# because we only want to perform one ${LDCONFIG} for both
|
||||
${Q}# libcalc${LIB_EXT_VERS} and libcustcalc${LIB_EXT_VERS}.
|
||||
${Q}# NOTE: The upper level makefile installs the file
|
||||
${Q}# libcustcalc${LIB_EXT_VERSION} because we only want to
|
||||
${Q}# perform one ${LDCONFIG} for both libcalc${LIB_EXT_VERSION}
|
||||
${Q}# and libcustcalc${LIB_EXT_VERSION}.
|
||||
|
||||
# Try to remove everything that was installed
|
||||
#
|
||||
|
@@ -3,14 +3,14 @@
|
||||
##############################################################################
|
||||
|
||||
# These .c files are required for the main custom interface and
|
||||
# for the custom support functions for libcustcalc${LIB_EXT_VERS}.
|
||||
# for the custom support functions for libcustcalc${LIB_EXT_VERSION}.
|
||||
#
|
||||
# There MUST be a .c for every .o in REQUIRED_OBJ.
|
||||
#
|
||||
REQUIRED_SRC= custtbl.c
|
||||
|
||||
# These .o files correspond to the .c files in REQUIRED_SRC
|
||||
# for libcustcalc${LIB_EXT_VERS}.
|
||||
# for libcustcalc${LIB_EXT_VERSION}.
|
||||
#
|
||||
# There MUST be a .o for every .c in REQUIRED_SRC.
|
||||
#
|
||||
@@ -20,11 +20,11 @@ REQUIRED_OBJ= custtbl.o
|
||||
#
|
||||
INSTALL_H_SRC= ${CUSTOM_H_SRC}
|
||||
|
||||
# These .c files are used to form libcustcalc${LIB_EXT_VERS}.
|
||||
# These .c files are used to form libcustcalc${LIB_EXT_VERSION}.
|
||||
#
|
||||
CUSTCALC_SRC= ${REQUIRED_SRC} ${CUSTOM_SRC}
|
||||
|
||||
# These .o files are used to form libcustcalc${LIB_EXT_VERS}.
|
||||
# These .o files are used to form libcustcalc${LIB_EXT_VERSION}.
|
||||
#
|
||||
CUSTCALC_OBJ= ${REQUIRED_OBJ} ${CUSTOM_OBJ}
|
||||
|
||||
@@ -51,7 +51,7 @@ CALCLIBLIST= ${CUSTCALC_SRC} ${INSTALL_H_SRC} ${MAKE_FILE} HOW_TO_ADD
|
||||
|
||||
# This is the custom dynbamic shared library that is build
|
||||
#
|
||||
CALC_DYNAMIC_LIBCUSTCALC= libcustcalc${LIB_EXT_VERS}
|
||||
CALC_DYNAMIC_LIBCUSTCALC= libcustcalc${LIB_EXT_VERSION}
|
||||
|
||||
# This is the custom static library that is build
|
||||
#
|
||||
@@ -74,10 +74,10 @@ calc-dynamic-only: ${CUSTCALC_OBJ} ${CALC_DYNAMIC_LIBCUSTCALC}
|
||||
|
||||
calc-static-only: ${CUSTCALC_OBJ} ${CALC_STATIC_LIBCUSTCALC}
|
||||
|
||||
custom/libcustcalc${LIB_EXT_VERS}: libcustcalc${LIB_EXT_VERS} \
|
||||
custom/libcustcalc${LIB_EXT_VERSION}: libcustcalc${LIB_EXT_VERSION} \
|
||||
${CALC_STATIC_LIBCUSTCALC}
|
||||
|
||||
libcustcalc${LIB_EXT_VERS}: ${CUSTCALC_OBJ} ${MAKE_FILE}
|
||||
libcustcalc${LIB_EXT_VERSION}: ${CUSTCALC_OBJ} ${MAKE_FILE}
|
||||
${CC} ${LIBCUSTCALC_SHLIB} ${CUSTCALC_OBJ} -o $@
|
||||
|
||||
##
|
||||
@@ -287,6 +287,7 @@ clean:
|
||||
clobber: clean
|
||||
${RM} -f ${BLD_TYPE}
|
||||
${RM} -f .all ${MAKE_FILE}.tmp ${MAKE_FILE}.bak
|
||||
${RM} -f libcustcalc${LIB_EXT_VERSION}
|
||||
${RM} -f libcustcalc${LIB_EXT_VERS}
|
||||
${RM} -f libcustcalc${LIB_EXT_VER}
|
||||
${RM} -f libcustcalc${LIB_EXT_VE}
|
||||
@@ -446,9 +447,10 @@ install: all
|
||||
fi; \
|
||||
fi; \
|
||||
fi
|
||||
${Q}# NOTE: The upper level makefile installs libcustcalc${LIB_EXT_VERS}
|
||||
${Q}# because we only want to perform one ${LDCONFIG} for both
|
||||
${Q}# libcalc${LIB_EXT_VERS} and libcustcalc${LIB_EXT_VERS}.
|
||||
${Q}# NOTE: The upper level makefile installs the file
|
||||
${Q}# libcustcalc${LIB_EXT_VERSION} because we only want to
|
||||
${Q}# perform one ${LDCONFIG} for both libcalc${LIB_EXT_VERSION}
|
||||
${Q}# and libcustcalc${LIB_EXT_VERSION}.
|
||||
|
||||
# Try to remove everything that was installed
|
||||
#
|
||||
|
8
decl.h
8
decl.h
@@ -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: decl.h,v 30.2 2007/07/05 13:30:38 chongo Exp $
|
||||
* @(#) $Revision: 30.3 $
|
||||
* @(#) $Id: decl.h,v 30.3 2008/04/15 21:17:57 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/decl.h,v $
|
||||
*
|
||||
* Under source code control: 2007/02/09 05:24:25
|
||||
@@ -62,10 +62,14 @@
|
||||
|
||||
|
||||
/* determine which type of DLL we must generate */
|
||||
# if !defined(STATIC_ONLY)
|
||||
# if defined(_EXPORTING)
|
||||
# define DLL __declspec(dllexport)
|
||||
# else
|
||||
# define DLL __declspec(dllimport)
|
||||
# endif
|
||||
# else
|
||||
# define DLL
|
||||
# endif
|
||||
|
||||
/* variable related macros */
|
||||
|
22
endian.c
22
endian.c
@@ -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: endian.c,v 30.1 2007/03/16 11:09:46 chongo Exp $
|
||||
* @(#) $Revision: 30.3 $
|
||||
* @(#) $Id: endian.c,v 30.3 2010/09/02 09:47:46 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/endian.c,v $
|
||||
*
|
||||
* Under source code control: 1993/11/15 04:32:58
|
||||
@@ -53,10 +53,8 @@ char byte[8] = { (char)0x12, (char)0x36, (char)0x48, (char)0x59,
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
#if !defined(LITTLE_ENDIAN) && !defined(BIG_ENDIAN)
|
||||
/* pointers into the byte order array */
|
||||
int *intp = (int *)byte;
|
||||
#endif
|
||||
#if defined(DEBUG)
|
||||
short *shortp = (short *)byte;
|
||||
long *longp = (long *)byte;
|
||||
@@ -73,13 +71,16 @@ main(void)
|
||||
#endif
|
||||
|
||||
/* Print the standard <machine/endian.h> defines */
|
||||
printf("#undef BIG_ENDIAN\n");
|
||||
printf("#define BIG_ENDIAN\t4321\n");
|
||||
printf("#undef LITTLE_ENDIAN\n");
|
||||
printf("#define LITTLE_ENDIAN\t1234\n");
|
||||
printf("#undef CALC_BYTE_ORDER\n");
|
||||
|
||||
#if defined(LITTLE_ENDIAN)
|
||||
printf("#define CALC_BYTE_ORDER\tLITTLE_ENDIAN\n");
|
||||
#elif defined(BIG_ENDIAN)
|
||||
#if defined(BIG_ENDIAN)
|
||||
printf("#define CALC_BYTE_ORDER\tBIG_ENDIAN\n");
|
||||
#elif defined(LITTLE_ENDIAN)
|
||||
printf("#define CALC_BYTE_ORDER\tLITTLW_ENDIAN\n");
|
||||
#else
|
||||
/* Determine byte order */
|
||||
if (intp[0] == 0x12364859) {
|
||||
@@ -89,8 +90,11 @@ main(void)
|
||||
/* Least Significant Byte first */
|
||||
printf("#define CALC_BYTE_ORDER\tLITTLE_ENDIAN\n");
|
||||
} else {
|
||||
fprintf(stderr,
|
||||
"Unknown int Byte Order, set CALC_BYTE_ORDER in Makefile\n");
|
||||
fprintf(stderr, "@=-=@ Fatal build error - cannot @=-=@\n");
|
||||
fprintf(stderr, "@=-=@ determine byte order. Set @=-=@\n");
|
||||
fprintf(stderr, "@=-=@ ${CALC_BYTE_ORDER} in the Makefile @=-=@\n");
|
||||
fprintf(stderr, "@=-=@ to be either -DBIG_ENDIAN or @=-=@\n");
|
||||
fprintf(stderr, "@=-=@ to be -DLITTLE_ENDIAN @=-=@\n");
|
||||
exit(1);
|
||||
}
|
||||
#endif
|
||||
|
@@ -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: fposval.c,v 30.1 2007/03/16 11:09:46 chongo Exp $
|
||||
* @(#) $Revision: 30.2 $
|
||||
* @(#) $Id: fposval.c,v 30.2 2007/09/19 22:34:22 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/fposval.c,v $
|
||||
*
|
||||
* Under source code control: 1994/11/05 03:19:52
|
||||
@@ -129,7 +129,7 @@ main(int argc, char **argv)
|
||||
* systems a FILEPOS is not a scalar hince we must memcpy.
|
||||
*/
|
||||
printf("#define SWAP_HALF_IN_FILEPOS(dest, src)\t%s\n",
|
||||
"memcpy((void *)(dest), (void *)(src), sizeof(FPOS_POS_BITS))");
|
||||
"memcpy((void *)(dest), (void *)(src), sizeof(FPOS_POS_LEN))");
|
||||
#endif /* HAVE_FILEPOS_SCALAR */
|
||||
#endif /* CALC_BYTE_ORDER == BIG_ENDIAN */
|
||||
putchar('\n');
|
||||
|
6
func.c
6
func.c
@@ -19,8 +19,8 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* @(#) $Revision: 30.2 $
|
||||
* @(#) $Id: func.c,v 30.2 2007/07/05 17:37:41 chongo Exp $
|
||||
* @(#) $Revision: 30.3 $
|
||||
* @(#) $Id: func.c,v 30.3 2008/04/15 21:17:57 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/func.c,v $
|
||||
*
|
||||
* Under source code control: 1990/02/15 01:48:15
|
||||
@@ -5721,7 +5721,9 @@ f_fflush(int count, VALUE **vals)
|
||||
i = 0;
|
||||
errno = 0;
|
||||
if (count == 0) {
|
||||
#if !defined(_WIN32)
|
||||
i = flushall();
|
||||
#endif /* Windoz free systems */
|
||||
} else {
|
||||
for (n = 0; n < count; n++) {
|
||||
if (vals[n]->v_type != V_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: have_fpos_pos.c,v 30.1 2007/03/16 11:09:46 chongo Exp $
|
||||
* @(#) $Revision: 30.2 $
|
||||
* @(#) $Id: have_fpos_pos.c,v 30.2 2007/09/19 22:34:22 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/have_fpos_pos.c,v $
|
||||
*
|
||||
* Under source code control: 2000/12/17 01:23
|
||||
@@ -51,17 +51,21 @@ main(void)
|
||||
printf("#define HAVE_FPOS_POS 1 /* yes */\n\n");
|
||||
|
||||
/* determine __pos element size */
|
||||
printf("#undef FPOS_POS_BITS\t/* no */\n");
|
||||
printf("#undef FPOS_POS_BITS\n");
|
||||
printf("#undef FPOS_POS_LEN\n");
|
||||
# if defined(FPOS_POS_BITS)
|
||||
printf("#define FPOS_POS_BITS %d\n\n", FPOS_POS_BITS);
|
||||
printf("#define FPOS_POS_BITS %d\n", FPOS_POS_BITS);
|
||||
printf("#define FPOS_POS_LEN %d\n", int(FPOS_POS_BITS/8));
|
||||
# else
|
||||
printf("#define FPOS_POS_BITS %d\n\n", sizeof(pos.__pos)*8);
|
||||
printf("#define FPOS_POS_BITS %d\n", sizeof(pos.__pos)*8);
|
||||
printf("#define FPOS_POS_LEN %d\n", sizeof(pos.__pos));
|
||||
# endif
|
||||
|
||||
#else
|
||||
/* we have no __pos element */
|
||||
printf("#undef HAVE_FPOS_POS\t/* no */\n");
|
||||
printf("#undef FPOS_POS_BITS\n");
|
||||
printf("#undef FPOS_POS_LEN\n");
|
||||
#endif
|
||||
/* exit(0); */
|
||||
return 0;
|
||||
|
@@ -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: have_offscl.c,v 30.1 2007/03/16 11:09:46 chongo Exp $
|
||||
* @(#) $Revision: 30.2 $
|
||||
* @(#) $Id: have_offscl.c,v 30.2 2008/04/15 21:17:57 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/have_offscl.c,v $
|
||||
*
|
||||
* Under source code control: 1996/07/13 12:57:22
|
||||
@@ -66,9 +66,11 @@ main(void)
|
||||
if (value > (off_t)1) {
|
||||
--value;
|
||||
}
|
||||
#if !defined(_WIN32)
|
||||
if (value <= (off_t)getppid()) {
|
||||
--value;
|
||||
}
|
||||
#endif
|
||||
if (value == value2) {
|
||||
value += value2;
|
||||
}
|
||||
|
@@ -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: have_posscl.c,v 30.1 2007/03/16 11:09:46 chongo Exp $
|
||||
* @(#) $Revision: 30.2 $
|
||||
* @(#) $Id: have_posscl.c,v 30.2 2008/04/15 21:17:57 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/have_posscl.c,v $
|
||||
*
|
||||
* Under source code control: 1996/07/13 12:57:22
|
||||
@@ -66,9 +66,11 @@ main(void)
|
||||
if (value > (FILEPOS)1) {
|
||||
--value;
|
||||
}
|
||||
#if !defined(_WIN32)
|
||||
if (value <= (FILEPOS)getppid()) {
|
||||
--value;
|
||||
}
|
||||
#endif
|
||||
if (value == value2) {
|
||||
value += value2;
|
||||
}
|
||||
|
10
help.c
10
help.c
@@ -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: help.c,v 30.1 2007/03/16 11:09:46 chongo Exp $
|
||||
* @(#) $Revision: 30.2 $
|
||||
* @(#) $Id: help.c,v 30.2 2007/09/21 01:27:27 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/help.c,v $
|
||||
*
|
||||
* Under source code control: 1997/09/14 10:58:30
|
||||
@@ -249,11 +249,15 @@ givehelp(char *type)
|
||||
/*
|
||||
* open the helpfile (looking in HELPDIR first)
|
||||
*/
|
||||
#if defined(CUSTOM)
|
||||
if (sizeof(CUSTOMHELPDIR) > sizeof(HELPDIR)) {
|
||||
helppath = (char *)malloc(sizeof(CUSTOMHELPDIR)+1+strlen(type));
|
||||
} else {
|
||||
helppath = (char *)malloc(sizeof(HELPDIR)+1+strlen(type));
|
||||
}
|
||||
#else /* CUSTOM */
|
||||
helppath = (char *)malloc(sizeof(HELPDIR)+1+strlen(type));
|
||||
#endif /* CUSTOM */
|
||||
if (helppath == NULL) {
|
||||
fprintf(stderr, "malloc failure in givehelp()\n");
|
||||
return;
|
||||
@@ -268,6 +272,7 @@ givehelp(char *type)
|
||||
page_file(stream);
|
||||
(void) fclose(stream);
|
||||
|
||||
#if defined(CUSTOM)
|
||||
/*
|
||||
* open the the helpfile (looking in CUSTOMHELPDIR last)
|
||||
*/
|
||||
@@ -287,6 +292,7 @@ givehelp(char *type)
|
||||
page_file(stream);
|
||||
(void) fclose(stream);
|
||||
}
|
||||
#endif /* CUSTOM */
|
||||
}
|
||||
|
||||
/*
|
||||
|
@@ -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.4 $
|
||||
# @(#) $Id: Makefile,v 30.4 2007/09/02 05:49:56 chongo Exp $
|
||||
# @(#) $Revision: 30.5 $
|
||||
# @(#) $Id: Makefile,v 30.5 2007/09/21 01:27:27 chongo Exp $
|
||||
# @(#) $Source: /usr/local/src/cmd/calc/help/RCS/Makefile,v $
|
||||
#
|
||||
# Under source code control: 1991/07/23 06:47:57
|
||||
@@ -111,9 +111,6 @@ CALC_SHAREDIR= /usr/share/calc
|
||||
# ---------------------------------------------------------------
|
||||
# ${HELPDIR} where the help directory is installed
|
||||
# ${CALC_INCDIR} where the calc include files are installed
|
||||
# ${CUSTOMCALDIR} where custom *.cal files are installed
|
||||
# ${CUSTOMHELPDIR} where custom help files are installed
|
||||
# ${CUSTOMINCPDIR} where custom .h files are installed
|
||||
# ${SCRIPTDIR} where calc shell scripts are installed
|
||||
#
|
||||
# NOTE: The install rule prepends installation paths with ${T}, which
|
||||
@@ -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
|
||||
|
@@ -600,7 +600,9 @@ DESCRIPTION
|
||||
|
||||
6 Report on rand() subtractive 100 shuffle generator issues.
|
||||
|
||||
Bits >= 7 are reserved for future use and should not be used at this time.
|
||||
7 Report on custom function issues.
|
||||
|
||||
Bits >= 8 are reserved for future use and should not be used at this time.
|
||||
|
||||
By default, "calc_debug" is 0. The initial value may be overridden
|
||||
by the -D command line option.
|
||||
@@ -972,8 +974,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.2 $
|
||||
## @(#) $Id: config,v 30.2 2007/07/05 17:37:41 chongo Exp $
|
||||
## @(#) $Revision: 30.3 $
|
||||
## @(#) $Id: config,v 30.3 2007/09/21 01:27:27 chongo Exp $
|
||||
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/config,v $
|
||||
##
|
||||
## Under source code control: 1991/07/21 04:37:17
|
||||
|
@@ -128,32 +128,28 @@ 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_test 1 logical test (false,true => 0,1), default tests elements
|
||||
xx_add 2
|
||||
xx_sub 2 subtraction, default adds negative
|
||||
xx_sub 2
|
||||
xx_neg 1 negative
|
||||
xx_mul 2
|
||||
xx_div 2 non-integral division, default multiplies
|
||||
by inverse
|
||||
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_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_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
|
||||
@@ -161,25 +157,43 @@ Using objects
|
||||
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_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 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_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
|
||||
|
25
help/rand
25
help/rand
@@ -2,18 +2,21 @@ NAME
|
||||
rand - subtractive 100 shuffle pseudo-random number generator
|
||||
|
||||
SYNOPSIS
|
||||
rand([[min, ] max])
|
||||
rand([[min, ] beyond])
|
||||
|
||||
TYPES
|
||||
min integer
|
||||
max integer
|
||||
beyond integer
|
||||
|
||||
return integer
|
||||
|
||||
DESCRIPTION
|
||||
Generate a pseudo-random number using an subtractive 100 shuffle generator.
|
||||
We return a pseudo-random number over the half closed interval [min,max).
|
||||
By default, min is 0 and max is 2^64.
|
||||
We return a pseudo-random number over the half closed interval:
|
||||
|
||||
[min,beyond) ((min <= return < beyond))
|
||||
|
||||
By default, min is 0 and beyond is 2^64.
|
||||
|
||||
The shuffle method is fast and serves as a fairly good standard
|
||||
pseudo-random generator. If you need a fast generator and do not
|
||||
@@ -26,7 +29,7 @@ DESCRIPTION
|
||||
Other arg forms:
|
||||
|
||||
rand() Same as rand(0, 2^64)
|
||||
rand(max) Same as rand(0, max)
|
||||
rand(beyond) Same as rand(0, beyond)
|
||||
|
||||
The rand generator generates the highest order bit first. Thus:
|
||||
|
||||
@@ -230,17 +233,17 @@ EXAMPLE
|
||||
2 658186291252503497642116 1 -324097
|
||||
|
||||
LIMITS
|
||||
min < max
|
||||
min < beyond
|
||||
|
||||
LINK LIBRARY
|
||||
void zrand(long cnt, ZVALUE *res)
|
||||
void zrandrange(ZVALUE low, ZVALUE high, ZVALUE *res)
|
||||
long irand(long max)
|
||||
void zrandrange(ZVALUE low, ZVALUE beyond, ZVALUE *res)
|
||||
long irand(long beyond)
|
||||
|
||||
SEE ALSO
|
||||
seed, srand, randbit, isrand, random, srandom, israndom
|
||||
|
||||
## Copyright (C) 1999 Landon Curt Noll
|
||||
## Copyright (C) 1999-2007 Landon Curt Noll
|
||||
##
|
||||
## Calc is open software; you can redistribute it and/or modify it under
|
||||
## the terms of the version 2.1 of the GNU Lesser General Public License
|
||||
@@ -256,8 +259,8 @@ SEE ALSO
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##
|
||||
## @(#) $Revision: 30.1 $
|
||||
## @(#) $Id: rand,v 30.1 2007/03/16 11:10:42 chongo Exp $
|
||||
## @(#) $Revision: 30.3 $
|
||||
## @(#) $Id: rand,v 30.3 2007/09/21 02:16:29 chongo Exp $
|
||||
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/rand,v $
|
||||
##
|
||||
## Under source code control: 1996/01/01 02:16:09
|
||||
|
27
help/random
27
help/random
@@ -2,18 +2,21 @@ NAME
|
||||
random - Blum-Blum-Shub pseudo-random number generator
|
||||
|
||||
SYNOPSIS
|
||||
random([[min, ] max])
|
||||
random([[min, ] beyond])
|
||||
|
||||
TYPES
|
||||
min integer
|
||||
max integer
|
||||
beyond integer
|
||||
|
||||
return integer
|
||||
|
||||
DESCRIPTION
|
||||
Generate a pseudo-random number using a Blum-Blum-Shub generator.
|
||||
We return a pseudo-random number over the half closed interval [min,max).
|
||||
By default, min is 0 and max is 2^64.
|
||||
We return a pseudo-random number over the half closed interval:
|
||||
|
||||
[min,beyond) ((min <= return < beyond))
|
||||
|
||||
By default, min is 0 and beyond is 2^64.
|
||||
|
||||
While the Blum-Blum-Shub generator is not painfully slow, it is not
|
||||
a fast generator. For a faster, but lesser quality generator
|
||||
@@ -22,8 +25,8 @@ DESCRIPTION
|
||||
|
||||
Other arg forms:
|
||||
|
||||
random() Same as rand(0, 2^64)
|
||||
random(max) Same as rand(0, max)
|
||||
random() Same as random(0, 2^64)
|
||||
random(beyond) Same as random(0, beyond)
|
||||
|
||||
The random generator generates the highest order bit first. Thus:
|
||||
|
||||
@@ -146,17 +149,17 @@ EXAMPLE
|
||||
10 483381144668580304003305 0 -70235
|
||||
|
||||
LIMITS
|
||||
min < max
|
||||
min < beyond
|
||||
|
||||
LINK LIBRARY
|
||||
void zrandom(long cnt, ZVALUE *res)
|
||||
void zrandomrange(ZVALUE low, ZVALUE high, ZVALUE *res)
|
||||
long irandom(long max)
|
||||
void zrandomrange(ZVALUE low, ZVALUE beyond, ZVALUE *res)
|
||||
long irandom(long beyond)
|
||||
|
||||
SEE ALSO
|
||||
seed, srand, randbit, isrand, rand, srandom, israndom
|
||||
|
||||
## Copyright (C) 1999 Landon Curt Noll
|
||||
## Copyright (C) 1999-2007 Landon Curt Noll
|
||||
##
|
||||
## Calc is open software; you can redistribute it and/or modify it under
|
||||
## the terms of the version 2.1 of the GNU Lesser General Public License
|
||||
@@ -172,8 +175,8 @@ SEE ALSO
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##
|
||||
## @(#) $Revision: 30.1 $
|
||||
## @(#) $Id: random,v 30.1 2007/03/16 11:10:42 chongo Exp $
|
||||
## @(#) $Revision: 30.3 $
|
||||
## @(#) $Id: random,v 30.3 2007/09/21 02:16:29 chongo Exp $
|
||||
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/random,v $
|
||||
##
|
||||
## Under source code control: 1997/02/17 01:18:22
|
||||
|
6
help/sgn
6
help/sgn
@@ -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
|
||||
|
14
help/todo
14
help/todo
@@ -51,6 +51,12 @@ Very High priority items:
|
||||
|
||||
* Consider using GNU autoconf / configure to build calc.
|
||||
|
||||
* It is overkill to have nearly everything wind up in libcalc.
|
||||
Form a libcalcmath and a libcalclang so that an application
|
||||
that just wants to link with the calc math libs can use them
|
||||
without dragging in all of the other calc language, I/O,
|
||||
and builtin functions.
|
||||
|
||||
* Fix any 'Known bugs' as noted in the BUGS file or as
|
||||
displayed by 'calc help bugs'.
|
||||
|
||||
@@ -102,8 +108,6 @@ Medium priority items:
|
||||
at by 'fizbin' and the HALF array pointer at by 'data' should be
|
||||
treated as read-only.
|
||||
|
||||
* It is overkill to have nearly everything wind up in libcalc.a.
|
||||
|
||||
One should make available a the fundamental math operations
|
||||
on ZVALUE, NUMBER and perhaps COMPLEX (without all of the
|
||||
other stuff) in a separate library.
|
||||
@@ -113,7 +117,7 @@ Medium priority items:
|
||||
* Add a builtin function to access the 64 bit FNV hash which
|
||||
is currently being used internally in seed.c.
|
||||
|
||||
## Copyright (C) 1999-2006 Landon Curt Noll
|
||||
## Copyright (C) 1999-2007 Landon Curt Noll
|
||||
##
|
||||
## Calc is open software; you can redistribute it and/or modify it under
|
||||
## the terms of the version 2.1 of the GNU Lesser General Public License
|
||||
@@ -129,8 +133,8 @@ Medium priority items:
|
||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
##
|
||||
## @(#) $Revision: 30.1 $
|
||||
## @(#) $Id: todo,v 30.1 2007/03/16 11:10:42 chongo Exp $
|
||||
## @(#) $Revision: 30.2 $
|
||||
## @(#) $Id: todo,v 30.2 2007/09/08 02:52:42 chongo Exp $
|
||||
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/todo,v $
|
||||
##
|
||||
## Under source code control: 1999/10/20 07:42:55
|
||||
|
@@ -4,6 +4,10 @@ Unexpected
|
||||
surprises in calc syntax and usage. Persons familiar with C should
|
||||
review this file.
|
||||
|
||||
Persons familiar with shell scripting may want to review this file
|
||||
as well, particularly notes dealing with command line evaluation
|
||||
and execution.
|
||||
|
||||
|
||||
The Comma
|
||||
=========
|
||||
@@ -75,7 +79,7 @@ Unexpected
|
||||
|
||||
(-1) ^ 0.5 == 1i
|
||||
|
||||
because the above expresssion in parsed as:
|
||||
because the above expression in parsed as:
|
||||
|
||||
-(1 ^ 0.5) == -1
|
||||
|
||||
@@ -220,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
|
||||
========================================
|
||||
@@ -335,7 +345,66 @@ Unexpected
|
||||
NOTE: See "help statement", "help todo", and "help bugs".
|
||||
|
||||
|
||||
## Copyright (C) 1999-2006 Landon Curt Noll
|
||||
Shell evaluation of command line arguments
|
||||
==========================================
|
||||
|
||||
In most interactive shells:
|
||||
|
||||
calc 2 * 3
|
||||
|
||||
will frequently produce a "Missing operator" error because the '*' is
|
||||
evaluated as a "shell glob". To avoid this you must quote or escape
|
||||
argument with characters that your interactive shell interprets.
|
||||
|
||||
For example, bash / ksh / sh shell users should use:
|
||||
|
||||
calc '2 * 3'
|
||||
|
||||
or:
|
||||
|
||||
calc 2 \* 3
|
||||
|
||||
or some other form of shell meta-character escaping.
|
||||
|
||||
|
||||
Calc reads standard input after processing command line args
|
||||
============================================================
|
||||
|
||||
The shell command:
|
||||
|
||||
seq 5 | while read i; do calc "($i+3)^2"; done
|
||||
|
||||
FYI: The command "seq 5" will write 1 through 5 on separate
|
||||
lines on standard output, while read i sets $i to
|
||||
the value of each line that is read from stdin.
|
||||
|
||||
will produce:
|
||||
|
||||
16
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
|
||||
The reason why the last 4 lines of output are 2 through 5 is
|
||||
that after calc evaluates the first line and prints (1+3)^2
|
||||
(i.e., 16), calc continues to read stdin and slurps up all
|
||||
of the remaining data on the pipe.
|
||||
|
||||
To avoid this problem, use:
|
||||
|
||||
seq 5 | while read i; do calc "($i+3)^2" </dev/null; done
|
||||
|
||||
which produces the expected results:
|
||||
|
||||
16
|
||||
25
|
||||
36
|
||||
49
|
||||
64
|
||||
|
||||
|
||||
## Copyright (C) 1999-2007 Landon Curt Noll
|
||||
##
|
||||
## Calc is open software; you can redistribute it and/or modify it under
|
||||
## the terms of the version 2.1 of the GNU Lesser General Public License
|
||||
@@ -351,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.2 $
|
||||
## @(#) $Id: unexpected,v 30.2 2007/07/11 23:00:39 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
|
||||
|
17
input.c
17
input.c
@@ -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: input.c,v 30.1 2007/03/16 11:09:46 chongo Exp $
|
||||
* @(#) $Revision: 30.2 $
|
||||
* @(#) $Id: input.c,v 30.2 2008/04/15 21:17:57 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/input.c,v $
|
||||
*
|
||||
* Under source code control: 1990/02/15 01:48:16
|
||||
@@ -37,6 +37,8 @@
|
||||
#include <ctype.h>
|
||||
#if !defined(_WIN32)
|
||||
# include <pwd.h>
|
||||
#else
|
||||
# include <stdlib.h>
|
||||
#endif
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
@@ -971,17 +973,14 @@ isinoderead(struct stat *sbuf)
|
||||
/* scan the entire readset */
|
||||
for (i=0; i < maxreadset; ++i) {
|
||||
#if defined(_WIN32) || defined(__MSDOS__)
|
||||
tmp = _fullpath(NULL, cip->i_name, _MAX_PATH);
|
||||
if (readset[i].active &&
|
||||
tmp != NULL &&
|
||||
char tmp[_MAX_PATH+1];
|
||||
tmp[_MAX_PATH] = '\0';
|
||||
if (_fullpath(tmp, cip->i_name, _MAX_PATH) &&
|
||||
readset[i].active &&
|
||||
strcasecmp(readset[i].path, tmp) == 0) {
|
||||
/* found a match */
|
||||
free(tmp);
|
||||
return i;
|
||||
}
|
||||
if (tmp != NULL) {
|
||||
free(tmp);
|
||||
}
|
||||
#else /* Windoz free systems */
|
||||
if (readset[i].active &&
|
||||
sbuf->st_dev == readset[i].inode.st_dev &&
|
||||
|
21
math_error.c
21
math_error.c
@@ -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);
|
||||
}
|
||||
|
14
opcodes.c
14
opcodes.c
@@ -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');
|
||||
|
6
qtrans.c
6
qtrans.c
@@ -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);
|
||||
|
27
rpm.mk
27
rpm.mk
@@ -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.2 $$
|
||||
# @(#) $Id: rpm.mk,v 30.2 2007/09/02 05:38:34 chongo Exp chongo $
|
||||
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
|
||||
@@ -43,7 +43,7 @@ MD5SUM= md5sum
|
||||
SHA1SUM= sha1sum
|
||||
SED= sed
|
||||
FIND= find
|
||||
GZIP_PROG= gzip
|
||||
BZIP2_PROG= bzip2
|
||||
TAR= tar
|
||||
RM= rm
|
||||
LS= ls
|
||||
@@ -53,6 +53,7 @@ EGREP= egrep
|
||||
MKDIR= mkdir
|
||||
GREP= grep
|
||||
SORT= sort
|
||||
CHMOD= chmod
|
||||
|
||||
# rpm-related parameters
|
||||
#
|
||||
@@ -61,7 +62,7 @@ PROJECT_VERSION=
|
||||
PROJECT_RELEASE=
|
||||
PROJECT= $(PROJECT_NAME)-$(PROJECT_VERSION)
|
||||
SPECFILE= $(PROJECT_NAME).spec
|
||||
TARBALL= $(PROJECT).${TAR}.gz
|
||||
TARBALL= $(PROJECT).${TAR}.bz2
|
||||
RPM686= $(PROJECT)-$(PROJECT_RELEASE).${TARCH}.rpm
|
||||
DRPM686= $(PROJECT_NAME)-devel-$(PROJECT_VERSION)-$(PROJECT_RELEASE).${TARCH}.rpm
|
||||
SRPM= $(PROJECT)-$(PROJECT_RELEASE).src.rpm
|
||||
@@ -88,7 +89,7 @@ all: calc.spec ver_calc
|
||||
calc.spec.in`" rpm
|
||||
${V} echo '=-=-=-=-= rpm.mk end of $@ rule =-=-=-=-='
|
||||
|
||||
pkgme: $(PROJECT_NAME)-spec.${TAR}.gz
|
||||
pkgme: $(PROJECT_NAME)-spec.${TAR}.bz2
|
||||
|
||||
ver_calc:
|
||||
${V} echo '=-=-=-=-= rpm.mk start of $@ rule =-=-=-=-='
|
||||
@@ -112,12 +113,18 @@ calc.spec: calc.spec.in ver_calc
|
||||
srcpkg: make_rhdir
|
||||
${V} echo '=-=-=-=-= rpm.mk start of $@ rule =-=-=-=-='
|
||||
${FIND} . -depth -print | \
|
||||
${EGREP} -v '/RCS|/CVS|/NOTES|/\.|\.out$$|\.safe$$' | \
|
||||
${EGREP} -v '/old[._-]|\.old$$|\.tar\.gz$$' | \
|
||||
${EGREP} -v '/RCS|/CVS|/NOTES|/\.|\.out$$|\.safe$$\.tar\.bz2$$' | \
|
||||
${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)") | \
|
||||
${GZIP_PROG} -c > "$(RPMDIR)/SOURCES/$(TARBALL)"
|
||||
${BZIP2_PROG} --best -c -z > "$(RPMDIR)/SOURCES/$(TARBALL)"
|
||||
${RM} -fr "$(TMPDIR)/$(PROJECT)"
|
||||
${V} echo '=-=-=-=-= rpm.mk end of $@ rule =-=-=-=-='
|
||||
|
||||
@@ -228,10 +235,10 @@ uninstallrpm:
|
||||
${RPM_TOOL} -e "$(PROJECT_NAME)"
|
||||
${V} echo '=-=-=-=-= rpm.mk end of $@ rule =-=-=-=-='
|
||||
|
||||
$(PROJECT_NAME)-spec.${TAR}.gz: rpm.mk $(PROJECT_NAME).spec.in
|
||||
$(PROJECT_NAME)-spec.${TAR}.bz2: rpm.mk $(PROJECT_NAME).spec.in
|
||||
${V} echo '=-=-=-=-= rpm.mk start of $@ rule =-=-=-=-='
|
||||
${RM} -f "$@"
|
||||
${TAR} cf - "$^" | ${GZIP_PROG} -c > "$@"
|
||||
${TAR} cf - "$^" | ${BZIP2_PROG} --best -c -z > "$@"
|
||||
${V} echo '=-=-=-=-= rpm.mk end of $@ rule =-=-=-=-='
|
||||
|
||||
#****
|
||||
|
5
token.c
5
token.c
@@ -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());
|
||||
|
8
value.c
8
value.c
@@ -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) {
|
||||
|
16
version.c
16
version.c
@@ -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.3 $
|
||||
* @(#) $Id: version.c,v 30.3 2007/07/15 02:09:35 chongo Exp $
|
||||
* @(#) $Revision: 30.13 $
|
||||
* @(#) $Id: version.c,v 30.13 2010/09/02 09:50:19 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 2 /* major software level under library version */
|
||||
#define MINOR_PATCH 0 /* minor software level or 0 if none */
|
||||
#define MAJOR_PATCH 4 /* major software level under library version */
|
||||
#define MINOR_PATCH 3 /* minor software level or 0 if not patched */
|
||||
|
||||
|
||||
/*
|
||||
@@ -103,8 +103,6 @@ char *Copyright = "\n"
|
||||
* string does not contain the title, just:
|
||||
*
|
||||
* x.y.z.w
|
||||
* x.y.z
|
||||
* x.y
|
||||
*/
|
||||
char *
|
||||
version(void)
|
||||
@@ -121,15 +119,9 @@ version(void)
|
||||
/*
|
||||
* form the version buffer
|
||||
*/
|
||||
if (MINOR_PATCH > 0) {
|
||||
snprintf(verbuf, BUFSIZ,
|
||||
"%d.%d.%d.%d", calc_major_ver, calc_minor_ver,
|
||||
calc_major_patch, calc_minor_patch);
|
||||
} else {
|
||||
snprintf(verbuf, BUFSIZ,
|
||||
"%d.%d.%d", calc_major_ver,
|
||||
calc_minor_ver, calc_major_patch);
|
||||
}
|
||||
|
||||
/*
|
||||
* save the versions string into a newly malloced buffer
|
||||
|
@@ -8,9 +8,8 @@
|
||||
|
||||
|
||||
/* what byte order are we? */
|
||||
#define BIG_ENDIAN 4321
|
||||
#define LITTLE_ENDIAN 1234
|
||||
#define CALC_BYTE_ORDER LITTLE_ENDIAN
|
||||
#include <endian.h>
|
||||
#define CALC_BYTE_ORDER BYTE_ORDER
|
||||
|
||||
|
||||
#endif /* !__ENDIAN_CALC_H__ */
|
||||
|
@@ -10,6 +10,7 @@
|
||||
/* do we have fgetpos & fsetpos functions? */
|
||||
#undef HAVE_FPOS_POS /* no */
|
||||
#undef FPOS_POS_BITS
|
||||
#undef FPOS_POS_LEN
|
||||
|
||||
|
||||
#endif /* !__HAVE_FPOS_POS_H__ */
|
||||
|
49
zfunc.c
49
zfunc.c
@@ -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: zfunc.c,v 30.1 2007/03/16 11:09:46 chongo Exp $
|
||||
* @(#) $Revision: 30.2 $
|
||||
* @(#) $Id: zfunc.c,v 30.2 2008/02/24 07:41:49 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/zfunc.c,v $
|
||||
*
|
||||
* Under source code control: 1990/02/15 01:48:27
|
||||
@@ -374,12 +374,28 @@ zcomb(ZVALUE z1, ZVALUE z2, ZVALUE *res)
|
||||
|
||||
|
||||
/*
|
||||
* Compute the Jacobi function (p / q) for odd q.
|
||||
* If q is prime then the result is:
|
||||
* 1 if p == x^2 (mod q) for some x.
|
||||
* -1 otherwise.
|
||||
* If q is not prime, then the result is not meaningful if it is 1.
|
||||
* This function returns 0 if q is even or q < 0.
|
||||
* Compute the Jacobi function (m / n) for odd n.
|
||||
*
|
||||
* The property of the Jacobi function is: If n>2 is prime then
|
||||
*
|
||||
* the result is 1 if m == x^2 (mod n) for some x.
|
||||
* otherwise the result is -1.
|
||||
*
|
||||
* If n is not prime, then the result does not prove that n is not prine
|
||||
* when the value of the Jacobi is 1.
|
||||
*
|
||||
* Jacobi evaluation of (m / n), where n > 0 is odd AND m > 0 is odd:
|
||||
*
|
||||
* rule 0: (0 / n) == 0
|
||||
* rule 1: (1 / n) == 1
|
||||
* rule 2: (m / n) == (a / n) if m == a % n
|
||||
* rule 3: (m / n) == (2*m / n) if n == 1 % 8 OR n == 7 % 8
|
||||
* rule 4: (m / n) == -(2*m / n) if n != 1 & 8 AND n != 7 % 8
|
||||
* rule 5: (m / n) == (n / m) if m == 3 % 4 AND n == 3 % 4
|
||||
* rule 6: (m / n) == -(n / m) if m != 3 % 4 OR n != 3 % 4
|
||||
*
|
||||
* NOTE: This function returns 0 in invalid Jacobi parameters:
|
||||
* m < 0 OR n is even OR n < 1.
|
||||
*/
|
||||
FLAG
|
||||
zjacobi(ZVALUE z1, ZVALUE z2)
|
||||
@@ -388,16 +404,16 @@ zjacobi(ZVALUE z1, ZVALUE z2)
|
||||
long lowbit;
|
||||
int val;
|
||||
|
||||
/* firewall */
|
||||
if (ziszero(z1) || zisneg(z1))
|
||||
return 0;
|
||||
if (ziseven(z2) || zisneg(z2))
|
||||
return 0;
|
||||
|
||||
/* assume a value of 1 unless we find otherwise */
|
||||
if (zisone(z1))
|
||||
return 1;
|
||||
val = 1;
|
||||
if (ziszero(z1) || zisone(z1))
|
||||
return val;
|
||||
if (zisunit(z1)) {
|
||||
if ((*z2.v - 1) & 0x2)
|
||||
val = -val;
|
||||
return val;
|
||||
}
|
||||
zcopy(z1, &p);
|
||||
zcopy(z2, &q);
|
||||
for (;;) {
|
||||
@@ -406,7 +422,8 @@ zjacobi(ZVALUE z1, ZVALUE z2)
|
||||
p = tmp;
|
||||
if (ziszero(p)) {
|
||||
zfree(p);
|
||||
p = _one_;
|
||||
zfree(q);
|
||||
return 0;
|
||||
}
|
||||
if (ziseven(p)) {
|
||||
lowbit = zlowbit(p);
|
||||
|
22
zrand.c
22
zrand.c
@@ -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: zrand.c,v 30.1 2007/03/16 11:09:46 chongo Exp $
|
||||
* @(#) $Revision: 30.2 $
|
||||
* @(#) $Id: zrand.c,v 30.2 2007/09/21 01:47:34 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/zrand.c,v $
|
||||
*
|
||||
* Under source code control: 1995/01/07 09:45:25
|
||||
@@ -123,7 +123,7 @@
|
||||
*
|
||||
* The s100 generator as the following calc interfaces:
|
||||
*
|
||||
* rand(min,max) (where min < max)
|
||||
* rand(min,beyond) (where min < beyond)
|
||||
*
|
||||
* Print an s100 generator random value over interval [a,b).
|
||||
*
|
||||
@@ -2171,17 +2171,17 @@ zrand(long cnt, ZVALUE *res)
|
||||
|
||||
|
||||
/*
|
||||
* zrandrange - generate an s100 random value in the range [low, high)
|
||||
* zrandrange - generate an s100 random value in the range [low, beyond)
|
||||
*
|
||||
* given:
|
||||
* low - low value of range
|
||||
* high - beyond end of range
|
||||
* beyond - beyond end of range
|
||||
* res - where to place the random bits as ZVALUE
|
||||
*/
|
||||
void
|
||||
zrandrange(CONST ZVALUE low, CONST ZVALUE high, ZVALUE *res)
|
||||
zrandrange(CONST ZVALUE low, CONST ZVALUE beyond, ZVALUE *res)
|
||||
{
|
||||
ZVALUE range; /* high-low */
|
||||
ZVALUE range; /* beyond-low */
|
||||
ZVALUE rval; /* random value [0, 2^bitlen) */
|
||||
ZVALUE rangem1; /* range - 1 */
|
||||
long bitlen; /* smallest power of 2 >= diff */
|
||||
@@ -2189,15 +2189,15 @@ zrandrange(CONST ZVALUE low, CONST ZVALUE high, ZVALUE *res)
|
||||
/*
|
||||
* firewall
|
||||
*/
|
||||
if (zrel(low, high) >= 0) {
|
||||
math_error("srand low range >= high range");
|
||||
if (zrel(low, beyond) >= 0) {
|
||||
math_error("srand low range >= beyond range");
|
||||
/*NOTREACHED*/
|
||||
}
|
||||
|
||||
/*
|
||||
* determine the size of the random number needed
|
||||
*/
|
||||
zsub(high, low, &range);
|
||||
zsub(beyond, low, &range);
|
||||
if (zisone(range)) {
|
||||
zfree(range);
|
||||
*res = low;
|
||||
@@ -2226,7 +2226,7 @@ zrandrange(CONST ZVALUE low, CONST ZVALUE high, ZVALUE *res)
|
||||
|
||||
/*
|
||||
* add in low value to produce the range [0+low, diff+low)
|
||||
* which is the range [low, high)
|
||||
* which is the range [low, beyond)
|
||||
*/
|
||||
zadd(rval, low, res);
|
||||
zfree(rval);
|
||||
|
24
zrandom.c
24
zrandom.c
@@ -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: zrandom.c,v 30.1 2007/03/16 11:09:46 chongo Exp $
|
||||
* @(#) $Revision: 30.2 $
|
||||
* @(#) $Id: zrandom.c,v 30.2 2007/09/21 01:47:34 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/zrandom.c,v $
|
||||
*
|
||||
* Under source code control: 1997/02/15 04:01:56
|
||||
@@ -133,9 +133,9 @@
|
||||
*
|
||||
* The Blum generator as the following calc interfaces:
|
||||
*
|
||||
* random(min, max) (where min < max)
|
||||
* random(min, beyond) (where min < beyond)
|
||||
*
|
||||
* Print a Blum generator random value over interval [min,max).
|
||||
* Print a Blum generator random value over interval [min,beyond).
|
||||
*
|
||||
* random()
|
||||
*
|
||||
@@ -2904,17 +2904,17 @@ zrandom(long cnt, ZVALUE *res)
|
||||
|
||||
|
||||
/*
|
||||
* zrandomrange - generate a Blum-Blum-Shub random value in [low, high)
|
||||
* zrandomrange - generate a Blum-Blum-Shub random value in [low, beyond)
|
||||
*
|
||||
* given:
|
||||
* low - low value of range
|
||||
* high - beyond end of range
|
||||
* beyond - beyond end of range
|
||||
* res - where to place the random bits as ZVALUE
|
||||
*/
|
||||
void
|
||||
zrandomrange(CONST ZVALUE low, CONST ZVALUE high, ZVALUE *res)
|
||||
zrandomrange(CONST ZVALUE low, CONST ZVALUE beyond, ZVALUE *res)
|
||||
{
|
||||
ZVALUE range; /* high-low */
|
||||
ZVALUE range; /* beyond-low */
|
||||
ZVALUE rval; /* random value [0, 2^bitlen) */
|
||||
ZVALUE rangem1; /* range - 1 */
|
||||
long bitlen; /* smallest power of 2 >= diff */
|
||||
@@ -2922,15 +2922,15 @@ zrandomrange(CONST ZVALUE low, CONST ZVALUE high, ZVALUE *res)
|
||||
/*
|
||||
* firewall
|
||||
*/
|
||||
if (zrel(low, high) >= 0) {
|
||||
math_error("srand low range >= high range");
|
||||
if (zrel(low, beyond) >= 0) {
|
||||
math_error("srand low range >= beyond range");
|
||||
/*NOTREACHED*/
|
||||
}
|
||||
|
||||
/*
|
||||
* determine the size of the random number needed
|
||||
*/
|
||||
zsub(high, low, &range);
|
||||
zsub(beyond, low, &range);
|
||||
if (zisone(range)) {
|
||||
zfree_random(range);
|
||||
zcopy(low, res);
|
||||
@@ -2959,7 +2959,7 @@ zrandomrange(CONST ZVALUE low, CONST ZVALUE high, ZVALUE *res)
|
||||
|
||||
/*
|
||||
* add in low value to produce the range [0+low, diff+low)
|
||||
* which is the range [low, high)
|
||||
* which is the range [low, beyond)
|
||||
*/
|
||||
zadd(rval, low, res);
|
||||
zfree_random(rval);
|
||||
|
Reference in New Issue
Block a user