/* A Bison parser, made from reconfig.y by GNU Bison version 1.25 */ #define YYBISON 1 /* Identify Bison output. */ #define ACCEL 258 #define AUTOREPEAT 259 #define BAUDRATE 260 #define BIOSBASE 261 #define BLACK 262 #define BUSMOUSE 263 #define CHIPSET 264 #define CHORDMIDDLE 265 #define CLEARDTR 266 #define CLEARRTS 267 #define CLOCKPROG 268 #define CLOCKS 269 #define CSYNC 270 #define DIRECTCOLOR 271 #define DISPLAYSIZE 272 #define DONTZAP 273 #define EMULATE3 274 #define FONTPATH 275 #define GRAYSCALE 276 #define INTERLACE 277 #define KEYBOARD 278 #define K_COMPOSE 279 #define K_CONTROL 280 #define K_META 281 #define K_MODELOCK 282 #define K_MODESHIFT 283 #define K_SCROLLLOCK 284 #define LEFTALT 285 #define LOGIMAN 286 #define LOGITECH 287 #define MEMBASE 288 #define MICROSOFT 289 #define MMHITTAB 290 #define MMSERIES 291 #define MODEDB 292 #define MODES 293 #define MONO 294 #define MOUSESYS 295 #define NHSYNC 296 #define NOSPEEDUP 297 #define NOTRAPSIGNALS 298 #define NVSYNC 299 #define OPTION 300 #define OSMOUSE 301 #define PHSYNC 302 #define PSEUDOCOLOR 303 #define PS_2 304 #define PVSYNC 305 #define RGBPATH 306 #define RIGHTALT 307 #define RIGHTCTL 308 #define SAMPLERATE 309 #define SCREENNO 310 #define SCROLLLOCK 311 #define SERVERNUM 312 #define SHAREDMON 313 #define SPEEDUP 314 #define STATICCOLOR 315 #define STATICGRAY 316 #define TRUECOLOR 317 #define VGA16 318 #define VGA2 319 #define VGA256 320 #define VIDEORAM 321 #define VIEWPORT 322 #define VIRTUAL 323 #define VTINIT 324 #define VTSYSREQ 325 #define WHITE 326 #define XLEDS 327 #define XQUE 328 #define RAMDAC 329 #define DACSPEED 330 #define IOBASE 331 #define DACBASE 332 #define COPBASE 333 #define POSBASE 334 #define INSTANCE 335 #define WRONG 336 #define STRING 337 #define NUMBER 338 #line 9 "reconfig.y" #include #include "os.h" #include "strlist.h" /* Author (of this quick hack): G.J. Akkerman * Usage: reconfig < OldXconfig > NewXconfig * * Notes: * This utility reads an Xconfig file into structures similar to those * in the server: one for server-global items, and one for each screen. * The datastructures used are however trivialized, since we don't want to * interpret data, but only to reshuffle it: * + Keywords without arguments are represented by ints (booleans) * + For keywords with arguments we use strings to represent those arguments * verbatim. (Even the quotes around strings are preserved.) In this way, we * avoid, for instance, round off errors. * After an Xconfig file is successfully read into the structures, we dump * them in the new format. We make up any required database keys, and we * give an arbitrary (and quite possibly wrong) monitor description. * In general, we do little error checking. It is possible that a wrong old * Xconfig file gets translated to a wrong new format Xconfig file. * * This is all the documentation there is. -- GJA. */ #define N_SCREENS 5 #define iVGA256 0 #define iVGA2 1 #define iMONO 2 #define iVGA16 3 #define iACCEL 4 #define fINTERLACE (1 << 0) #define fPHSYNC (1 << 1) #define fNHSYNC (1 << 2) #define fPVSYNC (1 << 3) #define fNVSYNC (1 << 4) #define fCSYNC (1 << 5) /* Indices for the keymaps */ #define N_KEYM 4 #define iLEFTALT 0 #define iRIGHTALT 1 #define iSCROLLLOCK 2 #define iRIGHTCTL 3 struct mode { char *mn; char *d; char *h1,*h2,*h3,*h4; char *v1,*v2,*v3,*v4; int flags; } ; typedef struct { int count; struct mode *datap; } mode_list ; struct general_struct { int Sharedmon; /* ? */ string_list *Fontpath; /* files */ char *Rgbpath; /* files */ int Notrapsignals; /* serverflags */ /* Keyboard stuff: */ char *Autorepeat1, *Autorepeat2; /* keyboard */ int Dontzap; /* serverflags */ int Servernum; /* keyboard */ char *Xleds; /* keyboard */ char *Vtinit; /* keyboard */ char *keymap[N_KEYM]; /* keyboard */ int Vtsysreq; /* keyboard */ /* Mouse stuff: */ char *mouse_name; /* pointer */ char *mouse_device; /* pointer */ char *Baudrate; /* pointer */ char *Samplerate; /* pointer */ int Emulate3 ; /* pointer */ int Chordmiddle ; /* pointer */ int Cleardtr ; /* pointer */ int Clearrts ; /* pointer */ } gen ; struct screen_struct { int configured; int Staticgray; /* screen.display */ int Grayscale ; /* screen.display */ int Staticcolor ; /* screen.display */ int Pseudocolor ; /* screen.display */ int Truecolor ; /* screen.display */ int Directcolor; /* screen.display */ char *Chipset; /* device */ char *Ramdac; /* device */ char *Dacspeed; /* device */ char *Clockchip; /* device */ string_list_list *Clocks; /* device */ char *Displaysize1,*Displaysize2 ; /* screen.display */ string_list *Modes; /* screen.display */ char *Screenno; /* screen */ string_list *Option; /* device */ char *Videoram; /* device */ char *Viewport1,*Viewport2; /* screen.display */ char *Virtual1,*Virtual2; /* screen.display */ char *Speedup; /* device */ int Nospeedup; /* device */ char *Clockprog1, *Clockprog2; /* device */ /* string + number */ char *Biosbase; /* device */ char *Membase; /* device */ char *Black1, *Black2, *Black3; /* screen.display */ char *White1, *White2, *White3; /* screen.display */ char *Iobase; /* device */ char *Dacbase; /* device */ char *Copbase; /* device */ char *Posbase; /* device */ char *Instance; /* device */ } screens[N_SCREENS] ; int scrn_index, kmap_index ; /* Indices */ int flags; /* Covert data path. */ char *modename; /* Covert data path. */ /* This is the *external* mode list. */ mode_list *modelist; mode_list *add_mode(); string_list_list *add_list(); string_list *add_string(); #define SCRN (screens[scrn_index]) #line 145 "reconfig.y" typedef union { char *string; char *number; string_list *stringlist; } YYSTYPE; #include #ifndef __cplusplus #ifndef __STDC__ #define const #endif #endif #define YYFINAL 184 #define YYFLAG -32768 #define YYNTBASE 84 #define YYTRANSLATE(x) ((unsigned)(x) <= 338 ? yytranslate[x] : 111) static const char yytranslate[] = { 0, 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, 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, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83 }; #if YYDEBUG != 0 static const short yyprhs[] = { 0, 0, 1, 4, 6, 9, 12, 14, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 56, 60, 61, 65, 66, 70, 71, 75, 76, 80, 81, 85, 88, 89, 90, 95, 96, 97, 110, 112, 114, 115, 118, 121, 124, 127, 130, 133, 134, 137, 139, 141, 143, 145, 147, 149, 152, 155, 158, 161, 164, 168, 171, 174, 177, 180, 184, 188, 191, 194, 196, 199, 203, 206, 209, 214, 219, 222, 225, 228, 231, 234, 235, 238, 239, 242, 243, 246, 250, 252, 254, 257, 260, 261, 265, 266, 270, 271, 275, 276, 280, 282, 284, 286, 288, 290, 292, 294, 295, 298, 301, 304, 306, 308, 310 }; static const short yyrhs[] = { -1, 84, 85, 0, 58, 0, 20, 96, 0, 51, 96, 0, 43, 0, 23, 102, 0, 34, 96, 109, 0, 40, 96, 109, 0, 36, 96, 109, 0, 32, 96, 109, 0, 8, 96, 109, 0, 31, 96, 109, 0, 49, 96, 109, 0, 35, 96, 109, 0, 73, 102, 109, 0, 46, 109, 0, 46, 96, 109, 0, 0, 65, 86, 98, 0, 0, 64, 87, 98, 0, 0, 39, 88, 98, 0, 0, 63, 89, 98, 0, 0, 3, 90, 98, 0, 37, 91, 0, 0, 0, 91, 96, 92, 93, 0, 0, 0, 93, 95, 95, 95, 95, 95, 95, 95, 95, 95, 94, 97, 0, 83, 0, 82, 0, 0, 97, 22, 0, 97, 47, 0, 97, 41, 0, 97, 50, 0, 97, 44, 0, 97, 15, 0, 0, 98, 99, 0, 61, 0, 21, 0, 60, 0, 48, 0, 62, 0, 16, 0, 9, 96, 0, 74, 96, 0, 75, 95, 0, 14, 96, 0, 14, 100, 0, 17, 95, 95, 0, 38, 101, 0, 55, 95, 0, 45, 96, 0, 66, 95, 0, 67, 95, 95, 0, 68, 95, 95, 0, 59, 96, 0, 59, 95, 0, 42, 0, 13, 96, 0, 13, 96, 95, 0, 6, 95, 0, 33, 95, 0, 7, 95, 95, 95, 0, 71, 95, 95, 95, 0, 76, 95, 0, 77, 95, 0, 78, 95, 0, 79, 95, 0, 80, 95, 0, 0, 100, 95, 0, 0, 101, 96, 0, 0, 102, 103, 0, 4, 95, 95, 0, 18, 0, 57, 0, 72, 95, 0, 69, 96, 0, 0, 30, 104, 108, 0, 0, 52, 105, 108, 0, 0, 56, 106, 108, 0, 0, 53, 107, 108, 0, 70, 0, 26, 0, 24, 0, 28, 0, 27, 0, 29, 0, 25, 0, 0, 109, 110, 0, 5, 95, 0, 54, 95, 0, 19, 0, 10, 0, 11, 0, 12, 0 }; #endif #if YYDEBUG != 0 static const short yyrline[] = { 0, 179, 180, 183, 184, 185, 186, 187, 188, 193, 196, 199, 202, 205, 208, 211, 214, 217, 220, 224, 228, 228, 230, 230, 232, 232, 234, 234, 236, 236, 239, 240, 241, 243, 244, 250, 253, 255, 257, 258, 259, 260, 261, 262, 263, 266, 267, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 283, 284, 285, 286, 287, 289, 291, 292, 293, 294, 295, 297, 298, 299, 301, 303, 304, 305, 306, 307, 310, 311, 314, 315, 319, 320, 322, 324, 325, 326, 327, 328, 329, 329, 330, 330, 331, 331, 332, 332, 335, 336, 337, 338, 339, 340, 343, 344, 346, 347, 348, 349, 350, 351 }; #endif #if YYDEBUG != 0 || defined (YYERROR_VERBOSE) static const char * const yytname[] = { "$","error","$undefined.","ACCEL", "AUTOREPEAT","BAUDRATE","BIOSBASE","BLACK","BUSMOUSE","CHIPSET","CHORDMIDDLE", "CLEARDTR","CLEARRTS","CLOCKPROG","CLOCKS","CSYNC","DIRECTCOLOR","DISPLAYSIZE", "DONTZAP","EMULATE3","FONTPATH","GRAYSCALE","INTERLACE","KEYBOARD","K_COMPOSE", "K_CONTROL","K_META","K_MODELOCK","K_MODESHIFT","K_SCROLLLOCK","LEFTALT","LOGIMAN", "LOGITECH","MEMBASE","MICROSOFT","MMHITTAB","MMSERIES","MODEDB","MODES","MONO", "MOUSESYS","NHSYNC","NOSPEEDUP","NOTRAPSIGNALS","NVSYNC","OPTION","OSMOUSE", "PHSYNC","PSEUDOCOLOR","PS_2","PVSYNC","RGBPATH","RIGHTALT","RIGHTCTL","SAMPLERATE", "SCREENNO","SCROLLLOCK","SERVERNUM","SHAREDMON","SPEEDUP","STATICCOLOR","STATICGRAY", "TRUECOLOR","VGA16","VGA2","VGA256","VIDEORAM","VIEWPORT","VIRTUAL","VTINIT", "VTSYSREQ","WHITE","XLEDS","XQUE","RAMDAC","DACSPEED","IOBASE","DACBASE","COPBASE", "POSBASE","INSTANCE","WRONG","STRING","NUMBER","file","top","@1","@2","@3","@4", "@5","modedb","@6","modes","@7","number","string","flags","graphicsconfig","gstmt", "clocks","strings","keyboardconfig","keybstmt","@8","@9","@10","@11","keymap", "mouseconfig","mousestmt", NULL }; #endif static const short yyr1[] = { 0, 84, 84, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 86, 85, 87, 85, 88, 85, 89, 85, 90, 85, 85, 91, 92, 91, 93, 94, 93, 95, 96, 97, 97, 97, 97, 97, 97, 97, 98, 98, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 100, 100, 101, 101, 102, 102, 103, 103, 103, 103, 103, 104, 103, 105, 103, 106, 103, 107, 103, 103, 108, 108, 108, 108, 108, 108, 109, 109, 110, 110, 110, 110, 110, 110 }; static const short yyr2[] = { 0, 0, 2, 1, 2, 2, 1, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 3, 0, 3, 0, 3, 0, 3, 0, 3, 0, 3, 2, 0, 0, 4, 0, 0, 12, 1, 1, 0, 2, 2, 2, 2, 2, 2, 0, 2, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, 3, 3, 2, 2, 1, 2, 3, 2, 2, 4, 4, 2, 2, 2, 2, 2, 0, 2, 0, 2, 0, 2, 3, 1, 1, 2, 2, 0, 3, 0, 3, 0, 3, 0, 3, 1, 1, 1, 1, 1, 1, 1, 0, 2, 2, 2, 1, 1, 1, 1 }; static const short yydefact[] = { 1, 0, 27, 0, 0, 83, 0, 0, 0, 0, 0, 30, 23, 0, 6, 105, 0, 0, 3, 25, 21, 19, 83, 2, 45, 37, 105, 4, 7, 105, 105, 105, 105, 105, 29, 45, 105, 105, 17, 105, 5, 45, 45, 45, 105, 28, 12, 0, 86, 90, 92, 96, 94, 87, 0, 98, 0, 84, 13, 11, 8, 15, 10, 31, 24, 9, 18, 0, 110, 111, 112, 109, 0, 106, 14, 26, 22, 20, 16, 0, 0, 0, 0, 79, 52, 0, 48, 0, 81, 67, 0, 50, 0, 0, 49, 47, 51, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 46, 36, 0, 0, 0, 0, 0, 89, 88, 33, 107, 108, 70, 0, 53, 68, 56, 57, 0, 71, 59, 61, 60, 66, 65, 62, 0, 0, 0, 54, 55, 74, 75, 76, 77, 78, 85, 100, 104, 99, 102, 101, 103, 91, 93, 97, 95, 32, 0, 69, 80, 58, 82, 63, 64, 0, 0, 72, 73, 0, 0, 0, 0, 0, 0, 0, 34, 38, 35, 44, 39, 41, 43, 40, 42, 0, 0 }; static const short yydefgoto[] = { 1, 23, 43, 42, 35, 41, 24, 34, 117, 155, 175, 110, 26, 176, 45, 108, 125, 128, 28, 57, 111, 112, 114, 113, 151, 38, 73 }; static const short yypact[] = {-32768, 154,-32768, -81, -81,-32768, -81, -81, -81, -81, -81, -32768,-32768, -81,-32768, -81, -81, -81,-32768,-32768,-32768, -32768,-32768,-32768,-32768,-32768,-32768,-32768, 18,-32768,-32768, -32768,-32768,-32768, -81,-32768,-32768,-32768, 13,-32768,-32768, -32768,-32768,-32768, 18, 104, 13, -73,-32768,-32768,-32768, -32768,-32768,-32768, -81,-32768, -73,-32768, 13, 13, 13, 13, 13,-32768, 104, 13, 13, -73,-32768,-32768,-32768, -32768, -73,-32768, 13, 104, 104, 104, 13, -73, -73, -81, -81, -81,-32768, -73,-32768, -73,-32768,-32768, -81, -32768, -73, -75,-32768,-32768,-32768, -73, -73, -73, -73, -81, -73, -73, -73, -73, -73, -73,-32768,-32768, -73, 74, 74, 74, 74,-32768,-32768,-32768,-32768,-32768,-32768, -73,-32768, -73,-32768, -73, -73,-32768, -81,-32768,-32768, -32768,-32768,-32768, -73, -73, -73,-32768,-32768,-32768,-32768, -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, -32768,-32768,-32768,-32768, -73, -73,-32768,-32768,-32768,-32768, -32768,-32768, -73, -73,-32768,-32768, -73, -73, -73, -73, -73, -73, -73,-32768,-32768, 94,-32768,-32768,-32768,-32768, -32768,-32768, 14,-32768 }; static const short yypgoto[] = {-32768, -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, -41, -4,-32768, -14,-32768,-32768,-32768, -6,-32768,-32768, -32768,-32768,-32768, -79, 199,-32768 }; #define YYLAST 243 static const short yytable[] = { 27, 25, 29, 30, 31, 32, 33, 25, 109, 36, 109, 37, 39, 40, 184, 116, 44, 0, 67, 0, 0, 64, 47, 68, 69, 70, 118, 75, 76, 77, 63, 119, 71, 152, 153, 154, 48, 0, 120, 121, 0, 0, 0, 0, 126, 0, 127, 0, 49, 0, 115, 130, 131, 0, 0, 0, 133, 134, 135, 136, 0, 138, 139, 140, 141, 142, 143, 72, 0, 144, 50, 51, 0, 0, 52, 53, 0, 122, 123, 124, 156, 0, 157, 0, 158, 159, 129, 54, 55, 132, 56, 0, 0, 161, 162, 163, 0, 137, 145, 146, 147, 148, 149, 150, 0, 0, 0, 0, 0, 177, 79, 80, 0, 81, 164, 165, 178, 82, 83, 0, 84, 85, 166, 167, 160, 86, 168, 169, 170, 171, 172, 173, 174, 0, 0, 179, 0, 87, 180, 0, 0, 181, 88, 0, 182, 0, 89, 0, 0, 90, 0, 0, 91, 0, 183, 0, 0, 2, 0, 92, 0, 0, 3, 93, 94, 95, 96, 0, 0, 0, 97, 98, 99, 0, 4, 100, 0, 5, 101, 102, 103, 104, 105, 106, 107, 6, 7, 0, 8, 9, 10, 11, 0, 12, 13, 0, 0, 14, 0, 0, 15, 0, 0, 16, 0, 17, 0, 0, 0, 0, 0, 0, 18, 0, 0, 0, 0, 19, 20, 21, 0, 0, 0, 0, 0, 46, 0, 22, 58, 59, 60, 61, 62, 0, 0, 65, 66, 0, 74, 0, 0, 0, 0, 78 }; static const short yycheck[] = { 4, 82, 6, 7, 8, 9, 10, 82, 83, 13, 83, 15, 16, 17, 0, 56, 22, -1, 5, -1, -1, 35, 4, 10, 11, 12, 67, 41, 42, 43, 34, 72, 19, 112, 113, 114, 18, -1, 79, 80, -1, -1, -1, -1, 85, -1, 87, -1, 30, -1, 54, 92, 93, -1, -1, -1, 97, 98, 99, 100, -1, 102, 103, 104, 105, 106, 107, 54, -1, 110, 52, 53, -1, -1, 56, 57, -1, 81, 82, 83, 121, -1, 123, -1, 125, 126, 90, 69, 70, 93, 72, -1, -1, 134, 135, 136, -1, 101, 24, 25, 26, 27, 28, 29, -1, -1, -1, -1, -1, 15, 6, 7, -1, 9, 155, 156, 22, 13, 14, -1, 16, 17, 163, 164, 128, 21, 167, 168, 169, 170, 171, 172, 173, -1, -1, 41, -1, 33, 44, -1, -1, 47, 38, -1, 50, -1, 42, -1, -1, 45, -1, -1, 48, -1, 0, -1, -1, 3, -1, 55, -1, -1, 8, 59, 60, 61, 62, -1, -1, -1, 66, 67, 68, -1, 20, 71, -1, 23, 74, 75, 76, 77, 78, 79, 80, 31, 32, -1, 34, 35, 36, 37, -1, 39, 40, -1, -1, 43, -1, -1, 46, -1, -1, 49, -1, 51, -1, -1, -1, -1, -1, -1, 58, -1, -1, -1, -1, 63, 64, 65, -1, -1, -1, -1, -1, 26, -1, 73, 29, 30, 31, 32, 33, -1, -1, 36, 37, -1, 39, -1, -1, -1, -1, 44 }; /* -*-C-*- Note some compilers choke on comments on `#line' lines. */ #line 3 "bison.simple" /* Skeleton output parser for bison, Copyright (C) 1984, 1989, 1990 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., 675 Mass Ave, Cambridge, MA 02139, 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 alloca #ifdef __GNUC__ #define alloca __builtin_alloca #else /* not GNU C. */ #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) #include #else /* not sparc */ #if defined (MSDOS) && !defined (__TURBOC__) #include #else /* not MSDOS, or __TURBOC__ */ #if defined(_AIX) #include #pragma alloca #else /* not MSDOS, __TURBOC__, or _AIX */ #ifdef __hpux #ifdef __cplusplus extern "C" { void *alloca (unsigned int); }; #else /* not __cplusplus */ void *alloca (); #endif /* not __cplusplus */ #endif /* __hpux */ #endif /* not _AIX */ #endif /* not MSDOS, or __TURBOC__ */ #endif /* not sparc. */ #endif /* not GNU C. */ #endif /* alloca not defined. */ /* This is the parser code that is written into each bison parser when the %semantic_parser declaration is not specified in the grammar. It was written by Richard Stallman by simplifying the hairy parser used when %semantic_parser is specified. */ /* Note: there must be only one dollar sign in this file. It is replaced by the list of actions, each action as one case of the switch. */ #define yyerrok (yyerrstatus = 0) #define yyclearin (yychar = YYEMPTY) #define YYEMPTY -2 #define YYEOF 0 #define YYACCEPT return(0) #define YYABORT return(1) #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 #ifndef YYPURE #define YYLEX yylex() #endif #ifdef YYPURE #ifdef YYLSP_NEEDED #ifdef YYLEX_PARAM #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM) #else #define YYLEX yylex(&yylval, &yylloc) #endif #else /* not YYLSP_NEEDED */ #ifdef YYLEX_PARAM #define YYLEX yylex(&yylval, YYLEX_PARAM) #else #define YYLEX yylex(&yylval) #endif #endif /* not YYLSP_NEEDED */ #endif /* If nonreentrant, generate the variables here */ #ifndef YYPURE int yychar; /* the lookahead symbol */ YYSTYPE yylval; /* the semantic value of the */ /* lookahead symbol */ #ifdef YYLSP_NEEDED YYLTYPE yylloc; /* location data for the lookahead */ /* symbol */ #endif int yynerrs; /* number of parse errors so far */ #endif /* not YYPURE */ #if YYDEBUG != 0 int yydebug; /* nonzero means print parse trace */ /* Since this is uninitialized, it does not stop multiple parsers from coexisting. */ #endif /* YYINITDEPTH indicates the initial size of the parser's stacks */ #ifndef YYINITDEPTH #define YYINITDEPTH 200 #endif /* YYMAXDEPTH is the maximum size the stacks can grow to (effective only if the built-in stack extension method is used). */ #if YYMAXDEPTH == 0 #undef YYMAXDEPTH #endif #ifndef YYMAXDEPTH #define YYMAXDEPTH 10000 #endif /* Prevent warning if -Wstrict-prototypes. */ #ifdef __GNUC__ int yyparse (void); #endif #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */ #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT) #else /* not GNU C or C++ */ #ifndef __cplusplus /* This is the most reliable way to avoid incompatibilities in available built-in functions on various systems. */ static void __yy_memcpy (to, from, count) char *to; char *from; int count; { register char *f = from; register char *t = to; register int i = count; while (i-- > 0) *t++ = *f++; } #else /* __cplusplus */ /* This is the most reliable way to avoid incompatibilities in available built-in functions on various systems. */ static void __yy_memcpy (char *to, char *from, int count) { register char *f = from; register char *t = to; register int i = count; while (i-- > 0) *t++ = *f++; } #endif #endif #line 196 "bison.simple" /* 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 #ifdef __cplusplus #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM #define YYPARSE_PARAM_DECL #else /* not __cplusplus */ #define YYPARSE_PARAM_ARG YYPARSE_PARAM #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; #endif /* not __cplusplus */ #else /* not YYPARSE_PARAM */ #define YYPARSE_PARAM_ARG #define YYPARSE_PARAM_DECL #endif /* not YYPARSE_PARAM */ int yyparse(YYPARSE_PARAM_ARG) YYPARSE_PARAM_DECL { register int yystate; register int yyn; register short *yyssp; register YYSTYPE *yyvsp; int yyerrstatus; /* number of tokens to shift before error messages enabled */ int yychar1 = 0; /* lookahead token as an internal (translated) token number */ short yyssa[YYINITDEPTH]; /* the state stack */ YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */ short *yyss = yyssa; /* refer to the stacks thru separate pointers */ YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */ #ifdef YYLSP_NEEDED YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */ YYLTYPE *yyls = yylsa; YYLTYPE *yylsp; #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) #else #define YYPOPSTACK (yyvsp--, yyssp--) #endif int yystacksize = YYINITDEPTH; #ifdef YYPURE int yychar; YYSTYPE yylval; int yynerrs; #ifdef YYLSP_NEEDED YYLTYPE yylloc; #endif #endif YYSTYPE yyval; /* the variable used to return */ /* semantic values from the action */ /* routines */ int yylen; #if YYDEBUG != 0 if (yydebug) fprintf(stderr, "Starting parse\n"); #endif 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 - 1; yyvsp = yyvs; #ifdef YYLSP_NEEDED yylsp = yyls; #endif /* Push a new state, which is found in yystate . */ /* In all cases, when you get here, the value and location stacks have just been pushed. so pushing a state here evens the stacks. */ yynewstate: *++yyssp = yystate; if (yyssp >= yyss + yystacksize - 1) { /* 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; #ifdef YYLSP_NEEDED YYLTYPE *yyls1 = yyls; #endif /* Get the current used size of the three stacks, in elements. */ int size = yyssp - yyss + 1; #ifdef yyoverflow /* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. */ #ifdef YYLSP_NEEDED /* 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, size * sizeof (*yyssp), &yyvs1, size * sizeof (*yyvsp), &yyls1, size * sizeof (*yylsp), &yystacksize); #else yyoverflow("parser stack overflow", &yyss1, size * sizeof (*yyssp), &yyvs1, size * sizeof (*yyvsp), &yystacksize); #endif yyss = yyss1; yyvs = yyvs1; #ifdef YYLSP_NEEDED yyls = yyls1; #endif #else /* no yyoverflow */ /* Extend the stack our own way. */ if (yystacksize >= YYMAXDEPTH) { yyerror("parser stack overflow"); return 2; } yystacksize *= 2; if (yystacksize > YYMAXDEPTH) yystacksize = YYMAXDEPTH; yyss = (short *) alloca (yystacksize * sizeof (*yyssp)); __yy_memcpy ((char *)yyss, (char *)yyss1, size * sizeof (*yyssp)); yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp)); __yy_memcpy ((char *)yyvs, (char *)yyvs1, size * sizeof (*yyvsp)); #ifdef YYLSP_NEEDED yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp)); __yy_memcpy ((char *)yyls, (char *)yyls1, size * sizeof (*yylsp)); #endif #endif /* no yyoverflow */ yyssp = yyss + size - 1; yyvsp = yyvs + size - 1; #ifdef YYLSP_NEEDED yylsp = yyls + size - 1; #endif #if YYDEBUG != 0 if (yydebug) fprintf(stderr, "Stack size increased to %d\n", yystacksize); #endif if (yyssp >= yyss + yystacksize - 1) YYABORT; } #if YYDEBUG != 0 if (yydebug) fprintf(stderr, "Entering state %d\n", yystate); #endif goto 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 == YYFLAG) 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) { #if YYDEBUG != 0 if (yydebug) fprintf(stderr, "Reading a token: "); #endif 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 */ #if YYDEBUG != 0 if (yydebug) fprintf(stderr, "Now at end of input.\n"); #endif } else { yychar1 = YYTRANSLATE(yychar); #if YYDEBUG != 0 if (yydebug) { fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]); /* Give the individual parser a way to print the precise meaning of a token, for further debugging info. */ #ifdef YYPRINT YYPRINT (stderr, yychar, yylval); #endif fprintf (stderr, ")\n"); } #endif } yyn += yychar1; if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1) goto yydefault; yyn = yytable[yyn]; /* yyn is what to do for this token type in this state. Negative => reduce, -yyn is rule number. Positive => shift, yyn is new state. New state is final state => don't bother to shift, just return success. 0, or most negative number => error. */ if (yyn < 0) { if (yyn == YYFLAG) goto yyerrlab; yyn = -yyn; goto yyreduce; } else if (yyn == 0) goto yyerrlab; if (yyn == YYFINAL) YYACCEPT; /* Shift the lookahead token. */ #if YYDEBUG != 0 if (yydebug) fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]); #endif /* Discard the token being shifted unless it is eof. */ if (yychar != YYEOF) yychar = YYEMPTY; *++yyvsp = yylval; #ifdef YYLSP_NEEDED *++yylsp = yylloc; #endif /* count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; yystate = yyn; goto yynewstate; /* Do the default action for the current state. */ yydefault: yyn = yydefact[yystate]; if (yyn == 0) goto yyerrlab; /* Do a reduction. yyn is the number of a rule to reduce with. */ yyreduce: yylen = yyr2[yyn]; if (yylen > 0) yyval = yyvsp[1-yylen]; /* implement default value of the action */ #if YYDEBUG != 0 if (yydebug) { int i; fprintf (stderr, "Reducing via rule %d (line %d), ", yyn, yyrline[yyn]); /* Print the symbols being reduced, and their result. */ for (i = yyprhs[yyn]; yyrhs[i] > 0; i++) fprintf (stderr, "%s ", yytname[yyrhs[i]]); fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]); } #endif switch (yyn) { case 3: #line 184 "reconfig.y" { gen.Sharedmon = 1; ; break;} case 4: #line 185 "reconfig.y" { gen.Fontpath = add_string(gen.Fontpath,yyvsp[0].string); ; break;} case 5: #line 186 "reconfig.y" { gen.Rgbpath = yyvsp[0].string; ; break;} case 6: #line 187 "reconfig.y" { gen.Notrapsignals = 1; ; break;} case 8: #line 192 "reconfig.y" { gen.mouse_device = yyvsp[-1].string; gen.mouse_name = "microsoft"; ; break;} case 9: #line 195 "reconfig.y" { gen.mouse_device = yyvsp[-1].string; gen.mouse_name = "mousesystems"; ; break;} case 10: #line 198 "reconfig.y" { gen.mouse_device = yyvsp[-1].string; gen.mouse_name = "mmseries"; ; break;} case 11: #line 201 "reconfig.y" { gen.mouse_device = yyvsp[-1].string; gen.mouse_name = "logitech"; ; break;} case 12: #line 204 "reconfig.y" { gen.mouse_device = yyvsp[-1].string; gen.mouse_name = "busmouse"; ; break;} case 13: #line 207 "reconfig.y" { gen.mouse_device = yyvsp[-1].string; gen.mouse_name = "mouseman"; ; break;} case 14: #line 210 "reconfig.y" { gen.mouse_device = yyvsp[-1].string; gen.mouse_name = "ps/2"; ; break;} case 15: #line 213 "reconfig.y" { gen.mouse_device = yyvsp[-1].string; gen.mouse_name = "mmhittab"; ; break;} case 16: #line 217 "reconfig.y" { gen.mouse_name = "xqueue"; ; break;} case 17: #line 220 "reconfig.y" { gen.mouse_name = "osmouse"; ; break;} case 18: #line 223 "reconfig.y" { gen.mouse_device = yyvsp[-1].string; gen.mouse_name = "osmouse"; ; break;} case 19: #line 227 "reconfig.y" { scrn_index = iVGA256; SCRN.configured = 1; ; break;} case 21: #line 229 "reconfig.y" { scrn_index = iVGA2; SCRN.configured = 1; ; break;} case 23: #line 231 "reconfig.y" { scrn_index = iMONO; SCRN.configured = 1; ; break;} case 25: #line 233 "reconfig.y" { scrn_index = iVGA16; SCRN.configured = 1; ; break;} case 27: #line 235 "reconfig.y" { scrn_index = iACCEL; SCRN.configured = 1; ; break;} case 30: #line 240 "reconfig.y" { modelist = NULL; ; break;} case 31: #line 241 "reconfig.y" { modename = yyvsp[0].string; ; break;} case 34: #line 249 "reconfig.y" { flags = 0; ; break;} case 35: #line 250 "reconfig.y" { modelist = add_mode(modelist, modename, yyvsp[-10].number, yyvsp[-9].number,yyvsp[-8].number,yyvsp[-7].number,yyvsp[-6].number, yyvsp[-5].number,yyvsp[-4].number,yyvsp[-3].number,yyvsp[-2].number, flags); ; break;} case 36: #line 253 "reconfig.y" { yyval.number = yyvsp[0].number; ; break;} case 37: #line 255 "reconfig.y" { yyval.string = yyvsp[0].string; ; break;} case 39: #line 259 "reconfig.y" { flags |= fINTERLACE; ; break;} case 40: #line 260 "reconfig.y" { flags |= fPHSYNC; ; break;} case 41: #line 261 "reconfig.y" { flags |= fNHSYNC; ; break;} case 42: #line 262 "reconfig.y" { flags |= fPVSYNC; ; break;} case 43: #line 263 "reconfig.y" { flags |= fNVSYNC; ; break;} case 44: #line 264 "reconfig.y" { flags |= fCSYNC; ; break;} case 47: #line 271 "reconfig.y" { SCRN.Staticgray = 1; ; break;} case 48: #line 272 "reconfig.y" { SCRN.Grayscale = 1; ; break;} case 49: #line 273 "reconfig.y" { SCRN.Staticcolor = 1; ; break;} case 50: #line 274 "reconfig.y" { SCRN.Pseudocolor = 1; ; break;} case 51: #line 275 "reconfig.y" { SCRN.Truecolor = 1; ; break;} case 52: #line 276 "reconfig.y" { SCRN.Directcolor = 1; ; break;} case 53: #line 277 "reconfig.y" { SCRN.Chipset = yyvsp[0].string; ; break;} case 54: #line 278 "reconfig.y" { SCRN.Ramdac = yyvsp[0].string; ; break;} case 55: #line 279 "reconfig.y" { SCRN.Dacspeed = yyvsp[0].number; ; break;} case 56: #line 280 "reconfig.y" { SCRN.Clockchip = yyvsp[0].string; ; break;} case 57: #line 281 "reconfig.y" { SCRN.Clocks = add_list(SCRN.Clocks,yyvsp[0].stringlist); ; break;} case 58: #line 283 "reconfig.y" { SCRN.Displaysize1 = yyvsp[-1].number; SCRN.Displaysize2 = yyvsp[0].number; ; break;} case 59: #line 284 "reconfig.y" { SCRN.Modes = yyvsp[0].stringlist; ; break;} case 60: #line 285 "reconfig.y" { SCRN.Screenno = yyvsp[0].number; ; break;} case 61: #line 286 "reconfig.y" { SCRN.Option = add_string(SCRN.Option,yyvsp[0].string); ; break;} case 62: #line 287 "reconfig.y" { SCRN.Videoram = yyvsp[0].number; ; break;} case 63: #line 289 "reconfig.y" { SCRN.Viewport1 = yyvsp[-1].number; SCRN.Viewport2 = yyvsp[0].number; ; break;} case 64: #line 291 "reconfig.y" { SCRN.Virtual1 = yyvsp[-1].number; SCRN.Virtual2 = yyvsp[0].number; ; break;} case 65: #line 292 "reconfig.y" { SCRN.Speedup = yyvsp[0].string; ; break;} case 66: #line 293 "reconfig.y" { SCRN.Speedup = yyvsp[0].number; ; break;} case 67: #line 294 "reconfig.y" { SCRN.Nospeedup = 1; ; break;} case 68: #line 295 "reconfig.y" { SCRN.Clockprog1 = yyvsp[0].string; ; break;} case 69: #line 297 "reconfig.y" { SCRN.Clockprog1 = yyvsp[-1].string; SCRN.Clockprog2 = yyvsp[0].number; ; break;} case 70: #line 298 "reconfig.y" { SCRN.Biosbase = yyvsp[0].number; ; break;} case 71: #line 299 "reconfig.y" { SCRN.Membase = yyvsp[0].number; ; break;} case 72: #line 301 "reconfig.y" { SCRN.Black1 = yyvsp[-2].number; SCRN.Black2 = yyvsp[-1].number; SCRN.Black3 = yyvsp[0].number; ; break;} case 73: #line 303 "reconfig.y" { SCRN.White1 = yyvsp[-2].number; SCRN.White2 = yyvsp[-1].number; SCRN.White3 = yyvsp[0].number; ; break;} case 74: #line 304 "reconfig.y" { SCRN.Iobase = yyvsp[0].number; ; break;} case 75: #line 305 "reconfig.y" { SCRN.Dacbase = yyvsp[0].number; ; break;} case 76: #line 306 "reconfig.y" { SCRN.Copbase = yyvsp[0].number; ; break;} case 77: #line 307 "reconfig.y" { SCRN.Posbase = yyvsp[0].number; ; break;} case 78: #line 308 "reconfig.y" { SCRN.Instance = yyvsp[0].number; ; break;} case 79: #line 311 "reconfig.y" { yyval.stringlist = NULL; ; break;} case 80: #line 312 "reconfig.y" { yyval.stringlist = add_string(yyvsp[-1].stringlist,yyvsp[0].number); ; break;} case 81: #line 315 "reconfig.y" { yyval.stringlist = NULL; ; break;} case 82: #line 316 "reconfig.y" { yyval.stringlist = add_string(yyvsp[-1].stringlist,yyvsp[0].string); ; break;} case 85: #line 324 "reconfig.y" { gen.Autorepeat1 = yyvsp[-1].number; gen.Autorepeat2 = yyvsp[0].number; ; break;} case 86: #line 325 "reconfig.y" { gen.Dontzap = 1; ; break;} case 87: #line 326 "reconfig.y" { gen.Servernum = 1; ; break;} case 88: #line 327 "reconfig.y" { gen.Xleds = yyvsp[0].number; ; break;} case 89: #line 328 "reconfig.y" { gen.Vtinit = yyvsp[0].string; ; break;} case 90: #line 329 "reconfig.y" { kmap_index = iLEFTALT; ; break;} case 92: #line 330 "reconfig.y" { kmap_index = iRIGHTALT; ; break;} case 94: #line 331 "reconfig.y" { kmap_index = iSCROLLLOCK; ; break;} case 96: #line 332 "reconfig.y" { kmap_index = iRIGHTCTL; ; break;} case 98: #line 333 "reconfig.y" { gen.Vtsysreq = 1; ; break;} case 99: #line 336 "reconfig.y" { gen.keymap[kmap_index] = "meta"; ; break;} case 100: #line 337 "reconfig.y" { gen.keymap[kmap_index] = "compose"; ; break;} case 101: #line 338 "reconfig.y" { gen.keymap[kmap_index] = "modeshift"; ; break;} case 102: #line 339 "reconfig.y" { gen.keymap[kmap_index] = "modelock"; ; break;} case 103: #line 340 "reconfig.y" { gen.keymap[kmap_index] = "scrollock"; ; break;} case 104: #line 341 "reconfig.y" { gen.keymap[kmap_index] = "control"; ; break;} case 107: #line 347 "reconfig.y" { gen.Baudrate = yyvsp[0].number; ; break;} case 108: #line 348 "reconfig.y" { gen.Samplerate = yyvsp[0].number; ; break;} case 109: #line 349 "reconfig.y" { gen.Emulate3 = 1; ; break;} case 110: #line 350 "reconfig.y" { gen.Chordmiddle = 1; ; break;} case 111: #line 351 "reconfig.y" { gen.Cleardtr = 1; ; break;} case 112: #line 352 "reconfig.y" { gen.Clearrts = 1; ; break;} } /* the action file gets copied in in place of this dollarsign */ #line 498 "bison.simple" yyvsp -= yylen; yyssp -= yylen; #ifdef YYLSP_NEEDED yylsp -= yylen; #endif #if YYDEBUG != 0 if (yydebug) { short *ssp1 = yyss - 1; fprintf (stderr, "state stack now"); while (ssp1 != yyssp) fprintf (stderr, " %d", *++ssp1); fprintf (stderr, "\n"); } #endif *++yyvsp = yyval; #ifdef YYLSP_NEEDED yylsp++; if (yylen == 0) { yylsp->first_line = yylloc.first_line; yylsp->first_column = yylloc.first_column; yylsp->last_line = (yylsp-1)->last_line; yylsp->last_column = (yylsp-1)->last_column; yylsp->text = 0; } else { yylsp->last_line = (yylsp+yylen-1)->last_line; yylsp->last_column = (yylsp+yylen-1)->last_column; } #endif /* 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 - YYNTBASE] + *yyssp; if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp) yystate = yytable[yystate]; else yystate = yydefgoto[yyn - YYNTBASE]; goto yynewstate; yyerrlab: /* here on detecting error */ if (! yyerrstatus) /* If not already recovering from an error, report this error. */ { ++yynerrs; #ifdef YYERROR_VERBOSE yyn = yypact[yystate]; if (yyn > YYFLAG && yyn < YYLAST) { int size = 0; char *msg; int x, count; count = 0; /* Start X at -yyn if nec to avoid negative indexes in yycheck. */ for (x = (yyn < 0 ? -yyn : 0); x < (sizeof(yytname) / sizeof(char *)); x++) if (yycheck[x + yyn] == x) size += strlen(yytname[x]) + 15, count++; msg = (char *) malloc(size + 15); if (msg != 0) { strcpy(msg, "parse error"); if (count < 5) { count = 0; for (x = (yyn < 0 ? -yyn : 0); x < (sizeof(yytname) / sizeof(char *)); x++) if (yycheck[x + yyn] == x) { strcat(msg, count == 0 ? ", expecting `" : " or `"); strcat(msg, yytname[x]); strcat(msg, "'"); count++; } } yyerror(msg); free(msg); } else yyerror ("parse error; also virtual memory exceeded"); } else #endif /* YYERROR_VERBOSE */ yyerror("parse error"); } goto yyerrlab1; yyerrlab1: /* here on error raised explicitly by an action */ 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) YYABORT; #if YYDEBUG != 0 if (yydebug) fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]); #endif yychar = YYEMPTY; } /* Else will try to reuse lookahead token after shifting the error token. */ yyerrstatus = 3; /* Each real token shifted decrements this */ goto yyerrhandle; yyerrdefault: /* current state does not do anything special for the error token. */ #if 0 /* This is wrong; only states that explicitly want error tokens should shift them. */ yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/ if (yyn) goto yydefault; #endif yyerrpop: /* pop the current state because it cannot handle the error token */ if (yyssp == yyss) YYABORT; yyvsp--; yystate = *--yyssp; #ifdef YYLSP_NEEDED yylsp--; #endif #if YYDEBUG != 0 if (yydebug) { short *ssp1 = yyss - 1; fprintf (stderr, "Error: state stack now"); while (ssp1 != yyssp) fprintf (stderr, " %d", *++ssp1); fprintf (stderr, "\n"); } #endif yyerrhandle: yyn = yypact[yystate]; if (yyn == YYFLAG) goto yyerrdefault; yyn += YYTERROR; if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR) goto yyerrdefault; yyn = yytable[yyn]; if (yyn < 0) { if (yyn == YYFLAG) goto yyerrpop; yyn = -yyn; goto yyreduce; } else if (yyn == 0) goto yyerrpop; if (yyn == YYFINAL) YYACCEPT; #if YYDEBUG != 0 if (yydebug) fprintf(stderr, "Shifting error token, "); #endif *++yyvsp = yylval; #ifdef YYLSP_NEEDED *++yylsp = yylloc; #endif yystate = yyn; goto yynewstate; } #line 354 "reconfig.y" #define NEW(t) (t *)malloc(sizeof(t)) #define REALLOC(n,t,d) (t *) realloc(d,n * sizeof(t)) /* Add a string to a list of strings */ string_list *add_string(sl,s) string_list *sl; char *s; { if ( sl == NULL ) { sl = NEW(string_list); sl -> datap = NEW(char *); (sl -> datap)[0] = s; sl -> count = 1; } else { sl->datap = REALLOC((sl->count+1),char *,sl->datap); (sl->datap)[sl->count] = s; sl->count++; } return sl; } /* Add a list to a list of lists */ string_list_list *add_list(sl,s) string_list_list *sl; string_list *s; { if ( sl == NULL ) { sl = NEW(string_list_list); sl -> datap = NEW(string_list *); (sl -> datap)[0] = s; sl -> count = 1; } else { sl->datap = REALLOC((sl->count+1),string_list *,sl->datap); (sl->datap)[sl->count] = s; sl->count++; } return sl; } /* Add a mode to a list of modes */ mode_list *add_mode(sl,mn,d,h1,h2,h3,h4,v1,v2,v3,v4,flags) mode_list *sl; char *mn; char *d, *h1,*h2,*h3,*h4, *v1,*v2,*v3,*v4; int flags; { if ( sl == NULL ) { sl = NEW(mode_list); sl -> datap = NEW(struct mode); sl -> datap[0].mn = mn; sl -> datap[0].d = d; sl -> datap[0].h1 = h1; sl -> datap[0].h2 = h2; sl -> datap[0].h3 = h3; sl -> datap[0].h4 = h4; sl -> datap[0].v1 = v1; sl -> datap[0].v2 = v2; sl -> datap[0].v3 = v3; sl -> datap[0].v4 = v4; sl -> datap[0].flags = flags; sl -> count = 1; } else { sl->datap = REALLOC((sl->count+1),struct mode,sl->datap); sl -> datap[sl->count].mn = mn; sl -> datap[sl->count].d = d; sl -> datap[sl->count].h1 = h1; sl -> datap[sl->count].h2 = h2; sl -> datap[sl->count].h3 = h3; sl -> datap[sl->count].h4 = h4; sl -> datap[sl->count].v1 = v1; sl -> datap[sl->count].v2 = v2; sl -> datap[sl->count].v3 = v3; sl -> datap[sl->count].v4 = v4; sl -> datap[sl->count].flags = flags; sl->count++; } return sl; } main() { if ( ! yyparse() ) { copyright(); printf("# This file was generated by reconfig(1)\n"); printf("# Refer to the XF86Config(4/5) man page for a "); printf("description of the format\n\n"); dump(); fprintf(stderr, "\n*** Note the XF86Config file generated "); fprintf(stderr, "must be edited before use.\n\n"); } exit(0); } yyerror(s) char *s; { extern int line; extern char *yytext; #if 0 fprintf(stderr, "%s on line %d while facing '%s'\n",s,line,yytext); #else fprintf(stderr, "%s on line %d\n",s,line); #endif } dump() { int i,j,k; /* Files section */ printf("Section \"Files\"\n"); if ( gen.Fontpath ) { for ( i = 0 ; i < gen.Fontpath->count ; i++ ) { printf(" FontPath %s\n", gen.Fontpath->datap[i]); } } if ( gen.Rgbpath ) { printf(" RGBPath %s\n",gen.Rgbpath); } printf("EndSection\n\n"); /* serverflags section */ printf("Section \"ServerFlags\"\n"); if ( gen.Notrapsignals ) { printf(" NoTrapSignals\n"); } if ( gen.Dontzap ) { printf(" DontZap\n"); } printf("EndSection\n\n"); /* Keyboard section */ printf("Section \"Keyboard\"\n"); if ( strcmp(gen.mouse_name,"xqueue") == 0 ) { printf(" Protocol \"Xqueue\"\n"); } else { printf(" Protocol \"Standard\"\n"); } if ( gen.Autorepeat1 ) { printf(" AutoRepeat %s %s\n", gen.Autorepeat1, gen.Autorepeat2); } if ( gen.Servernum ) { printf(" ServerNumLock\n"); } if ( gen.Xleds ) { printf(" Xleds %s\n", gen.Xleds); } if ( gen.Vtinit ) { printf(" VTInit %s\n", gen.Vtinit); } for ( i = 0 ; i < N_KEYM ; i++ ) { if (gen.keymap[i]) { switch ( i ) { case iLEFTALT: printf(" LEFTALT "); break; case iRIGHTALT: printf(" RIGHTALT "); break; case iSCROLLLOCK: printf(" SCROLLLOCK "); break; case iRIGHTCTL: printf(" RIGHTCTL "); break; } printf("%s\n", gen.keymap[i]); } } if ( gen.Vtsysreq ) { printf(" VTSysReq\n"); } printf("EndSection\n\n"); printf("Section \"Pointer\"\n"); if ( gen.mouse_name ) { printf(" Protocol \"%s\"\n",gen.mouse_name); } if ( gen.mouse_device ) { printf(" Device %s\n",gen.mouse_device); } if ( gen.Baudrate ) { printf(" BaudRate %s\n",gen.Baudrate); } if ( gen.Samplerate ) { printf(" SampleRate %s\n",gen.Samplerate); } if ( gen.Emulate3 ) { printf(" Emulate3Buttons\n"); } if ( gen.Chordmiddle ) { printf(" ChordMiddle\n"); } if ( gen.Cleardtr ) { printf(" ClearDTR\n"); } if ( gen.Clearrts ) { printf(" ClearRTS\n"); } printf("EndSection\n\n"); /* Now print monitor, device and screen sections, for each screen */ for ( j = 0 ; j < N_SCREENS ; j++ ) { scrn_index = j; if ( !SCRN.configured ) continue; printf("Section \"Monitor\"\n"); printf(" Identifier \"RandomMonitor-%d\"\n",scrn_index); printf(" VendorName \"Unknown\"\n"); printf(" ModelName \"Unknown\"\n"); printf(" BandWidth 25.2\t# EDIT THIS!\n"); printf(" HorizSync 31.5\t# EDIT THIS!\n"); printf(" VertRefresh 60\t# EDIT THIS!\n"); if ( modelist ) { for ( i = 0 ; i < modelist->count ; i++ ) { printf(" ModeLine"); printf(" %s", modelist->datap[i].mn); printf(" %s", modelist->datap[i].d); printf(" %s", modelist->datap[i].h1); printf(" %s", modelist->datap[i].h2); printf(" %s", modelist->datap[i].h3); printf(" %s", modelist->datap[i].h4); printf(" %s", modelist->datap[i].v1); printf(" %s", modelist->datap[i].v2); printf(" %s", modelist->datap[i].v3); printf(" %s", modelist->datap[i].v4); if ( modelist->datap[i].flags & fINTERLACE ) printf(" interlace"); if ( modelist->datap[i].flags & fPHSYNC ) printf(" +hsync"); if ( modelist->datap[i].flags & fNHSYNC ) printf(" -hsync"); if ( modelist->datap[i].flags & fPVSYNC ) printf(" +vsync"); if ( modelist->datap[i].flags & fNVSYNC ) printf(" -vsync"); if ( modelist->datap[i].flags & fCSYNC ) printf(" composite"); printf("\n"); } } printf("EndSection\n\n"); printf("Section \"Device\"\n"); printf(" Identifier \"RandomDevice-%d\"\n",scrn_index); printf(" VendorName \"Unknown\"\n"); printf(" BoardName \"Unknown\"\n"); if ( SCRN.Chipset ) { printf(" Chipset %s\n",SCRN.Chipset); } if ( SCRN.Ramdac ) { printf(" Ramdac %s\n",SCRN.Ramdac); } if ( SCRN.Dacspeed ) { printf(" Dacspeed %s\n",SCRN.Dacspeed); } if ( SCRN.Clockchip ) { printf(" Clockchip %s\n",SCRN.Clockchip); } if ( SCRN.Clocks ) { /* j is used to go over the screens. */ for ( k = 0 ; k < SCRN.Clocks->count ; k++ ) { string_list *clcks = SCRN.Clocks->datap[k]; if ( clcks ) { printf(" Clocks"); for ( i = 0 ; i < clcks->count ; i++ ) { printf(" %s",clcks->datap[i]); } printf("\n"); } } } if ( SCRN.Option ) { for ( i = 0 ; i < SCRN.Option->count ; i++ ) { printf(" Option %s\n",SCRN.Option->datap[i]); } } if ( SCRN.Videoram ) { printf(" Videoram %s\n",SCRN.Videoram); } if ( SCRN.Speedup ) { printf(" Speedup %s\n",SCRN.Speedup); } if ( SCRN.Clockprog1 ) { printf(" Clockprog %s",SCRN.Clockprog1); if ( SCRN.Clockprog2 ) { printf(" %s",SCRN.Clockprog2); } printf("\n"); } if ( SCRN.Biosbase ) { printf(" Biosbase %s\n",SCRN.Biosbase); } if ( SCRN.Membase ) { printf(" Membase %s\n",SCRN.Membase); } if ( SCRN.Iobase ) { printf(" Iobase %s\n",SCRN.Iobase); } if ( SCRN.Dacbase ) { printf(" Dacbase %s\n",SCRN.Dacbase); } if ( SCRN.Copbase ) { printf(" Copbase %s\n",SCRN.Copbase); } if ( SCRN.Posbase ) { printf(" Speedup %s\n",SCRN.Posbase); } if ( SCRN.Instance ) { printf(" Instance %s\n",SCRN.Instance); } printf("EndSection\n\n"); /* Screen section */ printf("Section \"Screen\"\n"); switch ( scrn_index ) { case iVGA256: printf(" Driver \"vga256\"\n"); break; case iVGA2: printf(" Driver \"vga2\"\n"); break; case iMONO: printf(" Driver \"mono\"\n"); break; case iVGA16: printf(" Driver \"vga16\"\n"); break; case iACCEL: printf(" Driver \"accel\"\n"); break; } printf(" Device \"RandomDevice-%d\"\n",scrn_index); printf(" Monitor \"RandomMonitor-%d\"\n",scrn_index); if ( SCRN.Screenno ) { printf(" Screenno %s\n",SCRN.Screenno); } printf(" Subsection \"Display\"\n"); if ( SCRN.Staticgray ) { printf(" StaticGray\n"); } if ( SCRN.Grayscale ) { printf(" GrayScale\n"); } if ( SCRN.Staticcolor ) { printf(" StaticColor\n"); } if ( SCRN.Pseudocolor ) { printf(" PseudoColor\n"); } if ( SCRN.Truecolor ) { printf(" TrueColor\n"); } if ( SCRN.Directcolor ) { printf(" DirectColor\n"); } if ( SCRN.Displaysize1 ) { printf(" DisplaySize %s %s\n", SCRN.Displaysize1,SCRN.Displaysize2); } if ( SCRN.Modes ) { printf(" Modes"); for ( i = 0 ; i < SCRN.Modes->count ; i++ ) { printf(" %s",SCRN.Modes->datap[i]); } printf("\n"); } if ( SCRN.Viewport1 ) { printf(" ViewPort %s %s\n", SCRN.Viewport1,SCRN.Viewport2); } if ( SCRN.Virtual1 ) { printf(" Virtual %s %s\n", SCRN.Virtual1,SCRN.Virtual2); } if ( SCRN.Black1 ) { printf(" Black %s %s %s\n", SCRN.Black1,SCRN.Black2,SCRN.Black3); } if ( SCRN.White1 ) { printf(" White %s %s %s\n", SCRN.White1,SCRN.White2,SCRN.White3); } printf(" EndSubsection\n"); printf("EndSection\n\n"); } /* screens */ } /* function */