2 * This file is part of MPlayer.
4 * MPlayer is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * MPlayer is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License along
15 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 #ifndef MPLAYER_SUBOPT_HELPER_H
20 #define MPLAYER_SUBOPT_HELPER_H
23 * \file subopt-helper.h
25 * \brief Datatype and functions declarations for usage
26 * of the suboption parser.
30 #define OPT_ARG_BOOL 0
33 #define OPT_ARG_MSTRZ 3 ///< A malloced, zero terminated string, use free()!
34 #define OPT_ARG_FLOAT 4
36 typedef int (*opt_test_f
)(void *);
38 /** simple structure for defining the option name, type and storage location */
41 const char * name
; ///< string that identifies the option
42 int type
; ///< option type as defined in subopt-helper.h
43 void * valp
; ///< pointer to the mem where the value should be stored
44 opt_test_f test
; ///< argument test func ( optional )
47 /** parses the string for the options specified in opt */
48 int subopt_parse( char const * const str
, const opt_t
* opts
);
51 /*------------------ arg specific types and declaration -------------------*/
52 typedef struct strarg_s
54 int len
; ///< length of the string determined by the parser
55 char const * str
; ///< pointer to position inside the parse string
59 int int_non_neg(void *iptr
);
60 int int_pos(void *iptr
);
62 int strargcmp(strarg_t
*arg
, const char *str
);
63 int strargcasecmp(strarg_t
*arg
, char *str
);
65 #endif /* MPLAYER_SUBOPT_HELPER_H */