aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2011-12-16 20:45:15 +0100
committerMarc Haesen <marc@hc-consult.be>2011-12-16 20:45:15 +0100
commit47913e82955ec8e2b1ba4d4b145497dede9163b5 (patch)
treed23c322caf26864270171d54eb2805cee2721e4d /xorg-server/hw
parent53d28537755790ee4625dc16f560cad5aa93f56b (diff)
downloadvcxsrv-47913e82955ec8e2b1ba4d4b145497dede9163b5.tar.gz
vcxsrv-47913e82955ec8e2b1ba4d4b145497dede9163b5.tar.bz2
vcxsrv-47913e82955ec8e2b1ba4d4b145497dede9163b5.zip
xserver git update 16 dec 2011
Diffstat (limited to 'xorg-server/hw')
-rw-r--r--xorg-server/hw/dmx/glxProxy/Makefile.am2
-rw-r--r--xorg-server/hw/kdrive/src/kdrive.c15
-rw-r--r--xorg-server/hw/kdrive/src/kdrive.h8
-rw-r--r--xorg-server/hw/xfree86/common/xf86.h2
-rw-r--r--xorg-server/hw/xfree86/common/xf86Config.c19
-rw-r--r--xorg-server/hw/xfree86/common/xf86Configure.c5
-rw-r--r--xorg-server/hw/xfree86/common/xf86DGA.c4
-rw-r--r--xorg-server/hw/xfree86/common/xf86Helper.c11
-rw-r--r--xorg-server/hw/xfree86/common/xf86Priv.h6
-rw-r--r--xorg-server/hw/xfree86/common/xf86Xinput.h2
-rw-r--r--xorg-server/hw/xfree86/modes/xf86Modes.h4
-rw-r--r--xorg-server/hw/xfree86/parser/Configint.h426
-rw-r--r--xorg-server/hw/xfree86/parser/DRI.c246
-rw-r--r--xorg-server/hw/xfree86/parser/Device.c742
-rw-r--r--xorg-server/hw/xfree86/parser/Extensions.c2
-rw-r--r--xorg-server/hw/xfree86/parser/Files.c2
-rw-r--r--xorg-server/hw/xfree86/parser/Flags.c4
-rw-r--r--xorg-server/hw/xfree86/parser/Input.c426
-rw-r--r--xorg-server/hw/xfree86/parser/InputClass.c4
-rw-r--r--xorg-server/hw/xfree86/parser/Layout.c28
-rw-r--r--xorg-server/hw/xfree86/parser/Module.c4
-rw-r--r--xorg-server/hw/xfree86/parser/Monitor.c1794
-rw-r--r--xorg-server/hw/xfree86/parser/Pointer.c466
-rw-r--r--xorg-server/hw/xfree86/parser/Screen.c1138
-rw-r--r--xorg-server/hw/xfree86/parser/Vendor.c6
-rw-r--r--xorg-server/hw/xfree86/parser/Video.c592
-rw-r--r--xorg-server/hw/xfree86/parser/configProcs.h4
-rw-r--r--xorg-server/hw/xfree86/x86emu/debug.c4
-rw-r--r--xorg-server/hw/xfree86/x86emu/fpu.c16
-rw-r--r--xorg-server/hw/xfree86/x86emu/ops2.c4
-rw-r--r--xorg-server/hw/xfree86/x86emu/x86emu/debug.h4
31 files changed, 2986 insertions, 3004 deletions
diff --git a/xorg-server/hw/dmx/glxProxy/Makefile.am b/xorg-server/hw/dmx/glxProxy/Makefile.am
index 851604883..4ee1036b3 100644
--- a/xorg-server/hw/dmx/glxProxy/Makefile.am
+++ b/xorg-server/hw/dmx/glxProxy/Makefile.am
@@ -1,10 +1,12 @@
noinst_LIBRARIES = libglxproxy.a
libglxproxy_a_SOURCES = compsize.c \
+ compsize.h \
g_disptab.c \
g_disptab.h \
global.c \
glxcmds.c \
+ glxcmds.h \
glxcmdsswap.c \
glxcontext.h \
glxdrawable.h \
diff --git a/xorg-server/hw/kdrive/src/kdrive.c b/xorg-server/hw/kdrive/src/kdrive.c
index 8dd039e1d..f6cc351cd 100644
--- a/xorg-server/hw/kdrive/src/kdrive.c
+++ b/xorg-server/hw/kdrive/src/kdrive.c
@@ -113,19 +113,14 @@ KdDisableScreen (ScreenPtr pScreen)
}
static void
-KdDoSwitchCmd (char *reason)
+KdDoSwitchCmd (const char *reason)
{
if (kdSwitchCmd)
{
- char *command = malloc(strlen (kdSwitchCmd) +
- 1 +
- strlen (reason) +
- 1);
- if (!command)
+ char *command;
+
+ if (asprintf(&command, "%s %s", kdSwitchCmd, reason) == -1)
return;
- strcpy (command, kdSwitchCmd);
- strcat (command, " ");
- strcat (command, reason);
system (command);
free(command);
}
@@ -258,7 +253,7 @@ Bool kdDumbDriver;
Bool kdSoftCursor;
char *
-KdParseFindNext (char *cur, char *delim, char *save, char *last)
+KdParseFindNext (char *cur, const char *delim, char *save, char *last)
{
while (*cur && !strchr (delim, *cur))
{
diff --git a/xorg-server/hw/kdrive/src/kdrive.h b/xorg-server/hw/kdrive/src/kdrive.h
index 9ac5a19d7..cda965d84 100644
--- a/xorg-server/hw/kdrive/src/kdrive.h
+++ b/xorg-server/hw/kdrive/src/kdrive.h
@@ -424,7 +424,7 @@ KdKeyboardInfo *
KdParseKeyboard (char *arg);
char *
-KdParseFindNext (char *cur, char *delim, char *save, char *last);
+KdParseFindNext (char *cur, const char *delim, char *save, char *last);
void
KdParseRgba (char *rgba);
@@ -503,12 +503,6 @@ KdInitInput(void);
void
KdCloseInput(void);
-void
-KdAddPointerDriver(KdPointerDriver *);
-
-void
-KdAddKeyboardDriver(KdKeyboardDriver *);
-
Bool
KdRegisterFd (int fd, void (*read) (int fd, void *closure), void *closure);
diff --git a/xorg-server/hw/xfree86/common/xf86.h b/xorg-server/hw/xfree86/common/xf86.h
index f216d5e8c..b711f0555 100644
--- a/xorg-server/hw/xfree86/common/xf86.h
+++ b/xorg-server/hw/xfree86/common/xf86.h
@@ -232,7 +232,7 @@ extern _X_EXPORT void xf86SetDpi(ScrnInfoPtr pScrn, int x, int y);
extern _X_EXPORT void xf86SetBlackWhitePixels(ScreenPtr pScreen);
extern _X_EXPORT void xf86EnableDisableFBAccess(int scrnIndex, Bool enable);
extern _X_EXPORT void xf86VDrvMsgVerb(int scrnIndex, MessageType type, int verb,
- const char *format, va_list args);
+ const char *format, va_list args) _X_ATTRIBUTE_PRINTF(4,0);
extern _X_EXPORT void xf86DrvMsgVerb(int scrnIndex, MessageType type, int verb,
const char *format, ...) _X_ATTRIBUTE_PRINTF(4,5);
extern _X_EXPORT void xf86DrvMsg(int scrnIndex, MessageType type, const char *format, ...)
diff --git a/xorg-server/hw/xfree86/common/xf86Config.c b/xorg-server/hw/xfree86/common/xf86Config.c
index fef4bf1fe..569695c8a 100644
--- a/xorg-server/hw/xfree86/common/xf86Config.c
+++ b/xorg-server/hw/xfree86/common/xf86Config.c
@@ -552,7 +552,7 @@ xf86DriverlistFromCompile(void)
* Print a READABLE ErrorMessage!!! All information that is
* available is printed.
*/
-static void
+static void _X_ATTRIBUTE_PRINTF(1,2)
xf86ConfigError(const char *msg, ...)
{
va_list ap;
@@ -2300,15 +2300,16 @@ checkInput(serverLayoutPtr layout, Bool implicit_layout) {
ConfigStatus
xf86HandleConfigFile(Bool autoconfig)
{
- char *filename, *dirname, *sysdirname;
- const char *filesearch, *dirsearch;
- MessageType filefrom = X_DEFAULT;
- MessageType dirfrom = X_DEFAULT;
char *scanptr;
Bool singlecard = 0;
Bool implicit_layout = FALSE;
if (!autoconfig) {
+ char *filename, *dirname, *sysdirname;
+ const char *filesearch, *dirsearch;
+ MessageType filefrom = X_DEFAULT;
+ MessageType dirfrom = X_DEFAULT;
+
if (getuid() == 0) {
filesearch = ROOT_CONFIGPATH;
dirsearch = ROOT_CONFIGDIRPATH;
@@ -2350,11 +2351,11 @@ xf86HandleConfigFile(Bool autoconfig)
sysdirname);
if (!filename && !dirname && !sysdirname)
return CONFIG_NOFILE;
- }
- free(filename);
- free(dirname);
- free(sysdirname);
+ free(filename);
+ free(dirname);
+ free(sysdirname);
+ }
if ((xf86configptr = xf86readConfigFile ()) == NULL) {
xf86Msg(X_ERROR, "Problem parsing the config file\n");
diff --git a/xorg-server/hw/xfree86/common/xf86Configure.c b/xorg-server/hw/xfree86/common/xf86Configure.c
index 24f367ec0..994d46fc2 100644
--- a/xorg-server/hw/xfree86/common/xf86Configure.c
+++ b/xorg-server/hw/xfree86/common/xf86Configure.c
@@ -778,7 +778,8 @@ void DoShowOptions (void) {
free(vlist);
for (i = 0; i < xf86NumDrivers; i++) {
if (xf86DriverList[i]->AvailableOptions) {
- OptionInfoPtr pOption = (OptionInfoPtr)(*xf86DriverList[i]->AvailableOptions)(0,0);
+ const OptionInfoRec *pOption =
+ (*xf86DriverList[i]->AvailableOptions)(0,0);
if (! pOption) {
ErrorF ("(EE) Couldn't read option table for %s driver\n",
xf86DriverList[i]->driverName
@@ -790,7 +791,7 @@ void DoShowOptions (void) {
initData = LoaderSymbol (pSymbol);
if (initData) {
XF86ModuleVersionInfo *vers = initData->vers;
- OptionInfoPtr p;
+ const OptionInfoRec *p;
ErrorF ("Driver[%d]:%s[%s] {\n",
i,xf86DriverList[i]->driverName,vers->vendor
);
diff --git a/xorg-server/hw/xfree86/common/xf86DGA.c b/xorg-server/hw/xfree86/common/xf86DGA.c
index 46e3005fa..0c958cdf3 100644
--- a/xorg-server/hw/xfree86/common/xf86DGA.c
+++ b/xorg-server/hw/xfree86/common/xf86DGA.c
@@ -1037,7 +1037,7 @@ DGAProcessKeyboardEvent (ScreenPtr pScreen, DGAEvent *event, DeviceIntPtr keybd)
if (pScreenPriv->client)
{
dgaEvent de;
- de.u.u.type = *XDGAEventBase + GetCoreType((InternalEvent*)&ev);
+ de.u.u.type = *XDGAEventBase + GetCoreType(ev.type);
de.u.u.detail = event->detail;
de.u.event.time = event->time;
de.u.event.dx = event->dx;
@@ -1091,7 +1091,7 @@ DGAProcessPointerEvent (ScreenPtr pScreen, DGAEvent *event, DeviceIntPtr mouse)
dgaEvent de;
int coreEquiv;
- coreEquiv = GetCoreType((InternalEvent*)&ev);
+ coreEquiv = GetCoreType(ev.type);
de.u.u.type = *XDGAEventBase + coreEquiv;
de.u.u.detail = event->detail;
diff --git a/xorg-server/hw/xfree86/common/xf86Helper.c b/xorg-server/hw/xfree86/common/xf86Helper.c
index d99522cf6..248ccf47e 100644
--- a/xorg-server/hw/xfree86/common/xf86Helper.c
+++ b/xorg-server/hw/xfree86/common/xf86Helper.c
@@ -1734,7 +1734,6 @@ xf86RegisterRootWindowProperty(int ScrnIndex, Atom property, Atom type,
int format, unsigned long len, pointer value )
{
RootWinPropPtr pNewProp = NULL, pRegProp;
- int i;
Bool existing = FALSE;
DebugF("xf86RegisterRootWindowProperty(%d, %ld, %ld, %d, %ld, %p)\n",
@@ -1775,15 +1774,11 @@ xf86RegisterRootWindowProperty(int ScrnIndex, Atom property, Atom type,
DebugF("new property filled\n");
- if (NULL==xf86RegisteredPropertiesTable) {
+ if (xf86RegisteredPropertiesTable == NULL) {
DebugF("creating xf86RegisteredPropertiesTable[] size %d\n",
xf86NumScreens);
- if ( NULL==(xf86RegisteredPropertiesTable=(RootWinPropPtr*)xnfcalloc(sizeof(RootWinProp),xf86NumScreens) )) {
- return BadAlloc;
- }
- for (i=0; i<xf86NumScreens; i++) {
- xf86RegisteredPropertiesTable[i] = NULL;
- }
+ xf86RegisteredPropertiesTable =
+ xnfcalloc(sizeof(RootWinProp), xf86NumScreens);
}
DebugF("xf86RegisteredPropertiesTable %p\n",
diff --git a/xorg-server/hw/xfree86/common/xf86Priv.h b/xorg-server/hw/xfree86/common/xf86Priv.h
index 8c698591e..e0b18098e 100644
--- a/xorg-server/hw/xfree86/common/xf86Priv.h
+++ b/xorg-server/hw/xfree86/common/xf86Priv.h
@@ -125,10 +125,8 @@ extern _X_EXPORT const DisplayModeRec xf86DefaultModes[];
extern _X_EXPORT const int xf86NumDefaultModes;
/* xf86Configure.c */
-extern _X_EXPORT void DoConfigure(void);
-
-/* xf86ShowOpts.c */
-extern _X_EXPORT void DoShowOptions(void);
+extern _X_EXPORT void DoConfigure(void) _X_NORETURN;
+extern _X_EXPORT void DoShowOptions(void) _X_NORETURN;
/* xf86Events.c */
diff --git a/xorg-server/hw/xfree86/common/xf86Xinput.h b/xorg-server/hw/xfree86/common/xf86Xinput.h
index 909fb57d6..7d96fac78 100644
--- a/xorg-server/hw/xfree86/common/xf86Xinput.h
+++ b/xorg-server/hw/xfree86/common/xf86Xinput.h
@@ -173,7 +173,7 @@ extern _X_EXPORT void xf86VIDrvMsgVerb(InputInfoPtr dev,
MessageType type,
int verb,
const char *format,
- va_list args);
+ va_list args) _X_ATTRIBUTE_PRINTF(4,0);
/* xf86Option.c */
extern _X_EXPORT void xf86CollectInputOptions(InputInfoPtr pInfo, const char **defaultOpts);
diff --git a/xorg-server/hw/xfree86/modes/xf86Modes.h b/xorg-server/hw/xfree86/modes/xf86Modes.h
index c72a93537..89ec0d81d 100644
--- a/xorg-server/hw/xfree86/modes/xf86Modes.h
+++ b/xorg-server/hw/xfree86/modes/xf86Modes.h
@@ -99,10 +99,6 @@ extern _X_EXPORT DisplayModePtr
xf86PruneDuplicateModes(DisplayModePtr modes);
extern _X_EXPORT void
-xf86ValidateModesFlags(ScrnInfoPtr pScrn, DisplayModePtr modeList,
- int flags);
-
-extern _X_EXPORT void
xf86ValidateModesUserConfig(ScrnInfoPtr pScrn, DisplayModePtr modeList);
extern _X_EXPORT DisplayModePtr
diff --git a/xorg-server/hw/xfree86/parser/Configint.h b/xorg-server/hw/xfree86/parser/Configint.h
index 670c24da5..3f84ff0fa 100644
--- a/xorg-server/hw/xfree86/parser/Configint.h
+++ b/xorg-server/hw/xfree86/parser/Configint.h
@@ -1,213 +1,213 @@
-/*
- *
- * Copyright (c) 1997 Metro Link Incorporated
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
- * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- *
- * Except as contained in this notice, the name of the Metro Link shall not be
- * used in advertising or otherwise to promote the sale, use or other dealings
- * in this Software without prior written authorization from Metro Link.
- *
- */
-/*
- * Copyright (c) 1997-2002 by The XFree86 Project, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * Except as contained in this notice, the name of the copyright holder(s)
- * and author(s) shall not be used in advertising or otherwise to promote
- * the sale, use or other dealings in this Software without prior written
- * 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.
- */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#ifndef _Configint_h_
-#define _Configint_h_
-
-#include <stdio.h>
-#include <string.h>
-#include <stdarg.h>
-#include <stddef.h>
-#include "xf86Parser.h"
-
-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;
-
-#ifndef TRUE
-#define TRUE 1
-#endif
-
-#ifndef FALSE
-#define FALSE 0
-#endif
-
-#include "configProcs.h"
-#include <stdlib.h>
-
-#define TestFree(a) if (a) { free (a); a = NULL; }
-
-#define parsePrologue(typeptr,typerec) typeptr ptr; \
-if( (ptr=calloc(1,sizeof(typerec))) == NULL ) { return NULL; }
-
-#define HANDLE_RETURN(f,func)\
-if ((ptr->f=func) == NULL)\
-{\
- CLEANUP (ptr);\
- return NULL;\
-}
-
-#define HANDLE_LIST(field,func,type)\
-{\
-type p = func ();\
-if (p == NULL)\
-{\
- CLEANUP (ptr);\
- return NULL;\
-}\
-else\
-{\
- ptr->field = (type) xf86addListItem ((glp) ptr->field, (glp) p);\
-}\
-}
-
-#define Error(a,b) do { \
- xf86parseError (a, b); CLEANUP (ptr); return NULL; \
- } while (0)
-
-/*
- * These are defines for error messages to promote consistency.
- * error messages are preceded by the line number, section and file name,
- * so these messages should be about the specific keyword and syntax in error.
- * To help limit namespace polution, end each with _MSG.
- * limit messages to 70 characters if possible.
- */
-
-#define BAD_OPTION_MSG \
-"The Option keyword requires 1 or 2 quoted strings to follow it."
-#define INVALID_KEYWORD_MSG \
-"\"%s\" is not a valid keyword in this section."
-#define INVALID_SECTION_MSG \
-"\"%s\" is not a valid section name."
-#define UNEXPECTED_EOF_MSG \
-"Unexpected EOF. Missing EndSection keyword?"
-#define QUOTE_MSG \
-"The %s keyword requires a quoted string to follow it."
-#define NUMBER_MSG \
-"The %s keyword requires a number to follow it."
-#define POSITIVE_INT_MSG \
-"The %s keyword requires a positive integer to follow it."
-#define BOOL_MSG \
-"The %s keyword requires a boolean to follow it."
-#define ZAXISMAPPING_MSG \
-"The ZAxisMapping keyword requires 2 positive numbers or X or Y to follow it."
-#define DACSPEED_MSG \
-"The DacSpeed keyword must be followed by a list of up to %d numbers."
-#define DISPLAYSIZE_MSG \
-"The DisplaySize keyword must be followed by the width and height in mm."
-#define HORIZSYNC_MSG \
-"The HorizSync keyword must be followed by a list of numbers or ranges."
-#define VERTREFRESH_MSG \
-"The VertRefresh keyword must be followed by a list of numbers or ranges."
-#define VIEWPORT_MSG \
-"The Viewport keyword must be followed by an X and Y value."
-#define VIRTUAL_MSG \
-"The Virtual keyword must be followed by a width and height value."
-#define WEIGHT_MSG \
-"The Weight keyword must be followed by red, green and blue values."
-#define BLACK_MSG \
-"The Black keyword must be followed by red, green and blue values."
-#define WHITE_MSG \
-"The White keyword must be followed by red, green and blue values."
-#define SCREEN_MSG \
-"The Screen keyword must be followed by an optional number, a screen name\n" \
-"\tin quotes, and optional position/layout information."
-#define INVALID_SCR_MSG \
-"Invalid Screen line."
-#define INPUTDEV_MSG \
-"The InputDevice keyword must be followed by an input device name in quotes."
-#define INACTIVE_MSG \
-"The Inactive keyword must be followed by a Device name in quotes."
-#define UNDEFINED_SCREEN_MSG \
-"Undefined Screen \"%s\" referenced by ServerLayout \"%s\"."
-#define UNDEFINED_MODES_MSG \
-"Undefined Modes Section \"%s\" referenced by Monitor \"%s\"."
-#define UNDEFINED_DEVICE_MSG \
-"Undefined Device \"%s\" referenced by Screen \"%s\"."
-#define UNDEFINED_ADAPTOR_MSG \
-"Undefined VideoAdaptor \"%s\" referenced by Screen \"%s\"."
-#define ADAPTOR_REF_TWICE_MSG \
-"VideoAdaptor \"%s\" already referenced by Screen \"%s\"."
-#define UNDEFINED_DEVICE_LAY_MSG \
-"Undefined Device \"%s\" referenced by ServerLayout \"%s\"."
-#define UNDEFINED_INPUT_MSG \
-"Undefined InputDevice \"%s\" referenced by ServerLayout \"%s\"."
-#define NO_IDENT_MSG \
-"This section must have an Identifier line."
-#define ONLY_ONE_MSG \
-"This section must have only one of either %s line."
-#define UNDEFINED_INPUTDRIVER_MSG \
-"InputDevice section \"%s\" must have a Driver line."
-#define INVALID_GAMMA_MSG \
-"gamma correction value(s) expected\n either one value or three r/g/b values."
-#define GROUP_MSG \
-"The Group keyword must be followed by either a group name in quotes or\n" \
-"\ta numerical group id."
-#define MULTIPLE_MSG \
-"Multiple \"%s\" lines."
-#define MUST_BE_OCTAL_MSG \
-"The number \"%d\" given in this section must be in octal (0xxx) format."
-
-/* Warning messages */
-#define OBSOLETE_MSG \
-"Ignoring obsolete keyword \"%s\"."
-
-#endif /* _Configint_h_ */
+/*
+ *
+ * Copyright (c) 1997 Metro Link Incorporated
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the Metro Link shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from Metro Link.
+ *
+ */
+/*
+ * Copyright (c) 1997-2002 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * 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.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#ifndef _Configint_h_
+#define _Configint_h_
+
+#include <stdio.h>
+#include <string.h>
+#include <stdarg.h>
+#include <stddef.h>
+#include "xf86Parser.h"
+
+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;
+
+#ifndef TRUE
+#define TRUE 1
+#endif
+
+#ifndef FALSE
+#define FALSE 0
+#endif
+
+#include "configProcs.h"
+#include <stdlib.h>
+
+#define TestFree(a) if (a) { free (a); a = NULL; }
+
+#define parsePrologue(typeptr,typerec) typeptr ptr; \
+if( (ptr=calloc(1,sizeof(typerec))) == NULL ) { return NULL; }
+
+#define HANDLE_RETURN(f,func)\
+if ((ptr->f=func) == NULL)\
+{\
+ CLEANUP (ptr);\
+ return NULL;\
+}
+
+#define HANDLE_LIST(field,func,type)\
+{\
+type p = func ();\
+if (p == NULL)\
+{\
+ CLEANUP (ptr);\
+ return NULL;\
+}\
+else\
+{\
+ ptr->field = (type) xf86addListItem ((glp) ptr->field, (glp) p);\
+}\
+}
+
+#define Error(...) do { \
+ xf86parseError (__VA_ARGS__); CLEANUP (ptr); return NULL; \
+ } while (0)
+
+/*
+ * These are defines for error messages to promote consistency.
+ * error messages are preceded by the line number, section and file name,
+ * so these messages should be about the specific keyword and syntax in error.
+ * To help limit namespace polution, end each with _MSG.
+ * limit messages to 70 characters if possible.
+ */
+
+#define BAD_OPTION_MSG \
+"The Option keyword requires 1 or 2 quoted strings to follow it."
+#define INVALID_KEYWORD_MSG \
+"\"%s\" is not a valid keyword in this section."
+#define INVALID_SECTION_MSG \
+"\"%s\" is not a valid section name."
+#define UNEXPECTED_EOF_MSG \
+"Unexpected EOF. Missing EndSection keyword?"
+#define QUOTE_MSG \
+"The %s keyword requires a quoted string to follow it."
+#define NUMBER_MSG \
+"The %s keyword requires a number to follow it."
+#define POSITIVE_INT_MSG \
+"The %s keyword requires a positive integer to follow it."
+#define BOOL_MSG \
+"The %s keyword requires a boolean to follow it."
+#define ZAXISMAPPING_MSG \
+"The ZAxisMapping keyword requires 2 positive numbers or X or Y to follow it."
+#define DACSPEED_MSG \
+"The DacSpeed keyword must be followed by a list of up to %d numbers."
+#define DISPLAYSIZE_MSG \
+"The DisplaySize keyword must be followed by the width and height in mm."
+#define HORIZSYNC_MSG \
+"The HorizSync keyword must be followed by a list of numbers or ranges."
+#define VERTREFRESH_MSG \
+"The VertRefresh keyword must be followed by a list of numbers or ranges."
+#define VIEWPORT_MSG \
+"The Viewport keyword must be followed by an X and Y value."
+#define VIRTUAL_MSG \
+"The Virtual keyword must be followed by a width and height value."
+#define WEIGHT_MSG \
+"The Weight keyword must be followed by red, green and blue values."
+#define BLACK_MSG \
+"The Black keyword must be followed by red, green and blue values."
+#define WHITE_MSG \
+"The White keyword must be followed by red, green and blue values."
+#define SCREEN_MSG \
+"The Screen keyword must be followed by an optional number, a screen name\n" \
+"\tin quotes, and optional position/layout information."
+#define INVALID_SCR_MSG \
+"Invalid Screen line."
+#define INPUTDEV_MSG \
+"The InputDevice keyword must be followed by an input device name in quotes."
+#define INACTIVE_MSG \
+"The Inactive keyword must be followed by a Device name in quotes."
+#define UNDEFINED_SCREEN_MSG \
+"Undefined Screen \"%s\" referenced by ServerLayout \"%s\"."
+#define UNDEFINED_MODES_MSG \
+"Undefined Modes Section \"%s\" referenced by Monitor \"%s\"."
+#define UNDEFINED_DEVICE_MSG \
+"Undefined Device \"%s\" referenced by Screen \"%s\"."
+#define UNDEFINED_ADAPTOR_MSG \
+"Undefined VideoAdaptor \"%s\" referenced by Screen \"%s\"."
+#define ADAPTOR_REF_TWICE_MSG \
+"VideoAdaptor \"%s\" already referenced by Screen \"%s\"."
+#define UNDEFINED_DEVICE_LAY_MSG \
+"Undefined Device \"%s\" referenced by ServerLayout \"%s\"."
+#define UNDEFINED_INPUT_MSG \
+"Undefined InputDevice \"%s\" referenced by ServerLayout \"%s\"."
+#define NO_IDENT_MSG \
+"This section must have an Identifier line."
+#define ONLY_ONE_MSG \
+"This section must have only one of either %s line."
+#define UNDEFINED_INPUTDRIVER_MSG \
+"InputDevice section \"%s\" must have a Driver line."
+#define INVALID_GAMMA_MSG \
+"gamma correction value(s) expected\n either one value or three r/g/b values."
+#define GROUP_MSG \
+"The Group keyword must be followed by either a group name in quotes or\n" \
+"\ta numerical group id."
+#define MULTIPLE_MSG \
+"Multiple \"%s\" lines."
+#define MUST_BE_OCTAL_MSG \
+"The number \"%d\" given in this section must be in octal (0xxx) format."
+
+/* Warning messages */
+#define OBSOLETE_MSG \
+"Ignoring obsolete keyword \"%s\"."
+
+#endif /* _Configint_h_ */
diff --git a/xorg-server/hw/xfree86/parser/DRI.c b/xorg-server/hw/xfree86/parser/DRI.c
index 4847bef2c..77846da2b 100644
--- a/xorg-server/hw/xfree86/parser/DRI.c
+++ b/xorg-server/hw/xfree86/parser/DRI.c
@@ -1,123 +1,123 @@
-/* DRI.c -- DRI Section in XF86Config file
- * Created: Fri Mar 19 08:40:22 1999 by faith@precisioninsight.com
- * Revised: Thu Jun 17 16:08:05 1999 by faith@precisioninsight.com
- *
- * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- *
- */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "xf86Parser.h"
-#include "xf86tokens.h"
-#include "Configint.h"
-
-extern LexRec val;
-
-static xf86ConfigSymTabRec DRITab[] =
-{
- {ENDSECTION, "endsection"},
- {GROUP, "group"},
- {MODE, "mode"},
- {-1, ""},
-};
-
-#define CLEANUP xf86freeDRI
-
-XF86ConfDRIPtr
-xf86parseDRISection (void)
-{
- int token;
- 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;
- }
- }
-
-#ifdef DEBUG
- ErrorF("DRI section parsed\n");
-#endif
-
- return ptr;
-}
-
-#undef CLEANUP
-
-void
-xf86printDRISection (FILE * cf, XF86ConfDRIPtr ptr)
-{
- if (ptr == NULL)
- return;
-
- fprintf (cf, "Section \"DRI\"\n");
- if (ptr->dri_comment)
- fprintf (cf, "%s", ptr->dri_comment);
- if (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);
- if (ptr->dri_mode)
- fprintf (cf, "\tMode 0%o\n", ptr->dri_mode);
- fprintf (cf, "EndSection\n\n");
-}
-
-void
-xf86freeDRI (XF86ConfDRIPtr ptr)
-{
- if (ptr == NULL)
- return;
-
- TestFree (ptr->dri_comment);
- free (ptr);
-}
+/* DRI.c -- DRI Section in XF86Config file
+ * Created: Fri Mar 19 08:40:22 1999 by faith@precisioninsight.com
+ * Revised: Thu Jun 17 16:08:05 1999 by faith@precisioninsight.com
+ *
+ * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ *
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf86Parser.h"
+#include "xf86tokens.h"
+#include "Configint.h"
+
+extern LexRec val;
+
+static xf86ConfigSymTabRec DRITab[] =
+{
+ {ENDSECTION, "endsection"},
+ {GROUP, "group"},
+ {MODE, "mode"},
+ {-1, ""},
+};
+
+#define CLEANUP xf86freeDRI
+
+XF86ConfDRIPtr
+xf86parseDRISection (void)
+{
+ int token;
+ 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);
+ 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)
+{
+ if (ptr == NULL)
+ return;
+
+ fprintf (cf, "Section \"DRI\"\n");
+ if (ptr->dri_comment)
+ fprintf (cf, "%s", ptr->dri_comment);
+ if (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);
+ if (ptr->dri_mode)
+ fprintf (cf, "\tMode 0%o\n", ptr->dri_mode);
+ fprintf (cf, "EndSection\n\n");
+}
+
+void
+xf86freeDRI (XF86ConfDRIPtr ptr)
+{
+ if (ptr == NULL)
+ return;
+
+ TestFree (ptr->dri_comment);
+ free (ptr);
+}
diff --git a/xorg-server/hw/xfree86/parser/Device.c b/xorg-server/hw/xfree86/parser/Device.c
index c81aa05d9..d99dbf79d 100644
--- a/xorg-server/hw/xfree86/parser/Device.c
+++ b/xorg-server/hw/xfree86/parser/Device.c
@@ -1,371 +1,371 @@
-/*
- *
- * Copyright (c) 1997 Metro Link Incorporated
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
- * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- *
- * Except as contained in this notice, the name of the Metro Link shall not be
- * used in advertising or otherwise to promote the sale, use or other dealings
- * in this Software without prior written authorization from Metro Link.
- *
- */
-/*
- * Copyright (c) 1997-2003 by The XFree86 Project, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * Except as contained in this notice, the name of the copyright holder(s)
- * and author(s) shall not be used in advertising or otherwise to promote
- * the sale, use or other dealings in this Software without prior written
- * authorization from the copyright holder(s) and author(s).
- */
-
-
-/* View/edit this file with tab stops set to 4 */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "xf86Parser.h"
-#include "xf86tokens.h"
-#include "Configint.h"
-
-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, ""},
-};
-
-#define CLEANUP xf86freeDeviceList
-
-XF86ConfDevicePtr
-xf86parseDeviceSection (void)
-{
- 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;
-
- 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;
- }
- }
-
- if (!has_ident)
- Error (NO_IDENT_MSG, NULL);
-
-#ifdef DEBUG
- printf ("Device section parsed\n");
-#endif
-
- return ptr;
-}
-
-#undef CLEANUP
-
-void
-xf86printDeviceSection (FILE * cf, XF86ConfDevicePtr ptr)
-{
- 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);
-
- 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)
-{
- 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);
-
- prev = ptr;
- ptr = ptr->list.next;
- free (prev);
- }
-}
-
-XF86ConfDevicePtr
-xf86findDevice (const char *ident, XF86ConfDevicePtr p)
-{
- while (p)
- {
- if (xf86nameCompare (ident, p->dev_identifier) == 0)
- return p;
-
- p = p->list.next;
- }
- return NULL;
-}
+/*
+ *
+ * Copyright (c) 1997 Metro Link Incorporated
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the Metro Link shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from Metro Link.
+ *
+ */
+/*
+ * Copyright (c) 1997-2003 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+
+/* View/edit this file with tab stops set to 4 */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf86Parser.h"
+#include "xf86tokens.h"
+#include "Configint.h"
+
+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, ""},
+};
+
+#define CLEANUP xf86freeDeviceList
+
+XF86ConfDevicePtr
+xf86parseDeviceSection (void)
+{
+ 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;
+
+ 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);
+
+#ifdef DEBUG
+ printf ("Device section parsed\n");
+#endif
+
+ return ptr;
+}
+
+#undef CLEANUP
+
+void
+xf86printDeviceSection (FILE * cf, XF86ConfDevicePtr ptr)
+{
+ 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);
+
+ 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)
+{
+ 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);
+
+ prev = ptr;
+ ptr = ptr->list.next;
+ free (prev);
+ }
+}
+
+XF86ConfDevicePtr
+xf86findDevice (const char *ident, XF86ConfDevicePtr p)
+{
+ while (p)
+ {
+ if (xf86nameCompare (ident, p->dev_identifier) == 0)
+ return p;
+
+ p = p->list.next;
+ }
+ return NULL;
+}
diff --git a/xorg-server/hw/xfree86/parser/Extensions.c b/xorg-server/hw/xfree86/parser/Extensions.c
index 4003b521a..662f5260c 100644
--- a/xorg-server/hw/xfree86/parser/Extensions.c
+++ b/xorg-server/hw/xfree86/parser/Extensions.c
@@ -62,7 +62,7 @@ xf86parseExtensionsSection (void)
ptr->ext_option_lst = xf86parseOption(ptr->ext_option_lst);
break;
case EOF_TOKEN:
- Error (UNEXPECTED_EOF_MSG, NULL);
+ Error (UNEXPECTED_EOF_MSG);
break;
case COMMENT:
ptr->extensions_comment =
diff --git a/xorg-server/hw/xfree86/parser/Files.c b/xorg-server/hw/xfree86/parser/Files.c
index 0c718354e..a95be9ee2 100644
--- a/xorg-server/hw/xfree86/parser/Files.c
+++ b/xorg-server/hw/xfree86/parser/Files.c
@@ -162,7 +162,7 @@ xf86parseFilesSection (void)
ptr->file_xkbdir = val.str;
break;
case EOF_TOKEN:
- Error (UNEXPECTED_EOF_MSG, NULL);
+ Error (UNEXPECTED_EOF_MSG);
break;
case OBSOLETE_TOKEN:
xf86parseError (OBSOLETE_MSG, xf86tokenString ());
diff --git a/xorg-server/hw/xfree86/parser/Flags.c b/xorg-server/hw/xfree86/parser/Flags.c
index 87fd3edf6..c2a04062c 100644
--- a/xorg-server/hw/xfree86/parser/Flags.c
+++ b/xorg-server/hw/xfree86/parser/Flags.c
@@ -160,7 +160,7 @@ xf86parseFlagsSection (void)
break;
case EOF_TOKEN:
- Error (UNEXPECTED_EOF_MSG, NULL);
+ Error (UNEXPECTED_EOF_MSG);
break;
default:
Error (INVALID_KEYWORD_MSG, xf86tokenString ());
@@ -440,7 +440,7 @@ xf86parseOption(XF86OptionPtr head)
int token;
if ((token = xf86getSubToken(&comment)) != STRING) {
- xf86parseError(BAD_OPTION_MSG, NULL);
+ xf86parseError(BAD_OPTION_MSG);
free(comment);
return head;
}
diff --git a/xorg-server/hw/xfree86/parser/Input.c b/xorg-server/hw/xfree86/parser/Input.c
index 739e49ba4..e6037732a 100644
--- a/xorg-server/hw/xfree86/parser/Input.c
+++ b/xorg-server/hw/xfree86/parser/Input.c
@@ -1,213 +1,213 @@
-/*
- *
- * Copyright (c) 1997 Metro Link Incorporated
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
- * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- *
- * Except as contained in this notice, the name of the Metro Link shall not be
- * used in advertising or otherwise to promote the sale, use or other dealings
- * in this Software without prior written authorization from Metro Link.
- *
- */
-/*
- * Copyright (c) 1997-2003 by The XFree86 Project, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * Except as contained in this notice, the name of the copyright holder(s)
- * and author(s) shall not be used in advertising or otherwise to promote
- * the sale, use or other dealings in this Software without prior written
- * authorization from the copyright holder(s) and author(s).
- */
-
-
-/* View/edit this file with tab stops set to 4 */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "os.h"
-#include "xf86Parser.h"
-#include "xf86tokens.h"
-#include "Configint.h"
-
-extern LexRec val;
-
-static
-xf86ConfigSymTabRec InputTab[] =
-{
- {ENDSECTION, "endsection"},
- {IDENTIFIER, "identifier"},
- {OPTION, "option"},
- {DRIVER, "driver"},
- {-1, ""},
-};
-
-#define CLEANUP xf86freeInputList
-
-XF86ConfInputPtr
-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);
-
-#ifdef DEBUG
- printf ("InputDevice section parsed\n");
-#endif
-
- return ptr;
-}
-
-#undef CLEANUP
-
-void
-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;
- }
-}
-
-void
-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);
- }
-}
-
-int
-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
-xf86findInput (const char *ident, XF86ConfInputPtr p)
-{
- while (p)
- {
- if (xf86nameCompare (ident, p->inp_identifier) == 0)
- return p;
-
- p = p->list.next;
- }
- return NULL;
-}
-
-XF86ConfInputPtr
-xf86findInputByDriver (const char *driver, XF86ConfInputPtr p)
-{
- while (p)
- {
- if (xf86nameCompare (driver, p->inp_driver) == 0)
- return p;
-
- p = p->list.next;
- }
- return NULL;
-}
-
+/*
+ *
+ * Copyright (c) 1997 Metro Link Incorporated
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the Metro Link shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from Metro Link.
+ *
+ */
+/*
+ * Copyright (c) 1997-2003 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+
+/* View/edit this file with tab stops set to 4 */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "os.h"
+#include "xf86Parser.h"
+#include "xf86tokens.h"
+#include "Configint.h"
+
+extern LexRec val;
+
+static
+xf86ConfigSymTabRec InputTab[] =
+{
+ {ENDSECTION, "endsection"},
+ {IDENTIFIER, "identifier"},
+ {OPTION, "option"},
+ {DRIVER, "driver"},
+ {-1, ""},
+};
+
+#define CLEANUP xf86freeInputList
+
+XF86ConfInputPtr
+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);
+ break;
+ default:
+ Error (INVALID_KEYWORD_MSG, xf86tokenString ());
+ break;
+ }
+ }
+
+ if (!has_ident)
+ Error (NO_IDENT_MSG);
+
+#ifdef DEBUG
+ printf ("InputDevice section parsed\n");
+#endif
+
+ return ptr;
+}
+
+#undef CLEANUP
+
+void
+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;
+ }
+}
+
+void
+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);
+ }
+}
+
+int
+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
+xf86findInput (const char *ident, XF86ConfInputPtr p)
+{
+ while (p)
+ {
+ if (xf86nameCompare (ident, p->inp_identifier) == 0)
+ return p;
+
+ p = p->list.next;
+ }
+ return NULL;
+}
+
+XF86ConfInputPtr
+xf86findInputByDriver (const char *driver, XF86ConfInputPtr p)
+{
+ while (p)
+ {
+ if (xf86nameCompare (driver, p->inp_driver) == 0)
+ return p;
+
+ p = p->list.next;
+ }
+ return NULL;
+}
+
diff --git a/xorg-server/hw/xfree86/parser/InputClass.c b/xorg-server/hw/xfree86/parser/InputClass.c
index 2cdc9125a..919ae1869 100644
--- a/xorg-server/hw/xfree86/parser/InputClass.c
+++ b/xorg-server/hw/xfree86/parser/InputClass.c
@@ -241,7 +241,7 @@ xf86parseInputClassSection(void)
Error(BOOL_MSG, "MatchIsTouchscreen");
break;
case EOF_TOKEN:
- Error(UNEXPECTED_EOF_MSG, NULL);
+ Error(UNEXPECTED_EOF_MSG);
break;
default:
Error(INVALID_KEYWORD_MSG, xf86tokenString ());
@@ -250,7 +250,7 @@ xf86parseInputClassSection(void)
}
if (!has_ident)
- Error(NO_IDENT_MSG, NULL);
+ Error(NO_IDENT_MSG);
#ifdef DEBUG
printf("InputClass section parsed\n");
diff --git a/xorg-server/hw/xfree86/parser/Layout.c b/xorg-server/hw/xfree86/parser/Layout.c
index 4487b0df6..7dd4ebfc6 100644
--- a/xorg-server/hw/xfree86/parser/Layout.c
+++ b/xorg-server/hw/xfree86/parser/Layout.c
@@ -124,7 +124,7 @@ xf86parseLayoutSection (void)
iptr->list.next = NULL;
if (xf86getSubToken (&(ptr->lay_comment)) != STRING) {
free (iptr);
- Error (INACTIVE_MSG, NULL);
+ Error (INACTIVE_MSG);
}
iptr->inactive_device_str = val.str;
ptr->lay_inactive_lst = (XF86ConfInactivePtr)
@@ -150,7 +150,7 @@ xf86parseLayoutSection (void)
token = xf86getSubToken(&(ptr->lay_comment));
if (token != STRING) {
free(aptr);
- Error (SCREEN_MSG, NULL);
+ Error (SCREEN_MSG);
}
aptr->adj_screen_str = val.str;
@@ -178,7 +178,7 @@ xf86parseLayoutSection (void)
break;
case EOF_TOKEN:
free(aptr);
- Error (UNEXPECTED_EOF_MSG, NULL);
+ Error (UNEXPECTED_EOF_MSG);
break;
default:
xf86unGetToken (token);
@@ -199,13 +199,13 @@ xf86parseLayoutSection (void)
token = xf86getSubToken(&(ptr->lay_comment));
if (token != NUMBER) {
free(aptr);
- Error(INVALID_SCR_MSG, NULL);
+ Error(INVALID_SCR_MSG);
}
aptr->adj_y = val.num;
} else {
if (absKeyword) {
free(aptr);
- Error(INVALID_SCR_MSG, NULL);
+ Error(INVALID_SCR_MSG);
} else
xf86unGetToken (token);
}
@@ -218,7 +218,7 @@ xf86parseLayoutSection (void)
token = xf86getSubToken(&(ptr->lay_comment));
if (token != STRING) {
free(aptr);
- Error(INVALID_SCR_MSG, NULL);
+ Error(INVALID_SCR_MSG);
}
aptr->adj_refscreen = val.str;
if (aptr->adj_where == CONF_ADJ_RELATIVE)
@@ -226,13 +226,13 @@ xf86parseLayoutSection (void)
token = xf86getSubToken(&(ptr->lay_comment));
if (token != NUMBER) {
free(aptr);
- Error(INVALID_SCR_MSG, NULL);
+ Error(INVALID_SCR_MSG);
}
aptr->adj_x = val.num;
token = xf86getSubToken(&(ptr->lay_comment));
if (token != NUMBER) {
free(aptr);
- Error(INVALID_SCR_MSG, NULL);
+ Error(INVALID_SCR_MSG);
}
aptr->adj_y = val.num;
}
@@ -244,21 +244,21 @@ xf86parseLayoutSection (void)
/* bottom */
if (xf86getSubToken (&(ptr->lay_comment)) != STRING) {
free(aptr);
- Error (SCREEN_MSG, NULL);
+ Error (SCREEN_MSG);
}
aptr->adj_bottom_str = val.str;
/* left */
if (xf86getSubToken (&(ptr->lay_comment)) != STRING) {
free(aptr);
- Error (SCREEN_MSG, NULL);
+ Error (SCREEN_MSG);
}
aptr->adj_left_str = val.str;
/* right */
if (xf86getSubToken (&(ptr->lay_comment)) != STRING) {
free(aptr);
- Error (SCREEN_MSG, NULL);
+ Error (SCREEN_MSG);
}
aptr->adj_right_str = val.str;
@@ -276,7 +276,7 @@ xf86parseLayoutSection (void)
iptr->iref_option_lst = NULL;
if (xf86getSubToken (&(ptr->lay_comment)) != STRING) {
free(iptr);
- Error (INPUTDEV_MSG, NULL);
+ Error (INPUTDEV_MSG);
}
iptr->iref_inputdev_str = val.str;
while ((token = xf86getSubToken (&(ptr->lay_comment))) == STRING)
@@ -293,7 +293,7 @@ xf86parseLayoutSection (void)
ptr->lay_option_lst = xf86parseOption(ptr->lay_option_lst);
break;
case EOF_TOKEN:
- Error (UNEXPECTED_EOF_MSG, NULL);
+ Error (UNEXPECTED_EOF_MSG);
break;
default:
Error (INVALID_KEYWORD_MSG, xf86tokenString ());
@@ -302,7 +302,7 @@ xf86parseLayoutSection (void)
}
if (!has_ident)
- Error (NO_IDENT_MSG, NULL);
+ Error (NO_IDENT_MSG);
#ifdef DEBUG
printf ("Layout section parsed\n");
diff --git a/xorg-server/hw/xfree86/parser/Module.c b/xorg-server/hw/xfree86/parser/Module.c
index ca323fc5a..3c4cefc18 100644
--- a/xorg-server/hw/xfree86/parser/Module.c
+++ b/xorg-server/hw/xfree86/parser/Module.c
@@ -107,7 +107,7 @@ xf86parseModuleSubSection (XF86LoadPtr head, char *name)
ptr->load_opt = xf86parseOption(ptr->load_opt);
break;
case EOF_TOKEN:
- xf86parseError (UNEXPECTED_EOF_MSG, NULL);
+ xf86parseError (UNEXPECTED_EOF_MSG);
free(ptr);
return NULL;
default:
@@ -163,7 +163,7 @@ xf86parseModuleSection (void)
xf86parseModuleSubSection (ptr->mod_load_lst, val.str);
break;
case EOF_TOKEN:
- Error (UNEXPECTED_EOF_MSG, NULL);
+ Error (UNEXPECTED_EOF_MSG);
break;
default:
Error (INVALID_KEYWORD_MSG, xf86tokenString ());
diff --git a/xorg-server/hw/xfree86/parser/Monitor.c b/xorg-server/hw/xfree86/parser/Monitor.c
index 24fe4ba0d..52c55007e 100644
--- a/xorg-server/hw/xfree86/parser/Monitor.c
+++ b/xorg-server/hw/xfree86/parser/Monitor.c
@@ -1,897 +1,897 @@
-/*
- *
- * Copyright (c) 1997 Metro Link Incorporated
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
- * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- *
- * Except as contained in this notice, the name of the Metro Link shall not be
- * used in advertising or otherwise to promote the sale, use or other dealings
- * in this Software without prior written authorization from Metro Link.
- *
- */
-/*
- * Copyright (c) 1997-2003 by The XFree86 Project, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * Except as contained in this notice, the name of the copyright holder(s)
- * and author(s) shall not be used in advertising or otherwise to promote
- * the sale, use or other dealings in this Software without prior written
- * authorization from the copyright holder(s) and author(s).
- */
-
-
-/* View/edit this file with tab stops set to 4 */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "xf86Parser.h"
-#include "xf86tokens.h"
-#include "Configint.h"
-
-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 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 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)
-{
- XF86ConfModeLinePtr prev;
- while (ptr)
- {
- TestFree (ptr->ml_identifier);
- TestFree (ptr->ml_comment);
- prev = ptr;
- ptr = ptr->list.next;
- free (prev);
- }
-}
-
-static XF86ConfModeLinePtr
-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);
-
-#ifdef DEBUG
- printf ("ModeLine parsed\n");
-#endif
- return ptr;
-}
-
-static XF86ConfModeLinePtr
-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);
-
-#ifdef DEBUG
- printf ("Verbose Mode parsed\n");
-#endif
- return ptr;
-}
-
-#undef CLEANUP
-
-#define CLEANUP xf86freeMonitorList
-
-XF86ConfMonitorPtr
-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);
-
-#ifdef DEBUG
- printf ("Monitor section parsed\n");
-#endif
- return ptr;
-}
-
-#undef CLEANUP
-#define CLEANUP xf86freeModesList
-
-XF86ConfModesPtr
-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);
-
-#ifdef DEBUG
- printf ("Modes section parsed\n");
-#endif
- return ptr;
-}
-
-#undef CLEANUP
-
-void
-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;
- }
-}
-
-void
-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;
- }
-}
-
-void
-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);
- }
-}
-
-void
-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);
- }
-}
-
-XF86ConfMonitorPtr
-xf86findMonitor (const char *ident, XF86ConfMonitorPtr p)
-{
- while (p)
- {
- if (xf86nameCompare (ident, p->mon_identifier) == 0)
- return p;
-
- p = p->list.next;
- }
- return NULL;
-}
-
-XF86ConfModesPtr
-xf86findModes (const char *ident, XF86ConfModesPtr p)
-{
- while (p)
- {
- if (xf86nameCompare (ident, p->modes_identifier) == 0)
- return p;
-
- p = p->list.next;
- }
- return NULL;
-}
-
-XF86ConfModeLinePtr
-xf86findModeLine (const char *ident, XF86ConfModeLinePtr p)
-{
- while (p)
- {
- if (xf86nameCompare (ident, p->ml_identifier) == 0)
- return p;
-
- p = p->list.next;
- }
- return NULL;
-}
-
-int
-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;
-}
+/*
+ *
+ * Copyright (c) 1997 Metro Link Incorporated
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the Metro Link shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from Metro Link.
+ *
+ */
+/*
+ * Copyright (c) 1997-2003 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+
+/* View/edit this file with tab stops set to 4 */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf86Parser.h"
+#include "xf86tokens.h"
+#include "Configint.h"
+
+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 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 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)
+{
+ XF86ConfModeLinePtr prev;
+ while (ptr)
+ {
+ TestFree (ptr->ml_identifier);
+ TestFree (ptr->ml_comment);
+ prev = ptr;
+ ptr = ptr->list.next;
+ free (prev);
+ }
+}
+
+static XF86ConfModeLinePtr
+xf86parseModeLine (void)
+{
+ 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");
+#endif
+ return ptr;
+}
+
+static XF86ConfModeLinePtr
+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");
+ 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");
+#endif
+ return ptr;
+}
+
+#undef CLEANUP
+
+#define CLEANUP xf86freeMonitorList
+
+XF86ConfMonitorPtr
+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);
+ 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");
+#endif
+ return ptr;
+}
+
+#undef CLEANUP
+#define CLEANUP xf86freeModesList
+
+XF86ConfModesPtr
+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);
+
+#ifdef DEBUG
+ printf ("Modes section parsed\n");
+#endif
+ return ptr;
+}
+
+#undef CLEANUP
+
+void
+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;
+ }
+}
+
+void
+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;
+ }
+}
+
+void
+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);
+ }
+}
+
+void
+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);
+ }
+}
+
+XF86ConfMonitorPtr
+xf86findMonitor (const char *ident, XF86ConfMonitorPtr p)
+{
+ while (p)
+ {
+ if (xf86nameCompare (ident, p->mon_identifier) == 0)
+ return p;
+
+ p = p->list.next;
+ }
+ return NULL;
+}
+
+XF86ConfModesPtr
+xf86findModes (const char *ident, XF86ConfModesPtr p)
+{
+ while (p)
+ {
+ if (xf86nameCompare (ident, p->modes_identifier) == 0)
+ return p;
+
+ p = p->list.next;
+ }
+ return NULL;
+}
+
+XF86ConfModeLinePtr
+xf86findModeLine (const char *ident, XF86ConfModeLinePtr p)
+{
+ while (p)
+ {
+ if (xf86nameCompare (ident, p->ml_identifier) == 0)
+ return p;
+
+ p = p->list.next;
+ }
+ return NULL;
+}
+
+int
+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;
+}
diff --git a/xorg-server/hw/xfree86/parser/Pointer.c b/xorg-server/hw/xfree86/parser/Pointer.c
index a7ee3f213..4edbf74d9 100644
--- a/xorg-server/hw/xfree86/parser/Pointer.c
+++ b/xorg-server/hw/xfree86/parser/Pointer.c
@@ -1,233 +1,233 @@
-/*
- *
- * Copyright (c) 1997 Metro Link Incorporated
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
- * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- *
- * Except as contained in this notice, the name of the Metro Link shall not be
- * used in advertising or otherwise to promote the sale, use or other dealings
- * in this Software without prior written authorization from Metro Link.
- *
- */
-/*
- * Copyright (c) 1997-2003 by The XFree86 Project, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * Except as contained in this notice, the name of the copyright holder(s)
- * and author(s) shall not be used in advertising or otherwise to promote
- * the sale, use or other dealings in this Software without prior written
- * authorization from the copyright holder(s) and author(s).
- */
-
-
-/* View/edit this file with tab stops set to 4 */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "xf86Parser.h"
-#include "xf86tokens.h"
-#include "Configint.h"
-#include "Xprintf.h"
-
-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 ZMapTab[] =
-{
- {XAXIS, "x"},
- {YAXIS, "y"},
- {-1, ""},
-};
-
-#define CLEANUP xf86freeInputList
-
-XF86ConfInputPtr
-xf86parsePointerSection (void)
-{
- char *s;
- unsigned long val1;
- int token;
- parsePrologue (XF86ConfInputPtr, XF86ConfInputRec)
-
- 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;
- }
- }
-
- 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");
-#endif
-
- return ptr;
-}
-
-#undef CLEANUP
-
+/*
+ *
+ * Copyright (c) 1997 Metro Link Incorporated
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the Metro Link shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from Metro Link.
+ *
+ */
+/*
+ * Copyright (c) 1997-2003 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+
+/* View/edit this file with tab stops set to 4 */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf86Parser.h"
+#include "xf86tokens.h"
+#include "Configint.h"
+#include "Xprintf.h"
+
+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 ZMapTab[] =
+{
+ {XAXIS, "x"},
+ {YAXIS, "y"},
+ {-1, ""},
+};
+
+#define CLEANUP xf86freeInputList
+
+XF86ConfInputPtr
+xf86parsePointerSection (void)
+{
+ char *s;
+ unsigned long val1;
+ int token;
+ parsePrologue (XF86ConfInputPtr, XF86ConfInputRec)
+
+ 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");
+#endif
+
+ return ptr;
+}
+
+#undef CLEANUP
+
diff --git a/xorg-server/hw/xfree86/parser/Screen.c b/xorg-server/hw/xfree86/parser/Screen.c
index b5667a79e..2ca2c570d 100644
--- a/xorg-server/hw/xfree86/parser/Screen.c
+++ b/xorg-server/hw/xfree86/parser/Screen.c
@@ -1,569 +1,569 @@
-/*
- *
- * Copyright (c) 1997 Metro Link Incorporated
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
- * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- *
- * Except as contained in this notice, the name of the Metro Link shall not be
- * used in advertising or otherwise to promote the sale, use or other dealings
- * in this Software without prior written authorization from Metro Link.
- *
- */
-/*
- * Copyright (c) 1997-2003 by The XFree86 Project, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * Except as contained in this notice, the name of the copyright holder(s)
- * and author(s) shall not be used in advertising or otherwise to promote
- * the sale, use or other dealings in this Software without prior written
- * authorization from the copyright holder(s) and author(s).
- */
-
-
-/* View/edit this file with tab stops set to 4 */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "xf86Parser.h"
-#include "xf86tokens.h"
-#include "Configint.h"
-
-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, ""},
-};
-
-#define CLEANUP xf86freeDisplayList
-
-static XF86ConfDisplayPtr
-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;
- }
- }
-
-#ifdef DEBUG
- printf ("Display subsection parsed\n");
-#endif
-
- 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, ""},
-};
-
-#define CLEANUP xf86freeScreenList
-XF86ConfScreenPtr
-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);
-
-#ifdef DEBUG
- printf ("Screen section parsed\n");
-#endif
-
- return ptr;
-}
-
-void
-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;
- }
-
-}
-
-void
-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);
- }
-}
-
-void
-xf86freeAdaptorLinkList (XF86ConfAdaptorLinkPtr ptr)
-{
- XF86ConfAdaptorLinkPtr prev;
-
- while (ptr)
- {
- TestFree (ptr->al_adaptor_str);
- prev = ptr;
- ptr = ptr->list.next;
- free (prev);
- }
-}
-
-void
-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);
- }
-}
-
-void
-xf86freeModeList (XF86ModePtr ptr)
-{
- XF86ModePtr prev;
-
- while (ptr)
- {
- TestFree (ptr->mode_name);
- prev = ptr;
- ptr = ptr->list.next;
- free (prev);
- }
-}
-
-int
-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
-xf86findScreen (const char *ident, XF86ConfScreenPtr p)
-{
- while (p)
- {
- if (xf86nameCompare (ident, p->scrn_identifier) == 0)
- return p;
-
- p = p->list.next;
- }
- return NULL;
-}
-
+/*
+ *
+ * Copyright (c) 1997 Metro Link Incorporated
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the Metro Link shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from Metro Link.
+ *
+ */
+/*
+ * Copyright (c) 1997-2003 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+
+/* View/edit this file with tab stops set to 4 */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf86Parser.h"
+#include "xf86tokens.h"
+#include "Configint.h"
+
+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, ""},
+};
+
+#define CLEANUP xf86freeDisplayList
+
+static XF86ConfDisplayPtr
+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);
+ 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");
+#endif
+
+ 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, ""},
+};
+
+#define CLEANUP xf86freeScreenList
+XF86ConfScreenPtr
+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);
+ 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");
+#endif
+
+ return ptr;
+}
+
+void
+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;
+ }
+
+}
+
+void
+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);
+ }
+}
+
+void
+xf86freeAdaptorLinkList (XF86ConfAdaptorLinkPtr ptr)
+{
+ XF86ConfAdaptorLinkPtr prev;
+
+ while (ptr)
+ {
+ TestFree (ptr->al_adaptor_str);
+ prev = ptr;
+ ptr = ptr->list.next;
+ free (prev);
+ }
+}
+
+void
+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);
+ }
+}
+
+void
+xf86freeModeList (XF86ModePtr ptr)
+{
+ XF86ModePtr prev;
+
+ while (ptr)
+ {
+ TestFree (ptr->mode_name);
+ prev = ptr;
+ ptr = ptr->list.next;
+ free (prev);
+ }
+}
+
+int
+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
+xf86findScreen (const char *ident, XF86ConfScreenPtr p)
+{
+ while (p)
+ {
+ if (xf86nameCompare (ident, p->scrn_identifier) == 0)
+ return p;
+
+ p = p->list.next;
+ }
+ return NULL;
+}
+
diff --git a/xorg-server/hw/xfree86/parser/Vendor.c b/xorg-server/hw/xfree86/parser/Vendor.c
index dce3f1ca1..d61f0a052 100644
--- a/xorg-server/hw/xfree86/parser/Vendor.c
+++ b/xorg-server/hw/xfree86/parser/Vendor.c
@@ -102,7 +102,7 @@ xf86parseVendorSubSection (void)
break;
case EOF_TOKEN:
- Error (UNEXPECTED_EOF_MSG, NULL);
+ Error (UNEXPECTED_EOF_MSG);
break;
default:
Error (INVALID_KEYWORD_MSG, xf86tokenString ());
@@ -164,7 +164,7 @@ xf86parseVendorSection (void)
}
break;
case EOF_TOKEN:
- Error (UNEXPECTED_EOF_MSG, NULL);
+ Error (UNEXPECTED_EOF_MSG);
break;
default:
Error (INVALID_KEYWORD_MSG, xf86tokenString ());
@@ -174,7 +174,7 @@ xf86parseVendorSection (void)
}
if (!has_ident)
- Error (NO_IDENT_MSG, NULL);
+ Error (NO_IDENT_MSG);
#ifdef DEBUG
printf ("Vendor section parsed\n");
diff --git a/xorg-server/hw/xfree86/parser/Video.c b/xorg-server/hw/xfree86/parser/Video.c
index 40a909707..19a5418b1 100644
--- a/xorg-server/hw/xfree86/parser/Video.c
+++ b/xorg-server/hw/xfree86/parser/Video.c
@@ -1,296 +1,296 @@
-/*
- *
- * Copyright (c) 1997 Metro Link Incorporated
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
- * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- *
- * Except as contained in this notice, the name of the Metro Link shall not be
- * used in advertising or otherwise to promote the sale, use or other dealings
- * in this Software without prior written authorization from Metro Link.
- *
- */
-/*
- * Copyright (c) 1997-2003 by The XFree86 Project, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * Except as contained in this notice, the name of the copyright holder(s)
- * and author(s) shall not be used in advertising or otherwise to promote
- * the sale, use or other dealings in this Software without prior written
- * authorization from the copyright holder(s) and author(s).
- */
-
-/* View/edit this file with tab stops set to 4 */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "xf86Parser.h"
-#include "xf86tokens.h"
-#include "Configint.h"
-
-extern LexRec val;
-
-static xf86ConfigSymTabRec VideoPortTab[] =
-{
- {ENDSUBSECTION, "endsubsection"},
- {IDENTIFIER, "identifier"},
- {OPTION, "option"},
- {-1, ""},
-};
-
-#define CLEANUP xf86freeVideoPortList
-
-static void
-xf86freeVideoPortList (XF86ConfVideoPortPtr ptr)
-{
- 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);
- }
-}
-
-static XF86ConfVideoPortPtr
-xf86parseVideoPortSubSection (void)
-{
- 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;
-
- case EOF_TOKEN:
- Error (UNEXPECTED_EOF_MSG, NULL);
- break;
- default:
- Error (INVALID_KEYWORD_MSG, xf86tokenString ());
- break;
- }
- }
-
-#ifdef DEBUG
- printf ("VideoPort subsection parsed\n");
-#endif
-
- return ptr;
-}
-
-#undef CLEANUP
-
-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)
-{
- int has_ident = FALSE;
- int token;
-
- 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;
-
- case EOF_TOKEN:
- Error (UNEXPECTED_EOF_MSG, NULL);
- break;
- default:
- Error (INVALID_KEYWORD_MSG, xf86tokenString ());
- break;
- }
- }
-
- if (!has_ident)
- Error (NO_IDENT_MSG, NULL);
-
-#ifdef DEBUG
- printf ("VideoAdaptor section parsed\n");
-#endif
-
- return ptr;
-}
-
-void
-xf86printVideoAdaptorSection (FILE * cf, XF86ConfVideoAdaptorPtr ptr)
-{
- 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;
- }
-
-}
-
-void
-xf86freeVideoAdaptorList (XF86ConfVideoAdaptorPtr ptr)
-{
- 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);
- }
-}
-
-XF86ConfVideoAdaptorPtr
-xf86findVideoAdaptor (const char *ident, XF86ConfVideoAdaptorPtr p)
-{
- while (p)
- {
- if (xf86nameCompare (ident, p->va_identifier) == 0)
- return p;
-
- p = p->list.next;
- }
- return NULL;
-}
+/*
+ *
+ * Copyright (c) 1997 Metro Link Incorporated
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the Metro Link shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from Metro Link.
+ *
+ */
+/*
+ * Copyright (c) 1997-2003 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+/* View/edit this file with tab stops set to 4 */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xf86Parser.h"
+#include "xf86tokens.h"
+#include "Configint.h"
+
+extern LexRec val;
+
+static xf86ConfigSymTabRec VideoPortTab[] =
+{
+ {ENDSUBSECTION, "endsubsection"},
+ {IDENTIFIER, "identifier"},
+ {OPTION, "option"},
+ {-1, ""},
+};
+
+#define CLEANUP xf86freeVideoPortList
+
+static void
+xf86freeVideoPortList (XF86ConfVideoPortPtr ptr)
+{
+ 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);
+ }
+}
+
+static XF86ConfVideoPortPtr
+xf86parseVideoPortSubSection (void)
+{
+ 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;
+
+ case EOF_TOKEN:
+ Error (UNEXPECTED_EOF_MSG);
+ break;
+ default:
+ Error (INVALID_KEYWORD_MSG, xf86tokenString ());
+ break;
+ }
+ }
+
+#ifdef DEBUG
+ printf ("VideoPort subsection parsed\n");
+#endif
+
+ return ptr;
+}
+
+#undef CLEANUP
+
+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)
+{
+ int has_ident = FALSE;
+ int token;
+
+ 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;
+
+ 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 ("VideoAdaptor section parsed\n");
+#endif
+
+ return ptr;
+}
+
+void
+xf86printVideoAdaptorSection (FILE * cf, XF86ConfVideoAdaptorPtr ptr)
+{
+ 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;
+ }
+
+}
+
+void
+xf86freeVideoAdaptorList (XF86ConfVideoAdaptorPtr ptr)
+{
+ 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);
+ }
+}
+
+XF86ConfVideoAdaptorPtr
+xf86findVideoAdaptor (const char *ident, XF86ConfVideoAdaptorPtr p)
+{
+ while (p)
+ {
+ if (xf86nameCompare (ident, p->va_identifier) == 0)
+ return p;
+
+ p = p->list.next;
+ }
+ return NULL;
+}
diff --git a/xorg-server/hw/xfree86/parser/configProcs.h b/xorg-server/hw/xfree86/parser/configProcs.h
index 114cdfe33..d67acc698 100644
--- a/xorg-server/hw/xfree86/parser/configProcs.h
+++ b/xorg-server/hw/xfree86/parser/configProcs.h
@@ -95,8 +95,8 @@ int xf86getSubToken(char **comment);
int xf86getSubTokenWithTab(char **comment, xf86ConfigSymTabRec *tab);
void xf86unGetToken(int token);
char *xf86tokenString(void);
-void xf86parseError(const char *format, ...);
-void xf86validationError(const char *format, ...);
+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 */
diff --git a/xorg-server/hw/xfree86/x86emu/debug.c b/xorg-server/hw/xfree86/x86emu/debug.c
index 04d0741e0..6dea9c7bc 100644
--- a/xorg-server/hw/xfree86/x86emu/debug.c
+++ b/xorg-server/hw/xfree86/x86emu/debug.c
@@ -163,13 +163,13 @@ void x86emu_inc_decoded_inst_len (int x)
M.x86.enc_pos += x;
}
-void x86emu_decode_printf (char *x)
+void x86emu_decode_printf (const char *x)
{
sprintf(M.x86.decoded_buf+M.x86.enc_str_pos,"%s",x);
M.x86.enc_str_pos += strlen(x);
}
-void x86emu_decode_printf2 (char *x, int y)
+void x86emu_decode_printf2 (const char *x, int y)
{
char temp[100];
snprintf(temp,sizeof(temp),x,y);
diff --git a/xorg-server/hw/xfree86/x86emu/fpu.c b/xorg-server/hw/xfree86/x86emu/fpu.c
index b72de1ee5..fbc602da5 100644
--- a/xorg-server/hw/xfree86/x86emu/fpu.c
+++ b/xorg-server/hw/xfree86/x86emu/fpu.c
@@ -52,7 +52,7 @@ void x86emuOp_esc_coprocess_d8(u8 X86EMU_UNUSED(op1))
#ifdef DEBUG
-static char *x86emu_fpu_op_d9_tab[] = {
+static const char *x86emu_fpu_op_d9_tab[] = {
"FLD\tDWORD PTR ", "ESC_D9\t", "FST\tDWORD PTR ", "FSTP\tDWORD PTR ",
"FLDENV\t", "FLDCW\t", "FSTENV\t", "FSTCW\t",
@@ -63,7 +63,7 @@ static char *x86emu_fpu_op_d9_tab[] = {
"FLDENV\t", "FLDCW\t", "FSTENV\t", "FSTCW\t",
};
-static char *x86emu_fpu_op_d9_tab1[] = {
+static const char *x86emu_fpu_op_d9_tab1[] = {
"FLD\t", "FLD\t", "FLD\t", "FLD\t",
"FLD\t", "FLD\t", "FLD\t", "FLD\t",
@@ -299,7 +299,7 @@ void x86emuOp_esc_coprocess_d9(u8 X86EMU_UNUSED(op1))
#ifdef DEBUG
-char *x86emu_fpu_op_da_tab[] = {
+static const char *x86emu_fpu_op_da_tab[] = {
"FIADD\tDWORD PTR ", "FIMUL\tDWORD PTR ", "FICOM\tDWORD PTR ",
"FICOMP\tDWORD PTR ",
"FISUB\tDWORD PTR ", "FISUBR\tDWORD PTR ", "FIDIV\tDWORD PTR ",
@@ -392,7 +392,7 @@ void x86emuOp_esc_coprocess_da(u8 X86EMU_UNUSED(op1))
#ifdef DEBUG
-char *x86emu_fpu_op_db_tab[] = {
+static const char *x86emu_fpu_op_db_tab[] = {
"FILD\tDWORD PTR ", "ESC_DB\t19", "FIST\tDWORD PTR ", "FISTP\tDWORD PTR ",
"ESC_DB\t1C", "FLD\tTBYTE PTR ", "ESC_DB\t1E", "FSTP\tTBYTE PTR ",
@@ -513,7 +513,7 @@ void x86emuOp_esc_coprocess_db(u8 X86EMU_UNUSED(op1))
}
#ifdef DEBUG
-char *x86emu_fpu_op_dc_tab[] = {
+static const char *x86emu_fpu_op_dc_tab[] = {
"FADD\tQWORD PTR ", "FMUL\tQWORD PTR ", "FCOM\tQWORD PTR ",
"FCOMP\tQWORD PTR ",
"FSUB\tQWORD PTR ", "FSUBR\tQWORD PTR ", "FDIV\tQWORD PTR ",
@@ -631,7 +631,7 @@ void x86emuOp_esc_coprocess_dc(u8 X86EMU_UNUSED(op1))
#ifdef DEBUG
-static char *x86emu_fpu_op_dd_tab[] = {
+static const char *x86emu_fpu_op_dd_tab[] = {
"FLD\tQWORD PTR ", "ESC_DD\t29,", "FST\tQWORD PTR ", "FSTP\tQWORD PTR ",
"FRSTOR\t", "ESC_DD\t2D,", "FSAVE\t", "FSTSW\t",
@@ -734,7 +734,7 @@ void x86emuOp_esc_coprocess_dd(u8 X86EMU_UNUSED(op1))
#ifdef DEBUG
-static char *x86emu_fpu_op_de_tab[] =
+static const char *x86emu_fpu_op_de_tab[] =
{
"FIADD\tWORD PTR ", "FIMUL\tWORD PTR ", "FICOM\tWORD PTR ",
"FICOMP\tWORD PTR ",
@@ -856,7 +856,7 @@ void x86emuOp_esc_coprocess_de(u8 X86EMU_UNUSED(op1))
#ifdef DEBUG
-static char *x86emu_fpu_op_df_tab[] = {
+static const char *x86emu_fpu_op_df_tab[] = {
/* mod == 00 */
"FILD\tWORD PTR ", "ESC_DF\t39\n", "FIST\tWORD PTR ", "FISTP\tWORD PTR ",
"FBLD\tTBYTE PTR ", "FILD\tQWORD PTR ", "FBSTP\tTBYTE PTR ",
diff --git a/xorg-server/hw/xfree86/x86emu/ops2.c b/xorg-server/hw/xfree86/x86emu/ops2.c
index 39bd0411d..501d5fcb2 100644
--- a/xorg-server/hw/xfree86/x86emu/ops2.c
+++ b/xorg-server/hw/xfree86/x86emu/ops2.c
@@ -110,7 +110,7 @@ Handles opcode 0x0f,0x80-0x8F
static void x86emuOp2_long_jump(u8 op2)
{
s32 target;
- char *name = NULL;
+ const char *name = NULL;
int cond = 0;
/* conditional jump to word offset. */
@@ -204,7 +204,7 @@ static void x86emuOp2_set_byte(u8 op2)
int mod, rl, rh;
uint destoffset;
u8 *destreg;
- char *name = NULL;
+ const char *name = NULL;
int cond = 0;
START_OF_INSTR();
diff --git a/xorg-server/hw/xfree86/x86emu/x86emu/debug.h b/xorg-server/hw/xfree86/x86emu/x86emu/debug.h
index 47aacb6c3..5f78d0575 100644
--- a/xorg-server/hw/xfree86/x86emu/x86emu/debug.h
+++ b/xorg-server/hw/xfree86/x86emu/x86emu/debug.h
@@ -189,8 +189,8 @@ extern "C" { /* Use "C" linkage when in C++ mode */
#endif
extern void x86emu_inc_decoded_inst_len (int x);
-extern void x86emu_decode_printf (char *x);
-extern void x86emu_decode_printf2 (char *x, int y);
+extern void x86emu_decode_printf (const char *x);
+extern void x86emu_decode_printf2 (const char *x, int y);
extern void x86emu_just_disassemble (void);
extern void x86emu_single_step (void);
extern void x86emu_end_instr (void);