Release calc version 2.12.4.11

This commit is contained in:
Landon Curt Noll
2013-09-01 15:25:13 -07:00
parent 17e3535595
commit 85bfa30897
37 changed files with 5367 additions and 3019 deletions

90
obj.c
View File

@@ -17,8 +17,8 @@
* received a copy with calc; if not, write to Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* @(#) $Revision: 30.2 $
* @(#) $Id: obj.c,v 30.2 2013/08/11 08:41:38 chongo Exp $
* @(#) $Revision: 30.3 $
* @(#) $Id: obj.c,v 30.3 2013/09/01 22:16:21 chongo Exp $
* @(#) $Source: /usr/local/src/bin/calc/RCS/obj.c,v $
*
* Under source code control: 1990/02/15 01:48:19
@@ -71,95 +71,95 @@ STATIC struct objectinfo {
char *name; /* name of function to call */
char *comment; /* useful comment if any */
} objectinfo[] = {
{1, A_UNDEF, ERR_PRINT,
{1, A_UNDEF, ERR_PRINT,
"print", "print value, default prints elements"},
{1, A_VALUE, ERR_ONE,
{1, A_VALUE, ERR_ONE,
"one", "multiplicative identity, default is 1"},
{1, A_INT, ERR_TEST,
{1, A_INT, ERR_TEST,
"test", "logical test (false,true => 0,1), default tests elements"},
{2, A_VALUE, ERR_NONE,
{2, A_VALUE, ERR_NONE,
"add", NULL},
{2, A_VALUE, ERR_NONE,
{2, A_VALUE, ERR_NONE,
"sub", NULL},
{1, A_VALUE, ERR_NONE,
{1, A_VALUE, ERR_NONE,
"neg", "negative"},
{2, A_VALUE, ERR_NONE,
{2, A_VALUE, ERR_NONE,
"mul", NULL},
{2, A_VALUE, ERR_NONE,
{2, A_VALUE, ERR_NONE,
"div", "non-integral division"},
{1, A_VALUE, ERR_NONE,
{1, A_VALUE, ERR_NONE,
"inv", "multiplicative inverse"},
{2, A_VALUE, ERR_NONE,
{2, A_VALUE, ERR_NONE,
"abs", "absolute value within given error"},
{1, A_VALUE, ERR_NONE,
{1, A_VALUE, ERR_NONE,
"norm", "square of absolute value"},
{1, A_VALUE, ERR_NONE,
{1, A_VALUE, ERR_NONE,
"conj", "conjugate"},
{2, A_VALUE, ERR_POW,
{2, A_VALUE, ERR_POW,
"pow", "integer power, default does multiply, square, inverse"},
{1, A_VALUE, ERR_NONE,
{1, A_VALUE, ERR_NONE,
"sgn", "sign of value (-1, 0, 1)"},
{2, A_INT, ERR_CMP,
{2, A_INT, ERR_CMP,
"cmp", "equality (equal,nonequal => 0,1), default tests elements"},
{2, A_VALUE, ERR_NONE,
{2, A_VALUE, ERR_NONE,
"rel", "relative order, positive for >, etc."},
{3, A_VALUE, ERR_NONE,
{3, A_VALUE, ERR_NONE,
"quo", "integer quotient"},
{3, A_VALUE, ERR_NONE,
{3, A_VALUE, ERR_NONE,
"mod", "remainder of division"},
{1, A_VALUE, ERR_NONE,
{1, A_VALUE, ERR_NONE,
"int", "integer part"},
{1, A_VALUE, ERR_NONE,
{1, A_VALUE, ERR_NONE,
"frac", "fractional part"},
{1, A_VALUE, ERR_INC,
{1, A_VALUE, ERR_INC,
"inc", "increment, default adds 1"},
{1, A_VALUE, ERR_DEC,
{1, A_VALUE, ERR_DEC,
"dec", "decrement, default subtracts 1"},
{1, A_VALUE, ERR_SQUARE,
"square", "default multiplies by itself"},
{2, A_VALUE, ERR_NONE,
{2, A_VALUE, ERR_NONE,
"scale", "multiply by power of 2"},
{2, A_VALUE, ERR_NONE,
"shift", "shift left by n bits (right if negative)"},
{3, A_VALUE, ERR_NONE,
{3, A_VALUE, ERR_NONE,
"round", "round to given number of decimal places"},
{3, A_VALUE, ERR_NONE,
"bround", "round to given number of binary places"},
{3, A_VALUE, ERR_NONE,
{3, A_VALUE, ERR_NONE,
"root", "root of value within given error"},
{3, A_VALUE, ERR_NONE,
{3, A_VALUE, ERR_NONE,
"sqrt", "square root within given error"},
{2, A_VALUE, ERR_NONE,
{2, A_VALUE, ERR_NONE,
"or", "bitwise or"},
{2, A_VALUE, ERR_NONE,
{2, A_VALUE, ERR_NONE,
"and", "bitwise and"},
{1, A_VALUE, ERR_NONE,
{1, A_VALUE, ERR_NONE,
"not", "logical not"},
{1, A_VALUE, ERR_NONE,
{1, A_VALUE, ERR_NONE,
"fact", "factorial or postfix !"},
{1, A_VALUE, ERR_VALUE,
{1, A_VALUE, ERR_VALUE,
"min", "value for min(...)"},
{1, A_VALUE, ERR_VALUE,
{1, A_VALUE, ERR_VALUE,
"max", "value for max(...)"},
{1, A_VALUE, ERR_VALUE,
{1, A_VALUE, ERR_VALUE,
"sum", "value for sum(...)"},
{2, A_UNDEF, ERR_ASSIGN,
{2, A_UNDEF, ERR_ASSIGN,
"assign", "assign, defaults to a = b"},
{2, A_VALUE, ERR_NONE,
{2, A_VALUE, ERR_NONE,
"xor", "value for binary ~"},
{1, A_VALUE, ERR_NONE,
{1, A_VALUE, ERR_NONE,
"comp", "value for unary ~"},
{1, A_VALUE, ERR_NONE,
{1, A_VALUE, ERR_NONE,
"content", "unary hash op"},
{2, A_VALUE, ERR_NONE,
{2, A_VALUE, ERR_NONE,
"hashop", "binary hash op"},
{1, A_VALUE, ERR_NONE,
{1, A_VALUE, ERR_NONE,
"backslash", "unary backslash op"},
{2, A_VALUE, ERR_NONE,
{2, A_VALUE, ERR_NONE,
"setminus", "binary backslash op"},
{1, A_VALUE, ERR_NONE,
{1, A_VALUE, ERR_NONE,
"plus", "unary + op"},
{0, 0, 0,
{0, 0, 0,
NULL, NULL}
};
@@ -307,7 +307,7 @@ objcall(int action, VALUE *v1, VALUE *v2, VALUE *v3)
val.v_type = V_NULL;
break;
default:
math_error("Function \"%s\" is undefined",
math_error("Function \"%s\" is undefined",
namefunc(index));
/*NOTREACHED*/
}