Mercurial > mplayer.hg
annotate subopt-helper.h @ 30689:ebe42a93c6c3
Fix silly type of guiGetEvent argument to use void * instead of char * and
get rid of some of the insane amount of casts necessary to hide the utter
idiocy of the type used before.
author | reimar |
---|---|
date | Thu, 25 Feb 2010 21:27:22 +0000 |
parents | c1a3f1bbba26 |
children | 08a90b0e44e1 |
rev | line source |
---|---|
30429
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
30122
diff
changeset
|
1 /* |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
30122
diff
changeset
|
2 * This file is part of MPlayer. |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
30122
diff
changeset
|
3 * |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
30122
diff
changeset
|
4 * MPlayer is free software; you can redistribute it and/or modify |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
30122
diff
changeset
|
5 * it under the terms of the GNU General Public License as published by |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
30122
diff
changeset
|
6 * the Free Software Foundation; either version 2 of the License, or |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
30122
diff
changeset
|
7 * (at your option) any later version. |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
30122
diff
changeset
|
8 * |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
30122
diff
changeset
|
9 * MPlayer is distributed in the hope that it will be useful, |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
30122
diff
changeset
|
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
30122
diff
changeset
|
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
30122
diff
changeset
|
12 * GNU General Public License for more details. |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
30122
diff
changeset
|
13 * |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
30122
diff
changeset
|
14 * You should have received a copy of the GNU General Public License along |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
30122
diff
changeset
|
15 * with MPlayer; if not, write to the Free Software Foundation, Inc., |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
30122
diff
changeset
|
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
30122
diff
changeset
|
17 */ |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
30122
diff
changeset
|
18 |
26029 | 19 #ifndef MPLAYER_SUBOPT_HELPER_H |
20 #define MPLAYER_SUBOPT_HELPER_H | |
14281 | 21 |
22 /** | |
23 * \file subopt-helper.h | |
24 * | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28827
diff
changeset
|
25 * \brief Datatype and functions declarations for usage |
14281 | 26 * of the suboption parser. |
27 * | |
28 */ | |
29 | |
30 #define OPT_ARG_BOOL 0 | |
31 #define OPT_ARG_INT 1 | |
32 #define OPT_ARG_STR 2 | |
14538
00c3c4111017
New suboption type: malloc'ed, zero terminated string
reimar
parents:
14285
diff
changeset
|
33 #define OPT_ARG_MSTRZ 3 ///< A malloced, zero terminated string, use free()! |
16720 | 34 #define OPT_ARG_FLOAT 4 |
14281 | 35 |
14285 | 36 typedef int (*opt_test_f)(void *); |
37 | |
14281 | 38 /** simple structure for defining the option name, type and storage location */ |
39 typedef struct opt_s | |
40 { | |
19194
5949a654e2d4
marks some read-only char* inside structs as const, patch by Stefan Huehner, stefan At huehner-org
reynaldo
parents:
19104
diff
changeset
|
41 const char * name; ///< string that identifies the option |
14281 | 42 int type; ///< option type as defined in subopt-helper.h |
43 void * valp; ///< pointer to the mem where the value should be stored | |
14285 | 44 opt_test_f test; ///< argument test func ( optional ) |
14281 | 45 } opt_t; |
46 | |
47 /** parses the string for the options specified in opt */ | |
28827
2b021e3e1000
Get rid of the "set" member of the subopt-parser struct, it made
reimar
parents:
26029
diff
changeset
|
48 int subopt_parse( char const * const str, const opt_t * opts ); |
14281 | 49 |
50 | |
51 /*------------------ arg specific types and declaration -------------------*/ | |
52 typedef struct strarg_s | |
53 { | |
14538
00c3c4111017
New suboption type: malloc'ed, zero terminated string
reimar
parents:
14285
diff
changeset
|
54 int len; ///< length of the string determined by the parser |
14281 | 55 char const * str; ///< pointer to position inside the parse string |
56 } strarg_t; | |
57 | |
14736 | 58 |
30122
1772a5171ac7
Fix function declarations to avoid casting function pointers.
reimar
parents:
29263
diff
changeset
|
59 int int_non_neg(void *iptr); |
1772a5171ac7
Fix function declarations to avoid casting function pointers.
reimar
parents:
29263
diff
changeset
|
60 int int_pos(void *iptr); |
14736 | 61 |
19104
2ec2301183cd
marks several read-only string parameters which aren't modified inside the called function as const. Patch by Stefan Huehner, stefan AT huehner-org
reynaldo
parents:
16720
diff
changeset
|
62 int strargcmp(strarg_t *arg, const char *str); |
15734
7e4fa8fc255c
helper functions for comparing strarg_t "strings".
reimar
parents:
14736
diff
changeset
|
63 int strargcasecmp(strarg_t *arg, char *str); |
7e4fa8fc255c
helper functions for comparing strarg_t "strings".
reimar
parents:
14736
diff
changeset
|
64 |
26029 | 65 #endif /* MPLAYER_SUBOPT_HELPER_H */ |