diff options
Diffstat (limited to 'xorg-server/hw/dmx/config')
49 files changed, 9516 insertions, 0 deletions
diff --git a/xorg-server/hw/dmx/config/Canvas.c b/xorg-server/hw/dmx/config/Canvas.c new file mode 100644 index 000000000..c2eba876a --- /dev/null +++ b/xorg-server/hw/dmx/config/Canvas.c @@ -0,0 +1,159 @@ +/* + * Copyright 1987, 1998 The Open Group + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation. + * + * 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 + * OPEN GROUP 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 Open Group 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 Open Group. + */ + +/* + * Copyright 2002 Red Hat Inc., Durham, North Carolina. + * + * 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 on 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 + * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR 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. + */ + +/* + * Authors: + * Rickard E. (Rik) Faith <faith@redhat.com> + * + * This file was originally taken from xc/lib/Xaw/Template.c + */ + +#include <X11/IntrinsicP.h> +#include <X11/StringDefs.h> +#include "CanvasP.h" + +static void CanvasInitialize(Widget request, Widget w, + ArgList args, Cardinal *num_args) +{ +} + +static void CanvasExpose(Widget w, XEvent *event, Region region) +{ + CanvasExposeDataRec data; + + data.w = w; + data.event = event; + data.region = region; + + if (!XtIsRealized(w)) return; + XtCallCallbacks(w, XtNcanvasExposeCallback, (XtPointer)&data); +} + +static void CanvasResize(Widget w) +{ + if (!XtIsRealized(w)) return; + XtCallCallbacks(w, XtNcanvasResizeCallback, (XtPointer)w); +} + +static void CanvasAction(Widget w, XEvent *event, + String *params, Cardinal *num_params) +{ + XtCallCallbacks(w, XtNcallback, (XtPointer)event); +} + +#define offset(field) XtOffsetOf(CanvasRec, canvas.field) +static XtResource resources[] = { + { XtNcallback, XtCCallback, XtRCallback, + sizeof(XtCallbackList), offset(input_callback), XtRCallback, NULL }, + { XtNcanvasExposeCallback, XtCcanvasExposeCallback, XtRCallback, + sizeof(XtCallbackList), offset(expose_callback), XtRCallback, NULL }, + { XtNcanvasResizeCallback, XtCcanvasResizeCallback, XtRCallback, + sizeof(XtCallbackList), offset(resize_callback), XtRCallback, NULL }, +}; +#undef offset + +static XtActionsRec actions[] = +{ + {"canvas", CanvasAction}, +}; + +static char translations[] = +"<Key>: canvas()\n\ +<Motion>: canvas()\n\ +<BtnDown>: canvas()\n\ +<BtnUp>: canvas()\n\ +" +; + +#define Superclass (&widgetClassRec) +CanvasClassRec canvasClassRec = { + /* core */ + { + (WidgetClass)Superclass, /* superclass */ + "Canvas", /* class_name */ + sizeof(CanvasRec), /* widget_size */ + NULL, /* class_initialize */ + NULL, /* class_part_initialize */ + False, /* class_inited */ + CanvasInitialize, /* initialize */ + NULL, /* initialize_hook */ + XtInheritRealize, /* realize */ + actions, /* actions */ + XtNumber(actions), /* num_actions */ + resources, /* resources */ + XtNumber(resources), /* num_resources */ + NULLQUARK, /* xrm_class */ + True, /* compress_motion */ + True, /* compress_exposure */ + True, /* compress_enterleave */ + False, /* visible_interest */ + NULL, /* destroy */ + CanvasResize, /* resize */ + CanvasExpose, /* expose */ + NULL, /* set_values */ + NULL, /* set_values_hook */ + XtInheritSetValuesAlmost, /* set_values_almost */ + NULL, /* get_values_hook */ + NULL, /* accept_focus */ + XtVersion, /* version */ + NULL, /* callback_private */ + translations, /* tm_table */ + XtInheritQueryGeometry, /* query_geometry */ + XtInheritDisplayAccelerator, /* display_accelerator */ + NULL, /* extension */ + }, + /* canvas */ + { + NULL, /* extension */ + } +}; + +WidgetClass canvasWidgetClass = (WidgetClass)&canvasClassRec; diff --git a/xorg-server/hw/dmx/config/Canvas.h b/xorg-server/hw/dmx/config/Canvas.h new file mode 100644 index 000000000..fe9a57f21 --- /dev/null +++ b/xorg-server/hw/dmx/config/Canvas.h @@ -0,0 +1,55 @@ +/* + +Copyright 1987, 1998 The Open Group +Copyright 2002 Red Hat Inc., Durham, North Carolina. + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +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 +OPEN GROUP 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 Open Group 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 Open Group. + +*/ + +/* + * Authors: + * Rickard E. (Rik) Faith <faith@redhat.com> + * + * This file was originally taken from xc/lib/Xaw/Template.h + */ + +#ifndef _Canvas_h +#define _Canvas_h + +#include <X11/Intrinsic.h> + +#define XtNcanvasExposeCallback "canvasExposeCallback" +#define XtCcanvasExposeCallback "CanvasExposeCallback" +#define XtNcanvasResizeCallback "canvasResizeCallback" +#define XtCcanvasResizeCallback "CanvasResizeCallback" + +typedef struct _CanvasClassRec *CanvasWidgetClass; +typedef struct _CanvasRec *CanvasWidget; +extern WidgetClass canvasWidgetClass; + +typedef struct _CanvasExposeDataRec { + Widget w; + XEvent *event; + Region region; +} CanvasExposeDataRec, *CanvasExposeDataPtr; + +#endif /* _Canvas_h */ diff --git a/xorg-server/hw/dmx/config/CanvasP.h b/xorg-server/hw/dmx/config/CanvasP.h new file mode 100644 index 000000000..cf43710f1 --- /dev/null +++ b/xorg-server/hw/dmx/config/CanvasP.h @@ -0,0 +1,65 @@ +/* + +Copyright 1987, 1998 The Open Group +Copyright 2002 Red Hat Inc., Durham, North Carolina. + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +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 +OPEN GROUP 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 Open Group 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 Open Group. + +*/ + +/* + * Authors: + * Rickard E. (Rik) Faith <faith@redhat.com> + * + * This file was originally taken from xc/lib/Xaw/TemplateP.h + */ + +#ifndef _CanvasP_h +#define _CanvasP_h + +#include "Canvas.h" + +/* include superclass private header file */ +#include <X11/CoreP.h> + +typedef struct { + XtPointer extension; +} CanvasClassPart; + +typedef struct _CanvasClassRec { + CoreClassPart core_class; + CanvasClassPart canvas_class; +} CanvasClassRec; + +extern CanvasClassRec canvasClassRec; + +typedef struct { + XtCallbackList input_callback; + XtCallbackList expose_callback; + XtCallbackList resize_callback; +} CanvasPart; + +typedef struct _CanvasRec { + CorePart core; + CanvasPart canvas; +} CanvasRec; + +#endif /* _CanvasP_h */ diff --git a/xorg-server/hw/dmx/config/Makefile.am b/xorg-server/hw/dmx/config/Makefile.am new file mode 100644 index 000000000..c31e04942 --- /dev/null +++ b/xorg-server/hw/dmx/config/Makefile.am @@ -0,0 +1,89 @@ +noinst_LIBRARIES = libdmxconfig.a + +LIBSRCS = parser.y \ + scanner.l \ + dmxparse.c \ + dmxparse.h \ + dmxprint.c \ + dmxprint.h \ + dmxcompat.c \ + dmxcompat.h \ + dmxconfig.c \ + dmxconfig.h + +parser.h: parser.c +scanner.c: scanner.l parser.h + +BUILT_SOURCES = parser.c parser.h scanner.c + +MAINTAINERCLEANFILES = $(BUILT_SOURCES) + +libdmxconfig_a_SOURCES = $(LIBSRCS) + +if GLX +GLX_DEFS = @GL_CFLAGS@ +GLX_INCS = -I@MESA_SOURCE@/include +endif + +AM_YFLAGS = -d +AM_CFLAGS = \ + $(DIX_CFLAGS) \ + -I$(top_srcdir)/hw/dmx \ + $(GLX_INCS) \ + -DHAVE_DMX_CONFIG_H \ + -DDMX_LOG_STANDALONE \ + $(GLX_DEFS) \ + @DMXMODULES_CFLAGS@ + +bin_PROGRAMS = xdmxconfig vdltodmx dmxtodmx + +xdmxconfig_DEPENDENCIES = libdmxconfig.a +xdmxconfig_SOURCES = \ + xdmxconfig.c \ + $(top_srcdir)/hw/dmx/dmxlog.c \ + Canvas.c \ + Canvas.h \ + CanvasP.h +xdmxconfig_LDADD = -L. -ldmxconfig @XDMXCONFIG_DEP_LIBS@ +xdmxconfig_CFLAGS = $(AM_CFLAGS) @XDMXCONFIG_DEP_CFLAGS@ + +vdltodmx_DEPENDENCIES = libdmxconfig.a +vdltodmx_SOURCES = vdltodmx.c +vdltodmx_LDADD = -L. -ldmxconfig + +dmxtodmx_DEPENDENCIES = libdmxconfig.a +dmxtodmx_SOURCES = dmxtodmx.c +dmxtodmx_LDADD = -L. -ldmxconfig + +appmandir = $(APP_MAN_DIR) + +appman_PRE = xdmxconfig.man vdltodmx.man dmxtodmx.man +appman_DATA = $(appman_PRE:man=@APP_MAN_SUFFIX@) + +CLEANFILES = $(appman_DATA) + +SUFFIXES = .$(APP_MAN_SUFFIX) .man + +# Strings to replace in man pages +XORGRELSTRING = @PACKAGE_STRING@ + XORGMANNAME = X Version 11 + +MAN_SUBSTS = -e 's|__vendorversion__|"$(XORGRELSTRING)" "$(XORGMANNAME)"|' + +.man.$(APP_MAN_SUFFIX): + sed $(MAN_SUBSTS) < $< > $@ + +EXTRA_DIST = \ + $(appman_PRE) \ + test-a.in test-a.out \ + test-b.in test-b.out \ + test-c.in test-c.out \ + test-d.in test-d.out \ + test-e.in test-e.out \ + test-f.in test-f.out \ + test-g.in test-g.out \ + test-h.in test-h.out \ + test-i.in test-i.out \ + test-j.in test-j.out \ + test-k.in test-k.out \ + test-l.in test-l.out diff --git a/xorg-server/hw/dmx/config/Makefile.in b/xorg-server/hw/dmx/config/Makefile.in new file mode 100644 index 000000000..6bfacad62 --- /dev/null +++ b/xorg-server/hw/dmx/config/Makefile.in @@ -0,0 +1,875 @@ +# Makefile.in generated by automake 1.10.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +bin_PROGRAMS = xdmxconfig$(EXEEXT) vdltodmx$(EXEEXT) dmxtodmx$(EXEEXT) +subdir = hw/dmx/config +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in TODO \ + parser.c parser.h scanner.c +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \ + $(top_builddir)/include/xorg-server.h \ + $(top_builddir)/include/dix-config.h \ + $(top_builddir)/include/xgl-config.h \ + $(top_builddir)/include/xorg-config.h \ + $(top_builddir)/include/xkb-config.h \ + $(top_builddir)/include/xwin-config.h \ + $(top_builddir)/include/kdrive-config.h +CONFIG_CLEAN_FILES = +LIBRARIES = $(noinst_LIBRARIES) +ARFLAGS = cru +libdmxconfig_a_AR = $(AR) $(ARFLAGS) +libdmxconfig_a_LIBADD = +am__objects_1 = parser.$(OBJEXT) scanner.$(OBJEXT) dmxparse.$(OBJEXT) \ + dmxprint.$(OBJEXT) dmxcompat.$(OBJEXT) dmxconfig.$(OBJEXT) +am_libdmxconfig_a_OBJECTS = $(am__objects_1) +libdmxconfig_a_OBJECTS = $(am_libdmxconfig_a_OBJECTS) +am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(appmandir)" +binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) +PROGRAMS = $(bin_PROGRAMS) +am_dmxtodmx_OBJECTS = dmxtodmx.$(OBJEXT) +dmxtodmx_OBJECTS = $(am_dmxtodmx_OBJECTS) +am_vdltodmx_OBJECTS = vdltodmx.$(OBJEXT) +vdltodmx_OBJECTS = $(am_vdltodmx_OBJECTS) +am_xdmxconfig_OBJECTS = xdmxconfig-xdmxconfig.$(OBJEXT) \ + xdmxconfig-dmxlog.$(OBJEXT) xdmxconfig-Canvas.$(OBJEXT) +xdmxconfig_OBJECTS = $(am_xdmxconfig_OBJECTS) +xdmxconfig_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(xdmxconfig_CFLAGS) \ + $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +@MAINTAINER_MODE_FALSE@am__skiplex = test -f $@ || +LEXCOMPILE = $(LEX) $(LFLAGS) $(AM_LFLAGS) +LTLEXCOMPILE = $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(LEX) $(LFLAGS) $(AM_LFLAGS) +YLWRAP = $(top_srcdir)/ylwrap +@MAINTAINER_MODE_FALSE@am__skipyacc = test -f $@ || +YACCCOMPILE = $(YACC) $(YFLAGS) $(AM_YFLAGS) +LTYACCCOMPILE = $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(YACC) $(YFLAGS) $(AM_YFLAGS) +SOURCES = $(libdmxconfig_a_SOURCES) $(dmxtodmx_SOURCES) \ + $(vdltodmx_SOURCES) $(xdmxconfig_SOURCES) +DIST_SOURCES = $(libdmxconfig_a_SOURCES) $(dmxtodmx_SOURCES) \ + $(vdltodmx_SOURCES) $(xdmxconfig_SOURCES) +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; +appmanDATA_INSTALL = $(INSTALL_DATA) +DATA = $(appman_DATA) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ADMIN_MAN_DIR = @ADMIN_MAN_DIR@ +ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@ +ALLOCA = @ALLOCA@ +AMTAR = @AMTAR@ +APPDEFAULTDIR = @APPDEFAULTDIR@ +APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@ +APP_MAN_DIR = @APP_MAN_DIR@ +APP_MAN_SUFFIX = @APP_MAN_SUFFIX@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BASE_FONT_PATH = @BASE_FONT_PATH@ +BUILD_DATE = @BUILD_DATE@ +BUILD_TIME = @BUILD_TIME@ +CC = @CC@ +CCAS = @CCAS@ +CCASDEPMODE = @CCASDEPMODE@ +CCASFLAGS = @CCASFLAGS@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DARWIN_LIBS = @DARWIN_LIBS@ +DBUS_CFLAGS = @DBUS_CFLAGS@ +DBUS_LIBS = @DBUS_LIBS@ +DEFAULT_LIBRARY_PATH = @DEFAULT_LIBRARY_PATH@ +DEFAULT_LOGPREFIX = @DEFAULT_LOGPREFIX@ +DEFAULT_MODULE_PATH = @DEFAULT_MODULE_PATH@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DGA_CFLAGS = @DGA_CFLAGS@ +DGA_LIBS = @DGA_LIBS@ +DIX_CFLAGS = @DIX_CFLAGS@ +DLLTOOL = @DLLTOOL@ +DMXEXAMPLES_DEP_CFLAGS = @DMXEXAMPLES_DEP_CFLAGS@ +DMXEXAMPLES_DEP_LIBS = @DMXEXAMPLES_DEP_LIBS@ +DMXMODULES_CFLAGS = @DMXMODULES_CFLAGS@ +DMXMODULES_LIBS = @DMXMODULES_LIBS@ +DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@ +DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@ +DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@ +DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ +DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ +DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ +DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@ +DRIPROTO_LIBS = @DRIPROTO_LIBS@ +DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ +DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ +DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ +DSYMUTIL = @DSYMUTIL@ +DTRACE = @DTRACE@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ +FILE_MAN_DIR = @FILE_MAN_DIR@ +FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@ +FREETYPE_CFLAGS = @FREETYPE_CFLAGS@ +FREETYPE_LIBS = @FREETYPE_LIBS@ +GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ +GLX_DEFINES = @GLX_DEFINES@ +GL_CFLAGS = @GL_CFLAGS@ +GL_LIBS = @GL_LIBS@ +GREP = @GREP@ +HAL_CFLAGS = @HAL_CFLAGS@ +HAL_LIBS = @HAL_LIBS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +KDRIVE_CFLAGS = @KDRIVE_CFLAGS@ +KDRIVE_INCS = @KDRIVE_INCS@ +KDRIVE_LIBS = @KDRIVE_LIBS@ +KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@ +KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@ +KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@ +LAUNCHD = @LAUNCHD@ +LDFLAGS = @LDFLAGS@ +LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ +LEX = @LEX@ +LEXLIB = @LEXLIB@ +LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ +LIBDRM_CFLAGS = @LIBDRM_CFLAGS@ +LIBDRM_LIBS = @LIBDRM_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIB_MAN_DIR = @LIB_MAN_DIR@ +LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ +LINUXDOC = @LINUXDOC@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MAKE_HTML = @MAKE_HTML@ +MAKE_PDF = @MAKE_PDF@ +MAKE_PS = @MAKE_PS@ +MAKE_TEXT = @MAKE_TEXT@ +MESA_SOURCE = @MESA_SOURCE@ +MISC_MAN_DIR = @MISC_MAN_DIR@ +MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@ +MKDIR_P = @MKDIR_P@ +MKFONTDIR = @MKFONTDIR@ +MKFONTSCALE = @MKFONTSCALE@ +NMEDIT = @NMEDIT@ +OBJC = @OBJC@ +OBJCCLD = @OBJCCLD@ +OBJCDEPMODE = @OBJCDEPMODE@ +OBJCFLAGS = @OBJCFLAGS@ +OBJCLINK = @OBJCLINK@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ +OPENSSL_LIBS = @OPENSSL_LIBS@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@ +PCIACCESS_LIBS = @PCIACCESS_LIBS@ +PCI_TXT_IDS_PATH = @PCI_TXT_IDS_PATH@ +PERL = @PERL@ +PKG_CONFIG = @PKG_CONFIG@ +PROJECTROOT = @PROJECTROOT@ +PS2PDF = @PS2PDF@ +RANLIB = @RANLIB@ +RAWCPP = @RAWCPP@ +RAWCPPFLAGS = @RAWCPPFLAGS@ +SED = @SED@ +SERVER_MISC_CONFIG_PATH = @SERVER_MISC_CONFIG_PATH@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SOLARIS_ASM_CFLAGS = @SOLARIS_ASM_CFLAGS@ +SOLARIS_INOUT_ARCH = @SOLARIS_INOUT_ARCH@ +STRIP = @STRIP@ +TSLIB_CFLAGS = @TSLIB_CFLAGS@ +TSLIB_LIBS = @TSLIB_LIBS@ +UTILS_SYS_LIBS = @UTILS_SYS_LIBS@ +VENDOR_MAN_VERSION = @VENDOR_MAN_VERSION@ +VENDOR_NAME = @VENDOR_NAME@ +VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@ +VENDOR_RELEASE = @VENDOR_RELEASE@ +VERSION = @VERSION@ +X11APP_ARCHS = @X11APP_ARCHS@ +X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@ +X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@ +XDMCP_CFLAGS = @XDMCP_CFLAGS@ +XDMCP_LIBS = @XDMCP_LIBS@ +XDMXCONFIG_DEP_CFLAGS = @XDMXCONFIG_DEP_CFLAGS@ +XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@ +XDMX_CFLAGS = @XDMX_CFLAGS@ +XDMX_LIBS = @XDMX_LIBS@ +XDMX_SYS_LIBS = @XDMX_SYS_LIBS@ +XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@ +XEGL_LIBS = @XEGL_LIBS@ +XEGL_SYS_LIBS = @XEGL_SYS_LIBS@ +XEPHYR_CFLAGS = @XEPHYR_CFLAGS@ +XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@ +XEPHYR_INCS = @XEPHYR_INCS@ +XEPHYR_LIBS = @XEPHYR_LIBS@ +XF86CONFIGFILE = @XF86CONFIGFILE@ +XF86MISC_CFLAGS = @XF86MISC_CFLAGS@ +XF86MISC_LIBS = @XF86MISC_LIBS@ +XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@ +XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@ +XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@ +XGLMODULES_LIBS = @XGLMODULES_LIBS@ +XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@ +XGLXMODULES_LIBS = @XGLXMODULES_LIBS@ +XGLX_LIBS = @XGLX_LIBS@ +XGLX_SYS_LIBS = @XGLX_SYS_LIBS@ +XGL_LIBS = @XGL_LIBS@ +XGL_MODULE_PATH = @XGL_MODULE_PATH@ +XGL_SYS_LIBS = @XGL_SYS_LIBS@ +XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@ +XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@ +XKB_COMPILED_DIR = @XKB_COMPILED_DIR@ +XKM_OUTPUT_DIR = @XKM_OUTPUT_DIR@ +XLIB_CFLAGS = @XLIB_CFLAGS@ +XLIB_LIBS = @XLIB_LIBS@ +XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@ +XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ +XNEST_LIBS = @XNEST_LIBS@ +XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ +XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@ +XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@ +XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@ +XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@ +XORG_CFLAGS = @XORG_CFLAGS@ +XORG_INCS = @XORG_INCS@ +XORG_LIBS = @XORG_LIBS@ +XORG_MODULES_CFLAGS = @XORG_MODULES_CFLAGS@ +XORG_MODULES_LIBS = @XORG_MODULES_LIBS@ +XORG_OS = @XORG_OS@ +XORG_OS_SUBDIR = @XORG_OS_SUBDIR@ +XORG_SYS_LIBS = @XORG_SYS_LIBS@ +XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@ +XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@ +XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@ +XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@ +XPRINT_CFLAGS = @XPRINT_CFLAGS@ +XPRINT_LIBS = @XPRINT_LIBS@ +XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@ +XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@ +XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@ +XSDL_INCS = @XSDL_INCS@ +XSDL_LIBS = @XSDL_LIBS@ +XSERVERCFLAGS_CFLAGS = @XSERVERCFLAGS_CFLAGS@ +XSERVERCFLAGS_LIBS = @XSERVERCFLAGS_LIBS@ +XSERVERLIBS_CFLAGS = @XSERVERLIBS_CFLAGS@ +XSERVERLIBS_LIBS = @XSERVERLIBS_LIBS@ +XSERVER_LIBS = @XSERVER_LIBS@ +XSERVER_SYS_LIBS = @XSERVER_SYS_LIBS@ +XTSTEXAMPLES_DEP_CFLAGS = @XTSTEXAMPLES_DEP_CFLAGS@ +XTSTEXAMPLES_DEP_LIBS = @XTSTEXAMPLES_DEP_LIBS@ +XVFB_LIBS = @XVFB_LIBS@ +XVFB_SYS_LIBS = @XVFB_SYS_LIBS@ +XWINMODULES_CFLAGS = @XWINMODULES_CFLAGS@ +XWINMODULES_LIBS = @XWINMODULES_LIBS@ +XWIN_LIBS = @XWIN_LIBS@ +XWIN_SERVER_NAME = @XWIN_SERVER_NAME@ +XWIN_SYS_LIBS = @XWIN_SYS_LIBS@ +YACC = @YACC@ +YFLAGS = @YFLAGS@ +__XCONFIGFILE__ = @__XCONFIGFILE__@ +abi_ansic = @abi_ansic@ +abi_extension = @abi_extension@ +abi_font = @abi_font@ +abi_videodrv = @abi_videodrv@ +abi_xinput = @abi_xinput@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +driverdir = @driverdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +extdir = @extdir@ +ft_config = @ft_config@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +launchagentsdir = @launchagentsdir@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +logdir = @logdir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +moduledir = @moduledir@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sdkdir = @sdkdir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +xglmoduledir = @xglmoduledir@ +xpconfigdir = @xpconfigdir@ +noinst_LIBRARIES = libdmxconfig.a +LIBSRCS = parser.y \ + scanner.l \ + dmxparse.c \ + dmxparse.h \ + dmxprint.c \ + dmxprint.h \ + dmxcompat.c \ + dmxcompat.h \ + dmxconfig.c \ + dmxconfig.h + +BUILT_SOURCES = parser.c parser.h scanner.c +MAINTAINERCLEANFILES = $(BUILT_SOURCES) +libdmxconfig_a_SOURCES = $(LIBSRCS) +@GLX_TRUE@GLX_DEFS = @GL_CFLAGS@ +@GLX_TRUE@GLX_INCS = -I@MESA_SOURCE@/include +AM_YFLAGS = -d +AM_CFLAGS = \ + $(DIX_CFLAGS) \ + -I$(top_srcdir)/hw/dmx \ + $(GLX_INCS) \ + -DHAVE_DMX_CONFIG_H \ + -DDMX_LOG_STANDALONE \ + $(GLX_DEFS) \ + @DMXMODULES_CFLAGS@ + +xdmxconfig_DEPENDENCIES = libdmxconfig.a +xdmxconfig_SOURCES = \ + xdmxconfig.c \ + $(top_srcdir)/hw/dmx/dmxlog.c \ + Canvas.c \ + Canvas.h \ + CanvasP.h + +xdmxconfig_LDADD = -L. -ldmxconfig @XDMXCONFIG_DEP_LIBS@ +xdmxconfig_CFLAGS = $(AM_CFLAGS) @XDMXCONFIG_DEP_CFLAGS@ +vdltodmx_DEPENDENCIES = libdmxconfig.a +vdltodmx_SOURCES = vdltodmx.c +vdltodmx_LDADD = -L. -ldmxconfig +dmxtodmx_DEPENDENCIES = libdmxconfig.a +dmxtodmx_SOURCES = dmxtodmx.c +dmxtodmx_LDADD = -L. -ldmxconfig +appmandir = $(APP_MAN_DIR) +appman_PRE = xdmxconfig.man vdltodmx.man dmxtodmx.man +appman_DATA = $(appman_PRE:man=@APP_MAN_SUFFIX@) +CLEANFILES = $(appman_DATA) +SUFFIXES = .$(APP_MAN_SUFFIX) .man + +# Strings to replace in man pages +XORGRELSTRING = @PACKAGE_STRING@ +XORGMANNAME = X Version 11 +MAN_SUBSTS = -e 's|__vendorversion__|"$(XORGRELSTRING)" "$(XORGMANNAME)"|' +EXTRA_DIST = \ + $(appman_PRE) \ + test-a.in test-a.out \ + test-b.in test-b.out \ + test-c.in test-c.out \ + test-d.in test-d.out \ + test-e.in test-e.out \ + test-f.in test-f.out \ + test-g.in test-g.out \ + test-h.in test-h.out \ + test-i.in test-i.out \ + test-j.in test-j.out \ + test-k.in test-k.out \ + test-l.in test-l.out + +all: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) all-am + +.SUFFIXES: +.SUFFIXES: .$(APP_MAN_SUFFIX) .man .c .l .lo .o .obj .y +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hw/dmx/config/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign hw/dmx/config/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +clean-noinstLIBRARIES: + -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) +libdmxconfig.a: $(libdmxconfig_a_OBJECTS) $(libdmxconfig_a_DEPENDENCIES) + -rm -f libdmxconfig.a + $(libdmxconfig_a_AR) libdmxconfig.a $(libdmxconfig_a_OBJECTS) $(libdmxconfig_a_LIBADD) + $(RANLIB) libdmxconfig.a +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + if test -f $$p \ + || test -f $$p1 \ + ; then \ + f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \ + else :; fi; \ + done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ + rm -f "$(DESTDIR)$(bindir)/$$f"; \ + done + +clean-binPROGRAMS: + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f $$p $$f"; \ + rm -f $$p $$f ; \ + done +dmxtodmx$(EXEEXT): $(dmxtodmx_OBJECTS) $(dmxtodmx_DEPENDENCIES) + @rm -f dmxtodmx$(EXEEXT) + $(LINK) $(dmxtodmx_OBJECTS) $(dmxtodmx_LDADD) $(LIBS) +vdltodmx$(EXEEXT): $(vdltodmx_OBJECTS) $(vdltodmx_DEPENDENCIES) + @rm -f vdltodmx$(EXEEXT) + $(LINK) $(vdltodmx_OBJECTS) $(vdltodmx_LDADD) $(LIBS) +xdmxconfig$(EXEEXT): $(xdmxconfig_OBJECTS) $(xdmxconfig_DEPENDENCIES) + @rm -f xdmxconfig$(EXEEXT) + $(xdmxconfig_LINK) $(xdmxconfig_OBJECTS) $(xdmxconfig_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dmxcompat.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dmxconfig.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dmxparse.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dmxprint.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dmxtodmx.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parser.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scanner.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vdltodmx.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xdmxconfig-Canvas.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xdmxconfig-dmxlog.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xdmxconfig-xdmxconfig.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +xdmxconfig-xdmxconfig.o: xdmxconfig.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xdmxconfig_CFLAGS) $(CFLAGS) -MT xdmxconfig-xdmxconfig.o -MD -MP -MF $(DEPDIR)/xdmxconfig-xdmxconfig.Tpo -c -o xdmxconfig-xdmxconfig.o `test -f 'xdmxconfig.c' || echo '$(srcdir)/'`xdmxconfig.c +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/xdmxconfig-xdmxconfig.Tpo $(DEPDIR)/xdmxconfig-xdmxconfig.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='xdmxconfig.c' object='xdmxconfig-xdmxconfig.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xdmxconfig_CFLAGS) $(CFLAGS) -c -o xdmxconfig-xdmxconfig.o `test -f 'xdmxconfig.c' || echo '$(srcdir)/'`xdmxconfig.c + +xdmxconfig-xdmxconfig.obj: xdmxconfig.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xdmxconfig_CFLAGS) $(CFLAGS) -MT xdmxconfig-xdmxconfig.obj -MD -MP -MF $(DEPDIR)/xdmxconfig-xdmxconfig.Tpo -c -o xdmxconfig-xdmxconfig.obj `if test -f 'xdmxconfig.c'; then $(CYGPATH_W) 'xdmxconfig.c'; else $(CYGPATH_W) '$(srcdir)/xdmxconfig.c'; fi` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/xdmxconfig-xdmxconfig.Tpo $(DEPDIR)/xdmxconfig-xdmxconfig.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='xdmxconfig.c' object='xdmxconfig-xdmxconfig.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xdmxconfig_CFLAGS) $(CFLAGS) -c -o xdmxconfig-xdmxconfig.obj `if test -f 'xdmxconfig.c'; then $(CYGPATH_W) 'xdmxconfig.c'; else $(CYGPATH_W) '$(srcdir)/xdmxconfig.c'; fi` + +xdmxconfig-dmxlog.o: $(top_srcdir)/hw/dmx/dmxlog.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xdmxconfig_CFLAGS) $(CFLAGS) -MT xdmxconfig-dmxlog.o -MD -MP -MF $(DEPDIR)/xdmxconfig-dmxlog.Tpo -c -o xdmxconfig-dmxlog.o `test -f '$(top_srcdir)/hw/dmx/dmxlog.c' || echo '$(srcdir)/'`$(top_srcdir)/hw/dmx/dmxlog.c +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/xdmxconfig-dmxlog.Tpo $(DEPDIR)/xdmxconfig-dmxlog.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/hw/dmx/dmxlog.c' object='xdmxconfig-dmxlog.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xdmxconfig_CFLAGS) $(CFLAGS) -c -o xdmxconfig-dmxlog.o `test -f '$(top_srcdir)/hw/dmx/dmxlog.c' || echo '$(srcdir)/'`$(top_srcdir)/hw/dmx/dmxlog.c + +xdmxconfig-dmxlog.obj: $(top_srcdir)/hw/dmx/dmxlog.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xdmxconfig_CFLAGS) $(CFLAGS) -MT xdmxconfig-dmxlog.obj -MD -MP -MF $(DEPDIR)/xdmxconfig-dmxlog.Tpo -c -o xdmxconfig-dmxlog.obj `if test -f '$(top_srcdir)/hw/dmx/dmxlog.c'; then $(CYGPATH_W) '$(top_srcdir)/hw/dmx/dmxlog.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/hw/dmx/dmxlog.c'; fi` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/xdmxconfig-dmxlog.Tpo $(DEPDIR)/xdmxconfig-dmxlog.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/hw/dmx/dmxlog.c' object='xdmxconfig-dmxlog.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xdmxconfig_CFLAGS) $(CFLAGS) -c -o xdmxconfig-dmxlog.obj `if test -f '$(top_srcdir)/hw/dmx/dmxlog.c'; then $(CYGPATH_W) '$(top_srcdir)/hw/dmx/dmxlog.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/hw/dmx/dmxlog.c'; fi` + +xdmxconfig-Canvas.o: Canvas.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xdmxconfig_CFLAGS) $(CFLAGS) -MT xdmxconfig-Canvas.o -MD -MP -MF $(DEPDIR)/xdmxconfig-Canvas.Tpo -c -o xdmxconfig-Canvas.o `test -f 'Canvas.c' || echo '$(srcdir)/'`Canvas.c +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/xdmxconfig-Canvas.Tpo $(DEPDIR)/xdmxconfig-Canvas.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='Canvas.c' object='xdmxconfig-Canvas.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xdmxconfig_CFLAGS) $(CFLAGS) -c -o xdmxconfig-Canvas.o `test -f 'Canvas.c' || echo '$(srcdir)/'`Canvas.c + +xdmxconfig-Canvas.obj: Canvas.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xdmxconfig_CFLAGS) $(CFLAGS) -MT xdmxconfig-Canvas.obj -MD -MP -MF $(DEPDIR)/xdmxconfig-Canvas.Tpo -c -o xdmxconfig-Canvas.obj `if test -f 'Canvas.c'; then $(CYGPATH_W) 'Canvas.c'; else $(CYGPATH_W) '$(srcdir)/Canvas.c'; fi` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/xdmxconfig-Canvas.Tpo $(DEPDIR)/xdmxconfig-Canvas.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='Canvas.c' object='xdmxconfig-Canvas.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(xdmxconfig_CFLAGS) $(CFLAGS) -c -o xdmxconfig-Canvas.obj `if test -f 'Canvas.c'; then $(CYGPATH_W) 'Canvas.c'; else $(CYGPATH_W) '$(srcdir)/Canvas.c'; fi` + +.l.c: + $(am__skiplex) $(SHELL) $(YLWRAP) $< $(LEX_OUTPUT_ROOT).c $@ -- $(LEXCOMPILE) + +.y.c: + $(am__skipyacc) $(SHELL) $(YLWRAP) $< y.tab.c $@ y.tab.h $*.h y.output $*.output -- $(YACCCOMPILE) + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-appmanDATA: $(appman_DATA) + @$(NORMAL_INSTALL) + test -z "$(appmandir)" || $(MKDIR_P) "$(DESTDIR)$(appmandir)" + @list='$(appman_DATA)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=$(am__strip_dir) \ + echo " $(appmanDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(appmandir)/$$f'"; \ + $(appmanDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(appmandir)/$$f"; \ + done + +uninstall-appmanDATA: + @$(NORMAL_UNINSTALL) + @list='$(appman_DATA)'; for p in $$list; do \ + f=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(appmandir)/$$f'"; \ + rm -f "$(DESTDIR)$(appmandir)/$$f"; \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) check-am +all-am: Makefile $(LIBRARIES) $(PROGRAMS) $(DATA) +installdirs: + for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(appmandir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -rm -f parser.c + -rm -f parser.h + -rm -f scanner.c + -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-am + +clean-am: clean-binPROGRAMS clean-generic clean-libtool \ + clean-noinstLIBRARIES mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: install-appmanDATA + +install-dvi: install-dvi-am + +install-exec-am: install-binPROGRAMS + +install-html: install-html-am + +install-info: install-info-am + +install-man: + +install-pdf: install-pdf-am + +install-ps: install-ps-am + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-appmanDATA uninstall-binPROGRAMS + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ + clean-generic clean-libtool clean-noinstLIBRARIES ctags \ + distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-appmanDATA \ + install-binPROGRAMS install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags uninstall uninstall-am \ + uninstall-appmanDATA uninstall-binPROGRAMS + + +parser.h: parser.c +scanner.c: scanner.l parser.h + +.man.$(APP_MAN_SUFFIX): + sed $(MAN_SUBSTS) < $< > $@ +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/xorg-server/hw/dmx/config/TODO b/xorg-server/hw/dmx/config/TODO new file mode 100644 index 000000000..2998ff4a0 --- /dev/null +++ b/xorg-server/hw/dmx/config/TODO @@ -0,0 +1,7 @@ +Fri May 31 13:20:17 2002 + +1) Sanitize values from input boxes. + +2) Add canvas colors to cavas widget resources or to command-line options. + +3) Add ability to edit option line(s) and wall. diff --git a/xorg-server/hw/dmx/config/dmxcompat.c b/xorg-server/hw/dmx/config/dmxcompat.c new file mode 100644 index 000000000..b4190ffcc --- /dev/null +++ b/xorg-server/hw/dmx/config/dmxcompat.c @@ -0,0 +1,236 @@ +/* + * Copyright 2002 Red Hat Inc., Durham, North Carolina. + * + * 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 on 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 + * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR 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. + */ + +/* + * Authors: + * Rickard E. (Rik) Faith <faith@redhat.com> + */ + +/** \file + * This file provides some compatibility support for reading VDL files + * that are used by xmovie + * (http://www.llnl.gov/icc/sdd/img/xmovie/xmovie.shtml). + * + * This file is not used by the DMX server. + */ + +#ifdef HAVE_DMX_CONFIG_H +#include <dmx-config.h> +#endif + +#include "dmxconfig.h" +#include "dmxparse.h" +#include "dmxcompat.h" +#include "parser.h" +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <ctype.h> + +static int dmxVDLReadLine(FILE *str, char *buf, int len) +{ + if (fgets(buf, len, str)) return strlen(buf); + return 0; +} + +static int dmxVDLCount(const char *buf) +{ + return strtol(buf, NULL, 10); +} + +static void dmxVDLVirtualEntry(const char *buf, + char *name, int *len, + int *x, int *y) +{ + char *end; + const char *s; + char *d; + int start; + + *x = strtol(buf, &end, 10); + *y = strtol(end, &end, 10); + + for (s = end, d = name, start = 1; *s && *s != '['; ++s) { + if (start && isspace(*s)) continue; + *d++ = *s; + start = 0; + } + *d = '\0'; + while (d > name && isspace(d[-1])) *--d = '\0'; /* remove trailing space */ + *len = strlen(name); +} + +static void dmxVDLDisplayEntry(const char *buf, + char *name, int *len, + int *x, int *y, + int *xoff, int *yoff, + int *xorig, int *yorig) +{ + const char *pt; + char *end; + + pt = strchr(buf, ' '); + strncpy(name, buf, pt-buf); + name[pt-buf] = '\0'; + *len = strlen(name); + + *x = strtol(pt, &end, 10); + *y = strtol(end, &end, 10); + *xorig = strtol(end, &end, 10); + *yorig = strtol(end, &end, 10); + *xoff = strtol(end, &end, 10); + *yoff = strtol(end, NULL, 10); +} + +/** Read from the VDL format \a filename and return a newly allocated \a + * DMXConfigEntryPtr */ +DMXConfigEntryPtr dmxVDLRead(const char *filename) +{ + FILE *str; + char buf[2048]; /* RATS: Use ok */ + char *pt; + int lineno = 0; + DMXConfigEntryPtr entry = NULL; + DMXConfigVirtualPtr virtual = NULL; + DMXConfigSubPtr sub = NULL; + DMXConfigDisplayPtr display = NULL; + DMXConfigFullDimPtr fdim = NULL; + int vcount = 0; + int dcount = 0; + int icount = 0; + int x, y, xoff, yoff, xorig, yorig; + char name[2048]; /* RATS: Use ok */ + const char *tmp; + int len; + enum { + simulateFlag, + virtualCount, + virtualEntry, + displayCount, + displayEntry, + ignoreCount, + ignoreEntry + } state = simulateFlag; + + if (!filename) str = stdin; + else str = fopen(filename, "r"); + if (!str) return NULL; + + while (dmxVDLReadLine(str, buf, sizeof(buf))) { + DMXConfigCommentPtr comment = NULL; + + ++lineno; + for (pt = buf; *pt; pt++) + if (*pt == '\r' || *pt == '\n') { + *pt = '\0'; + break; + } + if (buf[0] == '#') { + tmp = dmxConfigCopyString(buf + 1, strlen(buf + 1)); + comment = dmxConfigCreateComment(T_COMMENT, lineno, tmp); + entry = dmxConfigAddEntry(entry, dmxConfigComment, comment, NULL); + continue; + } + switch (state) { + case simulateFlag: + state = virtualCount; + break; + case virtualCount: + vcount = dmxVDLCount(buf); + state = virtualEntry; + break; + case virtualEntry: + len = sizeof(name); + dmxVDLVirtualEntry(buf, name, &len, &x, &y); + tmp = dmxConfigCopyString(name, len); + virtual = dmxConfigCreateVirtual(NULL, + dmxConfigCreateString(T_STRING, + lineno, + NULL, + tmp), + dmxConfigCreatePair(T_DIMENSION, + lineno, + NULL, + x, y, 0, 0), + NULL, NULL, NULL); + state = displayCount; + break; + case displayCount: + dcount = dmxVDLCount(buf); + state = displayEntry; + break; + case displayEntry: + dmxVDLDisplayEntry(buf, name, &len, &x, &y, &xoff, &yoff, + &xorig, &yorig); + tmp = dmxConfigCopyString(name, len); + fdim = dmxConfigCreateFullDim( + dmxConfigCreatePartDim( + dmxConfigCreatePair(T_DIMENSION, + lineno, + NULL, + x, y, 0, 0), + dmxConfigCreatePair(T_OFFSET, + lineno, + NULL, + xoff, yoff, + xoff, yoff)), + NULL); + display = dmxConfigCreateDisplay(NULL, + dmxConfigCreateString(T_STRING, + lineno, + NULL, + tmp), + fdim, + dmxConfigCreatePair(T_ORIGIN, + lineno, + NULL, + xorig, yorig, + 0, 0), + NULL); + sub = dmxConfigAddSub(sub, dmxConfigSubDisplay(display)); + if (!--dcount) { + state = ignoreCount; + virtual->subentry = sub; + entry = dmxConfigAddEntry(entry, + dmxConfigVirtual, + NULL, + virtual); + virtual = NULL; + sub = NULL; + } + break; + case ignoreCount: + icount = dmxVDLCount(buf); + state = ignoreEntry; + break; + case ignoreEntry: + if (!--icount) state = virtualEntry; + break; + } + } + return entry; +} diff --git a/xorg-server/hw/dmx/config/dmxcompat.h b/xorg-server/hw/dmx/config/dmxcompat.h new file mode 100644 index 000000000..718892040 --- /dev/null +++ b/xorg-server/hw/dmx/config/dmxcompat.h @@ -0,0 +1,44 @@ +/* + * Copyright 2002 Red Hat Inc., Durham, North Carolina. + * + * 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 on 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 + * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR 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. + */ + +/* + * Authors: + * Rickard E. (Rik) Faith <faith@redhat.com> + * + */ + +/** \file + * Interface to VDL compatibility support. \see dmxcompat.c + * + * This file is not used by the DMX server. + */ + +#ifndef _DMXCOMPAT_H_ +#define _DMXCOMPAT_H_ + +extern DMXConfigEntryPtr dmxVDLRead(const char *filename); +#endif diff --git a/xorg-server/hw/dmx/config/dmxconfig.c b/xorg-server/hw/dmx/config/dmxconfig.c new file mode 100644 index 000000000..225d89277 --- /dev/null +++ b/xorg-server/hw/dmx/config/dmxconfig.c @@ -0,0 +1,498 @@ +/* + * Copyright 2002-2003 Red Hat Inc., Durham, North Carolina. + * + * 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 on 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 + * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR 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. + */ + +/* + * Authors: + * Rickard E. (Rik) Faith <faith@redhat.com> + * + */ + +/** \file + * Provides interface for reading DMX configuration files and for + * combining that information with command-line configuration parameters. */ + + +#ifdef HAVE_DMX_CONFIG_H +#include <dmx-config.h> +#endif + +#include "dmx.h" +#include "dmxinput.h" +#include "dmxconfig.h" +#include "dmxparse.h" +#include "dmxlog.h" +#include "dmxcb.h" +#include "dmxstat.h" +#include "parser.h" + +extern int yyparse(void); +extern FILE *yyin; + +static char *dmxXkbRules; +static char *dmxXkbModel; +static char *dmxXkbLayout; +static char *dmxXkbVariant; +static char *dmxXkbOptions; + +/** Stores lists of configuration information. */ +typedef struct DMXConfigListStruct { + const char *name; + struct DMXConfigListStruct *next; +} DMXConfigList, *DMXConfigListPtr; + +/** This stucture stores the parsed configuration information. */ +typedef struct DMXConfigCmdStruct { + const char *filename; + const char *config; + DMXConfigList *displays; + DMXConfigList *inputs; + DMXConfigList *xinputs; +} DMXConfigCmd, *DMXConfigCmdPtr; + +DMXConfigEntryPtr dmxConfigEntry; +static DMXConfigCmd dmxConfigCmd; + +static int dmxDisplaysFromCommandLine; + +/** Make a note that \a display is the name of an X11 display that + * should be initialized as a backend (output) display. Called from + * #ddxProcessArgument. */ +void dmxConfigStoreDisplay(const char *display) +{ + DMXConfigListPtr entry = malloc(sizeof(*entry)); + entry->name = strdup(display); + entry->next = NULL; + if (!dmxConfigCmd.displays) dmxConfigCmd.displays = entry; + else { + DMXConfigList *pt; + for (pt = dmxConfigCmd.displays; pt->next; pt = pt->next); + if (!pt) + dmxLog(dmxFatal, "dmxConfigStoreDisplay: end of list non-NULL\n"); + pt->next = entry; + } + ++dmxDisplaysFromCommandLine; +} + +/** Make a note that \a input is the name of an X11 display that should + * be used for input (either a backend or a console input device). */ +void dmxConfigStoreInput(const char *input) +{ + DMXConfigListPtr entry = malloc(sizeof(*entry)); + entry->name = strdup(input); + entry->next = NULL; + if (!dmxConfigCmd.inputs) dmxConfigCmd.inputs = entry; + else { + DMXConfigList *pt; + for (pt = dmxConfigCmd.inputs; pt->next; pt = pt->next); + if (!pt) + dmxLog(dmxFatal, "dmxConfigStoreInput: end of list non-NULL\n"); + pt->next = entry; + } +} + +/** Make a note that \a input is the name of an X11 display that should + * be used for input from XInput extension devices. */ +void dmxConfigStoreXInput(const char *input) +{ + DMXConfigListPtr entry = malloc(sizeof(*entry)); + entry->name = strdup(input); + entry->next = NULL; + if (!dmxConfigCmd.xinputs) dmxConfigCmd.xinputs = entry; + else { + DMXConfigList *pt; + for (pt = dmxConfigCmd.xinputs; pt->next; pt = pt->next); + if (!pt) + dmxLog(dmxFatal, "dmxConfigStoreXInput: end of list non-NULL\n"); + pt->next = entry; + } +} + +/** Make a note that \a file is the configuration file. */ +void dmxConfigStoreFile(const char *file) +{ + if (dmxConfigCmd.filename) + dmxLog(dmxFatal, "Only one -configfile allowed\n"); + dmxConfigCmd.filename = strdup(file); +} + +/** Make a note that \a config should be used as the configuration for + * current instantiation of the DMX server. */ +void dmxConfigStoreConfig(const char *config) +{ + if (dmxConfigCmd.config) dmxLog(dmxFatal, "Only one -config allowed\n"); + dmxConfigCmd.config = strdup(config); +} + +static int dmxConfigReadFile(const char *filename, int debug) +{ + FILE *str; + + if (!(str = fopen(filename, "r"))) return -1; + dmxLog(dmxInfo, "Reading configuration file \"%s\"\n", filename); + yyin = str; + yydebug = debug; + yyparse(); + fclose(str); + return 0; +} + +static const char *dmxConfigMatch(const char *target, DMXConfigEntryPtr entry) +{ + DMXConfigVirtualPtr v = entry->virtual; + const char *name = NULL; + + if (v && v->name) name = v->name; + + if (v && !dmxConfigCmd.config) return v->name ? v->name : "<noname>"; + if (!name) return NULL; + if (!strcmp(name, target)) return name; + return NULL; +} + +static DMXScreenInfo *dmxConfigAddDisplay(const char *name, + int scrnWidth, int scrnHeight, + int scrnX, int scrnY, + int scrnXSign, int scrnYSign, + int rootWidth, int rootHeight, + int rootX, int rootY, + int rootXSign, int rootYSign) +{ + DMXScreenInfo *dmxScreen; + + if (!(dmxScreens = realloc(dmxScreens, + (dmxNumScreens+1) * sizeof(*dmxScreens)))) + dmxLog(dmxFatal, + "dmxConfigAddDisplay: realloc failed for screen %d (%s)\n", + dmxNumScreens, name); + + dmxScreen = &dmxScreens[dmxNumScreens]; + memset(dmxScreen, 0, sizeof(*dmxScreen)); + dmxScreen->name = name; + dmxScreen->index = dmxNumScreens; + dmxScreen->scrnWidth = scrnWidth; + dmxScreen->scrnHeight = scrnHeight; + dmxScreen->scrnX = scrnX; + dmxScreen->scrnY = scrnY; + dmxScreen->scrnXSign = scrnXSign; + dmxScreen->scrnYSign = scrnYSign; + dmxScreen->rootWidth = rootWidth; + dmxScreen->rootHeight = rootHeight; + dmxScreen->rootX = rootX; + dmxScreen->rootY = rootY; + dmxScreen->stat = dmxStatAlloc(); + ++dmxNumScreens; + return dmxScreen; +} + +DMXInputInfo *dmxConfigAddInput(const char *name, int core) +{ + DMXInputInfo *dmxInput; + + if (!(dmxInputs = realloc(dmxInputs, + (dmxNumInputs+1) * sizeof(*dmxInputs)))) + dmxLog(dmxFatal, + "dmxConfigAddInput: realloc failed for input %d (%s)\n", + dmxNumInputs, name); + + dmxInput = &dmxInputs[dmxNumInputs]; + + memset(dmxInput, 0, sizeof(*dmxInput)); + dmxInput->name = name; + dmxInput->inputIdx = dmxNumInputs; + dmxInput->scrnIdx = -1; + dmxInput->core = core; + ++dmxNumInputs; + return dmxInput; +} + +static void dmxConfigCopyFromDisplay(DMXConfigDisplayPtr d) +{ + DMXScreenInfo *dmxScreen; + + dmxScreen = dmxConfigAddDisplay(d->name, + d->scrnWidth, d->scrnHeight, + d->scrnX, d->scrnY, + d->scrnXSign, d->scrnYSign, + d->rootWidth, d->rootHeight, + d->rootX, d->rootY, + d->rootXSign, d->rootXSign); + dmxScreen->where = PosAbsolute; + dmxScreen->whereX = d->rootXOrigin; + dmxScreen->whereY = d->rootYOrigin; +} + +static void dmxConfigCopyFromWall(DMXConfigWallPtr w) +{ + DMXConfigStringPtr pt; + DMXScreenInfo *dmxScreen; + int edge = dmxNumScreens; + int last = dmxNumScreens; + + if (!w->xwall && !w->ywall) { /* Try to make it square */ + int count; + for (pt = w->nameList, count = 0; pt; pt = pt->next) ++count; + w->xwall = sqrt(count) + .5; + } + + for (pt = w->nameList; pt; pt = pt->next) { + dmxScreen = dmxConfigAddDisplay(pt->string, w->width, w->height, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); + if (pt == w->nameList) { /* Upper left */ + dmxScreen->where = PosAbsolute; + dmxScreen->whereX = 0; + dmxScreen->whereY = 0; + } else if (w->xwall) { /* Tile left to right, then top to bottom */ + if (!((dmxNumScreens-1) % w->xwall)) { + dmxScreen->where = PosBelow; + dmxScreen->whereRefScreen = edge; + edge = dmxNumScreens-1; + } else { + dmxScreen->where = PosRightOf; + dmxScreen->whereRefScreen = last; + } + } else { /* Tile top to bottom, then left to right */ + if (!((dmxNumScreens-1) % w->ywall)) { + dmxScreen->where = PosRightOf; + dmxScreen->whereRefScreen = edge; + edge = dmxNumScreens-1; + } else { + dmxScreen->where = PosBelow; + dmxScreen->whereRefScreen = last; + } + + } + last = dmxNumScreens-1; + if (dmxScreen->where == PosAbsolute) + dmxLog(dmxInfo, "Added %s at %d %d\n", + pt->string, dmxScreen->whereX, dmxScreen->whereY); + else + dmxLog(dmxInfo, "Added %s %s %s\n", + pt->string, + dmxScreen->where == PosBelow ? "below" : "right of", + dmxScreens[dmxScreen->whereRefScreen].name); + } +} + +static void dmxConfigCopyFromOption(DMXConfigOptionPtr o) +{ + DMXConfigStringPtr pt; + int argc = 0; + char **argv = NULL; + + if (serverGeneration != 1) return; /* FIXME: only do once, for now */ + if (!o || !o->string) return; + for (pt = o->option; pt; pt = pt->next) { + if (pt->string) { + ++argc; + argv = realloc(argv, (argc+1) * sizeof(*argv)); + argv[argc] = (char *)pt->string; + } + } + argv[0] = NULL; + ProcessCommandLine(argc+1, argv); + free(argv); +} + +static void dmxConfigCopyFromParam(DMXConfigParamPtr p) +{ + const char **argv; + int argc; + + if ((argv = dmxConfigLookupParam(p, "xkbrules", &argc)) && argc == 2) { + dmxConfigSetXkbRules(argv[1]); + } else if ((argv = dmxConfigLookupParam(p, "xkbmodel", &argc)) + && argc == 2) { + dmxConfigSetXkbModel(argv[1]); + } else if ((argv = dmxConfigLookupParam(p, "xkblayout", &argc)) + && argc == 2) { + dmxConfigSetXkbLayout(argv[1]); + } else if ((argv = dmxConfigLookupParam(p, "xkbvariant", &argc)) + && argc == 2) { + dmxConfigSetXkbVariant(argv[1]); + } else if ((argv = dmxConfigLookupParam(p, "xkboptions", &argc)) + && argc == 2) { + dmxConfigSetXkbOptions(argv[1]); + } +} + +static void dmxConfigCopyData(DMXConfigVirtualPtr v) +{ + DMXConfigSubPtr sub; + + if (v->dim) dmxSetWidthHeight(v->dim->x, v->dim->y); + else dmxSetWidthHeight(0, 0); + for (sub = v->subentry; sub; sub = sub->next) { + switch (sub->type) { + case dmxConfigDisplay: dmxConfigCopyFromDisplay(sub->display); break; + case dmxConfigWall: dmxConfigCopyFromWall(sub->wall); break; + case dmxConfigOption: dmxConfigCopyFromOption(sub->option); break; + case dmxConfigParam: dmxConfigCopyFromParam(sub->param); break; + default: + dmxLog(dmxFatal, + "dmxConfigCopyData: not a display, wall, or value\n"); + } + } +} + +static void dmxConfigFromCommandLine(void) +{ + DMXConfigListPtr pt; + + dmxLog(dmxInfo, "Using configuration from command line\n"); + for (pt = dmxConfigCmd.displays; pt; pt = pt->next) { + DMXScreenInfo *dmxScreen = dmxConfigAddDisplay(pt->name, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0); + if (dmxNumScreens == 1) { + dmxScreen->where = PosAbsolute; + dmxScreen->whereX = 0; + dmxScreen->whereY = 0; + dmxLog(dmxInfo, "Added %s at %d %d\n", + dmxScreen->name, dmxScreen->whereX, dmxScreen->whereY); + } else { + dmxScreen->where = PosRightOf; + dmxScreen->whereRefScreen = dmxNumScreens - 2; + if (dmxScreen->whereRefScreen < 0) dmxScreen->whereRefScreen = 0; + dmxLog(dmxInfo, "Added %s %s %s\n", + dmxScreen->name, + dmxScreen->where == PosBelow ? "below" : "right of", + dmxScreens[dmxScreen->whereRefScreen].name); + } + } +} + +static void dmxConfigFromConfigFile(void) +{ + DMXConfigEntryPtr pt; + const char *name; + + for (pt = dmxConfigEntry; pt; pt = pt->next) { + /* FIXME -- if an input is specified, use it */ + if (pt->type != dmxConfigVirtual) continue; + if ((name = dmxConfigMatch(dmxConfigCmd.config, pt))) { + dmxLog(dmxInfo, "Using configuration \"%s\"\n", name); + dmxConfigCopyData(pt->virtual); + return; + } + } + dmxLog(dmxFatal, "Could not find configuration \"%s\" in \"%s\"\n", + dmxConfigCmd.config, dmxConfigCmd.filename); +} + +static void dmxConfigConfigInputs(void) +{ + DMXConfigListPtr pt; + + if (dmxNumInputs) return; + + if (dmxConfigCmd.inputs) { /* Use command line */ + for (pt = dmxConfigCmd.inputs; pt; pt = pt->next) + dmxConfigAddInput(pt->name, TRUE); + } else if (dmxNumScreens) { /* Use first display */ + dmxConfigAddInput(dmxScreens[0].name, TRUE); + } else { /* Use dummy */ + dmxConfigAddInput("dummy", TRUE); + } + + if (dmxConfigCmd.xinputs) { /* Non-core devices from command line */ + for (pt = dmxConfigCmd.xinputs; pt; pt = pt->next) + dmxConfigAddInput(pt->name, FALSE); + } +} + +/** Set up the appropriate global variables so that the DMX server will + * be initialized using the configuration specified in the config file + * and on the command line. */ +void dmxConfigConfigure(void) +{ + if (dmxConfigEntry) { + dmxConfigFreeEntry(dmxConfigEntry); + dmxConfigEntry = NULL; + } + if (dmxConfigCmd.filename) { + if (dmxConfigCmd.displays) + dmxLog(dmxWarning, + "Using configuration file \"%s\" instead of command line\n", + dmxConfigCmd.filename); + dmxConfigReadFile(dmxConfigCmd.filename, 0); + dmxConfigFromConfigFile(); + } else { + if (dmxConfigCmd.config) + dmxLog(dmxWarning, + "Configuration name (%s) without configuration file\n", + dmxConfigCmd.config); + dmxConfigFromCommandLine(); + } + dmxConfigConfigInputs(); +} + +/** This function determines the number of displays we WILL have and + * sets MAXSCREENS to that value. This is difficult since the number + * depends on the command line (which is easy to count) or on the config + * file, which has to be parsed. */ +void dmxConfigSetMaxScreens(void) +{ + static int processing = 0; + + if (processing) return; /* Prevent reentry via ProcessCommandLine */ + processing = 1; + if (dmxConfigCmd.filename) { + if (!dmxNumScreens) + dmxConfigConfigure(); +#ifndef MAXSCREENS + SetMaxScreens(dmxNumScreens); +#endif + } else +#ifndef MAXSCREENS + SetMaxScreens(dmxDisplaysFromCommandLine); +#endif + processing = 0; +} + +/** This macro is used to generate the following access methods: + * - dmxConfig{Set,Get}rules + * - dmxConfig{Set,Get}model + * - dmxConfig{Set,Get}layout + * - dmxConfig{Set,Get}variant + * - dmxConfig{Set,Get}options + * These methods are used to read and write information about the keyboard. */ + +#define GEN(param,glob,def) \ + void dmxConfigSet##glob(const char *param) { \ + if (dmx##glob) free((void *)dmx##glob); \ + dmx##glob = strdup(param); \ + } \ + char *dmxConfigGet##glob(void) { \ + return (char *)(dmx##glob ? dmx##glob : def); \ + } + +GEN(rules, XkbRules, DMX_DEFAULT_XKB_RULES) +GEN(model, XkbModel, DMX_DEFAULT_XKB_MODEL) +GEN(layout, XkbLayout, DMX_DEFAULT_XKB_LAYOUT) +GEN(variant, XkbVariant, DMX_DEFAULT_XKB_VARIANT) +GEN(options, XkbOptions, DMX_DEFAULT_XKB_OPTIONS) + diff --git a/xorg-server/hw/dmx/config/dmxconfig.h b/xorg-server/hw/dmx/config/dmxconfig.h new file mode 100644 index 000000000..7c9dbc799 --- /dev/null +++ b/xorg-server/hw/dmx/config/dmxconfig.h @@ -0,0 +1,64 @@ +/* + * Copyright 2002 Red Hat Inc., Durham, North Carolina. + * + * 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 on 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 + * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR 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. + */ + +/* + * Authors: + * Rickard E. (Rik) Faith <faith@redhat.com> + * + */ + +/** \file + * Interface for DMX configuration file support. \see dmxconfig.c */ + +#ifndef _DMXCONFIG_H_ +#define _DMXCONFIG_H_ +#define DMX_DEFAULT_XKB_RULES "xfree86" +#define DMX_DEFAULT_XKB_MODEL "pc101" +#define DMX_DEFAULT_XKB_LAYOUT "us" +#define DMX_DEFAULT_XKB_VARIANT NULL +#define DMX_DEFAULT_XKB_OPTIONS NULL + +extern void dmxConfigStoreDisplay(const char *display); +extern void dmxConfigStoreInput(const char *input); /* Core devices */ +extern void dmxConfigStoreXInput(const char *input); /* Non-core devices */ +extern void dmxConfigStoreFile(const char *file); +extern void dmxConfigStoreConfig(const char *config); +extern void dmxConfigConfigure(void); +extern void dmxConfigSetMaxScreens(void); + +extern void dmxConfigSetXkbRules(const char *rules); +extern void dmxConfigSetXkbModel(const char *model); +extern void dmxConfigSetXkbLayout(const char *layout); +extern void dmxConfigSetXkbVariant(const char *variant); +extern void dmxConfigSetXkbOptions(const char *options); + +extern char *dmxConfigGetXkbRules(void); +extern char *dmxConfigGetXkbModel(void); +extern char *dmxConfigGetXkbLayout(void); +extern char *dmxConfigGetXkbVariant(void); +extern char *dmxConfigGetXkbOptions(void); +#endif diff --git a/xorg-server/hw/dmx/config/dmxparse.c b/xorg-server/hw/dmx/config/dmxparse.c new file mode 100644 index 000000000..0bf947051 --- /dev/null +++ b/xorg-server/hw/dmx/config/dmxparse.c @@ -0,0 +1,610 @@ +/* + * Copyright 2002 Red Hat Inc., Durham, North Carolina. + * + * 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 on 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 + * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR 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. + */ + +/* + * Authors: + * Rickard E. (Rik) Faith <faith@redhat.com> + * + */ + +/** \file + * + * This file provides support routines and helper functions to be used + * by the DMX configuration file parser. + * + * Because the DMX configuration file parsing should be capable of being + * used in a stand-alone fashion (i.e., independent from the DMX server + * source tree), no dependencies on other DMX routines are made. */ + +#ifdef HAVE_DMX_CONFIG_H +#include <dmx-config.h> +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <stdarg.h> +#include "dmxparse.h" + +/** A general error logging routine that does not depend on the dmxLog + * functions. */ +void dmxConfigLog(const char *format, ...) +{ + va_list args; + + va_start(args, format); + vprintf(format, args); /* RATS: All calls to dmxConfigLog from + * dmxparse.c and dmxprint.c use a + * trusted format. */ + va_end(args); +} + +void *dmxConfigAlloc(unsigned long bytes) +{ + void *area = malloc(bytes); + if (!area) { + dmxConfigLog("dmxConfigAlloc: out of memory\n"); + return NULL; + } + memset(area, 0, bytes); + return area; +} + +void *dmxConfigRealloc(void *orig, unsigned long orig_bytes, + unsigned long bytes) +{ + unsigned char *area = realloc(orig, bytes); + if (!area) { + dmxConfigLog("dmxConfigRealloc: out of memory\n"); + return NULL; + } + memset(area + orig_bytes, 0, bytes - orig_bytes); + return area; +} + +const char *dmxConfigCopyString(const char *string, int length) +{ + char *copy; + + if (!length) length = strlen(string); + copy = dmxConfigAlloc(length + 1); + if (length) strncpy(copy, string, length); + copy[length] = '\0'; + return copy; +} + +void dmxConfigFree(void *area) +{ + if (area) free(area); +} + +DMXConfigTokenPtr dmxConfigCreateToken(int token, int line, + const char *comment) +{ + DMXConfigTokenPtr pToken = dmxConfigAlloc(sizeof(*pToken)); + pToken->token = token; + pToken->line = line; + pToken->comment = comment; + return pToken; +} + +void dmxConfigFreeToken(DMXConfigTokenPtr p) +{ + if (!p) return; + dmxConfigFree((void *)p->comment); + dmxConfigFree(p); +} + +DMXConfigStringPtr dmxConfigCreateString(int token, int line, + const char *comment, + const char *string) +{ + DMXConfigStringPtr pString = dmxConfigAlloc(sizeof(*pString)); + + pString->token = token; + pString->line = line; + pString->comment = comment; + pString->string = string; + return pString; +} + +void dmxConfigFreeString(DMXConfigStringPtr p) +{ + DMXConfigStringPtr next; + + if (!p) return; + do { + next = p->next; + dmxConfigFree((void *)p->comment); + dmxConfigFree((void *)p->string); + dmxConfigFree(p); + } while ((p = next)); +} + +DMXConfigNumberPtr dmxConfigCreateNumber(int token, int line, + const char *comment, + int number) +{ + DMXConfigNumberPtr pNumber = dmxConfigAlloc(sizeof(*pNumber)); + + pNumber->token = token; + pNumber->line = line; + pNumber->comment = comment; + pNumber->number = number; + return pNumber; +} + +void dmxConfigFreeNumber(DMXConfigNumberPtr p) +{ + if (!p) return; + dmxConfigFree((void *)p->comment); + dmxConfigFree(p); +} + +DMXConfigPairPtr dmxConfigCreatePair(int token, int line, + const char *comment, + int x, int y, + int xsign, int ysign) +{ + DMXConfigPairPtr pPair = dmxConfigAlloc(sizeof(*pPair)); + + pPair->token = token; + pPair->line = line; + pPair->comment = comment; + pPair->x = x; + pPair->y = y; + pPair->xsign = (xsign < 0) ? -1 : 1; + pPair->ysign = (ysign < 0) ? -1 : 1; + return pPair; +} + +void dmxConfigFreePair(DMXConfigPairPtr p) +{ + if (!p) return; + dmxConfigFree((void *)p->comment); + dmxConfigFree(p); +} + +DMXConfigCommentPtr dmxConfigCreateComment(int token, int line, + const char *comment) +{ + DMXConfigCommentPtr pComment = dmxConfigAlloc(sizeof(*pComment)); + + pComment->token = token; + pComment->line = line; + pComment->comment = comment; + return pComment; +} + +void dmxConfigFreeComment(DMXConfigCommentPtr p) +{ + if (!p) return; + dmxConfigFree((void *)p->comment); + dmxConfigFree(p); +} + +DMXConfigPartDimPtr dmxConfigCreatePartDim(DMXConfigPairPtr pDim, + DMXConfigPairPtr pOffset) +{ + DMXConfigPartDimPtr pPart = dmxConfigAlloc(sizeof(*pPart)); + pPart->dim = pDim; + pPart->offset = pOffset; + return pPart; +} + +void dmxConfigFreePartDim(DMXConfigPartDimPtr p) +{ + if (!p) return; + dmxConfigFreePair(p->dim); + dmxConfigFreePair(p->offset); + dmxConfigFree(p); +} + +DMXConfigFullDimPtr dmxConfigCreateFullDim(DMXConfigPartDimPtr pScrn, + DMXConfigPartDimPtr pRoot) +{ + DMXConfigFullDimPtr pFull = dmxConfigAlloc(sizeof(*pFull)); + pFull->scrn = pScrn; + pFull->root = pRoot; + return pFull; +} + +void dmxConfigFreeFullDim(DMXConfigFullDimPtr p) +{ + if (!p) return; + dmxConfigFreePartDim(p->scrn); + dmxConfigFreePartDim(p->root); + dmxConfigFree(p); +} + +DMXConfigDisplayPtr dmxConfigCreateDisplay(DMXConfigTokenPtr pStart, + DMXConfigStringPtr pName, + DMXConfigFullDimPtr pDim, + DMXConfigPairPtr pOrigin, + DMXConfigTokenPtr pEnd) +{ + DMXConfigDisplayPtr pDisplay = dmxConfigAlloc(sizeof(*pDisplay)); + + memset(pDisplay, 0, sizeof(*pDisplay)); + + pDisplay->start = pStart; + pDisplay->dname = pName; + pDisplay->dim = pDim; + pDisplay->origin = pOrigin; + pDisplay->end = pEnd; + + pDisplay->name = pName ? pName->string : NULL; + pDisplay->rootXOrigin = pOrigin ? pOrigin->x : 0; + pDisplay->rootYOrigin = pOrigin ? pOrigin->y : 0; + + if (pDim && pDim->scrn && pDim->scrn->dim) { + pDisplay->scrnWidth = pDim->scrn->dim->x; + pDisplay->scrnHeight = pDim->scrn->dim->y; + } + if (pDim && pDim->scrn && pDim->scrn->offset) { + pDisplay->scrnX = pDim->scrn->offset->x; + pDisplay->scrnY = pDim->scrn->offset->y; + pDisplay->scrnXSign = pDim->scrn->offset->xsign; + pDisplay->scrnYSign = pDim->scrn->offset->ysign; + } + + if (pDim && pDim->root) { + if (pDim->root->dim) { + pDisplay->rootWidth = pDim->root->dim->x; + pDisplay->rootHeight = pDim->root->dim->y; + } + if (pDim->root->offset) { + pDisplay->rootX = pDim->root->offset->x; + pDisplay->rootY = pDim->root->offset->y; + pDisplay->rootXSign = pDim->root->offset->xsign; + pDisplay->rootYSign = pDim->root->offset->ysign; + } + } else { /* If no root specification, copy width + * and height from scrn -- leave offset + * as zero, since it is relative to + * scrn. */ + pDisplay->rootWidth = pDisplay->scrnWidth; + pDisplay->rootHeight = pDisplay->scrnHeight; + } + + + return pDisplay; +} + +void dmxConfigFreeDisplay(DMXConfigDisplayPtr p) +{ + if (!p) return; + dmxConfigFreeToken(p->start); + dmxConfigFreeString(p->dname); + dmxConfigFreeFullDim(p->dim); + dmxConfigFreeToken(p->end); + dmxConfigFree(p); +} + +DMXConfigWallPtr dmxConfigCreateWall(DMXConfigTokenPtr pStart, + DMXConfigPairPtr pWallDim, + DMXConfigPairPtr pDisplayDim, + DMXConfigStringPtr pNameList, + DMXConfigTokenPtr pEnd) +{ + DMXConfigWallPtr pWall = dmxConfigAlloc(sizeof(*pWall)); + + pWall->start = pStart; + pWall->wallDim = pWallDim; + pWall->displayDim = pDisplayDim; + pWall->nameList = pNameList; + pWall->end = pEnd; + + pWall->width = pDisplayDim ? pDisplayDim->x : 0; + pWall->height = pDisplayDim ? pDisplayDim->y : 0; + pWall->xwall = pWallDim ? pWallDim->x : 0; + pWall->ywall = pWallDim ? pWallDim->y : 0; + + return pWall; +} + +void dmxConfigFreeWall(DMXConfigWallPtr p) +{ + if (!p) return; + dmxConfigFreeToken(p->start); + dmxConfigFreePair(p->wallDim); + dmxConfigFreePair(p->displayDim); + dmxConfigFreeString(p->nameList); + dmxConfigFreeToken(p->end); + dmxConfigFree(p); +} + +DMXConfigOptionPtr dmxConfigCreateOption(DMXConfigTokenPtr pStart, + DMXConfigStringPtr pOption, + DMXConfigTokenPtr pEnd) +{ + int length = 0; + int offset = 0; + DMXConfigStringPtr p; + DMXConfigOptionPtr option = dmxConfigAlloc(sizeof(*option)); + + for (p = pOption; p; p = p->next) { + if (p->string) length += strlen(p->string) + 1; + } + + option->string = dmxConfigAlloc(length + 1); + + for (p = pOption; p; p = p->next) { + if (p->string) { + int len = strlen(p->string); + strncpy(option->string + offset, p->string, len); + offset += len; + if (p->next) option->string[offset++] = ' '; + } + } + option->string[offset] = '\0'; + + option->start = pStart; + option->option = pOption; + option->end = pEnd; + + return option; +} + +void dmxConfigFreeOption(DMXConfigOptionPtr p) +{ + if (!p) return; + if (p->string) free(p->string); + dmxConfigFreeToken(p->start); + dmxConfigFreeString(p->option); + dmxConfigFreeToken(p->end); + dmxConfigFree(p); +} + +const char **dmxConfigLookupParam(DMXConfigParamPtr p, const char *key, + int *argc) +{ + DMXConfigParamPtr pt; + + for (pt = p; pt; pt = pt->next) { + if (pt->argv && !strcasecmp(pt->argv[0], key)) { + *argc = pt->argc; + return pt->argv; + } + } + *argc = 0; + return NULL; +} + +DMXConfigParamPtr dmxConfigCreateParam(DMXConfigTokenPtr pStart, + DMXConfigTokenPtr pOpen, + DMXConfigStringPtr pParam, + DMXConfigTokenPtr pClose, + DMXConfigTokenPtr pEnd) +{ + DMXConfigParamPtr param = dmxConfigAlloc(sizeof(*param)); + DMXConfigStringPtr pt; + + param->argc = 0; + param->argv = NULL; + for (pt = pParam; pt; pt = pt->next) { + if (pt->string) { + param->argv = realloc(param->argv, + (param->argc+2) * sizeof(*param->argv)); + param->argv[param->argc] = pt->string; + ++param->argc; + } + } + if (param->argv) param->argv[param->argc] = NULL; + + param->start = pStart; + param->open = pOpen; + param->param = pParam; + param->close = pClose; + param->end = pEnd; + + return param; +} + +void dmxConfigFreeParam(DMXConfigParamPtr p) +{ + DMXConfigParamPtr next; + + if (!p) return; + do { + next = p->next; + dmxConfigFreeToken(p->start); + dmxConfigFreeToken(p->open); + dmxConfigFreeString(p->param); + dmxConfigFreeToken(p->close); + dmxConfigFreeToken(p->end); + dmxConfigFree(p->argv); + dmxConfigFree(p); + } while ((p = next)); +} + +DMXConfigSubPtr dmxConfigCreateSub(DMXConfigType type, + DMXConfigCommentPtr comment, + DMXConfigDisplayPtr display, + DMXConfigWallPtr wall, + DMXConfigOptionPtr option, + DMXConfigParamPtr param) +{ + DMXConfigSubPtr pSub = dmxConfigAlloc(sizeof(*pSub)); + pSub->type = type; + switch (type) { + case dmxConfigComment: pSub->comment = comment; break; + case dmxConfigDisplay: pSub->display = display; break; + case dmxConfigWall: pSub->wall = wall; break; + case dmxConfigOption: pSub->option = option; break; + case dmxConfigParam: pSub->param = param; break; + default: dmxConfigLog("Type %d not supported in subentry\n", type); break; + } + return pSub; +} + +void dmxConfigFreeSub(DMXConfigSubPtr sub) +{ + DMXConfigSubPtr pt; + + for (pt = sub; pt; pt = pt->next) { + switch (pt->type) { + case dmxConfigComment: dmxConfigFreeComment(pt->comment); break; + case dmxConfigDisplay: dmxConfigFreeDisplay(pt->display); break; + case dmxConfigWall: dmxConfigFreeWall(pt->wall); break; + case dmxConfigOption: dmxConfigFreeOption(pt->option); break; + case dmxConfigParam: dmxConfigFreeParam(pt->param); break; + default: + dmxConfigLog("Type %d not supported in subentry\n", pt->type); + break; + } + } + dmxConfigFree(sub); +} + +DMXConfigSubPtr dmxConfigSubComment(DMXConfigCommentPtr comment) +{ + return dmxConfigCreateSub(dmxConfigComment, comment, NULL, NULL, NULL, + NULL); +} + +DMXConfigSubPtr dmxConfigSubDisplay(DMXConfigDisplayPtr display) +{ + return dmxConfigCreateSub(dmxConfigDisplay, NULL, display, NULL, NULL, + NULL); +} + +DMXConfigSubPtr dmxConfigSubWall(DMXConfigWallPtr wall) +{ + return dmxConfigCreateSub(dmxConfigWall, NULL, NULL, wall, NULL, NULL); +} + +DMXConfigSubPtr dmxConfigSubOption(DMXConfigOptionPtr option) +{ + return dmxConfigCreateSub(dmxConfigOption, NULL, NULL, NULL, option, NULL); +} + +DMXConfigSubPtr dmxConfigSubParam(DMXConfigParamPtr param) +{ + return dmxConfigCreateSub(dmxConfigParam, NULL, NULL, NULL, NULL, param); +} + +extern DMXConfigSubPtr dmxConfigAddSub(DMXConfigSubPtr head, + DMXConfigSubPtr sub) +{ + DMXConfigSubPtr pt; + + if (!head) return sub; + for (pt = head; pt->next; pt = pt->next); + pt->next = sub; + return head; +} + +DMXConfigVirtualPtr dmxConfigCreateVirtual(DMXConfigTokenPtr pStart, + DMXConfigStringPtr pName, + DMXConfigPairPtr pDim, + DMXConfigTokenPtr pOpen, + DMXConfigSubPtr pSubentry, + DMXConfigTokenPtr pClose) +{ + DMXConfigVirtualPtr pVirtual = dmxConfigAlloc(sizeof(*pVirtual)); + + pVirtual->start = pStart; + pVirtual->vname = pName; + pVirtual->dim = pDim; + pVirtual->open = pOpen; + pVirtual->subentry = pSubentry; + pVirtual->close = pClose; + + pVirtual->name = pName ? pName->string : NULL; + pVirtual->width = pDim ? pDim->x : 0; + pVirtual->height = pDim ? pDim->y : 0; + + return pVirtual; +} + +void dmxConfigFreeVirtual(DMXConfigVirtualPtr virtual) +{ + dmxConfigFreeToken(virtual->start); + dmxConfigFreeString(virtual->vname); + dmxConfigFreePair(virtual->dim); + dmxConfigFreeToken(virtual->open); + dmxConfigFreeSub(virtual->subentry); + dmxConfigFreeToken(virtual->close); + dmxConfigFree(virtual); +} + +DMXConfigEntryPtr dmxConfigCreateEntry(DMXConfigType type, + DMXConfigCommentPtr comment, + DMXConfigVirtualPtr virtual) +{ + DMXConfigEntryPtr pEntry = dmxConfigAlloc(sizeof(*pEntry)); + pEntry->type = type; + switch (type) { + case dmxConfigComment: pEntry->comment = comment; break; + case dmxConfigVirtual: pEntry->virtual = virtual; break; + default: dmxConfigLog("Type %d not supported in entry\n", type); break; + } + return pEntry; +} + +void dmxConfigFreeEntry(DMXConfigEntryPtr entry) +{ + DMXConfigEntryPtr pt; + + for (pt = entry; pt; pt = pt->next) { + switch (pt->type) { + case dmxConfigComment: dmxConfigFreeComment(pt->comment); break; + case dmxConfigVirtual: dmxConfigFreeVirtual(pt->virtual); break; + default: + dmxConfigLog("Type %d not supported in entry\n", pt->type); + break; + } + } + dmxConfigFree(entry); +} + +DMXConfigEntryPtr dmxConfigAddEntry(DMXConfigEntryPtr head, + DMXConfigType type, + DMXConfigCommentPtr comment, + DMXConfigVirtualPtr virtual) +{ + DMXConfigEntryPtr child = dmxConfigCreateEntry(type, comment, virtual); + DMXConfigEntryPtr pt; + + if (!head) return child; + + for (pt = head; pt->next; pt = pt->next); + pt->next = child; + + return head; +} + +DMXConfigEntryPtr dmxConfigEntryComment(DMXConfigCommentPtr comment) +{ + return dmxConfigCreateEntry(dmxConfigComment, comment, NULL); +} + +DMXConfigEntryPtr dmxConfigEntryVirtual(DMXConfigVirtualPtr virtual) +{ + return dmxConfigCreateEntry(dmxConfigVirtual, NULL, virtual); +} diff --git a/xorg-server/hw/dmx/config/dmxparse.h b/xorg-server/hw/dmx/config/dmxparse.h new file mode 100644 index 000000000..de81d23b7 --- /dev/null +++ b/xorg-server/hw/dmx/config/dmxparse.h @@ -0,0 +1,297 @@ +/* + * Copyright 2002 Red Hat Inc., Durham, North Carolina. + * + * 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 on 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 + * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR 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. + */ + +/* + * Authors: + * Rickard E. (Rik) Faith <faith@redhat.com> + * + */ + +/** \file + * Interface to DMX configuration file parser. \see dmxparse.c */ + +#ifndef _DMXPARSE_H_ +#define _DMXPARSE_H_ + +#include <stdio.h> /* For FILE */ + +/** Stores tokens not stored in other structures (e.g., keywords and ;) */ +typedef struct _DMXConfigToken { + int token; + int line; + const char *comment; +} DMXConfigToken, *DMXConfigTokenPtr; + +/** Stores parsed strings. */ +typedef struct _DMXConfigString { + int token; + int line; + const char *comment; + const char *string; + struct _DMXConfigString *next; +} DMXConfigString, *DMXConfigStringPtr; + +/** Stores parsed numbers. */ +typedef struct _DMXConfigNumber { + int token; + int line; + const char *comment; + int number; +} DMXConfigNumber, *DMXConfigNumberPtr; + +/** Stores parsed pairs (e.g., x y) */ +typedef struct _DMXConfigPair { + int token; + int line; + const char *comment; + int x; + int y; + int xsign; + int ysign; +} DMXConfigPair, *DMXConfigPairPtr; + +/** Stores parsed comments not stored with a token. */ +typedef struct _DMXConfigComment { + int token; + int line; + const char *comment; +} DMXConfigComment, *DMXConfigCommentPtr; + +typedef enum { + dmxConfigComment, + dmxConfigVirtual, + dmxConfigDisplay, + dmxConfigWall, + dmxConfigOption, + dmxConfigParam +} DMXConfigType; + +/** Stores a geometry specification. */ +typedef struct _DMXConfigPartDim { + DMXConfigPairPtr dim; + DMXConfigPairPtr offset; +} DMXConfigPartDim, *DMXConfigPartDimPtr; + +/** Stores a pair of geometry specifications. */ +typedef struct _DMXConfigFullDim { + DMXConfigPartDimPtr scrn; + DMXConfigPartDimPtr root; +} DMXConfigFullDim, *DMXConfigFullDimPtr; + +/** Stores parsed display information. */ +typedef struct _DMXConfigDisplay { + /* Summary information */ + const char *name; + /* Screen Window Geometry */ + int scrnWidth, scrnHeight; + int scrnX, scrnY; + int scrnXSign, scrnYSign; + /* Root Window Geometry */ + int rootWidth, rootHeight; + int rootX, rootY; + int rootXSign, rootYSign; + /* Origin in global space */ + int rootXOrigin, rootYOrigin; + + /* Raw configuration information */ + DMXConfigTokenPtr start; + DMXConfigStringPtr dname; + DMXConfigFullDimPtr dim; + DMXConfigPairPtr origin; + DMXConfigTokenPtr end; +} DMXConfigDisplay, *DMXConfigDisplayPtr; + +/** Stores parsed wall information. */ +typedef struct _DMXConfigWall { + /* Summary information */ + int width, height; /* dimensions of displays */ + int xwall, ywall; /* dimensions of wall, in tiles */ + + + /* Raw configuration informaiton */ + DMXConfigTokenPtr start; + DMXConfigPairPtr wallDim; + DMXConfigPairPtr displayDim; + DMXConfigStringPtr nameList; + DMXConfigTokenPtr end; +} DMXConfigWall, *DMXConfigWallPtr; + +/** Stores parsed option information. */ +typedef struct _DMXConfigOption { + /* Summary information */ + char *string; + + /* Raw configuration informaiton */ + DMXConfigTokenPtr start; + DMXConfigStringPtr option; + DMXConfigTokenPtr end; +} DMXConfigOption, *DMXConfigOptionPtr; + +/** Stores parsed param information. */ +typedef struct _DMXConfigParam { + int argc; + const char **argv; + + DMXConfigTokenPtr start; + DMXConfigTokenPtr open; + DMXConfigStringPtr param; + DMXConfigTokenPtr close; + DMXConfigTokenPtr end; /* Either open/close OR end */ + struct _DMXConfigParam *next; +} DMXConfigParam, *DMXConfigParamPtr; + +/** Stores options under an entry (subentry). */ +typedef struct _DMXConfigSub { + DMXConfigType type; + DMXConfigCommentPtr comment; + DMXConfigDisplayPtr display; + DMXConfigWallPtr wall; + DMXConfigOptionPtr option; + DMXConfigParamPtr param; + struct _DMXConfigSub *next; +} DMXConfigSub, *DMXConfigSubPtr; + +/** Stores parsed virtual information. */ +typedef struct _DMXConfigVirtual { + /* Summary information */ + const char *name; + int width, height; + + /* Raw configuration information */ + DMXConfigTokenPtr start; + DMXConfigStringPtr vname; + DMXConfigPairPtr dim; + DMXConfigTokenPtr open; + DMXConfigSubPtr subentry; + DMXConfigTokenPtr close; +} DMXConfigVirtual, *DMXConfigVirtualPtr; + +/** Heads entry storage. */ +typedef struct _DMXConfigEntry { + DMXConfigType type; + DMXConfigCommentPtr comment; + DMXConfigVirtualPtr virtual; + struct _DMXConfigEntry *next; +} DMXConfigEntry, *DMXConfigEntryPtr; + +extern DMXConfigEntryPtr dmxConfigEntry; + +extern int yylex(void); +extern int yydebug; +extern void yyerror(const char *message); + +extern void dmxConfigLog(const char *format, ...); +extern void *dmxConfigAlloc(unsigned long bytes); +extern void *dmxConfigRealloc(void *orig, + unsigned long orig_bytes, + unsigned long bytes); +extern const char *dmxConfigCopyString(const char *string, + int length); +extern void dmxConfigFree(void *area); +extern DMXConfigTokenPtr dmxConfigCreateToken(int token, int line, + const char *comment); +extern void dmxConfigFreeToken(DMXConfigTokenPtr p); +extern DMXConfigStringPtr dmxConfigCreateString(int token, int line, + const char *comment, + const char *string); +extern void dmxConfigFreeString(DMXConfigStringPtr p); +extern DMXConfigNumberPtr dmxConfigCreateNumber(int token, int line, + const char *comment, + int number); +extern void dmxConfigFreeNumber(DMXConfigNumberPtr p); +extern DMXConfigPairPtr dmxConfigCreatePair(int token, int line, + const char *comment, + int x, int y, + int xsign, int ysign); +extern void dmxConfigFreePair(DMXConfigPairPtr p); +extern DMXConfigCommentPtr dmxConfigCreateComment(int token, int line, + const char *comment); +extern void dmxConfigFreeComment(DMXConfigCommentPtr p); +extern DMXConfigPartDimPtr dmxConfigCreatePartDim(DMXConfigPairPtr pDim, + DMXConfigPairPtr pOffset); +extern void dmxConfigFreePartDim(DMXConfigPartDimPtr p); +extern DMXConfigFullDimPtr dmxConfigCreateFullDim(DMXConfigPartDimPtr pScrn, + DMXConfigPartDimPtr pRoot); +extern void dmxConfigFreeFullDim(DMXConfigFullDimPtr p); +extern DMXConfigDisplayPtr dmxConfigCreateDisplay(DMXConfigTokenPtr pStart, + DMXConfigStringPtr pName, + DMXConfigFullDimPtr pDim, + DMXConfigPairPtr pOrigin, + DMXConfigTokenPtr pEnd); +extern void dmxConfigFreeDisplay(DMXConfigDisplayPtr p); +extern DMXConfigWallPtr dmxConfigCreateWall(DMXConfigTokenPtr pStart, + DMXConfigPairPtr pWallDim, + DMXConfigPairPtr pDisplayDim, + DMXConfigStringPtr pNameList, + DMXConfigTokenPtr pEnd); +extern void dmxConfigFreeWall(DMXConfigWallPtr p); +extern DMXConfigOptionPtr dmxConfigCreateOption(DMXConfigTokenPtr pStart, + DMXConfigStringPtr pOption, + DMXConfigTokenPtr pEnd); +extern void dmxConfigFreeOption(DMXConfigOptionPtr p); +extern DMXConfigParamPtr dmxConfigCreateParam(DMXConfigTokenPtr pStart, + DMXConfigTokenPtr pOpen, + DMXConfigStringPtr pParam, + DMXConfigTokenPtr pClose, + DMXConfigTokenPtr pEnd); +extern void dmxConfigFreeParam(DMXConfigParamPtr p); +extern const char **dmxConfigLookupParam(DMXConfigParamPtr p, + const char *key, + int *argc); +extern DMXConfigSubPtr dmxConfigCreateSub(DMXConfigType type, + DMXConfigCommentPtr comment, + DMXConfigDisplayPtr display, + DMXConfigWallPtr wall, + DMXConfigOptionPtr option, + DMXConfigParamPtr param); +extern void dmxConfigFreeSub(DMXConfigSubPtr sub); +extern DMXConfigSubPtr dmxConfigSubComment(DMXConfigCommentPtr comment); +extern DMXConfigSubPtr dmxConfigSubDisplay(DMXConfigDisplayPtr display); +extern DMXConfigSubPtr dmxConfigSubWall(DMXConfigWallPtr wall); +extern DMXConfigSubPtr dmxConfigSubOption(DMXConfigOptionPtr option); +extern DMXConfigSubPtr dmxConfigSubParam(DMXConfigParamPtr param); +extern DMXConfigSubPtr dmxConfigAddSub(DMXConfigSubPtr head, + DMXConfigSubPtr sub); +extern DMXConfigVirtualPtr dmxConfigCreateVirtual(DMXConfigTokenPtr pStart, + DMXConfigStringPtr pName, + DMXConfigPairPtr pDim, + DMXConfigTokenPtr pOpen, + DMXConfigSubPtr pSubentry, + DMXConfigTokenPtr pClose); +extern void dmxConfigFreeVirtual(DMXConfigVirtualPtr virtual); +extern DMXConfigEntryPtr dmxConfigCreateEntry(DMXConfigType type, + DMXConfigCommentPtr comment, + DMXConfigVirtualPtr virtual); +extern void dmxConfigFreeEntry(DMXConfigEntryPtr entry); +extern DMXConfigEntryPtr dmxConfigAddEntry(DMXConfigEntryPtr head, + DMXConfigType type, + DMXConfigCommentPtr comment, + DMXConfigVirtualPtr virtual); +extern DMXConfigEntryPtr dmxConfigEntryComment(DMXConfigCommentPtr comment); +extern DMXConfigEntryPtr dmxConfigEntryVirtual(DMXConfigVirtualPtr virtual); + +#endif diff --git a/xorg-server/hw/dmx/config/dmxprint.c b/xorg-server/hw/dmx/config/dmxprint.c new file mode 100644 index 000000000..599ebf5df --- /dev/null +++ b/xorg-server/hw/dmx/config/dmxprint.c @@ -0,0 +1,455 @@ +/* + * Copyright 2002 Red Hat Inc., Durham, North Carolina. + * + * 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 on 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 + * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR 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. + */ + +/* + * Authors: + * Rickard E. (Rik) Faith <faith@redhat.com> + * + */ + +/** \file + * + * This file provides support routines and helper functions to be used + * to pretty-print DMX configurations. + * + * Because the DMX configuration file parsing should be capable of being + * used in a stand-alone fashion (i.e., independent from the DMX server + * source tree), no dependencies on other DMX routines are made. */ + +#ifdef HAVE_DMX_CONFIG_H +#include <dmx-config.h> +#endif + +#include "dmxconfig.h" +#include "dmxparse.h" +#include "dmxprint.h" +#include "parser.h" +#include <stdio.h> +#include <stdarg.h> +#include <ctype.h> + +static FILE *str = NULL; +static int indent = 0; +static int pos = 0; + +/** Stack of indentation information used for pretty-printing + * configuration information. */ +static struct stack { + int base; + int comment; + int step; + struct stack *next; +} *stack, initialStack = { 0, 0, 4, NULL }; + +static void dmxConfigIndent(void) +{ + int i; + if (indent < 0) indent = 0; + if (indent > 40) indent = 40; + for (i = 0; i < indent; i++) fprintf(str, " "); +} + +static void dmxConfigNewline(void) +{ + if (pos) fprintf(str, "\n"); + pos = 0; +} + +static void dmxConfigPushState(int base, int comment, int step) +{ + struct stack *new = dmxConfigAlloc(sizeof(*new)); + new->base = base; + new->comment = comment; + new->step = step; + new->next = stack; + stack = new; + indent = base; + dmxConfigNewline(); +} + +static void dmxConfigPushComment(void) +{ + if (stack) indent = stack->comment; +} + +static void dmxConfigPushStep(void) +{ + if (stack) indent = stack->step; +} + +static void dmxConfigPopState(void) +{ + struct stack *old = stack; + + if (!stack) return; + indent = old->base; + stack = old->next; + if (!stack) dmxConfigLog("Stack underflow\n"); + dmxConfigFree(old); + dmxConfigNewline(); +} + +static void dmxConfigOutput(int addSpace, int doNewline, const char *comment, + const char *format, ...) +{ + va_list args; + + if (!pos) dmxConfigIndent(); + else if (addSpace) fprintf(str, " "); + + if (format) { + va_start(args, format); + /* RATS: This hasn't been audited -- it + * could probably result in a buffer + * overflow. */ + pos += vfprintf(str, format, args); /* assumes no newlines! */ + va_end(args); + } + + if (comment) { + if (pos) fprintf(str, " "); + pos += fprintf(str, "#%s", comment); + dmxConfigNewline(); + dmxConfigPushComment(); + } else if (doNewline) dmxConfigNewline(); +} + +static void dmxConfigPrintComment(DMXConfigCommentPtr p) +{ + dmxConfigOutput(1, 1, p->comment, NULL); +} + +static void dmxConfigPrintTokenFlag(DMXConfigTokenPtr p, int flag) +{ + if (!p) return; + switch (p->token) { + case T_VIRTUAL: + dmxConfigPushState(0, 4, 4); + dmxConfigOutput(0, 0, p->comment, "virtual"); + break; + case T_DISPLAY: + dmxConfigPushState(4, 12, 16); + dmxConfigOutput(0, 0, p->comment, "display"); + break; + case T_WALL: + dmxConfigPushState(4, 12, 16); + dmxConfigOutput(0, 0, p->comment, "wall"); + break; + case T_OPTION: + dmxConfigPushState(4, 12, 16); + dmxConfigOutput(0, 0, p->comment, "option"); + break; + case T_PARAM: + dmxConfigPushState(4, 8, 12); + dmxConfigOutput(0, 0, p->comment, "param"); + break; + case ';': + dmxConfigOutput(0, 1, p->comment, ";"); + if (flag) dmxConfigPopState(); + break; + case '{': + dmxConfigOutput(1, 1, p->comment, "{"); + dmxConfigPushStep(); + break; + case '}': + if (flag) dmxConfigPopState(); + dmxConfigOutput(0, 1, p->comment, "}"); + break; + case '/': + dmxConfigOutput(1, 0, NULL, "/"); + break; + default: + dmxConfigLog("unknown token %d on line %d\n", p->token, p->line); + } +} + +static void dmxConfigPrintToken(DMXConfigTokenPtr p) +{ + dmxConfigPrintTokenFlag(p, 1); +} + +static void dmxConfigPrintTokenNopop(DMXConfigTokenPtr p) +{ + dmxConfigPrintTokenFlag(p, 0); +} + +static int dmxConfigPrintQuotedString(const char *s) +{ + const char *pt; + + if (!s || !s[0]) return 1; /* Quote empty string */ + for (pt = s; *pt; ++pt) if (isspace(*pt)) return 1; + return 0; +} + +static void dmxConfigPrintString(DMXConfigStringPtr p, int quote) +{ + DMXConfigStringPtr pt; + + if (!p) return; + for (pt = p; pt; pt = pt->next) { + if (quote && dmxConfigPrintQuotedString(pt->string)) { + dmxConfigOutput(1, 0, pt->comment, "\"%s\"", + pt->string ? pt->string : ""); + } else + dmxConfigOutput(1, 0, pt->comment, "%s", + pt->string ? pt->string : ""); + } +} + +static int dmxConfigPrintPair(DMXConfigPairPtr p, int addSpace) +{ + const char *format = NULL; + + if (!p) return 0; + switch (p->token) { + case T_ORIGIN: format = "@%dx%d"; break; + case T_DIMENSION: format = "%dx%d"; break; + case T_OFFSET: format = "%c%d%c%d"; break; + } + if (p->token == T_OFFSET) { + if (!p->comment && !p->x && !p->y && p->xsign >= 0 && p->ysign >= 0) + return 0; + dmxConfigOutput(addSpace, 0, p->comment, format, + p->xsign < 0 ? '-' : '+', p->x, + p->ysign < 0 ? '-' : '+', p->y); + } else { + if (!p->comment && !p->x && !p->y) return 0; + dmxConfigOutput(addSpace, 0, p->comment, format, p->x, p->y); + } + return 1; +} + +static void dmxConfigPrintDisplay(DMXConfigDisplayPtr p) +{ + DMXConfigToken dummyStart = { T_DISPLAY, 0, NULL }; + DMXConfigToken dummyEnd = { ';', 0, NULL }; + DMXConfigToken dummySep = { '/', 0, NULL }; + DMXConfigString dummyName = { T_STRING, 0, NULL, NULL, NULL }; + DMXConfigPair dummySDim = { T_DIMENSION, 0, NULL, 0, 0, 0, 0 }; + DMXConfigPair dummySOffset = { T_OFFSET, 0, NULL, 0, 0, 0, 0 }; + DMXConfigPair dummyRDim = { T_DIMENSION, 0, NULL, 0, 0, 0, 0 }; + DMXConfigPair dummyROffset = { T_OFFSET, 0, NULL, 0, 0, 0, 0 }; + DMXConfigPair dummyOrigin = { T_ORIGIN, 0, NULL, 0, 0, 0, 0 }; + int output; + + if (p->dname) p->dname->string = p->name; + else dummyName.string = p->name; + + if (p->dim && p->dim->scrn && p->dim->scrn->dim) { + p->dim->scrn->dim->x = p->scrnWidth; + p->dim->scrn->dim->y = p->scrnHeight; + } else { + dummySDim.x = p->scrnWidth; + dummySDim.y = p->scrnHeight; + } + + if (p->dim && p->dim->scrn && p->dim->scrn->offset) { + p->dim->scrn->offset->x = p->scrnX; + p->dim->scrn->offset->y = p->scrnY; + } else { + dummySOffset.x = p->scrnX; + dummySOffset.y = p->scrnY; + } + + if (p->dim && p->dim->root && p->dim->root->dim) { + p->dim->root->dim->x = p->rootWidth; + p->dim->root->dim->y = p->rootHeight; + } else { + dummyRDim.x = p->rootWidth; + dummyRDim.y = p->rootHeight; + } + + if (p->dim && p->dim->root && p->dim->root->offset) { + p->dim->root->offset->x = p->rootX; + p->dim->root->offset->y = p->rootY; + } else { + dummyROffset.x = p->rootX; + dummyROffset.y = p->rootY; + } + + if (p->origin) { + p->origin->x = p->rootXOrigin, p->origin->y = p->rootYOrigin; + p->origin->xsign = p->rootXSign, p->origin->ysign = p->rootYSign; + } else { + dummyOrigin.x = p->rootXOrigin, dummyOrigin.y = p->rootYOrigin; + dummyOrigin.xsign = p->rootXSign, dummyOrigin.ysign = p->rootYSign; + } + + dmxConfigPrintToken(p->start ? p->start : &dummyStart); + dmxConfigPrintString(p->dname ? p->dname : &dummyName, 1); + + if (p->dim && p->dim->scrn && p->dim->scrn->dim) + output = dmxConfigPrintPair(p->dim->scrn->dim, 1); + else + output = dmxConfigPrintPair(&dummySDim, 1); + if (p->dim && p->dim->scrn && p->dim->scrn->offset) + dmxConfigPrintPair(p->dim->scrn->offset, !output); + else + dmxConfigPrintPair(&dummySOffset, !output); + + if (p->scrnWidth != p->rootWidth + || p->scrnHeight != p->rootHeight + || p->rootX + || p->rootY) { + dmxConfigPrintToken(&dummySep); + if (p->dim && p->dim->root && p->dim->root->dim) + output = dmxConfigPrintPair(p->dim->root->dim, 1); + else + output = dmxConfigPrintPair(&dummyRDim, 1); + if (p->dim && p->dim->root && p->dim->root->offset) + dmxConfigPrintPair(p->dim->root->offset, !output); + else + dmxConfigPrintPair(&dummyROffset, !output); + } + + dmxConfigPrintPair(p->origin ? p->origin : &dummyOrigin, 1); + dmxConfigPrintToken(p->end ? p->end : &dummyEnd); +} + +static void dmxConfigPrintWall(DMXConfigWallPtr p) +{ + dmxConfigPrintToken(p->start); + dmxConfigPrintPair(p->wallDim, 1); + dmxConfigPrintPair(p->displayDim, 1); + dmxConfigPrintString(p->nameList, 1); + dmxConfigPrintToken(p->end); +} + +static void dmxConfigPrintOption(DMXConfigOptionPtr p) +{ + DMXConfigToken dummyStart = { T_OPTION, 0, NULL }; + DMXConfigString dummyOption = { T_STRING, 0, NULL, NULL, NULL }; + DMXConfigToken dummyEnd = { ';', 0, NULL }; + + dummyOption.string = p->string; + + dmxConfigPrintToken(p->start ? p->start : &dummyStart); + dmxConfigPrintString(&dummyOption, 0); + dmxConfigPrintToken(p->end ? p->end : &dummyEnd); +} + +static void dmxConfigPrintParam(DMXConfigParamPtr p) +{ + if (!p) return; + if (p->start) { + if (p->open && p->close) { + dmxConfigPrintToken(p->start); + dmxConfigPrintToken(p->open); + dmxConfigPrintParam(p->next); + dmxConfigPrintToken(p->close); + } else if (p->end && p->param) { + dmxConfigPrintToken(p->start); + dmxConfigPrintString(p->param, 1); + dmxConfigPrintToken(p->end); + } else + dmxConfigLog("dmxConfigPrintParam: cannot handle format (a)\n"); + } else if (p->end && p->param) { + dmxConfigPrintString(p->param, 1); + dmxConfigPrintTokenNopop(p->end); + dmxConfigPrintParam(p->next); + } else + dmxConfigLog("dmxConfigPrintParam: cannot handle format (b)\n"); +} + +static void dmxConfigPrintSub(DMXConfigSubPtr p) +{ + DMXConfigSubPtr pt; + + if (!p) return; + for (pt = p; pt; pt = pt->next) { + switch (pt->type) { + case dmxConfigComment: dmxConfigPrintComment(pt->comment); break; + case dmxConfigDisplay: dmxConfigPrintDisplay(pt->display); break; + case dmxConfigWall: dmxConfigPrintWall(pt->wall); break; + case dmxConfigOption: dmxConfigPrintOption(pt->option); break; + case dmxConfigParam: dmxConfigPrintParam(pt->param); break; + default: + dmxConfigLog("dmxConfigPrintSub:" + " cannot handle type %d in subentry\n", pt->type); + } + } +} + +static void dmxConfigPrintVirtual(DMXConfigVirtualPtr p) +{ + DMXConfigToken dummyStart = { T_VIRTUAL, 0, NULL }; + DMXConfigToken dummyOpen = { '{', 0, NULL }; + DMXConfigToken dummyClose = { '}', 0, NULL }; + DMXConfigString dummyName = { T_STRING, 0, NULL, NULL, NULL }; + DMXConfigPair dummyDim = { T_DIMENSION, 0, NULL, 0, 0 }; + + if (p->vname) p->vname->string = p->name; + else dummyName.string = p->name; + + if (p->dim) p->dim->x = p->width, p->dim->y = p->height; + else dummyDim.x = p->width, dummyDim.y = p->height; + + + dmxConfigPrintToken(p->start ? p->start : &dummyStart); + dmxConfigPrintString(p->vname ? p->vname : &dummyName, 1); + dmxConfigPrintPair(p->dim ? p->dim : &dummyDim, 1); + dmxConfigPrintToken(p->open ? p->open : &dummyOpen); + dmxConfigPrintSub(p->subentry); + dmxConfigPrintToken(p->close ? p->close : &dummyClose); +} + +/** The configuration information in \a entry will be pretty-printed to + * the \a stream. If \a stream is NULL, then stdout will be used. */ +void dmxConfigPrint(FILE *stream, DMXConfigEntryPtr entry) +{ + DMXConfigEntryPtr pt; + + if (!stream) str = stdout; + else str = stream; + + stack = &initialStack; + + for (pt = entry; pt; pt = pt->next) { + switch (pt->type) { + case dmxConfigComment: dmxConfigPrintComment(pt->comment); break; + case dmxConfigVirtual: dmxConfigPrintVirtual(pt->virtual); break; + default: + dmxConfigLog("dmxConfigPrint: cannot handle type %d in entry\n", + pt->type); + } + } + if (pos) dmxConfigNewline(); +} + +/** The configuration information in \a p will be pretty-printed to the + * \a stream. If \a stream is NULL, then stdout will be used. */ +void dmxConfigVirtualPrint(FILE *stream, DMXConfigVirtualPtr p) +{ + if (!stream) str = stdout; + else str = stream; + + stack = &initialStack; + + dmxConfigPrintVirtual(p); + if (pos) dmxConfigNewline(); +} diff --git a/xorg-server/hw/dmx/config/dmxprint.h b/xorg-server/hw/dmx/config/dmxprint.h new file mode 100644 index 000000000..d162dea95 --- /dev/null +++ b/xorg-server/hw/dmx/config/dmxprint.h @@ -0,0 +1,43 @@ +/* + * Copyright 2002 Red Hat Inc., Durham, North Carolina. + * + * 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 on 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 + * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR 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. + */ + +/* + * Authors: + * Rickard E. (Rik) Faith <faith@redhat.com> + * + */ + +/** \file + * Interface to DMX configuration file pretty-printer. \see dmxprint.c */ + +#ifndef _DMXPRINT_H_ +#define _DMXPRINT_H_ + +void dmxConfigPrint(FILE *str, DMXConfigEntryPtr entry); +void dmxConfigVirtualPrint(FILE *str, DMXConfigVirtualPtr p); + +#endif diff --git a/xorg-server/hw/dmx/config/dmxtodmx.c b/xorg-server/hw/dmx/config/dmxtodmx.c new file mode 100644 index 000000000..0d4ee4c09 --- /dev/null +++ b/xorg-server/hw/dmx/config/dmxtodmx.c @@ -0,0 +1,49 @@ +/* + * Copyright 2002 Red Hat Inc., Durham, North Carolina. + * + * 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 on 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 + * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR 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. + */ + +/* + * Authors: + * Rickard E. (Rik) Faith <faith@redhat.com> + * + * This is a simple filter for testing. + */ + +#include "dmxconfig.h" +#include "dmxparse.h" +#include "dmxprint.h" +#include "dmxcompat.h" + +extern int yyparse(void); +extern FILE *yyin; + +int main(int argc, char **argv) +{ + yydebug = 0; + yyparse(); + dmxConfigPrint(stdout, dmxConfigEntry); + return 0; +} diff --git a/xorg-server/hw/dmx/config/dmxtodmx.man b/xorg-server/hw/dmx/config/dmxtodmx.man new file mode 100644 index 000000000..68c7f5b40 --- /dev/null +++ b/xorg-server/hw/dmx/config/dmxtodmx.man @@ -0,0 +1,41 @@ +.\" $XFree86$ +.\" Copyright 2002 Red Hat Inc., Durham, North Carolina. +.\" 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 on 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 +.\" NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR 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. +.\" +.\" Authors: +.\" Rickard E. (Rik) Faith <faith@redhat.com> +.\" +.TH dmxtodmx 1 __vendorversion__ +.SH NAME +dmxtodmx - dmx configuration file parser and printer +.SH SYNOPSIS +.B dmxtodmx +.SH DESCRIPTION +.I dmxtodmx +reads the standard input, parsing a configuration file for the +.I Xdmx +distributed multi-head X server. After a successful parse, the file is +pretty-printed to standard output. +.SH "SEE ALSO" +Xdmx(1), vdltodmx(1), xdmxconfig(1) diff --git a/xorg-server/hw/dmx/config/parser.c b/xorg-server/hw/dmx/config/parser.c new file mode 100644 index 000000000..61e4e201c --- /dev/null +++ b/xorg-server/hw/dmx/config/parser.c @@ -0,0 +1,1888 @@ +/* A Bison parser, made by GNU Bison 2.3. */ + +/* Skeleton implementation for Bison's Yacc-like parsers in C + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + +/* C LALR(1) parser skeleton written by Richard Stallman, by + simplifying the original so-called "semantic" parser. */ + +/* All symbols defined below should begin with yy or YY, to avoid + infringing on user name space. This should be done even for local + variables, as they might otherwise be expanded by user macros. + There are some unavoidable exceptions within include files to + define necessary library symbols; they are noted "INFRINGES ON + USER NAME SPACE" below. */ + +/* Identify Bison output. */ +#define YYBISON 1 + +/* Bison version. */ +#define YYBISON_VERSION "2.3" + +/* Skeleton name. */ +#define YYSKELETON_NAME "yacc.c" + +/* Pure parsers. */ +#define YYPURE 0 + +/* Using locations. */ +#define YYLSP_NEEDED 0 + + + +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + T_VIRTUAL = 258, + T_DISPLAY = 259, + T_WALL = 260, + T_OPTION = 261, + T_PARAM = 262, + T_STRING = 263, + T_DIMENSION = 264, + T_OFFSET = 265, + T_ORIGIN = 266, + T_COMMENT = 267, + T_LINE_COMMENT = 268 + }; +#endif +/* Tokens. */ +#define T_VIRTUAL 258 +#define T_DISPLAY 259 +#define T_WALL 260 +#define T_OPTION 261 +#define T_PARAM 262 +#define T_STRING 263 +#define T_DIMENSION 264 +#define T_OFFSET 265 +#define T_ORIGIN 266 +#define T_COMMENT 267 +#define T_LINE_COMMENT 268 + + + + +/* Copy the first part of user declarations. */ +#line 35 "parser.y" + +#ifdef HAVE_DMX_CONFIG_H +#include <dmx-config.h> +#endif + +#include "dmxparse.h" +#include <string.h> +#include <stdlib.h> +#define YYDEBUG 1 +#define YYERROR_VERBOSE +#define YY_USE_PROTOS + +DMXConfigEntryPtr dmxConfigEntry = NULL; +#define APPEND(type, h, t) \ +{ \ + type pt; \ + for (pt = h; pt->next; pt = pt->next); \ + pt->next = t; \ +} + + +/* Enabling traces. */ +#ifndef YYDEBUG +# define YYDEBUG 0 +#endif + +/* Enabling verbose error messages. */ +#ifdef YYERROR_VERBOSE +# undef YYERROR_VERBOSE +# define YYERROR_VERBOSE 1 +#else +# define YYERROR_VERBOSE 0 +#endif + +/* Enabling the token table. */ +#ifndef YYTOKEN_TABLE +# define YYTOKEN_TABLE 0 +#endif + +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED +typedef union YYSTYPE +#line 56 "parser.y" +{ + DMXConfigTokenPtr token; + DMXConfigStringPtr string; + DMXConfigNumberPtr number; + DMXConfigPairPtr pair; + DMXConfigFullDimPtr fdim; + DMXConfigPartDimPtr pdim; + DMXConfigDisplayPtr display; + DMXConfigWallPtr wall; + DMXConfigOptionPtr option; + DMXConfigParamPtr param; + DMXConfigCommentPtr comment; + DMXConfigSubPtr subentry; + DMXConfigVirtualPtr virtual; + DMXConfigEntryPtr entry; +} +/* Line 187 of yacc.c. */ +#line 160 "parser.c" + YYSTYPE; +# define yystype YYSTYPE /* obsolescent; will be withdrawn */ +# define YYSTYPE_IS_DECLARED 1 +# define YYSTYPE_IS_TRIVIAL 1 +#endif + + + +/* Copy the second part of user declarations. */ + + +/* Line 216 of yacc.c. */ +#line 173 "parser.c" + +#ifdef short +# undef short +#endif + +#ifdef YYTYPE_UINT8 +typedef YYTYPE_UINT8 yytype_uint8; +#else +typedef unsigned char yytype_uint8; +#endif + +#ifdef YYTYPE_INT8 +typedef YYTYPE_INT8 yytype_int8; +#elif (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +typedef signed char yytype_int8; +#else +typedef short int yytype_int8; +#endif + +#ifdef YYTYPE_UINT16 +typedef YYTYPE_UINT16 yytype_uint16; +#else +typedef unsigned short int yytype_uint16; +#endif + +#ifdef YYTYPE_INT16 +typedef YYTYPE_INT16 yytype_int16; +#else +typedef short int yytype_int16; +#endif + +#ifndef YYSIZE_T +# ifdef __SIZE_TYPE__ +# define YYSIZE_T __SIZE_TYPE__ +# elif defined size_t +# define YYSIZE_T size_t +# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +# include <stddef.h> /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +# else +# define YYSIZE_T unsigned int +# endif +#endif + +#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) + +#ifndef YY_ +# if YYENABLE_NLS +# if ENABLE_NLS +# include <libintl.h> /* INFRINGES ON USER NAME SPACE */ +# define YY_(msgid) dgettext ("bison-runtime", msgid) +# endif +# endif +# ifndef YY_ +# define YY_(msgid) msgid +# endif +#endif + +/* Suppress unused-variable warnings by "using" E. */ +#if ! defined lint || defined __GNUC__ +# define YYUSE(e) ((void) (e)) +#else +# define YYUSE(e) /* empty */ +#endif + +/* Identity function, used to suppress warnings about constant conditions. */ +#ifndef lint +# define YYID(n) (n) +#else +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static int +YYID (int i) +#else +static int +YYID (i) + int i; +#endif +{ + return i; +} +#endif + +#if ! defined yyoverflow || YYERROR_VERBOSE + +/* The parser invokes alloca or malloc; define the necessary symbols. */ + +# ifdef YYSTACK_USE_ALLOCA +# if YYSTACK_USE_ALLOCA +# ifdef __GNUC__ +# define YYSTACK_ALLOC __builtin_alloca +# elif defined __BUILTIN_VA_ARG_INCR +# include <alloca.h> /* INFRINGES ON USER NAME SPACE */ +# elif defined _AIX +# define YYSTACK_ALLOC __alloca +# elif defined _MSC_VER +# include <malloc.h> /* INFRINGES ON USER NAME SPACE */ +# define alloca _alloca +# else +# define YYSTACK_ALLOC alloca +# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ +# ifndef _STDLIB_H +# define _STDLIB_H 1 +# endif +# endif +# endif +# endif +# endif + +# ifdef YYSTACK_ALLOC + /* Pacify GCC's `empty if-body' warning. */ +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) +# ifndef YYSTACK_ALLOC_MAXIMUM + /* The OS might guarantee only one guard page at the bottom of the stack, + and a page size can be as small as 4096 bytes. So we cannot safely + invoke alloca (N) if N exceeds 4096. Use a slightly smaller number + to allow for a few compiler-allocated temporary stack slots. */ +# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ +# endif +# else +# define YYSTACK_ALLOC YYMALLOC +# define YYSTACK_FREE YYFREE +# ifndef YYSTACK_ALLOC_MAXIMUM +# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM +# endif +# if (defined __cplusplus && ! defined _STDLIB_H \ + && ! ((defined YYMALLOC || defined malloc) \ + && (defined YYFREE || defined free))) +# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ +# ifndef _STDLIB_H +# define _STDLIB_H 1 +# endif +# endif +# ifndef YYMALLOC +# define YYMALLOC malloc +# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# ifndef YYFREE +# define YYFREE free +# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +void free (void *); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# endif +#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ + + +#if (! defined yyoverflow \ + && (! defined __cplusplus \ + || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) + +/* A type that is properly aligned for any stack member. */ +union yyalloc +{ + yytype_int16 yyss; + YYSTYPE yyvs; + }; + +/* The size of the maximum gap between one aligned stack and the next. */ +# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) + +/* The size of an array large to enough to hold all stacks, each with + N elements. */ +# define YYSTACK_BYTES(N) \ + ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ + + YYSTACK_GAP_MAXIMUM) + +/* Copy COUNT objects from FROM to TO. The source and destination do + not overlap. */ +# ifndef YYCOPY +# if defined __GNUC__ && 1 < __GNUC__ +# define YYCOPY(To, From, Count) \ + __builtin_memcpy (To, From, (Count) * sizeof (*(From))) +# else +# define YYCOPY(To, From, Count) \ + do \ + { \ + YYSIZE_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (To)[yyi] = (From)[yyi]; \ + } \ + while (YYID (0)) +# endif +# endif + +/* Relocate STACK from its old location to the new one. The + local variables YYSIZE and YYSTACKSIZE give the old and new number of + elements in the stack, and YYPTR gives the new location of the + stack. Advance YYPTR to a properly aligned location for the next + stack. */ +# define YYSTACK_RELOCATE(Stack) \ + do \ + { \ + YYSIZE_T yynewbytes; \ + YYCOPY (&yyptr->Stack, Stack, yysize); \ + Stack = &yyptr->Stack; \ + yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ + yyptr += yynewbytes / sizeof (*yyptr); \ + } \ + while (YYID (0)) + +#endif + +/* YYFINAL -- State number of the termination state. */ +#define YYFINAL 13 +/* YYLAST -- Last index in YYTABLE. */ +#define YYLAST 106 + +/* YYNTOKENS -- Number of terminals. */ +#define YYNTOKENS 18 +/* YYNNTS -- Number of nonterminals. */ +#define YYNNTS 25 +/* YYNRULES -- Number of rules. */ +#define YYNRULES 59 +/* YYNRULES -- Number of states. */ +#define YYNSTATES 95 + +/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ +#define YYUNDEFTOK 2 +#define YYMAXUTOK 268 + +#define YYTRANSLATE(YYX) \ + ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) + +/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ +static const yytype_uint8 yytranslate[] = +{ + 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 6, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 5, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 3, 2, 4, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 1, 2, 7, 8, + 9, 10, 11, 12, 13, 14, 15, 16, 17 +}; + +#if YYDEBUG +/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in + YYRHS. */ +static const yytype_uint8 yyprhs[] = +{ + 0, 0, 3, 5, 7, 10, 12, 14, 19, 25, + 31, 38, 40, 43, 45, 47, 49, 51, 53, 57, + 61, 66, 68, 71, 74, 77, 79, 81, 85, 88, + 90, 96, 101, 106, 111, 115, 119, 122, 128, 133, + 137, 139, 142, 144, 147, 149, 152, 154, 157, 159, + 162, 164, 167, 169, 172, 174, 177, 179, 182, 184 +}; + +/* YYRHS -- A `-1'-separated list of the rules' RHS. */ +static const yytype_int8 yyrhs[] = +{ + 19, 0, -1, 20, -1, 21, -1, 20, 21, -1, + 22, -1, 17, -1, 7, 39, 23, 40, -1, 7, + 35, 39, 23, 40, -1, 7, 34, 39, 23, 40, + -1, 7, 34, 35, 39, 23, 40, -1, 24, -1, + 23, 24, -1, 17, -1, 31, -1, 32, -1, 25, + -1, 26, -1, 10, 42, 38, -1, 11, 42, 38, + -1, 11, 39, 27, 40, -1, 28, -1, 27, 28, + -1, 42, 38, -1, 35, 36, -1, 35, -1, 36, + -1, 29, 6, 29, -1, 6, 29, -1, 29, -1, + 33, 34, 30, 37, 38, -1, 33, 30, 37, 38, + -1, 33, 34, 37, 38, -1, 33, 34, 30, 38, + -1, 33, 30, 38, -1, 33, 34, 38, -1, 33, + 38, -1, 41, 35, 35, 42, 38, -1, 41, 35, + 42, 38, -1, 41, 42, 38, -1, 8, -1, 8, + 16, -1, 12, -1, 12, 16, -1, 13, -1, 13, + 16, -1, 14, -1, 14, 16, -1, 15, -1, 15, + 16, -1, 5, -1, 5, 16, -1, 3, -1, 3, + 16, -1, 4, -1, 4, 16, -1, 9, -1, 9, + 16, -1, 34, -1, 42, 34, -1 +}; + +/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ +static const yytype_uint8 yyrline[] = +{ + 0, 95, 95, 98, 99, 102, 103, 106, 108, 110, + 112, 116, 117, 120, 121, 122, 123, 124, 127, 131, + 133, 139, 140, 143, 147, 149, 151, 155, 157, 159, + 163, 165, 167, 170, 172, 174, 176, 180, 182, 184, + 188, 189, 192, 193, 196, 197, 200, 201, 204, 205, + 208, 209, 212, 213, 216, 217, 220, 221, 224, 225 +}; +#endif + +#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE +/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. + First, the terminals, then, starting at YYNTOKENS, nonterminals. */ +static const char *const yytname[] = +{ + "$end", "error", "$undefined", "'{'", "'}'", "';'", "'/'", "T_VIRTUAL", + "T_DISPLAY", "T_WALL", "T_OPTION", "T_PARAM", "T_STRING", "T_DIMENSION", + "T_OFFSET", "T_ORIGIN", "T_COMMENT", "T_LINE_COMMENT", "$accept", + "Program", "EntryList", "Entry", "Virtual", "SubList", "Sub", + "OptionEntry", "ParamEntry", "ParamList", "Param", "PartialDim", + "FullDim", "DisplayEntry", "WallEntry", "Display", "Name", "Dimension", + "Offset", "Origin", "Terminal", "Open", "Close", "Wall", "NameList", 0 +}; +#endif + +# ifdef YYPRINT +/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to + token YYLEX-NUM. */ +static const yytype_uint16 yytoknum[] = +{ + 0, 256, 257, 123, 125, 59, 47, 258, 259, 260, + 261, 262, 263, 264, 265, 266, 267, 268 +}; +# endif + +/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ +static const yytype_uint8 yyr1[] = +{ + 0, 18, 19, 20, 20, 21, 21, 22, 22, 22, + 22, 23, 23, 24, 24, 24, 24, 24, 25, 26, + 26, 27, 27, 28, 29, 29, 29, 30, 30, 30, + 31, 31, 31, 31, 31, 31, 31, 32, 32, 32, + 33, 33, 34, 34, 35, 35, 36, 36, 37, 37, + 38, 38, 39, 39, 40, 40, 41, 41, 42, 42 +}; + +/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ +static const yytype_uint8 yyr2[] = +{ + 0, 2, 1, 1, 2, 1, 1, 4, 5, 5, + 6, 1, 2, 1, 1, 1, 1, 1, 3, 3, + 4, 1, 2, 2, 2, 1, 1, 3, 2, 1, + 5, 4, 4, 4, 3, 3, 2, 5, 4, 3, + 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, + 1, 2, 1, 2, 1, 2, 1, 2, 1, 2 +}; + +/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state + STATE-NUM when YYTABLE doesn't specify something else to do. Zero + means the default is an error. */ +static const yytype_uint8 yydefact[] = +{ + 0, 0, 6, 0, 2, 3, 5, 52, 42, 44, + 0, 0, 0, 1, 4, 53, 43, 45, 0, 0, + 0, 40, 56, 0, 0, 13, 0, 11, 16, 17, + 14, 15, 0, 0, 0, 0, 0, 41, 57, 58, + 0, 0, 0, 54, 12, 7, 50, 0, 46, 29, + 0, 0, 25, 26, 36, 0, 0, 0, 9, 8, + 59, 18, 0, 21, 0, 19, 55, 51, 28, 47, + 0, 48, 0, 34, 0, 0, 35, 24, 0, 0, + 39, 10, 22, 20, 23, 27, 49, 31, 0, 33, + 32, 0, 38, 30, 37 +}; + +/* YYDEFGOTO[NTERM-NUM]. */ +static const yytype_int8 yydefgoto[] = +{ + -1, 3, 4, 5, 6, 26, 27, 28, 29, 62, + 63, 49, 50, 30, 31, 32, 39, 52, 53, 72, + 54, 12, 45, 33, 64 +}; + +/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ +#define YYPACT_NINF -32 +static const yytype_int8 yypact[] = +{ + -3, 41, -32, 22, -3, -32, -32, 12, 35, 46, + 5, 62, 75, -32, -32, -32, -32, -32, 62, 75, + 75, 51, 54, 59, 18, -32, 65, -32, -32, -32, + -32, -32, 88, 37, 75, 65, 65, -32, -32, -32, + 86, 59, 86, 61, -32, -32, 79, -4, 80, 28, + 31, 74, 67, -32, -32, 37, 86, 65, -32, -32, + -32, -32, 56, -32, 86, -32, -32, -32, -32, -32, + -4, 81, 94, -32, 31, 94, -32, -32, 59, 86, + -32, -32, -32, -32, -32, -32, -32, -32, 94, -32, + -32, 86, -32, -32, -32 +}; + +/* YYPGOTO[NTERM-NUM]. */ +static const yytype_int8 yypgoto[] = +{ + -32, -32, -32, 99, -32, 6, -19, -32, -32, -32, + 42, -28, 55, -32, -32, -32, -1, 2, 53, -31, + -27, 48, -30, -32, -22 +}; + +/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If + positive, shift that token. If negative, reduce the rule which + number is the opposite. If zero, do what YYDEFACT says. + If YYTABLE_NINF, syntax error. */ +#define YYTABLE_NINF -1 +static const yytype_uint8 yytable[] = +{ + 10, 40, 42, 11, 1, 58, 59, 44, 7, 9, + 48, 56, 18, 61, 2, 65, 44, 44, 9, 68, + 75, 7, 13, 73, 76, 35, 36, 81, 15, 80, + 8, 51, 83, 79, 70, 55, 46, 84, 44, 60, + 57, 60, 85, 88, 7, 87, 71, 89, 90, 8, + 9, 16, 92, 8, 9, 60, 91, 78, 19, 20, + 43, 93, 17, 60, 94, 7, 34, 37, 8, 43, + 38, 8, 41, 21, 22, 23, 24, 66, 60, 46, + 47, 48, 25, 21, 22, 23, 24, 9, 48, 71, + 60, 46, 25, 46, 47, 67, 69, 86, 8, 46, + 8, 9, 48, 14, 82, 77, 74 +}; + +static const yytype_uint8 yycheck[] = +{ + 1, 23, 24, 1, 7, 35, 36, 26, 3, 13, + 14, 33, 10, 40, 17, 42, 35, 36, 13, 47, + 51, 3, 0, 50, 51, 19, 20, 57, 16, 56, + 12, 32, 62, 55, 6, 33, 5, 64, 57, 40, + 34, 42, 70, 74, 3, 72, 15, 74, 75, 12, + 13, 16, 79, 12, 13, 56, 78, 55, 10, 11, + 4, 88, 16, 64, 91, 3, 18, 16, 12, 4, + 16, 12, 24, 8, 9, 10, 11, 16, 79, 5, + 6, 14, 17, 8, 9, 10, 11, 13, 14, 15, + 91, 5, 17, 5, 6, 16, 16, 16, 12, 5, + 12, 13, 14, 4, 62, 52, 51 +}; + +/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing + symbol of state STATE-NUM. */ +static const yytype_uint8 yystos[] = +{ + 0, 7, 17, 19, 20, 21, 22, 3, 12, 13, + 34, 35, 39, 0, 21, 16, 16, 16, 35, 39, + 39, 8, 9, 10, 11, 17, 23, 24, 25, 26, + 31, 32, 33, 41, 39, 23, 23, 16, 16, 34, + 42, 39, 42, 4, 24, 40, 5, 6, 14, 29, + 30, 34, 35, 36, 38, 35, 42, 23, 40, 40, + 34, 38, 27, 28, 42, 38, 16, 16, 29, 16, + 6, 15, 37, 38, 30, 37, 38, 36, 35, 42, + 38, 40, 28, 40, 38, 29, 16, 38, 37, 38, + 38, 42, 38, 38, 38 +}; + +#define yyerrok (yyerrstatus = 0) +#define yyclearin (yychar = YYEMPTY) +#define YYEMPTY (-2) +#define YYEOF 0 + +#define YYACCEPT goto yyacceptlab +#define YYABORT goto yyabortlab +#define YYERROR goto yyerrorlab + + +/* Like YYERROR except do call yyerror. This remains here temporarily + to ease the transition to the new meaning of YYERROR, for GCC. + Once GCC version 2 has supplanted version 1, this can go. */ + +#define YYFAIL goto yyerrlab + +#define YYRECOVERING() (!!yyerrstatus) + +#define YYBACKUP(Token, Value) \ +do \ + if (yychar == YYEMPTY && yylen == 1) \ + { \ + yychar = (Token); \ + yylval = (Value); \ + yytoken = YYTRANSLATE (yychar); \ + YYPOPSTACK (1); \ + goto yybackup; \ + } \ + else \ + { \ + yyerror (YY_("syntax error: cannot back up")); \ + YYERROR; \ + } \ +while (YYID (0)) + + +#define YYTERROR 1 +#define YYERRCODE 256 + + +/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. + If N is 0, then set CURRENT to the empty location which ends + the previous symbol: RHS[0] (always defined). */ + +#define YYRHSLOC(Rhs, K) ((Rhs)[K]) +#ifndef YYLLOC_DEFAULT +# define YYLLOC_DEFAULT(Current, Rhs, N) \ + do \ + if (YYID (N)) \ + { \ + (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ + (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ + (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ + (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ + } \ + else \ + { \ + (Current).first_line = (Current).last_line = \ + YYRHSLOC (Rhs, 0).last_line; \ + (Current).first_column = (Current).last_column = \ + YYRHSLOC (Rhs, 0).last_column; \ + } \ + while (YYID (0)) +#endif + + +/* YY_LOCATION_PRINT -- Print the location on the stream. + This macro was not mandated originally: define only if we know + we won't break user code: when these are the locations we know. */ + +#ifndef YY_LOCATION_PRINT +# if YYLTYPE_IS_TRIVIAL +# define YY_LOCATION_PRINT(File, Loc) \ + fprintf (File, "%d.%d-%d.%d", \ + (Loc).first_line, (Loc).first_column, \ + (Loc).last_line, (Loc).last_column) +# else +# define YY_LOCATION_PRINT(File, Loc) ((void) 0) +# endif +#endif + + +/* YYLEX -- calling `yylex' with the right arguments. */ + +#ifdef YYLEX_PARAM +# define YYLEX yylex (YYLEX_PARAM) +#else +# define YYLEX yylex () +#endif + +/* Enable debugging if requested. */ +#if YYDEBUG + +# ifndef YYFPRINTF +# include <stdio.h> /* INFRINGES ON USER NAME SPACE */ +# define YYFPRINTF fprintf +# endif + +# define YYDPRINTF(Args) \ +do { \ + if (yydebug) \ + YYFPRINTF Args; \ +} while (YYID (0)) + +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ +do { \ + if (yydebug) \ + { \ + YYFPRINTF (stderr, "%s ", Title); \ + yy_symbol_print (stderr, \ + Type, Value); \ + YYFPRINTF (stderr, "\n"); \ + } \ +} while (YYID (0)) + + +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ + +/*ARGSUSED*/ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) +#else +static void +yy_symbol_value_print (yyoutput, yytype, yyvaluep) + FILE *yyoutput; + int yytype; + YYSTYPE const * const yyvaluep; +#endif +{ + if (!yyvaluep) + return; +# ifdef YYPRINT + if (yytype < YYNTOKENS) + YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); +# else + YYUSE (yyoutput); +# endif + switch (yytype) + { + default: + break; + } +} + + +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ + +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) +#else +static void +yy_symbol_print (yyoutput, yytype, yyvaluep) + FILE *yyoutput; + int yytype; + YYSTYPE const * const yyvaluep; +#endif +{ + if (yytype < YYNTOKENS) + YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); + else + YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); + + yy_symbol_value_print (yyoutput, yytype, yyvaluep); + YYFPRINTF (yyoutput, ")"); +} + +/*------------------------------------------------------------------. +| yy_stack_print -- Print the state stack from its BOTTOM up to its | +| TOP (included). | +`------------------------------------------------------------------*/ + +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_stack_print (yytype_int16 *bottom, yytype_int16 *top) +#else +static void +yy_stack_print (bottom, top) + yytype_int16 *bottom; + yytype_int16 *top; +#endif +{ + YYFPRINTF (stderr, "Stack now"); + for (; bottom <= top; ++bottom) + YYFPRINTF (stderr, " %d", *bottom); + YYFPRINTF (stderr, "\n"); +} + +# define YY_STACK_PRINT(Bottom, Top) \ +do { \ + if (yydebug) \ + yy_stack_print ((Bottom), (Top)); \ +} while (YYID (0)) + + +/*------------------------------------------------. +| Report that the YYRULE is going to be reduced. | +`------------------------------------------------*/ + +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_reduce_print (YYSTYPE *yyvsp, int yyrule) +#else +static void +yy_reduce_print (yyvsp, yyrule) + YYSTYPE *yyvsp; + int yyrule; +#endif +{ + int yynrhs = yyr2[yyrule]; + int yyi; + unsigned long int yylno = yyrline[yyrule]; + YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", + yyrule - 1, yylno); + /* The symbols being reduced. */ + for (yyi = 0; yyi < yynrhs; yyi++) + { + fprintf (stderr, " $%d = ", yyi + 1); + yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], + &(yyvsp[(yyi + 1) - (yynrhs)]) + ); + fprintf (stderr, "\n"); + } +} + +# define YY_REDUCE_PRINT(Rule) \ +do { \ + if (yydebug) \ + yy_reduce_print (yyvsp, Rule); \ +} while (YYID (0)) + +/* Nonzero means print parse trace. It is left uninitialized so that + multiple parsers can coexist. */ +int yydebug; +#else /* !YYDEBUG */ +# define YYDPRINTF(Args) +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) +# define YY_STACK_PRINT(Bottom, Top) +# define YY_REDUCE_PRINT(Rule) +#endif /* !YYDEBUG */ + + +/* YYINITDEPTH -- initial size of the parser's stacks. */ +#ifndef YYINITDEPTH +# define YYINITDEPTH 200 +#endif + +/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only + if the built-in stack extension method is used). + + Do not make this value too large; the results are undefined if + YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) + evaluated with infinite-precision integer arithmetic. */ + +#ifndef YYMAXDEPTH +# define YYMAXDEPTH 10000 +#endif + + + +#if YYERROR_VERBOSE + +# ifndef yystrlen +# if defined __GLIBC__ && defined _STRING_H +# define yystrlen strlen +# else +/* Return the length of YYSTR. */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static YYSIZE_T +yystrlen (const char *yystr) +#else +static YYSIZE_T +yystrlen (yystr) + const char *yystr; +#endif +{ + YYSIZE_T yylen; + for (yylen = 0; yystr[yylen]; yylen++) + continue; + return yylen; +} +# endif +# endif + +# ifndef yystpcpy +# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE +# define yystpcpy stpcpy +# else +/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in + YYDEST. */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static char * +yystpcpy (char *yydest, const char *yysrc) +#else +static char * +yystpcpy (yydest, yysrc) + char *yydest; + const char *yysrc; +#endif +{ + char *yyd = yydest; + const char *yys = yysrc; + + while ((*yyd++ = *yys++) != '\0') + continue; + + return yyd - 1; +} +# endif +# endif + +# ifndef yytnamerr +/* Copy to YYRES the contents of YYSTR after stripping away unnecessary + quotes and backslashes, so that it's suitable for yyerror. The + heuristic is that double-quoting is unnecessary unless the string + contains an apostrophe, a comma, or backslash (other than + backslash-backslash). YYSTR is taken from yytname. If YYRES is + null, do not copy; instead, return the length of what the result + would have been. */ +static YYSIZE_T +yytnamerr (char *yyres, const char *yystr) +{ + if (*yystr == '"') + { + YYSIZE_T yyn = 0; + char const *yyp = yystr; + + for (;;) + switch (*++yyp) + { + case '\'': + case ',': + goto do_not_strip_quotes; + + case '\\': + if (*++yyp != '\\') + goto do_not_strip_quotes; + /* Fall through. */ + default: + if (yyres) + yyres[yyn] = *yyp; + yyn++; + break; + + case '"': + if (yyres) + yyres[yyn] = '\0'; + return yyn; + } + do_not_strip_quotes: ; + } + + if (! yyres) + return yystrlen (yystr); + + return yystpcpy (yyres, yystr) - yyres; +} +# endif + +/* Copy into YYRESULT an error message about the unexpected token + YYCHAR while in state YYSTATE. Return the number of bytes copied, + including the terminating null byte. If YYRESULT is null, do not + copy anything; just return the number of bytes that would be + copied. As a special case, return 0 if an ordinary "syntax error" + message will do. Return YYSIZE_MAXIMUM if overflow occurs during + size calculation. */ +static YYSIZE_T +yysyntax_error (char *yyresult, int yystate, int yychar) +{ + int yyn = yypact[yystate]; + + if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) + return 0; + else + { + int yytype = YYTRANSLATE (yychar); + YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); + YYSIZE_T yysize = yysize0; + YYSIZE_T yysize1; + int yysize_overflow = 0; + enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; + char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; + int yyx; + +# if 0 + /* This is so xgettext sees the translatable formats that are + constructed on the fly. */ + YY_("syntax error, unexpected %s"); + YY_("syntax error, unexpected %s, expecting %s"); + YY_("syntax error, unexpected %s, expecting %s or %s"); + YY_("syntax error, unexpected %s, expecting %s or %s or %s"); + YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); +# endif + char *yyfmt; + char const *yyf; + static char const yyunexpected[] = "syntax error, unexpected %s"; + static char const yyexpecting[] = ", expecting %s"; + static char const yyor[] = " or %s"; + char yyformat[sizeof yyunexpected + + sizeof yyexpecting - 1 + + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) + * (sizeof yyor - 1))]; + char const *yyprefix = yyexpecting; + + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. */ + int yyxbegin = yyn < 0 ? -yyn : 0; + + /* Stay within bounds of both yycheck and yytname. */ + int yychecklim = YYLAST - yyn + 1; + int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; + int yycount = 1; + + yyarg[0] = yytname[yytype]; + yyfmt = yystpcpy (yyformat, yyunexpected); + + for (yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) + { + if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) + { + yycount = 1; + yysize = yysize0; + yyformat[sizeof yyunexpected - 1] = '\0'; + break; + } + yyarg[yycount++] = yytname[yyx]; + yysize1 = yysize + yytnamerr (0, yytname[yyx]); + yysize_overflow |= (yysize1 < yysize); + yysize = yysize1; + yyfmt = yystpcpy (yyfmt, yyprefix); + yyprefix = yyor; + } + + yyf = YY_(yyformat); + yysize1 = yysize + yystrlen (yyf); + yysize_overflow |= (yysize1 < yysize); + yysize = yysize1; + + if (yysize_overflow) + return YYSIZE_MAXIMUM; + + if (yyresult) + { + /* Avoid sprintf, as that infringes on the user's name space. + Don't have undefined behavior even if the translation + produced a string with the wrong number of "%s"s. */ + char *yyp = yyresult; + int yyi = 0; + while ((*yyp = *yyf) != '\0') + { + if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) + { + yyp += yytnamerr (yyp, yyarg[yyi++]); + yyf += 2; + } + else + { + yyp++; + yyf++; + } + } + } + return yysize; + } +} +#endif /* YYERROR_VERBOSE */ + + +/*-----------------------------------------------. +| Release the memory associated to this symbol. | +`-----------------------------------------------*/ + +/*ARGSUSED*/ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) +#else +static void +yydestruct (yymsg, yytype, yyvaluep) + const char *yymsg; + int yytype; + YYSTYPE *yyvaluep; +#endif +{ + YYUSE (yyvaluep); + + if (!yymsg) + yymsg = "Deleting"; + YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); + + switch (yytype) + { + + default: + break; + } +} + + +/* Prevent warnings from -Wmissing-prototypes. */ + +#ifdef YYPARSE_PARAM +#if defined __STDC__ || defined __cplusplus +int yyparse (void *YYPARSE_PARAM); +#else +int yyparse (); +#endif +#else /* ! YYPARSE_PARAM */ +#if defined __STDC__ || defined __cplusplus +int yyparse (void); +#else +int yyparse (); +#endif +#endif /* ! YYPARSE_PARAM */ + + + +/* The look-ahead symbol. */ +int yychar; + +/* The semantic value of the look-ahead symbol. */ +YYSTYPE yylval; + +/* Number of syntax errors so far. */ +int yynerrs; + + + +/*----------. +| yyparse. | +`----------*/ + +#ifdef YYPARSE_PARAM +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +int +yyparse (void *YYPARSE_PARAM) +#else +int +yyparse (YYPARSE_PARAM) + void *YYPARSE_PARAM; +#endif +#else /* ! YYPARSE_PARAM */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +int +yyparse (void) +#else +int +yyparse () + +#endif +#endif +{ + + int yystate; + int yyn; + int yyresult; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; + /* Look-ahead token as an internal (translated) token number. */ + int yytoken = 0; +#if YYERROR_VERBOSE + /* Buffer for error messages, and its allocated size. */ + char yymsgbuf[128]; + char *yymsg = yymsgbuf; + YYSIZE_T yymsg_alloc = sizeof yymsgbuf; +#endif + + /* Three stacks and their tools: + `yyss': related to states, + `yyvs': related to semantic values, + `yyls': related to locations. + + Refer to the stacks thru separate pointers, to allow yyoverflow + to reallocate them elsewhere. */ + + /* The state stack. */ + yytype_int16 yyssa[YYINITDEPTH]; + yytype_int16 *yyss = yyssa; + yytype_int16 *yyssp; + + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs = yyvsa; + YYSTYPE *yyvsp; + + + +#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) + + YYSIZE_T yystacksize = YYINITDEPTH; + + /* The variables used to return semantic value and location from the + action routines. */ + YYSTYPE yyval; + + + /* The number of symbols on the RHS of the reduced rule. + Keep to zero when no symbol should be popped. */ + int yylen = 0; + + YYDPRINTF ((stderr, "Starting parse\n")); + + yystate = 0; + yyerrstatus = 0; + yynerrs = 0; + yychar = YYEMPTY; /* Cause a token to be read. */ + + /* Initialize stack pointers. + Waste one element of value and location stack + so that they stay on the same level as the state stack. + The wasted elements are never initialized. */ + + yyssp = yyss; + yyvsp = yyvs; + + goto yysetstate; + +/*------------------------------------------------------------. +| yynewstate -- Push a new state, which is found in yystate. | +`------------------------------------------------------------*/ + yynewstate: + /* In all cases, when you get here, the value and location stacks + have just been pushed. So pushing a state here evens the stacks. */ + yyssp++; + + yysetstate: + *yyssp = yystate; + + if (yyss + yystacksize - 1 <= yyssp) + { + /* Get the current used size of the three stacks, in elements. */ + YYSIZE_T yysize = yyssp - yyss + 1; + +#ifdef yyoverflow + { + /* Give user a chance to reallocate the stack. Use copies of + these so that the &'s don't force the real ones into + memory. */ + YYSTYPE *yyvs1 = yyvs; + yytype_int16 *yyss1 = yyss; + + + /* Each stack pointer address is followed by the size of the + data in use in that stack, in bytes. This used to be a + conditional around just the two extra args, but that might + be undefined if yyoverflow is a macro. */ + yyoverflow (YY_("memory exhausted"), + &yyss1, yysize * sizeof (*yyssp), + &yyvs1, yysize * sizeof (*yyvsp), + + &yystacksize); + + yyss = yyss1; + yyvs = yyvs1; + } +#else /* no yyoverflow */ +# ifndef YYSTACK_RELOCATE + goto yyexhaustedlab; +# else + /* Extend the stack our own way. */ + if (YYMAXDEPTH <= yystacksize) + goto yyexhaustedlab; + yystacksize *= 2; + if (YYMAXDEPTH < yystacksize) + yystacksize = YYMAXDEPTH; + + { + yytype_int16 *yyss1 = yyss; + union yyalloc *yyptr = + (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); + if (! yyptr) + goto yyexhaustedlab; + YYSTACK_RELOCATE (yyss); + YYSTACK_RELOCATE (yyvs); + +# undef YYSTACK_RELOCATE + if (yyss1 != yyssa) + YYSTACK_FREE (yyss1); + } +# endif +#endif /* no yyoverflow */ + + yyssp = yyss + yysize - 1; + yyvsp = yyvs + yysize - 1; + + + YYDPRINTF ((stderr, "Stack size increased to %lu\n", + (unsigned long int) yystacksize)); + + if (yyss + yystacksize - 1 <= yyssp) + YYABORT; + } + + YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + + goto yybackup; + +/*-----------. +| yybackup. | +`-----------*/ +yybackup: + + /* Do appropriate processing given the current state. Read a + look-ahead token if we need one and don't already have one. */ + + /* First try to decide what to do without reference to look-ahead token. */ + yyn = yypact[yystate]; + if (yyn == YYPACT_NINF) + goto yydefault; + + /* Not known => get a look-ahead token if don't already have one. */ + + /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ + if (yychar == YYEMPTY) + { + YYDPRINTF ((stderr, "Reading a token: ")); + yychar = YYLEX; + } + + if (yychar <= YYEOF) + { + yychar = yytoken = YYEOF; + YYDPRINTF ((stderr, "Now at end of input.\n")); + } + else + { + yytoken = YYTRANSLATE (yychar); + YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); + } + + /* If the proper action on seeing token YYTOKEN is to reduce or to + detect an error, take that action. */ + yyn += yytoken; + if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) + goto yydefault; + yyn = yytable[yyn]; + if (yyn <= 0) + { + if (yyn == 0 || yyn == YYTABLE_NINF) + goto yyerrlab; + yyn = -yyn; + goto yyreduce; + } + + if (yyn == YYFINAL) + YYACCEPT; + + /* Count tokens shifted since error; after three, turn off error + status. */ + if (yyerrstatus) + yyerrstatus--; + + /* Shift the look-ahead token. */ + YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); + + /* Discard the shifted token unless it is eof. */ + if (yychar != YYEOF) + yychar = YYEMPTY; + + yystate = yyn; + *++yyvsp = yylval; + + goto yynewstate; + + +/*-----------------------------------------------------------. +| yydefault -- do the default action for the current state. | +`-----------------------------------------------------------*/ +yydefault: + yyn = yydefact[yystate]; + if (yyn == 0) + goto yyerrlab; + goto yyreduce; + + +/*-----------------------------. +| yyreduce -- Do a reduction. | +`-----------------------------*/ +yyreduce: + /* yyn is the number of a rule to reduce with. */ + yylen = yyr2[yyn]; + + /* If YYLEN is nonzero, implement the default value of the action: + `$$ = $1'. + + Otherwise, the following line sets YYVAL to garbage. + This behavior is undocumented and Bison + users should not rely upon it. Assigning to YYVAL + unconditionally makes the parser a bit smaller, and it avoids a + GCC warning that YYVAL may be used uninitialized. */ + yyval = yyvsp[1-yylen]; + + + YY_REDUCE_PRINT (yyn); + switch (yyn) + { + case 2: +#line 95 "parser.y" + { dmxConfigEntry = (yyvsp[(1) - (1)].entry); } + break; + + case 4: +#line 99 "parser.y" + { APPEND(DMXConfigEntryPtr,(yyvsp[(1) - (2)].entry),(yyvsp[(2) - (2)].entry)); (yyval.entry) = (yyvsp[(1) - (2)].entry); } + break; + + case 5: +#line 102 "parser.y" + { (yyval.entry) = dmxConfigEntryVirtual((yyvsp[(1) - (1)].virtual)); } + break; + + case 6: +#line 103 "parser.y" + { (yyval.entry) = dmxConfigEntryComment((yyvsp[(1) - (1)].comment)); } + break; + + case 7: +#line 107 "parser.y" + { (yyval.virtual) = dmxConfigCreateVirtual((yyvsp[(1) - (4)].token), NULL, NULL, (yyvsp[(2) - (4)].token), (yyvsp[(3) - (4)].subentry), (yyvsp[(4) - (4)].token)); } + break; + + case 8: +#line 109 "parser.y" + { (yyval.virtual) = dmxConfigCreateVirtual((yyvsp[(1) - (5)].token), NULL, (yyvsp[(2) - (5)].pair), (yyvsp[(3) - (5)].token), (yyvsp[(4) - (5)].subentry), (yyvsp[(5) - (5)].token)); } + break; + + case 9: +#line 111 "parser.y" + { (yyval.virtual) = dmxConfigCreateVirtual((yyvsp[(1) - (5)].token), (yyvsp[(2) - (5)].string), NULL, (yyvsp[(3) - (5)].token), (yyvsp[(4) - (5)].subentry), (yyvsp[(5) - (5)].token)); } + break; + + case 10: +#line 113 "parser.y" + { (yyval.virtual) = dmxConfigCreateVirtual((yyvsp[(1) - (6)].token), (yyvsp[(2) - (6)].string), (yyvsp[(3) - (6)].pair), (yyvsp[(4) - (6)].token), (yyvsp[(5) - (6)].subentry), (yyvsp[(6) - (6)].token) ); } + break; + + case 12: +#line 117 "parser.y" + { APPEND(DMXConfigSubPtr,(yyvsp[(1) - (2)].subentry),(yyvsp[(2) - (2)].subentry)); (yyval.subentry) = (yyvsp[(1) - (2)].subentry); } + break; + + case 13: +#line 120 "parser.y" + { (yyval.subentry) = dmxConfigSubComment((yyvsp[(1) - (1)].comment)); } + break; + + case 14: +#line 121 "parser.y" + { (yyval.subentry) = dmxConfigSubDisplay((yyvsp[(1) - (1)].display)); } + break; + + case 15: +#line 122 "parser.y" + { (yyval.subentry) = dmxConfigSubWall((yyvsp[(1) - (1)].wall)); } + break; + + case 16: +#line 123 "parser.y" + { (yyval.subentry) = dmxConfigSubOption((yyvsp[(1) - (1)].option)); } + break; + + case 17: +#line 124 "parser.y" + { (yyval.subentry) = dmxConfigSubParam((yyvsp[(1) - (1)].param)); } + break; + + case 18: +#line 128 "parser.y" + { (yyval.option) = dmxConfigCreateOption((yyvsp[(1) - (3)].token), (yyvsp[(2) - (3)].string), (yyvsp[(3) - (3)].token)); } + break; + + case 19: +#line 132 "parser.y" + { (yyval.param) = dmxConfigCreateParam((yyvsp[(1) - (3)].token), NULL, (yyvsp[(2) - (3)].string), NULL, (yyvsp[(3) - (3)].token)); } + break; + + case 20: +#line 134 "parser.y" + { (yyval.param) = dmxConfigCreateParam((yyvsp[(1) - (4)].token), (yyvsp[(2) - (4)].token), NULL, (yyvsp[(4) - (4)].token), NULL); + (yyval.param)->next = (yyvsp[(3) - (4)].param); + } + break; + + case 22: +#line 140 "parser.y" + { APPEND(DMXConfigParamPtr,(yyvsp[(1) - (2)].param),(yyvsp[(2) - (2)].param)); (yyval.param) = (yyvsp[(1) - (2)].param); } + break; + + case 23: +#line 144 "parser.y" + { (yyval.param) = dmxConfigCreateParam(NULL, NULL, (yyvsp[(1) - (2)].string), NULL, (yyvsp[(2) - (2)].token)); } + break; + + case 24: +#line 148 "parser.y" + { (yyval.pdim) = dmxConfigCreatePartDim((yyvsp[(1) - (2)].pair), (yyvsp[(2) - (2)].pair)); } + break; + + case 25: +#line 150 "parser.y" + { (yyval.pdim) = dmxConfigCreatePartDim((yyvsp[(1) - (1)].pair), NULL); } + break; + + case 26: +#line 152 "parser.y" + { (yyval.pdim) = dmxConfigCreatePartDim(NULL, (yyvsp[(1) - (1)].pair)); } + break; + + case 27: +#line 156 "parser.y" + { (yyval.fdim) = dmxConfigCreateFullDim((yyvsp[(1) - (3)].pdim), (yyvsp[(3) - (3)].pdim)); } + break; + + case 28: +#line 158 "parser.y" + { (yyval.fdim) = dmxConfigCreateFullDim(NULL, (yyvsp[(2) - (2)].pdim)); } + break; + + case 29: +#line 160 "parser.y" + { (yyval.fdim) = dmxConfigCreateFullDim((yyvsp[(1) - (1)].pdim), NULL); } + break; + + case 30: +#line 164 "parser.y" + { (yyval.display) = dmxConfigCreateDisplay((yyvsp[(1) - (5)].token), (yyvsp[(2) - (5)].string), (yyvsp[(3) - (5)].fdim), (yyvsp[(4) - (5)].pair), (yyvsp[(5) - (5)].token)); } + break; + + case 31: +#line 166 "parser.y" + { (yyval.display) = dmxConfigCreateDisplay((yyvsp[(1) - (4)].token), NULL, (yyvsp[(2) - (4)].fdim), (yyvsp[(3) - (4)].pair), (yyvsp[(4) - (4)].token)); } + break; + + case 32: +#line 168 "parser.y" + { (yyval.display) = dmxConfigCreateDisplay((yyvsp[(1) - (4)].token), (yyvsp[(2) - (4)].string), NULL, (yyvsp[(3) - (4)].pair), (yyvsp[(4) - (4)].token)); } + break; + + case 33: +#line 171 "parser.y" + { (yyval.display) = dmxConfigCreateDisplay((yyvsp[(1) - (4)].token), (yyvsp[(2) - (4)].string), (yyvsp[(3) - (4)].fdim), NULL, (yyvsp[(4) - (4)].token)); } + break; + + case 34: +#line 173 "parser.y" + { (yyval.display) = dmxConfigCreateDisplay((yyvsp[(1) - (3)].token), NULL, (yyvsp[(2) - (3)].fdim), NULL, (yyvsp[(3) - (3)].token)); } + break; + + case 35: +#line 175 "parser.y" + { (yyval.display) = dmxConfigCreateDisplay((yyvsp[(1) - (3)].token), (yyvsp[(2) - (3)].string), NULL, NULL, (yyvsp[(3) - (3)].token)); } + break; + + case 36: +#line 177 "parser.y" + { (yyval.display) = dmxConfigCreateDisplay((yyvsp[(1) - (2)].token), NULL, NULL, NULL, (yyvsp[(2) - (2)].token)); } + break; + + case 37: +#line 181 "parser.y" + { (yyval.wall) = dmxConfigCreateWall((yyvsp[(1) - (5)].token), (yyvsp[(2) - (5)].pair), (yyvsp[(3) - (5)].pair), (yyvsp[(4) - (5)].string), (yyvsp[(5) - (5)].token)); } + break; + + case 38: +#line 183 "parser.y" + { (yyval.wall) = dmxConfigCreateWall((yyvsp[(1) - (4)].token), (yyvsp[(2) - (4)].pair), NULL, (yyvsp[(3) - (4)].string), (yyvsp[(4) - (4)].token)); } + break; + + case 39: +#line 185 "parser.y" + { (yyval.wall) = dmxConfigCreateWall((yyvsp[(1) - (3)].token), NULL, NULL, (yyvsp[(2) - (3)].string), (yyvsp[(3) - (3)].token)); } + break; + + case 41: +#line 189 "parser.y" + { (yyval.token) = (yyvsp[(1) - (2)].token); (yyval.token)->comment = (yyvsp[(2) - (2)].comment)->comment; } + break; + + case 43: +#line 193 "parser.y" + { (yyval.string) = (yyvsp[(1) - (2)].string); (yyval.string)->comment = (yyvsp[(2) - (2)].comment)->comment; } + break; + + case 45: +#line 197 "parser.y" + { (yyval.pair) = (yyvsp[(1) - (2)].pair); (yyval.pair)->comment = (yyvsp[(2) - (2)].comment)->comment; } + break; + + case 47: +#line 201 "parser.y" + { (yyval.pair) = (yyvsp[(1) - (2)].pair); (yyval.pair)->comment = (yyvsp[(2) - (2)].comment)->comment; } + break; + + case 49: +#line 205 "parser.y" + { (yyval.pair) = (yyvsp[(1) - (2)].pair); (yyval.pair)->comment = (yyvsp[(2) - (2)].comment)->comment; } + break; + + case 51: +#line 209 "parser.y" + { (yyval.token) = (yyvsp[(1) - (2)].token); (yyval.token)->comment = (yyvsp[(2) - (2)].comment)->comment; } + break; + + case 53: +#line 213 "parser.y" + { (yyval.token) = (yyvsp[(1) - (2)].token); (yyval.token)->comment = (yyvsp[(2) - (2)].comment)->comment; } + break; + + case 55: +#line 217 "parser.y" + { (yyval.token) = (yyvsp[(1) - (2)].token); (yyval.token)->comment = (yyvsp[(2) - (2)].comment)->comment; } + break; + + case 57: +#line 221 "parser.y" + { (yyval.token) = (yyvsp[(1) - (2)].token); (yyval.token)->comment = (yyvsp[(2) - (2)].comment)->comment; } + break; + + case 59: +#line 225 "parser.y" + { APPEND(DMXConfigStringPtr, (yyvsp[(1) - (2)].string), (yyvsp[(2) - (2)].string)); (yyval.string) = (yyvsp[(1) - (2)].string); } + break; + + +/* Line 1267 of yacc.c. */ +#line 1675 "parser.c" + default: break; + } + YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); + + YYPOPSTACK (yylen); + yylen = 0; + YY_STACK_PRINT (yyss, yyssp); + + *++yyvsp = yyval; + + + /* Now `shift' the result of the reduction. Determine what state + that goes to, based on the state we popped back to and the rule + number reduced by. */ + + yyn = yyr1[yyn]; + + yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; + if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) + yystate = yytable[yystate]; + else + yystate = yydefgoto[yyn - YYNTOKENS]; + + goto yynewstate; + + +/*------------------------------------. +| yyerrlab -- here on detecting error | +`------------------------------------*/ +yyerrlab: + /* If not already recovering from an error, report this error. */ + if (!yyerrstatus) + { + ++yynerrs; +#if ! YYERROR_VERBOSE + yyerror (YY_("syntax error")); +#else + { + YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); + if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) + { + YYSIZE_T yyalloc = 2 * yysize; + if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) + yyalloc = YYSTACK_ALLOC_MAXIMUM; + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); + yymsg = (char *) YYSTACK_ALLOC (yyalloc); + if (yymsg) + yymsg_alloc = yyalloc; + else + { + yymsg = yymsgbuf; + yymsg_alloc = sizeof yymsgbuf; + } + } + + if (0 < yysize && yysize <= yymsg_alloc) + { + (void) yysyntax_error (yymsg, yystate, yychar); + yyerror (yymsg); + } + else + { + yyerror (YY_("syntax error")); + if (yysize != 0) + goto yyexhaustedlab; + } + } +#endif + } + + + + if (yyerrstatus == 3) + { + /* If just tried and failed to reuse look-ahead token after an + error, discard it. */ + + if (yychar <= YYEOF) + { + /* Return failure if at end of input. */ + if (yychar == YYEOF) + YYABORT; + } + else + { + yydestruct ("Error: discarding", + yytoken, &yylval); + yychar = YYEMPTY; + } + } + + /* Else will try to reuse look-ahead token after shifting the error + token. */ + goto yyerrlab1; + + +/*---------------------------------------------------. +| yyerrorlab -- error raised explicitly by YYERROR. | +`---------------------------------------------------*/ +yyerrorlab: + + /* Pacify compilers like GCC when the user code never invokes + YYERROR and the label yyerrorlab therefore never appears in user + code. */ + if (/*CONSTCOND*/ 0) + goto yyerrorlab; + + /* Do not reclaim the symbols of the rule which action triggered + this YYERROR. */ + YYPOPSTACK (yylen); + yylen = 0; + YY_STACK_PRINT (yyss, yyssp); + yystate = *yyssp; + goto yyerrlab1; + + +/*-------------------------------------------------------------. +| yyerrlab1 -- common code for both syntax error and YYERROR. | +`-------------------------------------------------------------*/ +yyerrlab1: + yyerrstatus = 3; /* Each real token shifted decrements this. */ + + for (;;) + { + yyn = yypact[yystate]; + if (yyn != YYPACT_NINF) + { + yyn += YYTERROR; + if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) + { + yyn = yytable[yyn]; + if (0 < yyn) + break; + } + } + + /* Pop the current state because it cannot handle the error token. */ + if (yyssp == yyss) + YYABORT; + + + yydestruct ("Error: popping", + yystos[yystate], yyvsp); + YYPOPSTACK (1); + yystate = *yyssp; + YY_STACK_PRINT (yyss, yyssp); + } + + if (yyn == YYFINAL) + YYACCEPT; + + *++yyvsp = yylval; + + + /* Shift the error token. */ + YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); + + yystate = yyn; + goto yynewstate; + + +/*-------------------------------------. +| yyacceptlab -- YYACCEPT comes here. | +`-------------------------------------*/ +yyacceptlab: + yyresult = 0; + goto yyreturn; + +/*-----------------------------------. +| yyabortlab -- YYABORT comes here. | +`-----------------------------------*/ +yyabortlab: + yyresult = 1; + goto yyreturn; + +#ifndef yyoverflow +/*-------------------------------------------------. +| yyexhaustedlab -- memory exhaustion comes here. | +`-------------------------------------------------*/ +yyexhaustedlab: + yyerror (YY_("memory exhausted")); + yyresult = 2; + /* Fall through. */ +#endif + +yyreturn: + if (yychar != YYEOF && yychar != YYEMPTY) + yydestruct ("Cleanup: discarding lookahead", + yytoken, &yylval); + /* Do not reclaim the symbols of the rule which action triggered + this YYABORT or YYACCEPT. */ + YYPOPSTACK (yylen); + YY_STACK_PRINT (yyss, yyssp); + while (yyssp != yyss) + { + yydestruct ("Cleanup: popping", + yystos[*yyssp], yyvsp); + YYPOPSTACK (1); + } +#ifndef yyoverflow + if (yyss != yyssa) + YYSTACK_FREE (yyss); +#endif +#if YYERROR_VERBOSE + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); +#endif + /* Make sure YYID is used. */ + return YYID (yyresult); +} + + + diff --git a/xorg-server/hw/dmx/config/parser.h b/xorg-server/hw/dmx/config/parser.h new file mode 100644 index 000000000..1c9fde16c --- /dev/null +++ b/xorg-server/hw/dmx/config/parser.h @@ -0,0 +1,99 @@ +/* A Bison parser, made by GNU Bison 2.3. */ + +/* Skeleton interface for Bison's Yacc-like parsers in C + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + T_VIRTUAL = 258, + T_DISPLAY = 259, + T_WALL = 260, + T_OPTION = 261, + T_PARAM = 262, + T_STRING = 263, + T_DIMENSION = 264, + T_OFFSET = 265, + T_ORIGIN = 266, + T_COMMENT = 267, + T_LINE_COMMENT = 268 + }; +#endif +/* Tokens. */ +#define T_VIRTUAL 258 +#define T_DISPLAY 259 +#define T_WALL 260 +#define T_OPTION 261 +#define T_PARAM 262 +#define T_STRING 263 +#define T_DIMENSION 264 +#define T_OFFSET 265 +#define T_ORIGIN 266 +#define T_COMMENT 267 +#define T_LINE_COMMENT 268 + + + + +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED +typedef union YYSTYPE +#line 56 "parser.y" +{ + DMXConfigTokenPtr token; + DMXConfigStringPtr string; + DMXConfigNumberPtr number; + DMXConfigPairPtr pair; + DMXConfigFullDimPtr fdim; + DMXConfigPartDimPtr pdim; + DMXConfigDisplayPtr display; + DMXConfigWallPtr wall; + DMXConfigOptionPtr option; + DMXConfigParamPtr param; + DMXConfigCommentPtr comment; + DMXConfigSubPtr subentry; + DMXConfigVirtualPtr virtual; + DMXConfigEntryPtr entry; +} +/* Line 1489 of yacc.c. */ +#line 92 "parser.h" + YYSTYPE; +# define yystype YYSTYPE /* obsolescent; will be withdrawn */ +# define YYSTYPE_IS_DECLARED 1 +# define YYSTYPE_IS_TRIVIAL 1 +#endif + +extern YYSTYPE yylval; + diff --git a/xorg-server/hw/dmx/config/parser.y b/xorg-server/hw/dmx/config/parser.y new file mode 100644 index 000000000..ac2441017 --- /dev/null +++ b/xorg-server/hw/dmx/config/parser.y @@ -0,0 +1,226 @@ +/* $XFree86$ */ +/* + * Copyright 2002-2003 Red Hat Inc., Durham, North Carolina. + * + * 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 on 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 + * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR 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. + */ + +/* + * Authors: + * Rickard E. (Rik) Faith <faith@redhat.com> + * + */ + +%{ +#ifdef HAVE_DMX_CONFIG_H +#include <dmx-config.h> +#endif + +#include "dmxparse.h" +#include <string.h> +#include <stdlib.h> +#define YYDEBUG 1 +#define YYERROR_VERBOSE +#define YY_USE_PROTOS + +DMXConfigEntryPtr dmxConfigEntry = NULL; +#define APPEND(type, h, t) \ +{ \ + type pt; \ + for (pt = h; pt->next; pt = pt->next); \ + pt->next = t; \ +} +%} + +%union { + DMXConfigTokenPtr token; + DMXConfigStringPtr string; + DMXConfigNumberPtr number; + DMXConfigPairPtr pair; + DMXConfigFullDimPtr fdim; + DMXConfigPartDimPtr pdim; + DMXConfigDisplayPtr display; + DMXConfigWallPtr wall; + DMXConfigOptionPtr option; + DMXConfigParamPtr param; + DMXConfigCommentPtr comment; + DMXConfigSubPtr subentry; + DMXConfigVirtualPtr virtual; + DMXConfigEntryPtr entry; +} + + /* Terminals */ +%token <token> '{' '}' ';' '/' T_VIRTUAL T_DISPLAY T_WALL T_OPTION T_PARAM +%token <string> T_STRING +%token <pair> T_DIMENSION T_OFFSET T_ORIGIN +%token <comment> T_COMMENT T_LINE_COMMENT + + /* Non-termials */ +%type <token> Display Wall Terminal Open Close +%type <string> NameList Name +%type <pair> Dimension Offset Origin +%type <pdim> PartialDim +%type <fdim> FullDim +%type <display> DisplayEntry +%type <option> OptionEntry +%type <param> ParamEntry ParamList Param +%type <subentry> SubList Sub +%type <wall> WallEntry +%type <virtual> Virtual +%type <entry> Program EntryList Entry + +%% + +Program : EntryList { dmxConfigEntry = $1; } + ; + +EntryList : Entry + | EntryList Entry { APPEND(DMXConfigEntryPtr,$1,$2); $$ = $1; } + ; + +Entry : Virtual { $$ = dmxConfigEntryVirtual($1); } + | T_LINE_COMMENT { $$ = dmxConfigEntryComment($1); } + ; + +Virtual : T_VIRTUAL Open SubList Close + { $$ = dmxConfigCreateVirtual($1, NULL, NULL, $2, $3, $4); } + | T_VIRTUAL Dimension Open SubList Close + { $$ = dmxConfigCreateVirtual($1, NULL, $2, $3, $4, $5); } + | T_VIRTUAL Name Open SubList Close + { $$ = dmxConfigCreateVirtual($1, $2, NULL, $3, $4, $5); } + | T_VIRTUAL Name Dimension Open SubList Close + { $$ = dmxConfigCreateVirtual($1, $2, $3, $4, $5, $6 ); } + ; + +SubList : Sub + | SubList Sub { APPEND(DMXConfigSubPtr,$1,$2); $$ = $1; } + ; + +Sub : T_LINE_COMMENT { $$ = dmxConfigSubComment($1); } + | DisplayEntry { $$ = dmxConfigSubDisplay($1); } + | WallEntry { $$ = dmxConfigSubWall($1); } + | OptionEntry { $$ = dmxConfigSubOption($1); } + | ParamEntry { $$ = dmxConfigSubParam($1); } + ; + +OptionEntry : T_OPTION NameList Terminal + { $$ = dmxConfigCreateOption($1, $2, $3); } + ; + +ParamEntry : T_PARAM NameList Terminal + { $$ = dmxConfigCreateParam($1, NULL, $2, NULL, $3); } + | T_PARAM Open ParamList Close + { $$ = dmxConfigCreateParam($1, $2, NULL, $4, NULL); + $$->next = $3; + } + ; + +ParamList : Param + | ParamList Param { APPEND(DMXConfigParamPtr,$1,$2); $$ = $1; } + ; + +Param : NameList Terminal + { $$ = dmxConfigCreateParam(NULL, NULL, $1, NULL, $2); } + ; + +PartialDim : Dimension Offset + { $$ = dmxConfigCreatePartDim($1, $2); } + | Dimension + { $$ = dmxConfigCreatePartDim($1, NULL); } + | Offset + { $$ = dmxConfigCreatePartDim(NULL, $1); } + ; + +FullDim : PartialDim '/' PartialDim + { $$ = dmxConfigCreateFullDim($1, $3); } + | '/' PartialDim + { $$ = dmxConfigCreateFullDim(NULL, $2); } + | PartialDim + { $$ = dmxConfigCreateFullDim($1, NULL); } + ; + +DisplayEntry : Display Name FullDim Origin Terminal + { $$ = dmxConfigCreateDisplay($1, $2, $3, $4, $5); } + | Display FullDim Origin Terminal + { $$ = dmxConfigCreateDisplay($1, NULL, $2, $3, $4); } + | Display Name Origin Terminal + { $$ = dmxConfigCreateDisplay($1, $2, NULL, $3, $4); } + + | Display Name FullDim Terminal + { $$ = dmxConfigCreateDisplay($1, $2, $3, NULL, $4); } + | Display FullDim Terminal + { $$ = dmxConfigCreateDisplay($1, NULL, $2, NULL, $3); } + | Display Name Terminal + { $$ = dmxConfigCreateDisplay($1, $2, NULL, NULL, $3); } + | Display Terminal + { $$ = dmxConfigCreateDisplay($1, NULL, NULL, NULL, $2); } + ; + +WallEntry : Wall Dimension Dimension NameList Terminal + { $$ = dmxConfigCreateWall($1, $2, $3, $4, $5); } + | Wall Dimension NameList Terminal + { $$ = dmxConfigCreateWall($1, $2, NULL, $3, $4); } + | Wall NameList Terminal + { $$ = dmxConfigCreateWall($1, NULL, NULL, $2, $3); } + ; + +Display : T_DISPLAY + | T_DISPLAY T_COMMENT { $$ = $1; $$->comment = $2->comment; } + ; + +Name : T_STRING + | T_STRING T_COMMENT { $$ = $1; $$->comment = $2->comment; } + ; + +Dimension : T_DIMENSION + | T_DIMENSION T_COMMENT { $$ = $1; $$->comment = $2->comment; } + ; + +Offset : T_OFFSET + | T_OFFSET T_COMMENT { $$ = $1; $$->comment = $2->comment; } + ; + +Origin : T_ORIGIN + | T_ORIGIN T_COMMENT { $$ = $1; $$->comment = $2->comment; } + ; + +Terminal : ';' + | ';' T_COMMENT { $$ = $1; $$->comment = $2->comment; } + ; + +Open : '{' + | '{' T_COMMENT { $$ = $1; $$->comment = $2->comment; } + ; + +Close : '}' + | '}' T_COMMENT { $$ = $1; $$->comment = $2->comment; } + ; + +Wall : T_WALL + | T_WALL T_COMMENT { $$ = $1; $$->comment = $2->comment; } + ; + +NameList : Name + | NameList Name { APPEND(DMXConfigStringPtr, $1, $2); $$ = $1; } + ; diff --git a/xorg-server/hw/dmx/config/scanner.c b/xorg-server/hw/dmx/config/scanner.c new file mode 100644 index 000000000..d6b44b162 --- /dev/null +++ b/xorg-server/hw/dmx/config/scanner.c @@ -0,0 +1,2028 @@ + +#line 3 "scanner.c" + +#define YY_INT_ALIGNED short int + +/* A lexical scanner generated by flex */ + +#define FLEX_SCANNER +#define YY_FLEX_MAJOR_VERSION 2 +#define YY_FLEX_MINOR_VERSION 5 +#define YY_FLEX_SUBMINOR_VERSION 35 +#if YY_FLEX_SUBMINOR_VERSION > 0 +#define FLEX_BETA +#endif + +/* First, we deal with platform-specific or compiler-specific issues. */ + +/* begin standard C headers. */ +#include <stdio.h> +#include <string.h> +#include <errno.h> +#include <stdlib.h> + +/* end standard C headers. */ + +/* flex integer type definitions */ + +#ifndef FLEXINT_H +#define FLEXINT_H + +/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */ + +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + +/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, + * if you want the limit (max/min) macros for int types. + */ +#ifndef __STDC_LIMIT_MACROS +#define __STDC_LIMIT_MACROS 1 +#endif + +#include <inttypes.h> +typedef int8_t flex_int8_t; +typedef uint8_t flex_uint8_t; +typedef int16_t flex_int16_t; +typedef uint16_t flex_uint16_t; +typedef int32_t flex_int32_t; +typedef uint32_t flex_uint32_t; +#else +typedef signed char flex_int8_t; +typedef short int flex_int16_t; +typedef int flex_int32_t; +typedef unsigned char flex_uint8_t; +typedef unsigned short int flex_uint16_t; +typedef unsigned int flex_uint32_t; +#endif /* ! C99 */ + +/* Limits of integral types. */ +#ifndef INT8_MIN +#define INT8_MIN (-128) +#endif +#ifndef INT16_MIN +#define INT16_MIN (-32767-1) +#endif +#ifndef INT32_MIN +#define INT32_MIN (-2147483647-1) +#endif +#ifndef INT8_MAX +#define INT8_MAX (127) +#endif +#ifndef INT16_MAX +#define INT16_MAX (32767) +#endif +#ifndef INT32_MAX +#define INT32_MAX (2147483647) +#endif +#ifndef UINT8_MAX +#define UINT8_MAX (255U) +#endif +#ifndef UINT16_MAX +#define UINT16_MAX (65535U) +#endif +#ifndef UINT32_MAX +#define UINT32_MAX (4294967295U) +#endif + +#endif /* ! FLEXINT_H */ + +#ifdef __cplusplus + +/* The "const" storage-class-modifier is valid. */ +#define YY_USE_CONST + +#else /* ! __cplusplus */ + +/* C99 requires __STDC__ to be defined as 1. */ +#if defined (__STDC__) + +#define YY_USE_CONST + +#endif /* defined (__STDC__) */ +#endif /* ! __cplusplus */ + +#ifdef YY_USE_CONST +#define yyconst const +#else +#define yyconst +#endif + +/* Returned upon end-of-file. */ +#define YY_NULL 0 + +/* Promotes a possibly negative, possibly signed char to an unsigned + * integer for use as an array index. If the signed char is negative, + * we want to instead treat it as an 8-bit unsigned char, hence the + * double cast. + */ +#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) + +/* Enter a start condition. This macro really ought to take a parameter, + * but we do it the disgusting crufty way forced on us by the ()-less + * definition of BEGIN. + */ +#define BEGIN (yy_start) = 1 + 2 * + +/* Translate the current start state into a value that can be later handed + * to BEGIN to return to the state. The YYSTATE alias is for lex + * compatibility. + */ +#define YY_START (((yy_start) - 1) / 2) +#define YYSTATE YY_START + +/* Action number for EOF rule of a given start state. */ +#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) + +/* Special action meaning "start processing a new file". */ +#define YY_NEW_FILE yyrestart(yyin ) + +#define YY_END_OF_BUFFER_CHAR 0 + +/* Size of default input buffer. */ +#ifndef YY_BUF_SIZE +#define YY_BUF_SIZE 16384 +#endif + +/* The state buf must be large enough to hold one state per character in the main buffer. + */ +#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) + +#ifndef YY_TYPEDEF_YY_BUFFER_STATE +#define YY_TYPEDEF_YY_BUFFER_STATE +typedef struct yy_buffer_state *YY_BUFFER_STATE; +#endif + +extern int yyleng; + +extern FILE *yyin, *yyout; + +#define EOB_ACT_CONTINUE_SCAN 0 +#define EOB_ACT_END_OF_FILE 1 +#define EOB_ACT_LAST_MATCH 2 + + #define YY_LESS_LINENO(n) + +/* Return all but the first "n" matched characters back to the input stream. */ +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + *yy_cp = (yy_hold_char); \ + YY_RESTORE_YY_MORE_OFFSET \ + (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ + YY_DO_BEFORE_ACTION; /* set up yytext again */ \ + } \ + while ( 0 ) + +#define unput(c) yyunput( c, (yytext_ptr) ) + +#ifndef YY_TYPEDEF_YY_SIZE_T +#define YY_TYPEDEF_YY_SIZE_T +typedef size_t yy_size_t; +#endif + +#ifndef YY_STRUCT_YY_BUFFER_STATE +#define YY_STRUCT_YY_BUFFER_STATE +struct yy_buffer_state + { + FILE *yy_input_file; + + char *yy_ch_buf; /* input buffer */ + char *yy_buf_pos; /* current position in input buffer */ + + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ + yy_size_t yy_buf_size; + + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ + int yy_n_chars; + + /* Whether we "own" the buffer - i.e., we know we created it, + * and can realloc() it to grow it, and should free() it to + * delete it. + */ + int yy_is_our_buffer; + + /* Whether this is an "interactive" input source; if so, and + * if we're using stdio for input, then we want to use getc() + * instead of fread(), to make sure we stop fetching input after + * each newline. + */ + int yy_is_interactive; + + /* Whether we're considered to be at the beginning of a line. + * If so, '^' rules will be active on the next match, otherwise + * not. + */ + int yy_at_bol; + + int yy_bs_lineno; /**< The line count. */ + int yy_bs_column; /**< The column count. */ + + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int yy_fill_buffer; + + int yy_buffer_status; + +#define YY_BUFFER_NEW 0 +#define YY_BUFFER_NORMAL 1 + /* When an EOF's been seen but there's still some text to process + * then we mark the buffer as YY_EOF_PENDING, to indicate that we + * shouldn't try reading from the input source any more. We might + * still have a bunch of tokens to match, though, because of + * possible backing-up. + * + * When we actually see the EOF, we change the status to "new" + * (via yyrestart()), so that the user can continue scanning by + * just pointing yyin at a new input file. + */ +#define YY_BUFFER_EOF_PENDING 2 + + }; +#endif /* !YY_STRUCT_YY_BUFFER_STATE */ + +/* Stack of input buffers. */ +static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ +static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ +static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ + +/* We provide macros for accessing buffer states in case in the + * future we want to put the buffer states in a more general + * "scanner state". + * + * Returns the top of the stack, or NULL. + */ +#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ + ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ + : NULL) + +/* Same as previous macro, but useful when we know that the buffer stack is not + * NULL or when we need an lvalue. For internal use only. + */ +#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] + +/* yy_hold_char holds the character lost when yytext is formed. */ +static char yy_hold_char; +static int yy_n_chars; /* number of characters read into yy_ch_buf */ +int yyleng; + +/* Points to current character in buffer. */ +static char *yy_c_buf_p = (char *) 0; +static int yy_init = 0; /* whether we need to initialize */ +static int yy_start = 0; /* start state number */ + +/* Flag which is used to allow yywrap()'s to do buffer switches + * instead of setting up a fresh yyin. A bit of a hack ... + */ +static int yy_did_buffer_switch_on_eof; + +void yyrestart (FILE *input_file ); +void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ); +YY_BUFFER_STATE yy_create_buffer (FILE *file,int size ); +void yy_delete_buffer (YY_BUFFER_STATE b ); +void yy_flush_buffer (YY_BUFFER_STATE b ); +void yypush_buffer_state (YY_BUFFER_STATE new_buffer ); +void yypop_buffer_state (void ); + +static void yyensure_buffer_stack (void ); +static void yy_load_buffer_state (void ); +static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ); + +#define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER ) + +YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ); +YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ); +YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len ); + +void *yyalloc (yy_size_t ); +void *yyrealloc (void *,yy_size_t ); +void yyfree (void * ); + +#define yy_new_buffer yy_create_buffer + +#define yy_set_interactive(is_interactive) \ + { \ + if ( ! YY_CURRENT_BUFFER ){ \ + yyensure_buffer_stack (); \ + YY_CURRENT_BUFFER_LVALUE = \ + yy_create_buffer(yyin,YY_BUF_SIZE ); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ + } + +#define yy_set_bol(at_bol) \ + { \ + if ( ! YY_CURRENT_BUFFER ){\ + yyensure_buffer_stack (); \ + YY_CURRENT_BUFFER_LVALUE = \ + yy_create_buffer(yyin,YY_BUF_SIZE ); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ + } + +#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) + +/* Begin user sect3 */ + +typedef unsigned char YY_CHAR; + +FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; + +typedef int yy_state_type; + +extern int yylineno; + +int yylineno = 1; + +extern char *yytext; +#define yytext_ptr yytext + +static yy_state_type yy_get_previous_state (void ); +static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); +static int yy_get_next_buffer (void ); +static void yy_fatal_error (yyconst char msg[] ); + +/* Done after the current pattern has been matched and before the + * corresponding action - sets up yytext. + */ +#define YY_DO_BEFORE_ACTION \ + (yytext_ptr) = yy_bp; \ + yyleng = (size_t) (yy_cp - yy_bp); \ + (yy_hold_char) = *yy_cp; \ + *yy_cp = '\0'; \ + (yy_c_buf_p) = yy_cp; + +#define YY_NUM_RULES 20 +#define YY_END_OF_BUFFER 21 +/* This struct is not used in this scanner, + but its presence is necessary. */ +struct yy_trans_info + { + flex_int32_t yy_verify; + flex_int32_t yy_nxt; + }; +static yyconst flex_int16_t yy_accept[73] = + { 0, + 0, 0, 0, 0, 21, 19, 12, 11, 19, 18, + 19, 19, 16, 19, 15, 19, 19, 19, 19, 19, + 19, 13, 14, 17, 12, 0, 10, 18, 9, 9, + 0, 0, 0, 0, 0, 9, 9, 9, 9, 9, + 17, 0, 9, 0, 6, 0, 0, 9, 9, 9, + 9, 9, 0, 0, 7, 8, 9, 9, 9, 9, + 3, 7, 9, 9, 5, 9, 9, 4, 9, 2, + 1, 0 + } ; + +static yyconst flex_int32_t yy_ec[256] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 2, 1, 4, 5, 1, 1, 1, 1, 1, + 1, 6, 7, 1, 7, 6, 8, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 9, 6, 10, 1, + 1, 1, 1, 11, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 1, 1, 1, 1, 6, 1, 12, 6, 6, 13, + + 6, 6, 6, 6, 14, 6, 6, 15, 16, 17, + 18, 19, 6, 20, 21, 22, 23, 24, 25, 26, + 27, 6, 28, 1, 29, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1 + } ; + +static yyconst flex_int32_t yy_meta[30] = + { 0, + 1, 1, 2, 1, 1, 3, 3, 3, 3, 1, + 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 1, 1 + } ; + +static yyconst flex_int16_t yy_base[77] = + { 0, + 0, 101, 0, 100, 104, 107, 101, 107, 98, 0, + 0, 92, 0, 28, 107, 29, 86, 80, 86, 83, + 84, 107, 107, 0, 93, 90, 89, 0, 0, 32, + 30, 31, 33, 34, 42, 71, 69, 70, 69, 73, + 0, 43, 44, 46, 78, 45, 77, 66, 70, 71, + 60, 66, 50, 56, 70, 67, 58, 52, 53, 44, + 0, 57, 52, 46, 0, 50, 34, 0, 45, 0, + 0, 107, 71, 74, 46, 77 + } ; + +static yyconst flex_int16_t yy_def[77] = + { 0, + 72, 1, 1, 1, 72, 72, 72, 72, 73, 74, + 75, 75, 75, 72, 72, 72, 75, 75, 75, 75, + 75, 72, 72, 76, 72, 73, 72, 74, 75, 75, + 72, 72, 72, 72, 72, 75, 75, 75, 75, 75, + 76, 72, 75, 72, 72, 72, 72, 75, 75, 75, + 75, 75, 72, 72, 75, 72, 75, 75, 75, 75, + 75, 72, 75, 75, 75, 75, 75, 75, 75, 75, + 75, 0, 72, 72, 72, 72 + } ; + +static yyconst flex_int16_t yy_nxt[137] = + { 0, + 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 11, 17, 11, 11, 11, 11, 18, 19, 11, + 11, 11, 11, 20, 21, 11, 11, 22, 23, 31, + 34, 31, 31, 42, 44, 34, 32, 35, 43, 32, + 30, 45, 35, 46, 42, 54, 46, 44, 29, 53, + 35, 54, 55, 33, 45, 33, 33, 54, 62, 71, + 70, 69, 68, 67, 62, 62, 66, 47, 65, 64, + 47, 26, 63, 26, 28, 56, 28, 41, 55, 41, + 61, 60, 59, 58, 57, 56, 45, 52, 51, 50, + 49, 48, 26, 27, 25, 40, 39, 38, 37, 36, + + 30, 27, 25, 72, 24, 24, 5, 72, 72, 72, + 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, + 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, + 72, 72, 72, 72, 72, 72 + } ; + +static yyconst flex_int16_t yy_chk[137] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 14, + 16, 31, 32, 30, 33, 34, 14, 16, 30, 32, + 30, 33, 34, 35, 42, 43, 46, 44, 75, 42, + 35, 53, 43, 14, 44, 31, 32, 54, 53, 69, + 67, 66, 64, 63, 54, 62, 60, 35, 59, 58, + 46, 73, 57, 73, 74, 56, 74, 76, 55, 76, + 52, 51, 50, 49, 48, 47, 45, 40, 39, 38, + 37, 36, 27, 26, 25, 21, 20, 19, 18, 17, + + 12, 9, 7, 5, 4, 2, 72, 72, 72, 72, + 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, + 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, + 72, 72, 72, 72, 72, 72 + } ; + +static yy_state_type yy_last_accepting_state; +static char *yy_last_accepting_cpos; + +extern int yy_flex_debug; +int yy_flex_debug = 0; + +/* The intent behind this definition is that it'll catch + * any uses of REJECT which flex missed. + */ +#define REJECT reject_used_but_not_detected +#define yymore() yymore_used_but_not_detected +#define YY_MORE_ADJ 0 +#define YY_RESTORE_YY_MORE_OFFSET +char *yytext; +#line 1 "scanner.l" +/* $XFree86$ */ +/* + * Copyright 2002 Red Hat Inc., Durham, North Carolina. + * + * 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 on 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 + * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR 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. + */ +/* + * Authors: + * Rickard E. (Rik) Faith <faith@redhat.com> + * + */ +#line 36 "scanner.l" +#ifdef HAVE_DMX_CONFIG_H +#include <dmx-config.h> +#endif + +#include "dmxparse.h" +#include "parser.h" +#include <string.h> +#include <stdlib.h> +#include <ctype.h> +static int getdimension(int token, const char *text, int leng); +static int getstring(int token, const char *text, int leng); +static int gettoken(int token, const char *text, int leng); +static int getcomment(int token, const char *text, int leng); +static int lineno = 1; + +#line 548 "scanner.c" + +#define INITIAL 0 +#define OTHER 1 + +#ifndef YY_NO_UNISTD_H +/* Special case for "unistd.h", since it is non-ANSI. We include it way + * down here because we want the user's section 1 to have been scanned first. + * The user has a chance to override it with an option. + */ +#include <unistd.h> +#endif + +#ifndef YY_EXTRA_TYPE +#define YY_EXTRA_TYPE void * +#endif + +static int yy_init_globals (void ); + +/* Accessor methods to globals. + These are made visible to non-reentrant scanners for convenience. */ + +int yylex_destroy (void ); + +int yyget_debug (void ); + +void yyset_debug (int debug_flag ); + +YY_EXTRA_TYPE yyget_extra (void ); + +void yyset_extra (YY_EXTRA_TYPE user_defined ); + +FILE *yyget_in (void ); + +void yyset_in (FILE * in_str ); + +FILE *yyget_out (void ); + +void yyset_out (FILE * out_str ); + +int yyget_leng (void ); + +char *yyget_text (void ); + +int yyget_lineno (void ); + +void yyset_lineno (int line_number ); + +/* Macros after this point can all be overridden by user definitions in + * section 1. + */ + +#ifndef YY_SKIP_YYWRAP +#ifdef __cplusplus +extern "C" int yywrap (void ); +#else +extern int yywrap (void ); +#endif +#endif + + static void yyunput (int c,char *buf_ptr ); + +#ifndef yytext_ptr +static void yy_flex_strncpy (char *,yyconst char *,int ); +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen (yyconst char * ); +#endif + +#ifndef YY_NO_INPUT + +#ifdef __cplusplus +static int yyinput (void ); +#else +static int input (void ); +#endif + +#endif + +/* Amount of stuff to slurp up with each read. */ +#ifndef YY_READ_BUF_SIZE +#define YY_READ_BUF_SIZE 8192 +#endif + +/* Copy whatever the last rule matched to the standard output. */ +#ifndef ECHO +/* This used to be an fputs(), but since the string might contain NUL's, + * we now use fwrite(). + */ +#define ECHO fwrite( yytext, yyleng, 1, yyout ) +#endif + +/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, + * is returned in "result". + */ +#ifndef YY_INPUT +#define YY_INPUT(buf,result,max_size) \ + if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ + { \ + int c = '*'; \ + int n; \ + for ( n = 0; n < max_size && \ + (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ + buf[n] = (char) c; \ + if ( c == '\n' ) \ + buf[n++] = (char) c; \ + if ( c == EOF && ferror( yyin ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + result = n; \ + } \ + else \ + { \ + errno=0; \ + while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ + { \ + if( errno != EINTR) \ + { \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + break; \ + } \ + errno=0; \ + clearerr(yyin); \ + } \ + }\ +\ + +#endif + +/* No semi-colon after return; correct usage is to write "yyterminate();" - + * we don't want an extra ';' after the "return" because that will cause + * some compilers to complain about unreachable statements. + */ +#ifndef yyterminate +#define yyterminate() return YY_NULL +#endif + +/* Number of entries by which start-condition stack grows. */ +#ifndef YY_START_STACK_INCR +#define YY_START_STACK_INCR 25 +#endif + +/* Report a fatal error. */ +#ifndef YY_FATAL_ERROR +#define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) +#endif + +/* end tables serialization structures and prototypes */ + +/* Default declaration of generated scanner - a define so the user can + * easily add parameters. + */ +#ifndef YY_DECL +#define YY_DECL_IS_OURS 1 + +extern int yylex (void); + +#define YY_DECL int yylex (void) +#endif /* !YY_DECL */ + +/* Code executed at the beginning of each rule, after yytext and yyleng + * have been set up. + */ +#ifndef YY_USER_ACTION +#define YY_USER_ACTION +#endif + +/* Code executed at the end of each rule. */ +#ifndef YY_BREAK +#define YY_BREAK break; +#endif + +#define YY_RULE_SETUP \ + if ( yyleng > 0 ) \ + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \ + (yytext[yyleng - 1] == '\n'); \ + YY_USER_ACTION + +/** The main scanner function which does all the work. + */ +YY_DECL +{ + register yy_state_type yy_current_state; + register char *yy_cp, *yy_bp; + register int yy_act; + +#line 62 "scanner.l" + +#line 736 "scanner.c" + + if ( !(yy_init) ) + { + (yy_init) = 1; + +#ifdef YY_USER_INIT + YY_USER_INIT; +#endif + + if ( ! (yy_start) ) + (yy_start) = 1; /* first start state */ + + if ( ! yyin ) + yyin = stdin; + + if ( ! yyout ) + yyout = stdout; + + if ( ! YY_CURRENT_BUFFER ) { + yyensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + yy_create_buffer(yyin,YY_BUF_SIZE ); + } + + yy_load_buffer_state( ); + } + + while ( 1 ) /* loops until end-of-file is reached */ + { + yy_cp = (yy_c_buf_p); + + /* Support of yytext. */ + *yy_cp = (yy_hold_char); + + /* yy_bp points to the position in yy_ch_buf of the start of + * the current run. + */ + yy_bp = yy_cp; + + yy_current_state = (yy_start); + yy_current_state += YY_AT_BOL(); +yy_match: + do + { + register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 73 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + ++yy_cp; + } + while ( yy_base[yy_current_state] != 107 ); + +yy_find_action: + yy_act = yy_accept[yy_current_state]; + if ( yy_act == 0 ) + { /* have to back up */ + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); + yy_act = yy_accept[yy_current_state]; + } + + YY_DO_BEFORE_ACTION; + +do_action: /* This label is used only to access EOF actions. */ + + switch ( yy_act ) + { /* beginning of action switch */ + case 0: /* must back up */ + /* undo the effects of YY_DO_BEFORE_ACTION */ + *yy_cp = (yy_hold_char); + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); + goto yy_find_action; + +case 1: +YY_RULE_SETUP +#line 63 "scanner.l" +return gettoken(T_VIRTUAL, yytext, yyleng); + YY_BREAK +case 2: +YY_RULE_SETUP +#line 64 "scanner.l" +return gettoken(T_DISPLAY, yytext, yyleng); + YY_BREAK +case 3: +YY_RULE_SETUP +#line 65 "scanner.l" +return gettoken(T_WALL, yytext, yyleng); + YY_BREAK +case 4: +YY_RULE_SETUP +#line 66 "scanner.l" +return gettoken(T_OPTION, yytext, yyleng); + YY_BREAK +case 5: +YY_RULE_SETUP +#line 67 "scanner.l" +return gettoken(T_PARAM, yytext, yyleng); + YY_BREAK +case 6: +YY_RULE_SETUP +#line 68 "scanner.l" +return getdimension(T_DIMENSION, yytext, yyleng); + YY_BREAK +case 7: +YY_RULE_SETUP +#line 69 "scanner.l" +return getdimension(T_OFFSET, yytext+1, yyleng-1); + YY_BREAK +case 8: +YY_RULE_SETUP +#line 70 "scanner.l" +return getdimension(T_ORIGIN, yytext+1, yyleng-1); + YY_BREAK +case 9: +YY_RULE_SETUP +#line 71 "scanner.l" +return getstring(T_STRING, yytext, yyleng); + YY_BREAK +case 10: +YY_RULE_SETUP +#line 72 "scanner.l" +return getstring(T_STRING, yytext+1, yyleng-2); + YY_BREAK +case 11: +/* rule 11 can match eol */ +YY_RULE_SETUP +#line 73 "scanner.l" +++lineno; + YY_BREAK +case 12: +YY_RULE_SETUP +#line 74 "scanner.l" + + YY_BREAK +case 13: +YY_RULE_SETUP +#line 75 "scanner.l" +return gettoken(yytext[0], yytext, yyleng); + YY_BREAK +case 14: +YY_RULE_SETUP +#line 76 "scanner.l" +return gettoken(yytext[0], yytext, yyleng); + YY_BREAK +case 15: +YY_RULE_SETUP +#line 77 "scanner.l" +return gettoken(yytext[0], yytext, yyleng); + YY_BREAK +case 16: +YY_RULE_SETUP +#line 78 "scanner.l" +return gettoken(yytext[0], yytext, yyleng); + YY_BREAK +case 17: +YY_RULE_SETUP +#line 79 "scanner.l" +return getcomment(T_LINE_COMMENT, yytext, yyleng); + YY_BREAK +case 18: +YY_RULE_SETUP +#line 80 "scanner.l" +return getcomment(T_COMMENT, yytext, yyleng); + YY_BREAK +case 19: +YY_RULE_SETUP +#line 81 "scanner.l" +return getstring(T_STRING, yytext, yyleng); + YY_BREAK +case YY_STATE_EOF(INITIAL): +case YY_STATE_EOF(OTHER): +#line 82 "scanner.l" +return 0; + YY_BREAK +case 20: +YY_RULE_SETUP +#line 83 "scanner.l" +ECHO; + YY_BREAK +#line 926 "scanner.c" + + case YY_END_OF_BUFFER: + { + /* Amount of text matched not including the EOB char. */ + int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; + + /* Undo the effects of YY_DO_BEFORE_ACTION. */ + *yy_cp = (yy_hold_char); + YY_RESTORE_YY_MORE_OFFSET + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) + { + /* We're scanning a new file or input source. It's + * possible that this happened because the user + * just pointed yyin at a new source and called + * yylex(). If so, then we have to assure + * consistency between YY_CURRENT_BUFFER and our + * globals. Here is the right place to do so, because + * this is the first action (other than possibly a + * back-up) that will match for the new input source. + */ + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; + } + + /* Note that here we test for yy_c_buf_p "<=" to the position + * of the first EOB in the buffer, since yy_c_buf_p will + * already have been incremented past the NUL character + * (since all states make transitions on EOB to the + * end-of-buffer state). Contrast this with the test + * in input(). + */ + if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) + { /* This was really a NUL. */ + yy_state_type yy_next_state; + + (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( ); + + /* Okay, we're now positioned to make the NUL + * transition. We couldn't have + * yy_get_previous_state() go ahead and do it + * for us because it doesn't know how to deal + * with the possibility of jamming (and we don't + * want to build jamming into it because then it + * will run more slowly). + */ + + yy_next_state = yy_try_NUL_trans( yy_current_state ); + + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + + if ( yy_next_state ) + { + /* Consume the NUL. */ + yy_cp = ++(yy_c_buf_p); + yy_current_state = yy_next_state; + goto yy_match; + } + + else + { + yy_cp = (yy_c_buf_p); + goto yy_find_action; + } + } + + else switch ( yy_get_next_buffer( ) ) + { + case EOB_ACT_END_OF_FILE: + { + (yy_did_buffer_switch_on_eof) = 0; + + if ( yywrap( ) ) + { + /* Note: because we've taken care in + * yy_get_next_buffer() to have set up + * yytext, we can now set up + * yy_c_buf_p so that if some total + * hoser (like flex itself) wants to + * call the scanner after we return the + * YY_NULL, it'll still work - another + * YY_NULL will get returned. + */ + (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; + + yy_act = YY_STATE_EOF(YY_START); + goto do_action; + } + + else + { + if ( ! (yy_did_buffer_switch_on_eof) ) + YY_NEW_FILE; + } + break; + } + + case EOB_ACT_CONTINUE_SCAN: + (yy_c_buf_p) = + (yytext_ptr) + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( ); + + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + goto yy_match; + + case EOB_ACT_LAST_MATCH: + (yy_c_buf_p) = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; + + yy_current_state = yy_get_previous_state( ); + + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + goto yy_find_action; + } + break; + } + + default: + YY_FATAL_ERROR( + "fatal flex scanner internal error--no action found" ); + } /* end of action switch */ + } /* end of scanning one token */ +} /* end of yylex */ + +/* yy_get_next_buffer - try to read in a new buffer + * + * Returns a code representing an action: + * EOB_ACT_LAST_MATCH - + * EOB_ACT_CONTINUE_SCAN - continue scanning from current position + * EOB_ACT_END_OF_FILE - end of file + */ +static int yy_get_next_buffer (void) +{ + register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + register char *source = (yytext_ptr); + register int number_to_move, i; + int ret_val; + + if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) + YY_FATAL_ERROR( + "fatal flex scanner internal error--end of buffer missed" ); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) + { /* Don't try to fill the buffer, so this is an EOF. */ + if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) + { + /* We matched a single character, the EOB, so + * treat this as a final EOF. + */ + return EOB_ACT_END_OF_FILE; + } + + else + { + /* We matched some text prior to the EOB, first + * process it. + */ + return EOB_ACT_LAST_MATCH; + } + } + + /* Try to read more data. */ + + /* First move last chars to start of buffer. */ + number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; + + for ( i = 0; i < number_to_move; ++i ) + *(dest++) = *(source++); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) + /* don't do the read, it's not guaranteed to return an EOF, + * just force an EOF + */ + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; + + else + { + int num_to_read = + YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; + + while ( num_to_read <= 0 ) + { /* Not enough room in the buffer - grow it. */ + + /* just a shorter name for the current buffer */ + YY_BUFFER_STATE b = YY_CURRENT_BUFFER; + + int yy_c_buf_p_offset = + (int) ((yy_c_buf_p) - b->yy_ch_buf); + + if ( b->yy_is_our_buffer ) + { + int new_size = b->yy_buf_size * 2; + + if ( new_size <= 0 ) + b->yy_buf_size += b->yy_buf_size / 8; + else + b->yy_buf_size *= 2; + + b->yy_ch_buf = (char *) + /* Include room in for 2 EOB chars. */ + yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); + } + else + /* Can't grow it, we don't own it. */ + b->yy_ch_buf = 0; + + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( + "fatal error - scanner input buffer overflow" ); + + (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; + + num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - + number_to_move - 1; + + } + + if ( num_to_read > YY_READ_BUF_SIZE ) + num_to_read = YY_READ_BUF_SIZE; + + /* Read in more data. */ + YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), + (yy_n_chars), (size_t) num_to_read ); + + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + if ( (yy_n_chars) == 0 ) + { + if ( number_to_move == YY_MORE_ADJ ) + { + ret_val = EOB_ACT_END_OF_FILE; + yyrestart(yyin ); + } + + else + { + ret_val = EOB_ACT_LAST_MATCH; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = + YY_BUFFER_EOF_PENDING; + } + } + + else + ret_val = EOB_ACT_CONTINUE_SCAN; + + if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { + /* Extend the array by 50%, plus the number we really need. */ + yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); + if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); + } + + (yy_n_chars) += number_to_move; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; + + (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; + + return ret_val; +} + +/* yy_get_previous_state - get the state just before the EOB char was reached */ + + static yy_state_type yy_get_previous_state (void) +{ + register yy_state_type yy_current_state; + register char *yy_cp; + + yy_current_state = (yy_start); + yy_current_state += YY_AT_BOL(); + + for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) + { + register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 73 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + } + + return yy_current_state; +} + +/* yy_try_NUL_trans - try to make a transition on the NUL character + * + * synopsis + * next_state = yy_try_NUL_trans( current_state ); + */ + static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) +{ + register int yy_is_jam; + register char *yy_cp = (yy_c_buf_p); + + register YY_CHAR yy_c = 1; + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 73 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_is_jam = (yy_current_state == 72); + + return yy_is_jam ? 0 : yy_current_state; +} + + static void yyunput (int c, register char * yy_bp ) +{ + register char *yy_cp; + + yy_cp = (yy_c_buf_p); + + /* undo effects of setting up yytext */ + *yy_cp = (yy_hold_char); + + if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) + { /* need to shift things up to make room */ + /* +2 for EOB chars. */ + register int number_to_move = (yy_n_chars) + 2; + register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ + YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; + register char *source = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; + + while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + *--dest = *--source; + + yy_cp += (int) (dest - source); + yy_bp += (int) (dest - source); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; + + if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) + YY_FATAL_ERROR( "flex scanner push-back overflow" ); + } + + *--yy_cp = (char) c; + + (yytext_ptr) = yy_bp; + (yy_hold_char) = *yy_cp; + (yy_c_buf_p) = yy_cp; +} + +#ifndef YY_NO_INPUT +#ifdef __cplusplus + static int yyinput (void) +#else + static int input (void) +#endif + +{ + int c; + + *(yy_c_buf_p) = (yy_hold_char); + + if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) + { + /* yy_c_buf_p now points to the character we want to return. + * If this occurs *before* the EOB characters, then it's a + * valid NUL; if not, then we've hit the end of the buffer. + */ + if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) + /* This was really a NUL. */ + *(yy_c_buf_p) = '\0'; + + else + { /* need more input */ + int offset = (yy_c_buf_p) - (yytext_ptr); + ++(yy_c_buf_p); + + switch ( yy_get_next_buffer( ) ) + { + case EOB_ACT_LAST_MATCH: + /* This happens because yy_g_n_b() + * sees that we've accumulated a + * token and flags that we need to + * try matching the token before + * proceeding. But for input(), + * there's no matching to consider. + * So convert the EOB_ACT_LAST_MATCH + * to EOB_ACT_END_OF_FILE. + */ + + /* Reset buffer status. */ + yyrestart(yyin ); + + /*FALLTHROUGH*/ + + case EOB_ACT_END_OF_FILE: + { + if ( yywrap( ) ) + return EOF; + + if ( ! (yy_did_buffer_switch_on_eof) ) + YY_NEW_FILE; +#ifdef __cplusplus + return yyinput(); +#else + return input(); +#endif + } + + case EOB_ACT_CONTINUE_SCAN: + (yy_c_buf_p) = (yytext_ptr) + offset; + break; + } + } + } + + c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ + *(yy_c_buf_p) = '\0'; /* preserve yytext */ + (yy_hold_char) = *++(yy_c_buf_p); + + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n'); + + return c; +} +#endif /* ifndef YY_NO_INPUT */ + +/** Immediately switch to a different input stream. + * @param input_file A readable stream. + * + * @note This function does not reset the start condition to @c INITIAL . + */ + void yyrestart (FILE * input_file ) +{ + + if ( ! YY_CURRENT_BUFFER ){ + yyensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + yy_create_buffer(yyin,YY_BUF_SIZE ); + } + + yy_init_buffer(YY_CURRENT_BUFFER,input_file ); + yy_load_buffer_state( ); +} + +/** Switch to a different input buffer. + * @param new_buffer The new input buffer. + * + */ + void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) +{ + + /* TODO. We should be able to replace this entire function body + * with + * yypop_buffer_state(); + * yypush_buffer_state(new_buffer); + */ + yyensure_buffer_stack (); + if ( YY_CURRENT_BUFFER == new_buffer ) + return; + + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + YY_CURRENT_BUFFER_LVALUE = new_buffer; + yy_load_buffer_state( ); + + /* We don't actually know whether we did this switch during + * EOF (yywrap()) processing, but the only time this flag + * is looked at is after yywrap() is called, so it's safe + * to go ahead and always set it. + */ + (yy_did_buffer_switch_on_eof) = 1; +} + +static void yy_load_buffer_state (void) +{ + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; + yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; + (yy_hold_char) = *(yy_c_buf_p); +} + +/** Allocate and initialize an input buffer state. + * @param file A readable stream. + * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. + * + * @return the allocated buffer state. + */ + YY_BUFFER_STATE yy_create_buffer (FILE * file, int size ) +{ + YY_BUFFER_STATE b; + + b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_buf_size = size; + + /* yy_ch_buf has to be 2 characters longer than the size given because + * we need to put in 2 end-of-buffer characters. + */ + b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 ); + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_is_our_buffer = 1; + + yy_init_buffer(b,file ); + + return b; +} + +/** Destroy the buffer. + * @param b a buffer created with yy_create_buffer() + * + */ + void yy_delete_buffer (YY_BUFFER_STATE b ) +{ + + if ( ! b ) + return; + + if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ + YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; + + if ( b->yy_is_our_buffer ) + yyfree((void *) b->yy_ch_buf ); + + yyfree((void *) b ); +} + +#ifndef __cplusplus +extern int isatty (int ); +#endif /* __cplusplus */ + +/* Initializes or reinitializes a buffer. + * This function is sometimes called more than once on the same buffer, + * such as during a yyrestart() or at EOF. + */ + static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file ) + +{ + int oerrno = errno; + + yy_flush_buffer(b ); + + b->yy_input_file = file; + b->yy_fill_buffer = 1; + + /* If b is the current buffer, then yy_init_buffer was _probably_ + * called from yyrestart() or through yy_get_next_buffer. + * In that case, we don't want to reset the lineno or column. + */ + if (b != YY_CURRENT_BUFFER){ + b->yy_bs_lineno = 1; + b->yy_bs_column = 0; + } + + b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; + + errno = oerrno; +} + +/** Discard all buffered characters. On the next scan, YY_INPUT will be called. + * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. + * + */ + void yy_flush_buffer (YY_BUFFER_STATE b ) +{ + if ( ! b ) + return; + + b->yy_n_chars = 0; + + /* We always need two end-of-buffer characters. The first causes + * a transition to the end-of-buffer state. The second causes + * a jam in that state. + */ + b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; + b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; + + b->yy_buf_pos = &b->yy_ch_buf[0]; + + b->yy_at_bol = 1; + b->yy_buffer_status = YY_BUFFER_NEW; + + if ( b == YY_CURRENT_BUFFER ) + yy_load_buffer_state( ); +} + +/** Pushes the new state onto the stack. The new state becomes + * the current state. This function will allocate the stack + * if necessary. + * @param new_buffer The new state. + * + */ +void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) +{ + if (new_buffer == NULL) + return; + + yyensure_buffer_stack(); + + /* This block is copied from yy_switch_to_buffer. */ + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + /* Only push if top exists. Otherwise, replace top. */ + if (YY_CURRENT_BUFFER) + (yy_buffer_stack_top)++; + YY_CURRENT_BUFFER_LVALUE = new_buffer; + + /* copied from yy_switch_to_buffer. */ + yy_load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; +} + +/** Removes and deletes the top of the stack, if present. + * The next element becomes the new top. + * + */ +void yypop_buffer_state (void) +{ + if (!YY_CURRENT_BUFFER) + return; + + yy_delete_buffer(YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + if ((yy_buffer_stack_top) > 0) + --(yy_buffer_stack_top); + + if (YY_CURRENT_BUFFER) { + yy_load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; + } +} + +/* Allocates the stack if it does not exist. + * Guarantees space for at least one push. + */ +static void yyensure_buffer_stack (void) +{ + int num_to_alloc; + + if (!(yy_buffer_stack)) { + + /* First allocation is just for 2 elements, since we don't know if this + * scanner will even need a stack. We use 2 instead of 1 to avoid an + * immediate realloc on the next call. + */ + num_to_alloc = 1; + (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc + (num_to_alloc * sizeof(struct yy_buffer_state*) + ); + if ( ! (yy_buffer_stack) ) + YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); + + memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); + + (yy_buffer_stack_max) = num_to_alloc; + (yy_buffer_stack_top) = 0; + return; + } + + if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ + + /* Increase the buffer to prepare for a possible push. */ + int grow_size = 8 /* arbitrary grow size */; + + num_to_alloc = (yy_buffer_stack_max) + grow_size; + (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc + ((yy_buffer_stack), + num_to_alloc * sizeof(struct yy_buffer_state*) + ); + if ( ! (yy_buffer_stack) ) + YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); + + /* zero only the new slots.*/ + memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); + (yy_buffer_stack_max) = num_to_alloc; + } +} + +/** Setup the input buffer state to scan directly from a user-specified character buffer. + * @param base the character buffer + * @param size the size in bytes of the character buffer + * + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) +{ + YY_BUFFER_STATE b; + + if ( size < 2 || + base[size-2] != YY_END_OF_BUFFER_CHAR || + base[size-1] != YY_END_OF_BUFFER_CHAR ) + /* They forgot to leave room for the EOB's. */ + return 0; + + b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); + + b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ + b->yy_buf_pos = b->yy_ch_buf = base; + b->yy_is_our_buffer = 0; + b->yy_input_file = 0; + b->yy_n_chars = b->yy_buf_size; + b->yy_is_interactive = 0; + b->yy_at_bol = 1; + b->yy_fill_buffer = 0; + b->yy_buffer_status = YY_BUFFER_NEW; + + yy_switch_to_buffer(b ); + + return b; +} + +/** Setup the input buffer state to scan a string. The next call to yylex() will + * scan from a @e copy of @a str. + * @param yystr a NUL-terminated string to scan + * + * @return the newly allocated buffer state object. + * @note If you want to scan bytes that may contain NUL values, then use + * yy_scan_bytes() instead. + */ +YY_BUFFER_STATE yy_scan_string (yyconst char * yystr ) +{ + + return yy_scan_bytes(yystr,strlen(yystr) ); +} + +/** Setup the input buffer state to scan the given bytes. The next call to yylex() will + * scan from a @e copy of @a bytes. + * @param bytes the byte buffer to scan + * @param len the number of bytes in the buffer pointed to by @a bytes. + * + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, int _yybytes_len ) +{ + YY_BUFFER_STATE b; + char *buf; + yy_size_t n; + int i; + + /* Get memory for full buffer, including space for trailing EOB's. */ + n = _yybytes_len + 2; + buf = (char *) yyalloc(n ); + if ( ! buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); + + for ( i = 0; i < _yybytes_len; ++i ) + buf[i] = yybytes[i]; + + buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; + + b = yy_scan_buffer(buf,n ); + if ( ! b ) + YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); + + /* It's okay to grow etc. this buffer, and we should throw it + * away when we're done. + */ + b->yy_is_our_buffer = 1; + + return b; +} + +#ifndef YY_EXIT_FAILURE +#define YY_EXIT_FAILURE 2 +#endif + +static void yy_fatal_error (yyconst char* msg ) +{ + (void) fprintf( stderr, "%s\n", msg ); + exit( YY_EXIT_FAILURE ); +} + +/* Redefine yyless() so it works in section 3 code. */ + +#undef yyless +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + yytext[yyleng] = (yy_hold_char); \ + (yy_c_buf_p) = yytext + yyless_macro_arg; \ + (yy_hold_char) = *(yy_c_buf_p); \ + *(yy_c_buf_p) = '\0'; \ + yyleng = yyless_macro_arg; \ + } \ + while ( 0 ) + +/* Accessor methods (get/set functions) to struct members. */ + +/** Get the current line number. + * + */ +int yyget_lineno (void) +{ + + return yylineno; +} + +/** Get the input stream. + * + */ +FILE *yyget_in (void) +{ + return yyin; +} + +/** Get the output stream. + * + */ +FILE *yyget_out (void) +{ + return yyout; +} + +/** Get the length of the current token. + * + */ +int yyget_leng (void) +{ + return yyleng; +} + +/** Get the current token. + * + */ + +char *yyget_text (void) +{ + return yytext; +} + +/** Set the current line number. + * @param line_number + * + */ +void yyset_lineno (int line_number ) +{ + + yylineno = line_number; +} + +/** Set the input stream. This does not discard the current + * input buffer. + * @param in_str A readable stream. + * + * @see yy_switch_to_buffer + */ +void yyset_in (FILE * in_str ) +{ + yyin = in_str ; +} + +void yyset_out (FILE * out_str ) +{ + yyout = out_str ; +} + +int yyget_debug (void) +{ + return yy_flex_debug; +} + +void yyset_debug (int bdebug ) +{ + yy_flex_debug = bdebug ; +} + +static int yy_init_globals (void) +{ + /* Initialization is the same as for the non-reentrant scanner. + * This function is called from yylex_destroy(), so don't allocate here. + */ + + (yy_buffer_stack) = 0; + (yy_buffer_stack_top) = 0; + (yy_buffer_stack_max) = 0; + (yy_c_buf_p) = (char *) 0; + (yy_init) = 0; + (yy_start) = 0; + +/* Defined in main.c */ +#ifdef YY_STDINIT + yyin = stdin; + yyout = stdout; +#else + yyin = (FILE *) 0; + yyout = (FILE *) 0; +#endif + + /* For future reference: Set errno on error, since we are called by + * yylex_init() + */ + return 0; +} + +/* yylex_destroy is for both reentrant and non-reentrant scanners. */ +int yylex_destroy (void) +{ + + /* Pop the buffer stack, destroying each element. */ + while(YY_CURRENT_BUFFER){ + yy_delete_buffer(YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + yypop_buffer_state(); + } + + /* Destroy the stack itself. */ + yyfree((yy_buffer_stack) ); + (yy_buffer_stack) = NULL; + + /* Reset the globals. This is important in a non-reentrant scanner so the next time + * yylex() is called, initialization will occur. */ + yy_init_globals( ); + + return 0; +} + +/* + * Internal utility routines. + */ + +#ifndef yytext_ptr +static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) +{ + register int i; + for ( i = 0; i < n; ++i ) + s1[i] = s2[i]; +} +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen (yyconst char * s ) +{ + register int n; + for ( n = 0; s[n]; ++n ) + ; + + return n; +} +#endif + +void *yyalloc (yy_size_t size ) +{ + return (void *) malloc( size ); +} + +void *yyrealloc (void * ptr, yy_size_t size ) +{ + /* The cast to (char *) in the following accommodates both + * implementations that use char* generic pointers, and those + * that use void* generic pointers. It works with the latter + * because both ANSI C and C++ allow castless assignment from + * any pointer type to void*, and deal with argument conversions + * as though doing an assignment. + */ + return (void *) realloc( (char *) ptr, size ); +} + +void yyfree (void * ptr ) +{ + free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ +} + +#define YYTABLES_NAME "yytables" + +#line 83 "scanner.l" + + +int yywrap(void) +{ + return 1; +} + +void yyerror(const char *message) +{ + const char *pt, *end; + struct _entry { + const char *from; + const char *to; + } *entry, list[] = { + { "T_VIRTUAL", "\"virtual\"" }, + { "T_DISPLAY", "\"display\"" }, + { "T_WALL", "\"wall\"" }, + { "T_OPTION", "\"option\"" }, + { "T_PARAM", "\"param\"" }, + { "T_DIMENSION", "dimension (e.g., 2x2 or 1024x768)" }, + { "T_OFFSET", "display offset (e.g., +10-10)" }, + { "T_ORIGIN", "tile origin (e.g., @1280x1024)" }, + { "T_STRING", "string" }, + { "T_COMMENT", "comment (e.g., #...)" }, + { "T_LINE_COMMENT", "comment (e.g., #...)" }, + { NULL, NULL } + }; + + fprintf(stderr, "parse error on line %d at token \"%*.*s\"\n", + lineno, yyleng, yyleng, yytext); + end = message + strlen(message); + for (pt = message; *pt; pt++) { + if (pt[0] == 'T' && pt[1] == '_') { + const char *next = strchr(pt, ' '); + if (!next || !*next) next = strchr(pt, '\0'); + if (!next) goto bail; + --next; + if (next-pt == 1 && next[1] + && next[2] == '\'' && next[3] == '\'') { + fprintf(stderr, "\"%c\"", next[1]); + pt += 4; + goto cnt; + } + for (entry = list; entry->from; ++entry) { + if (!strncmp(entry->from, pt, strlen(entry->from))) { + fprintf(stderr, "%s", entry->to); + pt = next; + goto cnt; + } + } + } else if (end-pt >= 5 && pt[0] == '\'' && pt[1] == '\'' && pt[3] + && pt[4] == '\'' && pt[5] == '\'') { + fprintf(stderr, "\"%c\"", pt[3]); + pt += 5; + } else if (end-pt >= 3 && pt[0] == '\'' && pt[1] && pt[2] == '\'') { + fprintf(stderr, "\"%c\"", pt[1]); + pt += 3; + } + bail: + putc(*pt, stderr); + cnt: + ; + } + fprintf(stderr, "\n"); + exit( 1 ); +} + +static int getdimension(int token, const char *text, int leng) +{ + char *endptr; + char *tmp = dmxConfigAlloc(leng+1); + int x, y; + + strncpy(tmp, text, leng); + x = strtol(tmp, &endptr, 10); + while (*endptr && !isdigit(*endptr)) ++endptr; + y = strtol(endptr, NULL, 10); + dmxConfigFree(tmp); + yylval.pair = dmxConfigCreatePair(token, lineno, NULL, x, y, 1, 1); + return token; +} + +static int getstring(int token, const char *text, int leng) +{ + yylval.string = dmxConfigCreateString(token, lineno, NULL, + dmxConfigCopyString(leng ? text : "", + leng)); + return token; +} + +static int gettoken(int token, const char *text, int leng) +{ + yylval.token = dmxConfigCreateToken(token, lineno, NULL); + return token; +} + +static int getcomment(int token, const char *text, int leng) +{ + yylval.comment = dmxConfigCreateComment(token, lineno, + dmxConfigCopyString(text + 1, + leng - 1)); + return token; +} + diff --git a/xorg-server/hw/dmx/config/scanner.l b/xorg-server/hw/dmx/config/scanner.l new file mode 100644 index 000000000..cef99d088 --- /dev/null +++ b/xorg-server/hw/dmx/config/scanner.l @@ -0,0 +1,184 @@ +/* $XFree86$ */ +/* + * Copyright 2002 Red Hat Inc., Durham, North Carolina. + * + * 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 on 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 + * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR 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. + */ + +/* + * Authors: + * Rickard E. (Rik) Faith <faith@redhat.com> + * + */ + +%{ +#ifdef HAVE_DMX_CONFIG_H +#include <dmx-config.h> +#endif + +#include "dmxparse.h" +#include "parser.h" +#include <string.h> +#include <stdlib.h> +#include <ctype.h> +static int getdimension(int token, const char *text, int leng); +static int getstring(int token, const char *text, int leng); +static int gettoken(int token, const char *text, int leng); +static int getcomment(int token, const char *text, int leng); +static int lineno = 1; +%} +%s OTHER +comment #.* +word ([[:alpha:]_/:\-\+\.\*][[:alnum:]_/:\-\+\.\*]+) +string \"(([^\"\n])|\"\")*\" +badstring \"(([^\"\n])|\"\")* +number [[:digit:]x]+ +dimension [[:digit:]]+[[:blank:]]*x[[:blank:]]*[[:digit:]]+ +offset [+-][[:digit:]]+[[:blank:]]*[+-][[:blank:]]*[[:digit:]]+ +origin @[[:blank:]]*[[:digit:]]+[[:blank:]]*[[:blank:]]*x[[:digit:]]+ +NL \n +WS [[:blank:]]+ +%% +virtual return gettoken(T_VIRTUAL, yytext, yyleng); +display return gettoken(T_DISPLAY, yytext, yyleng); +wall return gettoken(T_WALL, yytext, yyleng); +option return gettoken(T_OPTION, yytext, yyleng); +param return gettoken(T_PARAM, yytext, yyleng); +{dimension} return getdimension(T_DIMENSION, yytext, yyleng); +{offset} return getdimension(T_OFFSET, yytext+1, yyleng-1); +{origin} return getdimension(T_ORIGIN, yytext+1, yyleng-1); +{word} return getstring(T_STRING, yytext, yyleng); +{string} return getstring(T_STRING, yytext+1, yyleng-2); +{NL} ++lineno; +{WS} +\{ return gettoken(yytext[0], yytext, yyleng); +\} return gettoken(yytext[0], yytext, yyleng); +\; return gettoken(yytext[0], yytext, yyleng); +\/ return gettoken(yytext[0], yytext, yyleng); +^{comment} return getcomment(T_LINE_COMMENT, yytext, yyleng); +{comment} return getcomment(T_COMMENT, yytext, yyleng); +. return getstring(T_STRING, yytext, yyleng); +<<EOF>> return 0; +%% +int yywrap(void) +{ + return 1; +} + +void yyerror(const char *message) +{ + const char *pt, *end; + struct _entry { + const char *from; + const char *to; + } *entry, list[] = { + { "T_VIRTUAL", "\"virtual\"" }, + { "T_DISPLAY", "\"display\"" }, + { "T_WALL", "\"wall\"" }, + { "T_OPTION", "\"option\"" }, + { "T_PARAM", "\"param\"" }, + { "T_DIMENSION", "dimension (e.g., 2x2 or 1024x768)" }, + { "T_OFFSET", "display offset (e.g., +10-10)" }, + { "T_ORIGIN", "tile origin (e.g., @1280x1024)" }, + { "T_STRING", "string" }, + { "T_COMMENT", "comment (e.g., #...)" }, + { "T_LINE_COMMENT", "comment (e.g., #...)" }, + { NULL, NULL } + }; + + fprintf(stderr, "parse error on line %d at token \"%*.*s\"\n", + lineno, yyleng, yyleng, yytext); + end = message + strlen(message); + for (pt = message; *pt; pt++) { + if (pt[0] == 'T' && pt[1] == '_') { + const char *next = strchr(pt, ' '); + if (!next || !*next) next = strchr(pt, '\0'); + if (!next) goto bail; + --next; + if (next-pt == 1 && next[1] + && next[2] == '\'' && next[3] == '\'') { + fprintf(stderr, "\"%c\"", next[1]); + pt += 4; + goto cnt; + } + for (entry = list; entry->from; ++entry) { + if (!strncmp(entry->from, pt, strlen(entry->from))) { + fprintf(stderr, "%s", entry->to); + pt = next; + goto cnt; + } + } + } else if (end-pt >= 5 && pt[0] == '\'' && pt[1] == '\'' && pt[3] + && pt[4] == '\'' && pt[5] == '\'') { + fprintf(stderr, "\"%c\"", pt[3]); + pt += 5; + } else if (end-pt >= 3 && pt[0] == '\'' && pt[1] && pt[2] == '\'') { + fprintf(stderr, "\"%c\"", pt[1]); + pt += 3; + } + bail: + putc(*pt, stderr); + cnt: + ; + } + fprintf(stderr, "\n"); + exit( 1 ); +} + +static int getdimension(int token, const char *text, int leng) +{ + char *endptr; + char *tmp = dmxConfigAlloc(leng+1); + int x, y; + + strncpy(tmp, text, leng); + x = strtol(tmp, &endptr, 10); + while (*endptr && !isdigit(*endptr)) ++endptr; + y = strtol(endptr, NULL, 10); + dmxConfigFree(tmp); + yylval.pair = dmxConfigCreatePair(token, lineno, NULL, x, y, 1, 1); + return token; +} + +static int getstring(int token, const char *text, int leng) +{ + yylval.string = dmxConfigCreateString(token, lineno, NULL, + dmxConfigCopyString(leng ? text : "", + leng)); + return token; +} + +static int gettoken(int token, const char *text, int leng) +{ + yylval.token = dmxConfigCreateToken(token, lineno, NULL); + return token; +} + +static int getcomment(int token, const char *text, int leng) +{ + yylval.comment = dmxConfigCreateComment(token, lineno, + dmxConfigCopyString(text + 1, + leng - 1)); + return token; +} diff --git a/xorg-server/hw/dmx/config/test-a.in b/xorg-server/hw/dmx/config/test-a.in new file mode 100644 index 000000000..827675374 --- /dev/null +++ b/xorg-server/hw/dmx/config/test-a.in @@ -0,0 +1 @@ +error diff --git a/xorg-server/hw/dmx/config/test-a.out b/xorg-server/hw/dmx/config/test-a.out new file mode 100644 index 000000000..d35b29fc0 --- /dev/null +++ b/xorg-server/hw/dmx/config/test-a.out @@ -0,0 +1,2 @@ +parse error on line 1 at token "error" +syntax error, unexpected string expecting "virtual" or comment (e.g., #...) diff --git a/xorg-server/hw/dmx/config/test-b.in b/xorg-server/hw/dmx/config/test-b.in new file mode 100644 index 000000000..308ec1db4 --- /dev/null +++ b/xorg-server/hw/dmx/config/test-b.in @@ -0,0 +1 @@ +# comment diff --git a/xorg-server/hw/dmx/config/test-b.out b/xorg-server/hw/dmx/config/test-b.out new file mode 100644 index 000000000..308ec1db4 --- /dev/null +++ b/xorg-server/hw/dmx/config/test-b.out @@ -0,0 +1 @@ +# comment diff --git a/xorg-server/hw/dmx/config/test-c.in b/xorg-server/hw/dmx/config/test-c.in new file mode 100644 index 000000000..e07ae5ba6 --- /dev/null +++ b/xorg-server/hw/dmx/config/test-c.in @@ -0,0 +1 @@ +virtual diff --git a/xorg-server/hw/dmx/config/test-c.out b/xorg-server/hw/dmx/config/test-c.out new file mode 100644 index 000000000..7390397a4 --- /dev/null +++ b/xorg-server/hw/dmx/config/test-c.out @@ -0,0 +1,2 @@ +parse error on line 2 at token " " +syntax error, unexpected $end, expecting "{" or string or dimension (e.g., 2x2 or 1024x768) diff --git a/xorg-server/hw/dmx/config/test-d.in b/xorg-server/hw/dmx/config/test-d.in new file mode 100644 index 000000000..6827503b1 --- /dev/null +++ b/xorg-server/hw/dmx/config/test-d.in @@ -0,0 +1 @@ +display diff --git a/xorg-server/hw/dmx/config/test-d.out b/xorg-server/hw/dmx/config/test-d.out new file mode 100644 index 000000000..f3219b301 --- /dev/null +++ b/xorg-server/hw/dmx/config/test-d.out @@ -0,0 +1,2 @@ +parse error on line 1 at token "display" +syntax error, unexpected "display" expecting "virtual" or comment (e.g., #...) diff --git a/xorg-server/hw/dmx/config/test-e.in b/xorg-server/hw/dmx/config/test-e.in new file mode 100644 index 000000000..21dbde95c --- /dev/null +++ b/xorg-server/hw/dmx/config/test-e.in @@ -0,0 +1 @@ +display; diff --git a/xorg-server/hw/dmx/config/test-e.out b/xorg-server/hw/dmx/config/test-e.out new file mode 100644 index 000000000..f3219b301 --- /dev/null +++ b/xorg-server/hw/dmx/config/test-e.out @@ -0,0 +1,2 @@ +parse error on line 1 at token "display" +syntax error, unexpected "display" expecting "virtual" or comment (e.g., #...) diff --git a/xorg-server/hw/dmx/config/test-f.in b/xorg-server/hw/dmx/config/test-f.in new file mode 100644 index 000000000..17f6c6327 --- /dev/null +++ b/xorg-server/hw/dmx/config/test-f.in @@ -0,0 +1,2 @@ +virtual { +} diff --git a/xorg-server/hw/dmx/config/test-f.out b/xorg-server/hw/dmx/config/test-f.out Binary files differnew file mode 100644 index 000000000..ba3f441d7 --- /dev/null +++ b/xorg-server/hw/dmx/config/test-f.out diff --git a/xorg-server/hw/dmx/config/test-g.in b/xorg-server/hw/dmx/config/test-g.in new file mode 100644 index 000000000..453d8121c --- /dev/null +++ b/xorg-server/hw/dmx/config/test-g.in @@ -0,0 +1,4 @@ +virtual a { + display d0:0 1280x1024; + display d1:0 1280x1024; +} diff --git a/xorg-server/hw/dmx/config/test-g.out b/xorg-server/hw/dmx/config/test-g.out new file mode 100644 index 000000000..453d8121c --- /dev/null +++ b/xorg-server/hw/dmx/config/test-g.out @@ -0,0 +1,4 @@ +virtual a { + display d0:0 1280x1024; + display d1:0 1280x1024; +} diff --git a/xorg-server/hw/dmx/config/test-h.in b/xorg-server/hw/dmx/config/test-h.in new file mode 100644 index 000000000..1193d309e --- /dev/null +++ b/xorg-server/hw/dmx/config/test-h.in @@ -0,0 +1,7 @@ +# comment a +# comment b +## comment c +# <-- tab +# Next comment is empty +# +# Non empty diff --git a/xorg-server/hw/dmx/config/test-h.out b/xorg-server/hw/dmx/config/test-h.out new file mode 100644 index 000000000..1193d309e --- /dev/null +++ b/xorg-server/hw/dmx/config/test-h.out @@ -0,0 +1,7 @@ +# comment a +# comment b +## comment c +# <-- tab +# Next comment is empty +# +# Non empty diff --git a/xorg-server/hw/dmx/config/test-i.in b/xorg-server/hw/dmx/config/test-i.in new file mode 100644 index 000000000..b65967e62 --- /dev/null +++ b/xorg-server/hw/dmx/config/test-i.in @@ -0,0 +1,3 @@ +virtual a { + param a b; # comment +} diff --git a/xorg-server/hw/dmx/config/test-i.out b/xorg-server/hw/dmx/config/test-i.out new file mode 100644 index 000000000..b65967e62 --- /dev/null +++ b/xorg-server/hw/dmx/config/test-i.out @@ -0,0 +1,3 @@ +virtual a { + param a b; # comment +} diff --git a/xorg-server/hw/dmx/config/test-j.in b/xorg-server/hw/dmx/config/test-j.in new file mode 100644 index 000000000..cc1cdd0ea --- /dev/null +++ b/xorg-server/hw/dmx/config/test-j.in @@ -0,0 +1,13 @@ +virtual a { + option aaa # bbb + aa cc; + param { # comment 1 + a b; + c d; + x y z; # comment 2 + } + param e f g h; # comment 3 + param e f g hlskdjflskdfjsd #comment 4 + flksdjf sldkfjsldkfjsdlf + "lsdkfjsldkfjlsdkjflskdjflsdkjfl" "lkjsdlfjsdlfkjsdlfj"; +} diff --git a/xorg-server/hw/dmx/config/test-j.out b/xorg-server/hw/dmx/config/test-j.out new file mode 100644 index 000000000..9acaa009b --- /dev/null +++ b/xorg-server/hw/dmx/config/test-j.out @@ -0,0 +1,11 @@ +virtual a { + option "aaa aa cc"; + param { # comment 1 + a b; + c d; + x y z; # comment 2 + } + param e f g h; # comment 3 + param e f g hlskdjflskdfjsd #comment 4 + flksdjf sldkfjsldkfjsdlf lsdkfjsldkfjlsdkjflskdjflsdkjfl lkjsdlfjsdlfkjsdlfj; +} diff --git a/xorg-server/hw/dmx/config/test-k.in b/xorg-server/hw/dmx/config/test-k.in new file mode 100644 index 000000000..2218d26d9 --- /dev/null +++ b/xorg-server/hw/dmx/config/test-k.in @@ -0,0 +1,3 @@ +virtual a { + option +xinerama -syncbatch 0; +} diff --git a/xorg-server/hw/dmx/config/test-k.out b/xorg-server/hw/dmx/config/test-k.out new file mode 100644 index 000000000..ebd743923 --- /dev/null +++ b/xorg-server/hw/dmx/config/test-k.out @@ -0,0 +1,3 @@ +virtual a { + option "+xinerama -syncbatch 0"; +} diff --git a/xorg-server/hw/dmx/config/test-l.in b/xorg-server/hw/dmx/config/test-l.in new file mode 100644 index 000000000..7bf05139b --- /dev/null +++ b/xorg-server/hw/dmx/config/test-l.in @@ -0,0 +1,12 @@ +virtual a { + display d0:0 1x2; + display d1:0 +3+4; + display d2:0 100x200 @1x1; + display d3:0 +3+4 @2x2; + display d4:0 100x200+3+4 @3x3; + display d5:0 / 1x2+3+4; + display d6:0 / 1x2; + display d7:0 / +3+4; + display d8:0 / 1x2+3+4 @4x4; + display d9:0 11x22+33+44 / 111x222+333+444 @1000x1100; +} diff --git a/xorg-server/hw/dmx/config/test-l.out b/xorg-server/hw/dmx/config/test-l.out new file mode 100644 index 000000000..7bf05139b --- /dev/null +++ b/xorg-server/hw/dmx/config/test-l.out @@ -0,0 +1,12 @@ +virtual a { + display d0:0 1x2; + display d1:0 +3+4; + display d2:0 100x200 @1x1; + display d3:0 +3+4 @2x2; + display d4:0 100x200+3+4 @3x3; + display d5:0 / 1x2+3+4; + display d6:0 / 1x2; + display d7:0 / +3+4; + display d8:0 / 1x2+3+4 @4x4; + display d9:0 11x22+33+44 / 111x222+333+444 @1000x1100; +} diff --git a/xorg-server/hw/dmx/config/vdltodmx.c b/xorg-server/hw/dmx/config/vdltodmx.c new file mode 100644 index 000000000..69563f16c --- /dev/null +++ b/xorg-server/hw/dmx/config/vdltodmx.c @@ -0,0 +1,57 @@ +/* + * Copyright 2002 Red Hat Inc., Durham, North Carolina. + * + * 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 on 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 + * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR 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. + */ + +/* + * Authors: + * Rickard E. (Rik) Faith <faith@redhat.com> + * + */ + +#include "dmxconfig.h" +#include "dmxparse.h" +#include "dmxprint.h" +#include "dmxcompat.h" + +int main(int argc, char **argv) +{ + DMXConfigEntryPtr entry; + FILE *str; + + if (argc != 2 && argc !=3) { + fprintf(stderr, "Usage: vdltodmx inFile [outFile]\n"); + return 1; + } + if (argc == 2) { + str = stdout; + } else if (!(str = fopen(argv[2], "w"))) { + fprintf(stderr, "Cannot open %s for write\n", argv[2]); + return 2; + } + entry = dmxVDLRead(argv[1]); + dmxConfigPrint(str, entry); + return 0; +} diff --git a/xorg-server/hw/dmx/config/vdltodmx.man b/xorg-server/hw/dmx/config/vdltodmx.man new file mode 100644 index 000000000..b733db7ab --- /dev/null +++ b/xorg-server/hw/dmx/config/vdltodmx.man @@ -0,0 +1,95 @@ +.\" $XFree86$ +.\" Copyright 2002 Red Hat Inc., Durham, North Carolina. +.\" 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 on 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 +.\" NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR 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. +.\" +.\" Authors: +.\" Rickard E. (Rik) Faith <faith@redhat.com> +.\" +.TH vdltodmx 1 __vendorversion__ +.SH NAME +vdltodmx - dmx configuration file parser and printer +.SH SYNOPSIS +.B vdltodmx +.I infile +.I outfile +.SH DESCRIPTION +.I vdltodmx +reads the input file, which should be in VDL configuration file format. +After a successful parse, a file in Xdmx configuration file format is +written to the output file. +.P +The VDL file format is used with +.IR xmovie , +which is available from +http://www.llnl.gov/icc/lc/img/xmovie/xmovie.html +.SH EXAMPLE +Given the following VDL-format file: +.RS +.nf +0 +2 +# +# +2560 2048 Left two-thirds [restrict=*:2] +2 +:2.1 1280 2048 0 0 0 0 +:2.2 1280 2048 1280 0 0 0 +4 +1280 1024 0 0 +1280 1024 0 1024 +1280 1024 1280 0 +1280 1024 1280 1024 +# +2560 2048 Right two-thirds [restrict=*:2] +2 +:2.2 1280 2048 0 0 0 0 +:2.3 1280 2048 1280 0 0 0 +4 +1280 1024 1280 0 +1280 1024 1280 1024 +1280 1024 2560 0 +1280 1024 2560 1024 +.fi +.RE +the following DMX-format file will be produced: +.RS +.nf +# +# +virtual "Left two-thirds" 2560x2048 { + display :2.1 1280x2048; + display :2.2 1280x2048 @1280x0; +} +# +virtual "Right two-thirds" 2560x2048 { + display :2.2 1280x2048; + display :2.3 1280x2048 @1280x0; +} +.fi +.RE +.SH BUGS +If the VDL file is not in the expected format, the program will probably +dump core. +.SH "SEE ALSO" +Xdmx(1), xdmxconfig(1), vdl(3), xmovie(1) diff --git a/xorg-server/hw/dmx/config/xdmxconfig.c b/xorg-server/hw/dmx/config/xdmxconfig.c new file mode 100644 index 000000000..033b52512 --- /dev/null +++ b/xorg-server/hw/dmx/config/xdmxconfig.c @@ -0,0 +1,1191 @@ +/* + * Copyright 2002 Red Hat Inc., Durham, North Carolina. + * + * 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 on 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 + * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR 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. + */ + +/* + * Authors: + * Rickard E. (Rik) Faith <faith@redhat.com> + * + */ + +#ifdef HAVE_DMX_CONFIG_H +#include <dmx-config.h> +#endif + +#include <stdio.h> +#include <stdlib.h> +#include <X11/Intrinsic.h> +#include <X11/StringDefs.h> +#include <X11/Xaw/Form.h> +#include <X11/Xaw/Box.h> +/* #include <X11/Xaw/Paned.h> */ +#include <X11/Xaw/Command.h> +#include <X11/Xaw/SimpleMenu.h> +#include <X11/Xaw/SmeBSB.h> +#include <X11/Xaw/MenuButton.h> +#include <X11/Xaw/Viewport.h> +#include <X11/Xaw/Dialog.h> +#include <X11/keysym.h> +#include <X11/Xmu/SysUtil.h> +#include "Canvas.h" + +#include "dmxparse.h" +#include "dmxprint.h" +#include "dmxlog.h" + +extern int yyparse(void); +extern FILE *yyin; + +#define DMX_INFO "xdmxconfig v0.9\nCopyright 2002 Red Hat Inc.\n" + +#define DMX_MAIN_WIDTH 800 +#define DMX_MAIN_HEIGHT 600 +#define DMX_DATA_WIDTH 200 +#define DMX_DATA_HEIGHT 200 +#define DMX_CANVAS_WIDTH 400 +#define DMX_CANVAS_HEIGHT 500 + +DMXConfigEntryPtr dmxConfigEntry; +static DMXConfigVirtualPtr dmxConfigCurrent, dmxConfigNewVirtual; +static DMXConfigDisplayPtr dmxConfigCurrentDisplay, dmxConfigNewDisplay; +static int dmxConfigGrabbed, dmxConfigGrabbedFine; +static int dmxConfigGrabbedX, dmxConfigGrabbedY; +static char *dmxConfigFilename; +static GC dmxConfigGC, dmxConfigGCRev, dmxConfigGCHL; +static int dmxConfigGCInit = 0; +static Dimension dmxConfigWidgetWidth, dmxConfigWidgetHeight; +static Dimension dmxConfigWallWidth, dmxConfigWallHeight; +static double dmxConfigScaleX, dmxConfigScaleY; +static int dmxConfigNotSaved; +static enum { + dmxConfigStateOpen, + dmxConfigStateSave +} dmxConfigState; + +/* Global widgets */ +static Widget canvas; +static Widget cnamebox, cdimbox; +static Widget openpopup, opendialog; +static Widget namebox, dimbox, rtbox, origbox; +static Widget okbutton, buttonpopup; +static Widget ecbutton, dcbutton; +static Widget ndbutton0, ndbutton1, edbutton, ddbutton; +static Widget ecpopup, ecdialog0, ecdialog1; +static Widget edpopup, eddialog0, eddialog1, eddialog2; +static Widget aboutpopup, quitpopup; + +static void dmxConfigCanvasGCs(void) +{ + Display *dpy = XtDisplay(canvas); + Window win = XtWindow(canvas); + XGCValues gcvals; + unsigned long mask; + Colormap colormap; + XColor fg, bg, hl, tmp; + + if (dmxConfigGCInit++) return; + + XtVaGetValues(canvas, XtNcolormap, &colormap, NULL); + XAllocNamedColor(XtDisplay(canvas), colormap, "black", &bg, &tmp); + XAllocNamedColor(XtDisplay(canvas), colormap, "white", &fg, &tmp); + XAllocNamedColor(XtDisplay(canvas), colormap, "red", &hl, &tmp); + + mask = (GCFunction | GCPlaneMask | GCClipMask | GCForeground | + GCBackground | GCLineWidth | GCLineStyle | GCCapStyle | + GCFillStyle); + + /* FIXME: copy this from widget */ + gcvals.function = GXcopy; + gcvals.plane_mask = AllPlanes; + gcvals.clip_mask = None; + gcvals.foreground = fg.pixel; + gcvals.background = bg.pixel; + gcvals.line_width = 0; + gcvals.line_style = LineSolid; + gcvals.cap_style = CapNotLast; + gcvals.fill_style = FillSolid; + + dmxConfigGC = XCreateGC(dpy, win, mask, &gcvals); + gcvals.foreground = hl.pixel; + dmxConfigGCHL = XCreateGC(dpy, win, mask, &gcvals); + gcvals.foreground = bg.pixel; + gcvals.background = fg.pixel; + dmxConfigGCRev = XCreateGC(dpy, win, mask, &gcvals); +} + +static void dmxConfigGetDims(int *maxWidth, int *maxHeight) +{ + DMXConfigSubPtr pt; + DMXConfigEntryPtr e; + + *maxWidth = dmxConfigWallWidth = 0; + *maxWidth = dmxConfigWallHeight = 0; + if (!dmxConfigCurrent) return; + + dmxConfigWallWidth = dmxConfigCurrent->width; + dmxConfigWallHeight = dmxConfigCurrent->height; + if (!dmxConfigWallWidth || !dmxConfigWallHeight) { + for (pt = dmxConfigCurrent->subentry; pt; pt = pt->next) { + if (pt->type == dmxConfigDisplay) { + int x = pt->display->scrnWidth + pt->display->rootXOrigin; + int y = pt->display->scrnHeight + pt->display->rootYOrigin; + if (x > dmxConfigWallWidth) dmxConfigWallWidth = x; + if (y > dmxConfigWallHeight) dmxConfigWallHeight = y; + } + } + } + /* Compute maximums */ + *maxWidth = *maxHeight = 0; + for (e = dmxConfigEntry; e; e = e->next) { + if (e->type != dmxConfigVirtual) continue; + for (pt = e->virtual->subentry; pt; pt = pt->next) { + if (pt->type == dmxConfigDisplay) { + int x = pt->display->scrnWidth + pt->display->rootXOrigin; + int y = pt->display->scrnHeight + pt->display->rootYOrigin; + if (x > *maxWidth) *maxWidth = x; + if (y > *maxHeight) *maxHeight = y; + } + } + } + if (dmxConfigWallWidth > *maxWidth) *maxWidth = dmxConfigWallWidth; + if (dmxConfigWallHeight > *maxHeight) *maxHeight = dmxConfigWallHeight; +} + +static int scalex(int x) { return (int)((x * dmxConfigScaleX) + .5); } +static int scaley(int y) { return (int)((y * dmxConfigScaleY) + .5); } +static int unscalex(int x) { return (int)((x / dmxConfigScaleX) + .5); } +static int unscaley(int y) { return (int)((y / dmxConfigScaleY) + .5); } + +static void dmxConfigDataUpdate(void) +{ + /* FIXME: could result in buffer overflows */ + char cnambuf[512]; + char cdimbuf[128]; + char nambuf[512]; + char dimbuf[128]; + char rtbuf[128]; + char offbuf[128]; + const char *name; + + if (!dmxConfigCurrent) { + XtVaSetValues(cnamebox, XtNlabel, "", XtNsensitive, False, NULL); + XtVaSetValues(cdimbox, XtNlabel, "", XtNsensitive, False, NULL); + XtVaSetValues(ecbutton, XtNsensitive, False, NULL); + XtVaSetValues(dcbutton, XtNsensitive, False, NULL); + XtVaSetValues(ndbutton0, XtNsensitive, False, NULL); + XtVaSetValues(ndbutton1, XtNsensitive, False, NULL); + } else { + name = dmxConfigCurrent->name; + XmuSnprintf(cnambuf, sizeof(cnambuf), "%s", name ? name : ""); + XmuSnprintf(cdimbuf, sizeof(cdimbuf), "%dx%d", + dmxConfigWallWidth, dmxConfigWallHeight); + XtVaSetValues(cnamebox, XtNlabel, cnambuf, XtNsensitive, True, NULL); + XtVaSetValues(cdimbox, XtNlabel, cdimbuf, XtNsensitive, True, NULL); + XtVaSetValues(ecbutton, XtNsensitive, True, NULL); + XtVaSetValues(dcbutton, XtNsensitive, True, NULL); + XtVaSetValues(ndbutton0, XtNsensitive, True, NULL); + XtVaSetValues(ndbutton1, XtNsensitive, True, NULL); + } + + if (!dmxConfigCurrentDisplay) { + XtVaSetValues(namebox, XtNlabel, "", XtNsensitive, False, NULL); + XtVaSetValues(dimbox, XtNlabel, "", XtNsensitive, False, NULL); + XtVaSetValues(rtbox, XtNlabel, "", XtNsensitive, False, NULL); + XtVaSetValues(origbox, XtNlabel, "", XtNsensitive, False, NULL); + XtVaSetValues(edbutton, XtNsensitive, False, NULL); + XtVaSetValues(ddbutton, XtNsensitive, False, NULL); + } else { + name = dmxConfigCurrentDisplay->name; + XmuSnprintf(nambuf, sizeof(nambuf), "%s", name ? name : ""); + XmuSnprintf(dimbuf, sizeof(dimbuf), "%dx%d%c%d%c%d", + dmxConfigCurrentDisplay->scrnWidth, + dmxConfigCurrentDisplay->scrnHeight, + dmxConfigCurrentDisplay->scrnXSign < 0 ? '-' : '+', + dmxConfigCurrentDisplay->scrnX, + dmxConfigCurrentDisplay->scrnYSign < 0 ? '-' : '+', + dmxConfigCurrentDisplay->scrnY); + XmuSnprintf(rtbuf, sizeof(dimbuf), "%dx%d%c%d%c%d", + dmxConfigCurrentDisplay->rootWidth, + dmxConfigCurrentDisplay->rootHeight, + dmxConfigCurrentDisplay->rootXSign < 0 ? '-' : '+', + dmxConfigCurrentDisplay->rootX, + dmxConfigCurrentDisplay->rootYSign < 0 ? '-' : '+', + dmxConfigCurrentDisplay->rootY); + XmuSnprintf(offbuf, sizeof(offbuf), "@%dx%d", + dmxConfigCurrentDisplay->rootXOrigin, + dmxConfigCurrentDisplay->rootYOrigin); + XtVaSetValues(namebox, XtNlabel, nambuf, XtNsensitive, True, NULL); + XtVaSetValues(dimbox, XtNlabel, dimbuf, XtNsensitive, True, NULL); + XtVaSetValues(rtbox, XtNlabel, rtbuf, XtNsensitive, True, NULL); + XtVaSetValues(origbox, XtNlabel, offbuf, XtNsensitive, True, NULL); + XtVaSetValues(edbutton, XtNsensitive, True, NULL); + XtVaSetValues(ddbutton, XtNsensitive, True, NULL); + } +} + +static void dmxConfigCanvasUpdate(void) +{ + DMXConfigSubPtr pt; + Display *dpy = XtDisplay(canvas); + Window win = XtWindow(canvas); + GContext gcontext = XGContextFromGC(dmxConfigGC); + XFontStruct *fs; + int w, h; + + XFillRectangle(dpy, win, dmxConfigGCRev, + 0, 0, dmxConfigWidgetWidth, dmxConfigWidgetHeight); + dmxConfigDataUpdate(); + if (!dmxConfigCurrent) return; + + w = scalex(dmxConfigWallWidth); + h = scaley(dmxConfigWallHeight); + if (w > dmxConfigWidgetWidth - 1) w = dmxConfigWidgetWidth - 1; + if (h > dmxConfigWidgetHeight - 1) h = dmxConfigWidgetHeight - 1; + XDrawRectangle(dpy, win, dmxConfigGC, 0, 0, w, h); + fs = XQueryFont(dpy, gcontext); + for (pt = dmxConfigCurrent->subentry; pt; pt = pt->next) { + int x, y, len; + int xo = 3, yo = fs->ascent + fs->descent + 2; + GC gc; + + if (pt->type != dmxConfigDisplay) continue; + gc = (pt->display == dmxConfigCurrentDisplay + ? dmxConfigGCHL + : dmxConfigGC); + x = scalex(pt->display->rootXOrigin); + y = scaley(pt->display->rootYOrigin); + w = scalex(pt->display->scrnWidth); + h = scaley(pt->display->scrnHeight); + len = pt->display->name ? strlen(pt->display->name) : 0; + if (x > dmxConfigWidgetWidth - 1) x = dmxConfigWidgetWidth - 1; + if (y > dmxConfigWidgetHeight - 1) y = dmxConfigWidgetHeight - 1; + XDrawRectangle(dpy, win, gc, x, y, w, h); + if (fs && len) { + while (len && XTextWidth(fs, pt->display->name, len) >= w - 2 * xo) + --len; + if (len) + XDrawString(dpy, win, gc, x+xo, y+yo, pt->display->name, len); + } + } + if (fs) XFreeFontInfo(NULL, fs, 0); +} + +static void dmxConfigCanvasDraw(Region region) +{ + Display *dpy = XtDisplay(canvas); + int maxWidth, maxHeight; + + dmxConfigCanvasGCs(); + if (region) { + XSetRegion(dpy, dmxConfigGC, region); + XSetRegion(dpy, dmxConfigGCRev, region); + XSetRegion(dpy, dmxConfigGCHL, region); + } + XtVaGetValues(canvas, + XtNwidth, &dmxConfigWidgetWidth, + XtNheight, &dmxConfigWidgetHeight, + NULL); + dmxConfigGetDims(&maxWidth, &maxHeight); + dmxConfigScaleX = (double)dmxConfigWidgetWidth / maxWidth; + dmxConfigScaleY = (double)dmxConfigWidgetHeight / maxHeight; + if (dmxConfigScaleX > dmxConfigScaleY) dmxConfigScaleX = dmxConfigScaleY; + if (dmxConfigScaleY > dmxConfigScaleX) dmxConfigScaleY = dmxConfigScaleX; + dmxConfigCanvasUpdate(); + if (region) { + XSetClipMask(dpy, dmxConfigGC, None); + XSetClipMask(dpy, dmxConfigGCRev, None); + XSetClipMask(dpy, dmxConfigGCHL, None); + } +} + +static void dmxConfigSelectCallback(Widget w, XtPointer closure, + XtPointer callData) +{ + dmxConfigCurrent = closure; + dmxConfigVirtualPrint(stdout, dmxConfigCurrent); + dmxConfigCanvasDraw(NULL); +} + +static void dmxConfigCopystrings(void) +{ + DMXConfigEntryPtr pt; + DMXConfigSubPtr sub; + + if (!dmxConfigCurrent) return; + + /* FIXME: this is all a per-config file + * memory leak */ + for (pt = dmxConfigEntry; pt; pt = pt->next) { + if (pt->type == dmxConfigVirtual) { + pt->virtual->name = XtNewString(pt->virtual->name + ? pt->virtual->name + : ""); + + for (sub = pt->virtual->subentry; sub; sub = sub->next) { + if (sub->type != dmxConfigDisplay) continue; + sub->display->name = XtNewString(sub->display->name + ? sub->display->name + : ""); + } + } + } +} + +static void dmxConfigGetValueString(char **d, Widget w) +{ + const char *tmp = XawDialogGetValueString(w); + if (*d) XtFree(*d); + *d = XtNewString(tmp); +} + +static void dmxConfigSetupCnamemenu(void) +{ + static Widget cnamemenu = NULL; + Widget w; + DMXConfigEntryPtr pt; + + if (cnamemenu) XtDestroyWidget(cnamemenu); + cnamemenu = NULL; + + if (!dmxConfigCurrent) return; + cnamemenu = XtVaCreatePopupShell("cnamemenu", simpleMenuWidgetClass, + cnamebox, + NULL); + + for (pt = dmxConfigEntry; pt; pt = pt->next) { + if (pt->type == dmxConfigVirtual) { + w = XtVaCreateManagedWidget(pt->virtual->name + ? pt->virtual->name + : "", + smeBSBObjectClass, cnamemenu, + NULL); + XtAddCallback(w, XtNcallback, + dmxConfigSelectCallback, pt->virtual); + } + } +} + +static void dmxConfigReadFile(void) +{ + FILE *str; + DMXConfigEntryPtr pt; + + if (!(str = fopen(dmxConfigFilename, "r"))) { + dmxLog(dmxWarning, "Unable to read configuration file %s\n", + dmxConfigFilename); + return; + } + yyin = str; + yydebug = 0; + yyparse(); + fclose(str); + dmxLog(dmxInfo, "Read configuration file %s\n", dmxConfigFilename); + + for (pt = dmxConfigEntry; pt; pt = pt->next) { + if (pt->type == dmxConfigVirtual) { + dmxConfigCurrent = pt->virtual; + break; + } + } + + + + if (XtIsRealized(canvas)) { + dmxConfigCopystrings(); + dmxConfigSetupCnamemenu(); + dmxConfigCanvasDraw(NULL); + } + dmxConfigVirtualPrint(stdout, dmxConfigCurrent); +} + +static void dmxConfigWriteFile(void) +{ + FILE *str; + + if (!(str = fopen(dmxConfigFilename, "w"))) { + dmxLog(dmxWarning, "Unable to write configuration file %s\n", + dmxConfigFilename); + return; + } + dmxConfigPrint(str, dmxConfigEntry); + fclose(str); +} + +static DMXConfigDisplayPtr dmxConfigFindDisplay(int x, int y) +{ + DMXConfigSubPtr pt; + + if (!dmxConfigCurrent) return NULL; + for (pt = dmxConfigCurrent->subentry; pt; pt = pt->next) { + DMXConfigDisplayPtr d = pt->display; + if (pt->type != dmxConfigDisplay) continue; + if (x >= scalex(d->rootXOrigin) + && x <= scalex(d->rootXOrigin + d->scrnWidth) + && y >= scaley(d->rootYOrigin) + && y <= scaley(d->rootYOrigin + d->scrnHeight)) return d; + } + return NULL; +} + +static void dmxConfigSetPopupPosition(Widget popup) +{ + Position x, y; + Window t1, t2; + int root_x, root_y; + int temp_x, temp_y; + unsigned int temp; + + + XtRealizeWidget(popup); + if (!XQueryPointer(XtDisplay(popup), XtWindow(popup), &t1, &t2, + &root_x, &root_y, &temp_x, &temp_y, &temp)) + root_x = root_y = 0; + + x = root_x - 5; + y = root_y - 5; + XtVaSetValues(popup, XtNx, x, XtNy, y, NULL); +} + +static void dmxConfigPlaceMenu(Widget w, XEvent *event, + String *params, Cardinal *num_params) +{ + dmxConfigSetPopupPosition(buttonpopup); +} + +static void dmxConfigMove(int deltaX, int deltaY) +{ + dmxConfigCurrentDisplay->rootXOrigin += deltaX; + dmxConfigCurrentDisplay->rootYOrigin += deltaY; + if (dmxConfigCurrentDisplay->rootXOrigin < 0) + dmxConfigCurrentDisplay->rootXOrigin = 0; + if (dmxConfigCurrentDisplay->rootYOrigin < 0) + dmxConfigCurrentDisplay->rootYOrigin = 0; + if (dmxConfigWallWidth && dmxConfigWallHeight) { + if (dmxConfigCurrentDisplay->rootXOrigin >= dmxConfigWallWidth) + dmxConfigCurrentDisplay->rootXOrigin = dmxConfigWallWidth - 1; + if (dmxConfigCurrentDisplay->rootYOrigin >= dmxConfigWallHeight) + dmxConfigCurrentDisplay->rootYOrigin = dmxConfigWallHeight - 1; + } + dmxConfigCanvasUpdate(); + dmxConfigNotSaved = 1; +} + +static void dmxConfigCanvasInput(Widget w, XtPointer closure, + XtPointer callData) +{ + XEvent *e = (XEvent *)callData; + DMXConfigDisplayPtr display = NULL; + + switch (e->type) { + case ButtonPress: + if (e->xbutton.button == Button1) { + dmxConfigGrabbed = 1; + dmxConfigGrabbedFine = 0; + dmxConfigGrabbedX = e->xbutton.x; + dmxConfigGrabbedY = e->xbutton.y; + } + if (e->xbutton.button == Button2) { + dmxConfigGrabbed = 1; + dmxConfigGrabbedFine = 1; + dmxConfigGrabbedX = e->xbutton.x; + dmxConfigGrabbedY = e->xbutton.y; + } + break; + case ButtonRelease: + if (e->xbutton.button == Button1) dmxConfigGrabbed = 0; + if (e->xbutton.button == Button2) dmxConfigGrabbed = 0; + break; + case MotionNotify: + if (dmxConfigGrabbed && dmxConfigCurrentDisplay) { + int deltaX = e->xmotion.x - dmxConfigGrabbedX; + int deltaY = e->xmotion.y - dmxConfigGrabbedY; + dmxConfigMove(dmxConfigGrabbedFine ? deltaX : unscalex(deltaX), + dmxConfigGrabbedFine ? deltaY : unscaley(deltaY)); + dmxConfigGrabbedX = e->xmotion.x; + dmxConfigGrabbedY = e->xmotion.y; + } else { + display = dmxConfigFindDisplay(e->xmotion.x, e->xmotion.y); + if (display != dmxConfigCurrentDisplay) { + dmxConfigCurrentDisplay = display; + dmxConfigCanvasUpdate(); + } + } + break; + case KeyPress: + switch (XLookupKeysym(&e->xkey, 0)) { + case XK_Right: dmxConfigMove(1,0); break; + case XK_Left: dmxConfigMove(-1,0); break; + case XK_Down: dmxConfigMove(0,1); break; + case XK_Up: dmxConfigMove(0,-1); break; + } + break; + } +} + +static void dmxConfigCanvasResize(Widget w, XtPointer closure, + XtPointer callData) +{ + dmxConfigCanvasDraw(NULL); +} + +static void dmxConfigCanvasExpose(Widget w, XtPointer closure, + XtPointer callData) +{ + CanvasExposeDataPtr data = (CanvasExposeDataPtr)callData; + + dmxConfigCanvasDraw(data->region); +} + +static void dmxConfigOpenCallback(Widget w, XtPointer closure, + XtPointer callData) +{ + dmxConfigState = dmxConfigStateOpen; + XtVaSetValues(okbutton, XtNlabel, "Open", NULL); + dmxConfigSetPopupPosition(openpopup); + XtPopup(openpopup, XtGrabExclusive); +} + +static void dmxConfigSaveCallback(Widget w, XtPointer closure, + XtPointer callData) +{ + dmxConfigState = dmxConfigStateSave; + XtVaSetValues(okbutton, XtNlabel, "Save", NULL); + dmxConfigSetPopupPosition(openpopup); + XtPopup(openpopup, XtGrabExclusive); +} + +static void dmxConfigOkCallback(Widget w, XtPointer closure, + XtPointer callData) +{ + dmxConfigGetValueString(&dmxConfigFilename, opendialog); + XtPopdown(openpopup); + if (dmxConfigState == dmxConfigStateOpen) dmxConfigReadFile(); + else dmxConfigWriteFile(); + dmxConfigNotSaved = 0; +} + +static void dmxConfigCanCallback(Widget w, XtPointer closure, + XtPointer callData) +{ + XtPopdown(openpopup); +} + +static void dmxConfigECCallback(Widget w, XtPointer closure, + XtPointer callData) +{ + char buf[256]; /* RATS: Only used in XmuSnprintf */ + + if (!dmxConfigCurrent) return; + dmxConfigSetPopupPosition(ecpopup); + XtVaSetValues(ecdialog0, XtNvalue, + dmxConfigCurrent->name ? dmxConfigCurrent->name : "", + NULL); + XmuSnprintf(buf, sizeof(buf), "%dx%d", + dmxConfigCurrent->width, dmxConfigCurrent->height); + XtVaSetValues(ecdialog1, XtNvalue, buf, NULL); + XtPopup(ecpopup, XtGrabExclusive); +} + +static void dmxConfigNCCallback(Widget w, XtPointer closure, + XtPointer callData) +{ + int width = 1280*2, height = 1024*2; + + if (dmxConfigCurrent) { + width = dmxConfigCurrent->width; + height = dmxConfigCurrent->height; + } + + dmxConfigCurrent = dmxConfigCreateVirtual(NULL, NULL, NULL, + NULL, NULL, NULL); + dmxConfigNewVirtual = dmxConfigCurrent; + dmxConfigCurrent->width = width; + dmxConfigCurrent->height = height; + dmxConfigEntry = dmxConfigAddEntry(dmxConfigEntry, dmxConfigVirtual, NULL, + dmxConfigCurrent); + dmxConfigECCallback(w, closure, callData); +} + +static void dmxConfigDCCallback(Widget w, XtPointer closure, + XtPointer callData) +{ + DMXConfigEntryPtr pt; + + if (!dmxConfigEntry) return; + if (dmxConfigEntry + && dmxConfigEntry->type == dmxConfigVirtual + && dmxConfigEntry->virtual == dmxConfigCurrent) { + dmxConfigEntry = dmxConfigEntry->next; + } else { + for (pt = dmxConfigEntry; pt && pt->next; pt = pt->next) + if (pt->next->type == dmxConfigVirtual + && pt->next->virtual == dmxConfigCurrent) { + pt->next = pt->next->next; + break; + } + } + dmxConfigFreeVirtual(dmxConfigCurrent); + dmxConfigCurrent = NULL; + dmxConfigCurrentDisplay = NULL; + + /* Make the first entry current */ + for (pt = dmxConfigEntry; pt; pt = pt->next) { + if (pt->type == dmxConfigVirtual) { + dmxConfigCurrent = pt->virtual; + break; + } + } + + dmxConfigSetupCnamemenu(); + dmxConfigCanvasDraw(NULL); +} + +static void dmxConfigECOkCallback(Widget w, XtPointer closure, + XtPointer callData) +{ + const char *value; + char *endpt; + + dmxConfigGetValueString((char **)&dmxConfigCurrent->name, ecdialog0); + value = XawDialogGetValueString(ecdialog1); + dmxConfigCurrent->width = strtol(value, &endpt, 10); + dmxConfigCurrent->height = strtol(endpt+1, NULL, 10); + XtPopdown(ecpopup); + dmxConfigCurrentDisplay = NULL; + dmxConfigNewVirtual = NULL; + dmxConfigSetupCnamemenu(); + dmxConfigCanvasDraw(NULL); + dmxConfigNotSaved = 1; +} + +static void dmxConfigECCanCallback(Widget w, XtPointer closure, + XtPointer callData) +{ + if (dmxConfigNewVirtual) dmxConfigDCCallback(w, closure, callData); + dmxConfigNewVirtual = NULL; + XtPopdown(ecpopup); +} + +static void dmxConfigEDCallback(Widget w, XtPointer closure, + XtPointer callData) +{ + char buf[256]; /* RATS: Only used in XmuSnprintf */ + + if (!dmxConfigCurrent || !dmxConfigCurrentDisplay) return; + dmxConfigSetPopupPosition(edpopup); + XtVaSetValues(eddialog0, XtNvalue, + dmxConfigCurrentDisplay->name + ? dmxConfigCurrentDisplay->name + : "", + NULL); + XmuSnprintf(buf, sizeof(buf), "%dx%d%c%d%c%d", + dmxConfigCurrentDisplay->scrnWidth, + dmxConfigCurrentDisplay->scrnHeight, + dmxConfigCurrentDisplay->scrnXSign < 0 ? '-' : '+', + dmxConfigCurrentDisplay->scrnY, + dmxConfigCurrentDisplay->scrnYSign < 0 ? '-' : '+', + dmxConfigCurrentDisplay->scrnY); + XtVaSetValues(eddialog1, XtNvalue, buf, NULL); + XmuSnprintf(buf, sizeof(buf), "@%dx%d", + dmxConfigCurrentDisplay->rootXOrigin, + dmxConfigCurrentDisplay->rootYOrigin); + XtVaSetValues(eddialog2, XtNvalue, buf, NULL); + XtPopup(edpopup, XtGrabExclusive); +} + +static void dmxConfigNDCallback(Widget w, XtPointer closure, + XtPointer callData) +{ + int width = 1280, height = 1024; + + if (!dmxConfigCurrent) return; + if (dmxConfigCurrentDisplay) { + width = dmxConfigCurrentDisplay->scrnWidth; + height = dmxConfigCurrentDisplay->scrnHeight; + } + dmxConfigCurrentDisplay = dmxConfigCreateDisplay(NULL, NULL, NULL, + NULL, NULL); + dmxConfigNewDisplay = dmxConfigCurrentDisplay; + dmxConfigCurrentDisplay->scrnWidth = width; + dmxConfigCurrentDisplay->scrnHeight = height; + + dmxConfigCurrent->subentry + = dmxConfigAddSub(dmxConfigCurrent->subentry, + dmxConfigSubDisplay(dmxConfigCurrentDisplay)); + dmxConfigEDCallback(w, closure, callData); +} + +static void dmxConfigDDCallback(Widget w, XtPointer closure, + XtPointer callData) +{ + DMXConfigSubPtr pt; + + if (!dmxConfigCurrent || !dmxConfigCurrentDisplay) return; + /* First */ + if (dmxConfigCurrent->subentry + && dmxConfigCurrent->subentry->type == dmxConfigDisplay + && dmxConfigCurrent->subentry->display == dmxConfigCurrentDisplay) { + dmxConfigCurrent->subentry = dmxConfigCurrent->subentry->next; + } else { + for (pt = dmxConfigCurrent->subentry; pt && pt->next; pt = pt->next) + if (pt->next->type == dmxConfigDisplay + && pt->next->display == dmxConfigCurrentDisplay) { + pt->next = pt->next->next; + break; + } + } + dmxConfigFreeDisplay(dmxConfigCurrentDisplay); + dmxConfigCurrentDisplay = NULL; + dmxConfigSetupCnamemenu(); + dmxConfigCanvasDraw(NULL); +} + +static void dmxConfigAboutCallback(Widget w, XtPointer closure, + XtPointer callData) +{ + dmxConfigSetPopupPosition(aboutpopup); + XtPopup(aboutpopup, XtGrabExclusive); +} + +static void dmxConfigAboutOkCallback(Widget w, XtPointer closure, + XtPointer CallData) +{ + XtPopdown(aboutpopup); +} + +static void dmxConfigQuitCallback(Widget w, XtPointer closure, + XtPointer callData) +{ + if (dmxConfigNotSaved) { + dmxConfigSetPopupPosition(quitpopup); + XtPopup(quitpopup, XtGrabExclusive); + return; + } + exit(0); +} + +static void dmxConfigQuitOkCallback(Widget w, XtPointer closure, + XtPointer callData) +{ + XtPopdown(quitpopup); + exit(0); +} + +static void dmxConfigQuitCanCallback(Widget w, XtPointer closure, + XtPointer callData) +{ + XtPopdown(quitpopup); +} + +static void dmxConfigEDOkCallback(Widget w, XtPointer closure, + XtPointer callData) +{ + char *value; + char *endpt; + + dmxConfigNewDisplay = NULL; + dmxConfigGetValueString((char **)&dmxConfigCurrentDisplay->name, + eddialog0); + value = XawDialogGetValueString(eddialog1); + if (*value == '-' || *value == '+') { + dmxConfigCurrentDisplay->scrnWidth = 0; + dmxConfigCurrentDisplay->scrnHeight = 0; + endpt = value; + } else { + dmxConfigCurrentDisplay->scrnWidth = strtol(value, &endpt, 10); + dmxConfigCurrentDisplay->scrnHeight = strtol(endpt+1, &endpt, 10); + } + if (*endpt) { + dmxConfigCurrentDisplay->scrnXSign = (*endpt == '-') ? -1 : 1; + dmxConfigCurrentDisplay->scrnX = strtol(endpt+1, &endpt, 10); + dmxConfigCurrentDisplay->scrnYSign = (*endpt == '-') ? -1 : 1; + dmxConfigCurrentDisplay->scrnY = strtol(endpt+1, NULL, 10); + } + if (dmxConfigCurrentDisplay->scrnX < 0) + dmxConfigCurrentDisplay->scrnX = -dmxConfigCurrentDisplay->scrnX; + if (dmxConfigCurrentDisplay->scrnY < 0) + dmxConfigCurrentDisplay->scrnY = -dmxConfigCurrentDisplay->scrnY; + value = XawDialogGetValueString(eddialog2); + dmxConfigCurrentDisplay->rootXOrigin = strtol(value+1, &endpt, 10); + dmxConfigCurrentDisplay->rootYOrigin = strtol(endpt+1, NULL, 10); + XtPopdown(edpopup); + dmxConfigSetupCnamemenu(); + dmxConfigCanvasDraw(NULL); + dmxConfigNotSaved = 1; +} + +static void dmxConfigEDCanCallback(Widget w, XtPointer closure, + XtPointer callData) +{ + if (dmxConfigNewDisplay) dmxConfigDDCallback(w, closure, callData); + dmxConfigNewDisplay = NULL; + XtPopdown(edpopup); +} + +static void dmxConfigOkAction(Widget w, XEvent *event, + String *params, Cardinal *num_params) +{ + Widget p = XtParent(w); + Widget t; + + if (p == opendialog) dmxConfigOkCallback(w, NULL, NULL); + + if (p == ecdialog0) { + t = XtNameToWidget(ecdialog1, "value"); + XWarpPointer(XtDisplay(t), None, XtWindow(t), 0, 0, 0, 0, 0, 10); + } + if (p == ecdialog1) dmxConfigECOkCallback(w, NULL, NULL); + + if (p == eddialog0) { + t = XtNameToWidget(eddialog1, "value"); + XWarpPointer(XtDisplay(t), None, XtWindow(t), 0, 0, 0, 0, 0, 10); + } + if (p == eddialog1) { + t = XtNameToWidget(eddialog2, "value"); + XWarpPointer(XtDisplay(t), None, XtWindow(t), 0, 0, 0, 0, 0, 10); + } + if (p == eddialog2) dmxConfigEDOkCallback(w, NULL, NULL); +} + +int main(int argc, char **argv) +{ + XtAppContext appContext; + Widget toplevel; + Widget parent, menubox, bottombox, databox, canvasbox; + Widget filebutton, helpbutton; + Widget filemenu, openbutton, savebutton, quitbutton; + Widget helpmenu, aboutbutton, aboutbox, abouttext, aboutok; + Widget quitbox, quittext, quitok, quitcan; + Widget ncbutton; + Widget canbutton; + Widget ecbox, ecokbutton, eccanbutton; + Widget edbox, edokbutton; + Widget edcanbutton; + /* FIXME: add meta-i, ctrl,meta-z,v? */ + const char *opentrans = "<Key>Return: openOk()\n\ + <Key>Linefeed: openOk()\n\ + Ctrl<Key>M: openOk()\n\ + Ctrl<Key>J: openOk()\n\ + Ctrl<Key>O: noop()\n\ + Ctrl<Key>N: noop()\n\ + Ctrl<Key>P: noop()"; + const char *canvastrans = + "<Btn3Down>: placeMenu() XtMenuPopup(buttonpopup)"; + XtActionsRec actiontable[] = { + { "openOk", dmxConfigOkAction }, + { "placeMenu", dmxConfigPlaceMenu }, + { "noop", NULL } + }; + + dmxConfigFilename = XtNewString((argc >= 2) ? argv[1] : ""); + + toplevel = XtVaAppInitialize(&appContext, "XDmxconfig", + NULL, 0, + &argc, argv, + NULL, + NULL); + + /* Main boxes */ + parent = XtVaCreateManagedWidget("parent", formWidgetClass, toplevel, + XtNorientation, XtorientVertical, + XtNwidth, DMX_MAIN_WIDTH, + XtNheight, DMX_MAIN_HEIGHT, + NULL); + menubox = XtVaCreateManagedWidget("menubox", boxWidgetClass, parent, + XtNborderWidth, 0, + XtNorientation, XtorientHorizontal, + XtNtop, XtChainTop, + NULL); + bottombox = XtVaCreateManagedWidget("bottombox", formWidgetClass, parent, + XtNborderWidth, 0, + XtNfromVert, menubox, + XtNorientation, XtorientHorizontal, + NULL); + databox = XtVaCreateManagedWidget("databox", formWidgetClass, + bottombox, + XtNborderWidth, 0, + XtNhorizDistance, 0, + XtNwidth, DMX_DATA_WIDTH, + XtNheight, DMX_DATA_HEIGHT, + XtNleft, XtChainLeft, + XtNorientation, XtorientVertical, + NULL); + + /* Data */ + cnamebox = XtVaCreateManagedWidget("cnamebox", menuButtonWidgetClass, + databox, + XtNtop, XtChainTop, + XtNjustify, XtJustifyLeft, + XtNwidth, DMX_DATA_WIDTH, + XtNlabel, "", + XtNmenuName, "cnamemenu", + NULL); + cdimbox = XtVaCreateManagedWidget("cdimbox", labelWidgetClass, + databox, + XtNfromVert, cnamebox, + XtNjustify, XtJustifyLeft, + XtNwidth, DMX_DATA_WIDTH, + XtNlabel, "", + NULL); + namebox = XtVaCreateManagedWidget("namebox", labelWidgetClass, databox, + XtNfromVert, cdimbox, + XtNjustify, XtJustifyLeft, + XtNwidth, DMX_DATA_WIDTH, + XtNlabel, "", + NULL); + dimbox = XtVaCreateManagedWidget("dimbox", labelWidgetClass, + databox, + XtNfromVert, namebox, + XtNjustify, XtJustifyLeft, + XtNwidth, DMX_DATA_WIDTH, + XtNlabel, "", + NULL); + rtbox = XtVaCreateManagedWidget("rtbox", labelWidgetClass, + databox, + XtNfromVert, dimbox, + XtNjustify, XtJustifyLeft, + XtNwidth, DMX_DATA_WIDTH, + XtNlabel, "", + NULL); + origbox = XtVaCreateManagedWidget("origbox", labelWidgetClass, + databox, + XtNfromVert, rtbox, + XtNjustify, XtJustifyLeft, + XtNwidth, DMX_DATA_WIDTH, + XtNlabel, "", + NULL); + + /* Canvas */ + canvasbox = XtVaCreateManagedWidget("canvasbox", boxWidgetClass, + bottombox, + XtNborderWidth, 0, + XtNwidth, DMX_CANVAS_WIDTH, + XtNheight, DMX_CANVAS_HEIGHT, + XtNfromHoriz, databox, + NULL); + + canvas = XtVaCreateManagedWidget("canvas", canvasWidgetClass, + canvasbox, + XtNwidth, DMX_CANVAS_WIDTH, + XtNheight, DMX_CANVAS_HEIGHT, + NULL); + + + /* Main menu buttons */ + filebutton = XtVaCreateManagedWidget("File", menuButtonWidgetClass, + menubox, + XtNmenuName, "filemenu", + NULL); + helpbutton = XtVaCreateManagedWidget("Help", menuButtonWidgetClass, + menubox, + XtNmenuName, "helpmenu", + NULL); + + + /* File submenu buttons */ + filemenu = XtVaCreatePopupShell("filemenu", simpleMenuWidgetClass, + filebutton, NULL); + openbutton = XtVaCreateManagedWidget("Open File", smeBSBObjectClass, + filemenu, NULL); + savebutton = XtVaCreateManagedWidget("Save File", smeBSBObjectClass, + filemenu, + NULL); + ncbutton = XtVaCreateManagedWidget("New Global", smeBSBObjectClass, + filemenu, NULL); + ecbutton = XtVaCreateManagedWidget("Edit Global", smeBSBObjectClass, + filemenu, + NULL); + dcbutton = XtVaCreateManagedWidget("Delete Global", smeBSBObjectClass, + filemenu, + NULL); + ndbutton0 = XtVaCreateManagedWidget("New Display", smeBSBObjectClass, + filemenu, + NULL); + quitbutton = XtVaCreateManagedWidget("Quit", smeBSBObjectClass, + filemenu, NULL); + + /* Help submenu button */ + helpmenu = XtVaCreatePopupShell("helpmenu", simpleMenuWidgetClass, + helpbutton, NULL); + aboutbutton = XtVaCreateManagedWidget("About", smeBSBObjectClass, + helpmenu, NULL); + + /* Open popup */ + openpopup = XtVaCreatePopupShell("openpopup", transientShellWidgetClass, + toplevel, NULL); + opendialog = XtVaCreateManagedWidget("opendialog", dialogWidgetClass, + openpopup, + XtNlabel, "Filename: ", + XtNvalue, dmxConfigFilename, + NULL); + okbutton = XtVaCreateManagedWidget("Open", commandWidgetClass, + opendialog, NULL); + canbutton = XtVaCreateManagedWidget("Cancel", commandWidgetClass, + opendialog, NULL); + + /* EC popup */ + ecpopup = XtVaCreatePopupShell("ecpopup", transientShellWidgetClass, + toplevel, NULL); + ecbox = XtVaCreateManagedWidget("ecbox", boxWidgetClass, + ecpopup, NULL); + ecdialog0 = XtVaCreateManagedWidget("ecdialog0", dialogWidgetClass, + ecbox, + XtNlabel, "Name: ", + XtNvalue, "", + NULL); + ecdialog1 = XtVaCreateManagedWidget("ecdialog1", dialogWidgetClass, + ecbox, + XtNlabel, "Dimension: ", + XtNvalue, "", + NULL); + ecokbutton = XtVaCreateManagedWidget("OK", commandWidgetClass, + ecbox, NULL); + eccanbutton = XtVaCreateManagedWidget("Cancel", commandWidgetClass, + ecbox, NULL); + + /* ED popup */ + edpopup = XtVaCreatePopupShell("edpopup", transientShellWidgetClass, + toplevel, NULL); + edbox = XtVaCreateManagedWidget("edbox", boxWidgetClass, + edpopup, NULL); + eddialog0 = XtVaCreateManagedWidget("eddialog0", dialogWidgetClass, + edbox, + XtNlabel, "Display Name: ", + XtNvalue, "", + NULL); + eddialog1 = XtVaCreateManagedWidget("eddialog1", dialogWidgetClass, + edbox, + XtNlabel, "Geometry: ", + XtNvalue, "", + NULL); + eddialog2 = XtVaCreateManagedWidget("eddialog2", dialogWidgetClass, + edbox, + XtNlabel, "Offset: ", + XtNvalue, "", + NULL); + edokbutton = XtVaCreateManagedWidget("OK", commandWidgetClass, + edbox, NULL); + edcanbutton = XtVaCreateManagedWidget("Cancel", commandWidgetClass, + edbox, NULL); + + /* About popup */ + aboutpopup = XtVaCreatePopupShell("aboutpopup",transientShellWidgetClass, + toplevel, NULL); + aboutbox = XtVaCreateManagedWidget("aboutbox", boxWidgetClass, + aboutpopup, NULL); + abouttext = XtVaCreateManagedWidget("abouttext", labelWidgetClass, + aboutbox, + XtNlabel, DMX_INFO, + NULL); + aboutok = XtVaCreateManagedWidget("OK", commandWidgetClass, + aboutbox, NULL); + + /* Quit popup */ + quitpopup = XtVaCreatePopupShell("quitpopup",transientShellWidgetClass, + toplevel, NULL); + quitbox = XtVaCreateManagedWidget("quitbox", boxWidgetClass, + quitpopup, NULL); + quittext = XtVaCreateManagedWidget("quittext", labelWidgetClass, + quitbox, + XtNlabel, + "Changes to the configuration\n" + "been made that have not yet\n" + "been saved. Do you want to\n" + "quit without saving?", + NULL); + quitok = XtVaCreateManagedWidget("Quit WITHOUT Saving", + commandWidgetClass, + quitbox, NULL); + quitcan = XtVaCreateManagedWidget("Continue Editing", + commandWidgetClass, + quitbox, NULL); + + /* Button popup */ + buttonpopup = XtVaCreatePopupShell("buttonpopup", simpleMenuWidgetClass, + toplevel, NULL); + ndbutton1 = XtVaCreateManagedWidget("New Display", smeBSBObjectClass, + buttonpopup, + NULL); + edbutton = XtVaCreateManagedWidget("Edit Display", smeBSBObjectClass, + buttonpopup, + NULL); + ddbutton = XtVaCreateManagedWidget("Delete Display", smeBSBObjectClass, + buttonpopup, + NULL); + + /* Callbacks */ + XtAddCallback(openbutton, XtNcallback, dmxConfigOpenCallback, NULL); + XtAddCallback(savebutton, XtNcallback, dmxConfigSaveCallback, NULL); + XtAddCallback(okbutton, XtNcallback, dmxConfigOkCallback, NULL); + XtAddCallback(canbutton, XtNcallback, dmxConfigCanCallback, NULL); + + XtAppAddActions(appContext, actiontable, XtNumber(actiontable)); + XtOverrideTranslations(canvas, XtParseTranslationTable(canvastrans)); + XtOverrideTranslations(XtNameToWidget(opendialog, "value"), + XtParseTranslationTable(opentrans)); + XtOverrideTranslations(XtNameToWidget(ecdialog0, "value"), + XtParseTranslationTable(opentrans)); + XtOverrideTranslations(XtNameToWidget(ecdialog1, "value"), + XtParseTranslationTable(opentrans)); + XtOverrideTranslations(XtNameToWidget(eddialog0, "value"), + XtParseTranslationTable(opentrans)); + XtOverrideTranslations(XtNameToWidget(eddialog1, "value"), + XtParseTranslationTable(opentrans)); + XtOverrideTranslations(XtNameToWidget(eddialog2, "value"), + XtParseTranslationTable(opentrans)); + + XtAddCallback(ncbutton, XtNcallback, dmxConfigNCCallback, NULL); + XtAddCallback(ecbutton, XtNcallback, dmxConfigECCallback, NULL); + XtAddCallback(ecokbutton, XtNcallback, dmxConfigECOkCallback, NULL); + XtAddCallback(eccanbutton, XtNcallback, dmxConfigECCanCallback, NULL); + XtAddCallback(dcbutton, XtNcallback, dmxConfigDCCallback, NULL); + + XtAddCallback(ndbutton0, XtNcallback, dmxConfigNDCallback, NULL); + XtAddCallback(ndbutton1, XtNcallback, dmxConfigNDCallback, NULL); + XtAddCallback(edbutton, XtNcallback, dmxConfigEDCallback, NULL); + XtAddCallback(ddbutton, XtNcallback, dmxConfigDDCallback, NULL); + XtAddCallback(edokbutton, XtNcallback, dmxConfigEDOkCallback, NULL); + XtAddCallback(edcanbutton, XtNcallback, dmxConfigEDCanCallback, NULL); + + XtAddCallback(aboutbutton, XtNcallback, dmxConfigAboutCallback, NULL); + XtAddCallback(aboutok, XtNcallback, dmxConfigAboutOkCallback, NULL); + XtAddCallback(quitok, XtNcallback, dmxConfigQuitOkCallback, NULL); + XtAddCallback(quitcan, XtNcallback, dmxConfigQuitCanCallback, NULL); + + XtAddCallback(quitbutton, XtNcallback, dmxConfigQuitCallback, NULL); + + XtAddCallback(canvas, XtNcallback, dmxConfigCanvasInput, NULL); + XtAddCallback(canvas, XtNcanvasExposeCallback, dmxConfigCanvasExpose,NULL); + XtAddCallback(canvas, XtNcanvasResizeCallback, dmxConfigCanvasResize,NULL); + + if (dmxConfigFilename) dmxConfigReadFile(); + + XtRealizeWidget(toplevel); + dmxConfigCopystrings(); + dmxConfigSetupCnamemenu(); + XtAppMainLoop(appContext); + return 0; +} diff --git a/xorg-server/hw/dmx/config/xdmxconfig.man b/xorg-server/hw/dmx/config/xdmxconfig.man new file mode 100644 index 000000000..dcceea0e3 --- /dev/null +++ b/xorg-server/hw/dmx/config/xdmxconfig.man @@ -0,0 +1,63 @@ +.\" $XFree86$ +.\" Copyright 2002 Red Hat Inc., Durham, North Carolina. +.\" 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 on 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 +.\" NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR 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. +.\" +.\" Authors: +.\" Rickard E. (Rik) Faith <faith@redhat.com> +.\" +.TH xdmxconfig 1 __vendorversion__ +.SH NAME +xdmxconfig - a graphical configuration tool for Xdmx configuration files +.SH SYNOPSIS +.B xdmxconfig +[filename] +.SH DESCRIPTION +.I xdmxconfig +reads, edits, and writes configuration files for the Xdmx server. The +grammar for the configuration file is specified in the Xdmx(1) manual +page. +.PP +To start from scratch, create a "New Global" and specify the name and +overall dimensions for the configuration. Then use "New Display" to +enter more displays. +.PP +If there is more than one configuration, the configuration name button +will bring up a selection menu. +.PP +In the right-hand pannel, the left mouse button will move the +highlighted display at "tool resolution"; the middle mouse button will +move the highlighted display by a single pixel (at "wall resolution"); +and the right mouse button will bring up a menu allowing the highlighted +display to be edited or deleted. The arrow keys will also move the +highlighted display by a single pixel. +.SH BUGS +Currently, entries with the +.B wall +keyword are not editable, but will be preserved in the new output file. +The tool will quit when requested by the user, even if a configuration +file has not been written out (i.e., without warning). The menu +interaction should be improved (menu entries that don't currently work +should be greyed-out, for example). The Help button does not work. +.SH "SEE ALSO" +Xdmx(1), vdltodmx(1) |