[comp.sys.ibm.pc.rt] IBM 8514 source code

mlewis@dolphin.tcspa.ibm.com (Mark S. Lewis) (03/13/90)

Subject: IBM 8514 source code (part 1 of 6) for X11 Release 4
Index: ../mit/server/ddx/ibm/ibm8514

Description:	
IBM has decided to provide X11 source code for the 8514 display
adapter.  This is the same code used to build the object files
included in the X11 Release 4 distribution.  This code supports
servers for both AIX and IBM/4.3 on their respective platforms.

	V1.32_kit.1	59,103 Bytes
	V1.32_kit.2	61,796 Bytes
	V1.32_kit.3	60,982 Bytes
	V1.32_kit.4	62,729 Bytes
	V1.32_kit.5	54,871 Bytes
	V1.32_kit.6	29,170 Bytes

Installation:	
This code is provided in a 6-part shell archive.  Before you
install it, you should save your current code.  You should save
the Imakefile in the ibm server directory.  You also should save
the entire ibm8514 directory by moving and remaking it.

	cd ../mit/server/ddx/ibm
	cp Imakefile Imakefile.orig
	mv ibm8514 ibm8514.orig
	mkdir ibm8514
	
Next, edit this header from each part, and feed the rest to
/bin/sh.  Proceed to make the server as instructed in the
X11 release notes.

	sh < V1.32_kit.1

=====-----     Mark S. Lewis, IBM AWD Palo Alto    -----======
inet: mlewis%ibmsupt@uunet.uu.net		(415) 855-4486
uucp: uunet!ibmsupt!mlewis              IBM Tie Line: 465-4486

# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
#
#	Imakefile
#	ibm8514/Imakefile
#	ibm8514/Makefile
#	ibm8514/blkout.s
#	ibm8514/brcBlit.c
#	ibm8514/brcCmap.c
#
echo x - Imakefile
sed 's/^X//' >Imakefile << 'END-of-Imakefile'
X#include <Server.tmpl>
X
X/* "@(#)Imakefile	3.1 88/09/22 09:29:19" */
X#define IHaveSubdirs
X#undef PassCDebugFlags
X#define PassCDebugFlags 'CDEBUGFLAGS=$(CDEBUGFLAGS)' 'CC=$(CC)'
'HCVERSION=$(HCVERSION)'
X
X#define	ListCreate(name)\
XSUBDIRS0= name @@\
XSUBOBJS0= name/name.o @@\
XDSUBOBJS0= name/name/**/_d.o @@\
XPSUBOBJS0= name/name/**/_p.o
X#define	ListCreateEmpty()\
XSUBDIRS0=  @@\
XSUBOBJS0=  @@\
XDSUBOBJS0=  @@\
XPSUBOBJS0= 
X#define	ListAdd(last,new,name)\
XSUBDIRS/**/new= $(SUBDIRS/**/last) name @@\
XSUBOBJS/**/new= $(SUBOBJS/**/last) name/name.o @@\
XDSUBOBJS/**/new= $(DSUBOBJS/**/last) name/name/**/_d.o @@\
XPSUBOBJS/**/new= $(PSUBOBJS/**/last) name/name/**/_p.o
X#define	ListAddEmpty(last,new)\
XSUBDIRS/**/new= $(SUBDIRS/**/last) @@\
XSUBOBJS/**/new= $(SUBOBJS/**/last) @@\
XDSUBOBJS/**/new= $(DSUBOBJS/**/last) @@\
XPSUBOBJS/**/new= $(PSUBOBJS/**/last)
X
X#if	ibmInclude8514
X#ifdef	AIXArchitecture
XListCreate(ibm8514)
X#else	/* !AIXArchitecture */
XSUBDIRS0 = ibm8514
XSUBOBJS0 = ibm8514/ibm8514.o
X#endif	/* !AIXArchitecture */
X#else	/* !ibmInclude8514 */
XListCreateEmpty()
X#endif	/* !ibmInclude8514 */
X
X#if ibmIncludeAED
XListAdd(0,1,aed)
X#else
XListAddEmpty(0,1)
X#endif
X#if ibmIncludeAPA8c
XListAdd(1,2,apa8c)
X#else
XListAddEmpty(1,2)
X#endif
X#if ibmIncludeAPA16
XListAdd(2,3,apa16)
X#else
XListAddEmpty(2,3)
X#endif
X#if ibmIncludeEGA
XListAdd(3,4,ega)
X#else
XListAddEmpty(3,4)
X#endif
X#if ibmIncludeMPEL
XListAdd(4,5,mpel)
X#else
XListAddEmpty(4,5)
X#endif
X#if ibmIncludeVGA
XListAdd(5,6,vga)
X#else
XListAddEmpty(5,6)
X#endif
X
XSUBDIRS= $(SUBDIRS6) common OPERATING_SYSTEM ppc
X/* common/ibmcomm.o is the seed for the link -- Don't put it below */
XSUBOBJS= $(SUBOBJS6) OPERATING_SYSTEM/OPERATING_SYSTEM.o ppc/ppc.o
XDSUBOBJS= $(DSUBOBJS6) OPERATING_SYSTEM/OPERATING_SYSTEM/**/_d.o
XPSUBOBJS= $(PSUBOBJS6) OPERATING_SYSTEM/OPERATING_SYSTEM/**/_p.o
X
Xall::	subdirs
X
Xlibibm.a: $(ICONFIGFILES)
X
XNormalLibraryTarget(ibm,$(SUBOBJS))
X#if ProfileServer
XNormalLibraryTarget(ibm_p,$(PSUBOBJS))
X#endif
X#if DebugServer
XNormalLibraryTarget(ibm_d,$(DSUBOBJS))
X#endif
X	
XNamedMakeSubdirs(subdirs,$(SUBDIRS))
X	
X#
X# before doing the depend, be sure that makedepend exists.
X#
Xdepend:: $(DEPEND)
X
XDependSubdirs($(SUBDIRS))
X
X#
X# we should be always using ANY tool available ( even lint ) !
X#
XMakeLintLibSubdirs($(SUBDIRS))
XLintSubdirs($(SUBDIRS))
X
X#
X# before making the makefiles, be sure that imake exists.
X#
XMakefiles:: $(IMAKE)
X
X	@echo "making $(IMAKESRC)"; \
X	cd $(IMAKESRC); $(MAKE)
X
X
END-of-Imakefile
echo x - ibm8514/Imakefile
sed 's/^X//' >ibm8514/Imakefile << 'END-of-ibm8514/Imakefile'
X#
X# Copyright IBM Corporation 1987,1990
X#
X# All Rights Reserved
X#
X# Permission to use, copy, modify, and distribute this software and its
X# documentation for any purpose and without fee is hereby granted,
X# provided that the above copyright notice appear in all copies and that
X# both that copyright notice and this permission notice appear in
X# supporting documentation, and that the name of IBM not be
X# used in advertising or publicity pertaining to distribution of the
X# software without specific, written prior permission.
X#
X# IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
X# ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
X# IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
X# ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
X# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
X# ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
X# SOFTWARE.
X#
X# PRPQ 5799-PFF (C) COPYRIGHT IBM CORPORATION 1987,1990
X# LICENSED MATERIALS - PROPERTY OF IBM
X# REFER TO COPYRIGHT INSTRUCTIONS FORM NUMBER G120-2083
X#
X# $Header:
/andrew/X11/r3src/release/server/ddx/ibm/ibm8514/RCS/Imakefile,v 9.3
89/02/13 22:47:06 paul Exp $ 
X# $Source: /andrew/X11/r3src/release/server/ddx/ibm/ibm8514/RCS/Imakefile,v $ 
XSRCS =	 	brcBlit.c	\
X		brcCmap.c	\
X		brcCurs.c	\
X		brcFillSp.c	\
X		brcGC.c		\
X		brcGetSp.c	\
X		brcImg.c	\
X		brcMono.c	\
X		brcSuspScr.c	\
X		brcIO.c		\
X		brcUtils.c	\
X		brcGBlt.c	\
X		brcLine.c	\
X		brcStip.c	\
X		brcFont.c	\
X		brcText.c	\
X		brcPoly.c	\
X		brcPgon.c	\
X		brcOutL.c	\
X		brcRect.c	\
X		brcTile.c	\
X		brcPushPxl.c	\
X		brcOSD.c	\
X		brcScrInfo.c	\
X		brcData.c
X
X#ifdef PS2Architecture
XASRCS =		blkout.s
X#endif
X
XCOBJS = 	brcBlit.o	\
X		brcCmap.o	\
X		brcCurs.o	\
X		brcFillSp.o	\
X		brcGC.o		\
X		brcGetSp.o	\
X		brcImg.o	\
X		brcMono.o	\
X		brcSuspScr.o	\
X		brcIO.o		\
X		brcUtils.o	\
X		brcGBlt.o	\
X		brcLine.o	\
X		brcStip.o	\
X		brcFont.o	\
X		brcText.o	\
X		brcPoly.o	\
X		brcPgon.o	\
X		brcOutL.o	\
X		brcRect.o	\
X		brcTile.o	\
X		brcPushPxl.o	\
X		brcOSD.o	\
X		brcScrInfo.o	\
X		brcData.o
X
X#if defined(PS2Architecture)
XASMOBJS =	blkout.o
X#else
XASMOBJS =
X#endif
X
XOBJS =		$(COBJS) $(ASMOBJS)
X
X#ifdef PS2Architecture
XSTD_DEFINES = ServerDefines OSDefines -DPCIO
X#else
XSTD_DEFINES = ServerDefines OSDefines -DATRIO
X#endif
X
XCDEBUGFLAGS = ServerCDebugFlags 
XSERVER = $(TOP)/server
XDDX = $(SERVER)/ddx
XDDXIBM = $(DDX)/ibm
XINCLUDES = -I. -I$(DDXIBM)/OPERATING_SYSTEM -I$(DDX)/mfb -I$(DDX)/mi
-I$(DDXIBM)/ppc -I$(SERVER)/include -I$(INCLUDESRC) -I$(DDXIBM)/common
X
XLINTLIBS =	$(DDX)/mfb/llib-lmfb.ln $(DDX)/mi/llib-lmi.ln \
X	$(DDXIBM)/ppc/llib-lppc.ln $(DDXIBM)/common/llib-libmcomm.ln 
X
XNormalRelocatableTarget(ibm8514,$(OBJS))
X
X#if DebugServer
XDebuggedRelocatableTarget(ibm8514,$(OBJS))
X#endif
X#if ProfileServer
XProfiledRelocatableTarget(ibm8514,$(OBJS))
X#endif
X
X#ifdef LCGBUILD
X	COMPILE_LIST = $(OBJS)
X	BUILD_LIST = ibm8514.o
X#endif
X
X#if DebugServer && ProfileServer
XDebuggedAndProfiledLibraryObjectRule()
X	$(RM) -f m.s $@ debugger/$@ profiled/$@
X	$(CPP) $(CFLAGS) $*.s > m.s
X	$(AS) -o $@ m.s
X	$(CP) $@ debugger/$@
X	$(CP) $@ profiled/$@
X	$(RM) -f m.s
X#else
X# if DebugServer
XDebuggedLibraryObjectRule()
X	$(RM) -f m.s $@ debugger/$@
X	$(CPP) $(CFLAGS) $*.s > m.s
X	$(AS) -o $@ m.s
X	$(CP) $@ debugger/$@
X	$(RM) -f m.s
X# else
X#  if ProfileServer
XProfiledLibraryObjectRule()
X	$(RM) -f m.s $@ profiled/$@
X	$(CPP) $(CFLAGS) $*.s > m.s
X	$(AS) -o $@ m.s
X	$(CP) $@ profiled/$@
X	$(RM) -f m.s
X#  else
XNormalLibraryObjectRule()
X	$(RM) -f m.s $@
X	$(CPP) -E $(CFLAGS) $*.s > m.s
X	$(AS) -o $@ m.s
X	$(RM) -f m.s
X#  endif
X# endif
X#endif
X
XDependTarget()
X
X#ifndef LCGBUILD
XLintLibraryTarget(ibm8514,$(SRCS))
XNormalLintTarget($(SRCS))
X#endif
END-of-ibm8514/Imakefile
echo x - ibm8514/Makefile
sed 's/^X//' >ibm8514/Makefile << 'END-of-ibm8514/Makefile'
X# Makefile generated by imake - do not edit!
X# $XConsortium: imake.c,v 1.51 89/12/12 12:37:30 jim Exp $
X
X###########################################################################
X# Makefile generated from "Imake.tmpl" and </tmp/IIf.005918>
X# $XConsortium: Imake.tmpl,v 1.77 89/12/18 17:01:37 jim Exp $
X#
X# Platform-specific parameters may be set in the appropriate .cf
X# configuration files.  Site-wide parameters may be set in the file
X# site.def.  Full rebuilds are recommended if any parameters are changed.
X#
X# If your C preprocessor doesn't define any unique symbols, you'll need
X# to set BOOTSTRAPCFLAGS when rebuilding imake (usually when doing
X# "make Makefile", "make Makefiles", or "make World").
X#
X# If you absolutely can't get imake to work, you'll need to set the
X# variables at the top of each Makefile as well as the dependencies at the
X# bottom (makedepend will do this automatically).
X#
X
X###########################################################################
X# platform-specific configuration parameters - edit ibm.cf to change
X
X            PCC = pcc
X
X# platform:  $XConsortium: ibm.cf,v 1.15 89/12/13 15:27:50 keith Exp $
X# operating system:  AOS
X
X###########################################################################
X# site-specific configuration parameters - edit site.def to change
X
X# site:  $XConsortium: site.def,v 1.21 89/12/06 11:46:50 jim Exp $
X
X            SHELL = 	/bin/sh
X
X              TOP = ../../../../.
X      CURRENT_DIR = ./server/ddx/ibm/ibm8514
X
X               AR = ar cq
X  BOOTSTRAPCFLAGS = -Dibm
X               CC = hc
X
X         COMPRESS = compress
X              CPP = /lib/cpp $(STD_CPP_DEFINES)
X    PREPROCESSCMD = hc -E $(STD_CPP_DEFINES)
X          INSTALL = install
X               LD = ld
X             LINT = lint
X      LINTLIBFLAG = -C
X         LINTOPTS = -ax -Dibm -DHCVERSION=21025
X               LN = ln -s
X             MAKE = make
X               MV = mv
X               CP = cp
X           RANLIB = ranlib
X  RANLIBINSTFLAGS =
X               RM = rm -f
X     STD_INCLUDES =
X  STD_CPP_DEFINES =
X      STD_DEFINES = -Dibm -DHCVERSION=21025
X EXTRA_LOAD_FLAGS =
X  EXTRA_LIBRARIES =
X             TAGS = ctags
X
X   SIGNAL_DEFINES = -DSIGNALRETURNSINT
X
X    PROTO_DEFINES =
X
X     INSTPGMFLAGS =
X
X     INSTBINFLAGS = -m 0755
X     INSTUIDFLAGS = -m 4755
X     INSTLIBFLAGS = -m 0664
X     INSTINCFLAGS = -m 0444
X     INSTMANFLAGS = -m 0444
X     INSTDATFLAGS = -m 0444
X    INSTKMEMFLAGS = -m 4755
X
X          DESTDIR =
X
X     TOP_INCLUDES = -I$(TOP)
X
X      CDEBUGFLAGS = -O
X        CCOPTIONS =
X      COMPATFLAGS =
X
X      ALLINCLUDES = $(STD_INCLUDES) $(TOP_INCLUDES) $(INCLUDES)
$(EXTRA_INCLUDES)
X       ALLDEFINES = $(ALLINCLUDES) $(STD_DEFINES) $(PROTO_DEFINES)
$(DEFINES) $(COMPATFLAGS)
X           CFLAGS = $(CDEBUGFLAGS) $(CCOPTIONS) $(ALLDEFINES)
X        LINTFLAGS = $(LINTOPTS) -DLINT $(ALLDEFINES)
X           LDLIBS = $(SYS_LIBRARIES) $(EXTRA_LIBRARIES)
X        LDOPTIONS = $(CDEBUGFLAGS) $(CCOPTIONS)
X   LDCOMBINEFLAGS = -X -r
X
X        MACROFILE = ibm.cf
X           RM_CMD = $(RM) *.CKP *.ln *.BAK *.bak *.o core errs ,* *~
*.a .emacs_* tags TAGS make.log MakeOut
X
X    IMAKE_DEFINES =
X
X         IRULESRC = $(CONFIGSRC)
X        IMAKE_CMD = $(NEWTOP)$(IMAKE) -I$(NEWTOP)$(IRULESRC) $(IMAKE_DEFINES)
X
X     ICONFIGFILES = $(IRULESRC)/Imake.tmpl $(IRULESRC)/Imake.rules \
X			$(IRULESRC)/Project.tmpl $(IRULESRC)/site.def \
X			$(IRULESRC)/$(MACROFILE) $(EXTRA_ICONFIGFILES)
X
X###########################################################################
X# X Window System Build Parameters
X# $XConsortium: Project.tmpl,v 1.63 89/12/18 16:46:44 jim Exp $
X
X###########################################################################
X# X Window System make variables; this need to be coordinated with rules
X# $XConsortium: Project.tmpl,v 1.63 89/12/18 16:46:44 jim Exp $
X
X          PATHSEP = /
X        USRLIBDIR = $(DESTDIR)/usr/lib
X           BINDIR = $(DESTDIR)/usr/bin/X11
X          INCROOT = $(DESTDIR)/usr/include
X     BUILDINCROOT = $(TOP)
X      BUILDINCDIR = $(BUILDINCROOT)/X11
X      BUILDINCTOP = ..
X           INCDIR = $(INCROOT)/X11
X           ADMDIR = $(DESTDIR)/usr/adm
X           LIBDIR = $(USRLIBDIR)/X11
X        CONFIGDIR = $(LIBDIR)/config
X       LINTLIBDIR = $(USRLIBDIR)/lint
X
X          FONTDIR = $(LIBDIR)/fonts
X         XINITDIR = $(LIBDIR)/xinit
X           XDMDIR = $(LIBDIR)/xdm
X           AWMDIR = $(LIBDIR)/awm
X           TWMDIR = $(LIBDIR)/twm
X           GWMDIR = $(LIBDIR)/gwm
X          MANPATH = $(DESTDIR)/usr/man
X    MANSOURCEPATH = $(MANPATH)/man
X           MANDIR = $(MANSOURCEPATH)n
X        LIBMANDIR = $(MANSOURCEPATH)3
X      XAPPLOADDIR = $(LIBDIR)/app-defaults
X
X       FONTCFLAGS = -t
X
X     INSTAPPFLAGS = $(INSTDATFLAGS)
X
X            IMAKE = $(IMAKESRC)/imake
X           DEPEND = $(DEPENDSRC)/makedepend
X              RGB = $(RGBSRC)/rgb
X            FONTC = $(BDFTOSNFSRC)/bdftosnf
X        MKFONTDIR = $(MKFONTDIRSRC)/mkfontdir
X        MKDIRHIER = 	/bin/sh $(SCRIPTSRC)/mkdirhier.sh
X
X        CONFIGSRC = $(TOP)/config
X        CLIENTSRC = $(TOP)/clients
X          DEMOSRC = $(TOP)/demos
X           LIBSRC = $(TOP)/lib
X          FONTSRC = $(TOP)/fonts
X       INCLUDESRC = $(TOP)/X11
X        SERVERSRC = $(TOP)/server
X          UTILSRC = $(TOP)/util
X        SCRIPTSRC = $(UTILSRC)/scripts
X       EXAMPLESRC = $(TOP)/examples
X       CONTRIBSRC = $(TOP)/../contrib
X           DOCSRC = $(TOP)/doc
X           RGBSRC = $(TOP)/rgb
X        DEPENDSRC = $(UTILSRC)/makedepend
X         IMAKESRC = $(CONFIGSRC)
X         XAUTHSRC = $(LIBSRC)/Xau
X          XLIBSRC = $(LIBSRC)/X
X           XMUSRC = $(LIBSRC)/Xmu
X       TOOLKITSRC = $(LIBSRC)/Xt
X       AWIDGETSRC = $(LIBSRC)/Xaw
X       OLDXLIBSRC = $(LIBSRC)/oldX
X      XDMCPLIBSRC = $(LIBSRC)/Xdmcp
X      BDFTOSNFSRC = $(FONTSRC)/bdftosnf
X     MKFONTDIRSRC = $(FONTSRC)/mkfontdir
X     EXTENSIONSRC = $(TOP)/extensions
X
X  DEPEXTENSIONLIB =  $(EXTENSIONSRC)/lib/libXext.a
X     EXTENSIONLIB = 			   $(DEPEXTENSIONLIB)
X
X          DEPXLIB = $(DEPEXTENSIONLIB)  $(XLIBSRC)/libX11.a
X             XLIB = $(EXTENSIONLIB) 			  $(XLIBSRC)/libX11.a
X
X      DEPXAUTHLIB =  $(XAUTHSRC)/libXau.a
X         XAUTHLIB = 			  $(DEPXAUTHLIB)
X
X        DEPXMULIB =  $(XMUSRC)/libXmu.a
X           XMULIB = 			  $(DEPXMULIB)
X
X       DEPOLDXLIB =  $(OLDXLIBSRC)/liboldX.a
X          OLDXLIB = 			  $(DEPOLDXLIB)
X
X      DEPXTOOLLIB =  $(TOOLKITSRC)/libXt.a
X         XTOOLLIB = 			  $(DEPXTOOLLIB)
X
X        DEPXAWLIB =  $(AWIDGETSRC)/libXaw.a
X           XAWLIB = 			  $(DEPXAWLIB)
X
X LINTEXTENSIONLIB =  $(EXTENSIONSRC)/lib/llib-lXext.ln
X         LINTXLIB =  $(XLIBSRC)/llib-lX11.ln
X          LINTXMU =  $(XMUSRC)/llib-lXmu.ln
X        LINTXTOOL =  $(TOOLKITSRC)/llib-lXt.ln
X          LINTXAW =  $(AWIDGETSRC)/llib-lXaw.ln
X
X          DEPLIBS = $(LOCAL_LIBRARIES)
X
X         DEPLIBS1 = $(DEPLIBS)
X         DEPLIBS2 = $(DEPLIBS)
X         DEPLIBS3 = $(DEPLIBS)
X
X###########################################################################
X# Imake rules for building libraries, programs, scripts, and data files
X# rules:  $XConsortium: Imake.rules,v 1.67 89/12/18 17:14:15 jim Exp $
X
X###########################################################################
X# start of Imakefile
X
X#
X# Copyright IBM Corporation 1987,1990
X#
X# All Rights Reserved
X#
X# Permission to use, copy, modify, and distribute this software and its
X# documentation for any purpose and without fee is hereby granted,
X# provided that the above copyright notice appear in all copies and that
X# both that copyright notice and this permission notice appear in
X# supporting documentation, and that the name of IBM not be
X# used in advertising or publicity pertaining to distribution of the
X# software without specific, written prior permission.
X#
X# IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
X# ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN 0 EVENT SHALL
X# IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
X# ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
X# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
X# ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
X# SOFTWARE.
X#
X# PRPQ 5799-PFF (C) COPYRIGHT IBM CORPORATION 1987,1990
X# LICENSED MATERIALS - PROPERTY OF IBM
X# REFER TO COPYRIGHT INSTRUCTIONS FORM NUMBER G120-2083
X#
X# $Header:
/andrew/X11/r3src/release/server/ddx/ibm/ibm8514/RCS/Imakefile,v 9.3
89/02/13 22:47:06 paul Exp $
X# $Source: /andrew/X11/r3src/release/server/ddx/ibm/ibm8514/RCS/Imakefile,v $
XSRCS =	 	brcBlit.c	\
X		brcCmap.c	\
X		brcCurs.c	\
X		brcFillSp.c	\
X		brcGC.c		\
X		brcGetSp.c	\
X		brcImg.c	\
X		brcMono.c	\
X		brcSuspScr.c	\
X		brcIO.c		\
X		brcUtils.c	\
X		brcGBlt.c	\
X		brcLine.c	\
X		brcStip.c	\
X		brcFont.c	\
X		brcText.c	\
X		brcPoly.c	\
X		brcPgon.c	\
X		brcOutL.c	\
X		brcRect.c	\
X		brcTile.c	\
X		brcPushPxl.c	\
X		brcOSD.c	\
X		brcScrInfo.c	\
X		brcData.c
X
XCOBJS = 	brcBlit.o	\
X		brcCmap.o	\
X		brcCurs.o	\
X		brcFillSp.o	\
X		brcGC.o		\
X		brcGetSp.o	\
X		brcImg.o	\
X		brcMono.o	\
X		brcSuspScr.o	\
X		brcIO.o		\
X		brcUtils.o	\
X		brcGBlt.o	\
X		brcLine.o	\
X		brcStip.o	\
X		brcFont.o	\
X		brcText.o	\
X		brcPoly.o	\
X		brcPgon.o	\
X		brcOutL.o	\
X		brcRect.o	\
X		brcTile.o	\
X		brcPushPxl.o	\
X		brcOSD.o	\
X		brcScrInfo.o	\
X		brcData.o
X
XASMOBJS =
X
XOBJS =		$(COBJS) $(ASMOBJS)
X
XSTD_DEFINES =  -Dibm -DHCVERSION=21025  -DUNIXCPP -DNOSTDHDRS -DBSDrt
-DSHAPE -DMULTIBUFFER -DMITMISC -DBSDrt -DATRIO
X
XCDEBUGFLAGS = -O
XSERVER = $(TOP)/server
XDDX = $(SERVER)/ddx
XDDXIBM = $(DDX)/ibm
XINCLUDES = -I. -I$(DDXIBM)/BSDrt -I$(DDX)/mfb -I$(DDX)/mi
-I$(DDXIBM)/ppc -I$(SERVER)/include -I$(INCLUDESRC) -I$(DDXIBM)/common
X
XLINTLIBS =	$(DDX)/mfb/llib-lmfb.ln $(DDX)/mi/llib-lmi.ln \
X	$(DDXIBM)/ppc/llib-lppc.ln $(DDXIBM)/common/llib-libmcomm.ln
X
Xall:: ibm8514.o
X
Xibm8514.o: $(OBJS)
X	$(RM) $@
X	$(LD) $(LDCOMBINEFLAGS) $(OBJS) -o $@
X
X	$(RM) $@
X	$(CC) -c $(CFLAGS) $*.c
X	$(RM) -f m.s $@
X	$(CPP) -E $(CFLAGS) $*.s > m.s
X	$(AS) -o $@ m.s
X	$(RM) -f m.s
X
Xdepend:: $(DEPEND)
X
X	@echo "checking $@ over in $(DEPENDSRC) first..."; \
X	cd $(DEPENDSRC); $(MAKE); \
X	echo "okay, continuing in $(CURRENT_DIR)"
X
Xdepend::
X	$(DEPEND) -s "# DO NOT DELETE" -- $(ALLDEFINES) -- $(SRCS)
X
Xlintlib:: llib-libm8514.ln
X
Xllib-libm8514.ln: $(SRCS)
X	$(RM) $@
X	$(LINT) $(LINTLIBFLAG)ibm8514 $(LINTFLAGS) $(SRCS)
X
X	$(LINT) $(LINTFLAGS) $(SRCS) $(LINTLIBS)
X	$(LINT) $(LINTFLAGS) $(FILE) $(LINTLIBS)
X
X###########################################################################
X# common rules for all Makefiles - do not edit
X
Xemptyrule::
X
Xclean::
X	$(RM_CMD) \#*
X
XMakefile:: $(IMAKE)
X
X	@(cd $(IMAKESRC); if [ -f Makefile ]; then \
X	echo "checking $@ in $(IMAKESRC) first..."; $(MAKE) all; else \
X	echo "bootstrapping $@ from Makefile.ini in $(IMAKESRC) first..."; \
X	$(MAKE) -f Makefile.ini BOOTSTRAPCFLAGS=$(BOOTSTRAPCFLAGS); fi; \
X	echo "okay, continuing in $(CURRENT_DIR)")
X
XMakefile::
X	-@if [ -f Makefile ]; then \
X		echo "	$(RM) Makefile.bak; $(MV) Makefile Makefile.bak"; \
X		$(RM) Makefile.bak; $(MV) Makefile Makefile.bak; \
X	else exit 0; fi
X	$(IMAKE_CMD) -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT_DIR)
X
Xtags::
X	$(TAGS) -w *.[ch]
X	$(TAGS) -xw *.[ch] > TAGS
X
X###########################################################################
X# empty rules for directories that do not have SUBDIRS - do not edit
X
Xinstall::
X	@echo "install in $(CURRENT_DIR) done"
X
Xinstall.man::
X	@echo "install.man in $(CURRENT_DIR) done"
X
XMakefiles::
X
Xincludes::
X
X###########################################################################
X# dependencies generated by makedepend
X
X# DO NOT DELETE
X
XbrcBlit.o: x8514.h ../../../.././server/ddx/ibm/common/ibmIOArch.h
XbrcBlit.o: ibm8514reg.h ../../../.././server/ddx/ibm/common/ibmTrace.h
XbrcCmap.o: ../../../.././X11/X.h ../../../.././server/include/screenint.h
XbrcCmap.o: ../../../.././server/include/scrnintstr.h
XbrcCmap.o: ../../../.././server/include/miscstruct.h
XbrcCmap.o: ../../../.././server/include/misc.h
XbrcCmap.o: ../../../.././server/include/os.h
XbrcCmap.o: ../../../.././server/include/region.h
XbrcCmap.o: ../../../.././server/include/pixmap.h
XbrcCmap.o: ../../../.././server/include/gc.h
XbrcCmap.o: ../../../.././server/include/colormap.h
XbrcCmap.o: ../../../.././server/ddx/ibm/BSDrt/OScompiler.h x8514.h
XbrcCmap.o: ../../../.././server/ddx/ibm/common/ibmIOArch.h ibm8514reg.h
XbrcCmap.o: ../../../.././server/ddx/ibm/common/ibmTrace.h
XbrcCurs.o: ../../../.././X11/X.h ../../../.././X11/Xmd.h
XbrcCurs.o: ../../../.././server/include/miscstruct.h
XbrcCurs.o: ../../../.././server/include/misc.h
XbrcCurs.o: ../../../.././server/include/os.h
XbrcCurs.o: ../../../.././server/include/scrnintstr.h
XbrcCurs.o: ../../../.././server/include/screenint.h
XbrcCurs.o: ../../../.././server/include/region.h
XbrcCurs.o: ../../../.././server/include/pixmap.h
XbrcCurs.o: ../../../.././server/include/gc.h
XbrcCurs.o: ../../../.././server/include/colormap.h
XbrcCurs.o: ../../../.././server/include/cursorstr.h
XbrcCurs.o: ../../../.././server/include/cursor.h
XbrcCurs.o: ../../../.././server/include/pixmapstr.h
XbrcCurs.o: ../../../.././server/include/colormapst.h
XbrcCurs.o: ../../../.././server/ddx/ibm/common/ibmScreen.h
XbrcCurs.o: ../../../.././server/ddx/ibm/common/ibmColor.h
XbrcCurs.o: ../../../.././server/ddx/ibm/ppc/ppc.h
XbrcCurs.o: ../../../.././server/include/gcstruct.h
XbrcCurs.o: ../../../.././server/include/dixfont.h
XbrcCurs.o: ../../../.././server/ddx/ibm/ppc/ppcGCstr.h
XbrcCurs.o: ../../../.././server/ddx/ibm/ppc/ppcScrn.h
XbrcCurs.o: ../../../.././server/ddx/ibm/ppc/ppcCache.h x8514.h
XbrcCurs.o: ../../../.././server/ddx/ibm/common/ibmIOArch.h ibm8514reg.h
XbrcCurs.o: ../../../.././server/ddx/ibm/BSDrt/OScompiler.h
XbrcCurs.o: ../../../.././server/ddx/ibm/common/ibmTrace.h
XbrcCurs.o: ../../mfb/maskbits.h ../../../.././server/include/servermd.h
XbrcFillSp.o: ../../../.././X11/X.h ../../../.././server/include/misc.h
XbrcFillSp.o: ../../../.././server/include/os.h
XbrcFillSp.o: ../../../.././server/include/gcstruct.h
XbrcFillSp.o: ../../../.././server/include/gc.h
XbrcFillSp.o: ../../../.././server/include/miscstruct.h
XbrcFillSp.o: ../../../.././server/include/region.h
XbrcFillSp.o: ../../../.././server/include/pixmap.h
XbrcFillSp.o: ../../../.././server/include/screenint.h
XbrcFillSp.o: ../../../.././server/include/dixfont.h
XbrcFillSp.o: ../../../.././server/include/windowstr.h
XbrcFillSp.o: ../../../.././server/include/window.h
XbrcFillSp.o: ../../../.././server/include/pixmapstr.h
XbrcFillSp.o: ../../../.././server/include/regionstr.h
XbrcFillSp.o: ../../../.././server/include/cursor.h
XbrcFillSp.o: ../../../.././server/include/property.h
XbrcFillSp.o: ../../../.././server/include/resource.h
XbrcFillSp.o: ../../../.././server/include/dix.h ../../../.././X11/Xprotostr.h
XbrcFillSp.o: ../../../.././X11/Xmd.h
XbrcFillSp.o: ../../../.././server/include/scrnintstr.h
XbrcFillSp.o: ../../../.././server/include/colormap.h
XbrcFillSp.o: ../../../.././server/ddx/ibm/BSDrt/OScompiler.h
XbrcFillSp.o: ../../../.././server/ddx/ibm/ppc/ppc.h
XbrcFillSp.o: ../../../.././server/ddx/ibm/ppc/ppcGCstr.h
XbrcFillSp.o: ../../../.././server/ddx/ibm/ppc/ppcScrn.h
XbrcFillSp.o: ../../../.././server/ddx/ibm/ppc/ppcCache.h
XbrcFillSp.o: ../../../.././server/ddx/ibm/ppc/ppcSpMcro.h x8514.h
XbrcFillSp.o: ../../../.././server/ddx/ibm/common/ibmIOArch.h ibm8514reg.h
XbrcFillSp.o: ../../../.././server/ddx/ibm/common/ibmTrace.h
XbrcGC.o: ../../../.././X11/X.h ../../../.././X11/Xproto.h
XbrcGC.o: ../../../.././X11/Xmd.h ../../../.././X11/Xprotostr.h
XbrcGC.o: ../../../.././server/include/windowstr.h
XbrcGC.o: ../../../.././server/include/window.h
XbrcGC.o: ../../../.././server/include/pixmapstr.h
XbrcGC.o: ../../../.././server/include/pixmap.h
XbrcGC.o: ../../../.././server/include/screenint.h
XbrcGC.o: ../../../.././server/include/miscstruct.h
XbrcGC.o: ../../../.././server/include/misc.h
XbrcGC.o: ../../../.././server/include/os.h
XbrcGC.o: ../../../.././server/include/regionstr.h
XbrcGC.o: ../../../.././server/include/region.h
XbrcGC.o: ../../../.././server/include/cursor.h
XbrcGC.o: ../../../.././server/include/property.h
XbrcGC.o: ../../../.././server/include/resource.h
XbrcGC.o: ../../../.././server/include/dix.h ../../../.././server/include/gc.h
XbrcGC.o: ../../../.././server/include/scrnintstr.h
XbrcGC.o: ../../../.././server/include/colormap.h
XbrcGC.o: ../../../.././server/include/font.h
XbrcGC.o: ../../../.././server/include/servermd.h
XbrcGC.o: ../../../.././server/include/gcstruct.h
XbrcGC.o: ../../../.././server/include/dixfont.h
XbrcGC.o: ../../../.././server/include/cursorstr.h
XbrcGC.o: ../../../.././server/ddx/mi/mistruct.h
XbrcGC.o: ../../../.././server/ddx/mi/mi.h ../../mfb/mfb.h
XbrcGC.o: ../../../.././server/ddx/mi/mibstore.h
XbrcGC.o: ../../../.././server/ddx/ibm/BSDrt/OScompiler.h
XbrcGC.o: ../../../.././server/ddx/ibm/ppc/ppc.h
XbrcGC.o: ../../../.././server/ddx/ibm/ppc/ppcGCstr.h
XbrcGC.o: ../../../.././server/ddx/ibm/ppc/ppcScrn.h
XbrcGC.o: ../../../.././server/ddx/ibm/ppc/ppcCache.h
XbrcGC.o: ../../../.././server/ddx/ibm/ppc/ppcProcs.h brcProcs.h
XbrcGC.o: ../../../.././server/ddx/ibm/common/ibmTrace.h
XbrcGetSp.o: ../../../.././X11/X.h ../../../.././X11/Xmd.h
XbrcGetSp.o: ../../../.././server/include/region.h
XbrcGetSp.o: ../../../.././server/include/gc.h
XbrcGetSp.o: ../../../.././server/include/windowstr.h
XbrcGetSp.o: ../../../.././server/include/window.h
XbrcGetSp.o: ../../../.././server/include/pixmapstr.h
XbrcGetSp.o: ../../../.././server/include/pixmap.h
XbrcGetSp.o: ../../../.././server/include/screenint.h
XbrcGetSp.o: ../../../.././server/include/miscstruct.h
XbrcGetSp.o: ../../../.././server/include/misc.h
XbrcGetSp.o: ../../../.././server/include/os.h
XbrcGetSp.o: ../../../.././server/include/regionstr.h
XbrcGetSp.o: ../../../.././server/include/cursor.h
XbrcGetSp.o: ../../../.././server/include/property.h
XbrcGetSp.o: ../../../.././server/include/resource.h
XbrcGetSp.o: ../../../.././server/include/dix.h ../../../.././X11/Xprotostr.h
XbrcGetSp.o: ../../../.././server/include/scrnintstr.h
XbrcGetSp.o: ../../../.././server/include/colormap.h
XbrcGetSp.o: ../../../.././server/include/servermd.h
XbrcGetSp.o: ../../../.././server/ddx/ibm/common/ibmTrace.h
XbrcImg.o: ../../../.././X11/X.h ../../../.././server/include/servermd.h
XbrcImg.o: ../../../.././server/ddx/ibm/BSDrt/OScompiler.h x8514.h
XbrcImg.o: ../../../.././server/ddx/ibm/common/ibmIOArch.h ibm8514reg.h
XbrcImg.o: ../../../.././server/ddx/ibm/common/ibmTrace.h
XbrcMono.o: ../../../.././X11/X.h ../../../.././X11/Xmd.h
XbrcMono.o: ../../../.././server/include/os.h
XbrcMono.o: ../../../.././server/include/misc.h
XbrcMono.o: ../../../.././server/ddx/ibm/BSDrt/OScompiler.h x8514.h
XbrcMono.o: ../../../.././server/ddx/ibm/common/ibmIOArch.h ibm8514reg.h
XbrcMono.o: ../../../.././server/ddx/ibm/common/ibmTrace.h
XbrcSuspScr.o: ../../../.././X11/X.h ../../../.././server/include/windowstr.h
XbrcSuspScr.o: ../../../.././server/include/window.h
XbrcSuspScr.o: ../../../.././server/include/pixmapstr.h
XbrcSuspScr.o: ../../../.././server/include/pixmap.h
XbrcSuspScr.o: ../../../.././server/include/screenint.h
XbrcSuspScr.o: ../../../.././server/include/miscstruct.h
XbrcSuspScr.o: ../../../.././server/include/misc.h
XbrcSuspScr.o: ../../../.././server/include/os.h
XbrcSuspScr.o: ../../../.././server/include/regionstr.h
XbrcSuspScr.o: ../../../.././server/include/region.h
XbrcSuspScr.o: ../../../.././server/include/cursor.h
XbrcSuspScr.o: ../../../.././server/include/property.h
XbrcSuspScr.o: ../../../.././server/include/resource.h
XbrcSuspScr.o: ../../../.././server/include/dix.h
XbrcSuspScr.o: ../../../.././server/include/gc.h ../../../.././X11/Xprotostr.h
XbrcSuspScr.o: ../../../.././X11/Xmd.h
XbrcSuspScr.o: ../../../.././server/include/scrnintstr.h
XbrcSuspScr.o: ../../../.././server/include/colormap.h
XbrcSuspScr.o: ../../../.././server/include/gcstruct.h
XbrcSuspScr.o: ../../../.././server/include/dixfont.h
XbrcSuspScr.o: ../../../.././server/include/cursorstr.h
XbrcSuspScr.o: ../../../.././server/ddx/ibm/BSDrt/OScompiler.h
XbrcSuspScr.o: ../../../.././server/ddx/ibm/common/ibmIOArch.h
XbrcSuspScr.o: ../../../.././server/ddx/ibm/common/ibmScreen.h
XbrcSuspScr.o: ../../../.././server/ddx/ibm/ppc/ppcGCstr.h
XbrcSuspScr.o: ../../../.././server/ddx/ibm/ppc/ppcScrn.h
XbrcSuspScr.o: ../../../.././server/ddx/ibm/ppc/ppcCache.h x8514.h
XbrcSuspScr.o: ibm8514reg.h brcProcs.h
XbrcIO.o: ../../../.././X11/X.h ../../../.././server/include/servermd.h
XbrcIO.o: ../../../.././server/include/screenint.h
XbrcIO.o: ../../../.././server/include/scrnintstr.h
XbrcIO.o: ../../../.././server/include/miscstruct.h
XbrcIO.o: ../../../.././server/include/misc.h
XbrcIO.o: ../../../.././server/include/os.h
XbrcIO.o: ../../../.././server/include/region.h
XbrcIO.o: ../../../.././server/include/pixmap.h
XbrcIO.o: ../../../.././server/include/gc.h
XbrcIO.o: ../../../.././server/include/colormap.h
XbrcIO.o: ../../../.././server/include/pixmapstr.h
XbrcIO.o: ../../../.././server/include/window.h
XbrcIO.o: ../../../.././server/include/windowstr.h
XbrcIO.o: ../../../.././server/include/regionstr.h
XbrcIO.o: ../../../.././server/include/cursor.h
XbrcIO.o: ../../../.././server/include/property.h
XbrcIO.o: ../../../.././server/include/resource.h
XbrcIO.o: ../../../.././server/include/dix.h ../../../.././X11/Xprotostr.h
XbrcIO.o: ../../../.././X11/Xmd.h ../../../.././server/include/colormapst.h
XbrcIO.o: ../../../.././server/ddx/ibm/common/ibmScreen.h
XbrcIO.o: ../../../.././server/ddx/ibm/ppc/ppc.h
XbrcIO.o: ../../../.././server/include/gcstruct.h
XbrcIO.o: ../../../.././server/include/dixfont.h
XbrcIO.o: ../../../.././server/ddx/ibm/ppc/ppcGCstr.h
XbrcIO.o: ../../../.././server/ddx/ibm/ppc/ppcScrn.h
XbrcIO.o: ../../../.././server/ddx/ibm/ppc/ppcCache.h x8514.h
XbrcIO.o: ../../../.././server/ddx/ibm/common/ibmIOArch.h ibm8514reg.h
XbrcIO.o: ../../../.././server/ddx/ibm/common/ibmTrace.h
XbrcUtils.o: ../../../.././X11/X.h ../../../.././server/include/cursorstr.h
XbrcUtils.o: ../../../.././server/include/cursor.h
XbrcUtils.o: ../../../.././server/include/pixmap.h
XbrcUtils.o: ../../../.././server/include/misc.h
XbrcUtils.o: ../../../.././server/include/os.h
XbrcUtils.o: ../../../.././server/include/scrnintstr.h
XbrcUtils.o: ../../../.././server/include/screenint.h
XbrcUtils.o: ../../../.././server/include/miscstruct.h
XbrcUtils.o: ../../../.././server/include/region.h
XbrcUtils.o: ../../../.././server/include/gc.h
XbrcUtils.o: ../../../.././server/include/colormap.h
XbrcUtils.o: ../../../.././server/ddx/ibm/BSDrt/OScompiler.h x8514.h
XbrcUtils.o: ../../../.././server/ddx/ibm/common/ibmIOArch.h ibm8514reg.h
XbrcUtils.o: ../../../.././server/ddx/ibm/common/ibmTrace.h
XbrcGBlt.o: ../../../.././X11/X.h ../../../.././X11/Xmd.h
XbrcGBlt.o: ../../../.././X11/Xproto.h ../../../.././X11/Xprotostr.h
XbrcGBlt.o: ../../../.././server/include/fontstruct.h
XbrcGBlt.o: ../../../.././server/include/font.h
XbrcGBlt.o: ../../../.././server/include/servermd.h
XbrcGBlt.o: ../../../.././server/include/misc.h
XbrcGBlt.o: ../../../.././server/include/os.h
XbrcGBlt.o: ../../../.././server/include/dixfontstr.h
XbrcGBlt.o: ../../../.././server/include/dixfont.h
XbrcGBlt.o: ../../../.././server/include/gcstruct.h
XbrcGBlt.o: ../../../.././server/include/gc.h
XbrcGBlt.o: ../../../.././server/include/miscstruct.h
XbrcGBlt.o: ../../../.././server/include/region.h
XbrcGBlt.o: ../../../.././server/include/pixmap.h
XbrcGBlt.o: ../../../.././server/include/screenint.h
XbrcGBlt.o: ../../../.././server/include/windowstr.h
XbrcGBlt.o: ../../../.././server/include/window.h
XbrcGBlt.o: ../../../.././server/include/pixmapstr.h
XbrcGBlt.o: ../../../.././server/include/regionstr.h
XbrcGBlt.o: ../../../.././server/include/cursor.h
XbrcGBlt.o: ../../../.././server/include/property.h
XbrcGBlt.o: ../../../.././server/include/resource.h
XbrcGBlt.o: ../../../.././server/include/dix.h
XbrcGBlt.o: ../../../.././server/include/scrnintstr.h
XbrcGBlt.o: ../../../.././server/include/colormap.h
XbrcGBlt.o: ../../../.././server/ddx/ibm/BSDrt/OScompiler.h
XbrcGBlt.o: ../../../.././server/ddx/ibm/ppc/ppc.h
XbrcGBlt.o: ../../../.././server/ddx/ibm/ppc/ppcGCstr.h
XbrcGBlt.o: ../../../.././server/ddx/ibm/ppc/ppcScrn.h
XbrcGBlt.o: ../../../.././server/ddx/ibm/ppc/ppcCache.h x8514.h
XbrcGBlt.o: ../../../.././server/ddx/ibm/common/ibmIOArch.h ibm8514reg.h
XbrcGBlt.o: ../../../.././server/ddx/ibm/common/ibmTrace.h
XbrcLine.o: ../../../.././X11/X.h ../../../.././server/include/misc.h
XbrcLine.o: ../../../.././server/include/os.h
XbrcLine.o: ../../../.././server/include/colormapst.h
XbrcLine.o: ../../../.././server/include/colormap.h
XbrcLine.o: ../../../.././server/include/screenint.h
XbrcLine.o: ../../../.././server/include/pixmapstr.h
XbrcLine.o: ../../../.././server/include/pixmap.h
XbrcLine.o: ../../../.././server/include/miscstruct.h
XbrcLine.o: ../../../.././server/ddx/ibm/ppc/ppc.h
XbrcLine.o: ../../../.././server/include/gcstruct.h
XbrcLine.o: ../../../.././server/include/gc.h
XbrcLine.o: ../../../.././server/include/region.h
XbrcLine.o: ../../../.././server/include/dixfont.h
XbrcLine.o: ../../../.././server/ddx/ibm/ppc/ppcGCstr.h
XbrcLine.o: ../../../.././server/ddx/ibm/ppc/ppcScrn.h
XbrcLine.o: ../../../.././server/ddx/ibm/ppc/ppcCache.h x8514.h
XbrcLine.o: ../../../.././server/ddx/ibm/common/ibmIOArch.h ibm8514reg.h
XbrcLine.o: ../../../.././server/ddx/ibm/common/ibmTrace.h
XbrcStip.o: ../../../.././X11/X.h ../../../.././server/include/servermd.h
XbrcStip.o: ../../../.././server/include/pixmap.h
XbrcStip.o: ../../../.././server/include/pixmapstr.h
XbrcStip.o: ../../../.././server/include/screenint.h
XbrcStip.o: ../../../.././server/include/miscstruct.h
XbrcStip.o: ../../../.././server/include/misc.h
XbrcStip.o: ../../../.././server/include/os.h
XbrcStip.o: ../../../.././server/include/gcstruct.h
XbrcStip.o: ../../../.././server/include/gc.h
XbrcStip.o: ../../../.././server/include/region.h
XbrcStip.o: ../../../.././server/include/dixfont.h
XbrcStip.o: ../../../.././server/ddx/ibm/BSDrt/OScompiler.h x8514.h
XbrcStip.o: ../../../.././server/ddx/ibm/common/ibmIOArch.h ibm8514reg.h
XbrcStip.o: ../../../.././server/ddx/ibm/common/ibmTrace.h
XbrcFont.o: ../../../.././X11/X.h ../../../.././X11/Xproto.h
XbrcFont.o: ../../../.././X11/Xmd.h ../../../.././X11/Xprotostr.h
XbrcFont.o: ../../../.././server/include/fontstruct.h
XbrcFont.o: ../../../.././server/include/font.h
XbrcFont.o: ../../../.././server/include/servermd.h
XbrcFont.o: ../../../.././server/include/misc.h
XbrcFont.o: ../../../.././server/include/os.h
XbrcFont.o: ../../../.././server/include/dixfontstr.h
XbrcFont.o: ../../../.././server/include/dixfont.h
XbrcFont.o: ../../../.././server/include/scrnintstr.h
XbrcFont.o: ../../../.././server/include/screenint.h
XbrcFont.o: ../../../.././server/include/miscstruct.h
XbrcFont.o: ../../../.././server/include/region.h
XbrcFont.o: ../../../.././server/include/pixmap.h
XbrcFont.o: ../../../.././server/include/gc.h
XbrcFont.o: ../../../.././server/include/colormap.h
XbrcFont.o: ../../../.././server/ddx/mfb/mfb.h
XbrcFont.o: ../../../.././server/ddx/mi/mibstore.h
XbrcFont.o: ../../../.././server/ddx/ibm/BSDrt/OScompiler.h x8514.h
XbrcFont.o: ../../../.././server/ddx/ibm/common/ibmIOArch.h ibm8514reg.h
XbrcFont.o: brcFonts.h ../../../.././server/ddx/ibm/common/ibmTrace.h
XbrcText.o: ../../../.././X11/X.h ../../../.././X11/Xproto.h
XbrcText.o: ../../../.././X11/Xmd.h ../../../.././X11/Xprotostr.h
XbrcText.o: ../../../.././server/include/fontstruct.h
XbrcText.o: ../../../.././server/include/font.h
XbrcText.o: ../../../.././server/include/servermd.h
XbrcText.o: ../../../.././server/include/misc.h
XbrcText.o: ../../../.././server/include/os.h
XbrcText.o: ../../../.././server/include/dixfontstr.h
XbrcText.o: ../../../.././server/include/dixfont.h
XbrcText.o: ../../../.././server/include/gcstruct.h
XbrcText.o: ../../../.././server/include/gc.h
XbrcText.o: ../../../.././server/include/miscstruct.h
XbrcText.o: ../../../.././server/include/region.h
XbrcText.o: ../../../.././server/include/pixmap.h
XbrcText.o: ../../../.././server/include/screenint.h
XbrcText.o: ../../../.././server/include/windowstr.h
XbrcText.o: ../../../.././server/include/window.h
XbrcText.o: ../../../.././server/include/pixmapstr.h
XbrcText.o: ../../../.././server/include/regionstr.h
XbrcText.o: ../../../.././server/include/cursor.h
XbrcText.o: ../../../.././server/include/property.h
XbrcText.o: ../../../.././server/include/resource.h
XbrcText.o: ../../../.././server/include/dix.h
XbrcText.o: ../../../.././server/include/scrnintstr.h
XbrcText.o: ../../../.././server/include/colormap.h
XbrcText.o: ../../../.././server/ddx/mfb/mfb.h
XbrcText.o: ../../../.././server/ddx/mi/mibstore.h
XbrcText.o: ../../../.././server/ddx/ibm/BSDrt/OScompiler.h
XbrcText.o: ../../../.././server/ddx/ibm/ppc/ppc.h
XbrcText.o: ../../../.././server/ddx/ibm/ppc/ppcGCstr.h
XbrcText.o: ../../../.././server/ddx/ibm/ppc/ppcScrn.h
XbrcText.o: ../../../.././server/ddx/ibm/ppc/ppcCache.h x8514.h
XbrcText.o: ../../../.././server/ddx/ibm/common/ibmIOArch.h ibm8514reg.h
XbrcText.o: brcFonts.h ../../../.././server/ddx/ibm/common/ibmTrace.h
XbrcPoly.o: ../../../.././X11/X.h ../../../.././server/include/misc.h
XbrcPoly.o: ../../../.././server/include/os.h
XbrcPoly.o: ../../../.././server/include/gcstruct.h
XbrcPoly.o: ../../../.././server/include/gc.h
XbrcPoly.o: ../../../.././server/include/miscstruct.h
XbrcPoly.o: ../../../.././server/include/region.h
XbrcPoly.o: ../../../.././server/include/pixmap.h
XbrcPoly.o: ../../../.././server/include/screenint.h
XbrcPoly.o: ../../../.././server/include/dixfont.h
XbrcPoly.o: ../../../.././server/include/windowstr.h
XbrcPoly.o: ../../../.././server/include/window.h
XbrcPoly.o: ../../../.././server/include/pixmapstr.h
XbrcPoly.o: ../../../.././server/include/regionstr.h
XbrcPoly.o: ../../../.././server/include/cursor.h
XbrcPoly.o: ../../../.././server/include/property.h
XbrcPoly.o: ../../../.././server/include/resource.h
XbrcPoly.o: ../../../.././server/include/dix.h ../../../.././X11/Xprotostr.h
XbrcPoly.o: ../../../.././X11/Xmd.h ../../../.././server/include/colormapst.h
XbrcPoly.o: ../../../.././server/include/colormap.h
XbrcPoly.o: ../../../.././server/ddx/ibm/BSDrt/OScompiler.h
XbrcPoly.o: ../../../.././server/ddx/ibm/ppc/ppc.h
XbrcPoly.o: ../../../.././server/ddx/ibm/ppc/ppcGCstr.h
XbrcPoly.o: ../../../.././server/ddx/ibm/ppc/ppcScrn.h
XbrcPoly.o: ../../../.././server/ddx/ibm/ppc/ppcCache.h
XbrcPoly.o: ../../../.././server/ddx/ibm/common/ibmTrace.h x8514.h
XbrcPoly.o: ../../../.././server/ddx/ibm/common/ibmIOArch.h ibm8514reg.h
XbrcPgon.o: ../../../.././X11/X.h ../../../.././server/include/pixmapstr.h
XbrcPgon.o: ../../../.././server/include/pixmap.h
XbrcPgon.o: ../../../.././server/include/screenint.h
XbrcPgon.o: ../../../.././server/include/miscstruct.h
XbrcPgon.o: ../../../.././server/include/misc.h
XbrcPgon.o: ../../../.././server/include/os.h
XbrcPgon.o: ../../../.././server/include/gcstruct.h
XbrcPgon.o: ../../../.././server/include/gc.h
XbrcPgon.o: ../../../.././server/include/region.h
XbrcPgon.o: ../../../.././server/include/dixfont.h
XbrcPgon.o: ../../../.././server/include/windowstr.h
XbrcPgon.o: ../../../.././server/include/window.h
XbrcPgon.o: ../../../.././server/include/regionstr.h
XbrcPgon.o: ../../../.././server/include/cursor.h
XbrcPgon.o: ../../../.././server/include/property.h
XbrcPgon.o: ../../../.././server/include/resource.h
XbrcPgon.o: ../../../.././server/include/dix.h ../../../.././X11/Xprotostr.h
XbrcPgon.o: ../../../.././X11/Xmd.h ../../../.././server/include/colormapst.h
XbrcPgon.o: ../../../.././server/include/colormap.h
XbrcPgon.o: ../../../.././server/ddx/ibm/ppc/ppc.h
XbrcPgon.o: ../../../.././server/ddx/ibm/ppc/ppcGCstr.h
XbrcPgon.o: ../../../.././server/ddx/ibm/ppc/ppcScrn.h
XbrcPgon.o: ../../../.././server/ddx/ibm/ppc/ppcCache.h
XbrcPgon.o: ../../../.././server/ddx/ibm/common/ibmTrace.h x8514.h
XbrcPgon.o: ../../../.././server/ddx/ibm/common/ibmIOArch.h ibm8514reg.h
XbrcOutL.o: ../../../.././X11/X.h
XbrcOutL.o: ../../../.././server/ddx/ibm/BSDrt/OScompiler.h x8514.h
XbrcOutL.o: ../../../.././server/ddx/ibm/common/ibmIOArch.h ibm8514reg.h
XbrcOutL.o: ../../../.././server/ddx/ibm/common/ibmTrace.h
XbrcRect.o: x8514.h ../../../.././server/ddx/ibm/common/ibmIOArch.h
XbrcRect.o: ibm8514reg.h ../../../.././server/ddx/ibm/common/ibmTrace.h
XbrcTile.o: ../../../.././X11/X.h ../../../.././server/include/misc.h
XbrcTile.o: ../../../.././server/include/os.h
XbrcTile.o: ../../../.././server/include/gcstruct.h
XbrcTile.o: ../../../.././server/include/gc.h
XbrcTile.o: ../../../.././server/include/miscstruct.h
XbrcTile.o: ../../../.././server/include/region.h
XbrcTile.o: ../../../.././server/include/pixmap.h
XbrcTile.o: ../../../.././server/include/screenint.h
XbrcTile.o: ../../../.././server/include/dixfont.h
XbrcTile.o: ../../../.././server/include/pixmapstr.h
XbrcTile.o: ../../../.././server/ddx/ibm/BSDrt/OScompiler.h x8514.h
XbrcTile.o: ../../../.././server/ddx/ibm/common/ibmIOArch.h ibm8514reg.h
XbrcTile.o: ../../../.././server/ddx/ibm/common/ibmTrace.h
XbrcPushPxl.o: ../../../.././X11/X.h ../../../.././server/include/misc.h
XbrcPushPxl.o: ../../../.././server/include/os.h
XbrcPushPxl.o: ../../../.././server/include/gcstruct.h
XbrcPushPxl.o: ../../../.././server/include/gc.h
XbrcPushPxl.o: ../../../.././server/include/miscstruct.h
XbrcPushPxl.o: ../../../.././server/include/region.h
XbrcPushPxl.o: ../../../.././server/include/pixmap.h
XbrcPushPxl.o: ../../../.././server/include/screenint.h
XbrcPushPxl.o: ../../../.././server/include/dixfont.h
XbrcPushPxl.o: ../../../.././server/include/scrnintstr.h
XbrcPushPxl.o: ../../../.././server/include/colormap.h
XbrcPushPxl.o: ../../../.././server/include/windowstr.h
XbrcPushPxl.o: ../../../.././server/include/window.h
XbrcPushPxl.o: ../../../.././server/include/pixmapstr.h
XbrcPushPxl.o: ../../../.././server/include/regionstr.h
XbrcPushPxl.o: ../../../.././server/include/cursor.h
XbrcPushPxl.o: ../../../.././server/include/property.h
XbrcPushPxl.o: ../../../.././server/include/resource.h
XbrcPushPxl.o: ../../../.././server/include/dix.h
XbrcPushPxl.o: ../../../.././X11/Xprotostr.h ../../../.././X11/Xmd.h
XbrcPushPxl.o: ../../../.././server/ddx/mfb/maskbits.h
XbrcPushPxl.o: ../../../.././server/include/servermd.h
XbrcPushPxl.o: ../../../.././server/ddx/ibm/BSDrt/OScompiler.h
XbrcPushPxl.o: ../../../.././server/ddx/ibm/ppc/ppc.h
XbrcPushPxl.o: ../../../.././server/ddx/ibm/ppc/ppcGCstr.h
XbrcPushPxl.o: ../../../.././server/ddx/ibm/ppc/ppcScrn.h
XbrcPushPxl.o: ../../../.././server/ddx/ibm/ppc/ppcCache.h x8514.h
XbrcPushPxl.o: ../../../.././server/ddx/ibm/common/ibmIOArch.h ibm8514reg.h
XbrcOSD.o: /usr/include/fcntl.h /usr/include/sys/ioctl.h
XbrcOSD.o: /usr/include/sys/ttychars.h /usr/include/sys/ttydev.h
XbrcOSD.o: ../../../.././X11/X.h ../../../.././server/include/miscstruct.h
XbrcOSD.o: ../../../.././server/include/misc.h
XbrcOSD.o: ../../../.././server/include/os.h
XbrcOSD.o: ../../../.././server/include/scrnintstr.h
XbrcOSD.o: ../../../.././server/include/screenint.h
XbrcOSD.o: ../../../.././server/include/region.h
XbrcOSD.o: ../../../.././server/include/pixmap.h
XbrcOSD.o: ../../../.././server/include/gc.h
XbrcOSD.o: ../../../.././server/include/colormap.h
XbrcOSD.o: ../../../.././server/include/cursorstr.h
XbrcOSD.o: ../../../.././server/include/cursor.h
XbrcOSD.o: ../../../.././server/ddx/ibm/common/ibmScreen.h
XbrcOSD.o: ../../../.././server/ddx/ibm/common/ibmTrace.h x8514.h
XbrcOSD.o: ../../../.././server/ddx/ibm/common/ibmIOArch.h ibm8514reg.h
XbrcScrInfo.o: ../../../.././X11/X.h ../../../.././server/include/misc.h
XbrcScrInfo.o: ../../../.././server/include/os.h
XbrcScrInfo.o: ../../../.././server/include/miscstruct.h
XbrcScrInfo.o: ../../../.././server/include/scrnintstr.h
XbrcScrInfo.o: ../../../.././server/include/screenint.h
XbrcScrInfo.o: ../../../.././server/include/region.h
XbrcScrInfo.o: ../../../.././server/include/pixmap.h
XbrcScrInfo.o: ../../../.././server/include/gc.h
XbrcScrInfo.o: ../../../.././server/include/colormap.h
XbrcScrInfo.o: ../../../.././server/include/cursorstr.h
XbrcScrInfo.o: ../../../.././server/include/cursor.h
XbrcScrInfo.o: ../../../.././server/ddx/ibm/common/ibmScreen.h x8514.h
XbrcScrInfo.o: ../../../.././server/ddx/ibm/common/ibmIOArch.h ibm8514reg.h
XbrcData.o: ../../../.././X11/X.h ../../../.././X11/Xproto.h
XbrcData.o: ../../../.././X11/Xmd.h ../../../.././X11/Xprotostr.h
XbrcData.o: ../../../.././server/include/miscstruct.h
XbrcData.o: ../../../.././server/include/misc.h
XbrcData.o: ../../../.././server/include/os.h
XbrcData.o: ../../../.././server/include/scrnintstr.h
XbrcData.o: ../../../.././server/include/screenint.h
XbrcData.o: ../../../.././server/include/region.h
XbrcData.o: ../../../.././server/include/pixmap.h
XbrcData.o: ../../../.././server/include/gc.h
XbrcData.o: ../../../.././server/include/colormap.h
XbrcData.o: ../../../.././server/include/font.h
XbrcData.o: ../../../.././server/include/servermd.h
XbrcData.o: ../../../.././server/include/pixmapstr.h
XbrcData.o: ../../../.././server/include/window.h
XbrcData.o: ../../../.././server/include/gcstruct.h
XbrcData.o: ../../../.././server/include/dixfont.h
XbrcData.o: ../../../.././server/include/colormapst.h
XbrcData.o: ../../../.././server/include/cursorstr.h
XbrcData.o: ../../../.././server/include/cursor.h
XbrcData.o: ../../../.././server/ddx/mi/mistruct.h
XbrcData.o: ../../../.././server/ddx/mi/mi.h
XbrcData.o: ../../../.././server/ddx/mfb/mfb.h
XbrcData.o: ../../../.././server/ddx/mi/mibstore.h
XbrcData.o: ../../../.././server/ddx/ibm/BSDrt/OScursor.h
XbrcData.o: ../../../.././server/ddx/ibm/BSDrt/OSio.h
XbrcData.o: ../../../.././server/ddx/ibm/common/ibmScreen.h
XbrcData.o: ../../../.././server/ddx/ibm/ppc/ppc.h
XbrcData.o: ../../../.././server/ddx/ibm/ppc/ppcGCstr.h
XbrcData.o: ../../../.././server/ddx/ibm/ppc/ppcScrn.h
XbrcData.o: ../../../.././server/ddx/ibm/ppc/ppcCache.h
XbrcData.o: ../../../.././server/ddx/ibm/ppc/ppcProcs.h x8514.h
XbrcData.o: ../../../.././server/ddx/ibm/common/ibmIOArch.h ibm8514reg.h
XbrcData.o: brcProcs.h
END-of-ibm8514/Makefile
echo x - ibm8514/blkout.s
sed 's/^X//' >ibm8514/blkout.s << 'END-of-ibm8514/blkout.s'
X	.file	"blkout.s"
X/*									*/
X/*	void								*/
X/*	blockoutw( unsigned short *values, int n )			*/
X/*									*/
X/*	This routine destroys the contents of %eax, %ecx & %edx		*/
X/*	All other registers are preserved.				*/
X/*									*/
X
X	.def	blockoutw;	.val	blockoutw;
X	.scl	2;	.type	055;	.endef
X	.globl	blockoutw
X.align 4
X	movw	%ax, %ax	/* Aligning "nop" */
X	xchgl	%esi, 4(%esp)	/* get "values" */
X	xchgl	%ebx, 8(%esp)	/* get "n" */
X/* Bottom half of %edx is I/O addr of the queue status port	0xDAE8 */
X/* Top half of %edx is I/O addr of the variable-data port	0xE2E8 */
X	movl	$0xE2E8DAE8, %edx
X
X.testQ1:	/* Now %dx points to the queue status port */
X	inw	(%dx)		/* Read The Queue Status Port */
X	xorb	$0xFF, %al	/* same as logical negation, but set flags */
X	jz	.testQ1		/* If no slots are available, spin & burn */
X
X	bsfl	%eax, %ecx
X	rorl	$16, %edx	/* Point %dx at the VAR-DATA I/O port */
X	subb	$8, %cl		/* The number of empty slots -- NEGATED !! */
X	negb	%cl		/* The number of empty slots !! */
X	subl	%ecx, %ebx	/* The number of words remaining after this */
X	jle	.final_batch
X	rep
X	outsw	/* (%dx), (%esi) */
X	rorl	$16, %edx	/* Point %dx at the Queue Status I/O port */
X	jmp	.testQ1
X
X	add	%ebx, %ecx	/* The number of words left !! */
X	jz	.done1		/* Are there any words left ?? */
X	rep
X	outsw	/* (%dx), (%esi) */
X	movl	4(%esp), %esi
X	movl	8(%esp), %ebx
X	ret
X	.def	blockoutw;	.val	.;	.scl	-1;	.endef
X
X/*	void					*/
X/*	blockouttransmogrifiedw( values, n )	*/
X/*	register unsigned char *values	;	*/
X/*	register int n ;			*/
X/*	{					*/
X/*	register unsigned char tmp ;		*/
X/*						*/
X/*	do {					*/
X/*		tmp = *values++ ;		*/
X/*		tmp = transmogrify( tmp ) ;	*/
X/*		ibm8514CheckQueue( 1 ) ;	*/
X/*		outw( VARDATA, tmp ) ;		*/
X/*	} while ( --n ) ;			*/
X/*	return	;				*/
X/*	}					*/
X	/* .align	4 */ /* Better off without this !! */
X	.def	blockouttransmogrifiedw;	.val	blockouttransmogrifiedw;
X	.scl	2;	.type	055;	.endef
X	.globl	blockouttransmogrifiedw
X	.text
X	xchgl	0x4(%esp), %esi
X	movl	0x8(%esp), %ecx
X	jcxz	.done2
X/* Top half of %edx is I/O addr of the queue status port	0xDAE8 */
X/* Bottom half of %edx is I/O addr of the variable-data port	0xE2E8 */
X	movl	$0xDAE8E2E8, %edx
X	rorl	$16, %edx
X/*		do { */
X.testQ2:		/* ibm8514CheckQueue( 1 ) ;	*/
X/*		ibm8514CheckQueue( 1 ) ;	*/
X	inw	(%dx)		/* Read The Queue Status Port */
X	testb	$128, %al
X	jnz	.testQ2
X	lodsb		/* tmp = *values++ ; ---- Does Increment For Us !! */
X/*		tmp = transmogrify( tmp ) ;	*/
X	shll	$4, %eax
X	shrb	$4, %al
X	addl	%eax, %eax
X	xchgb	%ah, %al
X/*		outw( VARDATA, tmp ) ;		*/
X	rorl	$16, %edx
X	outw	(%dx)
X/*	} while ( --n ) ;			*/
X	loop	.Loop_Top
X	movl	0x4(%esp), %esi
X	ret
X	
X	.def	blockouttransmogrifiedw;	.val	.;
X	.scl	-1;	.endef
END-of-ibm8514/blkout.s
echo x - ibm8514/brcBlit.c
sed 's/^X//' >ibm8514/brcBlit.c << 'END-of-ibm8514/brcBlit.c'
X/*
X * Copyright IBM Corporation 1987,1990
X *
X * All Rights Reserved
X *
X * Permission to use, copy, modify, and distribute this software and its
X * documentation for any purpose and without fee is hereby granted,
X * provided that the above copyright notice appear in all copies and that 
X * both that copyright notice and this permission notice appear in
X * supporting documentation, and that the name of IBM not be
X * used in advertising or publicity pertaining to distribution of the
X * software without specific, written prior permission.
X *
X * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
X * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
X * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
X * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
X * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
X * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
X * SOFTWARE.
X *
X*/
X/*
X * PRPQ 5799-PFF (C) COPYRIGHT IBM CORPORATION 1987,1990
X * LICENSED MATERIALS - PROPERTY OF IBM
X * REFER TO COPYRIGHT INSTRUCTIONS FORM NUMBER G120-2083
X */
X/*
X *  Hardware interface routines for IBM 8514/A adapter for
X *  X.11 server(s) on IBM equipment.
X *
X */
X/* $Header:
/andrew/X11/r3src/r3plus/server/ddx/ibm/ibm8514/RCS/brcBlit.c,v 6.3
89/05/07 15:14:40 paul Exp $ */
X/* $Source:
/andrew/X11/r3src/r3plus/server/ddx/ibm/ibm8514/RCS/brcBlit.c,v $ */
X
X#ifndef lint
Xstatic char *rcsid = "$Header:
/andrew/X11/r3src/r3plus/server/ddx/ibm/ibm8514/RCS/brcBlit.c,v 6.3
89/05/07 15:14:40 paul Exp $" ;
X#endif
X
X#include "x8514.h"
X
X#include "ibmTrace.h"
X
Xextern int mergexlate[] ;
Xextern int ibm8514cursorSemaphore ;
X
Xvoid
Xibm8514Bitblt( merge, rpm, wpm, x0, y0, x1, y1, lx, ly )
Xint merge ;
Xunsigned long int rpm, wpm ;
Xint x0, y0, x1, y1, lx, ly ;
X{
X	unsigned short command = 0xc0f3 ;
X	int CursorIsSaved ;
X
X	TRACE( (
"ibm8514Bitblt:merge=%d,rpm=%02x,wpm=%02x,x0=%d,y0=%d,x1=%d,y1=%d,lx=%d,
ly=%d\n",
X	  merge, rpm, wpm, x0, y0, x1, y1, lx, ly ) ) ;
X
X	if ( lx <= 0 || ly <= 0 )
X		return ;
X
X	CursorIsSaved = !ibm8514cursorSemaphore
X		     && ( ibm8514CheckCursor( x0, y0, lx, ly )
X		       || ibm8514CheckCursor( x1, y1, lx, ly ) ) ;
X
X	--lx ;
X	--ly ;
X	if ( x1 > x0 ) {
X		x0 += lx ; /* start at right and go left */
X		x1 += lx ;
X		command &= 0xFFDF ;/* turn off X cd bit */
X	}
X	if ( y1 > y0 ) {
X		y0 += ly ; /* start at bottom and go up */
X		y1 += ly ;
X		command &= 0xFF7F ;/* turn off Y cd bit */
X	}
X
X	ibm8514ATRNotBusy ;
X	ibm8514CheckQueue( 5 ) ;
X	PLNRENBL( rpm ) ;
X	PLNWENBL( wpm ) ;
X	SETFN1( FNCPYRCT, mergexlate[merge] ) ;
X	SETX0( x0 ) ;
X	SETY0( y0 ) ;
X	ibm8514CheckQueue( 5 ) ;
X	SETX1( x1 ) ;
X	SETY1( y1 ) ;
X	SETLX( lx ) ;
X	SETLY( ly ) ;
X	COMMAND( command ) ;
X
X	ibm8514CheckQueue( 3 ) ;
X	PLNRENBL( ibm8514ALLPLANES ) ;
X	PLNWENBL( ibm8514ALLPLANES ) ;
X	SETFN1( FNCOLOR1, FNREPLACE ) ; /* as expected elsewhere */
X
X	if ( CursorIsSaved )
X		ibm8514ReplaceCursor() ;
X
X	return ;
X}
X
Xvoid
Xibm8514BlitFG( rpm, wpm, fg, merge, x0, y0, x1, y1, lx, ly )
Xunsigned long int rpm ;
Xunsigned long int wpm ;
Xunsigned long int fg ;
Xint merge, x0, y0, x1, y1, lx, ly ;
X{
X	unsigned short command = 0xC0F3 ;
X	int CursorIsSaved ;
X
X	TRACE( ( "ibm8514BlitFG:rpm,wpm,fg,mrg,x0,y0,x1,y1,lx,ly =
%d,%d,%d,%d,%d,%d,%d,%d,%d,%d\n",
X	  rpm, wpm, fg, merge, x0, y0, x1, y1, lx, ly ) ) ;
X
X	if ( lx <= 0 || ly <= 0 )
X		return ;
X
X	CursorIsSaved = !ibm8514cursorSemaphore
X		     && ( ibm8514CheckCursor( x0, y0, lx, ly )
X		       || ibm8514CheckCursor( x1, y1, lx, ly ) ) ;
X
X	lx-- ;
X	ly-- ;
X	if ( x1 > x0 ) {
X		x0 += lx ; /* start at right and go left */
X		x1 += lx ;
X		command &= 0xFFDF ; /* turn off X cd bit */
X	}
X	if ( y1 > y0 ) {
X		y0 += ly ; /* start at bottom and go up */
X		y1 += ly ;
X		command &= 0xFF7F ;/* turn off Y cd bit */
X	}
X
X	ibm8514ATRNotBusy ;
X	ibm8514CheckQueue( 4 ) ;
X	SETFN0( FNCOLOR0, FNNOP ) ;
X	SETFN1( FNCOLOR1, mergexlate[merge] ) ;
X	PLNRENBL( rpm ) ;
X	PLNWENBL( wpm ) ;
X
X	ibm8514CheckQueue( 4 ) ;
X	SETMODE( M_CPYRCT ) ;
X	SETCOL1( fg ) ;
X	SETX0( x0 ) ;
X	SETY0( y0 ) ;
X
X	ibm8514CheckQueue( 5 ) ;
X	SETX1( x1 ) ;
X	SETY1( y1 ) ;
X	SETLX( lx ) ;
X	SETLY( ly ) ;
X	COMMAND( command ) ;
X
X	ibm8514CheckQueue( 5 ) ;
X	PLNRENBL( RPLANES ) ;
X	PLNWENBL( WPLANES ) ;
X	SETFN0( FNCOLOR0, FNREPLACE ) ;
X	SETFN1( FNCOLOR1, FNREPLACE ) ;
X	SETMODE( M_ONES ) ;
X
X	if ( CursorIsSaved )
X		ibm8514ReplaceCursor() ;
X
X	return ;
X}
X
Xvoid
Xibm8514BlitFGBG( rpm, wpm, fg, bg, merge, x0, y0, x1, y1, lx, ly )
Xunsigned long int rpm ;
Xunsigned long int wpm ;
Xunsigned long int fg ;
Xunsigned long int bg ;
Xint merge, x0, y0, x1, y1, lx, ly ;
X{
X	unsigned short command = 0xC0F3 ;
X	int CursorIsSaved ;
X
XTRACE( ( "ibm8514BlitFGBG:plns,fg,bg,mrg,x0,y0,x1,y1,lx,ly =
%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d\n",
X	  rpm, wpm, fg, bg, merge, x0, y0, x1, y1, lx, ly ) ) ;
X
X	if ( lx <= 0 || ly <= 0 )
X		return ;
X	CursorIsSaved = !ibm8514cursorSemaphore
X		     && ( ibm8514CheckCursor( x0, y0, lx, ly )
X		       || ibm8514CheckCursor( x1, y1, lx, ly ) ) ;
X
X	ly-- ;
X	lx-- ;
X	if ( x1 > x0 ) {
X		x0 += lx ; /* start at right and go left */
X		x1 += lx ;
X		command &= 0xFFDF ;/* turn off X cd bit */
X	}
X	if ( y1 > y0 ) {
X		y0 += ly ; /* start at bottom and go up */
X		y1 += ly ;
X		command &= 0xFF7F ;/* turn off Y cd bit */
X	}
X
X	ibm8514ATRNotBusy ;
X	ibm8514CheckQueue( 4 ) ;
X	SETFN0( FNCOLOR0, mergexlate[merge] ) ;
X	SETFN1( FNCOLOR1, mergexlate[merge] ) ;
X	SETCOL0( bg ) ;
X	SETCOL1( fg ) ;
X
X	ibm8514CheckQueue( 5 ) ;
X	PLNRENBL( rpm ) ;
X	PLNWENBL( wpm ) ;
X	SETMODE( M_CPYRCT ) ;
X	SETX0( x0 ) ;
X	SETY0( y0 ) ;
X
X	ibm8514CheckQueue( 5 ) ;
X	SETX1( x1 ) ;
X	SETY1( y1 ) ;
X	SETLX( lx ) ;
X	SETLY( ly ) ;
X	COMMAND( command ) ;
X
X	ibm8514CheckQueue( 5 ) ;
X	PLNRENBL( RPLANES ) ;
X	PLNWENBL( WPLANES ) ;
X	SETFN0( FNCOLOR0, FNREPLACE ) ;
X	SETFN1( FNCOLOR1, FNREPLACE ) ;
X	SETMODE( M_ONES ) ;
X
X	if ( CursorIsSaved )
X		ibm8514ReplaceCursor() ;
X
X	return ;
X}
END-of-ibm8514/brcBlit.c
echo x - ibm8514/brcCmap.c
sed 's/^X//' >ibm8514/brcCmap.c << 'END-of-ibm8514/brcCmap.c'
X/*
X * Copyright IBM Corporation 1987,1990
X *
X * All Rights Reserved
X *
X * Permission to use, copy, modify, and distribute this software and its
X * documentation for any purpose and without fee is hereby granted,
X * provided that the above copyright notice appear in all copies and that 
X * both that copyright notice and this permission notice appear in
X * supporting documentation, and that the name of IBM not be
X * used in advertising or publicity pertaining to distribution of the
X * software without specific, written prior permission.
X *
X * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
X * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
X * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
X * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
X * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
X * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
X * SOFTWARE.
X *
X*/
X/*
X * PRPQ 5799-PFF (C) COPYRIGHT IBM CORPORATION 1987,1990
X * LICENSED MATERIALS - PROPERTY OF IBM
X * REFER TO COPYRIGHT INSTRUCTIONS FORM NUMBER G120-2083
X */
X/*
X *  Hardware interface routines for IBM 8514/A adapter for
X *  X.11 server(s) on IBM equipment.
X *
X */
X/* $Header:
/andrew/X11/r3src/release/server/ddx/ibm/ibm8514/RCS/brcCmap.c,v 6.5
89/03/01 15:55:22 paul Exp $ */
X/* $Source:
/andrew/X11/r3src/release/server/ddx/ibm/ibm8514/RCS/brcCmap.c,v $ */
X
X#ifndef lint
Xstatic char *rcsid = "$Header:
/andrew/X11/r3src/release/server/ddx/ibm/ibm8514/RCS/brcCmap.c,v 6.5
89/03/01 15:55:22 paul Exp $" ;
X#endif
X
X#include "X.h"
X#include "screenint.h"
X#include "scrnintstr.h"
X
X#include "OScompiler.h"
X
X#include "x8514.h"
X
X#include "ibmTrace.h"
X
Xextern int ibm8514NumberOfPlanes ;
X
Xvoid
Xibm8514SetColor( number, r, g, b, pVisual )
Xregister unsigned long int number ;
Xregister unsigned short int r, g, b ;
XVisualPtr pVisual ;
X{
XTRACE( ( "ibm8514SetColor(num=%d,r=%d,g=%d,b=%d)\n", number, r, g, b ) ) ;
X
X	if ( number > pVisual->ColormapEntries )
X		return ;
X
X	r >>= 10 ;
X	g >>= 10 ; /* only top 6 bits sent to 8514 */
X	b >>= 10 ;
X
X	if ( ibm8514NumberOfPlanes == 8 ) {
X		/* FOLLOWING OPS ARE BYTE OUTS!!! */
X		ibm8514ClearQueue( 5 ) ;
X		outb( PALWRITE_ADDR, number ) ;
X		outb( PALMASK, 0xFFFF ) ;   /* enable all color bits */
X		outb( PALDATA, (unsigned char) r ) ;
X		outb( PALDATA, (unsigned char) g ) ;
X		outb( PALDATA, (unsigned char) b ) ;
X	}
X	else {
X		register unsigned int top ;
X		for ( top = 0 ; top < 16 ; top++ ) {
X			ibm8514ClearQueue( 5 ) ;
X			outb( PALWRITE_ADDR, ( top << 4 ) + number ) ;
X			outb( PALMASK, 0xFFFF ) ;   /* enable all color bits */
X			outb( PALDATA, (unsigned char) r ) ;
X			outb( PALDATA, (unsigned char) g ) ;
X			outb( PALDATA, (unsigned char) b ) ;
X		}
X	}
X	return ;
X}
END-of-ibm8514/brcCmap.c
exit

mlewis@dolphin.tcspa.ibm.com (Mark S. Lewis) (03/13/90)

Subject: IBM 8514 source code (part 2 of 6) for X11 Release 4
Index: ../mit/server/ddx/ibm/ibm8514

Description:	
IBM has decided to provide X11 source code for the 8514 display
adapter.  This is the same code used to build the object files
included in the X11 Release 4 distribution.  This code supports
servers for both AIX and IBM/4.3 on their respective platforms.

	V1.32_kit.1	59,103 Bytes
	V1.32_kit.2	61,796 Bytes
	V1.32_kit.3	60,982 Bytes
	V1.32_kit.4	62,729 Bytes
	V1.32_kit.5	54,871 Bytes
	V1.32_kit.6	29,170 Bytes

Installation:	
This code is provided in a 6-part shell archive.  Before you
install it, you should save your current code.  You should save
the Imakefile in the ibm server directory.  You also should save
the entire ibm8514 directory by moving and remaking it.

	cd ../mit/server/ddx/ibm
	cp Imakefile Imakefile.orig
	mv ibm8514 ibm8514.orig
	mkdir ibm8514
	
Next, edit this header from each part, and feed the rest to
/bin/sh.  Proceed to make the server as instructed in the
X11 release notes.

	sh < V1.32_kit.2

=====-----     Mark S. Lewis, IBM AWD Palo Alto    -----======
inet: mlewis%ibmsupt@uunet.uu.net		(415) 855-4486
uucp: uunet!ibmsupt!mlewis              IBM Tie Line: 465-4486

# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
#
#	ibm8514/brcCurs.c
#	ibm8514/brcDLine.c
#	ibm8514/brcDash.c
#	ibm8514/brcData.c
#
echo x - ibm8514/brcCurs.c
sed 's/^X//' >ibm8514/brcCurs.c << 'END-of-ibm8514/brcCurs.c'
X/*
X * Copyright IBM Corporation 1987,1990
X *
X * All Rights Reserved
X *
X * Permission to use, copy, modify, and distribute this software and its
X * documentation for any purpose and without fee is hereby granted,
X * provided that the above copyright notice appear in all copies and that 
X * both that copyright notice and this permission notice appear in
X * supporting documentation, and that the name of IBM not be
X * used in advertising or publicity pertaining to distribution of the
X * software without specific, written prior permission.
X *
X * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
X * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
X * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
X * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
X * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
X * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
X * SOFTWARE.
X *
X*/
X/*
X * PRPQ 5799-PFF (C) COPYRIGHT IBM CORPORATION 1987,1990
X * LICENSED MATERIALS - PROPERTY OF IBM
X * REFER TO COPYRIGHT INSTRUCTIONS FORM NUMBER G120-2083
X */
X/*
X *  Hardware interface routines for IBM 8514/A adapter for
X *  X.11 server(s) on IBM equipment.
X *
X */
X/* $Header:
/andrew/X11/r3src/r3plus/server/ddx/ibm/ibm8514/RCS/brcCurs.c,v 6.8
89/07/27 17:48:58 jeff Exp $ */
X/* $Source:
/andrew/X11/r3src/r3plus/server/ddx/ibm/ibm8514/RCS/brcCurs.c,v $ */
X
X#ifndef lint
Xstatic char *rcsid = "$Header:
/andrew/X11/r3src/r3plus/server/ddx/ibm/ibm8514/RCS/brcCurs.c,v 6.8
89/07/27 17:48:58 jeff Exp $" ;
X#endif
X
X/*
X * Software Cursor implementation for 8514/A
X *
X * Depends on owning some off-screen memory in SAVELOC, etc #defined areas
X */
X
X#include "X.h"
X#include "Xmd.h"
X#include "miscstruct.h"
X#include "scrnintstr.h"
X#include "cursorstr.h"
X#include "pixmapstr.h"
X#include "colormapst.h"
X
X#include "ibmScreen.h"
X#include "ibmColor.h"
X
X#include "ppc.h"
X
X#include "x8514.h"
X
X#include "OScompiler.h"
X#include "ibmTrace.h"
X#include "../../mfb/maskbits.h"
X
Xvoid ibm8514ReplaceCursor();
X
Xextern ibmPerScreenInfo ibm8514ScreenInfoStruct ; /* From brcScrInfo.c */
X
X#define CURBLIT( COL, X0, Y0, X1, Y1, LX, LY )	\
X	{				\
X   	ibm8514CheckQueue( 8 ) ;	\
X	SETCOL1( COL ) ;		\
X	SETX0( X0 ) ;			\
X	SETY0( Y0 ) ;			\
X	SETX1( X1 ) ;			\
X	SETY1( Y1 ) ;			\
X	SETLX( LX - 1 ) ;		\
X	SETLY( LY - 1 ) ;		\
X	COMMAND( 0xC0F3 ) ;		\
X	}
X
X/* Global Cursor State Semaphore */
Xint ibm8514cursorSemaphore = 0 ;
X
Xstatic short int c_x = 0 ;
Xstatic short int c_y = 0 ;
Xstatic unsigned long int c_fg = 255 ;
Xstatic unsigned long int c_bg = 0 ;
Xstatic int active = FALSE ;
Xstatic int cursor_not_displayed = FALSE ;
Xstatic int curs_fore_r, curs_fore_g, curs_fore_b,
X	   curs_back_r, curs_back_g, curs_back_b ;
Xstatic int current_w = 32 ;
Xstatic int current_h = 32 ;
X
Xstatic void
Xibm8514CBitblt( x0, y0, x1, y1 )
Xregister int x0, y0, x1, y1 ;
X{
X/* TRACE( ( "ibm8514CBitblt:x0=%d,y0=%d,x1=%d,y1=%d\n",
X	  x0, y0, x1, y1 ) ) ; */
X
X   ibm8514ATRNotBusy ;
X   ibm8514CheckQueue( 4 ) ;
X   SETFN1( FNCPYRCT, FNREPLACE ) ;
X   SETX0( x0 ) ;
X   SETY0( y0 ) ;
X   SETX1( x1 ) ;
X
X   ibm8514CheckQueue( 4 ) ;
X   SETY1( y1 ) ;
X   SETLX( current_w - 1 ) ;
X   SETLY( current_h - 1 ) ;
X   COMMAND( 0xC0F3 ) ;
X
X   ibm8514CheckQueue( 1 ) ;
X   SETFN1( FNCOLOR1, FNREPLACE ) ;
X
X   return ;
X}
X
Xvoid
Xibm8514RemoveCursor()
X{
X/* TRACE(("ibm8514RemoveCursor()\n")) ; */
X   active = FALSE ;
X   ibm8514CBitblt( SAVELOCX, SAVELOCY,
X		   c_x - ibm8514ScreenInfoStruct.ibm_CursorHotX,
X		   c_y - ibm8514ScreenInfoStruct.ibm_CursorHotY ) ;
X   return ;
X}
X
Xstatic void
Xibm8514Overlay( x, y )
Xregister short x, y ;
X{
X/*   TRACE(("ibm8514Overlay(%d,%d)\n",x,y)) ; */
X
X   ibm8514ATRNotBusy ;
X   ibm8514CheckQueue( 5 ) ;
X   SETFN0( FNCOLOR0, FNNOP ) ;
X   SETFN1( FNCOLOR1, FNREPLACE ) ;
X   PLNRENBL( RPLANE0 ) ;
X   SETMODE( M_CPYRCT ) ;
X   SETYMAX( _8514_SCREENHEIGHT - 1 ) ;
X
X   ibm8514ATRNotBusy ;
X   CURBLIT( c_fg, CUR1LOCX, CUR1LOCY, x, y, current_w, current_h ) ;
X   ibm8514ATRNotBusy ;
X   CURBLIT( c_bg, CUR0LOCX, CUR0LOCY, x, y, current_w, current_h ) ;
X
X   ibm8514CheckQueue( 4 ) ;
X   SETYMAX( 1023 ) ;
X   PLNRENBL( RPLANES ) ;
X   SETFN0( FNCOLOR0, FNREPLACE ) ;
X   SETMODE( M_ONES ) ;
X
X   return ;
X}
X
X/***============================================================***/
X
Xvoid
Xibm8514CursorInit( index )
Xregister int index ;
X{
X    TRACE( ( "ibm8514CursorInit(%d)\n", index ) ) ;
X
X    c_x = 0 ;
X    c_y = 0 ;
X    active = FALSE ;
X    ibm8514cursorSemaphore = 0 ;
X    cursor_not_displayed = FALSE ;
X    return ;
X}
X
X/***============================================================***/
X
XBool
Xibm8514RealizeCursor( pScr, pCurs )
X    ScreenPtr	pScr ;
X    CursorPtr	pCurs ;
X{
X    register unsigned long int tmpMask ;
X    register unsigned long int endbits ;
X    unsigned long int *pFG, *pBG ;
X    unsigned long int *psrcImage, *psrcMask ;
X    int srcWidth ;
X    int srcHeight ;
X    int srcRealWidth ;
X
X    TRACE( ( "ibm8514RealizeCursor(pScr=0x%x,pCurs=0x%x)\n", pScr, pCurs ) ) ;
X    if ( !( ( pCurs->devPriv[ pScr->myNum ] = (pointer) Xalloc( 256 ) ) ) ) {
X	ErrorF( "ibm8514RealizeCursor: can't malloc\n" ) ;
X	return FALSE ;
X    }
X    pFG = (unsigned long int *) pCurs->devPriv[pScr->myNum] ;
X    pBG = pFG + 32 ; /* words */
X    bzero( (char *) pFG, 256 ) ;
X    psrcImage = (unsigned long int *) pCurs->bits->source ;
X    psrcMask = (unsigned long int *) pCurs->bits->mask ;
X    srcRealWidth = ( pCurs->bits->width + 31 ) / 32 ;
X
X    srcWidth  = MIN( pCurs->bits->width, 32 ) ;
X    srcHeight = MIN( pCurs->bits->height, 32 ) ;
X
X    endbits = ( srcWidth == 32 ) ? 0xFFFFFFFF : SCRLEFT( -1, (32-srcWidth) );
X
X    while ( srcHeight-- ) {
X	tmpMask = *psrcMask &= endbits ;
X	*pFG++ = (*psrcImage) & tmpMask ;
X	*pBG++ = (~(*psrcImage)) & tmpMask ;
X	psrcImage += srcRealWidth ;
X	psrcMask  += srcRealWidth ;
X    }
X
X    return TRUE ;
X}
X
X/***============================================================***/
X
XBool
Xibm8514UnrealizeCursor( pScr, pCurs )
X    register ScreenPtr pScr ;
X    register CursorPtr pCurs ;
X{
X    TRACE( ( "ibm8514UnrealizeCursor(pScr=0x%x,pCurs=0x%x)\n",
X	   pScr, pCurs ) ) ;
X
X    Xfree( pCurs->devPriv[ pScr->myNum ] ) ;
X    pCurs->devPriv[ pScr->myNum ] = 0 ;
X    return TRUE ;
X}
X
Xvoid
Xibm8514ColorCursor( fg, bg )
Xregister unsigned long int fg, bg ;
X{
XTRACE( ( "ibm8514ColorCursor(%d,%d)\n", fg, bg ) ) ;
Xif ( ( fg > 255 ) || ( bg > 255 ) ) {
X	ErrorF( "ibm8514ColorCursor: bad color value(s)(fg/bg)=(%d,%d)",
X		fg, bg ) ;
X	return ;
X}
Xc_fg = fg ;
Xc_bg = bg ;
X
Xreturn ;
X}
X
Xvoid
Xibm8514RecolorCursor( cmap )
Xregister ColormapPtr cmap ;
X{
Xc_fg = ibmFindColor( cmap, curs_fore_r, curs_fore_g, curs_fore_b ) ;
Xc_bg = ibmFindColor( cmap, curs_back_r, curs_back_g, curs_back_b ) ;
Xif ( active && ( !cursor_not_displayed ) )
X	{
X	ibm8514RemoveCursor();
X	cursor_not_displayed = TRUE;
X	ibm8514ReplaceCursor();
X	}
Xreturn ;
X}
X
X/***============================================================***/
X
Xvoid
Xibm8514ShowCursor( x, y )
Xint x, y ;
X{
Xregister int xloc, yloc ;
X
X/* TRACE(("ibm8514ShowCursor(x=%d, y=%d)\n",x, y)) ; */
X   if ( active )
X	ibm8514RemoveCursor() ;
X
X   xloc = ( c_x = x ) - ibm8514ScreenInfoStruct.ibm_CursorHotX ;
X   yloc = ( c_y = y ) - ibm8514ScreenInfoStruct.ibm_CursorHotY ;
X   ibm8514CBitblt( xloc, yloc, SAVELOCX, SAVELOCY ) ;
X   ibm8514Overlay( xloc, yloc ) ;
X   active = TRUE ;
X   return ;
X}
X
Xint
Xibm8514DisplayCursor( pScr, pCurs )
X    register ScreenPtr pScr ;
X    register CursorPtr pCurs ;
X{
X    int *curdef ;
X
X    TRACE( ( "ibm8514DisplayCursor(pScr=0x%x,pCurs=0x%x)\n", pScr, pCurs ) ) ;
X
X    if ( active )
X	ibm8514RemoveCursor() ;
X    curdef = (int *) pCurs->devPriv[ pScr->myNum] ;
X
X    ibm8514ScreenInfoStruct.ibm_CursorHotX = pCurs->bits->xhot ;
X    ibm8514ScreenInfoStruct.ibm_CursorHotY = pCurs->bits->yhot ;
X    ibm8514ScreenInfoStruct.ibm_CurrentCursor = pCurs ;
X
X    curs_fore_r = pCurs->foreRed ;
X    curs_fore_g = pCurs->foreGreen ;
X    curs_fore_b = pCurs->foreBlue ;
X    curs_back_r = pCurs->backRed ;
X    curs_back_g = pCurs->backGreen ;
X    curs_back_b = pCurs->backBlue ;
X
X    ibm8514RecolorCursor(
X		( (ppcScrnPrivPtr) pScr->devPrivate )->InstalledColormap ) ;
X
X    ibm8514AlignMonoImage( ibm8514ALLPLANES, GXcopy, C1X, C1Y,
X			   CURD_X, CURD_Y, curdef ) ;
X    ibm8514AlignMonoImage( ibm8514ALLPLANES, GXcopy, C0X, C0Y,
X			   CURD_X, CURD_Y, curdef + 32 ) ;
X
X    current_w = MIN( pCurs->bits->width, CURD_X ) ;
X    current_h = MIN( pCurs->bits->height, CURD_Y ) ;
X
X    ibm8514ShowCursor( c_x, c_y ) ;
X    return TRUE ;
X}
X
Xint
Xibm8514CheckCursor( x, y, lx, ly )
Xregister const int x, y, lx, ly ;
X{
X/* check if the cursor is in this rectangle.  if so, remove and return TRUE
X    else return FALSE */
X
Xif ( !ibm8514cursorSemaphore && active
X  && ( cursor_not_displayed == FALSE )
X  && !( ( x > ( c_x + current_w ) )
X     || ( y > ( c_y + current_h ) )
X     || ( ( x + lx ) < ( c_x - current_w ) )
X     || ( ( y + ly ) < ( c_y - current_h ) ) ) ) {
X	ibm8514RemoveCursor() ;
X	return cursor_not_displayed = TRUE ;
X}
Xelse
X	return FALSE ;
X/*NOTREACHED*/
X}
X
Xvoid
Xibm8514ReplaceCursor()
X{
Xif ( cursor_not_displayed && !ibm8514cursorSemaphore ) {
X	ibm8514ShowCursor( c_x, c_y ) ;
X	cursor_not_displayed = FALSE ;
X	return ;
X}
X
Xreturn ;
X}
END-of-ibm8514/brcCurs.c
echo x - ibm8514/brcDLine.c
sed 's/^X//' >ibm8514/brcDLine.c << 'END-of-ibm8514/brcDLine.c'
X/*
X * Copyright IBM Corporation 1987,1990
X *
X * All Rights Reserved
X *
X * Permission to use, copy, modify, and distribute this software and its
X * documentation for any purpose and without fee is hereby granted,
X * provided that the above copyright notice appear in all copies and that 
X * both that copyright notice and this permission notice appear in
X * supporting documentation, and that the name of IBM not be
X * used in advertising or publicity pertaining to distribution of the
X * software without specific, written prior permission.
X *
X * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
X * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
X * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
X * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
X * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
X * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
X * SOFTWARE.
X *
X*/
X/*
X * PRPQ 5799-PFF (C) COPYRIGHT IBM CORPORATION 1987,1990
X * LICENSED MATERIALS - PROPERTY OF IBM
X * REFER TO COPYRIGHT INSTRUCTIONS FORM NUMBER G120-2083
X */
X/*
X *  Hardware interface routines for IBM 8514/A adapter for
X *  X.11 server(s) on IBM equipment.
X *
X */
X
X/***********************************************************
XCopyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
Xand the Massachusetts Institute of Technology, Cambridge, Massachusetts.
X
X                        All Rights Reserved
X
XPermission to use, copy, modify, and distribute this software and its 
Xdocumentation for any purpose and without fee is hereby granted, 
Xprovided that the above copyright notice appear in all copies and that
Xboth that copyright notice and this permission notice appear in 
Xsupporting documentation, and that the names of Digital or MIT not be
Xused in advertising or publicity pertaining to distribution of the
Xsoftware without specific, written prior permission.  
X
XDIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
XALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
XDIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
XANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
XWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
XARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
XSOFTWARE.
X
X******************************************************************/
X
X/* $Header:
/andrew/X11/r3src/earlyRelease/server/ddx/ibm/ibm8514/RCS/brcDLine.c,v
6.2 88/11/16 18:44:54 paquin Exp $ */
X/* $Source:
/andrew/X11/r3src/earlyRelease/server/ddx/ibm/ibm8514/RCS/brcDLine.c,v $ */
X
X#ifndef lint
Xstatic char *rcsid = "$Header:
/andrew/X11/r3src/earlyRelease/server/ddx/ibm/ibm8514/RCS/brcDLine.c,v
6.2 88/11/16 18:44:54 paquin Exp $";
X#endif
X
X
X#include "X.h"
X
X#include "misc.h"
X#include "gcstruct.h"
X#include "gc.h"
X#include "pixmap.h"
X#include "window.h"
X#include "windowstr.h"
X#include "pixmapstr.h"
X#include "regionstr.h"
X#include "scrnintstr.h"
X#include "mistruct.h"
X
X#include "mfb.h"
X#include "ppc.h"
X#include "ppcUtils.h"
X
X#include "x8514.h"
X
X/* ibm8514 dashed line
X *
X */
X
Xextern void ibm8514BresDash();
Xextern void ibm8514HorzDash();
Xextern void ibm8514VertDash();
Xextern void ibm8514BresLineStart();
Xextern void ibm8514BresLineCont();
Xextern void ibm8514BresLineStop();
X
Xextern void ibm8514HorzDashPat();
Xextern void ibm8514BresDashPat();
X
X#define X_AXIS 0
X
Xextern int mergexlate[];
Xextern int ibm8514cursorSemaphore ;
X
X/* NOTE
X   maybe OUTCODES should take box (the one that includes all
Xedges) instead of pbox (the standard no-right-or-lower-edge one)?
X*/
X#define OUTCODES(result, x, y, pbox) \
X    if (x < pbox->x1) \
X	result |= OUT_LEFT; \
X    else if (x >= pbox->x2) \
X	result |= OUT_RIGHT; \
X    if (y < pbox->y1) \
X	result |= OUT_ABOVE; \
X    else if (y >= pbox->y2) \
X	result |= OUT_BELOW;
X
Xvoid
Xibm8514ZeroDash(pDrawable, pGC, mode, npt, pptInit)
X    DrawablePtr pDrawable;
X    GCPtr pGC;
X    int mode;		/* Origin or Previous */
X    int npt;		/* number of points */
X    DDXPointPtr pptInit;
X{
X    int nboxInit;
X    register int nbox;
X    BoxPtr pboxInit;
X    register BoxPtr pbox;
X    int nptTmp;
X    DDXPointPtr ppt;		/* pointer to list of translated points */
X
X    DDXPointRec pt1;
X    DDXPointRec pt2;
X
X    unsigned int oc1;		/* outcode of point 1 */
X    unsigned int oc2;		/* outcode of point 2 */
X
X    int xorg, yorg;		/* origin of window */
X
X    int adx;		/* abs values of dx and dy */
X    int ady;
X    int signdx;		/* sign of dx and dy */
X    int signdy;
X    int e, e1, e2;		/* bresenham error and increments */
X    int len;			/* length of segment */
X
X    int clipDone;		/* flag for clipping loop */
X    DDXPointRec pt1Orig;	/* unclipped start point */
X    DDXPointRec pt2Orig;	/* unclipped end point */
X    int err;			/* modified bresenham error term */
X    int clip1, clip2;		/* clippedness of the endpoints */
X
X    int alu ;			/* Screen Raster-Op value */
X    long fg ;			/* foreground Pixel value */
X    long bg ;			/* background Pixel value */
X    unsigned long pm ;			/* plane mask */
X    register int tmp;
X    int x1, x2, y1, y2;
X				/* a bunch of temporaries */
X    void (* scrnFunc)();
X#ifdef notyet
X    int hardware_pat =
X	((ibm8514GCPrivPtr)(pGC->devPriv))->flags & HARDWARE_PAT;
X#endif
X
X    if ( pDrawable->type != DRAWABLE_WINDOW )
X    {
X	ErrorF("ibm8514ZeroDash: not a window\n");
X	return;
X    }
X
X    switch ( ( (ppcPrivGC *) pGC->devPriv )->colorRrop.fillStyle ) {
X	case FillSolid : /* Can Use Optimized Color Raster-Op */
X	    alu = ( (ppcPrivGC *) pGC->devPriv )->colorRrop.alu ;
X	    pm = ( (ppcPrivGC *) pGC->devPriv )->colorRrop.planemask ;
X	    if(pGC->lineStyle == LineOnOffDash){
X		ibm8514ClearQueue(1);
X		SETCOL1( ( (ppcPrivGC *) pGC->devPriv )->colorRrop.fgPixel) ;
X	    } else {
X	    	fg = ( (ppcPrivGC *) pGC->devPriv )->colorRrop.fgPixel ;
X	    	bg = ( (ppcPrivGC *) pGC->devPriv )->colorRrop.bgPixel ;
X	    }
X	    break ;
X	case FillTiled : /* Can't Use Optimized Color Raster-Op */
X	    alu = pGC->alu ;
X	    pm = pGC->planemask ;
X	    if(pGC->lineStyle == LineOnOffDash){
X		ibm8514ClearQueue(1);
X		SETCOL1(pGC->fgPixel);
X	    } else {
X	    	fg = pGC->fgPixel ;
X	    	bg = pGC->bgPixel ;
X	    }
X	    break ;
X    }
X    if ( alu == GXnoop )
X	return ;
X
X    pboxInit = ((mfbPrivGC *)(pGC->devPriv))->pCompositeClip->rects;
X    nboxInit = ((mfbPrivGC *)(pGC->devPriv))->pCompositeClip->numRects;
X
X    xorg = ((WindowPtr)pDrawable)->absCorner.x;
X    yorg = ((WindowPtr)pDrawable)->absCorner.y;
X
X    /* translate the point list */
X    ppt = pptInit;
X    nptTmp = npt;
X    if (mode == CoordModeOrigin)
X    {
X	while(nptTmp--)
X	{
X	    ppt->x += xorg;
X	    ppt++->y += yorg;
X	}
X    }
X    else
X    {
X	ppt->x += xorg;
X	ppt->y += yorg;
X	nptTmp--;
X	while ( nptTmp-- )
X	{
X	    ppt++;
X	    ppt->x += (ppt-1)->x;
X	    ppt->y += (ppt-1)->y;
X	}
X    }
X
X    ppt = pptInit;
X    while ( --npt )
X    {
X	nbox = nboxInit;
X	pbox = pboxInit;
X
X	pt1 = *ppt++;
X	pt2 = *ppt;
X
X	if ( !( adx = ( pt2.x - pt1.x ) ) )
X	{
X	    /* make the line go top to bottom of screen, keeping
X	       endpoint semantics
X	    */
X	    if ( pt1.y > pt2.y )
X	    {
X		tmp = pt2.y;
X		pt2.y = pt1.y + 1;
X		pt1.y = tmp + 1;
X	    }
X
X	    /* get to first band that might contain part of line */
X	    while ((nbox) && (pbox->y2 <= pt1.y))
X	    {
X		pbox++;
X		nbox--;
X	    }
X
X	    if ( nbox )
X	    {
X		/* stop when lower edge of box is beyond end of line */
X		while ( ( nbox ) && ( pt2.y >= pbox->y1 ) ) {
X		    if ( ( pt1.x >= pbox->x1 ) && ( pt1.x < pbox->x2 ) ) {
X			/* this box has part of the line in it */
X			if ( ( y1 = MAX( pt1.y, pbox->y1 ) )
X			  != ( y2 = MIN( pt2.y, pbox->y2 ) ) ) {
X			    ibm8514VertDash( pGC, fg, bg,
X				alu, pm, pt1.x, y1, y2 - y1 ) ;
X			}
X		    }
X		    nbox--;
X		    pbox++;
X		}
X	    }
X
X	}
X	else if ( !( ady = ( pt2.y - pt1.y ) ) )
X	{
X	    /* force line from left to right, keeping
X	       endpoint semantics
X	    */
X	    if (pt1.x > pt2.x)
X	    {
X		tmp = pt2.x;
X		pt2.x = pt1.x + 1;
X		pt1.x = tmp + 1;
X	    }
X
X	    /* find the correct band */
X	    while( nbox && (pbox->y2 <= pt1.y))
X	    {
X		pbox++;
X		nbox--;
X	    }
X
X	    /* try to draw the line, if we haven't gone beyond it */
X	    if ((nbox) && (pbox->y1 <= pt1.y))
X	    {
X		/* when we leave this band, we're done */
X		tmp = pbox->y1;
X		while((nbox) && (pbox->y1 == tmp))
X		{
X		    if (pbox->x2 <= pt1.x)
X		    {
X			/* skip boxes until one might contain start point */
X			nbox--;
X			pbox++;
X			continue;
X		    }
X
X		    /* stop if left of box is beyond right of line */
X		    if (pbox->x1 >= pt2.x)
X		    {
X			nbox = 0;
X			continue;
X		    }
X		    if ( ( x1 = MAX( pt1.x, pbox->x1 ) )
X		      != ( x2 = MIN( pt2.x, pbox->x2 ) ) ) {
X#ifdef notyet
X			    if(hardware_pat)
X			    	ibm8514HorzDashPat( pGC, fg, bg,
X					alu, pm, x1, pt1.y, x2 - x1 ) ;
X			    else
X#endif
X			    	ibm8514HorzDash( pGC, fg, bg,
X					alu, pm, x1, pt1.y, x2 - x1 ) ;
X		    }
X		    nbox--;
X		    pbox++;
X		}
X	    }
X	}
X	else	/* sloped line */
X	{
X	    signdx = sign(adx);
X	    signdy = sign(ady);
X	    adx = ABS(adx);
X	    ady = ABS(ady);
X
X	    if (adx > ady)
X	    {
X		e1 = ady*2;
X		e2 = e1 - 2*adx;
X		e = e1 - adx;
X
X	    }
X	    else
X	    {
X		e1 = adx*2;
X		e2 = e1 - 2*ady;
X		e = e1 - ady;
X	    }
X
X	    /* we have bresenham parameters and two points.
X	       all we have to do now is clip and draw.
X	    */
X
X	    pt1Orig = pt1;
X	    pt2Orig = pt2;
X
X	    while(nbox--)
X	    {
X
X		BoxRec box;
X
X		pt1 = pt1Orig;
X		pt2 = pt2Orig;
X		clipDone = 0;
X		box.x1 = pbox->x1;
X		box.y1 = pbox->y1;
X		box.x2 = pbox->x2-1;
X		box.y2 = pbox->y2-1;
X		clip1 = 0;
X		clip2 = 0;
X
X		oc1 = 0;
X		oc2 = 0;
X		OUTCODES(oc1, pt1.x, pt1.y, pbox);
X		OUTCODES(oc2, pt2.x, pt2.y, pbox);
X
X		if (oc1 & oc2)
X		    clipDone = -1;
X		else if ((oc1 | oc2) == 0)
X		    clipDone = 1;
X		else /* have to clip */
X		    clipDone = mfbClipLine(pbox, box,
X					   &pt1Orig, &pt1, &pt2, 
X					   adx, ady, signdx, signdy,
X					   ( ( adx > ady ) ? X_AXIS : Y_AXIS ),
X					   &clip1, &clip2);
X
X		if (clipDone == -1)
X		{
X		    pbox++;
X		}
X		else
X		{
X		    if ( adx > ady )
X			len = ABS(pt2.x - pt1.x);
X		    else
X			len = ABS(pt2.y - pt1.y);
X
X		    len += (clip2 != 0);
X		    if (len)
X		    {
X			/* unwind bresenham error term to first point */
X			if (clip1)
X			{
X			    if ( adx > ady )
X			        err = e
X				    + ( ABS( pt1.y - pt1Orig.y ) * ( e2 - e1 ) )
X				    + ( ABS( pt1.x - pt1Orig.x ) * e1 ) ;
X			    else
X			        err = e
X				    + ( ABS( pt1.x - pt1Orig.x ) * ( e2 - e1 ) )
X				    + ( ABS( pt1.y - pt1Orig.y ) * e1 ) ;
X			}
X			else
X			    err = e;
X			ibm8514BresDash( pGC, fg, bg, alu, pm,
X				      signdx, signdy,
X				      ( ( adx > ady ) ? X_AXIS : Y_AXIS ),
X				      pt1.x, pt1.y, err, e1, e2, len ) ;
X		    }
X
X		    /* if segment is unclipped, skip remaining rectangles */
X		    if (!(clip1 || clip2))
X			break;
X		    else
X			pbox++;
X		}
X	    } /* while (nbox--) */
X	} /* sloped line */
X    } /* while (nline--) */
X
X    /* paint the last point if the end style isn't CapNotLast.
X       (Assume that a projecting, butt, or round cap that is one
X        pixel wide is the same as the single pixel of the endpoint.)
X    */
X
X    if ((pGC->capStyle != CapNotLast) &&
X	((ppt->x != pptInit->x) ||
X	 (ppt->y != pptInit->y)))
X    {
X	nbox = nboxInit;
X	pbox = pboxInit;
X	scrnFunc =
X	 ( (ppcScrnPriv *)(pDrawable->pScreen->devPrivate))->solidFill ;
X	while (nbox--)
X	{
X	    if ((ppt->x >= pbox->x1) &&
X		(ppt->y >= pbox->y1) &&
X		(ppt->x <  pbox->x2) &&
X		(ppt->y <  pbox->y2))
X	    {
X		(* scrnFunc)( fg, alu, pm, ppt->x, ppt->y, 1, 1 ) ;
X		break;
X	    }
X	    else
X		pbox++;
X	}
X    }
X    return ;
X}
X
Xvoid
Xibm8514VertDash(pGC, fg, bg, alu, pm, x, y, len)
XGCPtr pGC;
Xlong fg;
Xlong bg;
Xint alu;
Xint pm;
Xint x;
Xint y;
Xint len;
X{
X	int talu = alu;
X	long color = fg;
X	int nseg;			/* number of dashed segments */
X	miDashPtr pdash;		/* list of dashes */
X	miDashPtr pdashInit;
X	DDXPointRec pt[2];
X	DDXPointRec pt1, pt2;
X	int lx;
X
X	pt[0].x = x;
X	pt[0].y = y;
X	pt[1].x = x;	
X	pt[1].y = y + len;
X
X	pdashInit = pdash = miDashLine( 2, pt, pGC->numInDashList,
X		pGC->dash, pGC->dashOffset, &nseg ) ;
X
X	ibm8514ClearQueue(1);
X	PLNWENBL(pm);
X
X	for(; nseg--; pdash++){
X		ibm8514ClearQueue(2);
X		if(pGC->lineStyle == LineOnOffDash){
X			if(pdash->which == ODD_DASH)
X				SETFN1(FNCOLOR1,mergexlate[alu]);
X			else 
X				SETFN1(FNCOLOR1,mergexlate[GXnoop]);
X		} else {
X			if(pdash->which == EVEN_DASH)
X				SETCOL1(fg);
X			else
X				SETCOL1(bg);
X		}
X
X		pt1 = pdash->pt;
X		pt2 = (pdash+1)->pt;
X
X		if (lx = (pt2.y - pt1.y))  /* SIC */
X			{
X			ibm8514ClearQueue(4);
X			SETLX(lx);
X			SETX0(pt1.x);
X			SETY0(pt1.y);
X			COMMAND(0x20df);
X			}
X	}
X	Xfree(pdashInit);
X}
X
X#ifdef notyet
Xvoid
Xibm8514HorzDashPat(pGC, fg, bg, alu, pm, x, y, len)
XGCPtr pGC;
Xlong fg;
Xlong bg;
Xint alu;
Xunsigned long pm;
Xint x;
Xint y;
Xint len;
X{
X	short pattern = ;
X
X	barrel_shift8(pattern, x % 8);
X	ibm8514ATRNotBusy();
X
X	ibm8514CheckQueue(4);
X	SETMODE(M_PATTS);
X	SETPAT0(pattern >> 3);
X	SETPAT1(pattern << 1);
X	PLNWENBL(pm);
X
X	ibm8514CheckQueue(4);
X	if(pGC->lineStyle == LineOnOffDash){
X		SETCOL1(fg);
X		SETFN0(FNCOLOR0,mergexlate[GXnoop]);
X		SETFN1(FNCOLOR1,mergexlate[alu]);
X	} else {
X		SETCOL0(bg);
X		SETCOL1(fg);
X		SETFN0(FNCOLOR0,mergexlate[alu]);
X		SETFN1(FNCOLOR1,mergexlate[alu]);
X	}
X	ibm8514HorzLine(color, alu, pm,
X		x, y, len);
X}
X#endif
X
Xvoid
Xibm8514HorzDash(pGC, fg, bg, alu, pm, x, y, len)
XGCPtr pGC;
Xlong fg;
Xlong bg;
Xint alu;
Xunsigned long pm;
Xint x;
Xint y;
Xint len;
X{
X	int talu = alu;
X	long color = fg;
X	int nseg;			/* number of dashed segments */
X	miDashPtr pdash;		/* list of dashes */
X	miDashPtr pdashInit;
X	DDXPointRec pt[2];
X	DDXPointRec pt1, pt2;
X	int lx;
X
X	pt[0].x = x;
X	pt[0].y = y;
X	pt[1].x = x + len;	
X	pt[1].y = y;
X
X	pdashInit = pdash = miDashLine( 2, pt, pGC->numInDashList,
X		pGC->dash, pGC->dashOffset, &nseg ) ;
X
X	ibm8514ClearQueue(1);
X	PLNWENBL(pm);
X
X	for(; nseg--; pdash++){
X		if(pGC->lineStyle == LineOnOffDash){
X			if(pdash->which == ODD_DASH)
X				talu = alu;
X			else 
X				talu = GXnoop;
X		} else {
X			if(pdash->which == EVEN_DASH)
X				color = fg;
X			else
X				color = bg;
X		}
X		pt1 = pdash->pt;
X		pt2 = (pdash+1)->pt;
X
X		if (lx = (pt2.x - pt1.x)) /* SIC */
X			{
X			ibm8514ATRNotBusy();
X			ibm8514CheckQueue(6);
X			SETFN1(FNCOLOR1,mergexlate[talu]);
X			SETCOL1(color);
X			SETLX(lx);
X			SETX0(pt1.x);
X			SETY0(pt1.y);
X			COMMAND(0x201f);
X			}
X	}
X	Xfree(pdashInit);
X}
X
Xvoid
Xibm8514BresDash( pGC, fg, bg, alu, pm, sdx, sdy, axis, x, y, et, e1, e2, len )
XGCPtr pGC;
Xunsigned long int fg, bg;
Xint alu ;
Xunsigned long int pm ;
Xint sdx, sdy, axis, x, y, et, e1, e2, len;
X{
X	int talu = alu;
X	long color = fg;
X	int nseg;			/* number of dashed segments */
X	miDashPtr pdash;		/* list of dashes */
X	miDashPtr pdashInit;
X	DDXPointRec pt[2];
X	DDXPointRec pt1, pt2;
X	int olen = len;
X
X	pt[0].x = x;
X	pt[0].y = y;
X	pt[1].x = x + len;	
X	pt[1].y = y + len;
X
X	pdashInit = pdash = miDashLine( 2, pt, pGC->numInDashList,
X		pGC->dash, pGC->dashOffset, &nseg ) ;
X
X	ibm8514ClearQueue(1);
X	PLNWENBL(pm);
X	for(; nseg--; pdash++){
X		if(pGC->lineStyle == LineOnOffDash){
X			if(pdash->which == ODD_DASH)
X				talu = alu;
X			else 
X				talu = GXnoop;
X		} else {
X			if(pdash->which == EVEN_DASH)
X				color = fg;
X			else
X				color = bg;
X		}
X		pt1 = pdash->pt;
X		pt2 = (pdash+1)->pt;
X		if ( axis == X_AXIS )
X			len = ABS(pt2.x - pt1.x);
X		else
X			len = ABS(pt2.y - pt1.y);
X
X		if(pdash->newLine)
X			ibm8514BresLineStart( color, talu, pm,
X				sdx, sdy, axis,
X				pt1.x, pt1.y , et, e1, e2, olen );
X		ibm8514BresLineCont( color, talu, pm, sdx, sdy, axis, len );
X	}
X	ibm8514BresLineStop();
X	Xfree(pdashInit);
X}
X
Xstatic int bres_saved;
X
Xvoid
Xibm8514BresLineStart( color, alu, pm, sdx, sdy, axis, x, y, et, e1, e2, len)
Xunsigned long int color ;
Xint alu ;
Xunsigned long int pm ;
Xint sdx, sdy, axis, x, y, et, e1, e2, len;
X{
X	int cx, cy;
X
X	if ( len <= 0 )
X		return;
X	if (sdx == -1)
X    		cx = x - len;
X	else
X    		cx = x;
X	if (sdy == -1)
X    		cy = y - len;
X	else
X    		cy = y;
X	bres_saved =
X		!ibm8514cursorSemaphore && ibm8514CheckCursor( cx,cy,len,len ) ;
X
X	ibm8514ATRNotBusy();
X	ibm8514CheckQueue(6);
X	PLNWENBL(pm);
X	SETET(et); 
X	SETK1(e1); 
X	SETK2(e2); 
X	SETX0(x);
X	SETY0(y);
X
X	return;
X}
X
Xvoid
Xibm8514BresLineCont( color, alu, pm, sdx, sdy, axis, len)
Xunsigned long int color ;
Xint alu ;
Xunsigned long int pm ;
Xint sdx, sdy, axis, len;
X{
X	unsigned short command;
X
X	if ( len <= 0 )
X		return;
X
X	ibm8514ATRNotBusy();
X	ibm8514CheckQueue(4);
X	SETCOL1(color);
X	SETFN1(FNCOLOR1,mergexlate[alu]);
X
X	SETLX(len); /* going to use LAST PEL NULL in Line command to brecon */
X
X	if (axis==X_AXIS)
X		command = 0x2017; /* draw bres. line on X, W, LPN, */
X	else
X		command = 0x2057; /* same, on Y */
X	if (sdx > 0)
X		command |= 0x0020;
X	if (sdy > 0)
X		command |= 0x0080;
X	COMMAND(command);
X
X	return;
X}
X
Xvoid
Xibm8514BresLineStop()
X{
X	ibm8514ATRNotBusy();
X	ibm8514CheckQueue(2);
X	SETFN1(FNCOLOR1,FNREPLACE);
X	PLNWENBL(ALLPLANES);
X
X	if (bres_saved)
X    		ibm8514ReplaceCursor();
X	return;
X}
END-of-ibm8514/brcDLine.c
echo x - ibm8514/brcDash.c
sed 's/^X//' >ibm8514/brcDash.c << 'END-of-ibm8514/brcDash.c'
X/*
X * Copyright IBM Corporation 1987,1990
X *
X * All Rights Reserved
X *
X * Permission to use, copy, modify, and distribute this software and its
X * documentation for any purpose and without fee is hereby granted,
X * provided that the above copyright notice appear in all copies and that 
X * both that copyright notice and this permission notice appear in
X * supporting documentation, and that the name of IBM not be
X * used in advertising or publicity pertaining to distribution of the
X * software without specific, written prior permission.
X *
X * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
X * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
X * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
X * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
X * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
X * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
X * SOFTWARE.
X *
X*/
X/*
X * PRPQ 5799-PFF (C) COPYRIGHT IBM CORPORATION 1987,1990
X * LICENSED MATERIALS - PROPERTY OF IBM
X * REFER TO COPYRIGHT INSTRUCTIONS FORM NUMBER G120-2083
X */
X/*
X *  Hardware interface routines for IBM 8514/A adapter for
X *  X.11 server(s) on IBM equipment.
X *
X */
X
X SYNTAX ERROR THIS LINE because I haven't finished cleaning this file for
X   timing errors.  11/16/88  paquin
X
X/***********************************************************
XCopyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
Xand the Massachusetts Institute of Technology, Cambridge, Massachusetts.
X
X                        All Rights Reserved
X
XPermission to use, copy, modify, and distribute this software and its 
Xdocumentation for any purpose and without fee is hereby granted, 
Xprovided that the above copyright notice appear in all copies and that
Xboth that copyright notice and this permission notice appear in 
Xsupporting documentation, and that the names of Digital or MIT not be
Xused in advertising or publicity pertaining to distribution of the
Xsoftware without specific, written prior permission.  
X
XDIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
XALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
XDIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
XANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
XWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
XARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
XSOFTWARE.
X
X******************************************************************/
X
X/* $Header:
/andrew/X11/r3src/earlyRelease/server/ddx/ibm/ibm8514/RCS/brcDash.c,v
6.4 88/11/16 18:45:01 paquin Exp $ */
X/* $Source:
/andrew/X11/r3src/earlyRelease/server/ddx/ibm/ibm8514/RCS/brcDash.c,v $ */
X
X#ifndef lint
Xstatic char *rcsid = "$Header:
/andrew/X11/r3src/earlyRelease/server/ddx/ibm/ibm8514/RCS/brcDash.c,v
6.4 88/11/16 18:45:01 paquin Exp $";
X#endif
X
X
X#include "X.h"
X
X#include "misc.h"
X#include "gcstruct.h"
X#include "gc.h"
X#include "pixmap.h"
X#include "window.h"
X#include "windowstr.h"
X#include "pixmapstr.h"
X#include "regionstr.h"
X#include "scrnintstr.h"
X#include "mistruct.h"
X
X#include "OScompiler.h"
X
X#include "mfb.h"
X#include "ppc.h"
X
X#include "x8514.h"
X
X#define ACCESS_PIXEL (1 << 4)
X
X#define barrel_shift8(v, s) \
X	(v = (v >> s) | (v << (8 - s)))
X
X#define HARDWARE_PATTERN 0x01
X
Xtypedef struct {
X	unsigned char	Flags;
X	unsigned short	Pattern;
X} ibm8514PrivGC;
X
Xtypedef ibm8514PrivGC *ibm8514PrivGCPtr;
X
X/* 
X * ibm8514 dashed line
X */
X
Xextern void ibm8514BresDash();
Xextern void ibm8514HorzDash();
Xextern void ibm8514VertDash();
X
X#define X_AXIS 0
X
Xextern int mergexlate[];
Xextern int ibm8514cursorSemaphore ;
X
X/* NOTE
X   maybe OUTCODES should take box (the one that includes all
Xedges) instead of pbox (the standard no-right-or-lower-edge one)?
X*/
X#define OUTCODES(result, x, y, pbox) \
X    if (x < pbox->x1) \
X	result |= OUT_LEFT; \
X    else if (x >= pbox->x2) \
X	result |= OUT_RIGHT; \
X    if (y < pbox->y1) \
X	result |= OUT_ABOVE; \
X    else if (y >= pbox->y2) \
X	result |= OUT_BELOW;
X
Xvoid
Xibm8514ZeroDash(pDrawable, pGC, mode, npt, pptInit)
X    DrawablePtr pDrawable;
X    GCPtr pGC;
X    int mode;		/* Origin or Previous */
X    int npt;		/* number of points */
X    DDXPointPtr pptInit;
X{
X    int nboxInit;
X    register int nbox;
X    BoxPtr pboxInit;
X    register BoxPtr pbox;
X    int nptTmp;
X    DDXPointPtr ppt;		/* pointer to list of translated points */
X
X    DDXPointRec pt1;
X    DDXPointRec pt2;
X
X    unsigned int oc1;		/* outcode of point 1 */
X    unsigned int oc2;		/* outcode of point 2 */
X
X    int xorg, yorg;		/* origin of window */
X
X    int adx;		/* abs values of dx and dy */
X    int ady;
X    int signdx;		/* sign of dx and dy */
X    int signdy;
X    int e, e1, e2;		/* bresenham error and increments */
X    int len;			/* length of segment */
X
X    int clipDone;		/* flag for clipping loop */
X    DDXPointRec pt1Orig;	/* unclipped start point */
X    DDXPointRec pt2Orig;	/* unclipped end point */
X    int err;			/* modified bresenham error term */
X    int clip1, clip2;		/* clippedness of the endpoints */
X
X    int alu ;			/* Screen Raster-Op value */
X    long fg ;			/* foreground Pixel value */
X    long bg ;			/* background Pixel value */
X    unsigned long pm ;			/* plane mask */
X    register int tmp;
X    int x1, x2, y1, y2;
X				/* a bunch of temporaries */
X    void (* scrnFunc)();
X
X    if ( pDrawable->type != DRAWABLE_WINDOW )
X    {
X	ErrorF("ibm8514ZeroDash: not a window\n");
X	return;
X    }
X
X    switch ( ( (ppcPrivGC *) pGC->devPriv )->colorRrop.fillStyle ) {
X	case FillSolid : /* Can Use Optimized Color Raster-Op */
X	    alu = ( (ppcPrivGC *) pGC->devPriv )->colorRrop.alu ;
X	    pm = ( (ppcPrivGC *) pGC->devPriv )->colorRrop.planemask ;
X	    if(pGC->lineStyle == LineOnOffDash){
X		ibm8514ClearQueue(1);
X		SETCOL1( ( (ppcPrivGC *) pGC->devPriv )->colorRrop.fgPixel) ;
X	    } else {
X	    	fg = ( (ppcPrivGC *) pGC->devPriv )->colorRrop.fgPixel ;
X	    	bg = ( (ppcPrivGC *) pGC->devPriv )->colorRrop.bgPixel ;
X	    }
X	    break ;
X	case FillTiled : /* Can't Use Optimized Color Raster-Op */
X	    alu = pGC->alu ;
X	    pm = pGC->planemask ;
X	    if(pGC->lineStyle == LineOnOffDash){
X		ibm8514ClearQueue(1);
X		SETCOL1(pGC->fgPixel);
X	    } else {
X	    	fg = pGC->fgPixel ;
X	    	bg = pGC->bgPixel ;
X	    }
X	    break ;
X    }
X    if ( alu == GXnoop )
X	return ;
X
X    pboxInit = ((mfbPrivGC *)(pGC->devPriv))->pCompositeClip->rects;
X    nboxInit = ((mfbPrivGC *)(pGC->devPriv))->pCompositeClip->numRects;
X
X    xorg = ((WindowPtr)pDrawable)->absCorner.x;
X    yorg = ((WindowPtr)pDrawable)->absCorner.y;
X
X    /* translate the point list */
X    ppt = pptInit;
X    nptTmp = npt;
X    if (mode == CoordModeOrigin)
X    {
X	while(nptTmp--)
X	{
X	    ppt->x += xorg;
X	    ppt++->y += yorg;
X	}
X    }
X    else
X    {
X	ppt->x += xorg;
X	ppt->y += yorg;
X	nptTmp--;
X	while ( nptTmp-- )
X	{
X	    ppt++;
X	    ppt->x += (ppt-1)->x;
X	    ppt->y += (ppt-1)->y;
X	}
X    }
X
X    ppt = pptInit;
X    while ( --npt )
X    {
X	nbox = nboxInit;
X	pbox = pboxInit;
X
X	pt1 = *ppt++;
X	pt2 = *ppt;
X
X	if ( !( adx = ( pt2.x - pt1.x ) ) )
X	{
X	    /* make the line go top to bottom of screen, keeping
X	       endpoint semantics
X	    */
X	    if ( pt1.y > pt2.y )
X	    {
X		tmp = pt2.y;
X		pt2.y = pt1.y + 1;
X		pt1.y = tmp + 1;
X	    }
X
X	    /* get to first band that might contain part of line */
X	    while ((nbox) && (pbox->y2 <= pt1.y))
X	    {
X		pbox++;
X		nbox--;
X	    }
X
X	    if ( nbox )
X	    {
X		/* stop when lower edge of box is beyond end of line */
X		while ( ( nbox ) && ( pt2.y >= pbox->y1 ) ) {
X		    if ( ( pt1.x >= pbox->x1 ) && ( pt1.x < pbox->x2 ) ) {
X			/* this box has part of the line in it */
X			if ( ( y1 = MAX( pt1.y, pbox->y1 ) )
X			  != ( y2 = MIN( pt2.y, pbox->y2 ) ) ) {
X			    ibm8514VertDash( pGC, fg, bg,
X				alu, pm, pt1.x, y1, y2 - y1 ) ;
X			}
X		    }
X		    nbox--;
X		    pbox++;
X		}
X	    }
X
X	}
X	else if ( !( ady = ( pt2.y - pt1.y ) ) )
X	{
X	    /* force line from left to right, keeping
X	       endpoint semantics
X	    */
X	    if (pt1.x > pt2.x)
X	    {
X		tmp = pt2.x;
X		pt2.x = pt1.x + 1;
X		pt1.x = tmp + 1;
X	    }
X
X	    /* find the correct band */
X	    while( nbox && (pbox->y2 <= pt1.y))
X	    {
X		pbox++;
X		nbox--;
X	    }
X
X	    /* try to draw the line, if we haven't gone beyond it */
X	    if ((nbox) && (pbox->y1 <= pt1.y))
X	    {
X		/* when we leave this band, we're done */
X		tmp = pbox->y1;
X		while((nbox) && (pbox->y1 == tmp))
X		{
X		    if (pbox->x2 <= pt1.x)
X		    {
X			/* skip boxes until one might contain start point */
X			nbox--;
X			pbox++;
X			continue;
X		    }
X
X		    /* stop if left of box is beyond right of line */
X		    if (pbox->x1 >= pt2.x)
X		    {
X			nbox = 0;
X			continue;
X		    }
X		    if ( ( x1 = MAX( pt1.x, pbox->x1 ) )
X		      != ( x2 = MIN( pt2.x, pbox->x2 ) ) ) {
X			    	ibm8514HorzDash( pGC, fg, bg,
X					alu, pm, x1, pt1.y, x2 - x1 ) ;
X		    }
X		    nbox--;
X		    pbox++;
X		}
X	    }
X	}
X	else	/* sloped line */
X	{
X	    signdx = sign(adx);
X	    signdy = sign(ady);
X	    adx = ABS(adx);
X	    ady = ABS(ady);
X
X	    if (adx > ady)
X	    {
X		e1 = ady*2;
X		e2 = e1 - 2*adx;
X		e = e1 - adx;
X
X	    }
X	    else
X	    {
X		e1 = adx*2;
X		e2 = e1 - 2*ady;
X		e = e1 - ady;
X	    }
X
X	    /* we have bresenham parameters and two points.
X	       all we have to do now is clip and draw.
X	    */
X
X	    pt1Orig = pt1;
X	    pt2Orig = pt2;
X
X	    while(nbox--)
X	    {
X
X		BoxRec box;
X
X		pt1 = pt1Orig;
X		pt2 = pt2Orig;
X		clipDone = 0;
X		box.x1 = pbox->x1;
X		box.y1 = pbox->y1;
X		box.x2 = pbox->x2-1;
X		box.y2 = pbox->y2-1;
X		clip1 = 0;
X		clip2 = 0;
X
X		oc1 = 0;
X		oc2 = 0;
X		OUTCODES(oc1, pt1.x, pt1.y, pbox);
X		OUTCODES(oc2, pt2.x, pt2.y, pbox);
X
X		if (oc1 & oc2)
X		    clipDone = -1;
X		else if ((oc1 | oc2) == 0)
X		    clipDone = 1;
X		else /* have to clip */
X		    clipDone = mfbClipLine(pbox, box,
X					   &pt1Orig, &pt1, &pt2, 
X					   adx, ady, signdx, signdy,
X					   ( ( adx > ady ) ? X_AXIS : Y_AXIS ),
X					   &clip1, &clip2);
X
X		if (clipDone == -1)
X		{
X		    pbox++;
X		}
X		else
X		{
X		    if ( adx > ady )
X			len = ABS(pt2.x - pt1.x);
X		    else
X			len = ABS(pt2.y - pt1.y);
X
X		    len += (clip2 != 0);
X		    if (len)
X		    {
X			/* unwind bresenham error term to first point */
X			if (clip1)
X			{
X			    if ( adx > ady )
X			        err = e
X				    + ( ABS( pt1.y - pt1Orig.y ) * ( e2 - e1 ) )
X				    + ( ABS( pt1.x - pt1Orig.x ) * e1 ) ;
X			    else
X			        err = e
X				    + ( ABS( pt1.x - pt1Orig.x ) * ( e2 - e1 ) )
X				    + ( ABS( pt1.y - pt1Orig.y ) * e1 ) ;
X			}
X			else
X			    err = e;
X			ibm8514BresDash( pGC, fg, bg, alu, pm,
X				      signdx, signdy,
X				      ( ( adx > ady ) ? X_AXIS : Y_AXIS ),
X				      pt1.x, pt1.y, err, e1, e2, len ) ;
X		    }
X
X		    /* if segment is unclipped, skip remaining rectangles */
X		    if (!(clip1 || clip2))
X			break;
X		    else
X			pbox++;
X		}
X	    } /* while (nbox--) */
X	} /* sloped line */
X    } /* while (nline--) */
X
X    /* paint the last point if the end style isn't CapNotLast.
X       (Assume that a projecting, butt, or round cap that is one
X        pixel wide is the same as the single pixel of the endpoint.)
X    */
X
X    if ((pGC->capStyle != CapNotLast) &&
X	((ppt->x != pptInit->x) ||
X	 (ppt->y != pptInit->y)))
X    {
X	nbox = nboxInit;
X	pbox = pboxInit;
X	scrnFunc =
X	 ( (ppcScrnPriv *)(pDrawable->pScreen->devPrivate))->solidFill ;
X	while (nbox--)
X	{
X	    if ((ppt->x >= pbox->x1) &&
X		(ppt->y >= pbox->y1) &&
X		(ppt->x <  pbox->x2) &&
X		(ppt->y <  pbox->y2))
X	    {
X		(* scrnFunc)( fg, alu, pm, ppt->x, ppt->y, 1, 1 ) ;
X		break;
X	    }
X	    else
X		pbox++;
X	}
X    }
X    return ;
X}
X
Xvoid
Xibm8514VertDash(pGC, fg, bg, alu, pm, x, y, len)
XGCPtr pGC;
Xlong fg;
Xlong bg;
Xint alu;
Xint pm;
Xint x;
Xint y;
Xint len;
X{
X	int saved;
X	int l = pGC->dash[0];
X	int n = 0;
X	int togo = len;
X	int ndash = 0;
X	int command = 0x20df | ACCESS_PIXEL;
X
X	y += pGC->dashOffset;
X
X	saved =
X		!ibm8514cursorSemaphore && ibm8514CheckCursor( x,y,1,len ) ;
X
X
X	ibm8514ATRNotBusy();
X	ibm8514CheckQueue(5);
X	PLNWENBL(pm);
X	SETCOL1(fg);
X	SETFN1(FNCOLOR1,mergexlate[alu]);
X	SETX0(x);
X	SETY0(y);
X
X	while(togo){
X		/* handle odd dash lists later */
X		if(n > pGC->numInDashList){
X			n = 0;
X		}
X		l = MIN(pGC->dash[n++], togo);
X		togo -= l;
X		if(pGC->lineStyle == LineOnOffDash){
X			if(ndash & 0x01)
X				command = 0x20df | ACCESS_PIXEL;
X			else
X				command = 0x20df  & ~ACCESS_PIXEL;
X			ibm8514ClearQueue(2);
X		} else {
X			ibm8514ClearQueue(4);
X			if(ndash & 0x01)
X				SETCOL1(bg);
X			else
X				SETCOL1(fg);
X
X			/* this appears to be a stupid line.  tfp 11/16/88 */
X			SETFN1(FNCOLOR1,mergexlate[alu]);
X		}
X		ndash++;
X
X		SETLX(l);
X		COMMAND(command);
X	}
X
X	ibm8514ClearQueue(2);
X	SETFN1(FNCOLOR1,FNREPLACE);
X	PLNWENBL(WPLANES);
X	if (saved)
X    		ibm8514ReplaceCursor();
X}
X
Xvoid
Xibm8514HorzDash(pGC, fg, bg, alu, pm, x, y, len)
XGCPtr pGC;
Xlong fg;
Xlong bg;
Xint alu;
Xunsigned long pm;
Xint x;
Xint y;
Xint len;
X{
X	int l = pGC->dash[0];
X	int n = 0;
X	int ndash = 0;
X	int  command = 0x201f | ACCESS_PIXEL;
X	ppcPrivGCPtr ppcPriv = (ppcPrivGCPtr)pGC->devPriv;
X	ibm8514PrivGCPtr ibm8514Priv = (ibm8514PrivGCPtr)ppcPriv->devPriv;
X	int togo = len;
X	int saved;
X
X	unsigned char flags = ibm8514Priv->Flags;
X	unsigned short pattern = ibm8514Priv->Pattern;
X
X	x += pGC->dashOffset;
X
X	saved =
X		!ibm8514cursorSemaphore && ibm8514CheckCursor( x,y,len,1 ) ;
X
X	ibm8514ATRNotBusy();
X	ibm8514CheckQueue(5);
X	PLNWENBL(pm);
X	SETCOL1(fg);
X	SETFN1(FNCOLOR1,mergexlate[alu]);
X	SETX0(x);
X	SETY0(y);
X	if(flags & HARDWARE_PATTERN){
X		ibm8514CheckQueue(5);
X		barrel_shift8(pattern, x % 8);
X		SETMODE(M_PATTS);
X		SETPAT0(pattern >> 3);
X		SETPAT1(pattern << 1);
X		SETCOL0(bg);
X		if(pGC->lineStyle == LineOnOffDash){
X			SETFN0(FNCOLOR0,mergexlate[GXnoop]);
X		} else {
X			SETFN0(FNCOLOR0,mergexlate[alu]);
X		}
X	}
X	while(togo){
X		/* handle odd dash lists later */
X		if(n > pGC->numInDashList){
X			n = 0;
X		}
X		l = MIN(pGC->dash[n++], togo);
X		togo -= l;
X		if(!(flags & HARDWARE_PATTERN)){
X			if(pGC->lineStyle == LineOnOffDash){
X				if(ndash & 0x01){
X					command = 0x201f | ACCESS_PIXEL;
X				} else {
X					command = 0x201f & ~ACCESS_PIXEL;
X				}
X			} else {
X				ibm8514ClearQueue(5);
X				PLNWENBL(pm);
X				if(ndash & 0x01){
X					SETCOL1(bg);
X				} else {
X					SETCOL1(fg);
X				}
X
X				/* why reset the fn1? tfp 11/16/88 */
X				SETFN1(FNCOLOR1,mergexlate[alu]);
X				SETX0(x);
X				SETY0(y);
X			}
X		}
X		ndash++;
X		ibm8514ClearQueue(2);
X		SETLX(l);
X		COMMAND(command);
X	}
X	ibm8514ClearQueue(6);
X	SETMODE(M_ONES);
X	SETPAT0(0);
X	SETPAT1(0);
X	SETFN0(FNCOLOR0,FNREPLACE);
X	SETFN1(FNCOLOR1,FNREPLACE);
X	PLNWENBL(WPLANES);
X	if (saved)
X    		ibm8514ReplaceCursor();
X}
X
Xvoid
Xibm8514BresDash( pGC, fg, bg, alu, pm, sdx, sdy, axis, x, y, et, e1, e2, len )
XGCPtr pGC;
Xunsigned long int fg, bg;
Xint alu ;
Xunsigned long int pm ;
Xint sdx, sdy, axis, x, y, et, e1, e2, len;
X{
X	int saved;
X	int togo = len;
X	int l = pGC->dash[0];
X	int n = 0;
X	int ndash = 0;
X	int  command;
X	ppcPrivGCPtr ppcPriv = (ppcPrivGCPtr)pGC->devPriv;
X	ibm8514PrivGCPtr ibm8514Priv = (ibm8514PrivGCPtr)ppcPriv->devPriv;
X	unsigned char flags = ibm8514Priv->Flags;
X	unsigned short pattern = ibm8514Priv->Pattern;
X
X	saved =
X		!ibm8514cursorSemaphore && ibm8514CheckCursor( x,y,len,len ) ;
X
X	if (axis==X_AXIS){
X		y += pGC->dashOffset;
X		command = 0x2017; /* draw bres. line on X, W, LPN, */
X	} else {
X		x += pGC->dashOffset;
X		command = 0x2057; /* same, on Y */
X	}
X
X	if (sdx > 0)
X		command |= 0x0020;
X	if (sdy > 0)
X		command |= 0x0080;
X
X	ibm8514ClearQueue(2);
X	SETCOL1(fg);
X	SETFN1(FNCOLOR1,mergexlate[alu]);
X	if(axis == X_AXIS && flags & HARDWARE_PATTERN){
X		ibm8514ClearQueue(6);
X		barrel_shift8(pattern, x % 8);
X		SETMODE(M_PATTS);
X		SETPAT0(pattern >> 3);
X		SETPAT1(pattern << 1);
X		if(pGC->lineStyle == LineOnOffDash){
X			SETFN0(FNCOLOR0,mergexlate[GXnoop]);
X		} else {
X			SETCOL0(bg);
X			SETFN0(FNCOLOR0,mergexlate[alu]);
X		}
X	}
X	ibm8514ClearQueue(6);
X	PLNWENBL(pm);
X	SETET(et); 
X	SETK1(e1); 
X	SETK2(e2); 
X
X	SETX0(x);
X	SETY0(y);
X
X	while(togo){
X		/* handle odd dash lists later */
X		if(n > pGC->numInDashList){
X			n = 0;
X		}
X		l = MIN(pGC->dash[n++], togo);
X		togo -= l;
X		if(!(axis == X_AXIS && flags & HARDWARE_PATTERN)){
X			if(pGC->lineStyle == LineOnOffDash){
X				if(ndash & 0x01)
X					command |= ACCESS_PIXEL;
X				else 
X					command &= ~ACCESS_PIXEL;
X			} else {
X				ibm8514ClearQueue(1);
X				if(ndash & 0x01)
X					SETCOL1(bg);
X				else
X					SETCOL1(fg);
X				SETFN1(FNCOLOR1,mergexlate[alu]);
X			}
X		}
X
X		ndash++;
X
X		ibm8514ClearQueue(2);
X		/* going to use LAST PEL NULL in Line command to brecon */
X		SETLX(l);
X
X		COMMAND(command);
X	}
X	ibm8514ClearQueue(6);
X	SETMODE(M_ONES);
X	SETPAT0(0);
X	SETPAT1(0);
X	SETFN0(FNCOLOR0,FNREPLACE);
X	SETFN1(FNCOLOR1,FNREPLACE);
X	PLNWENBL(WPLANES);
X	if (saved)
X    		ibm8514ReplaceCursor();
X}
X
X#define barrel_shift8(v, s) \
X	(v = (v >> s) | (v << (8 - s)))
X
Xvoid
Xibm8514_do_dashline_gc(pGC)
Xregister GCPtr pGC;
X{
X	register unsigned int len = 0;
X	register unsigned int n;
X       	register ibm8514PrivGCPtr ibm8514Priv =
X		(ibm8514PrivGCPtr) ( (ppcPrivGCPtr) pGC->devPriv )->devPriv;
X
X	/* check for dash pattern useable to ibm8514 */
X	for ( n = 0 ; n < pGC->numInDashList ; n++ )
X		len += pGC->dash[n];
X
X	if (	len == 2 ||
X		len == 4 ||
X		(len == 8 && ((pGC->numInDashList & 1) == 0)))
X	{
X		register int bit;
X		register int offset = 0;
X		register unsigned char *dp = &pGC->dash[0];
X		unsigned short pattern;
X
X		pattern = 0;
X		/* encode dash pattern into bitmask */
X		while (n-- > 0 && *dp != 0){
X			pattern |= ( ( ( 1 << *dp ) - 1 ) << offset ) ;
X			offset += *dp++;
X			if (n-- > 0)
X				offset += *dp++;
X		}
X		/* replicate pattern over full 8 bits */
X		for (bit = offset; bit < 8; bit++){
X			pattern |=
X				(pattern & (1 << bit - offset))
X					<< offset;
X		}
X		/* shift pattern to implement offset - mod 8 */
X		/* is it legal for offset > length ?? */
X		if (pGC->dashOffset != 0)
X			barrel_shift8(pattern, pGC->dashOffset % 8);
X		ibm8514Priv->Pattern = pattern;
X		ibm8514Priv->Flags |= HARDWARE_PATTERN;
X	} else {
X		ibm8514Priv->Flags &= ~HARDWARE_PATTERN;
X	}
X	pGC->Polylines = ibm8514ZeroDash;
X	return ;
X}
END-of-ibm8514/brcDash.c
echo x - ibm8514/brcData.c
sed 's/^X//' >ibm8514/brcData.c << 'END-of-ibm8514/brcData.c'
X/*
X * Copyright IBM Corporation 1987,1990
X *
X * All Rights Reserved
X *
X * Permission to use, copy, modify, and distribute this software and its
X * documentation for any purpose and without fee is hereby granted,
X * provided that the above copyright notice appear in all copies and that 
X * both that copyright notice and this permission notice appear in
X * supporting documentation, and that the name of IBM not be
X * used in advertising or publicity pertaining to distribution of the
X * software without specific, written prior permission.
X *
X * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
X * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
X * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
X * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
X * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
X * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
X * SOFTWARE.
X *
X*/
X/*
X * PRPQ 5799-PFF (C) COPYRIGHT IBM CORPORATION 1987,1990
X * LICENSED MATERIALS - PROPERTY OF IBM
X * REFER TO COPYRIGHT INSTRUCTIONS FORM NUMBER G120-2083
X */
X#include "X.h"
X#include "Xproto.h"
X#include "miscstruct.h"
X#include "scrnintstr.h"
X#include "font.h"
X#include "pixmapstr.h"
X#include "window.h"
X#include "gcstruct.h"
X#include "colormapst.h"
X#include "cursorstr.h"
X
X#include "mistruct.h"
X#include "mfb.h"
X
X#include "OScursor.h"
X#include "OSio.h"
X#include "ibmScreen.h"
X
X#include "ppc.h"
X#include "ppcProcs.h"
X
X#include "x8514.h"
X
X#include "brcProcs.h"
X
Xextern void miRecolorCursor() ;
Xextern void NoopDDA() ;
Xextern void ibmAbort() ;
X
Xextern ScreenRec ibm8514ScreenRec ; /* Forward Declaration */
X
XPixmapFormatRec	ibm8514Formats[]= { { IBM8514MAXPLANES, 8, 32 } } ;
X
XVisualRec ibm8514Visuals[] = {
X	{
X	0,			/* unsigned long	vid */
X	PseudoColor,		/* short       class */
X	6,			/* short       bitsPerRGBValue */
X	1 << IBM8514MAXPLANES,	/* short	ColormapEntries */
X	IBM8514MAXPLANES,	/* short	nplanes */
X	0,			/* unsigned long	redMask */
X	0,			/* unsigned long	greenMask */
X	0,			/* unsigned long	blueMask */
X	0,			/* int		offsetRed */
X	0,			/* int		offsetGreen */
X	0			/* int		offsetBlue */
X	}
X} ;
X
X#define NUM_VISUALS	(sizeof ibm8514Visuals/sizeof (VisualRec))
X
Xunsigned long int ibm8514DepthVIDs[NUM_VISUALS];
X
XDepthRec ibm8514Depths[] = {
X/*	depth			numVid		vids */
X    {	1,			0,		NULL		 },
X    {	IBM8514MAXPLANES,	NUM_VISUALS,	ibm8514DepthVIDs }
X} ;
X
X#define ibm8514GCInterestValidateMask \
X( GCLineStyle | GCLineWidth | GCJoinStyle | GCBackground | GCForeground	\
X| GCFunction | GCPlaneMask | GCFillStyle | GC_CALL_VALIDATE_BIT		\
X| GCClipXOrigin | GCClipYOrigin | GCClipMask | GCSubwindowMode )
X
XppcPrivGC ibm8514PrototypeGCPriv = {
X	GXcopy,	/* unsigned char	rop */
X	0,	/* unsigned char	ropOpStip */
X	0,	/* unsigned char	ropFillArea */
X	TRUE,	/* short	fExpose */
X	FALSE,	/* short	freeCompClip */
X	NullPixmap,	/* PixmapPtr	pRotatedPixmap */
X	0,	/* RegionPtr	pCompositeClip */
X	ppcAreaFill,	/* void 	(* FillArea)() */
X		{
X		    ibm8514ALLPLANES,	/* unsigned long	planemask */
X		    0,			/* unsigned long	fgPixel */
X		    1,			/* unsigned long	bgPixel */
X		    GXcopy,		/* int			alu */
X		    FillSolid,		/* int			fillStyle */
X		}, /* ppcReducedRrop	colorRrop  */
X	-1,	/* short lastDrawableType */
X	-1,	/* short lastDrawableDepth */
X	ibmAbort, /* void (* cachedIGBlt)() */
X	ibmAbort, /* void (* cachedPGBlt)() */
X	0	/* pointer devPriv */
X} ;
X
XGCFuncs ibm8514GCFuncs = {
XppcValidateGC,			/* void (*ValidateGC)() */
XNoopDDA,			/* void (*ChangeGC)() */
XNoopDDA,			/* void (*CopyGC)() */
XppcDestroyGC,			/* void (*DestroyGC)() */
XppcChangeClip,			/* void (*ChangeClip)() */
XppcDestroyClip,			/* void (*DestroyClip)() */
XppcCopyClip			/* void (*CopyClip)() */
X};
X
XGCOps ibm8514GCOps = {
X	ibm8514SolidFS,		/*  void (* FillSpans)() */
X	ppcSetSpans,		/*  void (* SetSpans)()	 */
X	miPutImage,		/*  void (* PutImage)()	 */
X	ppcCopyArea,		/*  RegionPtr (* CopyArea)()	 */
X	miCopyPlane,		/*  void (* CopyPlane)() */
X	ppcPolyPoint,		/*  void (* PolyPoint)() */
X	ppcScrnZeroLine,	/*  void (* Polylines)() */
X	ppcScrnZeroSegs,	/*  void (* PolySegment)() */
X	miPolyRectangle,	/*  void (* PolyRectangle)() */
X	miPolyArc,		/*  void (* PolyArc)()	 */
X	ibm8514FillPolygon,	/*  void (* FillPolygon)() */
X	miPolyFillRect,		/*  void (* PolyFillRect)() */
X	miPolyFillArc,		/*  void (* PolyFillArc)() */
X	ibm8514PolyText8,	/*  int (* PolyText8)()	 */
X	ibm8514PolyText16,	/*  int (* PolyText16)() */
X	ibm8514ImageText8,	/*  void (* ImageText8)() */
X	ibm8514ImageText16,	/*  void (* ImageText16)() */
X	(void (*)()) ibm8514ImageGlyphBlt,	/*  void (* ImageGlyphBlt)() */
X	(void (*)()) ppcPolyGlyphBlt,	/*  void (* PolyGlyphBlt)() */
X	ibm8514PushPixels,	/*  void (* PushPixels)() */
X	miMiter			/*  void (* LineHelper)() */
X};
X
XGC ibm8514PrototypeGC = {
X	&ibm8514ScreenRec,	/*  ScreenPtr	pScreen	 */
X	IBM8514MAXPLANES,	/*  int         depth	 */
X	GXcopy,			/*  int		alu	 */
X	0,			/*  int		lineWidth */
X	0,			/*  int		dashOffset */
X	0,			/*  int		numInDashList */
X	0,			/*  unsigned char *dash	 */
X	LineSolid,		/*  int		lineStyle */
X	CapButt,		/*  int		capStyle */
X	JoinMiter,		/*  int		joinStyle */
X	FillSolid,		/*  int		fillStyle */
X	EvenOddRule,		/*  int		fillRule */
X	ArcPieSlice,		/*  int		arcMode	 */
X	ClipByChildren,		/*  int		subWindowMode */
X	TRUE,			/*  Bool	graphicsExposures */
X	CT_NONE,		/*  int		clientClipType */
X	1,			/*  int		miTranslate:1 */
X	1,			/* unsigned int tileIsPixel:1 */
X	0,			/* unused:16 */
X	ibm8514ALLPLANES,	/*  unsigned long	planemask */
X	0,			/*  unsigned long	fgPixel */
X	1,			/*  unsigned long	bgPixel */
X	0,			/*  PixmapPtr	tile	 */
X	0,			/*  PixmapPtr	stipple	 */
X	{ 0, 0 },		/*  DDXPointRec	patOrg	 */
X	0,			/*  FontPtr	font	 */
X	{ 0, 0 },		/*  DDXPointRec	clipOrg	 */
X	{ 0, 0 },		/*  DDXPointRec	lastWinOrg */
X	NULL,			/*  pointer	clientClip */
X	/*(1<<(GCLastBit+1))-1,*/	/*  unsigned long	stateChanges */
X	0,			/*  unsigned long	stateChanges */
X	0,			/*  unsigned long        serialNumber */
X	(GCFuncs *) &ibm8514GCFuncs,	/*  pointer	funcs	 */
X	(GCOps *) &ibm8514GCOps,	/*  pointer	ops	 */
X	NULL /*  devUnion devPrivates	 */
X} ;
X
XppcScrnPriv ibm8514ScrnPriv = {
X	{
X		{
X			(unsigned char)DRAWABLE_PIXMAP,/* unsigned char  type */
X			(unsigned char)0,		/*unsigned char class */
X			(unsigned char)IBM8514MAXPLANES, /*unsignedchar depth */
X			(unsigned char)1,     /* unsigned char   bitsPerPixel */
X			0,		/* unsigned long   id */
X			0,		/* short   	   x */
X			0,		/* short           y */
X			_8514_SCREEN_WIDTH, /* unsigned short  width */
X			_8514_SCREEN_HEIGHT, /* unsigned short  height */
X			0,		/* ScreenPtr       pScreen */
X			0,		/* unsigned long   serialNumber */
X		},		/* DrawableRec drawable */
X		1,		/* int refcnt */
X		_8514_SCREEN_WIDTH / 8,	/* int devKind */
X		0		/* pointer devPrivate */
X	},			/* PixmapRec	pixmap */
X	0,			/* void	(* devHardwareInitBB)() */
X	0,			/* void	(* devHardwareInitAB)() */
X	&ibm8514PrototypeGC,	/* GCPtr	devPrototypeGC */
X	&ibm8514PrototypeGCPriv,/* ppcPrivGC 	*devPrototypeGCPriv */
X	ibm8514ChangeGCtype,	/* Mask		(* changeGCtype)() */
X	ibm8514ChangeWindowGC,	/* Mask		(* changeWindowGC)() */
X	0,			/* Colormap	InstalledColormap */
X	ibm8514Bitblt,		/* void	(* blit)() */
X	(void (*)()) ibm8514DrawRectangle, /* void	(* solidFill)() */
X	ibm8514TileRect,	/* void	(* tileFill)() */
X	ibm8514Stipple,		/* void	(* stipFill)() */
X	ibm8514OpStipple,	/* void	(* opstipFill)() */
X	ibm8514DrawColorImage,	/* void	(* imageFill)() */
X	ibm8514ReadColorImage,	/* void	(* imageRead)() */
X	ibm8514BresLine,	/* void	(* lineBres)() */
X	ibm8514HorzLine,	/* void	(* lineHorz)() */
X	ibm8514VertLine,	/* void	(* lineVert)() */
X	(void (*)())ibm8514SetColor,	/* void	(* setColor)() */
X	ibm8514RecolorCursor,	/* void	(* RecolorCursor)() */
X	ibm8514FillMonoImage,	/* void	(* monoFill)() */
X	ibm8514DrawMonoByteImage,	/* void	(* glyphFill)() */
X	(unsigned long *((*)())) ibmAbort,/* unsigned long *((* planeRead)()) */
X	ppcReplicateArea,	/* void	(* replicateArea)() */
X	NoopDDA,		/* void	(* DestroyGCPriv)() */
X/* High Level Software Cursor Support !! */
X	&ibm8514cursorSemaphore,/* int	* CursorSemaphore */
X	ibm8514CheckCursor,	/* int	(* CheckCursor)() */
X	ibm8514ReplaceCursor,	/* void	(* ReplaceCursor)() */
X	0			/* ppcCacheInfoPtr cacheInfo */
X} ;
X
XScreenRec ibm8514ScreenRec = {
X	0,			        /* int			myNum */
X	0,				/* ATOM         	id */
X	_8514_SCREEN_WIDTH,		/* short		width */
X	_8514_SCREEN_HEIGHT,		/* short		height */
X	(_8514_SCREEN_WIDTH * 254)/800,	/* short		mmWidth */
X	(_8514_SCREEN_HEIGHT*254)/800,	/* short		mmHeight */
X	sizeof ibm8514Depths/sizeof (DepthRec),	/* short	numDepths */
X	IBM8514MAXPLANES,		/* short       		rootDepth */
X	ibm8514Depths,			/* DepthPtr       	allowedDepths */
X	0,				/* unsigned long      	rootVisual */
X	0,				/* unsigned long	defColormap */
X	0,				/* short		minInstalledCmaps */
X	1,				/* short		maxInstalledCmaps */
X	Always,				/* char                backingStoreSupport */
X	NotUseful,			/* char                saveUnderSupport */
X	IBM8514_WHITE_PIXEL,		/* unsigned long	whitePixel */
X	IBM8514_BLACK_PIXEL,		/* unsigned long	blackPixel */
X	0,				/* unsigned long	rgf */
X	{ 0 },			/* GCPtr	GCperDepth[MAXFORMATS+1] */
X	{ 0 },			/* PixmapPtr		PixmapPerDepth[1] */
X	(pointer) &ibm8514ScrnPriv,	/* pointer		devPrivate */
X	NUM_VISUALS, /* short     	numVisuals */
X	&ibm8514Visuals[0],	/* VisualPtr		visuals */
X	0,				/* int 		WindowPrivateLen; */
X	0,				/* unsigned 	WindowPrivateSizes; */
X	0,				/* unsigned 	totalWindowSize; */
X	0,				/* int 		GCPrivateLen; */
X	0,				/* unsigned 	GCPrivateSizes; */
X	0,				/* unsigned 	totalGCSize; */
X/* Random screen procedures */
X	ibm8514ScreenClose,	/* Bool (* CloseScreen)() */
X	ppcQueryBestSize,	/* void (* QueryBestSize)() */
X	ibmSaveScreen,		/* Bool (* SaveScreen)() */
X	miGetImage,		/* void (* GetImage)() */
X	(void (*)()) ibm8514GetSpans, /* void (*GetSpans)() */
X	ibmAbort,		/* void (* PointerNonInterestBox)() */
X	(void (*)())NULL,			/* void (* SourceValidate)() */
X/* Window Procedures */
X	ppcCreateWindow,	/* Bool (* CreateWindow)() */
X	ppcDestroyWindow,	/* Bool (* DestroyWindow)() */
X	ppcPositionWindow,	/* Bool (* PositionWindow)() */
X	mfbChangeWindowAttributes,	/* Bool (* ChangeWindowAttributes)() */
X	mfbMapWindow,		/* Bool (* RealizeWindow)() */
X	mfbUnmapWindow,		/* Bool (* UnrealizeWindow)() */
X	miValidateTree,		/* int  (* ValidateTree)() */
X	miWindowExposures,	/* void (* WindowExposures)() */
X	ppcPaintWindow,		/* void PaintWindowBackground */
X	ppcPaintWindow,		/* void PaintWindowBorder */
X	ppcCopyWindow,		/* void CopyWindow */
X	miClearToBackground,	/* void ClearToBackground */
X/* Pixmap procedures */
X	ppcCreatePixmap,	/* PixmapPtr (* CreatePixmap)() */
X	mfbDestroyPixmap,	/* Bool (* DestroyPixmap)() */
X/* Backing store Procedures */
X	NoopDDA,	/* void SaveDoomedAreas */
X	(RegionPtr (*)())ppcRestoreAreas,	/* RegionPtr RestoreAreas */
X	NoopDDA,	/* void ExposeCopy */
X	(RegionPtr (*)())NoopDDA,	/* RegionPtr TranslateBackingStore */
X	(RegionPtr (*)())NoopDDA,	/* RegionPtr ClearBackingStore */
X	NoopDDA,	/* void DrawGuarantee */
X/* Font procedures */
X	ibm8514RealizeFont,	/* Bool (* RealizeFont)() */
X	ibm8514UnrealizeFont,	/* Bool (* UnrealizeFont)() */
X/* Cursor Procedures */
X	OS_ConstrainCursor,	/* void (* ConstrainCursor)() */
X	OS_CursorLimits,	/* void (* CursorLimits)() */
X	ibm8514DisplayCursor,	/* Bool (* DisplayCursor)() */
X	ibm8514RealizeCursor,	/* Bool (* RealizeCursor)() */
X	ibm8514UnrealizeCursor,	/* Bool (* UnrealizeCursor)() */
X	miRecolorCursor,	/* void (* RecolorCursor)() */
X	OS_SetCursorPosition,	/* Bool (* SetCursorPosition)() */
X/* GC procedures */
X	ppcCreateGC,		/* Bool (* CreateGC)() */
X/* Colormap procedures */
X	ppcCreateColormapNoop,	/* void (* CreateColormap)() */
X	NoopDDA,		/* void (* DestroyColormap)() */
X	ppcInstallColormap,	/* void (* InstallColormap)() */
X	ppcUninstallColormap,	/* void (* UninstallColormap)() */
X	ppcListInstalledColormaps,	/* int (* ListInstalledColormaps) () */
X	ppcStoreColors,		/* void (* StoreColors)() */
X	ppcResolveColor,	/* void (* ResolveColor)() */
X/* Region procedures */
X	miRegionCreate,		/* RegionPtr (* RegionCreate)() */
X	miRegionInit,		/* void (* RegionInit)() */
X	miRegionCopy,		/* Bool (* RegionCopy)() */
X	miRegionDestroy,	/* void (* RegionDestroy)() */
X	miRegionUninit,		/* void (* RegionUninit)() */
X	miIntersect,		/* int (* Intersect)() */
X	miUnion,		/* int (* Union)() */
X	miSubtract,		/* int (* Subtract)() */
X	miInverse,		/* int (* Inverse)() */
X	miRegionReset,		/* void (* RegionReset)() */
X	miTranslateRegion,	/* void (* TranslateRegion)() */
X	miRectIn,		/* int (* RectIn)() */
X	miPointInRegion,	/* Bool (* PointInRegion)() */
X	miRegionNotEmpty,	/* Bool (* RegionNotEmpty)() */
X	miRegionEmpty,		/* void (* RegionEmpty)() */
X	miRegionExtents,	/* BoxPtr (*RegionExtents)() */
X	miRegionAppend,		/* BoxPtr (*RegionAppend)() */
X	miRegionValidate,	/* BoxPtr (*RegionValidate)() */
X	mfbPixmapToRegion,	/* BoxPtr (*BitmapToRegion)() */
X	miRectsToRegion,	/* BoxPtr (*RectsToRegion)() */
X	miSendGraphicsExpose,	/* void	(*SendGraphicsExpose)() */
X/* os layer procedures */
X	OS_BlockHandler,	/* void (* BlockHandler)() */
X	OS_WakeupHandler,	/* void (* WakeupHandler)() */
X	(pointer) 0,		/* pointer blockData */
X	(pointer) 0,		/* pointer wakeupData */
X	0			/* DevUnion */
X} ;
END-of-ibm8514/brcData.c
exit

mlewis@dolphin.tcspa.ibm.com (Mark S. Lewis) (03/13/90)

Subject: IBM 8514 source code (part 3 of 6) for X11 Release 4
Index: ../mit/server/ddx/ibm/ibm8514

Description:	
IBM has decided to provide X11 source code for the 8514 display
adapter.  This is the same code used to build the object files
included in the X11 Release 4 distribution.  This code supports
servers for both AIX and IBM/4.3 on their respective platforms.

	V1.32_kit.1	59,103 Bytes
	V1.32_kit.2	61,796 Bytes
	V1.32_kit.3	60,982 Bytes
	V1.32_kit.4	62,729 Bytes
	V1.32_kit.5	54,871 Bytes
	V1.32_kit.6	29,170 Bytes

Installation:	
This code is provided in a 6-part shell archive.  Before you
install it, you should save your current code.  You should save
the Imakefile in the ibm server directory.  You also should save
the entire ibm8514 directory by moving and remaking it.

	cd ../mit/server/ddx/ibm
	cp Imakefile Imakefile.orig
	mv ibm8514 ibm8514.orig
	mkdir ibm8514
	
Next, edit this header from each part, and feed the rest to
/bin/sh.  Proceed to make the server as instructed in the
X11 release notes.

	sh < V1.32_kit.3

=====-----     Mark S. Lewis, IBM AWD Palo Alto    -----======
inet: mlewis%ibmsupt@uunet.uu.net		(415) 855-4486
uucp: uunet!ibmsupt!mlewis              IBM Tie Line: 465-4486

# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
#
#	ibm8514/brcFillSp.c
#	ibm8514/brcFont.c
#	ibm8514/brcFonts.h
#	ibm8514/brcGBlt.c
#	ibm8514/brcGC.c
#	ibm8514/brcGetSp.c
#	ibm8514/brcIO.c
#
echo x - ibm8514/brcFillSp.c
sed 's/^X//' >ibm8514/brcFillSp.c << 'END-of-ibm8514/brcFillSp.c'
X/*
X * Copyright IBM Corporation 1987,1990
X *
X * All Rights Reserved
X *
X * Permission to use, copy, modify, and distribute this software and its
X * documentation for any purpose and without fee is hereby granted,
X * provided that the above copyright notice appear in all copies and that 
X * both that copyright notice and this permission notice appear in
X * supporting documentation, and that the name of IBM not be
X * used in advertising or publicity pertaining to distribution of the
X * software without specific, written prior permission.
X *
X * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
X * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
X * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
X * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
X * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
X * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
X * SOFTWARE.
X *
X*/
X/*
X * PRPQ 5799-PFF (C) COPYRIGHT IBM CORPORATION 1987,1990
X * LICENSED MATERIALS - PROPERTY OF IBM
X * REFER TO COPYRIGHT INSTRUCTIONS FORM NUMBER G120-2083
X */
X/*
X *  Hardware interface routines for IBM 8514/A adapter for
X *  X.11 server(s) on IBM equipment.
X *
X */
X
X/* $Header:
/andrew/X11/r3src/r3plus/server/ddx/ibm/ibm8514/RCS/brcFillSp.c,v 6.3
89/05/07 15:18:34 jeff Exp $ */
X/* $Source:
/andrew/X11/r3src/r3plus/server/ddx/ibm/ibm8514/RCS/brcFillSp.c,v $ */
X
X#ifndef lint
Xstatic char *rcsid = "$Header:
/andrew/X11/r3src/r3plus/server/ddx/ibm/ibm8514/RCS/brcFillSp.c,v 6.3
89/05/07 15:18:34 jeff Exp $" ;
X#endif
X
X#include "X.h"
X#include "misc.h"
X#include "gcstruct.h"
X#include "windowstr.h"
X#include "window.h"
X#include "pixmapstr.h"
X#include "scrnintstr.h"
X
X#include "OScompiler.h"
X
X#include "ppc.h"
X#include "ppcSpMcro.h"
X
X#include "x8514.h"
X#include "ibmTrace.h"
X
Xextern int mergexlate[] ;
Xextern int ibm8514cursorSemaphore ;
Xextern int mfbGCPrivateIndex;
X
Xvoid
Xibm8514SolidFS( pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted )
X    DrawablePtr pDrawable ;
X    GCPtr	pGC ;
X    int		nInit ;			/* number of spans to fill */
X    DDXPointPtr pptInit ;		/* pointer to list of start points */
X    int		*pwidthInit ;		/* pointer to list of n widths */
X    int 	fSorted ;
X{
X    register unsigned long int pm ;
X    register unsigned long int fg ;
X    register int alu ;
X				/* next three parameters are post-clip */
X    int n ;			/* number of spans to fill */
X    register DDXPointPtr ppt ;	/* pointer to list of start points */
X    register int *pwidth ;	/* pointer to list of n widths */
X    int *pwidthFree ;		/* copies of the pointers to free */
X    DDXPointPtr pptFree ;
X
XTRACE(("ibm8514SolidFS((pDrawable = x%x, pGC = x%x, nInit = x%x,
pptInit = x%x, pwidthInit = x%x, fSorted = x%x)\n",
X	pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted ) ) ;
X
X    if ( pDrawable->depth == 1 )
X    {
X	ErrorF("ibm8514SolidFS: depth == 1\n") ;
X	return ;
X    }
X
X    if (pDrawable->type != DRAWABLE_WINDOW)
X    {
X	ErrorF("ibm8514SolidFS: not a window\n") ;
X	return ;
X    }
X
X    if ( ( alu = ( (ppcPrivGC *)
pGC->devPrivates[mfbGCPrivateIndex].ptr )->colorRrop.alu ) == GXnoop )
X	return ;
X
X    pm = ( (ppcPrivGC *) pGC->devPrivates[mfbGCPrivateIndex].ptr
)->colorRrop.planemask ;
X    fg = ( (ppcPrivGC *) pGC->devPrivates[mfbGCPrivateIndex].ptr
)->colorRrop.fgPixel ;
X
X    SETSPANPTRS( nInit, n, pwidthInit, pwidth, pptInit, 
X		 ppt, pwidthFree, pptFree, fSorted ) ;
X
X    while ( n--)
X	{
X	if ( *pwidth )
X		ibm8514DrawRectangle( fg, alu, pm,
X				      ppt->x, ppt->y, *pwidth, 1 ) ;
X	ppt++ ;
X	pwidth++ ;
X	}
X    DEALLOCATE_LOCAL(pptFree) ;
X    DEALLOCATE_LOCAL(pwidthFree) ;
X    return ;
X}
X
X#ifndef OLDFS
Xvoid
Xibm8514TileFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
XDrawablePtr pDrawable ;
XGC		*pGC ;
Xint		nInit ;		/* number of spans to fill */
XDDXPointPtr pptInit ;		/* pointer to list of start points */
Xint *pwidthInit ;		/* pointer to list of n widths */
Xint fSorted ;
X{
X    register unsigned long int pm ;
X    register int alu ;
X				/* next three parameters are post-clip */
X    int n ;			/* number of spans to fill */
X    register DDXPointPtr ppt ;	/* pointer to list of start points */
X    register int *pwidth ;	/* pointer to list of n widths */
X    int *pwidthFree ;		/* copies of the pointers to free */
X    DDXPointPtr pptFree ;
X    PixmapPtr pTile ;
X    int xSrc, ySrc ;
X    int width ;
X    int tlx, tly, hoffset, voffset, hremaining ;
X    int currx ;
X
XTRACE(("ibm8514TileFS((pDrawable = x%x, pGC = x%x, nInit = %d, pptInit
= x%x, pwidthInit = x%x, fSorted = x%x)\n",
X	pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)) ;
X
X    if (pDrawable->type != DRAWABLE_WINDOW)
X    {
X	ErrorF("ibm8514TileFS: not a window\n") ;
X	return ;
X    }
X
X    if ( ( alu = ( (ppcPrivGC *)
pGC->devPrivates[mfbGCPrivateIndex].ptr )->colorRrop.alu ) == GXnoop )
X	return ;
X
X    pm = ( (ppcPrivGC *) pGC->devPrivates[mfbGCPrivateIndex].ptr
)->colorRrop.planemask ;
X
X    SETSPANPTRS(nInit, n, pwidthInit, pwidth, pptInit, 
X		ppt, pwidthFree, pptFree, fSorted) ;
X
X	switch(alu)
X		{
X			while ( n--)
X				{
X				ibm8514DrawRectangle( 0xFF, alu, pm,
X					ppt->x, ppt->y, *pwidth, 1) ;
X				ppt++ ;
X				pwidth++ ;
X				}
X			return ;
X			break ;
X		}
X
X
X	xSrc = pGC->patOrg.x + pDrawable->x ;
X	ySrc = pGC->patOrg.y + pDrawable->y ;
X
X    	pTile= pGC->tile.pixmap ;
X
X	tlx = pTile->drawable.width ;
X	tly = pTile->drawable.height ;
X
X	if ( n == 1 ) {
X		unsigned char *data ;
X
X		if ((hoffset = ((ppt->x-xSrc)%tlx)) < 0) hoffset += tlx ;
X		hremaining = tlx-hoffset ;
X		if ((voffset = ((ppt->y-ySrc)%tly)) < 0) voffset += tly ;
X
X		data = pTile->devPrivate.ptr + voffset * pTile->devKind ;
X		width = *pwidth ;
X
X		if ( hoffset ) {
X			unsigned char *tmp
X			   = (unsigned char *) ALLOCATE_LOCAL(pTile->devKind) ;
X			MOVE( data + hoffset, tmp, hremaining) ;
X			if ( width > hremaining )
X				MOVE( data, tmp + hremaining, 
X				      MIN( hoffset, width - hremaining ) ) ;
X			data = tmp ;
X		}
X
X		if ( width <= tlx ) {
X			ibm8514DrawColorImage( ppt->x, ppt->y, width, 1, 
X					       data, width, alu, pm ) ;
X		}
X		else {
X			switch ( alu ) {
X					ibm8514DrawColorImage( ppt->x, ppt->y,
X							MIN( width, tlx ), 1, 
X							data,
X							MIN( width, tlx ),
X							alu, pm) ;
X					ppcReplicateArea( ppt->x, ppt->y,
X							  pm, width, 1,
X							  tlx, 1, 
X						pTile->drawable.pScreen ) ;
X					break ;
X					if ( tlx > MAXTILESIZE ) {
X						ibm8514DrawColorImage(
X							ppt->x, ppt->y,
X							MIN( width, tlx ), 1, 
X							data,
X							MIN( width, tlx ),
X							alu, pm) ;
X						for (
X						    width -= tlx,
X						    currx = ppt->x + tlx ;
X						    width > 0 ; 
X						    currx += tlx,
X						    width -= tlx
X						    )
X							ibm8514DrawColorImage(
X								currx, ppt->y,
X								MIN( width, tlx ), 
X								1, data, 
X								MIN( width, tlx ), 
X								alu, pm ) ;
X						}
X					   else { 
X						ibm8514DrawColorImage(
X							TILE_X, TILE_Y,
X							*pwidth, 1, 
X							data, *pwidth,
X							alu, pm ) ;
X						while ( tlx << 1 <= MAXTILESIZE)
X							{
X							ibm8514Bitblt(
X								GXcopy, 0xFF, 
X								0xFF,
X								TILE_X, TILE_Y,
X								TILE_X + tlx, 
X								TILE_Y,
X								tlx, 1 ) ;
X							tlx <<= 1 ;
X						}
X						for (
X						    currx = ppt->x ;
X						    width > 0 ;
X						    currx += tlx,
X						    width -= tlx )
X							ibm8514Bitblt(
X								alu, 0xFF, pm,
X								TILE_X, TILE_Y,
X								currx, ppt->y,
X								MIN( width, tlx ),
X								1 ) ;
X						}
X			} /* end switch on rop */
X		} /* end else on width > hremaining */
X	} /* end N = 1 */
X	   else {
X		if ( ( tlx <= MAXTILESIZE ) && ( tly <= MAXTILESIZE ) ) {
X
X			ibm8514DrawColorImage(
X				TILE_X, TILE_Y,
X				tlx, tly,
X				pTile->devPrivate.ptr,
X				pTile->devKind,
X				GXcopy, ibm8514ALLPLANES ) ;
X				/*we'll do the alu and planemask in the blits*/
X
X			while ( tlx << 1 <= MAXTILESIZE ) {
X				ibm8514Bitblt(
X					GXcopy, 0xff, 0xff,
X					TILE_X, TILE_Y,
X					TILE_X + tlx, TILE_Y,
X					tlx, tly ) ;
X				tlx <<= 1 ;
X			}
X
X	        	while ( n-- ) {
X				if ( ( hoffset = ( ( ppt->x - xSrc ) % tlx ) ) < 0 ) 
X					hoffset += pTile->drawable.width ;
X				if ( ( voffset = ( ( ppt->y - ySrc ) %tly ) ) < 0 ) 
X						voffset += tly ;
X
X				width = *pwidth ;
X				if ( hoffset ) {
X					ibm8514RotateTile( tlx, tly, hoffset, 0 ) ;
X					while ( width > 0 ) {
X						ibm8514Bitblt( alu, 0xff, pm,
X							ROTTILE_X, 
X							ROTTILE_Y + voffset,
X							ppt->x, ppt->y,
X							MIN( width, tlx ), 1 ) ;
X						width -= tlx ;
X						ppt->x += tlx ;
X					}
X				}
X				else
X					while ( width > 0 ) {
X						ibm8514Bitblt( alu, 0xff, pm,
X							TILE_X, 
X							TILE_Y + voffset,
X							ppt->x, ppt->y,
X							MIN( width, tlx ), 1 ) ;
X						width -= tlx ;
X						ppt->x += tlx ;
X					}
X				ppt++ ;
X				pwidth++ ;
X			}
X		}
X		else {
X			unsigned char *data ;
X			unsigned char *tmp
X			   = (unsigned char *) ALLOCATE_LOCAL(pTile->devKind) ;
X
X			while ( n-- ) {
X				if ( ( hoffset = ( ( ppt->x - xSrc ) % tlx ) ) < 0 ) 
X					hoffset += tlx ;
X				hremaining = tlx-hoffset ;
X				if ( ( voffset = ( ( ppt->y - ySrc ) % tly ) ) < 0 )
X					voffset += tly ;
X
X				data = pTile->devPrivate.ptr + 
X					voffset * pTile->devKind ;
X				
X				if ( hoffset ) {
X					MOVE( data + hoffset, tmp, hremaining ) ;
X					if ( *pwidth > hremaining )
X						MOVE( data, tmp + hremaining, 
X						      hoffset ) ;
X					data = tmp ;
X				}
X
X				while ( *pwidth > 0 ) {
X					ibm8514DrawColorImage(
X						ppt->x, ppt->y,
X						MIN( *pwidth, tlx ), 1,
X						data,
X						MIN( *pwidth, tlx ),
X						alu, pm ) ;
X					*pwidth -= tlx ;
X					ppt->x += tlx ;
X				}
X				ppt++ ;
X				pwidth++ ;
X			}
X		}
X	} /* end N > 1 */
X
X    DEALLOCATE_LOCAL(pptFree) ;
X    DEALLOCATE_LOCAL(pwidthFree) ;
X    return ;
X}
X#endif
X#ifdef OLDFS
Xvoid
Xibm8514TileFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
XDrawablePtr pDrawable ;
XGC		*pGC ;
Xint		nInit ;		/* number of spans to fill */
XDDXPointPtr pptInit ;		/* pointer to list of start points */
Xint *pwidthInit ;		/* pointer to list of n widths */
Xint fSorted ;
X{
X    register unsigned long int pm ;
X    register int alu ;
X				/* next three parameters are post-clip */
X    int n ;			/* number of spans to fill */
X    register DDXPointPtr ppt ;	/* pointer to list of start points */
X    register int *pwidth ;	/* pointer to list of n widths */
X    int *pwidthFree ;		/* copies of the pointers to free */
X    DDXPointPtr pptFree ;
X    PixmapPtr pTile ;
X    int xSrc, ySrc ;
X
XTRACE(("ibm8514TileFS((pDrawable = x%x, pGC = x%x, nInit = x%x, pptInit
= x%x, pwidthInit = x%x, fSorted = x%x)\n",
X	pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)) ;
X
X    if (pDrawable->depth == 1 )
X    {
X	ErrorF("ibm8514TileFS: depth == 1\n") ;
X	return ;
X    }
X
X    if (pDrawable->type != DRAWABLE_WINDOW)
X    {
X	ErrorF("ibm8514TileFS: not a window\n") ;
X	return ;
X    }
X    if ( ( alu = ( (ppcPrivGC *)
pGC->devPrivates[mfbGCPrivateIndex].ptr )->colorRrop.alu ) == GXnoop )
X	return ;
X
X    pm = ( (ppcPrivGC *) pGC->devPrivates[mfbGCPrivateIndex].ptr
)->colorRrop.planemask ;
X
X    SETSPANPTRS(nInit, n, pwidthInit, pwidth, pptInit, 
X		ppt, pwidthFree, pptFree, fSorted) ;
X
X    xSrc = pGC->patOrg.x ;
X    ySrc = pGC->patOrg.y ;
X    pTile= pGC->tile ;
X
X    while (n--)
X    {
X	ibm8514TileRect(pTile,alu,pm,ppt->x,ppt->y,*pwidth,1,xSrc,ySrc) ;
X	ppt++ ;
X	pwidth++ ;
X    }
X    DEALLOCATE_LOCAL(pptFree) ;
X    DEALLOCATE_LOCAL(pwidthFree) ;
X    return ;
X}
X#endif
X
X/* Fill spans with stipples that aren't 32 bits wide */
Xvoid
Xibm8514StippleFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
XDrawablePtr pDrawable ;
XGC		*pGC ;
Xint		nInit ;		/* number of spans to fill */
XDDXPointPtr pptInit ;		/* pointer to list of start points */
Xint *pwidthInit ;		/* pointer to list of n widths */
Xint fSorted ;
X{
X    unsigned long int pm ;
X    unsigned long int fg ;
X    int alu ;
X				/* next three parameters are post-clip */
X    int n ;			/* number of spans to fill */
X    register DDXPointPtr ppt ;	/* pointer to list of start points */
X    register int *pwidth ;	/* pointer to list of n widths */
X    int		iline ;		/* first line of stipple to use */
X    PixmapPtr	pStipple ;	/* pointer to stipple we want to fill with */
X    int		xSrc, ySrc, stippleWidth, xshift, maxwidth, totlen,
X    		saved = FALSE ;
X
X    pointer data ;
X    int *pwidthFree ;		/* copies of the pointers to free */
X    DDXPointPtr pptFree ;
X
XTRACE(("ibm8514StippleFS((pDrawable = x%x, pGC = x%x, nInit = x%x,
pptInit = x%x, pwidthInit = x%x, fSorted = x%x)\n",
X	pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)) ;
X    if ( pDrawable->depth != 8 )
X    {
X	ErrorF("ibm8514StippleFS: depth != 8\n") ;
X	return ;
X    }
X
X    if (pDrawable->type != DRAWABLE_WINDOW)
X    {
X        int dummy ;
X	dummy = (int) pDrawable->type ;
X	ErrorF("ibm8514StippleFS: x%x (=%d) not a window\n",dummy,dummy) ;
X	return ;
X    }
X
X    if ( ( alu = ( (ppcPrivGC *)
pGC->devPrivates[mfbGCPrivateIndex].ptr )->colorRrop.alu ) == GXnoop )
X	return ;
X
X    SETSPANPTRS(nInit, n, pwidthInit, pwidth, pptInit, 
X		ppt, pwidthFree, pptFree, fSorted) ;
X
X    pStipple = pGC->stipple ;
X    stippleWidth = pStipple->drawable.width ;
X
X    /* this replaces rotating the stipple.  Instead, we just adjust the offset
X     * at which we start grabbing bits from the stipple */
X    xSrc = pGC->patOrg.x + pDrawable->x ;
X    ySrc = pGC->patOrg.y + pDrawable->y ;
X
X    /* Grab From Pre-Calculated Storage */
X    pm = ( (ppcPrivGC *) pGC->devPrivates[mfbGCPrivateIndex].ptr
)->colorRrop.planemask ;
X    fg = ( (ppcPrivGC *) pGC->devPrivates[mfbGCPrivateIndex].ptr
)->colorRrop.fgPixel ;
X
X    while (n--)
X    {
X	iline = (ppt->y - ySrc) % pStipple->drawable.height ;
X	maxwidth = _8514_SCREENWIDTH - ppt->x ;
X	*pwidth = MIN(*pwidth,maxwidth) ;
X	data = pStipple->devPrivate.ptr + iline*stippleWidth ;
X
X        if ( !saved && !ibm8514cursorSemaphore )
X	     saved = ibm8514CheckCursor(ppt->x%xSrc,ppt->y,
X					   	 *pwidth+stippleWidth,1) ;
X	/* I am only going to call replace ONCE, after the whole
X	   stipple id done */
X
X	/* set up stipple off screen */
X	xshift = (ppt->x - xSrc) % stippleWidth ;
X	ibm8514AlignMonoImage(WPLANE0, alu,
X				STIPX, STIPY+1, stippleWidth, 1, data) ;
X	if (xshift) 
X		{/* shift the stipple left, then tack on end to the right */
X		ibm8514Bitblt(GXcopy,RPLANE0,WPLANE0,STIPX+xshift,STIPY+1,
X			STIPX,STIPY,stippleWidth-xshift,1) ;
X		ibm8514Bitblt(GXcopy,RPLANE0,WPLANE0,STIPX,STIPY+1,
X			STIPX+stippleWidth-xshift,STIPY,xshift,1) ;
X		}
X	totlen = stippleWidth ;
X	while ( totlen<*pwidth)
X		{ /* widen stipple to totlen of area to be stippled */
X	  	ibm8514Bitblt(GXcopy,RPLANE0,WPLANE0,
X			STIPX,STIPY,totlen,STIPY,totlen,1) ;
X	  	totlen += totlen ;
X	  	}
X
X
X    	ibm8514ClearQueue( 2 ) ;
X	SETXMIN(ppt->x) ; /* use clip to draw stippled line */
X	SETXMAX(*pwidth + ppt->x) ;
X
X	ibm8514BlitFG(RPLANE0,pm,fg,alu,
X			STIPX,STIPY,ppt->x%xSrc,ppt->y,*pwidth+stippleWidth,1) ;
X
X    	ibm8514ClearQueue(2) ;
X	SETXMIN(0) ;
X	SETXMAX(_8514_SCREENWIDTH-1) ;
X
X	ppt++ ;
X	pwidth++ ;
X    }
X
X    DEALLOCATE_LOCAL(pptFree) ;
X    DEALLOCATE_LOCAL(pwidthFree) ;
X    if (saved)
X	ibm8514ReplaceCursor() ;
X
X    return ;
X}
X
X
Xvoid
Xibm8514OPStippleFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
XDrawablePtr pDrawable ;
XGC		*pGC ;
Xint		nInit ;		/* number of spans to fill */
XDDXPointPtr pptInit ;		/* pointer to list of start points */
Xint *pwidthInit ;		/* pointer to list of n widths */
Xint fSorted ;
X{
X    unsigned long int pm ;
X    unsigned long int fg ;
X    unsigned long int bg ;
X    int alu ;
X				/* next three parameters are post-clip */
X    int n ;			/* number of spans to fill */
X    register DDXPointPtr ppt ;	/* pointer to list of start points */
X    register int *pwidth ;	/* pointer to list of n widths */
X    int		iline ;		/* first line of stipple to use */
X    PixmapPtr	pStipple ;	/* pointer to stipple we want to fill with */
X    int		xSrc, ySrc, stippleWidth, xshift,
X		maxwidth, totlen, saved = FALSE ;
X    pointer data ;
X    int *pwidthFree ;		/* copies of the pointers to free */
X    DDXPointPtr pptFree ;
X
XTRACE(("ibm8514StippleFS((pDrawable = x%x, pGC = x%x, nInit = x%x,
pptInit = x%x, pwidthInit = x%x, fSorted = x%x)\n",
X	pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)) ;
X    if ( pDrawable->depth != 8 )
X    {
X	ErrorF("ibm8514StippleFS: depth != 8\n") ;
X	return ;
X    }
X
X    if (pDrawable->type != DRAWABLE_WINDOW)
X    {
X        int dummy ;
X	dummy = (int) pDrawable->type ;
X	ErrorF("ibm8514StippleFS: x%x (=%d) not a window\n",dummy,dummy) ;
X	return ;
X    }
X
X    if ( ( alu = ( (ppcPrivGC *)
pGC->devPrivates[mfbGCPrivateIndex].ptr )->colorRrop.alu ) == GXnoop )
X	return ;
X
X    pm = ( (ppcPrivGC *) pGC->devPrivates[mfbGCPrivateIndex].ptr
)->colorRrop.planemask ;
X    fg = ( (ppcPrivGC *) pGC->devPrivates[mfbGCPrivateIndex].ptr
)->colorRrop.fgPixel ;
X    bg = ( (ppcPrivGC *) pGC->devPrivates[mfbGCPrivateIndex].ptr
)->colorRrop.bgPixel ;
X
X    SETSPANPTRS(nInit, n, pwidthInit, pwidth, pptInit, 
X		ppt, pwidthFree, pptFree, fSorted) ;
X
X    pStipple = pGC->stipple ;
X    stippleWidth = pStipple->drawable.width ;
X
X    /* this replaces rotating the stipple.  Instead, we just adjust the offset
X     * at which we start grabbing bits from the stipple */
X    xSrc = pGC->patOrg.x + pDrawable->x ;
X    ySrc = pGC->patOrg.y + pDrawable->y ;
X
X    while (n--)
X    {
X	iline = (ppt->y - ySrc) % pStipple->drawable.height ;
X	maxwidth = _8514_SCREENWIDTH - ppt->x ;
X	*pwidth = MIN(*pwidth,maxwidth) ;
X	data = pStipple->devPrivate.ptr + iline*stippleWidth ;
X
X        if ( !saved && !ibm8514cursorSemaphore )
X            saved = ibm8514CheckCursor(ppt->x%xSrc,ppt->y,
X					   	 *pwidth+stippleWidth,1) ;
X	/* I am only going to call replace ONCE, after the whole
X	   stipple id done */
X
X	/* set up stipple off screen */
X	xshift = (ppt->x - xSrc) % stippleWidth ;
X	ibm8514AlignMonoImage(WPLANE0,alu,STIPX,STIPY+1,stippleWidth,1,data) ;
X	if (xshift) 
X		{/* shift the stipple left, then tack on end to the right */
X		ibm8514Bitblt(GXcopy,RPLANE0,WPLANE0,STIPX+xshift,STIPY+1,
X			STIPX,STIPY,stippleWidth-xshift,1) ;
X		ibm8514Bitblt(GXcopy,RPLANE0,WPLANE0,STIPX,STIPY+1,
X			STIPX+stippleWidth-xshift,STIPY,xshift,1) ;
X		}
X
X	totlen = stippleWidth ;
X	while ( totlen<*pwidth)
X	  { /* widen stipple to totlen of area to be stippled */
X	  ibm8514Bitblt(GXcopy,RPLANE0,WPLANE0,
X			STIPX,STIPY,totlen,STIPY,totlen,1) ;
X	  totlen += totlen ;
X	  }
X
X    	ibm8514ClearQueue( 2 ) ;
X	SETXMIN(ppt->x) ; /* use clip to draw stippled line */
X	SETXMAX(*pwidth + ppt->x) ;
X
X	ibm8514BlitFGBG(RPLANE0,pm,fg,bg,alu,
X			STIPX,STIPY,ppt->x%xSrc,ppt->y,*pwidth+stippleWidth,1) ;
X
X    	ibm8514ClearQueue(2) ;
X	SETXMIN(0) ;
X	SETXMAX(_8514_SCREENWIDTH-1) ;
X
X	ppt++ ;
X	pwidth++ ;
X    }
X
X    DEALLOCATE_LOCAL(pptFree) ;
X    DEALLOCATE_LOCAL(pwidthFree) ;
X    if (saved)
X	ibm8514ReplaceCursor() ;
X
X    return ;
X}
END-of-ibm8514/brcFillSp.c
echo x - ibm8514/brcFont.c
sed 's/^X//' >ibm8514/brcFont.c << 'END-of-ibm8514/brcFont.c'
X/*
X * Copyright IBM Corporation 1987,1990
X *
X * All Rights Reserved
X *
X * Permission to use, copy, modify, and distribute this software and its
X * documentation for any purpose and without fee is hereby granted,
X * provided that the above copyright notice appear in all copies and that 
X * both that copyright notice and this permission notice appear in
X * supporting documentation, and that the name of IBM not be
X * used in advertising or publicity pertaining to distribution of the
X * software without specific, written prior permission.
X *
X * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
X * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
X * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
X * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
X * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
X * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
X * SOFTWARE.
X *
X*/
X/*
X * PRPQ 5799-PFF (C) COPYRIGHT IBM CORPORATION 1987,1990
X * LICENSED MATERIALS - PROPERTY OF IBM
X * REFER TO COPYRIGHT INSTRUCTIONS FORM NUMBER G120-2083
X */
X/*
X *  Hardware interface routines for IBM 8514/A adapter for
X *  X.11 server(s) on IBM equipment.
X *
X */
X/* $Header:
/andrew/X11/r3src/release/server/ddx/ibm/ibm8514/RCS/brcFont.c,v 30.2
89/02/28 18:16:03 paul Exp $ */
X/* $Source:
/andrew/X11/r3src/release/server/ddx/ibm/ibm8514/RCS/brcFont.c,v $ */
X
X#ifndef lint
Xstatic char *rcsid = "$Header:
/andrew/X11/r3src/release/server/ddx/ibm/ibm8514/RCS/brcFont.c,v 30.2
89/02/28 18:16:03 paul Exp $" ;
X#endif
X
X/* Cached Font Manager
X *
X * Try to stuff a font off screen and remember where it is
X * Always draw characters aligned to make life easy on the hardware
X * If no room, leave for Image Glyph Blit
X * When releasing, free up the space
X *
X */
X#include "X.h"
X#include "Xproto.h"
X#include "fontstruct.h"
X#include "dixfontstr.h"
X#include "dixfont.h"
X#include "font.h"
X#include "scrnintstr.h"
X
X#include "mfb.h"
X
X#include "OScompiler.h"
X
X#include "x8514.h"
X
X#include "brcFonts.h"
X
X#include "ibmTrace.h"
X
Xibm8514FontCacheRec ibm8514FontCacheEntry[NUMFONTPLANES] ;
X
Xvoid
Xibm8514InitFontCache()
X{
Xregister int i ;
X
XTRACE( ( "ibm8514InitFontCache()\n" ) ) ;
X
Xibm8514FontCacheEntry[0].RPlaneMask = RPLANE2 ;
Xibm8514FontCacheEntry[0].WPlaneMask = WPLANE2 ;
Xibm8514FontCacheEntry[1].RPlaneMask = RPLANE3 ;
Xibm8514FontCacheEntry[1].WPlaneMask = WPLANE3 ;
Xibm8514FontCacheEntry[2].RPlaneMask = RPLANE4 ;
Xibm8514FontCacheEntry[2].WPlaneMask = WPLANE4 ;
Xibm8514FontCacheEntry[3].RPlaneMask = RPLANE5 ;
Xibm8514FontCacheEntry[3].WPlaneMask = WPLANE5 ;
Xibm8514FontCacheEntry[4].RPlaneMask = RPLANE6 ;
Xibm8514FontCacheEntry[4].WPlaneMask = WPLANE6 ;
Xibm8514FontCacheEntry[5].RPlaneMask = RPLANE7 ;
Xibm8514FontCacheEntry[5].WPlaneMask = WPLANE7 ;
X
Xfor ( i = 0 ; i < NUMFONTPLANES ; i++ )
X	{
X	ibm8514FontCacheEntry[i].numInstalled 		= 0 ;
X	ibm8514FontCacheEntry[i].FirstAvailableLine	= FONTCACHESTARTLINE ;
X	ibm8514FontCacheEntry[i].NumLinesAvailable	= FONTCACHELENGTH ;
X	ibm8514FontCacheEntry[i].FontList		= NULL ;
X	}
Xreturn ;
X}
X
Xextern int ibm8514NumberOfPlanes ;
X
Xvoid
Xibm8514FreeFontChars( pChars, numChars )
Xregister InstalledCharPtr *pChars ;
Xregister int numChars ;
X{
Xregister InstalledCharPtr *pNextChar = pChars ;
X
Xwhile ( numChars-- )
X	Xfree( *pNextChar++ ) ;
XXfree( pChars ) ;
X
Xreturn ;
X}
X
XBool
Xibm8514RealizeFont( pscr, pFont )
X    ScreenPtr	pscr ;
X    FontPtr	pFont ;
X{
X    FontInfoPtr		pfi = pFont->pFI ;
X    CharInfoPtr		maxb = &pfi->maxbounds ;
X    int			lines, linesneeded, width, height, i,
X			numchars, firstchar, lastchar, found,
X			CacheEntries, destX, destY, glw, glh,
X			relativeY, wplane, padwidth ;
X    InstalledFontPtr	ptr, pIFont ;
X    char		*glyphs ;
X    CharInfoPtr		pCinfo ;
X
X    TRACE( ( "ibm8514RealizeFont: realizing 0x%x\n", pFont ) ) ;
X
X    if ( pfi->lastRow == 0 ) {
X	numchars = n1dChars( pfi ) ;
X	firstchar = pfi->chFirst ;
X	lastchar = pfi->chLast ;
X    }
X    else { /* XXX  This code needs to be looked at more  XXX */
X	numchars = n2dChars( pfi ) ;
X	pCinfo = pFont->pCI ;
X	for ( firstchar = -1, i = 0 ;
X	      ( ( i < 0xFFFF ) && ( firstchar == -1 ) ) ;
X	      i++ )
X		if ( pCinfo[i].exists )
X			firstchar = i ;
X	if ( ( i + numchars ) > 0xFFFF ) {
X		ErrorF("ibm8514RealizeFont: bad 16bit realize") ;
X		return mfbRealizeFont( pscr, pFont ) ;
X	}
X	lastchar = firstchar + numchars - 1 ;
X    }
X
X    lines = 1 ;
X    width = 0 ;
X    height = GLYPHHEIGHTPIXELS( maxb ) ;
X    if ( GLYPHWIDTHPIXELS( maxb ) > FONTCACHEWIDTH ) {
X	ErrorF( "Xibm: 8514: Not enough cache space (wide glyph)...") ;
X	ErrorF( "Font was 0x%x\n", pFont ) ;
X	return mfbRealizeFont( pscr, pFont ) ;
X    }
X
X    for ( i = 0 ; i < numchars ; i++ ) {
X	pCinfo = (CharInfoPtr) &(pFont->pCI[i]) ;
X	width += GLYPHWIDTHBYTES( pCinfo ) ;
X	if ( width > FONTCACHEBYTEWIDTH ) {
X		width = GLYPHWIDTHBYTES( pCinfo ) ;
X		lines++ ;
X	}
X    }
X
X    linesneeded = lines * height ;
X    CacheEntries = ibm8514NumberOfPlanes - 2 ; /* 1 for stage, 1 for fill, */
X					      /* rest are for fonts	*/
X
X    for ( i = 0, found = -1 ; ( i < CacheEntries ) && ( found == -1 ) ; i++ )
X	if ( linesneeded <= ibm8514FontCacheEntry[i].NumLinesAvailable )
X		found = i ;
X    if ( found == -1 ) /* Can't find enough space !! */
X	return mfbRealizeFont( pscr, pFont ) ;
X
X/* OK, we've space, we're going to go off-screen */
X    pIFont = (InstalledFontRec *) Xalloc( sizeof (InstalledFontRec) ) ;
X    if ( !pIFont )
X	{
X	ErrorF( "ibm8514RealizeFont: Cannot Xalloc for 0x%x\n", pFont ) ;
X	return mfbRealizeFont( pscr, pFont ) ;
X	}
X    pIFont->ppCharacter =
X	(InstalledCharPtr *) Xalloc( numchars * sizeof (InstalledCharPtr) ) ;
X    if ( !pIFont->ppCharacter )
X	{
X	ErrorF( "ibm8514RealizeFont: Cannot Xalloc for 0x%x\n", pFont ) ;
X	Xfree( pIFont ) ;
X	return mfbRealizeFont( pscr, pFont ) ;
X	}
X
X    pIFont->firstchar = firstchar ;
X    pIFont->lastchar = lastchar ;
X    pIFont->numchars = numchars ;
X    pIFont->CacheIndex = found ;
X    pIFont->cacheheight = linesneeded ;
X
X    destX = 0 ;
X    relativeY = 0 ;
X    destY = pIFont->startline =
X	ibm8514FontCacheEntry[found].FirstAvailableLine ;
X
X    /* allocate, install, fill chars */
X    wplane = ibm8514FontCacheEntry[found].WPlaneMask ;
X
X    for ( i = 0 ; i < numchars ; i++ ) {
X	pIFont->ppCharacter[i] =
X		(InstalledCharPtr) Xalloc( sizeof (InstalledCharRec) ) ;
X        if ( !(pIFont->ppCharacter[i]) ) {
X		ErrorF("ibm8514RealizeFont: Cannot Xalloc for 0x%x\n", pFont ) ;
X		ibm8514FreeFontChars( pIFont->ppCharacter, i ) ;
X		Xfree( pIFont ) ;
X		return mfbRealizeFont( pscr, pFont ) ;
X	}
X
X	pCinfo = pIFont->ppCharacter[i]->pInfo = &(pFont->pCI[i]) ;
X
X	if ( pCinfo->exists ) {
X		padwidth = 8 * GLYPHWIDTHBYTES( pCinfo ) ;
X		if ( destX + padwidth > FONTCACHEWIDTH ) {
X			destX = 0 ;
X			destY += height ; /* NEW LINE */
X			relativeY += height ;
X		}
X		pIFont->ppCharacter[i]->x = destX ;
X		pIFont->ppCharacter[i]->y = relativeY ;
X		pIFont->ppCharacter[i]->w = glw = GLYPHWIDTHPIXELS( pCinfo ) ;
X		pIFont->ppCharacter[i]->h = glh = GLYPHHEIGHTPIXELS( pCinfo ) ;
X		glyphs = pFont->pGlyphs + pCinfo->byteOffset ;
X		TRACE( (
X"Font Realize
align:pl=%d,destX=%d,destY=%d,glw=%d,glh=%d,glyphs=x%x,char=%d\n",
X		 	wplane, destX, destY, glw, glh, glyphs, i ) ) ;
X
X		/* dont do zero width or height glyphs */
X		if ( glw && glh )
X			ibm8514ByteAlignMonoImage( wplane, GXcopy, destX, destY,
X						   glw, glh, glyphs ) ;
X		destX += padwidth ;
X	}
X    }
X
X    /* tack the Installed Font into the beginning of the fontlist */
X    ptr = ibm8514FontCacheEntry[found].FontList ;
X    ibm8514FontCacheEntry[found].FontList = pIFont ;
X    pIFont->NextFont = ptr ;
X
X    ibm8514FontCacheEntry[found].numInstalled++ ;
X    ibm8514FontCacheEntry[found].FirstAvailableLine += linesneeded ;
X    ibm8514FontCacheEntry[found].NumLinesAvailable -= linesneeded ;
X
X    /* ok, so tell the world that it's been off-screened */
X    pFont->devPriv[pscr->myNum] = (pointer) pIFont ;
X    pIFont->pFont = pFont ;
X
X    return TRUE ;
X}
X
XBool
Xibm8514UnrealizeFont( pscr, pFont )
X    ScreenPtr	pscr ;
X    FontPtr	pFont ;
X{
Xint 			freeheight, blitheight, blitstart, blitdest ;
XInstalledFontPtr	currentfont, *lastfont, pIFont ;
Xibm8514FontCachePtr	pFC ;
X
XpIFont = (InstalledFontPtr) pFont->devPriv[pscr->myNum] ;
X
X/* this code depends on knowing what is going on in the mfb.  I am assuming
Xthat the mfbrealizefont routine will only store a 0,1,2 in the devPriv
Xfield, whereas I store a pointer.  In case the mfb grows, I will check
Xthe field to see if it is a mfb number else assuming a pointer
X*/
X
Xswitch ( (long) pIFont ) {
X		return mfbUnrealizeFont( pscr, pFont ) ;
X		break ; /* It is an off-screen cached font ! */
X}
X
XTRACE( ( "ibm8514UnrealizeFont: unrealizing 0x%x\n", pFont ) ) ;
X
X/* Free the font's character's data in core */
Xibm8514FreeFontChars( pIFont->ppCharacter, pIFont->numchars ) ;
X
XpFC = (ibm8514FontCachePtr) &(ibm8514FontCacheEntry[pIFont->CacheIndex]) ;
X
Xfreeheight = pIFont->cacheheight ;
Xblitstart = pIFont->startline+freeheight ;
Xblitheight = 0 ;
Xblitdest = pIFont->startline ;
X
Xcurrentfont = pFC->FontList ;
Xlastfont = (InstalledFontPtr *) &(pFC->FontList) ;
X/* notify all lower (earlier in list) fonts that they are moved up */
Xwhile ( currentfont != pIFont ) {
X	currentfont->startline -= freeheight ;
X	blitheight += currentfont->cacheheight ;
X	lastfont = (InstalledFontPtr *) &(currentfont->NextFont) ;
X	currentfont = currentfont->NextFont ;
X}
X/* move them up */
Xif ( blitheight )
X	ibm8514Bitblt( GXcopy, pFC->RPlaneMask, pFC->WPlaneMask,
X		       0, blitstart, 0, blitdest,
X		       FONTCACHEWIDTH, blitheight) ;
X
XpFC->FirstAvailableLine -= freeheight ;
XpFC->NumLinesAvailable += freeheight ;
XpFC->numInstalled-- ;
X*lastfont = pIFont->NextFont ;
XXfree( pIFont ) ;
X
Xreturn TRUE ;
X}
X
X#ifdef FONTDUMP
XFontDump( pscr, pFont )
X    ScreenPtr   pscr ;
X    FontPtr	pFont ;
X{
XInstalledFontPtr 	pIF ;
Xibm8514FontCachePtr	pFC ;
X
XpIF = (InstalledFontPtr) pFont->devPriv[pscr->myNum] ;
XpFC = (ibm8514FontCachePtr) &(ibm8514FontCacheEntry[pIF->CacheIndex]) ;
X
XErrorF( "FontDump: 0x%x\n", pFont ) ;
XErrorF( "InstalledFont:\n" ) ;
XErrorF( "\tCacheIndex = %d\n", pIF->CacheIndex ) ;
XErrorF( "\tstartline = %d\n", pIF->startline ) ;
XErrorF( "\tcacheheight = %d\n", pIF->cacheheight ) ;
XErrorF( "\tfirstchar = %d\n", pIF->firstchar ) ;
XErrorF( "\tlastchar = %d\n", pIF->lastchar ) ;
XErrorF( "\tnumchars = %d\n", pIF->numchars ) ;
XErrorF( "\tNextFont = %x\n", pIF->NextFont ) ;
X
XErrorF( "CacheIndex:\n" ) ;
XErrorF( "\tRplanemask, Wplanemask = %x, %x\n",
X	pFC->RPlaneMask,pFC->WPlaneMask ) ;
XErrorF( "\tnumInstalled = %d\n", pFC->numInstalled ) ;
XErrorF( "\tLinesAvail, First line = %d, %d\n",
X	pFC->FirstAvailableLine, pFC->NumLinesAvailable  ) ;
XErrorF( "\n" ) ;
X}
X#endif
X
X/* The X font from which it came */
Xstatic FontPtr *ibm8514SavedFontList = (FontPtr *) 0 ;
Xstatic int ibm8514SavedfontCount = 0 ;
X
Xvoid
Xibm8514CreateSavedFontList()
X{
XInstalledFontPtr brcFonts ;
XInstalledFontPtr nextInstalled ;
Xint i ;
Xint fontCount ;
Xint tPcnt ;
X
XfontCount = 0 ;
Xfor ( i = 0 ; i < NUMFONTPLANES ; i++ ) {
X	fontCount += ibm8514FontCacheEntry[i].numInstalled ;
X	ibm8514FontCacheEntry[i].FirstAvailableLine	= FONTCACHESTARTLINE ;
X	ibm8514FontCacheEntry[i].NumLinesAvailable	= FONTCACHELENGTH ;
X}
Xif ( !( ibm8514SavedFontList =
X		(FontPtr *) Xalloc( fontCount * sizeof (FontPtr) ) ) )
X	return ; /* Blew It !! */
X
Xibm8514SavedfontCount = 0 ;
Xfor ( i = 0 ; i < NUMFONTPLANES ; i++ ) {
X	brcFonts = ibm8514FontCacheEntry[i].FontList ;
X	for ( tPcnt = ibm8514FontCacheEntry[i].numInstalled ;
X	      tPcnt-- ; ) {
X		ibm8514SavedFontList[ibm8514SavedfontCount++] =
X			brcFonts->pFont ;
X		ibm8514FreeFontChars( brcFonts->ppCharacter,
X				      brcFonts->numchars ) ;
X		nextInstalled = brcFonts->NextFont ;
X		Xfree( brcFonts ) ;
X		brcFonts = nextInstalled ;
X	}
X	ibm8514FontCacheEntry[i].numInstalled 		= 0 ;
X	ibm8514FontCacheEntry[i].FontList		= NULL ;
X}
X
Xreturn ;
X}
X
Xvoid
Xibm8514RestoreOffScreenFonts( pScr )
XScreenPtr pScr ;
X{
XFontPtr *fontList = ibm8514SavedFontList ;
X
Xibm8514InitFontCache() ;
Xwhile ( ibm8514SavedfontCount-- )
X	ibm8514RealizeFont( pScr, *fontList++ ) ;
X
XXfree( ibm8514SavedFontList ) ;
Xibm8514SavedFontList = (FontPtr *) 0 ;
X
Xreturn ;
X}
END-of-ibm8514/brcFont.c
echo x - ibm8514/brcFonts.h
sed 's/^X//' >ibm8514/brcFonts.h << 'END-of-ibm8514/brcFonts.h'
X/*
X * Copyright IBM Corporation 1987,1990
X *
X * All Rights Reserved
X *
X * Permission to use, copy, modify, and distribute this software and its
X * documentation for any purpose and without fee is hereby granted,
X * provided that the above copyright notice appear in all copies and that 
X * both that copyright notice and this permission notice appear in
X * supporting documentation, and that the name of IBM not be
X * used in advertising or publicity pertaining to distribution of the
X * software without specific, written prior permission.
X *
X * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
X * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
X * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
X * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
X * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
X * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
X * SOFTWARE.
X *
X*/
X/*
X * PRPQ 5799-PFF (C) COPYRIGHT IBM CORPORATION 1987,1990
X * LICENSED MATERIALS - PROPERTY OF IBM
X * REFER TO COPYRIGHT INSTRUCTIONS FORM NUMBER G120-2083
X */
X/*
X *  Hardware interface routines for IBM 8514/A adapter for
X *  X.11 server(s) on IBM equipment.
X *
X */
X/* $Header:
/andrew/X11/r3src/earlyRelease/server/ddx/ibm/ibm8514/RCS/brcFonts.h,v
6.2 88/11/22 17:03:39 paul Exp $ */
X/* $Source:
/andrew/X11/r3src/earlyRelease/server/ddx/ibm/ibm8514/RCS/brcFonts.h,v $ */
X
X#if !defined(lint) && !defined(LOCORE) && defined(RCS_HDRS)
Xstatic char *rcsidibm8514fonts = "$Header:
/andrew/X11/r3src/earlyRelease/server/ddx/ibm/ibm8514/RCS/brcFonts.h,v
6.2 88/11/22 17:03:39 paul Exp $" ;
X#endif
X
Xtypedef struct _InstalledChar
X	{
X	unsigned short int x ;
X	unsigned short int y ; /* this is relative to the first cached line */
X	unsigned short int w ;
X	unsigned short int h ;
X	CharInfoPtr pInfo ;
X	} InstalledCharRec, *InstalledCharPtr ;
X
Xtypedef struct _InstalledFont
X	{
X	unsigned short int	CacheIndex ;
X	unsigned short int	startline ;
X	unsigned short int	cacheheight ;
X	unsigned short int	firstchar ;
X	unsigned short int	lastchar ;
X	unsigned short int	numchars ;
X	InstalledCharPtr	*ppCharacter ;
X	struct _InstalledFont	*NextFont ;
X	FontPtr			pFont ; /* The X font from which it came */
X	} InstalledFontRec, *InstalledFontPtr ;
X
Xtypedef struct _ibm8514FontCacheEntry
X	{
X	unsigned long int	RPlaneMask ;
X	unsigned long int	WPlaneMask ;
X	int			numInstalled ;
X	unsigned short int	FirstAvailableLine ;
X	unsigned short int	NumLinesAvailable ;
X	InstalledFontPtr 	FontList ;
X	} ibm8514FontCacheRec, *ibm8514FontCachePtr ;
X
X#define FONTCACHESTARTLINE	801
X#define FONTCACHELENGTH		222
X#define FONTCACHEWIDTH		1024
X#define FONTCACHEBYTEWIDTH	128
X#define NUMFONTPLANES		6    /* save 1 for stage, 1 for fill */
END-of-ibm8514/brcFonts.h
echo x - ibm8514/brcGBlt.c
sed 's/^X//' >ibm8514/brcGBlt.c << 'END-of-ibm8514/brcGBlt.c'
X/*
X * Copyright IBM Corporation 1987,1990
X *
X * All Rights Reserved
X *
X * Permission to use, copy, modify, and distribute this software and its
X * documentation for any purpose and without fee is hereby granted,
X * provided that the above copyright notice appear in all copies and that 
X * both that copyright notice and this permission notice appear in
X * supporting documentation, and that the name of IBM not be
X * used in advertising or publicity pertaining to distribution of the
X * software without specific, written prior permission.
X *
X * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
X * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
X * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
X * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
X * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
X * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
X * SOFTWARE.
X *
X*/
X/*
X * PRPQ 5799-PFF (C) COPYRIGHT IBM CORPORATION 1987,1990
X * LICENSED MATERIALS - PROPERTY OF IBM
X * REFER TO COPYRIGHT INSTRUCTIONS FORM NUMBER G120-2083
X */
X/*
X *  Hardware interface routines for IBM 8514/A adapter for
X *  X.11 server(s) on IBM equipment.
X *
X */
X
X/* $Header:
/andrew/X11/r3src/release/server/ddx/ibm/ibm8514/RCS/brcGBlt.c,v 30.0
89/01/23 19:23:37 paul Exp $ */
X/* $Source:
/andrew/X11/r3src/release/server/ddx/ibm/ibm8514/RCS/brcGBlt.c,v $ */
X
X#ifndef lint
Xstatic char *rcsid = "$Header:
/andrew/X11/r3src/release/server/ddx/ibm/ibm8514/RCS/brcGBlt.c,v 30.0
89/01/23 19:23:37 paul Exp $";
X#endif
X
X/* 
X * Image Glyph Blit
X * For use when font cache is full
X *
X */
X
X#include "X.h"
X#include "Xmd.h"
X#include "Xproto.h"
X#include "fontstruct.h"
X#include "dixfontstr.h"
X#include "gcstruct.h"
X#include "windowstr.h"
X#include "scrnintstr.h"
X#include "pixmapstr.h"
X#include "regionstr.h"
X
X#include "OScompiler.h"
X
X#include "ppc.h"
X
X#include "x8514.h"
X
X#include "ibmTrace.h"
X
Xextern int ibm8514cursorSemaphore;
Xextern int mfbGCPrivateIndex;
X
Xvoid
Xibm8514ImageGlyphBlt( pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
X    DrawablePtr pDrawable;
X    GC 		*pGC;
X    int 	x, y;
X    unsigned int nglyph;
X    CharInfoPtr *ppci;		/* array of character info */
X    unsigned char *pglyphBase;	/* start of array of glyphs */
X{
X    int CursorIsSaved;
X    ExtentInfoRec info;	/* used by QueryGlyphExtents() */
X    BoxRec bbox;	/* string's bounding box */
X    xRectangle backrect;/* backing rectangle to paint.
X			   in the general case, NOT necessarily
X			   the same as the string's bounding box
X			*/
X    CharInfoPtr pci;
X    int xorg, yorg;	/* origin of drawable in bitmap */
X    int w;		/* width of glyph in bits */
X    int h;		/* height of glyph */
X    register unsigned char *pglyph;
X			/* pointer to current row of glyph */
X    int nbox;
X    BoxPtr pbox;
X    int i ;
X    RegionPtr pRegion;
X    unsigned long int pm, bg, fg ;
X    int x0, y0 ;
X
X    TRACE(("ibm8514ImageGlyphBlt( pDrawable = 0x%x, pGC = 0x%x, x=%d,
y=%d, nglyph=%d, ppci= 0x%x, pglyphBase= 0x%x)\n", pDrawable, pGC, x, y,
nglyph, ppci, pglyphBase));
X    if ( !( pGC->planemask & ibm8514ALLPLANES ) )
X	return ;
X
X    xorg = pDrawable->x;
X    yorg = pDrawable->y;
X
X    QueryGlyphExtents(pGC->font, ppci, nglyph, &info);
X
X    x += xorg;
X    y += yorg;
X
X    backrect.x = x + info.overallLeft;
X    backrect.y = y - pGC->font->pFI->fontAscent;
X    backrect.width = info.overallRight - info.overallLeft;
X    backrect.width = MAX( backrect.width, info.overallWidth );
X    backrect.height = pGC->font->pFI->fontAscent + 
X		      pGC->font->pFI->fontDescent;
X
X    bbox.x1 = x + info.overallLeft;
X    bbox.x2 = x + info.overallRight;
X    bbox.y1 = y - info.overallAscent;
X    bbox.y2 = y + info.overallDescent;
X
X    pRegion = ((ppcPrivGC
*)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pCompositeClip;
X    nbox = REGION_NUM_RECTS(pRegion);
X    if ( nbox == 0 )
X	return;
X
X
X    pbox = REGION_RECTS(pRegion);
X    pm =  pGC->planemask;
X    fg =  pGC->fgPixel;
X    bg =  pGC->bgPixel;
X    CursorIsSaved = !ibm8514cursorSemaphore && ibm8514CheckCursor(
backrect.x, backrect.y, backrect.width, backrect.height );
X    for ( i = nbox ; i-- ; pbox++ ) {
X	ibm8514ClearQueue(4);
X	SETXMIN(pbox->x1);
X	SETYMIN(pbox->y1);
X	SETXMAX(pbox->x2-1);
X	SETYMAX(pbox->y2-1);
X	ibm8514DrawRectangle( bg, GXcopy, pm,
X		backrect.x, backrect.y,
X		backrect.width, backrect.height);
X    }
X
X    ibm8514ClearQueue(4);
X    SETXMIN(0);
X    SETYMIN(0);
X    SETXMAX(_8514_SCREEN_WIDTH-1);
X    SETYMAX( 1023 ) ;
X
X    if ( CursorIsSaved )
X	ibm8514ReplaceCursor();
X
X    CursorIsSaved = !ibm8514cursorSemaphore && ibm8514CheckCursor(
bbox.x1, bbox.y1, bbox.x2-bbox.x1, bbox.y2-bbox.y1 );
X
X    switch ( (*pGC->pScreen->RectIn)(
X		  ( (ppcPrivGC
*)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pCompositeClip, &bbox ) )
X    {
X	break;
X
X        while (nglyph--)
X        {
X	    pci = *ppci;
X	    pglyph = pglyphBase + pci->byteOffset;
X	    w = GLYPHWIDTHPIXELS(pci);
X	    h = GLYPHHEIGHTPIXELS(pci);
X	    x0 = x + pci->metrics.leftSideBearing;
X	    y0 = y - pci->metrics.ascent;
X	    /* draw offscreen */
X	    ibm8514ByteAlignMonoImage( MONO_STAGE_WPLANE, GXcopy,
X				       MONO_STAGE_X, MONO_STAGE_Y,
X				       w, h, pglyph ) ;
X	    /* blit onscreen */
X	    ibm8514BlitFG( MONO_STAGE_RPLANE, pm, fg, GXcopy,
X			   MONO_STAGE_X, MONO_STAGE_Y, x0, y0, w, h ) ;
X
X	    /* update character origin */
X	    x += pci->metrics.characterWidth;
X	    ppci++;
X        } /* while nglyph-- */
X	break;
X      {
X	int nbox;
X	BoxPtr pbox;
X	int i;
X	RegionPtr prgnClip;
X	BoxRec cbox;
X	int glx, gly;
X
X        while (nglyph--)
X        {
X	    pci = *ppci;
X	    pglyph = pglyphBase + pci->byteOffset;
X	    w = GLYPHWIDTHPIXELS(pci);
X	    h = GLYPHHEIGHTPIXELS(pci);
X	    cbox.x1 = glx = x + pci->metrics.leftSideBearing;
X	    cbox.y1 = gly = y - pci->metrics.ascent;
X	    cbox.x2 = cbox.x1 + w;
X	    cbox.y2 = cbox.y1 + h;
X
X	    switch ((*pGC->pScreen->RectIn)(
X		  ((ppcPrivGC
*)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pCompositeClip, &cbox))
X
X	    {
X		break;
X		/* draw offscreen */
X	    	ibm8514ByteAlignMonoImage( MONO_STAGE_WPLANE, GXcopy,
X				           MONO_STAGE_X, MONO_STAGE_Y,
X				           w, h, pglyph ) ;
X		/* blit onscreen */
X	    	ibm8514BlitFG( MONO_STAGE_RPLANE, pm, fg, GXcopy,
X			       MONO_STAGE_X, MONO_STAGE_Y,
X			       glx, gly, w, h ) ;
X		break;
X		prgnClip =
X		  (* ((WindowPtr)pDrawable)->drawable.pScreen->RegionCreate)(
X		  &cbox, 
X		  REGION_NUM_RECTS(((ppcPrivGC
*)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pCompositeClip)) ;
X		(* ((WindowPtr)pDrawable)->drawable.pScreen->Intersect)
X			( prgnClip, prgnClip, 
X			  ((ppcPrivGC
*)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pCompositeClip ) ;
X		if ( !( nbox = REGION_NUM_RECTS(prgnClip) ) )
X		    break;
X		pbox = REGION_RECTS(prgnClip);
X		/* draw offscreen */
X	    	ibm8514ByteAlignMonoImage( MONO_STAGE_WPLANE, GXcopy,
X					   MONO_STAGE_X, MONO_STAGE_Y,
X					   w, h, pglyph ) ;
X/* ****** THIS STINKS & MUST BE FIXED SOMEDAY -- SOON ****** */
X		for ( i = nbox ; i-- ; pbox++ ) {
X			ibm8514ClearQueue( 4 ) ;
X			SETXMIN(pbox->x1);
X			SETYMIN(pbox->y1);
X			SETXMAX(pbox->x2-1);
X			SETYMAX(pbox->y2-1);
X			/* blit onscreen*/
X	    		ibm8514BlitFG( MONO_STAGE_RPLANE, pm, fg, GXcopy,
X				       MONO_STAGE_X, MONO_STAGE_Y,
X				       glx, gly, w, h ) ;
XTRACE(("gbltPARTPART: call BlitFG: x=%d, y=%d, w=%d, h=%d\n", glx,gly,w,h));
X		}
X
X		(* ((WindowPtr)pDrawable)->drawable.pScreen->RegionDestroy)
X			(prgnClip);
X		ibm8514ClearQueue( 4 );
X		SETXMIN(0);
X		SETYMIN(0);
X		SETXMAX(_8514_SCREEN_WIDTH-1);
X		SETYMAX( 1023 ) ;
X		break;
X	    }
X	    /* update character origin */
X	    x += pci->metrics.characterWidth;
X	    ppci++;
X        } /* while nglyph-- */
X
X      }
X	break;
X    }
X
X    if ( CursorIsSaved )
X	ibm8514ReplaceCursor();
X    return ;
X}
END-of-ibm8514/brcGBlt.c
echo x - ibm8514/brcGC.c
sed 's/^X//' >ibm8514/brcGC.c << 'END-of-ibm8514/brcGC.c'
X/*
X * Copyright IBM Corporation 1987,1990
X *
X * All Rights Reserved
X *
X * Permission to use, copy, modify, and distribute this software and its
X * documentation for any purpose and without fee is hereby granted,
X * provided that the above copyright notice appear in all copies and that 
X * both that copyright notice and this permission notice appear in
X * supporting documentation, and that the name of IBM not be
X * used in advertising or publicity pertaining to distribution of the
X * software without specific, written prior permission.
X *
X * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
X * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
X * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
X * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
X * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
X * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
X * SOFTWARE.
X *
X*/
X/*
X * PRPQ 5799-PFF (C) COPYRIGHT IBM CORPORATION 1987,1990
X * LICENSED MATERIALS - PROPERTY OF IBM
X * REFER TO COPYRIGHT INSTRUCTIONS FORM NUMBER G120-2083
X */
X/*
X *  Hardware interface routines for IBM 8514/A adapter for
X *  X.11 server(s) on IBM equipment.
X *
X */
X
X/***********************************************************
XCopyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
Xand the Massachusetts Institute of Technology, Cambridge, Massachusetts.
X
X			All Rights Reserved
X
XPermission to use, copy, modify, and distribute this software and its
Xdocumentation for any purpose and without fee is hereby granted,
Xprovided that the above copyright notice appear in all copies and that
Xboth that copyright notice and this permission notice appear in
Xsupporting documentation, and that the names of Digital or MIT not be
Xused in advertising or publicity pertaining to distribution of the
Xsoftware without specific, written prior permission.
X
XDIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
XALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
XDIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
XANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
XWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
XARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
XSOFTWARE.
X
X******************************************************************/
X
X/* $Header:
/andrew/X11/r3src/r3plus/server/ddx/ibm/ibm8514/RCS/brcGC.c,v 6.12
89/07/06 13:55:40 jeff Exp $ */
X/* $Source: /andrew/X11/r3src/r3plus/server/ddx/ibm/ibm8514/RCS/brcGC.c,v $ */
X
X#ifndef lint
Xstatic char *rcsid = "$Header:
/andrew/X11/r3src/r3plus/server/ddx/ibm/ibm8514/RCS/brcGC.c,v 6.12
89/07/06 13:55:40 jeff Exp $" ;
X#endif
X
X#include "X.h"
X#include "Xproto.h"
X#include "windowstr.h"
X#include "window.h"
X#include "pixmapstr.h"
X#include "scrnintstr.h"
X#include "misc.h"
X#include "font.h"
X#include "gcstruct.h"
X#include "cursorstr.h"
X#include "region.h"
X
X#include "mistruct.h"
X
X#include "../../mfb/mfb.h"
X
X#include "OScompiler.h"
X
X#include "ppc.h"
X#include "ppcProcs.h"
X
X#include "brcProcs.h"
X#include "ibmTrace.h"
X
X#ifdef Use8514HardwareDashes
Xextern void ibm8514ZeroDash() ;		/* will be .h */
X#endif
X
Xextern void miWideLine() ;
Xextern int mfbGCPrivateIndex;
X
XMask
Xibm8514ChangeGCtype( pGC, devPriv )
Xregister GC *pGC ;
Xregister ppcPrivGCPtr devPriv ;
X{
X	if ( devPriv->lastDrawableType == DRAWABLE_PIXMAP ) {
X	    devPriv->FillArea	= mfbSolidInvertArea ;
X	    pGC->ops->CopyArea	= miCopyArea ;
X	    pGC->ops->PolyFillRect	= miPolyFillRect ;
X	    pGC->ops->FillPolygon	= miFillPolygon ;
X	    pGC->ops->ImageText8	= miImageText8 ;
X	    pGC->ops->ImageText16	= miImageText16 ;
X	    pGC->ops->PolyText8	= miPolyText8 ;
X	    pGC->ops->PolyText16	= miPolyText16 ;
X	    pGC->ops->PushPixels	= miPushPixels ;
X    	    pGC->ops->PolyGlyphBlt	= miPolyGlyphBlt ;
X	    pGC->ops->PolyArc	= miPolyArc ;
X	    pGC->ops->PolyFillArc	= miPolyFillArc ;
X	    pGC->ops->PolySegment	= miPolySegment ;
X	    pGC->ops->PolyRectangle	= miPolyRectangle ;
X	}
X	else {
X	    devPriv->FillArea	= ppcAreaFill ;
X	    pGC->ops->CopyArea	= ppcCopyArea ;
X	    pGC->ops->PolyFillRect	= ppcPolyFillRect ;
X	    pGC->ops->FillPolygon	= ibm8514FillPolygon ;
X	    pGC->ops->ImageText8	= (void (*)()) ibm8514ImageText8 ;
X	    pGC->ops->ImageText16	= (void (*)()) ibm8514ImageText16 ;
X	    pGC->ops->PolyText8	= ibm8514PolyText8 ;
X	    pGC->ops->PolyText16	= ibm8514PolyText16 ;
X	    pGC->ops->PushPixels	= ibm8514PushPixels ;
X    	    pGC->ops->PolyGlyphBlt	= ppcPolyGlyphBlt ;
X	}
X	return;
X}
X
XMask
Xibm8514ChangeWindowGC( pGC, changes )
Xregister GC *pGC ;
Xregister Mask changes ;
X{
Xregister ppcPrivGCPtr devPriv = (ppcPrivGCPtr)
(pGC->devPrivates[mfbGCPrivateIndex].ptr) ;
Xregister unsigned long int index ; /* used for stepping through bitfields */
Xregister Mask bsChanges = 0 ;
X
X#define LOWBIT( x ) ( x & - x ) /* Two's complement */
X    while ( index = LOWBIT( changes ) ) {
X	switch ( index ) {
X
X		if ( pGC->lineStyle == LineSolid ) {
X	    		pGC->ops->PolySegment = ( ( pGC->lineWidth == 0 )
X				? ppcScrnZeroSegs : miPolySegment ) ;
X	    		pGC->ops->Polylines = ( ( pGC->lineWidth == 0 )
X				? ppcScrnZeroLine : miWideLine ) ;
X	    		pGC->ops->PolyArc = ( ( pGC->lineWidth == 0 )
X				? ppcPolyZeroArc : miPolyArc ) ;
X		}
X		else {
X	    		pGC->ops->PolySegment = miPolySegment;
X#ifdef Use8514HardwareDashes
X			if ( pGC->lineWidth == 0 ) {
X				extern void ibm8514_do_dashline_gc() ;
X				ibm8514_do_dashline_gc( pGC ) ;
X			}
X			else {
X				pGC->ops->Polylines = miWideDash ;
X			}
X#else
X			pGC->ops->Polylines = ( pGC->lineWidth == 0 )
X					? ppcScrnZeroDash : miWideDash ;
X#endif
X			pGC->ops->PolyArc = miPolyArc;
X		}
X	    /*
X	     * If these are just square boxes with no funny business
X	     * going on we can call the fast routine that draws
X	     * rectangles without floating point.
X	     */
X	    if ( ( pGC->lineStyle == LineSolid ) 
X			&& ( pGC->joinStyle == JoinMiter ) 
X			&& ( pGC->lineWidth != 0 ) )
X		pGC->ops->PolyRectangle = ppcPolyRectangle;
X	    else
X		pGC->ops->PolyRectangle = miPolyRectangle;
X
X	    changes &= ~( GCLineStyle | GCLineWidth ) ;
X	    break ;
X	    pGC->ops->LineHelper =
X		( pGC->joinStyle == JoinMiter ) ? miMiter : miNotMiter ;
X	    /*
X	     * If these are just square boxes with no funny business
X	     * going on we can call the fast routine that draws
X	     * rectangles without floating point.
X	     */
X	    if ( ( pGC->lineStyle == LineSolid ) 
X			&& ( pGC->joinStyle == JoinMiter ) 
X			&& ( pGC->lineWidth != 0 ) )
X		pGC->ops->PolyRectangle = ppcPolyRectangle;
X	    else
X		pGC->ops->PolyRectangle = miPolyRectangle;
X	    changes &= ~ index ; /* i.e. changes &= ~ GCJoinStyle */
X	    break ;
X
X	    if ( pGC->fillStyle != FillOpaqueStippled ) {
X		changes &= ~ index ; /* i.e. changes &= ~GCBackground */
X		break ;
X	    } /* else Fall Through */
X	    if ( pGC->fillStyle == FillTiled ) {
X		changes &= ~ index ; /* i.e. changes &= ~GCForeground */
X		break ;
X	    } /* else Fall Through */
X	    { /* new_fill */
X		int fillStyle = devPriv->colorRrop.fillStyle ;
X		/* install a suitable fillspans */
X		if ( fillStyle == FillSolid )
X		    pGC->ops->FillSpans = ibm8514SolidFS ;
X		else if ( fillStyle == FillStippled )
X		    pGC->ops->FillSpans = ppcStippleWindowFS ;
X		else if ( fillStyle == FillOpaqueStippled )
X		    pGC->ops->FillSpans = ppcOpStippleWindowFS ;
X		else /* fillStyle == FillTiled */
X		    pGC->ops->FillSpans = ibm8514TileFS ;
X		pGC->ops->PolyFillArc = ppcPolyFillArc;
X	    } /* end of new_fill */
X	    changes &= ~( GCBackground | GCForeground
X		     | GCFunction
X		     | GCPlaneMask | GCFillStyle ) ;
X	    break ;
X
X	    ErrorF( "ibm8514ValidateGC: Unexpected GC Change\n" ) ;
X	    changes &= ~ index ; /* Remove it anyway */
X	    break ;
X	}
X    }
X    return bsChanges ;
X}
END-of-ibm8514/brcGC.c
echo x - ibm8514/brcGetSp.c
sed 's/^X//' >ibm8514/brcGetSp.c << 'END-of-ibm8514/brcGetSp.c'
X/*
X * Copyright IBM Corporation 1987,1990
X *
X * All Rights Reserved
X *
X * Permission to use, copy, modify, and distribute this software and its
X * documentation for any purpose and without fee is hereby granted,
X * provided that the above copyright notice appear in all copies and that 
X * both that copyright notice and this permission notice appear in
X * supporting documentation, and that the name of IBM not be
X * used in advertising or publicity pertaining to distribution of the
X * software without specific, written prior permission.
X *
X * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
X * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
X * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
X * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
X * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
X * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
X * SOFTWARE.
X *
X*/
X/*
X * PRPQ 5799-PFF (C) COPYRIGHT IBM CORPORATION 1987,1990
X * LICENSED MATERIALS - PROPERTY OF IBM
X * REFER TO COPYRIGHT INSTRUCTIONS FORM NUMBER G120-2083
X */
X/* $Header:
/andrew/X11/r3src/release/server/ddx/ibm/ibm8514/RCS/brcGetSp.c,v 6.3
89/02/14 22:23:05 paul Exp $ */
X/* $Source:
/andrew/X11/r3src/release/server/ddx/ibm/ibm8514/RCS/brcGetSp.c,v $ */
X
X#ifndef lint
Xstatic char *rcsid = "$Header:
/andrew/X11/r3src/release/server/ddx/ibm/ibm8514/RCS/brcGetSp.c,v 6.3
89/02/14 22:23:05 paul Exp $" ;
X#endif
X
X#include "X.h"
X#include "Xmd.h"
X
X#include "region.h"
X#include "gc.h"
X#include "windowstr.h"
X#include "pixmapstr.h"
X#include "scrnintstr.h"
X#include "servermd.h"
X
X#include "ibmTrace.h"
X
Xextern void ppcGetSpans() ;
X
Xvoid
Xibm8514GetSpans( pDrawable, wMax, ppt, pwidth, nspans, pdstStart )
X    DrawablePtr		pDrawable ;
X    int			wMax ;
X    register DDXPointPtr ppt ;
X    int			*pwidth ;
X    int			nspans ;
X    unsigned long int *pdstStart ;
X{
X    register unsigned int *pdst ;	/* where to put the bits */
X    register unsigned int width ;
X
X    if ( pDrawable->type != DRAWABLE_WINDOW )
X	{
X	ppcGetSpans( pDrawable, wMax, ppt, pwidth, nspans, pdstStart ) ;
X	return ;
X	}
X
X/*******************************************************************/
X    /* read back the slices */
X    for ( pdst = pdstStart ; nspans-- ; ppt++, pwidth++ ) {
X	width = *pwidth ;
X	ibm8514ReadColorImage( ppt->x, ppt->y, width, 1, pdst,
X			       ( width + 3 ) & ~3 ) ;
X	pdst += ( width + 3 ) >> 2 ; /* width is in 32 bit words */
X    }
X/*******************************************************************/
X
X    return ;
X}
END-of-ibm8514/brcGetSp.c
echo x - ibm8514/brcIO.c
sed 's/^X//' >ibm8514/brcIO.c << 'END-of-ibm8514/brcIO.c'
X/*
X * Copyright IBM Corporation 1987,1990
X *
X * All Rights Reserved
X *
X * Permission to use, copy, modify, and distribute this software and its
X * documentation for any purpose and without fee is hereby granted,
X * provided that the above copyright notice appear in all copies and that 
X * both that copyright notice and this permission notice appear in
X * supporting documentation, and that the name of IBM not be
X * used in advertising or publicity pertaining to distribution of the
X * software without specific, written prior permission.
X *
X * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
X * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
X * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
X * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
X * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
X * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
X * SOFTWARE.
X *
X*/
X/*
X * PRPQ 5799-PFF (C) COPYRIGHT IBM CORPORATION 1987,1990
X * LICENSED MATERIALS - PROPERTY OF IBM
X * REFER TO COPYRIGHT INSTRUCTIONS FORM NUMBER G120-2083
X */
X/*
X *  Hardware interface routines for IBM 8514/A adapter for
X *  X.11 server(s) on IBM equipment.
X *
X */
X
X/* $Header: brcIO.c,v 1.1 89/11/14 13:25:53 keith Exp $ */
X/* $Source: /users/keith/X/ibm8514/RCS/brcIO.c,v $ */
X
X#ifndef lint
Xstatic char *rcsid = "$Header: brcIO.c,v 1.1 89/11/14 13:25:53 keith Exp $" ;
X#endif
X
X#include "X.h"
X#include "servermd.h"
X#include "screenint.h"
X#include "scrnintstr.h"
X#include "pixmapstr.h"
X#include "miscstruct.h"
X#include "window.h"
X#include "windowstr.h"
X#include "colormap.h"
X#include "colormapst.h"
X#include "resource.h"
X
X#include "ibmScreen.h"
X
X#include "ppc.h"
X
X#include "x8514.h"
X
X#include "ibmTrace.h"
X
Xint ibm8514HeadInstalled = HEAD_NONE ;
Xint ibm8514NumberOfPlanes = IBM8514MAXPLANES ;
X
X/**********************************************************************
********/
X
Xstatic int ibm8514Generation = 0 ;
X
X/* Declared in "ibm8514Data.c" */
Xextern GC ibm8514PrototypeGC ;
Xextern ScreenRec ibm8514ScreenRec ;
Xextern ppcScrnPriv ibm8514ScrnPriv ;
Xextern VisualRec ibm8514Visuals[] ;
Xextern DepthRec ibm8514Depths[] ;
Xextern unsigned long ibm8514DepthVIDs[];
Xextern PixmapFormatRec ibm8514Formats[] ;
X
XBool
Xibm8514ScreenInit( index, pScreen, argc, argv )
Xregister const int index ;
Xregister ScreenPtr const pScreen ;
Xregister int const argc ;		/* these two may NOT be changed */
Xregister char * const * const argv ;
X{
X	int	i;
X	TRACE( ( "ibm8514ScreenInit(index=%d,pScreen=0x%x,argc=%d,argv=0x%x)\n",
X		 index, pScreen, argc, argv ) ) ;
X
X	if ( ibm8514Generation != serverGeneration ) {
X		for (i = 0; i < ibm8514ScreenRec.numVisuals; i++)
X		{
X		    ibm8514DepthVIDs[i] =
X			ibm8514Visuals[i].vid = FakeClientID(0);
X		}
X		ibm8514ScreenRec.rootVisual = ibm8514Visuals[0].vid;
X		if ( ( ibm8514NumberOfPlanes = ibm8514ScreenInitHW( index ) )
X		     != 8 ) {
X			ibm8514PrototypeGC.planemask =
X				( ibm8514Visuals[0].ColormapEntries =
X					1 << ( ibm8514Visuals[0].nplanes =
X					       ibm8514Formats[0].depth = 
X					       ibm8514Depths[1].depth =
X					       ibm8514ScreenRec.rootDepth =
X				       ibm8514ScrnPriv.pixmap.drawable.depth =
X					       ibm8514PrototypeGC.depth =
X					       ibm8514NumberOfPlanes ) ) - 1 ;
X		}
X		ibm8514ScrnPriv.pixmap.devKind =
X			PixmapBytePad( _8514_SCREEN_WIDTH,
X				       ibm8514NumberOfPlanes ) ;
X		ibm8514Visuals[0].class = ibm8514QueryHead() ;
X		ibm8514Generation = serverGeneration;
X	}
X	/* Magic Hardware Initialization */
X	ibm8514outw( ibm8514_MiscIO, 0x0005 ) ;
X
X	ppcCommonScreenInit( pScreen, index, &ibm8514ScreenRec ) ;
X
X	ibm8514CursorInit( index ) ;
X	ibm8514InitFontCache() ;
X
X	/* we MIGHT return 0 if we had been keeping track of potential
X	   allocation failures.  one day someone will clean this up.
X	*/
X	return 1 ;
X}
X
X/*ARGSUSED*/
XBool
Xibm8514ScreenClose( index, pScreen )
Xregister const int index ;
Xregister ScreenPtr const pScreen ;
X{
XTRACE( ( "ibm8514ScreenClose(index=%d,pScreen=0x%x)\n", index, pScreen ) ) ;
XppcCommonScreenClose( pScreen, index, &ibm8514ScreenRec ) ;
Xif ( ibm8514Generation == serverGeneration ) {
X	ibm8514outw( ibm8514_MiscIO, 0 ) ;  /* reset 'miscio' */
X}
X
Xreturn TRUE ;
X}
END-of-ibm8514/brcIO.c
exit

mlewis@dolphin.tcspa.ibm.com (Mark S. Lewis) (03/13/90)

Subject: IBM 8514 source code (part 4 of 6) for X11 Release 4
Index: ../mit/server/ddx/ibm/ibm8514

Description:	
IBM has decided to provide X11 source code for the 8514 display
adapter.  This is the same code used to build the object files
included in the X11 Release 4 distribution.  This code supports
servers for both AIX and IBM/4.3 on their respective platforms.

	V1.32_kit.1	59,103 Bytes
	V1.32_kit.2	61,796 Bytes
	V1.32_kit.3	60,982 Bytes
	V1.32_kit.4	62,729 Bytes
	V1.32_kit.5	54,871 Bytes
	V1.32_kit.6	29,170 Bytes

Installation:	
This code is provided in a 6-part shell archive.  Before you
install it, you should save your current code.  You should save
the Imakefile in the ibm server directory.  You also should save
the entire ibm8514 directory by moving and remaking it.

	cd ../mit/server/ddx/ibm
	cp Imakefile Imakefile.orig
	mv ibm8514 ibm8514.orig
	mkdir ibm8514
	
Next, edit this header from each part, and feed the rest to
/bin/sh.  Proceed to make the server as instructed in the
X11 release notes.

	sh < V1.32_kit.4

=====-----     Mark S. Lewis, IBM AWD Palo Alto    -----======
inet: mlewis%ibmsupt@uunet.uu.net		(415) 855-4486
uucp: uunet!ibmsupt!mlewis              IBM Tie Line: 465-4486

# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
#
#	ibm8514/brcImg.c
#	ibm8514/brcLine.c
#	ibm8514/brcMono.c
#	ibm8514/brcOSD.c
#	ibm8514/brcOutL.c
#	ibm8514/brcPgon.c
#	ibm8514/brcPoly.c
#	ibm8514/brcProcs.h
#	ibm8514/brcPushPxl.c
#
echo x - ibm8514/brcImg.c
sed 's/^X//' >ibm8514/brcImg.c << 'END-of-ibm8514/brcImg.c'
X/*
X * Copyright IBM Corporation 1987,1990
X *
X * All Rights Reserved
X *
X * Permission to use, copy, modify, and distribute this software and its
X * documentation for any purpose and without fee is hereby granted,
X * provided that the above copyright notice appear in all copies and that 
X * both that copyright notice and this permission notice appear in
X * supporting documentation, and that the name of IBM not be
X * used in advertising or publicity pertaining to distribution of the
X * software without specific, written prior permission.
X *
X * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
X * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
X * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
X * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
X * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
X * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
X * SOFTWARE.
X *
X*/
X/*
X * PRPQ 5799-PFF (C) COPYRIGHT IBM CORPORATION 1987,1990
X * LICENSED MATERIALS - PROPERTY OF IBM
X * REFER TO COPYRIGHT INSTRUCTIONS FORM NUMBER G120-2083
X */
X/*
X *  Hardware interface routines for IBM 8514/A adapter for
X *  X.11 server(s) on IBM equipment.
X *
X */
X
X/* $Header:
/andrew/X11/r3src/release/server/ddx/ibm/ibm8514/RCS/brcImg.c,v 30.1
89/04/29 21:59:24 jeff Exp $ */
X/* $Source:
/andrew/X11/r3src/release/server/ddx/ibm/ibm8514/RCS/brcImg.c,v $ */
X
X#ifndef lint
Xstatic char *rcsid = "$Header:
/andrew/X11/r3src/release/server/ddx/ibm/ibm8514/RCS/brcImg.c,v 30.1
89/04/29 21:59:24 jeff Exp $" ;
X#endif
X
X/* IMAGES
X * Read and Write Full Color Images to/from 8514/A
X *
X */
X#include "X.h"
X
X#include "servermd.h"
X
X#include "OScompiler.h"
X
X#include "x8514.h"
X
X#include "ibmTrace.h"
X
Xextern int mergexlate[16] ;
Xextern int ibm8514cursorSemaphore ;
X
Xextern void blockoutw() ;
Xextern void blockinw() ;
X
Xvoid
Xibm8514DrawColorImage( x, y, w, h, data, RowIncrement, merge, planes )
Xint x,y ;
Xregister int w ;
Xint h ;
Xregister unsigned char *data ;
Xint RowIncrement ;
Xint merge ;
Xunsigned long int planes ;
X{
Xint saved ;
X
XTRACE( (
"ibm8514DrawColorImage(x=%d,y=%d,w=%d,h=%d,data=x%x,RowIncrement=%d,merg
e=x%x,planes=x%x)\n",
X	x, y, w, h, data, RowIncrement, merge, planes ) ) ;
X
Xif ( ( w <= 0 ) || ( h <= 0 ) )
X	return ;
X
Xsaved = !ibm8514cursorSemaphore && ibm8514CheckCursor( x, y, w, h ) ;
X
Xibm8514ATRNotBusy ;
Xibm8514ClearQueue( 7 ) ;
XPLNWENBL( planes ) ;
XSETFN1( FNVAR, mergexlate[ merge ] ) ; /* don't overlook that FNVAR */
XSETX0( x ) ;
XSETY0( y ) ;
XSETLX( w - 1 ) ;
XSETLY( h - 1 ) ;
X
XCOMMAND( ibm8514WriteZData ) ;
X
X/* NOTE: we write half as many shorts as bytes */
Xif ( w == RowIncrement )
X	blockoutw( data, ( ( w * h ) + 1 ) >> 1 ) ;
Xelse if ( w & 1 ) { /* MOD 2 == 1 */
X	int extrah ;
X	unsigned char tchar ;
X	int almostw ;
X
X	extrah = h & 1 ;
X	h >>= 1 ; /* write half line pairs */
X	if ( almostw = --w >> 1 ) {
X		while ( h-- ) { /* write half line pairs */
X		/* WARNING: arg to blockoutw may not be 16-bit aligned here ! */
X			blockoutw( data, almostw ) ;
X			tchar = data[ w ] ;
X			data += RowIncrement ;
X#if IMAGE_BYTE_ORDER == MSBFirst
X			outw( VARDATA, ( tchar << 8 ) | *data ) ;
X#else
X			outw( VARDATA, tchar | ( ( *data ) << 8 ) ) ;
X#endif
X		/* WARNING: arg to blockoutw may not be 16-bit aligned here ! */
X			blockoutw( data + 1, almostw ) ;
X			data += RowIncrement ;
X		}
X		/* WARNING: arg to blockoutw may not be 16-bit aligned here ! */
X		if ( extrah )
X			blockoutw( data, almostw + 1 ) ;
X	}
X	else {
X		while ( h-- ) { /* write half line pairs */
X			tchar = data[ w ] ;
X			data += RowIncrement ;
X#if IMAGE_BYTE_ORDER == MSBFirst
X			outw( VARDATA, ( tchar << 8 ) | *data ) ;
X#else
X			outw( VARDATA, tchar | ( ( *data ) << 8 ) ) ;
X#endif
X			data += RowIncrement ;
X		}
X		/* WARNING: arg to blockoutw may not be 16-bit aligned here ! */
X		if ( extrah )
X#if IMAGE_BYTE_ORDER == MSBFirst
X			outw( VARDATA, ( *data << 8 ) ) ;
X#else
X			outw( VARDATA, *data ) ;
X#endif
X	}
X}
Xelse
X	for ( w >>= 1 ; h-- ; data += RowIncrement )
X		blockoutw( data, w ) ;
X
Xibm8514ClearQueue( 3 ) ;  /* following a blockout */
XSETFN1( FNCOLOR1, FNREPLACE ) ;
XPLNWENBL( ibm8514ALLPLANES ) ;
X
Xif ( saved )
X	ibm8514ReplaceCursor() ;
X
Xreturn ;
X}
X
Xvoid
Xibm8514ReadColorImage( x, y, lx, ly, data, RowIncrement )
Xint x ;
Xint y ;
Xint lx ;
Xint ly ;
Xregister unsigned char *data ;
Xint RowIncrement ;
X{
Xint saved ;
X
XTRACE( (
"ibm8514ReadColorImage(x=%d,y=%d,lx=%d,ly=%d,data=x%x,RowIncrement=%d)\n",
X	x, y, lx, ly, data, RowIncrement ) ) ;
X
Xif ( ( lx <= 0 ) || ( ly <= 0 ) )
X	return ;
X
Xsaved = !ibm8514cursorSemaphore && ibm8514CheckCursor( x, y, lx, ly ) ;
X
Xibm8514ATRNotBusy ;
Xibm8514CheckQueue( 4 ) ;
XPLNWENBL( ibm8514ALLPLANES ) ;
XPLNRENBL( ibm8514ALLPLANES ) ;
XSETMODE( M_DEPTH ) ;
XSETFN1( FNVAR, FNREPLACE ) ;
Xibm8514CheckQueue( 5 ) ;
XSETX0( x ) ;
XSETY0( y ) ;
XSETLX( lx - 1 ) ;
XSETLY( ly - 1 ) ;
XCOMMAND( ibm8514ReadZData ) ;
X
Xif ( lx == RowIncrement )
X	blockinw( data, ( lx * ly ) / 2 ) ;
X/* NOTE: we read half as many shorts as bytes */
Xelse if ( lx & 1 ) { /* MOD 2 == 1 */
X	unsigned short int shrt ;
X	int extrah ;
X	int almostw ;
X
X	almostw = --lx >> 1 ;
X	extrah = ly & 1 ;
X	ly >>= 1 ;
X	while ( ly-- ) { /* write half line pairs */
X		blockinw( data, almostw ) ;
X		shrt = inw( VARDATA ) ;
X#if IMAGE_BYTE_ORDER == MSBFirst
X		data[ lx ] = shrt >> 8 ; /* Top 8 bits */
X		data += RowIncrement ;
X		*data = shrt & 0xFF ; /* Bottom 8 bits */
X#else
X		data[ lx ] = shrt & 0xFF ; /* Bottom 8 bits */
X		data += RowIncrement ;
X		*data = shrt >> 8 ; /* Top 8 bits */
X#endif
X		/* WARNING: arg to blockinw may not be 16-bit aligned here ! */
X		blockinw( data + 1, almostw ) ;
X		data += RowIncrement ;
X	}
X	if ( extrah ) {
X		blockinw( data, almostw ) ;
X		shrt = inw( VARDATA ) ;
X#if IMAGE_BYTE_ORDER == MSBFirst
X		data[ lx ] = shrt >> 8 ; /* Top 8 bits */
X#else
X		data[ lx ] = shrt & 0xFF ; /* Bottom 8 bits */
X#endif
X	}
X}
Xelse
X	for ( lx >>= 1 ; ly-- ; data += RowIncrement )
X		blockinw( data, lx ) ;
X
Xibm8514ClearQueue( 2 ) ;
XSETFN1( FNCOLOR1, FNREPLACE ) ;
XSETMODE( M_ONES ) ;
X
Xif ( saved )
X	ibm8514ReplaceCursor() ;
X
Xreturn ;
X}
END-of-ibm8514/brcImg.c
echo x - ibm8514/brcLine.c
sed 's/^X//' >ibm8514/brcLine.c << 'END-of-ibm8514/brcLine.c'
X/*
X * Copyright IBM Corporation 1987,1990
X *
X * All Rights Reserved
X *
X * Permission to use, copy, modify, and distribute this software and its
X * documentation for any purpose and without fee is hereby granted,
X * provided that the above copyright notice appear in all copies and that 
X * both that copyright notice and this permission notice appear in
X * supporting documentation, and that the name of IBM not be
X * used in advertising or publicity pertaining to distribution of the
X * software without specific, written prior permission.
X *
X * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
X * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
X * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
X * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
X * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
X * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
X * SOFTWARE.
X *
X*/
X/*
X * PRPQ 5799-PFF (C) COPYRIGHT IBM CORPORATION 1987,1990
X * LICENSED MATERIALS - PROPERTY OF IBM
X * REFER TO COPYRIGHT INSTRUCTIONS FORM NUMBER G120-2083
X */
X/*
X *  Hardware interface routines for IBM 8514/A adapter for
X *  X.11 server(s) on IBM equipment.
X *
X */
X
X/* $Header:
/andrew/X11/r3src/r3plus/server/ddx/ibm/ibm8514/RCS/brcLine.c,v 6.4
89/05/07 15:13:06 paul Exp $ */
X/* $Source:
/andrew/X11/r3src/r3plus/server/ddx/ibm/ibm8514/RCS/brcLine.c,v $ */
X
X#ifndef lint
Xstatic char *rcsid = "$Header:
/andrew/X11/r3src/r3plus/server/ddx/ibm/ibm8514/RCS/brcLine.c,v 6.4
89/05/07 15:13:06 paul Exp $" ;
X#endif
X
X#include "X.h"
X#include "misc.h"
X#include "colormapst.h"
X#include "pixmapstr.h"
X
X#include "ppc.h"
X
X#include "x8514.h"
X
X#include "ibmTrace.h"
X
X#define X_AXIS 0
X
Xextern int mergexlate[] ;
Xextern int ibm8514cursorSemaphore ;
X
Xvoid
Xibm8514HorzLine( color, alu, mask,x,y,w)
Xunsigned long int color ;
Xint alu ;
Xunsigned long int mask ;
Xint x,y,w ;
X{
Xint saved ;
X
Xif (w<=0)
X	return ;
Xsaved = !ibm8514cursorSemaphore && ibm8514CheckCursor( x, y, w, 1) ;
X
Xibm8514ClearQueue(7) ;
XPLNWENBL(mask) ;
XSETCOL1(color) ;
XSETFN1(FNCOLOR1,mergexlate[alu]) ;
XSETLX(w) ;
XSETX0(x) ;
XSETY0(y) ;
XCOMMAND(0x201f) ;
X
X
Xibm8514CheckQueue(2) ;
XSETFN1(FNCOLOR1,FNREPLACE) ;
XPLNWENBL( ibm8514ALLPLANES ) ;
X
Xif (saved)
X    ibm8514ReplaceCursor() ;
Xreturn ;
X}
X
Xvoid
Xibm8514VertLine( color, alu, mask,x,y,h)
Xunsigned long int color ;
Xint alu ;
Xunsigned long int mask ;
Xint x,y,h ;
X{
Xint saved ;
X
Xif ( h <= 0 )
X	return ;
Xsaved = !ibm8514cursorSemaphore && ibm8514CheckCursor(x, y, 1, h) ;
X
Xibm8514ClearQueue(7) ;
XPLNWENBL(mask) ;
XSETCOL1(color) ;
XSETFN1(FNCOLOR1,mergexlate[alu]) ;
XSETLX(h) ;
XSETX0(x) ;
XSETY0(y) ;
XCOMMAND(0x20df) ;
X
Xibm8514ClearQueue(2) ;
XSETFN1(FNCOLOR1,FNREPLACE) ;
XPLNWENBL( ibm8514ALLPLANES ) ;
X
Xif (saved)
X    ibm8514ReplaceCursor() ;
Xreturn ;
X}
X
Xvoid
Xibm8514BresLine( color, alu, mask, signdx, signdy, axis, x, y, et, e1,
e2, len)
Xunsigned long int color ;
Xint alu ;
Xunsigned long int mask ;
Xint signdx, signdy, axis, x, y, et, e1, e2, len ;
X{
Xunsigned short command ;
Xint saved ;
Xint cx, cy ;
X
Xif ( len <= 0 )
X	return ;
Xif (signdx == -1)
X    cx = x - len ;
Xelse
X    cx = x ;
Xif (signdy == -1)
X    cy = y - len ;
Xelse
X    cy = y ;
Xsaved = !ibm8514cursorSemaphore && ibm8514CheckCursor( cx,cy,len,len ) ;
X
Xif (axis==X_AXIS)
X	command = 0x2017 ; /* draw bres. line on X, W, LPN, */
Xelse
X	command = 0x2057 ; /* same, on Y */
Xif (signdx > 0)
X	command |= 0x0020 ;
Xif (signdy > 0)
X	command |= 0x0080 ;
X
Xibm8514ATRNotBusy ;
Xibm8514CheckQueue( 5 ) ;
XPLNWENBL(mask) ;
XSETET(et) ; 
XSETK1(e1) ; 
XSETK2(e2) ; 
XSETFN1(FNCOLOR1,mergexlate[alu]) ;
X
Xibm8514CheckQueue( 5 ) ;
XSETCOL1(color) ;
XSETLX(len) ; /* going to use LAST PEL NULL in Line command to brecon */
XSETX0(x) ;
XSETY0(y) ;
XCOMMAND(command) ;
X
Xibm8514ClearQueue(2) ;
XSETFN1( FNCOLOR1, FNREPLACE ) ;
XPLNWENBL( ibm8514ALLPLANES ) ;
X
Xif (saved)
X    ibm8514ReplaceCursor() ;
Xreturn ;
X}
END-of-ibm8514/brcLine.c
echo x - ibm8514/brcMono.c
sed 's/^X//' >ibm8514/brcMono.c << 'END-of-ibm8514/brcMono.c'
X/*
X * Copyright IBM Corporation 1987,1990
X *
X * All Rights Reserved
X *
X * Permission to use, copy, modify, and distribute this software and its
X * documentation for any purpose and without fee is hereby granted,
X * provided that the above copyright notice appear in all copies and that 
X * both that copyright notice and this permission notice appear in
X * supporting documentation, and that the name of IBM not be
X * used in advertising or publicity pertaining to distribution of the
X * software without specific, written prior permission.
X *
X * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
X * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
X * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
X * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
X * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
X * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
X * SOFTWARE.
X *
X*/
X/*
X * PRPQ 5799-PFF (C) COPYRIGHT IBM CORPORATION 1987,1990
X * LICENSED MATERIALS - PROPERTY OF IBM
X * REFER TO COPYRIGHT INSTRUCTIONS FORM NUMBER G120-2083
X */
X/*
X *  Hardware interface routines for IBM 8514/A adapter for
X *  X.11 server( s ) on IBM equipment.
X *
X */
X/* $Header:
/andrew/X11/r3src/release/server/ddx/ibm/ibm8514/RCS/brcMono.c,v 30.0
89/01/23 19:23:54 paul Exp $ */
X/* $Source:
/andrew/X11/r3src/release/server/ddx/ibm/ibm8514/RCS/brcMono.c,v $ */
X
X#ifndef lint
Xstatic char *rcsid = "$Header:
/andrew/X11/r3src/release/server/ddx/ibm/ibm8514/RCS/brcMono.c,v 30.0
89/01/23 19:23:54 paul Exp $" ;
X#endif
X
X/* MONO-
X   This file is here to do the sundry Monochrome ops on the 8514.  You
X   may wish to read or write a plane or take a depth - 1 image and use
X   it to fill Foreground and Background.
X
X   Monochrome ops to the 8514 are a bear ( in terms of cycles ) when the
X   target is not a 4-ple, so these routines plan on you drawing to a 4-ple
X   target ( off-screen if necessary ) and blitting to the final destination
X   if necessary.
X*/
X
X#include "X.h"
X#include "Xmd.h"
X#include "os.h"
X
X#include "OScompiler.h"
X
X#include "x8514.h"
X
X#include "ibmTrace.h"
X
Xextern int mergexlate[] ;
Xextern int ibm8514cursorSemaphore ;
X
X/* I/O port type is 4 bytes for 6152 but only 2 for i386 !! */
X#if defined(ATRIO)
X/*
X * Transmogrify: To change or alter greatly and often with
X *	grotesque or humorous effect.
X * ( Websters Ninth New Collegiate Dictionary )
X */
X#define transmogrify( byte ) \
X( ( ( byte | ( ( ( unsigned short int ) byte ) << 4 ) ) & ~ 0xF0 ) << 1 )
X
Xstatic void
Xblockouttransmogrifiedw( values, n )
Xregister unsigned char *values ;
Xregister int n ;
X{
Xregister unsigned char tmp ;
Xregister volatile unsigned long int * const ptr =
X	(volatile unsigned long int *) ( VARDATA | WORDADD ) ;
X
Xwhile ( n-- ) {
X	tmp = *values++ ;
X	*ptr = (unsigned long int) transmogrify( tmp ) ;
X}
Xreturn ;
X}
X#else /* Not "ATRIO" */
X#if defined(PCIO )
X#if !defined(USE_PORTABLE_BLOCKOUTTRANSMOGRIFIEDW)
Xextern void blockouttransmogrifiedw() ;
X#else /* Not "PCIO" either */
X#define transmogrify( byte ) \
X( ( ( byte >> 3 ) | ( ( (unsigned short int) byte ) << 9 ) ) & 0x1E1E )
X
Xstatic void
Xblockouttransmogrifiedw( values, n )
Xregister unsigned char *values ;
Xregister int n ;
X{
Xregister unsigned char tmp ;
X
Xwhile ( n-- ) {
X	tmp = *values++ ;
X	/* XXX make this smarter if we can */
X	ibm8514CheckQueue( 1 ) ;
X	outw( VARDATA, transmogrify( tmp ) ) ;
X}
Xreturn ;
X}
X#endif /* USE_PORTABLE_BLOCKOUTTRANSMOGRIFIEDW */
X#else /* Not "PCIO" */
X	******** ERROR ********
X#endif /* Not "PCIO" */
X#endif /* Not "ATRIO" */
X
X/* Used by cursor & FillSpans */
Xvoid
Xibm8514AlignMonoImage( planes, merge, x, y, lx, ly, data )
Xunsigned long int planes ;
Xint merge ;
Xregister int x, y, lx, ly ;
Xregister unsigned char *data ;
X{
X/*WARNING WARNING WARNING this routine merges 1's to requested planes and 0's
X* ro requested planes, BUT ALIGNS X TO BE A MULTIPLE OF FOUR!!!
X*
X* Use ibm8514StageMono and Blit to get monochrome images elsewhere
X*/
X    register int width ;
X    int CursorIsSaved ;
X
XTRACE(("ibm8514AlignMonoImage(planes=x%x,merge=x%x,x=x%x,y=x%x,lx=x%x,l
y=x%x,data=x%x)\n",
X	planes, merge, x, y, lx, ly, data ) ) ;
X
X    if ( ( lx <= 0 ) || ( ly <= 0 ) )
X	return ;
X
X    CursorIsSaved = !ibm8514cursorSemaphore
X		 && ibm8514CheckCursor( x, y, lx, ly ) ;
X
X    ibm8514ATRNotBusy ;
X    ibm8514CheckQueue( 4 ) ;
X    PLNWENBL( planes ) ;
X    SETMODE( M_VAR ) ;
X    SETFN0( FNCOLOR0, mergexlate[merge] ) ;
X    SETFN1( FNCOLOR1, mergexlate[merge] ) ;
X    x &= ~ 03 ; /* alignment happens here */
X    ibm8514CheckQueue( 4 ) ;
X    SETX0( x ) ;
X    SETY0( y ) ;
X    /* measured in BITS - clip will discard excess */
X    width = ( lx + 0x1F ) >> 5 ;
X    SETLX( ( width << 5 ) - 1 ) ;
X    SETLY( ly - 1 ) ;
X
X    ibm8514CheckQueue( 4 ) ;
X    SETCOL1( 255 ) ;
X    SETCOL0( 0 ) ;
X    SETXMAX( x + lx - 1 ) ;
X    COMMAND( ibm8514WriteXYData ) ;
X    blockouttransmogrifiedw( data, width * ly * 4 ) ;
X
X    ibm8514ClearQueue( 5 ) ;
X    SETMODE( M_ONES ) ;
X    SETFN1( FNCOLOR1, FNREPLACE ) ;
X    SETFN0( FNCOLOR0, FNREPLACE ) ;
X    PLNWENBL( ibm8514ALLPLANES ) ;
X    SETXMAX( _8514_SCREEN_WIDTH - 1 ) ;
X
X    if ( CursorIsSaved )
X	ibm8514ReplaceCursor() ;
X    return ;
X}
X
X/* Used By Stipple */
Xvoid
Xibm8514StageMono( lx, ly, data )
Xregister int lx, ly ;
Xregister unsigned char *data ;
X{
XTRACE(("ibm8514StageMono(lx=x%x,ly=x%x,data=x%x)\n",lx,ly,data));
X
Xif ( ( lx <= 0 ) || ( ly <= 0 ) )
X	return ;
Xibm8514AlignMonoImage( MONO_STAGE_WPLANE, GXcopy, MONO_STAGE_X, MONO_STAGE_Y, 
X		       lx, ly, data ) ;
Xreturn ;
X}
X
X/* Not Used ??? */
Xvoid
Xibm8514FillMonoImage( planes, fg, bg, merge, x, y, lx, ly, data )
Xunsigned long int planes, fg, bg ;
Xint merge, x ;
Xregister int y ;
Xint lx ;
Xregister int ly ;
Xregister unsigned char *data ;
X{
Xregister int count ;
Xint blocksize, CursorIsSaved ;
X
XTRACE(("ibm8514FillMonoImage(planes=x%x,fg=x%x,bg=x%x,merge=x%x,x=x%x,y
=x%x,lx=x%x,ly=x%x,data=x%x)\n",
X	planes, fg, bg, merge, x, y, lx, ly, data ) ) ;
X
Xif ( ( lx <= 0 ) || ( ly <= 0 ) )
X	return ;
X
XCursorIsSaved = !ibm8514cursorSemaphore && ibm8514CheckCursor( x, y,
lx, ly ) ;
Xibm8514cursorSemaphore++ ;
X
Xblocksize = ( lx + 3 ) * MONO_STAGE_SIZE ;
Xcount = ( ( ly + MONO_STAGE_SIZE - 1 ) / MONO_STAGE_SIZE ) - 1 ;
Xwhile ( count-- ) {
X	ibm8514StageMono( lx, MONO_STAGE_SIZE, data ) ;
X	ibm8514BlitFGBG( MONO_STAGE_RPLANE, planes, fg, bg, merge, 
X			 MONO_STAGE_X, MONO_STAGE_Y, 
X			 x, y, lx, MONO_STAGE_SIZE ) ;
X	data += blocksize ;
X	y += MONO_STAGE_SIZE ;
X	ly -= MONO_STAGE_SIZE ;
X}
Xif ( ly ) {
X	ibm8514StageMono( lx, ly, data ) ;
X	ibm8514BlitFGBG( MONO_STAGE_RPLANE, planes, fg, bg, merge, 
X			 MONO_STAGE_X, MONO_STAGE_Y, 
X			 x, y, lx, ly ) ;
X}
Xif ( !--ibm8514cursorSemaphore && CursorIsSaved )
X	ibm8514ReplaceCursor() ;
Xreturn ;
X}
X
X/* Not Used ?? */
Xvoid
Xibm8514DrawMonoByteImage( data, x, y, lx, ly, fg, merge, planes )
Xregister unsigned char *data ;
Xunsigned long int fg ;
Xint x, y, lx, ly ;
Xint merge ;
Xunsigned long int planes ;
X{
X/*WARNING WARNING WARNING this routine merges 1's to requested planes and 0's
X* ro requested planes, BUT ALIGNS X TO BE A MULTIPLE OF FOUR!!!
X*
X* Use ibm8514StageMono and Blit to get monochrome images elsewhere
X*/
X    register int width ;
X    int CursorIsSaved ;
X
XTRACE(("ibm8514DrawMonoImage(planes=x%x,merge=x%x,x=x%x,y=x%x,lx=x%x,ly
=x%x,data=x%x)\n",
X	planes, merge, x, y, lx, ly, data ) ) ;
X
X    if ( ( lx <= 0 ) || ( ly <= 0 ) )
X	return ;
X    CursorIsSaved = !ibm8514cursorSemaphore
X		 && ibm8514CheckCursor( x, y, lx, ly ) ;
X    ibm8514ATRNotBusy ;
X    ibm8514CheckQueue( 5 ) ;
X    PLNWENBL( planes ) ;
X    SETMODE( M_VAR ) ;
X    SETCOL1( fg ) ;
X    SETFN0( FNCOLOR0, FNNOP ) ;
X    SETFN1( FNCOLOR1, mergexlate[merge] ) ;
X    x &= ~ 03 ; /* alignment happens here */
X
X    ibm8514CheckQueue( 6 ) ;
X    SETX0( x ) ;
X    SETY0( y ) ;
X    width = ( lx + 7 ) >> 3 ;
X    SETLX( ( width << 3 ) - 1 ) ;
X    /* measured in BITS - clip will discard excess */
X    SETLY( ly - 1 ) ;
X    SETXMAX( x + lx - 1 ) ;
X    COMMAND( ibm8514WriteXYData ) ;
X
X    blockouttransmogrifiedw( data, width * ly * 4 ) ;
X
X    ibm8514ClearQueue( 5 ) ;
X    SETMODE( M_ONES ) ;
X    SETFN1( FNCOLOR1, FNREPLACE ) ;
X    SETFN0( FNCOLOR0, FNREPLACE ) ;
X    PLNWENBL( ibm8514ALLPLANES ) ;
X    SETXMAX( _8514_SCREEN_WIDTH - 1 ) ;
X
X    if ( CursorIsSaved )
X	ibm8514ReplaceCursor() ;
X    return ;
X}
X
X/* Used For Stipples */
Xvoid
Xibm8514DrawMonoImage( data, x, y, lx, ly, fg, merge, planes )
Xregister unsigned char *data ;
Xint x, y, lx, ly ;
Xunsigned long int fg ;
Xint merge ;
Xunsigned long int planes ;
X{
X/*WARNING WARNING WARNING this routine
X* ALIGNS X TO BE A MULTIPLE OF FOUR!!!
X*
X* Use ibm8514StageMono and Blit to get monochrome images elsewhere
X*/
X    register int width ;
X    int CursorIsSaved ;
X
XTRACE( ( "ibm8514DrawMonoImage( planes=x%x, merge=x%x, x=x%x, y=x%x,
lx=x%x, ly=x%x, data=x%x )\n", 
X	planes, merge, x, y, lx, ly, data ) ) ;
X
X    if ( ( lx <= 0 ) || ( ly <= 0 ) )
X	return ;
X
X    CursorIsSaved = !ibm8514cursorSemaphore && ibm8514CheckCursor( x,
y, lx, ly ) ;
X
X    ibm8514ATRNotBusy ;
X    ibm8514CheckQueue( 8 ) ;
X    PLNWENBL( planes ) ;
X    SETMODE( M_VAR ) ;
X    SETCOL1( fg ) ;
X    SETFN0( FNCOLOR0, FNNOP ) ;
X    SETFN1( FNCOLOR1, mergexlate[merge] ) ;
X    x &= ~ 03 ; /* alignment happens here */
X
X    SETX0( x ) ;
X    SETY0( y ) ;
X
X    width = ( lx + 31 ) >> 5 ;
X    SETLX( ( 32*width ) - 1 ) ;  /* measured in BITS - clip will
discard excess */
X
X    ibm8514CheckQueue( 3 ) ;
X    SETLY( ly - 1 ) ;
X    SETXMAX( x + lx - 1 ) ;
X    COMMAND( ibm8514WriteXYData ) ;
X    blockouttransmogrifiedw( data, width*ly*4 ) ;
X
X    ibm8514ClearQueue( 5 ) ;
X    SETMODE( M_ONES ) ;
X    SETFN1( FNCOLOR1, FNREPLACE ) ;
X    SETFN0( FNCOLOR0, FNREPLACE ) ;
X    PLNWENBL( ibm8514ALLPLANES ) ;
X    SETXMAX( _8514_SCREEN_WIDTH - 1 ) ;
X
X    if ( CursorIsSaved )
X	ibm8514ReplaceCursor() ;
X
X    return ;
X}
X
X/* Used By "Glyph-Blit" */
Xvoid
Xibm8514ByteAlignMonoImage( planes, merge, x, y, lx, ly, data )
Xunsigned long int planes ;
Xint merge, x, y, lx, ly ;
Xregister unsigned char *data ;
X{
X/*WARNING WARNING WARNING this routine merges 1's to requested planes and 0's
X* ro requested planes, BUT ALIGNS X TO BE A MULTIPLE OF FOUR!!!
X*
X* Use ibm8514StageMono and Blit to get monochrome images elsewhere
X*/
X    register int width ;
X    int CursorIsSaved ;
X
XTRACE( ( "ibm8514ByteAlignMonoImage( planes=x%x, merge=x%x, x=x%x,
y=x%x, lx=x%x, ly=x%x, data=x%x )\n", 
X	planes, merge, x, y, lx, ly, data ) ) ;
X
X    if ( ( lx <= 0 ) || ( ly <= 0 ) )
X	return ;
X
X    CursorIsSaved = !ibm8514cursorSemaphore && ibm8514CheckCursor( x,
y, lx, ly ) ;
X
X    ibm8514ATRNotBusy ;
X    ibm8514CheckQueue( 8 ) ;
X    PLNWENBL( planes ) ;
X    SETMODE( M_VAR ) ;
X    SETFN0( FNCOLOR0, mergexlate[merge] ) ;
X    SETFN1( FNCOLOR1, mergexlate[merge] ) ;
X    x &= ~ 03 ; /* alignment happens here */
X
X    SETX0( x ) ;
X    SETY0( y ) ;
X    width =  ( lx + 7 ) >> 3 ;
X    SETLX( ( 8*width ) - 1 ) ; /* measured in BITS */
X    SETLY( ly - 1 ) ;
X
X    ibm8514CheckQueue( 4 ) ;
X    SETCOL1( 255 ) ;
X    SETCOL0( 0 ) ;
X    SETXMAX( x + lx - 1 ) ;
X    COMMAND( ibm8514WriteXYData ) ;
X    blockouttransmogrifiedw( data, width * ly ) ;
X
X    ibm8514ClearQueue( 5 ) ;
X    SETMODE( M_ONES ) ;
X    SETFN1( FNCOLOR1, FNREPLACE ) ;
X    SETFN0( FNCOLOR0, FNREPLACE ) ;
X    PLNWENBL( ibm8514ALLPLANES ) ;
X    SETXMAX( _8514_SCREEN_WIDTH - 1 ) ;
X
X    if ( CursorIsSaved )
X	ibm8514ReplaceCursor() ;
X
X    return ;
X}
END-of-ibm8514/brcMono.c
echo x - ibm8514/brcOSD.c
sed 's/^X//' >ibm8514/brcOSD.c << 'END-of-ibm8514/brcOSD.c'
X/*
X * Copyright IBM Corporation 1987,1990
X *
X * All Rights Reserved
X *
X * Permission to use, copy, modify, and distribute this software and its
X * documentation for any purpose and without fee is hereby granted,
X * provided that the above copyright notice appear in all copies and that 
X * both that copyright notice and this permission notice appear in
X * supporting documentation, and that the name of IBM not be
X * used in advertising or publicity pertaining to distribution of the
X * software without specific, written prior permission.
X *
X * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
X * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
X * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
X * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
X * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
X * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
X * SOFTWARE.
X *
X*/
X/*
X * PRPQ 5799-PFF (C) COPYRIGHT IBM CORPORATION 1987,1990
X * LICENSED MATERIALS - PROPERTY OF IBM
X * REFER TO COPYRIGHT INSTRUCTIONS FORM NUMBER G120-2083
X */
X/*
X *  Hardware interface routines for IBM 8514/A adapter for
X *  X.11 server(s) on IBM equipment.
X *
X */
X
X#include <fcntl.h>
X#include <sys/ioctl.h>
X
X#if defined(ibm032) && defined(BSDrt)
X#define ATR
X#include <machinecons/buf_emul.h>
X#else
X#ifdef i386
X#if defined(IBM_OS_HAS_HFT) || !defined(IBM_OS_HAS_X_QUEUE)
X#include "ibmXhftMap.h"
X#endif
X	/* Nothing Yet */
X#else
X	******** ERROR ********
X#endif
X#endif
X
X#include "X.h"
X#include "miscstruct.h"
X#include "scrnintstr.h"
X#include "cursorstr.h"
X
X#include "ibmScreen.h"
X#include "ibmTrace.h"
X
X#include "x8514.h"
X
Xextern void ibmInfoMsg() ;
X
Xextern PixmapFormatRec ibm8514Formats[] ;
X/* GLOBAL FILE DESCRIPTOR -- for ioctl's etc. */
Xint ibm8514FD = -1 ;
X
X/*ARGSUSED*/
Xvoid
Xibm8514osdInit( index )
Xregister int index ;
X{
X    TRACE( ( "ibm8514osdInit()\n" ) ) ;
X#ifdef ibm032
X	/* Nothing Yet */
X#else
X#ifdef i386
X	/* Nothing Yet */
X#else
X	******** ERROR ********
X#endif
X#endif
Xreturn ;
X}
X
X/**********************************************************************
********/
X
Xvoid
Xibm8514SetVideoRegisters()
X{
X#if !defined(BSDrt)
X  /* THE FOLLOWING 8 OUTPUT VALUES ARE MAGIC NUMBERS */
X  /* Note that they are not queued */
X  /* This is the only place they occur, so screw the #define theory */
X    ibm8514outw( 0x12e8, 0x0660 ) ;	 /* frame total width */
X    ibm8514outw( 0x1ae8, 0x0600 ) ;	 /* frame sync posn */
X    ibm8514outw( 0x16e8, 0x05fb ) ;	 /* frame blank start */
X    outb( 0x1ee8, 0x08 ) ;		 /* frame sync width */
X    ibm8514outw( 0x02e8, 0x009d ) ;	 /* line total length */
X    ibm8514outw( 0x0ae8, 0x0081 ) ;	 /* line sync posn */
X    ibm8514outw( 0x06e8, 0x007f ) ;	 /* line blank start */
X    ibm8514outw( 0x0ee8, 0x0016 ) ;	 /* line sync width */
X  /* END MAGIC NUMBERS */
X#endif
X    return ;
X}
X
X/**********************************************************************
********/
X
Xint
Xibm8514Probe()
X{
Xregister int fd ;
X
X#if defined(IBM_OS_HAS_X_QUEUE) || defined(BSDrt)
X    if ( ( fd = open( IBM8514_DEV_FILE, O_RDWR | O_NDELAY ) ) >= 0 ) {
X#if defined(i386)
X	(void) ioctl( fd, 'B'<<8|1, 0 ) ; /* 8514 specific I/O permissions !! */
X#else
X	(void) ioctl( fd, BUFINIT8514, 0 ) ;
X#endif
X    }
X    else /* Open of device file failed */
X#endif /* IBM_OS_HAS_X_QUEUE */
X#if defined(IBM_OS_HAS_HFT)
X    {
X	if ( ( fd = hftProbe( IBM8514xHFTid ) ) < 0 )
X	    return fd ;
X    }
X#else /* No hft and initial devFile open failed */
X	return -1 ;
X#endif /* defined(IBM_OS_HAS_HFT) */
X
X    ibmInfoMsg( "Found a %d-plane 8514a with ",
X		ibm8514Formats[0].depth = ibm8514QueryPlanes() ) ;
X
X    switch ( ibm8514QueryHead() )
X	{
X		ibmInfoMsg( "a Color display\n" ) ;
X		break ;
X		ibmInfoMsg( "a Grayscale display\n" ) ;
X		break ;
X		ibmInfoMsg( "no known display\n" ) ;
X		ErrorF( "Not bothering with headless 8514\n" ) ;
X		(void) close( fd ) ;
X		return -1 ;
X	}
X	return ibm8514FD = fd ;
X	/*NOTREACHED*/
X}
X
X#if defined(ibm032) && defined(ATRIO)
X/* on the 386 blockoutw should be assembly coded to use "rep outs %dx,
*%esi" */
Xvoid
Xblockoutw( values, n )
Xregister unsigned char *values ;
Xregister int n ;
X{
X    /* I/O port type is 4 bytes for 6152 but only 2 for i386 !! */
X    register volatile unsigned long int *ptr ;
X
Xif ( !n )
X    return ;
X
Xptr = (volatile unsigned long int *) ( VARDATA | WORDADD ) ;
X
X/* Test Alignment */
Xif ( ( (unsigned long int) values ) & 1 ) {
X    register unsigned long int tmpBuf ;
X
X    tmpBuf = *values++ << 16 ; /* Now We're Aligned */
X    while ( --n ) {
X	tmpBuf |= *( (unsigned short int *) values ) ;
X    	*ptr = (unsigned long int) ( tmpBuf >> 8 ) ;
X	values += sizeof (unsigned short int) ;
X    	tmpBuf <<= 16 ;
X    }
X    *ptr = (unsigned long int) ( ( tmpBuf >> 8 ) | *values ) ;
X}
Xelse
X    for ( n++ ; --n ; values += sizeof (unsigned short int) )
X    	*ptr = (unsigned long int) *( (unsigned short int *) values ) ;
X
Xreturn ;
X}
X
Xvoid
Xblockinw( data, n )
Xregister unsigned char *data ;
Xregister int n ;
X{
X/* I/O port type is 4 bytes for 6152 but only 2 for i386 !! */
Xregister unsigned long int *ptr ;
X
Xif ( !n )
X	return ;
X
Xptr = (unsigned long int *) ( VARDATA | WORDADD ) ;
X
X/* Test Alignment */
Xif ( ( (unsigned long int) data ) & 1 ) {
X    register unsigned long int tmpBuf ;
X
X    tmpBuf = *ptr ;
X    *data++ = tmpBuf >> 8 ;
X    tmpBuf <<= 16 ;
X    while ( --n ) {
X	tmpBuf |= (unsigned short) *ptr ;
X	*( (unsigned short int *) data ) = tmpBuf >> 8 ;
X	tmpBuf <<= 16 ;
X	data += sizeof (unsigned short int) ;
X    }
X    *data = tmpBuf >> 16 ;
X
X}
Xelse
X    for ( n++ ; --n ; data += sizeof (unsigned short int) )
X	*( (unsigned short int *) data ) = (unsigned short) *ptr ;
X
Xreturn ;
X}
X
X#else
X#if defined(i386) && defined(PCIO)
X
X#if defined(USE_PORTABLE_BLOCKOUTW)
Xvoid
Xblockoutw( values, n )
Xregister unsigned short *values ;
Xregister int n ;
X{
X#if HALFQBUF != 4
X	******** ERROR ********
X#endif
X    for ( ; n >= HALFQBUF ; n -= HALFQBUF ) {
X       	ibm8514ClearQueue( HALFQBUF ) ;
X    	outw( VARDATA, *values++ ) ;	/* This assume that HALFQBUF is 4 */
X    	outw( VARDATA, *values++ ) ;
X    	outw( VARDATA, *values++ ) ;
X    	outw( VARDATA, *values++ ) ;
X    }
X    if ( n ) {		/* Left over < HALFQBUF */
X       	ibm8514ClearQueue( n ) ;
X    	while ( n-- )
X    		outw( VARDATA, *values++ ) ;
X    }
X    return ;
X}
X
X#endif /* #if defined(USE_PORTABLE_BLOCKOUTW) */
X
Xvoid
Xblockinw( data, n )
Xregister unsigned char *data ;
Xregister int n ;
X{
Xfor ( n++ ; --n ; data += sizeof (unsigned short int) )
X	*( (unsigned short int *) data ) = inw( VARDATA ) ;
X
Xreturn ;
X}
X#else
X	******** ERROR -- RT w/ Family-1 Bus ??
X#endif
X#endif
END-of-ibm8514/brcOSD.c
echo x - ibm8514/brcOutL.c
sed 's/^X//' >ibm8514/brcOutL.c << 'END-of-ibm8514/brcOutL.c'
X/*
X * Copyright IBM Corporation 1987,1990
X *
X * All Rights Reserved
X *
X * Permission to use, copy, modify, and distribute this software and its
X * documentation for any purpose and without fee is hereby granted,
X * provided that the above copyright notice appear in all copies and that 
X * both that copyright notice and this permission notice appear in
X * supporting documentation, and that the name of IBM not be
X * used in advertising or publicity pertaining to distribution of the
X * software without specific, written prior permission.
X *
X * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
X * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
X * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
X * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
X * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
X * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
X * SOFTWARE.
X *
X*/
X/*
X * PRPQ 5799-PFF (C) COPYRIGHT IBM CORPORATION 1987,1990
X * LICENSED MATERIALS - PROPERTY OF IBM
X * REFER TO COPYRIGHT INSTRUCTIONS FORM NUMBER G120-2083
X */
X/*
X *  Hardware interface routines for IBM 8514/A adapter for
X *  X.11 server(s) on IBM equipment.
X *
X */
X/* $Header:
/andrew/X11/r3src/r3plus/server/ddx/ibm/ibm8514/RCS/brcOutL.c,v 6.3
89/05/07 15:12:37 paul Exp $ */
X/* $Source:
/andrew/X11/r3src/r3plus/server/ddx/ibm/ibm8514/RCS/brcOutL.c,v $ */
X
X#ifndef lint
Xstatic char *rcsid = "$Header:
/andrew/X11/r3src/r3plus/server/ddx/ibm/ibm8514/RCS/brcOutL.c,v 6.3
89/05/07 15:12:37 paul Exp $" ;
X#endif
X
X/* SOLID AREA FILL OUTLINE
X *
X * This draws a strange line intended to be used as an outline for area fill
X * IT SHOULD NOT BE USED FOR ANYTHING ELSE
X * 
X */
X
X#include "X.h"
X
X#include "OScompiler.h"
X
X#include "x8514.h"
X
X#include "ibmTrace.h"
X
Xextern int mergexlate[] ;
Xextern int ibm8514cursorSemaphore ;
X
X#define VERT	1
X#define HORIZ	2
X#define SLOP1	3
X#define SLOPN1	4
X#define YUCK	5
X
Xvoid
Xibm8514Outline( planes, x0, y0, x1, y1 )
Xunsigned long int planes ;
Xint x0, y0, x1, y1 ;
X{
Xint saved ;
Xint qd,k1,k2,dx,dy,adx,ady ;
X
XTRACE(("ibm8514OutLine(x0=%d, y0=%d, x1=%d, y1=%d)\n", x0,y0,x1,y1)) ;
X
Xdx = x1 - x0 ;
Xadx = ABS( dx ) ;
Xdy = y1 - y0 ;
Xady = ABS( dy ) ;
X
Xsaved = !ibm8514cursorSemaphore
X     && ibm8514CheckCursor( MIN( x0, x1 ), MIN( y0, y1 ), adx, ady ) ;
X
Xibm8514ATRNotBusy ;
Xibm8514CheckQueue( 5 ) ;
XSETFN1( FNCOLOR1, mergexlate[GXxor] ) ;
XSETCOL1( 255 ) ;
XPLNWENBL( planes ) ;
XPLNRENBL( FILL_STAGE_RPLANE ) ;
XSETET( 0 ) ; /* bresenham error term.  See README file about this */
X
Xif ( !dx )
X	qd = VERT ;
Xelse if ( !dy )
X	qd = HORIZ ;
Xelse if ( dx == dy )
X	qd = SLOPN1 ;
Xelse if ( adx == ady )
X	qd = SLOP1 ;
Xelse
X	qd = YUCK ;
X
Xibm8514CheckQueue( 6 ) ; /* Max # of outw's in switch statement */
Xswitch ( qd ) {
X		SETLX( ady ) ; /* stepping along Y */
X		SETY0( ( dy > 0 ) ? y0 : y1 ) ;
X 		SETX0( x0 ) ;
X		COMMAND( 0xA0DF ) ;
X		break ;
X		break ;
X		SETLX( adx ) ;
X		if ( dx > 0 ) {
X			SETX0( x1 ) ;
X			SETY0( y1 ) ;
X		}
X		else {
X			SETX0( x0 ) ;
X			SETY0( y0 ) ;
X		}
X		COMMAND( 0xA0BF ) ;
X		break ;
X		SETLX( adx ) ;
X		if ( dx > 0 ) {
X			SETX0( x0 ) ;
X			SETY0( y0 ) ;
X		}
X		else {
X			SETX0( x1 ) ;
X			SETY0( y1 ) ;
X		}
X		COMMAND( 0xA0FF ) ;
X		break ;
X	case YUCK: /* slope is not 0,1,-1,or infinite */
X		if ( adx >= ady ) { /* STEPX */
X			k1 = 2 * ady ;
X			SETK1( k1 ) ;
X			k2 = k1 - 2 * adx ;
X			SETK2( k2 ) ;
X			SETLX( adx ) ;
X			if ( dy > 0 ) {
X				SETX0( x0 ) ;
X				SETY0( y0 ) ;
X				if ( dx > 0 )
X					COMMAND( 0xA0B7 ) ; /*QUAD1*/
X				else
X					COMMAND( 0xA097 ) ; /*QUAD 4*/
X			}
X			else {
X				SETX0( x1 ) ;
X				SETY0( y1 ) ;
X				if ( dx > 0 )
X					COMMAND( 0xA097 ) ; /*QUAD8*/
X				else
X					COMMAND( 0xA0B7 ) ; /*QUAD 5*/
X			}
X		}
X		else { /* STEPY */
X			k1 = 2 * adx ;
X			SETK1( k1 ) ;
X			k2 = k1 - 2 * ady ;
X			SETK2( k2 ) ;
X			SETLX( ady ) ;
X			if ( dy > 0 ) {
X				SETX0( x0 ) ;
X				SETY0( y0 ) ;
X				if ( dx > 0 )
X					COMMAND( 0xA0F7 ) ; /*QUAD2*/
X				else
X					COMMAND( 0xA0D7 ) ; /*QUAD 3*/
X			}
X			else {
X				SETX0( x1 ) ;
X				SETY0( y1 ) ;
X			  	if ( dx > 0 )
X					COMMAND( 0xA0D7 ) ; /*QUAD7*/
X				else
X					COMMAND( 0xA0F7) ; /*QUAD 6*/
X			}
X		}
X		break ;
X	} /* end switch */
X
Xibm8514ClearQueue( 3 ) ;
XSETFN1( FNCOLOR1, FNREPLACE ) ;
XPLNWENBL( ibm8514ALLPLANES ) ;
XPLNRENBL( ibm8514ALLPLANES ) ;
X
Xif ( saved )
X	ibm8514ReplaceCursor() ;
Xreturn ;
X}
END-of-ibm8514/brcOutL.c
echo x - ibm8514/brcPgon.c
sed 's/^X//' >ibm8514/brcPgon.c << 'END-of-ibm8514/brcPgon.c'
X/*
X * Copyright IBM Corporation 1987,1990
X *
X * All Rights Reserved
X *
X * Permission to use, copy, modify, and distribute this software and its
X * documentation for any purpose and without fee is hereby granted,
X * provided that the above copyright notice appear in all copies and that 
X * both that copyright notice and this permission notice appear in
X * supporting documentation, and that the name of IBM not be
X * used in advertising or publicity pertaining to distribution of the
X * software without specific, written prior permission.
X *
X * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
X * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
X * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
X * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
X * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
X * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
X * SOFTWARE.
X *
X*/
X/*
X * PRPQ 5799-PFF (C) COPYRIGHT IBM CORPORATION 1987,1990
X * LICENSED MATERIALS - PROPERTY OF IBM
X * REFER TO COPYRIGHT INSTRUCTIONS FORM NUMBER G120-2083
X */
X/*
X *  Hardware interface routines for IBM 8514/A adapter for
X *  X.11 server(s) on IBM equipment.
X *
X */
X/* $Header:
/andrew/X11/r3src/earlyRelease/server/ddx/ibm/ibm8514/RCS/brcPgon.c,v
6.3 88/11/16 18:46:44 paquin Exp $ */
X/* $Source:
/andrew/X11/r3src/earlyRelease/server/ddx/ibm/ibm8514/RCS/brcPgon.c,v $ */
X
X#ifndef lint
Xstatic char *rcsid = "$Header:
/andrew/X11/r3src/earlyRelease/server/ddx/ibm/ibm8514/RCS/brcPgon.c,v
6.3 88/11/16 18:46:44 paquin Exp $";
X#endif
X
X/* POLYGON FILL
X *
X */
X#include 	"X.h"
X#include 	"pixmapstr.h"
X#include        "gcstruct.h"
X#include        "windowstr.h"
X#include        "colormapst.h"
X
X#include	"ppc.h"
X#include        "ibmTrace.h"
X
X#include 	"x8514.h"
Xextern int mfbGCPrivateIndex;
X
Xvoid
Xibm8514FillPolygon( dst, pgc, shape, mode, count, pPts )
XDrawablePtr	dst;
Xregister GCPtr	pgc;
Xint		shape, mode;
Xregister int	count;
XDDXPointPtr	pPts;
X{
Xregister DDXPointPtr ppt;
Xint i ;
X
Xif ( !( i = count ) )
X	return ;
X
Xif
(((ppcPrivGCPtr)pgc->devPrivates[mfbGCPrivateIndex].ptr)->colorRrop.fill
Style != FillSolid)
X	{
X	miFillPolygon(dst, pgc, shape, mode, count, pPts);
X	return;
X	}
X
Xif (dst->type != DRAWABLE_WINDOW)
X	{
X	ErrorF("ibm8514FillPolygon: not a window\n");
X	miFillPolygon(dst, pgc, shape, mode, count, pPts);
X	return;
X    	}
X
Xppt = pPts ;
Xif ( pgc->miTranslate ) {
X    	if ( mode != CoordModeOrigin)
X	    	for ( ppt++ ; count-- ; ppt++ ) {
X	        	ppt->x += (ppt-1)->x;
X	        	ppt->y += (ppt-1)->y;
X    		}
X}
Xelse
X	if ( mode == CoordModePrevious )
X	    	for ( ppt++ ; count-- ; ppt++ ) {
X	        	ppt->x += (ppt-1)->x ;
X	        	ppt->y += (ppt-1)->y ;
X		}
X
Xibm8514SolidFillPoly( dst, pgc, i, pPts ) ;
X
Xreturn ;
X}
END-of-ibm8514/brcPgon.c
echo x - ibm8514/brcPoly.c
sed 's/^X//' >ibm8514/brcPoly.c << 'END-of-ibm8514/brcPoly.c'
X/*
X * Copyright IBM Corporation 1987,1990
X *
X * All Rights Reserved
X *
X * Permission to use, copy, modify, and distribute this software and its
X * documentation for any purpose and without fee is hereby granted,
X * provided that the above copyright notice appear in all copies and that 
X * both that copyright notice and this permission notice appear in
X * supporting documentation, and that the name of IBM not be
X * used in advertising or publicity pertaining to distribution of the
X * software without specific, written prior permission.
X *
X * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
X * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
X * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
X * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
X * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
X * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
X * SOFTWARE.
X *
X*/
X/*
X * PRPQ 5799-PFF (C) COPYRIGHT IBM CORPORATION 1987,1990
X * LICENSED MATERIALS - PROPERTY OF IBM
X * REFER TO COPYRIGHT INSTRUCTIONS FORM NUMBER G120-2083
X */
X/*
X *  Hardware interface routines for IBM 8514/A adapter for
X *  X.11 server(s) on IBM equipment.
X *
X */
X/* $Header:
/andrew/X11/r3src/r3plus/server/ddx/ibm/ibm8514/RCS/brcPoly.c,v 6.4
89/05/07 15:18:46 jeff Exp $ */
X/* $Source:
/andrew/X11/r3src/r3plus/server/ddx/ibm/ibm8514/RCS/brcPoly.c,v $ */
X
X#ifndef lint
Xstatic char *rcsid = "$Header:
/andrew/X11/r3src/r3plus/server/ddx/ibm/ibm8514/RCS/brcPoly.c,v 6.4
89/05/07 15:18:46 jeff Exp $";
X#endif
X
X/* FILL A POLYGON
X *
X */
X#include "X.h"
X#include "misc.h"
X#include "gcstruct.h"
X#include "windowstr.h"
X#include "colormapst.h"
X#include "regionstr.h"
X
X#include "OScompiler.h"
X
X#include "ppc.h"
X#include "ibmTrace.h"
X
X#include "x8514.h"
X
Xextern int ibm8514Disabled ;
X
Xextern int ibm8514cursorSemaphore ;
Xextern int mfbGCPrivateIndex ;
X
X#define CLEARSTAGE(W,H)	\
X	ibm8514DrawRectangle(0,GXclear, MONO_STAGE_WPLANE | FILL_STAGE_WPLANE,\
X	MONO_STAGE_X, MONO_STAGE_Y, W, H)
X
Xstatic void
Xibm8514StageFill(w,h)
Xint w,h ;
X{
Xibm8514ATRNotBusy ;
Xibm8514CheckQueue(5);
XPLNRENBL(FILL_STAGE_RPLANE);
XSETCOL1(255);
XPLNWENBL(MONO_STAGE_WPLANE);
XSETFN1(FNCOLOR1, FNREPLACE);
XSETX0(MONO_STAGE_X);
Xibm8514CheckQueue(5);
XSETY0(MONO_STAGE_Y);
XSETLX(w);
XSETLY(h);
XSETMODE(M_PLFILL);
XCOMMAND(0x42f7);
X
Xibm8514ClearQueue(3);
XPLNWENBL(RPLANES);
XPLNRENBL(RPLANES);
XSETMODE(M_ONES);
Xreturn;
X}
X
Xibm8514SolidFillPoly( pDraw, pGC, count, pts)
X    DrawablePtr pDraw;
X    GCPtr	pGC;
X    int		count;
X    DDXPointPtr	pts;
X{
X    RegionPtr		pCC;
X    int			saved, alu ;
X    unsigned long int	wPM ;
X    int			nbox, x0, y0;
X    int			i, j, miny, minx, maxx, maxy, bboxh, bboxw,
X			thisboxh, x1, y1, destx, desty, ydelta;
X    unsigned long int	fg ;
X    BoxRec		*pbox;
X
Xif ( ibm8514Disabled )
X	return ;
X
XTRACE(("ibm8514SolidFillPoly: pDraw=x%x, pGC=x%x, count=%d, pts=x%x\n",
X	pDraw, pGC, count, pts));
XpCC = ((ppcPrivGC *)pGC->devPrivates[mfbGCPrivateIndex].ptr)->pCompositeClip;
X
Xif ( !( nbox = REGION_NUM_RECTS(pCC) ) || ( ( alu = pGC->alu ) == GXnoop ) )
X	return;
X
XwPM = pGC->planemask;
Xfg  = pGC->fgPixel;
X  
Xminx = miny = _8514_SCREEN_WIDTH;
Xmaxx = maxy = 0;
Xfor (i=0; i<count; i++)
X	{
X	TRACE(("ibm8514SFPoly: pt[%d] = (%d,%d)\n",i,pts[i].x,pts[i].y));
X	minx = MIN(minx,pts[i].x);
X	miny = MIN(miny,pts[i].y);
X	maxx = MAX(maxx,pts[i].x);
X	maxy = MAX(maxy,pts[i].y);
X	}
X
Xdesty = miny + pDraw->y;
Xdestx = minx + pDraw->x;
Xbboxw = maxx-minx+1;
Xbboxh = maxy-miny+1;
Xydelta = 0;
X
Xsaved = !ibm8514cursorSemaphore
X     && ibm8514CheckCursor(destx, desty, bboxw, bboxh);
Xibm8514cursorSemaphore++ ;
X
Xwhile (bboxh>0)
X	{
X	/* set up the staging area to do the fill*/
X	ibm8514ClearQueue(4);
X	SETXMIN(MONO_STAGE_X);
X	SETYMIN(MONO_STAGE_Y);
X	SETXMAX(1023);
X	SETYMAX(1023);
X
X	thisboxh = MIN(MONO_STAGE_SIZE,bboxh);
X	CLEARSTAGE(bboxw, thisboxh);
X
X	/* Draw the edges */
X	for (j=0; j<count-1; j++)
X		{
X		x0 = pts[j].x + MONO_STAGE_X - minx;
X		y0 = pts[j].y + MONO_STAGE_Y - miny - ydelta;
X		x1 = pts[j+1].x + MONO_STAGE_X - minx;
X		y1 = pts[j+1].y + MONO_STAGE_Y - miny - ydelta;
X		ibm8514Outline(FILL_STAGE_WPLANE,x0,y0,x1,y1);
X		}
X	/* close the polygon */
X	x0 = pts[count-1].x + MONO_STAGE_X - minx;
X	y0 = pts[count-1].y + MONO_STAGE_Y - miny - ydelta;
X	x1 = pts[0].x + MONO_STAGE_X - minx;
X	y1 = pts[0].y + MONO_STAGE_Y - miny - ydelta;
X	ibm8514Outline(FILL_STAGE_WPLANE,x0,y0,x1,y1);
X
X	/* do the area fill */
X	ibm8514StageFill(bboxw, thisboxh);
X
X	/* Now get the stuff up to the real destination */
X	pbox = REGION_RECTS(pCC);
X	for (i=0; i<nbox; i++, pbox++)
X		{
X		ibm8514ClearQueue(4);
X		SETXMIN(pbox->x1);
X		SETYMIN(pbox->y1);
X		SETXMAX(pbox->x2-1);
X		SETYMAX(pbox->y2-1);
X	
X		ibm8514BlitFG(MONO_STAGE_RPLANE, wPM,
X				fg, alu, 
X				MONO_STAGE_X, MONO_STAGE_Y,
X				destx, desty,
X				bboxw,thisboxh);
X		}
X
X	desty += MONO_STAGE_SIZE;
X	ydelta += MONO_STAGE_SIZE;
X	bboxh -= MONO_STAGE_SIZE;
X	}
X
X
Xibm8514ClearQueue(6);
XSETYMIN(0);
XSETXMIN(0);
XSETYMAX( 1023 ) ;
XSETXMAX(_8514_SCREEN_WIDTH-1);
XPLNRENBL(RPLANES);
XPLNWENBL(WPLANES);
X
Xif ( !--ibm8514cursorSemaphore && saved )
X	ibm8514ReplaceCursor();
Xreturn;
X}
END-of-ibm8514/brcPoly.c
echo x - ibm8514/brcProcs.h
sed 's/^X//' >ibm8514/brcProcs.h << 'END-of-ibm8514/brcProcs.h'
X/*
X * Copyright IBM Corporation 1987,1990
X *
X * All Rights Reserved
X *
X * Permission to use, copy, modify, and distribute this software and its
X * documentation for any purpose and without fee is hereby granted,
X * provided that the above copyright notice appear in all copies and that 
X * both that copyright notice and this permission notice appear in
X * supporting documentation, and that the name of IBM not be
X * used in advertising or publicity pertaining to distribution of the
X * software without specific, written prior permission.
X *
X * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
X * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
X * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
X * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
X * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
X * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
X * SOFTWARE.
X *
X*/
X/*
X * PRPQ 5799-PFF (C) COPYRIGHT IBM CORPORATION 1987,1990
X * LICENSED MATERIALS - PROPERTY OF IBM
X * REFER TO COPYRIGHT INSTRUCTIONS FORM NUMBER G120-2083
X */
X/*
X *  Hardware interface routines for IBM 8514/A adapter for
X *  X.11 server(s) on IBM equipment.
X *
X */
X/* $Header:
/andrew/X11/r3src/earlyRelease/server/ddx/ibm/ibm8514/RCS/brcProcs.h,v
6.4 88/11/21 13:47:06 jeff Exp $ */
X/* $Source:
/andrew/X11/r3src/earlyRelease/server/ddx/ibm/ibm8514/RCS/brcProcs.h,v $ */
X
X#if !defined(lint) && !defined(LOCORE) && defined(RCS_HDRS)
Xstatic char *rcsidibm8514procs = "$Header:
/andrew/X11/r3src/earlyRelease/server/ddx/ibm/ibm8514/RCS/brcProcs.h,v
6.4 88/11/21 13:47:06 jeff Exp $";
X#endif
X
X#if !defined(NO_FUNCTION_PROTOTYPES)
X/* brcCurs.o */
X
Xextern int ibm8514CheckCursor(
X	const int x,
X	const int y,
X	const int lx,
X	const int ly ) ;
X
Xextern void ibm8514ReplaceCursor(
X	void ) ;
X
Xextern int ibm8514cursorSemaphore ;
X
X#if !defined(CURSOR_ONLY)
Xextern void ibm8514RemoveCursor(
X	void ) ;
X
Xextern void ibm8514CursorInit(
X	int index ) ;
X
Xextern Bool ibm8514RealizeCursor(
X	ScreenPtr pScr,
X	CursorPtr pCurs ) ;
X
Xextern Bool ibm8514UnrealizeCursor(
X	ScreenPtr pScr,
X	CursorPtr pCurs ) ;
X
Xextern void ibm8514ColorCursor(
X	unsigned long int fg,
X	unsigned long int bg ) ;
X
Xextern void ibm8514RecolorCursor(
X	ColormapPtr cmap ) ;
X
Xextern int ibm8514DisplayCursor(
X	ScreenPtr pScr,
X	CursorPtr pCurs ) ;
X
Xextern void ibm8514ShowCursor(
X	int x,
X	int y ) ;
X
X/* brcBlit.o */
X
Xextern void ibm8514Bitblt(
X	int merge,
X	int rpm,
X	int wpm,
X	int x0,
X	int y0,
X	int x1,
X	int y1,
X	int lx,
X	int ly ) ;
X
Xextern void ibm8514BlitFG(
X	int rpm,
X	int wpm,
X	int fg,
X	int merge,
X	int x0,
X	int y0,
X	int x1,
X	int y1,
X	int lx,
X	int ly ) ;
X
Xextern void ibm8514BlitFGBG(
X	int rpm,
X	int wpm,
X	int fg,
X	int bg,
X	int merge,
X	int x0,
X	int y0,
X	int x1,
X	int y1,
X	int lx,
X	int ly ) ;
X
X/* brcCmap.o */
X
Xextern void ibm8514SetColor(
X	unsigned long int number,
X	unsigned short int r,
X	unsigned short int g,
X	unsigned short int b,
X	VisualPtr pVisual ) ;
X
X/* brcFillSp.o */
X
Xextern void ibm8514SolidFS(
X	DrawablePtr pDrawable,
X	GCPtr pGC,
X	int nInit,
X	DDXPointPtr pptInit,
X	int *pwidthInit,
X	int fSorted ) ;
X
Xextern void ibm8514TileFS(
X	DrawablePtr pDrawable,
X	GC *pGC,
X	int nInit,
X	DDXPointPtr pptInit,
X	int *pwidthInit,
X	int fSorted ) ;
X
Xextern void ibm8514StippleFS(
X	DrawablePtr pDrawable,
X	GC *pGC,
X	int nInit,
X	DDXPointPtr pptInit,
X	int *pwidthInit,
X	int fSorted ) ;
X
Xextern void ibm8514OPStippleFS(
X	DrawablePtr pDrawable,
X	GC *pGC,
X	int nInit,
X	DDXPointPtr pptInit,
X	int *pwidthInit,
X	int fSorted ) ;
X
X/* brcFillSp.o */
X
Xextern void ibm8514SolidFS(
X	DrawablePtr pDrawable,
X	GCPtr pGC,
X	int nInit,
X	DDXPointPtr pptInit,
X	int *pwidthInit,
X	int fSorted ) ;
X
Xextern void ibm8514TileFS(
X	DrawablePtr pDrawable,
X	GC *pGC,
X	int nInit,
X	DDXPointPtr pptInit,
X	int *pwidthInit,
X	int fSorted ) ;
X
Xextern void ibm8514StippleFS(
X	DrawablePtr pDrawable,
X	GC *pGC,
X	int nInit,
X	DDXPointPtr pptInit,
X	int *pwidthInit,
X	int fSorted ) ;
X
Xextern void ibm8514OPStippleFS(
X	DrawablePtr pDrawable,
X	GC *pGC,
X	int nInit,
X	DDXPointPtr pptInit,
X	int *pwidthInit,
X	int fSorted ) ;
X
X/* brcGC.o */
Xextern Mask ibm8514ChangeGCtype(
X	GC *pGC,
X	ppcPrivGCPtr devPriv ) ;
X
Xextern Mask ibm8514ChangeWindowGC(
X	GC *pGC,
X	Mask changes ) ;
X
X/* brcGetSp.o */
X
Xextern void ibm8514GetSpans(
X	DrawablePtr pDrawable,
X	int wMax,
X	DDXPointPtr ppt,
X	int *pwidth,
X	int nspans,
X	unsigned int *pdstStart ) ;
X
X/* brcImg.o */
X
Xextern void ibm8514DrawColorImage(
X	int x,
X	int y,
X	int w,
X	int h,
X	unsigned char *data,
X	int RowIncrement,
X	int merge,
X	unsigned long int planes ) ;
X
Xextern void ibm8514ReadColorImage(
X	int x,
X	int y,
X	int lx,
X	int ly,
X	unsigned char *data,
X	int RowIncrement ) ;
X
X/* brcMono.o */
X
Xextern void ibm8514AlignMonoImage(
X	unsigned long int planes,
X	int merge,
X	int x,
X	int y,
X	int lx,
X	int ly,
X	unsigned char *data ) ;
X
Xextern void ibm8514StageMono(
X	int lx,
X	int ly,
X	unsigned char *data ) ;
X
Xextern void ibm8514FillMonoImage(
X	unsigned long int planes,
X	unsigned long int fg,
X	unsigned long int bg,
X	int merge,
X	int x,
X	int y,
X	int lx,
X	int ly,
X	unsigned char *data ) ;
X
Xextern void ibm8514DrawMonoByteImage(
X	unsigned char *data,
X	int x,
X	int y,
X	int lx,
X	int ly,
X	unsigned long int fg,
X	int merge,
X	unsigned long int planes ) ;
X
Xextern void ibm8514DrawMonoImage(
X	unsigned char *data,
X	int x,
X	int y,
X	int lx,
X	int ly,
X	unsigned long int fg,
X	int merge,
X	unsigned long int planes ) ;
X
Xextern void ibm8514ByteAlignMonoImage(
X	unsigned long int planes,
X	int merge,
X	int x,
X	int y,
X	int lx,
X	int ly,
X	unsigned char *data ) ;
X/* brcScrInit.o */
X
Xextern Bool ibm8514InitScreen(
X	int index,
X	ScreenPtr pScreen,
X	pointer pbits,
X	int xsize,
X	int ysize,
X	int dpix,
X	int dpiy ) ;
X
X/* brcSuspScr.o */
X
Xextern void ibm8514SuspendScreenAndSave(
X	void ) ;
X
Xextern void ibm8514RestoreScreenAndActivate(
X	void ) ;
X
X/* brcIO.c */
X
Xextern Bool ibm8514ScreenInit(
X	const int index,
X	ScreenPtr const pScreen,
X	int const argc,
X	char * const * const argv ) ;
X
Xextern Bool ibm8514ScreenClose(
X	const int index,
X	ScreenPtr const pScreen ) ;
X
X/* brcUtils.o */
X
Xextern short int ibm8514QueryHead(
X	void ) ;
X
Xextern int ibm8514QueryPlanes(
X	void ) ;
X
Xextern void ibm8514InitializeHardwareState(
X	void ) ;
X
Xextern int ibm8514ScreenInitHW(
X	int index ) ;
X
X#if defined(ibm032)
Xextern unsigned short int ibm8514inw(
X	unsigned int addr ) ;
X#endif
X
X/* brcGBlt.o */
X
Xextern void ibm8514ImageGlyphBlt(
X	DrawablePtr pDrawable,
X	GC *pGC,
X	int x,
X	int y,
X	unsigned int nglyph,
X	CharInfoPtr *ppci,
X	unsigned char *pglyphBase ) ;
X
X/* brcLine.o */
X
Xextern void ibm8514HorzLine(
X	unsigned long int color,
X	int alu,
X	unsigned long int mask,
X	int x,
X	int y,
X	int w ) ;
X
Xextern void ibm8514VertLine(
X	unsigned long int color,
X	int alu,
X	unsigned long int mask,
X	int x,
X	int y,
X	int h ) ;
X
Xextern void ibm8514BresLine(
X	unsigned long int color,
X	int alu,
X	unsigned long int mask,
X	int signdx,
X	int signdy,
X	int axis,
X	int x,
X	int y,
X	int et,
X	int e1,
X	int e2,
X	int len ) ;
X
X/* brcStip.o */
X
Xextern void ibm8514UnnaturalOpStipple(
X	PixmapPtr pStipple,
X	unsigned long int fg,
X	unsigned long int bg,
X	int merge,
X	unsigned long int planes,
X	int x,
X	int y,
X	int w,
X	int h,
X	int xSrc,
X	int ySrc ) ;
X
Xextern void ibm8514UnnaturalStipple(
X	PixmapPtr pStipple,
X	unsigned long int fg,
X	int merge,
X	unsigned long int planes,
X	int x,
X	int y,
X	int w,
X	int h,
X	int xSrc,
X	int ySrc ) ;
X
Xextern void ibm8514Stipple(
X	PixmapPtr pStipple,
X	unsigned long int fg,
X	int merge,
X	unsigned long int planes,
X	int x,
X	int y,
X	int w,
X	int h,
X	int xSrc,
X	int ySrc ) ;
X
Xextern void ibm8514OpStipple(
X	PixmapPtr pStipple,
X	unsigned long int fg,
X	unsigned long int bg,
X	int merge,
X	unsigned long int planes,
X	int x,
X	int y,
X	int w,
X	int h,
X	int xSrc,
X	int ySrc ) ;
X
X/* brcFont.o */
X
Xextern void ibm8514InitFontCache(
X	void ) ;
X
Xextern Bool ibm8514RealizeFont(
X	ScreenPtr pscr,
X	FontPtr pFont ) ;
X
Xextern Bool ibm8514UnrealizeFont(
X	ScreenPtr pscr,
X	FontPtr pFont ) ;
X
X/* brcText.o */
X
Xextern int ibm8514PolyText8(
X	DrawablePtr pDraw,
X	GCPtr pGC,
X	int x,
X	int y,
X	int count,
X	char *chars ) ;
X
Xextern int ibm8514PolyText16(
X	DrawablePtr pDraw,
X	GCPtr pGC,
X	int x,
X	int y,
X	int count,
X	unsigned short int *chars ) ;
X
Xextern void ibm8514ImageText8(
X	DrawablePtr pDraw,
X	GCPtr pGC,
X	int x,
X	int y,
X	int count,
X	char *chars ) ;
X
Xextern void ibm8514ImageText16(
X	DrawablePtr pDraw,
X	GCPtr pGC,
X	int x,
X	int y,
X	int count,
X	unsigned short int *chars ) ;
X
X/* brcPoly.c */
X
Xextern int ibm8514SolidFillPoly(
X	DrawablePtr pDraw,
X	GCPtr pGC,
X	int count,
X	DDXPointPtr pts ) ;
X
X/* brcPgon.o */
X
Xextern void ibm8514FillPolygon(
X	DrawablePtr dst,
X	GCPtr pgc,
X	int shape,
X	int mode,
X	int count,
X	DDXPointPtr pPts ) ;
X
X/* brcOutL.o */
X
Xextern void ibm8514Outline(
X	unsigned long int planes,
X	int x0,
X	int y0,
X	int x1,
X	int y1 ) ;
X
X/* brcRect.o */
X
Xextern void ibm8514DrawRectangle(
X	unsigned long int color,
X	int merge,
X	unsigned long int planes,
X	short int x0,
X	short int y0,
X	short int lx,
X	short int ly ) ;
X
X/* brcTile.o */
X
Xextern void ibm8514TileRect(
X	PixmapPtr pTile,
X	int merge,
X	unsigned long int planes,
X	int x,
X	int y,
X	int w,
X	int h,
X	int xSrc,
X	int ySrc ) ;
X
Xextern int ibm8514RotateTile(
X	int w,
X	int h,
X	int dx,
X	int dy ) ;
X
X/* brcPushPxl.o */
X
Xextern void ibm8514PushPixels(
X	GCPtr pGC,
X	PixmapPtr pBitMap,
X	DrawablePtr pDrawable,
X	int dx,
X	int dy,
X	int xOrg,
X	int yOrg ) ;
X
X/* brcOSD.o */
X
Xextern void ibm8514osdInit(
X	int index ) ;
X
Xextern int ibm8514Probe(
X	void ) ;
X
Xextern void blockoutw(
X	unsigned int port,
X	unsigned short int *values,
X	int n ) ;
X
Xextern void blockinw(
X	unsigned short int addr,
X	unsigned short int *data,
X	int n ) ;
X
X#endif /* CURSOR_ONLY */
X#else
X/* brcCurs.o */
Xextern int ibm8514CheckCursor() ;
Xextern void ibm8514ReplaceCursor() ;
Xextern int ibm8514cursorSemaphore ;
X#if !defined(CURSOR_ONLY)
Xextern void ibm8514RemoveCursor() ;
Xextern void ibm8514CursorInit() ;
Xextern Bool ibm8514RealizeCursor() ;
Xextern Bool ibm8514UnrealizeCursor() ;
Xextern void ibm8514ColorCursor() ;
Xextern void ibm8514RecolorCursor() ;
Xextern int ibm8514DisplayCursor() ;
Xextern void ibm8514ShowCursor() ;
X/* brcBlit.o */
Xextern void ibm8514Bitblt() ;
Xextern void ibm8514BlitFG() ;
Xextern void ibm8514BlitFGBG() ;
X/* brcCmap.o */
Xextern void ibm8514SetColor() ;
X/* brcFillSp.o */
Xextern void ibm8514SolidFS() ;
Xextern void ibm8514TileFS() ;
Xextern void ibm8514StippleFS() ;
Xextern void ibm8514OPStippleFS() ;
X/* brcFillSp.o */
Xextern void ibm8514SolidFS() ;
Xextern void ibm8514TileFS() ;
Xextern void ibm8514StippleFS() ;
Xextern void ibm8514OPStippleFS() ;
X/* brcGC.o */
Xextern Mask ibm8514ChangeGCtype() ;
Xextern Mask ibm8514ChangeWindowGC() ;
X/* brcGetSp.o */
Xextern void ibm8514GetSpans() ;
X/* brcImg.o */
Xextern void ibm8514DrawColorImage() ;
Xextern void ibm8514ReadColorImage() ;
X/* brcMono.o */
Xextern void ibm8514AlignMonoImage() ;
Xextern void ibm8514StageMono() ;
Xextern void ibm8514FillMonoImage() ;
Xextern void ibm8514DrawMonoByteImage() ;
Xextern void ibm8514DrawMonoImage() ;
Xextern void ibm8514ByteAlignMonoImage() ;
X/* brcScrInit.o */
Xextern Bool ibm8514InitScreen() ;
X/* brcSuspScr.o */
Xextern void ibm8514SuspendScreenAndSave() ;
Xextern void ibm8514RestoreScreenAndActivate() ;
X/* brcIO.c */
Xextern Bool ibm8514ScreenInit() ;
Xextern Bool ibm8514ScreenClose() ;
X/* brcUtils.o */
Xextern short int ibm8514QueryHead() ;
Xextern int ibm8514QueryPlanes() ;
Xextern void ibm8514InitializeHardwareState() ;
Xextern int ibm8514ScreenInitHW() ;
X#if defined(ibm032)
Xextern unsigned short int ibm8514inw() ;
X#endif
X/* brcGBlt.o */
Xextern void ibm8514ImageGlyphBlt() ;
X/* brcLine.o */
Xextern void ibm8514HorzLine() ;
Xextern void ibm8514VertLine() ;
Xextern void ibm8514BresLine() ;
X/* brcStip.o */
Xextern void ibm8514UnnaturalOpStipple() ;
Xextern void ibm8514UnnaturalStipple() ;
Xextern void ibm8514Stipple() ;
Xextern void ibm8514OpStipple() ;
X/* brcFont.o */
Xextern void ibm8514InitFontCache() ;
Xextern Bool ibm8514RealizeFont() ;
Xextern Bool ibm8514UnrealizeFont() ;
X/* brcText.o */
Xextern int ibm8514PolyText8() ;
Xextern int ibm8514PolyText16() ;
Xextern void ibm8514ImageText8() ;
Xextern void ibm8514ImageText16() ;
X/* brcPoly.c */
Xextern int ibm8514SolidFillPoly() ;
X/* brcPgon.o */
Xextern void ibm8514FillPolygon() ;
X/* brcOutL.o */
Xextern void ibm8514Outline() ;
X/* brcRect.o */
Xextern void ibm8514DrawRectangle() ;
X/* brcTile.o */
Xextern void ibm8514TileRect() ;
Xextern int ibm8514RotateTile() ;
X/* brcPushPxl.o */
Xextern void ibm8514PushPixels() ;
X/* brcOSD.o */
Xextern void ibm8514osdInit() ;
Xextern int ibm8514Probe() ;
Xextern void blockoutw() ;
Xextern void blockinw() ;
X#endif /* CURSOR_ONLY */
X#endif
END-of-ibm8514/brcProcs.h
echo x - ibm8514/brcPushPxl.c
sed 's/^X//' >ibm8514/brcPushPxl.c << 'END-of-ibm8514/brcPushPxl.c'
X/*
X * Copyright IBM Corporation 1987,1990
X *
X * All Rights Reserved
X *
X * Permission to use, copy, modify, and distribute this software and its
X * documentation for any purpose and without fee is hereby granted,
X * provided that the above copyright notice appear in all copies and that 
X * both that copyright notice and this permission notice appear in
X * supporting documentation, and that the name of IBM not be
X * used in advertising or publicity pertaining to distribution of the
X * software without specific, written prior permission.
X *
X * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
X * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
X * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
X * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
X * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
X * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
X * SOFTWARE.
X *
X*/
X/*
X * PRPQ 5799-PFF (C) COPYRIGHT IBM CORPORATION 1987,1990
X * LICENSED MATERIALS - PROPERTY OF IBM
X * REFER TO COPYRIGHT INSTRUCTIONS FORM NUMBER G120-2083
X */
X/*
X * ibm8514PushPixels
X */
X#include "X.h"
X#include "misc.h"
X#include "gcstruct.h"
X#include "scrnintstr.h"
X#include "windowstr.h"
X#include "regionstr.h"
X#include "pixmapstr.h"
X#include "miscstruct.h"
X#include "maskbits.h"
X
X#include "OScompiler.h"
X
X#include "ppc.h"
X
X#include "x8514.h"
Xextern int mfbGCPrivateIndex;
X
Xvoid
Xibm8514PushPixels(pGC, pBitMap, pDrawable, dx, dy, xOrg, yOrg)
X    GCPtr	pGC;
X    PixmapPtr	pBitMap;
X    DrawablePtr pDrawable;
X    int		dx, dy, xOrg, yOrg;
X{
Xregister int		thisX, thisY;
XppcPrivGC               *gcPriv  = (ppcPrivGC *) (
pGC->devPrivates[mfbGCPrivateIndex].ptr ) ;
Xint			alu = 	gcPriv->colorRrop.alu;
Xint			fillstyle = gcPriv->colorRrop.fillStyle;
XRegionPtr               prgnDst ;
XBoxPtr                  pbox ;
Xunsigned int            nbox ;
Xint 			dxInWords, wInWords, i;
Xunsigned char 		*data;
XScreenPtr		pScrn;
X
Xif (alu == GXnoop)
X	return;
X
Xif (dy > MONO_STAGE_SIZE) 
X	{
X	ppcPushPixels(pGC, pBitMap, pDrawable, dx, dy, xOrg, yOrg);
X	return;
X	}
X
Xswitch (fillstyle)
X	{
X		break;
X		ppcPushPixels(pGC, pBitMap, pDrawable, dx, dy, xOrg, yOrg);
X		return;
X		ErrorF( "ibm8514PushPixels: Unknown fill Style\n" ) ;
X		return ;
X	}
X
X/* Find The Actual Regions To Fill
X * by intersecting the destination's clip-region with
X * the box defined by our arguments.
X */
X{
X        BoxRec          dstBox ;
X
X        dstBox.x2 = ( dstBox.x1 = xOrg ) + dx ;
X        dstBox.y2 = ( dstBox.y1 = yOrg ) + dy ;
X
X	pScrn = (ScreenPtr) pDrawable->pScreen ;
X
X        prgnDst = (* pScrn->RegionCreate )( &dstBox,
X                                           
REGION_NUM_RECTS(gcPriv->pCompositeClip)) ;
X        (* pScrn->Intersect)( prgnDst, prgnDst, gcPriv->pCompositeClip ) ;
X        if ( !( nbox = REGION_NUM_RECTS(prgnDst) ) )
X		{
X		(* pScrn->RegionDestroy )( prgnDst);
X                return ;
X		}
X        pbox = REGION_RECTS(prgnDst) ;
X}
X
Xdx =  MIN(dx,_8514_SCREEN_WIDTH);
X
XdxInWords = (dx+31) >> 5;
XwInWords = (pBitMap->drawable.width + 31) >> 5;
X
Xif (dxInWords < wInWords)
X	{
X	/* fill the stage line by line */
X	data = pBitMap->devPrivate.ptr;
X	for ( i = 0 ; i < dy ; i++ )
X		{
X		/* since I know I'm one line high, I can lie about
X		   end-of-line padding and use ByteAlign */
X		ibm8514ByteAlignMonoImage(MONO_STAGE_WPLANE, GXcopy,
X			MONO_STAGE_X,  MONO_STAGE_Y+i,
X			dx, 1, data);
X		data += pBitMap->devKind;
X		}
X	}
X   else 
X	ibm8514AlignMonoImage(MONO_STAGE_WPLANE, GXcopy,
X			MONO_STAGE_X,  MONO_STAGE_Y,
X			dx, dy, pBitMap->devPrivate.ptr );
X
X/* OK, the bitmap is on the stage */
Xswitch (fillstyle)
X	{
X		for ( nbox = REGION_NUM_RECTS(prgnDst), pbox = REGION_RECTS(prgnDst) ;
X		      nbox-- ;
X		      pbox++ )
X			{
X			thisX = pbox->x1;
X			thisY = pbox->y1;
X			ibm8514BlitFG(MONO_STAGE_RPLANE, 
X					gcPriv->colorRrop.planemask,
X					gcPriv->colorRrop.fgPixel, alu, 
X					MONO_STAGE_X + thisX - xOrg,
X					MONO_STAGE_Y + thisY - yOrg,
X					thisX, thisY,
X					pbox->x2 - thisX,
X					pbox->y2 - thisY  );
X			}
X		break;
X		ErrorF(
X		"ibm8514PushPixels: Serious Error. Unsupported fill Style\n" ) ;
X		break;
X		ErrorF( "ibm8514PushPixels: Unknown fill Style\n" ) ;
X		break;
X	}
X(* pScrn->RegionDestroy )( prgnDst);
Xreturn ;
X}
END-of-ibm8514/brcPushPxl.c
exit

mlewis@dolphin.tcspa.ibm.com (Mark S. Lewis) (03/13/90)

Subject: IBM 8514 source code (part 5 of 6) for X11 Release 4
Index: ../mit/server/ddx/ibm/ibm8514

Description:	
IBM has decided to provide X11 source code for the 8514 display
adapter.  This is the same code used to build the object files
included in the X11 Release 4 distribution.  This code supports
servers for both AIX and IBM/4.3 on their respective platforms.

	V1.32_kit.1	59,103 Bytes
	V1.32_kit.2	61,796 Bytes
	V1.32_kit.3	60,982 Bytes
	V1.32_kit.4	62,729 Bytes
	V1.32_kit.5	54,871 Bytes
	V1.32_kit.6	29,170 Bytes

Installation:	
This code is provided in a 6-part shell archive.  Before you
install it, you should save your current code.  You should save
the Imakefile in the ibm server directory.  You also should save
the entire ibm8514 directory by moving and remaking it.

	cd ../mit/server/ddx/ibm
	cp Imakefile Imakefile.orig
	mv ibm8514 ibm8514.orig
	mkdir ibm8514
	
Next, edit this header from each part, and feed the rest to
/bin/sh.  Proceed to make the server as instructed in the
X11 release notes.

	sh < V1.32_kit.5

=====-----     Mark S. Lewis, IBM AWD Palo Alto    -----======
inet: mlewis%ibmsupt@uunet.uu.net		(415) 855-4486
uucp: uunet!ibmsupt!mlewis              IBM Tie Line: 465-4486

# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
#
#	ibm8514/brcRect.c
#	ibm8514/brcScrInfo.c
#	ibm8514/brcStip.c
#	ibm8514/brcSuspScr.c
#	ibm8514/brcText.c
#
echo x - ibm8514/brcRect.c
sed 's/^X//' >ibm8514/brcRect.c << 'END-of-ibm8514/brcRect.c'
X/*
X * Copyright IBM Corporation 1987,1990
X *
X * All Rights Reserved
X *
X * Permission to use, copy, modify, and distribute this software and its
X * documentation for any purpose and without fee is hereby granted,
X * provided that the above copyright notice appear in all copies and that 
X * both that copyright notice and this permission notice appear in
X * supporting documentation, and that the name of IBM not be
X * used in advertising or publicity pertaining to distribution of the
X * software without specific, written prior permission.
X *
X * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
X * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
X * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
X * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
X * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
X * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
X * SOFTWARE.
X *
X*/
X/*
X * PRPQ 5799-PFF (C) COPYRIGHT IBM CORPORATION 1987,1990
X * LICENSED MATERIALS - PROPERTY OF IBM
X * REFER TO COPYRIGHT INSTRUCTIONS FORM NUMBER G120-2083
X */
X/*
X *  Hardware interface routines for IBM 8514/A adapter for
X *  X.11 server(s) on IBM equipment.
X *
X */
X/* $Header:
/andrew/X11/r3src/r3plus/server/ddx/ibm/ibm8514/RCS/brcRect.c,v 6.3
89/05/07 15:11:19 paul Exp $ */
X/* $Source:
/andrew/X11/r3src/r3plus/server/ddx/ibm/ibm8514/RCS/brcRect.c,v $ */
X
X#ifndef lint
Xstatic char *rcsid = "$Header:
/andrew/X11/r3src/r3plus/server/ddx/ibm/ibm8514/RCS/brcRect.c,v 6.3
89/05/07 15:11:19 paul Exp $" ;
X#endif
X
X#include "x8514.h"
X#include "ibmTrace.h"
X
Xextern int mergexlate[] ;
Xextern int ibm8514cursorSemaphore ;
X
Xvoid
Xibm8514DrawRectangle(color, merge, planes, x0, y0, lx, ly)
Xunsigned long int color ;
Xint merge ;
Xunsigned long int planes ;
Xshort  x0, y0, lx, ly ;
X{
Xint CursorIsSaved ;
XTRACE(("ibm8514DrawRectangle(color=%d, merge=x%x, planes=%02x, x=%d,
y=%d, lx=%d, ly=%d\n",
X	color, merge, planes, x0, y0, lx, ly)) ;
X
X   if ( ( lx <= 0 ) || ( ly <= 0 ) )
X	return ;
X   CursorIsSaved = !ibm8514cursorSemaphore && ibm8514CheckCursor(x0,
y0, lx, ly) ;
X
X   ibm8514ATRNotBusy ;
X   ibm8514CheckQueue(8) ;
X   SETFN1(FNCOLOR1, mergexlate[merge]) ;
X   SETCOL1(color) ;
X   PLNWENBL(planes) ;
X   SETY0(y0) ;
X   SETX0(x0) ;
X   SETLY(ly-1) ;
X   SETLX(lx-1) ;
X   COMMAND(0x80b3) ; /* Horizontal Rect operation, DX = DY = 'increasing'*/
X
X   ibm8514ClearQueue(2) ;
X   PLNWENBL( ibm8514ALLPLANES ) ;
X   SETFN1(FNCOLOR1, FNREPLACE) ;
X
X   if (CursorIsSaved)
X	ibm8514ReplaceCursor() ;
X   return ;
X}
END-of-ibm8514/brcRect.c
echo x - ibm8514/brcScrInfo.c
sed 's/^X//' >ibm8514/brcScrInfo.c << 'END-of-ibm8514/brcScrInfo.c'
X/*
X * Copyright IBM Corporation 1987,1990
X *
X * All Rights Reserved
X *
X * Permission to use, copy, modify, and distribute this software and its
X * documentation for any purpose and without fee is hereby granted,
X * provided that the above copyright notice appear in all copies and that 
X * both that copyright notice and this permission notice appear in
X * supporting documentation, and that the name of IBM not be
X * used in advertising or publicity pertaining to distribution of the
X * software without specific, written prior permission.
X *
X * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
X * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
X * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
X * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
X * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
X * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
X * SOFTWARE.
X *
X*/
X/*
X * PRPQ 5799-PFF (C) COPYRIGHT IBM CORPORATION 1987,1990
X * LICENSED MATERIALS - PROPERTY OF IBM
X * REFER TO COPYRIGHT INSTRUCTIONS FORM NUMBER G120-2083
X */
X#include "X.h"
X#include "misc.h"
X#include "miscstruct.h"
X#include "scrnintstr.h"
X#include "cursorstr.h"
X
X#include "ibmScreen.h"
X
X#include "x8514.h"
X
Xextern Bool ibm8514ScreenInit() ;
Xextern Bool ibm8514Probe() ;
Xextern void ibm8514RemoveCursor() ;
Xextern void ibm8514ShowCursor() ;
Xextern void ibm8514SuspendScreenAndSave() ;
Xextern void ibm8514RestoreScreenAndActivate() ;
Xextern PixmapFormatRec ibm8514Formats[] ;
X
XibmPerScreenInfo ibm8514ScreenInfoStruct = {
X
X	{ 0, 0,
X	  _8514_SCREENWIDTH - 1,
X	  _8514_SCREENHEIGHT - 1 },	/* BoxRec	 ibm_ScreenBounds ; */
X	1,			/* int		 ibm_NumFormats ; */
X	ibm8514Formats,		/* PixmapFormatRec	*ibm_ScreenFormats ; */
X	ibm8514ScreenInit,	/* Bool		(*ibm_InitFunc)() ; */
X	ibm8514Probe,		/* int		(*ibm_ProbeFunc)() ; */
X	ibm8514RemoveCursor,	/* void		(*ibm_HideCursor)() ; */
X	"-8514",		/* char		 *ibm_ScreenFlag ; */
X	IBM8514_DEV_FILE,		/* char		 *ibm_ScreenDevice ; */
X	"/dev/ms8514",			/* char		 *ibm_ScreenPointer ; */
X	ibm8514SuspendScreenAndSave,/* void		(*ibm_SaveFunc)() ; */
X	ibm8514RestoreScreenAndActivate,/* void	(*ibm_RestoreFunc)() ; */
X	(ScreenPtr) 0,		/* ScreenPtr	  ibm_Screen */
X	-1,			/* int		  ibm_ScreenFD */
X	0,			/* int		  ibm_Wanted */
X	0,			/* short	  ibm_CursorHotX */
X	0,			/* short	  ibm_CursorHotY */
X	ibm8514ShowCursor,	/* void		(*ibm_CursorShow)() */
X	(CursorPtr) 0,		/* CursorPtr	  ibm_CurrentCursor */
X	SCREEN_UNINITIALIZED	/* int		  ibm_ScreenState */
X} ;
END-of-ibm8514/brcScrInfo.c
echo x - ibm8514/brcStip.c
sed 's/^X//' >ibm8514/brcStip.c << 'END-of-ibm8514/brcStip.c'
X/*
X * Copyright IBM Corporation 1987,1990
X *
X * All Rights Reserved
X *
X * Permission to use, copy, modify, and distribute this software and its
X * documentation for any purpose and without fee is hereby granted,
X * provided that the above copyright notice appear in all copies and that 
X * both that copyright notice and this permission notice appear in
X * supporting documentation, and that the name of IBM not be
X * used in advertising or publicity pertaining to distribution of the
X * software without specific, written prior permission.
X *
X * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
X * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
X * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
X * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
X * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
X * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
X * SOFTWARE.
X *
X*/
X/*
X * PRPQ 5799-PFF (C) COPYRIGHT IBM CORPORATION 1987,1990
X * LICENSED MATERIALS - PROPERTY OF IBM
X * REFER TO COPYRIGHT INSTRUCTIONS FORM NUMBER G120-2083
X */
X/*
X *  Hardware interface routines for IBM 8514/A adapter for
X *  X.11 server(s) on IBM equipment.
X *
X */
X/* $Header:
/andrew/X11/r3src/release/server/ddx/ibm/ibm8514/RCS/brcStip.c,v 30.0
89/01/23 19:24:03 paul Exp $ */
X/* $Source:
/andrew/X11/r3src/release/server/ddx/ibm/ibm8514/RCS/brcStip.c,v $ */
X
X#ifndef lint
Xstatic char *rcsid = "$Header:
/andrew/X11/r3src/release/server/ddx/ibm/ibm8514/RCS/brcStip.c,v 30.0
89/01/23 19:24:03 paul Exp $" ;
X#endif
X
X
X/* DO STIPPLES!!!
X */
X
X#include "X.h"
X#include "servermd.h"
X#include "pixmap.h"
X#include "pixmapstr.h"
X#include "gcstruct.h"
X
X#include "OScompiler.h"
X
X#include "x8514.h"
X
X#include "ibmTrace.h"
X
Xextern int ibm8514cursorSemaphore ;
Xextern PixmapPtr ppcCopyPixmap() ;
X
Xvoid
Xibm8514UnnaturalOpStipple( pStipple, fg, bg, merge, planes,
X			   x, y, w, h, xSrc, ySrc )
XPixmapPtr pStipple ;
Xunsigned long int fg, bg ;
Xint merge ;
Xunsigned long int planes ;
Xint x ;
Xint y ;
Xint w ;
Xint h ;
Xint xSrc ;
Xint ySrc ;
X{
Xint hcount, vcount, vtarget, htarget, savehcount, savehtarget, tlx, tly ;
Xint maxwid, heightleft, tmp, CursorIsSaved, yoffset, this_height ;
Xunsigned char *data ;
X
Xif ( x < 0 ) {
X	w += x ;
X	x = 0 ;
X}
Xif ( y < 0 ) {
X	h += y ;
X	y = 0 ;
X}
Xw = MIN(_8514_SCREENWIDTH-x, w) ;
Xh = MIN(_8514_SCREENHEIGHT-y, h) ;
X
Xif ( ( w <= 0 ) || ( h <= 0 )  )
X	return ;
X
Xtlx = pStipple->drawable.width ;
Xtly = pStipple->drawable.height ;
X
XCursorIsSaved = !ibm8514cursorSemaphore
X		&& ibm8514CheckCursor( x, y, x + w, y + h ) ;
Xibm8514cursorSemaphore++ ;
X
Xheightleft = h ;
Xyoffset = 0 ;
X
Xdata = pStipple->devPrivate.ptr ;
Xwhile ( heightleft > 0 ) {
X	this_height = MIN( heightleft, MAXSTIPPLEHEIGHT ) ;
X	ibm8514StageMono( tlx, this_height, data ) ;
X	/*expand the tile to largest available size */
X	maxwid = MIN( MAXSTIPPLEWIDTH, w ) ;
X	while ( tlx * 2 <= maxwid ) {
X		ibm8514Bitblt( GXcopy, MONO_STAGE_RPLANE, MONO_STAGE_WPLANE,
X			       MONO_STAGE_X, MONO_STAGE_Y,
X			       tlx + MONO_STAGE_X, MONO_STAGE_Y,
X			       tlx, this_height ) ;
X		tlx *= 2 ;
X	}
X	tmp = ( x - xSrc ) % tlx ;
X	if ( tmp < 0  )
X		tmp += tlx ;
X	savehtarget = htarget = x - tmp ;
X
X	tmp = ( y - ySrc ) % tly ;
X	if ( tmp < 0  )
X		tmp += tly ;
X	vtarget = y - tmp + yoffset ;
X
X	/*tiles to fill horiz */
X	savehcount = hcount = ( ( x + w - htarget ) + tlx - 1 ) / tlx ;
X
X	/* tiles it will take to fill vert */
X	vcount = ( ( y + h - vtarget ) + tly - 1 ) / tly ;
X
X	ibm8514ClearQueue( 4 ) ;
X	SETXMAX( x + w - 1 ) ;
X	SETYMAX( y + h - 1 ) ;
X	SETXMIN( x ) ;
X	SETYMIN( y ) ;
X
X	while ( vcount-- ) {
X		while ( hcount-- ) {
X			ibm8514BlitFGBG( MONO_STAGE_RPLANE, planes,
X					 fg, bg, merge,
X					 MONO_STAGE_X, MONO_STAGE_Y,
X					 htarget, vtarget, tlx, this_height ) ;
X			htarget += tlx ;
X		}
X		vtarget += tly ;
X		htarget = savehtarget ;
X		hcount = savehcount ;
X	}
X	yoffset += this_height ;
X	heightleft -= this_height ;
X	data += this_height * pStipple->devKind ;
X
X	ibm8514ClearQueue( 4 ) ;
X	SETXMAX( _8514_SCREENWIDTH - 1 ) ;
X	SETYMAX( 1023 ) ;
X	SETXMIN( 0 ) ;
X	SETYMIN( 0 ) ;
X}
Xif ( !--ibm8514cursorSemaphore && CursorIsSaved  )
X	ibm8514ReplaceCursor() ;
X
Xreturn ;
X}
X
Xvoid
Xibm8514UnnaturalStipple(pStipple, fg, merge, planes, x, y, w, h, xSrc, ySrc )
XPixmapPtr pStipple ;
Xunsigned long int fg ;
Xint merge ;
Xunsigned long int planes ;
Xint x ;
Xint y ;
Xint w ;
Xint h ;
Xint xSrc ;
Xint ySrc ;
X{
Xint hcount, vcount, vtarget, htarget, savehcount, savehtarget, tlx, tly ;
Xint maxwid, heightleft, tmp, CursorIsSaved, yoffset, this_height ;
Xunsigned char *data ;
X
Xif ( x < 0 ) {
X	w += x ;
X	x = 0 ;
X}
Xif ( y < 0 ) {
X	h += y ;
X	y = 0 ;
X}
Xw = MIN( _8514_SCREENWIDTH - x, w ) ;
Xh = MIN( _8514_SCREENHEIGHT - y, h ) ;
X
Xif ( w <= 0 || h <= 0 )
X	return ;
X
Xtlx = pStipple->drawable.width ;
Xtly = pStipple->drawable.height ;
X
XCursorIsSaved = !ibm8514cursorSemaphore
X		&& ibm8514CheckCursor( x, y, x + w, y + h ) ;
Xibm8514cursorSemaphore++ ;
X
Xheightleft = h ;
Xyoffset = 0 ;
X
Xdata = pStipple->devPrivate.ptr ;
Xwhile ( heightleft > 0 ) {
X	this_height = MIN( heightleft, MAXSTIPPLEHEIGHT ) ;
X
X	ibm8514StageMono( tlx, this_height, data ) ;
X
X	/*expand the tile to largest available size */
X	maxwid = MIN( MAXSTIPPLEWIDTH, w ) ;
X	while ( tlx*2 <= maxwid ) {
X		ibm8514Bitblt( GXcopy, MONO_STAGE_RPLANE, MONO_STAGE_WPLANE,
X			       MONO_STAGE_X, MONO_STAGE_Y,
X			       tlx + MONO_STAGE_X, MONO_STAGE_Y,
X			       tlx, this_height ) ;
X		tlx *= 2 ;
X	}
X	tmp = ( x - xSrc ) % tlx ;
X	if ( tmp < 0  )
X		tmp += tlx ;
X	savehtarget = htarget = x - tmp ;
X
X	tmp = ( y - ySrc ) % tly ;
X	if ( tmp < 0  )
X		tmp += tly ;
X	vtarget =  y - tmp + yoffset ;
X
X	/* tiles to fill horiz */
X	savehcount = hcount = ( ( x + w - htarget ) + tlx - 1 ) / tlx ;
X
X	/* tiles it will take to fill vert */
X	vcount = ( ( y + h - vtarget ) + tly - 1 ) / tly ;
X
X	ibm8514ClearQueue( 4 ) ;
X	SETXMAX( x + w - 1 ) ;
X	SETYMAX( y + h - 1 ) ;
X	SETXMIN( x ) ;
X	SETYMIN( y ) ;
X
X	while ( vcount-- ) {
X		while ( hcount-- ) {
X			ibm8514BlitFG( MONO_STAGE_RPLANE, planes, fg, merge,
X				       MONO_STAGE_X, MONO_STAGE_Y,
X				       htarget, vtarget, tlx, this_height ) ;
X			htarget += tlx ;
X		}
X		vtarget += tly ;
X		htarget = savehtarget ;
X		hcount = savehcount ;
X	}
X	yoffset += this_height ;
X	heightleft -= this_height ;
X	data += this_height * pStipple->devKind ;
X
X	ibm8514ClearQueue( 4 ) ;
X	SETXMAX( _8514_SCREENWIDTH - 1 ) ;
X	SETYMAX( 1023 ) ;
X	SETXMIN( 0 ) ;
X	SETYMIN( 0 ) ;
X}
X
Xif ( !--ibm8514cursorSemaphore && CursorIsSaved  )
X	ibm8514ReplaceCursor() ;
Xreturn ;
X}
X
Xvoid
Xibm8514Stipple(pStipple, fg, merge, planes, x, y, w, h, xSrc, ySrc )
XPixmapPtr pStipple ;
Xunsigned long int fg ;
Xint merge ;
Xunsigned long int planes ;
Xint x, y, w, h, xSrc, ySrc ;
X{
Xint hcount, vcount, vtarget, htarget, savehcount, savehtarget, tlx, tly ;
Xint maxhite, maxwid ;
Xint tmp, CursorIsSaved ;
Xint xrot, yshift ;
X
XTRACE(("ibm8514Stipple(pStipple = x%x, fg=%d, merge= x%x, planes=x%02x,
x=%d, y=%d, w=%d, h=%d, xSrc=%d, ySrc=%d\n)",
X		pStipple, fg, merge, planes, x, y, w, h, xSrc, ySrc)) ;
Xtlx = pStipple->drawable.width ;
Xtly = pStipple->drawable.height ;
X
X{
X
Xif ((x%4 == 0) && (w<=tlx) && (h<=tly) )
X	{
X	PixmapPtr pTmpStipple ;
X	int destroy=FALSE ;
X
X	if (xrot = ((x-xSrc)%tlx) )
X		{
X		if (!(pTmpStipple = ppcCopyPixmap(pStipple)) )
X			{
X			ErrorF("Fail ppcCopyPixmap \"pTmpStipple\" \n") ;
X			return ;
X			}
X		destroy = TRUE ;
X		ppcRotBitmapRight(pTmpStipple, tlx-xrot) ;
X		}
X	  if (
X	      (
X		((w+BITMAP_SCANLINE_PAD-1) >> LOG2_BITMAP_PAD)
X		<< LOG2_BYTES_PER_SCANLINE_PAD
X	       )
X		   <      pStipple->devKind
X	     ) {
X		PixmapPtr ppcClipBitmap() ;
X		if (!destroy )
X			{
X			if (!(pTmpStipple = ppcClipBitmap(pStipple, w, h)) )
X				{
X				ErrorF("Fail ppcClipBitxmap\n") ;
X				return ;
X				}
X			destroy = TRUE ;
X			}
X		else {
X			PixmapPtr pNew ;
X			if (!(pNew = ppcClipBitmap(pTmpStipple, w, h)) )
X				{
X				ErrorF("Fail ppcClipBitxmap\n") ;
X				mfbDestroyPixmap(pTmpStipple) ;
X				return ;
X				}
X			mfbDestroyPixmap(pTmpStipple) ;
X			pTmpStipple = pNew ;
X			}
X		}
X	if (!destroy )
X		pTmpStipple = pStipple ;
X
X	yshift = ((y-ySrc)%tly) ;
X
X	if ( yshift > h )
X		{
X		ibm8514DrawMonoImage( pTmpStipple->devPrivate.ptr
X				      + (yshift*pTmpStipple->devKind),
X				      x, y, w, h, fg, merge, planes ) ;
X		}
X	else
X		{
X		ibm8514DrawMonoImage( pTmpStipple->devPrivate.ptr, x, y+yshift,
X					w, h-yshift, fg, merge, planes) ;
X		ibm8514DrawMonoImage( pTmpStipple->devPrivate.ptr
X			      + (yshift*pTmpStipple->devKind),
X			      x, y, w, yshift, fg, merge, planes ) ;
X		/*
X		WHATS WRONG WITH ALIGNMONOIMAGE HERE????
X		ALIGNMONOIMAGE DOESN'T TAKE A FG COLOR
X		*/
X		}
X	if (destroy )
X		mfbDestroyPixmap(pTmpStipple) ;
X
X	return ;
X	}
X}
X
Xif ( ( tlx > MAXSTIPPLEWIDTH ) || ( tly > MAXSTIPPLEHEIGHT ) ) {
X	ibm8514UnnaturalStipple( pStipple, fg, merge, planes,
X				 x, y, w, h, xSrc, ySrc) ;
X	return ;
X}
X
Xif ( x < 0 ) {
X	w += x ;
X	x = 0 ;
X}
Xif ( y < 0 ) {
X	h += y ;
X	y = 0 ;
X}
Xw = MIN(_8514_SCREENWIDTH-x, w) ;
Xh = MIN(_8514_SCREENHEIGHT-y, h) ;
X
Xif ( ( w <= 0) || (h <= 0)  )
X	return ;
X
Xibm8514StageMono(tlx, tly, pStipple->devPrivate.ptr) ;
X
X/*expand the tile to largest available size */
Xmaxwid = MIN(MAXSTIPPLEWIDTH, w) ;
Xwhile ( tlx * 2 <= maxwid ) {
X	ibm8514Bitblt( GXcopy, MONO_STAGE_RPLANE, MONO_STAGE_WPLANE,
X		MONO_STAGE_X, MONO_STAGE_Y,
X		tlx + MONO_STAGE_X, MONO_STAGE_Y,
X		tlx, tly ) ;
X	tlx *= 2 ;
X}
Xmaxhite = MIN(MAXSTIPPLEHEIGHT, h) ;
Xwhile ( tly*2 <= maxhite ) {
X	ibm8514Bitblt( GXcopy, MONO_STAGE_RPLANE, MONO_STAGE_WPLANE,
X		MONO_STAGE_X, MONO_STAGE_Y,
X		MONO_STAGE_X, tly+MONO_STAGE_Y,
X		tlx, tly) ;
X	tly *= 2 ;
X}
X
Xtmp = ( x - xSrc ) % tlx ;
Xif ( tmp < 0  )
X	tmp += tlx ;
Xsavehtarget = htarget = x - tmp ;
Xtmp = ( y - ySrc ) % tly ;
Xif ( tmp < 0  )
X	tmp += tly ;
Xvtarget = y - tmp ;
X
Xsavehcount = hcount = ((x+w-htarget)+tlx-1)/tlx ; /*tiles to fill horiz */
Xvcount = ((y+h-vtarget)+tly-1)/tly ; /*tiles it will take to fill vert */
X
XCursorIsSaved = !ibm8514cursorSemaphore
X     && ibm8514CheckCursor(htarget, vtarget, hcount*tlx, vcount*tly) ;
Xibm8514cursorSemaphore++ ;
X
Xibm8514ClearQueue(4) ;
XSETXMAX(x+w-1) ;
XSETYMAX(y+h-1) ;
XSETXMIN(x) ;
XSETYMIN(y) ;
X
Xwhile ( vcount-- ) {
X	while ( hcount-- ) {
X		ibm8514BlitFG( MONO_STAGE_RPLANE, planes, fg, merge,
X				MONO_STAGE_X, MONO_STAGE_Y,
X				htarget, vtarget, tlx, tly) ;
X		htarget += tlx ;
X	}
X	vtarget += tly ;
X	htarget = savehtarget ;
X	hcount = savehcount ;
X}
X
Xibm8514ClearQueue(4) ;
XSETXMAX(_8514_SCREENWIDTH-1) ;
XSETYMAX( 1023 ) ;
XSETXMIN(0) ;
XSETYMIN(0) ;
Xif ( !(--ibm8514cursorSemaphore) && CursorIsSaved  )
X	ibm8514ReplaceCursor() ;
Xreturn ;
X}
X
Xvoid
Xibm8514OpStipple(pStipple, fg, bg, merge, planes, x, y, w, h, xSrc, ySrc )
XPixmapPtr pStipple ;
Xunsigned long int fg, bg ;
Xint merge ;
Xunsigned long int planes ;
Xint x, y, w, h, xSrc, ySrc ;
X{
Xint hcount, vcount, vtarget, htarget, savehcount, savehtarget, tlx, tly ;
Xint maxhite, maxwid ;
Xint tmp, CursorIsSaved ;
X
XTRACE(("ibm8514Stipple(pStipple = x%x, fg=%d, merge= x%x, planes=x%02x,
x=%d, y=%d, w=%d, h=%d, xSrc=%d, ySrc=%d\n",
X		pStipple, fg, merge, planes, x, y, w, h, xSrc, ySrc)) ;
X
Xtlx = pStipple->drawable.width ;
Xtly = pStipple->drawable.height ;
X
Xif ( ( tlx > MAXSTIPPLEWIDTH ) || ( tly > MAXSTIPPLEHEIGHT ) ) {
X       ibm8514UnnaturalOpStipple( pStipple, fg, bg, merge, planes,
X				  x, y, w, h, xSrc, ySrc ) ;
X	return ;
X}
X
Xif ( x < 0 ) {
X	w += x ;
X	x = 0 ;
X}
Xif ( y < 0 ) {
X	h += y ;
X	y = 0 ;
X}
Xw = MIN(_8514_SCREENWIDTH-x, w) ;
Xh = MIN(_8514_SCREENHEIGHT-y, h) ;
X
Xif ( (w <= 0) || (h <= 0 )  )
X	return ;
X
Xibm8514StageMono(tlx, tly, pStipple->devPrivate.ptr) ;
X
X/*expand the tile to largest available size */
Xmaxwid = MIN(MAXSTIPPLEWIDTH, w) ;
Xwhile ( tlx*2 <= maxwid )
X	{
X	ibm8514Bitblt(GXcopy, MONO_STAGE_RPLANE, MONO_STAGE_WPLANE,
X		MONO_STAGE_X, MONO_STAGE_Y,
X		tlx+MONO_STAGE_X, MONO_STAGE_Y,
X		tlx, tly) ;
X	tlx *= 2 ;
X	}
Xmaxhite = MIN(MAXSTIPPLEHEIGHT, h) ;
Xwhile ( tly*2 <= maxhite )
X	{
X	ibm8514Bitblt(GXcopy, MONO_STAGE_RPLANE, MONO_STAGE_WPLANE,
X		MONO_STAGE_X, MONO_STAGE_Y,
X		MONO_STAGE_X, tly+MONO_STAGE_Y,
X		tlx, tly) ;
X	tly *= 2 ;
X	}
X
Xtmp = ( x - xSrc ) % tlx ;
Xif ( tmp < 0  )
X	tmp += tlx ;
Xsavehtarget = htarget =  x - tmp ;
Xtmp = ((y-ySrc)%tly) ;
Xif ( tmp < 0  )
X	tmp += tly ;
Xvtarget =  y - tmp ;
X
Xsavehcount = hcount = ((x+w-htarget)+tlx-1)/tlx ; /*tiles to fill horiz */
Xvcount = ((y+h-vtarget)+tly-1)/tly ; /*tiles it will take to fill vert */
X
XCursorIsSaved = !ibm8514cursorSemaphore
X     && ibm8514CheckCursor(htarget, vtarget, hcount*tlx, vcount*tly) ;
Xibm8514cursorSemaphore++ ;
X
Xibm8514ClearQueue(4) ;
XSETXMAX(x+w-1) ;
XSETYMAX(y+h-1) ;
XSETXMIN(x) ;
XSETYMIN(y) ;
X
Xwhile ( vcount-- ) {
X	while ( hcount-- ) {
X		ibm8514BlitFGBG(MONO_STAGE_RPLANE, planes, fg, bg, merge,
X				MONO_STAGE_X, MONO_STAGE_Y,
X				htarget, vtarget, tlx, tly) ;
X		htarget += tlx ;
X	}
X	vtarget += tly ;
X	htarget = savehtarget ;
X	hcount = savehcount ;
X}
X
Xibm8514ClearQueue(4) ;
XSETXMAX(_8514_SCREENWIDTH-1) ;
XSETYMAX( 1023 ) ;
XSETXMIN(0) ;
XSETYMIN(0) ;
Xif ( !(--ibm8514cursorSemaphore) && CursorIsSaved  )
X	ibm8514ReplaceCursor() ;
Xreturn ;
X}
END-of-ibm8514/brcStip.c
echo x - ibm8514/brcSuspScr.c
sed 's/^X//' >ibm8514/brcSuspScr.c << 'END-of-ibm8514/brcSuspScr.c'
X/*
X * Copyright IBM Corporation 1987,1990
X *
X * All Rights Reserved
X *
X * Permission to use, copy, modify, and distribute this software and its
X * documentation for any purpose and without fee is hereby granted,
X * provided that the above copyright notice appear in all copies and that 
X * both that copyright notice and this permission notice appear in
X * supporting documentation, and that the name of IBM not be
X * used in advertising or publicity pertaining to distribution of the
X * software without specific, written prior permission.
X *
X * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
X * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
X * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
X * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
X * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
X * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
X * SOFTWARE.
X *
X*/
X/*
X * PRPQ 5799-PFF (C) COPYRIGHT IBM CORPORATION 1987,1990
X * LICENSED MATERIALS - PROPERTY OF IBM
X * REFER TO COPYRIGHT INSTRUCTIONS FORM NUMBER G120-2083
X */
X/*
X *  Hardware interface routines for IBM 8514/A adapter for
X *  X.11 server(s) on IBM equipment.
X *
X */
X
X#include "X.h"
X#include "windowstr.h"
X#include "window.h"
X#include "pixmapstr.h"
X#include "scrnintstr.h"
X#include "gcstruct.h"
X#include "cursorstr.h"
X
X#include "OScompiler.h"
X
X#include "ibmIOArch.h"
X#include "ibmScreen.h"
X
X#include "ppcGCstr.h"
X#include "ppcScrn.h"
X
X#include "x8514.h"
X
X#define CURSOR_ONLY
X#include "brcProcs.h"
X
X#if defined(ibm032) && defined(BSDrt)
X#define ATR
X#include <sys/ioctl.h>
X#include <machinecons/buf_emul.h>
X#else
X#ifdef i386
X        /* Nothing Yet */
X#else
X        ******** ERROR ********
X#endif
X#endif
X
X#if defined(IBM_OS_HAS_HFT) && !defined(IBM_OS_HAS_X_QUEUE)
X#define HFT_HACKS "Oh no. The hack is here!"
X#endif
X
X#if !defined(HFT_HACKS)
Xextern WindowPtr ObscureEntireScreen() ;
X#else
Xextern void ibmSaveScreenData() ;
Xextern void ibmRestoreScreenData() ;
Xextern void ppcSaveAreas() ;
Xextern void ppcRestoreAreas() ;
X#endif
X
X/* Data from brcScrInfo.c */
Xextern ibmPerScreenInfo ibm8514ScreenInfoStruct ;
X
X/* Data from brcData.c */
Xextern ppcScrnPriv ibm8514ScrnPriv ;
X
X/* Procedures from brcCurs.c */
Xextern void ibm8514RemoveCursor() ;
Xextern void ibm8514ShowCursor() ;
X
X/* Procedures from brcutils.c */
Xextern void ibm8514InitializeHardwareState() ;
Xextern int ibm8514FD ;
X
X/*
************************************************************************** */
X
Xint ibm8514Disabled = 0 ;
X
X/* Private State Variables */
Xstatic int CursorWasActive = 0 ;
Xstatic ppcScrnPriv savedibm8514ScrnPriv ;
Xstatic WindowPtr coveringWindow = (WindowPtr) 0 ;
X
Xstatic int
XDoNaught()
X{
Xreturn 0 ;
X}
X
X#if !defined(HFT_HACKS)
Xvoid
Xibm8514SuspendScreenAndSave( index )
Xint index ;
X#else /* erik's hft hack */
Xvoid
Xibm8514SuspendScreenAndSave( pScreen, saveBits )
XScreenPtr pScreen ;
Xint saveBits ;
X#endif
X{
Xif ( ibm8514ScreenInfoStruct.ibm_ScreenState == SCREEN_ACTIVE ) {
X	/* Now Disable any further screen writes
X	 * by preventing call though the screen-priv
X	 */
X	savedibm8514ScrnPriv = ibm8514ScrnPriv ;
X	CursorWasActive = !ibm8514cursorSemaphore
X			&& ibm8514CheckCursor( 0, 0, _8514_SCREENWIDTH,
X					       _8514_SCREENHEIGHT ) ;
X	ibm8514cursorSemaphore++ ;
X
X	/* Fields in the ibmPerScreenInfo Structure */
X	ibm8514ScreenInfoStruct.ibm_HideCursor = (void (*)()) DoNaught ;
X	ibm8514ScreenInfoStruct.ibm_CursorShow = (void (*)()) DoNaught ;
X
X#if !defined(HFT_HACKS)
X	coveringWindow =
X		ObscureEntireScreen( ibm8514ScreenInfoStruct.ibm_Screen ) ;
X#else /* erik's hft hack */
X	if ( saveBits )
X		ibmSaveScreenData( pScreen, ppcSaveAreas ) ;
X#endif
X
X	/* Fields in the ppcScrnPriv Structure */
X	ibm8514ScrnPriv.blit = (void (*)()) DoNaught ;
X	ibm8514ScrnPriv.solidFill = (void (*)()) DoNaught ;
X	ibm8514ScrnPriv.tileFill = (void (*)()) DoNaught ;
X	ibm8514ScrnPriv.stipFill = (void (*)()) DoNaught ;
X	ibm8514ScrnPriv.opstipFill = (void (*)()) DoNaught ;
X	ibm8514ScrnPriv.imageFill = (void (*)()) DoNaught ;
X	ibm8514ScrnPriv.imageRead = (void (*)()) DoNaught ;
X	ibm8514ScrnPriv.lineBres = (void (*)()) DoNaught ;
X	ibm8514ScrnPriv.lineHorz = (void (*)()) DoNaught ;
X	ibm8514ScrnPriv.lineVert = (void (*)()) DoNaught ;
X	ibm8514ScrnPriv.setColor = (void (*)()) DoNaught ;
X	ibm8514ScrnPriv.RecolorCursor = (void (*)()) DoNaught ;
X	ibm8514ScrnPriv.monoFill = (void (*)()) DoNaught ;
X	ibm8514ScrnPriv.glyphFill = (void (*)()) DoNaught ;
X	ibm8514ScrnPriv.planeRead = (unsigned long int *(*)()) DoNaught ;
X	ibm8514ScrnPriv.replicateArea = (void (*)()) DoNaught ;
X	ibm8514ScrnPriv.DestroyGCPriv = (void (*)()) DoNaught ;
X	ibm8514ScrnPriv.CheckCursor = (int (*)()) DoNaught ;
X	ibm8514ScrnPriv.ReplaceCursor = (void (*)()) DoNaught ;
X
X	/* Make the list of cached fonts */
X	ibm8514CreateSavedFontList() ;
X
X	ibm8514ScreenInfoStruct.ibm_ScreenState = SCREEN_INACTIVE ;
X	ibm8514Disabled = 1 ;
X}
Xelse if ( ibm8514ScreenInfoStruct.ibm_ScreenState == SCREEN_INACTIVE ) {
X	ErrorF(
X	  "ibm8514SuspendScreenAndSave: ibm8514 State Is Already Inactive!" ) ;
X}
Xelse if ( ibm8514ScreenInfoStruct.ibm_ScreenState == SCREEN_UNINITIALIZED ) {
X	ErrorF( "ibm8514SuspendScreenAndSave: ibm8514 Still uninitialized!" ) ;
X}
X
Xreturn ;
X}
X
X#if !defined(HFT_HACKS)
Xvoid
Xibm8514RestoreScreenAndActivate( index )
Xint index ;
X#else /* erik's hft hack */
Xibm8514RestoreScreenAndActivate( pScreen, restoreBits )
XScreenPtr pScreen ;
Xint restoreBits ;
X#endif
X{
XColormapPtr currentColormap ;
X
Xif ( ibm8514ScreenInfoStruct.ibm_ScreenState == SCREEN_INACTIVE ) {
X
X#if defined(ibm032) && defined(BSDrt)
X	(void) ioctl( ibm8514FD, BUFINIT8514, 0 ) ;
X#else
X#ifdef i386
X        /* Nothing Yet */
X#else
X	********* ERROR ********
X#endif
X#endif
X	ibm8514InitializeHardwareState() ;
X	/* Magic Hardware Initialization */
X	ibm8514outw( ibm8514_MiscIO, 0x0005 ) ;
X
X	/* Re-enable Cursor Fields in the ibmPerScreenInfo Structure */
X	ibm8514ScreenInfoStruct.ibm_HideCursor = ibm8514RemoveCursor ;
X	ibm8514ScreenInfoStruct.ibm_CursorShow = ibm8514ShowCursor ;
X
X	/* Now Re-Enable any screen writes by restoring the screen-priv */
X	currentColormap = ibm8514ScrnPriv.InstalledColormap ;
X	ibm8514ScrnPriv = savedibm8514ScrnPriv ;
X
X	/* Now Re-Realize any Cache-able Fonts !! */
X
X	/* Now We Are Free to Draw Again !! */
X	ibm8514Disabled = 0 ;
X#if !defined(HFT_HACKS)
X	FreeResource( coveringWindow->drawable.id, RT_NONE ) ;
X	coveringWindow = (WindowPtr) 0 ;
X#else /* erik's hft hack */
X	if ( restoreBits )
X		ibmRestoreScreenData( pScreen, ppcRestoreAreas ) ;
X#endif
X
X	/* Now Reinstall the current Colormap !! */
X	ppcInstallColormap( currentColormap ) ;
X
X	if ( !--ibm8514cursorSemaphore && CursorWasActive )
X		ibm8514ReplaceCursor() ;
X
X	ibm8514ScreenInfoStruct.ibm_ScreenState = SCREEN_ACTIVE ;
X#if !defined(HFT_HACKS)
X	ibm8514RestoreOffScreenFonts( ibmScreen( index ) ) ;
X#else /* erik's hft hack */
X	ibm8514RestoreOffScreenFonts( pScreen ) ;
X#endif
X}
Xelse if ( ibm8514ScreenInfoStruct.ibm_ScreenState == SCREEN_ACTIVE ) {
X	ErrorF(
X	  "ibm8514SuspendScreenAndSave: ibm8514 State Is Still Active!" ) ;
X}
Xelse if ( ibm8514ScreenInfoStruct.ibm_ScreenState == SCREEN_UNINITIALIZED ) {
X	ErrorF( "ibm8514SuspendScreenAndSave: ibm8514 Still uninitialized!" ) ;
X}
X
Xreturn ;
X}
END-of-ibm8514/brcSuspScr.c
echo x - ibm8514/brcText.c
sed 's/^X//' >ibm8514/brcText.c << 'END-of-ibm8514/brcText.c'
X/*
X * Copyright IBM Corporation 1987,1990
X *
X * All Rights Reserved
X *
X * Permission to use, copy, modify, and distribute this software and its
X * documentation for any purpose and without fee is hereby granted,
X * provided that the above copyright notice appear in all copies and that 
X * both that copyright notice and this permission notice appear in
X * supporting documentation, and that the name of IBM not be
X * used in advertising or publicity pertaining to distribution of the
X * software without specific, written prior permission.
X *
X * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
X * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
X * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
X * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
X * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
X * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
X * SOFTWARE.
X *
X*/
X/*
X * PRPQ 5799-PFF (C) COPYRIGHT IBM CORPORATION 1987,1990
X * LICENSED MATERIALS - PROPERTY OF IBM
X * REFER TO COPYRIGHT INSTRUCTIONS FORM NUMBER G120-2083
X */
X/*
X *  Hardware interface routines for IBM 8514/A adapter for
X *  X.11 server(s) on IBM equipment.
X *
X */
X/* $Header:
/andrew/X11/r3src/r3plus/server/ddx/ibm/ibm8514/RCS/brcText.c,v 6.4
89/05/18 15:05:05 jeff Exp $ */
X/* $Source:
/andrew/X11/r3src/r3plus/server/ddx/ibm/ibm8514/RCS/brcText.c,v $ */
X
X#ifndef lint
Xstatic char *rcsid = "$Header:
/andrew/X11/r3src/r3plus/server/ddx/ibm/ibm8514/RCS/brcText.c,v 6.4
89/05/18 15:05:05 jeff Exp $";
X#endif
X
X/* Draw character glyphs on the screen, knowing that they have been
X * cached offscreen.  Worry about traditional X clipping and such.
X * 
X * You may wonder why I figure the background rectangle size every
X * time this is called, rather than just multiplying some font-specific
X * char size times the number of glyphs and using that.  The protocol
X * evidently has other views of this issue, so we do what it says;
X * the protocol is the bible here.  If the glyphs vary widely in size,
X * we come through with flying colors. (figuratively)
X * 
X */
X#include	"X.h"
X#include	"Xproto.h"
X#include	"fontstruct.h"
X#include	"dixfontstr.h"
X#include	"gcstruct.h"
X#include	"windowstr.h"
X#include	"scrnintstr.h"
X#include	"pixmapstr.h"
X#include	"regionstr.h"
X
X#include	"mfb.h"
X
X#include	"OScompiler.h"
X
X#include	"ppc.h"
X
X#include	"x8514.h"
X#include 	"brcFonts.h"
X
X#include	"ibmTrace.h"
X
Xextern int ibm8514Disabled ;
X
Xextern ibm8514FontCacheRec ibm8514FontCacheEntry[];
Xextern int ibm8514cursorSemaphore ;
Xextern int mfbGCPrivateIndex ;
X
Xstatic unsigned int
XmiWidth(n, charinfo)
X    register unsigned int n;
X    register CharInfoPtr charinfo[];
X{
X    register unsigned int w = 0;
X
X    while ( n-- )
X	w += charinfo[n]->metrics.characterWidth ;
X
X    return w;
X}
X
Xstatic int 
Xibm8514CachedPolyText( pDraw, pGC, x, y, count, chars, fontEncoding)
X    DrawablePtr pDraw;
X    GCPtr	pGC;
X    int		x, y;
X    int		count;
X    char	*chars;
X    FontEncoding fontEncoding;
X{
X    CharInfoPtr 	*ppci;
X    ExtentInfoRec 	info;
X    RegionPtr		prgnClip, pCC;
X    int			CursorIsSaved,i, alu ;
X    unsigned long int	rPM, wPM ;
X    int			index, nbox, x0, y0;
X    unsigned long int	fg ;
X    ScreenPtr		pscr;
X    FontPtr		pFont;
X    InstalledFontPtr	pInFont;
X    InstalledCharPtr	pChar;
X    xRectangle		backrect;
X    BoxRec		*pbox, bbox, cbox;
X    xCharInfo		*pBig, *pMetrics;
X    int			maxw, maxh, charoffset, lineoffset;
X    int			charFirst, charLast;
X    unsigned short 	*chars16 = (unsigned short *) chars;
X
XpCC = ((ppcPrivGC *)pGC->devPrivates[mfbGCPrivateIndex].ptr)->pCompositeClip;
Xif ( !( nbox = REGION_NUM_RECTS(pCC) ) )
X	return 0 ;
Xpbox = REGION_RECTS(pCC);
X
Xpscr = pGC->pScreen;
XpFont = pGC->font;
Xindex = pscr->myNum;
XpInFont = (InstalledFontPtr) pFont->devPriv[index];
XrPM = ibm8514FontCacheEntry[pInFont->CacheIndex].RPlaneMask;
X
Xalu = pGC->alu;
XwPM = pGC->planemask;
Xfg  = pGC->fgPixel;
X  
Xx += pDraw->x;
Xy += pDraw->y;
X
Xlineoffset = pInFont->startline;
XcharFirst  = charoffset = pInFont->firstchar;
XcharLast   = pInFont->lastchar;
X
Xppci = (CharInfoPtr *) ALLOCATE_LOCAL(count*sizeof(CharInfoPtr));
Xswitch ( fontEncoding)
X	{
X		{
X		for (i = 0 ; i <count; i++) 
X			if ( (charFirst <= chars16[i]) &&  
X	     		(charLast  >= chars16[i]) )
X	   		then	ppci[i] = pInFont->
X					ppCharacter[chars16[i]-charoffset]->
X					pInfo;
X	   		else 	{ i--; count--; } /* ignore this character */
X		break;
X		}
X		for (i = 0 ; i <count; i++) 
X			if ( (charFirst <= chars[i]) &&  
X	     		(charLast  >= chars[i]) )
X	   		then	ppci[i] = pInFont->
X					ppCharacter[chars[i]-charoffset]->
X					pInfo;
X	   		else 	{ i--; count--; } /* ignore this character */
X		break;
X		ErrorF("ibm8514CachedPolyText: bad font encoding");
X		return 0;
X	}
X
XQueryGlyphExtents(pFont,ppci,count,&info);
XDEALLOCATE_LOCAL(ppci);
X
Xbackrect.x = x + info.overallLeft;
Xbackrect.y = y - pFont->pFI->fontAscent;
Xbackrect.width = info.overallRight - info.overallLeft;
Xbackrect.width = MAX( backrect.width, info.overallWidth );
Xbackrect.height = pFont->pFI->fontAscent + pFont->pFI->fontDescent;
X
XpBig = &(pFont->pFI->maxbounds.metrics);
Xmaxw = count * (pBig->rightSideBearing - pBig->leftSideBearing);
Xmaxh =  (pBig->ascent + pBig->descent);
X
XCursorIsSaved = !ibm8514cursorSemaphore
X     && ( ibm8514CheckCursor( backrect.x, backrect.y,
X			      backrect.width, backrect.height )
X/* if fonts are correct, the next line may get deleted someday */
X       || ibm8514CheckCursor(x, y, maxw, maxh) ) ;
Xibm8514cursorSemaphore++ ;
X
Xbbox.x1 = x + info.overallLeft;
Xbbox.y1 = y - info.overallAscent;
Xbbox.x2 = x + info.overallRight;
Xbbox.y2 = y + info.overallDescent;
X
Xswitch ( (*pscr->RectIn)(pCC, &bbox))
X	{
X		break;
X		while ( count--)
X			{
X			if (fontEncoding == Linear8Bit)
X				index = *chars++ - charoffset;
X			   else index = *chars16++ - charoffset;
X
X			pChar=(InstalledCharPtr)pInFont->ppCharacter[index];
X			pMetrics = (xCharInfo *)(&(pChar->pInfo->metrics));
X			if (pChar->pInfo->exists)
X				{
X				x0 = x + pMetrics->leftSideBearing;
X				y0 = y - pMetrics->ascent;
Xif ( !ibm8514Disabled )
X				ibm8514BlitFG(rPM,wPM,fg,alu,
X					pChar->x, lineoffset + pChar->y, 
X					x0, y0, pChar->w, pChar->h);
X				}
X			x += pMetrics->characterWidth;
X			}	 
X		break;
X		prgnClip = (*(pscr->RegionCreate))((BoxRec *)NULL,1);
X		while ( count--)
X			{
X			index = *chars++ - charoffset;
X			pChar=(InstalledCharPtr)pInFont->ppCharacter[index];
X			pMetrics = (xCharInfo *)(&(pChar->pInfo->metrics));
X			if (pChar->pInfo->exists)
X				{
X				cbox.x1 = x0 = x + pMetrics->leftSideBearing;
X				cbox.y1 = y0 = y - pMetrics->ascent;
X				cbox.x2 = cbox.x1 + pChar->w;
X				cbox.y2 = cbox.y1 + pChar->h;
X
X				switch ( (*pscr->RectIn)(pCC, &cbox))
X					{
X						break;
Xif ( !ibm8514Disabled )
X						ibm8514BlitFG(rPM,wPM,fg,alu,
X							pChar->x, 
X							lineoffset+pChar->y, 
X							x0, y0, 
X							pChar->w, pChar->h);
X						break;
X						(*(pscr->RegionReset))(
X						   prgnClip, &cbox);
X						(*(pscr->Intersect))(
X						   prgnClip,prgnClip,pCC);
X						pbox = REGION_RECTS(prgnClip);
X						nbox = REGION_NUM_RECTS(prgnClip);
X						if (nbox==0) break;
Xif ( !ibm8514Disabled )
X						for (i = 0 ; i <nbox; i++, pbox++)
X							{
X							ibm8514ClearQueue(4);
X							SETXMIN(pbox->x1);
X							SETYMIN(pbox->y1);
X							SETXMAX(pbox->x2-1);
X							SETYMAX(pbox->y2-1);
X							ibm8514BlitFG(
X								rPM,
X								wPM,
X								fg,
X								alu,
X								pChar->x, 
X								lineoffset +
X								pChar->y, 
X								x0, 
X								y0, 
X								pChar->w, 
X								pChar->h);
X							}
Xif ( !ibm8514Disabled ) {
X						ibm8514ClearQueue(4);
X						SETXMIN(0);
X						SETYMIN(0);
X						SETXMAX(_8514_SCREENWIDTH-1);
X						SETYMAX( 1023 );
X}
X						break;
X					} /* end second switch */
X				}
X			x += pMetrics->characterWidth;
X			}
X		(*(pscr->RegionDestroy))(prgnClip);
X		break;
X	}/* end main switch */
Xif ( !(--ibm8514cursorSemaphore) && CursorIsSaved )
X	ibm8514ReplaceCursor();
X
Xreturn x- pDraw->x;
X}
X
Xstatic int
Xibm8514CachedImageText( pDraw, pGC, x, y, count, chars, fontEncoding)
X    DrawablePtr pDraw;
X    GCPtr	pGC;
X    int		x, y;
X    int		count;
X    char	*chars;
X    FontEncoding fontEncoding;
X{
X    CharInfoPtr 	*ppci;
X    ExtentInfoRec 	info;
X    RegionPtr		prgnClip, pCC;
X    int			CursorIsSaved,i ;
X    unsigned long int	rPM, wPM ;
X    int			index, nbox, x0, y0;
X    unsigned long int	fg, bg;
X    ScreenPtr		pscr;
X    FontPtr		pFont;
X    InstalledFontPtr	pInFont;
X    InstalledCharPtr	pChar;
X    xRectangle		backrect;
X    BoxRec		*pbox, bbox, cbox;
X    xCharInfo		*pBig, *pMetrics;
X    int			maxw, maxh, charoffset, lineoffset;
X    int			charFirst, charLast;
X    unsigned short 	*chars16 = (unsigned short *) chars;
X
X
XpCC = ((ppcPrivGC *)pGC->devPrivates[mfbGCPrivateIndex].ptr)->pCompositeClip;
Xif ( !( nbox = REGION_NUM_RECTS(pCC) ) )
X	return 0 ;
Xpbox = REGION_RECTS(pCC);
X
Xpscr = pGC->pScreen;
XpFont = pGC->font;
Xindex = pscr->myNum;
XpInFont = (InstalledFontPtr) pFont->devPriv[index];
XrPM = ibm8514FontCacheEntry[pInFont->CacheIndex].RPlaneMask;
X
XwPM = pGC->planemask;
Xbg  = pGC->bgPixel;
Xfg  = pGC->fgPixel;
X  
Xx += pDraw->x;
Xy += pDraw->y;
X
Xlineoffset = pInFont->startline;
XcharFirst  = charoffset = pInFont->firstchar;
XcharLast   = pInFont->lastchar;
X
X
Xppci = (CharInfoPtr *) ALLOCATE_LOCAL(count*sizeof(CharInfoPtr));
Xswitch ( fontEncoding)
X	{
X		{
X		for (i = 0 ; i <count; i++) 
X			if ( (charFirst <= chars16[i]) &&  
X	     		(charLast  >= chars16[i]) )
X	   		then	ppci[i] = pInFont->
X					ppCharacter[chars16[i]-charoffset]->
X					pInfo;
X	   		else 	{ i--; count--; } /* ignore this character */
X		break;
X		}
X		for (i = 0 ; i <count; i++) 
X			if ( (charFirst <= chars[i]) &&  
X	     		(charLast  >= chars[i]) )
X	   		then	ppci[i] = pInFont->
X					ppCharacter[chars[i]-charoffset]->
X					pInfo;
X	   		else 	{ i--; count--; } /* ignore this character */
X		break;
X		ErrorF("ibm8514CachedImageText: bad font encoding");
X		return 0;
X	}
X
XQueryGlyphExtents(pFont,ppci,count,&info);
XDEALLOCATE_LOCAL(ppci);
X
Xbackrect.x = x + info.overallLeft;
Xbackrect.y = y - pFont->pFI->fontAscent;
Xbackrect.width = info.overallRight - info.overallLeft;
Xbackrect.width = MAX( backrect.width, info.overallWidth );
Xbackrect.height = pFont->pFI->fontAscent + pFont->pFI->fontDescent;
X
XpBig = &(pFont->pFI->maxbounds.metrics);
Xmaxw = count * (pBig->rightSideBearing - pBig->leftSideBearing);
Xmaxh =  (pBig->ascent + pBig->descent);
X
XCursorIsSaved = !ibm8514cursorSemaphore
X     && ( ibm8514CheckCursor( backrect.x, backrect.y,
X			      backrect.width, backrect.height )
X/* if fonts are correct, the next line may get deleted someday */
X       || ibm8514CheckCursor(x, y, maxw, maxh) ) ;
Xibm8514cursorSemaphore++ ;
X
Xif ( !ibm8514Disabled ) {
Xfor ( i = 0 ; i <nbox; i++, pbox++)
X	{
X	ibm8514ClearQueue(4);
X	SETXMIN(pbox->x1);
X	SETYMIN(pbox->y1);
X	SETXMAX(pbox->x2-1);
X	SETYMAX(pbox->y2-1);
X	ibm8514DrawRectangle(bg,GXcopy,wPM, backrect.x, backrect.y,
X				backrect.width, backrect.height);
X	}
Xibm8514ClearQueue(4);
XSETXMIN(0);
XSETYMIN(0);
XSETXMAX(_8514_SCREENWIDTH-1);
XSETYMAX( 1023 );
X}
X
Xbbox.x1 = x + info.overallLeft;
Xbbox.y1 = y - info.overallAscent;
Xbbox.x2 = x + info.overallRight;
Xbbox.y2 = y + info.overallDescent;
X
Xswitch ( (*pscr->RectIn)(pCC, &bbox))
X	{
X		break;
X		while (count--)
X			{
X				/* 2d16bit already bombed */
X			if (fontEncoding == Linear8Bit)
X				index = *chars++ - charoffset;
X			   else index = *chars16++ - charoffset;
X
X			pChar=(InstalledCharPtr)pInFont->ppCharacter[index];
X			pMetrics = (xCharInfo *)(&(pChar->pInfo->metrics));
X			if (pChar->pInfo->exists)
X				{
X				x0 = x + pMetrics->leftSideBearing;
X				y0 = y - pMetrics->ascent;
Xif ( !ibm8514Disabled )
X				ibm8514BlitFG(rPM,wPM,fg,GXcopy,
X					pChar->x, lineoffset + pChar->y, 
X					x0, y0, pChar->w, pChar->h);
X				}
X			x += pMetrics->characterWidth;
X			}	 
X		break;
X		prgnClip = (*(pscr->RegionCreate))((BoxRec *)NULL,REGION_NUM_RECTS(pCC));
X		while ( count--)
X			{
X			index = *chars++ - charoffset;
X			pChar=(InstalledCharPtr)pInFont->ppCharacter[index];
X			pMetrics = (xCharInfo *)(&(pChar->pInfo->metrics));
X			if (pChar->pInfo->exists)
X				{
X				cbox.x1 = x0 = x + pMetrics->leftSideBearing;
X				cbox.y1 = y0 = y - pMetrics->ascent;
X				cbox.x2 = cbox.x1 + pChar->w;
X				cbox.y2 = cbox.y1 + pChar->h;
X
X				switch ( (*pscr->RectIn)(pCC, &cbox))
X					{
X						break;
Xif ( !ibm8514Disabled )
X						ibm8514BlitFG(rPM,wPM,fg,GXcopy,
X							pChar->x, 
X							lineoffset+pChar->y, 
X							x0, y0, 
X							pChar->w, pChar->h);
X						break;
X						(*(pscr->RegionReset))(
X						   prgnClip,&cbox);
X						(*(pscr->Intersect))(
X						   prgnClip,prgnClip,pCC);
X						pbox = REGION_RECTS(prgnClip);
X						nbox = REGION_NUM_RECTS(prgnClip);
X						if (nbox==0) break;
Xif ( !ibm8514Disabled ) {
X						for (i = 0 ; i <nbox; i++, pbox++)
X							{
X							ibm8514ClearQueue(4);
X							SETXMIN(pbox->x1);
X							SETYMIN(pbox->y1);
X							SETXMAX(pbox->x2-1);
X							SETYMAX(pbox->y2-1);
X							ibm8514BlitFG(
X								rPM,
X								wPM,
X								fg,
X								GXcopy,
X								pChar->x, 
X								lineoffset +
X								pChar->y, 
X								x0, 
X								y0, 
X								pChar->w, 
X								pChar->h);
X							}
X						ibm8514ClearQueue(4);
X						SETXMIN(0);
X						SETYMIN(0);
X						SETXMAX(_8514_SCREENWIDTH-1);
X						SETYMAX( 1023 );
X}
X						break;
X					} /* end second switch */
X				}
X			x += pMetrics->characterWidth;
X			}
X		(*(pscr->RegionDestroy))(prgnClip);
X		break;
X	}/* end main switch */
Xif ( !(--ibm8514cursorSemaphore) && CursorIsSaved )
X	ibm8514ReplaceCursor();
X
Xreturn x - pDraw->x;
X}
X
Xstatic int
Xibm8514PolyText(pDraw, pGC, x, y, count, chars, fontEncoding )
X    DrawablePtr pDraw;
X    GCPtr	pGC;
X    int		x, y;
X    int		count;
X    char 	*chars;
X    FontEncoding fontEncoding;
X{
X    CharInfoPtr *charinfo;
X    unsigned int n, w = 0;
X
Xswitch ( (long) pGC->font->devPriv[pDraw->pScreen->myNum] )
X	{
X		break;
X		switch (pGC->fillStyle )
X			{
X				return ibm8514CachedPolyText(pDraw, pGC, 
X					x, y, count, chars, fontEncoding);
X				return ibm8514StipCachedText( pDraw, pGC, 
X					x, y, count, chars, fontEncoding);
X				break;
X			}
X	}
X
Xif ( !(charinfo = (CharInfoPtr *)ALLOCATE_LOCAL(
X		count*sizeof(CharInfoPtr ))))
X	return x ;
XGetGlyphs(pGC->font, count, chars, fontEncoding, &n, charinfo);
Xif ( n ) {
X	w = miWidth(n, charinfo);
X	(*pGC->ops->PolyGlyphBlt)(
X	pDraw, pGC, x, y, n, charinfo, pGC->font->pGlyphs);
X}
X
XDEALLOCATE_LOCAL(charinfo);
Xreturn x + w ;
X}
X
Xstatic int
Xibm8514ImageText(pDraw, pGC, x, y, count, chars, fontEncoding)
X    DrawablePtr pDraw;
X    GCPtr	pGC;
X    int 	x, y;
X    int 	count;
X    char 	*chars;
X    FontEncoding fontEncoding;
X{
XCharInfoPtr *charinfo;
Xunsigned int n, w = 0;
X
Xswitch ( (long) pGC->font->devPriv[pDraw->pScreen->myNum] )
X	{
X    		if ( !(charinfo = (CharInfoPtr *)ALLOCATE_LOCAL(
X				count*sizeof(CharInfoPtr ))))
X			return x ;
X    		GetGlyphs(pGC->font, count, chars, fontEncoding, &n, charinfo);
X    		if ( n ) {
X    			w = miWidth(n, charinfo);
X        		(*pGC->ops->ImageGlyphBlt)(
X	    		pDraw, pGC, x, y, n, charinfo, pGC->font->pGlyphs);
X		}
X		
X    		DEALLOCATE_LOCAL(charinfo);
X    		return x + w ;
X	}
Xreturn ibm8514CachedImageText(pDraw, pGC, x, y, count, chars, fontEncoding);
X}
X
Xint
Xibm8514PolyText8(pDraw, pGC, x, y, count, chars)
X    DrawablePtr pDraw;
X    GCPtr	pGC;
X    int		x, y;
X    int 	count;
X    char	*chars;
X{
X    return ibm8514PolyText(pDraw, pGC, x, y, count, chars, Linear8Bit);
X}
X
Xint
Xibm8514PolyText16(pDraw, pGC, x, y, count, chars)
X    DrawablePtr pDraw;
X    GCPtr	pGC;
X    int		x, y;
X    int		count;
X    unsigned short *chars;
X{
Xreturn ibm8514PolyText( pDraw, pGC, x, y, count, (char *)chars,
X			( (pGC->font->pFI->lastRow == 0)
X			? Linear16Bit : TwoD16Bit ) ) ;
X}
X
Xvoid
Xibm8514ImageText8(pDraw, pGC, x, y, count, chars)
X    DrawablePtr pDraw;
X    GCPtr	pGC;
X    int		x, y;
X    int		count;
X    char	*chars;
X{
X    ibm8514ImageText(pDraw, pGC, x, y, count, chars, Linear8Bit);
X}
X
Xvoid
Xibm8514ImageText16(pDraw, pGC, x, y, count, chars)
X    DrawablePtr pDraw;
X    GCPtr	pGC;
X    int		x, y;
X    int		count;
X    unsigned short *chars;
X{
Xibm8514ImageText( pDraw, pGC, x, y, count, (char *)chars,
X			( (pGC->font->pFI->lastRow == 0)
X			? Linear16Bit : TwoD16Bit ) ) ;
Xreturn ;
X}
X
Xstatic int 
Xibm8514StipCachedText( pDraw, pGC, x, y, count, chars, fontEncoding)
X    DrawablePtr pDraw;
X    GCPtr	pGC;
X    int		x, y;
X    int		count;
X    char	*chars;
X    FontEncoding fontEncoding;
X{
X    CharInfoPtr 	*ppci;
X    ExtentInfoRec 	info;
X    RegionPtr		prgnDst, pCC;
X    int			CursorIsSaved,i, alu ;
X    unsigned long int	rPM, wPM ;
X    int			index, nbox, x0, y0, icount;
X    char*               ichars = chars;
X    unsigned long int	fg , bg;
X    ScreenPtr		pscr;
X    FontPtr		pFont;
X    InstalledFontPtr	pInFont;
X    InstalledCharPtr	pChar;
X    BoxRec		*pbox, bbox ;
X    xCharInfo		*pBig, *pMetrics;
X    int			maxw, maxh, charoffset, lineoffset;
X    int			charFirst, charLast;
X    unsigned short 	*chars16 = (unsigned short *) chars;
X    int			stageX, stageY;
X    void		GetStippleOnStage();
X
XpCC = ((ppcPrivGC *)pGC->devPrivates[mfbGCPrivateIndex].ptr)->pCompositeClip;
X
Xpscr = pGC->pScreen;
XpFont = pGC->font;
Xindex = pscr->myNum;
XpInFont = (InstalledFontPtr) pFont->devPriv[index];
XrPM = ibm8514FontCacheEntry[pInFont->CacheIndex].RPlaneMask;
X
Xx += pDraw->x;
Xy += pDraw->y;
X
Xif (!( REGION_NUM_RECTS(pCC))) return x- pDraw->x;
Xif ((alu = pGC->alu) == GXnoop) return x- pDraw->x;
XwPM = pGC->planemask;
Xfg  = pGC->fgPixel;
Xbg  = pGC->bgPixel;
X
Xlineoffset = pInFont->startline;
XcharFirst  = charoffset = pInFont->firstchar;
XcharLast   = pInFont->lastchar;
X
Xppci = (CharInfoPtr *) ALLOCATE_LOCAL(count*sizeof(CharInfoPtr));
Xswitch ( fontEncoding)
X	{
X		{
X		for (i = 0 ; i <count; i++) 
X			if ( (charFirst <= chars16[i]) &&  
X	     		(charLast  >= chars16[i]) )
X	   		then	ppci[i] = pInFont->
X					ppCharacter[chars16[i]-charoffset]->
X					pInfo;
X	   		else 	{ i--; count--; } /* ignore this character */
X		break;
X		}
X		for (i = 0 ; i <count; i++) 
X			if ( (charFirst <= chars[i]) &&  
X	     		(charLast  >= chars[i]) )
X	   		then	ppci[i] = pInFont->
X					ppCharacter[chars[i]-charoffset]->
X					pInfo;
X	   		else 	{ i--; count--; } /* ignore this character */
X		break;
X		ErrorF("ibm8514CachedPolyText: bad font encoding");
X		return 0;
X	}
X
XQueryGlyphExtents(pFont,ppci,count,&info);
XDEALLOCATE_LOCAL(ppci);
X
XpBig = &(pFont->pFI->maxbounds.metrics);
Xmaxw = count * (pBig->rightSideBearing - pBig->leftSideBearing);
Xmaxh =  (pBig->ascent + pBig->descent);
X
Xbbox.x1 = x + info.overallLeft;
Xbbox.y1 = y - info.overallAscent;
Xbbox.x2 = x + info.overallRight;
Xbbox.y2 = y + info.overallDescent;
X
X
XprgnDst = (* pscr->RegionCreate )( &bbox, REGION_NUM_RECTS(pCC)) ;
X(* pscr->Intersect)( prgnDst, prgnDst, pCC ) ;
X
Xif (!( REGION_NUM_RECTS(prgnDst)))
X	return x- pDraw->x;
X
XCursorIsSaved = !ibm8514cursorSemaphore
X     && ( ibm8514CheckCursor( bbox.x1, bbox.y1,
X			      bbox.x2 - bbox.x1, bbox.x2 - bbox.x1 )
X/* if fonts are correct, the next line may get deleted someday */
X       || ibm8514CheckCursor(x, y, maxw, maxh) ) ;
Xibm8514cursorSemaphore++ ;
X
Xswitch (pGC->fillStyle)
X	{
X		stageX = 0;
X		stageY = MONO_STAGE_Y + info.overallAscent;
X		GetStippleOnStage(pGC, &bbox);
X		icount = count;
X		while ( icount--)
X			{
X			if (fontEncoding == Linear8Bit)
X				index = *chars++ - charoffset;
X	   		else index = *chars16++ - charoffset;
X		
X			pChar=(InstalledCharPtr)pInFont->ppCharacter[index];
X			pMetrics = (xCharInfo *)(&(pChar->pInfo->metrics));
X			if ((pChar->pInfo->exists) && 
X					(stageX+x+pChar->w >= bbox.x1))
X				{
X				x0 = stageX + pMetrics->leftSideBearing;
X				y0 = stageY - pMetrics->ascent;
Xif ( !ibm8514Disabled )
X				ibm8514BlitFGBG(
X					rPM, MONO_STAGE_WPLANE,
X					255,0,GXandInverted,
X					pChar->x, lineoffset + pChar->y, 
X					x0, y0, 
X					pChar->w, pChar->h);
X				}
X			stageX += pMetrics->characterWidth;
X			if (stageX + x > bbox.x2) break;
X			}	 
Xif ( !ibm8514Disabled )
X		for (nbox = REGION_NUM_RECTS(prgnDst), pbox = REGION_RECTS(prgnDst);
X				nbox--;
X				pbox++)
X			{
X			x0 = pbox->x1;
X			y0 = pbox->y1;
X			ibm8514BlitFG(
X				MONO_STAGE_RPLANE, wPM, bg, alu,
X				MONO_STAGE_X + x0 - x,
X				stageY +y0-y,
X				x0, y0,
X				pbox->x2 - x0,
X				pbox->y2 - y0 );
X			}
X
X		/* fall through to do the foreground */
X		stageX = 0;
X		stageY = MONO_STAGE_Y + info.overallAscent;
Xif ( !ibm8514Disabled )
X		GetStippleOnStage(pGC, &bbox);
X		icount = count;
X		if (fontEncoding == Linear8Bit)
X			chars = ichars;
X	   	else chars16 = (unsigned int*)ichars;
X		while ( icount--)
X			{
X			if (fontEncoding == Linear8Bit)
X				index = *chars++ - charoffset;
X	   		else index = *chars16++ - charoffset;
X		
X			pChar=(InstalledCharPtr)pInFont->ppCharacter[index];
X			pMetrics = (xCharInfo *)(&(pChar->pInfo->metrics));
X			if ((pChar->pInfo->exists) && 
X					(stageX+x+pChar->w >= bbox.x1))
X				{
X				x0 = stageX + pMetrics->leftSideBearing;
X				y0 = stageY - pMetrics->ascent;
Xif ( !ibm8514Disabled )
X				ibm8514BlitFGBG(
X					rPM, MONO_STAGE_WPLANE,
X					255,0,GXand,
X					pChar->x, lineoffset + pChar->y, 
X					x0, y0, 
X					pChar->w, pChar->h);
X				}
X			stageX += pMetrics->characterWidth;
X			if (stageX + x > bbox.x2) break;
X			}	 
Xif ( !ibm8514Disabled )
X		for (nbox = REGION_NUM_RECTS(prgnDst), pbox = REGION_RECTS(prgnDst);
X				nbox--;
X				pbox++)
X			{
X			x0 = pbox->x1;
X			y0 = pbox->y1;
X			ibm8514BlitFG(
X				MONO_STAGE_RPLANE, wPM, fg, alu,
X				MONO_STAGE_X + x0 - x,
X				stageY +y0-y,
X				x0, y0,
X				pbox->x2 - x0,
X				pbox->y2 - y0 );
X			}
X
X		break;
X	}
Xif ( !(--ibm8514cursorSemaphore) && CursorIsSaved )
X	ibm8514ReplaceCursor();
X
Xreturn x- pDraw->x;
X}
X
X
Xstatic void
XGetStippleOnStage(pGC, pbox)
XGCPtr	pGC;
XBoxRec *pbox;
X{
XPixmapPtr 	pStipple;
Xregister int j;
Xint tlx, tly, boxW, boxH, drawW, drawH, grow;
Xint hoffset, voffset, vremaining, hremaining;
Xint xSrc, ySrc;
X
XpStipple = pGC->stipple;
X
Xtlx = pStipple->drawable.width;
Xtly = pStipple->drawable.height;
XxSrc = pGC->patOrg.x;
XySrc = pGC->patOrg.y;
X
XboxH = pbox->y2 - pbox->y1;
XboxW = pbox->x2 - pbox->x1;
XdrawW = MIN(boxW, tlx);
XdrawH = MIN(boxH, tly);
X
Xif ((hoffset = ((pbox->x1-xSrc)%tlx)) < 0)
X		hoffset += tlx;
Xhremaining = tlx-hoffset;
X
Xif ((voffset = ((pbox->y1-ySrc)%tly)) < 0)
X		voffset += tly;
Xvremaining = tly-voffset;
X
X#define FILL_STAGE_X 0
X#define FILL_STAGE_Y 802
Xif (hoffset)
X	{
X	ibm8514AlignMonoImage(FILL_STAGE_WPLANE, GXcopy,
X			FILL_STAGE_X, FILL_STAGE_Y,
X			tlx, drawH, pStipple->devPrivate.ptr );
X	/* LOWER RIGHT RECTANGLE */
X        ibm8514Bitblt
X                (
X                GXcopy, RPLANE1, MONO_STAGE_WPLANE,
X                FILL_STAGE_X+hoffset, FILL_STAGE_Y+voffset,
X                MONO_STAGE_X, MONO_STAGE_Y,
X                MIN(hremaining,drawW), MIN(vremaining,drawH)
X                );
X
X        /* LOWER LEFT RECTANGLE */
X        if (drawW > hremaining)
X        ibm8514Bitblt
X                (
X                GXcopy, RPLANE1, MONO_STAGE_WPLANE,
X                FILL_STAGE_X, FILL_STAGE_Y+voffset,
X                MONO_STAGE_X+hremaining, MONO_STAGE_Y,
X                drawW-hremaining, MIN(vremaining,drawH)
X                );
X
X        /* UPPER RIGHT RECTANGLE */
X        if (drawH > vremaining)
X            {
X            ibm8514Bitblt
X                (
X                GXcopy, RPLANE1, MONO_STAGE_WPLANE,
X                FILL_STAGE_X+hoffset, FILL_STAGE_Y,
X                MONO_STAGE_X, MONO_STAGE_Y+vremaining,
X                MIN(hremaining,drawW), drawH - vremaining
X                );
X
X        /* UPPER LEFT RECTANGLE */
X            if (drawW > hremaining)
X                ibm8514Bitblt
X                        (
X                        GXcopy, RPLANE1, MONO_STAGE_WPLANE,
X                        FILL_STAGE_X, FILL_STAGE_Y,
X                        MONO_STAGE_X+hremaining, MONO_STAGE_Y+vremaining,
X                        drawW-hremaining, drawH-vremaining
X                        );
X	     }
X	}
X   else {
X	if (voffset)
X		{
X		j = MIN(vremaining,drawH); 
X		ibm8514AlignMonoImage(MONO_STAGE_WPLANE, GXcopy,
X			MONO_STAGE_X, MONO_STAGE_Y,
X			tlx, j,
X			pStipple->devPrivate.ptr +
X				voffset*pStipple->devKind);
X		if (j<drawH)
X			ibm8514AlignMonoImage(MONO_STAGE_WPLANE, GXcopy,
X				MONO_STAGE_X, MONO_STAGE_Y + j,
X				tlx, drawH-j,
X				pStipple->devPrivate.ptr );
X			
X		}
X	   else ibm8514AlignMonoImage(MONO_STAGE_WPLANE, GXcopy,
X			MONO_STAGE_X, MONO_STAGE_Y,
X			tlx, drawH, pStipple->devPrivate.ptr );
X	}
Xwhile (  drawW < boxW)
X	{
X	grow = MIN(drawW, boxW-drawW);
X	ibm8514Bitblt(GXcopy,MONO_STAGE_RPLANE, MONO_STAGE_WPLANE,
X		0, MONO_STAGE_Y,
X		drawW, MONO_STAGE_Y,
X		grow, drawH);
X	drawW += grow;
X	}
Xwhile ( drawH < boxH)
X	{
X	grow = MIN(drawH, boxH-drawH);
X	ibm8514Bitblt(GXcopy,MONO_STAGE_RPLANE, MONO_STAGE_WPLANE,
X		0, MONO_STAGE_Y,
X		0, drawH,
X		drawW, grow);
X	drawH += grow;
X	}
X
Xreturn ;
X}
END-of-ibm8514/brcText.c
exit

mlewis@dolphin.tcspa.ibm.com (Mark S. Lewis) (03/13/90)

Subject: IBM 8514 source code (part 6 of 6) for X11 Release 4
Index: ../mit/server/ddx/ibm/ibm8514

Description:	
IBM has decided to provide X11 source code for the 8514 display
adapter.  This is the same code used to build the object files
included in the X11 Release 4 distribution.  This code supports
servers for both AIX and IBM/4.3 on their respective platforms.

	V1.32_kit.1	59,103 Bytes
	V1.32_kit.2	61,796 Bytes
	V1.32_kit.3	60,982 Bytes
	V1.32_kit.4	62,729 Bytes
	V1.32_kit.5	54,871 Bytes
	V1.32_kit.6	29,170 Bytes

Installation:	
This code is provided in a 6-part shell archive.  Before you
install it, you should save your current code.  You should save
the Imakefile in the ibm server directory.  You also should save
the entire ibm8514 directory by moving and remaking it.

	cd ../mit/server/ddx/ibm
	cp Imakefile Imakefile.orig
	mv ibm8514 ibm8514.orig
	mkdir ibm8514
	
Next, edit this header from each part, and feed the rest to
/bin/sh.  Proceed to make the server as instructed in the
X11 release notes.

	sh < V1.32_kit.6

=====-----     Mark S. Lewis, IBM AWD Palo Alto    -----======
inet: mlewis%ibmsupt@uunet.uu.net		(415) 855-4486
uucp: uunet!ibmsupt!mlewis              IBM Tie Line: 465-4486

# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
#
#	ibm8514/brcTile.c
#	ibm8514/brcUtils.c
#	ibm8514/ibm8514reg.h
#	ibm8514/x8514.h
#
echo x - ibm8514/brcTile.c
sed 's/^X//' >ibm8514/brcTile.c << 'END-of-ibm8514/brcTile.c'
X/*
X * Copyright IBM Corporation 1987,1990
X *
X * All Rights Reserved
X *
X * Permission to use, copy, modify, and distribute this software and its
X * documentation for any purpose and without fee is hereby granted,
X * provided that the above copyright notice appear in all copies and that 
X * both that copyright notice and this permission notice appear in
X * supporting documentation, and that the name of IBM not be
X * used in advertising or publicity pertaining to distribution of the
X * software without specific, written prior permission.
X *
X * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
X * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
X * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
X * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
X * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
X * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
X * SOFTWARE.
X *
X*/
X/*
X * PRPQ 5799-PFF (C) COPYRIGHT IBM CORPORATION 1987,1990
X * LICENSED MATERIALS - PROPERTY OF IBM
X * REFER TO COPYRIGHT INSTRUCTIONS FORM NUMBER G120-2083
X */
X/*
X *  Hardware interface routines for IBM 8514/A adapter for
X *  X.11 server(s) on IBM equipment.
X *
X */
X/* $Header:
/andrew/X11/r3src/r3plus/server/ddx/ibm/ibm8514/RCS/brcTile.c,v 6.3
89/05/07 15:09:49 paul Exp $ */
X/* $Source:
/andrew/X11/r3src/r3plus/server/ddx/ibm/ibm8514/RCS/brcTile.c,v $ */
X
X#ifndef lint
Xstatic char *rcsid = "$Header:
/andrew/X11/r3src/r3plus/server/ddx/ibm/ibm8514/RCS/brcTile.c,v 6.3
89/05/07 15:09:49 paul Exp $" ;
X#endif
X
X/* Tile an area with a pixmap image.
X *
X */
X#include "X.h"
X#include "misc.h"
X#include "gcstruct.h"
X#include "pixmapstr.h"
X
X#include "OScompiler.h"
X
X#include "x8514.h"
X
X#include "ibmTrace.h"
X
Xextern int ibm8514cursorSemaphore ;
X
Xvoid
Xibm8514RotateTile( w, h, dx, dy )
Xint w, h, dx, dy ;
X{
X	register int rx, ry ;
X
X	/*THIS IS COMPLETELY OFFSCREEN, SO DISABLE CURSORCHECKING */
X	ibm8514cursorSemaphore++ ;
X
X	rx = w - dx ;
X	ry = h - dy ;
X
X	/* DO BOTTOM RIGHT */
X	/* You definitely want to do this, even if dx==dy==0.
X	   This is to force *something* into the RotatedTile location */
X	ibm8514Bitblt( GXcopy, ibm8514ALLPLANES, ibm8514ALLPLANES,
X			TILE_X + dx, TILE_Y + dy,
X			ROTTILE_X, ROTTILE_Y,
X			rx, ry ) ;
X
X	/* DO TOP RIGHT */
X	if (dy)
X		ibm8514Bitblt( GXcopy, ibm8514ALLPLANES, ibm8514ALLPLANES,
X			TILE_X + dx, TILE_Y,
X			ROTTILE_X, ROTTILE_Y + ry,
X			rx, dy ) ;
X
X	/* DO BOTTOM LEFT */
X	if (dx)
X		{
X		ibm8514Bitblt( GXcopy, ibm8514ALLPLANES, ibm8514ALLPLANES,
X			TILE_X , TILE_Y+dy,
X			ROTTILE_X+rx, ROTTILE_Y,
X			dx, ry ) ;
X
X	/* DO TOP LEFT */
X		if (dy)
X		ibm8514Bitblt( GXcopy,  ibm8514ALLPLANES, ibm8514ALLPLANES,
X			TILE_X , TILE_Y,
X			ROTTILE_X+rx, ROTTILE_Y+ry,
X			dx, dy ) ;
X		}
X
X	/* set things back the way you found them */
X	ibm8514cursorSemaphore-- ;
X
X	return ;
X}
X
Xvoid
Xibm8514TileRect( pTile, merge, planes, x, y, w, h, xSrc, ySrc )
XPixmapPtr pTile ;
Xint merge ;
Xunsigned long int planes ;
Xint x ;
Xint y ;
Xint w ;
Xint h ;
Xint xSrc ;
Xint ySrc ;
X{
Xint htarget, tlx, tly ;
Xint maxhite, maxwid ;
Xint CursorIsSaved ;
Xint tmp_w, tw, th, hoffset, voffset ;
X
XTRACE( (
"ibm8514TileRect(pTile=x%x,merge=x%x,planes=x%02x,x=%d,y=%d,w=%d,h=%d,xS
rc=%d,ySrc=%d\n",
X	pTile, merge, planes, x, y, w, h, xSrc, ySrc ) ) ;
X
Xx = MAX(0,x) ;
Xy = MAX(0,y) ;
Xw = MIN(_8514_SCREENWIDTH-x,w) ;
Xh = MIN(_8514_SCREENHEIGHT-y,h) ;
X
Xif ( (w <= 0) || (h <= 0) )
X	return ;
X
X/* trap the trivial cases.  Use ppcrep if you can.  Fall thru to do the hard
X   cases if you have to. */
X
Xswitch ( merge ) {
X		ibm8514DrawRectangle( ibm8514ALLPLANES, merge, planes,
X				      x, y, w, h ) ;
X		return ;
X		ppcTileRect( pTile, merge, planes, x, y, w, h, xSrc, ySrc ) ;
X		return ;
X		tlx = pTile->drawable.width ;
X		tly = pTile->drawable.height ;
X		if ( ( tlx > MAXTILESIZE ) || ( tly > MAXTILESIZE ) ) {
X			ppcTileRect( pTile, merge, planes,
X				     x, y, w, h, xSrc, ySrc ) ;
X			return ;
X		}
X		break ;
X}
X
XCursorIsSaved = !ibm8514cursorSemaphore && ibm8514CheckCursor( x, y, w, h ) ;
Xibm8514cursorSemaphore++ ;
X
X/* ALAS, ALACK, we are going to have to actually draw the silly thing N
X   times.  I won't bother rotating it, I'll just draw to the origin points
X   clipped to the desired box.  It's not clear when this is a win.
X*/
Xibm8514DrawColorImage( TILE_X, TILE_Y, tlx, tly,
X		       pTile->devPrivate.ptr,
X		       pTile->devKind,
X		       GXcopy, ibm8514ALLPLANES ) ;
X
X/*expand the tile to largest available size */
Xmaxwid = MIN( MAXTILESIZE, w ) ;
Xwhile ( tlx << 1 <= maxwid ) {
X	ibm8514Bitblt( GXcopy, ibm8514ALLPLANES, ibm8514ALLPLANES,
X		       TILE_X, TILE_Y, tlx + TILE_X, TILE_Y, tlx, tly ) ;
X	tlx <<= 1 ;
X}
Xmaxhite = MIN( MAXTILESIZE, h ) ;
Xwhile ( tly << 1 <= maxhite ) {
X	ibm8514Bitblt( GXcopy, ibm8514ALLPLANES, ibm8514ALLPLANES,
X		       TILE_X, TILE_Y, TILE_X, TILE_Y + tly, tlx, tly ) ;
X	tly <<= 1 ;
X}
X
Xif ( ( hoffset = ( x - xSrc ) % tlx ) < 0 )
X	hoffset += tlx ;
Xif ( ( voffset = ( y - ySrc ) % tly ) < 0 )
X	voffset += tly ;
X
Xibm8514RotateTile( tlx, tly, hoffset, voffset ) ;
X
Xfor ( ; h ; h -= th, y += th ) {
X	th = MIN( h, tly ) ;
X	for ( htarget = x, tmp_w = w ; tmp_w ; tmp_w -= tw, htarget += tlx )
X		ibm8514Bitblt( merge, ibm8514ALLPLANES, planes,
X			       ROTTILE_X, ROTTILE_Y,
X			       htarget, y,
X			       tw = MIN( tmp_w, tlx ), th ) ;
X}
X
Xif ( !--ibm8514cursorSemaphore && CursorIsSaved )
X	ibm8514ReplaceCursor() ;
X
Xreturn ;
X}
END-of-ibm8514/brcTile.c
echo x - ibm8514/brcUtils.c
sed 's/^X//' >ibm8514/brcUtils.c << 'END-of-ibm8514/brcUtils.c'
X/*
X * Copyright IBM Corporation 1987,1990
X *
X * All Rights Reserved
X *
X * Permission to use, copy, modify, and distribute this software and its
X * documentation for any purpose and without fee is hereby granted,
X * provided that the above copyright notice appear in all copies and that 
X * both that copyright notice and this permission notice appear in
X * supporting documentation, and that the name of IBM not be
X * used in advertising or publicity pertaining to distribution of the
X * software without specific, written prior permission.
X *
X * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
X * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
X * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
X * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
X * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
X * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
X * SOFTWARE.
X *
X*/
X/*
X * PRPQ 5799-PFF (C) COPYRIGHT IBM CORPORATION 1987,1990
X * LICENSED MATERIALS - PROPERTY OF IBM
X * REFER TO COPYRIGHT INSTRUCTIONS FORM NUMBER G120-2083
X */
X/*
X *  Hardware interface routines for IBM 8514/A adapter for
X *  X.11 server(s) on IBM equipment.
X *
X */
X/* $Header:
/andrew/X11/r3src/r3plus/server/ddx/ibm/ibm8514/RCS/brcUtils.c,v 6.4
89/05/07 15:18:57 jeff Exp $ */
X/* $Source:
/andrew/X11/r3src/r3plus/server/ddx/ibm/ibm8514/RCS/brcUtils.c,v $ */
X
X#ifndef lint
Xstatic char *rcsid = "$Header:
/andrew/X11/r3src/r3plus/server/ddx/ibm/ibm8514/RCS/brcUtils.c,v 6.4
89/05/07 15:18:57 jeff Exp $" ;
X#endif
X
X#include "X.h"
X#include "cursorstr.h"
X#include "scrnintstr.h"
X#include "miscstruct.h"
X
X#include "OScompiler.h"
X
X#include "x8514.h"
X#include "ibmTrace.h"
X
Xextern int ibm8514HeadInstalled ;
X
Xint mergexlate[16] ;
X
X/**********************************************************************
********/
X
Xshort
Xibm8514QueryHead()
X{
X
Xswitch ( ibm8514HeadInstalled = ( QCTRL & 0x0070 ) >> 4 )
X	{
X		return PseudoColor ;
X		return GrayScale ;
X	case 0 : /* Temporarily 0 for the 19-inch grayscale tube */
X		return GrayScale ;
X		ErrorF("ibm8514QueryHead: No known head attached. value = %d\n",
X			ibm8514HeadInstalled ) ;
X		return -1 ; /* Ramdom Error Value */
X	}
X/*NOTREACHED*/
X}
X
X/**********************************************************************
********/
X
Xint
Xibm8514QueryPlanes()
X{
Xreturn ( QCTRL & 0x0080 ) ? 8 : 4 ;
X}
X
X/**********************************************************************
********/
X
Xvoid
Xibm8514InitializeHardwareState()
X{
X
XTRACE( ( "ibm8514InitializeHardwareState()\n" ) ) ;
X
X    ibm8514outw( ibm8514_MiscIO, 0 ) ; /* reset 'miscio' */
X    CRTCMODE( 0x0053 ) ; /* reset on */
X    ibm8514SetVideoRegisters() ;
X    CRTCMODE( 0x0033 ) ; /* reset off */
X
X    ibm8514outw( ibm8514_MiscIO,    0x0005 ) ;   /* set 'miscio' */
X    ibm8514outw( ibm8514_Control,   0x9000 ) ;    /* reset brecon */
X    ibm8514outw( ibm8514_SecDecode, 0x5006 ) ;   /* set config */
X    ibm8514outw( ibm8514_Control,   0x400F ) ;    /* set constat */
X
X    ibm8514ATRNotBusy ;
X    ibm8514CheckQueue( 7 ) ;
X    SETCOL0( 0 ) ;
X    SETCOL1( ibm8514ALLPLANES ) ;
X    PLNWENBL( ibm8514ALLPLANES ) ; /* enable all planes for write */
X    PLNRENBL( ibm8514ALLPLANES ) ; /* enable all planes for read */
X    SETFN0( FNCOLOR0, FNREPLACE ) ; /* my routines assume this is true */
X    SETFN1( FNCOLOR1, FNREPLACE ) ; /* my routines assume this is true */
X    SETMODE( M_ONES ) ; /* assumed by this set of routines */
X
X    ibm8514CheckQueue( 6 ) ;
X    SETPAT0( 0 ) ; /* currently, I am not using the Pattern registers */
X    SETPAT1( 0 ) ;
X    SETXMIN( 0 ) ; /* clip */
X    SETYMIN( 0 ) ; /* clip */
X    SETXMAX( _8514_SCREEN_WIDTH - 1 ) ; /* clip */
X    SETYMAX( 1023 ) ; /* clip */
X
X    return ;
X}
X
Xint
Xibm8514ScreenInitHW( index )	/* returns number of planes */
Xregister int index ;
X{
Xregister int planes ;
Xextern void ibm8514osdInit() ; /* defined in ibm8514osd.c */
X
XTRACE( ( "ibm8514ScreenInitHW(index=%d)\n", index ) ) ;
X
X    mergexlate[GXclear]	 	= 0x01 ;
X    mergexlate[GXand] 		= 0x0C ;
X    mergexlate[GXandReverse] 	= 0x0D ;
X    mergexlate[GXcopy] 		= 0x07 ;
X    mergexlate[GXandInverted] 	= 0x0E ;
X    mergexlate[GXnoop] 		= 0x03 ;
X    mergexlate[GXxor] 		= 0x05 ;
X    mergexlate[GXor] 		= 0x0B ;
X    mergexlate[GXnor] 		= 0x0F ;
X    mergexlate[GXequiv] 	= 0x06 ;
X    mergexlate[GXinvert] 	= 0x00 ;
X    mergexlate[GXorReverse] 	= 0x0A ;
X    mergexlate[GXcopyInverted] 	= 0x04 ;
X    mergexlate[GXorInverted] 	= 0x09 ;
X    mergexlate[GXnand] 		= 0x08 ;
X    mergexlate[GXset]	 	= 0x02 ;
X
X    /* ******************** OS-DEPENDANT CALL ******************** */
X    ibm8514osdInit( index ) ; /* defined in ibm8514osd.c */
X    /* Now is the first time the device registers may be referenced legally */
X    if ( !( planes = ibm8514QueryPlanes() ) || ( ibm8514QueryHead() < 0 ) )
X	return 0 ;
X
X    ibm8514InitializeHardwareState() ;
X
X    return planes ;
X}
X
X#if defined(ATR) && defined(BSDrt)
X
X/**********************************************************************
********/
X/*
X *			WARNING!!!!!!!!!!!
X *
X * This routine does byte swapping!!  If you've never encountered this
X * delightful consumer of your time, be careful!  And be glad you're dealing
X * with Intel processors!!!
X *
X * Need to Byte-Swap for RT processor
X */
Xunsigned short
Xibm8514inw(addr)
Xregister unsigned int addr ;
X{
Xregister unsigned long int retval ;
X
Xretval = *( (volatile unsigned long int *) ( addr | WORDADD ) ) ;
Xreturn (unsigned short) ( ((retval&0x0000ff00)>>8) |
((retval&0x000000ff)<<8) ) ;
X}
X#endif
X
X/**********************************************************************
********/
X
X#if defined(DEBUG) && !defined(NDEBUG)
X
X#include <fcntl.h>
X
Xint
Xibm8514LoadPalette(fn)
Xchar *fn ;
X{ int fh,i ;
X  unsigned char block[1024],c,r,g,b,*p ;
X  unsigned int red,green,blue ;
X
X  fh = open(fn,O_RDONLY) ;
X  if (fh<0) { ErrorF("ibm8514LoadPalette: Error opening %s\n",fn) ;
return(-1) ; }
X
X  i = read(fh,block,1024) ;
X  if (i!=1024) {ErrorF("ibm8514LoadPalette: Error reading %s\n",fn)
;return(-1) ;}
X
X  p = block ;
X  for (i=0 ; i<256 ; i++)
X         {
X         c = i ;
X         r = *p++ ;
X         b = *p++ ;  /* note that its RBG, unlike hardware, which is RGB */
X         g = *p++ ;
X         p++ ; /* dummy */
X	red   = ((int)r) ;
X	green = ((int)g) ;
X	blue  = ((int)b) ;
X	red   <<=8 ;
X	green <<=8 ; /* file contents are 8 bits per color */
X	blue  <<=8 ;
X         ibm8514SetColor(c,red,green,blue) ;
X         }
X  (void) close(fh) ;
Xreturn 0 ;
X}
X#endif
END-of-ibm8514/brcUtils.c
echo x - ibm8514/ibm8514reg.h
sed 's/^X//' >ibm8514/ibm8514reg.h << 'END-of-ibm8514/ibm8514reg.h'
X/*
X * Copyright IBM Corporation 1987,1990
X *
X * All Rights Reserved
X *
X * Permission to use, copy, modify, and distribute this software and its
X * documentation for any purpose and without fee is hereby granted,
X * provided that the above copyright notice appear in all copies and that 
X * both that copyright notice and this permission notice appear in
X * supporting documentation, and that the name of IBM not be
X * used in advertising or publicity pertaining to distribution of the
X * software without specific, written prior permission.
X *
X * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
X * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
X * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
X * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
X * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
X * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
X * SOFTWARE.
X *
X*/
X/*
X * PRPQ 5799-PFF (C) COPYRIGHT IBM CORPORATION 1987,1990
X * LICENSED MATERIALS - PROPERTY OF IBM
X * REFER TO COPYRIGHT INSTRUCTIONS FORM NUMBER G120-2083
X */
X/*
X *
X * Hardware interface routines for IBM 8514/A adapter for
X * X.11 server(s) on IBM equipment.
X *
X */
X/* $Header:
/andrew/X11/r3src/release/server/ddx/ibm/ibm8514/RCS/ibm8514reg.h,v 30.0
89/01/23 19:24:09 paul Exp $ */
X/* $Source:
/andrew/X11/r3src/release/server/ddx/ibm/ibm8514/RCS/ibm8514reg.h,v $ */
X
X#if !defined(lint) && !defined(LOCORE) && defined(RCS_HDRS)
Xstatic char *rcsidibm8514reg = "$Header:
/andrew/X11/r3src/release/server/ddx/ibm/ibm8514/RCS/ibm8514reg.h,v 30.0
89/01/23 19:24:09 paul Exp $";
X#endif
X
X/* Magic I/O port addresses */
X#define QSTATADD 	0xDAE8
X#define QCTRLADD 	0x42E8
X
X#if !defined(IBM_OS_HAS_HFT)
X#define PALMASK 	0x42EA
X#define PALREAD_ADDR 	0x42EB
X#define PALWRITE_ADDR 	0x42EC
X#define PALDATA 	0x42ED
X#else /* HFT on Danbury Kernel. Yuk. */
X#define PALMASK 	0x02EA
X#define PALREAD_ADDR 	0x02EB
X#define PALWRITE_ADDR 	0x02EC
X#define PALDATA 	0x02ED
X#endif
X
X#define VARDATA		0xE2E8
X
X/* Register Constants -- Wait on I/O busy */
X#define ibm8514WaitOnIO		0x4000	/* This Does Wait IF busy */
X#define ibm8514_Y0		( 0x82E8 | ibm8514WaitOnIO )
X#define ibm8514_X0		( 0x86E8 | ibm8514WaitOnIO )
X#define ibm8514_Y1		( 0x8AE8 | ibm8514WaitOnIO )
X#define ibm8514_X1		( 0x8EE8 | ibm8514WaitOnIO )
X#define ibm8514_K1		ibm8514_Y1
X#define ibm8514_K2		ibm8514_X1
X#define ibm8514_ErrorAcc	( 0x92E8 | ibm8514WaitOnIO )
X#define ibm8514_LX		( 0x96E8 | ibm8514WaitOnIO )
X#define ibm8514_Qstatus		( 0x9AE8 )
X#define ibm8514_CMD		( ibm8514_Qstatus | ibm8514WaitOnIO )
X#define ibm8514_ShortStroke	( 0x9EE8 | ibm8514WaitOnIO )
X#define ibm8514_Color0		( 0xA2E8 | ibm8514WaitOnIO )
X#define ibm8514_Color1		( 0xA6E8 | ibm8514WaitOnIO )
X#define ibm8514_PlaneWE		( 0xAAE8 | ibm8514WaitOnIO )
X#define ibm8514_PlaneRE		( 0xAEE8 | ibm8514WaitOnIO )
X#define ibm8514_ColorCMP	( 0xB2E8 | ibm8514WaitOnIO )
X#define ibm8514_Func0		( 0xB6E8 | ibm8514WaitOnIO )
X#define ibm8514_Func1		( 0xBAE8 | ibm8514WaitOnIO )
X#define ibm8514_SecDecode	( 0xBEE8 | ibm8514WaitOnIO )
X#define ibm8514_Control		( 0x42E8 )
X#define ibm8514_Status		ibm8514_Control
X#define ibm8514_PromPage	( 0x46E8 )
X#define ibm8514_MiscIO		( 0x4AE8 )
X
X/* Manifest Constants */
X#define IM_DEEP8 	0x01
X#define IM_DEEP4 	0x44
X#define IM_MON0  	0x13	/* clear image */
X#define IM_MON1  	0x23	/* transmorgrified, and twice as big */
X
X#define M_ONES	 	0xA000
X#define M_PATTS  	0xA040
X#define M_VAR	 	0xA080
X#define M_CPYRCT 	0xA0C0
X#define M_ACROSS 	0xA004
X#define M_DEPTH  	0xA000
X#define M_PLFILL  	0xA004
X
X#define FNCOLOR0 	0x0000
X#define FNCOLOR1 	0x0020
X#define FNVAR	 	0x0040
X#define FNCPYRCT 	0x0060
X#define FNREPLACE	0x0007
X#define FNNOP		0x0003
X#define FNAND		0x000C
X#define FNOR		0x000B
X#define FNXOR		0x0005
X#define FNMIN		0x0010
X#define FNMAX		0x0014
X
X#define CLOSE 		ibm8514outw( QCTRLADD, 0 )
X#define FULLSC(C) 	rect( C, 0, 0, 1024, 1024 )
X
X#define IBM8514MAXPLANES 8
X#define ibm8514ALLPLANES ~( ( ~0 ) << IBM8514MAXPLANES )
X
X#define WPLANE0		0x0001
X#define WPLANE1		0x0002
X#define WPLANE2		0x0004
X#define WPLANE3		0x0008
X#define WPLANE4		0x0010
X#define WPLANE5		0x0020
X#define WPLANE6		0x0040
X#define WPLANE7		0x0080
X#define WPLANES		ibm8514ALLPLANES
X
X#define RPLANE0		0x0002
X#define RPLANE1		0x0004
X#define RPLANE2		0x0008
X#define RPLANE3		0x0010
X#define RPLANE4		0x0020
X#define RPLANE5		0x0040
X#define RPLANE6		0x0080
X#define RPLANE7		0x0001
X#define RPLANES		ibm8514ALLPLANES
X
X/* ************************ COMMAND MACROS ************************ */
X#define SETMODE(M)	ibm8514outw( ibm8514_SecDecode, M )
X#define SETCOL0(C)	ibm8514outw( ibm8514_Color0, C )
X#define SETCOL1(C)	ibm8514outw( ibm8514_Color1, C )
X#define SETFN0(C, ALU)	ibm8514outw( ibm8514_Func0, ( ( C ) | ( ALU ) ) )
X#define SETFN1(C, ALU)	ibm8514outw( ibm8514_Func1, ( ( C ) | ( ALU ) ) )
X#define PLNWENBL(C)	ibm8514outw( ibm8514_PlaneWE, C )
X#define PLNRENBL(C)	ibm8514outw( ibm8514_PlaneRE, C )
X#define COLRCOMP(C)	ibm8514outw( ibm8514_ColorCMP, C )
X#define SETVAR(C)	ibm8514outw( VARDATA, C )
X#define GETVAR		ibm8514inw( VARDATA )
X
X#define CRTCMODE(C)  	outb( 0x22E8, C )
X#define MISCIO(C)   	ibm8514outw( ibm8514_MiscIO, C )
X#define SETET(C)   	ibm8514outw( ibm8514_ErrorAcc, C )
X#define SETK1(C)   	ibm8514outw( ibm8514_K1, C )
X#define SETK2(C)   	ibm8514outw( ibm8514_K2, C )
X#define SETY0(C)   	ibm8514outw( ibm8514_Y0, ((C)&0x07FF) )
X#define SETX0(C)   	ibm8514outw( ibm8514_X0, ((C)&0x07FF) )
X#define SETY1(C)   	ibm8514outw( ibm8514_Y1, ((C)&0x07FF) )
X#define SETX1(C)   	ibm8514outw( ibm8514_X1, ((C)&0x07FF) )
X#define SETLX(C)   	ibm8514outw( ibm8514_LX, C )
X#define SETLY(C)   	ibm8514outw( ibm8514_SecDecode, C )
X#define SETXMAX(C)  	ibm8514outw( ibm8514_SecDecode, (((C) & 0x0FFF)|0x4000))
X#define SETXMIN(C)  	ibm8514outw( ibm8514_SecDecode, (((C) & 0x0FFF)|0x2000))
X#define SETYMAX(C)  	ibm8514outw( ibm8514_SecDecode, (((C) & 0x0FFF)|0x3000))
X#define SETYMIN(C)  	ibm8514outw( ibm8514_SecDecode, (((C) & 0x0FFF)|0x1000))
X#define SETPAT0(C)  	ibm8514outw( ibm8514_SecDecode, (((C) & 0x001E)|0x8000))
X#define SETPAT1(C)  	ibm8514outw( ibm8514_SecDecode, (((C) & 0x001E)|0x9000))
X#define COMMAND(C)  	ibm8514outw( QSTATADD, C )
X
X/* ************************ COMMAND DEFINES ************************ */
X/* Bits 15, 14 & 13 are the command selector */
X#define ibm8514cmd_Null		0x0000
X#define ibm8514cmd_Vector	0x2000
X#define ibm8514cmd_HRect	0x4000
X#define ibm8514cmd_VRect	0x6000
X#define ibm8514cmd_FRect	0x8000
X#define ibm8514cmd_OutlDraw	0xA000
X#define ibm8514cmd_CopyRect	0xC000
X#define ibm8514cmd_ILLEGAL	0xE000
X
X/* Bit 12 selects whether the data is byte-swapped */
X#if defined(ATRIO) || defined(PCIO)
X#define ibm8514ByteOrder	0x1000
X#else
X	******** Error ********
X#endif
X
X/* Bits 10 & 11 are always 0 */
X
X/* Bit 9 selects for 8 or 16 bit data */
X#define ibm8514cmd_WordData	0x0000
X#define ibm8514cmd_ByteData	0x0200
X
X/* Bit 8 selects for Fixed or variable Data */
X#define ibm8514cmd_FData	0x0000
X#define ibm8514cmd_VData	0x0100
X
X/* Bits 7, 6 & 5 are the Coded Direction selector */
X#define ibm8514cmd_pXpYpZ	0x00E0
X#define ibm8514cmd_pXpYnZ	0x00C0
X#define ibm8514cmd_pXnYpZ	0x00A0
X#define ibm8514cmd_pXnYnZ	0x0080
X#define ibm8514cmd_nXpYpZ	0x0060
X#define ibm8514cmd_nXpYnZ	0x0040
X#define ibm8514cmd_nXnYpZ	0x0020
X#define ibm8514cmd_nXnYnZ	0x0000
X
X/* Bit 4 deterines if the does anything */
X/* if set to zero the 8514 calculates but doesn't change anything
X * Also if zero no data may be read or written */
X#define ibm8514cmd_DoAccess	0x0010
X#define ibm8514cmd_MoveOnly	0x0000
X
X/* Bit 3 selects if the Coded Direction field is used */
X#define ibm8514cmd_UseCDir	0x0008
X#define ibm8514cmd_DontUseCDir	0x0000
X
X/* Bit 2 selects if the Last Pel is accessed */
X#define ibm8514cmd_LastPelNull	0x0004
X#define ibm8514cmd_UseLastPel	0x0000
X
X/* Bit 1 selects for Actual Pel Accrual */
X#define ibm8514cmd_AccruePels	0x0002
X#define ibm8514cmd_NoAccrue	0x0000
X
X/* Bit 0 selects for Read or Write Data */
X#define ibm8514cmd_Read		0x0000
X#define ibm8514cmd_Write	0x0001
X
X/* ************ Actual COMMAND Bitpattern DEFINES ************ */
X#define ibm8514WriteZData	( ibm8514cmd_HRect \
X				| ibm8514ByteOrder \
X				| ibm8514cmd_ByteData \
X				| ibm8514cmd_VData \
X				| ibm8514cmd_pXpYpZ \
X				| ibm8514cmd_DoAccess \
X				| ibm8514cmd_DontUseCDir \
X				| ibm8514cmd_UseLastPel \
X				| ibm8514cmd_NoAccrue \
X				| ibm8514cmd_Write )
X#define ibm8514ReadZData	( ibm8514cmd_HRect \
X				| ibm8514ByteOrder \
X				| ibm8514cmd_ByteData \
X				| ibm8514cmd_VData \
X				| ibm8514cmd_pXpYpZ \
X				| ibm8514cmd_DoAccess \
X				| ibm8514cmd_DontUseCDir \
X				| ibm8514cmd_UseLastPel \
X				| ibm8514cmd_NoAccrue \
X				| ibm8514cmd_Read )
X
X#define ibm8514WriteXYData	( ibm8514cmd_HRect \
X				| ibm8514ByteOrder \
X				| ibm8514cmd_ByteData \
X				| ibm8514cmd_VData \
X				| ibm8514cmd_pXpYpZ \
X				| ibm8514cmd_DoAccess \
X				| ibm8514cmd_DontUseCDir \
X				| ibm8514cmd_UseLastPel \
X				| ibm8514cmd_AccruePels \
X				| ibm8514cmd_Write )
END-of-ibm8514/ibm8514reg.h
echo x - ibm8514/x8514.h
sed 's/^X//' >ibm8514/x8514.h << 'END-of-ibm8514/x8514.h'
X/*
X * Copyright IBM Corporation 1987,1990
X *
X * All Rights Reserved
X *
X * Permission to use, copy, modify, and distribute this software and its
X * documentation for any purpose and without fee is hereby granted,
X * provided that the above copyright notice appear in all copies and that 
X * both that copyright notice and this permission notice appear in
X * supporting documentation, and that the name of IBM not be
X * used in advertising or publicity pertaining to distribution of the
X * software without specific, written prior permission.
X *
X * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
X * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
X * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
X * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
X * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
X * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
X * SOFTWARE.
X *
X*/
X/*
X * PRPQ 5799-PFF (C) COPYRIGHT IBM CORPORATION 1987,1990
X * LICENSED MATERIALS - PROPERTY OF IBM
X * REFER TO COPYRIGHT INSTRUCTIONS FORM NUMBER G120-2083
X */
X/*
X *
X * Hardware interface routines for IBM 8514/A adapter for
X * X.11 server(s) on IBM equipment.
X *
X */
X/* $Header:
/andrew/X11/r3src/release/server/ddx/ibm/ibm8514/RCS/x8514.h,v 30.0
89/01/23 19:24:45 paul Exp $ */
X/* $Source:
/andrew/X11/r3src/release/server/ddx/ibm/ibm8514/RCS/x8514.h,v $ */
X
X#if !defined(lint) && !defined(LOCORE) && defined(RCS_HDRS)
Xstatic char *rcsidx8514 = "$Header:
/andrew/X11/r3src/release/server/ddx/ibm/ibm8514/RCS/x8514.h,v 30.0
89/01/23 19:24:45 paul Exp $";
X#endif
X
X#if !defined(i386) && !defined(iAPX386) && !defined(iAPX286)
X/* ibm 6152 */
X#ifndef ATR
X#define ATR
X#endif
X#ifndef ATRIO
X#define ATRIO
X#endif
X#ifdef PCIO
X#undef PCIO
X#endif
X
X#else
X/* ibm AIX/386 */
X#ifdef ATR
X#undef ATR
X#endif
X#ifndef PCIO
X#define PCIO
X#endif
X#ifdef ATRIO
X#undef ATRIO
X#endif
X
X#endif
X
X#if defined(ibm032) && defined(BSDrt)
X
X#define SWAP_ADJUST( x ) (x) /* Code originally written for the rt */
X
Xextern unsigned short ibm8514inw() ;
X#define ibm8514outw(port, val16) \
X	outw( port, (((val16 & 0x0000FF00)>>8) | ((val16 & 0x000000FF)<<8)) )
X
X/* The folowing are two magic addresses for the ATR kernel */
X#define BYTEADD 0xD00F0000
X#define WORDADD 0xD00E0000
X
X#else
X#if defined(i386) || defined(iAPX386) || defined(iAPX286)
X
X/* Code originally written for the rt */
X#define SWAP_ADJUST( x ) ((((x)&0xFF)<<8)|(((x)>>8)&0xFF))
X
X#define ibm8514inw( addr ) inw( (addr) )
X#define ibm8514outw(port, val16) outw( (port), (val16) )
X
X#else
X	******** ERROR ********
X#endif
X#endif
X
X/* Memory Reference Portability Macros */
X#include "ibmIOArch.h"
X
X/* Device Register Definitions */
X#include "ibm8514reg.h"
X
X/* Supported display tube types */
X#define HEAD_GRAY1024 	1
X#define HEAD_COLOR1024 	2
X#define HEAD_GRAY640 	5
X#define HEAD_COLOR640 	6
X#define HEAD_NONE 	7
X
X#define HALFQBUF	4
X
X/* Psuedo-Functions for adapter control */
X#define QSTAT ( ibm8514inw( QSTATADD ) )
X#define QCTRL ( ibm8514inw( QCTRLADD ) )
X#define QCSTAT ( ibm8514inw( 0x02E8 ) )
X
X#define ibm8514NotBusy \
X	while ( QSTAT & 0x0200 ) /* Do Nothing */ ;
X
X/* Note N must be < 9, otherwise the result is indeterminate */
X#define ibm8514ClearQueue( numSlots )	\
X	while ( ( 0x0100 >> ( numSlots ) ) & QSTAT ) ;
X
X#if defined(ATRIO) || ( defined(ibm032) && defined(BSDrt) )
X#define ibm8514CheckQueue(N)	/* Noop on 6152 !! */
X#define ibm8514ATRNotBusy 	ibm8514NotBusy
X#else
X#define ibm8514CheckQueue(N)	ibm8514ClearQueue(N)
X#define ibm8514ATRNotBusy 	/* No-op on 386 */
X#endif
X
X#define _8514_SCREENHEIGHT	768
X#define _8514_SCREENWIDTH	1024
X#define _8514_SCREEN_HEIGHT	768
X#define _8514_SCREEN_WIDTH	1024
X
X#define ibm8514MaxCursorWidth	32
X#define ibm8514MaxCursorHeight	32
X#define SAVELOCX 0
X#define SAVELOCY ( _8514_SCREENHEIGHT + 1 )
X#define CUR1LOCX ( SAVELOCX + ibm8514MaxCursorWidth )
X#define CUR1LOCY ( _8514_SCREENHEIGHT + 1 )
X#define CUR0LOCX ( CUR1LOCX + ibm8514MaxCursorWidth )
X#define CUR0LOCY ( _8514_SCREENHEIGHT + 1 )
X#define C1X 		CUR1LOCX
X#define C1Y		( _8514_SCREENHEIGHT + 1 )
X#define C0X		CUR0LOCX
X#define C0Y		( _8514_SCREENHEIGHT + 1 )
X#define SAVEX		SAVELOCX
X#define SAVEY		( _8514_SCREENHEIGHT + 1 )
X#define CURD_X		ibm8514MaxCursorWidth
X#define CURD_Y		ibm8514MaxCursorHeight
X
X#define TILE_X		96
X#define TILE_Y		( _8514_SCREENHEIGHT + 1 )
X#define ROTTILE_X	128
X#define ROTTILE_Y	( _8514_SCREENHEIGHT + 1 )
X#define MAXTILESIZE	32
X
X#define STIPX		0
X#define MAXSTIPPLEWIDTH	( _8514_SCREENWIDTH - STIPX )
X#define STIPY		802
X#define MAXSTIPPLEHEIGHT 220
X#define FILL_STAGE_WPLANE	0x02
X#define FILL_STAGE_RPLANE	0x02
X#define MONO_STAGE_SIZE		200
X#define MONO_STAGE_WPLANE	WPLANE0
X#define MONO_STAGE_RPLANE	RPLANE0
X#define MONO_STAGE_X		0
X#define MONO_STAGE_Y		803
X
X/* Default Colors */
X#define IBM8514_BLACK_PIXEL 0
X#define IBM8514_WHITE_PIXEL 1
X
X/* Name of device file for "unix" ( Not AIX ) */
X#define IBM8514_DEV_FILE "/dev/ibm8514"
X
X/* Tom's stylistic effects */
X#define then
X
X#ifndef TRUE
X#define TRUE -1
X#endif
X
X#ifndef FALSE
X#define FALSE 0
X#endif
END-of-ibm8514/x8514.h
exit