mirror of
https://github.com/lcn2/calc.git
synced 2025-08-19 01:13:27 +03:00
Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
253b47942f | ||
|
c773ee736f | ||
|
7d0cc52afe | ||
|
2441df7fdc | ||
|
5c565a7cea |
63
CHANGES
63
CHANGES
@@ -1,4 +1,38 @@
|
||||
The following are the changes from calc version 2.12.1.7 to date:
|
||||
The following are the changes from calc version 2.12.1.10 to date:
|
||||
|
||||
Put back the missing -s flags on the cscripts: mersenne, 4dsphere,
|
||||
fprodcut, plus, and powerterm. Thanks goes to Bradley Reed
|
||||
<bradreed1 at gmail dot com> for discovering this problem.
|
||||
|
||||
All static variables are now declared with the symbol STATIC.
|
||||
All extern variables are now declared with the symbol EXTERN.
|
||||
All static functions are now declared with the symbol S_FUNC.
|
||||
All extern functions are now declared with the symbol E_FUNC.
|
||||
The include file decl.h defines these 4 symbols by default
|
||||
to static, extern, static, and extern respectively. Under
|
||||
Windoz, DLL is also defined accorind to the _EXPORTING symbol
|
||||
and is prepended to the EXTERN and E_FUNC symbols. The decl.h
|
||||
file has replaced the win32dll.h file.
|
||||
|
||||
Added Apple Mac OS X compiler set in the Makefile.
|
||||
|
||||
When MACOSX_TLS is defined, calc attempts to compile with OS
|
||||
X Thread Local Storage. As of version 2.12.1.12 this mode is
|
||||
extremely experimental. Calc may not compile with MACOSX_TLS defined.
|
||||
|
||||
Fixed E_FUNC vs EXTERN issues discovered by Mirko Viviani
|
||||
<mirko at objectlab dot org>.
|
||||
|
||||
Removed include of <malloc.h>. The building of the include file
|
||||
"have_malloc.h" has been removed from the Makefile. One some
|
||||
systems such as FreeBSD, the file /usr/include/malloc.h exists
|
||||
and contains an forced error saying that stdlib.h should be used
|
||||
instead. The Makefile symbol HAVE_MALLOC has been removed.
|
||||
|
||||
Fixed FreeBSD dereferencing type-punned pointer error in filepos2z().
|
||||
|
||||
|
||||
The following are the changes from calc version 2.12.1.8 to 2.12.1.9:
|
||||
|
||||
Fixed calc cscripts that contained comments that were not valid calc
|
||||
comments. Improved calc comment documentation in "help unexpected"
|
||||
@@ -35,11 +69,30 @@ The following are the changes from calc version 2.12.1.7 to date:
|
||||
The "help define" command is now equivalent to "help command".
|
||||
|
||||
Fixed calc command line usage message.
|
||||
|
||||
|
||||
Fixed missing README.src file in RPM src and tgz src tarball.
|
||||
|
||||
Removed HAVE_SNPRINTF test in version.c. We now assume that
|
||||
all systems come with the standard snprintf() library function.
|
||||
|
||||
The following are the changes from calc version 2.12.1.6 to 2.12.1.6:
|
||||
Make does not assume that DONT_HAVE_VSPRINTF must be defined in
|
||||
order to test for varargs (via have_varvs.c). Instead it uses the
|
||||
${HAVE_VSPRINTF} to determine if the vsprintf() and vsnprintf()
|
||||
should be tested to assumed to exist or not exist.
|
||||
|
||||
Tests for the existence of vsprintf() now also require the existence
|
||||
of vsnprintf(). Test for the existence of vsnprintf() now also
|
||||
require the existence of vsprintf().
|
||||
|
||||
The #define CALC_SIZE_T was never used except when memmove() was
|
||||
not found. This symbol was renamed to MEMMOVE_SIZE_T. Calc
|
||||
requires that size_t must be a known type.
|
||||
|
||||
Calc and cscripts are installed mode 0755 instead of 0555 to
|
||||
make rpmlint happy.
|
||||
|
||||
|
||||
The following are the changes from calc version 2.12.1.6 to 2.12.1.7:
|
||||
|
||||
Added the calc builtin function, usertime(), to return the amount of
|
||||
user CPU time used by the current process. Unlike the old runtime()
|
||||
@@ -6320,8 +6373,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.
|
||||
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
##
|
||||
## @(#) $Revision: 29.94 $
|
||||
## @(#) $Id: CHANGES,v 29.94 2007/02/07 01:38:03 chongo Exp $
|
||||
## @(#) $Revision: 29.100 $
|
||||
## @(#) $Id: CHANGES,v 29.100 2007/02/12 08:22:13 chongo Exp $
|
||||
## @(#) $Source: /usr/local/src/cmd/calc/RCS/CHANGES,v $
|
||||
##
|
||||
## Under source code control: 1993/06/02 18:12:57
|
||||
|
12
COPYING
12
COPYING
@@ -12,8 +12,8 @@ This file is Copyrighted
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
# @(#) $Revision: 29.8 $
|
||||
# @(#) $Id: COPYING,v 29.8 2006/05/01 19:16:57 chongo Exp $
|
||||
# @(#) $Revision: 29.9 $
|
||||
# @(#) $Id: COPYING,v 29.9 2007/02/11 10:16:31 chongo Exp $
|
||||
# @(#) $Source: /usr/local/src/cmd/calc/RCS/COPYING,v $
|
||||
|
||||
=-=
|
||||
@@ -182,9 +182,11 @@ Calc copyrights and exception files
|
||||
top of this file. It is important to note that you may distribute
|
||||
verbatim copies of this file but you may not modify this file.
|
||||
|
||||
Some of these exception files are in the public domain. Other
|
||||
exception files have non-LGPL Copyrights. Other files are under a
|
||||
LGPL Copyright but have different authors.
|
||||
Some of these exception files are in the public domain. The md5.c
|
||||
and md5.h files were "derived from the RSA Data Security, Inc. MD5
|
||||
Message-Digest Algorithm" and are under a copyright that allows these
|
||||
two files to be freely used and distributed. Other files are under
|
||||
the LGPL but have different authors that those listed above.
|
||||
|
||||
In all cases one may use and distribute these exception files freely.
|
||||
And because one may freely distribute the LGPL covered files, the
|
||||
|
@@ -56,7 +56,7 @@ recommends the following settings:
|
||||
CALCPATH= .;./cal;~/.cal;${CALC_SHAREDIR};${CUSTOMCALDIR}
|
||||
CALCRC= ${CALC_SHAREDIR}/startup;~/.calcrc;./.calcinit
|
||||
CALCPAGER= less.exe -ci
|
||||
DEBUG= -O2 -gstabs+
|
||||
DEBUG= -O2 -gstabs+ -DWINDOZ
|
||||
|
||||
The 'Linux set' or 'gcc set' (see the Select your compiler type section)
|
||||
should work for DJGPP systems if you set the above Makefile variables.
|
||||
@@ -112,37 +112,8 @@ In particular:
|
||||
source directory, edit them (if needed) and build using the
|
||||
Cygwin GCC compiler and Cygwin build environment.
|
||||
|
||||
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||
=-=-= calc maintenance folk =-=-=
|
||||
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
|
||||
|
||||
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) 2002 Landon Curt Noll and Thomas Jones-Low
|
||||
## Copyright (C) 2002-2007 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
|
||||
@@ -158,8 +129,8 @@ was changed to:
|
||||
## 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.12 $
|
||||
## @(#) $Id: README.WINDOWS,v 29.12 2004/07/28 12:52:01 chongo Exp $
|
||||
## @(#) $Revision: 29.13 $
|
||||
## @(#) $Id: README.WINDOWS,v 29.13 2007/02/11 10:23:28 chongo Exp $
|
||||
## @(#) $Source: /usr/local/src/cmd/calc/RCS/README.WINDOWS,v $
|
||||
##
|
||||
## Under source code control: 2001/02/25 14:00:05
|
||||
|
28
addop.c
28
addop.c
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* addop - add opcodes to a function being compiled
|
||||
*
|
||||
* Copyright (C) 1999-2006 David I. Bell and Ernest Bowen
|
||||
* Copyright (C) 1999-2007 David I. Bell and Ernest Bowen
|
||||
*
|
||||
* Primary author: David I. Bell
|
||||
*
|
||||
@@ -19,8 +19,8 @@
|
||||
* 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.13 $
|
||||
* @(#) $Id: addop.c,v 29.13 2006/06/20 10:28:06 chongo Exp $
|
||||
* @(#) $Revision: 29.14 $
|
||||
* @(#) $Id: addop.c,v 29.14 2007/02/11 10:19:14 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/addop.c,v $
|
||||
*
|
||||
* Under source code control: 1990/02/15 01:48:10
|
||||
@@ -44,17 +44,17 @@
|
||||
#define OPCODEALLOCSIZE 100 /* reallocate size for opcodes in functions */
|
||||
|
||||
|
||||
static unsigned long maxopcodes;/* number of opcodes available */
|
||||
static long newindex; /* index of new function */
|
||||
static char *newname; /* name of new function */
|
||||
static long oldop; /* previous opcode */
|
||||
static long oldoldop; /* opcode before previous opcode */
|
||||
static long debugline; /* line number of latest debug opcode */
|
||||
static long funccount; /* number of functions */
|
||||
static long funcavail; /* available number of functions */
|
||||
static FUNC *functemplate; /* function definition template */
|
||||
static FUNC **functions; /* table of functions */
|
||||
static STRINGHEAD funcnames; /* function names */
|
||||
STATIC unsigned long maxopcodes;/* number of opcodes available */
|
||||
STATIC long newindex; /* index of new function */
|
||||
STATIC char *newname; /* name of new function */
|
||||
STATIC long oldop; /* previous opcode */
|
||||
STATIC long oldoldop; /* opcode before previous opcode */
|
||||
STATIC long debugline; /* line number of latest debug opcode */
|
||||
STATIC long funccount; /* number of functions */
|
||||
STATIC long funcavail; /* available number of functions */
|
||||
STATIC FUNC *functemplate; /* function definition template */
|
||||
STATIC FUNC **functions; /* table of functions */
|
||||
STATIC STRINGHEAD funcnames; /* function names */
|
||||
|
||||
|
||||
/*
|
||||
|
54
alloc.h
54
alloc.h
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* alloc - storage allocation and storage debug macros
|
||||
*
|
||||
* Copyright (C) 1999 David I. Bell
|
||||
* Copyright (C) 1999-2007 David I. Bell
|
||||
*
|
||||
* 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
|
||||
@@ -17,8 +17,8 @@
|
||||
* 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: alloc.h,v 29.4 2001/06/08 21:00:58 chongo Exp $
|
||||
* @(#) $Revision: 29.7 $
|
||||
* @(#) $Id: alloc.h,v 29.7 2007/02/12 03:57:00 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/alloc.h,v $
|
||||
*
|
||||
* Under source code control: 1990/02/15 01:48:29
|
||||
@@ -33,54 +33,38 @@
|
||||
|
||||
|
||||
#if defined(CALC_SRC) /* if we are building from the calc source tree */
|
||||
# include "have_malloc.h"
|
||||
# include "have_newstr.h"
|
||||
# include "have_string.h"
|
||||
# include "have_memmv.h"
|
||||
#else
|
||||
# include <calc/have_malloc.h>
|
||||
# include <calc/have_newstr.h>
|
||||
# include <calc/have_string.h>
|
||||
# include <calc/have_memmv.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_MALLOC_H
|
||||
# include <malloc.h>
|
||||
#else
|
||||
#if defined(FORCE_STDC) || (defined(__STDC__) && __STDC__ != 0) || defined(__cplusplus)
|
||||
extern void *malloc();
|
||||
extern void *realloc();
|
||||
extern void free();
|
||||
# else
|
||||
extern char *malloc();
|
||||
extern char *realloc();
|
||||
extern void free();
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STRING_H
|
||||
# include <string.h>
|
||||
|
||||
#else
|
||||
|
||||
# if defined(HAVE_NEWSTR)
|
||||
extern void *memcpy();
|
||||
extern void *memset();
|
||||
E_FUNC void *memcpy();
|
||||
E_FUNC void *memset();
|
||||
#if defined(FORCE_STDC) || (defined(__STDC__) && __STDC__ != 0) || defined(__cplusplus)
|
||||
extern size_t strlen();
|
||||
E_FUNC size_t strlen();
|
||||
# else
|
||||
extern long strlen();
|
||||
E_FUNC long strlen();
|
||||
# endif
|
||||
# else /* HAVE_NEWSTR */
|
||||
extern void bcopy();
|
||||
extern void bfill();
|
||||
extern char *index();
|
||||
E_FUNC void bcopy();
|
||||
E_FUNC void bfill();
|
||||
E_FUNC char *index();
|
||||
# endif /* HAVE_NEWSTR */
|
||||
extern char *strchr();
|
||||
extern char *strcpy();
|
||||
extern char *strncpy();
|
||||
extern char *strcat();
|
||||
extern int strcmp();
|
||||
E_FUNC char *strchr();
|
||||
E_FUNC char *strcpy();
|
||||
E_FUNC char *strncpy();
|
||||
E_FUNC char *strcat();
|
||||
E_FUNC int strcmp();
|
||||
|
||||
#endif
|
||||
|
||||
@@ -94,13 +78,13 @@ extern int strcmp();
|
||||
#endif /* HAVE_NEWSTR */
|
||||
|
||||
#if !defined(HAVE_MEMMOVE)
|
||||
# undef CALC_SIZE_T
|
||||
# undef MEMMOVE_SIZE_T
|
||||
#if defined(FORCE_STDC) || (defined(__STDC__) && __STDC__ != 0) || defined(__cplusplus)
|
||||
# define CALC_SIZE_T size_t
|
||||
# define MEMMOVE_SIZE_T size_t
|
||||
# else
|
||||
# define CALC_SIZE_T long
|
||||
# define MEMMOVE_SIZE_T long
|
||||
# endif
|
||||
extern void *memmove(void *s1, const void *s2, CALC_SIZE_T n);
|
||||
E_FUNC void *memmove(void *s1, CONST void *s2, MEMMOVE_SIZE_T n);
|
||||
#endif
|
||||
|
||||
#endif /* !__ALLOC_H__ */
|
||||
|
24
assocfunc.c
24
assocfunc.c
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* assocfunc - association table routines
|
||||
*
|
||||
* Copyright (C) 1999 David I. Bell
|
||||
* Copyright (C) 1999-2007 David I. Bell
|
||||
*
|
||||
* 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
|
||||
@@ -17,8 +17,8 @@
|
||||
* 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: assocfunc.c,v 29.2 2000/06/07 14:02:13 chongo Exp $
|
||||
* @(#) $Revision: 29.3 $
|
||||
* @(#) $Id: assocfunc.c,v 29.3 2007/02/11 10:19:14 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/assocfunc.c,v $
|
||||
*
|
||||
* Under source code control: 1993/07/20 23:04:27
|
||||
@@ -46,10 +46,10 @@
|
||||
#define ELEMSIZE(n) (sizeof(ASSOCELEM) + (sizeof(VALUE) * ((n) - 1)))
|
||||
|
||||
|
||||
static ASSOCELEM *elemindex(ASSOC *ap, long index);
|
||||
static BOOL compareindices(VALUE *v1, VALUE *v2, long dim);
|
||||
static void resize(ASSOC *ap, long newsize);
|
||||
static void assoc_elemfree(ASSOCELEM *ep);
|
||||
S_FUNC ASSOCELEM *elemindex(ASSOC *ap, long index);
|
||||
S_FUNC BOOL compareindices(VALUE *v1, VALUE *v2, long dim);
|
||||
S_FUNC void resize(ASSOC *ap, long newsize);
|
||||
S_FUNC void assoc_elemfree(ASSOCELEM *ep);
|
||||
|
||||
|
||||
/*
|
||||
@@ -69,7 +69,7 @@ associndex(ASSOC *ap, BOOL create, long dim, VALUE *indices)
|
||||
{
|
||||
ASSOCELEM **listhead;
|
||||
ASSOCELEM *ep;
|
||||
static VALUE val;
|
||||
STATIC VALUE val;
|
||||
QCKHASH hash;
|
||||
int i;
|
||||
|
||||
@@ -200,7 +200,7 @@ assocrsearch(ASSOC *ap, VALUE *vp, long i, long j, ZVALUE *index)
|
||||
* ap association to index into
|
||||
* index index of desired element
|
||||
*/
|
||||
static ASSOCELEM *
|
||||
S_FUNC ASSOCELEM *
|
||||
elemindex(ASSOC *ap, long index)
|
||||
{
|
||||
ASSOCELEM *ep;
|
||||
@@ -356,7 +356,7 @@ assoccopy(ASSOC *oldap)
|
||||
* This is only actually done if the growth from the previous size is
|
||||
* enough to make this worthwhile.
|
||||
*/
|
||||
static void
|
||||
S_FUNC void
|
||||
resize(ASSOC *ap, long newsize)
|
||||
{
|
||||
ASSOCELEM **oldtable;
|
||||
@@ -400,7 +400,7 @@ resize(ASSOC *ap, long newsize)
|
||||
/*
|
||||
* Free an association element, along with any contained values.
|
||||
*/
|
||||
static void
|
||||
S_FUNC void
|
||||
assoc_elemfree(ASSOCELEM *ep)
|
||||
{
|
||||
int i;
|
||||
@@ -520,7 +520,7 @@ assocprint(ASSOC *ap, long max_print)
|
||||
* Compare two lists of index values to see if they are identical.
|
||||
* Returns TRUE if they are the same.
|
||||
*/
|
||||
static BOOL
|
||||
S_FUNC BOOL
|
||||
compareindices(VALUE *v1, VALUE *v2, long dim)
|
||||
{
|
||||
int i;
|
||||
|
8
blkcpy.c
8
blkcpy.c
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* blkcpy - general values and related routines used by the calculator
|
||||
*
|
||||
* Copyright (C) 1999-2006 Landon Curt Noll and Ernest Bowen
|
||||
* Copyright (C) 1999-2007 Landon Curt Noll and Ernest Bowen
|
||||
*
|
||||
* Primary author: Landon Curt Noll
|
||||
*
|
||||
@@ -19,8 +19,8 @@
|
||||
* 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.9 $
|
||||
* @(#) $Id: blkcpy.c,v 29.9 2006/05/20 08:43:55 chongo Exp $
|
||||
* @(#) $Revision: 29.11 $
|
||||
* @(#) $Id: blkcpy.c,v 29.11 2007/02/11 10:19:14 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/blkcpy.c,v $
|
||||
*
|
||||
* Under source code control: 1997/04/18 20:41:26
|
||||
@@ -935,7 +935,7 @@ copyostr2blk(char *str,long ssi,long num,BLOCK *dblk,long dsi,BOOL noreloc)
|
||||
* s1
|
||||
*/
|
||||
void *
|
||||
memmove(void *s1, const void *s2, CALC_SIZE_T n)
|
||||
memmove(void *s1, CONST void *s2, MEMMOVE_SIZE_T n)
|
||||
{
|
||||
/*
|
||||
* firewall
|
||||
|
42
blkcpy.h
42
blkcpy.h
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* blkcpy - general values and related routines used by the calculator
|
||||
*
|
||||
* Copyright (C) 1999 Landon Curt Noll and Ernest Bowen
|
||||
* Copyright (C) 1999-2007 Landon Curt Noll and Ernest Bowen
|
||||
*
|
||||
* Primary author: Landon Curt Noll
|
||||
*
|
||||
@@ -19,8 +19,8 @@
|
||||
* 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: blkcpy.h,v 29.2 2000/06/07 14:02:13 chongo Exp $
|
||||
* @(#) $Revision: 29.3 $
|
||||
* @(#) $Id: blkcpy.h,v 29.3 2007/02/11 10:19:14 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/blkcpy.h,v $
|
||||
*
|
||||
* Under source code control: 1997/04/18 20:41:25
|
||||
@@ -36,27 +36,27 @@
|
||||
/*
|
||||
* the main copy gateway function
|
||||
*/
|
||||
extern int copystod(VALUE *, long, long, VALUE *, long);
|
||||
E_FUNC int copystod(VALUE *, long, long, VALUE *, long);
|
||||
|
||||
/*
|
||||
* specific copy functions
|
||||
*/
|
||||
extern int copyblk2blk(BLOCK *, long, long, BLOCK *, long, BOOL);
|
||||
extern int copyblk2file(BLOCK *, long, long, FILEID, long);
|
||||
extern int copyblk2mat(BLOCK *, long, long, MATRIX *, long);
|
||||
extern int copyblk2num(BLOCK *, long, long, NUMBER *, long, NUMBER **);
|
||||
extern int copyblk2str(BLOCK *, long, long, STRING *, long);
|
||||
extern int copyfile2blk(FILEID, long, long, BLOCK *, long, BOOL);
|
||||
extern int copylist2list(LIST *, long, long, LIST *, long);
|
||||
extern int copylist2mat(LIST *, long, long, MATRIX *, long);
|
||||
extern int copymat2blk(MATRIX *, long, long, BLOCK *, long, BOOL);
|
||||
extern int copymat2list(MATRIX *, long, long, LIST *, long);
|
||||
extern int copymat2mat(MATRIX *, long, long, MATRIX *, long);
|
||||
extern int copynum2blk(NUMBER *, long, long, BLOCK *, long, BOOL);
|
||||
extern int copyostr2blk(char *, long, long, BLOCK *, long, BOOL);
|
||||
extern int copyostr2str(char *, long, long, STRING *, long);
|
||||
extern int copystr2blk(STRING *, long, long, BLOCK *, long, BOOL);
|
||||
extern int copystr2file(STRING *, long, long, FILEID, long);
|
||||
extern int copystr2str(STRING *, long, long, STRING *, long);
|
||||
E_FUNC int copyblk2blk(BLOCK *, long, long, BLOCK *, long, BOOL);
|
||||
E_FUNC int copyblk2file(BLOCK *, long, long, FILEID, long);
|
||||
E_FUNC int copyblk2mat(BLOCK *, long, long, MATRIX *, long);
|
||||
E_FUNC int copyblk2num(BLOCK *, long, long, NUMBER *, long, NUMBER **);
|
||||
E_FUNC int copyblk2str(BLOCK *, long, long, STRING *, long);
|
||||
E_FUNC int copyfile2blk(FILEID, long, long, BLOCK *, long, BOOL);
|
||||
E_FUNC int copylist2list(LIST *, long, long, LIST *, long);
|
||||
E_FUNC int copylist2mat(LIST *, long, long, MATRIX *, long);
|
||||
E_FUNC int copymat2blk(MATRIX *, long, long, BLOCK *, long, BOOL);
|
||||
E_FUNC int copymat2list(MATRIX *, long, long, LIST *, long);
|
||||
E_FUNC int copymat2mat(MATRIX *, long, long, MATRIX *, long);
|
||||
E_FUNC int copynum2blk(NUMBER *, long, long, BLOCK *, long, BOOL);
|
||||
E_FUNC int copyostr2blk(char *, long, long, BLOCK *, long, BOOL);
|
||||
E_FUNC int copyostr2str(char *, long, long, STRING *, long);
|
||||
E_FUNC int copystr2blk(STRING *, long, long, BLOCK *, long, BOOL);
|
||||
E_FUNC int copystr2file(STRING *, long, long, FILEID, long);
|
||||
E_FUNC int copystr2str(STRING *, long, long, STRING *, long);
|
||||
|
||||
#endif /* !__BLKCPY_H__ */
|
||||
|
18
block.c
18
block.c
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* block - fixed, dynamic, fifo and circular memory blocks
|
||||
*
|
||||
* Copyright (C) 1999 Landon Curt Noll and Ernest Bowen
|
||||
* Copyright (C) 1999-2007 Landon Curt Noll and Ernest Bowen
|
||||
*
|
||||
* Primary author: Landon Curt Noll
|
||||
*
|
||||
@@ -19,8 +19,8 @@
|
||||
* 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.3 $
|
||||
* @(#) $Id: block.c,v 29.3 2006/05/01 19:16:57 chongo Exp $
|
||||
* @(#) $Revision: 29.4 $
|
||||
* @(#) $Id: block.c,v 29.4 2007/02/11 10:19:14 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/block.c,v $
|
||||
*
|
||||
* Under source code control: 1997/02/27 00:29:40
|
||||
@@ -42,14 +42,14 @@
|
||||
|
||||
#define NBLOCKCHUNK 16
|
||||
|
||||
static long nblockcount = 0;
|
||||
static long maxnblockcount = 0;
|
||||
static STRINGHEAD nblocknames;
|
||||
static NBLOCK **nblocks;
|
||||
STATIC long nblockcount = 0;
|
||||
STATIC long maxnblockcount = 0;
|
||||
STATIC STRINGHEAD nblocknames;
|
||||
STATIC NBLOCK **nblocks;
|
||||
|
||||
|
||||
/* forward declarations */
|
||||
static void blkchk(BLOCK*);
|
||||
S_FUNC void blkchk(BLOCK*);
|
||||
|
||||
|
||||
/*
|
||||
@@ -154,7 +154,7 @@ blk_free(BLOCK *blk)
|
||||
* if all is ok, otherwise math_error() is called and this
|
||||
* function does not return
|
||||
*/
|
||||
static void
|
||||
S_FUNC void
|
||||
blkchk(BLOCK *blk)
|
||||
{
|
||||
|
||||
|
40
block.h
40
block.h
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* block - fixed, dynamic, fifo and circular memory blocks
|
||||
*
|
||||
* Copyright (C) 1999 Landon Curt Noll and Ernest Bowen
|
||||
* Copyright (C) 1999-2007 Landon Curt Noll and Ernest Bowen
|
||||
*
|
||||
* Primary author: Landon Curt Noll
|
||||
*
|
||||
@@ -19,8 +19,8 @@
|
||||
* 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: block.h,v 29.2 2000/06/07 14:02:13 chongo Exp $
|
||||
* @(#) $Revision: 29.3 $
|
||||
* @(#) $Id: block.h,v 29.3 2007/02/11 10:19:14 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/block.h,v $
|
||||
*
|
||||
* Under source code control: 1997/02/21 05:03:39
|
||||
@@ -160,7 +160,7 @@ typedef struct nblock NBLOCK;
|
||||
/*
|
||||
* block debug
|
||||
*/
|
||||
extern int blk_debug; /* 0 => debug off */
|
||||
EXTERN int blk_debug; /* 0 => debug off */
|
||||
|
||||
|
||||
/*
|
||||
@@ -204,22 +204,22 @@ typedef USB8 OCTET;
|
||||
/*
|
||||
* external functions
|
||||
*/
|
||||
extern BLOCK *blkalloc(int, int);
|
||||
extern void blk_free(BLOCK*);
|
||||
extern BLOCK *blkrealloc(BLOCK*, int, int);
|
||||
extern void blktrunc(BLOCK*);
|
||||
extern BLOCK *blk_copy(BLOCK*);
|
||||
extern int blk_cmp(BLOCK*, BLOCK*);
|
||||
extern void blk_print(BLOCK*);
|
||||
extern void nblock_print(NBLOCK *);
|
||||
extern NBLOCK *createnblock(char *, int, int);
|
||||
extern NBLOCK *reallocnblock(int, int, int);
|
||||
extern int removenblock(int);
|
||||
extern int findnblockid(char *);
|
||||
extern NBLOCK *findnblock(int);
|
||||
extern BLOCK *copyrealloc(BLOCK*, int, int);
|
||||
extern int countnblocks(void);
|
||||
extern void shownblocks(void);
|
||||
E_FUNC BLOCK *blkalloc(int, int);
|
||||
E_FUNC void blk_free(BLOCK*);
|
||||
E_FUNC BLOCK *blkrealloc(BLOCK*, int, int);
|
||||
E_FUNC void blktrunc(BLOCK*);
|
||||
E_FUNC BLOCK *blk_copy(BLOCK*);
|
||||
E_FUNC int blk_cmp(BLOCK*, BLOCK*);
|
||||
E_FUNC void blk_print(BLOCK*);
|
||||
E_FUNC void nblock_print(NBLOCK *);
|
||||
E_FUNC NBLOCK *createnblock(char *, int, int);
|
||||
E_FUNC NBLOCK *reallocnblock(int, int, int);
|
||||
E_FUNC int removenblock(int);
|
||||
E_FUNC int findnblockid(char *);
|
||||
E_FUNC NBLOCK *findnblock(int);
|
||||
E_FUNC BLOCK *copyrealloc(BLOCK*, int, int);
|
||||
E_FUNC int countnblocks(void);
|
||||
E_FUNC void shownblocks(void);
|
||||
|
||||
|
||||
#endif /* !__BLOCK_H__ */
|
||||
|
20
calc.c
20
calc.c
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* calc - arbitrary precision calculator
|
||||
*
|
||||
* Copyright (C) 1999-2006 David I. Bell, Landon Curt Noll and Ernest Bowen
|
||||
* Copyright (C) 1999-2007 David I. Bell, Landon Curt Noll and Ernest Bowen
|
||||
*
|
||||
* Primary author: David I. Bell
|
||||
*
|
||||
@@ -19,8 +19,8 @@
|
||||
* 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.14 $
|
||||
* @(#) $Id: calc.c,v 29.14 2007/02/07 00:37:25 chongo Exp $
|
||||
* @(#) $Revision: 29.15 $
|
||||
* @(#) $Id: calc.c,v 29.15 2007/02/11 10:19:14 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/calc.c,v $
|
||||
*
|
||||
* Under source code control: 1990/02/15 01:48:11
|
||||
@@ -87,11 +87,11 @@
|
||||
|
||||
|
||||
/*
|
||||
* static definitions and functions
|
||||
* S_FUNC definitions and functions
|
||||
*/
|
||||
static void intint(int arg); /* interrupt routine */
|
||||
static int nextcp(char **cpp, int *ip, int argc, char **argv, BOOL haveendstr);
|
||||
static void set_run_state(run state);
|
||||
S_FUNC void intint(int arg); /* interrupt routine */
|
||||
S_FUNC int nextcp(char **cpp, int *ip, int argc, char **argv, BOOL haveendstr);
|
||||
S_FUNC void set_run_state(run state);
|
||||
|
||||
/*
|
||||
* Top level calculator routine.
|
||||
@@ -713,7 +713,7 @@ main(int argc, char **argv)
|
||||
* arg to keep ANSI C happy
|
||||
*/
|
||||
/*ARGSUSED*/
|
||||
static void
|
||||
S_FUNC void
|
||||
intint(int UNUSED arg)
|
||||
{
|
||||
(void) signal(SIGINT, intint);
|
||||
@@ -760,7 +760,7 @@ math_error(char *fmt, ...)
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
S_FUNC int
|
||||
nextcp(char **cpp, int *ip, int argc, char **argv, BOOL haveendstr)
|
||||
{
|
||||
char *cp;
|
||||
@@ -799,7 +799,7 @@ nextcp(char **cpp, int *ip, int argc, char **argv, BOOL haveendstr)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
S_FUNC void
|
||||
set_run_state(run state)
|
||||
{
|
||||
if (conf->calc_debug & CALCDBG_RUNSTATE)
|
||||
|
237
calc.h
237
calc.h
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* calc - definitions for calculator program
|
||||
*
|
||||
* Copyright (C) 1999-2006 David I. Bell
|
||||
* Copyright (C) 1999-2007 David I. Bell
|
||||
*
|
||||
* 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
|
||||
@@ -17,8 +17,8 @@
|
||||
* 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.19 $
|
||||
* @(#) $Id: calc.h,v 29.19 2006/08/20 15:01:30 chongo Exp $
|
||||
* @(#) $Revision: 29.21 $
|
||||
* @(#) $Id: calc.h,v 29.21 2007/02/12 03:26:23 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/calc.h,v $
|
||||
*
|
||||
* Under source code control: 1990/02/15 01:48:31
|
||||
@@ -33,11 +33,11 @@
|
||||
|
||||
#include <setjmp.h>
|
||||
#if defined(CALC_SRC) /* if we are building from the calc source tree */
|
||||
# include "win32dll.h"
|
||||
# include "decl.h"
|
||||
# include "value.h"
|
||||
# include "have_const.h"
|
||||
#else
|
||||
# include <calc/win32dll.h>
|
||||
# include <calc/decl.h>
|
||||
# include <calc/value.h>
|
||||
# include <calc/have_const.h>
|
||||
#endif
|
||||
@@ -103,141 +103,140 @@
|
||||
/*
|
||||
* File I/O routines.
|
||||
*/
|
||||
extern DLL FILEID openid(char *name, char *mode);
|
||||
extern DLL FILEID openpathid(char *name, char *mode, char *pathlist);
|
||||
extern DLL FILEID indexid(long index);
|
||||
extern DLL BOOL validid(FILEID id);
|
||||
extern DLL BOOL errorid(FILEID id);
|
||||
extern DLL BOOL eofid(FILEID id);
|
||||
extern DLL int closeid(FILEID id);
|
||||
extern DLL int getcharid(FILEID id);
|
||||
extern DLL int idprintf(FILEID id, char *fmt, int count, VALUE **vals);
|
||||
extern DLL int idfputc(FILEID id, int ch);
|
||||
extern DLL int idfputs(FILEID id, STRING *str);
|
||||
extern DLL int printid(FILEID id, int flags);
|
||||
extern DLL int flushid(FILEID id);
|
||||
extern DLL int readid(FILEID id, int flags, STRING **retptr);
|
||||
extern DLL int getloc(FILEID id, ZVALUE *loc);
|
||||
extern DLL int setloc(FILEID id, ZVALUE zpos);
|
||||
extern DLL int getsize(FILEID id, ZVALUE *size);
|
||||
extern DLL int get_device(FILEID id, ZVALUE *dev);
|
||||
extern DLL int get_inode(FILEID id, ZVALUE *ino);
|
||||
extern DLL FILEID reopenid(FILEID id, char *mode, char *name);
|
||||
extern DLL int closeall(void);
|
||||
E_FUNC FILEID openid(char *name, char *mode);
|
||||
E_FUNC FILEID openpathid(char *name, char *mode, char *pathlist);
|
||||
E_FUNC FILEID indexid(long index);
|
||||
E_FUNC BOOL validid(FILEID id);
|
||||
E_FUNC BOOL errorid(FILEID id);
|
||||
E_FUNC BOOL eofid(FILEID id);
|
||||
E_FUNC int closeid(FILEID id);
|
||||
E_FUNC int getcharid(FILEID id);
|
||||
E_FUNC int idprintf(FILEID id, char *fmt, int count, VALUE **vals);
|
||||
E_FUNC int idfputc(FILEID id, int ch);
|
||||
E_FUNC int idfputs(FILEID id, STRING *str);
|
||||
E_FUNC int printid(FILEID id, int flags);
|
||||
E_FUNC int flushid(FILEID id);
|
||||
E_FUNC int readid(FILEID id, int flags, STRING **retptr);
|
||||
E_FUNC int getloc(FILEID id, ZVALUE *loc);
|
||||
E_FUNC int setloc(FILEID id, ZVALUE zpos);
|
||||
E_FUNC int getsize(FILEID id, ZVALUE *size);
|
||||
E_FUNC int get_device(FILEID id, ZVALUE *dev);
|
||||
E_FUNC int get_inode(FILEID id, ZVALUE *ino);
|
||||
E_FUNC FILEID reopenid(FILEID id, char *mode, char *name);
|
||||
E_FUNC int closeall(void);
|
||||
|
||||
#if !defined(_WIN32)
|
||||
extern DLL int flushall(void);
|
||||
E_FUNC int flushall(void);
|
||||
#endif
|
||||
|
||||
extern DLL int idfputstr(FILEID id, char *str);
|
||||
extern DLL int rewindid(FILEID id);
|
||||
extern DLL void rewindall(void);
|
||||
extern DLL ZVALUE zfilesize(FILEID id);
|
||||
extern DLL void showfiles(void);
|
||||
extern DLL int fscanfid(FILEID id, char *fmt, int count, VALUE **vals);
|
||||
extern DLL int scanfstr(char *str, char *fmt, int count, VALUE **vals);
|
||||
extern DLL int ftellid(FILEID id, ZVALUE *res);
|
||||
extern DLL int fseekid(FILEID id, ZVALUE offset, int whence);
|
||||
extern DLL int isattyid(FILEID id);
|
||||
extern DLL int fsearch(FILEID id, char *str, ZVALUE start, ZVALUE end, ZVALUE *res);
|
||||
extern DLL int frsearch(FILEID id, char *str, ZVALUE first, ZVALUE last, ZVALUE *res);
|
||||
extern DLL void showconstants(void);
|
||||
extern DLL void freeconstant(unsigned long);
|
||||
extern DLL void freestringconstant(long);
|
||||
extern DLL void trimconstants(void);
|
||||
E_FUNC int idfputstr(FILEID id, char *str);
|
||||
E_FUNC int rewindid(FILEID id);
|
||||
E_FUNC void rewindall(void);
|
||||
E_FUNC ZVALUE zfilesize(FILEID id);
|
||||
E_FUNC void showfiles(void);
|
||||
E_FUNC int fscanfid(FILEID id, char *fmt, int count, VALUE **vals);
|
||||
E_FUNC int scanfstr(char *str, char *fmt, int count, VALUE **vals);
|
||||
E_FUNC int ftellid(FILEID id, ZVALUE *res);
|
||||
E_FUNC int fseekid(FILEID id, ZVALUE offset, int whence);
|
||||
E_FUNC int isattyid(FILEID id);
|
||||
E_FUNC int fsearch(FILEID id, char *str, ZVALUE start, ZVALUE end, ZVALUE *res);
|
||||
E_FUNC int frsearch(FILEID id, char *str, ZVALUE first, ZVALUE last, ZVALUE *res);
|
||||
E_FUNC void showconstants(void);
|
||||
E_FUNC void freeconstant(unsigned long);
|
||||
E_FUNC void freestringconstant(long);
|
||||
E_FUNC void trimconstants(void);
|
||||
|
||||
/*
|
||||
* Input routines.
|
||||
*/
|
||||
extern DLL int openstring(char *str, size_t num);
|
||||
extern DLL int openterminal(void);
|
||||
extern DLL int opensearchfile(char *name, char *pathlist, char *exten, int reopen_ok);
|
||||
extern DLL char *nextline(void);
|
||||
extern DLL int nextchar(void);
|
||||
extern DLL void reread(void);
|
||||
extern DLL void resetinput(void);
|
||||
extern DLL void setprompt(char *);
|
||||
extern DLL BOOL inputisterminal(void);
|
||||
extern DLL int inputlevel(void);
|
||||
extern DLL long calclevel(void);
|
||||
extern DLL char *inputname(void);
|
||||
extern DLL long linenumber(void);
|
||||
extern DLL void runrcfiles(void);
|
||||
extern DLL void closeinput(void);
|
||||
E_FUNC int openstring(char *str, size_t num);
|
||||
E_FUNC int openterminal(void);
|
||||
E_FUNC int opensearchfile(char *name, char *pathlist, char *exten, int reopen_ok);
|
||||
E_FUNC char *nextline(void);
|
||||
E_FUNC int nextchar(void);
|
||||
E_FUNC void reread(void);
|
||||
E_FUNC void resetinput(void);
|
||||
E_FUNC void setprompt(char *);
|
||||
E_FUNC BOOL inputisterminal(void);
|
||||
E_FUNC int inputlevel(void);
|
||||
E_FUNC long calclevel(void);
|
||||
E_FUNC char *inputname(void);
|
||||
E_FUNC long linenumber(void);
|
||||
E_FUNC void runrcfiles(void);
|
||||
E_FUNC void closeinput(void);
|
||||
|
||||
/*
|
||||
* Other routines.
|
||||
*/
|
||||
extern DLL NUMBER *constvalue(unsigned long index);
|
||||
extern DLL long addnumber(char *str);
|
||||
extern DLL long addqconstant(NUMBER *q);
|
||||
extern DLL void initstack(void);
|
||||
extern DLL void getcommands(BOOL toplevel);
|
||||
extern DLL void givehelp(char *type);
|
||||
extern DLL void libcalc_call_me_first(void);
|
||||
extern DLL void libcalc_call_me_last(void);
|
||||
extern DLL BOOL calc_tty(int fd);
|
||||
extern DLL BOOL orig_tty(int fd);
|
||||
extern DLL void showerrors(void);
|
||||
extern DLL char *calc_strdup(CONST char *);
|
||||
E_FUNC NUMBER *constvalue(unsigned long index);
|
||||
E_FUNC long addnumber(char *str);
|
||||
E_FUNC long addqconstant(NUMBER *q);
|
||||
E_FUNC void initstack(void);
|
||||
E_FUNC void getcommands(BOOL toplevel);
|
||||
E_FUNC void givehelp(char *type);
|
||||
E_FUNC void libcalc_call_me_first(void);
|
||||
E_FUNC void libcalc_call_me_last(void);
|
||||
E_FUNC BOOL calc_tty(int fd);
|
||||
E_FUNC BOOL orig_tty(int fd);
|
||||
E_FUNC void showerrors(void);
|
||||
E_FUNC char *calc_strdup(CONST char *);
|
||||
|
||||
/*
|
||||
* Initialization
|
||||
*/
|
||||
extern DLL void initialize(void);
|
||||
extern DLL void reinitialize(void);
|
||||
E_FUNC void initialize(void);
|
||||
E_FUNC void reinitialize(void);
|
||||
#if !defined (_WIN32)
|
||||
extern DLL int isatty(int tty); /* TRUE if fd is a tty */
|
||||
E_FUNC int isatty(int tty); /* TRUE if fd is a tty */
|
||||
#endif
|
||||
extern DLL char *version(void); /* return version string */
|
||||
extern DLL int post_init; /* TRUE => math_error setjmp is ready */
|
||||
E_FUNC char *version(void); /* return version string */
|
||||
EXTERN int post_init; /* TRUE => math_error setjmp is ready */
|
||||
|
||||
/*
|
||||
* global flags and definitions
|
||||
*/
|
||||
extern DLL int abortlevel; /* current level of aborts */
|
||||
extern DLL BOOL inputwait; /* TRUE if in a terminal input wait */
|
||||
extern DLL jmp_buf jmpbuf; /* for errors */
|
||||
EXTERN int abortlevel; /* current level of aborts */
|
||||
EXTERN BOOL inputwait; /* TRUE if in a terminal input wait */
|
||||
EXTERN jmp_buf jmpbuf; /* for errors */
|
||||
|
||||
extern DLL int p_flag; /* TRUE => pipe mode */
|
||||
extern DLL int q_flag; /* TRUE => don't execute rc files */
|
||||
extern DLL int u_flag; /* TRUE => unbuffer stdin and stdout */
|
||||
extern DLL int d_flag; /* TRUE => disable heading, resource_debug */
|
||||
extern DLL int c_flag; /* TRUE => continue after error if permitted */
|
||||
extern DLL int i_flag; /* TRUE => try to go interactive after error */
|
||||
extern DLL int s_flag; /* TRUE => keep args as strings for argv() */
|
||||
extern DLL long stoponerror; /* >0 => stop, <0 => continue, ==0 => use -c */
|
||||
extern DLL BOOL abort_now; /* TRUE => try to go interactive */
|
||||
EXTERN int p_flag; /* TRUE => pipe mode */
|
||||
EXTERN int q_flag; /* TRUE => don't execute rc files */
|
||||
EXTERN int u_flag; /* TRUE => unbuffer stdin and stdout */
|
||||
EXTERN int d_flag; /* TRUE => disable heading, resource_debug */
|
||||
EXTERN int c_flag; /* TRUE => continue after error if permitted */
|
||||
EXTERN int i_flag; /* TRUE => try to go interactive after error */
|
||||
E_FUNC int s_flag; /* TRUE => keep args as strings for argv() */
|
||||
EXTERN long stoponerror; /* >0 => stop, <0 => continue, ==0 => use -c */
|
||||
EXTERN BOOL abort_now; /* TRUE => try to go interactive */
|
||||
|
||||
extern DLL int argc_value; /* count of argv[] strings for argv() builtin */
|
||||
extern DLL char **argv_value; /* argv[] strings for argv() builtin */
|
||||
E_FUNC int argc_value; /* count of argv[] strings for argv() builtin */
|
||||
E_FUNC char **argv_value; /* argv[] strings for argv() builtin */
|
||||
|
||||
extern DLL char *pager; /* $PAGER or default */
|
||||
extern DLL int stdin_tty; /* TRUE if stdin is a tty */
|
||||
extern DLL int havecommands; /* TRUE if have cmd args) */
|
||||
extern DLL char *program; /* our name */
|
||||
extern DLL char *base_name; /* basename of our name */
|
||||
extern DLL char cmdbuf[]; /* command line expression */
|
||||
EXTERN char *pager; /* $PAGER or default */
|
||||
EXTERN int stdin_tty; /* TRUE if stdin is a tty */
|
||||
EXTERN int havecommands; /* TRUE if have cmd args) */
|
||||
EXTERN char *program; /* our name */
|
||||
EXTERN char *base_name; /* basename of our name */
|
||||
EXTERN char cmdbuf[]; /* command line expression */
|
||||
|
||||
extern DLL int abortlevel; /* current level of aborts */
|
||||
extern DLL BOOL inputwait; /* TRUE if in a terminal input wait */
|
||||
extern DLL VALUE *stack; /* execution stack */
|
||||
extern DLL int dumpnames; /* TRUE => dump names rather than indices */
|
||||
EXTERN int abortlevel; /* current level of aborts */
|
||||
EXTERN BOOL inputwait; /* TRUE if in a terminal input wait */
|
||||
EXTERN VALUE *stack; /* execution stack */
|
||||
EXTERN int dumpnames; /* TRUE => dump names rather than indices */
|
||||
|
||||
extern DLL char *calcpath; /* $CALCPATH or default */
|
||||
extern DLL char *calcrc; /* $CALCRC or default */
|
||||
extern DLL char *calcbindings; /* $CALCBINDINGS or default */
|
||||
extern DLL char *home; /* $HOME or default */
|
||||
extern DLL char *shell; /* $SHELL or default */
|
||||
extern DLL char *program; /* our name (argv[0]) */
|
||||
EXTERN char *calcpath; /* $CALCPATH or default */
|
||||
EXTERN char *calcrc; /* $CALCRC or default */
|
||||
EXTERN char *calcbindings; /* $CALCBINDINGS or default */
|
||||
EXTERN char *home; /* $HOME or default */
|
||||
EXTERN char *shell; /* $SHELL or default */
|
||||
|
||||
extern DLL int no_env; /* TRUE (-e) => ignore env vars on startup */
|
||||
extern DLL long errmax; /* if >= 0, error when errcount exceeds errmax */
|
||||
extern DLL int use_old_std; /* TRUE (-O) => use classic configuration */
|
||||
EXTERN int no_env; /* TRUE (-e) => ignore env vars on startup */
|
||||
EXTERN long errmax; /* if >= 0, error when errcount exceeds errmax */
|
||||
EXTERN int use_old_std; /* TRUE (-O) => use classic configuration */
|
||||
|
||||
extern DLL int allow_read; /* FALSE => dont open any files for reading */
|
||||
extern DLL int allow_write; /* FALSE => dont open any files for writing */
|
||||
extern DLL int allow_exec; /* FALSE => may not execute any commands */
|
||||
EXTERN int allow_read; /* FALSE => dont open any files for reading */
|
||||
EXTERN int allow_write; /* FALSE => dont open any files for writing */
|
||||
EXTERN int allow_exec; /* FALSE => may not execute any commands */
|
||||
|
||||
/*
|
||||
* calc startup and run state
|
||||
@@ -253,19 +252,19 @@ typedef enum {
|
||||
RUN_EXIT, /* normal exit from calc */
|
||||
RUN_EXIT_WITH_ERROR /* exit with error */
|
||||
} run;
|
||||
extern DLL run run_state;
|
||||
extern DLL char *run_state_name(run state);
|
||||
EXTERN run run_state;
|
||||
E_FUNC char *run_state_name(run state);
|
||||
|
||||
/*
|
||||
* calc version information
|
||||
*/
|
||||
#define CALC_TITLE "C-style arbitrary precision calculator"
|
||||
extern int calc_major_ver;
|
||||
extern int calc_minor_ver;
|
||||
extern int calc_major_patch;
|
||||
extern int calc_minor_patch;
|
||||
extern char *Copyright;
|
||||
extern DLL char *version(void);
|
||||
EXTERN int calc_major_ver;
|
||||
EXTERN int calc_minor_ver;
|
||||
EXTERN int calc_major_patch;
|
||||
EXTERN int calc_minor_patch;
|
||||
EXTERN char *Copyright;
|
||||
E_FUNC char *version(void);
|
||||
|
||||
|
||||
#endif /* !__CALC_H__ */
|
||||
|
114
cmath.h
114
cmath.h
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* cmath - data structures for extended precision complex arithmetic
|
||||
*
|
||||
* Copyright (C) 1999 David I. Bell
|
||||
* Copyright (C) 1999-2007 David I. Bell
|
||||
*
|
||||
* 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
|
||||
@@ -52,84 +52,84 @@ typedef struct {
|
||||
/*
|
||||
* Input, output, and conversion routines.
|
||||
*/
|
||||
extern COMPLEX *comalloc(void);
|
||||
extern COMPLEX *qqtoc(NUMBER *q1, NUMBER *q2);
|
||||
extern void comfree(COMPLEX *c);
|
||||
extern void comprint(COMPLEX *c);
|
||||
extern void cprintfr(COMPLEX *c);
|
||||
E_FUNC COMPLEX *comalloc(void);
|
||||
E_FUNC COMPLEX *qqtoc(NUMBER *q1, NUMBER *q2);
|
||||
E_FUNC void comfree(COMPLEX *c);
|
||||
E_FUNC void comprint(COMPLEX *c);
|
||||
E_FUNC void cprintfr(COMPLEX *c);
|
||||
|
||||
|
||||
/*
|
||||
* Basic numeric routines.
|
||||
*/
|
||||
|
||||
extern COMPLEX *c_add(COMPLEX *c1, COMPLEX *c2);
|
||||
extern COMPLEX *c_sub(COMPLEX *c1, COMPLEX *c2);
|
||||
extern COMPLEX *c_mul(COMPLEX *c1, COMPLEX *c2);
|
||||
extern COMPLEX *c_div(COMPLEX *c1, COMPLEX *c2);
|
||||
extern COMPLEX *c_addq(COMPLEX *c, NUMBER *q);
|
||||
extern COMPLEX *c_subq(COMPLEX *c, NUMBER *q);
|
||||
extern COMPLEX *c_mulq(COMPLEX *c, NUMBER *q);
|
||||
extern COMPLEX *c_divq(COMPLEX *c, NUMBER *q);
|
||||
extern COMPLEX *c_scale(COMPLEX *c, long i);
|
||||
extern COMPLEX *c_shift(COMPLEX *c, long i);
|
||||
extern COMPLEX *c_square(COMPLEX *c);
|
||||
extern COMPLEX *c_conj(COMPLEX *c);
|
||||
extern COMPLEX *c_real(COMPLEX *c);
|
||||
extern COMPLEX *c_imag(COMPLEX *c);
|
||||
extern COMPLEX *c_neg(COMPLEX *c);
|
||||
extern COMPLEX *c_inv(COMPLEX *c);
|
||||
extern COMPLEX *c_int(COMPLEX *c);
|
||||
extern COMPLEX *c_frac(COMPLEX *c);
|
||||
extern BOOL c_cmp(COMPLEX *c1, COMPLEX *c2);
|
||||
E_FUNC COMPLEX *c_add(COMPLEX *c1, COMPLEX *c2);
|
||||
E_FUNC COMPLEX *c_sub(COMPLEX *c1, COMPLEX *c2);
|
||||
E_FUNC COMPLEX *c_mul(COMPLEX *c1, COMPLEX *c2);
|
||||
E_FUNC COMPLEX *c_div(COMPLEX *c1, COMPLEX *c2);
|
||||
E_FUNC COMPLEX *c_addq(COMPLEX *c, NUMBER *q);
|
||||
E_FUNC COMPLEX *c_subq(COMPLEX *c, NUMBER *q);
|
||||
E_FUNC COMPLEX *c_mulq(COMPLEX *c, NUMBER *q);
|
||||
E_FUNC COMPLEX *c_divq(COMPLEX *c, NUMBER *q);
|
||||
E_FUNC COMPLEX *c_scale(COMPLEX *c, long i);
|
||||
E_FUNC COMPLEX *c_shift(COMPLEX *c, long i);
|
||||
E_FUNC COMPLEX *c_square(COMPLEX *c);
|
||||
E_FUNC COMPLEX *c_conj(COMPLEX *c);
|
||||
E_FUNC COMPLEX *c_real(COMPLEX *c);
|
||||
E_FUNC COMPLEX *c_imag(COMPLEX *c);
|
||||
E_FUNC COMPLEX *c_neg(COMPLEX *c);
|
||||
E_FUNC COMPLEX *c_inv(COMPLEX *c);
|
||||
E_FUNC COMPLEX *c_int(COMPLEX *c);
|
||||
E_FUNC COMPLEX *c_frac(COMPLEX *c);
|
||||
E_FUNC BOOL c_cmp(COMPLEX *c1, COMPLEX *c2);
|
||||
|
||||
|
||||
/*
|
||||
* More complicated functions.
|
||||
*/
|
||||
extern COMPLEX *c_powi(COMPLEX *c, NUMBER *q);
|
||||
extern NUMBER *c_ilog(COMPLEX *c, ZVALUE base);
|
||||
E_FUNC COMPLEX *c_powi(COMPLEX *c, NUMBER *q);
|
||||
E_FUNC NUMBER *c_ilog(COMPLEX *c, ZVALUE base);
|
||||
|
||||
|
||||
/*
|
||||
* Transcendental routines. These all take an epsilon argument to
|
||||
* specify how accurately these are to be calculated.
|
||||
*/
|
||||
extern COMPLEX *c_power(COMPLEX *c1, COMPLEX *c2, NUMBER *epsilon);
|
||||
extern COMPLEX *c_sqrt(COMPLEX *c, NUMBER *epsilon, long R);
|
||||
extern COMPLEX *c_root(COMPLEX *c, NUMBER *q, NUMBER *epsilon);
|
||||
extern COMPLEX *c_exp(COMPLEX *c, NUMBER *epsilon);
|
||||
extern COMPLEX *c_ln(COMPLEX *c, NUMBER *epsilon);
|
||||
extern COMPLEX *c_log(COMPLEX *c, NUMBER *epsilon);
|
||||
extern COMPLEX *c_cos(COMPLEX *c, NUMBER *epsilon);
|
||||
extern COMPLEX *c_sin(COMPLEX *c, NUMBER *epsilon);
|
||||
extern COMPLEX *c_cosh(COMPLEX *c, NUMBER *epsilon);
|
||||
extern COMPLEX *c_sinh(COMPLEX *c, NUMBER *epsilon);
|
||||
extern COMPLEX *c_polar(NUMBER *q1, NUMBER *q2, NUMBER *epsilon);
|
||||
extern COMPLEX *c_rel(COMPLEX *c1, COMPLEX *c2);
|
||||
extern COMPLEX *c_asin(COMPLEX *c, NUMBER *epsilon);
|
||||
extern COMPLEX *c_acos(COMPLEX *c, NUMBER *epsilon);
|
||||
extern COMPLEX *c_atan(COMPLEX *c, NUMBER *epsilon);
|
||||
extern COMPLEX *c_acot(COMPLEX *c, NUMBER *epsilon);
|
||||
extern COMPLEX *c_asec(COMPLEX *c, NUMBER *epsilon);
|
||||
extern COMPLEX *c_acsc(COMPLEX *c, NUMBER *epsilon);
|
||||
extern COMPLEX *c_asinh(COMPLEX *c, NUMBER *epsilon);
|
||||
extern COMPLEX *c_acosh(COMPLEX *c, NUMBER *epsilon);
|
||||
extern COMPLEX *c_atanh(COMPLEX *c, NUMBER *epsilon);
|
||||
extern COMPLEX *c_acoth(COMPLEX *c, NUMBER *epsilon);
|
||||
extern COMPLEX *c_asech(COMPLEX *c, NUMBER *epsilon);
|
||||
extern COMPLEX *c_acsch(COMPLEX *c, NUMBER *epsilon);
|
||||
extern COMPLEX *c_gd(COMPLEX *c, NUMBER *epsilon);
|
||||
extern COMPLEX *c_agd(COMPLEX *c, NUMBER *epsilon);
|
||||
E_FUNC COMPLEX *c_power(COMPLEX *c1, COMPLEX *c2, NUMBER *epsilon);
|
||||
E_FUNC COMPLEX *c_sqrt(COMPLEX *c, NUMBER *epsilon, long R);
|
||||
E_FUNC COMPLEX *c_root(COMPLEX *c, NUMBER *q, NUMBER *epsilon);
|
||||
E_FUNC COMPLEX *c_exp(COMPLEX *c, NUMBER *epsilon);
|
||||
E_FUNC COMPLEX *c_ln(COMPLEX *c, NUMBER *epsilon);
|
||||
E_FUNC COMPLEX *c_log(COMPLEX *c, NUMBER *epsilon);
|
||||
E_FUNC COMPLEX *c_cos(COMPLEX *c, NUMBER *epsilon);
|
||||
E_FUNC COMPLEX *c_sin(COMPLEX *c, NUMBER *epsilon);
|
||||
E_FUNC COMPLEX *c_cosh(COMPLEX *c, NUMBER *epsilon);
|
||||
E_FUNC COMPLEX *c_sinh(COMPLEX *c, NUMBER *epsilon);
|
||||
E_FUNC COMPLEX *c_polar(NUMBER *q1, NUMBER *q2, NUMBER *epsilon);
|
||||
E_FUNC COMPLEX *c_rel(COMPLEX *c1, COMPLEX *c2);
|
||||
E_FUNC COMPLEX *c_asin(COMPLEX *c, NUMBER *epsilon);
|
||||
E_FUNC COMPLEX *c_acos(COMPLEX *c, NUMBER *epsilon);
|
||||
E_FUNC COMPLEX *c_atan(COMPLEX *c, NUMBER *epsilon);
|
||||
E_FUNC COMPLEX *c_acot(COMPLEX *c, NUMBER *epsilon);
|
||||
E_FUNC COMPLEX *c_asec(COMPLEX *c, NUMBER *epsilon);
|
||||
E_FUNC COMPLEX *c_acsc(COMPLEX *c, NUMBER *epsilon);
|
||||
E_FUNC COMPLEX *c_asinh(COMPLEX *c, NUMBER *epsilon);
|
||||
E_FUNC COMPLEX *c_acosh(COMPLEX *c, NUMBER *epsilon);
|
||||
E_FUNC COMPLEX *c_atanh(COMPLEX *c, NUMBER *epsilon);
|
||||
E_FUNC COMPLEX *c_acoth(COMPLEX *c, NUMBER *epsilon);
|
||||
E_FUNC COMPLEX *c_asech(COMPLEX *c, NUMBER *epsilon);
|
||||
E_FUNC COMPLEX *c_acsch(COMPLEX *c, NUMBER *epsilon);
|
||||
E_FUNC COMPLEX *c_gd(COMPLEX *c, NUMBER *epsilon);
|
||||
E_FUNC COMPLEX *c_agd(COMPLEX *c, NUMBER *epsilon);
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* external functions
|
||||
*/
|
||||
extern COMPLEX *swap_b8_in_COMPLEX(COMPLEX *dest, COMPLEX *src, BOOL all);
|
||||
extern COMPLEX *swap_b16_in_COMPLEX(COMPLEX *dest, COMPLEX *src, BOOL all);
|
||||
extern COMPLEX *swap_HALF_in_COMPLEX(COMPLEX *dest, COMPLEX *src, BOOL all);
|
||||
E_FUNC COMPLEX *swap_b8_in_COMPLEX(COMPLEX *dest, COMPLEX *src, BOOL all);
|
||||
E_FUNC COMPLEX *swap_b16_in_COMPLEX(COMPLEX *dest, COMPLEX *src, BOOL all);
|
||||
E_FUNC COMPLEX *swap_HALF_in_COMPLEX(COMPLEX *dest, COMPLEX *src, BOOL all);
|
||||
|
||||
|
||||
/*
|
||||
@@ -153,7 +153,7 @@ extern COMPLEX *swap_HALF_in_COMPLEX(COMPLEX *dest, COMPLEX *src, BOOL all);
|
||||
/*
|
||||
* Pre-defined values.
|
||||
*/
|
||||
extern COMPLEX _czero_, _cone_, _conei_;
|
||||
EXTERN COMPLEX _czero_, _cone_, _conei_;
|
||||
|
||||
|
||||
#endif /* !__CMATH_H__ */
|
||||
|
188
codegen.c
188
codegen.c
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* codegen - module to generate opcodes from the input tokens
|
||||
*
|
||||
* Copyright (C) 1999-2006 David I. Bell and Ernest Bowen
|
||||
* Copyright (C) 1999-2007 David I. Bell and Ernest Bowen
|
||||
*
|
||||
* Primary author: David I. Bell
|
||||
*
|
||||
@@ -19,8 +19,8 @@
|
||||
* 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.22 $
|
||||
* @(#) $Id: codegen.c,v 29.22 2006/12/15 16:25:09 chongo Exp $
|
||||
* @(#) $Revision: 29.23 $
|
||||
* @(#) $Id: codegen.c,v 29.23 2007/02/11 10:19:14 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/codegen.c,v $
|
||||
*
|
||||
* Under source code control: 1990/02/15 01:48:13
|
||||
@@ -49,61 +49,61 @@
|
||||
# include <direct.h>
|
||||
#endif
|
||||
|
||||
static BOOL rdonce; /* TRUE => do not reread this file */
|
||||
STATIC BOOL rdonce; /* TRUE => do not reread this file */
|
||||
|
||||
FUNC *curfunc;
|
||||
|
||||
static int getsymvalue(char *name, VALUE *v_p);
|
||||
static int getfilename(char *name, size_t namelen, BOOL *once);
|
||||
static BOOL getid(char *buf);
|
||||
static void getshowstatement(void);
|
||||
static void getfunction(void);
|
||||
static void ungetfunction(void);
|
||||
static void getbody(LABEL *contlabel, LABEL *breaklabel,
|
||||
S_FUNC int getsymvalue(char *name, VALUE *v_p);
|
||||
S_FUNC int getfilename(char *name, size_t namelen, BOOL *once);
|
||||
S_FUNC BOOL getid(char *buf);
|
||||
S_FUNC void getshowstatement(void);
|
||||
S_FUNC void getfunction(void);
|
||||
S_FUNC void ungetfunction(void);
|
||||
S_FUNC void getbody(LABEL *contlabel, LABEL *breaklabel,
|
||||
LABEL *nextcaselabel, LABEL *defaultlabel);
|
||||
static int getdeclarations(int symtype);
|
||||
static int getsimpledeclaration (int symtype);
|
||||
static int getonevariable (int symtype);
|
||||
static void getstatement(LABEL *contlabel, LABEL *breaklabel,
|
||||
S_FUNC int getdeclarations(int symtype);
|
||||
S_FUNC int getsimpledeclaration (int symtype);
|
||||
S_FUNC int getonevariable (int symtype);
|
||||
S_FUNC void getstatement(LABEL *contlabel, LABEL *breaklabel,
|
||||
LABEL *nextcaselabel, LABEL *defaultlabel);
|
||||
static void getobjdeclaration(int symtype);
|
||||
static void getoneobj(long index, int symtype);
|
||||
static void getobjvars(char *name, int symtype);
|
||||
static void getmatdeclaration(int symtype);
|
||||
static void getonematrix(int symtype);
|
||||
static void creatematrix(void);
|
||||
static void getsimplebody(void);
|
||||
static void getcondition(void);
|
||||
static void getmatargs(void);
|
||||
static void getelement(void);
|
||||
static void usesymbol(char *name, int autodef);
|
||||
static void definesymbol(char *name, int symtype);
|
||||
static void getcallargs(char *name);
|
||||
static void do_changedir(void);
|
||||
static int getexprlist(void);
|
||||
static int getopassignment(void);
|
||||
static int getassignment(void);
|
||||
static int getaltcond(void);
|
||||
static int getorcond(void);
|
||||
static int getandcond(void);
|
||||
static int getrelation(void);
|
||||
static int getsum(void);
|
||||
static int getproduct(void);
|
||||
static int getorexpr(void);
|
||||
static int getandexpr(void);
|
||||
static int getshiftexpr(void);
|
||||
static int getreference(void);
|
||||
static int getincdecexpr(void);
|
||||
static int getterm(void);
|
||||
static int getidexpr(BOOL okmat, int autodef);
|
||||
static long getinitlist(void);
|
||||
S_FUNC void getobjdeclaration(int symtype);
|
||||
S_FUNC void getoneobj(long index, int symtype);
|
||||
S_FUNC void getobjvars(char *name, int symtype);
|
||||
S_FUNC void getmatdeclaration(int symtype);
|
||||
S_FUNC void getonematrix(int symtype);
|
||||
S_FUNC void creatematrix(void);
|
||||
S_FUNC void getsimplebody(void);
|
||||
S_FUNC void getcondition(void);
|
||||
S_FUNC void getmatargs(void);
|
||||
S_FUNC void getelement(void);
|
||||
S_FUNC void usesymbol(char *name, int autodef);
|
||||
S_FUNC void definesymbol(char *name, int symtype);
|
||||
S_FUNC void getcallargs(char *name);
|
||||
S_FUNC void do_changedir(void);
|
||||
S_FUNC int getexprlist(void);
|
||||
S_FUNC int getopassignment(void);
|
||||
S_FUNC int getassignment(void);
|
||||
S_FUNC int getaltcond(void);
|
||||
S_FUNC int getorcond(void);
|
||||
S_FUNC int getandcond(void);
|
||||
S_FUNC int getrelation(void);
|
||||
S_FUNC int getsum(void);
|
||||
S_FUNC int getproduct(void);
|
||||
S_FUNC int getorexpr(void);
|
||||
S_FUNC int getandexpr(void);
|
||||
S_FUNC int getshiftexpr(void);
|
||||
S_FUNC int getreference(void);
|
||||
S_FUNC int getincdecexpr(void);
|
||||
S_FUNC int getterm(void);
|
||||
S_FUNC int getidexpr(BOOL okmat, int autodef);
|
||||
S_FUNC long getinitlist(void);
|
||||
|
||||
#define INDICALLOC 8
|
||||
|
||||
static int quickindices[INDICALLOC];
|
||||
static int * newindices;
|
||||
static int * indices;
|
||||
static int maxindices;
|
||||
STATIC int quickindices[INDICALLOC];
|
||||
STATIC int * newindices;
|
||||
STATIC int * indices;
|
||||
STATIC int maxindices;
|
||||
|
||||
|
||||
/*
|
||||
@@ -289,7 +289,7 @@ evaluate(BOOL nestflag)
|
||||
/*
|
||||
* Undefine one or more functions
|
||||
*/
|
||||
static void
|
||||
S_FUNC void
|
||||
ungetfunction(void)
|
||||
{
|
||||
char *name;
|
||||
@@ -340,7 +340,7 @@ ungetfunction(void)
|
||||
* func = name '(' '' | name [ ',' name] ... ')' simplebody
|
||||
* | name '(' '' | name [ ',' name] ... ')' body.
|
||||
*/
|
||||
static void
|
||||
S_FUNC void
|
||||
getfunction(void)
|
||||
{
|
||||
char *name; /* parameter name */
|
||||
@@ -429,7 +429,7 @@ getfunction(void)
|
||||
* Get a simple assignment style body for a function declaration.
|
||||
* simplebody = '=' assignment '\n'.
|
||||
*/
|
||||
static void
|
||||
S_FUNC void
|
||||
getsimplebody(void)
|
||||
{
|
||||
(void) tokenmode(TM_NEWLINES);
|
||||
@@ -444,7 +444,7 @@ getsimplebody(void)
|
||||
* | [ declarations ] ... [statement ] ... '\n'
|
||||
*/
|
||||
/*ARGSUSED*/
|
||||
static void
|
||||
S_FUNC void
|
||||
getbody(LABEL *contlabel, LABEL *breaklabel, LABEL *nextcaselabel, LABEL *defaultlabel)
|
||||
{
|
||||
int oldmode;
|
||||
@@ -474,7 +474,7 @@ getbody(LABEL *contlabel, LABEL *breaklabel, LABEL *nextcaselabel, LABEL *defaul
|
||||
* declarations = { LOCAL | GLOBAL | STATIC } onedeclaration
|
||||
* [ ',' onedeclaration ] ... ';'.
|
||||
*/
|
||||
static int
|
||||
S_FUNC int
|
||||
getdeclarations(int symtype)
|
||||
{
|
||||
int res = 0;
|
||||
@@ -526,7 +526,7 @@ getdeclarations(int symtype)
|
||||
* Subsequences end with "," or at end of line; spaces indicate
|
||||
* repeated assignment, e.g. "c d = 2" has the effect of "c = 2, d = 2".
|
||||
*/
|
||||
static int
|
||||
S_FUNC int
|
||||
getsimpledeclaration(int symtype)
|
||||
{
|
||||
int res = 0;
|
||||
@@ -554,9 +554,9 @@ getsimpledeclaration(int symtype)
|
||||
* Get one variable in a sequence of simple identifiers.
|
||||
* Returns 1 if the subsequence in which the variable occurs ends with
|
||||
* an assignment, e.g. for the variables b, c, d, in
|
||||
* static a, b = 1, c d = 2, d;
|
||||
* S_FUNC a, b = 1, c d = 2, d;
|
||||
*/
|
||||
static int
|
||||
S_FUNC int
|
||||
getonevariable(int symtype)
|
||||
{
|
||||
char *name;
|
||||
@@ -608,7 +608,7 @@ getonevariable(int symtype)
|
||||
* nextcaselabel label for next case statement
|
||||
* defaultlabel label for default case
|
||||
*/
|
||||
static void
|
||||
S_FUNC void
|
||||
getstatement(LABEL *contlabel, LABEL *breaklabel, LABEL *nextcaselabel, LABEL *defaultlabel)
|
||||
{
|
||||
LABEL label;
|
||||
@@ -1059,7 +1059,7 @@ getstatement(LABEL *contlabel, LABEL *breaklabel, LABEL *nextcaselabel, LABEL *d
|
||||
* is an OBJ statement, otherwise this is part of a declaration which will
|
||||
* define new symbols with the specified type.
|
||||
*/
|
||||
static void
|
||||
S_FUNC void
|
||||
getobjdeclaration(int symtype)
|
||||
{
|
||||
char *name; /* name of object type */
|
||||
@@ -1165,7 +1165,7 @@ getobjdeclaration(int symtype)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
S_FUNC void
|
||||
getoneobj(long index, int symtype)
|
||||
{
|
||||
char *symname;
|
||||
@@ -1192,7 +1192,7 @@ getoneobj(long index, int symtype)
|
||||
|
||||
/*
|
||||
* Routine to assign a specified object-type value to each of a set of
|
||||
* variables in a "global", "local" or "static" declaration, or, if
|
||||
* variables in a "global", "local" or "S_FUNC" declaration, or, if
|
||||
* symtype is SYM_UNDEFINED, to create one object value of the specified
|
||||
* type.
|
||||
*
|
||||
@@ -1200,7 +1200,7 @@ getoneobj(long index, int symtype)
|
||||
* name object name
|
||||
* symtype declaration type
|
||||
*/
|
||||
static void
|
||||
S_FUNC void
|
||||
getobjvars(char *name, int symtype)
|
||||
{
|
||||
long index; /* index for object */
|
||||
@@ -1224,7 +1224,7 @@ getobjvars(char *name, int symtype)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
S_FUNC void
|
||||
getmatdeclaration(int symtype)
|
||||
{
|
||||
for (;;) {
|
||||
@@ -1244,7 +1244,7 @@ getmatdeclaration(int symtype)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
S_FUNC void
|
||||
getonematrix(int symtype)
|
||||
{
|
||||
long dim;
|
||||
@@ -1340,7 +1340,7 @@ getonematrix(int symtype)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
S_FUNC void
|
||||
creatematrix(void)
|
||||
{
|
||||
long dim;
|
||||
@@ -1398,7 +1398,7 @@ creatematrix(void)
|
||||
* Returns the number of elements that are in the list, or -1 on parse error.
|
||||
* initlist = { assignment [ , assignment ] ... }.
|
||||
*/
|
||||
static long
|
||||
S_FUNC long
|
||||
getinitlist(void)
|
||||
{
|
||||
long index;
|
||||
@@ -1454,7 +1454,7 @@ getinitlist(void)
|
||||
* Get a condition.
|
||||
* condition = '(' assignment ')'.
|
||||
*/
|
||||
static void
|
||||
S_FUNC void
|
||||
getcondition(void)
|
||||
{
|
||||
if (gettoken() != T_LEFTPAREN) {
|
||||
@@ -1478,7 +1478,7 @@ getcondition(void)
|
||||
* Returns flags describing the type of the last assignment or expression found.
|
||||
* exprlist = assignment [ ',' assignment ] ...
|
||||
*/
|
||||
static int
|
||||
S_FUNC int
|
||||
getexprlist(void)
|
||||
{
|
||||
int type;
|
||||
@@ -1511,7 +1511,7 @@ getexprlist(void)
|
||||
* | lvalue '**=' assignment
|
||||
* | orcond.
|
||||
*/
|
||||
static int
|
||||
S_FUNC int
|
||||
getopassignment(void)
|
||||
{
|
||||
int type; /* type of expression */
|
||||
@@ -1587,7 +1587,7 @@ getopassignment(void)
|
||||
* Get an assignment (lvalue = ...) or possibly just an expression
|
||||
*/
|
||||
|
||||
static int
|
||||
S_FUNC int
|
||||
getassignment (void)
|
||||
{
|
||||
int type; /* type of expression */
|
||||
@@ -1657,7 +1657,7 @@ getassignment (void)
|
||||
* Flags are returned indicating the type of expression found.
|
||||
* altcond = orcond [ '?' orcond ':' altcond ].
|
||||
*/
|
||||
static int
|
||||
S_FUNC int
|
||||
getaltcond(void)
|
||||
{
|
||||
int type; /* type of expression */
|
||||
@@ -1691,7 +1691,7 @@ getaltcond(void)
|
||||
* Flags are returned indicating the type of expression found.
|
||||
* orcond = andcond [ '||' andcond ] ...
|
||||
*/
|
||||
static int
|
||||
S_FUNC int
|
||||
getorcond(void)
|
||||
{
|
||||
int type; /* type of expression */
|
||||
@@ -1715,7 +1715,7 @@ getorcond(void)
|
||||
* Flags are returned indicating the type of expression found.
|
||||
* andcond = relation [ '&&' relation ] ...
|
||||
*/
|
||||
static int
|
||||
S_FUNC int
|
||||
getandcond(void)
|
||||
{
|
||||
int type; /* type of expression */
|
||||
@@ -1745,7 +1745,7 @@ getandcond(void)
|
||||
* | sum '>' sum
|
||||
* | sum.
|
||||
*/
|
||||
static int
|
||||
S_FUNC int
|
||||
getrelation(void)
|
||||
{
|
||||
int type; /* type of expression */
|
||||
@@ -1776,7 +1776,7 @@ getrelation(void)
|
||||
* Flags indicating the type of expression found are returned.
|
||||
* sum = product [ {'+' | '-'} product ] ...
|
||||
*/
|
||||
static int
|
||||
S_FUNC int
|
||||
getsum(void)
|
||||
{
|
||||
int type; /* type of expression found */
|
||||
@@ -1819,7 +1819,7 @@ getsum(void)
|
||||
* Flags indicating the type of expression found are returned.
|
||||
* product = orexpr [ {'*' | '/' | '//' | '%'} orexpr ] ...
|
||||
*/
|
||||
static int
|
||||
S_FUNC int
|
||||
getproduct(void)
|
||||
{
|
||||
int type; /* type of value found */
|
||||
@@ -1850,7 +1850,7 @@ getproduct(void)
|
||||
* Flags indicating the type of expression found are returned.
|
||||
* orexpr = andexpr [ '|' andexpr ] ...
|
||||
*/
|
||||
static int
|
||||
S_FUNC int
|
||||
getorexpr(void)
|
||||
{
|
||||
int type; /* type of value found */
|
||||
@@ -1873,7 +1873,7 @@ getorexpr(void)
|
||||
* Flags indicating the type of expression found are returned.
|
||||
* andexpr = shiftexpr [ '&' shiftexpr ] ...
|
||||
*/
|
||||
static int
|
||||
S_FUNC int
|
||||
getandexpr(void)
|
||||
{
|
||||
int type; /* type of value found */
|
||||
@@ -1912,7 +1912,7 @@ getandexpr(void)
|
||||
* | reference '>>' shiftexpr
|
||||
* | reference.
|
||||
*/
|
||||
static int
|
||||
S_FUNC int
|
||||
getshiftexpr(void)
|
||||
{
|
||||
int type; /* type of value found */
|
||||
@@ -1956,7 +1956,7 @@ getshiftexpr(void)
|
||||
* address = '&' term
|
||||
* dereference = '*' term
|
||||
*/
|
||||
static int
|
||||
S_FUNC int
|
||||
getreference(void)
|
||||
{
|
||||
int type;
|
||||
@@ -1993,7 +1993,7 @@ getreference(void)
|
||||
* get an increment or decrement expression
|
||||
* ++expr, --expr, expr++, expr--
|
||||
*/
|
||||
static int
|
||||
S_FUNC int
|
||||
getincdecexpr(void)
|
||||
{
|
||||
int type;
|
||||
@@ -2051,7 +2051,7 @@ getincdecexpr(void)
|
||||
* | function [ '(' [assignment [',' assignment] ] ')' ]
|
||||
* | '!' term
|
||||
*/
|
||||
static int
|
||||
S_FUNC int
|
||||
getterm(void)
|
||||
{
|
||||
int type; /* type of term found */
|
||||
@@ -2211,7 +2211,7 @@ getterm(void)
|
||||
* element references. The symbol can be a global or a local variable name.
|
||||
* Returns the type of expression found.
|
||||
*/
|
||||
static int
|
||||
S_FUNC int
|
||||
getidexpr(BOOL okmat, int autodef)
|
||||
{
|
||||
int type;
|
||||
@@ -2286,7 +2286,7 @@ getidexpr(BOOL okmat, int autodef)
|
||||
* to get the value of a symbol. It should NOT be used in the
|
||||
* general op code generation / calc code parsing case.
|
||||
*/
|
||||
static int
|
||||
S_FUNC int
|
||||
getsymvalue(char *name, VALUE *v_p)
|
||||
{
|
||||
GLOBAL *g_ret; /* global return from findglobal() */
|
||||
@@ -2319,7 +2319,7 @@ getsymvalue(char *name, VALUE *v_p)
|
||||
* namelen length of filename buffer including NUL byte
|
||||
* once non-NULL => set to TRUE of -once read
|
||||
*/
|
||||
static int
|
||||
S_FUNC int
|
||||
getfilename(char *name, size_t namelen, BOOL *once)
|
||||
{
|
||||
STRING *s;
|
||||
@@ -2401,7 +2401,7 @@ getfilename(char *name, size_t namelen, BOOL *once)
|
||||
/*
|
||||
* Read the show command to display useful information
|
||||
*/
|
||||
static void
|
||||
S_FUNC void
|
||||
getshowstatement(void)
|
||||
{
|
||||
char name[5];
|
||||
@@ -2472,7 +2472,7 @@ getshowstatement(void)
|
||||
* Read in a set of matrix index arguments, surrounded with square brackets.
|
||||
* This also handles double square brackets for 'fast indexing'.
|
||||
*/
|
||||
static void
|
||||
S_FUNC void
|
||||
getmatargs(void)
|
||||
{
|
||||
int dim;
|
||||
@@ -2534,7 +2534,7 @@ getmatargs(void)
|
||||
* Get an element of an object reference.
|
||||
* The leading period which introduces the element has already been read.
|
||||
*/
|
||||
static void
|
||||
S_FUNC void
|
||||
getelement(void)
|
||||
{
|
||||
long index;
|
||||
@@ -2555,7 +2555,7 @@ getelement(void)
|
||||
* Read in a single symbol name and copy its value into the given buffer.
|
||||
* Returns TRUE if a valid symbol id was found.
|
||||
*/
|
||||
static BOOL
|
||||
S_FUNC BOOL
|
||||
getid(char *buf)
|
||||
{
|
||||
int type;
|
||||
@@ -2587,7 +2587,7 @@ getid(char *buf)
|
||||
* redeclared and when in the same body the variable will be accessible only
|
||||
^ with the appropriate specfier.
|
||||
*/
|
||||
static void
|
||||
S_FUNC void
|
||||
definesymbol(char *name, int symtype)
|
||||
{
|
||||
switch (symboltype(name)) {
|
||||
@@ -2650,7 +2650,7 @@ definesymbol(char *name, int symtype)
|
||||
* autodef 1 => define if symbol is not known
|
||||
* T_GLOBAL => get global, define if necessary
|
||||
*/
|
||||
static void
|
||||
S_FUNC void
|
||||
usesymbol(char *name, int autodef)
|
||||
{
|
||||
int type;
|
||||
@@ -2707,7 +2707,7 @@ usesymbol(char *name, int autodef)
|
||||
* given:
|
||||
* name name of function
|
||||
*/
|
||||
static void
|
||||
S_FUNC void
|
||||
getcallargs(char *name)
|
||||
{
|
||||
long index; /* function index */
|
||||
@@ -2776,7 +2776,7 @@ getcallargs(char *name)
|
||||
/*
|
||||
* Change the current directory. If no directory is given, assume home.
|
||||
*/
|
||||
static void
|
||||
S_FUNC void
|
||||
do_changedir(void)
|
||||
{
|
||||
char *p;
|
||||
|
14
comfunc.c
14
comfunc.c
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* comfunc - extended precision complex arithmetic non-primitive routines
|
||||
*
|
||||
* Copyright (C) 1999 David I. Bell and Ernest Bowen
|
||||
* Copyright (C) 1999-2007 David I. Bell and Ernest Bowen
|
||||
*
|
||||
* Primary author: David I. Bell
|
||||
*
|
||||
@@ -19,8 +19,8 @@
|
||||
* 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.6 $
|
||||
* @(#) $Id: comfunc.c,v 29.6 2006/05/20 08:43:55 chongo Exp $
|
||||
* @(#) $Revision: 29.7 $
|
||||
* @(#) $Id: comfunc.c,v 29.7 2007/02/11 10:19:14 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/comfunc.c,v $
|
||||
*
|
||||
* Under source code control: 1990/02/15 01:48:13
|
||||
@@ -36,10 +36,10 @@
|
||||
/*
|
||||
* cache the natural logarithm of 10
|
||||
*/
|
||||
static COMPLEX *cln_10 = NULL;
|
||||
static NUMBER *cln_10_epsilon = NULL;
|
||||
static NUMBER _q10_ = { { _tenval_, 1, 0 }, { _oneval_, 1, 0 }, 1, NULL };
|
||||
static NUMBER _q0_ = { { _zeroval_, 1, 0 }, { _oneval_, 1, 0 }, 1, NULL };
|
||||
STATIC COMPLEX *cln_10 = NULL;
|
||||
STATIC NUMBER *cln_10_epsilon = NULL;
|
||||
STATIC NUMBER _q10_ = { { _tenval_, 1, 0 }, { _oneval_, 1, 0 }, 1, NULL };
|
||||
STATIC NUMBER _q0_ = { { _zeroval_, 1, 0 }, { _oneval_, 1, 0 }, 1, NULL };
|
||||
COMPLEX _cten_ = { &_q10_, &_q0_, 1 };
|
||||
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* commath - extended precision complex arithmetic primitive routines
|
||||
*
|
||||
* Copyright (C) 1999 David I. Bell
|
||||
* Copyright (C) 1999-2007 David I. Bell
|
||||
*
|
||||
* 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
|
||||
@@ -17,8 +17,8 @@
|
||||
* 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: commath.c,v 29.4 2005/10/18 10:43:49 chongo Exp $
|
||||
* @(#) $Revision: 29.5 $
|
||||
* @(#) $Id: commath.c,v 29.5 2007/02/11 10:19:14 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/commath.c,v $
|
||||
*
|
||||
* Under source code control: 1990/02/15 01:48:10
|
||||
@@ -35,7 +35,7 @@ COMPLEX _czero_ = { &_qzero_, &_qzero_, 1 };
|
||||
COMPLEX _cone_ = { &_qone_, &_qzero_, 1 };
|
||||
COMPLEX _conei_ = { &_qzero_, &_qone_, 1 };
|
||||
|
||||
static COMPLEX _cnegone_ = { &_qnegone_, &_qzero_, 1 };
|
||||
STATIC COMPLEX _cnegone_ = { &_qnegone_, &_qzero_, 1 };
|
||||
|
||||
|
||||
/*
|
||||
|
28
config.c
28
config.c
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* config - configuration routines
|
||||
*
|
||||
* Copyright (C) 1999-2006 David I. Bell and Landon Curt Noll
|
||||
* Copyright (C) 1999-2007 David I. Bell and Landon Curt Noll
|
||||
*
|
||||
* Primary author: David I. Bell
|
||||
*
|
||||
@@ -19,8 +19,8 @@
|
||||
* 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.23 $
|
||||
* @(#) $Id: config.c,v 29.23 2006/12/15 16:17:18 chongo Exp $
|
||||
* @(#) $Revision: 29.24 $
|
||||
* @(#) $Id: config.c,v 29.24 2007/02/11 10:19:14 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/config.c,v $
|
||||
*
|
||||
* Under source code control: 1991/07/20 00:21:56
|
||||
@@ -261,7 +261,7 @@ CONFIG *conf = NULL; /* loaded in at startup - current configuration */
|
||||
/*
|
||||
* Possible output modes.
|
||||
*/
|
||||
static NAMETYPE modes[] = {
|
||||
STATIC NAMETYPE modes[] = {
|
||||
{"fraction", MODE_FRAC},
|
||||
{"frac", MODE_FRAC},
|
||||
{"integer", MODE_INT},
|
||||
@@ -286,7 +286,7 @@ static NAMETYPE modes[] = {
|
||||
/*
|
||||
* Possible block base output modes
|
||||
*/
|
||||
static NAMETYPE blk_base[] = {
|
||||
STATIC NAMETYPE blk_base[] = {
|
||||
{"hexadecimal", BLK_BASE_HEX},
|
||||
{"hex", BLK_BASE_HEX},
|
||||
{"default", BLK_BASE_HEX},
|
||||
@@ -305,7 +305,7 @@ static NAMETYPE blk_base[] = {
|
||||
/*
|
||||
* Possible block output formats
|
||||
*/
|
||||
static NAMETYPE blk_fmt[] = {
|
||||
STATIC NAMETYPE blk_fmt[] = {
|
||||
{"lines", BLK_FMT_LINE},
|
||||
{"line", BLK_FMT_LINE},
|
||||
{"strings", BLK_FMT_STRING},
|
||||
@@ -325,7 +325,7 @@ static NAMETYPE blk_fmt[] = {
|
||||
/*
|
||||
* Possible ctrl_d styles
|
||||
*/
|
||||
static NAMETYPE ctrl_d[] = {
|
||||
STATIC NAMETYPE ctrl_d[] = {
|
||||
{"virgin_eof", CTRL_D_VIRGIN_EOF},
|
||||
{"virgineof", CTRL_D_VIRGIN_EOF},
|
||||
{"virgin", CTRL_D_VIRGIN_EOF},
|
||||
@@ -345,7 +345,7 @@ static NAMETYPE ctrl_d[] = {
|
||||
*/
|
||||
#define TRUE_STRING "true"
|
||||
#define FALSE_STRING "false"
|
||||
static NAMETYPE truth[] = {
|
||||
STATIC NAMETYPE truth[] = {
|
||||
{TRUE_STRING, TRUE},
|
||||
{"t", TRUE},
|
||||
{"on", TRUE},
|
||||
@@ -367,9 +367,9 @@ static NAMETYPE truth[] = {
|
||||
/*
|
||||
* declare static functions
|
||||
*/
|
||||
static long lookup_long(NAMETYPE *set, char *name);
|
||||
static char *lookup_name(NAMETYPE *set, long val);
|
||||
static int getlen(VALUE *vp, LEN *lp);
|
||||
S_FUNC long lookup_long(NAMETYPE *set, char *name);
|
||||
S_FUNC char *lookup_name(NAMETYPE *set, long val);
|
||||
S_FUNC int getlen(VALUE *vp, LEN *lp);
|
||||
|
||||
|
||||
/*
|
||||
@@ -403,7 +403,7 @@ configtype(char *name)
|
||||
* returns:
|
||||
* numeric value of the name or -1 if not found
|
||||
*/
|
||||
static long
|
||||
S_FUNC long
|
||||
lookup_long(NAMETYPE *set, char *name)
|
||||
{
|
||||
NAMETYPE *cp; /* current config pointer */
|
||||
@@ -426,7 +426,7 @@ lookup_long(NAMETYPE *set, char *name)
|
||||
* returns:
|
||||
* name of the value found of NULL
|
||||
*/
|
||||
static char *
|
||||
S_FUNC char *
|
||||
lookup_name(NAMETYPE *set, long val)
|
||||
{
|
||||
NAMETYPE *cp; /* current config pointer */
|
||||
@@ -446,7 +446,7 @@ lookup_name(NAMETYPE *set, long val)
|
||||
* Return: 1 ==> not an integer, 2 ==> int > 2^31, 0 ==> OK, -1 ==> error
|
||||
*/
|
||||
|
||||
static int
|
||||
S_FUNC int
|
||||
getlen(VALUE *vp, LEN *lp)
|
||||
{
|
||||
if (vp->v_type != V_NUM || !qisint(vp->v_num))
|
||||
|
34
config.h
34
config.h
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* config - configuration routines
|
||||
*
|
||||
* Copyright (C) 1999-2004 Landon Curt Noll and David I. Bell
|
||||
* Copyright (C) 1999-2007 Landon Curt Noll and David I. Bell
|
||||
*
|
||||
* Primary author: Landon Curt Noll
|
||||
*
|
||||
@@ -19,8 +19,8 @@
|
||||
* 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.21 $
|
||||
* @(#) $Id: config.h,v 29.21 2006/12/15 16:16:59 chongo Exp $
|
||||
* @(#) $Revision: 29.22 $
|
||||
* @(#) $Id: config.h,v 29.22 2007/02/11 10:19:14 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/config.h,v $
|
||||
*
|
||||
* Under source code control: 1995/11/01 22:20:17
|
||||
@@ -36,11 +36,11 @@
|
||||
|
||||
|
||||
#if defined(CALC_SRC) /* if we are building from the calc source tree */
|
||||
# include "win32dll.h"
|
||||
# include "decl.h"
|
||||
# include "nametype.h"
|
||||
# include "qmath.h"
|
||||
#else
|
||||
# include <calc/win32dll.h>
|
||||
# include <calc/decl.h>
|
||||
# include <calc/nametype.h>
|
||||
# include <calc/qmath.h>
|
||||
#endif
|
||||
@@ -206,23 +206,23 @@ typedef struct config CONFIG;
|
||||
/*
|
||||
* global configuration states and aliases
|
||||
*/
|
||||
extern DLL CONFIG *conf; /* current configuration */
|
||||
extern DLL CONFIG oldstd; /* old classic standard configuration */
|
||||
extern DLL CONFIG newstd; /* default compatible configuration */
|
||||
extern DLL char *calc_debug; /* !=NULL => value of config("calc_debug") */
|
||||
extern DLL char *resource_debug; /* !=NULL => config("resource_debug") value */
|
||||
extern DLL char *user_debug; /* !=NULL => value of config("user_debug") */
|
||||
EXTERN CONFIG *conf; /* current configuration */
|
||||
EXTERN CONFIG oldstd; /* old classic standard configuration */
|
||||
EXTERN CONFIG newstd; /* default compatible configuration */
|
||||
E_FUNC char *calc_debug; /* !=NULL => value of config("calc_debug") */
|
||||
E_FUNC char *resource_debug; /* !=NULL => config("resource_debug") value */
|
||||
E_FUNC char *user_debug; /* !=NULL => value of config("user_debug") */
|
||||
|
||||
|
||||
/*
|
||||
* configuration externals
|
||||
*/
|
||||
extern DLL CONFIG *config_copy(CONFIG *src);
|
||||
extern DLL void config_free(CONFIG *cfg);
|
||||
extern DLL void config_print(CONFIG *cfg);
|
||||
extern DLL int configtype(char*);
|
||||
extern DLL void config_print(CONFIG*);
|
||||
extern DLL BOOL config_cmp(CONFIG*, CONFIG*);
|
||||
E_FUNC CONFIG *config_copy(CONFIG *src);
|
||||
E_FUNC void config_free(CONFIG *cfg);
|
||||
E_FUNC void config_print(CONFIG *cfg);
|
||||
E_FUNC int configtype(char*);
|
||||
E_FUNC void config_print(CONFIG*);
|
||||
E_FUNC BOOL config_cmp(CONFIG*, CONFIG*);
|
||||
|
||||
|
||||
#endif /* !__CONFIG_H__ */
|
||||
|
12
const.c
12
const.c
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* const - constant number storage module
|
||||
*
|
||||
* Copyright (C) 1999-2004 David I. Bell
|
||||
* Copyright (C) 1999-2007 David I. Bell
|
||||
*
|
||||
* 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
|
||||
@@ -17,8 +17,8 @@
|
||||
* 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: const.c,v 29.4 2004/02/23 14:04:01 chongo Exp $
|
||||
* @(#) $Revision: 29.5 $
|
||||
* @(#) $Id: const.c,v 29.5 2007/02/11 10:19:14 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/const.c,v $
|
||||
*
|
||||
* Under source code control: 1990/02/15 01:48:14
|
||||
@@ -34,9 +34,9 @@
|
||||
|
||||
#define CONSTALLOCSIZE 400 /* number of constants to allocate */
|
||||
|
||||
static unsigned long constcount;/* number of constants defined */
|
||||
static long constavail; /* number of constants available */
|
||||
static NUMBER **consttable; /* table of constants */
|
||||
STATIC unsigned long constcount;/* number of constants defined */
|
||||
STATIC long constavail; /* number of constants available */
|
||||
STATIC NUMBER **consttable; /* table of constants */
|
||||
|
||||
|
||||
void
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#!/usr/local/src/cmd/calc/calc -q -f
|
||||
#!/usr/local/src/cmd/calc/calc -q -s -f
|
||||
/*
|
||||
* 4dsphere - determine if 6 points lie on the surface of a sphere in R^4
|
||||
*
|
||||
@@ -26,8 +26,8 @@
|
||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* @(#) $Revision: 1.4 $
|
||||
* @(#) $Id: 4dsphere.calc,v 1.4 2007/02/07 00:34:04 chongo Exp $
|
||||
* @(#) $Revision: 1.5 $
|
||||
* @(#) $Id: 4dsphere.calc,v 1.5 2007/02/11 10:05:56 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/cscript/RCS/4dsphere.calc,v $
|
||||
*
|
||||
* Under source code control: 2001/05/03 19:02:03
|
||||
|
@@ -17,8 +17,8 @@
|
||||
# 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.31 $
|
||||
# @(#) $Id: Makefile,v 29.31 2007/02/07 01:43:56 chongo Exp $
|
||||
# @(#) $Revision: 29.32 $
|
||||
# @(#) $Id: Makefile,v 29.32 2007/02/08 21:21:25 chongo Exp $
|
||||
# @(#) $Source: /usr/local/src/cmd/calc/cscript/RCS/Makefile,v $
|
||||
#
|
||||
# Under source code control: 1999/11/29 11:10:26
|
||||
@@ -400,7 +400,7 @@ install: all
|
||||
else \
|
||||
${RM} -f ${T}${SCRIPTDIR}/$$i.new; \
|
||||
${CP} -f $$i ${T}${SCRIPTDIR}/$$i.new; \
|
||||
${CHMOD} 0555 ${T}${SCRIPTDIR}/$$i.new; \
|
||||
${CHMOD} 0755 ${T}${SCRIPTDIR}/$$i.new; \
|
||||
${MV} -f ${T}${SCRIPTDIR}/$$i.new ${T}${SCRIPTDIR}/$$i; \
|
||||
echo "installed ${T}${SCRIPTDIR}/$$i"; \
|
||||
fi; \
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#!/usr/local/src/cmd/calc/calc -q -f
|
||||
#!/usr/local/src/cmd/calc/calc -q -s -f
|
||||
/*
|
||||
* fproduct - write the big Endian product of terms to a file
|
||||
*
|
||||
@@ -24,8 +24,8 @@
|
||||
* 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.3 $
|
||||
* @(#) $Id: fproduct.calc,v 29.3 2007/02/07 00:34:04 chongo Exp $
|
||||
* @(#) $Revision: 29.4 $
|
||||
* @(#) $Id: fproduct.calc,v 29.4 2007/02/11 10:05:56 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/cscript/RCS/fproduct.calc,v $
|
||||
*
|
||||
* Under source code control: 2001/04/07 20:13:11
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#!/usr/local/src/cmd/calc/calc -q -f
|
||||
#!/usr/local/src/cmd/calc/calc -q -s -f
|
||||
/*
|
||||
* mersenne - print the value of a mersenne number
|
||||
*
|
||||
@@ -18,8 +18,8 @@
|
||||
* 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: mersenne.calc,v 29.4 2007/02/07 00:34:04 chongo Exp $
|
||||
* @(#) $Revision: 29.5 $
|
||||
* @(#) $Id: mersenne.calc,v 29.5 2007/02/11 10:05:56 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/cscript/RCS/mersenne.calc,v $
|
||||
*
|
||||
* Under source code control: 1999/11/30 00:09:01;
|
||||
|
@@ -1,4 +1,4 @@
|
||||
#!/usr/local/src/cmd/calc/calc -q -f
|
||||
#!/usr/local/src/cmd/calc/calc -q -s -f
|
||||
/*
|
||||
* powerterm - print the argument as a sum of powers of integers
|
||||
*
|
||||
@@ -24,8 +24,8 @@
|
||||
* 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.7 $
|
||||
* @(#) $Id: powerterm.calc,v 29.7 2007/02/07 00:34:04 chongo Exp $
|
||||
* @(#) $Revision: 29.8 $
|
||||
* @(#) $Id: powerterm.calc,v 29.8 2007/02/11 10:05:56 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/cscript/RCS/powerterm.calc,v $
|
||||
*
|
||||
* Under source code control: 2001/04/24 23:49:11
|
||||
|
16
custom.h
16
custom.h
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* custom - interface for custom software and hardware interfaces
|
||||
*
|
||||
* Copyright (C) 1999 Landon Curt Noll
|
||||
* Copyright (C) 1999-2007 Landon Curt Noll
|
||||
*
|
||||
* Calc is open software; you can redistribute it and/or modify it under
|
||||
* the terms of the version 2.1 of the GNU Lesser General Public License
|
||||
@@ -17,8 +17,8 @@
|
||||
* 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.3 $
|
||||
* @(#) $Id: custom.h,v 29.3 2004/02/25 23:54:40 chongo Exp $
|
||||
* @(#) $Revision: 29.4 $
|
||||
* @(#) $Id: custom.h,v 29.4 2007/02/11 10:19:14 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/custom.h,v $
|
||||
*
|
||||
* Under source code control: 1997/03/03 04:53:08
|
||||
@@ -71,10 +71,10 @@ struct custom {
|
||||
*
|
||||
* These are the required interfaces. The dummy.c stubs these interfaces too.
|
||||
*/
|
||||
extern VALUE custom(char*, int, VALUE**); /* master custom interface */
|
||||
extern BOOL allow_custom; /* TRUE => custom builtins allowed */
|
||||
extern void showcustom(void); /* print custom functions */
|
||||
extern void customhelp(char *); /* direct custom help */
|
||||
extern CONST struct custom cust[]; /* custom interface table */
|
||||
E_FUNC VALUE custom(char*, int, VALUE**); /* master custom interface */
|
||||
EXTERN BOOL allow_custom; /* TRUE => custom builtins allowed */
|
||||
E_FUNC void showcustom(void); /* print custom functions */
|
||||
E_FUNC void customhelp(char *); /* direct custom help */
|
||||
EXTERN CONST struct custom cust[]; /* custom interface table */
|
||||
|
||||
#endif /* !CUSTOM_H */
|
||||
|
@@ -480,18 +480,18 @@ Step 6: Register the function in the custom interface table
|
||||
*
|
||||
* Declare custom functions as follows:
|
||||
*
|
||||
* extern VALUE c_xyz(char*, int, VALUE**);
|
||||
* E_FUNC VALUE c_xyz(char*, int, VALUE**);
|
||||
*
|
||||
* We suggest that you sort the entries below by name.
|
||||
*/
|
||||
extern VALUE c_argv(char*, int, VALUE**);
|
||||
extern VALUE c_devnull(char*, int, VALUE**);
|
||||
extern VALUE c_help(char*, int, VALUE**);
|
||||
extern VALUE c_sysinfo(char*, int, VALUE**);
|
||||
E_FUNC VALUE c_argv(char*, int, VALUE**);
|
||||
E_FUNC VALUE c_devnull(char*, int, VALUE**);
|
||||
E_FUNC VALUE c_help(char*, int, VALUE**);
|
||||
E_FUNC VALUE c_sysinfo(char*, int, VALUE**);
|
||||
|
||||
For u_curds we would add the line:
|
||||
|
||||
extern VALUE u_curds(char*, int, VALUE**);
|
||||
E_FUNC VALUE u_curds(char*, int, VALUE**);
|
||||
|
||||
|
||||
Step 7: Add the required information to the custom/Makefile
|
||||
@@ -631,7 +631,7 @@ Step 12: Contribute
|
||||
and consider submitting your custom function for possible
|
||||
inclusion in later versions of calc.
|
||||
|
||||
## Copyright (C) 1999-2004 Landon Curt Noll
|
||||
## Copyright (C) 1999-2007 Landon Curt Noll
|
||||
##
|
||||
## Calc is open software; you can redistribute it and/or modify it under
|
||||
## the terms of the version 2.1 of the GNU Lesser General Public License
|
||||
@@ -647,8 +647,8 @@ Step 12: Contribute
|
||||
## 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.5 $
|
||||
## @(#) $Id: HOW_TO_ADD,v 29.5 2005/10/18 11:18:34 chongo Exp $
|
||||
## @(#) $Revision: 29.6 $
|
||||
## @(#) $Id: HOW_TO_ADD,v 29.6 2007/02/11 10:22:46 chongo Exp $
|
||||
## @(#) $Source: /usr/local/src/cmd/calc/custom/RCS/HOW_TO_ADD,v $
|
||||
##
|
||||
## Under source code control: 1997/03/10 03:03:21
|
||||
|
@@ -18,8 +18,8 @@
|
||||
# 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.29 $
|
||||
# @(#) $Id: Makefile,v 29.29 2006/09/18 13:13:25 chongo Exp $
|
||||
# @(#) $Revision: 29.31 $
|
||||
# @(#) $Id: Makefile,v 29.31 2007/02/12 04:19:17 chongo Exp $
|
||||
# @(#) $Source: /usr/local/src/cmd/calc/custom/RCS/Makefile,v $
|
||||
#
|
||||
# Under source code control: 1997/03/09 02:28:54
|
||||
@@ -845,10 +845,10 @@ c_argv.o: ../calcerr.h
|
||||
c_argv.o: ../cmath.h
|
||||
c_argv.o: ../config.h
|
||||
c_argv.o: ../custom.h
|
||||
c_argv.o: ../decl.h
|
||||
c_argv.o: ../endian_calc.h
|
||||
c_argv.o: ../hash.h
|
||||
c_argv.o: ../have_const.h
|
||||
c_argv.o: ../have_malloc.h
|
||||
c_argv.o: ../have_memmv.h
|
||||
c_argv.o: ../have_newstr.h
|
||||
c_argv.o: ../have_stdlib.h
|
||||
@@ -862,7 +862,6 @@ c_argv.o: ../shs.h
|
||||
c_argv.o: ../shs1.h
|
||||
c_argv.o: ../string.h
|
||||
c_argv.o: ../value.h
|
||||
c_argv.o: ../win32dll.h
|
||||
c_argv.o: ../zmath.h
|
||||
c_argv.o: c_argv.c
|
||||
c_devnull.o: ../alloc.h
|
||||
@@ -872,10 +871,10 @@ c_devnull.o: ../calcerr.h
|
||||
c_devnull.o: ../cmath.h
|
||||
c_devnull.o: ../config.h
|
||||
c_devnull.o: ../custom.h
|
||||
c_devnull.o: ../decl.h
|
||||
c_devnull.o: ../endian_calc.h
|
||||
c_devnull.o: ../hash.h
|
||||
c_devnull.o: ../have_const.h
|
||||
c_devnull.o: ../have_malloc.h
|
||||
c_devnull.o: ../have_memmv.h
|
||||
c_devnull.o: ../have_newstr.h
|
||||
c_devnull.o: ../have_stdlib.h
|
||||
@@ -889,7 +888,6 @@ c_devnull.o: ../shs.h
|
||||
c_devnull.o: ../shs1.h
|
||||
c_devnull.o: ../string.h
|
||||
c_devnull.o: ../value.h
|
||||
c_devnull.o: ../win32dll.h
|
||||
c_devnull.o: ../zmath.h
|
||||
c_devnull.o: c_devnull.c
|
||||
c_help.o: ../alloc.h
|
||||
@@ -899,10 +897,10 @@ c_help.o: ../calcerr.h
|
||||
c_help.o: ../cmath.h
|
||||
c_help.o: ../config.h
|
||||
c_help.o: ../custom.h
|
||||
c_help.o: ../decl.h
|
||||
c_help.o: ../endian_calc.h
|
||||
c_help.o: ../hash.h
|
||||
c_help.o: ../have_const.h
|
||||
c_help.o: ../have_malloc.h
|
||||
c_help.o: ../have_memmv.h
|
||||
c_help.o: ../have_newstr.h
|
||||
c_help.o: ../have_stdlib.h
|
||||
@@ -916,7 +914,6 @@ c_help.o: ../shs.h
|
||||
c_help.o: ../shs1.h
|
||||
c_help.o: ../string.h
|
||||
c_help.o: ../value.h
|
||||
c_help.o: ../win32dll.h
|
||||
c_help.o: ../zmath.h
|
||||
c_help.o: c_help.c
|
||||
c_pmodm127.o: ../alloc.h
|
||||
@@ -926,10 +923,10 @@ c_pmodm127.o: ../calcerr.h
|
||||
c_pmodm127.o: ../cmath.h
|
||||
c_pmodm127.o: ../config.h
|
||||
c_pmodm127.o: ../custom.h
|
||||
c_pmodm127.o: ../decl.h
|
||||
c_pmodm127.o: ../endian_calc.h
|
||||
c_pmodm127.o: ../hash.h
|
||||
c_pmodm127.o: ../have_const.h
|
||||
c_pmodm127.o: ../have_malloc.h
|
||||
c_pmodm127.o: ../have_memmv.h
|
||||
c_pmodm127.o: ../have_newstr.h
|
||||
c_pmodm127.o: ../have_stdlib.h
|
||||
@@ -943,7 +940,6 @@ c_pmodm127.o: ../shs.h
|
||||
c_pmodm127.o: ../shs1.h
|
||||
c_pmodm127.o: ../string.h
|
||||
c_pmodm127.o: ../value.h
|
||||
c_pmodm127.o: ../win32dll.h
|
||||
c_pmodm127.o: ../zmath.h
|
||||
c_pmodm127.o: c_pmodm127.c
|
||||
c_pzasusb8.o: ../alloc.h
|
||||
@@ -953,10 +949,10 @@ c_pzasusb8.o: ../calcerr.h
|
||||
c_pzasusb8.o: ../cmath.h
|
||||
c_pzasusb8.o: ../config.h
|
||||
c_pzasusb8.o: ../custom.h
|
||||
c_pzasusb8.o: ../decl.h
|
||||
c_pzasusb8.o: ../endian_calc.h
|
||||
c_pzasusb8.o: ../hash.h
|
||||
c_pzasusb8.o: ../have_const.h
|
||||
c_pzasusb8.o: ../have_malloc.h
|
||||
c_pzasusb8.o: ../have_memmv.h
|
||||
c_pzasusb8.o: ../have_newstr.h
|
||||
c_pzasusb8.o: ../have_stdlib.h
|
||||
@@ -970,7 +966,6 @@ c_pzasusb8.o: ../shs.h
|
||||
c_pzasusb8.o: ../shs1.h
|
||||
c_pzasusb8.o: ../string.h
|
||||
c_pzasusb8.o: ../value.h
|
||||
c_pzasusb8.o: ../win32dll.h
|
||||
c_pzasusb8.o: ../zmath.h
|
||||
c_pzasusb8.o: c_pzasusb8.c
|
||||
c_sysinfo.o: ../alloc.h
|
||||
@@ -982,11 +977,11 @@ c_sysinfo.o: ../cmath.h
|
||||
c_sysinfo.o: ../conf.h
|
||||
c_sysinfo.o: ../config.h
|
||||
c_sysinfo.o: ../custom.h
|
||||
c_sysinfo.o: ../decl.h
|
||||
c_sysinfo.o: ../endian_calc.h
|
||||
c_sysinfo.o: ../fposval.h
|
||||
c_sysinfo.o: ../hash.h
|
||||
c_sysinfo.o: ../have_const.h
|
||||
c_sysinfo.o: ../have_malloc.h
|
||||
c_sysinfo.o: ../have_memmv.h
|
||||
c_sysinfo.o: ../have_newstr.h
|
||||
c_sysinfo.o: ../have_stdlib.h
|
||||
@@ -1002,7 +997,6 @@ c_sysinfo.o: ../shs.h
|
||||
c_sysinfo.o: ../shs1.h
|
||||
c_sysinfo.o: ../string.h
|
||||
c_sysinfo.o: ../value.h
|
||||
c_sysinfo.o: ../win32dll.h
|
||||
c_sysinfo.o: ../zmath.h
|
||||
c_sysinfo.o: ../zrand.h
|
||||
c_sysinfo.o: ../zrandom.h
|
||||
@@ -1014,10 +1008,10 @@ custtbl.o: ../calcerr.h
|
||||
custtbl.o: ../cmath.h
|
||||
custtbl.o: ../config.h
|
||||
custtbl.o: ../custom.h
|
||||
custtbl.o: ../decl.h
|
||||
custtbl.o: ../endian_calc.h
|
||||
custtbl.o: ../hash.h
|
||||
custtbl.o: ../have_const.h
|
||||
custtbl.o: ../have_malloc.h
|
||||
custtbl.o: ../have_memmv.h
|
||||
custtbl.o: ../have_newstr.h
|
||||
custtbl.o: ../have_stdlib.h
|
||||
@@ -1030,6 +1024,5 @@ custtbl.o: ../shs.h
|
||||
custtbl.o: ../shs1.h
|
||||
custtbl.o: ../string.h
|
||||
custtbl.o: ../value.h
|
||||
custtbl.o: ../win32dll.h
|
||||
custtbl.o: ../zmath.h
|
||||
custtbl.o: custtbl.c
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* c_pmodm127 - calculate q mod 2^(2^127-1)
|
||||
*
|
||||
* Copyright (C) 2004 Landon Curt Noll
|
||||
* Copyright (C) 2004-2007 Landon Curt Noll
|
||||
*
|
||||
* Calc is open software; you can redistribute it and/or modify it under
|
||||
* the terms of the version 2.1 of the GNU Lesser General Public License
|
||||
@@ -17,8 +17,8 @@
|
||||
* 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.5 $
|
||||
* @(#) $Id: c_pmodm127.c,v 29.5 2006/06/25 22:08:42 chongo Exp $
|
||||
* @(#) $Revision: 29.6 $
|
||||
* @(#) $Id: c_pmodm127.c,v 29.6 2007/02/11 10:19:14 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/custom/RCS/c_pmodm127.c,v $
|
||||
*
|
||||
* Under source code control: 2004/07/28 22:12:25
|
||||
@@ -40,7 +40,7 @@
|
||||
#include "../have_unused.h"
|
||||
|
||||
/* 2^255 */
|
||||
static HALF h255[] = {
|
||||
STATIC HALF h255[] = {
|
||||
#if BASEB == 32
|
||||
(HALF)0x00000000, (HALF)0x00000000, (HALF)0x00000000, (HALF)0x00000000,
|
||||
(HALF)0x00000000, (HALF)0x00000000, (HALF)0x00000000, (HALF)0x80000000
|
||||
@@ -57,10 +57,10 @@ ZVALUE p255 = {
|
||||
|
||||
|
||||
/* static declarations */
|
||||
static void zmod5_or_zmod(ZVALUE *zp);
|
||||
static BOOL havelastmod = FALSE;
|
||||
static ZVALUE lastmod[1];
|
||||
static ZVALUE lastmodinv[1];
|
||||
S_FUNC void zmod5_or_zmod(ZVALUE *zp);
|
||||
STATIC BOOL havelastmod = FALSE;
|
||||
STATIC ZVALUE lastmod[1];
|
||||
STATIC ZVALUE lastmodinv[1];
|
||||
|
||||
|
||||
/*
|
||||
@@ -187,7 +187,7 @@ c_pmodm127(char UNUSED *name, int UNUSED count, VALUE **vals)
|
||||
* the result of the zmod5_or_zmod conditions do not apply to the argument
|
||||
* and saved mod.
|
||||
*/
|
||||
static void
|
||||
S_FUNC void
|
||||
zmod5_or_zmod(ZVALUE *zp)
|
||||
{
|
||||
LEN len, modlen, j;
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* c_sysinfo - names and values of selected #defines
|
||||
*
|
||||
* Copyright (C) 1999,2004 Landon Curt Noll
|
||||
* Copyright (C) 1999-2007 Landon Curt Noll
|
||||
*
|
||||
* Calc is open software; you can redistribute it and/or modify it under
|
||||
* the terms of the version 2.1 of the GNU Lesser General Public License
|
||||
@@ -17,8 +17,8 @@
|
||||
* 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.12 $
|
||||
* @(#) $Id: c_sysinfo.c,v 29.12 2006/09/18 06:28:47 chongo Exp $
|
||||
* @(#) $Revision: 29.13 $
|
||||
* @(#) $Id: c_sysinfo.c,v 29.13 2007/02/11 10:19:14 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/custom/RCS/c_sysinfo.c,v $
|
||||
*
|
||||
* Under source code control: 1997/03/09 23:14:40
|
||||
@@ -64,7 +64,7 @@ struct infoname {
|
||||
char *str; /* non-NULL ==> value of #define is a string */
|
||||
FULL nmbr; /* if str==NULL ==> value fo #define as a FULL */
|
||||
};
|
||||
static struct infoname sys_info[] = {
|
||||
STATIC struct infoname sys_info[] = {
|
||||
{"S100", "slots in an subtractive 100 table", NULL, (FULL)S100},
|
||||
{"BASE", "base for calculations", NULL, (FULL)BASE},
|
||||
{"BASE1", "one less than base", NULL, (FULL)BASE},
|
||||
@@ -160,9 +160,9 @@ static struct infoname sys_info[] = {
|
||||
/*
|
||||
* forward declarations
|
||||
*/
|
||||
static void dump_name_meaning(void); /* custom("sysinfo", 0) */
|
||||
static void dump_name_value(void); /* custom("sysinfo", 1) */
|
||||
static void dump_mening_value(void); /* custom("sysinfo", 2) */
|
||||
S_FUNC void dump_name_meaning(void); /* custom("sysinfo", 0) */
|
||||
S_FUNC void dump_name_value(void); /* custom("sysinfo", 1) */
|
||||
S_FUNC void dump_mening_value(void); /* custom("sysinfo", 2) */
|
||||
|
||||
|
||||
/*
|
||||
@@ -290,7 +290,7 @@ c_sysinfo(char UNUSED *name, int count, VALUE **vals)
|
||||
/*
|
||||
* dump_name_meaning - print all infonames and meanings
|
||||
*/
|
||||
static void
|
||||
S_FUNC void
|
||||
dump_name_meaning(void)
|
||||
{
|
||||
struct infoname *p; /* current infoname */
|
||||
@@ -307,7 +307,7 @@ dump_name_meaning(void)
|
||||
/*
|
||||
* dump_name_value - print all infonames and values
|
||||
*/
|
||||
static void
|
||||
S_FUNC void
|
||||
dump_name_value(void)
|
||||
{
|
||||
struct infoname *p; /* current infoname */
|
||||
@@ -338,7 +338,7 @@ dump_name_value(void)
|
||||
/*
|
||||
* dump_mening_value - print all values and meanings
|
||||
*/
|
||||
static void
|
||||
S_FUNC void
|
||||
dump_mening_value(void)
|
||||
{
|
||||
struct infoname *p; /* current infoname */
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* custtbl - custom interface table
|
||||
*
|
||||
* Copyright (C) 1999 Landon Curt Noll
|
||||
* Copyright (C) 1999-2007 Landon Curt Noll
|
||||
*
|
||||
* Calc is open software; you can redistribute it and/or modify it under
|
||||
* the terms of the version 2.1 of the GNU Lesser General Public License
|
||||
@@ -17,8 +17,8 @@
|
||||
* 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: custtbl.c,v 29.4 2005/02/05 06:16:19 chongo Exp $
|
||||
* @(#) $Revision: 29.5 $
|
||||
* @(#) $Id: custtbl.c,v 29.5 2007/02/11 10:19:14 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/custom/RCS/custtbl.c,v $
|
||||
*
|
||||
* Under source code control: 1997/03/09 02:28:54
|
||||
@@ -47,16 +47,16 @@
|
||||
*
|
||||
* Declare custom functions as follows:
|
||||
*
|
||||
* extern VALUE c_xyz(char*, int, VALUE**);
|
||||
* E_FUNC VALUE c_xyz(char*, int, VALUE**);
|
||||
*
|
||||
* We suggest that you sort the entries below by name.
|
||||
*/
|
||||
extern VALUE c_argv(char*, int, VALUE**);
|
||||
extern VALUE c_devnull(char*, int, VALUE**);
|
||||
extern VALUE c_help(char*, int, VALUE**);
|
||||
extern VALUE c_sysinfo(char*, int, VALUE**);
|
||||
extern VALUE c_pzasusb8(char*, int, VALUE**);
|
||||
extern VALUE c_pmodm127(char*, int, VALUE**);
|
||||
E_FUNC VALUE c_argv(char*, int, VALUE**);
|
||||
E_FUNC VALUE c_devnull(char*, int, VALUE**);
|
||||
E_FUNC VALUE c_help(char*, int, VALUE**);
|
||||
E_FUNC VALUE c_sysinfo(char*, int, VALUE**);
|
||||
E_FUNC VALUE c_pzasusb8(char*, int, VALUE**);
|
||||
E_FUNC VALUE c_pmodm127(char*, int, VALUE**);
|
||||
|
||||
|
||||
#endif /* CUSTOM */
|
||||
|
97
decl.h
Normal file
97
decl.h
Normal file
@@ -0,0 +1,97 @@
|
||||
/*
|
||||
* decl - variable and function declaration macros
|
||||
*
|
||||
* Copyright (C) 2007 Landon Curt Noll
|
||||
*
|
||||
* Primary author: 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.4 $
|
||||
* @(#) $Id: decl.h,v 29.4 2007/02/12 03:38:42 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/decl.h,v $
|
||||
*
|
||||
* Under source code control: 2007/02/09 05:24:25
|
||||
* File existed as early as: 2007
|
||||
*
|
||||
* Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
||||
*/
|
||||
|
||||
|
||||
#include "have_const.h"
|
||||
|
||||
|
||||
#if !defined(__DECL_H__)
|
||||
#define __DECL_H__
|
||||
|
||||
|
||||
/*
|
||||
* Mac OS X Thread Local Storage macros
|
||||
*
|
||||
* NOTE: The use of -DMACOSX_TLS is extremely experimental. Calc may not
|
||||
* compile with MACOSX_TLS defined.
|
||||
*/
|
||||
#if defined(MACOSX_TLS)
|
||||
|
||||
|
||||
/* variable related macros */
|
||||
# define EXTERN extern __thread
|
||||
# define STATIC static __thread
|
||||
|
||||
/* function related macros */
|
||||
# define E_FUNC extern
|
||||
# define S_FUNC static
|
||||
|
||||
|
||||
/*
|
||||
* MS windoz macros
|
||||
*/
|
||||
#elif defined(_WIN32) || defined(WINDOZ)
|
||||
|
||||
|
||||
/* determine which type of DLL we must generate */
|
||||
# if defined(_EXPORTING)
|
||||
# define DLL __declspec(dllexport)
|
||||
# else
|
||||
# define DLL __declspec(dllimport)
|
||||
# endif
|
||||
|
||||
/* variable related macros */
|
||||
# define EXTERN extern DLL
|
||||
# define STATIC static
|
||||
|
||||
/* function related macros */
|
||||
# define E_FUNC extern DLL
|
||||
# define S_FUNC static
|
||||
|
||||
|
||||
/*
|
||||
* default macros
|
||||
*/
|
||||
#else
|
||||
|
||||
|
||||
/* variable related macros */
|
||||
# define EXTERN extern
|
||||
# define STATIC static
|
||||
|
||||
/* function related macros */
|
||||
# define E_FUNC extern
|
||||
# define S_FUNC static
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* !__DECL_H__ */
|
82
file.c
82
file.c
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* file - file I/O routines callable by users
|
||||
*
|
||||
* Copyright (C) 1999-2006 David I. Bell and Landon Curt Noll
|
||||
* Copyright (C) 1999-2007 David I. Bell and Landon Curt Noll
|
||||
*
|
||||
* Primary author: David I. Bell
|
||||
*
|
||||
@@ -19,8 +19,8 @@
|
||||
* 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.16 $
|
||||
* @(#) $Id: file.c,v 29.16 2006/08/20 15:01:30 chongo Exp $
|
||||
* @(#) $Revision: 29.18 $
|
||||
* @(#) $Id: file.c,v 29.18 2007/02/12 08:20:24 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/file.c,v $
|
||||
*
|
||||
* Under source code control: 1991/07/20 00:21:56
|
||||
@@ -57,8 +57,8 @@
|
||||
/*
|
||||
* external STDIO functions
|
||||
*/
|
||||
extern void math_setfp(FILE *fp);
|
||||
extern FILE *f_open(char *name, char *mode);
|
||||
E_FUNC void math_setfp(FILE *fp);
|
||||
E_FUNC FILE *f_open(char *name, char *mode);
|
||||
|
||||
|
||||
/*
|
||||
@@ -66,7 +66,7 @@ extern FILE *f_open(char *name, char *mode);
|
||||
* The first three entries always correspond to stdin, stdout, and stderr,
|
||||
* and cannot be closed. Their file ids are always 0, 1, and 2.
|
||||
*/
|
||||
static FILEIO files[MAXFILES] = {
|
||||
STATIC FILEIO files[MAXFILES] = {
|
||||
{FILEID_STDIN, NULL, (dev_t)0, (ino_t)0,
|
||||
"(stdin)", TRUE, FALSE, FALSE, FALSE, 'r', "r"},
|
||||
{FILEID_STDOUT, NULL, (dev_t)0, (ino_t)0,
|
||||
@@ -76,28 +76,28 @@ static FILEIO files[MAXFILES] = {
|
||||
};
|
||||
|
||||
|
||||
static int ioindex[MAXFILES] = {0,1,2}; /* Indices for FILEIO table */
|
||||
static FILEID lastid = FILEID_STDERR; /* Last allocated file id */
|
||||
static int idnum = 3; /* Number of allocated file ids */
|
||||
STATIC int ioindex[MAXFILES] = {0,1,2}; /* Indices for FILEIO table */
|
||||
STATIC FILEID lastid = FILEID_STDERR; /* Last allocated file id */
|
||||
STATIC int idnum = 3; /* Number of allocated file ids */
|
||||
|
||||
|
||||
/* forward static declarations */
|
||||
static ZVALUE filepos2z(FILEPOS pos);
|
||||
static FILEPOS z2filepos(ZVALUE pos);
|
||||
static int set_open_pos(FILE *fp, ZVALUE zpos);
|
||||
static int get_open_pos(FILE *fp, ZVALUE *res);
|
||||
static ZVALUE off_t2z(off_t siz);
|
||||
static ZVALUE dev2z(dev_t dev);
|
||||
static ZVALUE inode2z(ino_t inode);
|
||||
static void getscanfield(FILE *fp, BOOL skip, unsigned int width,
|
||||
S_FUNC ZVALUE filepos2z(FILEPOS pos);
|
||||
S_FUNC FILEPOS z2filepos(ZVALUE pos);
|
||||
S_FUNC int set_open_pos(FILE *fp, ZVALUE zpos);
|
||||
S_FUNC int get_open_pos(FILE *fp, ZVALUE *res);
|
||||
S_FUNC ZVALUE off_t2z(off_t siz);
|
||||
S_FUNC ZVALUE dev2z(dev_t dev);
|
||||
S_FUNC ZVALUE inode2z(ino_t inode);
|
||||
S_FUNC void getscanfield(FILE *fp, BOOL skip, unsigned int width,
|
||||
int scannum, char *scanptr, char **strptr);
|
||||
static void getscanwhite(FILE *fp, BOOL skip, unsigned int width,
|
||||
S_FUNC void getscanwhite(FILE *fp, BOOL skip, unsigned int width,
|
||||
int scannum, char **strptr);
|
||||
static int fscanfile(FILE *fp, char *fmt, int count, VALUE **vals);
|
||||
static void freadnum(FILE *fp, VALUE *valptr);
|
||||
static void freadsum(FILE *fp, VALUE *valptr);
|
||||
static void freadprod(FILE *fp, VALUE *valptr);
|
||||
static void fskipnum(FILE *fp);
|
||||
S_FUNC int fscanfile(FILE *fp, char *fmt, int count, VALUE **vals);
|
||||
S_FUNC void freadnum(FILE *fp, VALUE *valptr);
|
||||
S_FUNC void freadsum(FILE *fp, VALUE *valptr);
|
||||
S_FUNC void freadprod(FILE *fp, VALUE *valptr);
|
||||
S_FUNC void fskipnum(FILE *fp);
|
||||
|
||||
|
||||
/*
|
||||
@@ -112,7 +112,7 @@ static void fskipnum(FILE *fp);
|
||||
void
|
||||
file_init(void)
|
||||
{
|
||||
static int done = 0; /* 1 => routine already called */
|
||||
STATIC int done = 0; /* 1 => routine already called */
|
||||
struct stat sbuf; /* file status */
|
||||
FILEIO *fiop;
|
||||
FILE *fp;
|
||||
@@ -202,7 +202,7 @@ file_init(void)
|
||||
* id calc file ID
|
||||
* fp open file stream
|
||||
*/
|
||||
static void
|
||||
S_FUNC void
|
||||
init_fileio(FILEIO *fiop, char *name, char *mode,
|
||||
struct stat *sbufp, FILEID id, FILE *fp)
|
||||
{
|
||||
@@ -1352,7 +1352,7 @@ rewindall(void)
|
||||
* NOTE: Does not support negative file positions.
|
||||
*/
|
||||
/*ARGSUSED*/
|
||||
static ZVALUE
|
||||
S_FUNC ZVALUE
|
||||
filepos2z(FILEPOS pos)
|
||||
{
|
||||
ZVALUE ret; /* ZVALUE file position to return */
|
||||
@@ -1363,7 +1363,7 @@ filepos2z(FILEPOS pos)
|
||||
ret.len = FILEPOS_BITS/BASEB;
|
||||
ret.v = alloc(ret.len);
|
||||
zclearval(ret);
|
||||
SWAP_HALF_IN_FILEPOS(ret.v, (HALF *)&pos);
|
||||
SWAP_HALF_IN_FILEPOS(ret.v, &pos);
|
||||
ret.sign = 0;
|
||||
ztrim(&ret);
|
||||
|
||||
@@ -1385,7 +1385,7 @@ filepos2z(FILEPOS pos)
|
||||
*
|
||||
* NOTE: Does not support negative file positions.
|
||||
*/
|
||||
static FILEPOS
|
||||
S_FUNC FILEPOS
|
||||
z2filepos(ZVALUE zpos)
|
||||
{
|
||||
#if FILEPOS_BITS > FULL_BITS
|
||||
@@ -1462,7 +1462,7 @@ z2filepos(ZVALUE zpos)
|
||||
* 0 res points to the file position
|
||||
* -1 error
|
||||
*/
|
||||
static int
|
||||
S_FUNC int
|
||||
get_open_pos(FILE *fp, ZVALUE *res)
|
||||
{
|
||||
FILEPOS pos; /* current file position */
|
||||
@@ -1622,7 +1622,7 @@ fseekid(FILEID id, ZVALUE offset, int whence)
|
||||
* NOTE: Due to fsetpos limitation, position is set relative to only
|
||||
* the beginning of the file.
|
||||
*/
|
||||
static int
|
||||
S_FUNC int
|
||||
set_open_pos(FILE *fp, ZVALUE zpos)
|
||||
{
|
||||
FILEPOS pos; /* current file position */
|
||||
@@ -1706,7 +1706,7 @@ setloc(FILEID id, ZVALUE zpos)
|
||||
* file size as a ZVALUE
|
||||
*/
|
||||
/*ARGSUSED*/
|
||||
static ZVALUE
|
||||
S_FUNC ZVALUE
|
||||
off_t2z(off_t siz)
|
||||
{
|
||||
ZVALUE ret; /* ZVALUE file size to return */
|
||||
@@ -1737,7 +1737,7 @@ off_t2z(off_t siz)
|
||||
* returns:
|
||||
* file size as a ZVALUE
|
||||
*/
|
||||
static ZVALUE
|
||||
S_FUNC ZVALUE
|
||||
dev2z(dev_t dev)
|
||||
{
|
||||
ZVALUE ret; /* ZVALUE file size to return */
|
||||
@@ -1769,7 +1769,7 @@ dev2z(dev_t dev)
|
||||
* file size as a ZVALUE
|
||||
*/
|
||||
/*ARGSUSED*/
|
||||
static ZVALUE
|
||||
S_FUNC ZVALUE
|
||||
inode2z(ino_t inode)
|
||||
{
|
||||
ZVALUE ret; /* ZVALUE file size to return */
|
||||
@@ -1927,7 +1927,7 @@ get_inode(FILEID id, ZVALUE *inode)
|
||||
}
|
||||
|
||||
|
||||
static off_t
|
||||
S_FUNC off_t
|
||||
filesize(FILEIO *fiop)
|
||||
{
|
||||
struct stat sbuf;
|
||||
@@ -2025,7 +2025,7 @@ showfiles(void)
|
||||
* scanptr string of characters considered separators
|
||||
* strptr pointer to where the new field pointer may be found
|
||||
*/
|
||||
static void
|
||||
S_FUNC void
|
||||
getscanfield(FILE *fp, BOOL skip, unsigned int width, int scannum, char *scanptr, char **strptr)
|
||||
{
|
||||
char *str; /* current string */
|
||||
@@ -2103,7 +2103,7 @@ getscanfield(FILE *fp, BOOL skip, unsigned int width, int scannum, char *scanptr
|
||||
* scannum Number of characters in scanset
|
||||
* strptr pointer to where the new field pointer may be found
|
||||
*/
|
||||
static void
|
||||
S_FUNC void
|
||||
getscanwhite(FILE *fp, BOOL skip, unsigned int width, int scannum, char **strptr)
|
||||
{
|
||||
char *str; /* current string */
|
||||
@@ -2170,7 +2170,7 @@ getscanwhite(FILE *fp, BOOL skip, unsigned int width, int scannum, char **strptr
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
S_FUNC int
|
||||
fscanfile(FILE *fp, char *fmt, int count, VALUE **vals)
|
||||
{
|
||||
int assnum; /* Number of assignments made */
|
||||
@@ -2364,7 +2364,7 @@ scanfstr(char *str, char *fmt, int count, VALUE **vals)
|
||||
* a sign immediately following 'e' or 'E', or a dot is encountered.
|
||||
* Absence of digits is interpreted as zero.
|
||||
*/
|
||||
static void
|
||||
S_FUNC void
|
||||
freadnum(FILE *fp, VALUE *valptr)
|
||||
{
|
||||
ZVALUE num, zden, newnum, newden, div, tmp;
|
||||
@@ -2502,7 +2502,7 @@ freadnum(FILE *fp, VALUE *valptr)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
S_FUNC void
|
||||
freadsum(FILE *fp, VALUE *valptr)
|
||||
{
|
||||
VALUE v1, v2, v3;
|
||||
@@ -2528,7 +2528,7 @@ freadsum(FILE *fp, VALUE *valptr)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
S_FUNC void
|
||||
freadprod(FILE *fp, VALUE *valptr)
|
||||
{
|
||||
VALUE v1, v2, v3;
|
||||
@@ -2552,7 +2552,7 @@ freadprod(FILE *fp, VALUE *valptr)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
S_FUNC void
|
||||
fskipnum(FILE *fp)
|
||||
{
|
||||
char ch;
|
||||
|
18
file.h
18
file.h
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* file - file I/O routines callable by users
|
||||
*
|
||||
* Copyright (C) 1999-2006 David I. Bell and Landon Curt Noll
|
||||
* Copyright (C) 1999-2007 David I. Bell and Landon Curt Noll
|
||||
*
|
||||
* Primary author: David I. Bell
|
||||
*
|
||||
@@ -19,8 +19,8 @@
|
||||
* 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.8 $
|
||||
* @(#) $Id: file.h,v 29.8 2006/05/19 15:26:10 chongo Exp $
|
||||
* @(#) $Revision: 29.9 $
|
||||
* @(#) $Id: file.h,v 29.9 2007/02/11 10:19:14 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/file.h,v $
|
||||
*
|
||||
* Under source code control: 1996/05/24 05:55:58
|
||||
@@ -91,12 +91,12 @@ typedef struct {
|
||||
/*
|
||||
* external functions
|
||||
*/
|
||||
extern DLL FILEIO * findid(FILEID id, int writable);
|
||||
extern DLL int fgetposid(FILEID id, FILEPOS *ptr);
|
||||
extern DLL int fsetposid(FILEID id, FILEPOS *ptr);
|
||||
extern DLL int get_open_siz(FILE *fp, ZVALUE *res);
|
||||
extern DLL char* findfname(FILEID);
|
||||
extern DLL FILE *f_pathopen(char *name, char *mode, char *pathlist, char **openpath);
|
||||
E_FUNC FILEIO * findid(FILEID id, int writable);
|
||||
E_FUNC int fgetposid(FILEID id, FILEPOS *ptr);
|
||||
E_FUNC int fsetposid(FILEID id, FILEPOS *ptr);
|
||||
E_FUNC int get_open_siz(FILE *fp, ZVALUE *res);
|
||||
E_FUNC char* findfname(FILEID);
|
||||
E_FUNC FILE *f_pathopen(char *name, char *mode, char *pathlist, char **openpath);
|
||||
|
||||
|
||||
#endif /* !__FILE_H__ */
|
||||
|
68
func.h
68
func.h
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* func - built-in function interface definitions
|
||||
*
|
||||
* Copyright (C) 1999 David I. Bell
|
||||
* Copyright (C) 1999-2007 David I. Bell
|
||||
*
|
||||
* 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
|
||||
@@ -17,8 +17,8 @@
|
||||
* 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: func.h,v 29.4 2001/06/08 21:00:58 chongo Exp $
|
||||
* @(#) $Revision: 29.6 $
|
||||
* @(#) $Id: func.h,v 29.6 2007/02/12 03:40:06 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/func.h,v $
|
||||
*
|
||||
* Under source code control: 1990/02/15 01:48:33
|
||||
@@ -72,42 +72,42 @@ struct func {
|
||||
/*
|
||||
* The current function being compiled.
|
||||
*/
|
||||
extern FUNC *curfunc;
|
||||
E_FUNC FUNC *curfunc; /* NOTE: This is a function pointer, we need E_FUNC */
|
||||
|
||||
|
||||
/*
|
||||
* Functions to handle functions.
|
||||
*/
|
||||
extern FUNC *findfunc(long index);
|
||||
extern char *namefunc(long index);
|
||||
extern BOOL evaluate(BOOL nestflag);
|
||||
extern long adduserfunc(char *name);
|
||||
extern void rmuserfunc(char *name);
|
||||
extern void rmalluserfunc(void);
|
||||
extern long getuserfunc(char *name);
|
||||
extern void beginfunc(char *name, BOOL newflag);
|
||||
extern int builtinopcode(long index);
|
||||
extern char *builtinname(long index);
|
||||
extern int dumpop(unsigned long *pc);
|
||||
extern void addop(long op);
|
||||
extern void endfunc(void);
|
||||
extern void addopone(long op, long arg);
|
||||
extern void addoptwo(long op, long arg1, long arg2);
|
||||
extern void addoplabel(long op, LABEL *label);
|
||||
extern void addopptr(long op, char *ptr);
|
||||
extern void writeindexop(void);
|
||||
extern void showbuiltins(void);
|
||||
extern int getbuiltinfunc(char *name);
|
||||
extern void builtincheck(long index, int count);
|
||||
extern void addopfunction(long op, long index, int count);
|
||||
extern void showfunctions(void);
|
||||
extern void initfunctions(void);
|
||||
extern void clearopt(void);
|
||||
extern void updateoldvalue(FUNC *fp);
|
||||
extern void calculate(FUNC *fp, int argcount);
|
||||
extern VALUE builtinfunc(long index, int argcount, VALUE *stck);
|
||||
extern void freenumbers(FUNC *);
|
||||
extern void freefunc(FUNC *);
|
||||
E_FUNC FUNC *findfunc(long index);
|
||||
E_FUNC char *namefunc(long index);
|
||||
E_FUNC BOOL evaluate(BOOL nestflag);
|
||||
E_FUNC long adduserfunc(char *name);
|
||||
E_FUNC void rmuserfunc(char *name);
|
||||
E_FUNC void rmalluserfunc(void);
|
||||
E_FUNC long getuserfunc(char *name);
|
||||
E_FUNC void beginfunc(char *name, BOOL newflag);
|
||||
E_FUNC int builtinopcode(long index);
|
||||
E_FUNC char *builtinname(long index);
|
||||
E_FUNC int dumpop(unsigned long *pc);
|
||||
E_FUNC void addop(long op);
|
||||
E_FUNC void endfunc(void);
|
||||
E_FUNC void addopone(long op, long arg);
|
||||
E_FUNC void addoptwo(long op, long arg1, long arg2);
|
||||
E_FUNC void addoplabel(long op, LABEL *label);
|
||||
E_FUNC void addopptr(long op, char *ptr);
|
||||
E_FUNC void writeindexop(void);
|
||||
E_FUNC void showbuiltins(void);
|
||||
E_FUNC int getbuiltinfunc(char *name);
|
||||
E_FUNC void builtincheck(long index, int count);
|
||||
E_FUNC void addopfunction(long op, long index, int count);
|
||||
E_FUNC void showfunctions(void);
|
||||
E_FUNC void initfunctions(void);
|
||||
E_FUNC void clearopt(void);
|
||||
E_FUNC void updateoldvalue(FUNC *fp);
|
||||
E_FUNC void calculate(FUNC *fp, int argcount);
|
||||
E_FUNC VALUE builtinfunc(long index, int argcount, VALUE *stck);
|
||||
E_FUNC void freenumbers(FUNC *);
|
||||
E_FUNC void freefunc(FUNC *);
|
||||
|
||||
|
||||
#endif /* !__FUNC_H__ */
|
||||
|
14
hash.c
14
hash.c
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* hash - one-way hash routines
|
||||
*
|
||||
* Copyright (C) 1999-2006 Landon Curt Noll
|
||||
* Copyright (C) 1999-2007 Landon Curt Noll
|
||||
*
|
||||
* Calc is open software; you can redistribute it and/or modify it under
|
||||
* the terms of the version 2.1 of the GNU Lesser General Public License
|
||||
@@ -17,8 +17,8 @@
|
||||
* 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.10 $
|
||||
* @(#) $Id: hash.c,v 29.10 2006/06/20 10:25:45 chongo Exp $
|
||||
* @(#) $Revision: 29.11 $
|
||||
* @(#) $Id: hash.c,v 29.11 2007/02/11 10:19:14 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/hash.c,v $
|
||||
*
|
||||
* Under source code control: 1995/11/23 05:13:11
|
||||
@@ -43,9 +43,9 @@
|
||||
/*
|
||||
* external hash_setup functions
|
||||
*/
|
||||
extern void shs_init_state(HASH*);
|
||||
extern void shs1_init_state(HASH*);
|
||||
extern void MD5_init_state(HASH*);
|
||||
E_FUNC void shs_init_state(HASH*);
|
||||
E_FUNC void shs1_init_state(HASH*);
|
||||
E_FUNC void MD5_init_state(HASH*);
|
||||
|
||||
|
||||
/*
|
||||
@@ -60,7 +60,7 @@ extern void MD5_init_state(HASH*);
|
||||
/*
|
||||
* hash_setup - setup the hash state for a given hash
|
||||
*/
|
||||
static struct hash_setup {
|
||||
STATIC struct hash_setup {
|
||||
int type; /* hash type (see XYZ_HASH_TYPE below) */
|
||||
void (*init_state)(HASH*); /* initialize a hash state */
|
||||
} htbl[] = {
|
||||
|
32
hash.h
32
hash.h
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* hash - one-way hash routines
|
||||
*
|
||||
* Copyright (C) 1999 Landon Curt Noll
|
||||
* Copyright (C) 1999-2007 Landon Curt Noll
|
||||
*
|
||||
* Calc is open software; you can redistribute it and/or modify it under
|
||||
* the terms of the version 2.1 of the GNU Lesser General Public License
|
||||
@@ -17,8 +17,8 @@
|
||||
* 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: hash.h,v 29.4 2001/06/08 21:00:58 chongo Exp $
|
||||
* @(#) $Revision: 29.5 $
|
||||
* @(#) $Id: hash.h,v 29.5 2007/02/11 10:19:14 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/hash.h,v $
|
||||
*
|
||||
* Under source code control: 1995/11/14 23:57:45
|
||||
@@ -123,19 +123,19 @@ struct hashstate {
|
||||
/*
|
||||
* external functions
|
||||
*/
|
||||
extern HASH* hash_init(int, HASH*);
|
||||
extern void hash_free(HASH*);
|
||||
extern HASH* hash_copy(HASH*);
|
||||
extern int hash_cmp(HASH*, HASH*);
|
||||
extern void hash_print(HASH*);
|
||||
extern ZVALUE hash_final(HASH*);
|
||||
extern HASH* hash_long(int, long, HASH*);
|
||||
extern HASH* hash_zvalue(int, ZVALUE, HASH*);
|
||||
extern HASH* hash_number(int, void*, HASH*);
|
||||
extern HASH* hash_complex(int, void*, HASH*);
|
||||
extern HASH* hash_str(int, char*, HASH*);
|
||||
extern HASH* hash_usb8(int, USB8*, int, HASH*);
|
||||
extern HASH* hash_value(int, void*, HASH*);
|
||||
E_FUNC HASH* hash_init(int, HASH*);
|
||||
E_FUNC void hash_free(HASH*);
|
||||
E_FUNC HASH* hash_copy(HASH*);
|
||||
E_FUNC int hash_cmp(HASH*, HASH*);
|
||||
E_FUNC void hash_print(HASH*);
|
||||
E_FUNC ZVALUE hash_final(HASH*);
|
||||
E_FUNC HASH* hash_long(int, long, HASH*);
|
||||
E_FUNC HASH* hash_zvalue(int, ZVALUE, HASH*);
|
||||
E_FUNC HASH* hash_number(int, void*, HASH*);
|
||||
E_FUNC HASH* hash_complex(int, void*, HASH*);
|
||||
E_FUNC HASH* hash_str(int, char*, HASH*);
|
||||
E_FUNC HASH* hash_usb8(int, USB8*, int, HASH*);
|
||||
E_FUNC HASH* hash_value(int, void*, HASH*);
|
||||
|
||||
|
||||
#endif /* !__HASH_H__ */
|
||||
|
65
have_stdvs.c
65
have_stdvs.c
@@ -17,8 +17,8 @@
|
||||
* 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: have_stdvs.c,v 29.2 2000/06/07 14:02:13 chongo Exp $
|
||||
* @(#) $Revision: 29.3 $
|
||||
* @(#) $Id: have_stdvs.c,v 29.3 2007/02/07 20:53:18 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/have_stdvs.c,v $
|
||||
*
|
||||
* Under source code control: 1995/09/09 22:41:10
|
||||
@@ -56,6 +56,13 @@
|
||||
# include <string.h>
|
||||
#endif
|
||||
|
||||
#undef VSPRINTF_SIZE_T
|
||||
#if defined(FORCE_STDC) || (defined(__STDC__) && __STDC__ != 0) || defined(__cplusplus)
|
||||
# define VSPRINTF_SIZE_T size_t
|
||||
#else
|
||||
# define VSPRINTF_SIZE_T long
|
||||
#endif
|
||||
|
||||
char buf[BUFSIZ];
|
||||
|
||||
|
||||
@@ -74,6 +81,21 @@ try_this(char *fmt, ...)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
try_nthis(char *fmt, VSPRINTF_SIZE_T size, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
#if !defined(DONT_HAVE_VSPRINTF)
|
||||
vsnprintf(buf, size, fmt, ap);
|
||||
#else
|
||||
snprintf(buf, size, fmt, ap);
|
||||
#endif
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
@@ -95,9 +117,9 @@ main(void)
|
||||
exit(1);
|
||||
}
|
||||
try_this("%s %d%s%d%d %s",
|
||||
"Landon Noll 1st proved that", 2, "^", 23209, -1, "was prime");
|
||||
"Landon Noll 1st coproved that", 2, "^", 21701, -1, "was prime");
|
||||
if (strcmp(buf,
|
||||
"Landon Noll 1st proved that 2^23209-1 was prime") != 0) {
|
||||
"Landon Noll 1st coproved that 2^21701-1 was prime") != 0) {
|
||||
#if !defined(DONT_HAVE_VSPRINTF)
|
||||
/* <stdarg.h> with vsprintf() didn't work */
|
||||
#else
|
||||
@@ -106,6 +128,30 @@ main(void)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/*
|
||||
* test variable args and vsnprintf/snprintf
|
||||
*/
|
||||
try_nthis("@%d:%s:%d@", sizeof(buf)-1, 1, "hello", 5);
|
||||
if (strcmp(buf, "@1:hello:5@") != 0) {
|
||||
#if !defined(DONT_HAVE_VSPRINTF)
|
||||
/* <stdarg.h> with vsnprintf() didn't work */
|
||||
#else
|
||||
/* <stdarg.h> with snprintf() simulating vsnprintf() didn't work */
|
||||
#endif
|
||||
exit(1);
|
||||
}
|
||||
try_nthis("%s %d%s%d%d %s", sizeof(buf)-1,
|
||||
"Landon Noll 1st proved that", 2, "^", 23209, -1, "was prime");
|
||||
if (strcmp(buf,
|
||||
"Landon Noll 1st proved that 2^23209-1 was prime") != 0) {
|
||||
#if !defined(DONT_HAVE_VSPRINTF)
|
||||
/* <stdarg.h> with vsnprintf() didn't work */
|
||||
#else
|
||||
/* <stdarg.h> with snprintf() simulating vsnprintf() didn't work */
|
||||
#endif
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/*
|
||||
* report the result
|
||||
*/
|
||||
@@ -128,19 +174,22 @@ main(void)
|
||||
puts("#define STDARG /* use <stdarg.h> */");
|
||||
puts("#include <stdarg.h>");
|
||||
#endif
|
||||
puts("\n/* should we use vsprintf()? */");
|
||||
puts("\n/* should we use vsprintf() and vsnprintf()? */");
|
||||
#if !defined(DONT_HAVE_VSPRINTF)
|
||||
puts("#define HAVE_VS /* yes */");
|
||||
puts("#define HAVE_VSPRINTF /* yes */");
|
||||
#else
|
||||
puts("/*");
|
||||
puts(" * Hack aleart!!!");
|
||||
puts(" *");
|
||||
puts(" * Systems that do not have vsprintf() need something. In some");
|
||||
puts(" * cases the sprintf function will deal correctly with the");
|
||||
puts(" * va_alist 3rd arg. Hope for the best!");
|
||||
puts(" * va_alist 3rd arg. Same gors for a lack of an vsnprintf()");
|
||||
puts(" * function. In either case we use the #defines below and");
|
||||
puts(" * hope for the best!");
|
||||
puts(" */");
|
||||
puts("#define vsprintf sprintf");
|
||||
puts("#undef HAVE_VS");
|
||||
puts("#define vsnprintf snprintf");
|
||||
puts("#undef HAVE_VSPRINTF");
|
||||
#endif
|
||||
/* exit(0); */
|
||||
return 0;
|
||||
|
72
have_varvs.c
72
have_varvs.c
@@ -17,8 +17,8 @@
|
||||
* 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: have_varvs.c,v 29.2 2000/06/07 14:02:13 chongo Exp $
|
||||
* @(#) $Revision: 29.3 $
|
||||
* @(#) $Id: have_varvs.c,v 29.3 2007/02/07 20:53:18 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/have_varvs.c,v $
|
||||
*
|
||||
* Under source code control: 1995/09/09 22:41:10
|
||||
@@ -52,6 +52,13 @@
|
||||
# include <string.h>
|
||||
#endif
|
||||
|
||||
#undef VSPRINTF_SIZE_T
|
||||
#if defined(FORCE_STDC) || (defined(__STDC__) && __STDC__ != 0) || defined(__cplusplus)
|
||||
# define VSPRINTF_SIZE_T size_t
|
||||
#else
|
||||
# define VSPRINTF_SIZE_T long
|
||||
#endif
|
||||
|
||||
char buf[BUFSIZ];
|
||||
|
||||
#if !defined(STDARG) && !defined(SIMULATE_STDARG)
|
||||
@@ -73,6 +80,22 @@ try_this(char *fmt, ...)
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
void
|
||||
try_nthis(char *fmt, VSPRINTF_SIZE_T size, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
va_start(ap);
|
||||
|
||||
#if !defined(DONT_HAVE_VSPRINTF)
|
||||
vsnprintf(buf, size, fmt, ap);
|
||||
#else
|
||||
snprintf(buf, size, fmt, ap);
|
||||
#endif
|
||||
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
void
|
||||
@@ -81,6 +104,12 @@ try_this(char *a, int b, char *c, int d)
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
try_nthis(char *a, VSPRINTF_SIZE_T size, int b, char *c, int d)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -109,9 +138,33 @@ main(void)
|
||||
if (strcmp(buf,
|
||||
"Landon Noll 1st proved that 2^23209-1 was prime") != 0) {
|
||||
#if !defined(DONT_HAVE_VSPRINTF)
|
||||
/* <stdarg.h> with vsprintf() didn't work */
|
||||
/* <varargs.h> with vsprintf() didn't work */
|
||||
#else
|
||||
/* <stdarg.h> with sprintf() simulating vsprintf() didn't work */
|
||||
/* <varargs.h> with sprintf() simulating vsprintf() didn't work */
|
||||
#endif
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/*
|
||||
* test variable args and vsnprintf/snprintf
|
||||
*/
|
||||
try_nthis("@%d:%s:%d@", sizeof(buf)-1, 1, "hello", 5);
|
||||
if (strcmp(buf, "@1:hello:5@") != 0) {
|
||||
#if !defined(DONT_HAVE_VSPRINTF)
|
||||
/* <varargs.h> with vsnprintf() didn't work */
|
||||
#else
|
||||
/* <varargs.h> with snprintf() simulating vsnprintf() didn't work */
|
||||
#endif
|
||||
exit(1);
|
||||
}
|
||||
try_nthis("%s %d%s%d%d %s", sizeof(buf)-1,
|
||||
"Landon Noll 1st proved that", 2, "^", 23209, -1, "was prime");
|
||||
if (strcmp(buf,
|
||||
"Landon Noll 1st proved that 2^23209-1 was prime") != 0) {
|
||||
#if !defined(DONT_HAVE_VSPRINTF)
|
||||
/* <varargs.h> with vsnprintf() didn't work */
|
||||
#else
|
||||
/* <varargs.h> with snprintf() simulating vsnprintf() didn't work */
|
||||
#endif
|
||||
exit(1);
|
||||
}
|
||||
@@ -122,19 +175,22 @@ main(void)
|
||||
puts("/* what type of variable args do we have? */");
|
||||
puts("#define VARARGS /* use <varargs.h> */");
|
||||
puts("#include <varargs.h>");
|
||||
puts("\n/* should we use vsprintf()? */");
|
||||
puts("\n/* should we use vsprintf() and vsnprintf()? */");
|
||||
#if !defined(DONT_HAVE_VSPRINTF)
|
||||
puts("#define HAVE_VS /* yes */");
|
||||
puts("#define HAVE_VSPRINTF /* yes */");
|
||||
#else
|
||||
puts("/*");
|
||||
puts(" * Hack aleart!!!");
|
||||
puts(" *");
|
||||
puts(" * Systems that do not have vsprintf() need something. In some");
|
||||
puts(" * cases the sprintf function will deal correctly with the");
|
||||
puts(" * va_alist 3rd arg. Hope for the best!");
|
||||
puts(" * va_alist 3rd arg. Same gors for a lack of an vsnprintf()");
|
||||
puts(" * function. In either case we use the #defines below and");
|
||||
puts(" * hope for the best!");
|
||||
puts(" */");
|
||||
puts("#define vsprintf sprintf");
|
||||
puts("#undef HAVE_VS");
|
||||
puts("#define vsnprintf snprintf");
|
||||
puts("#undef HAVE_VSPRINTF");
|
||||
#endif
|
||||
/* exit(0); */
|
||||
return 0;
|
||||
|
12
help.c
12
help.c
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* help - display help for calc
|
||||
*
|
||||
* Copyright (C) 1999 Landon Curt Noll
|
||||
* Copyright (C) 1999-2007 Landon Curt Noll
|
||||
*
|
||||
* Calc is open software; you can redistribute it and/or modify it under
|
||||
* the terms of the version 2.1 of the GNU Lesser General Public License
|
||||
@@ -17,8 +17,8 @@
|
||||
* 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.9 $
|
||||
* @(#) $Id: help.c,v 29.9 2007/02/07 00:37:52 chongo Exp $
|
||||
* @(#) $Revision: 29.10 $
|
||||
* @(#) $Id: help.c,v 29.10 2007/02/11 10:19:14 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/help.c,v $
|
||||
*
|
||||
* Under source code control: 1997/09/14 10:58:30
|
||||
@@ -51,7 +51,7 @@
|
||||
/*
|
||||
* some help topics are symbols, so we alias them to nice filenames
|
||||
*/
|
||||
static struct help_alias {
|
||||
STATIC struct help_alias {
|
||||
char *topic;
|
||||
char *filename;
|
||||
} halias[] = {
|
||||
@@ -89,7 +89,7 @@ static struct help_alias {
|
||||
/*
|
||||
* external values
|
||||
*/
|
||||
extern char *pager; /* $PAGER or default */
|
||||
EXTERN char *pager; /* $PAGER or default */
|
||||
|
||||
|
||||
/*
|
||||
@@ -104,7 +104,7 @@ extern char *pager; /* $PAGER or default */
|
||||
* given:
|
||||
* stream open file stream of the file to send to the pager
|
||||
*/
|
||||
static void
|
||||
S_FUNC void
|
||||
page_file(FILE *stream)
|
||||
{
|
||||
FILE *cmd; /* pager command */
|
||||
|
@@ -178,7 +178,7 @@
|
||||
the hash value may change with different versions of the calculator.
|
||||
|
||||
The base function allows one to specify how numbers should be
|
||||
printer. The base function provides a numeric shorthand to the
|
||||
printed. The base function provides a numeric shorthand to the
|
||||
config("mode") interface. With no args, base() will return the
|
||||
current mode. With 1 arg, base(val) will set the mode according to
|
||||
the arg and return the previous mode.
|
||||
@@ -199,7 +199,7 @@
|
||||
For convenience, any non-integer value is assumed to mean "frac",
|
||||
and any integer >= 2^64 is assumed to mean "exp".
|
||||
|
||||
## Copyright (C) 1999 Landon Curt Noll
|
||||
## Copyright (C) 1999-2007 Landon Curt Noll
|
||||
##
|
||||
## Calc is open software; you can redistribute it and/or modify it under
|
||||
## the terms of the version 2.1 of the GNU Lesser General Public License
|
||||
@@ -215,8 +215,8 @@
|
||||
## 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: builtin.end,v 29.2 2000/06/07 14:02:33 chongo Exp $
|
||||
## @(#) $Revision: 29.3 $
|
||||
## @(#) $Id: builtin.end,v 29.3 2007/02/08 06:25:23 chongo Exp $
|
||||
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/builtin.end,v $
|
||||
##
|
||||
## Under source code control: 1995/07/10 01:17:53
|
||||
|
278
hist.c
278
hist.c
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* hist - interactive readline module
|
||||
*
|
||||
* Copyright (C) 1999-2006 David I. Bell
|
||||
* Copyright (C) 1999-2007 David I. Bell
|
||||
*
|
||||
* 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
|
||||
@@ -17,8 +17,8 @@
|
||||
* 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.12 $
|
||||
* @(#) $Id: hist.c,v 29.12 2006/06/02 09:57:12 chongo Exp $
|
||||
* @(#) $Revision: 29.13 $
|
||||
* @(#) $Id: hist.c,v 29.13 2007/02/11 10:19:14 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/hist.c,v $
|
||||
*
|
||||
* Under source code control: 1993/05/02 20:09:19
|
||||
@@ -71,7 +71,7 @@
|
||||
|
||||
#if !defined(USE_READLINE)
|
||||
|
||||
extern FILE *curstream(void);
|
||||
E_FUNC FILE *curstream(void);
|
||||
|
||||
#define STDIN 0
|
||||
#define SAVE_SIZE 256 /* size of save buffer */
|
||||
@@ -80,7 +80,7 @@ extern FILE *curstream(void);
|
||||
|
||||
#define CONTROL(x) ((char)(((int)(x)) & 0x1f))
|
||||
|
||||
static struct {
|
||||
STATIC struct {
|
||||
char *prompt;
|
||||
char *buf;
|
||||
char *pos;
|
||||
@@ -102,41 +102,41 @@ typedef struct {
|
||||
} FUNC;
|
||||
|
||||
/* declare binding functions */
|
||||
static void flush_input(void);
|
||||
static void start_of_line(void);
|
||||
static void end_of_line(void);
|
||||
static void forward_char(void);
|
||||
static void backward_char(void);
|
||||
static void forward_word(void);
|
||||
static void backward_word(void);
|
||||
static void delete_char(void);
|
||||
static void forward_kill_char(void);
|
||||
static void backward_kill_char(void);
|
||||
static void forward_kill_word(void);
|
||||
static void kill_line(void);
|
||||
static void new_line(void);
|
||||
static void save_line(void);
|
||||
static void forward_history(void);
|
||||
static void backward_history(void);
|
||||
static void insert_char(int key);
|
||||
static void goto_line(void);
|
||||
static void list_history(void);
|
||||
static void refresh_line(void);
|
||||
static void swap_chars(void);
|
||||
static void set_mark(void);
|
||||
static void yank(void);
|
||||
static void save_region(void);
|
||||
static void kill_region(void);
|
||||
static void reverse_search(void);
|
||||
static void quote_char(void);
|
||||
static void uppercase_word(void);
|
||||
static void lowercase_word(void);
|
||||
static void ignore_char(void);
|
||||
static void arrow_key(void);
|
||||
static void quit_calc(void);
|
||||
S_FUNC void flush_input(void);
|
||||
S_FUNC void start_of_line(void);
|
||||
S_FUNC void end_of_line(void);
|
||||
S_FUNC void forward_char(void);
|
||||
S_FUNC void backward_char(void);
|
||||
S_FUNC void forward_word(void);
|
||||
S_FUNC void backward_word(void);
|
||||
S_FUNC void delete_char(void);
|
||||
S_FUNC void forward_kill_char(void);
|
||||
S_FUNC void backward_kill_char(void);
|
||||
S_FUNC void forward_kill_word(void);
|
||||
S_FUNC void kill_line(void);
|
||||
S_FUNC void new_line(void);
|
||||
S_FUNC void save_line(void);
|
||||
S_FUNC void forward_history(void);
|
||||
S_FUNC void backward_history(void);
|
||||
S_FUNC void insert_char(int key);
|
||||
S_FUNC void goto_line(void);
|
||||
S_FUNC void list_history(void);
|
||||
S_FUNC void refresh_line(void);
|
||||
S_FUNC void swap_chars(void);
|
||||
S_FUNC void set_mark(void);
|
||||
S_FUNC void yank(void);
|
||||
S_FUNC void save_region(void);
|
||||
S_FUNC void kill_region(void);
|
||||
S_FUNC void reverse_search(void);
|
||||
S_FUNC void quote_char(void);
|
||||
S_FUNC void uppercase_word(void);
|
||||
S_FUNC void lowercase_word(void);
|
||||
S_FUNC void ignore_char(void);
|
||||
S_FUNC void arrow_key(void);
|
||||
S_FUNC void quit_calc(void);
|
||||
|
||||
|
||||
static FUNC funcs[] =
|
||||
STATIC FUNC funcs[] =
|
||||
{
|
||||
{"ignore-char", ignore_char},
|
||||
{"flush-input", flush_input},
|
||||
@@ -190,11 +190,11 @@ struct key_map {
|
||||
};
|
||||
|
||||
|
||||
static char base_map_name[] = "base-map";
|
||||
static char esc_map_name[] = "esc-map";
|
||||
STATIC char base_map_name[] = "base-map";
|
||||
STATIC char esc_map_name[] = "esc-map";
|
||||
|
||||
|
||||
static KEY_MAP maps[] = {
|
||||
STATIC KEY_MAP maps[] = {
|
||||
{base_map_name, {NULL, NULL}, {NULL, NULL}},
|
||||
{esc_map_name, {NULL, NULL}, {NULL, NULL}},
|
||||
};
|
||||
@@ -213,46 +213,46 @@ typedef struct {
|
||||
} HIST;
|
||||
|
||||
|
||||
static int inited;
|
||||
static int canedit;
|
||||
static int histused;
|
||||
static int key_count;
|
||||
static int save_len;
|
||||
static KEY_MAP *cur_map;
|
||||
static KEY_MAP *base_map;
|
||||
static KEY_ENT key_table[MAX_KEYS];
|
||||
static char histbuf[HIST_SIZE + 1];
|
||||
static char save_buffer[SAVE_SIZE];
|
||||
STATIC int inited;
|
||||
STATIC int canedit;
|
||||
STATIC int histused;
|
||||
STATIC int key_count;
|
||||
STATIC int save_len;
|
||||
STATIC KEY_MAP *cur_map;
|
||||
STATIC KEY_MAP *base_map;
|
||||
STATIC KEY_ENT key_table[MAX_KEYS];
|
||||
STATIC char histbuf[HIST_SIZE + 1];
|
||||
STATIC char save_buffer[SAVE_SIZE];
|
||||
|
||||
/* declare other static functions */
|
||||
static FUNCPTR find_func(char *name);
|
||||
static HIST *get_event(int n);
|
||||
static HIST *find_event(char *pat, int len);
|
||||
static void read_key(void);
|
||||
static void erasechar(void);
|
||||
static void newline(void);
|
||||
static void backspace(void);
|
||||
static void beep(void);
|
||||
static void echo_char(int ch);
|
||||
static void echo_string(char *str, int len);
|
||||
static void savetext(char *str, int len);
|
||||
static void memrcpy(char *dest, char *src, int len);
|
||||
static int read_bindings(FILE *fp);
|
||||
static int in_word(int ch);
|
||||
static KEY_MAP *find_map(char *map);
|
||||
static void unbind_key(KEY_MAP *map, int key);
|
||||
static void raw_bind_key(KEY_MAP *map, int key,
|
||||
S_FUNC FUNCPTR find_func(char *name);
|
||||
S_FUNC HIST *get_event(int n);
|
||||
S_FUNC HIST *find_event(char *pat, int len);
|
||||
S_FUNC void read_key(void);
|
||||
S_FUNC void erasechar(void);
|
||||
S_FUNC void newline(void);
|
||||
S_FUNC void backspace(void);
|
||||
S_FUNC void beep(void);
|
||||
S_FUNC void echo_char(int ch);
|
||||
S_FUNC void echo_string(char *str, int len);
|
||||
S_FUNC void savetext(char *str, int len);
|
||||
S_FUNC void memrcpy(char *dest, char *src, int len);
|
||||
S_FUNC int read_bindings(FILE *fp);
|
||||
S_FUNC int in_word(int ch);
|
||||
S_FUNC KEY_MAP *find_map(char *map);
|
||||
S_FUNC void unbind_key(KEY_MAP *map, int key);
|
||||
S_FUNC void raw_bind_key(KEY_MAP *map, int key,
|
||||
FUNCPTR func, KEY_MAP *next_map);
|
||||
static KEY_MAP *do_map_line(char *line);
|
||||
static void do_default_line(KEY_MAP *map, char *line);
|
||||
static void do_bind_line(KEY_MAP *map, char *line);
|
||||
static void back_over_char(int ch);
|
||||
static void echo_rest_of_line(void);
|
||||
static void goto_start_of_line(void);
|
||||
static void goto_end_of_line(void);
|
||||
static void remove_char(int ch);
|
||||
static void decrement_end(int n);
|
||||
static void insert_string(char *str, int len);
|
||||
S_FUNC KEY_MAP *do_map_line(char *line);
|
||||
S_FUNC void do_default_line(KEY_MAP *map, char *line);
|
||||
S_FUNC void do_bind_line(KEY_MAP *map, char *line);
|
||||
S_FUNC void back_over_char(int ch);
|
||||
S_FUNC void echo_rest_of_line(void);
|
||||
S_FUNC void goto_start_of_line(void);
|
||||
S_FUNC void goto_end_of_line(void);
|
||||
S_FUNC void remove_char(int ch);
|
||||
S_FUNC void decrement_end(int n);
|
||||
S_FUNC void insert_string(char *str, int len);
|
||||
|
||||
|
||||
/*
|
||||
@@ -406,7 +406,7 @@ hist_term(void)
|
||||
}
|
||||
|
||||
|
||||
static KEY_MAP *
|
||||
S_FUNC KEY_MAP *
|
||||
find_map(char *map)
|
||||
{
|
||||
unsigned int i;
|
||||
@@ -419,14 +419,14 @@ find_map(char *map)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
S_FUNC void
|
||||
unbind_key(KEY_MAP *map, int key)
|
||||
{
|
||||
map->map[key] = NULL;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
S_FUNC void
|
||||
raw_bind_key(KEY_MAP *map, int key, FUNCPTR func, KEY_MAP *next_map)
|
||||
{
|
||||
if (map->map[key] == NULL) {
|
||||
@@ -439,7 +439,7 @@ raw_bind_key(KEY_MAP *map, int key, FUNCPTR func, KEY_MAP *next_map)
|
||||
}
|
||||
|
||||
|
||||
static KEY_MAP *
|
||||
S_FUNC KEY_MAP *
|
||||
do_map_line(char *line)
|
||||
{
|
||||
char *cp;
|
||||
@@ -458,7 +458,7 @@ do_map_line(char *line)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
S_FUNC void
|
||||
do_bind_line(KEY_MAP *map, char *line)
|
||||
{
|
||||
char *cp;
|
||||
@@ -529,7 +529,7 @@ do_bind_line(KEY_MAP *map, char *line)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
S_FUNC void
|
||||
do_default_line(KEY_MAP *map, char *line)
|
||||
{
|
||||
char *cp;
|
||||
@@ -584,7 +584,7 @@ do_default_line(KEY_MAP *map, char *line)
|
||||
*
|
||||
* Returns nonzero on error.
|
||||
*/
|
||||
static int
|
||||
S_FUNC int
|
||||
read_bindings(FILE *fp)
|
||||
{
|
||||
char *cp;
|
||||
@@ -621,7 +621,7 @@ read_bindings(FILE *fp)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
S_FUNC void
|
||||
read_key(void)
|
||||
{
|
||||
KEY_ENT *ent;
|
||||
@@ -653,7 +653,7 @@ read_key(void)
|
||||
* Return the Nth history event, indexed from zero.
|
||||
* Earlier history events are lower in number.
|
||||
*/
|
||||
static HIST *
|
||||
S_FUNC HIST *
|
||||
get_event(int n)
|
||||
{
|
||||
register HIST * hp;
|
||||
@@ -671,7 +671,7 @@ get_event(int n)
|
||||
* Search the history list for the specified pattern.
|
||||
* Returns the found history, or NULL.
|
||||
*/
|
||||
static HIST *
|
||||
S_FUNC HIST *
|
||||
find_event(char *pat, int len)
|
||||
{
|
||||
register HIST * hp;
|
||||
@@ -747,7 +747,7 @@ hist_saveline(char *line, int len)
|
||||
/*
|
||||
* Find the function for a specified name.
|
||||
*/
|
||||
static FUNCPTR
|
||||
S_FUNC FUNCPTR
|
||||
find_func(char *name)
|
||||
{
|
||||
FUNC *fp;
|
||||
@@ -760,7 +760,7 @@ find_func(char *name)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
S_FUNC void
|
||||
arrow_key(void)
|
||||
{
|
||||
switch (fgetc(stdin)) {
|
||||
@@ -780,7 +780,7 @@ arrow_key(void)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
S_FUNC void
|
||||
back_over_char(int ch)
|
||||
{
|
||||
backspace();
|
||||
@@ -789,7 +789,7 @@ back_over_char(int ch)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
S_FUNC void
|
||||
remove_char(int ch)
|
||||
{
|
||||
erasechar();
|
||||
@@ -798,14 +798,14 @@ remove_char(int ch)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
S_FUNC void
|
||||
echo_rest_of_line(void)
|
||||
{
|
||||
echo_string(HS.pos, HS.end - HS.pos);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
S_FUNC void
|
||||
goto_start_of_line(void)
|
||||
{
|
||||
while (HS.pos > HS.buf)
|
||||
@@ -813,7 +813,7 @@ goto_start_of_line(void)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
S_FUNC void
|
||||
goto_end_of_line(void)
|
||||
{
|
||||
echo_rest_of_line();
|
||||
@@ -821,7 +821,7 @@ goto_end_of_line(void)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
S_FUNC void
|
||||
decrement_end(int n)
|
||||
{
|
||||
HS.end -= n;
|
||||
@@ -830,13 +830,13 @@ decrement_end(int n)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
S_FUNC void
|
||||
ignore_char(void)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
S_FUNC void
|
||||
flush_input(void)
|
||||
{
|
||||
echo_rest_of_line();
|
||||
@@ -847,21 +847,21 @@ flush_input(void)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
S_FUNC void
|
||||
start_of_line(void)
|
||||
{
|
||||
goto_start_of_line();
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
S_FUNC void
|
||||
end_of_line(void)
|
||||
{
|
||||
goto_end_of_line();
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
S_FUNC void
|
||||
forward_char(void)
|
||||
{
|
||||
if (HS.pos < HS.end)
|
||||
@@ -869,7 +869,7 @@ forward_char(void)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
S_FUNC void
|
||||
backward_char(void)
|
||||
{
|
||||
if (HS.pos > HS.buf)
|
||||
@@ -877,7 +877,7 @@ backward_char(void)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
S_FUNC void
|
||||
uppercase_word(void)
|
||||
{
|
||||
while ((HS.pos < HS.end) && !in_word((int)(*HS.pos)))
|
||||
@@ -890,7 +890,7 @@ uppercase_word(void)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
S_FUNC void
|
||||
lowercase_word(void)
|
||||
{
|
||||
while ((HS.pos < HS.end) && !in_word((int)(*HS.pos)))
|
||||
@@ -903,7 +903,7 @@ lowercase_word(void)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
S_FUNC void
|
||||
forward_word(void)
|
||||
{
|
||||
while ((HS.pos < HS.end) && !in_word((int)(*HS.pos)))
|
||||
@@ -913,7 +913,7 @@ forward_word(void)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
S_FUNC void
|
||||
backward_word(void)
|
||||
{
|
||||
if ((HS.pos > HS.buf) && in_word((int)(*HS.pos)))
|
||||
@@ -927,7 +927,7 @@ backward_word(void)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
S_FUNC void
|
||||
forward_kill_char(void)
|
||||
{
|
||||
int rest;
|
||||
@@ -949,7 +949,7 @@ forward_kill_char(void)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
S_FUNC void
|
||||
delete_char(void)
|
||||
{
|
||||
/*
|
||||
@@ -972,7 +972,7 @@ delete_char(void)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
S_FUNC void
|
||||
backward_kill_char(void)
|
||||
{
|
||||
if (HS.pos > HS.buf) {
|
||||
@@ -983,7 +983,7 @@ backward_kill_char(void)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
S_FUNC void
|
||||
forward_kill_word(void)
|
||||
{
|
||||
char *cp;
|
||||
@@ -1007,7 +1007,7 @@ forward_kill_word(void)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
S_FUNC void
|
||||
kill_line(void)
|
||||
{
|
||||
if (HS.end <= HS.pos)
|
||||
@@ -1026,7 +1026,7 @@ kill_line(void)
|
||||
* The line is NOT put into the edit history, so that the caller can
|
||||
* decide whether or not this should be done.
|
||||
*/
|
||||
static void
|
||||
S_FUNC void
|
||||
new_line(void)
|
||||
{
|
||||
int len;
|
||||
@@ -1050,7 +1050,7 @@ new_line(void)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
S_FUNC void
|
||||
save_line(void)
|
||||
{
|
||||
int len;
|
||||
@@ -1064,7 +1064,7 @@ save_line(void)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
S_FUNC void
|
||||
goto_line(void)
|
||||
{
|
||||
int num;
|
||||
@@ -1088,7 +1088,7 @@ goto_line(void)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
S_FUNC void
|
||||
forward_history(void)
|
||||
{
|
||||
HIST *hp;
|
||||
@@ -1105,7 +1105,7 @@ forward_history(void)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
S_FUNC void
|
||||
backward_history(void)
|
||||
{
|
||||
HIST *hp;
|
||||
@@ -1122,7 +1122,7 @@ backward_history(void)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
S_FUNC void
|
||||
insert_char(int key)
|
||||
{
|
||||
int len;
|
||||
@@ -1145,7 +1145,7 @@ insert_char(int key)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
S_FUNC void
|
||||
insert_string(char *str, int len)
|
||||
{
|
||||
int rest;
|
||||
@@ -1171,7 +1171,7 @@ insert_string(char *str, int len)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
S_FUNC void
|
||||
list_history(void)
|
||||
{
|
||||
HIST *hp;
|
||||
@@ -1186,7 +1186,7 @@ list_history(void)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
S_FUNC void
|
||||
refresh_line(void)
|
||||
{
|
||||
char *cp;
|
||||
@@ -1202,7 +1202,7 @@ refresh_line(void)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
S_FUNC void
|
||||
swap_chars(void)
|
||||
{
|
||||
char ch1;
|
||||
@@ -1221,14 +1221,14 @@ swap_chars(void)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
S_FUNC void
|
||||
set_mark(void)
|
||||
{
|
||||
HS.mark = HS.pos;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
S_FUNC void
|
||||
save_region(void)
|
||||
{
|
||||
int len;
|
||||
@@ -1243,7 +1243,7 @@ save_region(void)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
S_FUNC void
|
||||
kill_region(void)
|
||||
{
|
||||
char *cp;
|
||||
@@ -1275,14 +1275,14 @@ kill_region(void)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
S_FUNC void
|
||||
yank(void)
|
||||
{
|
||||
insert_string(save_buffer, save_len);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
S_FUNC void
|
||||
reverse_search(void)
|
||||
{
|
||||
int len;
|
||||
@@ -1318,7 +1318,7 @@ reverse_search(void)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
S_FUNC void
|
||||
quote_char(void)
|
||||
{
|
||||
int ch;
|
||||
@@ -1332,7 +1332,7 @@ quote_char(void)
|
||||
/*
|
||||
* Save data in the save buffer.
|
||||
*/
|
||||
static void
|
||||
S_FUNC void
|
||||
savetext(char *str, int len)
|
||||
{
|
||||
save_len = 0;
|
||||
@@ -1348,42 +1348,42 @@ savetext(char *str, int len)
|
||||
/*
|
||||
* Test whether a character is part of a word.
|
||||
*/
|
||||
static int
|
||||
S_FUNC int
|
||||
in_word(int ch)
|
||||
{
|
||||
return (isalnum(ch) || (ch == '_'));
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
S_FUNC void
|
||||
erasechar(void)
|
||||
{
|
||||
fputs("\b \b", stdout);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
S_FUNC void
|
||||
newline(void)
|
||||
{
|
||||
fputc('\n', stdout);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
S_FUNC void
|
||||
backspace(void)
|
||||
{
|
||||
fputc('\b', stdout);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
S_FUNC void
|
||||
beep(void)
|
||||
{
|
||||
fputc('\007', stdout);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
S_FUNC void
|
||||
echo_char(int ch)
|
||||
{
|
||||
if (isprint(ch)) {
|
||||
@@ -1395,7 +1395,7 @@ echo_char(int ch)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
S_FUNC void
|
||||
echo_string(char *str, int len)
|
||||
{
|
||||
while (len-- > 0)
|
||||
@@ -1403,7 +1403,7 @@ echo_string(char *str, int len)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
S_FUNC void
|
||||
memrcpy(char *dest, char *src, int len)
|
||||
{
|
||||
dest += len - 1;
|
||||
@@ -1414,7 +1414,7 @@ memrcpy(char *dest, char *src, int len)
|
||||
|
||||
#endif /* !USE_READLINE */
|
||||
|
||||
static void
|
||||
S_FUNC void
|
||||
quit_calc(void)
|
||||
{
|
||||
hist_term();
|
||||
@@ -1480,7 +1480,7 @@ hist_term(void)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
S_FUNC void
|
||||
my_stifle_history (void)
|
||||
{
|
||||
/* only save last number of entries */
|
||||
@@ -1514,7 +1514,7 @@ hist_init(char UNUSED *filename)
|
||||
void
|
||||
hist_saveline(char *line, int len)
|
||||
{
|
||||
static char *prev = NULL;
|
||||
STATIC char *prev = NULL;
|
||||
|
||||
if (len <= 1)
|
||||
return;
|
||||
|
14
hist.h
14
hist.h
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* hist - definitions for command history module
|
||||
*
|
||||
* Copyright (C) 1999-2006 David I. Bell
|
||||
* Copyright (C) 1999-2007 David I. Bell
|
||||
*
|
||||
* 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
|
||||
@@ -17,8 +17,8 @@
|
||||
* 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.6 $
|
||||
* @(#) $Id: hist.h,v 29.6 2006/05/19 15:26:10 chongo Exp $
|
||||
* @(#) $Revision: 29.7 $
|
||||
* @(#) $Id: hist.h,v 29.7 2007/02/11 10:19:14 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/hist.h,v $
|
||||
*
|
||||
* Under source code control: 1993/05/02 20:09:20
|
||||
@@ -68,10 +68,10 @@
|
||||
#define HIST_NOTTY 3 /* terminal modes could not be set */
|
||||
|
||||
|
||||
extern DLL int hist_init(char *filename);
|
||||
extern DLL void hist_term(void);
|
||||
extern DLL size_t hist_getline(char *prompt, char *buf, size_t len);
|
||||
extern DLL void hist_saveline(char *line, int len);
|
||||
E_FUNC int hist_init(char *filename);
|
||||
E_FUNC void hist_term(void);
|
||||
E_FUNC size_t hist_getline(char *prompt, char *buf, size_t len);
|
||||
E_FUNC void hist_saveline(char *line, int len);
|
||||
|
||||
|
||||
#endif /* !__HIST_H__ */
|
||||
|
56
input.c
56
input.c
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* input - nested input source file reader
|
||||
*
|
||||
* Copyright (C) 1999-2006 David I. Bell
|
||||
* Copyright (C) 1999-2007 David I. Bell
|
||||
*
|
||||
* 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
|
||||
@@ -17,8 +17,8 @@
|
||||
* 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.12 $
|
||||
* @(#) $Id: input.c,v 29.12 2006/12/15 17:02:49 chongo Exp $
|
||||
* @(#) $Revision: 29.13 $
|
||||
* @(#) $Id: input.c,v 29.13 2007/02/11 10:19:14 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/input.c,v $
|
||||
*
|
||||
* Under source code control: 1990/02/15 01:48:16
|
||||
@@ -56,9 +56,9 @@
|
||||
#include "conf.h"
|
||||
#include "hist.h"
|
||||
|
||||
extern int stdin_tty; /* TRUE if stdin is a tty */
|
||||
extern FILE *f_open(char *name, char *mode);
|
||||
extern FILE *curstream(void);
|
||||
EXTERN int stdin_tty; /* TRUE if stdin is a tty */
|
||||
E_FUNC FILE *f_open(char *name, char *mode);
|
||||
E_FUNC FILE *curstream(void);
|
||||
|
||||
|
||||
#define TTYSIZE 100 /* reallocation size for terminal buffers */
|
||||
@@ -90,25 +90,25 @@ typedef struct {
|
||||
struct stat inode; /* inode information for file */
|
||||
} READSET;
|
||||
|
||||
static READSET *readset = NULL; /* array of files read */
|
||||
static int maxreadset = 0; /* length of readset */
|
||||
STATIC READSET *readset = NULL; /* array of files read */
|
||||
STATIC int maxreadset = 0; /* length of readset */
|
||||
|
||||
static int linesize; /* current max size of input line */
|
||||
static char *linebuf; /* current input line buffer */
|
||||
static char *prompt; /* current prompt for terminal */
|
||||
static BOOL noprompt; /* TRUE if should not print prompt */
|
||||
STATIC int linesize; /* current max size of input line */
|
||||
STATIC char *linebuf; /* current input line buffer */
|
||||
STATIC char *prompt; /* current prompt for terminal */
|
||||
STATIC BOOL noprompt; /* TRUE if should not print prompt */
|
||||
|
||||
static int depth; /* current input depth */
|
||||
static INPUT *cip; /* current input source */
|
||||
static INPUT inputs[MAXDEPTH]; /* input sources */
|
||||
STATIC int depth; /* current input depth */
|
||||
STATIC INPUT *cip; /* current input source */
|
||||
STATIC INPUT inputs[MAXDEPTH]; /* input sources */
|
||||
|
||||
|
||||
static int openfile(char *name);
|
||||
static int ttychar(void);
|
||||
static int isinoderead(struct stat *sbuf);
|
||||
static int findfreeread(void);
|
||||
static int addreadset(char *name, char *path, struct stat *sbuf);
|
||||
static char *homeexpand(char *name);
|
||||
S_FUNC int openfile(char *name);
|
||||
S_FUNC int ttychar(void);
|
||||
S_FUNC int isinoderead(struct stat *sbuf);
|
||||
S_FUNC int findfreeread(void);
|
||||
S_FUNC int addreadset(char *name, char *path, struct stat *sbuf);
|
||||
S_FUNC char *homeexpand(char *name);
|
||||
|
||||
|
||||
/*
|
||||
@@ -390,7 +390,7 @@ f_pathopen(char *name, char *mode, char *pathlist, char **openpath)
|
||||
* given:
|
||||
* name a filename with a leading ~
|
||||
*/
|
||||
static char *
|
||||
S_FUNC char *
|
||||
homeexpand(char *name)
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
@@ -539,7 +539,7 @@ f_open(char *name, char *mode)
|
||||
* given:
|
||||
* name file name to be read
|
||||
*/
|
||||
static int
|
||||
S_FUNC int
|
||||
openfile(char *name)
|
||||
{
|
||||
FILE *fp; /* open file descriptor */
|
||||
@@ -773,12 +773,12 @@ nextline(void)
|
||||
* The routines in the history module are called so that the user
|
||||
* can use a command history and emacs-like editing of the line.
|
||||
*/
|
||||
static int
|
||||
S_FUNC int
|
||||
ttychar(void)
|
||||
{
|
||||
int ch; /* current char */
|
||||
int len; /* length of current command */
|
||||
static char charbuf[1024];
|
||||
STATIC char charbuf[1024];
|
||||
|
||||
/*
|
||||
* If we have more to read from the saved command line, then do that.
|
||||
@@ -957,7 +957,7 @@ runrcfiles(void)
|
||||
* sbuf stat of the inode in question
|
||||
*/
|
||||
|
||||
static int
|
||||
S_FUNC int
|
||||
isinoderead(struct stat *sbuf)
|
||||
{
|
||||
int i;
|
||||
@@ -1005,7 +1005,7 @@ isinoderead(struct stat *sbuf)
|
||||
*
|
||||
* This function returns the index of the next free element, or -1.
|
||||
*/
|
||||
static int
|
||||
S_FUNC int
|
||||
findfreeread(void)
|
||||
{
|
||||
int i;
|
||||
@@ -1066,7 +1066,7 @@ findfreeread(void)
|
||||
* path full pathname of file
|
||||
* sbuf stat of the path
|
||||
*/
|
||||
static int
|
||||
S_FUNC int
|
||||
addreadset(char *name, char *path, struct stat *sbuf)
|
||||
{
|
||||
int ret; /* index to return */
|
||||
|
14
jump.h
14
jump.h
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* jump - trivial prime jump table
|
||||
*
|
||||
* Copyright (C) 1999 Landon Curt Noll
|
||||
* Copyright (C) 1999-2007 Landon Curt Noll
|
||||
*
|
||||
* Calc is open software; you can redistribute it and/or modify it under
|
||||
* the terms of the version 2.1 of the GNU Lesser General Public License
|
||||
@@ -17,8 +17,8 @@
|
||||
* 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: jump.h,v 29.4 2001/06/08 21:00:58 chongo Exp $
|
||||
* @(#) $Revision: 29.5 $
|
||||
* @(#) $Id: jump.h,v 29.5 2007/02/11 10:19:14 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/jump.h,v $
|
||||
*
|
||||
* Under source code control: 1994/06/29 04:03:55
|
||||
@@ -68,8 +68,10 @@
|
||||
|
||||
#if defined(CALC_SRC) /* if we are building from the calc source tree */
|
||||
# include "have_const.h"
|
||||
# include "decl.h"
|
||||
#else
|
||||
# include <calc/have_const.h>
|
||||
# include <calc/decl.h>
|
||||
#endif
|
||||
|
||||
|
||||
@@ -101,8 +103,8 @@
|
||||
/*
|
||||
* external jump tables
|
||||
*/
|
||||
extern CONST short jmpindx[];
|
||||
extern CONST unsigned char jmp[];
|
||||
extern CONST unsigned char *CONST lastjmp;
|
||||
EXTERN CONST short jmpindx[];
|
||||
EXTERN CONST unsigned char jmp[];
|
||||
EXTERN CONST unsigned char *CONST lastjmp;
|
||||
|
||||
#endif /* !__JUMP_H__ */
|
||||
|
12
label.c
12
label.c
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* label - label handling routines
|
||||
*
|
||||
* Copyright (C) 1999 David I. Bell
|
||||
* Copyright (C) 1999-2007 David I. Bell
|
||||
*
|
||||
* 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
|
||||
@@ -17,8 +17,8 @@
|
||||
* 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: label.c,v 29.2 2000/06/07 14:02:13 chongo Exp $
|
||||
* @(#) $Revision: 29.3 $
|
||||
* @(#) $Id: label.c,v 29.3 2007/02/11 10:19:14 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/label.c,v $
|
||||
*
|
||||
* Under source code control: 1990/02/15 01:48:17
|
||||
@@ -35,9 +35,9 @@
|
||||
#include "opcodes.h"
|
||||
#include "func.h"
|
||||
|
||||
static long labelcount; /* number of user labels defined */
|
||||
static STRINGHEAD labelnames; /* list of user label names */
|
||||
static LABEL labels[MAXLABELS]; /* list of user labels */
|
||||
STATIC long labelcount; /* number of user labels defined */
|
||||
STATIC STRINGHEAD labelnames; /* list of user label names */
|
||||
STATIC LABEL labels[MAXLABELS]; /* list of user labels */
|
||||
|
||||
|
||||
/*
|
||||
|
20
label.h
20
label.h
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* label - label handling routines
|
||||
*
|
||||
* Copyright (C) 1999 David I. Bell
|
||||
* Copyright (C) 1999-2007 David I. Bell
|
||||
*
|
||||
* 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
|
||||
@@ -17,8 +17,8 @@
|
||||
* 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: label.h,v 29.4 2001/06/08 21:00:58 chongo Exp $
|
||||
* @(#) $Revision: 29.5 $
|
||||
* @(#) $Id: label.h,v 29.5 2007/02/11 10:19:14 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/label.h,v $
|
||||
*
|
||||
* Under source code control: 1990/02/15 01:48:33
|
||||
@@ -52,13 +52,13 @@ typedef struct {
|
||||
} LABEL;
|
||||
|
||||
|
||||
extern void initlabels(void);
|
||||
extern void definelabel(char *name);
|
||||
extern void addlabel(char *name);
|
||||
extern void clearlabel(LABEL *lp);
|
||||
extern void setlabel(LABEL *lp);
|
||||
extern void uselabel(LABEL *lp);
|
||||
extern void checklabels(void);
|
||||
E_FUNC void initlabels(void);
|
||||
E_FUNC void definelabel(char *name);
|
||||
E_FUNC void addlabel(char *name);
|
||||
E_FUNC void clearlabel(LABEL *lp);
|
||||
E_FUNC void setlabel(LABEL *lp);
|
||||
E_FUNC void uselabel(LABEL *lp);
|
||||
E_FUNC void checklabels(void);
|
||||
|
||||
|
||||
#endif /* !__LABEL_H__ */
|
||||
|
38
lib_calc.c
38
lib_calc.c
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* lib_calc - calc link library initialization and shutdown routines
|
||||
*
|
||||
* Copyright (C) 1999-2006 Landon Curt Noll
|
||||
* Copyright (C) 1999-2007 Landon Curt Noll
|
||||
*
|
||||
* Calc is open software; you can redistribute it and/or modify it under
|
||||
* the terms of the version 2.1 of the GNU Lesser General Public License
|
||||
@@ -17,8 +17,8 @@
|
||||
* 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.14 $
|
||||
* @(#) $Id: lib_calc.c,v 29.14 2006/05/21 07:28:54 chongo Exp $
|
||||
* @(#) $Revision: 29.15 $
|
||||
* @(#) $Id: lib_calc.c,v 29.15 2007/02/11 10:19:14 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/lib_calc.c,v $
|
||||
*
|
||||
* Under source code control: 1996/06/17 18:06:19
|
||||
@@ -98,8 +98,8 @@ typedef struct {int fd;} ttystruct;
|
||||
#if !defined(HAVE_UID_T) && !defined(_UID_T)
|
||||
typedef unsigned short uid_t;
|
||||
#endif
|
||||
extern char *getenv();
|
||||
extern uid_t geteuid();
|
||||
E_FUNC char *getenv();
|
||||
E_FUNC uid_t geteuid();
|
||||
#endif
|
||||
|
||||
|
||||
@@ -167,23 +167,23 @@ char *user_debug = NULL; /* !=NULL => value of config("user_debug") */
|
||||
/*
|
||||
* initialization functions
|
||||
*/
|
||||
extern void math_setfp(FILE *fp);
|
||||
extern void file_init(void);
|
||||
extern void zio_init(void);
|
||||
extern void initialize(void);
|
||||
extern void reinitialize(void);
|
||||
E_FUNC void math_setfp(FILE *fp);
|
||||
E_FUNC void file_init(void);
|
||||
E_FUNC void zio_init(void);
|
||||
E_FUNC void initialize(void);
|
||||
E_FUNC void reinitialize(void);
|
||||
|
||||
|
||||
/*
|
||||
* static declarations
|
||||
*/
|
||||
static int init_done = 0; /* 1 => we already initialized */
|
||||
static int *fd_setup = NULL; /* fd's setup for interaction or -1 */
|
||||
static int fd_setup_len = 0; /* number of fd's in fd_setup */
|
||||
static ttystruct *fd_orig = NULL; /* fd original state */
|
||||
static ttystruct *fd_cur = NULL; /* fd current state */
|
||||
static void initenv(void); /* setup calc environment */
|
||||
static int find_tty_state(int fd); /* find slot for saved tty state */
|
||||
STATIC int init_done = 0; /* 1 => we already initialized */
|
||||
STATIC int *fd_setup = NULL; /* fd's setup for interaction or -1 */
|
||||
STATIC int fd_setup_len = 0; /* number of fd's in fd_setup */
|
||||
STATIC ttystruct *fd_orig = NULL; /* fd original state */
|
||||
STATIC ttystruct *fd_cur = NULL; /* fd current state */
|
||||
S_FUNC void initenv(void); /* setup calc environment */
|
||||
S_FUNC int find_tty_state(int fd); /* find slot for saved tty state */
|
||||
|
||||
|
||||
/*
|
||||
@@ -394,7 +394,7 @@ cvmalloc_error(char *message)
|
||||
* use a default value. If $HOME does not exist, or is empty, use the home
|
||||
* directory information from the password file.
|
||||
*/
|
||||
static void
|
||||
S_FUNC void
|
||||
initenv(void)
|
||||
{
|
||||
#if !defined(_WIN32)
|
||||
@@ -597,7 +597,7 @@ calc_strdup(CONST char *s1)
|
||||
* Returns:
|
||||
* indx The index into fd_setup[], fd_orig[] and fd_cur[] to use or -1
|
||||
*/
|
||||
static int
|
||||
S_FUNC int
|
||||
find_tty_state(int fd)
|
||||
{
|
||||
int *new_fd_setup; /* new fd_setup array */
|
||||
|
16
lib_util.h
16
lib_util.h
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* lib_util - calc link library utility routines
|
||||
*
|
||||
* Copyright (C) 1999 Landon Curt Noll
|
||||
* Copyright (C) 1999-2007 Landon Curt Noll
|
||||
*
|
||||
* Calc is open software; you can redistribute it and/or modify it under
|
||||
* the terms of the version 2.1 of the GNU Lesser General Public License
|
||||
@@ -17,8 +17,8 @@
|
||||
* 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: lib_util.h,v 29.2 2000/06/07 14:02:13 chongo Exp $
|
||||
* @(#) $Revision: 29.3 $
|
||||
* @(#) $Id: lib_util.h,v 29.3 2007/02/11 10:19:14 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/lib_util.h,v $
|
||||
*
|
||||
* Under source code control: 1997/04/19 21:38:30
|
||||
@@ -38,10 +38,10 @@
|
||||
#define __LIB_UTIL_H__
|
||||
|
||||
/* external functions in lib_util.c */
|
||||
extern int lowhex2bin[256];
|
||||
extern char lowbin2hex[256];
|
||||
extern ZVALUE convstr2z(char*);
|
||||
extern ZVALUE convhex2z(char *hex);
|
||||
extern char *convz2hex(ZVALUE z);
|
||||
EXTERN int lowhex2bin[256];
|
||||
EXTERN char lowbin2hex[256];
|
||||
E_FUNC ZVALUE convstr2z(char*);
|
||||
E_FUNC ZVALUE convhex2z(char *hex);
|
||||
E_FUNC char *convz2hex(ZVALUE z);
|
||||
|
||||
#endif /* __LIB_UTIL_H__ */
|
||||
|
20
listfunc.c
20
listfunc.c
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* listfunc - list handling routines
|
||||
*
|
||||
* Copyright (C) 1999 David I. Bell
|
||||
* Copyright (C) 1999-2007 David I. Bell
|
||||
*
|
||||
* 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
|
||||
@@ -17,8 +17,8 @@
|
||||
* 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.3 $
|
||||
* @(#) $Id: listfunc.c,v 29.3 2006/06/02 10:24:09 chongo Exp $
|
||||
* @(#) $Revision: 29.4 $
|
||||
* @(#) $Id: listfunc.c,v 29.4 2007/02/11 10:19:14 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/listfunc.c,v $
|
||||
*
|
||||
* Under source code control: 1990/02/15 01:48:18
|
||||
@@ -40,11 +40,11 @@
|
||||
#include "value.h"
|
||||
#include "zrand.h"
|
||||
|
||||
extern long irand(long s);
|
||||
E_FUNC long irand(long s);
|
||||
|
||||
static LISTELEM *elemalloc(void);
|
||||
static void elemfree(LISTELEM *ep);
|
||||
static void removelistelement(LIST *lp, LISTELEM *ep);
|
||||
S_FUNC LISTELEM *elemalloc(void);
|
||||
S_FUNC void elemfree(LISTELEM *ep);
|
||||
S_FUNC void removelistelement(LIST *lp, LISTELEM *ep);
|
||||
|
||||
|
||||
/*
|
||||
@@ -224,7 +224,7 @@ removelistmiddle(LIST *lp, long index, VALUE *vp)
|
||||
* lp list header
|
||||
* ep list element to remove
|
||||
*/
|
||||
static void
|
||||
S_FUNC void
|
||||
removelistelement(LIST *lp, LISTELEM *ep)
|
||||
{
|
||||
if ((ep == lp->l_cache) || ((ep != lp->l_first) && (ep != lp->l_last)))
|
||||
@@ -804,7 +804,7 @@ listrandperm(LIST *lp)
|
||||
/*
|
||||
* Allocate an element for a list.
|
||||
*/
|
||||
static LISTELEM *
|
||||
S_FUNC LISTELEM *
|
||||
elemalloc(void)
|
||||
{
|
||||
LISTELEM *ep;
|
||||
@@ -825,7 +825,7 @@ elemalloc(void)
|
||||
/*
|
||||
* Free a list element, along with any contained value.
|
||||
*/
|
||||
static void
|
||||
S_FUNC void
|
||||
elemfree(LISTELEM *ep)
|
||||
{
|
||||
if (ep->e_value.v_type != V_NULL)
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* longbits - Determine the number if bits in a char, short, int or long
|
||||
*
|
||||
* Copyright (C) 1999-2006 Landon Curt Noll
|
||||
* Copyright (C) 1999-2007 Landon Curt Noll
|
||||
*
|
||||
* Calc is open software; you can redistribute it and/or modify it under
|
||||
* the terms of the version 2.1 of the GNU Lesser General Public License
|
||||
@@ -17,8 +17,8 @@
|
||||
* 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.7 $
|
||||
* @(#) $Id: longbits.c,v 29.7 2006/06/01 11:37:20 chongo Exp $
|
||||
* @(#) $Revision: 29.8 $
|
||||
* @(#) $Id: longbits.c,v 29.8 2007/02/11 10:19:14 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/longbits.c,v $
|
||||
*
|
||||
* Under source code control: 1994/03/18 03:06:18
|
||||
@@ -98,7 +98,7 @@
|
||||
|
||||
#if defined(__linux)
|
||||
# if !defined(isascii)
|
||||
extern int isascii(int c);
|
||||
E_FUNC int isascii(int c);
|
||||
# endif /* !isascii */
|
||||
#endif /* __linux */
|
||||
|
||||
|
24
matfunc.c
24
matfunc.c
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* matfunc - extended precision rational arithmetic matrix functions
|
||||
*
|
||||
* Copyright (C) 1999-2004 David I. Bell
|
||||
* Copyright (C) 1999-2007 David I. Bell
|
||||
*
|
||||
* 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
|
||||
@@ -17,8 +17,8 @@
|
||||
* 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.7 $
|
||||
* @(#) $Id: matfunc.c,v 29.7 2006/06/02 10:24:09 chongo Exp $
|
||||
* @(#) $Revision: 29.8 $
|
||||
* @(#) $Id: matfunc.c,v 29.8 2007/02/11 10:19:14 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/matfunc.c,v $
|
||||
*
|
||||
* Under source code control: 1990/02/15 01:48:18
|
||||
@@ -38,12 +38,12 @@
|
||||
|
||||
#include "have_unused.h"
|
||||
|
||||
extern long irand(long s);
|
||||
E_FUNC long irand(long s);
|
||||
|
||||
static void matswaprow(MATRIX *m, long r1, long r2);
|
||||
static void matsubrow(MATRIX *m, long oprow, long baserow, VALUE *mulval);
|
||||
static void matmulrow(MATRIX *m, long row, VALUE *mulval);
|
||||
static MATRIX *matident(MATRIX *m);
|
||||
S_FUNC void matswaprow(MATRIX *m, long r1, long r2);
|
||||
S_FUNC void matsubrow(MATRIX *m, long oprow, long baserow, VALUE *mulval);
|
||||
S_FUNC void matmulrow(MATRIX *m, long row, VALUE *mulval);
|
||||
S_FUNC MATRIX *matident(MATRIX *m);
|
||||
|
||||
|
||||
|
||||
@@ -1043,7 +1043,7 @@ matfill(MATRIX *m, VALUE *v1, VALUE *v2)
|
||||
/*
|
||||
* Set a copy of a square matrix to the identity matrix.
|
||||
*/
|
||||
static MATRIX *
|
||||
S_FUNC MATRIX *
|
||||
matident(MATRIX *m)
|
||||
{
|
||||
register VALUE *val; /* current value */
|
||||
@@ -1318,7 +1318,7 @@ matdet(MATRIX *m)
|
||||
* Local utility routine to swap two rows of a square matrix.
|
||||
* No checks are made to verify the legality of the arguments.
|
||||
*/
|
||||
static void
|
||||
S_FUNC void
|
||||
matswaprow(MATRIX *m, long r1, long r2)
|
||||
{
|
||||
register VALUE *v1, *v2;
|
||||
@@ -1345,7 +1345,7 @@ matswaprow(MATRIX *m, long r1, long r2)
|
||||
* The row to be changed is oprow, the row to be subtracted is baserow.
|
||||
* No checks are made to verify the legality of the arguments.
|
||||
*/
|
||||
static void
|
||||
S_FUNC void
|
||||
matsubrow(MATRIX *m, long oprow, long baserow, VALUE *mulval)
|
||||
{
|
||||
register VALUE *vop, *vbase;
|
||||
@@ -1371,7 +1371,7 @@ matsubrow(MATRIX *m, long oprow, long baserow, VALUE *mulval)
|
||||
* Local utility routine to multiply a row by a specified number.
|
||||
* No checks are made to verify the legality of the arguments.
|
||||
*/
|
||||
static void
|
||||
S_FUNC void
|
||||
matmulrow(MATRIX *m, long row, VALUE *mulval)
|
||||
{
|
||||
register VALUE *val;
|
||||
|
12
math_error.h
12
math_error.h
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* math_error - a simple libcalc math error routine
|
||||
*
|
||||
* Copyright (C) 1999 Landon Curt Noll
|
||||
* Copyright (C) 1999-2007 Landon Curt Noll
|
||||
*
|
||||
* Calc is open software; you can redistribute it and/or modify it under
|
||||
* the terms of the version 2.1 of the GNU Lesser General Public License
|
||||
@@ -17,8 +17,8 @@
|
||||
* 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.5 $
|
||||
* @(#) $Id: math_error.h,v 29.5 2001/06/08 21:00:58 chongo Exp $
|
||||
* @(#) $Revision: 29.6 $
|
||||
* @(#) $Id: math_error.h,v 29.6 2007/02/11 10:19:14 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/math_error.h,v $
|
||||
*
|
||||
* Under source code control: 1997/03/23 18:37:10
|
||||
@@ -34,16 +34,16 @@
|
||||
|
||||
|
||||
#if defined(CALC_SRC) /* if we are building from the calc source tree */
|
||||
# include "win32dll.h"
|
||||
# include "decl.h"
|
||||
#else
|
||||
# include <calc/win32dll.h>
|
||||
# include <calc/decl.h>
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Global data definitions.
|
||||
*/
|
||||
extern DLL jmp_buf jmpbuf; /* for errors */
|
||||
EXTERN jmp_buf jmpbuf; /* for errors */
|
||||
|
||||
|
||||
#endif /* !__MATH_ERROR_H__ */
|
||||
|
8
md5.c
8
md5.c
@@ -10,8 +10,8 @@
|
||||
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
||||
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
* @(#) $Revision: 29.3 $
|
||||
* @(#) $Id: md5.c,v 29.3 2004/08/03 12:28:29 chongo Exp $
|
||||
* @(#) $Revision: 29.4 $
|
||||
* @(#) $Id: md5.c,v 29.4 2007/02/11 10:16:31 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/md5.c,v $
|
||||
*
|
||||
* This file is not covered under version 2.1 of the GNU LGPL.
|
||||
@@ -54,6 +54,7 @@
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include "decl.h"
|
||||
#include "longbits.h"
|
||||
#include "align32.h"
|
||||
#include "endian_calc.h"
|
||||
@@ -61,6 +62,9 @@
|
||||
#include "hash.h"
|
||||
#include "md5.h"
|
||||
|
||||
CONST char *rsa_notice = "The md5 code was derived from the RSA "
|
||||
"Data Security, Inc. MD5 Message-Digest Algorithm.";
|
||||
|
||||
|
||||
/*
|
||||
* The F, G, H and I are basic MD5 functions. The following
|
||||
|
34
obj.c
34
obj.c
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* obj - object handling primitives
|
||||
*
|
||||
* Copyright (C) 1999-2006 David I. Bell
|
||||
* Copyright (C) 1999-2007 David I. Bell
|
||||
*
|
||||
* 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
|
||||
@@ -17,8 +17,8 @@
|
||||
* 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.8 $
|
||||
* @(#) $Id: obj.c,v 29.8 2006/05/20 08:43:55 chongo Exp $
|
||||
* @(#) $Revision: 29.9 $
|
||||
* @(#) $Id: obj.c,v 29.9 2007/02/11 10:19:14 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/obj.c,v $
|
||||
*
|
||||
* Under source code control: 1990/02/15 01:48:19
|
||||
@@ -64,7 +64,7 @@
|
||||
#define ERR_ASSIGN 10 /* assign value */
|
||||
|
||||
|
||||
static struct objectinfo {
|
||||
STATIC struct objectinfo {
|
||||
short args; /* number of arguments */
|
||||
short retval; /* type of return value */
|
||||
short error; /* special action on errors */
|
||||
@@ -119,17 +119,17 @@ static struct objectinfo {
|
||||
};
|
||||
|
||||
|
||||
static STRINGHEAD objectnames; /* names of objects */
|
||||
static STRINGHEAD elements; /* element names for parts of objects */
|
||||
static OBJECTACTIONS **objects; /* table of actions for objects */
|
||||
STATIC STRINGHEAD objectnames; /* names of objects */
|
||||
STATIC STRINGHEAD elements; /* element names for parts of objects */
|
||||
STATIC OBJECTACTIONS **objects; /* table of actions for objects */
|
||||
|
||||
#define OBJALLOC 16
|
||||
static long maxobjcount = 0;
|
||||
STATIC long maxobjcount = 0;
|
||||
|
||||
static VALUE objpowi(VALUE *vp, NUMBER *q);
|
||||
static BOOL objtest(OBJECT *op);
|
||||
static BOOL objcmp(OBJECT *op1, OBJECT *op2);
|
||||
static void objprint(OBJECT *op);
|
||||
S_FUNC VALUE objpowi(VALUE *vp, NUMBER *q);
|
||||
S_FUNC BOOL objtest(OBJECT *op);
|
||||
S_FUNC BOOL objcmp(OBJECT *op1, OBJECT *op2);
|
||||
S_FUNC void objprint(OBJECT *op);
|
||||
|
||||
|
||||
/*
|
||||
@@ -159,7 +159,7 @@ VALUE
|
||||
objcall(int action, VALUE *v1, VALUE *v2, VALUE *v3)
|
||||
{
|
||||
FUNC *fp; /* function to call */
|
||||
static OBJECTACTIONS *oap; /* object to call for */
|
||||
STATIC OBJECTACTIONS *oap; /* object to call for */
|
||||
struct objectinfo *oip; /* information about action */
|
||||
long index; /* index of function (negative if undefined) */
|
||||
VALUE val; /* return value */
|
||||
@@ -332,7 +332,7 @@ objcall(int action, VALUE *v1, VALUE *v2, VALUE *v3)
|
||||
* given:
|
||||
* op object being printed
|
||||
*/
|
||||
static void
|
||||
S_FUNC void
|
||||
objprint(OBJECT *op)
|
||||
{
|
||||
int count; /* number of elements */
|
||||
@@ -354,7 +354,7 @@ objprint(OBJECT *op)
|
||||
* This is the default routine if the user's is not defined.
|
||||
* Returns TRUE if any of the elements are "nonzero".
|
||||
*/
|
||||
static BOOL
|
||||
S_FUNC BOOL
|
||||
objtest(OBJECT *op)
|
||||
{
|
||||
int i; /* loop counter */
|
||||
@@ -373,7 +373,7 @@ objtest(OBJECT *op)
|
||||
* This is the default routine if the user's is not defined.
|
||||
* For equality, all elements must be equal.
|
||||
*/
|
||||
static BOOL
|
||||
S_FUNC BOOL
|
||||
objcmp(OBJECT *op1, OBJECT *op2)
|
||||
{
|
||||
int i; /* loop counter */
|
||||
@@ -399,7 +399,7 @@ objcmp(OBJECT *op1, OBJECT *op2)
|
||||
* vp value to be powered
|
||||
* q power to raise number to
|
||||
*/
|
||||
static VALUE
|
||||
S_FUNC VALUE
|
||||
objpowi(VALUE *vp, NUMBER *q)
|
||||
{
|
||||
VALUE res, tmp;
|
||||
|
14
opcodes.h
14
opcodes.h
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* opcodes - opcode execution module definition
|
||||
*
|
||||
* Copyright (C) 1999-2006 David I. Bell
|
||||
* Copyright (C) 1999-2007 David I. Bell
|
||||
*
|
||||
* 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
|
||||
@@ -17,8 +17,8 @@
|
||||
* 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.7 $
|
||||
* @(#) $Id: opcodes.h,v 29.7 2006/06/25 20:33:26 chongo Exp $
|
||||
* @(#) $Revision: 29.8 $
|
||||
* @(#) $Id: opcodes.h,v 29.8 2007/02/11 10:19:14 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/opcodes.h,v $
|
||||
*
|
||||
* Under source code control: 1990/02/15 01:48:35
|
||||
@@ -33,9 +33,9 @@
|
||||
|
||||
|
||||
#if defined(CALC_SRC) /* if we are building from the calc source tree */
|
||||
# include "win32dll.h"
|
||||
# include "decl.h"
|
||||
#else
|
||||
# include <calc/win32dll.h>
|
||||
# include <calc/decl.h>
|
||||
#endif
|
||||
|
||||
|
||||
@@ -180,8 +180,8 @@
|
||||
/*
|
||||
* external declarations
|
||||
*/
|
||||
extern DLL char *funcname; /* function being executed */
|
||||
extern DLL long funcline; /* function line being executed */
|
||||
EXTERN char *funcname; /* function being executed */
|
||||
EXTERN long funcline; /* function line being executed */
|
||||
|
||||
|
||||
#endif /* !__OPCODES_H__ */
|
||||
|
12
prime.c
12
prime.c
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* prime - quickly determine if a small number is prime
|
||||
*
|
||||
* Copyright (C) 1999 Landon Curt Noll
|
||||
* Copyright (C) 1999-2007 Landon Curt Noll
|
||||
*
|
||||
* Calc is open software; you can redistribute it and/or modify it under
|
||||
* the terms of the version 2.1 of the GNU Lesser General Public License
|
||||
@@ -17,8 +17,8 @@
|
||||
* 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: prime.c,v 29.2 2000/06/07 14:02:13 chongo Exp $
|
||||
* @(#) $Revision: 29.3 $
|
||||
* @(#) $Id: prime.c,v 29.3 2007/02/11 10:19:14 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/prime.c,v $
|
||||
*
|
||||
* Under source code control: 1994/06/04 03:26:14
|
||||
@@ -916,11 +916,11 @@ CONST unsigned short prime[MAP_POPCNT+1] = {
|
||||
* smallest prime > MAX_SM_PRIME (2^32-5) == 2^32+15
|
||||
*/
|
||||
#if BASEB == 32
|
||||
static CONST HALF _nxt_prime_val_[] = { 0xf, 0x1 };
|
||||
STATIC CONST HALF _nxt_prime_val_[] = { 0xf, 0x1 };
|
||||
ZVALUE CONST _nxt_prime_ = { (HALF *)_nxt_prime_val_, 2, 0 };
|
||||
NUMBER _nxtprime_ = {{(HALF *)_nxt_prime_val_,2,0}, {_oneval_,1,0}, 1, NULL};
|
||||
#else
|
||||
static CONST HALF _nxt_prime_val_[] = { 0xf, 0x0, 0x1 };
|
||||
STATIC CONST HALF _nxt_prime_val_[] = { 0xf, 0x0, 0x1 };
|
||||
ZVALUE CONST _nxt_prime_ = { (HALF *)_nxt_prime_val_, 3, 0 };
|
||||
NUMBER _nxtprime_ = {{(HALF *)_nxt_prime_val_,3,0}, {_oneval_,1,0}, 1, NULL};
|
||||
#endif
|
||||
@@ -928,5 +928,5 @@ NUMBER _nxtprime_ = {{(HALF *)_nxt_prime_val_,3,0}, {_oneval_,1,0}, 1, NULL};
|
||||
/*
|
||||
* JMPMOD*2 as a ZVALUE
|
||||
*/
|
||||
static CONST HALF _jmpmod2_val_[] = { JMPMOD*2 };
|
||||
STATIC CONST HALF _jmpmod2_val_[] = { JMPMOD*2 };
|
||||
CONST ZVALUE _jmpmod2_ = { (HALF *)_jmpmod2_val_, 1, 0 };
|
||||
|
20
prime.h
20
prime.h
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* prime - quickly determine if a small number is prime
|
||||
*
|
||||
* Copyright (C) 1999 Landon Curt Noll
|
||||
* Copyright (C) 1999-2007 Landon Curt Noll
|
||||
*
|
||||
* Calc is open software; you can redistribute it and/or modify it under
|
||||
* the terms of the version 2.1 of the GNU Lesser General Public License
|
||||
@@ -17,8 +17,8 @@
|
||||
* 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: prime.h,v 29.4 2001/06/08 21:00:58 chongo Exp $
|
||||
* @(#) $Revision: 29.5 $
|
||||
* @(#) $Id: prime.h,v 29.5 2007/02/11 10:19:14 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/prime.h,v $
|
||||
*
|
||||
* Under source code control: 1994/06/04 03:26:15
|
||||
@@ -82,13 +82,13 @@
|
||||
/*
|
||||
* Prime related external arrays.
|
||||
*/
|
||||
extern CONST unsigned short prime[];
|
||||
extern CONST unsigned char pr_map[];
|
||||
extern CONST unsigned short pi10b[];
|
||||
extern CONST unsigned short pi18b[];
|
||||
extern NUMBER _nxtprime_; /* 2^32+15 - smallest prime > 2^32 */
|
||||
extern CONST ZVALUE _nxt_prime_; /* 2^32+15 - smallest prime > 2^32 */
|
||||
extern CONST ZVALUE _jmpmod2_; /* JMPMOD*2 as a ZVALUE */
|
||||
EXTERN CONST unsigned short prime[];
|
||||
EXTERN CONST unsigned char pr_map[];
|
||||
EXTERN CONST unsigned short pi10b[];
|
||||
EXTERN CONST unsigned short pi18b[];
|
||||
EXTERN NUMBER _nxtprime_; /* 2^32+15 - smallest prime > 2^32 */
|
||||
EXTERN CONST ZVALUE _nxt_prime_; /* 2^32+15 - smallest prime > 2^32 */
|
||||
EXTERN CONST ZVALUE _jmpmod2_; /* JMPMOD*2 as a ZVALUE */
|
||||
|
||||
|
||||
#endif /* !__PRIME_H__ */
|
||||
|
16
qfunc.c
16
qfunc.c
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* qfunc - extended precision rational arithmetic non-primitive functions
|
||||
*
|
||||
* Copyright (C) 1999-2004 David I. Bell and Ernest Bowen
|
||||
* Copyright (C) 1999-2007 David I. Bell and Ernest Bowen
|
||||
*
|
||||
* Primary author: David I. Bell
|
||||
*
|
||||
@@ -19,8 +19,8 @@
|
||||
* 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.9 $
|
||||
* @(#) $Id: qfunc.c,v 29.9 2006/05/20 08:43:55 chongo Exp $
|
||||
* @(#) $Revision: 29.10 $
|
||||
* @(#) $Id: qfunc.c,v 29.10 2007/02/11 10:19:14 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/qfunc.c,v $
|
||||
*
|
||||
* Under source code control: 1990/02/15 01:48:20
|
||||
@@ -34,11 +34,11 @@
|
||||
#include "config.h"
|
||||
#include "prime.h"
|
||||
|
||||
static NUMBER **B_table;
|
||||
static long B_num;
|
||||
static long B_allocnum;
|
||||
static NUMBER **E_table;
|
||||
static long E_num;
|
||||
STATIC NUMBER **B_table;
|
||||
STATIC long B_num;
|
||||
STATIC long B_allocnum;
|
||||
STATIC NUMBER **E_table;
|
||||
STATIC long E_num;
|
||||
|
||||
#define QALLOCNUM 64
|
||||
|
||||
|
10
qio.c
10
qio.c
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* qio - scanf and printf routines for arbitrary precision rational numbers
|
||||
*
|
||||
* Copyright (C) 1999-2004 David I. Bell
|
||||
* Copyright (C) 1999-2007 David I. Bell
|
||||
*
|
||||
* 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
|
||||
@@ -17,8 +17,8 @@
|
||||
* 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.8 $
|
||||
* @(#) $Id: qio.c,v 29.8 2006/05/20 08:43:55 chongo Exp $
|
||||
* @(#) $Revision: 29.9 $
|
||||
* @(#) $Id: qio.c,v 29.9 2007/02/11 10:19:14 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/qio.c,v $
|
||||
*
|
||||
* Under source code control: 1993/07/30 19:42:46
|
||||
@@ -40,8 +40,8 @@
|
||||
#define PRINTF1(fmt, a1) math_fmt(fmt, a1)
|
||||
#define PRINTF2(fmt, a1, a2) math_fmt(fmt, a1, a2)
|
||||
|
||||
static long scalefactor;
|
||||
static ZVALUE scalenumber = { 0, 0, 0 };
|
||||
STATIC long scalefactor;
|
||||
STATIC ZVALUE scalenumber = { 0, 0, 0 };
|
||||
|
||||
|
||||
/*
|
||||
|
12
qmath.c
12
qmath.c
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* qmath - extended precision rational arithmetic primitive routines
|
||||
*
|
||||
* Copyright (C) 1999-2004 David I. Bell and Ernest Bowen
|
||||
* Copyright (C) 1999-2007 David I. Bell and Ernest Bowen
|
||||
*
|
||||
* Primary author: David I. Bell
|
||||
*
|
||||
@@ -19,8 +19,8 @@
|
||||
* 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.7 $
|
||||
* @(#) $Id: qmath.c,v 29.7 2006/12/15 16:18:10 chongo Exp $
|
||||
* @(#) $Revision: 29.8 $
|
||||
* @(#) $Id: qmath.c,v 29.8 2007/02/11 10:19:14 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/qmath.c,v $
|
||||
*
|
||||
* Under source code control: 1990/02/15 01:48:21
|
||||
@@ -1393,9 +1393,9 @@ qcmpi(NUMBER *q, long n)
|
||||
#define NNALLOC 1000
|
||||
|
||||
|
||||
static NUMBER *freeNum = NULL;
|
||||
static NUMBER **firstNums = NULL;
|
||||
static long blockcount = 0;
|
||||
STATIC NUMBER *freeNum = NULL;
|
||||
STATIC NUMBER **firstNums = NULL;
|
||||
STATIC long blockcount = 0;
|
||||
|
||||
|
||||
NUMBER *
|
||||
|
314
qmath.h
314
qmath.h
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* qmath - declarations for extended precision rational arithmetic
|
||||
*
|
||||
* Copyright (C) 1999-2006 David I. Bell
|
||||
* Copyright (C) 1999-2007 David I. Bell
|
||||
*
|
||||
* 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
|
||||
@@ -17,8 +17,8 @@
|
||||
* 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.8 $
|
||||
* @(#) $Id: qmath.h,v 29.8 2006/12/15 16:18:10 chongo Exp $
|
||||
* @(#) $Revision: 29.9 $
|
||||
* @(#) $Id: qmath.h,v 29.9 2007/02/11 10:19:14 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/qmath.h,v $
|
||||
*
|
||||
* Under source code control: 1993/07/30 19:42:47
|
||||
@@ -53,188 +53,188 @@ struct number {
|
||||
|
||||
typedef struct number NUMBER;
|
||||
|
||||
extern NUMBER _qlge_;
|
||||
EXTERN NUMBER _qlge_;
|
||||
|
||||
/*
|
||||
* Input. output, allocation, and conversion routines.
|
||||
*/
|
||||
extern NUMBER *qalloc(void);
|
||||
extern NUMBER *qcopy(NUMBER *q);
|
||||
extern NUMBER *uutoq(FULL i1, FULL i2);
|
||||
extern NUMBER *iitoq(long i1, long i2);
|
||||
extern NUMBER *str2q(char *str);
|
||||
extern NUMBER *itoq(long i);
|
||||
extern NUMBER *utoq(FULL i);
|
||||
extern NUMBER *stoq(SFULL i);
|
||||
extern long qtoi(NUMBER *q);
|
||||
extern FULL qtou(NUMBER *q);
|
||||
extern SFULL qtos(NUMBER *q);
|
||||
extern long qparse(char *str, int flags);
|
||||
extern void qfreenum(NUMBER *q);
|
||||
extern void qprintnum(NUMBER *q, int mode);
|
||||
extern void qprintff(NUMBER *q, long width, long precision);
|
||||
extern void qprintfe(NUMBER *q, long width, long precision);
|
||||
extern void qprintfr(NUMBER *q, long width, BOOL force);
|
||||
extern void qprintfd(NUMBER *q, long width);
|
||||
extern void qprintfx(NUMBER *q, long width);
|
||||
extern void qprintfb(NUMBER *q, long width);
|
||||
extern void qprintfo(NUMBER *q, long width);
|
||||
extern void qprintf(char *, ...);
|
||||
extern void shownumbers(void);
|
||||
extern void showredcdata(void);
|
||||
extern void freeredcdata(void);
|
||||
extern void fitprint(NUMBER *, long);
|
||||
E_FUNC NUMBER *qalloc(void);
|
||||
E_FUNC NUMBER *qcopy(NUMBER *q);
|
||||
E_FUNC NUMBER *uutoq(FULL i1, FULL i2);
|
||||
E_FUNC NUMBER *iitoq(long i1, long i2);
|
||||
E_FUNC NUMBER *str2q(char *str);
|
||||
E_FUNC NUMBER *itoq(long i);
|
||||
E_FUNC NUMBER *utoq(FULL i);
|
||||
E_FUNC NUMBER *stoq(SFULL i);
|
||||
E_FUNC long qtoi(NUMBER *q);
|
||||
E_FUNC FULL qtou(NUMBER *q);
|
||||
E_FUNC SFULL qtos(NUMBER *q);
|
||||
E_FUNC long qparse(char *str, int flags);
|
||||
E_FUNC void qfreenum(NUMBER *q);
|
||||
E_FUNC void qprintnum(NUMBER *q, int mode);
|
||||
E_FUNC void qprintff(NUMBER *q, long width, long precision);
|
||||
E_FUNC void qprintfe(NUMBER *q, long width, long precision);
|
||||
E_FUNC void qprintfr(NUMBER *q, long width, BOOL force);
|
||||
E_FUNC void qprintfd(NUMBER *q, long width);
|
||||
E_FUNC void qprintfx(NUMBER *q, long width);
|
||||
E_FUNC void qprintfb(NUMBER *q, long width);
|
||||
E_FUNC void qprintfo(NUMBER *q, long width);
|
||||
E_FUNC void qprintf(char *, ...);
|
||||
E_FUNC void shownumbers(void);
|
||||
E_FUNC void showredcdata(void);
|
||||
E_FUNC void freeredcdata(void);
|
||||
E_FUNC void fitprint(NUMBER *, long);
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Basic numeric routines.
|
||||
*/
|
||||
extern NUMBER *qaddi(NUMBER *q, long i);
|
||||
extern NUMBER *qmuli(NUMBER *q, long i);
|
||||
extern NUMBER *qdivi(NUMBER *q, long i);
|
||||
extern NUMBER *qqadd(NUMBER *q1, NUMBER *q2);
|
||||
extern NUMBER *qsub(NUMBER *q1, NUMBER *q2);
|
||||
extern NUMBER *qmul(NUMBER *q1, NUMBER *q2);
|
||||
extern NUMBER *qqdiv(NUMBER *q1, NUMBER *q2);
|
||||
extern NUMBER *qquo(NUMBER *q1, NUMBER *q2, long rnd);
|
||||
extern NUMBER *qmod(NUMBER *q1, NUMBER *q2, long rnd);
|
||||
extern NUMBER *qmin(NUMBER *q1, NUMBER *q2);
|
||||
extern NUMBER *qmax(NUMBER *q1, NUMBER *q2);
|
||||
extern NUMBER *qand(NUMBER *q1, NUMBER *q2);
|
||||
extern NUMBER *qor(NUMBER *q1, NUMBER *q2);
|
||||
extern NUMBER *qxor(NUMBER *q1, NUMBER *q2);
|
||||
extern NUMBER *qandnot(NUMBER *q1, NUMBER *q2);
|
||||
extern NUMBER *qcomp(NUMBER *q);
|
||||
extern NUMBER *qpowermod(NUMBER *q1, NUMBER *q2, NUMBER *q3);
|
||||
extern NUMBER *qpowi(NUMBER *q1, NUMBER *q2);
|
||||
extern NUMBER *qsquare(NUMBER *q);
|
||||
extern NUMBER *qneg(NUMBER *q);
|
||||
extern NUMBER *qsign(NUMBER *q);
|
||||
extern NUMBER *qint(NUMBER *q);
|
||||
extern NUMBER *qfrac(NUMBER *q);
|
||||
extern NUMBER *qnum(NUMBER *q);
|
||||
extern NUMBER *qden(NUMBER *q);
|
||||
extern NUMBER *qinv(NUMBER *q);
|
||||
extern NUMBER *qqabs(NUMBER *q);
|
||||
extern NUMBER *qinc(NUMBER *q);
|
||||
extern NUMBER *qdec(NUMBER *q);
|
||||
extern NUMBER *qshift(NUMBER *q, long n);
|
||||
extern NUMBER *qtrunc(NUMBER *q1, NUMBER *q2);
|
||||
extern NUMBER *qround(NUMBER *q, long places, long rnd);
|
||||
extern NUMBER *qbtrunc(NUMBER *q1, NUMBER *q2);
|
||||
extern NUMBER *qbround(NUMBER *q, long places, long rnd);
|
||||
extern NUMBER *qscale(NUMBER *q, long i);
|
||||
extern BOOL qdivides(NUMBER *q1, NUMBER *q2);
|
||||
extern BOOL qcmp(NUMBER *q1, NUMBER *q2);
|
||||
extern BOOL qcmpi(NUMBER *q, long i);
|
||||
extern FLAG qrel(NUMBER *q1, NUMBER *q2);
|
||||
extern FLAG qreli(NUMBER *q, long i);
|
||||
extern BOOL qisset(NUMBER *q, long i);
|
||||
E_FUNC NUMBER *qaddi(NUMBER *q, long i);
|
||||
E_FUNC NUMBER *qmuli(NUMBER *q, long i);
|
||||
E_FUNC NUMBER *qdivi(NUMBER *q, long i);
|
||||
E_FUNC NUMBER *qqadd(NUMBER *q1, NUMBER *q2);
|
||||
E_FUNC NUMBER *qsub(NUMBER *q1, NUMBER *q2);
|
||||
E_FUNC NUMBER *qmul(NUMBER *q1, NUMBER *q2);
|
||||
E_FUNC NUMBER *qqdiv(NUMBER *q1, NUMBER *q2);
|
||||
E_FUNC NUMBER *qquo(NUMBER *q1, NUMBER *q2, long rnd);
|
||||
E_FUNC NUMBER *qmod(NUMBER *q1, NUMBER *q2, long rnd);
|
||||
E_FUNC NUMBER *qmin(NUMBER *q1, NUMBER *q2);
|
||||
E_FUNC NUMBER *qmax(NUMBER *q1, NUMBER *q2);
|
||||
E_FUNC NUMBER *qand(NUMBER *q1, NUMBER *q2);
|
||||
E_FUNC NUMBER *qor(NUMBER *q1, NUMBER *q2);
|
||||
E_FUNC NUMBER *qxor(NUMBER *q1, NUMBER *q2);
|
||||
E_FUNC NUMBER *qandnot(NUMBER *q1, NUMBER *q2);
|
||||
E_FUNC NUMBER *qcomp(NUMBER *q);
|
||||
E_FUNC NUMBER *qpowermod(NUMBER *q1, NUMBER *q2, NUMBER *q3);
|
||||
E_FUNC NUMBER *qpowi(NUMBER *q1, NUMBER *q2);
|
||||
E_FUNC NUMBER *qsquare(NUMBER *q);
|
||||
E_FUNC NUMBER *qneg(NUMBER *q);
|
||||
E_FUNC NUMBER *qsign(NUMBER *q);
|
||||
E_FUNC NUMBER *qint(NUMBER *q);
|
||||
E_FUNC NUMBER *qfrac(NUMBER *q);
|
||||
E_FUNC NUMBER *qnum(NUMBER *q);
|
||||
E_FUNC NUMBER *qden(NUMBER *q);
|
||||
E_FUNC NUMBER *qinv(NUMBER *q);
|
||||
E_FUNC NUMBER *qqabs(NUMBER *q);
|
||||
E_FUNC NUMBER *qinc(NUMBER *q);
|
||||
E_FUNC NUMBER *qdec(NUMBER *q);
|
||||
E_FUNC NUMBER *qshift(NUMBER *q, long n);
|
||||
E_FUNC NUMBER *qtrunc(NUMBER *q1, NUMBER *q2);
|
||||
E_FUNC NUMBER *qround(NUMBER *q, long places, long rnd);
|
||||
E_FUNC NUMBER *qbtrunc(NUMBER *q1, NUMBER *q2);
|
||||
E_FUNC NUMBER *qbround(NUMBER *q, long places, long rnd);
|
||||
E_FUNC NUMBER *qscale(NUMBER *q, long i);
|
||||
E_FUNC BOOL qdivides(NUMBER *q1, NUMBER *q2);
|
||||
E_FUNC BOOL qcmp(NUMBER *q1, NUMBER *q2);
|
||||
E_FUNC BOOL qcmpi(NUMBER *q, long i);
|
||||
E_FUNC FLAG qrel(NUMBER *q1, NUMBER *q2);
|
||||
E_FUNC FLAG qreli(NUMBER *q, long i);
|
||||
E_FUNC BOOL qisset(NUMBER *q, long i);
|
||||
|
||||
|
||||
/*
|
||||
* More complicated numeric functions.
|
||||
*/
|
||||
extern NUMBER *qcomb(NUMBER *q1, NUMBER *q2);
|
||||
extern NUMBER *qgcd(NUMBER *q1, NUMBER *q2);
|
||||
extern NUMBER *qlcm(NUMBER *q1, NUMBER *q2);
|
||||
extern NUMBER *qfact(NUMBER *q);
|
||||
extern NUMBER *qpfact(NUMBER *q);
|
||||
extern NUMBER *qminv(NUMBER *q1, NUMBER *q2);
|
||||
extern NUMBER *qfacrem(NUMBER *q1, NUMBER *q2);
|
||||
extern NUMBER *qperm(NUMBER *q1, NUMBER *q2);
|
||||
extern NUMBER *qgcdrem(NUMBER *q1, NUMBER *q2);
|
||||
extern NUMBER *qlowfactor(NUMBER *q1, NUMBER *q2);
|
||||
extern NUMBER *qfib(NUMBER *q);
|
||||
extern NUMBER *qcfappr(NUMBER *q, NUMBER *epsilon, long R);
|
||||
extern NUMBER *qcfsim(NUMBER *q, long R);
|
||||
extern NUMBER *qisqrt(NUMBER *q);
|
||||
extern NUMBER *qjacobi(NUMBER *q1, NUMBER *q2);
|
||||
extern NUMBER *qiroot(NUMBER *q1, NUMBER *q2);
|
||||
extern NUMBER *qmappr(NUMBER *q, NUMBER *e, long R);
|
||||
extern NUMBER *qlcmfact(NUMBER *q);
|
||||
extern NUMBER *qredcin(NUMBER *q1, NUMBER *q2);
|
||||
extern NUMBER *qredcout(NUMBER *q1, NUMBER *q2);
|
||||
extern NUMBER *qredcmul(NUMBER *q1, NUMBER *q2, NUMBER *q3);
|
||||
extern NUMBER *qredcsquare(NUMBER *q1, NUMBER *q2);
|
||||
extern NUMBER *qredcpower(NUMBER *q1, NUMBER *q2, NUMBER *q3);
|
||||
extern BOOL qprimetest(NUMBER *q1, NUMBER *q2, NUMBER *q3);
|
||||
extern BOOL qissquare(NUMBER *q);
|
||||
extern long qilog2(NUMBER *q);
|
||||
extern long qilog10(NUMBER *q);
|
||||
extern NUMBER *qilog(NUMBER *q, ZVALUE base);
|
||||
extern BOOL qcmpmod(NUMBER *q1, NUMBER *q2, NUMBER *q3);
|
||||
extern BOOL qquomod(NUMBER *q1, NUMBER *q2, NUMBER **quo, NUMBER **mod, long rnd);
|
||||
extern FLAG qnear(NUMBER *q1, NUMBER *q2, NUMBER *epsilon);
|
||||
extern NUMBER *qdigit(NUMBER *q, ZVALUE dpos, ZVALUE base);
|
||||
extern long qprecision(NUMBER *q);
|
||||
extern long qplaces(NUMBER *q, ZVALUE base);
|
||||
extern long qdecplaces(NUMBER *q);
|
||||
extern long qdigits(NUMBER *q, ZVALUE base);
|
||||
extern void setepsilon(NUMBER *q);
|
||||
extern NUMBER *qbitvalue(long i);
|
||||
extern NUMBER *qtenpow(long i);
|
||||
E_FUNC NUMBER *qcomb(NUMBER *q1, NUMBER *q2);
|
||||
E_FUNC NUMBER *qgcd(NUMBER *q1, NUMBER *q2);
|
||||
E_FUNC NUMBER *qlcm(NUMBER *q1, NUMBER *q2);
|
||||
E_FUNC NUMBER *qfact(NUMBER *q);
|
||||
E_FUNC NUMBER *qpfact(NUMBER *q);
|
||||
E_FUNC NUMBER *qminv(NUMBER *q1, NUMBER *q2);
|
||||
E_FUNC NUMBER *qfacrem(NUMBER *q1, NUMBER *q2);
|
||||
E_FUNC NUMBER *qperm(NUMBER *q1, NUMBER *q2);
|
||||
E_FUNC NUMBER *qgcdrem(NUMBER *q1, NUMBER *q2);
|
||||
E_FUNC NUMBER *qlowfactor(NUMBER *q1, NUMBER *q2);
|
||||
E_FUNC NUMBER *qfib(NUMBER *q);
|
||||
E_FUNC NUMBER *qcfappr(NUMBER *q, NUMBER *epsilon, long R);
|
||||
E_FUNC NUMBER *qcfsim(NUMBER *q, long R);
|
||||
E_FUNC NUMBER *qisqrt(NUMBER *q);
|
||||
E_FUNC NUMBER *qjacobi(NUMBER *q1, NUMBER *q2);
|
||||
E_FUNC NUMBER *qiroot(NUMBER *q1, NUMBER *q2);
|
||||
E_FUNC NUMBER *qmappr(NUMBER *q, NUMBER *e, long R);
|
||||
E_FUNC NUMBER *qlcmfact(NUMBER *q);
|
||||
E_FUNC NUMBER *qredcin(NUMBER *q1, NUMBER *q2);
|
||||
E_FUNC NUMBER *qredcout(NUMBER *q1, NUMBER *q2);
|
||||
E_FUNC NUMBER *qredcmul(NUMBER *q1, NUMBER *q2, NUMBER *q3);
|
||||
E_FUNC NUMBER *qredcsquare(NUMBER *q1, NUMBER *q2);
|
||||
E_FUNC NUMBER *qredcpower(NUMBER *q1, NUMBER *q2, NUMBER *q3);
|
||||
E_FUNC BOOL qprimetest(NUMBER *q1, NUMBER *q2, NUMBER *q3);
|
||||
E_FUNC BOOL qissquare(NUMBER *q);
|
||||
E_FUNC long qilog2(NUMBER *q);
|
||||
E_FUNC long qilog10(NUMBER *q);
|
||||
E_FUNC NUMBER *qilog(NUMBER *q, ZVALUE base);
|
||||
E_FUNC BOOL qcmpmod(NUMBER *q1, NUMBER *q2, NUMBER *q3);
|
||||
E_FUNC BOOL qquomod(NUMBER *q1, NUMBER *q2, NUMBER **quo, NUMBER **mod, long rnd);
|
||||
E_FUNC FLAG qnear(NUMBER *q1, NUMBER *q2, NUMBER *epsilon);
|
||||
E_FUNC NUMBER *qdigit(NUMBER *q, ZVALUE dpos, ZVALUE base);
|
||||
E_FUNC long qprecision(NUMBER *q);
|
||||
E_FUNC long qplaces(NUMBER *q, ZVALUE base);
|
||||
E_FUNC long qdecplaces(NUMBER *q);
|
||||
E_FUNC long qdigits(NUMBER *q, ZVALUE base);
|
||||
E_FUNC void setepsilon(NUMBER *q);
|
||||
E_FUNC NUMBER *qbitvalue(long i);
|
||||
E_FUNC NUMBER *qtenpow(long i);
|
||||
|
||||
|
||||
/*
|
||||
* Transcendental functions. These all take an epsilon argument to
|
||||
* specify the required accuracy of the calculation.
|
||||
*/
|
||||
extern void qsincos(NUMBER *q, long bitnum, NUMBER **vs, NUMBER **vc);
|
||||
extern NUMBER *qsqrt(NUMBER *q, NUMBER *epsilon, long R);
|
||||
extern NUMBER *qpower(NUMBER *q1, NUMBER *q2, NUMBER *epsilon);
|
||||
extern NUMBER *qroot(NUMBER *q1, NUMBER *q2, NUMBER *epsilon);
|
||||
extern NUMBER *qcos(NUMBER *q, NUMBER *epsilon);
|
||||
extern NUMBER *qsin(NUMBER *q, NUMBER *epsilon);
|
||||
extern NUMBER *qexp(NUMBER *q, NUMBER *epsilon);
|
||||
extern NUMBER *qln(NUMBER *q, NUMBER *epsilon);
|
||||
extern NUMBER *qlog(NUMBER *q, NUMBER *epsilon);
|
||||
extern NUMBER *qtan(NUMBER *q, NUMBER *epsilon);
|
||||
extern NUMBER *qsec(NUMBER *q, NUMBER *epsilon);
|
||||
extern NUMBER *qcot(NUMBER *q, NUMBER *epsilon);
|
||||
extern NUMBER *qcsc(NUMBER *q, NUMBER *epsilon);
|
||||
extern NUMBER *qacos(NUMBER *q, NUMBER *epsilon);
|
||||
extern NUMBER *qasin(NUMBER *q, NUMBER *epsilon);
|
||||
extern NUMBER *qatan(NUMBER *q, NUMBER *epsilon);
|
||||
extern NUMBER *qasec(NUMBER *q, NUMBER *epsilon);
|
||||
extern NUMBER *qacsc(NUMBER *q, NUMBER *epsilon);
|
||||
extern NUMBER *qacot(NUMBER *q, NUMBER *epsilon);
|
||||
extern NUMBER *qatan2(NUMBER *q1, NUMBER *q2, NUMBER *epsilon);
|
||||
extern NUMBER *qhypot(NUMBER *q1, NUMBER *q2, NUMBER *epsilon);
|
||||
extern NUMBER *qcosh(NUMBER *q, NUMBER *epsilon);
|
||||
extern NUMBER *qsinh(NUMBER *q, NUMBER *epsilon);
|
||||
extern NUMBER *qtanh(NUMBER *q, NUMBER *epsilon);
|
||||
extern NUMBER *qcoth(NUMBER *q, NUMBER *epsilon);
|
||||
extern NUMBER *qsech(NUMBER *q, NUMBER *epsilon);
|
||||
extern NUMBER *qcsch(NUMBER *q, NUMBER *epsilon);
|
||||
extern NUMBER *qacosh(NUMBER *q, NUMBER *epsilon);
|
||||
extern NUMBER *qasinh(NUMBER *q, NUMBER *epsilon);
|
||||
extern NUMBER *qatanh(NUMBER *q, NUMBER *epsilon);
|
||||
extern NUMBER *qasech(NUMBER *q, NUMBER *epsilon);
|
||||
extern NUMBER *qacsch(NUMBER *q, NUMBER *epsilon);
|
||||
extern NUMBER *qacoth(NUMBER *q, NUMBER *epsilon);
|
||||
extern NUMBER *qlegtoleg(NUMBER *q, NUMBER *epsilon, BOOL wantneg);
|
||||
extern NUMBER *qpi(NUMBER *epsilon);
|
||||
extern NUMBER *qcatalan(NUMBER *);
|
||||
extern NUMBER *qbern(ZVALUE z);
|
||||
extern void qfreebern(void);
|
||||
extern NUMBER *qeuler(ZVALUE z);
|
||||
extern void qfreeeuler(void);
|
||||
E_FUNC void qsincos(NUMBER *q, long bitnum, NUMBER **vs, NUMBER **vc);
|
||||
E_FUNC NUMBER *qsqrt(NUMBER *q, NUMBER *epsilon, long R);
|
||||
E_FUNC NUMBER *qpower(NUMBER *q1, NUMBER *q2, NUMBER *epsilon);
|
||||
E_FUNC NUMBER *qroot(NUMBER *q1, NUMBER *q2, NUMBER *epsilon);
|
||||
E_FUNC NUMBER *qcos(NUMBER *q, NUMBER *epsilon);
|
||||
E_FUNC NUMBER *qsin(NUMBER *q, NUMBER *epsilon);
|
||||
E_FUNC NUMBER *qexp(NUMBER *q, NUMBER *epsilon);
|
||||
E_FUNC NUMBER *qln(NUMBER *q, NUMBER *epsilon);
|
||||
E_FUNC NUMBER *qlog(NUMBER *q, NUMBER *epsilon);
|
||||
E_FUNC NUMBER *qtan(NUMBER *q, NUMBER *epsilon);
|
||||
E_FUNC NUMBER *qsec(NUMBER *q, NUMBER *epsilon);
|
||||
E_FUNC NUMBER *qcot(NUMBER *q, NUMBER *epsilon);
|
||||
E_FUNC NUMBER *qcsc(NUMBER *q, NUMBER *epsilon);
|
||||
E_FUNC NUMBER *qacos(NUMBER *q, NUMBER *epsilon);
|
||||
E_FUNC NUMBER *qasin(NUMBER *q, NUMBER *epsilon);
|
||||
E_FUNC NUMBER *qatan(NUMBER *q, NUMBER *epsilon);
|
||||
E_FUNC NUMBER *qasec(NUMBER *q, NUMBER *epsilon);
|
||||
E_FUNC NUMBER *qacsc(NUMBER *q, NUMBER *epsilon);
|
||||
E_FUNC NUMBER *qacot(NUMBER *q, NUMBER *epsilon);
|
||||
E_FUNC NUMBER *qatan2(NUMBER *q1, NUMBER *q2, NUMBER *epsilon);
|
||||
E_FUNC NUMBER *qhypot(NUMBER *q1, NUMBER *q2, NUMBER *epsilon);
|
||||
E_FUNC NUMBER *qcosh(NUMBER *q, NUMBER *epsilon);
|
||||
E_FUNC NUMBER *qsinh(NUMBER *q, NUMBER *epsilon);
|
||||
E_FUNC NUMBER *qtanh(NUMBER *q, NUMBER *epsilon);
|
||||
E_FUNC NUMBER *qcoth(NUMBER *q, NUMBER *epsilon);
|
||||
E_FUNC NUMBER *qsech(NUMBER *q, NUMBER *epsilon);
|
||||
E_FUNC NUMBER *qcsch(NUMBER *q, NUMBER *epsilon);
|
||||
E_FUNC NUMBER *qacosh(NUMBER *q, NUMBER *epsilon);
|
||||
E_FUNC NUMBER *qasinh(NUMBER *q, NUMBER *epsilon);
|
||||
E_FUNC NUMBER *qatanh(NUMBER *q, NUMBER *epsilon);
|
||||
E_FUNC NUMBER *qasech(NUMBER *q, NUMBER *epsilon);
|
||||
E_FUNC NUMBER *qacsch(NUMBER *q, NUMBER *epsilon);
|
||||
E_FUNC NUMBER *qacoth(NUMBER *q, NUMBER *epsilon);
|
||||
E_FUNC NUMBER *qlegtoleg(NUMBER *q, NUMBER *epsilon, BOOL wantneg);
|
||||
E_FUNC NUMBER *qpi(NUMBER *epsilon);
|
||||
E_FUNC NUMBER *qcatalan(NUMBER *);
|
||||
E_FUNC NUMBER *qbern(ZVALUE z);
|
||||
E_FUNC void qfreebern(void);
|
||||
E_FUNC NUMBER *qeuler(ZVALUE z);
|
||||
E_FUNC void qfreeeuler(void);
|
||||
|
||||
|
||||
/*
|
||||
* pseudo-seed generator
|
||||
*/
|
||||
extern NUMBER *pseudo_seed(void);
|
||||
E_FUNC NUMBER *pseudo_seed(void);
|
||||
|
||||
|
||||
/*
|
||||
* external swap functions
|
||||
*/
|
||||
extern NUMBER *swap_b8_in_NUMBER(NUMBER *dest, NUMBER *src, BOOL all);
|
||||
extern NUMBER *swap_b16_in_NUMBER(NUMBER *dest, NUMBER *src, BOOL all);
|
||||
extern NUMBER *swap_HALF_in_NUMBER(NUMBER *dest, NUMBER *src, BOOL all);
|
||||
E_FUNC NUMBER *swap_b8_in_NUMBER(NUMBER *dest, NUMBER *src, BOOL all);
|
||||
E_FUNC NUMBER *swap_b16_in_NUMBER(NUMBER *dest, NUMBER *src, BOOL all);
|
||||
E_FUNC NUMBER *swap_HALF_in_NUMBER(NUMBER *dest, NUMBER *src, BOOL all);
|
||||
|
||||
|
||||
/*
|
||||
@@ -271,9 +271,9 @@ extern NUMBER *swap_HALF_in_NUMBER(NUMBER *dest, NUMBER *src, BOOL all);
|
||||
/*
|
||||
* constants used often by the arithmetic routines
|
||||
*/
|
||||
extern NUMBER _qzero_, _qone_, _qnegone_, _qonehalf_, _qneghalf_, _qonesqbase_;
|
||||
extern NUMBER _qtwo_, _qthree_, _qfour_, _qten_;
|
||||
extern NUMBER * initnumbs[];
|
||||
EXTERN NUMBER _qzero_, _qone_, _qnegone_, _qonehalf_, _qneghalf_, _qonesqbase_;
|
||||
EXTERN NUMBER _qtwo_, _qthree_, _qfour_, _qten_;
|
||||
EXTERN NUMBER * initnumbs[];
|
||||
|
||||
|
||||
#endif /* !__QMATH_H__ */
|
||||
|
14
qmod.c
14
qmod.c
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* qmod - modular arithmetic routines for normal numbers and REDC numbers
|
||||
*
|
||||
* Copyright (C) 1999-2006 David I. Bell and Ernest Bowen
|
||||
* Copyright (C) 1999-2007 David I. Bell and Ernest Bowen
|
||||
*
|
||||
* Primary author: David I. Bell
|
||||
*
|
||||
@@ -19,8 +19,8 @@
|
||||
* 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.3 $
|
||||
* @(#) $Id: qmod.c,v 29.3 2006/06/25 20:33:26 chongo Exp $
|
||||
* @(#) $Revision: 29.4 $
|
||||
* @(#) $Id: qmod.c,v 29.4 2007/02/11 10:19:14 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/qmod.c,v $
|
||||
*
|
||||
* Under source code control: 1991/05/22 23:15:07
|
||||
@@ -45,11 +45,11 @@ typedef struct {
|
||||
} REDC_CACHE;
|
||||
|
||||
|
||||
static long redc_age; /* current age counter */
|
||||
static REDC_CACHE redc_cache[MAXREDC]; /* cached REDC info */
|
||||
STATIC long redc_age; /* current age counter */
|
||||
STATIC REDC_CACHE redc_cache[MAXREDC]; /* cached REDC info */
|
||||
|
||||
|
||||
static REDC *qfindredc(NUMBER *q);
|
||||
S_FUNC REDC *qfindredc(NUMBER *q);
|
||||
|
||||
|
||||
/*
|
||||
@@ -339,7 +339,7 @@ qredcpower(NUMBER *q1, NUMBER *q2, NUMBER *q3)
|
||||
* given:
|
||||
* q modulus to find REDC information of
|
||||
*/
|
||||
static REDC *
|
||||
S_FUNC REDC *
|
||||
qfindredc(NUMBER *q)
|
||||
{
|
||||
register REDC_CACHE *rcp;
|
||||
|
16
qtrans.c
16
qtrans.c
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* qtrans - transcendental functions for real numbers
|
||||
*
|
||||
* Copyright (C) 1999-2004 David I. Bell and Ernest Bowen
|
||||
* Copyright (C) 1999-2007 David I. Bell and Ernest Bowen
|
||||
*
|
||||
* Primary author: David I. Bell
|
||||
*
|
||||
@@ -19,8 +19,8 @@
|
||||
* 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.7 $
|
||||
* @(#) $Id: qtrans.c,v 29.7 2006/05/07 13:04:18 chongo Exp $
|
||||
* @(#) $Revision: 29.8 $
|
||||
* @(#) $Id: qtrans.c,v 29.8 2007/02/11 10:19:14 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/qtrans.c,v $
|
||||
*
|
||||
* Under source code control: 1990/02/15 01:48:22
|
||||
@@ -44,11 +44,11 @@ NUMBER _qlge_ = { { _qlgenum_, 1, 0 }, { _qlgeden_, 1, 0 }, 1, NULL };
|
||||
/*
|
||||
* cache the natural logarithm of 10
|
||||
*/
|
||||
static NUMBER *ln_10 = NULL;
|
||||
static NUMBER *ln_10_epsilon = NULL;
|
||||
STATIC NUMBER *ln_10 = NULL;
|
||||
STATIC NUMBER *ln_10_epsilon = NULL;
|
||||
|
||||
static NUMBER *pivalue[2];
|
||||
static NUMBER *qexprel(NUMBER *q, long bitnum);
|
||||
STATIC NUMBER *pivalue[2];
|
||||
STATIC NUMBER *qexprel(NUMBER *q, long bitnum);
|
||||
|
||||
/*
|
||||
* Evaluate and store in specified locations the sin and cos of a given
|
||||
@@ -821,7 +821,7 @@ qexp(NUMBER *q, NUMBER *epsilon)
|
||||
* Requires *q >= 0, bitnum >= 0.
|
||||
* This returns NULL if more than 2^30 working bits would be required.
|
||||
*/
|
||||
static NUMBER *
|
||||
S_FUNC NUMBER *
|
||||
qexprel(NUMBER *q, long bitnum)
|
||||
{
|
||||
long n, m, k, h, s, t, d;
|
||||
|
58
quickhash.c
58
quickhash.c
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* quickhash - quickly hash a calc value using a quasi Fowler/Noll/Vo hash
|
||||
*
|
||||
* Copyright (C) 1999-2002 Landon Curt Noll
|
||||
* Copyright (C) 1999-2007 Landon Curt Noll
|
||||
*
|
||||
* Calc is open software; you can redistribute it and/or modify it under
|
||||
* the terms of the version 2.1 of the GNU Lesser General Public License
|
||||
@@ -17,8 +17,8 @@
|
||||
* 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.13 $
|
||||
* @(#) $Id: quickhash.c,v 29.13 2006/06/25 23:24:16 chongo Exp $
|
||||
* @(#) $Revision: 29.14 $
|
||||
* @(#) $Id: quickhash.c,v 29.14 2007/02/11 10:19:14 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/quickhash.c,v $
|
||||
*
|
||||
* Under source code control: 1995/03/04 11:34:23
|
||||
@@ -41,19 +41,19 @@
|
||||
/*
|
||||
* forward declarations
|
||||
*/
|
||||
static QCKHASH assochash(ASSOC *ap, QCKHASH val);
|
||||
static QCKHASH listhash(LIST *lp, QCKHASH val);
|
||||
static QCKHASH mathash(MATRIX *m, QCKHASH val);
|
||||
static QCKHASH objhash(OBJECT *op, QCKHASH val);
|
||||
static QCKHASH randhash(RAND *r, QCKHASH val);
|
||||
static QCKHASH randomhash(RANDOM *state, QCKHASH val);
|
||||
static QCKHASH config_hash(CONFIG *cfg, QCKHASH val);
|
||||
static QCKHASH fnv_strhash(char *ch, QCKHASH val);
|
||||
static QCKHASH fnv_STRhash(STRING *str, QCKHASH val);
|
||||
static QCKHASH fnv_fullhash(FULL *v, LEN len, QCKHASH val);
|
||||
static QCKHASH fnv_zhash(ZVALUE z, QCKHASH val);
|
||||
static QCKHASH hash_hash(HASH *hash, QCKHASH val);
|
||||
static QCKHASH blk_hash(BLOCK *blk, QCKHASH val);
|
||||
S_FUNC QCKHASH assochash(ASSOC *ap, QCKHASH val);
|
||||
S_FUNC QCKHASH listhash(LIST *lp, QCKHASH val);
|
||||
S_FUNC QCKHASH mathash(MATRIX *m, QCKHASH val);
|
||||
S_FUNC QCKHASH objhash(OBJECT *op, QCKHASH val);
|
||||
S_FUNC QCKHASH randhash(RAND *r, QCKHASH val);
|
||||
S_FUNC QCKHASH randomhash(RANDOM *state, QCKHASH val);
|
||||
S_FUNC QCKHASH config_hash(CONFIG *cfg, QCKHASH val);
|
||||
S_FUNC QCKHASH fnv_strhash(char *ch, QCKHASH val);
|
||||
S_FUNC QCKHASH fnv_STRhash(STRING *str, QCKHASH val);
|
||||
S_FUNC QCKHASH fnv_fullhash(FULL *v, LEN len, QCKHASH val);
|
||||
S_FUNC QCKHASH fnv_zhash(ZVALUE z, QCKHASH val);
|
||||
S_FUNC QCKHASH hash_hash(HASH *hash, QCKHASH val);
|
||||
S_FUNC QCKHASH blk_hash(BLOCK *blk, QCKHASH val);
|
||||
|
||||
|
||||
/*
|
||||
@@ -233,7 +233,7 @@ hashvalue(VALUE *vp, QCKHASH val)
|
||||
/*
|
||||
* Return a trivial hash value for an association.
|
||||
*/
|
||||
static QCKHASH
|
||||
S_FUNC QCKHASH
|
||||
assochash(ASSOC *ap, QCKHASH val)
|
||||
{
|
||||
/*
|
||||
@@ -249,7 +249,7 @@ assochash(ASSOC *ap, QCKHASH val)
|
||||
/*
|
||||
* Return a trivial hash value for a list.
|
||||
*/
|
||||
static QCKHASH
|
||||
S_FUNC QCKHASH
|
||||
listhash(LIST *lp, QCKHASH val)
|
||||
{
|
||||
/*
|
||||
@@ -275,7 +275,7 @@ listhash(LIST *lp, QCKHASH val)
|
||||
/*
|
||||
* Return a trivial hash value for a matrix.
|
||||
*/
|
||||
static QCKHASH
|
||||
S_FUNC QCKHASH
|
||||
mathash(MATRIX *m, QCKHASH val)
|
||||
{
|
||||
long skip;
|
||||
@@ -325,7 +325,7 @@ mathash(MATRIX *m, QCKHASH val)
|
||||
/*
|
||||
* Return a trivial hash value for an object.
|
||||
*/
|
||||
static QCKHASH
|
||||
S_FUNC QCKHASH
|
||||
objhash(OBJECT *op, QCKHASH val)
|
||||
{
|
||||
int i;
|
||||
@@ -348,7 +348,7 @@ objhash(OBJECT *op, QCKHASH val)
|
||||
* returns:
|
||||
* trivial hash integer
|
||||
*/
|
||||
static QCKHASH
|
||||
S_FUNC QCKHASH
|
||||
randhash(RAND *r, QCKHASH val)
|
||||
{
|
||||
/*
|
||||
@@ -380,7 +380,7 @@ randhash(RAND *r, QCKHASH val)
|
||||
* returns:
|
||||
* trivial hash integer
|
||||
*/
|
||||
static QCKHASH
|
||||
S_FUNC QCKHASH
|
||||
randomhash(RANDOM *state, QCKHASH val)
|
||||
{
|
||||
/*
|
||||
@@ -408,7 +408,7 @@ randomhash(RANDOM *state, QCKHASH val)
|
||||
/*
|
||||
* config_hash - return a trivial hash for a configuration state
|
||||
*/
|
||||
static QCKHASH
|
||||
S_FUNC QCKHASH
|
||||
config_hash(CONFIG *cfg, QCKHASH val)
|
||||
{
|
||||
USB32 value; /* value to hash from hash elements */
|
||||
@@ -515,7 +515,7 @@ config_hash(CONFIG *cfg, QCKHASH val)
|
||||
* returns:
|
||||
* a 32 bit QCKHASH value
|
||||
*/
|
||||
static QCKHASH
|
||||
S_FUNC QCKHASH
|
||||
fnv_strhash(char *ch, QCKHASH val)
|
||||
{
|
||||
/*
|
||||
@@ -537,7 +537,7 @@ fnv_strhash(char *ch, QCKHASH val)
|
||||
* returns:
|
||||
* a 32 bit QCKHASH value
|
||||
*/
|
||||
static QCKHASH
|
||||
S_FUNC QCKHASH
|
||||
fnv_STRhash(STRING *str, QCKHASH val)
|
||||
{
|
||||
char *ch;
|
||||
@@ -567,7 +567,7 @@ fnv_STRhash(STRING *str, QCKHASH val)
|
||||
* returns:
|
||||
* a 32 bit QCKHASH value
|
||||
*/
|
||||
static QCKHASH
|
||||
S_FUNC QCKHASH
|
||||
fnv_fullhash(FULL *v, LEN len, QCKHASH val)
|
||||
{
|
||||
/*
|
||||
@@ -590,7 +590,7 @@ fnv_fullhash(FULL *v, LEN len, QCKHASH val)
|
||||
* returns:
|
||||
* a 32 bit QCKHASH value
|
||||
*/
|
||||
static QCKHASH
|
||||
S_FUNC QCKHASH
|
||||
fnv_zhash(ZVALUE z, QCKHASH val)
|
||||
{
|
||||
LEN n;
|
||||
@@ -638,7 +638,7 @@ fnv_zhash(ZVALUE z, QCKHASH val)
|
||||
* returns:
|
||||
* a 32 bit QCKHASH value
|
||||
*/
|
||||
static QCKHASH
|
||||
S_FUNC QCKHASH
|
||||
hash_hash(HASH *hash, QCKHASH val)
|
||||
{
|
||||
int i;
|
||||
@@ -663,7 +663,7 @@ hash_hash(HASH *hash, QCKHASH val)
|
||||
* returns:
|
||||
* a 32 bit QCKHASH value
|
||||
*/
|
||||
static QCKHASH
|
||||
S_FUNC QCKHASH
|
||||
blk_hash(BLOCK *blk, QCKHASH val)
|
||||
{
|
||||
int i;
|
||||
|
@@ -17,8 +17,8 @@
|
||||
# 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.23 $
|
||||
# @(#) $Id: Makefile,v 29.23 2006/09/18 13:13:25 chongo Exp $
|
||||
# @(#) $Revision: 29.25 $
|
||||
# @(#) $Id: Makefile,v 29.25 2007/02/12 04:19:17 chongo Exp $
|
||||
# @(#) $Source: /usr/local/src/cmd/calc/sample/RCS/Makefile,v $
|
||||
#
|
||||
# Under source code control: 1997/04/19 22:46:49
|
||||
@@ -618,10 +618,10 @@ many_random.o: ../calc.h
|
||||
many_random.o: ../calcerr.h
|
||||
many_random.o: ../cmath.h
|
||||
many_random.o: ../config.h
|
||||
many_random.o: ../decl.h
|
||||
many_random.o: ../endian_calc.h
|
||||
many_random.o: ../hash.h
|
||||
many_random.o: ../have_const.h
|
||||
many_random.o: ../have_malloc.h
|
||||
many_random.o: ../have_memmv.h
|
||||
many_random.o: ../have_newstr.h
|
||||
many_random.o: ../have_stdlib.h
|
||||
@@ -635,7 +635,6 @@ many_random.o: ../shs.h
|
||||
many_random.o: ../shs1.h
|
||||
many_random.o: ../string.h
|
||||
many_random.o: ../value.h
|
||||
many_random.o: ../win32dll.h
|
||||
many_random.o: ../zmath.h
|
||||
many_random.o: ../zrandom.h
|
||||
many_random.o: many_random.c
|
||||
@@ -646,10 +645,10 @@ test_random.o: ../calc.h
|
||||
test_random.o: ../calcerr.h
|
||||
test_random.o: ../cmath.h
|
||||
test_random.o: ../config.h
|
||||
test_random.o: ../decl.h
|
||||
test_random.o: ../endian_calc.h
|
||||
test_random.o: ../hash.h
|
||||
test_random.o: ../have_const.h
|
||||
test_random.o: ../have_malloc.h
|
||||
test_random.o: ../have_memmv.h
|
||||
test_random.o: ../have_newstr.h
|
||||
test_random.o: ../have_stdlib.h
|
||||
@@ -663,7 +662,6 @@ test_random.o: ../shs.h
|
||||
test_random.o: ../shs1.h
|
||||
test_random.o: ../string.h
|
||||
test_random.o: ../value.h
|
||||
test_random.o: ../win32dll.h
|
||||
test_random.o: ../zmath.h
|
||||
test_random.o: ../zrandom.h
|
||||
test_random.o: test_random.c
|
||||
|
8
seed.c
8
seed.c
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* seed - produce a pseudo-random seeds
|
||||
*
|
||||
* Copyright (C) 1999-2004 Landon Curt Noll
|
||||
* Copyright (C) 1999-2007 Landon Curt Noll
|
||||
*
|
||||
* Calc is open software; you can redistribute it and/or modify it under
|
||||
* the terms of the version 2.1 of the GNU Lesser General Public License
|
||||
@@ -17,8 +17,8 @@
|
||||
* 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.7 $
|
||||
* @(#) $Id: seed.c,v 29.7 2004/02/23 14:04:01 chongo Exp $
|
||||
* @(#) $Revision: 29.8 $
|
||||
* @(#) $Id: seed.c,v 29.8 2007/02/11 10:19:14 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/seed.c,v $
|
||||
*
|
||||
* Under source code control: 1999/10/03 10:06:53
|
||||
@@ -171,7 +171,7 @@ typedef struct s_hash64 hash64;
|
||||
* returns:
|
||||
* 64 bit hash as a static hash64 structure
|
||||
*/
|
||||
static hash64
|
||||
S_FUNC hash64
|
||||
hash_buf(char *buf, unsigned len)
|
||||
{
|
||||
hash64 hval; /* current hash value */
|
||||
|
44
shs.c
44
shs.c
@@ -31,8 +31,8 @@
|
||||
* Based on Version 2.11 (09 Mar 1995) from Landon Curt Noll's
|
||||
* (http://www.isthe.com/chongo/) shs hash program.
|
||||
*
|
||||
* @(#) $Revision: 29.3 $
|
||||
* @(#) $Id: shs.c,v 29.3 2004/02/23 08:14:15 chongo Exp $
|
||||
* @(#) $Revision: 29.4 $
|
||||
* @(#) $Id: shs.c,v 29.4 2007/02/11 10:19:14 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/shs.c,v $
|
||||
*
|
||||
* This file is not covered under version 2.1 of the GNU LGPL.
|
||||
@@ -128,23 +128,23 @@
|
||||
/*
|
||||
* forward declarations
|
||||
*/
|
||||
static void shsInit(HASH*);
|
||||
static void shsTransform(USB32*, USB32*);
|
||||
static void shsUpdate(HASH*, USB8*, USB32);
|
||||
static void shsFinal(HASH*);
|
||||
static void shs_chkpt(HASH*);
|
||||
static void shs_note(int, HASH*);
|
||||
static void shs_type(int, HASH*);
|
||||
S_FUNC void shsInit(HASH*);
|
||||
S_FUNC void shsTransform(USB32*, USB32*);
|
||||
S_FUNC void shsUpdate(HASH*, USB8*, USB32);
|
||||
S_FUNC void shsFinal(HASH*);
|
||||
S_FUNC void shs_chkpt(HASH*);
|
||||
S_FUNC void shs_note(int, HASH*);
|
||||
S_FUNC void shs_type(int, HASH*);
|
||||
void shs_init_state(HASH*);
|
||||
static ZVALUE shs_final_state(HASH*);
|
||||
static int shs_cmp(HASH*, HASH*);
|
||||
static void shs_print(HASH*);
|
||||
S_FUNC ZVALUE shs_final_state(HASH*);
|
||||
S_FUNC int shs_cmp(HASH*, HASH*);
|
||||
S_FUNC void shs_print(HASH*);
|
||||
|
||||
|
||||
/*
|
||||
* shsInit - initialize the SHS state
|
||||
*/
|
||||
static void
|
||||
S_FUNC void
|
||||
shsInit(HASH *state)
|
||||
{
|
||||
SHS_INFO *dig = &state->h_union.h_shs; /* digest state */
|
||||
@@ -170,7 +170,7 @@ shsInit(HASH *state)
|
||||
* It may be necessary to split it into sections, eg based on the four
|
||||
* subrounds. One may also want to roll each subround into a loop.
|
||||
*/
|
||||
static void
|
||||
S_FUNC void
|
||||
shsTransform(USB32 *digest, USB32 *W)
|
||||
{
|
||||
USB32 A, B, C, D, E; /* Local vars */
|
||||
@@ -279,7 +279,7 @@ shsTransform(USB32 *digest, USB32 *W)
|
||||
/*
|
||||
* shsUpdate - update SHS with arbitrary length data
|
||||
*/
|
||||
static void
|
||||
S_FUNC void
|
||||
shsUpdate(HASH *state, USB8 *buffer, USB32 count)
|
||||
{
|
||||
SHS_INFO *dig = &state->h_union.h_shs; /* digest state */
|
||||
@@ -356,7 +356,7 @@ shsUpdate(HASH *state, USB8 *buffer, USB32 count)
|
||||
* Finally we append the 64 bit length on to the 56 bytes of data
|
||||
* remaining. This final chunk is transformed.
|
||||
*/
|
||||
static void
|
||||
S_FUNC void
|
||||
shsFinal(HASH *state)
|
||||
{
|
||||
SHS_INFO *dig = &state->h_union.h_shs; /* digest state */
|
||||
@@ -428,7 +428,7 @@ shsFinal(HASH *state)
|
||||
* This function will ensure that the the hash chunk buffer is empty.
|
||||
* Any partially hashed data will be padded out with 0's and hashed.
|
||||
*/
|
||||
static void
|
||||
S_FUNC void
|
||||
shs_chkpt(HASH *state)
|
||||
{
|
||||
SHS_INFO *dig = &state->h_union.h_shs; /* digest state */
|
||||
@@ -474,7 +474,7 @@ shs_chkpt(HASH *state)
|
||||
* Types include negative values, complex values, division, zero numeric
|
||||
* and array of HALFs.
|
||||
*/
|
||||
static void
|
||||
S_FUNC void
|
||||
shs_note(int special, HASH *state)
|
||||
{
|
||||
SHS_INFO *dig = &state->h_union.h_shs; /* digest state */
|
||||
@@ -505,7 +505,7 @@ shs_note(int special, HASH *state)
|
||||
* or not. We also do nothing with V_STR so that a hash of a string
|
||||
* will produce the same value as the standard hash function.
|
||||
*/
|
||||
static void
|
||||
S_FUNC void
|
||||
shs_type(int type, HASH *state)
|
||||
{
|
||||
SHS_INFO *dig = &state->h_union.h_shs; /* digest state */
|
||||
@@ -572,7 +572,7 @@ shs_init_state(HASH *state)
|
||||
* returns:
|
||||
* a ZVALUE representing the state
|
||||
*/
|
||||
static ZVALUE
|
||||
S_FUNC ZVALUE
|
||||
shs_final_state(HASH *state)
|
||||
{
|
||||
SHS_INFO *dig = &state->h_union.h_shs; /* digest state */
|
||||
@@ -636,7 +636,7 @@ shs_final_state(HASH *state)
|
||||
* TRUE => hash states are different
|
||||
* FALSE => hash states are the same
|
||||
*/
|
||||
static int
|
||||
S_FUNC int
|
||||
shs_cmp(HASH *a, HASH *b)
|
||||
{
|
||||
/*
|
||||
@@ -695,7 +695,7 @@ shs_cmp(HASH *a, HASH *b)
|
||||
* given:
|
||||
* state the hash state to print
|
||||
*/
|
||||
static void
|
||||
S_FUNC void
|
||||
shs_print(HASH *state)
|
||||
{
|
||||
/*
|
||||
|
40
shs1.c
40
shs1.c
@@ -22,8 +22,8 @@
|
||||
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
||||
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
* @(#) $Revision: 29.3 $
|
||||
* @(#) $Id: shs1.c,v 29.3 2004/02/23 08:15:52 chongo Exp $
|
||||
* @(#) $Revision: 29.4 $
|
||||
* @(#) $Id: shs1.c,v 29.4 2007/02/11 10:19:14 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/shs1.c,v $
|
||||
*
|
||||
* This file is not covered under version 2.1 of the GNU LGPL.
|
||||
@@ -102,23 +102,23 @@
|
||||
(e += LEFT_ROT(a,5) + f(b,c,d) + k + data, b = LEFT_ROT(b,30))
|
||||
|
||||
/* forward declarations */
|
||||
static void shs1Init(HASH*);
|
||||
static void shs1Transform(USB32*, USB32*);
|
||||
static void shs1Update(HASH*, USB8*, USB32);
|
||||
static void shs1Final(HASH*);
|
||||
static void shs1_chkpt(HASH*);
|
||||
static void shs1_note(int, HASH*);
|
||||
static void shs1_type(int, HASH*);
|
||||
S_FUNC void shs1Init(HASH*);
|
||||
S_FUNC void shs1Transform(USB32*, USB32*);
|
||||
S_FUNC void shs1Update(HASH*, USB8*, USB32);
|
||||
S_FUNC void shs1Final(HASH*);
|
||||
S_FUNC void shs1_chkpt(HASH*);
|
||||
S_FUNC void shs1_note(int, HASH*);
|
||||
S_FUNC void shs1_type(int, HASH*);
|
||||
void shs1_init_state(HASH*);
|
||||
static ZVALUE shs1_final_state(HASH*);
|
||||
static int shs1_cmp(HASH*, HASH*);
|
||||
static void shs1_print(HASH*);
|
||||
S_FUNC ZVALUE shs1_final_state(HASH*);
|
||||
S_FUNC int shs1_cmp(HASH*, HASH*);
|
||||
S_FUNC void shs1_print(HASH*);
|
||||
|
||||
|
||||
/*
|
||||
* shs1Init - initialize the SHS1 state
|
||||
*/
|
||||
static void
|
||||
S_FUNC void
|
||||
shs1Init(HASH *state)
|
||||
{
|
||||
SHS1_INFO *dig = &state->h_union.h_shs1; /* digest state */
|
||||
@@ -144,7 +144,7 @@ shs1Init(HASH *state)
|
||||
* It may be necessary to split it into sections, eg based on the four
|
||||
* subrounds. One may also want to roll each subround into a loop.
|
||||
*/
|
||||
static void
|
||||
S_FUNC void
|
||||
shs1Transform(USB32 *digest, USB32 *W)
|
||||
{
|
||||
USB32 A, B, C, D, E; /* Local vars */
|
||||
@@ -406,7 +406,7 @@ shs1Final(HASH *state)
|
||||
* This function will ensure that the the hash chunk buffer is empty.
|
||||
* Any partially hashed data will be padded out with 0's and hashed.
|
||||
*/
|
||||
static void
|
||||
S_FUNC void
|
||||
shs1_chkpt(HASH *state)
|
||||
{
|
||||
SHS1_INFO *dig = &state->h_union.h_shs1; /* digest state */
|
||||
@@ -451,7 +451,7 @@ shs1_chkpt(HASH *state)
|
||||
* Types include negative values, complex values, division, zero numeric
|
||||
* and array of HALFs.
|
||||
*/
|
||||
static void
|
||||
S_FUNC void
|
||||
shs1_note(int special, HASH *state)
|
||||
{
|
||||
SHS1_INFO *dig = &state->h_union.h_shs1; /* digest state */
|
||||
@@ -482,7 +482,7 @@ shs1_note(int special, HASH *state)
|
||||
* or not. We also do nothing with V_STR so that a hash of a string
|
||||
* will produce the same value as the standard hash function.
|
||||
*/
|
||||
static void
|
||||
S_FUNC void
|
||||
shs1_type(int type, HASH *state)
|
||||
{
|
||||
SHS1_INFO *dig = &state->h_union.h_shs1; /* digest state */
|
||||
@@ -549,7 +549,7 @@ shs1_init_state(HASH *state)
|
||||
* returns:
|
||||
* a ZVALUE representing the state
|
||||
*/
|
||||
static ZVALUE
|
||||
S_FUNC ZVALUE
|
||||
shs1_final_state(HASH *state)
|
||||
{
|
||||
SHS1_INFO *dig = &state->h_union.h_shs1; /* digest state */
|
||||
@@ -613,7 +613,7 @@ shs1_final_state(HASH *state)
|
||||
* TRUE => hash states are different
|
||||
* FALSE => hash states are the same
|
||||
*/
|
||||
static int
|
||||
S_FUNC int
|
||||
shs1_cmp(HASH *a, HASH *b)
|
||||
{
|
||||
/*
|
||||
@@ -672,7 +672,7 @@ shs1_cmp(HASH *a, HASH *b)
|
||||
* given:
|
||||
* state the hash state to print
|
||||
*/
|
||||
static void
|
||||
S_FUNC void
|
||||
shs1_print(HASH *state)
|
||||
{
|
||||
/*
|
||||
|
26
size.c
26
size.c
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* size - size and sizeof functions are implemented here
|
||||
*
|
||||
* Copyright (C) 1999-2006 David I. Bell
|
||||
* Copyright (C) 1999-2007 David I. Bell
|
||||
*
|
||||
* 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
|
||||
@@ -17,8 +17,8 @@
|
||||
* 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: size.c,v 29.4 2006/05/19 15:26:10 chongo Exp $
|
||||
* @(#) $Revision: 29.5 $
|
||||
* @(#) $Id: size.c,v 29.5 2007/02/11 10:19:14 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/size.c,v $
|
||||
*
|
||||
* Under source code control: 1997/03/10 01:56:51
|
||||
@@ -37,11 +37,11 @@
|
||||
/*
|
||||
* forward declarations
|
||||
*/
|
||||
static size_t zsize(ZVALUE);
|
||||
static size_t qsize(NUMBER*);
|
||||
static size_t csize(COMPLEX*);
|
||||
static size_t memzsize(ZVALUE);
|
||||
static size_t memqsize(NUMBER*);
|
||||
S_FUNC size_t zsize(ZVALUE);
|
||||
S_FUNC size_t qsize(NUMBER*);
|
||||
S_FUNC size_t csize(COMPLEX*);
|
||||
S_FUNC size_t memzsize(ZVALUE);
|
||||
S_FUNC size_t memqsize(NUMBER*);
|
||||
|
||||
|
||||
/*
|
||||
@@ -124,7 +124,7 @@ elm_count(VALUE *vp)
|
||||
* returns:
|
||||
* value size
|
||||
*/
|
||||
static size_t
|
||||
S_FUNC size_t
|
||||
zsize(ZVALUE z)
|
||||
{
|
||||
/* ignore the size of 0, 1 and -1 */
|
||||
@@ -148,7 +148,7 @@ zsize(ZVALUE z)
|
||||
* returns:
|
||||
* value size
|
||||
*/
|
||||
static size_t
|
||||
S_FUNC size_t
|
||||
qsize(NUMBER *q)
|
||||
{
|
||||
/* ingore denominator parts of integers */
|
||||
@@ -173,7 +173,7 @@ qsize(NUMBER *q)
|
||||
* returns:
|
||||
* value size
|
||||
*/
|
||||
static size_t
|
||||
S_FUNC size_t
|
||||
csize(COMPLEX *c)
|
||||
{
|
||||
/* ingore denominator parts of integers */
|
||||
@@ -194,7 +194,7 @@ csize(COMPLEX *c)
|
||||
* returns:
|
||||
* memory footprint
|
||||
*/
|
||||
static size_t
|
||||
S_FUNC size_t
|
||||
memzsize(ZVALUE z)
|
||||
{
|
||||
return sizeof(ZVALUE) + (z.len * sizeof(HALF));
|
||||
@@ -210,7 +210,7 @@ memzsize(ZVALUE z)
|
||||
* returns:
|
||||
* memory footprint
|
||||
*/
|
||||
static size_t
|
||||
S_FUNC size_t
|
||||
memqsize(NUMBER *q)
|
||||
{
|
||||
return sizeof(NUMBER) + memzsize(q->num) + memzsize(q->den);
|
||||
|
24
string.c
24
string.c
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* string - string list routines
|
||||
*
|
||||
* Copyright (C) 1999-2006 David I. Bell and Ernest Bowen
|
||||
* Copyright (C) 1999-2007 David I. Bell and Ernest Bowen
|
||||
*
|
||||
* Primary author: David I. Bell
|
||||
*
|
||||
@@ -19,8 +19,8 @@
|
||||
* 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.10 $
|
||||
* @(#) $Id: string.c,v 29.10 2006/08/20 15:01:30 chongo Exp $
|
||||
* @(#) $Revision: 29.11 $
|
||||
* @(#) $Id: string.c,v 29.11 2007/02/11 10:19:14 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/string.c,v $
|
||||
*
|
||||
* Under source code control: 1990/02/15 01:48:10
|
||||
@@ -40,9 +40,9 @@
|
||||
|
||||
STRING _nullstring_ = {"", 0, 1, NULL};
|
||||
|
||||
static char *chartable; /* single character string table */
|
||||
STATIC char *chartable; /* single character string table */
|
||||
|
||||
static struct {
|
||||
STATIC struct {
|
||||
long l_count; /* count of strings in table */
|
||||
long l_maxcount; /* maximum strings storable in table */
|
||||
size_t l_avail; /* characters available in current string */
|
||||
@@ -792,7 +792,7 @@ stringlowbit(STRING *s)
|
||||
* Returns TRUE if and only if a difference is encountered.
|
||||
* Essentially a local version of memcmp.
|
||||
*/
|
||||
static BOOL
|
||||
S_FUNC BOOL
|
||||
stringcompare(char *c1, char *c2, long len)
|
||||
{
|
||||
while (len-- > 0) {
|
||||
@@ -1000,9 +1000,9 @@ stringrsearch(STRING *s1, STRING *s2, long start, long end, ZVALUE *index)
|
||||
#define STRALLOC 100
|
||||
|
||||
|
||||
static STRING *freeStr = NULL;
|
||||
static STRING **firstStrs = NULL;
|
||||
static long blockcount = 0;
|
||||
STATIC STRING *freeStr = NULL;
|
||||
STATIC STRING **firstStrs = NULL;
|
||||
STATIC long blockcount = 0;
|
||||
|
||||
|
||||
STRING *
|
||||
@@ -1172,9 +1172,9 @@ sfree(STRING *s)
|
||||
freeStr = s;
|
||||
}
|
||||
|
||||
static long stringconstcount = 0;
|
||||
static long stringconstavail = 0;
|
||||
static STRING **stringconsttable;
|
||||
STATIC long stringconstcount = 0;
|
||||
STATIC long stringconstavail = 0;
|
||||
STATIC STRING **stringconsttable;
|
||||
#define STRCONSTALLOC 100
|
||||
|
||||
void
|
||||
|
46
string.h
46
string.h
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* string - string list routines
|
||||
*
|
||||
* Copyright (C) 1999-2006 David I. Bell
|
||||
* Copyright (C) 1999-2007 David I. Bell
|
||||
*
|
||||
* 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
|
||||
@@ -17,8 +17,8 @@
|
||||
* 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.7 $
|
||||
* @(#) $Id: string.h,v 29.7 2006/08/20 15:01:30 chongo Exp $
|
||||
* @(#) $Revision: 29.8 $
|
||||
* @(#) $Id: string.h,v 29.8 2007/02/11 10:19:14 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/string.h,v $
|
||||
*
|
||||
* Under source code control: 1990/02/15 01:48:36
|
||||
@@ -57,26 +57,26 @@ typedef struct {
|
||||
} STRINGHEAD;
|
||||
|
||||
|
||||
extern void initstr(STRINGHEAD *hp);
|
||||
extern char *addstr(STRINGHEAD *hp, char *str);
|
||||
extern char *namestr(STRINGHEAD *hp, long n);
|
||||
extern int findstr(STRINGHEAD *hp, char *str);
|
||||
extern char *charstr(int ch);
|
||||
extern char *addliteral(char *str);
|
||||
extern long stringindex(char *str1, char *str2);
|
||||
extern STRING *stralloc(void);
|
||||
extern long addstring(char *str, size_t len);
|
||||
extern STRING *charstring(int ch);
|
||||
extern STRING *makestring(char *str);
|
||||
extern STRING *makenewstring(char *str);
|
||||
extern STRING *findstring(long index);
|
||||
extern STRING *slink(STRING *);
|
||||
extern void sfree(STRING *);
|
||||
extern void fitstring(char *, long, long);
|
||||
extern void strprint(STRING *);
|
||||
extern void showstrings(void);
|
||||
extern void showliterals(void);
|
||||
extern STRING _nullstring_;
|
||||
E_FUNC void initstr(STRINGHEAD *hp);
|
||||
E_FUNC char *addstr(STRINGHEAD *hp, char *str);
|
||||
E_FUNC char *namestr(STRINGHEAD *hp, long n);
|
||||
E_FUNC int findstr(STRINGHEAD *hp, char *str);
|
||||
E_FUNC char *charstr(int ch);
|
||||
E_FUNC char *addliteral(char *str);
|
||||
E_FUNC long stringindex(char *str1, char *str2);
|
||||
E_FUNC STRING *stralloc(void);
|
||||
E_FUNC long addstring(char *str, size_t len);
|
||||
E_FUNC STRING *charstring(int ch);
|
||||
E_FUNC STRING *makestring(char *str);
|
||||
E_FUNC STRING *makenewstring(char *str);
|
||||
E_FUNC STRING *findstring(long index);
|
||||
E_FUNC STRING *slink(STRING *);
|
||||
E_FUNC void sfree(STRING *);
|
||||
E_FUNC void fitstring(char *, long, long);
|
||||
E_FUNC void strprint(STRING *);
|
||||
E_FUNC void showstrings(void);
|
||||
E_FUNC void showliterals(void);
|
||||
EXTERN STRING _nullstring_;
|
||||
|
||||
|
||||
#endif /* !__CALCSTRING_H__ */
|
||||
|
38
symbol.c
38
symbol.c
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* symbol - global and local symbol routines
|
||||
*
|
||||
* Copyright (C) 1999-2006 David I. Bell and Ernest Bowen
|
||||
* Copyright (C) 1999-2007 David I. Bell and Ernest Bowen
|
||||
*
|
||||
* Primary author: David I. Bell
|
||||
*
|
||||
@@ -19,8 +19,8 @@
|
||||
* 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.6 $
|
||||
* @(#) $Id: symbol.c,v 29.6 2006/06/20 10:28:06 chongo Exp $
|
||||
* @(#) $Revision: 29.7 $
|
||||
* @(#) $Id: symbol.c,v 29.7 2007/02/11 10:19:14 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/symbol.c,v $
|
||||
*
|
||||
* Under source code control: 1990/02/15 01:48:23
|
||||
@@ -40,21 +40,21 @@
|
||||
|
||||
#define HASHSIZE 37 /* size of hash table */
|
||||
|
||||
extern FILE *f_open(char *name, char *mode);
|
||||
E_FUNC FILE *f_open(char *name, char *mode);
|
||||
|
||||
static int filescope; /* file scope level for static variables */
|
||||
static int funcscope; /* function scope level for static variables */
|
||||
static STRINGHEAD localnames; /* list of local variable names */
|
||||
static STRINGHEAD globalnames; /* list of global variable names */
|
||||
static STRINGHEAD paramnames; /* list of parameter variable names */
|
||||
static GLOBAL *globalhash[HASHSIZE]; /* hash table for globals */
|
||||
STATIC int filescope; /* file scope level for static variables */
|
||||
STATIC int funcscope; /* function scope level for static variables */
|
||||
STATIC STRINGHEAD localnames; /* list of local variable names */
|
||||
STATIC STRINGHEAD globalnames; /* list of global variable names */
|
||||
STATIC STRINGHEAD paramnames; /* list of parameter variable names */
|
||||
STATIC GLOBAL *globalhash[HASHSIZE]; /* hash table for globals */
|
||||
|
||||
static void printtype(VALUE *);
|
||||
static void unscope(void);
|
||||
static void addstatic(GLOBAL *);
|
||||
static long staticcount = 0;
|
||||
static long staticavail = 0;
|
||||
static GLOBAL **statictable;
|
||||
S_FUNC void printtype(VALUE *);
|
||||
S_FUNC void unscope(void);
|
||||
S_FUNC void addstatic(GLOBAL *);
|
||||
STATIC long staticcount = 0;
|
||||
STATIC long staticavail = 0;
|
||||
STATIC GLOBAL **statictable;
|
||||
|
||||
|
||||
/*
|
||||
@@ -231,7 +231,7 @@ showallglobals(void)
|
||||
printf("No global variables\n");
|
||||
}
|
||||
|
||||
static void
|
||||
S_FUNC void
|
||||
printtype(VALUE *vp)
|
||||
{
|
||||
int type;
|
||||
@@ -330,7 +330,7 @@ writeglobals(char *name)
|
||||
GLOBAL **hp; /* hash table head address */
|
||||
register GLOBAL *sp; /* current global symbol pointer */
|
||||
int savemode; /* saved output mode */
|
||||
extern void math_setfp(FILE *fp);
|
||||
E_FUNC void math_setfp(FILE *fp);
|
||||
|
||||
fp = f_open(name, "w");
|
||||
if (fp == NULL)
|
||||
@@ -576,7 +576,7 @@ showstatics(void)
|
||||
* function scopes larger than the current scope levels. Their memory
|
||||
* remains allocated since their values still actually exist.
|
||||
*/
|
||||
static void
|
||||
S_FUNC void
|
||||
unscope(void)
|
||||
{
|
||||
GLOBAL **hp; /* hash table head address */
|
||||
|
54
symbol.h
54
symbol.h
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* symbol - global and local symbol routines
|
||||
*
|
||||
* Copyright (C) 1999-2006 David I. Bell
|
||||
* Copyright (C) 1999-2007 David I. Bell
|
||||
*
|
||||
* 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
|
||||
@@ -17,8 +17,8 @@
|
||||
* 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.6 $
|
||||
* @(#) $Id: symbol.h,v 29.6 2006/05/19 15:26:10 chongo Exp $
|
||||
* @(#) $Revision: 29.7 $
|
||||
* @(#) $Id: symbol.h,v 29.7 2007/02/11 10:19:14 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/symbol.h,v $
|
||||
*
|
||||
* Under source code control: 1990/02/15 01:48:37
|
||||
@@ -66,45 +66,45 @@ struct global {
|
||||
/*
|
||||
* Routines to search for global symbols.
|
||||
*/
|
||||
extern GLOBAL *addglobal(char *name, BOOL isstatic);
|
||||
extern GLOBAL *findglobal(char *name);
|
||||
E_FUNC GLOBAL *addglobal(char *name, BOOL isstatic);
|
||||
E_FUNC GLOBAL *findglobal(char *name);
|
||||
|
||||
|
||||
/*
|
||||
* Routines to return names of variables.
|
||||
*/
|
||||
extern char *localname(long n);
|
||||
extern char *paramname(long n);
|
||||
extern char *globalname(GLOBAL *sp);
|
||||
E_FUNC char *localname(long n);
|
||||
E_FUNC char *paramname(long n);
|
||||
E_FUNC char *globalname(GLOBAL *sp);
|
||||
|
||||
|
||||
/*
|
||||
* Routines to handle entering and leaving of scope levels.
|
||||
*/
|
||||
extern void resetscopes(void);
|
||||
extern void enterfilescope(void);
|
||||
extern void exitfilescope(void);
|
||||
extern void enterfuncscope(void);
|
||||
extern void exitfuncscope(void);
|
||||
extern void endscope (char *name, BOOL isglobal);
|
||||
E_FUNC void resetscopes(void);
|
||||
E_FUNC void enterfilescope(void);
|
||||
E_FUNC void exitfilescope(void);
|
||||
E_FUNC void enterfuncscope(void);
|
||||
E_FUNC void exitfuncscope(void);
|
||||
E_FUNC void endscope (char *name, BOOL isglobal);
|
||||
|
||||
|
||||
/*
|
||||
* Other routines.
|
||||
*/
|
||||
extern long addlocal(char *name);
|
||||
extern long findlocal(char *name);
|
||||
extern long addparam(char *name);
|
||||
extern long findparam(char *name);
|
||||
extern void initlocals(void);
|
||||
extern void initglobals(void);
|
||||
extern int writeglobals(char *name);
|
||||
extern int symboltype(char *name);
|
||||
extern void showglobals(void);
|
||||
extern void showallglobals(void);
|
||||
extern void freeglobals(void);
|
||||
extern void showstatics(void);
|
||||
extern void freestatics(void);
|
||||
E_FUNC long addlocal(char *name);
|
||||
E_FUNC long findlocal(char *name);
|
||||
E_FUNC long addparam(char *name);
|
||||
E_FUNC long findparam(char *name);
|
||||
E_FUNC void initlocals(void);
|
||||
E_FUNC void initglobals(void);
|
||||
E_FUNC int writeglobals(char *name);
|
||||
E_FUNC int symboltype(char *name);
|
||||
E_FUNC void showglobals(void);
|
||||
E_FUNC void showallglobals(void);
|
||||
E_FUNC void freeglobals(void);
|
||||
E_FUNC void showstatics(void);
|
||||
E_FUNC void freestatics(void);
|
||||
|
||||
|
||||
#endif /* !__SYMBOL_H__ */
|
||||
|
44
token.c
44
token.c
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* token - read input file characters into tokens
|
||||
*
|
||||
* Copyright (C) 1999 David I. Bell and Ernest Bowen
|
||||
* Copyright (C) 1999-2007 David I. Bell and Ernest Bowen
|
||||
*
|
||||
* Primary author: David I. Bell
|
||||
*
|
||||
@@ -19,8 +19,8 @@
|
||||
* 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.10 $
|
||||
* @(#) $Id: token.c,v 29.10 2006/06/24 18:43:05 chongo Exp $
|
||||
* @(#) $Revision: 29.11 $
|
||||
* @(#) $Id: token.c,v 29.11 2007/02/11 10:19:14 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/token.c,v $
|
||||
*
|
||||
* Under source code control: 1990/02/15 01:48:25
|
||||
@@ -52,7 +52,7 @@
|
||||
/*
|
||||
* Current token.
|
||||
*/
|
||||
static struct {
|
||||
STATIC struct {
|
||||
short t_type; /* type of token */
|
||||
char *t_sym; /* symbol name */
|
||||
long t_strindex; /* index of string value */
|
||||
@@ -60,12 +60,12 @@ static struct {
|
||||
} curtoken;
|
||||
|
||||
|
||||
static BOOL rescan; /* TRUE to reread current token */
|
||||
static BOOL newlines; /* TRUE to return newlines as tokens */
|
||||
static BOOL allsyms; /* TRUE if always want a symbol token */
|
||||
static STRINGHEAD strings; /* list of constant strings */
|
||||
static char *numbuf; /* buffer for numeric tokens */
|
||||
static long numbufsize; /* current size of numeric buffer */
|
||||
STATIC BOOL rescan; /* TRUE to reread current token */
|
||||
STATIC BOOL newlines; /* TRUE to return newlines as tokens */
|
||||
STATIC BOOL allsyms; /* TRUE if always want a symbol token */
|
||||
STATIC STRINGHEAD strings; /* list of constant strings */
|
||||
STATIC char *numbuf; /* buffer for numeric tokens */
|
||||
STATIC long numbufsize; /* current size of numeric buffer */
|
||||
|
||||
long errorcount = 0; /* number of compilation errors */
|
||||
|
||||
@@ -78,7 +78,7 @@ struct keyword {
|
||||
int k_token; /* token number */
|
||||
};
|
||||
|
||||
static struct keyword keywords[] = {
|
||||
STATIC struct keyword keywords[] = {
|
||||
{"if", T_IF},
|
||||
{"else", T_ELSE},
|
||||
{"for", T_FOR},
|
||||
@@ -111,11 +111,11 @@ static struct keyword keywords[] = {
|
||||
};
|
||||
|
||||
|
||||
static void eatcomment(void);
|
||||
static void eatstring(int quotechar);
|
||||
static void eatline(void);
|
||||
static int eatsymbol(void);
|
||||
static int eatnumber(void);
|
||||
S_FUNC void eatcomment(void);
|
||||
S_FUNC void eatstring(int quotechar);
|
||||
S_FUNC void eatline(void);
|
||||
S_FUNC int eatsymbol(void);
|
||||
S_FUNC int eatnumber(void);
|
||||
|
||||
|
||||
/*
|
||||
@@ -379,7 +379,7 @@ gettoken(void)
|
||||
* Continue to eat up a comment string.
|
||||
* The leading slash-asterisk has just been scanned at this point.
|
||||
*/
|
||||
static void
|
||||
S_FUNC void
|
||||
eatcomment(void)
|
||||
{
|
||||
int ch;
|
||||
@@ -407,7 +407,7 @@ eatcomment(void)
|
||||
* Typically a #! will require the rest of the line to be eaten as if
|
||||
* it were a comment.
|
||||
*/
|
||||
static void
|
||||
S_FUNC void
|
||||
eatline(void)
|
||||
{
|
||||
int ch; /* chars being eaten */
|
||||
@@ -423,7 +423,7 @@ eatline(void)
|
||||
* Read in a string and add it to the literal string pool.
|
||||
* The leading single or double quote has been read in at this point.
|
||||
*/
|
||||
static void
|
||||
S_FUNC void
|
||||
eatstring(int quotechar)
|
||||
{
|
||||
register char *cp; /* current character address */
|
||||
@@ -551,14 +551,14 @@ eatstring(int quotechar)
|
||||
* If allsyms is set, keywords are not looked up and almost all chars
|
||||
* will be accepted for the symbol. Returns the type of symbol found.
|
||||
*/
|
||||
static int
|
||||
S_FUNC int
|
||||
eatsymbol(void)
|
||||
{
|
||||
register struct keyword *kp; /* pointer to current keyword */
|
||||
register char *cp; /* current character pointer */
|
||||
int ch; /* current character */
|
||||
int cc; /* character count */
|
||||
static char buf[SYMBOLSIZE+1]; /* temporary buffer */
|
||||
STATIC char buf[SYMBOLSIZE+1]; /* temporary buffer */
|
||||
|
||||
cp = buf;
|
||||
cc = SYMBOLSIZE;
|
||||
@@ -604,7 +604,7 @@ eatsymbol(void)
|
||||
* return just a period, which is used for element accesses and for
|
||||
* the old numeric value.
|
||||
*/
|
||||
static int
|
||||
S_FUNC int
|
||||
eatnumber(void)
|
||||
{
|
||||
register char *cp; /* current character pointer */
|
||||
|
26
token.h
26
token.h
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* token - token defines
|
||||
*
|
||||
* Copyright (C) 1999 David I. Bell
|
||||
* Copyright (C) 1999-2007 David I. Bell
|
||||
*
|
||||
* 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
|
||||
@@ -17,8 +17,8 @@
|
||||
* 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.5 $
|
||||
* @(#) $Id: token.h,v 29.5 2006/06/20 10:28:06 chongo Exp $
|
||||
* @(#) $Revision: 29.6 $
|
||||
* @(#) $Id: token.h,v 29.6 2007/02/11 10:19:14 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/token.h,v $
|
||||
*
|
||||
* Under source code control: 1990/02/15 01:48:37
|
||||
@@ -166,17 +166,17 @@
|
||||
#define TM_ALLSYMS 0x2 /* treat almost everything as a symbol */
|
||||
|
||||
|
||||
extern long errorcount; /* number of errors found */
|
||||
EXTERN long errorcount; /* number of errors found */
|
||||
|
||||
extern long tokenstring(void);
|
||||
extern long tokennumber(void);
|
||||
extern char *tokensymbol(void);
|
||||
extern void inittokens(void);
|
||||
extern int tokenmode(int flag);
|
||||
extern int gettoken(void);
|
||||
extern void rescantoken(void);
|
||||
extern void scanerror(int, char *, ...);
|
||||
extern void warning(char *, ...);
|
||||
E_FUNC long tokenstring(void);
|
||||
E_FUNC long tokennumber(void);
|
||||
E_FUNC char *tokensymbol(void);
|
||||
E_FUNC void inittokens(void);
|
||||
E_FUNC int tokenmode(int flag);
|
||||
E_FUNC int gettoken(void);
|
||||
E_FUNC void rescantoken(void);
|
||||
E_FUNC void scanerror(int, char *, ...);
|
||||
E_FUNC void warning(char *, ...);
|
||||
|
||||
|
||||
#endif /* !__TOKEN_H__ */
|
||||
|
8
value.c
8
value.c
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* value - generic value manipulation routines
|
||||
*
|
||||
* Copyright (C) 1999-2006 David I. Bell
|
||||
* Copyright (C) 1999-2007 David I. Bell
|
||||
*
|
||||
* 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
|
||||
@@ -17,8 +17,8 @@
|
||||
* 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.10 $
|
||||
* @(#) $Id: value.c,v 29.10 2006/08/20 15:01:30 chongo Exp $
|
||||
* @(#) $Revision: 29.11 $
|
||||
* @(#) $Id: value.c,v 29.11 2007/02/11 10:19:14 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/value.c,v $
|
||||
*
|
||||
* Under source code control: 1990/02/15 01:48:25
|
||||
@@ -1617,7 +1617,7 @@ rootvalue(VALUE *v1, VALUE *v2, VALUE *v3, VALUE *vres)
|
||||
void
|
||||
absvalue(VALUE *v1, VALUE *v2, VALUE *vres)
|
||||
{
|
||||
static NUMBER *q;
|
||||
STATIC NUMBER *q;
|
||||
|
||||
if (v1->v_type == V_OBJ || v2->v_type == V_OBJ) {
|
||||
*vres = objcall(OBJ_ABS, v1, v2, NULL_VALUE);
|
||||
|
350
value.h
350
value.h
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* value - definitions of general values and related routines used by calc
|
||||
*
|
||||
* Copyright (C) 1999-2006 David I. Bell
|
||||
* Copyright (C) 1999-2007 David I. Bell
|
||||
*
|
||||
* 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
|
||||
@@ -17,8 +17,8 @@
|
||||
* 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.11 $
|
||||
* @(#) $Id: value.h,v 29.11 2006/08/20 15:01:30 chongo Exp $
|
||||
* @(#) $Revision: 29.12 $
|
||||
* @(#) $Id: value.h,v 29.12 2007/02/11 10:19:14 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/value.h,v $
|
||||
*
|
||||
* Under source code control: 1993/07/30 19:42:47
|
||||
@@ -33,7 +33,7 @@
|
||||
|
||||
|
||||
#if defined(CALC_SRC) /* if we are building from the calc source tree */
|
||||
# include "win32dll.h"
|
||||
# include "decl.h"
|
||||
# include "cmath.h"
|
||||
# include "config.h"
|
||||
# include "shs.h"
|
||||
@@ -43,7 +43,7 @@
|
||||
# include "nametype.h"
|
||||
# include "string.h"
|
||||
#else
|
||||
# include <calc/win32dll.h>
|
||||
# include <calc/decl.h>
|
||||
# include <calc/cmath.h>
|
||||
# include <calc/config.h>
|
||||
# include <calc/shs.h>
|
||||
@@ -201,60 +201,60 @@ struct value {
|
||||
/*
|
||||
* value functions
|
||||
*/
|
||||
extern DLL void freevalue(VALUE *vp);
|
||||
extern DLL void copyvalue(VALUE *vp, VALUE *vres);
|
||||
extern DLL void negvalue(VALUE *vp, VALUE *vres);
|
||||
extern DLL void addvalue(VALUE *v1, VALUE *v2, VALUE *vres);
|
||||
extern DLL void subvalue(VALUE *v1, VALUE *v2, VALUE *vres);
|
||||
extern DLL void mulvalue(VALUE *v1, VALUE *v2, VALUE *vres);
|
||||
extern DLL void orvalue(VALUE *v1, VALUE *v2, VALUE *vres);
|
||||
extern DLL void andvalue(VALUE *v1, VALUE *v2, VALUE *vres);
|
||||
extern DLL void compvalue(VALUE *vp, VALUE *vres);
|
||||
extern DLL void xorvalue(VALUE *v1, VALUE *v2, VALUE *vres);
|
||||
extern DLL void squarevalue(VALUE *vp, VALUE *vres);
|
||||
extern DLL void invertvalue(VALUE *vp, VALUE *vres);
|
||||
extern DLL void roundvalue(VALUE *v1, VALUE *v2, VALUE *v3, VALUE *vres);
|
||||
extern DLL void broundvalue(VALUE *v1, VALUE *v2, VALUE *v3, VALUE *vres);
|
||||
extern DLL void setminusvalue(VALUE *, VALUE *, VALUE *);
|
||||
extern DLL void backslashvalue(VALUE *, VALUE *);
|
||||
extern DLL void contentvalue(VALUE *, VALUE *);
|
||||
extern DLL void hashopvalue(VALUE *, VALUE *, VALUE *);
|
||||
extern DLL void apprvalue(VALUE *v1, VALUE *v2, VALUE *v3, VALUE *vres);
|
||||
extern DLL void intvalue(VALUE *vp, VALUE *vres);
|
||||
extern DLL void fracvalue(VALUE *vp, VALUE *vres);
|
||||
extern DLL void incvalue(VALUE *vp, VALUE *vres);
|
||||
extern DLL void decvalue(VALUE *vp, VALUE *vres);
|
||||
extern DLL void conjvalue(VALUE *vp, VALUE *vres);
|
||||
extern DLL void sqrtvalue(VALUE *v1, VALUE *v2, VALUE *v3, VALUE *vres);
|
||||
extern DLL void rootvalue(VALUE *v1, VALUE *v2, VALUE *v3, VALUE *vres);
|
||||
extern DLL void absvalue(VALUE *v1, VALUE *v2, VALUE *vres);
|
||||
extern DLL void normvalue(VALUE *vp, VALUE *vres);
|
||||
extern DLL void shiftvalue(VALUE *v1, VALUE *v2, BOOL rightshift, VALUE *vres);
|
||||
extern DLL void scalevalue(VALUE *v1, VALUE *v2, VALUE *vres);
|
||||
extern DLL void powivalue(VALUE *v1, VALUE *v2, VALUE *vres);
|
||||
extern DLL void powervalue(VALUE *v1, VALUE *v2, VALUE *v3, VALUE *vres);
|
||||
extern DLL void divvalue(VALUE *v1, VALUE *v2, VALUE *vres);
|
||||
extern DLL void quovalue(VALUE *v1, VALUE *v2, VALUE *v3, VALUE *vres);
|
||||
extern DLL void modvalue(VALUE *v1, VALUE *v2, VALUE *v3, VALUE *vres);
|
||||
extern DLL BOOL testvalue(VALUE *vp);
|
||||
extern DLL BOOL comparevalue(VALUE *v1, VALUE *v2);
|
||||
extern DLL BOOL acceptvalue(VALUE *v1, VALUE *v2);
|
||||
extern DLL void relvalue(VALUE *v1, VALUE *v2, VALUE *vres);
|
||||
extern DLL void sgnvalue(VALUE *vp, VALUE *vres);
|
||||
extern DLL QCKHASH hashvalue(VALUE *vp, QCKHASH val);
|
||||
extern DLL void printvalue(VALUE *vp, int flags);
|
||||
extern DLL void printestr(VALUE *vp);
|
||||
extern DLL BOOL precvalue(VALUE *v1, VALUE *v2);
|
||||
extern DLL VALUE error_value(int e);
|
||||
extern DLL int set_errno(int e);
|
||||
extern DLL int set_errcount(int e);
|
||||
extern DLL long countlistitems(LIST *lp);
|
||||
extern DLL void addlistitems(LIST *lp, VALUE *vres);
|
||||
extern DLL void addlistinv(LIST *lp, VALUE *vres);
|
||||
extern DLL void copy2octet(VALUE *, OCTET *);
|
||||
extern DLL int copystod(VALUE *, long, long, VALUE *, long);
|
||||
extern DLL void protecttodepth(VALUE *, int, int);
|
||||
extern DLL void set_update(int);
|
||||
E_FUNC void freevalue(VALUE *vp);
|
||||
E_FUNC void copyvalue(VALUE *vp, VALUE *vres);
|
||||
E_FUNC void negvalue(VALUE *vp, VALUE *vres);
|
||||
E_FUNC void addvalue(VALUE *v1, VALUE *v2, VALUE *vres);
|
||||
E_FUNC void subvalue(VALUE *v1, VALUE *v2, VALUE *vres);
|
||||
E_FUNC void mulvalue(VALUE *v1, VALUE *v2, VALUE *vres);
|
||||
E_FUNC void orvalue(VALUE *v1, VALUE *v2, VALUE *vres);
|
||||
E_FUNC void andvalue(VALUE *v1, VALUE *v2, VALUE *vres);
|
||||
E_FUNC void compvalue(VALUE *vp, VALUE *vres);
|
||||
E_FUNC void xorvalue(VALUE *v1, VALUE *v2, VALUE *vres);
|
||||
E_FUNC void squarevalue(VALUE *vp, VALUE *vres);
|
||||
E_FUNC void invertvalue(VALUE *vp, VALUE *vres);
|
||||
E_FUNC void roundvalue(VALUE *v1, VALUE *v2, VALUE *v3, VALUE *vres);
|
||||
E_FUNC void broundvalue(VALUE *v1, VALUE *v2, VALUE *v3, VALUE *vres);
|
||||
E_FUNC void setminusvalue(VALUE *, VALUE *, VALUE *);
|
||||
E_FUNC void backslashvalue(VALUE *, VALUE *);
|
||||
E_FUNC void contentvalue(VALUE *, VALUE *);
|
||||
E_FUNC void hashopvalue(VALUE *, VALUE *, VALUE *);
|
||||
E_FUNC void apprvalue(VALUE *v1, VALUE *v2, VALUE *v3, VALUE *vres);
|
||||
E_FUNC void intvalue(VALUE *vp, VALUE *vres);
|
||||
E_FUNC void fracvalue(VALUE *vp, VALUE *vres);
|
||||
E_FUNC void incvalue(VALUE *vp, VALUE *vres);
|
||||
E_FUNC void decvalue(VALUE *vp, VALUE *vres);
|
||||
E_FUNC void conjvalue(VALUE *vp, VALUE *vres);
|
||||
E_FUNC void sqrtvalue(VALUE *v1, VALUE *v2, VALUE *v3, VALUE *vres);
|
||||
E_FUNC void rootvalue(VALUE *v1, VALUE *v2, VALUE *v3, VALUE *vres);
|
||||
E_FUNC void absvalue(VALUE *v1, VALUE *v2, VALUE *vres);
|
||||
E_FUNC void normvalue(VALUE *vp, VALUE *vres);
|
||||
E_FUNC void shiftvalue(VALUE *v1, VALUE *v2, BOOL rightshift, VALUE *vres);
|
||||
E_FUNC void scalevalue(VALUE *v1, VALUE *v2, VALUE *vres);
|
||||
E_FUNC void powivalue(VALUE *v1, VALUE *v2, VALUE *vres);
|
||||
E_FUNC void powervalue(VALUE *v1, VALUE *v2, VALUE *v3, VALUE *vres);
|
||||
E_FUNC void divvalue(VALUE *v1, VALUE *v2, VALUE *vres);
|
||||
E_FUNC void quovalue(VALUE *v1, VALUE *v2, VALUE *v3, VALUE *vres);
|
||||
E_FUNC void modvalue(VALUE *v1, VALUE *v2, VALUE *v3, VALUE *vres);
|
||||
E_FUNC BOOL testvalue(VALUE *vp);
|
||||
E_FUNC BOOL comparevalue(VALUE *v1, VALUE *v2);
|
||||
E_FUNC BOOL acceptvalue(VALUE *v1, VALUE *v2);
|
||||
E_FUNC void relvalue(VALUE *v1, VALUE *v2, VALUE *vres);
|
||||
E_FUNC void sgnvalue(VALUE *vp, VALUE *vres);
|
||||
E_FUNC QCKHASH hashvalue(VALUE *vp, QCKHASH val);
|
||||
E_FUNC void printvalue(VALUE *vp, int flags);
|
||||
E_FUNC void printestr(VALUE *vp);
|
||||
E_FUNC BOOL precvalue(VALUE *v1, VALUE *v2);
|
||||
E_FUNC VALUE error_value(int e);
|
||||
E_FUNC int set_errno(int e);
|
||||
E_FUNC int set_errcount(int e);
|
||||
E_FUNC long countlistitems(LIST *lp);
|
||||
E_FUNC void addlistitems(LIST *lp, VALUE *vres);
|
||||
E_FUNC void addlistinv(LIST *lp, VALUE *vres);
|
||||
E_FUNC void copy2octet(VALUE *, OCTET *);
|
||||
E_FUNC int copystod(VALUE *, long, long, VALUE *, long);
|
||||
E_FUNC void protecttodepth(VALUE *, int, int);
|
||||
E_FUNC void set_update(int);
|
||||
|
||||
|
||||
/*
|
||||
@@ -271,44 +271,44 @@ struct matrix {
|
||||
#define matsize(n) (sizeof(MATRIX) - sizeof(VALUE) + ((n) * sizeof(VALUE)))
|
||||
|
||||
|
||||
extern DLL MATRIX *matadd(MATRIX *m1, MATRIX *m2);
|
||||
extern DLL MATRIX *matsub(MATRIX *m1, MATRIX *m2);
|
||||
extern DLL MATRIX *matmul(MATRIX *m1, MATRIX *m2);
|
||||
extern DLL MATRIX *matneg(MATRIX *m);
|
||||
extern DLL MATRIX *matalloc(long size);
|
||||
extern DLL MATRIX *matcopy(MATRIX *m);
|
||||
extern DLL MATRIX *matinit(MATRIX *m, VALUE *v1, VALUE *v2);
|
||||
extern DLL MATRIX *matsquare(MATRIX *m);
|
||||
extern DLL MATRIX *matinv(MATRIX *m);
|
||||
extern DLL MATRIX *matscale(MATRIX *m, long n);
|
||||
extern DLL MATRIX *matshift(MATRIX *m, long n);
|
||||
extern DLL MATRIX *matmulval(MATRIX *m, VALUE *vp);
|
||||
extern DLL MATRIX *matpowi(MATRIX *m, NUMBER *q);
|
||||
extern DLL MATRIX *matconj(MATRIX *m);
|
||||
extern DLL MATRIX *matquoval(MATRIX *m, VALUE *vp, VALUE *v3);
|
||||
extern DLL MATRIX *matmodval(MATRIX *m, VALUE *vp, VALUE *v3);
|
||||
extern DLL MATRIX *matint(MATRIX *m);
|
||||
extern DLL MATRIX *matfrac(MATRIX *m);
|
||||
extern DLL MATRIX *matappr(MATRIX *m, VALUE *v2, VALUE *v3);
|
||||
extern DLL VALUE mattrace(MATRIX *m);
|
||||
extern DLL MATRIX *mattrans(MATRIX *m);
|
||||
extern DLL MATRIX *matcross(MATRIX *m1, MATRIX *m2);
|
||||
extern DLL BOOL mattest(MATRIX *m);
|
||||
extern DLL void matsum(MATRIX *m, VALUE *vres);
|
||||
extern DLL BOOL matcmp(MATRIX *m1, MATRIX *m2);
|
||||
extern DLL int matsearch(MATRIX *m, VALUE *vp, long start, long end, ZVALUE *index);
|
||||
extern DLL int matrsearch(MATRIX *m, VALUE *vp, long start, long end, ZVALUE *index);
|
||||
extern DLL VALUE matdet(MATRIX *m);
|
||||
extern DLL VALUE matdot(MATRIX *m1, MATRIX *m2);
|
||||
extern DLL void matfill(MATRIX *m, VALUE *v1, VALUE *v2);
|
||||
extern DLL void matfree(MATRIX *m);
|
||||
extern DLL void matprint(MATRIX *m, long max_print);
|
||||
extern DLL VALUE *matindex(MATRIX *mp, BOOL create, long dim, VALUE *indices);
|
||||
extern DLL void matreverse(MATRIX *m);
|
||||
extern DLL void matsort(MATRIX *m);
|
||||
extern DLL BOOL matisident(MATRIX *m);
|
||||
extern DLL MATRIX *matround(MATRIX *m, VALUE *v2, VALUE *v3);
|
||||
extern DLL MATRIX *matbround(MATRIX *m, VALUE *v2, VALUE *v3);
|
||||
E_FUNC MATRIX *matadd(MATRIX *m1, MATRIX *m2);
|
||||
E_FUNC MATRIX *matsub(MATRIX *m1, MATRIX *m2);
|
||||
E_FUNC MATRIX *matmul(MATRIX *m1, MATRIX *m2);
|
||||
E_FUNC MATRIX *matneg(MATRIX *m);
|
||||
E_FUNC MATRIX *matalloc(long size);
|
||||
E_FUNC MATRIX *matcopy(MATRIX *m);
|
||||
E_FUNC MATRIX *matinit(MATRIX *m, VALUE *v1, VALUE *v2);
|
||||
E_FUNC MATRIX *matsquare(MATRIX *m);
|
||||
E_FUNC MATRIX *matinv(MATRIX *m);
|
||||
E_FUNC MATRIX *matscale(MATRIX *m, long n);
|
||||
E_FUNC MATRIX *matshift(MATRIX *m, long n);
|
||||
E_FUNC MATRIX *matmulval(MATRIX *m, VALUE *vp);
|
||||
E_FUNC MATRIX *matpowi(MATRIX *m, NUMBER *q);
|
||||
E_FUNC MATRIX *matconj(MATRIX *m);
|
||||
E_FUNC MATRIX *matquoval(MATRIX *m, VALUE *vp, VALUE *v3);
|
||||
E_FUNC MATRIX *matmodval(MATRIX *m, VALUE *vp, VALUE *v3);
|
||||
E_FUNC MATRIX *matint(MATRIX *m);
|
||||
E_FUNC MATRIX *matfrac(MATRIX *m);
|
||||
E_FUNC MATRIX *matappr(MATRIX *m, VALUE *v2, VALUE *v3);
|
||||
E_FUNC VALUE mattrace(MATRIX *m);
|
||||
E_FUNC MATRIX *mattrans(MATRIX *m);
|
||||
E_FUNC MATRIX *matcross(MATRIX *m1, MATRIX *m2);
|
||||
E_FUNC BOOL mattest(MATRIX *m);
|
||||
E_FUNC void matsum(MATRIX *m, VALUE *vres);
|
||||
E_FUNC BOOL matcmp(MATRIX *m1, MATRIX *m2);
|
||||
E_FUNC int matsearch(MATRIX *m, VALUE *vp, long start, long end, ZVALUE *index);
|
||||
E_FUNC int matrsearch(MATRIX *m, VALUE *vp, long start, long end, ZVALUE *index);
|
||||
E_FUNC VALUE matdet(MATRIX *m);
|
||||
E_FUNC VALUE matdot(MATRIX *m1, MATRIX *m2);
|
||||
E_FUNC void matfill(MATRIX *m, VALUE *v1, VALUE *v2);
|
||||
E_FUNC void matfree(MATRIX *m);
|
||||
E_FUNC void matprint(MATRIX *m, long max_print);
|
||||
E_FUNC VALUE *matindex(MATRIX *mp, BOOL create, long dim, VALUE *indices);
|
||||
E_FUNC void matreverse(MATRIX *m);
|
||||
E_FUNC void matsort(MATRIX *m);
|
||||
E_FUNC BOOL matisident(MATRIX *m);
|
||||
E_FUNC MATRIX *matround(MATRIX *m, VALUE *v2, VALUE *v3);
|
||||
E_FUNC MATRIX *matbround(MATRIX *m, VALUE *v2, VALUE *v3);
|
||||
|
||||
|
||||
/*
|
||||
@@ -335,32 +335,32 @@ struct list {
|
||||
};
|
||||
|
||||
|
||||
extern DLL void insertlistfirst(LIST *lp, VALUE *vp);
|
||||
extern DLL void insertlistlast(LIST *lp, VALUE *vp);
|
||||
extern DLL void insertlistmiddle(LIST *lp, long index, VALUE *vp);
|
||||
extern DLL void removelistfirst(LIST *lp, VALUE *vp);
|
||||
extern DLL void removelistlast(LIST *lp, VALUE *vp);
|
||||
extern DLL void removelistmiddle(LIST *lp, long index, VALUE *vp);
|
||||
extern DLL void listfree(LIST *lp);
|
||||
extern DLL void listprint(LIST *lp, long max_print);
|
||||
extern DLL int listsearch(LIST *lp, VALUE *vp, long start, long end, ZVALUE *index);
|
||||
extern DLL int listrsearch(LIST *lp, VALUE *vp, long start, long end, ZVALUE *index);
|
||||
extern DLL BOOL listcmp(LIST *lp1, LIST *lp2);
|
||||
extern DLL VALUE *listfindex(LIST *lp, long index);
|
||||
extern DLL LIST *listalloc(void);
|
||||
extern DLL LIST *listcopy(LIST *lp);
|
||||
extern DLL void listreverse(LIST *lp);
|
||||
extern DLL void listsort(LIST *lp);
|
||||
extern DLL LIST *listappr(LIST *lp, VALUE *v2, VALUE *v3);
|
||||
extern DLL LIST *listround(LIST *m, VALUE *v2, VALUE *v3);
|
||||
extern DLL LIST *listbround(LIST *m, VALUE *v2, VALUE *v3);
|
||||
extern DLL LIST *listquo(LIST *lp, VALUE *v2, VALUE *v3);
|
||||
extern DLL LIST *listmod(LIST *lp, VALUE *v2, VALUE *v3);
|
||||
extern DLL BOOL evp(LISTELEM *cp, LISTELEM *x, VALUE *vres);
|
||||
extern DLL BOOL evalpoly(LIST *clist, LISTELEM *x, VALUE *vres);
|
||||
extern DLL void insertitems(LIST *lp1, LIST *lp2);
|
||||
extern DLL LISTELEM *listelement(LIST *, long);
|
||||
extern DLL LIST *listsegment(LIST *, long, long);
|
||||
E_FUNC void insertlistfirst(LIST *lp, VALUE *vp);
|
||||
E_FUNC void insertlistlast(LIST *lp, VALUE *vp);
|
||||
E_FUNC void insertlistmiddle(LIST *lp, long index, VALUE *vp);
|
||||
E_FUNC void removelistfirst(LIST *lp, VALUE *vp);
|
||||
E_FUNC void removelistlast(LIST *lp, VALUE *vp);
|
||||
E_FUNC void removelistmiddle(LIST *lp, long index, VALUE *vp);
|
||||
E_FUNC void listfree(LIST *lp);
|
||||
E_FUNC void listprint(LIST *lp, long max_print);
|
||||
E_FUNC int listsearch(LIST *lp, VALUE *vp, long start, long end, ZVALUE *index);
|
||||
E_FUNC int listrsearch(LIST *lp, VALUE *vp, long start, long end, ZVALUE *index);
|
||||
E_FUNC BOOL listcmp(LIST *lp1, LIST *lp2);
|
||||
E_FUNC VALUE *listfindex(LIST *lp, long index);
|
||||
E_FUNC LIST *listalloc(void);
|
||||
E_FUNC LIST *listcopy(LIST *lp);
|
||||
E_FUNC void listreverse(LIST *lp);
|
||||
E_FUNC void listsort(LIST *lp);
|
||||
E_FUNC LIST *listappr(LIST *lp, VALUE *v2, VALUE *v3);
|
||||
E_FUNC LIST *listround(LIST *m, VALUE *v2, VALUE *v3);
|
||||
E_FUNC LIST *listbround(LIST *m, VALUE *v2, VALUE *v3);
|
||||
E_FUNC LIST *listquo(LIST *lp, VALUE *v2, VALUE *v3);
|
||||
E_FUNC LIST *listmod(LIST *lp, VALUE *v2, VALUE *v3);
|
||||
E_FUNC BOOL evp(LISTELEM *cp, LISTELEM *x, VALUE *vres);
|
||||
E_FUNC BOOL evalpoly(LIST *clist, LISTELEM *x, VALUE *vres);
|
||||
E_FUNC void insertitems(LIST *lp1, LIST *lp2);
|
||||
E_FUNC LISTELEM *listelement(LIST *, long);
|
||||
E_FUNC LIST *listsegment(LIST *, long, long);
|
||||
|
||||
|
||||
/*
|
||||
@@ -385,15 +385,15 @@ struct assoc {
|
||||
};
|
||||
|
||||
|
||||
extern DLL ASSOC *assocalloc(long initsize);
|
||||
extern DLL ASSOC *assoccopy(ASSOC *ap);
|
||||
extern DLL void assocfree(ASSOC *ap);
|
||||
extern DLL void assocprint(ASSOC *ap, long max_print);
|
||||
extern DLL int assocsearch(ASSOC *ap, VALUE *vp, long start, long end, ZVALUE *index);
|
||||
extern DLL int assocrsearch(ASSOC *ap, VALUE *vp, long start, long end, ZVALUE *index);
|
||||
extern DLL BOOL assoccmp(ASSOC *ap1, ASSOC *ap2);
|
||||
extern DLL VALUE *assocfindex(ASSOC *ap, long index);
|
||||
extern DLL VALUE *associndex(ASSOC *ap, BOOL create, long dim, VALUE *indices);
|
||||
E_FUNC ASSOC *assocalloc(long initsize);
|
||||
E_FUNC ASSOC *assoccopy(ASSOC *ap);
|
||||
E_FUNC void assocfree(ASSOC *ap);
|
||||
E_FUNC void assocprint(ASSOC *ap, long max_print);
|
||||
E_FUNC int assocsearch(ASSOC *ap, VALUE *vp, long start, long end, ZVALUE *index);
|
||||
E_FUNC int assocrsearch(ASSOC *ap, VALUE *vp, long start, long end, ZVALUE *index);
|
||||
E_FUNC BOOL assoccmp(ASSOC *ap1, ASSOC *ap2);
|
||||
E_FUNC VALUE *assocfindex(ASSOC *ap, long index);
|
||||
E_FUNC VALUE *associndex(ASSOC *ap, BOOL create, long dim, VALUE *indices);
|
||||
|
||||
|
||||
/*
|
||||
@@ -475,62 +475,62 @@ struct object {
|
||||
(sizeof(OBJECT) + ((elements) - USUAL_ELEMENTS) * sizeof(VALUE))
|
||||
|
||||
|
||||
extern DLL OBJECT *objcopy(OBJECT *op);
|
||||
extern DLL OBJECT *objalloc(long index);
|
||||
extern DLL VALUE objcall(int action, VALUE *v1, VALUE *v2, VALUE *v3);
|
||||
extern DLL void objfree(OBJECT *op);
|
||||
extern DLL int addelement(char *name);
|
||||
extern DLL int defineobject(char *name, int indices[], int count);
|
||||
extern DLL int checkobject(char *name);
|
||||
extern DLL void showobjfuncs(void);
|
||||
extern DLL void showobjtypes(void);
|
||||
extern DLL int findelement(char *name);
|
||||
extern DLL char *objtypename(unsigned long index);
|
||||
extern DLL int objoffset(OBJECT *op, long index);
|
||||
E_FUNC OBJECT *objcopy(OBJECT *op);
|
||||
E_FUNC OBJECT *objalloc(long index);
|
||||
E_FUNC VALUE objcall(int action, VALUE *v1, VALUE *v2, VALUE *v3);
|
||||
E_FUNC void objfree(OBJECT *op);
|
||||
E_FUNC int addelement(char *name);
|
||||
E_FUNC int defineobject(char *name, int indices[], int count);
|
||||
E_FUNC int checkobject(char *name);
|
||||
E_FUNC void showobjfuncs(void);
|
||||
E_FUNC void showobjtypes(void);
|
||||
E_FUNC int findelement(char *name);
|
||||
E_FUNC char *objtypename(unsigned long index);
|
||||
E_FUNC int objoffset(OBJECT *op, long index);
|
||||
|
||||
|
||||
/*
|
||||
* Configuration parameter name and type.
|
||||
*/
|
||||
extern NAMETYPE configs[];
|
||||
extern DLL void config_value(CONFIG *cfg, int type, VALUE *ret);
|
||||
extern DLL void setconfig(int type, VALUE *vp);
|
||||
extern DLL void config_print(CONFIG *cfg); /* the CONFIG to print */
|
||||
EXTERN NAMETYPE configs[];
|
||||
E_FUNC void config_value(CONFIG *cfg, int type, VALUE *ret);
|
||||
E_FUNC void setconfig(int type, VALUE *vp);
|
||||
E_FUNC void config_print(CONFIG *cfg); /* the CONFIG to print */
|
||||
|
||||
|
||||
/*
|
||||
* size, memsize and sizeof support
|
||||
*/
|
||||
extern DLL long elm_count(VALUE *vp);
|
||||
extern DLL size_t lsizeof(VALUE *vp);
|
||||
extern DLL size_t memsize(VALUE *vp);
|
||||
E_FUNC long elm_count(VALUE *vp);
|
||||
E_FUNC size_t lsizeof(VALUE *vp);
|
||||
E_FUNC size_t memsize(VALUE *vp);
|
||||
|
||||
/*
|
||||
* String functions
|
||||
*/
|
||||
extern DLL STRING *stringadd(STRING *, STRING *);
|
||||
extern DLL STRING *stringcopy(STRING *);
|
||||
extern DLL STRING *stringsub(STRING *, STRING *);
|
||||
extern DLL STRING *stringmul(NUMBER *, STRING *);
|
||||
extern DLL STRING *stringand(STRING *, STRING *);
|
||||
extern DLL STRING *stringor(STRING *, STRING *);
|
||||
extern DLL STRING *stringxor(STRING *, STRING *);
|
||||
extern DLL STRING *stringdiff(STRING *, STRING *);
|
||||
extern DLL STRING *stringsegment(STRING *, long, long);
|
||||
extern DLL STRING *stringshift(STRING *, long);
|
||||
extern DLL STRING *stringcomp(STRING *);
|
||||
extern DLL STRING *stringneg(STRING *);
|
||||
extern DLL STRING *stringcpy(STRING *, STRING *);
|
||||
extern DLL STRING *stringncpy(STRING *, STRING *, size_t);
|
||||
extern DLL long stringcontent(STRING *s);
|
||||
extern DLL long stringlowbit(STRING *s);
|
||||
extern DLL long stringhighbit(STRING *s);
|
||||
extern DLL BOOL stringcmp(STRING *, STRING *);
|
||||
extern DLL BOOL stringrel(STRING *, STRING *);
|
||||
extern DLL int stringbit(STRING *, long);
|
||||
extern DLL BOOL stringtest(STRING *);
|
||||
extern DLL int stringsetbit(STRING *, long, BOOL);
|
||||
extern DLL int stringsearch(STRING *, STRING *, long, long, ZVALUE *);
|
||||
extern DLL int stringrsearch(STRING *, STRING *, long, long, ZVALUE *);
|
||||
E_FUNC STRING *stringadd(STRING *, STRING *);
|
||||
E_FUNC STRING *stringcopy(STRING *);
|
||||
E_FUNC STRING *stringsub(STRING *, STRING *);
|
||||
E_FUNC STRING *stringmul(NUMBER *, STRING *);
|
||||
E_FUNC STRING *stringand(STRING *, STRING *);
|
||||
E_FUNC STRING *stringor(STRING *, STRING *);
|
||||
E_FUNC STRING *stringxor(STRING *, STRING *);
|
||||
E_FUNC STRING *stringdiff(STRING *, STRING *);
|
||||
E_FUNC STRING *stringsegment(STRING *, long, long);
|
||||
E_FUNC STRING *stringshift(STRING *, long);
|
||||
E_FUNC STRING *stringcomp(STRING *);
|
||||
E_FUNC STRING *stringneg(STRING *);
|
||||
E_FUNC STRING *stringcpy(STRING *, STRING *);
|
||||
E_FUNC STRING *stringncpy(STRING *, STRING *, size_t);
|
||||
E_FUNC long stringcontent(STRING *s);
|
||||
E_FUNC long stringlowbit(STRING *s);
|
||||
E_FUNC long stringhighbit(STRING *s);
|
||||
E_FUNC BOOL stringcmp(STRING *, STRING *);
|
||||
E_FUNC BOOL stringrel(STRING *, STRING *);
|
||||
E_FUNC int stringbit(STRING *, long);
|
||||
E_FUNC BOOL stringtest(STRING *);
|
||||
E_FUNC int stringsetbit(STRING *, long, BOOL);
|
||||
E_FUNC int stringsearch(STRING *, STRING *, long, long, ZVALUE *);
|
||||
E_FUNC int stringrsearch(STRING *, STRING *, long, long, ZVALUE *);
|
||||
|
||||
#endif /* !__VALUE_H__ */
|
||||
|
36
version.c
36
version.c
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* version - determine the version of calc
|
||||
*
|
||||
* Copyright (C) 1999-2006 David I. Bell and Landon Curt Noll
|
||||
* Copyright (C) 1999-2007 David I. Bell and Landon Curt Noll
|
||||
*
|
||||
* Primary author: David I. Bell
|
||||
*
|
||||
@@ -19,8 +19,8 @@
|
||||
* 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.74 $
|
||||
* @(#) $Id: version.c,v 29.74 2007/02/07 01:37:07 chongo Exp $
|
||||
* @(#) $Revision: 29.81 $
|
||||
* @(#) $Id: version.c,v 29.81 2007/02/12 03:40:35 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/version.c,v $
|
||||
*
|
||||
* Under source code control: 1990/05/22 11:00:58
|
||||
@@ -36,8 +36,9 @@
|
||||
#include <string.h>
|
||||
|
||||
#if defined(CALC_VER)
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
# include <stdlib.h>
|
||||
# include <unistd.h>
|
||||
# define STATIC static
|
||||
static char *program;
|
||||
#else
|
||||
# include "calc.h"
|
||||
@@ -48,7 +49,7 @@ static char *program;
|
||||
#define MAJOR_VER 2 /* major version */
|
||||
#define MINOR_VER 12 /* minor version */
|
||||
#define MAJOR_PATCH 1 /* patch level or 0 if no patch */
|
||||
#define MINOR_PATCH 8 /* test number or 0 if no minor patch */
|
||||
#define MINOR_PATCH 12 /* test number or 0 if no minor patch */
|
||||
|
||||
|
||||
/*
|
||||
@@ -63,7 +64,7 @@ int calc_minor_patch = MINOR_PATCH;
|
||||
/*
|
||||
* stored version
|
||||
*/
|
||||
static char *stored_version = NULL; /* version formed if != NULL */
|
||||
STATIC char *stored_version = NULL; /* version formed if != NULL */
|
||||
|
||||
|
||||
/*
|
||||
@@ -72,9 +73,9 @@ static char *stored_version = NULL; /* version formed if != NULL */
|
||||
char *Copyright = "\n"
|
||||
"calc - arbitrary precision calculator\n"
|
||||
"\n"
|
||||
"@(#) Copyright (C) 2006 David I. Bell, Landon Curt Noll and Ernest Bowen\n"
|
||||
"@(#) Copyright (C) 2007 David I. Bell, Landon Curt Noll and Ernest Bowen\n"
|
||||
"\n"
|
||||
"Primary author: David I. Bell\n"
|
||||
"Initial author: David I. Bell\n"
|
||||
"\n"
|
||||
"Calc is open software; you can redistribute it and/or modify it under\n"
|
||||
"the terms of the version 2.1 of the GNU Lesser General Public License\n"
|
||||
@@ -95,23 +96,6 @@ char *Copyright = "\n"
|
||||
"\n";
|
||||
|
||||
|
||||
#if !defined(HAVE_SNPRINTF)
|
||||
/* Simulate snprintf with vsprintf, hoping that BUFSIZ is large enough. */
|
||||
#include <stdarg.h>
|
||||
/*ARGSUSED*/
|
||||
int
|
||||
snprintf (char *buf, size_t UNUSED n, const char *fmt, ...)
|
||||
{
|
||||
int retval;
|
||||
va_list arg;
|
||||
|
||||
va_start (arg, fmt);
|
||||
retval = vsprintf (buf, fmt, arg);
|
||||
va_end (arg);
|
||||
return retval;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* version - return version string
|
||||
*
|
||||
|
@@ -11,8 +11,8 @@
|
||||
#define STDARG /* use <stdarg.h> */
|
||||
#include <stdarg.h>
|
||||
|
||||
/* should we use vsprintf()? */
|
||||
#define HAVE_VS /* yes */
|
||||
/* should we use vsprintf() and vsnprintf()? */
|
||||
#define HAVE_VSPRINTF /* yes */
|
||||
|
||||
|
||||
#endif /* !__ARGS_H__ */
|
||||
|
@@ -1,14 +0,0 @@
|
||||
/*
|
||||
* DO NOT EDIT -- generated by the Makefile
|
||||
*/
|
||||
|
||||
|
||||
#if !defined(__HAVE_MALLOC_H__)
|
||||
#define __HAVE_MALLOC_H__
|
||||
|
||||
|
||||
/* do we have <malloc.h>? */
|
||||
#define HAVE_MALLOC_H /* yes */
|
||||
|
||||
|
||||
#endif /* !__HAVE_MALLOC_H__ */
|
50
win32dll.h
50
win32dll.h
@@ -1,50 +0,0 @@
|
||||
/*
|
||||
* win32dll - definitions for building windoz dll files
|
||||
*
|
||||
* Copyright (C) 2001 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: win32dll.h,v 29.1 2001/03/18 03:03:11 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/win32dll.h,v $
|
||||
*
|
||||
* Under source code control: 2001/03/17 13:05:31
|
||||
* 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/
|
||||
*/
|
||||
|
||||
|
||||
#if !defined(__WIN32DLL_H__)
|
||||
#define __WIN32DLL_H__
|
||||
|
||||
#if defined(_WIN32)
|
||||
|
||||
# if defined(_EXPORTING)
|
||||
# define DLL __declspec(dllexport)
|
||||
# else
|
||||
# define DLL __declspec(dllimport)
|
||||
# endif
|
||||
|
||||
#else /* Windoz free systems */
|
||||
|
||||
# define DLL
|
||||
|
||||
#endif /* Windoz free systems */
|
||||
|
||||
|
||||
#endif /* !__WIN32DLL_H__ */
|
14
zfunc.c
14
zfunc.c
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* zfunc - extended precision integral arithmetic non-primitive routines
|
||||
*
|
||||
* Copyright (C) 1999 David I. Bell, Landon Curt Noll and Ernest Bowen
|
||||
* Copyright (C) 1999-2007 David I. Bell, Landon Curt Noll and Ernest Bowen
|
||||
*
|
||||
* Primary author: David I. Bell
|
||||
*
|
||||
@@ -19,8 +19,8 @@
|
||||
* 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.8 $
|
||||
* @(#) $Id: zfunc.c,v 29.8 2006/06/04 20:18:44 chongo Exp $
|
||||
* @(#) $Revision: 29.9 $
|
||||
* @(#) $Id: zfunc.c,v 29.9 2007/02/11 10:19:14 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/zfunc.c,v $
|
||||
*
|
||||
* Under source code control: 1990/02/15 01:48:27
|
||||
@@ -34,8 +34,8 @@
|
||||
|
||||
ZVALUE _tenpowers_[TEN_MAX+1]; /* table of 10^2^n */
|
||||
|
||||
static long *power10 = NULL;
|
||||
static int max_power10_exp = 0;
|
||||
STATIC long *power10 = NULL;
|
||||
STATIC int max_power10_exp = 0;
|
||||
|
||||
/*
|
||||
* given:
|
||||
@@ -48,7 +48,7 @@ static int max_power10_exp = 0;
|
||||
* If issq_mod4k[x & 0xfff] == 0, then x cannot be a perfect square
|
||||
* else x might be a perfect square.
|
||||
*/
|
||||
static USB8 issq_mod4k[1<<12] = {
|
||||
STATIC USB8 issq_mod4k[1<<12] = {
|
||||
1,1,0,0,1,0,0,0,0,1,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,
|
||||
0,1,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,
|
||||
1,1,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,
|
||||
@@ -275,7 +275,7 @@ zperm(ZVALUE z1, ZVALUE z2, ZVALUE *res)
|
||||
/*
|
||||
* docomb evaluates binomial coefficient when z1 >= 0, z2 >= 0
|
||||
*/
|
||||
static int
|
||||
S_FUNC int
|
||||
docomb(ZVALUE z1, ZVALUE z2, ZVALUE *res)
|
||||
{
|
||||
ZVALUE ans;
|
||||
|
20
zio.c
20
zio.c
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* zio - scanf and printf routines for arbitrary precision integers
|
||||
*
|
||||
* Copyright (C) 1999-2006 David I. Bell
|
||||
* Copyright (C) 1999-2007 David I. Bell
|
||||
*
|
||||
* 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
|
||||
@@ -17,8 +17,8 @@
|
||||
* 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.8 $
|
||||
* @(#) $Id: zio.c,v 29.8 2006/06/01 16:21:37 chongo Exp $
|
||||
* @(#) $Revision: 29.9 $
|
||||
* @(#) $Id: zio.c,v 29.9 2007/02/11 10:19:14 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/zio.c,v $
|
||||
*
|
||||
* Under source code control: 1993/07/30 19:42:48
|
||||
@@ -61,12 +61,12 @@ struct iostate {
|
||||
};
|
||||
|
||||
|
||||
static IOSTATE *oldiostates = NULL; /* list of saved output states */
|
||||
static FILE *outfp = NULL; /* file unit for output */
|
||||
static char *outbuf = NULL; /* current diverted buffer */
|
||||
static BOOL outputisstring = FALSE;
|
||||
static size_t outbufsize;
|
||||
static size_t outbufused;
|
||||
STATIC IOSTATE *oldiostates = NULL; /* list of saved output states */
|
||||
STATIC FILE *outfp = NULL; /* file unit for output */
|
||||
STATIC char *outbuf = NULL; /* current diverted buffer */
|
||||
STATIC BOOL outputisstring = FALSE;
|
||||
STATIC size_t outbufsize;
|
||||
STATIC size_t outbufused;
|
||||
|
||||
|
||||
/*
|
||||
@@ -79,7 +79,7 @@ static size_t outbufused;
|
||||
void
|
||||
zio_init(void)
|
||||
{
|
||||
static int done = 0; /* 1 => routine already called */
|
||||
STATIC int done = 0; /* 1 => routine already called */
|
||||
|
||||
if (!done) {
|
||||
outfp = stdout;
|
||||
|
10
zmath.c
10
zmath.c
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* zmath - extended precision integral arithmetic primitives
|
||||
*
|
||||
* Copyright (C) 1999 David I. Bell and Ernest Bowen
|
||||
* Copyright (C) 1999-2007 David I. Bell and Ernest Bowen
|
||||
*
|
||||
* Primary author: David I. Bell
|
||||
*
|
||||
@@ -19,8 +19,8 @@
|
||||
* 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.3 $
|
||||
* @(#) $Id: zmath.c,v 29.3 2006/12/15 16:20:04 chongo Exp $
|
||||
* @(#) $Revision: 29.4 $
|
||||
* @(#) $Id: zmath.c,v 29.4 2007/02/11 10:19:14 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/zmath.c,v $
|
||||
*
|
||||
* Under source code control: 1990/02/15 01:48:28
|
||||
@@ -228,8 +228,8 @@ char popcnt[256] = {
|
||||
|
||||
|
||||
#ifdef ALLOCTEST
|
||||
static long nalloc = 0;
|
||||
static long nfree = 0;
|
||||
STATIC long nalloc = 0;
|
||||
STATIC long nfree = 0;
|
||||
#endif
|
||||
|
||||
|
||||
|
272
zmath.h
272
zmath.h
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* zmath - declarations for extended precision integer arithmetic
|
||||
*
|
||||
* Copyright (C) 1999-2006 David I. Bell
|
||||
* Copyright (C) 1999-2007 David I. Bell
|
||||
*
|
||||
* 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
|
||||
@@ -17,8 +17,8 @@
|
||||
* 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.18 $
|
||||
* @(#) $Id: zmath.h,v 29.18 2006/12/15 16:20:04 chongo Exp $
|
||||
* @(#) $Revision: 29.19 $
|
||||
* @(#) $Id: zmath.h,v 29.19 2007/02/11 10:19:14 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/zmath.h,v $
|
||||
*
|
||||
* Under source code control: 1993/07/30 19:42:48
|
||||
@@ -39,14 +39,14 @@
|
||||
|
||||
|
||||
#if defined(CALC_SRC) /* if we are building from the calc source tree */
|
||||
# include "win32dll.h"
|
||||
# include "decl.h"
|
||||
# include "alloc.h"
|
||||
# include "endian_calc.h"
|
||||
# include "longbits.h"
|
||||
# include "byteswap.h"
|
||||
# include "have_stdlib.h"
|
||||
#else
|
||||
# include <calc/win32dll.h>
|
||||
# include <calc/decl.h>
|
||||
# include <calc/alloc.h>
|
||||
# include <calc/endian_calc.h>
|
||||
# include <calc/longbits.h>
|
||||
@@ -278,128 +278,128 @@ typedef struct {
|
||||
/*
|
||||
* Function prototypes for integer math routines.
|
||||
*/
|
||||
extern DLL HALF * alloc(LEN len);
|
||||
E_FUNC HALF * alloc(LEN len);
|
||||
#ifdef ALLOCTEST
|
||||
extern DLL void freeh(HALF *);
|
||||
E_FUNC void freeh(HALF *);
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Input, output, and conversion routines.
|
||||
*/
|
||||
extern DLL void zcopy(ZVALUE z, ZVALUE *res);
|
||||
extern DLL void itoz(long i, ZVALUE *res);
|
||||
extern DLL void utoz(FULL i, ZVALUE *res);
|
||||
extern DLL void stoz(SFULL i, ZVALUE *res);
|
||||
extern DLL void str2z(char *s, ZVALUE *res);
|
||||
extern DLL long ztoi(ZVALUE z);
|
||||
extern DLL FULL ztou(ZVALUE z);
|
||||
extern DLL SFULL ztos(ZVALUE z);
|
||||
extern DLL void zprintval(ZVALUE z, long decimals, long width);
|
||||
extern DLL void zprintx(ZVALUE z, long width);
|
||||
extern DLL void zprintb(ZVALUE z, long width);
|
||||
extern DLL void zprinto(ZVALUE z, long width);
|
||||
extern DLL void fitzprint(ZVALUE, long, long);
|
||||
E_FUNC void zcopy(ZVALUE z, ZVALUE *res);
|
||||
E_FUNC void itoz(long i, ZVALUE *res);
|
||||
E_FUNC void utoz(FULL i, ZVALUE *res);
|
||||
E_FUNC void stoz(SFULL i, ZVALUE *res);
|
||||
E_FUNC void str2z(char *s, ZVALUE *res);
|
||||
E_FUNC long ztoi(ZVALUE z);
|
||||
E_FUNC FULL ztou(ZVALUE z);
|
||||
E_FUNC SFULL ztos(ZVALUE z);
|
||||
E_FUNC void zprintval(ZVALUE z, long decimals, long width);
|
||||
E_FUNC void zprintx(ZVALUE z, long width);
|
||||
E_FUNC void zprintb(ZVALUE z, long width);
|
||||
E_FUNC void zprinto(ZVALUE z, long width);
|
||||
E_FUNC void fitzprint(ZVALUE, long, long);
|
||||
|
||||
|
||||
/*
|
||||
* Basic numeric routines.
|
||||
*/
|
||||
extern DLL void zmuli(ZVALUE z, long n, ZVALUE *res);
|
||||
extern DLL long zdivi(ZVALUE z, long n, ZVALUE *res);
|
||||
extern DLL long zmodi(ZVALUE z, long n);
|
||||
extern DLL void zadd(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||
extern DLL void zsub(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||
extern DLL void zmul(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||
extern DLL long zdiv(ZVALUE z1, ZVALUE z2, ZVALUE *res, ZVALUE *rem, long R);
|
||||
extern DLL long zquo(ZVALUE z1, ZVALUE z2, ZVALUE *res, long R);
|
||||
extern DLL long zmod(ZVALUE z1, ZVALUE z2, ZVALUE *rem, long R);
|
||||
extern DLL void zequo(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||
extern DLL BOOL zdivides(ZVALUE z1, ZVALUE z2);
|
||||
extern DLL void zor(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||
extern DLL void zand(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||
extern DLL void zxor(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||
extern DLL void zandnot(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||
extern DLL long zpopcnt(ZVALUE z, int bitval);
|
||||
extern DLL void zshift(ZVALUE z, long n, ZVALUE *res);
|
||||
extern DLL void zsquare(ZVALUE z, ZVALUE *res);
|
||||
extern DLL long zlowbit(ZVALUE z);
|
||||
extern DLL LEN zhighbit(ZVALUE z);
|
||||
extern DLL void zbitvalue(long n, ZVALUE *res);
|
||||
extern DLL BOOL zisset(ZVALUE z, long n);
|
||||
extern DLL BOOL zisonebit(ZVALUE z);
|
||||
extern DLL BOOL zisallbits(ZVALUE z);
|
||||
extern DLL FLAG ztest(ZVALUE z);
|
||||
extern DLL FLAG zrel(ZVALUE z1, ZVALUE z2);
|
||||
extern DLL FLAG zabsrel(ZVALUE z1, ZVALUE z2);
|
||||
extern DLL BOOL zcmp(ZVALUE z1, ZVALUE z2);
|
||||
E_FUNC void zmuli(ZVALUE z, long n, ZVALUE *res);
|
||||
E_FUNC long zdivi(ZVALUE z, long n, ZVALUE *res);
|
||||
E_FUNC long zmodi(ZVALUE z, long n);
|
||||
E_FUNC void zadd(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||
E_FUNC void zsub(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||
E_FUNC void zmul(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||
E_FUNC long zdiv(ZVALUE z1, ZVALUE z2, ZVALUE *res, ZVALUE *rem, long R);
|
||||
E_FUNC long zquo(ZVALUE z1, ZVALUE z2, ZVALUE *res, long R);
|
||||
E_FUNC long zmod(ZVALUE z1, ZVALUE z2, ZVALUE *rem, long R);
|
||||
E_FUNC void zequo(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||
E_FUNC BOOL zdivides(ZVALUE z1, ZVALUE z2);
|
||||
E_FUNC void zor(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||
E_FUNC void zand(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||
E_FUNC void zxor(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||
E_FUNC void zandnot(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||
E_FUNC long zpopcnt(ZVALUE z, int bitval);
|
||||
E_FUNC void zshift(ZVALUE z, long n, ZVALUE *res);
|
||||
E_FUNC void zsquare(ZVALUE z, ZVALUE *res);
|
||||
E_FUNC long zlowbit(ZVALUE z);
|
||||
E_FUNC LEN zhighbit(ZVALUE z);
|
||||
E_FUNC void zbitvalue(long n, ZVALUE *res);
|
||||
E_FUNC BOOL zisset(ZVALUE z, long n);
|
||||
E_FUNC BOOL zisonebit(ZVALUE z);
|
||||
E_FUNC BOOL zisallbits(ZVALUE z);
|
||||
E_FUNC FLAG ztest(ZVALUE z);
|
||||
E_FUNC FLAG zrel(ZVALUE z1, ZVALUE z2);
|
||||
E_FUNC FLAG zabsrel(ZVALUE z1, ZVALUE z2);
|
||||
E_FUNC BOOL zcmp(ZVALUE z1, ZVALUE z2);
|
||||
|
||||
|
||||
/*
|
||||
* More complicated numeric functions.
|
||||
*/
|
||||
extern DLL FULL uugcd(FULL i1, FULL i2);
|
||||
extern DLL long iigcd(long i1, long i2);
|
||||
extern DLL void zgcd(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||
extern DLL void zlcm(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||
extern DLL void zreduce(ZVALUE z1, ZVALUE z2, ZVALUE *z1res, ZVALUE *z2res);
|
||||
extern DLL void zfact(ZVALUE z, ZVALUE *dest);
|
||||
extern DLL void zperm(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||
extern DLL int zcomb(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||
extern DLL FLAG zjacobi(ZVALUE z1, ZVALUE z2);
|
||||
extern DLL void zfib(ZVALUE z, ZVALUE *res);
|
||||
extern DLL void zpowi(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||
extern DLL void ztenpow(long power, ZVALUE *res);
|
||||
extern DLL void zpowermod(ZVALUE z1, ZVALUE z2, ZVALUE z3, ZVALUE *res);
|
||||
extern DLL BOOL zmodinv(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||
extern DLL BOOL zrelprime(ZVALUE z1, ZVALUE z2);
|
||||
extern DLL long zlog(ZVALUE z1, ZVALUE z2);
|
||||
extern DLL long zlog10(ZVALUE z, BOOL *was_10_power);
|
||||
extern DLL long zdivcount(ZVALUE z1, ZVALUE z2);
|
||||
extern DLL long zfacrem(ZVALUE z1, ZVALUE z2, ZVALUE *rem);
|
||||
extern DLL long zgcdrem(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||
extern DLL long zdigits(ZVALUE z1);
|
||||
extern DLL long zdigit(ZVALUE z1, long n);
|
||||
extern DLL FLAG zsqrt(ZVALUE z1, ZVALUE *dest, long R);
|
||||
extern DLL void zroot(ZVALUE z1, ZVALUE z2, ZVALUE *dest);
|
||||
extern DLL BOOL zissquare(ZVALUE z);
|
||||
extern DLL void zhnrmod(ZVALUE v, ZVALUE h, ZVALUE zn, ZVALUE zr, ZVALUE *res);
|
||||
E_FUNC FULL uugcd(FULL i1, FULL i2);
|
||||
E_FUNC long iigcd(long i1, long i2);
|
||||
E_FUNC void zgcd(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||
E_FUNC void zlcm(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||
E_FUNC void zreduce(ZVALUE z1, ZVALUE z2, ZVALUE *z1res, ZVALUE *z2res);
|
||||
E_FUNC void zfact(ZVALUE z, ZVALUE *dest);
|
||||
E_FUNC void zperm(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||
E_FUNC int zcomb(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||
E_FUNC FLAG zjacobi(ZVALUE z1, ZVALUE z2);
|
||||
E_FUNC void zfib(ZVALUE z, ZVALUE *res);
|
||||
E_FUNC void zpowi(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||
E_FUNC void ztenpow(long power, ZVALUE *res);
|
||||
E_FUNC void zpowermod(ZVALUE z1, ZVALUE z2, ZVALUE z3, ZVALUE *res);
|
||||
E_FUNC BOOL zmodinv(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||
E_FUNC BOOL zrelprime(ZVALUE z1, ZVALUE z2);
|
||||
E_FUNC long zlog(ZVALUE z1, ZVALUE z2);
|
||||
E_FUNC long zlog10(ZVALUE z, BOOL *was_10_power);
|
||||
E_FUNC long zdivcount(ZVALUE z1, ZVALUE z2);
|
||||
E_FUNC long zfacrem(ZVALUE z1, ZVALUE z2, ZVALUE *rem);
|
||||
E_FUNC long zgcdrem(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||
E_FUNC long zdigits(ZVALUE z1);
|
||||
E_FUNC long zdigit(ZVALUE z1, long n);
|
||||
E_FUNC FLAG zsqrt(ZVALUE z1, ZVALUE *dest, long R);
|
||||
E_FUNC void zroot(ZVALUE z1, ZVALUE z2, ZVALUE *dest);
|
||||
E_FUNC BOOL zissquare(ZVALUE z);
|
||||
E_FUNC void zhnrmod(ZVALUE v, ZVALUE h, ZVALUE zn, ZVALUE zr, ZVALUE *res);
|
||||
|
||||
|
||||
/*
|
||||
* Prime related functions.
|
||||
*/
|
||||
extern DLL FLAG zisprime(ZVALUE z);
|
||||
extern DLL FULL znprime(ZVALUE z);
|
||||
extern DLL FULL next_prime(FULL v);
|
||||
extern DLL FULL zpprime(ZVALUE z);
|
||||
extern DLL void zpfact(ZVALUE z, ZVALUE *dest);
|
||||
extern DLL BOOL zprimetest(ZVALUE z, long count, ZVALUE skip);
|
||||
extern DLL BOOL zredcprimetest(ZVALUE z, long count, ZVALUE skip);
|
||||
extern DLL BOOL znextcand(ZVALUE z1, long count, ZVALUE skip, ZVALUE res, ZVALUE mod, ZVALUE *cand);
|
||||
extern DLL BOOL zprevcand(ZVALUE z1, long count, ZVALUE skip, ZVALUE res, ZVALUE mod, ZVALUE *cand);
|
||||
extern DLL FULL zlowfactor(ZVALUE z, long count);
|
||||
extern DLL FLAG zfactor(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||
extern DLL long zpix(ZVALUE z1);
|
||||
extern DLL void zlcmfact(ZVALUE z, ZVALUE *dest);
|
||||
E_FUNC FLAG zisprime(ZVALUE z);
|
||||
E_FUNC FULL znprime(ZVALUE z);
|
||||
E_FUNC FULL next_prime(FULL v);
|
||||
E_FUNC FULL zpprime(ZVALUE z);
|
||||
E_FUNC void zpfact(ZVALUE z, ZVALUE *dest);
|
||||
E_FUNC BOOL zprimetest(ZVALUE z, long count, ZVALUE skip);
|
||||
E_FUNC BOOL zredcprimetest(ZVALUE z, long count, ZVALUE skip);
|
||||
E_FUNC BOOL znextcand(ZVALUE z1, long count, ZVALUE skip, ZVALUE res, ZVALUE mod, ZVALUE *cand);
|
||||
E_FUNC BOOL zprevcand(ZVALUE z1, long count, ZVALUE skip, ZVALUE res, ZVALUE mod, ZVALUE *cand);
|
||||
E_FUNC FULL zlowfactor(ZVALUE z, long count);
|
||||
E_FUNC FLAG zfactor(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||
E_FUNC long zpix(ZVALUE z1);
|
||||
E_FUNC void zlcmfact(ZVALUE z, ZVALUE *dest);
|
||||
|
||||
|
||||
/*
|
||||
* Misc misc functions. :-)
|
||||
*/
|
||||
extern DLL void zsquaremod(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||
extern DLL void zminmod(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||
extern DLL BOOL zcmpmod(ZVALUE z1, ZVALUE z2, ZVALUE z3);
|
||||
extern DLL void zio_init(void);
|
||||
E_FUNC void zsquaremod(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||
E_FUNC void zminmod(ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||
E_FUNC BOOL zcmpmod(ZVALUE z1, ZVALUE z2, ZVALUE z3);
|
||||
E_FUNC void zio_init(void);
|
||||
|
||||
|
||||
/*
|
||||
* These functions are for internal use only.
|
||||
*/
|
||||
extern DLL void ztrim(ZVALUE *z);
|
||||
extern DLL void zshiftr(ZVALUE z, long n);
|
||||
extern DLL void zshiftl(ZVALUE z, long n);
|
||||
extern DLL HALF *zalloctemp(LEN len);
|
||||
E_FUNC void ztrim(ZVALUE *z);
|
||||
E_FUNC void zshiftr(ZVALUE z, long n);
|
||||
E_FUNC void zshiftl(ZVALUE z, long n);
|
||||
E_FUNC HALF *zalloctemp(LEN len);
|
||||
|
||||
|
||||
/*
|
||||
@@ -416,13 +416,13 @@ typedef struct {
|
||||
ZVALUE one; /* REDC format for the number 1 */
|
||||
} REDC;
|
||||
|
||||
extern DLL REDC *zredcalloc(ZVALUE z1);
|
||||
extern DLL void zredcfree(REDC *rp);
|
||||
extern DLL void zredcencode(REDC *rp, ZVALUE z1, ZVALUE *res);
|
||||
extern DLL void zredcdecode(REDC *rp, ZVALUE z1, ZVALUE *res);
|
||||
extern DLL void zredcmul(REDC *rp, ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||
extern DLL void zredcsquare(REDC *rp, ZVALUE z1, ZVALUE *res);
|
||||
extern DLL void zredcpower(REDC *rp, ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||
E_FUNC REDC *zredcalloc(ZVALUE z1);
|
||||
E_FUNC void zredcfree(REDC *rp);
|
||||
E_FUNC void zredcencode(REDC *rp, ZVALUE z1, ZVALUE *res);
|
||||
E_FUNC void zredcdecode(REDC *rp, ZVALUE z1, ZVALUE *res);
|
||||
E_FUNC void zredcmul(REDC *rp, ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||
E_FUNC void zredcsquare(REDC *rp, ZVALUE z1, ZVALUE *res);
|
||||
E_FUNC void zredcpower(REDC *rp, ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||
|
||||
|
||||
/*
|
||||
@@ -587,63 +587,63 @@ extern DLL void zredcpower(REDC *rp, ZVALUE z1, ZVALUE z2, ZVALUE *res);
|
||||
/*
|
||||
* Output routines for either FILE handles or strings.
|
||||
*/
|
||||
extern DLL void math_chr(int ch);
|
||||
extern DLL void math_str(char *str);
|
||||
extern DLL void math_fill(char *str, long width);
|
||||
extern DLL void math_flush(void);
|
||||
extern DLL void math_divertio(void);
|
||||
extern DLL void math_cleardiversions(void);
|
||||
extern DLL char *math_getdivertedio(void);
|
||||
extern DLL int math_setmode(int mode);
|
||||
extern DLL int math_setmode2(int mode);
|
||||
extern DLL LEN math_setdigits(LEN digits);
|
||||
extern DLL void math_fmt(char *, ...);
|
||||
E_FUNC void math_chr(int ch);
|
||||
E_FUNC void math_str(char *str);
|
||||
E_FUNC void math_fill(char *str, long width);
|
||||
E_FUNC void math_flush(void);
|
||||
E_FUNC void math_divertio(void);
|
||||
E_FUNC void math_cleardiversions(void);
|
||||
E_FUNC char *math_getdivertedio(void);
|
||||
E_FUNC int math_setmode(int mode);
|
||||
E_FUNC int math_setmode2(int mode);
|
||||
E_FUNC LEN math_setdigits(LEN digits);
|
||||
E_FUNC void math_fmt(char *, ...);
|
||||
|
||||
|
||||
/*
|
||||
* The error routine.
|
||||
*/
|
||||
extern DLL void math_error(char *, ...);
|
||||
E_FUNC void math_error(char *, ...);
|
||||
|
||||
|
||||
/*
|
||||
* external swap functions
|
||||
*/
|
||||
extern DLL HALF *swap_b8_in_HALFs(HALF *dest, HALF *src, LEN len);
|
||||
extern DLL ZVALUE *swap_b8_in_ZVALUE(ZVALUE *dest, ZVALUE *src, BOOL all);
|
||||
extern DLL HALF *swap_b16_in_HALFs(HALF *dest, HALF *src, LEN len);
|
||||
extern DLL ZVALUE *swap_b16_in_ZVALUE(ZVALUE *dest, ZVALUE *src, BOOL all);
|
||||
extern DLL ZVALUE *swap_HALF_in_ZVALUE(ZVALUE *dest, ZVALUE *src, BOOL all);
|
||||
E_FUNC HALF *swap_b8_in_HALFs(HALF *dest, HALF *src, LEN len);
|
||||
E_FUNC ZVALUE *swap_b8_in_ZVALUE(ZVALUE *dest, ZVALUE *src, BOOL all);
|
||||
E_FUNC HALF *swap_b16_in_HALFs(HALF *dest, HALF *src, LEN len);
|
||||
E_FUNC ZVALUE *swap_b16_in_ZVALUE(ZVALUE *dest, ZVALUE *src, BOOL all);
|
||||
E_FUNC ZVALUE *swap_HALF_in_ZVALUE(ZVALUE *dest, ZVALUE *src, BOOL all);
|
||||
|
||||
|
||||
/*
|
||||
* constants used often by the arithmetic routines
|
||||
*/
|
||||
extern HALF _zeroval_[], _oneval_[], _twoval_[], _threeval_[], _fourval_[];
|
||||
extern HALF _fiveval_[], _sixval_[], _sevenval_[], _eightval_[], _nineval_[];
|
||||
extern HALF _tenval_[], _elevenval_[], _twelveval_[], _thirteenval_[];
|
||||
extern HALF _fourteenval_[], _fifteenval_[];
|
||||
extern HALF _sqbaseval_[];
|
||||
extern HALF _fourthbaseval_[];
|
||||
EXTERN HALF _zeroval_[], _oneval_[], _twoval_[], _threeval_[], _fourval_[];
|
||||
EXTERN HALF _fiveval_[], _sixval_[], _sevenval_[], _eightval_[], _nineval_[];
|
||||
EXTERN HALF _tenval_[], _elevenval_[], _twelveval_[], _thirteenval_[];
|
||||
EXTERN HALF _fourteenval_[], _fifteenval_[];
|
||||
EXTERN HALF _sqbaseval_[];
|
||||
EXTERN HALF _fourthbaseval_[];
|
||||
|
||||
extern ZVALUE zconst[]; /* ZVALUE integers from 0 thru 15 */
|
||||
EXTERN ZVALUE zconst[]; /* ZVALUE integers from 0 thru 15 */
|
||||
|
||||
extern ZVALUE _zero_, _one_, _two_, _ten_, _neg_one_;
|
||||
extern ZVALUE _sqbase_, _pow4base_, _pow8base_;
|
||||
EXTERN ZVALUE _zero_, _one_, _two_, _ten_, _neg_one_;
|
||||
EXTERN ZVALUE _sqbase_, _pow4base_, _pow8base_;
|
||||
|
||||
extern ZVALUE _b32_, _b64_;
|
||||
EXTERN ZVALUE _b32_, _b64_;
|
||||
|
||||
extern DLL BOOL _math_abort_; /* nonzero to abort calculations */
|
||||
extern ZVALUE _tenpowers_[]; /* table of 10^2^n */
|
||||
EXTERN BOOL _math_abort_; /* nonzero to abort calculations */
|
||||
EXTERN ZVALUE _tenpowers_[]; /* table of 10^2^n */
|
||||
|
||||
/*
|
||||
* Bit fiddeling functions and types
|
||||
*/
|
||||
extern HALF bitmask[]; /* bit rotation, norm 0 */
|
||||
extern HALF lowhalf[]; /* bit masks from low end of HALF */
|
||||
extern HALF rlowhalf[]; /* reversed bit masks from low end of HALF */
|
||||
extern HALF highhalf[]; /* bit masks from high end of HALF */
|
||||
extern HALF rhighhalf[]; /* reversed bit masks from high end of HALF */
|
||||
EXTERN HALF bitmask[]; /* bit rotation, norm 0 */
|
||||
EXTERN HALF lowhalf[]; /* bit masks from low end of HALF */
|
||||
EXTERN HALF rlowhalf[]; /* reversed bit masks from low end of HALF */
|
||||
EXTERN HALF highhalf[]; /* bit masks from high end of HALF */
|
||||
EXTERN HALF rhighhalf[]; /* reversed bit masks from high end of HALF */
|
||||
#define HAVE_REVERSED_MASKS /* allows old code to know libcalc.a has them */
|
||||
|
||||
|
||||
|
24
zmod.c
24
zmod.c
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* zmod - modulo arithmetic routines
|
||||
*
|
||||
* Copyright (C) 1999 David I. Bell, Landon Curt Noll and Ernest Bowen
|
||||
* Copyright (C) 1999-2007 David I. Bell, Landon Curt Noll and Ernest Bowen
|
||||
*
|
||||
* Primary author: David I. Bell
|
||||
*
|
||||
@@ -19,8 +19,8 @@
|
||||
* 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: zmod.c,v 29.4 2006/06/11 00:08:56 chongo Exp $
|
||||
* @(#) $Revision: 29.5 $
|
||||
* @(#) $Id: zmod.c,v 29.5 2007/02/11 10:19:14 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/zmod.c,v $
|
||||
*
|
||||
* Under source code control: 1991/05/22 23:03:55
|
||||
@@ -47,15 +47,15 @@
|
||||
#define POWBITS 4 /* bits for power chunks (must divide BASEB) */
|
||||
#define POWNUMS (1<<POWBITS) /* number of powers needed in table */
|
||||
|
||||
static void zmod5(ZVALUE *zp);
|
||||
static void zmod6(ZVALUE z1, ZVALUE *res);
|
||||
static void zredcmodinv(ZVALUE z1, ZVALUE *res);
|
||||
S_FUNC void zmod5(ZVALUE *zp);
|
||||
S_FUNC void zmod6(ZVALUE z1, ZVALUE *res);
|
||||
S_FUNC void zredcmodinv(ZVALUE z1, ZVALUE *res);
|
||||
|
||||
static REDC *powermodredc = NULL; /* REDC info for raising to power */
|
||||
STATIC REDC *powermodredc = NULL; /* REDC info for raising to power */
|
||||
|
||||
BOOL havelastmod = FALSE;
|
||||
static ZVALUE lastmod[1];
|
||||
static ZVALUE lastmodinv[1];
|
||||
STATIC ZVALUE lastmod[1];
|
||||
STATIC ZVALUE lastmodinv[1];
|
||||
|
||||
|
||||
/*
|
||||
@@ -341,7 +341,7 @@ zcmpmod(ZVALUE z1, ZVALUE z2, ZVALUE z3)
|
||||
* exceed twice that of the modulus stored at lastmod, to evaluate and store
|
||||
* at that address the value of the integer modulo the modulus.
|
||||
*/
|
||||
static void
|
||||
S_FUNC void
|
||||
zmod5(ZVALUE *zp)
|
||||
{
|
||||
LEN len, modlen, j;
|
||||
@@ -422,7 +422,7 @@ zmod5(ZVALUE *zp)
|
||||
zp->len = 1;
|
||||
}
|
||||
|
||||
static void
|
||||
S_FUNC void
|
||||
zmod6(ZVALUE z1, ZVALUE *res)
|
||||
{
|
||||
LEN len, modlen, len0;
|
||||
@@ -799,7 +799,7 @@ zpowermod(ZVALUE z1, ZVALUE z2, ZVALUE z3, ZVALUE *res)
|
||||
/*
|
||||
* Given a positive odd N-word integer z, evaluate minv(-z, BASEB^N)
|
||||
*/
|
||||
static void
|
||||
S_FUNC void
|
||||
zredcmodinv(ZVALUE z, ZVALUE *res)
|
||||
{
|
||||
ZVALUE tmp;
|
||||
|
20
zmul.c
20
zmul.c
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* zmul - faster than usual multiplying and squaring routines
|
||||
*
|
||||
* Copyright (C) 1999 David I. Bell
|
||||
* Copyright (C) 1999-2007 David I. Bell
|
||||
*
|
||||
* 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
|
||||
@@ -17,8 +17,8 @@
|
||||
* 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: zmul.c,v 29.2 2000/06/07 14:02:13 chongo Exp $
|
||||
* @(#) $Revision: 29.3 $
|
||||
* @(#) $Id: zmul.c,v 29.3 2007/02/11 10:19:14 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/zmul.c,v $
|
||||
*
|
||||
* Under source code control: 1991/01/09 20:01:31
|
||||
@@ -41,10 +41,10 @@
|
||||
#include "zmath.h"
|
||||
|
||||
|
||||
static HALF *tempbuf; /* temporary buffer for multiply and square */
|
||||
STATIC HALF *tempbuf; /* temporary buffer for multiply and square */
|
||||
|
||||
static LEN domul(HALF *v1, LEN size1, HALF *v2, LEN size2, HALF *ans);
|
||||
static LEN dosquare(HALF *vp, LEN size, HALF *ans);
|
||||
S_FUNC LEN domul(HALF *v1, LEN size1, HALF *v2, LEN size2, HALF *ans);
|
||||
S_FUNC LEN dosquare(HALF *vp, LEN size, HALF *ans);
|
||||
|
||||
|
||||
/*
|
||||
@@ -116,7 +116,7 @@ zmul(ZVALUE z1, ZVALUE z2, ZVALUE *res)
|
||||
* size2 size of second number
|
||||
* ans location for result
|
||||
*/
|
||||
static LEN
|
||||
S_FUNC LEN
|
||||
domul(HALF *v1, LEN size1, HALF *v2, LEN size2, HALF *ans)
|
||||
{
|
||||
LEN shift; /* amount numbers are shifted by */
|
||||
@@ -705,7 +705,7 @@ zsquare(ZVALUE z, ZVALUE *res)
|
||||
* size length of value to square
|
||||
* ans location for result
|
||||
*/
|
||||
static LEN
|
||||
S_FUNC LEN
|
||||
dosquare(HALF *vp, LEN size, HALF *ans)
|
||||
{
|
||||
LEN shift; /* amount numbers are shifted by */
|
||||
@@ -1052,8 +1052,8 @@ HALF *
|
||||
zalloctemp(LEN len)
|
||||
{
|
||||
HALF *hp;
|
||||
static LEN buflen; /* current length of temp buffer */
|
||||
static HALF *bufptr; /* pointer to current temp buffer */
|
||||
STATIC LEN buflen; /* current length of temp buffer */
|
||||
STATIC HALF *bufptr; /* pointer to current temp buffer */
|
||||
|
||||
if (len <= buflen)
|
||||
return bufptr;
|
||||
|
24
zprime.c
24
zprime.c
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* zprime - rapid small prime routines
|
||||
*
|
||||
* Copyright (C) 1999 Landon Curt Noll
|
||||
* Copyright (C) 1999-2007 Landon Curt Noll
|
||||
*
|
||||
* Calc is open software; you can redistribute it and/or modify it under
|
||||
* the terms of the version 2.1 of the GNU Lesser General Public License
|
||||
@@ -17,8 +17,8 @@
|
||||
* 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.3 $
|
||||
* @(#) $Id: zprime.c,v 29.3 2006/05/20 08:43:55 chongo Exp $
|
||||
* @(#) $Revision: 29.4 $
|
||||
* @(#) $Id: zprime.c,v 29.4 2007/02/11 10:19:14 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/zprime.c,v $
|
||||
*
|
||||
* Under source code control: 1994/05/29 04:34:36
|
||||
@@ -49,7 +49,7 @@
|
||||
/*
|
||||
* product of primes that fit into a long
|
||||
*/
|
||||
static CONST FULL pfact_tbl[MAX_PFACT_VAL+1] = {
|
||||
STATIC CONST FULL pfact_tbl[MAX_PFACT_VAL+1] = {
|
||||
1, 1, 2, 6, 6, 30, 30, 210, 210, 210, 210, 2310, 2310, 30030, 30030,
|
||||
30030, 30030, 510510, 510510, 9699690, 9699690, 9699690, 9699690,
|
||||
223092870, 223092870, 223092870, 223092870, 223092870, 223092870
|
||||
@@ -70,7 +70,7 @@ static CONST FULL pfact_tbl[MAX_PFACT_VAL+1] = {
|
||||
* topbit[0] == 0 by convention
|
||||
* topbit[x] gives the highest 1 bit of x
|
||||
*/
|
||||
static CONST unsigned char topbit[256] = {
|
||||
STATIC CONST unsigned char topbit[256] = {
|
||||
0, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3,
|
||||
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
|
||||
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
|
||||
@@ -96,7 +96,7 @@ static CONST unsigned char topbit[256] = {
|
||||
*
|
||||
* We have enough table entries for a FULL that is 64 bits long.
|
||||
*/
|
||||
static CONST FULL isqrt_pow2[64] = {
|
||||
STATIC CONST FULL isqrt_pow2[64] = {
|
||||
1, 1, 2, 2, 4, 5, 8, 11, /* 0 .. 7 */
|
||||
16, 22, 32, 45, 64, 90, 128, 181, /* 8 .. 15 */
|
||||
256, 362, 512, 724, 1024, 1448, 2048, 2896, /* 16 .. 23 */
|
||||
@@ -114,9 +114,9 @@ static CONST FULL isqrt_pow2[64] = {
|
||||
/*
|
||||
* static functions
|
||||
*/
|
||||
static FULL fsqrt(FULL v); /* quick square root of v */
|
||||
static long pix(FULL x); /* pi of x */
|
||||
static FULL small_factor(ZVALUE n, FULL limit); /* factor or 0 */
|
||||
S_FUNC FULL fsqrt(FULL v); /* quick square root of v */
|
||||
S_FUNC long pix(FULL x); /* pi of x */
|
||||
S_FUNC FULL small_factor(ZVALUE n, FULL limit); /* factor or 0 */
|
||||
|
||||
|
||||
/*
|
||||
@@ -434,7 +434,7 @@ zpix(ZVALUE z)
|
||||
* -1 error
|
||||
* >=0 number of primes <= x
|
||||
*/
|
||||
static long
|
||||
S_FUNC long
|
||||
pix(FULL x)
|
||||
{
|
||||
long count; /* pi(x) */
|
||||
@@ -588,7 +588,7 @@ zfactor(ZVALUE n, ZVALUE zlimit, ZVALUE *res)
|
||||
* 0 no prime <= the limit was found
|
||||
* != 0 the smallest prime factor
|
||||
*/
|
||||
static FULL
|
||||
S_FUNC FULL
|
||||
small_factor(ZVALUE z, FULL limit)
|
||||
{
|
||||
FULL top; /* current max factor level */
|
||||
@@ -1588,7 +1588,7 @@ zlcmfact(ZVALUE z, ZVALUE *dest)
|
||||
* given:
|
||||
* x compute the integer square root of x
|
||||
*/
|
||||
static FULL
|
||||
S_FUNC FULL
|
||||
fsqrt(FULL x)
|
||||
{
|
||||
FULL y; /* (FULL)temporary value */
|
||||
|
36
zrand.c
36
zrand.c
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* zrand - subtractive 100 shuffle generator
|
||||
*
|
||||
* Copyright (C) 1999,2004 Landon Curt Noll
|
||||
* Copyright (C) 1999-2007 Landon Curt Noll
|
||||
*
|
||||
* Calc is open software; you can redistribute it and/or modify it under
|
||||
* the terms of the version 2.1 of the GNU Lesser General Public License
|
||||
@@ -17,8 +17,8 @@
|
||||
* 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.9 $
|
||||
* @(#) $Id: zrand.c,v 29.9 2004/03/31 04:58:40 chongo Exp $
|
||||
* @(#) $Revision: 29.10 $
|
||||
* @(#) $Id: zrand.c,v 29.10 2007/02/11 10:19:14 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/zrand.c,v $
|
||||
*
|
||||
* Under source code control: 1995/01/07 09:45:25
|
||||
@@ -366,7 +366,7 @@
|
||||
* This is the state of the s100 generator after initialization, or srand(0),
|
||||
* or srand(0) is called. The init_s100 value is never changed, only copied.
|
||||
*/
|
||||
static CONST RAND init_s100 = {
|
||||
STATIC CONST RAND init_s100 = {
|
||||
1, /* seeded */
|
||||
0, /* no buffered bits */
|
||||
#if FULL_BITS == SBITS /* buffer */
|
||||
@@ -759,7 +759,7 @@ static CONST RAND init_s100 = {
|
||||
*
|
||||
* This array is never changed, only copied.
|
||||
*/
|
||||
static CONST FULL def_subtract[SCNT] = {
|
||||
STATIC CONST FULL def_subtract[SCNT] = {
|
||||
#if FULL_BITS == SBITS
|
||||
(FULL)U(0xc8c0370c7db7dc19), (FULL)U(0x738e33b940a06fbb),
|
||||
(FULL)U(0x481abb76a859ed2b), (FULL)U(0x74106bb39ccdccb5),
|
||||
@@ -877,32 +877,32 @@ static CONST FULL def_subtract[SCNT] = {
|
||||
* These constants are used in the randreseed64(). See below.
|
||||
*/
|
||||
#if FULL_BITS == SBITS
|
||||
static CONST HALF a_vec[SHALFS] = { (HALF)0x73c0ccbd, (HALF)0x57aa0ff4 };
|
||||
static CONST HALF c_vec[SHALFS] = { (HALF)0x18e09865, (HALF)0x12ea8057 };
|
||||
STATIC CONST HALF a_vec[SHALFS] = { (HALF)0x73c0ccbd, (HALF)0x57aa0ff4 };
|
||||
STATIC CONST HALF c_vec[SHALFS] = { (HALF)0x18e09865, (HALF)0x12ea8057 };
|
||||
#elif 2*FULL_BITS == SBITS
|
||||
static CONST HALF a_vec[SHALFS] = { (HALF)0xccbd, (HALF)0x73c0,
|
||||
STATIC CONST HALF a_vec[SHALFS] = { (HALF)0xccbd, (HALF)0x73c0,
|
||||
(HALF)0x0ff4, (HALF)0x57aa };
|
||||
static CONST HALF c_vec[SHALFS] = { (HALF)0x9865, (HALF)0x18e0,
|
||||
STATIC CONST HALF c_vec[SHALFS] = { (HALF)0x9865, (HALF)0x18e0,
|
||||
(HALF)0x8057, (HALF)0x12ea };
|
||||
#else
|
||||
/\../\ FULL_BITS must be 32 or 64 /\../\ !!!
|
||||
#endif
|
||||
static CONST ZVALUE a_val = {(HALF *)a_vec, SHALFS, 0};
|
||||
static CONST ZVALUE c_val = {(HALF *)c_vec, SHALFS, 0};
|
||||
STATIC CONST ZVALUE a_val = {(HALF *)a_vec, SHALFS, 0};
|
||||
STATIC CONST ZVALUE c_val = {(HALF *)c_vec, SHALFS, 0};
|
||||
|
||||
|
||||
/*
|
||||
* current s100 generator state
|
||||
*/
|
||||
static RAND s100;
|
||||
STATIC RAND s100;
|
||||
|
||||
|
||||
/*
|
||||
* declare static functions
|
||||
*/
|
||||
static void randreseed64(ZVALUE seed, ZVALUE *res);
|
||||
static int slotcp(BITSTR *bitstr, FULL *src, int count);
|
||||
static void slotcp64(BITSTR *bitstr, FULL *src);
|
||||
S_FUNC void randreseed64(ZVALUE seed, ZVALUE *res);
|
||||
S_FUNC int slotcp(BITSTR *bitstr, FULL *src, int count);
|
||||
S_FUNC void slotcp64(BITSTR *bitstr, FULL *src);
|
||||
|
||||
|
||||
/*
|
||||
@@ -1034,7 +1034,7 @@ static void slotcp64(BITSTR *bitstr, FULL *src);
|
||||
* NOTE: This is NOT a pseudo random number generator. This function is
|
||||
* intended to be used internally by ss100rand() and sshufrand().
|
||||
*/
|
||||
static void
|
||||
S_FUNC void
|
||||
randreseed64(ZVALUE seed, ZVALUE *res)
|
||||
{
|
||||
ZVALUE t; /* temp value */
|
||||
@@ -1440,7 +1440,7 @@ zsetrand(CONST RAND *state)
|
||||
* returns:
|
||||
* number of bits transfered
|
||||
*/
|
||||
static int
|
||||
S_FUNC int
|
||||
slotcp(BITSTR *bitstr, FULL *src, int count)
|
||||
{
|
||||
HALF *dh; /* most significant HALF in dest */
|
||||
@@ -1615,7 +1615,7 @@ slotcp(BITSTR *bitstr, FULL *src, int count)
|
||||
* returns:
|
||||
* number of bits transfered
|
||||
*/
|
||||
static void
|
||||
S_FUNC void
|
||||
slotcp64(BITSTR *bitstr, FULL *src)
|
||||
{
|
||||
HALF *dh = bitstr->loc; /* most significant HALF in dest */
|
||||
|
26
zrand.h
26
zrand.h
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* zrand - subtractive 100 shuffle generator
|
||||
*
|
||||
* Copyright (C) 1999,2004 Landon Curt Noll
|
||||
* Copyright (C) 1999-2007 Landon Curt Noll
|
||||
*
|
||||
* Calc is open software; you can redistribute it and/or modify it under
|
||||
* the terms of the version 2.1 of the GNU Lesser General Public License
|
||||
@@ -17,8 +17,8 @@
|
||||
* 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.7 $
|
||||
* @(#) $Id: zrand.h,v 29.7 2004/03/31 04:58:40 chongo Exp $
|
||||
* @(#) $Revision: 29.8 $
|
||||
* @(#) $Id: zrand.h,v 29.8 2007/02/11 10:19:14 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/zrand.h,v $
|
||||
*
|
||||
* Under source code control: 1995/01/07 09:45:26
|
||||
@@ -210,16 +210,16 @@ struct rand {
|
||||
/*
|
||||
* s100 generator function declarations
|
||||
*/
|
||||
extern RAND *zsrand(CONST ZVALUE *seed, CONST MATRIX *pmat100);
|
||||
extern RAND *zsetrand(CONST RAND *state);
|
||||
extern void zrandskip(long count);
|
||||
extern void zrand(long count, ZVALUE *res);
|
||||
extern void zrandrange(CONST ZVALUE low, CONST ZVALUE beyond, ZVALUE *res);
|
||||
extern long irand(long s);
|
||||
extern RAND *randcopy(CONST RAND *rand);
|
||||
extern void randfree(RAND *rand);
|
||||
extern BOOL randcmp(CONST RAND *s1, CONST RAND *s2);
|
||||
extern void randprint(CONST RAND *state, int flags);
|
||||
E_FUNC RAND *zsrand(CONST ZVALUE *seed, CONST MATRIX *pmat100);
|
||||
E_FUNC RAND *zsetrand(CONST RAND *state);
|
||||
E_FUNC void zrandskip(long count);
|
||||
E_FUNC void zrand(long count, ZVALUE *res);
|
||||
E_FUNC void zrandrange(CONST ZVALUE low, CONST ZVALUE beyond, ZVALUE *res);
|
||||
E_FUNC long irand(long s);
|
||||
E_FUNC RAND *randcopy(CONST RAND *rand);
|
||||
E_FUNC void randfree(RAND *rand);
|
||||
E_FUNC BOOL randcmp(CONST RAND *s1, CONST RAND *s2);
|
||||
E_FUNC void randprint(CONST RAND *state, int flags);
|
||||
|
||||
|
||||
#endif /* !__ZRAND_H__ */
|
||||
|
190
zrandom.c
190
zrandom.c
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* zrandom - Blum-Blum-Shub pseudo-random generator
|
||||
*
|
||||
* Copyright (C) 1999,2004 Landon Curt Noll
|
||||
* Copyright (C) 1999-2007 Landon Curt Noll
|
||||
*
|
||||
* Calc is open software; you can redistribute it and/or modify it under
|
||||
* the terms of the version 2.1 of the GNU Lesser General Public License
|
||||
@@ -17,8 +17,8 @@
|
||||
* 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.8 $
|
||||
* @(#) $Id: zrandom.c,v 29.8 2004/03/31 04:58:40 chongo Exp $
|
||||
* @(#) $Revision: 29.9 $
|
||||
* @(#) $Id: zrandom.c,v 29.9 2007/02/11 10:19:14 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/zrandom.c,v $
|
||||
*
|
||||
* Under source code control: 1997/02/15 04:01:56
|
||||
@@ -1090,7 +1090,7 @@
|
||||
/*
|
||||
* current Blum generator state
|
||||
*/
|
||||
static RANDOM blum;
|
||||
STATIC RANDOM blum;
|
||||
|
||||
|
||||
/*
|
||||
@@ -1101,25 +1101,25 @@ static RANDOM blum;
|
||||
* The z_rdefault ZVALUE is the 'r' (quadratic residue) of init_blum.
|
||||
*/
|
||||
#if FULL_BITS == 64
|
||||
static CONST HALF h_ndefvec[] = {
|
||||
STATIC CONST HALF h_ndefvec[] = {
|
||||
(HALF)0xd6be18d9, (HALF)0xba55a689, (HALF)0x4a9027d9, (HALF)0x84f34b64,
|
||||
(HALF)0xd0e8d302, (HALF)0x3d78613e, (HALF)0x56af9e37, (HALF)0x2ac19031,
|
||||
(HALF)0xf
|
||||
};
|
||||
static CONST HALF h_rdefvec[] = {
|
||||
STATIC CONST HALF h_rdefvec[] = {
|
||||
(HALF)0xd3e7b11e, (HALF)0x0f23fd7e, (HALF)0xa62546c9, (HALF)0x06c73ca5,
|
||||
(HALF)0x627d6265, (HALF)0x2f1e93a8, (HALF)0xff4b074e, (HALF)0x48b6d882,
|
||||
(HALF)0x7
|
||||
};
|
||||
#elif 2*FULL_BITS == 64
|
||||
static CONST HALF h_ndefvec[] = {
|
||||
STATIC CONST HALF h_ndefvec[] = {
|
||||
(HALF)0x18d9, (HALF)0xd6be, (HALF)0xa689, (HALF)0xba55,
|
||||
(HALF)0x27d9, (HALF)0x4a90, (HALF)0x4b64, (HALF)0x84f3,
|
||||
(HALF)0xd302, (HALF)0xd0e8, (HALF)0x613e, (HALF)0x3d78,
|
||||
(HALF)0x9e37, (HALF)0x56af, (HALF)0x9031, (HALF)0x2ac1,
|
||||
(HALF)0xf
|
||||
};
|
||||
static CONST HALF h_rdefvec[] = {
|
||||
STATIC CONST HALF h_rdefvec[] = {
|
||||
(HALF)0xb11e, (HALF)0xd3e7, (HALF)0xfd7e, (HALF)0x0f23,
|
||||
(HALF)0x46c9, (HALF)0xa625, (HALF)0x3ca5, (HALF)0x06c7,
|
||||
(HALF)0x6265, (HALF)0x627d, (HALF)0x93a8, (HALF)0x2f1e,
|
||||
@@ -1129,19 +1129,19 @@ static CONST HALF h_rdefvec[] = {
|
||||
#else
|
||||
/\../\ FULL_BITS must be 32 or 64 /\../\ !!!
|
||||
#endif
|
||||
static CONST RANDOM init_blum = {1, 0, 8, (HALF)0, (HALF)0xff,
|
||||
STATIC CONST RANDOM init_blum = {1, 0, 8, (HALF)0, (HALF)0xff,
|
||||
{(HALF *)h_ndefvec,
|
||||
sizeof(h_ndefvec)/sizeof(HALF), 0},
|
||||
{(HALF *)h_rdefvec,
|
||||
sizeof(h_rdefvec)/sizeof(HALF), 0}};
|
||||
#if FULL_BITS == 64
|
||||
static CONST HALF h_rdefvec_2[] = {
|
||||
STATIC CONST HALF h_rdefvec_2[] = {
|
||||
(HALF)0xd3e7b11e, (HALF)0x0f23fd7e, (HALF)0xa62546c9, (HALF)0x06c73ca5,
|
||||
(HALF)0x627d6265, (HALF)0x2f1e93a8, (HALF)0xff4b074e, (HALF)0x48b6d882,
|
||||
(HALF)0x7
|
||||
};
|
||||
#elif 2*FULL_BITS == 64
|
||||
static CONST HALF h_rdefvec_2[] = {
|
||||
STATIC CONST HALF h_rdefvec_2[] = {
|
||||
(HALF)0xb11e, (HALF)0xd3e7, (HALF)0xfd7e, (HALF)0x0f23,
|
||||
(HALF)0x46c9, (HALF)0xa625, (HALF)0x3ca5, (HALF)0x06c7,
|
||||
(HALF)0x6265, (HALF)0x627d, (HALF)0x93a8, (HALF)0x2f1e,
|
||||
@@ -1151,7 +1151,7 @@ static CONST HALF h_rdefvec_2[] = {
|
||||
#else
|
||||
/\../\ FULL_BITS must be 32 or 64 /\../\ !!!
|
||||
#endif
|
||||
static CONST ZVALUE z_rdefault = {
|
||||
STATIC CONST ZVALUE z_rdefault = {
|
||||
(HALF *)h_rdefvec_2, sizeof(h_rdefvec_2)/sizeof(HALF), 0
|
||||
};
|
||||
|
||||
@@ -1163,132 +1163,132 @@ static CONST ZVALUE z_rdefault = {
|
||||
* 1 <= newn < BLUM_PREGEN.
|
||||
*/
|
||||
#if FULL_BITS == 64
|
||||
static CONST HALF h_nvec01[] = {
|
||||
STATIC CONST HALF h_nvec01[] = {
|
||||
(HALF)0x83de9361, (HALF)0xf0db722d, (HALF)0x6fe328ca, (HALF)0x04944073,
|
||||
(HALF)0x5
|
||||
};
|
||||
static CONST HALF h_rvec01[] = {
|
||||
STATIC CONST HALF h_rvec01[] = {
|
||||
(HALF)0xa4cc42ec, (HALF)0x4e5dbb01, (HALF)0x11d952e7, (HALF)0xb226980f
|
||||
};
|
||||
static CONST HALF h_nvec02[] = {
|
||||
STATIC CONST HALF h_nvec02[] = {
|
||||
(HALF)0x353443f1, (HALF)0xeb286ea9, (HALF)0xdd374a18, (HALF)0x348a2555,
|
||||
(HALF)0x2c5
|
||||
};
|
||||
static CONST HALF h_rvec02[] = {
|
||||
STATIC CONST HALF h_rvec02[] = {
|
||||
(HALF)0x21e3a218, (HALF)0xe893616b, (HALF)0x6cd710e3, (HALF)0xf3d64344,
|
||||
(HALF)0x40
|
||||
};
|
||||
static CONST HALF h_nvec03[] = {
|
||||
STATIC CONST HALF h_nvec03[] = {
|
||||
(HALF)0x11d001f1, (HALF)0xf2ca661f, (HALF)0x3a81f1e0, (HALF)0x59d6ce4e,
|
||||
(HALF)0x0009cfd9
|
||||
};
|
||||
static CONST HALF h_rvec03[] = {
|
||||
STATIC CONST HALF h_rvec03[] = {
|
||||
(HALF)0xa0d7d76a, (HALF)0x3e142de2, (HALF)0xff5cea4f, (HALF)0xb44d9b64,
|
||||
(HALF)0xfae5
|
||||
};
|
||||
static CONST HALF h_nvec04[] = {
|
||||
STATIC CONST HALF h_nvec04[] = {
|
||||
(HALF)0xdfcc0751, (HALF)0x2decc680, (HALF)0x5df12a1a, (HALF)0x5c894ed7,
|
||||
(HALF)0x3070f924
|
||||
};
|
||||
static CONST HALF h_rvec04[] = {
|
||||
STATIC CONST HALF h_rvec04[] = {
|
||||
(HALF)0x4b984570, (HALF)0xa220ddba, (HALF)0xa2c0af8a, (HALF)0x131b2bdc,
|
||||
(HALF)0x0020c2d8
|
||||
};
|
||||
static CONST HALF h_nvec05[] = {
|
||||
STATIC CONST HALF h_nvec05[] = {
|
||||
(HALF)0x99166ef1, (HALF)0x8b99e5e7, (HALF)0x8769a010, (HALF)0x5d3fe111,
|
||||
(HALF)0x680bc2fa, (HALF)0x38f75aac, (HALF)0xdb81a85b, (HALF)0x109b1822,
|
||||
(HALF)0x2
|
||||
};
|
||||
static CONST HALF h_rvec05[] = {
|
||||
STATIC CONST HALF h_rvec05[] = {
|
||||
(HALF)0x59e2efa9, (HALF)0x0e6c77c8, (HALF)0x1e70aeed, (HALF)0x234f7b7d,
|
||||
(HALF)0x5f5df6db, (HALF)0xe821a960, (HALF)0xae33b792, (HALF)0x5e9b890e
|
||||
};
|
||||
static CONST HALF h_nvec06[] = {
|
||||
STATIC CONST HALF h_nvec06[] = {
|
||||
(HALF)0xe1ddf431, (HALF)0xd85557f1, (HALF)0x5ee732da, (HALF)0x3a38db77,
|
||||
(HALF)0x5c644026, (HALF)0xf2dbf218, (HALF)0x9ada2c79, (HALF)0x7bfd9d7d,
|
||||
(HALF)0xa
|
||||
};
|
||||
static CONST HALF h_rvec06[] = {
|
||||
STATIC CONST HALF h_rvec06[] = {
|
||||
(HALF)0xc9404daf, (HALF)0xc5dc2e80, (HALF)0x2c98eccf, (HALF)0xe1f3495d,
|
||||
(HALF)0xce1c925c, (HALF)0xe097aede, (HALF)0x88667154, (HALF)0x5e94a02f
|
||||
};
|
||||
static CONST HALF h_nvec07[] = {
|
||||
STATIC CONST HALF h_nvec07[] = {
|
||||
(HALF)0xcf9ec751, (HALF)0x602f9125, (HALF)0x52882e7f, (HALF)0x0dcf53ce,
|
||||
(HALF)0xff569d6b, (HALF)0x628643fc, (HALF)0x37801cd5, (HALF)0xf2399ef2,
|
||||
(HALF)0x43d87de8
|
||||
};
|
||||
static CONST HALF h_rvec07[] = {
|
||||
STATIC CONST HALF h_rvec07[] = {
|
||||
(HALF)0x098d25e6, (HALF)0x3992d2e5, (HALF)0x64f0b58c, (HALF)0xcf18d4dd,
|
||||
(HALF)0x9d876aef, (HALF)0x7acced04, (HALF)0xbfbe9076, (HALF)0x1ee014c7,
|
||||
(HALF)0x0013522d
|
||||
};
|
||||
static CONST HALF h_nvec08[] = {
|
||||
STATIC CONST HALF h_nvec08[] = {
|
||||
(HALF)0x26742f11, (HALF)0xbc42e66a, (HALF)0xb59cd9f0, (HALF)0x9ad4a6c2,
|
||||
(HALF)0x5bdbd2f9, (HALF)0xbdc91fed, (HALF)0xf13c9ce7, (HALF)0xeb4699b7,
|
||||
(HALF)0x47126ca7, (HALF)0x58
|
||||
};
|
||||
static CONST HALF h_rvec08[] = {
|
||||
STATIC CONST HALF h_rvec08[] = {
|
||||
(HALF)0x489dc674, (HALF)0xaae95f3a, (HALF)0xa35da929, (HALF)0x5597b4b8,
|
||||
(HALF)0x28e9c947, (HALF)0x3d344f9a, (HALF)0xb7e661fa, (HALF)0xa3269116,
|
||||
(HALF)0x853016dc
|
||||
};
|
||||
static CONST HALF h_nvec09[] = {
|
||||
STATIC CONST HALF h_nvec09[] = {
|
||||
(HALF)0xab27e3d1, (HALF)0x12745db4, (HALF)0xb980f951, (HALF)0x62b16b66,
|
||||
(HALF)0x0fdece0d, (HALF)0x6061c6fd, (HALF)0x36a6ff09, (HALF)0xe08eb61c,
|
||||
(HALF)0x84d895c3, (HALF)0x4a86752a, (HALF)0xc1797b4f, (HALF)0x562157a3,
|
||||
(HALF)0x3d267bb0, (HALF)0x14e81b00, (HALF)0x218d9238, (HALF)0x52322fd3,
|
||||
(HALF)0x0039e8be
|
||||
};
|
||||
static CONST HALF h_rvec09[] = {
|
||||
STATIC CONST HALF h_rvec09[] = {
|
||||
(HALF)0x7d4ed20d, (HALF)0x601ef2b8, (HALF)0x8e59f959, (HALF)0xedaa5d9e,
|
||||
(HALF)0x309a89ba, (HALF)0xe5ab7d81, (HALF)0x796b2545, (HALF)0x02de3222,
|
||||
(HALF)0x8357c0bd, (HALF)0x0107e3fd, (HALF)0x82d9d288, (HALF)0xbc42a8aa,
|
||||
(HALF)0x4b787343, (HALF)0xc0150886, (HALF)0xbab915bf, (HALF)0xf8ad1e6b,
|
||||
(HALF)0xb458
|
||||
};
|
||||
static CONST HALF h_nvec10[] = {
|
||||
STATIC CONST HALF h_nvec10[] = {
|
||||
(HALF)0xb7e64b89, (HALF)0xc3cdc363, (HALF)0x2ef9c73c, (HALF)0x6092ce22,
|
||||
(HALF)0x02abe36c, (HALF)0x08d49573, (HALF)0x74511c40, (HALF)0xd38582de,
|
||||
(HALF)0xa524a02f, (HALF)0x52c81b3b, (HALF)0x250d3cc9, (HALF)0x23b50e88,
|
||||
(HALF)0xbd1448bf, (HALF)0x882d7f98, (HALF)0xc23ef596, (HALF)0xc9055666,
|
||||
(HALF)0x025f2435
|
||||
};
|
||||
static CONST HALF h_rvec10[] = {
|
||||
STATIC CONST HALF h_rvec10[] = {
|
||||
(HALF)0x94cfc482, (HALF)0x594f5ad4, (HALF)0x23442aee, (HALF)0x145f40ce,
|
||||
(HALF)0x1baf950d, (HALF)0xadc4f175, (HALF)0xf62c669f, (HALF)0x8d075d56,
|
||||
(HALF)0x08ed8b40, (HALF)0xaaf2cf30, (HALF)0xc24b5ffb, (HALF)0x250df8cf,
|
||||
(HALF)0x7ca81ec9, (HALF)0x787e2b70, (HALF)0x18401468, (HALF)0x47b20e0c,
|
||||
(HALF)0x0066bb7e
|
||||
};
|
||||
static CONST HALF h_nvec11[] = {
|
||||
STATIC CONST HALF h_nvec11[] = {
|
||||
(HALF)0x546ee069, (HALF)0x2e1a530c, (HALF)0x2014dab2, (HALF)0xa729cf52,
|
||||
(HALF)0x920ee1a9, (HALF)0x68f27533, (HALF)0x25873cfa, (HALF)0xdd37a749,
|
||||
(HALF)0x4499daa2, (HALF)0x286e5870, (HALF)0x57f3f9b6, (HALF)0x5ec54467,
|
||||
(HALF)0x69a791ea, (HALF)0x874ecd77, (HALF)0x4217d56b, (HALF)0x82bdb309,
|
||||
(HALF)0x497864de
|
||||
};
|
||||
static CONST HALF h_rvec11[] = {
|
||||
STATIC CONST HALF h_rvec11[] = {
|
||||
(HALF)0x56e38b04, (HALF)0x3a0aded3, (HALF)0x461d88b1, (HALF)0x9c094d65,
|
||||
(HALF)0xe5333fed, (HALF)0x34d918fe, (HALF)0x1ef56281, (HALF)0xcedfa07c,
|
||||
(HALF)0x590f47fb, (HALF)0xa2c54d5c, (HALF)0x732339ee, (HALF)0x806549a7,
|
||||
(HALF)0x9ce3163f, (HALF)0xae3af8b6, (HALF)0x264a4465, (HALF)0x1cb5e630,
|
||||
(HALF)0x00868488
|
||||
};
|
||||
static CONST HALF h_nvec12[] = {
|
||||
STATIC CONST HALF h_nvec12[] = {
|
||||
(HALF)0xf14c7b99, (HALF)0x7f66d151, (HALF)0x87efad2b, (HALF)0x57d3f098,
|
||||
(HALF)0xd6534165, (HALF)0x812fdd25, (HALF)0x48c7c7ce, (HALF)0xa1bf41e0,
|
||||
(HALF)0x4c94e315, (HALF)0x190b1593, (HALF)0xee4251da, (HALF)0x2b4a1a66,
|
||||
(HALF)0x2bb7c2a1, (HALF)0x65b18ca9, (HALF)0x08b89116, (HALF)0xc0ccb15f,
|
||||
(HALF)0x57582ab3, (HALF)0x34
|
||||
};
|
||||
static CONST HALF h_rvec12[] = {
|
||||
STATIC CONST HALF h_rvec12[] = {
|
||||
(HALF)0xe207b4a0, (HALF)0x5227dd68, (HALF)0x9488fbc4, (HALF)0x6ed081aa,
|
||||
(HALF)0x8e736fe5, (HALF)0x3dd2c020, (HALF)0xeeb07c57, (HALF)0x0b604eb7,
|
||||
(HALF)0xa13f72a1, (HALF)0xcbfc4333, (HALF)0xa4c5e8cd, (HALF)0x0add520d,
|
||||
(HALF)0x758ca3b2, (HALF)0x55490137, (HALF)0x5870babd, (HALF)0xf648ed93,
|
||||
(HALF)0xdf719bd1
|
||||
};
|
||||
static CONST HALF h_nvec13[] = {
|
||||
STATIC CONST HALF h_nvec13[] = {
|
||||
(HALF)0x3314fc49, (HALF)0xcca20032, (HALF)0x208e3420, (HALF)0x8aaa503a,
|
||||
(HALF)0xd79a63cc, (HALF)0xb4ed7417, (HALF)0x95dd1892, (HALF)0xb5915f64,
|
||||
(HALF)0xd14cc7f1, (HALF)0x1589917e, (HALF)0xb2b05667, (HALF)0xc32d99cb,
|
||||
@@ -1299,7 +1299,7 @@ static CONST HALF h_nvec13[] = {
|
||||
(HALF)0xdaf66d82, (HALF)0xed03d833, (HALF)0x1b5af734, (HALF)0x166b7dd2,
|
||||
(HALF)0x01517c19
|
||||
};
|
||||
static CONST HALF h_rvec13[] = {
|
||||
STATIC CONST HALF h_rvec13[] = {
|
||||
(HALF)0x6b7736f5, (HALF)0x2407bfe4, (HALF)0x965e2072, (HALF)0xcc26cf3e,
|
||||
(HALF)0xa432b567, (HALF)0x2ed007ab, (HALF)0x0e2f67b9, (HALF)0xef640960,
|
||||
(HALF)0xbe5f1ad3, (HALF)0x3faeda1b, (HALF)0xa8f6b988, (HALF)0xe5c9cea5,
|
||||
@@ -1310,7 +1310,7 @@ static CONST HALF h_rvec13[] = {
|
||||
(HALF)0x9b706d2b, (HALF)0x8b04f6a6, (HALF)0x1263fa64, (HALF)0x8e9a560d,
|
||||
(HALF)0xd42e
|
||||
};
|
||||
static CONST HALF h_nvec14[] = {
|
||||
STATIC CONST HALF h_nvec14[] = {
|
||||
(HALF)0xc116af01, (HALF)0xbdef8c0f, (HALF)0xc4409a1a, (HALF)0xacb3185c,
|
||||
(HALF)0xb33f925b, (HALF)0xfee83005, (HALF)0x4b3db112, (HALF)0x7f076743,
|
||||
(HALF)0x21709223, (HALF)0x2159054b, (HALF)0x6fdfefe3, (HALF)0x792d0a07,
|
||||
@@ -1321,7 +1321,7 @@ static CONST HALF h_nvec14[] = {
|
||||
(HALF)0x1f564618, (HALF)0xb9d983d0, (HALF)0x7479ac07, (HALF)0x93c6f4e8,
|
||||
(HALF)0x5e56a00e
|
||||
};
|
||||
static CONST HALF h_rvec14[] = {
|
||||
STATIC CONST HALF h_rvec14[] = {
|
||||
(HALF)0x0ff9f190, (HALF)0x47a4db68, (HALF)0x913cc8ea, (HALF)0xb6b1b220,
|
||||
(HALF)0x13edfbbb, (HALF)0xa8f1f1c3, (HALF)0xd6d71f8f, (HALF)0x4194649a,
|
||||
(HALF)0x7d497344, (HALF)0x677c8416, (HALF)0x0186b983, (HALF)0xee633901,
|
||||
@@ -1332,7 +1332,7 @@ static CONST HALF h_rvec14[] = {
|
||||
(HALF)0x15b9a564, (HALF)0x9b18f154, (HALF)0x6ef0c5d0, (HALF)0xb6733509,
|
||||
(HALF)0x00f7aa7c
|
||||
};
|
||||
static CONST HALF h_nvec15[] = {
|
||||
STATIC CONST HALF h_nvec15[] = {
|
||||
(HALF)0xc8d97079, (HALF)0x061e7597, (HALF)0xf5d2c721, (HALF)0x299bc51f,
|
||||
(HALF)0xffe6c337, (HALF)0x19798624, (HALF)0xee6f92b6, (HALF)0x0b1d0c7a,
|
||||
(HALF)0xb5308231, (HALF)0x49c558dd, (HALF)0x196a530e, (HALF)0x0caa515c,
|
||||
@@ -1343,7 +1343,7 @@ static CONST HALF h_nvec15[] = {
|
||||
(HALF)0x45352ebe, (HALF)0x5ba81ca8, (HALF)0x02c46c17, (HALF)0x9edfbcdb,
|
||||
(HALF)0x97dd840b
|
||||
};
|
||||
static CONST HALF h_rvec15[] = {
|
||||
STATIC CONST HALF h_rvec15[] = {
|
||||
(HALF)0x6c3e2110, (HALF)0x808f0aaa, (HALF)0xd98db92e, (HALF)0x1e6abd43,
|
||||
(HALF)0xf401b920, (HALF)0x9d3f0381, (HALF)0xdb95d174, (HALF)0xa2f65c33,
|
||||
(HALF)0x0c5469f8, (HALF)0xa3c126fc, (HALF)0x8866241b, (HALF)0x0e46eca7,
|
||||
@@ -1354,7 +1354,7 @@ static CONST HALF h_rvec15[] = {
|
||||
(HALF)0xa8d77ca6, (HALF)0xb50025da, (HALF)0x69ab99f9, (HALF)0x03b8c758,
|
||||
(HALF)0x00b82207
|
||||
};
|
||||
static CONST HALF h_nvec16[] = {
|
||||
STATIC CONST HALF h_nvec16[] = {
|
||||
(HALF)0xd84346e1, (HALF)0x184183f6, (HALF)0x2dc9bd36, (HALF)0x4ca857ac,
|
||||
(HALF)0x96a5828d, (HALF)0xed1f1c59, (HALF)0x36d9731f, (HALF)0xbd3f6183,
|
||||
(HALF)0xde0f5578, (HALF)0xb6a2ea8a, (HALF)0xbe993c44, (HALF)0x0e283c05,
|
||||
@@ -1365,7 +1365,7 @@ static CONST HALF h_nvec16[] = {
|
||||
(HALF)0x9e43536a, (HALF)0x9f544cb8, (HALF)0xb56f84c3, (HALF)0xb82fbb12,
|
||||
(HALF)0x6e348549, (HALF)0x45
|
||||
};
|
||||
static CONST HALF h_rvec16[] = {
|
||||
STATIC CONST HALF h_rvec16[] = {
|
||||
(HALF)0x7b4e8830, (HALF)0x70605db8, (HALF)0xa1abe4a5, (HALF)0xa70fbe04,
|
||||
(HALF)0x2bcda8f4, (HALF)0xd29ada9a, (HALF)0x55ad0560, (HALF)0xb367137e,
|
||||
(HALF)0xd6972f1a, (HALF)0x809bad45, (HALF)0xb15d2454, (HALF)0x0c0d415f,
|
||||
@@ -1376,7 +1376,7 @@ static CONST HALF h_rvec16[] = {
|
||||
(HALF)0x7895ae8f, (HALF)0x4a4b6dcd, (HALF)0x973e921a, (HALF)0x9fb27a07,
|
||||
(HALF)0xb0d7dcb1
|
||||
};
|
||||
static CONST HALF h_nvec17[] = {
|
||||
STATIC CONST HALF h_nvec17[] = {
|
||||
(HALF)0x72b72051, (HALF)0xedc24ebf, (HALF)0xe970a8d1, (HALF)0x66c9b150,
|
||||
(HALF)0xcbb927f7, (HALF)0xb574ffd9, (HALF)0x4166b249, (HALF)0x0fce4030,
|
||||
(HALF)0xfa6922ca, (HALF)0x39cc14a9, (HALF)0x14396e2a, (HALF)0xaff74c7f,
|
||||
@@ -1395,7 +1395,7 @@ static CONST HALF h_nvec17[] = {
|
||||
(HALF)0x96e0faf9, (HALF)0x33be3c0f, (HALF)0xffa3040b, (HALF)0x813aeac0,
|
||||
(HALF)0x6177
|
||||
};
|
||||
static CONST HALF h_rvec17[] = {
|
||||
STATIC CONST HALF h_rvec17[] = {
|
||||
(HALF)0x22b41dac, (HALF)0xd6258005, (HALF)0x2aa1e0cb, (HALF)0x45d147b5,
|
||||
(HALF)0xbf5c46d9, (HALF)0x14c9dadf, (HALF)0x09b0aec4, (HALF)0x4286bfef,
|
||||
(HALF)0xc6f8e9d1, (HALF)0xdd68467b, (HALF)0x93f4ffb9, (HALF)0x58f2eb51,
|
||||
@@ -1414,7 +1414,7 @@ static CONST HALF h_rvec17[] = {
|
||||
(HALF)0xc2d2fc5b, (HALF)0xdd665324, (HALF)0xc3b8adf1, (HALF)0x0b6eaf3b,
|
||||
(HALF)0x5372
|
||||
};
|
||||
static CONST HALF h_nvec18[] = {
|
||||
STATIC CONST HALF h_nvec18[] = {
|
||||
(HALF)0xc8b78629, (HALF)0x41351b18, (HALF)0x28ad4ed8, (HALF)0xc96f7df1,
|
||||
(HALF)0x7cd3c931, (HALF)0x0f23036a, (HALF)0xac657631, (HALF)0x6a625812,
|
||||
(HALF)0x08144788, (HALF)0x8642ed62, (HALF)0x76198a40, (HALF)0x70defd64,
|
||||
@@ -1433,7 +1433,7 @@ static CONST HALF h_nvec18[] = {
|
||||
(HALF)0x5378efcb, (HALF)0xfec0c7c6, (HALF)0xf07cb724, (HALF)0xfb61b42a,
|
||||
(HALF)0x068f2a38
|
||||
};
|
||||
static CONST HALF h_rvec18[] = {
|
||||
STATIC CONST HALF h_rvec18[] = {
|
||||
(HALF)0x35ea3c63, (HALF)0x8df2ef97, (HALF)0xa2b3afb7, (HALF)0x179158f6,
|
||||
(HALF)0x04920dba, (HALF)0xf333077e, (HALF)0xf8304b5a, (HALF)0x230ff2ae,
|
||||
(HALF)0x84a8f3f0, (HALF)0xadda164e, (HALF)0xc9a1c944, (HALF)0xc70502f2,
|
||||
@@ -1452,7 +1452,7 @@ static CONST HALF h_rvec18[] = {
|
||||
(HALF)0x5358be89, (HALF)0x4cd835d7, (HALF)0xf0d5cda8, (HALF)0x1f1ac6c3,
|
||||
(HALF)0x04735e92
|
||||
};
|
||||
static CONST HALF h_nvec19[] = {
|
||||
STATIC CONST HALF h_nvec19[] = {
|
||||
(HALF)0x6b659a79, (HALF)0x0239c12d, (HALF)0xd204df49, (HALF)0x1d4ae0c7,
|
||||
(HALF)0x099bf000, (HALF)0x6435ade8, (HALF)0xdc4af029, (HALF)0x2f4ee7a2,
|
||||
(HALF)0xadfcf1e3, (HALF)0x73358f43, (HALF)0x687eede5, (HALF)0xb567cd4d,
|
||||
@@ -1471,7 +1471,7 @@ static CONST HALF h_nvec19[] = {
|
||||
(HALF)0x2e410ad4, (HALF)0x0721c315, (HALF)0xdde27654, (HALF)0x2ad6534b,
|
||||
(HALF)0xd6788b25, (HALF)0xb23bb9e8, (HALF)0x00230d7a
|
||||
};
|
||||
static CONST HALF h_rvec19[] = {
|
||||
STATIC CONST HALF h_rvec19[] = {
|
||||
(HALF)0x698ef473, (HALF)0x3d53a5b7, (HALF)0x06448319, (HALF)0xd9ad4445,
|
||||
(HALF)0x6967daa0, (HALF)0xa14c6240, (HALF)0x78e77724, (HALF)0x63ef2ab7,
|
||||
(HALF)0x8dff2ee2, (HALF)0x662eb424, (HALF)0xcd9307d6, (HALF)0x0ab06a5d,
|
||||
@@ -1490,7 +1490,7 @@ static CONST HALF h_rvec19[] = {
|
||||
(HALF)0x6fa6fa75, (HALF)0xe21f6512, (HALF)0x999518b4, (HALF)0x2196605b,
|
||||
(HALF)0xe4fc1798, (HALF)0x5f21e245, (HALF)0x0008f172
|
||||
};
|
||||
static CONST HALF h_nvec20[] = {
|
||||
STATIC CONST HALF h_nvec20[] = {
|
||||
(HALF)0xc3c1d081, (HALF)0x4d262fce, (HALF)0x8765cc91, (HALF)0xf3727f7c,
|
||||
(HALF)0xabba4bbc, (HALF)0xe0985801, (HALF)0xfa365c51, (HALF)0xb2a4b230,
|
||||
(HALF)0xf4430a8d, (HALF)0x546b98c8, (HALF)0xd9748b26, (HALF)0xe255a82f,
|
||||
@@ -1509,7 +1509,7 @@ static CONST HALF h_nvec20[] = {
|
||||
(HALF)0x56d79660, (HALF)0x6066a3f3, (HALF)0x648b0327, (HALF)0x267e5b3a,
|
||||
(HALF)0xdddc63a0, (HALF)0x3322e890, (HALF)0x20e0d8b1, (HALF)0x004fd2b8
|
||||
};
|
||||
static CONST HALF h_rvec20[] = {
|
||||
STATIC CONST HALF h_rvec20[] = {
|
||||
(HALF)0xa048bd1a, (HALF)0x95abdc7b, (HALF)0x98f47cf8, (HALF)0x126ac98d,
|
||||
(HALF)0xaebf85fd, (HALF)0x5650580f, (HALF)0x3292d7dd, (HALF)0xf49e8377,
|
||||
(HALF)0x2947ed46, (HALF)0xd1a5b26c, (HALF)0xae14e6a1, (HALF)0x9b1f5788,
|
||||
@@ -1529,100 +1529,100 @@ static CONST HALF h_rvec20[] = {
|
||||
(HALF)0xee960da1, (HALF)0xa3099293, (HALF)0x84445fea, (HALF)0x0046ef01
|
||||
};
|
||||
#elif 2*FULL_BITS == 64
|
||||
static CONST HALF h_nvec01[] = {
|
||||
STATIC CONST HALF h_nvec01[] = {
|
||||
(HALF)0x9361, (HALF)0x83de, (HALF)0x722d, (HALF)0xf0db,
|
||||
(HALF)0x28ca, (HALF)0x6fe3, (HALF)0x4073, (HALF)0x0494,
|
||||
(HALF)0x5
|
||||
};
|
||||
static CONST HALF h_rvec01[] = {
|
||||
STATIC CONST HALF h_rvec01[] = {
|
||||
(HALF)0x42ec, (HALF)0xa4cc, (HALF)0xbb01, (HALF)0x4e5d,
|
||||
(HALF)0x52e7, (HALF)0x11d9, (HALF)0x980f, (HALF)0xb226
|
||||
};
|
||||
static CONST HALF h_nvec02[] = {
|
||||
STATIC CONST HALF h_nvec02[] = {
|
||||
(HALF)0x43f1, (HALF)0x3534, (HALF)0x6ea9, (HALF)0xeb28,
|
||||
(HALF)0x4a18, (HALF)0xdd37, (HALF)0x2555, (HALF)0x348a,
|
||||
(HALF)0x2c5
|
||||
};
|
||||
static CONST HALF h_rvec02[] = {
|
||||
STATIC CONST HALF h_rvec02[] = {
|
||||
(HALF)0xa218, (HALF)0x21e3, (HALF)0x616b, (HALF)0xe893,
|
||||
(HALF)0x10e3, (HALF)0x6cd7, (HALF)0x4344, (HALF)0xf3d6,
|
||||
(HALF)0x40
|
||||
};
|
||||
static CONST HALF h_nvec03[] = {
|
||||
STATIC CONST HALF h_nvec03[] = {
|
||||
(HALF)0x01f1, (HALF)0x11d0, (HALF)0x661f, (HALF)0xf2ca,
|
||||
(HALF)0xf1e0, (HALF)0x3a81, (HALF)0xce4e, (HALF)0x59d6,
|
||||
(HALF)0xcfd9, (HALF)0x0009
|
||||
};
|
||||
static CONST HALF h_rvec03[] = {
|
||||
STATIC CONST HALF h_rvec03[] = {
|
||||
(HALF)0xd76a, (HALF)0xa0d7, (HALF)0x2de2, (HALF)0x3e14,
|
||||
(HALF)0xea4f, (HALF)0xff5c, (HALF)0x9b64, (HALF)0xb44d,
|
||||
(HALF)0xfae5
|
||||
};
|
||||
static CONST HALF h_nvec04[] = {
|
||||
STATIC CONST HALF h_nvec04[] = {
|
||||
(HALF)0x0751, (HALF)0xdfcc, (HALF)0xc680, (HALF)0x2dec,
|
||||
(HALF)0x2a1a, (HALF)0x5df1, (HALF)0x4ed7, (HALF)0x5c89,
|
||||
(HALF)0xf924, (HALF)0x3070
|
||||
};
|
||||
static CONST HALF h_rvec04[] = {
|
||||
STATIC CONST HALF h_rvec04[] = {
|
||||
(HALF)0x4570, (HALF)0x4b98, (HALF)0xddba, (HALF)0xa220,
|
||||
(HALF)0xaf8a, (HALF)0xa2c0, (HALF)0x2bdc, (HALF)0x131b,
|
||||
(HALF)0xc2d8, (HALF)0x0020
|
||||
};
|
||||
static CONST HALF h_nvec05[] = {
|
||||
STATIC CONST HALF h_nvec05[] = {
|
||||
(HALF)0x6ef1, (HALF)0x9916, (HALF)0xe5e7, (HALF)0x8b99,
|
||||
(HALF)0xa010, (HALF)0x8769, (HALF)0xe111, (HALF)0x5d3f,
|
||||
(HALF)0xc2fa, (HALF)0x680b, (HALF)0x5aac, (HALF)0x38f7,
|
||||
(HALF)0xa85b, (HALF)0xdb81, (HALF)0x1822, (HALF)0x109b,
|
||||
(HALF)0x2
|
||||
};
|
||||
static CONST HALF h_rvec05[] = {
|
||||
STATIC CONST HALF h_rvec05[] = {
|
||||
(HALF)0xefa9, (HALF)0x59e2, (HALF)0x77c8, (HALF)0x0e6c,
|
||||
(HALF)0xaeed, (HALF)0x1e70, (HALF)0x7b7d, (HALF)0x234f,
|
||||
(HALF)0xf6db, (HALF)0x5f5d, (HALF)0xa960, (HALF)0xe821,
|
||||
(HALF)0xb792, (HALF)0xae33, (HALF)0x890e, (HALF)0x5e9b
|
||||
};
|
||||
static CONST HALF h_nvec06[] = {
|
||||
STATIC CONST HALF h_nvec06[] = {
|
||||
(HALF)0xf431, (HALF)0xe1dd, (HALF)0x57f1, (HALF)0xd855,
|
||||
(HALF)0x32da, (HALF)0x5ee7, (HALF)0xdb77, (HALF)0x3a38,
|
||||
(HALF)0x4026, (HALF)0x5c64, (HALF)0xf218, (HALF)0xf2db,
|
||||
(HALF)0x2c79, (HALF)0x9ada, (HALF)0x9d7d, (HALF)0x7bfd,
|
||||
(HALF)0xa
|
||||
};
|
||||
static CONST HALF h_rvec06[] = {
|
||||
STATIC CONST HALF h_rvec06[] = {
|
||||
(HALF)0x4daf, (HALF)0xc940, (HALF)0x2e80, (HALF)0xc5dc,
|
||||
(HALF)0xeccf, (HALF)0x2c98, (HALF)0x495d, (HALF)0xe1f3,
|
||||
(HALF)0x925c, (HALF)0xce1c, (HALF)0xaede, (HALF)0xe097,
|
||||
(HALF)0x7154, (HALF)0x8866, (HALF)0xa02f, (HALF)0x5e94
|
||||
};
|
||||
static CONST HALF h_nvec07[] = {
|
||||
STATIC CONST HALF h_nvec07[] = {
|
||||
(HALF)0xc751, (HALF)0xcf9e, (HALF)0x9125, (HALF)0x602f,
|
||||
(HALF)0x2e7f, (HALF)0x5288, (HALF)0x53ce, (HALF)0x0dcf,
|
||||
(HALF)0x9d6b, (HALF)0xff56, (HALF)0x43fc, (HALF)0x6286,
|
||||
(HALF)0x1cd5, (HALF)0x3780, (HALF)0x9ef2, (HALF)0xf239,
|
||||
(HALF)0x7de8, (HALF)0x43d8
|
||||
};
|
||||
static CONST HALF h_rvec07[] = {
|
||||
STATIC CONST HALF h_rvec07[] = {
|
||||
(HALF)0x25e6, (HALF)0x098d, (HALF)0xd2e5, (HALF)0x3992,
|
||||
(HALF)0xb58c, (HALF)0x64f0, (HALF)0xd4dd, (HALF)0xcf18,
|
||||
(HALF)0x6aef, (HALF)0x9d87, (HALF)0xed04, (HALF)0x7acc,
|
||||
(HALF)0x9076, (HALF)0xbfbe, (HALF)0x14c7, (HALF)0x1ee0,
|
||||
(HALF)0x522d, (HALF)0x0013
|
||||
};
|
||||
static CONST HALF h_nvec08[] = {
|
||||
STATIC CONST HALF h_nvec08[] = {
|
||||
(HALF)0x2f11, (HALF)0x2674, (HALF)0xe66a, (HALF)0xbc42,
|
||||
(HALF)0xd9f0, (HALF)0xb59c, (HALF)0xa6c2, (HALF)0x9ad4,
|
||||
(HALF)0xd2f9, (HALF)0x5bdb, (HALF)0x1fed, (HALF)0xbdc9,
|
||||
(HALF)0x9ce7, (HALF)0xf13c, (HALF)0x99b7, (HALF)0xeb46,
|
||||
(HALF)0x6ca7, (HALF)0x4712, (HALF)0x58
|
||||
};
|
||||
static CONST HALF h_rvec08[] = {
|
||||
STATIC CONST HALF h_rvec08[] = {
|
||||
(HALF)0xc674, (HALF)0x489d, (HALF)0x5f3a, (HALF)0xaae9,
|
||||
(HALF)0xa929, (HALF)0xa35d, (HALF)0xb4b8, (HALF)0x5597,
|
||||
(HALF)0xc947, (HALF)0x28e9, (HALF)0x4f9a, (HALF)0x3d34,
|
||||
(HALF)0x61fa, (HALF)0xb7e6, (HALF)0x9116, (HALF)0xa326,
|
||||
(HALF)0x16dc, (HALF)0x8530
|
||||
};
|
||||
static CONST HALF h_nvec09[] = {
|
||||
STATIC CONST HALF h_nvec09[] = {
|
||||
(HALF)0xe3d1, (HALF)0xab27, (HALF)0x5db4, (HALF)0x1274,
|
||||
(HALF)0xf951, (HALF)0xb980, (HALF)0x6b66, (HALF)0x62b1,
|
||||
(HALF)0xce0d, (HALF)0x0fde, (HALF)0xc6fd, (HALF)0x6061,
|
||||
@@ -1633,7 +1633,7 @@ static CONST HALF h_nvec09[] = {
|
||||
(HALF)0x9238, (HALF)0x218d, (HALF)0x2fd3, (HALF)0x5232,
|
||||
(HALF)0xe8be, (HALF)0x0039
|
||||
};
|
||||
static CONST HALF h_rvec09[] = {
|
||||
STATIC CONST HALF h_rvec09[] = {
|
||||
(HALF)0xd20d, (HALF)0x7d4e, (HALF)0xf2b8, (HALF)0x601e,
|
||||
(HALF)0xf959, (HALF)0x8e59, (HALF)0x5d9e, (HALF)0xedaa,
|
||||
(HALF)0x89ba, (HALF)0x309a, (HALF)0x7d81, (HALF)0xe5ab,
|
||||
@@ -1644,7 +1644,7 @@ static CONST HALF h_rvec09[] = {
|
||||
(HALF)0x15bf, (HALF)0xbab9, (HALF)0x1e6b, (HALF)0xf8ad,
|
||||
(HALF)0xb458
|
||||
};
|
||||
static CONST HALF h_nvec10[] = {
|
||||
STATIC CONST HALF h_nvec10[] = {
|
||||
(HALF)0x4b89, (HALF)0xb7e6, (HALF)0xc363, (HALF)0xc3cd,
|
||||
(HALF)0xc73c, (HALF)0x2ef9, (HALF)0xce22, (HALF)0x6092,
|
||||
(HALF)0xe36c, (HALF)0x02ab, (HALF)0x9573, (HALF)0x08d4,
|
||||
@@ -1655,7 +1655,7 @@ static CONST HALF h_nvec10[] = {
|
||||
(HALF)0xf596, (HALF)0xc23e, (HALF)0x5666, (HALF)0xc905,
|
||||
(HALF)0x2435, (HALF)0x025f
|
||||
};
|
||||
static CONST HALF h_rvec10[] = {
|
||||
STATIC CONST HALF h_rvec10[] = {
|
||||
(HALF)0xc482, (HALF)0x94cf, (HALF)0x5ad4, (HALF)0x594f,
|
||||
(HALF)0x2aee, (HALF)0x2344, (HALF)0x40ce, (HALF)0x145f,
|
||||
(HALF)0x950d, (HALF)0x1baf, (HALF)0xf175, (HALF)0xadc4,
|
||||
@@ -1666,7 +1666,7 @@ static CONST HALF h_rvec10[] = {
|
||||
(HALF)0x1468, (HALF)0x1840, (HALF)0x0e0c, (HALF)0x47b2,
|
||||
(HALF)0xbb7e, (HALF)0x0066
|
||||
};
|
||||
static CONST HALF h_nvec11[] = {
|
||||
STATIC CONST HALF h_nvec11[] = {
|
||||
(HALF)0xe069, (HALF)0x546e, (HALF)0x530c, (HALF)0x2e1a,
|
||||
(HALF)0xdab2, (HALF)0x2014, (HALF)0xcf52, (HALF)0xa729,
|
||||
(HALF)0xe1a9, (HALF)0x920e, (HALF)0x7533, (HALF)0x68f2,
|
||||
@@ -1677,7 +1677,7 @@ static CONST HALF h_nvec11[] = {
|
||||
(HALF)0xd56b, (HALF)0x4217, (HALF)0xb309, (HALF)0x82bd,
|
||||
(HALF)0x64de, (HALF)0x4978
|
||||
};
|
||||
static CONST HALF h_rvec11[] = {
|
||||
STATIC CONST HALF h_rvec11[] = {
|
||||
(HALF)0x8b04, (HALF)0x56e3, (HALF)0xded3, (HALF)0x3a0a,
|
||||
(HALF)0x88b1, (HALF)0x461d, (HALF)0x4d65, (HALF)0x9c09,
|
||||
(HALF)0x3fed, (HALF)0xe533, (HALF)0x18fe, (HALF)0x34d9,
|
||||
@@ -1688,7 +1688,7 @@ static CONST HALF h_rvec11[] = {
|
||||
(HALF)0x4465, (HALF)0x264a, (HALF)0xe630, (HALF)0x1cb5,
|
||||
(HALF)0x8488, (HALF)0x0086
|
||||
};
|
||||
static CONST HALF h_nvec12[] = {
|
||||
STATIC CONST HALF h_nvec12[] = {
|
||||
(HALF)0x7b99, (HALF)0xf14c, (HALF)0xd151, (HALF)0x7f66,
|
||||
(HALF)0xad2b, (HALF)0x87ef, (HALF)0xf098, (HALF)0x57d3,
|
||||
(HALF)0x4165, (HALF)0xd653, (HALF)0xdd25, (HALF)0x812f,
|
||||
@@ -1699,7 +1699,7 @@ static CONST HALF h_nvec12[] = {
|
||||
(HALF)0x9116, (HALF)0x08b8, (HALF)0xb15f, (HALF)0xc0cc,
|
||||
(HALF)0x2ab3, (HALF)0x5758, (HALF)0x34
|
||||
};
|
||||
static CONST HALF h_rvec12[] = {
|
||||
STATIC CONST HALF h_rvec12[] = {
|
||||
(HALF)0xb4a0, (HALF)0xe207, (HALF)0xdd68, (HALF)0x5227,
|
||||
(HALF)0xfbc4, (HALF)0x9488, (HALF)0x81aa, (HALF)0x6ed0,
|
||||
(HALF)0x6fe5, (HALF)0x8e73, (HALF)0xc020, (HALF)0x3dd2,
|
||||
@@ -1710,7 +1710,7 @@ static CONST HALF h_rvec12[] = {
|
||||
(HALF)0xbabd, (HALF)0x5870, (HALF)0xed93, (HALF)0xf648,
|
||||
(HALF)0x9bd1, (HALF)0xdf71
|
||||
};
|
||||
static CONST HALF h_nvec13[] = {
|
||||
STATIC CONST HALF h_nvec13[] = {
|
||||
(HALF)0xfc49, (HALF)0x3314, (HALF)0x0032, (HALF)0xcca2,
|
||||
(HALF)0x3420, (HALF)0x208e, (HALF)0x503a, (HALF)0x8aaa,
|
||||
(HALF)0x63cc, (HALF)0xd79a, (HALF)0x7417, (HALF)0xb4ed,
|
||||
@@ -1729,7 +1729,7 @@ static CONST HALF h_nvec13[] = {
|
||||
(HALF)0xf734, (HALF)0x1b5a, (HALF)0x7dd2, (HALF)0x166b,
|
||||
(HALF)0x7c19, (HALF)0x0151
|
||||
};
|
||||
static CONST HALF h_rvec13[] = {
|
||||
STATIC CONST HALF h_rvec13[] = {
|
||||
(HALF)0x36f5, (HALF)0x6b77, (HALF)0xbfe4, (HALF)0x2407,
|
||||
(HALF)0x2072, (HALF)0x965e, (HALF)0xcf3e, (HALF)0xcc26,
|
||||
(HALF)0xb567, (HALF)0xa432, (HALF)0x07ab, (HALF)0x2ed0,
|
||||
@@ -1748,7 +1748,7 @@ static CONST HALF h_rvec13[] = {
|
||||
(HALF)0xfa64, (HALF)0x1263, (HALF)0x560d, (HALF)0x8e9a,
|
||||
(HALF)0xd42e
|
||||
};
|
||||
static CONST HALF h_nvec14[] = {
|
||||
STATIC CONST HALF h_nvec14[] = {
|
||||
(HALF)0xaf01, (HALF)0xc116, (HALF)0x8c0f, (HALF)0xbdef,
|
||||
(HALF)0x9a1a, (HALF)0xc440, (HALF)0x185c, (HALF)0xacb3,
|
||||
(HALF)0x925b, (HALF)0xb33f, (HALF)0x3005, (HALF)0xfee8,
|
||||
@@ -1767,7 +1767,7 @@ static CONST HALF h_nvec14[] = {
|
||||
(HALF)0xac07, (HALF)0x7479, (HALF)0xf4e8, (HALF)0x93c6,
|
||||
(HALF)0xa00e, (HALF)0x5e56
|
||||
};
|
||||
static CONST HALF h_rvec14[] = {
|
||||
STATIC CONST HALF h_rvec14[] = {
|
||||
(HALF)0xf190, (HALF)0x0ff9, (HALF)0xdb68, (HALF)0x47a4,
|
||||
(HALF)0xc8ea, (HALF)0x913c, (HALF)0xb220, (HALF)0xb6b1,
|
||||
(HALF)0xfbbb, (HALF)0x13ed, (HALF)0xf1c3, (HALF)0xa8f1,
|
||||
@@ -1786,7 +1786,7 @@ static CONST HALF h_rvec14[] = {
|
||||
(HALF)0xc5d0, (HALF)0x6ef0, (HALF)0x3509, (HALF)0xb673,
|
||||
(HALF)0xaa7c, (HALF)0x00f7
|
||||
};
|
||||
static CONST HALF h_nvec15[] = {
|
||||
STATIC CONST HALF h_nvec15[] = {
|
||||
(HALF)0x7079, (HALF)0xc8d9, (HALF)0x7597, (HALF)0x061e,
|
||||
(HALF)0xc721, (HALF)0xf5d2, (HALF)0xc51f, (HALF)0x299b,
|
||||
(HALF)0xc337, (HALF)0xffe6, (HALF)0x8624, (HALF)0x1979,
|
||||
@@ -1805,7 +1805,7 @@ static CONST HALF h_nvec15[] = {
|
||||
(HALF)0x6c17, (HALF)0x02c4, (HALF)0xbcdb, (HALF)0x9edf,
|
||||
(HALF)0x840b, (HALF)0x97dd
|
||||
};
|
||||
static CONST HALF h_rvec15[] = {
|
||||
STATIC CONST HALF h_rvec15[] = {
|
||||
(HALF)0x2110, (HALF)0x6c3e, (HALF)0x0aaa, (HALF)0x808f,
|
||||
(HALF)0xb92e, (HALF)0xd98d, (HALF)0xbd43, (HALF)0x1e6a,
|
||||
(HALF)0xb920, (HALF)0xf401, (HALF)0x0381, (HALF)0x9d3f,
|
||||
@@ -1824,7 +1824,7 @@ static CONST HALF h_rvec15[] = {
|
||||
(HALF)0x99f9, (HALF)0x69ab, (HALF)0xc758, (HALF)0x03b8,
|
||||
(HALF)0x2207, (HALF)0x00b8
|
||||
};
|
||||
static CONST HALF h_nvec16[] = {
|
||||
STATIC CONST HALF h_nvec16[] = {
|
||||
(HALF)0x46e1, (HALF)0xd843, (HALF)0x83f6, (HALF)0x1841,
|
||||
(HALF)0xbd36, (HALF)0x2dc9, (HALF)0x57ac, (HALF)0x4ca8,
|
||||
(HALF)0x828d, (HALF)0x96a5, (HALF)0x1c59, (HALF)0xed1f,
|
||||
@@ -1843,7 +1843,7 @@ static CONST HALF h_nvec16[] = {
|
||||
(HALF)0x84c3, (HALF)0xb56f, (HALF)0xbb12, (HALF)0xb82f,
|
||||
(HALF)0x8549, (HALF)0x6e34, (HALF)0x45
|
||||
};
|
||||
static CONST HALF h_rvec16[] = {
|
||||
STATIC CONST HALF h_rvec16[] = {
|
||||
(HALF)0x8830, (HALF)0x7b4e, (HALF)0x5db8, (HALF)0x7060, (HALF)0xe4a5,
|
||||
(HALF)0xa1ab, (HALF)0xbe04, (HALF)0xa70f,
|
||||
(HALF)0xa8f4, (HALF)0x2bcd, (HALF)0xda9a, (HALF)0xd29a,
|
||||
@@ -1862,7 +1862,7 @@ static CONST HALF h_rvec16[] = {
|
||||
(HALF)0x921a, (HALF)0x973e, (HALF)0x7a07, (HALF)0x9fb2,
|
||||
(HALF)0xdcb1, (HALF)0xb0d7
|
||||
};
|
||||
static CONST HALF h_nvec17[] = {
|
||||
STATIC CONST HALF h_nvec17[] = {
|
||||
(HALF)0x2051, (HALF)0x72b7, (HALF)0x4ebf, (HALF)0xedc2,
|
||||
(HALF)0xa8d1, (HALF)0xe970, (HALF)0xb150, (HALF)0x66c9,
|
||||
(HALF)0x27f7, (HALF)0xcbb9, (HALF)0xffd9, (HALF)0xb574,
|
||||
@@ -1897,7 +1897,7 @@ static CONST HALF h_nvec17[] = {
|
||||
(HALF)0x040b, (HALF)0xffa3, (HALF)0xeac0, (HALF)0x813a,
|
||||
(HALF)0x6177
|
||||
};
|
||||
static CONST HALF h_rvec17[] = {
|
||||
STATIC CONST HALF h_rvec17[] = {
|
||||
(HALF)0x1dac, (HALF)0x22b4, (HALF)0x8005, (HALF)0xd625,
|
||||
(HALF)0xe0cb, (HALF)0x2aa1, (HALF)0x47b5, (HALF)0x45d1,
|
||||
(HALF)0x46d9, (HALF)0xbf5c, (HALF)0xdadf, (HALF)0x14c9,
|
||||
@@ -1932,7 +1932,7 @@ static CONST HALF h_rvec17[] = {
|
||||
(HALF)0xadf1, (HALF)0xc3b8, (HALF)0xaf3b, (HALF)0x0b6e,
|
||||
(HALF)0x5372
|
||||
};
|
||||
static CONST HALF h_nvec18[] = {
|
||||
STATIC CONST HALF h_nvec18[] = {
|
||||
(HALF)0x8629, (HALF)0xc8b7, (HALF)0x1b18, (HALF)0x4135, (HALF)0x4ed8,
|
||||
(HALF)0x28ad, (HALF)0x7df1, (HALF)0xc96f,
|
||||
(HALF)0xc931, (HALF)0x7cd3, (HALF)0x036a, (HALF)0x0f23,
|
||||
@@ -1967,7 +1967,7 @@ static CONST HALF h_nvec18[] = {
|
||||
(HALF)0xb724, (HALF)0xf07c, (HALF)0xb42a, (HALF)0xfb61,
|
||||
(HALF)0x2a38, (HALF)0x068f
|
||||
};
|
||||
static CONST HALF h_rvec18[] = {
|
||||
STATIC CONST HALF h_rvec18[] = {
|
||||
(HALF)0x3c63, (HALF)0x35ea, (HALF)0xef97, (HALF)0x8df2,
|
||||
(HALF)0xafb7, (HALF)0xa2b3, (HALF)0x58f6, (HALF)0x1791,
|
||||
(HALF)0x0dba, (HALF)0x0492, (HALF)0x077e, (HALF)0xf333,
|
||||
@@ -2002,7 +2002,7 @@ static CONST HALF h_rvec18[] = {
|
||||
(HALF)0xcda8, (HALF)0xf0d5, (HALF)0xc6c3, (HALF)0x1f1a,
|
||||
(HALF)0x5e92, (HALF)0x0473
|
||||
};
|
||||
static CONST HALF h_nvec19[] = {
|
||||
STATIC CONST HALF h_nvec19[] = {
|
||||
(HALF)0x9a79, (HALF)0x6b65, (HALF)0xc12d, (HALF)0x0239,
|
||||
(HALF)0xdf49, (HALF)0xd204, (HALF)0xe0c7, (HALF)0x1d4a,
|
||||
(HALF)0xf000, (HALF)0x099b, (HALF)0xade8, (HALF)0x6435,
|
||||
@@ -2038,7 +2038,7 @@ static CONST HALF h_nvec19[] = {
|
||||
(HALF)0x8b25, (HALF)0xd678, (HALF)0xb9e8, (HALF)0xb23b,
|
||||
(HALF)0x0d7a, (HALF)0x0023
|
||||
};
|
||||
static CONST HALF h_rvec19[] = {
|
||||
STATIC CONST HALF h_rvec19[] = {
|
||||
(HALF)0xf473, (HALF)0x698e, (HALF)0xa5b7, (HALF)0x3d53,
|
||||
(HALF)0x8319, (HALF)0x0644, (HALF)0x4445, (HALF)0xd9ad,
|
||||
(HALF)0xdaa0, (HALF)0x6967, (HALF)0x6240, (HALF)0xa14c,
|
||||
@@ -2073,7 +2073,7 @@ static CONST HALF h_rvec19[] = {
|
||||
(HALF)0x18b4, (HALF)0x9995, (HALF)0x605b, (HALF)0x2196,
|
||||
(HALF)0x1798, (HALF)0xe4fc, (HALF)0xe245, (HALF)0x5f21, (HALF)0xf172, (HALF)0x0008
|
||||
};
|
||||
static CONST HALF h_nvec20[] = {
|
||||
STATIC CONST HALF h_nvec20[] = {
|
||||
(HALF)0xd081, (HALF)0xc3c1, (HALF)0x2fce, (HALF)0x4d26,
|
||||
(HALF)0xcc91, (HALF)0x8765, (HALF)0x7f7c, (HALF)0xf372,
|
||||
(HALF)0x4bbc, (HALF)0xabba, (HALF)0x5801, (HALF)0xe098,
|
||||
@@ -2109,7 +2109,7 @@ static CONST HALF h_nvec20[] = {
|
||||
(HALF)0x63a0, (HALF)0xdddc, (HALF)0xe890, (HALF)0x3322,
|
||||
(HALF)0xd8b1, (HALF)0x20e0, (HALF)0xd2b8, (HALF)0x004f
|
||||
};
|
||||
static CONST HALF h_rvec20[] = {
|
||||
STATIC CONST HALF h_rvec20[] = {
|
||||
(HALF)0xbd1a, (HALF)0xa048, (HALF)0xdc7b, (HALF)0x95ab,
|
||||
(HALF)0x7cf8, (HALF)0x98f4, (HALF)0xc98d, (HALF)0x126a,
|
||||
(HALF)0x85fd, (HALF)0xaebf, (HALF)0x580f, (HALF)0x5650,
|
||||
@@ -2151,7 +2151,7 @@ static CONST HALF h_rvec20[] = {
|
||||
/*
|
||||
* NOTE: set n is found in random_pregen[n-1]
|
||||
*/
|
||||
static RANDOM random_pregen[BLUM_PREGEN] = {
|
||||
STATIC RANDOM random_pregen[BLUM_PREGEN] = {
|
||||
{1, 0, 7, (HALF)0, (HALF)0x07f,
|
||||
{(HALF *)h_nvec01, sizeof(h_nvec01)/sizeof(HALF), 0},
|
||||
{(HALF *)h_rvec01, sizeof(h_rvec01)/sizeof(HALF), 0}},
|
||||
@@ -2218,7 +2218,7 @@ static RANDOM random_pregen[BLUM_PREGEN] = {
|
||||
/*
|
||||
* forward static declarations
|
||||
*/
|
||||
static void zfree_random(ZVALUE z);
|
||||
S_FUNC void zfree_random(ZVALUE z);
|
||||
|
||||
|
||||
/*
|
||||
@@ -3171,7 +3171,7 @@ random_libcalc_cleanup(void)
|
||||
* given:
|
||||
* z the ZVALUE to zfree(z) if not pointing to static data
|
||||
*/
|
||||
static void
|
||||
S_FUNC void
|
||||
zfree_random(ZVALUE z)
|
||||
{
|
||||
if (z.v != NULL &&
|
||||
|
34
zrandom.h
34
zrandom.h
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* zrandom - Blum-Blum-Shub pseudo-random generator
|
||||
*
|
||||
* Copyright (C) 1999 Landon Curt Noll
|
||||
* Copyright (C) 1999-2007 Landon Curt Noll
|
||||
*
|
||||
* Calc is open software; you can redistribute it and/or modify it under
|
||||
* the terms of the version 2.1 of the GNU Lesser General Public License
|
||||
@@ -17,8 +17,8 @@
|
||||
* 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: zrandom.h,v 29.4 2001/06/08 21:00:58 chongo Exp $
|
||||
* @(#) $Revision: 29.5 $
|
||||
* @(#) $Id: zrandom.h,v 29.5 2007/02/11 10:19:14 chongo Exp $
|
||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/zrandom.h,v $
|
||||
*
|
||||
* Under source code control: 1997/02/15 04:01:56
|
||||
@@ -74,21 +74,21 @@ struct random {
|
||||
/*
|
||||
* Blum generator function declarations
|
||||
*/
|
||||
extern RANDOM *zsrandom1(CONST ZVALUE seed, BOOL need_ret);
|
||||
extern RANDOM *zsrandom2(CONST ZVALUE seed, CONST ZVALUE newn);
|
||||
extern RANDOM *zsrandom4(CONST ZVALUE seed,
|
||||
E_FUNC RANDOM *zsrandom1(CONST ZVALUE seed, BOOL need_ret);
|
||||
E_FUNC RANDOM *zsrandom2(CONST ZVALUE seed, CONST ZVALUE newn);
|
||||
E_FUNC RANDOM *zsrandom4(CONST ZVALUE seed,
|
||||
CONST ZVALUE ip, CONST ZVALUE iq, long trials);
|
||||
extern RANDOM *zsetrandom(CONST RANDOM *state);
|
||||
extern void zrandomskip(long count);
|
||||
extern void zrandom(long count, ZVALUE *res);
|
||||
extern void zrandom(long count, ZVALUE *res);
|
||||
extern void zrandomrange(CONST ZVALUE low, CONST ZVALUE beyond, ZVALUE *res);
|
||||
extern long irandom(long s);
|
||||
extern RANDOM *randomcopy(CONST RANDOM *random);
|
||||
extern void randomfree(RANDOM *random);
|
||||
extern BOOL randomcmp(CONST RANDOM *s1, CONST RANDOM *s2);
|
||||
extern void randomprint(CONST RANDOM *state, int flags);
|
||||
extern void random_libcalc_cleanup(void);
|
||||
E_FUNC RANDOM *zsetrandom(CONST RANDOM *state);
|
||||
E_FUNC void zrandomskip(long count);
|
||||
E_FUNC void zrandom(long count, ZVALUE *res);
|
||||
E_FUNC void zrandom(long count, ZVALUE *res);
|
||||
E_FUNC void zrandomrange(CONST ZVALUE low, CONST ZVALUE beyond, ZVALUE *res);
|
||||
E_FUNC long irandom(long s);
|
||||
E_FUNC RANDOM *randomcopy(CONST RANDOM *random);
|
||||
E_FUNC void randomfree(RANDOM *random);
|
||||
E_FUNC BOOL randomcmp(CONST RANDOM *s1, CONST RANDOM *s2);
|
||||
E_FUNC void randomprint(CONST RANDOM *state, int flags);
|
||||
E_FUNC void random_libcalc_cleanup(void);
|
||||
|
||||
|
||||
#endif /* !__ZRANDOM_H__ */
|
||||
|
Reference in New Issue
Block a user