version 1.89, 2005/11/02 05:18:41 |
version 1.90, 2005/11/02 05:39:23 |
|
|
* DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE, |
* DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE, |
* PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE. |
* PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE. |
* |
* |
* $OpenXM: OpenXM_contrib2/asir2000/builtin/strobj.c,v 1.88 2005/11/01 07:24:11 noro Exp $ |
* $OpenXM: OpenXM_contrib2/asir2000/builtin/strobj.c,v 1.89 2005/11/02 05:18:41 noro Exp $ |
*/ |
*/ |
#include "ca.h" |
#include "ca.h" |
#include "parse.h" |
#include "parse.h" |
Line 96 void Pquote_is_integer(),Pquote_is_rational(),Pquote_i |
|
Line 96 void Pquote_is_integer(),Pquote_is_rational(),Pquote_i |
|
void Pquote_is_dependent(),Pquote_is_function(); |
void Pquote_is_dependent(),Pquote_is_function(); |
void Pquote_normalize(); |
void Pquote_normalize(); |
void Pquote_normalize_comp(); |
void Pquote_normalize_comp(); |
void Pquote_normalize_unify(); |
void Pquote_normalize_match(); |
|
|
void Pquote_to_funargs(),Pfunargs_to_quote(),Pget_function_name(); |
void Pquote_to_funargs(),Pfunargs_to_quote(),Pget_function_name(); |
void Pquote_unify(),Pget_quote_id(),Pquote_match_rewrite(); |
void Pquote_match(),Pget_quote_id(),Pquote_match_rewrite(); |
void Pquote_to_nary(),Pquote_to_bin(); |
void Pquote_to_nary(),Pquote_to_bin(); |
void fnode_do_assign(NODE arg); |
void fnode_do_assign(NODE arg); |
void do_assign(NODE arg); |
void do_assign(NODE arg); |
Line 112 void tb_to_string(TB tb,STRING *rp); |
|
Line 112 void tb_to_string(TB tb,STRING *rp); |
|
void fnodenodetotex_tb(NODE n,TB tb); |
void fnodenodetotex_tb(NODE n,TB tb); |
void fargstotex_tb(char *opname,FNODE f,TB tb); |
void fargstotex_tb(char *opname,FNODE f,TB tb); |
int top_is_minus(FNODE f); |
int top_is_minus(FNODE f); |
int quote_unify(Obj f,Obj pat,NODE *rp); |
int quote_match(Obj f,Obj pat,NODE *rp); |
|
|
struct ftab str_tab[] = { |
struct ftab str_tab[] = { |
{"sprintf",Psprintf,-99999999}, |
{"sprintf",Psprintf,-99999999}, |
Line 146 struct ftab str_tab[] = { |
|
Line 146 struct ftab str_tab[] = { |
|
{"quotetotex_env",Pquotetotex_env,-99999999}, |
{"quotetotex_env",Pquotetotex_env,-99999999}, |
{"flatten_quote",Pflatten_quote,-2}, |
{"flatten_quote",Pflatten_quote,-2}, |
{"quote_to_funargs",Pquote_to_funargs,1}, |
{"quote_to_funargs",Pquote_to_funargs,1}, |
{"quote_unify",Pquote_unify,2}, |
{"quote_match",Pquote_match,2}, |
{"quote_normalize_unify",Pquote_normalize_unify,2}, |
{"quote_normalize_match",Pquote_normalize_match,2}, |
{"quote_match_rewrite",Pquote_match_rewrite,-4}, |
{"quote_match_rewrite",Pquote_match_rewrite,-4}, |
{"funargs_to_quote",Pfunargs_to_quote,1}, |
{"funargs_to_quote",Pfunargs_to_quote,1}, |
{"get_function_name",Pget_function_name,1}, |
{"get_function_name",Pget_function_name,1}, |
Line 634 void Pquote_is_dependent(NODE arg,Q *rp) |
|
Line 634 void Pquote_is_dependent(NODE arg,Q *rp) |
|
} |
} |
|
|
|
|
void Pquote_unify(NODE arg,Q *rp) |
void Pquote_match(NODE arg,Q *rp) |
{ |
{ |
FNODE f,g; |
FNODE f,g; |
Obj obj; |
Obj obj; |
Line 645 void Pquote_unify(NODE arg,Q *rp) |
|
Line 645 void Pquote_unify(NODE arg,Q *rp) |
|
#if 0 |
#if 0 |
g = partial_eval(BDY(((QUOTE)ARG0(arg)))); |
g = partial_eval(BDY(((QUOTE)ARG0(arg)))); |
MKQUOTE(q,g); |
MKQUOTE(q,g); |
ret = quote_unify((Obj)q,(Obj)ARG1(arg),&r); |
ret = quote_match((Obj)q,(Obj)ARG1(arg),&r); |
#else |
#else |
obj = (Obj)ARG0(arg); |
obj = (Obj)ARG0(arg); |
ret = quote_unify(obj,(Obj)ARG1(arg),&r); |
ret = quote_match(obj,(Obj)ARG1(arg),&r); |
#endif |
#endif |
if ( ret ) { |
if ( ret ) { |
do_assign(r); |
do_assign(r); |
Line 657 void Pquote_unify(NODE arg,Q *rp) |
|
Line 657 void Pquote_unify(NODE arg,Q *rp) |
|
*rp = 0; |
*rp = 0; |
} |
} |
|
|
void Pquote_normalize_unify(NODE arg,Q *rp) |
void Pquote_normalize_match(NODE arg,Q *rp) |
{ |
{ |
QUOTE fq,pq; |
QUOTE fq,pq; |
FNODE f,p; |
FNODE f,p; |
Line 666 void Pquote_normalize_unify(NODE arg,Q *rp) |
|
Line 666 void Pquote_normalize_unify(NODE arg,Q *rp) |
|
|
|
fq = (QUOTE)ARG0(arg); Pquote_normalize(mknode(2,fq,0),&fq); f = (FNODE)BDY(fq); |
fq = (QUOTE)ARG0(arg); Pquote_normalize(mknode(2,fq,0),&fq); f = (FNODE)BDY(fq); |
pq = (QUOTE)ARG1(arg); Pquote_normalize(mknode(2,pq,0),&pq); p = (FNODE)BDY(pq); |
pq = (QUOTE)ARG1(arg); Pquote_normalize(mknode(2,pq,0),&pq); p = (FNODE)BDY(pq); |
ret = fnode_normalize_unify(f,p,&r); |
ret = fnode_normalize_match(f,p,&r); |
if ( ret ) { |
if ( ret ) { |
fnode_do_assign(r); |
fnode_do_assign(r); |
*rp = ONE; |
*rp = ONE; |
Line 687 void Pquote_match_rewrite(NODE arg,Obj *rp) |
|
Line 687 void Pquote_match_rewrite(NODE arg,Obj *rp) |
|
int ret,ind,ac; |
int ret,ind,ac; |
|
|
obj = (Obj)ARG0(arg); |
obj = (Obj)ARG0(arg); |
ret = quote_unify(obj,(Obj)ARG1(arg),&r); |
ret = quote_match(obj,(Obj)ARG1(arg),&r); |
if ( ret ) { |
if ( ret ) { |
for ( t = r, s0 = 0; t; t = NEXT(t) ) { |
for ( t = r, s0 = 0; t; t = NEXT(t) ) { |
NEXTNODE(s0,s); |
NEXTNODE(s0,s); |
Line 785 int merge_matching_node(NODE n,NODE a,NODE *rp) |
|
Line 785 int merge_matching_node(NODE n,NODE a,NODE *rp) |
|
return 1; |
return 1; |
} |
} |
|
|
int quote_unify_node(NODE f,NODE pat,NODE *rp) { |
int quote_match_node(NODE f,NODE pat,NODE *rp) { |
NODE r,a,tf,tp,r1; |
NODE r,a,tf,tp,r1; |
int ret; |
int ret; |
|
|
if ( length(f) != length(pat) ) return 0; |
if ( length(f) != length(pat) ) return 0; |
r = 0; |
r = 0; |
for ( tf = f, tp = pat; tf; tf = NEXT(tf), tp = NEXT(tp) ) { |
for ( tf = f, tp = pat; tf; tf = NEXT(tf), tp = NEXT(tp) ) { |
ret = quote_unify((Obj)BDY(tf),(Obj)BDY(tp),&a); |
ret = quote_match((Obj)BDY(tf),(Obj)BDY(tp),&a); |
if ( !ret ) return 0; |
if ( !ret ) return 0; |
ret = merge_matching_node(r,a,&r1); |
ret = merge_matching_node(r,a,&r1); |
if ( !ret ) return 0; |
if ( !ret ) return 0; |
Line 804 int quote_unify_node(NODE f,NODE pat,NODE *rp) { |
|
Line 804 int quote_unify_node(NODE f,NODE pat,NODE *rp) { |
|
|
|
/* f = [a,b,c,...] pat = [X,Y,...] rpat matches the rest of f */ |
/* f = [a,b,c,...] pat = [X,Y,...] rpat matches the rest of f */ |
|
|
int quote_unify_cons(NODE f,NODE pat,Obj rpat,NODE *rp) { |
int quote_match_cons(NODE f,NODE pat,Obj rpat,NODE *rp) { |
QUOTE q; |
QUOTE q; |
Q id; |
Q id; |
FNODE fn; |
FNODE fn; |
Line 816 int quote_unify_cons(NODE f,NODE pat,Obj rpat,NODE *rp |
|
Line 816 int quote_unify_cons(NODE f,NODE pat,Obj rpat,NODE *rp |
|
if ( length(f) < length(pat) ) return 0; |
if ( length(f) < length(pat) ) return 0; |
r = 0; |
r = 0; |
for ( tf = f, tp = pat; tp; tf = NEXT(tf), tp = NEXT(tp) ) { |
for ( tf = f, tp = pat; tp; tf = NEXT(tf), tp = NEXT(tp) ) { |
ret = quote_unify((Obj)BDY(tf),(Obj)BDY(tp),&a); |
ret = quote_match((Obj)BDY(tf),(Obj)BDY(tp),&a); |
if ( !ret ) return 0; |
if ( !ret ) return 0; |
ret = merge_matching_node(r,a,&r1); |
ret = merge_matching_node(r,a,&r1); |
if ( !ret ) return 0; |
if ( !ret ) return 0; |
Line 828 int quote_unify_cons(NODE f,NODE pat,Obj rpat,NODE *rp |
|
Line 828 int quote_unify_cons(NODE f,NODE pat,Obj rpat,NODE *rp |
|
MKLIST(alist,a); |
MKLIST(alist,a); |
arg = mknode(1,alist); |
arg = mknode(1,alist); |
Pfunargs_to_quote(arg,&q); |
Pfunargs_to_quote(arg,&q); |
ret = quote_unify((Obj)q,rpat,&a); |
ret = quote_match((Obj)q,rpat,&a); |
if ( !ret ) return 0; |
if ( !ret ) return 0; |
ret = merge_matching_node(r,a,&r1); |
ret = merge_matching_node(r,a,&r1); |
if ( !ret ) return 0; |
if ( !ret ) return 0; |
Line 847 void get_quote_id_arg(QUOTE f,int *id,NODE *r) |
|
Line 847 void get_quote_id_arg(QUOTE f,int *id,NODE *r) |
|
|
|
/* *rp : [[quote(A),quote(1)],...] */ |
/* *rp : [[quote(A),quote(1)],...] */ |
|
|
int quote_unify(Obj f, Obj pat, NODE *rp) |
int quote_match(Obj f, Obj pat, NODE *rp) |
{ |
{ |
NODE tf,tp,head,body; |
NODE tf,tp,head,body; |
NODE parg,farg,r; |
NODE parg,farg,r; |
Line 866 int quote_unify(Obj f, Obj pat, NODE *rp) |
|
Line 866 int quote_unify(Obj f, Obj pat, NODE *rp) |
|
return 0; |
return 0; |
else if ( OID(pat) == O_LIST ) { |
else if ( OID(pat) == O_LIST ) { |
if ( OID(f) == O_LIST ) |
if ( OID(f) == O_LIST ) |
return quote_unify_node(BDY((LIST)f),BDY((LIST)pat),rp); |
return quote_match_node(BDY((LIST)f),BDY((LIST)pat),rp); |
else |
else |
return 0; |
return 0; |
} else if ( OID(pat) == O_QUOTE ) { |
} else if ( OID(pat) == O_QUOTE ) { |
Line 893 int quote_unify(Obj f, Obj pat, NODE *rp) |
|
Line 893 int quote_unify(Obj f, Obj pat, NODE *rp) |
|
|
|
tp = BDY((LIST)BDY(parg)); |
tp = BDY((LIST)BDY(parg)); |
if ( pid == I_LIST ) |
if ( pid == I_LIST ) |
return quote_unify_node(tf,tp,rp); |
return quote_match_node(tf,tp,rp); |
else { |
else { |
rpat = (Obj)BDY(NEXT(parg)); |
rpat = (Obj)BDY(NEXT(parg)); |
return quote_unify_cons(tf,tp,rpat,rp); |
return quote_match_cons(tf,tp,rpat,rp); |
} |
} |
|
|
case I_PVAR: |
case I_PVAR: |
Line 912 int quote_unify(Obj f, Obj pat, NODE *rp) |
|
Line 912 int quote_unify(Obj f, Obj pat, NODE *rp) |
|
if ( id == I_FUNC ) { |
if ( id == I_FUNC ) { |
r = mknode(2,BDY(parg),BDY(farg)); MKLIST(l,r); |
r = mknode(2,BDY(parg),BDY(farg)); MKLIST(l,r); |
head = mknode(1,l); |
head = mknode(1,l); |
ret = quote_unify(BDY(NEXT(farg)), |
ret = quote_match(BDY(NEXT(farg)), |
BDY(NEXT(parg)),&body); |
BDY(NEXT(parg)),&body); |
if ( !ret ) return 0; |
if ( !ret ) return 0; |
else return merge_matching_node(head,body,rp); |
else return merge_matching_node(head,body,rp); |
Line 940 int quote_unify(Obj f, Obj pat, NODE *rp) |
|
Line 940 int quote_unify(Obj f, Obj pat, NODE *rp) |
|
get_quote_id_arg((QUOTE)pat,&pid,&parg); |
get_quote_id_arg((QUOTE)pat,&pid,&parg); |
get_quote_id_arg((QUOTE)f,&id,&farg); |
get_quote_id_arg((QUOTE)f,&id,&farg); |
if ( compqa(CO,BDY(farg),BDY(parg)) ) return 0; |
if ( compqa(CO,BDY(farg),BDY(parg)) ) return 0; |
return quote_unify_node(NEXT(farg),NEXT(parg),rp); |
return quote_match_node(NEXT(farg),NEXT(parg),rp); |
|
|
default: |
default: |
if ( OID(f) != O_QUOTE ) return 0; |
if ( OID(f) != O_QUOTE ) return 0; |
Line 948 int quote_unify(Obj f, Obj pat, NODE *rp) |
|
Line 948 int quote_unify(Obj f, Obj pat, NODE *rp) |
|
if ( id != pid ) return 0; |
if ( id != pid ) return 0; |
get_quote_id_arg((QUOTE)pat,&pid,&parg); |
get_quote_id_arg((QUOTE)pat,&pid,&parg); |
get_quote_id_arg((QUOTE)f,&id,&farg); |
get_quote_id_arg((QUOTE)f,&id,&farg); |
return quote_unify_node(farg,parg,rp); |
return quote_match_node(farg,parg,rp); |
} |
} |
} |
} |
} |
} |
Line 2707 NODE append_node(NODE a1,NODE a2) |
|
Line 2707 NODE append_node(NODE a1,NODE a2) |
|
} |
} |
} |
} |
|
|
int fnode_normalize_unify(FNODE f,FNODE pat,NODE *rp) |
int fnode_normalize_match(FNODE f,FNODE pat,NODE *rp) |
{ |
{ |
NODE m,m1,m2,base,exp,fa,pa,n; |
NODE m,m1,m2,base,exp,fa,pa,n; |
LIST l; |
LIST l; |
Line 2731 int fnode_normalize_unify(FNODE f,FNODE pat,NODE *rp) |
|
Line 2731 int fnode_normalize_unify(FNODE f,FNODE pat,NODE *rp) |
|
case I_BOP: |
case I_BOP: |
/* OPNAME should be "^" */ |
/* OPNAME should be "^" */ |
if ( !IS_BINARYPWR(pat) ) |
if ( !IS_BINARYPWR(pat) ) |
error("fnode_normalize_unify : invalid BOP"); |
error("fnode_normalize_match : invalid BOP"); |
if ( IS_BINARYPWR(f) ) { |
if ( IS_BINARYPWR(f) ) { |
fbase = FA1(f); fexp = FA2(f); |
fbase = FA1(f); fexp = FA2(f); |
} else { |
} else { |
fbase = f; fexp = mkfnode(1,I_FORMULA,ONE); |
fbase = f; fexp = mkfnode(1,I_FORMULA,ONE); |
} |
} |
if ( !fnode_normalize_unify(fbase,FA1(pat),&base) ) return 0; |
if ( !fnode_normalize_match(fbase,FA1(pat),&base) ) return 0; |
a = rewrite_fnode(FA2(pat),base); |
a = rewrite_fnode(FA2(pat),base); |
if ( !fnode_normalize_unify(fexp,a,&exp) ) return 0; |
if ( !fnode_normalize_match(fexp,a,&exp) ) return 0; |
else { |
else { |
*rp = append_node(base,exp); |
*rp = append_node(base,exp); |
return 1; |
return 1; |
Line 2756 int fnode_normalize_unify(FNODE f,FNODE pat,NODE *rp) |
|
Line 2756 int fnode_normalize_unify(FNODE f,FNODE pat,NODE *rp) |
|
m = 0; |
m = 0; |
while ( fa && pa ) { |
while ( fa && pa ) { |
a = rewrite_fnode(BDY(pa),m); |
a = rewrite_fnode(BDY(pa),m); |
if ( !fnode_normalize_unify(BDY(fa),a,&m1) ) return 0; |
if ( !fnode_normalize_match(BDY(fa),a,&m1) ) return 0; |
m = append_node(m1,m); |
m = append_node(m1,m); |
fa = NEXT(fa); pa = NEXT(pa); |
fa = NEXT(fa); pa = NEXT(pa); |
} |
} |
Line 2768 int fnode_normalize_unify(FNODE f,FNODE pat,NODE *rp) |
|
Line 2768 int fnode_normalize_unify(FNODE f,FNODE pat,NODE *rp) |
|
|
|
case I_NARYOP: |
case I_NARYOP: |
if ( IS_NARYADD(pat) ) |
if ( IS_NARYADD(pat) ) |
return fnode_normalize_unify_naryadd(f,pat,rp); |
return fnode_normalize_match_naryadd(f,pat,rp); |
else if ( IS_NARYMUL(pat) ) |
else if ( IS_NARYMUL(pat) ) |
return fnode_normalize_unify_narymul(f,pat,rp); |
return fnode_normalize_match_narymul(f,pat,rp); |
else |
else |
error("fnode_normalize_unify : invalid NARYOP"); |
error("fnode_normalize_match : invalid NARYOP"); |
break; |
break; |
|
|
default: |
default: |
error("fnode_normalize_unify : invalid pattern"); |
error("fnode_normalize_match : invalid pattern"); |
} |
} |
} |
} |
|
|
Line 2841 FNODE fnode_right_narymul(FNODE p,int i) |
|
Line 2841 FNODE fnode_right_narymul(FNODE p,int i) |
|
} |
} |
} |
} |
|
|
int fnode_normalize_unify_naryadd(FNODE f,FNODE p,NODE *rp) |
int fnode_normalize_match_naryadd(FNODE f,FNODE p,NODE *rp) |
{ |
{ |
int fl,pl,fi,pi; |
int fl,pl,fi,pi; |
NODE fa,pa,t,s,m,m1; |
NODE fa,pa,t,s,m,m1; |
Line 2853 int fnode_normalize_unify_naryadd(FNODE f,FNODE p,NODE |
|
Line 2853 int fnode_normalize_unify_naryadd(FNODE f,FNODE p,NODE |
|
if ( fl < pl ) return 0; |
if ( fl < pl ) return 0; |
else if ( pl == 1 ) { |
else if ( pl == 1 ) { |
if ( fl == 1 ) |
if ( fl == 1 ) |
return fnode_normalize_unify(BDY(fa),BDY(pa),rp); |
return fnode_normalize_match(BDY(fa),BDY(pa),rp); |
else |
else |
return 0; |
return 0; |
} else { |
} else { |
Line 2863 int fnode_normalize_unify_naryadd(FNODE f,FNODE p,NODE |
|
Line 2863 int fnode_normalize_unify_naryadd(FNODE f,FNODE p,NODE |
|
/* all are I_PVAR */ |
/* all are I_PVAR */ |
m = 0; |
m = 0; |
for ( t = pa, s = fa; NEXT(t); t = NEXT(t), s = NEXT(s) ) { |
for ( t = pa, s = fa; NEXT(t); t = NEXT(t), s = NEXT(s) ) { |
fnode_normalize_unify(BDY(s),BDY(t),&m1); |
fnode_normalize_match(BDY(s),BDY(t),&m1); |
m = append_node(m1,m); |
m = append_node(m1,m); |
} |
} |
if ( !NEXT(s) ) |
if ( !NEXT(s) ) |
fr = (FNODE)BDY(s); |
fr = (FNODE)BDY(s); |
else |
else |
fr = mkfnode(2,I_NARYOP,FA0(f),s); |
fr = mkfnode(2,I_NARYOP,FA0(f),s); |
fnode_normalize_unify(fr,BDY(t),&m1); |
fnode_normalize_match(fr,BDY(t),&m1); |
*rp = append_node(m1,m); |
*rp = append_node(m1,m); |
return 1; |
return 1; |
} else { |
} else { |
pivot = (FNODE)BDY(t); |
pivot = (FNODE)BDY(t); |
pr = fnode_removeith_naryadd(p,pi); |
pr = fnode_removeith_naryadd(p,pi); |
for ( s = fa, fi = 0; s; s = NEXT(s), fi++ ) { |
for ( s = fa, fi = 0; s; s = NEXT(s), fi++ ) { |
if ( fnode_normalize_unify(BDY(s),pivot,&m) ) { |
if ( fnode_normalize_match(BDY(s),pivot,&m) ) { |
fr = fnode_removeith_naryadd(f,fi); |
fr = fnode_removeith_naryadd(f,fi); |
prr = rewrite_fnode(pr,m); |
prr = rewrite_fnode(pr,m); |
if ( fnode_normalize_unify(fr,prr,&m1) ) { |
if ( fnode_normalize_match(fr,prr,&m1) ) { |
*rp = append_node(m,m1); |
*rp = append_node(m,m1); |
return 1; |
return 1; |
} |
} |
Line 2891 int fnode_normalize_unify_naryadd(FNODE f,FNODE p,NODE |
|
Line 2891 int fnode_normalize_unify_naryadd(FNODE f,FNODE p,NODE |
|
} |
} |
} |
} |
|
|
int fnode_normalize_unify_narymul(FNODE f,FNODE p,NODE *rp) |
int fnode_normalize_match_narymul(FNODE f,FNODE p,NODE *rp) |
{ |
{ |
int fl,pl,fi,pi; |
int fl,pl,fi,pi; |
NODE fa,pa,t,s,m,m1; |
NODE fa,pa,t,s,m,m1; |
Line 2903 int fnode_normalize_unify_narymul(FNODE f,FNODE p,NODE |
|
Line 2903 int fnode_normalize_unify_narymul(FNODE f,FNODE p,NODE |
|
if ( fl < pl ) return 0; |
if ( fl < pl ) return 0; |
else if ( pl == 1 ) { |
else if ( pl == 1 ) { |
if ( fl == 1 ) |
if ( fl == 1 ) |
return fnode_normalize_unify(BDY(fa),BDY(pa),rp); |
return fnode_normalize_match(BDY(fa),BDY(pa),rp); |
else |
else |
return 0; |
return 0; |
} else { |
} else { |
Line 2914 int fnode_normalize_unify_narymul(FNODE f,FNODE p,NODE |
|
Line 2914 int fnode_normalize_unify_narymul(FNODE f,FNODE p,NODE |
|
m = 0; |
m = 0; |
for ( t = pa, s = fa; NEXT(t); t = NEXT(t), s = NEXT(s) ) { |
for ( t = pa, s = fa; NEXT(t); t = NEXT(t), s = NEXT(s) ) { |
pr = rewrite_fnode(BDY(t),m); |
pr = rewrite_fnode(BDY(t),m); |
if ( !fnode_normalize_unify(BDY(s),pr,&m1) ) return 0; |
if ( !fnode_normalize_match(BDY(s),pr,&m1) ) return 0; |
m = append_node(m1,m); |
m = append_node(m1,m); |
} |
} |
if ( !NEXT(s) ) |
if ( !NEXT(s) ) |
Line 2922 int fnode_normalize_unify_narymul(FNODE f,FNODE p,NODE |
|
Line 2922 int fnode_normalize_unify_narymul(FNODE f,FNODE p,NODE |
|
else |
else |
fr = mkfnode(2,I_NARYOP,FA0(f),s); |
fr = mkfnode(2,I_NARYOP,FA0(f),s); |
pr = rewrite_fnode(BDY(t),m); |
pr = rewrite_fnode(BDY(t),m); |
if ( !fnode_normalize_unify(fr,pr,&m1) ) return 0; |
if ( !fnode_normalize_match(fr,pr,&m1) ) return 0; |
*rp = append_node(m1,m); |
*rp = append_node(m1,m); |
return 1; |
return 1; |
} else { |
} else { |
Line 2931 int fnode_normalize_unify_narymul(FNODE f,FNODE p,NODE |
|
Line 2931 int fnode_normalize_unify_narymul(FNODE f,FNODE p,NODE |
|
pright = fnode_right_narymul(p,pi); |
pright = fnode_right_narymul(p,pi); |
/* XXX : incomplete */ |
/* XXX : incomplete */ |
for ( s = fa, fi = 0; s; s = NEXT(s), fi++ ) { |
for ( s = fa, fi = 0; s; s = NEXT(s), fi++ ) { |
if ( fnode_normalize_unify(BDY(s),pivot,&m) ) { |
if ( fnode_normalize_match(BDY(s),pivot,&m) ) { |
fleft = fnode_left_narymul(f,fi); |
fleft = fnode_left_narymul(f,fi); |
pleft1 = rewrite_fnode(pleft,m); |
pleft1 = rewrite_fnode(pleft,m); |
if ( fnode_normalize_unify(fleft,pleft1,&m1) ) { |
if ( fnode_normalize_match(fleft,pleft1,&m1) ) { |
m = append_node(m1,m); |
m = append_node(m1,m); |
fright = fnode_right_narymul(f,fi); |
fright = fnode_right_narymul(f,fi); |
pright1 = rewrite_fnode(pright,m); |
pright1 = rewrite_fnode(pright,m); |
if ( fnode_normalize_unify(fright,pright1,&m1) ) { |
if ( fnode_normalize_match(fright,pright1,&m1) ) { |
*rp = append_node(m1,m); |
*rp = append_node(m1,m); |
return 1; |
return 1; |
} |
} |