summaryrefslogtreecommitdiff
path: root/xserver/hw/xfree86/parser
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu@cvs.openbsd.org>2012-06-10 13:21:33 +0000
committerMatthieu Herrb <matthieu@cvs.openbsd.org>2012-06-10 13:21:33 +0000
commit171e929a08098b6c844887adc43879c7579dc15f (patch)
tree6b4d2e3bc20dbd4dc9a1f031416e66614c53dd21 /xserver/hw/xfree86/parser
parent68781b09de2c95b87ea898c4ecf3018dfb4460d2 (diff)
Update to xserver 1.12.2. tested by naddy@, krw@, mpi@.
Diffstat (limited to 'xserver/hw/xfree86/parser')
-rw-r--r--xserver/hw/xfree86/parser/Configint.h21
-rw-r--r--xserver/hw/xfree86/parser/DRI.c101
-rw-r--r--xserver/hw/xfree86/parser/Device.c531
-rw-r--r--xserver/hw/xfree86/parser/Extensions.c66
-rw-r--r--xserver/hw/xfree86/parser/Files.c299
-rw-r--r--xserver/hw/xfree86/parser/Flags.c652
-rw-r--r--xserver/hw/xfree86/parser/Input.c217
-rw-r--r--xserver/hw/xfree86/parser/InputClass.c117
-rw-r--r--xserver/hw/xfree86/parser/Layout.c840
-rw-r--r--xserver/hw/xfree86/parser/Makefile.am2
-rw-r--r--xserver/hw/xfree86/parser/Makefile.in15
-rw-r--r--xserver/hw/xfree86/parser/Module.c329
-rw-r--r--xserver/hw/xfree86/parser/Monitor.c1465
-rw-r--r--xserver/hw/xfree86/parser/Pointer.c290
-rw-r--r--xserver/hw/xfree86/parser/Screen.c874
-rw-r--r--xserver/hw/xfree86/parser/Vendor.c270
-rw-r--r--xserver/hw/xfree86/parser/Video.c346
-rw-r--r--xserver/hw/xfree86/parser/configProcs.h86
-rw-r--r--xserver/hw/xfree86/parser/read.c376
-rw-r--r--xserver/hw/xfree86/parser/scan.c1548
-rw-r--r--xserver/hw/xfree86/parser/write.c187
-rw-r--r--xserver/hw/xfree86/parser/xf86Optrec.h49
-rw-r--r--xserver/hw/xfree86/parser/xf86Parser.h725
-rw-r--r--xserver/hw/xfree86/parser/xf86tokens.h21
24 files changed, 4598 insertions, 4829 deletions
diff --git a/xserver/hw/xfree86/parser/Configint.h b/xserver/hw/xfree86/parser/Configint.h
index 82d7de4c4..81cc1fc59 100644
--- a/xserver/hw/xfree86/parser/Configint.h
+++ b/xserver/hw/xfree86/parser/Configint.h
@@ -52,7 +52,6 @@
* authorization from the copyright holder(s) and author(s).
*/
-
/*
* These definitions are used through out the configuration file parser, but
* they should not be visible outside of the parser.
@@ -73,14 +72,12 @@
typedef enum { PARSE_DECIMAL, PARSE_OCTAL, PARSE_HEX } ParserNumType;
-typedef struct
-{
- int num; /* returned number */
- char *str; /* private copy of the return-string */
- double realnum; /* returned number as a real */
- ParserNumType numType; /* used to enforce correct number formatting */
-}
-LexRec, *LexPtr;
+typedef struct {
+ int num; /* returned number */
+ char *str; /* private copy of the return-string */
+ double realnum; /* returned number as a real */
+ ParserNumType numType; /* used to enforce correct number formatting */
+} LexRec, *LexPtr;
#ifndef TRUE
#define TRUE 1
@@ -119,8 +116,8 @@ else\
}\
}
-#define Error(a,b) do { \
- xf86parseError (a, b); CLEANUP (ptr); return NULL; \
+#define Error(...) do { \
+ xf86parseError (__VA_ARGS__); CLEANUP (ptr); return NULL; \
} while (0)
/*
@@ -210,4 +207,4 @@ else\
#define OBSOLETE_MSG \
"Ignoring obsolete keyword \"%s\"."
-#endif /* _Configint_h_ */
+#endif /* _Configint_h_ */
diff --git a/xserver/hw/xfree86/parser/DRI.c b/xserver/hw/xfree86/parser/DRI.c
index f51f6b989..e8d26255f 100644
--- a/xserver/hw/xfree86/parser/DRI.c
+++ b/xserver/hw/xfree86/parser/DRI.c
@@ -37,87 +37,86 @@
extern LexRec val;
-static xf86ConfigSymTabRec DRITab[] =
-{
+static xf86ConfigSymTabRec DRITab[] = {
{ENDSECTION, "endsection"},
- {GROUP, "group"},
- {MODE, "mode"},
- {-1, ""},
+ {GROUP, "group"},
+ {MODE, "mode"},
+ {-1, ""},
};
#define CLEANUP xf86freeDRI
XF86ConfDRIPtr
-xf86parseDRISection (void)
+xf86parseDRISection(void)
{
int token;
- parsePrologue (XF86ConfDRIPtr, XF86ConfDRIRec);
+
+ parsePrologue(XF86ConfDRIPtr, XF86ConfDRIRec);
/* Zero is a valid value for this. */
ptr->dri_group = -1;
- while ((token = xf86getToken (DRITab)) != ENDSECTION) {
- switch (token)
- {
- case GROUP:
- if ((token = xf86getSubToken (&(ptr->dri_comment))) == STRING)
- ptr->dri_group_name = val.str;
- else if (token == NUMBER)
- ptr->dri_group = val.num;
- else
- Error (GROUP_MSG, NULL);
- break;
- case MODE:
- if (xf86getSubToken (&(ptr->dri_comment)) != NUMBER)
- Error (NUMBER_MSG, "Mode");
- if (val.numType != PARSE_OCTAL)
- Error (MUST_BE_OCTAL_MSG, val.num);
- ptr->dri_mode = val.num;
- break;
- case EOF_TOKEN:
- Error (UNEXPECTED_EOF_MSG, NULL);
- break;
- case COMMENT:
- ptr->dri_comment = xf86addComment(ptr->dri_comment, val.str);
- break;
- default:
- Error (INVALID_KEYWORD_MSG, xf86tokenString ());
- break;
- }
+ while ((token = xf86getToken(DRITab)) != ENDSECTION) {
+ switch (token) {
+ case GROUP:
+ if ((token = xf86getSubToken(&(ptr->dri_comment))) == STRING)
+ ptr->dri_group_name = val.str;
+ else if (token == NUMBER)
+ ptr->dri_group = val.num;
+ else
+ Error(GROUP_MSG);
+ break;
+ case MODE:
+ if (xf86getSubToken(&(ptr->dri_comment)) != NUMBER)
+ Error(NUMBER_MSG, "Mode");
+ if (val.numType != PARSE_OCTAL)
+ Error(MUST_BE_OCTAL_MSG, val.num);
+ ptr->dri_mode = val.num;
+ break;
+ case EOF_TOKEN:
+ Error(UNEXPECTED_EOF_MSG);
+ break;
+ case COMMENT:
+ ptr->dri_comment = xf86addComment(ptr->dri_comment, val.str);
+ break;
+ default:
+ Error(INVALID_KEYWORD_MSG, xf86tokenString());
+ break;
+ }
}
-
+
#ifdef DEBUG
ErrorF("DRI section parsed\n");
#endif
-
+
return ptr;
}
#undef CLEANUP
void
-xf86printDRISection (FILE * cf, XF86ConfDRIPtr ptr)
+xf86printDRISection(FILE * cf, XF86ConfDRIPtr ptr)
{
if (ptr == NULL)
- return;
-
- fprintf (cf, "Section \"DRI\"\n");
+ return;
+
+ fprintf(cf, "Section \"DRI\"\n");
if (ptr->dri_comment)
- fprintf (cf, "%s", ptr->dri_comment);
+ fprintf(cf, "%s", ptr->dri_comment);
if (ptr->dri_group_name)
- fprintf (cf, "\tGroup \"%s\"\n", ptr->dri_group_name);
+ fprintf(cf, "\tGroup \"%s\"\n", ptr->dri_group_name);
else if (ptr->dri_group >= 0)
- fprintf (cf, "\tGroup %d\n", ptr->dri_group);
+ fprintf(cf, "\tGroup %d\n", ptr->dri_group);
if (ptr->dri_mode)
- fprintf (cf, "\tMode 0%o\n", ptr->dri_mode);
- fprintf (cf, "EndSection\n\n");
+ fprintf(cf, "\tMode 0%o\n", ptr->dri_mode);
+ fprintf(cf, "EndSection\n\n");
}
void
-xf86freeDRI (XF86ConfDRIPtr ptr)
+xf86freeDRI(XF86ConfDRIPtr ptr)
{
if (ptr == NULL)
- return;
-
- TestFree (ptr->dri_comment);
- free (ptr);
+ return;
+
+ TestFree(ptr->dri_comment);
+ free(ptr);
}
diff --git a/xserver/hw/xfree86/parser/Device.c b/xserver/hw/xfree86/parser/Device.c
index d71abc6c2..f27b56fef 100644
--- a/xserver/hw/xfree86/parser/Device.c
+++ b/xserver/hw/xfree86/parser/Device.c
@@ -52,7 +52,6 @@
* authorization from the copyright holder(s) and author(s).
*/
-
/* View/edit this file with tab stops set to 4 */
#ifdef HAVE_XORG_CONFIG_H
@@ -66,306 +65,296 @@
extern LexRec val;
static
-xf86ConfigSymTabRec DeviceTab[] =
-{
- {ENDSECTION, "endsection"},
- {IDENTIFIER, "identifier"},
- {VENDOR, "vendorname"},
- {BOARD, "boardname"},
- {CHIPSET, "chipset"},
- {RAMDAC, "ramdac"},
- {DACSPEED, "dacspeed"},
- {CLOCKS, "clocks"},
- {OPTION, "option"},
- {VIDEORAM, "videoram"},
- {BIOSBASE, "biosbase"},
- {MEMBASE, "membase"},
- {IOBASE, "iobase"},
- {CLOCKCHIP, "clockchip"},
- {CHIPID, "chipid"},
- {CHIPREV, "chiprev"},
- {CARD, "card"},
- {DRIVER, "driver"},
- {BUSID, "busid"},
- {TEXTCLOCKFRQ, "textclockfreq"},
- {IRQ, "irq"},
- {SCREEN, "screen"},
- {-1, ""},
+xf86ConfigSymTabRec DeviceTab[] = {
+ {ENDSECTION, "endsection"},
+ {IDENTIFIER, "identifier"},
+ {VENDOR, "vendorname"},
+ {BOARD, "boardname"},
+ {CHIPSET, "chipset"},
+ {RAMDAC, "ramdac"},
+ {DACSPEED, "dacspeed"},
+ {CLOCKS, "clocks"},
+ {OPTION, "option"},
+ {VIDEORAM, "videoram"},
+ {BIOSBASE, "biosbase"},
+ {MEMBASE, "membase"},
+ {IOBASE, "iobase"},
+ {CLOCKCHIP, "clockchip"},
+ {CHIPID, "chipid"},
+ {CHIPREV, "chiprev"},
+ {CARD, "card"},
+ {DRIVER, "driver"},
+ {BUSID, "busid"},
+ {TEXTCLOCKFRQ, "textclockfreq"},
+ {IRQ, "irq"},
+ {SCREEN, "screen"},
+ {-1, ""},
};
#define CLEANUP xf86freeDeviceList
XF86ConfDevicePtr
-xf86parseDeviceSection (void)
+xf86parseDeviceSection(void)
{
- int i;
- int has_ident = FALSE;
- int token;
- parsePrologue (XF86ConfDevicePtr, XF86ConfDeviceRec)
+ int i;
+ int has_ident = FALSE;
+ int token;
+
+ parsePrologue(XF86ConfDevicePtr, XF86ConfDeviceRec)
- /* Zero is a valid value for these */
- ptr->dev_chipid = -1;
- ptr->dev_chiprev = -1;
- ptr->dev_irq = -1;
- while ((token = xf86getToken (DeviceTab)) != ENDSECTION)
- {
- switch (token)
- {
- case COMMENT:
- ptr->dev_comment = xf86addComment(ptr->dev_comment, val.str);
- break;
- case IDENTIFIER:
- if (xf86getSubToken (&(ptr->dev_comment)) != STRING)
- Error (QUOTE_MSG, "Identifier");
- if (has_ident == TRUE)
- Error (MULTIPLE_MSG, "Identifier");
- ptr->dev_identifier = val.str;
- has_ident = TRUE;
- break;
- case VENDOR:
- if (xf86getSubToken (&(ptr->dev_comment)) != STRING)
- Error (QUOTE_MSG, "Vendor");
- ptr->dev_vendor = val.str;
- break;
- case BOARD:
- if (xf86getSubToken (&(ptr->dev_comment)) != STRING)
- Error (QUOTE_MSG, "Board");
- ptr->dev_board = val.str;
- break;
- case CHIPSET:
- if (xf86getSubToken (&(ptr->dev_comment)) != STRING)
- Error (QUOTE_MSG, "Chipset");
- ptr->dev_chipset = val.str;
- break;
- case CARD:
- if (xf86getSubToken (&(ptr->dev_comment)) != STRING)
- Error (QUOTE_MSG, "Card");
- ptr->dev_card = val.str;
- break;
- case DRIVER:
- if (xf86getSubToken (&(ptr->dev_comment)) != STRING)
- Error (QUOTE_MSG, "Driver");
- ptr->dev_driver = val.str;
- break;
- case RAMDAC:
- if (xf86getSubToken (&(ptr->dev_comment)) != STRING)
- Error (QUOTE_MSG, "Ramdac");
- ptr->dev_ramdac = val.str;
- break;
- case DACSPEED:
- for (i = 0; i < CONF_MAXDACSPEEDS; i++)
- ptr->dev_dacSpeeds[i] = 0;
- if (xf86getSubToken (&(ptr->dev_comment)) != NUMBER)
- {
- Error (DACSPEED_MSG, CONF_MAXDACSPEEDS);
- }
- else
- {
- ptr->dev_dacSpeeds[0] = (int) (val.realnum * 1000.0 + 0.5);
- for (i = 1; i < CONF_MAXDACSPEEDS; i++)
- {
- if (xf86getSubToken (&(ptr->dev_comment)) == NUMBER)
- ptr->dev_dacSpeeds[i] = (int)
- (val.realnum * 1000.0 + 0.5);
- else
- {
- xf86unGetToken (token);
- break;
- }
- }
- }
- break;
- case VIDEORAM:
- if (xf86getSubToken (&(ptr->dev_comment)) != NUMBER)
- Error (NUMBER_MSG, "VideoRam");
- ptr->dev_videoram = val.num;
- break;
- case BIOSBASE:
- if (xf86getSubToken (&(ptr->dev_comment)) != NUMBER)
- Error (NUMBER_MSG, "BIOSBase");
- ptr->dev_bios_base = val.num;
- break;
- case MEMBASE:
- if (xf86getSubToken (&(ptr->dev_comment)) != NUMBER)
- Error (NUMBER_MSG, "MemBase");
- ptr->dev_mem_base = val.num;
- break;
- case IOBASE:
- if (xf86getSubToken (&(ptr->dev_comment)) != NUMBER)
- Error (NUMBER_MSG, "IOBase");
- ptr->dev_io_base = val.num;
- break;
- case CLOCKCHIP:
- if (xf86getSubToken (&(ptr->dev_comment)) != STRING)
- Error (QUOTE_MSG, "ClockChip");
- ptr->dev_clockchip = val.str;
- break;
- case CHIPID:
- if (xf86getSubToken (&(ptr->dev_comment)) != NUMBER)
- Error (NUMBER_MSG, "ChipID");
- ptr->dev_chipid = val.num;
- break;
- case CHIPREV:
- if (xf86getSubToken (&(ptr->dev_comment)) != NUMBER)
- Error (NUMBER_MSG, "ChipRev");
- ptr->dev_chiprev = val.num;
- break;
+ /* Zero is a valid value for these */
+ ptr->dev_chipid = -1;
+ ptr->dev_chiprev = -1;
+ ptr->dev_irq = -1;
+ while ((token = xf86getToken(DeviceTab)) != ENDSECTION) {
+ switch (token) {
+ case COMMENT:
+ ptr->dev_comment = xf86addComment(ptr->dev_comment, val.str);
+ break;
+ case IDENTIFIER:
+ if (xf86getSubToken(&(ptr->dev_comment)) != STRING)
+ Error(QUOTE_MSG, "Identifier");
+ if (has_ident == TRUE)
+ Error(MULTIPLE_MSG, "Identifier");
+ ptr->dev_identifier = val.str;
+ has_ident = TRUE;
+ break;
+ case VENDOR:
+ if (xf86getSubToken(&(ptr->dev_comment)) != STRING)
+ Error(QUOTE_MSG, "Vendor");
+ ptr->dev_vendor = val.str;
+ break;
+ case BOARD:
+ if (xf86getSubToken(&(ptr->dev_comment)) != STRING)
+ Error(QUOTE_MSG, "Board");
+ ptr->dev_board = val.str;
+ break;
+ case CHIPSET:
+ if (xf86getSubToken(&(ptr->dev_comment)) != STRING)
+ Error(QUOTE_MSG, "Chipset");
+ ptr->dev_chipset = val.str;
+ break;
+ case CARD:
+ if (xf86getSubToken(&(ptr->dev_comment)) != STRING)
+ Error(QUOTE_MSG, "Card");
+ ptr->dev_card = val.str;
+ break;
+ case DRIVER:
+ if (xf86getSubToken(&(ptr->dev_comment)) != STRING)
+ Error(QUOTE_MSG, "Driver");
+ ptr->dev_driver = val.str;
+ break;
+ case RAMDAC:
+ if (xf86getSubToken(&(ptr->dev_comment)) != STRING)
+ Error(QUOTE_MSG, "Ramdac");
+ ptr->dev_ramdac = val.str;
+ break;
+ case DACSPEED:
+ for (i = 0; i < CONF_MAXDACSPEEDS; i++)
+ ptr->dev_dacSpeeds[i] = 0;
+ if (xf86getSubToken(&(ptr->dev_comment)) != NUMBER) {
+ Error(DACSPEED_MSG, CONF_MAXDACSPEEDS);
+ }
+ else {
+ ptr->dev_dacSpeeds[0] = (int) (val.realnum * 1000.0 + 0.5);
+ for (i = 1; i < CONF_MAXDACSPEEDS; i++) {
+ if (xf86getSubToken(&(ptr->dev_comment)) == NUMBER)
+ ptr->dev_dacSpeeds[i] = (int)
+ (val.realnum * 1000.0 + 0.5);
+ else {
+ xf86unGetToken(token);
+ break;
+ }
+ }
+ }
+ break;
+ case VIDEORAM:
+ if (xf86getSubToken(&(ptr->dev_comment)) != NUMBER)
+ Error(NUMBER_MSG, "VideoRam");
+ ptr->dev_videoram = val.num;
+ break;
+ case BIOSBASE:
+ if (xf86getSubToken(&(ptr->dev_comment)) != NUMBER)
+ Error(NUMBER_MSG, "BIOSBase");
+ ptr->dev_bios_base = val.num;
+ break;
+ case MEMBASE:
+ if (xf86getSubToken(&(ptr->dev_comment)) != NUMBER)
+ Error(NUMBER_MSG, "MemBase");
+ ptr->dev_mem_base = val.num;
+ break;
+ case IOBASE:
+ if (xf86getSubToken(&(ptr->dev_comment)) != NUMBER)
+ Error(NUMBER_MSG, "IOBase");
+ ptr->dev_io_base = val.num;
+ break;
+ case CLOCKCHIP:
+ if (xf86getSubToken(&(ptr->dev_comment)) != STRING)
+ Error(QUOTE_MSG, "ClockChip");
+ ptr->dev_clockchip = val.str;
+ break;
+ case CHIPID:
+ if (xf86getSubToken(&(ptr->dev_comment)) != NUMBER)
+ Error(NUMBER_MSG, "ChipID");
+ ptr->dev_chipid = val.num;
+ break;
+ case CHIPREV:
+ if (xf86getSubToken(&(ptr->dev_comment)) != NUMBER)
+ Error(NUMBER_MSG, "ChipRev");
+ ptr->dev_chiprev = val.num;
+ break;
- case CLOCKS:
- token = xf86getSubToken(&(ptr->dev_comment));
- for( i = ptr->dev_clocks;
- token == NUMBER && i < CONF_MAXCLOCKS; i++ ) {
- ptr->dev_clock[i] = (int)(val.realnum * 1000.0 + 0.5);
- token = xf86getSubToken(&(ptr->dev_comment));
- }
- ptr->dev_clocks = i;
- xf86unGetToken (token);
- break;
- case TEXTCLOCKFRQ:
- if ((token = xf86getSubToken(&(ptr->dev_comment))) != NUMBER)
- Error (NUMBER_MSG, "TextClockFreq");
- ptr->dev_textclockfreq = (int)(val.realnum * 1000.0 + 0.5);
- break;
- case OPTION:
- ptr->dev_option_lst = xf86parseOption(ptr->dev_option_lst);
- break;
- case BUSID:
- if (xf86getSubToken (&(ptr->dev_comment)) != STRING)
- Error (QUOTE_MSG, "BusID");
- ptr->dev_busid = val.str;
- break;
- case IRQ:
- if (xf86getSubToken (&(ptr->dev_comment)) != NUMBER)
- Error (QUOTE_MSG, "IRQ");
- ptr->dev_irq = val.num;
- break;
- case SCREEN:
- if (xf86getSubToken (&(ptr->dev_comment)) != NUMBER)
- Error (NUMBER_MSG, "Screen");
- ptr->dev_screen = val.num;
- break;
- case EOF_TOKEN:
- Error (UNEXPECTED_EOF_MSG, NULL);
- break;
- default:
- Error (INVALID_KEYWORD_MSG, xf86tokenString ());
- break;
- }
- }
+ case CLOCKS:
+ token = xf86getSubToken(&(ptr->dev_comment));
+ for (i = ptr->dev_clocks;
+ token == NUMBER && i < CONF_MAXCLOCKS; i++) {
+ ptr->dev_clock[i] = (int) (val.realnum * 1000.0 + 0.5);
+ token = xf86getSubToken(&(ptr->dev_comment));
+ }
+ ptr->dev_clocks = i;
+ xf86unGetToken(token);
+ break;
+ case TEXTCLOCKFRQ:
+ if ((token = xf86getSubToken(&(ptr->dev_comment))) != NUMBER)
+ Error(NUMBER_MSG, "TextClockFreq");
+ ptr->dev_textclockfreq = (int) (val.realnum * 1000.0 + 0.5);
+ break;
+ case OPTION:
+ ptr->dev_option_lst = xf86parseOption(ptr->dev_option_lst);
+ break;
+ case BUSID:
+ if (xf86getSubToken(&(ptr->dev_comment)) != STRING)
+ Error(QUOTE_MSG, "BusID");
+ ptr->dev_busid = val.str;
+ break;
+ case IRQ:
+ if (xf86getSubToken(&(ptr->dev_comment)) != NUMBER)
+ Error(QUOTE_MSG, "IRQ");
+ ptr->dev_irq = val.num;
+ break;
+ case SCREEN:
+ if (xf86getSubToken(&(ptr->dev_comment)) != NUMBER)
+ Error(NUMBER_MSG, "Screen");
+ ptr->dev_screen = val.num;
+ break;
+ case EOF_TOKEN:
+ Error(UNEXPECTED_EOF_MSG);
+ break;
+ default:
+ Error(INVALID_KEYWORD_MSG, xf86tokenString());
+ break;
+ }
+ }
- if (!has_ident)
- Error (NO_IDENT_MSG, NULL);
+ if (!has_ident)
+ Error(NO_IDENT_MSG);
#ifdef DEBUG
- printf ("Device section parsed\n");
+ printf("Device section parsed\n");
#endif
- return ptr;
+ return ptr;
}
#undef CLEANUP
void
-xf86printDeviceSection (FILE * cf, XF86ConfDevicePtr ptr)
+xf86printDeviceSection(FILE * cf, XF86ConfDevicePtr ptr)
{
- int i;
+ int i;
- while (ptr)
- {
- fprintf (cf, "Section \"Device\"\n");
- if (ptr->dev_comment)
- fprintf (cf, "%s", ptr->dev_comment);
- if (ptr->dev_identifier)
- fprintf (cf, "\tIdentifier \"%s\"\n", ptr->dev_identifier);
- if (ptr->dev_driver)
- fprintf (cf, "\tDriver \"%s\"\n", ptr->dev_driver);
- if (ptr->dev_vendor)
- fprintf (cf, "\tVendorName \"%s\"\n", ptr->dev_vendor);
- if (ptr->dev_board)
- fprintf (cf, "\tBoardName \"%s\"\n", ptr->dev_board);
- if (ptr->dev_chipset)
- fprintf (cf, "\tChipSet \"%s\"\n", ptr->dev_chipset);
- if (ptr->dev_card)
- fprintf (cf, "\tCard \"%s\"\n", ptr->dev_card);
- if (ptr->dev_ramdac)
- fprintf (cf, "\tRamDac \"%s\"\n", ptr->dev_ramdac);
- if (ptr->dev_dacSpeeds[0] > 0 ) {
- fprintf (cf, "\tDacSpeed ");
- for (i = 0; i < CONF_MAXDACSPEEDS
- && ptr->dev_dacSpeeds[i] > 0; i++ )
- fprintf (cf, "%g ", (double) (ptr->dev_dacSpeeds[i])/ 1000.0 );
- fprintf (cf, "\n");
- }
- if (ptr->dev_videoram)
- fprintf (cf, "\tVideoRam %d\n", ptr->dev_videoram);
- if (ptr->dev_bios_base)
- fprintf (cf, "\tBiosBase 0x%lx\n", ptr->dev_bios_base);
- if (ptr->dev_mem_base)
- fprintf (cf, "\tMemBase 0x%lx\n", ptr->dev_mem_base);
- if (ptr->dev_io_base)
- fprintf (cf, "\tIOBase 0x%lx\n", ptr->dev_io_base);
- if (ptr->dev_clockchip)
- fprintf (cf, "\tClockChip \"%s\"\n", ptr->dev_clockchip);
- if (ptr->dev_chipid != -1)
- fprintf (cf, "\tChipId 0x%x\n", ptr->dev_chipid);
- if (ptr->dev_chiprev != -1)
- fprintf (cf, "\tChipRev 0x%x\n", ptr->dev_chiprev);
+ while (ptr) {
+ fprintf(cf, "Section \"Device\"\n");
+ if (ptr->dev_comment)
+ fprintf(cf, "%s", ptr->dev_comment);
+ if (ptr->dev_identifier)
+ fprintf(cf, "\tIdentifier \"%s\"\n", ptr->dev_identifier);
+ if (ptr->dev_driver)
+ fprintf(cf, "\tDriver \"%s\"\n", ptr->dev_driver);
+ if (ptr->dev_vendor)
+ fprintf(cf, "\tVendorName \"%s\"\n", ptr->dev_vendor);
+ if (ptr->dev_board)
+ fprintf(cf, "\tBoardName \"%s\"\n", ptr->dev_board);
+ if (ptr->dev_chipset)
+ fprintf(cf, "\tChipSet \"%s\"\n", ptr->dev_chipset);
+ if (ptr->dev_card)
+ fprintf(cf, "\tCard \"%s\"\n", ptr->dev_card);
+ if (ptr->dev_ramdac)
+ fprintf(cf, "\tRamDac \"%s\"\n", ptr->dev_ramdac);
+ if (ptr->dev_dacSpeeds[0] > 0) {
+ fprintf(cf, "\tDacSpeed ");
+ for (i = 0; i < CONF_MAXDACSPEEDS && ptr->dev_dacSpeeds[i] > 0; i++)
+ fprintf(cf, "%g ", (double) (ptr->dev_dacSpeeds[i]) / 1000.0);
+ fprintf(cf, "\n");
+ }
+ if (ptr->dev_videoram)
+ fprintf(cf, "\tVideoRam %d\n", ptr->dev_videoram);
+ if (ptr->dev_bios_base)
+ fprintf(cf, "\tBiosBase 0x%lx\n", ptr->dev_bios_base);
+ if (ptr->dev_mem_base)
+ fprintf(cf, "\tMemBase 0x%lx\n", ptr->dev_mem_base);
+ if (ptr->dev_io_base)
+ fprintf(cf, "\tIOBase 0x%lx\n", ptr->dev_io_base);
+ if (ptr->dev_clockchip)
+ fprintf(cf, "\tClockChip \"%s\"\n", ptr->dev_clockchip);
+ if (ptr->dev_chipid != -1)
+ fprintf(cf, "\tChipId 0x%x\n", ptr->dev_chipid);
+ if (ptr->dev_chiprev != -1)
+ fprintf(cf, "\tChipRev 0x%x\n", ptr->dev_chiprev);
- xf86printOptionList(cf, ptr->dev_option_lst, 1);
- if (ptr->dev_clocks > 0 ) {
- fprintf (cf, "\tClocks ");
- for (i = 0; i < ptr->dev_clocks; i++ )
- fprintf (cf, "%.1f ", (double)ptr->dev_clock[i] / 1000.0 );
- fprintf (cf, "\n");
- }
- if (ptr->dev_textclockfreq) {
- fprintf (cf, "\tTextClockFreq %.1f\n",
- (double)ptr->dev_textclockfreq / 1000.0);
- }
- if (ptr->dev_busid)
- fprintf (cf, "\tBusID \"%s\"\n", ptr->dev_busid);
- if (ptr->dev_screen > 0)
- fprintf (cf, "\tScreen %d\n", ptr->dev_screen);
- if (ptr->dev_irq >= 0)
- fprintf (cf, "\tIRQ %d\n", ptr->dev_irq);
- fprintf (cf, "EndSection\n\n");
- ptr = ptr->list.next;
- }
+ xf86printOptionList(cf, ptr->dev_option_lst, 1);
+ if (ptr->dev_clocks > 0) {
+ fprintf(cf, "\tClocks ");
+ for (i = 0; i < ptr->dev_clocks; i++)
+ fprintf(cf, "%.1f ", (double) ptr->dev_clock[i] / 1000.0);
+ fprintf(cf, "\n");
+ }
+ if (ptr->dev_textclockfreq) {
+ fprintf(cf, "\tTextClockFreq %.1f\n",
+ (double) ptr->dev_textclockfreq / 1000.0);
+ }
+ if (ptr->dev_busid)
+ fprintf(cf, "\tBusID \"%s\"\n", ptr->dev_busid);
+ if (ptr->dev_screen > 0)
+ fprintf(cf, "\tScreen %d\n", ptr->dev_screen);
+ if (ptr->dev_irq >= 0)
+ fprintf(cf, "\tIRQ %d\n", ptr->dev_irq);
+ fprintf(cf, "EndSection\n\n");
+ ptr = ptr->list.next;
+ }
}
void
-xf86freeDeviceList (XF86ConfDevicePtr ptr)
+xf86freeDeviceList(XF86ConfDevicePtr ptr)
{
- XF86ConfDevicePtr prev;
+ XF86ConfDevicePtr prev;
- while (ptr)
- {
- TestFree (ptr->dev_identifier);
- TestFree (ptr->dev_vendor);
- TestFree (ptr->dev_board);
- TestFree (ptr->dev_chipset);
- TestFree (ptr->dev_card);
- TestFree (ptr->dev_driver);
- TestFree (ptr->dev_ramdac);
- TestFree (ptr->dev_clockchip);
- TestFree (ptr->dev_comment);
- xf86optionListFree (ptr->dev_option_lst);
+ while (ptr) {
+ TestFree(ptr->dev_identifier);
+ TestFree(ptr->dev_vendor);
+ TestFree(ptr->dev_board);
+ TestFree(ptr->dev_chipset);
+ TestFree(ptr->dev_card);
+ TestFree(ptr->dev_driver);
+ TestFree(ptr->dev_ramdac);
+ TestFree(ptr->dev_clockchip);
+ TestFree(ptr->dev_comment);
+ xf86optionListFree(ptr->dev_option_lst);
- prev = ptr;
- ptr = ptr->list.next;
- free (prev);
- }
+ prev = ptr;
+ ptr = ptr->list.next;
+ free(prev);
+ }
}
XF86ConfDevicePtr
-xf86findDevice (const char *ident, XF86ConfDevicePtr p)
+xf86findDevice(const char *ident, XF86ConfDevicePtr p)
{
- while (p)
- {
- if (xf86nameCompare (ident, p->dev_identifier) == 0)
- return p;
+ while (p) {
+ if (xf86nameCompare(ident, p->dev_identifier) == 0)
+ return p;
- p = p->list.next;
- }
- return NULL;
+ p = p->list.next;
+ }
+ return NULL;
}
diff --git a/xserver/hw/xfree86/parser/Extensions.c b/xserver/hw/xfree86/parser/Extensions.c
index 4003b521a..ec0bda4c0 100644
--- a/xserver/hw/xfree86/parser/Extensions.c
+++ b/xserver/hw/xfree86/parser/Extensions.c
@@ -41,37 +41,37 @@
extern LexRec val;
-static xf86ConfigSymTabRec ExtensionsTab[] =
-{
+static xf86ConfigSymTabRec ExtensionsTab[] = {
{ENDSECTION, "endsection"},
- {OPTION, "option"},
- {-1, ""},
+ {OPTION, "option"},
+ {-1, ""},
};
#define CLEANUP xf86freeExtensions
XF86ConfExtensionsPtr
-xf86parseExtensionsSection (void)
+xf86parseExtensionsSection(void)
{
int token;
- parsePrologue (XF86ConfExtensionsPtr, XF86ConfExtensionsRec);
-
- while ((token = xf86getToken (ExtensionsTab)) != ENDSECTION) {
- switch (token) {
- case OPTION:
- ptr->ext_option_lst = xf86parseOption(ptr->ext_option_lst);
- break;
- case EOF_TOKEN:
- Error (UNEXPECTED_EOF_MSG, NULL);
- break;
- case COMMENT:
- ptr->extensions_comment =
- xf86addComment(ptr->extensions_comment, val.str);
- break;
- default:
- Error (INVALID_KEYWORD_MSG, xf86tokenString ());
- break;
- }
+
+ parsePrologue(XF86ConfExtensionsPtr, XF86ConfExtensionsRec);
+
+ while ((token = xf86getToken(ExtensionsTab)) != ENDSECTION) {
+ switch (token) {
+ case OPTION:
+ ptr->ext_option_lst = xf86parseOption(ptr->ext_option_lst);
+ break;
+ case EOF_TOKEN:
+ Error(UNEXPECTED_EOF_MSG);
+ break;
+ case COMMENT:
+ ptr->extensions_comment =
+ xf86addComment(ptr->extensions_comment, val.str);
+ break;
+ default:
+ Error(INVALID_KEYWORD_MSG, xf86tokenString());
+ break;
+ }
}
#ifdef DEBUG
@@ -84,28 +84,28 @@ xf86parseExtensionsSection (void)
#undef CLEANUP
void
-xf86printExtensionsSection (FILE * cf, XF86ConfExtensionsPtr ptr)
+xf86printExtensionsSection(FILE * cf, XF86ConfExtensionsPtr ptr)
{
XF86OptionPtr p;
if (ptr == NULL || ptr->ext_option_lst == NULL)
- return;
+ return;
p = ptr->ext_option_lst;
- fprintf (cf, "Section \"Extensions\"\n");
+ fprintf(cf, "Section \"Extensions\"\n");
if (ptr->extensions_comment)
- fprintf (cf, "%s", ptr->extensions_comment);
+ fprintf(cf, "%s", ptr->extensions_comment);
xf86printOptionList(cf, p, 1);
- fprintf (cf, "EndSection\n\n");
+ fprintf(cf, "EndSection\n\n");
}
void
-xf86freeExtensions (XF86ConfExtensionsPtr ptr)
+xf86freeExtensions(XF86ConfExtensionsPtr ptr)
{
if (ptr == NULL)
- return;
+ return;
- xf86optionListFree (ptr->ext_option_lst);
- TestFree (ptr->extensions_comment);
- free (ptr);
+ xf86optionListFree(ptr->ext_option_lst);
+ TestFree(ptr->extensions_comment);
+ free(ptr);
}
diff --git a/xserver/hw/xfree86/parser/Files.c b/xserver/hw/xfree86/parser/Files.c
index 0c718354e..d8152c008 100644
--- a/xserver/hw/xfree86/parser/Files.c
+++ b/xserver/hw/xfree86/parser/Files.c
@@ -51,7 +51,6 @@
* authorization from the copyright holder(s) and author(s).
*/
-
/* View/edit this file with tab stops set to 4 */
#ifdef HAVE_XORG_CONFIG_H
@@ -65,181 +64,169 @@
extern LexRec val;
-static xf86ConfigSymTabRec FilesTab[] =
-{
- {ENDSECTION, "endsection"},
- {FONTPATH, "fontpath"},
- {MODULEPATH, "modulepath"},
- {LOGFILEPATH, "logfile"},
- {XKBDIR, "xkbdir"},
- /* Obsolete keywords that aren't used but shouldn't cause errors: */
- {OBSOLETE_TOKEN, "rgbpath"},
- {OBSOLETE_TOKEN, "inputdevices"},
- {-1, ""},
+static xf86ConfigSymTabRec FilesTab[] = {
+ {ENDSECTION, "endsection"},
+ {FONTPATH, "fontpath"},
+ {MODULEPATH, "modulepath"},
+ {LOGFILEPATH, "logfile"},
+ {XKBDIR, "xkbdir"},
+ /* Obsolete keywords that aren't used but shouldn't cause errors: */
+ {OBSOLETE_TOKEN, "rgbpath"},
+ {OBSOLETE_TOKEN, "inputdevices"},
+ {-1, ""},
};
#define CLEANUP xf86freeFiles
XF86ConfFilesPtr
-xf86parseFilesSection (void)
+xf86parseFilesSection(void)
{
- int i, j;
- int k, l;
- char *str;
- int token;
- parsePrologue (XF86ConfFilesPtr, XF86ConfFilesRec)
-
- while ((token = xf86getToken (FilesTab)) != ENDSECTION)
- {
- switch (token)
- {
- case COMMENT:
- ptr->file_comment = xf86addComment(ptr->file_comment, val.str);
- break;
- case FONTPATH:
- if (xf86getSubToken (&(ptr->file_comment)) != STRING)
- Error (QUOTE_MSG, "FontPath");
- j = FALSE;
- str = val.str;
- if (ptr->file_fontpath == NULL)
- {
- ptr->file_fontpath = malloc (1);
- ptr->file_fontpath[0] = '\0';
- i = strlen (str) + 1;
- }
- else
- {
- i = strlen (ptr->file_fontpath) + strlen (str) + 1;
- if (ptr->file_fontpath[strlen (ptr->file_fontpath) - 1] != ',')
- {
- i++;
- j = TRUE;
- }
- }
- ptr->file_fontpath =
- realloc (ptr->file_fontpath, i);
- if (j)
- strcat (ptr->file_fontpath, ",");
-
- strcat (ptr->file_fontpath, str);
- free (val.str);
- break;
- case MODULEPATH:
- if (xf86getSubToken (&(ptr->file_comment)) != STRING)
- Error (QUOTE_MSG, "ModulePath");
- l = FALSE;
- str = val.str;
- if (ptr->file_modulepath == NULL)
- {
- ptr->file_modulepath = malloc (1);
- ptr->file_modulepath[0] = '\0';
- k = strlen (str) + 1;
- }
- else
- {
- k = strlen (ptr->file_modulepath) + strlen (str) + 1;
- if (ptr->file_modulepath[strlen (ptr->file_modulepath) - 1] != ',')
- {
- k++;
- l = TRUE;
- }
- }
- ptr->file_modulepath = realloc (ptr->file_modulepath, k);
- if (l)
- strcat (ptr->file_modulepath, ",");
-
- strcat (ptr->file_modulepath, str);
- free (val.str);
- break;
- case LOGFILEPATH:
- if (xf86getSubToken (&(ptr->file_comment)) != STRING)
- Error (QUOTE_MSG, "LogFile");
- ptr->file_logfile = val.str;
- break;
- case XKBDIR:
- if (xf86getSubToken (&(ptr->file_xkbdir)) != STRING)
- Error (QUOTE_MSG, "XkbDir");
- ptr->file_xkbdir = val.str;
- break;
- case EOF_TOKEN:
- Error (UNEXPECTED_EOF_MSG, NULL);
- break;
- case OBSOLETE_TOKEN:
- xf86parseError (OBSOLETE_MSG, xf86tokenString ());
- xf86getSubToken (&(ptr->file_comment));
- break;
- default:
- Error (INVALID_KEYWORD_MSG, xf86tokenString ());
- break;
- }
- }
+ int i, j;
+ int k, l;
+ char *str;
+ int token;
+
+ parsePrologue(XF86ConfFilesPtr, XF86ConfFilesRec)
+
+ while ((token = xf86getToken(FilesTab)) != ENDSECTION) {
+ switch (token) {
+ case COMMENT:
+ ptr->file_comment = xf86addComment(ptr->file_comment, val.str);
+ break;
+ case FONTPATH:
+ if (xf86getSubToken(&(ptr->file_comment)) != STRING)
+ Error(QUOTE_MSG, "FontPath");
+ j = FALSE;
+ str = val.str;
+ if (ptr->file_fontpath == NULL) {
+ ptr->file_fontpath = malloc(1);
+ ptr->file_fontpath[0] = '\0';
+ i = strlen(str) + 1;
+ }
+ else {
+ i = strlen(ptr->file_fontpath) + strlen(str) + 1;
+ if (ptr->file_fontpath[strlen(ptr->file_fontpath) - 1] != ',') {
+ i++;
+ j = TRUE;
+ }
+ }
+ ptr->file_fontpath = realloc(ptr->file_fontpath, i);
+ if (j)
+ strcat(ptr->file_fontpath, ",");
+
+ strcat(ptr->file_fontpath, str);
+ free(val.str);
+ break;
+ case MODULEPATH:
+ if (xf86getSubToken(&(ptr->file_comment)) != STRING)
+ Error(QUOTE_MSG, "ModulePath");
+ l = FALSE;
+ str = val.str;
+ if (ptr->file_modulepath == NULL) {
+ ptr->file_modulepath = malloc(1);
+ ptr->file_modulepath[0] = '\0';
+ k = strlen(str) + 1;
+ }
+ else {
+ k = strlen(ptr->file_modulepath) + strlen(str) + 1;
+ if (ptr->file_modulepath[strlen(ptr->file_modulepath) - 1] !=
+ ',') {
+ k++;
+ l = TRUE;
+ }
+ }
+ ptr->file_modulepath = realloc(ptr->file_modulepath, k);
+ if (l)
+ strcat(ptr->file_modulepath, ",");
+
+ strcat(ptr->file_modulepath, str);
+ free(val.str);
+ break;
+ case LOGFILEPATH:
+ if (xf86getSubToken(&(ptr->file_comment)) != STRING)
+ Error(QUOTE_MSG, "LogFile");
+ ptr->file_logfile = val.str;
+ break;
+ case XKBDIR:
+ if (xf86getSubToken(&(ptr->file_xkbdir)) != STRING)
+ Error(QUOTE_MSG, "XkbDir");
+ ptr->file_xkbdir = val.str;
+ break;
+ case EOF_TOKEN:
+ Error(UNEXPECTED_EOF_MSG);
+ break;
+ case OBSOLETE_TOKEN:
+ xf86parseError(OBSOLETE_MSG, xf86tokenString());
+ xf86getSubToken(&(ptr->file_comment));
+ break;
+ default:
+ Error(INVALID_KEYWORD_MSG, xf86tokenString());
+ break;
+ }
+ }
#ifdef DEBUG
- printf ("File section parsed\n");
+ printf("File section parsed\n");
#endif
- return ptr;
+ return ptr;
}
#undef CLEANUP
void
-xf86printFileSection (FILE * cf, XF86ConfFilesPtr ptr)
+xf86printFileSection(FILE * cf, XF86ConfFilesPtr ptr)
{
- char *p, *s;
-
- if (ptr == NULL)
- return;
-
- if (ptr->file_comment)
- fprintf (cf, "%s", ptr->file_comment);
- if (ptr->file_logfile)
- fprintf (cf, "\tLogFile \"%s\"\n", ptr->file_logfile);
- if (ptr->file_modulepath)
- {
- s = ptr->file_modulepath;
- p = index (s, ',');
- while (p)
- {
- *p = '\000';
- fprintf (cf, "\tModulePath \"%s\"\n", s);
- *p = ',';
- s = p;
- s++;
- p = index (s, ',');
- }
- fprintf (cf, "\tModulePath \"%s\"\n", s);
- }
- if (ptr->file_fontpath)
- {
- s = ptr->file_fontpath;
- p = index (s, ',');
- while (p)
- {
- *p = '\000';
- fprintf (cf, "\tFontPath \"%s\"\n", s);
- *p = ',';
- s = p;
- s++;
- p = index (s, ',');
- }
- fprintf (cf, "\tFontPath \"%s\"\n", s);
- }
- if (ptr->file_xkbdir)
- fprintf (cf, "\tXkbDir \"%s\"\n", ptr->file_xkbdir);
+ char *p, *s;
+
+ if (ptr == NULL)
+ return;
+
+ if (ptr->file_comment)
+ fprintf(cf, "%s", ptr->file_comment);
+ if (ptr->file_logfile)
+ fprintf(cf, "\tLogFile \"%s\"\n", ptr->file_logfile);
+ if (ptr->file_modulepath) {
+ s = ptr->file_modulepath;
+ p = index(s, ',');
+ while (p) {
+ *p = '\000';
+ fprintf(cf, "\tModulePath \"%s\"\n", s);
+ *p = ',';
+ s = p;
+ s++;
+ p = index(s, ',');
+ }
+ fprintf(cf, "\tModulePath \"%s\"\n", s);
+ }
+ if (ptr->file_fontpath) {
+ s = ptr->file_fontpath;
+ p = index(s, ',');
+ while (p) {
+ *p = '\000';
+ fprintf(cf, "\tFontPath \"%s\"\n", s);
+ *p = ',';
+ s = p;
+ s++;
+ p = index(s, ',');
+ }
+ fprintf(cf, "\tFontPath \"%s\"\n", s);
+ }
+ if (ptr->file_xkbdir)
+ fprintf(cf, "\tXkbDir \"%s\"\n", ptr->file_xkbdir);
}
void
-xf86freeFiles (XF86ConfFilesPtr p)
+xf86freeFiles(XF86ConfFilesPtr p)
{
- if (p == NULL)
- return;
+ if (p == NULL)
+ return;
- TestFree (p->file_logfile);
- TestFree (p->file_modulepath);
- TestFree (p->file_fontpath);
- TestFree (p->file_comment);
- TestFree (p->file_xkbdir);
+ TestFree(p->file_logfile);
+ TestFree(p->file_modulepath);
+ TestFree(p->file_fontpath);
+ TestFree(p->file_comment);
+ TestFree(p->file_xkbdir);
- free (p);
+ free(p);
}
diff --git a/xserver/hw/xfree86/parser/Flags.c b/xserver/hw/xfree86/parser/Flags.c
index 7a0794bb0..29a60a2e1 100644
--- a/xserver/hw/xfree86/parser/Flags.c
+++ b/xserver/hw/xfree86/parser/Flags.c
@@ -51,7 +51,6 @@
* authorization from the copyright holder(s) and author(s).
*/
-
/* View/edit this file with tab stops set to 4 */
#ifdef HAVE_XORG_CONFIG_H
@@ -63,245 +62,243 @@
#include "Configint.h"
#include <X11/Xfuncproto.h>
#include "Xprintf.h"
+#include "optionstr.h"
extern LexRec val;
-static xf86ConfigSymTabRec ServerFlagsTab[] =
-{
- {ENDSECTION, "endsection"},
- {NOTRAPSIGNALS, "notrapsignals"},
- {DONTZAP, "dontzap"},
- {DONTZOOM, "dontzoom"},
- {DISABLEVIDMODE, "disablevidmodeextension"},
- {ALLOWNONLOCAL, "allownonlocalxvidtune"},
- {DISABLEMODINDEV, "disablemodindev"},
- {MODINDEVALLOWNONLOCAL, "allownonlocalmodindev"},
- {ALLOWMOUSEOPENFAIL, "allowmouseopenfail"},
- {OPTION, "option"},
- {BLANKTIME, "blanktime"},
- {STANDBYTIME, "standbytime"},
- {SUSPENDTIME, "suspendtime"},
- {OFFTIME, "offtime"},
- {DEFAULTLAYOUT, "defaultserverlayout"},
- {-1, ""},
+static xf86ConfigSymTabRec ServerFlagsTab[] = {
+ {ENDSECTION, "endsection"},
+ {NOTRAPSIGNALS, "notrapsignals"},
+ {DONTZAP, "dontzap"},
+ {DONTZOOM, "dontzoom"},
+ {DISABLEVIDMODE, "disablevidmodeextension"},
+ {ALLOWNONLOCAL, "allownonlocalxvidtune"},
+ {DISABLEMODINDEV, "disablemodindev"},
+ {MODINDEVALLOWNONLOCAL, "allownonlocalmodindev"},
+ {ALLOWMOUSEOPENFAIL, "allowmouseopenfail"},
+ {OPTION, "option"},
+ {BLANKTIME, "blanktime"},
+ {STANDBYTIME, "standbytime"},
+ {SUSPENDTIME, "suspendtime"},
+ {OFFTIME, "offtime"},
+ {DEFAULTLAYOUT, "defaultserverlayout"},
+ {-1, ""},
};
#define CLEANUP xf86freeFlags
XF86ConfFlagsPtr
-xf86parseFlagsSection (void)
+xf86parseFlagsSection(void)
{
- int token;
- parsePrologue (XF86ConfFlagsPtr, XF86ConfFlagsRec)
-
- while ((token = xf86getToken (ServerFlagsTab)) != ENDSECTION)
- {
- int hasvalue = FALSE;
- int strvalue = FALSE;
- int tokentype;
- switch (token)
- {
- case COMMENT:
- ptr->flg_comment = xf86addComment(ptr->flg_comment, val.str);
- break;
- /*
- * these old keywords are turned into standard generic options.
- * we fall through here on purpose
- */
- case DEFAULTLAYOUT:
- strvalue = TRUE;
- case BLANKTIME:
- case STANDBYTIME:
- case SUSPENDTIME:
- case OFFTIME:
- hasvalue = TRUE;
- case NOTRAPSIGNALS:
- case DONTZAP:
- case DONTZOOM:
- case DISABLEVIDMODE:
- case ALLOWNONLOCAL:
- case DISABLEMODINDEV:
- case MODINDEVALLOWNONLOCAL:
- case ALLOWMOUSEOPENFAIL:
- {
- int i = 0;
- while (ServerFlagsTab[i].token != -1)
- {
- char *tmp;
-
- if (ServerFlagsTab[i].token == token)
- {
- char *valstr = NULL;
- tmp = strdup (ServerFlagsTab[i].name);
- if (hasvalue)
- {
- tokentype = xf86getSubToken(&(ptr->flg_comment));
- if (strvalue) {
- if (tokentype != STRING)
- Error (QUOTE_MSG, tmp);
- valstr = val.str;
- } else {
- if (tokentype != NUMBER)
- Error (NUMBER_MSG, tmp);
- if (asprintf(&valstr, "%d", val.num) == -1)
- valstr = NULL;
- }
- }
- ptr->flg_option_lst = xf86addNewOption
- (ptr->flg_option_lst, tmp, valstr);
- }
- i++;
- }
- }
- break;
- case OPTION:
- ptr->flg_option_lst = xf86parseOption(ptr->flg_option_lst);
- break;
-
- case EOF_TOKEN:
- Error (UNEXPECTED_EOF_MSG, NULL);
- break;
- default:
- Error (INVALID_KEYWORD_MSG, xf86tokenString ());
- break;
- }
- }
+ int token;
+
+ parsePrologue(XF86ConfFlagsPtr, XF86ConfFlagsRec)
+
+ while ((token = xf86getToken(ServerFlagsTab)) != ENDSECTION) {
+ int hasvalue = FALSE;
+ int strvalue = FALSE;
+ int tokentype;
+
+ switch (token) {
+ case COMMENT:
+ ptr->flg_comment = xf86addComment(ptr->flg_comment, val.str);
+ break;
+ /*
+ * these old keywords are turned into standard generic options.
+ * we fall through here on purpose
+ */
+ case DEFAULTLAYOUT:
+ strvalue = TRUE;
+ case BLANKTIME:
+ case STANDBYTIME:
+ case SUSPENDTIME:
+ case OFFTIME:
+ hasvalue = TRUE;
+ case NOTRAPSIGNALS:
+ case DONTZAP:
+ case DONTZOOM:
+ case DISABLEVIDMODE:
+ case ALLOWNONLOCAL:
+ case DISABLEMODINDEV:
+ case MODINDEVALLOWNONLOCAL:
+ case ALLOWMOUSEOPENFAIL:
+ {
+ int i = 0;
+
+ while (ServerFlagsTab[i].token != -1) {
+ char *tmp;
+
+ if (ServerFlagsTab[i].token == token) {
+ char *valstr = NULL;
+
+ tmp = strdup(ServerFlagsTab[i].name);
+ if (hasvalue) {
+ tokentype = xf86getSubToken(&(ptr->flg_comment));
+ if (strvalue) {
+ if (tokentype != STRING)
+ Error(QUOTE_MSG, tmp);
+ valstr = val.str;
+ }
+ else {
+ if (tokentype != NUMBER)
+ Error(NUMBER_MSG, tmp);
+ if (asprintf(&valstr, "%d", val.num) == -1)
+ valstr = NULL;
+ }
+ }
+ ptr->flg_option_lst = xf86addNewOption
+ (ptr->flg_option_lst, tmp, valstr);
+ }
+ i++;
+ }
+ }
+ break;
+ case OPTION:
+ ptr->flg_option_lst = xf86parseOption(ptr->flg_option_lst);
+ break;
+
+ case EOF_TOKEN:
+ Error(UNEXPECTED_EOF_MSG);
+ break;
+ default:
+ Error(INVALID_KEYWORD_MSG, xf86tokenString());
+ break;
+ }
+ }
#ifdef DEBUG
- printf ("Flags section parsed\n");
+ printf("Flags section parsed\n");
#endif
- return ptr;
+ return ptr;
}
#undef CLEANUP
void
-xf86printServerFlagsSection (FILE * f, XF86ConfFlagsPtr flags)
+xf86printServerFlagsSection(FILE * f, XF86ConfFlagsPtr flags)
{
- XF86OptionPtr p;
-
- if ((!flags) || (!flags->flg_option_lst))
- return;
- p = flags->flg_option_lst;
- fprintf (f, "Section \"ServerFlags\"\n");
- if (flags->flg_comment)
- fprintf (f, "%s", flags->flg_comment);
- xf86printOptionList(f, p, 1);
- fprintf (f, "EndSection\n\n");
+ XF86OptionPtr p;
+
+ if ((!flags) || (!flags->flg_option_lst))
+ return;
+ p = flags->flg_option_lst;
+ fprintf(f, "Section \"ServerFlags\"\n");
+ if (flags->flg_comment)
+ fprintf(f, "%s", flags->flg_comment);
+ xf86printOptionList(f, p, 1);
+ fprintf(f, "EndSection\n\n");
}
static XF86OptionPtr
-addNewOption2 (XF86OptionPtr head, char *name, char *val, int used)
+addNewOption2(XF86OptionPtr head, char *name, char *val, int used)
{
- XF86OptionPtr new, old = NULL;
-
- /* Don't allow duplicates, free old strings */
- if (head != NULL && (old = xf86findOption(head, name)) != NULL) {
- new = old;
- free(new->opt_name);
- free(new->opt_val);
- }
- else
- new = calloc (1, sizeof (XF86OptionRec));
- new->opt_name = name;
- new->opt_val = val;
- new->opt_used = used;
-
- if (old)
- return head;
- return ((XF86OptionPtr) xf86addListItem ((glp) head, (glp) new));
+ XF86OptionPtr new, old = NULL;
+
+ /* Don't allow duplicates, free old strings */
+ if (head != NULL && (old = xf86findOption(head, name)) != NULL) {
+ new = old;
+ free(new->opt_name);
+ free(new->opt_val);
+ }
+ else
+ new = calloc(1, sizeof(*new));
+ new->opt_name = name;
+ new->opt_val = val;
+ new->opt_used = used;
+
+ if (old)
+ return head;
+ return ((XF86OptionPtr) xf86addListItem((glp) head, (glp) new));
}
XF86OptionPtr
-xf86addNewOption (XF86OptionPtr head, char *name, char *val)
+xf86addNewOption(XF86OptionPtr head, char *name, char *val)
{
- return addNewOption2(head, name, val, 0);
+ return addNewOption2(head, name, val, 0);
}
void
-xf86freeFlags (XF86ConfFlagsPtr flags)
+xf86freeFlags(XF86ConfFlagsPtr flags)
{
- if (flags == NULL)
- return;
- xf86optionListFree (flags->flg_option_lst);
- TestFree(flags->flg_comment);
- free (flags);
+ if (flags == NULL)
+ return;
+ xf86optionListFree(flags->flg_option_lst);
+ TestFree(flags->flg_comment);
+ free(flags);
}
XF86OptionPtr
-xf86optionListDup (XF86OptionPtr opt)
+xf86optionListDup(XF86OptionPtr opt)
{
- XF86OptionPtr newopt = NULL;
- char *val;
-
- while (opt)
- {
- val = opt->opt_val ? strdup(opt->opt_val) : NULL;
- newopt = xf86addNewOption(newopt, strdup(opt->opt_name), val);
- newopt->opt_used = opt->opt_used;
- if (opt->opt_comment)
- newopt->opt_comment = strdup(opt->opt_comment);
- opt = opt->list.next;
- }
- return newopt;
+ XF86OptionPtr newopt = NULL;
+ char *val;
+
+ while (opt) {
+ val = opt->opt_val ? strdup(opt->opt_val) : NULL;
+ newopt = xf86addNewOption(newopt, strdup(opt->opt_name), val);
+ newopt->opt_used = opt->opt_used;
+ if (opt->opt_comment)
+ newopt->opt_comment = strdup(opt->opt_comment);
+ opt = opt->list.next;
+ }
+ return newopt;
}
void
-xf86optionListFree (XF86OptionPtr opt)
+xf86optionListFree(XF86OptionPtr opt)
{
- XF86OptionPtr prev;
-
- while (opt)
- {
- TestFree (opt->opt_name);
- TestFree (opt->opt_val);
- TestFree (opt->opt_comment);
- prev = opt;
- opt = opt->list.next;
- free (prev);
- }
+ XF86OptionPtr prev;
+
+ while (opt) {
+ TestFree(opt->opt_name);
+ TestFree(opt->opt_val);
+ TestFree(opt->opt_comment);
+ prev = opt;
+ opt = opt->list.next;
+ free(prev);
+ }
}
char *
xf86optionName(XF86OptionPtr opt)
{
- if (opt)
- return opt->opt_name;
- return 0;
+ if (opt)
+ return opt->opt_name;
+ return 0;
}
char *
xf86optionValue(XF86OptionPtr opt)
{
- if (opt)
- return opt->opt_val;
- return 0;
+ if (opt)
+ return opt->opt_val;
+ return 0;
}
XF86OptionPtr
xf86newOption(char *name, char *value)
{
- XF86OptionPtr opt;
+ XF86OptionPtr opt;
- opt = calloc(1, sizeof (XF86OptionRec));
- if (!opt)
- return NULL;
+ opt = calloc(1, sizeof(*opt));
+ if (!opt)
+ return NULL;
- opt->opt_used = 0;
- opt->list.next = 0;
- opt->opt_name = name;
- opt->opt_val = value;
+ opt->opt_used = 0;
+ opt->list.next = 0;
+ opt->opt_name = name;
+ opt->opt_val = value;
- return opt;
+ return opt;
}
XF86OptionPtr
xf86nextOption(XF86OptionPtr list)
{
- if (!list)
- return NULL;
- return list->list.next;
+ if (!list)
+ return NULL;
+ return list->list.next;
}
/*
@@ -311,15 +308,14 @@ xf86nextOption(XF86OptionPtr list)
*/
XF86OptionPtr
-xf86findOption (XF86OptionPtr list, const char *name)
+xf86findOption(XF86OptionPtr list, const char *name)
{
- while (list)
- {
- if (xf86nameCompare (list->opt_name, name) == 0)
- return list;
- list = list->list.next;
- }
- return NULL;
+ while (list) {
+ if (xf86nameCompare(list->opt_name, name) == 0)
+ return list;
+ list = list->list.next;
+ }
+ return NULL;
}
/*
@@ -329,46 +325,42 @@ xf86findOption (XF86OptionPtr list, const char *name)
* returned. If the option is not found, a NULL is returned.
*/
-char *
-xf86findOptionValue (XF86OptionPtr list, const char *name)
+const char *
+xf86findOptionValue(XF86OptionPtr list, const char *name)
{
- XF86OptionPtr p = xf86findOption (list, name);
-
- if (p)
- {
- if (p->opt_val)
- return p->opt_val;
- else
- return "";
- }
- return NULL;
+ XF86OptionPtr p = xf86findOption(list, name);
+
+ if (p) {
+ if (p->opt_val)
+ return p->opt_val;
+ else
+ return "";
+ }
+ return NULL;
}
XF86OptionPtr
-xf86optionListCreate( const char **options, int count, int used )
+xf86optionListCreate(const char **options, int count, int used)
{
- XF86OptionPtr p = NULL;
- char *t1, *t2;
- int i;
-
- if (count == -1)
- {
- for (count = 0; options[count]; count++)
- ;
- }
- if( (count % 2) != 0 )
- {
- fprintf( stderr, "xf86optionListCreate: count must be an even number.\n" );
- return NULL;
- }
- for (i = 0; i < count; i += 2)
- {
- t1 = strdup(options[i]);
- t2 = strdup(options[i + 1]);
- p = addNewOption2 (p, t1, t2, used);
- }
-
- return p;
+ XF86OptionPtr p = NULL;
+ char *t1, *t2;
+ int i;
+
+ if (count == -1) {
+ for (count = 0; options[count]; count++);
+ }
+ if ((count % 2) != 0) {
+ fprintf(stderr,
+ "xf86optionListCreate: count must be an even number.\n");
+ return NULL;
+ }
+ for (i = 0; i < count; i += 2) {
+ t1 = strdup(options[i]);
+ t2 = strdup(options[i + 1]);
+ p = addNewOption2(p, t1, t2, used);
+ }
+
+ return p;
}
/* the 2 given lists are merged. If an option with the same name is present in
@@ -377,128 +369,130 @@ xf86optionListCreate( const char **options, int count, int used )
* are freed, and the original lists are no longer guaranteed to be complete.
*/
XF86OptionPtr
-xf86optionListMerge (XF86OptionPtr head, XF86OptionPtr tail)
+xf86optionListMerge(XF86OptionPtr head, XF86OptionPtr tail)
{
- XF86OptionPtr a, b, ap = NULL, bp = NULL;
-
- a = tail;
- b = head;
- while (tail && b) {
- if (xf86nameCompare (a->opt_name, b->opt_name) == 0) {
- if (b == head)
- head = a;
- else
- bp->list.next = a;
- if (a == tail)
- tail = a->list.next;
- else
- ap->list.next = a->list.next;
- a->list.next = b->list.next;
- b->list.next = NULL;
- xf86optionListFree (b);
- b = a->list.next;
- bp = a;
- a = tail;
- ap = NULL;
- } else {
- ap = a;
- if (!(a = a->list.next)) {
- a = tail;
- bp = b;
- b = b->list.next;
- ap = NULL;
- }
- }
- }
-
- if (head) {
- for (a = head; a->list.next; a = a->list.next)
- ;
- a->list.next = tail;
- } else
- head = tail;
-
- return head;
+ XF86OptionPtr a, b, ap = NULL, bp = NULL;
+
+ a = tail;
+ b = head;
+ while (tail && b) {
+ if (xf86nameCompare(a->opt_name, b->opt_name) == 0) {
+ if (b == head)
+ head = a;
+ else
+ bp->list.next = a;
+ if (a == tail)
+ tail = a->list.next;
+ else
+ ap->list.next = a->list.next;
+ a->list.next = b->list.next;
+ b->list.next = NULL;
+ xf86optionListFree(b);
+ b = a->list.next;
+ bp = a;
+ a = tail;
+ ap = NULL;
+ }
+ else {
+ ap = a;
+ if (!(a = a->list.next)) {
+ a = tail;
+ bp = b;
+ b = b->list.next;
+ ap = NULL;
+ }
+ }
+ }
+
+ if (head) {
+ for (a = head; a->list.next; a = a->list.next);
+ a->list.next = tail;
+ }
+ else
+ head = tail;
+
+ return head;
}
char *
xf86uLongToString(unsigned long i)
{
- char *s;
+ char *s;
- if (asprintf(&s, "%lu", i) == -1)
- return NULL;
- return s;
+ if (asprintf(&s, "%lu", i) == -1)
+ return NULL;
+ return s;
}
XF86OptionPtr
xf86parseOption(XF86OptionPtr head)
{
- XF86OptionPtr option, cnew, old;
- char *name, *comment = NULL;
- int token;
-
- if ((token = xf86getSubToken(&comment)) != STRING) {
- xf86parseError(BAD_OPTION_MSG, NULL);
- free(comment);
- return head;
- }
-
- name = val.str;
- if ((token = xf86getSubToken(&comment)) == STRING) {
- option = xf86newOption(name, val.str);
- option->opt_comment = comment;
- if ((token = xf86getToken(NULL)) == COMMENT)
- option->opt_comment = xf86addComment(option->opt_comment, val.str);
- else
- xf86unGetToken(token);
- }
- else {
- option = xf86newOption(name, NULL);
- option->opt_comment = comment;
- if (token == COMMENT)
- option->opt_comment = xf86addComment(option->opt_comment, val.str);
- else
- xf86unGetToken(token);
- }
-
- old = NULL;
-
- /* Don't allow duplicates */
- if (head != NULL && (old = xf86findOption(head, name)) != NULL) {
- cnew = old;
- free(option->opt_name);
- TestFree(option->opt_val);
- TestFree(option->opt_comment);
- free(option);
- }
- else
- cnew = option;
-
- if (old == NULL)
- return ((XF86OptionPtr)xf86addListItem((glp)head, (glp)cnew));
-
- return head;
+ XF86OptionPtr option, cnew, old;
+ char *name, *comment = NULL;
+ int token;
+
+ if ((token = xf86getSubToken(&comment)) != STRING) {
+ xf86parseError(BAD_OPTION_MSG);
+ free(comment);
+ return head;
+ }
+
+ name = val.str;
+ if ((token = xf86getSubToken(&comment)) == STRING) {
+ option = xf86newOption(name, val.str);
+ option->opt_comment = comment;
+ if ((token = xf86getToken(NULL)) == COMMENT)
+ option->opt_comment = xf86addComment(option->opt_comment, val.str);
+ else
+ xf86unGetToken(token);
+ }
+ else {
+ option = xf86newOption(name, NULL);
+ option->opt_comment = comment;
+ if (token == COMMENT)
+ option->opt_comment = xf86addComment(option->opt_comment, val.str);
+ else
+ xf86unGetToken(token);
+ }
+
+ old = NULL;
+
+ /* Don't allow duplicates */
+ if (head != NULL && (old = xf86findOption(head, name)) != NULL) {
+ cnew = old;
+ free(option->opt_name);
+ TestFree(option->opt_val);
+ TestFree(option->opt_comment);
+ free(option);
+ }
+ else
+ cnew = option;
+
+ if (old == NULL)
+ return ((XF86OptionPtr) xf86addListItem((glp) head, (glp) cnew));
+
+ return head;
}
void
-xf86printOptionList(FILE *fp, XF86OptionPtr list, int tabs)
+xf86printOptionList(FILE * fp, XF86OptionPtr list, int tabs)
{
- int i;
-
- if (!list)
- return;
- while (list) {
- for (i = 0; i < tabs; i++)
- fputc('\t', fp);
- if (list->opt_val)
- fprintf(fp, "Option \"%s\" \"%s\"", list->opt_name, list->opt_val);
- else
- fprintf(fp, "Option \"%s\"", list->opt_name);
- if (list->opt_comment)
- fprintf(fp, "%s", list->opt_comment);
- else
- fputc('\n', fp);
- list = list->list.next;
- }
+ int i;
+
+ if (!list)
+ return;
+ while (list) {
+ for (i = 0; i < tabs; i++)
+ fputc('\t', fp);
+ if (list->opt_val)
+ fprintf(fp, "Option \"%s\" \"%s\"", list->opt_name,
+ list->opt_val);
+ else
+ fprintf(fp, "Option \"%s\"", list->opt_name);
+ if (list->opt_comment)
+ fprintf(fp, "%s", list->opt_comment);
+ else
+ fputc('\n', fp);
+ list = list->list.next;
+ }
}
diff --git a/xserver/hw/xfree86/parser/Input.c b/xserver/hw/xfree86/parser/Input.c
index faff0f45f..6e0073437 100644
--- a/xserver/hw/xfree86/parser/Input.c
+++ b/xserver/hw/xfree86/parser/Input.c
@@ -52,7 +52,6 @@
* authorization from the copyright holder(s) and author(s).
*/
-
/* View/edit this file with tab stops set to 4 */
#ifdef HAVE_XORG_CONFIG_H
@@ -67,147 +66,141 @@
extern LexRec val;
static
-xf86ConfigSymTabRec InputTab[] =
-{
- {ENDSECTION, "endsection"},
- {IDENTIFIER, "identifier"},
- {OPTION, "option"},
- {DRIVER, "driver"},
- {-1, ""},
+xf86ConfigSymTabRec InputTab[] = {
+ {ENDSECTION, "endsection"},
+ {IDENTIFIER, "identifier"},
+ {OPTION, "option"},
+ {DRIVER, "driver"},
+ {-1, ""},
};
#define CLEANUP xf86freeInputList
XF86ConfInputPtr
-xf86parseInputSection (void)
+xf86parseInputSection(void)
{
- int has_ident = FALSE;
- int token;
- parsePrologue (XF86ConfInputPtr, XF86ConfInputRec)
-
- while ((token = xf86getToken (InputTab)) != ENDSECTION)
- {
- switch (token)
- {
- case COMMENT:
- ptr->inp_comment = xf86addComment(ptr->inp_comment, val.str);
- break;
- case IDENTIFIER:
- if (xf86getSubToken (&(ptr->inp_comment)) != STRING)
- Error (QUOTE_MSG, "Identifier");
- if (has_ident == TRUE)
- Error (MULTIPLE_MSG, "Identifier");
- ptr->inp_identifier = val.str;
- has_ident = TRUE;
- break;
- case DRIVER:
- if (xf86getSubToken (&(ptr->inp_comment)) != STRING)
- Error (QUOTE_MSG, "Driver");
- if (strcmp(val.str, "keyboard") == 0) {
- ptr->inp_driver = strdup("kbd");
- free(val.str);
- }
- else
- ptr->inp_driver = val.str;
- break;
- case OPTION:
- ptr->inp_option_lst = xf86parseOption(ptr->inp_option_lst);
- break;
- case EOF_TOKEN:
- Error (UNEXPECTED_EOF_MSG, NULL);
- break;
- default:
- Error (INVALID_KEYWORD_MSG, xf86tokenString ());
- break;
- }
- }
-
- if (!has_ident)
- Error (NO_IDENT_MSG, NULL);
+ int has_ident = FALSE;
+ int token;
+
+ parsePrologue(XF86ConfInputPtr, XF86ConfInputRec)
+
+ while ((token = xf86getToken(InputTab)) != ENDSECTION) {
+ switch (token) {
+ case COMMENT:
+ ptr->inp_comment = xf86addComment(ptr->inp_comment, val.str);
+ break;
+ case IDENTIFIER:
+ if (xf86getSubToken(&(ptr->inp_comment)) != STRING)
+ Error(QUOTE_MSG, "Identifier");
+ if (has_ident == TRUE)
+ Error(MULTIPLE_MSG, "Identifier");
+ ptr->inp_identifier = val.str;
+ has_ident = TRUE;
+ break;
+ case DRIVER:
+ if (xf86getSubToken(&(ptr->inp_comment)) != STRING)
+ Error(QUOTE_MSG, "Driver");
+ if (strcmp(val.str, "keyboard") == 0) {
+ ptr->inp_driver = strdup("kbd");
+ free(val.str);
+ }
+ else
+ ptr->inp_driver = val.str;
+ break;
+ case OPTION:
+ ptr->inp_option_lst = xf86parseOption(ptr->inp_option_lst);
+ break;
+ case EOF_TOKEN:
+ Error(UNEXPECTED_EOF_MSG);
+ break;
+ default:
+ Error(INVALID_KEYWORD_MSG, xf86tokenString());
+ break;
+ }
+ }
+
+ if (!has_ident)
+ Error(NO_IDENT_MSG);
#ifdef DEBUG
- printf ("InputDevice section parsed\n");
+ printf("InputDevice section parsed\n");
#endif
- return ptr;
+ return ptr;
}
#undef CLEANUP
void
-xf86printInputSection (FILE * cf, XF86ConfInputPtr ptr)
+xf86printInputSection(FILE * cf, XF86ConfInputPtr ptr)
{
- while (ptr)
- {
- fprintf (cf, "Section \"InputDevice\"\n");
- if (ptr->inp_comment)
- fprintf (cf, "%s", ptr->inp_comment);
- if (ptr->inp_identifier)
- fprintf (cf, "\tIdentifier \"%s\"\n", ptr->inp_identifier);
- if (ptr->inp_driver)
- fprintf (cf, "\tDriver \"%s\"\n", ptr->inp_driver);
- xf86printOptionList(cf, ptr->inp_option_lst, 1);
- fprintf (cf, "EndSection\n\n");
- ptr = ptr->list.next;
- }
+ while (ptr) {
+ fprintf(cf, "Section \"InputDevice\"\n");
+ if (ptr->inp_comment)
+ fprintf(cf, "%s", ptr->inp_comment);
+ if (ptr->inp_identifier)
+ fprintf(cf, "\tIdentifier \"%s\"\n", ptr->inp_identifier);
+ if (ptr->inp_driver)
+ fprintf(cf, "\tDriver \"%s\"\n", ptr->inp_driver);
+ xf86printOptionList(cf, ptr->inp_option_lst, 1);
+ fprintf(cf, "EndSection\n\n");
+ ptr = ptr->list.next;
+ }
}
void
-xf86freeInputList (XF86ConfInputPtr ptr)
+xf86freeInputList(XF86ConfInputPtr ptr)
{
- XF86ConfInputPtr prev;
-
- while (ptr)
- {
- TestFree (ptr->inp_identifier);
- TestFree (ptr->inp_driver);
- TestFree (ptr->inp_comment);
- xf86optionListFree (ptr->inp_option_lst);
-
- prev = ptr;
- ptr = ptr->list.next;
- free (prev);
- }
+ XF86ConfInputPtr prev;
+
+ while (ptr) {
+ TestFree(ptr->inp_identifier);
+ TestFree(ptr->inp_driver);
+ TestFree(ptr->inp_comment);
+ xf86optionListFree(ptr->inp_option_lst);
+
+ prev = ptr;
+ ptr = ptr->list.next;
+ free(prev);
+ }
}
int
-xf86validateInput (XF86ConfigPtr p)
+xf86validateInput(XF86ConfigPtr p)
{
- XF86ConfInputPtr input = p->conf_input_lst;
-
- while (input) {
- if (!input->inp_driver) {
- xf86validationError (UNDEFINED_INPUTDRIVER_MSG, input->inp_identifier);
- return FALSE;
- }
- input = input->list.next;
- }
- return TRUE;
+ XF86ConfInputPtr input = p->conf_input_lst;
+
+ while (input) {
+ if (!input->inp_driver) {
+ xf86validationError(UNDEFINED_INPUTDRIVER_MSG,
+ input->inp_identifier);
+ return FALSE;
+ }
+ input = input->list.next;
+ }
+ return TRUE;
}
XF86ConfInputPtr
-xf86findInput (const char *ident, XF86ConfInputPtr p)
+xf86findInput(const char *ident, XF86ConfInputPtr p)
{
- while (p)
- {
- if (xf86nameCompare (ident, p->inp_identifier) == 0)
- return p;
-
- p = p->list.next;
- }
- return NULL;
+ while (p) {
+ if (xf86nameCompare(ident, p->inp_identifier) == 0)
+ return p;
+
+ p = p->list.next;
+ }
+ return NULL;
}
XF86ConfInputPtr
-xf86findInputByDriver (const char *driver, XF86ConfInputPtr p)
+xf86findInputByDriver(const char *driver, XF86ConfInputPtr p)
{
- while (p)
- {
- if (xf86nameCompare (driver, p->inp_driver) == 0)
- return p;
-
- p = p->list.next;
- }
- return NULL;
-}
+ while (p) {
+ if (xf86nameCompare(driver, p->inp_driver) == 0)
+ return p;
+ p = p->list.next;
+ }
+ return NULL;
+}
diff --git a/xserver/hw/xfree86/parser/InputClass.c b/xserver/hw/xfree86/parser/InputClass.c
index 3f801700e..8493685cd 100644
--- a/xserver/hw/xfree86/parser/InputClass.c
+++ b/xserver/hw/xfree86/parser/InputClass.c
@@ -38,8 +38,7 @@
extern LexRec val;
static
-xf86ConfigSymTabRec InputClassTab[] =
-{
+xf86ConfigSymTabRec InputClassTab[] = {
{ENDSECTION, "endsection"},
{IDENTIFIER, "identifier"},
{OPTION, "option"},
@@ -67,14 +66,14 @@ xf86ConfigSymTabRec InputClassTab[] =
#define TOKEN_SEP "|"
static void
-add_group_entry(struct list *head, char **values)
+add_group_entry(struct xorg_list *head, char **values)
{
xf86MatchGroup *group;
group = malloc(sizeof(*group));
if (group) {
group->values = values;
- list_add(&group->entry, head);
+ xorg_list_add(&group->entry, head);
}
}
@@ -86,16 +85,16 @@ xf86parseInputClassSection(void)
parsePrologue(XF86ConfInputClassPtr, XF86ConfInputClassRec)
- /* Initialize MatchGroup lists */
- list_init(&ptr->match_product);
- list_init(&ptr->match_vendor);
- list_init(&ptr->match_device);
- list_init(&ptr->match_os);
- list_init(&ptr->match_pnpid);
- list_init(&ptr->match_usbid);
- list_init(&ptr->match_driver);
- list_init(&ptr->match_tag);
- list_init(&ptr->match_layout);
+ /* Initialize MatchGroup lists */
+ xorg_list_init(&ptr->match_product);
+ xorg_list_init(&ptr->match_vendor);
+ xorg_list_init(&ptr->match_device);
+ xorg_list_init(&ptr->match_os);
+ xorg_list_init(&ptr->match_pnpid);
+ xorg_list_init(&ptr->match_usbid);
+ xorg_list_init(&ptr->match_driver);
+ xorg_list_init(&ptr->match_tag);
+ xorg_list_init(&ptr->match_layout);
while ((token = xf86getToken(InputClassTab)) != ENDSECTION) {
switch (token) {
@@ -128,60 +127,68 @@ xf86parseInputClassSection(void)
Error(QUOTE_MSG, "MatchProduct");
add_group_entry(&ptr->match_product,
xstrtokenize(val.str, TOKEN_SEP));
+ free(val.str);
break;
case MATCH_VENDOR:
if (xf86getSubToken(&(ptr->comment)) != STRING)
Error(QUOTE_MSG, "MatchVendor");
add_group_entry(&ptr->match_vendor,
xstrtokenize(val.str, TOKEN_SEP));
+ free(val.str);
break;
case MATCH_DEVICE_PATH:
if (xf86getSubToken(&(ptr->comment)) != STRING)
Error(QUOTE_MSG, "MatchDevicePath");
add_group_entry(&ptr->match_device,
xstrtokenize(val.str, TOKEN_SEP));
+ free(val.str);
break;
case MATCH_OS:
if (xf86getSubToken(&(ptr->comment)) != STRING)
Error(QUOTE_MSG, "MatchOS");
- add_group_entry(&ptr->match_os,
- xstrtokenize(val.str, TOKEN_SEP));
+ add_group_entry(&ptr->match_os, xstrtokenize(val.str, TOKEN_SEP));
+ free(val.str);
break;
case MATCH_PNPID:
if (xf86getSubToken(&(ptr->comment)) != STRING)
Error(QUOTE_MSG, "MatchPnPID");
add_group_entry(&ptr->match_pnpid,
xstrtokenize(val.str, TOKEN_SEP));
+ free(val.str);
break;
case MATCH_USBID:
if (xf86getSubToken(&(ptr->comment)) != STRING)
Error(QUOTE_MSG, "MatchUSBID");
add_group_entry(&ptr->match_usbid,
xstrtokenize(val.str, TOKEN_SEP));
+ free(val.str);
break;
case MATCH_DRIVER:
if (xf86getSubToken(&(ptr->comment)) != STRING)
Error(QUOTE_MSG, "MatchDriver");
add_group_entry(&ptr->match_driver,
xstrtokenize(val.str, TOKEN_SEP));
+ free(val.str);
break;
case MATCH_TAG:
if (xf86getSubToken(&(ptr->comment)) != STRING)
Error(QUOTE_MSG, "MatchTag");
- add_group_entry(&ptr->match_tag,
- xstrtokenize(val.str, TOKEN_SEP));
+ add_group_entry(&ptr->match_tag, xstrtokenize(val.str, TOKEN_SEP));
+ free(val.str);
break;
case MATCH_LAYOUT:
if (xf86getSubToken(&(ptr->comment)) != STRING)
Error(QUOTE_MSG, "MatchLayout");
add_group_entry(&ptr->match_layout,
xstrtokenize(val.str, TOKEN_SEP));
+ free(val.str);
break;
case MATCH_IS_KEYBOARD:
if (xf86getSubToken(&(ptr->comment)) != STRING)
Error(QUOTE_MSG, "MatchIsKeyboard");
ptr->is_keyboard.set = xf86getBoolValue(&ptr->is_keyboard.val,
val.str);
+ free(val.str);
if (!ptr->is_keyboard.set)
Error(BOOL_MSG, "MatchIsKeyboard");
break;
@@ -190,6 +197,7 @@ xf86parseInputClassSection(void)
Error(QUOTE_MSG, "MatchIsPointer");
ptr->is_pointer.set = xf86getBoolValue(&ptr->is_pointer.val,
val.str);
+ free(val.str);
if (!ptr->is_pointer.set)
Error(BOOL_MSG, "MatchIsPointer");
break;
@@ -198,14 +206,15 @@ xf86parseInputClassSection(void)
Error(QUOTE_MSG, "MatchIsJoystick");
ptr->is_joystick.set = xf86getBoolValue(&ptr->is_joystick.val,
val.str);
+ free(val.str);
if (!ptr->is_joystick.set)
Error(BOOL_MSG, "MatchIsJoystick");
break;
case MATCH_IS_TABLET:
if (xf86getSubToken(&(ptr->comment)) != STRING)
Error(QUOTE_MSG, "MatchIsTablet");
- ptr->is_tablet.set = xf86getBoolValue(&ptr->is_tablet.val,
- val.str);
+ ptr->is_tablet.set = xf86getBoolValue(&ptr->is_tablet.val, val.str);
+ free(val.str);
if (!ptr->is_tablet.set)
Error(BOOL_MSG, "MatchIsTablet");
break;
@@ -214,6 +223,7 @@ xf86parseInputClassSection(void)
Error(QUOTE_MSG, "MatchIsTouchpad");
ptr->is_touchpad.set = xf86getBoolValue(&ptr->is_touchpad.val,
val.str);
+ free(val.str);
if (!ptr->is_touchpad.set)
Error(BOOL_MSG, "MatchIsTouchpad");
break;
@@ -222,20 +232,21 @@ xf86parseInputClassSection(void)
Error(QUOTE_MSG, "MatchIsTouchscreen");
ptr->is_touchscreen.set = xf86getBoolValue(&ptr->is_touchscreen.val,
val.str);
+ free(val.str);
if (!ptr->is_touchscreen.set)
Error(BOOL_MSG, "MatchIsTouchscreen");
break;
case EOF_TOKEN:
- Error(UNEXPECTED_EOF_MSG, NULL);
+ Error(UNEXPECTED_EOF_MSG);
break;
default:
- Error(INVALID_KEYWORD_MSG, xf86tokenString ());
+ Error(INVALID_KEYWORD_MSG, xf86tokenString());
break;
}
}
if (!has_ident)
- Error(NO_IDENT_MSG, NULL);
+ Error(NO_IDENT_MSG);
#ifdef DEBUG
printf("InputClass section parsed\n");
@@ -245,10 +256,10 @@ xf86parseInputClassSection(void)
}
void
-xf86printInputClassSection (FILE * cf, XF86ConfInputClassPtr ptr)
+xf86printInputClassSection(FILE * cf, XF86ConfInputClassPtr ptr)
{
const xf86MatchGroup *group;
- char * const *cur;
+ char *const *cur;
while (ptr) {
fprintf(cf, "Section \"InputClass\"\n");
@@ -259,63 +270,63 @@ xf86printInputClassSection (FILE * cf, XF86ConfInputClassPtr ptr)
if (ptr->driver)
fprintf(cf, "\tDriver \"%s\"\n", ptr->driver);
- list_for_each_entry(group, &ptr->match_product, entry) {
+ xorg_list_for_each_entry(group, &ptr->match_product, entry) {
fprintf(cf, "\tMatchProduct \"");
for (cur = group->values; *cur; cur++)
fprintf(cf, "%s%s", cur == group->values ? "" : TOKEN_SEP,
*cur);
fprintf(cf, "\"\n");
}
- list_for_each_entry(group, &ptr->match_vendor, entry) {
+ xorg_list_for_each_entry(group, &ptr->match_vendor, entry) {
fprintf(cf, "\tMatchVendor \"");
for (cur = group->values; *cur; cur++)
fprintf(cf, "%s%s", cur == group->values ? "" : TOKEN_SEP,
*cur);
fprintf(cf, "\"\n");
}
- list_for_each_entry(group, &ptr->match_device, entry) {
+ xorg_list_for_each_entry(group, &ptr->match_device, entry) {
fprintf(cf, "\tMatchDevicePath \"");
for (cur = group->values; *cur; cur++)
fprintf(cf, "%s%s", cur == group->values ? "" : TOKEN_SEP,
*cur);
fprintf(cf, "\"\n");
}
- list_for_each_entry(group, &ptr->match_os, entry) {
+ xorg_list_for_each_entry(group, &ptr->match_os, entry) {
fprintf(cf, "\tMatchOS \"");
for (cur = group->values; *cur; cur++)
fprintf(cf, "%s%s", cur == group->values ? "" : TOKEN_SEP,
*cur);
fprintf(cf, "\"\n");
}
- list_for_each_entry(group, &ptr->match_pnpid, entry) {
+ xorg_list_for_each_entry(group, &ptr->match_pnpid, entry) {
fprintf(cf, "\tMatchPnPID \"");
for (cur = group->values; *cur; cur++)
fprintf(cf, "%s%s", cur == group->values ? "" : TOKEN_SEP,
*cur);
fprintf(cf, "\"\n");
}
- list_for_each_entry(group, &ptr->match_usbid, entry) {
+ xorg_list_for_each_entry(group, &ptr->match_usbid, entry) {
fprintf(cf, "\tMatchUSBID \"");
for (cur = group->values; *cur; cur++)
fprintf(cf, "%s%s", cur == group->values ? "" : TOKEN_SEP,
*cur);
fprintf(cf, "\"\n");
}
- list_for_each_entry(group, &ptr->match_driver, entry) {
+ xorg_list_for_each_entry(group, &ptr->match_driver, entry) {
fprintf(cf, "\tMatchDriver \"");
for (cur = group->values; *cur; cur++)
fprintf(cf, "%s%s", cur == group->values ? "" : TOKEN_SEP,
*cur);
fprintf(cf, "\"\n");
}
- list_for_each_entry(group, &ptr->match_tag, entry) {
+ xorg_list_for_each_entry(group, &ptr->match_tag, entry) {
fprintf(cf, "\tMatchTag \"");
for (cur = group->values; *cur; cur++)
fprintf(cf, "%s%s", cur == group->values ? "" : TOKEN_SEP,
*cur);
fprintf(cf, "\"\n");
}
- list_for_each_entry(group, &ptr->match_layout, entry) {
+ xorg_list_for_each_entry(group, &ptr->match_layout, entry) {
fprintf(cf, "\tMatchLayout \"");
for (cur = group->values; *cur; cur++)
fprintf(cf, "%s%s", cur == group->values ? "" : TOKEN_SEP,
@@ -348,7 +359,7 @@ xf86printInputClassSection (FILE * cf, XF86ConfInputClassPtr ptr)
}
void
-xf86freeInputClassList (XF86ConfInputClassPtr ptr)
+xf86freeInputClassList(XF86ConfInputClassPtr ptr)
{
XF86ConfInputClassPtr prev;
@@ -359,56 +370,56 @@ xf86freeInputClassList (XF86ConfInputClassPtr ptr)
TestFree(ptr->identifier);
TestFree(ptr->driver);
- list_for_each_entry_safe(group, next, &ptr->match_product, entry) {
- list_del(&group->entry);
+ xorg_list_for_each_entry_safe(group, next, &ptr->match_product, entry) {
+ xorg_list_del(&group->entry);
for (list = group->values; *list; list++)
free(*list);
free(group);
}
- list_for_each_entry_safe(group, next, &ptr->match_vendor, entry) {
- list_del(&group->entry);
+ xorg_list_for_each_entry_safe(group, next, &ptr->match_vendor, entry) {
+ xorg_list_del(&group->entry);
for (list = group->values; *list; list++)
free(*list);
free(group);
}
- list_for_each_entry_safe(group, next, &ptr->match_device, entry) {
- list_del(&group->entry);
+ xorg_list_for_each_entry_safe(group, next, &ptr->match_device, entry) {
+ xorg_list_del(&group->entry);
for (list = group->values; *list; list++)
free(*list);
free(group);
}
- list_for_each_entry_safe(group, next, &ptr->match_os, entry) {
- list_del(&group->entry);
+ xorg_list_for_each_entry_safe(group, next, &ptr->match_os, entry) {
+ xorg_list_del(&group->entry);
for (list = group->values; *list; list++)
free(*list);
free(group);
}
- list_for_each_entry_safe(group, next, &ptr->match_pnpid, entry) {
- list_del(&group->entry);
+ xorg_list_for_each_entry_safe(group, next, &ptr->match_pnpid, entry) {
+ xorg_list_del(&group->entry);
for (list = group->values; *list; list++)
free(*list);
free(group);
}
- list_for_each_entry_safe(group, next, &ptr->match_usbid, entry) {
- list_del(&group->entry);
+ xorg_list_for_each_entry_safe(group, next, &ptr->match_usbid, entry) {
+ xorg_list_del(&group->entry);
for (list = group->values; *list; list++)
free(*list);
free(group);
}
- list_for_each_entry_safe(group, next, &ptr->match_driver, entry) {
- list_del(&group->entry);
+ xorg_list_for_each_entry_safe(group, next, &ptr->match_driver, entry) {
+ xorg_list_del(&group->entry);
for (list = group->values; *list; list++)
free(*list);
free(group);
}
- list_for_each_entry_safe(group, next, &ptr->match_tag, entry) {
- list_del(&group->entry);
+ xorg_list_for_each_entry_safe(group, next, &ptr->match_tag, entry) {
+ xorg_list_del(&group->entry);
for (list = group->values; *list; list++)
free(*list);
free(group);
}
- list_for_each_entry_safe(group, next, &ptr->match_layout, entry) {
- list_del(&group->entry);
+ xorg_list_for_each_entry_safe(group, next, &ptr->match_layout, entry) {
+ xorg_list_del(&group->entry);
for (list = group->values; *list; list++)
free(*list);
free(group);
diff --git a/xserver/hw/xfree86/parser/Layout.c b/xserver/hw/xfree86/parser/Layout.c
index e1f770bc3..bd33d6dfc 100644
--- a/xserver/hw/xfree86/parser/Layout.c
+++ b/xserver/hw/xfree86/parser/Layout.c
@@ -52,7 +52,6 @@
* authorization from the copyright holder(s) and author(s).
*/
-
/* View/edit this file with tab stops set to 4 */
#ifdef HAVE_XORG_CONFIG_H
@@ -63,380 +62,366 @@
#include "xf86tokens.h"
#include "Configint.h"
#include <string.h>
-
+#include "optionstr.h"
/* Needed for auto server layout */
-extern int xf86CheckBoolOption(void* optlist, const char *name, int deflt);
+extern int xf86CheckBoolOption(void *optlist, const char *name, int deflt);
extern LexRec val;
-static xf86ConfigSymTabRec LayoutTab[] =
-{
- {ENDSECTION, "endsection"},
- {SCREEN, "screen"},
- {IDENTIFIER, "identifier"},
- {INACTIVE, "inactive"},
- {INPUTDEVICE, "inputdevice"},
- {OPTION, "option"},
- {-1, ""},
+static xf86ConfigSymTabRec LayoutTab[] = {
+ {ENDSECTION, "endsection"},
+ {SCREEN, "screen"},
+ {IDENTIFIER, "identifier"},
+ {INACTIVE, "inactive"},
+ {INPUTDEVICE, "inputdevice"},
+ {OPTION, "option"},
+ {-1, ""},
};
-static xf86ConfigSymTabRec AdjTab[] =
-{
- {RIGHTOF, "rightof"},
- {LEFTOF, "leftof"},
- {ABOVE, "above"},
- {BELOW, "below"},
- {RELATIVE, "relative"},
- {ABSOLUTE, "absolute"},
- {-1, ""},
+static xf86ConfigSymTabRec AdjTab[] = {
+ {RIGHTOF, "rightof"},
+ {LEFTOF, "leftof"},
+ {ABOVE, "above"},
+ {BELOW, "below"},
+ {RELATIVE, "relative"},
+ {ABSOLUTE, "absolute"},
+ {-1, ""},
};
#define CLEANUP xf86freeLayoutList
XF86ConfLayoutPtr
-xf86parseLayoutSection (void)
+xf86parseLayoutSection(void)
{
- int has_ident = FALSE;
- int token;
- parsePrologue (XF86ConfLayoutPtr, XF86ConfLayoutRec)
-
- while ((token = xf86getToken (LayoutTab)) != ENDSECTION)
- {
- switch (token)
- {
- case COMMENT:
- ptr->lay_comment = xf86addComment(ptr->lay_comment, val.str);
- break;
- case IDENTIFIER:
- if (xf86getSubToken (&(ptr->lay_comment)) != STRING)
- Error (QUOTE_MSG, "Identifier");
- if (has_ident == TRUE)
- Error (MULTIPLE_MSG, "Identifier");
- ptr->lay_identifier = val.str;
- has_ident = TRUE;
- break;
- case INACTIVE:
- {
- XF86ConfInactivePtr iptr;
-
- iptr = calloc (1, sizeof (XF86ConfInactiveRec));
- iptr->list.next = NULL;
- if (xf86getSubToken (&(ptr->lay_comment)) != STRING) {
- free (iptr);
- Error (INACTIVE_MSG, NULL);
- }
- iptr->inactive_device_str = val.str;
- ptr->lay_inactive_lst = (XF86ConfInactivePtr)
- xf86addListItem ((glp) ptr->lay_inactive_lst, (glp) iptr);
- }
- break;
- case SCREEN:
- {
- XF86ConfAdjacencyPtr aptr;
- int absKeyword = 0;
-
- aptr = calloc (1, sizeof (XF86ConfAdjacencyRec));
- aptr->list.next = NULL;
- aptr->adj_scrnum = -1;
- aptr->adj_where = CONF_ADJ_OBSOLETE;
- aptr->adj_x = 0;
- aptr->adj_y = 0;
- aptr->adj_refscreen = NULL;
- if ((token = xf86getSubToken (&(ptr->lay_comment))) == NUMBER)
- aptr->adj_scrnum = val.num;
- else
- xf86unGetToken (token);
- token = xf86getSubToken(&(ptr->lay_comment));
- if (token != STRING) {
- free(aptr);
- Error (SCREEN_MSG, NULL);
- }
- aptr->adj_screen_str = val.str;
-
- token = xf86getSubTokenWithTab(&(ptr->lay_comment), AdjTab);
- switch (token)
- {
- case RIGHTOF:
- aptr->adj_where = CONF_ADJ_RIGHTOF;
- break;
- case LEFTOF:
- aptr->adj_where = CONF_ADJ_LEFTOF;
- break;
- case ABOVE:
- aptr->adj_where = CONF_ADJ_ABOVE;
- break;
- case BELOW:
- aptr->adj_where = CONF_ADJ_BELOW;
- break;
- case RELATIVE:
- aptr->adj_where = CONF_ADJ_RELATIVE;
- break;
- case ABSOLUTE:
- aptr->adj_where = CONF_ADJ_ABSOLUTE;
- absKeyword = 1;
- break;
- case EOF_TOKEN:
- free(aptr);
- Error (UNEXPECTED_EOF_MSG, NULL);
- break;
- default:
- xf86unGetToken (token);
- token = xf86getSubToken(&(ptr->lay_comment));
- if (token == STRING)
- aptr->adj_where = CONF_ADJ_OBSOLETE;
- else
- aptr->adj_where = CONF_ADJ_ABSOLUTE;
- }
- switch (aptr->adj_where)
- {
- case CONF_ADJ_ABSOLUTE:
- if (absKeyword)
- token = xf86getSubToken(&(ptr->lay_comment));
- if (token == NUMBER)
- {
- aptr->adj_x = val.num;
- token = xf86getSubToken(&(ptr->lay_comment));
- if (token != NUMBER) {
- free(aptr);
- Error(INVALID_SCR_MSG, NULL);
- }
- aptr->adj_y = val.num;
- } else {
- if (absKeyword) {
- free(aptr);
- Error(INVALID_SCR_MSG, NULL);
- } else
- xf86unGetToken (token);
- }
- break;
- case CONF_ADJ_RIGHTOF:
- case CONF_ADJ_LEFTOF:
- case CONF_ADJ_ABOVE:
- case CONF_ADJ_BELOW:
- case CONF_ADJ_RELATIVE:
- token = xf86getSubToken(&(ptr->lay_comment));
- if (token != STRING) {
- free(aptr);
- Error(INVALID_SCR_MSG, NULL);
- }
- aptr->adj_refscreen = val.str;
- if (aptr->adj_where == CONF_ADJ_RELATIVE)
- {
- token = xf86getSubToken(&(ptr->lay_comment));
- if (token != NUMBER) {
- free(aptr);
- Error(INVALID_SCR_MSG, NULL);
- }
- aptr->adj_x = val.num;
- token = xf86getSubToken(&(ptr->lay_comment));
- if (token != NUMBER) {
- free(aptr);
- Error(INVALID_SCR_MSG, NULL);
- }
- aptr->adj_y = val.num;
- }
- break;
- case CONF_ADJ_OBSOLETE:
- /* top */
- aptr->adj_top_str = val.str;
-
- /* bottom */
- if (xf86getSubToken (&(ptr->lay_comment)) != STRING) {
- free(aptr);
- Error (SCREEN_MSG, NULL);
- }
- aptr->adj_bottom_str = val.str;
-
- /* left */
- if (xf86getSubToken (&(ptr->lay_comment)) != STRING) {
- free(aptr);
- Error (SCREEN_MSG, NULL);
- }
- aptr->adj_left_str = val.str;
-
- /* right */
- if (xf86getSubToken (&(ptr->lay_comment)) != STRING) {
- free(aptr);
- Error (SCREEN_MSG, NULL);
- }
- aptr->adj_right_str = val.str;
-
- }
- ptr->lay_adjacency_lst = (XF86ConfAdjacencyPtr)
- xf86addListItem ((glp) ptr->lay_adjacency_lst, (glp) aptr);
- }
- break;
- case INPUTDEVICE:
- {
- XF86ConfInputrefPtr iptr;
-
- iptr = calloc (1, sizeof (XF86ConfInputrefRec));
- iptr->list.next = NULL;
- iptr->iref_option_lst = NULL;
- if (xf86getSubToken (&(ptr->lay_comment)) != STRING) {
- free(iptr);
- Error (INPUTDEV_MSG, NULL);
- }
- iptr->iref_inputdev_str = val.str;
- while ((token = xf86getSubToken (&(ptr->lay_comment))) == STRING)
- {
- iptr->iref_option_lst =
- xf86addNewOption (iptr->iref_option_lst, val.str, NULL);
- }
- xf86unGetToken (token);
- ptr->lay_input_lst = (XF86ConfInputrefPtr)
- xf86addListItem ((glp) ptr->lay_input_lst, (glp) iptr);
- }
- break;
- case OPTION:
- ptr->lay_option_lst = xf86parseOption(ptr->lay_option_lst);
- break;
- case EOF_TOKEN:
- Error (UNEXPECTED_EOF_MSG, NULL);
- break;
- default:
- Error (INVALID_KEYWORD_MSG, xf86tokenString ());
- break;
- }
- }
-
- if (!has_ident)
- Error (NO_IDENT_MSG, NULL);
+ int has_ident = FALSE;
+ int token;
+
+ parsePrologue(XF86ConfLayoutPtr, XF86ConfLayoutRec)
+
+ while ((token = xf86getToken(LayoutTab)) != ENDSECTION) {
+ switch (token) {
+ case COMMENT:
+ ptr->lay_comment = xf86addComment(ptr->lay_comment, val.str);
+ break;
+ case IDENTIFIER:
+ if (xf86getSubToken(&(ptr->lay_comment)) != STRING)
+ Error(QUOTE_MSG, "Identifier");
+ if (has_ident == TRUE)
+ Error(MULTIPLE_MSG, "Identifier");
+ ptr->lay_identifier = val.str;
+ has_ident = TRUE;
+ break;
+ case INACTIVE:
+ {
+ XF86ConfInactivePtr iptr;
+
+ iptr = calloc(1, sizeof(XF86ConfInactiveRec));
+ iptr->list.next = NULL;
+ if (xf86getSubToken(&(ptr->lay_comment)) != STRING) {
+ free(iptr);
+ Error(INACTIVE_MSG);
+ }
+ iptr->inactive_device_str = val.str;
+ ptr->lay_inactive_lst = (XF86ConfInactivePtr)
+ xf86addListItem((glp) ptr->lay_inactive_lst, (glp) iptr);
+ }
+ break;
+ case SCREEN:
+ {
+ XF86ConfAdjacencyPtr aptr;
+ int absKeyword = 0;
+
+ aptr = calloc(1, sizeof(XF86ConfAdjacencyRec));
+ aptr->list.next = NULL;
+ aptr->adj_scrnum = -1;
+ aptr->adj_where = CONF_ADJ_OBSOLETE;
+ aptr->adj_x = 0;
+ aptr->adj_y = 0;
+ aptr->adj_refscreen = NULL;
+ if ((token = xf86getSubToken(&(ptr->lay_comment))) == NUMBER)
+ aptr->adj_scrnum = val.num;
+ else
+ xf86unGetToken(token);
+ token = xf86getSubToken(&(ptr->lay_comment));
+ if (token != STRING) {
+ free(aptr);
+ Error(SCREEN_MSG);
+ }
+ aptr->adj_screen_str = val.str;
+
+ token = xf86getSubTokenWithTab(&(ptr->lay_comment), AdjTab);
+ switch (token) {
+ case RIGHTOF:
+ aptr->adj_where = CONF_ADJ_RIGHTOF;
+ break;
+ case LEFTOF:
+ aptr->adj_where = CONF_ADJ_LEFTOF;
+ break;
+ case ABOVE:
+ aptr->adj_where = CONF_ADJ_ABOVE;
+ break;
+ case BELOW:
+ aptr->adj_where = CONF_ADJ_BELOW;
+ break;
+ case RELATIVE:
+ aptr->adj_where = CONF_ADJ_RELATIVE;
+ break;
+ case ABSOLUTE:
+ aptr->adj_where = CONF_ADJ_ABSOLUTE;
+ absKeyword = 1;
+ break;
+ case EOF_TOKEN:
+ free(aptr);
+ Error(UNEXPECTED_EOF_MSG);
+ break;
+ default:
+ xf86unGetToken(token);
+ token = xf86getSubToken(&(ptr->lay_comment));
+ if (token == STRING)
+ aptr->adj_where = CONF_ADJ_OBSOLETE;
+ else
+ aptr->adj_where = CONF_ADJ_ABSOLUTE;
+ }
+ switch (aptr->adj_where) {
+ case CONF_ADJ_ABSOLUTE:
+ if (absKeyword)
+ token = xf86getSubToken(&(ptr->lay_comment));
+ if (token == NUMBER) {
+ aptr->adj_x = val.num;
+ token = xf86getSubToken(&(ptr->lay_comment));
+ if (token != NUMBER) {
+ free(aptr);
+ Error(INVALID_SCR_MSG);
+ }
+ aptr->adj_y = val.num;
+ }
+ else {
+ if (absKeyword) {
+ free(aptr);
+ Error(INVALID_SCR_MSG);
+ }
+ else
+ xf86unGetToken(token);
+ }
+ break;
+ case CONF_ADJ_RIGHTOF:
+ case CONF_ADJ_LEFTOF:
+ case CONF_ADJ_ABOVE:
+ case CONF_ADJ_BELOW:
+ case CONF_ADJ_RELATIVE:
+ token = xf86getSubToken(&(ptr->lay_comment));
+ if (token != STRING) {
+ free(aptr);
+ Error(INVALID_SCR_MSG);
+ }
+ aptr->adj_refscreen = val.str;
+ if (aptr->adj_where == CONF_ADJ_RELATIVE) {
+ token = xf86getSubToken(&(ptr->lay_comment));
+ if (token != NUMBER) {
+ free(aptr);
+ Error(INVALID_SCR_MSG);
+ }
+ aptr->adj_x = val.num;
+ token = xf86getSubToken(&(ptr->lay_comment));
+ if (token != NUMBER) {
+ free(aptr);
+ Error(INVALID_SCR_MSG);
+ }
+ aptr->adj_y = val.num;
+ }
+ break;
+ case CONF_ADJ_OBSOLETE:
+ /* top */
+ aptr->adj_top_str = val.str;
+
+ /* bottom */
+ if (xf86getSubToken(&(ptr->lay_comment)) != STRING) {
+ free(aptr);
+ Error(SCREEN_MSG);
+ }
+ aptr->adj_bottom_str = val.str;
+
+ /* left */
+ if (xf86getSubToken(&(ptr->lay_comment)) != STRING) {
+ free(aptr);
+ Error(SCREEN_MSG);
+ }
+ aptr->adj_left_str = val.str;
+
+ /* right */
+ if (xf86getSubToken(&(ptr->lay_comment)) != STRING) {
+ free(aptr);
+ Error(SCREEN_MSG);
+ }
+ aptr->adj_right_str = val.str;
+
+ }
+ ptr->lay_adjacency_lst = (XF86ConfAdjacencyPtr)
+ xf86addListItem((glp) ptr->lay_adjacency_lst, (glp) aptr);
+ }
+ break;
+ case INPUTDEVICE:
+ {
+ XF86ConfInputrefPtr iptr;
+
+ iptr = calloc(1, sizeof(XF86ConfInputrefRec));
+ iptr->list.next = NULL;
+ iptr->iref_option_lst = NULL;
+ if (xf86getSubToken(&(ptr->lay_comment)) != STRING) {
+ free(iptr);
+ Error(INPUTDEV_MSG);
+ }
+ iptr->iref_inputdev_str = val.str;
+ while ((token = xf86getSubToken(&(ptr->lay_comment))) == STRING) {
+ iptr->iref_option_lst =
+ xf86addNewOption(iptr->iref_option_lst, val.str, NULL);
+ }
+ xf86unGetToken(token);
+ ptr->lay_input_lst = (XF86ConfInputrefPtr)
+ xf86addListItem((glp) ptr->lay_input_lst, (glp) iptr);
+ }
+ break;
+ case OPTION:
+ ptr->lay_option_lst = xf86parseOption(ptr->lay_option_lst);
+ break;
+ case EOF_TOKEN:
+ Error(UNEXPECTED_EOF_MSG);
+ break;
+ default:
+ Error(INVALID_KEYWORD_MSG, xf86tokenString());
+ break;
+ }
+ }
+
+ if (!has_ident)
+ Error(NO_IDENT_MSG);
#ifdef DEBUG
- printf ("Layout section parsed\n");
+ printf("Layout section parsed\n");
#endif
- return ptr;
+ return ptr;
}
#undef CLEANUP
void
-xf86printLayoutSection (FILE * cf, XF86ConfLayoutPtr ptr)
+xf86printLayoutSection(FILE * cf, XF86ConfLayoutPtr ptr)
{
- XF86ConfAdjacencyPtr aptr;
- XF86ConfInactivePtr iptr;
- XF86ConfInputrefPtr inptr;
- XF86OptionPtr optr;
-
- while (ptr)
- {
- fprintf (cf, "Section \"ServerLayout\"\n");
- if (ptr->lay_comment)
- fprintf (cf, "%s", ptr->lay_comment);
- if (ptr->lay_identifier)
- fprintf (cf, "\tIdentifier \"%s\"\n", ptr->lay_identifier);
-
- for (aptr = ptr->lay_adjacency_lst; aptr; aptr = aptr->list.next)
- {
- fprintf (cf, "\tScreen ");
- if (aptr->adj_scrnum >= 0)
- fprintf (cf, "%2d", aptr->adj_scrnum);
- else
- fprintf (cf, " ");
- fprintf (cf, " \"%s\"", aptr->adj_screen_str);
- switch(aptr->adj_where)
- {
- case CONF_ADJ_OBSOLETE:
- fprintf (cf, " \"%s\"", aptr->adj_top_str);
- fprintf (cf, " \"%s\"", aptr->adj_bottom_str);
- fprintf (cf, " \"%s\"", aptr->adj_right_str);
- fprintf (cf, " \"%s\"\n", aptr->adj_left_str);
- break;
- case CONF_ADJ_ABSOLUTE:
- if (aptr->adj_x != -1)
- fprintf (cf, " %d %d\n", aptr->adj_x, aptr->adj_y);
- else
- fprintf (cf, "\n");
- break;
- case CONF_ADJ_RIGHTOF:
- fprintf (cf, " RightOf \"%s\"\n", aptr->adj_refscreen);
- break;
- case CONF_ADJ_LEFTOF:
- fprintf (cf, " LeftOf \"%s\"\n", aptr->adj_refscreen);
- break;
- case CONF_ADJ_ABOVE:
- fprintf (cf, " Above \"%s\"\n", aptr->adj_refscreen);
- break;
- case CONF_ADJ_BELOW:
- fprintf (cf, " Below \"%s\"\n", aptr->adj_refscreen);
- break;
- case CONF_ADJ_RELATIVE:
- fprintf (cf, " Relative \"%s\" %d %d\n", aptr->adj_refscreen,
- aptr->adj_x, aptr->adj_y);
- break;
- }
- }
- for (iptr = ptr->lay_inactive_lst; iptr; iptr = iptr->list.next)
- fprintf (cf, "\tInactive \"%s\"\n", iptr->inactive_device_str);
- for (inptr = ptr->lay_input_lst; inptr; inptr = inptr->list.next)
- {
- fprintf (cf, "\tInputDevice \"%s\"", inptr->iref_inputdev_str);
- for (optr = inptr->iref_option_lst; optr; optr = optr->list.next)
- {
- fprintf(cf, " \"%s\"", optr->opt_name);
- }
- fprintf(cf, "\n");
- }
- xf86printOptionList(cf, ptr->lay_option_lst, 1);
- fprintf (cf, "EndSection\n\n");
- ptr = ptr->list.next;
- }
+ XF86ConfAdjacencyPtr aptr;
+ XF86ConfInactivePtr iptr;
+ XF86ConfInputrefPtr inptr;
+ XF86OptionPtr optr;
+
+ while (ptr) {
+ fprintf(cf, "Section \"ServerLayout\"\n");
+ if (ptr->lay_comment)
+ fprintf(cf, "%s", ptr->lay_comment);
+ if (ptr->lay_identifier)
+ fprintf(cf, "\tIdentifier \"%s\"\n", ptr->lay_identifier);
+
+ for (aptr = ptr->lay_adjacency_lst; aptr; aptr = aptr->list.next) {
+ fprintf(cf, "\tScreen ");
+ if (aptr->adj_scrnum >= 0)
+ fprintf(cf, "%2d", aptr->adj_scrnum);
+ else
+ fprintf(cf, " ");
+ fprintf(cf, " \"%s\"", aptr->adj_screen_str);
+ switch (aptr->adj_where) {
+ case CONF_ADJ_OBSOLETE:
+ fprintf(cf, " \"%s\"", aptr->adj_top_str);
+ fprintf(cf, " \"%s\"", aptr->adj_bottom_str);
+ fprintf(cf, " \"%s\"", aptr->adj_right_str);
+ fprintf(cf, " \"%s\"\n", aptr->adj_left_str);
+ break;
+ case CONF_ADJ_ABSOLUTE:
+ if (aptr->adj_x != -1)
+ fprintf(cf, " %d %d\n", aptr->adj_x, aptr->adj_y);
+ else
+ fprintf(cf, "\n");
+ break;
+ case CONF_ADJ_RIGHTOF:
+ fprintf(cf, " RightOf \"%s\"\n", aptr->adj_refscreen);
+ break;
+ case CONF_ADJ_LEFTOF:
+ fprintf(cf, " LeftOf \"%s\"\n", aptr->adj_refscreen);
+ break;
+ case CONF_ADJ_ABOVE:
+ fprintf(cf, " Above \"%s\"\n", aptr->adj_refscreen);
+ break;
+ case CONF_ADJ_BELOW:
+ fprintf(cf, " Below \"%s\"\n", aptr->adj_refscreen);
+ break;
+ case CONF_ADJ_RELATIVE:
+ fprintf(cf, " Relative \"%s\" %d %d\n", aptr->adj_refscreen,
+ aptr->adj_x, aptr->adj_y);
+ break;
+ }
+ }
+ for (iptr = ptr->lay_inactive_lst; iptr; iptr = iptr->list.next)
+ fprintf(cf, "\tInactive \"%s\"\n", iptr->inactive_device_str);
+ for (inptr = ptr->lay_input_lst; inptr; inptr = inptr->list.next) {
+ fprintf(cf, "\tInputDevice \"%s\"", inptr->iref_inputdev_str);
+ for (optr = inptr->iref_option_lst; optr; optr = optr->list.next) {
+ fprintf(cf, " \"%s\"", optr->opt_name);
+ }
+ fprintf(cf, "\n");
+ }
+ xf86printOptionList(cf, ptr->lay_option_lst, 1);
+ fprintf(cf, "EndSection\n\n");
+ ptr = ptr->list.next;
+ }
}
static void
-xf86freeAdjacencyList (XF86ConfAdjacencyPtr ptr)
+xf86freeAdjacencyList(XF86ConfAdjacencyPtr ptr)
{
- XF86ConfAdjacencyPtr prev;
-
- while (ptr)
- {
- TestFree (ptr->adj_screen_str);
- TestFree (ptr->adj_top_str);
- TestFree (ptr->adj_bottom_str);
- TestFree (ptr->adj_left_str);
- TestFree (ptr->adj_right_str);
-
- prev = ptr;
- ptr = ptr->list.next;
- free (prev);
- }
+ XF86ConfAdjacencyPtr prev;
+
+ while (ptr) {
+ TestFree(ptr->adj_screen_str);
+ TestFree(ptr->adj_top_str);
+ TestFree(ptr->adj_bottom_str);
+ TestFree(ptr->adj_left_str);
+ TestFree(ptr->adj_right_str);
+
+ prev = ptr;
+ ptr = ptr->list.next;
+ free(prev);
+ }
}
static void
-xf86freeInputrefList (XF86ConfInputrefPtr ptr)
+xf86freeInputrefList(XF86ConfInputrefPtr ptr)
{
- XF86ConfInputrefPtr prev;
-
- while (ptr)
- {
- TestFree (ptr->iref_inputdev_str);
- xf86optionListFree (ptr->iref_option_lst);
- prev = ptr;
- ptr = ptr->list.next;
- free (prev);
- }
+ XF86ConfInputrefPtr prev;
+
+ while (ptr) {
+ TestFree(ptr->iref_inputdev_str);
+ xf86optionListFree(ptr->iref_option_lst);
+ prev = ptr;
+ ptr = ptr->list.next;
+ free(prev);
+ }
}
void
-xf86freeLayoutList (XF86ConfLayoutPtr ptr)
+xf86freeLayoutList(XF86ConfLayoutPtr ptr)
{
- XF86ConfLayoutPtr prev;
-
- while (ptr)
- {
- TestFree (ptr->lay_identifier);
- TestFree (ptr->lay_comment);
- xf86freeAdjacencyList (ptr->lay_adjacency_lst);
- xf86freeInputrefList (ptr->lay_input_lst);
- prev = ptr;
- ptr = ptr->list.next;
- free (prev);
- }
+ XF86ConfLayoutPtr prev;
+
+ while (ptr) {
+ TestFree(ptr->lay_identifier);
+ TestFree(ptr->lay_comment);
+ xf86freeAdjacencyList(ptr->lay_adjacency_lst);
+ xf86freeInputrefList(ptr->lay_input_lst);
+ prev = ptr;
+ ptr = ptr->list.next;
+ free(prev);
+ }
}
int
@@ -447,112 +432,103 @@ xf86layoutAddInputDevices(XF86ConfigPtr config, XF86ConfLayoutPtr layout)
XF86ConfInputrefPtr inptr;
/* add all AutoServerLayout devices to the server layout */
- while (input)
- {
- if (xf86CheckBoolOption(input->inp_option_lst, "AutoServerLayout", FALSE))
- {
- XF86ConfInputrefPtr iref = layout->lay_input_lst;
-
- /* avoid duplicates if referenced but lists AutoServerLayout too */
- while (iref)
- {
- if (strcmp(iref->iref_inputdev_str, input->inp_identifier) == 0)
- break;
- iref = iref->list.next;
- }
-
- if (!iref)
- {
- XF86ConfInputrefPtr iptr;
- iptr = calloc(1, sizeof(XF86ConfInputrefRec));
- iptr->iref_inputdev_str = input->inp_identifier;
- layout->lay_input_lst = (XF86ConfInputrefPtr)
- xf86addListItem((glp)layout->lay_input_lst, (glp)iptr);
- count++;
- }
- }
- input = input->list.next;
+ while (input) {
+ if (xf86CheckBoolOption
+ (input->inp_option_lst, "AutoServerLayout", FALSE)) {
+ XF86ConfInputrefPtr iref = layout->lay_input_lst;
+
+ /* avoid duplicates if referenced but lists AutoServerLayout too */
+ while (iref) {
+ if (strcmp(iref->iref_inputdev_str, input->inp_identifier) == 0)
+ break;
+ iref = iref->list.next;
+ }
+
+ if (!iref) {
+ XF86ConfInputrefPtr iptr;
+
+ iptr = calloc(1, sizeof(XF86ConfInputrefRec));
+ iptr->iref_inputdev_str = input->inp_identifier;
+ layout->lay_input_lst = (XF86ConfInputrefPtr)
+ xf86addListItem((glp) layout->lay_input_lst, (glp) iptr);
+ count++;
+ }
+ }
+ input = input->list.next;
}
inptr = layout->lay_input_lst;
- while (inptr)
- {
- input = xf86findInput (inptr->iref_inputdev_str,
- config->conf_input_lst);
- if (!input)
- {
- xf86validationError (UNDEFINED_INPUT_MSG,
- inptr->iref_inputdev_str, layout->lay_identifier);
- return -1;
- }
- else
- inptr->iref_inputdev = input;
- inptr = inptr->list.next;
+ while (inptr) {
+ input = xf86findInput(inptr->iref_inputdev_str, config->conf_input_lst);
+ if (!input) {
+ xf86validationError(UNDEFINED_INPUT_MSG,
+ inptr->iref_inputdev_str,
+ layout->lay_identifier);
+ return -1;
+ }
+ else
+ inptr->iref_inputdev = input;
+ inptr = inptr->list.next;
}
return count;
}
int
-xf86validateLayout (XF86ConfigPtr p)
+xf86validateLayout(XF86ConfigPtr p)
{
- XF86ConfLayoutPtr layout = p->conf_layout_lst;
- XF86ConfAdjacencyPtr adj;
- XF86ConfInactivePtr iptr;
- XF86ConfScreenPtr screen;
- XF86ConfDevicePtr device;
-
- while (layout)
- {
- adj = layout->lay_adjacency_lst;
- while (adj)
- {
- /* the first one can't be "" but all others can */
- screen = xf86findScreen (adj->adj_screen_str, p->conf_screen_lst);
- if (!screen)
- {
- xf86validationError (UNDEFINED_SCREEN_MSG,
- adj->adj_screen_str, layout->lay_identifier);
- return FALSE;
- }
- else
- adj->adj_screen = screen;
-
- adj = adj->list.next;
- }
- iptr = layout->lay_inactive_lst;
- while (iptr)
- {
- device = xf86findDevice (iptr->inactive_device_str,
- p->conf_device_lst);
- if (!device)
- {
- xf86validationError (UNDEFINED_DEVICE_LAY_MSG,
- iptr->inactive_device_str, layout->lay_identifier);
- return FALSE;
- }
- else
- iptr->inactive_device = device;
- iptr = iptr->list.next;
- }
-
- if (xf86layoutAddInputDevices(p, layout) == -1)
- return FALSE;
-
- layout = layout->list.next;
- }
- return TRUE;
+ XF86ConfLayoutPtr layout = p->conf_layout_lst;
+ XF86ConfAdjacencyPtr adj;
+ XF86ConfInactivePtr iptr;
+ XF86ConfScreenPtr screen;
+ XF86ConfDevicePtr device;
+
+ while (layout) {
+ adj = layout->lay_adjacency_lst;
+ while (adj) {
+ /* the first one can't be "" but all others can */
+ screen = xf86findScreen(adj->adj_screen_str, p->conf_screen_lst);
+ if (!screen) {
+ xf86validationError(UNDEFINED_SCREEN_MSG,
+ adj->adj_screen_str,
+ layout->lay_identifier);
+ return FALSE;
+ }
+ else
+ adj->adj_screen = screen;
+
+ adj = adj->list.next;
+ }
+ iptr = layout->lay_inactive_lst;
+ while (iptr) {
+ device = xf86findDevice(iptr->inactive_device_str,
+ p->conf_device_lst);
+ if (!device) {
+ xf86validationError(UNDEFINED_DEVICE_LAY_MSG,
+ iptr->inactive_device_str,
+ layout->lay_identifier);
+ return FALSE;
+ }
+ else
+ iptr->inactive_device = device;
+ iptr = iptr->list.next;
+ }
+
+ if (xf86layoutAddInputDevices(p, layout) == -1)
+ return FALSE;
+
+ layout = layout->list.next;
+ }
+ return TRUE;
}
XF86ConfLayoutPtr
-xf86findLayout (const char *name, XF86ConfLayoutPtr list)
+xf86findLayout(const char *name, XF86ConfLayoutPtr list)
{
- while (list)
- {
- if (xf86nameCompare (list->lay_identifier, name) == 0)
- return list;
- list = list->list.next;
- }
- return NULL;
+ while (list) {
+ if (xf86nameCompare(list->lay_identifier, name) == 0)
+ return list;
+ list = list->list.next;
+ }
+ return NULL;
}
-
diff --git a/xserver/hw/xfree86/parser/Makefile.am b/xserver/hw/xfree86/parser/Makefile.am
index 1cd70e7a5..002cfbf5c 100644
--- a/xserver/hw/xfree86/parser/Makefile.am
+++ b/xserver/hw/xfree86/parser/Makefile.am
@@ -50,3 +50,5 @@ EXTRA_DIST = \
sdk_HEADERS = \
xf86Parser.h \
xf86Optrec.h
+
+INCLUDES = -I$(srcdir)/../common
diff --git a/xserver/hw/xfree86/parser/Makefile.in b/xserver/hw/xfree86/parser/Makefile.in
index c695a526d..5a4dfa668 100644
--- a/xserver/hw/xfree86/parser/Makefile.in
+++ b/xserver/hw/xfree86/parser/Makefile.in
@@ -118,7 +118,6 @@ AGP_FALSE = @AGP_FALSE@
AGP_TRUE = @AGP_TRUE@
AIGLX_DRI_LOADER_FALSE = @AIGLX_DRI_LOADER_FALSE@
AIGLX_DRI_LOADER_TRUE = @AIGLX_DRI_LOADER_TRUE@
-ALLOCA = @ALLOCA@
ALPHA_VIDEO_FALSE = @ALPHA_VIDEO_FALSE@
ALPHA_VIDEO_TRUE = @ALPHA_VIDEO_TRUE@
AMDEP_FALSE = @AMDEP_FALSE@
@@ -137,6 +136,7 @@ AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
+BASE_CFLAGS = @BASE_CFLAGS@
BASE_FONT_PATH = @BASE_FONT_PATH@
BSD_APM_FALSE = @BSD_APM_FALSE@
BSD_APM_TRUE = @BSD_APM_TRUE@
@@ -344,8 +344,6 @@ LIB_MAN_DIR = @LIB_MAN_DIR@
LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
LINUX_ALPHA_FALSE = @LINUX_ALPHA_FALSE@
LINUX_ALPHA_TRUE = @LINUX_ALPHA_TRUE@
-LINUX_IA64_FALSE = @LINUX_IA64_FALSE@
-LINUX_IA64_TRUE = @LINUX_IA64_TRUE@
LIPO = @LIPO@
LNXACPI_FALSE = @LNXACPI_FALSE@
LNXACPI_TRUE = @LNXACPI_TRUE@
@@ -364,10 +362,6 @@ MISC_MAN_DIR = @MISC_MAN_DIR@
MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
MITSHM_FALSE = @MITSHM_FALSE@
MITSHM_TRUE = @MITSHM_TRUE@
-NEED_STRLCAT_FALSE = @NEED_STRLCAT_FALSE@
-NEED_STRLCAT_TRUE = @NEED_STRLCAT_TRUE@
-NEED_VSNPRINTF_FALSE = @NEED_VSNPRINTF_FALSE@
-NEED_VSNPRINTF_TRUE = @NEED_VSNPRINTF_TRUE@
NM = @NM@
NMEDIT = @NMEDIT@
OBJC = @OBJC@
@@ -511,18 +505,18 @@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
XNEST_TRUE = @XNEST_TRUE@
XORG_BUS_BSDPCI_FALSE = @XORG_BUS_BSDPCI_FALSE@
XORG_BUS_BSDPCI_TRUE = @XORG_BUS_BSDPCI_TRUE@
-XORG_BUS_LINUXPCI_FALSE = @XORG_BUS_LINUXPCI_FALSE@
-XORG_BUS_LINUXPCI_TRUE = @XORG_BUS_LINUXPCI_TRUE@
+XORG_BUS_PCI_FALSE = @XORG_BUS_PCI_FALSE@
+XORG_BUS_PCI_TRUE = @XORG_BUS_PCI_TRUE@
XORG_BUS_SPARC_FALSE = @XORG_BUS_SPARC_FALSE@
XORG_BUS_SPARC_TRUE = @XORG_BUS_SPARC_TRUE@
XORG_CFLAGS = @XORG_CFLAGS@
XORG_FALSE = @XORG_FALSE@
XORG_INCS = @XORG_INCS@
XORG_LIBS = @XORG_LIBS@
+XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@
XORG_MAN_PAGE = @XORG_MAN_PAGE@
XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@
XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
-XORG_OS = @XORG_OS@
XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
XORG_SGML_PATH = @XORG_SGML_PATH@
XORG_SYS_LIBS = @XORG_SYS_LIBS@
@@ -698,6 +692,7 @@ sdk_HEADERS = \
xf86Parser.h \
xf86Optrec.h
+INCLUDES = -I$(srcdir)/../common
all: all-am
.SUFFIXES:
diff --git a/xserver/hw/xfree86/parser/Module.c b/xserver/hw/xfree86/parser/Module.c
index ca323fc5a..1c458ae6c 100644
--- a/xserver/hw/xfree86/parser/Module.c
+++ b/xserver/hw/xfree86/parser/Module.c
@@ -52,7 +52,6 @@
* authorization from the copyright holder(s) and author(s).
*/
-
/* View/edit this file with tab stops set to 4 */
#ifdef HAVE_XORG_CONFIG_H
@@ -65,215 +64,207 @@
extern LexRec val;
-static xf86ConfigSymTabRec SubModuleTab[] =
-{
- {ENDSUBSECTION, "endsubsection"},
- {OPTION, "option"},
- {-1, ""},
+static xf86ConfigSymTabRec SubModuleTab[] = {
+ {ENDSUBSECTION, "endsubsection"},
+ {OPTION, "option"},
+ {-1, ""},
};
-static xf86ConfigSymTabRec ModuleTab[] =
-{
- {ENDSECTION, "endsection"},
- {LOAD, "load"},
- {DISABLE, "disable"},
- {LOAD_DRIVER, "loaddriver"},
- {SUBSECTION, "subsection"},
- {-1, ""},
+static xf86ConfigSymTabRec ModuleTab[] = {
+ {ENDSECTION, "endsection"},
+ {LOAD, "load"},
+ {DISABLE, "disable"},
+ {LOAD_DRIVER, "loaddriver"},
+ {SUBSECTION, "subsection"},
+ {-1, ""},
};
#define CLEANUP xf86freeModules
static XF86LoadPtr
-xf86parseModuleSubSection (XF86LoadPtr head, char *name)
+xf86parseModuleSubSection(XF86LoadPtr head, char *name)
{
- int token;
- parsePrologue (XF86LoadPtr, XF86LoadRec)
+ int token;
- ptr->load_name = name;
- ptr->load_type = XF86_LOAD_MODULE;
- ptr->ignore = 0;
- ptr->load_opt = NULL;
- ptr->list.next = NULL;
+ parsePrologue(XF86LoadPtr, XF86LoadRec)
- while ((token = xf86getToken (SubModuleTab)) != ENDSUBSECTION)
- {
- switch (token)
- {
- case COMMENT:
- ptr->load_comment = xf86addComment(ptr->load_comment, val.str);
- break;
- case OPTION:
- ptr->load_opt = xf86parseOption(ptr->load_opt);
- break;
- case EOF_TOKEN:
- xf86parseError (UNEXPECTED_EOF_MSG, NULL);
- free(ptr);
- return NULL;
- default:
- xf86parseError (INVALID_KEYWORD_MSG, xf86tokenString ());
- free(ptr);
- return NULL;
- break;
- }
+ ptr->load_name = name;
+ ptr->load_type = XF86_LOAD_MODULE;
+ ptr->ignore = 0;
+ ptr->load_opt = NULL;
+ ptr->list.next = NULL;
- }
+ while ((token = xf86getToken(SubModuleTab)) != ENDSUBSECTION) {
+ switch (token) {
+ case COMMENT:
+ ptr->load_comment = xf86addComment(ptr->load_comment, val.str);
+ break;
+ case OPTION:
+ ptr->load_opt = xf86parseOption(ptr->load_opt);
+ break;
+ case EOF_TOKEN:
+ xf86parseError(UNEXPECTED_EOF_MSG);
+ free(ptr);
+ return NULL;
+ default:
+ xf86parseError(INVALID_KEYWORD_MSG, xf86tokenString());
+ free(ptr);
+ return NULL;
+ break;
+ }
- return ((XF86LoadPtr) xf86addListItem ((glp) head, (glp) ptr));
+ }
+
+ return ((XF86LoadPtr) xf86addListItem((glp) head, (glp) ptr));
}
XF86ConfModulePtr
-xf86parseModuleSection (void)
+xf86parseModuleSection(void)
{
- int token;
- parsePrologue (XF86ConfModulePtr, XF86ConfModuleRec)
+ int token;
+
+ parsePrologue(XF86ConfModulePtr, XF86ConfModuleRec)
- while ((token = xf86getToken (ModuleTab)) != ENDSECTION)
- {
- switch (token)
- {
- case COMMENT:
- ptr->mod_comment = xf86addComment(ptr->mod_comment, val.str);
- break;
- case LOAD:
- if (xf86getSubToken (&(ptr->mod_comment)) != STRING)
- Error (QUOTE_MSG, "Load");
- ptr->mod_load_lst =
- xf86addNewLoadDirective (ptr->mod_load_lst, val.str,
- XF86_LOAD_MODULE, NULL);
- break;
- case DISABLE:
- if (xf86getSubToken (&(ptr->mod_comment)) != STRING)
- Error (QUOTE_MSG, "Disable");
- ptr->mod_disable_lst =
- xf86addNewLoadDirective (ptr->mod_disable_lst, val.str,
- XF86_DISABLE_MODULE, NULL);
- break;
- case LOAD_DRIVER:
- if (xf86getSubToken (&(ptr->mod_comment)) != STRING)
- Error (QUOTE_MSG, "LoadDriver");
- ptr->mod_load_lst =
- xf86addNewLoadDirective (ptr->mod_load_lst, val.str,
- XF86_LOAD_DRIVER, NULL);
- break;
- case SUBSECTION:
- if (xf86getSubToken (&(ptr->mod_comment)) != STRING)
- Error (QUOTE_MSG, "SubSection");
- ptr->mod_load_lst =
- xf86parseModuleSubSection (ptr->mod_load_lst, val.str);
- break;
- case EOF_TOKEN:
- Error (UNEXPECTED_EOF_MSG, NULL);
- break;
- default:
- Error (INVALID_KEYWORD_MSG, xf86tokenString ());
- break;
- }
- }
+ while ((token = xf86getToken(ModuleTab)) != ENDSECTION) {
+ switch (token) {
+ case COMMENT:
+ ptr->mod_comment = xf86addComment(ptr->mod_comment, val.str);
+ break;
+ case LOAD:
+ if (xf86getSubToken(&(ptr->mod_comment)) != STRING)
+ Error(QUOTE_MSG, "Load");
+ ptr->mod_load_lst =
+ xf86addNewLoadDirective(ptr->mod_load_lst, val.str,
+ XF86_LOAD_MODULE, NULL);
+ break;
+ case DISABLE:
+ if (xf86getSubToken(&(ptr->mod_comment)) != STRING)
+ Error(QUOTE_MSG, "Disable");
+ ptr->mod_disable_lst =
+ xf86addNewLoadDirective(ptr->mod_disable_lst, val.str,
+ XF86_DISABLE_MODULE, NULL);
+ break;
+ case LOAD_DRIVER:
+ if (xf86getSubToken(&(ptr->mod_comment)) != STRING)
+ Error(QUOTE_MSG, "LoadDriver");
+ ptr->mod_load_lst =
+ xf86addNewLoadDirective(ptr->mod_load_lst, val.str,
+ XF86_LOAD_DRIVER, NULL);
+ break;
+ case SUBSECTION:
+ if (xf86getSubToken(&(ptr->mod_comment)) != STRING)
+ Error(QUOTE_MSG, "SubSection");
+ ptr->mod_load_lst =
+ xf86parseModuleSubSection(ptr->mod_load_lst, val.str);
+ break;
+ case EOF_TOKEN:
+ Error(UNEXPECTED_EOF_MSG);
+ break;
+ default:
+ Error(INVALID_KEYWORD_MSG, xf86tokenString());
+ break;
+ }
+ }
#ifdef DEBUG
- printf ("Module section parsed\n");
+ printf("Module section parsed\n");
#endif
- return ptr;
+ return ptr;
}
#undef CLEANUP
void
-xf86printModuleSection (FILE * cf, XF86ConfModulePtr ptr)
+xf86printModuleSection(FILE * cf, XF86ConfModulePtr ptr)
{
- XF86LoadPtr lptr;
+ XF86LoadPtr lptr;
- if (ptr == NULL)
- return;
+ if (ptr == NULL)
+ return;
- if (ptr->mod_comment)
- fprintf(cf, "%s", ptr->mod_comment);
- for (lptr = ptr->mod_load_lst; lptr; lptr = lptr->list.next)
- {
- switch (lptr->load_type)
- {
- case XF86_LOAD_MODULE:
- if( lptr->load_opt == NULL ) {
- fprintf (cf, "\tLoad \"%s\"", lptr->load_name);
- if (lptr->load_comment)
- fprintf(cf, "%s", lptr->load_comment);
- else
- fputc('\n', cf);
- }
- else
- {
- fprintf (cf, "\tSubSection \"%s\"\n", lptr->load_name);
- if (lptr->load_comment)
- fprintf(cf, "%s", lptr->load_comment);
- xf86printOptionList(cf, lptr->load_opt, 2);
- fprintf (cf, "\tEndSubSection\n");
- }
- break;
- case XF86_LOAD_DRIVER:
- fprintf (cf, "\tLoadDriver \"%s\"", lptr->load_name);
- if (lptr->load_comment)
- fprintf(cf, "%s", lptr->load_comment);
- else
- fputc('\n', cf);
- break;
+ if (ptr->mod_comment)
+ fprintf(cf, "%s", ptr->mod_comment);
+ for (lptr = ptr->mod_load_lst; lptr; lptr = lptr->list.next) {
+ switch (lptr->load_type) {
+ case XF86_LOAD_MODULE:
+ if (lptr->load_opt == NULL) {
+ fprintf(cf, "\tLoad \"%s\"", lptr->load_name);
+ if (lptr->load_comment)
+ fprintf(cf, "%s", lptr->load_comment);
+ else
+ fputc('\n', cf);
+ }
+ else {
+ fprintf(cf, "\tSubSection \"%s\"\n", lptr->load_name);
+ if (lptr->load_comment)
+ fprintf(cf, "%s", lptr->load_comment);
+ xf86printOptionList(cf, lptr->load_opt, 2);
+ fprintf(cf, "\tEndSubSection\n");
+ }
+ break;
+ case XF86_LOAD_DRIVER:
+ fprintf(cf, "\tLoadDriver \"%s\"", lptr->load_name);
+ if (lptr->load_comment)
+ fprintf(cf, "%s", lptr->load_comment);
+ else
+ fputc('\n', cf);
+ break;
#if 0
- default:
- fprintf (cf, "#\tUnknown type \"%s\"\n", lptr->load_name);
- break;
+ default:
+ fprintf(cf, "#\tUnknown type \"%s\"\n", lptr->load_name);
+ break;
#endif
- }
- }
+ }
+ }
}
XF86LoadPtr
-xf86addNewLoadDirective (XF86LoadPtr head, char *name, int type, XF86OptionPtr opts)
+xf86addNewLoadDirective(XF86LoadPtr head, char *name, int type,
+ XF86OptionPtr opts)
{
- XF86LoadPtr new;
- int token;
+ XF86LoadPtr new;
+ int token;
- new = calloc (1, sizeof (XF86LoadRec));
- new->load_name = name;
- new->load_type = type;
- new->load_opt = opts;
- new->ignore = 0;
- new->list.next = NULL;
+ new = calloc(1, sizeof(XF86LoadRec));
+ new->load_name = name;
+ new->load_type = type;
+ new->load_opt = opts;
+ new->ignore = 0;
+ new->list.next = NULL;
- if ((token = xf86getToken(NULL)) == COMMENT)
- new->load_comment = xf86addComment(new->load_comment, val.str);
- else
- xf86unGetToken(token);
+ if ((token = xf86getToken(NULL)) == COMMENT)
+ new->load_comment = xf86addComment(new->load_comment, val.str);
+ else
+ xf86unGetToken(token);
- return ((XF86LoadPtr) xf86addListItem ((glp) head, (glp) new));
+ return ((XF86LoadPtr) xf86addListItem((glp) head, (glp) new));
}
void
-xf86freeModules (XF86ConfModulePtr ptr)
+xf86freeModules(XF86ConfModulePtr ptr)
{
- XF86LoadPtr lptr;
- XF86LoadPtr prev;
+ XF86LoadPtr lptr;
+ XF86LoadPtr prev;
- if (ptr == NULL)
- return;
- lptr = ptr->mod_load_lst;
- while (lptr)
- {
- TestFree (lptr->load_name);
- TestFree (lptr->load_comment);
- prev = lptr;
- lptr = lptr->list.next;
- free (prev);
- }
- lptr = ptr->mod_disable_lst;
- while (lptr)
- {
- TestFree (lptr->load_name);
- TestFree (lptr->load_comment);
- prev = lptr;
- lptr = lptr->list.next;
- free (prev);
- }
- TestFree (ptr->mod_comment);
- free (ptr);
+ if (ptr == NULL)
+ return;
+ lptr = ptr->mod_load_lst;
+ while (lptr) {
+ TestFree(lptr->load_name);
+ TestFree(lptr->load_comment);
+ prev = lptr;
+ lptr = lptr->list.next;
+ free(prev);
+ }
+ lptr = ptr->mod_disable_lst;
+ while (lptr) {
+ TestFree(lptr->load_name);
+ TestFree(lptr->load_comment);
+ prev = lptr;
+ lptr = lptr->list.next;
+ free(prev);
+ }
+ TestFree(ptr->mod_comment);
+ free(ptr);
}
diff --git a/xserver/hw/xfree86/parser/Monitor.c b/xserver/hw/xfree86/parser/Monitor.c
index 970406d4d..b237dfb32 100644
--- a/xserver/hw/xfree86/parser/Monitor.c
+++ b/xserver/hw/xfree86/parser/Monitor.c
@@ -52,7 +52,6 @@
* authorization from the copyright holder(s) and author(s).
*/
-
/* View/edit this file with tab stops set to 4 */
#ifdef HAVE_XORG_CONFIG_H
@@ -65,348 +64,340 @@
extern LexRec val;
-static xf86ConfigSymTabRec MonitorTab[] =
-{
- {ENDSECTION, "endsection"},
- {IDENTIFIER, "identifier"},
- {VENDOR, "vendorname"},
- {MODEL, "modelname"},
- {USEMODES, "usemodes"},
- {MODELINE, "modeline"},
- {DISPLAYSIZE, "displaysize"},
- {HORIZSYNC, "horizsync"},
- {VERTREFRESH, "vertrefresh"},
- {MODE, "mode"},
- {GAMMA, "gamma"},
- {OPTION, "option"},
- {-1, ""},
+static xf86ConfigSymTabRec MonitorTab[] = {
+ {ENDSECTION, "endsection"},
+ {IDENTIFIER, "identifier"},
+ {VENDOR, "vendorname"},
+ {MODEL, "modelname"},
+ {USEMODES, "usemodes"},
+ {MODELINE, "modeline"},
+ {DISPLAYSIZE, "displaysize"},
+ {HORIZSYNC, "horizsync"},
+ {VERTREFRESH, "vertrefresh"},
+ {MODE, "mode"},
+ {GAMMA, "gamma"},
+ {OPTION, "option"},
+ {-1, ""},
};
-static xf86ConfigSymTabRec ModesTab[] =
-{
- {ENDSECTION, "endsection"},
- {IDENTIFIER, "identifier"},
- {MODELINE, "modeline"},
- {MODE, "mode"},
- {-1, ""},
+static xf86ConfigSymTabRec ModesTab[] = {
+ {ENDSECTION, "endsection"},
+ {IDENTIFIER, "identifier"},
+ {MODELINE, "modeline"},
+ {MODE, "mode"},
+ {-1, ""},
};
-static xf86ConfigSymTabRec TimingTab[] =
-{
- {TT_INTERLACE, "interlace"},
- {TT_PHSYNC, "+hsync"},
- {TT_NHSYNC, "-hsync"},
- {TT_PVSYNC, "+vsync"},
- {TT_NVSYNC, "-vsync"},
- {TT_CSYNC, "composite"},
- {TT_PCSYNC, "+csync"},
- {TT_NCSYNC, "-csync"},
- {TT_DBLSCAN, "doublescan"},
- {TT_HSKEW, "hskew"},
- {TT_BCAST, "bcast"},
- {TT_VSCAN, "vscan"},
- {-1, ""},
+static xf86ConfigSymTabRec TimingTab[] = {
+ {TT_INTERLACE, "interlace"},
+ {TT_PHSYNC, "+hsync"},
+ {TT_NHSYNC, "-hsync"},
+ {TT_PVSYNC, "+vsync"},
+ {TT_NVSYNC, "-vsync"},
+ {TT_CSYNC, "composite"},
+ {TT_PCSYNC, "+csync"},
+ {TT_NCSYNC, "-csync"},
+ {TT_DBLSCAN, "doublescan"},
+ {TT_HSKEW, "hskew"},
+ {TT_BCAST, "bcast"},
+ {TT_VSCAN, "vscan"},
+ {-1, ""},
};
-static xf86ConfigSymTabRec ModeTab[] =
-{
- {DOTCLOCK, "dotclock"},
- {HTIMINGS, "htimings"},
- {VTIMINGS, "vtimings"},
- {FLAGS, "flags"},
- {HSKEW, "hskew"},
- {BCAST, "bcast"},
- {VSCAN, "vscan"},
- {ENDMODE, "endmode"},
- {-1, ""},
+static xf86ConfigSymTabRec ModeTab[] = {
+ {DOTCLOCK, "dotclock"},
+ {HTIMINGS, "htimings"},
+ {VTIMINGS, "vtimings"},
+ {FLAGS, "flags"},
+ {HSKEW, "hskew"},
+ {BCAST, "bcast"},
+ {VSCAN, "vscan"},
+ {ENDMODE, "endmode"},
+ {-1, ""},
};
#define CLEANUP xf86freeModeLineList
static void
-xf86freeModeLineList (XF86ConfModeLinePtr ptr)
+xf86freeModeLineList(XF86ConfModeLinePtr ptr)
{
- XF86ConfModeLinePtr prev;
- while (ptr)
- {
- TestFree (ptr->ml_identifier);
- TestFree (ptr->ml_comment);
- prev = ptr;
- ptr = ptr->list.next;
- free (prev);
- }
+ XF86ConfModeLinePtr prev;
+
+ while (ptr) {
+ TestFree(ptr->ml_identifier);
+ TestFree(ptr->ml_comment);
+ prev = ptr;
+ ptr = ptr->list.next;
+ free(prev);
+ }
}
static XF86ConfModeLinePtr
-xf86parseModeLine (void)
+xf86parseModeLine(void)
{
- int token;
- parsePrologue (XF86ConfModeLinePtr, XF86ConfModeLineRec)
-
- /* Identifier */
- if (xf86getSubToken (&(ptr->ml_comment)) != STRING)
- Error ("ModeLine identifier expected", NULL);
- ptr->ml_identifier = val.str;
-
- /* DotClock */
- if (xf86getSubToken (&(ptr->ml_comment)) != NUMBER)
- Error ("ModeLine dotclock expected", NULL);
- ptr->ml_clock = (int) (val.realnum * 1000.0 + 0.5);
-
- /* HDisplay */
- if (xf86getSubToken (&(ptr->ml_comment)) != NUMBER)
- Error ("ModeLine Hdisplay expected", NULL);
- ptr->ml_hdisplay = val.num;
-
- /* HSyncStart */
- if (xf86getSubToken (&(ptr->ml_comment)) != NUMBER)
- Error ("ModeLine HSyncStart expected", NULL);
- ptr->ml_hsyncstart = val.num;
-
- /* HSyncEnd */
- if (xf86getSubToken (&(ptr->ml_comment)) != NUMBER)
- Error ("ModeLine HSyncEnd expected", NULL);
- ptr->ml_hsyncend = val.num;
-
- /* HTotal */
- if (xf86getSubToken (&(ptr->ml_comment)) != NUMBER)
- Error ("ModeLine HTotal expected", NULL);
- ptr->ml_htotal = val.num;
-
- /* VDisplay */
- if (xf86getSubToken (&(ptr->ml_comment)) != NUMBER)
- Error ("ModeLine Vdisplay expected", NULL);
- ptr->ml_vdisplay = val.num;
-
- /* VSyncStart */
- if (xf86getSubToken (&(ptr->ml_comment)) != NUMBER)
- Error ("ModeLine VSyncStart expected", NULL);
- ptr->ml_vsyncstart = val.num;
-
- /* VSyncEnd */
- if (xf86getSubToken (&(ptr->ml_comment)) != NUMBER)
- Error ("ModeLine VSyncEnd expected", NULL);
- ptr->ml_vsyncend = val.num;
-
- /* VTotal */
- if (xf86getSubToken (&(ptr->ml_comment)) != NUMBER)
- Error ("ModeLine VTotal expected", NULL);
- ptr->ml_vtotal = val.num;
-
- token = xf86getSubTokenWithTab (&(ptr->ml_comment), TimingTab);
- while ((token == TT_INTERLACE) || (token == TT_PHSYNC) ||
- (token == TT_NHSYNC) || (token == TT_PVSYNC) ||
- (token == TT_NVSYNC) || (token == TT_CSYNC) ||
- (token == TT_PCSYNC) || (token == TT_NCSYNC) ||
- (token == TT_DBLSCAN) || (token == TT_HSKEW) ||
- (token == TT_VSCAN) || (token == TT_BCAST))
- {
- switch (token)
- {
-
- case TT_INTERLACE:
- ptr->ml_flags |= XF86CONF_INTERLACE;
- break;
- case TT_PHSYNC:
- ptr->ml_flags |= XF86CONF_PHSYNC;
- break;
- case TT_NHSYNC:
- ptr->ml_flags |= XF86CONF_NHSYNC;
- break;
- case TT_PVSYNC:
- ptr->ml_flags |= XF86CONF_PVSYNC;
- break;
- case TT_NVSYNC:
- ptr->ml_flags |= XF86CONF_NVSYNC;
- break;
- case TT_CSYNC:
- ptr->ml_flags |= XF86CONF_CSYNC;
- break;
- case TT_PCSYNC:
- ptr->ml_flags |= XF86CONF_PCSYNC;
- break;
- case TT_NCSYNC:
- ptr->ml_flags |= XF86CONF_NCSYNC;
- break;
- case TT_DBLSCAN:
- ptr->ml_flags |= XF86CONF_DBLSCAN;
- break;
- case TT_HSKEW:
- if (xf86getSubToken (&(ptr->ml_comment)) != NUMBER)
- Error (NUMBER_MSG, "Hskew");
- ptr->ml_hskew = val.num;
- ptr->ml_flags |= XF86CONF_HSKEW;
- break;
- case TT_BCAST:
- ptr->ml_flags |= XF86CONF_BCAST;
- break;
- case TT_VSCAN:
- if (xf86getSubToken (&(ptr->ml_comment)) != NUMBER)
- Error (NUMBER_MSG, "Vscan");
- ptr->ml_vscan = val.num;
- ptr->ml_flags |= XF86CONF_VSCAN;
- break;
- case EOF_TOKEN:
- Error (UNEXPECTED_EOF_MSG, NULL);
- break;
- default:
- Error (INVALID_KEYWORD_MSG, xf86tokenString ());
- break;
- }
- token = xf86getSubTokenWithTab (&(ptr->ml_comment), TimingTab);
- }
- xf86unGetToken (token);
+ int token;
+
+ parsePrologue(XF86ConfModeLinePtr, XF86ConfModeLineRec)
+
+ /* Identifier */
+ if (xf86getSubToken(&(ptr->ml_comment)) != STRING)
+ Error("ModeLine identifier expected");
+ ptr->ml_identifier = val.str;
+
+ /* DotClock */
+ if (xf86getSubToken(&(ptr->ml_comment)) != NUMBER)
+ Error("ModeLine dotclock expected");
+ ptr->ml_clock = (int) (val.realnum * 1000.0 + 0.5);
+
+ /* HDisplay */
+ if (xf86getSubToken(&(ptr->ml_comment)) != NUMBER)
+ Error("ModeLine Hdisplay expected");
+ ptr->ml_hdisplay = val.num;
+
+ /* HSyncStart */
+ if (xf86getSubToken(&(ptr->ml_comment)) != NUMBER)
+ Error("ModeLine HSyncStart expected");
+ ptr->ml_hsyncstart = val.num;
+
+ /* HSyncEnd */
+ if (xf86getSubToken(&(ptr->ml_comment)) != NUMBER)
+ Error("ModeLine HSyncEnd expected");
+ ptr->ml_hsyncend = val.num;
+
+ /* HTotal */
+ if (xf86getSubToken(&(ptr->ml_comment)) != NUMBER)
+ Error("ModeLine HTotal expected");
+ ptr->ml_htotal = val.num;
+
+ /* VDisplay */
+ if (xf86getSubToken(&(ptr->ml_comment)) != NUMBER)
+ Error("ModeLine Vdisplay expected");
+ ptr->ml_vdisplay = val.num;
+
+ /* VSyncStart */
+ if (xf86getSubToken(&(ptr->ml_comment)) != NUMBER)
+ Error("ModeLine VSyncStart expected");
+ ptr->ml_vsyncstart = val.num;
+
+ /* VSyncEnd */
+ if (xf86getSubToken(&(ptr->ml_comment)) != NUMBER)
+ Error("ModeLine VSyncEnd expected");
+ ptr->ml_vsyncend = val.num;
+
+ /* VTotal */
+ if (xf86getSubToken(&(ptr->ml_comment)) != NUMBER)
+ Error("ModeLine VTotal expected");
+ ptr->ml_vtotal = val.num;
+
+ token = xf86getSubTokenWithTab(&(ptr->ml_comment), TimingTab);
+ while ((token == TT_INTERLACE) || (token == TT_PHSYNC) ||
+ (token == TT_NHSYNC) || (token == TT_PVSYNC) ||
+ (token == TT_NVSYNC) || (token == TT_CSYNC) ||
+ (token == TT_PCSYNC) || (token == TT_NCSYNC) ||
+ (token == TT_DBLSCAN) || (token == TT_HSKEW) ||
+ (token == TT_VSCAN) || (token == TT_BCAST)) {
+ switch (token) {
+
+ case TT_INTERLACE:
+ ptr->ml_flags |= XF86CONF_INTERLACE;
+ break;
+ case TT_PHSYNC:
+ ptr->ml_flags |= XF86CONF_PHSYNC;
+ break;
+ case TT_NHSYNC:
+ ptr->ml_flags |= XF86CONF_NHSYNC;
+ break;
+ case TT_PVSYNC:
+ ptr->ml_flags |= XF86CONF_PVSYNC;
+ break;
+ case TT_NVSYNC:
+ ptr->ml_flags |= XF86CONF_NVSYNC;
+ break;
+ case TT_CSYNC:
+ ptr->ml_flags |= XF86CONF_CSYNC;
+ break;
+ case TT_PCSYNC:
+ ptr->ml_flags |= XF86CONF_PCSYNC;
+ break;
+ case TT_NCSYNC:
+ ptr->ml_flags |= XF86CONF_NCSYNC;
+ break;
+ case TT_DBLSCAN:
+ ptr->ml_flags |= XF86CONF_DBLSCAN;
+ break;
+ case TT_HSKEW:
+ if (xf86getSubToken(&(ptr->ml_comment)) != NUMBER)
+ Error(NUMBER_MSG, "Hskew");
+ ptr->ml_hskew = val.num;
+ ptr->ml_flags |= XF86CONF_HSKEW;
+ break;
+ case TT_BCAST:
+ ptr->ml_flags |= XF86CONF_BCAST;
+ break;
+ case TT_VSCAN:
+ if (xf86getSubToken(&(ptr->ml_comment)) != NUMBER)
+ Error(NUMBER_MSG, "Vscan");
+ ptr->ml_vscan = val.num;
+ ptr->ml_flags |= XF86CONF_VSCAN;
+ break;
+ case EOF_TOKEN:
+ Error(UNEXPECTED_EOF_MSG);
+ break;
+ default:
+ Error(INVALID_KEYWORD_MSG, xf86tokenString());
+ break;
+ }
+ token = xf86getSubTokenWithTab(&(ptr->ml_comment), TimingTab);
+ }
+ xf86unGetToken(token);
#ifdef DEBUG
- printf ("ModeLine parsed\n");
+ printf("ModeLine parsed\n");
#endif
- return ptr;
+ return ptr;
}
static XF86ConfModeLinePtr
-xf86parseVerboseMode (void)
+xf86parseVerboseMode(void)
{
- int token, token2;
- int had_dotclock = 0, had_htimings = 0, had_vtimings = 0;
- parsePrologue (XF86ConfModeLinePtr, XF86ConfModeLineRec)
-
- if (xf86getSubToken (&(ptr->ml_comment)) != STRING)
- Error ("Mode name expected", NULL);
- ptr->ml_identifier = val.str;
- while ((token = xf86getToken (ModeTab)) != ENDMODE)
- {
- switch (token)
- {
- case COMMENT:
- ptr->ml_comment = xf86addComment(ptr->ml_comment, val.str);
- break;
- case DOTCLOCK:
- if ((token = xf86getSubToken (&(ptr->ml_comment))) != NUMBER)
- Error (NUMBER_MSG, "DotClock");
- ptr->ml_clock = (int) (val.realnum * 1000.0 + 0.5);
- had_dotclock = 1;
- break;
- case HTIMINGS:
- if (xf86getSubToken (&(ptr->ml_comment)) == NUMBER)
- ptr->ml_hdisplay = val.num;
- else
- Error ("Horizontal display expected", NULL);
-
- if (xf86getSubToken (&(ptr->ml_comment)) == NUMBER)
- ptr->ml_hsyncstart = val.num;
- else
- Error ("Horizontal sync start expected", NULL);
-
- if (xf86getSubToken (&(ptr->ml_comment)) == NUMBER)
- ptr->ml_hsyncend = val.num;
- else
- Error ("Horizontal sync end expected", NULL);
-
- if (xf86getSubToken (&(ptr->ml_comment)) == NUMBER)
- ptr->ml_htotal = val.num;
- else
- Error ("Horizontal total expected", NULL);
- had_htimings = 1;
- break;
- case VTIMINGS:
- if (xf86getSubToken (&(ptr->ml_comment)) == NUMBER)
- ptr->ml_vdisplay = val.num;
- else
- Error ("Vertical display expected", NULL);
-
- if (xf86getSubToken (&(ptr->ml_comment)) == NUMBER)
- ptr->ml_vsyncstart = val.num;
- else
- Error ("Vertical sync start expected", NULL);
-
- if (xf86getSubToken (&(ptr->ml_comment)) == NUMBER)
- ptr->ml_vsyncend = val.num;
- else
- Error ("Vertical sync end expected", NULL);
-
- if (xf86getSubToken (&(ptr->ml_comment)) == NUMBER)
- ptr->ml_vtotal = val.num;
- else
- Error ("Vertical total expected", NULL);
- had_vtimings = 1;
- break;
- case FLAGS:
- token = xf86getSubToken (&(ptr->ml_comment));
- if (token != STRING)
- Error (QUOTE_MSG, "Flags");
- while (token == STRING)
- {
- token2 = xf86getStringToken (TimingTab);
- switch (token2)
- {
- case TT_INTERLACE:
- ptr->ml_flags |= XF86CONF_INTERLACE;
- break;
- case TT_PHSYNC:
- ptr->ml_flags |= XF86CONF_PHSYNC;
- break;
- case TT_NHSYNC:
- ptr->ml_flags |= XF86CONF_NHSYNC;
- break;
- case TT_PVSYNC:
- ptr->ml_flags |= XF86CONF_PVSYNC;
- break;
- case TT_NVSYNC:
- ptr->ml_flags |= XF86CONF_NVSYNC;
- break;
- case TT_CSYNC:
- ptr->ml_flags |= XF86CONF_CSYNC;
- break;
- case TT_PCSYNC:
- ptr->ml_flags |= XF86CONF_PCSYNC;
- break;
- case TT_NCSYNC:
- ptr->ml_flags |= XF86CONF_NCSYNC;
- break;
- case TT_DBLSCAN:
- ptr->ml_flags |= XF86CONF_DBLSCAN;
- break;
- case EOF_TOKEN:
- Error (UNEXPECTED_EOF_MSG, NULL);
- break;
- default:
- Error ("Unknown flag string", NULL);
- break;
- }
- token = xf86getSubToken (&(ptr->ml_comment));
- }
- xf86unGetToken (token);
- break;
- case HSKEW:
- if (xf86getSubToken (&(ptr->ml_comment)) != NUMBER)
- Error ("Horizontal skew expected", NULL);
- ptr->ml_flags |= XF86CONF_HSKEW;
- ptr->ml_hskew = val.num;
- break;
- case VSCAN:
- if (xf86getSubToken (&(ptr->ml_comment)) != NUMBER)
- Error ("Vertical scan count expected", NULL);
- ptr->ml_flags |= XF86CONF_VSCAN;
- ptr->ml_vscan = val.num;
- break;
- case EOF_TOKEN:
- Error (UNEXPECTED_EOF_MSG, NULL);
- break;
- default:
- Error ("Unexepcted token in verbose \"Mode\" entry\n", NULL);
- }
- }
- if (!had_dotclock)
- Error ("the dotclock is missing", NULL);
- if (!had_htimings)
- Error ("the horizontal timings are missing", NULL);
- if (!had_vtimings)
- Error ("the vertical timings are missing", NULL);
+ int token, token2;
+ int had_dotclock = 0, had_htimings = 0, had_vtimings = 0;
+
+ parsePrologue(XF86ConfModeLinePtr, XF86ConfModeLineRec)
+
+ if (xf86getSubToken(&(ptr->ml_comment)) != STRING)
+ Error("Mode name expected");
+ ptr->ml_identifier = val.str;
+ while ((token = xf86getToken(ModeTab)) != ENDMODE) {
+ switch (token) {
+ case COMMENT:
+ ptr->ml_comment = xf86addComment(ptr->ml_comment, val.str);
+ break;
+ case DOTCLOCK:
+ if ((token = xf86getSubToken(&(ptr->ml_comment))) != NUMBER)
+ Error(NUMBER_MSG, "DotClock");
+ ptr->ml_clock = (int) (val.realnum * 1000.0 + 0.5);
+ had_dotclock = 1;
+ break;
+ case HTIMINGS:
+ if (xf86getSubToken(&(ptr->ml_comment)) == NUMBER)
+ ptr->ml_hdisplay = val.num;
+ else
+ Error("Horizontal display expected");
+
+ if (xf86getSubToken(&(ptr->ml_comment)) == NUMBER)
+ ptr->ml_hsyncstart = val.num;
+ else
+ Error("Horizontal sync start expected");
+
+ if (xf86getSubToken(&(ptr->ml_comment)) == NUMBER)
+ ptr->ml_hsyncend = val.num;
+ else
+ Error("Horizontal sync end expected");
+
+ if (xf86getSubToken(&(ptr->ml_comment)) == NUMBER)
+ ptr->ml_htotal = val.num;
+ else
+ Error("Horizontal total expected");
+ had_htimings = 1;
+ break;
+ case VTIMINGS:
+ if (xf86getSubToken(&(ptr->ml_comment)) == NUMBER)
+ ptr->ml_vdisplay = val.num;
+ else
+ Error("Vertical display expected");
+
+ if (xf86getSubToken(&(ptr->ml_comment)) == NUMBER)
+ ptr->ml_vsyncstart = val.num;
+ else
+ Error("Vertical sync start expected");
+
+ if (xf86getSubToken(&(ptr->ml_comment)) == NUMBER)
+ ptr->ml_vsyncend = val.num;
+ else
+ Error("Vertical sync end expected");
+
+ if (xf86getSubToken(&(ptr->ml_comment)) == NUMBER)
+ ptr->ml_vtotal = val.num;
+ else
+ Error("Vertical total expected");
+ had_vtimings = 1;
+ break;
+ case FLAGS:
+ token = xf86getSubToken(&(ptr->ml_comment));
+ if (token != STRING)
+ Error(QUOTE_MSG, "Flags");
+ while (token == STRING) {
+ token2 = xf86getStringToken(TimingTab);
+ switch (token2) {
+ case TT_INTERLACE:
+ ptr->ml_flags |= XF86CONF_INTERLACE;
+ break;
+ case TT_PHSYNC:
+ ptr->ml_flags |= XF86CONF_PHSYNC;
+ break;
+ case TT_NHSYNC:
+ ptr->ml_flags |= XF86CONF_NHSYNC;
+ break;
+ case TT_PVSYNC:
+ ptr->ml_flags |= XF86CONF_PVSYNC;
+ break;
+ case TT_NVSYNC:
+ ptr->ml_flags |= XF86CONF_NVSYNC;
+ break;
+ case TT_CSYNC:
+ ptr->ml_flags |= XF86CONF_CSYNC;
+ break;
+ case TT_PCSYNC:
+ ptr->ml_flags |= XF86CONF_PCSYNC;
+ break;
+ case TT_NCSYNC:
+ ptr->ml_flags |= XF86CONF_NCSYNC;
+ break;
+ case TT_DBLSCAN:
+ ptr->ml_flags |= XF86CONF_DBLSCAN;
+ break;
+ case EOF_TOKEN:
+ Error(UNEXPECTED_EOF_MSG);
+ break;
+ default:
+ Error("Unknown flag string");
+ break;
+ }
+ token = xf86getSubToken(&(ptr->ml_comment));
+ }
+ xf86unGetToken(token);
+ break;
+ case HSKEW:
+ if (xf86getSubToken(&(ptr->ml_comment)) != NUMBER)
+ Error("Horizontal skew expected");
+ ptr->ml_flags |= XF86CONF_HSKEW;
+ ptr->ml_hskew = val.num;
+ break;
+ case VSCAN:
+ if (xf86getSubToken(&(ptr->ml_comment)) != NUMBER)
+ Error("Vertical scan count expected");
+ ptr->ml_flags |= XF86CONF_VSCAN;
+ ptr->ml_vscan = val.num;
+ break;
+ case EOF_TOKEN:
+ Error(UNEXPECTED_EOF_MSG);
+ break;
+ default:
+ Error("Unexepcted token in verbose \"Mode\" entry\n");
+ }
+ }
+ if (!had_dotclock)
+ Error("the dotclock is missing");
+ if (!had_htimings)
+ Error("the horizontal timings are missing");
+ if (!had_vtimings)
+ Error("the vertical timings are missing");
#ifdef DEBUG
- printf ("Verbose Mode parsed\n");
+ printf("Verbose Mode parsed\n");
#endif
- return ptr;
+ return ptr;
}
#undef CLEANUP
@@ -414,484 +405,460 @@ xf86parseVerboseMode (void)
#define CLEANUP xf86freeMonitorList
XF86ConfMonitorPtr
-xf86parseMonitorSection (void)
+xf86parseMonitorSection(void)
{
- int has_ident = FALSE;
- int token;
- parsePrologue (XF86ConfMonitorPtr, XF86ConfMonitorRec)
-
- while ((token = xf86getToken (MonitorTab)) != ENDSECTION)
- {
- switch (token)
- {
- case COMMENT:
- ptr->mon_comment = xf86addComment(ptr->mon_comment, val.str);
- break;
- case IDENTIFIER:
- if (xf86getSubToken (&(ptr->mon_comment)) != STRING)
- Error (QUOTE_MSG, "Identifier");
- if (has_ident == TRUE)
- Error (MULTIPLE_MSG, "Identifier");
- ptr->mon_identifier = val.str;
- has_ident = TRUE;
- break;
- case VENDOR:
- if (xf86getSubToken (&(ptr->mon_comment)) != STRING)
- Error (QUOTE_MSG, "Vendor");
- ptr->mon_vendor = val.str;
- break;
- case MODEL:
- if (xf86getSubToken (&(ptr->mon_comment)) != STRING)
- Error (QUOTE_MSG, "ModelName");
- ptr->mon_modelname = val.str;
- break;
- case MODE:
- HANDLE_LIST (mon_modeline_lst, xf86parseVerboseMode,
- XF86ConfModeLinePtr);
- break;
- case MODELINE:
- HANDLE_LIST (mon_modeline_lst, xf86parseModeLine,
- XF86ConfModeLinePtr);
- break;
- case DISPLAYSIZE:
- if (xf86getSubToken (&(ptr->mon_comment)) != NUMBER)
- Error (DISPLAYSIZE_MSG, NULL);
- ptr->mon_width = val.realnum;
- if (xf86getSubToken (&(ptr->mon_comment)) != NUMBER)
- Error (DISPLAYSIZE_MSG, NULL);
- ptr->mon_height = val.realnum;
- break;
-
- case HORIZSYNC:
- if (xf86getSubToken (&(ptr->mon_comment)) != NUMBER)
- Error (HORIZSYNC_MSG, NULL);
- do {
- if (ptr->mon_n_hsync >= CONF_MAX_HSYNC)
- Error ("Sorry. Too many horizontal sync intervals.", NULL);
- ptr->mon_hsync[ptr->mon_n_hsync].lo = val.realnum;
- switch (token = xf86getSubToken (&(ptr->mon_comment)))
- {
- case COMMA:
- ptr->mon_hsync[ptr->mon_n_hsync].hi =
- ptr->mon_hsync[ptr->mon_n_hsync].lo;
- break;
- case DASH:
- if (xf86getSubToken (&(ptr->mon_comment)) != NUMBER ||
- (float)val.realnum < ptr->mon_hsync[ptr->mon_n_hsync].lo)
- Error (HORIZSYNC_MSG, NULL);
- ptr->mon_hsync[ptr->mon_n_hsync].hi = val.realnum;
- if ((token = xf86getSubToken (&(ptr->mon_comment))) == COMMA)
- break;
- ptr->mon_n_hsync++;
- goto HorizDone;
- default:
- /* We cannot currently know if a '\n' was found,
- * or this is a real error
- */
- ptr->mon_hsync[ptr->mon_n_hsync].hi =
- ptr->mon_hsync[ptr->mon_n_hsync].lo;
- ptr->mon_n_hsync++;
- goto HorizDone;
- }
- ptr->mon_n_hsync++;
- } while ((token = xf86getSubToken (&(ptr->mon_comment))) == NUMBER);
-HorizDone:
- xf86unGetToken (token);
- break;
-
- case VERTREFRESH:
- if (xf86getSubToken (&(ptr->mon_comment)) != NUMBER)
- Error (VERTREFRESH_MSG, NULL);
- do {
- ptr->mon_vrefresh[ptr->mon_n_vrefresh].lo = val.realnum;
- switch (token = xf86getSubToken (&(ptr->mon_comment)))
- {
- case COMMA:
- ptr->mon_vrefresh[ptr->mon_n_vrefresh].hi =
- ptr->mon_vrefresh[ptr->mon_n_vrefresh].lo;
- break;
- case DASH:
- if (xf86getSubToken (&(ptr->mon_comment)) != NUMBER ||
- (float)val.realnum < ptr->mon_vrefresh[ptr->mon_n_vrefresh].lo)
- Error (VERTREFRESH_MSG, NULL);
- ptr->mon_vrefresh[ptr->mon_n_vrefresh].hi = val.realnum;
- if ((token = xf86getSubToken (&(ptr->mon_comment))) == COMMA)
- break;
- ptr->mon_n_vrefresh++;
- goto VertDone;
- default:
- /* We cannot currently know if a '\n' was found,
- * or this is a real error
- */
- ptr->mon_vrefresh[ptr->mon_n_vrefresh].hi =
- ptr->mon_vrefresh[ptr->mon_n_vrefresh].lo;
- ptr->mon_n_vrefresh++;
- goto VertDone;
- }
- if (ptr->mon_n_vrefresh >= CONF_MAX_VREFRESH)
- Error ("Sorry. Too many vertical refresh intervals.", NULL);
- ptr->mon_n_vrefresh++;
- } while ((token = xf86getSubToken (&(ptr->mon_comment))) == NUMBER);
-VertDone:
- xf86unGetToken (token);
- break;
-
- case GAMMA:
- if( xf86getSubToken (&(ptr->mon_comment)) != NUMBER )
- {
- Error (INVALID_GAMMA_MSG, NULL);
- }
- else
- {
- ptr->mon_gamma_red = ptr->mon_gamma_green =
- ptr->mon_gamma_blue = val.realnum;
- if( xf86getSubToken (&(ptr->mon_comment)) == NUMBER )
- {
- ptr->mon_gamma_green = val.realnum;
- if( xf86getSubToken (&(ptr->mon_comment)) == NUMBER )
- {
- ptr->mon_gamma_blue = val.realnum;
- }
- else
- {
- Error (INVALID_GAMMA_MSG, NULL);
- }
- }
- else
- xf86unGetToken (token);
- }
- break;
- case OPTION:
- ptr->mon_option_lst = xf86parseOption(ptr->mon_option_lst);
- break;
- case USEMODES:
- {
- XF86ConfModesLinkPtr mptr;
-
- if ((token = xf86getSubToken (&(ptr->mon_comment))) != STRING)
- Error (QUOTE_MSG, "UseModes");
-
- /* add to the end of the list of modes sections
- referenced here */
- mptr = calloc (1, sizeof (XF86ConfModesLinkRec));
- mptr->list.next = NULL;
- mptr->ml_modes_str = val.str;
- mptr->ml_modes = NULL;
- ptr->mon_modes_sect_lst = (XF86ConfModesLinkPtr)
- xf86addListItem((GenericListPtr)ptr->mon_modes_sect_lst,
- (GenericListPtr)mptr);
- }
- break;
- case EOF_TOKEN:
- Error (UNEXPECTED_EOF_MSG, NULL);
- break;
- default:
- xf86parseError (INVALID_KEYWORD_MSG, xf86tokenString ());
- CLEANUP (ptr);
- return NULL;
- break;
- }
- }
-
- if (!has_ident)
- Error (NO_IDENT_MSG, NULL);
+ int has_ident = FALSE;
+ int token;
+
+ parsePrologue(XF86ConfMonitorPtr, XF86ConfMonitorRec)
+
+ while ((token = xf86getToken(MonitorTab)) != ENDSECTION) {
+ switch (token) {
+ case COMMENT:
+ ptr->mon_comment = xf86addComment(ptr->mon_comment, val.str);
+ break;
+ case IDENTIFIER:
+ if (xf86getSubToken(&(ptr->mon_comment)) != STRING)
+ Error(QUOTE_MSG, "Identifier");
+ if (has_ident == TRUE)
+ Error(MULTIPLE_MSG, "Identifier");
+ ptr->mon_identifier = val.str;
+ has_ident = TRUE;
+ break;
+ case VENDOR:
+ if (xf86getSubToken(&(ptr->mon_comment)) != STRING)
+ Error(QUOTE_MSG, "Vendor");
+ ptr->mon_vendor = val.str;
+ break;
+ case MODEL:
+ if (xf86getSubToken(&(ptr->mon_comment)) != STRING)
+ Error(QUOTE_MSG, "ModelName");
+ ptr->mon_modelname = val.str;
+ break;
+ case MODE:
+ HANDLE_LIST(mon_modeline_lst, xf86parseVerboseMode,
+ XF86ConfModeLinePtr);
+ break;
+ case MODELINE:
+ HANDLE_LIST(mon_modeline_lst, xf86parseModeLine,
+ XF86ConfModeLinePtr);
+ break;
+ case DISPLAYSIZE:
+ if (xf86getSubToken(&(ptr->mon_comment)) != NUMBER)
+ Error(DISPLAYSIZE_MSG);
+ ptr->mon_width = val.realnum;
+ if (xf86getSubToken(&(ptr->mon_comment)) != NUMBER)
+ Error(DISPLAYSIZE_MSG);
+ ptr->mon_height = val.realnum;
+ break;
+
+ case HORIZSYNC:
+ if (xf86getSubToken(&(ptr->mon_comment)) != NUMBER)
+ Error(HORIZSYNC_MSG);
+ do {
+ if (ptr->mon_n_hsync >= CONF_MAX_HSYNC)
+ Error("Sorry. Too many horizontal sync intervals.");
+ ptr->mon_hsync[ptr->mon_n_hsync].lo = val.realnum;
+ switch (token = xf86getSubToken(&(ptr->mon_comment))) {
+ case COMMA:
+ ptr->mon_hsync[ptr->mon_n_hsync].hi =
+ ptr->mon_hsync[ptr->mon_n_hsync].lo;
+ break;
+ case DASH:
+ if (xf86getSubToken(&(ptr->mon_comment)) != NUMBER ||
+ (float) val.realnum <
+ ptr->mon_hsync[ptr->mon_n_hsync].lo)
+ Error(HORIZSYNC_MSG);
+ ptr->mon_hsync[ptr->mon_n_hsync].hi = val.realnum;
+ if ((token = xf86getSubToken(&(ptr->mon_comment))) == COMMA)
+ break;
+ ptr->mon_n_hsync++;
+ goto HorizDone;
+ default:
+ /* We cannot currently know if a '\n' was found,
+ * or this is a real error
+ */
+ ptr->mon_hsync[ptr->mon_n_hsync].hi =
+ ptr->mon_hsync[ptr->mon_n_hsync].lo;
+ ptr->mon_n_hsync++;
+ goto HorizDone;
+ }
+ ptr->mon_n_hsync++;
+ } while ((token = xf86getSubToken(&(ptr->mon_comment))) == NUMBER);
+ HorizDone:
+ xf86unGetToken(token);
+ break;
+
+ case VERTREFRESH:
+ if (xf86getSubToken(&(ptr->mon_comment)) != NUMBER)
+ Error(VERTREFRESH_MSG);
+ do {
+ ptr->mon_vrefresh[ptr->mon_n_vrefresh].lo = val.realnum;
+ switch (token = xf86getSubToken(&(ptr->mon_comment))) {
+ case COMMA:
+ ptr->mon_vrefresh[ptr->mon_n_vrefresh].hi =
+ ptr->mon_vrefresh[ptr->mon_n_vrefresh].lo;
+ break;
+ case DASH:
+ if (xf86getSubToken(&(ptr->mon_comment)) != NUMBER ||
+ (float) val.realnum <
+ ptr->mon_vrefresh[ptr->mon_n_vrefresh].lo)
+ Error(VERTREFRESH_MSG);
+ ptr->mon_vrefresh[ptr->mon_n_vrefresh].hi = val.realnum;
+ if ((token = xf86getSubToken(&(ptr->mon_comment))) == COMMA)
+ break;
+ ptr->mon_n_vrefresh++;
+ goto VertDone;
+ default:
+ /* We cannot currently know if a '\n' was found,
+ * or this is a real error
+ */
+ ptr->mon_vrefresh[ptr->mon_n_vrefresh].hi =
+ ptr->mon_vrefresh[ptr->mon_n_vrefresh].lo;
+ ptr->mon_n_vrefresh++;
+ goto VertDone;
+ }
+ if (ptr->mon_n_vrefresh >= CONF_MAX_VREFRESH)
+ Error("Sorry. Too many vertical refresh intervals.");
+ ptr->mon_n_vrefresh++;
+ } while ((token = xf86getSubToken(&(ptr->mon_comment))) == NUMBER);
+ VertDone:
+ xf86unGetToken(token);
+ break;
+
+ case GAMMA:
+ if (xf86getSubToken(&(ptr->mon_comment)) != NUMBER) {
+ Error(INVALID_GAMMA_MSG);
+ }
+ else {
+ ptr->mon_gamma_red = ptr->mon_gamma_green =
+ ptr->mon_gamma_blue = val.realnum;
+ if (xf86getSubToken(&(ptr->mon_comment)) == NUMBER) {
+ ptr->mon_gamma_green = val.realnum;
+ if (xf86getSubToken(&(ptr->mon_comment)) == NUMBER) {
+ ptr->mon_gamma_blue = val.realnum;
+ }
+ else {
+ Error(INVALID_GAMMA_MSG);
+ }
+ }
+ else
+ xf86unGetToken(token);
+ }
+ break;
+ case OPTION:
+ ptr->mon_option_lst = xf86parseOption(ptr->mon_option_lst);
+ break;
+ case USEMODES:
+ {
+ XF86ConfModesLinkPtr mptr;
+
+ if ((token = xf86getSubToken(&(ptr->mon_comment))) != STRING)
+ Error(QUOTE_MSG, "UseModes");
+
+ /* add to the end of the list of modes sections
+ referenced here */
+ mptr = calloc(1, sizeof(XF86ConfModesLinkRec));
+ mptr->list.next = NULL;
+ mptr->ml_modes_str = val.str;
+ mptr->ml_modes = NULL;
+ ptr->mon_modes_sect_lst = (XF86ConfModesLinkPtr)
+ xf86addListItem((GenericListPtr) ptr->mon_modes_sect_lst,
+ (GenericListPtr) mptr);
+ }
+ break;
+ case EOF_TOKEN:
+ Error(UNEXPECTED_EOF_MSG);
+ break;
+ default:
+ xf86parseError(INVALID_KEYWORD_MSG, xf86tokenString());
+ CLEANUP(ptr);
+ return NULL;
+ break;
+ }
+ }
+
+ if (!has_ident)
+ Error(NO_IDENT_MSG);
#ifdef DEBUG
- printf ("Monitor section parsed\n");
+ printf("Monitor section parsed\n");
#endif
- return ptr;
+ return ptr;
}
#undef CLEANUP
#define CLEANUP xf86freeModesList
XF86ConfModesPtr
-xf86parseModesSection (void)
+xf86parseModesSection(void)
{
- int has_ident = FALSE;
- int token;
- parsePrologue (XF86ConfModesPtr, XF86ConfModesRec)
-
- while ((token = xf86getToken (ModesTab)) != ENDSECTION)
- {
- switch (token)
- {
- case COMMENT:
- ptr->modes_comment = xf86addComment(ptr->modes_comment, val.str);
- break;
- case IDENTIFIER:
- if (xf86getSubToken (&(ptr->modes_comment)) != STRING)
- Error (QUOTE_MSG, "Identifier");
- if (has_ident == TRUE)
- Error (MULTIPLE_MSG, "Identifier");
- ptr->modes_identifier = val.str;
- has_ident = TRUE;
- break;
- case MODE:
- HANDLE_LIST (mon_modeline_lst, xf86parseVerboseMode,
- XF86ConfModeLinePtr);
- break;
- case MODELINE:
- HANDLE_LIST (mon_modeline_lst, xf86parseModeLine,
- XF86ConfModeLinePtr);
- break;
- default:
- xf86parseError (INVALID_KEYWORD_MSG, xf86tokenString ());
- CLEANUP (ptr);
- return NULL;
- break;
- }
- }
-
- if (!has_ident)
- Error (NO_IDENT_MSG, NULL);
+ int has_ident = FALSE;
+ int token;
+
+ parsePrologue(XF86ConfModesPtr, XF86ConfModesRec)
+
+ while ((token = xf86getToken(ModesTab)) != ENDSECTION) {
+ switch (token) {
+ case COMMENT:
+ ptr->modes_comment = xf86addComment(ptr->modes_comment, val.str);
+ break;
+ case IDENTIFIER:
+ if (xf86getSubToken(&(ptr->modes_comment)) != STRING)
+ Error(QUOTE_MSG, "Identifier");
+ if (has_ident == TRUE)
+ Error(MULTIPLE_MSG, "Identifier");
+ ptr->modes_identifier = val.str;
+ has_ident = TRUE;
+ break;
+ case MODE:
+ HANDLE_LIST(mon_modeline_lst, xf86parseVerboseMode,
+ XF86ConfModeLinePtr);
+ break;
+ case MODELINE:
+ HANDLE_LIST(mon_modeline_lst, xf86parseModeLine,
+ XF86ConfModeLinePtr);
+ break;
+ default:
+ xf86parseError(INVALID_KEYWORD_MSG, xf86tokenString());
+ CLEANUP(ptr);
+ return NULL;
+ break;
+ }
+ }
+
+ if (!has_ident)
+ Error(NO_IDENT_MSG);
#ifdef DEBUG
- printf ("Modes section parsed\n");
+ printf("Modes section parsed\n");
#endif
- return ptr;
+ return ptr;
}
#undef CLEANUP
void
-xf86printMonitorSection (FILE * cf, XF86ConfMonitorPtr ptr)
+xf86printMonitorSection(FILE * cf, XF86ConfMonitorPtr ptr)
{
- int i;
- XF86ConfModeLinePtr mlptr;
- XF86ConfModesLinkPtr mptr;
-
- while (ptr)
- {
- mptr = ptr->mon_modes_sect_lst;
- fprintf (cf, "Section \"Monitor\"\n");
- if (ptr->mon_comment)
- fprintf (cf, "%s", ptr->mon_comment);
- if (ptr->mon_identifier)
- fprintf (cf, "\tIdentifier \"%s\"\n", ptr->mon_identifier);
- if (ptr->mon_vendor)
- fprintf (cf, "\tVendorName \"%s\"\n", ptr->mon_vendor);
- if (ptr->mon_modelname)
- fprintf (cf, "\tModelName \"%s\"\n", ptr->mon_modelname);
- while (mptr) {
- fprintf (cf, "\tUseModes \"%s\"\n", mptr->ml_modes_str);
- mptr = mptr->list.next;
- }
- if (ptr->mon_width)
- fprintf (cf, "\tDisplaySize %d\t%d\n",
- ptr->mon_width,
- ptr->mon_height);
- for (i = 0; i < ptr->mon_n_hsync; i++)
- {
- fprintf (cf, "\tHorizSync %2.1f - %2.1f\n",
- ptr->mon_hsync[i].lo,
- ptr->mon_hsync[i].hi);
- }
- for (i = 0; i < ptr->mon_n_vrefresh; i++)
- {
- fprintf (cf, "\tVertRefresh %2.1f - %2.1f\n",
- ptr->mon_vrefresh[i].lo,
- ptr->mon_vrefresh[i].hi);
- }
- if (ptr->mon_gamma_red) {
- if (ptr->mon_gamma_red == ptr->mon_gamma_green
- && ptr->mon_gamma_red == ptr->mon_gamma_blue)
- {
- fprintf (cf, "\tGamma %.4g\n",
- ptr->mon_gamma_red);
- } else {
- fprintf (cf, "\tGamma %.4g %.4g %.4g\n",
- ptr->mon_gamma_red,
- ptr->mon_gamma_green,
- ptr->mon_gamma_blue);
- }
- }
- for (mlptr = ptr->mon_modeline_lst; mlptr; mlptr = mlptr->list.next)
- {
- fprintf (cf, "\tModeLine \"%s\" %2.1f ",
- mlptr->ml_identifier, mlptr->ml_clock / 1000.0);
- fprintf (cf, "%d %d %d %d %d %d %d %d",
- mlptr->ml_hdisplay, mlptr->ml_hsyncstart,
- mlptr->ml_hsyncend, mlptr->ml_htotal,
- mlptr->ml_vdisplay, mlptr->ml_vsyncstart,
- mlptr->ml_vsyncend, mlptr->ml_vtotal);
- if (mlptr->ml_flags & XF86CONF_PHSYNC)
- fprintf (cf, " +hsync");
- if (mlptr->ml_flags & XF86CONF_NHSYNC)
- fprintf (cf, " -hsync");
- if (mlptr->ml_flags & XF86CONF_PVSYNC)
- fprintf (cf, " +vsync");
- if (mlptr->ml_flags & XF86CONF_NVSYNC)
- fprintf (cf, " -vsync");
- if (mlptr->ml_flags & XF86CONF_INTERLACE)
- fprintf (cf, " interlace");
- if (mlptr->ml_flags & XF86CONF_CSYNC)
- fprintf (cf, " composite");
- if (mlptr->ml_flags & XF86CONF_PCSYNC)
- fprintf (cf, " +csync");
- if (mlptr->ml_flags & XF86CONF_NCSYNC)
- fprintf (cf, " -csync");
- if (mlptr->ml_flags & XF86CONF_DBLSCAN)
- fprintf (cf, " doublescan");
- if (mlptr->ml_flags & XF86CONF_HSKEW)
- fprintf (cf, " hskew %d", mlptr->ml_hskew);
- if (mlptr->ml_flags & XF86CONF_BCAST)
- fprintf (cf, " bcast");
- fprintf (cf, "\n");
- }
- xf86printOptionList(cf, ptr->mon_option_lst, 1);
- fprintf (cf, "EndSection\n\n");
- ptr = ptr->list.next;
- }
+ int i;
+ XF86ConfModeLinePtr mlptr;
+ XF86ConfModesLinkPtr mptr;
+
+ while (ptr) {
+ mptr = ptr->mon_modes_sect_lst;
+ fprintf(cf, "Section \"Monitor\"\n");
+ if (ptr->mon_comment)
+ fprintf(cf, "%s", ptr->mon_comment);
+ if (ptr->mon_identifier)
+ fprintf(cf, "\tIdentifier \"%s\"\n", ptr->mon_identifier);
+ if (ptr->mon_vendor)
+ fprintf(cf, "\tVendorName \"%s\"\n", ptr->mon_vendor);
+ if (ptr->mon_modelname)
+ fprintf(cf, "\tModelName \"%s\"\n", ptr->mon_modelname);
+ while (mptr) {
+ fprintf(cf, "\tUseModes \"%s\"\n", mptr->ml_modes_str);
+ mptr = mptr->list.next;
+ }
+ if (ptr->mon_width)
+ fprintf(cf, "\tDisplaySize %d\t%d\n",
+ ptr->mon_width, ptr->mon_height);
+ for (i = 0; i < ptr->mon_n_hsync; i++) {
+ fprintf(cf, "\tHorizSync %2.1f - %2.1f\n",
+ ptr->mon_hsync[i].lo, ptr->mon_hsync[i].hi);
+ }
+ for (i = 0; i < ptr->mon_n_vrefresh; i++) {
+ fprintf(cf, "\tVertRefresh %2.1f - %2.1f\n",
+ ptr->mon_vrefresh[i].lo, ptr->mon_vrefresh[i].hi);
+ }
+ if (ptr->mon_gamma_red) {
+ if (ptr->mon_gamma_red == ptr->mon_gamma_green
+ && ptr->mon_gamma_red == ptr->mon_gamma_blue) {
+ fprintf(cf, "\tGamma %.4g\n", ptr->mon_gamma_red);
+ }
+ else {
+ fprintf(cf, "\tGamma %.4g %.4g %.4g\n",
+ ptr->mon_gamma_red,
+ ptr->mon_gamma_green, ptr->mon_gamma_blue);
+ }
+ }
+ for (mlptr = ptr->mon_modeline_lst; mlptr; mlptr = mlptr->list.next) {
+ fprintf(cf, "\tModeLine \"%s\" %2.1f ",
+ mlptr->ml_identifier, mlptr->ml_clock / 1000.0);
+ fprintf(cf, "%d %d %d %d %d %d %d %d",
+ mlptr->ml_hdisplay, mlptr->ml_hsyncstart,
+ mlptr->ml_hsyncend, mlptr->ml_htotal,
+ mlptr->ml_vdisplay, mlptr->ml_vsyncstart,
+ mlptr->ml_vsyncend, mlptr->ml_vtotal);
+ if (mlptr->ml_flags & XF86CONF_PHSYNC)
+ fprintf(cf, " +hsync");
+ if (mlptr->ml_flags & XF86CONF_NHSYNC)
+ fprintf(cf, " -hsync");
+ if (mlptr->ml_flags & XF86CONF_PVSYNC)
+ fprintf(cf, " +vsync");
+ if (mlptr->ml_flags & XF86CONF_NVSYNC)
+ fprintf(cf, " -vsync");
+ if (mlptr->ml_flags & XF86CONF_INTERLACE)
+ fprintf(cf, " interlace");
+ if (mlptr->ml_flags & XF86CONF_CSYNC)
+ fprintf(cf, " composite");
+ if (mlptr->ml_flags & XF86CONF_PCSYNC)
+ fprintf(cf, " +csync");
+ if (mlptr->ml_flags & XF86CONF_NCSYNC)
+ fprintf(cf, " -csync");
+ if (mlptr->ml_flags & XF86CONF_DBLSCAN)
+ fprintf(cf, " doublescan");
+ if (mlptr->ml_flags & XF86CONF_HSKEW)
+ fprintf(cf, " hskew %d", mlptr->ml_hskew);
+ if (mlptr->ml_flags & XF86CONF_BCAST)
+ fprintf(cf, " bcast");
+ fprintf(cf, "\n");
+ }
+ xf86printOptionList(cf, ptr->mon_option_lst, 1);
+ fprintf(cf, "EndSection\n\n");
+ ptr = ptr->list.next;
+ }
}
void
-xf86printModesSection (FILE * cf, XF86ConfModesPtr ptr)
+xf86printModesSection(FILE * cf, XF86ConfModesPtr ptr)
{
- XF86ConfModeLinePtr mlptr;
-
- while (ptr)
- {
- fprintf (cf, "Section \"Modes\"\n");
- if (ptr->modes_comment)
- fprintf (cf, "%s", ptr->modes_comment);
- if (ptr->modes_identifier)
- fprintf (cf, "\tIdentifier \"%s\"\n", ptr->modes_identifier);
- for (mlptr = ptr->mon_modeline_lst; mlptr; mlptr = mlptr->list.next)
- {
- fprintf (cf, "\tModeLine \"%s\" %2.1f ",
- mlptr->ml_identifier, mlptr->ml_clock / 1000.0);
- fprintf (cf, "%d %d %d %d %d %d %d %d",
- mlptr->ml_hdisplay, mlptr->ml_hsyncstart,
- mlptr->ml_hsyncend, mlptr->ml_htotal,
- mlptr->ml_vdisplay, mlptr->ml_vsyncstart,
- mlptr->ml_vsyncend, mlptr->ml_vtotal);
- if (mlptr->ml_flags & XF86CONF_PHSYNC)
- fprintf (cf, " +hsync");
- if (mlptr->ml_flags & XF86CONF_NHSYNC)
- fprintf (cf, " -hsync");
- if (mlptr->ml_flags & XF86CONF_PVSYNC)
- fprintf (cf, " +vsync");
- if (mlptr->ml_flags & XF86CONF_NVSYNC)
- fprintf (cf, " -vsync");
- if (mlptr->ml_flags & XF86CONF_INTERLACE)
- fprintf (cf, " interlace");
- if (mlptr->ml_flags & XF86CONF_CSYNC)
- fprintf (cf, " composite");
- if (mlptr->ml_flags & XF86CONF_PCSYNC)
- fprintf (cf, " +csync");
- if (mlptr->ml_flags & XF86CONF_NCSYNC)
- fprintf (cf, " -csync");
- if (mlptr->ml_flags & XF86CONF_DBLSCAN)
- fprintf (cf, " doublescan");
- if (mlptr->ml_flags & XF86CONF_HSKEW)
- fprintf (cf, " hskew %d", mlptr->ml_hskew);
- if (mlptr->ml_flags & XF86CONF_VSCAN)
- fprintf (cf, " vscan %d", mlptr->ml_vscan);
- if (mlptr->ml_flags & XF86CONF_BCAST)
- fprintf (cf, " bcast");
- if (mlptr->ml_comment)
- fprintf (cf, "%s", mlptr->ml_comment);
- else
- fprintf (cf, "\n");
- }
- fprintf (cf, "EndSection\n\n");
- ptr = ptr->list.next;
- }
+ XF86ConfModeLinePtr mlptr;
+
+ while (ptr) {
+ fprintf(cf, "Section \"Modes\"\n");
+ if (ptr->modes_comment)
+ fprintf(cf, "%s", ptr->modes_comment);
+ if (ptr->modes_identifier)
+ fprintf(cf, "\tIdentifier \"%s\"\n", ptr->modes_identifier);
+ for (mlptr = ptr->mon_modeline_lst; mlptr; mlptr = mlptr->list.next) {
+ fprintf(cf, "\tModeLine \"%s\" %2.1f ",
+ mlptr->ml_identifier, mlptr->ml_clock / 1000.0);
+ fprintf(cf, "%d %d %d %d %d %d %d %d",
+ mlptr->ml_hdisplay, mlptr->ml_hsyncstart,
+ mlptr->ml_hsyncend, mlptr->ml_htotal,
+ mlptr->ml_vdisplay, mlptr->ml_vsyncstart,
+ mlptr->ml_vsyncend, mlptr->ml_vtotal);
+ if (mlptr->ml_flags & XF86CONF_PHSYNC)
+ fprintf(cf, " +hsync");
+ if (mlptr->ml_flags & XF86CONF_NHSYNC)
+ fprintf(cf, " -hsync");
+ if (mlptr->ml_flags & XF86CONF_PVSYNC)
+ fprintf(cf, " +vsync");
+ if (mlptr->ml_flags & XF86CONF_NVSYNC)
+ fprintf(cf, " -vsync");
+ if (mlptr->ml_flags & XF86CONF_INTERLACE)
+ fprintf(cf, " interlace");
+ if (mlptr->ml_flags & XF86CONF_CSYNC)
+ fprintf(cf, " composite");
+ if (mlptr->ml_flags & XF86CONF_PCSYNC)
+ fprintf(cf, " +csync");
+ if (mlptr->ml_flags & XF86CONF_NCSYNC)
+ fprintf(cf, " -csync");
+ if (mlptr->ml_flags & XF86CONF_DBLSCAN)
+ fprintf(cf, " doublescan");
+ if (mlptr->ml_flags & XF86CONF_HSKEW)
+ fprintf(cf, " hskew %d", mlptr->ml_hskew);
+ if (mlptr->ml_flags & XF86CONF_VSCAN)
+ fprintf(cf, " vscan %d", mlptr->ml_vscan);
+ if (mlptr->ml_flags & XF86CONF_BCAST)
+ fprintf(cf, " bcast");
+ if (mlptr->ml_comment)
+ fprintf(cf, "%s", mlptr->ml_comment);
+ else
+ fprintf(cf, "\n");
+ }
+ fprintf(cf, "EndSection\n\n");
+ ptr = ptr->list.next;
+ }
}
void
-xf86freeMonitorList (XF86ConfMonitorPtr ptr)
+xf86freeMonitorList(XF86ConfMonitorPtr ptr)
{
- XF86ConfMonitorPtr prev;
-
- while (ptr)
- {
- TestFree (ptr->mon_identifier);
- TestFree (ptr->mon_vendor);
- TestFree (ptr->mon_modelname);
- TestFree (ptr->mon_comment);
- xf86optionListFree (ptr->mon_option_lst);
- xf86freeModeLineList (ptr->mon_modeline_lst);
- prev = ptr;
- ptr = ptr->list.next;
- free (prev);
- }
+ XF86ConfMonitorPtr prev;
+
+ while (ptr) {
+ TestFree(ptr->mon_identifier);
+ TestFree(ptr->mon_vendor);
+ TestFree(ptr->mon_modelname);
+ TestFree(ptr->mon_comment);
+ xf86optionListFree(ptr->mon_option_lst);
+ xf86freeModeLineList(ptr->mon_modeline_lst);
+ prev = ptr;
+ ptr = ptr->list.next;
+ free(prev);
+ }
}
void
-xf86freeModesList (XF86ConfModesPtr ptr)
+xf86freeModesList(XF86ConfModesPtr ptr)
{
- XF86ConfModesPtr prev;
-
- while (ptr)
- {
- TestFree (ptr->modes_identifier);
- TestFree (ptr->modes_comment);
- xf86freeModeLineList (ptr->mon_modeline_lst);
- prev = ptr;
- ptr = ptr->list.next;
- free (prev);
- }
+ XF86ConfModesPtr prev;
+
+ while (ptr) {
+ TestFree(ptr->modes_identifier);
+ TestFree(ptr->modes_comment);
+ xf86freeModeLineList(ptr->mon_modeline_lst);
+ prev = ptr;
+ ptr = ptr->list.next;
+ free(prev);
+ }
}
XF86ConfMonitorPtr
-xf86findMonitor (const char *ident, XF86ConfMonitorPtr p)
+xf86findMonitor(const char *ident, XF86ConfMonitorPtr p)
{
- while (p)
- {
- if (xf86nameCompare (ident, p->mon_identifier) == 0)
- return p;
-
- p = p->list.next;
- }
- return NULL;
+ while (p) {
+ if (xf86nameCompare(ident, p->mon_identifier) == 0)
+ return p;
+
+ p = p->list.next;
+ }
+ return NULL;
}
XF86ConfModesPtr
-xf86findModes (const char *ident, XF86ConfModesPtr p)
+xf86findModes(const char *ident, XF86ConfModesPtr p)
{
- while (p)
- {
- if (xf86nameCompare (ident, p->modes_identifier) == 0)
- return p;
-
- p = p->list.next;
- }
- return NULL;
+ while (p) {
+ if (xf86nameCompare(ident, p->modes_identifier) == 0)
+ return p;
+
+ p = p->list.next;
+ }
+ return NULL;
}
XF86ConfModeLinePtr
-xf86findModeLine (const char *ident, XF86ConfModeLinePtr p)
+xf86findModeLine(const char *ident, XF86ConfModeLinePtr p)
{
- while (p)
- {
- if (xf86nameCompare (ident, p->ml_identifier) == 0)
- return p;
-
- p = p->list.next;
- }
- return NULL;
+ while (p) {
+ if (xf86nameCompare(ident, p->ml_identifier) == 0)
+ return p;
+
+ p = p->list.next;
+ }
+ return NULL;
}
int
-xf86validateMonitor (XF86ConfigPtr p, XF86ConfScreenPtr screen)
+xf86validateMonitor(XF86ConfigPtr p, XF86ConfScreenPtr screen)
{
- XF86ConfMonitorPtr monitor = screen->scrn_monitor;
- XF86ConfModesLinkPtr modeslnk = monitor->mon_modes_sect_lst;
- XF86ConfModesPtr modes;
- while(modeslnk)
- {
- modes = xf86findModes (modeslnk->ml_modes_str, p->conf_modes_lst);
- if (!modes)
- {
- xf86validationError (UNDEFINED_MODES_MSG,
- modeslnk->ml_modes_str,
- screen->scrn_identifier);
- return FALSE;
- }
- modeslnk->ml_modes = modes;
- modeslnk = modeslnk->list.next;
- }
- return TRUE;
+ XF86ConfMonitorPtr monitor = screen->scrn_monitor;
+ XF86ConfModesLinkPtr modeslnk = monitor->mon_modes_sect_lst;
+ XF86ConfModesPtr modes;
+
+ while (modeslnk) {
+ modes = xf86findModes(modeslnk->ml_modes_str, p->conf_modes_lst);
+ if (!modes) {
+ xf86validationError(UNDEFINED_MODES_MSG,
+ modeslnk->ml_modes_str,
+ screen->scrn_identifier);
+ return FALSE;
+ }
+ modeslnk->ml_modes = modes;
+ modeslnk = modeslnk->list.next;
+ }
+ return TRUE;
}
diff --git a/xserver/hw/xfree86/parser/Pointer.c b/xserver/hw/xfree86/parser/Pointer.c
index e8ad290f9..cdbc09c1a 100644
--- a/xserver/hw/xfree86/parser/Pointer.c
+++ b/xserver/hw/xfree86/parser/Pointer.c
@@ -52,7 +52,6 @@
* authorization from the copyright holder(s) and author(s).
*/
-
/* View/edit this file with tab stops set to 4 */
#ifdef HAVE_XORG_CONFIG_H
@@ -66,168 +65,161 @@
extern LexRec val;
-static xf86ConfigSymTabRec PointerTab[] =
-{
- {PROTOCOL, "protocol"},
- {EMULATE3, "emulate3buttons"},
- {EM3TIMEOUT, "emulate3timeout"},
- {ENDSUBSECTION, "endsubsection"},
- {ENDSECTION, "endsection"},
- {PDEVICE, "device"},
- {PDEVICE, "port"},
- {BAUDRATE, "baudrate"},
- {SAMPLERATE, "samplerate"},
- {CLEARDTR, "cleardtr"},
- {CLEARRTS, "clearrts"},
- {CHORDMIDDLE, "chordmiddle"},
- {PRESOLUTION, "resolution"},
- {DEVICE_NAME, "devicename"},
- {ALWAYSCORE, "alwayscore"},
- {PBUTTONS, "buttons"},
- {ZAXISMAPPING, "zaxismapping"},
- {-1, ""},
+static xf86ConfigSymTabRec PointerTab[] = {
+ {PROTOCOL, "protocol"},
+ {EMULATE3, "emulate3buttons"},
+ {EM3TIMEOUT, "emulate3timeout"},
+ {ENDSUBSECTION, "endsubsection"},
+ {ENDSECTION, "endsection"},
+ {PDEVICE, "device"},
+ {PDEVICE, "port"},
+ {BAUDRATE, "baudrate"},
+ {SAMPLERATE, "samplerate"},
+ {CLEARDTR, "cleardtr"},
+ {CLEARRTS, "clearrts"},
+ {CHORDMIDDLE, "chordmiddle"},
+ {PRESOLUTION, "resolution"},
+ {DEVICE_NAME, "devicename"},
+ {ALWAYSCORE, "alwayscore"},
+ {PBUTTONS, "buttons"},
+ {ZAXISMAPPING, "zaxismapping"},
+ {-1, ""},
};
-static xf86ConfigSymTabRec ZMapTab[] =
-{
- {XAXIS, "x"},
- {YAXIS, "y"},
- {-1, ""},
+static xf86ConfigSymTabRec ZMapTab[] = {
+ {XAXIS, "x"},
+ {YAXIS, "y"},
+ {-1, ""},
};
#define CLEANUP xf86freeInputList
XF86ConfInputPtr
-xf86parsePointerSection (void)
+xf86parsePointerSection(void)
{
- char *s;
- unsigned long val1;
- int token;
- parsePrologue (XF86ConfInputPtr, XF86ConfInputRec)
+ char *s;
+ unsigned long val1;
+ int token;
- while ((token = xf86getToken (PointerTab)) != ENDSECTION)
- {
- switch (token)
- {
- case COMMENT:
- ptr->inp_comment = xf86addComment(ptr->inp_comment, val.str);
- break;
- case PROTOCOL:
- if (xf86getSubToken (&(ptr->inp_comment)) != STRING)
- Error (QUOTE_MSG, "Protocol");
- ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
- strdup("Protocol"),
- val.str);
- break;
- case PDEVICE:
- if (xf86getSubToken (&(ptr->inp_comment)) != STRING)
- Error (QUOTE_MSG, "Device");
- ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
- strdup("Device"),
- val.str);
- break;
- case EMULATE3:
- ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
- strdup("Emulate3Buttons"),
- NULL);
- break;
- case EM3TIMEOUT:
- if (xf86getSubToken (&(ptr->inp_comment)) != NUMBER || val.num < 0)
- Error (POSITIVE_INT_MSG, "Emulate3Timeout");
- s = xf86uLongToString(val.num);
- ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
- strdup("Emulate3Timeout"),
- s);
- break;
- case CHORDMIDDLE:
- ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
- strdup("ChordMiddle"),
- NULL);
- break;
- case PBUTTONS:
- if (xf86getSubToken (&(ptr->inp_comment)) != NUMBER || val.num < 0)
- Error (POSITIVE_INT_MSG, "Buttons");
- s = xf86uLongToString(val.num);
- ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
- strdup("Buttons"), s);
- break;
- case BAUDRATE:
- if (xf86getSubToken (&(ptr->inp_comment)) != NUMBER || val.num < 0)
- Error (POSITIVE_INT_MSG, "BaudRate");
- s = xf86uLongToString(val.num);
- ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
- strdup("BaudRate"), s);
- break;
- case SAMPLERATE:
- if (xf86getSubToken (&(ptr->inp_comment)) != NUMBER || val.num < 0)
- Error (POSITIVE_INT_MSG, "SampleRate");
- s = xf86uLongToString(val.num);
- ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
- strdup("SampleRate"), s);
- break;
- case PRESOLUTION:
- if (xf86getSubToken (&(ptr->inp_comment)) != NUMBER || val.num < 0)
- Error (POSITIVE_INT_MSG, "Resolution");
- s = xf86uLongToString(val.num);
- ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
- strdup("Resolution"), s);
- break;
- case CLEARDTR:
- ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
- strdup("ClearDTR"), NULL);
- break;
- case CLEARRTS:
- ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
- strdup("ClearRTS"), NULL);
- break;
- case ZAXISMAPPING:
- switch (xf86getToken(ZMapTab)) {
- case NUMBER:
- if (val.num < 0)
- Error (ZAXISMAPPING_MSG, NULL);
- val1 = val.num;
- if (xf86getSubToken (&(ptr->inp_comment)) != NUMBER || val.num < 0) {
- Error (ZAXISMAPPING_MSG, NULL);
- }
- if (asprintf(&s, "%lu %u", val1, val.num) == -1)
- s = NULL;
- break;
- case XAXIS:
- s = strdup("x");
- break;
- case YAXIS:
- s = strdup("y");
- break;
- default:
- Error (ZAXISMAPPING_MSG, NULL);
- break;
- }
- ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
- strdup("ZAxisMapping"),
- s);
- break;
- case ALWAYSCORE:
- break;
- case EOF_TOKEN:
- Error (UNEXPECTED_EOF_MSG, NULL);
- break;
- default:
- Error (INVALID_KEYWORD_MSG, xf86tokenString ());
- break;
- }
- }
+ parsePrologue(XF86ConfInputPtr, XF86ConfInputRec)
- ptr->inp_identifier = strdup(CONF_IMPLICIT_POINTER);
- ptr->inp_driver = strdup("mouse");
- ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
- strdup("CorePointer"), NULL);
+ while ((token = xf86getToken(PointerTab)) != ENDSECTION) {
+ switch (token) {
+ case COMMENT:
+ ptr->inp_comment = xf86addComment(ptr->inp_comment, val.str);
+ break;
+ case PROTOCOL:
+ if (xf86getSubToken(&(ptr->inp_comment)) != STRING)
+ Error(QUOTE_MSG, "Protocol");
+ ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
+ strdup("Protocol"), val.str);
+ break;
+ case PDEVICE:
+ if (xf86getSubToken(&(ptr->inp_comment)) != STRING)
+ Error(QUOTE_MSG, "Device");
+ ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
+ strdup("Device"), val.str);
+ break;
+ case EMULATE3:
+ ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
+ strdup("Emulate3Buttons"),
+ NULL);
+ break;
+ case EM3TIMEOUT:
+ if (xf86getSubToken(&(ptr->inp_comment)) != NUMBER || val.num < 0)
+ Error(POSITIVE_INT_MSG, "Emulate3Timeout");
+ s = xf86uLongToString(val.num);
+ ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
+ strdup("Emulate3Timeout"),
+ s);
+ break;
+ case CHORDMIDDLE:
+ ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
+ strdup("ChordMiddle"), NULL);
+ break;
+ case PBUTTONS:
+ if (xf86getSubToken(&(ptr->inp_comment)) != NUMBER || val.num < 0)
+ Error(POSITIVE_INT_MSG, "Buttons");
+ s = xf86uLongToString(val.num);
+ ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
+ strdup("Buttons"), s);
+ break;
+ case BAUDRATE:
+ if (xf86getSubToken(&(ptr->inp_comment)) != NUMBER || val.num < 0)
+ Error(POSITIVE_INT_MSG, "BaudRate");
+ s = xf86uLongToString(val.num);
+ ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
+ strdup("BaudRate"), s);
+ break;
+ case SAMPLERATE:
+ if (xf86getSubToken(&(ptr->inp_comment)) != NUMBER || val.num < 0)
+ Error(POSITIVE_INT_MSG, "SampleRate");
+ s = xf86uLongToString(val.num);
+ ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
+ strdup("SampleRate"), s);
+ break;
+ case PRESOLUTION:
+ if (xf86getSubToken(&(ptr->inp_comment)) != NUMBER || val.num < 0)
+ Error(POSITIVE_INT_MSG, "Resolution");
+ s = xf86uLongToString(val.num);
+ ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
+ strdup("Resolution"), s);
+ break;
+ case CLEARDTR:
+ ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
+ strdup("ClearDTR"), NULL);
+ break;
+ case CLEARRTS:
+ ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
+ strdup("ClearRTS"), NULL);
+ break;
+ case ZAXISMAPPING:
+ switch (xf86getToken(ZMapTab)) {
+ case NUMBER:
+ if (val.num < 0)
+ Error(ZAXISMAPPING_MSG);
+ val1 = val.num;
+ if (xf86getSubToken(&(ptr->inp_comment)) != NUMBER ||
+ val.num < 0) {
+ Error(ZAXISMAPPING_MSG);
+ }
+ if (asprintf(&s, "%lu %u", val1, val.num) == -1)
+ s = NULL;
+ break;
+ case XAXIS:
+ s = strdup("x");
+ break;
+ case YAXIS:
+ s = strdup("y");
+ break;
+ default:
+ Error(ZAXISMAPPING_MSG);
+ break;
+ }
+ ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
+ strdup("ZAxisMapping"), s);
+ break;
+ case ALWAYSCORE:
+ break;
+ case EOF_TOKEN:
+ Error(UNEXPECTED_EOF_MSG);
+ break;
+ default:
+ Error(INVALID_KEYWORD_MSG, xf86tokenString());
+ break;
+ }
+ }
+
+ ptr->inp_identifier = strdup(CONF_IMPLICIT_POINTER);
+ ptr->inp_driver = strdup("mouse");
+ ptr->inp_option_lst = xf86addNewOption(ptr->inp_option_lst,
+ strdup("CorePointer"), NULL);
#ifdef DEBUG
- printf ("Pointer section parsed\n");
+ printf("Pointer section parsed\n");
#endif
- return ptr;
+ return ptr;
}
#undef CLEANUP
-
diff --git a/xserver/hw/xfree86/parser/Screen.c b/xserver/hw/xfree86/parser/Screen.c
index dd2319d95..71778d88d 100644
--- a/xserver/hw/xfree86/parser/Screen.c
+++ b/xserver/hw/xfree86/parser/Screen.c
@@ -52,7 +52,6 @@
* authorization from the copyright holder(s) and author(s).
*/
-
/* View/edit this file with tab stops set to 4 */
#ifdef HAVE_XORG_CONFIG_H
@@ -65,505 +64,480 @@
extern LexRec val;
-static xf86ConfigSymTabRec DisplayTab[] =
-{
- {ENDSUBSECTION, "endsubsection"},
- {MODES, "modes"},
- {VIEWPORT, "viewport"},
- {VIRTUAL, "virtual"},
- {VISUAL, "visual"},
- {BLACK_TOK, "black"},
- {WHITE_TOK, "white"},
- {DEPTH, "depth"},
- {BPP, "fbbpp"},
- {WEIGHT, "weight"},
- {OPTION, "option"},
- {-1, ""},
+static xf86ConfigSymTabRec DisplayTab[] = {
+ {ENDSUBSECTION, "endsubsection"},
+ {MODES, "modes"},
+ {VIEWPORT, "viewport"},
+ {VIRTUAL, "virtual"},
+ {VISUAL, "visual"},
+ {BLACK_TOK, "black"},
+ {WHITE_TOK, "white"},
+ {DEPTH, "depth"},
+ {BPP, "fbbpp"},
+ {WEIGHT, "weight"},
+ {OPTION, "option"},
+ {-1, ""},
};
#define CLEANUP xf86freeDisplayList
static XF86ConfDisplayPtr
-xf86parseDisplaySubSection (void)
+xf86parseDisplaySubSection(void)
{
- int token;
- parsePrologue (XF86ConfDisplayPtr, XF86ConfDisplayRec)
-
- ptr->disp_black.red = ptr->disp_black.green = ptr->disp_black.blue = -1;
- ptr->disp_white.red = ptr->disp_white.green = ptr->disp_white.blue = -1;
- ptr->disp_frameX0 = ptr->disp_frameY0 = -1;
- while ((token = xf86getToken (DisplayTab)) != ENDSUBSECTION)
- {
- switch (token)
- {
- case COMMENT:
- ptr->disp_comment = xf86addComment(ptr->disp_comment, val.str);
- break;
- case VIEWPORT:
- if (xf86getSubToken (&(ptr->disp_comment)) != NUMBER)
- Error (VIEWPORT_MSG, NULL);
- ptr->disp_frameX0 = val.num;
- if (xf86getSubToken (&(ptr->disp_comment)) != NUMBER)
- Error (VIEWPORT_MSG, NULL);
- ptr->disp_frameY0 = val.num;
- break;
- case VIRTUAL:
- if (xf86getSubToken (&(ptr->disp_comment)) != NUMBER)
- Error (VIRTUAL_MSG, NULL);
- ptr->disp_virtualX = val.num;
- if (xf86getSubToken (&(ptr->disp_comment)) != NUMBER)
- Error (VIRTUAL_MSG, NULL);
- ptr->disp_virtualY = val.num;
- break;
- case DEPTH:
- if (xf86getSubToken (&(ptr->disp_comment)) != NUMBER)
- Error (NUMBER_MSG, "Display");
- ptr->disp_depth = val.num;
- break;
- case BPP:
- if (xf86getSubToken (&(ptr->disp_comment)) != NUMBER)
- Error (NUMBER_MSG, "Display");
- ptr->disp_bpp = val.num;
- break;
- case VISUAL:
- if (xf86getSubToken (&(ptr->disp_comment)) != STRING)
- Error (QUOTE_MSG, "Display");
- ptr->disp_visual = val.str;
- break;
- case WEIGHT:
- if (xf86getSubToken (&(ptr->disp_comment)) != NUMBER)
- Error (WEIGHT_MSG, NULL);
- ptr->disp_weight.red = val.num;
- if (xf86getSubToken (&(ptr->disp_comment)) != NUMBER)
- Error (WEIGHT_MSG, NULL);
- ptr->disp_weight.green = val.num;
- if (xf86getSubToken (&(ptr->disp_comment)) != NUMBER)
- Error (WEIGHT_MSG, NULL);
- ptr->disp_weight.blue = val.num;
- break;
- case BLACK_TOK:
- if (xf86getSubToken (&(ptr->disp_comment)) != NUMBER)
- Error (BLACK_MSG, NULL);
- ptr->disp_black.red = val.num;
- if (xf86getSubToken (&(ptr->disp_comment)) != NUMBER)
- Error (BLACK_MSG, NULL);
- ptr->disp_black.green = val.num;
- if (xf86getSubToken (&(ptr->disp_comment)) != NUMBER)
- Error (BLACK_MSG, NULL);
- ptr->disp_black.blue = val.num;
- break;
- case WHITE_TOK:
- if (xf86getSubToken (&(ptr->disp_comment)) != NUMBER)
- Error (WHITE_MSG, NULL);
- ptr->disp_white.red = val.num;
- if (xf86getSubToken (&(ptr->disp_comment)) != NUMBER)
- Error (WHITE_MSG, NULL);
- ptr->disp_white.green = val.num;
- if (xf86getSubToken (&(ptr->disp_comment)) != NUMBER)
- Error (WHITE_MSG, NULL);
- ptr->disp_white.blue = val.num;
- break;
- case MODES:
- {
- XF86ModePtr mptr;
-
- while ((token = xf86getSubTokenWithTab (&(ptr->disp_comment), DisplayTab)) == STRING)
- {
- mptr = calloc (1, sizeof (XF86ModeRec));
- mptr->mode_name = val.str;
- mptr->list.next = NULL;
- ptr->disp_mode_lst = (XF86ModePtr)
- xf86addListItem ((glp) ptr->disp_mode_lst, (glp) mptr);
- }
- xf86unGetToken (token);
- }
- break;
- case OPTION:
- ptr->disp_option_lst = xf86parseOption(ptr->disp_option_lst);
- break;
-
- case EOF_TOKEN:
- Error (UNEXPECTED_EOF_MSG, NULL);
- break;
- default:
- Error (INVALID_KEYWORD_MSG, xf86tokenString ());
- break;
- }
- }
+ int token;
+
+ parsePrologue(XF86ConfDisplayPtr, XF86ConfDisplayRec)
+
+ ptr->disp_black.red = ptr->disp_black.green = ptr->disp_black.blue = -1;
+ ptr->disp_white.red = ptr->disp_white.green = ptr->disp_white.blue = -1;
+ ptr->disp_frameX0 = ptr->disp_frameY0 = -1;
+ while ((token = xf86getToken(DisplayTab)) != ENDSUBSECTION) {
+ switch (token) {
+ case COMMENT:
+ ptr->disp_comment = xf86addComment(ptr->disp_comment, val.str);
+ break;
+ case VIEWPORT:
+ if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER)
+ Error(VIEWPORT_MSG);
+ ptr->disp_frameX0 = val.num;
+ if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER)
+ Error(VIEWPORT_MSG);
+ ptr->disp_frameY0 = val.num;
+ break;
+ case VIRTUAL:
+ if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER)
+ Error(VIRTUAL_MSG);
+ ptr->disp_virtualX = val.num;
+ if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER)
+ Error(VIRTUAL_MSG);
+ ptr->disp_virtualY = val.num;
+ break;
+ case DEPTH:
+ if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER)
+ Error(NUMBER_MSG, "Display");
+ ptr->disp_depth = val.num;
+ break;
+ case BPP:
+ if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER)
+ Error(NUMBER_MSG, "Display");
+ ptr->disp_bpp = val.num;
+ break;
+ case VISUAL:
+ if (xf86getSubToken(&(ptr->disp_comment)) != STRING)
+ Error(QUOTE_MSG, "Display");
+ ptr->disp_visual = val.str;
+ break;
+ case WEIGHT:
+ if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER)
+ Error(WEIGHT_MSG);
+ ptr->disp_weight.red = val.num;
+ if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER)
+ Error(WEIGHT_MSG);
+ ptr->disp_weight.green = val.num;
+ if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER)
+ Error(WEIGHT_MSG);
+ ptr->disp_weight.blue = val.num;
+ break;
+ case BLACK_TOK:
+ if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER)
+ Error(BLACK_MSG);
+ ptr->disp_black.red = val.num;
+ if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER)
+ Error(BLACK_MSG);
+ ptr->disp_black.green = val.num;
+ if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER)
+ Error(BLACK_MSG);
+ ptr->disp_black.blue = val.num;
+ break;
+ case WHITE_TOK:
+ if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER)
+ Error(WHITE_MSG);
+ ptr->disp_white.red = val.num;
+ if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER)
+ Error(WHITE_MSG);
+ ptr->disp_white.green = val.num;
+ if (xf86getSubToken(&(ptr->disp_comment)) != NUMBER)
+ Error(WHITE_MSG);
+ ptr->disp_white.blue = val.num;
+ break;
+ case MODES:
+ {
+ XF86ModePtr mptr;
+
+ while ((token =
+ xf86getSubTokenWithTab(&(ptr->disp_comment),
+ DisplayTab)) == STRING) {
+ mptr = calloc(1, sizeof(XF86ModeRec));
+ mptr->mode_name = val.str;
+ mptr->list.next = NULL;
+ ptr->disp_mode_lst = (XF86ModePtr)
+ xf86addListItem((glp) ptr->disp_mode_lst, (glp) mptr);
+ }
+ xf86unGetToken(token);
+ }
+ break;
+ case OPTION:
+ ptr->disp_option_lst = xf86parseOption(ptr->disp_option_lst);
+ break;
+
+ case EOF_TOKEN:
+ Error(UNEXPECTED_EOF_MSG);
+ break;
+ default:
+ Error(INVALID_KEYWORD_MSG, xf86tokenString());
+ break;
+ }
+ }
#ifdef DEBUG
- printf ("Display subsection parsed\n");
+ printf("Display subsection parsed\n");
#endif
- return ptr;
+ return ptr;
}
#undef CLEANUP
-static xf86ConfigSymTabRec ScreenTab[] =
-{
- {ENDSECTION, "endsection"},
- {IDENTIFIER, "identifier"},
- {OBSDRIVER, "driver"},
- {MDEVICE, "device"},
- {MONITOR, "monitor"},
- {VIDEOADAPTOR, "videoadaptor"},
- {SCREENNO, "screenno"},
- {SUBSECTION, "subsection"},
- {DEFAULTDEPTH, "defaultcolordepth"},
- {DEFAULTDEPTH, "defaultdepth"},
- {DEFAULTBPP, "defaultbpp"},
- {DEFAULTFBBPP, "defaultfbbpp"},
- {VIRTUAL, "virtual"},
- {OPTION, "option"},
- {-1, ""},
+static xf86ConfigSymTabRec ScreenTab[] = {
+ {ENDSECTION, "endsection"},
+ {IDENTIFIER, "identifier"},
+ {OBSDRIVER, "driver"},
+ {MDEVICE, "device"},
+ {MONITOR, "monitor"},
+ {VIDEOADAPTOR, "videoadaptor"},
+ {SCREENNO, "screenno"},
+ {SUBSECTION, "subsection"},
+ {DEFAULTDEPTH, "defaultcolordepth"},
+ {DEFAULTDEPTH, "defaultdepth"},
+ {DEFAULTBPP, "defaultbpp"},
+ {DEFAULTFBBPP, "defaultfbbpp"},
+ {VIRTUAL, "virtual"},
+ {OPTION, "option"},
+ {-1, ""},
};
#define CLEANUP xf86freeScreenList
XF86ConfScreenPtr
-xf86parseScreenSection (void)
+xf86parseScreenSection(void)
{
- int has_ident = FALSE;
- int has_driver= FALSE;
- int token;
-
- parsePrologue (XF86ConfScreenPtr, XF86ConfScreenRec)
-
- while ((token = xf86getToken (ScreenTab)) != ENDSECTION)
- {
- switch (token)
- {
- case COMMENT:
- ptr->scrn_comment = xf86addComment(ptr->scrn_comment, val.str);
- break;
- case IDENTIFIER:
- if (xf86getSubToken (&(ptr->scrn_comment)) != STRING)
- Error (QUOTE_MSG, "Identifier");
- ptr->scrn_identifier = val.str;
- if (has_ident || has_driver)
- Error (ONLY_ONE_MSG,"Identifier or Driver");
- has_ident = TRUE;
- break;
- case OBSDRIVER:
- if (xf86getSubToken (&(ptr->scrn_comment)) != STRING)
- Error (QUOTE_MSG, "Driver");
- ptr->scrn_obso_driver = val.str;
- if (has_ident || has_driver)
- Error (ONLY_ONE_MSG,"Identifier or Driver");
- has_driver = TRUE;
- break;
- case DEFAULTDEPTH:
- if (xf86getSubToken (&(ptr->scrn_comment)) != NUMBER)
- Error (NUMBER_MSG, "DefaultDepth");
- ptr->scrn_defaultdepth = val.num;
- break;
- case DEFAULTBPP:
- if (xf86getSubToken (&(ptr->scrn_comment)) != NUMBER)
- Error (NUMBER_MSG, "DefaultBPP");
- ptr->scrn_defaultbpp = val.num;
- break;
- case DEFAULTFBBPP:
- if (xf86getSubToken (&(ptr->scrn_comment)) != NUMBER)
- Error (NUMBER_MSG, "DefaultFbBPP");
- ptr->scrn_defaultfbbpp = val.num;
- break;
- case MDEVICE:
- if (xf86getSubToken (&(ptr->scrn_comment)) != STRING)
- Error (QUOTE_MSG, "Device");
- ptr->scrn_device_str = val.str;
- break;
- case MONITOR:
- if (xf86getSubToken (&(ptr->scrn_comment)) != STRING)
- Error (QUOTE_MSG, "Monitor");
- ptr->scrn_monitor_str = val.str;
- break;
- case VIDEOADAPTOR:
- {
- XF86ConfAdaptorLinkPtr aptr;
-
- if (xf86getSubToken (&(ptr->scrn_comment)) != STRING)
- Error (QUOTE_MSG, "VideoAdaptor");
-
- /* Don't allow duplicates */
- for (aptr = ptr->scrn_adaptor_lst; aptr;
- aptr = (XF86ConfAdaptorLinkPtr) aptr->list.next)
- if (xf86nameCompare (val.str, aptr->al_adaptor_str) == 0)
- break;
-
- if (aptr == NULL)
- {
- aptr = calloc (1, sizeof (XF86ConfAdaptorLinkRec));
- aptr->list.next = NULL;
- aptr->al_adaptor_str = val.str;
- ptr->scrn_adaptor_lst = (XF86ConfAdaptorLinkPtr)
- xf86addListItem ((glp) ptr->scrn_adaptor_lst, (glp) aptr);
- }
- }
- break;
- case VIRTUAL:
- if (xf86getSubToken (&(ptr->scrn_comment)) != NUMBER)
- Error (VIRTUAL_MSG, NULL);
- ptr->scrn_virtualX = val.num;
- if (xf86getSubToken (&(ptr->scrn_comment)) != NUMBER)
- Error (VIRTUAL_MSG, NULL);
- ptr->scrn_virtualY = val.num;
- break;
- case OPTION:
- ptr->scrn_option_lst = xf86parseOption(ptr->scrn_option_lst);
- break;
- case SUBSECTION:
- if (xf86getSubToken (&(ptr->scrn_comment)) != STRING)
- Error (QUOTE_MSG, "SubSection");
- {
- free(val.str);
- HANDLE_LIST (scrn_display_lst, xf86parseDisplaySubSection,
- XF86ConfDisplayPtr);
- }
- break;
- case EOF_TOKEN:
- Error (UNEXPECTED_EOF_MSG, NULL);
- break;
- default:
- Error (INVALID_KEYWORD_MSG, xf86tokenString ());
- break;
- }
- }
-
- if (!has_ident && !has_driver)
- Error (NO_IDENT_MSG, NULL);
+ int has_ident = FALSE;
+ int has_driver = FALSE;
+ int token;
+
+ parsePrologue(XF86ConfScreenPtr, XF86ConfScreenRec)
+
+ while ((token = xf86getToken(ScreenTab)) != ENDSECTION) {
+ switch (token) {
+ case COMMENT:
+ ptr->scrn_comment = xf86addComment(ptr->scrn_comment, val.str);
+ break;
+ case IDENTIFIER:
+ if (xf86getSubToken(&(ptr->scrn_comment)) != STRING)
+ Error(QUOTE_MSG, "Identifier");
+ ptr->scrn_identifier = val.str;
+ if (has_ident || has_driver)
+ Error(ONLY_ONE_MSG, "Identifier or Driver");
+ has_ident = TRUE;
+ break;
+ case OBSDRIVER:
+ if (xf86getSubToken(&(ptr->scrn_comment)) != STRING)
+ Error(QUOTE_MSG, "Driver");
+ ptr->scrn_obso_driver = val.str;
+ if (has_ident || has_driver)
+ Error(ONLY_ONE_MSG, "Identifier or Driver");
+ has_driver = TRUE;
+ break;
+ case DEFAULTDEPTH:
+ if (xf86getSubToken(&(ptr->scrn_comment)) != NUMBER)
+ Error(NUMBER_MSG, "DefaultDepth");
+ ptr->scrn_defaultdepth = val.num;
+ break;
+ case DEFAULTBPP:
+ if (xf86getSubToken(&(ptr->scrn_comment)) != NUMBER)
+ Error(NUMBER_MSG, "DefaultBPP");
+ ptr->scrn_defaultbpp = val.num;
+ break;
+ case DEFAULTFBBPP:
+ if (xf86getSubToken(&(ptr->scrn_comment)) != NUMBER)
+ Error(NUMBER_MSG, "DefaultFbBPP");
+ ptr->scrn_defaultfbbpp = val.num;
+ break;
+ case MDEVICE:
+ if (xf86getSubToken(&(ptr->scrn_comment)) != STRING)
+ Error(QUOTE_MSG, "Device");
+ ptr->scrn_device_str = val.str;
+ break;
+ case MONITOR:
+ if (xf86getSubToken(&(ptr->scrn_comment)) != STRING)
+ Error(QUOTE_MSG, "Monitor");
+ ptr->scrn_monitor_str = val.str;
+ break;
+ case VIDEOADAPTOR:
+ {
+ XF86ConfAdaptorLinkPtr aptr;
+
+ if (xf86getSubToken(&(ptr->scrn_comment)) != STRING)
+ Error(QUOTE_MSG, "VideoAdaptor");
+
+ /* Don't allow duplicates */
+ for (aptr = ptr->scrn_adaptor_lst; aptr;
+ aptr = (XF86ConfAdaptorLinkPtr) aptr->list.next)
+ if (xf86nameCompare(val.str, aptr->al_adaptor_str) == 0)
+ break;
+
+ if (aptr == NULL) {
+ aptr = calloc(1, sizeof(XF86ConfAdaptorLinkRec));
+ aptr->list.next = NULL;
+ aptr->al_adaptor_str = val.str;
+ ptr->scrn_adaptor_lst = (XF86ConfAdaptorLinkPtr)
+ xf86addListItem((glp) ptr->scrn_adaptor_lst, (glp) aptr);
+ }
+ }
+ break;
+ case VIRTUAL:
+ if (xf86getSubToken(&(ptr->scrn_comment)) != NUMBER)
+ Error(VIRTUAL_MSG);
+ ptr->scrn_virtualX = val.num;
+ if (xf86getSubToken(&(ptr->scrn_comment)) != NUMBER)
+ Error(VIRTUAL_MSG);
+ ptr->scrn_virtualY = val.num;
+ break;
+ case OPTION:
+ ptr->scrn_option_lst = xf86parseOption(ptr->scrn_option_lst);
+ break;
+ case SUBSECTION:
+ if (xf86getSubToken(&(ptr->scrn_comment)) != STRING)
+ Error(QUOTE_MSG, "SubSection");
+ {
+ free(val.str);
+ HANDLE_LIST(scrn_display_lst, xf86parseDisplaySubSection,
+ XF86ConfDisplayPtr);
+ }
+ break;
+ case EOF_TOKEN:
+ Error(UNEXPECTED_EOF_MSG);
+ break;
+ default:
+ Error(INVALID_KEYWORD_MSG, xf86tokenString());
+ break;
+ }
+ }
+
+ if (!has_ident && !has_driver)
+ Error(NO_IDENT_MSG);
#ifdef DEBUG
- printf ("Screen section parsed\n");
+ printf("Screen section parsed\n");
#endif
- return ptr;
+ return ptr;
}
void
-xf86printScreenSection (FILE * cf, XF86ConfScreenPtr ptr)
+xf86printScreenSection(FILE * cf, XF86ConfScreenPtr ptr)
{
- XF86ConfAdaptorLinkPtr aptr;
- XF86ConfDisplayPtr dptr;
- XF86ModePtr mptr;
-
- while (ptr)
- {
- fprintf (cf, "Section \"Screen\"\n");
- if (ptr->scrn_comment)
- fprintf (cf, "%s", ptr->scrn_comment);
- if (ptr->scrn_identifier)
- fprintf (cf, "\tIdentifier \"%s\"\n", ptr->scrn_identifier);
- if (ptr->scrn_obso_driver)
- fprintf (cf, "\tDriver \"%s\"\n", ptr->scrn_obso_driver);
- if (ptr->scrn_device_str)
- fprintf (cf, "\tDevice \"%s\"\n", ptr->scrn_device_str);
- if (ptr->scrn_monitor_str)
- fprintf (cf, "\tMonitor \"%s\"\n", ptr->scrn_monitor_str);
- if (ptr->scrn_defaultdepth)
- fprintf (cf, "\tDefaultDepth %d\n",
- ptr->scrn_defaultdepth);
- if (ptr->scrn_defaultbpp)
- fprintf (cf, "\tDefaultBPP %d\n",
- ptr->scrn_defaultbpp);
- if (ptr->scrn_defaultfbbpp)
- fprintf (cf, "\tDefaultFbBPP %d\n",
- ptr->scrn_defaultfbbpp);
- xf86printOptionList(cf, ptr->scrn_option_lst, 1);
- for (aptr = ptr->scrn_adaptor_lst; aptr; aptr = aptr->list.next)
- {
- fprintf (cf, "\tVideoAdaptor \"%s\"\n", aptr->al_adaptor_str);
- }
- if (ptr->scrn_virtualX && ptr->scrn_virtualY)
- fprintf (cf, "\tVirtual %d %d\n",
- ptr->scrn_virtualX,
- ptr->scrn_virtualY);
- for (dptr = ptr->scrn_display_lst; dptr; dptr = dptr->list.next)
- {
- fprintf (cf, "\tSubSection \"Display\"\n");
- if (dptr->disp_comment)
- fprintf (cf, "%s", dptr->disp_comment);
- if (dptr->disp_frameX0 >= 0 || dptr->disp_frameY0 >= 0)
- {
- fprintf (cf, "\t\tViewport %d %d\n",
- dptr->disp_frameX0, dptr->disp_frameY0);
- }
- if (dptr->disp_virtualX != 0 || dptr->disp_virtualY != 0)
- {
- fprintf (cf, "\t\tVirtual %d %d\n",
- dptr->disp_virtualX, dptr->disp_virtualY);
- }
- if (dptr->disp_depth)
- {
- fprintf (cf, "\t\tDepth %d\n", dptr->disp_depth);
- }
- if (dptr->disp_bpp)
- {
- fprintf (cf, "\t\tFbBPP %d\n", dptr->disp_bpp);
- }
- if (dptr->disp_visual)
- {
- fprintf (cf, "\t\tVisual \"%s\"\n", dptr->disp_visual);
- }
- if (dptr->disp_weight.red != 0)
- {
- fprintf (cf, "\t\tWeight %d %d %d\n",
- dptr->disp_weight.red, dptr->disp_weight.green, dptr->disp_weight.blue);
- }
- if (dptr->disp_black.red != -1)
- {
- fprintf (cf, "\t\tBlack 0x%04x 0x%04x 0x%04x\n",
- dptr->disp_black.red, dptr->disp_black.green, dptr->disp_black.blue);
- }
- if (dptr->disp_white.red != -1)
- {
- fprintf (cf, "\t\tWhite 0x%04x 0x%04x 0x%04x\n",
- dptr->disp_white.red, dptr->disp_white.green, dptr->disp_white.blue);
- }
- if (dptr->disp_mode_lst)
- {
- fprintf (cf, "\t\tModes ");
- }
- for (mptr = dptr->disp_mode_lst; mptr; mptr = mptr->list.next)
- {
- fprintf (cf, " \"%s\"", mptr->mode_name);
- }
- if (dptr->disp_mode_lst)
- {
- fprintf (cf, "\n");
- }
- xf86printOptionList(cf, dptr->disp_option_lst, 2);
- fprintf (cf, "\tEndSubSection\n");
- }
- fprintf (cf, "EndSection\n\n");
- ptr = ptr->list.next;
- }
+ XF86ConfAdaptorLinkPtr aptr;
+ XF86ConfDisplayPtr dptr;
+ XF86ModePtr mptr;
+
+ while (ptr) {
+ fprintf(cf, "Section \"Screen\"\n");
+ if (ptr->scrn_comment)
+ fprintf(cf, "%s", ptr->scrn_comment);
+ if (ptr->scrn_identifier)
+ fprintf(cf, "\tIdentifier \"%s\"\n", ptr->scrn_identifier);
+ if (ptr->scrn_obso_driver)
+ fprintf(cf, "\tDriver \"%s\"\n", ptr->scrn_obso_driver);
+ if (ptr->scrn_device_str)
+ fprintf(cf, "\tDevice \"%s\"\n", ptr->scrn_device_str);
+ if (ptr->scrn_monitor_str)
+ fprintf(cf, "\tMonitor \"%s\"\n", ptr->scrn_monitor_str);
+ if (ptr->scrn_defaultdepth)
+ fprintf(cf, "\tDefaultDepth %d\n", ptr->scrn_defaultdepth);
+ if (ptr->scrn_defaultbpp)
+ fprintf(cf, "\tDefaultBPP %d\n", ptr->scrn_defaultbpp);
+ if (ptr->scrn_defaultfbbpp)
+ fprintf(cf, "\tDefaultFbBPP %d\n", ptr->scrn_defaultfbbpp);
+ xf86printOptionList(cf, ptr->scrn_option_lst, 1);
+ for (aptr = ptr->scrn_adaptor_lst; aptr; aptr = aptr->list.next) {
+ fprintf(cf, "\tVideoAdaptor \"%s\"\n", aptr->al_adaptor_str);
+ }
+ if (ptr->scrn_virtualX && ptr->scrn_virtualY)
+ fprintf(cf, "\tVirtual %d %d\n",
+ ptr->scrn_virtualX, ptr->scrn_virtualY);
+ for (dptr = ptr->scrn_display_lst; dptr; dptr = dptr->list.next) {
+ fprintf(cf, "\tSubSection \"Display\"\n");
+ if (dptr->disp_comment)
+ fprintf(cf, "%s", dptr->disp_comment);
+ if (dptr->disp_frameX0 >= 0 || dptr->disp_frameY0 >= 0) {
+ fprintf(cf, "\t\tViewport %d %d\n",
+ dptr->disp_frameX0, dptr->disp_frameY0);
+ }
+ if (dptr->disp_virtualX != 0 || dptr->disp_virtualY != 0) {
+ fprintf(cf, "\t\tVirtual %d %d\n",
+ dptr->disp_virtualX, dptr->disp_virtualY);
+ }
+ if (dptr->disp_depth) {
+ fprintf(cf, "\t\tDepth %d\n", dptr->disp_depth);
+ }
+ if (dptr->disp_bpp) {
+ fprintf(cf, "\t\tFbBPP %d\n", dptr->disp_bpp);
+ }
+ if (dptr->disp_visual) {
+ fprintf(cf, "\t\tVisual \"%s\"\n", dptr->disp_visual);
+ }
+ if (dptr->disp_weight.red != 0) {
+ fprintf(cf, "\t\tWeight %d %d %d\n",
+ dptr->disp_weight.red, dptr->disp_weight.green,
+ dptr->disp_weight.blue);
+ }
+ if (dptr->disp_black.red != -1) {
+ fprintf(cf, "\t\tBlack 0x%04x 0x%04x 0x%04x\n",
+ dptr->disp_black.red, dptr->disp_black.green,
+ dptr->disp_black.blue);
+ }
+ if (dptr->disp_white.red != -1) {
+ fprintf(cf, "\t\tWhite 0x%04x 0x%04x 0x%04x\n",
+ dptr->disp_white.red, dptr->disp_white.green,
+ dptr->disp_white.blue);
+ }
+ if (dptr->disp_mode_lst) {
+ fprintf(cf, "\t\tModes ");
+ }
+ for (mptr = dptr->disp_mode_lst; mptr; mptr = mptr->list.next) {
+ fprintf(cf, " \"%s\"", mptr->mode_name);
+ }
+ if (dptr->disp_mode_lst) {
+ fprintf(cf, "\n");
+ }
+ xf86printOptionList(cf, dptr->disp_option_lst, 2);
+ fprintf(cf, "\tEndSubSection\n");
+ }
+ fprintf(cf, "EndSection\n\n");
+ ptr = ptr->list.next;
+ }
}
void
-xf86freeScreenList (XF86ConfScreenPtr ptr)
+xf86freeScreenList(XF86ConfScreenPtr ptr)
{
- XF86ConfScreenPtr prev;
-
- while (ptr)
- {
- TestFree (ptr->scrn_identifier);
- TestFree (ptr->scrn_monitor_str);
- TestFree (ptr->scrn_device_str);
- TestFree (ptr->scrn_comment);
- xf86optionListFree (ptr->scrn_option_lst);
- xf86freeAdaptorLinkList (ptr->scrn_adaptor_lst);
- xf86freeDisplayList (ptr->scrn_display_lst);
- prev = ptr;
- ptr = ptr->list.next;
- free (prev);
- }
+ XF86ConfScreenPtr prev;
+
+ while (ptr) {
+ TestFree(ptr->scrn_identifier);
+ TestFree(ptr->scrn_monitor_str);
+ TestFree(ptr->scrn_device_str);
+ TestFree(ptr->scrn_comment);
+ xf86optionListFree(ptr->scrn_option_lst);
+ xf86freeAdaptorLinkList(ptr->scrn_adaptor_lst);
+ xf86freeDisplayList(ptr->scrn_display_lst);
+ prev = ptr;
+ ptr = ptr->list.next;
+ free(prev);
+ }
}
void
-xf86freeAdaptorLinkList (XF86ConfAdaptorLinkPtr ptr)
+xf86freeAdaptorLinkList(XF86ConfAdaptorLinkPtr ptr)
{
- XF86ConfAdaptorLinkPtr prev;
-
- while (ptr)
- {
- TestFree (ptr->al_adaptor_str);
- prev = ptr;
- ptr = ptr->list.next;
- free (prev);
- }
+ XF86ConfAdaptorLinkPtr prev;
+
+ while (ptr) {
+ TestFree(ptr->al_adaptor_str);
+ prev = ptr;
+ ptr = ptr->list.next;
+ free(prev);
+ }
}
void
-xf86freeDisplayList (XF86ConfDisplayPtr ptr)
+xf86freeDisplayList(XF86ConfDisplayPtr ptr)
{
- XF86ConfDisplayPtr prev;
-
- while (ptr)
- {
- xf86freeModeList (ptr->disp_mode_lst);
- xf86optionListFree (ptr->disp_option_lst);
- prev = ptr;
- ptr = ptr->list.next;
- free (prev);
- }
+ XF86ConfDisplayPtr prev;
+
+ while (ptr) {
+ xf86freeModeList(ptr->disp_mode_lst);
+ xf86optionListFree(ptr->disp_option_lst);
+ prev = ptr;
+ ptr = ptr->list.next;
+ free(prev);
+ }
}
void
-xf86freeModeList (XF86ModePtr ptr)
+xf86freeModeList(XF86ModePtr ptr)
{
- XF86ModePtr prev;
-
- while (ptr)
- {
- TestFree (ptr->mode_name);
- prev = ptr;
- ptr = ptr->list.next;
- free (prev);
- }
+ XF86ModePtr prev;
+
+ while (ptr) {
+ TestFree(ptr->mode_name);
+ prev = ptr;
+ ptr = ptr->list.next;
+ free(prev);
+ }
}
int
-xf86validateScreen (XF86ConfigPtr p)
+xf86validateScreen(XF86ConfigPtr p)
{
- XF86ConfScreenPtr screen = p->conf_screen_lst;
- XF86ConfMonitorPtr monitor;
- XF86ConfAdaptorLinkPtr adaptor;
-
- while (screen)
- {
- if (screen->scrn_obso_driver && !screen->scrn_identifier)
- screen->scrn_identifier = screen->scrn_obso_driver;
-
- monitor = xf86findMonitor (screen->scrn_monitor_str, p->conf_monitor_lst);
- if (screen->scrn_monitor_str)
- {
- if (monitor)
- {
- screen->scrn_monitor = monitor;
- if (!xf86validateMonitor(p, screen))
- return FALSE;
- }
- }
-
- screen->scrn_device= xf86findDevice (screen->scrn_device_str, p->conf_device_lst);
-
- adaptor = screen->scrn_adaptor_lst;
- while (adaptor)
- {
- adaptor->al_adaptor = xf86findVideoAdaptor (adaptor->al_adaptor_str, p->conf_videoadaptor_lst);
- if (!adaptor->al_adaptor)
- {
- xf86validationError (UNDEFINED_ADAPTOR_MSG, adaptor->al_adaptor_str, screen->scrn_identifier);
- return FALSE;
- }
- else if (adaptor->al_adaptor->va_fwdref)
- {
- xf86validationError (ADAPTOR_REF_TWICE_MSG, adaptor->al_adaptor_str,
- adaptor->al_adaptor->va_fwdref);
- return FALSE;
- }
-
- adaptor->al_adaptor->va_fwdref = strdup(screen->scrn_identifier);
- adaptor = adaptor->list.next;
- }
-
- screen = screen->list.next;
- }
-
- return TRUE;
+ XF86ConfScreenPtr screen = p->conf_screen_lst;
+ XF86ConfMonitorPtr monitor;
+ XF86ConfAdaptorLinkPtr adaptor;
+
+ while (screen) {
+ if (screen->scrn_obso_driver && !screen->scrn_identifier)
+ screen->scrn_identifier = screen->scrn_obso_driver;
+
+ monitor =
+ xf86findMonitor(screen->scrn_monitor_str, p->conf_monitor_lst);
+ if (screen->scrn_monitor_str) {
+ if (monitor) {
+ screen->scrn_monitor = monitor;
+ if (!xf86validateMonitor(p, screen))
+ return FALSE;
+ }
+ }
+
+ screen->scrn_device =
+ xf86findDevice(screen->scrn_device_str, p->conf_device_lst);
+
+ adaptor = screen->scrn_adaptor_lst;
+ while (adaptor) {
+ adaptor->al_adaptor =
+ xf86findVideoAdaptor(adaptor->al_adaptor_str,
+ p->conf_videoadaptor_lst);
+ if (!adaptor->al_adaptor) {
+ xf86validationError(UNDEFINED_ADAPTOR_MSG,
+ adaptor->al_adaptor_str,
+ screen->scrn_identifier);
+ return FALSE;
+ }
+ else if (adaptor->al_adaptor->va_fwdref) {
+ xf86validationError(ADAPTOR_REF_TWICE_MSG,
+ adaptor->al_adaptor_str,
+ adaptor->al_adaptor->va_fwdref);
+ return FALSE;
+ }
+
+ adaptor->al_adaptor->va_fwdref = strdup(screen->scrn_identifier);
+ adaptor = adaptor->list.next;
+ }
+
+ screen = screen->list.next;
+ }
+
+ return TRUE;
}
XF86ConfScreenPtr
-xf86findScreen (const char *ident, XF86ConfScreenPtr p)
+xf86findScreen(const char *ident, XF86ConfScreenPtr p)
{
- while (p)
- {
- if (xf86nameCompare (ident, p->scrn_identifier) == 0)
- return p;
-
- p = p->list.next;
- }
- return NULL;
-}
+ while (p) {
+ if (xf86nameCompare(ident, p->scrn_identifier) == 0)
+ return p;
+ p = p->list.next;
+ }
+ return NULL;
+}
diff --git a/xserver/hw/xfree86/parser/Vendor.c b/xserver/hw/xfree86/parser/Vendor.c
index dce3f1ca1..b4e2165b0 100644
--- a/xserver/hw/xfree86/parser/Vendor.c
+++ b/xserver/hw/xfree86/parser/Vendor.c
@@ -52,7 +52,6 @@
* authorization from the copyright holder(s) and author(s).
*/
-
/* View/edit this file with tab stops set to 4 */
#ifdef HAVE_XORG_CONFIG_H
@@ -65,180 +64,173 @@
extern LexRec val;
-static xf86ConfigSymTabRec VendorSubTab[] =
-{
- {ENDSUBSECTION, "endsubsection"},
- {IDENTIFIER, "identifier"},
- {OPTION, "option"},
- {-1, ""},
+static xf86ConfigSymTabRec VendorSubTab[] = {
+ {ENDSUBSECTION, "endsubsection"},
+ {IDENTIFIER, "identifier"},
+ {OPTION, "option"},
+ {-1, ""},
};
#define CLEANUP xf86freeVendorSubList
static XF86ConfVendSubPtr
-xf86parseVendorSubSection (void)
+xf86parseVendorSubSection(void)
{
- int has_ident = FALSE;
- int token;
- parsePrologue (XF86ConfVendSubPtr, XF86ConfVendSubRec)
-
- while ((token = xf86getToken (VendorSubTab)) != ENDSUBSECTION)
- {
- switch (token)
- {
- case COMMENT:
- ptr->vs_comment = xf86addComment(ptr->vs_comment, val.str);
- break;
- case IDENTIFIER:
- if (xf86getSubToken (&(ptr->vs_comment)))
- Error (QUOTE_MSG, "Identifier");
- if (has_ident == TRUE)
- Error (MULTIPLE_MSG, "Identifier");
- ptr->vs_identifier = val.str;
- has_ident = TRUE;
- break;
- case OPTION:
- ptr->vs_option_lst = xf86parseOption(ptr->vs_option_lst);
- break;
-
- case EOF_TOKEN:
- Error (UNEXPECTED_EOF_MSG, NULL);
- break;
- default:
- Error (INVALID_KEYWORD_MSG, xf86tokenString ());
- break;
- }
- }
+ int has_ident = FALSE;
+ int token;
+
+ parsePrologue(XF86ConfVendSubPtr, XF86ConfVendSubRec)
+
+ while ((token = xf86getToken(VendorSubTab)) != ENDSUBSECTION) {
+ switch (token) {
+ case COMMENT:
+ ptr->vs_comment = xf86addComment(ptr->vs_comment, val.str);
+ break;
+ case IDENTIFIER:
+ if (xf86getSubToken(&(ptr->vs_comment)))
+ Error(QUOTE_MSG, "Identifier");
+ if (has_ident == TRUE)
+ Error(MULTIPLE_MSG, "Identifier");
+ ptr->vs_identifier = val.str;
+ has_ident = TRUE;
+ break;
+ case OPTION:
+ ptr->vs_option_lst = xf86parseOption(ptr->vs_option_lst);
+ break;
+
+ case EOF_TOKEN:
+ Error(UNEXPECTED_EOF_MSG);
+ break;
+ default:
+ Error(INVALID_KEYWORD_MSG, xf86tokenString());
+ break;
+ }
+ }
#ifdef DEBUG
- printf ("Vendor subsection parsed\n");
+ printf("Vendor subsection parsed\n");
#endif
- return ptr;
+ return ptr;
}
#undef CLEANUP
-static xf86ConfigSymTabRec VendorTab[] =
-{
- {ENDSECTION, "endsection"},
- {IDENTIFIER, "identifier"},
- {OPTION, "option"},
- {SUBSECTION, "subsection"},
- {-1, ""},
+static xf86ConfigSymTabRec VendorTab[] = {
+ {ENDSECTION, "endsection"},
+ {IDENTIFIER, "identifier"},
+ {OPTION, "option"},
+ {SUBSECTION, "subsection"},
+ {-1, ""},
};
#define CLEANUP xf86freeVendorList
XF86ConfVendorPtr
-xf86parseVendorSection (void)
+xf86parseVendorSection(void)
{
- int has_ident = FALSE;
- int token;
- parsePrologue (XF86ConfVendorPtr, XF86ConfVendorRec)
-
- while ((token = xf86getToken (VendorTab)) != ENDSECTION)
- {
- switch (token)
- {
- case COMMENT:
- ptr->vnd_comment = xf86addComment(ptr->vnd_comment, val.str);
- break;
- case IDENTIFIER:
- if (xf86getSubToken (&(ptr->vnd_comment)) != STRING)
- Error (QUOTE_MSG, "Identifier");
- if (has_ident == TRUE)
- Error (MULTIPLE_MSG, "Identifier");
- ptr->vnd_identifier = val.str;
- has_ident = TRUE;
- break;
- case OPTION:
- ptr->vnd_option_lst = xf86parseOption(ptr->vnd_option_lst);
- break;
- case SUBSECTION:
- if (xf86getSubToken (&(ptr->vnd_comment)) != STRING)
- Error (QUOTE_MSG, "SubSection");
- {
- HANDLE_LIST (vnd_sub_lst, xf86parseVendorSubSection,
- XF86ConfVendSubPtr);
- }
- break;
- case EOF_TOKEN:
- Error (UNEXPECTED_EOF_MSG, NULL);
- break;
- default:
- Error (INVALID_KEYWORD_MSG, xf86tokenString ());
- break;
- }
-
- }
-
- if (!has_ident)
- Error (NO_IDENT_MSG, NULL);
+ int has_ident = FALSE;
+ int token;
+
+ parsePrologue(XF86ConfVendorPtr, XF86ConfVendorRec)
+
+ while ((token = xf86getToken(VendorTab)) != ENDSECTION) {
+ switch (token) {
+ case COMMENT:
+ ptr->vnd_comment = xf86addComment(ptr->vnd_comment, val.str);
+ break;
+ case IDENTIFIER:
+ if (xf86getSubToken(&(ptr->vnd_comment)) != STRING)
+ Error(QUOTE_MSG, "Identifier");
+ if (has_ident == TRUE)
+ Error(MULTIPLE_MSG, "Identifier");
+ ptr->vnd_identifier = val.str;
+ has_ident = TRUE;
+ break;
+ case OPTION:
+ ptr->vnd_option_lst = xf86parseOption(ptr->vnd_option_lst);
+ break;
+ case SUBSECTION:
+ if (xf86getSubToken(&(ptr->vnd_comment)) != STRING)
+ Error(QUOTE_MSG, "SubSection");
+ {
+ HANDLE_LIST(vnd_sub_lst, xf86parseVendorSubSection,
+ XF86ConfVendSubPtr);
+ }
+ break;
+ case EOF_TOKEN:
+ Error(UNEXPECTED_EOF_MSG);
+ break;
+ default:
+ Error(INVALID_KEYWORD_MSG, xf86tokenString());
+ break;
+ }
+
+ }
+
+ if (!has_ident)
+ Error(NO_IDENT_MSG);
#ifdef DEBUG
- printf ("Vendor section parsed\n");
+ printf("Vendor section parsed\n");
#endif
- return ptr;
+ return ptr;
}
#undef CLEANUP
void
-xf86printVendorSection (FILE * cf, XF86ConfVendorPtr ptr)
+xf86printVendorSection(FILE * cf, XF86ConfVendorPtr ptr)
{
- XF86ConfVendSubPtr pptr;
-
- while (ptr)
- {
- fprintf (cf, "Section \"Vendor\"\n");
- if (ptr->vnd_comment)
- fprintf (cf, "%s", ptr->vnd_comment);
- if (ptr->vnd_identifier)
- fprintf (cf, "\tIdentifier \"%s\"\n", ptr->vnd_identifier);
-
- xf86printOptionList(cf, ptr->vnd_option_lst, 1);
- for (pptr = ptr->vnd_sub_lst; pptr; pptr = pptr->list.next)
- {
- fprintf (cf, "\tSubSection \"Vendor\"\n");
- if (pptr->vs_comment)
- fprintf (cf, "%s", pptr->vs_comment);
- if (pptr->vs_identifier)
- fprintf (cf, "\t\tIdentifier \"%s\"\n", pptr->vs_identifier);
- xf86printOptionList(cf, pptr->vs_option_lst, 2);
- fprintf (cf, "\tEndSubSection\n");
- }
- fprintf (cf, "EndSection\n\n");
- ptr = ptr->list.next;
- }
+ XF86ConfVendSubPtr pptr;
+
+ while (ptr) {
+ fprintf(cf, "Section \"Vendor\"\n");
+ if (ptr->vnd_comment)
+ fprintf(cf, "%s", ptr->vnd_comment);
+ if (ptr->vnd_identifier)
+ fprintf(cf, "\tIdentifier \"%s\"\n", ptr->vnd_identifier);
+
+ xf86printOptionList(cf, ptr->vnd_option_lst, 1);
+ for (pptr = ptr->vnd_sub_lst; pptr; pptr = pptr->list.next) {
+ fprintf(cf, "\tSubSection \"Vendor\"\n");
+ if (pptr->vs_comment)
+ fprintf(cf, "%s", pptr->vs_comment);
+ if (pptr->vs_identifier)
+ fprintf(cf, "\t\tIdentifier \"%s\"\n", pptr->vs_identifier);
+ xf86printOptionList(cf, pptr->vs_option_lst, 2);
+ fprintf(cf, "\tEndSubSection\n");
+ }
+ fprintf(cf, "EndSection\n\n");
+ ptr = ptr->list.next;
+ }
}
void
-xf86freeVendorList (XF86ConfVendorPtr p)
+xf86freeVendorList(XF86ConfVendorPtr p)
{
- if (p == NULL)
- return;
- xf86freeVendorSubList (p->vnd_sub_lst);
- TestFree (p->vnd_identifier);
- TestFree (p->vnd_comment);
- xf86optionListFree (p->vnd_option_lst);
- free (p);
+ if (p == NULL)
+ return;
+ xf86freeVendorSubList(p->vnd_sub_lst);
+ TestFree(p->vnd_identifier);
+ TestFree(p->vnd_comment);
+ xf86optionListFree(p->vnd_option_lst);
+ free(p);
}
void
-xf86freeVendorSubList (XF86ConfVendSubPtr ptr)
+xf86freeVendorSubList(XF86ConfVendSubPtr ptr)
{
- XF86ConfVendSubPtr prev;
-
- while (ptr)
- {
- TestFree (ptr->vs_identifier);
- TestFree (ptr->vs_name);
- TestFree (ptr->vs_comment);
- xf86optionListFree (ptr->vs_option_lst);
- prev = ptr;
- ptr = ptr->list.next;
- free (prev);
- }
+ XF86ConfVendSubPtr prev;
+
+ while (ptr) {
+ TestFree(ptr->vs_identifier);
+ TestFree(ptr->vs_name);
+ TestFree(ptr->vs_comment);
+ xf86optionListFree(ptr->vs_option_lst);
+ prev = ptr;
+ ptr = ptr->list.next;
+ free(prev);
+ }
}
diff --git a/xserver/hw/xfree86/parser/Video.c b/xserver/hw/xfree86/parser/Video.c
index 377438749..fc1f1e544 100644
--- a/xserver/hw/xfree86/parser/Video.c
+++ b/xserver/hw/xfree86/parser/Video.c
@@ -64,233 +64,223 @@
extern LexRec val;
-static xf86ConfigSymTabRec VideoPortTab[] =
-{
- {ENDSUBSECTION, "endsubsection"},
- {IDENTIFIER, "identifier"},
- {OPTION, "option"},
- {-1, ""},
+static xf86ConfigSymTabRec VideoPortTab[] = {
+ {ENDSUBSECTION, "endsubsection"},
+ {IDENTIFIER, "identifier"},
+ {OPTION, "option"},
+ {-1, ""},
};
#define CLEANUP xf86freeVideoPortList
static void
-xf86freeVideoPortList (XF86ConfVideoPortPtr ptr)
+xf86freeVideoPortList(XF86ConfVideoPortPtr ptr)
{
- XF86ConfVideoPortPtr prev;
+ XF86ConfVideoPortPtr prev;
- while (ptr)
- {
- TestFree (ptr->vp_identifier);
- TestFree (ptr->vp_comment);
- xf86optionListFree (ptr->vp_option_lst);
- prev = ptr;
- ptr = ptr->list.next;
- free (prev);
- }
+ while (ptr) {
+ TestFree(ptr->vp_identifier);
+ TestFree(ptr->vp_comment);
+ xf86optionListFree(ptr->vp_option_lst);
+ prev = ptr;
+ ptr = ptr->list.next;
+ free(prev);
+ }
}
static XF86ConfVideoPortPtr
-xf86parseVideoPortSubSection (void)
+xf86parseVideoPortSubSection(void)
{
- int has_ident = FALSE;
- int token;
- parsePrologue (XF86ConfVideoPortPtr, XF86ConfVideoPortRec)
+ int has_ident = FALSE;
+ int token;
+
+ parsePrologue(XF86ConfVideoPortPtr, XF86ConfVideoPortRec)
- while ((token = xf86getToken (VideoPortTab)) != ENDSUBSECTION)
- {
- switch (token)
- {
- case COMMENT:
- ptr->vp_comment = xf86addComment(ptr->vp_comment, val.str);
- break;
- case IDENTIFIER:
- if (xf86getSubToken (&(ptr->vp_comment)) != STRING)
- Error (QUOTE_MSG, "Identifier");
- if (has_ident == TRUE)
- Error (MULTIPLE_MSG, "Identifier");
- ptr->vp_identifier = val.str;
- has_ident = TRUE;
- break;
- case OPTION:
- ptr->vp_option_lst = xf86parseOption(ptr->vp_option_lst);
- break;
+ while ((token = xf86getToken(VideoPortTab)) != ENDSUBSECTION) {
+ switch (token) {
+ case COMMENT:
+ ptr->vp_comment = xf86addComment(ptr->vp_comment, val.str);
+ break;
+ case IDENTIFIER:
+ if (xf86getSubToken(&(ptr->vp_comment)) != STRING)
+ Error(QUOTE_MSG, "Identifier");
+ if (has_ident == TRUE)
+ Error(MULTIPLE_MSG, "Identifier");
+ ptr->vp_identifier = val.str;
+ has_ident = TRUE;
+ break;
+ case OPTION:
+ ptr->vp_option_lst = xf86parseOption(ptr->vp_option_lst);
+ break;
- case EOF_TOKEN:
- Error (UNEXPECTED_EOF_MSG, NULL);
- break;
- default:
- Error (INVALID_KEYWORD_MSG, xf86tokenString ());
- break;
- }
- }
+ case EOF_TOKEN:
+ Error(UNEXPECTED_EOF_MSG);
+ break;
+ default:
+ Error(INVALID_KEYWORD_MSG, xf86tokenString());
+ break;
+ }
+ }
#ifdef DEBUG
- printf ("VideoPort subsection parsed\n");
+ printf("VideoPort subsection parsed\n");
#endif
- return ptr;
+ return ptr;
}
#undef CLEANUP
-static xf86ConfigSymTabRec VideoAdaptorTab[] =
-{
- {ENDSECTION, "endsection"},
- {IDENTIFIER, "identifier"},
- {VENDOR, "vendorname"},
- {BOARD, "boardname"},
- {BUSID, "busid"},
- {DRIVER, "driver"},
- {OPTION, "option"},
- {SUBSECTION, "subsection"},
- {-1, ""},
+static xf86ConfigSymTabRec VideoAdaptorTab[] = {
+ {ENDSECTION, "endsection"},
+ {IDENTIFIER, "identifier"},
+ {VENDOR, "vendorname"},
+ {BOARD, "boardname"},
+ {BUSID, "busid"},
+ {DRIVER, "driver"},
+ {OPTION, "option"},
+ {SUBSECTION, "subsection"},
+ {-1, ""},
};
#define CLEANUP xf86freeVideoAdaptorList
XF86ConfVideoAdaptorPtr
-xf86parseVideoAdaptorSection (void)
+xf86parseVideoAdaptorSection(void)
{
- int has_ident = FALSE;
- int token;
+ int has_ident = FALSE;
+ int token;
- parsePrologue (XF86ConfVideoAdaptorPtr, XF86ConfVideoAdaptorRec)
+ parsePrologue(XF86ConfVideoAdaptorPtr, XF86ConfVideoAdaptorRec)
- while ((token = xf86getToken (VideoAdaptorTab)) != ENDSECTION)
- {
- switch (token)
- {
- case COMMENT:
- ptr->va_comment = xf86addComment(ptr->va_comment, val.str);
- break;
- case IDENTIFIER:
- if (xf86getSubToken (&(ptr->va_comment)) != STRING)
- Error (QUOTE_MSG, "Identifier");
- ptr->va_identifier = val.str;
- if (has_ident == TRUE)
- Error (MULTIPLE_MSG, "Identifier");
- has_ident = TRUE;
- break;
- case VENDOR:
- if (xf86getSubToken (&(ptr->va_comment)) != STRING)
- Error (QUOTE_MSG, "Vendor");
- ptr->va_vendor = val.str;
- break;
- case BOARD:
- if (xf86getSubToken (&(ptr->va_comment)) != STRING)
- Error (QUOTE_MSG, "Board");
- ptr->va_board = val.str;
- break;
- case BUSID:
- if (xf86getSubToken (&(ptr->va_comment)) != STRING)
- Error (QUOTE_MSG, "BusID");
- ptr->va_busid = val.str;
- break;
- case DRIVER:
- if (xf86getSubToken (&(ptr->va_comment)) != STRING)
- Error (QUOTE_MSG, "Driver");
- ptr->va_driver = val.str;
- break;
- case OPTION:
- ptr->va_option_lst = xf86parseOption(ptr->va_option_lst);
- break;
- case SUBSECTION:
- if (xf86getSubToken (&(ptr->va_comment)) != STRING)
- Error (QUOTE_MSG, "SubSection");
- {
- HANDLE_LIST (va_port_lst, xf86parseVideoPortSubSection,
- XF86ConfVideoPortPtr);
- }
- break;
+ while ((token = xf86getToken(VideoAdaptorTab)) != ENDSECTION) {
+ switch (token) {
+ case COMMENT:
+ ptr->va_comment = xf86addComment(ptr->va_comment, val.str);
+ break;
+ case IDENTIFIER:
+ if (xf86getSubToken(&(ptr->va_comment)) != STRING)
+ Error(QUOTE_MSG, "Identifier");
+ ptr->va_identifier = val.str;
+ if (has_ident == TRUE)
+ Error(MULTIPLE_MSG, "Identifier");
+ has_ident = TRUE;
+ break;
+ case VENDOR:
+ if (xf86getSubToken(&(ptr->va_comment)) != STRING)
+ Error(QUOTE_MSG, "Vendor");
+ ptr->va_vendor = val.str;
+ break;
+ case BOARD:
+ if (xf86getSubToken(&(ptr->va_comment)) != STRING)
+ Error(QUOTE_MSG, "Board");
+ ptr->va_board = val.str;
+ break;
+ case BUSID:
+ if (xf86getSubToken(&(ptr->va_comment)) != STRING)
+ Error(QUOTE_MSG, "BusID");
+ ptr->va_busid = val.str;
+ break;
+ case DRIVER:
+ if (xf86getSubToken(&(ptr->va_comment)) != STRING)
+ Error(QUOTE_MSG, "Driver");
+ ptr->va_driver = val.str;
+ break;
+ case OPTION:
+ ptr->va_option_lst = xf86parseOption(ptr->va_option_lst);
+ break;
+ case SUBSECTION:
+ if (xf86getSubToken(&(ptr->va_comment)) != STRING)
+ Error(QUOTE_MSG, "SubSection");
+ {
+ HANDLE_LIST(va_port_lst, xf86parseVideoPortSubSection,
+ XF86ConfVideoPortPtr);
+ }
+ break;
- case EOF_TOKEN:
- Error (UNEXPECTED_EOF_MSG, NULL);
- break;
- default:
- Error (INVALID_KEYWORD_MSG, xf86tokenString ());
- break;
- }
- }
+ case EOF_TOKEN:
+ Error(UNEXPECTED_EOF_MSG);
+ break;
+ default:
+ Error(INVALID_KEYWORD_MSG, xf86tokenString());
+ break;
+ }
+ }
- if (!has_ident)
- Error (NO_IDENT_MSG, NULL);
+ if (!has_ident)
+ Error(NO_IDENT_MSG);
#ifdef DEBUG
- printf ("VideoAdaptor section parsed\n");
+ printf("VideoAdaptor section parsed\n");
#endif
- return ptr;
+ return ptr;
}
void
-xf86printVideoAdaptorSection (FILE * cf, XF86ConfVideoAdaptorPtr ptr)
+xf86printVideoAdaptorSection(FILE * cf, XF86ConfVideoAdaptorPtr ptr)
{
- XF86ConfVideoPortPtr pptr;
+ XF86ConfVideoPortPtr pptr;
- while (ptr)
- {
- fprintf (cf, "Section \"VideoAdaptor\"\n");
- if (ptr->va_comment)
- fprintf (cf, "%s", ptr->va_comment);
- if (ptr->va_identifier)
- fprintf (cf, "\tIdentifier \"%s\"\n", ptr->va_identifier);
- if (ptr->va_vendor)
- fprintf (cf, "\tVendorName \"%s\"\n", ptr->va_vendor);
- if (ptr->va_board)
- fprintf (cf, "\tBoardName \"%s\"\n", ptr->va_board);
- if (ptr->va_busid)
- fprintf (cf, "\tBusID \"%s\"\n", ptr->va_busid);
- if (ptr->va_driver)
- fprintf (cf, "\tDriver \"%s\"\n", ptr->va_driver);
- xf86printOptionList(cf, ptr->va_option_lst, 1);
- for (pptr = ptr->va_port_lst; pptr; pptr = pptr->list.next)
- {
- fprintf (cf, "\tSubSection \"VideoPort\"\n");
- if (pptr->vp_comment)
- fprintf (cf, "%s", pptr->vp_comment);
- if (pptr->vp_identifier)
- fprintf (cf, "\t\tIdentifier \"%s\"\n", pptr->vp_identifier);
- xf86printOptionList(cf, pptr->vp_option_lst, 2);
- fprintf (cf, "\tEndSubSection\n");
- }
- fprintf (cf, "EndSection\n\n");
- ptr = ptr->list.next;
- }
+ while (ptr) {
+ fprintf(cf, "Section \"VideoAdaptor\"\n");
+ if (ptr->va_comment)
+ fprintf(cf, "%s", ptr->va_comment);
+ if (ptr->va_identifier)
+ fprintf(cf, "\tIdentifier \"%s\"\n", ptr->va_identifier);
+ if (ptr->va_vendor)
+ fprintf(cf, "\tVendorName \"%s\"\n", ptr->va_vendor);
+ if (ptr->va_board)
+ fprintf(cf, "\tBoardName \"%s\"\n", ptr->va_board);
+ if (ptr->va_busid)
+ fprintf(cf, "\tBusID \"%s\"\n", ptr->va_busid);
+ if (ptr->va_driver)
+ fprintf(cf, "\tDriver \"%s\"\n", ptr->va_driver);
+ xf86printOptionList(cf, ptr->va_option_lst, 1);
+ for (pptr = ptr->va_port_lst; pptr; pptr = pptr->list.next) {
+ fprintf(cf, "\tSubSection \"VideoPort\"\n");
+ if (pptr->vp_comment)
+ fprintf(cf, "%s", pptr->vp_comment);
+ if (pptr->vp_identifier)
+ fprintf(cf, "\t\tIdentifier \"%s\"\n", pptr->vp_identifier);
+ xf86printOptionList(cf, pptr->vp_option_lst, 2);
+ fprintf(cf, "\tEndSubSection\n");
+ }
+ fprintf(cf, "EndSection\n\n");
+ ptr = ptr->list.next;
+ }
}
void
-xf86freeVideoAdaptorList (XF86ConfVideoAdaptorPtr ptr)
+xf86freeVideoAdaptorList(XF86ConfVideoAdaptorPtr ptr)
{
- XF86ConfVideoAdaptorPtr prev;
+ XF86ConfVideoAdaptorPtr prev;
- while (ptr)
- {
- TestFree (ptr->va_identifier);
- TestFree (ptr->va_vendor);
- TestFree (ptr->va_board);
- TestFree (ptr->va_busid);
- TestFree (ptr->va_driver);
- TestFree (ptr->va_fwdref);
- TestFree (ptr->va_comment);
- xf86freeVideoPortList (ptr->va_port_lst);
- xf86optionListFree (ptr->va_option_lst);
- prev = ptr;
- ptr = ptr->list.next;
- free (prev);
- }
+ while (ptr) {
+ TestFree(ptr->va_identifier);
+ TestFree(ptr->va_vendor);
+ TestFree(ptr->va_board);
+ TestFree(ptr->va_busid);
+ TestFree(ptr->va_driver);
+ TestFree(ptr->va_fwdref);
+ TestFree(ptr->va_comment);
+ xf86freeVideoPortList(ptr->va_port_lst);
+ xf86optionListFree(ptr->va_option_lst);
+ prev = ptr;
+ ptr = ptr->list.next;
+ free(prev);
+ }
}
XF86ConfVideoAdaptorPtr
-xf86findVideoAdaptor (const char *ident, XF86ConfVideoAdaptorPtr p)
+xf86findVideoAdaptor(const char *ident, XF86ConfVideoAdaptorPtr p)
{
- while (p)
- {
- if (xf86nameCompare (ident, p->va_identifier) == 0)
- return p;
+ while (p) {
+ if (xf86nameCompare(ident, p->va_identifier) == 0)
+ return p;
- p = p->list.next;
- }
- return NULL;
+ p = p->list.next;
+ }
+ return NULL;
}
diff --git a/xserver/hw/xfree86/parser/configProcs.h b/xserver/hw/xfree86/parser/configProcs.h
index 7d8a8e53a..1250f3922 100644
--- a/xserver/hw/xfree86/parser/configProcs.h
+++ b/xserver/hw/xfree86/parser/configProcs.h
@@ -32,82 +32,110 @@
/* Device.c */
XF86ConfDevicePtr xf86parseDeviceSection(void);
-void xf86printDeviceSection(FILE *cf, XF86ConfDevicePtr ptr);
+void xf86printDeviceSection(FILE * cf, XF86ConfDevicePtr ptr);
void xf86freeDeviceList(XF86ConfDevicePtr ptr);
int xf86validateDevice(XF86ConfigPtr p);
+
/* Files.c */
XF86ConfFilesPtr xf86parseFilesSection(void);
-void xf86printFileSection(FILE *cf, XF86ConfFilesPtr ptr);
+void xf86printFileSection(FILE * cf, XF86ConfFilesPtr ptr);
void xf86freeFiles(XF86ConfFilesPtr p);
+
/* Flags.c */
XF86ConfFlagsPtr xf86parseFlagsSection(void);
-void xf86printServerFlagsSection(FILE *f, XF86ConfFlagsPtr flags);
+void xf86printServerFlagsSection(FILE * f, XF86ConfFlagsPtr flags);
void xf86freeFlags(XF86ConfFlagsPtr flags);
+
/* Input.c */
XF86ConfInputPtr xf86parseInputSection(void);
-void xf86printInputSection(FILE *f, XF86ConfInputPtr ptr);
+void xf86printInputSection(FILE * f, XF86ConfInputPtr ptr);
void xf86freeInputList(XF86ConfInputPtr ptr);
-int xf86validateInput (XF86ConfigPtr p);
+int xf86validateInput(XF86ConfigPtr p);
+
/* InputClass.c */
XF86ConfInputClassPtr xf86parseInputClassSection(void);
-void xf86printInputClassSection(FILE *f, XF86ConfInputClassPtr ptr);
+void xf86printInputClassSection(FILE * f, XF86ConfInputClassPtr ptr);
void xf86freeInputClassList(XF86ConfInputClassPtr ptr);
+
/* Layout.c */
XF86ConfLayoutPtr xf86parseLayoutSection(void);
-void xf86printLayoutSection(FILE *cf, XF86ConfLayoutPtr ptr);
+void xf86printLayoutSection(FILE * cf, XF86ConfLayoutPtr ptr);
void xf86freeLayoutList(XF86ConfLayoutPtr ptr);
int xf86validateLayout(XF86ConfigPtr p);
+
/* Module.c */
XF86ConfModulePtr xf86parseModuleSection(void);
-void xf86printModuleSection(FILE *cf, XF86ConfModulePtr ptr);
-extern _X_EXPORT XF86LoadPtr xf86addNewLoadDirective(XF86LoadPtr head, char *name, int type, XF86OptionPtr opts);
+void xf86printModuleSection(FILE * cf, XF86ConfModulePtr ptr);
+extern _X_EXPORT XF86LoadPtr xf86addNewLoadDirective(XF86LoadPtr head,
+ char *name, int type,
+ XF86OptionPtr opts);
void xf86freeModules(XF86ConfModulePtr ptr);
+
/* Monitor.c */
XF86ConfMonitorPtr xf86parseMonitorSection(void);
XF86ConfModesPtr xf86parseModesSection(void);
-void xf86printMonitorSection(FILE *cf, XF86ConfMonitorPtr ptr);
-void xf86printModesSection(FILE *cf, XF86ConfModesPtr ptr);
+void xf86printMonitorSection(FILE * cf, XF86ConfMonitorPtr ptr);
+void xf86printModesSection(FILE * cf, XF86ConfModesPtr ptr);
extern _X_EXPORT void xf86freeMonitorList(XF86ConfMonitorPtr ptr);
void xf86freeModesList(XF86ConfModesPtr ptr);
int xf86validateMonitor(XF86ConfigPtr p, XF86ConfScreenPtr screen);
+
/* Pointer.c */
XF86ConfInputPtr xf86parsePointerSection(void);
+
/* Screen.c */
XF86ConfScreenPtr xf86parseScreenSection(void);
-void xf86printScreenSection(FILE *cf, XF86ConfScreenPtr ptr);
+void xf86printScreenSection(FILE * cf, XF86ConfScreenPtr ptr);
extern _X_EXPORT void xf86freeScreenList(XF86ConfScreenPtr ptr);
void xf86freeAdaptorLinkList(XF86ConfAdaptorLinkPtr ptr);
void xf86freeDisplayList(XF86ConfDisplayPtr ptr);
void xf86freeModeList(XF86ModePtr ptr);
int xf86validateScreen(XF86ConfigPtr p);
+
/* Vendor.c */
XF86ConfVendorPtr xf86parseVendorSection(void);
void xf86freeVendorList(XF86ConfVendorPtr p);
void xf86printVendorSection(FILE * cf, XF86ConfVendorPtr ptr);
-void xf86freeVendorSubList (XF86ConfVendSubPtr ptr);
+void xf86freeVendorSubList(XF86ConfVendSubPtr ptr);
+
/* Video.c */
XF86ConfVideoAdaptorPtr xf86parseVideoAdaptorSection(void);
-void xf86printVideoAdaptorSection(FILE *cf, XF86ConfVideoAdaptorPtr ptr);
+void xf86printVideoAdaptorSection(FILE * cf, XF86ConfVideoAdaptorPtr ptr);
void xf86freeVideoAdaptorList(XF86ConfVideoAdaptorPtr ptr);
+
/* scan.c */
-int xf86getToken(xf86ConfigSymTabRec *tab);
+int xf86getToken(xf86ConfigSymTabRec * tab);
int xf86getSubToken(char **comment);
-int xf86getSubTokenWithTab(char **comment, xf86ConfigSymTabRec *tab);
+int xf86getSubTokenWithTab(char **comment, xf86ConfigSymTabRec * tab);
void xf86unGetToken(int token);
char *xf86tokenString(void);
-void xf86parseError(char *format, ...);
-void xf86validationError(char *format, ...);
-void xf86setSection(char *section);
-int xf86getStringToken(xf86ConfigSymTabRec *tab);
+void
+xf86parseError(const char *format, ...)
+_X_ATTRIBUTE_PRINTF(1, 2);
+void
+xf86validationError(const char *format, ...)
+_X_ATTRIBUTE_PRINTF(1, 2);
+void
+xf86setSection(const char *section);
+int
+xf86getStringToken(xf86ConfigSymTabRec * tab);
+
/* write.c */
/* DRI.c */
-XF86ConfDRIPtr xf86parseDRISection (void);
-void xf86printDRISection (FILE * cf, XF86ConfDRIPtr ptr);
-void xf86freeDRI (XF86ConfDRIPtr ptr);
+XF86ConfDRIPtr
+xf86parseDRISection(void);
+void
+xf86printDRISection(FILE * cf, XF86ConfDRIPtr ptr);
+void
+xf86freeDRI(XF86ConfDRIPtr ptr);
+
/* Extensions.c */
-XF86ConfExtensionsPtr xf86parseExtensionsSection (void);
-void xf86printExtensionsSection (FILE * cf, XF86ConfExtensionsPtr ptr);
-void xf86freeExtensions (XF86ConfExtensionsPtr ptr);
+XF86ConfExtensionsPtr
+xf86parseExtensionsSection(void);
+void
+xf86printExtensionsSection(FILE * cf, XF86ConfExtensionsPtr ptr);
+void
+xf86freeExtensions(XF86ConfExtensionsPtr ptr);
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
@@ -115,6 +143,8 @@ void xf86freeExtensions (XF86ConfExtensionsPtr ptr);
#ifndef IN_XSERVER
/* Externally provided functions */
-void ErrorF(const char *f, ...);
-void VErrorF(const char *f, va_list args);
+void
+ErrorF(const char *f, ...);
+void
+VErrorF(const char *f, va_list args);
#endif
diff --git a/xserver/hw/xfree86/parser/read.c b/xserver/hw/xfree86/parser/read.c
index d4d525218..eef873e89 100644
--- a/xserver/hw/xfree86/parser/read.c
+++ b/xserver/hw/xfree86/parser/read.c
@@ -52,7 +52,6 @@
* authorization from the copyright holder(s) and author(s).
*/
-
/* View/edit this file with tab stops set to 4 */
#ifdef HAVE_XORG_CONFIG_H
@@ -65,10 +64,9 @@
extern LexRec val;
-static xf86ConfigSymTabRec TopLevelTab[] =
-{
- {SECTION, "section"},
- {-1, ""},
+static xf86ConfigSymTabRec TopLevelTab[] = {
+ {SECTION, "section"},
+ {-1, ""},
};
#define CLEANUP xf86freeConfig
@@ -78,166 +76,144 @@ static xf86ConfigSymTabRec TopLevelTab[] =
* objects cannot be found.
*/
static int
-xf86validateConfig (XF86ConfigPtr p)
+xf86validateConfig(XF86ConfigPtr p)
{
- if (!xf86validateScreen (p))
- return FALSE;
- if (!xf86validateInput (p))
- return FALSE;
- if (!xf86validateLayout (p))
- return FALSE;
+ if (!xf86validateScreen(p))
+ return FALSE;
+ if (!xf86validateInput(p))
+ return FALSE;
+ if (!xf86validateLayout(p))
+ return FALSE;
- return TRUE;
+ return TRUE;
}
XF86ConfigPtr
-xf86readConfigFile (void)
+xf86readConfigFile(void)
{
- int token;
- XF86ConfigPtr ptr = NULL;
+ int token;
+ XF86ConfigPtr ptr = NULL;
- if ((ptr = calloc (1, sizeof (XF86ConfigRec))) == NULL)
- {
- return NULL;
- }
+ if ((ptr = calloc(1, sizeof(XF86ConfigRec))) == NULL) {
+ return NULL;
+ }
- while ((token = xf86getToken (TopLevelTab)) != EOF_TOKEN)
- {
- switch (token)
- {
- case COMMENT:
- ptr->conf_comment = xf86addComment(ptr->conf_comment, val.str);
- break;
- case SECTION:
- if (xf86getSubToken (&(ptr->conf_comment)) != STRING)
- {
- xf86parseError (QUOTE_MSG, "Section");
- CLEANUP (ptr);
- return NULL;
- }
- xf86setSection (val.str);
- if (xf86nameCompare (val.str, "files") == 0)
- {
- free(val.str);
- val.str = NULL;
- HANDLE_RETURN (conf_files, xf86parseFilesSection ());
- }
- else if (xf86nameCompare (val.str, "serverflags") == 0)
- {
- free(val.str);
- val.str = NULL;
- HANDLE_RETURN (conf_flags, xf86parseFlagsSection ());
- }
- else if (xf86nameCompare (val.str, "pointer") == 0)
- {
- free(val.str);
- val.str = NULL;
- HANDLE_LIST (conf_input_lst, xf86parsePointerSection,
- XF86ConfInputPtr);
- }
- else if (xf86nameCompare (val.str, "videoadaptor") == 0)
- {
- free(val.str);
- val.str = NULL;
- HANDLE_LIST (conf_videoadaptor_lst, xf86parseVideoAdaptorSection,
- XF86ConfVideoAdaptorPtr);
- }
- else if (xf86nameCompare (val.str, "device") == 0)
- {
- free(val.str);
- val.str = NULL;
- HANDLE_LIST (conf_device_lst, xf86parseDeviceSection,
- XF86ConfDevicePtr);
- }
- else if (xf86nameCompare (val.str, "monitor") == 0)
- {
- free(val.str);
- val.str = NULL;
- HANDLE_LIST (conf_monitor_lst, xf86parseMonitorSection,
- XF86ConfMonitorPtr);
- }
- else if (xf86nameCompare (val.str, "modes") == 0)
- {
- free(val.str);
- val.str = NULL;
- HANDLE_LIST (conf_modes_lst, xf86parseModesSection,
- XF86ConfModesPtr);
- }
- else if (xf86nameCompare (val.str, "screen") == 0)
- {
- free(val.str);
- val.str = NULL;
- HANDLE_LIST (conf_screen_lst, xf86parseScreenSection,
- XF86ConfScreenPtr);
- }
- else if (xf86nameCompare(val.str, "inputdevice") == 0)
- {
- free(val.str);
- val.str = NULL;
- HANDLE_LIST (conf_input_lst, xf86parseInputSection,
- XF86ConfInputPtr);
- }
- else if (xf86nameCompare(val.str, "inputclass") == 0)
- {
- free(val.str);
- val.str = NULL;
- HANDLE_LIST (conf_inputclass_lst,
- xf86parseInputClassSection,
- XF86ConfInputClassPtr);
- }
- else if (xf86nameCompare (val.str, "module") == 0)
- {
- free(val.str);
- val.str = NULL;
- HANDLE_RETURN (conf_modules, xf86parseModuleSection ());
- }
- else if (xf86nameCompare (val.str, "serverlayout") == 0)
- {
- free(val.str);
- val.str = NULL;
- HANDLE_LIST (conf_layout_lst, xf86parseLayoutSection,
- XF86ConfLayoutPtr);
- }
- else if (xf86nameCompare (val.str, "vendor") == 0)
- {
- free(val.str);
- val.str = NULL;
- HANDLE_LIST (conf_vendor_lst, xf86parseVendorSection,
- XF86ConfVendorPtr);
- }
- else if (xf86nameCompare (val.str, "dri") == 0)
- {
- free(val.str);
- val.str = NULL;
- HANDLE_RETURN (conf_dri, xf86parseDRISection ());
- }
- else if (xf86nameCompare (val.str, "extensions") == 0)
- {
- free(val.str);
- val.str = NULL;
- HANDLE_RETURN (conf_extensions, xf86parseExtensionsSection ());
- }
- else
- {
- free(val.str);
- val.str = NULL;
- Error (INVALID_SECTION_MSG, xf86tokenString ());
- }
- break;
- default:
- free(val.str);
- val.str = NULL;
- Error (INVALID_KEYWORD_MSG, xf86tokenString ());
- }
- }
+ while ((token = xf86getToken(TopLevelTab)) != EOF_TOKEN) {
+ switch (token) {
+ case COMMENT:
+ ptr->conf_comment = xf86addComment(ptr->conf_comment, val.str);
+ break;
+ case SECTION:
+ if (xf86getSubToken(&(ptr->conf_comment)) != STRING) {
+ xf86parseError(QUOTE_MSG, "Section");
+ CLEANUP(ptr);
+ return NULL;
+ }
+ xf86setSection(val.str);
+ if (xf86nameCompare(val.str, "files") == 0) {
+ free(val.str);
+ val.str = NULL;
+ HANDLE_RETURN(conf_files, xf86parseFilesSection());
+ }
+ else if (xf86nameCompare(val.str, "serverflags") == 0) {
+ free(val.str);
+ val.str = NULL;
+ HANDLE_RETURN(conf_flags, xf86parseFlagsSection());
+ }
+ else if (xf86nameCompare(val.str, "pointer") == 0) {
+ free(val.str);
+ val.str = NULL;
+ HANDLE_LIST(conf_input_lst, xf86parsePointerSection,
+ XF86ConfInputPtr);
+ }
+ else if (xf86nameCompare(val.str, "videoadaptor") == 0) {
+ free(val.str);
+ val.str = NULL;
+ HANDLE_LIST(conf_videoadaptor_lst, xf86parseVideoAdaptorSection,
+ XF86ConfVideoAdaptorPtr);
+ }
+ else if (xf86nameCompare(val.str, "device") == 0) {
+ free(val.str);
+ val.str = NULL;
+ HANDLE_LIST(conf_device_lst, xf86parseDeviceSection,
+ XF86ConfDevicePtr);
+ }
+ else if (xf86nameCompare(val.str, "monitor") == 0) {
+ free(val.str);
+ val.str = NULL;
+ HANDLE_LIST(conf_monitor_lst, xf86parseMonitorSection,
+ XF86ConfMonitorPtr);
+ }
+ else if (xf86nameCompare(val.str, "modes") == 0) {
+ free(val.str);
+ val.str = NULL;
+ HANDLE_LIST(conf_modes_lst, xf86parseModesSection,
+ XF86ConfModesPtr);
+ }
+ else if (xf86nameCompare(val.str, "screen") == 0) {
+ free(val.str);
+ val.str = NULL;
+ HANDLE_LIST(conf_screen_lst, xf86parseScreenSection,
+ XF86ConfScreenPtr);
+ }
+ else if (xf86nameCompare(val.str, "inputdevice") == 0) {
+ free(val.str);
+ val.str = NULL;
+ HANDLE_LIST(conf_input_lst, xf86parseInputSection,
+ XF86ConfInputPtr);
+ }
+ else if (xf86nameCompare(val.str, "inputclass") == 0) {
+ free(val.str);
+ val.str = NULL;
+ HANDLE_LIST(conf_inputclass_lst,
+ xf86parseInputClassSection, XF86ConfInputClassPtr);
+ }
+ else if (xf86nameCompare(val.str, "module") == 0) {
+ free(val.str);
+ val.str = NULL;
+ HANDLE_RETURN(conf_modules, xf86parseModuleSection());
+ }
+ else if (xf86nameCompare(val.str, "serverlayout") == 0) {
+ free(val.str);
+ val.str = NULL;
+ HANDLE_LIST(conf_layout_lst, xf86parseLayoutSection,
+ XF86ConfLayoutPtr);
+ }
+ else if (xf86nameCompare(val.str, "vendor") == 0) {
+ free(val.str);
+ val.str = NULL;
+ HANDLE_LIST(conf_vendor_lst, xf86parseVendorSection,
+ XF86ConfVendorPtr);
+ }
+ else if (xf86nameCompare(val.str, "dri") == 0) {
+ free(val.str);
+ val.str = NULL;
+ HANDLE_RETURN(conf_dri, xf86parseDRISection());
+ }
+ else if (xf86nameCompare(val.str, "extensions") == 0) {
+ free(val.str);
+ val.str = NULL;
+ HANDLE_RETURN(conf_extensions, xf86parseExtensionsSection());
+ }
+ else {
+ free(val.str);
+ val.str = NULL;
+ Error(INVALID_SECTION_MSG, xf86tokenString());
+ }
+ break;
+ default:
+ free(val.str);
+ val.str = NULL;
+ Error(INVALID_KEYWORD_MSG, xf86tokenString());
+ }
+ }
- if (xf86validateConfig (ptr))
- return ptr;
- else
- {
- CLEANUP (ptr);
- return NULL;
- }
+ if (xf86validateConfig(ptr))
+ return ptr;
+ else {
+ CLEANUP(ptr);
+ return NULL;
+ }
}
#undef CLEANUP
@@ -249,24 +225,22 @@ xf86readConfigFile (void)
* the first item.
*/
GenericListPtr
-xf86addListItem (GenericListPtr head, GenericListPtr new)
+xf86addListItem(GenericListPtr head, GenericListPtr new)
{
- GenericListPtr p = head;
- GenericListPtr last = NULL;
+ GenericListPtr p = head;
+ GenericListPtr last = NULL;
- while (p)
- {
- last = p;
- p = p->next;
- }
+ while (p) {
+ last = p;
+ p = p->next;
+ }
- if (last)
- {
- last->next = new;
- return head;
- }
- else
- return new;
+ if (last) {
+ last->next = new;
+ return head;
+ }
+ else
+ return new;
}
/*
@@ -276,43 +250,43 @@ xf86addListItem (GenericListPtr head, GenericListPtr new)
int
xf86itemNotSublist(GenericListPtr list_1, GenericListPtr list_2)
{
- GenericListPtr p = list_1;
- GenericListPtr last_1 = NULL, last_2 = NULL;
+ GenericListPtr p = list_1;
+ GenericListPtr last_1 = NULL, last_2 = NULL;
- while (p) {
- last_1 = p;
- p = p->next;
- }
+ while (p) {
+ last_1 = p;
+ p = p->next;
+ }
- p = list_2;
- while (p) {
- last_2 = p;
- p = p->next;
- }
+ p = list_2;
+ while (p) {
+ last_2 = p;
+ p = p->next;
+ }
- return (!(last_1 == last_2));
+ return (!(last_1 == last_2));
}
void
-xf86freeConfig (XF86ConfigPtr p)
+xf86freeConfig(XF86ConfigPtr p)
{
- if (p == NULL)
- return;
+ if (p == NULL)
+ return;
- xf86freeFiles (p->conf_files);
- xf86freeModules (p->conf_modules);
- xf86freeFlags (p->conf_flags);
- xf86freeMonitorList (p->conf_monitor_lst);
- xf86freeModesList (p->conf_modes_lst);
- xf86freeVideoAdaptorList (p->conf_videoadaptor_lst);
- xf86freeDeviceList (p->conf_device_lst);
- xf86freeScreenList (p->conf_screen_lst);
- xf86freeLayoutList (p->conf_layout_lst);
- xf86freeInputList (p->conf_input_lst);
- xf86freeVendorList (p->conf_vendor_lst);
- xf86freeDRI (p->conf_dri);
- xf86freeExtensions (p->conf_extensions);
- TestFree(p->conf_comment);
+ xf86freeFiles(p->conf_files);
+ xf86freeModules(p->conf_modules);
+ xf86freeFlags(p->conf_flags);
+ xf86freeMonitorList(p->conf_monitor_lst);
+ xf86freeModesList(p->conf_modes_lst);
+ xf86freeVideoAdaptorList(p->conf_videoadaptor_lst);
+ xf86freeDeviceList(p->conf_device_lst);
+ xf86freeScreenList(p->conf_screen_lst);
+ xf86freeLayoutList(p->conf_layout_lst);
+ xf86freeInputList(p->conf_input_lst);
+ xf86freeVendorList(p->conf_vendor_lst);
+ xf86freeDRI(p->conf_dri);
+ xf86freeExtensions(p->conf_extensions);
+ TestFree(p->conf_comment);
- free (p);
+ free(p);
}
diff --git a/xserver/hw/xfree86/parser/scan.c b/xserver/hw/xfree86/parser/scan.c
index 1cff3bc5c..795da615f 100644
--- a/xserver/hw/xfree86/parser/scan.c
+++ b/xserver/hw/xfree86/parser/scan.c
@@ -51,7 +51,6 @@
* authorization from the copyright holder(s) and author(s).
*/
-
/* View/edit this file with tab stops set to 4 */
#ifdef HAVE_XORG_CONFIG_H
@@ -75,11 +74,11 @@
#define _POSIX_SOURCE
#include <limits.h>
#undef _POSIX_SOURCE
-#endif /* _POSIX_SOURCE */
+#endif /* _POSIX_SOURCE */
#if !defined(MAXHOSTNAMELEN)
#define MAXHOSTNAMELEN 32
-#endif /* !MAXHOSTNAMELEN */
+#endif /* !MAXHOSTNAMELEN */
/* For PATH_MAX */
#include "misc.h"
@@ -90,24 +89,22 @@
#define CONFIG_BUF_LEN 1024
#define CONFIG_MAX_FILES 64
-static int StringToToken (char *, xf86ConfigSymTabRec *);
+static int StringToToken(const char *, xf86ConfigSymTabRec *);
static struct {
- FILE *file;
- char *path;
+ FILE *file;
+ char *path;
} configFiles[CONFIG_MAX_FILES];
static const char **builtinConfig = NULL;
static int builtinIndex = 0;
-static int configPos = 0; /* current readers position */
-static int configLineNo = 0; /* linenumber */
-static char *configBuf, *configRBuf; /* buffer for lines */
-static char *configPath; /* path to config file */
-static char *configDirPath; /* path to config dir */
-static char *configSection = NULL; /* name of current section being parsed */
-static int numFiles = 0; /* number of config files */
-static int curFileIndex = 0; /* index of current config file */
+static int configPos = 0; /* current readers position */
+static int configLineNo = 0; /* linenumber */
+static char *configBuf, *configRBuf; /* buffer for lines */
+static char *configSection = NULL; /* name of current section being parsed */
+static int numFiles = 0; /* number of config files */
+static int curFileIndex = 0; /* index of current config file */
static int pushToken = LOCK_TOKEN;
-static int eol_seen = 0; /* private state to handle comments */
+static int eol_seen = 0; /* private state to handle comments */
LexRec val;
/*
@@ -121,123 +118,129 @@ LexRec val;
* support that.
*/
-static char*
+static char *
xf86getNextLine(void)
{
- static int configBufLen = CONFIG_BUF_LEN;
- char *tmpConfigBuf, *tmpConfigRBuf;
- int c, i, pos = 0, eolFound = 0;
- char *ret = NULL;
+ static int configBufLen = CONFIG_BUF_LEN;
+ char *tmpConfigBuf, *tmpConfigRBuf;
+ int c, i, pos = 0, eolFound = 0;
+ char *ret = NULL;
- /*
- * reallocate the string if it was grown last time (i.e., is no
- * longer CONFIG_BUF_LEN); we malloc the new strings first, so
- * that if either of the mallocs fail, we can fall back on the
- * existing buffer allocations
- */
+ /*
+ * reallocate the string if it was grown last time (i.e., is no
+ * longer CONFIG_BUF_LEN); we malloc the new strings first, so
+ * that if either of the mallocs fail, we can fall back on the
+ * existing buffer allocations
+ */
- if (configBufLen != CONFIG_BUF_LEN) {
+ if (configBufLen != CONFIG_BUF_LEN) {
- tmpConfigBuf = malloc(CONFIG_BUF_LEN);
- tmpConfigRBuf = malloc(CONFIG_BUF_LEN);
+ tmpConfigBuf = malloc(CONFIG_BUF_LEN);
+ tmpConfigRBuf = malloc(CONFIG_BUF_LEN);
- if (!tmpConfigBuf || !tmpConfigRBuf) {
+ if (!tmpConfigBuf || !tmpConfigRBuf) {
- /*
- * at least one of the mallocs failed; keep the old buffers
- * and free any partial allocations
- */
+ /*
+ * at least one of the mallocs failed; keep the old buffers
+ * and free any partial allocations
+ */
- free(tmpConfigBuf);
- free(tmpConfigRBuf);
+ free(tmpConfigBuf);
+ free(tmpConfigRBuf);
- } else {
+ }
+ else {
- /*
- * malloc succeeded; free the old buffers and use the new
- * buffers
- */
+ /*
+ * malloc succeeded; free the old buffers and use the new
+ * buffers
+ */
- configBufLen = CONFIG_BUF_LEN;
+ configBufLen = CONFIG_BUF_LEN;
- free(configBuf);
- free(configRBuf);
+ free(configBuf);
+ free(configRBuf);
- configBuf = tmpConfigBuf;
- configRBuf = tmpConfigRBuf;
- }
- }
+ configBuf = tmpConfigBuf;
+ configRBuf = tmpConfigRBuf;
+ }
+ }
- /* read in another block of chars */
+ /* read in another block of chars */
- do {
- ret = fgets(configBuf + pos, configBufLen - pos - 1,
- configFiles[curFileIndex].file);
+ do {
+ ret = fgets(configBuf + pos, configBufLen - pos - 1,
+ configFiles[curFileIndex].file);
- if (!ret) {
- /*
- * if the file doesn't end in a newline, add one
- * and trigger another read
- */
- if (pos != 0) {
- strcpy(&configBuf[pos], "\n");
- ret = configBuf;
- } else
- break;
- }
+ if (!ret) {
+ /*
+ * if the file doesn't end in a newline, add one
+ * and trigger another read
+ */
+ if (pos != 0) {
+ strcpy(&configBuf[pos], "\n");
+ ret = configBuf;
+ }
+ else
+ break;
+ }
- /* search for EOL in the new block of chars */
+ /* search for EOL in the new block of chars */
- for (i = pos; i < (configBufLen - 1); i++) {
- c = configBuf[i];
+ for (i = pos; i < (configBufLen - 1); i++) {
+ c = configBuf[i];
- if (c == '\0') break;
+ if (c == '\0')
+ break;
- if ((c == '\n') || (c == '\r')) {
- eolFound = 1;
- break;
- }
- }
+ if ((c == '\n') || (c == '\r')) {
+ eolFound = 1;
+ break;
+ }
+ }
- /*
- * if we didn't find EOL, then grow the string and
- * read in more
- */
+ /*
+ * if we didn't find EOL, then grow the string and
+ * read in more
+ */
- if (!eolFound) {
+ if (!eolFound) {
- tmpConfigBuf = realloc(configBuf, configBufLen + CONFIG_BUF_LEN);
- tmpConfigRBuf = realloc(configRBuf, configBufLen + CONFIG_BUF_LEN);
+ tmpConfigBuf = realloc(configBuf, configBufLen + CONFIG_BUF_LEN);
+ tmpConfigRBuf = realloc(configRBuf, configBufLen + CONFIG_BUF_LEN);
- if (!tmpConfigBuf || !tmpConfigRBuf) {
+ if (!tmpConfigBuf || !tmpConfigRBuf) {
- /*
- * at least one of the reallocations failed; use the
- * new allocation that succeeded, but we have to
- * fallback to the previous configBufLen size and use
- * the string we have, even though we don't have an
- * EOL
- */
+ /*
+ * at least one of the reallocations failed; use the
+ * new allocation that succeeded, but we have to
+ * fallback to the previous configBufLen size and use
+ * the string we have, even though we don't have an
+ * EOL
+ */
- if (tmpConfigBuf) configBuf = tmpConfigBuf;
- if (tmpConfigRBuf) configRBuf = tmpConfigRBuf;
+ if (tmpConfigBuf)
+ configBuf = tmpConfigBuf;
+ if (tmpConfigRBuf)
+ configRBuf = tmpConfigRBuf;
- break;
+ break;
- } else {
+ }
+ else {
- /* reallocation succeeded */
+ /* reallocation succeeded */
- configBuf = tmpConfigBuf;
- configRBuf = tmpConfigRBuf;
- pos = i;
- configBufLen += CONFIG_BUF_LEN;
- }
- }
+ configBuf = tmpConfigBuf;
+ configRBuf = tmpConfigRBuf;
+ pos = i;
+ configBufLen += CONFIG_BUF_LEN;
+ }
+ }
- } while (!eolFound);
+ } while (!eolFound);
- return ret;
+ return ret;
}
/*
@@ -246,293 +249,278 @@ xf86getNextLine(void)
* pushToken.
*/
int
-xf86getToken (xf86ConfigSymTabRec * tab)
+xf86getToken(xf86ConfigSymTabRec * tab)
{
- int c, i;
-
- /*
- * First check whether pushToken has a different value than LOCK_TOKEN.
- * In this case rBuf[] contains a valid STRING/TOKEN/NUMBER. But in the
- * oth * case the next token must be read from the input.
- */
- if (pushToken == EOF_TOKEN)
- return EOF_TOKEN;
- else if (pushToken == LOCK_TOKEN)
- {
- /*
- * eol_seen is only set for the first token after a newline.
- */
- eol_seen = 0;
-
- c = configBuf[configPos];
-
- /*
- * Get start of next Token. EOF is handled,
- * whitespaces are skipped.
- */
-
-again:
- if (!c)
- {
- char *ret;
- if (numFiles > 0)
- ret = xf86getNextLine();
- else {
- if (builtinConfig[builtinIndex] == NULL)
- ret = NULL;
- else {
- ret = strncpy(configBuf, builtinConfig[builtinIndex],
- CONFIG_BUF_LEN);
- builtinIndex++;
- }
- }
- if (ret == NULL)
- {
- /*
- * if necessary, move to the next file and
- * read the first line
- */
- if (curFileIndex + 1 < numFiles) {
- curFileIndex++;
- configLineNo = 0;
- goto again;
- }
- else
- return pushToken = EOF_TOKEN;
- }
- configLineNo++;
- configPos = 0;
- eol_seen = 1;
- }
-
- i = 0;
- for (;;) {
- c = configBuf[configPos++];
- configRBuf[i++] = c;
- switch (c) {
- case ' ':
- case '\t':
- case '\r':
- continue;
- case '\n':
- i = 0;
- continue;
- }
- break;
- }
- if (c == '\0')
- goto again;
-
- if (c == '#')
- {
- do
- {
- configRBuf[i++] = (c = configBuf[configPos++]);
- }
- while ((c != '\n') && (c != '\r') && (c != '\0'));
- configRBuf[i] = '\0';
- /* XXX no private copy.
- * Use xf86addComment when setting a comment.
- */
- val.str = configRBuf;
- return COMMENT;
- }
-
- /* GJA -- handle '-' and ',' * Be careful: "-hsync" is a keyword. */
- else if ((c == ',') && !isalpha (configBuf[configPos]))
- {
- return COMMA;
- }
- else if ((c == '-') && !isalpha (configBuf[configPos]))
- {
- return DASH;
- }
-
- /*
- * Numbers are returned immediately ...
- */
- if (isdigit (c))
- {
- int base;
-
- if (c == '0')
- if ((configBuf[configPos] == 'x') ||
- (configBuf[configPos] == 'X'))
- {
- base = 16;
- val.numType = PARSE_HEX;
- }
- else
- {
- base = 8;
- val.numType = PARSE_OCTAL;
- }
- else
- {
- base = 10;
- val.numType = PARSE_DECIMAL;
- }
-
- configRBuf[0] = c;
- i = 1;
- while (isdigit (c = configBuf[configPos++]) ||
- (c == '.') || (c == 'x') || (c == 'X') ||
- ((base == 16) && (((c >= 'a') && (c <= 'f')) ||
- ((c >= 'A') && (c <= 'F')))))
- configRBuf[i++] = c;
- configPos--; /* GJA -- one too far */
- configRBuf[i] = '\0';
- val.num = strtoul (configRBuf, NULL, 0);
- val.realnum = atof (configRBuf);
- return NUMBER;
- }
-
- /*
- * All Strings START with a \" ...
- */
- else if (c == '\"')
- {
- i = -1;
- do
- {
- configRBuf[++i] = (c = configBuf[configPos++]);
- }
- while ((c != '\"') && (c != '\n') && (c != '\r') && (c != '\0'));
- configRBuf[i] = '\0';
- val.str = malloc (strlen (configRBuf) + 1);
- strcpy (val.str, configRBuf); /* private copy ! */
- return STRING;
- }
-
- /*
- * ... and now we MUST have a valid token. The search is
- * handled later along with the pushed tokens.
- */
- else
- {
- configRBuf[0] = c;
- i = 0;
- do
- {
- configRBuf[++i] = (c = configBuf[configPos++]);
- }
- while ((c != ' ') && (c != '\t') && (c != '\n') && (c != '\r') && (c != '\0') && (c != '#'));
- --configPos;
- configRBuf[i] = '\0';
- i = 0;
- }
-
- }
- else
- {
-
- /*
- * Here we deal with pushed tokens. Reinitialize pushToken again. If
- * the pushed token was NUMBER || STRING return them again ...
- */
- int temp = pushToken;
- pushToken = LOCK_TOKEN;
-
- if (temp == COMMA || temp == DASH)
- return temp;
- if (temp == NUMBER || temp == STRING)
- return temp;
- }
-
- /*
- * Joop, at last we have to lookup the token ...
- */
- if (tab)
- {
- i = 0;
- while (tab[i].token != -1)
- if (xf86nameCompare (configRBuf, tab[i].name) == 0)
- return tab[i].token;
- else
- i++;
- }
-
- return ERROR_TOKEN; /* Error catcher */
+ int c, i;
+
+ /*
+ * First check whether pushToken has a different value than LOCK_TOKEN.
+ * In this case rBuf[] contains a valid STRING/TOKEN/NUMBER. But in the
+ * oth * case the next token must be read from the input.
+ */
+ if (pushToken == EOF_TOKEN)
+ return EOF_TOKEN;
+ else if (pushToken == LOCK_TOKEN) {
+ /*
+ * eol_seen is only set for the first token after a newline.
+ */
+ eol_seen = 0;
+
+ c = configBuf[configPos];
+
+ /*
+ * Get start of next Token. EOF is handled,
+ * whitespaces are skipped.
+ */
+
+ again:
+ if (!c) {
+ char *ret;
+
+ if (numFiles > 0)
+ ret = xf86getNextLine();
+ else {
+ if (builtinConfig[builtinIndex] == NULL)
+ ret = NULL;
+ else {
+ strlcpy(configBuf,
+ builtinConfig[builtinIndex], CONFIG_BUF_LEN);
+ ret = configBuf;
+ builtinIndex++;
+ }
+ }
+ if (ret == NULL) {
+ /*
+ * if necessary, move to the next file and
+ * read the first line
+ */
+ if (curFileIndex + 1 < numFiles) {
+ curFileIndex++;
+ configLineNo = 0;
+ goto again;
+ }
+ else
+ return pushToken = EOF_TOKEN;
+ }
+ configLineNo++;
+ configPos = 0;
+ eol_seen = 1;
+ }
+
+ i = 0;
+ for (;;) {
+ c = configBuf[configPos++];
+ configRBuf[i++] = c;
+ switch (c) {
+ case ' ':
+ case '\t':
+ case '\r':
+ continue;
+ case '\n':
+ i = 0;
+ continue;
+ }
+ break;
+ }
+ if (c == '\0')
+ goto again;
+
+ if (c == '#') {
+ do {
+ configRBuf[i++] = (c = configBuf[configPos++]);
+ }
+ while ((c != '\n') && (c != '\r') && (c != '\0'));
+ configRBuf[i] = '\0';
+ /* XXX no private copy.
+ * Use xf86addComment when setting a comment.
+ */
+ val.str = configRBuf;
+ return COMMENT;
+ }
+
+ /* GJA -- handle '-' and ',' * Be careful: "-hsync" is a keyword. */
+ else if ((c == ',') && !isalpha(configBuf[configPos])) {
+ return COMMA;
+ }
+ else if ((c == '-') && !isalpha(configBuf[configPos])) {
+ return DASH;
+ }
+
+ /*
+ * Numbers are returned immediately ...
+ */
+ if (isdigit(c)) {
+ int base;
+
+ if (c == '0')
+ if ((configBuf[configPos] == 'x') ||
+ (configBuf[configPos] == 'X')) {
+ base = 16;
+ val.numType = PARSE_HEX;
+ }
+ else {
+ base = 8;
+ val.numType = PARSE_OCTAL;
+ }
+ else {
+ base = 10;
+ val.numType = PARSE_DECIMAL;
+ }
+
+ configRBuf[0] = c;
+ i = 1;
+ while (isdigit(c = configBuf[configPos++]) ||
+ (c == '.') || (c == 'x') || (c == 'X') ||
+ ((base == 16) && (((c >= 'a') && (c <= 'f')) ||
+ ((c >= 'A') && (c <= 'F')))))
+ configRBuf[i++] = c;
+ configPos--; /* GJA -- one too far */
+ configRBuf[i] = '\0';
+ val.num = strtoul(configRBuf, NULL, 0);
+ val.realnum = atof(configRBuf);
+ return NUMBER;
+ }
+
+ /*
+ * All Strings START with a \" ...
+ */
+ else if (c == '\"') {
+ i = -1;
+ do {
+ configRBuf[++i] = (c = configBuf[configPos++]);
+ }
+ while ((c != '\"') && (c != '\n') && (c != '\r') && (c != '\0'));
+ configRBuf[i] = '\0';
+ val.str = malloc(strlen(configRBuf) + 1);
+ strcpy(val.str, configRBuf); /* private copy ! */
+ return STRING;
+ }
+
+ /*
+ * ... and now we MUST have a valid token. The search is
+ * handled later along with the pushed tokens.
+ */
+ else {
+ configRBuf[0] = c;
+ i = 0;
+ do {
+ configRBuf[++i] = (c = configBuf[configPos++]);
+ }
+ while ((c != ' ') && (c != '\t') && (c != '\n') && (c != '\r') &&
+ (c != '\0') && (c != '#'));
+ --configPos;
+ configRBuf[i] = '\0';
+ i = 0;
+ }
+
+ }
+ else {
+
+ /*
+ * Here we deal with pushed tokens. Reinitialize pushToken again. If
+ * the pushed token was NUMBER || STRING return them again ...
+ */
+ int temp = pushToken;
+
+ pushToken = LOCK_TOKEN;
+
+ if (temp == COMMA || temp == DASH)
+ return temp;
+ if (temp == NUMBER || temp == STRING)
+ return temp;
+ }
+
+ /*
+ * Joop, at last we have to lookup the token ...
+ */
+ if (tab) {
+ i = 0;
+ while (tab[i].token != -1)
+ if (xf86nameCompare(configRBuf, tab[i].name) == 0)
+ return tab[i].token;
+ else
+ i++;
+ }
+
+ return ERROR_TOKEN; /* Error catcher */
}
int
-xf86getSubToken (char **comment)
+xf86getSubToken(char **comment)
{
- int token;
-
- for (;;) {
- token = xf86getToken(NULL);
- if (token == COMMENT) {
- if (comment)
- *comment = xf86addComment(*comment, val.str);
- }
- else
- return token;
- }
- /*NOTREACHED*/
-}
+ int token;
+
+ for (;;) {
+ token = xf86getToken(NULL);
+ if (token == COMMENT) {
+ if (comment)
+ *comment = xf86addComment(*comment, val.str);
+ }
+ else
+ return token;
+ }
+ /*NOTREACHED*/}
int
-xf86getSubTokenWithTab (char **comment, xf86ConfigSymTabRec *tab)
+xf86getSubTokenWithTab(char **comment, xf86ConfigSymTabRec * tab)
{
- int token;
-
- for (;;) {
- token = xf86getToken(tab);
- if (token == COMMENT) {
- if (comment)
- *comment = xf86addComment(*comment, val.str);
- }
- else
- return token;
- }
- /*NOTREACHED*/
-}
+ int token;
+
+ for (;;) {
+ token = xf86getToken(tab);
+ if (token == COMMENT) {
+ if (comment)
+ *comment = xf86addComment(*comment, val.str);
+ }
+ else
+ return token;
+ }
+ /*NOTREACHED*/}
void
-xf86unGetToken (int token)
+xf86unGetToken(int token)
{
- pushToken = token;
+ pushToken = token;
}
char *
-xf86tokenString (void)
+xf86tokenString(void)
{
- return configRBuf;
+ return configRBuf;
}
int
xf86pathIsAbsolute(const char *path)
{
- if (path && path[0] == '/')
- return 1;
- return 0;
+ if (path && path[0] == '/')
+ return 1;
+ return 0;
}
/* A path is "safe" if it is relative and if it contains no ".." elements. */
int
xf86pathIsSafe(const char *path)
{
- if (xf86pathIsAbsolute(path))
- return 0;
+ if (xf86pathIsAbsolute(path))
+ return 0;
- /* Compare with ".." */
- if (!strcmp(path, ".."))
- return 0;
+ /* Compare with ".." */
+ if (!strcmp(path, ".."))
+ return 0;
- /* Look for leading "../" */
- if (!strncmp(path, "../", 3))
- return 0;
+ /* Look for leading "../" */
+ if (!strncmp(path, "../", 3))
+ return 0;
- /* Look for trailing "/.." */
- if ((strlen(path) > 3) && !strcmp(path + strlen(path) - 3, "/.."))
- return 0;
+ /* Look for trailing "/.." */
+ if ((strlen(path) > 3) && !strcmp(path + strlen(path) - 3, "/.."))
+ return 0;
- /* Look for "/../" */
- if (strstr(path, "/../"))
- return 0;
+ /* Look for "/../" */
+ if (strstr(path, "/../"))
+ return 0;
- return 1;
+ return 1;
}
/*
@@ -596,129 +584,136 @@ xf86pathIsSafe(const char *path)
static char *
DoSubstitution(const char *template, const char *cmdline, const char *projroot,
- int *cmdlineUsed, int *envUsed,
- const char *XConfigFile)
+ int *cmdlineUsed, int *envUsed, const char *XConfigFile)
{
- char *result;
- int i, l;
- static const char *env = NULL;
- static char *hostname = NULL;
-
- if (!template)
- return NULL;
-
- if (cmdlineUsed)
- *cmdlineUsed = 0;
- if (envUsed)
- *envUsed = 0;
-
- result = malloc(PATH_MAX + 1);
- l = 0;
- for (i = 0; template[i]; i++) {
- if (template[i] != '%') {
- result[l++] = template[i];
- CHECK_LENGTH;
- } else {
- switch (template[++i]) {
- case 'A':
- if (cmdline && xf86pathIsAbsolute(cmdline)) {
- APPEND_STR(cmdline);
- if (cmdlineUsed)
- *cmdlineUsed = 1;
- } else
- BAIL_OUT;
- break;
- case 'R':
- if (cmdline && !xf86pathIsAbsolute(cmdline)) {
- APPEND_STR(cmdline);
- if (cmdlineUsed)
- *cmdlineUsed = 1;
- } else
- BAIL_OUT;
- break;
- case 'S':
- if (cmdline && xf86pathIsSafe(cmdline)) {
- APPEND_STR(cmdline);
- if (cmdlineUsed)
- *cmdlineUsed = 1;
- } else
- BAIL_OUT;
- break;
- case 'X':
- APPEND_STR(XConfigFile);
- break;
- case 'H':
- if (!hostname) {
- if ((hostname = malloc(MAXHOSTNAMELEN + 1))) {
- if (gethostname(hostname, MAXHOSTNAMELEN) == 0) {
- hostname[MAXHOSTNAMELEN] = '\0';
- } else {
- free(hostname);
- hostname = NULL;
- }
- }
- }
- if (hostname)
- APPEND_STR(hostname);
- break;
- case 'E':
- if (!env)
- env = getenv(XCONFENV);
- if (env && xf86pathIsAbsolute(env)) {
- APPEND_STR(env);
- if (envUsed)
- *envUsed = 1;
- } else
- BAIL_OUT;
- break;
- case 'F':
- if (!env)
- env = getenv(XCONFENV);
- if (env && !xf86pathIsAbsolute(env)) {
- APPEND_STR(env);
- if (envUsed)
- *envUsed = 1;
- } else
- BAIL_OUT;
- break;
- case 'G':
- if (!env)
- env = getenv(XCONFENV);
- if (env && xf86pathIsSafe(env)) {
- APPEND_STR(env);
- if (envUsed)
- *envUsed = 1;
- } else
- BAIL_OUT;
- break;
- case 'P':
- if (projroot && xf86pathIsAbsolute(projroot))
- APPEND_STR(projroot);
- else
- BAIL_OUT;
- break;
- case 'C':
- APPEND_STR(SYSCONFDIR);
- break;
- case 'D':
- APPEND_STR(DATADIR);
- break;
- case '%':
- result[l++] = '%';
- CHECK_LENGTH;
- break;
- default:
- fprintf(stderr, "invalid escape %%%c found in path template\n",
- template[i]);
- BAIL_OUT;
- break;
- }
- }
- }
+ char *result;
+ int i, l;
+ static const char *env = NULL;
+ static char *hostname = NULL;
+
+ if (!template)
+ return NULL;
+
+ if (cmdlineUsed)
+ *cmdlineUsed = 0;
+ if (envUsed)
+ *envUsed = 0;
+
+ result = malloc(PATH_MAX + 1);
+ l = 0;
+ for (i = 0; template[i]; i++) {
+ if (template[i] != '%') {
+ result[l++] = template[i];
+ CHECK_LENGTH;
+ }
+ else {
+ switch (template[++i]) {
+ case 'A':
+ if (cmdline && xf86pathIsAbsolute(cmdline)) {
+ APPEND_STR(cmdline);
+ if (cmdlineUsed)
+ *cmdlineUsed = 1;
+ }
+ else
+ BAIL_OUT;
+ break;
+ case 'R':
+ if (cmdline && !xf86pathIsAbsolute(cmdline)) {
+ APPEND_STR(cmdline);
+ if (cmdlineUsed)
+ *cmdlineUsed = 1;
+ }
+ else
+ BAIL_OUT;
+ break;
+ case 'S':
+ if (cmdline && xf86pathIsSafe(cmdline)) {
+ APPEND_STR(cmdline);
+ if (cmdlineUsed)
+ *cmdlineUsed = 1;
+ }
+ else
+ BAIL_OUT;
+ break;
+ case 'X':
+ APPEND_STR(XConfigFile);
+ break;
+ case 'H':
+ if (!hostname) {
+ if ((hostname = malloc(MAXHOSTNAMELEN + 1))) {
+ if (gethostname(hostname, MAXHOSTNAMELEN) == 0) {
+ hostname[MAXHOSTNAMELEN] = '\0';
+ }
+ else {
+ free(hostname);
+ hostname = NULL;
+ }
+ }
+ }
+ if (hostname)
+ APPEND_STR(hostname);
+ break;
+ case 'E':
+ if (!env)
+ env = getenv(XCONFENV);
+ if (env && xf86pathIsAbsolute(env)) {
+ APPEND_STR(env);
+ if (envUsed)
+ *envUsed = 1;
+ }
+ else
+ BAIL_OUT;
+ break;
+ case 'F':
+ if (!env)
+ env = getenv(XCONFENV);
+ if (env && !xf86pathIsAbsolute(env)) {
+ APPEND_STR(env);
+ if (envUsed)
+ *envUsed = 1;
+ }
+ else
+ BAIL_OUT;
+ break;
+ case 'G':
+ if (!env)
+ env = getenv(XCONFENV);
+ if (env && xf86pathIsSafe(env)) {
+ APPEND_STR(env);
+ if (envUsed)
+ *envUsed = 1;
+ }
+ else
+ BAIL_OUT;
+ break;
+ case 'P':
+ if (projroot && xf86pathIsAbsolute(projroot))
+ APPEND_STR(projroot);
+ else
+ BAIL_OUT;
+ break;
+ case 'C':
+ APPEND_STR(SYSCONFDIR);
+ break;
+ case 'D':
+ APPEND_STR(DATADIR);
+ break;
+ case '%':
+ result[l++] = '%';
+ CHECK_LENGTH;
+ break;
+ default:
+ fprintf(stderr, "invalid escape %%%c found in path template\n",
+ template[i]);
+ BAIL_OUT;
+ break;
+ }
+ }
+ }
#ifdef DEBUG
- fprintf(stderr, "Converted `%s' to `%s'\n", template, result);
+ fprintf(stderr, "Converted `%s' to `%s'\n", template, result);
#endif
- return result;
+ return result;
}
/*
@@ -726,40 +721,40 @@ DoSubstitution(const char *template, const char *cmdline, const char *projroot,
*/
static char *
OpenConfigFile(const char *path, const char *cmdline, const char *projroot,
- const char *confname)
+ const char *confname)
{
- char *filepath = NULL;
- char *pathcopy;
- const char *template;
- int cmdlineUsed = 0;
- FILE *file = NULL;
-
- pathcopy = strdup(path);
- for (template = strtok(pathcopy, ","); template && !file;
- template = strtok(NULL, ",")) {
- filepath = DoSubstitution(template, cmdline, projroot,
- &cmdlineUsed, NULL, confname);
- if (!filepath)
- continue;
- if (cmdline && !cmdlineUsed) {
- free(filepath);
- filepath = NULL;
- continue;
- }
- file = fopen(filepath, "r");
- if (!file) {
- free(filepath);
- filepath = NULL;
- }
- }
-
- free(pathcopy);
- if (file) {
- configFiles[numFiles].file = file;
- configFiles[numFiles].path = strdup(filepath);
- numFiles++;
- }
- return filepath;
+ char *filepath = NULL;
+ char *pathcopy;
+ const char *template;
+ int cmdlineUsed = 0;
+ FILE *file = NULL;
+
+ pathcopy = strdup(path);
+ for (template = strtok(pathcopy, ","); template && !file;
+ template = strtok(NULL, ",")) {
+ filepath = DoSubstitution(template, cmdline, projroot,
+ &cmdlineUsed, NULL, confname);
+ if (!filepath)
+ continue;
+ if (cmdline && !cmdlineUsed) {
+ free(filepath);
+ filepath = NULL;
+ continue;
+ }
+ file = fopen(filepath, "r");
+ if (!file) {
+ free(filepath);
+ filepath = NULL;
+ }
+ }
+
+ free(pathcopy);
+ if (file) {
+ configFiles[numFiles].file = file;
+ configFiles[numFiles].path = strdup(filepath);
+ numFiles++;
+ }
+ return filepath;
}
/*
@@ -769,58 +764,54 @@ OpenConfigFile(const char *path, const char *cmdline, const char *projroot,
static int
ConfigFilter(const struct dirent *de)
{
- const char *name = de->d_name;
- size_t len;
- size_t suflen = strlen(XCONFIGSUFFIX);
-
- if (!name || name[0] == '.')
- return 0;
- len = strlen(name);
- if(len <= suflen)
- return 0;
- if (strcmp(&name[len-suflen], XCONFIGSUFFIX) != 0)
- return 0;
- return 1;
+ const char *name = de->d_name;
+ size_t len;
+ size_t suflen = strlen(XCONFIGSUFFIX);
+
+ if (!name || name[0] == '.')
+ return 0;
+ len = strlen(name);
+ if (len <= suflen)
+ return 0;
+ if (strcmp(&name[len - suflen], XCONFIGSUFFIX) != 0)
+ return 0;
+ return 1;
}
static Bool
AddConfigDirFiles(const char *dirpath, struct dirent **list, int num)
{
- int i;
- Bool openedFile = FALSE;
- Bool warnOnce = FALSE;
-
- for (i = 0; i < num; i++) {
- char *path;
- FILE *file;
-
- if (numFiles >= CONFIG_MAX_FILES) {
- if (!warnOnce) {
- ErrorF("Maximum number of configuration "
- "files opened\n");
- warnOnce = TRUE;
- }
- free(list[i]);
- continue;
- }
-
- path = malloc(PATH_MAX + 1);
- snprintf(path, PATH_MAX + 1, "%s/%s", dirpath,
- list[i]->d_name);
- free(list[i]);
- file = fopen(path, "r");
- if (!file) {
- free(path);
- continue;
- }
- openedFile = TRUE;
-
- configFiles[numFiles].file = file;
- configFiles[numFiles].path = path;
- numFiles++;
- }
-
- return openedFile;
+ int i;
+ Bool openedFile = FALSE;
+ Bool warnOnce = FALSE;
+
+ for (i = 0; i < num; i++) {
+ char *path;
+ FILE *file;
+
+ if (numFiles >= CONFIG_MAX_FILES) {
+ if (!warnOnce) {
+ ErrorF("Maximum number of configuration " "files opened\n");
+ warnOnce = TRUE;
+ }
+ continue;
+ }
+
+ path = malloc(PATH_MAX + 1);
+ snprintf(path, PATH_MAX + 1, "%s/%s", dirpath, list[i]->d_name);
+ file = fopen(path, "r");
+ if (!file) {
+ free(path);
+ continue;
+ }
+ openedFile = TRUE;
+
+ configFiles[numFiles].file = file;
+ configFiles[numFiles].path = path;
+ numFiles++;
+ }
+
+ return openedFile;
}
/*
@@ -829,41 +820,47 @@ AddConfigDirFiles(const char *dirpath, struct dirent **list, int num)
*/
static char *
OpenConfigDir(const char *path, const char *cmdline, const char *projroot,
- const char *confname)
+ const char *confname)
{
- char *dirpath, *pathcopy;
- const char *template;
- Bool found = FALSE;
- int cmdlineUsed = 0;
-
- pathcopy = strdup(path);
- for (template = strtok(pathcopy, ","); template && !found;
- template = strtok(NULL, ",")) {
- struct dirent **list = NULL;
- int num;
-
- dirpath = DoSubstitution(template, cmdline, projroot,
- &cmdlineUsed, NULL, confname);
- if (!dirpath)
- continue;
- if (cmdline && !cmdlineUsed) {
- free(dirpath);
- dirpath = NULL;
- continue;
- }
-
- /* match files named *.conf */
- num = scandir(dirpath, &list, ConfigFilter, alphasort);
- found = AddConfigDirFiles(dirpath, list, num);
- if (!found) {
- free(dirpath);
- dirpath = NULL;
- free(list);
- }
- }
-
- free(pathcopy);
- return dirpath;
+ char *dirpath, *pathcopy;
+ const char *template;
+ Bool found = FALSE;
+ int cmdlineUsed = 0;
+
+ pathcopy = strdup(path);
+ for (template = strtok(pathcopy, ","); template && !found;
+ template = strtok(NULL, ",")) {
+ struct dirent **list = NULL;
+ int num;
+
+ dirpath = DoSubstitution(template, cmdline, projroot,
+ &cmdlineUsed, NULL, confname);
+ if (!dirpath)
+ continue;
+ if (cmdline && !cmdlineUsed) {
+ free(dirpath);
+ dirpath = NULL;
+ continue;
+ }
+
+ /* match files named *.conf */
+ num = scandir(dirpath, &list, ConfigFilter, alphasort);
+ if (num < 0) {
+ list = NULL;
+ num = 0;
+ }
+ found = AddConfigDirFiles(dirpath, list, num);
+ if (!found) {
+ free(dirpath);
+ dirpath = NULL;
+ }
+ while (num--)
+ free(list[num]);
+ free(list);
+ }
+
+ free(pathcopy);
+ return dirpath;
}
/*
@@ -872,14 +869,14 @@ OpenConfigDir(const char *path, const char *cmdline, const char *projroot,
void
xf86initConfigFiles(void)
{
- curFileIndex = 0;
- configPos = 0;
- configLineNo = 0;
- pushToken = LOCK_TOKEN;
-
- configBuf = malloc(CONFIG_BUF_LEN);
- configRBuf = malloc(CONFIG_BUF_LEN);
- configBuf[0] = '\0'; /* sanity ... */
+ curFileIndex = 0;
+ configPos = 0;
+ configLineNo = 0;
+ pushToken = LOCK_TOKEN;
+
+ configBuf = malloc(CONFIG_BUF_LEN);
+ configRBuf = malloc(CONFIG_BUF_LEN);
+ configBuf[0] = '\0'; /* sanity ... */
}
/*
@@ -892,7 +889,8 @@ xf86initConfigFiles(void)
* of the located files.
*
* The return value is a pointer to the actual name of the file that was
- * opened. When no file is found, the return value is NULL.
+ * opened. When no file is found, the return value is NULL. The caller should
+ * free() the returned value.
*
* The escape sequences allowed in the search path are defined above.
*
@@ -914,17 +912,16 @@ xf86initConfigFiles(void)
"%P/lib/X11/%X"
#endif
-const char *
+char *
xf86openConfigFile(const char *path, const char *cmdline, const char *projroot)
{
- if (!path || !path[0])
- path = DEFAULT_CONF_PATH;
- if (!projroot || !projroot[0])
- projroot = PROJECTROOT;
-
- /* Search for a config file */
- configPath = OpenConfigFile(path, cmdline, projroot, XCONFIGFILE);
- return configPath;
+ if (!path || !path[0])
+ path = DEFAULT_CONF_PATH;
+ if (!projroot || !projroot[0])
+ projroot = PROJECTROOT;
+
+ /* Search for a config file */
+ return OpenConfigFile(path, cmdline, projroot, XCONFIGFILE);
}
/*
@@ -937,94 +934,90 @@ xf86openConfigFile(const char *path, const char *cmdline, const char *projroot)
* fails if it is not found.
*
* The return value is a pointer to the actual name of the direcoty that was
- * opened. When no directory is found, the return value is NULL.
+ * opened. When no directory is found, the return value is NULL. The caller
+ * should free() the returned value.
*
* The escape sequences allowed in the search path are defined above.
*
*/
-const char *
+char *
xf86openConfigDirFiles(const char *path, const char *cmdline,
- const char *projroot)
+ const char *projroot)
{
- if (!path || !path[0])
- path = DEFAULT_CONF_PATH;
- if (!projroot || !projroot[0])
- projroot = PROJECTROOT;
-
- /* Search for the multiconf directory */
- configDirPath = OpenConfigDir(path, cmdline, projroot, XCONFIGDIR);
- return configDirPath;
+ if (!path || !path[0])
+ path = DEFAULT_CONF_PATH;
+ if (!projroot || !projroot[0])
+ projroot = PROJECTROOT;
+
+ /* Search for the multiconf directory */
+ return OpenConfigDir(path, cmdline, projroot, XCONFIGDIR);
}
void
-xf86closeConfigFile (void)
+xf86closeConfigFile(void)
{
- int i;
-
- free (configPath);
- configPath = NULL;
- free (configDirPath);
- configDirPath = NULL;
- free (configRBuf);
- configRBuf = NULL;
- free (configBuf);
- configBuf = NULL;
-
- if (numFiles == 0) {
- builtinConfig = NULL;
- builtinIndex = 0;
- }
- for (i = 0; i < numFiles; i++) {
- fclose(configFiles[i].file);
- configFiles[i].file = NULL;
- free(configFiles[i].path);
- configFiles[i].path = NULL;
- }
- numFiles = 0;
+ int i;
+
+ free(configRBuf);
+ configRBuf = NULL;
+ free(configBuf);
+ configBuf = NULL;
+
+ if (numFiles == 0) {
+ builtinConfig = NULL;
+ builtinIndex = 0;
+ }
+ for (i = 0; i < numFiles; i++) {
+ fclose(configFiles[i].file);
+ configFiles[i].file = NULL;
+ free(configFiles[i].path);
+ configFiles[i].path = NULL;
+ }
+ numFiles = 0;
}
void
xf86setBuiltinConfig(const char *config[])
{
- builtinConfig = config;
+ builtinConfig = config;
}
void
-xf86parseError (char *format,...)
+xf86parseError(const char *format, ...)
{
- va_list ap;
- char *filename = numFiles ? configFiles[curFileIndex].path :
- "<builtin configuration>";
+ va_list ap;
+ const char *filename = numFiles ? configFiles[curFileIndex].path
+ : "<builtin configuration>";
- ErrorF ("Parse error on line %d of section %s in file %s\n\t",
- configLineNo, configSection, filename);
- va_start (ap, format);
- VErrorF (format, ap);
- va_end (ap);
+ ErrorF("Parse error on line %d of section %s in file %s\n\t",
+ configLineNo, configSection, filename);
+ va_start(ap, format);
+ VErrorF(format, ap);
+ va_end(ap);
- ErrorF ("\n");
+ ErrorF("\n");
}
void
-xf86validationError (char *format,...)
+xf86validationError(const char *format, ...)
{
- va_list ap;
- char *filename = numFiles ? configFiles[curFileIndex].path :
- "<builtin configuration>";
+ va_list ap;
+ const char *filename = numFiles ? configFiles[curFileIndex].path
+ : "<builtin configuration>";
- ErrorF ("Data incomplete in file %s\n\t", filename);
- va_start (ap, format);
- VErrorF (format, ap);
- va_end (ap);
+ ErrorF("Data incomplete in file %s\n\t", filename);
+ va_start(ap, format);
+ VErrorF(format, ap);
+ va_end(ap);
- ErrorF ("\n");
+ ErrorF("\n");
}
void
-xf86setSection (char *section)
+xf86setSection(const char *section)
{
- free(configSection);
- configSection = strdup(section);
+ free(configSection);
+ configSection = strdup(section);
}
/*
@@ -1032,136 +1025,143 @@ xf86setSection (char *section)
* Lookup a string if it is actually a token in disguise.
*/
int
-xf86getStringToken (xf86ConfigSymTabRec * tab)
+xf86getStringToken(xf86ConfigSymTabRec * tab)
{
- return StringToToken (val.str, tab);
+ return StringToToken(val.str, tab);
}
static int
-StringToToken (char *str, xf86ConfigSymTabRec * tab)
+StringToToken(const char *str, xf86ConfigSymTabRec * tab)
{
- int i;
-
- for (i = 0; tab[i].token != -1; i++)
- {
- if (!xf86nameCompare (tab[i].name, str))
- return tab[i].token;
- }
- return ERROR_TOKEN;
-}
+ int i;
+ for (i = 0; tab[i].token != -1; i++) {
+ if (!xf86nameCompare(tab[i].name, str))
+ return tab[i].token;
+ }
+ return ERROR_TOKEN;
+}
/*
* Compare two names. The characters '_', ' ', and '\t' are ignored
* in the comparison.
*/
int
-xf86nameCompare (const char *s1, const char *s2)
+xf86nameCompare(const char *s1, const char *s2)
{
- char c1, c2;
-
- if (!s1 || *s1 == 0) {
- if (!s2 || *s2 == 0)
- return 0;
- else
- return 1;
- }
-
- while (*s1 == '_' || *s1 == ' ' || *s1 == '\t')
- s1++;
- while (*s2 == '_' || *s2 == ' ' || *s2 == '\t')
- s2++;
- c1 = (isupper (*s1) ? tolower (*s1) : *s1);
- c2 = (isupper (*s2) ? tolower (*s2) : *s2);
- while (c1 == c2)
- {
- if (c1 == '\0')
- return 0;
- s1++;
- s2++;
- while (*s1 == '_' || *s1 == ' ' || *s1 == '\t')
- s1++;
- while (*s2 == '_' || *s2 == ' ' || *s2 == '\t')
- s2++;
- c1 = (isupper (*s1) ? tolower (*s1) : *s1);
- c2 = (isupper (*s2) ? tolower (*s2) : *s2);
- }
- return c1 - c2;
+ char c1, c2;
+
+ if (!s1 || *s1 == 0) {
+ if (!s2 || *s2 == 0)
+ return 0;
+ else
+ return 1;
+ }
+
+ while (*s1 == '_' || *s1 == ' ' || *s1 == '\t')
+ s1++;
+ while (*s2 == '_' || *s2 == ' ' || *s2 == '\t')
+ s2++;
+ c1 = (isupper(*s1) ? tolower(*s1) : *s1);
+ c2 = (isupper(*s2) ? tolower(*s2) : *s2);
+ while (c1 == c2) {
+ if (c1 == '\0')
+ return 0;
+ s1++;
+ s2++;
+ while (*s1 == '_' || *s1 == ' ' || *s1 == '\t')
+ s1++;
+ while (*s2 == '_' || *s2 == ' ' || *s2 == '\t')
+ s2++;
+ c1 = (isupper(*s1) ? tolower(*s1) : *s1);
+ c2 = (isupper(*s2) ? tolower(*s2) : *s2);
+ }
+ return c1 - c2;
}
char *
xf86addComment(char *cur, char *add)
{
- char *str;
- int len, curlen, iscomment, hasnewline = 0, endnewline;
-
- if (add == NULL || add[0] == '\0')
- return cur;
-
- if (cur) {
- curlen = strlen(cur);
- if (curlen)
- hasnewline = cur[curlen - 1] == '\n';
- eol_seen = 0;
- }
- else
- curlen = 0;
-
- str = add;
- iscomment = 0;
- while (*str) {
- if (*str != ' ' && *str != '\t')
- break;
- ++str;
- }
- iscomment = (*str == '#');
-
- len = strlen(add);
- endnewline = add[len - 1] == '\n';
- len += 1 + iscomment + (!hasnewline) + (!endnewline) + eol_seen;
-
- if ((str = realloc(cur, len + curlen)) == NULL)
- return cur;
-
- cur = str;
-
- if (eol_seen || (curlen && !hasnewline))
- cur[curlen++] = '\n';
- if (!iscomment)
- cur[curlen++] = '#';
- strcpy(cur + curlen, add);
- if (!endnewline)
- strcat(cur, "\n");
-
- return cur;
+ char *str;
+ int len, curlen, iscomment, hasnewline = 0, insnewline, endnewline;
+
+ if (add == NULL || add[0] == '\0')
+ return cur;
+
+ if (cur) {
+ curlen = strlen(cur);
+ if (curlen)
+ hasnewline = cur[curlen - 1] == '\n';
+ eol_seen = 0;
+ }
+ else
+ curlen = 0;
+
+ str = add;
+ iscomment = 0;
+ while (*str) {
+ if (*str != ' ' && *str != '\t')
+ break;
+ ++str;
+ }
+ iscomment = (*str == '#');
+
+ len = strlen(add);
+ endnewline = add[len - 1] == '\n';
+
+ insnewline = eol_seen || (curlen && !hasnewline);
+ if (insnewline)
+ len++;
+ if (!iscomment)
+ len++;
+ if (!endnewline)
+ len++;
+
+ /* Allocate + 1 char for '\0' terminator. */
+ str = realloc(cur, curlen + len + 1);
+ if (!str)
+ return cur;
+
+ cur = str;
+
+ if (insnewline)
+ cur[curlen++] = '\n';
+ if (!iscomment)
+ cur[curlen++] = '#';
+ strcpy(cur + curlen, add);
+ if (!endnewline)
+ strcat(cur, "\n");
+
+ return cur;
}
Bool
xf86getBoolValue(Bool *val, const char *str)
{
- if (!val || !str)
- return FALSE;
- if (*str == '\0') {
- *val = TRUE;
- } else {
- if (xf86nameCompare(str, "1") == 0)
- *val = TRUE;
- else if (xf86nameCompare(str, "on") == 0)
- *val = TRUE;
- else if (xf86nameCompare(str, "true") == 0)
- *val = TRUE;
- else if (xf86nameCompare(str, "yes") == 0)
- *val = TRUE;
- else if (xf86nameCompare(str, "0") == 0)
- *val = FALSE;
- else if (xf86nameCompare(str, "off") == 0)
- *val = FALSE;
- else if (xf86nameCompare(str, "false") == 0)
- *val = FALSE;
- else if (xf86nameCompare(str, "no") == 0)
- *val = FALSE;
- else
- return FALSE;
- }
- return TRUE;
+ if (!val || !str)
+ return FALSE;
+ if (*str == '\0') {
+ *val = TRUE;
+ }
+ else {
+ if (xf86nameCompare(str, "1") == 0)
+ *val = TRUE;
+ else if (xf86nameCompare(str, "on") == 0)
+ *val = TRUE;
+ else if (xf86nameCompare(str, "true") == 0)
+ *val = TRUE;
+ else if (xf86nameCompare(str, "yes") == 0)
+ *val = TRUE;
+ else if (xf86nameCompare(str, "0") == 0)
+ *val = FALSE;
+ else if (xf86nameCompare(str, "off") == 0)
+ *val = FALSE;
+ else if (xf86nameCompare(str, "false") == 0)
+ *val = FALSE;
+ else if (xf86nameCompare(str, "no") == 0)
+ *val = FALSE;
+ else
+ return FALSE;
+ }
+ return TRUE;
}
diff --git a/xserver/hw/xfree86/parser/write.c b/xserver/hw/xfree86/parser/write.c
index eea3f0693..c001c3d51 100644
--- a/xserver/hw/xfree86/parser/write.c
+++ b/xserver/hw/xfree86/parser/write.c
@@ -51,7 +51,6 @@
* authorization from the copyright holder(s) and author(s).
*/
-
/* View/edit this file with tab stops set to 4 */
#ifdef HAVE_XORG_CONFIG_H
@@ -83,134 +82,124 @@
#endif
Local int
-doWriteConfigFile (const char *filename, XF86ConfigPtr cptr)
+doWriteConfigFile(const char *filename, XF86ConfigPtr cptr)
{
- FILE *cf;
+ FILE *cf;
- if ((cf = fopen (filename, "w")) == NULL)
- {
- return 0;
- }
+ if ((cf = fopen(filename, "w")) == NULL) {
+ return 0;
+ }
- if (cptr->conf_comment)
- fprintf (cf, "%s\n", cptr->conf_comment);
+ if (cptr->conf_comment)
+ fprintf(cf, "%s\n", cptr->conf_comment);
- xf86printLayoutSection (cf, cptr->conf_layout_lst);
+ xf86printLayoutSection(cf, cptr->conf_layout_lst);
- if (cptr->conf_files != NULL)
- {
- fprintf (cf, "Section \"Files\"\n");
- xf86printFileSection (cf, cptr->conf_files);
- fprintf (cf, "EndSection\n\n");
- }
+ if (cptr->conf_files != NULL) {
+ fprintf(cf, "Section \"Files\"\n");
+ xf86printFileSection(cf, cptr->conf_files);
+ fprintf(cf, "EndSection\n\n");
+ }
- if (cptr->conf_modules != NULL)
- {
- fprintf (cf, "Section \"Module\"\n");
- xf86printModuleSection (cf, cptr->conf_modules);
- fprintf (cf, "EndSection\n\n");
- }
+ if (cptr->conf_modules != NULL) {
+ fprintf(cf, "Section \"Module\"\n");
+ xf86printModuleSection(cf, cptr->conf_modules);
+ fprintf(cf, "EndSection\n\n");
+ }
- xf86printVendorSection (cf, cptr->conf_vendor_lst);
+ xf86printVendorSection(cf, cptr->conf_vendor_lst);
- xf86printServerFlagsSection (cf, cptr->conf_flags);
+ xf86printServerFlagsSection(cf, cptr->conf_flags);
- xf86printInputSection (cf, cptr->conf_input_lst);
+ xf86printInputSection(cf, cptr->conf_input_lst);
- xf86printInputClassSection (cf, cptr->conf_inputclass_lst);
+ xf86printInputClassSection(cf, cptr->conf_inputclass_lst);
- xf86printVideoAdaptorSection (cf, cptr->conf_videoadaptor_lst);
+ xf86printVideoAdaptorSection(cf, cptr->conf_videoadaptor_lst);
- xf86printModesSection (cf, cptr->conf_modes_lst);
+ xf86printModesSection(cf, cptr->conf_modes_lst);
- xf86printMonitorSection (cf, cptr->conf_monitor_lst);
+ xf86printMonitorSection(cf, cptr->conf_monitor_lst);
- xf86printDeviceSection (cf, cptr->conf_device_lst);
+ xf86printDeviceSection(cf, cptr->conf_device_lst);
- xf86printScreenSection (cf, cptr->conf_screen_lst);
+ xf86printScreenSection(cf, cptr->conf_screen_lst);
- xf86printDRISection (cf, cptr->conf_dri);
+ xf86printDRISection(cf, cptr->conf_dri);
- xf86printExtensionsSection (cf, cptr->conf_extensions);
+ xf86printExtensionsSection(cf, cptr->conf_extensions);
- fclose(cf);
- return 1;
+ fclose(cf);
+ return 1;
}
#ifndef HAS_NO_UIDS
int
-xf86writeConfigFile (const char *filename, XF86ConfigPtr cptr)
+xf86writeConfigFile(const char *filename, XF86ConfigPtr cptr)
{
- int ret;
+ int ret;
#if !defined(HAS_SAVED_IDS_AND_SETEUID)
- int pid, p;
- int status;
- void (*csig)(int);
+ int pid, p;
+ int status;
+ void (*csig) (int);
#else
- int ruid, euid;
+ int ruid, euid;
#endif
- if (getuid() != geteuid())
- {
+ if (getuid() != geteuid()) {
#if !defined(HAS_SAVED_IDS_AND_SETEUID)
- /* Need to fork to change ruid without loosing euid */
- csig = signal(SIGCHLD, SIG_DFL);
- switch ((pid = fork()))
- {
- case -1:
- ErrorF("xf86writeConfigFile(): fork failed (%s)\n",
- strerror(errno));
- return 0;
- case 0: /* child */
- if (setuid(getuid()) == -1)
- FatalError("xf86writeConfigFile(): "
- "setuid failed(%s)\n",
- strerror(errno));
- ret = doWriteConfigFile(filename, cptr);
- exit(ret);
- break;
- default: /* parent */
- do
- {
- p = waitpid(pid, &status, 0);
- } while (p == -1 && errno == EINTR);
- }
- signal(SIGCHLD, csig);
- if (p != -1 && WIFEXITED(status) && WEXITSTATUS(status) == 0)
- return 1; /* success */
- else
- return 0;
-
-#else /* HAS_SAVED_IDS_AND_SETEUID */
-
- ruid = getuid();
- euid = geteuid();
-
- if (seteuid(ruid) == -1)
- {
- ErrorF("xf86writeConfigFile(): seteuid(%d) failed (%s)\n",
- ruid, strerror(errno));
- return 0;
- }
- ret = doWriteConfigFile(filename, cptr);
-
- if (seteuid(euid) == -1)
- {
- ErrorF("xf86writeConfigFile(): seteuid(%d) failed (%s)\n",
- euid, strerror(errno));
- }
- return ret;
-
-#endif /* HAS_SAVED_IDS_AND_SETEUID */
-
- }
- else
- {
- return doWriteConfigFile(filename, cptr);
- }
+ /* Need to fork to change ruid without loosing euid */
+ csig = signal(SIGCHLD, SIG_DFL);
+ switch ((pid = fork())) {
+ case -1:
+ ErrorF("xf86writeConfigFile(): fork failed (%s)\n",
+ strerror(errno));
+ return 0;
+ case 0: /* child */
+ if (setuid(getuid()) == -1)
+ FatalError("xf86writeConfigFile(): "
+ "setuid failed(%s)\n", strerror(errno));
+ ret = doWriteConfigFile(filename, cptr);
+ exit(ret);
+ break;
+ default: /* parent */
+ do {
+ p = waitpid(pid, &status, 0);
+ } while (p == -1 && errno == EINTR);
+ }
+ signal(SIGCHLD, csig);
+ if (p != -1 && WIFEXITED(status) && WEXITSTATUS(status) == 0)
+ return 1; /* success */
+ else
+ return 0;
+
+#else /* HAS_SAVED_IDS_AND_SETEUID */
+
+ ruid = getuid();
+ euid = geteuid();
+
+ if (seteuid(ruid) == -1) {
+ ErrorF("xf86writeConfigFile(): seteuid(%d) failed (%s)\n",
+ ruid, strerror(errno));
+ return 0;
+ }
+ ret = doWriteConfigFile(filename, cptr);
+
+ if (seteuid(euid) == -1) {
+ ErrorF("xf86writeConfigFile(): seteuid(%d) failed (%s)\n",
+ euid, strerror(errno));
+ }
+ return ret;
+
+#endif /* HAS_SAVED_IDS_AND_SETEUID */
+
+ }
+ else {
+ return doWriteConfigFile(filename, cptr);
+ }
}
-#endif /* !HAS_NO_UIDS */
+#endif /* !HAS_NO_UIDS */
diff --git a/xserver/hw/xfree86/parser/xf86Optrec.h b/xserver/hw/xfree86/parser/xf86Optrec.h
index 5ccf7285b..ea0cb1329 100644
--- a/xserver/hw/xfree86/parser/xf86Optrec.h
+++ b/xserver/hw/xfree86/parser/xf86Optrec.h
@@ -52,7 +52,6 @@
* authorization from the copyright holder(s) and author(s).
*/
-
/*
* This file contains the Option Record that is passed between the Parser,
* and Module setup procs.
@@ -65,48 +64,30 @@
#define _xf86Optrec_h_
#include <stdio.h>
#include <string.h>
+#include "xf86Optionstr.h"
#include <X11/Xfuncproto.h>
-/*
- * all records that need to be linked lists should contain a GenericList as
- * their first field.
- */
-typedef struct generic_list_rec
-{
- void *next;
-}
-GenericListRec, *GenericListPtr, *glp;
-
-/*
- * All options are stored using this data type.
- */
-typedef struct
-{
- GenericListRec list;
- char *opt_name;
- char *opt_val;
- int opt_used;
- char *opt_comment;
-}
-XF86OptionRec, *XF86OptionPtr;
-
-
-extern _X_EXPORT XF86OptionPtr xf86addNewOption(XF86OptionPtr head, char *name, char *val);
+extern _X_EXPORT XF86OptionPtr xf86addNewOption(XF86OptionPtr head, char *name,
+ char *val);
extern _X_EXPORT XF86OptionPtr xf86optionListDup(XF86OptionPtr opt);
extern _X_EXPORT void xf86optionListFree(XF86OptionPtr opt);
extern _X_EXPORT char *xf86optionName(XF86OptionPtr opt);
extern _X_EXPORT char *xf86optionValue(XF86OptionPtr opt);
extern _X_EXPORT XF86OptionPtr xf86newOption(char *name, char *value);
extern _X_EXPORT XF86OptionPtr xf86nextOption(XF86OptionPtr list);
-extern _X_EXPORT XF86OptionPtr xf86findOption(XF86OptionPtr list, const char *name);
-extern _X_EXPORT char *xf86findOptionValue(XF86OptionPtr list, const char *name);
-extern _X_EXPORT XF86OptionPtr xf86optionListCreate(const char **options, int count, int used);
-extern _X_EXPORT XF86OptionPtr xf86optionListMerge(XF86OptionPtr head, XF86OptionPtr tail);
-extern _X_EXPORT int xf86nameCompare (const char *s1, const char *s2);
+extern _X_EXPORT XF86OptionPtr xf86findOption(XF86OptionPtr list,
+ const char *name);
+extern _X_EXPORT const char *xf86findOptionValue(XF86OptionPtr list,
+ const char *name);
+extern _X_EXPORT XF86OptionPtr xf86optionListCreate(const char **options,
+ int count, int used);
+extern _X_EXPORT XF86OptionPtr xf86optionListMerge(XF86OptionPtr head,
+ XF86OptionPtr tail);
+extern _X_EXPORT int xf86nameCompare(const char *s1, const char *s2);
extern _X_EXPORT char *xf86uLongToString(unsigned long i);
extern _X_EXPORT XF86OptionPtr xf86parseOption(XF86OptionPtr head);
-extern _X_EXPORT void xf86printOptionList(FILE *fp, XF86OptionPtr list, int tabs);
-
+extern _X_EXPORT void xf86printOptionList(FILE * fp, XF86OptionPtr list,
+ int tabs);
-#endif /* _xf86Optrec_h_ */
+#endif /* _xf86Optrec_h_ */
diff --git a/xserver/hw/xfree86/parser/xf86Parser.h b/xserver/hw/xfree86/parser/xf86Parser.h
index a8785c5fa..e7210e811 100644
--- a/xserver/hw/xfree86/parser/xf86Parser.h
+++ b/xserver/hw/xfree86/parser/xf86Parser.h
@@ -52,7 +52,6 @@
* authorization from the copyright holder(s) and author(s).
*/
-
/*
* This file contains the external interfaces for the XFree86 configuration
* file parser.
@@ -70,39 +69,33 @@
#define HAVE_PARSER_DECLS
-typedef struct
-{
- char *file_logfile;
- char *file_modulepath;
- char *file_fontpath;
- char *file_comment;
- char *file_xkbdir;
-}
-XF86ConfFilesRec, *XF86ConfFilesPtr;
+typedef struct {
+ char *file_logfile;
+ char *file_modulepath;
+ char *file_fontpath;
+ char *file_comment;
+ char *file_xkbdir;
+} XF86ConfFilesRec, *XF86ConfFilesPtr;
/* Values for load_type */
#define XF86_LOAD_MODULE 0
#define XF86_LOAD_DRIVER 1
#define XF86_DISABLE_MODULE 2
-typedef struct
-{
- GenericListRec list;
- int load_type;
- char *load_name;
- XF86OptionPtr load_opt;
- char *load_comment;
- int ignore;
-}
-XF86LoadRec, *XF86LoadPtr;
-
-typedef struct
-{
- XF86LoadPtr mod_load_lst;
+typedef struct {
+ GenericListRec list;
+ int load_type;
+ char *load_name;
+ XF86OptionPtr load_opt;
+ char *load_comment;
+ int ignore;
+} XF86LoadRec, *XF86LoadPtr;
+
+typedef struct {
+ XF86LoadPtr mod_load_lst;
XF86LoadPtr mod_disable_lst;
- char *mod_comment;
-}
-XF86ConfModuleRec, *XF86ConfModulePtr;
+ char *mod_comment;
+} XF86ConfModuleRec, *XF86ConfModulePtr;
#define CONF_IMPLICIT_KEYBOARD "Implicit Core Keyboard"
@@ -117,258 +110,220 @@ XF86ConfModuleRec, *XF86ConfModulePtr;
#define XF86CONF_CSYNC 0x0040
#define XF86CONF_PCSYNC 0x0080
#define XF86CONF_NCSYNC 0x0100
-#define XF86CONF_HSKEW 0x0200 /* hskew provided */
+#define XF86CONF_HSKEW 0x0200 /* hskew provided */
#define XF86CONF_BCAST 0x0400
#define XF86CONF_VSCAN 0x1000
-typedef struct
-{
- GenericListRec list;
- char *ml_identifier;
- int ml_clock;
- int ml_hdisplay;
- int ml_hsyncstart;
- int ml_hsyncend;
- int ml_htotal;
- int ml_vdisplay;
- int ml_vsyncstart;
- int ml_vsyncend;
- int ml_vtotal;
- int ml_vscan;
- int ml_flags;
- int ml_hskew;
- char *ml_comment;
-}
-XF86ConfModeLineRec, *XF86ConfModeLinePtr;
-
-typedef struct
-{
- GenericListRec list;
- char *vp_identifier;
- XF86OptionPtr vp_option_lst;
- char *vp_comment;
-}
-XF86ConfVideoPortRec, *XF86ConfVideoPortPtr;
-
-typedef struct
-{
- GenericListRec list;
- char *va_identifier;
- char *va_vendor;
- char *va_board;
- char *va_busid;
- char *va_driver;
- XF86OptionPtr va_option_lst;
- XF86ConfVideoPortPtr va_port_lst;
- char *va_fwdref;
- char *va_comment;
-}
-XF86ConfVideoAdaptorRec, *XF86ConfVideoAdaptorPtr;
+typedef struct {
+ GenericListRec list;
+ char *ml_identifier;
+ int ml_clock;
+ int ml_hdisplay;
+ int ml_hsyncstart;
+ int ml_hsyncend;
+ int ml_htotal;
+ int ml_vdisplay;
+ int ml_vsyncstart;
+ int ml_vsyncend;
+ int ml_vtotal;
+ int ml_vscan;
+ int ml_flags;
+ int ml_hskew;
+ char *ml_comment;
+} XF86ConfModeLineRec, *XF86ConfModeLinePtr;
+
+typedef struct {
+ GenericListRec list;
+ char *vp_identifier;
+ XF86OptionPtr vp_option_lst;
+ char *vp_comment;
+} XF86ConfVideoPortRec, *XF86ConfVideoPortPtr;
+
+typedef struct {
+ GenericListRec list;
+ char *va_identifier;
+ char *va_vendor;
+ char *va_board;
+ char *va_busid;
+ char *va_driver;
+ XF86OptionPtr va_option_lst;
+ XF86ConfVideoPortPtr va_port_lst;
+ char *va_fwdref;
+ char *va_comment;
+} XF86ConfVideoAdaptorRec, *XF86ConfVideoAdaptorPtr;
#define CONF_MAX_HSYNC 8
#define CONF_MAX_VREFRESH 8
-typedef struct
-{
- float hi, lo;
-}
-parser_range;
-
-typedef struct
-{
- int red, green, blue;
-}
-parser_rgb;
-
-typedef struct
-{
- GenericListRec list;
- char *modes_identifier;
- XF86ConfModeLinePtr mon_modeline_lst;
- char *modes_comment;
-}
-XF86ConfModesRec, *XF86ConfModesPtr;
-
-typedef struct
-{
- GenericListRec list;
- char *ml_modes_str;
- XF86ConfModesPtr ml_modes;
-}
-XF86ConfModesLinkRec, *XF86ConfModesLinkPtr;
-
-typedef struct
-{
- GenericListRec list;
- char *mon_identifier;
- char *mon_vendor;
- char *mon_modelname;
- int mon_width; /* in mm */
- int mon_height; /* in mm */
- XF86ConfModeLinePtr mon_modeline_lst;
- int mon_n_hsync;
- parser_range mon_hsync[CONF_MAX_HSYNC];
- int mon_n_vrefresh;
- parser_range mon_vrefresh[CONF_MAX_VREFRESH];
- float mon_gamma_red;
- float mon_gamma_green;
- float mon_gamma_blue;
- XF86OptionPtr mon_option_lst;
- XF86ConfModesLinkPtr mon_modes_sect_lst;
- char *mon_comment;
-}
-XF86ConfMonitorRec, *XF86ConfMonitorPtr;
+typedef struct {
+ float hi, lo;
+} parser_range;
+
+typedef struct {
+ int red, green, blue;
+} parser_rgb;
+
+typedef struct {
+ GenericListRec list;
+ char *modes_identifier;
+ XF86ConfModeLinePtr mon_modeline_lst;
+ char *modes_comment;
+} XF86ConfModesRec, *XF86ConfModesPtr;
+
+typedef struct {
+ GenericListRec list;
+ char *ml_modes_str;
+ XF86ConfModesPtr ml_modes;
+} XF86ConfModesLinkRec, *XF86ConfModesLinkPtr;
+
+typedef struct {
+ GenericListRec list;
+ char *mon_identifier;
+ char *mon_vendor;
+ char *mon_modelname;
+ int mon_width; /* in mm */
+ int mon_height; /* in mm */
+ XF86ConfModeLinePtr mon_modeline_lst;
+ int mon_n_hsync;
+ parser_range mon_hsync[CONF_MAX_HSYNC];
+ int mon_n_vrefresh;
+ parser_range mon_vrefresh[CONF_MAX_VREFRESH];
+ float mon_gamma_red;
+ float mon_gamma_green;
+ float mon_gamma_blue;
+ XF86OptionPtr mon_option_lst;
+ XF86ConfModesLinkPtr mon_modes_sect_lst;
+ char *mon_comment;
+} XF86ConfMonitorRec, *XF86ConfMonitorPtr;
#define CONF_MAXDACSPEEDS 4
#define CONF_MAXCLOCKS 128
-typedef struct
-{
- GenericListRec list;
- char *dev_identifier;
- char *dev_vendor;
- char *dev_board;
- char *dev_chipset;
- char *dev_busid;
- char *dev_card;
- char *dev_driver;
- char *dev_ramdac;
- int dev_dacSpeeds[CONF_MAXDACSPEEDS];
- int dev_videoram;
- int dev_textclockfreq;
- unsigned long dev_bios_base;
- unsigned long dev_mem_base;
- unsigned long dev_io_base;
- char *dev_clockchip;
- int dev_clocks;
- int dev_clock[CONF_MAXCLOCKS];
- int dev_chipid;
- int dev_chiprev;
- int dev_irq;
- int dev_screen;
- XF86OptionPtr dev_option_lst;
- char *dev_comment;
-}
-XF86ConfDeviceRec, *XF86ConfDevicePtr;
-
-typedef struct
-{
- GenericListRec list;
- char *mode_name;
-}
-XF86ModeRec, *XF86ModePtr;
-
-typedef struct
-{
- GenericListRec list;
- int disp_frameX0;
- int disp_frameY0;
- int disp_virtualX;
- int disp_virtualY;
- int disp_depth;
- int disp_bpp;
- char *disp_visual;
- parser_rgb disp_weight;
- parser_rgb disp_black;
- parser_rgb disp_white;
- XF86ModePtr disp_mode_lst;
- XF86OptionPtr disp_option_lst;
- char *disp_comment;
-}
-XF86ConfDisplayRec, *XF86ConfDisplayPtr;
-
-typedef struct
-{
- XF86OptionPtr flg_option_lst;
- char *flg_comment;
-}
-XF86ConfFlagsRec, *XF86ConfFlagsPtr;
-
-typedef struct
-{
- GenericListRec list;
- char *al_adaptor_str;
- XF86ConfVideoAdaptorPtr al_adaptor;
-}
-XF86ConfAdaptorLinkRec, *XF86ConfAdaptorLinkPtr;
-
-typedef struct
-{
- GenericListRec list;
- char *scrn_identifier;
- char *scrn_obso_driver;
- int scrn_defaultdepth;
- int scrn_defaultbpp;
- int scrn_defaultfbbpp;
- char *scrn_monitor_str;
- XF86ConfMonitorPtr scrn_monitor;
- char *scrn_device_str;
- XF86ConfDevicePtr scrn_device;
- XF86ConfAdaptorLinkPtr scrn_adaptor_lst;
- XF86ConfDisplayPtr scrn_display_lst;
- XF86OptionPtr scrn_option_lst;
- char *scrn_comment;
- int scrn_virtualX, scrn_virtualY;
-}
-XF86ConfScreenRec, *XF86ConfScreenPtr;
-
-typedef struct
-{
- GenericListRec list;
- char *inp_identifier;
- char *inp_driver;
- XF86OptionPtr inp_option_lst;
- char *inp_comment;
-}
-XF86ConfInputRec, *XF86ConfInputPtr;
-
-typedef struct
-{
- GenericListRec list;
- XF86ConfInputPtr iref_inputdev;
- char *iref_inputdev_str;
- XF86OptionPtr iref_option_lst;
-}
-XF86ConfInputrefRec, *XF86ConfInputrefPtr;
-
-typedef struct
-{
- Bool set;
- Bool val;
-}
-xf86TriState;
-
-typedef struct
-{
- struct list entry;
- char **values;
-}
-xf86MatchGroup;
-
-typedef struct
-{
- GenericListRec list;
- char *identifier;
- char *driver;
- struct list match_product;
- struct list match_vendor;
- struct list match_device;
- struct list match_os;
- struct list match_pnpid;
- struct list match_usbid;
- struct list match_driver;
- struct list match_tag;
- struct list match_layout;
- xf86TriState is_keyboard;
- xf86TriState is_pointer;
- xf86TriState is_joystick;
- xf86TriState is_tablet;
- xf86TriState is_touchpad;
- xf86TriState is_touchscreen;
- XF86OptionPtr option_lst;
- char *comment;
-}
-XF86ConfInputClassRec, *XF86ConfInputClassPtr;
+typedef struct {
+ GenericListRec list;
+ char *dev_identifier;
+ char *dev_vendor;
+ char *dev_board;
+ char *dev_chipset;
+ char *dev_busid;
+ char *dev_card;
+ char *dev_driver;
+ char *dev_ramdac;
+ int dev_dacSpeeds[CONF_MAXDACSPEEDS];
+ int dev_videoram;
+ int dev_textclockfreq;
+ unsigned long dev_bios_base;
+ unsigned long dev_mem_base;
+ unsigned long dev_io_base;
+ char *dev_clockchip;
+ int dev_clocks;
+ int dev_clock[CONF_MAXCLOCKS];
+ int dev_chipid;
+ int dev_chiprev;
+ int dev_irq;
+ int dev_screen;
+ XF86OptionPtr dev_option_lst;
+ char *dev_comment;
+} XF86ConfDeviceRec, *XF86ConfDevicePtr;
+
+typedef struct {
+ GenericListRec list;
+ char *mode_name;
+} XF86ModeRec, *XF86ModePtr;
+
+typedef struct {
+ GenericListRec list;
+ int disp_frameX0;
+ int disp_frameY0;
+ int disp_virtualX;
+ int disp_virtualY;
+ int disp_depth;
+ int disp_bpp;
+ char *disp_visual;
+ parser_rgb disp_weight;
+ parser_rgb disp_black;
+ parser_rgb disp_white;
+ XF86ModePtr disp_mode_lst;
+ XF86OptionPtr disp_option_lst;
+ char *disp_comment;
+} XF86ConfDisplayRec, *XF86ConfDisplayPtr;
+
+typedef struct {
+ XF86OptionPtr flg_option_lst;
+ char *flg_comment;
+} XF86ConfFlagsRec, *XF86ConfFlagsPtr;
+
+typedef struct {
+ GenericListRec list;
+ char *al_adaptor_str;
+ XF86ConfVideoAdaptorPtr al_adaptor;
+} XF86ConfAdaptorLinkRec, *XF86ConfAdaptorLinkPtr;
+
+typedef struct {
+ GenericListRec list;
+ char *scrn_identifier;
+ char *scrn_obso_driver;
+ int scrn_defaultdepth;
+ int scrn_defaultbpp;
+ int scrn_defaultfbbpp;
+ char *scrn_monitor_str;
+ XF86ConfMonitorPtr scrn_monitor;
+ char *scrn_device_str;
+ XF86ConfDevicePtr scrn_device;
+ XF86ConfAdaptorLinkPtr scrn_adaptor_lst;
+ XF86ConfDisplayPtr scrn_display_lst;
+ XF86OptionPtr scrn_option_lst;
+ char *scrn_comment;
+ int scrn_virtualX, scrn_virtualY;
+} XF86ConfScreenRec, *XF86ConfScreenPtr;
+
+typedef struct {
+ GenericListRec list;
+ char *inp_identifier;
+ char *inp_driver;
+ XF86OptionPtr inp_option_lst;
+ char *inp_comment;
+} XF86ConfInputRec, *XF86ConfInputPtr;
+
+typedef struct {
+ GenericListRec list;
+ XF86ConfInputPtr iref_inputdev;
+ char *iref_inputdev_str;
+ XF86OptionPtr iref_option_lst;
+} XF86ConfInputrefRec, *XF86ConfInputrefPtr;
+
+typedef struct {
+ Bool set;
+ Bool val;
+} xf86TriState;
+
+typedef struct {
+ struct xorg_list entry;
+ char **values;
+} xf86MatchGroup;
+
+typedef struct {
+ GenericListRec list;
+ char *identifier;
+ char *driver;
+ struct xorg_list match_product;
+ struct xorg_list match_vendor;
+ struct xorg_list match_device;
+ struct xorg_list match_os;
+ struct xorg_list match_pnpid;
+ struct xorg_list match_usbid;
+ struct xorg_list match_driver;
+ struct xorg_list match_tag;
+ struct xorg_list match_layout;
+ xf86TriState is_keyboard;
+ xf86TriState is_pointer;
+ xf86TriState is_joystick;
+ xf86TriState is_tablet;
+ xf86TriState is_touchpad;
+ xf86TriState is_touchscreen;
+ XF86OptionPtr option_lst;
+ char *comment;
+} XF86ConfInputClassRec, *XF86ConfInputClassPtr;
/* Values for adj_where */
#define CONF_ADJ_OBSOLETE -1
@@ -379,141 +334,135 @@ XF86ConfInputClassRec, *XF86ConfInputClassPtr;
#define CONF_ADJ_BELOW 4
#define CONF_ADJ_RELATIVE 5
-typedef struct
-{
- GenericListRec list;
- int adj_scrnum;
- XF86ConfScreenPtr adj_screen;
- char *adj_screen_str;
- XF86ConfScreenPtr adj_top;
- char *adj_top_str;
- XF86ConfScreenPtr adj_bottom;
- char *adj_bottom_str;
- XF86ConfScreenPtr adj_left;
- char *adj_left_str;
- XF86ConfScreenPtr adj_right;
- char *adj_right_str;
- int adj_where;
- int adj_x;
- int adj_y;
- char *adj_refscreen;
-}
-XF86ConfAdjacencyRec, *XF86ConfAdjacencyPtr;
-
-typedef struct
-{
- GenericListRec list;
- char *inactive_device_str;
- XF86ConfDevicePtr inactive_device;
-}
-XF86ConfInactiveRec, *XF86ConfInactivePtr;
-
-typedef struct
-{
- GenericListRec list;
- char *lay_identifier;
- XF86ConfAdjacencyPtr lay_adjacency_lst;
- XF86ConfInactivePtr lay_inactive_lst;
- XF86ConfInputrefPtr lay_input_lst;
- XF86OptionPtr lay_option_lst;
- char *lay_comment;
-}
-XF86ConfLayoutRec, *XF86ConfLayoutPtr;
-
-typedef struct
-{
- GenericListRec list;
- char *vs_name;
- char *vs_identifier;
- XF86OptionPtr vs_option_lst;
- char *vs_comment;
-}
-XF86ConfVendSubRec, *XF86ConfVendSubPtr;
-
-typedef struct
-{
- GenericListRec list;
- char *vnd_identifier;
- XF86OptionPtr vnd_option_lst;
- XF86ConfVendSubPtr vnd_sub_lst;
- char *vnd_comment;
-}
-XF86ConfVendorRec, *XF86ConfVendorPtr;
-
-typedef struct
-{
- char *dri_group_name;
- int dri_group;
- int dri_mode;
- char *dri_comment;
-}
-XF86ConfDRIRec, *XF86ConfDRIPtr;
-
-typedef struct
-{
- XF86OptionPtr ext_option_lst;
- char *extensions_comment;
-}
-XF86ConfExtensionsRec, *XF86ConfExtensionsPtr;
-
-typedef struct
-{
- XF86ConfFilesPtr conf_files;
- XF86ConfModulePtr conf_modules;
- XF86ConfFlagsPtr conf_flags;
- XF86ConfVideoAdaptorPtr conf_videoadaptor_lst;
- XF86ConfModesPtr conf_modes_lst;
- XF86ConfMonitorPtr conf_monitor_lst;
- XF86ConfDevicePtr conf_device_lst;
- XF86ConfScreenPtr conf_screen_lst;
- XF86ConfInputPtr conf_input_lst;
- XF86ConfInputClassPtr conf_inputclass_lst;
- XF86ConfLayoutPtr conf_layout_lst;
- XF86ConfVendorPtr conf_vendor_lst;
- XF86ConfDRIPtr conf_dri;
- XF86ConfExtensionsPtr conf_extensions;
- char *conf_comment;
-}
-XF86ConfigRec, *XF86ConfigPtr;
-
-typedef struct
-{
- int token; /* id of the token */
- char *name; /* pointer to the LOWERCASED name */
-}
-xf86ConfigSymTabRec, *xf86ConfigSymTabPtr;
+typedef struct {
+ GenericListRec list;
+ int adj_scrnum;
+ XF86ConfScreenPtr adj_screen;
+ char *adj_screen_str;
+ XF86ConfScreenPtr adj_top;
+ char *adj_top_str;
+ XF86ConfScreenPtr adj_bottom;
+ char *adj_bottom_str;
+ XF86ConfScreenPtr adj_left;
+ char *adj_left_str;
+ XF86ConfScreenPtr adj_right;
+ char *adj_right_str;
+ int adj_where;
+ int adj_x;
+ int adj_y;
+ char *adj_refscreen;
+} XF86ConfAdjacencyRec, *XF86ConfAdjacencyPtr;
+
+typedef struct {
+ GenericListRec list;
+ char *inactive_device_str;
+ XF86ConfDevicePtr inactive_device;
+} XF86ConfInactiveRec, *XF86ConfInactivePtr;
+
+typedef struct {
+ GenericListRec list;
+ char *lay_identifier;
+ XF86ConfAdjacencyPtr lay_adjacency_lst;
+ XF86ConfInactivePtr lay_inactive_lst;
+ XF86ConfInputrefPtr lay_input_lst;
+ XF86OptionPtr lay_option_lst;
+ char *lay_comment;
+} XF86ConfLayoutRec, *XF86ConfLayoutPtr;
+
+typedef struct {
+ GenericListRec list;
+ char *vs_name;
+ char *vs_identifier;
+ XF86OptionPtr vs_option_lst;
+ char *vs_comment;
+} XF86ConfVendSubRec, *XF86ConfVendSubPtr;
+
+typedef struct {
+ GenericListRec list;
+ char *vnd_identifier;
+ XF86OptionPtr vnd_option_lst;
+ XF86ConfVendSubPtr vnd_sub_lst;
+ char *vnd_comment;
+} XF86ConfVendorRec, *XF86ConfVendorPtr;
+
+typedef struct {
+ char *dri_group_name;
+ int dri_group;
+ int dri_mode;
+ char *dri_comment;
+} XF86ConfDRIRec, *XF86ConfDRIPtr;
+
+typedef struct {
+ XF86OptionPtr ext_option_lst;
+ char *extensions_comment;
+} XF86ConfExtensionsRec, *XF86ConfExtensionsPtr;
+
+typedef struct {
+ XF86ConfFilesPtr conf_files;
+ XF86ConfModulePtr conf_modules;
+ XF86ConfFlagsPtr conf_flags;
+ XF86ConfVideoAdaptorPtr conf_videoadaptor_lst;
+ XF86ConfModesPtr conf_modes_lst;
+ XF86ConfMonitorPtr conf_monitor_lst;
+ XF86ConfDevicePtr conf_device_lst;
+ XF86ConfScreenPtr conf_screen_lst;
+ XF86ConfInputPtr conf_input_lst;
+ XF86ConfInputClassPtr conf_inputclass_lst;
+ XF86ConfLayoutPtr conf_layout_lst;
+ XF86ConfVendorPtr conf_vendor_lst;
+ XF86ConfDRIPtr conf_dri;
+ XF86ConfExtensionsPtr conf_extensions;
+ char *conf_comment;
+} XF86ConfigRec, *XF86ConfigPtr;
+
+typedef struct {
+ int token; /* id of the token */
+ const char *name; /* pointer to the LOWERCASED name */
+} xf86ConfigSymTabRec, *xf86ConfigSymTabPtr;
/*
* prototypes for public functions
*/
extern void xf86initConfigFiles(void);
-extern const char *xf86openConfigFile(const char *path, const char *cmdline,
- const char *projroot);
-extern const char *xf86openConfigDirFiles(const char *path, const char *cmdline,
- const char *projroot);
+extern char *xf86openConfigFile(const char *path, const char *cmdline,
+ const char *projroot);
+extern char *xf86openConfigDirFiles(const char *path, const char *cmdline,
+ const char *projroot);
extern void xf86setBuiltinConfig(const char *config[]);
extern XF86ConfigPtr xf86readConfigFile(void);
extern void xf86closeConfigFile(void);
extern void xf86freeConfig(XF86ConfigPtr p);
extern int xf86writeConfigFile(const char *, XF86ConfigPtr);
-extern _X_EXPORT XF86ConfDevicePtr xf86findDevice(const char *ident, XF86ConfDevicePtr p);
-extern _X_EXPORT XF86ConfLayoutPtr xf86findLayout(const char *name, XF86ConfLayoutPtr list);
-extern _X_EXPORT XF86ConfMonitorPtr xf86findMonitor(const char *ident, XF86ConfMonitorPtr p);
-extern _X_EXPORT XF86ConfModesPtr xf86findModes(const char *ident, XF86ConfModesPtr p);
-extern _X_EXPORT XF86ConfModeLinePtr xf86findModeLine(const char *ident, XF86ConfModeLinePtr p);
-extern _X_EXPORT XF86ConfScreenPtr xf86findScreen(const char *ident, XF86ConfScreenPtr p);
-extern _X_EXPORT XF86ConfInputPtr xf86findInput(const char *ident, XF86ConfInputPtr p);
-extern _X_EXPORT XF86ConfInputPtr xf86findInputByDriver(const char *driver, XF86ConfInputPtr p);
+extern _X_EXPORT XF86ConfDevicePtr xf86findDevice(const char *ident,
+ XF86ConfDevicePtr p);
+extern _X_EXPORT XF86ConfLayoutPtr xf86findLayout(const char *name,
+ XF86ConfLayoutPtr list);
+extern _X_EXPORT XF86ConfMonitorPtr xf86findMonitor(const char *ident,
+ XF86ConfMonitorPtr p);
+extern _X_EXPORT XF86ConfModesPtr xf86findModes(const char *ident,
+ XF86ConfModesPtr p);
+extern _X_EXPORT XF86ConfModeLinePtr xf86findModeLine(const char *ident,
+ XF86ConfModeLinePtr p);
+extern _X_EXPORT XF86ConfScreenPtr xf86findScreen(const char *ident,
+ XF86ConfScreenPtr p);
+extern _X_EXPORT XF86ConfInputPtr xf86findInput(const char *ident,
+ XF86ConfInputPtr p);
+extern _X_EXPORT XF86ConfInputPtr xf86findInputByDriver(const char *driver,
+ XF86ConfInputPtr p);
extern _X_EXPORT XF86ConfVideoAdaptorPtr xf86findVideoAdaptor(const char *ident,
- XF86ConfVideoAdaptorPtr p);
-extern int xf86layoutAddInputDevices(XF86ConfigPtr config, XF86ConfLayoutPtr layout);
+ XF86ConfVideoAdaptorPtr
+ p);
+extern int xf86layoutAddInputDevices(XF86ConfigPtr config,
+ XF86ConfLayoutPtr layout);
-extern _X_EXPORT GenericListPtr xf86addListItem(GenericListPtr head, GenericListPtr c_new);
-extern _X_EXPORT int xf86itemNotSublist(GenericListPtr list_1, GenericListPtr list_2);
+extern _X_EXPORT GenericListPtr xf86addListItem(GenericListPtr head,
+ GenericListPtr c_new);
+extern _X_EXPORT int xf86itemNotSublist(GenericListPtr list_1,
+ GenericListPtr list_2);
extern _X_EXPORT int xf86pathIsAbsolute(const char *path);
extern _X_EXPORT int xf86pathIsSafe(const char *path);
extern _X_EXPORT char *xf86addComment(char *cur, char *add);
extern _X_EXPORT Bool xf86getBoolValue(Bool *val, const char *str);
-#endif /* _xf86Parser_h_ */
+#endif /* _xf86Parser_h_ */
diff --git a/xserver/hw/xfree86/parser/xf86tokens.h b/xserver/hw/xfree86/parser/xf86tokens.h
index abcafcf8e..f751b7b0e 100644
--- a/xserver/hw/xfree86/parser/xf86tokens.h
+++ b/xserver/hw/xfree86/parser/xf86tokens.h
@@ -52,7 +52,6 @@
* authorization from the copyright holder(s) and author(s).
*/
-
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
@@ -70,13 +69,13 @@
typedef enum {
/* errno-style tokens */
- OBSOLETE_TOKEN = -5,
- EOF_TOKEN = -4,
- LOCK_TOKEN = -3,
- ERROR_TOKEN = -2,
+ OBSOLETE_TOKEN = -5,
+ EOF_TOKEN = -4,
+ LOCK_TOKEN = -3,
+ ERROR_TOKEN = -2,
/* value type tokens */
- NUMBER = 1,
+ NUMBER = 1,
STRING,
/* Tokens that can appear in many sections */
@@ -148,7 +147,7 @@ typedef enum {
DEFAULTDEPTH,
DEFAULTBPP,
DEFAULTFBBPP,
-
+
/* VideoAdaptor tokens */
VIDEOADAPTOR,
@@ -170,7 +169,7 @@ typedef enum {
LOAD,
LOAD_DRIVER,
DISABLE,
-
+
/* Device tokens */
DRIVER,
CHIPSET,
@@ -207,8 +206,6 @@ typedef enum {
XKBLAYOUT,
XKBVARIANT,
XKBOPTIONS,
- /* The next two have become ServerFlags options */
- VTSYSREQ,
/* Obsolete keyboard tokens */
SERVERNUM,
LEFTALT,
@@ -253,7 +250,7 @@ typedef enum {
DEPTH,
BPP,
WEIGHT,
-
+
/* Layout Tokens */
SCREEN,
INACTIVE,
@@ -291,4 +288,4 @@ typedef enum {
MATCH_IS_TOUCHSCREEN
} ParserTokens;
-#endif /* _xf86_tokens_h */
+#endif /* _xf86_tokens_h */