now actually works (especially for double scan modes and the like)

This commit is contained in:
Bill Currie 2001-11-02 06:43:41 +00:00
parent f9ab09356e
commit 7b4e5e69af
2 changed files with 12 additions and 11 deletions

View file

@ -15,8 +15,6 @@
%{ %{
#define YYSTYPE long
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
@ -76,6 +74,7 @@ static int FindToken(const char *s)
for (i = 0; keywords[i].token > 0; i++) for (i = 0; keywords[i].token > 0; i++)
if (!strcasecmp(s, keywords[i].name)) { if (!strcasecmp(s, keywords[i].name)) {
yylval.int_val = keywords[i].value;
return keywords[i].token; return keywords[i].token;
} }
Die("%s:%d: Unknown keyword `%s'\n", Opt_modedb, line, s); Die("%s:%d: Unknown keyword `%s'\n", Opt_modedb, line, s);
@ -108,17 +107,16 @@ junk .
%% %%
{keyword} { {keyword} {
yylval = FindToken(yytext); return FindToken(yytext);
return yylval;
} }
{number} { {number} {
yylval = strtoul(yytext, NULL, 0); yylval.int_val = strtoul(yytext, NULL, 0);
return NUMBER; return NUMBER;
} }
{string} { {string} {
yylval = (unsigned long)CopyString(yytext); yylval.string = CopyString(yytext);
return STRING; return STRING;
} }

View file

@ -14,8 +14,6 @@
%{ %{
#define YYSTYPE long
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@ -41,10 +39,15 @@ static void ClearVideoMode(void)
%start file %start file
%union {
int int_val;
char *string;
}
%token MODE GEOMETRY TIMINGS HSYNC VSYNC CSYNC GSYNC EXTSYNC BCAST LACED DOUBLE %token MODE GEOMETRY TIMINGS HSYNC VSYNC CSYNC GSYNC EXTSYNC BCAST LACED DOUBLE
RGBA NONSTD ACCEL GRAYSCALE RGBA NONSTD ACCEL GRAYSCALE
ENDMODE POLARITY BOOLEAN STRING NUMBER %token <int_val> ENDMODE POLARITY BOOLEAN NUMBER
%token <string> STRING
%% %%
file : vmodes file : vmodes
@ -57,7 +60,7 @@ vmodes : /* empty */
vmode : MODE STRING geometry timings options ENDMODE vmode : MODE STRING geometry timings options ENDMODE
{ {
VideoMode.name = (char *)$2; VideoMode.name = $2;
AddVideoMode(&VideoMode); AddVideoMode(&VideoMode);
ClearVideoMode(); ClearVideoMode();
} }