mirror of
https://github.com/lcn2/calc.git
synced 2025-08-19 01:13:27 +03:00
Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
fc85ac3791 | ||
|
3d55811205 | ||
|
296aa50ac7 |
30
BUGS
30
BUGS
@@ -83,6 +83,32 @@ Problems with known work-a-rounds:
|
|||||||
to fail the regression test. The work-a-round is to compile with -O
|
to fail the regression test. The work-a-round is to compile with -O
|
||||||
or to use gcc-2.96 or later.
|
or to use gcc-2.96 or later.
|
||||||
|
|
||||||
|
This bug has been observed on the Sparc and the PowerPC machine.
|
||||||
|
|
||||||
|
On the PowerPC with gcc-2.95 when compiled with -O2, the following
|
||||||
|
patch seems to help:
|
||||||
|
|
||||||
|
*** zfunc.c.orig Fri Feb 23 18:18:39 2001
|
||||||
|
--- zfunc.c Fri Feb 23 18:39:33 2001
|
||||||
|
***************
|
||||||
|
*** 1481,1487 ****
|
||||||
|
{
|
||||||
|
HALF *a, *A, *b, *a0, u;
|
||||||
|
int i, j, j1, j2, k, k1, m, m0, m1, n, n0, o;
|
||||||
|
! FULL d, e, f, g, h, s, t, x, topbit;
|
||||||
|
int remsign;
|
||||||
|
BOOL up, onebit;
|
||||||
|
ZVALUE sqrt;
|
||||||
|
--- 1481,1488 ----
|
||||||
|
{
|
||||||
|
HALF *a, *A, *b, *a0, u;
|
||||||
|
int i, j, j1, j2, k, k1, m, m0, m1, n, n0, o;
|
||||||
|
! volatile FULL d;
|
||||||
|
! FULL e, f, g, h, s, t, x, topbit;
|
||||||
|
int remsign;
|
||||||
|
BOOL up, onebit;
|
||||||
|
ZVALUE sqrt;
|
||||||
|
|
||||||
* Solaris cc somtimes barfs while compiling zrand.c. In particular, calc
|
* Solaris cc somtimes barfs while compiling zrand.c. In particular, calc
|
||||||
barfs on on the SVAL macro. The work-a-round is to use the Solaric cc
|
barfs on on the SVAL macro. The work-a-round is to use the Solaric cc
|
||||||
Makefile set sets -DFORCE_STDC. I.e,:
|
Makefile set sets -DFORCE_STDC. I.e,:
|
||||||
@@ -179,8 +205,8 @@ Problems with known work-a-rounds:
|
|||||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||||
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||||
##
|
##
|
||||||
## @(#) $Revision: 29.5 $
|
## @(#) $Revision: 29.7 $
|
||||||
## @(#) $Id: BUGS,v 29.5 2000/06/07 14:02:13 chongo Exp $
|
## @(#) $Id: BUGS,v 29.7 2001/02/25 21:01:52 chongo Exp $
|
||||||
## @(#) $Source: /usr/local/src/cmd/calc/RCS/BUGS,v $
|
## @(#) $Source: /usr/local/src/cmd/calc/RCS/BUGS,v $
|
||||||
##
|
##
|
||||||
## Under source code control: 1994/03/18 14:06:13
|
## Under source code control: 1994/03/18 14:06:13
|
||||||
|
44
CHANGES
44
CHANGES
@@ -1,3 +1,21 @@
|
|||||||
|
The following are the changes from calc version 2.11.5t0 to date:
|
||||||
|
|
||||||
|
Fixed a compile problem with Linux 2.4 / Debian. Thanks goes
|
||||||
|
to Martin Buck <m at rtin-buck dot de> for help with this issue.
|
||||||
|
|
||||||
|
Fixed a bug in how L64_FORMAT (it determined if "%ld" or "%lld"
|
||||||
|
is appropriate for printing of 64 bit long longs) was determined.
|
||||||
|
Thanks goes to Martin Buck <m at rtin-buck dot de> for reporting
|
||||||
|
this bug and testing the fix.
|
||||||
|
|
||||||
|
An effort was made to make calc easier to build under Windoz
|
||||||
|
using the Cygwin project (http://sources.redhat.com/cygwin/).
|
||||||
|
Thanks to the work of Thomas Jones-Low (tjoneslo and softstart
|
||||||
|
dot com), a number of #if defined(_WIN32)'s have been added
|
||||||
|
to calc source. These changes should not effect Windoz
|
||||||
|
free system such as GNU/Linux, Solaris, POSIX-like, etc ...
|
||||||
|
|
||||||
|
|
||||||
The following are the changes from calc version 2.11.4t1 to date:
|
The following are the changes from calc version 2.11.4t1 to date:
|
||||||
|
|
||||||
Added missing test8600.cal test file.
|
Added missing test8600.cal test file.
|
||||||
@@ -5,6 +23,28 @@ The following are the changes from calc version 2.11.4t1 to date:
|
|||||||
Fixes cscript files to deal with the -S flag being replaced by
|
Fixes cscript files to deal with the -S flag being replaced by
|
||||||
-f and possibly other flags.
|
-f and possibly other flags.
|
||||||
|
|
||||||
|
Added regression tests for builtin functions bernoulli, catalan,
|
||||||
|
euler, freeeuler, and sleep. Added non-base 10 regression tests
|
||||||
|
for digit, digits and places.
|
||||||
|
|
||||||
|
The bernoulli.cal script now just calls the bernoulli() builtin
|
||||||
|
function. It remains for backward compatibility.
|
||||||
|
|
||||||
|
The Makefile now builds have_fpos_pos.h to determine if the
|
||||||
|
a non-scalar FILEPOS has a __pos stucture element. If it does,
|
||||||
|
the FILEPOS_BITS is taken to be the size of just the __pos element.
|
||||||
|
|
||||||
|
Misc fixes related to non-scalar (e.g., structure) FILEPOS. Fixed
|
||||||
|
a compile problems where non-scalar FILEPOS were incorrectly assigned.
|
||||||
|
|
||||||
|
Fixed make depend rule.
|
||||||
|
|
||||||
|
Return an error on malloc / realloc failures for bernoulli and
|
||||||
|
euler functions.
|
||||||
|
|
||||||
|
Added MAKEFILE_REV make variable to help determine Makefile version.
|
||||||
|
Fixed the way the env rule reports Makefile values.
|
||||||
|
|
||||||
|
|
||||||
The following are the changes from calc version 2.11.3t0 to 2.11.4:
|
The following are the changes from calc version 2.11.3t0 to 2.11.4:
|
||||||
|
|
||||||
@@ -5019,8 +5059,8 @@ Following is a list of visible changes to calc from version 1.24.7 to 1.26.1:
|
|||||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||||
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||||
##
|
##
|
||||||
## @(#) $Revision: 29.14 $
|
## @(#) $Revision: 29.20 $
|
||||||
## @(#) $Id: CHANGES,v 29.14 2000/12/15 14:58:20 chongo Exp $
|
## @(#) $Id: CHANGES,v 29.20 2001/02/25 22:07:36 chongo Exp $
|
||||||
## @(#) $Source: /usr/local/src/cmd/calc/RCS/CHANGES,v $
|
## @(#) $Source: /usr/local/src/cmd/calc/RCS/CHANGES,v $
|
||||||
##
|
##
|
||||||
## Under source code control: 1993/06/02 18:12:57
|
## Under source code control: 1993/06/02 18:12:57
|
||||||
|
25
COPYING
25
COPYING
@@ -12,8 +12,8 @@ This file is Copyrighted
|
|||||||
Everyone is permitted to copy and distribute verbatim copies
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
of this license document, but changing it is not allowed.
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
# @(#) $Revision: 29.3 $
|
# @(#) $Revision: 29.5 $
|
||||||
# @(#) $Id: COPYING,v 29.3 2000/12/14 09:18:06 chongo Exp $
|
# @(#) $Id: COPYING,v 29.5 2000/12/18 10:22:55 chongo Exp $
|
||||||
# @(#) $Source: /usr/local/src/cmd/calc/RCS/COPYING,v $
|
# @(#) $Source: /usr/local/src/cmd/calc/RCS/COPYING,v $
|
||||||
|
|
||||||
=-=
|
=-=
|
||||||
@@ -140,7 +140,7 @@ Calc copyrights and exception files
|
|||||||
-----------------------------------
|
-----------------------------------
|
||||||
|
|
||||||
With the exception of the files listed below, Calc is covered under
|
With the exception of the files listed below, Calc is covered under
|
||||||
the following Copyrights:
|
the following GNU Lesser General Public License Copyrights:
|
||||||
|
|
||||||
Copyright (C) year David I. Bell
|
Copyright (C) year David I. Bell
|
||||||
Copyright (C) year David I. Bell and Landon Curt Noll
|
Copyright (C) year David I. Bell and Landon Curt Noll
|
||||||
@@ -150,12 +150,11 @@ Calc copyrights and exception files
|
|||||||
Copyright (C) year Ernest Bowen and Landon Curt Noll
|
Copyright (C) year Ernest Bowen and Landon Curt Noll
|
||||||
Copyright (C) year Ernest Bowen
|
Copyright (C) year Ernest Bowen
|
||||||
|
|
||||||
A few files are not covered under the GNU Lesser General Public
|
These files are not covered under one of the Copyrights listed above:
|
||||||
License. The source files not covered are:
|
|
||||||
|
|
||||||
shs1.c shs1.h shs.c shs.h
|
shs1.c shs1.h shs.c shs.h
|
||||||
md5.c md5.h lib/qtime.cal COPYING
|
md5.c md5.h COPYING COPYING-LGPL
|
||||||
COPYING-LGPL
|
cal/qtime.cal
|
||||||
|
|
||||||
The file COPYING-LGPL, which contains a copy of the version 2.1
|
The file COPYING-LGPL, which contains a copy of the version 2.1
|
||||||
GNU Lesser General Public License, is itself Copyrighted by the
|
GNU Lesser General Public License, is itself Copyrighted by the
|
||||||
@@ -168,10 +167,12 @@ Calc copyrights and exception files
|
|||||||
verbatim copies of this file but you may not modify this file.
|
verbatim copies of this file but you may not modify this file.
|
||||||
|
|
||||||
Some of these exception files are in the public domain. Other
|
Some of these exception files are in the public domain. Other
|
||||||
exception files have non-LGPL Copyrights. In all cases one may
|
exception files have non-LGPL Copyrights. Other files are under a
|
||||||
use and distribute these exception files freely. And because one
|
LGPL Copyright but have different authors.
|
||||||
may freely distribute the LGPL covered files, the entire calc
|
|
||||||
source may be freely used and distributed.
|
In all cases one may use and distribute these exception files freely.
|
||||||
|
And because one may freely distribute the LGPL covered files, the
|
||||||
|
entire calc source may be freely used and distributed.
|
||||||
|
|
||||||
=-=
|
=-=
|
||||||
|
|
||||||
|
312
Makefile
312
Makefile
@@ -20,8 +20,8 @@
|
|||||||
# received a copy with calc; if not, write to Free Software Foundation, Inc.
|
# received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||||
# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#
|
#
|
||||||
# @(#) $Revision: 29.9 $
|
MAKEFILE_REV= $$Revision: 29.14 $$
|
||||||
# @(#) $Id: Makefile.ship,v 29.9 2000/06/07 15:50:19 chongo Exp $
|
# @(#) $Id: Makefile.ship,v 29.14 2001/02/25 22:07:36 chongo Exp $
|
||||||
# @(#) $Source: /usr/local/src/cmd/calc/RCS/Makefile.ship,v $
|
# @(#) $Source: /usr/local/src/cmd/calc/RCS/Makefile.ship,v $
|
||||||
#
|
#
|
||||||
# Under source code control: 1990/02/15 01:48:41
|
# Under source code control: 1990/02/15 01:48:41
|
||||||
@@ -42,7 +42,7 @@
|
|||||||
#
|
#
|
||||||
# value meaning
|
# value meaning
|
||||||
# -------- -------
|
# -------- -------
|
||||||
# (nothing) let the makefile guess at what you need
|
# (nothing) let the Makefile guess at what you need
|
||||||
# -DUSE_TERMIOS use struct termios from <termios.h>
|
# -DUSE_TERMIOS use struct termios from <termios.h>
|
||||||
# -DUSE_TERMIO use struct termios from <termio.h>
|
# -DUSE_TERMIO use struct termios from <termio.h>
|
||||||
# -DUSE_SGTTY use struct sgttyb from <sys/ioctl.h>
|
# -DUSE_SGTTY use struct sgttyb from <sys/ioctl.h>
|
||||||
@@ -63,7 +63,7 @@ TERMCONTROL=
|
|||||||
# If you do not have vsprintf(), then calc will try sprintf() and hope
|
# If you do not have vsprintf(), then calc will try sprintf() and hope
|
||||||
# for the best.
|
# for the best.
|
||||||
#
|
#
|
||||||
# If HAVE_VSPRINTF is empty, this makefile will run the have_stdvs.c and/or
|
# If HAVE_VSPRINTF is empty, this Makefile will run the have_stdvs.c and/or
|
||||||
# have_varvs.c program to determine if vsprintf() is supported. If
|
# have_varvs.c program to determine if vsprintf() is supported. If
|
||||||
# HAVE_VSPRINTF is set to -DDONT_HAVE_VSPRINTF then calc will hope that
|
# HAVE_VSPRINTF is set to -DDONT_HAVE_VSPRINTF then calc will hope that
|
||||||
# sprintf() will work.
|
# sprintf() will work.
|
||||||
@@ -78,7 +78,7 @@ HAVE_VSPRINTF=
|
|||||||
# Big Endian: Amdahl, 68k, Pyramid, Mips, Sparc, ...
|
# Big Endian: Amdahl, 68k, Pyramid, Mips, Sparc, ...
|
||||||
# Little Endian: Vax, 32k, Spim (Dec Mips), i386, i486, ...
|
# Little Endian: Vax, 32k, Spim (Dec Mips), i386, i486, ...
|
||||||
#
|
#
|
||||||
# If in doubt, leave BYTE_ORDER empty. This makefile will attempt to
|
# If in doubt, leave BYTE_ORDER empty. This Makefile will attempt to
|
||||||
# use BYTE_ORDER in <machine/endian.h> or it will attempt to run
|
# use BYTE_ORDER in <machine/endian.h> or it will attempt to run
|
||||||
# the endian program. If you get syntax errors when you compile,
|
# the endian program. If you get syntax errors when you compile,
|
||||||
# try forcing the value to be BIG_ENDIAN and run the calc regression
|
# try forcing the value to be BIG_ENDIAN and run the calc regression
|
||||||
@@ -92,7 +92,7 @@ BYTE_ORDER=
|
|||||||
|
|
||||||
# Determine the number of bits in a long
|
# Determine the number of bits in a long
|
||||||
#
|
#
|
||||||
# If in doubt, leave LONG_BITS empty. This makefile will run
|
# If in doubt, leave LONG_BITS empty. This Makefile will run
|
||||||
# the longbits program to determine the length.
|
# the longbits program to determine the length.
|
||||||
#
|
#
|
||||||
# In order to avoid make brain damage in some systems, we avoid placing
|
# In order to avoid make brain damage in some systems, we avoid placing
|
||||||
@@ -125,7 +125,7 @@ LONGLONG_BITS=
|
|||||||
# Determine if we have the ANSI C fgetpos and fsetpos alternate interface
|
# Determine if we have the ANSI C fgetpos and fsetpos alternate interface
|
||||||
# to the ftell() and fseek() (with whence set to SEEK_SET) functions.
|
# to the ftell() and fseek() (with whence set to SEEK_SET) functions.
|
||||||
#
|
#
|
||||||
# If HAVE_FPOS is empty, this makefile will run the have_fpos program
|
# If HAVE_FPOS is empty, this Makefile will run the have_fpos program
|
||||||
# to determine if there is are fgetpos and fsetpos functions. If HAVE_FPOS
|
# to determine if there is are fgetpos and fsetpos functions. If HAVE_FPOS
|
||||||
# is set to -DHAVE_NO_FPOS, then calc will use ftell() and fseek().
|
# is set to -DHAVE_NO_FPOS, then calc will use ftell() and fseek().
|
||||||
#
|
#
|
||||||
@@ -134,11 +134,22 @@ LONGLONG_BITS=
|
|||||||
HAVE_FPOS=
|
HAVE_FPOS=
|
||||||
#HAVE_FPOS= -DHAVE_NO_FPOS
|
#HAVE_FPOS= -DHAVE_NO_FPOS
|
||||||
|
|
||||||
|
# Determine if we have an __pos element of a file position (fpos_t) structure.
|
||||||
|
#
|
||||||
|
# If HAVE_FPOS_POS is empty, this Makefile will run the have_fpos_pos program
|
||||||
|
# to determine if fpos_t has a __pos structure element. If HAVE_FPOS_POS
|
||||||
|
# is set to -DHAVE_NO_FPOS_POS, then calc assume there is no __pos element.
|
||||||
|
#
|
||||||
|
# If in doubt, leave HAVE_FPOS_POS empty and this Makefile will figure it out.
|
||||||
|
#
|
||||||
|
HAVE_FPOS_POS=
|
||||||
|
#HAVE_FPOS= -DHAVE_NO_FPOS_POS
|
||||||
|
|
||||||
# Determine if we have an off_t which one can perform arithmetic operations,
|
# Determine if we have an off_t which one can perform arithmetic operations,
|
||||||
# assignments and comparisons. On some systems off_t is some sort of union
|
# assignments and comparisons. On some systems off_t is some sort of union
|
||||||
# or struct.
|
# or struct.
|
||||||
#
|
#
|
||||||
# If HAVE_OFFSCL is empty, this makefile will run the have_offscl program
|
# If HAVE_OFFSCL is empty, this Makefile will run the have_offscl program
|
||||||
# to determine if off_t is a scalar. If HAVE_OFFSCL is set to the value
|
# to determine if off_t is a scalar. If HAVE_OFFSCL is set to the value
|
||||||
# -DOFF_T_NON_SCALAR when calc will assume that off_t some sort of
|
# -DOFF_T_NON_SCALAR when calc will assume that off_t some sort of
|
||||||
# union or struct which.
|
# union or struct which.
|
||||||
@@ -153,7 +164,7 @@ HAVE_OFFSCL=
|
|||||||
# or struct. Some systems do not have an fpos_t and long is as a file
|
# or struct. Some systems do not have an fpos_t and long is as a file
|
||||||
# offset instead.
|
# offset instead.
|
||||||
#
|
#
|
||||||
# If HAVE_POSSCL is empty, this makefile will run the have_offscl program
|
# If HAVE_POSSCL is empty, this Makefile will run the have_offscl program
|
||||||
# to determine if off_t is a scalar, or if there is no off_t and long
|
# to determine if off_t is a scalar, or if there is no off_t and long
|
||||||
# (a scalar) should be used instead. If HAVE_POSSCL is set to the value
|
# (a scalar) should be used instead. If HAVE_POSSCL is set to the value
|
||||||
# -DFILEPOS_NON_SCALAR when calc will assume that fpos_t exists and is
|
# -DFILEPOS_NON_SCALAR when calc will assume that fpos_t exists and is
|
||||||
@@ -166,7 +177,7 @@ HAVE_POSSCL=
|
|||||||
|
|
||||||
# Determine if we have ANSI C const.
|
# Determine if we have ANSI C const.
|
||||||
#
|
#
|
||||||
# If HAVE_CONST is empty, this makefile will run the have_const program
|
# If HAVE_CONST is empty, this Makefile will run the have_const program
|
||||||
# to determine if const is supported. If HAVE_CONST is set to -DHAVE_NO_CONST,
|
# to determine if const is supported. If HAVE_CONST is set to -DHAVE_NO_CONST,
|
||||||
# then calc will not use const.
|
# then calc will not use const.
|
||||||
#
|
#
|
||||||
@@ -177,7 +188,7 @@ HAVE_CONST=
|
|||||||
|
|
||||||
# Determine if we have uid_t
|
# Determine if we have uid_t
|
||||||
#
|
#
|
||||||
# If HAVE_UID_T is empty, this makefile will run the have_uid_t program
|
# If HAVE_UID_T is empty, this Makefile will run the have_uid_t program
|
||||||
# to determine if const is supported. If HAVE_UID_T is set to -DHAVE_NO_UID_T,
|
# to determine if const is supported. If HAVE_UID_T is set to -DHAVE_NO_UID_T,
|
||||||
# then calc will treat uid_t as an unsigned short. This only matters if
|
# then calc will treat uid_t as an unsigned short. This only matters if
|
||||||
# $HOME is not set and calc must look up the home directory in /etc/passwd.
|
# $HOME is not set and calc must look up the home directory in /etc/passwd.
|
||||||
@@ -189,7 +200,7 @@ HAVE_UID_T=
|
|||||||
|
|
||||||
# Determine if we have memcpy(), memset() and strchr()
|
# Determine if we have memcpy(), memset() and strchr()
|
||||||
#
|
#
|
||||||
# If HAVE_NEWSTR is empty, this makefile will run the have_newstr program
|
# If HAVE_NEWSTR is empty, this Makefile will run the have_newstr program
|
||||||
# to determine if memcpy(), memset() and strchr() are supported. If
|
# to determine if memcpy(), memset() and strchr() are supported. If
|
||||||
# HAVE_NEWSTR is set to -DHAVE_NO_NEWSTR, then calc will use bcopy() instead
|
# HAVE_NEWSTR is set to -DHAVE_NO_NEWSTR, then calc will use bcopy() instead
|
||||||
# of memcpy(), use bfill() instead of memset(), and use index() instead of
|
# of memcpy(), use bfill() instead of memset(), and use index() instead of
|
||||||
@@ -202,7 +213,7 @@ HAVE_NEWSTR=
|
|||||||
|
|
||||||
# Determine if we have memmove()
|
# Determine if we have memmove()
|
||||||
#
|
#
|
||||||
# If HAVE_MEMMOVE is empty, this makefile will run the have_memmv program
|
# If HAVE_MEMMOVE is empty, this Makefile will run the have_memmv program
|
||||||
# to determine if memmove() is supported. If HAVE_MEMMOVE is set to
|
# to determine if memmove() is supported. If HAVE_MEMMOVE is set to
|
||||||
# -DHAVE_NO_MEMMOVE, then calc will use internal functions to simulate
|
# -DHAVE_NO_MEMMOVE, then calc will use internal functions to simulate
|
||||||
# the memory move function that does correct overlapping memory modes.
|
# the memory move function that does correct overlapping memory modes.
|
||||||
@@ -214,7 +225,7 @@ HAVE_MEMMOVE=
|
|||||||
|
|
||||||
# Determine if we have ustat()
|
# Determine if we have ustat()
|
||||||
#
|
#
|
||||||
# If HAVE_USTAT is empty, this makefile will run the have_memmv program
|
# If HAVE_USTAT is empty, this Makefile will run the have_memmv program
|
||||||
# to determine if ustat() is supported. If HAVE_USTAT is set to
|
# to determine if ustat() is supported. If HAVE_USTAT is set to
|
||||||
# -DHAVE_NO_USTAT, then calc will use internal functions to simulate
|
# -DHAVE_NO_USTAT, then calc will use internal functions to simulate
|
||||||
# the memory move function that does correct overlapping memory modes.
|
# the memory move function that does correct overlapping memory modes.
|
||||||
@@ -226,7 +237,7 @@ HAVE_USTAT=
|
|||||||
|
|
||||||
# Determine if we have getsid()
|
# Determine if we have getsid()
|
||||||
#
|
#
|
||||||
# If HAVE_GETSID is empty, this makefile will run the have_memmv program
|
# If HAVE_GETSID is empty, this Makefile will run the have_memmv program
|
||||||
# to determine if getsid() is supported. If HAVE_GETSID is set to
|
# to determine if getsid() is supported. If HAVE_GETSID is set to
|
||||||
# -DHAVE_NO_GETSID, then calc will use internal functions to simulate
|
# -DHAVE_NO_GETSID, then calc will use internal functions to simulate
|
||||||
# the memory move function that does correct overlapping memory modes.
|
# the memory move function that does correct overlapping memory modes.
|
||||||
@@ -238,7 +249,7 @@ HAVE_GETSID=
|
|||||||
|
|
||||||
# Determine if we have getpgid()
|
# Determine if we have getpgid()
|
||||||
#
|
#
|
||||||
# If HAVE_GETPGID is empty, this makefile will run the have_memmv program
|
# If HAVE_GETPGID is empty, this Makefile will run the have_memmv program
|
||||||
# to determine if getpgid() is supported. If HAVE_GETPGID is set to
|
# to determine if getpgid() is supported. If HAVE_GETPGID is set to
|
||||||
# -DHAVE_NO_GETPGID, then calc will use internal functions to simulate
|
# -DHAVE_NO_GETPGID, then calc will use internal functions to simulate
|
||||||
# the memory move function that does correct overlapping memory modes.
|
# the memory move function that does correct overlapping memory modes.
|
||||||
@@ -250,7 +261,7 @@ HAVE_GETPGID=
|
|||||||
|
|
||||||
# Determine if we have clock_gettime()
|
# Determine if we have clock_gettime()
|
||||||
#
|
#
|
||||||
# If HAVE_GETTIME is empty, this makefile will run the have_memmv program
|
# If HAVE_GETTIME is empty, this Makefile will run the have_memmv program
|
||||||
# to determine if clock_gettime() is supported. If HAVE_GETTIME is set to
|
# to determine if clock_gettime() is supported. If HAVE_GETTIME is set to
|
||||||
# -DHAVE_NO_GETTIME, then calc will use internal functions to simulate
|
# -DHAVE_NO_GETTIME, then calc will use internal functions to simulate
|
||||||
# the memory move function that does correct overlapping memory modes.
|
# the memory move function that does correct overlapping memory modes.
|
||||||
@@ -262,7 +273,7 @@ HAVE_GETTIME=
|
|||||||
|
|
||||||
# Determine if we have getprid()
|
# Determine if we have getprid()
|
||||||
#
|
#
|
||||||
# If HAVE_GETPRID is empty, this makefile will run the have_memmv program
|
# If HAVE_GETPRID is empty, this Makefile will run the have_memmv program
|
||||||
# to determine if getprid() is supported. If HAVE_GETPRID is set to
|
# to determine if getprid() is supported. If HAVE_GETPRID is set to
|
||||||
# -DHAVE_NO_GETPRID, then calc will use internal functions to simulate
|
# -DHAVE_NO_GETPRID, then calc will use internal functions to simulate
|
||||||
# the memory move function that does correct overlapping memory modes.
|
# the memory move function that does correct overlapping memory modes.
|
||||||
@@ -274,7 +285,7 @@ HAVE_GETPRID=
|
|||||||
|
|
||||||
# Determine if we have /dev/urandom
|
# Determine if we have /dev/urandom
|
||||||
#
|
#
|
||||||
# If HAVE_URANDOM is empty, this makefile will run the have_memmv program
|
# If HAVE_URANDOM is empty, this Makefile will run the have_memmv program
|
||||||
# to determine if /dev/urandom is supported. If HAVE_URANDOM is set to
|
# to determine if /dev/urandom is supported. If HAVE_URANDOM is set to
|
||||||
# -DHAVE_NO_URANDOM, then calc will use internal functions to simulate
|
# -DHAVE_NO_URANDOM, then calc will use internal functions to simulate
|
||||||
# the memory move function that does correct overlapping memory modes.
|
# the memory move function that does correct overlapping memory modes.
|
||||||
@@ -286,7 +297,7 @@ HAVE_URANDOM=
|
|||||||
|
|
||||||
# Determine if we have getrusage()
|
# Determine if we have getrusage()
|
||||||
#
|
#
|
||||||
# If HAVE_GETRUSAGE is empty, this makefile will run the have_memmv program
|
# If HAVE_GETRUSAGE is empty, this Makefile will run the have_memmv program
|
||||||
# to determine if getrusage() is supported. If HAVE_GETRUSAGE is set to
|
# to determine if getrusage() is supported. If HAVE_GETRUSAGE is set to
|
||||||
# -DHAVE_NO_GETRUSAGE, then calc will use internal functions to simulate
|
# -DHAVE_NO_GETRUSAGE, then calc will use internal functions to simulate
|
||||||
# the memory move function that does correct overlapping memory modes.
|
# the memory move function that does correct overlapping memory modes.
|
||||||
@@ -298,7 +309,7 @@ HAVE_GETRUSAGE=
|
|||||||
|
|
||||||
# Determine if we have strdup()
|
# Determine if we have strdup()
|
||||||
#
|
#
|
||||||
# If HAVE_STRDUP is empty, this makefile will run the have_memmv program
|
# If HAVE_STRDUP is empty, this Makefile will run the have_memmv program
|
||||||
# to determine if strdup() is supported. If HAVE_STRDUP is set to
|
# to determine if strdup() is supported. If HAVE_STRDUP is set to
|
||||||
# -DHAVE_NO_STRDUP, then calc will use internal functions to simulate
|
# -DHAVE_NO_STRDUP, then calc will use internal functions to simulate
|
||||||
# the memory move function that does correct overlapping memory modes.
|
# the memory move function that does correct overlapping memory modes.
|
||||||
@@ -824,8 +835,8 @@ ECHO= /bin/echo
|
|||||||
|
|
||||||
# Makefile debug
|
# Makefile debug
|
||||||
#
|
#
|
||||||
# Q=@ do not echo internal makefile actions (quiet mode)
|
# Q=@ do not echo internal Makefile actions (quiet mode)
|
||||||
# Q= echo internal makefile actions (debug / verbose mode)
|
# Q= echo internal Makefile actions (debug / verbose mode)
|
||||||
#
|
#
|
||||||
# V=@: do not echo debug statements (quiet mode)
|
# V=@: do not echo debug statements (quiet mode)
|
||||||
# V=@ do echo debug statements (debug / verbose mode)
|
# V=@ do echo debug statements (debug / verbose mode)
|
||||||
@@ -885,7 +896,7 @@ LIB_H_SRC= alloc.h blkcpy.h block.h byteswap.h calc.h cmath.h \
|
|||||||
# we build these .h files during the make
|
# we build these .h files during the make
|
||||||
#
|
#
|
||||||
BUILD_H_SRC= align32.h args.h calcerr.h conf.h endian_calc.h \
|
BUILD_H_SRC= align32.h args.h calcerr.h conf.h endian_calc.h \
|
||||||
fposval.h have_const.h have_fpos.h have_malloc.h \
|
fposval.h have_const.h have_fpos.h have_fpos_pos.h have_malloc.h \
|
||||||
have_memmv.h have_newstr.h have_offscl.h have_posscl.h \
|
have_memmv.h have_newstr.h have_offscl.h have_posscl.h \
|
||||||
have_stdlib.h have_string.h have_times.h have_uid_t.h \
|
have_stdlib.h have_string.h have_times.h have_uid_t.h \
|
||||||
have_unistd.h longbits.h longlong.h terminal.h \
|
have_unistd.h longbits.h longlong.h terminal.h \
|
||||||
@@ -903,7 +914,7 @@ BUILD_C_SRC= calcerr.c
|
|||||||
#
|
#
|
||||||
UTIL_C_SRC= align32.c endian.c longbits.c have_newstr.c have_uid_t.c \
|
UTIL_C_SRC= align32.c endian.c longbits.c have_newstr.c have_uid_t.c \
|
||||||
have_const.c have_stdvs.c have_varvs.c fposval.c have_fpos.c \
|
have_const.c have_stdvs.c have_varvs.c fposval.c have_fpos.c \
|
||||||
longlong.c have_offscl.c have_posscl.c have_memmv.c \
|
have_fpos_pos.c longlong.c have_offscl.c have_posscl.c have_memmv.c \
|
||||||
have_ustat.c have_getsid.c have_getpgid.c \
|
have_ustat.c have_getsid.c have_getpgid.c \
|
||||||
have_gettime.c have_getprid.c have_rusage.c have_strdup.c
|
have_gettime.c have_getprid.c have_rusage.c have_strdup.c
|
||||||
|
|
||||||
@@ -918,8 +929,8 @@ UTIL_MISC_SRC= calcerr_h.sed calcerr_h.awk calcerr_c.sed calcerr_c.awk \
|
|||||||
# There MUST be a .o for every .c in UTIL_C_SRC.
|
# There MUST be a .o for every .c in UTIL_C_SRC.
|
||||||
#
|
#
|
||||||
UTIL_OBJS= endian.o longbits.o have_newstr.o have_uid_t.o \
|
UTIL_OBJS= endian.o longbits.o have_newstr.o have_uid_t.o \
|
||||||
have_const.o fposval.o have_fpos.o longlong.o try_strarg.o \
|
have_const.o fposval.o have_fpos.o have_fpos_pos.o longlong.o \
|
||||||
have_stdvs.o have_varvs.o have_posscl.o have_memmv.o \
|
try_strarg.o have_stdvs.o have_varvs.o have_posscl.o have_memmv.o \
|
||||||
have_ustat.o have_getsid.o have_getpgid.o \
|
have_ustat.o have_getsid.o have_getpgid.o \
|
||||||
have_gettime.o have_getprid.o ver_calc.o have_rusage.o have_strdup.o
|
have_gettime.o have_getprid.o ver_calc.o have_rusage.o have_strdup.o
|
||||||
|
|
||||||
@@ -936,7 +947,7 @@ UTIL_PROGS= align32 fposval have_uid_t longlong have_const \
|
|||||||
have_ustat have_getsid have_getpgid \
|
have_ustat have_getsid have_getpgid \
|
||||||
have_gettime have_getprid ver_calc have_strdup
|
have_gettime have_getprid ver_calc have_strdup
|
||||||
|
|
||||||
# The complete list of makefile vars passed down to custom/Makefile.
|
# The complete list of Makefile vars passed down to custom/Makefile.
|
||||||
#
|
#
|
||||||
CUSTOM_PASSDOWN= Q="${Q}" \
|
CUSTOM_PASSDOWN= Q="${Q}" \
|
||||||
TOPDIR="${TOPDIR}" \
|
TOPDIR="${TOPDIR}" \
|
||||||
@@ -964,7 +975,7 @@ CUSTOM_PASSDOWN= Q="${Q}" \
|
|||||||
MAKEDEPEND=${MAKEDEPEND} \
|
MAKEDEPEND=${MAKEDEPEND} \
|
||||||
SORT=${SORT}
|
SORT=${SORT}
|
||||||
|
|
||||||
# The complete list of makefile vars passed down to sample/Makefile.
|
# The complete list of Makefile vars passed down to sample/Makefile.
|
||||||
#
|
#
|
||||||
SAMPLE_PASSDOWN= Q="${Q}" \
|
SAMPLE_PASSDOWN= Q="${Q}" \
|
||||||
TOPDIR="${TOPDIR}" \
|
TOPDIR="${TOPDIR}" \
|
||||||
@@ -991,7 +1002,7 @@ SAMPLE_PASSDOWN= Q="${Q}" \
|
|||||||
CHMOD=${CHMOD} \
|
CHMOD=${CHMOD} \
|
||||||
SORT=${SORT}
|
SORT=${SORT}
|
||||||
|
|
||||||
# The compelte list of makefile vars passed down to help/Makefile.
|
# The compelte list of Makefile vars passed down to help/Makefile.
|
||||||
#
|
#
|
||||||
HELP_PASSDOWN= Q="${Q}" \
|
HELP_PASSDOWN= Q="${Q}" \
|
||||||
TOPDIR="${TOPDIR}" \
|
TOPDIR="${TOPDIR}" \
|
||||||
@@ -1005,7 +1016,7 @@ HELP_PASSDOWN= Q="${Q}" \
|
|||||||
CHMOD=${CHMOD} \
|
CHMOD=${CHMOD} \
|
||||||
FMT=${FMT}
|
FMT=${FMT}
|
||||||
|
|
||||||
# The compelte list of makefile vars passed down to cal/Makefile.
|
# The compelte list of Makefile vars passed down to cal/Makefile.
|
||||||
#
|
#
|
||||||
CAL_PASSDOWN= Q="${Q}" \
|
CAL_PASSDOWN= Q="${Q}" \
|
||||||
TOPDIR="${TOPDIR}" \
|
TOPDIR="${TOPDIR}" \
|
||||||
@@ -1013,7 +1024,7 @@ CAL_PASSDOWN= Q="${Q}" \
|
|||||||
MAKE_FILE=${MAKE_FILE} \
|
MAKE_FILE=${MAKE_FILE} \
|
||||||
CHMOD=${CHMOD}
|
CHMOD=${CHMOD}
|
||||||
|
|
||||||
# The compelte list of makefile vars passed down to cscript/Makefile.
|
# The compelte list of Makefile vars passed down to cscript/Makefile.
|
||||||
#
|
#
|
||||||
CSCRIPT_PASSDOWN= Q="${Q}" \
|
CSCRIPT_PASSDOWN= Q="${Q}" \
|
||||||
BINDIR="${BINDIR}" \
|
BINDIR="${BINDIR}" \
|
||||||
@@ -1039,7 +1050,7 @@ LICENSE= COPYING COPYING-LGPL
|
|||||||
# These files are found (but not built) in the distribution
|
# These files are found (but not built) in the distribution
|
||||||
#
|
#
|
||||||
DISTLIST= ${C_SRC} ${H_SRC} ${MAKE_FILE} BUGS CHANGES LIBRARY README \
|
DISTLIST= ${C_SRC} ${H_SRC} ${MAKE_FILE} BUGS CHANGES LIBRARY README \
|
||||||
calc.man HOWTO.INSTALL ${UTIL_MISC_SRC} ${LICENSE}
|
README.WINDOWS calc.man HOWTO.INSTALL ${UTIL_MISC_SRC} ${LICENSE}
|
||||||
|
|
||||||
# These files are used to make (but not built) a calc .a link library
|
# These files are used to make (but not built) a calc .a link library
|
||||||
#
|
#
|
||||||
@@ -1559,7 +1570,51 @@ have_fpos.h: have_fpos.c ${MAKE_FILE}
|
|||||||
true; \
|
true; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
fposval.h: fposval.c have_fpos.h have_offscl.h have_posscl.h \
|
have_fpos_pos.h: have_fpos_pos.c have_fpos.h have_posscl.h ${MAKE_FILE}
|
||||||
|
-${Q}rm -f have_fpos_pos have_fpos_pos.o fpos_tmp have_fpos_pos.h
|
||||||
|
${Q}echo 'forming have_fpos_pos.h'
|
||||||
|
${Q}echo '/*' > have_fpos_pos.h
|
||||||
|
${Q}echo ' * DO NOT EDIT -- generated by the Makefile' \
|
||||||
|
>> have_fpos_pos.h
|
||||||
|
${Q}echo ' */' >> have_fpos_pos.h
|
||||||
|
${Q}echo '' >> have_fpos_pos.h
|
||||||
|
${Q}echo '' >> have_fpos_pos.h
|
||||||
|
${Q}echo '#if !defined(__HAVE_FPOS_POS_H__)' >> have_fpos_pos.h
|
||||||
|
${Q}echo '#define __HAVE_FPOS_POS_H__' >> have_fpos_pos.h
|
||||||
|
${Q}echo '' >> have_fpos_pos.h
|
||||||
|
${Q}echo '' >> have_fpos_pos.h
|
||||||
|
${Q}echo '/* do we have fgetpos & fsetpos functions? */' \
|
||||||
|
>> have_fpos_pos.h
|
||||||
|
-${Q}rm -f have_fpos_pos.o have_fpos_pos
|
||||||
|
-${Q}${LCC} ${HAVE_FPOS_POS} ${ICFLAGS} have_fpos_pos.c -c \
|
||||||
|
2>/dev/null; true
|
||||||
|
-${Q}${LCC} ${ILDFLAGS} have_fpos_pos.o -o have_fpos_pos \
|
||||||
|
2>/dev/null; true
|
||||||
|
-${Q}${SHELL} -c "./have_fpos_pos > fpos_tmp 2>/dev/null" \
|
||||||
|
>/dev/null 2>&1; true
|
||||||
|
-${Q}if [ -s fpos_tmp ]; then \
|
||||||
|
cat fpos_tmp >> have_fpos_pos.h; \
|
||||||
|
else \
|
||||||
|
echo '#undef HAVE_FPOS_POS /* no */' >> have_fpos_pos.h; \
|
||||||
|
echo '' >> have_fpos_pos.h; \
|
||||||
|
echo '#undef FPOS_POS_BITS' >> have_fpos_pos.h; \
|
||||||
|
fi
|
||||||
|
${Q}echo '' >> have_fpos_pos.h
|
||||||
|
${Q}echo '' >> have_fpos_pos.h
|
||||||
|
${Q}echo '#endif /* !__HAVE_FPOS_POS_H__ */' >> have_fpos_pos.h
|
||||||
|
-${Q}rm -f have_fpos_pos have_fpos_pos.o fpos_tmp
|
||||||
|
${Q}echo 'have_fpos_pos.h formed'
|
||||||
|
-@if [ -z "${Q}" ]; then \
|
||||||
|
echo ''; \
|
||||||
|
echo '=-=-= start of $@ =-=-='; \
|
||||||
|
cat $@; \
|
||||||
|
echo '=-=-= end of $@ =-=-='; \
|
||||||
|
echo ''; \
|
||||||
|
else \
|
||||||
|
true; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
fposval.h: fposval.c have_fpos.h have_fpos_pos.h have_offscl.h have_posscl.h \
|
||||||
endian_calc.h ${MAKE_FILE}
|
endian_calc.h ${MAKE_FILE}
|
||||||
-${Q}rm -f fposv_tmp fposval fposval.o fposval.h
|
-${Q}rm -f fposv_tmp fposval fposval.o fposval.h
|
||||||
${Q}echo 'forming fposval.h'
|
${Q}echo 'forming fposval.h'
|
||||||
@@ -2423,7 +2478,7 @@ sample/all:
|
|||||||
|
|
||||||
##
|
##
|
||||||
#
|
#
|
||||||
# The BSDI cdrom makefile expects certain files to be pre-built in a sub-dir
|
# The BSDI cdrom Makefile expects certain files to be pre-built in a sub-dir
|
||||||
# called gen_h. This rule creats this sub-directory so that the release can
|
# called gen_h. This rule creats this sub-directory so that the release can
|
||||||
# be shipped off to BSDI. You can ignore this rule.
|
# be shipped off to BSDI. You can ignore this rule.
|
||||||
#
|
#
|
||||||
@@ -2591,108 +2646,110 @@ chk: ./cal/regress.cal
|
|||||||
# debug
|
# debug
|
||||||
#
|
#
|
||||||
# make env:
|
# make env:
|
||||||
# * print major makefile variables
|
# * print major Makefile variables
|
||||||
#
|
#
|
||||||
# make mkdebug:
|
# make mkdebug:
|
||||||
# * print major makefile variables
|
# * print major Makefile variables
|
||||||
# * build anything not yet built
|
# * build anything not yet built
|
||||||
#
|
#
|
||||||
# make debug:
|
# make debug:
|
||||||
# * remove everything that was previously built
|
# * remove everything that was previously built
|
||||||
# * print major makefile variables
|
# * print major Makefile variables
|
||||||
# * make everything
|
# * make everything
|
||||||
# * run the regression tests
|
# * run the regression tests
|
||||||
##
|
##
|
||||||
|
|
||||||
env:
|
env:
|
||||||
@echo '=-=-=-=-= dumping major make variables =-=-=-=-='
|
@echo '=-=-=-=-= dumping major make variables =-=-=-=-='
|
||||||
@echo "TERMCONTROL=${TERMCONTROL}"; echo ""
|
@echo 'MAKEFILE_REV=${MAKEFILE_REV}'; echo ''
|
||||||
@echo "HAVE_VSPRINTF=${HAVE_VSPRINTF}"; echo ""
|
@echo 'TERMCONTROL=${TERMCONTROL}'; echo ''
|
||||||
@echo "BYTE_ORDER=${BYTE_ORDER}"; echo ""
|
@echo 'HAVE_VSPRINTF=${HAVE_VSPRINTF}'; echo ''
|
||||||
@echo "LONG_BITS=${LONG_BITS}"; echo ""
|
@echo 'BYTE_ORDER=${BYTE_ORDER}'; echo ''
|
||||||
@echo "LONGLONG_BITS=${LONGLONG_BITS}"; echo ""
|
@echo 'LONG_BITS=${LONG_BITS}'; echo ''
|
||||||
@echo "HAVE_FPOS=${HAVE_FPOS}"; echo ""
|
@echo 'LONGLONG_BITS=${LONGLONG_BITS}'; echo ''
|
||||||
@echo "HAVE_OFFSCL=${HAVE_OFFSCL}"; echo ""
|
@echo 'HAVE_FPOS=${HAVE_FPOS}'; echo ''
|
||||||
@echo "HAVE_POSSCL=${HAVE_POSSCL}"; echo ""
|
@echo 'HAVE_FPOS_POS=${HAVE_FPOS_POS}'; echo ''
|
||||||
@echo "HAVE_CONST=${HAVE_CONST}"; echo ""
|
@echo 'HAVE_OFFSCL=${HAVE_OFFSCL}'; echo ''
|
||||||
@echo "HAVE_UID_T=${HAVE_UID_T}"; echo ""
|
@echo 'HAVE_POSSCL=${HAVE_POSSCL}'; echo ''
|
||||||
@echo "HAVE_NEWSTR=${HAVE_NEWSTR}"; echo ""
|
@echo 'HAVE_CONST=${HAVE_CONST}'; echo ''
|
||||||
@echo "HAVE_USTAT=${HAVE_USTAT}"; echo ""
|
@echo 'HAVE_UID_T=${HAVE_UID_T}'; echo ''
|
||||||
@echo "HAVE_GETSID=${HAVE_GETSID}"; echo ""
|
@echo 'HAVE_NEWSTR=${HAVE_NEWSTR}'; echo ''
|
||||||
@echo "HAVE_GETPGID=${HAVE_GETPGID}"; echo ""
|
@echo 'HAVE_USTAT=${HAVE_USTAT}'; echo ''
|
||||||
@echo "HAVE_GETTIME=${HAVE_GETTIME}"; echo ""
|
@echo 'HAVE_GETSID=${HAVE_GETSID}'; echo ''
|
||||||
@echo "HAVE_GETPRID=${HAVE_GETPRID}"; echo ""
|
@echo 'HAVE_GETPGID=${HAVE_GETPGID}'; echo ''
|
||||||
@echo "HAVE_URANDOM=${HAVE_URANDOM}"; echo ""
|
@echo 'HAVE_GETTIME=${HAVE_GETTIME}'; echo ''
|
||||||
@echo "ALIGN32=${ALIGN32}"; echo ""
|
@echo 'HAVE_GETPRID=${HAVE_GETPRID}'; echo ''
|
||||||
@echo "BINDIR=${BINDIR}"; echo ""
|
@echo 'HAVE_URANDOM=${HAVE_URANDOM}'; echo ''
|
||||||
@echo "TOPDIR=${TOPDIR}"; echo ""
|
@echo 'ALIGN32=${ALIGN32}'; echo ''
|
||||||
@echo "LIBDIR=${LIBDIR}"; echo ""
|
@echo 'BINDIR=${BINDIR}'; echo ''
|
||||||
@echo "HELPDIR=${HELPDIR}"; echo ""
|
@echo 'TOPDIR=${TOPDIR}'; echo ''
|
||||||
@echo "CUSTOMLIBDIR=${CUSTOMLIBDIR}"; echo ""
|
@echo 'LIBDIR=${LIBDIR}'; echo ''
|
||||||
@echo "CUSTOMHELPDIR=${CUSTOMHELPDIR}"; echo ""
|
@echo 'HELPDIR=${HELPDIR}'; echo ''
|
||||||
@echo "SCRIPTDIR=${SCRIPTDIR}"; echo ""
|
@echo 'CUSTOMLIBDIR=${CUSTOMLIBDIR}'; echo ''
|
||||||
@echo "MANDIR=${MANDIR}"; echo ""
|
@echo 'CUSTOMHELPDIR=${CUSTOMHELPDIR}'; echo ''
|
||||||
@echo "CATDIR=${CATDIR}"; echo ""
|
@echo 'SCRIPTDIR=${SCRIPTDIR}'; echo ''
|
||||||
@echo "MANEXT=${MANEXT}"; echo ""
|
@echo 'MANDIR=${MANDIR}'; echo ''
|
||||||
@echo "CATEXT=${CATEXT}"; echo ""
|
@echo 'CATDIR=${CATDIR}'; echo ''
|
||||||
@echo "NROFF=${NROFF}"; echo ""
|
@echo 'MANEXT=${MANEXT}'; echo ''
|
||||||
@echo "NROFF_ARG=${NROFF_ARG}"; echo ""
|
@echo 'CATEXT=${CATEXT}'; echo ''
|
||||||
@echo "MANMAKE=${MANMAKE}"; echo ""
|
@echo 'NROFF=${NROFF}'; echo ''
|
||||||
@echo "CALCPATH=${CALCPATH}"; echo ""
|
@echo 'NROFF_ARG=${NROFF_ARG}'; echo ''
|
||||||
@echo "CALCRC=${CALCRC}"; echo ""
|
@echo 'MANMAKE=${MANMAKE}'; echo ''
|
||||||
@echo "CALCPAGER=${CALCPAGER}"; echo ""
|
@echo 'CALCPATH=${CALCPATH}'; echo ''
|
||||||
@echo "DEBUG=${DEBUG}"; echo ""
|
@echo 'CALCRC=${CALCRC}'; echo ''
|
||||||
@echo "NO_SHARED=${NO_SHARED}"; echo ""
|
@echo 'CALCPAGER=${CALCPAGER}'; echo ''
|
||||||
@echo "LD_NO_SHARED=${LD_NO_SHARED}"; echo ""
|
@echo 'DEBUG=${DEBUG}'; echo ''
|
||||||
@echo "RANLIB=${RANLIB}"; echo ""
|
@echo 'NO_SHARED=${NO_SHARED}'; echo ''
|
||||||
@echo "MAKE_FILE=${MAKE_FILE}"; echo ""
|
@echo 'LD_NO_SHARED=${LD_NO_SHARED}'; echo ''
|
||||||
@echo "PURIFY=${PURIFY}"; echo ""
|
@echo 'RANLIB=${RANLIB}'; echo ''
|
||||||
@echo "LD_DEBUG=${LD_DEBUG}"; echo ""
|
@echo 'MAKE_FILE=${MAKE_FILE}'; echo ''
|
||||||
@echo "CALC_ENV=${CALC_ENV}"; echo ""
|
@echo 'PURIFY=${PURIFY}'; echo ''
|
||||||
@echo "ALLOW_CUSTOM=${ALLOW_CUSTOM}"; echo ""
|
@echo 'LD_DEBUG=${LD_DEBUG}'; echo ''
|
||||||
@echo "CCOPT=${CCOPT}"; echo ""
|
@echo 'CALC_ENV=${CALC_ENV}'; echo ''
|
||||||
@echo "CCWARN=${CCWARN}"; echo ""
|
@echo 'ALLOW_CUSTOM=${ALLOW_CUSTOM}'; echo ''
|
||||||
@echo "CCMISC=${CCMISC}"; echo ""
|
@echo 'CCOPT=${CCOPT}'; echo ''
|
||||||
@echo "CFLAGS=${CFLAGS}"; echo ""
|
@echo 'CCWARN=${CCWARN}'; echo ''
|
||||||
@echo "ICFLAGS=${ICFLAGS}"; echo ""
|
@echo 'CCMISC=${CCMISC}'; echo ''
|
||||||
@echo "LDFLAGS=${LDFLAGS}"; echo ""
|
@echo 'CFLAGS=${CFLAGS}'; echo ''
|
||||||
@echo "ILDFLAGS=${ILDFLAGS}"; echo ""
|
@echo 'ICFLAGS=${ICFLAGS}'; echo ''
|
||||||
@echo "LCC=${LCC}"; echo ""
|
@echo 'LDFLAGS=${LDFLAGS}'; echo ''
|
||||||
@echo "CC=${CC}"; echo ""
|
@echo 'ILDFLAGS=${ILDFLAGS}'; echo ''
|
||||||
@echo "SHELL=${SHELL}"; echo ""
|
@echo 'LCC=${LCC}'; echo ''
|
||||||
@echo "MAKE=${MAKE}"; echo ""
|
@echo 'CC=${CC}'; echo ''
|
||||||
@echo "AWK=${AWK}"; echo ""
|
@echo 'SHELL=${SHELL}'; echo ''
|
||||||
@echo "SED=${SED}"; echo ""
|
@echo 'MAKE=${MAKE}'; echo ''
|
||||||
@echo "SORT=${SORT}"; echo ""
|
@echo 'AWK=${AWK}'; echo ''
|
||||||
@echo "TEE=${TEE}"; echo ""
|
@echo 'SED=${SED}'; echo ''
|
||||||
@echo "CTAGS=${CTAGS}"; echo ""
|
@echo 'SORT=${SORT}'; echo ''
|
||||||
@echo "MAKEDEPEND=${MAKEDEPEND}"; echo ""
|
@echo 'TEE=${TEE}'; echo ''
|
||||||
@echo "Q=${Q}"; echo ""
|
@echo 'CTAGS=${CTAGS}'; echo ''
|
||||||
@echo "V=${V}"; echo ""
|
@echo 'MAKEDEPEND=${MAKEDEPEND}'; echo ''
|
||||||
@echo "LIBSRC=${LIBSRC}"; echo ""
|
@echo 'Q=${Q}'; echo ''
|
||||||
@echo "LIBOBJS=${LIBOBJS}"; echo ""
|
@echo 'V=${V}'; echo ''
|
||||||
@echo "CALCSRC=${CALCSRC}"; echo ""
|
@echo 'LIBSRC=${LIBSRC}'; echo ''
|
||||||
@echo "CALCOBJS=${CALCOBJS}"; echo ""
|
@echo 'LIBOBJS=${LIBOBJS}'; echo ''
|
||||||
@echo "BUILD_H_SRC=${BUILD_H_SRC}"; echo ""
|
@echo 'CALCSRC=${CALCSRC}'; echo ''
|
||||||
@echo "BUILD_C_SRC=${BUILD_C_SRC}"; echo ""
|
@echo 'CALCOBJS=${CALCOBJS}'; echo ''
|
||||||
@echo "UTIL_C_SRC=${UTIL_C_SRC}"; echo ""
|
@echo 'BUILD_H_SRC=${BUILD_H_SRC}'; echo ''
|
||||||
@echo "UTIL_MISC_SRC=${UTIL_MISC_SRC}"; echo ""
|
@echo 'BUILD_C_SRC=${BUILD_C_SRC}'; echo ''
|
||||||
@echo "UTIL_OBJS=${UTIL_OBJS}"; echo ""
|
@echo 'UTIL_C_SRC=${UTIL_C_SRC}'; echo ''
|
||||||
@echo "UTIL_TMP=${UTIL_TMP}"; echo ""
|
@echo 'UTIL_MISC_SRC=${UTIL_MISC_SRC}'; echo ''
|
||||||
@echo "UTIL_PROGS=${UTIL_PROGS}"; echo ""
|
@echo 'UTIL_OBJS=${UTIL_OBJS}'; echo ''
|
||||||
@echo "LIB_H_SRC=${LIB_H_SRC}"; echo ""
|
@echo 'UTIL_TMP=${UTIL_TMP}'; echo ''
|
||||||
@echo "CUSTOM_PASSDOWN=${CUSTOM_PASSDOWN}"; echo ""
|
@echo 'UTIL_PROGS=${UTIL_PROGS}'; echo ''
|
||||||
@echo "SAMPLE_PASSDOWN=${SAMPLE_PASSDOWN}"; echo ""
|
@echo 'LIB_H_SRC=${LIB_H_SRC}'; echo ''
|
||||||
@echo "HELP_PASSDOWN=${HELP_PASSDOWN}"; echo ""
|
@echo 'CUSTOM_PASSDOWN=${CUSTOM_PASSDOWN}'; echo ''
|
||||||
@echo "CAL_PASSDOWN=${CAL_PASSDOWN}"; echo ""
|
@echo 'SAMPLE_PASSDOWN=${SAMPLE_PASSDOWN}'; echo ''
|
||||||
@echo "CSCRIPT_PASSDOWN=${CSCRIPT_PASSDOWN}"; echo ""
|
@echo 'HELP_PASSDOWN=${HELP_PASSDOWN}'; echo ''
|
||||||
@echo "H_SRC=${H_SRC}"; echo ""
|
@echo 'CAL_PASSDOWN=${CAL_PASSDOWN}'; echo ''
|
||||||
@echo "C_SRC=${C_SRC}"; echo ""
|
@echo 'CSCRIPT_PASSDOWN=${CSCRIPT_PASSDOWN}'; echo ''
|
||||||
@echo "DISTLIST=${DISTLIST}"; echo ""
|
@echo 'H_SRC=${H_SRC}'; echo ''
|
||||||
@echo "OBJS=${OBJS}"; echo ""
|
@echo 'C_SRC=${C_SRC}'; echo ''
|
||||||
@echo "CALC_LIBS=${CALC_LIBS}"; echo ""
|
@echo 'DISTLIST=${DISTLIST}'; echo ''
|
||||||
@echo "PROGS=${PROGS}"; echo ""
|
@echo 'OBJS=${OBJS}'; echo ''
|
||||||
@echo "TARGETS=${TARGETS}"; echo ""
|
@echo 'CALC_LIBS=${CALC_LIBS}'; echo ''
|
||||||
|
@echo 'PROGS=${PROGS}'; echo ''
|
||||||
|
@echo 'TARGETS=${TARGETS}'; echo ''
|
||||||
@echo '=-=-=-=-= end of major make variable dump =-=-=-=-='
|
@echo '=-=-=-=-= end of major make variable dump =-=-=-=-='
|
||||||
|
|
||||||
mkdebug: env version.c
|
mkdebug: env version.c
|
||||||
@@ -3282,6 +3339,7 @@ file.o: fposval.h
|
|||||||
file.o: hash.h
|
file.o: hash.h
|
||||||
file.o: have_const.h
|
file.o: have_const.h
|
||||||
file.o: have_fpos.h
|
file.o: have_fpos.h
|
||||||
|
file.o: have_fpos_pos.h
|
||||||
file.o: have_malloc.h
|
file.o: have_malloc.h
|
||||||
file.o: have_memmv.h
|
file.o: have_memmv.h
|
||||||
file.o: have_newstr.h
|
file.o: have_newstr.h
|
||||||
@@ -3299,6 +3357,7 @@ file.o: zmath.h
|
|||||||
fposval.o: endian_calc.h
|
fposval.o: endian_calc.h
|
||||||
fposval.o: fposval.c
|
fposval.o: fposval.c
|
||||||
fposval.o: have_fpos.h
|
fposval.o: have_fpos.h
|
||||||
|
fposval.o: have_fpos_pos.h
|
||||||
fposval.o: have_offscl.h
|
fposval.o: have_offscl.h
|
||||||
fposval.o: have_posscl.h
|
fposval.o: have_posscl.h
|
||||||
func.o: alloc.h
|
func.o: alloc.h
|
||||||
@@ -3369,6 +3428,9 @@ hash.o: zrand.h
|
|||||||
hash.o: zrandom.h
|
hash.o: zrandom.h
|
||||||
have_const.o: have_const.c
|
have_const.o: have_const.c
|
||||||
have_fpos.o: have_fpos.c
|
have_fpos.o: have_fpos.c
|
||||||
|
have_fpos_pos.o: have_fpos.h
|
||||||
|
have_fpos_pos.o: have_fpos_pos.c
|
||||||
|
have_fpos_pos.o: have_posscl.h
|
||||||
have_getpgid.o: have_getpgid.c
|
have_getpgid.o: have_getpgid.c
|
||||||
have_getprid.o: have_getprid.c
|
have_getprid.o: have_getprid.c
|
||||||
have_getsid.o: have_getsid.c
|
have_getsid.o: have_getsid.c
|
||||||
|
113
README.WINDOWS
Normal file
113
README.WINDOWS
Normal file
@@ -0,0 +1,113 @@
|
|||||||
|
Dear calc user on a Windoz based system,
|
||||||
|
|
||||||
|
See the HOWTO.INSTALL file for information on how to build and install calc.
|
||||||
|
See also the README file.
|
||||||
|
|
||||||
|
NOTE: The Windoz port is extremely experimental, untested and perhaps
|
||||||
|
incomplete. We are in the process of making it easier. The
|
||||||
|
following should help anyone who is trying to make a go of this
|
||||||
|
under the current code conditions.
|
||||||
|
|
||||||
|
NOTE: We are currently ONLY making an effort to support building under
|
||||||
|
Windoz using the Cygwin project (http://sources.redhat.com/cygwin/)
|
||||||
|
with the GCC compiler and Un*x tools for Windows.
|
||||||
|
|
||||||
|
NOTE: The main developers do not have access to a Windoz based platform.
|
||||||
|
While we will make an effort to not break calc Windoz based system,
|
||||||
|
our lack of a Windoz test environment will mean we will make mistakes
|
||||||
|
from time to time. Hopefully Windowz users can overcome these mistakes.
|
||||||
|
Of course you are welcome to send us any patches that fix your
|
||||||
|
Windoz build environment.
|
||||||
|
|
||||||
|
=-=
|
||||||
|
|
||||||
|
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 calcexe.exe which is the command line interface.
|
||||||
|
|
||||||
|
He recommends that you generate by hand all of the header files generated
|
||||||
|
by the make file:
|
||||||
|
|
||||||
|
align32.h args.h calcerr.h conf.h endian_calc.h
|
||||||
|
fposval.h have_const.h have_fpos.h have_fpos_pos.h have_malloc.h
|
||||||
|
have_memmv.h have_newstr.h have_offscl.h have_posscl.h
|
||||||
|
have_stdlib.h have_string.h have_times.h have_uid_t.h
|
||||||
|
have_unistd.h longbits.h longlong.h terminal.h
|
||||||
|
have_ustat.h have_getsid.h have_getpgid.h
|
||||||
|
have_gettime.h have_getprid.h have_urandom.h have_rusage.h
|
||||||
|
have_strdup.h
|
||||||
|
|
||||||
|
NOTE: In a future release, a tarball of these files will be shipped with
|
||||||
|
calc so that you do not have to do much other than inspect them.
|
||||||
|
|
||||||
|
=-=
|
||||||
|
|
||||||
|
People who maintain calc need to keep in mind the following:
|
||||||
|
|
||||||
|
The following was added to opcodes.h, config.h, zmath.h and value.h:
|
||||||
|
|
||||||
|
#if defined (_WIN32)
|
||||||
|
#ifdef _EXPORTING
|
||||||
|
#define DLL __declspec(dllexport)
|
||||||
|
#else
|
||||||
|
#define DLL __declspec(dllimport)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#else /* Windoz free systems */
|
||||||
|
|
||||||
|
#define DLL
|
||||||
|
|
||||||
|
#endif /* Windoz free systems */
|
||||||
|
|
||||||
|
Then DLL was added in front of all the exported functions. For example:
|
||||||
|
|
||||||
|
extern int configtype(char*);
|
||||||
|
|
||||||
|
was changed to:
|
||||||
|
|
||||||
|
DLL extern int configtype(char*);
|
||||||
|
|
||||||
|
|
||||||
|
## Copyright (C) 2001 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
|
||||||
|
## as published by the Free Software Foundation.
|
||||||
|
##
|
||||||
|
## Calc is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||||
|
## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
|
||||||
|
## Public License for more details.
|
||||||
|
##
|
||||||
|
## A copy of version 2.1 of the GNU Lesser General Public License is
|
||||||
|
## distributed with calc under the filename COPYING-LGPL. You should have
|
||||||
|
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||||
|
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
##
|
||||||
|
## @(#) $Revision: 29.2 $
|
||||||
|
## @(#) $Id: README.WINDOWS,v 29.2 2001/02/25 22:20:38 chongo Exp $
|
||||||
|
## @(#) $Source: /usr/local/src/cmd/calc/RCS/README.WINDOWS,v $
|
||||||
|
##
|
||||||
|
## Under source code control: 2001/02/25 14:00:05
|
||||||
|
## File existed as early as: 2001
|
||||||
|
##
|
||||||
|
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||||
|
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
12
cal/README
12
cal/README
@@ -116,6 +116,10 @@ bernoulli.cal
|
|||||||
|
|
||||||
Calculate the nth Bernoulli number.
|
Calculate the nth Bernoulli number.
|
||||||
|
|
||||||
|
NOTE: There is now a bernoulli() builtin function. This file is
|
||||||
|
left here for backward compatibility and now simply returns
|
||||||
|
the buildin function.
|
||||||
|
|
||||||
|
|
||||||
bigprime.cal
|
bigprime.cal
|
||||||
|
|
||||||
@@ -681,7 +685,7 @@ test8400.cal
|
|||||||
|
|
||||||
test8400() defined
|
test8400() defined
|
||||||
|
|
||||||
This resource file is used by regress.cal to check for quit-based
|
This resource file is used by regress.cal to check for quit-based
|
||||||
memory leaks.
|
memory leaks.
|
||||||
|
|
||||||
test8500.cal
|
test8500.cal
|
||||||
@@ -702,7 +706,7 @@ test8600.cal
|
|||||||
global max_8600
|
global max_8600
|
||||||
global hash_8600
|
global hash_8600
|
||||||
global hmean_8600
|
global hmean_8600
|
||||||
|
|
||||||
This resource file is used by regress.cal to test a change of
|
This resource file is used by regress.cal to test a change of
|
||||||
allowing up to 1024 args to be passed to a builtin function.
|
allowing up to 1024 args to be passed to a builtin function.
|
||||||
|
|
||||||
@@ -752,8 +756,8 @@ xx_print.cal
|
|||||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||||
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||||
##
|
##
|
||||||
## @(#) $Revision: 29.3 $
|
## @(#) $Revision: 29.4 $
|
||||||
## @(#) $Id: README,v 29.3 2000/12/04 20:11:52 chongo Exp $
|
## @(#) $Id: README,v 29.4 2000/12/17 12:26:04 chongo Exp $
|
||||||
## @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/README,v $
|
## @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/README,v $
|
||||||
##
|
##
|
||||||
## Under source code control: 1990/02/15 01:50:32
|
## Under source code control: 1990/02/15 01:50:32
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* bernoulli - clculate the Nth Bernoulli number B(n)
|
* bernoulli - clculate the Nth Bernoulli number B(n)
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999 David I. Bell
|
* Copyright (C) 2000 David I. Bell and Landon Curt Noll
|
||||||
*
|
*
|
||||||
* Calc is open software; you can redistribute it and/or modify it under
|
* Calc is open software; you can redistribute it and/or modify it under
|
||||||
* the terms of the version 2.1 of the GNU Lesser General Public License
|
* the terms of the version 2.1 of the GNU Lesser General Public License
|
||||||
@@ -17,8 +17,8 @@
|
|||||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*
|
*
|
||||||
* @(#) $Revision: 29.2 $
|
* @(#) $Revision: 29.3 $
|
||||||
* @(#) $Id: bernoulli.cal,v 29.2 2000/06/07 14:02:25 chongo Exp $
|
* @(#) $Id: bernoulli.cal,v 29.3 2000/12/17 12:26:04 chongo Exp $
|
||||||
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/bernoulli.cal,v $
|
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/bernoulli.cal,v $
|
||||||
*
|
*
|
||||||
* Under source code control: 1991/09/30 11:18:41
|
* Under source code control: 1991/09/30 11:18:41
|
||||||
@@ -29,12 +29,16 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Calculate the Nth Bernoulli number B(n).
|
* Calculate the Nth Bernoulli number B(n).
|
||||||
* This uses the following symbolic formula to calculate B(n):
|
*
|
||||||
|
* NOTE: This is now a bulitin function.
|
||||||
|
*
|
||||||
|
* The non-buildin code used the following symbolic formula to calculate B(n):
|
||||||
*
|
*
|
||||||
* (b+1)^(n+1) - b^(n+1) = 0
|
* (b+1)^(n+1) - b^(n+1) = 0
|
||||||
*
|
*
|
||||||
* where b is a dummy value, and each power b^i gets replaced by B(i).
|
* where b is a dummy value, and each power b^i gets replaced by B(i).
|
||||||
* For example, for n = 3:
|
* For example, for n = 3:
|
||||||
|
*
|
||||||
* (b+1)^4 - b^4 = 0
|
* (b+1)^4 - b^4 = 0
|
||||||
* b^4 + 4*b^3 + 6*b^2 + 4*b + 1 - b^4 = 0
|
* b^4 + 4*b^3 + 6*b^2 + 4*b + 1 - b^4 = 0
|
||||||
* 4*b^3 + 6*b^2 + 4*b + 1 = 0
|
* 4*b^3 + 6*b^2 + 4*b + 1 = 0
|
||||||
@@ -48,11 +52,14 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
static Bnmax;
|
static Bnmax;
|
||||||
static mat Bn[1001];
|
static mat Bn[1001];
|
||||||
|
*/
|
||||||
|
|
||||||
define B(n)
|
define B(n)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
local nn, np1, i, sum, mulval, divval, combval;
|
local nn, np1, i, sum, mulval, divval, combval;
|
||||||
|
|
||||||
if (!isint(n) || (n < 0))
|
if (!isint(n) || (n < 0))
|
||||||
@@ -85,4 +92,6 @@ define B(n)
|
|||||||
}
|
}
|
||||||
Bnmax = n;
|
Bnmax = n;
|
||||||
return Bn[n];
|
return Bn[n];
|
||||||
|
*/
|
||||||
|
return bernoulli(n);
|
||||||
}
|
}
|
||||||
|
@@ -1,24 +1,46 @@
|
|||||||
/*
|
/*
|
||||||
* qtime - Display time as English sentence
|
* qtime - Display time as English sentence
|
||||||
*
|
*
|
||||||
|
* Copyright (C) 1999 Klaus Alexander Seistrup and Landon Curt Noll
|
||||||
|
*
|
||||||
|
* Written by: Klaus Alexander Seistrup <kseis@magnetic-ink.dk>
|
||||||
|
* With mods by: Landon Curt Noll <http://www.isthe.com/chongo/>
|
||||||
|
*
|
||||||
|
* Calc is open software; you can redistribute it and/or modify it under
|
||||||
|
* the terms of the version 2.1 of the GNU Lesser General Public License
|
||||||
|
* as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* Calc is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||||
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
|
||||||
|
* Public License for more details.
|
||||||
|
*
|
||||||
|
* A copy of version 2.1 of the GNU Lesser General Public License is
|
||||||
|
* distributed with calc under the filename COPYING-LGPL. You should have
|
||||||
|
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||||
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*
|
||||||
|
* @(#) $Revision: 29.4 $
|
||||||
|
* @(#) $Id: qtime.cal,v 29.4 2000/12/18 10:18:40 chongo Exp $
|
||||||
|
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/qtime.cal,v $
|
||||||
|
*
|
||||||
|
* Under source code control: 1999/10/13 04:10:33
|
||||||
|
* File existed as early as: 1999
|
||||||
|
*
|
||||||
|
* chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||||
|
* Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
* usage:
|
* usage:
|
||||||
* qtime(utc_hr_offset)
|
* qtime(utc_hr_offset)
|
||||||
*
|
*
|
||||||
* utc_hr_offset Offset from UTC in hours.
|
* utc_hr_offset Offset from UTC in hours.
|
||||||
*
|
*
|
||||||
* Written by: Klaus Alexander Seistrup <kseis@magnetic-ink.dk>
|
|
||||||
* With minor mods by: Landon Curt Noll <http://www.isthe.com/chongo/>
|
|
||||||
*
|
|
||||||
* See:
|
* See:
|
||||||
* http://www.magnetic-ink.dk/download/qtime.html
|
* http://www.magnetic-ink.dk/download/qtime.html
|
||||||
*
|
*
|
||||||
* for examples of qtime() written on other languages.
|
* for examples of qtime() written on other languages.
|
||||||
*
|
|
||||||
* @(#) $Revision: 29.2 $
|
|
||||||
* @(#) $Id: qtime.cal,v 29.2 2000/06/07 14:02:25 chongo Exp $
|
|
||||||
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/qtime.cal,v $
|
|
||||||
*
|
|
||||||
* This file is not covered under version 2.1 of the GNU LGPL.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
@@ -17,8 +17,8 @@
|
|||||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*
|
*
|
||||||
* @(#) $Revision: 29.5 $
|
* @(#) $Revision: 29.6 $
|
||||||
* @(#) $Id: regress.cal,v 29.5 2000/12/04 20:00:53 chongo Exp $
|
* @(#) $Id: regress.cal,v 29.6 2000/12/17 12:26:42 chongo Exp $
|
||||||
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/regress.cal,v $
|
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/regress.cal,v $
|
||||||
*
|
*
|
||||||
* Under source code control: 1990/02/15 01:50:36
|
* Under source code control: 1990/02/15 01:50:36
|
||||||
@@ -1223,7 +1223,85 @@ define test_functions()
|
|||||||
vrfy(hnrmod(21<<500+7,3,500,-1) == (21<<500+7)%(3<<500-1),
|
vrfy(hnrmod(21<<500+7,3,500,-1) == (21<<500+7)%(3<<500-1),
|
||||||
'1112: hnrmod(21<<500+7,3,500,-1) == (21<<500+7)%(3<<500-1)');
|
'1112: hnrmod(21<<500+7,3,500,-1) == (21<<500+7)%(3<<500-1)');
|
||||||
|
|
||||||
print '1113: Ending test_functions';
|
/*
|
||||||
|
* catalan testing
|
||||||
|
*/
|
||||||
|
vrfy(catalan(2) == 2, '1113: catalan(2) == 2');
|
||||||
|
vrfy(catalan(3) == 5, '1114: catalan(3) == 5');
|
||||||
|
vrfy(catalan(4) == 14, '1115: catalan(4) == 14');
|
||||||
|
vrfy(catalan(20) == 6564120420, '1116: catalan(20) == 6564120420');
|
||||||
|
|
||||||
|
/*
|
||||||
|
* bernoulli builtin function testing
|
||||||
|
*/
|
||||||
|
vrfy(bernoulli(0) == 1, '1117: bernoulli(0) == 1');
|
||||||
|
vrfy(bernoulli(1) == -1/2, '1118: bernoulli(1) == -1/2');
|
||||||
|
vrfy(bernoulli(2) == 1/6, '1119: bernoulli(2) == 1/6');
|
||||||
|
vrfy(bernoulli(3) == 0, '1120: bernoulli(3) == 0');
|
||||||
|
vrfy(bernoulli(4) == -1/30, '1121: bernoulli(4) == -1/30');
|
||||||
|
vrfy(bernoulli(5) == 0, '1122: bernoulli(5) == 0');
|
||||||
|
vrfy(bernoulli(6) == 1/42, '1123: bernoulli(6) == 1/42');
|
||||||
|
vrfy(bernoulli(32) == -7709321041217/510,
|
||||||
|
'1124: bernoulli(32) == -7709321041217/510');
|
||||||
|
|
||||||
|
/*
|
||||||
|
* euler function testing
|
||||||
|
*/
|
||||||
|
vrfy(euler(0) == 1, '1125: euler(0) == 1');
|
||||||
|
vrfy(euler(1) == 0, '1126: euler(1) == 0');
|
||||||
|
vrfy(euler(2) == -1, '1127: euler(2) == -1');
|
||||||
|
vrfy(euler(3) == 0, '1128: euler(3) == 0');
|
||||||
|
vrfy(freeeuler() == null(), '1129: freeeuler() == null()');
|
||||||
|
vrfy(euler(4) == 5, '1130: euler(4) == 5');
|
||||||
|
vrfy(euler(5) == 0, '1131: euler(5) == 0');
|
||||||
|
vrfy(euler(6) == -61, '1132: euler(6) == -61');
|
||||||
|
vrfy(euler(32) == 177519391579539289436664789665,
|
||||||
|
'1130: euler(32) == 177519391579539289436664789665');
|
||||||
|
vrfy(freeeuler() == null(), '1133: freeeuler() == null()');
|
||||||
|
|
||||||
|
/*
|
||||||
|
* digit with non-10 base
|
||||||
|
*/
|
||||||
|
a = 123456.789;
|
||||||
|
print '1134: a = 123456.789';
|
||||||
|
vrfy(digit(a, 6, 100) == 0, '1135: digit(a, 6, 100) == 0');
|
||||||
|
vrfy(digit(a, 5, 100) == 0, '1136: digit(a, 5, 100) == 0');
|
||||||
|
vrfy(digit(a, 4, 100) == 0, '1137: digit(a, 4, 100) == 0');
|
||||||
|
vrfy(digit(a, 3, 100) == 0, '1138: digit(a, 3, 100) == 0');
|
||||||
|
vrfy(digit(a, 2, 100) == 12, '1139: digit(a, 2, 100) == 12');
|
||||||
|
vrfy(digit(a, 1, 100) == 34, '1140: digit(a, 1, 100) == 34');
|
||||||
|
vrfy(digit(a, 0, 100) == 56, '1141: digit(a, 0, 100) == 56');
|
||||||
|
vrfy(digit(a, -1, 100) == 78, '1142: digit(a, -1, 100) == 78');
|
||||||
|
vrfy(digit(a, -2, 100) == 90, '1143: digit(a, -2, 100) == 90');
|
||||||
|
vrfy(digit(a, -3, 100) == 0, '1144: digit(a, -3, 100) == 0');
|
||||||
|
vrfy(digit(a, -4, 100) == 0, '1145: digit(a, -4, 100) == 0');
|
||||||
|
vrfy(digit(a, -5, 100) == 0, '1146: digit(a, -5, 100) == 0');
|
||||||
|
vrfy(digit(a, -6, 100) == 0, '1146: digit(a, -6, 100) == 0');
|
||||||
|
|
||||||
|
/*
|
||||||
|
* digits with a non-10 base
|
||||||
|
*/
|
||||||
|
vrfy(digits(a, 100) == 3, '1147: digits(a, 100) == 3');
|
||||||
|
vrfy(digits(2^256-1, 256) == 32,'1148: digits(2^256-1, 256) == 32');
|
||||||
|
|
||||||
|
/*
|
||||||
|
* places with a non-10 base
|
||||||
|
*/
|
||||||
|
vrfy(places(0.0123, 2) == -1, '1149: places(0.0123, 2) == -1');
|
||||||
|
vrfy(places(0.625, 2) == 3, '1150: places(0.625, 2) == 3');
|
||||||
|
vrfy(places(0.625, 8) == 1, '1151: places(0.625, 8) == 1');
|
||||||
|
vrfy(places(171/2^712, 2) == 712,
|
||||||
|
'1152: places(171/2^7120.625, 2) == 712');
|
||||||
|
vrfy(places(171/2^712, 64) == 119,
|
||||||
|
'1152: places(171/2^7120.625, 64) == 119');
|
||||||
|
|
||||||
|
/*
|
||||||
|
* verify sleep
|
||||||
|
*/
|
||||||
|
vrfy(sleep(1/5) == null(), '1153: sleep(1/5) == null()');
|
||||||
|
vrfy(sleep(1) == null(), '1154: sleep(1) == null()');
|
||||||
|
|
||||||
|
print '1155: Ending test_functions';
|
||||||
}
|
}
|
||||||
print '017: parsed test_functions()';
|
print '017: parsed test_functions()';
|
||||||
|
|
||||||
|
16
calc.c
16
calc.c
@@ -19,8 +19,8 @@
|
|||||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*
|
*
|
||||||
* @(#) $Revision: 29.5 $
|
* @(#) $Revision: 29.6 $
|
||||||
* @(#) $Id: calc.c,v 29.5 2000/07/17 15:35:49 chongo Exp $
|
* @(#) $Id: calc.c,v 29.6 2001/02/25 22:07:36 chongo Exp $
|
||||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/calc.c,v $
|
* @(#) $Source: /usr/local/src/cmd/calc/RCS/calc.c,v $
|
||||||
*
|
*
|
||||||
* Under source code control: 1990/02/15 01:48:11
|
* Under source code control: 1990/02/15 01:48:11
|
||||||
@@ -36,6 +36,18 @@
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
|
#if defined (_WIN32)
|
||||||
|
#include <io.h>
|
||||||
|
/*
|
||||||
|
* getopt.h file is from the Cygwin GNU library
|
||||||
|
*
|
||||||
|
* See:
|
||||||
|
* http://sources.redhat.com/cygwin/
|
||||||
|
*/
|
||||||
|
#include "../getopt/getopt.h"
|
||||||
|
#define strdup _strdup
|
||||||
|
#endif /* Windoz */
|
||||||
|
|
||||||
#define CALC_C
|
#define CALC_C
|
||||||
#include "calc.h"
|
#include "calc.h"
|
||||||
#include "hist.h"
|
#include "hist.h"
|
||||||
|
30
config.h
30
config.h
@@ -19,8 +19,8 @@
|
|||||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*
|
*
|
||||||
* @(#) $Revision: 29.4 $
|
* @(#) $Revision: 29.5 $
|
||||||
* @(#) $Id: config.h,v 29.4 2000/07/17 15:35:49 chongo Exp $
|
* @(#) $Id: config.h,v 29.5 2001/02/25 22:07:36 chongo Exp $
|
||||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/config.h,v $
|
* @(#) $Source: /usr/local/src/cmd/calc/RCS/config.h,v $
|
||||||
*
|
*
|
||||||
* Under source code control: 1995/11/01 22:20:17
|
* Under source code control: 1995/11/01 22:20:17
|
||||||
@@ -35,6 +35,20 @@
|
|||||||
#define __CONFIG_H__
|
#define __CONFIG_H__
|
||||||
|
|
||||||
|
|
||||||
|
#if defined (_WIN32)
|
||||||
|
#ifdef _EXPORTING
|
||||||
|
#define DLL __declspec(dllexport)
|
||||||
|
#else
|
||||||
|
#define DLL __declspec(dllimport)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#else /* Windoz free systems */
|
||||||
|
|
||||||
|
#define DLL
|
||||||
|
|
||||||
|
#endif /* Windoz free systems */
|
||||||
|
|
||||||
|
|
||||||
#include "nametype.h"
|
#include "nametype.h"
|
||||||
#include "qmath.h"
|
#include "qmath.h"
|
||||||
|
|
||||||
@@ -193,12 +207,12 @@ extern char *user_debug; /* !=NULL => value of config("user_debug") */
|
|||||||
/*
|
/*
|
||||||
* configuration externals
|
* configuration externals
|
||||||
*/
|
*/
|
||||||
extern CONFIG *config_copy(CONFIG *src);
|
DLL extern CONFIG *config_copy(CONFIG *src);
|
||||||
extern void config_free(CONFIG *cfg);
|
DLL extern void config_free(CONFIG *cfg);
|
||||||
extern void config_print(CONFIG *cfg);
|
DLL extern void config_print(CONFIG *cfg);
|
||||||
extern int configtype(char*);
|
DLL extern int configtype(char*);
|
||||||
extern void config_print(CONFIG*);
|
DLL extern void config_print(CONFIG*);
|
||||||
extern BOOL config_cmp(CONFIG*, CONFIG*);
|
DLL extern BOOL config_cmp(CONFIG*, CONFIG*);
|
||||||
|
|
||||||
|
|
||||||
#endif /* !__CONFIG_H__ */
|
#endif /* !__CONFIG_H__ */
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# sqaure - print the squares of input values
|
# sqaure - print the squares of input values
|
||||||
#
|
#
|
||||||
# Copyright (C) 2000 Landon Curt Noll
|
# Copyright (C) 2000 Ernest Bowen
|
||||||
#
|
#
|
||||||
# Calc is open software; you can redistribute it and/or modify it under
|
# Calc is open software; you can redistribute it and/or modify it under
|
||||||
# the terms of the version 2.1 of the GNU Lesser General Public License
|
# the terms of the version 2.1 of the GNU Lesser General Public License
|
||||||
@@ -18,8 +18,8 @@
|
|||||||
# received a copy with calc; if not, write to Free Software Foundation, Inc.
|
# received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||||
# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#
|
#
|
||||||
# @(#) $Revision: 29.1 $
|
# @(#) $Revision: 29.3 $
|
||||||
# @(#) $Id: square.calc,v 29.1 2000/12/15 14:55:59 chongo Exp $
|
# @(#) $Id: square.calc,v 29.3 2000/12/17 14:31:58 chongo Exp $
|
||||||
# @(#) $Source: /usr/local/src/cmd/calc/cscript/RCS/square.calc,v $
|
# @(#) $Source: /usr/local/src/cmd/calc/cscript/RCS/square.calc,v $
|
||||||
#
|
#
|
||||||
# Under source code control: 2000/12/15 06:52:01
|
# Under source code control: 2000/12/15 06:52:01
|
||||||
@@ -27,8 +27,38 @@
|
|||||||
#
|
#
|
||||||
# Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
# Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||||
|
|
||||||
# usage:
|
# Usage:
|
||||||
# mersenne exp
|
#
|
||||||
|
# From the shell:
|
||||||
|
#
|
||||||
|
# ./square
|
||||||
|
# cat file | ./square
|
||||||
|
# echo "123" | ./square
|
||||||
|
#
|
||||||
|
# Within calc:
|
||||||
|
#
|
||||||
|
# > read square
|
||||||
|
#
|
||||||
|
# With input from a terminal, there is no prompt but each non-empty
|
||||||
|
# line of input is evaluated as a calc expression and if it can be
|
||||||
|
# calculated, the square of the value of that expression is displayed.
|
||||||
|
# Execution stops when an empty line is input.
|
||||||
|
#
|
||||||
|
# From the shell:
|
||||||
|
#
|
||||||
|
# ./square
|
||||||
|
#
|
||||||
|
# The following shows lines of input followed by output:
|
||||||
|
#
|
||||||
|
# 1234
|
||||||
|
# 1522756
|
||||||
|
# ln(2)
|
||||||
|
# ~.48045301391820142467
|
||||||
|
# config("mode","frac"), bernoulli(10)
|
||||||
|
# 25/4356
|
||||||
|
# config("mode", "hex"), 0xff
|
||||||
|
# 0xfe01
|
||||||
|
#
|
||||||
|
|
||||||
global s;
|
global s;
|
||||||
while ((s = prompt("")))
|
while ((s = prompt("")))
|
||||||
|
@@ -18,8 +18,8 @@
|
|||||||
# received a copy with calc; if not, write to Free Software Foundation, Inc.
|
# received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||||
# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#
|
#
|
||||||
# @(#) $Revision: 29.2 $
|
# @(#) $Revision: 29.3 $
|
||||||
# @(#) $Id: Makefile,v 29.2 2000/06/07 14:03:03 chongo Exp $
|
# @(#) $Id: Makefile,v 29.3 2000/12/17 12:28:15 chongo Exp $
|
||||||
# @(#) $Source: /usr/local/src/cmd/calc/custom/RCS/Makefile,v $
|
# @(#) $Source: /usr/local/src/cmd/calc/custom/RCS/Makefile,v $
|
||||||
#
|
#
|
||||||
# Under source code control: 1997/03/09 02:28:54
|
# Under source code control: 1997/03/09 02:28:54
|
||||||
@@ -406,7 +406,10 @@ depend:
|
|||||||
echo '#endif /* '"$$tag"' */' >> "skel/custom/$$i"; \
|
echo '#endif /* '"$$tag"' */' >> "skel/custom/$$i"; \
|
||||||
done
|
done
|
||||||
${Q}(cd ..; ${MAKE} hsrc)
|
${Q}(cd ..; ${MAKE} hsrc)
|
||||||
${Q}for i in `cd ..; ${MAKE} h_list`; do \
|
${Q}for i in `cd ..; ${MAKE} h_list 2>&1 | \
|
||||||
|
${SED} -e '/Entering directory/d' \
|
||||||
|
-e '/Nothing to be done/d' \
|
||||||
|
-e '/Leaving directory/d'`; do \
|
||||||
tag="`echo $$i | ${SED} 's/[\.+,:]/_/g'`"; \
|
tag="`echo $$i | ${SED} 's/[\.+,:]/_/g'`"; \
|
||||||
echo "#if !defined($$tag)" > "skel/$$i"; \
|
echo "#if !defined($$tag)" > "skel/$$i"; \
|
||||||
echo "#define $$tag" >> "skel/$$i"; \
|
echo "#define $$tag" >> "skel/$$i"; \
|
||||||
|
15
file.c
15
file.c
@@ -19,8 +19,8 @@
|
|||||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*
|
*
|
||||||
* @(#) $Revision: 29.2 $
|
* @(#) $Revision: 29.5 $
|
||||||
* @(#) $Id: file.c,v 29.2 2000/06/07 14:02:13 chongo Exp $
|
* @(#) $Id: file.c,v 29.5 2001/02/25 22:07:36 chongo Exp $
|
||||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/file.c,v $
|
* @(#) $Source: /usr/local/src/cmd/calc/RCS/file.c,v $
|
||||||
*
|
*
|
||||||
* Under source code control: 1991/07/20 00:21:56
|
* Under source code control: 1991/07/20 00:21:56
|
||||||
@@ -35,11 +35,15 @@
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include "have_unistd.h"
|
||||||
|
#if defined(HAVE_UNISTD_H)
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#endif /* HAVE_UNISTD_H */
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include "calc.h"
|
#include "calc.h"
|
||||||
#include "longbits.h"
|
#include "longbits.h"
|
||||||
#include "have_fpos.h"
|
#include "have_fpos.h"
|
||||||
|
#include "have_fpos_pos.h"
|
||||||
#include "fposval.h"
|
#include "fposval.h"
|
||||||
#include "file.h"
|
#include "file.h"
|
||||||
#include "calcerr.h"
|
#include "calcerr.h"
|
||||||
@@ -1178,7 +1182,7 @@ filepos2z(FILEPOS pos)
|
|||||||
ret.len = FILEPOS_BITS/BASEB;
|
ret.len = FILEPOS_BITS/BASEB;
|
||||||
ret.v = alloc(ret.len);
|
ret.v = alloc(ret.len);
|
||||||
zclearval(ret);
|
zclearval(ret);
|
||||||
SWAP_HALF_IN_FILEPOS(ret.v, &pos);
|
SWAP_HALF_IN_FILEPOS(ret.v, (HALF *)&pos);
|
||||||
ret.sign = 0;
|
ret.sign = 0;
|
||||||
ztrim(&ret);
|
ztrim(&ret);
|
||||||
|
|
||||||
@@ -1239,7 +1243,8 @@ z2filepos(ZVALUE zpos)
|
|||||||
if (!zgtmaxfull(zpos)) {
|
if (!zgtmaxfull(zpos)) {
|
||||||
/* ztofull puts the value into native byte order */
|
/* ztofull puts the value into native byte order */
|
||||||
pos = ztofull(zpos);
|
pos = ztofull(zpos);
|
||||||
ret = pos;
|
memset(&ret, 0, sizeof(FILEPOS));
|
||||||
|
memcpy((void *)&ret, (void *)&pos, sizeof(pos));
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1251,7 +1256,7 @@ z2filepos(ZVALUE zpos)
|
|||||||
memcpy(&tmp, zpos.v, sizeof(FILEPOS));
|
memcpy(&tmp, zpos.v, sizeof(FILEPOS));
|
||||||
} else {
|
} else {
|
||||||
/* copy what bits we can into the temp value */
|
/* copy what bits we can into the temp value */
|
||||||
tmp = 0;
|
memset(&tmp, 0, sizeof(FILEPOS));
|
||||||
memcpy(&tmp, zpos.v, zpos.len*BASEB/8);
|
memcpy(&tmp, zpos.v, zpos.len*BASEB/8);
|
||||||
}
|
}
|
||||||
/* swap into native byte order */
|
/* swap into native byte order */
|
||||||
|
13
fposval.c
13
fposval.c
@@ -17,8 +17,8 @@
|
|||||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*
|
*
|
||||||
* @(#) $Revision: 29.2 $
|
* @(#) $Revision: 29.5 $
|
||||||
* @(#) $Id: fposval.c,v 29.2 2000/06/07 14:02:13 chongo Exp $
|
* @(#) $Id: fposval.c,v 29.5 2001/02/25 21:01:34 chongo Exp $
|
||||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/fposval.c,v $
|
* @(#) $Source: /usr/local/src/cmd/calc/RCS/fposval.c,v $
|
||||||
*
|
*
|
||||||
* Under source code control: 1994/11/05 03:19:52
|
* Under source code control: 1994/11/05 03:19:52
|
||||||
@@ -63,6 +63,7 @@
|
|||||||
#include "endian_calc.h"
|
#include "endian_calc.h"
|
||||||
#include "have_offscl.h"
|
#include "have_offscl.h"
|
||||||
#include "have_posscl.h"
|
#include "have_posscl.h"
|
||||||
|
#include "have_fpos_pos.h"
|
||||||
|
|
||||||
char *program; /* our name */
|
char *program; /* our name */
|
||||||
|
|
||||||
@@ -83,7 +84,11 @@ main(int argc, char **argv)
|
|||||||
/*
|
/*
|
||||||
* print the file position information
|
* print the file position information
|
||||||
*/
|
*/
|
||||||
|
#if defined(HAVE_FPOS_POS)
|
||||||
|
fileposlen = FPOS_POS_BITS;
|
||||||
|
#else /* ! HAVE_FPOS_POS */
|
||||||
fileposlen = sizeof(FILEPOS)*8;
|
fileposlen = sizeof(FILEPOS)*8;
|
||||||
|
#endif /* ! HAVE_FPOS_POS */
|
||||||
printf("#undef FILEPOS_BITS\n");
|
printf("#undef FILEPOS_BITS\n");
|
||||||
printf("#define FILEPOS_BITS %d\n", fileposlen);
|
printf("#define FILEPOS_BITS %d\n", fileposlen);
|
||||||
#if CALC_BYTE_ORDER == BIG_ENDIAN
|
#if CALC_BYTE_ORDER == BIG_ENDIAN
|
||||||
@@ -113,8 +118,8 @@ main(int argc, char **argv)
|
|||||||
* Normally a "(*(dest) = *(src))" would do, but on some
|
* Normally a "(*(dest) = *(src))" would do, but on some
|
||||||
* systems a FILEPOS is not a scalar hince we must memcpy.
|
* systems a FILEPOS is not a scalar hince we must memcpy.
|
||||||
*/
|
*/
|
||||||
printf("#define SWAP_HALF_IN_FILEPOS(dest, src)\t%s%d%s\n",
|
printf("#define SWAP_HALF_IN_FILEPOS(dest, src)\t%s\n",
|
||||||
"memcpy((void *)(dest), (void *)(src), sizeof(",fileposlen,"))");
|
"memcpy((void *)(dest), (void *)(src), sizeof(FPOS_POS_BITS))");
|
||||||
#endif /* HAVE_FILEPOS_SCALAR */
|
#endif /* HAVE_FILEPOS_SCALAR */
|
||||||
#endif /* CALC_BYTE_ORDER == BIG_ENDIAN */
|
#endif /* CALC_BYTE_ORDER == BIG_ENDIAN */
|
||||||
putchar('\n');
|
putchar('\n');
|
||||||
|
13
func.c
13
func.c
@@ -19,8 +19,8 @@
|
|||||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*
|
*
|
||||||
* @(#) $Revision: 29.5 $
|
* @(#) $Revision: 29.6 $
|
||||||
* @(#) $Id: func.c,v 29.5 2000/12/04 19:32:33 chongo Exp $
|
* @(#) $Id: func.c,v 29.6 2001/02/25 22:07:36 chongo Exp $
|
||||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/func.c,v $
|
* @(#) $Source: /usr/local/src/cmd/calc/RCS/func.c,v $
|
||||||
*
|
*
|
||||||
* Under source code control: 1990/02/15 01:48:15
|
* Under source code control: 1990/02/15 01:48:15
|
||||||
@@ -35,6 +35,11 @@
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
|
#if defined(_WIN32)
|
||||||
|
#include <io.h>
|
||||||
|
#define _access access
|
||||||
|
#endif /* Windoz */
|
||||||
|
|
||||||
#if defined(FUNCLIST)
|
#if defined(FUNCLIST)
|
||||||
|
|
||||||
#define CONST /* disabled for FUNCLIST in case NATIVE_CC doesn't have it */
|
#define CONST /* disabled for FUNCLIST in case NATIVE_CC doesn't have it */
|
||||||
@@ -4922,10 +4927,14 @@ f_listremove(VALUE *vp)
|
|||||||
static NUMBER *
|
static NUMBER *
|
||||||
f_runtime(void)
|
f_runtime(void)
|
||||||
{
|
{
|
||||||
|
#if defined(_WIN32)
|
||||||
|
return qlink(&_qzero_);
|
||||||
|
#else /* Windoz free systems */
|
||||||
struct tms buf;
|
struct tms buf;
|
||||||
|
|
||||||
times(&buf);
|
times(&buf);
|
||||||
return iitoq((long) buf.tms_utime, (long) CLK_TCK);
|
return iitoq((long) buf.tms_utime, (long) CLK_TCK);
|
||||||
|
#endif /* Windoz free systems */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
59
have_fpos_pos.c
Normal file
59
have_fpos_pos.c
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
/*
|
||||||
|
* have_fpos_pos - Determine if a __pos element in FILEPOS
|
||||||
|
*
|
||||||
|
* Copyright (C) 2000 Landon Curt Noll
|
||||||
|
*
|
||||||
|
* Calc is open software; you can redistribute it and/or modify it under
|
||||||
|
* the terms of the version 2.1 of the GNU Lesser General Public License
|
||||||
|
* as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* Calc is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||||
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
|
||||||
|
* Public License for more details.
|
||||||
|
*
|
||||||
|
* A copy of version 2.1 of the GNU Lesser General Public License is
|
||||||
|
* distributed with calc under the filename COPYING-LGPL. You should have
|
||||||
|
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||||
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*
|
||||||
|
* @(#) $Revision: 29.1 $
|
||||||
|
* @(#) $Id: have_fpos_pos.c,v 29.1 2000/12/17 11:25:22 chongo Exp $
|
||||||
|
* @(#) $Source: /usr/local/src/cmd/calc/RCS/have_fpos_pos.c,v $
|
||||||
|
*
|
||||||
|
* Under source code control: 2000/12/17 01:23
|
||||||
|
* File existed as early as: 2000
|
||||||
|
*
|
||||||
|
* chongo <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||||
|
* Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If the symbol HAVE_NO_FPOS is defined, we will output nothing.
|
||||||
|
* If the HAVE_FILEPOS_SCALAR is defuned, we will output nothing.
|
||||||
|
* If we are able to compile this program, then we must have the
|
||||||
|
* __pos element in a non-scalar FILEPOS.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include "have_fpos.h"
|
||||||
|
#include "have_posscl.h"
|
||||||
|
|
||||||
|
int
|
||||||
|
main(void)
|
||||||
|
{
|
||||||
|
#if !defined(HAVE_NO_FPOS) && !defined(HAVE_FILEPOS_SCALAR)
|
||||||
|
fpos_t pos; /* file position */
|
||||||
|
|
||||||
|
/* print a __pos element in fpos_t */
|
||||||
|
printf("#undef HAVE_FPOS_POS\n");
|
||||||
|
printf("#define HAVE_FPOS_POS 1 /* yes */\n\n");
|
||||||
|
|
||||||
|
/* determine __pos element size */
|
||||||
|
printf("#undef FPOS_POS_BITS\n");
|
||||||
|
printf("#define FPOS_POS_BITS %d\n\n", sizeof(pos.__pos)*8);
|
||||||
|
#endif
|
||||||
|
/* exit(0); */
|
||||||
|
return 0;
|
||||||
|
}
|
10
help.c
10
help.c
@@ -17,8 +17,8 @@
|
|||||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*
|
*
|
||||||
* @(#) $Revision: 29.4 $
|
* @(#) $Revision: 29.5 $
|
||||||
* @(#) $Id: help.c,v 29.4 2000/06/07 14:02:13 chongo Exp $
|
* @(#) $Id: help.c,v 29.5 2001/02/25 22:07:36 chongo Exp $
|
||||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/help.c,v $
|
* @(#) $Source: /usr/local/src/cmd/calc/RCS/help.c,v $
|
||||||
*
|
*
|
||||||
* Under source code control: 1997/09/14 10:58:30
|
* Under source code control: 1997/09/14 10:58:30
|
||||||
@@ -105,7 +105,11 @@ page_file(FILE *stream)
|
|||||||
/*
|
/*
|
||||||
* form a write pipe to a pager
|
* form a write pipe to a pager
|
||||||
*/
|
*/
|
||||||
cmd = popen(pager, "w");
|
if (pager == NULL || pager[0] == '\0') {
|
||||||
|
cmd = stdout;
|
||||||
|
} else {
|
||||||
|
cmd = popen(pager, "w");
|
||||||
|
}
|
||||||
if (cmd == NULL) {
|
if (cmd == NULL) {
|
||||||
fprintf(stderr, "unable form pipe to pager: %s", pager);
|
fprintf(stderr, "unable form pipe to pager: %s", pager);
|
||||||
return;
|
return;
|
||||||
|
@@ -22,7 +22,7 @@ DESCRIPTION
|
|||||||
|
|
||||||
Considerable runtime and memory are required for calculating
|
Considerable runtime and memory are required for calculating
|
||||||
bernoulli(n) for large even n. For n = 1000, the numerator has
|
bernoulli(n) for large even n. For n = 1000, the numerator has
|
||||||
1779 digits, the denominator 9 digits.
|
1779 digits, the denominator 9 digits.
|
||||||
|
|
||||||
The memory used to store calculated bernoulli numbers is freed by
|
The memory used to store calculated bernoulli numbers is freed by
|
||||||
freebernoulli().
|
freebernoulli().
|
||||||
@@ -57,8 +57,8 @@ SEE ALSO
|
|||||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||||
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||||
##
|
##
|
||||||
## @(#) $Revision: 29.3 $
|
## @(#) $Revision: 29.4 $
|
||||||
## @(#) $Id: bernoulli,v 29.3 2000/12/14 10:32:24 chongo Exp $
|
## @(#) $Id: bernoulli,v 29.4 2000/12/17 12:27:58 chongo Exp $
|
||||||
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/bernoulli,v $
|
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/bernoulli,v $
|
||||||
##
|
##
|
||||||
## Under source code control: 2000/07/13 01:33:00
|
## Under source code control: 2000/07/13 01:33:00
|
||||||
|
@@ -11,7 +11,7 @@ TYPES
|
|||||||
|
|
||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
If n >= 0, this returns the Catalan number for index n:
|
If n >= 0, this returns the Catalan number for index n:
|
||||||
|
|
||||||
catalan(n) = comb(2*n,n)/(n + 1)
|
catalan(n) = comb(2*n,n)/(n + 1)
|
||||||
|
|
||||||
Zero is returned for negative n.
|
Zero is returned for negative n.
|
||||||
@@ -53,8 +53,8 @@ SEE ALSO
|
|||||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||||
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||||
##
|
##
|
||||||
## @(#) $Revision: 29.1 $
|
## @(#) $Revision: 29.2 $
|
||||||
## @(#) $Id: catalan,v 29.1 2000/12/14 10:31:45 chongo Exp $
|
## @(#) $Id: catalan,v 29.2 2000/12/17 12:27:58 chongo Exp $
|
||||||
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/catalan,v $
|
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/catalan,v $
|
||||||
##
|
##
|
||||||
## Under source code control: 2000/12/14 01:33:00
|
## Under source code control: 2000/12/14 01:33:00
|
||||||
|
14
help/digit
14
help/digit
@@ -15,7 +15,7 @@ DESCRIPTION
|
|||||||
|
|
||||||
d(x,n,b) returns the digit with index n in a standard base-b "decimal"
|
d(x,n,b) returns the digit with index n in a standard base-b "decimal"
|
||||||
representation of x, which may be described as follows:
|
representation of x, which may be described as follows:
|
||||||
|
|
||||||
For an arbitrary base b >= 2, following the pattern of decimal (base 10)
|
For an arbitrary base b >= 2, following the pattern of decimal (base 10)
|
||||||
notation in elementary arithmetic, a base-b "decimal" representation of
|
notation in elementary arithmetic, a base-b "decimal" representation of
|
||||||
a positive real number may be considered to be specified by a finite or
|
a positive real number may be considered to be specified by a finite or
|
||||||
@@ -31,18 +31,18 @@ DESCRIPTION
|
|||||||
d_2 d_1 d_0 . d_-1 d_-2
|
d_2 d_1 d_0 . d_-1 d_-2
|
||||||
|
|
||||||
represents the number
|
represents the number
|
||||||
|
|
||||||
d_2 * b^2 + d_1 * b + d0 + d_-1 * b^-1 + d_-2 * b^-2
|
d_2 * b^2 + d_1 * b + d0 + d_-1 * b^-1 + d_-2 * b^-2
|
||||||
|
|
||||||
The sequence of digits has to be infinite if den(x) has a prime factor
|
The sequence of digits has to be infinite if den(x) has a prime factor
|
||||||
which is not a factor of the base b. In cases where the representation
|
which is not a factor of the base b. In cases where the representation
|
||||||
may terminate, the digits are considered to continue with an infinite
|
may terminate, the digits are considered to continue with an infinite
|
||||||
string of zeros rather than the other possibility of an infinite
|
string of zeros rather than the other possibility of an infinite
|
||||||
sequence of (b - 1)s. Thus, for the above example, d_n = 0 for
|
sequence of (b - 1)s. Thus, for the above example, d_n = 0 for
|
||||||
n = -3, -4, ... Similarly, a representation may be considered to
|
n = -3, -4, ... Similarly, a representation may be considered to
|
||||||
continue with an infinite string of zeros on the left, so that in the
|
continue with an infinite string of zeros on the left, so that in the
|
||||||
above example d_n = 0 also for n >= 3.
|
above example d_n = 0 also for n >= 3.
|
||||||
|
|
||||||
For negative x, digit(x,n,b) is given by digit(abs(x),n,b); the
|
For negative x, digit(x,n,b) is given by digit(abs(x),n,b); the
|
||||||
standard "decimal" representation of this x is a - sign followed by
|
standard "decimal" representation of this x is a - sign followed by
|
||||||
the representation of abs(x).
|
the representation of abs(x).
|
||||||
@@ -71,7 +71,7 @@ EXAMPLE
|
|||||||
0 0 0 0 12 34 56 78 90 0 0 0 0
|
0 0 0 0 12 34 56 78 90 0 0 0 0
|
||||||
|
|
||||||
> for (n = 6; n >= -6; n--) print digit(a, n, 256),; print
|
> for (n = 6; n >= -6; n--) print digit(a, n, 256),; print
|
||||||
0 0 0 0 1 226 64 201 251 231 108 139 67
|
0 0 0 0 1 226 64 201 251 231 108 139 67
|
||||||
|
|
||||||
> for (n = 1; n >= -12; n++) print digit(10/7, n),; print
|
> for (n = 1; n >= -12; n++) print digit(10/7, n),; print
|
||||||
> 0 1 4 2 8 5 7 1 4 2 8 5 7 1
|
> 0 1 4 2 8 5 7 1 4 2 8 5 7 1
|
||||||
@@ -108,8 +108,8 @@ SEE ALSO
|
|||||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||||
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||||
##
|
##
|
||||||
## @(#) $Revision: 29.3 $
|
## @(#) $Revision: 29.4 $
|
||||||
## @(#) $Id: digit,v 29.3 2000/12/14 10:32:24 chongo Exp $
|
## @(#) $Id: digit,v 29.4 2000/12/17 12:27:58 chongo Exp $
|
||||||
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/digit,v $
|
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/digit,v $
|
||||||
##
|
##
|
||||||
## Under source code control: 1995/10/03 10:40:01
|
## Under source code control: 1995/10/03 10:40:01
|
||||||
|
@@ -29,7 +29,7 @@ EXAMPLE
|
|||||||
1 0 -1 0 5 0 -61
|
1 0 -1 0 5 0 -61
|
||||||
|
|
||||||
LIMITS
|
LIMITS
|
||||||
none
|
none
|
||||||
|
|
||||||
LINK LIBRARY
|
LINK LIBRARY
|
||||||
NUMBER *qeuler(long n)
|
NUMBER *qeuler(long n)
|
||||||
@@ -53,8 +53,8 @@ SEE ALSO
|
|||||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||||
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||||
##
|
##
|
||||||
## @(#) $Revision: 29.1 $
|
## @(#) $Revision: 29.2 $
|
||||||
## @(#) $Id: euler,v 29.1 2000/12/14 10:31:45 chongo Exp $
|
## @(#) $Id: euler,v 29.2 2000/12/17 12:27:58 chongo Exp $
|
||||||
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/euler,v $
|
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/euler,v $
|
||||||
##
|
##
|
||||||
## Under source code control: 2000/12/14 01:33:00
|
## Under source code control: 2000/12/14 01:33:00
|
||||||
|
@@ -19,7 +19,7 @@ DESCRIPTION
|
|||||||
places(x,b) = n > 0 if and only if the fractional part of abs(x)
|
places(x,b) = n > 0 if and only if the fractional part of abs(x)
|
||||||
has a finite base-b "decimal" representation with n digits of which
|
has a finite base-b "decimal" representation with n digits of which
|
||||||
the last digit is nonzero. This occurs if and only if every prime
|
the last digit is nonzero. This occurs if and only if every prime
|
||||||
factor of den(x) is a factor of b.
|
factor of den(x) is a factor of b.
|
||||||
|
|
||||||
EXAMPLE
|
EXAMPLE
|
||||||
> print places(3), places(0.0123), places(3.70), places(1e-10), places(3/7)
|
> print places(3), places(0.0123), places(3.70), places(1e-10), places(3/7)
|
||||||
@@ -53,8 +53,8 @@ SEE ALSO
|
|||||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||||
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||||
##
|
##
|
||||||
## @(#) $Revision: 29.3 $
|
## @(#) $Revision: 29.4 $
|
||||||
## @(#) $Id: places,v 29.3 2000/12/14 10:32:24 chongo Exp $
|
## @(#) $Id: places,v 29.4 2000/12/17 12:27:58 chongo Exp $
|
||||||
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/places,v $
|
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/places,v $
|
||||||
##
|
##
|
||||||
## Under source code control: 1995/10/03 10:40:02
|
## Under source code control: 1995/10/03 10:40:02
|
||||||
|
@@ -25,7 +25,7 @@ DESCRIPTION
|
|||||||
|
|
||||||
The following illustrates what happens if ctrl-C is hit 5 seconds
|
The following illustrates what happens if ctrl-C is hit 5 seconds
|
||||||
after the first command:
|
after the first command:
|
||||||
|
|
||||||
> print sleep(20)
|
> print sleep(20)
|
||||||
|
|
||||||
[Abort level 1]
|
[Abort level 1]
|
||||||
@@ -58,8 +58,8 @@ SEE ALSO
|
|||||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||||
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||||
##
|
##
|
||||||
## @(#) $Revision: 29.1 $
|
## @(#) $Revision: 29.2 $
|
||||||
## @(#) $Id: sleep,v 29.1 2000/12/14 10:31:45 chongo Exp $
|
## @(#) $Id: sleep,v 29.2 2000/12/17 12:27:58 chongo Exp $
|
||||||
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/sleep,v $
|
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/sleep,v $
|
||||||
##
|
##
|
||||||
## Under source code control: 2000/12/14 01:33:00
|
## Under source code control: 2000/12/14 01:33:00
|
||||||
|
13
input.c
13
input.c
@@ -17,8 +17,8 @@
|
|||||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*
|
*
|
||||||
* @(#) $Revision: 29.3 $
|
* @(#) $Revision: 29.4 $
|
||||||
* @(#) $Id: input.c,v 29.3 2000/07/17 15:35:49 chongo Exp $
|
* @(#) $Id: input.c,v 29.4 2001/02/25 22:07:36 chongo Exp $
|
||||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/input.c,v $
|
* @(#) $Source: /usr/local/src/cmd/calc/RCS/input.c,v $
|
||||||
*
|
*
|
||||||
* Under source code control: 1990/02/15 01:48:16
|
* Under source code control: 1990/02/15 01:48:16
|
||||||
@@ -35,7 +35,9 @@
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
#if !defined(_WIN32)
|
||||||
#include <pwd.h>
|
#include <pwd.h>
|
||||||
|
#endif /* Windoz free systems */
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
@@ -257,6 +259,12 @@ opensearchfile(char *name, char *pathlist, char *extension, int rd_once)
|
|||||||
static char *
|
static char *
|
||||||
homeexpand(char *name)
|
homeexpand(char *name)
|
||||||
{
|
{
|
||||||
|
#if defined (_WIN32)
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
#else /* Windoz free systems */
|
||||||
|
|
||||||
struct passwd *ent; /* password entry */
|
struct passwd *ent; /* password entry */
|
||||||
char *home2; /* fullpath of the home directory */
|
char *home2; /* fullpath of the home directory */
|
||||||
char *fullpath; /* the malloced expanded path */
|
char *fullpath; /* the malloced expanded path */
|
||||||
@@ -323,6 +331,7 @@ homeexpand(char *name)
|
|||||||
}
|
}
|
||||||
sprintf(fullpath, "%s%s", home2, after);
|
sprintf(fullpath, "%s%s", home2, after);
|
||||||
return fullpath;
|
return fullpath;
|
||||||
|
#endif /* Windoz free systems */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
22
lib_calc.c
22
lib_calc.c
@@ -17,8 +17,8 @@
|
|||||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*
|
*
|
||||||
* @(#) $Revision: 29.4 $
|
* @(#) $Revision: 29.5 $
|
||||||
* @(#) $Id: lib_calc.c,v 29.4 2000/07/17 15:35:49 chongo Exp $
|
* @(#) $Id: lib_calc.c,v 29.5 2001/02/25 22:07:36 chongo Exp $
|
||||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/lib_calc.c,v $
|
* @(#) $Source: /usr/local/src/cmd/calc/RCS/lib_calc.c,v $
|
||||||
*
|
*
|
||||||
* Under source code control: 1996/06/17 18:06:19
|
* Under source code control: 1996/06/17 18:06:19
|
||||||
@@ -68,11 +68,16 @@ typedef struct termios ttystruct;
|
|||||||
# include <termio.h>
|
# include <termio.h>
|
||||||
typedef struct termio ttystruct;
|
typedef struct termio ttystruct;
|
||||||
|
|
||||||
#else /* assume USE_SGTTY */
|
#elif defined(USE_SGTTY)
|
||||||
|
|
||||||
# include <sys/ioctl.h>
|
# include <sys/ioctl.h>
|
||||||
typedef struct sgttyb ttystruct;
|
typedef struct sgttyb ttystruct;
|
||||||
|
|
||||||
|
#elif !defined(_WIN32)
|
||||||
|
|
||||||
|
-=*#*=- A Windoz free system without termio, termios or sgtty!!! -=*#*=-
|
||||||
|
-=*#*=- We do not know how to compile for such a host, sorry!!!! -=*#*=-
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -192,7 +197,9 @@ libcalc_call_me_first(void)
|
|||||||
* Disable SIGPIPE so that the pipe to the help file pager will
|
* Disable SIGPIPE so that the pipe to the help file pager will
|
||||||
* not stop calc.
|
* not stop calc.
|
||||||
*/
|
*/
|
||||||
|
#if !defined(_WIN32)
|
||||||
(void) signal(SIGPIPE, SIG_IGN);
|
(void) signal(SIGPIPE, SIG_IGN);
|
||||||
|
#endif /* Windoz free systems */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* determine the basename
|
* determine the basename
|
||||||
@@ -373,7 +380,9 @@ cvmalloc_error(char *message)
|
|||||||
static void
|
static void
|
||||||
initenv(void)
|
initenv(void)
|
||||||
{
|
{
|
||||||
|
#if !defined(_WIN32)
|
||||||
struct passwd *ent; /* our password entry */
|
struct passwd *ent; /* our password entry */
|
||||||
|
#endif /* Windoz free systems */
|
||||||
char *c;
|
char *c;
|
||||||
|
|
||||||
/* determine the $CALCPATH value */
|
/* determine the $CALCPATH value */
|
||||||
@@ -402,6 +411,12 @@ initenv(void)
|
|||||||
/* determine the $HOME value */
|
/* determine the $HOME value */
|
||||||
c = (no_env ? NULL : getenv(HOME));
|
c = (no_env ? NULL : getenv(HOME));
|
||||||
home = (c ? strdup(c) : NULL);
|
home = (c ? strdup(c) : NULL);
|
||||||
|
#if defined(_WIN32)
|
||||||
|
if (home == NULL || home[0] == '\0') {
|
||||||
|
/* just assume . is home if all else fails */
|
||||||
|
home = ".";
|
||||||
|
}
|
||||||
|
#else /* Windoz free systems */
|
||||||
if (home == NULL || home[0] == '\0') {
|
if (home == NULL || home[0] == '\0') {
|
||||||
ent = (struct passwd *)getpwuid(geteuid());
|
ent = (struct passwd *)getpwuid(geteuid());
|
||||||
if (ent == NULL) {
|
if (ent == NULL) {
|
||||||
@@ -411,6 +426,7 @@ initenv(void)
|
|||||||
home = (char *)malloc(strlen(ent->pw_dir)+1);
|
home = (char *)malloc(strlen(ent->pw_dir)+1);
|
||||||
strcpy(home, ent->pw_dir);
|
strcpy(home, ent->pw_dir);
|
||||||
}
|
}
|
||||||
|
#endif /* Windoz free systems */
|
||||||
|
|
||||||
/* determine the $PAGER value */
|
/* determine the $PAGER value */
|
||||||
c = (no_env ? NULL : getenv(PAGER));
|
c = (no_env ? NULL : getenv(PAGER));
|
||||||
|
10
longlong.c
10
longlong.c
@@ -17,8 +17,8 @@
|
|||||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*
|
*
|
||||||
* @(#) $Revision: 29.2 $
|
* @(#) $Revision: 29.3 $
|
||||||
* @(#) $Id: longlong.c,v 29.2 2000/06/07 14:02:13 chongo Exp $
|
* @(#) $Id: longlong.c,v 29.3 2001/02/23 20:46:38 chongo Exp $
|
||||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/longlong.c,v $
|
* @(#) $Source: /usr/local/src/cmd/calc/RCS/longlong.c,v $
|
||||||
*
|
*
|
||||||
* Under source code control: 1994/08/05 01:09:19
|
* Under source code control: 1994/08/05 01:09:19
|
||||||
@@ -119,10 +119,10 @@ main(int argc, char **argv)
|
|||||||
printf(" * if defined(L64_FORMAT), ok to use %%ld\n");
|
printf(" * if defined(L64_FORMAT), ok to use %%ld\n");
|
||||||
printf(" * if !defined(L64_FORMAT), use %%lld\n");
|
printf(" * if !defined(L64_FORMAT), use %%lld\n");
|
||||||
printf(" */\n");
|
printf(" */\n");
|
||||||
if (buf[0] == '-') {
|
if (strcmp(buf, "1311768467284833366") == 0) {
|
||||||
printf("#undef L64_FORMAT\n");
|
|
||||||
} else {
|
|
||||||
printf("#define L64_FORMAT\n");
|
printf("#define L64_FORMAT\n");
|
||||||
|
} else {
|
||||||
|
printf("#undef L64_FORMAT\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
18
opcodes.h
18
opcodes.h
@@ -17,8 +17,8 @@
|
|||||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*
|
*
|
||||||
* @(#) $Revision: 29.2 $
|
* @(#) $Revision: 29.3 $
|
||||||
* @(#) $Id: opcodes.h,v 29.2 2000/06/07 14:02:13 chongo Exp $
|
* @(#) $Id: opcodes.h,v 29.3 2001/02/25 22:07:36 chongo Exp $
|
||||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/opcodes.h,v $
|
* @(#) $Source: /usr/local/src/cmd/calc/RCS/opcodes.h,v $
|
||||||
*
|
*
|
||||||
* Under source code control: 1990/02/15 01:48:35
|
* Under source code control: 1990/02/15 01:48:35
|
||||||
@@ -32,6 +32,20 @@
|
|||||||
#define __OPCODES_H__
|
#define __OPCODES_H__
|
||||||
|
|
||||||
|
|
||||||
|
#if defined (_WIN32)
|
||||||
|
#ifdef _EXPORTING
|
||||||
|
#define DLL __declspec(dllexport)
|
||||||
|
#else
|
||||||
|
#define DLL __declspec(dllimport)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#else /* Windoz free systems */
|
||||||
|
|
||||||
|
#define DLL
|
||||||
|
|
||||||
|
#endif /* Windoz free systems */
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Opcodes
|
* Opcodes
|
||||||
*/
|
*/
|
||||||
|
34
qfunc.c
34
qfunc.c
@@ -19,8 +19,8 @@
|
|||||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*
|
*
|
||||||
* @(#) $Revision: 29.3 $
|
* @(#) $Revision: 29.4 $
|
||||||
* @(#) $Id: qfunc.c,v 29.3 2000/07/17 15:35:49 chongo Exp $
|
* @(#) $Id: qfunc.c,v 29.4 2000/12/17 13:07:32 chongo Exp $
|
||||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/qfunc.c,v $
|
* @(#) $Source: /usr/local/src/cmd/calc/RCS/qfunc.c,v $
|
||||||
*
|
*
|
||||||
* Under source code control: 1990/02/15 01:48:20
|
* Under source code control: 1990/02/15 01:48:20
|
||||||
@@ -976,6 +976,7 @@ qbern(ZVALUE z)
|
|||||||
long n, i, k, m, nn, dd;
|
long n, i, k, m, nn, dd;
|
||||||
NUMBER **p;
|
NUMBER **p;
|
||||||
NUMBER *s, *s1, *c, *c1, *t;
|
NUMBER *s, *s1, *c, *c1, *t;
|
||||||
|
size_t sz;
|
||||||
|
|
||||||
if (zisone(z))
|
if (zisone(z))
|
||||||
return qlink(&_qneghalf_);
|
return qlink(&_qneghalf_);
|
||||||
@@ -999,15 +1000,15 @@ qbern(ZVALUE z)
|
|||||||
|
|
||||||
if (m >= B_allocnum) {
|
if (m >= B_allocnum) {
|
||||||
k = (m/QALLOCNUM + 1) * QALLOCNUM;
|
k = (m/QALLOCNUM + 1) * QALLOCNUM;
|
||||||
|
sz = k * sizeof(NUMBER *);
|
||||||
|
if (sz < (size_t) k)
|
||||||
|
return NULL;
|
||||||
if (B_allocnum == 0)
|
if (B_allocnum == 0)
|
||||||
p = (NUMBER **) malloc(k * sizeof(NUMBER *));
|
p = (NUMBER **) malloc(sz);
|
||||||
else
|
else
|
||||||
p = (NUMBER **) realloc(B_table,
|
p = (NUMBER **) realloc(B_table, sz);
|
||||||
k * sizeof(NUMBER *));
|
if (p == NULL)
|
||||||
if (p == NULL) {
|
return NULL;
|
||||||
math_error("Not enough memory for Bernoulli numbers");
|
|
||||||
/*NOTREACHED*/
|
|
||||||
}
|
|
||||||
B_allocnum = k;
|
B_allocnum = k;
|
||||||
B_table = p;
|
B_table = p;
|
||||||
}
|
}
|
||||||
@@ -1069,6 +1070,7 @@ qeuler(ZVALUE z)
|
|||||||
long i, k, m, n, nn, dd;
|
long i, k, m, n, nn, dd;
|
||||||
NUMBER **p;
|
NUMBER **p;
|
||||||
NUMBER *s, *s1, *c, *c1, *t;
|
NUMBER *s, *s1, *c, *c1, *t;
|
||||||
|
size_t sz;
|
||||||
|
|
||||||
|
|
||||||
if (ziszero(z))
|
if (ziszero(z))
|
||||||
@@ -1081,11 +1083,15 @@ qeuler(ZVALUE z)
|
|||||||
m = (n >> 1) - 1;
|
m = (n >> 1) - 1;
|
||||||
if (m < E_num)
|
if (m < E_num)
|
||||||
return qlink(E_table[m]);
|
return qlink(E_table[m]);
|
||||||
p = (NUMBER **) realloc(E_table, (m + 1) * sizeof(NUMBER *));
|
sz = (m + 1) * sizeof(NUMBER *);
|
||||||
if (p == NULL) {
|
if (sz < (size_t) m + 1)
|
||||||
math_error("Unable to allocate memory for Euler numbers");
|
return NULL;
|
||||||
/*NOTREACHED*/
|
if (E_num)
|
||||||
}
|
p = (NUMBER **) realloc(E_table, sz);
|
||||||
|
else
|
||||||
|
p = (NUMBER **) malloc(sz);
|
||||||
|
if (p == NULL)
|
||||||
|
return NULL;
|
||||||
E_table = p;
|
E_table = p;
|
||||||
for (k = E_num; k <= m; k++) {
|
for (k = E_num; k <= m; k++) {
|
||||||
nn = 2 * k + 2;
|
nn = 2 * k + 2;
|
||||||
|
@@ -17,8 +17,8 @@
|
|||||||
# received a copy with calc; if not, write to Free Software Foundation, Inc.
|
# received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||||
# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#
|
#
|
||||||
# @(#) $Revision: 29.2 $
|
# @(#) $Revision: 29.3 $
|
||||||
# @(#) $Id: Makefile,v 29.2 2000/06/07 14:02:54 chongo Exp $
|
# @(#) $Id: Makefile,v 29.3 2000/12/17 12:28:31 chongo Exp $
|
||||||
# @(#) $Source: /usr/local/src/cmd/calc/sample/RCS/Makefile,v $
|
# @(#) $Source: /usr/local/src/cmd/calc/sample/RCS/Makefile,v $
|
||||||
#
|
#
|
||||||
# Under source code control: 1997/04/19 22:46:49
|
# Under source code control: 1997/04/19 22:46:49
|
||||||
@@ -378,7 +378,10 @@ depend:
|
|||||||
fi; \
|
fi; \
|
||||||
done
|
done
|
||||||
${Q}(cd ..; ${MAKE} hsrc)
|
${Q}(cd ..; ${MAKE} hsrc)
|
||||||
${Q}for i in `cd ..; ${MAKE} h_list`; do \
|
${Q}for i in `cd ..; ${MAKE} h_list 2>&1 | \
|
||||||
|
${SED} -e '/Entering directory/d' \
|
||||||
|
-e '/Nothing to be done/d' \
|
||||||
|
-e '/Leaving directory/d'`; do \
|
||||||
tag="`echo $$i | ${SED} 's/[\.+,:]/_/g'`"; \
|
tag="`echo $$i | ${SED} 's/[\.+,:]/_/g'`"; \
|
||||||
echo "#if !defined($$tag)" > "skel/$$i"; \
|
echo "#if !defined($$tag)" > "skel/$$i"; \
|
||||||
echo "#define $$tag" >> "skel/$$i"; \
|
echo "#define $$tag" >> "skel/$$i"; \
|
||||||
|
73
seed.c
73
seed.c
@@ -17,8 +17,8 @@
|
|||||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*
|
*
|
||||||
* @(#) $Revision: 29.2 $
|
* @(#) $Revision: 29.3 $
|
||||||
* @(#) $Id: seed.c,v 29.2 2000/06/07 14:02:13 chongo Exp $
|
* @(#) $Id: seed.c,v 29.3 2001/02/25 22:07:36 chongo Exp $
|
||||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/seed.c,v $
|
* @(#) $Source: /usr/local/src/cmd/calc/RCS/seed.c,v $
|
||||||
*
|
*
|
||||||
* Under source code control: 1999/10/03 10:06:53
|
* Under source code control: 1999/10/03 10:06:53
|
||||||
@@ -40,7 +40,16 @@
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
|
#include "have_unistd.h"
|
||||||
|
#if defined(HAVE_UNISTD_H)
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(_WIN32)
|
||||||
|
#include <process.h>
|
||||||
|
#define pid_t int
|
||||||
|
#endif /* Windoz */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* PORTING NOTE:
|
* PORTING NOTE:
|
||||||
@@ -55,10 +64,19 @@
|
|||||||
*/
|
*/
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
#include "have_times.h"
|
||||||
|
#if defined(HAVE_TIME_H)
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
#endif
|
||||||
|
#if defined(HAVE_SYS_TIME_H)
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
#endif
|
||||||
|
#if defined(HAVE_SYS_TIMES_H)
|
||||||
#include <sys/times.h>
|
#include <sys/times.h>
|
||||||
|
#endif
|
||||||
|
#if !defined(_WIN32)
|
||||||
#include <sys/resource.h>
|
#include <sys/resource.h>
|
||||||
|
#endif /* Windoz free systems */
|
||||||
#include <setjmp.h>
|
#include <setjmp.h>
|
||||||
#include "qmath.h"
|
#include "qmath.h"
|
||||||
#include "longbits.h"
|
#include "longbits.h"
|
||||||
@@ -69,14 +87,15 @@
|
|||||||
#include "have_getprid.h"
|
#include "have_getprid.h"
|
||||||
#include "have_urandom.h"
|
#include "have_urandom.h"
|
||||||
#include "have_rusage.h"
|
#include "have_rusage.h"
|
||||||
|
#include "have_uid_t.h"
|
||||||
#if defined(HAVE_USTAT)
|
#if defined(HAVE_USTAT)
|
||||||
# include <ustat.h>
|
# include <ustat.h>
|
||||||
#endif /* HAVE_USTAT */
|
#endif
|
||||||
#if defined(HAVE_URANDOM)
|
#if defined(HAVE_URANDOM)
|
||||||
# include <fcntl.h>
|
# include <fcntl.h>
|
||||||
# define DEV_URANDOM "/dev/urandom"
|
# define DEV_URANDOM "/dev/urandom"
|
||||||
# define DEV_URANDOM_POOL 16
|
# define DEV_URANDOM_POOL 16
|
||||||
#endif /* HAVE_URANDOM */
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -272,26 +291,30 @@ pseudo_seed(void)
|
|||||||
#if defined(HAVE_GETTIME)
|
#if defined(HAVE_GETTIME)
|
||||||
# if defined(CLOCK_SGI_CYCLE)
|
# if defined(CLOCK_SGI_CYCLE)
|
||||||
struct timespec sgi_cycle; /* SGI hardware clock */
|
struct timespec sgi_cycle; /* SGI hardware clock */
|
||||||
# endif /* CLOCK_SGI_CYCLE */
|
# endif
|
||||||
# if defined(CLOCK_REALTIME)
|
# if defined(CLOCK_REALTIME)
|
||||||
struct timespec realtime; /* POSIX realtime clock */
|
struct timespec realtime; /* POSIX realtime clock */
|
||||||
# endif /* CLOCK_REALTIME */
|
# endif
|
||||||
#endif /* HAVE_GETTIME */
|
#endif
|
||||||
#if defined(HAVE_GETPRID)
|
#if defined(HAVE_GETPRID)
|
||||||
prid_t getprid; /* project ID */
|
prid_t getprid; /* project ID */
|
||||||
#endif /* HAVE_GETPRID */
|
#endif
|
||||||
#if defined(HAVE_URANDOM)
|
#if defined(HAVE_URANDOM)
|
||||||
int urandom_fd; /* open descriptor for /dev/urandom */
|
int urandom_fd; /* open descriptor for /dev/urandom */
|
||||||
int urandom_ret; /* read() of /dev/random */
|
int urandom_ret; /* read() of /dev/random */
|
||||||
char urandom_pool[DEV_URANDOM_POOL]; /* /dev/urandom data pool */
|
char urandom_pool[DEV_URANDOM_POOL]; /* /dev/urandom data pool */
|
||||||
#endif /* HAVE_URANDOM */
|
#endif
|
||||||
|
#if defined(HAVE_SYS_TIME_H)
|
||||||
struct timeval tp; /* time of day */
|
struct timeval tp; /* time of day */
|
||||||
|
#endif
|
||||||
pid_t getpid; /* process ID */
|
pid_t getpid; /* process ID */
|
||||||
pid_t getppid; /* parent process ID */
|
pid_t getppid; /* parent process ID */
|
||||||
|
#if defined(HAVE_UID_T)
|
||||||
uid_t getuid; /* real user ID */
|
uid_t getuid; /* real user ID */
|
||||||
uid_t geteuid; /* effective user ID */
|
uid_t geteuid; /* effective user ID */
|
||||||
gid_t getgid; /* real group ID */
|
gid_t getgid; /* real group ID */
|
||||||
gid_t getegid; /* effective group ID */
|
gid_t getegid; /* effective group ID */
|
||||||
|
#endif
|
||||||
struct stat stat_dot; /* stat of "." */
|
struct stat stat_dot; /* stat of "." */
|
||||||
struct stat stat_dotdot; /* stat of ".." */
|
struct stat stat_dotdot; /* stat of ".." */
|
||||||
struct stat stat_tmp; /* stat of "/tmp" */
|
struct stat stat_tmp; /* stat of "/tmp" */
|
||||||
@@ -307,19 +330,21 @@ pseudo_seed(void)
|
|||||||
struct ustat ustat_stdin; /* usage stat of stdin */
|
struct ustat ustat_stdin; /* usage stat of stdin */
|
||||||
struct ustat ustat_stdout; /* usage stat of stdout */
|
struct ustat ustat_stdout; /* usage stat of stdout */
|
||||||
struct ustat ustat_stderr; /* usage stat of stderr */
|
struct ustat ustat_stderr; /* usage stat of stderr */
|
||||||
#endif /* HAVE_USTAT */
|
#endif
|
||||||
#if defined(HAVE_GETSID)
|
#if defined(HAVE_GETSID)
|
||||||
pid_t getsid; /* session ID */
|
pid_t getsid; /* session ID */
|
||||||
#endif /* HAVE_GETSID */
|
#endif
|
||||||
#if defined(HAVE_GETPGID)
|
#if defined(HAVE_GETPGID)
|
||||||
pid_t getpgid; /* process group ID */
|
pid_t getpgid; /* process group ID */
|
||||||
#endif /* HAVE_GETPGID */
|
#endif
|
||||||
#if defined(HAVE_GETRUSAGE)
|
#if defined(HAVE_GETRUSAGE)
|
||||||
struct rusage rusage; /* resource utilization */
|
struct rusage rusage; /* resource utilization */
|
||||||
struct rusage rusage_chld; /* resource utilization of children */
|
struct rusage rusage_chld; /* resource utilization of children */
|
||||||
#endif /* HAVE_GETRUSAGE */
|
#endif
|
||||||
|
#if defined(HAVE_SYS_TIME_H)
|
||||||
struct timeval tp2; /* time of day again */
|
struct timeval tp2; /* time of day again */
|
||||||
struct tms times; /* process times */
|
struct tms times; /* process times */
|
||||||
|
#endif
|
||||||
time_t time; /* local time */
|
time_t time; /* local time */
|
||||||
size_t size; /* size of this data structure */
|
size_t size; /* size of this data structure */
|
||||||
jmp_buf env; /* setjmp() context */
|
jmp_buf env; /* setjmp() context */
|
||||||
@@ -339,14 +364,14 @@ pseudo_seed(void)
|
|||||||
#if defined(HAVE_GETTIME)
|
#if defined(HAVE_GETTIME)
|
||||||
# if defined(CLOCK_SGI_CYCLE)
|
# if defined(CLOCK_SGI_CYCLE)
|
||||||
(void) clock_gettime(CLOCK_SGI_CYCLE, &sdata.sgi_cycle);
|
(void) clock_gettime(CLOCK_SGI_CYCLE, &sdata.sgi_cycle);
|
||||||
# endif /* CLOCK_SGI_CYCLE */
|
# endif
|
||||||
# if defined(CLOCK_REALTIME)
|
# if defined(CLOCK_REALTIME)
|
||||||
(void) clock_gettime(CLOCK_REALTIME, &sdata.realtime);
|
(void) clock_gettime(CLOCK_REALTIME, &sdata.realtime);
|
||||||
# endif /* CLOCK_REALTIME */
|
# endif
|
||||||
#endif /* HAVE_GETTIME */
|
#endif
|
||||||
#if defined(HAVE_GETPRID)
|
#if defined(HAVE_GETPRID)
|
||||||
sdata.getprid = getprid();
|
sdata.getprid = getprid();
|
||||||
#endif /* HAVE_GETPRID */
|
#endif
|
||||||
#if defined(HAVE_URANDOM)
|
#if defined(HAVE_URANDOM)
|
||||||
sdata.urandom_fd = open(DEV_URANDOM, O_NONBLOCK|O_RDONLY);
|
sdata.urandom_fd = open(DEV_URANDOM, O_NONBLOCK|O_RDONLY);
|
||||||
if (sdata.urandom_fd >= 0) {
|
if (sdata.urandom_fd >= 0) {
|
||||||
@@ -358,13 +383,17 @@ pseudo_seed(void)
|
|||||||
sdata.urandom_ret = EOF;
|
sdata.urandom_ret = EOF;
|
||||||
}
|
}
|
||||||
#endif /* HAVE_URANDOM */
|
#endif /* HAVE_URANDOM */
|
||||||
|
#if defined(HAVE_SYS_TIME_H)
|
||||||
(void) gettimeofday(&sdata.tp, NULL);
|
(void) gettimeofday(&sdata.tp, NULL);
|
||||||
|
#endif
|
||||||
sdata.getpid = getpid();
|
sdata.getpid = getpid();
|
||||||
sdata.getppid = getppid();
|
sdata.getppid = getppid();
|
||||||
|
#if defined(HAVE_UID_T)
|
||||||
sdata.getuid = getuid();
|
sdata.getuid = getuid();
|
||||||
sdata.geteuid = geteuid();
|
sdata.geteuid = geteuid();
|
||||||
sdata.getgid = getgid();
|
sdata.getgid = getgid();
|
||||||
sdata.getegid = getegid();
|
sdata.getegid = getegid();
|
||||||
|
#endif
|
||||||
(void) stat(".", &sdata.stat_dot);
|
(void) stat(".", &sdata.stat_dot);
|
||||||
(void) stat("..", &sdata.stat_dotdot);
|
(void) stat("..", &sdata.stat_dotdot);
|
||||||
(void) stat("/tmp", &sdata.stat_tmp);
|
(void) stat("/tmp", &sdata.stat_tmp);
|
||||||
@@ -380,19 +409,21 @@ pseudo_seed(void)
|
|||||||
(void) ustat(sdata.fstat_stdin.st_dev, &sdata.ustat_stdin);
|
(void) ustat(sdata.fstat_stdin.st_dev, &sdata.ustat_stdin);
|
||||||
(void) ustat(sdata.fstat_stdout.st_dev, &sdata.ustat_stdout);
|
(void) ustat(sdata.fstat_stdout.st_dev, &sdata.ustat_stdout);
|
||||||
(void) ustat(sdata.fstat_stderr.st_dev, &sdata.ustat_stderr);
|
(void) ustat(sdata.fstat_stderr.st_dev, &sdata.ustat_stderr);
|
||||||
#endif /* HAVE_USTAT */
|
#endif
|
||||||
#if defined(HAVE_GETSID)
|
#if defined(HAVE_GETSID)
|
||||||
sdata.getsid = getsid((pid_t)0);
|
sdata.getsid = getsid((pid_t)0);
|
||||||
#endif /* HAVE_GETSID */
|
#endif
|
||||||
#if defined(HAVE_GETPGID)
|
#if defined(HAVE_GETPGID)
|
||||||
sdata.getpgid = getpgid((pid_t)0);
|
sdata.getpgid = getpgid((pid_t)0);
|
||||||
#endif /* HAVE_GETPGID */
|
#endif
|
||||||
#if defined(HAVE_GETRUSAGE)
|
#if defined(HAVE_GETRUSAGE)
|
||||||
(void) getrusage(RUSAGE_SELF, &sdata.rusage);
|
(void) getrusage(RUSAGE_SELF, &sdata.rusage);
|
||||||
(void) getrusage(RUSAGE_CHILDREN, &sdata.rusage_chld);
|
(void) getrusage(RUSAGE_CHILDREN, &sdata.rusage_chld);
|
||||||
#endif /* HAVE_GETRUSAGE */
|
#endif
|
||||||
|
#if defined(HAVE_SYS_TIME_H)
|
||||||
(void) gettimeofday(&sdata.tp2, NULL);
|
(void) gettimeofday(&sdata.tp2, NULL);
|
||||||
(void) times(&sdata.times);
|
(void) times(&sdata.times);
|
||||||
|
#endif
|
||||||
sdata.time = time(NULL);
|
sdata.time = time(NULL);
|
||||||
sdata.size = sizeof(sdata);
|
sdata.size = sizeof(sdata);
|
||||||
(void) setjmp(sdata.env);
|
(void) setjmp(sdata.env);
|
||||||
|
354
value.h
354
value.h
@@ -17,8 +17,8 @@
|
|||||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*
|
*
|
||||||
* @(#) $Revision: 29.3 $
|
* @(#) $Revision: 29.4 $
|
||||||
* @(#) $Id: value.h,v 29.3 2000/07/17 15:35:49 chongo Exp $
|
* @(#) $Id: value.h,v 29.4 2001/02/25 22:07:36 chongo Exp $
|
||||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/value.h,v $
|
* @(#) $Source: /usr/local/src/cmd/calc/RCS/value.h,v $
|
||||||
*
|
*
|
||||||
* Under source code control: 1993/07/30 19:42:47
|
* Under source code control: 1993/07/30 19:42:47
|
||||||
@@ -32,6 +32,20 @@
|
|||||||
#define __VALUE_H__
|
#define __VALUE_H__
|
||||||
|
|
||||||
|
|
||||||
|
#if defined (_WIN32)
|
||||||
|
#ifdef _EXPORTING
|
||||||
|
#define DLL __declspec(dllexport)
|
||||||
|
#else
|
||||||
|
#define DLL __declspec(dllimport)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#else /* Windoz free systems */
|
||||||
|
|
||||||
|
#define DLL
|
||||||
|
|
||||||
|
#endif /* Windoz free systems */
|
||||||
|
|
||||||
|
|
||||||
#include "cmath.h"
|
#include "cmath.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "shs.h"
|
#include "shs.h"
|
||||||
@@ -187,59 +201,59 @@ struct value {
|
|||||||
/*
|
/*
|
||||||
* value functions
|
* value functions
|
||||||
*/
|
*/
|
||||||
extern void freevalue(VALUE *vp);
|
DLL extern void freevalue(VALUE *vp);
|
||||||
extern void copyvalue(VALUE *vp, VALUE *vres);
|
DLL extern void copyvalue(VALUE *vp, VALUE *vres);
|
||||||
extern void negvalue(VALUE *vp, VALUE *vres);
|
DLL extern void negvalue(VALUE *vp, VALUE *vres);
|
||||||
extern void addvalue(VALUE *v1, VALUE *v2, VALUE *vres);
|
DLL extern void addvalue(VALUE *v1, VALUE *v2, VALUE *vres);
|
||||||
extern void subvalue(VALUE *v1, VALUE *v2, VALUE *vres);
|
DLL extern void subvalue(VALUE *v1, VALUE *v2, VALUE *vres);
|
||||||
extern void mulvalue(VALUE *v1, VALUE *v2, VALUE *vres);
|
DLL extern void mulvalue(VALUE *v1, VALUE *v2, VALUE *vres);
|
||||||
extern void orvalue(VALUE *v1, VALUE *v2, VALUE *vres);
|
DLL extern void orvalue(VALUE *v1, VALUE *v2, VALUE *vres);
|
||||||
extern void andvalue(VALUE *v1, VALUE *v2, VALUE *vres);
|
DLL extern void andvalue(VALUE *v1, VALUE *v2, VALUE *vres);
|
||||||
extern void compvalue(VALUE *vp, VALUE *vres);
|
DLL extern void compvalue(VALUE *vp, VALUE *vres);
|
||||||
extern void xorvalue(VALUE *v1, VALUE *v2, VALUE *vres);
|
DLL extern void xorvalue(VALUE *v1, VALUE *v2, VALUE *vres);
|
||||||
extern void squarevalue(VALUE *vp, VALUE *vres);
|
DLL extern void squarevalue(VALUE *vp, VALUE *vres);
|
||||||
extern void invertvalue(VALUE *vp, VALUE *vres);
|
DLL extern void invertvalue(VALUE *vp, VALUE *vres);
|
||||||
extern void roundvalue(VALUE *v1, VALUE *v2, VALUE *v3, VALUE *vres);
|
DLL extern void roundvalue(VALUE *v1, VALUE *v2, VALUE *v3, VALUE *vres);
|
||||||
extern void broundvalue(VALUE *v1, VALUE *v2, VALUE *v3, VALUE *vres);
|
DLL extern void broundvalue(VALUE *v1, VALUE *v2, VALUE *v3, VALUE *vres);
|
||||||
extern void setminusvalue(VALUE *, VALUE *, VALUE *);
|
DLL extern void setminusvalue(VALUE *, VALUE *, VALUE *);
|
||||||
extern void backslashvalue(VALUE *, VALUE *);
|
DLL extern void backslashvalue(VALUE *, VALUE *);
|
||||||
extern void contentvalue(VALUE *, VALUE *);
|
DLL extern void contentvalue(VALUE *, VALUE *);
|
||||||
extern void hashopvalue(VALUE *, VALUE *, VALUE *);
|
DLL extern void hashopvalue(VALUE *, VALUE *, VALUE *);
|
||||||
extern void apprvalue(VALUE *v1, VALUE *v2, VALUE *v3, VALUE *vres);
|
DLL extern void apprvalue(VALUE *v1, VALUE *v2, VALUE *v3, VALUE *vres);
|
||||||
extern void intvalue(VALUE *vp, VALUE *vres);
|
DLL extern void intvalue(VALUE *vp, VALUE *vres);
|
||||||
extern void fracvalue(VALUE *vp, VALUE *vres);
|
DLL extern void fracvalue(VALUE *vp, VALUE *vres);
|
||||||
extern void incvalue(VALUE *vp, VALUE *vres);
|
DLL extern void incvalue(VALUE *vp, VALUE *vres);
|
||||||
extern void decvalue(VALUE *vp, VALUE *vres);
|
DLL extern void decvalue(VALUE *vp, VALUE *vres);
|
||||||
extern void conjvalue(VALUE *vp, VALUE *vres);
|
DLL extern void conjvalue(VALUE *vp, VALUE *vres);
|
||||||
extern void sqrtvalue(VALUE *v1, VALUE *v2, VALUE *v3, VALUE *vres);
|
DLL extern void sqrtvalue(VALUE *v1, VALUE *v2, VALUE *v3, VALUE *vres);
|
||||||
extern void rootvalue(VALUE *v1, VALUE *v2, VALUE *v3, VALUE *vres);
|
DLL extern void rootvalue(VALUE *v1, VALUE *v2, VALUE *v3, VALUE *vres);
|
||||||
extern void absvalue(VALUE *v1, VALUE *v2, VALUE *vres);
|
DLL extern void absvalue(VALUE *v1, VALUE *v2, VALUE *vres);
|
||||||
extern void normvalue(VALUE *vp, VALUE *vres);
|
DLL extern void normvalue(VALUE *vp, VALUE *vres);
|
||||||
extern void shiftvalue(VALUE *v1, VALUE *v2, BOOL rightshift, VALUE *vres);
|
DLL extern void shiftvalue(VALUE *v1, VALUE *v2, BOOL rightshift, VALUE *vres);
|
||||||
extern void scalevalue(VALUE *v1, VALUE *v2, VALUE *vres);
|
DLL extern void scalevalue(VALUE *v1, VALUE *v2, VALUE *vres);
|
||||||
extern void powivalue(VALUE *v1, VALUE *v2, VALUE *vres);
|
DLL extern void powivalue(VALUE *v1, VALUE *v2, VALUE *vres);
|
||||||
extern void powervalue(VALUE *v1, VALUE *v2, VALUE *v3, VALUE *vres);
|
DLL extern void powervalue(VALUE *v1, VALUE *v2, VALUE *v3, VALUE *vres);
|
||||||
extern void divvalue(VALUE *v1, VALUE *v2, VALUE *vres);
|
DLL extern void divvalue(VALUE *v1, VALUE *v2, VALUE *vres);
|
||||||
extern void quovalue(VALUE *v1, VALUE *v2, VALUE *v3, VALUE *vres);
|
DLL extern void quovalue(VALUE *v1, VALUE *v2, VALUE *v3, VALUE *vres);
|
||||||
extern void modvalue(VALUE *v1, VALUE *v2, VALUE *v3, VALUE *vres);
|
DLL extern void modvalue(VALUE *v1, VALUE *v2, VALUE *v3, VALUE *vres);
|
||||||
extern BOOL testvalue(VALUE *vp);
|
DLL extern BOOL testvalue(VALUE *vp);
|
||||||
extern BOOL comparevalue(VALUE *v1, VALUE *v2);
|
DLL extern BOOL comparevalue(VALUE *v1, VALUE *v2);
|
||||||
extern BOOL acceptvalue(VALUE *v1, VALUE *v2);
|
DLL extern BOOL acceptvalue(VALUE *v1, VALUE *v2);
|
||||||
extern void relvalue(VALUE *v1, VALUE *v2, VALUE *vres);
|
DLL extern void relvalue(VALUE *v1, VALUE *v2, VALUE *vres);
|
||||||
extern void sgnvalue(VALUE *vp, VALUE *vres);
|
DLL extern void sgnvalue(VALUE *vp, VALUE *vres);
|
||||||
extern QCKHASH hashvalue(VALUE *vp, QCKHASH val);
|
DLL extern QCKHASH hashvalue(VALUE *vp, QCKHASH val);
|
||||||
extern void printvalue(VALUE *vp, int flags);
|
DLL extern void printvalue(VALUE *vp, int flags);
|
||||||
extern BOOL precvalue(VALUE *v1, VALUE *v2);
|
DLL extern BOOL precvalue(VALUE *v1, VALUE *v2);
|
||||||
extern VALUE error_value(int e);
|
DLL extern VALUE error_value(int e);
|
||||||
extern int set_errno(int e);
|
DLL extern int set_errno(int e);
|
||||||
extern int set_errcount(int e);
|
DLL extern int set_errcount(int e);
|
||||||
extern long countlistitems(LIST *lp);
|
DLL extern long countlistitems(LIST *lp);
|
||||||
extern void addlistitems(LIST *lp, VALUE *vres);
|
DLL extern void addlistitems(LIST *lp, VALUE *vres);
|
||||||
extern void addlistinv(LIST *lp, VALUE *vres);
|
DLL extern void addlistinv(LIST *lp, VALUE *vres);
|
||||||
extern void copy2octet(VALUE *, OCTET *);
|
DLL extern void copy2octet(VALUE *, OCTET *);
|
||||||
extern int copystod(VALUE *, long, long, VALUE *, long);
|
DLL extern int copystod(VALUE *, long, long, VALUE *, long);
|
||||||
extern void protectall(VALUE *, int);
|
DLL extern void protectall(VALUE *, int);
|
||||||
extern void set_update(int);
|
DLL extern void set_update(int);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -256,44 +270,44 @@ struct matrix {
|
|||||||
#define matsize(n) (sizeof(MATRIX) - sizeof(VALUE) + ((n) * sizeof(VALUE)))
|
#define matsize(n) (sizeof(MATRIX) - sizeof(VALUE) + ((n) * sizeof(VALUE)))
|
||||||
|
|
||||||
|
|
||||||
extern MATRIX *matadd(MATRIX *m1, MATRIX *m2);
|
DLL extern MATRIX *matadd(MATRIX *m1, MATRIX *m2);
|
||||||
extern MATRIX *matsub(MATRIX *m1, MATRIX *m2);
|
DLL extern MATRIX *matsub(MATRIX *m1, MATRIX *m2);
|
||||||
extern MATRIX *matmul(MATRIX *m1, MATRIX *m2);
|
DLL extern MATRIX *matmul(MATRIX *m1, MATRIX *m2);
|
||||||
extern MATRIX *matneg(MATRIX *m);
|
DLL extern MATRIX *matneg(MATRIX *m);
|
||||||
extern MATRIX *matalloc(long size);
|
DLL extern MATRIX *matalloc(long size);
|
||||||
extern MATRIX *matcopy(MATRIX *m);
|
DLL extern MATRIX *matcopy(MATRIX *m);
|
||||||
extern MATRIX *matinit(MATRIX *m, VALUE *v1, VALUE *v2);
|
DLL extern MATRIX *matinit(MATRIX *m, VALUE *v1, VALUE *v2);
|
||||||
extern MATRIX *matsquare(MATRIX *m);
|
DLL extern MATRIX *matsquare(MATRIX *m);
|
||||||
extern MATRIX *matinv(MATRIX *m);
|
DLL extern MATRIX *matinv(MATRIX *m);
|
||||||
extern MATRIX *matscale(MATRIX *m, long n);
|
DLL extern MATRIX *matscale(MATRIX *m, long n);
|
||||||
extern MATRIX *matshift(MATRIX *m, long n);
|
DLL extern MATRIX *matshift(MATRIX *m, long n);
|
||||||
extern MATRIX *matmulval(MATRIX *m, VALUE *vp);
|
DLL extern MATRIX *matmulval(MATRIX *m, VALUE *vp);
|
||||||
extern MATRIX *matpowi(MATRIX *m, NUMBER *q);
|
DLL extern MATRIX *matpowi(MATRIX *m, NUMBER *q);
|
||||||
extern MATRIX *matconj(MATRIX *m);
|
DLL extern MATRIX *matconj(MATRIX *m);
|
||||||
extern MATRIX *matquoval(MATRIX *m, VALUE *vp, VALUE *v3);
|
DLL extern MATRIX *matquoval(MATRIX *m, VALUE *vp, VALUE *v3);
|
||||||
extern MATRIX *matmodval(MATRIX *m, VALUE *vp, VALUE *v3);
|
DLL extern MATRIX *matmodval(MATRIX *m, VALUE *vp, VALUE *v3);
|
||||||
extern MATRIX *matint(MATRIX *m);
|
DLL extern MATRIX *matint(MATRIX *m);
|
||||||
extern MATRIX *matfrac(MATRIX *m);
|
DLL extern MATRIX *matfrac(MATRIX *m);
|
||||||
extern MATRIX *matappr(MATRIX *m, VALUE *v2, VALUE *v3);
|
DLL extern MATRIX *matappr(MATRIX *m, VALUE *v2, VALUE *v3);
|
||||||
extern VALUE mattrace(MATRIX *m);
|
DLL extern VALUE mattrace(MATRIX *m);
|
||||||
extern MATRIX *mattrans(MATRIX *m);
|
DLL extern MATRIX *mattrans(MATRIX *m);
|
||||||
extern MATRIX *matcross(MATRIX *m1, MATRIX *m2);
|
DLL extern MATRIX *matcross(MATRIX *m1, MATRIX *m2);
|
||||||
extern BOOL mattest(MATRIX *m);
|
DLL extern BOOL mattest(MATRIX *m);
|
||||||
extern void matsum(MATRIX *m, VALUE *vres);
|
DLL extern void matsum(MATRIX *m, VALUE *vres);
|
||||||
extern BOOL matcmp(MATRIX *m1, MATRIX *m2);
|
DLL extern BOOL matcmp(MATRIX *m1, MATRIX *m2);
|
||||||
extern int matsearch(MATRIX *m, VALUE *vp, long start, long end, ZVALUE *index);
|
DLL extern int matsearch(MATRIX *m, VALUE *vp, long start, long end, ZVALUE *index);
|
||||||
extern int matrsearch(MATRIX *m, VALUE *vp, long start, long end, ZVALUE *index);
|
DLL extern int matrsearch(MATRIX *m, VALUE *vp, long start, long end, ZVALUE *index);
|
||||||
extern VALUE matdet(MATRIX *m);
|
DLL extern VALUE matdet(MATRIX *m);
|
||||||
extern VALUE matdot(MATRIX *m1, MATRIX *m2);
|
DLL extern VALUE matdot(MATRIX *m1, MATRIX *m2);
|
||||||
extern void matfill(MATRIX *m, VALUE *v1, VALUE *v2);
|
DLL extern void matfill(MATRIX *m, VALUE *v1, VALUE *v2);
|
||||||
extern void matfree(MATRIX *m);
|
DLL extern void matfree(MATRIX *m);
|
||||||
extern void matprint(MATRIX *m, long max_print);
|
DLL extern void matprint(MATRIX *m, long max_print);
|
||||||
extern VALUE *matindex(MATRIX *mp, BOOL create, long dim, VALUE *indices);
|
DLL extern VALUE *matindex(MATRIX *mp, BOOL create, long dim, VALUE *indices);
|
||||||
extern void matreverse(MATRIX *m);
|
DLL extern void matreverse(MATRIX *m);
|
||||||
extern void matsort(MATRIX *m);
|
DLL extern void matsort(MATRIX *m);
|
||||||
extern BOOL matisident(MATRIX *m);
|
DLL extern BOOL matisident(MATRIX *m);
|
||||||
extern MATRIX *matround(MATRIX *m, VALUE *v2, VALUE *v3);
|
DLL extern MATRIX *matround(MATRIX *m, VALUE *v2, VALUE *v3);
|
||||||
extern MATRIX *matbround(MATRIX *m, VALUE *v2, VALUE *v3);
|
DLL extern MATRIX *matbround(MATRIX *m, VALUE *v2, VALUE *v3);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -320,32 +334,32 @@ struct list {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
extern void insertlistfirst(LIST *lp, VALUE *vp);
|
DLL extern void insertlistfirst(LIST *lp, VALUE *vp);
|
||||||
extern void insertlistlast(LIST *lp, VALUE *vp);
|
DLL extern void insertlistlast(LIST *lp, VALUE *vp);
|
||||||
extern void insertlistmiddle(LIST *lp, long index, VALUE *vp);
|
DLL extern void insertlistmiddle(LIST *lp, long index, VALUE *vp);
|
||||||
extern void removelistfirst(LIST *lp, VALUE *vp);
|
DLL extern void removelistfirst(LIST *lp, VALUE *vp);
|
||||||
extern void removelistlast(LIST *lp, VALUE *vp);
|
DLL extern void removelistlast(LIST *lp, VALUE *vp);
|
||||||
extern void removelistmiddle(LIST *lp, long index, VALUE *vp);
|
DLL extern void removelistmiddle(LIST *lp, long index, VALUE *vp);
|
||||||
extern void listfree(LIST *lp);
|
DLL extern void listfree(LIST *lp);
|
||||||
extern void listprint(LIST *lp, long max_print);
|
DLL extern void listprint(LIST *lp, long max_print);
|
||||||
extern int listsearch(LIST *lp, VALUE *vp, long start, long end, ZVALUE *index);
|
DLL extern int listsearch(LIST *lp, VALUE *vp, long start, long end, ZVALUE *index);
|
||||||
extern int listrsearch(LIST *lp, VALUE *vp, long start, long end, ZVALUE *index);
|
DLL extern int listrsearch(LIST *lp, VALUE *vp, long start, long end, ZVALUE *index);
|
||||||
extern BOOL listcmp(LIST *lp1, LIST *lp2);
|
DLL extern BOOL listcmp(LIST *lp1, LIST *lp2);
|
||||||
extern VALUE *listfindex(LIST *lp, long index);
|
DLL extern VALUE *listfindex(LIST *lp, long index);
|
||||||
extern LIST *listalloc(void);
|
DLL extern LIST *listalloc(void);
|
||||||
extern LIST *listcopy(LIST *lp);
|
DLL extern LIST *listcopy(LIST *lp);
|
||||||
extern void listreverse(LIST *lp);
|
DLL extern void listreverse(LIST *lp);
|
||||||
extern void listsort(LIST *lp);
|
DLL extern void listsort(LIST *lp);
|
||||||
extern LIST *listappr(LIST *lp, VALUE *v2, VALUE *v3);
|
DLL extern LIST *listappr(LIST *lp, VALUE *v2, VALUE *v3);
|
||||||
extern LIST *listround(LIST *m, VALUE *v2, VALUE *v3);
|
DLL extern LIST *listround(LIST *m, VALUE *v2, VALUE *v3);
|
||||||
extern LIST *listbround(LIST *m, VALUE *v2, VALUE *v3);
|
DLL extern LIST *listbround(LIST *m, VALUE *v2, VALUE *v3);
|
||||||
extern LIST *listquo(LIST *lp, VALUE *v2, VALUE *v3);
|
DLL extern LIST *listquo(LIST *lp, VALUE *v2, VALUE *v3);
|
||||||
extern LIST *listmod(LIST *lp, VALUE *v2, VALUE *v3);
|
DLL extern LIST *listmod(LIST *lp, VALUE *v2, VALUE *v3);
|
||||||
extern BOOL evp(LISTELEM *cp, LISTELEM *x, VALUE *vres);
|
DLL extern BOOL evp(LISTELEM *cp, LISTELEM *x, VALUE *vres);
|
||||||
extern BOOL evalpoly(LIST *clist, LISTELEM *x, VALUE *vres);
|
DLL extern BOOL evalpoly(LIST *clist, LISTELEM *x, VALUE *vres);
|
||||||
extern void insertitems(LIST *lp1, LIST *lp2);
|
DLL extern void insertitems(LIST *lp1, LIST *lp2);
|
||||||
extern LISTELEM *listelement(LIST *, long);
|
DLL extern LISTELEM *listelement(LIST *, long);
|
||||||
extern LIST *listsegment(LIST *, long, long);
|
DLL extern LIST *listsegment(LIST *, long, long);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -370,15 +384,15 @@ struct assoc {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
extern ASSOC *assocalloc(long initsize);
|
DLL extern ASSOC *assocalloc(long initsize);
|
||||||
extern ASSOC *assoccopy(ASSOC *ap);
|
DLL extern ASSOC *assoccopy(ASSOC *ap);
|
||||||
extern void assocfree(ASSOC *ap);
|
DLL extern void assocfree(ASSOC *ap);
|
||||||
extern void assocprint(ASSOC *ap, long max_print);
|
DLL extern void assocprint(ASSOC *ap, long max_print);
|
||||||
extern int assocsearch(ASSOC *ap, VALUE *vp, long start, long end, ZVALUE *index);
|
DLL extern int assocsearch(ASSOC *ap, VALUE *vp, long start, long end, ZVALUE *index);
|
||||||
extern int assocrsearch(ASSOC *ap, VALUE *vp, long start, long end, ZVALUE *index);
|
DLL extern int assocrsearch(ASSOC *ap, VALUE *vp, long start, long end, ZVALUE *index);
|
||||||
extern BOOL assoccmp(ASSOC *ap1, ASSOC *ap2);
|
DLL extern BOOL assoccmp(ASSOC *ap1, ASSOC *ap2);
|
||||||
extern VALUE *assocfindex(ASSOC *ap, long index);
|
DLL extern VALUE *assocfindex(ASSOC *ap, long index);
|
||||||
extern VALUE *associndex(ASSOC *ap, BOOL create, long dim, VALUE *indices);
|
DLL extern VALUE *associndex(ASSOC *ap, BOOL create, long dim, VALUE *indices);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -460,62 +474,62 @@ struct object {
|
|||||||
(sizeof(OBJECT) + ((elements) - USUAL_ELEMENTS) * sizeof(VALUE))
|
(sizeof(OBJECT) + ((elements) - USUAL_ELEMENTS) * sizeof(VALUE))
|
||||||
|
|
||||||
|
|
||||||
extern OBJECT *objcopy(OBJECT *op);
|
DLL extern OBJECT *objcopy(OBJECT *op);
|
||||||
extern OBJECT *objalloc(long index);
|
DLL extern OBJECT *objalloc(long index);
|
||||||
extern VALUE objcall(int action, VALUE *v1, VALUE *v2, VALUE *v3);
|
DLL extern VALUE objcall(int action, VALUE *v1, VALUE *v2, VALUE *v3);
|
||||||
extern void objfree(OBJECT *op);
|
DLL extern void objfree(OBJECT *op);
|
||||||
extern int addelement(char *name);
|
DLL extern int addelement(char *name);
|
||||||
extern int defineobject(char *name, int indices[], int count);
|
DLL extern int defineobject(char *name, int indices[], int count);
|
||||||
extern int checkobject(char *name);
|
DLL extern int checkobject(char *name);
|
||||||
extern void showobjfuncs(void);
|
DLL extern void showobjfuncs(void);
|
||||||
extern void showobjtypes(void);
|
DLL extern void showobjtypes(void);
|
||||||
extern int findelement(char *name);
|
DLL extern int findelement(char *name);
|
||||||
extern char *objtypename(unsigned long index);
|
DLL extern char *objtypename(unsigned long index);
|
||||||
extern int objoffset(OBJECT *op, long index);
|
DLL extern int objoffset(OBJECT *op, long index);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Configuration parameter name and type.
|
* Configuration parameter name and type.
|
||||||
*/
|
*/
|
||||||
extern NAMETYPE configs[];
|
extern NAMETYPE configs[];
|
||||||
extern void config_value(CONFIG *cfg, int type, VALUE *ret);
|
DLL extern void config_value(CONFIG *cfg, int type, VALUE *ret);
|
||||||
extern void setconfig(int type, VALUE *vp);
|
DLL extern void setconfig(int type, VALUE *vp);
|
||||||
extern void config_print(CONFIG *cfg); /* the CONFIG to print */
|
DLL extern void config_print(CONFIG *cfg); /* the CONFIG to print */
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* size, memsize and sizeof support
|
* size, memsize and sizeof support
|
||||||
*/
|
*/
|
||||||
extern long elm_count(VALUE *vp);
|
DLL extern long elm_count(VALUE *vp);
|
||||||
extern long lsizeof(VALUE *vp);
|
DLL extern long lsizeof(VALUE *vp);
|
||||||
extern long memsize(VALUE *vp);
|
DLL extern long memsize(VALUE *vp);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* String functions
|
* String functions
|
||||||
*/
|
*/
|
||||||
extern STRING *stringadd(STRING *, STRING *);
|
DLL extern STRING *stringadd(STRING *, STRING *);
|
||||||
extern STRING *stringcopy(STRING *);
|
DLL extern STRING *stringcopy(STRING *);
|
||||||
extern STRING *stringsub(STRING *, STRING *);
|
DLL extern STRING *stringsub(STRING *, STRING *);
|
||||||
extern STRING *stringmul(NUMBER *, STRING *);
|
DLL extern STRING *stringmul(NUMBER *, STRING *);
|
||||||
extern STRING *stringand(STRING *, STRING *);
|
DLL extern STRING *stringand(STRING *, STRING *);
|
||||||
extern STRING *stringor(STRING *, STRING *);
|
DLL extern STRING *stringor(STRING *, STRING *);
|
||||||
extern STRING *stringxor(STRING *, STRING *);
|
DLL extern STRING *stringxor(STRING *, STRING *);
|
||||||
extern STRING *stringdiff(STRING *, STRING *);
|
DLL extern STRING *stringdiff(STRING *, STRING *);
|
||||||
extern STRING *stringsegment(STRING *, long, long);
|
DLL extern STRING *stringsegment(STRING *, long, long);
|
||||||
extern STRING *stringshift(STRING *, long);
|
DLL extern STRING *stringshift(STRING *, long);
|
||||||
extern STRING *stringcomp(STRING *);
|
DLL extern STRING *stringcomp(STRING *);
|
||||||
extern STRING *stringneg(STRING *);
|
DLL extern STRING *stringneg(STRING *);
|
||||||
extern STRING *stringcpy(STRING *, STRING *);
|
DLL extern STRING *stringcpy(STRING *, STRING *);
|
||||||
extern STRING *stringncpy(STRING *, STRING *, long);
|
DLL extern STRING *stringncpy(STRING *, STRING *, long);
|
||||||
extern long stringcontent(STRING *s);
|
DLL extern long stringcontent(STRING *s);
|
||||||
extern long stringlowbit(STRING *s);
|
DLL extern long stringlowbit(STRING *s);
|
||||||
extern long stringhighbit(STRING *s);
|
DLL extern long stringhighbit(STRING *s);
|
||||||
extern BOOL stringcmp(STRING *, STRING *);
|
DLL extern BOOL stringcmp(STRING *, STRING *);
|
||||||
extern BOOL stringrel(STRING *, STRING *);
|
DLL extern BOOL stringrel(STRING *, STRING *);
|
||||||
extern int stringbit(STRING *, long);
|
DLL extern int stringbit(STRING *, long);
|
||||||
extern BOOL stringtest(STRING *);
|
DLL extern BOOL stringtest(STRING *);
|
||||||
extern int stringsetbit(STRING *, long, BOOL);
|
DLL extern int stringsetbit(STRING *, long, BOOL);
|
||||||
extern int stringsearch(STRING *, STRING *, long, long, ZVALUE *);
|
DLL extern int stringsearch(STRING *, STRING *, long, long, ZVALUE *);
|
||||||
extern int stringrsearch(STRING *, STRING *, long, long, ZVALUE *);
|
DLL extern int stringrsearch(STRING *, STRING *, long, long, ZVALUE *);
|
||||||
|
|
||||||
#endif /* !__VALUE_H__ */
|
#endif /* !__VALUE_H__ */
|
||||||
|
@@ -19,8 +19,8 @@
|
|||||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*
|
*
|
||||||
* @(#) $Revision: 29.17 $
|
* @(#) $Revision: 29.19 $
|
||||||
* @(#) $Id: version.c,v 29.17 2000/12/15 14:58:20 chongo Exp $
|
* @(#) $Id: version.c,v 29.19 2001/02/25 22:07:36 chongo Exp $
|
||||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/version.c,v $
|
* @(#) $Source: /usr/local/src/cmd/calc/RCS/version.c,v $
|
||||||
*
|
*
|
||||||
* Under source code control: 1990/05/22 11:00:58
|
* Under source code control: 1990/05/22 11:00:58
|
||||||
@@ -42,8 +42,8 @@ static char *program;
|
|||||||
|
|
||||||
#define MAJOR_VER 2 /* major version */
|
#define MAJOR_VER 2 /* major version */
|
||||||
#define MINOR_VER 11 /* minor version */
|
#define MINOR_VER 11 /* minor version */
|
||||||
#define MAJOR_PATCH 4 /* patch level or 0 if no patch */
|
#define MAJOR_PATCH 5 /* patch level or 0 if no patch */
|
||||||
#define MINOR_PATCH "1" /* test number or empty string if no patch */
|
#define MINOR_PATCH "0" /* test number or empty string if no patch */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* calc version constants
|
* calc version constants
|
||||||
|
240
zmath.h
240
zmath.h
@@ -17,8 +17,8 @@
|
|||||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*
|
*
|
||||||
* @(#) $Revision: 29.3 $
|
* @(#) $Revision: 29.4 $
|
||||||
* @(#) $Id: zmath.h,v 29.3 2000/07/17 15:35:49 chongo Exp $
|
* @(#) $Id: zmath.h,v 29.4 2001/02/25 22:07:36 chongo Exp $
|
||||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/zmath.h,v $
|
* @(#) $Source: /usr/local/src/cmd/calc/RCS/zmath.h,v $
|
||||||
*
|
*
|
||||||
* Under source code control: 1993/07/30 19:42:48
|
* Under source code control: 1993/07/30 19:42:48
|
||||||
@@ -38,6 +38,20 @@
|
|||||||
#define __ZMATH_H__
|
#define __ZMATH_H__
|
||||||
|
|
||||||
|
|
||||||
|
#if defined (_WIN32)
|
||||||
|
#ifdef _EXPORTING
|
||||||
|
#define DLL __declspec(dllexport)
|
||||||
|
#else
|
||||||
|
#define DLL __declspec(dllimport)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#else /* Windoz free systems */
|
||||||
|
|
||||||
|
#define DLL
|
||||||
|
|
||||||
|
#endif /* Windoz free systems */
|
||||||
|
|
||||||
|
|
||||||
#include "alloc.h"
|
#include "alloc.h"
|
||||||
#include "endian_calc.h"
|
#include "endian_calc.h"
|
||||||
#include "longbits.h"
|
#include "longbits.h"
|
||||||
@@ -267,126 +281,126 @@ typedef struct {
|
|||||||
/*
|
/*
|
||||||
* Function prototypes for integer math routines.
|
* Function prototypes for integer math routines.
|
||||||
*/
|
*/
|
||||||
extern HALF * alloc(LEN len);
|
DLL extern HALF * alloc(LEN len);
|
||||||
#ifdef ALLOCTEST
|
#ifdef ALLOCTEST
|
||||||
extern void freeh(HALF *);
|
DLL extern void freeh(HALF *);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Input, output, and conversion routines.
|
* Input, output, and conversion routines.
|
||||||
*/
|
*/
|
||||||
extern void zcopy(ZVALUE z, ZVALUE *res);
|
DLL extern void zcopy(ZVALUE z, ZVALUE *res);
|
||||||
extern void itoz(long i, ZVALUE *res);
|
DLL extern void itoz(long i, ZVALUE *res);
|
||||||
extern void utoz(FULL i, ZVALUE *res);
|
DLL extern void utoz(FULL i, ZVALUE *res);
|
||||||
extern void str2z(char *s, ZVALUE *res);
|
DLL extern void str2z(char *s, ZVALUE *res);
|
||||||
extern long ztoi(ZVALUE z);
|
DLL extern long ztoi(ZVALUE z);
|
||||||
extern FULL ztou(ZVALUE z);
|
DLL extern FULL ztou(ZVALUE z);
|
||||||
extern void zprintval(ZVALUE z, long decimals, long width);
|
DLL extern void zprintval(ZVALUE z, long decimals, long width);
|
||||||
extern void zprintx(ZVALUE z, long width);
|
DLL extern void zprintx(ZVALUE z, long width);
|
||||||
extern void zprintb(ZVALUE z, long width);
|
DLL extern void zprintb(ZVALUE z, long width);
|
||||||
extern void zprinto(ZVALUE z, long width);
|
DLL extern void zprinto(ZVALUE z, long width);
|
||||||
extern void fitzprint(ZVALUE, long, long);
|
DLL extern void fitzprint(ZVALUE, long, long);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Basic numeric routines.
|
* Basic numeric routines.
|
||||||
*/
|
*/
|
||||||
extern void zmuli(ZVALUE z, long n, ZVALUE *res);
|
DLL extern void zmuli(ZVALUE z, long n, ZVALUE *res);
|
||||||
extern long zdivi(ZVALUE z, long n, ZVALUE *res);
|
DLL extern long zdivi(ZVALUE z, long n, ZVALUE *res);
|
||||||
extern long zmodi(ZVALUE z, long n);
|
DLL extern long zmodi(ZVALUE z, long n);
|
||||||
extern void zadd(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
DLL extern void zadd(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||||
extern void zsub(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
DLL extern void zsub(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||||
extern void zmul(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
DLL extern void zmul(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||||
extern long zdiv(ZVALUE z1, ZVALUE z2, ZVALUE *res, ZVALUE *rem, long R);
|
DLL extern long zdiv(ZVALUE z1, ZVALUE z2, ZVALUE *res, ZVALUE *rem, long R);
|
||||||
extern long zquo(ZVALUE z1, ZVALUE z2, ZVALUE *res, long R);
|
DLL extern long zquo(ZVALUE z1, ZVALUE z2, ZVALUE *res, long R);
|
||||||
extern long zmod(ZVALUE z1, ZVALUE z2, ZVALUE *rem, long R);
|
DLL extern long zmod(ZVALUE z1, ZVALUE z2, ZVALUE *rem, long R);
|
||||||
extern void zequo(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
DLL extern void zequo(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||||
extern BOOL zdivides(ZVALUE z1, ZVALUE z2);
|
DLL extern BOOL zdivides(ZVALUE z1, ZVALUE z2);
|
||||||
extern void zor(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
DLL extern void zor(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||||
extern void zand(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
DLL extern void zand(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||||
extern void zxor(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
DLL extern void zxor(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||||
extern void zandnot(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
DLL extern void zandnot(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||||
extern long zpopcnt(ZVALUE z, int bitval);
|
DLL extern long zpopcnt(ZVALUE z, int bitval);
|
||||||
extern void zshift(ZVALUE z, long n, ZVALUE *res);
|
DLL extern void zshift(ZVALUE z, long n, ZVALUE *res);
|
||||||
extern void zsquare(ZVALUE z, ZVALUE *res);
|
DLL extern void zsquare(ZVALUE z, ZVALUE *res);
|
||||||
extern long zlowbit(ZVALUE z);
|
DLL extern long zlowbit(ZVALUE z);
|
||||||
extern LEN zhighbit(ZVALUE z);
|
DLL extern LEN zhighbit(ZVALUE z);
|
||||||
extern void zbitvalue(long n, ZVALUE *res);
|
DLL extern void zbitvalue(long n, ZVALUE *res);
|
||||||
extern BOOL zisset(ZVALUE z, long n);
|
DLL extern BOOL zisset(ZVALUE z, long n);
|
||||||
extern BOOL zisonebit(ZVALUE z);
|
DLL extern BOOL zisonebit(ZVALUE z);
|
||||||
extern BOOL zisallbits(ZVALUE z);
|
DLL extern BOOL zisallbits(ZVALUE z);
|
||||||
extern FLAG ztest(ZVALUE z);
|
DLL extern FLAG ztest(ZVALUE z);
|
||||||
extern FLAG zrel(ZVALUE z1, ZVALUE z2);
|
DLL extern FLAG zrel(ZVALUE z1, ZVALUE z2);
|
||||||
extern FLAG zabsrel(ZVALUE z1, ZVALUE z2);
|
DLL extern FLAG zabsrel(ZVALUE z1, ZVALUE z2);
|
||||||
extern BOOL zcmp(ZVALUE z1, ZVALUE z2);
|
DLL extern BOOL zcmp(ZVALUE z1, ZVALUE z2);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* More complicated numeric functions.
|
* More complicated numeric functions.
|
||||||
*/
|
*/
|
||||||
extern FULL uugcd(FULL i1, FULL i2);
|
DLL extern FULL uugcd(FULL i1, FULL i2);
|
||||||
extern long iigcd(long i1, long i2);
|
DLL extern long iigcd(long i1, long i2);
|
||||||
extern void zgcd(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
DLL extern void zgcd(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||||
extern void zlcm(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
DLL extern void zlcm(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||||
extern void zreduce(ZVALUE z1, ZVALUE z2, ZVALUE *z1res, ZVALUE *z2res);
|
DLL extern void zreduce(ZVALUE z1, ZVALUE z2, ZVALUE *z1res, ZVALUE *z2res);
|
||||||
extern void zfact(ZVALUE z, ZVALUE *dest);
|
DLL extern void zfact(ZVALUE z, ZVALUE *dest);
|
||||||
extern void zperm(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
DLL extern void zperm(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||||
extern int zcomb(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
DLL extern int zcomb(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||||
extern FLAG zjacobi(ZVALUE z1, ZVALUE z2);
|
DLL extern FLAG zjacobi(ZVALUE z1, ZVALUE z2);
|
||||||
extern void zfib(ZVALUE z, ZVALUE *res);
|
DLL extern void zfib(ZVALUE z, ZVALUE *res);
|
||||||
extern void zpowi(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
DLL extern void zpowi(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||||
extern void ztenpow(long power, ZVALUE *res);
|
DLL extern void ztenpow(long power, ZVALUE *res);
|
||||||
extern void zpowermod(ZVALUE z1, ZVALUE z2, ZVALUE z3, ZVALUE *res);
|
DLL extern void zpowermod(ZVALUE z1, ZVALUE z2, ZVALUE z3, ZVALUE *res);
|
||||||
extern BOOL zmodinv(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
DLL extern BOOL zmodinv(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||||
extern BOOL zrelprime(ZVALUE z1, ZVALUE z2);
|
DLL extern BOOL zrelprime(ZVALUE z1, ZVALUE z2);
|
||||||
extern long zlog(ZVALUE z1, ZVALUE z2);
|
DLL extern long zlog(ZVALUE z1, ZVALUE z2);
|
||||||
extern long zlog10(ZVALUE z);
|
DLL extern long zlog10(ZVALUE z);
|
||||||
extern long zdivcount(ZVALUE z1, ZVALUE z2);
|
DLL extern long zdivcount(ZVALUE z1, ZVALUE z2);
|
||||||
extern long zfacrem(ZVALUE z1, ZVALUE z2, ZVALUE *rem);
|
DLL extern long zfacrem(ZVALUE z1, ZVALUE z2, ZVALUE *rem);
|
||||||
extern long zgcdrem(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
DLL extern long zgcdrem(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||||
extern long zdigits(ZVALUE z1);
|
DLL extern long zdigits(ZVALUE z1);
|
||||||
extern long zdigit(ZVALUE z1, long n);
|
DLL extern long zdigit(ZVALUE z1, long n);
|
||||||
extern FLAG zsqrt(ZVALUE z1, ZVALUE *dest, long R);
|
DLL extern FLAG zsqrt(ZVALUE z1, ZVALUE *dest, long R);
|
||||||
extern void zroot(ZVALUE z1, ZVALUE z2, ZVALUE *dest);
|
DLL extern void zroot(ZVALUE z1, ZVALUE z2, ZVALUE *dest);
|
||||||
extern BOOL zissquare(ZVALUE z);
|
DLL extern BOOL zissquare(ZVALUE z);
|
||||||
extern void zhnrmod(ZVALUE v, ZVALUE h, ZVALUE zn, ZVALUE zr, ZVALUE *res);
|
DLL extern void zhnrmod(ZVALUE v, ZVALUE h, ZVALUE zn, ZVALUE zr, ZVALUE *res);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Prime related functions.
|
* Prime related functions.
|
||||||
*/
|
*/
|
||||||
extern FLAG zisprime(ZVALUE z);
|
DLL extern FLAG zisprime(ZVALUE z);
|
||||||
extern FULL znprime(ZVALUE z);
|
DLL extern FULL znprime(ZVALUE z);
|
||||||
extern FULL next_prime(FULL v);
|
DLL extern FULL next_prime(FULL v);
|
||||||
extern FULL zpprime(ZVALUE z);
|
DLL extern FULL zpprime(ZVALUE z);
|
||||||
extern void zpfact(ZVALUE z, ZVALUE *dest);
|
DLL extern void zpfact(ZVALUE z, ZVALUE *dest);
|
||||||
extern BOOL zprimetest(ZVALUE z, long count, ZVALUE skip);
|
DLL extern BOOL zprimetest(ZVALUE z, long count, ZVALUE skip);
|
||||||
extern BOOL zredcprimetest(ZVALUE z, long count, ZVALUE skip);
|
DLL extern BOOL zredcprimetest(ZVALUE z, long count, ZVALUE skip);
|
||||||
extern BOOL znextcand(ZVALUE z1, long count, ZVALUE skip, ZVALUE res, ZVALUE mod, ZVALUE *cand);
|
DLL extern BOOL znextcand(ZVALUE z1, long count, ZVALUE skip, ZVALUE res, ZVALUE mod, ZVALUE *cand);
|
||||||
extern BOOL zprevcand(ZVALUE z1, long count, ZVALUE skip, ZVALUE res, ZVALUE mod, ZVALUE *cand);
|
DLL extern BOOL zprevcand(ZVALUE z1, long count, ZVALUE skip, ZVALUE res, ZVALUE mod, ZVALUE *cand);
|
||||||
extern FULL zlowfactor(ZVALUE z, long count);
|
DLL extern FULL zlowfactor(ZVALUE z, long count);
|
||||||
extern FLAG zfactor(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
DLL extern FLAG zfactor(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||||
extern long zpix(ZVALUE z1);
|
DLL extern long zpix(ZVALUE z1);
|
||||||
extern void zlcmfact(ZVALUE z, ZVALUE *dest);
|
DLL extern void zlcmfact(ZVALUE z, ZVALUE *dest);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Misc misc functions. :-)
|
* Misc misc functions. :-)
|
||||||
*/
|
*/
|
||||||
extern void zsquaremod(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
DLL extern void zsquaremod(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||||
extern void zminmod(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
DLL extern void zminmod(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||||
extern BOOL zcmpmod(ZVALUE z1, ZVALUE z2, ZVALUE z3);
|
DLL extern BOOL zcmpmod(ZVALUE z1, ZVALUE z2, ZVALUE z3);
|
||||||
extern void zio_init(void);
|
DLL extern void zio_init(void);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* These functions are for internal use only.
|
* These functions are for internal use only.
|
||||||
*/
|
*/
|
||||||
extern void ztrim(ZVALUE *z);
|
DLL extern void ztrim(ZVALUE *z);
|
||||||
extern void zshiftr(ZVALUE z, long n);
|
DLL extern void zshiftr(ZVALUE z, long n);
|
||||||
extern void zshiftl(ZVALUE z, long n);
|
DLL extern void zshiftl(ZVALUE z, long n);
|
||||||
extern HALF *zalloctemp(LEN len);
|
DLL extern HALF *zalloctemp(LEN len);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -403,13 +417,13 @@ typedef struct {
|
|||||||
ZVALUE one; /* REDC format for the number 1 */
|
ZVALUE one; /* REDC format for the number 1 */
|
||||||
} REDC;
|
} REDC;
|
||||||
|
|
||||||
extern REDC *zredcalloc(ZVALUE z1);
|
DLL extern REDC *zredcalloc(ZVALUE z1);
|
||||||
extern void zredcfree(REDC *rp);
|
DLL extern void zredcfree(REDC *rp);
|
||||||
extern void zredcencode(REDC *rp, ZVALUE z1, ZVALUE *res);
|
DLL extern void zredcencode(REDC *rp, ZVALUE z1, ZVALUE *res);
|
||||||
extern void zredcdecode(REDC *rp, ZVALUE z1, ZVALUE *res);
|
DLL extern void zredcdecode(REDC *rp, ZVALUE z1, ZVALUE *res);
|
||||||
extern void zredcmul(REDC *rp, ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
DLL extern void zredcmul(REDC *rp, ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||||
extern void zredcsquare(REDC *rp, ZVALUE z1, ZVALUE *res);
|
DLL extern void zredcsquare(REDC *rp, ZVALUE z1, ZVALUE *res);
|
||||||
extern void zredcpower(REDC *rp, ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
DLL extern void zredcpower(REDC *rp, ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -550,32 +564,32 @@ extern void zredcpower(REDC *rp, ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
|||||||
/*
|
/*
|
||||||
* Output routines for either FILE handles or strings.
|
* Output routines for either FILE handles or strings.
|
||||||
*/
|
*/
|
||||||
extern void math_chr(int ch);
|
DLL extern void math_chr(int ch);
|
||||||
extern void math_str(char *str);
|
DLL extern void math_str(char *str);
|
||||||
extern void math_fill(char *str, long width);
|
DLL extern void math_fill(char *str, long width);
|
||||||
extern void math_flush(void);
|
DLL extern void math_flush(void);
|
||||||
extern void math_divertio(void);
|
DLL extern void math_divertio(void);
|
||||||
extern void math_cleardiversions(void);
|
DLL extern void math_cleardiversions(void);
|
||||||
extern char *math_getdivertedio(void);
|
DLL extern char *math_getdivertedio(void);
|
||||||
extern int math_setmode(int mode);
|
DLL extern int math_setmode(int mode);
|
||||||
extern LEN math_setdigits(LEN digits);
|
DLL extern LEN math_setdigits(LEN digits);
|
||||||
extern void math_fmt(char *, ...);
|
DLL extern void math_fmt(char *, ...);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The error routine.
|
* The error routine.
|
||||||
*/
|
*/
|
||||||
extern void math_error(char *, ...);
|
DLL extern void math_error(char *, ...);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* external swap functions
|
* external swap functions
|
||||||
*/
|
*/
|
||||||
extern HALF *swap_b8_in_HALFs(HALF *dest, HALF *src, LEN len);
|
DLL extern HALF *swap_b8_in_HALFs(HALF *dest, HALF *src, LEN len);
|
||||||
extern ZVALUE *swap_b8_in_ZVALUE(ZVALUE *dest, ZVALUE *src, BOOL all);
|
DLL extern ZVALUE *swap_b8_in_ZVALUE(ZVALUE *dest, ZVALUE *src, BOOL all);
|
||||||
extern HALF *swap_b16_in_HALFs(HALF *dest, HALF *src, LEN len);
|
DLL extern HALF *swap_b16_in_HALFs(HALF *dest, HALF *src, LEN len);
|
||||||
extern ZVALUE *swap_b16_in_ZVALUE(ZVALUE *dest, ZVALUE *src, BOOL all);
|
DLL extern ZVALUE *swap_b16_in_ZVALUE(ZVALUE *dest, ZVALUE *src, BOOL all);
|
||||||
extern ZVALUE *swap_HALF_in_ZVALUE(ZVALUE *dest, ZVALUE *src, BOOL all);
|
DLL extern ZVALUE *swap_HALF_in_ZVALUE(ZVALUE *dest, ZVALUE *src, BOOL all);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Reference in New Issue
Block a user