Compare commits

..

4 Commits

Author SHA1 Message Date
Landon Curt Noll
2c0d0bbc1b Release calc version 2.12.1.2 2017-05-21 15:38:48 -07:00
Landon Curt Noll
a7147039ee Release calc version 2.12.1.1 2017-05-21 15:38:47 -07:00
Landon Curt Noll
6fa83e417e Release calc version 2.12.1 2017-05-21 15:38:47 -07:00
Landon Curt Noll
c335809b5f Release calc version 2.12.0.8 2017-05-21 15:38:47 -07:00
32 changed files with 1540 additions and 1202 deletions

53
BUGS
View File

@@ -68,10 +68,6 @@ of a context diff patch).
Known bugs:
The stoponerror() facility does not seem to work, or perhaps
the stoponerror help file is incorrect. The stoponerror help file
lacks examples because of this problem.
We are sure some more bugs exist. When you find them, please let
us know! See the above for details on how to report and were to
EMail your bug reports and hopefully patches to fix them.
@@ -114,51 +110,6 @@ Problems with old systems that have known work-a-rounds:
to fail the regression test. The work-a-round is to compile with -O
or to use gcc-2.96 or later.
This bug has been observed on the Sparc and the PowerPC machine.
On the PowerPC with gcc-2.95 when compiled with -O2, the following
patch seems to help:
*** zfunc.c.orig Fri Feb 23 18:18:39 2001
--- zfunc.c Fri Feb 23 18:39:33 2001
***************
*** 1481,1487 ****
{
HALF *a, *A, *b, *a0, u;
int i, j, j1, j2, k, k1, m, m0, m1, n, n0, o;
! FULL d, e, f, g, h, s, t, x, topbit;
int remsign;
BOOL up, onebit;
ZVALUE sqrt;
--- 1481,1488 ----
{
HALF *a, *A, *b, *a0, u;
int i, j, j1, j2, k, k1, m, m0, m1, n, n0, o;
! volatile FULL d;
! FULL e, f, g, h, s, t, x, topbit;
int remsign;
BOOL up, onebit;
ZVALUE sqrt;
*** zmath.c 2000/06/07 14:02:13 29.2
--- zmath.c 2001/03/13 19:47:03
***************
*** 1608,1614 ****
void
zbitvalue(long n, ZVALUE *res)
{
! ZVALUE z;
if (n < 0) n = 0;
z.sign = 0;
--- 1608,1614 ----
void
zbitvalue(long n, ZVALUE *res)
{
! volatile ZVALUE z;
if (n < 0) n = 0;
z.sign = 0;
* There are problems compiling calc on the sparcv9 under 64 bit
Solaris. On that platform, gcc-2.96 is able to compile calc, but
calc dumps core very early on in startup. It is said that sparcv9
@@ -190,8 +141,8 @@ Problems with old systems that have known work-a-rounds:
## 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.24 $
## @(#) $Id: BUGS,v 29.24 2006/05/21 07:54:13 chongo Exp $
## @(#) $Revision: 29.25 $
## @(#) $Id: BUGS,v 29.25 2006/08/20 17:51:25 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/RCS/BUGS,v $
##
## Under source code control: 1994/03/18 14:06:13

112
CHANGES
View File

@@ -1,4 +1,13 @@
The following are the changes from calc version 2.12.0 to date:
The following are the changes from calc version 2.12.1 to date:
Fixed minor typos in the 'version 2.12.0 to 2.12.0.8' section below.
Made minor formatting changes as well.
Changed use of ${Q} in the Makefile to avoid an make "feature"
related to OpenBSD.
The following are the changes from calc version 2.12.0 to 2.12.0.8:
Fixed ellip.cal to deal with a calc syntax change that happened
many ages ago but was never applied to this file until now.
@@ -109,34 +118,34 @@ The following are the changes from calc version 2.12.0 to date:
<ebowen at une dot edu dot au>, the dotest evaluates individual
lines from a file. The dotest() function takes 1 to 3 arguments:
dotest(dotest_file [,dotest_code [,dotest_maxcond]])
dotest(dotest_file [,dotest_code [,dotest_maxcond]])
dotest_file
dotest_file
Search along CALCPATH for dotest_file, which contains lines that
should evaluate to 1. Comment lines and empty lines are ignored.
Comment lines should use ## instead of the multi like /* ... */
because lines are evaluated one line at a time.
Search along CALCPATH for dotest_file, which contains lines that
should evaluate to 1. Comment lines and empty lines are ignored.
Comment lines should use ## instead of the multi like /* ... */
because lines are evaluated one line at a time.
dotest_code
dotest_code
Assign the code number that is to be printed at the start of
each non-error line and after **** in each error line.
The default code number is 999.
Assign the code number that is to be printed at the start of
each non-error line and after **** in each error line.
The default code number is 999.
dotest_maxcond
dotest_maxcond
The maximum number of error conditions that may be detected.
An error condition is not a sign of a problem, in some cases
a line deliberately forces an error condition. A value of -1,
the default, implies a maximum of 2147483647.
The maximum number of error conditions that may be detected.
An error condition is not a sign of a problem, in some cases
a line deliberately forces an error condition. A value of -1,
the default, implies a maximum of 2147483647.
Global variables and functions must be declared ahead of time because
the dotest scope of evaluation is a line at a time. For example:
Global variables and functions must be declared ahead of time because
the dotest scope of evaluation is a line at a time. For example:
; read dotest.cal
; read set8700.cal
; dotest("set8700.line");
; read dotest.cal
; read set8700.cal
; dotest("set8700.line");
Updated the todo / wish list items. The top priority now is to
convert calc to GNU autoconf / configure to build the calc.
@@ -164,7 +173,7 @@ The following are the changes from calc version 2.12.0 to date:
Made math_error() in math_error.c more robust against a error
message constant that is too long.
Made read_bindings() in hist.c more robust against very line bindings
Made read_bindings() in hist.c more robust against very long bindings
config lines.
Made listsort() in listfunc.c and matsort() matfunc.c more robust
@@ -179,8 +188,7 @@ The following are the changes from calc version 2.12.0 to date:
no other compile errors, only the unterminated comment will stop
completion of the function being defined.
Added the reading of more calc resource files to the cal/regress.cal
regression test.
The cal/regress.cal now reads most of the calc resource files.
The issq() test had a slight performance boost. A minor note
was added to the help/issq file.
@@ -192,25 +200,18 @@ The following are the changes from calc version 2.12.0 to date:
the number of bits in the fundamental base in which calculations
are performed. This is a read-only configuration value.
Calc now permits such as:
++*p-- ++*----*++p----
Calc now will allow syntax such as ++*p-- and ++*----*++p----
where p is an lvalue; successful evaluation of course require the
successive operations to be performed to have operands of appropriate
types; e.g. in *A, A is usually an lvalue whose current value is a
pointer. ++ and -- act on lvalues. In the above examples there are
implied parentheses from the beginning to immediately after p. If
there are no pre ++ or -- operations, as in
**p++
the implied parentheses are from immediately before p to the end.
there are no pre ++ or -- operations, as in **p++. The implied
parentheses are from immediately before p to the end.
Improved the error message when && is used as a prefix operator.
Changed the help/config file to read like a builtin function
help file.
Changed the help/config file to read like a builtin function help file.
One can no longer set to 1, or to a value < 0, the config()
parameters: "mul2", "sq2", "pow2", and "redc2". These values
@@ -224,10 +225,10 @@ The following are the changes from calc version 2.12.0 to date:
config("sq2") == 3388
config("pow2") == 176
These values were determined established on a 1.8GHz AMD 32-bit
CPU of ~3406 BogoMIPS by the new resource file:
These values were determined established on a 1.8GHz AMD 32-bit
CPU of ~3406 BogoMIPS by the new resource file:
cal/alg_config.cal
cal/alg_config.cal
Regarding the alg_config.cal resource file:
@@ -255,7 +256,7 @@ The following are the changes from calc version 2.12.0 to date:
inaccuracy in CPU timings will cause the best value returned to
differ slightly from run to run.
See "help resource" for more information on alg_config.cal.
See "help resource" for more information on alg_config.cal.
Updated the "help variable" text to reflect the current calc
use of ` (backquote), * (star), and & (ampersand).
@@ -304,24 +305,22 @@ The following are the changes from calc version 2.12.0 to date:
silly to use the same identifier for both a parameter and local
variable, it should not be illegal.
The provision of warnings for possibly questionable programming in
function definitions.
Added warnings for possibly questionable code in function definitions.
Added config("redecl_warn", boolean) to control if calc issues
warnings about variables being declared. The config("redecl_warn")
value is TRUE by default.
Added config("dupvar_warn", boolean) to control if calc issues
warnings about when variable names collide. Examples of variable name
collisions include when:
warnings about when variable names collide. The config("dupvar_warn")
value is TRUE by default. Examples of variable name collisions
include when:
* both local and static variables have the same name
* both local and global variables have the same name
* both function parameter and local variables have the same name
* both function parameter and global variables have the same name
The config("dupvar_warn") value is TRUE by default.
Fix of a bug which causes some static variables not to be correctly
unscoped when their identifiers are used in a global declaration.
@@ -351,7 +350,7 @@ The following are the changes from calc version 2.12.0 to date:
read sumtimes
doalltimes(1e6)
Calc now ignores carrage returns (\r), vertical tabs (\v), and
Calc now ignores carriage returns (\r), vertical tabs (\v), and
form feeds (\f) when token parsing. Thus users on Windoz systems
can write files using their \r\n format and users on non-Windoz
systems can read them without errors.
@@ -359,7 +358,7 @@ The following are the changes from calc version 2.12.0 to date:
The quomod() builtin function now takes an optional 5th argument
which controls the rounding mode like config("quomod") does, but
only for that call. Now quomod() is in line with quo() and mod()
in that the final augument is an optional rounding mode.
in that the final argument is an optional rounding mode.
Added a "make uninstall" rule which will attempt to remove everything
that was installed by a "make install".
@@ -367,6 +366,21 @@ The following are the changes from calc version 2.12.0 to date:
Changed the "Copyright" line in the rpm spec file to a "License" line
as per new rpm v4.4 syntax.
The quomod() builtin function does not allow constants for its 3rd
and 4th arguments. Updated the "help quomod" file and added more
quomod regression tests.
Added patch from Ernest Bowen <ebowen at une dot edu dot au> to
add the builtin: estr(). The estr(x) will return a representation
of a null, string, real number, complex number, list, matrix,
object. block, named block, error as a string.
Added patch from Ernest Bowen <ebowen at une dot edu dot au> to
add the builtin: fgetfile(). The fgetfile(x) will return the rest
of an open file as a string.
Improved help files for fgetfield, fputs, name, or quomod.
The following are the changes from calc version 2.11.10.1 to 2.11.11:
@@ -6187,8 +6201,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.84 $
## @(#) $Id: CHANGES,v 29.84 2006/06/26 05:53:25 chongo Exp $
## @(#) $Revision: 29.87 $
## @(#) $Id: CHANGES,v 29.87 2006/09/17 23:50:45 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/RCS/CHANGES,v $
##
## Under source code control: 1993/06/02 18:12:57

1492
Makefile

File diff suppressed because it is too large Load Diff

View File

@@ -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.21 $
# @(#) $Id: Makefile,v 29.21 2006/06/26 05:46:06 chongo Exp $
# @(#) $Revision: 29.22 $
# @(#) $Id: Makefile,v 29.22 2006/09/18 00:08:42 chongo Exp $
# @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/Makefile,v $
#
# Under source code control: 1991/07/21 05:00:54
@@ -209,17 +209,17 @@ all: ${CALC_FILES} ${MAKE_FILE} .all
##
distlist: ${DISTLIST}
${Q}for i in ${DISTLIST} /dev/null; do \
${Q} for i in ${DISTLIST} /dev/null; do \
if [ X"$$i" != X"/dev/null" ]; then \
echo cal/$$i; \
fi; \
done
distdir:
${Q}echo cal
${Q} echo cal
calcliblist:
${Q}for i in ${CALCLIBLIST} /dev/null; do \
${Q} for i in ${CALCLIBLIST} /dev/null; do \
if [ X"$$i" != X"/dev/null" ]; then \
echo cal/$$i; \
fi; \
@@ -232,7 +232,7 @@ calcliblist:
##
echo_inst_files:
${Q}for i in ${CALC_FILES} /dev/null; do \
${Q} for i in ${CALC_FILES} /dev/null; do \
if [ X"$$i" != X"/dev/null" ]; then \
echo __file__ ${CALC_SHAREDIR}/$$i; \
fi; \
@@ -254,7 +254,7 @@ clobber:
# NOTE: Keep the uninstall rule in reverse order to the install rule
#
install: all
-${Q}if [ ! -d $T${CALC_SHAREDIR} ]; then \
-${Q} if [ ! -d $T${CALC_SHAREDIR} ]; then \
echo mkdir $T${CALC_SHAREDIR}; \
mkdir $T${CALC_SHAREDIR}; \
if [ ! -d "$T${CALC_SHAREDIR}" ]; then \
@@ -266,7 +266,7 @@ install: all
else \
true; \
fi
${Q}for i in ${CALC_FILES} /dev/null; do \
${Q} for i in ${CALC_FILES} /dev/null; do \
if [ "$$i" = "/dev/null" ]; then \
continue; \
fi; \
@@ -286,7 +286,7 @@ install: all
# NOTE: Keep the uninstall rule in reverse order to the install rule
#
uninstall:
-${Q}for i in ${CALC_FILES} /dev/null; do \
-${Q} for i in ${CALC_FILES} /dev/null; do \
if [ "$$i" = "/dev/null" ]; then \
continue; \
fi; \
@@ -299,7 +299,7 @@ uninstall:
fi; \
fi; \
done
-${Q}for i in ${CALC_SHAREDIR}; do \
-${Q} for i in ${CALC_SHAREDIR}; do \
if [ -d "$T$$i" ]; then \
rmdir "$T$$i" 2>/dev/null; \
echo "cleaned up $T$$i"; \

View File

@@ -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.34 $
* @(#) $Id: regress.cal,v 29.34 2006/06/25 20:33:26 chongo Exp $
* @(#) $Revision: 29.35 $
* @(#) $Id: regress.cal,v 29.35 2006/08/20 16:16:11 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/regress.cal,v $
*
* Under source code control: 1990/02/15 01:50:36
@@ -743,6 +743,7 @@ define test_functions()
local pi;
local h, n, r, m, v;
local n2, m2, v2;
local t;
print '700: Beginning test_functions';
@@ -3461,7 +3462,7 @@ print '070: parsed test_redc()';
*/
define test_fileops()
{
local a, b, c, f, m, n, p, r, x, y, z;
local a, b, c, f, m, n, p, r, s, x, y, z;
local L = "Landon";
local C = "Curt";
local N = "Noll";
@@ -3586,15 +3587,38 @@ define test_fileops()
++ecnt;
print '4267: ++ecnt;';
vrfy(isfile(p=fopen(long,"r")) == 0,
'4268: isfile(p=fopen(long,"r")) == 0');
'4268: isfile(p=fopen(long,"r")) == 0');
/*
* test fgetfile() and fgetline()
*/
vrfy(!iserror(p=fopen("tmp4200","w")),
'4269: !iserror(p=fopen("tmp4200","w"))');
vrfy(!iserror(fputs(p,"chongo\n")),
'4270: !iserror(fputs(p,"chongo\n"))');
vrfy(!iserror(fputs(p,"w\0a\0s\n")),
'4271: !iserror(fputs(p,"w\0a\0s\n"))');
vrfy(!iserror(fputs(p,"here\n")),
'4272: !iserror(fputs(p,"here\n"))');
vrfy(!iserror(fclose(p)), '4273: !iserror(fclose(p))');
vrfy(!iserror(p=fopen("tmp4200","r")),
'4274: !iserror(p=fopen("tmp4200","r"))');
vrfy(!iserror(s=fgetline(p)), '4275: !iserror(s=fgetline(p))');
vrfy(strcmp(s,"chongo") == 0, '4276: strcmp(s,"chongo") == 0');
vrfy(!iserror(s=fgetfile(p)), '4277: !iserror(s=fgetfile(p))');
vrfy(strcmp(s,"w\0a\0s\nhere\n") == 0,
'4278: strcmp(s,"w\0a\0s\nhere\n") == 0');
vrfy(!iserror(fclose(p)), '4279: !iserror(fclose(p))');
/*
* cleanup
*/
x = rm("junk4200");
print '4269: x = rm("junk4200")';
print '4280: x = rm("junk4200")';
x = rm("tmp4200");
print '4281: x = rm("tmp4200")';
print '4270: Ending test_fileops';
print '4282: Ending test_fileops';
}
print '071: parsed test_fileops()';

View File

@@ -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.1 $
* @(#) $Id: set8700.cal,v 29.1 2006/05/20 19:35:33 chongo Exp $
* @(#) $Revision: 29.2 $
* @(#) $Id: set8700.cal,v 29.2 2006/08/20 16:16:11 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/set8700.cal,v $
*
* Under source code control: 2006/05/20 14:10:11
@@ -70,3 +70,8 @@ define set8700_g(set8700_x)
obj set8700_point {
set8700_x, set8700_y, set8700_z
}
global mat set8700_c[] = { 1, 2+3i, -5+4i, 5i+6, -7i };
global mat set8700_e[] = { 0, 1, 0, 0, 2, -3/2, 2, -1/2,
-3, 0.5, -1.0, 0.5, 1.0, 0.0, 0.0, 0.0 };

View File

@@ -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: set8700.line,v 29.2 2006/06/20 09:29:16 chongo Exp $
## @(#) $Revision: 29.4 $
## @(#) $Id: set8700.line,v 29.4 2006/08/20 16:16:11 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/set8700.line,v $
##
## Under source code control: 2006/05/20 14:10:11
@@ -402,3 +402,28 @@ set8700_P == (obj set8700_point = {1,2,3})
set8700_L = list(mat[1] = {set8700_P}), protect(set8700_L[0][0]) == 16
set8700_L = {{{4,5,6}}}, set8700_L[0][0] == set8700_P
protect(set8700_L,0,2), set8700_L = {{{4,5,6}}}, set8700_L[0][0] == (obj set8700_point = {4,5,6})
## Testing quomod
quomod(14,5,3,4) == error(10374)
global set8700_a,set8700_b; quomod("abc", 4, set8700_a, set8700_b) == error(10375)
quomod(14,5,set8700_a,set8700_b,0) == 1 && set8700_a == 2 && set8700_b == 4
quomod(14,5,set8700_a,set8700_b,1) == 1 && set8700_a == 3 && set8700_b == -1
quomod("abc",2,set8700_a,set8700_b) == error(10375)
set8700_a = "abc"; quomod(14,5,set8700_a,set8700_b) == error(10375)
set8700_a = null(); quomod(14,5,set8700_a,set8700_b,24) == 1; set8700_a == 3 && set8700_b == -1
quomod(14,5,set8700_a,set8700_a) == error(10374)
quomod(14,5,set8700_a,set8700_b,-1) == error(10375)
protect(set8700_a,1); quomod(17,2,set8700_a,set8700_b) == error(10376)
protect(set8700_a,0); quomod(17,2,set8700_a,set8700_b); set8700_a == 8 && set8700_b == 1
set8700_p = &set8700_a, set8700_q = &set8700_b; quomod(14,5,*set8700_p,*set8700_q); *set8700_p == 2 && *set8700_q == 4
## Testing estr
base(1/3) == 10
strcmp(estr(null()), "\"\"") == 0
strcmp(estr(bernoulli(48)), "-5609403368997817686249127547/46410") == 0
strcmp(estr(sin(3i)), "1001787492740990189897i/100000000000000000000") == 0
base(10) == 1/3
strcmp(estr("fizzbin"), "\"fizzbin\"") == 0
strcmp(estr(set8700_c), "mat[5]={1,2+3i,-5+4i,6+5i,-7i}") == 0
strcmp(estr(set8700_e), "mat[16]={0,1,0,0,2,-3/2,2,-1/2,-3,1/2,-1,1/2,1,0,0,0}") == 0
strcmp(estr(list(2,3,5)), "list(2,3,5)") == 0

8
calc.h
View File

@@ -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: calc.h,v 29.18 2006/05/21 07:28:54 chongo Exp $
* @(#) $Revision: 29.19 $
* @(#) $Id: calc.h,v 29.19 2006/08/20 15:01:30 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/calc.h,v $
*
* Under source code control: 1990/02/15 01:48:31
@@ -113,10 +113,10 @@ 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, char *str);
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, char **retptr);
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);

View File

@@ -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: calcerr.tbl,v 29.9 2006/06/25 20:33:26 chongo Exp $
# @(#) $Revision: 29.10 $
# @(#) $Id: calcerr.tbl,v 29.10 2006/08/20 15:01:30 chongo Exp $
# @(#) $Source: /usr/local/src/cmd/calc/RCS/calcerr.tbl,v $
#
# Under source code control: 1996/05/23 17:38:44
@@ -445,3 +445,7 @@ E_FPATHOPEN1 Non-string arguments for fpathopen
E_FPATHOPEN2 Unrecognized mode for fpathopen
E_LOG1 Bad epsilon argument for log
E_LOG2 Non-numeric first argument for log
E_FGETFILE1 Non-file argument for fgetfile
E_FGETFILE2 File argument for fgetfile not open for reading
E_FGETFILE3 Unable to set file position in fgetfile
E_ESTR Non-representable type for estr

View File

@@ -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.3 $
# @(#) $Id: check.awk,v 29.3 2006/05/20 19:43:39 chongo Exp $
# @(#) $Revision: 29.4 $
# @(#) $Id: check.awk,v 29.4 2006/08/20 16:16:31 chongo Exp $
# @(#) $Source: /usr/local/src/cmd/calc/RCS/check.awk,v $
#
# Under source code control: 1996/05/25 22:07:58
@@ -64,7 +64,7 @@ NF == 0 {
end_seen = 1;
}
$1 ~ /^[0-9]+:/ || $1 ~ /^[0-9]+-[0-9]*:/ {
$1 ~ /^[0-9]+:/ || $1 ~ /^[0-9]+-[0-9]*:/ || $1 ~ /^"))$/ {
if (error > 0) {
if (havebuf2) {
print buf2;

View File

@@ -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.24 $
# @(#) $Id: Makefile,v 29.24 2006/06/26 05:46:06 chongo Exp $
# @(#) $Revision: 29.25 $
# @(#) $Id: Makefile,v 29.25 2006/09/18 00:13:59 chongo Exp $
# @(#) $Source: /usr/local/src/cmd/calc/cscript/RCS/Makefile,v $
#
# Under source code control: 1999/11/29 11:10:26
@@ -229,21 +229,21 @@ all: ${TARGETS} .all
##
distlist: ${DISTLIST}
${Q}for i in ${DISTLIST} /dev/null; do \
${Q} for i in ${DISTLIST} /dev/null; do \
if [ X"$$i" != X"/dev/null" ]; then \
echo cscript/$$i; \
fi; \
done | LANG=C ${SORT}
distdir:
${Q}echo cscript
${Q} echo cscript
calcliblist:
# These next rule help me form the ${DETAIL_HELP} makefile variables above.
#
detaillist:
${Q}-(echo "xxxxxxx"; \
${Q} -(echo "xxxxxxx"; \
for i in ${SCRIPT} /dev/null; do \
if [ X"$$i" != X"/dev/null" ]; then \
if [ ! -f RCS/$$i.calc,v ]; then \
@@ -255,8 +255,8 @@ detaillist:
done | LANG=C ${SORT}) | ${FMT} -70 | \
${SED} -e '1s/xxxxxxx/SCRIPT=/' -e '2,$$s/^/ /' \
-e 's/$$/ \\/' -e '$$s/ \\$$//'
${Q}echo
${Q}-(echo "xxxxxxxxxxx"; \
${Q} echo
${Q} -(echo "xxxxxxxxxxx"; \
for i in ${SCRIPT} /dev/null; do \
if [ X"$$i" != X"/dev/null" ]; then \
if [ ! -f RCS/$$i.calc,v ]; then \
@@ -282,18 +282,18 @@ detaillist:
##
depend:
${Q}if [ -f Makefile.bak ]; then \
${Q} if [ -f Makefile.bak ]; then \
echo "Makefile.bak exists, remove or move it out of the way"; \
exit 1; \
else \
true; \
fi
-${Q}rm -f makedep.out
${Q}echo forming cscript dependency list
${Q}echo "# DO NOT DELETE THIS LINE -- make depend depends on it." > \
-${Q} rm -f makedep.out
${Q} echo forming cscript dependency list
${Q} echo "# DO NOT DELETE THIS LINE -- make depend depends on it." > \
makedep.out
${Q}echo "" >> makedep.out
${Q}for i in ${SCRIPT} /dev/null; do \
${Q} echo "" >> makedep.out
${Q} for i in ${SCRIPT} /dev/null; do \
if [ X"$$i" != X"/dev/null" ]; then \
echo "$$i: $$i.calc"; \
echo ' @rm -f $$@'; \
@@ -301,15 +301,15 @@ depend:
echo ' @$${CHMOD} +x $$@'; \
fi; \
done >> makedep.out
${Q}echo sample dependency list formed
${Q}echo forming new cscript/Makefile
-${Q}rm -f Makefile.bak
${Q}mv Makefile Makefile.bak
${Q}${SED} -n '1,/^# DO NOT DELETE THIS LINE/p' Makefile.bak > Makefile
${Q}echo "" >> Makefile
${Q}${SED} -n '3,$$p' makedep.out >> Makefile
-${Q}rm -f makedep.out
-${Q}if ${CMP} -s Makefile.bak Makefile; then \
${Q} echo sample dependency list formed
${Q} echo forming new cscript/Makefile
-${Q} rm -f Makefile.bak
${Q} mv Makefile Makefile.bak
${Q} ${SED} -n '1,/^# DO NOT DELETE THIS LINE/p' Makefile.bak > Makefile
${Q} echo "" >> Makefile
${Q} ${SED} -n '3,$$p' makedep.out >> Makefile
-${Q} rm -f makedep.out
-${Q} if ${CMP} -s Makefile.bak Makefile; then \
echo 'sample Makefile was already up to date'; \
mv -f Makefile.bak Makefile; \
else \
@@ -331,7 +331,7 @@ depend:
##
echo_inst_files:
${Q}for i in ${SCRIPT} /dev/null; do \
${Q} for i in ${SCRIPT} /dev/null; do \
if [ X"$$i" != X"/dev/null" ]; then \
echo __file__ ${SCRIPTDIR}/$$i; \
fi; \
@@ -354,7 +354,7 @@ clobber:
# NOTE: Keep the uninstall rule in reverse order to the install rule
#
install: all
-${Q}if [ ! -d $T${BINDIR} ]; then \
-${Q} if [ ! -d $T${BINDIR} ]; then \
echo mkdir $T${BINDIR}; \
mkdir $T${BINDIR}; \
if [ ! -d "$T${BINDIR}" ]; then \
@@ -366,7 +366,7 @@ install: all
else \
true; \
fi
-${Q}if [ ! -d $T${SCRIPTDIR} ]; then \
-${Q} if [ ! -d $T${SCRIPTDIR} ]; then \
echo mkdir $T${SCRIPTDIR}; \
mkdir $T${SCRIPTDIR}; \
if [ ! -d "$T${SCRIPTDIR}" ]; then \
@@ -378,7 +378,7 @@ install: all
else \
true; \
fi
${Q}for i in ${SCRIPT} /dev/null; do \
${Q} for i in ${SCRIPT} /dev/null; do \
if [ "$$i" = "/dev/null" ]; then \
continue; \
fi; \
@@ -398,7 +398,7 @@ install: all
# NOTE: Keep the uninstall rule in reverse order to the install rule
#
uninstall:
-${Q}for i in ${SCRIPT} /dev/null; do \
-${Q} for i in ${SCRIPT} /dev/null; do \
if [ "$$i" = "/dev/null" ]; then \
continue; \
fi; \
@@ -411,7 +411,7 @@ uninstall:
fi; \
fi; \
done
-${Q}for i in ${SCRIPTDIR} ${BINDIR}; do \
-${Q} for i in ${SCRIPTDIR} ${BINDIR}; do \
if [ -d "$T$$i" ]; then \
rmdir "$T$$i" 2>/dev/null; \
echo "cleaned up $T$$i"; \

View File

@@ -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.25 $
# @(#) $Id: Makefile,v 29.25 2006/06/26 05:46:06 chongo Exp $
# @(#) $Revision: 29.26 $
# @(#) $Id: Makefile,v 29.26 2006/09/18 00:13:59 chongo Exp $
# @(#) $Source: /usr/local/src/cmd/calc/custom/RCS/Makefile,v $
#
# Under source code control: 1997/03/09 02:28:54
@@ -452,17 +452,17 @@ c_sysinfo.o: c_sysinfo.c ${MAKE_FILE}
##
distlist: ${DISTLIST}
${Q}for i in ${DISTLIST} /dev/null; do \
${Q} for i in ${DISTLIST} /dev/null; do \
if [ X"$$i" != X"/dev/null" ]; then \
echo custom/$$i; \
fi; \
done
distdir:
${Q}echo custom
${Q} echo custom
calcliblist: ${CALCLIBLIST}
${Q}for i in ${CALCLIBLIST} /dev/null; do \
${Q} for i in ${CALCLIBLIST} /dev/null; do \
if [ X"$$i" != X"/dev/null" ]; then \
echo custom/$$i; \
fi; \
@@ -481,23 +481,23 @@ calcliblist: ${CALCLIBLIST}
##
depend:
${Q}if [ -f Makefile.bak ]; then \
${Q} if [ -f Makefile.bak ]; then \
echo "Makefile.bak exists, remove or move it out of the way"; \
exit 1; \
else \
true; \
fi
${Q}echo forming custom/skel
-${Q}rm -rf skel
${Q}mkdir skel
${Q}mkdir skel/custom
-${Q}for i in ${C_SRC} /dev/null; do \
${Q} echo forming custom/skel
-${Q} rm -rf skel
${Q} mkdir skel
${Q} mkdir skel/custom
-${Q} for i in ${C_SRC} /dev/null; do \
if [ X"$$i" != X"/dev/null" ]; then \
${SED} -n '/^#[ ]*include[ ]*"/p' \
"$$i" > "skel/custom/$$i"; \
fi; \
done
-${Q}for i in ${H_SRC} /dev/null; do \
-${Q} for i in ${H_SRC} /dev/null; do \
if [ "$$i" = "/dev/null" ]; then \
continue; \
fi; \
@@ -508,8 +508,8 @@ depend:
>> "skel/custom/$$i"; \
echo '#endif /* '"$$tag"' */' >> "skel/custom/$$i"; \
done
${Q}(cd ..; ${MAKE} hsrc)
${Q}for i in `cd ..; ${MAKE} h_list 2>&1 | \
${Q} (cd ..; ${MAKE} hsrc)
${Q} for i in `cd ..; ${MAKE} h_list 2>&1 | \
${SED} -e '/Entering directory/d' \
-e '/Nothing to be done/d' \
-e '/Leaving directory/d'` /dev/null; do \
@@ -523,27 +523,27 @@ depend:
>> "skel/$$i"; \
echo '#endif /* '"$$tag"' */' >> "skel/$$i"; \
done
-${Q}rm -f skel/custom/makedep.out
${Q}echo custom/skel formed
${Q}echo forming custom dependency list
${Q}echo "# DO NOT DELETE THIS LINE -- make depend depends on it." > \
-${Q} rm -f skel/custom/makedep.out
${Q} echo custom/skel formed
${Q} echo forming custom dependency list
${Q} echo "# DO NOT DELETE THIS LINE -- make depend depends on it." > \
skel/custom/makedep.out
${Q}cd skel/custom; ${MAKEDEPEND} -w 1 -f makedep.out ${C_SRC}
-${Q}for i in ${C_SRC} /dev/null; do \
${Q} cd skel/custom; ${MAKEDEPEND} -w 1 -f makedep.out ${C_SRC}
-${Q} for i in ${C_SRC} /dev/null; do \
if [ X"$$i" != X"/dev/null" ]; then \
echo "$$i" | ${SED} 's/^\(.*\)\.c/\1.o: \1.c/'; \
fi; \
done >> skel/custom/makedep.out
${Q}echo custom dependency list formed
${Q}echo forming new custom/Makefile
-${Q}rm -f Makefile.bak
${Q}mv Makefile Makefile.bak
${Q}${SED} -n '1,/^# DO NOT DELETE THIS LINE/p' Makefile.bak > Makefile
${Q}echo "" >> Makefile
${Q}${SED} -n '3,$$p' skel/custom/makedep.out | \
${Q} echo custom dependency list formed
${Q} echo forming new custom/Makefile
-${Q} rm -f Makefile.bak
${Q} mv Makefile Makefile.bak
${Q} ${SED} -n '1,/^# DO NOT DELETE THIS LINE/p' Makefile.bak > Makefile
${Q} echo "" >> Makefile
${Q} ${SED} -n '3,$$p' skel/custom/makedep.out | \
LANG=C ${SORT} -u >> Makefile
-${Q}rm -rf skel
-${Q}if ${CMP} -s Makefile.bak Makefile; then \
-${Q} rm -rf skel
-${Q} if ${CMP} -s Makefile.bak Makefile; then \
echo 'custom Makefile was already up to date'; \
mv -f Makefile.bak Makefile; \
else \
@@ -565,22 +565,22 @@ depend:
##
echo_inst_files:
${Q}for i in ${INSTALL_H_SRC} /dev/null; do \
${Q} for i in ${INSTALL_H_SRC} /dev/null; do \
if [ X"$$i" != X"/dev/null" ]; then \
echo __file__ ${CUSTOMINCDIR}/$$i; \
fi; \
done
${Q}for i in ${CUSTOM_HELP} /dev/null; do \
${Q} for i in ${CUSTOM_HELP} /dev/null; do \
if [ X"$$i" != X"/dev/null" ]; then \
echo __file__ ${CUSTOMHELPDIR}/$$i; \
fi; \
done
${Q}for i in ${CUSTOM_CALC_FILES} /dev/null; do \
${Q} for i in ${CUSTOM_CALC_FILES} /dev/null; do \
if [ X"$$i" != X"/dev/null" ]; then \
echo __file__ ${CUSTOMCALDIR}/$$i; \
fi; \
done
${Q}for i in ${CALC_LIBCUSTOM} /dev/null; do \
${Q} for i in ${CALC_LIBCUSTOM} /dev/null; do \
if [ X"$$i" != X"/dev/null" ]; then \
echo __file__ ${CUSTOMCALDIR}/$$i; \
fi; \
@@ -604,7 +604,7 @@ clobber:
# NOTE: Keep the uninstall rule in reverse order to the install rule
#
install: all
-${Q}if [ ! -d $T${INCDIR} ]; then \
-${Q} if [ ! -d $T${INCDIR} ]; then \
echo mkdir $T${INCDIR}; \
mkdir $T${INCDIR}; \
if [ ! -d "$T${INCDIR}" ]; then \
@@ -616,7 +616,7 @@ install: all
else \
true; \
fi
-${Q}if [ ! -d $T${CALC_SHAREDIR} ]; then \
-${Q} if [ ! -d $T${CALC_SHAREDIR} ]; then \
echo mkdir $T${CALC_SHAREDIR}; \
mkdir $T${CALC_SHAREDIR}; \
if [ ! -d "$T${CALC_SHAREDIR}" ]; then \
@@ -628,7 +628,7 @@ install: all
else \
true; \
fi
-${Q}if [ ! -d $T${CALC_INCDIR} ]; then \
-${Q} if [ ! -d $T${CALC_INCDIR} ]; then \
echo mkdir $T${CALC_INCDIR}; \
mkdir $T${CALC_INCDIR}; \
if [ ! -d "$T${CALC_INCDIR}" ]; then \
@@ -640,7 +640,7 @@ install: all
else \
true; \
fi
-${Q}if [ ! -d $T${HELPDIR} ]; then \
-${Q} if [ ! -d $T${HELPDIR} ]; then \
echo mkdir $T${HELPDIR}; \
mkdir $T${HELPDIR}; \
if [ ! -d "$T${HELPDIR}" ]; then \
@@ -652,7 +652,7 @@ install: all
else \
true; \
fi
-${Q}if [ ! -d $T${CUSTOMCALDIR} ]; then \
-${Q} if [ ! -d $T${CUSTOMCALDIR} ]; then \
echo mkdir $T${CUSTOMCALDIR}; \
mkdir $T${CUSTOMCALDIR}; \
if [ ! -d "$T${CUSTOMCALDIR}" ]; then \
@@ -664,7 +664,7 @@ install: all
else \
true; \
fi
-${Q}if [ ! -d $T${CUSTOMHELPDIR} ]; then \
-${Q} if [ ! -d $T${CUSTOMHELPDIR} ]; then \
echo mkdir $T${CUSTOMHELPDIR}; \
mkdir $T${CUSTOMHELPDIR}; \
if [ ! -d "$T${CUSTOMHELPDIR}" ]; then \
@@ -676,7 +676,7 @@ install: all
else \
true; \
fi
-${Q}if [ ! -d $T${CUSTOMINCDIR} ]; then \
-${Q} if [ ! -d $T${CUSTOMINCDIR} ]; then \
echo mkdir $T${CUSTOMINCDIR}; \
mkdir $T${CUSTOMINCDIR}; \
if [ ! -d "$T${CUSTOMINCDIR}" ]; then \
@@ -688,7 +688,7 @@ install: all
else \
true; \
fi
-${Q}for i in ${INSTALL_H_SRC} /dev/null; do \
-${Q} for i in ${INSTALL_H_SRC} /dev/null; do \
if [ "$$i" = "/dev/null" ]; then \
continue; \
fi; \
@@ -702,7 +702,7 @@ install: all
echo "installed $T${CUSTOMINCDIR}/$$i"; \
fi; \
done
-${Q}for i in ${CUSTOM_CALC_FILES} /dev/null; do \
-${Q} for i in ${CUSTOM_CALC_FILES} /dev/null; do \
if [ "$$i" = "/dev/null" ]; then \
continue; \
fi; \
@@ -716,7 +716,7 @@ install: all
echo "installed $T${CUSTOMCALDIR}/$$i"; \
fi; \
done
-${Q}for i in ${CUSTOM_HELP} /dev/null; do \
-${Q} for i in ${CUSTOM_HELP} /dev/null; do \
if [ "$$i" = "/dev/null" ]; then \
continue; \
fi; \
@@ -730,7 +730,7 @@ install: all
echo "installed $T${CUSTOMHELPDIR}/$$i"; \
fi; \
done
-${Q}if [ ! -z ${ALLOW_CUSTOM} ]; then \
-${Q} if [ ! -z ${ALLOW_CUSTOM} ]; then \
if ${CMP} -s libcustcalc.a $T${CUSTOMCALDIR}/libcustcalc.a; then \
true; \
else \
@@ -749,7 +749,7 @@ install: all
# NOTE: Keep the uninstall rule in reverse order to the install rule
#
uninstall:
-${Q}if [ -f "$T${CUSTOMCALDIR}/libcustcalc.a" ]; then \
-${Q} if [ -f "$T${CUSTOMCALDIR}/libcustcalc.a" ]; then \
rm -f "$T${CUSTOMCALDIR}/libcustcalc.a"; \
if [ -f "$T${CUSTOMCALDIR}/libcustcalc.a" ]; then \
echo "cannot uninstall $T${CUSTOMCALDIR}/libcustcalc.a"; \
@@ -757,7 +757,7 @@ uninstall:
echo "uninstalled $T${CUSTOMCALDIR}/libcustcalc.a"; \
fi; \
fi
-${Q}for i in ${CUSTOM_HELP} /dev/null; do \
-${Q} for i in ${CUSTOM_HELP} /dev/null; do \
if [ "$$i" = "/dev/null" ]; then \
continue; \
fi; \
@@ -770,7 +770,7 @@ uninstall:
fi; \
fi; \
done
-${Q}for i in ${CUSTOM_CALC_FILES} /dev/null; do \
-${Q} for i in ${CUSTOM_CALC_FILES} /dev/null; do \
if [ "$$i" = "/dev/null" ]; then \
continue; \
fi; \
@@ -783,7 +783,7 @@ uninstall:
fi; \
fi; \
done
-${Q}for i in ${INSTALL_H_SRC} /dev/null; do \
-${Q} for i in ${INSTALL_H_SRC} /dev/null; do \
if [ "$$i" = "/dev/null" ]; then \
continue; \
fi; \
@@ -796,7 +796,7 @@ uninstall:
fi; \
fi; \
done
-${Q}for i in ${CUSTOMINCDIR} ${CUSTOMHELPDIR} ${CUSTOMCALDIR} \
-${Q} for i in ${CUSTOMINCDIR} ${CUSTOMHELPDIR} ${CUSTOMCALDIR} \
${HELPDIR} ${CALC_INCDIR} ${CALC_SHAREDIR} ${INCDIR}; do \
if [ -d "$T$$i" ]; then \
rmdir "$T$$i" 2>/dev/null; \

38
file.c
View File

@@ -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.15 $
* @(#) $Id: file.c,v 29.15 2006/05/22 19:04:45 chongo Exp $
* @(#) $Revision: 29.16 $
* @(#) $Id: file.c,v 29.16 2006/08/20 15:01:30 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/file.c,v $
*
* Under source code control: 1991/07/20 00:21:56
@@ -746,10 +746,10 @@ flushall(void)
* given:
* id file to read from
* flags read flags (see above)
* retptr returned pointer to string
* retstr returned pointer to string
*/
int
readid(FILEID id, int flags, char **retptr)
readid(FILEID id, int flags, STRING **retstr)
{
FILEIO *fiop; /* file structure */
FILE *fp;
@@ -761,6 +761,7 @@ readid(FILEID id, int flags, char **retptr)
int c;
BOOL nlstop, nullstop, wsstop, rmstop, done;
FILEPOS fpos;
STRING *newstr;
totlen = 0;
str = NULL;
@@ -831,7 +832,10 @@ readid(FILEID id, int flags, char **retptr)
if ((nullstop && c == '\0') && !rmstop)
str[totlen - 1] = '\0';
str[totlen] = '\0';
*retptr = str;
newstr = stralloc();
newstr->s_len = totlen;
newstr->s_str = str;
*retstr = newstr;
return 0;
}
@@ -895,7 +899,7 @@ printid(FILEID id, int flags)
math_chr('"');
return 0;
}
math_fmt("FILE %d \"%s\" (%s, ", id, fiop->name, fiop->mode);
math_fmt("FILE %d \"%s\" (%s", id, fiop->name, fiop->mode);
/*
* print file position
@@ -904,11 +908,13 @@ printid(FILEID id, int flags)
fp = fiop->fp;
if (get_open_pos(fp, &pos) < 0) {
math_str("Error while determining file position!)");
if (fileno(fp) > 2)
math_str("Error while determining file position!");
math_chr(')');
return 0;
}
math_str("pos ");
math_str(", pos ");
zprintval(pos, 0, 0);
zfree(pos);
@@ -1233,10 +1239,13 @@ idungetc(FILEID id, int ch)
* str string to write
*/
int
idfputs(FILEID id, char *str)
idfputs(FILEID id, STRING *str)
{
FILEIO *fiop;
FILEPOS fpos;
FILE *fp;
char *c;
long len;
/* get the file info pointer */
fiop = findid(id, TRUE);
@@ -1251,14 +1260,13 @@ idfputs(FILEID id, char *str)
fiop->action = 'w';
/* set output to file */
math_setfp(fiop->fp);
fp = fiop->fp;
len = str->s_len;
c = str->s_str;
/* write the string */
math_str(str);
while (len-- > 0)
fputc(*c++, fp);
/* restore output to stdout */
math_setfp(stdout);
return 0;
}

92
func.c
View File

@@ -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.28 $
* @(#) $Id: func.c,v 29.28 2006/06/25 20:33:26 chongo Exp $
* @(#) $Revision: 29.30 $
* @(#) $Id: func.c,v 29.30 2006/08/20 15:01:30 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/func.c,v $
*
* Under source code control: 1990/02/15 01:48:15
@@ -357,6 +357,24 @@ f_str(VALUE *vp)
}
static VALUE
f_estr(VALUE *vp)
{
VALUE result;
char *cp;
/* initialize result */
result.v_type = V_STR;
result.v_subtype = V_NOSUBTYPE;
math_divertio();
printestr(vp);
cp = math_getdivertedio();
result.v_str = makestring(cp);
return result;
}
static VALUE
f_name(VALUE *vp)
{
@@ -3572,14 +3590,16 @@ f_quomod(int count, VALUE **vals)
v3 = vals[2];
v4 = vals[3];
if (v3->v_type != V_ADDR || v4->v_type != V_ADDR)
return error_value(E_QUOMOD1);
if (v3->v_type != V_ADDR || v4->v_type != V_ADDR ||
v3->v_addr == v4->v_addr)
return error_value(E_QUOMOD1);
if (count == 5) {
v5 = vals[4];
if (v5->v_type == V_ADDR)
v5 = v5->v_addr;
if (v5->v_type != V_NUM || qisfrac(v5->v_num) ||
qisneg(v5->v_num)) return error_value(E_QUOMOD2);
qisneg(v5->v_num) || zge31b(v5->v_num->num))
return error_value(E_QUOMOD2);
rnd = qtoi(v5->v_num);
} else
rnd = conf->quomod;
@@ -3588,22 +3608,29 @@ f_quomod(int count, VALUE **vals)
v1 = v1->v_addr;
if (v2->v_type == V_ADDR)
v2 = v2->v_addr;
if (v1->v_type != V_NUM || v2->v_type != V_NUM)
return error_value(E_QUOMOD2);
v3 = v3->v_addr;
v4 = v4->v_addr;
if (v1->v_type != V_NUM || v2->v_type != V_NUM ||
(v3->v_type != V_NUM && v3->v_type != V_NULL) ||
(v4->v_type != V_NUM && v4->v_type != V_NULL))
return error_value(E_QUOMOD2);
s3 = v3->v_subtype;
s4 = v4->v_subtype;
if ((s3 | s4) & V_NOASSIGNTO)
return error_value(E_QUOMOD3);
freevalue(v3);
freevalue(v4);
v3->v_type = V_NUM;
v4->v_type = V_NUM;
v3->v_subtype = s3;
v4->v_subtype = s4;
res = qquomod(v1->v_num, v2->v_num, &v3->v_num, &v4->v_num, rnd);
result.v_type = V_NUM;
result.v_subtype = V_NOSUBTYPE;
@@ -5827,7 +5854,7 @@ strscan(char *s, int count, VALUE **vals)
static int
filescan(FILEID id, int count, VALUE **vals)
{
char *str;
STRING *str;
int i;
int n = 0;
VALUE val;
@@ -5848,7 +5875,7 @@ filescan(FILEID id, int count, VALUE **vals)
if (i > 0)
return EOF;
n++;
val.v_str = makenewstring(str);
val.v_str = str;
result = f_eval(&val);
var = *vals++;
if (var->v_type == V_ADDR) {
@@ -6095,7 +6122,7 @@ f_fputs(int count, VALUE **vals)
return error_value(E_FPUTS2);
}
for (i = 1; i < count; i++) {
err = idfputs(vals[0]->v_file, vals[i]->v_str->s_str);
err = idfputs(vals[0]->v_file, vals[i]->v_str);
if (err > 0)
return error_value(E_FPUTS3);
}
@@ -6242,7 +6269,7 @@ static VALUE
f_fgetline(VALUE *vp)
{
VALUE result;
char *str;
STRING *str;
int i;
/* initialize VALUE */
@@ -6256,7 +6283,7 @@ f_fgetline(VALUE *vp)
result.v_type = V_NULL;
if (i == 0) {
result.v_type = V_STR;
result.v_str = makestring(str);
result.v_str = str;
}
return result;
}
@@ -6266,7 +6293,7 @@ static VALUE
f_fgets(VALUE *vp)
{
VALUE result;
char *str;
STRING *str;
int i;
/* initialize VALUE */
@@ -6280,7 +6307,7 @@ f_fgets(VALUE *vp)
result.v_type = V_NULL;
if (i == 0) {
result.v_type = V_STR;
result.v_str = makestring(str);
result.v_str = str;
}
return result;
}
@@ -6290,7 +6317,7 @@ static VALUE
f_fgetstr(VALUE *vp)
{
VALUE result;
char *str;
STRING *str;
int i;
/* initialize VALUE */
@@ -6304,7 +6331,7 @@ f_fgetstr(VALUE *vp)
result.v_type = V_NULL;
if (i == 0) {
result.v_type = V_STR;
result.v_str = makestring(str);
result.v_str = str;
}
return result;
}
@@ -6314,7 +6341,7 @@ static VALUE
f_fgetfield(VALUE *vp)
{
VALUE result;
char *str;
STRING *str;
int i;
/* initialize VALUE */
@@ -6328,7 +6355,32 @@ f_fgetfield(VALUE *vp)
result.v_type = V_NULL;
if (i == 0) {
result.v_type = V_STR;
result.v_str = makestring(str);
result.v_str = str;
}
return result;
}
static VALUE
f_fgetfile(VALUE *vp)
{
VALUE result;
STRING *str;
int i;
/* initialize VALUE */
result.v_subtype = V_NOSUBTYPE;
if (vp->v_type != V_FILE)
return error_value(E_FGETFILE1);
i = readid(vp->v_file, 0, &str);
if (i == 1)
return error_value(E_FGETFILE2);
if (i == 3)
return error_value(E_FGETFILE3);
result.v_type = V_NULL;
if (i == 0) {
result.v_type = V_STR;
result.v_str = str;
}
return result;
}
@@ -8165,6 +8217,8 @@ static CONST struct builtin builtins[] = {
"set or read calc_errno"},
{"error", 0, 1, 0, OP_NOP, 0, f_error,
"generate error value"},
{"estr", 1, 1, 0, OP_NOP, 0, f_estr,
"exact text string representation of value"},
{"euler", 1, 1, 0, OP_NOP, 0, f_euler,
"Euler number"},
{"eval", 1, 1, 0, OP_NOP, 0, f_eval,
@@ -8195,6 +8249,8 @@ static CONST struct builtin builtins[] = {
"read next char from file"},
{"fgetfield", 1, 1, 0, OP_NOP, 0, f_fgetfield,
"read next white-space delimited field from file"},
{"fgetfile", 1, 1, 0, OP_NOP, 0, f_fgetfile,
"read to end of file"},
{"fgetline", 1, 1, 0, OP_NOP, 0, f_fgetline,
"read next line from file, newline removed"},
{"fgets", 1, 1, 0, OP_NOP, 0, f_fgets,

View File

@@ -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/06/26 05:46:06 chongo Exp $
# @(#) $Revision: 29.31 $
# @(#) $Id: Makefile,v 29.31 2006/09/18 00:13:59 chongo Exp $
# @(#) $Source: /usr/local/src/cmd/calc/help/RCS/Makefile,v $
#
# Under source code control: 1991/07/23 06:47:57
@@ -267,15 +267,15 @@ BLT_HELP_FILES= ${BLT_HELP_FILES_3} ${BLT_HELP_FILES_5} \
#
DETAIL_HELP= abs access acos acosh acot acoth acsc acsch address agd append \
appr arg argv arrow asec asech asin asinh assign atan atan2 atanh \
avg base base2 bernoulli bit blk blkcpy blkfree blocks bround btrunc \
calc_tty calclevel catalan ceil cfappr cfsim char cmdbuf cmp comb \
conj cos cosh cot coth count cp csc csch ctime delete den dereference \
det digit digits display dp epsilon errcount errmax errno error \
euler eval exp fact factor fclose fcnt feof ferror fflush fgetc \
fgetfield fgetline fgets fgetstr fib files floor fopen forall \
fpathopen fprintf fputc fputs fputstr frac free freebernoulli \
freeeuler freeglobals freeredc freestatics frem freopen fscan \
fscanf fseek fsize ftell gcd gcdrem gd getenv hash head highbit \
avg base base2 bernoulli bit blk blkcpy blkfree blocks bround \
btrunc calc_tty calclevel catalan ceil cfappr cfsim char cmdbuf \
cmp comb conj cos cosh cot coth count cp csc csch ctime delete den \
dereference det digit digits display dp epsilon errcount errmax \
errno error estr euler eval exp fact factor fclose fcnt feof ferror \
fflush fgetc fgetfield fgetfile fgetline fgets fgetstr fib files \
floor fopen forall fpathopen fprintf fputc fputs fputstr frac free \
freebernoulli freeeuler freeglobals freeredc freestatics frem freopen \
fscan fscanf fseek fsize ftell gcd gcdrem gd getenv hash head highbit \
hmean hnrmod hypot ilog ilog10 ilog2 im indices inputlevel insert \
int inverse iroot isassoc isatty isblk isconfig isdefined iserror \
iseven isfile ishash isident isint islist ismat ismult isnull isnum \
@@ -487,9 +487,9 @@ cscript: ../cscript/README
fi
full: ${FULL_HELP_FILES} ${MAKE_FILE}
${Q}echo "forming full"
-${Q}rm -f $@
-${Q}for i in ${FULL_HELP_FILES}; do \
${Q} echo "forming full"
-${Q} rm -f $@
-${Q} for i in ${FULL_HELP_FILES}; do \
if [ Xintro != X"$$i" ]; then \
echo " "; \
else \
@@ -506,7 +506,7 @@ full: ${FULL_HELP_FILES} ${MAKE_FILE}
echo ""; \
cat $$i; \
done > $@
${Q}echo "full formed"
${Q} echo "full formed"
-@if [ -z "${Q}" ]; then \
echo ''; \
echo '=-=-= skipping the cat of help/$@ =-=-='; \
@@ -518,7 +518,7 @@ full: ${FULL_HELP_FILES} ${MAKE_FILE}
# Singular files are the same files as their plural form.
#
${SINGULAR_FILES}: ${PLURAL_FILES}
${Q}for i in ${SINGULAR_FILES} /dev/null; do \
${Q} for i in ${SINGULAR_FILES} /dev/null; do \
if [ X"$$i" != X"/dev/null" ]; then \
echo "rm -f $${i}"; \
rm -f $${i}; \
@@ -553,19 +553,19 @@ ${SINGULAR_FILES}: ${PLURAL_FILES}
# do not treat -I.. correctly!
#
builtin: builtin.top builtin.end ../func.c funclist.sed
${Q}echo "forming builtin help file"
-${Q}rm -f funclist.c
${Q}${SED} -n -f funclist.sed ../func.c > funclist.c
-${Q}rm -f funclist.o funclist${EXT}
${Q}${LCC} ${ICFLAGS} -DFUNCLIST -I/usr/include \
${Q} echo "forming builtin help file"
-${Q} rm -f funclist.c
${Q} ${SED} -n -f funclist.sed ../func.c > funclist.c
-${Q} rm -f funclist.o funclist${EXT}
${Q} ${LCC} ${ICFLAGS} -DFUNCLIST -I/usr/include \
-I.. funclist.c -c 2>/dev/null
${Q}${LCC} ${ILDFLAGS} funclist.o -o funclist${EXT}
-${Q}rm -f builtin
${Q}cat builtin.top > builtin
${Q}./funclist${EXT} | \
${Q} ${LCC} ${ILDFLAGS} funclist.o -o funclist${EXT}
-${Q} rm -f builtin
${Q} cat builtin.top > builtin
${Q} ./funclist${EXT} | \
${SED} -e 's/^/ /' -e 's/[ ][ ]*$$//' >> builtin
${Q}cat builtin.end >> builtin
${Q}echo "builtin help file formed"
${Q} cat builtin.end >> builtin
${Q} echo "builtin help file formed"
-@if [ -z "${Q}" ]; then \
echo ''; \
echo '=-=-= skipping the cat of help/$@ =-=-='; \
@@ -585,17 +585,17 @@ builtin: builtin.top builtin.end ../func.c funclist.sed
##
distlist: ${DISTLIST}
${Q}for i in ${DISTLIST} /dev/null; do \
${Q} for i in ${DISTLIST} /dev/null; do \
if [ X"$$i" != X"/dev/null" ]; then \
echo help/$$i; \
fi; \
done | LANG=C ${SORT}
distdir:
${Q}echo help
${Q} echo help
calcliblist:
${Q}for i in ${CALCLIBLIST} /dev/null; do \
${Q} for i in ${CALCLIBLIST} /dev/null; do \
if [ X"$$i" != X"/dev/null" ]; then \
echo help/$$i; \
fi; \
@@ -612,7 +612,7 @@ bsdi: all
# These next rule help me form the ${DETAIL_HELP} makefile variables above.
#
detaillist:
${Q}-(echo "xxxxx"; \
${Q} -(echo "xxxxx"; \
for i in ${DETAIL_HELP} /dev/null; do \
if [ X"$$i" != X"/dev/null" ]; then \
if [ ! -f RCS/$$i,v ]; then \
@@ -632,13 +632,13 @@ detaillist:
##
echo_inst_files:
${Q}for i in ${STD_HELP_FILES} full ${BLT_HELP_FILES} \
${Q} for i in ${STD_HELP_FILES} full ${BLT_HELP_FILES} \
builtin ${DETAIL_HELP} ${SINGULAR_FILES} /dev/null; do \
if [ X"$$i" != X"/dev/null" ]; then \
echo __file__ ${HELPDIR}/$$i; \
fi; \
done
${Q}echo __file__ ${HELPDIR}/obj
${Q} echo __file__ ${HELPDIR}/obj
##
#
@@ -661,7 +661,7 @@ clobber:
# NOTE: Keep the uninstall rule in reverse order to the install rule
#
install: all
-${Q}if [ ! -d $T${CALC_SHAREDIR} ]; then \
-${Q} if [ ! -d $T${CALC_SHAREDIR} ]; then \
echo mkdir $T${CALC_SHAREDIR}; \
mkdir $T${CALC_SHAREDIR}; \
if [ ! -d "$T${CALC_SHAREDIR}" ]; then \
@@ -673,7 +673,7 @@ install: all
else \
true; \
fi
-${Q}if [ ! -d $T${HELPDIR} ]; then \
-${Q} if [ ! -d $T${HELPDIR} ]; then \
echo mkdir $T${HELPDIR}; \
mkdir $T${HELPDIR}; \
if [ ! -d "$T${HELPDIR}" ]; then \
@@ -685,7 +685,7 @@ install: all
else \
true; \
fi
-${Q}for i in ${STD_HELP_FILES} ${BLT_HELP_FILES} builtin \
-${Q} for i in ${STD_HELP_FILES} ${BLT_HELP_FILES} builtin \
full ${DETAIL_HELP} ${SINGULAR_FILES} /dev/null; do \
if [ "$$i" = "/dev/null" ]; then \
continue; \
@@ -700,7 +700,7 @@ install: all
echo "installed $T${HELPDIR}/$$i"; \
fi; \
done
-${Q}if ${CMP} -s obj.file $T${HELPDIR}/obj; then \
-${Q} if ${CMP} -s obj.file $T${HELPDIR}/obj; then \
true; \
else \
rm -f $T${HELPDIR}/obj.new; \
@@ -715,7 +715,7 @@ install: all
# NOTE: Keep the uninstall rule in reverse order to the install rule
#
uninstall:
-${Q}if [ -f "$T${HELPDIR}/obj" ]; then \
-${Q} if [ -f "$T${HELPDIR}/obj" ]; then \
rm -f "$T${HELPDIR}/obj"; \
if [ -f "$T${HELPDIR}/obj" ]; then \
echo "cannot uninstall $T${HELPDIR}/obj"; \
@@ -723,7 +723,7 @@ uninstall:
echo "uninstalled $T${HELPDIR}/obj"; \
fi; \
fi
-${Q}for i in ${SINGULAR_FILES} ${DETAIL_HELP} full builtin \
-${Q} for i in ${SINGULAR_FILES} ${DETAIL_HELP} full builtin \
${BLT_HELP_FILES} ${STD_HELP_FILES} /dev/null; do \
if [ "$$i" = "/dev/null" ]; then \
continue; \
@@ -737,7 +737,7 @@ uninstall:
fi; \
fi; \
done
-${Q}for i in ${HELPDIR} ${CALC_SHAREDIR}; do \
-${Q} for i in ${HELPDIR} ${CALC_SHAREDIR}; do \
if [ -d "$T$$i" ]; then \
rmdir "$T$$i" 2>/dev/null; \
echo "cleaned up $T$$i"; \

45
help/estr Normal file
View File

@@ -0,0 +1,45 @@
NAME
estr - represent some types of value by text strings
SYNOPSIS
estr(x)
TYPES
x null, string, real or complex number, list, matrix,
object. block, named block, error
return string
DESCRIPTION
This function attempts to represent x exactly by a string s of
ordinary text characters such that eval(s) == x.
If x is null, estr(x) returns the string "".
If x is a string, estr(x) returns the string in which occurrences of
newline, tab, ", \, etc. have been converted to \n, \t, \",
\\, etc., '\0' to \000 or \0 according as the next character is
or is not an octal digit, and other non-text characters to their
escaped hex representation, e.g. char(165) becomes \xa5.
For real x, estr(x) represebts x in fractional mode.
EXAMPLE
; estr("abc\0xyz\00023\n\xa5\r\n")
""abc\0xyz\00023\n\xa5\r\n""
; estr(1.67)
"167/100"
; estr(mat[3] = {2, list(3,5), "abc"})
"mat[3]={2,list(3,5),"abc""
LIMITS
none
LINK LIBRARY
none
SEE ALSO
str, strprintf

View File

@@ -7,19 +7,18 @@ SYNOPSIS
TYPES
fs file stream open for reading
return string, null or error value
return string or null
DESCRIPTION
If characters cannot be read from the file, an error value is returned.
Otherwise starting at the current file position, any whitespace
Starting at the current file position, any whitespace
characters are skipped. If the reading reaches end-of-file, the
null value is returned. If non-whitespace is encountered, formation
of a string begins, continuing until whitespace of '\0' or end-of-file
is reached. The returned value is this string (terminated as usual
by a null character). After the operation, the file position will
be immediately after the first whitespace character of '\0' or at
end-of-file.
null value is returned. Otherwise the function returns the empty
string "" if the first non-white character is '\0', and in other cases,
the string formed by the non-white-space characters read until '\0' or
a white-space character or te end of the file is reached. In the
cases where the reading is stopped by '\0' or white-space character,
the file position will be that immediately after that character.
EXAMPLE
@@ -67,8 +66,8 @@ SEE ALSO
## 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: fgetfield,v 29.5 2006/06/25 22:16:55 chongo Exp $
## @(#) $Revision: 29.6 $
## @(#) $Id: fgetfield,v 29.6 2006/08/20 15:01:57 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/fgetfield,v $
##
## Under source code control: 1996/04/30 03:05:17

72
help/fgetfile Normal file
View File

@@ -0,0 +1,72 @@
NAME
fgetfile - read the rest of a file to form a string
SYNOPSIS
fgetfile(fs)
TYPES
fs file stream open for reading
return string or null value
DESCRIPTION
If the current file position for fs is the end of the file, the
null value is returned.
Otherwise the function returns the string formed from reading all
characters from the current file position to the end of the file.
If the content of the file "newfile" is a sequence of statements that
could form the body of function definition, the statement sequence
fs = fopen("newfile", "r");
eval(fgetfile(fs));
achieves the same as the command
read newfile;
EXAMPLE
; f = fopen("/tmp/newfile", "w")
; fputs(f, "abc\0xyz\n\t\xb0\0\r\v123"
; freopen(f, "r")
; estr(fgetfile(f))
""abc\0xyz\n\t\xb0\0\r\v123""
LIMITS
none
LINK LIBRARY
none
SEE ALSO
fgets, fgetstr, files, fopen, fprintf, fputs, fputstr
## Copyright (C) 1999-2006 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.2 $
## @(#) $Id: fgetfile,v 29.2 2006/08/20 15:01:57 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/fgetfile,v $
##
## Under source code control: 1996/04/30 03:05:17
## File existed as early as: 1996
##
## chongo <was here> /\oo/\ http://www.isthe.com/chongo/
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/

View File

@@ -2,34 +2,34 @@ NAME
fputs - write a string to a file
SYNOPSIS
fputs(fd, data)
fputs(fd, s1, s2, ...)
TYPES
fd file
data str
fd file stream open for writing
s1, s2, ... strings
return nil
return null value
DESCRIPTION
This function writes the string found in data to the file
associated with fd.
This function writes in succession the strings s1, s2, ..., to the
file associated with fd.
EXAMPLE
; fd = fopen("/tmp/newfile", "w")
; fputs(fd, "chongo was here\n")
; fputs(fd, "chongo was", " here\n")
; fd2 = fopen("/tmp/newfile", "r")
; fgetline(fd2)
"chongo was here"
LIMITS
fd must be associated with an open file
The number of arguments is not to exceed 1024
LINK LIBRARY
none
SEE ALSO
errno, fclose, feof, ferror, fflush, fgetc, fgetline, fgets, files, fopen,
fprintf, fputc, fputs, fseek, fsize, ftell, isfile, printf, prompt
errno, fclose, feof, ferror, fflush, fgetc, fgetfile, fgetline, fgets,
files, fopen, fprintf, fputc, fseek, fsize, ftell, isfile
## Copyright (C) 1999 Landon Curt Noll
##
@@ -47,8 +47,8 @@ SEE ALSO
## 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: fputs,v 29.3 2006/05/07 07:25:46 chongo Exp $
## @(#) $Revision: 29.4 $
## @(#) $Id: fputs,v 29.4 2006/08/20 15:01:57 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/fputs,v $
##
## Under source code control: 1995/03/04 11:33:20

View File

@@ -26,7 +26,7 @@ EXAMPLE
; name(f)
"/tmp/beta"
; names(files(0))
; name(files(0))
"(stdin)"
LIMITS
@@ -54,8 +54,8 @@ SEE ALSO
## 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: name,v 29.4 2006/06/25 22:16:55 chongo Exp $
## @(#) $Revision: 29.5 $
## @(#) $Id: name,v 29.5 2006/08/20 15:01:57 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/name,v $
##
## Under source code control: 1997/04/05 14:12:44

View File

@@ -1,41 +1,73 @@
NAME
quomod - assign quotient and remainder to two variables
quomod - assign quotient and remainder to two lvalues
SYNOPSIS
quomod(x, y, q, r [, rnd])
quomod(x, y, Q, R [, rnd])
TYPES
x real
y real
q any
r any
rnd integer, defaults to config("quomod")
Q null-or-real-valued lvalue with assign-to permission
R null-or-real-valued lvalue with assign-to permission
rnd nonnegative integer, defaults to config("quomod")
return real
return 0 or 1
DESCRIPTION
Returns 0 or 1 according as x is or is not a multiple of y.
Let x = q * y + r where q is an integer and 0 <= r < y
This function assigns the values q and r to the variables
Q and R. If x >= 0, the results for Q and R are the same as
those given by Q = x // y, R = x % y.
If y is nonzero and x/y is an integer q, this function assigns
q to Q and zero to R, and returns zero.
The argument rnd (if passed or config value config("quomod") if the
rnd argument is not passed) impacts the rounding mode for producing
the quotient and modulus. See "help quo" details of how the quotient
is impacted by rounding modes. See "help mod" for details of how
the modulus is impacted by rounding modes. The only difference on
those descriptions is that quomod() is controlled by a single config
value config("quomod") instead of config("quo") and config("mod").
If y is zero, zero is assigned to Q, x to R and 0 or 1 returned
according as x is zero or nonzero.
XXX - replace the above paragraph and directly describe how rnd
and config("quomod") impact quomod.
In the remaining case, y nonzero and x/y not an intger, there
are two pairs (q,r) for which x = q * y + r, q is an integer, and
abs(r) < abs(y). Depending on the low 5 bits of rnd, the q and r
of one of these pairs will be assigned to Q and R respectively,
and the number 1 returned. The effects of rnd can be described in
terms of the way q is related to x/y, e.g. by rounding down,
rounding towards zero, rounding to a nearest integeri, etc. or
by properties of the remainder r, e.g. positive, negative,
smallest, etc. The effects of the most commonly used values of
rnd are described in the following table:
The C language method of modulus and integer division is:
rnd q r
0 round down. q = floor(x/y) same sign as y
1 round up, q = ceil(x/y) opposite sign to y
2 round to zero, q = int(x/y) same sign as x, r = y * frac(x/y)
3 round from zero oppsite sign to x
4 positive
5 negative
6 same sign as x/y
7 opposite sigh to x/y
8 to nearest even
9 to nearest odd
For 16 <= rnd < 32, the rounding is to the nearest integer and r
is the smallest (in absolute value) remainder except when x/y is
halfway between consecutive integers, in which case the rounding
is as given by the 4 low bits of rnd. Using rnd = 24 gives the
cpmmonly used principle of rounding: round to the nearest integer,
but take the even integer when there are two equally close integers.
For more detail on the effects of rnd for values other than those
listed above, see "help quo" and "help mod".
In all cases, the values assigned to Q and R by quomod(x, y, Q, R, rnd)
are the same as those given by Q = quo(x,y,rnd), R = mod(x,y,rnd).
If config("quo") == rnd, Q is also given by quo(x,y) or x // y.
If config("mod") == rnd, R is also given by mod(x,y) or x % y.
The rounding used by the C language for x / y and x % y corresponds
to rnd = 2.
An error values is returned and the values of Q and R are not changed
if Q and R are not both lvalues, or if the current value of any
argument is not as specified above, or if Q or R has no-assign-to
prptection, e.g. after protect(Q,1).
config("quomod", 2)
config("quo", 2)
config("mod", 2)
EXAMPLE
; global u, v;
@@ -59,13 +91,13 @@ EXAMPLE
1 3 -1
LIMITS
y > 0
rnd < 2^31
LINK LIBRARY
BOOL qquomod(NUMBER *q1, NUMBER *q2, NUMBER **retqdiv, NUMBER **retqmod)
BOOL qquomod(NUMBER *q1, NUMBER *q2, NUMBER **quo, NUMBER **mod)
SEE ALSO
//, %
//, %, quo, mod, floor. ceil, int. frac
## Copyright (C) 1999-2006 Landon Curt Noll
##
@@ -83,8 +115,8 @@ SEE ALSO
## 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: quomod,v 29.5 2006/06/25 20:33:26 chongo Exp $
## @(#) $Revision: 29.7 $
## @(#) $Id: quomod,v 29.7 2006/08/20 15:01:57 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/quomod,v $
##
## Under source code control: 1995/05/07 03:17:03

View File

@@ -58,32 +58,6 @@ High priority items:
Medium priority items:
* Review and if needed, correct/update the help topics:
topic description
----- -----------
intro introduction to calc
overview overview of calc
assoc using associations
command top level commands
define how to define functions
environment how environment variables effect calc
errorcodes calc generated error codes
expression expression sequences
file using files
history command history
interrupt how interrupts are handled
list using lists
obj user defined data types
operator math, relational, logic and variable access ...
statement flow control and declaration statements
types builtin data types
unexpected unexpected syntax/usage surprises for C ...
variable variables and variable declarations
libcalc using the arbitrary precision routines in ...
bugs known bugs and mis-features
wishlist wish list of future enhancements of calc
* Complete the use of CONST where appropriate:
CONST is beginning to be used with read-only tables and some
@@ -130,8 +104,8 @@ Medium priority items:
## 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: todo,v 29.8 2006/05/21 07:50:11 chongo Exp $
## @(#) $Revision: 29.9 $
## @(#) $Id: todo,v 29.9 2006/09/17 20:54:07 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/todo,v $
##
## Under source code control: 1999/10/20 07:42:55

View File

@@ -139,8 +139,6 @@ Variable declarations
arguments as addresses, there is no gain in using the backquote when
calling these functions.
XXX - this file needs to be updated to be in sync with calc source code.
## Copyright (C) 1999-2006 Landon Curt Noll
##
## Calc is open software; you can redistribute it and/or modify it under
@@ -157,8 +155,8 @@ Variable declarations
## 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: variable,v 29.4 2006/06/25 23:07:08 chongo Exp $
## @(#) $Revision: 29.5 $
## @(#) $Id: variable,v 29.5 2006/09/17 20:54:07 chongo Exp $
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/variable,v $
##
## Under source code control: 1991/07/21 04:37:25

46
rpm.mk
View File

@@ -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.
#
MAKEFILE_REV= $$Revision: 29.13 $$
# @(#) $Id: rpm.mk,v 29.13 2003/04/15 03:39:17 chongo Exp $
MAKEFILE_REV= $$Revision: 29.14 $$
# @(#) $Id: rpm.mk,v 29.14 2006/08/20 16:47:51 chongo Exp $
# @(#) $Source: /usr/local/src/cmd/calc/RCS/rpm.mk,v $
#
# Under source code control: 2003/02/16 20:21:39
@@ -55,7 +55,7 @@ RPM686= $(PROJECT)-$(PROJECT_RELEASE).${TARCH}.rpm
DRPM686= $(PROJECT_NAME)-devel-$(PROJECT_VERSION)-$(PROJECT_RELEASE).${TARCH}.rpm
SRPM= $(PROJECT)-$(PROJECT_RELEASE).src.rpm
TMPDIR= /var/tmp
RHDIR= /usr/src/redhat
RPMDIR= /usr/src/redhat
all: calc.spec ver_calc
$(MAKE) -f rpm.mk PROJECT_VERSION="`./ver_calc`" \
@@ -80,50 +80,50 @@ calc.spec: calc.spec.in ver_calc
srcpkg: make_rhdir
find . -depth -print | egrep -v '/RCS|/CVS|/NOTES|\.gone' | \
cpio -dumpv $(TMPDIR)/$(PROJECT)
(cd $(TMPDIR); tar cf - $(PROJECT) | \
gzip -c > $(RHDIR)/SOURCES/$(TARBALL))
(cd $(TMPDIR); tar cf - $(PROJECT)) | \
gzip -c > $(RPMDIR)/SOURCES/$(TARBALL)
rm -fr $(TMPDIR)/$(PROJECT)
.PHONY: rpm
rpm: srcpkg calc.spec
$(MAKE) -f Makefile clean
cp $(SPECFILE) $(RHDIR)/SPECS/$(SPECFILE)
rm -f $(RHDIR)/RPMS/${TARCH}/$(RPM686)
rm -f $(RHDIR)/RPMS/${TARCH}/$(DRPM686)
rm -f $(RHDIR)/SRPMS/$(SRPM)
${RPMBUILD_TOOL} ${RPMBUILD_OPTION} $(RHDIR)/SPECS/$(SPECFILE)
@if [ ! -f "$(RHDIR)/SRPMS/$(SRPM)" ]; then \
cp $(SPECFILE) $(RPMDIR)/SPECS/$(SPECFILE)
rm -f $(RPMDIR)/RPMS/${TARCH}/$(RPM686)
rm -f $(RPMDIR)/RPMS/${TARCH}/$(DRPM686)
rm -f $(RPMDIR)/SRPMS/$(SRPM)
${RPMBUILD_TOOL} ${RPMBUILD_OPTION} $(RPMDIR)/SPECS/$(SPECFILE)
@if [ ! -f "$(RPMDIR)/SRPMS/$(SRPM)" ]; then \
echo "SRPMS/$(SRPM) not found" 1>&2; \
exit 3; \
fi
@echo
@echo "RPM package sizes:"
@echo
@cd $(RHDIR); ls -1s RPMS/${TARCH}/$(RPM686) \
@cd $(RPMDIR); ls -1s RPMS/${TARCH}/$(RPM686) \
RPMS/${TARCH}/$(DRPM686) SRPMS/$(SRPM)
@echo
@echo "RPM package md5 hashes:"
@echo
-@cd $(RHDIR); ${MD5SUM} RPMS/${TARCH}/$(RPM686) \
-@cd $(RPMDIR); ${MD5SUM} RPMS/${TARCH}/$(RPM686) \
RPMS/${TARCH}/$(DRPM686) SRPMS/$(SRPM)
@echo
@echo "RPM package sha1 hashes:"
@echo
-@cd $(RHDIR); ${SHA1SUM} RPMS/${TARCH}/$(RPM686) \
-@cd $(RPMDIR); ${SHA1SUM} RPMS/${TARCH}/$(RPM686) \
RPMS/${TARCH}/$(DRPM686) SRPMS/$(SRPM)
@echo
@echo "RPM package locations:"
@echo
@ls -1 $(RHDIR)/RPMS/${TARCH}/$(RPM686) \
$(RHDIR)/RPMS/${TARCH}/$(DRPM686) $(RHDIR)/SRPMS/$(SRPM)
@ls -1 $(RPMDIR)/RPMS/${TARCH}/$(RPM686) \
$(RPMDIR)/RPMS/${TARCH}/$(DRPM686) $(RPMDIR)/SRPMS/$(SRPM)
@echo
@echo "All done! -- Jessica Noll, Age 2"
@echo
.PHONY: make_rhdir
make_rhdir:
for i in $(RHDIR) $(RHDIR)/RPMS $(RHDIR)/SOURCES \
$(RHDIR)/SPECS $(RHDIR)/SRPMS $(RHDIR)/BUILD; do \
for i in $(RPMDIR) $(RPMDIR)/RPMS $(RPMDIR)/SOURCES \
$(RPMDIR)/SPECS $(RPMDIR)/SRPMS $(RPMDIR)/BUILD; do \
if [ ! -d $$i ] ; then \
mkdir -p $$i; \
fi; \
@@ -136,9 +136,9 @@ logdate:
.PHONY: chkpkg
chkpkg:
for i in $(RHDIR)/RPMS/${TARCH}/$(RPM686) \
$(RHDIR)/RPMS/${TARCH}/$(DRPM686) \
$(RHDIR)/SRPMS/$(SRPM) ; do \
for i in $(RPMDIR)/RPMS/${TARCH}/$(RPM686) \
$(RPMDIR)/RPMS/${TARCH}/$(DRPM686) \
$(RPMDIR)/SRPMS/$(SRPM) ; do \
echo "***** start $$i" ; \
${RPM_TOOL} -qpi $$i ; \
echo "***** files $$i" ; \
@@ -165,8 +165,8 @@ installrpm:
echo "must be root to install RPMs" 1>&2; \
exit 5; \
fi
${RPM_TOOL} -ivh $(RHDIR)/RPMS/${TARCH}/$(RPM686)
${RPM_TOOL} -ivh $(RHDIR)/RPMS/${TARCH}/$(DRPM686)
${RPM_TOOL} -ivh $(RPMDIR)/RPMS/${TARCH}/$(RPM686)
${RPM_TOOL} -ivh $(RPMDIR)/RPMS/${TARCH}/$(DRPM686)
.PHONY: uninstallrpm
uninstallrpm:

View File

@@ -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: Makefile,v 29.18 2006/06/26 05:46:06 chongo Exp $
# @(#) $Revision: 29.19 $
# @(#) $Id: Makefile,v 29.19 2006/09/18 00:14:13 chongo Exp $
# @(#) $Source: /usr/local/src/cmd/calc/sample/RCS/Makefile,v $
#
# Under source code control: 1997/04/19 22:46:49
@@ -429,17 +429,17 @@ many_random: many_random.o ../libcalc.a
##
distlist: ${DISTLIST}
${Q}for i in ${DISTLIST} /dev/null; do \
${Q} for i in ${DISTLIST} /dev/null; do \
if [ X"$$i" != X"/dev/null" ]; then \
echo sample/$$i; \
fi; \
done
distdir:
${Q}echo sample
${Q} echo sample
calcliblist:
${Q}for i in ${CALCLIBLIST} /dev/null; do \
${Q} for i in ${CALCLIBLIST} /dev/null; do \
if [ X"$$i" != X"/dev/null" ]; then \
echo sample/$$i; \
fi; \
@@ -458,23 +458,23 @@ calcliblist:
##
depend:
${Q}if [ -f Makefile.bak ]; then \
${Q} if [ -f Makefile.bak ]; then \
echo "Makefile.bak exists, remove or move it out of the way"; \
exit 1; \
else \
true; \
fi
${Q}echo forming sample/skel
-${Q}rm -rf skel
${Q}mkdir skel
${Q}mkdir skel/sample
-${Q}for i in ${C_SRC} /dev/null; do \
${Q} echo forming sample/skel
-${Q} rm -rf skel
${Q} mkdir skel
${Q} mkdir skel/sample
-${Q} for i in ${C_SRC} /dev/null; do \
if [ X"$$i" != X"/dev/null" ]; then \
${SED} -n '/^#[ ]*include[ ]*"/p' \
"$$i" > "skel/sample/$$i"; \
fi; \
done
-${Q}for i in ${H_SRC} /dev/null; do \
-${Q} for i in ${H_SRC} /dev/null; do \
if [ X"$$i" != X"/dev/null" ]; then \
if [ X"$$i" != X"/dev/null" ]; then \
tag="`echo $$i | ${SED} 's/[\.+,:]/_/g'`"; \
@@ -486,8 +486,8 @@ depend:
fi; \
fi; \
done
${Q}(cd ..; ${MAKE} hsrc)
${Q}for i in `cd ..; ${MAKE} h_list 2>&1 | \
${Q} (cd ..; ${MAKE} hsrc)
${Q} for i in `cd ..; ${MAKE} h_list 2>&1 | \
${SED} -e '/Entering directory/d' \
-e '/Nothing to be done/d' \
-e '/Leaving directory/d'` /dev/null; do \
@@ -500,27 +500,27 @@ depend:
echo '#endif /* '"$$tag"' */' >> "skel/$$i"; \
fi; \
done
-${Q}rm -f skel/sample/makedep.out
${Q}echo sample/skel formed
${Q}echo forming sample dependency list
${Q}echo "# DO NOT DELETE THIS LINE -- make depend depends on it." > \
-${Q} rm -f skel/sample/makedep.out
${Q} echo sample/skel formed
${Q} echo forming sample dependency list
${Q} echo "# DO NOT DELETE THIS LINE -- make depend depends on it." > \
skel/sample/makedep.out
${Q}cd skel/sample; ${MAKEDEPEND} -w 1 -f makedep.out -I.. ${C_SRC}
-${Q}for i in ${C_SRC} /dev/null; do \
${Q} cd skel/sample; ${MAKEDEPEND} -w 1 -f makedep.out -I.. ${C_SRC}
-${Q} for i in ${C_SRC} /dev/null; do \
if [ X"$$i" != X"/dev/null" ]; then \
echo "$$i" | ${SED} 's/^\(.*\)\.c/\1.o: \1.c/'; \
fi; \
done >> skel/sample/makedep.out
${Q}echo sample dependency list formed
${Q}echo forming new sample/Makefile
-${Q}rm -f Makefile.bak
${Q}mv Makefile Makefile.bak
${Q}${SED} -n '1,/^# DO NOT DELETE THIS LINE/p' Makefile.bak > Makefile
${Q}echo "" >> Makefile
${Q}${SED} -n '3,$$p' skel/sample/makedep.out | \
${Q} echo sample dependency list formed
${Q} echo forming new sample/Makefile
-${Q} rm -f Makefile.bak
${Q} mv Makefile Makefile.bak
${Q} ${SED} -n '1,/^# DO NOT DELETE THIS LINE/p' Makefile.bak > Makefile
${Q} echo "" >> Makefile
${Q} ${SED} -n '3,$$p' skel/sample/makedep.out | \
LANG=C ${SORT} -u >> Makefile
-${Q}rm -rf skel
-${Q}if ${CMP} -s Makefile.bak Makefile; then \
-${Q} rm -rf skel
-${Q} if ${CMP} -s Makefile.bak Makefile; then \
echo 'sample Makefile was already up to date'; \
mv -f Makefile.bak Makefile; \
else \

View File

@@ -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: string.c,v 29.9 2006/05/20 10:13:39 chongo Exp $
* @(#) $Revision: 29.10 $
* @(#) $Id: string.c,v 29.10 2006/08/20 15:01:30 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/string.c,v $
*
* Under source code control: 1990/02/15 01:48:10
@@ -1292,18 +1292,15 @@ freestringconstant(long index)
long
printechar(char *c)
{
long n;
unsigned char ch;
unsigned char ch, cc;
unsigned char ech; /* for escape sequence */
unsigned char nch; /* for next character */
BOOL three;
ch = *c;
if (ch >= ' ' && ch < 127 && ch != '\\' && ch != '\"') {
putchar(ch);
if (ch >= ' ' && ch < 127 && ch != '\\' && ch != '\"' && ch != '\'') {
math_chr(ch);
return 1;
}
putchar('\\');
math_chr('\\');
ech = 0;
switch (ch) {
case '\n': ech = 'n'; break;
@@ -1314,28 +1311,28 @@ printechar(char *c)
case '\v': ech = 'v'; break;
case '\\': ech = '\\'; break;
case '\"': ech = '\"'; break;
case '\'': ech = '\''; break;
case 0: ech = '0'; break;
case 7: ech = 'a'; break;
case 27: ech = 'e'; break;
}
if (ech == '0') {
cc = *(c + 1);
if (cc >= '0' && cc < '8') {
math_str("000");
return 4;
}
}
if (ech) {
putchar(ech);
math_chr(ech);
return 2;
}
nch = *(c + 1);
three = (nch >= '0' && nch < '8');
n = 2;
if (three || ch >= 64) {
putchar('0' + ch/64);
n++;
}
ch %= 64;
if (three || ch >= 8) {
putchar('0' + ch/8);
n++;
}
ch %= 8;
putchar('0' + ch);
return n;
math_chr('x');
cc = ch / 16;
math_chr((cc < 10) ? '0' + cc : 87 + cc);
cc = ch % 16;
math_chr((cc < 10) ? '0' + cc : 87 + cc);
return 4;
}
@@ -1376,11 +1373,23 @@ fitstring(char *str, long len, long width)
n++;
}
if (j > i)
printf("...");
math_str("...");
while (j++ < len)
(void) printechar(c++);
}
void
strprint(STRING *str) {
long n;
char *c;
c = str->s_str;
n = str->s_len;
while (n-- > 0)
(void) printechar(c++);
}
void
showstrings(void)
{

View File

@@ -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: string.h,v 29.6 2006/05/19 15:26:10 chongo Exp $
* @(#) $Revision: 29.7 $
* @(#) $Id: string.h,v 29.7 2006/08/20 15:01:30 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/string.h,v $
*
* Under source code control: 1990/02/15 01:48:36
@@ -73,6 +73,7 @@ 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_;

116
value.c
View File

@@ -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: value.c,v 29.9 2006/06/01 11:47:07 chongo Exp $
* @(#) $Revision: 29.10 $
* @(#) $Id: value.c,v 29.10 2006/08/20 15:01:30 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/value.c,v $
*
* Under source code control: 1990/02/15 01:48:25
@@ -2752,6 +2752,118 @@ printvalue(VALUE *vp, int flags)
}
}
/*
* Print an exact text representation of a value
*/
void
printestr(VALUE *vp)
{
LISTELEM *ep;
MATRIX *mp;
OBJECT *op;
BLOCK *bp;
int mode;
long i, min, max;
USB8 *cp;
if (vp->v_type < 0) {
math_fmt("error(%d)", -vp->v_type);
return;
}
switch(vp->v_type) {
case V_NULL:
math_str("\"\"");
return;
case V_STR:
math_chr('"');
strprint(vp->v_str);
math_chr('"');
return;
case V_NUM:
qprintnum(vp->v_num, MODE_FRAC);
return;
case V_COM:
mode = math_setmode(MODE_FRAC);
comprint(vp->v_com);
math_setmode(mode);
return;
case V_LIST:
math_str("list(");
ep = vp->v_list->l_first;
if (ep) {
printestr(&ep->e_value);
while ((ep = ep->e_next)) {
math_chr(',');
printestr(&ep->e_value);
}
}
math_chr(')');
return;
case V_MAT:
mp = vp->v_mat;
if (mp->m_dim == 0)
math_str("(mat[])");
else {
math_str("mat[");
for (i = 0; i < mp->m_dim; i++) {
min = mp->m_min[i];
max = mp->m_max[i];
if (i > 0)
math_chr(',');
if (min)
math_fmt("%ld:%ld", min, max);
else
math_fmt("%ld", max + 1);
}
math_chr(']');
}
i = mp->m_size;
vp = mp->m_table;
break;
case V_OBJ:
op = vp->v_obj;
math_fmt("obj %s",objtypename(op->o_actions->oa_index));
i = op->o_actions->oa_count;
vp = op->o_table;
break;
case V_BLOCK:
case V_NBLOCK:
math_str("blk(");
if (vp->v_type == V_BLOCK)
bp = vp->v_block;
else {
math_fmt("\"%s\",", vp->v_nblock->name);
bp = vp->v_nblock->blk;
}
i = bp->datalen;
math_fmt("%d,%d)", i, bp->blkchunk);
cp = bp->data;
if (i > 0) {
math_str("={");
math_fmt("%d", *cp);
while (--i > 0) {
math_chr(',');
math_fmt("%d", *++cp);
}
math_chr('}');
}
return;
default:
math_str("\"???\"");
return;
}
if (i > 0) {
math_str("={");
printestr(vp);
while (--i > 0) {
math_chr(',');
printestr(++vp);
}
math_chr('}');
}
}
/*
* config_print - print a configuration value

View File

@@ -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.h,v 29.10 2006/05/19 15:26:10 chongo Exp $
* @(#) $Revision: 29.11 $
* @(#) $Id: value.h,v 29.11 2006/08/20 15:01:30 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/value.h,v $
*
* Under source code control: 1993/07/30 19:42:47
@@ -243,6 +243,7 @@ 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);

View File

@@ -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.63 $
* @(#) $Id: version.c,v 29.63 2006/06/26 05:53:25 chongo Exp $
* @(#) $Revision: 29.68 $
* @(#) $Id: version.c,v 29.68 2006/09/18 00:14:46 chongo Exp $
* @(#) $Source: /usr/local/src/cmd/calc/RCS/version.c,v $
*
* Under source code control: 1990/05/22 11:00:58
@@ -47,8 +47,8 @@ static char *program;
#define MAJOR_VER 2 /* major version */
#define MINOR_VER 12 /* minor version */
#define MAJOR_PATCH 0 /* patch level or 0 if no patch */
#define MINOR_PATCH 6 /* test number or 0 if no minor patch */
#define MAJOR_PATCH 1 /* patch level or 0 if no patch */
#define MINOR_PATCH 2 /* test number or 0 if no minor patch */
/*

View File

@@ -427,5 +427,9 @@ CONST char *error_table[E__COUNT+2] = {
"Unrecognized mode for fpathopen",
"Bad epsilon argument for log",
"Non-numeric first argument for log",
"Non-file argument for fgetfile",
"File argument for fgetfile not open for reading",
"Unable to set file position in fgetfile",
"Non-representable type for estr",
NULL
};

View File

@@ -424,9 +424,13 @@
#define E_FPATHOPEN2 10411 /* Unrecognized mode for fpathopen */
#define E_LOG1 10412 /* Bad epsilon argument for log */
#define E_LOG2 10413 /* Non-numeric first argument for log */
#define E_FGETFILE1 10414 /* Non-file argument for fgetfile */
#define E_FGETFILE2 10415 /* File argument for fgetfile not open for reading */
#define E_FGETFILE3 10416 /* Unable to set file position in fgetfile */
#define E_ESTR 10417 /* Non-representable type for estr */
#define E__HIGHEST 10413 /* highest calc error */
#define E__COUNT 413 /* number of calc errors */
#define E__HIGHEST 10417 /* highest calc error */
#define E__COUNT 417 /* number of calc errors */
#define E_USERDEF 20000 /* base of user defined errors */
/* names of calc error values */