videogen-0.32/0040755000175000001440000000000007570643142012145 5ustar rumiusersvideogen-0.32/BUGS0100644000175000001440000000245007570643142012626 0ustar rumiusers+-------------------------------------------------------+ | | | videogen | | | | a simple XFree86 Modeline calculator | | (c) 1997-2002, Szabolcs Rumi | | | | http://www.rtfm.hu/videogen | | | | the videogen package is distributed under the | | GNU General Public License Version 2 (GPLv2) | | | +-------------------------------------------------------+ Please report bugs and problems to me: szrumi-at-axelero-dot-hu Known bugs in videogen: - With the version 0.31 I modified the algorithm to produce better Modelines especially when NVidia compatibility mode is on. Because of this I classify the new algorithm as "experimental". I would be very happy to receive user feedback, positive and negative as well! - Error messages could be more verbose at some points. - Some defaults and constants in the program were only found out by trial and error so it is not sure that they always work. videogen-0.32/CHANGES0100644000175000001440000000461607570642704013147 0ustar rumiusers+-------------------------------------------------------+ | | | videogen | | | | a simple XFree86 Modeline calculator | | (c) 1997-2002, Szabolcs Rumi | | | | http://www.rtfm.hu/videogen | | | | the videogen package is distributed under the | | GNU General Public License Version 2 (GPLv2) | | | +-------------------------------------------------------+ See the THANKS file for the list of people who helped me with fixing bugs, feature ideas, comments, etc. The videogen change log: 0.32 released: 26 Nov 2002 - fixed a small bug which can cause a segfault 0.31 released: 21 Nov 2002 - major changes to the calculation algorithm which fixes some of the problems with the new nvidia support - some other minor changes 0.30 released: 30 Oct 2002 - major rewrite of the whole code, primarily a very different (and hopefully better) user interface - added nvidia driver compatibility support - updated documentation 0.21 released: 6 Mar 2001 - made some minor internal changes to the code - renamed command line options to be less cryptic - cleaned up and revised documentation and all other files - dropped GPLv2 file from the package, it's a waste of diskspace 0.20 released: 19 Feb 2000 - almost the entire code has been rewritten - new calculation algorhythm implemented - added a default value for the horizontal sync pulse - the manpage has been revised to reflect changes 0.16 released: 19 Feb 1999 - added kernel framebuffer (fbset) support - added option -fb to print fbset format timings in silent mode - added new targets in the Makefile - updated documentation 0.15 released: 16 Aug 1997 - revised the source code and the whole package - added a videogen(1) manual page - slightly changed command line syntax 0.14 released: 28 May 1997 - added a little online help if started without options or with the usual --help option - slightly changed the the inner structure of the package 0.13 released: 9 May 1997 - first public release videogen-0.32/config.h0100644000175000001440000000714507566533126013574 0ustar rumiusers/* * +-------------------------------------------------------+ * | | * | videogen | * | | * | a simple XFree86 Modeline calculator | * | (c) 1997-2002, Szabolcs Rumi | * | | * | http://www.rtfm.hu/videogen | * | | * | the videogen package is distributed under the | * | GNU General Public License Version 2 (GPLv2) | * | | * +-------------------------------------------------------+ */ #ifndef CONFIG_H # define CONFIG_H /* * * * Here you can configure some compile-time defaults, but you should * only modify these if you are really sure you know what you are doing. * * */ /* * The version number reported by the program. This should not be bothered... */ #define CFG_VIDEOGEN_VERSION "0.31" /* * verbose output * * default: 1 */ #define CFG_VERBOSE 1 /* * default configuration file * * default: ~/.videogen */ #define CFG_CFGFILE "~/.videogen" /* * Linux framebuffer (fbset) timings calculation mode * * default: 0 */ #define CFG_FBSET 0 /* * Linux NVidia driver compatibility mode * * default: 1 */ #define CFG_NVIDIA 1 /* * parameter preferences */ #define CFG_PREC_DEFAULT 0 #define CFG_PREC_CFGFILE 1 #define CFG_PREC_CMDLINE 2 /* * how many percents of horizontal frame length is visible * default: 80% */ #define CFG_HORIZ_VISIBLE 80 /* * how many percents of vertical frame length is visible * default: 95% */ #define CFG_VERT_VISIBLE 95 /* * horizontal front porch interval (must be n*8) * default: 32 [ticks] */ #define CFG_HORIZ_FRONT_PORCH 64 /* * horizontal back porch interval (must be n*8) * default: 64 [ticks] */ #define CFG_HORIZ_BACK_PORCH 128 /* * default minimum horizontal sync pulse duration * default: 0.5 [us] */ #define CFG_HORIZ_SYNC_PULSE 0.5 /* * vertical front porch interval * default: 2 [ticks] */ #define CFG_VERT_FRONT_PORCH 2 /* * vertical back porch interval * default: 32 [ticks] */ #define CFG_VERT_BACK_PORCH 32 /* * default vertical sync pulse duration * default: 50 [us] */ #define CFG_VERT_SYNC_PULSE 50 /* * default limits for hardware parameter bounds checking * do not bother these. */ #define CFG_WIDTH_MIN 320 #define CFG_WIDTH_MAX 2048 #define CFG_HEIGHT_MIN 200 #define CFG_HEIGHT_MAX 1536 #define CFG_MAX_DOTCLK_MIN 5 #define CFG_MAX_DOTCLK_MAX 500 #define CFG_MAX_HFREQ_MIN 15 #define CFG_MAX_HFREQ_MAX 200 #define CFG_MAX_VFREQ_MIN 40 #define CFG_MAX_VFREQ_MAX 200 #define CFG_TARGET_VFREQ_MIN 40 #define CFG_TARGET_VFREQ_MAX 200 #define CFG_ASPECT_RATIO_MIN 0.5 #define CFG_ASPECT_RATIO_MAX 0.9 #define CFG_HORIZ_VISIBLE_MIN 70 #define CFG_HORIZ_VISIBLE_MAX 97 #define CFG_VERT_VISIBLE_MIN 70 #define CFG_VERT_VISIBLE_MAX 99 #define CFG_HORIZ_FRONT_PORCH_MIN 32 #define CFG_HORIZ_FRONT_PORCH_MAX 512 #define CFG_HORIZ_BACK_PORCH_MIN 32 #define CFG_HORIZ_BACK_PORCH_MAX 512 #define CFG_HORIZ_SYNC_PULSE_MIN 0.3 #define CFG_HORIZ_SYNC_PULSE_MAX 1.5 #define CFG_VERT_FRONT_PORCH_MIN 0 #define CFG_VERT_FRONT_PORCH_MAX 256 #define CFG_VERT_BACK_PORCH_MIN 0 #define CFG_VERT_BACK_PORCH_MAX 256 #define CFG_VERT_SYNC_PULSE_MIN 30 #define CFG_VERT_SYNC_PULSE_MAX 150 #define CFG_NV_MAX_HBLANK 1016 #define CFG_NV_MAX_HSP 256 #define CFG_NV_MAX_VBLANK 128 #define CFG_NV_MAX_VSP 16 #endif /* CONFIG_H */ videogen-0.32/Makefile0100644000175000001440000000454407570640166013614 0ustar rumiusers# +-------------------------------------------------------+ # | | # | videogen | # | | # | a simple XFree86 Modeline calculator | # | (c) 1997-2002, Szabolcs Rumi | # | | # | http://www.rtfm.hu/videogen | # | | # | the videogen package is distributed under the | # | GNU General Public License Version 2 (GPLv2) | # | | # +-------------------------------------------------------+ # installation directories BINDIR = /usr/local/bin MANDIR = /usr/local/man # uncomment the definitions appropriate for your environment below # Linux, FreeBSD, NetBSD, etc. (GNU cc, GNU make) CC = gcc CFLAGS = -Wall -O -g CDEFS = -D_POSIX_SOURCE LIBS = -lm # SunOS 5.8 (Sun cc, GNU make) #CC = cc #CFLAGS = -O #LIBS = -lm # SGI IRIX 6.5 (MIPSpro cc, GNU make) #CC = cc #CFLAGS = -O #LIBS = -lm # Digital (Compaq, HP) UNIX 5.1A (DEC C, GNU Make) #CC = cc #CFLAGS = -w0 -O #LIBS = -lm # HP-UX 10.20 (HP ANSI C, GNU Make) #CC = cc #CFLAGS = -Ae -O #LIBS = -lm # currently parser generation only works with GNU flex and bison, # but the generated files are included in the source package so that # you don't need any tools if you simply want to compile videogen LEX = flex -i YACC = bison -d # ---------- do not change anything beyond this line ---------- # objects OBJECTS = cfg.yy.o cfg.tab.o args.o checks.o misc.o videogen.o INTERMEDIATE = cfg.tab.c cfg.tab.h cfg.yy.c # targets %.yy.c: %.l $(LEX) $< %.tab.c %.tab.h: %.y $(YACC) $< %.o: %.c $(CC) $(CFLAGS) $(CDEFS) -c $< videogen: $(OBJECTS) $(CC) $(CFLAGS) $(CDEFS) -o videogen $(OBJECTS) $(LIBS) cfg.yy.o: cfg.tab.h .PRECIOUS: cfg.yy.c clean: rm -f videogen $(OBJECTS) distclean: clean rm -f core *~ realclean: distclean rm -f $(INTERMEDIATE) all: $(MAKE) clean videogen install: $(MAKE) all strip videogen cp videogen $(BINDIR) cp videogen.1x $(MANDIR)/man1 chmod 755 $(BINDIR)/videogen chmod 644 $(MANDIR)/man1/videogen.1x uninstall: rm -f $(BINDIR)/videogen rm -f $(MANDIR)/man1/videogen.1x # EOF videogen-0.32/README0100644000175000001440000000545007567156627013043 0ustar rumiusers+-------------------------------------------------------+ | | | videogen | | | | a simple XFree86 Modeline calculator | | (c) 1997-2002, Szabolcs Rumi | | | | http://www.rtfm.hu/videogen | | | | the videogen package is distributed under the | | GNU General Public License Version 2 (GPLv2) | | | +-------------------------------------------------------+ LEGAL INFORMATION / DISCLAIMER ------------------------------ This whole package is distributed under the GNU General Public License (GPL) The license text itself is no longer included in the videogen package. If you want to get a copy go to the following URL: http://www.gnu.org INTRODUCTION ------------ If you are reading this, you probably already know what videogen can be used for: to generate XFree86 Modelines and Linux fbset timings which provide the highest possible (or the desired) refresh rate at any given resolution. INSTALLATION ------------ The sources are using lex/yacc to generate some files. I have chosen to include these files with the source release (generated by GNU Flex and GNU Bison) so that you don't need these tools to compile the package. 1.) check "Makefile" and modify it according to your OS/environment 2.) do a "make" 3.) do a "make install" to install the binary and the manpage *4.) you can do a "make clean" to remove the binaries from the source dir *5.) you can do a "make distclean" to remove other junk files too *6.) you can do a "make realclean" to remove the lex/yacc generated files too *7.) you can remove the installed binary and manpage with "make uninstall" *) optional steps USAGE ----- videogen user interface changed greatly with the version 0.30. Now you can use both command line options and a configuration file to set the parameters for the calculations. You should take a look at the videogen.sample configuration file. For further information read the videogen(1x) manpage. PROBLEM REPORTING ----------------- If you are reporting a problem, it is best when you can provide detailed information like your exact monitor and graphics card make/model, settings you used to generate a particular Modeline, picture position on the screen with a particular Modeline or description of the screen artifacts when the generated Modeline is considered bad. Thank you in advance! HOMEPAGE -------- The videogen homepage has the latest tarballs, packages, and contact info at: http://www.rtfm.hu/videogen videogen-0.32/cfg.y0100644000175000001440000003051707557662555013117 0ustar rumiusers%{ /* * +-------------------------------------------------------+ * | | * | videogen | * | | * | a simple XFree86 Modeline calculator | * | (c) 1997-2002, Szabolcs Rumi | * | | * | http://www.rtfm.hu/videogen | * | | * | the videogen package is distributed under the | * | GNU General Public License Version 2 (GPLv2) | * | | * +-------------------------------------------------------+ */ #include #include #include "config.h" #include "videogen.h" extern unsigned int lexer_num_lines; /* line counter */ extern int yylex (void); void yyerror (char *errtext); %} %union { long int ival; /* integer value */ double fval; /* floating point value */ unsigned char bval; /* boolean value */ } %token T_INTEGER %token T_FLOAT %token T_BOOLEAN %token T_VERBOSE %token T_FBSET %token T_NVIDIA %token T_MODE %token T_MAX_DOTCLK %token T_MAX_HFREQ %token T_MAX_VFREQ %token T_DESIRED_VFREQ %token T_HVISIBLE %token T_VVISIBLE %token T_HFPORCH %token T_HBPORCH %token T_HSYNC %token T_VFPORCH %token T_VBPORCH %token T_VSYNC %% input: /* empty */ /* empty */ | input line /* empty */ | input error /* empty */ ; line: '\n' /* empty */ | assignments '\n' /* empty */ ; assignments: ';' /* empty */ | assignments ';' assignment /* empty */ | assignments ';' /* empty */ | assignment /* empty */ ; assignment: T_VERBOSE '=' T_BOOLEAN { if ($3 > 0) { if (commit_verbose (CFG_PREC_CFGFILE, &verbose, 1) == 0) { pmsg (VL_DEBUG, "[cfgfile] line %u: verbose mode on\n", lexer_num_lines); } } else { if (commit_verbose (CFG_PREC_CFGFILE, &verbose, 0) == 0) pmsg (VL_DEBUG, "[cfgfile] line %u: verbose mode off\n", lexer_num_lines); } } | T_FBSET '=' T_BOOLEAN { if ($3 > 0) { if (commit_fbset (CFG_PREC_CFGFILE, &fbset, 1) == 0) pmsg (VL_DEBUG, "[cfgfile] line %u: fbset mode on\n", lexer_num_lines); } else { if (commit_fbset (CFG_PREC_CFGFILE, &fbset, 0) == 0) pmsg (VL_DEBUG, "[cfgfile] line %u: fbset mode off\n", lexer_num_lines); } } | T_NVIDIA '=' T_BOOLEAN { if ($3 > 0) { if (commit_nvidia (CFG_PREC_CFGFILE, &nvidia, 1) == 0) pmsg (VL_DEBUG, "[cfgfile] line %u: nvidia compatibility mode on\n", lexer_num_lines); } else { if (commit_nvidia (CFG_PREC_CFGFILE, &nvidia, 0) == 0) pmsg (VL_DEBUG, "[cfgfile] line %u: nvidia compatibility mode off\n", lexer_num_lines); } } | T_MODE T_INTEGER 'x' T_INTEGER { switch (commit_mode (CFG_PREC_CFGFILE, &modes, &num_modes, $2, $4)) { case -1: break; case 0: { pmsg (VL_DEBUG, "[cfgfile] line %u: added mode %lux%lu\n", lexer_num_lines, $2, $4); break; } case 5: { pmsg (VL_DEBUG, "[cfgfile] line %u: too many modes, dropping %lux%lu\n", lexer_num_lines, $2, $4); pmsg (VL_VERBOSE, "no more than 256 modes are allowed, dropping %lux%lu\n", $2, $4); break; } default: { pmsg (VL_DEBUG, "[cfgfile] line %u: invalid parameter %lux%lu\n", lexer_num_lines, $2, $4); pmsg (VL_VERBOSE, "error at line %u: invalid parameter\n", lexer_num_lines); YYABORT; } } } | T_MAX_DOTCLK '=' T_INTEGER { switch (commit_max_dotclk (CFG_PREC_CFGFILE, &max_dotclk, $3)) { case -1: break; case 0: { pmsg (VL_DEBUG, "[cfgfile] line %u: max_dotclk = %lu MHz\n", lexer_num_lines, $3); break; } default: { pmsg (VL_DEBUG, "[cfgfile] line %u: invalid parameter (max_dotclk = %lu MHz)\n", lexer_num_lines, $3); pmsg (VL_VERBOSE, "error at line %u: invalid parameter\n", lexer_num_lines); YYABORT; } } } | T_MAX_HFREQ '=' T_INTEGER { switch (commit_max_hfreq (CFG_PREC_CFGFILE, &max_hfreq, $3)) { case -1: break; case 0: { pmsg (VL_DEBUG, "[cfgfile] line %u: max_hfreq = %lu kHz\n", lexer_num_lines, $3); break; } default: { pmsg (VL_DEBUG, "[cfgfile] line %u: invalid parameter (max_hfreq = %lu kHz)\n", lexer_num_lines, $3); pmsg (VL_VERBOSE, "error at line %u: invalid parameter\n", lexer_num_lines); YYABORT; } } } | T_MAX_HFREQ '=' T_FLOAT { switch (commit_max_hfreq (CFG_PREC_CFGFILE, &max_hfreq, $3)) { case -1: break; case 0: { pmsg (VL_DEBUG, "[cfgfile] line %u: max_hfreq = %f kHz\n", lexer_num_lines, $3); break; } default: { pmsg (VL_DEBUG, "[cfgfile] line %u: invalid parameter (max_hfreq = %f kHz)\n", lexer_num_lines, $3); pmsg (VL_VERBOSE, "error at line %u: invalid parameter\n", lexer_num_lines); YYABORT; } } } | T_MAX_VFREQ '=' T_INTEGER { switch (commit_max_vfreq (CFG_PREC_CFGFILE, &max_vfreq, $3)) { case -1: break; case 0: { pmsg (VL_DEBUG, "[cfgfile] line %u: max_vfreq = %lu Hz\n", lexer_num_lines, $3); break; } default: { pmsg (VL_DEBUG, "[cfgfile] line %u: invalid parameter (max_vfreq = %lu Hz)\n", lexer_num_lines, $3); pmsg (VL_VERBOSE, "error at line %u: invalid parameter\n", lexer_num_lines); YYABORT; } } } | T_MAX_VFREQ '=' T_FLOAT { switch (commit_max_vfreq (CFG_PREC_CFGFILE, &max_vfreq, $3)) { case -1: break; case 0: { pmsg (VL_DEBUG, "[cfgfile] line %u: max_vfreq = %f Hz\n", lexer_num_lines, $3); break; } default: { pmsg (VL_DEBUG, "[cfgfile] line %u: invalid parameter (max_vfreq = %f Hz)\n", lexer_num_lines, $3); pmsg (VL_VERBOSE, "error at line %u: invalid parameter\n", lexer_num_lines); YYABORT; } } } | T_DESIRED_VFREQ '=' T_INTEGER { switch (commit_desired_vfreq (CFG_PREC_CFGFILE, &desired_vfreq, $3)) { case -1: break; case 0: { pmsg (VL_DEBUG, "[cfgfile] line %u: desired_vfreq = %lu Hz\n", lexer_num_lines, $3); break; } default: { pmsg (VL_DEBUG, "[cfgfile] line %u: invalid parameter (desired_vfreq = %lu Hz)\n", lexer_num_lines, $3); pmsg (VL_VERBOSE, "error at line %u: invalid parameter\n", lexer_num_lines); YYABORT; } } } | T_DESIRED_VFREQ '=' T_FLOAT { switch (commit_desired_vfreq (CFG_PREC_CFGFILE, &desired_vfreq, $3)) { case -1: break; case 0: { pmsg (VL_DEBUG, "[cfgfile] line %u: desired_vfreq = %f Hz\n", lexer_num_lines, $3); break; } default: { pmsg (VL_DEBUG, "[cfgfile] line %u: invalid parameter (desired_vfreq = %f Hz)\n", lexer_num_lines, $3); pmsg (VL_VERBOSE, "error at line %u: invalid parameter\n", lexer_num_lines); YYABORT; } } } | T_HVISIBLE '=' T_INTEGER { switch (commit_hvisible (CFG_PREC_CFGFILE, &hvisible, $3)) { case -1: break; case 0: { pmsg (VL_DEBUG, "[cfgfile] line %u: hvisible = %lu%%\n", lexer_num_lines, $3); break; } default: { pmsg (VL_DEBUG, "[cfgfile] line %u: invalid parameter (hvisible = %lu%%)\n", lexer_num_lines, $3); pmsg (VL_VERBOSE, "error at line %u: invalid parameter\n", lexer_num_lines); YYABORT; } } } | T_HVISIBLE '=' T_FLOAT { switch (commit_hvisible (CFG_PREC_CFGFILE, &hvisible, $3)) { case -1: break; case 0: { pmsg (VL_DEBUG, "[cfgfile] line %u: hvisible = %.4g%%\n", lexer_num_lines, $3); break; } default: { pmsg (VL_DEBUG, "[cfgfile] line %u: invalid parameter (hvisible = %.4g%%)\n", lexer_num_lines, $3); pmsg (VL_VERBOSE, "error at line %u: invalid parameter\n", lexer_num_lines); YYABORT; } } } | T_VVISIBLE '=' T_INTEGER { switch (commit_vvisible (CFG_PREC_CFGFILE, &vvisible, $3)) { case -1: break; case 0: { pmsg (VL_DEBUG, "[cfgfile] line %u: vvisible = %lu%%\n", lexer_num_lines, $3); break; } default: { pmsg (VL_DEBUG, "[cfgfile] line %u: invalid parameter (vvisible = %lu%%)\n", lexer_num_lines, $3); pmsg (VL_VERBOSE, "error at line %u: invalid parameter\n", lexer_num_lines); YYABORT; } } } | T_VVISIBLE '=' T_FLOAT { switch (commit_vvisible (CFG_PREC_CFGFILE, &vvisible, $3)) { case -1: break; case 0: { pmsg (VL_DEBUG, "[cfgfile] line %u: vvisible = %.4g%%\n", lexer_num_lines, $3); break; } default: { pmsg (VL_DEBUG, "[cfgfile] line %u: invalid parameter (vvisible = %.4g%%)\n", lexer_num_lines, $3); pmsg (VL_VERBOSE, "error at line %u: invalid parameter\n", lexer_num_lines); YYABORT; } } } | T_HFPORCH '=' T_INTEGER { switch (commit_hfporch (CFG_PREC_CFGFILE, &hfporch, $3)) { case -1: break; case 0: { pmsg (VL_DEBUG, "[cfgfile] line %u: hfporch = %lu ticks\n", lexer_num_lines, $3); break; } default: { pmsg (VL_DEBUG, "[cfgfile] line %u: invalid parameter (hfporch = %lu ticks\n", lexer_num_lines, $3); pmsg (VL_VERBOSE, "error at line %u: invalid parameter\n", lexer_num_lines); YYABORT; } } } | T_HBPORCH '=' T_INTEGER { switch (commit_hbporch (CFG_PREC_CFGFILE, &hbporch, $3)) { case -1: break; case 0: { pmsg (VL_DEBUG, "[cfgfile] line %u: hbporch = %lu ticks\n", lexer_num_lines, $3); break; } default: { pmsg (VL_DEBUG, "[cfgfile] line %u: invalid parameter (hbporch = %lu ticks\n", lexer_num_lines, $3); pmsg (VL_VERBOSE, "error at line %u: invalid parameter\n", lexer_num_lines); YYABORT; } } } | T_HSYNC '=' T_INTEGER { switch (commit_hsync (CFG_PREC_CFGFILE, &hsync, $3)) { case -1: break; case 0: { pmsg (VL_DEBUG, "[cfgfile] line %u: hsync = %lu us\n", lexer_num_lines, $3); break; } default: { pmsg (VL_DEBUG, "[cfgfile] line %u: invalid parameter (hsync = %lu us\n", lexer_num_lines, $3); pmsg (VL_VERBOSE, "error at line %u: invalid parameter\n", lexer_num_lines); YYABORT; } } } | T_HSYNC '=' T_FLOAT { switch (commit_hsync (CFG_PREC_CFGFILE, &hsync, $3)) { case -1: break; case 0: { pmsg (VL_DEBUG, "[cfgfile] line %u: hsync = %.4g us\n", lexer_num_lines, $3); break; } default: { pmsg (VL_DEBUG, "[cfgfile] line %u: invalid parameter (hsync = %.4g us\n", lexer_num_lines, $3); pmsg (VL_VERBOSE, "error at line %u: invalid parameter\n", lexer_num_lines); YYABORT; } } } | T_VFPORCH '=' T_INTEGER { switch (commit_vfporch (CFG_PREC_CFGFILE, &vfporch, $3)) { case -1: break; case 0: { pmsg (VL_DEBUG, "[cfgfile] line %u: vfporch = %lu ticks\n", lexer_num_lines, $3); break; } default: { pmsg (VL_DEBUG, "[cfgfile] line %u: invalid parameter (vfporch = %lu ticks\n", lexer_num_lines, $3); pmsg (VL_VERBOSE, "error at line %u: invalid parameter\n", lexer_num_lines); YYABORT; } } } | T_VBPORCH '=' T_INTEGER { switch (commit_vbporch (CFG_PREC_CFGFILE, &vbporch, $3)) { case -1: break; case 0: { pmsg (VL_DEBUG, "[cfgfile] line %u: vbporch = %lu ticks\n", lexer_num_lines, $3); break; } default: { pmsg (VL_DEBUG, "[cfgfile] line %u: invalid parameter (vbporch = %lu ticks\n", lexer_num_lines, $3); pmsg (VL_VERBOSE, "error at line %u: invalid parameter\n", lexer_num_lines); YYABORT; } } } | T_VSYNC '=' T_INTEGER { switch (commit_vsync (CFG_PREC_CFGFILE, &vsync, $3)) { case -1: break; case 0: { pmsg (VL_DEBUG, "[cfgfile] line %u: vsync = %lu us\n", lexer_num_lines, $3); break; } default: { pmsg (VL_DEBUG, "[cfgfile] line %u: invalid parameter (vsync = %lu us\n", lexer_num_lines, $3); pmsg (VL_VERBOSE, "error at line %u: invalid parameter\n", lexer_num_lines); YYABORT; } } } | T_VSYNC '=' T_FLOAT { switch (commit_vsync (CFG_PREC_CFGFILE, &vsync, $3)) { case -1: break; case 0: { pmsg (VL_DEBUG, "[cfgfile] line %u: vsync = %.4g us\n", lexer_num_lines, $3); break; } default: { pmsg (VL_DEBUG, "[cfgfile] line %u: invalid parameter (vsync = %.4g us\n", lexer_num_lines, $3); pmsg (VL_VERBOSE, "error at line %u: invalid parameter\n", lexer_num_lines); YYABORT; } } } ; %% void yyerror (char *errtext) { pmsg (VL_DEBUG, "[cfgfile] parse error at line %u: %s\n", lexer_num_lines, errtext); pmsg (VL_VERBOSE, "error at line %u: %s\n", lexer_num_lines, errtext); } /* EOF */ videogen-0.32/cfg.yy.c0100644000175000001440000012525107570640177013520 0ustar rumiusers#line 2 "cfg.yy.c" /* A lexical scanner generated by flex */ /* Scanner skeleton version: * $Header: /home/daffy/u0/vern/flex/RCS/flex.skl,v 2.91 96/09/10 16:58:48 vern Exp $ */ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 5 #include #include /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ #ifdef c_plusplus #ifndef __cplusplus #define __cplusplus #endif #endif #ifdef __cplusplus #include #ifndef _WIN32 #include #endif /* Use prototypes in function declarations. */ #define YY_USE_PROTOS /* The "const" storage-class-modifier is valid. */ #define YY_USE_CONST #else /* ! __cplusplus */ #if __STDC__ #define YY_USE_PROTOS #define YY_USE_CONST #endif /* __STDC__ */ #endif /* ! __cplusplus */ #ifdef __TURBOC__ #pragma warn -rch #pragma warn -use #include #include #define YY_USE_CONST #define YY_USE_PROTOS #endif #ifdef YY_USE_CONST #define yyconst const #else #define yyconst #endif #ifdef YY_USE_PROTOS #define YY_PROTO(proto) proto #else #define YY_PROTO(proto) () #endif /* Returned upon end-of-file. */ #define YY_NULL 0 /* Promotes a possibly negative, possibly signed char to an unsigned * integer for use as an array index. If the signed char is negative, * we want to instead treat it as an 8-bit unsigned char, hence the * double cast. */ #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) /* Enter a start condition. This macro really ought to take a parameter, * but we do it the disgusting crufty way forced on us by the ()-less * definition of BEGIN. */ #define BEGIN yy_start = 1 + 2 * /* Translate the current start state into a value that can be later handed * to BEGIN to return to the state. The YYSTATE alias is for lex * compatibility. */ #define YY_START ((yy_start - 1) / 2) #define YYSTATE YY_START /* Action number for EOF rule of a given start state. */ #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) /* Special action meaning "start processing a new file". */ #define YY_NEW_FILE yyrestart( yyin ) #define YY_END_OF_BUFFER_CHAR 0 /* Size of default input buffer. */ #define YY_BUF_SIZE 16384 typedef struct yy_buffer_state *YY_BUFFER_STATE; extern int yyleng; extern FILE *yyin, *yyout; #define EOB_ACT_CONTINUE_SCAN 0 #define EOB_ACT_END_OF_FILE 1 #define EOB_ACT_LAST_MATCH 2 /* The funky do-while in the following #define is used to turn the definition * int a single C statement (which needs a semi-colon terminator). This * avoids problems with code like: * * if ( condition_holds ) * yyless( 5 ); * else * do_something_else(); * * Prior to using the do-while the compiler would get upset at the * "else" because it interpreted the "if" statement as being all * done when it reached the ';' after the yyless() call. */ /* Return all but the first 'n' matched characters back to the input stream. */ #define yyless(n) \ do \ { \ /* Undo effects of setting up yytext. */ \ *yy_cp = yy_hold_char; \ YY_RESTORE_YY_MORE_OFFSET \ yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \ YY_DO_BEFORE_ACTION; /* set up yytext again */ \ } \ while ( 0 ) #define unput(c) yyunput( c, yytext_ptr ) /* The following is because we cannot portably get our hands on size_t * (without autoconf's help, which isn't available because we want * flex-generated scanners to compile on their own). */ typedef unsigned int yy_size_t; struct yy_buffer_state { FILE *yy_input_file; char *yy_ch_buf; /* input buffer */ char *yy_buf_pos; /* current position in input buffer */ /* Size of input buffer in bytes, not including room for EOB * characters. */ yy_size_t yy_buf_size; /* Number of characters read into yy_ch_buf, not including EOB * characters. */ int yy_n_chars; /* Whether we "own" the buffer - i.e., we know we created it, * and can realloc() it to grow it, and should free() it to * delete it. */ int yy_is_our_buffer; /* Whether this is an "interactive" input source; if so, and * if we're using stdio for input, then we want to use getc() * instead of fread(), to make sure we stop fetching input after * each newline. */ int yy_is_interactive; /* Whether we're considered to be at the beginning of a line. * If so, '^' rules will be active on the next match, otherwise * not. */ int yy_at_bol; /* Whether to try to fill the input buffer when we reach the * end of it. */ int yy_fill_buffer; int yy_buffer_status; #define YY_BUFFER_NEW 0 #define YY_BUFFER_NORMAL 1 /* When an EOF's been seen but there's still some text to process * then we mark the buffer as YY_EOF_PENDING, to indicate that we * shouldn't try reading from the input source any more. We might * still have a bunch of tokens to match, though, because of * possible backing-up. * * When we actually see the EOF, we change the status to "new" * (via yyrestart()), so that the user can continue scanning by * just pointing yyin at a new input file. */ #define YY_BUFFER_EOF_PENDING 2 }; static YY_BUFFER_STATE yy_current_buffer = 0; /* We provide macros for accessing buffer states in case in the * future we want to put the buffer states in a more general * "scanner state". */ #define YY_CURRENT_BUFFER yy_current_buffer /* yy_hold_char holds the character lost when yytext is formed. */ static char yy_hold_char; static int yy_n_chars; /* number of characters read into yy_ch_buf */ int yyleng; /* Points to current character in buffer. */ static char *yy_c_buf_p = (char *) 0; static int yy_init = 1; /* whether we need to initialize */ static int yy_start = 0; /* start state number */ /* Flag which is used to allow yywrap()'s to do buffer switches * instead of setting up a fresh yyin. A bit of a hack ... */ static int yy_did_buffer_switch_on_eof; void yyrestart YY_PROTO(( FILE *input_file )); void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer )); void yy_load_buffer_state YY_PROTO(( void )); YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size )); void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b )); void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file )); void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b )); #define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer ) YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size )); YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str )); YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len )); static void *yy_flex_alloc YY_PROTO(( yy_size_t )); static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )); static void yy_flex_free YY_PROTO(( void * )); #define yy_new_buffer yy_create_buffer #define yy_set_interactive(is_interactive) \ { \ if ( ! yy_current_buffer ) \ yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ yy_current_buffer->yy_is_interactive = is_interactive; \ } #define yy_set_bol(at_bol) \ { \ if ( ! yy_current_buffer ) \ yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ yy_current_buffer->yy_at_bol = at_bol; \ } #define YY_AT_BOL() (yy_current_buffer->yy_at_bol) #define yywrap() 1 #define YY_SKIP_YYWRAP typedef unsigned char YY_CHAR; FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; typedef int yy_state_type; extern char *yytext; #define yytext_ptr yytext static yy_state_type yy_get_previous_state YY_PROTO(( void )); static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state )); static int yy_get_next_buffer YY_PROTO(( void )); static void yy_fatal_error YY_PROTO(( yyconst char msg[] )); /* Done after the current pattern has been matched and before the * corresponding action - sets up yytext. */ #define YY_DO_BEFORE_ACTION \ yytext_ptr = yy_bp; \ yyleng = (int) (yy_cp - yy_bp); \ yy_hold_char = *yy_cp; \ *yy_cp = '\0'; \ yy_c_buf_p = yy_cp; #define YY_NUM_RULES 28 #define YY_END_OF_BUFFER 29 static yyconst short int yy_accept[125] = { 0, 0, 0, 29, 27, 25, 23, 24, 3, 22, 1, 27, 27, 27, 27, 5, 27, 27, 26, 4, 25, 24, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 4, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 18, 0, 0, 0, 0, 0, 0, 0, 0, 21, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 17, 16, 0, 0, 0, 0, 20, 6, 19, 0, 0, 14, 0, 0, 0, 15, 0, 0, 11, 12, 0, 10, 0, 0, 13, 0 } ; static yyconst int yy_ec[256] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 1, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 1, 7, 1, 8, 1, 1, 1, 10, 11, 12, 13, 14, 15, 1, 16, 17, 1, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 1, 28, 1, 29, 30, 1, 1, 1, 1, 1, 9, 1, 10, 11, 12, 13, 14, 15, 1, 16, 17, 1, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 1, 28, 1, 29, 30, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } ; static yyconst int yy_meta[31] = { 0, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } ; static yyconst short int yy_base[126] = { 0, 0, 0, 141, 142, 138, 142, 0, 26, 142, 142, 125, 127, 22, 24, 13, 21, 40, 142, 123, 134, 0, 129, 33, 108, 107, 109, 108, 100, 112, 99, 114, 142, 109, 110, 142, 101, 98, 99, 91, 103, 93, 112, 100, 102, 93, 92, 92, 86, 102, 96, 96, 86, 96, 84, 84, 78, 78, 75, 76, 75, 87, 81, 31, 142, 80, 71, 73, 69, 81, 75, 77, 142, 78, 77, 142, 77, 65, 71, 70, 74, 71, 56, 69, 142, 69, 66, 62, 61, 57, 48, 49, 48, 142, 56, 57, 54, 50, 58, 142, 142, 51, 52, 49, 48, 142, 142, 142, 47, 32, 142, 39, 33, 32, 142, 38, 34, 142, 142, 24, 142, 31, 19, 142, 142, 39 } ; static yyconst short int yy_def[126] = { 0, 124, 1, 124, 124, 124, 124, 125, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 125, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 0, 124 } ; static yyconst short int yy_nxt[173] = { 0, 4, 5, 6, 7, 4, 8, 9, 10, 4, 4, 4, 4, 11, 4, 12, 13, 4, 4, 4, 14, 15, 16, 4, 4, 4, 4, 4, 17, 18, 19, 22, 23, 26, 30, 32, 34, 27, 22, 23, 21, 33, 35, 123, 77, 122, 31, 78, 28, 121, 29, 36, 120, 119, 37, 38, 118, 117, 116, 79, 115, 114, 113, 112, 111, 110, 39, 109, 40, 108, 107, 106, 105, 104, 103, 102, 101, 100, 99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, 88, 87, 86, 85, 84, 83, 82, 81, 80, 76, 75, 74, 73, 72, 71, 70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 42, 35, 56, 55, 54, 53, 52, 32, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 20, 41, 25, 24, 20, 124, 3, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124 } ; static yyconst short int yy_chk[173] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 8, 8, 13, 14, 15, 16, 13, 23, 23, 125, 15, 16, 122, 63, 121, 14, 63, 13, 119, 13, 17, 116, 115, 17, 17, 113, 112, 111, 63, 109, 108, 104, 103, 102, 101, 17, 98, 17, 97, 96, 95, 94, 92, 91, 90, 89, 88, 87, 86, 85, 83, 82, 81, 80, 79, 78, 77, 76, 74, 73, 71, 70, 69, 68, 67, 66, 65, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 34, 33, 31, 30, 29, 28, 27, 26, 25, 24, 22, 20, 19, 12, 11, 5, 3, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124 } ; static yy_state_type yy_last_accepting_state; static char *yy_last_accepting_cpos; /* The intent behind this definition is that it'll catch * any uses of REJECT which flex missed. */ #define REJECT reject_used_but_not_detected #define yymore() yymore_used_but_not_detected #define YY_MORE_ADJ 0 #define YY_RESTORE_YY_MORE_OFFSET char *yytext; #line 1 "cfg.l" #define INITIAL 0 #line 2 "cfg.l" /* * +-------------------------------------------------------+ * | | * | videogen | * | | * | a simple XFree86 Modeline calculator | * | (c) 1997-2002, Szabolcs Rumi | * | | * | http://www.rtfm.hu/videogen | * | | * | the videogen package is distributed under the | * | GNU General Public License Version 2 (GPLv2) | * | | * +-------------------------------------------------------+ */ /* this should be generated as a case insensitive lexer */ #include #include "config.h" #include "videogen.h" #include "cfg.tab.h" unsigned int lexer_num_lines = 1; /* start line counting from 1 */ #line 483 "cfg.yy.c" /* Macros after this point can all be overridden by user definitions in * section 1. */ #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus extern "C" int yywrap YY_PROTO(( void )); #else extern int yywrap YY_PROTO(( void )); #endif #endif #ifndef YY_NO_UNPUT static void yyunput YY_PROTO(( int c, char *buf_ptr )); #endif #ifndef yytext_ptr static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int )); #endif #ifdef YY_NEED_STRLEN static int yy_flex_strlen YY_PROTO(( yyconst char * )); #endif #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput YY_PROTO(( void )); #else static int input YY_PROTO(( void )); #endif #endif #if YY_STACK_USED static int yy_start_stack_ptr = 0; static int yy_start_stack_depth = 0; static int *yy_start_stack = 0; #ifndef YY_NO_PUSH_STATE static void yy_push_state YY_PROTO(( int new_state )); #endif #ifndef YY_NO_POP_STATE static void yy_pop_state YY_PROTO(( void )); #endif #ifndef YY_NO_TOP_STATE static int yy_top_state YY_PROTO(( void )); #endif #else #define YY_NO_PUSH_STATE 1 #define YY_NO_POP_STATE 1 #define YY_NO_TOP_STATE 1 #endif #ifdef YY_MALLOC_DECL YY_MALLOC_DECL #else #if __STDC__ #ifndef __cplusplus #include #endif #else /* Just try to get by without declaring the routines. This will fail * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int) * or sizeof(void*) != sizeof(int). */ #endif #endif /* Amount of stuff to slurp up with each read. */ #ifndef YY_READ_BUF_SIZE #define YY_READ_BUF_SIZE 8192 #endif /* Copy whatever the last rule matched to the standard output. */ #ifndef ECHO /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ #define ECHO (void) fwrite( yytext, yyleng, 1, yyout ) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, * is returned in "result". */ #ifndef YY_INPUT #define YY_INPUT(buf,result,max_size) \ if ( yy_current_buffer->yy_is_interactive ) \ { \ int c = '*', n; \ for ( n = 0; n < max_size && \ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ if ( c == '\n' ) \ buf[n++] = (char) c; \ if ( c == EOF && ferror( yyin ) ) \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ result = n; \ } \ else \ { \ errno=0; \ while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ { \ if( errno != EINTR) \ { \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ break; \ } \ errno=0; \ clearerr(yyin); \ } \ } #endif /* No semi-colon after return; correct usage is to write "yyterminate();" - * we don't want an extra ';' after the "return" because that will cause * some compilers to complain about unreachable statements. */ #ifndef yyterminate #define yyterminate() return YY_NULL #endif /* Number of entries by which start-condition stack grows. */ #ifndef YY_START_STACK_INCR #define YY_START_STACK_INCR 25 #endif /* Report a fatal error. */ #ifndef YY_FATAL_ERROR #define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) #endif /* Default declaration of generated scanner - a define so the user can * easily add parameters. */ #ifndef YY_DECL #define YY_DECL int yylex YY_PROTO(( void )) #endif /* Code executed at the beginning of each rule, after yytext and yyleng * have been set up. */ #ifndef YY_USER_ACTION #define YY_USER_ACTION #endif /* Code executed at the end of each rule. */ #ifndef YY_BREAK #define YY_BREAK break; #endif #define YY_RULE_SETUP \ YY_USER_ACTION YY_DECL { register yy_state_type yy_current_state; register char *yy_cp, *yy_bp; register int yy_act; #line 47 "cfg.l" #line 650 "cfg.yy.c" if ( yy_init ) { yy_init = 0; #ifdef YY_USER_INIT YY_USER_INIT; #endif if ( ! yy_start ) yy_start = 1; /* first start state */ if ( ! yyin ) yyin = stdin; if ( ! yyout ) yyout = stdout; if ( ! yy_current_buffer ) yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); yy_load_buffer_state(); } while ( 1 ) /* loops until end-of-file is reached */ { yy_cp = yy_c_buf_p; /* Support of yytext. */ *yy_cp = yy_hold_char; /* yy_bp points to the position in yy_ch_buf of the start of * the current run. */ yy_bp = yy_cp; yy_current_state = yy_start; yy_match: do { register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; if ( yy_accept[yy_current_state] ) { yy_last_accepting_state = yy_current_state; yy_last_accepting_cpos = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 125 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; ++yy_cp; } while ( yy_base[yy_current_state] != 142 ); yy_find_action: yy_act = yy_accept[yy_current_state]; if ( yy_act == 0 ) { /* have to back up */ yy_cp = yy_last_accepting_cpos; yy_current_state = yy_last_accepting_state; yy_act = yy_accept[yy_current_state]; } YY_DO_BEFORE_ACTION; do_action: /* This label is used only to access EOF actions. */ switch ( yy_act ) { /* beginning of action switch */ case 0: /* must back up */ /* undo the effects of YY_DO_BEFORE_ACTION */ *yy_cp = yy_hold_char; yy_cp = yy_last_accepting_cpos; yy_current_state = yy_last_accepting_state; goto yy_find_action; case 1: YY_RULE_SETUP #line 51 "cfg.l" { return ('='); } YY_BREAK case 2: YY_RULE_SETUP #line 53 "cfg.l" { yylval.fval = atof (yytext); return (T_FLOAT); } YY_BREAK case 3: YY_RULE_SETUP #line 56 "cfg.l" { yylval.ival = atol (yytext); return (T_INTEGER); } YY_BREAK case 4: YY_RULE_SETUP #line 59 "cfg.l" { yylval.bval = 1; return (T_BOOLEAN); } YY_BREAK case 5: YY_RULE_SETUP #line 62 "cfg.l" { yylval.bval = 0; return (T_BOOLEAN); } YY_BREAK case 6: YY_RULE_SETUP #line 65 "cfg.l" { return (T_VERBOSE); } YY_BREAK case 7: YY_RULE_SETUP #line 67 "cfg.l" { return (T_FBSET); } YY_BREAK case 8: YY_RULE_SETUP #line 69 "cfg.l" { return (T_NVIDIA); } YY_BREAK case 9: YY_RULE_SETUP #line 71 "cfg.l" { return (T_MODE); } YY_BREAK case 10: YY_RULE_SETUP #line 73 "cfg.l" { return (T_MAX_DOTCLK); } YY_BREAK case 11: YY_RULE_SETUP #line 75 "cfg.l" { return (T_MAX_HFREQ); } YY_BREAK case 12: YY_RULE_SETUP #line 77 "cfg.l" { return (T_MAX_VFREQ); } YY_BREAK case 13: YY_RULE_SETUP #line 79 "cfg.l" { return (T_DESIRED_VFREQ); } YY_BREAK case 14: YY_RULE_SETUP #line 81 "cfg.l" { return (T_HVISIBLE); } YY_BREAK case 15: YY_RULE_SETUP #line 83 "cfg.l" { return (T_VVISIBLE); } YY_BREAK case 16: YY_RULE_SETUP #line 85 "cfg.l" { return (T_HFPORCH); } YY_BREAK case 17: YY_RULE_SETUP #line 87 "cfg.l" { return (T_HBPORCH); } YY_BREAK case 18: YY_RULE_SETUP #line 89 "cfg.l" { return (T_HSYNC); } YY_BREAK case 19: YY_RULE_SETUP #line 91 "cfg.l" { return (T_VFPORCH); } YY_BREAK case 20: YY_RULE_SETUP #line 93 "cfg.l" { return (T_VBPORCH); } YY_BREAK case 21: YY_RULE_SETUP #line 95 "cfg.l" { return (T_VSYNC); } YY_BREAK case 22: YY_RULE_SETUP #line 97 "cfg.l" { return (';'); } YY_BREAK case 23: YY_RULE_SETUP #line 99 "cfg.l" { lexer_num_lines++; return ('\n'); } YY_BREAK case 24: YY_RULE_SETUP #line 102 "cfg.l" /* eat up shell-style comments */ YY_BREAK case 25: YY_RULE_SETUP #line 104 "cfg.l" /* eat up blanks */ YY_BREAK case 26: YY_RULE_SETUP #line 106 "cfg.l" { return ('x'); } YY_BREAK case 27: YY_RULE_SETUP #line 108 "cfg.l" { pmsg(VL_DEBUG, "[lexer] unrecognized character: %s\n", yytext ); } YY_BREAK case 28: YY_RULE_SETUP #line 114 "cfg.l" ECHO; YY_BREAK #line 880 "cfg.yy.c" case YY_STATE_EOF(INITIAL): yyterminate(); case YY_END_OF_BUFFER: { /* Amount of text matched not including the EOB char. */ int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1; /* Undo the effects of YY_DO_BEFORE_ACTION. */ *yy_cp = yy_hold_char; YY_RESTORE_YY_MORE_OFFSET if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW ) { /* We're scanning a new file or input source. It's * possible that this happened because the user * just pointed yyin at a new source and called * yylex(). If so, then we have to assure * consistency between yy_current_buffer and our * globals. Here is the right place to do so, because * this is the first action (other than possibly a * back-up) that will match for the new input source. */ yy_n_chars = yy_current_buffer->yy_n_chars; yy_current_buffer->yy_input_file = yyin; yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL; } /* Note that here we test for yy_c_buf_p "<=" to the position * of the first EOB in the buffer, since yy_c_buf_p will * already have been incremented past the NUL character * (since all states make transitions on EOB to the * end-of-buffer state). Contrast this with the test * in input(). */ if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] ) { /* This was really a NUL. */ yy_state_type yy_next_state; yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; yy_current_state = yy_get_previous_state(); /* Okay, we're now positioned to make the NUL * transition. We couldn't have * yy_get_previous_state() go ahead and do it * for us because it doesn't know how to deal * with the possibility of jamming (and we don't * want to build jamming into it because then it * will run more slowly). */ yy_next_state = yy_try_NUL_trans( yy_current_state ); yy_bp = yytext_ptr + YY_MORE_ADJ; if ( yy_next_state ) { /* Consume the NUL. */ yy_cp = ++yy_c_buf_p; yy_current_state = yy_next_state; goto yy_match; } else { yy_cp = yy_c_buf_p; goto yy_find_action; } } else switch ( yy_get_next_buffer() ) { case EOB_ACT_END_OF_FILE: { yy_did_buffer_switch_on_eof = 0; if ( yywrap() ) { /* Note: because we've taken care in * yy_get_next_buffer() to have set up * yytext, we can now set up * yy_c_buf_p so that if some total * hoser (like flex itself) wants to * call the scanner after we return the * YY_NULL, it'll still work - another * YY_NULL will get returned. */ yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; yy_act = YY_STATE_EOF(YY_START); goto do_action; } else { if ( ! yy_did_buffer_switch_on_eof ) YY_NEW_FILE; } break; } case EOB_ACT_CONTINUE_SCAN: yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; yy_current_state = yy_get_previous_state(); yy_cp = yy_c_buf_p; yy_bp = yytext_ptr + YY_MORE_ADJ; goto yy_match; case EOB_ACT_LAST_MATCH: yy_c_buf_p = &yy_current_buffer->yy_ch_buf[yy_n_chars]; yy_current_state = yy_get_previous_state(); yy_cp = yy_c_buf_p; yy_bp = yytext_ptr + YY_MORE_ADJ; goto yy_find_action; } break; } default: YY_FATAL_ERROR( "fatal flex scanner internal error--no action found" ); } /* end of action switch */ } /* end of scanning one token */ } /* end of yylex */ /* yy_get_next_buffer - try to read in a new buffer * * Returns a code representing an action: * EOB_ACT_LAST_MATCH - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position * EOB_ACT_END_OF_FILE - end of file */ static int yy_get_next_buffer() { register char *dest = yy_current_buffer->yy_ch_buf; register char *source = yytext_ptr; register int number_to_move, i; int ret_val; if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] ) YY_FATAL_ERROR( "fatal flex scanner internal error--end of buffer missed" ); if ( yy_current_buffer->yy_fill_buffer == 0 ) { /* Don't try to fill the buffer, so this is an EOF. */ if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 ) { /* We matched a single character, the EOB, so * treat this as a final EOF. */ return EOB_ACT_END_OF_FILE; } else { /* We matched some text prior to the EOB, first * process it. */ return EOB_ACT_LAST_MATCH; } } /* Try to read more data. */ /* First move last chars to start of buffer. */ number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1; for ( i = 0; i < number_to_move; ++i ) *(dest++) = *(source++); if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING ) /* don't do the read, it's not guaranteed to return an EOF, * just force an EOF */ yy_current_buffer->yy_n_chars = yy_n_chars = 0; else { int num_to_read = yy_current_buffer->yy_buf_size - number_to_move - 1; while ( num_to_read <= 0 ) { /* Not enough room in the buffer - grow it. */ #ifdef YY_USES_REJECT YY_FATAL_ERROR( "input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); #else /* just a shorter name for the current buffer */ YY_BUFFER_STATE b = yy_current_buffer; int yy_c_buf_p_offset = (int) (yy_c_buf_p - b->yy_ch_buf); if ( b->yy_is_our_buffer ) { int new_size = b->yy_buf_size * 2; if ( new_size <= 0 ) b->yy_buf_size += b->yy_buf_size / 8; else b->yy_buf_size *= 2; b->yy_ch_buf = (char *) /* Include room in for 2 EOB chars. */ yy_flex_realloc( (void *) b->yy_ch_buf, b->yy_buf_size + 2 ); } else /* Can't grow it, we don't own it. */ b->yy_ch_buf = 0; if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( "fatal error - scanner input buffer overflow" ); yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; num_to_read = yy_current_buffer->yy_buf_size - number_to_move - 1; #endif } if ( num_to_read > YY_READ_BUF_SIZE ) num_to_read = YY_READ_BUF_SIZE; /* Read in more data. */ YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), yy_n_chars, num_to_read ); yy_current_buffer->yy_n_chars = yy_n_chars; } if ( yy_n_chars == 0 ) { if ( number_to_move == YY_MORE_ADJ ) { ret_val = EOB_ACT_END_OF_FILE; yyrestart( yyin ); } else { ret_val = EOB_ACT_LAST_MATCH; yy_current_buffer->yy_buffer_status = YY_BUFFER_EOF_PENDING; } } else ret_val = EOB_ACT_CONTINUE_SCAN; yy_n_chars += number_to_move; yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR; yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; yytext_ptr = &yy_current_buffer->yy_ch_buf[0]; return ret_val; } /* yy_get_previous_state - get the state just before the EOB char was reached */ static yy_state_type yy_get_previous_state() { register yy_state_type yy_current_state; register char *yy_cp; yy_current_state = yy_start; for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) { register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); if ( yy_accept[yy_current_state] ) { yy_last_accepting_state = yy_current_state; yy_last_accepting_cpos = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 125 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; } return yy_current_state; } /* yy_try_NUL_trans - try to make a transition on the NUL character * * synopsis * next_state = yy_try_NUL_trans( current_state ); */ #ifdef YY_USE_PROTOS static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state ) #else static yy_state_type yy_try_NUL_trans( yy_current_state ) yy_state_type yy_current_state; #endif { register int yy_is_jam; register char *yy_cp = yy_c_buf_p; register YY_CHAR yy_c = 1; if ( yy_accept[yy_current_state] ) { yy_last_accepting_state = yy_current_state; yy_last_accepting_cpos = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 125 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; yy_is_jam = (yy_current_state == 124); return yy_is_jam ? 0 : yy_current_state; } #ifndef YY_NO_UNPUT #ifdef YY_USE_PROTOS static void yyunput( int c, register char *yy_bp ) #else static void yyunput( c, yy_bp ) int c; register char *yy_bp; #endif { register char *yy_cp = yy_c_buf_p; /* undo effects of setting up yytext */ *yy_cp = yy_hold_char; if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) { /* need to shift things up to make room */ /* +2 for EOB chars. */ register int number_to_move = yy_n_chars + 2; register char *dest = &yy_current_buffer->yy_ch_buf[ yy_current_buffer->yy_buf_size + 2]; register char *source = &yy_current_buffer->yy_ch_buf[number_to_move]; while ( source > yy_current_buffer->yy_ch_buf ) *--dest = *--source; yy_cp += (int) (dest - source); yy_bp += (int) (dest - source); yy_current_buffer->yy_n_chars = yy_n_chars = yy_current_buffer->yy_buf_size; if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) YY_FATAL_ERROR( "flex scanner push-back overflow" ); } *--yy_cp = (char) c; yytext_ptr = yy_bp; yy_hold_char = *yy_cp; yy_c_buf_p = yy_cp; } #endif /* ifndef YY_NO_UNPUT */ #ifdef __cplusplus static int yyinput() #else static int input() #endif { int c; *yy_c_buf_p = yy_hold_char; if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) { /* yy_c_buf_p now points to the character we want to return. * If this occurs *before* the EOB characters, then it's a * valid NUL; if not, then we've hit the end of the buffer. */ if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] ) /* This was really a NUL. */ *yy_c_buf_p = '\0'; else { /* need more input */ int offset = yy_c_buf_p - yytext_ptr; ++yy_c_buf_p; switch ( yy_get_next_buffer() ) { case EOB_ACT_LAST_MATCH: /* This happens because yy_g_n_b() * sees that we've accumulated a * token and flags that we need to * try matching the token before * proceeding. But for input(), * there's no matching to consider. * So convert the EOB_ACT_LAST_MATCH * to EOB_ACT_END_OF_FILE. */ /* Reset buffer status. */ yyrestart( yyin ); /* fall through */ case EOB_ACT_END_OF_FILE: { if ( yywrap() ) return EOF; if ( ! yy_did_buffer_switch_on_eof ) YY_NEW_FILE; #ifdef __cplusplus return yyinput(); #else return input(); #endif } case EOB_ACT_CONTINUE_SCAN: yy_c_buf_p = yytext_ptr + offset; break; } } } c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */ *yy_c_buf_p = '\0'; /* preserve yytext */ yy_hold_char = *++yy_c_buf_p; return c; } #ifdef YY_USE_PROTOS void yyrestart( FILE *input_file ) #else void yyrestart( input_file ) FILE *input_file; #endif { if ( ! yy_current_buffer ) yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); yy_init_buffer( yy_current_buffer, input_file ); yy_load_buffer_state(); } #ifdef YY_USE_PROTOS void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) #else void yy_switch_to_buffer( new_buffer ) YY_BUFFER_STATE new_buffer; #endif { if ( yy_current_buffer == new_buffer ) return; if ( yy_current_buffer ) { /* Flush out information for old buffer. */ *yy_c_buf_p = yy_hold_char; yy_current_buffer->yy_buf_pos = yy_c_buf_p; yy_current_buffer->yy_n_chars = yy_n_chars; } yy_current_buffer = new_buffer; yy_load_buffer_state(); /* We don't actually know whether we did this switch during * EOF (yywrap()) processing, but the only time this flag * is looked at is after yywrap() is called, so it's safe * to go ahead and always set it. */ yy_did_buffer_switch_on_eof = 1; } #ifdef YY_USE_PROTOS void yy_load_buffer_state( void ) #else void yy_load_buffer_state() #endif { yy_n_chars = yy_current_buffer->yy_n_chars; yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos; yyin = yy_current_buffer->yy_input_file; yy_hold_char = *yy_c_buf_p; } #ifdef YY_USE_PROTOS YY_BUFFER_STATE yy_create_buffer( FILE *file, int size ) #else YY_BUFFER_STATE yy_create_buffer( file, size ) FILE *file; int size; #endif { YY_BUFFER_STATE b; b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); b->yy_buf_size = size; /* yy_ch_buf has to be 2 characters longer than the size given because * we need to put in 2 end-of-buffer characters. */ b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 ); if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); b->yy_is_our_buffer = 1; yy_init_buffer( b, file ); return b; } #ifdef YY_USE_PROTOS void yy_delete_buffer( YY_BUFFER_STATE b ) #else void yy_delete_buffer( b ) YY_BUFFER_STATE b; #endif { if ( ! b ) return; if ( b == yy_current_buffer ) yy_current_buffer = (YY_BUFFER_STATE) 0; if ( b->yy_is_our_buffer ) yy_flex_free( (void *) b->yy_ch_buf ); yy_flex_free( (void *) b ); } #ifndef _WIN32 #include #else #ifndef YY_ALWAYS_INTERACTIVE #ifndef YY_NEVER_INTERACTIVE extern int isatty YY_PROTO(( int )); #endif #endif #endif #ifdef YY_USE_PROTOS void yy_init_buffer( YY_BUFFER_STATE b, FILE *file ) #else void yy_init_buffer( b, file ) YY_BUFFER_STATE b; FILE *file; #endif { yy_flush_buffer( b ); b->yy_input_file = file; b->yy_fill_buffer = 1; #if YY_ALWAYS_INTERACTIVE b->yy_is_interactive = 1; #else #if YY_NEVER_INTERACTIVE b->yy_is_interactive = 0; #else b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; #endif #endif } #ifdef YY_USE_PROTOS void yy_flush_buffer( YY_BUFFER_STATE b ) #else void yy_flush_buffer( b ) YY_BUFFER_STATE b; #endif { if ( ! b ) return; b->yy_n_chars = 0; /* We always need two end-of-buffer characters. The first causes * a transition to the end-of-buffer state. The second causes * a jam in that state. */ b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; b->yy_buf_pos = &b->yy_ch_buf[0]; b->yy_at_bol = 1; b->yy_buffer_status = YY_BUFFER_NEW; if ( b == yy_current_buffer ) yy_load_buffer_state(); } #ifndef YY_NO_SCAN_BUFFER #ifdef YY_USE_PROTOS YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size ) #else YY_BUFFER_STATE yy_scan_buffer( base, size ) char *base; yy_size_t size; #endif { YY_BUFFER_STATE b; if ( size < 2 || base[size-2] != YY_END_OF_BUFFER_CHAR || base[size-1] != YY_END_OF_BUFFER_CHAR ) /* They forgot to leave room for the EOB's. */ return 0; b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ b->yy_buf_pos = b->yy_ch_buf = base; b->yy_is_our_buffer = 0; b->yy_input_file = 0; b->yy_n_chars = b->yy_buf_size; b->yy_is_interactive = 0; b->yy_at_bol = 1; b->yy_fill_buffer = 0; b->yy_buffer_status = YY_BUFFER_NEW; yy_switch_to_buffer( b ); return b; } #endif #ifndef YY_NO_SCAN_STRING #ifdef YY_USE_PROTOS YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str ) #else YY_BUFFER_STATE yy_scan_string( yy_str ) yyconst char *yy_str; #endif { int len; for ( len = 0; yy_str[len]; ++len ) ; return yy_scan_bytes( yy_str, len ); } #endif #ifndef YY_NO_SCAN_BYTES #ifdef YY_USE_PROTOS YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len ) #else YY_BUFFER_STATE yy_scan_bytes( bytes, len ) yyconst char *bytes; int len; #endif { YY_BUFFER_STATE b; char *buf; yy_size_t n; int i; /* Get memory for full buffer, including space for trailing EOB's. */ n = len + 2; buf = (char *) yy_flex_alloc( n ); if ( ! buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); for ( i = 0; i < len; ++i ) buf[i] = bytes[i]; buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; b = yy_scan_buffer( buf, n ); if ( ! b ) YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); /* It's okay to grow etc. this buffer, and we should throw it * away when we're done. */ b->yy_is_our_buffer = 1; return b; } #endif #ifndef YY_NO_PUSH_STATE #ifdef YY_USE_PROTOS static void yy_push_state( int new_state ) #else static void yy_push_state( new_state ) int new_state; #endif { if ( yy_start_stack_ptr >= yy_start_stack_depth ) { yy_size_t new_size; yy_start_stack_depth += YY_START_STACK_INCR; new_size = yy_start_stack_depth * sizeof( int ); if ( ! yy_start_stack ) yy_start_stack = (int *) yy_flex_alloc( new_size ); else yy_start_stack = (int *) yy_flex_realloc( (void *) yy_start_stack, new_size ); if ( ! yy_start_stack ) YY_FATAL_ERROR( "out of memory expanding start-condition stack" ); } yy_start_stack[yy_start_stack_ptr++] = YY_START; BEGIN(new_state); } #endif #ifndef YY_NO_POP_STATE static void yy_pop_state() { if ( --yy_start_stack_ptr < 0 ) YY_FATAL_ERROR( "start-condition stack underflow" ); BEGIN(yy_start_stack[yy_start_stack_ptr]); } #endif #ifndef YY_NO_TOP_STATE static int yy_top_state() { return yy_start_stack[yy_start_stack_ptr - 1]; } #endif #ifndef YY_EXIT_FAILURE #define YY_EXIT_FAILURE 2 #endif #ifdef YY_USE_PROTOS static void yy_fatal_error( yyconst char msg[] ) #else static void yy_fatal_error( msg ) char msg[]; #endif { (void) fprintf( stderr, "%s\n", msg ); exit( YY_EXIT_FAILURE ); } /* Redefine yyless() so it works in section 3 code. */ #undef yyless #define yyless(n) \ do \ { \ /* Undo effects of setting up yytext. */ \ yytext[yyleng] = yy_hold_char; \ yy_c_buf_p = yytext + n; \ yy_hold_char = *yy_c_buf_p; \ *yy_c_buf_p = '\0'; \ yyleng = n; \ } \ while ( 0 ) /* Internal utility routines. */ #ifndef yytext_ptr #ifdef YY_USE_PROTOS static void yy_flex_strncpy( char *s1, yyconst char *s2, int n ) #else static void yy_flex_strncpy( s1, s2, n ) char *s1; yyconst char *s2; int n; #endif { register int i; for ( i = 0; i < n; ++i ) s1[i] = s2[i]; } #endif #ifdef YY_NEED_STRLEN #ifdef YY_USE_PROTOS static int yy_flex_strlen( yyconst char *s ) #else static int yy_flex_strlen( s ) yyconst char *s; #endif { register int n; for ( n = 0; s[n]; ++n ) ; return n; } #endif #ifdef YY_USE_PROTOS static void *yy_flex_alloc( yy_size_t size ) #else static void *yy_flex_alloc( size ) yy_size_t size; #endif { return (void *) malloc( size ); } #ifdef YY_USE_PROTOS static void *yy_flex_realloc( void *ptr, yy_size_t size ) #else static void *yy_flex_realloc( ptr, size ) void *ptr; yy_size_t size; #endif { /* The cast to (char *) in the following accommodates both * implementations that use char* generic pointers, and those * that use void* generic pointers. It works with the latter * because both ANSI C and C++ allow castless assignment from * any pointer type to void*, and deal with argument conversions * as though doing an assignment. */ return (void *) realloc( (char *) ptr, size ); } #ifdef YY_USE_PROTOS static void yy_flex_free( void *ptr ) #else static void yy_flex_free( ptr ) void *ptr; #endif { free( ptr ); } #if YY_MAIN int main() { yylex(); return 0; } #endif #line 114 "cfg.l" /* EOF */ videogen-0.32/videogen.1x0100644000175000001440000001423607557662025014230 0ustar rumiusers.TH VIDEOGEN 1 "videogen" "Szabolcs Rumi" \" -*- nroff -*- .SH NAME videogen \- generate Modelines for XFree86 servers .SH SYNOPSIS .B videogen [\-v|\-q] [\-fb|\-nfb] [\-nv|\-nnv] [\-f=] [\-m=] [\-mdc=] [\-mhf=] [\-mvf=] [\-dvf=] [\-hv=] [\-vv=] [\-hfp=] [\-hbp=] [\-hsp=] [\-vfp=] [\-vbp=] [\-vsp=] .SH DESCRIPTION .B videogen can be used to generate Modelines for XFree86 servers to reach the highest possible vertical refresh (screen update) rate at all resolutions, or to match the refresh rate you desire. As a new feature, it can obey the non-free NVidia driver's timing constraints. It can print the calculated results in the Linux framebuffer device format as well. .P .B ATTENTION! You only have to specify the maximum dot clock, the maximum horizontal frequency, the maximum vertical refresh, and of course the modes (resolutions) to generate the appropriate Modelines. The other options are only there for tweaking or solving special problems, there are hardcoded defaults for them which are suitable for the vast majority of cases. .SS CONFIGURATION FILE A configuration file can be used to specify all or part of the parameters needed by .B videogen to perform its calculations. This can be very comfortable in many cases. You can also specify a configuration file path on the command line other than the default (~/.videogen) or read from stdin which might be helpful if you want to call videogen from another program or from a script. .P The general syntax rules are the following: the parameters can be specified using name=value pairs. The parameter names are matched in a case insensitive manner. Blanks are optional. More name=value pairs can be specified on a single line separated by ";" characters. Any string after a "#" character is treated as a comment up to the end of the line. .SS COMMAND LINE The command line options always override the parameters set in the configuration file. This also applies to the mode list, so when one or more modes are specified on the command line, the entire list of modes read from the configuration file is replaced by these. .SS OPTIONS The command line options are described below together with their configuration file variable counterparts (if present). .PD .TP .I "\-v" .PD 0 .TP .I "\-q" .TP .I "verbose=on|off" Turn on/off verbose output. FYI -q stands for quiet ;) (default=on) .PD .TP .I "\-fb" .PD 0 .TP .I "\-nfb" .TP .I "fbset=on|off" Turn on/off fbset (Linux framebuffer timings) mode. In this mode fbset timings are printed instead of Modelines. (default=off) .PD .TP .I "\-nv" .PD 0 .TP .I "\-nnv" .TP .I "nvidia=on|off" Turn on/off non-free NVidia Linux driver compatibility mode. (default=on) .PD .TP .I "\-f=filespec" Use .B filespec as the configuration file. This accepts .B - to read the options from the standard input. The "~" character gets expanded to the home directory of the user running videogen. (default=~/.videogen) .PD .TP .I "\-m=modespec" .PD 0 .TP .I "mode=modespec" Adds .B modespec to the list of modes to calculate a Modeline for. This must be in the form .B 800x600 (width x height) and it can be specified more than once to add several modes. .PD .TP .I "\-mdc=freq" Set .B freq to the maximum dot clock rate of your video card or the bandwidth of your monitor, whichever is lower, in MHz. .TP .I "\-mhf=freq" Set .B freq to the maximum horizontal refresh frequency of your monitor in kHz. .TP .I "\-mvf=freq" Set .B freq to the maximum vertical refresh frequency of your monitor in Hz. .TP .I "\-dvf=freq" Set .B freq to the vertical refresh frequency which you think it would be optimal for you, in Hz. The program will try to match this frequency at all resolutions, instead of the maximum frequency that would be technically possible. (optional) .TP .I "\-hv=percent" Set .B percent to the percentage of the horizontal frame length you want the visible resolution to be. (optional) .TP .I "\-vv=percent" Set .B percent to the percentage of the vertical frame length you want the visible resolution to be. (optional) .TP .I "\-hfp=duration" Set .B duration to the horizontal front porch duration of your monitor in clock ticks. (optional) .TP .I "\-hbp=duration" Set .B duration to the horizontal back porch duration of your monitor in clock ticks. (optional) .TP .I "\-hsp=duration" Set .B duration to the minimum horizontal sync pulse duration of your monitor. (optional) .TP .I "\-vfp=duration" Set .B duration to the vertical front porch duration of your monitor in clock ticks. (optional) .TP .I "\-vbp=duration" Set .B duration to the vertical back porch duration of your monitor in clock ticks. (optional) .TP .I "\-vsp=duration" Set .B duration to the minimum vertical sync pulse duration of your monitor. (optional) .SS ERRORS You can expect the following error codes to be returned by videogen: .TP .I "100" system error (memory allocation problems, or other) .TP .I "101" command line option error .TP .I "102" configuration file error .TP .I "103" bad resolution error, currently returned when no (valid) modes have been specified anywhere .TP .I "104" bad maximum dot clock rate, currently returned when a proper value has not been specified anywhere .TP .I "105" bad maximum horizontal refresh, currently returned when a proper value has not been specified anywhere .TP .I "106" bad maximum vertical refresh, currently returned when a proper value has not been specified anywhere .SS FIXED DOT CLOCKS If your display adapter does not have a programmable clockchip then you will need to get a list of available clocks somehow and enter these as the maximum dot clock frequency. This way videogen will have to adjust (decrease) the horizontal refresh frequency to get exactly the given dot clock rate. A similar method can be used to match the proper frequencies of a fixed frequency monitor. .SH FILES .TP .I "~/.videogen" This is the default location for the videogen configuration file. .TP .I "/usr/X11/lib/X11/XF86Config" This is the common Xserver configuration file where the Modelines generated with .B videogen can be used. Currently this must be done by hand. .SH SEE ALSO X(1), XF86Setup(1), xvidtune(1), kvideogen(1) .SH AUTHOR Szabolcs Rumi .SH COPYING GNU General Public License Version 2 videogen-0.32/videogen.c0100644000175000001440000002104207566245547014121 0ustar rumiusers/* * +-------------------------------------------------------+ * | | * | videogen | * | | * | a simple XFree86 Modeline calculator | * | (c) 1997-2002, Szabolcs Rumi | * | | * | http://www.rtfm.hu/videogen | * | | * | the videogen package is distributed under the | * | GNU General Public License Version 2 (GPLv2) | * | | * +-------------------------------------------------------+ */ #include #include #include #include #include #include "config.h" #include "videogen.h" extern FILE *yyin; extern int yyparse (void); extern int yydebug; char *cfgfile = CFG_CFGFILE; unsigned int verbose = CFG_VERBOSE; unsigned int fbset = CFG_FBSET; unsigned int nvidia = CFG_NVIDIA; unsigned int num_modes = 0; resolution_t modes[256]; double max_dotclk = 0; double max_hfreq = 0; double max_vfreq = 0; double desired_vfreq = 0; double hvisible = CFG_HORIZ_VISIBLE; double vvisible = CFG_VERT_VISIBLE; double hfporch = CFG_HORIZ_FRONT_PORCH; double hbporch = CFG_HORIZ_BACK_PORCH; double hsync = CFG_HORIZ_SYNC_PULSE; double vfporch = CFG_VERT_FRONT_PORCH; double vbporch = CFG_VERT_BACK_PORCH; double vsync = CFG_VERT_SYNC_PULSE; void banner (void) { pmsg (VL_VERBOSE, "\n +--------------------------------------------------------------+\n"); pmsg (VL_VERBOSE, " | |\n"); pmsg (VL_VERBOSE, " | videogen %s simple XFree86 Modeline calculator |\n", CFG_VIDEOGEN_VERSION); pmsg (VL_VERBOSE, " | |\n"); pmsg (VL_VERBOSE, " | by Szabolcs Rumi, (c) 1997 - 2002 |\n"); pmsg (VL_VERBOSE, " | THIS PROGRAM COMES WITH ABSOLUTELY NO WARRANTY |\n"); pmsg (VL_VERBOSE, " | for details see the GNU General Public License (GPLv2) |\n"); pmsg (VL_VERBOSE, " | |\n"); pmsg (VL_VERBOSE, " +--------------------------------------------------------------+\n\n"); } void usage (void) { pmsg (VL_QUIET, "USAGE: videogen [-h] [-v|-q] [-fb|-nfb] [-nv|-nnv] [-f=] [-m=]\n"); pmsg (VL_QUIET, " [-mdc=] [-mhf=] [-mvf=] [-dvf=] [-hv=] [-vv=]\n"); pmsg (VL_QUIET, " [-hfp=] [-hbp=] [-hsp=] [-vfp=] [-vbp=] [-vsp=]\n\n"); } int main (int argc, char **argv) { char pathname_buf[4096]; arg_parse_t ap = { 0, 0, 0, NULL, &opts }; int i; double calc_dc, calc_hf, calc_vf; unsigned int calc_hfl, calc_vfl, calc_hfp, calc_hsp, calc_hbp, calc_vfp, calc_vsp, calc_vbp; /* * reading command line parameters */ ap.argc = argc; ap.argv = argv; if (arg_parse (&ap, &arg_action) < 0) { pmsg (VL_VERBOSE, "command line syntax error\n"); exit (ERR_CMDLINE); } /* * reading config file */ if (strcmp (cfgfile, "-")) { yyin = fopen (tpathexp (cfgfile, (char *)&pathname_buf), "r"); if (yyin == NULL) { pmsg (VL_VERBOSE, "could not open configuration file \"%s\" (errno=%i)\n", cfgfile, errno); } else { pmsg (VL_VERBOSE, "reading configuration from file %s\n", cfgfile); if (yyparse () != 0) exit (ERR_CFGFILE); } } else { yyin = stdin; if (yyin == NULL) { pmsg (VL_DEBUG, "[main] stdin not open\n"); } else { pmsg (VL_VERBOSE, "reading configuration from standard input\n"); if (yyparse () != 0) exit (ERR_CFGFILE); } } /* * print out some information about the program itself (in verbose mode only) */ banner (); /* * check if the mandatory parameters are present */ if (num_modes == 0) { pmsg (VL_VERBOSE, "error: no modes (resolutions) have been specified\n"); exit (ERR_RES); } if (max_dotclk == 0) { pmsg (VL_VERBOSE, "error: the maximum dot clock rate has not been specified\n"); exit (ERR_MDC); } if (max_hfreq == 0) { pmsg (VL_VERBOSE, "error: the maximum horizontal refresh frequency has not been specified\n"); exit (ERR_MHF); } if (max_vfreq == 0) { pmsg (VL_VERBOSE, "error: the maximum vertical refresh frequency has not been specified\n"); exit (ERR_MVF); } if (desired_vfreq == 0) desired_vfreq = max_vfreq; /* * do our main job */ for (i = 0; i < num_modes; i++) { calc_vf = desired_vfreq; calc_hfl = (unsigned int)floor (modes[i].hres * 100 / hvisible / 8) * 8; if ((nvidia > 0) && (calc_hfl - modes[i].hres > CFG_NV_MAX_HBLANK)) { pmsg (VL_DEBUG, "[main] hblank: %u > %u\n", calc_hfl - modes[i].hres, CFG_NV_MAX_HBLANK); hvisible = 100 - ((100 - hvisible) * (CFG_NV_MAX_HBLANK / (calc_hfl - modes[i].hres))); calc_hfl = (unsigned int)floor (modes[i].hres * 100 / hvisible); calc_hfl = (unsigned int)floor (calc_hfl / 8) * 8; } calc_hfp = (unsigned int)floor ((calc_hfl - modes[i].hres) / 64) * 8; calc_hbp = (unsigned int)floor ((calc_hfl - modes[i].hres - calc_hfp) / 8) * 8; calc_hsp = floor (hsync * max_dotclk / 8) * 8; if ((nvidia > 0) && (calc_hsp > CFG_NV_MAX_HSP)) { /* calc_hsp is assumed to be a multiple of 8 because all values it is * calculated from are assumed to be multiples of 8. */ pmsg (VL_DEBUG, "[main] hsp: %u > %u\n", calc_hsp, CFG_NV_MAX_HSP); calc_hsp = CFG_NV_MAX_HSP; } calc_hbp -= calc_hsp; calc_vfl = (unsigned int)floor (modes[i].vres * 100 / vvisible + 0.5); if ((nvidia > 0) && (calc_vfl - modes[i].vres > CFG_NV_MAX_VBLANK)) { pmsg (VL_DEBUG, "[main] vblank: %u > %u\n", calc_vfl - modes[i].vres, CFG_NV_MAX_VBLANK); vvisible = 100 - ((100 - vvisible) * (CFG_NV_MAX_VBLANK / (calc_vfl - modes[i].vres))); calc_vfl = (unsigned int)floor (modes[i].vres * 100 / vvisible); } calc_dc = calc_vf * calc_hfl * calc_vfl / 1000000; calc_hf = (1000 * calc_dc) / calc_hfl; calc_vfp = (unsigned int)vfporch; calc_vbp = calc_vfl - modes[i].vres - calc_vfp; calc_vsp = floor (vsync * calc_hf / 1000); if ((nvidia > 0) && (calc_vsp > CFG_NV_MAX_VSP)) { /* framelength must be the same after the correction */ pmsg (VL_DEBUG, "[main] vsp: %u > %u\n", calc_vsp, CFG_NV_MAX_VSP); calc_vsp = CFG_NV_MAX_VSP; } calc_vbp -= calc_vsp; pmsg (VL_DEBUG, "[main] dump 1: visible=%ux%u frame=%ux%u\n", modes[i].hres, modes[i].vres, calc_hfl, calc_vfl); pmsg (VL_DEBUG, "[main] dump 1: dc=%f hf=%f vf=%f\n", calc_dc, calc_hf, calc_vf); pmsg (VL_DEBUG, "[main] dump 1: hsp=%u vsp=%u\n\n", calc_hsp, calc_vsp); if (calc_dc > max_dotclk) { pmsg (VL_DEBUG, "[main] dc: %f > %f\n", calc_dc, max_dotclk); calc_dc = max_dotclk; calc_vf = (1000000 * calc_dc) / (calc_hfl * calc_vfl); } calc_hf = (1000 * calc_dc) / calc_hfl; pmsg (VL_DEBUG, "[main] dump 2: visible=%ux%u frame=%ux%u\n", modes[i].hres, modes[i].vres, calc_hfl, calc_vfl); pmsg (VL_DEBUG, "[main] dump 2: dc=%f hf=%f vf=%f\n", calc_dc, calc_hf, calc_vf); pmsg (VL_DEBUG, "[main] dump 2: hsp=%u vsp=%u\n\n", calc_hsp, calc_vsp); if (calc_hf > max_hfreq) { pmsg (VL_DEBUG, "[main] hf: %f > %f\n", calc_hf, max_hfreq); calc_hf = max_hfreq; calc_dc = calc_hf * calc_hfl / 1000; calc_vf = (1000000 * calc_dc) / (calc_hfl * calc_vfl); } pmsg (VL_DEBUG, "[main] dump 3: visible=%ux%u frame=%ux%u\n", modes[i].hres, modes[i].vres, calc_hfl, calc_vfl); pmsg (VL_DEBUG, "[main] dump 3: dc=%f hf=%f vf=%f\n", calc_dc, calc_hf, calc_vf); pmsg (VL_DEBUG, "[main] dump 3: hsp=%u vsp=%u\n\n", calc_hsp, calc_vsp); /* * printing out the results */ if (fbset == 0) { fprintf (stdout, "Modeline \"%ux%u\" %0.2f %u %u %u %u %u %u %u %u # %0.0f MHz, %0.1f kHz, %0.1f Hz\n", modes[i].hres, modes[i].vres, calc_dc, modes[i].hres, modes[i].hres + calc_hfp, modes[i].hres + calc_hfp + calc_hsp, modes[i].hres + calc_hfp + calc_hsp + calc_hbp, modes[i].vres, modes[i].vres + calc_vfp, modes[i].vres + calc_vfp + calc_vsp, modes[i].vres + calc_vfp + calc_vsp + calc_vbp, calc_dc, calc_hf, calc_vf); } else { fprintf (stdout, "timings %0.0f %u %u %u %u %u %u # %0.0f MHz, %0.1f kHz, %0.1f Hz\n", 1000000 / calc_dc, calc_hbp, calc_hfp, calc_vbp, calc_vfp, calc_hsp, calc_vsp, calc_dc, calc_hf, calc_vf); } } return (0); } /* EOF */ videogen-0.32/checks.c0100644000175000001440000001524007557106606013554 0ustar rumiusers/* * +-------------------------------------------------------+ * | | * | videogen | * | | * | a simple XFree86 Modeline calculator | * | (c) 1997-2002, Szabolcs Rumi | * | | * | http://www.rtfm.hu/videogen | * | | * | the videogen package is distributed under the | * | GNU General Public License Version 2 (GPLv2) | * | | * +-------------------------------------------------------+ */ #include #include #include "config.h" #include "videogen.h" /* * parameter checking functions return values: * * commit success retval = 0 * precedence error retval = -1 * overflow error retval > 0 * underflow error retval < 0 */ int commit_verbose (int precedence, unsigned int *verbose, unsigned int x) { static int current_precedence = CFG_PREC_DEFAULT; if (precedence < current_precedence) return (-1); *verbose = x; current_precedence = precedence; return (0); } int commit_fbset (int precedence, unsigned int *fbset, unsigned int x) { static int current_precedence = CFG_PREC_DEFAULT; if (precedence < current_precedence) return (-1); *fbset = x; current_precedence = precedence; return (0); } int commit_nvidia (int precedence, unsigned int *nvidia, unsigned int x) { static int current_precedence = CFG_PREC_DEFAULT; if (precedence < current_precedence) return (-1); *nvidia = x; current_precedence = precedence; return (0); } int commit_mode (int precedence, resolution_t (*modes)[], unsigned int *num_modes, unsigned int x, unsigned int y) { static int current_precedence = CFG_PREC_DEFAULT; if (x < CFG_WIDTH_MIN) return (-2); if (x > CFG_WIDTH_MAX) return (2); if (y < CFG_HEIGHT_MIN) return (-3); if (y > CFG_HEIGHT_MAX) return (3); if ((double)y / x < CFG_ASPECT_RATIO_MIN) return (-4); if ((double)y / x > CFG_ASPECT_RATIO_MAX) return (4); if ((unsigned int)(x / 8) * 8 != x) return (6); if (precedence < current_precedence) return (-1); if (precedence > current_precedence) *num_modes = 0; if (*num_modes > 255) return (5); (*modes)[*num_modes].hres = x; (*modes)[*num_modes].vres = y; (*num_modes)++; current_precedence = precedence; return (0); } int commit_max_dotclk (int precedence, double *max_dotclk, double x) { static int current_precedence = CFG_PREC_DEFAULT; if (x < CFG_MAX_DOTCLK_MIN) return (-2); if (x > CFG_MAX_DOTCLK_MAX) return (2); if (precedence < current_precedence) return (-1); *max_dotclk = x; current_precedence = precedence; return (0); } int commit_max_hfreq (int precedence, double *max_hfreq, double x) { static int current_precedence = CFG_PREC_DEFAULT; if (x < CFG_MAX_HFREQ_MIN) return (-2); if (x > CFG_MAX_HFREQ_MAX) return (2); if (precedence < current_precedence) return (-1); *max_hfreq = x; current_precedence = precedence; return (0); } int commit_max_vfreq (int precedence, double *max_vfreq, double x) { static int current_precedence = CFG_PREC_DEFAULT; if (x < CFG_MAX_VFREQ_MIN) return (-2); if (x > CFG_MAX_VFREQ_MAX) return (2); if (precedence < current_precedence) return (-1); *max_vfreq = x; current_precedence = precedence; return (0); } int commit_desired_vfreq (int precedence, double *desired_vfreq, double x) { static int current_precedence = CFG_PREC_DEFAULT; if (x < CFG_TARGET_VFREQ_MIN) return (-2); if (x > CFG_TARGET_VFREQ_MAX) return (2); if (precedence < current_precedence) return (-1); *desired_vfreq = x; current_precedence = precedence; return (0); } int commit_hvisible (int precedence, double *hvisible, double x) { static int current_precedence = CFG_PREC_DEFAULT; if (x < CFG_HORIZ_VISIBLE_MIN) return (-2); if (x > CFG_HORIZ_VISIBLE_MAX) return (2); if (precedence < current_precedence) return (-1); *hvisible = x; current_precedence = precedence; return (0); } int commit_vvisible (int precedence, double *vvisible, double x) { static int current_precedence = CFG_PREC_DEFAULT; if (x < CFG_VERT_VISIBLE_MIN) return (-2); if (x > CFG_VERT_VISIBLE_MAX) return (2); if (precedence < current_precedence) return (-1); *vvisible = x; current_precedence = precedence; return (0); } int commit_hfporch (int precedence, double *hfporch, double x) { static int current_precedence = CFG_PREC_DEFAULT; if (x < CFG_HORIZ_FRONT_PORCH_MIN) return (-2); if (x > CFG_HORIZ_FRONT_PORCH_MAX) return (2); if ((unsigned int)(x / 8) * 8 != x) return (3); if (precedence < current_precedence) return (-1); *hfporch = x; current_precedence = precedence; return (0); } int commit_hbporch (int precedence, double *hbporch, double x) { static int current_precedence = CFG_PREC_DEFAULT; if (x < CFG_HORIZ_BACK_PORCH_MIN) return (-2); if (x > CFG_HORIZ_BACK_PORCH_MAX) return (2); if ((unsigned int)(x / 8) * 8 != x) return (3); if (precedence < current_precedence) return (-1); *hbporch = x; current_precedence = precedence; return (0); } int commit_hsync (int precedence, double *hsync, double x) { static int current_precedence = CFG_PREC_DEFAULT; if (x < CFG_HORIZ_SYNC_PULSE_MIN) return (-2); if (x > CFG_HORIZ_SYNC_PULSE_MAX) return (2); if (precedence < current_precedence) return (-1); *hsync = x; current_precedence = precedence; return (0); } int commit_vfporch (int precedence, double *vfporch, double x) { static int current_precedence = CFG_PREC_DEFAULT; if (x < CFG_VERT_FRONT_PORCH_MIN) return (-2); if (x > CFG_VERT_FRONT_PORCH_MAX) return (2); if (precedence < current_precedence) return (-1); *vfporch = x; current_precedence = precedence; return (0); } int commit_vbporch (int precedence, double *vbporch, double x) { static int current_precedence = CFG_PREC_DEFAULT; if (x < CFG_VERT_BACK_PORCH_MIN) return (-2); if (x > CFG_VERT_BACK_PORCH_MAX) return (2); if (precedence < current_precedence) return (-1); *vbporch = x; current_precedence = precedence; return (0); } int commit_vsync (int precedence, double *vsync, double x) { static int current_precedence = CFG_PREC_DEFAULT; if (x < CFG_VERT_SYNC_PULSE_MIN) return (-2); if (x > CFG_VERT_SYNC_PULSE_MAX) return (2); if (precedence < current_precedence) return (-1); *vsync = x; current_precedence = precedence; return (0); } /* EOF */ videogen-0.32/cfg.l0100644000175000001440000000436707557662576013111 0ustar rumiusers%{ /* * +-------------------------------------------------------+ * | | * | videogen | * | | * | a simple XFree86 Modeline calculator | * | (c) 1997-2002, Szabolcs Rumi | * | | * | http://www.rtfm.hu/videogen | * | | * | the videogen package is distributed under the | * | GNU General Public License Version 2 (GPLv2) | * | | * +-------------------------------------------------------+ */ /* this should be generated as a case insensitive lexer */ #include #include "config.h" #include "videogen.h" #include "cfg.tab.h" unsigned int lexer_num_lines = 1; /* start line counting from 1 */ %} %option outfile="cfg.yy.c" %option noyywrap %% = { return ('='); } [0-9]+[.][0-9]+ { yylval.fval = atof (yytext); return (T_FLOAT); } [0-9]+ { yylval.ival = atol (yytext); return (T_INTEGER); } yes|y|on { yylval.bval = 1; return (T_BOOLEAN); } no|n|off { yylval.bval = 0; return (T_BOOLEAN); } verbose { return (T_VERBOSE); } fbset { return (T_FBSET); } nvidia { return (T_NVIDIA); } mode { return (T_MODE); } max_dotclk { return (T_MAX_DOTCLK); } max_hfreq { return (T_MAX_HFREQ); } max_vfreq { return (T_MAX_VFREQ); } desired_vfreq { return (T_DESIRED_VFREQ); } hvisible { return (T_HVISIBLE); } vvisible { return (T_VVISIBLE); } hfporch { return (T_HFPORCH); } hbporch { return (T_HBPORCH); } hsync { return (T_HSYNC); } vfporch { return (T_VFPORCH); } vbporch { return (T_VBPORCH); } vsync { return (T_VSYNC); } ; { return (';'); } \n { lexer_num_lines++; return ('\n'); } #[^\n]* /* eat up shell-style comments */ [ \t]+ /* eat up blanks */ x { return ('x'); } . { pmsg(VL_DEBUG, "[lexer] unrecognized character: %s\n", yytext ); } %% /* EOF */ videogen-0.32/misc.c0100644000175000001440000000375607557071163013257 0ustar rumiusers/* * +-------------------------------------------------------+ * | | * | videogen | * | | * | a simple XFree86 Modeline calculator | * | (c) 1997-2002, Szabolcs Rumi | * | | * | http://www.rtfm.hu/videogen | * | | * | the videogen package is distributed under the | * | GNU General Public License Version 2 (GPLv2) | * | | * +-------------------------------------------------------+ */ #include #include #include #include #include #include #include "config.h" #include "videogen.h" int pmsg (int vlevel, char *fmt, ...) { va_list vl; int printed = 0; va_start (vl, fmt); if (vlevel <= verbose) printed = vfprintf (stderr, fmt, vl); #ifdef DEBUG if (vlevel == 2) printed = vfprintf (stderr, fmt, vl); #endif va_end (vl); return (printed); } char * tpathexp (char *tpath, char *expath) { char uname[16]; unsigned int pos = 0; struct passwd *pw; if ((tpath == NULL) || (strlen (tpath) == 0) || (tpath[0] != '~')) strcpy (expath, tpath); else { while ((tpath[1 + pos] != '\0') && (tpath[1 + pos] != '/')) { uname[pos] = tpath[1 + pos]; pos++; } uname[pos] = '\0'; if (pos > 0) { if ((pw = getpwnam ((char *)&uname)) == NULL) strcpy (expath, tpath); else { strcpy (expath, pw->pw_dir); strcat (expath, (char *)(tpath + pos + 1)); } } else { if ((pw = getpwuid (getuid ())) == NULL) strcpy (expath, tpath); else { strcpy (expath, pw->pw_dir); strcat (expath, (char *)(tpath + pos + 1)); } } } return (expath); } /* EOF */ videogen-0.32/videogen.h0100644000175000001440000000670007557421536014124 0ustar rumiusers/* * +-------------------------------------------------------+ * | | * | videogen | * | | * | a simple XFree86 Modeline calculator | * | (c) 1997-2002, Szabolcs Rumi | * | | * | http://www.rtfm.hu/videogen | * | | * | the videogen package is distributed under the | * | GNU General Public License Version 2 (GPLv2) | * | | * +-------------------------------------------------------+ */ #ifndef VIDEOGEN_H # define VIDEOGEN_H #define ERR_SYSTEM 100 /* environmental or system error */ #define ERR_CMDLINE 101 /* command line error */ #define ERR_CFGFILE 102 /* config file error */ #define ERR_RES 103 /* bad resolution */ #define ERR_MDC 104 /* bad max dot clock */ #define ERR_MHF 105 /* bad max horizontal freq */ #define ERR_MVF 106 /* bad max vertical freq */ #define VL_QUIET 0 #define VL_VERBOSE 1 #define VL_DEBUG 2 typedef struct { unsigned int hres; unsigned int vres; } resolution_t; extern char *cfgfile; extern unsigned int verbose; extern unsigned int fbset; extern unsigned int nvidia; extern unsigned int num_modes; extern resolution_t modes[]; extern double max_dotclk; extern double max_hfreq; extern double max_vfreq; extern double desired_vfreq; extern double hvisible; extern double vvisible; extern double hfporch; extern double hbporch; extern double hsync; extern double vfporch; extern double vbporch; extern double vsync; extern void banner (void); extern void usage (void); extern int pmsg (int, char *, ...); extern char *tpathexp (char *, char *); #define ARG_FOUND 0x1 #define ARG_FOUND_PARM 0x2 typedef struct { char *ao_option; /* option string to be matched */ char *ao_parameter; /* argument parameter parsed */ int ao_flags; /* flags */ } arg_opt_t; typedef struct { int aindex; /* command line argument currently examined */ int oindex; /* option the current argument is believed to match */ int argc; /* argc to be parsed */ char **argv; /* argv to be parsed */ arg_opt_t (*options)[]; /* pre-defined options list */ } arg_parse_t; extern arg_opt_t opts[]; extern int arg_action (arg_parse_t *); extern int arg_parse (arg_parse_t *, int (*) (arg_parse_t *)); extern int commit_verbose (int, unsigned int *, unsigned int); extern int commit_fbset (int, unsigned int *, unsigned int); extern int commit_nvidia (int, unsigned int *, unsigned int); extern int commit_mode (int, resolution_t (*)[], unsigned int *, unsigned int, unsigned int); extern int commit_max_dotclk (int, double *, double); extern int commit_max_hfreq (int, double *, double); extern int commit_max_vfreq (int, double *, double); extern int commit_desired_vfreq (int, double *, double); extern int commit_hvisible (int, double *, double); extern int commit_vvisible (int, double *, double); extern int commit_hfporch (int, double *, double); extern int commit_hbporch (int, double *, double); extern int commit_hsync (int, double *, double); extern int commit_vfporch (int, double *, double); extern int commit_vbporch (int, double *, double); extern int commit_vsync (int, double *, double); #endif /* !VIDEOGEN_H */ /* EOF */ videogen-0.32/INSTALL0100644000175000001440000000142307567156041013176 0ustar rumiusers+-------------------------------------------------------+ | | | videogen | | | | a simple XFree86 Modeline calculator | | (c) 1997-2002, Szabolcs Rumi | | | | http://www.rtfm.hu/videogen | | | | the videogen package is distributed under the | | GNU General Public License Version 2 (GPLv2) | | | +-------------------------------------------------------+ Read the README! ;-) videogen-0.32/cfg.tab.c0100644000175000001440000013422507570640177013626 0ustar rumiusers/* A Bison parser, made from cfg.y, by GNU bison 1.75. */ /* Skeleton parser for Yacc-like parsing with Bison, Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* As a special exception, when this file is copied by Bison into a Bison output file, you may use that output file without restriction. This special exception was added by the Free Software Foundation in version 1.24 of Bison. */ /* Written by Richard Stallman by simplifying the original so called ``semantic'' parser. */ /* All symbols defined below should begin with yy or YY, to avoid infringing on user name space. This should be done even for local variables, as they might otherwise be expanded by user macros. There are some unavoidable exceptions within include files to define necessary library symbols; they are noted "INFRINGES ON USER NAME SPACE" below. */ /* Identify Bison output. */ #define YYBISON 1 /* Pure parsers. */ #define YYPURE 0 /* Using locations. */ #define YYLSP_NEEDED 0 /* Tokens. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE /* Put the tokens into the symbol table, so that GDB and other debuggers know about them. */ enum yytokentype { T_INTEGER = 258, T_FLOAT = 259, T_BOOLEAN = 260, T_VERBOSE = 261, T_FBSET = 262, T_NVIDIA = 263, T_MODE = 264, T_MAX_DOTCLK = 265, T_MAX_HFREQ = 266, T_MAX_VFREQ = 267, T_DESIRED_VFREQ = 268, T_HVISIBLE = 269, T_VVISIBLE = 270, T_HFPORCH = 271, T_HBPORCH = 272, T_HSYNC = 273, T_VFPORCH = 274, T_VBPORCH = 275, T_VSYNC = 276 }; #endif #define T_INTEGER 258 #define T_FLOAT 259 #define T_BOOLEAN 260 #define T_VERBOSE 261 #define T_FBSET 262 #define T_NVIDIA 263 #define T_MODE 264 #define T_MAX_DOTCLK 265 #define T_MAX_HFREQ 266 #define T_MAX_VFREQ 267 #define T_DESIRED_VFREQ 268 #define T_HVISIBLE 269 #define T_VVISIBLE 270 #define T_HFPORCH 271 #define T_HBPORCH 272 #define T_HSYNC 273 #define T_VFPORCH 274 #define T_VBPORCH 275 #define T_VSYNC 276 /* Copy the first part of user declarations. */ #line 1 "cfg.y" /* * +-------------------------------------------------------+ * | | * | videogen | * | | * | a simple XFree86 Modeline calculator | * | (c) 1997-2002, Szabolcs Rumi | * | | * | http://www.rtfm.hu/videogen | * | | * | the videogen package is distributed under the | * | GNU General Public License Version 2 (GPLv2) | * | | * +-------------------------------------------------------+ */ #include #include #include "config.h" #include "videogen.h" extern unsigned int lexer_num_lines; /* line counter */ extern int yylex (void); void yyerror (char *errtext); /* Enabling traces. */ #ifndef YYDEBUG # define YYDEBUG 0 #endif /* Enabling verbose error messages. */ #ifdef YYERROR_VERBOSE # undef YYERROR_VERBOSE # define YYERROR_VERBOSE 1 #else # define YYERROR_VERBOSE 0 #endif #ifndef YYSTYPE #line 45 "cfg.y" typedef union { long int ival; /* integer value */ double fval; /* floating point value */ unsigned char bval; /* boolean value */ } yystype; /* Line 193 of /usr/share/bison/yacc.c. */ #line 161 "cfg.tab.c" # define YYSTYPE yystype # define YYSTYPE_IS_TRIVIAL 1 #endif #ifndef YYLTYPE typedef struct yyltype { int first_line; int first_column; int last_line; int last_column; } yyltype; # define YYLTYPE yyltype # define YYLTYPE_IS_TRIVIAL 1 #endif /* Copy the second part of user declarations. */ /* Line 213 of /usr/share/bison/yacc.c. */ #line 182 "cfg.tab.c" #if ! defined (yyoverflow) || YYERROR_VERBOSE /* The parser invokes alloca or malloc; define the necessary symbols. */ # if YYSTACK_USE_ALLOCA # define YYSTACK_ALLOC alloca # else # ifndef YYSTACK_USE_ALLOCA # if defined (alloca) || defined (_ALLOCA_H) # define YYSTACK_ALLOC alloca # else # ifdef __GNUC__ # define YYSTACK_ALLOC __builtin_alloca # endif # endif # endif # endif # ifdef YYSTACK_ALLOC /* Pacify GCC's `empty if-body' warning. */ # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) # else # if defined (__STDC__) || defined (__cplusplus) # include /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # endif # define YYSTACK_ALLOC malloc # define YYSTACK_FREE free # endif #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */ #if (! defined (yyoverflow) \ && (! defined (__cplusplus) \ || (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) /* A type that is properly aligned for any stack member. */ union yyalloc { short yyss; YYSTYPE yyvs; }; /* The size of the maximum gap between one aligned stack and the next. */ # define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1) /* The size of an array large to enough to hold all stacks, each with N elements. */ # define YYSTACK_BYTES(N) \ ((N) * (sizeof (short) + sizeof (YYSTYPE)) \ + YYSTACK_GAP_MAX) /* Copy COUNT objects from FROM to TO. The source and destination do not overlap. */ # ifndef YYCOPY # if 1 < __GNUC__ # define YYCOPY(To, From, Count) \ __builtin_memcpy (To, From, (Count) * sizeof (*(From))) # else # define YYCOPY(To, From, Count) \ do \ { \ register YYSIZE_T yyi; \ for (yyi = 0; yyi < (Count); yyi++) \ (To)[yyi] = (From)[yyi]; \ } \ while (0) # endif # endif /* Relocate STACK from its old location to the new one. The local variables YYSIZE and YYSTACKSIZE give the old and new number of elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ # define YYSTACK_RELOCATE(Stack) \ do \ { \ YYSIZE_T yynewbytes; \ YYCOPY (&yyptr->Stack, Stack, yysize); \ Stack = &yyptr->Stack; \ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAX; \ yyptr += yynewbytes / sizeof (*yyptr); \ } \ while (0) #endif #if defined (__STDC__) || defined (__cplusplus) typedef signed char yysigned_char; #else typedef short yysigned_char; #endif /* YYFINAL -- State number of the termination state. */ #define YYFINAL 2 #define YYLAST 93 /* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 26 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 5 /* YYNRULES -- Number of rules. */ #define YYNRULES 33 /* YYNRULES -- Number of states. */ #define YYNSTATES 68 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 #define YYMAXUTOK 276 #define YYTRANSLATE(X) \ ((unsigned)(X) <= YYMAXUTOK ? yytranslate[X] : YYUNDEFTOK) /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ static const unsigned char yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 22, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 23, 2, 24, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 25, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21 }; #if YYDEBUG /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in YYRHS. */ static const unsigned char yyprhs[] = { 0, 0, 3, 4, 7, 10, 12, 15, 17, 21, 24, 26, 30, 34, 38, 43, 47, 51, 55, 59, 63, 67, 71, 75, 79, 83, 87, 91, 95, 99, 103, 107, 111, 115 }; /* YYRHS -- A `-1'-separated list of the rules' RHS. */ static const yysigned_char yyrhs[] = { 27, 0, -1, -1, 27, 28, -1, 27, 1, -1, 22, -1, 29, 22, -1, 23, -1, 29, 23, 30, -1, 29, 23, -1, 30, -1, 6, 24, 5, -1, 7, 24, 5, -1, 8, 24, 5, -1, 9, 3, 25, 3, -1, 10, 24, 3, -1, 11, 24, 3, -1, 11, 24, 4, -1, 12, 24, 3, -1, 12, 24, 4, -1, 13, 24, 3, -1, 13, 24, 4, -1, 14, 24, 3, -1, 14, 24, 4, -1, 15, 24, 3, -1, 15, 24, 4, -1, 16, 24, 3, -1, 17, 24, 3, -1, 18, 24, 3, -1, 18, 24, 4, -1, 19, 24, 3, -1, 20, 24, 3, -1, 21, 24, 3, -1, 21, 24, 4, -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const unsigned short yyrline[] = { 0, 81, 81, 82, 83, 88, 89, 94, 95, 96, 97, 102, 120, 137, 154, 182, 204, 226, 248, 270, 292, 314, 336, 358, 380, 402, 424, 446, 468, 490, 512, 534, 556, 578 }; #endif #if YYDEBUG || YYERROR_VERBOSE /* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = { "$end", "error", "$undefined", "T_INTEGER", "T_FLOAT", "T_BOOLEAN", "T_VERBOSE", "T_FBSET", "T_NVIDIA", "T_MODE", "T_MAX_DOTCLK", "T_MAX_HFREQ", "T_MAX_VFREQ", "T_DESIRED_VFREQ", "T_HVISIBLE", "T_VVISIBLE", "T_HFPORCH", "T_HBPORCH", "T_HSYNC", "T_VFPORCH", "T_VBPORCH", "T_VSYNC", "'\\n'", "';'", "'='", "'x'", "$accept", "input", "line", "assignments", "assignment", 0 }; #endif # ifdef YYPRINT /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to token YYLEX-NUM. */ static const unsigned short yytoknum[] = { 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 10, 59, 61, 120 }; # endif /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const unsigned char yyr1[] = { 0, 26, 27, 27, 27, 28, 28, 29, 29, 29, 29, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ static const unsigned char yyr2[] = { 0, 2, 0, 2, 2, 1, 2, 1, 3, 2, 1, 3, 3, 3, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 }; /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state STATE-NUM when YYTABLE doesn't specify something else to do. Zero means the default is an error. */ static const unsigned char yydefact[] = { 2, 0, 1, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 7, 3, 0, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 9, 11, 12, 13, 0, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 8, 14 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yysigned_char yydefgoto[] = { -1, 1, 22, 23, 24 }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ #define YYPACT_NINF -21 static const yysigned_char yypact[] = { -21, 0, -21, -21, 28, 29, 30, 52, 32, 33, 34, 35, 36, 38, 40, 42, 44, 46, 48, 49, -21, -21, -21, -20, -21, 56, 58, 60, 50, 64, 1, 37, 39, 41, 43, 66, 68, 45, 71, 73, 47, -21, 18, -21, -21, -21, 74, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21 }; /* YYPGOTO[NTERM-NUM]. */ static const yysigned_char yypgoto[] = { -21, -21, -21, -21, 51 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If positive, shift that token. If negative, reduce the rule which number is the opposite. If zero, do what YYDEFACT says. If YYTABLE_NINF, parse error. */ #define YYTABLE_NINF -1 static const unsigned char yytable[] = { 2, 3, 41, 42, 48, 49, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 50, 51, 52, 53, 54, 55, 56, 57, 60, 61, 64, 65, 25, 26, 27, 28, 29, 30, 31, 32, 33, 43, 34, 44, 35, 45, 36, 47, 37, 58, 38, 59, 39, 40, 62, 46, 63, 67, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 66 }; static const yysigned_char yycheck[] = { 0, 1, 22, 23, 3, 4, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 24, 24, 24, 3, 24, 24, 24, 24, 24, 5, 24, 5, 24, 5, 24, 3, 24, 3, 24, 3, 24, 24, 3, 25, 3, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 42 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ static const unsigned char yystos[] = { 0, 27, 0, 1, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 28, 29, 30, 24, 24, 24, 3, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 22, 23, 5, 5, 5, 25, 3, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 3, 3, 4, 3, 3, 3, 4, 30, 3 }; #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) # define YYSIZE_T __SIZE_TYPE__ #endif #if ! defined (YYSIZE_T) && defined (size_t) # define YYSIZE_T size_t #endif #if ! defined (YYSIZE_T) # if defined (__STDC__) || defined (__cplusplus) # include /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # endif #endif #if ! defined (YYSIZE_T) # define YYSIZE_T unsigned int #endif #define yyerrok (yyerrstatus = 0) #define yyclearin (yychar = YYEMPTY) #define YYEMPTY -2 #define YYEOF 0 #define YYACCEPT goto yyacceptlab #define YYABORT goto yyabortlab #define YYERROR goto yyerrlab1 /* Like YYERROR except do call yyerror. This remains here temporarily to ease the transition to the new meaning of YYERROR, for GCC. Once GCC version 2 has supplanted version 1, this can go. */ #define YYFAIL goto yyerrlab #define YYRECOVERING() (!!yyerrstatus) #define YYBACKUP(Token, Value) \ do \ if (yychar == YYEMPTY && yylen == 1) \ { \ yychar = (Token); \ yylval = (Value); \ yychar1 = YYTRANSLATE (yychar); \ YYPOPSTACK; \ goto yybackup; \ } \ else \ { \ yyerror ("syntax error: cannot back up"); \ YYERROR; \ } \ while (0) #define YYTERROR 1 #define YYERRCODE 256 /* YYLLOC_DEFAULT -- Compute the default location (before the actions are run). */ #ifndef YYLLOC_DEFAULT # define YYLLOC_DEFAULT(Current, Rhs, N) \ Current.first_line = Rhs[1].first_line; \ Current.first_column = Rhs[1].first_column; \ Current.last_line = Rhs[N].last_line; \ Current.last_column = Rhs[N].last_column; #endif /* YYLEX -- calling `yylex' with the right arguments. */ #define YYLEX yylex () /* Enable debugging if requested. */ #if YYDEBUG # ifndef YYFPRINTF # include /* INFRINGES ON USER NAME SPACE */ # define YYFPRINTF fprintf # endif # define YYDPRINTF(Args) \ do { \ if (yydebug) \ YYFPRINTF Args; \ } while (0) # define YYDSYMPRINT(Args) \ do { \ if (yydebug) \ yysymprint Args; \ } while (0) /* Nonzero means print parse trace. It is left uninitialized so that multiple parsers can coexist. */ int yydebug; #else /* !YYDEBUG */ # define YYDPRINTF(Args) # define YYDSYMPRINT(Args) #endif /* !YYDEBUG */ /* YYINITDEPTH -- initial size of the parser's stacks. */ #ifndef YYINITDEPTH # define YYINITDEPTH 200 #endif /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only if the built-in stack extension method is used). Do not make this value too large; the results are undefined if SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH) evaluated with infinite-precision integer arithmetic. */ #if YYMAXDEPTH == 0 # undef YYMAXDEPTH #endif #ifndef YYMAXDEPTH # define YYMAXDEPTH 10000 #endif #if YYERROR_VERBOSE # ifndef yystrlen # if defined (__GLIBC__) && defined (_STRING_H) # define yystrlen strlen # else /* Return the length of YYSTR. */ static YYSIZE_T # if defined (__STDC__) || defined (__cplusplus) yystrlen (const char *yystr) # else yystrlen (yystr) const char *yystr; # endif { register const char *yys = yystr; while (*yys++ != '\0') continue; return yys - yystr - 1; } # endif # endif # ifndef yystpcpy # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE) # define yystpcpy stpcpy # else /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in YYDEST. */ static char * # if defined (__STDC__) || defined (__cplusplus) yystpcpy (char *yydest, const char *yysrc) # else yystpcpy (yydest, yysrc) char *yydest; const char *yysrc; # endif { register char *yyd = yydest; register const char *yys = yysrc; while ((*yyd++ = *yys++) != '\0') continue; return yyd - 1; } # endif # endif #endif /* !YYERROR_VERBOSE */ #if YYDEBUG /*-----------------------------. | Print this symbol on YYOUT. | `-----------------------------*/ static void #if defined (__STDC__) || defined (__cplusplus) yysymprint (FILE* yyout, int yytype, YYSTYPE yyvalue) #else yysymprint (yyout, yytype, yyvalue) FILE* yyout; int yytype; YYSTYPE yyvalue; #endif { /* Pacify ``unused variable'' warnings. */ (void) yyvalue; if (yytype < YYNTOKENS) { YYFPRINTF (yyout, "token %s (", yytname[yytype]); # ifdef YYPRINT YYPRINT (yyout, yytoknum[yytype], yyvalue); # endif } else YYFPRINTF (yyout, "nterm %s (", yytname[yytype]); switch (yytype) { default: break; } YYFPRINTF (yyout, ")"); } #endif /* YYDEBUG. */ /*-----------------------------------------------. | Release the memory associated to this symbol. | `-----------------------------------------------*/ static void #if defined (__STDC__) || defined (__cplusplus) yydestruct (int yytype, YYSTYPE yyvalue) #else yydestruct (yytype, yyvalue) int yytype; YYSTYPE yyvalue; #endif { /* Pacify ``unused variable'' warnings. */ (void) yyvalue; switch (yytype) { default: break; } } /* The user can define YYPARSE_PARAM as the name of an argument to be passed into yyparse. The argument should have type void *. It should actually point to an object. Grammar actions can access the variable by casting it to the proper pointer type. */ #ifdef YYPARSE_PARAM # if defined (__STDC__) || defined (__cplusplus) # define YYPARSE_PARAM_ARG void *YYPARSE_PARAM # define YYPARSE_PARAM_DECL # else # define YYPARSE_PARAM_ARG YYPARSE_PARAM # define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; # endif #else /* !YYPARSE_PARAM */ # define YYPARSE_PARAM_ARG # define YYPARSE_PARAM_DECL #endif /* !YYPARSE_PARAM */ /* Prevent warning if -Wstrict-prototypes. */ #ifdef __GNUC__ # ifdef YYPARSE_PARAM int yyparse (void *); # else int yyparse (void); # endif #endif /* The lookahead symbol. */ int yychar; /* The semantic value of the lookahead symbol. */ YYSTYPE yylval; /* Number of parse errors so far. */ int yynerrs; int yyparse (YYPARSE_PARAM_ARG) YYPARSE_PARAM_DECL { register int yystate; register int yyn; int yyresult; /* Number of tokens to shift before error messages enabled. */ int yyerrstatus; /* Lookahead token as an internal (translated) token number. */ int yychar1 = 0; /* Three stacks and their tools: `yyss': related to states, `yyvs': related to semantic values, `yyls': related to locations. Refer to the stacks thru separate pointers, to allow yyoverflow to reallocate them elsewhere. */ /* The state stack. */ short yyssa[YYINITDEPTH]; short *yyss = yyssa; register short *yyssp; /* The semantic value stack. */ YYSTYPE yyvsa[YYINITDEPTH]; YYSTYPE *yyvs = yyvsa; register YYSTYPE *yyvsp; #define YYPOPSTACK (yyvsp--, yyssp--) YYSIZE_T yystacksize = YYINITDEPTH; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; /* When reducing, the number of symbols on the RHS of the reduced rule. */ int yylen; YYDPRINTF ((stderr, "Starting parse\n")); yystate = 0; yyerrstatus = 0; yynerrs = 0; yychar = YYEMPTY; /* Cause a token to be read. */ /* Initialize stack pointers. Waste one element of value and location stack so that they stay on the same level as the state stack. The wasted elements are never initialized. */ yyssp = yyss; yyvsp = yyvs; goto yysetstate; /*------------------------------------------------------------. | yynewstate -- Push a new state, which is found in yystate. | `------------------------------------------------------------*/ yynewstate: /* In all cases, when you get here, the value and location stacks have just been pushed. so pushing a state here evens the stacks. */ yyssp++; yysetstate: *yyssp = yystate; if (yyssp >= yyss + yystacksize - 1) { /* Get the current used size of the three stacks, in elements. */ YYSIZE_T yysize = yyssp - yyss + 1; #ifdef yyoverflow { /* Give user a chance to reallocate the stack. Use copies of these so that the &'s don't force the real ones into memory. */ YYSTYPE *yyvs1 = yyvs; short *yyss1 = yyss; /* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. This used to be a conditional around just the two extra args, but that might be undefined if yyoverflow is a macro. */ yyoverflow ("parser stack overflow", &yyss1, yysize * sizeof (*yyssp), &yyvs1, yysize * sizeof (*yyvsp), &yystacksize); yyss = yyss1; yyvs = yyvs1; } #else /* no yyoverflow */ # ifndef YYSTACK_RELOCATE goto yyoverflowlab; # else /* Extend the stack our own way. */ if (yystacksize >= YYMAXDEPTH) goto yyoverflowlab; yystacksize *= 2; if (yystacksize > YYMAXDEPTH) yystacksize = YYMAXDEPTH; { short *yyss1 = yyss; union yyalloc *yyptr = (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) goto yyoverflowlab; YYSTACK_RELOCATE (yyss); YYSTACK_RELOCATE (yyvs); # undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); } # endif #endif /* no yyoverflow */ yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; YYDPRINTF ((stderr, "Stack size increased to %lu\n", (unsigned long int) yystacksize)); if (yyssp >= yyss + yystacksize - 1) YYABORT; } YYDPRINTF ((stderr, "Entering state %d\n", yystate)); goto yybackup; /*-----------. | yybackup. | `-----------*/ yybackup: /* Do appropriate processing given the current state. */ /* Read a lookahead token if we need one and don't already have one. */ /* yyresume: */ /* First try to decide what to do without reference to lookahead token. */ yyn = yypact[yystate]; if (yyn == YYPACT_NINF) goto yydefault; /* Not known => get a lookahead token if don't already have one. */ /* yychar is either YYEMPTY or YYEOF or a valid token in external form. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); yychar = YYLEX; } /* Convert token to internal form (in yychar1) for indexing tables with. */ if (yychar <= 0) /* This means end of input. */ { yychar1 = 0; yychar = YYEOF; /* Don't call YYLEX any more. */ YYDPRINTF ((stderr, "Now at end of input.\n")); } else { yychar1 = YYTRANSLATE (yychar); /* We have to keep this `#if YYDEBUG', since we use variables which are defined only if `YYDEBUG' is set. */ YYDPRINTF ((stderr, "Next token is ")); YYDSYMPRINT ((stderr, yychar1, yylval)); YYDPRINTF ((stderr, "\n")); } /* If the proper action on seeing token YYCHAR1 is to reduce or to detect an error, take that action. */ yyn += yychar1; if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yychar1) goto yydefault; yyn = yytable[yyn]; if (yyn <= 0) { if (yyn == 0 || yyn == YYTABLE_NINF) goto yyerrlab; yyn = -yyn; goto yyreduce; } if (yyn == YYFINAL) YYACCEPT; /* Shift the lookahead token. */ YYDPRINTF ((stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1])); /* Discard the token being shifted unless it is eof. */ if (yychar != YYEOF) yychar = YYEMPTY; *++yyvsp = yylval; /* Count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; yystate = yyn; goto yynewstate; /*-----------------------------------------------------------. | yydefault -- do the default action for the current state. | `-----------------------------------------------------------*/ yydefault: yyn = yydefact[yystate]; if (yyn == 0) goto yyerrlab; goto yyreduce; /*-----------------------------. | yyreduce -- Do a reduction. | `-----------------------------*/ yyreduce: /* yyn is the number of a rule to reduce with. */ yylen = yyr2[yyn]; /* If YYLEN is nonzero, implement the default value of the action: `$$ = $1'. Otherwise, the following line sets YYVAL to garbage. This behavior is undocumented and Bison users should not rely upon it. Assigning to YYVAL unconditionally makes the parser a bit smaller, and it avoids a GCC warning that YYVAL may be used uninitialized. */ yyval = yyvsp[1-yylen]; #if YYDEBUG /* We have to keep this `#if YYDEBUG', since we use variables which are defined only if `YYDEBUG' is set. */ if (yydebug) { int yyi; YYFPRINTF (stderr, "Reducing via rule %d (line %d), ", yyn - 1, yyrline[yyn]); /* Print the symbols being reduced, and their result. */ for (yyi = yyprhs[yyn]; yyrhs[yyi] >= 0; yyi++) YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]); YYFPRINTF (stderr, " -> %s\n", yytname[yyr1[yyn]]); } #endif switch (yyn) { case 11: #line 102 "cfg.y" { if (yyvsp[0].bval > 0) { if (commit_verbose (CFG_PREC_CFGFILE, &verbose, 1) == 0) { pmsg (VL_DEBUG, "[cfgfile] line %u: verbose mode on\n", lexer_num_lines); } } else { if (commit_verbose (CFG_PREC_CFGFILE, &verbose, 0) == 0) pmsg (VL_DEBUG, "[cfgfile] line %u: verbose mode off\n", lexer_num_lines); } } break; case 12: #line 120 "cfg.y" { if (yyvsp[0].bval > 0) { if (commit_fbset (CFG_PREC_CFGFILE, &fbset, 1) == 0) pmsg (VL_DEBUG, "[cfgfile] line %u: fbset mode on\n", lexer_num_lines); } else { if (commit_fbset (CFG_PREC_CFGFILE, &fbset, 0) == 0) pmsg (VL_DEBUG, "[cfgfile] line %u: fbset mode off\n", lexer_num_lines); } } break; case 13: #line 137 "cfg.y" { if (yyvsp[0].bval > 0) { if (commit_nvidia (CFG_PREC_CFGFILE, &nvidia, 1) == 0) pmsg (VL_DEBUG, "[cfgfile] line %u: nvidia compatibility mode on\n", lexer_num_lines); } else { if (commit_nvidia (CFG_PREC_CFGFILE, &nvidia, 0) == 0) pmsg (VL_DEBUG, "[cfgfile] line %u: nvidia compatibility mode off\n", lexer_num_lines); } } break; case 14: #line 154 "cfg.y" { switch (commit_mode (CFG_PREC_CFGFILE, &modes, &num_modes, yyvsp[-2].ival, yyvsp[0].ival)) { case -1: break; case 0: { pmsg (VL_DEBUG, "[cfgfile] line %u: added mode %lux%lu\n", lexer_num_lines, yyvsp[-2].ival, yyvsp[0].ival); break; } case 5: { pmsg (VL_DEBUG, "[cfgfile] line %u: too many modes, dropping %lux%lu\n", lexer_num_lines, yyvsp[-2].ival, yyvsp[0].ival); pmsg (VL_VERBOSE, "no more than 256 modes are allowed, dropping %lux%lu\n", yyvsp[-2].ival, yyvsp[0].ival); break; } default: { pmsg (VL_DEBUG, "[cfgfile] line %u: invalid parameter %lux%lu\n", lexer_num_lines, yyvsp[-2].ival, yyvsp[0].ival); pmsg (VL_VERBOSE, "error at line %u: invalid parameter\n", lexer_num_lines); YYABORT; } } } break; case 15: #line 182 "cfg.y" { switch (commit_max_dotclk (CFG_PREC_CFGFILE, &max_dotclk, yyvsp[0].ival)) { case -1: break; case 0: { pmsg (VL_DEBUG, "[cfgfile] line %u: max_dotclk = %lu MHz\n", lexer_num_lines, yyvsp[0].ival); break; } default: { pmsg (VL_DEBUG, "[cfgfile] line %u: invalid parameter (max_dotclk = %lu MHz)\n", lexer_num_lines, yyvsp[0].ival); pmsg (VL_VERBOSE, "error at line %u: invalid parameter\n", lexer_num_lines); YYABORT; } } } break; case 16: #line 204 "cfg.y" { switch (commit_max_hfreq (CFG_PREC_CFGFILE, &max_hfreq, yyvsp[0].ival)) { case -1: break; case 0: { pmsg (VL_DEBUG, "[cfgfile] line %u: max_hfreq = %lu kHz\n", lexer_num_lines, yyvsp[0].ival); break; } default: { pmsg (VL_DEBUG, "[cfgfile] line %u: invalid parameter (max_hfreq = %lu kHz)\n", lexer_num_lines, yyvsp[0].ival); pmsg (VL_VERBOSE, "error at line %u: invalid parameter\n", lexer_num_lines); YYABORT; } } } break; case 17: #line 226 "cfg.y" { switch (commit_max_hfreq (CFG_PREC_CFGFILE, &max_hfreq, yyvsp[0].fval)) { case -1: break; case 0: { pmsg (VL_DEBUG, "[cfgfile] line %u: max_hfreq = %f kHz\n", lexer_num_lines, yyvsp[0].fval); break; } default: { pmsg (VL_DEBUG, "[cfgfile] line %u: invalid parameter (max_hfreq = %f kHz)\n", lexer_num_lines, yyvsp[0].fval); pmsg (VL_VERBOSE, "error at line %u: invalid parameter\n", lexer_num_lines); YYABORT; } } } break; case 18: #line 248 "cfg.y" { switch (commit_max_vfreq (CFG_PREC_CFGFILE, &max_vfreq, yyvsp[0].ival)) { case -1: break; case 0: { pmsg (VL_DEBUG, "[cfgfile] line %u: max_vfreq = %lu Hz\n", lexer_num_lines, yyvsp[0].ival); break; } default: { pmsg (VL_DEBUG, "[cfgfile] line %u: invalid parameter (max_vfreq = %lu Hz)\n", lexer_num_lines, yyvsp[0].ival); pmsg (VL_VERBOSE, "error at line %u: invalid parameter\n", lexer_num_lines); YYABORT; } } } break; case 19: #line 270 "cfg.y" { switch (commit_max_vfreq (CFG_PREC_CFGFILE, &max_vfreq, yyvsp[0].fval)) { case -1: break; case 0: { pmsg (VL_DEBUG, "[cfgfile] line %u: max_vfreq = %f Hz\n", lexer_num_lines, yyvsp[0].fval); break; } default: { pmsg (VL_DEBUG, "[cfgfile] line %u: invalid parameter (max_vfreq = %f Hz)\n", lexer_num_lines, yyvsp[0].fval); pmsg (VL_VERBOSE, "error at line %u: invalid parameter\n", lexer_num_lines); YYABORT; } } } break; case 20: #line 292 "cfg.y" { switch (commit_desired_vfreq (CFG_PREC_CFGFILE, &desired_vfreq, yyvsp[0].ival)) { case -1: break; case 0: { pmsg (VL_DEBUG, "[cfgfile] line %u: desired_vfreq = %lu Hz\n", lexer_num_lines, yyvsp[0].ival); break; } default: { pmsg (VL_DEBUG, "[cfgfile] line %u: invalid parameter (desired_vfreq = %lu Hz)\n", lexer_num_lines, yyvsp[0].ival); pmsg (VL_VERBOSE, "error at line %u: invalid parameter\n", lexer_num_lines); YYABORT; } } } break; case 21: #line 314 "cfg.y" { switch (commit_desired_vfreq (CFG_PREC_CFGFILE, &desired_vfreq, yyvsp[0].fval)) { case -1: break; case 0: { pmsg (VL_DEBUG, "[cfgfile] line %u: desired_vfreq = %f Hz\n", lexer_num_lines, yyvsp[0].fval); break; } default: { pmsg (VL_DEBUG, "[cfgfile] line %u: invalid parameter (desired_vfreq = %f Hz)\n", lexer_num_lines, yyvsp[0].fval); pmsg (VL_VERBOSE, "error at line %u: invalid parameter\n", lexer_num_lines); YYABORT; } } } break; case 22: #line 336 "cfg.y" { switch (commit_hvisible (CFG_PREC_CFGFILE, &hvisible, yyvsp[0].ival)) { case -1: break; case 0: { pmsg (VL_DEBUG, "[cfgfile] line %u: hvisible = %lu%%\n", lexer_num_lines, yyvsp[0].ival); break; } default: { pmsg (VL_DEBUG, "[cfgfile] line %u: invalid parameter (hvisible = %lu%%)\n", lexer_num_lines, yyvsp[0].ival); pmsg (VL_VERBOSE, "error at line %u: invalid parameter\n", lexer_num_lines); YYABORT; } } } break; case 23: #line 358 "cfg.y" { switch (commit_hvisible (CFG_PREC_CFGFILE, &hvisible, yyvsp[0].fval)) { case -1: break; case 0: { pmsg (VL_DEBUG, "[cfgfile] line %u: hvisible = %.4g%%\n", lexer_num_lines, yyvsp[0].fval); break; } default: { pmsg (VL_DEBUG, "[cfgfile] line %u: invalid parameter (hvisible = %.4g%%)\n", lexer_num_lines, yyvsp[0].fval); pmsg (VL_VERBOSE, "error at line %u: invalid parameter\n", lexer_num_lines); YYABORT; } } } break; case 24: #line 380 "cfg.y" { switch (commit_vvisible (CFG_PREC_CFGFILE, &vvisible, yyvsp[0].ival)) { case -1: break; case 0: { pmsg (VL_DEBUG, "[cfgfile] line %u: vvisible = %lu%%\n", lexer_num_lines, yyvsp[0].ival); break; } default: { pmsg (VL_DEBUG, "[cfgfile] line %u: invalid parameter (vvisible = %lu%%)\n", lexer_num_lines, yyvsp[0].ival); pmsg (VL_VERBOSE, "error at line %u: invalid parameter\n", lexer_num_lines); YYABORT; } } } break; case 25: #line 402 "cfg.y" { switch (commit_vvisible (CFG_PREC_CFGFILE, &vvisible, yyvsp[0].fval)) { case -1: break; case 0: { pmsg (VL_DEBUG, "[cfgfile] line %u: vvisible = %.4g%%\n", lexer_num_lines, yyvsp[0].fval); break; } default: { pmsg (VL_DEBUG, "[cfgfile] line %u: invalid parameter (vvisible = %.4g%%)\n", lexer_num_lines, yyvsp[0].fval); pmsg (VL_VERBOSE, "error at line %u: invalid parameter\n", lexer_num_lines); YYABORT; } } } break; case 26: #line 424 "cfg.y" { switch (commit_hfporch (CFG_PREC_CFGFILE, &hfporch, yyvsp[0].ival)) { case -1: break; case 0: { pmsg (VL_DEBUG, "[cfgfile] line %u: hfporch = %lu ticks\n", lexer_num_lines, yyvsp[0].ival); break; } default: { pmsg (VL_DEBUG, "[cfgfile] line %u: invalid parameter (hfporch = %lu ticks\n", lexer_num_lines, yyvsp[0].ival); pmsg (VL_VERBOSE, "error at line %u: invalid parameter\n", lexer_num_lines); YYABORT; } } } break; case 27: #line 446 "cfg.y" { switch (commit_hbporch (CFG_PREC_CFGFILE, &hbporch, yyvsp[0].ival)) { case -1: break; case 0: { pmsg (VL_DEBUG, "[cfgfile] line %u: hbporch = %lu ticks\n", lexer_num_lines, yyvsp[0].ival); break; } default: { pmsg (VL_DEBUG, "[cfgfile] line %u: invalid parameter (hbporch = %lu ticks\n", lexer_num_lines, yyvsp[0].ival); pmsg (VL_VERBOSE, "error at line %u: invalid parameter\n", lexer_num_lines); YYABORT; } } } break; case 28: #line 468 "cfg.y" { switch (commit_hsync (CFG_PREC_CFGFILE, &hsync, yyvsp[0].ival)) { case -1: break; case 0: { pmsg (VL_DEBUG, "[cfgfile] line %u: hsync = %lu us\n", lexer_num_lines, yyvsp[0].ival); break; } default: { pmsg (VL_DEBUG, "[cfgfile] line %u: invalid parameter (hsync = %lu us\n", lexer_num_lines, yyvsp[0].ival); pmsg (VL_VERBOSE, "error at line %u: invalid parameter\n", lexer_num_lines); YYABORT; } } } break; case 29: #line 490 "cfg.y" { switch (commit_hsync (CFG_PREC_CFGFILE, &hsync, yyvsp[0].fval)) { case -1: break; case 0: { pmsg (VL_DEBUG, "[cfgfile] line %u: hsync = %.4g us\n", lexer_num_lines, yyvsp[0].fval); break; } default: { pmsg (VL_DEBUG, "[cfgfile] line %u: invalid parameter (hsync = %.4g us\n", lexer_num_lines, yyvsp[0].fval); pmsg (VL_VERBOSE, "error at line %u: invalid parameter\n", lexer_num_lines); YYABORT; } } } break; case 30: #line 512 "cfg.y" { switch (commit_vfporch (CFG_PREC_CFGFILE, &vfporch, yyvsp[0].ival)) { case -1: break; case 0: { pmsg (VL_DEBUG, "[cfgfile] line %u: vfporch = %lu ticks\n", lexer_num_lines, yyvsp[0].ival); break; } default: { pmsg (VL_DEBUG, "[cfgfile] line %u: invalid parameter (vfporch = %lu ticks\n", lexer_num_lines, yyvsp[0].ival); pmsg (VL_VERBOSE, "error at line %u: invalid parameter\n", lexer_num_lines); YYABORT; } } } break; case 31: #line 534 "cfg.y" { switch (commit_vbporch (CFG_PREC_CFGFILE, &vbporch, yyvsp[0].ival)) { case -1: break; case 0: { pmsg (VL_DEBUG, "[cfgfile] line %u: vbporch = %lu ticks\n", lexer_num_lines, yyvsp[0].ival); break; } default: { pmsg (VL_DEBUG, "[cfgfile] line %u: invalid parameter (vbporch = %lu ticks\n", lexer_num_lines, yyvsp[0].ival); pmsg (VL_VERBOSE, "error at line %u: invalid parameter\n", lexer_num_lines); YYABORT; } } } break; case 32: #line 556 "cfg.y" { switch (commit_vsync (CFG_PREC_CFGFILE, &vsync, yyvsp[0].ival)) { case -1: break; case 0: { pmsg (VL_DEBUG, "[cfgfile] line %u: vsync = %lu us\n", lexer_num_lines, yyvsp[0].ival); break; } default: { pmsg (VL_DEBUG, "[cfgfile] line %u: invalid parameter (vsync = %lu us\n", lexer_num_lines, yyvsp[0].ival); pmsg (VL_VERBOSE, "error at line %u: invalid parameter\n", lexer_num_lines); YYABORT; } } } break; case 33: #line 578 "cfg.y" { switch (commit_vsync (CFG_PREC_CFGFILE, &vsync, yyvsp[0].fval)) { case -1: break; case 0: { pmsg (VL_DEBUG, "[cfgfile] line %u: vsync = %.4g us\n", lexer_num_lines, yyvsp[0].fval); break; } default: { pmsg (VL_DEBUG, "[cfgfile] line %u: invalid parameter (vsync = %.4g us\n", lexer_num_lines, yyvsp[0].fval); pmsg (VL_VERBOSE, "error at line %u: invalid parameter\n", lexer_num_lines); YYABORT; } } } break; } /* Line 1016 of /usr/share/bison/yacc.c. */ #line 1570 "cfg.tab.c" yyvsp -= yylen; yyssp -= yylen; #if YYDEBUG if (yydebug) { short *yyssp1 = yyss - 1; YYFPRINTF (stderr, "state stack now"); while (yyssp1 != yyssp) YYFPRINTF (stderr, " %d", *++yyssp1); YYFPRINTF (stderr, "\n"); } #endif *++yyvsp = yyval; /* Now `shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ yyn = yyr1[yyn]; yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) yystate = yytable[yystate]; else yystate = yydefgoto[yyn - YYNTOKENS]; goto yynewstate; /*------------------------------------. | yyerrlab -- here on detecting error | `------------------------------------*/ yyerrlab: /* If not already recovering from an error, report this error. */ if (!yyerrstatus) { ++yynerrs; #if YYERROR_VERBOSE yyn = yypact[yystate]; if (YYPACT_NINF < yyn && yyn < YYLAST) { YYSIZE_T yysize = 0; int yytype = YYTRANSLATE (yychar); char *yymsg; int yyx, yycount; yycount = 0; /* Start YYX at -YYN if negative to avoid negative indexes in YYCHECK. */ for (yyx = yyn < 0 ? -yyn : 0; yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++) if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) yysize += yystrlen (yytname[yyx]) + 15, yycount++; yysize += yystrlen ("parse error, unexpected ") + 1; yysize += yystrlen (yytname[yytype]); yymsg = (char *) YYSTACK_ALLOC (yysize); if (yymsg != 0) { char *yyp = yystpcpy (yymsg, "parse error, unexpected "); yyp = yystpcpy (yyp, yytname[yytype]); if (yycount < 5) { yycount = 0; for (yyx = yyn < 0 ? -yyn : 0; yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++) if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) { const char *yyq = ! yycount ? ", expecting " : " or "; yyp = yystpcpy (yyp, yyq); yyp = yystpcpy (yyp, yytname[yyx]); yycount++; } } yyerror (yymsg); YYSTACK_FREE (yymsg); } else yyerror ("parse error; also virtual memory exhausted"); } else #endif /* YYERROR_VERBOSE */ yyerror ("parse error"); } goto yyerrlab1; /*----------------------------------------------------. | yyerrlab1 -- error raised explicitly by an action. | `----------------------------------------------------*/ yyerrlab1: if (yyerrstatus == 3) { /* If just tried and failed to reuse lookahead token after an error, discard it. */ /* Return failure if at end of input. */ if (yychar == YYEOF) { /* Pop the error token. */ YYPOPSTACK; /* Pop the rest of the stack. */ while (yyssp > yyss) { YYDPRINTF ((stderr, "Error: popping ")); YYDSYMPRINT ((stderr, yystos[*yyssp], *yyvsp)); YYDPRINTF ((stderr, "\n")); yydestruct (yystos[*yyssp], *yyvsp); YYPOPSTACK; } YYABORT; } YYDPRINTF ((stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1])); yydestruct (yychar1, yylval); yychar = YYEMPTY; } /* Else will try to reuse lookahead token after shifting the error token. */ yyerrstatus = 3; /* Each real token shifted decrements this. */ for (;;) { yyn = yypact[yystate]; if (yyn != YYPACT_NINF) { yyn += YYTERROR; if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) { yyn = yytable[yyn]; if (0 < yyn) break; } } /* Pop the current state because it cannot handle the error token. */ if (yyssp == yyss) YYABORT; YYDPRINTF ((stderr, "Error: popping ")); YYDSYMPRINT ((stderr, yystos[*yyssp], *yyvsp)); YYDPRINTF ((stderr, "\n")); yydestruct (yystos[yystate], *yyvsp); yyvsp--; yystate = *--yyssp; #if YYDEBUG if (yydebug) { short *yyssp1 = yyss - 1; YYFPRINTF (stderr, "Error: state stack now"); while (yyssp1 != yyssp) YYFPRINTF (stderr, " %d", *++yyssp1); YYFPRINTF (stderr, "\n"); } #endif } if (yyn == YYFINAL) YYACCEPT; YYDPRINTF ((stderr, "Shifting error token, ")); *++yyvsp = yylval; yystate = yyn; goto yynewstate; /*-------------------------------------. | yyacceptlab -- YYACCEPT comes here. | `-------------------------------------*/ yyacceptlab: yyresult = 0; goto yyreturn; /*-----------------------------------. | yyabortlab -- YYABORT comes here. | `-----------------------------------*/ yyabortlab: yyresult = 1; goto yyreturn; #ifndef yyoverflow /*----------------------------------------------. | yyoverflowlab -- parser overflow comes here. | `----------------------------------------------*/ yyoverflowlab: yyerror ("parser stack overflow"); yyresult = 2; /* Fall through. */ #endif yyreturn: #ifndef yyoverflow if (yyss != yyssa) YYSTACK_FREE (yyss); #endif return yyresult; } #line 604 "cfg.y" void yyerror (char *errtext) { pmsg (VL_DEBUG, "[cfgfile] parse error at line %u: %s\n", lexer_num_lines, errtext); pmsg (VL_VERBOSE, "error at line %u: %s\n", lexer_num_lines, errtext); } /* EOF */ videogen-0.32/args.c0100644000175000001440000004150507570637173013256 0ustar rumiusers/* * +-------------------------------------------------------+ * | | * | videogen | * | | * | a simple XFree86 Modeline calculator | * | (c) 1997-2002, Szabolcs Rumi | * | | * | http://www.rtfm.hu/videogen | * | | * | the videogen package is distributed under the | * | GNU General Public License Version 2 (GPLv2) | * | | * +-------------------------------------------------------+ */ #include #include #include #include "config.h" #include "videogen.h" arg_opt_t opts[] = { { "-h", NULL, 0 }, { "-v", NULL, 0 }, { "-q", NULL, 0 }, { "-fb", NULL, 0 }, { "-nfb", NULL, 0 }, { "-nv", NULL, 0 }, { "-nnv", NULL, 0 }, { "-f", NULL, 0 }, { "-m", NULL, 0 }, { "-mdc", NULL, 0 }, { "-mhf", NULL, 0 }, { "-mvf", NULL, 0 }, { "-dvf", NULL, 0 }, { "-hv", NULL, 0 }, { "-vv", NULL, 0 }, { "-hfp", NULL, 0 }, { "-hbp", NULL, 0 }, { "-hsp", NULL, 0 }, { "-vfp", NULL, 0 }, { "-vbp", NULL, 0 }, { "-vsp", NULL, 0 }, { NULL, NULL, 0 } }; int arg_action (arg_parse_t *ap) { unsigned int x_uint, y_uint; double x_double; char *serr = NULL; /* for using with strtol(), strtod() */ /* fprintf (stdout, "argument %u matches option %u: %s == %s\n", ap->aindex, ap->oindex, (*ap->options)[ap->oindex].ao_option, (*ap->options)[ap->oindex].ao_parameter); */ /* * taking appropriate actions for each argument type */ switch (ap->oindex) { case 0: { banner (); usage (); exit (0); /* either reading help or using the program... */ break; } case 1: { if (commit_verbose (CFG_PREC_CMDLINE, &verbose, 1) == 0) pmsg (VL_DEBUG, "[cmdline] arg %u: verbose mode on\n", ap->aindex); break; } case 2: { if (commit_verbose (CFG_PREC_CMDLINE, &verbose, 0) == 0) pmsg (VL_DEBUG, "[cmdline] arg %u: verbose mode off\n", ap->aindex); break; } case 3: { if (commit_fbset (CFG_PREC_CMDLINE, &fbset, 1) == 0) pmsg (VL_DEBUG, "[cmdline] arg %u: fbset mode on\n", ap->aindex); break; } case 4: { if (commit_fbset (CFG_PREC_CMDLINE, &fbset, 0) == 0) pmsg (VL_DEBUG, "[cmdline] arg %u: fbset mode off\n", ap->aindex); break; } case 5: { if (commit_nvidia (CFG_PREC_CMDLINE, &nvidia, 1) == 0) pmsg (VL_DEBUG, "[cmdline] arg %u: nvidia compatibility mode on\n", ap->aindex); break; } case 6: { if (commit_nvidia (CFG_PREC_CMDLINE, &nvidia, 0) == 0) pmsg (VL_DEBUG, "[cmdline] arg %u: nvidia compatibility mode off\n", ap->aindex); break; } case 7: { if ((*ap->options)[ap->oindex].ao_flags & ARG_FOUND_PARM) { cfgfile = (*ap->options)[ap->oindex].ao_parameter; pmsg (VL_DEBUG, "[cmdline] arg %u: config file set to %s\n", ap->aindex, cfgfile); } break; } case 8: { if ((*ap->options)[ap->oindex].ao_flags & ARG_FOUND_PARM) { if (sscanf ((*ap->options)[ap->oindex].ao_parameter, "%ux%u", &x_uint, &y_uint) == 2) { switch (commit_mode (CFG_PREC_CMDLINE, &modes, &num_modes, x_uint, y_uint)) { case -1: break; case 0: { pmsg (VL_DEBUG, "[cmdline] arg %u: added mode %ux%u\n", ap->aindex, x_uint, y_uint); break; } case 5: { pmsg (VL_DEBUG, "[cmdline] arg %u: too many modes, dropping %ux%u\n", ap->aindex, x_uint, y_uint); pmsg (VL_VERBOSE, "no more than 256 modes are allowed, dropping %ux%u\n", x_uint, y_uint); break; } default: { pmsg (VL_DEBUG, "[cmdline] arg %u: %s has an invalid parameter \"%s\"\n", ap->aindex, (*ap->options)[ap->oindex].ao_option, (*ap->options)[ap->oindex].ao_parameter); pmsg (VL_VERBOSE, "argument %u (%s) has an invalid parameter\n", ap->aindex, ap->argv[ap->aindex]); return (-1); } } } else return (-1); } else return (-1); break; } case 9: { if ((*ap->options)[ap->oindex].ao_flags & ARG_FOUND_PARM) { x_double = strtod ((*ap->options)[ap->oindex].ao_parameter, &serr); if ((*(*ap->options)[ap->oindex].ao_parameter != '\0') && (*serr == '\0')) { switch (commit_max_dotclk (CFG_PREC_CMDLINE, &max_dotclk, x_double)) { case -1: break; case 0: { pmsg (VL_DEBUG, "[cmdline] arg %u: max_dotclk = %0.0f MHz\n", ap->aindex, x_double); break; } default: { pmsg (VL_DEBUG, "[cmdline] arg %u: %s has an invalid parameter \"%s\"\n", ap->aindex, (*ap->options)[ap->oindex].ao_option, (*ap->options)[ap->oindex].ao_parameter); pmsg (VL_VERBOSE, "argument %u (%s) has an invalid parameter\n", ap->aindex, ap->argv[ap->aindex]); return (-1); } } } else return (-1); } else return (-1); break; } case 10: { if ((*ap->options)[ap->oindex].ao_flags & ARG_FOUND_PARM) { x_double = strtod ((*ap->options)[ap->oindex].ao_parameter, &serr); if ((*(*ap->options)[ap->oindex].ao_parameter != '\0') && (*serr == '\0')) { switch (commit_max_hfreq (CFG_PREC_CMDLINE, &max_hfreq, x_double)) { case -1: break; case 0: { pmsg (VL_DEBUG, "[cmdline] arg %u: max_hfreq = %0.1f kHz\n", ap->aindex, x_double); break; } default: { pmsg (VL_DEBUG, "[cmdline] arg %u: %s has an invalid parameter \"%s\"\n", ap->aindex, (*ap->options)[ap->oindex].ao_option, (*ap->options)[ap->oindex].ao_parameter); pmsg (VL_VERBOSE, "argument %u (%s) has an invalid parameter\n", ap->aindex, ap->argv[ap->aindex]); return (-1); } } } else return (-1); } else return (-1); break; } case 11: { if ((*ap->options)[ap->oindex].ao_flags & ARG_FOUND_PARM) { x_double = strtod ((*ap->options)[ap->oindex].ao_parameter, &serr); if ((*(*ap->options)[ap->oindex].ao_parameter != '\0') && (*serr == '\0')) { switch (commit_max_vfreq (CFG_PREC_CMDLINE, &max_vfreq, x_double)) { case -1: break; case 0: { pmsg (VL_DEBUG, "[cmdline] arg %u: max_vfreq = %0.1f Hz\n", ap->aindex, x_double); break; } default: { pmsg (VL_DEBUG, "[cmdline] arg %u: %s has an invalid parameter \"%s\"\n", ap->aindex, (*ap->options)[ap->oindex].ao_option, (*ap->options)[ap->oindex].ao_parameter); pmsg (VL_VERBOSE, "argument %u (%s) has an invalid parameter\n", ap->aindex, ap->argv[ap->aindex]); return (-1); } } } else return (-1); } else return (-1); break; } case 12: { if ((*ap->options)[ap->oindex].ao_flags & ARG_FOUND_PARM) { x_double = strtod ((*ap->options)[ap->oindex].ao_parameter, &serr); if ((*(*ap->options)[ap->oindex].ao_parameter != '\0') && (*serr == '\0')) { switch (commit_desired_vfreq (CFG_PREC_CMDLINE, &desired_vfreq, x_double)) { case -1: break; case 0: { pmsg (VL_DEBUG, "[cmdline] arg %u: desired_vfreq = %0.1f Hz\n", ap->aindex, x_double); break; } default: { pmsg (VL_DEBUG, "[cmdline] arg %u: %s has an invalid parameter \"%s\"\n", ap->aindex, (*ap->options)[ap->oindex].ao_option, (*ap->options)[ap->oindex].ao_parameter); pmsg (VL_VERBOSE, "argument %u (%s) has an invalid parameter\n", ap->aindex, ap->argv[ap->aindex]); return (-1); } } } else return (-1); } else return (-1); break; } case 13: { if ((*ap->options)[ap->oindex].ao_flags & ARG_FOUND_PARM) { x_double = strtod ((*ap->options)[ap->oindex].ao_parameter, &serr); if ((*(*ap->options)[ap->oindex].ao_parameter != '\0') && (*serr == '\0')) { switch (commit_hvisible (CFG_PREC_CMDLINE, &hvisible, x_double)) { case -1: break; case 0: { pmsg (VL_DEBUG, "[cmdline] arg %u: hvisible = %0.0f %\n", ap->aindex, x_double); break; } default: { pmsg (VL_DEBUG, "[cmdline] arg %u: %s has an invalid parameter \"%s\"\n", ap->aindex, (*ap->options)[ap->oindex].ao_option, (*ap->options)[ap->oindex].ao_parameter); pmsg (VL_VERBOSE, "argument %u (%s) has an invalid parameter\n", ap->aindex, ap->argv[ap->aindex]); return (-1); } } } else return (-1); } else return (-1); break; } case 14: { if ((*ap->options)[ap->oindex].ao_flags & ARG_FOUND_PARM) { x_double = strtod ((*ap->options)[ap->oindex].ao_parameter, &serr); if ((*(*ap->options)[ap->oindex].ao_parameter != '\0') && (*serr == '\0')) { switch (commit_vvisible (CFG_PREC_CMDLINE, &vvisible, x_double)) { case -1: break; case 0: { pmsg (VL_DEBUG, "[cmdline] arg %u: vvisible = %0.0f %\n", ap->aindex, x_double); break; } default: { pmsg (VL_DEBUG, "[cmdline] arg %u: %s has an invalid parameter \"%s\"\n", ap->aindex, (*ap->options)[ap->oindex].ao_option, (*ap->options)[ap->oindex].ao_parameter); pmsg (VL_VERBOSE, "argument %u (%s) has an invalid parameter\n", ap->aindex, ap->argv[ap->aindex]); return (-1); } } } else return (-1); } else return (-1); break; } case 15: { if ((*ap->options)[ap->oindex].ao_flags & ARG_FOUND_PARM) { x_double = strtod ((*ap->options)[ap->oindex].ao_parameter, &serr); if ((*(*ap->options)[ap->oindex].ao_parameter != '\0') && (*serr == '\0')) { switch (commit_hfporch (CFG_PREC_CMDLINE, &hfporch, x_double)) { case -1: break; case 0: { pmsg (VL_DEBUG, "[cmdline] arg %u: hfporch = %0.0f ticks\n", ap->aindex, x_double); break; } default: { pmsg (VL_DEBUG, "[cmdline] arg %u: %s has an invalid parameter \"%s\"\n", ap->aindex, (*ap->options)[ap->oindex].ao_option, (*ap->options)[ap->oindex].ao_parameter); pmsg (VL_VERBOSE, "argument %u (%s) has an invalid parameter\n", ap->aindex, ap->argv[ap->aindex]); return (-1); } } } else return (-1); } else return (-1); break; } case 16: { if ((*ap->options)[ap->oindex].ao_flags & ARG_FOUND_PARM) { x_double = strtod ((*ap->options)[ap->oindex].ao_parameter, &serr); if ((*(*ap->options)[ap->oindex].ao_parameter != '\0') && (*serr == '\0')) { switch (commit_hbporch (CFG_PREC_CMDLINE, &hbporch, x_double)) { case -1: break; case 0: { pmsg (VL_DEBUG, "[cmdline] arg %u: hbporch = %0.0f ticks\n", ap->aindex, x_double); break; } default: { pmsg (VL_DEBUG, "[cmdline] arg %u: %s has an invalid parameter \"%s\"\n", ap->aindex, (*ap->options)[ap->oindex].ao_option, (*ap->options)[ap->oindex].ao_parameter); pmsg (VL_VERBOSE, "argument %u (%s) has an invalid parameter\n", ap->aindex, ap->argv[ap->aindex]); return (-1); } } } else return (-1); } else return (-1); break; } case 17: { if ((*ap->options)[ap->oindex].ao_flags & ARG_FOUND_PARM) { x_double = strtod ((*ap->options)[ap->oindex].ao_parameter, &serr); if ((*(*ap->options)[ap->oindex].ao_parameter != '\0') && (*serr == '\0')) { switch (commit_hsync (CFG_PREC_CMDLINE, &hsync, x_double)) { case -1: break; case 0: { pmsg (VL_DEBUG, "[cmdline] arg %u: hsync = %0.1f usec\n", ap->aindex, x_double); break; } default: { pmsg (VL_DEBUG, "[cmdline] arg %u: %s has an invalid parameter \"%s\"\n", ap->aindex, (*ap->options)[ap->oindex].ao_option, (*ap->options)[ap->oindex].ao_parameter); pmsg (VL_VERBOSE, "argument %u (%s) has an invalid parameter\n", ap->aindex, ap->argv[ap->aindex]); return (-1); } } } else return (-1); } else return (-1); break; } case 18: { if ((*ap->options)[ap->oindex].ao_flags & ARG_FOUND_PARM) { x_double = strtod ((*ap->options)[ap->oindex].ao_parameter, &serr); if ((*(*ap->options)[ap->oindex].ao_parameter != '\0') && (*serr == '\0')) { switch (commit_vfporch (CFG_PREC_CMDLINE, &vfporch, x_double)) { case -1: break; case 0: { pmsg (VL_DEBUG, "[cmdline] arg %u: vfporch = %0.0f ticks\n", ap->aindex, x_double); break; } default: { pmsg (VL_DEBUG, "[cmdline] arg %u: %s has an invalid parameter \"%s\"\n", ap->aindex, (*ap->options)[ap->oindex].ao_option, (*ap->options)[ap->oindex].ao_parameter); pmsg (VL_VERBOSE, "argument %u (%s) has an invalid parameter\n", ap->aindex, ap->argv[ap->aindex]); return (-1); } } } else return (-1); } else return (-1); break; } case 19: { if ((*ap->options)[ap->oindex].ao_flags & ARG_FOUND_PARM) { x_double = strtod ((*ap->options)[ap->oindex].ao_parameter, &serr); if ((*(*ap->options)[ap->oindex].ao_parameter != '\0') && (*serr == '\0')) { switch (commit_vbporch (CFG_PREC_CMDLINE, &vbporch, x_double)) { case -1: break; case 0: { pmsg (VL_DEBUG, "[cmdline] arg %u: vbporch = %0.0f ticks\n", ap->aindex, x_double); break; } default: { pmsg (VL_DEBUG, "[cmdline] arg %u: %s has an invalid parameter \"%s\"\n", ap->aindex, (*ap->options)[ap->oindex].ao_option, (*ap->options)[ap->oindex].ao_parameter); pmsg (VL_VERBOSE, "argument %u (%s) has an invalid parameter\n", ap->aindex, ap->argv[ap->aindex]); return (-1); } } } else return (-1); } else return (-1); break; } case 20: { if ((*ap->options)[ap->oindex].ao_flags & ARG_FOUND_PARM) { x_double = strtod ((*ap->options)[ap->oindex].ao_parameter, &serr); if ((*(*ap->options)[ap->oindex].ao_parameter != '\0') && (*serr == '\0')) { switch (commit_vsync (CFG_PREC_CMDLINE, &vsync, x_double)) { case -1: break; case 0: { pmsg (VL_DEBUG, "[cmdline] arg %u: vsync = %0.0f usec\n", ap->aindex, x_double); break; } default: { pmsg (VL_DEBUG, "[cmdline] arg %u: %s has an invalid parameter \"%s\"\n", ap->aindex, (*ap->options)[ap->oindex].ao_option, (*ap->options)[ap->oindex].ao_parameter); pmsg (VL_VERBOSE, "argument %u (%s) has an invalid parameter\n", ap->aindex, ap->argv[ap->aindex]); return (-1); } } } else return (-1); } else return (-1); break; } default: { pmsg (VL_DEBUG, "[cmdline] arg %u: unrecognized argument \"%s\"\n", ap->aindex, ap->argv[ap->aindex]); pmsg (VL_VERBOSE, "invalid argument %u (%s)\n", ap->aindex, ap->argv[ap->aindex]); return (-1); } } return (0); } int arg_parse (arg_parse_t *ap, int (*arg_action) (arg_parse_t *)) { char *eq; int match; /* * parse all arguments present on the command line */ ap->aindex = 1; while (ap->aindex < ap->argc) { ap->oindex = 0; match = 0; while ((*ap->options)[ap->oindex].ao_option != NULL) { if ((eq = strchr (ap->argv[ap->aindex], '=')) == NULL) { /* * argument does not have a parameter */ if (strcmp ((*ap->options)[ap->oindex].ao_option, ap->argv[ap->aindex]) == 0) { match++; (*ap->options)[ap->oindex].ao_flags |= ARG_FOUND; if ((*arg_action) (ap) < 0) return (-1); } } else { /* * argument does have a parameter */ *eq = '\0'; /* temporarily split string at the equal sign */ if (strcmp ((*ap->options)[ap->oindex].ao_option, ap->argv[ap->aindex]) == 0) { match++; (*ap->options)[ap->oindex].ao_flags |= ARG_FOUND; (*ap->options)[ap->oindex].ao_flags |= ARG_FOUND_PARM; (*ap->options)[ap->oindex].ao_parameter = eq + 1; *eq = '='; /* restore equal sign */ if ((*arg_action) (ap) < 0) return (-1); } else *eq = '='; /* restore equal sign */ } ap->oindex++; } if (((*ap->options)[ap->oindex].ao_option != NULL) && (match == 0)) { ap->oindex = -1; /* signal unmatched argument */ if ((*arg_action) (ap) < 0) return (-1); } ap->aindex++; } return (0); } /* EOF */ videogen-0.32/cfg.tab.h0100644000175000001440000000501107570640177013621 0ustar rumiusers/* A Bison parser, made from cfg.y, by GNU bison 1.75. */ /* Skeleton parser for Yacc-like parsing with Bison, Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* As a special exception, when this file is copied by Bison into a Bison output file, you may use that output file without restriction. This special exception was added by the Free Software Foundation in version 1.24 of Bison. */ #ifndef BISON_CFG_TAB_H # define BISON_CFG_TAB_H /* Tokens. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE /* Put the tokens into the symbol table, so that GDB and other debuggers know about them. */ enum yytokentype { T_INTEGER = 258, T_FLOAT = 259, T_BOOLEAN = 260, T_VERBOSE = 261, T_FBSET = 262, T_NVIDIA = 263, T_MODE = 264, T_MAX_DOTCLK = 265, T_MAX_HFREQ = 266, T_MAX_VFREQ = 267, T_DESIRED_VFREQ = 268, T_HVISIBLE = 269, T_VVISIBLE = 270, T_HFPORCH = 271, T_HBPORCH = 272, T_HSYNC = 273, T_VFPORCH = 274, T_VBPORCH = 275, T_VSYNC = 276 }; #endif #define T_INTEGER 258 #define T_FLOAT 259 #define T_BOOLEAN 260 #define T_VERBOSE 261 #define T_FBSET 262 #define T_NVIDIA 263 #define T_MODE 264 #define T_MAX_DOTCLK 265 #define T_MAX_HFREQ 266 #define T_MAX_VFREQ 267 #define T_DESIRED_VFREQ 268 #define T_HVISIBLE 269 #define T_VVISIBLE 270 #define T_HFPORCH 271 #define T_HBPORCH 272 #define T_HSYNC 273 #define T_VFPORCH 274 #define T_VBPORCH 275 #define T_VSYNC 276 #ifndef YYSTYPE #line 45 "cfg.y" typedef union { long int ival; /* integer value */ double fval; /* floating point value */ unsigned char bval; /* boolean value */ } yystype; /* Line 1281 of /usr/share/bison/yacc.c. */ #line 88 "cfg.tab.h" # define YYSTYPE yystype #endif extern YYSTYPE yylval; #endif /* not BISON_CFG_TAB_H */ videogen-0.32/videogen.sample0100644000175000001440000000047407566241560015155 0ustar rumiusers# # videogen sample configuration file # max_dotclk=300 max_hfreq=130; max_vfreq=160 # more parameters per line possible desired_vfreq=100 mode 320x200 # process several modes at a time mode 640x400 mode 640x480 mode 800x600 mode 1024x768 mode 1152x864 mode 1280x960 mode 1280x1024 mode 1600x1200 mode 2048x1536 videogen-0.32/THANKS0100644000175000001440000000165507570642753013073 0ustar rumiusers+-------------------------------------------------------+ | | | videogen | | | | a simple XFree86 Modeline calculator | | (c) 1997-2002, Szabolcs Rumi | | | | http://www.rtfm.hu/videogen | | | | the videogen package is distributed under the | | GNU General Public License Version 2 (GPLv2) | | | +-------------------------------------------------------+ I have to thank to the following people for helping me with their ideas/advices/comments/testing/bug-reporting etc.: Eduard Bloch Gerhard Olsson Dwayne Fontenot Matthias Buelow