55int main(
int argc,
char **argv)
59 const char *outfilename =
NULL, *infilename =
NULL;
61 const char *prompt =
"=> ";
62 int count = 0, echo = 0;
67 if (!av_dynarray2_add((void **)&buf, &buf_size, 1, NULL)) { \
68 av_log(NULL, AV_LOG_ERROR, \
69 "Memory allocation problem occurred\n"); \
75 while ((
c =
getopt(argc, argv,
"ehi:o:p:")) != -1) {
97 if (!infilename || !strcmp(infilename,
"-")) {
101 infile = fopen(infilename,
"r");
104 fprintf(stderr,
"Impossible to open input file '%s': %s\n", infilename, strerror(errno));
108 if (!outfilename || !strcmp(outfilename,
"-")) {
109 outfilename =
"stdout";
112 outfile = fopen(outfilename,
"w");
115 fprintf(stderr,
"Impossible to open output file '%s': %s\n", outfilename, strerror(errno));
119 while ((
c = fgetc(infile)) != EOF) {
130 if (ret >= 0) fprintf(
outfile,
"%s%f\n", prompt, d);
135 if (count >= buf_size-1)
int av_expr_parse_and_eval(double *d, const char *s, const char *const *const_names, const double *const_values, const char *const *func1_names, double(*const *funcs1)(void *, double), const char *const *func2_names, double(*const *funcs2)(void *, double, double), void *opaque, int log_offset, void *log_ctx)
Parse and evaluate an expression.