mirror of
https://github.com/lcn2/calc.git
synced 2025-08-16 01:03:29 +03:00
Release calc version 2.12.0.8
This commit is contained in:
53
BUGS
53
BUGS
@@ -68,10 +68,6 @@ of a context diff patch).
|
|||||||
|
|
||||||
Known bugs:
|
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
|
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
|
us know! See the above for details on how to report and were to
|
||||||
EMail your bug reports and hopefully patches to fix them.
|
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
|
to fail the regression test. The work-a-round is to compile with -O
|
||||||
or to use gcc-2.96 or later.
|
or to use gcc-2.96 or later.
|
||||||
|
|
||||||
This bug has been observed on the Sparc and the PowerPC machine.
|
|
||||||
|
|
||||||
On the PowerPC with gcc-2.95 when compiled with -O2, the following
|
|
||||||
patch seems to help:
|
|
||||||
|
|
||||||
*** zfunc.c.orig Fri Feb 23 18:18:39 2001
|
|
||||||
--- zfunc.c Fri Feb 23 18:39:33 2001
|
|
||||||
***************
|
|
||||||
*** 1481,1487 ****
|
|
||||||
{
|
|
||||||
HALF *a, *A, *b, *a0, u;
|
|
||||||
int i, j, j1, j2, k, k1, m, m0, m1, n, n0, o;
|
|
||||||
! FULL d, e, f, g, h, s, t, x, topbit;
|
|
||||||
int remsign;
|
|
||||||
BOOL up, onebit;
|
|
||||||
ZVALUE sqrt;
|
|
||||||
--- 1481,1488 ----
|
|
||||||
{
|
|
||||||
HALF *a, *A, *b, *a0, u;
|
|
||||||
int i, j, j1, j2, k, k1, m, m0, m1, n, n0, o;
|
|
||||||
! volatile FULL d;
|
|
||||||
! FULL e, f, g, h, s, t, x, topbit;
|
|
||||||
int remsign;
|
|
||||||
BOOL up, onebit;
|
|
||||||
ZVALUE sqrt;
|
|
||||||
*** 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
|
* There are problems compiling calc on the sparcv9 under 64 bit
|
||||||
Solaris. On that platform, gcc-2.96 is able to compile calc, but
|
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
|
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.
|
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||||
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||||
##
|
##
|
||||||
## @(#) $Revision: 29.24 $
|
## @(#) $Revision: 29.25 $
|
||||||
## @(#) $Id: BUGS,v 29.24 2006/05/21 07:54:13 chongo Exp $
|
## @(#) $Id: BUGS,v 29.25 2006/08/20 17:51:25 chongo Exp $
|
||||||
## @(#) $Source: /usr/local/src/cmd/calc/RCS/BUGS,v $
|
## @(#) $Source: /usr/local/src/cmd/calc/RCS/BUGS,v $
|
||||||
##
|
##
|
||||||
## Under source code control: 1994/03/18 14:06:13
|
## Under source code control: 1994/03/18 14:06:13
|
||||||
|
19
CHANGES
19
CHANGES
@@ -367,6 +367,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
|
Changed the "Copyright" line in the rpm spec file to a "License" line
|
||||||
as per new rpm v4.4 syntax.
|
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:
|
The following are the changes from calc version 2.11.10.1 to 2.11.11:
|
||||||
|
|
||||||
@@ -6187,8 +6202,8 @@ Following is a list of visible changes to calc from version 1.24.7 to 1.26.1:
|
|||||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||||
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||||
##
|
##
|
||||||
## @(#) $Revision: 29.84 $
|
## @(#) $Revision: 29.86 $
|
||||||
## @(#) $Id: CHANGES,v 29.84 2006/06/26 05:53:25 chongo Exp $
|
## @(#) $Id: CHANGES,v 29.86 2006/08/20 16:18:10 chongo Exp $
|
||||||
## @(#) $Source: /usr/local/src/cmd/calc/RCS/CHANGES,v $
|
## @(#) $Source: /usr/local/src/cmd/calc/RCS/CHANGES,v $
|
||||||
##
|
##
|
||||||
## Under source code control: 1993/06/02 18:12:57
|
## Under source code control: 1993/06/02 18:12:57
|
||||||
|
@@ -17,8 +17,8 @@
|
|||||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*
|
*
|
||||||
* @(#) $Revision: 29.34 $
|
* @(#) $Revision: 29.35 $
|
||||||
* @(#) $Id: regress.cal,v 29.34 2006/06/25 20:33:26 chongo Exp $
|
* @(#) $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 $
|
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/regress.cal,v $
|
||||||
*
|
*
|
||||||
* Under source code control: 1990/02/15 01:50:36
|
* Under source code control: 1990/02/15 01:50:36
|
||||||
@@ -743,6 +743,7 @@ define test_functions()
|
|||||||
local pi;
|
local pi;
|
||||||
local h, n, r, m, v;
|
local h, n, r, m, v;
|
||||||
local n2, m2, v2;
|
local n2, m2, v2;
|
||||||
|
local t;
|
||||||
|
|
||||||
print '700: Beginning test_functions';
|
print '700: Beginning test_functions';
|
||||||
|
|
||||||
@@ -3461,7 +3462,7 @@ print '070: parsed test_redc()';
|
|||||||
*/
|
*/
|
||||||
define test_fileops()
|
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 L = "Landon";
|
||||||
local C = "Curt";
|
local C = "Curt";
|
||||||
local N = "Noll";
|
local N = "Noll";
|
||||||
@@ -3586,15 +3587,38 @@ define test_fileops()
|
|||||||
++ecnt;
|
++ecnt;
|
||||||
print '4267: ++ecnt;';
|
print '4267: ++ecnt;';
|
||||||
vrfy(isfile(p=fopen(long,"r")) == 0,
|
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
|
* cleanup
|
||||||
*/
|
*/
|
||||||
x = rm("junk4200");
|
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()';
|
print '071: parsed test_fileops()';
|
||||||
|
|
||||||
|
@@ -17,8 +17,8 @@
|
|||||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*
|
*
|
||||||
* @(#) $Revision: 29.1 $
|
* @(#) $Revision: 29.2 $
|
||||||
* @(#) $Id: set8700.cal,v 29.1 2006/05/20 19:35:33 chongo Exp $
|
* @(#) $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 $
|
* @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/set8700.cal,v $
|
||||||
*
|
*
|
||||||
* Under source code control: 2006/05/20 14:10:11
|
* Under source code control: 2006/05/20 14:10:11
|
||||||
@@ -70,3 +70,8 @@ define set8700_g(set8700_x)
|
|||||||
obj set8700_point {
|
obj set8700_point {
|
||||||
set8700_x, set8700_y, set8700_z
|
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 };
|
||||||
|
@@ -17,8 +17,8 @@
|
|||||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||||
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||||
##
|
##
|
||||||
## @(#) $Revision: 29.2 $
|
## @(#) $Revision: 29.4 $
|
||||||
## @(#) $Id: set8700.line,v 29.2 2006/06/20 09:29:16 chongo Exp $
|
## @(#) $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 $
|
## @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/set8700.line,v $
|
||||||
##
|
##
|
||||||
## Under source code control: 2006/05/20 14:10:11
|
## 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 = list(mat[1] = {set8700_P}), protect(set8700_L[0][0]) == 16
|
||||||
set8700_L = {{{4,5,6}}}, set8700_L[0][0] == set8700_P
|
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})
|
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
8
calc.h
@@ -17,8 +17,8 @@
|
|||||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*
|
*
|
||||||
* @(#) $Revision: 29.18 $
|
* @(#) $Revision: 29.19 $
|
||||||
* @(#) $Id: calc.h,v 29.18 2006/05/21 07:28:54 chongo Exp $
|
* @(#) $Id: calc.h,v 29.19 2006/08/20 15:01:30 chongo Exp $
|
||||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/calc.h,v $
|
* @(#) $Source: /usr/local/src/cmd/calc/RCS/calc.h,v $
|
||||||
*
|
*
|
||||||
* Under source code control: 1990/02/15 01:48:31
|
* 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 getcharid(FILEID id);
|
||||||
extern DLL int idprintf(FILEID id, char *fmt, int count, VALUE **vals);
|
extern DLL int idprintf(FILEID id, char *fmt, int count, VALUE **vals);
|
||||||
extern DLL int idfputc(FILEID id, int ch);
|
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 printid(FILEID id, int flags);
|
||||||
extern DLL int flushid(FILEID id);
|
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 getloc(FILEID id, ZVALUE *loc);
|
||||||
extern DLL int setloc(FILEID id, ZVALUE zpos);
|
extern DLL int setloc(FILEID id, ZVALUE zpos);
|
||||||
extern DLL int getsize(FILEID id, ZVALUE *size);
|
extern DLL int getsize(FILEID id, ZVALUE *size);
|
||||||
|
@@ -17,8 +17,8 @@
|
|||||||
# received a copy with calc; if not, write to Free Software Foundation, Inc.
|
# received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||||
# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#
|
#
|
||||||
# @(#) $Revision: 29.9 $
|
# @(#) $Revision: 29.10 $
|
||||||
# @(#) $Id: calcerr.tbl,v 29.9 2006/06/25 20:33:26 chongo Exp $
|
# @(#) $Id: calcerr.tbl,v 29.10 2006/08/20 15:01:30 chongo Exp $
|
||||||
# @(#) $Source: /usr/local/src/cmd/calc/RCS/calcerr.tbl,v $
|
# @(#) $Source: /usr/local/src/cmd/calc/RCS/calcerr.tbl,v $
|
||||||
#
|
#
|
||||||
# Under source code control: 1996/05/23 17:38:44
|
# 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_FPATHOPEN2 Unrecognized mode for fpathopen
|
||||||
E_LOG1 Bad epsilon argument for log
|
E_LOG1 Bad epsilon argument for log
|
||||||
E_LOG2 Non-numeric first 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
|
||||||
|
@@ -18,8 +18,8 @@
|
|||||||
# received a copy with calc; if not, write to Free Software Foundation, Inc.
|
# received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||||
# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#
|
#
|
||||||
# @(#) $Revision: 29.3 $
|
# @(#) $Revision: 29.4 $
|
||||||
# @(#) $Id: check.awk,v 29.3 2006/05/20 19:43:39 chongo Exp $
|
# @(#) $Id: check.awk,v 29.4 2006/08/20 16:16:31 chongo Exp $
|
||||||
# @(#) $Source: /usr/local/src/cmd/calc/RCS/check.awk,v $
|
# @(#) $Source: /usr/local/src/cmd/calc/RCS/check.awk,v $
|
||||||
#
|
#
|
||||||
# Under source code control: 1996/05/25 22:07:58
|
# Under source code control: 1996/05/25 22:07:58
|
||||||
@@ -64,7 +64,7 @@ NF == 0 {
|
|||||||
end_seen = 1;
|
end_seen = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
$1 ~ /^[0-9]+:/ || $1 ~ /^[0-9]+-[0-9]*:/ {
|
$1 ~ /^[0-9]+:/ || $1 ~ /^[0-9]+-[0-9]*:/ || $1 ~ /^"))$/ {
|
||||||
if (error > 0) {
|
if (error > 0) {
|
||||||
if (havebuf2) {
|
if (havebuf2) {
|
||||||
print buf2;
|
print buf2;
|
||||||
|
38
file.c
38
file.c
@@ -19,8 +19,8 @@
|
|||||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*
|
*
|
||||||
* @(#) $Revision: 29.15 $
|
* @(#) $Revision: 29.16 $
|
||||||
* @(#) $Id: file.c,v 29.15 2006/05/22 19:04:45 chongo Exp $
|
* @(#) $Id: file.c,v 29.16 2006/08/20 15:01:30 chongo Exp $
|
||||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/file.c,v $
|
* @(#) $Source: /usr/local/src/cmd/calc/RCS/file.c,v $
|
||||||
*
|
*
|
||||||
* Under source code control: 1991/07/20 00:21:56
|
* Under source code control: 1991/07/20 00:21:56
|
||||||
@@ -746,10 +746,10 @@ flushall(void)
|
|||||||
* given:
|
* given:
|
||||||
* id file to read from
|
* id file to read from
|
||||||
* flags read flags (see above)
|
* flags read flags (see above)
|
||||||
* retptr returned pointer to string
|
* retstr returned pointer to string
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
readid(FILEID id, int flags, char **retptr)
|
readid(FILEID id, int flags, STRING **retstr)
|
||||||
{
|
{
|
||||||
FILEIO *fiop; /* file structure */
|
FILEIO *fiop; /* file structure */
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
@@ -761,6 +761,7 @@ readid(FILEID id, int flags, char **retptr)
|
|||||||
int c;
|
int c;
|
||||||
BOOL nlstop, nullstop, wsstop, rmstop, done;
|
BOOL nlstop, nullstop, wsstop, rmstop, done;
|
||||||
FILEPOS fpos;
|
FILEPOS fpos;
|
||||||
|
STRING *newstr;
|
||||||
|
|
||||||
totlen = 0;
|
totlen = 0;
|
||||||
str = NULL;
|
str = NULL;
|
||||||
@@ -831,7 +832,10 @@ readid(FILEID id, int flags, char **retptr)
|
|||||||
if ((nullstop && c == '\0') && !rmstop)
|
if ((nullstop && c == '\0') && !rmstop)
|
||||||
str[totlen - 1] = '\0';
|
str[totlen - 1] = '\0';
|
||||||
str[totlen] = '\0';
|
str[totlen] = '\0';
|
||||||
*retptr = str;
|
newstr = stralloc();
|
||||||
|
newstr->s_len = totlen;
|
||||||
|
newstr->s_str = str;
|
||||||
|
*retstr = newstr;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -895,7 +899,7 @@ printid(FILEID id, int flags)
|
|||||||
math_chr('"');
|
math_chr('"');
|
||||||
return 0;
|
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
|
* print file position
|
||||||
@@ -904,11 +908,13 @@ printid(FILEID id, int flags)
|
|||||||
fp = fiop->fp;
|
fp = fiop->fp;
|
||||||
|
|
||||||
if (get_open_pos(fp, &pos) < 0) {
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
math_str("pos ");
|
math_str(", pos ");
|
||||||
zprintval(pos, 0, 0);
|
zprintval(pos, 0, 0);
|
||||||
zfree(pos);
|
zfree(pos);
|
||||||
|
|
||||||
@@ -1233,10 +1239,13 @@ idungetc(FILEID id, int ch)
|
|||||||
* str string to write
|
* str string to write
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
idfputs(FILEID id, char *str)
|
idfputs(FILEID id, STRING *str)
|
||||||
{
|
{
|
||||||
FILEIO *fiop;
|
FILEIO *fiop;
|
||||||
FILEPOS fpos;
|
FILEPOS fpos;
|
||||||
|
FILE *fp;
|
||||||
|
char *c;
|
||||||
|
long len;
|
||||||
|
|
||||||
/* get the file info pointer */
|
/* get the file info pointer */
|
||||||
fiop = findid(id, TRUE);
|
fiop = findid(id, TRUE);
|
||||||
@@ -1251,14 +1260,13 @@ idfputs(FILEID id, char *str)
|
|||||||
|
|
||||||
fiop->action = 'w';
|
fiop->action = 'w';
|
||||||
|
|
||||||
/* set output to file */
|
fp = fiop->fp;
|
||||||
math_setfp(fiop->fp);
|
len = str->s_len;
|
||||||
|
c = str->s_str;
|
||||||
|
|
||||||
/* write the string */
|
while (len-- > 0)
|
||||||
math_str(str);
|
fputc(*c++, fp);
|
||||||
|
|
||||||
/* restore output to stdout */
|
|
||||||
math_setfp(stdout);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
92
func.c
92
func.c
@@ -19,8 +19,8 @@
|
|||||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*
|
*
|
||||||
* @(#) $Revision: 29.28 $
|
* @(#) $Revision: 29.30 $
|
||||||
* @(#) $Id: func.c,v 29.28 2006/06/25 20:33:26 chongo Exp $
|
* @(#) $Id: func.c,v 29.30 2006/08/20 15:01:30 chongo Exp $
|
||||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/func.c,v $
|
* @(#) $Source: /usr/local/src/cmd/calc/RCS/func.c,v $
|
||||||
*
|
*
|
||||||
* Under source code control: 1990/02/15 01:48:15
|
* Under source code control: 1990/02/15 01:48:15
|
||||||
@@ -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
|
static VALUE
|
||||||
f_name(VALUE *vp)
|
f_name(VALUE *vp)
|
||||||
{
|
{
|
||||||
@@ -3572,14 +3590,16 @@ f_quomod(int count, VALUE **vals)
|
|||||||
v3 = vals[2];
|
v3 = vals[2];
|
||||||
v4 = vals[3];
|
v4 = vals[3];
|
||||||
|
|
||||||
if (v3->v_type != V_ADDR || v4->v_type != V_ADDR)
|
if (v3->v_type != V_ADDR || v4->v_type != V_ADDR ||
|
||||||
return error_value(E_QUOMOD1);
|
v3->v_addr == v4->v_addr)
|
||||||
|
return error_value(E_QUOMOD1);
|
||||||
if (count == 5) {
|
if (count == 5) {
|
||||||
v5 = vals[4];
|
v5 = vals[4];
|
||||||
if (v5->v_type == V_ADDR)
|
if (v5->v_type == V_ADDR)
|
||||||
v5 = v5->v_addr;
|
v5 = v5->v_addr;
|
||||||
if (v5->v_type != V_NUM || qisfrac(v5->v_num) ||
|
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);
|
rnd = qtoi(v5->v_num);
|
||||||
} else
|
} else
|
||||||
rnd = conf->quomod;
|
rnd = conf->quomod;
|
||||||
@@ -3588,22 +3608,29 @@ f_quomod(int count, VALUE **vals)
|
|||||||
v1 = v1->v_addr;
|
v1 = v1->v_addr;
|
||||||
if (v2->v_type == V_ADDR)
|
if (v2->v_type == V_ADDR)
|
||||||
v2 = v2->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;
|
v3 = v3->v_addr;
|
||||||
v4 = v4->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;
|
s3 = v3->v_subtype;
|
||||||
s4 = v4->v_subtype;
|
s4 = v4->v_subtype;
|
||||||
|
|
||||||
if ((s3 | s4) & V_NOASSIGNTO)
|
if ((s3 | s4) & V_NOASSIGNTO)
|
||||||
return error_value(E_QUOMOD3);
|
return error_value(E_QUOMOD3);
|
||||||
|
|
||||||
freevalue(v3);
|
freevalue(v3);
|
||||||
freevalue(v4);
|
freevalue(v4);
|
||||||
|
|
||||||
v3->v_type = V_NUM;
|
v3->v_type = V_NUM;
|
||||||
v4->v_type = V_NUM;
|
v4->v_type = V_NUM;
|
||||||
|
|
||||||
v3->v_subtype = s3;
|
v3->v_subtype = s3;
|
||||||
v4->v_subtype = s4;
|
v4->v_subtype = s4;
|
||||||
|
|
||||||
res = qquomod(v1->v_num, v2->v_num, &v3->v_num, &v4->v_num, rnd);
|
res = qquomod(v1->v_num, v2->v_num, &v3->v_num, &v4->v_num, rnd);
|
||||||
result.v_type = V_NUM;
|
result.v_type = V_NUM;
|
||||||
result.v_subtype = V_NOSUBTYPE;
|
result.v_subtype = V_NOSUBTYPE;
|
||||||
@@ -5827,7 +5854,7 @@ strscan(char *s, int count, VALUE **vals)
|
|||||||
static int
|
static int
|
||||||
filescan(FILEID id, int count, VALUE **vals)
|
filescan(FILEID id, int count, VALUE **vals)
|
||||||
{
|
{
|
||||||
char *str;
|
STRING *str;
|
||||||
int i;
|
int i;
|
||||||
int n = 0;
|
int n = 0;
|
||||||
VALUE val;
|
VALUE val;
|
||||||
@@ -5848,7 +5875,7 @@ filescan(FILEID id, int count, VALUE **vals)
|
|||||||
if (i > 0)
|
if (i > 0)
|
||||||
return EOF;
|
return EOF;
|
||||||
n++;
|
n++;
|
||||||
val.v_str = makenewstring(str);
|
val.v_str = str;
|
||||||
result = f_eval(&val);
|
result = f_eval(&val);
|
||||||
var = *vals++;
|
var = *vals++;
|
||||||
if (var->v_type == V_ADDR) {
|
if (var->v_type == V_ADDR) {
|
||||||
@@ -6095,7 +6122,7 @@ f_fputs(int count, VALUE **vals)
|
|||||||
return error_value(E_FPUTS2);
|
return error_value(E_FPUTS2);
|
||||||
}
|
}
|
||||||
for (i = 1; i < count; i++) {
|
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)
|
if (err > 0)
|
||||||
return error_value(E_FPUTS3);
|
return error_value(E_FPUTS3);
|
||||||
}
|
}
|
||||||
@@ -6242,7 +6269,7 @@ static VALUE
|
|||||||
f_fgetline(VALUE *vp)
|
f_fgetline(VALUE *vp)
|
||||||
{
|
{
|
||||||
VALUE result;
|
VALUE result;
|
||||||
char *str;
|
STRING *str;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* initialize VALUE */
|
/* initialize VALUE */
|
||||||
@@ -6256,7 +6283,7 @@ f_fgetline(VALUE *vp)
|
|||||||
result.v_type = V_NULL;
|
result.v_type = V_NULL;
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
result.v_type = V_STR;
|
result.v_type = V_STR;
|
||||||
result.v_str = makestring(str);
|
result.v_str = str;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -6266,7 +6293,7 @@ static VALUE
|
|||||||
f_fgets(VALUE *vp)
|
f_fgets(VALUE *vp)
|
||||||
{
|
{
|
||||||
VALUE result;
|
VALUE result;
|
||||||
char *str;
|
STRING *str;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* initialize VALUE */
|
/* initialize VALUE */
|
||||||
@@ -6280,7 +6307,7 @@ f_fgets(VALUE *vp)
|
|||||||
result.v_type = V_NULL;
|
result.v_type = V_NULL;
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
result.v_type = V_STR;
|
result.v_type = V_STR;
|
||||||
result.v_str = makestring(str);
|
result.v_str = str;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -6290,7 +6317,7 @@ static VALUE
|
|||||||
f_fgetstr(VALUE *vp)
|
f_fgetstr(VALUE *vp)
|
||||||
{
|
{
|
||||||
VALUE result;
|
VALUE result;
|
||||||
char *str;
|
STRING *str;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* initialize VALUE */
|
/* initialize VALUE */
|
||||||
@@ -6304,7 +6331,7 @@ f_fgetstr(VALUE *vp)
|
|||||||
result.v_type = V_NULL;
|
result.v_type = V_NULL;
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
result.v_type = V_STR;
|
result.v_type = V_STR;
|
||||||
result.v_str = makestring(str);
|
result.v_str = str;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -6314,7 +6341,7 @@ static VALUE
|
|||||||
f_fgetfield(VALUE *vp)
|
f_fgetfield(VALUE *vp)
|
||||||
{
|
{
|
||||||
VALUE result;
|
VALUE result;
|
||||||
char *str;
|
STRING *str;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* initialize VALUE */
|
/* initialize VALUE */
|
||||||
@@ -6328,7 +6355,32 @@ f_fgetfield(VALUE *vp)
|
|||||||
result.v_type = V_NULL;
|
result.v_type = V_NULL;
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
result.v_type = V_STR;
|
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;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -8165,6 +8217,8 @@ static CONST struct builtin builtins[] = {
|
|||||||
"set or read calc_errno"},
|
"set or read calc_errno"},
|
||||||
{"error", 0, 1, 0, OP_NOP, 0, f_error,
|
{"error", 0, 1, 0, OP_NOP, 0, f_error,
|
||||||
"generate error value"},
|
"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", 1, 1, 0, OP_NOP, 0, f_euler,
|
||||||
"Euler number"},
|
"Euler number"},
|
||||||
{"eval", 1, 1, 0, OP_NOP, 0, f_eval,
|
{"eval", 1, 1, 0, OP_NOP, 0, f_eval,
|
||||||
@@ -8195,6 +8249,8 @@ static CONST struct builtin builtins[] = {
|
|||||||
"read next char from file"},
|
"read next char from file"},
|
||||||
{"fgetfield", 1, 1, 0, OP_NOP, 0, f_fgetfield,
|
{"fgetfield", 1, 1, 0, OP_NOP, 0, f_fgetfield,
|
||||||
"read next white-space delimited field from file"},
|
"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,
|
{"fgetline", 1, 1, 0, OP_NOP, 0, f_fgetline,
|
||||||
"read next line from file, newline removed"},
|
"read next line from file, newline removed"},
|
||||||
{"fgets", 1, 1, 0, OP_NOP, 0, f_fgets,
|
{"fgets", 1, 1, 0, OP_NOP, 0, f_fgets,
|
||||||
|
@@ -18,8 +18,8 @@
|
|||||||
# received a copy with calc; if not, write to Free Software Foundation, Inc.
|
# received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||||
# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#
|
#
|
||||||
# @(#) $Revision: 29.29 $
|
# @(#) $Revision: 29.30 $
|
||||||
# @(#) $Id: Makefile,v 29.29 2006/06/26 05:46:06 chongo Exp $
|
# @(#) $Id: Makefile,v 29.30 2006/08/20 15:01:57 chongo Exp $
|
||||||
# @(#) $Source: /usr/local/src/cmd/calc/help/RCS/Makefile,v $
|
# @(#) $Source: /usr/local/src/cmd/calc/help/RCS/Makefile,v $
|
||||||
#
|
#
|
||||||
# Under source code control: 1991/07/23 06:47:57
|
# 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 \
|
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 \
|
appr arg argv arrow asec asech asin asinh assign atan atan2 atanh \
|
||||||
avg base base2 bernoulli bit blk blkcpy blkfree blocks bround btrunc \
|
avg base base2 bernoulli bit blk blkcpy blkfree blocks bround \
|
||||||
calc_tty calclevel catalan ceil cfappr cfsim char cmdbuf cmp comb \
|
btrunc calc_tty calclevel catalan ceil cfappr cfsim char cmdbuf \
|
||||||
conj cos cosh cot coth count cp csc csch ctime delete den dereference \
|
cmp comb conj cos cosh cot coth count cp csc csch ctime delete den \
|
||||||
det digit digits display dp epsilon errcount errmax errno error \
|
dereference det digit digits display dp epsilon errcount errmax \
|
||||||
euler eval exp fact factor fclose fcnt feof ferror fflush fgetc \
|
errno error estr euler eval exp fact factor fclose fcnt feof ferror \
|
||||||
fgetfield fgetline fgets fgetstr fib files floor fopen forall \
|
fflush fgetc fgetfield fgetfile fgetline fgets fgetstr fib files \
|
||||||
fpathopen fprintf fputc fputs fputstr frac free freebernoulli \
|
floor fopen forall fpathopen fprintf fputc fputs fputstr frac free \
|
||||||
freeeuler freeglobals freeredc freestatics frem freopen fscan \
|
freebernoulli freeeuler freeglobals freeredc freestatics frem freopen \
|
||||||
fscanf fseek fsize ftell gcd gcdrem gd getenv hash head highbit \
|
fscan fscanf fseek fsize ftell gcd gcdrem gd getenv hash head highbit \
|
||||||
hmean hnrmod hypot ilog ilog10 ilog2 im indices inputlevel insert \
|
hmean hnrmod hypot ilog ilog10 ilog2 im indices inputlevel insert \
|
||||||
int inverse iroot isassoc isatty isblk isconfig isdefined iserror \
|
int inverse iroot isassoc isatty isblk isconfig isdefined iserror \
|
||||||
iseven isfile ishash isident isint islist ismat ismult isnull isnum \
|
iseven isfile ishash isident isint islist ismat ismult isnull isnum \
|
||||||
|
45
help/estr
Normal file
45
help/estr
Normal 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
|
||||||
|
|
@@ -7,19 +7,18 @@ SYNOPSIS
|
|||||||
TYPES
|
TYPES
|
||||||
fs file stream open for reading
|
fs file stream open for reading
|
||||||
|
|
||||||
return string, null or error value
|
return string or null
|
||||||
|
|
||||||
DESCRIPTION
|
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
|
characters are skipped. If the reading reaches end-of-file, the
|
||||||
null value is returned. If non-whitespace is encountered, formation
|
null value is returned. Otherwise the function returns the empty
|
||||||
of a string begins, continuing until whitespace of '\0' or end-of-file
|
string "" if the first non-white character is '\0', and in other cases,
|
||||||
is reached. The returned value is this string (terminated as usual
|
the string formed by the non-white-space characters read until '\0' or
|
||||||
by a null character). After the operation, the file position will
|
a white-space character or te end of the file is reached. In the
|
||||||
be immediately after the first whitespace character of '\0' or at
|
cases where the reading is stopped by '\0' or white-space character,
|
||||||
end-of-file.
|
the file position will be that immediately after that character.
|
||||||
|
|
||||||
EXAMPLE
|
EXAMPLE
|
||||||
|
|
||||||
@@ -67,8 +66,8 @@ SEE ALSO
|
|||||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||||
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||||
##
|
##
|
||||||
## @(#) $Revision: 29.5 $
|
## @(#) $Revision: 29.6 $
|
||||||
## @(#) $Id: fgetfield,v 29.5 2006/06/25 22:16:55 chongo Exp $
|
## @(#) $Id: fgetfield,v 29.6 2006/08/20 15:01:57 chongo Exp $
|
||||||
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/fgetfield,v $
|
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/fgetfield,v $
|
||||||
##
|
##
|
||||||
## Under source code control: 1996/04/30 03:05:17
|
## Under source code control: 1996/04/30 03:05:17
|
||||||
|
72
help/fgetfile
Normal file
72
help/fgetfile
Normal 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/
|
24
help/fputs
24
help/fputs
@@ -2,34 +2,34 @@ NAME
|
|||||||
fputs - write a string to a file
|
fputs - write a string to a file
|
||||||
|
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
fputs(fd, data)
|
fputs(fd, s1, s2, ...)
|
||||||
|
|
||||||
TYPES
|
TYPES
|
||||||
fd file
|
fd file stream open for writing
|
||||||
data str
|
s1, s2, ... strings
|
||||||
|
|
||||||
return nil
|
return null value
|
||||||
|
|
||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
This function writes the string found in data to the file
|
This function writes in succession the strings s1, s2, ..., to the
|
||||||
associated with fd.
|
file associated with fd.
|
||||||
|
|
||||||
EXAMPLE
|
EXAMPLE
|
||||||
; fd = fopen("/tmp/newfile", "w")
|
; fd = fopen("/tmp/newfile", "w")
|
||||||
; fputs(fd, "chongo was here\n")
|
; fputs(fd, "chongo was", " here\n")
|
||||||
; fd2 = fopen("/tmp/newfile", "r")
|
; fd2 = fopen("/tmp/newfile", "r")
|
||||||
; fgetline(fd2)
|
; fgetline(fd2)
|
||||||
"chongo was here"
|
"chongo was here"
|
||||||
|
|
||||||
LIMITS
|
LIMITS
|
||||||
fd must be associated with an open file
|
The number of arguments is not to exceed 1024
|
||||||
|
|
||||||
LINK LIBRARY
|
LINK LIBRARY
|
||||||
none
|
none
|
||||||
|
|
||||||
SEE ALSO
|
SEE ALSO
|
||||||
errno, fclose, feof, ferror, fflush, fgetc, fgetline, fgets, files, fopen,
|
errno, fclose, feof, ferror, fflush, fgetc, fgetfile, fgetline, fgets,
|
||||||
fprintf, fputc, fputs, fseek, fsize, ftell, isfile, printf, prompt
|
files, fopen, fprintf, fputc, fseek, fsize, ftell, isfile
|
||||||
|
|
||||||
## Copyright (C) 1999 Landon Curt Noll
|
## 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.
|
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||||
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||||
##
|
##
|
||||||
## @(#) $Revision: 29.3 $
|
## @(#) $Revision: 29.4 $
|
||||||
## @(#) $Id: fputs,v 29.3 2006/05/07 07:25:46 chongo Exp $
|
## @(#) $Id: fputs,v 29.4 2006/08/20 15:01:57 chongo Exp $
|
||||||
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/fputs,v $
|
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/fputs,v $
|
||||||
##
|
##
|
||||||
## Under source code control: 1995/03/04 11:33:20
|
## Under source code control: 1995/03/04 11:33:20
|
||||||
|
@@ -26,7 +26,7 @@ EXAMPLE
|
|||||||
; name(f)
|
; name(f)
|
||||||
"/tmp/beta"
|
"/tmp/beta"
|
||||||
|
|
||||||
; names(files(0))
|
; name(files(0))
|
||||||
"(stdin)"
|
"(stdin)"
|
||||||
|
|
||||||
LIMITS
|
LIMITS
|
||||||
@@ -54,8 +54,8 @@ SEE ALSO
|
|||||||
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||||
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||||
##
|
##
|
||||||
## @(#) $Revision: 29.4 $
|
## @(#) $Revision: 29.5 $
|
||||||
## @(#) $Id: name,v 29.4 2006/06/25 22:16:55 chongo Exp $
|
## @(#) $Id: name,v 29.5 2006/08/20 15:01:57 chongo Exp $
|
||||||
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/name,v $
|
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/name,v $
|
||||||
##
|
##
|
||||||
## Under source code control: 1997/04/05 14:12:44
|
## Under source code control: 1997/04/05 14:12:44
|
||||||
|
90
help/quomod
90
help/quomod
@@ -1,41 +1,73 @@
|
|||||||
NAME
|
NAME
|
||||||
quomod - assign quotient and remainder to two variables
|
quomod - assign quotient and remainder to two lvalues
|
||||||
|
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
quomod(x, y, q, r [, rnd])
|
quomod(x, y, Q, R [, rnd])
|
||||||
|
|
||||||
TYPES
|
TYPES
|
||||||
x real
|
x real
|
||||||
y real
|
y real
|
||||||
q any
|
Q null-or-real-valued lvalue with assign-to permission
|
||||||
r any
|
R null-or-real-valued lvalue with assign-to permission
|
||||||
rnd integer, defaults to config("quomod")
|
rnd nonnegative integer, defaults to config("quomod")
|
||||||
|
|
||||||
return real
|
return 0 or 1
|
||||||
|
|
||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
Returns 0 or 1 according as x is or is not a multiple of y.
|
If y is nonzero and x/y is an integer q, this function assigns
|
||||||
Let x = q * y + r where q is an integer and 0 <= r < y
|
q to Q and zero to R, and returns zero.
|
||||||
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.
|
|
||||||
|
|
||||||
The argument rnd (if passed or config value config("quomod") if the
|
If y is zero, zero is assigned to Q, x to R and 0 or 1 returned
|
||||||
rnd argument is not passed) impacts the rounding mode for producing
|
according as x is zero or nonzero.
|
||||||
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").
|
|
||||||
|
|
||||||
XXX - replace the above paragraph and directly describe how rnd
|
In the remaining case, y nonzero and x/y not an intger, there
|
||||||
and config("quomod") impact quomod.
|
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
|
EXAMPLE
|
||||||
; global u, v;
|
; global u, v;
|
||||||
@@ -59,13 +91,13 @@ EXAMPLE
|
|||||||
1 3 -1
|
1 3 -1
|
||||||
|
|
||||||
LIMITS
|
LIMITS
|
||||||
y > 0
|
rnd < 2^31
|
||||||
|
|
||||||
LINK LIBRARY
|
LINK LIBRARY
|
||||||
BOOL qquomod(NUMBER *q1, NUMBER *q2, NUMBER **retqdiv, NUMBER **retqmod)
|
BOOL qquomod(NUMBER *q1, NUMBER *q2, NUMBER **quo, NUMBER **mod)
|
||||||
|
|
||||||
SEE ALSO
|
SEE ALSO
|
||||||
//, %
|
//, %, quo, mod, floor. ceil, int. frac
|
||||||
|
|
||||||
## Copyright (C) 1999-2006 Landon Curt Noll
|
## 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.
|
## received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||||
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||||
##
|
##
|
||||||
## @(#) $Revision: 29.5 $
|
## @(#) $Revision: 29.7 $
|
||||||
## @(#) $Id: quomod,v 29.5 2006/06/25 20:33:26 chongo Exp $
|
## @(#) $Id: quomod,v 29.7 2006/08/20 15:01:57 chongo Exp $
|
||||||
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/quomod,v $
|
## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/quomod,v $
|
||||||
##
|
##
|
||||||
## Under source code control: 1995/05/07 03:17:03
|
## Under source code control: 1995/05/07 03:17:03
|
||||||
|
46
rpm.mk
46
rpm.mk
@@ -19,8 +19,8 @@
|
|||||||
# received a copy with calc; if not, write to Free Software Foundation, Inc.
|
# received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||||
# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#
|
#
|
||||||
MAKEFILE_REV= $$Revision: 29.13 $$
|
MAKEFILE_REV= $$Revision: 29.14 $$
|
||||||
# @(#) $Id: rpm.mk,v 29.13 2003/04/15 03:39:17 chongo Exp $
|
# @(#) $Id: rpm.mk,v 29.14 2006/08/20 16:47:51 chongo Exp $
|
||||||
# @(#) $Source: /usr/local/src/cmd/calc/RCS/rpm.mk,v $
|
# @(#) $Source: /usr/local/src/cmd/calc/RCS/rpm.mk,v $
|
||||||
#
|
#
|
||||||
# Under source code control: 2003/02/16 20:21:39
|
# 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
|
DRPM686= $(PROJECT_NAME)-devel-$(PROJECT_VERSION)-$(PROJECT_RELEASE).${TARCH}.rpm
|
||||||
SRPM= $(PROJECT)-$(PROJECT_RELEASE).src.rpm
|
SRPM= $(PROJECT)-$(PROJECT_RELEASE).src.rpm
|
||||||
TMPDIR= /var/tmp
|
TMPDIR= /var/tmp
|
||||||
RHDIR= /usr/src/redhat
|
RPMDIR= /usr/src/redhat
|
||||||
|
|
||||||
all: calc.spec ver_calc
|
all: calc.spec ver_calc
|
||||||
$(MAKE) -f rpm.mk PROJECT_VERSION="`./ver_calc`" \
|
$(MAKE) -f rpm.mk PROJECT_VERSION="`./ver_calc`" \
|
||||||
@@ -80,50 +80,50 @@ calc.spec: calc.spec.in ver_calc
|
|||||||
srcpkg: make_rhdir
|
srcpkg: make_rhdir
|
||||||
find . -depth -print | egrep -v '/RCS|/CVS|/NOTES|\.gone' | \
|
find . -depth -print | egrep -v '/RCS|/CVS|/NOTES|\.gone' | \
|
||||||
cpio -dumpv $(TMPDIR)/$(PROJECT)
|
cpio -dumpv $(TMPDIR)/$(PROJECT)
|
||||||
(cd $(TMPDIR); tar cf - $(PROJECT) | \
|
(cd $(TMPDIR); tar cf - $(PROJECT)) | \
|
||||||
gzip -c > $(RHDIR)/SOURCES/$(TARBALL))
|
gzip -c > $(RPMDIR)/SOURCES/$(TARBALL)
|
||||||
rm -fr $(TMPDIR)/$(PROJECT)
|
rm -fr $(TMPDIR)/$(PROJECT)
|
||||||
|
|
||||||
.PHONY: rpm
|
.PHONY: rpm
|
||||||
rpm: srcpkg calc.spec
|
rpm: srcpkg calc.spec
|
||||||
$(MAKE) -f Makefile clean
|
$(MAKE) -f Makefile clean
|
||||||
cp $(SPECFILE) $(RHDIR)/SPECS/$(SPECFILE)
|
cp $(SPECFILE) $(RPMDIR)/SPECS/$(SPECFILE)
|
||||||
rm -f $(RHDIR)/RPMS/${TARCH}/$(RPM686)
|
rm -f $(RPMDIR)/RPMS/${TARCH}/$(RPM686)
|
||||||
rm -f $(RHDIR)/RPMS/${TARCH}/$(DRPM686)
|
rm -f $(RPMDIR)/RPMS/${TARCH}/$(DRPM686)
|
||||||
rm -f $(RHDIR)/SRPMS/$(SRPM)
|
rm -f $(RPMDIR)/SRPMS/$(SRPM)
|
||||||
${RPMBUILD_TOOL} ${RPMBUILD_OPTION} $(RHDIR)/SPECS/$(SPECFILE)
|
${RPMBUILD_TOOL} ${RPMBUILD_OPTION} $(RPMDIR)/SPECS/$(SPECFILE)
|
||||||
@if [ ! -f "$(RHDIR)/SRPMS/$(SRPM)" ]; then \
|
@if [ ! -f "$(RPMDIR)/SRPMS/$(SRPM)" ]; then \
|
||||||
echo "SRPMS/$(SRPM) not found" 1>&2; \
|
echo "SRPMS/$(SRPM) not found" 1>&2; \
|
||||||
exit 3; \
|
exit 3; \
|
||||||
fi
|
fi
|
||||||
@echo
|
@echo
|
||||||
@echo "RPM package sizes:"
|
@echo "RPM package sizes:"
|
||||||
@echo
|
@echo
|
||||||
@cd $(RHDIR); ls -1s RPMS/${TARCH}/$(RPM686) \
|
@cd $(RPMDIR); ls -1s RPMS/${TARCH}/$(RPM686) \
|
||||||
RPMS/${TARCH}/$(DRPM686) SRPMS/$(SRPM)
|
RPMS/${TARCH}/$(DRPM686) SRPMS/$(SRPM)
|
||||||
@echo
|
@echo
|
||||||
@echo "RPM package md5 hashes:"
|
@echo "RPM package md5 hashes:"
|
||||||
@echo
|
@echo
|
||||||
-@cd $(RHDIR); ${MD5SUM} RPMS/${TARCH}/$(RPM686) \
|
-@cd $(RPMDIR); ${MD5SUM} RPMS/${TARCH}/$(RPM686) \
|
||||||
RPMS/${TARCH}/$(DRPM686) SRPMS/$(SRPM)
|
RPMS/${TARCH}/$(DRPM686) SRPMS/$(SRPM)
|
||||||
@echo
|
@echo
|
||||||
@echo "RPM package sha1 hashes:"
|
@echo "RPM package sha1 hashes:"
|
||||||
@echo
|
@echo
|
||||||
-@cd $(RHDIR); ${SHA1SUM} RPMS/${TARCH}/$(RPM686) \
|
-@cd $(RPMDIR); ${SHA1SUM} RPMS/${TARCH}/$(RPM686) \
|
||||||
RPMS/${TARCH}/$(DRPM686) SRPMS/$(SRPM)
|
RPMS/${TARCH}/$(DRPM686) SRPMS/$(SRPM)
|
||||||
@echo
|
@echo
|
||||||
@echo "RPM package locations:"
|
@echo "RPM package locations:"
|
||||||
@echo
|
@echo
|
||||||
@ls -1 $(RHDIR)/RPMS/${TARCH}/$(RPM686) \
|
@ls -1 $(RPMDIR)/RPMS/${TARCH}/$(RPM686) \
|
||||||
$(RHDIR)/RPMS/${TARCH}/$(DRPM686) $(RHDIR)/SRPMS/$(SRPM)
|
$(RPMDIR)/RPMS/${TARCH}/$(DRPM686) $(RPMDIR)/SRPMS/$(SRPM)
|
||||||
@echo
|
@echo
|
||||||
@echo "All done! -- Jessica Noll, Age 2"
|
@echo "All done! -- Jessica Noll, Age 2"
|
||||||
@echo
|
@echo
|
||||||
|
|
||||||
.PHONY: make_rhdir
|
.PHONY: make_rhdir
|
||||||
make_rhdir:
|
make_rhdir:
|
||||||
for i in $(RHDIR) $(RHDIR)/RPMS $(RHDIR)/SOURCES \
|
for i in $(RPMDIR) $(RPMDIR)/RPMS $(RPMDIR)/SOURCES \
|
||||||
$(RHDIR)/SPECS $(RHDIR)/SRPMS $(RHDIR)/BUILD; do \
|
$(RPMDIR)/SPECS $(RPMDIR)/SRPMS $(RPMDIR)/BUILD; do \
|
||||||
if [ ! -d $$i ] ; then \
|
if [ ! -d $$i ] ; then \
|
||||||
mkdir -p $$i; \
|
mkdir -p $$i; \
|
||||||
fi; \
|
fi; \
|
||||||
@@ -136,9 +136,9 @@ logdate:
|
|||||||
|
|
||||||
.PHONY: chkpkg
|
.PHONY: chkpkg
|
||||||
chkpkg:
|
chkpkg:
|
||||||
for i in $(RHDIR)/RPMS/${TARCH}/$(RPM686) \
|
for i in $(RPMDIR)/RPMS/${TARCH}/$(RPM686) \
|
||||||
$(RHDIR)/RPMS/${TARCH}/$(DRPM686) \
|
$(RPMDIR)/RPMS/${TARCH}/$(DRPM686) \
|
||||||
$(RHDIR)/SRPMS/$(SRPM) ; do \
|
$(RPMDIR)/SRPMS/$(SRPM) ; do \
|
||||||
echo "***** start $$i" ; \
|
echo "***** start $$i" ; \
|
||||||
${RPM_TOOL} -qpi $$i ; \
|
${RPM_TOOL} -qpi $$i ; \
|
||||||
echo "***** files $$i" ; \
|
echo "***** files $$i" ; \
|
||||||
@@ -165,8 +165,8 @@ installrpm:
|
|||||||
echo "must be root to install RPMs" 1>&2; \
|
echo "must be root to install RPMs" 1>&2; \
|
||||||
exit 5; \
|
exit 5; \
|
||||||
fi
|
fi
|
||||||
${RPM_TOOL} -ivh $(RHDIR)/RPMS/${TARCH}/$(RPM686)
|
${RPM_TOOL} -ivh $(RPMDIR)/RPMS/${TARCH}/$(RPM686)
|
||||||
${RPM_TOOL} -ivh $(RHDIR)/RPMS/${TARCH}/$(DRPM686)
|
${RPM_TOOL} -ivh $(RPMDIR)/RPMS/${TARCH}/$(DRPM686)
|
||||||
|
|
||||||
.PHONY: uninstallrpm
|
.PHONY: uninstallrpm
|
||||||
uninstallrpm:
|
uninstallrpm:
|
||||||
|
61
string.c
61
string.c
@@ -19,8 +19,8 @@
|
|||||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*
|
*
|
||||||
* @(#) $Revision: 29.9 $
|
* @(#) $Revision: 29.10 $
|
||||||
* @(#) $Id: string.c,v 29.9 2006/05/20 10:13:39 chongo Exp $
|
* @(#) $Id: string.c,v 29.10 2006/08/20 15:01:30 chongo Exp $
|
||||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/string.c,v $
|
* @(#) $Source: /usr/local/src/cmd/calc/RCS/string.c,v $
|
||||||
*
|
*
|
||||||
* Under source code control: 1990/02/15 01:48:10
|
* Under source code control: 1990/02/15 01:48:10
|
||||||
@@ -1292,18 +1292,15 @@ freestringconstant(long index)
|
|||||||
long
|
long
|
||||||
printechar(char *c)
|
printechar(char *c)
|
||||||
{
|
{
|
||||||
long n;
|
unsigned char ch, cc;
|
||||||
unsigned char ch;
|
|
||||||
unsigned char ech; /* for escape sequence */
|
unsigned char ech; /* for escape sequence */
|
||||||
unsigned char nch; /* for next character */
|
|
||||||
BOOL three;
|
|
||||||
|
|
||||||
ch = *c;
|
ch = *c;
|
||||||
if (ch >= ' ' && ch < 127 && ch != '\\' && ch != '\"') {
|
if (ch >= ' ' && ch < 127 && ch != '\\' && ch != '\"' && ch != '\'') {
|
||||||
putchar(ch);
|
math_chr(ch);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
putchar('\\');
|
math_chr('\\');
|
||||||
ech = 0;
|
ech = 0;
|
||||||
switch (ch) {
|
switch (ch) {
|
||||||
case '\n': ech = 'n'; break;
|
case '\n': ech = 'n'; break;
|
||||||
@@ -1314,28 +1311,28 @@ printechar(char *c)
|
|||||||
case '\v': ech = 'v'; break;
|
case '\v': ech = 'v'; break;
|
||||||
case '\\': ech = '\\'; break;
|
case '\\': ech = '\\'; break;
|
||||||
case '\"': ech = '\"'; break;
|
case '\"': ech = '\"'; break;
|
||||||
|
case '\'': ech = '\''; break;
|
||||||
|
case 0: ech = '0'; break;
|
||||||
case 7: ech = 'a'; break;
|
case 7: ech = 'a'; break;
|
||||||
case 27: ech = 'e'; break;
|
case 27: ech = 'e'; break;
|
||||||
}
|
}
|
||||||
|
if (ech == '0') {
|
||||||
|
cc = *(c + 1);
|
||||||
|
if (cc >= '0' && cc < '8') {
|
||||||
|
math_str("000");
|
||||||
|
return 4;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (ech) {
|
if (ech) {
|
||||||
putchar(ech);
|
math_chr(ech);
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
nch = *(c + 1);
|
math_chr('x');
|
||||||
three = (nch >= '0' && nch < '8');
|
cc = ch / 16;
|
||||||
n = 2;
|
math_chr((cc < 10) ? '0' + cc : 87 + cc);
|
||||||
if (three || ch >= 64) {
|
cc = ch % 16;
|
||||||
putchar('0' + ch/64);
|
math_chr((cc < 10) ? '0' + cc : 87 + cc);
|
||||||
n++;
|
return 4;
|
||||||
}
|
|
||||||
ch %= 64;
|
|
||||||
if (three || ch >= 8) {
|
|
||||||
putchar('0' + ch/8);
|
|
||||||
n++;
|
|
||||||
}
|
|
||||||
ch %= 8;
|
|
||||||
putchar('0' + ch);
|
|
||||||
return n;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1376,11 +1373,23 @@ fitstring(char *str, long len, long width)
|
|||||||
n++;
|
n++;
|
||||||
}
|
}
|
||||||
if (j > i)
|
if (j > i)
|
||||||
printf("...");
|
math_str("...");
|
||||||
while (j++ < len)
|
while (j++ < len)
|
||||||
(void) printechar(c++);
|
(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
|
void
|
||||||
showstrings(void)
|
showstrings(void)
|
||||||
{
|
{
|
||||||
|
5
string.h
5
string.h
@@ -17,8 +17,8 @@
|
|||||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*
|
*
|
||||||
* @(#) $Revision: 29.6 $
|
* @(#) $Revision: 29.7 $
|
||||||
* @(#) $Id: string.h,v 29.6 2006/05/19 15:26:10 chongo Exp $
|
* @(#) $Id: string.h,v 29.7 2006/08/20 15:01:30 chongo Exp $
|
||||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/string.h,v $
|
* @(#) $Source: /usr/local/src/cmd/calc/RCS/string.h,v $
|
||||||
*
|
*
|
||||||
* Under source code control: 1990/02/15 01:48:36
|
* Under source code control: 1990/02/15 01:48:36
|
||||||
@@ -73,6 +73,7 @@ extern STRING *findstring(long index);
|
|||||||
extern STRING *slink(STRING *);
|
extern STRING *slink(STRING *);
|
||||||
extern void sfree(STRING *);
|
extern void sfree(STRING *);
|
||||||
extern void fitstring(char *, long, long);
|
extern void fitstring(char *, long, long);
|
||||||
|
extern void strprint(STRING *);
|
||||||
extern void showstrings(void);
|
extern void showstrings(void);
|
||||||
extern void showliterals(void);
|
extern void showliterals(void);
|
||||||
extern STRING _nullstring_;
|
extern STRING _nullstring_;
|
||||||
|
116
value.c
116
value.c
@@ -17,8 +17,8 @@
|
|||||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*
|
*
|
||||||
* @(#) $Revision: 29.9 $
|
* @(#) $Revision: 29.10 $
|
||||||
* @(#) $Id: value.c,v 29.9 2006/06/01 11:47:07 chongo Exp $
|
* @(#) $Id: value.c,v 29.10 2006/08/20 15:01:30 chongo Exp $
|
||||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/value.c,v $
|
* @(#) $Source: /usr/local/src/cmd/calc/RCS/value.c,v $
|
||||||
*
|
*
|
||||||
* Under source code control: 1990/02/15 01:48:25
|
* 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
|
* config_print - print a configuration value
|
||||||
|
5
value.h
5
value.h
@@ -17,8 +17,8 @@
|
|||||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*
|
*
|
||||||
* @(#) $Revision: 29.10 $
|
* @(#) $Revision: 29.11 $
|
||||||
* @(#) $Id: value.h,v 29.10 2006/05/19 15:26:10 chongo Exp $
|
* @(#) $Id: value.h,v 29.11 2006/08/20 15:01:30 chongo Exp $
|
||||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/value.h,v $
|
* @(#) $Source: /usr/local/src/cmd/calc/RCS/value.h,v $
|
||||||
*
|
*
|
||||||
* Under source code control: 1993/07/30 19:42:47
|
* Under source code control: 1993/07/30 19:42:47
|
||||||
@@ -243,6 +243,7 @@ extern DLL void relvalue(VALUE *v1, VALUE *v2, VALUE *vres);
|
|||||||
extern DLL void sgnvalue(VALUE *vp, VALUE *vres);
|
extern DLL void sgnvalue(VALUE *vp, VALUE *vres);
|
||||||
extern DLL QCKHASH hashvalue(VALUE *vp, QCKHASH val);
|
extern DLL QCKHASH hashvalue(VALUE *vp, QCKHASH val);
|
||||||
extern DLL void printvalue(VALUE *vp, int flags);
|
extern DLL void printvalue(VALUE *vp, int flags);
|
||||||
|
extern DLL void printestr(VALUE *vp);
|
||||||
extern DLL BOOL precvalue(VALUE *v1, VALUE *v2);
|
extern DLL BOOL precvalue(VALUE *v1, VALUE *v2);
|
||||||
extern DLL VALUE error_value(int e);
|
extern DLL VALUE error_value(int e);
|
||||||
extern DLL int set_errno(int e);
|
extern DLL int set_errno(int e);
|
||||||
|
@@ -19,8 +19,8 @@
|
|||||||
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
* received a copy with calc; if not, write to Free Software Foundation, Inc.
|
||||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*
|
*
|
||||||
* @(#) $Revision: 29.63 $
|
* @(#) $Revision: 29.65 $
|
||||||
* @(#) $Id: version.c,v 29.63 2006/06/26 05:53:25 chongo Exp $
|
* @(#) $Id: version.c,v 29.65 2006/08/20 16:18:10 chongo Exp $
|
||||||
* @(#) $Source: /usr/local/src/cmd/calc/RCS/version.c,v $
|
* @(#) $Source: /usr/local/src/cmd/calc/RCS/version.c,v $
|
||||||
*
|
*
|
||||||
* Under source code control: 1990/05/22 11:00:58
|
* Under source code control: 1990/05/22 11:00:58
|
||||||
@@ -48,7 +48,7 @@ static char *program;
|
|||||||
#define MAJOR_VER 2 /* major version */
|
#define MAJOR_VER 2 /* major version */
|
||||||
#define MINOR_VER 12 /* minor version */
|
#define MINOR_VER 12 /* minor version */
|
||||||
#define MAJOR_PATCH 0 /* patch level or 0 if no patch */
|
#define MAJOR_PATCH 0 /* patch level or 0 if no patch */
|
||||||
#define MINOR_PATCH 6 /* test number or 0 if no minor patch */
|
#define MINOR_PATCH 8 /* test number or 0 if no minor patch */
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@@ -427,5 +427,9 @@ CONST char *error_table[E__COUNT+2] = {
|
|||||||
"Unrecognized mode for fpathopen",
|
"Unrecognized mode for fpathopen",
|
||||||
"Bad epsilon argument for log",
|
"Bad epsilon argument for log",
|
||||||
"Non-numeric first 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
|
NULL
|
||||||
};
|
};
|
||||||
|
@@ -424,9 +424,13 @@
|
|||||||
#define E_FPATHOPEN2 10411 /* Unrecognized mode for fpathopen */
|
#define E_FPATHOPEN2 10411 /* Unrecognized mode for fpathopen */
|
||||||
#define E_LOG1 10412 /* Bad epsilon argument for log */
|
#define E_LOG1 10412 /* Bad epsilon argument for log */
|
||||||
#define E_LOG2 10413 /* Non-numeric first 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__HIGHEST 10417 /* highest calc error */
|
||||||
#define E__COUNT 413 /* number of calc errors */
|
#define E__COUNT 417 /* number of calc errors */
|
||||||
#define E_USERDEF 20000 /* base of user defined errors */
|
#define E_USERDEF 20000 /* base of user defined errors */
|
||||||
|
|
||||||
/* names of calc error values */
|
/* names of calc error values */
|
||||||
|
Reference in New Issue
Block a user