comparison eval.h @ 11739:ceffa0ca7596 libavcodec

Change the order of parameters for ff_eval_expr() and ff_parse_and_eval_expr(), place the names for constants/functions before the corresponding values. This looks more readable, as the user is expected to know the names before the values.
author stefano
date Sun, 16 May 2010 23:00:22 +0000
parents 7dd2a45249a9
children c6368258b694
comparison
equal deleted inserted replaced
11738:9bfef228a117 11739:ceffa0ca7596
31 /** 31 /**
32 * Parses and evaluates an expression. 32 * Parses and evaluates an expression.
33 * Note, this is significantly slower than ff_eval_expr(). 33 * Note, this is significantly slower than ff_eval_expr().
34 * 34 *
35 * @param s expression as a zero terminated string for example "1+2^3+5*5+sin(2/3)" 35 * @param s expression as a zero terminated string for example "1+2^3+5*5+sin(2/3)"
36 * @param const_name NULL terminated array of zero terminated strings of constant identifers for example {"PI", "E", 0}
37 * @param const_value a zero terminated array of values for the identifers from const_name
38 * @param func1_name NULL terminated array of zero terminated strings of func1 identifers
36 * @param func1 NULL terminated array of function pointers for functions which take 1 argument 39 * @param func1 NULL terminated array of function pointers for functions which take 1 argument
40 * @param func2_name NULL terminated array of zero terminated strings of func2 identifers
37 * @param func2 NULL terminated array of function pointers for functions which take 2 arguments 41 * @param func2 NULL terminated array of function pointers for functions which take 2 arguments
38 * @param const_name NULL terminated array of zero terminated strings of constant identifers for example {"PI", "E", 0}
39 * @param func1_name NULL terminated array of zero terminated strings of func1 identifers
40 * @param func2_name NULL terminated array of zero terminated strings of func2 identifers
41 * @param error pointer to a char* which is set to an error message if something goes wrong 42 * @param error pointer to a char* which is set to an error message if something goes wrong
42 * @param const_value a zero terminated array of values for the identifers from const_name
43 * @param opaque a pointer which will be passed to all functions from func1 and func2 43 * @param opaque a pointer which will be passed to all functions from func1 and func2
44 * @return the value of the expression 44 * @return the value of the expression
45 */ 45 */
46 double ff_parse_and_eval_expr(const char *s, const double *const_value, const char * const *const_name, 46 double ff_parse_and_eval_expr(const char *s,
47 double (* const *func1)(void *, double), const char * const *func1_name, 47 const char * const *const_name, const double *const_value,
48 double (* const *func2)(void *, double, double), const char * const *func2_name, 48 const char * const *func1_name, double (* const *func1)(void *, double),
49 const char * const *func2_name, double (* const *func2)(void *, double, double),
49 void *opaque, const char **error); 50 void *opaque, const char **error);
50 51
51 /** 52 /**
52 * Parses an expression. 53 * Parses an expression.
53 * 54 *
54 * @param s expression as a zero terminated string for example "1+2^3+5*5+sin(2/3)" 55 * @param s expression as a zero terminated string for example "1+2^3+5*5+sin(2/3)"
55 * @param func1 NULL terminated array of function pointers for functions which take 1 argument
56 * @param func2 NULL terminated array of function pointers for functions which take 2 arguments
57 * @param const_name NULL terminated array of zero terminated strings of constant identifers for example {"PI", "E", 0} 56 * @param const_name NULL terminated array of zero terminated strings of constant identifers for example {"PI", "E", 0}
58 * @param func1_name NULL terminated array of zero terminated strings of func1 identifers 57 * @param func1_name NULL terminated array of zero terminated strings of func1 identifers
58 * @param func1 NULL terminated array of function pointers for functions which take 1 argument
59 * @param func2_name NULL terminated array of zero terminated strings of func2 identifers 59 * @param func2_name NULL terminated array of zero terminated strings of func2 identifers
60 * @param func2 NULL terminated array of function pointers for functions which take 2 arguments
60 * @param error pointer to a char* which is set to an error message if something goes wrong 61 * @param error pointer to a char* which is set to an error message if something goes wrong
61 * @return AVExpr which must be freed with ff_free_expr() by the user when it is not needed anymore 62 * @return AVExpr which must be freed with ff_free_expr() by the user when it is not needed anymore
62 * NULL if anything went wrong 63 * NULL if anything went wrong
63 */ 64 */
64 AVExpr *ff_parse_expr(const char *s, const char * const *const_name, 65 AVExpr *ff_parse_expr(const char *s,
65 double (* const *func1)(void *, double), const char * const *func1_name, 66 const char * const *const_name,
66 double (* const *func2)(void *, double, double), const char * const *func2_name, 67 const char * const *func1_name, double (* const *func1)(void *, double),
68 const char * const *func2_name, double (* const *func2)(void *, double, double),
67 const char **error); 69 const char **error);
68 70
69 /** 71 /**
70 * Evaluates a previously parsed expression. 72 * Evaluates a previously parsed expression.
71 * 73 *