|
|
@ -47,12 +47,12 @@ |
|
|
|
typedef struct Parser{ |
|
|
|
typedef struct Parser{ |
|
|
|
int stack_index; |
|
|
|
int stack_index; |
|
|
|
char *s; |
|
|
|
char *s; |
|
|
|
double *const_value; |
|
|
|
const double *const_value; |
|
|
|
const char **const_name; // NULL terminated
|
|
|
|
const char * const *const_name; // NULL terminated
|
|
|
|
double (**func1)(void *, double a); // NULL terminated
|
|
|
|
double (**func1)(void *, double a); // NULL terminated
|
|
|
|
const char **func1_name; // NULL terminated
|
|
|
|
const char **func1_name; // NULL terminated
|
|
|
|
double (**func2)(void *, double a, double b); // NULL terminated
|
|
|
|
double (**func2)(void *, double a, double b); // NULL terminated
|
|
|
|
char **func2_name; // NULL terminated
|
|
|
|
const char **func2_name; // NULL terminated
|
|
|
|
void *opaque; |
|
|
|
void *opaque; |
|
|
|
const char **error; |
|
|
|
const char **error; |
|
|
|
#define VARS 10 |
|
|
|
#define VARS 10 |
|
|
@ -375,9 +375,9 @@ static int verify_expr(AVEvalExpr * e) { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
AVEvalExpr * ff_parse(const char *s, const char **const_name, |
|
|
|
AVEvalExpr * ff_parse(const char *s, const char * const *const_name, |
|
|
|
double (**func1)(void *, double), const char **func1_name, |
|
|
|
double (**func1)(void *, double), const char **func1_name, |
|
|
|
double (**func2)(void *, double, double), char **func2_name, |
|
|
|
double (**func2)(void *, double, double), const char **func2_name, |
|
|
|
const char **error){ |
|
|
|
const char **error){ |
|
|
|
Parser p; |
|
|
|
Parser p; |
|
|
|
AVEvalExpr * e; |
|
|
|
AVEvalExpr * e; |
|
|
@ -404,7 +404,7 @@ AVEvalExpr * ff_parse(const char *s, const char **const_name, |
|
|
|
return e; |
|
|
|
return e; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
double ff_parse_eval(AVEvalExpr * e, double *const_value, void *opaque) { |
|
|
|
double ff_parse_eval(AVEvalExpr * e, const double *const_value, void *opaque) { |
|
|
|
Parser p; |
|
|
|
Parser p; |
|
|
|
|
|
|
|
|
|
|
|
p.const_value= const_value; |
|
|
|
p.const_value= const_value; |
|
|
@ -412,9 +412,9 @@ double ff_parse_eval(AVEvalExpr * e, double *const_value, void *opaque) { |
|
|
|
return eval_expr(&p, e); |
|
|
|
return eval_expr(&p, e); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
double ff_eval2(const char *s, double *const_value, const char **const_name, |
|
|
|
double ff_eval2(const char *s, const double *const_value, const char * const *const_name, |
|
|
|
double (**func1)(void *, double), const char **func1_name, |
|
|
|
double (**func1)(void *, double), const char **func1_name, |
|
|
|
double (**func2)(void *, double, double), char **func2_name, |
|
|
|
double (**func2)(void *, double, double), const char **func2_name, |
|
|
|
void *opaque, const char **error){ |
|
|
|
void *opaque, const char **error){ |
|
|
|
AVEvalExpr * e = ff_parse(s, const_name, func1, func1_name, func2, func2_name, error); |
|
|
|
AVEvalExpr * e = ff_parse(s, const_name, func1, func1_name, func2, func2_name, error); |
|
|
|
double d; |
|
|
|
double d; |
|
|
|