Initial WebM release
[profile/ivi/libvpx.git] / args.h
1 /*
2  *  Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
3  *
4  *  Use of this source code is governed by a BSD-style license and patent
5  *  grant that can be found in the LICENSE file in the root of the source
6  *  tree. All contributing project authors may be found in the AUTHORS
7  *  file in the root of the source tree.
8  */
9
10
11 #ifndef ARGS_H
12 #define ARGS_H
13 #include <stdio.h>
14
15 struct arg
16 {
17     char                 **argv;
18     const char            *name;
19     const char            *val;
20     unsigned int           argv_step;
21     const struct arg_def  *def;
22 };
23
24 typedef struct arg_def
25 {
26     const char *short_name;
27     const char *long_name;
28     int         has_val;
29     const char *desc;
30 } arg_def_t;
31 #define ARG_DEF(s,l,v,d) {s,l,v,d}
32 #define ARG_DEF_LIST_END {0}
33
34 struct arg arg_init(char **argv);
35 int arg_match(struct arg *arg_, const struct arg_def *def, char **argv);
36 const char *arg_next(struct arg *arg);
37 void arg_show_usage(FILE *fp, const struct arg_def *const *defs);
38 char **argv_dup(int argc, const char **argv);
39
40 unsigned int arg_parse_uint(const struct arg *arg);
41 int arg_parse_int(const struct arg *arg);
42 struct vpx_rational arg_parse_rational(const struct arg *arg);
43 #endif