From 87570b56fe3e5bd45dba42ec5b767e33dfae2e26 Mon Sep 17 00:00:00 2001 From: Landon Curt Noll Date: Sun, 25 Jun 2006 16:40:26 -0700 Subject: [PATCH] Release calc version 2.12.0.5 --- CHANGES | 38 ++++++++- cal/Makefile | 6 +- cal/README | 25 +++++- cal/regress.cal | 80 ++++++++++++++++--- cal/sumtimes.cal | 186 ++++++++++++++++++++++++++++++++++++++++++++ cal/test2700.cal | 10 +-- calcerr.tbl | 12 +-- config.c | 7 +- config.h | 8 +- custom/c_argv.c | 7 +- custom/c_pmodm127.c | 10 ++- func.c | 161 +++++++++++++++++++++++++++++--------- help/append | 9 ++- help/argv | 8 +- help/avg | 8 +- help/blk | 23 +++++- help/cmdbuf | 8 +- help/comb | 8 +- help/config | 10 ++- help/define | 6 +- help/delete | 9 ++- help/fact | 8 +- help/factor | 7 +- help/fgetfield | 8 +- help/fgetstr | 8 +- help/fib | 8 +- help/fprintf | 8 +- help/fputstr | 8 +- help/freopen | 10 +-- help/fscan | 10 +-- help/fscanf | 10 +-- help/gcd | 8 +- help/hash | 8 +- help/hmean | 8 +- help/insert | 9 ++- help/isblk | 8 +- help/isdefined | 8 +- help/islist | 19 ++--- help/isobjtype | 8 +- help/isprime | 13 ++-- help/israndom | 8 +- help/lcm | 8 +- help/lfactor | 7 +- help/mat | 10 +-- help/matdim | 10 ++- help/matfill | 10 ++- help/matmax | 10 ++- help/matmin | 10 ++- help/matsum | 10 ++- help/mattrans | 10 ++- help/max | 8 +- help/min | 10 +-- help/mod | 72 +++++++++++------ help/name | 8 +- help/nextcand | 9 ++- help/nextprime | 9 ++- help/null | 8 +- help/perm | 8 +- help/pfact | 9 ++- help/pi | 8 +- help/pix | 9 ++- help/poly | 10 +-- help/pop | 9 ++- help/prevcand | 9 ++- help/prevprime | 9 ++- help/printf | 8 +- help/prompt | 6 +- help/ptest | 9 ++- help/push | 9 ++- help/quo | 18 ++++- help/quomod | 40 ++++++++-- help/randperm | 11 ++- help/remove | 9 ++- help/rewind | 10 +-- help/rsearch | 11 ++- help/runtime | 10 +-- help/scale | 8 +- help/scan | 10 +-- help/scanf | 10 +-- help/search | 10 ++- help/select | 10 +-- help/size | 8 +- help/ssq | 27 ++++--- help/str | 6 +- help/strcat | 24 ++++-- help/strcmp | 30 ++++++- help/strcpy | 29 ++++++- help/strerror | 7 +- help/strlen | 9 ++- help/strncmp | 29 ++++++- help/strncpy | 29 ++++++- help/strpos | 10 +-- help/strprintf | 11 ++- help/strscan | 13 ++-- help/strscanf | 13 ++-- help/substr | 9 ++- help/sum | 11 ++- help/system | 9 +-- help/variable | 5 +- help/xor | 10 +-- opcodes.c | 71 +---------------- opcodes.h | 79 ++++++++++--------- qmath.h | 8 +- qmod.c | 58 +++++++------- quickhash.c | 10 ++- token.c | 7 +- version.c | 6 +- win32/calcerr.c | 6 +- win32/calcerr.h | 6 +- 109 files changed, 1203 insertions(+), 627 deletions(-) create mode 100644 cal/sumtimes.cal diff --git a/CHANGES b/CHANGES index 73deb77..4a63f73 100644 --- a/CHANGES +++ b/CHANGES @@ -332,6 +332,35 @@ The following are the changes from calc version 2.12.0 to date: Change/restored the syntax rules for "for" and "while" loops to recognize an unescaped newline in top-level command-level statements. + Updated help/avg, help/define, help/fprintf, help/gcd, help/hash, + help/hmean, help/lcm, help/max, help/min, help/null, help/poly, + help/printf, help/ssq, help/strcat, help/strprintf, help/sum, + help/xor. + + Changed the definition of the function ssq() to enable list arguments + to be processed in the same way as in sum(). For example: + + ssq(1,2, list(3,4,list(5,6)), list(), 7, 8) + + returns the value of 1^2 + 2^2 + ... + 8^2 == 204. + + Added the calc resource sumtimes.cal, to give the runtimes for + various ways of evaluating sums, sums of squares, etc, for large + lists and matrices. For example: + + read sumtimes + doalltimes(1e6) + + Calc now ignores carrage 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. + + 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. + The following are the changes from calc version 2.11.10.1 to 2.11.11: @@ -478,6 +507,9 @@ The following are the changes from calc version 2.11.10 to 2.11.10: that was reported for the PowerMac G5 2GHz MacOS 10.3 by Guillaume VERGNAUD . + Fixed a number of pending issues with help files filling in + missing LIMITS, LINK LIBRARY, and SEE ALSO information, + The following are the changes from calc version 2.11.9 to 2.11.9.3: @@ -856,7 +888,7 @@ The following are the changes from calc version 2.11.5t4.1 to 2.11.5t4.4: For example when forming the calc rpm, the Makefile is called with T=$RPM_BUILD_ROOT. If $T is empty, calc is installed under /. - Removed all echo_XXX rules except for echo_inst_files from lower + Removed all echo_XYZ rules except for echo_inst_files from lower level makefile. The calc.spec will use a make install rule with T=$RPM_BUILD_ROOT. @@ -6149,8 +6181,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.82 $ -## @(#) $Id: CHANGES,v 29.82 2006/06/20 10:26:41 chongo Exp $ +## @(#) $Revision: 29.83 $ +## @(#) $Id: CHANGES,v 29.83 2006/06/25 22:58:54 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/RCS/CHANGES,v $ ## ## Under source code control: 1993/06/02 18:12:57 diff --git a/cal/Makefile b/cal/Makefile index d40d526..1742eae 100644 --- a/cal/Makefile +++ b/cal/Makefile @@ -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.19 $ -# @(#) $Id: Makefile,v 29.19 2006/06/10 13:01:34 chongo Exp $ +# @(#) $Revision: 29.20 $ +# @(#) $Id: Makefile,v 29.20 2006/06/23 00:34:55 chongo Exp $ # @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/Makefile,v $ # # Under source code control: 1991/07/21 05:00:54 @@ -177,7 +177,7 @@ CALC_FILES= README bigprime.cal deg.cal ellip.cal lucas.cal lucas_chk.cal \ beer.cal hello.cal test5100.cal test5200.cal randombitrun.cal \ randomrun.cal repeat.cal xx_print.cal natnumset.cal qtime.cal \ test8400.cal test8500.cal test8600.cal chi.cal intfile.cal screen.cal \ - dotest.cal set8700.cal set8700.line alg_config.cal + dotest.cal set8700.cal set8700.line alg_config.cal sumtimes.cal # These files are found (but not built) in the distribution # diff --git a/cal/README b/cal/README index a3d0120..3242198 100644 --- a/cal/README +++ b/cal/README @@ -701,6 +701,27 @@ sumsq.cal 4N+1, and always impossible for primes of the form 4N-1. +sumtimes.cal + + timematsum(N) + timelistsum(N) + timematsort(N) + timelistsort(N) + timematreverse(N) + timelistreverse(N) + timematssq(N) + timelistssq(N) + timehmean(N,M) + doalltimes(N) + + Give the runtimes for various ways of evaluating sums, sums of + squares, etc, for large lists and matrices. N is the size of + the list or matrix to use. The doalltimes() function will run + all fo the sumtimes tests. For example: + + doalltimes(1e6); + + surd.cal surd(a, b) @@ -993,8 +1014,8 @@ xx_print.cal ## received a copy with calc; if not, write to Free Software Foundation, Inc. ## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. ## -## @(#) $Revision: 29.14 $ -## @(#) $Id: README,v 29.14 2006/06/11 07:22:05 chongo Exp $ +## @(#) $Revision: 29.15 $ +## @(#) $Id: README,v 29.15 2006/06/23 00:34:55 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/README,v $ ## ## Under source code control: 1990/02/15 01:50:32 diff --git a/cal/regress.cal b/cal/regress.cal index 2824ab1..c462186 100644 --- a/cal/regress.cal +++ b/cal/regress.cal @@ -17,8 +17,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.31 $ - * @(#) $Id: regress.cal,v 29.31 2006/06/20 10:25:00 chongo Exp $ + * @(#) $Revision: 29.34 $ + * @(#) $Id: regress.cal,v 29.34 2006/06/25 20:33:26 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/regress.cal,v $ * * Under source code control: 1990/02/15 01:50:36 @@ -1316,7 +1316,65 @@ define test_functions() */ vrfy(isstr(calcpath()), '1155: isstr(calcpath())'); - print '1156: Ending test_functions'; + /* + * ssq use of lists + */ + vrfy(ssq(1,2, list(3,4,list(5,6)), list(), 7, 8) == 204, + '1156: ssq(1,2, list(3,4,list(5,6)), list(), 7, 8) == 204'); + + /* + * quomod 5th argument rounding tests + */ + vrfy(quomod(10,-3,a,b,0) == 1, '1157: vrfy(quomod(10,-3,a,b,0) == 1'); + vrfy(a == -4, '1158: a == -4'); + vrfy(b == -2, '1159: b == -2'); + vrfy(quomod(-10,-3,a,b,1) == 1, '1160: vrfy(quomod(-10,-3,a,b,1) == 1'); + vrfy(a == 4, '1161: a == 4'); + vrfy(b == 2, '1162: b == 2'); + vrfy(quomod(10,3,a,b,2) == 1, '1163: vrfy(quomod(10,3,a,b,2) == 1'); + vrfy(a == 3, '1164: a == 3'); + vrfy(b == 1, '1165: b == 1'); + vrfy(quomod(-10,3,a,b,3) == 1, '1166: vrfy(quomod(-10,3,a,b,3) == 1'); + vrfy(a == -4, '1167: a == -4'); + vrfy(b == 2, '1168: b == 2'); + vrfy(quomod(10,-3,a,b,4) == 1, '1169: vrfy(quomod(10,-3,a,b,4) == 1'); + vrfy(a == -3, '1170: a == -3'); + vrfy(b == 1, '1171: b == 1'); + vrfy(quomod(-10,-3,a,b,5) == 1, '1172: vrfy(quomod(-10,-3,a,b,5) == 1'); + vrfy(a == 3, '1173: a == 3'); + vrfy(b == -1, '1174: b == -1'); + vrfy(quomod(10,3,a,b,6) == 1, '1175: vrfy(quomod(10,3,a,b,6) == 1'); + vrfy(a == 3, '1176: a == 3'); + vrfy(b == 1, '1177: b == 1'); + vrfy(quomod(-10,3,a,b,7) == 1, '1178: vrfy(quomod(-10,3,a,b,7) == 1'); + vrfy(a == -4, '1179: a == -4'); + vrfy(b == 2, '1180: b == 2'); + vrfy(quomod(10,-3,a,b,8) == 1, '1181: vrfy(quomod(10,-3,a,b,8) == 1'); + vrfy(a == -4, '1182: a == -4'); + vrfy(b == -2, '1183: b == -2'); + vrfy(quomod(-10,-3,a,b,9) == 1, '1184: vrfy(quomod(-10,-3,a,b,9) == 1'); + vrfy(a == 3, '1185: a == 3'); + vrfy(b == -1, '1186: b == -1'); + vrfy(quomod(10,3,a,b,10) == 1, '1187: vrfy(quomod(10,3,a,b,10) == 1'); + vrfy(a == 4, '1188: a == 4'); + vrfy(b == -2, '1189: b == -2'); + vrfy(quomod(-10,3,a,b,11) == 1, '1190: vrfy(quomod(-10,3,a,b,11) == 1'); + vrfy(a == -4, '1191: a == -4'); + vrfy(b == 2, '1192: b == 2'); + vrfy(quomod(10,-3,a,b,12) == 1, '1193: vrfy(quomod(10,-3,a,b,12) == 1'); + vrfy(a == -3, '1194: a == -3'); + vrfy(b == 1, '1195: b == 1'); + vrfy(quomod(-10,-3,a,b,13) == 1,'1196: vrfy(quomod(-10,-3,a,b,13) == 1'); + vrfy(a == 4, '1197: a == 4'); + vrfy(b == 2, '1198: b == 2'); + vrfy(quomod(10,3,a,b,14) == 1, '1199: vrfy(quomod(10,3,a,b,14) == 1'); + vrfy(a == 4, '1200: a == 4'); + vrfy(b == -2, '1201: b == -2'); + vrfy(quomod(-10,3,a,b,15) == 1, '1202: vrfy(quomod(-10,3,a,b,15) == 1'); + vrfy(a == -4, '1203: a == -4'); + vrfy(b == 2, '1204: b == 2'); + + print '1205: Ending test_functions'; } print '017: parsed test_functions()'; @@ -1333,14 +1391,14 @@ define _test_underscore() local _a = 27; local __a = 23209; - print "1200: Beginning _test_underscore"; + print "1290: Beginning _test_underscore"; - vrfy(_a == 27, '1201: _a == 27'); - vrfy(_ == 49, '1202: _ == 49'); - vrfy(__ == 63, '1203: __ == 63'); - vrfy(__a == 23209, '1204: __a == 23209'); + vrfy(_a == 27, '1291: _a == 27'); + vrfy(_ == 49, '1292: _ == 49'); + vrfy(__ == 63, '1293: __ == 63'); + vrfy(__a == 23209, '1294: __a == 23209'); - print "1205: Ending _test_underscore"; + print "1295: Ending _test_underscore"; } print '020: parsed _test_underscore'; @@ -7947,7 +8005,9 @@ print '9836: read -once linear'; print '9837: skipping read -once beer.cal because it is an infinite loop'; print '9838: skipping read -once hello.cal because it is an infinite loop'; print '9839: skipping read -once xx_print.cal because it is a printing demo'; -print '9840: Ending read of selected calc resource files'; +read -once sumtimes; +print '9840: read -once sumtimes'; +print '9841: Ending read of selected calc resource files'; /* diff --git a/cal/sumtimes.cal b/cal/sumtimes.cal new file mode 100644 index 0000000..14e7305 --- /dev/null +++ b/cal/sumtimes.cal @@ -0,0 +1,186 @@ +/* + * sumtimes - runtimes evaluating sums & squares of large lists and mats + * + * Copyright (C) 2006 Ernest Bowen + * + * Calc is open software; you can redistribute it and/or modify it under + * the terms of the version 2.1 of the GNU Lesser General Public License + * as published by the Free Software Foundation. + * + * Calc is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General + * Public License for more details. + * + * A copy of version 2.1 of the GNU Lesser General Public License is + * distributed with calc under the filename COPYING-LGPL. You should have + * received a copy with calc; if not, write to Free Software Foundation, Inc. + * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. + * + * @(#) $Revision: 29.1 $ + * @(#) $Id: sumtimes.cal,v 29.1 2006/06/23 00:35:30 chongo Exp $ + * @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/sumtimes.cal,v $ + * + * Under source code control: 2006/06/22 17:29 + * File existed as early as: 2006 + * + * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ + */ + + +global sumtimes_t0, sumtimes_t1, sumtimes_t2, sumtimes_t3; +global sumtimes_A, sumtimes_B; +config("tilde", 0),; + +define timematsum(N) { + local n, s, p, ptop; + + sumtimes_A = mat[N]; + + for (n = 0; n < N; n++) sumtimes_A[n] = rand(N); + + ptop = &sumtimes_A[n-1]; + sumtimes_t0 = runtime(); + for (s = n = 0; n < N; n++) s += sumtimes_A[n]; + sumtimes_t1 = runtime(); + for (s = 0, p = &sumtimes_A[0]; p <= ptop; p++) s += *p; + sumtimes_t2 = runtime(); + s = matsum(sumtimes_A); + sumtimes_t3 = runtime(); + + print "Matrix sum runtimes"; + printf('\tStandard "for" loop:\t\t%.4f\n', sumtimes_t1 - sumtimes_t0); + printf('\t"For" loop using pointers:\t\t%.4f\n', sumtimes_t2 - sumtimes_t1); + printf('\tUsing builtin "matsum":\t\t%.4f\n', sumtimes_t3 - sumtimes_t2); +} + +define timelistsum(N) { + local n, s; + + sumtimes_A = makelist(N); + for (n = 0; n < N; n++) sumtimes_A[n] = rand(N); + + sumtimes_t0 = runtime(); + for (s = n = 0; n < N; n++) s += sumtimes_A[n]; + sumtimes_t1 = runtime(); + s = sum(sumtimes_A); + sumtimes_t2 = runtime(); + print "List sum runtimes"; + printf('\tStandard "for" loop:\t\t%.4f\n', sumtimes_t1 - sumtimes_t0); + printf('\tUsing builtin "sum":\t\t%.4f\n', sumtimes_t2 - sumtimes_t1); +} + + +define timematsort(N) { + local n; + + sumtimes_A = mat[N]; + for (n = 0; n < N; n++) sumtimes_A[n] = rand(N); + sumtimes_t0 = runtime(); + sort(sumtimes_A); + sumtimes_t1 = runtime(); + printf('\tMatrix sort runtime:\t\t%.4f\n', sumtimes_t1 - sumtimes_t0); +} + + +define timelistsort(N) { + local n; + + sumtimes_A = makelist(N); + for (n = 0; n < N; n++) sumtimes_A[n] = rand(N); + sumtimes_t0 = runtime(); + sort(sumtimes_A); + sumtimes_t1 = runtime(); + printf('\tList sort runtime:\t\t%.4f\n', sumtimes_t1 - sumtimes_t0); +} + +define timematreverse(N) { + local n; + + sumtimes_A = mat[N]; + for (n = 0; n < N; n++) sumtimes_A[n] = rand(N); + sumtimes_t0 = runtime(); + reverse(sumtimes_A); + sumtimes_t1 = runtime(); + printf('\tMatrix reverse runtime %.4f\n', sumtimes_t1 - sumtimes_t0); +} + +define timelistreverse(N) { + local n; + + sumtimes_A = makelist(N); + for (n = 0; n < N; n++) sumtimes_A[n] = rand(N); + sumtimes_t0 = runtime(); + reverse(sumtimes_A); + sumtimes_t1 = runtime(); + printf('\tList reverse runtime:\t\t%.4f\n', sumtimes_t1 - sumtimes_t0); +} + +define timematssq(N) { + local n, s, p, ptop; + + sumtimes_A = mat[N]; + + for (n = 0; n < N; n++) sumtimes_A[n] = rand(N); + + ptop = &sumtimes_A[n-1]; + sumtimes_t0 = runtime(); + for (s = n = 0; n < N; n++) s += sumtimes_A[n]^2; + sumtimes_t1 = runtime(); + for (s = 0, p = &sumtimes_A[0]; p <= ptop; p++) s += (*p)^2; + sumtimes_t2 = runtime(); + + print "Matrix sum of squares runtimes"; + printf('\tStandard "for" loop:\t\t%.4f\n', sumtimes_t1 - sumtimes_t0); + printf('\t"For" loop using pointers:\t\t%.4f\n', sumtimes_t2 - sumtimes_t1); +} + +define timelistssq(N) { + local n, s; + + sumtimes_A = makelist(N); + for (n = 0; n < N; n++) sumtimes_A[n] = rand(N); + + sumtimes_t0 = runtime(); + for (s = n = 0; n < N; n++) s += sumtimes_A[n]^2; + sumtimes_t1 = runtime(); + s = ssq(sumtimes_A); + sumtimes_t2 = runtime(); + print "List sum of squares runtimes"; + printf('\tStandard "for" loop:\t\t%.4f\n', sumtimes_t1 - sumtimes_t0); + printf('\tUsing builtin "ssq":\t\t%.4f\n', sumtimes_t2 - sumtimes_t1); +} + +define timehmean(N, M = 10) { + local n, s, v1, v2; + + sumtimes_A = makelist(N); + for (n = 0; n < N; n++) sumtimes_A[n] = rand(1, M); + + sumtimes_t0 = runtime(); + for (s = n = 0; n < N; n++) s += 1/sumtimes_A[n]; + v1 = N/s; + sumtimes_t1 = runtime(); + v2 = hmean(sumtimes_A); + sumtimes_t2 = runtime(); + print v1, v2; + print "List harmonic meanruntimes"; + printf('\tStandard "for" loop:\t\t%.4f\n', sumtimes_t1 - sumtimes_t0); + printf('\tUsing builtin "hmean":\t\t%.4f\n', sumtimes_t2 - sumtimes_t1); +} + +define doalltimes(N) { + timematsum(N); + print; + timelistsum(N); + print; + timematssq(N); + print; + timelistssq(N); + print; + timematsort(N); + timelistsort(N); + timematreverse(N); + timelistreverse(N); + print; +} diff --git a/cal/test2700.cal b/cal/test2700.cal index be9a3aa..8684030 100644 --- a/cal/test2700.cal +++ b/cal/test2700.cal @@ -19,8 +19,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.3 $ - * @(#) $Id: test2700.cal,v 29.3 2006/06/20 09:29:16 chongo Exp $ + * @(#) $Revision: 29.4 $ + * @(#) $Id: test2700.cal,v 29.4 2006/06/25 22:06:23 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/cal/RCS/test2700.cal,v $ * * Under source code control: 1995/11/01 22:52:25 @@ -88,11 +88,11 @@ define mkfrac() = rand(2) ? mkposfrac() : -mkposfrac(); define mksquarereal() = mknonnegreal()^2; /* - * XXX - Should be able to do better than the following. For nonsquare - * positive integer less than 1e6, could use + * We might be able to do better than the following. For nonsquare + * positive integer less than 1e6, could use: * x = rand(1, 1000); * return rand(x^2 + 1, (x + 1)^2); - * Maybe could do + * Maybe could do: * do * x = mkreal_2700(); * while diff --git a/calcerr.tbl b/calcerr.tbl index 820bf2e..c78e9ba 100644 --- a/calcerr.tbl +++ b/calcerr.tbl @@ -1,7 +1,7 @@ # # calcerr - error codes and messages # -# Copyright (C) 1999 Ernest Bowen +# Copyright (C) 1999-2006 Ernest Bowen # # Calc is open software; you can redistribute it and/or modify it under # the terms of the version 2.1 of the GNU Lesser General Public License @@ -17,8 +17,8 @@ # received a copy with calc; if not, write to Free Software Foundation, Inc. # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. # -# @(#) $Revision: 29.8 $ -# @(#) $Id: calcerr.tbl,v 29.8 2006/05/19 15:12:57 chongo Exp $ +# @(#) $Revision: 29.9 $ +# @(#) $Id: calcerr.tbl,v 29.9 2006/06/25 20:33:26 chongo Exp $ # @(#) $Source: /usr/local/src/cmd/calc/RCS/calcerr.tbl,v $ # # Under source code control: 1996/05/23 17:38:44 @@ -404,9 +404,9 @@ E_ASSIGN8 No-type-change destination for assign E_ASSIGN9 No-error-value destination for assign E_SWAP1 No-copy argument for octet swap E_SWAP2 No-assign-to-or-from argument for swap -E_SWAP3 Non-variable argument for swap -E_QUOMOD1 Non-variable argument 4 or 4 for quomod -E_QUOMOD2 Non-real-number argument 1 or 2 for quomod +E_SWAP3 Non-lvalue argument for swap +E_QUOMOD1 Non-lvalue argument 3 or 4 for quomod +E_QUOMOD2 Non-real-number arg 1 or 2 or bad arg 5 for quomod E_QUOMOD3 No-assign-to argument 3 or 4 for quomod E_PREINC1 No-copy-to or no-change argument for octet preinc E_PREINC2 Non-variable argument for preinc diff --git a/config.c b/config.c index 37d6d00..95bd8f1 100644 --- a/config.c +++ b/config.c @@ -19,8 +19,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.21 $ - * @(#) $Id: config.c,v 29.21 2006/06/20 10:25:45 chongo Exp $ + * @(#) $Revision: 29.22 $ + * @(#) $Id: config.c,v 29.22 2006/06/25 22:05:38 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/config.c,v $ * * Under source code control: 1991/07/20 00:21:56 @@ -414,7 +414,8 @@ lookup_name(NAMETYPE *set, long val) /* * Check whether VALUE at vp is a LEN (32-bit signed integer) and if so, * copy that integer to lp. - * Return: 1, 2, 0, or -1 XXX + * + * Return: 1 ==> not an integer, 2 ==> int > 2^31, 0 ==> OK, -1 ==> error */ static int diff --git a/config.h b/config.h index de4fde2..b04ff17 100644 --- a/config.h +++ b/config.h @@ -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.19 $ - * @(#) $Id: config.h,v 29.19 2006/06/20 10:25:45 chongo Exp $ + * @(#) $Revision: 29.20 $ + * @(#) $Id: config.h,v 29.20 2006/06/25 22:05:38 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/config.h,v $ * * Under source code control: 1995/11/01 22:20:17 @@ -153,8 +153,8 @@ struct config { BOOL blkverbose; /* TRUE => print all lines if a block */ int blkbase; /* block output base */ int blkfmt; /* block output style */ - long calc_debug; /* internal debug, see CALC_DEBUG_XXX below */ - long resource_debug; /* resource debug, see RSCDBG_XXX below */ + long calc_debug; /* internal debug, see CALC_DEBUG_XYZ below */ + long resource_debug; /* resource debug, see RSCDBG_XYZ below */ long user_debug; /* user defined debug value: 0 default */ BOOL verbose_quit; /* TRUE => print Quit or abort executed msg */ int ctrl_d; /* see CTRL_D_xyz below */ diff --git a/custom/c_argv.c b/custom/c_argv.c index 18b74bf..b59ec99 100644 --- a/custom/c_argv.c +++ b/custom/c_argv.c @@ -17,8 +17,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.7 $ - * @(#) $Id: c_argv.c,v 29.7 2006/05/22 19:04:45 chongo Exp $ + * @(#) $Revision: 29.8 $ + * @(#) $Id: c_argv.c,v 29.8 2006/06/25 22:06:23 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/custom/RCS/c_argv.c,v $ * * Under source code control: 1997/03/09 20:27:37 @@ -123,12 +123,9 @@ c_argv(char UNUSED *name, int count, VALUE **vals) case V_BLOCK: /* memory block */ type = "octet_block"; break; -#if 0 - /* XXX - V_OCTET is subject to change */ case V_OCTET: /* octet (unsigned char) */ type = "octet"; break; -#endif default: type = "unknown"; break; diff --git a/custom/c_pmodm127.c b/custom/c_pmodm127.c index beb0f12..4875249 100644 --- a/custom/c_pmodm127.c +++ b/custom/c_pmodm127.c @@ -17,8 +17,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.3 $ - * @(#) $Id: c_pmodm127.c,v 29.3 2004/07/29 09:48:31 chongo Exp $ + * @(#) $Revision: 29.5 $ + * @(#) $Id: c_pmodm127.c,v 29.5 2006/06/25 22:08:42 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/custom/RCS/c_pmodm127.c,v $ * * Under source code control: 2004/07/28 22:12:25 @@ -156,7 +156,11 @@ c_pmodm127(char UNUSED *name, int UNUSED count, VALUE **vals) #else zsquare(result.v_num->num, &temp); /* square */ #endif - /* XXX - we could manually shift to speed up a tiny bit */ + /* + * We could manually shift here, but this would o speed + * up the operation only a very tiny bit at the expense + * of a bunch of special code. + */ zfree(result.v_num->num); zshift(temp, 1, &result.v_num->num); /* times 2 */ zfree(temp); diff --git a/func.c b/func.c index 54f89d7..20a9ab4 100644 --- a/func.c +++ b/func.c @@ -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.26 $ - * @(#) $Id: func.c,v 29.26 2006/06/11 00:08:56 chongo Exp $ + * @(#) $Revision: 29.28 $ + * @(#) $Id: func.c,v 29.28 2006/06/25 20:33:26 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/func.c,v $ * * Under source code control: 1990/02/15 01:48:15 @@ -1694,14 +1694,13 @@ sumlistitems(LIST *lp) NULL_VALUE, NULL_VALUE); break; default: - copyvalue(vp, &term); + addvalue(&sum, vp, &tmp); + freevalue(&sum); + if (tmp.v_type < 0) + return tmp; + sum = tmp; + continue; } - if (sum.v_type == V_NULL) { - sum = term; - continue; - } - if (term.v_type == V_NULL) - continue; addvalue(&sum, &term, &tmp); freevalue(&sum); freevalue(&term); @@ -1728,7 +1727,6 @@ f_sum(int count, VALUE **vals) sum.v_subtype = V_NOSUBTYPE; term.v_type = V_NULL; term.v_subtype = V_NOSUBTYPE; - while (count-- > 0) { vp = *vals++; switch(vp->v_type) { @@ -1740,24 +1738,19 @@ f_sum(int count, VALUE **vals) NULL_VALUE, NULL_VALUE); break; default: - copyvalue(vp, &term); - } - if (sum.v_type == V_NULL) { - sum = term; - continue; - } - if (term.v_type == V_NULL) - continue; - if (term.v_type < 0) { - freevalue(&sum); - return term; + addvalue(&sum, vp, &tmp); + freevalue(&sum); + if (tmp.v_type < 0) + return tmp; + sum = tmp; + continue; } addvalue(&sum, &term, &tmp); freevalue(&term); freevalue(&sum); sum = tmp; if (sum.v_type < 0) - return sum; + break; } return sum; } @@ -1904,26 +1897,70 @@ f_hnrmod(NUMBER *val1, NUMBER *val2, NUMBER *val3, NUMBER *val4) return res; } +VALUE +ssqlistitems(LIST *lp) +{ + LISTELEM *ep; + VALUE *vp; + VALUE term; + VALUE tmp; + VALUE sum; + + /* initialize VALUEs */ + term.v_type = V_NULL; + term.v_subtype = V_NOSUBTYPE; + tmp.v_type = V_NULL; + tmp.v_subtype = V_NOSUBTYPE; + sum.v_type = V_NULL; + sum.v_subtype = V_NOSUBTYPE; + + for (ep = lp->l_first; ep; ep = ep->e_next) { + vp = &ep->e_value; + if (vp->v_type == V_LIST) { + term = ssqlistitems(vp->v_list); + } else { + squarevalue(vp, &term); + } + addvalue(&sum, &term, &tmp); + freevalue(&sum); + freevalue(&term); + sum = tmp; + if (sum.v_type < 0) + break; + } + return sum; +} static VALUE f_ssq(int count, VALUE **vals) { - VALUE result, tmp1, tmp2; + VALUE tmp; + VALUE sum; + VALUE term; + VALUE *vp; /* initialize VALUEs */ - result.v_subtype = V_NOSUBTYPE; - tmp1.v_subtype = V_NOSUBTYPE; - tmp2.v_subtype = V_NOSUBTYPE; - - squarevalue(*vals++, &result); - while (--count > 0) { - squarevalue(*vals++, &tmp1); - addvalue(&tmp1, &result, &tmp2); - freevalue(&tmp1); - freevalue(&result); - result = tmp2; + tmp.v_type = V_NULL; + tmp.v_subtype = V_NOSUBTYPE; + sum.v_type = V_NULL; + sum.v_subtype = V_NOSUBTYPE; + term.v_type = V_NULL; + term.v_subtype = V_NOSUBTYPE; + while (count-- > 0) { + vp = *vals++; + if (vp->v_type == V_LIST) { + term = ssqlistitems(vp->v_list); + } else { + squarevalue(vp, &term); + } + addvalue(&sum, &term, &tmp); + freevalue(&term); + freevalue(&sum); + sum = tmp; + if (sum.v_type < 0) + break; } - return result; + return sum; } @@ -3521,6 +3558,58 @@ f_mod(int count, VALUE **vals) return res; } +static VALUE +f_quomod(int count, VALUE **vals) +{ + VALUE *v1, *v2, *v3, *v4, *v5; + VALUE result; + long rnd; + BOOL res; + short s3, s4; /* to preserve subtypes of v3, v4 */ + + v1 = vals[0]; + v2 = vals[1]; + v3 = vals[2]; + v4 = vals[3]; + + if (v3->v_type != V_ADDR || v4->v_type != 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); + rnd = qtoi(v5->v_num); + } else + rnd = conf->quomod; + + if (v1->v_type == V_ADDR) + 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; + + 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; + result.v_num = res ? qlink(&_qone_) : qlink(&_qzero_); + return result; +} static VALUE f_mmin(VALUE *v1, VALUE *v2) @@ -8374,7 +8463,7 @@ static CONST struct builtin builtins[] = { "define an environment variable"}, {"quo", 2, 3, 0, OP_NOP, 0, f_quo, "integer quotient of a by b, rounding type c"}, - {"quomod", 4, 4, 0, OP_QUOMOD, 0, 0, + {"quomod", 4, 5, FA, OP_NOP, 0, f_quomod, "set c and d to quotient and remainder of a\n\t\t\tdivided by b"}, {"rand", 0, 2, 0, OP_NOP, f_rand, 0, "additive 55 random number [0,2^64), [0,a), or [a,b)"}, diff --git a/help/append b/help/append index 2305802..3108d23 100644 --- a/help/append +++ b/help/append @@ -57,9 +57,10 @@ LINK LIBRARY none SEE ALSO - delete, insert, islist, list, pop, push, remove, rsearch, search, size + delete, insert, islist, pop, push, remove, rsearch, search, + select, size -## Copyright (C) 1999 Landon Curt Noll +## 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 @@ -75,8 +76,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: append,v 29.3 2006/05/07 07:25:46 chongo Exp $ +## @(#) $Revision: 29.4 $ +## @(#) $Id: append,v 29.4 2006/06/25 22:16:55 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/append,v $ ## ## Under source code control: 1994/03/19 03:13:17 diff --git a/help/argv b/help/argv index 8a54895..86b7b29 100644 --- a/help/argv +++ b/help/argv @@ -51,9 +51,9 @@ LINK LIBRARY none SEE ALSO - param, usage + param, system, usage -## Copyright (C) 1999 Landon Curt Noll +## 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 @@ -69,8 +69,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: argv,v 29.3 2006/05/07 07:25:46 chongo Exp $ +## @(#) $Revision: 29.4 $ +## @(#) $Id: argv,v 29.4 2006/06/25 22:16:55 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/argv,v $ ## ## Under source code control: 1999/11/23 19:45:05 diff --git a/help/avg b/help/avg index 9c13749..5eff80b 100644 --- a/help/avg +++ b/help/avg @@ -41,7 +41,7 @@ EXAMPLE [1,1] = 6 LIMITS - The number of arguments is not to exceed 100. + The number of arguments is not to exceed 1024. LINK LIBRARY none @@ -49,7 +49,7 @@ LINK LIBRARY SEE ALSO hmean -## Copyright (C) 1999 Landon Curt Noll +## 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 @@ -65,8 +65,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: avg,v 29.3 2006/05/07 07:25:46 chongo Exp $ +## @(#) $Revision: 29.4 $ +## @(#) $Id: avg,v 29.4 2006/06/22 23:49:22 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/avg,v $ ## ## Under source code control: 1994/09/25 20:22:31 diff --git a/help/blk b/help/blk index 41a9329..6a51fec 100644 --- a/help/blk +++ b/help/blk @@ -213,12 +213,27 @@ LIMITS 1 <= chunk < 2^31 LINK LIBRARY - XXX + BLOCK *blkalloc(int len, int chunk) + void blk_free(BLOCK *blk) + BLOCK *blkrealloc(BLOCK *blk, int newlen, int newchunk) + void blktrunc(BLOCK *blk) + BLOCK *blk_copy(BLOCK *blk) + int blk_cmp(BLOCK *a, BLOCK *b) + void blk_print(BLOCK *blk) + void nblock_print(NBLOCK *nblk) + NBLOCK *reallocnblock(int id, int len, int chunk) + NBLOCK *createnblock(char *name, int len, int chunk) + int findnblockid(char * name) + int removenblock(int id) + int countnblocks(void) + void shownblocks(void) + NBLOCK *findnblock(int id) + BLOCK *copyrealloc(BLOCK *blk, int newlen, int newchunk) SEE ALSO blocks, blkfree -## Copyright (C) 1999 Landon Curt Noll +## 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 @@ -234,8 +249,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: blk,v 29.4 2006/05/07 07:16:42 chongo Exp $ +## @(#) $Revision: 29.5 $ +## @(#) $Id: blk,v 29.5 2006/06/25 22:16:55 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/blk,v $ ## ## Under source code control: 1997/04/05 13:07:13 diff --git a/help/cmdbuf b/help/cmdbuf index c75863a..bd85b2a 100644 --- a/help/cmdbuf +++ b/help/cmdbuf @@ -26,9 +26,9 @@ LINK LIBRARY none SEE ALSO - XXX - fill in + argv, system -## Copyright (C) 1999 Landon Curt Noll +## 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 @@ -44,8 +44,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.2 $ -## @(#) $Id: cmdbuf,v 29.2 2000/06/07 14:02:33 chongo Exp $ +## @(#) $Revision: 29.3 $ +## @(#) $Id: cmdbuf,v 29.3 2006/06/25 22:16:55 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/cmdbuf,v $ ## ## Under source code control: 1995/07/09 04:05:58 diff --git a/help/comb b/help/comb index ddce752..a6cf05c 100644 --- a/help/comb +++ b/help/comb @@ -36,9 +36,9 @@ LINK LIBRARY void zcomb(ZVALUE x, ZVALUE y, ZVALUE *res) SEE ALSO - fact, perm + fact, perm, randperm -## Copyright (C) 1999 Landon Curt Noll +## 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 @@ -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.3 $ -## @(#) $Id: comb,v 29.3 2006/05/07 07:25:46 chongo Exp $ +## @(#) $Revision: 29.4 $ +## @(#) $Id: comb,v 29.4 2006/06/25 22:16:55 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/comb,v $ ## ## Under source code control: 1994/10/20 04:03:02 diff --git a/help/config b/help/config index 06cd3ba..78b479a 100644 --- a/help/config +++ b/help/config @@ -430,6 +430,12 @@ DESCRIPTION by the various kinds of printing to the output: bits 0, 1, 3 and 4 are used in the same way as for the functions round and bround. + The C language method of modulus and integer division is: + + config("quomod", 2) + config("quo", 2) + config("mod", 2) + =-= config("leadzero", boolean) @@ -954,8 +960,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.16 $ -## @(#) $Id: config,v 29.16 2006/06/20 10:25:00 chongo Exp $ +## @(#) $Revision: 29.17 $ +## @(#) $Id: config,v 29.17 2006/06/24 19:06:58 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/config,v $ ## ## Under source code control: 1991/07/21 04:37:17 diff --git a/help/define b/help/define index 7f89565..be2fc51 100644 --- a/help/define +++ b/help/define @@ -183,7 +183,7 @@ EXAMPLE ;; } LIMITS - The number of arguments in a function-call cannot exceed 100. + The number of arguments in a function-call cannot exceed 1024. LIBRARY none @@ -207,8 +207,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: define,v 29.5 2006/06/10 12:28:10 chongo Exp $ +## @(#) $Revision: 29.6 $ +## @(#) $Id: define,v 29.6 2006/06/22 23:49:22 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/define,v $ ## ## diff --git a/help/delete b/help/delete index fe5ea0f..a9c77b7 100644 --- a/help/delete +++ b/help/delete @@ -39,9 +39,10 @@ LINK LIBRARY none SEE ALSO - append, insert, pop, push, remove, size + append, insert, islist, pop, push, remove, rsearch, search, + select, size -## Copyright (C) 1999 Landon Curt Noll +## 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 @@ -57,8 +58,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: delete,v 29.3 2006/05/07 07:25:46 chongo Exp $ +## @(#) $Revision: 29.4 $ +## @(#) $Id: delete,v 29.4 2006/06/25 22:16:55 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/delete,v $ ## ## Under source code control: 1994/03/19 03:13:18 diff --git a/help/fact b/help/fact index 4cafb19..18910e9 100644 --- a/help/fact +++ b/help/fact @@ -30,9 +30,9 @@ LINK LIBRARY void zfact(NUMBER x, *ret) SEE ALSO - comb, perm + comb, perm, randperm -## Copyright (C) 1999 Landon Curt Noll +## 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 @@ -48,8 +48,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: fact,v 29.3 2006/05/07 07:25:46 chongo Exp $ +## @(#) $Revision: 29.4 $ +## @(#) $Id: fact,v 29.4 2006/06/25 22:16:55 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/fact,v $ ## ## Under source code control: 1994/10/20 04:03:02 diff --git a/help/factor b/help/factor index 8c8852b..6deb3cc 100644 --- a/help/factor +++ b/help/factor @@ -47,7 +47,8 @@ LINK LIBRARY FLAG zfactor(ZVALUE n, ZVALUE limit, ZVALUE *res) SEE ALSO - lfactor + isprime, lfactor, nextcand, nextprime, prevcand, prevprime, + pfact, pix, ptest ## Copyright (C) 1999-2006 Landon Curt Noll ## @@ -65,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.4 $ -## @(#) $Id: factor,v 29.4 2006/06/01 11:36:02 chongo Exp $ +## @(#) $Revision: 29.5 $ +## @(#) $Id: factor,v 29.5 2006/06/25 22:16:55 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/factor,v $ ## ## Under source code control: 1995/12/18 12:34:57 diff --git a/help/fgetfield b/help/fgetfield index f67336a..2b4c91a 100644 --- a/help/fgetfield +++ b/help/fgetfield @@ -43,10 +43,10 @@ EXAMPLE "Beta" LIMITS - none - XXX - is this correct? + none LINK LIBRARY - none - XXX - is this correct? + none SEE ALSO fgetstr, fputstr, fgets, fputs, fopen, files, fprintf @@ -67,8 +67,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: fgetfield,v 29.4 2006/06/10 12:28:10 chongo Exp $ +## @(#) $Revision: 29.5 $ +## @(#) $Id: fgetfield,v 29.5 2006/06/25 22:16:55 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/fgetfield,v $ ## ## Under source code control: 1996/04/30 03:05:17 diff --git a/help/fgetstr b/help/fgetstr index b86e43a..0580b90 100644 --- a/help/fgetstr +++ b/help/fgetstr @@ -38,10 +38,10 @@ EXAMPLE ; fgetstr(f) LIMITS - none - XXX - is this correct? + none LINK LIBRARY - none - XXX - is this correct? + none SEE ALSO fputstr, fgetword, fgets, fputs, fopen, files, fprintf @@ -62,8 +62,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: fgetstr,v 29.4 2006/06/10 12:28:10 chongo Exp $ +## @(#) $Revision: 29.5 $ +## @(#) $Id: fgetstr,v 29.5 2006/06/25 22:16:55 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/fgetstr,v $ ## ## Under source code control: 1996/04/30 03:05:17 diff --git a/help/fib b/help/fib index dba2c2f..02cee7f 100644 --- a/help/fib +++ b/help/fib @@ -25,9 +25,9 @@ LINK LIBRARY NUMBER *qfib(NUMBER *n) SEE ALSO - XXX - fill in + fact -## Copyright (C) 1999 Landon Curt Noll +## 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 @@ -43,8 +43,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: fib,v 29.3 2006/05/07 07:25:46 chongo Exp $ +## @(#) $Revision: 29.4 $ +## @(#) $Id: fib,v 29.4 2006/06/25 22:16:55 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/fib,v $ ## ## Under source code control: 1995/10/25 04:03:45 diff --git a/help/fprintf b/help/fprintf index fd827fa..b057e40 100644 --- a/help/fprintf +++ b/help/fprintf @@ -46,7 +46,7 @@ EXAMPLE [3] = NULL LIMITS - The number of arguments of fprintf() is not to exceed 100. + The number of arguments of fprintf() is not to exceed 1024. LINK LIBRARY none @@ -54,7 +54,7 @@ LINK LIBRARY SEE ALSO printf, strprintf, print -## Copyright (C) 1999 Landon Curt Noll +## 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 @@ -70,8 +70,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: fprintf,v 29.3 2006/05/07 07:25:46 chongo Exp $ +## @(#) $Revision: 29.4 $ +## @(#) $Id: fprintf,v 29.4 2006/06/22 23:49:22 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/fprintf,v $ ## ## Under source code control: 1996/03/12 22:50:41 diff --git a/help/fputstr b/help/fputstr index aea866e..fd2da84 100644 --- a/help/fputstr +++ b/help/fputstr @@ -31,10 +31,10 @@ EXAMPLE Error 72 LIMITS - none - XXX - is this correct? + none LINK LIBRARY - none - XXX - is this correct? + none SEE ALSO fgetstr, fgetfield, fgets, fputs, fopen, files, fprintf @@ -55,8 +55,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: fputstr,v 29.4 2006/06/10 12:28:10 chongo Exp $ +## @(#) $Revision: 29.5 $ +## @(#) $Id: fputstr,v 29.5 2006/06/25 22:16:55 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/fputstr,v $ ## ## Under source code control: 1996/04/30 03:05:18 diff --git a/help/freopen b/help/freopen index 91fafc1..8fe38a4 100644 --- a/help/freopen +++ b/help/freopen @@ -32,16 +32,16 @@ EXAMPLE Error 10013 LIMITS - none - XXX - is this correct? + none LINK LIBRARY - none - XXX - is this correct? + none SEE ALSO errno, fclose, feof, ferror, fflush, fgetc, fgetline, fgets, files, fopen, fprintf, fputc, fputs, fseek, fsize, ftell, isfile, printf, prompt -## Copyright (C) 1999 Landon Curt Noll +## 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 @@ -57,8 +57,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: freopen,v 29.3 2006/05/07 07:18:56 chongo Exp $ +## @(#) $Revision: 29.4 $ +## @(#) $Id: freopen,v 29.4 2006/06/25 22:16:55 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/freopen,v $ ## ## Under source code control: 1996/04/30 03:05:18 diff --git a/help/fscan b/help/fscan index 3e4aa11..9e32495 100644 --- a/help/fscan +++ b/help/fscan @@ -30,15 +30,15 @@ EXAMPLE 7 a-2i word 49 LIMITS - none - XXX - is this correct? + The number of arguments is not to exceed 1024. LINK LIBRARY - none - XXX - is this correct? + none SEE ALSO scan, strscan, fscanf, scanf, strscanf, printf, fprintf, strprintf -## Copyright (C) 1999 Landon Curt Noll +## 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 @@ -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.3 $ -## @(#) $Id: fscan,v 29.3 2006/05/07 07:25:46 chongo Exp $ +## @(#) $Revision: 29.4 $ +## @(#) $Id: fscan,v 29.4 2006/06/25 22:16:55 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/fscan,v $ ## ## Under source code control: 1996/04/30 03:05:18 diff --git a/help/fscanf b/help/fscanf index 391ef9d..525c519 100644 --- a/help/fscanf +++ b/help/fscanf @@ -121,15 +121,15 @@ EXAMPLE "mma" LIMITS - none - XXX - is this correct? + The number of arguments is not to exceed 1024. LINK LIBRARY - none - XXX - is this correct? + extern int fscanfid(FILEID id, char *fmt, int count, VALUE **vals); SEE ALSO scanf, strscanf, printf, fprintf, strprintf, fscan, scan, strscan -## Copyright (C) 1999 Landon Curt Noll +## 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 @@ -145,8 +145,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: fscanf,v 29.3 2006/05/07 07:25:46 chongo Exp $ +## @(#) $Revision: 29.4 $ +## @(#) $Id: fscanf,v 29.4 2006/06/25 22:16:55 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/fscanf,v $ ## ## Under source code control: 1996/04/30 03:05:18 diff --git a/help/gcd b/help/gcd index a036a95..a1aedf6 100644 --- a/help/gcd +++ b/help/gcd @@ -19,7 +19,7 @@ EXAMPLE 6 .02 0 LIMITS - The number of arguments may not to exceed 100. + The number of arguments may not to exceed 1024. LINK LIBRARY NUMBER *qgcd(NUMBER *x1, NUMBER *x2) @@ -27,7 +27,7 @@ LINK LIBRARY SEE ALSO lcm -## Copyright (C) 1999 Landon Curt Noll +## 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 @@ -43,8 +43,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: gcd,v 29.3 2006/05/07 07:25:46 chongo Exp $ +## @(#) $Revision: 29.4 $ +## @(#) $Id: gcd,v 29.4 2006/06/22 23:49:22 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/gcd,v $ ## ## Under source code control: 1995/10/05 04:52:26 diff --git a/help/hash b/help/hash index 740206a..d05cc5d 100644 --- a/help/hash +++ b/help/hash @@ -29,7 +29,7 @@ EXAMPLE 2378490456 LIMITS - The number of arguments is not to exceed 100. + The number of arguments is not to exceed 1024. LINK LIBRARY none @@ -37,7 +37,7 @@ LINK LIBRARY SEE ALSO sha, sha1, md5 -## Copyright (C) 1999-2003 Landon Curt Noll +## 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 @@ -53,8 +53,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: hash,v 29.4 2006/05/07 07:25:46 chongo Exp $ +## @(#) $Revision: 29.5 $ +## @(#) $Id: hash,v 29.5 2006/06/22 23:49:22 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/hash,v $ ## ## Under source code control: 1996/03/12 23:10:01 diff --git a/help/hmean b/help/hmean index 7ba5207..00e21bf 100644 --- a/help/hmean +++ b/help/hmean @@ -29,7 +29,7 @@ EXAMPLE 1 4/3 18/11 48/25 0 LIMITS - The number of arguments is not to exceed 100. + The number of arguments is not to exceed 1024. LINK LIBRARY none @@ -37,7 +37,7 @@ LINK LIBRARY SEE ALSO avg -## Copyright (C) 1999 Landon Curt Noll +## 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 @@ -53,8 +53,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: hmean,v 29.3 2006/05/07 07:25:46 chongo Exp $ +## @(#) $Revision: 29.4 $ +## @(#) $Id: hmean,v 29.4 2006/06/22 23:49:22 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/hmean,v $ ## ## Under source code control: 1995/12/18 03:30:59 diff --git a/help/insert b/help/insert index 848282c..38f059e 100644 --- a/help/insert +++ b/help/insert @@ -56,9 +56,10 @@ LINK LIBRARY none SEE ALSO - append, delete, islist, list, pop, push, remove, rsearch, search, size + append, delete, islist, pop, push, remove, rsearch, search, + select, size -## Copyright (C) 1999 Landon Curt Noll +## 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 @@ -74,8 +75,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: insert,v 29.3 2006/05/07 07:25:46 chongo Exp $ +## @(#) $Revision: 29.4 $ +## @(#) $Id: insert,v 29.4 2006/06/25 22:16:55 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/insert,v $ ## ## Under source code control: 1994/03/19 03:13:18 diff --git a/help/isblk b/help/isblk index 6f288a6..d1486a0 100644 --- a/help/isblk +++ b/help/isblk @@ -34,7 +34,7 @@ LIMITS none LINK LIBRARY - none - XXX ??? + none SEE ALSO blk, blocks, blkfree, @@ -43,7 +43,7 @@ SEE ALSO isobjtype, isodd, isprime, isrand, israndom, isreal, isrel, issimple, issq, isstr, istype -## Copyright (C) 1999 Landon Curt Noll +## 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 @@ -59,8 +59,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: isblk,v 29.3 2006/05/07 07:25:46 chongo Exp $ +## @(#) $Revision: 29.4 $ +## @(#) $Id: isblk,v 29.4 2006/06/25 22:16:55 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/isblk,v $ ## ## Under source code control: 1997/04/06 03:03:23 diff --git a/help/isdefined b/help/isdefined index 8e61c04..587af1b 100644 --- a/help/isdefined +++ b/help/isdefined @@ -34,7 +34,7 @@ LIMITS none LINK LIBRARY - none - XXX ? + none SEE ALSO define, undefine, @@ -43,7 +43,7 @@ SEE ALSO isobjtype, isodd, isprime, isrand, israndom, isreal, isrel, issimple, issq, isstr, istype -## Copyright (C) 1999 Landon Curt Noll +## 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 @@ -59,8 +59,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: isdefined,v 29.3 2006/05/07 07:25:46 chongo Exp $ +## @(#) $Revision: 29.4 $ +## @(#) $Id: isdefined,v 29.4 2006/06/25 22:16:55 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/isdefined,v $ ## ## Under source code control: 1997/04/05 14:10:17 diff --git a/help/islist b/help/islist index 9d3cad7..980d563 100644 --- a/help/islist +++ b/help/islist @@ -25,14 +25,15 @@ LINK LIBRARY none SEE ALSO - append, delete, insert, islist, pop, push, remove, rsearch, - search, size, list, - isassoc, isatty, isblk, isconfig, isdefined, iserror, iseven, isfile, - ishash, isident, isint, ismat, ismult, isnull, isnum, isobj, - isobjtype, isodd, isprime, isrand, israndom, isreal, isrel, - issimple, issq, isstr, istype + append, delete, insert, pop, push, remove, rsearch, search, + select, size, -## Copyright (C) 1999 Landon Curt Noll + isassoc, isatty, isblk, isconfig, isdefined, iserror, iseven, isfile, + ishash, isident, isint, ismat, ismult, isnull, isnum, isobj, + isobjtype, isodd, isprime, isrand, israndom, isreal, isrel, + issimple, issq, isstr, istype + +## 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 @@ -48,8 +49,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: islist,v 29.3 2006/05/07 07:25:46 chongo Exp $ +## @(#) $Revision: 29.4 $ +## @(#) $Id: islist,v 29.4 2006/06/25 22:16:55 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/islist,v $ ## ## Under source code control: 1994/03/19 03:13:19 diff --git a/help/isobjtype b/help/isobjtype index c38862e..c852796 100644 --- a/help/isobjtype +++ b/help/isobjtype @@ -25,7 +25,7 @@ LIMITS none LINK LIBRARY - none - XXX ??? + none SEE ALSO obj, @@ -34,7 +34,7 @@ SEE ALSO isodd, isprime, isrand, israndom, isreal, isrel, issimple, issq, isstr, istype -## Copyright (C) 1999 Landon Curt Noll +## 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 @@ -50,8 +50,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: isobjtype,v 29.3 2006/05/07 07:25:46 chongo Exp $ +## @(#) $Revision: 29.4 $ +## @(#) $Id: isobjtype,v 29.4 2006/06/25 22:16:55 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/isobjtype,v $ ## ## Under source code control: 1997/04/05 14:10:17 diff --git a/help/isprime b/help/isprime index a31ce68..cff0aee 100644 --- a/help/isprime +++ b/help/isprime @@ -45,13 +45,10 @@ LINK LIBRARY FLAG zisprime(ZVALUE x) (return 1 if prime, 0 not prime, -1 if >= 2^32) SEE ALSO - factor, lfactor, nextprime, prevprime, pfact, pix, - isassoc, isatty, isblk, isconfig, isdefined, iserror, iseven, isfile, - ishash, isident, isint, islist, ismat, ismult, isnull, isnum, isobj, - isobjtype, isodd, isrand, israndom, isreal, isrel, - issimple, issq, isstr, istype + factor, lfactor, nextcand, nextprime, prevcand, prevprime, + pfact, pix, ptest -## Copyright (C) 1999 Landon Curt Noll +## 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 @@ -67,8 +64,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: isprime,v 29.3 2006/05/07 07:25:46 chongo Exp $ +## @(#) $Revision: 29.4 $ +## @(#) $Id: isprime,v 29.4 2006/06/25 22:16:55 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/isprime,v $ ## ## Under source code control: 1994/10/21 02:21:29 diff --git a/help/israndom b/help/israndom index c877a23..697e1ad 100644 --- a/help/israndom +++ b/help/israndom @@ -13,8 +13,6 @@ DESCRIPTION Determine if x is a Blum-Blum-Shub pseudo-random number generator state. This function will return 1 if x is a file, 0 otherwise. - XXX - the interface to the Blum generator has not been not written. - EXAMPLE ; a = srandom(0) ; print israndom(a), israndom(0); @@ -33,7 +31,7 @@ SEE ALSO isobjtype, isodd, isprime, isrand, isreal, isrel, issimple, issq, isstr, istype -## Copyright (C) 1999 Landon Curt Noll +## 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 @@ -49,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: israndom,v 29.3 2006/05/07 07:25:46 chongo Exp $ +## @(#) $Revision: 29.4 $ +## @(#) $Id: israndom,v 29.4 2006/06/25 22:16:55 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/israndom,v $ ## ## Under source code control: 1995/11/11 05:09:41 diff --git a/help/lcm b/help/lcm index c7cf33e..28ffc53 100644 --- a/help/lcm +++ b/help/lcm @@ -21,7 +21,7 @@ EXAMPLE -120 79.2 2 LIMITS - none + The number of arguments is not to exceed 1024. LINK LIBRARY NUMBER *qlcm(NUMBER *x1, NUMBER *x2) @@ -29,7 +29,7 @@ LINK LIBRARY SEE ALSO gcd -## Copyright (C) 1999 Landon Curt Noll +## 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 @@ -45,8 +45,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: lcm,v 29.3 2006/05/07 07:25:46 chongo Exp $ +## @(#) $Revision: 29.4 $ +## @(#) $Id: lcm,v 29.4 2006/06/22 23:49:22 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/lcm,v $ ## ## Under source code control: 1995/10/05 04:52:26 diff --git a/help/lfactor b/help/lfactor index 0ebc75d..499d1cd 100644 --- a/help/lfactor +++ b/help/lfactor @@ -40,7 +40,8 @@ LINK LIBRARY FULL zlowfactor(ZVALUE z, long count) SEE ALSO - factor + factor, isprime, nextcand, nextprime, prevcand, prevprime, + pfact, pix, ptest ## Copyright (C) 1999-2006 Landon Curt Noll ## @@ -58,8 +59,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: lfactor,v 29.4 2006/06/01 11:36:02 chongo Exp $ +## @(#) $Revision: 29.5 $ +## @(#) $Id: lfactor,v 29.5 2006/06/25 22:16:55 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/lfactor,v $ ## ## Under source code control: 1995/12/18 12:34:57 diff --git a/help/mat b/help/mat index d506249..394d0d3 100644 --- a/help/mat +++ b/help/mat @@ -410,9 +410,9 @@ LINK LIBRARY n/a SEE ALSO - ismat, matdim, matmax, matmin, mattrans, mattrace, matsum, det, inverse, - isident, test, config, search, rsearch, reverse, copy, blkcpy, dp, cp, - randperm, sort + ismat, matdim, matmax, matmin, mattrans, mattrace, matsum, matfill, + det, inverse, isident, test, config, search, rsearch, reverse, copy, + blkcpy, dp, cp, randperm, sort ## Copyright (C) 1999-2006 Landon Curt Noll ## @@ -430,8 +430,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.6 $ -## @(#) $Id: mat,v 29.6 2006/06/11 07:25:14 chongo Exp $ +## @(#) $Revision: 29.7 $ +## @(#) $Id: mat,v 29.7 2006/06/25 22:16:55 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/mat,v $ ## ## Under source code control: 1991/07/21 04:37:22 diff --git a/help/matdim b/help/matdim index df4b75d..08af709 100644 --- a/help/matdim +++ b/help/matdim @@ -24,9 +24,11 @@ LINK LIBRARY none SEE ALSO - XXX - fill in + mat, ismat, matmax, matmin, mattrans, mattrace, matsum, matfill, + det, inverse, isident, test, config, search, rsearch, reverse, copy, + blkcpy, dp, cp, randperm, sort -## Copyright (C) 1999 Landon Curt Noll +## 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 @@ -42,8 +44,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: matdim,v 29.3 2006/05/07 07:25:46 chongo Exp $ +## @(#) $Revision: 29.4 $ +## @(#) $Id: matdim,v 29.4 2006/06/25 22:16:55 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/matdim,v $ ## ## Under source code control: 1995/10/25 04:03:45 diff --git a/help/matfill b/help/matfill index a3e051b..7cc1bd6 100644 --- a/help/matfill +++ b/help/matfill @@ -37,9 +37,11 @@ LINK LIBRARY none SEE ALSO - XXX - fill in + mat, ismat, matdim, matmax, matmin, mattrans, mattrace, matsum, + det, inverse, isident, test, config, search, rsearch, reverse, copy, + blkcpy, dp, cp, randperm, sort -## Copyright (C) 1999 Landon Curt Noll +## 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 @@ -55,8 +57,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: matfill,v 29.3 2006/05/07 07:25:46 chongo Exp $ +## @(#) $Revision: 29.4 $ +## @(#) $Id: matfill,v 29.4 2006/06/25 22:16:55 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/matfill,v $ ## ## Under source code control: 1995/10/25 04:03:45 diff --git a/help/matmax b/help/matmax index 090f090..b9922fa 100644 --- a/help/matmax +++ b/help/matmax @@ -26,9 +26,11 @@ LINK LIBRARY none SEE ALSO - XXX - fill in + mat, ismat, matdim, matmin, mattrans, mattrace, matsum, matfill, + det, inverse, isident, test, config, search, rsearch, reverse, copy, + blkcpy, dp, cp, randperm, sort -## Copyright (C) 1999 Landon Curt Noll +## 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 @@ -44,8 +46,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: matmax,v 29.3 2006/05/07 07:25:46 chongo Exp $ +## @(#) $Revision: 29.4 $ +## @(#) $Id: matmax,v 29.4 2006/06/25 22:16:55 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/matmax,v $ ## ## Under source code control: 1995/10/25 04:03:45 diff --git a/help/matmin b/help/matmin index a906cb5..934092d 100644 --- a/help/matmin +++ b/help/matmin @@ -26,9 +26,11 @@ LINK LIBRARY none SEE ALSO - XXX - fill in + mat, ismat, matdim, matmax, mattrans, mattrace, matsum, matfill, + det, inverse, isident, test, config, search, rsearch, reverse, copy, + blkcpy, dp, cp, randperm, sort -## Copyright (C) 1999 Landon Curt Noll +## 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 @@ -44,8 +46,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: matmin,v 29.3 2006/05/07 07:25:46 chongo Exp $ +## @(#) $Revision: 29.4 $ +## @(#) $Id: matmin,v 29.4 2006/06/25 22:16:55 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/matmin,v $ ## ## Under source code control: 1995/10/25 04:03:45 diff --git a/help/matsum b/help/matsum index 06ef5a3..b8706a2 100644 --- a/help/matsum +++ b/help/matsum @@ -25,9 +25,11 @@ LINK LIBRARY void matsum(MATRIX *m, VALUE *vres); SEE ALSO - XXX - fill in + mat, ismat, matdim, matmax, matmin, mattrans, mattrace, matfill, + det, inverse, isident, test, config, search, rsearch, reverse, copy, + blkcpy, dp, cp, randperm, sort -## Copyright (C) 1999 Landon Curt Noll +## 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 @@ -43,8 +45,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: matsum,v 29.3 2006/05/07 07:25:46 chongo Exp $ +## @(#) $Revision: 29.4 $ +## @(#) $Id: matsum,v 29.4 2006/06/25 22:16:55 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/matsum,v $ ## ## Under source code control: 1995/10/25 04:03:46 diff --git a/help/mattrans b/help/mattrans index 834c549..fd497e3 100644 --- a/help/mattrans +++ b/help/mattrans @@ -31,9 +31,11 @@ LINK LIBRARY MATRIX *mattrans(MATRIX *m) SEE ALSO - XXX - fill in + mat, ismat, matdim, matmax, matmin, mattrace, matsum, matfill, + det, inverse, isident, test, config, search, rsearch, reverse, copy, + blkcpy, dp, cp, randperm, sort -## Copyright (C) 1999 Landon Curt Noll +## 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 @@ -49,8 +51,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: mattrans,v 29.3 2006/05/07 07:25:46 chongo Exp $ +## @(#) $Revision: 29.4 $ +## @(#) $Id: mattrans,v 29.4 2006/06/25 22:16:55 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/mattrans,v $ ## ## Under source code control: 1995/10/25 04:03:46 diff --git a/help/max b/help/max index f7ad80e..62c1077 100644 --- a/help/max +++ b/help/max @@ -62,7 +62,7 @@ EXAMPLE 3 LIMITS - The number of arguments is not to exceed 100. + The number of arguments is not to exceed 1024. LINK LIBRARY NUMBER *qmax(NUMBER *x1, NUMBER *x2) @@ -70,7 +70,7 @@ LINK LIBRARY SEE ALSO max, obj -## Copyright (C) 1999 Landon Curt Noll +## 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 @@ -86,8 +86,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: max,v 29.3 2006/05/07 07:25:46 chongo Exp $ +## @(#) $Revision: 29.4 $ +## @(#) $Id: max,v 29.4 2006/06/22 23:49:22 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/max,v $ ## ## Under source code control: 1995/10/05 04:52:27 diff --git a/help/min b/help/min index d163cf8..61b4ea5 100644 --- a/help/min +++ b/help/min @@ -62,15 +62,15 @@ EXAMPLE 1 LIMITS - The number of arguments is not to exceed 100. + The number of arguments is not to exceed 1024. LINK LIBRARY NUMBER *qmin(NUMBER *x1, NUMBER *x2) SEE ALSO - max, obj + max, obj, sum, ssq -## Copyright (C) 1999 Landon Curt Noll +## 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 @@ -86,8 +86,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: min,v 29.3 2006/05/07 07:25:46 chongo Exp $ +## @(#) $Revision: 29.4 $ +## @(#) $Id: min,v 29.4 2006/06/22 23:49:22 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/min,v $ ## ## Under source code control: 1995/10/05 04:52:27 diff --git a/help/mod b/help/mod index a10b130..ae12b92 100644 --- a/help/mod +++ b/help/mod @@ -23,6 +23,24 @@ TYPES return number DESCRIPTION + The expression: + + x % y + + is equivalent to call: + + mod(x, y) + + The function: + + mod(x, y, rnd) + + is equivalent to: + + config("mod", rnd), x % y + + except that the global config("mod") value does not change. + If x is real or complex and y is zero, mod(x, y, rnd) returns x. If x is complex, mod(x, y, rnd) returns @@ -32,18 +50,16 @@ DESCRIPTION If x/y is an integer mod(x, y, rnd) returns zero. - If x/y is not an integer, mod(x, y, rnd) returns one of the two numbers - r for which for some integer q, x = q * v + r and abs(r) < abs(y). - Which of the two numbers is returned is controlled by rnd. + If x/y is not an integer, mod(x, y, rnd) returns one of the two + values of r for which for some integer q exists such that x = q * y + r + and abs(r) < abs(y). Which of the two values or r that is returned is + controlled by rnd. If bit 4 of rnd is set (e.g. if 16 <= rnd < 32) abs(r) <= abs(y)/2; this uniquely determines r if abs(r) < abs(y)/2. If bit 4 of rnd is set and abs(r) = abs(y)/2, or if bit 4 of r is not set, the result for r depends on rnd as in the following table: - (Blank entries indicate that the description would be complicated - and probably not of much interest.) - rnd & 15 sign of r parity of q 0 sgn(y) @@ -63,26 +79,36 @@ DESCRIPTION 14 even if x > 0, otherwise odd 15 odd if x > 0, otherwise even - This dependence on rnd is consistent with quo(x, y, rnd) and - appr(x, y, rnd) in that for any real x and y and any integer rnd, + NOTE: Blank entries in the table above indicate that the + description would be complicated and probably not of + much interest. - x = y * quo(x, y, rnd) + mod(x, y, rnd). - mod(x, y, rnd) = x - appr(x, y, rnd) + The C language method of modulus and integer division is: - If y and rnd are fixed and mod(x, y, rnd) is to be considered as - a canonical residue of x modulo y, bits 1 and 3 of rnd should be - zero: if 0 <= rnd < 32, it is only for rnd = 0, 1, 4, 5, 16, 17, - 20, or 21, that the set of possible values for mod(x, y, rnd) - form an interval of length y, and for any x1, x2, + config("quomod", 2) + config("quo", 2) + config("mod", 2) - mod(x1, y, rnd) = mod(x2, y, rnd) + This dependence on rnd is consistent with quo(x, y, rnd) and + appr(x, y, rnd) in that for any real x and y and any integer rnd, - is equivalent to: + x = y * quo(x, y, rnd) + mod(x, y, rnd). + mod(x, y, rnd) = x - appr(x, y, rnd) - x1 is congruent to x2 modulo y. + If y and rnd are fixed and mod(x, y, rnd) is to be considered as + a canonical residue of x % y, bits 1 and 3 of rnd should be + zero: if 0 <= rnd < 32, it is only for rnd = 0, 1, 4, 5, 16, 17, + 20, or 21, that the set of possible values for mod(x, y, rnd) + form an interval of length y, and for any x1, x2, - This is particularly relevant when working with the ring of - integers modulo an integer y. + mod(x1, y, rnd) = mod(x2, y, rnd) + + is equivalent to: + + x1 is congruent to x2 modulo y. + + This is particularly relevant when working with the ring of + integers modulo an integer y. EXAMPLE ; print mod(11,5,0), mod(11,5,1), mod(-11,5,2), mod(-11,-5,3) @@ -111,7 +137,7 @@ LINK LIBRARY SEE ALSO quo, quomod, //, % -## Copyright (C) 1999 Landon Curt Noll +## 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 @@ -127,8 +153,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: mod,v 29.3 2006/05/07 07:25:46 chongo Exp $ +## @(#) $Revision: 29.5 $ +## @(#) $Id: mod,v 29.5 2006/06/24 19:06:58 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/mod,v $ ## ## Under source code control: 1995/09/18 02:09:31 diff --git a/help/name b/help/name index a239c5b..864ecb2 100644 --- a/help/name +++ b/help/name @@ -33,12 +33,12 @@ LIMITS none LINK LIBRARY - none - XXX ??? + none SEE ALSO blk, fopen -## Copyright (C) 1999 Landon Curt Noll +## 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 @@ -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.3 $ -## @(#) $Id: name,v 29.3 2006/05/07 07:25:46 chongo Exp $ +## @(#) $Revision: 29.4 $ +## @(#) $Id: name,v 29.4 2006/06/25 22:16:55 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/name,v $ ## ## Under source code control: 1997/04/05 14:12:44 diff --git a/help/nextcand b/help/nextcand index 04be839..b5d7d34 100644 --- a/help/nextcand +++ b/help/nextcand @@ -74,9 +74,10 @@ LINK LIBRARY ZVALUE *cand) SEE ALSO - prevcand, ptest + factor, isprime, lfactor, nextprime, prevcand, prevprime, + pfact, pix, ptest -## Copyright (C) 1999 Landon Curt Noll +## 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 @@ -92,8 +93,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: nextcand,v 29.3 2006/05/07 07:25:46 chongo Exp $ +## @(#) $Revision: 29.4 $ +## @(#) $Id: nextcand,v 29.4 2006/06/25 22:16:55 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/nextcand,v $ ## ## Under source code control: 1996/02/25 00:27:43 diff --git a/help/nextprime b/help/nextprime index 0b6f7a8..3acc4a6 100644 --- a/help/nextprime +++ b/help/nextprime @@ -33,9 +33,10 @@ LINK LIBRARY FULL znprime(ZVALUE z) SEE ALSO - prevprime + factor, isprime, lfactor, nextcand, prevcand, prevprime, + pfact, pix, ptest -## Copyright (C) 1999 Landon Curt Noll +## 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 @@ -51,8 +52,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: nextprime,v 29.3 2006/05/07 07:25:46 chongo Exp $ +## @(#) $Revision: 29.4 $ +## @(#) $Id: nextprime,v 29.4 2006/06/25 22:16:55 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/nextprime,v $ ## ## Under source code control: 1995/12/18 12:34:57 diff --git a/help/null b/help/null index 21e289a..4c0c378 100644 --- a/help/null +++ b/help/null @@ -66,7 +66,7 @@ EXAMPLE 27 LIMITS - The number of arguments is not to exceed 100. + The number of arguments is not to exceed 1024. LINK LIBRARY none @@ -74,7 +74,7 @@ LINK LIBRARY SEE ALSO isnull, test -## Copyright (C) 1999 Landon Curt Noll +## 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 @@ -90,8 +90,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: null,v 29.3 2006/05/07 07:25:46 chongo Exp $ +## @(#) $Revision: 29.4 $ +## @(#) $Id: null,v 29.4 2006/06/22 23:49:22 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/null,v $ ## ## Under source code control: 1996/03/12 23:10:01 diff --git a/help/perm b/help/perm index dc75b71..066c41a 100644 --- a/help/perm +++ b/help/perm @@ -35,9 +35,9 @@ LINK LIBRARY void zperm(NUMBER x, y, *ret) SEE ALSO - comb, fact + comb, fact, randperm -## Copyright (C) 1999 Landon Curt Noll +## 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 @@ -53,8 +53,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: perm,v 29.3 2006/05/07 07:25:46 chongo Exp $ +## @(#) $Revision: 29.4 $ +## @(#) $Id: perm,v 29.4 2006/06/25 22:16:55 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/perm,v $ ## ## Under source code control: 1994/10/20 04:03:02 diff --git a/help/pfact b/help/pfact index e0b3853..b2ad545 100644 --- a/help/pfact +++ b/help/pfact @@ -24,9 +24,10 @@ LINK LIBRARY void zpfact(ZVALUE z, ZVALUE *dest) SEE ALSO - fact, lcmfact + factor, isprime, lfactor, nextcand, nextprime, prevcand, prevprime, + pix, ptest, fact, lcmfact -## Copyright (C) 1999 Landon Curt Noll +## 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 @@ -42,8 +43,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: pfact,v 29.3 2006/05/07 07:25:46 chongo Exp $ +## @(#) $Revision: 29.4 $ +## @(#) $Id: pfact,v 29.4 2006/06/25 22:16:55 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/pfact,v $ ## ## Under source code control: 1995/12/18 12:34:57 diff --git a/help/pi b/help/pi index aa0cc3e..7d36ebc 100644 --- a/help/pi +++ b/help/pi @@ -24,9 +24,9 @@ LINK LIBRARY NUMBER *qpi(NUMBER *eps) SEE ALSO - XXX - fill in + atan2 -## Copyright (C) 1999 Landon Curt Noll +## 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 @@ -42,8 +42,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: pi,v 29.3 2006/05/07 07:25:46 chongo Exp $ +## @(#) $Revision: 29.4 $ +## @(#) $Id: pi,v 29.4 2006/06/25 22:16:55 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/pi,v $ ## ## Under source code control: 1995/10/25 04:03:46 diff --git a/help/pix b/help/pix index bd90190..981be2c 100644 --- a/help/pix +++ b/help/pix @@ -35,9 +35,10 @@ LINK LIBRARY FULL pix(FULL x) SEE ALSO - XXX - fill in + factor, isprime, lfactor, nextcand, nextprime, prevcand, prevprime, + pfact, ptest -## Copyright (C) 1999 Landon Curt Noll +## 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 @@ -53,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.3 $ -## @(#) $Id: pix,v 29.3 2006/05/07 07:25:46 chongo Exp $ +## @(#) $Revision: 29.4 $ +## @(#) $Id: pix,v 29.4 2006/06/25 22:16:55 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/pix,v $ ## ## Under source code control: 1995/12/18 12:34:58 diff --git a/help/poly b/help/poly index a9b67fa..2966e18 100644 --- a/help/poly +++ b/help/poly @@ -128,15 +128,15 @@ EXAMPLE 113 113 113 LIMITS - The number of arguments is not to exceed 100 + The number of arguments is not to exceed 1024 LINK LIBRARY BOOL evalpoly(LIST *clist, LISTELEM *x, VALUE *result); SEE ALSO - XXX - fill in + list -## Copyright (C) 1999 Landon Curt Noll +## 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 @@ -152,8 +152,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: poly,v 29.3 2006/05/07 07:25:46 chongo Exp $ +## @(#) $Revision: 29.4 $ +## @(#) $Id: poly,v 29.4 2006/06/22 23:49:22 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/poly,v $ ## ## Under source code control: 1995/12/02 02:40:43 diff --git a/help/pop b/help/pop index 7a3337e..a2ec141 100644 --- a/help/pop +++ b/help/pop @@ -43,9 +43,10 @@ LINK LIBRARY none SEE ALSO - append, delete, insert, islist, list, push, remove, rsearch, search, size + append, delete, insert, islist, push, remove, rsearch, search, + select, size -## Copyright (C) 1999 Landon Curt Noll +## 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 @@ -61,8 +62,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: pop,v 29.3 2006/05/07 07:25:46 chongo Exp $ +## @(#) $Revision: 29.4 $ +## @(#) $Id: pop,v 29.4 2006/06/25 22:16:55 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/pop,v $ ## ## Under source code control: 1994/03/19 03:13:20 diff --git a/help/prevcand b/help/prevcand index bb7fd95..43491ab 100644 --- a/help/prevcand +++ b/help/prevcand @@ -82,9 +82,10 @@ LINK LIBRARY ZVALUE *cand) SEE ALSO - nextcand, ptest + factor, isprime, lfactor, nextcand, nextprime, prevprime, + pfact, pix, ptest -## Copyright (C) 1999 Landon Curt Noll +## 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 @@ -100,8 +101,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: prevcand,v 29.3 2006/05/07 07:25:46 chongo Exp $ +## @(#) $Revision: 29.4 $ +## @(#) $Id: prevcand,v 29.4 2006/06/25 22:16:55 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/prevcand,v $ ## ## Under source code control: 1996/02/25 00:27:43 diff --git a/help/prevprime b/help/prevprime index 3141e42..3120006 100644 --- a/help/prevprime +++ b/help/prevprime @@ -36,9 +36,10 @@ LINK LIBRARY FULL zpprime(ZVALUE z) SEE ALSO - nextprime + factor, isprime, lfactor, nextcand, nextprime, prevcand, + pfact, pix, ptest -## Copyright (C) 1999 Landon Curt Noll +## 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 @@ -54,8 +55,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: prevprime,v 29.3 2006/05/07 07:25:46 chongo Exp $ +## @(#) $Revision: 29.4 $ +## @(#) $Id: prevprime,v 29.4 2006/06/25 22:16:55 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/prevprime,v $ ## ## Under source code control: 1995/12/18 12:34:58 diff --git a/help/printf b/help/printf index 54665ac..93e0b60 100644 --- a/help/printf +++ b/help/printf @@ -118,7 +118,7 @@ EXAMPLE LIMITS - The number of arguments of printf() is not to exceed 100. + The number of arguments of printf() is not to exceed 1024. LINK LIBRARY none @@ -126,7 +126,7 @@ LINK LIBRARY SEE ALSO fprintf, strprintf, print -## Copyright (C) 1999 Landon Curt Noll +## 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 @@ -142,8 +142,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: printf,v 29.3 2006/05/07 07:25:46 chongo Exp $ +## @(#) $Revision: 29.4 $ +## @(#) $Id: printf,v 29.4 2006/06/22 23:49:22 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/printf,v $ ## ## Under source code control: 1996/03/12 22:50:41 diff --git a/help/prompt b/help/prompt index 7bbb8c9..a5aaabe 100644 --- a/help/prompt +++ b/help/prompt @@ -35,7 +35,7 @@ LINK LIBRARY none SEE ALSO - XXX - fill in + fgetfield, fgetline, fgetstr ## Copyright (C) 1999-2006 Landon Curt Noll ## @@ -53,8 +53,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: prompt,v 29.4 2006/06/10 12:28:10 chongo Exp $ +## @(#) $Revision: 29.5 $ +## @(#) $Id: prompt,v 29.5 2006/06/25 22:16:55 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/prompt,v $ ## ## Under source code control: 1995/12/18 12:34:58 diff --git a/help/ptest b/help/ptest index 44b56d3..6531f99 100644 --- a/help/ptest +++ b/help/ptest @@ -126,9 +126,10 @@ LINK LIBRARY BOOL zprimetest(ZVALUE n, long count, long skip) SEE ALSO - isprime, prevcand, nextcand + factor, isprime, lfactor, nextcand, nextprime, prevcand, prevprime, + pfact, pix -## Copyright (C) 1999 Landon Curt Noll +## 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 @@ -144,8 +145,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: ptest,v 29.3 2006/05/07 07:25:46 chongo Exp $ +## @(#) $Revision: 29.4 $ +## @(#) $Id: ptest,v 29.4 2006/06/25 22:16:55 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/ptest,v $ ## ## Under source code control: 1996/02/25 00:27:43 diff --git a/help/push b/help/push index ef1eeb3..39d4bd4 100644 --- a/help/push +++ b/help/push @@ -52,9 +52,10 @@ LINK LIBRARY none SEE ALSO - append, delete, insert, islist, list, pop, remove, rsearch, search, size + append, delete, insert, islist, pop, remove, rsearch, search, + select, size -## Copyright (C) 1999 Landon Curt Noll +## 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 @@ -70,8 +71,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: push,v 29.3 2006/05/07 07:25:46 chongo Exp $ +## @(#) $Revision: 29.4 $ +## @(#) $Id: push,v 29.4 2006/06/25 22:16:55 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/push,v $ ## ## Under source code control: 1994/03/19 03:13:20 diff --git a/help/quo b/help/quo index 4fa74e2..c3be4fc 100644 --- a/help/quo +++ b/help/quo @@ -32,8 +32,8 @@ DESCRIPTION If x/y is an integer quo(x, y, rnd) returns x/y. If x is real, y nonzero and x/y is not an integer, x // y returns - one of the two integers v for which abs(x/y - v) < 1. Which - integer is returned is controlled by rnd as follows: + one of the two integers v for which abs(x/y - v) < 1. Which + integer is returned is controlled by rnd as follows: rnd sign of x/y - v Description of rounding @@ -60,6 +60,16 @@ DESCRIPTION half-integer, as if rnd replaced by rnd & 15 + NOTE: Blank entries in the table above indicate that the + description would be complicated and probably not of + much interest. + + The C language method of modulus and integer division is: + + config("quomod", 2) + config("quo", 2) + config("mod", 2) + EXAMPLE print quo(11,5,0), quo(11,5,1), quo(-11,5,2), quo(-11,-5,3) 2 3 -2 3 @@ -93,8 +103,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.2 $ -## @(#) $Id: quo,v 29.2 2000/06/07 14:02:33 chongo Exp $ +## @(#) $Revision: 29.3 $ +## @(#) $Id: quo,v 29.3 2006/06/24 19:06:58 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/quo,v $ ## ## Under source code control: 1995/09/18 04:01:44 diff --git a/help/quomod b/help/quomod index de06ec1..67f811b 100644 --- a/help/quomod +++ b/help/quomod @@ -2,13 +2,14 @@ NAME quomod - assign quotient and remainder to two variables SYNOPSIS - quomod(x, y, q, r) + quomod(x, y, q, r [, rnd]) TYPES x real y real q any r any + rnd integer, defaults to config("quomod") return real @@ -19,18 +20,43 @@ DESCRIPTION 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. - XXX - need to document relationship with "quomod" config value + 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"). + + XXX - replace the above paragraph and directly describe how rnd + and config("quomod") impact quomod. + + The C language method of modulus and integer division is: + + config("quomod", 2) + config("quo", 2) + config("mod", 2) EXAMPLE ; global u, v; ; global mat M[2]; ; print quomod(13,5,u,v), u, v, quomod(15.6,5.2,M[0],M[1]), M[0], M[1]; - ; 1 2 3 0 3 0 + 1 2 3 0 3 0 + ; A = assoc(); ; print quomod(13, 5, A[1], A[2]), A[1], A[2] ; 1 2 3 - XXX - need examples of how the "quomod" config file changes results + ; print quomod(10, -3, u, v), u, v; + 1 -4 -2 + ; print quomod(10, -3, u, v, 0), u, v; + 1 -4 -2 + ; print quomod(10, -3, u, v, 1), u, v; + 1 -3 1 + ; print quomod(10, -3, u, v, 2), u, v; + 1 -3 1 + ; print quomod(-10, -3, u, v, 2), u, v; + 1 3 -1 LIMITS y > 0 @@ -41,7 +67,7 @@ LINK LIBRARY SEE ALSO //, % -## Copyright (C) 1999 Landon Curt Noll +## 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 @@ -57,8 +83,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: quomod,v 29.3 2006/05/07 07:25:46 chongo Exp $ +## @(#) $Revision: 29.5 $ +## @(#) $Id: quomod,v 29.5 2006/06/25 20:33:26 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/quomod,v $ ## ## Under source code control: 1995/05/07 03:17:03 diff --git a/help/randperm b/help/randperm index de82cf7..2a5b8fc 100644 --- a/help/randperm +++ b/help/randperm @@ -14,6 +14,9 @@ DESCRIPTION the elements have been randomly permuted. The value of x is not changed. + This function uses the rand() subtractive 100 shuffle pseudo-random + number generator. + EXAMPLE ; A = list(1,2,2,3,4) ; randperm(A) @@ -41,9 +44,9 @@ LINK LIBRARY none SEE ALSO - XXX - fill in + comp, fact, rand, perm -## Copyright (C) 1999 Landon Curt Noll +## 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 @@ -59,8 +62,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: randperm,v 29.3 2006/05/07 07:25:46 chongo Exp $ +## @(#) $Revision: 29.4 $ +## @(#) $Id: randperm,v 29.4 2006/06/25 22:16:55 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/randperm,v $ ## ## Under source code control: 1995/07/10 02:09:31 diff --git a/help/remove b/help/remove index 928d426..b6f5f3c 100644 --- a/help/remove +++ b/help/remove @@ -47,9 +47,10 @@ LINK LIBRARY none SEE ALSO - append, delete, insert, islist, list, push, pop, rsearch, search, size + append, delete, insert, islist, pop, push, rsearch, search, + select, size -## Copyright (C) 1999 Landon Curt Noll +## 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 @@ -65,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.3 $ -## @(#) $Id: remove,v 29.3 2006/05/07 07:25:46 chongo Exp $ +## @(#) $Revision: 29.4 $ +## @(#) $Id: remove,v 29.4 2006/06/25 22:16:55 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/remove,v $ ## ## Under source code control: 1996/03/12 23:10:01 diff --git a/help/rewind b/help/rewind index c6aeabd..8218aa6 100644 --- a/help/rewind +++ b/help/rewind @@ -23,16 +23,16 @@ EXAMPLE 1 LIMITS - none - XXX - is this correct? + The number of arguments is not to exceed 1024. LINK LIBRARY - none - XXX - is this correct? + int rewindid(FILEID id); SEE ALSO errno, fclose, feof, ferror, fflush, fgetc, fgetline, fgets, files, fopen, fprintf, fputc, fputs, fseek, fsize, ftell, isfile, printf, prompt -## Copyright (C) 1999 Landon Curt Noll +## 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 @@ -48,8 +48,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: rewind,v 29.3 2006/05/07 07:25:46 chongo Exp $ +## @(#) $Revision: 29.4 $ +## @(#) $Id: rewind,v 29.4 2006/06/25 22:16:55 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/rewind,v $ ## ## Under source code control: 1996/04/30 03:05:18 diff --git a/help/rsearch b/help/rsearch index 8c34218..adb4c37 100644 --- a/help/rsearch +++ b/help/rsearch @@ -104,9 +104,12 @@ LINK LIBRARY none SEE ALSO - assoc, list, mat, search + append, delete, insert, islist, pop, push, remove, search, + select, size, -## Copyright (C) 1999 Landon Curt Noll + assoc, list, mat + +## 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 @@ -122,8 +125,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: rsearch,v 29.3 2006/05/07 07:25:46 chongo Exp $ +## @(#) $Revision: 29.4 $ +## @(#) $Id: rsearch,v 29.4 2006/06/25 22:16:55 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/rsearch,v $ ## ## Under source code control: 1994/03/19 03:13:21 diff --git a/help/runtime b/help/runtime index 9a44033..b9d70ef 100644 --- a/help/runtime +++ b/help/runtime @@ -11,10 +11,10 @@ DESCRIPTION Returns the current user mode cpu runtime in seconds. EXAMPLE + The result for this example will depend on the speed and number of - of clock-ticks per second for the computer being used. - The result is a multiple of 1/CLK_TCK, where CLK_TCK is - usually 60. The following is for a XXX machine. + of clock-ticks per second for the computer being used. The result + is a multiple of 1/CLK_TCK, where CLK_TCK is usually 60, 100, or 1000. ; t = runtime(); ; pi = pi(1e-1000); @@ -46,8 +46,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: runtime,v 29.4 2006/06/04 18:24:33 chongo Exp $ +## @(#) $Revision: 29.5 $ +## @(#) $Id: runtime,v 29.5 2006/06/25 22:16:55 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/runtime,v $ ## ## Under source code control: 1996/03/12 23:10:01 diff --git a/help/scale b/help/scale index a32d978..82ea550 100644 --- a/help/scale +++ b/help/scale @@ -35,9 +35,9 @@ LINK LIBRARY MATRIX *matscale(MATRIX *x, long n) SEE ALSO - XXX - fill in + obj -## Copyright (C) 1999 Landon Curt Noll +## 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 @@ -53,8 +53,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: scale,v 29.4 2006/05/07 07:25:46 chongo Exp $ +## @(#) $Revision: 29.5 $ +## @(#) $Id: scale,v 29.5 2006/06/25 22:16:55 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/scale,v $ ## ## Under source code control: 1995/12/18 12:34:58 diff --git a/help/scan b/help/scan index 190b0bc..b9c7b00 100644 --- a/help/scan +++ b/help/scan @@ -25,15 +25,15 @@ EXAMPLE 5 25 3+4i Error 3 LIMITS - none - XXX - is this correct? + The number of arguments is not to exceed 1024. LINK LIBRARY - none - XXX - is this correct? + int scanfstr(char *str, char *fmt, int count, VALUE **vals); SEE ALSO fscan, strscan, fscanf, strscanf, scanf, printf, fprintf -## Copyright (C) 1999 Landon Curt Noll +## 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 @@ -49,8 +49,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: scan,v 29.3 2006/05/07 07:25:46 chongo Exp $ +## @(#) $Revision: 29.4 $ +## @(#) $Id: scan,v 29.4 2006/06/25 22:16:55 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/scan,v $ ## ## Under source code control: 1996/04/30 03:05:18 diff --git a/help/scanf b/help/scanf index f5f9a5a..4f44b94 100644 --- a/help/scanf +++ b/help/scanf @@ -22,15 +22,15 @@ EXAMPLE "Alpha" LIMITS - none - XXX - is this correct? + The number of arguments is not to exceed 1024. LINK LIBRARY - none - XXX - is this correct? + int scanfstr(char *str, char *fmt, int count, VALUE **vals); SEE ALSO scan, strscan, fscanf, strscanf, scanf, printf, fprintf -## Copyright (C) 1999 Landon Curt Noll +## 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 @@ -46,8 +46,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: scanf,v 29.3 2006/05/07 07:25:46 chongo Exp $ +## @(#) $Revision: 29.4 $ +## @(#) $Id: scanf,v 29.4 2006/06/25 22:16:55 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/scanf,v $ ## ## Under source code control: 1996/04/30 03:05:18 diff --git a/help/search b/help/search index 39c9599..65969a3 100644 --- a/help/search +++ b/help/search @@ -120,10 +120,12 @@ LINK LIBRARY none SEE ALSO - assoc, list, mat, rsearch + append, delete, insert, islist, pop, push, remove, rsearch, + select, size, + assoc, list, mat -## Copyright (C) 1999 Landon Curt Noll +## 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 @@ -139,8 +141,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: search,v 29.3 2006/05/07 07:25:46 chongo Exp $ +## @(#) $Revision: 29.4 $ +## @(#) $Id: search,v 29.4 2006/06/25 22:16:55 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/search,v $ ## ## Under source code control: 1994/03/19 03:13:21 diff --git a/help/select b/help/select index 50904db..3821d7f 100644 --- a/help/select +++ b/help/select @@ -17,7 +17,6 @@ DESCRIPTION The list x is not changed. The order of the returned list is the same as in x. - EXAMPLE ; define f(x) = x > 5 ; A = list(2,4,6,8,2,7) @@ -35,9 +34,10 @@ LINK LIBRARY none SEE ALSO - XXX - fill in + append, delete, insert, islist, pop, push, remove, rsearch, search, + size -## Copyright (C) 1999 Landon Curt Noll +## 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 @@ -53,8 +53,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: select,v 29.3 2006/05/07 07:25:46 chongo Exp $ +## @(#) $Revision: 29.4 $ +## @(#) $Id: select,v 29.4 2006/06/25 22:16:55 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/select,v $ ## ## Under source code control: 1995/07/10 02:09:31 diff --git a/help/size b/help/size index aeb7ce5..d2d0359 100644 --- a/help/size +++ b/help/size @@ -55,9 +55,9 @@ LINK LIBRARY none SEE ALSO - list, mat, assoc, obj, sizeof, memsize + list, mat, assoc, obj, sizeof, memsize -## Copyright (C) 1999 Landon Curt Noll +## 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 @@ -73,8 +73,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: size,v 29.3 2006/05/07 07:25:46 chongo Exp $ +## @(#) $Revision: 29.4 $ +## @(#) $Id: size,v 29.4 2006/06/25 22:16:55 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/size,v $ ## ## Under source code control: 1994/03/19 03:13:22 diff --git a/help/ssq b/help/ssq index d668f2c..e157788 100644 --- a/help/ssq +++ b/help/ssq @@ -5,14 +5,15 @@ SYNOPSIS ssq(x1, x2, ...) TYPES - x1, x2, ... any for which the required squaring and addition - operations are defined + x1, x2, ... lists or values for which required operations are defined return as determined by the operations on x1, x2, ... DESCRIPTION - Returns the value of x1^2 + x2^2 + ... - + Null values are ignored; ssq() returns the null value. + If no argument is a list, returns x1^2 + x2^2 + ... + If an argument = list(t1, t2, ...) it contributes ssq(t1, t2, ...) + to the result. EXAMPLE ; print ssq(1,2,3), ssq(1+2i, 3-4i, 5 +6i) 14 -21+40i @@ -26,16 +27,24 @@ EXAMPLE [1,0] = 286 [1,1] = 352 + ; ssq(list(2,3,5),7) + 87 + + ; ssq(1,2,3,4,5,6,7,8) + 204 + ; ssq(1,2, list(3,4,list(5,6)), list(), 7, 8) + 204 + LIMITS - The number of arguments is not to exceed 100. + The number of arguments is not to exceed 1024. LINK LIBRARY none SEE ALSO - XXX - fill in + sum, max, min -## Copyright (C) 1999 Landon Curt Noll +## 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 @@ -51,8 +60,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: ssq,v 29.3 2006/05/07 07:25:46 chongo Exp $ +## @(#) $Revision: 29.5 $ +## @(#) $Id: ssq,v 29.5 2006/06/23 00:10:20 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/ssq,v $ ## ## Under source code control: 1995/10/25 04:03:46 diff --git a/help/str b/help/str index 9d59397..84a6842 100644 --- a/help/str +++ b/help/str @@ -47,7 +47,7 @@ LINK LIBRARY SEE ALSO base, base2, config -## Copyright (C) 1999-2002 Landon Curt Noll +## 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 @@ -63,8 +63,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: str,v 29.4 2006/05/07 07:25:46 chongo Exp $ +## @(#) $Revision: 29.5 $ +## @(#) $Id: str,v 29.5 2006/06/25 22:16:55 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/str,v $ ## ## Under source code control: 1995/10/05 04:52:27 diff --git a/help/strcat b/help/strcat index af6e326..7e56195 100644 --- a/help/strcat +++ b/help/strcat @@ -1,5 +1,5 @@ NAME - strcat - concatenate strings + strcat - concatenate null-terminated strings SYNOPSIS strcat(x1, x2, ...) @@ -11,9 +11,16 @@ TYPES DESCRIPTION strcat(x1, x2, ...) forms a string starting with a copy of - x1, followed by the characters in order of x2, etc. The + x1 before the first, if any, null character in x1, followed by the + initial non-null characters of any later arguments x2, ... The length of the resulting string will be the sum of the lengths - of the component strings. + of the component strings considered as null-terminated strings (i.e. + the lengths as returned by strlen()). The sum function may be used + to concatenate strings where '\0' is to be considered as an ordinary + character, either by sum(x1, x2, ...) or sum(list(x1, x2, ...)); + in this case, the size of the resulting string is the sum of the + sizes of the component strings. + EXAMPLE ; A = "abc"; B = "XY"; C = " "; @@ -21,15 +28,16 @@ EXAMPLE abcXY XYabc LIMITS - The number of arguments may not to exceed 100. + The number of arguments may not to exceed 1024. LINK LIBRARY none SEE ALSO - XXX - fill in + strcmp, strcpy, strerror, strlen, strncmp, strncpy, strpos, + strprintf, strscan, strscanf, substr -## Copyright (C) 1999 Landon Curt Noll +## 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 @@ -45,8 +53,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: strcat,v 29.3 2006/05/07 07:25:46 chongo Exp $ +## @(#) $Revision: 29.5 $ +## @(#) $Id: strcat,v 29.5 2006/06/25 22:16:55 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/strcat,v $ ## ## Under source code control: 1995/10/05 04:52:27 diff --git a/help/strcmp b/help/strcmp index a8a52e0..ce30a16 100644 --- a/help/strcmp +++ b/help/strcmp @@ -29,7 +29,6 @@ EXAMPLE strcmp("abc\0", "abc") == 1 strcmp("a\0b", "a\0c") == -1 - LIMITS none @@ -37,4 +36,31 @@ LINK LIBRARY FLAG stringrel(STRING *s1, STRING *s2) SEE ALSO - strncmp + strcat, strcpy, strerror, strlen, strncmp, strncpy, strpos, + strprintf, strscan, strscanf, substr + +## Copyright (C) 2006 Ernest Bowen +## +## 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: 25.2 $ +## @(#) $Id: strcmp,v 25.2 2006/06/25 22:16:55 chongo Exp $ +## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/strcmp,v $ +## +## Under source code control: 2006/03/03 03:32:44 +## File existed as early as: 2006 +## +## chongo /\oo/\ http://www.isthe.com/chongo/ +## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ diff --git a/help/strcpy b/help/strcpy index dfaa1ca..3ca3830 100644 --- a/help/strcpy +++ b/help/strcpy @@ -38,4 +38,31 @@ LINK LIBRARY STRING* stringcpy(STRING *s1, STRING *s2) SEE ALSO - strncpy + strcat, strcpy, strerror, strlen, strncmp, strncpy, strpos, + strprintf, strscan, strscanf, substr + +## Copyright (C) 2006 Ernest Bowen +## +## 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: 25.2 $ +## @(#) $Id: strcpy,v 25.2 2006/06/25 22:16:55 chongo Exp $ +## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/strcpy,v $ +## +## Under source code control: 2006/03/03 03:32:44 +## File existed as early as: 2006 +## +## chongo /\oo/\ http://www.isthe.com/chongo/ +## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ diff --git a/help/strerror b/help/strerror index ec4b111..023a6fd 100644 --- a/help/strerror +++ b/help/strerror @@ -49,6 +49,9 @@ LINK LIBRARY none SEE ALSO + strcat, strcpy, strlen, strncmp, strncpy, strpos, + strprintf, strscan, strscanf, substr, + errcount, errmax, error, iserror, errno, newerror, errorcodes, stoponerror @@ -68,8 +71,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: strerror,v 29.4 2006/05/21 07:31:46 chongo Exp $ +## @(#) $Revision: 29.5 $ +## @(#) $Id: strerror,v 29.5 2006/06/25 22:16:55 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/strerror,v $ ## ## Under source code control: 1996/04/30 03:05:18 diff --git a/help/strlen b/help/strlen index 82d7d41..378b674 100644 --- a/help/strlen +++ b/help/strlen @@ -23,9 +23,10 @@ LINK LIBRARY none SEE ALSO - XXX - fill in + strcat, strcpy, strerror, strncmp, strncpy, strpos, + strprintf, strscan, strscanf, substr -## Copyright (C) 1999 Landon Curt Noll +## Copyright (C) 1999-2006 Ernest Bowen ## ## 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 @@ -41,8 +42,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: strlen,v 29.3 2006/05/07 07:25:46 chongo Exp $ +## @(#) $Revision: 29.4 $ +## @(#) $Id: strlen,v 29.4 2006/06/25 22:16:55 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/strlen,v $ ## ## Under source code control: 1995/10/05 04:52:27 diff --git a/help/strncmp b/help/strncmp index 2272c7d..427ef1a 100644 --- a/help/strncmp +++ b/help/strncmp @@ -41,4 +41,31 @@ LINK LIBRARY temporarily replacing the string sizes by min(n1,n) and min(n2,n). SEE ALSO - strcmp + strcat, strcpy, strerror, strlen, strncpy, strpos, + strprintf, strscan, strscanf, substr + +## Copyright (C) 2006 Ernest Bowen +## +## 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: 25.2 $ +## @(#) $Id: strncmp,v 25.2 2006/06/25 22:16:55 chongo Exp $ +## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/strncmp,v $ +## +## Under source code control: 2006/03/03 03:32:44 +## File existed as early as: 2006 +## +## chongo /\oo/\ http://www.isthe.com/chongo/ +## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ diff --git a/help/strncpy b/help/strncpy index 3f3bf72..9b889ae 100644 --- a/help/strncpy +++ b/help/strncpy @@ -36,4 +36,31 @@ LINK LIBRARY STRING* stringncpy(STRING *s1, STRING *s2, long num) SEE ALSO - strcpy + strcat, strcpy, strerror, strlen, strncmp, strpos, + strprintf, strscan, strscanf, substr + +## Copyright (C) 2006 Ernest Bowen +## +## 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: 25.2 $ +## @(#) $Id: strncpy,v 25.2 2006/06/25 22:16:55 chongo Exp $ +## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/strncpy,v $ +## +## Under source code control: 2006/03/03 03:32:44 +## File existed as early as: 2006 +## +## chongo /\oo/\ http://www.isthe.com/chongo/ +## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ diff --git a/help/strpos b/help/strpos index 0dffee2..bd3b7ea 100644 --- a/help/strpos +++ b/help/strpos @@ -29,7 +29,6 @@ EXAMPLE ; strpos("abcdefg", "xyz") 0 - LIMITS none @@ -37,9 +36,10 @@ LINK LIBRARY none SEE ALSO - XXX - fill in + strcat, strcpy, strerror, strlen, strncmp, strncpy, + strprintf, strscan, strscanf, substr -## Copyright (C) 1999 Landon Curt Noll +## Copyright (C) 1999-2006 Ernest Bowen ## ## 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 @@ -55,8 +55,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: strpos,v 29.3 2006/05/07 07:25:46 chongo Exp $ +## @(#) $Revision: 29.4 $ +## @(#) $Id: strpos,v 29.4 2006/06/25 22:16:55 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/strpos,v $ ## ## Under source code control: 1995/07/09 03:48:57 diff --git a/help/strprintf b/help/strprintf index 1a97e5f..7be8d96 100644 --- a/help/strprintf +++ b/help/strprintf @@ -28,15 +28,18 @@ EXAMPLE " LIMITS - The number of arguments of strprintf() is not to exceed 100. + The number of arguments of strprintf() is not to exceed 1024. LINK LIBRARY none SEE ALSO + strcat, strcpy, strerror, strlen, strncmp, strncpy, strpos, + strscan, strscanf, substr, + printf, fprintf, print -## Copyright (C) 1999 Landon Curt Noll +## 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 @@ -52,8 +55,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: strprintf,v 29.3 2006/05/07 07:25:46 chongo Exp $ +## @(#) $Revision: 29.5 $ +## @(#) $Id: strprintf,v 29.5 2006/06/25 22:16:55 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/strprintf,v $ ## ## Under source code control: 1996/03/12 22:50:41 diff --git a/help/strscan b/help/strscan index e6017b2..3f0bcfd 100644 --- a/help/strscan +++ b/help/strscan @@ -27,15 +27,16 @@ EXAMPLE 5 25 LIMITS - none - XXX - is this correct? + The number of arguments is not to exceed 1024. LINK LIBRARY - none - XXX - is this correct? + none SEE ALSO - scan, fscan, fscanf, strscanf, scanf, printf, fprintf + strcat, strcpy, strerror, strlen, strncmp, strncpy, strpos, + strprintf, strscanf, substr -## Copyright (C) 1999 Landon Curt Noll +## Copyright (C) 1999-2006 Ernest Bowen ## ## 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 @@ -51,8 +52,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: strscan,v 29.3 2006/05/07 07:25:46 chongo Exp $ +## @(#) $Revision: 29.4 $ +## @(#) $Id: strscan,v 29.4 2006/06/25 22:16:55 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/strscan,v $ ## ## Under source code control: 1996/04/30 03:05:18 diff --git a/help/strscanf b/help/strscanf index 53e14a4..8568f17 100644 --- a/help/strscanf +++ b/help/strscanf @@ -106,15 +106,16 @@ EXAMPLE ; alpha LIMITS - none - XXX - is this correct? + The number of arguments is not to exceed 1024. LINK LIBRARY - none - XXX - is this correct? + int fscanfid(FILEID id, char *fmt, int count, VALUE **vals); SEE ALSO - fscanf, scanf, fscan, strscan, scan, print, printf + strcat, strcpy, strerror, strlen, strncmp, strncpy, strpos, + strprintf, strscan, substr -## Copyright (C) 1999 Landon Curt Noll +## Copyright (C) 1999-2006 Ernest Bowen ## ## 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 @@ -130,8 +131,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: strscanf,v 29.3 2006/05/07 07:25:46 chongo Exp $ +## @(#) $Revision: 29.4 $ +## @(#) $Id: strscanf,v 29.4 2006/06/25 22:16:55 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/strscanf,v $ ## ## Under source code control: 1996/04/30 03:05:18 diff --git a/help/substr b/help/substr index 7cfa172..47edea5 100644 --- a/help/substr +++ b/help/substr @@ -35,9 +35,10 @@ LINK LIBRARY none SEE ALSO - XXX - fill in + strcat, strcpy, strerror, strlen, strncmp, strncpy, strpos, + strprintf, strscan, strscanf -## Copyright (C) 1999 Landon Curt Noll +## Copyright (C) 1999-2006 Ernest Bowen ## ## 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 @@ -53,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.3 $ -## @(#) $Id: substr,v 29.3 2006/05/07 07:25:46 chongo Exp $ +## @(#) $Revision: 29.4 $ +## @(#) $Id: substr,v 29.4 2006/06/25 22:16:55 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/substr,v $ ## ## Under source code control: 1995/10/05 04:52:27 diff --git a/help/sum b/help/sum index e029f7a..b613ead 100644 --- a/help/sum +++ b/help/sum @@ -51,15 +51,14 @@ EXAMPLE 5 LIMITS - The number of arguments is not to exceed 100. + The number of arguments is not to exceed 1024. LINK LIBRARY - NUMBER *qmin(NUMBER *x1, NUMBER *x2) SEE ALSO - max, obj + max, min, obj, ssq -## Copyright (C) 1999 Landon Curt Noll +## 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 @@ -75,8 +74,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: sum,v 29.3 2006/05/07 07:25:46 chongo Exp $ +## @(#) $Revision: 29.4 $ +## @(#) $Id: sum,v 29.4 2006/06/22 23:49:22 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/sum,v $ ## ## Under source code control: 1997/03/10 03:59:59 diff --git a/help/system b/help/system index 50aae7b..da831af 100644 --- a/help/system +++ b/help/system @@ -23,7 +23,6 @@ DESCRIPTION will determine if the shell is executable. If the shell is executable, 0 is returned otherwise non-zero is returned. - EXAMPLE ; system("") 0 @@ -42,9 +41,9 @@ LINK LIBRARY none SEE ALSO - XXX - fill in + cmdbuf, argv -## Copyright (C) 1999 Landon Curt Noll +## 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 @@ -60,8 +59,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: system,v 29.3 2006/05/07 07:25:46 chongo Exp $ +## @(#) $Revision: 29.4 $ +## @(#) $Id: system,v 29.4 2006/06/25 22:16:55 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/system,v $ ## ## Under source code control: 1995/07/09 03:48:57 diff --git a/help/variable b/help/variable index 03a79d0..76bb00f 100644 --- a/help/variable +++ b/help/variable @@ -139,6 +139,7 @@ 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 ## @@ -156,8 +157,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.3 $ -## @(#) $Id: variable,v 29.3 2006/06/11 07:50:48 chongo Exp $ +## @(#) $Revision: 29.4 $ +## @(#) $Id: variable,v 29.4 2006/06/25 23:07:08 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/variable,v $ ## ## Under source code control: 1991/07/21 04:37:25 diff --git a/help/xor b/help/xor index fbdcf03..9169977 100644 --- a/help/xor +++ b/help/xor @@ -30,15 +30,15 @@ EXAMPLE 2 10 LIMITS - The number of arguments is not to exceed 100. + The number of arguments is not to exceed 1024. LINK LIBRARY NUMBER *qxor(NUMBER *x1, NUMBER *x2) SEE ALSO - XXX - fill in + operator -## Copyright (C) 1999 Landon Curt Noll +## 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 @@ -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.3 $ -## @(#) $Id: xor,v 29.3 2006/05/07 07:25:46 chongo Exp $ +## @(#) $Revision: 29.4 $ +## @(#) $Id: xor,v 29.4 2006/06/22 23:49:22 chongo Exp $ ## @(#) $Source: /usr/local/src/cmd/calc/help/RCS/xor,v $ ## ## Under source code control: 1995/10/05 04:52:27 diff --git a/opcodes.c b/opcodes.c index bb4569c..d1332e5 100644 --- a/opcodes.c +++ b/opcodes.c @@ -19,8 +19,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.10 $ - * @(#) $Id: opcodes.c,v 29.10 2006/05/20 08:43:55 chongo Exp $ + * @(#) $Revision: 29.12 $ + * @(#) $Id: opcodes.c,v 29.12 2006/06/25 22:05:38 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/opcodes.c,v $ * * Under source code control: 1990/02/15 01:48:19 @@ -194,7 +194,7 @@ o_paramaddr(FUNC UNUSED *fp, int argcount, VALUE *args, long index) } stack->v_addr = args; stack->v_type = V_ADDR; -/* stack->v_subtype = V_NOSUBTYPE; XXX */ +/* stack->v_subtype = V_NOSUBTYPE; */ /* XXX ??? */ } @@ -1238,70 +1238,6 @@ o_mod(void) } -static void -o_quomod(void) -{ - VALUE *v1, *v2, *v3, *v4; - VALUE valquo, valmod; - BOOL res; - - v1 = &stack[-3]; - v2 = &stack[-2]; - v3 = &stack[-1]; - v4 = &stack[0]; - if (v1->v_type == V_ADDR) - v1 = v1->v_addr; - if (v2->v_type == V_ADDR) - v2 = v2->v_addr; - if ((v3->v_type != V_ADDR) || (v4->v_type != V_ADDR)) { - freevalue(stack--); - freevalue(stack--); - freevalue(stack--); - freevalue(stack); - *stack = error_value(E_QUOMOD1); - return; - } - if ((v1->v_type != V_NUM) || (v2->v_type != V_NUM)) { - stack -= 2; - freevalue(stack--); - freevalue(stack); - *stack = error_value(E_QUOMOD2); - return; - } - v3 = v3->v_addr; - v4 = v4->v_addr; - - if ((v3->v_subtype | v4->v_subtype) & V_NOASSIGNTO) { - stack -= 2; - freevalue(stack--); - freevalue(stack); - *stack = error_value(E_QUOMOD3); - return; - } - - valquo.v_type = V_NUM; - valquo.v_subtype = v3->v_subtype; - valmod.v_type = V_NUM; - valmod.v_subtype = v4->v_subtype; - res = qquomod(v1->v_num, v2->v_num, &valquo.v_num, &valmod.v_num); - stack -= 2; - if (stack->v_type == V_NUM) - qfree(stack->v_num); - stack--; - if (stack->v_type == V_NUM) - qfree(stack->v_num); - stack->v_num = (res ? qlink(&_qone_) : qlink(&_qzero_)); - stack->v_type = V_NUM; - stack->v_subtype = V_NOSUBTYPE; - - freevalue(v3); - freevalue(v4); - - *v3 = valquo; - *v4 = valmod; -} - - static void o_and(void) { @@ -3701,7 +3637,6 @@ static struct opcode opcodes[MAX_OPCODE+1] = { {o_swap, OPNUL, "SWAP"}, /* swap values of two variables */ {o_issimple, OPNUL, "ISSIMPLE"}, /* whether value is simple type */ {o_cmp, OPNUL, "CMP"}, /* compare values returning -1, 0, 1 */ - {o_quomod, OPNUL, "QUOMOD"}, /* calculate quotient and remainder */ {o_setconfig, OPNUL, "SETCONFIG"}, /* set configuration parameter */ {o_setepsilon, OPNUL, "SETEPSILON"}, /* set allowed error for calculations */ {o_isfile, OPNUL, "ISFILE"}, /* whether value is a file */ diff --git a/opcodes.h b/opcodes.h index 2d3a2c1..5aae904 100644 --- a/opcodes.h +++ b/opcodes.h @@ -1,7 +1,7 @@ /* * opcodes - opcode execution module definition * - * Copyright (C) 1999 David I. Bell + * Copyright (C) 1999-2006 David I. Bell * * Calc is open software; you can redistribute it and/or modify it under * the terms of the version 2.1 of the GNU Lesser General Public License @@ -17,8 +17,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.6 $ - * @(#) $Id: opcodes.h,v 29.6 2001/06/08 21:00:58 chongo Exp $ + * @(#) $Revision: 29.7 $ + * @(#) $Id: opcodes.h,v 29.7 2006/06/25 20:33:26 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/opcodes.h,v $ * * Under source code control: 1990/02/15 01:48:35 @@ -139,43 +139,42 @@ #define OP_SWAP 94L /* swap values of two variables */ #define OP_ISSIMPLE 95L /* whether value is a simple type */ #define OP_CMP 96L /* compare values returning -1, 0, or 1 */ -#define OP_QUOMOD 97L /* calculate quotient and remainder */ -#define OP_SETCONFIG 98L /* set configuration parameter */ -#define OP_SETEPSILON 99L /* set allowed error for calculations */ -#define OP_ISFILE 100L /* whether value is a file */ -#define OP_ISASSOC 101L /* whether value is an association */ -#define OP_INITSTATIC 102L /* once only code for static initialization */ -#define OP_ELEMINIT 103L /* assign element of matrix or object */ -#define OP_ISCONFIG 104L /* whether value is a configuration state */ -#define OP_ISHASH 105L /* whether value is a hash state */ -#define OP_ISRAND 106L /* whether value is additive 55 random state */ -#define OP_ISRANDOM 107L /* whether value is a Blum random state */ -#define OP_SHOW 108L /* show data about current state */ -#define OP_INITFILL 109L /* fill new matrix with copies of a value */ -#define OP_ASSIGNBACK 110L /* assign in reverse order */ -#define OP_TEST 111L /* test whether value is "nonzero" */ -#define OP_ISDEFINED 112L /* whether string names a function */ -#define OP_ISOBJTYPE 113L /* whether string names an object type */ -#define OP_ISBLK 114L /* whether value is a block */ -#define OP_PTR 115L /* octet pointer */ -#define OP_DEREF 116L /* dereference an octet pointer */ -#define OP_ISOCTET 117L /* whether value is an octet */ -#define OP_ISPTR 118L /* whether value is a pointer */ -#define OP_SAVEVAL 119L /* activate updating */ -#define OP_LINKS 120L /* return links for numbers and strings */ -#define OP_BIT 121L /* whether specified bit is set */ -#define OP_COMP 122L /* complement value */ -#define OP_XOR 123L /* xor (~) of values */ -#define OP_HIGHBIT 124L /* index of high bit of value */ -#define OP_LOWBIT 125L /* index of low bit of value */ -#define OP_CONTENT 126L /* value returned by unary # */ -#define OP_HASHOP 127L /* binary # */ -#define OP_BACKSLASH 128L /* unary backslash */ -#define OP_SETMINUS 129L /* binary backslash */ -#define OP_PLUS 130L /* unary + */ -#define OP_JUMPNN 131L /* jump if top value is non-null */ -#define OP_ABORT 132L /* abort operation */ -#define MAX_OPCODE 132L /* highest legal opcode */ +#define OP_SETCONFIG 97L /* set configuration parameter */ +#define OP_SETEPSILON 98L /* set allowed error for calculations */ +#define OP_ISFILE 99L /* whether value is a file */ +#define OP_ISASSOC 100L /* whether value is an association */ +#define OP_INITSTATIC 101L /* once only code for static initialization */ +#define OP_ELEMINIT 102L /* assign element of matrix or object */ +#define OP_ISCONFIG 103L /* whether value is a configuration state */ +#define OP_ISHASH 104L /* whether value is a hash state */ +#define OP_ISRAND 105L /* whether value is additive 55 random state */ +#define OP_ISRANDOM 106L /* whether value is a Blum random state */ +#define OP_SHOW 107L /* show data about current state */ +#define OP_INITFILL 108L /* fill new matrix with copies of a value */ +#define OP_ASSIGNBACK 109L /* assign in reverse order */ +#define OP_TEST 110L /* test whether value is "nonzero" */ +#define OP_ISDEFINED 111L /* whether string names a function */ +#define OP_ISOBJTYPE 112L /* whether string names an object type */ +#define OP_ISBLK 113L /* whether value is a block */ +#define OP_PTR 114L /* octet pointer */ +#define OP_DEREF 115L /* dereference an octet pointer */ +#define OP_ISOCTET 116L /* whether value is an octet */ +#define OP_ISPTR 117L /* whether value is a pointer */ +#define OP_SAVEVAL 118L /* activate updating */ +#define OP_LINKS 119L /* return links for numbers and strings */ +#define OP_BIT 120L /* whether specified bit is set */ +#define OP_COMP 121L /* complement value */ +#define OP_XOR 122L /* xor (~) of values */ +#define OP_HIGHBIT 123L /* index of high bit of value */ +#define OP_LOWBIT 124L /* index of low bit of value */ +#define OP_CONTENT 125L /* value returned by unary # */ +#define OP_HASHOP 126L /* binary # */ +#define OP_BACKSLASH 127L /* unary backslash */ +#define OP_SETMINUS 128L /* binary backslash */ +#define OP_PLUS 129L /* unary + */ +#define OP_JUMPNN 130L /* jump if top value is non-null */ +#define OP_ABORT 131L /* abort operation */ +#define MAX_OPCODE 131L /* highest legal opcode */ /* diff --git a/qmath.h b/qmath.h index 3553e8a..a521757 100644 --- a/qmath.h +++ b/qmath.h @@ -1,7 +1,7 @@ /* * qmath - declarations for extended precision rational arithmetic * - * Copyright (C) 1999 David I. Bell + * Copyright (C) 1999-2006 David I. Bell * * Calc is open software; you can redistribute it and/or modify it under * the terms of the version 2.1 of the GNU Lesser General Public License @@ -17,8 +17,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.6 $ - * @(#) $Id: qmath.h,v 29.6 2006/05/07 13:04:18 chongo Exp $ + * @(#) $Revision: 29.7 $ + * @(#) $Id: qmath.h,v 29.7 2006/06/25 20:33:26 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/qmath.h,v $ * * Under source code control: 1993/07/30 19:42:47 @@ -163,7 +163,7 @@ extern long qilog2(NUMBER *q); extern long qilog10(NUMBER *q); extern NUMBER *qilog(NUMBER *q, ZVALUE base); extern BOOL qcmpmod(NUMBER *q1, NUMBER *q2, NUMBER *q3); -extern BOOL qquomod(NUMBER *q1, NUMBER *q2, NUMBER **retdiv, NUMBER **retmod); +extern BOOL qquomod(NUMBER *q1, NUMBER *q2, NUMBER **quo, NUMBER **mod, long rnd); extern FLAG qnear(NUMBER *q1, NUMBER *q2, NUMBER *epsilon); extern NUMBER *qdigit(NUMBER *q, ZVALUE dpos, ZVALUE base); extern long qprecision(NUMBER *q); diff --git a/qmod.c b/qmod.c index 2434e73..8ebebf4 100644 --- a/qmod.c +++ b/qmod.c @@ -1,7 +1,7 @@ /* * qmod - modular arithmetic routines for normal numbers and REDC numbers * - * Copyright (C) 1999 David I. Bell and Ernest Bowen + * Copyright (C) 1999-2006 David I. Bell and Ernest Bowen * * Primary author: David I. Bell * @@ -19,8 +19,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.2 $ - * @(#) $Id: qmod.c,v 29.2 2000/06/07 14:02:13 chongo Exp $ + * @(#) $Revision: 29.3 $ + * @(#) $Id: qmod.c,v 29.3 2006/06/25 20:33:26 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/qmod.c,v $ * * Under source code control: 1991/05/22 23:15:07 @@ -100,39 +100,37 @@ qmod(NUMBER *q1, NUMBER *q2, long rnd) /* - * Given two numbers q1, q2, qquomod(q1, q2, retqdiv, retqmod) - * calculates an integral quotient and numerical remainder such that - * q1 = q2 * quotient + remainder. The remainder is zero if - * q1 is a multiple of q2; the quotient is zero if q2 is zero. - * In other cases, the remainder always has absolute value less than - * abs(q2). Which of the two possible quotient-remainder pairs is returned - * is determined by the conf->quomod configuration parameter. - * If the quomod parameter is zero, the remainder has the sign of q2 - * and the qotient is rounded towards zero. - * The results are returned indirectly through pointers. - * The function returns FALSE or - * TRUE according as the remainder is or is not zero. For - * example, if conf->quomod = 0, - * qquomod(11, 4, &x, &y) sets x to 2, y to 3, and returns TRUE. - * qquomod(-7, -3, &x, &y) sets x to 2, y to -1, and returns TRUE. + * Given two numbers q1, q2, qquomod(q1, q2, quo, mod, rnd) assigns + * quo(q1, q2, rnd) to quo and mod(q1, q2, rnd) to mod. The quotient + * quo is always an integer, q1 = q2 * quo + mod, and if q2 is non-zero, + * abs(mod) < abs(q2). If q2 is zero, quo is assigned the value zero and + * mod = q1. + * Which of the two possible quotient-remainder pairs is assigned + * to quo and mod is determined by the fifth argument rnd. + * If rnd is zero, the remainder has the sign of q2 + * and the quotient is rounded towards zero. * - * given: - * q1 numbers to do quotient with - * q2 numbers to do quotient with - * retqdiv returned quotient - * retqmod returned modulo + * The function returns TRUE or FALSE according as the remainder is + * nonzero or zero + * + * Given: + * q1 number to be divided + * q2 divisor + * quo quotient + * mod remainder + * rnd rounding-type specifier */ BOOL -qquomod(NUMBER *q1, NUMBER *q2, NUMBER **retqdiv, NUMBER **retqmod) +qquomod(NUMBER *q1, NUMBER *q2, NUMBER **quo, NUMBER **mod, long rnd) { NUMBER *qq, *qm; ZVALUE tmp1, tmp2, tmp3, tmp4; - if (qiszero(q2)) { /* zero modulus case */ + if (qiszero(q2)) { /* zero divisor case */ qq = qlink(&_qzero_); qm = qlink(q1); - } else if (qisint(q1) && qisint(q2)) { /* integer case */ - zdiv(q1->num, q2->num, &tmp1, &tmp2, conf->quomod); + } else if (qisint(q1) && qisint(q2)) { /* integer args case */ + zdiv(q1->num, q2->num, &tmp1, &tmp2, rnd); if (ziszero(tmp1)) { zfree(tmp1); zfree(tmp2); @@ -152,7 +150,7 @@ qquomod(NUMBER *q1, NUMBER *q2, NUMBER **retqdiv, NUMBER **retqmod) } else { /* fractional case */ zmul(q1->num, q2->den, &tmp1); zmul(q2->num, q1->den, &tmp2); - zdiv(tmp1, tmp2, &tmp3, &tmp4, conf->quomod); + zdiv(tmp1, tmp2, &tmp3, &tmp4, rnd); zfree(tmp1); zfree(tmp2); if (ziszero(tmp3)) { @@ -175,8 +173,8 @@ qquomod(NUMBER *q1, NUMBER *q2, NUMBER **retqdiv, NUMBER **retqmod) } } } - *retqdiv = qq; - *retqmod = qm; + *quo = qq; + *mod = qm; return !qiszero(qm); } diff --git a/quickhash.c b/quickhash.c index a396746..a5465d7 100644 --- a/quickhash.c +++ b/quickhash.c @@ -17,8 +17,8 @@ * received a copy with calc; if not, write to Free Software Foundation, Inc. * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * - * @(#) $Revision: 29.11 $ - * @(#) $Id: quickhash.c,v 29.11 2006/06/20 10:25:45 chongo Exp $ + * @(#) $Revision: 29.13 $ + * @(#) $Id: quickhash.c,v 29.13 2006/06/25 23:24:16 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/quickhash.c,v $ * * Under source code control: 1995/03/04 11:34:23 @@ -236,7 +236,11 @@ hashvalue(VALUE *vp, QCKHASH val) static QCKHASH assochash(ASSOC *ap, QCKHASH val) { - /* XXX - hash the first and last values??? */ + /* + * XXX - maybe we should hash the first few and last few values??? + * Perhaps we should hash associations in a different but + * fast way? + */ val += V_ASSOC; return quasi_fnv(ap->a_count, val); } diff --git a/token.c b/token.c index d67be8d..9dec83f 100644 --- a/token.c +++ b/token.c @@ -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: token.c,v 29.9 2006/06/20 10:28:06 chongo Exp $ + * @(#) $Revision: 29.10 $ + * @(#) $Id: token.c,v 29.10 2006/06/24 18:43:05 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/token.c,v $ * * Under source code control: 1990/02/15 01:48:25 @@ -187,6 +187,9 @@ gettoken(void) switch (ch) { case ' ': case '\t': + case '\r': + case '\v': + case '\f': case '\0': break; case '\n': diff --git a/version.c b/version.c index b45f8d3..a161263 100644 --- a/version.c +++ b/version.c @@ -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.61 $ - * @(#) $Id: version.c,v 29.61 2006/06/20 09:27:07 chongo Exp $ + * @(#) $Revision: 29.62 $ + * @(#) $Id: version.c,v 29.62 2006/06/25 22:59:16 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/calc/RCS/version.c,v $ * * Under source code control: 1990/05/22 11:00:58 @@ -48,7 +48,7 @@ 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 4 /* test number or 0 if no minor patch */ +#define MINOR_PATCH 5 /* test number or 0 if no minor patch */ /* diff --git a/win32/calcerr.c b/win32/calcerr.c index 5daec22..a647a2f 100644 --- a/win32/calcerr.c +++ b/win32/calcerr.c @@ -386,9 +386,9 @@ CONST char *error_table[E__COUNT+2] = { "No-error-value destination for assign", "No-copy argument for octet swap", "No-assign-to-or-from argument for swap", - "Non-variable argument for swap", - "Non-variable argument 4 or 4 for quomod", - "Non-real-number argument 1 or 2 for quomod", + "Non-lvalue argument for swap", + "Non-lvalue argument 3 or 4 for quomod", + "Non-real-number arg 1 or 2 or bad arg 5 for quomod", "No-assign-to argument 3 or 4 for quomod", "No-copy-to or no-change argument for octet preinc", "Non-variable argument for preinc", diff --git a/win32/calcerr.h b/win32/calcerr.h index eb32f10..0852b1b 100644 --- a/win32/calcerr.h +++ b/win32/calcerr.h @@ -383,9 +383,9 @@ #define E_ASSIGN9 10370 /* No-error-value destination for assign */ #define E_SWAP1 10371 /* No-copy argument for octet swap */ #define E_SWAP2 10372 /* No-assign-to-or-from argument for swap */ -#define E_SWAP3 10373 /* Non-variable argument for swap */ -#define E_QUOMOD1 10374 /* Non-variable argument 4 or 4 for quomod */ -#define E_QUOMOD2 10375 /* Non-real-number argument 1 or 2 for quomod */ +#define E_SWAP3 10373 /* Non-lvalue argument for swap */ +#define E_QUOMOD1 10374 /* Non-lvalue argument 3 or 4 for quomod */ +#define E_QUOMOD2 10375 /* Non-real-number arg 1 or 2 or bad arg 5 for quomod */ #define E_QUOMOD3 10376 /* No-assign-to argument 3 or 4 for quomod */ #define E_PREINC1 10377 /* No-copy-to or no-change argument for octet preinc */ #define E_PREINC2 10378 /* Non-variable argument for preinc */