comparison libvo/vo_fbdev.c @ 977:d3354ad8aa7b

small fix
author szabii
date Sun, 03 Jun 2001 23:24:31 +0000
parents de1e10c4da3c
children 52bbb0e913d8
comparison
equal deleted inserted replaced
976:90408bd383a5 977:d3354ad8aa7b
138 static fb_mode_t *fb_modes = NULL; 138 static fb_mode_t *fb_modes = NULL;
139 static int nr_modes = 0; 139 static int nr_modes = 0;
140 140
141 static int parse_fbmode_cfg(char *cfgfile) 141 static int parse_fbmode_cfg(char *cfgfile)
142 { 142 {
143 #define CHECK_IN_MODE_DEF\
144 do {\
145 if (!in_mode_def) {\
146 printf("'needs 'mode' first");\
147 goto err_out_print_linenum;\
148 }\
149 } while (0)
150
143 fb_mode_t *mode = NULL; 151 fb_mode_t *mode = NULL;
144 char *endptr; // strtoul()... 152 char *endptr; // strtoul()...
153 int in_mode_def = 0;
145 int tmp, i; 154 int tmp, i;
146 155
147 if (verbose > 0) 156 if (verbose > 0)
148 printf("Reading %s: ", cfgfile); 157 printf("Reading %s: ", cfgfile);
149 158
170 179
171 while ((tmp = get_token(1)) != RET_EOF) { 180 while ((tmp = get_token(1)) != RET_EOF) {
172 if (tmp == RET_EOL) 181 if (tmp == RET_EOL)
173 continue; 182 continue;
174 if (!strcmp(token[0], "mode")) { 183 if (!strcmp(token[0], "mode")) {
184 if (in_mode_def) {
185 printf("'endmode' required");
186 goto err_out_print_linenum;
187 }
175 if (!validate_mode(mode)) 188 if (!validate_mode(mode))
176 goto err_out_not_valid; 189 goto err_out_not_valid;
177 loop_enter: 190 loop_enter:
178 if (!(fb_modes = (fb_mode_t *) realloc(fb_modes, 191 if (!(fb_modes = (fb_mode_t *) realloc(fb_modes,
179 sizeof(fb_mode_t) * (nr_modes + 1)))) { 192 sizeof(fb_mode_t) * (nr_modes + 1)))) {
195 } 208 }
196 if (!(mode->name = strdup(token[0]))) { 209 if (!(mode->name = strdup(token[0]))) {
197 printf("can't strdup -> 'name': %s\n", strerror(errno)); 210 printf("can't strdup -> 'name': %s\n", strerror(errno));
198 goto err_out; 211 goto err_out;
199 } 212 }
213 in_mode_def = 1;
200 } else if (!strcmp(token[0], "geometry")) { 214 } else if (!strcmp(token[0], "geometry")) {
215 CHECK_IN_MODE_DEF;
201 if (get_token(5) < 0) 216 if (get_token(5) < 0)
202 goto err_out_parse_error; 217 goto err_out_parse_error;
203 mode->xres = strtoul(token[0], &endptr, 0); 218 mode->xres = strtoul(token[0], &endptr, 0);
204 if (*endptr) 219 if (*endptr)
205 goto err_out_parse_error; 220 goto err_out_parse_error;
214 goto err_out_parse_error; 229 goto err_out_parse_error;
215 mode->depth = strtoul(token[4], &endptr, 0); 230 mode->depth = strtoul(token[4], &endptr, 0);
216 if (*endptr) 231 if (*endptr)
217 goto err_out_parse_error; 232 goto err_out_parse_error;
218 } else if (!strcmp(token[0], "timings")) { 233 } else if (!strcmp(token[0], "timings")) {
234 CHECK_IN_MODE_DEF;
219 if (get_token(7) < 0) 235 if (get_token(7) < 0)
220 goto err_out_parse_error; 236 goto err_out_parse_error;
221 mode->pixclock = strtoul(token[0], &endptr, 0); 237 mode->pixclock = strtoul(token[0], &endptr, 0);
222 if (*endptr) 238 if (*endptr)
223 goto err_out_parse_error; 239 goto err_out_parse_error;
238 goto err_out_parse_error; 254 goto err_out_parse_error;
239 mode->vslen = strtoul(token[6], &endptr, 0); 255 mode->vslen = strtoul(token[6], &endptr, 0);
240 if (*endptr) 256 if (*endptr)
241 goto err_out_parse_error; 257 goto err_out_parse_error;
242 } else if (!strcmp(token[0], "endmode")) { 258 } else if (!strcmp(token[0], "endmode")) {
243 /* FIXME NOTHING for now*/ 259 CHECK_IN_MODE_DEF;
260 in_mode_def = 0;
244 } else if (!strcmp(token[0], "accel")) { 261 } else if (!strcmp(token[0], "accel")) {
262 CHECK_IN_MODE_DEF;
245 if (get_token(1) < 0) 263 if (get_token(1) < 0)
246 goto err_out_parse_error; 264 goto err_out_parse_error;
247 /* 265 /*
248 * it's only used for text acceleration 266 * it's only used for text acceleration
249 * so we just ignore it. 267 * so we just ignore it.
250 */ 268 */
251 } else if (!strcmp(token[0], "hsync")) { 269 } else if (!strcmp(token[0], "hsync")) {
270 CHECK_IN_MODE_DEF;
252 if (get_token(1) < 0) 271 if (get_token(1) < 0)
253 goto err_out_parse_error; 272 goto err_out_parse_error;
254 if (!strcmp(token[0], "low")) 273 if (!strcmp(token[0], "low"))
255 mode->sync &= ~FB_SYNC_HOR_HIGH_ACT; 274 mode->sync &= ~FB_SYNC_HOR_HIGH_ACT;
256 else if(!strcmp(token[0], "high")) 275 else if(!strcmp(token[0], "high"))
257 mode->sync |= FB_SYNC_HOR_HIGH_ACT; 276 mode->sync |= FB_SYNC_HOR_HIGH_ACT;
258 else 277 else
259 goto err_out_parse_error; 278 goto err_out_parse_error;
260 } else if (!strcmp(token[0], "vsync")) { 279 } else if (!strcmp(token[0], "vsync")) {
280 CHECK_IN_MODE_DEF;
261 if (get_token(1) < 0) 281 if (get_token(1) < 0)
262 goto err_out_parse_error; 282 goto err_out_parse_error;
263 if (!strcmp(token[0], "low")) 283 if (!strcmp(token[0], "low"))
264 mode->sync &= ~FB_SYNC_VERT_HIGH_ACT; 284 mode->sync &= ~FB_SYNC_VERT_HIGH_ACT;
265 else if(!strcmp(token[0], "high")) 285 else if(!strcmp(token[0], "high"))
266 mode->sync |= FB_SYNC_VERT_HIGH_ACT; 286 mode->sync |= FB_SYNC_VERT_HIGH_ACT;
267 else 287 else
268 goto err_out_parse_error; 288 goto err_out_parse_error;
269 } else if (!strcmp(token[0], "csync")) { 289 } else if (!strcmp(token[0], "csync")) {
290 CHECK_IN_MODE_DEF;
270 if (get_token(1) < 0) 291 if (get_token(1) < 0)
271 goto err_out_parse_error; 292 goto err_out_parse_error;
272 if (!strcmp(token[0], "low")) 293 if (!strcmp(token[0], "low"))
273 mode->sync &= ~FB_SYNC_COMP_HIGH_ACT; 294 mode->sync &= ~FB_SYNC_COMP_HIGH_ACT;
274 else if(!strcmp(token[0], "high")) 295 else if(!strcmp(token[0], "high"))
275 mode->sync |= FB_SYNC_COMP_HIGH_ACT; 296 mode->sync |= FB_SYNC_COMP_HIGH_ACT;
276 else 297 else
277 goto err_out_parse_error; 298 goto err_out_parse_error;
278 } else if (!strcmp(token[0], "extsync")) { 299 } else if (!strcmp(token[0], "extsync")) {
300 CHECK_IN_MODE_DEF;
279 if (get_token(1) < 0) 301 if (get_token(1) < 0)
280 goto err_out_parse_error; 302 goto err_out_parse_error;
281 if (!strcmp(token[0], "false")) 303 if (!strcmp(token[0], "false"))
282 mode->sync &= ~FB_SYNC_EXT; 304 mode->sync &= ~FB_SYNC_EXT;
283 else if(!strcmp(token[0], "true")) 305 else if(!strcmp(token[0], "true"))
284 mode->sync |= FB_SYNC_EXT; 306 mode->sync |= FB_SYNC_EXT;
285 else 307 else
286 goto err_out_parse_error; 308 goto err_out_parse_error;
287 } else if (!strcmp(token[0], "laced")) { 309 } else if (!strcmp(token[0], "laced")) {
310 CHECK_IN_MODE_DEF;
288 if (get_token(1) < 0) 311 if (get_token(1) < 0)
289 goto err_out_parse_error; 312 goto err_out_parse_error;
290 if (!strcmp(token[0], "false")) 313 if (!strcmp(token[0], "false"))
291 mode->vmode = FB_VMODE_NONINTERLACED; 314 mode->vmode = FB_VMODE_NONINTERLACED;
292 else if (!strcmp(token[0], "true")) 315 else if (!strcmp(token[0], "true"))
293 mode->vmode = FB_VMODE_INTERLACED; 316 mode->vmode = FB_VMODE_INTERLACED;
294 else 317 else
295 goto err_out_parse_error; 318 goto err_out_parse_error;
296 } else if (!strcmp(token[0], "double")) { 319 } else if (!strcmp(token[0], "double")) {
320 CHECK_IN_MODE_DEF;
297 if (get_token(1) < 0) 321 if (get_token(1) < 0)
298 goto err_out_parse_error; 322 goto err_out_parse_error;
299 if (!strcmp(token[0], "false")) 323 if (!strcmp(token[0], "false"))
300 ; 324 ;
301 else if (!strcmp(token[0], "true")) 325 else if (!strcmp(token[0], "true"))