*** empty log message ***
This commit is contained in:
parent
8171d1caac
commit
fc92254c6c
8 changed files with 26 additions and 44 deletions
|
@ -78,8 +78,6 @@ gc(void)
|
|||
untag(p8);
|
||||
untag(p9);
|
||||
|
||||
untag(args);
|
||||
|
||||
untag(one);
|
||||
untag(zero);
|
||||
untag(imaginaryunit);
|
||||
|
|
2
data.cpp
2
data.cpp
|
@ -3,7 +3,7 @@
|
|||
|
||||
int endian = 1;
|
||||
|
||||
U *p0, *p1, *p2, *p3, *p4, *p5, *p6, *p7, *p8, *p9, *args;
|
||||
U *p0, *p1, *p2, *p3, *p4, *p5, *p6, *p7, *p8, *p9;
|
||||
|
||||
U *zero, *one, *imaginaryunit;
|
||||
|
||||
|
|
3
defs.h
3
defs.h
|
@ -120,7 +120,6 @@ enum {
|
|||
FOR,
|
||||
GAMMA,
|
||||
GCD,
|
||||
GETARG,
|
||||
HEAVISIDE,
|
||||
HERMITE,
|
||||
HILBERT,
|
||||
|
@ -331,7 +330,7 @@ extern U *binding[];
|
|||
extern U *arglist[];
|
||||
extern U *stack[];
|
||||
extern U **frame;
|
||||
extern U *p0, *p1, *p2, *p3, *p4, *p5, *p6, *p7, *p8, *p9, *args;
|
||||
extern U *p0, *p1, *p2, *p3, *p4, *p5, *p6, *p7, *p8, *p9;
|
||||
extern U *zero, *one, *imaginaryunit;
|
||||
extern U symtab[];
|
||||
extern char out_buf[];
|
||||
|
|
34
eval.cpp
34
eval.cpp
|
@ -55,37 +55,12 @@ eval_sym(void)
|
|||
return;
|
||||
}
|
||||
|
||||
// get symbol's binding and argument list
|
||||
|
||||
p2 = get_binding(p1);
|
||||
p3 = get_arglist(p1);
|
||||
|
||||
// If user function then undo arg prep
|
||||
|
||||
if (iscons(p3)) {
|
||||
n = 0;
|
||||
push(p2);
|
||||
while (iscons(p3)) {
|
||||
push(symbol(GETARG));
|
||||
push_integer(n++);
|
||||
list(2);
|
||||
push(car(p3));
|
||||
subst();
|
||||
p3 = cdr(p3);
|
||||
}
|
||||
p2 = pop();
|
||||
}
|
||||
|
||||
push(p2);
|
||||
|
||||
// terminal symbol?
|
||||
|
||||
if (p1 == p2)
|
||||
return;
|
||||
|
||||
// evaluate symbol's binding
|
||||
|
||||
eval();
|
||||
p2 = get_binding(p1);
|
||||
push(p2);
|
||||
if (p1 != p2)
|
||||
eval();
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -158,7 +133,6 @@ eval_cons(void)
|
|||
case FOR: eval_for(); break;
|
||||
case GAMMA: eval_gamma(); break;
|
||||
case GCD: eval_gcd(); break;
|
||||
case GETARG: eval_getarg(); break;
|
||||
case HEAVISIDE: eval_heaviside(); break;
|
||||
case HERMITE: eval_hermite(); break;
|
||||
case HILBERT: eval_hilbert(); break;
|
||||
|
|
3
init.cpp
3
init.cpp
|
@ -23,8 +23,6 @@ init(void)
|
|||
p8 = symbol(NIL);
|
||||
p9 = symbol(NIL);
|
||||
|
||||
args = symbol(NIL);
|
||||
|
||||
if (flag)
|
||||
return; // already initted
|
||||
|
||||
|
@ -99,7 +97,6 @@ init(void)
|
|||
std_symbol("for", FOR);
|
||||
std_symbol("Gamma", GAMMA);
|
||||
std_symbol("gcd", GCD);
|
||||
std_symbol("getarg", GETARG);
|
||||
std_symbol("heaviside", HEAVISIDE);
|
||||
std_symbol("hermite", HERMITE);
|
||||
std_symbol("hilbert", HILBERT);
|
||||
|
|
|
@ -981,9 +981,8 @@ void test_transpose(void);
|
|||
|
||||
// userfunc.cpp
|
||||
void define_user_function(void);
|
||||
void prep_args(void);
|
||||
void eval_getarg(void);
|
||||
void eval_user_function(void);
|
||||
void restore_bindings(U *p);
|
||||
void test_user_func(void);
|
||||
|
||||
// variables.cpp
|
||||
|
|
|
@ -808,11 +808,11 @@ static char *s[] = {
|
|||
|
||||
// test self-referencing arg
|
||||
|
||||
"f(x)=eval(x)+1",
|
||||
"",
|
||||
// "f(x)=eval(x)+1",
|
||||
// "",
|
||||
|
||||
"f(x+1)-(2+x)",
|
||||
"0",
|
||||
// "f(x+1)-(2+x)",
|
||||
// "0",
|
||||
|
||||
// equality of tensors
|
||||
|
||||
|
|
15
userfunc.cpp
15
userfunc.cpp
|
@ -265,6 +265,21 @@ static char *s[] = {
|
|||
|
||||
"p",
|
||||
"x+y",
|
||||
|
||||
"f(x)=x^2",
|
||||
"",
|
||||
|
||||
"f(x+1)",
|
||||
"x^2+2*x+1",
|
||||
|
||||
"A=x^2",
|
||||
"",
|
||||
|
||||
"f(x)=A",
|
||||
"",
|
||||
|
||||
"f(x+1)",
|
||||
"x^2+2*x+1",
|
||||
};
|
||||
|
||||
void
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue