version 1.29, 2003/05/30 00:47:24 |
version 1.37, 2004/11/22 02:26:56 |
|
|
* 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/parse/eval.c,v 1.28 2003/05/24 10:42:18 noro Exp $ |
* $OpenXM: OpenXM_contrib2/asir2000/parse/eval.c,v 1.36 2004/10/27 08:21:47 noro Exp $ |
*/ |
*/ |
#include <ctype.h> |
#include <ctype.h> |
#include "ca.h" |
#include "ca.h" |
Line 84 pointer eval(FNODE f) |
|
Line 84 pointer eval(FNODE f) |
|
GF2N gf2n; |
GF2N gf2n; |
GFPN gfpn; |
GFPN gfpn; |
GFSN gfsn; |
GFSN gfsn; |
|
RANGE range; |
|
|
#if defined(VISUAL) |
#if defined(VISUAL) |
if ( recv_intr ) { |
if ( recv_intr ) { |
Line 305 pointer eval(FNODE f) |
|
Line 306 pointer eval(FNODE f) |
|
MKLIST(t,NEXT(BDY((LIST)a))); val = (pointer)t; |
MKLIST(t,NEXT(BDY((LIST)a))); val = (pointer)t; |
} |
} |
break; |
break; |
case I_PROC: |
|
val = (pointer)FA0(f); break; |
|
case I_INDEX: |
case I_INDEX: |
a = eval((FNODE)FA0(f)); ind = (NODE)FA1(f); |
a = eval((FNODE)FA0(f)); ind = (NODE)FA1(f); |
evalnodebody(ind,&tn); getarray(a,tn,&val); |
evalnodebody(ind,&tn); getarray(a,tn,&val); |
Line 455 pointer evalf(FUNC f,FNODE a,FNODE opt) |
|
Line 454 pointer evalf(FUNC f,FNODE a,FNODE opt) |
|
LIST args; |
LIST args; |
pointer val; |
pointer val; |
int i,n,level; |
int i,n,level; |
NODE tn,sn,opts,opt1; |
NODE tn,sn,opts,opt1,dmy; |
VS pvs,prev_mpvs; |
VS pvs,prev_mpvs; |
char errbuf[BUFSIZ]; |
char errbuf[BUFSIZ]; |
static unsigned int stack_size; |
static unsigned int stack_size; |
static void *stack_base; |
static void *stack_base; |
Line 465 pointer evalf(FUNC f,FNODE a,FNODE opt) |
|
Line 464 pointer evalf(FUNC f,FNODE a,FNODE opt) |
|
sprintf(errbuf,"evalf : %s undefined",NAME(f)); |
sprintf(errbuf,"evalf : %s undefined",NAME(f)); |
error(errbuf); |
error(errbuf); |
} |
} |
|
if ( getsecuremode() && !PVSS && !f->secure ) { |
|
sprintf(errbuf,"evalf : %s not permitted",NAME(f)); |
|
error(errbuf); |
|
} |
if ( f->id != A_PARI ) { |
if ( f->id != A_PARI ) { |
for ( i = 0, tn = a?(NODE)FA0(a):0; tn; i++, tn = NEXT(tn) ); |
for ( i = 0, tn = a?(NODE)FA0(a):0; tn; i++, tn = NEXT(tn) ); |
if ( ((n = f->argc)>= 0 && i != n) || (n < 0 && i > -n) ) { |
if ( ((n = f->argc)>= 0 && i != n) || (n < 0 && i > -n) ) { |
Line 474 pointer evalf(FUNC f,FNODE a,FNODE opt) |
|
Line 477 pointer evalf(FUNC f,FNODE a,FNODE opt) |
|
} |
} |
switch ( f->id ) { |
switch ( f->id ) { |
case A_BIN: |
case A_BIN: |
|
if ( opt ) { |
|
opts = BDY((LIST)eval(opt)); |
|
/* opts = ["opt1",arg1],... */ |
|
opt1 = BDY((LIST)BDY(opts)); |
|
if ( !strcmp(BDY((STRING)BDY(opt1)),"option_list") ) { |
|
/* |
|
* the special option specification: |
|
* option_list=[["o1","a1"],...] |
|
*/ |
|
asir_assert(BDY(NEXT(opt1)),O_LIST,"evalf"); |
|
opts = BDY((LIST)BDY(NEXT(opt1))); |
|
} |
|
} else |
|
opts = 0; |
if ( !n ) { |
if ( !n ) { |
cur_binf = f; |
cur_binf = f; |
(*f->f.binf)(&val); |
(*f->f.binf)(&val); |
} else { |
} else { |
args = (LIST)eval(a); |
args = (LIST)eval(a); |
|
current_option = opts; |
cur_binf = f; |
cur_binf = f; |
(*f->f.binf)(args?BDY(args):0,&val); |
(*f->f.binf)(args?BDY(args):0,&val); |
} |
} |
Line 680 pointer bevalf(FUNC f,NODE a) |
|
Line 698 pointer bevalf(FUNC f,NODE a) |
|
sprintf(errbuf,"bevalf : %s undefined",NAME(f)); |
sprintf(errbuf,"bevalf : %s undefined",NAME(f)); |
error(errbuf); |
error(errbuf); |
} |
} |
|
if ( getsecuremode() && !PVSS && !f->secure ) { |
|
sprintf(errbuf,"bevalf : %s not permitted",NAME(f)); |
|
error(errbuf); |
|
} |
if ( f->id != A_PARI ) { |
if ( f->id != A_PARI ) { |
for ( i = 0, tn = a; tn; i++, tn = NEXT(tn) ); |
for ( i = 0, tn = a; tn; i++, tn = NEXT(tn) ); |
if ( ((n = f->argc)>= 0 && i != n) || (n < 0 && i > -n) ) { |
if ( ((n = f->argc)>= 0 && i != n) || (n < 0 && i > -n) ) { |
Line 847 void gen_searchf(char *name,FUNC *r) |
|
Line 869 void gen_searchf(char *name,FUNC *r) |
|
searchuf(name,&val); |
searchuf(name,&val); |
if ( !val ) |
if ( !val ) |
appenduf(name,&val); |
appenduf(name,&val); |
|
*r = val; |
|
} |
|
|
|
void gen_searchf_searchonly(char *name,FUNC *r) |
|
{ |
|
FUNC val = 0; |
|
int global = 0; |
|
if ( *name == ':' ) { |
|
global = 1; |
|
name += 2; |
|
} |
|
if ( CUR_MODULE && !global ) |
|
searchf(CUR_MODULE->usrf_list,name,&val); |
|
if ( !val ) |
|
searchf(sysf,name,&val); |
|
if ( !val ) |
|
searchf(ubinf,name,&val); |
|
if ( !val ) |
|
searchpf(name,&val); |
|
if ( !val ) |
|
searchuf(name,&val); |
*r = val; |
*r = val; |
} |
} |
|
|