version 1.5, 2000/02/22 18:19:02
|
version 1.6, 2000/06/27 18:28:49
|
Line 32 extern int Current_line[MAX_OPEN
|
Line 32 extern int Current_line[MAX_OPEN
|
extern int Func_idx; |
extern int Func_idx; |
extern Symbol FuncStack[MAX_FUNC_NEST]; |
extern Symbol FuncStack[MAX_FUNC_NEST]; |
|
|
|
#ifdef TTH |
|
extern int textohtmldyn(char*,char**,char**,int); |
|
char *tth_err; |
|
#endif |
|
|
/* --------------------------------------------------------------------------- */ |
/* --------------------------------------------------------------------------- */ |
int |
int |
match_function(func, argc) char *func; int argc; |
match_function(func, argc) char *func; int argc; |
Line 43 match_function(func, argc) char *func; i
|
Line 48 match_function(func, argc) char *func; i
|
if( !strcmp(func,"random_poisson") ) return ((argc==4)? RANDOM_POISSON_F : MIS_ARG_COUNT); |
if( !strcmp(func,"random_poisson") ) return ((argc==4)? RANDOM_POISSON_F : MIS_ARG_COUNT); |
if( !strcmp(func,"random_exponential") ) return ((argc==4)? RANDOM_EXPONENTIAL_F : MIS_ARG_COUNT); |
if( !strcmp(func,"random_exponential") ) return ((argc==4)? RANDOM_EXPONENTIAL_F : MIS_ARG_COUNT); |
if( !strcmp(func,"random_chi") ) return ((argc==4)? RANDOM_CHI_F : MIS_ARG_COUNT); |
if( !strcmp(func,"random_chi") ) return ((argc==4)? RANDOM_CHI_F : MIS_ARG_COUNT); |
if( !strcmp(func,"random_noncentral_chi") ) return ((argc==4)? RANDOM_NONCENTRAL_CHI_F : MIS_ARG_COUNT); |
if( !strcmp(func,"random_noncentral_chi") ) return ((argc==5)? RANDOM_NONCENTRAL_CHI_F : MIS_ARG_COUNT); |
if( !strcmp(func,"choose") ) return (CHOOSE_F); |
if( !strcmp(func,"choose") ) return (CHOOSE_F); |
if( !strcmp(func,"tex") ) return (((argc==2)? TEX_F: MIS_ARG_COUNT)); |
if( !strcmp(func,"tex") ) return (((argc==2)? TEX_F: MIS_ARG_COUNT)); |
if( !strcmp(func,"var_in_tex") ) return (VAR_IN_TEX_F); |
if( !strcmp(func,"var_in_tex") ) return (VAR_IN_TEX_F); |
Line 784 ArgNode_t *argp;
|
Line 789 ArgNode_t *argp;
|
case RANDOM_NORMAL_F: |
case RANDOM_NORMAL_F: |
case RANDOM_BETA_F: |
case RANDOM_BETA_F: |
case RANDOM_GAMMA_F: /* two-parameter functions */ |
case RANDOM_GAMMA_F: /* two-parameter functions */ |
|
case RANDOM_NONCENTRAL_CHI_F: |
{ errCode = 0; |
{ errCode = 0; |
switch( FIRST_ARGTYPE(argp) ) { /* parameter two */ |
switch( FIRST_ARGTYPE(argp) ) { /* parameter two */ |
case I_VAR: case I_CONSTANT: |
case I_VAR: case I_CONSTANT: |
Line 875 ArgNode_t *argp;
|
Line 881 ArgNode_t *argp;
|
break; |
break; |
case IDENTIFIER: |
case IDENTIFIER: |
tmp_int = free_array(FIFTH_ARGNAME(argp)); |
tmp_int = free_array(FIFTH_ARGNAME(argp)); |
r_p = gen_random_by_selector(FIFTH_ARGSTR(argp),sel,tmp_str,item_cnt,para1,para2); |
r_p = gen_random_by_selector(FIFTH_ARGNAME(argp),sel,tmp_str,item_cnt,para1,para2); |
capa_mfree((char *)resultp); |
capa_mfree((char *)resultp); |
resultp = r_p; |
resultp = r_p; |
break; |
break; |
Line 889 ArgNode_t *argp;
|
Line 895 ArgNode_t *argp;
|
break; |
break; |
case RANDOM_POISSON_F: |
case RANDOM_POISSON_F: |
case RANDOM_EXPONENTIAL_F: |
case RANDOM_EXPONENTIAL_F: |
case RANDOM_CHI_F: |
case RANDOM_CHI_F: /* one parameter functions */ |
case RANDOM_NONCENTRAL_CHI_F: /* one parameter functions */ |
|
{ errCode = 0; |
{ errCode = 0; |
switch( FIRST_ARGTYPE(argp) ) { /* parameter one */ |
switch( FIRST_ARGTYPE(argp) ) { /* parameter one */ |
case I_VAR: case I_CONSTANT: |
case I_VAR: case I_CONSTANT: |
para2 = (float)FIRST_ARGINT(argp); |
para1 = (float)FIRST_ARGINT(argp); |
break; |
break; |
case R_VAR: case R_CONSTANT: |
case R_VAR: case R_CONSTANT: |
para2 = (float)FIRST_ARGREAL(argp); |
para1 = (float)FIRST_ARGREAL(argp); |
break; |
break; |
case S_VAR: case S_CONSTANT: |
case S_VAR: case S_CONSTANT: |
case IDENTIFIER: |
case IDENTIFIER: |
Line 965 ArgNode_t *argp;
|
Line 970 ArgNode_t *argp;
|
break; |
break; |
case IDENTIFIER: |
case IDENTIFIER: |
tmp_int = free_array(FOURTH_ARGNAME(argp)); |
tmp_int = free_array(FOURTH_ARGNAME(argp)); |
r_p = gen_random_by_selector(FOURTH_ARGSTR(argp),sel,tmp_str,item_cnt,para1,para2); |
r_p = gen_random_by_selector(FOURTH_ARGNAME(argp),sel,tmp_str,item_cnt,para1,para2); |
capa_mfree((char *)resultp); |
capa_mfree((char *)resultp); |
resultp = r_p; |
resultp = r_p; |
break; |
break; |
Line 1269 ArgNode_t *argp;
|
Line 1274 ArgNode_t *argp;
|
} |
} |
break; |
break; |
case TEX_F: { if (Parsemode_f != TeX_MODE) { |
case TEX_F: { if (Parsemode_f != TeX_MODE) { |
|
#ifdef TTH |
|
#define CHARLEN 1024*1024 |
|
{ |
|
char *html; |
|
if ( (Parsemode_f==HTML_MODE) && |
|
((SECOND_ARGTYPE(argp) == S_VAR) || |
|
(SECOND_ARGTYPE(argp) == S_CONSTANT)) |
|
) { |
|
printf("Hi There %s\n",SECOND_ARGSTR(argp)); |
|
resultp->s_type = SECOND_ARGTYPE(argp); |
|
if(tth_err) { free(tth_err); tth_err=NULL; } |
|
textohtmldyn(SECOND_ARGSTR(argp),&html,&tth_err,CHARLEN); |
|
if(html) { |
|
resultp->s_str=strsave(html); |
|
capa_mfree(html); |
|
} else { |
|
resultp->s_str=strsave(""); |
|
} |
|
break; |
|
} |
|
} |
|
#undef CHARLEN |
|
#endif |
resultp->s_type = FIRST_ARGTYPE(argp); |
resultp->s_type = FIRST_ARGTYPE(argp); |
switch(FIRST_ARGTYPE(argp)) { |
switch(FIRST_ARGTYPE(argp)) { |
case I_VAR: |
case I_VAR: |