annotate m_option.c @ 8695:e74e46ba03cc

lavc 4649
author michael
date Wed, 01 Jan 2003 14:39:09 +0000
parents 7a7980b874f5
children d3b750570887
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8164
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
1
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
2 #include "config.h"
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
3
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
4 #ifdef NEW_CONFIG
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
5
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
6 #include <stdlib.h>
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
7 #include <string.h>
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
8 #include <math.h>
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
9 #include <stdio.h>
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
10 #include <stdarg.h>
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
11 #include <inttypes.h>
8262
103a2758f9c5 FreeBSD fix
nexus
parents: 8168
diff changeset
12 #include <unistd.h>
8164
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
13
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
14 #include "m_option.h"
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
15 //#include "m_config.h"
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
16 #include "mp_msg.h"
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
17
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
18 // Default function that just do a memcpy
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
19
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
20 static void copy_opt(m_option_t* opt,void* dst,void* src) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
21 if(dst && src)
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
22 memcpy(dst,src,opt->type->size);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
23 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
24
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
25 // Helper for the print funcs (from man printf)
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
26 static char* dup_printf(const char *fmt, ...) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
27 /* Guess we need no more than 50 bytes. */
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
28 int n, size = 50;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
29 char *p;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
30 va_list ap;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
31 if ((p = malloc (size)) == NULL)
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
32 return NULL;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
33 while (1) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
34 /* Try to print in the allocated space. */
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
35 va_start(ap, fmt);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
36 n = vsnprintf (p, size, fmt, ap);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
37 va_end(ap);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
38 /* If that worked, return the string. */
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
39 if (n > -1 && n < size)
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
40 return p;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
41 /* Else try again with more space. */
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
42 if (n > -1) /* glibc 2.1 */
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
43 size = n+1; /* precisely what is needed */
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
44 else /* glibc 2.0 */
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
45 size *= 2; /* twice the old size */
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
46 if ((p = realloc (p, size)) == NULL)
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
47 return NULL;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
48 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
49 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
50
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
51
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
52 // Flag
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
53
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
54 #define VAL(x) (*(int*)(x))
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
55
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
56 static int parse_flag(m_option_t* opt,char *name, char *param, void* dst, int src) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
57 if (src == M_CONFIG_FILE) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
58 if (!strcasecmp(param, "yes") || /* any other language? */
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
59 !strcasecmp(param, "ja") ||
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
60 !strcasecmp(param, "si") ||
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
61 !strcasecmp(param, "igen") ||
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
62 !strcasecmp(param, "y") ||
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
63 !strcasecmp(param, "j") ||
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
64 !strcasecmp(param, "i") ||
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
65 !strcmp(param, "1")) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
66 if(dst) VAL(dst) = opt->max;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
67 } else if (!strcasecmp(param, "no") ||
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
68 !strcasecmp(param, "nein") ||
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
69 !strcasecmp(param, "nicht") ||
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
70 !strcasecmp(param, "nem") ||
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
71 !strcasecmp(param, "n") ||
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
72 !strcmp(param, "0")) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
73 if(dst) VAL(dst) = opt->min;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
74 } else {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
75 mp_msg(MSGT_CFGPARSER, MSGL_ERR, "invalid parameter for %s flag: %s\n",name, param);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
76 return M_OPT_INVALID;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
77 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
78 return 1;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
79 } else {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
80 if(dst) VAL(dst) = opt->max;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
81 return 0;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
82 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
83 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
84
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
85 static char* print_flag(m_option_t* opt, void* val) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
86 if(VAL(val) == opt->min)
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
87 return strdup("no");
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
88 else
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
89 return strdup("yes");
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
90 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
91
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
92 m_option_type_t m_option_type_flag = {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
93 "Flag",
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
94 "need yes or no in config files",
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
95 sizeof(int),
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
96 0,
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
97 parse_flag,
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
98 print_flag,
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
99 copy_opt,
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
100 copy_opt,
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
101 NULL,
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
102 NULL
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
103 };
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
104
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
105 // Integer
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
106
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
107 static int parse_int(m_option_t* opt,char *name, char *param, void* dst, int src) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
108 long tmp_int;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
109 char *endptr;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
110 src = 0;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
111
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
112 if (param == NULL)
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
113 return M_OPT_MISSING_PARAM;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
114
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
115 tmp_int = strtol(param, &endptr, 0);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
116 if (*endptr) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
117 mp_msg(MSGT_CFGPARSER, MSGL_ERR, "The %s option must be an integer: %s\n",name, param);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
118 return M_OPT_INVALID;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
119 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
120
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
121 if ((opt->flags & M_OPT_MIN) && (tmp_int < opt->min)) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
122 mp_msg(MSGT_CFGPARSER, MSGL_ERR, "The %s option must be >= %d: %s\n", name, (int) opt->min, param);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
123 return M_OPT_OUT_OF_RANGE;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
124 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
125
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
126 if ((opt->flags & M_OPT_MAX) && (tmp_int > opt->max)) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
127 mp_msg(MSGT_CFGPARSER, MSGL_ERR, "The %s option must be <= %d: %s\n",name, (int) opt->max, param);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
128 return M_OPT_OUT_OF_RANGE;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
129 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
130
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
131 if(dst) VAL(dst) = tmp_int;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
132
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
133 return 1;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
134 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
135
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
136 static char* print_int(m_option_t* opt, void* val) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
137 opt = NULL;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
138 return dup_printf("%d",VAL(val));
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
139 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
140
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
141 m_option_type_t m_option_type_int = {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
142 "Integer",
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
143 "",
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
144 sizeof(int),
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
145 0,
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
146 parse_int,
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
147 print_int,
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
148 copy_opt,
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
149 copy_opt,
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
150 NULL,
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
151 NULL
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
152 };
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
153
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
154 // Float
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
155
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
156 #undef VAL
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
157 #define VAL(x) (*(float*)(x))
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
158
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
159 static int parse_float(m_option_t* opt,char *name, char *param, void* dst, int src) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
160 float tmp_float;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
161 char* endptr;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
162 src = 0;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
163
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
164 if (param == NULL)
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
165 return M_OPT_MISSING_PARAM;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
166
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
167 tmp_float = strtod(param, &endptr);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
168
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
169 switch(*endptr) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
170 case ':':
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
171 case '/':
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
172 tmp_float /= strtod(endptr+1, &endptr);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
173 break;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
174 case '.':
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
175 case ',':
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
176 /* we also handle floats specified with
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
177 * non-locale decimal point ::atmos
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
178 */
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
179 if(tmp_float<0)
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
180 tmp_float -= 1.0/pow(10,strlen(endptr+1)) * strtod(endptr+1, &endptr);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
181 else
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
182 tmp_float += 1.0/pow(10,strlen(endptr+1)) * strtod(endptr+1, &endptr);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
183 break;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
184 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
185
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
186 if (*endptr) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
187 mp_msg(MSGT_CFGPARSER, MSGL_ERR, "The %s option must be a floating point "
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
188 "number or a ratio (numerator[:/]denominator): %s\n",name, param);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
189 return M_OPT_INVALID;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
190 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
191
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
192 if (opt->flags & M_OPT_MIN)
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
193 if (tmp_float < opt->min) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
194 mp_msg(MSGT_CFGPARSER, MSGL_ERR, "The %s option must be >= %f: %s\n", name, opt->min, param);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
195 return M_OPT_OUT_OF_RANGE;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
196 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
197
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
198 if (opt->flags & M_OPT_MAX)
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
199 if (tmp_float > opt->max) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
200 mp_msg(MSGT_CFGPARSER, MSGL_ERR, "The %s option must be <= %f: %s\n", name, opt->max, param);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
201 return M_OPT_OUT_OF_RANGE;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
202 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
203
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
204 if(dst) VAL(dst) = tmp_float;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
205 return 1;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
206 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
207
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
208 static char* print_float(m_option_t* opt, void* val) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
209 opt = NULL;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
210 return dup_printf("%f",VAL(val));
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
211 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
212
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
213 m_option_type_t m_option_type_float = {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
214 "Float",
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
215 "floating point number or ratio (numerator[:/]denominator)",
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
216 sizeof(float),
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
217 0,
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
218 parse_float,
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
219 print_float,
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
220 copy_opt,
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
221 copy_opt,
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
222 NULL,
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
223 NULL
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
224 };
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
225
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
226 ///////////// Position
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
227 #undef VAL
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
228 #define VAL(x) (*(off_t*)(x))
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
229
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
230 static int parse_position(m_option_t* opt,char *name, char *param, void* dst, int src) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
231 off_t tmp_off;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
232 char dummy;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
233
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
234 if (param == NULL)
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
235 return M_OPT_MISSING_PARAM;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
236 if (sscanf(param, sizeof(off_t) == sizeof(int) ?
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
237 "%d%c" : "%lld%c", &tmp_off, &dummy) != 1) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
238 mp_msg(MSGT_CFGPARSER, MSGL_ERR, "The %s option must be an integer: %s\n",opt->name,param);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
239 return M_OPT_INVALID;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
240 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
241
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
242 if (opt->flags & M_OPT_MIN)
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
243 if (tmp_off < opt->min) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
244 mp_msg(MSGT_CFGPARSER, MSGL_ERR,
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
245 (sizeof(off_t) == sizeof(int) ?
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
246 "The %s option must be >= %d: %s\n" :
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
247 "The %s option must be >= %lld: %s\n"),
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
248 (off_t) opt->min, param);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
249 return M_OPT_OUT_OF_RANGE;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
250 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
251
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
252 if (opt->flags & M_OPT_MAX)
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
253 if (tmp_off > opt->max) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
254 mp_msg(MSGT_CFGPARSER, MSGL_ERR,
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
255 (sizeof(off_t) == sizeof(int) ?
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
256 "The %s option must be <= %d: %s\n" :
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
257 "The %s option must be <= %lld: %s\n"),
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
258 (off_t) opt->max, param);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
259 return M_OPT_OUT_OF_RANGE;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
260 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
261
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
262 if(dst)
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
263 VAL(dst) = tmp_off;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
264 return 1;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
265 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
266
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
267 static char* print_position(m_option_t* opt, void* val) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
268 return dup_printf(sizeof(off_t) == sizeof(int) ? "%d" : "%lld",VAL(val));
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
269 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
270
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
271 m_option_type_t m_option_type_position = {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
272 "Position",
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
273 "Integer (off_t)",
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
274 sizeof(off_t),
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
275 0,
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
276 parse_position,
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
277 print_position,
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
278 copy_opt,
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
279 copy_opt,
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
280 NULL,
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
281 NULL
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
282 };
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
283
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
284
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
285 ///////////// String
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
286
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
287 #undef VAL
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
288 #define VAL(x) (*(char**)(x))
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
289
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
290 static int parse_str(m_option_t* opt,char *name, char *param, void* dst, int src) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
291
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
292
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
293 if (param == NULL)
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
294 return M_OPT_MISSING_PARAM;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
295
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
296 if ((opt->flags & M_OPT_MIN) && (strlen(param) < opt->min)) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
297 mp_msg(MSGT_CFGPARSER, MSGL_ERR, "parameter must be >= %d chars: %s\n",
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
298 (int) opt->min, param);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
299 return M_OPT_OUT_OF_RANGE;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
300 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
301
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
302 if ((opt->flags & M_OPT_MAX) && (strlen(param) > opt->max)) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
303 mp_msg(MSGT_CFGPARSER, MSGL_ERR, "parameter must be <= %d chars: %s\n",
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
304 (int) opt->max, param);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
305 return M_OPT_OUT_OF_RANGE;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
306 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
307
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
308 if(dst) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
309 if(VAL(dst))
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
310 free(VAL(dst));
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
311 VAL(dst) = strdup(param);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
312 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
313
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
314 return 1;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
315
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
316 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
317
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
318 static char* print_str(m_option_t* opt, void* val) {
8168
ff6a98628e6c Fix the Gui with NEW_CONFIG
albeu
parents: 8164
diff changeset
319 return (val && VAL(val) && strlen(VAL(val)) > 0) ? strdup(VAL(val)) : NULL;
8164
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
320 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
321
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
322 static void copy_str(m_option_t* opt,void* dst, void* src) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
323 if(dst && src) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
324 if(VAL(dst)) free(VAL(dst));
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
325 VAL(dst) = VAL(src) ? strdup(VAL(src)) : NULL;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
326 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
327 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
328
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
329 static void free_str(void* src) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
330 if(src && VAL(src)){
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
331 free(VAL(src));
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
332 VAL(src) = NULL;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
333 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
334 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
335
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
336 m_option_type_t m_option_type_string = {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
337 "String",
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
338 "",
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
339 sizeof(char*),
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
340 M_OPT_TYPE_DYNAMIC,
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
341 parse_str,
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
342 print_str,
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
343 copy_str,
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
344 copy_str,
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
345 copy_str,
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
346 free_str
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
347 };
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
348
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
349 //////////// String list
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
350
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
351 #define LIST_SEPARATOR ','
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
352 #undef VAL
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
353 #define VAL(x) (*(char***)(x))
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
354
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
355 #define OP_NONE 0
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
356 #define OP_ADD 1
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
357 #define OP_PRE 2
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
358 #define OP_DEL 3
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
359 #define OP_CLR 4
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
360
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
361 static void free_str_list(void* dst) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
362 char** d;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
363 int i;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
364
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
365 if(!dst || !VAL(dst)) return;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
366 d = VAL(dst);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
367
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
368
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
369 for(i = 0 ; d[i] != NULL ; i++)
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
370 free(d[i]);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
371 free(d);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
372 VAL(dst) = NULL;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
373 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
374
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
375 static int str_list_add(char** add, int n,void* dst,int pre) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
376 char** lst = VAL(dst);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
377 int ln;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
378
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
379 if(!dst) return M_OPT_PARSER_ERR;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
380 lst = VAL(dst);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
381
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
382 for(ln = 0 ; lst && lst[ln] ; ln++)
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
383 /**/;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
384
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
385 lst = realloc(lst,(n+ln+1)*sizeof(char*));
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
386
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
387 if(pre) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
388 memmove(&lst[n],lst,(ln+1)*sizeof(char*));
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
389 memcpy(lst,add,n*sizeof(char*));
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
390 } else
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
391 memcpy(&lst[ln],add,(n+1)*sizeof(char*));
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
392
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
393 free(add);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
394
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
395 VAL(dst) = lst;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
396
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
397 return 1;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
398 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
399
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
400 static int str_list_del(char** del, int n,void* dst) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
401 char **lst,*ep,**d;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
402 int i,ln,s;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
403 long idx;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
404
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
405 if(!dst) return M_OPT_PARSER_ERR;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
406 lst = VAL(dst);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
407
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
408 for(ln = 0 ; lst && lst[ln] ; ln++)
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
409 /**/;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
410 s = ln;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
411
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
412 for(i = 0 ; del[i] != NULL ; i++) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
413 idx = strtol(del[i], &ep, 0);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
414 if(*ep) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
415 mp_msg(MSGT_CFGPARSER, MSGL_ERR, "Invalid index: %s\n",del[i]);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
416 free(del[i]);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
417 continue;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
418 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
419 free(del[i]);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
420 if(idx < 0 || idx >= ln) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
421 mp_msg(MSGT_CFGPARSER, MSGL_ERR, "Index %d is out of range\n",idx);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
422 continue;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
423 } else if(!lst[idx])
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
424 continue;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
425 free(lst[idx]);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
426 lst[idx] = NULL;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
427 s--;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
428 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
429 free(del);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
430
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
431 if(s == 0) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
432 if(lst) free(lst);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
433 VAL(dst) = NULL;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
434 return 1;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
435 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
436
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
437 d = calloc(s+1,sizeof(char*));
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
438 for(i = 0, n = 0 ; i < ln ; i++) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
439 if(!lst[i]) continue;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
440 d[n] = lst[i];
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
441 n++;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
442 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
443 d[s] = NULL;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
444
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
445 if(lst) free(lst);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
446 VAL(dst) = d;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
447
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
448 return 1;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
449 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
450
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
451
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
452 static int parse_str_list(m_option_t* opt,char *name, char *param, void* dst, int src) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
453 int n = 0,len = strlen(opt->name);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
454 char *ptr = param, *last_ptr, **res;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
455 int op = OP_NONE;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
456
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
457 if(opt->name[len-1] == '*' && ((int)strlen(name) > len - 1)) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
458 char* n = &name[len-1];
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
459 if(strcasecmp(n,"-add") == 0)
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
460 op = OP_ADD;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
461 else if(strcasecmp(n,"-pre") == 0)
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
462 op = OP_PRE;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
463 else if(strcasecmp(n,"-del") == 0)
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
464 op = OP_DEL;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
465 else if(strcasecmp(n,"-clr") == 0)
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
466 op = OP_CLR;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
467 else
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
468 return M_OPT_UNKNOW;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
469 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
470
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
471 // Clear the list ??
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
472 if(op == OP_CLR) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
473 if(dst)
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
474 free_str_list(dst);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
475 return 0;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
476 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
477
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
478 // All other op need a param
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
479 if (param == NULL || strlen(param) == 0)
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
480 return M_OPT_MISSING_PARAM;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
481
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
482
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
483 while(ptr[0] != '\0') {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
484 last_ptr = ptr;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
485 ptr = strchr(ptr,LIST_SEPARATOR);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
486 if(!ptr) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
487 n++;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
488 break;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
489 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
490 ptr++;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
491 n++;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
492 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
493 if(n == 0)
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
494 return M_OPT_INVALID;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
495 if( ((opt->flags & M_OPT_MIN) && (n < opt->min)) ||
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
496 ((opt->flags & M_OPT_MAX) && (n > opt->max)) )
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
497 return M_OPT_OUT_OF_RANGE;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
498
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
499 if(!dst) return 1;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
500
8384
7a7980b874f5 fixed 'mplayer -nosound xxx' sig11 if configfile have string list options
arpi
parents: 8262
diff changeset
501 res = malloc((n+2)*sizeof(char*));
8164
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
502 ptr = param;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
503 n = 0;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
504
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
505 while(1) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
506 last_ptr = ptr;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
507 ptr = strchr(ptr,LIST_SEPARATOR);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
508 if(!ptr) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
509 res[n] = strdup(last_ptr);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
510 n++;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
511 break;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
512 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
513 len = ptr - last_ptr;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
514 res[n] = (char*)malloc(len + 1);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
515 if(len) strncpy(res[n],last_ptr,len);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
516 res[n][len] = '\0';
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
517 ptr++;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
518 n++;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
519 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
520 res[n] = NULL;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
521
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
522 switch(op) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
523 case OP_ADD:
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
524 return str_list_add(res,n,dst,0);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
525 case OP_PRE:
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
526 return str_list_add(res,n,dst,1);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
527 case OP_DEL:
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
528 return str_list_del(res,n,dst);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
529 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
530
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
531 if(VAL(dst))
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
532 free_str_list(dst);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
533 VAL(dst) = res;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
534
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
535 return 1;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
536 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
537
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
538 static void copy_str_list(m_option_t* opt,void* dst, void* src) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
539 int n;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
540 char **d,**s;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
541
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
542 if(!(dst && src)) return;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
543 s = VAL(src);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
544
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
545 if(VAL(dst))
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
546 free_str_list(dst);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
547
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
548 if(!s) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
549 VAL(dst) = NULL;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
550 return;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
551 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
552
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
553 for(n = 0 ; s[n] != NULL ; n++)
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
554 /* NOTHING */;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
555 d = (char**)malloc((n+1)*sizeof(char*));
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
556 for( ; n >= 0 ; n--)
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
557 d[n] = s[n] ? strdup(s[n]) : NULL;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
558
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
559 VAL(dst) = d;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
560 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
561
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
562 static char* print_str_list(m_option_t* opt, void* src) {
8168
ff6a98628e6c Fix the Gui with NEW_CONFIG
albeu
parents: 8164
diff changeset
563 char **lst = NULL;
ff6a98628e6c Fix the Gui with NEW_CONFIG
albeu
parents: 8164
diff changeset
564 char *ret = NULL,*last = NULL;
ff6a98628e6c Fix the Gui with NEW_CONFIG
albeu
parents: 8164
diff changeset
565 int i;
ff6a98628e6c Fix the Gui with NEW_CONFIG
albeu
parents: 8164
diff changeset
566
ff6a98628e6c Fix the Gui with NEW_CONFIG
albeu
parents: 8164
diff changeset
567 if(!(src && VAL(src))) return NULL;
ff6a98628e6c Fix the Gui with NEW_CONFIG
albeu
parents: 8164
diff changeset
568 lst = VAL(src);
ff6a98628e6c Fix the Gui with NEW_CONFIG
albeu
parents: 8164
diff changeset
569
ff6a98628e6c Fix the Gui with NEW_CONFIG
albeu
parents: 8164
diff changeset
570 for(i = 0 ; lst[i] ; i++) {
ff6a98628e6c Fix the Gui with NEW_CONFIG
albeu
parents: 8164
diff changeset
571 if(last) {
ff6a98628e6c Fix the Gui with NEW_CONFIG
albeu
parents: 8164
diff changeset
572 ret = dup_printf("%s,%s",last,lst[i]);
ff6a98628e6c Fix the Gui with NEW_CONFIG
albeu
parents: 8164
diff changeset
573 free(last);
ff6a98628e6c Fix the Gui with NEW_CONFIG
albeu
parents: 8164
diff changeset
574 } else
ff6a98628e6c Fix the Gui with NEW_CONFIG
albeu
parents: 8164
diff changeset
575 ret = strdup(lst[i]);
ff6a98628e6c Fix the Gui with NEW_CONFIG
albeu
parents: 8164
diff changeset
576 last = ret;
ff6a98628e6c Fix the Gui with NEW_CONFIG
albeu
parents: 8164
diff changeset
577 }
ff6a98628e6c Fix the Gui with NEW_CONFIG
albeu
parents: 8164
diff changeset
578 if(last && last != ret) free(last);
ff6a98628e6c Fix the Gui with NEW_CONFIG
albeu
parents: 8164
diff changeset
579 return ret;
8164
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
580 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
581
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
582 m_option_type_t m_option_type_string_list = {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
583 "String list",
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
584 "A list of string separated by ','\n"
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
585 "Option with name that finish by an * allow to use the following suffix : \n"
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
586 "\t-add : add the given parameters at the end of list\n"
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
587 "\t-pre : add the given parameters at the begining of list\n"
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
588 "\t-del : remove the entry at the given indexs\n"
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
589 "\t-clr : clear the list\n"
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
590 "e.g: -vop-add flip,mirror -vop-del 2,5\n",
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
591 sizeof(char**),
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
592 M_OPT_TYPE_DYNAMIC | M_OPT_TYPE_ALLOW_WILDCARD,
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
593 parse_str_list,
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
594 print_str_list,
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
595 copy_str_list,
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
596 copy_str_list,
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
597 copy_str_list,
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
598 free_str_list
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
599 };
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
600
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
601
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
602 /////////////////// Func based options
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
603
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
604 // A chained list to save the various calls for func_param and func_full
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
605 typedef struct m_func_save m_func_save_t;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
606 struct m_func_save {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
607 m_func_save_t* next;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
608 char* name;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
609 char* param;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
610 };
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
611
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
612 #undef VAL
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
613 #define VAL(x) (*(m_func_save_t**)(x))
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
614
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
615 static void free_func_pf(void* src) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
616 m_func_save_t *s,*n;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
617
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
618 if(!src) return;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
619
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
620 s = VAL(src);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
621
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
622 while(s) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
623 n = s->next;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
624 free(s->name);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
625 if(s->param) free(s->param);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
626 free(s);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
627 s = n;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
628 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
629 VAL(src) = NULL;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
630 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
631
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
632 // Parser for func_param and func_full
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
633 static int parse_func_pf(m_option_t* opt,char *name, char *param, void* dst, int src) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
634 m_func_save_t *s,*p;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
635
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
636 if(!dst)
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
637 return 1;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
638
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
639 s = (m_func_save_t*)calloc(1,sizeof(m_func_save_t));
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
640 s->name = strdup(name);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
641 s->param = param ? strdup(param) : NULL;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
642
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
643 p = VAL(dst);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
644 if(p) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
645 for( ; p->next != NULL ; p = p->next)
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
646 /**/;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
647 p->next = s;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
648 } else
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
649 VAL(dst) = s;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
650
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
651 return 1;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
652 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
653
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
654 static void copy_func_pf(m_option_t* opt,void* dst, void* src) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
655 m_func_save_t *d = NULL, *s,* last = NULL;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
656
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
657 if(!(dst && src)) return;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
658 s = VAL(src);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
659
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
660 if(VAL(dst))
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
661 free_func_pf(dst);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
662
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
663 while(s) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
664 d = (m_func_save_t*)malloc(sizeof(m_func_save_t));
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
665 d->name = strdup(s->name);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
666 d->param = s->param ? strdup(s->param) : NULL;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
667 if(last)
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
668 last->next = d;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
669 else
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
670 VAL(dst) = d;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
671 last = d;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
672 s = s->next;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
673 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
674
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
675
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
676 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
677
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
678 /////////////////// Func_param
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
679
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
680 static void set_func_param(m_option_t* opt, void* dst, void* src) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
681 m_func_save_t* s;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
682
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
683 if(!src) return;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
684 s = VAL(src);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
685
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
686 if(!s) return;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
687
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
688 // Revert if needed
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
689 if(opt->priv) ((m_opt_default_func_t)opt->priv)(opt,opt->name);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
690 for( ; s != NULL ; s = s->next)
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
691 ((m_opt_func_param_t) opt->p)(opt,s->param);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
692 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
693
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
694 m_option_type_t m_option_type_func_param = {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
695 "Func param",
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
696 "",
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
697 sizeof(m_func_save_t*),
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
698 M_OPT_TYPE_INDIRECT,
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
699 parse_func_pf,
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
700 NULL,
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
701 NULL, // Nothing to do on save
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
702 set_func_param,
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
703 copy_func_pf,
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
704 free_func_pf
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
705 };
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
706
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
707 /////////////////// Func_full
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
708
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
709 static void set_func_full(m_option_t* opt, void* dst, void* src) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
710 m_func_save_t* s;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
711
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
712 if(!src) return;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
713
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
714 for(s = VAL(src) ; s ; s = s->next) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
715 // Revert if needed
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
716 if(opt->priv) ((m_opt_default_func_t)opt->priv)(opt,s->name);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
717 ((m_opt_func_full_t) opt->p)(opt,s->name,s->param);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
718 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
719 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
720
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
721 m_option_type_t m_option_type_func_full = {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
722 "Func full",
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
723 "",
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
724 sizeof(m_func_save_t*),
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
725 M_OPT_TYPE_ALLOW_WILDCARD|M_OPT_TYPE_INDIRECT,
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
726 parse_func_pf,
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
727 NULL,
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
728 NULL, // Nothing to do on save
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
729 set_func_full,
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
730 copy_func_pf,
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
731 free_func_pf
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
732 };
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
733
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
734 /////////////// Func
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
735
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
736 #undef VAL
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
737 #define VAL(x) (*(int*)(x))
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
738
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
739 static int parse_func(m_option_t* opt,char *name, char *param, void* dst, int src) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
740 if(dst)
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
741 VAL(dst) += 1;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
742 return 0;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
743 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
744
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
745 static void set_func(m_option_t* opt,void* dst, void* src) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
746 int i;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
747 if(opt->priv) ((m_opt_default_func_t)opt->priv)(opt,opt->name);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
748 for(i = 0 ; i < VAL(src) ; i++)
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
749 ((m_opt_func_t) opt->p)(opt);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
750 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
751
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
752 m_option_type_t m_option_type_func = {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
753 "Func",
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
754 "",
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
755 sizeof(int),
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
756 M_OPT_TYPE_INDIRECT,
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
757 parse_func,
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
758 NULL,
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
759 NULL, // Nothing to do on save
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
760 set_func,
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
761 NULL,
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
762 NULL
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
763 };
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
764
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
765 /////////////////// Print
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
766
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
767 static int parse_print(m_option_t* opt,char *name, char *param, void* dst, int src) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
768 mp_msg(MSGT_CFGPARSER, MSGL_INFO, "%s", (char *) opt->p);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
769 if(opt->priv == NULL)
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
770 exit(1); // Call something else instead ??
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
771 return 1;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
772 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
773
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
774 m_option_type_t m_option_type_print = {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
775 "Print",
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
776 "",
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
777 0,
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
778 0,
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
779 parse_print,
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
780 NULL,
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
781 NULL,
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
782 NULL,
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
783 NULL,
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
784 NULL
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
785 };
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
786
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
787 /////////////////////// Subconfig
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
788 #undef VAL
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
789 #define VAL(x) (*(char***)(x))
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
790
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
791 static int parse_subconf(m_option_t* opt,char *name, char *param, void* dst, int src) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
792 char *subparam;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
793 char *subopt;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
794 int nr = 0;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
795 m_option_t *subopts;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
796 char *token;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
797 char *p;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
798 char** lst = NULL;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
799
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
800 if (param == NULL || strlen(param) == 0)
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
801 return M_OPT_MISSING_PARAM;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
802
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
803 subparam = malloc(strlen(param)+1);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
804 subopt = malloc(strlen(param)+1);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
805 p = strdup(param); // In case that param is a static string (cf man strtok)
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
806
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
807 subopts = opt->p;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
808
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
809 token = strtok(p, (char *)&(":"));
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
810 while(token)
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
811 {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
812 int sscanf_ret;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
813 /* clear out */
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
814 subopt[0] = subparam[0] = 0;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
815
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
816 sscanf_ret = sscanf(token, "%[^=]=%[^:]", subopt, subparam);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
817
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
818 mp_msg(MSGT_CFGPARSER, MSGL_DBG3, "token: '%s', subopt='%s', subparam='%s' (ret: %d)\n", token, subopt, subparam, sscanf_ret);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
819 switch(sscanf_ret)
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
820 {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
821 case 1:
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
822 subparam[0] = 0;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
823 case 2:
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
824 if(dst) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
825 lst = (char**)realloc(lst,2 * (nr+2) * sizeof(char*));
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
826 lst[2*nr] = strdup(subopt);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
827 lst[2*nr+1] = subparam[0] == 0 ? NULL : strdup(subparam);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
828 memset(&lst[2*(nr+1)],0,2*sizeof(char*));
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
829 nr++;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
830 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
831 break;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
832 default:
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
833 mp_msg(MSGT_CFGPARSER, MSGL_ERR, "Invalid subconfig argument! ('%s')\n", token);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
834 return M_OPT_INVALID;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
835 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
836 token = strtok(NULL, (char *)&(":"));
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
837 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
838
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
839 free(subparam);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
840 free(subopt);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
841 free(p);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
842 VAL(dst) = lst;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
843
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
844 return 1;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
845 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
846
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
847 m_option_type_t m_option_type_subconfig = {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
848 "Subconfig",
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
849 "The syntax is -option opt1=foo:flag:opt2=blah",
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
850 sizeof(int),
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
851 M_OPT_TYPE_HAS_CHILD,
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
852 parse_subconf,
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
853 NULL,
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
854 NULL,
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
855 NULL,
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
856 NULL,
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
857 NULL
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
858 };
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
859
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
860 #include "libmpcodecs/img_format.h"
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
861 // TODO : use an array so we parse/print easily
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
862
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
863 static int parse_imgfmt(m_option_t* opt,char *name, char *param, void* dst, int src) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
864 uint32_t fmt = 0;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
865
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
866 if (param == NULL || strlen(param) == 0)
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
867 return M_OPT_MISSING_PARAM;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
868
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
869 // From vf_format
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
870 if(!strcasecmp(param,"444p")) fmt=IMGFMT_444P; else
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
871 if(!strcasecmp(param,"422p")) fmt=IMGFMT_422P; else
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
872 if(!strcasecmp(param,"411p")) fmt=IMGFMT_411P; else
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
873 if(!strcasecmp(param,"yuy2")) fmt=IMGFMT_YUY2; else
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
874 if(!strcasecmp(param,"yv12")) fmt=IMGFMT_YV12; else
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
875 if(!strcasecmp(param,"i420")) fmt=IMGFMT_I420; else
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
876 if(!strcasecmp(param,"yvu9")) fmt=IMGFMT_YVU9; else
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
877 if(!strcasecmp(param,"if09")) fmt=IMGFMT_IF09; else
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
878 if(!strcasecmp(param,"iyuv")) fmt=IMGFMT_IYUV; else
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
879 if(!strcasecmp(param,"uyvy")) fmt=IMGFMT_UYVY; else
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
880 if(!strcasecmp(param,"bgr24")) fmt=IMGFMT_BGR24; else
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
881 if(!strcasecmp(param,"bgr32")) fmt=IMGFMT_BGR32; else
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
882 if(!strcasecmp(param,"bgr16")) fmt=IMGFMT_BGR16; else
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
883 if(!strcasecmp(param,"bgr15")) fmt=IMGFMT_BGR15; else
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
884 if(!strcasecmp(param,"bgr8")) fmt=IMGFMT_BGR8; else
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
885 if(!strcasecmp(param,"bgr4")) fmt=IMGFMT_BGR4; else
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
886 if(!strcasecmp(param,"bgr1")) fmt=IMGFMT_BGR1; else
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
887 if(!strcasecmp(param,"rgb24")) fmt=IMGFMT_RGB24; else
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
888 if(!strcasecmp(param,"rgb32")) fmt=IMGFMT_RGB32; else
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
889 if(!strcasecmp(param,"rgb16")) fmt=IMGFMT_RGB16; else
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
890 if(!strcasecmp(param,"rgb15")) fmt=IMGFMT_RGB15; else
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
891 if(!strcasecmp(param,"rgb8")) fmt=IMGFMT_RGB8; else
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
892 if(!strcasecmp(param,"rgb4")) fmt=IMGFMT_RGB4; else
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
893 if(!strcasecmp(param,"rgb1")) fmt=IMGFMT_RGB1; else {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
894 mp_msg(MSGT_CFGPARSER, MSGL_ERR, "Option %s: unknown format name: '%s'\n",param);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
895 return M_OPT_INVALID;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
896 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
897
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
898 if(dst)
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
899 *((uint32_t*)dst) = fmt;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
900
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
901 return 1;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
902 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
903
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
904 m_option_type_t m_option_type_imgfmt = {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
905 "Image format (aka colorspace)",
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
906 "Pls report any missing colorspace",
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
907 sizeof(uint32_t),
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
908 0,
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
909 parse_imgfmt,
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
910 NULL,
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
911 copy_opt,
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
912 copy_opt,
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
913 NULL,
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
914 NULL
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
915 };
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
916
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
917 /// Span stuff : Not finished
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
918 static int parse_play_pos(m_play_pos_t* pos,char* opt, char *s) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
919 char *ep;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
920 long tmp;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
921 int i;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
922
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
923 memset(pos,0,sizeof(m_play_pos_t));
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
924
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
925 if(!s || s[0] == '\0')
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
926 return M_OPT_MISSING_PARAM;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
927
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
928 // Track index
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
929 tmp = strtol(s, &ep, 0);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
930 if(ep != s) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
931 if(tmp < 1) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
932 mp_msg(MSGT_CFGPARSER, MSGL_ERR, "Option %s: Track/Chapter index must be > 0\n", opt);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
933 return M_OPT_OUT_OF_RANGE;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
934 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
935 pos->idx = tmp;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
936 if(ep[0] == '\0')
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
937 return 1;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
938 s = ep;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
939 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
940
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
941 // Span
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
942 tmp = strlen(s);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
943 if(s[0] != '[' || s[tmp-1] != ']') {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
944 mp_msg(MSGT_CFGPARSER, MSGL_ERR, "Option %s: invalid argument ?\n", opt);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
945 return M_OPT_INVALID;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
946 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
947 s[tmp-1] = '\0';
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
948 s++;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
949
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
950 // hh:mm:ss
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
951 for( i = 2 ; i >= 0 && s[0] != 0 ; i--) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
952 if(s[0] == ':') {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
953 tmp = 0;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
954 s++;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
955 } else {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
956 tmp = strtol(s, &ep, 0);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
957 if(tmp < 0 || (ep[0] != '\0' && ep[0] != (i > 0 ? ':' : '.') )) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
958 mp_msg(MSGT_CFGPARSER, MSGL_ERR, "Option %s: invalid argument ?\n", opt);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
959 return M_OPT_INVALID;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
960 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
961 pos->seconds += tmp * pow(60,i);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
962 s = ep;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
963 if(s[0] != '\0')
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
964 s++;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
965
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
966 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
967 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
968
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
969 // sectors
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
970 if(s[0]) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
971 tmp = strtol(s, &ep, 0);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
972 if(tmp < 0 || ep[0] != '\0') {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
973 mp_msg(MSGT_CFGPARSER, MSGL_ERR, "Option %s: invalid argument ?\n", opt);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
974 return M_OPT_INVALID;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
975 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
976 pos->sectors = tmp;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
977 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
978
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
979 return 1;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
980 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
981
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
982
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
983 static int parse_span(m_option_t* opt,char *name, char *param, void* dst, int src) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
984 m_span_t* span = dst;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
985 char *s = param,*e = NULL;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
986 int r = M_OPT_INVALID;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
987
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
988 if(param == NULL)
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
989 return M_OPT_MISSING_PARAM;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
990
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
991 e = strchr(param,'-');
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
992 if(e) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
993 e[0] = '\0';
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
994 e++;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
995 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
996
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
997 if(s[0] == '\0' && e[0] == '\0') {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
998 mp_msg(MSGT_CFGPARSER, MSGL_ERR, "Option %s: invalid argument\n");
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
999 return M_OPT_INVALID;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
1000 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
1001
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
1002 if(s[0]) {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
1003 r = parse_play_pos(&span->start,name,s);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
1004 if(r < 0) return r;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
1005 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
1006 if(e && e[0] != '\0')
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
1007 r = parse_play_pos(&span->end,name,s);
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
1008
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
1009 return r;
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
1010 }
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
1011
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
1012 m_option_type_t m_option_type_span = {
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
1013 "Span",
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
1014 "The syntax is 1[hh:mm:ss.zz]-5[hh:mm:ss.zz]",
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
1015 sizeof(m_span_t),
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
1016 0,
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
1017 parse_span,
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
1018 NULL,
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
1019 copy_opt,
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
1020 copy_opt,
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
1021 NULL,
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
1022 NULL
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
1023 };
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
1024
487cfc28525d New config system + cleanup of header inter dependency
albeu
parents:
diff changeset
1025 #endif