diff options
Diffstat (limited to 'xorg-server/hw/xfree86/parser')
-rw-r--r-- | xorg-server/hw/xfree86/parser/InputClass.c | 80 | ||||
-rw-r--r-- | xorg-server/hw/xfree86/parser/Makefile.in | 32 | ||||
-rw-r--r-- | xorg-server/hw/xfree86/parser/scan.c | 26 | ||||
-rw-r--r-- | xorg-server/hw/xfree86/parser/xf86Parser.h | 7 | ||||
-rw-r--r-- | xorg-server/hw/xfree86/parser/xf86tokens.h | 1 |
5 files changed, 120 insertions, 26 deletions
diff --git a/xorg-server/hw/xfree86/parser/InputClass.c b/xorg-server/hw/xfree86/parser/InputClass.c index 1c9816012..7fb2866cd 100644 --- a/xorg-server/hw/xfree86/parser/InputClass.c +++ b/xorg-server/hw/xfree86/parser/InputClass.c @@ -29,6 +29,8 @@ #include <xorg-config.h> #endif +#include <string.h> +#include "os.h" #include "xf86Parser.h" #include "xf86tokens.h" #include "Configint.h" @@ -45,6 +47,7 @@ xf86ConfigSymTabRec InputClassTab[] = {MATCH_PRODUCT, "matchproduct"}, {MATCH_VENDOR, "matchvendor"}, {MATCH_DEVICE_PATH, "matchdevicepath"}, + {MATCH_TAG, "matchtag"}, {MATCH_IS_KEYBOARD, "matchiskeyboard"}, {MATCH_IS_POINTER, "matchispointer"}, {MATCH_IS_JOYSTICK, "matchisjoystick"}, @@ -56,6 +59,8 @@ xf86ConfigSymTabRec InputClassTab[] = #define CLEANUP xf86freeInputClassList +#define TOKEN_SEP "|" + XF86ConfInputClassPtr xf86parseInputClassSection(void) { @@ -91,17 +96,22 @@ xf86parseInputClassSection(void) case MATCH_PRODUCT: if (xf86getSubToken(&(ptr->comment)) != STRING) Error(QUOTE_MSG, "MatchProduct"); - ptr->match_product = val.str; + ptr->match_product = xstrtokenize(val.str, TOKEN_SEP); break; case MATCH_VENDOR: if (xf86getSubToken(&(ptr->comment)) != STRING) Error(QUOTE_MSG, "MatchVendor"); - ptr->match_vendor = val.str; + ptr->match_vendor = xstrtokenize(val.str, TOKEN_SEP); break; case MATCH_DEVICE_PATH: if (xf86getSubToken(&(ptr->comment)) != STRING) Error(QUOTE_MSG, "MatchDevicePath"); - ptr->match_device = val.str; + ptr->match_device = xstrtokenize(val.str, TOKEN_SEP); + break; + case MATCH_TAG: + if (xf86getSubToken(&(ptr->comment)) != STRING) + Error(QUOTE_MSG, "MatchTag"); + ptr->match_tag = xstrtokenize(val.str, TOKEN_SEP); break; case MATCH_IS_KEYBOARD: if (xf86getSubToken(&(ptr->comment)) != STRING) @@ -173,6 +183,8 @@ xf86parseInputClassSection(void) void xf86printInputClassSection (FILE * cf, XF86ConfInputClassPtr ptr) { + char **list; + while (ptr) { fprintf(cf, "Section \"InputClass\"\n"); if (ptr->comment) @@ -181,12 +193,38 @@ xf86printInputClassSection (FILE * cf, XF86ConfInputClassPtr ptr) fprintf(cf, "\tIdentifier \"%s\"\n", ptr->identifier); if (ptr->driver) fprintf(cf, "\tDriver \"%s\"\n", ptr->driver); - if (ptr->match_product) - fprintf(cf, "\tMatchProduct \"%s\"\n", ptr->match_product); - if (ptr->match_vendor) - fprintf(cf, "\tMatchVendor \"%s\"\n", ptr->match_vendor); - if (ptr->match_device) - fprintf(cf, "\tMatchDevicePath \"%s\"\n", ptr->match_device); + if (ptr->match_product) { + fprintf(cf, "\tMatchProduct \""); + for (list = ptr->match_product; *list; list++) + fprintf(cf, "%s%s", + list == ptr->match_product ? "" : TOKEN_SEP, + *list); + fprintf(cf, "\"\n"); + } + if (ptr->match_vendor) { + fprintf(cf, "\tMatchVendor \""); + for (list = ptr->match_vendor; *list; list++) + fprintf(cf, "%s%s", + list == ptr->match_vendor ? "" : TOKEN_SEP, + *list); + fprintf(cf, "\"\n"); + } + if (ptr->match_device) { + fprintf(cf, "\tMatchDevicePath \""); + for (list = ptr->match_device; *list; list++) + fprintf(cf, "%s%s", + list == ptr->match_device ? "" : TOKEN_SEP, + *list); + fprintf(cf, "\"\n"); + } + if (ptr->match_tag) { + fprintf(cf, "\tMatchTag \""); + for (list = ptr->match_tag; *list; list++) + fprintf(cf, "%s%s", + list == ptr->match_tag ? "" : TOKEN_SEP, + *list); + fprintf(cf, "\"\n"); + } if (ptr->is_keyboard.set) fprintf(cf, "\tIsKeyboard \"%s\"\n", ptr->is_keyboard.val ? "yes" : "no"); @@ -215,13 +253,31 @@ void xf86freeInputClassList (XF86ConfInputClassPtr ptr) { XF86ConfInputClassPtr prev; + char **list; while (ptr) { TestFree(ptr->identifier); TestFree(ptr->driver); - TestFree(ptr->match_product); - TestFree(ptr->match_vendor); - TestFree(ptr->match_device); + if (ptr->match_product) { + for (list = ptr->match_product; *list; list++) + free(*list); + free(ptr->match_product); + } + if (ptr->match_vendor) { + for (list = ptr->match_vendor; *list; list++) + free(*list); + free(ptr->match_vendor); + } + if (ptr->match_device) { + for (list = ptr->match_device; *list; list++) + free(*list); + free(ptr->match_device); + } + if (ptr->match_tag) { + for (list = ptr->match_tag; *list; list++) + free(*list); + free(ptr->match_tag); + } TestFree(ptr->comment); xf86optionListFree(ptr->option_lst); diff --git a/xorg-server/hw/xfree86/parser/Makefile.in b/xorg-server/hw/xfree86/parser/Makefile.in index 863513cd9..1b31c622d 100644 --- a/xorg-server/hw/xfree86/parser/Makefile.in +++ b/xorg-server/hw/xfree86/parser/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.11 from Makefile.am. +# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -94,6 +94,7 @@ am__objects_1 = libxf86config_a-Device.$(OBJEXT) \ libxf86config_a-Files.$(OBJEXT) \ libxf86config_a-Flags.$(OBJEXT) \ libxf86config_a-Input.$(OBJEXT) \ + libxf86config_a-InputClass.$(OBJEXT) \ libxf86config_a-Layout.$(OBJEXT) \ libxf86config_a-Module.$(OBJEXT) \ libxf86config_a-Video.$(OBJEXT) \ @@ -108,9 +109,9 @@ am_libxf86config_a_OBJECTS = $(am__objects_1) libxf86config_a_OBJECTS = $(am_libxf86config_a_OBJECTS) LTLIBRARIES = $(noinst_LTLIBRARIES) libxf86config_internal_la_LIBADD = -am__objects_2 = Device.lo Files.lo Flags.lo Input.lo Layout.lo \ - Module.lo Video.lo Monitor.lo Pointer.lo Screen.lo Vendor.lo \ - read.lo scan.lo write.lo DRI.lo Extensions.lo +am__objects_2 = Device.lo Files.lo Flags.lo Input.lo InputClass.lo \ + Layout.lo Module.lo Video.lo Monitor.lo Pointer.lo Screen.lo \ + Vendor.lo read.lo scan.lo write.lo DRI.lo Extensions.lo am_libxf86config_internal_la_OBJECTS = $(am__objects_2) libxf86config_internal_la_OBJECTS = \ $(am_libxf86config_internal_la_OBJECTS) @@ -320,8 +321,11 @@ SHELL = @SHELL@ SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@ SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ STRIP = @STRIP@ +SYSCONFDIR = @SYSCONFDIR@ TSLIB_CFLAGS = @TSLIB_CFLAGS@ TSLIB_LIBS = @TSLIB_LIBS@ +UDEV_CFLAGS = @UDEV_CFLAGS@ +UDEV_LIBS = @UDEV_LIBS@ UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ VERSION = @VERSION@ @@ -381,6 +385,7 @@ XWIN_SERVER_NAME = @XWIN_SERVER_NAME@ XWIN_SYS_LIBS = @XWIN_SYS_LIBS@ YACC = @YACC@ YFLAGS = @YFLAGS@ +__XCONFIGDIR__ = @__XCONFIGDIR__@ __XCONFIGFILE__ = @__XCONFIGFILE__@ abi_ansic = @abi_ansic@ abi_extension = @abi_extension@ @@ -456,6 +461,7 @@ INTERNAL_SOURCES = \ Files.c \ Flags.c \ Input.c \ + InputClass.c \ Layout.c \ Module.c \ Video.c \ @@ -582,6 +588,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Files.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Flags.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Input.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/InputClass.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Layout.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Module.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Monitor.Plo@am__quote@ @@ -595,6 +602,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libxf86config_a-Files.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libxf86config_a-Flags.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libxf86config_a-Input.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libxf86config_a-InputClass.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libxf86config_a-Layout.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libxf86config_a-Module.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libxf86config_a-Monitor.Po@am__quote@ @@ -697,6 +705,22 @@ libxf86config_a-Input.obj: Input.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libxf86config_a_CFLAGS) $(CFLAGS) -c -o libxf86config_a-Input.obj `if test -f 'Input.c'; then $(CYGPATH_W) 'Input.c'; else $(CYGPATH_W) '$(srcdir)/Input.c'; fi` +libxf86config_a-InputClass.o: InputClass.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libxf86config_a_CFLAGS) $(CFLAGS) -MT libxf86config_a-InputClass.o -MD -MP -MF $(DEPDIR)/libxf86config_a-InputClass.Tpo -c -o libxf86config_a-InputClass.o `test -f 'InputClass.c' || echo '$(srcdir)/'`InputClass.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libxf86config_a-InputClass.Tpo $(DEPDIR)/libxf86config_a-InputClass.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='InputClass.c' object='libxf86config_a-InputClass.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libxf86config_a_CFLAGS) $(CFLAGS) -c -o libxf86config_a-InputClass.o `test -f 'InputClass.c' || echo '$(srcdir)/'`InputClass.c + +libxf86config_a-InputClass.obj: InputClass.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libxf86config_a_CFLAGS) $(CFLAGS) -MT libxf86config_a-InputClass.obj -MD -MP -MF $(DEPDIR)/libxf86config_a-InputClass.Tpo -c -o libxf86config_a-InputClass.obj `if test -f 'InputClass.c'; then $(CYGPATH_W) 'InputClass.c'; else $(CYGPATH_W) '$(srcdir)/InputClass.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libxf86config_a-InputClass.Tpo $(DEPDIR)/libxf86config_a-InputClass.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='InputClass.c' object='libxf86config_a-InputClass.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libxf86config_a_CFLAGS) $(CFLAGS) -c -o libxf86config_a-InputClass.obj `if test -f 'InputClass.c'; then $(CYGPATH_W) 'InputClass.c'; else $(CYGPATH_W) '$(srcdir)/InputClass.c'; fi` + libxf86config_a-Layout.o: Layout.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libxf86config_a_CFLAGS) $(CFLAGS) -MT libxf86config_a-Layout.o -MD -MP -MF $(DEPDIR)/libxf86config_a-Layout.Tpo -c -o libxf86config_a-Layout.o `test -f 'Layout.c' || echo '$(srcdir)/'`Layout.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libxf86config_a-Layout.Tpo $(DEPDIR)/libxf86config_a-Layout.Po diff --git a/xorg-server/hw/xfree86/parser/scan.c b/xorg-server/hw/xfree86/parser/scan.c index b80fbfb8f..03cbc8a44 100644 --- a/xorg-server/hw/xfree86/parser/scan.c +++ b/xorg-server/hw/xfree86/parser/scan.c @@ -227,13 +227,15 @@ xf86getNextLine(void) configFiles[curFileIndex].file); if (!ret) { - /* stop if there are no more files */ - if (++curFileIndex >= numFiles) { - curFileIndex = 0; + /* + * 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; - } - configLineNo = 0; - continue; } /* search for EOL in the new block of chars */ @@ -338,7 +340,17 @@ again: } if (ret == NULL) { - return (pushToken = EOF_TOKEN); + /* + * 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; diff --git a/xorg-server/hw/xfree86/parser/xf86Parser.h b/xorg-server/hw/xfree86/parser/xf86Parser.h index 5e8351fc4..d79544a20 100644 --- a/xorg-server/hw/xfree86/parser/xf86Parser.h +++ b/xorg-server/hw/xfree86/parser/xf86Parser.h @@ -343,9 +343,10 @@ typedef struct GenericListRec list; char *identifier; char *driver; - char *match_product; - char *match_vendor; - char *match_device; + char **match_product; + char **match_vendor; + char **match_device; + char **match_tag; xf86TriState is_keyboard; xf86TriState is_pointer; xf86TriState is_joystick; diff --git a/xorg-server/hw/xfree86/parser/xf86tokens.h b/xorg-server/hw/xfree86/parser/xf86tokens.h index e3a9d716b..cb600704b 100644 --- a/xorg-server/hw/xfree86/parser/xf86tokens.h +++ b/xorg-server/hw/xfree86/parser/xf86tokens.h @@ -279,6 +279,7 @@ typedef enum { MATCH_PRODUCT, MATCH_VENDOR, MATCH_DEVICE_PATH, + MATCH_TAG, MATCH_IS_KEYBOARD, MATCH_IS_POINTER, MATCH_IS_JOYSTICK, |