[BACK]Return to ox_eval.c CVS log [TXT][DIR] Up to [local] / OpenXM / src / ox_gsl

Diff for /OpenXM/src/ox_gsl/ox_eval.c between version 1.2 and 1.3

version 1.2, 2018/04/05 05:53:52 version 1.3, 2018/04/05 13:02:39
Line 1 
Line 1 
 /* $OpenXM: OpenXM/src/ox_gsl/ox_eval.c,v 1.1 2018/04/03 12:09:46 ohara Exp $ */  /* $OpenXM: OpenXM/src/ox_gsl/ox_eval.c,v 1.2 2018/04/05 05:53:52 ohara Exp $ */
   
 #include <stdio.h>  #include <stdio.h>
 #include <stdlib.h>  #include <stdlib.h>
   #include <stdarg.h>
 #include <string.h>  #include <string.h>
 #include <math.h>  #include <math.h>
 #include "ox_toolkit.h"  #include "ox_toolkit.h"
Line 10 
Line 11 
 Usage:  Usage:
   
 double d;  double d;
 init_dic();  replace(3,"x",1.25,"y",-2.0, "z", 2.1);
 register_entry("x",1.25);  
 register_entry("y",2.1);  
 if(eval_cmo(your_cmo_tree,&d)==0) goto_error();  if(eval_cmo(your_cmo_tree,&d)==0) goto_error();
 */  */
   
Line 22  if(eval_cmo(your_cmo_tree,&d)==0) goto_error();
Line 21  if(eval_cmo(your_cmo_tree,&d)==0) goto_error();
 #define FAILED  0  #define FAILED  0
 #define SUCCEED 1  #define SUCCEED 1
   
   void replace(int n, ...);
   void replace2(int n, char *s[], double v[]);
 int eval_cmo(cmo *c, double *retval);  int eval_cmo(cmo *c, double *retval);
   
 static double op_add(double x,double y)  static double op_add(double x,double y)
Line 106  void init_dic()
Line 107  void init_dic()
     }      }
     local_dic_counter=0;      local_dic_counter=0;
     memset(local_dic, 0, sizeof(entry)*LOCAL_DIC_SIZE);      memset(local_dic, 0, sizeof(entry)*LOCAL_DIC_SIZE);
   }
   
   void replace(int n, ...)
   {
       char *s;
       double d;
       va_list ap;
       va_start(ap,n);
       for(init_dic(); n>0; n--) {
           s = va_arg(ap, char *);
           d = va_arg(ap, double);
           register_entry(s,d);
       }
       va_end(ap);
   }
   
   void replace2(int n, char *s[], double v[])
   {
       int i;
       init_dic();
       for(i=0; i<n; i++) {
           register_entry(s[i],v[i]);
       }
 }  }
   
 static entry *find_entry(cmo *node, entry *dic)  static entry *find_entry(cmo *node, entry *dic)

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>