aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw/xprint/pcl
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2009-06-28 22:07:26 +0000
committermarha <marha@users.sourceforge.net>2009-06-28 22:07:26 +0000
commit3562e78743202e43aec8727005182a2558117eca (patch)
tree8f9113a77d12470c5c851a2a8e4cb02e89df7d43 /xorg-server/hw/xprint/pcl
downloadvcxsrv-3562e78743202e43aec8727005182a2558117eca.tar.gz
vcxsrv-3562e78743202e43aec8727005182a2558117eca.tar.bz2
vcxsrv-3562e78743202e43aec8727005182a2558117eca.zip
Checked in the following released items:
xkeyboard-config-1.4.tar.gz ttf-bitstream-vera-1.10.tar.gz font-alias-1.0.1.tar.gz font-sun-misc-1.0.0.tar.gz font-sun-misc-1.0.0.tar.gz font-sony-misc-1.0.0.tar.gz font-schumacher-misc-1.0.0.tar.gz font-mutt-misc-1.0.0.tar.gz font-misc-misc-1.0.0.tar.gz font-misc-meltho-1.0.0.tar.gz font-micro-misc-1.0.0.tar.gz font-jis-misc-1.0.0.tar.gz font-isas-misc-1.0.0.tar.gz font-dec-misc-1.0.0.tar.gz font-daewoo-misc-1.0.0.tar.gz font-cursor-misc-1.0.0.tar.gz font-arabic-misc-1.0.0.tar.gz font-winitzki-cyrillic-1.0.0.tar.gz font-misc-cyrillic-1.0.0.tar.gz font-cronyx-cyrillic-1.0.0.tar.gz font-screen-cyrillic-1.0.1.tar.gz font-xfree86-type1-1.0.1.tar.gz font-adobe-utopia-type1-1.0.1.tar.gz font-ibm-type1-1.0.0.tar.gz font-bitstream-type1-1.0.0.tar.gz font-bitstream-speedo-1.0.0.tar.gz font-bh-ttf-1.0.0.tar.gz font-bh-type1-1.0.0.tar.gz font-bitstream-100dpi-1.0.0.tar.gz font-bh-lucidatypewriter-100dpi-1.0.0.tar.gz font-bh-100dpi-1.0.0.tar.gz font-adobe-utopia-100dpi-1.0.1.tar.gz font-adobe-100dpi-1.0.0.tar.gz font-util-1.0.1.tar.gz font-bitstream-75dpi-1.0.0.tar.gz font-bh-lucidatypewriter-75dpi-1.0.0.tar.gz font-adobe-utopia-75dpi-1.0.1.tar.gz font-bh-75dpi-1.0.0.tar.gz bdftopcf-1.0.1.tar.gz font-adobe-75dpi-1.0.0.tar.gz mkfontscale-1.0.6.tar.gz openssl-0.9.8k.tar.gz bigreqsproto-1.0.2.tar.gz xtrans-1.2.2.tar.gz resourceproto-1.0.2.tar.gz inputproto-1.4.4.tar.gz compositeproto-0.4.tar.gz damageproto-1.1.0.tar.gz zlib-1.2.3.tar.gz xkbcomp-1.0.5.tar.gz freetype-2.3.9.tar.gz pthreads-w32-2-8-0-release.tar.gz pixman-0.12.0.tar.gz kbproto-1.0.3.tar.gz evieext-1.0.2.tar.gz fixesproto-4.0.tar.gz recordproto-1.13.2.tar.gz randrproto-1.2.2.tar.gz scrnsaverproto-1.1.0.tar.gz renderproto-0.9.3.tar.gz xcmiscproto-1.1.2.tar.gz fontsproto-2.0.2.tar.gz xextproto-7.0.3.tar.gz xproto-7.0.14.tar.gz libXdmcp-1.0.2.tar.gz libxkbfile-1.0.5.tar.gz libfontenc-1.0.4.tar.gz libXfont-1.3.4.tar.gz libX11-1.1.5.tar.gz libXau-1.0.4.tar.gz libxcb-1.1.tar.gz xorg-server-1.5.3.tar.gz
Diffstat (limited to 'xorg-server/hw/xprint/pcl')
-rw-r--r--xorg-server/hw/xprint/pcl/Makefile.am6
-rw-r--r--xorg-server/hw/xprint/pcl/Makefile.am.inc27
-rw-r--r--xorg-server/hw/xprint/pcl/Makefile.in814
-rw-r--r--xorg-server/hw/xprint/pcl/Pcl.h619
-rw-r--r--xorg-server/hw/xprint/pcl/PclArc.c268
-rw-r--r--xorg-server/hw/xprint/pcl/PclArea.c436
-rw-r--r--xorg-server/hw/xprint/pcl/PclAttVal.c206
-rw-r--r--xorg-server/hw/xprint/pcl/PclAttr.c86
-rw-r--r--xorg-server/hw/xprint/pcl/PclColor.c851
-rw-r--r--xorg-server/hw/xprint/pcl/PclCursor.c113
-rw-r--r--xorg-server/hw/xprint/pcl/PclDef.h67
-rw-r--r--xorg-server/hw/xprint/pcl/PclFonts.c72
-rw-r--r--xorg-server/hw/xprint/pcl/PclGC.c971
-rw-r--r--xorg-server/hw/xprint/pcl/PclInit.c575
-rw-r--r--xorg-server/hw/xprint/pcl/PclLine.c314
-rw-r--r--xorg-server/hw/xprint/pcl/PclMisc.c301
-rw-r--r--xorg-server/hw/xprint/pcl/PclPixel.c159
-rw-r--r--xorg-server/hw/xprint/pcl/PclPolygon.c351
-rw-r--r--xorg-server/hw/xprint/pcl/PclPrint.c709
-rw-r--r--xorg-server/hw/xprint/pcl/PclSFonts.c427
-rw-r--r--xorg-server/hw/xprint/pcl/PclSFonts.h115
-rw-r--r--xorg-server/hw/xprint/pcl/PclSpans.c137
-rw-r--r--xorg-server/hw/xprint/pcl/PclText.c934
-rw-r--r--xorg-server/hw/xprint/pcl/PclWindow.c209
-rw-r--r--xorg-server/hw/xprint/pcl/Pclmap.h210
25 files changed, 8977 insertions, 0 deletions
diff --git a/xorg-server/hw/xprint/pcl/Makefile.am b/xorg-server/hw/xprint/pcl/Makefile.am
new file mode 100644
index 000000000..90133e8e2
--- /dev/null
+++ b/xorg-server/hw/xprint/pcl/Makefile.am
@@ -0,0 +1,6 @@
+noinst_LTLIBRARIES = libpcl.la
+
+PCL_DRIVER = -DXP_PCL_COLOR
+
+include ../pcl/Makefile.am.inc
+
diff --git a/xorg-server/hw/xprint/pcl/Makefile.am.inc b/xorg-server/hw/xprint/pcl/Makefile.am.inc
new file mode 100644
index 000000000..c3af606ee
--- /dev/null
+++ b/xorg-server/hw/xprint/pcl/Makefile.am.inc
@@ -0,0 +1,27 @@
+INCLUDES = -I$(top_srcdir)/hw/xprint
+
+AM_CFLAGS = @DIX_CFLAGS@ @XPRINT_CFLAGS@ -D_XP_PRINT_SERVER_ $(PCL_DRIVER)
+
+libpcl_la_SOURCES = \
+ $(srcdir)/../pcl/PclArc.c \
+ $(srcdir)/../pcl/PclArea.c \
+ $(srcdir)/../pcl/PclAttr.c \
+ $(srcdir)/../pcl/PclAttVal.c \
+ $(srcdir)/../pcl/PclColor.c \
+ $(srcdir)/../pcl/PclCursor.c \
+ $(srcdir)/../pcl/PclDef.h \
+ $(srcdir)/../pcl/PclFonts.c \
+ $(srcdir)/../pcl/PclGC.c \
+ $(srcdir)/../pcl/Pcl.h \
+ $(srcdir)/../pcl/PclInit.c \
+ $(srcdir)/../pcl/PclLine.c \
+ $(srcdir)/../pcl/Pclmap.h \
+ $(srcdir)/../pcl/PclMisc.c \
+ $(srcdir)/../pcl/PclPixel.c \
+ $(srcdir)/../pcl/PclPolygon.c \
+ $(srcdir)/../pcl/PclPrint.c \
+ $(srcdir)/../pcl/PclSFonts.c \
+ $(srcdir)/../pcl/PclSFonts.h \
+ $(srcdir)/../pcl/PclSpans.c \
+ $(srcdir)/../pcl/PclText.c \
+ $(srcdir)/../pcl/PclWindow.c
diff --git a/xorg-server/hw/xprint/pcl/Makefile.in b/xorg-server/hw/xprint/pcl/Makefile.in
new file mode 100644
index 000000000..4a6c567c6
--- /dev/null
+++ b/xorg-server/hw/xprint/pcl/Makefile.in
@@ -0,0 +1,814 @@
+# 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@
+DIST_COMMON = $(srcdir)/../pcl/Makefile.am.inc $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in
+subdir = hw/xprint/pcl
+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 =
+LTLIBRARIES = $(noinst_LTLIBRARIES)
+libpcl_la_LIBADD =
+am_libpcl_la_OBJECTS = PclArc.lo PclArea.lo PclAttr.lo PclAttVal.lo \
+ PclColor.lo PclCursor.lo PclFonts.lo PclGC.lo PclInit.lo \
+ PclLine.lo PclMisc.lo PclPixel.lo PclPolygon.lo PclPrint.lo \
+ PclSFonts.lo PclSpans.lo PclText.lo PclWindow.lo
+libpcl_la_OBJECTS = $(am_libpcl_la_OBJECTS)
+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 $@
+SOURCES = $(libpcl_la_SOURCES)
+DIST_SOURCES = $(libpcl_la_SOURCES)
+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_LTLIBRARIES = libpcl.la
+PCL_DRIVER = -DXP_PCL_COLOR
+INCLUDES = -I$(top_srcdir)/hw/xprint
+AM_CFLAGS = @DIX_CFLAGS@ @XPRINT_CFLAGS@ -D_XP_PRINT_SERVER_ $(PCL_DRIVER)
+libpcl_la_SOURCES = \
+ $(srcdir)/../pcl/PclArc.c \
+ $(srcdir)/../pcl/PclArea.c \
+ $(srcdir)/../pcl/PclAttr.c \
+ $(srcdir)/../pcl/PclAttVal.c \
+ $(srcdir)/../pcl/PclColor.c \
+ $(srcdir)/../pcl/PclCursor.c \
+ $(srcdir)/../pcl/PclDef.h \
+ $(srcdir)/../pcl/PclFonts.c \
+ $(srcdir)/../pcl/PclGC.c \
+ $(srcdir)/../pcl/Pcl.h \
+ $(srcdir)/../pcl/PclInit.c \
+ $(srcdir)/../pcl/PclLine.c \
+ $(srcdir)/../pcl/Pclmap.h \
+ $(srcdir)/../pcl/PclMisc.c \
+ $(srcdir)/../pcl/PclPixel.c \
+ $(srcdir)/../pcl/PclPolygon.c \
+ $(srcdir)/../pcl/PclPrint.c \
+ $(srcdir)/../pcl/PclSFonts.c \
+ $(srcdir)/../pcl/PclSFonts.h \
+ $(srcdir)/../pcl/PclSpans.c \
+ $(srcdir)/../pcl/PclText.c \
+ $(srcdir)/../pcl/PclWindow.c
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/../pcl/Makefile.am.inc $(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/xprint/pcl/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign hw/xprint/pcl/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-noinstLTLIBRARIES:
+ -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
+ @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" != "$$p" || dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+libpcl.la: $(libpcl_la_OBJECTS) $(libpcl_la_DEPENDENCIES)
+ $(LINK) $(libpcl_la_OBJECTS) $(libpcl_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PclArc.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PclArea.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PclAttVal.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PclAttr.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PclColor.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PclCursor.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PclFonts.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PclGC.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PclInit.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PclLine.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PclMisc.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PclPixel.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PclPolygon.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PclPrint.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PclSFonts.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PclSpans.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PclText.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PclWindow.Plo@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 $@ $<
+
+PclArc.lo: $(srcdir)/../pcl/PclArc.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT PclArc.lo -MD -MP -MF $(DEPDIR)/PclArc.Tpo -c -o PclArc.lo `test -f '$(srcdir)/../pcl/PclArc.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclArc.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/PclArc.Tpo $(DEPDIR)/PclArc.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/../pcl/PclArc.c' object='PclArc.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o PclArc.lo `test -f '$(srcdir)/../pcl/PclArc.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclArc.c
+
+PclArea.lo: $(srcdir)/../pcl/PclArea.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT PclArea.lo -MD -MP -MF $(DEPDIR)/PclArea.Tpo -c -o PclArea.lo `test -f '$(srcdir)/../pcl/PclArea.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclArea.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/PclArea.Tpo $(DEPDIR)/PclArea.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/../pcl/PclArea.c' object='PclArea.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o PclArea.lo `test -f '$(srcdir)/../pcl/PclArea.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclArea.c
+
+PclAttr.lo: $(srcdir)/../pcl/PclAttr.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT PclAttr.lo -MD -MP -MF $(DEPDIR)/PclAttr.Tpo -c -o PclAttr.lo `test -f '$(srcdir)/../pcl/PclAttr.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclAttr.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/PclAttr.Tpo $(DEPDIR)/PclAttr.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/../pcl/PclAttr.c' object='PclAttr.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o PclAttr.lo `test -f '$(srcdir)/../pcl/PclAttr.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclAttr.c
+
+PclAttVal.lo: $(srcdir)/../pcl/PclAttVal.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT PclAttVal.lo -MD -MP -MF $(DEPDIR)/PclAttVal.Tpo -c -o PclAttVal.lo `test -f '$(srcdir)/../pcl/PclAttVal.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclAttVal.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/PclAttVal.Tpo $(DEPDIR)/PclAttVal.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/../pcl/PclAttVal.c' object='PclAttVal.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o PclAttVal.lo `test -f '$(srcdir)/../pcl/PclAttVal.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclAttVal.c
+
+PclColor.lo: $(srcdir)/../pcl/PclColor.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT PclColor.lo -MD -MP -MF $(DEPDIR)/PclColor.Tpo -c -o PclColor.lo `test -f '$(srcdir)/../pcl/PclColor.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclColor.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/PclColor.Tpo $(DEPDIR)/PclColor.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/../pcl/PclColor.c' object='PclColor.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o PclColor.lo `test -f '$(srcdir)/../pcl/PclColor.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclColor.c
+
+PclCursor.lo: $(srcdir)/../pcl/PclCursor.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT PclCursor.lo -MD -MP -MF $(DEPDIR)/PclCursor.Tpo -c -o PclCursor.lo `test -f '$(srcdir)/../pcl/PclCursor.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclCursor.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/PclCursor.Tpo $(DEPDIR)/PclCursor.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/../pcl/PclCursor.c' object='PclCursor.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o PclCursor.lo `test -f '$(srcdir)/../pcl/PclCursor.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclCursor.c
+
+PclFonts.lo: $(srcdir)/../pcl/PclFonts.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT PclFonts.lo -MD -MP -MF $(DEPDIR)/PclFonts.Tpo -c -o PclFonts.lo `test -f '$(srcdir)/../pcl/PclFonts.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclFonts.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/PclFonts.Tpo $(DEPDIR)/PclFonts.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/../pcl/PclFonts.c' object='PclFonts.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o PclFonts.lo `test -f '$(srcdir)/../pcl/PclFonts.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclFonts.c
+
+PclGC.lo: $(srcdir)/../pcl/PclGC.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT PclGC.lo -MD -MP -MF $(DEPDIR)/PclGC.Tpo -c -o PclGC.lo `test -f '$(srcdir)/../pcl/PclGC.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclGC.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/PclGC.Tpo $(DEPDIR)/PclGC.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/../pcl/PclGC.c' object='PclGC.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o PclGC.lo `test -f '$(srcdir)/../pcl/PclGC.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclGC.c
+
+PclInit.lo: $(srcdir)/../pcl/PclInit.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT PclInit.lo -MD -MP -MF $(DEPDIR)/PclInit.Tpo -c -o PclInit.lo `test -f '$(srcdir)/../pcl/PclInit.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclInit.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/PclInit.Tpo $(DEPDIR)/PclInit.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/../pcl/PclInit.c' object='PclInit.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o PclInit.lo `test -f '$(srcdir)/../pcl/PclInit.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclInit.c
+
+PclLine.lo: $(srcdir)/../pcl/PclLine.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT PclLine.lo -MD -MP -MF $(DEPDIR)/PclLine.Tpo -c -o PclLine.lo `test -f '$(srcdir)/../pcl/PclLine.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclLine.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/PclLine.Tpo $(DEPDIR)/PclLine.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/../pcl/PclLine.c' object='PclLine.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o PclLine.lo `test -f '$(srcdir)/../pcl/PclLine.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclLine.c
+
+PclMisc.lo: $(srcdir)/../pcl/PclMisc.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT PclMisc.lo -MD -MP -MF $(DEPDIR)/PclMisc.Tpo -c -o PclMisc.lo `test -f '$(srcdir)/../pcl/PclMisc.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclMisc.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/PclMisc.Tpo $(DEPDIR)/PclMisc.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/../pcl/PclMisc.c' object='PclMisc.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o PclMisc.lo `test -f '$(srcdir)/../pcl/PclMisc.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclMisc.c
+
+PclPixel.lo: $(srcdir)/../pcl/PclPixel.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT PclPixel.lo -MD -MP -MF $(DEPDIR)/PclPixel.Tpo -c -o PclPixel.lo `test -f '$(srcdir)/../pcl/PclPixel.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclPixel.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/PclPixel.Tpo $(DEPDIR)/PclPixel.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/../pcl/PclPixel.c' object='PclPixel.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o PclPixel.lo `test -f '$(srcdir)/../pcl/PclPixel.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclPixel.c
+
+PclPolygon.lo: $(srcdir)/../pcl/PclPolygon.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT PclPolygon.lo -MD -MP -MF $(DEPDIR)/PclPolygon.Tpo -c -o PclPolygon.lo `test -f '$(srcdir)/../pcl/PclPolygon.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclPolygon.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/PclPolygon.Tpo $(DEPDIR)/PclPolygon.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/../pcl/PclPolygon.c' object='PclPolygon.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o PclPolygon.lo `test -f '$(srcdir)/../pcl/PclPolygon.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclPolygon.c
+
+PclPrint.lo: $(srcdir)/../pcl/PclPrint.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT PclPrint.lo -MD -MP -MF $(DEPDIR)/PclPrint.Tpo -c -o PclPrint.lo `test -f '$(srcdir)/../pcl/PclPrint.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclPrint.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/PclPrint.Tpo $(DEPDIR)/PclPrint.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/../pcl/PclPrint.c' object='PclPrint.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o PclPrint.lo `test -f '$(srcdir)/../pcl/PclPrint.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclPrint.c
+
+PclSFonts.lo: $(srcdir)/../pcl/PclSFonts.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT PclSFonts.lo -MD -MP -MF $(DEPDIR)/PclSFonts.Tpo -c -o PclSFonts.lo `test -f '$(srcdir)/../pcl/PclSFonts.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclSFonts.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/PclSFonts.Tpo $(DEPDIR)/PclSFonts.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/../pcl/PclSFonts.c' object='PclSFonts.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o PclSFonts.lo `test -f '$(srcdir)/../pcl/PclSFonts.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclSFonts.c
+
+PclSpans.lo: $(srcdir)/../pcl/PclSpans.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT PclSpans.lo -MD -MP -MF $(DEPDIR)/PclSpans.Tpo -c -o PclSpans.lo `test -f '$(srcdir)/../pcl/PclSpans.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclSpans.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/PclSpans.Tpo $(DEPDIR)/PclSpans.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/../pcl/PclSpans.c' object='PclSpans.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o PclSpans.lo `test -f '$(srcdir)/../pcl/PclSpans.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclSpans.c
+
+PclText.lo: $(srcdir)/../pcl/PclText.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT PclText.lo -MD -MP -MF $(DEPDIR)/PclText.Tpo -c -o PclText.lo `test -f '$(srcdir)/../pcl/PclText.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclText.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/PclText.Tpo $(DEPDIR)/PclText.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/../pcl/PclText.c' object='PclText.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o PclText.lo `test -f '$(srcdir)/../pcl/PclText.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclText.c
+
+PclWindow.lo: $(srcdir)/../pcl/PclWindow.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT PclWindow.lo -MD -MP -MF $(DEPDIR)/PclWindow.Tpo -c -o PclWindow.lo `test -f '$(srcdir)/../pcl/PclWindow.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclWindow.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/PclWindow.Tpo $(DEPDIR)/PclWindow.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(srcdir)/../pcl/PclWindow.c' object='PclWindow.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o PclWindow.lo `test -f '$(srcdir)/../pcl/PclWindow.c' || echo '$(srcdir)/'`$(srcdir)/../pcl/PclWindow.c
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+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: check-am
+all-am: Makefile $(LTLIBRARIES)
+installdirs:
+install: 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:
+
+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."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
+ 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-dvi: install-dvi-am
+
+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
+
+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:
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-noinstLTLIBRARIES ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am 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
+
+# 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/xprint/pcl/Pcl.h b/xorg-server/hw/xprint/pcl/Pcl.h
new file mode 100644
index 000000000..d46a03401
--- /dev/null
+++ b/xorg-server/hw/xprint/pcl/Pcl.h
@@ -0,0 +1,619 @@
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: Pcl.h
+** *
+** * Contents: defines and includes for the Pcl driver
+** * for a printing X server.
+** *
+** * Created: 1/30/95
+** *
+** *********************************************************
+**
+********************************************************************/
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS 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 names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#ifndef _PCL_H_
+#define _PCL_H_
+
+#include <stdio.h>
+#include "scrnintstr.h"
+
+#include "PclDef.h"
+#include "Pclmap.h"
+#include "PclSFonts.h"
+
+#include <X11/extensions/Print.h>
+#include <X11/extensions/Printstr.h>
+
+#include "regionstr.h"
+#include <X11/fonts/fontstruct.h>
+#include "dixfontstr.h"
+#include "gcstruct.h"
+
+/*
+ * Some sleazes to force the XrmDB stuff into the server
+ */
+#ifndef HAVE_XPointer
+typedef char *XPointer;
+#endif
+#define Status int
+#define True 1
+#define False 0
+#include "misc.h"
+#include <X11/Xfuncproto.h>
+#include <X11/Xresource.h>
+#include "attributes.h"
+
+/******
+ * externally visible variables from PclInit.c
+ ******/
+extern DevPrivateKey PclScreenPrivateKey, PclWindowPrivateKey;
+extern DevPrivateKey PclContextPrivateKey;
+extern DevPrivateKey PclPixmapPrivateKey;
+extern DevPrivateKey PclGCPrivateKey;
+
+/******
+ * externally visible variables from PclAttVal.c
+ ******/
+extern XpValidatePoolsRec PclValidatePoolsRec;
+
+/*
+ * This structure defines a mapping from an X colormap ID to a list of
+ * print contexts which use the colormap.
+ */
+typedef struct _pclcontextlist {
+ XpContextPtr context;
+ struct _pclcontextlist *next;
+} PclContextList, *PclContextListPtr;
+
+typedef struct _pclcmaptocontexts {
+ long colormapId;
+ PclContextListPtr contexts;
+ struct _pclcmaptocontexts *next;
+} PclCmapToContexts;
+
+typedef struct {
+ PclCmapToContexts *colormaps;
+ CloseScreenProcPtr CloseScreen;
+} PclScreenPrivRec, *PclScreenPrivPtr;
+
+/*
+ * This structure defines a mapping from an X colormap ID to a PCL
+ * palette ID.
+ */
+typedef struct _palettemap {
+ long colormapId;
+ int paletteId;
+ int downloaded;
+ struct _palettemap *next;
+} PclPaletteMap, *PclPaletteMapPtr;
+
+typedef struct {
+ char *jobFileName;
+ FILE *pJobFile;
+ char *pageFileName;
+ FILE *pPageFile;
+ GC lastGC;
+ unsigned char *dash;
+ int validGC;
+ ClientPtr getDocClient;
+ int getDocBufSize;
+ PclSoftFontInfoPtr pSoftFontInfo;
+ PclPaletteMapPtr palettes;
+ int currentPalette;
+ int nextPaletteId;
+ PclPaletteMap staticGrayPalette;
+ PclPaletteMap trueColorPalette;
+ PclPaletteMap specialTrueColorPalette;
+ unsigned char *ctbl;
+ int ctbldim;
+ int isRaw;
+#ifdef XP_PCL_LJ3
+ unsigned int fcount;
+ unsigned int fcount_max;
+ char *figures;
+#endif /* XP_PCL_LJ3 */
+} PclContextPrivRec, *PclContextPrivPtr;
+
+typedef struct {
+ int validContext;
+ XpContextPtr context;
+} PclWindowPrivRec, *PclWindowPrivPtr;
+
+typedef struct {
+ unsigned long stippleFg, stippleBg;
+} PclGCPrivRec, *PclGCPrivPtr;
+
+typedef struct {
+ XpContextPtr context;
+ char *tempFileName;
+ FILE *tempFile;
+ GC lastGC;
+ int validGC;
+} PclPixmapPrivRec, *PclPixmapPrivPtr;
+
+/******
+ * Defined functions
+ ******/
+#define SEND_PCL(f,c) fwrite( c, sizeof( char ), strlen( c ), f )
+#define SEND_PCL_COUNT(f,c,n) fwrite( c, sizeof( char ), n, f )
+
+#ifndef XP_PCL_LJ3
+#define SAVE_PCL(f,p,c) SEND_PCL(f,c)
+#define SAVE_PCL_COUNT(f,p,c,n) SEND_PCL_COUNT(f,c,n)
+#define MACRO_START(f,p) SEND_PCL(f, "\033&f1Y\033&f0X")
+#define MACRO_END(f) SEND_PCL(f, "\033&f1X")
+#else
+#define SAVE_PCL(f,p,c) PclSpoolFigs(p, c, strlen(c))
+#define SAVE_PCL_COUNT(f,p,c,n) PclSpoolFigs(p, c, n)
+#define MACRO_START(f,p) p->fcount = 0
+#define MACRO_END(f) /* do nothing */
+#endif /* XP_PCL_LJ3 */
+
+#define MIN(a,b) (((a)<(b))?(a):(b))
+#ifndef MAX
+#define MAX(a,b) (((a)>(b))?(a):(b))
+#endif
+
+/******
+ * Functions in PclArc.c
+ ******/
+extern void PclPolyArc(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int nArcs,
+ xArc *pArcs);
+extern void PclPolyFillArc(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int nArcs,
+ xArc *pArcs);
+
+/******
+ * Functions in PclArea.c
+ ******/
+extern void PclPutImage(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int depth,
+ int x,
+ int y,
+ int w,
+ int h,
+ int leftPad,
+ int format,
+ char *pImage);
+extern RegionPtr PclCopyArea(
+ DrawablePtr pSrc,
+ DrawablePtr pDst,
+ GCPtr pGC,
+ int srcx,
+ int srcy,
+ int width,
+ int height,
+ int dstx,
+ int dsty);
+RegionPtr PclCopyPlane(
+ DrawablePtr pSrc,
+ DrawablePtr pDst,
+ GCPtr pGC,
+ int srcx,
+ int srcy,
+ int width,
+ int height,
+ int dstx,
+ int dsty,
+ unsigned long plane);
+
+
+/******
+ * Functions in PclAttr.c
+ ******/
+extern char *PclGetAttributes(
+ XpContextPtr pCon,
+ XPAttributes pool );
+extern char *PclGetOneAttribute(
+ XpContextPtr pCon,
+ XPAttributes pool,
+ char *attr );
+extern int PclAugmentAttributes(
+ XpContextPtr pCon,
+ XPAttributes pool,
+ char *attrs );
+extern int PclSetAttributes(
+ XpContextPtr pCon,
+ XPAttributes pool,
+ char *attrs );
+
+/******
+ * Functions in PclColor.c
+ ******/
+extern Bool PclCreateDefColormap(ScreenPtr pScreen);
+extern Bool PclCreateColormap(ColormapPtr pColor);
+extern void PclDestroyColormap(ColormapPtr pColor);
+extern void PclInstallColormap(ColormapPtr pColor);
+extern void PclUninstallColormap(ColormapPtr pColor);
+extern int PclListInstalledColormaps(ScreenPtr pScreen,
+ XID *pCmapList);
+extern void PclStoreColors(ColormapPtr pColor,
+ int ndef,
+ xColorItem *pdefs);
+extern void PclResolveColor(unsigned short *pRed,
+ unsigned short *pGreen,
+ unsigned short *pBlue,
+ VisualPtr pVisual);
+extern int PclUpdateColormap(DrawablePtr pDrawable,
+ XpContextPtr pCon,
+ GCPtr gc,
+ FILE *outFile);
+extern void PclLookUp(ColormapPtr cmap,
+ PclContextPrivPtr cPriv,
+ unsigned short *r,
+ unsigned short *g,
+ unsigned short *b);
+extern PclPaletteMapPtr PclFindPaletteMap(PclContextPrivPtr cPriv,
+ ColormapPtr cmap,
+ GCPtr gc);
+extern unsigned char *PclReadMap(char *, int *);
+
+
+/******
+ * Functions in PclCursor.c
+ ******/
+extern void PclConstrainCursor(
+ ScreenPtr pScreen,
+ BoxPtr pBox);
+extern void PclCursorLimits(
+ ScreenPtr pScreen,
+ CursorPtr pCursor,
+ BoxPtr pHotBox,
+ BoxPtr pTopLeftbox);
+extern Bool PclDisplayCursor(
+ ScreenPtr pScreen,
+ CursorPtr pCursor);
+extern Bool PclRealizeCursor(
+ ScreenPtr pScreen,
+ CursorPtr pCursor);
+extern Bool PclUnrealizeCursor(
+ ScreenPtr pScreen,
+ CursorPtr pCursor);
+extern void PclRecolorCursor(
+ ScreenPtr pScreen,
+ CursorPtr pCursor,
+ Bool displayed);
+extern Bool PclSetCursorPosition(
+ ScreenPtr pScreen,
+ int x,
+ int y,
+ Bool generateEvent);
+
+/******
+ * Functions in PclSFonts.c
+ ******/
+extern void
+PclDownloadSoftFont8(
+ FILE *fp,
+ PclSoftFontInfoPtr pSoftFontInfo,
+ PclFontHead8Ptr pfh,
+ PclCharDataPtr pcd,
+ unsigned char *code);
+extern void PclDownloadSoftFont16(
+ FILE *fp,
+ PclSoftFontInfoPtr pSoftFontInfo,
+ PclFontHead16Ptr pfh,
+ PclCharDataPtr pcd,
+ unsigned char row,
+ unsigned char col);
+extern PclSoftFontInfoPtr PclCreateSoftFontInfo(void);
+extern void PclDestroySoftFontInfo(
+ PclSoftFontInfoPtr pSoftFontInfo );
+
+/******
+ * Functions in PclGC.c
+ ******/
+extern Bool PclCreateGC(GCPtr pGC);
+extern void PclDestroyGC(GCPtr pGC);
+extern int PclUpdateDrawableGC(
+ GCPtr pGC,
+ DrawablePtr pDrawable,
+ FILE **outFile);
+extern void PclValidateGC(
+ GCPtr pGC,
+ unsigned long changes,
+ DrawablePtr pDrawable);
+extern void PclSetDrawablePrivateStuff(
+ DrawablePtr pDrawable,
+ GC gc );
+extern int PclGetDrawablePrivateStuff(
+ DrawablePtr pDrawable,
+ GC *gc,
+ unsigned long *valid,
+ FILE **file );
+extern void PclSetDrawablePrivateGC(
+ DrawablePtr pDrawable,
+ GC gc);
+extern void PclComputeCompositeClip(
+ GCPtr pGC,
+ DrawablePtr pDrawable);
+
+/******
+ * Functions in PclInit.c
+ ******/
+extern Bool PclCloseScreen(
+ int index,
+ ScreenPtr pScreen);
+extern Bool InitializeColorPclDriver(
+ int ndx,
+ ScreenPtr pScreen,
+ int argc,
+ char **argv);
+extern Bool InitializeMonoPclDriver(
+ int ndx,
+ ScreenPtr pScreen,
+ int argc,
+ char **argv);
+extern Bool InitializeLj3PclDriver(
+ int ndx,
+ ScreenPtr pScreen,
+ int argc,
+ char **argv);
+extern XpContextPtr PclGetContextFromWindow( WindowPtr win );
+
+/******
+ * Functions in PclLine.c
+ ******/
+extern void PclPolyLine(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int mode,
+ int nPoints,
+ xPoint *pPoints);
+extern void PclPolySegment(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int nSegments,
+ xSegment *pSegments);
+
+/******
+ * Functions in PclMisc.c
+ ******/
+extern void PclQueryBestSize(
+ int class,
+ short *pwidth,
+ short *pheight,
+ ScreenPtr pScreen);
+extern char *GetPropString(WindowPtr pWin, char *propName);
+extern int SystemCmd(char *cmdStr);
+extern int PclGetMediumDimensions(
+ XpContextPtr pCon,
+ CARD16 *pWidth,
+ CARD16 *pHeight);
+extern int PclGetReproducibleArea(
+ XpContextPtr pCon,
+ xRectangle *pRect);
+extern void PclSendData(
+ FILE *outFile,
+ PclContextPrivPtr pConPriv,
+ BoxPtr pbox,
+ int nbox,
+ double ratio);
+
+/******
+ * Functions in PclPixel.c
+ ******/
+extern void PclPolyPoint(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int mode,
+ int nPoints,
+ xPoint *pPoints);
+extern void PclPushPixels(
+ GCPtr pGC,
+ PixmapPtr pBitmap,
+ DrawablePtr pDrawable,
+ int width,
+ int height,
+ int x,
+ int y);
+
+/******
+ * Functions in PclPixmap.c
+ ******/
+extern PixmapPtr PclCreatePixmap(
+ ScreenPtr pScreen,
+ int width,
+ int height,
+ int depth);
+extern Bool PclDestroyPixmap(PixmapPtr pPixmap);
+
+/******
+ * Functions in PclPolygon.c
+ ******/
+extern void PclPolyRectangle(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int nRects,
+ xRectangle *pRects);
+extern void PclFillPolygon(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int shape,
+ int mode,
+ int nPoints,
+ DDXPointPtr pPoints);
+extern void PclPolyFillRect(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int nRects,
+ xRectangle *pRects);
+
+/******
+ * Functions in PclSpans.c
+ ******/
+extern void PclFillSpans(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int nSpans,
+ DDXPointPtr pPoints,
+ int *pWidths,
+ int fSorted);
+extern void PclSetSpans(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ char *pSrc,
+ DDXPointPtr pPoints,
+ int *pWidths,
+ int nSpans,
+ int fSorted);
+
+/******
+ * Functions in PclText.c
+ ******/
+extern int PclPolyText8(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int x,
+ int y,
+ int count,
+ char *string);
+extern int PclPolyText16(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int x,
+ int y,
+ int count,
+ unsigned short *string);
+extern void PclImageText8(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int x,
+ int y,
+ int count,
+ char *string);
+extern void PclImageText16(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int x,
+ int y,
+ int count,
+ unsigned short *string);
+extern void PclImageGlyphBlt(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int x,
+ int y,
+ unsigned int nGlyphs,
+ CharInfoPtr *pCharInfo,
+ pointer pGlyphBase);
+extern void PclPolyGlyphBlt(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int x,
+ int y,
+ unsigned int nGlyphs,
+ CharInfoPtr *pCharInfo,
+ pointer pGlyphBase);
+
+/******
+ * Functions in PclWindow.c
+ ******/
+extern Bool PclCreateWindow(register WindowPtr pWin);
+extern Bool PclDestroyWindow(WindowPtr pWin);
+extern Bool PclMapWindow(WindowPtr pWindow);
+extern Bool PclPositionWindow(
+ register WindowPtr pWin,
+ int x,
+ int y);
+extern Bool PclUnmapWindow(WindowPtr pWindow);
+extern void PclCopyWindow(
+ WindowPtr pWin,
+ DDXPointRec ptOldOrg,
+ RegionPtr prgnSrc);
+extern Bool PclChangeWindowAttributes(
+ register WindowPtr pWin,
+ register unsigned long mask);
+
+/******
+ * Functions in PclFonts.c
+ ******/
+extern Bool PclRealizeFont(
+ ScreenPtr pscr,
+ FontPtr pFont);
+extern Bool PclUnrealizeFont(
+ ScreenPtr pscr,
+ FontPtr pFont);
+
+/******
+ * Functions in PclPrint.c
+ ******/
+extern int PclStartJob(
+ XpContextPtr pCon,
+ Bool sendClientData,
+ ClientPtr client);
+extern int PclEndJob(
+ XpContextPtr pCon,
+ Bool cancel);
+extern int PclStartPage(
+ XpContextPtr pCon,
+ WindowPtr pWin);
+extern int PclEndPage(
+ XpContextPtr pCon,
+ WindowPtr pWin);
+extern int PclStartDoc(XpContextPtr pCon,
+ XPDocumentType type);
+extern int PclEndDoc(
+ XpContextPtr pCon,
+ Bool cancel);
+extern int PclDocumentData(
+ XpContextPtr pCon,
+ DrawablePtr pDraw,
+ char *pData,
+ int len_data,
+ char *pFmt,
+ int len_fmt,
+ char *pOpt,
+ int len_opt,
+ ClientPtr client);
+extern int PclGetDocumentData(
+ XpContextPtr pCon,
+ ClientPtr client,
+ int maxBufferSize);
+
+
+#endif /* _PCL_H_ */
diff --git a/xorg-server/hw/xprint/pcl/PclArc.c b/xorg-server/hw/xprint/pcl/PclArc.c
new file mode 100644
index 000000000..20d3f723d
--- /dev/null
+++ b/xorg-server/hw/xprint/pcl/PclArc.c
@@ -0,0 +1,268 @@
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: PclArc.c
+** *
+** * Contents:
+** * Arc-drawing code for the PCL DDX driver
+** *
+** * Created: 10/23/95
+** *
+** *********************************************************
+**
+********************************************************************/
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS 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 names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <stdio.h>
+#include <math.h>
+#include <errno.h>
+
+#include "Pcl.h"
+#include "gcstruct.h"
+#include "windowstr.h"
+#include "attributes.h"
+
+static void
+PclDoArc(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int nArcs,
+ xArc *pArcs,
+ void (*DoIt)(FILE *, PclContextPrivPtr, double, double, xArc))
+{
+ char t[80];
+ FILE *outFile;
+ int nbox, i;
+ BoxPtr pbox;
+ BoxRec r;
+ RegionPtr drawRegion, region, transClip;
+ short fudge;
+ int xoffset, yoffset;
+ XpContextPtr pCon;
+ PclContextPrivPtr pConPriv;
+ xRectangle repro;
+
+ if( PclUpdateDrawableGC( pGC, pDrawable, &outFile ) == FALSE )
+ return;
+
+ fudge = 3 * pGC->lineWidth;
+
+ pCon = PclGetContextFromWindow( (WindowPtr) pDrawable );
+ pConPriv = (PclContextPrivPtr)
+ dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey);
+ XpGetReproductionArea( pCon, &repro );
+
+ /*
+ * Generate the PCL code to draw the collection of arcs, by
+ * defining it as a macro which uses the HP-GL/2 arc drawing
+ * function.
+ */
+
+ xoffset = pDrawable->x;
+ yoffset = pDrawable->y;
+
+ for( i = 0; i < nArcs; i++ )
+ {
+ xArc Arc = pArcs[i];
+ double b, X, Y, ratio;
+ double angle1;
+
+ MACRO_START( outFile, pConPriv );
+ SAVE_PCL( outFile, pConPriv, "\033%0B" );
+
+ /* Calculate the start of the arc */
+ if( ( Arc.angle1 / 64 ) % 360 == 90 )
+ {
+ X = 0;
+ Y = -Arc.height / 2.0;
+ }
+ else if( ( Arc.angle1 / 64 ) % 360 == 270 )
+ {
+ X = 0;
+ Y = Arc.height / 2.0;
+ }
+ else
+ {
+ /* Convert the angle to radians */
+ angle1 = ( Arc.angle1 / 64.0 ) * 3.141592654 / 180.0;
+
+ b = (Arc.height / 2.0);
+ X = b * cos( angle1 );
+ Y = -b * sin( angle1 );
+ }
+
+ /* Change the coordinate system to scale the ellipse */
+ ratio = (double)Arc.height / (double)Arc.width;
+
+ sprintf( t, "SC%.2f,%.2f,%d,%d;",
+ (repro.x - Arc.width / 2 - xoffset - Arc.x) * ratio,
+ (repro.x - Arc.width / 2 - xoffset - Arc.x +
+ repro.width) * ratio,
+ repro.y - Arc.height / 2 - yoffset - Arc.y + repro.height,
+ repro.y - Arc.height / 2 - yoffset - Arc.y);
+ SAVE_PCL( outFile, pConPriv, t );
+
+ DoIt( outFile, pConPriv, X, Y, Arc );
+
+ /* Build the bounding box */
+ r.x1 = -Arc.width / 2 - fudge;
+ r.y1 = -Arc.height / 2 - fudge;
+ r.x2 = Arc.width / 2 + fudge;
+ r.y2 = Arc.height / 2 + fudge;
+ drawRegion = REGION_CREATE( pGC->pScreen, &r, 0 );
+
+ SAVE_PCL( outFile, pConPriv, "\033%0A" );
+ MACRO_END( outFile );
+
+ /*
+ * Intersect the bounding box with the clip region.
+ */
+ region = REGION_CREATE( pGC->pScreen, NULL, 0 );
+ transClip = REGION_CREATE( pGC->pScreen, NULL, 0 );
+ REGION_COPY( pGC->pScreen, transClip, pGC->pCompositeClip );
+ REGION_TRANSLATE( pGC->pScreen, transClip,
+ -(xoffset + Arc.x + Arc.width / 2),
+ -(yoffset + Arc.y + Arc.height / 2) );
+ REGION_INTERSECT( pGC->pScreen, region, drawRegion, transClip );
+
+ /*
+ * For each rectangle in the clip region, set the HP-GL/2 "input
+ * window" and render the collection of arcs to it.
+ */
+ pbox = REGION_RECTS( region );
+ nbox = REGION_NUM_RECTS( region );
+
+ PclSendData(outFile, pConPriv, pbox, nbox, ratio);
+
+ /*
+ * Restore the coordinate system
+ */
+ sprintf( t, "\033%%0BSC%d,%d,%d,%d;\033%%0A", repro.x,
+ repro.x + repro.width, repro.y + repro.height,
+ repro.y );
+ SEND_PCL( outFile, t );
+
+ /*
+ * Clean up the temporary regions
+ */
+ REGION_DESTROY( pGC->pScreen, drawRegion );
+ REGION_DESTROY( pGC->pScreen, region );
+ REGION_DESTROY( pGC->pScreen, transClip );
+ }
+}
+
+/*
+ * Draw a simple non-filled arc, centered on the origin and starting
+ * at the given point.
+ */
+static void
+DrawArc(FILE *outFile,
+ PclContextPrivPtr pConPriv,
+ double X,
+ double Y,
+ xArc A)
+{
+ char t[80];
+
+ sprintf( t, "PU%d,%d;PD;AA0,0,%.2f;", (int)X, (int)Y,
+ (float)A.angle2 / -64.0 );
+ SAVE_PCL(outFile, pConPriv, t);
+}
+
+void
+PclPolyArc(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int nArcs,
+ xArc *pArcs)
+{
+ PclDoArc( pDrawable, pGC, nArcs, pArcs, DrawArc );
+}
+
+/*
+ * Draw a filled wedge, from the origin, to the given point, through
+ * the appropriate angle, and back to the origin.
+ */
+static void
+DoWedge(FILE *outFile,
+ PclContextPrivPtr pConPriv,
+ double X,
+ double Y,
+ xArc A)
+{
+ char t[80];
+
+ sprintf( t, "PU0,0;WG%.2f,%.2f,%.2f;", sqrt( X * X + Y * Y ),
+ (float)A.angle1 / -64.0,
+ (float)A.angle2 / -64.0 );
+ SAVE_PCL(outFile, pConPriv, t);
+}
+
+static void
+DoChord(FILE *outFile,
+ PclContextPrivPtr pConPriv,
+ double X,
+ double Y,
+ xArc A)
+{
+ char t[80];
+
+ sprintf( t, "PU%d,%d;PM0;AA0,0,%.2f;PA%d,%d;PM2;FP;", (int)X, (int)Y,
+ (float)A.angle2 / -64.0 , (int)X, (int)Y );
+ SAVE_PCL(outFile, pConPriv, t);
+}
+
+
+void
+PclPolyFillArc(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int nArcs,
+ xArc *pArcs)
+{
+ switch( pGC->arcMode )
+ {
+ case ArcChord:
+ PclDoArc( pDrawable, pGC, nArcs, pArcs, DoChord );
+ break;
+ case ArcPieSlice:
+ PclDoArc( pDrawable, pGC, nArcs, pArcs, DoWedge );
+ break;
+ }
+}
diff --git a/xorg-server/hw/xprint/pcl/PclArea.c b/xorg-server/hw/xprint/pcl/PclArea.c
new file mode 100644
index 000000000..a4e53dad6
--- /dev/null
+++ b/xorg-server/hw/xprint/pcl/PclArea.c
@@ -0,0 +1,436 @@
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: PclArea.c
+** *
+** * Contents:
+** * Image and Area functions for the PCL DDX driver
+** *
+** * Created: 10/23/95
+** *
+** *********************************************************
+**
+********************************************************************/
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS 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 names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include "Pcl.h"
+#include "pixmapstr.h"
+#include "region.h"
+
+#include "fb.h"
+
+void
+PclPutImage(DrawablePtr pDrawable,
+ GCPtr pGC,
+ int depth,
+ int x,
+ int y,
+ int w,
+ int h,
+ int leftPad,
+ int format,
+ char *pImage)
+{
+ PixmapPtr pPixmap;
+ unsigned long oldFg, oldBg;
+ XID gcv[3];
+ unsigned long oldPlanemask;
+ unsigned long i;
+ long bytesPer;
+
+ if( ( w == 0 ) || ( h == 0 ) )
+ return;
+
+ if( format != XYPixmap )
+ {
+ pPixmap = GetScratchPixmapHeader( pDrawable->pScreen,
+ w+leftPad, h, depth,
+ BitsPerPixel( depth ),
+ PixmapBytePad( w + leftPad,
+ depth ), (pointer)pImage );
+ if( !pPixmap )
+ return;
+
+ if( format == ZPixmap )
+ (void)(*pGC->ops->CopyArea)( (DrawablePtr)pPixmap, pDrawable, pGC,
+ leftPad, 0, w, h, x, y );
+ else
+ (void)(*pGC->ops->CopyPlane)( (DrawablePtr)pPixmap, pDrawable, pGC,
+ leftPad, 0, w, h, x, y, 1 );
+ FreeScratchPixmapHeader( pPixmap );
+ }
+ else
+ {
+ pPixmap = GetScratchPixmapHeader( pDrawable->pScreen,
+ w+leftPad, h, depth,
+ BitsPerPixel( depth ),
+ PixmapBytePad( w + leftPad,
+ depth ), (pointer)pImage );
+
+ if( !pPixmap )
+ return;
+
+ depth = pGC->depth;
+ oldPlanemask = pGC->planemask;
+ oldFg = pGC->fgPixel;
+ oldBg = pGC->bgPixel;
+ gcv[0] = ~0L;
+ gcv[1] = 0;
+ DoChangeGC( pGC, GCForeground | GCBackground, gcv, 0 );
+ bytesPer = (long)h * BitmapBytePad( w + leftPad );
+
+ for( i = 1 << (depth-1); i != 0; i >>= 1, pImage += bytesPer )
+ {
+ if( i & oldPlanemask )
+ {
+ gcv[0] = i;
+ DoChangeGC( pGC, GCPlaneMask, gcv, 0 );
+ ValidateGC( pDrawable, pGC );
+ fbPutImage( (DrawablePtr)pPixmap, pGC, 1, x, y, w, h,
+ leftPad, XYBitmap, pImage );
+ }
+ }
+ gcv[0] = oldPlanemask;
+ gcv[1] = oldFg;
+ gcv[2] = oldBg;
+ DoChangeGC( pGC, GCPlaneMask | GCForeground | GCBackground,
+ gcv, 0 );
+
+ PclCopyArea( (DrawablePtr)pPixmap, pDrawable, pGC, leftPad,
+ 0, w, h, x, y );
+ FreeScratchPixmapHeader( pPixmap );
+ }
+}
+
+/*
+ * PclMonoPixmapFragment()
+ *
+ * Given a 1-bit-deep pixmap, send the appropriate part of it to the
+ * output file as a PCL raster graphics command.
+ */
+static void
+PclMonoPixmapFragment(FILE *outFile,
+ PixmapPtr pix,
+ short x1,
+ short y1,
+ short x2,
+ short y2,
+ short dstx,
+ short dsty)
+{
+ char *bits, t[80], *row;
+ int h, w, i;
+
+ /*
+ * Create a storage area large enough to hold the entire pixmap,
+ * then use fbGetImage to get the appropriate bits.
+ */
+ h = y2 - y1;
+ w = BitmapBytePad( x2 - x1 );
+
+ bits = (char *)xalloc( h * w );
+ fbGetImage( (DrawablePtr)pix, x1, y1, x2 - x1, h,
+ XYPixmap, ~0, bits );
+
+ /*
+ * Move the cursor to the appropriate place on the page. We have
+ * to jump into HP-GL/2 to do this correctly, then go back to PCL
+ * for the actual drawing.
+ */
+ sprintf( t, "\033%%0BPU%d,%d;\033%%1A", dstx, dsty );
+ SEND_PCL( outFile, t );
+
+ /*
+ * Now, wrap the raster in the appropriate PCL code. Right now,
+ * it's going to go down the wire without any compression. That
+ * will have to be good enough for the sample implementation.
+ */
+ sprintf( t, "\033*t300R\033*r%dT\033*r%dS\033*r1A\033*b0M",
+ h, x2 - x1 );
+ SEND_PCL( outFile, t );
+
+ sprintf( t, "\033*b%dW", w );
+ for( row = bits, i = 0; i <= h; i++, row += w )
+ {
+ SEND_PCL( outFile, t );
+ SEND_PCL_COUNT( outFile, row, w );
+ }
+
+ SEND_PCL( outFile, "\033*rC" );
+
+ /*
+ * Clean things up a bit
+ */
+ xfree( bits );
+}
+
+static void
+PclColorPixmapFragment(FILE *outFile,
+ PixmapPtr pix,
+ short x1,
+ short y1,
+ short x2,
+ short y2,
+ short dstx,
+ short dsty)
+{
+ char *bits, t[80], *row;
+ int h, w, i;
+
+ /*
+ * Create a storage area large enough to hold the entire pixmap,
+ * then use fbGetImage to get the appropriate bits.
+ */
+ h = y2 - y1;
+ w = PixmapBytePad( x2 - x1, pix->drawable.depth );
+
+ bits = (char *)xalloc( h * w );
+ fbGetImage( (DrawablePtr)pix, x1, y1, x2 - x1, h, ZPixmap, ~0, bits );
+
+ /*
+ * Move the cursor to the appropriate place on the page. We have
+ * to jump into HP-GL/2 to do this correctly, then go back to PCL
+ * for the actual drawing.
+ */
+ sprintf( t, "\033%%0BPU%d,%d;\033%%1A", dstx, dsty );
+ SEND_PCL( outFile, t );
+
+ /*
+ * Now, wrap the raster in the appropriate PCL code. Right now,
+ * it's going to go down the wire without any compression. That
+ * will have to be good enough for the sample implementation.
+ */
+ sprintf( t, "\033*t300R\033*r%dt%ds1A\033*b0M",
+ h, x2 - x1 );
+ SEND_PCL( outFile, t );
+
+ sprintf( t, "\033*b%dW", w );
+ for( row = bits, i = 0; i < h; i++, row += w )
+ {
+ SEND_PCL( outFile, t );
+ SEND_PCL_COUNT( outFile, row, w );
+ }
+
+ SEND_PCL( outFile, "\033*rC" );
+
+ /*
+ * Clean things up a bit
+ */
+ xfree( bits );
+}
+
+RegionPtr
+PclCopyArea(DrawablePtr pSrc,
+ DrawablePtr pDst,
+ GCPtr pGC,
+ int srcx,
+ int srcy,
+ int width,
+ int height,
+ int dstx,
+ int dsty)
+{
+ PixmapPtr pixSrc = (PixmapPtr)pSrc;
+/*
+ FILE *srcFile;
+ GC srcGC;
+*/
+ FILE *dstFile;
+ GC dstGC;
+ unsigned long valid;
+ RegionPtr drawRegion, region, whole, ret;
+ BoxRec box;
+ BoxPtr prect;
+ int nrect;
+ void (*doFragment)(FILE *, PixmapPtr, short, short, short, short,
+ short, short );
+
+ /*
+ * Since we don't store any information on a per-window basis, we
+ * can't copy from a window.
+ */
+ if( pSrc->type == DRAWABLE_WINDOW )
+ return NULL;
+
+ /*
+ * If we're copying from a pixmap to a pixmap, we just use the
+ * fb code to do the work.
+ */
+ if( pDst->type == DRAWABLE_PIXMAP )
+ fbCopyArea( pSrc, pDst, pGC, srcx, srcy, width, height, dstx, dsty );
+
+/*
+ PclGetDrawablePrivateStuff( pSrc, &srcGC, &valid, &srcFile );
+*/
+ PclGetDrawablePrivateStuff( pDst, &dstGC, &valid, &dstFile );
+
+ /*
+ * If we're copying to a window, we have to do some actual
+ * drawing, instead of just handing it off to fb. Start
+ * by determining the region that will be drawn.
+ */
+ box.x1 = srcx;
+ box.y1 = srcy;
+ box.x2 = srcx + width;
+ box.y2 = srcy + height;
+ drawRegion = REGION_CREATE( pGC->pScreen, &box, 0 );
+ REGION_TRANSLATE( pGC->pScreen, drawRegion, dstx, dsty );
+
+ region = REGION_CREATE( pGC->pScreen, NULL, 0 );
+ REGION_INTERSECT( pGC->pScreen, region, drawRegion, pGC->pCompositeClip );
+
+ /*
+ * Now select the operation to be performed on each box in the
+ * region.
+ */
+ if( pSrc->depth == 1 )
+ doFragment = PclMonoPixmapFragment;
+ else
+ doFragment = PclColorPixmapFragment;
+
+ /*
+ * Actually draw each section of the bitmap.
+ */
+ nrect = REGION_NUM_RECTS( region );
+ prect = REGION_RECTS( region );
+
+ while( nrect )
+ {
+ (*doFragment)( dstFile, (PixmapPtr)pSrc, prect->x1 - dstx,
+ prect->y1 - dsty, prect->x2 - dstx,
+ prect->y2 - dsty, prect->x1, prect->y1 );
+
+ nrect--;
+ prect++;
+ }
+
+ /*
+ * Update the destination's GC to the source's GC.
+ */
+/*
+ PclSetDrawablePrivateGC( pDst, srcGC );
+*/
+
+ /*
+ * Determine the region that needs to be returned. This is the
+ * region of the source that falls outside the boundary of the
+ * pixmap.
+ */
+ box.x1 = 0;
+ box.y1 = 0;
+ box.x2 = pixSrc->drawable.width;
+ box.y2 = pixSrc->drawable.height;
+ whole = REGION_CREATE( pGC->pScreen, &box, 0 );
+ ret = REGION_CREATE( pGC->pScreen, NULL, 0 );
+
+ REGION_TRANSLATE( pGC->pScreen, drawRegion, -dstx, -dsty );
+ REGION_SUBTRACT( pGC->pScreen, ret, drawRegion, whole );
+
+ /*
+ * Clean up the regions
+ */
+ REGION_DESTROY( pGC->pScreen, drawRegion );
+ REGION_DESTROY( pGC->pScreen, region );
+ REGION_DESTROY( pGC->pScreen, whole );
+
+ if( REGION_NOTEMPTY( pGC->pScreen, ret ) )
+ return ret;
+ else
+ {
+ REGION_DESTROY( pGC->pScreen, ret );
+ return NULL;
+ }
+}
+
+RegionPtr
+PclCopyPlane(DrawablePtr pSrc,
+ DrawablePtr pDst,
+ GCPtr pGC,
+ int srcx,
+ int srcy,
+ int width,
+ int height,
+ int dstx,
+ int dsty,
+ unsigned long plane)
+{
+ RegionPtr reg;
+ GCPtr scratchGC;
+ PixmapPtr scratchPix;
+
+ /*
+ * Since we don't store PCL on a per-window basis, there's no good
+ * way to copy from a window.
+ */
+ if( pSrc->type == DRAWABLE_WINDOW )
+ return NULL;
+
+ /* Copying from a pixmap to a pixmap is already implemented by fb. */
+ if( pSrc->type == DRAWABLE_PIXMAP &&
+ pDst->type == DRAWABLE_PIXMAP )
+ fbCopyPlane( pSrc, pDst, pGC, srcx, srcy, width, height,
+ dstx, dsty, plane );
+
+ /*
+ * We can use fbCopyPlane to do the work of grabbing the plane and
+ * converting it to the desired visual. Once that's done, we already
+ * know how to do a CopyArea.
+ */
+ scratchPix = (*pDst->pScreen->CreatePixmap)( pDst->pScreen, width,
+ height, pDst->depth,
+ CREATE_PIXMAP_USAGE_SCRATCH );
+
+ scratchGC = GetScratchGC( pDst->depth, pDst->pScreen );
+ CopyGC( pGC, scratchGC, ~0L );
+
+ fbValidateGC( scratchGC, ~0L, (DrawablePtr)scratchPix );
+ fbCopyPlane( pSrc, (DrawablePtr)scratchPix, scratchGC,
+ srcx, srcy, width, height, 0, 0, plane );
+
+ reg = PclCopyArea( (DrawablePtr)scratchPix, pDst, pGC, 0, 0, width,
+ height, dstx, dsty );
+
+ FreeScratchGC( scratchGC );
+
+ (*pDst->pScreen->DestroyPixmap)( scratchPix );
+
+ return reg;
+}
diff --git a/xorg-server/hw/xprint/pcl/PclAttVal.c b/xorg-server/hw/xprint/pcl/PclAttVal.c
new file mode 100644
index 000000000..f0f204764
--- /dev/null
+++ b/xorg-server/hw/xprint/pcl/PclAttVal.c
@@ -0,0 +1,206 @@
+/*
+ */
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS 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 names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "Pcl.h"
+#include "AttrValid.h"
+
+/*
+ * define valid values and defaults for Printer pool
+ */
+static XpOid ValidContentOrientationsOids[] = {
+ xpoid_val_content_orientation_portrait,
+ xpoid_val_content_orientation_landscape,
+ xpoid_val_content_orientation_reverse_portrait,
+ xpoid_val_content_orientation_reverse_landscape
+};
+static XpOidList ValidContentOrientations = {
+ ValidContentOrientationsOids, XpNumber(ValidContentOrientationsOids)
+};
+
+static XpOid DefaultContentOrientationsOids[] = {
+ xpoid_val_content_orientation_portrait,
+ xpoid_val_content_orientation_landscape
+};
+static XpOidList DefaultContentOrientations = {
+ DefaultContentOrientationsOids, XpNumber(DefaultContentOrientationsOids)
+};
+
+static XpOid ValidPlexesOids[] = {
+ xpoid_val_plex_simplex, xpoid_val_plex_duplex, xpoid_val_plex_tumble
+};
+static XpOidList ValidPlexes = {
+ ValidPlexesOids, XpNumber(ValidPlexesOids)
+};
+
+static XpOid DefaultPlexesOids[] = {
+ xpoid_val_plex_simplex
+};
+static XpOidList DefaultPlexes = {
+ DefaultPlexesOids, XpNumber(DefaultPlexesOids)
+};
+
+static unsigned long ValidPrinterResolutionsCards[] = {
+ 300
+};
+static XpOidCardList ValidPrinterResolutions = {
+ ValidPrinterResolutionsCards, XpNumber(ValidPrinterResolutionsCards)
+};
+
+static unsigned long DefaultPrinterResolutionsCards[] = {
+ 300
+};
+static XpOidCardList DefaultPrinterResolutions = {
+ DefaultPrinterResolutionsCards, XpNumber(DefaultPrinterResolutionsCards)
+};
+
+static XpOid ValidListfontsModesOids[] = {
+ xpoid_val_xp_list_internal_printer_fonts, xpoid_val_xp_list_glyph_fonts
+};
+static XpOidList ValidListfontsModes = {
+ ValidListfontsModesOids, XpNumber(ValidListfontsModesOids)
+};
+
+static XpOid DefaultListfontsModesOids[] = {
+ xpoid_val_xp_list_glyph_fonts
+};
+static XpOidList DefaultListfontsModes = {
+ DefaultListfontsModesOids, XpNumber(DefaultListfontsModesOids)
+};
+
+static XpOid ValidSetupProvisoOids[] = {
+ xpoid_val_xp_setup_mandatory, xpoid_val_xp_setup_optional
+};
+static XpOidList ValidSetupProviso = {
+
+
+ ValidSetupProvisoOids, XpNumber(ValidSetupProvisoOids)
+};
+
+static XpOidDocFmt ValidDocFormatsSupportedFmts[] = {
+ { "PCL", "5", NULL },
+};
+static XpOidDocFmtList ValidDocFormatsSupported = {
+ ValidDocFormatsSupportedFmts, XpNumber(ValidDocFormatsSupportedFmts)
+};
+
+static XpOidDocFmt DefaultDocFormatsSupportedFmts[] = {
+ { "PCL", "5", NULL }
+};
+static XpOidDocFmtList DefaultDocFormatsSupported = {
+ DefaultDocFormatsSupportedFmts, XpNumber(DefaultDocFormatsSupportedFmts)
+};
+
+static XpOidDocFmt ValidEmbeddedFormatsSupportedFmts[] = {
+ { "HPGL", "2", NULL },
+};
+static XpOidDocFmtList ValidEmbeddedFormatsSupported = {
+ ValidEmbeddedFormatsSupportedFmts, XpNumber(ValidEmbeddedFormatsSupportedFmts)
+};
+
+static XpOidDocFmt DefaultEmbeddedFormatsSupportedFmts[] = {
+ { "HPGL", "2", NULL }
+};
+static XpOidDocFmtList DefaultEmbeddedFormatsSupported = {
+ DefaultEmbeddedFormatsSupportedFmts, XpNumber(DefaultEmbeddedFormatsSupportedFmts)
+};
+
+static XpOidDocFmt ValidRawFormatsSupportedFmts[] = {
+ { "PCL", "5", NULL },
+ { "Postscript", "2", NULL },
+ { "ASCII", NULL, NULL }
+
+};
+static XpOidDocFmtList ValidRawFormatsSupported = {
+ ValidRawFormatsSupportedFmts, XpNumber(ValidRawFormatsSupportedFmts)
+};
+
+static XpOidDocFmt DefaultRawFormatsSupportedFmts[] = {
+ { "PCL", "5", NULL }
+};
+static XpOidDocFmtList DefaultRawFormatsSupported = {
+ DefaultRawFormatsSupportedFmts, XpNumber(DefaultRawFormatsSupportedFmts)
+};
+
+static XpOid ValidInputTraysOids[] = {
+ xpoid_val_input_tray_manual,
+ xpoid_val_input_tray_main,
+ xpoid_val_input_tray_envelope,
+ xpoid_val_input_tray_large_capacity,
+ xpoid_val_input_tray_bottom
+};
+static XpOidList ValidInputTrays = {
+ ValidInputTraysOids, XpNumber(ValidInputTraysOids)
+};
+
+static XpOid ValidMediumSizesOids[] = {
+ xpoid_val_medium_size_iso_a3,
+ xpoid_val_medium_size_iso_a4,
+ xpoid_val_medium_size_na_letter,
+ xpoid_val_medium_size_na_legal,
+ xpoid_val_medium_size_executive,
+ xpoid_val_medium_size_ledger,
+ xpoid_val_medium_size_iso_c5,
+ xpoid_val_medium_size_iso_designated_long,
+ xpoid_val_medium_size_na_number_10_envelope,
+ xpoid_val_medium_size_monarch_envelope,
+ xpoid_val_medium_size_jis_b5,
+};
+static XpOidList ValidMediumSizes = {
+ ValidMediumSizesOids, XpNumber(ValidMediumSizesOids)
+};
+
+static XpOidDocFmt DefaultDocumentFormat = {
+ "PCL", "5", NULL
+};
+
+
+/*
+ * init struct for XpValidate*Pool
+ */
+XpValidatePoolsRec PclValidatePoolsRec = {
+ &ValidContentOrientations, &DefaultContentOrientations,
+ &ValidDocFormatsSupported, &DefaultDocFormatsSupported,
+ &ValidInputTrays, &ValidMediumSizes,
+ &ValidPlexes, &DefaultPlexes,
+ &ValidPrinterResolutions, &DefaultPrinterResolutions,
+ &ValidEmbeddedFormatsSupported, &DefaultEmbeddedFormatsSupported,
+ &ValidListfontsModes, &DefaultListfontsModes,
+ &ValidRawFormatsSupported, &DefaultRawFormatsSupported,
+ &ValidSetupProviso,
+ &DefaultDocumentFormat
+};
diff --git a/xorg-server/hw/xprint/pcl/PclAttr.c b/xorg-server/hw/xprint/pcl/PclAttr.c
new file mode 100644
index 000000000..b27bf4fce
--- /dev/null
+++ b/xorg-server/hw/xprint/pcl/PclAttr.c
@@ -0,0 +1,86 @@
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: PclAttr.c
+** *
+** * Contents:
+** * Attribute-handling functions for the PCL driver
+** *
+** * Created: 2/2/96
+** *
+** *********************************************************
+**
+********************************************************************/
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS 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 names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "Pcl.h"
+#include "attributes.h"
+
+char *
+PclGetAttributes(
+ XpContextPtr pCon,
+ XPAttributes pool )
+{
+ return XpGetAttributes( pCon, pool );
+}
+
+char *
+PclGetOneAttribute(
+ XpContextPtr pCon,
+ XPAttributes pool,
+ char *attr )
+{
+ return XpGetOneAttribute( pCon, pool, attr );
+}
+int
+PclAugmentAttributes(
+ XpContextPtr pCon,
+ XPAttributes pool,
+ char *attrs )
+{
+ return XpAugmentAttributes( pCon, pool, attrs );
+}
+
+int
+PclSetAttributes(
+ XpContextPtr pCon,
+ XPAttributes pool,
+ char *attrs )
+{
+ return XpSetAttributes( pCon, pool, attrs );
+}
diff --git a/xorg-server/hw/xprint/pcl/PclColor.c b/xorg-server/hw/xprint/pcl/PclColor.c
new file mode 100644
index 000000000..5e8ffa63c
--- /dev/null
+++ b/xorg-server/hw/xprint/pcl/PclColor.c
@@ -0,0 +1,851 @@
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: PclColorInit.c
+** *
+** * Contents:
+** * Colormap handing code of Pcl driver for the
+** * print server.
+** *
+** * Created: 4/8/96
+** *
+** *********************************************************
+**
+********************************************************************/
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS 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 names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <unistd.h>
+#include <math.h>
+
+#include "colormapst.h"
+#include "windowstr.h"
+#include "resource.h"
+
+#include "Pcl.h"
+#include "fb.h"
+
+static void lookup(unsigned char *src,
+ unsigned char *dst,
+ int num,
+ unsigned char *map,
+ int dim);
+static void trilinear(unsigned char *p,
+ unsigned char *out,
+ unsigned char *d,
+ int dim,
+ unsigned char def);
+
+
+/*
+ * This seems to be (and is) a duplication of effort; one would think
+ * that fbCreateDefColormap would be sufficient. It almost is. The
+ * only change made in this function is that the black and white pixels
+ * are allocated with three separate variables for red, green and blue
+ * values, instead of the single variable in fbCreateDefColormap. The
+ * single variable leads to the one value being corrected by
+ * ResolveColor three times, which leads to incorrect colors.
+ */
+
+Bool
+PclCreateDefColormap(ScreenPtr pScreen)
+{
+ unsigned short wp_red = ~0, wp_green = ~0, wp_blue = ~0;
+ unsigned short bp_red = 0, bp_green = 0, bp_blue = 0;
+ VisualPtr pVisual;
+ ColormapPtr cmap;
+ Pixel wp, bp;
+
+ for (pVisual = pScreen->visuals;
+ pVisual->vid != pScreen->rootVisual;
+ pVisual++)
+ ;
+
+ if (CreateColormap(pScreen->defColormap, pScreen, pVisual, &cmap,
+ (pVisual->class & DynamicClass) ? AllocNone : AllocAll,
+ 0)
+ != Success)
+ return FALSE;
+ wp = pScreen->whitePixel;
+ bp = pScreen->blackPixel;
+ if ((AllocColor(cmap, &wp_red, &wp_green, &wp_blue, &wp, 0) !=
+ Success) ||
+ (AllocColor(cmap, &bp_red, &bp_green, &bp_blue, &bp, 0) !=
+ Success))
+ return FALSE;
+
+ pScreen->whitePixel = wp;
+ pScreen->blackPixel = bp;
+
+ (*pScreen->InstallColormap)(cmap);
+ return TRUE;
+}
+
+/*
+ * Add colormap to list of colormaps on screen
+ */
+Bool
+PclCreateColormap(ColormapPtr pColor)
+{
+ PclCmapToContexts *new;
+ PclScreenPrivPtr sPriv;
+
+ sPriv = (PclScreenPrivPtr)
+ dixLookupPrivate(&pColor->pScreen->devPrivates, PclScreenPrivateKey);
+
+ /*
+ * Use existing code to initialize the values in the colormap
+ */
+ fbInitializeColormap( pColor );
+
+ /*
+ * Set up the mapping between the color map and the context
+ */
+ new = (PclCmapToContexts *)xalloc( sizeof( PclCmapToContexts ) );
+
+ if( new )
+ {
+ new->colormapId = pColor->mid;
+ new->contexts = NULL;
+ new->next = sPriv->colormaps;
+ sPriv->colormaps = new;
+
+ return TRUE;
+ }
+ else
+ return FALSE;
+}
+
+void
+PclDestroyColormap(ColormapPtr pColor)
+{
+ PclScreenPrivPtr sPriv;
+ PclCmapToContexts *pCmap, *tCmap = 0;
+ PclContextListPtr con, tCon;
+ PclContextPrivPtr cPriv;
+ PclPaletteMapPtr pPal;
+ char t[80];
+
+ /*
+ * At DestroyContext time, colormaps may be destroyed twice, so if the
+ * pointer is NULL, just crash out.
+ */
+ if( !pColor )
+ return;
+
+ /*
+ * Find the colormap <-> contexts mapping
+ */
+ sPriv = (PclScreenPrivPtr)
+ dixLookupPrivate(&pColor->pScreen->devPrivates, PclScreenPrivateKey);
+ pCmap = sPriv->colormaps;
+ while( pCmap )
+ {
+ if( pCmap->colormapId == pColor->mid )
+ break;
+ tCmap = pCmap;
+ pCmap = pCmap->next;
+ }
+
+ /*
+ * For each context, delete the palette in the printer and
+ * free the mapping.
+ */
+ if( pCmap )
+ {
+ con = pCmap->contexts;
+ while( con )
+ {
+ cPriv = dixLookupPrivate(&con->context->devPrivates,
+ PclContextPrivateKey);
+ pPal = cPriv->palettes;
+ while( pPal )
+ {
+ if( pPal->colormapId == pColor->mid )
+ break;
+ pPal = pPal->next;
+ }
+
+ if( cPriv->pPageFile )
+ {
+ sprintf( t, "\033&p%dI\033*p2C", pPal->paletteId );
+ SEND_PCL( cPriv->pPageFile, t );
+ }
+
+ tCon = con;
+ con = con->next;
+ xfree( tCon );
+ }
+
+ /*
+ * Delete the colormap<->contexts mapping
+ */
+ if( sPriv->colormaps == pCmap )
+ /* Delete from the front */
+ sPriv->colormaps = pCmap->next;
+ else
+ /* Delete from the middle */
+ tCmap->next = pCmap->next;
+ free( pCmap );
+ }
+}
+
+void
+PclInstallColormap(ColormapPtr pColor)
+{
+}
+
+void
+PclUninstallColormap(ColormapPtr pColor)
+{
+}
+
+int
+PclListInstalledColormaps(ScreenPtr pScreen,
+ XID *pCmapList)
+{
+ return 0;
+}
+
+void
+PclStoreColors(ColormapPtr pColor,
+ int ndef,
+ xColorItem *pdefs)
+{
+ PclCmapToContexts *p;
+ PclScreenPrivPtr sPriv;
+ PclContextListPtr con;
+ PclContextPrivPtr cPriv;
+ PclPaletteMapPtr pMap;
+ char t[80];
+ int i;
+
+ sPriv = (PclScreenPrivPtr)
+ dixLookupPrivate(&pColor->pScreen->devPrivates, PclScreenPrivateKey);
+ p = sPriv->colormaps;
+ while( p )
+ {
+ if( p->colormapId == pColor->mid )
+ break;
+ p = p->next;
+ }
+
+ if( p )
+ {
+ con = p->contexts;
+ while( con )
+ {
+ /*
+ * For each context, get the palette ID and update the
+ * appropriate palette.
+ */
+ cPriv = dixLookupPrivate(&con->context->devPrivates,
+ PclContextPrivateKey);
+ pMap = PclFindPaletteMap( cPriv, pColor, NULL );
+
+ /*
+ * Update the palette
+ */
+ sprintf( t, "\033&p%dS", pMap->paletteId );
+ SEND_PCL( cPriv->pPageFile, t );
+
+ if( pColor->class == PseudoColor )
+ {
+ unsigned short r, g, b;
+ unsigned int pID;
+ for( i = 0; i < ndef; i++ )
+ {
+ pID = pdefs[i].pixel;
+ if ( pColor->red[i].fShared )
+ {
+ r = pColor->red[pID].co.shco.red->color;
+ g = pColor->red[pID].co.shco.green->color;
+ b = pColor->red[pID].co.shco.blue->color;
+ }
+ else
+ {
+ r = pColor->red[pID].co.local.red;
+ g = pColor->red[pID].co.local.green;
+ b = pColor->red[pID].co.local.blue;
+ }
+
+ if( pdefs[i].flags & DoRed )
+ r = pdefs[i].red;
+ if( pdefs[i].flags & DoGreen )
+ g = pdefs[i].green;
+ if( pdefs[i].flags & DoBlue )
+ b = pdefs[i].blue;
+ PclLookUp(pColor, cPriv, &r, &g, &b);
+ sprintf( t, "\033*v%ua%ub%uc%dI", r, g, b, pID);
+ SEND_PCL( cPriv->pPageFile, t );
+ }
+ }
+
+ sprintf( t, "\033&p%dS", cPriv->currentPalette );
+ SEND_PCL( cPriv->pPageFile, t );
+
+ con = con->next;
+ }
+ }
+}
+
+void
+PclResolveColor(unsigned short *pRed,
+ unsigned short *pGreen,
+ unsigned short *pBlue,
+ VisualPtr pVisual)
+{
+ /*
+ * We need to map the X color range of [0,65535] to the PCL color
+ * range of [0,32767].
+ */
+ *pRed >>= 1;
+ *pGreen >>= 1;
+ *pBlue >>= 1;
+}
+
+PclPaletteMapPtr
+PclFindPaletteMap(PclContextPrivPtr cPriv,
+ ColormapPtr cmap,
+ GCPtr gc)
+{
+ PclPaletteMapPtr p = cPriv->palettes, new;
+
+ /*
+ * If the colormap is static, grab one of the special palettes. If we come
+ * into this from StoreColors, there will be no GC, but by definition we're
+ * looking at a dynamic color map, so the special colors will not be
+ * needed.
+ */
+ if( gc )
+ {
+ if( cmap->pVisual->class == StaticGray )
+ return &( cPriv->staticGrayPalette );
+ else if( cmap->pVisual->class == TrueColor )
+ {
+ if( gc->fillStyle == FillTiled && !( gc->tileIsPixel ) )
+ return &( cPriv->specialTrueColorPalette );
+ else
+ return &( cPriv->trueColorPalette );
+ }
+ }
+
+
+ /* Look for the colormap ID <-> palette ID mapping */
+ while( p )
+ {
+ if( p->colormapId == cmap->mid )
+ return p;
+ p = p->next;
+ }
+
+ /* If the colormap isn't already there, make an entry for it */
+ new = (PclPaletteMapPtr)xalloc( sizeof( PclPaletteMap ) );
+ new->colormapId = cmap->mid;
+ new->paletteId = cPriv->nextPaletteId++;
+ new->downloaded = 0;
+ new->next = cPriv->palettes;
+ cPriv->palettes = new;
+ return new;
+}
+
+int
+PclUpdateColormap(DrawablePtr pDrawable,
+ XpContextPtr pCon,
+ GCPtr gc,
+ FILE *outFile)
+{
+ PclScreenPrivPtr sPriv;
+
+ PclContextPrivPtr cPriv;
+ PclPaletteMapPtr pMap;
+ PclCmapToContexts *pCmap;
+ PclContextListPtr new;
+ char t[80];
+ Colormap c;
+ ColormapPtr cmap;
+ WindowPtr win = (WindowPtr)pDrawable;
+ unsigned short r, g, b, rr, gg, bb;
+ int i;
+
+ cPriv = (PclContextPrivPtr)
+ dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey);
+
+ c = wColormap( win );
+ cmap = (ColormapPtr)LookupIDByType( c, RT_COLORMAP );
+ pMap = PclFindPaletteMap( cPriv, cmap, gc );
+
+ if( cPriv->currentPalette == pMap->paletteId )
+ /*
+ * If the requested colormap is already active, nothing needs to
+ * be done.
+ */
+ return FALSE;
+
+ /*
+ * Now we activate the palette in the printer
+ */
+ sprintf( t, "\033&p%dS", pMap->paletteId );
+ SEND_PCL( outFile, t );
+ cPriv->currentPalette = pMap->paletteId;
+
+ if( pMap->downloaded == 0 )
+ /*
+ * If the requested colormap has not been downloaded to the
+ * printer, we need to do that before activating it.
+ */
+ {
+ /*
+ * Add the colormap to the screen-level colormap<->context mapping.
+ */
+ sPriv = (PclScreenPrivPtr)
+ dixLookupPrivate(&cmap->pScreen->devPrivates,
+ PclScreenPrivateKey);
+ pCmap = sPriv->colormaps;
+ while( pCmap && ( pCmap->colormapId != cmap->mid ) )
+ pCmap = pCmap->next;
+ new = (PclContextListPtr)xalloc( sizeof( PclContextList ) );
+ new->context = pCon;
+ new->next = pCmap->contexts;
+ pCmap->contexts = new;
+
+ /*
+ * XXX Download the colormap
+ */
+ if( cmap->class == StaticGray )
+ {
+#ifdef XP_PCL_COLOR
+ sprintf( t, "\033*v18W%c%c%c%c%c%c", 0, 1, 1, 1, 1, 1 );
+ SEND_PCL_COUNT( cPriv->pPageFile, t, 12 );
+
+ /* Send the white reference point... */
+ sprintf( t, "%c%c%c%c%c%c", 0x7f, 0xff, 0x7f, 0xff,
+ 0x7f, 0xff );
+ SEND_PCL_COUNT( cPriv->pPageFile, t, 6 );
+
+ /* ... and the black reference point */
+ sprintf( t, "%c%c%c%c%c%c", 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00 );
+ SEND_PCL_COUNT( cPriv->pPageFile, t, 6 );
+
+ /* Now program the two colors */
+ sprintf( t, "\033*v0a0b0c%ldI", (long) cmap->pScreen->blackPixel );
+ SEND_PCL( cPriv->pPageFile, t );
+ sprintf( t, "\033*v32767a32767b32767c%ldI",
+ (long) cmap->pScreen->whitePixel );
+ SEND_PCL( cPriv->pPageFile, t );
+#endif /* XP_PCL_COLOR */
+ }
+ else if( cmap->class == PseudoColor )
+ {
+ sprintf( t,
+ "\033*v18W%c%c%c%c%c%c",
+ 0, 1, cmap->pVisual->nplanes, 16, 16, 16 );
+ SEND_PCL_COUNT( cPriv->pPageFile, t, 12 );
+
+ /* Send the white reference point... */
+ if ( cPriv->ctbl != NULL )
+ sprintf( t, "%c%c%c%c%c%c", 0x00, 0xff, 0x00, 0xff,
+ 0x00, 0xff );
+ else
+ sprintf( t, "%c%c%c%c%c%c", 0x7f, 0xff, 0x7f, 0xff,
+ 0x7f, 0xff );
+ SEND_PCL_COUNT( cPriv->pPageFile, t, 6 );
+
+ /* ... and the black reference point */
+ sprintf( t, "%c%c%c%c%c%c", 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00 );
+ SEND_PCL_COUNT( cPriv->pPageFile, t, 6 );
+
+ for(i = 0; i < cmap->pVisual->ColormapEntries; i++ )
+ {
+ if( cmap->red[i].fShared )
+ {
+ r = cmap->red[i].co.shco.red->color;
+ g = cmap->red[i].co.shco.green->color;
+ b = cmap->red[i].co.shco.blue->color;
+ }
+ else
+ {
+ r = cmap->red[i].co.local.red;
+ g = cmap->red[i].co.local.green;
+ b = cmap->red[i].co.local.blue;
+ }
+ PclLookUp(cmap, cPriv, &r, &g, &b);
+ sprintf( t, "\033*v%ua%ub%uc%dI", r, g, b, i );
+ SEND_PCL( outFile, t );
+ }
+ }
+ else if( cmap->class == TrueColor )
+ {
+ unsigned short lim;
+
+ if( gc->fillStyle == FillTiled && !( gc->tileIsPixel ) )
+ {
+ if( cPriv->ctbl != NULL )
+ {
+ /* Send the "special" colormap for 24-bit fills */
+ sprintf( t, "\033*v18W%c%c%c%c%c%c", 0, 1,
+ 8,
+ cmap->pVisual->bitsPerRGBValue,
+ cmap->pVisual->bitsPerRGBValue,
+ cmap->pVisual->bitsPerRGBValue );
+ SEND_PCL_COUNT( cPriv->pPageFile, t, 12 );
+
+ /* Send the white reference point... */
+ sprintf( t, "%c%c%c%c%c%c",
+ 0x00, 0xff,
+ 0x00, 0xff,
+ 0x00, 0xff );
+ SEND_PCL_COUNT( cPriv->pPageFile, t, 6 );
+
+ /* ... and the black reference point */
+ sprintf( t, "%c%c%c%c%c%c",
+ 0x00, 0x00,
+ 0x00, 0x00,
+ 0x00, 0x00 );
+ SEND_PCL_COUNT( cPriv->pPageFile, t, 6 );
+
+ /* Now send the color entries, RRRGGGBB */
+ i=0;
+ for( r = 0; r < 8; r++ )
+ for( g = 0; g < 8; g ++ )
+ for( b = 0; b < 4; b++ )
+ {
+ rr = (r * 0xff)/7;
+ gg = (g * 0xff)/7;
+ bb = (b * 0xff)/3;
+ PclLookUp(cmap, cPriv, &rr, &gg, &bb);
+ sprintf( t, "\033*v%ua%ub%uc%dI",
+ rr, gg, bb, i );
+ SEND_PCL( outFile, t );
+ i++;
+ }
+ }
+ else
+ {
+ /* Send the "special" colormap for 24-bit fills */
+ sprintf( t, "\033*v18W%c%c%c%c%c%c", 0, 1,
+ 8,
+ cmap->pVisual->bitsPerRGBValue,
+ cmap->pVisual->bitsPerRGBValue,
+ cmap->pVisual->bitsPerRGBValue );
+ SEND_PCL_COUNT( cPriv->pPageFile, t, 12 );
+
+ /* Send the white reference point... */
+ sprintf( t, "%c%c%c%c%c%c",
+ 0x00, 0x07,
+ 0x00, 0x07,
+ 0x00, 0x03 );
+ SEND_PCL_COUNT( cPriv->pPageFile, t, 6 );
+
+ /* ... and the black reference point */
+ sprintf( t, "%c%c%c%c%c%c",
+ 0x00, 0x00,
+ 0x00, 0x00,
+ 0x00, 0x00 );
+ SEND_PCL_COUNT( cPriv->pPageFile, t, 6 );
+
+ /* Now send the color entries, RRRGGGBB */
+ i=0;
+ for( r = 0; r < 8; r++ )
+ for( g = 0; g < 8; g ++ )
+ for( b = 0; b < 4; b++ )
+ {
+ sprintf( t, "\033*v%ua%ub%uc%dI",
+ r, g, b, i );
+ SEND_PCL( outFile, t );
+ i++;
+ }
+ }
+
+ }
+ else
+ {
+ lim = (1 << cmap->pVisual->bitsPerRGBValue) - 1;
+
+ /* Send the "special" colormap for 24-bit fills */
+ sprintf( t, "\033*v18W%c%c%c%c%c%c", 0, 3,
+ cmap->pVisual->nplanes,
+ cmap->pVisual->bitsPerRGBValue,
+ cmap->pVisual->bitsPerRGBValue,
+ cmap->pVisual->bitsPerRGBValue );
+ SEND_PCL_COUNT( cPriv->pPageFile, t, 12 );
+
+ /* Send the white reference point... */
+ sprintf( t, "%c%c%c%c%c%c",
+ (lim >> 8) & 0xff, lim & 0xff,
+ (lim >> 8) & 0xff, lim & 0xff,
+ (lim >> 8) & 0xff, lim & 0xff);
+ SEND_PCL_COUNT( cPriv->pPageFile, t, 6 );
+
+ /* ... and the black reference point */
+ sprintf( t, "%c%c%c%c%c%c", 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00 );
+ SEND_PCL_COUNT( cPriv->pPageFile, t, 6 );
+ }
+
+ }
+ pMap->downloaded = 1;
+ }
+ return TRUE;
+
+}
+
+void PclLookUp(
+ ColormapPtr cmap,
+ PclContextPrivPtr cPriv,
+ unsigned short *r,
+ unsigned short *g,
+ unsigned short *b
+)
+{
+ unsigned char cdata[3];
+
+ if( cmap->class == PseudoColor )
+ {
+ if( cPriv->ctbl != NULL )
+ {
+ cdata[0] = *r >> 8;
+ cdata[1] = *g >> 8;
+ cdata[2] = *b >> 8;
+ lookup(cdata, cdata, 1, cPriv->ctbl, cPriv->ctbldim);
+ *r = cdata[0];
+ *g = cdata[1];
+ *b = cdata[2];
+ }
+ else
+ {
+ *r >>= 1;
+ *g >>= 1;
+ *b >>= 1;
+ }
+ }
+ else if( cmap->class == TrueColor )
+ {
+ if( cPriv->ctbl != NULL )
+ {
+ cdata[0] = *r;
+ cdata[1] = *g;
+ cdata[2] = *b;
+ lookup(cdata, cdata, 1, cPriv->ctbl, cPriv->ctbldim);
+ *r = cdata[0];
+ *g = cdata[1];
+ *b = cdata[2];
+ }
+ }
+ return;
+}
+
+unsigned char *PclReadMap(char *name, int *dim)
+{
+ FILE *fp;
+ unsigned char *data;
+ long size;
+
+ if ((fp=fopen(name, "r")) == NULL) {
+ return(NULL);
+ }
+
+ fseek(fp, 0, SEEK_END);
+ size = ftell(fp);
+
+ /* Could do this with a lookup table, if the constraint is that the
+ 3 map dimensions must be equal. */
+ switch (size) {
+ case 8*8*8*3:
+ *dim = 8;
+ break;
+ case 16*16*16*3:
+ *dim = 16;
+ break;
+ case 17*17*17*3:
+ *dim = 17;
+ break;
+ case 65*65*65*3:
+ *dim = 65;
+ break;
+ default:
+ fclose(fp);
+ return(NULL);
+ }
+
+ if ((data = (unsigned char *) xalloc(sizeof(char) * size)) == NULL) {
+ fclose(fp);
+ return(NULL);
+ }
+
+ fseek(fp, 0, SEEK_SET);
+
+ if (fread(data, sizeof(char), size, fp) != (unsigned) size) {
+ fclose(fp);
+ free(data);
+ return(NULL);
+ }
+
+ fclose(fp);
+ return(data);
+}
+
+/************************************************************************
+ *
+ * Here is the mapper.
+ *
+ ************************************************************************/
+
+#define SCL(x) ((x)*(dim-1)/255)
+/* Interleaved-map lookup */
+static void lookup(unsigned char *src, unsigned char *dst, int num, unsigned char *map, int dim)
+{
+ int i;
+
+#define _INTERPOLATE
+#ifndef _INTERPOLATE
+ unsigned char *p1, *p2, *p3;
+
+ for (i=0; i<num; i++) {
+ p1 = map + (SCL(src[0])*dim*dim + SCL(src[1])*dim + SCL(src[2])) * 3;
+ *dst++ = *p1++;
+ *dst++ = *p1++;
+ *dst++ = *p1++;
+ src += 3;
+ }
+#else
+ for (i=0; i<num; i++) {
+ trilinear(src, dst, map, dim, 128);
+ src += 3;
+ dst += 3;
+ }
+#endif
+}
+
+/*
+ * C code from the article
+ * "Tri-linear Interpolation"
+ * by Steve Hill, sah@ukc.ac.uk
+ * in "Graphics Gems IV", Academic Press, 1994
+ *
+ * Fri Feb 16 14:12:43 PST 1996
+ * Modified to use for 8-bit color mapping -- A. Fitzhugh,
+ * HP Labs, Printing Technology Department
+ */
+
+/* linear interpolation from l (when a=0) to h (when a=1)*/
+/* (equal to (a*h)+((1-a)*l) */
+#define LERP(a,l,h) ((l)+((((h)-(l))*(a))>>8))
+
+static void trilinear(unsigned char *p, unsigned char *out, unsigned char *d, int dim, unsigned char def)
+{
+#define DENS(X, Y, Z, ch) d[((X*dim+Y)*dim+Z)*3+ch]
+
+ int x0, y0, z0,
+ x1, y1, z1,
+ i;
+ unsigned char *dp,
+ fx, fy, fz,
+ d000, d001, d010, d011,
+ d100, d101, d110, d111,
+ dx00, dx01, dx10, dx11,
+ dxy0, dxy1;
+ float scale;
+
+ scale = 255.0 / (dim-1);
+
+ x0 = p[0] / scale;
+ y0 = p[1] / scale;
+ z0 = p[2] / scale;
+
+ /* Fractions should range from 0-1.0 (fixed point 8-256) */
+ fx = (((int) (p[0] - x0 * scale)) << 8) / 255;
+ fy = (((int) (p[1] - y0 * scale)) << 8) / 255;
+ fz = (((int) (p[2] - z0 * scale)) << 8) / 255;
+
+ x1 = x0 + 1;
+ y1 = y0 + 1;
+ z1 = z0 + 1;
+
+ for (i=0; i<3; i++) {
+
+ if (x0 >= 0 && x1 < dim &&
+ y0 >= 0 && y1 < dim &&
+ z0 >= 0 && z1 < dim) {
+ dp = &DENS(x0, y0, z0, i);
+ d000 = dp[0];
+ d100 = dp[3];
+ dp += dim*3;
+ d010 = dp[0];
+ d110 = dp[3];
+ dp += dim*dim*3;
+ d011 = dp[0];
+ d111 = dp[3];
+ dp -= dim*3;
+ d001 = dp[0];
+ d101 = dp[3];
+ } else {
+# define INRANGE(X, Y, Z) \
+ ((X) >= 0 && (X) < dim && \
+ (Y) >= 0 && (Y) < dim && \
+ (Z) >= 0 && (Z) < dim)
+
+ d000 = INRANGE(x0, y0, z0) ? DENS(x0, y0, z0, i) : def;
+ d001 = INRANGE(x0, y0, z1) ? DENS(x0, y0, z1, i) : def;
+ d010 = INRANGE(x0, y1, z0) ? DENS(x0, y1, z0, i) : def;
+ d011 = INRANGE(x0, y1, z1) ? DENS(x0, y1, z1, i) : def;
+
+ d100 = INRANGE(x1, y0, z0) ? DENS(x1, y0, z0, i) : def;
+ d101 = INRANGE(x1, y0, z1) ? DENS(x1, y0, z1, i) : def;
+ d110 = INRANGE(x1, y1, z0) ? DENS(x1, y1, z0, i) : def;
+ d111 = INRANGE(x1, y1, z1) ? DENS(x1, y1, z1, i) : def;
+ }
+
+ dx00 = LERP(fx, d000, d100);
+ dx01 = LERP(fx, d001, d101);
+ dx10 = LERP(fx, d010, d110);
+ dx11 = LERP(fx, d011, d111);
+
+ dxy0 = LERP(fy, dx00, dx10);
+ dxy1 = LERP(fy, dx01, dx11);
+
+ out[i] = LERP(fz, dxy0, dxy1);
+ }
+}
+
diff --git a/xorg-server/hw/xprint/pcl/PclCursor.c b/xorg-server/hw/xprint/pcl/PclCursor.c
new file mode 100644
index 000000000..a3eeb1610
--- /dev/null
+++ b/xorg-server/hw/xprint/pcl/PclCursor.c
@@ -0,0 +1,113 @@
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: PclCursor.c
+** *
+** * Contents:
+** * Cursor-handling code for the PCL DDX driver
+** *
+** * Created: 1/18/96
+** *
+** *********************************************************
+**
+********************************************************************/
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS 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 names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <stdio.h>
+
+#include "Pcl.h"
+#include "gcstruct.h"
+#include "windowstr.h"
+
+void
+PclConstrainCursor(
+ ScreenPtr pScreen,
+ BoxPtr pBox)
+{
+}
+
+void
+PclCursorLimits(
+ ScreenPtr pScreen,
+ CursorPtr pCursor,
+ BoxPtr pHotBox,
+ BoxPtr pTopLeftBox)
+{
+}
+
+Bool
+PclDisplayCursor(
+ ScreenPtr pScreen,
+ CursorPtr pCursor)
+{
+ return True;
+}
+
+Bool
+PclRealizeCursor(
+ ScreenPtr pScreen,
+ CursorPtr pCursor)
+{
+ return True;
+}
+
+Bool
+PclUnrealizeCursor(
+ ScreenPtr pScreen,
+ CursorPtr pCursor)
+{
+ return True;
+}
+
+void
+PclRecolorCursor(
+ ScreenPtr pScreen,
+ CursorPtr pCursor,
+ Bool displayed)
+{
+}
+
+Bool
+PclSetCursorPosition(
+ ScreenPtr pScreen,
+ int x,
+ int y,
+ Bool generateEvent)
+{
+ return True;
+}
diff --git a/xorg-server/hw/xprint/pcl/PclDef.h b/xorg-server/hw/xprint/pcl/PclDef.h
new file mode 100644
index 000000000..dcd54c4fe
--- /dev/null
+++ b/xorg-server/hw/xprint/pcl/PclDef.h
@@ -0,0 +1,67 @@
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: PclDef.h
+** *
+** * Contents: extran defines and includes for the Pcl driver
+** * for a printing X server.
+** *
+** * Created: 7/31/95
+** *
+** *********************************************************
+**
+********************************************************************/
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS 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 names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#ifndef _PCLDEF_H_
+#define _PCLDEF_H_
+
+#define DT_PRINT_JOB_HEADER "DT_PRINT_JOB_HEADER"
+#define DT_PRINT_JOB_TRAILER "DT_PRINT_JOB_TRAILER"
+#define DT_PRINT_JOB_COMMAND "DT_PRINT_JOB_COMMAND"
+#define DT_PRINT_JOB_EXEC_COMMAND "DT_PRINT_JOB_EXEC_COMMAND"
+#define DT_PRINT_JOB_EXEC_OPTIONS "DT_PRINT_JOB_EXEC_OPTION"
+#define DT_PRINT_PAGE_HEADER "DT_PRINT_PAGE_HEADER"
+#define DT_PRINT_PAGE_TRAILER "DT_PRINT_PAGE_TRAILER"
+#define DT_PRINT_PAGE_COMMAND "DT_PRINT_PAGE_COMMAND"
+
+#define DT_IN_FILE_STRING "%(InFile)%"
+#define DT_OUT_FILE_STRING "%(OutFile)%"
+#define DT_ALLOWED_COMMANDS_FILE "printCommands"
+
+#endif /* _PCLDEF_H_ */
diff --git a/xorg-server/hw/xprint/pcl/PclFonts.c b/xorg-server/hw/xprint/pcl/PclFonts.c
new file mode 100644
index 000000000..9e993f79c
--- /dev/null
+++ b/xorg-server/hw/xprint/pcl/PclFonts.c
@@ -0,0 +1,72 @@
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: PclFonts.c
+** *
+** * Contents:
+** * Font code for Pcl driver.
+** *
+** * Created: 2/03/95
+** *
+** *********************************************************
+**
+********************************************************************/
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS 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 names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "regionstr.h"
+#include <X11/fonts/fontstruct.h>
+#include "dixfontstr.h"
+#include "scrnintstr.h"
+
+#include "Pcl.h"
+
+Bool
+PclRealizeFont(
+ ScreenPtr pscr,
+ FontPtr pFont)
+{
+ return TRUE;
+}
+
+Bool
+PclUnrealizeFont(
+ ScreenPtr pscr,
+ FontPtr pFont)
+{
+ return TRUE;
+}
diff --git a/xorg-server/hw/xprint/pcl/PclGC.c b/xorg-server/hw/xprint/pcl/PclGC.c
new file mode 100644
index 000000000..fbadf5d5d
--- /dev/null
+++ b/xorg-server/hw/xprint/pcl/PclGC.c
@@ -0,0 +1,971 @@
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: PclGC.c
+** *
+** * Contents:
+** * Graphics Context handling for the PCL driver
+** *
+** * Created: 10/11/95
+** *
+** *********************************************************
+**
+********************************************************************/
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS 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 names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "gcstruct.h"
+
+#include "Pcl.h"
+#include "pixmapstr.h"
+#include "colormapst.h"
+#include "windowstr.h"
+#include "fb.h"
+#include "scrnintstr.h"
+#include "resource.h"
+
+static GCOps PclGCOps =
+{
+ PclFillSpans,
+ PclSetSpans,
+ PclPutImage,
+ PclCopyArea,
+ PclCopyPlane,
+ PclPolyPoint,
+ PclPolyLine,
+ PclPolySegment,
+ PclPolyRectangle,
+ PclPolyArc,
+ PclFillPolygon,
+ PclPolyFillRect,
+ PclPolyFillArc,
+ PclPolyText8,
+ PclPolyText16,
+ PclImageText8,
+ PclImageText16,
+ PclImageGlyphBlt,
+ PclPolyGlyphBlt,
+ PclPushPixels
+}
+;
+
+
+static GCFuncs PclGCFuncs =
+{
+ PclValidateGC,
+ miChangeGC,
+ miCopyGC,
+ PclDestroyGC,
+ miChangeClip,
+ miDestroyClip,
+ miCopyClip,
+}
+;
+
+Bool
+PclCreateGC(GCPtr pGC)
+{
+ if (fbCreateGC(pGC) == FALSE)
+ return FALSE;
+
+ pGC->clientClip = NULL;
+ pGC->clientClipType = CT_NONE;
+
+ pGC->ops = &PclGCOps;
+ pGC->funcs = &PclGCFuncs;
+
+ return TRUE;
+}
+
+void
+PclDestroyGC(GCPtr pGC)
+{
+ /* fb doesn't specialize DestroyGC */
+ miDestroyGC( pGC );
+}
+
+
+int
+PclGetDrawablePrivateStuff(
+ DrawablePtr pDrawable,
+ GC *gc,
+ unsigned long *valid,
+ FILE **file)
+{
+ XpContextPtr pCon;
+ PclContextPrivPtr cPriv;
+
+ switch( pDrawable->type )
+ {
+ case DRAWABLE_PIXMAP:
+ /*
+ * If we ever get here, something is wrong.
+ */
+ return FALSE;
+
+ case DRAWABLE_WINDOW:
+ pCon = PclGetContextFromWindow( (WindowPtr)pDrawable );
+
+ if( pCon == NULL )
+ return FALSE;
+ else
+ {
+ cPriv = (PclContextPrivPtr)
+ dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey);
+ *gc = cPriv->lastGC;
+ *valid = cPriv->validGC;
+ *file = cPriv->pPageFile;
+ return TRUE;
+ }
+
+ default:
+ return FALSE;
+ }
+}
+
+void
+PclSetDrawablePrivateGC(
+ DrawablePtr pDrawable,
+ GC gc)
+{
+ PixmapPtr pix;
+ XpContextPtr pCon;
+ PclPixmapPrivPtr pixPriv;
+ PclContextPrivPtr pPriv;
+ int i;
+
+ switch( pDrawable->type )
+ {
+ case DRAWABLE_PIXMAP:
+ pix = (PixmapPtr)pDrawable;
+ pixPriv = (PclPixmapPrivPtr)
+ dixLookupPrivate(&pix->devPrivates, PclPixmapPrivateKey);
+
+ pixPriv->lastGC = gc;
+ pixPriv->validGC = 1;
+ break;
+
+ case DRAWABLE_WINDOW:
+ pCon = PclGetContextFromWindow( (WindowPtr)pDrawable );
+ pPriv = (PclContextPrivPtr)
+ dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey);
+
+ pPriv->validGC = 1;
+ pPriv->lastGC = gc;
+
+ /*
+ * Store the dash list separately, to avoid having it freed
+ * out from under us.
+ */
+ if( pPriv->dash != NULL )
+ xfree( pPriv->dash );
+ if( gc.numInDashList != 0 )
+ {
+ pPriv->dash = (unsigned char *)xalloc( sizeof( unsigned char )
+ * gc.numInDashList );
+ for( i = 0; i < gc.numInDashList; i++ )
+ pPriv->dash[i] = gc.dash[i];
+ }
+ else
+ pPriv->dash = NULL;
+
+
+ /*
+ * Store the dash list separately, to avoid having it freed
+ * out from under us.
+ */
+ if( pPriv->dash != NULL )
+ xfree( pPriv->dash );
+ if( gc.numInDashList != 0 )
+ {
+ pPriv->dash = (unsigned char *)xalloc( sizeof( unsigned char )
+ * gc.numInDashList );
+ for( i = 0; i < gc.numInDashList; i++ )
+ pPriv->dash[i] = gc.dash[i];
+ }
+ else
+ pPriv->dash = NULL;
+
+ break;
+ }
+}
+
+static void
+PclSendPattern(char *bits,
+ int sz,
+ int depth,
+ int h,
+ int w,
+ int patNum,
+ FILE *outFile)
+{
+ char t[80], *row, *mod;
+ int w2;
+ int i, j;
+
+ SEND_PCL( outFile, "\033%0A" );
+
+ if( depth == 1 )
+ {
+ /* Each row must be word-aligned */
+ w2 = ( w / 8 ) + ( ( w%8 ) ? 1 : 0 );
+/*
+ if( w2 % 2 )
+ w2++;
+*/
+
+ sprintf( t, "\033*c%dg%dW", patNum, h * w2 + 8 );
+ SEND_PCL( outFile, t );
+
+ sprintf( t, "%c%c%c%c%c%c%c%c", 0, 0, 1, 0, h>>8, h&0xff, w>>8,
+ w&0xff );
+ SEND_PCL_COUNT( outFile, t, 8 );
+
+ for( row = bits, i = 0; i < h; i++, row += BitmapBytePad( w ) )
+ SEND_PCL_COUNT( outFile, row, w2 );
+ }
+ else if( depth == 8 )
+ {
+ w2 = ( w % 2 ) ? w + 1 : w;
+
+ sprintf( t, "\033*c%dg%dW", patNum, h * w2 + 8 );
+ SEND_PCL( outFile, t );
+
+ sprintf( t, "%c%c%c%c%c%c%c%c", 1, 0, 8, 0, h>>8, h&0xff,
+ w>>8, w&0xff );
+ SEND_PCL_COUNT( outFile, t, 8 );
+
+ for( row = bits, i = 0; i < h; i++,
+ row += PixmapBytePad( w, 8 ) )
+ SEND_PCL_COUNT( outFile, row, w2 );
+ }
+ else
+ {
+ w2 = ( w % 2 ) ? w + 1 : w;
+
+ sprintf( t, "\033*c%dg%dW", patNum, h * w2 + 8 );
+ SEND_PCL( outFile, t );
+
+ sprintf( t, "%c%c%c%c%c%c%c%c", 1, 0, 8, 0, h>>8, h&0xff,
+ w>>8, w&0xff );
+ SEND_PCL_COUNT( outFile, t, 8 );
+
+ mod = (char *)xalloc( w2 );
+
+ for( row = bits, i = 0; i < h; i++,
+ row += PixmapBytePad( w, 24 ) )
+ {
+ char r, g, b;
+ for( j = 0; j < w2; j++ ) {
+ r = ((row[j*4+1] >> 5) & 0x7) << 5;
+ g = ((row[j*4+2] >> 5) & 0x7) << 2;
+ b = ((row[j*4+3] >> 6) & 0x3);
+ mod[j] = r | g | b;
+ }
+ SEND_PCL_COUNT( outFile, mod, w2 );
+ }
+
+ xfree( mod );
+ }
+
+ SEND_PCL( outFile, "\033%0B" );
+}
+
+int
+PclUpdateDrawableGC(
+ GCPtr pGC,
+ DrawablePtr pDrawable,
+ FILE **outFile)
+{
+ Mask changeMask = 0;
+ GC dGC;
+ unsigned long valid;
+ int i;
+ XpContextPtr pCon;
+ PclContextPrivPtr cPriv;
+ PclGCPrivPtr gcPriv = (PclGCPrivPtr)
+ dixLookupPrivate(&pGC->devPrivates, PclGCPrivateKey);
+
+ if( !PclGetDrawablePrivateStuff( pDrawable, &dGC, &valid, outFile ) )
+ return FALSE;
+
+ pCon = PclGetContextFromWindow( (WindowPtr)pDrawable );
+ cPriv = (PclContextPrivPtr)
+ dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey);
+
+ /*
+ * Here's where we update the colormap. Since there can be
+ * different colormaps installed on each window, we need to check
+ * before each drawing request that the correct palette is active in
+ * the printer. This is as good a place as any.
+ */
+ if( !PclUpdateColormap( pDrawable, pCon, pGC, *outFile ) )
+ return FALSE;
+
+ /*
+ * If the drawable's last GC is NULL, this means that this is
+ * the first time the drawable is being used. Therefore, we need
+ * to emit PCL for all the GC fields.
+ */
+ if( valid == 0 )
+ changeMask = ~0;
+
+ /*
+ * If we have two different GC structures, there is no alternative
+ * but to scan through them both to determine the changeMask.
+ */
+ else
+ {
+ if( dGC.alu != pGC->alu )
+ changeMask |= GCFunction;
+ if( dGC.fgPixel != pGC->fgPixel )
+ changeMask |= GCForeground;
+ if( dGC.bgPixel != pGC->bgPixel )
+ changeMask |= GCBackground;
+ if( dGC.lineWidth != pGC->lineWidth )
+ changeMask |= GCLineWidth;
+ if( dGC.lineStyle != pGC->lineStyle )
+ changeMask |= GCLineStyle;
+ if( dGC.capStyle != pGC->capStyle )
+ changeMask |= GCCapStyle;
+ if( dGC.joinStyle != pGC->joinStyle )
+ changeMask |= GCJoinStyle;
+ if( dGC.fillStyle != pGC->fillStyle )
+ changeMask |= GCFillStyle;
+ if( dGC.tile.pixmap != pGC->tile.pixmap )
+ changeMask |= GCTile;
+ if( dGC.stipple != pGC->stipple )
+ changeMask |= GCStipple;
+ if( dGC.patOrg.x != pGC->patOrg.x )
+ changeMask |= GCTileStipXOrigin;
+ if( dGC.patOrg.y != pGC->patOrg.y )
+ changeMask |= GCTileStipYOrigin;
+
+ if( dGC.numInDashList == pGC->numInDashList )
+ {
+ for( i = 0; i < dGC.numInDashList; i++ )
+ if( cPriv->dash[i] != pGC->dash[i] )
+ {
+ changeMask |= GCDashList;
+ break;
+ }
+ }
+ else
+ changeMask |= GCDashList;
+ }
+
+ /*
+ * Once the changeMask has been determined, we scan it and emit
+ * the appropriate PCL code to set the drawing attributes.
+ */
+
+ /* Must be in HP-GL/2 mode to set attributes */
+ SEND_PCL( *outFile, "\033%0B" );
+
+ if( changeMask & GCFunction )
+ {
+#ifdef XP_PCL_COLOR
+
+ if( pGC->alu == GXclear )
+ SEND_PCL( *outFile, "SP0;" );
+ else
+ SEND_PCL( *outFile, "SP1;" );
+#else
+ if( pGC->alu == GXclear )
+ SEND_PCL( *outFile, "SP0;" );
+ else
+ SEND_PCL( *outFile, "SP1;" );
+#endif /* XP_PCL_COLOR */
+ }
+
+#if 0
+ if( changeMask & GCFunction )
+ {
+ int rop = -1;
+ char t[10];
+
+ switch( pGC->alu )
+ {
+ case GXclear:
+ rop = 1;
+ break;
+ case GXand:
+ rop = 136;
+ break;
+ case GXandReverse:
+ rop = 68;
+ break;
+ case GXcopy:
+ rop = 204;
+ break;
+ case GXandInverted:
+ rop = 34;
+ break;
+ case GXnoop:
+ rop = 170;
+ break;
+ case GXxor:
+ rop = 238;
+ break;
+ case GXor:
+ rop = 238;
+ break;
+ case GXnor:
+ rop = 17;
+ break;
+ case GXequiv:
+ rop = 153;
+ break;
+ case GXinvert:
+ rop = 85;
+ break;
+ case GXorReverse:
+ rop = 221;
+ break;
+ case GXcopyInverted:
+ rop = 51;
+ break;
+ case GXorInverted:
+ rop = 187;
+ break;
+ case GXnand:
+ rop = 119;
+ break;
+ case GXset:
+ rop = 0;
+ break;
+ }
+ if( rop != -1 )
+ {
+ sprintf( t, "MC1,%d;", rop );
+ SEND_PCL( *outFile, t );
+#endif
+
+ if( changeMask & GCForeground )
+ switch( pGC->fgPixel )
+ {
+ case 1:
+ SEND_PCL( *outFile, "SP1;" );
+ break;
+ default:
+ SEND_PCL( *outFile, "SP0;" );
+ break;
+ }
+
+ if( changeMask & GCForeground )
+ {
+#ifdef XP_PCL_COLOR
+ ColormapPtr cmap;
+ Colormap c;
+ char t[40];
+
+ c = wColormap( ((WindowPtr)pDrawable) );
+ cmap = (ColormapPtr)LookupIDByType( c, RT_COLORMAP );
+
+ if( cmap->class == TrueColor )
+ {
+ if( pGC->fillStyle != FillTiled || pGC->tileIsPixel ) {
+ unsigned short r, g, b;
+
+ r = (pGC->fgPixel & cmap->pVisual->redMask)
+ >> (cmap->pVisual->offsetRed );
+ g = (pGC->fgPixel & cmap->pVisual->greenMask)
+ >> (cmap->pVisual->offsetGreen);
+ b = (pGC->fgPixel & cmap->pVisual->blueMask)
+ >> (cmap->pVisual->offsetBlue);
+
+ PclLookUp(cmap, cPriv, &r, &g, &b);
+ sprintf( t, "\033%%0A\033*v%ua%ub%uc0I\033%%0B", r, g, b);
+ SEND_PCL( *outFile, t );
+ }
+ }
+ else /* PseudoColor or StaticGray */
+ {
+ sprintf( t, "SP%ld;", (long) pGC->fgPixel );
+ SEND_PCL( *outFile, t );
+ }
+#else
+ ScreenPtr screen;
+ screen = pDrawable->pScreen;
+ if ( pGC->fgPixel == screen->whitePixel )
+ SEND_PCL( *outFile, "SP0;");
+ else
+ SEND_PCL( *outFile, "SP1;");
+#endif /* XP_PCL_COLOR */
+ }
+
+ if( changeMask & GCJoinStyle )
+ switch( pGC->joinStyle )
+ {
+ case JoinMiter:
+ SEND_PCL( *outFile, "LA2,1;" );
+ break;
+ case JoinRound:
+ SEND_PCL( *outFile, "LA2,4;" );
+ break;
+ case JoinBevel:
+ SEND_PCL( *outFile, "LA2,5;" );
+ break;
+ }
+
+ if( changeMask & GCCapStyle )
+ switch( pGC->capStyle )
+ {
+ case CapNotLast:
+ case CapButt:
+ SEND_PCL( *outFile, "LA1,1;" );
+ break;
+ case CapRound:
+ SEND_PCL( *outFile, "LA1,4;" );
+ break;
+ case CapProjecting:
+ SEND_PCL( *outFile, "LA1,2;" );
+ break;
+ }
+
+ if( changeMask & GCLineWidth )
+ {
+ float penWidth, pixelsPerMM;
+ ScreenPtr screen;
+ char temp[30];
+
+ if( pGC->lineWidth == 0 || pGC->lineWidth == 1 )
+ /* A pen width of 0.0 mm gives a one-pixel-wide line */
+ penWidth = 0.0;
+ else
+ {
+ screen = pDrawable->pScreen;
+ pixelsPerMM = (float)screen->width / (float)screen->mmWidth;
+
+ penWidth = pGC->lineWidth / pixelsPerMM;
+ }
+ sprintf( temp, "PW%g;", penWidth );
+ SEND_PCL( *outFile, temp );
+ }
+
+ if( changeMask & GCLineStyle )
+ {
+ int i, num = pGC->numInDashList;
+ double total;
+ char t[30];
+
+ switch( pGC->lineStyle )
+ {
+ case LineSolid:
+ SEND_PCL( *outFile, "LT;" );
+ break;
+ case LineOnOffDash:
+ /*
+ * Calculate the pattern length of the dashes, in pixels,
+ * then convert to mm
+ */
+ for( i = 0, total = 0.0; i < 20 && i < num; i++ )
+ total += pGC->dash[i];
+ if( num % 2 )
+ for( i = num; i < 20 && i < num + num; i++ )
+ total += pGC->dash[i-num];
+
+ total *= ( (double)pDrawable->pScreen->mmWidth /
+ (double)pDrawable->pScreen->width );
+
+ sprintf( t, "LT8,%f,1;", total );
+ SEND_PCL( *outFile, t );
+ break;
+ }
+ }
+
+
+ if( changeMask & GCFillStyle )
+ switch( pGC->fillStyle )
+ {
+ case FillSolid:
+ SEND_PCL( *outFile, "FT1;TR0;CF;" );
+ break;
+ case FillTiled:
+ SEND_PCL( *outFile, "FT22,100;TR0;CF2,0;" );
+ break;
+ case FillOpaqueStippled:
+ SEND_PCL( *outFile, "FT22,101;TR0;CF2,0;" );
+ if( pGC->fgPixel != gcPriv->stippleFg ||
+ pGC->bgPixel != gcPriv->stippleBg )
+ changeMask |= GCStipple;
+ break;
+ case FillStippled:
+ SEND_PCL( *outFile, "FT22,102;TR1;CF2,0;" );
+ break;
+ }
+
+ if( changeMask & GCTile && !pGC->tileIsPixel )
+ {
+ char *bits;
+ int h, w, sz;
+
+ h = pGC->tile.pixmap->drawable.height;
+ w = pGC->tile.pixmap->drawable.width;
+
+ sz = h * PixmapBytePad(w, pGC->tile.pixmap->drawable.depth);
+ bits = (char *)xalloc(sz);
+ fbGetImage(&(pGC->tile.pixmap->drawable), 0, 0, w, h, XYPixmap, ~0,
+ bits);
+ PclSendPattern( bits, sz, 1, h, w, 100, *outFile );
+ xfree( bits );
+ }
+
+ if( changeMask & ( GCTileStipXOrigin | GCTileStipYOrigin ) )
+ {
+ char t[30];
+
+ sprintf( t, "AC%d,%d;", pGC->patOrg.x, pGC->patOrg.y );
+ SEND_PCL( *outFile, t );
+ }
+
+ /*
+ * We have to resend the stipple pattern either when the stipple itself
+ * changes, or if we're in FillOpaqueStippled mode and either the
+ * foreground or the background color changes.
+ */
+ if( changeMask & GCStipple ||
+ ( pGC->fillStyle == FillOpaqueStippled &&
+ ( pGC->fgPixel != gcPriv->stippleFg ||
+ pGC->bgPixel != gcPriv->stippleBg ) ) )
+ {
+ int h, w, i, sz, w2;
+ char *bits, *row, t[30];
+ PixmapPtr scratchPix;
+ GCPtr scratchGC;
+
+ if( pGC->stipple != NULL )
+ {
+ SEND_PCL( *outFile, "\033%0A" );
+
+ h = pGC->stipple->drawable.height;
+ w = pGC->stipple->drawable.width;
+ sz = h * BitmapBytePad( w );
+
+ bits = (char *)xalloc( sz );
+ fbGetImage( &(pGC->stipple->drawable), 0, 0, w, h, XYPixmap, ~0, bits );
+
+ w2 = ( w / 8 ) + ( ( w%8 ) ? 1 : 0 );
+ /*
+ * XXX The PCL docs say that I need to word-align each
+ * XXX row, but I get garbage when I do...
+ */
+ /*
+ if( w2 % 2 )
+ w2++;
+ */
+
+ sprintf( t, "\033*c102g%dW", h * w2 + 8 );
+ SEND_PCL( *outFile, t );
+
+ sprintf( t, "%c%c%c%c%c%c%c%c", 0, 0, 1, 0, h>>8, h&0xff, w>>8,
+ w&0xff );
+ SEND_PCL_COUNT( *outFile, t, 8 );
+
+ for( row = bits, i = 0; i < h; i++, row += BitmapBytePad( w ) )
+ SEND_PCL_COUNT( *outFile, row, w2 );
+
+ SEND_PCL( *outFile, "\033%0B" );
+
+ xfree( bits );
+
+ /*
+ * Also do the opaque stipple, as a tile
+ */
+ if( pGC->depth != 1 )
+ sz = h * PixmapBytePad( w, pGC->depth );
+ bits = (char *)xalloc( sz );
+
+ scratchPix =
+ (*pGC->pScreen->CreatePixmap)( pGC->pScreen,
+ w, h, pGC->depth,
+ CREATE_PIXMAP_USAGE_SCRATCH );
+ scratchGC = GetScratchGC( pGC->depth, pGC->pScreen );
+ CopyGC( pGC, scratchGC, ~0L );
+
+ fbValidateGC(scratchGC, ~0L, (DrawablePtr)scratchPix);
+ fbCopyPlane(&(pGC->stipple->drawable), (DrawablePtr)scratchPix,
+ scratchGC, 0, 0, w, h, 0, 0, 1);
+ fbGetImage(&(scratchPix->drawable), 0, 0, w, h, XYPixmap, ~0,
+ bits);
+ PclSendPattern( bits, sz, pGC->depth, h, w, 101, *outFile );
+ FreeScratchGC( scratchGC );
+ (*pGC->pScreen->DestroyPixmap)( scratchPix );
+ xfree( bits );
+ }
+ }
+
+ if( changeMask & ( GCTileStipXOrigin | GCTileStipYOrigin ) )
+ {
+ char t[30];
+
+ sprintf( t, "AC%d,%d;", pGC->patOrg.x, pGC->patOrg.y );
+ SEND_PCL( *outFile, t );
+ }
+
+ if( changeMask & GCDashList )
+ {
+ int num = pGC->numInDashList;
+ double total;
+ char dashes[20];
+ char t[100], t2[20];
+
+ /* Make up the doubled dash list, if necessary */
+ for( i = 0; i < 20 && i < num; i++ )
+ dashes[i] = pGC->dash[i];
+
+ if( num % 2 )
+ {
+ for( i = num; i < 20 && i < num + num; i++ )
+ dashes[i] = dashes[i-num];
+ if( ( num *= 2 ) > 20 )
+ num = 20;
+ }
+
+ /* Add up dash lengths to get percentage */
+ for( i = 0, total = 0; i < num; i++ )
+ total += dashes[i];
+
+ /* Build up the HP-GL/2 for the dash list */
+ strcpy( t, "UL8" );
+ for( i = 0; i < num; i++ )
+ {
+ sprintf( t2, ",%d",
+ (int)( ( (double)dashes[i] / total * 100.0 ) + 0.5 ) );
+ strcat( t, t2 );
+ }
+ strcat( t, ";" );
+ SEND_PCL( *outFile, t );
+ }
+
+
+ /* Go back to PCL mode */
+ SEND_PCL( *outFile, "\033%0A" );
+
+ /*
+ * Update the drawable's private information, which includes
+ * erasing the drawable's private changeMask, since all the
+ * changes have been made.
+ */
+ if( changeMask )
+ PclSetDrawablePrivateGC( pDrawable, *pGC );
+
+ return TRUE;
+}
+
+/*
+ * PclComputeCompositeClip()
+ *
+ * I'd like to use the miComputeCompositeClip function, but it sticks
+ * things into the mi GC privates, where the PCL driver can't get at
+ * it. So, rather than mess around with the mi code, I ripped it out
+ * and made the appropriate changes here.
+ */
+
+
+void
+PclComputeCompositeClip(
+ GCPtr pGC,
+ DrawablePtr pDrawable)
+{
+ if (pDrawable->type == DRAWABLE_WINDOW)
+ {
+ WindowPtr pWin = (WindowPtr) pDrawable;
+ RegionPtr pregWin;
+ Bool freeTmpClip, freeCompClip;
+
+ if (pGC->subWindowMode == IncludeInferiors)
+ {
+ pregWin = NotClippedByChildren(pWin);
+ freeTmpClip = TRUE;
+ }
+ else
+ {
+ pregWin = &pWin->clipList;
+ freeTmpClip = FALSE;
+ }
+ freeCompClip = pGC->freeCompClip;
+
+ /*
+ * if there is no client clip, we can get by with just keeping the
+ * pointer we got, and remembering whether or not should destroy (or
+ * maybe re-use) it later. this way, we avoid unnecessary copying of
+ * regions. (this wins especially if many clients clip by children
+ * and have no client clip.)
+ */
+ if (pGC->clientClipType == CT_NONE)
+ {
+ if (freeCompClip)
+ REGION_DESTROY(pGC->pScreen, pGC->pCompositeClip);
+ pGC->pCompositeClip = pregWin;
+ pGC->freeCompClip = freeTmpClip;
+ }
+ else
+ {
+ /*
+ * we need one 'real' region to put into the composite clip. if
+ * pregWin the current composite clip are real, we can get rid of
+ * one. if pregWin is real and the current composite clip isn't,
+ * use pregWin for the composite clip. if the current composite
+ * clip is real and pregWin isn't, use the current composite
+ * clip. if neither is real, create a new region.
+ */
+
+ REGION_TRANSLATE(pGC->pScreen, pGC->clientClip,
+ pDrawable->x + pGC->clipOrg.x,
+ pDrawable->y + pGC->clipOrg.y);
+
+ if (freeCompClip)
+ {
+ REGION_INTERSECT(pGC->pScreen, pGC->pCompositeClip,
+ pregWin, pGC->clientClip);
+ if (freeTmpClip)
+ REGION_DESTROY(pGC->pScreen, pregWin);
+ }
+ else if (freeTmpClip)
+ {
+ REGION_INTERSECT(pGC->pScreen, pregWin, pregWin,
+ pGC->clientClip);
+ pGC->pCompositeClip = pregWin;
+ }
+ else
+ {
+ pGC->pCompositeClip = REGION_CREATE(pGC->pScreen, NullBox, 0);
+ REGION_INTERSECT(pGC->pScreen, pGC->pCompositeClip,
+ pregWin, pGC->clientClip);
+ }
+ pGC->freeCompClip = TRUE;
+ REGION_TRANSLATE(pGC->pScreen, pGC->clientClip,
+ -(pDrawable->x + pGC->clipOrg.x),
+ -(pDrawable->y + pGC->clipOrg.y));
+ }
+ } /* end of composite clip for a window */
+ else
+ {
+ BoxRec pixbounds;
+
+ /* XXX should we translate by drawable.x/y here ? */
+ pixbounds.x1 = 0;
+ pixbounds.y1 = 0;
+ pixbounds.x2 = pDrawable->width;
+ pixbounds.y2 = pDrawable->height;
+
+ if (pGC->freeCompClip)
+ {
+ REGION_RESET(pGC->pScreen, pGC->pCompositeClip, &pixbounds);
+ }
+ else
+ {
+ pGC->freeCompClip = TRUE;
+ pGC->pCompositeClip = REGION_CREATE(pGC->pScreen, &pixbounds, 1);
+ }
+
+ if (pGC->clientClipType == CT_REGION)
+ {
+ REGION_TRANSLATE(pGC->pScreen, pGC->pCompositeClip,
+ -pGC->clipOrg.x, -pGC->clipOrg.y);
+ REGION_INTERSECT(pGC->pScreen, pGC->pCompositeClip,
+ pGC->pCompositeClip, pGC->clientClip);
+ REGION_TRANSLATE(pGC->pScreen, pGC->pCompositeClip,
+ pGC->clipOrg.x, pGC->clipOrg.y);
+ }
+ } /* end of composite clip for pixmap */
+}
+
+/*
+ * PclValidateGC()
+ *
+ * Unlike many screen GCValidate routines, this function should not need
+ * to mess with setting the drawing functions. Different drawing
+ * functions are usually needed to optimize such things as drawing
+ * wide or dashed lines; this functionality will be handled primarily
+ * by the printer itself, while the necessary PCL code to set the
+ * attributes will be done in PclUpdateDrawableGC().
+ */
+
+/*ARGSUSED*/
+void
+PclValidateGC(
+ GCPtr pGC,
+ unsigned long changes,
+ DrawablePtr pDrawable)
+{
+ /*
+ * Pixmaps should be handled by their respective validation
+ * functions.
+ */
+ if( pDrawable->type == DRAWABLE_PIXMAP )
+ {
+ fbValidateGC(pGC, ~0, pDrawable);
+ return;
+ }
+
+ /*
+ * Reset the drawing operations
+ */
+ pGC->ops = &PclGCOps;
+
+ /*
+ * Validate the information, and correct it if necessary.
+ */
+
+ /*
+ * If necessary, compute the composite clip region. (Code ripped
+ * from migc.c)
+ */
+ if ((changes & (GCClipXOrigin|GCClipYOrigin|GCClipMask|GCSubwindowMode)) ||
+ (pDrawable->serialNumber != (pGC->serialNumber & DRAWABLE_SERIAL_BITS))
+ )
+ {
+ PclComputeCompositeClip(pGC, pDrawable);
+ }
+
+ /*
+ * PCL does not directly support the DoubleDash line style, nor is
+ * there an easy way to simulate it, so we'll just change it to a
+ * LineOnOffDash, which is supported by PCL.
+ */
+ if( ( changes & GCLineStyle ) && ( pGC->lineStyle == LineDoubleDash ) )
+ pGC->lineStyle = LineOnOffDash;
+
+ /*
+ * Update the drawable's changeMask to reflect the changes made to the GC.
+ */
+/*
+ PclSetDrawablePrivateGC( pDrawable, *pGC, changes );
+*/
+}
diff --git a/xorg-server/hw/xprint/pcl/PclInit.c b/xorg-server/hw/xprint/pcl/PclInit.c
new file mode 100644
index 000000000..e738e3e54
--- /dev/null
+++ b/xorg-server/hw/xprint/pcl/PclInit.c
@@ -0,0 +1,575 @@
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: PclInit.c
+** *
+** * Contents:
+** * Initialization code of Pcl driver for the print server.
+** *
+** * Created: 1/30/95
+** *
+** *********************************************************
+**
+********************************************************************/
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS 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 names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <stdio.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+
+#include "Pcl.h"
+
+#include "fb.h"
+#include <X11/Xos.h> /* for unlink() */
+
+#include "attributes.h"
+#include "DiPrint.h"
+
+#define MODELDIRNAME "/models"
+
+static void AllocatePclPrivates(ScreenPtr pScreen);
+static int PclInitContext(XpContextPtr pCon);
+static Bool PclDestroyContext(XpContextPtr pCon);
+
+DevPrivateKey PclScreenPrivateKey = &PclScreenPrivateKey;
+DevPrivateKey PclContextPrivateKey = &PclContextPrivateKey;
+DevPrivateKey PclPixmapPrivateKey = &PclPixmapPrivateKey;
+DevPrivateKey PclWindowPrivateKey = &PclWindowPrivateKey;
+DevPrivateKey PclGCPrivateKey = &PclGCPrivateKey;
+
+#ifdef XP_PCL_COLOR
+/*
+ * The supported visuals on this screen
+ */
+static VisualRec Visuals[] =
+{
+ { 1, StaticGray, 1, 2, 1, 0, 0, 0, 0, 0, 0 },
+ { 2, PseudoColor, 8, 256, 8, 0, 0, 0, 0, 0, 0 },
+ { 3, TrueColor, 8, 256, 24, 0xFF0000, 0xFF00, 0xFF, 16, 8, 0 }
+};
+
+/*
+ * The supported depths on this screen
+ */
+static DepthRec Depths[] =
+{
+ { 1, 1, NULL },
+ { 8, 1, NULL },
+ { 24, 1, NULL }
+};
+#else
+/*
+ * The supported visuals on this screen
+ */
+static VisualRec Visuals[] =
+{
+ { 1, StaticGray, 1, 2, 1, 0, 0, 0, 0, 0, 0}
+};
+
+/*
+ * The supported depths on this screen
+ */
+static DepthRec Depths[] =
+{
+ { 1, 1, NULL }
+};
+#endif /* XP_PCL_COLOR */
+
+
+#define NUM_VISUALS(visuals) (sizeof(visuals) / sizeof(VisualRec))
+#define NUM_DEPTHS(depths) (sizeof(depths) / sizeof(DepthRec))
+
+Bool
+PclCloseScreen(int index,
+ ScreenPtr pScreen)
+{
+ PclScreenPrivPtr pPriv = (PclScreenPrivPtr)
+ dixLookupPrivate(&pScreen->devPrivates, PclScreenPrivateKey);
+
+ pScreen->CloseScreen = pPriv->CloseScreen;
+ xfree( pPriv );
+
+ return (*pScreen->CloseScreen)(index, pScreen);
+}
+
+Bool
+InitializePclDriver(
+ int ndx,
+ ScreenPtr pScreen,
+ int argc,
+ char **argv)
+{
+ int maxRes, xRes, yRes, maxDim;
+ unsigned i;
+ PclScreenPrivPtr pPriv;
+
+ /*
+ * Register this driver's InitContext function with the print
+ * extension. This is a bit sleazy, as the extension hasn't yet
+ * been initialized, but the extensionneeds to know this, and this
+ * seems the best time to provide the information.
+ */
+#ifdef XP_PCL_COLOR
+ XpRegisterInitFunc( pScreen, "XP-PCL-COLOR", PclInitContext );
+#elif XP_PCL_MONO
+ XpRegisterInitFunc( pScreen, "XP-PCL-MONO", PclInitContext );
+#else
+ XpRegisterInitFunc( pScreen, "XP-PCL-LJ3", PclInitContext );
+#endif /* XP_PCL_MONO */
+
+ /*
+ * Create and fill in the devPrivate for the PCL driver.
+ */
+ AllocatePclPrivates(pScreen);
+
+ pPriv = (PclScreenPrivPtr)
+ dixLookupPrivate(&pScreen->devPrivates, PclScreenPrivateKey);
+
+ maxDim = MAX( pScreen->height, pScreen->width );
+ xRes = pScreen->width / ( pScreen->mmWidth / 25.4 );
+ yRes = pScreen->height / ( pScreen->mmHeight / 25.4 );
+ maxRes = MAX( xRes, yRes );
+
+#ifdef XP_PCL_COLOR
+ fbScreenInit( pScreen, NULL, maxDim, maxDim, maxRes, maxRes,
+ maxRes, 8 ); /* XXX what's the depth here? */
+ /* Clean up the fields that we stomp (code taken from fbCloseScreen) */
+ for( i = 0; (int) i < pScreen->numDepths; i++ )
+ xfree( pScreen->allowedDepths[i].vids );
+ xfree( pScreen->allowedDepths );
+ xfree( pScreen->visuals );
+#else
+ fbScreenInit( pScreen, NULL, maxDim, maxDim, maxRes, maxRes,
+ maxRes, 1 );
+#endif /* XP_PCL_COLOR */
+
+ miInitializeBackingStore ( pScreen );
+
+ pScreen->defColormap = FakeClientID(0);
+ pScreen->blackPixel = 1;
+ pScreen->whitePixel = 0;
+
+ pPriv->CloseScreen = pScreen->CloseScreen;
+ pScreen->CloseScreen = PclCloseScreen;
+
+ pScreen->QueryBestSize = (QueryBestSizeProcPtr)PclQueryBestSize;
+ pScreen->SaveScreen = (SaveScreenProcPtr)_XpBoolNoop;
+ pScreen->GetImage = (GetImageProcPtr)_XpVoidNoop;
+ pScreen->GetSpans = (GetSpansProcPtr)_XpVoidNoop;
+ pScreen->CreateWindow = PclCreateWindow;
+ pScreen->DestroyWindow = PclDestroyWindow;
+/*
+ pScreen->PositionWindow = PclPositionWindow;
+*/
+ pScreen->ChangeWindowAttributes = PclChangeWindowAttributes;
+/*
+ pScreen->RealizeWindow = PclMapWindow;
+ pScreen->UnrealizeWindow = PclUnmapWindow;
+*/
+ pScreen->CopyWindow = PclCopyWindow; /* XXX Hard routine to write! */
+
+ pScreen->CreatePixmap = fbCreatePixmap;
+ pScreen->DestroyPixmap = fbDestroyPixmap;
+ pScreen->RealizeFont = PclRealizeFont;
+ pScreen->UnrealizeFont = PclUnrealizeFont;
+ pScreen->CreateGC = PclCreateGC;
+
+ pScreen->CreateColormap = PclCreateColormap;
+ pScreen->DestroyColormap = PclDestroyColormap;
+ pScreen->InstallColormap = (InstallColormapProcPtr)NoopDDA;
+ pScreen->UninstallColormap = (UninstallColormapProcPtr)NoopDDA;
+ pScreen->ListInstalledColormaps = PclListInstalledColormaps;
+ pScreen->StoreColors = PclStoreColors;
+/*
+ pScreen->ResolveColor = PclResolveColor;
+*/
+
+ pScreen->BitmapToRegion = fbPixmapToRegion;
+
+ pScreen->ConstrainCursor = PclConstrainCursor;
+ pScreen->CursorLimits = PclCursorLimits;
+ pScreen->DisplayCursor = PclDisplayCursor;
+ pScreen->RealizeCursor = PclRealizeCursor;
+ pScreen->UnrealizeCursor = PclUnrealizeCursor;
+ pScreen->RecolorCursor = PclRecolorCursor;
+ pScreen->SetCursorPosition = PclSetCursorPosition;
+
+ pScreen->visuals = Visuals;
+ pScreen->numVisuals = NUM_VISUALS( Visuals );
+ pScreen->allowedDepths = Depths;
+ pScreen->numDepths = NUM_DEPTHS( Depths );
+
+ for( i = 0; i < NUM_DEPTHS( Depths ); i++ )
+ {
+ pScreen->allowedDepths[i].vids =
+ (VisualID *)xalloc( sizeof(VisualID ) );
+ pScreen->allowedDepths[i].vids[0] = i + 1;
+ }
+
+#ifdef XP_PCL_COLOR
+ pScreen->rootVisual = 2;
+ pScreen->rootDepth = 8;
+#else
+ pScreen->rootVisual = 1;
+ pScreen->rootDepth = 1;
+#endif /* XP_PCL_COLOR */
+
+ pPriv->colormaps = NULL;
+ PclCreateDefColormap( pScreen );
+
+ return TRUE;
+}
+
+static void
+AllocatePclPrivates(ScreenPtr pScreen)
+{
+ dixRequestPrivate(PclWindowPrivateKey, sizeof( PclWindowPrivRec ) );
+ dixRequestPrivate(PclContextPrivateKey, sizeof( PclContextPrivRec ) );
+ dixRequestPrivate(PclGCPrivateKey, sizeof( PclGCPrivRec ) );
+ dixRequestPrivate(PclPixmapPrivateKey, sizeof( PclPixmapPrivRec ) );
+
+ dixSetPrivate(&pScreen->devPrivates, PclScreenPrivateKey,
+ xalloc(sizeof(PclScreenPrivRec)));
+}
+
+/*
+ * PclInitContext
+ *
+ * Establish the appropriate values for a PrintContext used with the PCL
+ * driver.
+ */
+
+static char DOC_ATT_SUPP[]="document-attributes-supported";
+static char DOC_ATT_VAL[]="document-format xp-listfonts-modes";
+static char JOB_ATT_SUPP[]="job-attributes-supported";
+static char JOB_ATT_VAL[]="";
+static char PAGE_ATT_SUPP[]="xp-page-attributes-supported";
+static char PAGE_ATT_VAL[]="content-orientation default-printer-resolution \
+default-input-tray default-medium plex xp-listfonts-modes";
+
+static int
+PclInitContext(XpContextPtr pCon)
+{
+ XpDriverFuncsPtr pFuncs;
+ PclContextPrivPtr pConPriv;
+ char *server, *attrStr;
+ char *modelID;
+ char *configDir;
+ char *pathName;
+ int i, j;
+ float width, height;
+ XpOidMediumDiscreteSizeList* ds_list;
+ XpOidArea* repro;
+ XpOid page_size;
+ XpOidMediumSS* m;
+
+ /*
+ * Initialize the attribute store for this printer.
+ */
+ XpInitAttributes( pCon );
+
+ /*
+ * Initialize the function pointers
+ */
+ pFuncs = &( pCon->funcs );
+ pFuncs->StartJob = PclStartJob;
+ pFuncs->EndJob = PclEndJob;
+ pFuncs->StartDoc = PclStartDoc;
+ pFuncs->EndDoc = PclEndDoc;
+ pFuncs->StartPage = PclStartPage;
+ pFuncs->EndPage = PclEndPage;
+ pFuncs->PutDocumentData = PclDocumentData;
+ pFuncs->GetDocumentData = PclGetDocumentData;
+ pFuncs->GetAttributes = PclGetAttributes;
+ pFuncs->SetAttributes = PclSetAttributes;
+ pFuncs->AugmentAttributes = PclAugmentAttributes;
+ pFuncs->GetOneAttribute = PclGetOneAttribute;
+ pFuncs->DestroyContext = PclDestroyContext;
+ pFuncs->GetMediumDimensions = PclGetMediumDimensions;
+ pFuncs->GetReproducibleArea = PclGetReproducibleArea;
+
+
+ /*
+ * Set up the context privates
+ */
+ pConPriv = (PclContextPrivPtr)
+ dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey);
+
+ pConPriv->jobFileName = (char *)NULL;
+ pConPriv->pageFileName = (char *)NULL;
+ pConPriv->pJobFile = (FILE *)NULL;
+ pConPriv->pPageFile = (FILE *)NULL;
+ pConPriv->dash = NULL;
+ pConPriv->validGC = 0;
+
+ pConPriv->getDocClient = (ClientPtr)NULL;
+ pConPriv->getDocBufSize = 0;
+ modelID = XpGetOneAttribute(pCon, XPPrinterAttr, "xp-model-identifier");
+ if ( (configDir = XpGetConfigDir(False)) != (char *) NULL ) {
+ pathName = (char *)xalloc(strlen(configDir) + strlen(MODELDIRNAME) +
+ strlen(modelID) + strlen("color.map") + 4);
+ if (pathName) {
+ sprintf(pathName, "%s/%s/%s/%s", configDir, MODELDIRNAME, modelID,
+ "color.map");
+ pConPriv->ctbl = PclReadMap(pathName, &pConPriv->ctbldim);
+ xfree(pathName);
+
+ } else
+ pConPriv->ctbl = NULL;
+ } else
+ pConPriv->ctbl = NULL;
+
+#ifdef XP_PCL_LJ3
+ /*
+ * Initialize the spooling buffer for saving the figures temporary
+ * (LaserJet IIIs printers don't support the macro function which
+ * includes some HP-GL/2 commands.)
+ */
+ pConPriv->fcount = 0;
+ if ( !(pConPriv->figures = (char *)xalloc(1024)) )
+ pConPriv->fcount_max = 0;
+ else
+ pConPriv->fcount_max = 1024;
+#endif /* XP_PCL_LJ3 */
+
+ /*
+ * document-attributes-supported
+ */
+ server = XpGetOneAttribute( pCon, XPServerAttr, DOC_ATT_SUPP );
+ if( ( attrStr = (char *)xalloc(strlen(server) + strlen(DOC_ATT_SUPP)
+ + strlen(DOC_ATT_VAL) +
+ strlen(PAGE_ATT_VAL) + 8 ) )
+ == (char *)NULL )
+ return BadAlloc;
+ sprintf( attrStr, "*%s:\t%s %s %s", DOC_ATT_SUPP, server,
+ DOC_ATT_VAL, PAGE_ATT_VAL );
+ XpAugmentAttributes( pCon, XPPrinterAttr, attrStr );
+ xfree( attrStr );
+
+ /*
+ * job-attributes-supported
+ */
+ server = XpGetOneAttribute( pCon, XPServerAttr, JOB_ATT_SUPP );
+ if( ( attrStr = (char *)xalloc(strlen(server) + strlen(JOB_ATT_SUPP)
+ + strlen(JOB_ATT_VAL) + 8 ) )
+ == (char *)NULL )
+ return BadAlloc;
+ sprintf( attrStr, "*%s:\t%s %s", JOB_ATT_SUPP, server, JOB_ATT_VAL );
+ XpAugmentAttributes( pCon, XPPrinterAttr, attrStr );
+ xfree( attrStr );
+
+ /*
+ * xp-page-attributes-supported
+ */
+ server = XpGetOneAttribute( pCon, XPServerAttr, PAGE_ATT_SUPP );
+ if( ( attrStr = (char *)xalloc(strlen(server) + strlen(PAGE_ATT_SUPP)
+ + strlen(PAGE_ATT_VAL) + 8 ) )
+ == (char *)NULL )
+ return BadAlloc;
+ sprintf( attrStr, "*%s:\t%s %s", PAGE_ATT_SUPP, server, PAGE_ATT_VAL );
+ XpAugmentAttributes( pCon, XPPrinterAttr, attrStr );
+ xfree( attrStr );
+
+ /*
+ * Validate the attribute pools
+ */
+ XpValidateAttributePool( pCon, XPPrinterAttr, &PclValidatePoolsRec );
+
+ /*
+ * Munge the reproducible areas to reflect the fact that PCL will not let
+ * me move the right or left margins closer than .25" to the edge of the
+ * paper.
+ */
+ m = XpGetMediumSSAttr( pCon, XPPrinterAttr,
+ xpoid_att_medium_source_sizes_supported,
+ (const XpOidList*) NULL,
+ (const XpOidList*) NULL );
+ for( i = 0; i < XpOidMediumSSCount( m ); i++ )
+ {
+ if( XpOidMediumSS_DISCRETE == (m->mss)[i].mstag )
+ {
+ ds_list = (m->mss)[i].ms.discrete;
+ for( j = 0; j < ds_list->count; j++ )
+ {
+ repro = &(ds_list->list)[j].assured_reproduction_area;
+ page_size = (ds_list->list)[j].page_size;
+ XpGetMediumMillimeters( page_size, &width, &height );
+
+ if( repro->minimum_x < 6.35 )
+ repro->minimum_x = 6.35;
+ if( width - repro->maximum_x < 6.35 )
+ repro->maximum_x = width - 6.35;
+ }
+ }
+ }
+ XpPutMediumSSAttr( pCon, XPPrinterAttr,
+ xpoid_att_medium_source_sizes_supported, m );
+ XpOidMediumSSDelete( m );
+
+ /*
+ * Finish validating the attribute pools
+ */
+
+ XpValidateAttributePool( pCon, XPDocAttr, &PclValidatePoolsRec );
+ XpValidateAttributePool( pCon, XPJobAttr, &PclValidatePoolsRec );
+ XpValidateAttributePool( pCon, XPPageAttr, &PclValidatePoolsRec );
+
+ /*
+ * Clear out the colormap storage
+ */
+ pConPriv->palettes = NULL;
+
+ return Success;
+}
+
+static Bool
+PclDestroyContext(XpContextPtr pCon)
+{
+ PclContextPrivPtr pConPriv = (PclContextPrivPtr)
+ dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey);
+ PclPaletteMapPtr p, t;
+ PclCmapToContexts *pCmap;
+ ScreenPtr screen;
+ PclScreenPrivPtr sPriv;
+ PclContextListPtr con, prevCon, temp;
+
+
+ /*
+ * Clean up the temporary files
+ */
+ if( pConPriv->pPageFile != (FILE *)NULL )
+ {
+ fclose( pConPriv->pPageFile );
+ pConPriv->pPageFile = (FILE *)NULL;
+ }
+ if( pConPriv->pageFileName != (char *)NULL )
+ {
+ unlink( pConPriv->pageFileName );
+ xfree( pConPriv->pageFileName );
+ pConPriv->pageFileName = (char *)NULL;
+ }
+
+ if( pConPriv->pJobFile != (FILE *)NULL )
+ {
+ fclose( pConPriv->pJobFile );
+ pConPriv->pJobFile = NULL;
+ }
+ if( pConPriv->jobFileName != (char *)NULL )
+ {
+ unlink( pConPriv->jobFileName );
+ xfree( pConPriv->jobFileName );
+ pConPriv->jobFileName = (char *)NULL;
+ }
+
+ xfree( pConPriv->dash );
+ xfree(pConPriv->ctbl);
+ pConPriv->ctbl = NULL;
+#ifdef XP_PCL_LJ3
+ xfree( pConPriv->figures );
+#endif /* XP_PCL_LJ3 */
+
+ /*
+ * Destroy the colormap<->palette mappings
+ */
+ p = pConPriv->palettes;
+ while( p )
+ {
+ t = p;
+ p = p->next;
+ xfree( t );
+ }
+ pConPriv->palettes = NULL;
+
+ /*
+ * Remove the context from the screen-level colormap<->contexts mappings
+ */
+ screen = screenInfo.screens[pCon->screenNum];
+ sPriv = (PclScreenPrivPtr)
+ dixLookupPrivate(&screen->devPrivates, PclScreenPrivateKey);
+ pCmap = sPriv->colormaps;
+ while( pCmap )
+ {
+ con = pCmap->contexts;
+ prevCon = NULL;
+
+ while( con )
+ {
+ if( con->context->contextID == pCon->contextID )
+ {
+ if( prevCon )
+ {
+ temp = con;
+ prevCon->next = con = con->next;
+ }
+ else
+ {
+ temp = pCmap->contexts;
+ pCmap->contexts = con = con->next;
+ }
+ xfree( temp );
+ }
+ else
+ con = con->next;
+ }
+
+ pCmap = pCmap->next;
+ }
+
+ XpDestroyAttributes(pCon);
+
+ return Success;
+}
+
+XpContextPtr
+PclGetContextFromWindow(WindowPtr win)
+{
+ PclWindowPrivPtr pPriv;
+
+ while( win )
+ {
+ pPriv = (PclWindowPrivPtr)
+ dixLookupPrivate(&win->devPrivates, PclWindowPrivateKey);
+ if( pPriv->validContext )
+ return pPriv->context;
+
+ win = win->parent;
+ }
+
+ return NULL;
+}
diff --git a/xorg-server/hw/xprint/pcl/PclLine.c b/xorg-server/hw/xprint/pcl/PclLine.c
new file mode 100644
index 000000000..68d55a525
--- /dev/null
+++ b/xorg-server/hw/xprint/pcl/PclLine.c
@@ -0,0 +1,314 @@
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: PclLine.c
+** *
+** * Contents:
+** * Line drawing routines for the PCL driver
+** *
+** * Created: 10/11/95
+** *
+** *********************************************************
+**
+********************************************************************/
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS 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 names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "Pcl.h"
+#include "gcstruct.h"
+#include "windowstr.h"
+
+/*
+ * PclPolyLine()
+ * PclPolySegment()
+ *
+ * Generates PCL code to draw a polyline, or a collection of distinct
+ * line segments, clipped by the current clip region. Since PCL
+ * supports clipping to a rectangle, and the clip region is
+ * represented as a collection of visible rectangles, we can draw and
+ * clip the line by repeatedly drawing the complete line, clipped to
+ * each rectangle in the clip region.
+ *
+ * Since each box in the clipping region generates approximately 30
+ * bytes of PCL code, we have to have a way to avoid having a large
+ * number of boxes. The worst problem the case where the clipping
+ * region is a collection of one-pixel-high boxes, perhaps arising
+ * from a bitmap clip mask, or a region defined by a non-rectangular
+ * polygon.
+ *
+ * To alleviate this problem, we create a second clipping region,
+ * which consists of the union of the bounding boxes of each line
+ * segment. (Each bounding box is also increased by some amount
+ * related to the current line width to allow for non-zero-width
+ * lines, and for the various end and join styles.) This region is
+ * intersected with the "real" clipping region to get the region used
+ * to actually clip the polyline. This should result in a significant
+ * reduction in the number of clip rectangles, as the region-handling
+ * code should consolidate many of the fragments of one-pixel-high
+ * rectangles into larger rectangles.
+ */
+
+void
+PclPolyLine(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int mode,
+ int nPoints,
+ xPoint *pPoints)
+{
+ char t[80];
+ FILE *outFile;
+ int xoffset = 0, yoffset = 0;
+ int nbox;
+ BoxPtr pbox;
+ xRectangle *drawRects, *r;
+ RegionPtr drawRegion, region;
+ short fudge;
+ int i;
+ XpContextPtr pCon;
+ PclContextPrivPtr pConPriv;
+
+ if( PclUpdateDrawableGC( pGC, pDrawable, &outFile ) == FALSE )
+ return;
+
+ pCon = PclGetContextFromWindow( (WindowPtr) pDrawable );
+ pConPriv = (PclContextPrivPtr)
+ dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey);
+
+ /*
+ * Allocate the storage required to deal with the clipping
+ * regions.
+ */
+ region = REGION_CREATE( pGC->pScreen, NULL, 0 );
+ drawRects = (xRectangle *)
+ xalloc( ( nPoints - 1 ) * sizeof( xRectangle ) );
+
+ /*
+ * Calculate the "fudge factor" based on the line width.
+ * Multiplying by three seems to be a good first guess.
+ * XXX I need to think of a way to test this.
+ */
+ fudge = 3 * pGC->lineWidth + 1;
+
+ /*
+ * Generate the PCL code to draw the polyline, by defining it as a
+ * macro which uses the HP-GL/2 line drawing function.
+ */
+
+ MACRO_START( outFile, pConPriv );
+ SAVE_PCL( outFile, pConPriv, "\033%0B" );
+
+ sprintf( t, "PU%d,%dPD\n", pPoints[0].x + pDrawable->x,
+ pPoints[0].y + pDrawable->y );
+ SAVE_PCL( outFile, pConPriv, t ); /* Move to the start of the polyline */
+
+ switch( mode )
+ {
+ case CoordModeOrigin:
+ xoffset = pDrawable->x;
+ yoffset = pDrawable->y;
+ SAVE_PCL( outFile, pConPriv, "PA" );
+ break;
+ case CoordModePrevious:
+ xoffset = yoffset = 0;
+ SAVE_PCL( outFile, pConPriv, "PR" );
+ break;
+ }
+
+ /*
+ * Build the "drawing region" as we build the PCL to draw the
+ * line.
+ */
+ for(i = 1, r = drawRects; i < nPoints; i++, r++ )
+ {
+ if( i != 1 )
+ SAVE_PCL( outFile, pConPriv, "," );
+
+ sprintf( t, "%d,%d", pPoints[i].x + xoffset,
+ pPoints[i].y + yoffset );
+ SAVE_PCL( outFile, pConPriv, t );
+
+ r->x = MIN( pPoints[i-1].x, pPoints[i].x ) + xoffset - fudge;
+ r->y = MIN( pPoints[i-1].y, pPoints[i].y ) + yoffset - fudge;
+ r->width = abs( pPoints[i-1].x - pPoints[i].x ) + 2 * fudge;
+ r->height = abs( pPoints[i-1].y - pPoints[i].y ) + 2 * fudge;
+ }
+ SAVE_PCL( outFile, pConPriv, ";\033%0A" ); /* End the macro */
+ MACRO_END( outFile );
+
+ /*
+ * Convert the collection of rectangles into a proper region, then
+ * intersect it with the clip region.
+ */
+ drawRegion = RECTS_TO_REGION( pGC->pScreen, nPoints - 1,
+ drawRects, CT_UNSORTED );
+ if( mode == CoordModePrevious )
+ REGION_TRANSLATE( pGC->pScreen, drawRegion, pPoints[0].x, pPoints[0].y );
+ REGION_INTERSECT( pGC->pScreen, region, drawRegion, pGC->pCompositeClip );
+
+ /*
+ * For each rectangle in the clip region, set the HP-GL/2 "input
+ * window" and render the entire polyline to it.
+ */
+ pbox = REGION_RECTS( region );
+ nbox = REGION_NUM_RECTS( region );
+
+ PclSendData(outFile, pConPriv, pbox, nbox, 1.0);
+
+ /*
+ * Clean up the temporary regions
+ */
+ REGION_DESTROY( pGC->pScreen, drawRegion );
+ REGION_DESTROY( pGC->pScreen, region );
+ xfree( drawRects );
+}
+
+void
+PclPolySegment(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int nSegments,
+ xSegment *pSegments)
+{
+ FILE *outFile, *dummy;
+ char t[80];
+ int xoffset, yoffset;
+ int nbox, i;
+ unsigned long valid;
+ BoxPtr pbox;
+ xRectangle *drawRects, *r;
+ RegionPtr drawRegion, region;
+ short fudge;
+ XpContextPtr pCon;
+ PclContextPrivPtr pConPriv;
+ GC cacheGC;
+
+
+ if( PclUpdateDrawableGC( pGC, pDrawable, &outFile ) == FALSE )
+ return;
+
+ pCon = PclGetContextFromWindow( (WindowPtr) pDrawable );
+ pConPriv = (PclContextPrivPtr)
+ dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey);
+
+ /*
+ * Allocate the storage for the temporary regions.
+ */
+ region = REGION_CREATE( pGC->pScreen, NULL, 0 );
+ drawRects = (xRectangle *)
+ xalloc( nSegments * sizeof( xRectangle ) );
+
+ /*
+ * Calculate the fudge factor, based on the line width
+ */
+ fudge = pGC->lineWidth * 3 + 1;
+
+ /*
+ * Turn off line joining.
+ */
+ SEND_PCL( outFile, "\033%0BLA2,6;\033%0A" );
+
+ /*
+ * Generate the PCL code to draw the segments, by defining them as
+ * a macro which uses the HP-GL/2 line drawing function.
+ *
+ * XXX I wonder if this should be implemented using the Encoded
+ * XXX Polyline function. Since I'm only sending it once, it's not
+ * XXX necessarily too important.
+ */
+
+ MACRO_START( outFile, pConPriv );
+ SAVE_PCL( outFile, pConPriv, "\033%0B" );
+
+ xoffset = pDrawable->x;
+ yoffset = pDrawable->y;
+
+ for( i = 0, r = drawRects; i < nSegments; i++, r++ )
+ {
+ r->x = MIN( pSegments[i].x1, pSegments[i].x2 ) + xoffset;
+ r->y = MIN( pSegments[i].y1, pSegments[i].y2 ) + yoffset;
+ r->width = abs( pSegments[i].x1 - pSegments[i].x2 );
+ r->height = abs( pSegments[i].y1 - pSegments[i].y2 );
+
+ sprintf( t, "PU%d,%d;PD%d,%d;", pSegments[i].x1 + xoffset,
+ pSegments[i].y1 + yoffset, pSegments[i].x2 +
+ xoffset, pSegments[i].y2 + yoffset );
+ SAVE_PCL( outFile, pConPriv, t );
+
+ r->x -= fudge;
+ r->y -= fudge;
+ r->width += 2 * fudge;
+ r->height += 2 * fudge;
+ }
+ SAVE_PCL( outFile, pConPriv, "\033%0A" );
+ MACRO_END ( outFile );
+
+ /*
+ * Convert the collection of rectangles into a proper region, then
+ * intersect it with the clip region.
+ */
+ drawRegion = RECTS_TO_REGION( pGC->pScreen, nSegments,
+ drawRects, CT_UNSORTED );
+ REGION_INTERSECT( pGC->pScreen, region, drawRegion, pGC->pCompositeClip );
+
+ /*
+ * For each rectangle in the clip region, set the HP-GL/2 "input
+ * window" and render the entire set of segments to it.
+ */
+ pbox = REGION_RECTS( region );
+ nbox = REGION_NUM_RECTS( region );
+
+ PclSendData(outFile, pConPriv, pbox, nbox, 1.0);
+
+ /*
+ * Now we need to reset the line join mode to whatever it was at before.
+ * The easiest way is to force the cached GC's joinstyle to be different
+ * from the current GC's joinstyle, then re-update the GC. This way, we
+ * don't have to duplicate code unnecessarily.
+ */
+ PclGetDrawablePrivateStuff( pDrawable, &cacheGC, &valid, &dummy );
+ cacheGC.joinStyle = !cacheGC.joinStyle;
+ PclSetDrawablePrivateGC( pDrawable, cacheGC );
+ PclUpdateDrawableGC( pGC, pDrawable, &outFile );
+
+ /*
+ * Clean up
+ */
+ REGION_DESTROY( pGC->pScreen, drawRegion );
+ REGION_DESTROY( pGC->pScreen, region );
+ xfree( drawRects );
+}
diff --git a/xorg-server/hw/xprint/pcl/PclMisc.c b/xorg-server/hw/xprint/pcl/PclMisc.c
new file mode 100644
index 000000000..0b37836e9
--- /dev/null
+++ b/xorg-server/hw/xprint/pcl/PclMisc.c
@@ -0,0 +1,301 @@
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: PclMisc.c
+** *
+** * Contents:
+** * Miscellaneous code for Pcl driver.
+** *
+** * Created: 2/01/95
+** *
+** *********************************************************
+**
+********************************************************************/
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS 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 names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <stdlib.h>
+#include <signal.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <X11/Xos.h> /* for SIGCLD on pre-POSIX systems */
+#include "Pcl.h"
+
+#include "cursor.h"
+#include "resource.h"
+
+#include "windowstr.h"
+#include "propertyst.h"
+#include "attributes.h"
+
+
+/*ARGSUSED*/
+void
+PclQueryBestSize(
+ int type,
+ short *pwidth,
+ short *pheight,
+ ScreenPtr pScreen)
+{
+ unsigned width, highBit;
+
+ switch(type)
+ {
+ case CursorShape:
+ *pwidth = 0;
+ *pheight = 0;
+ break;
+ case TileShape:
+ case StippleShape:
+ width = *pwidth;
+ if (!width) break;
+ /* Return the nearest power of two >= what they gave us */
+ highBit = 0x80000000;
+ /* Find the highest 1 bit in the given width */
+ while(!(highBit & width))
+ highBit >>= 1;
+ /* If greater than that then return the next power of two */
+ if((highBit - 1) & width)
+ highBit <<= 1;
+ *pwidth = highBit;
+ /* height is a don't-care */
+ break;
+ }
+}
+
+/*
+ * GetPropString searches the window heirarchy from pWin up looking for
+ * a property by the name of propName. If found, returns the property's
+ * value. If not, it returns NULL.
+ */
+char *
+GetPropString(
+ WindowPtr pWin,
+ char *propName)
+{
+ Atom atom;
+ PropertyPtr pProp = (PropertyPtr)NULL;
+ char *retVal;
+
+ atom = MakeAtom(propName, strlen(propName), FALSE);
+ if(atom != BAD_RESOURCE)
+ {
+ WindowPtr pPropWin;
+ int rc, n;
+
+ /*
+ * The atom has been defined, but it might only exist as a
+ * property on an unrelated window.
+ */
+ for(pPropWin = pWin; pPropWin != (WindowPtr)NULL;
+ pPropWin = pPropWin->parent)
+ {
+ rc = dixLookupProperty(&pProp, pPropWin, atom,
+ serverClient, DixReadAccess);
+ if (rc == Success)
+ break;
+ else
+ pProp = NULL;
+ }
+ if(pProp == (PropertyPtr)NULL)
+ return (char *)NULL;
+
+ n = (pProp->format/8) * pProp->size; /* size (bytes) of prop */
+ retVal = (char *)xalloc(n + 1);
+ (void)memcpy((void *)retVal, (void *)pProp->data, n);
+ retVal[n] = '\0';
+
+ return retVal;
+ }
+
+ return (char *)NULL;
+}
+
+#include <signal.h>
+#include <errno.h>
+
+/* ARGSUSED */
+static void SigchldHndlr (
+ int dummy)
+{
+ int status;
+ int olderrno = errno;
+ struct sigaction act;
+ sigfillset(&act.sa_mask);
+ act.sa_flags = 0;
+ act.sa_handler = SigchldHndlr;
+
+ (void) wait (&status);
+
+ /*
+ * Is this really necessary?
+ */
+ sigaction(SIGCHLD, &act, (struct sigaction *)NULL);
+ errno = olderrno;
+}
+
+/*
+ * SystemCmd provides a wrapper for the 'system' library call. The call
+ * appears to be sensitive to the handling of SIGCHLD, so this wrapper
+ * sets the status to SIG_DFL, and then resets the established handler
+ * after system returns.
+ */
+int
+SystemCmd(char *cmdStr)
+{
+ int status;
+ struct sigaction newAct, oldAct;
+ sigfillset(&newAct.sa_mask);
+ newAct.sa_flags = 0;
+ newAct.sa_handler = SIG_DFL;
+ sigfillset(&oldAct.sa_mask);
+ oldAct.sa_flags = 0;
+ oldAct.sa_handler = SigchldHndlr;
+
+ /*
+ * get the old handler, and set the action to IGN
+ */
+ sigaction(SIGCHLD, &newAct, &oldAct);
+
+ status = system (cmdStr);
+
+ sigaction(SIGCHLD, &oldAct, (struct sigaction *)NULL);
+ return status;
+}
+
+
+/*
+ * PclGetMediumDimensions is installed in the GetMediumDimensions field
+ * of each Pcl-initialized context.
+ */
+int
+PclGetMediumDimensions(XpContextPtr pCon,
+ CARD16 *width,
+ CARD16 *height)
+{
+ XpGetMediumDimensions(pCon, width, height);
+ return Success;
+}
+
+/*
+ * PclGetReproducibleArea is installed in the GetReproducibleArea field
+ * of each Pcl-initialized context.
+ */
+int
+PclGetReproducibleArea(XpContextPtr pCon,
+ xRectangle *pRect)
+{
+ XpGetReproductionArea(pCon, pRect);
+ return Success;
+}
+
+#ifdef XP_PCL_LJ3
+/*
+ * PclSpoolFigs spooled the rendering PCL/HP-GL2 commands into the
+ * temporary buffer pointed by figures pointer in pcl private context.
+ * LaserJet IIIs printers don't support the macro function which
+ * includes some HP-GL/2 commands.
+ */
+void
+PclSpoolFigs(PclContextPrivPtr pConPriv, char *t, int n)
+{
+char *ptr;
+
+ ptr = pConPriv->figures;
+ while ( ( pConPriv->fcount + n) > pConPriv->fcount_max ) {
+ ptr = (char *)xrealloc(ptr, 1024 + pConPriv->fcount_max);
+ if ( !ptr )
+ return;
+ pConPriv->figures = ptr;
+ pConPriv->fcount_max += 1024;
+ }
+ ptr += pConPriv->fcount;
+ pConPriv->fcount += n;
+ memcpy(ptr, t, n);
+}
+#endif /* XP_PCL_LJ3 */
+
+/*
+ * PclSendData:
+ * For XP-PCL-COLOR/XP-PCL-MONO, it executes the macro stored before
+ * in the clipped area.
+ * For XP-PCL-LJ3, it draws the spooled figures in the clipped area.
+ */
+void
+PclSendData(
+ FILE *outFile,
+ PclContextPrivPtr pConPriv,
+ BoxPtr pbox,
+ int nbox,
+ double ratio
+)
+{
+char *ptr;
+int n;
+char t[80];
+
+#ifdef XP_PCL_LJ3
+ ptr = pConPriv->figures;
+ n = pConPriv->fcount;
+#else
+ ptr = "\033&f3X";
+ n = 5;
+#endif /* XP_PCL_LJ3 */
+
+ while( nbox )
+ {
+ /*
+ * Set the HP-GL/2 input window to the current
+ * rectangle in the clip region, then send the code to
+ * execute the macro defined above.
+ */
+ if (ratio == 1.0)
+ sprintf( t, "\033%%0BIW%d,%d,%d,%d;\033%%0A",
+ pbox->x1, pbox->y1,
+ pbox->x2, pbox->y2 );
+ else
+ sprintf( t, "\033%%0BIW%g,%d,%g,%d;\033%%0A",
+ ratio * pbox->x1, pbox->y1,
+ ratio * pbox->x2, pbox->y2 );
+
+ SEND_PCL( outFile, t );
+ SEND_PCL_COUNT( outFile, ptr, n);
+
+ nbox--;
+ pbox++;
+ }
+}
diff --git a/xorg-server/hw/xprint/pcl/PclPixel.c b/xorg-server/hw/xprint/pcl/PclPixel.c
new file mode 100644
index 000000000..d219838f0
--- /dev/null
+++ b/xorg-server/hw/xprint/pcl/PclPixel.c
@@ -0,0 +1,159 @@
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: PclPixel.c
+** *
+** * Contents:
+** * Pixel-drawing code for the PCL DDX driver
+** *
+** * Created: 10/23/95
+** *
+** *********************************************************
+**
+********************************************************************/
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS 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 names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <stdio.h>
+
+#include "windowstr.h"
+#include "gcstruct.h"
+
+#include "Pcl.h"
+
+void
+PclPolyPoint( pDrawable, pGC, mode, nPoints, pPoints )
+ DrawablePtr pDrawable;
+ GCPtr pGC;
+ int mode;
+ int nPoints;
+ xPoint *pPoints;
+{
+ char t[80];
+ FILE *outFile;
+ int xoffset, yoffset;
+ BoxRec box;
+ int xloc, yloc, i;
+#if 0
+ XpContextPtr pCon;
+ PclContextPrivPtr cPriv;
+ PclPixmapPrivPtr pPriv;
+#endif
+
+ if( PclUpdateDrawableGC( pGC, pDrawable, &outFile ) == FALSE )
+ return;
+
+ xoffset = pDrawable->x;
+ yoffset = pDrawable->y;
+
+ /*
+ * Enter HP-GL/2 and change the line style to one in which only
+ * the vertices of the specified polyline are drawn. We must also
+ * temporarily change the line width so that only a single pixel
+ * is drawn. Then move to the first possible location.
+ */
+ xloc = pPoints[0].x + pDrawable->x;
+ yloc = pPoints[0].y + pDrawable->y;
+
+ sprintf( t, "\27%%0BPW0,0;LT0;PU;PA%d,%d", xloc, yloc );
+ SEND_PCL( outFile, t );
+
+ /*
+ * Check each point against the clip region. If it is outside the
+ * region, don't send the PCL to the printer.
+ */
+
+ for( i = 0; i < nPoints; i++ )
+ {
+ if( POINT_IN_REGION( pGC->pScreen, pGC->clientClip, xloc, yloc, &box ) )
+ {
+ sprintf( t, ",%d,%d", xloc, yloc );
+ SEND_PCL( outFile, t );
+ }
+
+ if( mode == CoordModeOrigin )
+ {
+ xloc = pPoints[i+1].x + xoffset;
+ yloc = pPoints[i+1].y + yoffset;
+ }
+ else
+ {
+ xloc += pPoints[i+1].x;
+ yloc += pPoints[i+1].y;
+ }
+ }
+
+#if 0
+ /*
+ * Change the line style and width back to what they were before
+ * this routine was called. No, this isn't pretty...
+ */
+ if( pDrawable->type == DRAWABLE_WINDOW )
+ {
+ pCon = PclGetContextFromWindow( (WindowPtr)pDrawable );
+ cPriv = (PclContextPrivPtr)
+ dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey);
+ cPriv->changeMask = GCLineWidth | GCLineStyle;
+ }
+ else
+ {
+ pPriv = (PclPixmapPrivPtr)
+ dixLookupPrivate(&((PixmapPtr)pDrawable)->devPrivates,
+ PclPixmapPrivateKey);
+ pPriv->changeMask = GCLineWidth | GCLineStyle;
+ }
+#endif
+
+ PclUpdateDrawableGC( pGC, pDrawable, &outFile );
+
+ /*
+ * Go back to PCL
+ */
+ SEND_PCL( outFile, "\27%0A" );
+}
+
+void
+PclPushPixels( pGC, pBitmap, pDrawable, width, height, x, y )
+ GCPtr pGC;
+ PixmapPtr pBitmap;
+ DrawablePtr pDrawable;
+ int width;
+ int height;
+ int x;
+ int y;
+{
+}
diff --git a/xorg-server/hw/xprint/pcl/PclPolygon.c b/xorg-server/hw/xprint/pcl/PclPolygon.c
new file mode 100644
index 000000000..7d95d6484
--- /dev/null
+++ b/xorg-server/hw/xprint/pcl/PclPolygon.c
@@ -0,0 +1,351 @@
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: PclPolygon.c
+** *
+** * Contents:
+** * Draws Polygons and Rectangles for the PCL DDX
+** *
+** * Created: 10/23/95
+** *
+** *********************************************************
+**
+********************************************************************/
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS 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 names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "Pcl.h"
+#include "gcstruct.h"
+#include "windowstr.h"
+
+void
+PclPolyRectangle(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int nRects,
+ xRectangle *pRects)
+{
+ char t[80];
+ FILE *outFile;
+ int nbox, i;
+ BoxPtr pbox;
+ xRectangle *drawRects, *r;
+ RegionPtr drawRegion, region;
+ short fudge;
+ int xoffset, yoffset;
+ XpContextPtr pCon;
+ PclContextPrivPtr pConPriv;
+
+ if( PclUpdateDrawableGC( pGC, pDrawable, &outFile ) == FALSE )
+ return;
+
+ pCon = PclGetContextFromWindow( (WindowPtr) pDrawable );
+ pConPriv = (PclContextPrivPtr)
+ dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey);
+
+ /*
+ * Allocate the storage required to deal with the clipping
+ * regions.
+ */
+ region = REGION_CREATE( pGC->pScreen, NULL, 0 );
+ drawRects = (xRectangle *)xalloc( nRects * sizeof( xRectangle ) );
+
+ fudge = 3 * pGC->lineWidth + 1;
+
+ /*
+ * Generate the PCL code to draw the rectangles, by defining them
+ * as a macro which uses the HP-GL/2 rectangle drawing function.
+ */
+ MACRO_START( outFile, pConPriv );
+ SAVE_PCL( outFile, pConPriv, "\033%0B" );
+
+ xoffset = pDrawable->x;
+ yoffset = pDrawable->y;
+
+ for( i = 0, r = drawRects; i < nRects; i++, r++ )
+ {
+ xRectangle rect = pRects[i];
+
+ /* Draw the rectangle */
+ sprintf( t, "PU%d,%d;ER%d,%d;", rect.x + xoffset,
+ rect.y + yoffset, rect.width, rect.height );
+ SAVE_PCL( outFile, pConPriv, t );
+
+ /* Build the bounding box */
+ r->x = MIN( rect.x, rect.x + rect.width ) + xoffset -
+ fudge;
+ r->y = MIN( rect.y, rect.y + rect.height ) + yoffset -
+ fudge;
+ r->width = rect.width + 2 * fudge;
+ r->height = rect.height + 2 * fudge;
+ }
+ SAVE_PCL( outFile, pConPriv, ";\033%0A" ); /* End the macro */
+ MACRO_END( outFile );
+
+ /*
+ * Convert the collection of rectangles to a proper region, then
+ * intersect it with the clip region.
+ */
+ drawRegion = RECTS_TO_REGION( pGC->pScreen, nRects,
+ drawRects, CT_UNSORTED );
+
+ REGION_INTERSECT( pGC->pScreen, region, drawRegion, pGC->pCompositeClip );
+
+ /*
+ * For each rectangle in the clip region, set the HP-GL/2 "input
+ * window" and render the set of rectangles to it.
+ */
+ pbox = REGION_RECTS( region );
+ nbox = REGION_NUM_RECTS( region );
+
+ PclSendData(outFile, pConPriv, pbox, nbox, 1.0);
+
+ /*
+ * Clean up the temporary regions
+ */
+ REGION_DESTROY( pGC->pScreen, drawRegion );
+ REGION_DESTROY( pGC->pScreen, region );
+ xfree( drawRects );
+}
+
+void
+PclFillPolygon(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int shape,
+ int mode,
+ int nPoints,
+ DDXPointPtr pPoints)
+{
+ char t[80];
+ FILE *outFile;
+ int nbox, i;
+ BoxPtr pbox;
+ BoxRec box;
+ RegionPtr drawRegion, region;
+ int xoffset, yoffset;
+ int xtop, xbottom, yleft, yright;
+ int fillRule;
+ XpContextPtr pCon;
+ PclContextPrivPtr pConPriv;
+ char *command;
+
+ if( PclUpdateDrawableGC( pGC, pDrawable, &outFile ) == FALSE )
+ return;
+
+ pCon = PclGetContextFromWindow( (WindowPtr) pDrawable );
+ pConPriv = (PclContextPrivPtr)
+ dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey);
+
+ /*
+ * Generate the PCL code to draw the filled polygon, by defining
+ * it as a macro which uses the HP-GL/2 polygon drawing function.
+ */
+ MACRO_START( outFile, pConPriv );
+ SAVE_PCL( outFile, pConPriv, "\033%0B" );
+
+ if( mode == CoordModeOrigin )
+ {
+ xoffset = pDrawable->x;
+ yoffset = pDrawable->y;
+ command = "PA";
+ }
+ else
+ {
+ xoffset = yoffset = 0;
+ command = "PR";
+ }
+
+ /* Begin the polygon */
+ sprintf( t, "PU%d,%d;PM0;%s", pPoints[0].x + xoffset, pPoints[0].y
+ + yoffset, command );
+ SAVE_PCL( outFile, pConPriv, t );
+
+ /* Seed the bounding box */
+ xtop = xbottom = pPoints[0].x + xoffset;
+ yleft = yright = pPoints[0].y + yoffset;
+
+ /* Add the rest of the points to the polygon */
+ for( i = 1; i < nPoints; i++ )
+ {
+ if( i != 1 )
+ SAVE_PCL( outFile, pConPriv, "," );
+
+ sprintf( t, "%d,%d", pPoints[i].x + xoffset, pPoints[i].y +
+ yoffset );
+ SAVE_PCL( outFile, pConPriv, t );
+
+ /* Update the bounding box */
+ xtop = MIN( xtop, pPoints[i].x + xoffset );
+ xbottom = MAX( xbottom, pPoints[i].x + xoffset );
+ yleft = MIN( yleft, pPoints[i].y + yoffset );
+ yright = MAX( yright, pPoints[i].y + yoffset );
+ }
+
+ /* Close the polygon and the macro */
+
+ if( pGC->fillRule == EvenOddRule )
+ fillRule = 0;
+ else
+ fillRule = 1;
+
+ sprintf( t, ";PM2;FP%d;\033%%0A", fillRule );
+ SAVE_PCL( outFile, pConPriv, t );
+ MACRO_END ( outFile );
+
+ /*
+ * Build the bounding region from the bounding box of the polygon
+ */
+ box.x1 = xtop;
+ box.y1 = yleft;
+ box.x2 = xbottom;
+ box.y2 = yright;
+ drawRegion = REGION_CREATE( pGC->pScreen, &box, 0 );
+
+ if( mode == CoordModePrevious )
+ REGION_TRANSLATE( pGC->pScreen, drawRegion, pPoints[0].x, pPoints[0].y );
+
+ region = REGION_CREATE( pGC->pScreen, NULL, 0 );
+
+ REGION_INTERSECT( pGC->pScreen, region, drawRegion, pGC->pCompositeClip );
+
+ /*
+ * For each rectangle in the clip region, set the HP-GL/2 "input
+ * window" and render the polygon to it.
+ */
+ pbox = REGION_RECTS( region );
+ nbox = REGION_NUM_RECTS( region );
+
+ PclSendData(outFile, pConPriv, pbox, nbox, 1.0);
+
+ /*
+ * Clean up the temporary regions
+ */
+ REGION_DESTROY( pGC->pScreen, drawRegion );
+ REGION_DESTROY( pGC->pScreen, region );
+}
+
+void
+PclPolyFillRect(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int nRects,
+ xRectangle *pRects)
+{
+ char t[80];
+ FILE *outFile;
+ int nbox, i;
+ BoxPtr pbox;
+ xRectangle *drawRects, *r;
+ RegionPtr drawRegion, region;
+ int xoffset, yoffset;
+ short fudge;
+ XpContextPtr pCon;
+ PclContextPrivPtr pConPriv;
+
+ if( PclUpdateDrawableGC( pGC, pDrawable, &outFile ) == FALSE )
+ return;
+
+ pCon = PclGetContextFromWindow( (WindowPtr) pDrawable );
+ pConPriv = (PclContextPrivPtr)
+ dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey);
+
+ /*
+ * Allocate the storage required to deal with the clipping
+ * regions.
+ */
+ region = REGION_CREATE( pGC->pScreen, NULL, 0 );
+ drawRects = (xRectangle *)xalloc( nRects * sizeof( xRectangle ) );
+
+
+ fudge = 3 * pGC->lineWidth + 1;
+
+ /*
+ * Generate the PCL code to draw the filled rectangles, by
+ * defining them as a macro which uses the HP-GL/2 rectangle
+ * drawing function.
+ */
+ MACRO_START( outFile, pConPriv );
+ SAVE_PCL( outFile, pConPriv, "\033%0B" );
+
+ xoffset = pDrawable->x;
+ yoffset = pDrawable->y;
+
+ for( i = 0, r = drawRects; i < nRects; i++, r++ )
+ {
+ xRectangle rect = pRects[i];
+
+ /* Draw the rectangle */
+ sprintf( t, "PU%d,%d;RR%d,%d;", rect.x + xoffset, rect.y +
+ yoffset, rect.width, rect.height );
+ SAVE_PCL( outFile, pConPriv, t );
+
+ /* Build the bounding box */
+ r->x = MIN( rect.x, rect.x + rect.width ) + xoffset - fudge;
+ r->y = MIN( rect.y, rect.y + rect.height ) + yoffset -
+ fudge;
+ r->width = rect.width + 2 * fudge;
+ r->height = rect.height + 2 * fudge;
+ }
+ SAVE_PCL( outFile, pConPriv, ";\033%0A" ); /* End the macro */
+ MACRO_END( outFile );
+
+ /*
+ * Convert the collection of rectangles to a proper region, then
+ * intersect it with the clip region.
+ */
+ drawRegion = RECTS_TO_REGION( pGC->pScreen, nRects,
+ drawRects, CT_UNSORTED );
+ REGION_INTERSECT( pGC->pScreen, region, drawRegion, pGC->pCompositeClip );
+
+ /*
+ * For each rectangle in the clip region, set the HP-GL/2 "input
+ * window" and render the set of rectangles to it.
+ */
+ pbox = REGION_RECTS( region );
+ nbox = REGION_NUM_RECTS( region );
+
+ PclSendData(outFile, pConPriv, pbox, nbox, 1.0);
+
+ /*
+ * Clean up the temporary regions
+ */
+ REGION_DESTROY( pGC->pScreen, drawRegion );
+ REGION_DESTROY( pGC->pScreen, region );
+ xfree( drawRects );
+}
diff --git a/xorg-server/hw/xprint/pcl/PclPrint.c b/xorg-server/hw/xprint/pcl/PclPrint.c
new file mode 100644
index 000000000..ac8ea1537
--- /dev/null
+++ b/xorg-server/hw/xprint/pcl/PclPrint.c
@@ -0,0 +1,709 @@
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: PclPrint.c
+** *
+** * Contents: Print extension code of Pcl driver
+** *
+** * Created: 2/03/95
+** *
+** *********************************************************
+**
+********************************************************************/
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS 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 names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <stdio.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/wait.h>
+#include <unistd.h>
+#include <X11/Xprotostr.h>
+
+#define NEED_EVENTS
+#include <X11/Xproto.h>
+#undef NEED_EVENTS
+
+#include "Pcl.h"
+
+#include "windowstr.h"
+#include "attributes.h"
+#include "AttrValid.h"
+#include "Oid.h"
+
+int
+PclStartJob(
+ XpContextPtr pCon,
+ Bool sendClientData,
+ ClientPtr client)
+{
+ PclContextPrivPtr pConPriv = (PclContextPrivPtr)
+ dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey);
+ PclPaletteMap *pal;
+
+ /*
+ * Check for existing page file, and delete it if it exists.
+ */
+ if(pConPriv->pageFileName != (char *)NULL)
+ {
+ if(pConPriv->pPageFile != (FILE *)NULL)
+ {
+ fclose(pConPriv->pPageFile);
+ pConPriv->pPageFile = (FILE *)NULL;
+ }
+ unlink(pConPriv->pageFileName);
+ xfree(pConPriv->pageFileName);
+ pConPriv->pageFileName = (char *)NULL;
+ }
+
+ /*
+ * Create a temporary file to store the printer output.
+ */
+ if (!XpOpenTmpFile("w+", &pConPriv->jobFileName, &pConPriv->pJobFile))
+ return BadAlloc;
+
+ /*
+ * Create/Initialize the SoftFontInfo structure
+ */
+ pConPriv->pSoftFontInfo = PclCreateSoftFontInfo();
+
+ /*
+ * Set up the colormap handling
+ */
+ pConPriv->palettes = NULL;
+ pConPriv->nextPaletteId = 4;
+ pConPriv->currentPalette = 0;
+
+ pal = &( pConPriv->staticGrayPalette );
+ pal->paletteId = 1;
+ pal->downloaded = 0;
+
+ pal = &( pConPriv->trueColorPalette );
+ pal->paletteId = 2;
+ pal->downloaded = 0;
+
+ pal = &( pConPriv->specialTrueColorPalette );
+ pal->paletteId = 3;
+ pal->downloaded = 0;
+
+ return Success;
+}
+
+int
+PclEndJob(
+ XpContextPtr pCon,
+ Bool cancel)
+{
+ PclContextPrivPtr priv = (PclContextPrivPtr)
+ dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey);
+
+#ifdef CCP_DEBUG
+ FILE *xpoutput;
+#endif
+ FILE *fp;
+ int retVal;
+ char *fileName, *trailer;
+ struct stat statBuf;
+ PclPaletteMapPtr p;
+
+ trailer = "\033%-12345X@PJL RESET\n";
+
+ if( cancel == True )
+ {
+ if( priv->getDocClient != (ClientPtr)NULL ) {
+ XpFinishDocData( priv->getDocClient );
+
+ priv->getDocClient = NULL;
+ priv->getDocBufSize = 0;
+ }
+
+ return Success;
+ }
+
+ if( priv->getDocClient != (ClientPtr)NULL && priv->getDocBufSize > 0 )
+ {
+ /*
+ * We need to stash the trailer information somewhere...
+ */
+ if (!XpOpenTmpFile("w+", &fileName, &fp))
+ return BadAlloc;
+
+#ifndef XP_PCL_LJ3
+ SEND_PCL( fp, trailer );
+ rewind( fp );
+
+ retVal = XpSendDocumentData( priv->getDocClient, fp,
+ strlen( trailer ),
+ priv->getDocBufSize );
+#endif /* XP_PCL_LJ3 */
+
+ fclose( fp );
+ unlink( fileName );
+ xfree( fileName );
+
+ if( priv->getDocClient != (ClientPtr)NULL ) {
+ XpFinishDocData( priv->getDocClient );
+
+ priv->getDocClient = NULL;
+ priv->getDocBufSize = 0;
+ }
+
+ return retVal;
+ }
+
+#ifndef XP_PCL_LJ3
+ SEND_PCL( priv->pJobFile, trailer );
+#endif /* XP_PCL_LJ3 */
+
+ /*
+ * Submit the job to the spooler
+ */
+ fflush( priv->pJobFile );
+
+ /*
+ * Dump the job file to another output file, for testing
+ * purposes.
+ */
+ rewind( priv->pJobFile );
+ stat( priv->jobFileName, &statBuf );
+
+#ifdef CCP_DEBUG
+ unlink( "/users/prince/XpOutput" );
+ xpoutput = fopen( "/users/prince/XpOutput", "w" );
+
+ rewind( priv->pJobFile );
+ TransferBytes( priv->pJobFile, xpoutput,
+ (int)statBuf.st_size );
+ fclose( xpoutput );
+#endif
+
+ XpSubmitJob( priv->jobFileName, pCon );
+ fclose( priv->pJobFile );
+ unlink( priv->jobFileName );
+ xfree( priv->jobFileName );
+ priv->jobFileName = NULL;
+
+ PclDestroySoftFontInfo(priv->pSoftFontInfo);
+ priv->pSoftFontInfo = (PclSoftFontInfoPtr) NULL;
+
+ /*
+ * Clear out the colormap cache
+ */
+ p = priv->palettes;
+ while( p )
+ {
+ p->downloaded = 0;
+ p = p->next;
+ }
+
+ return Success;
+}
+
+/* StartPage
+ *
+ * If page file exists
+ * close page file
+ * set page file pointer = NULL
+ * unlink page file
+ * Create a new page file
+ * Send the page header information to the page file
+ * ClearArea the window and all descendant windows
+ */
+int
+PclStartPage(
+ XpContextPtr pCon,
+ WindowPtr pWin)
+{
+ PclContextPrivPtr pConPriv = (PclContextPrivPtr)
+ dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey);
+ PclWindowPrivPtr pWinPriv = (PclWindowPrivPtr)
+ dixLookupPrivate(&pWin->devPrivates, PclWindowPrivateKey);
+ xRectangle repro;
+ char t[80];
+ XpOid orient, plex, tray, medium;
+ int dir, plexNum, num;
+
+ /*
+ * Put a pointer to the context in the window private structure
+ */
+ pWinPriv->validContext = 1;
+ pWinPriv->context = pCon;
+
+ /*
+ * Clear out the old page file, if necessary
+ */
+ if(pConPriv->pPageFile != (FILE *)NULL)
+ {
+ fclose(pConPriv->pPageFile);
+ pConPriv->pPageFile = (FILE *)NULL;
+ }
+ if(pConPriv->pageFileName != (char *)NULL)
+ {
+ unlink(pConPriv->pageFileName);
+ pConPriv->pageFileName = (char *)NULL;
+ }
+
+ /*
+ * Make up a new page file.
+ */
+ if (!XpOpenTmpFile("w+", &pConPriv->pageFileName, &pConPriv->pPageFile))
+ return BadAlloc;
+
+ /*
+ * Reset the GC cached in the context private struct.
+ */
+ pConPriv->validGC = 0;
+
+ /*
+ * Set the page orientation
+ */
+ orient = XpGetContentOrientation( pCon );
+ switch( orient )
+ {
+ case xpoid_val_content_orientation_landscape:
+ dir = 1;
+ break;
+ case xpoid_val_content_orientation_reverse_portrait:
+ dir = 2;
+ break;
+ case xpoid_val_content_orientation_reverse_landscape:
+ dir = 3;
+ break;
+ case xpoid_val_content_orientation_portrait:
+ default:
+ dir = 0;
+ break;
+ }
+ sprintf( t, "\033&l%dO", dir );
+ SEND_PCL( pConPriv->pPageFile, t );
+
+ /*
+ * Set the duplexing method. Since PCL wants to think of it in
+ * terms of the "binding edge," and the attribute store thinks in
+ * "duplex/tumble," this is a little complicated.
+ *
+ * Actually, this has no bearing on the output, since the HP1600C
+ * will only print on one side of the paper, and ignore all
+ * requests to enable duplexing. But, in an attempt to keep this
+ * driver somewhat generic, we'll enable it anyway.
+ */
+ plex = XpGetPlex( pCon );
+
+ if( plex == xpoid_val_plex_duplex )
+ {
+ if( dir == 0 || dir == 2 )
+ plexNum = 1;
+ else
+ plexNum = 2;
+ }
+ else if( plex == xpoid_val_plex_tumble )
+ {
+ if( dir == 0 || dir == 2 )
+ plexNum = 2;
+ else
+ plexNum = 1;
+ }
+ else
+ plexNum = 0;
+ sprintf( t, "\033&l%dS", plexNum );
+ SEND_PCL( pConPriv->pPageFile, t );
+
+ /*
+ * Set the input tray or medium. If XpGetPageSize gives us a valid medium,
+ * we can just send that to the printer, and let the printer handle the
+ * details. Otherwise, we select the tray returned from XpGetPageSize,
+ * which will be either a tray that should contain the correct medium
+ * (possibly with operator intervention), or the default tray from the
+ * config files.
+ */
+ medium = XpGetPageSize( pCon, &tray, NULL );
+ if( medium != xpoid_none )
+ {
+ switch( medium )
+ {
+ case xpoid_val_medium_size_na_legal:
+ num = 3;
+ break;
+ case xpoid_val_medium_size_iso_a3:
+ num = 27;
+ break;
+ case xpoid_val_medium_size_iso_a4:
+ num = 26;
+ break;
+ case xpoid_val_medium_size_executive:
+ num = 1;
+ break;
+ case xpoid_val_medium_size_ledger:
+ num = 6;
+ break;
+ case xpoid_val_medium_size_monarch_envelope:
+ num = 80;
+ break;
+ case xpoid_val_medium_size_na_number_10_envelope:
+ num = 81;
+ break;
+ case xpoid_val_medium_size_iso_designated_long:
+ num = 90;
+ break;
+ case xpoid_val_medium_size_iso_c5:
+ num = 91;
+ break;
+ case xpoid_val_medium_size_iso_b5:
+ num = 100;
+ break;
+ case xpoid_val_medium_size_jis_b5:
+ num = 45;
+ break;
+ case xpoid_val_medium_size_na_letter:
+ default:
+ num = 2;
+ break;
+ }
+ sprintf( t, "\033&l%dA", num );
+ SEND_PCL( pConPriv->pPageFile, t );
+ }
+ else
+ {
+ switch( tray )
+ {
+ case xpoid_val_input_tray_manual:
+ num = 2;
+ break;
+ case xpoid_val_input_tray_envelope:
+ num = 3;
+ break;
+ case xpoid_val_input_tray_large_capacity:
+ num = 5;
+ break;
+ case xpoid_val_input_tray_bottom:
+ num = 4;
+ break;
+ case xpoid_val_input_tray_main:
+ default:
+ num = 1;
+ break;
+ }
+ sprintf( t, "\033&l%dH", num );
+ SEND_PCL( pConPriv->pPageFile, t );
+ }
+
+ /*
+ * Set the scaling factors so that the HP-GL/2 coordinate system
+ * matches the X coordinate system, both in axis orientation and
+ * in unit<->pixel conversion.
+ */
+ XpGetReproductionArea( pCon, &repro );
+
+ sprintf( t, "\033&l0E\033*p%dx%dY", repro.x - 75, repro.y );
+ SEND_PCL( pConPriv->pPageFile, t );
+
+ sprintf( t, "\033*c%dx%dY\033*c0T", (int)(repro.width / 300.0 * 720.0),
+ (int)(repro.height / 300.0 * 720.0) );
+ SEND_PCL( pConPriv->pPageFile, t );
+
+ sprintf( t, "\033%%0BSC%d,%d,%d,%d;\033%%0A", repro.x, repro.x +
+ repro.width, repro.y + repro.height, repro.y );
+ SEND_PCL( pConPriv->pPageFile, t );
+
+ return Success;
+}
+
+/*
+ * When sending the generated PCL code back to the client, we send everything
+ * that we have generated so far for the job. After sending the data, we clean
+ * out the job file, to avoid repeatedly sending the same data.
+ */
+
+static int
+SendDocData( PclContextPrivPtr pPriv )
+{
+ struct stat statBuf;
+ int ret;
+
+ rewind( pPriv->pJobFile );
+ if( stat( pPriv->jobFileName, &statBuf ) < 0 )
+ return BadAlloc;
+
+ ret = XpSendDocumentData( pPriv->getDocClient, pPriv->pJobFile,
+ (int)statBuf.st_size, pPriv->getDocBufSize );
+
+ /*
+ * Clean out the job file
+ */
+ fclose( pPriv->pJobFile );
+ unlink( pPriv->jobFileName );
+
+ xfree(pPriv->jobFileName);
+
+ if (!XpOpenTmpFile("w+", &pPriv->jobFileName, &pPriv->pJobFile))
+ return BadAlloc;
+
+ return ret;
+}
+
+/*
+ * EndPage:
+ *
+ * Write page trailer to page file
+ * Write page file to job file
+ */
+int
+PclEndPage(
+ XpContextPtr pCon,
+ WindowPtr pWin)
+{
+ PclContextPrivPtr pConPriv = (PclContextPrivPtr)
+ dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey);
+
+ struct stat statBuf;
+
+ /*
+ * Send the page trailer to the page file.
+ */
+ SEND_PCL( pConPriv->pPageFile, "\014" );
+ fflush( pConPriv->pPageFile );
+
+ /*
+ * Write the page file contents to the job file, or to the
+ * whatever client has called GetDocumentData.
+ *
+ * pWinPriv->pPageFile must first be set to the start of the page file.
+ */
+ rewind(pConPriv->pPageFile);
+ if(stat(pConPriv->pageFileName, &statBuf) < 0)
+ return BadAlloc;
+
+ if(TransferBytes(pConPriv->pPageFile, pConPriv->pJobFile,
+ (int)statBuf.st_size) != (int)statBuf.st_size)
+ return BadAlloc;
+
+ if( pConPriv->getDocClient != (ClientPtr)NULL &&
+ pConPriv->getDocBufSize > 0 )
+ {
+ return SendDocData( pConPriv );
+ }
+
+ return Success;
+}
+
+/*
+ * The PclStartDoc() and PclEndDoc() functions serve basically as NOOP
+ * placeholders. This driver doesn't deal with the notion of multiple
+ * documents per page.
+ */
+
+int
+PclStartDoc(XpContextPtr pCon,
+ XPDocumentType type)
+{
+ PclContextPrivPtr pConPriv = (PclContextPrivPtr)
+ dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey);
+
+#ifndef XP_PCL_LJ3
+ /*
+ * Set the printer resolution for the page. Since we can only
+ * render color at 300dpi, we just hard-code this.
+ */
+ SEND_PCL( pConPriv->pJobFile,
+ "\033%-12345X@PJL SET RESOLUTION = 300\r\n" );
+#endif /* XP_PCL_LJ3 */
+
+ /*
+ * Initialize HP-GL/2
+ */
+ SEND_PCL( pConPriv->pJobFile, "\033E\033%0BIN,SP1,TR0;\033%0A" );
+
+ /*
+ * Stash the type of the document (used by PutDocumentData operation)
+ */
+ pConPriv->isRaw = (type == XPDocRaw);
+
+ return Success;
+}
+
+int
+PclEndDoc(
+ XpContextPtr pCon,
+ Bool cancel)
+{
+ /*
+ * XXX What should I do if I get cancel == TRUE?
+ */
+ return Success;
+}
+
+/*
+ * PclDocumentData()
+ *
+ * Hand any pre-generated PDL down to the spool files, formatting it
+ * as necessary to fit the given window.
+ *
+ */
+
+#define DOC_PCL 1
+#define DOC_HPGL 2
+
+int
+PclDocumentData(
+ XpContextPtr pCon,
+ DrawablePtr pDraw,
+ char *pData,
+ int len_data,
+ char *pFmt,
+ int len_fmt,
+ char *pOpt,
+ int len_opt,
+ ClientPtr client)
+{
+ int type = 0;
+ PclContextPrivPtr pPriv = (PclContextPrivPtr)
+ dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey);
+ XpOidDocFmtList *formats;
+ XpOidDocFmt *f;
+ char t[80];
+ xRectangle repro;
+
+ /*
+ * Verify the input format
+ */
+ formats = XpGetDocFmtListAttr( pCon, XPPrinterAttr,
+ (pPriv->isRaw) ?
+ xpoid_att_xp_raw_formats_supported :
+ xpoid_att_xp_embedded_formats_supported,
+ NULL );
+ f = XpOidDocFmtNew( pFmt );
+ if( !XpOidDocFmtListHasFmt( formats, f ) )
+ {
+ XpOidDocFmtListDelete( formats );
+ XpOidDocFmtDelete( f );
+ return BadMatch;
+ }
+ XpOidDocFmtListDelete( formats );
+
+ if( !(pPriv->isRaw) )
+ {
+ if( !strcmp( f->format, "PCL" ) )
+ type = DOC_PCL;
+ else if( !strcmp( f->format, "HPGL" ) )
+ type = DOC_HPGL;
+ else
+ {
+ XpOidDocFmtDelete( f );
+ return BadMatch;
+ }
+
+ switch( type )
+ {
+ case DOC_HPGL:
+ /*
+ * Move the picture frame to the appropriate place on the page,
+ * then assume that the embedded code will scale it properly.
+ */
+ sprintf( t, "\033&l0E\033*p%dx%dY",
+ pDraw->x - 75,
+ pDraw->y );
+ SEND_PCL( pPriv->pPageFile, t );
+
+ sprintf( t, "\033*c%dx%dY\033*coT",
+ (int)( pDraw->width / 300.0 * 720.0 ),
+ (int)( pDraw->height / 300.0 * 720.0 ) );
+ SEND_PCL( pPriv->pPageFile, t );
+ break;
+ }
+ }
+
+
+ /*
+ * Send the data down the pipe
+ */
+ SEND_PCL_COUNT( pPriv->pPageFile, pData, len_data );
+
+ /*
+ * If it's not a raw document, clean up the embedding
+ */
+ if( !(pPriv->isRaw) )
+ switch( type )
+ {
+ case DOC_HPGL:
+ /*
+ * Reset the picture frame
+ */
+ XpGetReproductionArea( pCon, &repro );
+
+ sprintf( t, "\033&l0E\033*p%dx%dY", repro.x - 75, repro.y );
+ SEND_PCL( pPriv->pPageFile, t );
+
+ sprintf( t, "\033*c%dx%dY\033*c0T",
+ (int)(repro.width / 300.0 * 720.0),
+ (int)(repro.height / 300.0 * 720.0) );
+ SEND_PCL( pPriv->pPageFile, t );
+
+ sprintf( t, "\033%%0BSC%d,%d,%d,%d;\033%%0A", repro.x, repro.x +
+ repro.width, repro.y + repro.height, repro.y );
+ SEND_PCL( pPriv->pPageFile, t );
+ break;
+ }
+
+ XpOidDocFmtDelete( f );
+ return Success;
+}
+
+/*
+ *
+ * PclGetDocumentData()
+ *
+ * This function allows the driver to send the generated PCL back to
+ * the client.
+ *
+ * XXX This function is barely spec'ed, much less implemented!
+ */
+
+int
+PclGetDocumentData(
+ XpContextPtr pCon,
+ ClientPtr client,
+ int maxBufferSize)
+{
+ PclContextPrivPtr pPriv = (PclContextPrivPtr)
+ dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey);
+
+ pPriv->getDocClient = client;
+ pPriv->getDocBufSize = maxBufferSize;
+
+ return Success;
+}
diff --git a/xorg-server/hw/xprint/pcl/PclSFonts.c b/xorg-server/hw/xprint/pcl/PclSFonts.c
new file mode 100644
index 000000000..2474d90d7
--- /dev/null
+++ b/xorg-server/hw/xprint/pcl/PclSFonts.c
@@ -0,0 +1,427 @@
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: PclSFonts.c
+** *
+** * Contents:
+** * Send Soft Font Download data to the specified
+** * file pointer.
+** *
+** * Created: 3/4/96
+** *
+** *********************************************************
+**
+********************************************************************/
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS 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 names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <stdio.h>
+#include "Pcl.h"
+
+static char tmp1;
+static short tmp2;
+#define Put1byte(fp, x) tmp1=x; fwrite((char *)&tmp1, 1, 1, fp)
+#define Put2bytes(fp, x) tmp2=x; fwrite((char *)&tmp2, 2, 1, fp)
+
+#define ESC 0x1b
+#define SYMBOL_SET 277
+
+static unsigned int PclDownloadChar(FILE *,PclCharDataPtr,unsigned short,unsigned char);
+static unsigned int PclDownloadHeader(FILE *, PclFontDescPtr, unsigned short);
+
+#ifdef PCL_FONT_COMPRESS
+static unsigned char *compress_bitmap_data(PclCharDataPtr, unsigned int *);
+#endif /* PCL_FONT_COMPRESS */
+
+/* -*- PclDownloadSoftFont8 -*-
+ * Send the Character Definition Command for 8-bit font
+ * **************************************************************************/
+void
+PclDownloadSoftFont8(
+ FILE *fp,
+ PclSoftFontInfoPtr pSoftFontInfo,
+ PclFontHead8Ptr pfh,
+ PclCharDataPtr pcd,
+ unsigned char *code
+)
+{
+ /*
+ * Check whether the font header has already been downloaded.
+ * If not, download it.
+ */
+
+ if ( !pfh->fid ) {
+ pfh->fid = pSoftFontInfo->cur_max_fid++;
+ PclDownloadHeader(fp, &(pfh->fd), pfh->fid);
+ }
+ pfh->index[*code] = *code;
+ PclDownloadChar(fp, pcd, pfh->fid, pfh->index[*code]);
+
+}
+
+/* -*- PclDownloadSoftFont16 -*-
+ * Send the Character Definition Command for 16 bit font
+ * **************************************************************************/
+void
+PclDownloadSoftFont16(
+ FILE *fp,
+ PclSoftFontInfoPtr pSoftFontInfo,
+ PclFontHead16Ptr pfh,
+ PclCharDataPtr pcd,
+ unsigned char row,
+ unsigned char col
+)
+{
+ /*
+ * Check whether the font header is already downloaded.
+ * If not, download it.
+ */
+
+ if ( !pfh->cur_cindex ) {
+ pfh->cur_fid = pSoftFontInfo->cur_max_fid++;
+ PclDownloadHeader(fp, &(pfh->fd), pfh->cur_fid);
+ }
+ pfh->index[row][col].fid = pfh->cur_fid;
+ pfh->index[row][col].cindex = pfh->cur_cindex++;
+
+ PclDownloadChar(fp, pcd, pfh->index[row][col].fid, pfh->index[row][col].cindex);
+}
+
+/* -*- PclCreateSoftFontInfo -*-
+ * Create and Initialize the structure for storing the information
+ * of the downloaded soft font.
+ * **************************************************************************/
+PclSoftFontInfoPtr
+PclCreateSoftFontInfo(void)
+{
+PclSoftFontInfoPtr pSoftFontInfo;
+
+ pSoftFontInfo = (PclSoftFontInfoPtr)xalloc(sizeof(PclSoftFontInfoRec));
+ if ( pSoftFontInfo == (PclSoftFontInfoPtr) NULL)
+ return (PclSoftFontInfoPtr) NULL;
+ pSoftFontInfo->phead8 = (PclFontHead8Ptr)NULL;
+ pSoftFontInfo->phead16 = (PclFontHead16Ptr)NULL;
+ pSoftFontInfo->pinfont = (PclInternalFontPtr)NULL;
+ pSoftFontInfo->cur_max_fid = 1;
+ return pSoftFontInfo;
+}
+
+/* -*- PclDestroySoftFontInfo -*-
+ * Destroy the soft font information structure
+ * **************************************************************************/
+void
+PclDestroySoftFontInfo( PclSoftFontInfoPtr pSoftFontInfo )
+{
+PclFontHead8Ptr pfh8, pfh8_next;
+PclFontHead16Ptr pfh16, pfh16_next;
+PclInternalFontPtr pin, pin_next;
+unsigned char nindex_row;
+int i;
+
+ if ( pSoftFontInfo == (PclSoftFontInfoPtr) NULL )
+ return;
+
+ pfh8 = pSoftFontInfo->phead8;
+ while (pfh8 != (PclFontHead8Ptr) NULL) {
+ xfree(pfh8->fontname);
+ xfree(pfh8->index);
+ pfh8_next = pfh8->next;
+ xfree(pfh8);
+ pfh8 = pfh8_next;
+ }
+
+ pfh16 = pSoftFontInfo->phead16;
+ while (pfh16 != (PclFontHead16Ptr) NULL) {
+ xfree(pfh16->fontname);
+ nindex_row = pfh16->lastRow - pfh16->firstRow + 1;
+ for (i=0; i<nindex_row; i++)
+ xfree(pfh16->index[i]);
+ xfree(pfh16->index);
+ pfh16_next = pfh16->next;
+ xfree(pfh16);
+ pfh16 = pfh16_next;
+ }
+
+ pin = pSoftFontInfo->pinfont;
+ while (pin != (PclInternalFontPtr) NULL) {
+ xfree(pin->fontname);
+ pin_next = pin->next;
+ xfree(pin);
+ pin = pin_next;
+ }
+
+ xfree(pSoftFontInfo);
+}
+
+/* -*- PclDownloadHeader -*-
+ * Send the Font Header Commnad.
+ * Format 0 : Font Header for Pcl Bitmapped Fonts
+ * Format 20 : Font Header for Resolution Specified Bitmapped Fonts
+ * **************************************************************************/
+static unsigned int
+PclDownloadHeader(
+ FILE *fp,
+ PclFontDescPtr fd,
+ unsigned short fid
+)
+{
+int nbytes;
+
+#ifdef XP_PCL_LJ3
+ nbytes = 64;
+#else
+ nbytes = 68;
+#endif /* XP_PCL_LJ3 */
+ /*
+ * Font ID Command : Esc *c#D
+ * (Default = 0, Range = 0 - 32767)
+ */
+ fprintf(fp, "%c*c%dD", ESC, fid);
+
+ /*
+ * Font Header Commnad : Esc )s#W[font header data]
+ * (Default = 0, Range = 0 - 32767)
+ */
+ fprintf(fp, "%c)s%dW", ESC, nbytes);
+
+ Put2bytes(fp, nbytes); /* Font Description Size */
+#ifdef XP_PCL_LJ3
+ Put1byte(fp, 0); /* Header Format */
+#else
+ Put1byte(fp, 20); /* Header Format */
+#endif /* XP_PCL_LJ3 */
+ Put1byte(fp, 2); /* Font Type */
+ Put2bytes(fp, 0); /* Style MSB */
+ Put2bytes(fp, fd->ascent); /* BaseLine Position */
+ Put2bytes(fp, fd->cellwidth); /* Cell Width */
+ Put2bytes(fp, fd->cellheight); /* Cell Height */
+ Put1byte(fp, 0); /* Orienation */
+ Put1byte(fp, fd->spacing); /* Spacing */
+ Put2bytes(fp, SYMBOL_SET); /* Symbol Set */
+ Put2bytes(fp, fd->pitch*4); /* font pitch */
+ Put2bytes(fp, fd->cellheight * 4); /* Height */
+ Put2bytes(fp, 0); /* x-Height */
+ Put1byte(fp, 0); /* width type (normal) */
+ Put1byte(fp, 0); /* Style LSB */
+ Put1byte(fp, 0); /* Stroke Weight */
+ Put1byte(fp, 5); /* Typeface LSB */
+ Put1byte(fp, 0); /* Typeface MSB */
+ Put1byte(fp, 0); /* Serif Style */
+ Put1byte(fp, 0); /* Quality */
+ Put1byte(fp, 0); /* Placement */
+ Put1byte(fp, 0); /* Underline Position */
+ Put1byte(fp, 0); /* Underline Thickness */
+ Put2bytes(fp, fd->cellheight*1.2); /* Text Height */
+ Put2bytes(fp, fd->cellwidth * 4); /* Text Width */
+ Put2bytes(fp, 0); /* First Code */
+ Put2bytes(fp, 255); /* Last Code */
+ Put1byte(fp, 0); /* Pitch Extend */
+ Put1byte(fp, 0); /* Height Extend */
+ Put2bytes(fp, 0); /* Cap Height */
+ Put2bytes(fp, 0); /* Font Number 1 */
+ Put2bytes(fp, 0); /* Font Number 2 */
+ Put2bytes(fp, 0); /* Font Name */
+ Put2bytes(fp, 0); /* Font Name */
+ Put2bytes(fp, 0); /* Font Name */
+ Put2bytes(fp, 0); /* Font Name */
+ Put2bytes(fp, 0); /* Font Name */
+ Put2bytes(fp, 0); /* Font Name */
+ Put2bytes(fp, 0); /* Font Name */
+ Put2bytes(fp, 0); /* Font Name */
+
+#ifdef XP_PCL_LJ3
+ return 64;
+#else
+ Put2bytes(fp, 300); /* X Resolution */
+ Put2bytes(fp, 300); /* Y Resolution */
+ return 68;
+#endif /* XP_PCL_LJ3 */
+
+}
+
+/* -*- PclDownloadCharacter -*-
+ * Send the Character Definition Command.
+ * **************************************************************************/
+static unsigned int
+PclDownloadChar(
+ FILE *fp,
+ PclCharDataPtr cd,
+ unsigned short fid,
+ unsigned char code
+)
+{
+unsigned int nbytes, n;
+unsigned char *raster;
+
+ /*
+ * Font ID Command : Esc *c#D
+ * (Default = 0, Range = 0 - 32767)
+ * Character Code Command : Esc *c#E
+ * (Default = 0, Range = 0 - 65535)
+ */
+ fprintf(fp, "%c*c%dd%dE", ESC, fid, code);
+
+ /*
+ * Character Definition Command : Esc (s#W[character descriptor and data]
+ * (Default = N/A, Range = 0 - 32767)
+ */
+
+ nbytes = n = cd->height * ((cd->width + 7) / 8);
+#ifdef PCL_FONT_COMPRESS
+ raster = compress_bitmap_data(cd, &nbytes);
+#else
+ raster = (unsigned char *)NULL;
+#endif /* PCL_FONT_COMPRESS */
+ fprintf(fp, "%c(s%dW", ESC, nbytes + 16);
+
+ Put1byte(fp, 4); /* Format */
+ Put1byte(fp, 0); /* Continuation */
+ Put1byte(fp, 14); /* Descriptor Size */
+ if (raster) { /* Class */
+ Put1byte(fp, 2);
+ } else {
+ Put1byte(fp, 1); /* Class */
+ }
+ Put2bytes(fp, 0); /* Orientation */
+ Put2bytes(fp, cd->h_offset); /* left offset */
+ Put2bytes(fp, cd->v_offset); /* top offset */
+ Put2bytes(fp, cd->width); /* character width */
+ Put2bytes(fp, cd->height); /* character height */
+ Put2bytes(fp, cd->font_pitch*4); /* delta X */
+
+ /*
+ * Raster Character Data
+ */
+ if (raster) {
+ fwrite(raster, nbytes, 1, fp);
+ xfree(raster);
+ } else
+ fwrite(cd->raster_top, nbytes, 1, fp);
+
+ return n + 16;
+}
+
+
+#ifdef PCL_FONT_COMPRESS
+/* -*- compress_bitmap_data -*-
+ * Compress Bitmap data
+ * **************************************************************************/
+static unsigned char *
+compress_bitmap_data(
+ PclCharDataPtr cd,
+ unsigned int *nbytes
+)
+{
+unsigned int byte_width;
+unsigned char *raster, *rptr_s, *rptr_e, *rptr_end;
+unsigned char *tmp_s, *tmp_ptr;
+unsigned char *p;
+unsigned char cur, pixel;
+unsigned int num;
+
+int i, j, k, w;
+
+ byte_width = (cd->width + 7) / 8;
+ *nbytes = cd->height * byte_width;
+
+ /* Create buffer for storing compress bitmap glyph */
+ raster = (unsigned char *)xalloc(*nbytes);
+ rptr_s = raster;
+ rptr_e = raster;
+ rptr_end = raster + *nbytes;
+
+ tmp_s = (unsigned char *)xalloc(cd->width * 8 + 2);
+
+ p = cd->raster_top;
+ for (i=0; i<cd->height; i++) {
+ tmp_ptr = tmp_s;
+ *tmp_ptr++ = 0;
+ if ( (*p>>7)&0x1 == 1 ) {
+ *tmp_ptr++ = 0;
+ cur = 1;
+ } else {
+ cur = 0;
+ }
+ num = 0;
+ for (j=0, w=0; j<byte_width; j++, p++) {
+ for (k=0; k<8 && w<cd->width; k++, w++) {
+ pixel = (*p>>(7-k))&0x1;
+ if ( pixel == cur ) {
+ num++;
+ } else {
+ cur = pixel;
+ while (num > 255) {
+ *tmp_ptr++ = 255;
+ *tmp_ptr++ = 0;
+ num -= 255;
+ }
+ *tmp_ptr++ = num;
+ num = 1;
+ }
+ }
+ }
+ if ( pixel == cur ) {
+ while (num > 255) {
+ *tmp_ptr++ = 255;
+ *tmp_ptr++ = 0;
+ num -= 255;
+ }
+ *tmp_ptr++ = num&0xff;
+ } else
+ *tmp_ptr++ = num;
+
+ if ( ((rptr_e - rptr_s) == (tmp_ptr - tmp_s)) &&
+ !memcmp(rptr_s+1, tmp_s+1, (tmp_ptr - tmp_s) - 1) )
+ *rptr_s += 1;
+ else {
+ if ( rptr_e + (tmp_ptr - tmp_s) > rptr_end ) {
+ xfree(raster);
+ xfree(tmp_s);
+ return (unsigned char *)NULL;
+ }
+ memcpy (rptr_e, tmp_s, tmp_ptr - tmp_s);
+ rptr_s = rptr_e;
+ rptr_e = rptr_s + (tmp_ptr - tmp_s);
+ }
+ }
+ xfree(tmp_s);
+ *nbytes = rptr_e - raster;
+
+ return raster;
+}
+#endif /* PCL_FONT_COMPRESS */
diff --git a/xorg-server/hw/xprint/pcl/PclSFonts.h b/xorg-server/hw/xprint/pcl/PclSFonts.h
new file mode 100644
index 000000000..c991263df
--- /dev/null
+++ b/xorg-server/hw/xprint/pcl/PclSFonts.h
@@ -0,0 +1,115 @@
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#ifndef _PCLFONTS_H
+#define _PCLFONTS_H
+
+/* -*-H-*-
+******************************************************************************
+******************************************************************************
+*
+* File: PclFonts.h
+* Description: Send Soft Font Download data to the specified file pointer.
+*
+*
+******************************************************************************
+******************************************************************************
+*/
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS 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 names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+
+
+typedef struct {
+ unsigned char fid; /* sfont font ID */
+ unsigned char cindex; /* character indext */
+} PclFontMapRec, PclFontMapPtr;
+
+typedef struct {
+ int h_offset;
+ int v_offset;
+ unsigned int width;
+ unsigned int height;
+ int font_pitch;
+ unsigned char *raster_top;
+} PclCharDataRec, *PclCharDataPtr;
+
+typedef struct {
+ unsigned char spacing;
+ unsigned int pitch;
+ unsigned int cellheight;
+ unsigned int cellwidth;
+ int ascent;
+ int descent;
+} PclFontDescRec, *PclFontDescPtr;
+
+typedef struct _PclFontHead8Rec {
+ char *fontname;
+ PclFontDescRec fd;
+ unsigned short fid;
+ unsigned char *index;
+ struct _PclFontHead8Rec *next;
+} PclFontHead8Rec, *PclFontHead8Ptr;
+
+typedef struct _PclFontHead16Rec {
+ char *fontname;
+ PclFontDescRec fd;
+ unsigned short cur_fid;
+ unsigned char cur_cindex;
+ PclFontMapRec **index;
+ unsigned short firstCol;
+ unsigned short lastCol;
+ unsigned short firstRow;
+ unsigned short lastRow;
+ struct _PclFontHead16Rec *next;
+} PclFontHead16Rec, *PclFontHead16Ptr;
+
+typedef struct _PclInternalFontRec {
+ char *fontname;
+ float pitch;
+ float height;
+ char *pcl_font_name;
+ char *spacing;
+ struct _PclInternalFontRec *next;
+} PclInternalFontRec, *PclInternalFontPtr;
+
+typedef struct {
+ PclFontHead8Ptr phead8;
+ PclFontHead16Ptr phead16;
+ PclInternalFontPtr pinfont;
+ unsigned char cur_max_fid;
+} PclSoftFontInfoRec, *PclSoftFontInfoPtr;
+
+#define MONOSPACE 0
+#define PROPSPACE 1
+
+#endif /* _PCLFONTS_H */
diff --git a/xorg-server/hw/xprint/pcl/PclSpans.c b/xorg-server/hw/xprint/pcl/PclSpans.c
new file mode 100644
index 000000000..4951899ab
--- /dev/null
+++ b/xorg-server/hw/xprint/pcl/PclSpans.c
@@ -0,0 +1,137 @@
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: PclSpans.c
+** *
+** * Contents:
+** * Code to set and fill spans in the PCL DDX
+** *
+** * Created: 10/23/95
+** *
+** *********************************************************
+**
+********************************************************************/
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS 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 names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include "Pcl.h"
+#include "gcstruct.h"
+#include "windowstr.h"
+
+void
+PclFillSpans(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int nSpans,
+ DDXPointPtr pPoints,
+ int *pWidths,
+ int fSorted)
+{
+ char t[80];
+ FILE *outFile;
+ int xoffset, yoffset;
+ xRectangle *rects, *r;
+ RegionPtr fillRegion, region = 0;
+ int i;
+ int nbox;
+ BoxPtr pbox;
+
+ if( PclUpdateDrawableGC( pGC, pDrawable, &outFile ) == FALSE )
+ return;
+
+ /*
+ * Build a region out of the spans
+ */
+ rects = (xRectangle *)xalloc( nSpans * sizeof( xRectangle ) );
+ xoffset = pDrawable->x;
+ yoffset = pDrawable->y;
+
+ for( i = 0, r = rects; i < nSpans; i++, r++ )
+ {
+ r->x = pPoints[i].x + xoffset;
+ r->y = pPoints[i].y + yoffset;
+ r->width = pWidths[i];
+ r->height = 1;
+ }
+ fillRegion = RECTS_TO_REGION( pGC->pScreen, nSpans, rects, ( fSorted ) ?
+ CT_YSORTED : CT_UNSORTED );
+
+ /*
+ * Intersect this region with the clip region. Whatever's left,
+ * should be filled.
+ */
+ REGION_INTERSECT( pGC->pScreen, region, fillRegion, pGC->clientClip );
+
+ pbox = REGION_RECTS( region );
+ nbox = REGION_NUM_RECTS( region );
+
+ /* Enter HP-GL/2 */
+ SEND_PCL( outFile, "\27%0B" );
+
+ while( nbox )
+ {
+ sprintf( t, "PU%d,%d;RR%d,%d;", pbox->x1, pbox->y1,
+ pbox->x2, pbox->y2 );
+ SEND_PCL( outFile, t );
+
+ nbox--;
+ pbox++;
+ }
+
+ /* Go back to PCL */
+ SEND_PCL( outFile, "\27%0A" );
+
+ /*
+ * Clean up the temporary regions
+ */
+ REGION_DESTROY( pGC->pScreen, fillRegion );
+ REGION_DESTROY( pGC->pScreen, region );
+ xfree( rects );
+}
+
+void
+PclSetSpans(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ char *pSrc,
+ DDXPointPtr pPoints,
+ int *pWidths,
+ int nSpans,
+ int fSorted)
+{
+}
diff --git a/xorg-server/hw/xprint/pcl/PclText.c b/xorg-server/hw/xprint/pcl/PclText.c
new file mode 100644
index 000000000..324de3014
--- /dev/null
+++ b/xorg-server/hw/xprint/pcl/PclText.c
@@ -0,0 +1,934 @@
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: PclText.c
+** *
+** * Contents:
+** * Character-drawing routines for the PCL DDX
+** *
+** * Created: 10/23/95
+** *
+** *********************************************************
+**
+********************************************************************/
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS 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 names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#ifdef DO_TWO_BYTE_PCL
+#include "iconv.h"
+#endif /* DO_TWO_BYTE_PCL */
+#include "gcstruct.h"
+#include "windowstr.h"
+
+#include "Pcl.h"
+#include "migc.h"
+#include <X11/Xatom.h>
+
+#include "PclSFonts.h"
+
+static PclFontHead8Ptr makeFontHeader8 (FontPtr, PclSoftFontInfoPtr);
+static PclFontHead16Ptr makeFontHeader16(FontPtr, PclSoftFontInfoPtr);
+static PclInternalFontPtr makeInternalFont(FontPtr, PclSoftFontInfoPtr);
+static void fillFontDescData(FontPtr, PclFontDescPtr, unsigned int);
+static PclCharDataPtr fillCharDescData(PclCharDataPtr, CharInfoPtr);
+static void output_text(FILE *, PclContextPrivPtr, unsigned char);
+static char * getFontName(FontPtr);
+static char isInternal(FontPtr);
+static void selectInternalFont(FILE *, PclInternalFontPtr, int);
+static void selectSize(FILE *, PclContextPrivPtr, PclInternalFontPtr);
+static char t[80];
+
+#ifdef DO_TWO_BYTE_PCL
+static void code_conv(PclSoftFontInfoPtr, FontPtr, char *, char *);
+#endif /* DO_TWO_BYTE_PCL */
+
+#define ESC 0x1b
+#define PER 0x25
+#define ETX 0x3
+#define ETX_ALT 0x2a
+#define DOWNLOAD_FONT 0
+#define INTERNAL_FONT 1
+
+int
+PclPolyText8(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int x,
+ int y,
+ int count,
+ char *string)
+{
+XpContextPtr pCon;
+PclContextPrivPtr pConPriv;
+unsigned long n, i;
+int w;
+CharInfoPtr charinfo[255], *chinfo;
+
+FILE *outFile;
+PclSoftFontInfoPtr pSoftFontInfo;
+PclFontHead8Ptr pfh8 = (PclFontHead8Ptr)NULL;
+PclInternalFontPtr pin = (PclInternalFontPtr)NULL;
+PclCharDataRec cd;
+unsigned char *p;
+unsigned char last_fid;
+int max_ascent, max_descent;
+
+int nbox;
+BoxPtr pbox;
+BoxRec box;
+RegionPtr drawRegion, region;
+char font_type;
+
+ if( PclUpdateDrawableGC( pGC, pDrawable, &outFile ) == FALSE )
+ return x;
+
+ GetGlyphs(pGC->font, (unsigned long)count, (unsigned char *)string,
+ Linear8Bit, &n, charinfo);
+ if ( n == 0 )
+ return x;
+
+ pCon = PclGetContextFromWindow( (WindowPtr)pDrawable );
+ pConPriv = (PclContextPrivPtr)
+ dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey);
+ pSoftFontInfo = pConPriv->pSoftFontInfo;
+ font_type = isInternal(pGC->font);
+ if ( font_type == DOWNLOAD_FONT ) {
+ /*
+ * Create Soft Font Header Information
+ */
+ pfh8 = makeFontHeader8(pGC->font, pSoftFontInfo);
+ if (!pfh8)
+ return x;
+
+ /*
+ * exec Soft Font Downloading
+ */
+ p = (unsigned char *)string;
+ for (i=0, chinfo=charinfo; i<n; i++, p++, chinfo++) {
+ if ( !pfh8->index[*p] ) {
+ fillCharDescData(&cd, *chinfo);
+ PclDownloadSoftFont8(pConPriv->pJobFile, pSoftFontInfo,
+ pfh8, &cd, p);
+ xfree(cd.raster_top);
+ }
+ }
+
+ /*
+ * print characters
+ */
+ MACRO_START( outFile, pConPriv );
+ sprintf(t, "\033%%0B;PU%d,%dPD;TD1;DT%c,1;",
+ x + pDrawable->x, y + pDrawable->y + pGC->font->info.fontAscent,
+ ETX);
+ SAVE_PCL( outFile, pConPriv, t );
+ SAVE_PCL_COUNT( outFile, pConPriv, "FI0;SS;LB", 9 );
+
+ last_fid = 0;
+ w = 0;
+ max_ascent = charinfo[0]->metrics.ascent;
+ max_descent = charinfo[0]->metrics.descent;
+ p = (unsigned char *)string;
+ for (i=0, chinfo=charinfo; i<n; i++, p++, chinfo++) {
+ if ( last_fid != pfh8->fid ) {
+ sprintf(t, "%c;FI%d;SS;LB", ETX, pfh8->fid);
+ SAVE_PCL( outFile, pConPriv, t );
+
+ last_fid = pfh8->fid;
+ }
+
+ output_text(outFile, pConPriv, pfh8->index[*p]);
+
+ w += (*chinfo)->metrics.characterWidth;
+ max_ascent = MAX(max_ascent, (*chinfo)->metrics.ascent);
+ max_descent = MAX(max_descent, (*chinfo)->metrics.descent);
+ }
+
+ sprintf(t, "%c", ETX);
+ SAVE_PCL_COUNT( outFile, pConPriv, t, 1 );
+ sprintf(t, "TD0;\033%%1A");
+ SAVE_PCL( outFile, pConPriv, t );
+ MACRO_END( outFile );
+
+ } else {
+ int fid = 0;
+
+ pin = makeInternalFont(pGC->font, pSoftFontInfo);
+ if (!pin)
+ return x;
+
+ selectInternalFont(outFile, pin, fid);
+
+ /*
+ * print characters
+ */
+ MACRO_START( outFile, pConPriv );
+ sprintf(t, "\033%%0B;PU%d,%dPD;TD1;DT%c,1;",
+ x + pDrawable->x, y + pDrawable->y + pGC->font->info.fontAscent,
+ ETX);
+ SAVE_PCL( outFile, pConPriv, t );
+ selectSize(outFile, pConPriv, pin);
+ SAVE_PCL_COUNT( outFile, pConPriv, "FI0;SS;LB", 9 );
+
+ w = 0;
+ max_ascent = charinfo[0]->metrics.ascent;
+ max_descent = charinfo[0]->metrics.descent;
+ p = (unsigned char *)string;
+ for (i=0, chinfo=charinfo; i<n; i++, p++, chinfo++) {
+ output_text(outFile, pConPriv, *p);
+
+ w += (*chinfo)->metrics.characterWidth;
+ max_ascent = MAX(max_ascent, (*chinfo)->metrics.ascent);
+ max_descent = MAX(max_descent, (*chinfo)->metrics.descent);
+ }
+ sprintf(t, "%c", ETX);
+ SAVE_PCL_COUNT( outFile, pConPriv, t, 1 );
+ sprintf(t, "TD0;\033%%1A");
+ SAVE_PCL( outFile, pConPriv, t );
+ MACRO_END( outFile );
+ }
+
+ /*
+ * Convert the collection of rectangles into a proper region, then
+ * intersect it with the clip region.
+ */
+ box.x1 = x + pDrawable->x;
+ box.y1 = y - max_ascent + pDrawable->y + pGC->font->info.fontAscent;
+ box.x2 = x + w + pDrawable->x;
+ box.y2 = y + max_descent + pDrawable->y + pGC->font->info.fontAscent;
+
+ drawRegion = miRegionCreate( &box, 0 );
+ region = miRegionCreate( NULL, 0 );
+ miIntersect( region, drawRegion, pGC->pCompositeClip );
+
+ /*
+ * For each rectangle in the clip region, set the HP-GL/2 "input
+ * window" and render the entire polyline to it.
+ */
+ pbox = REGION_RECTS( region );
+ nbox = REGION_NUM_RECTS( region );
+
+ PclSendData(outFile, pConPriv, pbox, nbox, 1.0);
+
+ /*
+ * Clean up the temporary regions
+ */
+ REGION_DESTROY( pGC->pScreen, drawRegion );
+ REGION_DESTROY( pGC->pScreen, region );
+
+ return x+w;
+}
+
+int
+PclPolyText16(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int x,
+ int y,
+ int count,
+ unsigned short *string)
+{
+XpContextPtr pCon;
+PclContextPrivPtr pConPriv;
+unsigned long n, i;
+int w;
+CharInfoPtr charinfo[255], *chinfo;
+
+FILE *outFile;
+PclSoftFontInfoPtr pSoftFontInfo;
+PclFontHead16Ptr pfh16 = (PclFontHead16Ptr)NULL;
+PclCharDataRec cd;
+FontInfoPtr pfi;
+unsigned char row, col;
+char *p;
+unsigned char last_fid;
+int max_ascent, max_descent;
+unsigned short def;
+
+int nbox;
+BoxPtr pbox;
+BoxRec box;
+RegionPtr drawRegion, region;
+char font_type;
+
+ if( PclUpdateDrawableGC( pGC, pDrawable, &outFile ) == FALSE )
+ return x;
+
+ GetGlyphs(pGC->font, (unsigned long)count, (unsigned char *)string,
+ (FONTLASTROW(pGC->font) == 0) ? Linear16Bit : TwoD16Bit,
+ &n, charinfo);
+
+ pCon = PclGetContextFromWindow( (WindowPtr)pDrawable );
+ pConPriv = (PclContextPrivPtr)
+ dixLookupPrivate(&pCon->devPrivates, PclContextPrivateKey);
+ pSoftFontInfo = pConPriv->pSoftFontInfo;
+
+ font_type = isInternal(pGC->font);
+ if ( font_type == DOWNLOAD_FONT ) {
+ /*
+ * Create Soft Font Header Information
+ */
+ pfh16 = makeFontHeader16(pGC->font, pSoftFontInfo);
+ if (!pfh16)
+ return x;
+
+ /*
+ * exec Soft Font Downloading
+ */
+ pfi = (FontInfoRec *)&pGC->font->info;
+ p = (char *)string;
+ for (i=0, p=(char *)string, chinfo=charinfo; i<n; i++, p+=2, chinfo++) {
+ row = *p & 0xff;
+ col = *(p+1) & 0xff;
+ if ( (pfi->firstRow <= row) && (row <= pfi->lastRow)
+ && (pfi->firstCol <= col) && (col <= pfi->lastCol) ) {
+ row = row - pfi->firstRow;
+ col = col - pfi->firstCol;
+ } else {
+ def = pfi->defaultCh;
+ row = ((def>>8)&0xff) - pfi->firstRow;
+ col = (def&0xff) - pfi->firstCol;
+ }
+ if ( !pfh16->index[row][col].fid ) {
+ fillCharDescData(&cd, *chinfo);
+ PclDownloadSoftFont16(pConPriv->pJobFile, pSoftFontInfo,
+ pfh16, &cd, row, col);
+ xfree(cd.raster_top);
+ }
+ }
+
+ /*
+ * print characters
+ */
+ MACRO_START( outFile, pConPriv );
+ sprintf(t, "\033%%0B;PU%d,%dPD;TD1;DT%c,1;",
+ x + pDrawable->x, y + pDrawable->y + pGC->font->info.fontAscent,
+ ETX);
+ SAVE_PCL( outFile, pConPriv, t );
+ SAVE_PCL_COUNT( outFile, pConPriv, "FI0;SS;LB", 9 );
+
+ last_fid = 0;
+
+ w = 0;
+ max_ascent = charinfo[0]->metrics.ascent;
+ max_descent = charinfo[0]->metrics.descent;
+ for (i=0, p=(char *)string, chinfo=charinfo; i<n; i++, p+=2, chinfo++) {
+ row = *p & 0xff;
+ col = *(p+1) & 0xff;
+ if ( (pfi->firstRow <= row) && (row <= pfi->lastRow)
+ && (pfi->firstCol <= col) && (col <= pfi->lastCol) ) {
+ row = row - pfi->firstRow;
+ col = col - pfi->firstCol;
+ } else {
+ def = pfi->defaultCh;
+ row = ((def>>8)&0xff) - pfi->firstRow;
+ col = (def&0xff) - pfi->firstCol;
+ }
+ if ( last_fid != pfh16->index[row][col].fid ) {
+ sprintf(t, "%cFI%d;SS;LB",
+ ETX, pfh16->index[row][col].fid);
+ SAVE_PCL( outFile, pConPriv, t );
+ last_fid = pfh16->index[row][col].fid;
+ }
+
+ output_text(outFile, pConPriv, pfh16->index[row][col].cindex);
+
+ w += (*chinfo)->metrics.characterWidth;
+ max_ascent = MAX(max_ascent, (*chinfo)->metrics.ascent);
+ max_descent = MAX(max_descent, (*chinfo)->metrics.descent);
+ }
+ sprintf(t, "%c", ETX);
+ SAVE_PCL_COUNT( outFile, pConPriv, t, 1 );
+ sprintf(t, "TD0;\033%%1A");
+ SAVE_PCL( outFile, pConPriv, t );
+ MACRO_END( outFile );
+
+ } else {
+#ifdef DO_TWO_BYTE_PCL
+ PclInternalFontPtr pin;
+ int fid = 0;
+
+ pin = makeInternalFont(pGC->font, pSoftFontInfo);
+ if (!pin)
+ return x;
+
+ selectInternalFont(outFile, pin, fid);
+ fprintf(outFile, "%c&t31P", ESC);
+
+ /*
+ * print characters
+ */
+ MACRO_START( outFile, pConPriv );
+ sprintf(t, "\033%%0B;PU%d,%dPD;TD1;DT%c,1;",
+ x + pDrawable->x, y + pDrawable->y + pGC->font->info.fontAscent,
+ ETX);
+ SAVE_PCL( outFile, pConPriv, t );
+ sprintf(t, "TD0;\033%%1A");
+ SAVE_PCL( outFile, pConPriv, t );
+
+ w = 0;
+ last_fid = 0;
+ max_ascent = charinfo[0]->metrics.ascent;
+ max_descent = charinfo[0]->metrics.descent;
+ for (i=0, p=(char *)string, chinfo=charinfo; i<n; i++, p+=2, chinfo++) {
+ char tobuf[3];
+ code_conv(pSoftFontInfo, pGC->font, (char *)p, tobuf);
+ fprintf(outFile, "%c%c", tobuf[0], tobuf[1]);
+
+ w += (*chinfo)->metrics.characterWidth;
+ max_ascent = MAX(max_ascent, (*chinfo)->metrics.ascent);
+ max_descent = MAX(max_descent, (*chinfo)->metrics.descent);
+ }
+ MACRO_END( outFile );
+#else
+ return x;
+#endif /* DO_TWO_BYTE_PCL */
+ }
+
+ /*
+ * Convert the collection of rectangles into a proper region, then
+ * intersect it with the clip region.
+ */
+ box.x1 = x + pDrawable->x;
+ box.y1 = y - max_ascent + pDrawable->y + pGC->font->info.fontAscent;
+ box.x2 = x + w + pDrawable->x;
+ box.y2 = y + max_descent + pDrawable->y + pGC->font->info.fontAscent;
+
+ drawRegion = miRegionCreate( &box, 0 );
+ region = miRegionCreate( NULL, 0 );
+ miIntersect( region, drawRegion, pGC->pCompositeClip );
+
+ /*
+ * For each rectangle in the clip region, set the HP-GL/2 "input
+ * window" and render the entire polyline to it.
+ */
+ pbox = REGION_RECTS( region );
+ nbox = REGION_NUM_RECTS( region );
+
+ PclSendData(outFile, pConPriv, pbox, nbox, 1.0);
+
+ /*
+ * Clean up the temporary regions
+ */
+ REGION_DESTROY( pGC->pScreen, drawRegion );
+ REGION_DESTROY( pGC->pScreen, region );
+
+ return x+w;
+}
+
+void
+PclImageText8(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int x, int y,
+ int count,
+ char *string)
+{
+}
+
+void
+PclImageText16(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int x,
+ int y,
+ int count,
+ unsigned short *string)
+{
+}
+
+void
+PclImageGlyphBlt(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int x, int y,
+ unsigned int nGlyphs,
+ CharInfoPtr *pCharInfo,
+ pointer pGlyphBase)
+{
+}
+
+void
+PclPolyGlyphBlt(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int x, int y,
+ unsigned int nGlyphs,
+ CharInfoPtr *pCharInfo,
+ pointer pGlyphBase)
+{
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+static PclFontHead8Ptr
+makeFontHeader8(FontPtr pfont, PclSoftFontInfoPtr pSoftFontInfo)
+{
+PclFontHead8Ptr phead8 = pSoftFontInfo->phead8;
+PclFontHead8Ptr pfh8 = phead8;
+PclFontHead8Ptr prev = (PclFontHead8Ptr)NULL;
+FontInfoPtr pfi;
+char *fontname;
+unsigned char nindex;
+int i;
+unsigned long n;
+CharInfoPtr charinfo[1];
+unsigned int space_width;
+
+ if (pSoftFontInfo == (PclSoftFontInfoPtr) NULL)
+ return (PclFontHead8Ptr)NULL;
+
+ /*
+ * Verify it has already been created, if so, return it.
+ */
+ if ( (fontname = getFontName(pfont)) == (char *)NULL)
+ return (PclFontHead8Ptr)NULL;
+
+ while (pfh8 != (PclFontHead8Ptr) NULL) {
+ if (!strcmp(pfh8->fontname, fontname))
+ return pfh8;
+ prev = pfh8;
+ pfh8 = pfh8->next;
+ }
+
+ /*
+ * Create Font Header Information
+ */
+ pfh8 = (PclFontHead8Ptr)xalloc(sizeof(PclFontHead8Rec));
+ if (pfh8 == (PclFontHead8Ptr)NULL)
+ return (PclFontHead8Ptr)NULL;
+
+ pfi = (FontInfoRec *)&pfont->info;
+ GetGlyphs(pfont, 1, (unsigned char *)&pfi->defaultCh,
+ Linear8Bit, &n, charinfo);
+ if ( n )
+ space_width = charinfo[0]->metrics.characterWidth;
+ else
+ space_width = FONTMAXBOUNDS(pfont,characterWidth);
+
+ fillFontDescData(pfont, &(pfh8->fd), space_width);
+ pfh8->fid = 0;
+ pfh8->fontname = (char *)xalloc(strlen(fontname) + 1);
+ if (pfh8->fontname == (char *)NULL) {
+ xfree(pfh8);
+ return (PclFontHead8Ptr) NULL;
+ }
+ strcpy(pfh8->fontname, fontname);
+
+ nindex = 0xff;
+ pfh8->index = (unsigned char *)xalloc(nindex);
+ if ( pfh8->index == (unsigned char *) NULL ) {
+ xfree(pfh8->fontname);
+ xfree(pfh8);
+ return (PclFontHead8Ptr) NULL;
+ }
+
+ for (i=0; i<=nindex; i++)
+ pfh8->index[i] = 0x0;
+
+ pfh8->next = (PclFontHead8Ptr)NULL;
+
+ if ( prev == (PclFontHead8Ptr) NULL)
+ pSoftFontInfo->phead8 = pfh8;
+ else
+ prev->next = pfh8;
+
+ return pfh8;
+}
+
+static PclFontHead16Ptr
+makeFontHeader16(FontPtr pfont, PclSoftFontInfoPtr pSoftFontInfo)
+{
+PclFontHead16Ptr phead16 = pSoftFontInfo->phead16;
+PclFontHead16Ptr pfh16 = phead16;
+PclFontHead16Ptr prev = (PclFontHead16Ptr)NULL;
+PclFontMapRec ** index;
+FontInfoPtr pfi;
+char *fontname;
+unsigned char nindex_row, nindex_col;
+int i, j;
+unsigned long n;
+CharInfoPtr charinfo[1];
+unsigned int space_width;
+
+ if (pSoftFontInfo == (PclSoftFontInfoPtr) NULL)
+ return (PclFontHead16Ptr)NULL;
+
+ /*
+ * Verify it has already been created, if so, return it.
+ */
+ if ( (fontname = getFontName(pfont)) == (char *)NULL)
+ return (PclFontHead16Ptr)NULL;
+
+ while (pfh16 != (PclFontHead16Ptr) NULL) {
+ if (!strcmp(pfh16->fontname, fontname))
+ return pfh16;
+ prev = pfh16;
+ pfh16 = pfh16->next;
+ }
+
+ /*
+ * Create Font Header Information
+ */
+ pfh16 = (PclFontHead16Ptr)xalloc(sizeof(PclFontHead16Rec));
+ if (pfh16 == (PclFontHead16Ptr)NULL)
+ return (PclFontHead16Ptr)NULL;
+
+ pfi = (FontInfoRec *)&pfont->info;
+ GetGlyphs(pfont, 1, (unsigned char *)&pfi->defaultCh,
+ (FONTLASTROW(pfont) == 0) ? Linear16Bit : TwoD16Bit,
+ &n, charinfo);
+
+ if ( n )
+ space_width = charinfo[0]->metrics.characterWidth;
+ else
+ space_width = FONTMAXBOUNDS(pfont,characterWidth);
+
+ fillFontDescData(pfont, &(pfh16->fd), space_width);
+ pfh16->cur_fid = 0;
+ pfh16->cur_cindex = 0;
+ pfh16->fontname = (char *)xalloc(strlen(fontname) + 1);
+ if (pfh16->fontname == (char *)NULL) {
+ xfree(pfh16);
+ return (PclFontHead16Ptr) NULL;
+ }
+ strcpy(pfh16->fontname, fontname);
+
+ pfi = (FontInfoRec *)&pfont->info;
+ nindex_col = pfi->lastCol - pfi->firstCol + 1;
+ nindex_row = pfi->lastRow - pfi->firstRow + 1;
+ index = (PclFontMapRec **)xalloc(sizeof(PclFontMapRec *)*nindex_row);
+ if (index == (PclFontMapRec **)NULL) {
+ xfree(pfh16->fontname);
+ xfree(pfh16);
+ return (PclFontHead16Ptr) NULL;
+ }
+ for (i=0; i<nindex_row; i++) {
+ index[i] = (PclFontMapRec *)xalloc(sizeof(PclFontMapRec)*nindex_col);
+ if (index[i] == (PclFontMapRec *)NULL) {
+ for(j=0; j<i; j++)
+ xfree(index[j]);
+ xfree(pfh16->fontname);
+ xfree(pfh16);
+ return (PclFontHead16Ptr) NULL;
+ }
+ for (j=0; j<=nindex_col; j++)
+ index[i][j].fid = 0x0;
+ }
+
+ pfh16->index = index;
+ pfh16->firstCol = pfi->firstCol;
+ pfh16->lastCol = pfi->lastCol;
+ pfh16->firstRow = pfi->firstRow;
+ pfh16->lastRow = pfi->lastRow;
+ pfh16->next = (PclFontHead16Ptr)NULL;
+
+ if ( prev == (PclFontHead16Ptr) NULL)
+ pSoftFontInfo->phead16 = pfh16;
+ else
+ prev->next = pfh16;
+
+ return pfh16;
+}
+
+static PclInternalFontPtr
+makeInternalFont(FontPtr pfont, PclSoftFontInfoPtr pSoftFontInfo)
+{
+PclInternalFontPtr pinfont = pSoftFontInfo->pinfont;
+PclInternalFontPtr pin = pinfont;
+PclInternalFontPtr prev = (PclInternalFontPtr)NULL;
+FontPropPtr props;
+FontInfoPtr pfi;
+char *fontname;
+Atom xa_pcl_font_name, xa_res, xa_ave_width, xa_spacing;
+int width = 1;
+int mask;
+int i;
+
+ if (pSoftFontInfo == (PclSoftFontInfoPtr) NULL)
+ return (PclInternalFontPtr)NULL;
+
+ /*
+ * Verify it has already been created, if so, return it.
+ */
+ if ( (fontname = getFontName(pfont)) == (char *)NULL)
+ return (PclInternalFontPtr)NULL;
+
+ while (pin != (PclInternalFontPtr) NULL) {
+ if (!strcmp(pin->fontname, fontname))
+ return pin;
+ prev = pin;
+ pin = pin->next;
+ }
+
+ /*
+ * Create Internal Font Information
+ */
+ pin = (PclInternalFontPtr)xalloc(sizeof(PclInternalFontRec));
+ if (pin == (PclInternalFontPtr)NULL)
+ return (PclInternalFontPtr)NULL;
+
+ pin->fontname = (char *)xalloc(strlen(fontname) + 1);
+ if (pin->fontname == (char *)NULL) {
+ xfree(pin);
+ return (PclInternalFontPtr) NULL;
+ }
+ strcpy(pin->fontname, fontname);
+
+ xa_pcl_font_name = MakeAtom("PCL_FONT_NAME", strlen("PCL_FONT_NAME"), TRUE);
+ xa_res = MakeAtom("RESOLUTION_X", strlen("RESOLUTION_X"), TRUE);
+ xa_ave_width = MakeAtom("AVERAGE_WIDTH", strlen("AVERAGE_WIDTH"), TRUE);
+ xa_spacing = MakeAtom("SPACING", strlen("SPACING"), TRUE);
+ pfi = (FontInfoRec *)&pfont->info;
+ props = pfi->props;
+
+ mask = 0;
+ for (i=0; i<pfi->nprops; i++, props++) {
+ if ( (Atom) props->name == xa_pcl_font_name ) {
+ pin->pcl_font_name = NameForAtom(props->value);
+ mask |= 0x1;
+ } else if ( props->name == XA_POINT_SIZE ) {
+ pin->height = (float) props->value / 10.0;
+ mask |= 0x2;
+ } else if ( (Atom) props->name == xa_res ) {
+ mask |= 0x4;
+ } else if ( (Atom) props->name == xa_ave_width ) {
+ width = (int) props->value / 10;
+ mask |= 0x8;
+ } else if ( (Atom) props->name == xa_spacing ) {
+ pin->spacing = NameForAtom(props->value);
+ mask |= 0x10;
+ }
+ }
+ if ( mask != 0x1f ) {
+ xfree(pin->fontname);
+ xfree(pin);
+ return (PclInternalFontPtr) NULL;
+ }
+
+ if ( *pin->spacing != 'P' || *pin->spacing != 'p' ) {
+ if (width == 0)
+ width = 1;
+ pin->pitch = (float) 300.0 / width; /* Hard-Code: Resolution is 300 */
+ }
+
+ pin->next = (PclInternalFontPtr)NULL;
+ if ( prev == (PclInternalFontPtr) NULL)
+ pSoftFontInfo->pinfont = pin;
+ else
+ prev->next = pin;
+
+ return pin;
+}
+
+static void
+fillFontDescData(FontPtr pfont, PclFontDescPtr pfd, unsigned int space)
+{
+FontInfoPtr pfi;
+
+ pfi = (FontInfoRec *)&pfont->info;
+
+ if ( (pfi->maxbounds.leftSideBearing == pfi->minbounds.leftSideBearing)
+ && (pfi->maxbounds.rightSideBearing == pfi->minbounds.rightSideBearing)
+ && (pfi->maxbounds.characterWidth == pfi->minbounds.characterWidth)
+ && (pfi->maxbounds.ascent == pfi->minbounds.ascent)
+ && (pfi->maxbounds.descent == pfi->minbounds.descent)
+ )
+ pfd->spacing = MONOSPACE;
+ else
+ pfd->spacing = PROPSPACE;
+
+ pfd->pitch = space;
+ pfd->cellheight = FONTMAXBOUNDS(pfont,ascent)
+ + FONTMAXBOUNDS(pfont,descent);
+ pfd->cellwidth = FONTMAXBOUNDS(pfont,rightSideBearing)
+ - FONTMINBOUNDS(pfont,leftSideBearing);
+ pfd->ascent = FONTMAXBOUNDS(pfont,ascent); /*FONTASCENT(pfont);*/
+ pfd->descent = FONTMAXBOUNDS(pfont,descent); /*FONTDESCENT(pfont);*/
+}
+
+static PclCharDataPtr
+fillCharDescData(PclCharDataPtr pcd, CharInfoPtr pci)
+{
+unsigned int byte_width;
+unsigned char *p;
+register int nbyGlyphWidth;
+unsigned char *pglyph, *pg;
+unsigned int i, j;
+
+ pcd->h_offset = pci->metrics.leftSideBearing;
+ pcd->v_offset = pci->metrics.ascent;
+ pcd->width = pci->metrics.rightSideBearing
+ - pci->metrics.leftSideBearing;
+ pcd->height = pci->metrics.ascent + pci->metrics.descent;
+ pcd->font_pitch = pci->metrics.characterWidth;
+
+ byte_width = (pcd->width + 7)/8;
+ pcd->raster_top = (unsigned char *)xalloc(byte_width * pcd->height);
+ if (pcd->raster_top == (unsigned char *)NULL)
+ return (PclCharDataPtr)NULL;
+
+ p = pcd->raster_top;
+ nbyGlyphWidth = GLYPHWIDTHBYTESPADDED(pci);
+ pglyph = FONTGLYPHBITS(pglyphBase, pci);
+ for (i=0; i<pcd->height; i++) {
+ pg = pglyph + nbyGlyphWidth * i;
+ for (j=0; j<byte_width; j++)
+ *p++ = *pg++;
+ }
+ return pcd;
+}
+
+static void
+output_text(FILE *outFile,
+ PclContextPrivPtr pConPriv,
+ unsigned char index)
+{
+ if ( index == ETX ) {
+ sprintf(t, "%c;DT%c,1;LB%c%c;DT%c,1;LB",
+ ETX, ETX_ALT, ETX, ETX_ALT, ETX);
+ SAVE_PCL( outFile, pConPriv, t );
+ } else {
+ sprintf(t, "%c", index);
+ SAVE_PCL_COUNT( outFile, pConPriv, t, 1 );
+ }
+}
+
+static char *
+getFontName(FontPtr pfont)
+{
+int i;
+FontInfoPtr pfi;
+FontPropPtr props;
+char *fontname;
+
+ pfi = (FontInfoRec *)&pfont->info;
+ props = pfi->props;
+ fontname = (char *) NULL;
+ for (i=0; i<pfi->nprops; i++, props++) {
+ if ( props->name == XA_FONT ) {
+ fontname = (char *)NameForAtom(props->value);
+ break;
+ }
+ }
+ return fontname;
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/* Internal Font Selection */
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+static char
+isInternal(FontPtr pfont)
+{
+int i;
+FontInfoPtr pfi;
+FontPropPtr props;
+Atom dest;
+
+ dest = MakeAtom("PRINTER_RESIDENT_FONT", strlen("PRINTER_RESIDENT_FONT"), TRUE);
+
+ pfi = (FontInfoRec *)&pfont->info;
+ props = pfi->props;
+ for (i=0; i<pfi->nprops; i++, props++) {
+ if ( (Atom) props->name == dest && props->value == 2 )
+ return INTERNAL_FONT;
+ }
+ return DOWNLOAD_FONT;
+}
+
+static void
+selectInternalFont(FILE *outFile, PclInternalFontPtr pin, int fid)
+{
+ fprintf(outFile, "%c*c%dD", ESC, fid);
+ if ( *pin->spacing == 'P' || *pin->spacing == 'p' )
+ fprintf(outFile, pin->pcl_font_name, pin->height);
+ else
+ fprintf(outFile, pin->pcl_font_name, pin->pitch);
+ fprintf(outFile, "%c*c6F", ESC);
+}
+
+static void
+selectSize(FILE *outFile,
+ PclContextPrivPtr pConPriv,
+ PclInternalFontPtr pin)
+{
+ if ( *pin->spacing == 'P' || *pin->spacing == 'p' ) {
+ sprintf(t, "SD4,%f;", pin->height);
+ SAVE_PCL( outFile, pConPriv, t );
+ } else {
+ sprintf(t, "SD3,%f;", pin->pitch);
+ SAVE_PCL( outFile, pConPriv, t );
+ }
+ return;
+}
+
+#ifdef DO_TWO_BYTE_PCL
+static void
+code_conv(
+ PclSoftFontInfoPtr pSoftFontInfo,
+ FontPtr pfont,
+ char *from,
+ char *to
+)
+{
+iconv_t cd;
+char frombuf[9], *fromptr;
+size_t inbyte = 5, outbyte=2;
+
+ fromptr = frombuf;
+ frombuf[0] = 0x1b; /* Esc */
+ frombuf[1] = 0x24; /* $ */
+ frombuf[2] = 0x42; /* B */
+ frombuf[3] = *from;
+ frombuf[4] = *(from+1);
+ frombuf[5] = 0x1b; /* Esc */
+ frombuf[6] = 0x28; /* ( */
+ frombuf[7] = 0x4a; /* J */
+ frombuf[8] = 0x0;
+ if ((cd = iconv_open("sjis", "jis")) == (iconv_t)(-1)) {
+ *to = (unsigned char)NULL;
+ return;
+ }
+
+ if ( iconv(cd, &fromptr, &inbyte, &to, &outbyte) == -1 )
+ *to = (unsigned char)NULL;
+
+ iconv_close(cd);
+ return;
+}
+#endif /* DO_TWO_BYTE_PCL */
diff --git a/xorg-server/hw/xprint/pcl/PclWindow.c b/xorg-server/hw/xprint/pcl/PclWindow.c
new file mode 100644
index 000000000..950933e49
--- /dev/null
+++ b/xorg-server/hw/xprint/pcl/PclWindow.c
@@ -0,0 +1,209 @@
+/*******************************************************************
+**
+** *********************************************************
+** *
+** * File: PclWindow.c
+** *
+** * Contents:
+** * Window code for Pcl driver.
+** *
+** * Created: 2/02/95
+** *
+** *********************************************************
+**
+********************************************************************/
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS 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 names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <stdio.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+
+#include "mistruct.h"
+#include "regionstr.h"
+#include "windowstr.h"
+#include "gcstruct.h"
+
+#include "Pcl.h"
+
+#if 0
+/*
+ * The following list of strings defines the properties which will be
+ * placed on the screen's root window if the property was defined in
+ * the start-up configuration resource database.
+ */
+static /* const */ char *propStrings[] = {
+ DT_PRINT_JOB_HEADER,
+ DT_PRINT_JOB_TRAILER,
+ DT_PRINT_JOB_COMMAND, /* old-obsolete */
+ DT_PRINT_JOB_EXEC_COMMAND,
+ DT_PRINT_JOB_EXEC_OPTIONS,
+ DT_PRINT_PAGE_HEADER,
+ DT_PRINT_PAGE_TRAILER,
+ DT_PRINT_PAGE_COMMAND,
+ (char *)NULL
+};
+#endif
+
+/*
+ * PclCreateWindow - watch for the creation of the root window.
+ * When it's created, register the screen with the print extension,
+ * and put the default command/header properties on it.
+ */
+/*ARGSUSED*/
+
+Bool
+PclCreateWindow(
+ register WindowPtr pWin)
+{
+ PclWindowPrivPtr pPriv;
+
+#if 0
+ Bool status = Success;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ PclScreenPrivPtr pScreenPriv = (PclScreenPrivPtr)
+ dixLookupPrivate(&pScreen->devPrivates, PclScreenPrivateKey);
+ PclWindowPrivPtr pWinPriv = (PclWindowPrivPtr)
+ dixLookupPrivate(&pWin->devPrivates, PclWindowPrivateKey);
+
+ /*
+ * Initialize this window's private struct.
+ */
+ pWinPriv->jobFileName = (char *)NULL;
+ pWinPriv->pJobFile = (FILE *)NULL;
+ pWinPriv->pageFileName = (char *)NULL;
+ pWinPriv->pPageFile = (FILE *)NULL;
+
+ if(pWin->parent == (WindowPtr)NULL) /* root window? */
+ {
+ Atom propName; /* type = XA_STRING */
+ char *propVal;
+ int i;
+ XrmDatabase rmdb = pScreenPriv->resDB;
+
+ /*
+ * Put the defaults spec'd in the config files in properties on this
+ * screen's root window.
+ */
+ for(i = 0; propStrings[i] != (char *)NULL; i++)
+ {
+ if((propVal = _DtPrintGetPrinterResource(pWin, rmdb,
+ propStrings[i])) !=
+ (char *)NULL)
+ {
+ propName = MakeAtom(propStrings[i], strlen(propStrings[i]),
+ TRUE);
+ dixChangeWindowProperty(serverClient, pWin, propName, XA_STRING,
+ 8, PropModeReplace, strlen(propVal),
+ (pointer)propVal, FALSE);
+ xfree(propVal);
+ }
+ }
+ }
+
+ return status;
+#endif
+
+ /*
+ * Invalidate the window's private print context.
+ */
+ pPriv = (PclWindowPrivPtr)
+ dixLookupPrivate(&pWin->devPrivates, PclWindowPrivateKey);
+ pPriv->validContext = 0;
+
+ return TRUE;
+}
+
+
+/*ARGSUSED*/
+Bool PclMapWindow(
+ WindowPtr pWindow)
+{
+ return TRUE;
+}
+
+/*ARGSUSED*/
+Bool
+PclPositionWindow(
+ register WindowPtr pWin,
+ int x,
+ int y)
+{
+ return TRUE;
+}
+
+/*ARGSUSED*/
+Bool
+PclUnmapWindow(
+ WindowPtr pWindow)
+{
+ return TRUE;
+}
+
+/*ARGSUSED*/
+void
+PclCopyWindow(
+ WindowPtr pWin,
+ DDXPointRec ptOldOrg,
+ RegionPtr prgnSrc)
+{
+}
+
+/*ARGSUSED*/
+Bool
+PclChangeWindowAttributes(
+ register WindowPtr pWin,
+ register unsigned long mask)
+{
+ if( pWin->backingStore != NotUseful )
+ {
+ pWin->backingStore = NotUseful;
+ mask |= CWBackingStore;
+ }
+
+ return TRUE;
+}
+
+/*ARGSUSED*/
+Bool
+PclDestroyWindow(
+ WindowPtr pWin)
+{
+ return TRUE;
+}
+
diff --git a/xorg-server/hw/xprint/pcl/Pclmap.h b/xorg-server/hw/xprint/pcl/Pclmap.h
new file mode 100644
index 000000000..18ac31d90
--- /dev/null
+++ b/xorg-server/hw/xprint/pcl/Pclmap.h
@@ -0,0 +1,210 @@
+/*
+(c) Copyright 1996 Hewlett-Packard Company
+(c) Copyright 1996 International Business Machines Corp.
+(c) Copyright 1996 Sun Microsystems, Inc.
+(c) Copyright 1996 Novell, Inc.
+(c) Copyright 1996 Digital Equipment Corp.
+(c) Copyright 1996 Fujitsu Limited
+(c) Copyright 1996 Hitachi, Ltd.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDERS 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 names of the copyright holders shall
+not be used in advertising or otherwise to promote the sale, use or other
+dealings in this Software without prior written authorization from said
+copyright holders.
+*/
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#ifndef _PCLMAP_H_
+#define _PCLMAP_H_
+
+#ifdef XP_PCL_COLOR
+#ifdef CATNAME
+#undef CATNAME
+#endif
+#if !defined(UNIXCPP) || defined(ANSICPP)
+#define PCLNAME(subname) PclCr##subname
+#define CATNAME(prefix,subname) prefix##Color##subname
+#else
+#define PCLNAME(subname) PclCr/**/subname
+#define CATNAME(prefix,subname) prefix/**/Color/**/subname
+#endif
+#endif /* XP_PCL_COLOR */
+
+#ifdef XP_PCL_MONO
+#ifdef CATNAME
+#undef CATNAME
+#endif
+#if !defined(UNIXCPP) || defined(ANSICPP)
+#define PCLNAME(subname) PclMn##subname
+#define CATNAME(prefix,subname) prefix##Mono##subname
+#else
+#define PCLNAME(subname) PclMn/**/subname
+#define CATNAME(prefix,subname) prefix/**/Mono/**/subname
+#endif
+#endif /* XP_PCL_MONO */
+
+#ifdef XP_PCL_LJ3
+#ifdef CATNAME
+#undef CATNAME
+#endif
+#if !defined(UNIXCPP) || defined(ANSICPP)
+#define PCLNAME(subname) PclLj3##subname
+#define CATNAME(prefix,subname) prefix##Lj3##subname
+#else
+#define PCLNAME(subname) PclLj3/**/subname
+#define CATNAME(prefix,subname) prefix/**/Lj3/**/subname
+#endif
+#endif /* XP_PCL_LJ3 */
+
+#ifdef PCLNAME
+
+/* PclInit.c */
+#define InitializePclDriver CATNAME(Initialize, PclDriver)
+#define PclCloseScreen PCLNAME(CloseScreen)
+#define PclGetContextFromWindow PCLNAME(GetContextFromWindow)
+#define PclScreenPrivateKey PCLNAME(ScreenPrivateKey)
+#define PclWindowPrivateKey PCLNAME(WindowPrivateKey)
+#define PclContextPrivateKey PCLNAME(ContextPrivateKey)
+#define PclPixmapPrivateKey PCLNAME(PixmapPrivateKey)
+#define PclGCPrivateKey PCLNAME(GCPrivateKey)
+
+/* PclPrint.c */
+#define PclStartJob PCLNAME(StartJob)
+#define PclEndJob PCLNAME(EndJob)
+#define PclStartPage PCLNAME(StartPage)
+#define PclEndPage PCLNAME(EndPage)
+#define PclStartDoc PCLNAME(StartDoc)
+#define PclEndDoc PCLNAME(EndDoc)
+#define PclDocumentData PCLNAME(DocumentData)
+#define PclGetDocumentData PCLNAME(GetDocumentData)
+
+/* PclWindow.c */
+#define PclCreateWindow PCLNAME(CreateWindow)
+#define PclMapWindow PCLNAME(MapWindow)
+#define PclPositionWindow PCLNAME(PositionWindow)
+#define PclUnmapWindow PCLNAME(UnmapWindow)
+#define PclCopyWindow PCLNAME(CopyWindow)
+#define PclChangeWindowAttributes PCLNAME(ChangeWindowAttributes)
+#define PclDestroyWindow PCLNAME(DestroyWindow)
+
+/* PclGC.c */
+#define PclCreateGC PCLNAME(CreateGC)
+#define PclDestroyGC PCLNAME(DestroyGC)
+#define PclGetDrawablePrivateStuff PCLNAME(GetDrawablePrivateStuff)
+#define PclSetDrawablePrivateGC PCLNAME(SetDrawablePrivateGC)
+#define PclSendPattern PCLNAME(SendPattern)
+#define PclUpdateDrawableGC PCLNAME(UpdateDrawableGC)
+#define PclComputeCompositeClip PCLNAME(ComputeCompositeClip)
+#define PclValidateGC PCLNAME(ValidateGC)
+
+/* PclAttr.c */
+#define PclGetAttributes PCLNAME(GetAttributes)
+#define PclGetOneAttribute PCLNAME(GetOneAttribute)
+#define PclAugmentAttributes PCLNAME(AugmentAttributes)
+#define PclSetAttributes PCLNAME(SetAttributes)
+
+/* PclColor.c */
+#define PclLookUp PCLNAME(LookUp)
+#define PclCreateDefColormap PCLNAME(CreateDefColormap)
+#define PclCreateColormap PCLNAME(CreateColormap)
+#define PclDestroyColormap PCLNAME(DestroyColormap)
+#define PclInstallColormap PCLNAME(InstallColormap)
+#define PclUninstallColormap PCLNAME(UninstallColormap)
+#define PclListInstalledColormaps PCLNAME(ListInstalledColormaps)
+#define PclStoreColors PCLNAME(StoreColors)
+#define PclResolveColor PCLNAME(ResolveColor)
+#define PclFindPaletteMap PCLNAME(FindPaletteMap)
+#define PclUpdateColormap PCLNAME(UpdateColormap)
+#define PclReadMap PCLNAME(ReadMap)
+
+/* PclPixmap.c */
+#define PclCreatePixmap PCLNAME(CreatePixmap)
+#define PclDestroyPixmap PCLNAME(DestroyPixmap)
+
+/* PclArc.c */
+#define PclDoArc PCLNAME(DoArc)
+#define PclPolyArc PCLNAME(PolyArc)
+#define PclPolyFillArc PCLNAME(PolyFillArc)
+
+/* PclArea.c */
+#define PclPutImage PCLNAME(PutImage)
+#define PclCopyArea PCLNAME(CopyArea)
+#define PclCopyPlane PCLNAME(CopyPlane)
+
+/* PclLine */
+#define PclPolyLine PCLNAME(PolyLine)
+#define PclPolySegment PCLNAME(PolySegment)
+
+/* PclPixel.c */
+#define PclPolyPoint PCLNAME(PolyPoint)
+#define PclPushPixels PCLNAME(PushPixels)
+
+/* PclPolygon.c */
+#define PclPolyRectangle PCLNAME(PolyRectangle)
+#define PclFillPolygon PCLNAME(FillPolygon)
+#define PclPolyFillRect PCLNAME(PolyFillRect)
+
+/* PclSpans.c */
+#define PclFillSpans PCLNAME(FillSpans)
+#define PclSetSpans PCLNAME(SetSpans)
+
+/* PclText.c */
+#define PclPolyText8 PCLNAME(PolyText8)
+#define PclPolyText16 PCLNAME(PolyText16)
+#define PclImageText8 PCLNAME(ImageText8)
+#define PclImageText16 PCLNAME(ImageText16)
+#define PclImageGlyphBlt PCLNAME(ImageGlyphBlt)
+#define PclPolyGlyphBlt PCLNAME(PolyGlyphBlt)
+#define PclPolyGlyphBlt PCLNAME(PolyGlyphBlt)
+
+/* PclFonts.c */
+#define PclRealizeFont PCLNAME(RealizeFont)
+#define PclUnrealizeFont PCLNAME(UnrealizeFont)
+
+/* PclSFonts.c */
+#define PclDownloadSoftFont8 PCLNAME(DownloadSoftFont8)
+#define PclDownloadSoftFont16 PCLNAME(DownloadSoftFont16)
+#define PclCreateSoftFontInfo PCLNAME(CreateSoftFontInfo)
+#define PclDestroySoftFontInfo PCLNAME(DestroySoftFontInfo)
+
+/* PclMisc.c */
+#define PclQueryBestSize PCLNAME(QueryBestSize)
+#define GetPropString PCLNAME(GetPropString)
+#define SystemCmd PCLNAME(SystemCmd)
+#define PclGetMediumDimensions PCLNAME(GetMediumDimensions)
+#define PclGetReproducibleArea PCLNAME(GetReproducibleArea)
+#define PclSpoolFigs PCLNAME(SpoolFigs)
+#define PclSendData PCLNAME(SendData)
+
+/* PclCursor.c */
+#define PclConstrainCursor PCLNAME(ConstrainCursor)
+#define PclCursorLimits PCLNAME(CursorLimits)
+#define PclDisplayCursor PCLNAME(DisplayCursor)
+#define PclRealizeCursor PCLNAME(RealizeCursor)
+#define PclUnrealizeCursor PCLNAME(UnrealizeCursor)
+#define PclRecolorCursor PCLNAME(RecolorCursor)
+#define PclSetCursorPosition PCLNAME(SetCursorPosition)
+
+#endif
+
+#endif /* _PCLMAP_H_ */