summaryrefslogtreecommitdiff
path: root/Xprint
diff options
context:
space:
mode:
Diffstat (limited to 'Xprint')
-rw-r--r--Xprint/AttrValid.c12
-rw-r--r--Xprint/AttrValid.h15
-rw-r--r--Xprint/DiPrint.h21
-rw-r--r--Xprint/Init.c259
-rw-r--r--Xprint/Oid.c26
-rw-r--r--Xprint/Oid.h3
-rw-r--r--Xprint/OidStrs.h260
-rw-r--r--Xprint/Util.c84
-rw-r--r--Xprint/attributes.c238
-rw-r--r--Xprint/attributes.h54
-rw-r--r--Xprint/ddxInit.c177
-rw-r--r--Xprint/mediaSizes.c28
-rw-r--r--Xprint/pcl/Pcl.h115
-rw-r--r--Xprint/pcl/PclArc.c56
-rw-r--r--Xprint/pcl/PclArea.c129
-rw-r--r--Xprint/pcl/PclColor.c36
-rw-r--r--Xprint/pcl/PclCursor.c53
-rw-r--r--Xprint/pcl/PclGC.c146
-rw-r--r--Xprint/pcl/PclInit.c111
-rw-r--r--Xprint/pcl/PclLine.c96
-rw-r--r--Xprint/pcl/PclMisc.c11
-rw-r--r--Xprint/pcl/PclPixel.c7
-rw-r--r--Xprint/pcl/PclPixmap.c11
-rw-r--r--Xprint/pcl/PclPolygon.c141
-rw-r--r--Xprint/pcl/PclPrint.c80
-rw-r--r--Xprint/pcl/PclSFonts.c12
-rw-r--r--Xprint/pcl/PclSpans.c61
-rw-r--r--Xprint/pcl/PclText.c134
-rw-r--r--Xprint/pcl/PclWindow.c14
-rw-r--r--Xprint/pcl/Pclmap.h214
-rw-r--r--Xprint/ps/Ps.h56
-rw-r--r--Xprint/ps/PsArea.c138
-rw-r--r--Xprint/ps/PsAttVal.c11
-rw-r--r--Xprint/ps/PsAttr.c2
-rw-r--r--Xprint/ps/PsCache.c194
-rw-r--r--Xprint/ps/PsColor.c2
-rw-r--r--Xprint/ps/PsFonts.c9
-rw-r--r--Xprint/ps/PsGC.c6
-rw-r--r--Xprint/ps/PsInit.c61
-rw-r--r--Xprint/ps/PsLine.c1
-rw-r--r--Xprint/ps/PsMisc.c1
-rw-r--r--Xprint/ps/PsPixel.c1
-rw-r--r--Xprint/ps/PsPixmap.c12
-rw-r--r--Xprint/ps/PsPolygon.c3
-rw-r--r--Xprint/ps/PsPrint.c7
-rw-r--r--Xprint/ps/PsSpans.c12
-rw-r--r--Xprint/ps/PsText.c7
-rw-r--r--Xprint/ps/PsWindow.c14
-rw-r--r--Xprint/ps/psout.c43
-rw-r--r--Xprint/ps/psout.h15
-rw-r--r--Xprint/raster/Raster.c103
-rw-r--r--Xprint/raster/Raster.h25
-rw-r--r--Xprint/raster/RasterAttVal.c6
53 files changed, 1688 insertions, 1645 deletions
diff --git a/Xprint/AttrValid.c b/Xprint/AttrValid.c
index 1303701af..83d6b9674 100644
--- a/Xprint/AttrValid.c
+++ b/Xprint/AttrValid.c
@@ -30,13 +30,11 @@ not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from said
copyright holders.
*/
-#include <scrnintstr.h>
+/* $XFree86: xc/programs/Xserver/Xprint/AttrValid.c,v 1.5 2001/12/21 21:02:04 dawes Exp $ */
-#define _XP_PRINT_SERVER_
-#include "extensions/Printstr.h"
-#undef _XP_PRINT_SERVER_
+#include <scrnintstr.h>
-#include "AttrValid.h"
+#include "attributes.h"
/*
* default medium-source-sizes supported = na-letter w/.25" margins
@@ -48,7 +46,7 @@ static XpOidMediumDiscreteSizeList DefaultMediumSizeList = {
&DefaultMediumSize, 1
};
static XpOidMediumSourceSize DefaultMediumSourceSize = {
- xpoid_unspecified, XpOidMediumSS_DISCRETE, &DefaultMediumSizeList
+ xpoid_unspecified, XpOidMediumSS_DISCRETE, { &DefaultMediumSizeList }
};
static XpOidMediumSS DefaultMediumSS = {
&DefaultMediumSourceSize, 1
@@ -300,7 +298,7 @@ XpPutMediumSSAttr(XpContextPtr pContext,
}
const XpOidMediumSS*
-XpGetDefaultMediumSS()
+XpGetDefaultMediumSS(void)
{
return &DefaultMediumSS;
}
diff --git a/Xprint/AttrValid.h b/Xprint/AttrValid.h
index dab3c2def..87ab48b69 100644
--- a/Xprint/AttrValid.h
+++ b/Xprint/AttrValid.h
@@ -30,12 +30,13 @@ not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from said
copyright holders.
*/
+/* $XFree86: xc/programs/Xserver/Xprint/AttrValid.h,v 1.7 2001/12/21 21:02:04 dawes Exp $ */
#ifndef _Xp_AttrValid_h
#define _Xp_AttrValid_h
+#include <X11/extensions/Printstr.h>
#include "Oid.h"
-#include "attributes.h"
#define XpNumber(a) (sizeof(a) / sizeof(*(a)))
@@ -83,6 +84,9 @@ typedef struct
(const char*)XpGetOneAttribute(pContext, pool, (char*)XpOidString(oid))
#define XpPutStringAttr(pContext, pool, oid, value) \
XpPutOneAttribute(pContext, pool, XpOidString(oid), value)
+
+#ifdef _XP_PRINT_SERVER_ /* needed for XpContextPtr in Printstr.h */
+
/*
* XpOid-valued attribute access
*/
@@ -175,7 +179,7 @@ void XpPutMediumSSAttr(XpContextPtr pContext,
XPAttributes pool,
XpOid oid,
const XpOidMediumSS* msss);
-const XpOidMediumSS* XpGetDefaultMediumSS();
+const XpOidMediumSS* XpGetDefaultMediumSS(void);
/*
* XpOidTrayMediumList-valued attribute access
@@ -189,12 +193,15 @@ void XpPutTrayMediumListAttr(XpContextPtr pContext,
XPAttributes pool,
XpOid oid,
const XpOidTrayMediumList* tm);
+BOOL XpOidTrayMediumListHasTray(const XpOidTrayMediumList* list, XpOid tray);
+
/*
* Attribute pool validation
*/
void XpValidateAttributePool(XpContextPtr pContext,
XPAttributes pool,
const XpValidatePoolsRec* vpr);
+void XpValidateNotificationProfile(XpContextPtr pContext);
void XpValidatePrinterPool(XpContextPtr pContext,
const XpValidatePoolsRec* vpr);
void XpValidateJobPool(XpContextPtr pContext,
@@ -203,6 +210,10 @@ void XpValidateDocumentPool(XpContextPtr pContext,
const XpValidatePoolsRec* vpr);
void XpValidatePagePool(XpContextPtr pContext,
const XpValidatePoolsRec* vpr);
+void XpValidatePrinterMediaAttrs(XpContextPtr pContext,
+ const XpOidList* valid_trays,
+ const XpOidList* valid_sizes);
+#endif /* _XP_PRINT_SERVER_ */
#endif /* _Xp_AttrValid_h - don't add anything after this line */
diff --git a/Xprint/DiPrint.h b/Xprint/DiPrint.h
index a4b969141..3830c20d2 100644
--- a/Xprint/DiPrint.h
+++ b/Xprint/DiPrint.h
@@ -30,6 +30,8 @@ not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from said
copyright holders.
*/
+/* $XFree86: xc/programs/Xserver/Xprint/DiPrint.h,v 1.4 2001/01/17 22:36:28 dawes Exp $ */
+
/*
* The XpDiListEntry struct is the type of each element of the array
* handed back to the extension code to handle a GetPrinterList request.
@@ -38,6 +40,11 @@ copyright holders.
* request will allow us to build it with the description in the locale of
* the requesting client.
*/
+#ifndef _XpDiPrint_H_
+#define _XpDiPrint_H_ 1
+
+#include "scrnintstr.h"
+
typedef struct _diListEntry {
char *name;
char *description;
@@ -52,3 +59,17 @@ extern XpDiListEntry **XpDiGetPrinterList(
char *name,
int localeLen,
char *locale);
+
+extern char * XpDiGetDriverName(int index, char *printerName);
+
+extern WindowPtr XpDiValidatePrinter(char *printerName, int printerNameLen);
+
+extern int XprintOptions(int argc, char **argv, int i);
+
+extern void PrinterInitOutput(ScreenInfo *pScreenInfo, int argc, char **argv);
+
+extern void _XpVoidNoop(void);
+
+extern Bool _XpBoolNoop(void);
+
+#endif /* _XpDiPrint_H_ */
diff --git a/Xprint/Init.c b/Xprint/Init.c
index 06757fa77..a022c31c7 100644
--- a/Xprint/Init.c
+++ b/Xprint/Init.c
@@ -50,6 +50,7 @@ copyright holders.
** *********************************************************
**
********************************************************************/
+/* $XFree86: xc/programs/Xserver/Xprint/Init.c,v 1.13 2001/12/21 21:02:04 dawes Exp $ */
#include <unistd.h>
#include <stdlib.h>
@@ -74,53 +75,23 @@ copyright holders.
#include "cursor.h"
#include "misc.h"
#include "windowstr.h"
-#include "scrnintstr.h"
#include "inputstr.h"
#include "gcstruct.h"
#include "fonts/fontstruct.h"
#include "errno.h"
-#define _XP_PRINT_SERVER_
-#include "Printstr.h"
-#undef _XP_PRINT_SERVER_
-
typedef char *XPointer;
+#define HAVE_XPointer 1
+
#define Status int
#include <Xresource.h>
#include "DiPrint.h"
-#include "AttrValid.h"
#include "attributes.h"
-extern char *display; /* display number as a string */
-
-#if 0
-/* extern char *Xalloc(); */
-extern void Xfree();
-/* extern char *Xrealloc(); */
-#else
#include "os.h"
-#endif
-
-extern char *getenv();
-extern void XpAddPrinterAttribute();
-extern char *XpGetConfigDir();
-extern XpContextPtr XpContextOfClient();
-
-/*
-extern int GiveUp();
-*/
-
-extern WindowPtr *WindowTable; /* declared in dix:globals.c */
-
-#if NeedFunctionPrototypes
-
-static void GetDriverFromPrinterName(
- char *printerName,
- char **driverName,
- Bool (**initScreenFunc)());
static void GenericScreenInit(
int index,
ScreenPtr pScreen,
@@ -132,15 +103,6 @@ static Bool InitPrintDrivers(
int argc,
char **argv);
-#else
-
-static void GetDriverFromPrinterName();
-static void GenericScreenInit();
-static Bool InitPrintDrivers();
-
-#endif
-
-
/*
* The following two defines are used to build the name "X*printers", where
* the "*" is replaced by the display number. This is used to construct
@@ -188,7 +150,7 @@ const char *LIST_QUEUES = "LANG=C lpstat -v | "
" print substr($5, 1, x-1)"
" }' | sort";
#else
-#if defined(CSRG_BASED) || defined(linux)
+#if defined(CSRG_BASED) || defined(linux) || defined(ISC) || defined(__GNUC__)
const char *LIST_QUEUES = "LANG=C lpc status | grep -v '^\t' | "
"sed -e /:/s/// | sort";
#else
@@ -209,12 +171,11 @@ const char *LIST_QUEUES = "LANG=C lpstat -v | "
static
PixmapFormatRec RasterPixmapFormats[] = {
- 1, 1, BITMAP_SCANLINE_PAD
+ { 1, 1, BITMAP_SCANLINE_PAD }
};
#define NUMRASTFORMATS (sizeof RasterPixmapFormats)/(sizeof RasterPixmapFormats[0])
-extern Bool InitializeRasterDriver();
-extern XpValidatePoolsRec RasterValidatePoolsRec; /* From RasterAttVal.c */
+#include "raster/Raster.h"
#endif
@@ -222,51 +183,45 @@ extern XpValidatePoolsRec RasterValidatePoolsRec; /* From RasterAttVal.c */
static
PixmapFormatRec ColorPclPixmapFormats[] = {
- 1, 1, BITMAP_SCANLINE_PAD,
- 8, 8, BITMAP_SCANLINE_PAD,
- 24,32, BITMAP_SCANLINE_PAD
+ { 1, 1, BITMAP_SCANLINE_PAD },
+ { 8, 8, BITMAP_SCANLINE_PAD },
+ { 24,32, BITMAP_SCANLINE_PAD }
};
#define NUMCPCLFORMATS (sizeof ColorPclPixmapFormats)/(sizeof ColorPclPixmapFormats[0])
-extern Bool InitializeColorPclDriver();
-extern XpValidatePoolsRec PclValidatePoolsRec;
-
#endif
#ifdef XPMONOPCLDDX
static
PixmapFormatRec MonoPclPixmapFormats[] = {
- 1, 1, BITMAP_SCANLINE_PAD
+ { 1, 1, BITMAP_SCANLINE_PAD }
};
#define NUMMPCLFORMATS (sizeof MonoPclPixmapFormats)/(sizeof MonoPclPixmapFormats[0])
-extern Bool InitializeMonoPclDriver();
-extern XpValidatePoolsRec PclValidatePoolsRec;
+#endif
+#if defined(XPPCLDDX) || defined(XPMONOPCLDDX)
+#include "pcl/Pcl.h"
#endif
#ifdef XPPSDDX
static
PixmapFormatRec PSPixmapFormats[] = {
- 1, 1, BITMAP_SCANLINE_PAD,
- 8, 8, BITMAP_SCANLINE_PAD,
- 24,32, BITMAP_SCANLINE_PAD
+ { 1, 1, BITMAP_SCANLINE_PAD },
+ { 8, 8, BITMAP_SCANLINE_PAD },
+ { 24,32, BITMAP_SCANLINE_PAD }
};
#define NUMPSFORMATS (sizeof PSPixmapFormats)/(sizeof PSPixmapFormats[0])
-extern Bool InitializePsDriver();
-extern XpValidatePoolsRec PsValidatePoolsRec;
+#include "ps/Ps.h"
#endif
-
-typedef Bool (*pBFunc)();
-typedef void (*pVFunc)();
/*
* The driverInitArray contains an entry for each driver the
* server knows about. Each element contains pointers to pixmap formats, the
@@ -375,10 +330,6 @@ static const char configFilePath[] =
static const char printServerConfigDir[] = "XPSERVERCONFIGDIR";
-static int printScreenPrivIndex,
- printWindowPrivIndex,
- printGCPrivIndex;
-static unsigned long printGeneration = 0;
static char *configFileName = (char *)NULL;
static Bool freeDefaultFontPath = FALSE;
static char *origFontPath = (char *)NULL;
@@ -389,12 +340,11 @@ static char *origFontPath = (char *)NULL;
* of the next option to process.
*/
int
-XprintOptions(argc, argv, i)
- int argc;
- char **argv;
- int i;
+XprintOptions(
+ int argc,
+ char **argv,
+ int i)
{
- extern void ddxUseMsg();
if(strcmp(argv[i], "-XpFile") == 0)
{
if ((i + 1) >= argc) {
@@ -427,9 +377,7 @@ static pIFunc
GetInitFunc(driverName)
*/
-static Bool (*
-GetInitFunc(driverName))()
- char *driverName;
+static pBFunc GetInitFunc(char *driverName)
{
driverInitRec *pInitRec;
int numDrivers = sizeof(driverInits)/sizeof(driverInitRec);
@@ -441,7 +389,7 @@ GetInitFunc(driverName))()
return pInitRec->initFunc;
}
- return (Bool(*)())NULL;
+ return 0;
}
static void
@@ -464,17 +412,17 @@ GetDimFuncAndRec(
}
}
- *dimensionsFunc = (pVFunc)NULL;
- *pValRec = (XpValidatePoolsRec *)NULL;
+ *dimensionsFunc = 0;
+ *pValRec = 0;
return;
}
static void
-FreePrinterDb()
+FreePrinterDb(void)
{
PrinterDbPtr pCurEntry, pNextEntry;
- for(pCurEntry = printerDb, pNextEntry = (PrinterDbPtr)NULL;
+ for(pCurEntry = printerDb, pNextEntry = 0;
pCurEntry != (PrinterDbPtr)NULL; pCurEntry = pNextEntry)
{
pNextEntry = pCurEntry->next;
@@ -486,7 +434,7 @@ FreePrinterDb()
*/
xfree(pCurEntry);
}
- printerDb = (PrinterDbPtr)NULL;
+ printerDb = 0;
}
/*
@@ -496,8 +444,7 @@ FreePrinterDb()
* XXX AddPrinterDbName needs to check for (and not add) duplicate names.
*/
static Bool
-AddPrinterDbName(name)
- char *name;
+AddPrinterDbName(char *name)
{
PrinterDbPtr pEntry = (PrinterDbPtr)xalloc(sizeof(PrinterDbEntry));
@@ -519,8 +466,7 @@ AddPrinterDbName(name)
}
static void
-AugmentPrinterDb(command)
- char *command;
+AugmentPrinterDb(const char *command)
{
FILE *fp;
char name[256];
@@ -539,7 +485,7 @@ AugmentPrinterDb(command)
* FreeNameMap frees all remaining memory associated with the nameMap.
*/
static void
-FreeNameMap()
+FreeNameMap(void)
{
NameMapPtr pEntry, pTmp;
@@ -561,9 +507,7 @@ FreeNameMap()
* AddNameMap adds an element to the nameMap linked list.
*/
static Bool
-AddNameMap(name, qualifier)
- char *name;
- char *qualifier;
+AddNameMap(char *name, char *qualifier)
{
NameMapPtr pEntry;
@@ -585,7 +529,7 @@ AddNameMap(name, qualifier)
* is NULLed out.
*/
static void
-MergeNameMap()
+MergeNameMap(void)
{
NameMapPtr pMap;
PrinterDbPtr pDb;
@@ -608,7 +552,7 @@ MergeNameMap()
* each printer in the printerDb.
*/
static void
-CreatePrinterAttrs()
+CreatePrinterAttrs(void)
{
PrinterDbPtr pDb;
@@ -642,7 +586,7 @@ CreatePrinterAttrs()
* the screens.
*/
static void
-StoreDriverNames()
+StoreDriverNames(void)
{
PrinterDbPtr pEntry;
@@ -653,7 +597,7 @@ StoreDriverNames()
"xp-ddx-identifier");
if(pEntry->driverName == (char *)NULL ||
strlen(pEntry->driverName) == 0 ||
- GetInitFunc(pEntry->driverName) == (Bool(*)())NULL)
+ GetInitFunc(pEntry->driverName) == 0)
{
if (pEntry->driverName && (strlen(pEntry->driverName) != 0)) {
ErrorF("Xp Extension: Can't load driver %s\n",
@@ -670,7 +614,7 @@ StoreDriverNames()
}
}
-char *
+static char *
MbStrchr(
char *str,
int ch)
@@ -699,7 +643,7 @@ MbStrchr(
* string must be freed by the caller.
*/
static char *
-GetConfigFileName()
+GetConfigFileName(void)
{
/*
* We need to find the system-wide file, if one exists. This
@@ -711,7 +655,7 @@ GetConfigFileName()
/*
* Check for a LANG-specific file.
*/
- if(dirName = XpGetConfigDir(TRUE))
+ if ((dirName = XpGetConfigDir(TRUE)) != 0)
{
filePath = (char *)xalloc(strlen(dirName) +
strlen(XPRINTERSFILENAME) + 2);
@@ -730,7 +674,7 @@ GetConfigFileName()
xfree(filePath);
}
- if(dirName = XpGetConfigDir(FALSE))
+ if ((dirName = XpGetConfigDir(FALSE)) != 0)
{
filePath = (char *)xalloc(strlen(dirName) +
strlen(XPRINTERSFILENAME) + 2);
@@ -760,9 +704,8 @@ GetConfigFileName()
* XXX
*/
static PrinterDbPtr
-BuildPrinterDb()
+BuildPrinterDb(void)
{
- char *printerList, *augmentCmd = (char *)NULL;
Bool defaultAugment = TRUE, freeConfigFileName;
if(configFileName && access(configFileName, R_OK) != 0)
@@ -789,7 +732,7 @@ BuildPrinterDb()
{
while((tok = strtok((char *)NULL, " \t")) != (char *)NULL)
{
- if(ptr = MbStrchr(tok, '\012'))
+ if ((ptr = MbStrchr(tok, '\012')) != 0)
*ptr = (char)'\0';
AddPrinterDbName(tok);
}
@@ -855,8 +798,7 @@ BuildPrinterDb()
}
static void
-FreeDriverMap(driverMap)
- DriverMapPtr driverMap;
+FreeDriverMap(DriverMapPtr driverMap)
{
DriverMapPtr pCurEntry, pNextEntry;
@@ -882,7 +824,7 @@ FreeDriverMap(driverMap)
* the next rehash or server recycle.
*/
int
-XpRehashPrinterList()
+XpRehashPrinterList(void)
{
PrinterDbPtr pEntry, pPrev;
DriverMapPtr driverMap = (DriverMapPtr)NULL, pDrvEnt;
@@ -1014,7 +956,7 @@ FindFontDir(
return (char *)NULL;
configDir = XpGetConfigDir(TRUE);
- if(fontDir = ValidateFontDir(configDir, modelName))
+ if ((fontDir = ValidateFontDir(configDir, modelName)) != 0)
{
xfree(configDir);
return fontDir;
@@ -1074,10 +1016,10 @@ AddToFontPath(
* and to properly free the modified version upon server recycle.
*/
static void
-AugmentFontPath()
+AugmentFontPath(void)
{
- char *newPath, *modelID, **allIDs = (char **)NULL;
- PrinterDbPtr pDb, pDbEntry;
+ char *modelID, **allIDs = (char **)NULL;
+ PrinterDbPtr pDbEntry;
int numModels, i;
if(!origFontPath)
@@ -1135,7 +1077,7 @@ AugmentFontPath()
for(i = 0; allIDs != (char **)NULL && allIDs[i] != (char *)NULL; i ++)
{
char *fontDir;
- if(fontDir = FindFontDir(allIDs[i]))
+ if ((fontDir = FindFontDir(allIDs[i])) != 0)
{
AddToFontPath(fontDir);
xfree(fontDir);
@@ -1225,7 +1167,7 @@ XpClientIsPrintClient(
* fpe->name.
*/
if(fpe->name_length < PATH_PREFIX_LEN ||
- (strlen(fontDir) != (fpe->name_length - PATH_PREFIX_LEN)) ||
+ (strlen(fontDir) != (unsigned)(fpe->name_length - PATH_PREFIX_LEN)) ||
strncmp(fontDir, fpe->name + PATH_PREFIX_LEN,
fpe->name_length - PATH_PREFIX_LEN))
{
@@ -1237,9 +1179,7 @@ XpClientIsPrintClient(
}
static void
-AddFormats(pScreenInfo, driverName)
- ScreenInfo *pScreenInfo;
- char *driverName;
+AddFormats(ScreenInfo *pScreenInfo, char *driverName)
{
int i, j;
driverInitRec *pInitRec;
@@ -1290,10 +1230,10 @@ AddFormats(pScreenInfo, driverName)
************************************************************/
void
-PrinterInitOutput(pScreenInfo, argc, argv)
- ScreenInfo *pScreenInfo;
- int argc;
- char **argv;
+PrinterInitOutput(
+ ScreenInfo *pScreenInfo,
+ int argc,
+ char **argv)
{
PrinterDbPtr pDb, pDbEntry;
int driverCount = 0, i;
@@ -1454,11 +1394,11 @@ PrinterInitOutput(pScreenInfo, argc, argv)
* screen.
*/
static Bool
-InitPrintDrivers(index, pScreen, argc, argv)
- int index;
- ScreenPtr pScreen;
- int argc;
- char **argv;
+InitPrintDrivers(
+ int index,
+ ScreenPtr pScreen,
+ int argc,
+ char **argv)
{
PrinterDbPtr pDb, pDb2;
@@ -1479,7 +1419,7 @@ InitPrintDrivers(index, pScreen, argc, argv)
}
if(callInit == TRUE)
{
- Bool (*initFunc)();
+ pBFunc initFunc;
initFunc = GetInitFunc(pDb->driverName);
if(initFunc(index, pScreen, argc, argv) == FALSE)
{
@@ -1492,13 +1432,13 @@ InitPrintDrivers(index, pScreen, argc, argv)
}
void
-_XpVoidNoop()
+_XpVoidNoop(void)
{
return;
}
Bool
-_XpBoolNoop()
+_XpBoolNoop(void)
{
return TRUE;
}
@@ -1510,16 +1450,15 @@ _XpBoolNoop()
*/
static void
-GenericScreenInit( index, pScreen, argc, argv )
- int index;
- ScreenPtr pScreen;
- int argc;
- char **argv;
+GenericScreenInit(
+ int index,
+ ScreenPtr pScreen,
+ int argc,
+ char **argv)
{
- int i;
float fWidth, fHeight, maxWidth, maxHeight;
unsigned short width, height;
- PrinterDbPtr pDb, pDb2;
+ PrinterDbPtr pDb;
int res, maxRes;
/*
@@ -1543,7 +1482,6 @@ GenericScreenInit( index, pScreen, argc, argv )
{
if(pDb->screenNum == index)
{
-
XpValidatePoolsRec *pValRec;
pVFunc dimensionsFunc;
@@ -1582,9 +1520,9 @@ GenericScreenInit( index, pScreen, argc, argv )
* freeing the associated memory.
*/
static char *
-QualifyName(fileName, searchPath)
- char *fileName;
- char *searchPath;
+QualifyName(
+ char *fileName,
+ char *searchPath)
{
char * curPath = searchPath;
char * nextPath;
@@ -1632,11 +1570,11 @@ QualifyName(fileName, searchPath)
* XXX "localeName" elements of the XpDiListEntry to the specified locale.
*/
static void
-FillPrinterListEntry(pEntry, pDb, localeLen, locale)
- XpDiListEntry *pEntry;
- PrinterDbPtr pDb;
- int localeLen;
- char *locale;
+FillPrinterListEntry(
+ XpDiListEntry *pEntry,
+ PrinterDbPtr pDb,
+ int localeLen,
+ char *locale)
{
static char *localeStr = (char *)NULL;
@@ -1659,18 +1597,19 @@ FillPrinterListEntry(pEntry, pDb, localeLen, locale)
*
*/
static Bool
-GetPrinterListInfo(pEntry, nameLen, name, localeLen, locale)
- XpDiListEntry *pEntry;
- int nameLen;
- char *name;
- int localeLen;
- char *locale;
+GetPrinterListInfo(
+ XpDiListEntry *pEntry,
+ int nameLen,
+ char *name,
+ int localeLen,
+ char *locale)
{
- PrinterDbPtr pDb, pDb2;
+ PrinterDbPtr pDb;
for(pDb = printerDb; pDb != (PrinterDbPtr)NULL; pDb = pDb->next)
{
- if(strlen(pDb->name) == nameLen && !strncmp(pDb->name, name, nameLen))
+ if (strlen(pDb->name) == (unsigned)nameLen
+ && !strncmp(pDb->name, name, nameLen))
{
FillPrinterListEntry(pEntry, pDb, localeLen, locale);
return TRUE;
@@ -1684,8 +1623,7 @@ GetPrinterListInfo(pEntry, nameLen, name, localeLen, locale)
* for a printer list.
*/
void
-XpDiFreePrinterList(list)
- XpDiListEntry **list;
+XpDiFreePrinterList(XpDiListEntry **list)
{
int i;
@@ -1705,18 +1643,18 @@ XpDiFreePrinterList(list)
* the information for all printers is desired.
*/
XpDiListEntry **
-XpDiGetPrinterList(nameLen, name, localeLen, locale)
- int nameLen;
- char *name;
- int localeLen;
- char *locale;
+XpDiGetPrinterList(
+ int nameLen,
+ char *name,
+ int localeLen,
+ char *locale)
{
XpDiListEntry **pList;
if(!nameLen || name == (char *)NULL)
{
int i;
- PrinterDbPtr pDb, pDb2;
+ PrinterDbPtr pDb;
for(pDb = printerDb, i = 0; pDb != (PrinterDbPtr)NULL;
pDb = pDb->next, i++)
@@ -1763,17 +1701,14 @@ XpDiGetPrinterList(nameLen, name, localeLen, locale)
}
WindowPtr
-XpDiValidatePrinter(printerName, printerNameLen)
- char *printerName;
- int printerNameLen;
+XpDiValidatePrinter(char *printerName, int printerNameLen)
{
PrinterDbPtr pCurEntry;
- WindowPtr pWin;
for(pCurEntry = printerDb;
pCurEntry != (PrinterDbPtr)NULL; pCurEntry = pCurEntry->next)
{
- if(strlen(pCurEntry->name) == printerNameLen &&
+ if(strlen(pCurEntry->name) == (unsigned)printerNameLen &&
!strncmp(pCurEntry->name, printerName, printerNameLen))
return WindowTable[pCurEntry->screenNum];
}
@@ -1786,9 +1721,7 @@ XpDiValidatePrinter(printerName, printerNameLen)
* on the specified screen.
*/
char *
-XpDiGetDriverName(index, printerName)
- int index;
- char *printerName;
+XpDiGetDriverName(int index, char *printerName)
{
PrinterDbPtr pCurEntry;
diff --git a/Xprint/Oid.c b/Xprint/Oid.c
index 3fe926c00..ac0e54434 100644
--- a/Xprint/Oid.c
+++ b/Xprint/Oid.c
@@ -30,11 +30,9 @@ not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from said
copyright holders.
*/
-#include <stdio.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include "Oid.h"
-#include <X11/Xfuncs.h> /* for memmove */
+/* $XFree86: xc/programs/Xserver/Xprint/Oid.c,v 1.5 2001/10/28 03:32:53 tsi Exp $ */
+
+#include "attributes.h"
/*
* XpOidNotify value strings
@@ -753,7 +751,7 @@ XpOidLinkedListFirstOid(XpOidLinkedList* me)
XpOid
XpOidLinkedListNextOid(XpOidLinkedList* me)
{
- if(me->current ? me->current = me->current->next : xFalse)
+ if(me->current ? (me->current = me->current->next) != 0 : xFalse)
return me->current->oid;
else
return xpoid_none;
@@ -1654,8 +1652,6 @@ TrayMediumListValidate(XpOidTrayMediumList* me,
const XpOidMediumSS* msss)
{
int i_mss, i_ds, i_itm;
- XpOidMediumDiscreteSizeList* ds_list;
- int tray_count;
XpOid current_tray, current_medium;
XpOidMediumDiscreteSizeList* unspecified_tray_ds;
XpOidMediumDiscreteSizeList* tray_ds;
@@ -1715,6 +1711,7 @@ TrayMediumListValidate(XpOidTrayMediumList* me,
* list
*/
if(tray_ds == (XpOidMediumDiscreteSizeList*)NULL)
+ {
if(unspecified_tray_ds == (XpOidMediumDiscreteSizeList*)NULL)
{
/*
@@ -1725,7 +1722,10 @@ TrayMediumListValidate(XpOidTrayMediumList* me,
continue;
}
else
+ {
tray_ds = unspecified_tray_ds;
+ }
+ }
/*
* loop through the discrete sizes list, looking for a size that
* matches the medium for the current input tray
@@ -2107,15 +2107,13 @@ const char* XpOidNotifyString(XpOidNotify notify)
{
switch(notify)
{
+ default:
case XPOID_NOTIFY_UNSUPPORTED:
return (const char*)NULL;
- break;
case XPOID_NOTIFY_NONE:
return NOTIFY_NONE_STR;
- break;
case XPOID_NOTIFY_EMAIL:
return NOTIFY_EMAIL_STR;
- break;
}
}
@@ -2240,7 +2238,7 @@ XpOidDocFmtNext(XpOidDocFmt* doc_fmt,
const char* first_nonws_ptr;
const char* format;
const char* variant;
- const char* version;
+ const char* version = 0;
int format_len;
int variant_len;
int version_len;
@@ -2553,10 +2551,12 @@ XpOidDocFmtListHasFmt(const XpOidDocFmtList* list,
* variants must both be NULL or match
*/
if(fmt->variant == (char*)NULL)
+ {
if(list->list[i].variant == (char*)NULL)
return xTrue;
else
continue;
+ }
if(list->list[i].variant == (char*)NULL)
continue;
if(strcmp(fmt->variant, list->list[i].variant) != 0)
@@ -2565,10 +2565,12 @@ XpOidDocFmtListHasFmt(const XpOidDocFmtList* list,
* versions must both be NULL or match
*/
if(fmt->version == (char*)NULL)
+ {
if(list->list[i].version == (char*)NULL)
return xTrue;
else
continue;
+ }
if(list->list[i].version == (char*)NULL)
continue;
if(strcmp(fmt->version, list->list[i].version) == 0)
diff --git a/Xprint/Oid.h b/Xprint/Oid.h
index 70bd8d3e5..c5574b06e 100644
--- a/Xprint/Oid.h
+++ b/Xprint/Oid.h
@@ -30,6 +30,7 @@ not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from said
copyright holders.
*/
+/* $XFree86: xc/programs/Xserver/Xprint/Oid.h,v 1.4 2001/01/17 22:36:28 dawes Exp $ */
#ifndef _Xp_Oid_h
#define _Xp_Oid_h
@@ -205,7 +206,7 @@ char* XpOidListString(const XpOidList*);
/*
* XpOidLinkedList public methods
*/
-XpOidLinkedList* XpOidLinkedListNew();
+XpOidLinkedList* XpOidLinkedListNew(void);
void XpOidLinkedListDelete(XpOidLinkedList*);
#define XpOidLinkedListCount(l) ((l) ? (l)->count : 0)
XpOid XpOidLinkedListGetOid(XpOidLinkedList* list, int i);
diff --git a/Xprint/OidStrs.h b/Xprint/OidStrs.h
index 81119378c..3aab300dc 100644
--- a/Xprint/OidStrs.h
+++ b/Xprint/OidStrs.h
@@ -30,136 +30,140 @@ not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from said
copyright holders.
*/
-/* This is an automatically-generated file. Do not edit. */
+/* $XFree86: xc/programs/Xserver/Xprint/OidStrs.h,v 1.5 2001/12/21 21:02:05 dawes Exp $ */
static int XpOidStringMapCount = 127;
+#define OIDATA(name) { name, sizeof(name)-1, 0, 0, 0 }
+
static const XpOidStringMapEntry XpOidStringMap[] = {
- { "", 0 },
- { "", 0 },
- { "descriptor", 10 },
- { "content-orientation", 19 },
- { "copy-count", 10 },
- { "default-printer-resolution", 26 },
- { "default-input-tray", 18 },
- { "default-medium", 14 },
- { "document-format", 15 },
- { "plex", 4 },
- { "xp-listfonts-modes", 18 },
- { "job-name", 8 },
- { "job-owner", 9 },
- { "notification-profile", 20 },
- { "xp-setup-state", 14 },
- { "xp-spooler-command-options", 26 },
- { "content-orientations-supported", 30 },
- { "document-formats-supported", 26 },
- { "dt-pdm-command", 14 },
- { "input-trays-medium", 18 },
- { "medium-source-sizes-supported", 29 },
- { "plexes-supported", 16 },
- { "printer-model", 13 },
- { "printer-name", 12 },
- { "printer-resolutions-supported", 29 },
- { "xp-embedded-formats-supported", 29 },
- { "xp-listfonts-modes-supported", 28 },
- { "xp-page-attributes-supported", 28 },
- { "xp-raw-formats-supported", 24 },
- { "xp-setup-proviso", 16 },
- { "document-attributes-supported", 29 },
- { "job-attributes-supported", 24 },
- { "locale", 6 },
- { "multiple-documents-supported", 28 },
- { "available-compression", 21 },
- { "available-compressions-supported", 32 },
- { "portrait", 8 },
- { "landscape", 9 },
- { "reverse-portrait", 16 },
- { "reverse-landscape", 17 },
- { "iso-a0", 6 },
- { "iso-a1", 6 },
- { "iso-a2", 6 },
- { "iso-a3", 6 },
- { "iso-a4", 6 },
- { "iso-a5", 6 },
- { "iso-a6", 6 },
- { "iso-a7", 6 },
- { "iso-a8", 6 },
- { "iso-a9", 6 },
- { "iso-a10", 7 },
- { "iso-b0", 6 },
- { "iso-b1", 6 },
- { "iso-b2", 6 },
- { "iso-b3", 6 },
- { "iso-b4", 6 },
- { "iso-b5", 6 },
- { "iso-b6", 6 },
- { "iso-b7", 6 },
- { "iso-b8", 6 },
- { "iso-b9", 6 },
- { "iso-b10", 7 },
- { "na-letter", 9 },
- { "na-legal", 8 },
- { "executive", 9 },
- { "folio", 5 },
- { "invoice", 7 },
- { "ledger", 6 },
- { "quarto", 6 },
- { "iso-c3", 6 },
- { "iso-c4", 6 },
- { "iso-c5", 6 },
- { "iso-c6", 6 },
- { "iso-designated-long", 19 },
- { "na-10x13-envelope", 17 },
- { "na-9x12-envelope", 16 },
- { "na-number-10-envelope", 21 },
- { "na-7x9-envelope", 15 },
- { "na-9x11-envelope", 16 },
- { "na-10x14-envelope", 17 },
- { "na-number-9-envelope", 20 },
- { "na-6x9-envelope", 15 },
- { "na-10x15-envelope", 17 },
- { "monarch-envelope", 16 },
- { "a", 1 },
- { "b", 1 },
- { "c", 1 },
- { "d", 1 },
- { "e", 1 },
- { "jis-b0", 6 },
- { "jis-b1", 6 },
- { "jis-b2", 6 },
- { "jis-b3", 6 },
- { "jis-b4", 6 },
- { "jis-b5", 6 },
- { "jis-b6", 6 },
- { "jis-b7", 6 },
- { "jis-b8", 6 },
- { "jis-b9", 6 },
- { "jis-b10", 7 },
- { "simplex", 7 },
- { "duplex", 6 },
- { "tumble", 6 },
- { "top", 3 },
- { "middle", 6 },
- { "bottom", 6 },
- { "envelope", 8 },
- { "manual", 6 },
- { "large-capacity", 14 },
- { "main", 4 },
- { "side", 4 },
- { "event-report-job-completed", 26 },
- { "electronic-mail", 15 },
- { "xp-setup-mandatory", 18 },
- { "xp-setup-optional", 17 },
- { "xp-setup-ok", 11 },
- { "xp-setup-incomplete", 19 },
- { "xp-list-glyph-fonts", 19 },
- { "xp-list-internal-printer-fonts", 30 },
- { "0", 1 },
- { "01", 2 },
- { "02", 2 },
- { "03", 2 },
- { "012", 3 },
- { "013", 3 },
- { "023", 3 },
- { "0123", 4 }
+ OIDATA(""),
+ OIDATA(""),
+ OIDATA("descriptor"),
+ OIDATA("content-orientation"),
+ OIDATA("copy-count"),
+ OIDATA("default-printer-resolution"),
+ OIDATA("default-input-tray"),
+ OIDATA("default-medium"),
+ OIDATA("document-format"),
+ OIDATA("plex"),
+ OIDATA("xp-listfonts-modes"),
+ OIDATA("job-name"),
+ OIDATA("job-owner"),
+ OIDATA("notification-profile"),
+ OIDATA("xp-setup-state"),
+ OIDATA("xp-spooler-command-options"),
+ OIDATA("content-orientations-supported"),
+ OIDATA("document-formats-supported"),
+ OIDATA("dt-pdm-command"),
+ OIDATA("input-trays-medium"),
+ OIDATA("medium-source-sizes-supported"),
+ OIDATA("plexes-supported"),
+ OIDATA("printer-model"),
+ OIDATA("printer-name"),
+ OIDATA("printer-resolutions-supported"),
+ OIDATA("xp-embedded-formats-supported"),
+ OIDATA("xp-listfonts-modes-supported"),
+ OIDATA("xp-page-attributes-supported"),
+ OIDATA("xp-raw-formats-supported"),
+ OIDATA("xp-setup-proviso"),
+ OIDATA("document-attributes-supported"),
+ OIDATA("job-attributes-supported"),
+ OIDATA("locale"),
+ OIDATA("multiple-documents-supported"),
+ OIDATA("available-compression"),
+ OIDATA("available-compressions-supported"),
+ OIDATA("portrait"),
+ OIDATA("landscape"),
+ OIDATA("reverse-portrait"),
+ OIDATA("reverse-landscape"),
+ OIDATA("iso-a0"),
+ OIDATA("iso-a1"),
+ OIDATA("iso-a2"),
+ OIDATA("iso-a3"),
+ OIDATA("iso-a4"),
+ OIDATA("iso-a5"),
+ OIDATA("iso-a6"),
+ OIDATA("iso-a7"),
+ OIDATA("iso-a8"),
+ OIDATA("iso-a9"),
+ OIDATA("iso-a10"),
+ OIDATA("iso-b0"),
+ OIDATA("iso-b1"),
+ OIDATA("iso-b2"),
+ OIDATA("iso-b3"),
+ OIDATA("iso-b4"),
+ OIDATA("iso-b5"),
+ OIDATA("iso-b6"),
+ OIDATA("iso-b7"),
+ OIDATA("iso-b8"),
+ OIDATA("iso-b9"),
+ OIDATA("iso-b10"),
+ OIDATA("na-letter"),
+ OIDATA("na-legal"),
+ OIDATA("executive"),
+ OIDATA("folio"),
+ OIDATA("invoice"),
+ OIDATA("ledger"),
+ OIDATA("quarto"),
+ OIDATA("iso-c3"),
+ OIDATA("iso-c4"),
+ OIDATA("iso-c5"),
+ OIDATA("iso-c6"),
+ OIDATA("iso-designated-long"),
+ OIDATA("na-10x13-envelope"),
+ OIDATA("na-9x12-envelope"),
+ OIDATA("na-number-10-envelope"),
+ OIDATA("na-7x9-envelope"),
+ OIDATA("na-9x11-envelope"),
+ OIDATA("na-10x14-envelope"),
+ OIDATA("na-number-9-envelope"),
+ OIDATA("na-6x9-envelope"),
+ OIDATA("na-10x15-envelope"),
+ OIDATA("monarch-envelope"),
+ OIDATA("a"),
+ OIDATA("b"),
+ OIDATA("c"),
+ OIDATA("d"),
+ OIDATA("e"),
+ OIDATA("jis-b0"),
+ OIDATA("jis-b1"),
+ OIDATA("jis-b2"),
+ OIDATA("jis-b3"),
+ OIDATA("jis-b4"),
+ OIDATA("jis-b5"),
+ OIDATA("jis-b6"),
+ OIDATA("jis-b7"),
+ OIDATA("jis-b8"),
+ OIDATA("jis-b9"),
+ OIDATA("jis-b10"),
+ OIDATA("simplex"),
+ OIDATA("duplex"),
+ OIDATA("tumble"),
+ OIDATA("top"),
+ OIDATA("middle"),
+ OIDATA("bottom"),
+ OIDATA("envelope"),
+ OIDATA("manual"),
+ OIDATA("large-capacity"),
+ OIDATA("main"),
+ OIDATA("side"),
+ OIDATA("event-report-job-completed"),
+ OIDATA("electronic-mail"),
+ OIDATA("xp-setup-mandatory"),
+ OIDATA("xp-setup-optional"),
+ OIDATA("xp-setup-ok"),
+ OIDATA("xp-setup-incomplete"),
+ OIDATA("xp-list-glyph-fonts"),
+ OIDATA("xp-list-internal-printer-fonts"),
+ OIDATA("0"),
+ OIDATA("01"),
+ OIDATA("02"),
+ OIDATA("03"),
+ OIDATA("012"),
+ OIDATA("013"),
+ OIDATA("023"),
+ OIDATA("0123")
};
+
+#undef OIDATA
diff --git a/Xprint/Util.c b/Xprint/Util.c
index efc196f82..9e0bdf925 100644
--- a/Xprint/Util.c
+++ b/Xprint/Util.c
@@ -30,18 +30,23 @@ not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from said
copyright holders.
*/
-#include "Xos.h" /* for unistd.h and string.h */
+/* $XFree86: xc/programs/Xserver/Xprint/Util.c,v 1.13 2001/10/31 22:50:28 tsi Exp $ */
+
+/* To get the tempnam() prototype in <stdio.h> */
+#if defined(linux) && defined(__STRICT_ANSI__)
+#undef __STRICT_ANSI__
+#endif
+
+#include <X11/Xos.h> /* for unistd.h and string.h */
#include <stdio.h>
#include <sys/wait.h>
#include <sys/stat.h>
-#include "dixstruct.h"
-#include "scrnintstr.h"
#include "misc.h"
+#include "dixstruct.h"
-#define _XP_PRINT_SERVER_
-#include "extensions/Print.h"
-#include "extensions/Printstr.h"
-#undef _XP_PRINT_SERVER_
+#include <X11/extensions/Print.h>
+
+#include "attributes.h"
#define IN_FILE_STRING "%(InFile)%"
#define OUT_FILE_STRING "%(OutFile)%"
@@ -89,10 +94,10 @@ ReplaceAnyString(
* and the caller is responsible for freeing whatever string is returned.
*/
char *
-ReplaceFileString(string, inFileName, outFileName)
- char *string;
- char *inFileName;
- char *outFileName;
+ReplaceFileString(
+ char *string,
+ char *inFileName,
+ char *outFileName)
{
char *pKeyString,
*pInFileString = IN_FILE_STRING,
@@ -143,9 +148,9 @@ ReplaceFileString(string, inFileName, outFileName)
* we don't delete the job file before the spooler has made a copy.
*/
void
-ExecCommand(pCommand, argVector)
- char *pCommand;
- char **argVector;
+ExecCommand(
+ char *pCommand,
+ char **argVector)
{
pid_t childPid;
int status;
@@ -169,17 +174,19 @@ ExecCommand(pCommand, argVector)
* beginning the transfer.
*/
int
-TransferBytes(pSrcFile, pDstFile, numBytes)
+TransferBytes(
FILE *pSrcFile,
- *pDstFile;
- int numBytes;
+ FILE *pDstFile,
+ int numBytes)
{
char buf[10240];
- int bytesWritten = 0, bytesToXfer;
+#define BUF_SIZE (sizeof(buf)*sizeof(char))
+ int bytesWritten = 0;
+ unsigned bytesToXfer;
- for(bytesToXfer = min(sizeof(buf)*sizeof(char), numBytes);
+ for(bytesToXfer = min(BUF_SIZE, (unsigned)numBytes);
bytesToXfer > 0;
- bytesToXfer = min(sizeof(buf)*sizeof(char), numBytes - bytesWritten))
+ bytesToXfer = min(BUF_SIZE, (unsigned)(numBytes - bytesWritten)))
{
if(fread((void *)buf, (size_t) 1, bytesToXfer, pSrcFile) < bytesToXfer)
return bytesWritten;
@@ -195,10 +202,10 @@ TransferBytes(pSrcFile, pDstFile, numBytes)
* pre, no, and post raster files as well as the raster file itself.
*/
Bool
-CopyContentsAndDelete(ppSrcFile, pSrcFileName, pDstFile)
+CopyContentsAndDelete(
FILE **ppSrcFile,
- *pDstFile;
- char **pSrcFileName;
+ char **pSrcFileName,
+ FILE *pDstFile)
{
struct stat statBuf;
@@ -228,7 +235,8 @@ XpSendDocumentData(
int maxBufSize)
{
xPrintGetDocumentDataReply *pRep;
- int bytesWritten, bytesToWrite;
+ int bytesWritten;
+ unsigned bytesToWrite;
int result = Success;
if(client->clientGone)
@@ -247,8 +255,7 @@ XpSendDocumentData(
pRep->length = (QUADPAD(bytesToWrite)) >> 2;
pRep->dataLen = bytesToWrite;
- if(fread((void *)(pRep + 1), (size_t) 1, bytesToWrite, fp) <
- bytesToWrite)
+ if(fread((void *)(pRep + 1), 1, bytesToWrite, fp) < bytesToWrite)
{
result = BadAlloc; /* XXX poor error choice? */
pRep->statusCode = 2; /* XXX Is this the right value??? */
@@ -316,6 +323,7 @@ XpFinishDocData(
return Success;
}
+#ifndef HAS_MKSTEMP
static
char *XpDirName(char *fname)
{
@@ -334,6 +342,7 @@ char *XpDirName(char *fname)
}
return fn;
}
+#endif
Bool
XpOpenTmpFile(
@@ -341,6 +350,7 @@ XpOpenTmpFile(
char **fname,
FILE **stream)
{
+#ifndef HAS_MKSTEMP
char *fn = NULL;
/* note that there is a small race condition here... */
@@ -348,6 +358,7 @@ XpOpenTmpFile(
!(fn = XpDirName(*fname)) ||
access(fn, W_OK) ||
!(*stream = fopen(*fname, mode)))
+
{
xfree(fn);
xfree(*fname);
@@ -356,5 +367,26 @@ XpOpenTmpFile(
return FALSE;
}
xfree(fn);
+#else
+ int fd;
+
+ *stream = NULL;
+ *fname = (char *)xalloc(14);
+ if (*fname == NULL)
+ return FALSE;
+ strcpy(*fname, "/tmp/xpXXXXXX");
+ fd = mkstemp(*fname);
+ if (fd < 0) {
+ xfree(*fname);
+ *fname = NULL;
+ return FALSE;
+ }
+ *stream = fdopen(fd, mode);
+ if (stream == NULL) {
+ xfree(*fname);
+ *fname = NULL;
+ return FALSE;
+ }
+#endif
return TRUE;
}
diff --git a/Xprint/attributes.c b/Xprint/attributes.c
index 7348d6402..7d71760be 100644
--- a/Xprint/attributes.c
+++ b/Xprint/attributes.c
@@ -44,26 +44,30 @@ copyright holders.
** *********************************************************
**
********************************************************************/
+/* $XFree86: xc/programs/Xserver/Xprint/attributes.c,v 1.18 2002/05/31 18:45:53 dawes Exp $ */
-#include <Xproto.h>
+#include <X11/Xproto.h>
#include <string.h>
#include <stdlib.h>
+#include <sys/types.h>
#include <sys/wait.h>
#include <pwd.h>
+#if defined(sun) && defined(SVR4)
+#include <wchar.h>
+#endif
-#include <scrnintstr.h>
+#include "scrnintstr.h"
-#define _XP_PRINT_SERVER_
-#include "extensions/Printstr.h"
-#undef _XP_PRINT_SERVER_
+#include <X11/extensions/Printstr.h>
+#include "attributes.h"
#include "Xrm.c"
static XrmDatabase CopyDb(XrmDatabase inDb);
-extern XrmDatabase XpSpoolerGetServerAttributes();
+extern XrmDatabase XpSpoolerGetServerAttributes(void);
-static int attrGeneration = 0;
+static unsigned long attrGeneration = 0;
typedef struct {
XrmDatabase *pDb;
@@ -137,8 +141,7 @@ static char NULL_STRING[] = "\0";
* $LANG. It makes no attempt to ensure that the directory actually exists.
*/
char *
-XpGetConfigDir(useLocale)
- Bool useLocale;
+XpGetConfigDir(Bool useLocale)
{
char *dirName, *langName, *langDir, *configDir;
Bool freeLangDir = False;
@@ -182,8 +185,7 @@ XpGetConfigDir(useLocale)
* locale (if other than the top-level).
*/
static XrmDatabase
-GetMergedDatabase(attrName)
- char *attrName;
+GetMergedDatabase(const char *attrName)
{
char *dirName, *fileName;
XrmDatabase db;
@@ -220,7 +222,7 @@ GetMergedDatabase(attrName)
* the context.
*/
static void
-BuildSystemAttributes()
+BuildSystemAttributes(void)
{
if(systemAttributes.printers != (XrmDatabase)NULL)
XrmDestroyDatabase(systemAttributes.printers);
@@ -243,13 +245,13 @@ BuildSystemAttributes()
* passed as the client_data (aka "closure").
*/
static Bool
-AddDbEntry(sourceDB, bindings, quarks, type, value, client_data)
- XrmDatabase *sourceDB;
- XrmBindingList bindings;
- XrmQuarkList quarks;
- XrmRepresentation *type;
- XrmValue *value;
- XPointer client_data;
+AddDbEntry(
+ XrmDatabase *sourceDB,
+ XrmBindingList bindings,
+ XrmQuarkList quarks,
+ XrmRepresentation *type,
+ XrmValue *value,
+ XPointer client_data)
{
DbEnumStruct *pEnumStruct = (DbEnumStruct *)client_data;
XrmName xrm_name[5];
@@ -293,15 +295,15 @@ AddDbEntry(sourceDB, bindings, quarks, type, value, client_data)
* printer.
*/
static XrmDatabase
-BuildPrinterAttrs(printerName, qualifierName)
- char *printerName;
- char *qualifierName;
+BuildPrinterAttrs(
+ char *printerName,
+ char *qualifierName)
{
XrmDatabase printerDB = (XrmDatabase)NULL;
if(systemAttributes.printers != (XrmDatabase)NULL)
{
- char *dirName, *fileName;
+ char *fileName;
XrmDatabase modelDB = (XrmDatabase)NULL;
XrmName xrm_name[5], xrm_class[2];
XrmRepresentation rep_type;
@@ -374,10 +376,10 @@ BuildPrinterAttrs(printerName, qualifierName)
* level doc and job databases.
*/
static XrmDatabase
-BuildABase(printerName, qualifierName, sourceBase)
- char *printerName;
- char *qualifierName;
- XrmDatabase sourceBase;
+BuildABase(
+ char *printerName,
+ char *qualifierName,
+ XrmDatabase sourceBase)
{
XrmDatabase builtDB = (XrmDatabase)NULL;
@@ -425,7 +427,7 @@ BuildABase(printerName, qualifierName, sourceBase)
* databases stored in the global attrList.
*/
static void
-FreeAttrList()
+FreeAttrList(void)
{
PrAttrPtr pAttr, pNext;
@@ -454,7 +456,7 @@ FreeAttrList()
* by calling XpBuildAttributeStore for a new list of printers.
*/
int
-XpRehashAttributes()
+XpRehashAttributes(void)
{
if(attrList != (PrAttrPtr)NULL)
FreeAttrList();
@@ -468,9 +470,9 @@ XpRehashAttributes()
* calls BuildSystemAttributes to create the system-level databases.
*/
void
-XpBuildAttributeStore(printerName, qualifierName)
- char *printerName;
- char *qualifierName;
+XpBuildAttributeStore(
+ char *printerName,
+ char *qualifierName)
{
PrAttrPtr pAttr;
@@ -510,13 +512,13 @@ XpBuildAttributeStore(printerName, qualifierName)
static Bool
-StoreEntry(sourceDB, bindings, quarks, type, value, client_data)
- XrmDatabase *sourceDB;
- XrmBindingList bindings;
- XrmQuarkList quarks;
- XrmRepresentation *type;
- XrmValue *value;
- XPointer client_data;
+StoreEntry(
+ XrmDatabase *sourceDB,
+ XrmBindingList bindings,
+ XrmQuarkList quarks,
+ XrmRepresentation *type,
+ XrmValue *value,
+ XPointer client_data)
{
XrmDatabase *outDb = (XrmDatabase *)client_data;
@@ -530,8 +532,7 @@ StoreEntry(sourceDB, bindings, quarks, type, value, client_data)
* the copy.
*/
static XrmDatabase
-CopyDb(inDb)
- XrmDatabase inDb;
+CopyDb(XrmDatabase inDb)
{
XrmDatabase outDb = (XrmDatabase)NULL;
XrmQuark empty = NULLQUARK;
@@ -547,8 +548,7 @@ CopyDb(inDb)
* attributes databases for the printer associated with the context.
*/
void
-XpInitAttributes( pContext )
- XpContextPtr pContext;
+XpInitAttributes(XpContextPtr pContext)
{
ContextAttrPtr pCtxtAttrs;
PrAttrPtr pPrAttr = attrList;
@@ -569,8 +569,8 @@ XpInitAttributes( pContext )
}
void
-XpDestroyAttributes( pContext )
- XpContextPtr pContext;
+XpDestroyAttributes(
+ XpContextPtr pContext)
{
ContextAttrPtr pCtxtAttrs;
@@ -596,14 +596,13 @@ XpDestroyAttributes( pContext )
* in which case the pContext parameter is ignored.
*/
char *
-XpGetOneAttribute( pContext, class, attributeName )
- XpContextPtr pContext;
- XPAttributes class;
- char *attributeName;
+XpGetOneAttribute(
+ XpContextPtr pContext,
+ XPAttributes class,
+ char *attributeName)
{
ContextAttrPtr pCtxtAttrs;
XrmDatabase db = (XrmDatabase)NULL;
- char *retVal;
XrmName xrm_name[3];
XrmRepresentation rep_type;
XrmValue value;
@@ -666,12 +665,11 @@ XpGetOneAttribute( pContext, class, attributeName )
* function does not recognize XPServerAttr.
*/
void
-XpPutOneAttribute( pContext, class, attributeName, value )
-
-XpContextPtr pContext;
-XPAttributes class;
-const char* attributeName;
-const char* value;
+XpPutOneAttribute(
+ XpContextPtr pContext,
+ XPAttributes class,
+ const char* attributeName,
+ const char* value)
{
ContextAttrPtr pCtxtAttrs;
XrmDatabase db;
@@ -720,8 +718,8 @@ const char* value;
* struct to indicate the new amount of space available.
*/
static Bool
-ExpandSpace(pStr)
- StringDbStruct *pStr;
+ExpandSpace(
+ StringDbStruct *pStr)
{
char *newSpace;
@@ -740,9 +738,9 @@ ExpandSpace(pStr)
* are updated.
*/
static void
-PutString(pStr, pString)
- StringDbStruct *pStr;
- char *pString;
+PutString(
+ StringDbStruct *pStr,
+ char *pString)
{
int len = strlen(pString);
@@ -760,9 +758,9 @@ PutString(pStr, pString)
* the byte, and the nextPos and space fields are updated.
*/
static void
-PutByte(pStr, byte)
- StringDbStruct *pStr;
- char byte;
+PutByte(
+ StringDbStruct *pStr,
+ char byte)
{
if(pStr->space <= 1)
if(!ExpandSpace(pStr))
@@ -782,13 +780,13 @@ PutByte(pStr, byte)
* This code is based directly on that in "DumpEntry" in Xrm.c.
*/
static Bool
-AppendEntry(db, bindings, quarks, type, value, data)
- XrmDatabase *db;
- XrmBindingList bindings;
- XrmQuarkList quarks;
- XrmRepresentation *type;
- XrmValuePtr value;
- XPointer data;
+AppendEntry(
+ XrmDatabase *db,
+ XrmBindingList bindings,
+ XrmQuarkList quarks,
+ XrmRepresentation *type,
+ XrmValuePtr value,
+ XPointer data)
{
StringDbStruct *pEnumStr = (StringDbStruct *)data;
Bool firstNameSeen;
@@ -796,7 +794,7 @@ AppendEntry(db, bindings, quarks, type, value, data)
char *s, c;
if (*type != XrmQString)
- return;
+ return False;
for (firstNameSeen = False; *quarks; bindings++, quarks++) {
if (*bindings == XrmBindLoosely) {
@@ -849,13 +847,12 @@ AppendEntry(db, bindings, quarks, type, value, data)
* unlike XpGetOneAttribute, where the caller must not free the string.
*/
char *
-XpGetAttributes( pContext, class )
- XpContextPtr pContext;
- XPAttributes class;
+XpGetAttributes(
+ XpContextPtr pContext,
+ XPAttributes class)
{
ContextAttrPtr pCtxtAttrs;
XrmDatabase db = (XrmDatabase)NULL;
- char *retVal;
StringDbStruct enumStruct;
XrmQuark empty = NULLQUARK;
@@ -904,10 +901,10 @@ XpGetAttributes( pContext, class )
}
int
-XpAugmentAttributes( pContext, class, attributes )
- XpContextPtr pContext;
- XPAttributes class;
- char *attributes;
+XpAugmentAttributes(
+ XpContextPtr pContext,
+ XPAttributes class,
+ char *attributes)
{
XrmDatabase db;
ContextAttrPtr pCtxtAttrs;
@@ -940,10 +937,10 @@ XpAugmentAttributes( pContext, class, attributes )
* XpSetAttributes - sets the attribute stores for a specified context.
*/
int
-XpSetAttributes( pContext, class, attributes )
- XpContextPtr pContext;
- XPAttributes class;
- char *attributes;
+XpSetAttributes(
+ XpContextPtr pContext,
+ XPAttributes class,
+ char *attributes)
{
XrmDatabase db;
ContextAttrPtr pCtxtAttrs;
@@ -981,12 +978,11 @@ XpSetAttributes( pContext, class, attributes )
}
void
-XpAddPrinterAttribute(printerName, printerQualifier, attributeName,
- attributeValue)
- char *printerName;
- char *printerQualifier;
- char *attributeName;
- char *attributeValue;
+XpAddPrinterAttribute(
+ char *printerName,
+ char *printerQualifier,
+ char *attributeName,
+ char *attributeValue)
{
PrAttrPtr pAttr;
@@ -1045,7 +1041,7 @@ static char serverAttrStr[] = "*document-attributes-supported: copy-count\n\
*multiple-documents-supported: False";
XrmDatabase
-XpSpoolerGetServerAttributes()
+XpSpoolerGetServerAttributes(void)
{
char *totalAttrs, *localeName;
XrmDatabase db;
@@ -1065,34 +1061,6 @@ XpSpoolerGetServerAttributes()
}
/*
- * ExecuteCommand takes two pointers - the command to execute,
- * and the "argv" style NULL-terminated vector of arguments for the command.
- * We wait for the command to terminate before continuing to ensure that
- * we don't delete the job file before the spooler has made a copy.
- */
-static void
-ExecCommand(pCommand, argVector)
- char *pCommand;
- char **argVector;
-{
- pid_t childPid;
- int status;
-
- if((childPid = fork()) == 0)
- {
- /* return BadAlloc? */
- if (execv(pCommand, argVector) == -1) {
- FatalError("unable to exec '%s'", pCommand);
- }
- }
- else
- {
- (void) waitpid(childPid, &status, 0);
- }
- return;
-}
-
-/*
* SendFileToCommand takes three character pointers - the file name,
* the command to execute,
* and the "argv" style NULL-terminated vector of arguments for the command.
@@ -1167,8 +1135,6 @@ SendFileToCommand(
}
else
{
- int res;
-
(void) close(pipefd[0]);
outPipe = fdopen(pipefd[1], "w");
@@ -1188,7 +1154,6 @@ SendFileToCommand(
* store for the supplied print context. The ReplaceAnyString utility
* routine is used to perform the actual replacements.
*/
-extern char *ReplaceAnyString(char *, char *, char *);
static char *
ReplaceAllKeywords(
@@ -1233,7 +1198,20 @@ ReplaceAllKeywords(
return command;
}
-#if defined(CSRG_BASED) || defined(linux) || (defined(sun) && !defined(SVR4)) || (defined(SVR4) && !defined(sun) && !defined(USL))
+#ifdef __QNX__
+#define toascii( c ) ((unsigned)(c) & 0x007f)
+#endif
+
+#if defined(CSRG_BASED) || \
+ defined(linux) || \
+ defined(__CYGWIN__) || \
+ (defined(sun) && !defined(SVR4)) || \
+ (defined(SVR4) && !defined(sun) && !defined(USL)) || \
+ defined(__UNIXOS2__) || \
+ defined(ISC) || \
+ defined(Lynx) || \
+ defined(__QNX__) || \
+ defined(__DARWIN__)
#define iswspace(c) (isascii(c) && isspace(toascii(c)))
#endif
@@ -1387,8 +1365,8 @@ VectorizeCommand(
char ***pVector,
XpContextPtr pContext)
{
- char *cmdName, *curTok;
- int i, numChars;
+ char *cmdName;
+ int numChars;
if(command == (char *)NULL)
return (char *)NULL;
@@ -1410,11 +1388,11 @@ static char DEFAULT_SPOOL_COMMAND[] = "/usr/bin/lp -d %printer-name% -n %copy-co
#endif
int
-XpSubmitJob(fileName, pContext)
- char *fileName;
- XpContextPtr pContext;
+XpSubmitJob(
+ char *fileName,
+ XpContextPtr pContext)
{
- char **vector, *cmdNam, *cmdOpt, *command, *userName;
+ char **vector, *cmdNam, *command, *userName;
int i;
command = XpGetOneAttribute(pContext, XPPrinterAttr, "xp-spooler-command");
@@ -1452,6 +1430,7 @@ XpSubmitJob(fileName, pContext)
FreeVector(vector);
xfree(cmdNam);
+ return Success;
}
/*
@@ -1524,7 +1503,6 @@ XpGetTrayMediumFromContext(XpContextPtr pCon,
{
char *defMedium, *defTray;
char *t, *m;
- char *pS, *pE, *pLast;
defMedium = XpGetOneAttribute( pCon, XPPageAttr,
"default-medium" );
diff --git a/Xprint/attributes.h b/Xprint/attributes.h
index 59ccb9c63..d9d551f32 100644
--- a/Xprint/attributes.h
+++ b/Xprint/attributes.h
@@ -30,13 +30,32 @@ not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from said
copyright holders.
*/
+/* $XFree86: xc/programs/Xserver/Xprint/attributes.h,v 1.6 2001/12/21 21:02:05 dawes Exp $ */
-#include "Oid.h"
+#ifndef _Xp_attributes_h
+#define _Xp_attributes_h 1
+
+#include "scrnintstr.h"
+#include "AttrValid.h"
+
+#define BFuncArgs int ndx, ScreenPtr pScreen, int argc, char **argv
+typedef Bool (*pBFunc)(BFuncArgs);
+
+#define VFuncArgs char *name, XpValidatePoolsRec *pValRec, float *width, float *height, int *res
+typedef void (*pVFunc)(VFuncArgs);
/*
* attributes.c
*/
void XpInitAttributes(XpContextPtr pContext);
+void XpBuildAttributeStore(char *printerName,
+ char *qualifierName);
+void XpAddPrinterAttribute(char *printerName,
+ char *printerQualifier,
+ char *attributeName,
+ char *attributeValue);
+void XpDestroyAttributes(XpContextPtr pContext);
+char *XpGetConfigDir(Bool useLocale);
char *XpGetOneAttribute(XpContextPtr pContext,
XPAttributes class,
char *attributeName);
@@ -44,6 +63,7 @@ void XpPutOneAttribute(XpContextPtr pContext,
XPAttributes class,
const char* attributeName,
const char* value);
+int XpRehashAttributes(void);
char *XpGetAttributes(XpContextPtr pContext,
XPAttributes class);
int XpAugmentAttributes(XpContextPtr pContext,
@@ -57,6 +77,7 @@ const char *XpGetPrinterAttribute(const char *printerName,
void XpGetTrayMediumFromContext(XpContextPtr pCon,
char **medium,
char **tray);
+int XpSubmitJob(char *fileName, XpContextPtr pContext);
/*
* mediaSizes.c
@@ -76,3 +97,34 @@ void XpGetMediumDimensions(XpContextPtr pContext,
unsigned short *height);
void XpGetReproductionArea(XpContextPtr pContext,
xRectangle *pRect);
+void XpGetMaxWidthHeightRes(const char *printer_name,
+ const XpValidatePoolsRec* vpr,
+ float *width,
+ float *height,
+ int* resolution);
+
+/* Util.c */
+char * ReplaceAnyString(char *string,
+ char *target,
+ char *replacement);
+char * ReplaceFileString(char *string,
+ char *inFileName,
+ char *outFileName);
+void ExecCommand(char *pCommand,
+ char **argVector);
+int TransferBytes(FILE *pSrcFile,
+ FILE *pDstFile,
+ int numBytes);
+Bool CopyContentsAndDelete(FILE **ppSrcFile,
+ char **pSrcFileName,
+ FILE *pDstFile);
+int XpSendDocumentData(ClientPtr client,
+ FILE *fp,
+ int fileLen,
+ int maxBufSize);
+int XpFinishDocData(ClientPtr client);
+Bool XpOpenTmpFile(char *mode,
+ char **fname,
+ FILE **stream);
+
+#endif /* _Xp_attributes_h */
diff --git a/Xprint/ddxInit.c b/Xprint/ddxInit.c
index 3f8cefbe8..a96a766f8 100644
--- a/Xprint/ddxInit.c
+++ b/Xprint/ddxInit.c
@@ -30,19 +30,16 @@ not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from said
copyright holders.
*/
+/* $XFree86: xc/programs/Xserver/Xprint/ddxInit.c,v 1.14 2001/10/28 03:32:53 tsi Exp $ */
#include "X.h"
#include "Xproto.h"
-#include "screenint.h"
-#include "input.h"
-#include "misc.h"
-#include "scrnintstr.h"
#include "windowstr.h"
#include "servermd.h"
#include "Xos.h"
+#include "DiPrint.h"
-static void Exit();
-void _XpVoidNoop();
+static void Exit(int);
/*-
*-----------------------------------------------------------------------
@@ -72,13 +69,11 @@ void _XpVoidNoop();
*/
void
-InitOutput(pScreenInfo, argc, argv)
- ScreenInfo *pScreenInfo;
- int argc;
- char **argv;
+InitOutput(
+ ScreenInfo *pScreenInfo,
+ int argc,
+ char **argv)
{
- int i;
-
pScreenInfo->imageByteOrder = IMAGE_BYTE_ORDER;
pScreenInfo->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT;
pScreenInfo->bitmapScanlinePad = BITMAP_SCANLINE_PAD;
@@ -92,17 +87,17 @@ InitOutput(pScreenInfo, argc, argv)
}
static void
-BellProc(volume, pDev)
- int volume;
- DeviceIntPtr pDev;
+BellProc(
+ int volume,
+ DeviceIntPtr pDev)
{
return;
}
static void
-KeyControlProc(pDev, ctrl)
- DeviceIntPtr pDev;
- KeybdCtrl *ctrl;
+KeyControlProc(
+ DeviceIntPtr pDev,
+ KeybdCtrl *ctrl)
{
return;
}
@@ -111,11 +106,11 @@ static KeySym printKeyMap[256];
static CARD8 printModMap[256];
static int
-KeyboardProc(pKbd, what, argc, argv)
- DevicePtr pKbd;
- int what;
- int argc;
- char *argv[];
+KeyboardProc(
+ DevicePtr pKbd,
+ int what,
+ int argc,
+ char *argv[])
{
KeySymsRec keySyms;
@@ -143,11 +138,11 @@ KeyboardProc(pKbd, what, argc, argv)
#include "../mi/mipointer.h"
static int
-PointerProc(pPtr, what, argc, argv)
- DevicePtr pPtr;
- int what;
- int argc;
- char *argv[];
+PointerProc(
+ DevicePtr pPtr,
+ int what,
+ int argc,
+ char *argv[])
{
#define NUM_BUTTONS 1
CARD8 map[NUM_BUTTONS];
@@ -174,11 +169,11 @@ PointerProc(pPtr, what, argc, argv)
}
void
-InitInput(argc, argv)
- int argc;
- char **argv;
+InitInput(
+ int argc,
+ char **argv)
{
- DevicePtr ptr, kbd;
+ DeviceIntPtr ptr, kbd;
ptr = AddInputDevice((DeviceProc)PointerProc, TRUE);
kbd = AddInputDevice((DeviceProc)KeyboardProc, TRUE);
@@ -189,28 +184,42 @@ InitInput(argc, argv)
Bool
-LegalModifier(key, dev)
- unsigned int key;
- DevicePtr dev;
+LegalModifier(
+ unsigned int key,
+ DevicePtr dev)
{
return TRUE;
}
void
-ProcessInputEvents()
+ProcessInputEvents(void)
+{
+}
+
+#ifdef __DARWIN__
+void
+DarwinHandleGUI(int argc, char *argv[])
{
}
+#endif
#ifdef DDXOSINIT
void
-OsVendorInit()
+OsVendorInit(void)
+{
+}
+#endif
+
+#ifdef DDXOSFATALERROR
+void
+OsVendorFatalError(void)
{
}
#endif
#ifdef DDXTIME
CARD32
-GetTimeInMillis()
+GetTimeInMillis(void)
{
struct timeval tp;
@@ -226,7 +235,7 @@ GetTimeInMillis()
*
*****************************************/
-void ddxUseMsg()
+void ddxUseMsg(void)
{
/* Right now, let's just do nothing */
}
@@ -237,20 +246,19 @@ static void Exit (code)
exit (code);
}
-void AbortDDX ()
+void AbortDDX (void)
{
}
-void ddxGiveUp() /* Called by GiveUp() */
+void ddxGiveUp(void) /* Called by GiveUp() */
{
}
int
-ddxProcessArgument (argc, argv, i)
- int argc;
- char *argv[];
- int i;
-
+ddxProcessArgument (
+ int argc,
+ char *argv[],
+ int i)
{
#ifdef PRINT_ONLY_SERVER
return XprintOptions(argc, argv, i) - i;
@@ -263,67 +271,76 @@ ddxProcessArgument (argc, argv, i)
#include "XI.h"
#include "XIproto.h"
+#include "XIstubs.h"
extern int BadDevice;
-ChangePointerDevice (old_dev, new_dev, x, y)
- DeviceIntPtr old_dev;
- DeviceIntPtr new_dev;
- unsigned char x,y;
+int
+ChangePointerDevice (
+ DeviceIntPtr old_dev,
+ DeviceIntPtr new_dev,
+ unsigned char x,
+ unsigned char y)
{
- return (BadDevice);
+ return (BadDevice);
}
int
-ChangeDeviceControl (client, dev, control)
- register ClientPtr client;
- DeviceIntPtr dev;
- xDeviceCtl *control;
+ChangeDeviceControl (
+ register ClientPtr client,
+ DeviceIntPtr dev,
+ xDeviceCtl *control)
{
return BadMatch;
}
-OpenInputDevice (dev, client, status)
- DeviceIntPtr dev;
- ClientPtr client;
- int *status;
+void
+OpenInputDevice (
+ DeviceIntPtr dev,
+ ClientPtr client,
+ int *status)
{
return;
}
-AddOtherInputDevices ()
+void
+AddOtherInputDevices (void)
{
return;
}
-CloseInputDevice (dev, client)
- DeviceIntPtr dev;
- ClientPtr client;
+void
+CloseInputDevice (
+ DeviceIntPtr dev,
+ ClientPtr client)
{
return;
}
-ChangeKeyboardDevice (old_dev, new_dev)
- DeviceIntPtr old_dev;
- DeviceIntPtr new_dev;
+int
+ChangeKeyboardDevice (
+ DeviceIntPtr old_dev,
+ DeviceIntPtr new_dev)
{
return (Success);
}
-SetDeviceMode (client, dev, mode)
- register ClientPtr client;
- DeviceIntPtr dev;
- int mode;
+int
+SetDeviceMode (
+ register ClientPtr client,
+ DeviceIntPtr dev,
+ int mode)
{
return BadMatch;
}
-SetDeviceValuators (client, dev, valuators, first_valuator, num_valuators)
- register ClientPtr client;
- DeviceIntPtr dev;
- int *valuators;
- int first_valuator;
- int num_valuators;
+int
+SetDeviceValuators (
+ register ClientPtr client,
+ DeviceIntPtr dev,
+ int *valuators,
+ int first_valuator,
+ int num_valuators)
{
return BadMatch;
}
@@ -334,21 +351,19 @@ SetDeviceValuators (client, dev, valuators, first_valuator, num_valuators)
#ifdef XTESTEXT1
void
-XTestJumpPointer(x, y, dev)
- int x, y, dev;
+XTestJumpPointer(int x, int y, int dev)
{
return;
}
void
-XTestGetPointerPos(x, y)
+XTestGetPointerPos(int x, int y)
{
return;
}
void
-XTestGenerateEvent(dev, keycode, keystate, x, y)
- int dev, keycode, keystate, x, y;
+XTestGenerateEvent(int dev, int keycode, int keystate, int x, int y)
{
return;
}
diff --git a/Xprint/mediaSizes.c b/Xprint/mediaSizes.c
index eaff20a88..7bb08b412 100644
--- a/Xprint/mediaSizes.c
+++ b/Xprint/mediaSizes.c
@@ -30,6 +30,8 @@ not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from said
copyright holders.
*/
+/* $XFree86: xc/programs/Xserver/Xprint/mediaSizes.c,v 1.5 2001/12/21 21:02:05 dawes Exp $ */
+
/*******************************************************************
**
** *********************************************************
@@ -62,14 +64,8 @@ copyright holders.
#include "scrnintstr.h"
#include "fontstruct.h"
-#define _XP_PRINT_SERVER_
-#include "Printstr.h"
-#undef _XP_PRINT_SERVER_
-
#include "DiPrint.h"
-#include "AttrValid.h"
-
-extern XpContextPtr XpContextOfClient();
+#include "attributes.h"
typedef struct {
XpOid page_size;
@@ -149,8 +145,7 @@ static PageDimensionsRec PageDimensions[] =
* attributes pools have been validated.
*/
int
-XpGetResolution(
- XpContextPtr pContext)
+XpGetResolution(XpContextPtr pContext)
{
unsigned long resolution;
@@ -190,8 +185,7 @@ XpGetResolution(
* attributes pools have been validated.
*/
XpOid
-XpGetContentOrientation(
- XpContextPtr pContext)
+XpGetContentOrientation(XpContextPtr pContext)
{
XpOid orientation;
@@ -421,7 +415,7 @@ XpGetMediumMillimeters(
float *width, /* return */
float *height) /* return */
{
- int i;
+ unsigned i;
*width = *height = 0;
for(i = 0; i < XpNumber(PageDimensions); i++)
@@ -745,9 +739,7 @@ XpGetMaxWidthHeightRes(
}
FontResolutionPtr
-XpGetClientResolutions(client, num)
- ClientPtr client;
- int *num;
+XpGetClientResolutions(ClientPtr client, int *num)
{
static struct _FontResolution res;
int resolution = XpGetResolution(XpContextOfClient(client));
@@ -763,15 +755,13 @@ XpGetClientResolutions(client, num)
}
-void XpSetFontResFunc(client)
- ClientPtr client;
+void XpSetFontResFunc(ClientPtr client)
{
client->fontResFunc = XpGetClientResolutions;
}
-void XpUnsetFontResFunc(client)
- ClientPtr client;
+void XpUnsetFontResFunc(ClientPtr client)
{
client->fontResFunc = NULL;
}
diff --git a/Xprint/pcl/Pcl.h b/Xprint/pcl/Pcl.h
index 0f744eafe..0532e1fcc 100644
--- a/Xprint/pcl/Pcl.h
+++ b/Xprint/pcl/Pcl.h
@@ -11,7 +11,7 @@
** * Created: 1/30/95
** *
** *********************************************************
-**
+**
********************************************************************/
/*
(c) Copyright 1996 Hewlett-Packard Company
@@ -44,6 +44,7 @@ not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from said
copyright holders.
*/
+/* $XFree86: xc/programs/Xserver/Xprint/pcl/Pcl.h,v 1.12 2001/12/21 21:02:05 dawes Exp $ */
#ifndef _PCL_H_
#define _PCL_H_
@@ -51,25 +52,12 @@ copyright holders.
#include <stdio.h>
#include "scrnintstr.h"
-/*
-#include "X.h"
-#include "Xproto.h"
-#include "Xatom.h"
-#include "misc.h"
-#include "screenint.h"
-#include "colormapst.h"
-#include "windowstr.h"
-#include "propertyst.h"
-#include "servermd.h" */ /* needed for IMAGE_BUFSIZE */
-
#include "PclDef.h"
#include "Pclmap.h"
#include "PclSFonts.h"
-#define _XP_PRINT_SERVER_
-#include "Print.h"
-#include "extensions/Printstr.h"
-#undef _XP_PRINT_SERVER_
+#include <X11/extensions/Print.h>
+#include <X11/extensions/Printstr.h>
#include "miscstruct.h"
#include "fontstruct.h"
@@ -79,13 +67,16 @@ copyright holders.
/*
* Some sleazes to force the XrmDB stuff into the server
*/
+#ifndef HAVE_XPointer
typedef char *XPointer;
+#endif
#define Status int
#define True 1
#define False 0
#include "misc.h"
-#include <Xfuncproto.h>
-#include "../Xresource.h"
+#include <X11/Xfuncproto.h>
+#include <X11/Xresource.h>
+#include "attributes.h"
/******
* externally visible variables from PclInit.c
@@ -95,6 +86,11 @@ extern int PclContextPrivateIndex;
extern int PclPixmapPrivateIndex;
extern int PclGCPrivateIndex;
+/******
+ * externally visible variables from PclAttVal.c
+ ******/
+extern XpValidatePoolsRec PclValidatePoolsRec;
+
/*
* This structure defines a mapping from an X colormap ID to a list of
* print contexts which use the colormap.
@@ -159,8 +155,6 @@ typedef struct {
} PclWindowPrivRec, *PclWindowPrivPtr;
typedef struct {
- unsigned freeCompClip;
- RegionPtr pCompositeClip;
unsigned long stippleFg, stippleBg;
} PclGCPrivRec, *PclGCPrivPtr;
@@ -191,7 +185,9 @@ typedef struct {
#endif /* XP_PCL_LJ3 */
#define MIN(a,b) (((a)<(b))?(a):(b))
+#ifndef MAX
#define MAX(a,b) (((a)>(b))?(a):(b))
+#endif
/******
* Functions in PclArc.c
@@ -247,18 +243,18 @@ RegionPtr PclCopyPlane(
/******
* Functions in PclAttr.c
******/
-extern char *PclGetAttributes(
+extern char *PclGetAttributes(
XpContextPtr pCon,
XPAttributes pool );
extern char *PclGetOneAttribute(
XpContextPtr pCon,
XPAttributes pool,
char *attr );
-extern int PclAugmentAttributes(
+extern int PclAugmentAttributes(
XpContextPtr pCon,
XPAttributes pool,
char *attrs );
-extern int PclSetAttributes(
+extern int PclSetAttributes(
XpContextPtr pCon,
XPAttributes pool,
char *attrs );
@@ -284,6 +280,16 @@ extern int PclUpdateColormap(DrawablePtr pDrawable,
XpContextPtr pCon,
GCPtr gc,
FILE *outFile);
+extern void PclLookUp(ColormapPtr cmap,
+ PclContextPrivPtr cPriv,
+ unsigned short *r,
+ unsigned short *g,
+ unsigned short *b);
+extern PclPaletteMapPtr PclFindPaletteMap(PclContextPrivPtr cPriv,
+ ColormapPtr cmap,
+ GCPtr gc);
+extern unsigned char *PclReadMap(char *, int *);
+
/******
* Functions in PclCursor.c
@@ -316,6 +322,27 @@ extern Bool PclSetCursorPosition(
Bool generateEvent);
/******
+ * Functions in PclSFonts.c
+ ******/
+extern void
+PclDownloadSoftFont8(
+ FILE *fp,
+ PclSoftFontInfoPtr pSoftFontInfo,
+ PclFontHead8Ptr pfh,
+ PclCharDataPtr pcd,
+ unsigned char *code);
+extern void PclDownloadSoftFont16(
+ FILE *fp,
+ PclSoftFontInfoPtr pSoftFontInfo,
+ PclFontHead16Ptr pfh,
+ PclCharDataPtr pcd,
+ unsigned char row,
+ unsigned char col);
+extern PclSoftFontInfoPtr PclCreateSoftFontInfo(void);
+extern void PclDestroySoftFontInfo(
+ PclSoftFontInfoPtr pSoftFontInfo );
+
+/******
* Functions in PclGC.c
******/
extern Bool PclCreateGC(GCPtr pGC);
@@ -326,7 +353,7 @@ extern int PclUpdateDrawableGC(
FILE **outFile);
extern void PclValidateGC(
GCPtr pGC,
- Mask changes,
+ unsigned long changes,
DrawablePtr pDrawable);
extern void PclSetDrawablePrivateStuff(
DrawablePtr pDrawable,
@@ -336,16 +363,34 @@ extern int PclGetDrawablePrivateStuff(
GC *gc,
unsigned long *valid,
FILE **file );
-
+extern void PclSetDrawablePrivateGC(
+ DrawablePtr pDrawable,
+ GC gc);
+extern void PclComputeCompositeClip(
+ GCPtr pGC,
+ DrawablePtr pDrawable);
+
/******
* Functions in PclInit.c
******/
-extern Bool InitializePclDriver(
+extern Bool PclCloseScreen(
+ int index,
+ ScreenPtr pScreen);
+extern Bool InitializeColorPclDriver(
+ int ndx,
+ ScreenPtr pScreen,
+ int argc,
+ char **argv);
+extern Bool InitializeMonoPclDriver(
+ int ndx,
+ ScreenPtr pScreen,
+ int argc,
+ char **argv);
+extern Bool InitializeLj3PclDriver(
int ndx,
ScreenPtr pScreen,
int argc,
char **argv);
-static Bool PclDestroyContext( XpContextPtr pCon );
extern XpContextPtr PclGetContextFromWindow( WindowPtr win );
/******
@@ -380,6 +425,12 @@ extern int PclGetMediumDimensions(
extern int PclGetReproducibleArea(
XpContextPtr pCon,
xRectangle *pRect);
+extern void PclSendData(
+ FILE *outFile,
+ PclContextPrivPtr pConPriv,
+ BoxPtr pbox,
+ int nbox,
+ double ratio);
/******
* Functions in PclPixel.c
@@ -508,7 +559,6 @@ extern Bool PclPositionWindow(
int x,
int y);
extern Bool PclUnmapWindow(WindowPtr pWindow);
-extern Bool PclUnmapWindow(WindowPtr pWindow);
extern void PclCopyWindow(
WindowPtr pWin,
DDXPointRec ptOldOrg,
@@ -569,12 +619,3 @@ extern int PclGetDocumentData(
#endif /* _PCL_H_ */
-
-
-
-
-
-
-
-
-
diff --git a/Xprint/pcl/PclArc.c b/Xprint/pcl/PclArc.c
index ffdf32907..ca13b3a84 100644
--- a/Xprint/pcl/PclArc.c
+++ b/Xprint/pcl/PclArc.c
@@ -45,6 +45,8 @@ dealings in this Software without prior written authorization from said
copyright holders.
*/
+/* $XFree86: xc/programs/Xserver/Xprint/pcl/PclArc.c,v 1.5 2001/01/17 22:36:30 dawes Exp $ */
+
#include <stdio.h>
#include <math.h>
#include <errno.h>
@@ -52,14 +54,15 @@ copyright holders.
#include "Pcl.h"
#include "gcstruct.h"
#include "windowstr.h"
+#include "attributes.h"
static void
-PclDoArc( pDrawable, pGC, nArcs, pArcs, DoIt )
- DrawablePtr pDrawable;
- GCPtr pGC;
- int nArcs;
- xArc *pArcs;
- void (*DoIt)();
+PclDoArc(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int nArcs,
+ xArc *pArcs,
+ void (*DoIt)(FILE *, PclContextPrivPtr, double, double, xArc))
{
char t[80];
FILE *outFile;
@@ -140,7 +143,7 @@ PclDoArc( pDrawable, pGC, nArcs, pArcs, DoIt )
r.y1 = -Arc.height / 2 - fudge;
r.x2 = Arc.width / 2 + fudge;
r.y2 = Arc.height / 2 + fudge;
- drawRegion = miRegionCreate( &r, 0 );
+ drawRegion = REGION_CREATE( pGC->pScreen, &r, 0 );
SAVE_PCL( outFile, pConPriv, "\033%0A" );
MACRO_END( outFile );
@@ -148,14 +151,13 @@ PclDoArc( pDrawable, pGC, nArcs, pArcs, DoIt )
/*
* Intersect the bounding box with the clip region.
*/
- region = miRegionCreate( NULL, 0 );
- transClip = miRegionCreate( NULL, 0 );
- miRegionCopy( transClip,
- ((PclGCPrivPtr)pGC->devPrivates[PclGCPrivateIndex].ptr)
- ->pCompositeClip );
- miTranslateRegion( transClip, -(xoffset + Arc.x + Arc.width / 2),
+ region = REGION_CREATE( pGC->pScreen, NULL, 0 );
+ transClip = REGION_CREATE( pGC->pScreen, NULL, 0 );
+ REGION_COPY( pGC->pScreen, transClip, pGC->pCompositeClip );
+ REGION_TRANSLATE( pGC->pScreen, transClip,
+ -(xoffset + Arc.x + Arc.width / 2),
-(yoffset + Arc.y + Arc.height / 2) );
- miIntersect( region, drawRegion, transClip );
+ REGION_INTERSECT( pGC->pScreen, region, drawRegion, transClip );
/*
* For each rectangle in the clip region, set the HP-GL/2 "input
@@ -177,9 +179,9 @@ PclDoArc( pDrawable, pGC, nArcs, pArcs, DoIt )
/*
* Clean up the temporary regions
*/
- miRegionDestroy( drawRegion );
- miRegionDestroy( region );
- miRegionDestroy( transClip );
+ REGION_DESTROY( pGC->pScreen, drawRegion );
+ REGION_DESTROY( pGC->pScreen, region );
+ REGION_DESTROY( pGC->pScreen, transClip );
}
}
@@ -202,11 +204,11 @@ DrawArc(FILE *outFile,
}
void
-PclPolyArc( pDrawable, pGC, nArcs, pArcs )
- DrawablePtr pDrawable;
- GCPtr pGC;
- int nArcs;
- xArc *pArcs;
+PclPolyArc(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int nArcs,
+ xArc *pArcs)
{
PclDoArc( pDrawable, pGC, nArcs, pArcs, DrawArc );
}
@@ -246,11 +248,11 @@ DoChord(FILE *outFile,
void
-PclPolyFillArc( pDrawable, pGC, nArcs, pArcs )
- DrawablePtr pDrawable;
- GCPtr pGC;
- int nArcs;
- xArc *pArcs;
+PclPolyFillArc(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int nArcs,
+ xArc *pArcs)
{
switch( pGC->arcMode )
{
diff --git a/Xprint/pcl/PclArea.c b/Xprint/pcl/PclArea.c
index da3107d5a..971506da6 100644
--- a/Xprint/pcl/PclArea.c
+++ b/Xprint/pcl/PclArea.c
@@ -11,7 +11,7 @@
** * Created: 10/23/95
** *
** *********************************************************
-**
+**
********************************************************************/
/*
(c) Copyright 1996 Hewlett-Packard Company
@@ -44,6 +44,7 @@ not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from said
copyright holders.
*/
+/* $XFree86: xc/programs/Xserver/Xprint/pcl/PclArea.c,v 1.9 2001/10/28 03:32:54 tsi Exp $ */
#include <stdio.h>
#include <sys/types.h>
@@ -53,6 +54,9 @@ copyright holders.
#include "region.h"
#include "cfb.h"
+#if 1
+#include "cfb32.h"
+#endif
void
PclPutImage(DrawablePtr pDrawable,
@@ -72,10 +76,10 @@ PclPutImage(DrawablePtr pDrawable,
unsigned long oldPlanemask;
unsigned long i;
long bytesPer;
-
+
if( ( w == 0 ) || ( h == 0 ) )
return;
-
+
if( format != XYPixmap )
{
pPixmap = GetScratchPixmapHeader( pDrawable->pScreen,
@@ -85,7 +89,7 @@ PclPutImage(DrawablePtr pDrawable,
depth ), (pointer)pImage );
if( !pPixmap )
return;
-
+
if( format == ZPixmap )
(void)(*pGC->ops->CopyArea)( (DrawablePtr)pPixmap, pDrawable, pGC,
leftPad, 0, w, h, x, y );
@@ -104,7 +108,7 @@ PclPutImage(DrawablePtr pDrawable,
if( !pPixmap )
return;
-
+
depth = pGC->depth;
oldPlanemask = pGC->planemask;
oldFg = pGC->fgPixel;
@@ -113,12 +117,11 @@ PclPutImage(DrawablePtr pDrawable,
gcv[1] = 0;
DoChangeGC( pGC, GCForeground | GCBackground, gcv, 0 );
bytesPer = (long)h * BitmapBytePad( w + leftPad );
-
+
for( i = 1 << (depth-1); i != 0; i >>= 1, pImage += bytesPer )
{
if( i & oldPlanemask )
{
- extern void cfbPutImage(), cfb32PutImage();
gcv[0] = i;
DoChangeGC( pGC, GCPlaneMask, gcv, 0 );
ValidateGC( pDrawable, pGC );
@@ -160,16 +163,16 @@ PclMonoPixmapFragment(FILE *outFile,
{
char *bits, t[80], *row;
int h, w, i;
-
+
/*
* Create a storage area large enough to hold the entire pixmap,
- * then use mfbGetImage to get the appropriate bits.
+ * then use mfbGetImage to get the appropriate bits.
*/
h = y2 - y1;
w = BitmapBytePad( x2 - x1 );
-
+
bits = (char *)xalloc( h * w );
- mfbGetImage( (DrawablePtr)pix, x1, y1, x2 - x1, h,
+ mfbGetImage( (DrawablePtr)pix, x1, y1, x2 - x1, h,
XYPixmap, ~0, bits );
/*
@@ -179,7 +182,7 @@ PclMonoPixmapFragment(FILE *outFile,
*/
sprintf( t, "\033%%0BPU%d,%d;\033%%1A", dstx, dsty );
SEND_PCL( outFile, t );
-
+
/*
* Now, wrap the raster in the appropriate PCL code. Right now,
* it's going to go down the wire without any compression. That
@@ -188,14 +191,14 @@ PclMonoPixmapFragment(FILE *outFile,
sprintf( t, "\033*t300R\033*r%dT\033*r%dS\033*r1A\033*b0M",
h, x2 - x1 );
SEND_PCL( outFile, t );
-
+
sprintf( t, "\033*b%dW", w );
for( row = bits, i = 0; i <= h; i++, row += w )
{
SEND_PCL( outFile, t );
SEND_PCL_COUNT( outFile, row, w );
}
-
+
SEND_PCL( outFile, "\033*rC" );
/*
@@ -216,21 +219,20 @@ PclColorPixmapFragment(FILE *outFile,
{
char *bits, t[80], *row;
int h, w, i;
- extern void cfbGetImage(), cfb32GetImage();
-
+
/*
* Create a storage area large enough to hold the entire pixmap,
- * then use cfbGetImage to get the appropriate bits.
+ * then use cfbGetImage to get the appropriate bits.
*/
h = y2 - y1;
w = PixmapBytePad( x2 - x1, pix->drawable.depth );
-
+
bits = (char *)xalloc( h * w );
if (pix->drawable.depth <= 8)
- cfbGetImage( (DrawablePtr)pix, x1, y1, x2 - x1, h,
+ cfbGetImage( (DrawablePtr)pix, x1, y1, x2 - x1, h,
ZPixmap, ~0, bits );
else if (pix->drawable.depth <= 32)
- cfb32GetImage( (DrawablePtr)pix, x1, y1, x2 - x1, h,
+ cfb32GetImage( (DrawablePtr)pix, x1, y1, x2 - x1, h,
ZPixmap, ~0, bits );
/*
@@ -249,16 +251,16 @@ PclColorPixmapFragment(FILE *outFile,
sprintf( t, "\033*t300R\033*r%dt%ds1A\033*b0M",
h, x2 - x1 );
SEND_PCL( outFile, t );
-
+
sprintf( t, "\033*b%dW", w );
for( row = bits, i = 0; i < h; i++, row += w )
{
SEND_PCL( outFile, t );
SEND_PCL_COUNT( outFile, row, w );
}
-
+
SEND_PCL( outFile, "\033*rC" );
-
+
/*
* Clean things up a bit
*/
@@ -277,22 +279,20 @@ PclCopyArea(DrawablePtr pSrc,
int dsty)
{
PixmapPtr pixSrc = (PixmapPtr)pSrc;
- char t[80];
- FILE *srcFile, *dstFile;
- GC srcGC, dstGC;
+/*
+ FILE *srcFile;
+ GC srcGC;
+*/
+ FILE *dstFile;
+ GC dstGC;
unsigned long valid;
- struct stat statBuf;
- XpContextPtr pCon;
- xRectangle repro;
- PclPixmapPrivPtr pPriv;
RegionPtr drawRegion, region, whole, ret;
BoxRec box;
BoxPtr prect;
int nrect;
void (*doFragment)(FILE *, PixmapPtr, short, short, short, short,
short, short );
- extern RegionPtr mfbCopyArea(), cfbCopyArea(), cfb32CopyArea();
-
+
/*
* Since we don't store any information on a per-window basis, we
* can't copy from a window.
@@ -321,7 +321,7 @@ PclCopyArea(DrawablePtr pSrc,
PclGetDrawablePrivateStuff( pSrc, &srcGC, &valid, &srcFile );
*/
PclGetDrawablePrivateStuff( pDst, &dstGC, &valid, &dstFile );
-
+
/*
* If we're copying to a window, we have to do some actual
* drawing, instead of just handing it off to mfb or cfb. Start
@@ -331,14 +331,11 @@ PclCopyArea(DrawablePtr pSrc,
box.y1 = srcy;
box.x2 = srcx + width;
box.y2 = srcy + height;
- drawRegion = miRegionCreate( &box, 0 );
- miTranslateRegion( drawRegion, dstx, dsty );
-
- region = miRegionCreate( NULL, 0 );
- miIntersect( region, drawRegion,
- ((PclGCPrivPtr)
- (pGC->devPrivates[PclGCPrivateIndex].ptr))
- ->pCompositeClip );
+ drawRegion = REGION_CREATE( pGC->pScreen, &box, 0 );
+ REGION_TRANSLATE( pGC->pScreen, drawRegion, dstx, dsty );
+
+ region = REGION_CREATE( pGC->pScreen, NULL, 0 );
+ REGION_INTERSECT( pGC->pScreen, region, drawRegion, pGC->pCompositeClip );
/*
* Now select the operation to be performed on each box in the
@@ -348,7 +345,7 @@ PclCopyArea(DrawablePtr pSrc,
doFragment = PclMonoPixmapFragment;
else
doFragment = PclColorPixmapFragment;
-
+
/*
* Actually draw each section of the bitmap.
*/
@@ -360,18 +357,18 @@ PclCopyArea(DrawablePtr pSrc,
(*doFragment)( dstFile, (PixmapPtr)pSrc, prect->x1 - dstx,
prect->y1 - dsty, prect->x2 - dstx,
prect->y2 - dsty, prect->x1, prect->y1 );
-
+
nrect--;
prect++;
}
-
+
/*
* Update the destination's GC to the source's GC.
*/
/*
PclSetDrawablePrivateGC( pDst, srcGC );
*/
-
+
/*
* Determine the region that needs to be returned. This is the
* region of the source that falls outside the boundary of the
@@ -381,24 +378,24 @@ PclCopyArea(DrawablePtr pSrc,
box.y1 = 0;
box.x2 = pixSrc->drawable.width;
box.y2 = pixSrc->drawable.height;
- whole = miRegionCreate( &box, 0 );
- ret = miRegionCreate( NULL, 0 );
-
- miTranslateRegion( drawRegion, -dstx, -dsty );
- miSubtract( ret, drawRegion, whole );
-
+ whole = REGION_CREATE( pGC->pScreen, &box, 0 );
+ ret = REGION_CREATE( pGC->pScreen, NULL, 0 );
+
+ REGION_TRANSLATE( pGC->pScreen, drawRegion, -dstx, -dsty );
+ REGION_SUBTRACT( pGC->pScreen, ret, drawRegion, whole );
+
/*
* Clean up the regions
*/
- miRegionDestroy( drawRegion );
- miRegionDestroy( region );
- miRegionDestroy( whole );
-
- if( miRegionNotEmpty( ret ) )
+ REGION_DESTROY( pGC->pScreen, drawRegion );
+ REGION_DESTROY( pGC->pScreen, region );
+ REGION_DESTROY( pGC->pScreen, whole );
+
+ if( REGION_NOTEMPTY( pGC->pScreen, ret ) )
return ret;
else
{
- miRegionDestroy( ret );
+ REGION_DESTROY( pGC->pScreen, ret );
return NULL;
}
}
@@ -418,20 +415,19 @@ PclCopyPlane(DrawablePtr pSrc,
RegionPtr reg;
GCPtr scratchGC;
PixmapPtr scratchPix;
- extern RegionPtr mfbCopyPlane(), cfbCopyPlane(), cfb32CopyPlane();
-
+
/*
* Since we don't store PCL on a per-window basis, there's no good
* way to copy from a window.
*/
if( pSrc->type == DRAWABLE_WINDOW )
return NULL;
-
+
/*
* Copying from a pixmap to a pixmap is already implemented by
* mfb/cfb.
*/
- if( pSrc->type == DRAWABLE_PIXMAP &&
+ if( pSrc->type == DRAWABLE_PIXMAP &&
pDst->type == DRAWABLE_PIXMAP )
{
if( pDst->depth == 1 )
@@ -452,7 +448,7 @@ PclCopyPlane(DrawablePtr pSrc,
*/
scratchPix = (*pDst->pScreen->CreatePixmap)( pDst->pScreen, width,
height, pDst->depth );
-
+
scratchGC = GetScratchGC( pDst->depth, pDst->pScreen );
CopyGC( pGC, scratchGC, ~0L );
@@ -474,14 +470,13 @@ PclCopyPlane(DrawablePtr pSrc,
cfb32CopyPlane( pSrc, (DrawablePtr)scratchPix, scratchGC,
srcx, srcy, width, height, 0, 0, plane );
}
-
+
reg = PclCopyArea( (DrawablePtr)scratchPix, pDst, pGC, 0, 0, width,
height, dstx, dsty );
-
+
FreeScratchGC( scratchGC );
-
+
(*pDst->pScreen->DestroyPixmap)( scratchPix );
-
+
return reg;
}
-
diff --git a/Xprint/pcl/PclColor.c b/Xprint/pcl/PclColor.c
index cd3d2cc12..807e711de 100644
--- a/Xprint/pcl/PclColor.c
+++ b/Xprint/pcl/PclColor.c
@@ -45,10 +45,12 @@ not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from said
copyright holders.
*/
+/* $XFree86: xc/programs/Xserver/Xprint/pcl/PclColor.c,v 1.9 2001/10/28 03:32:54 tsi Exp $ */
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
+#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
#include <math.h>
@@ -58,18 +60,7 @@ copyright holders.
#include "resource.h"
#include "Pcl.h"
-
-PclPaletteMapPtr PclFindPaletteMap(PclContextPrivPtr cPriv,
- ColormapPtr cmap,
- GCPtr gc);
-
-unsigned char *PclReadMap(char *, int *);
-
-void PclLookUp( ColormapPtr cmap,
- PclContextPrivPtr cPriv,
- unsigned short *r,
- unsigned short *g,
- unsigned short *b);
+#include "cfb.h"
static void lookup(unsigned char *src,
unsigned char *dst,
@@ -166,7 +157,7 @@ void
PclDestroyColormap(ColormapPtr pColor)
{
PclScreenPrivPtr sPriv;
- PclCmapToContexts *pCmap, *tCmap;
+ PclCmapToContexts *pCmap, *tCmap = 0;
PclContextListPtr con, tCon;
PclContextPrivPtr cPriv;
PclPaletteMapPtr pPal;
@@ -263,7 +254,7 @@ PclStoreColors(ColormapPtr pColor,
PclContextListPtr con;
PclContextPrivPtr cPriv;
PclPaletteMapPtr pMap;
- char t[80], t2[30];
+ char t[80];
int i;
sPriv = (PclScreenPrivPtr)pColor->pScreen
@@ -425,7 +416,7 @@ PclUpdateColormap(DrawablePtr pDrawable,
* If the requested colormap is already active, nothing needs to
* be done.
*/
- return;
+ return FALSE;
/*
* Now we activate the palette in the printer
@@ -478,10 +469,10 @@ PclUpdateColormap(DrawablePtr pDrawable,
SEND_PCL_COUNT( cPriv->pPageFile, t, 6 );
/* Now program the two colors */
- sprintf( t, "\033*v0a0b0c%dI", cmap->pScreen->blackPixel );
+ sprintf( t, "\033*v0a0b0c%ldI", (long) cmap->pScreen->blackPixel );
SEND_PCL( cPriv->pPageFile, t );
- sprintf( t, "\033*v32767a32767b32767c%dI",
- cmap->pScreen->whitePixel );
+ sprintf( t, "\033*v32767a32767b32767c%ldI",
+ (long) cmap->pScreen->whitePixel );
SEND_PCL( cPriv->pPageFile, t );
#endif /* XP_PCL_COLOR */
}
@@ -637,6 +628,7 @@ PclUpdateColormap(DrawablePtr pDrawable,
}
pMap->downloaded = 1;
}
+ return TRUE;
}
@@ -725,7 +717,7 @@ unsigned char *PclReadMap(char *name, int *dim)
fseek(fp, 0, SEEK_SET);
- if (fread(data, sizeof(char), size, fp) != size) {
+ if (fread(data, sizeof(char), size, fp) != (unsigned) size) {
fclose(fp);
free(data);
return(NULL);
@@ -746,11 +738,11 @@ unsigned char *PclReadMap(char *name, int *dim)
static void lookup(unsigned char *src, unsigned char *dst, int num, unsigned char *map, int dim)
{
int i;
- unsigned char *p1, *p2, *p3;
- int shift, offset;
#define _INTERPOLATE
#ifndef _INTERPOLATE
+ unsigned char *p1, *p2, *p3;
+
for (i=0; i<num; i++) {
p1 = map + (SCL(src[0])*dim*dim + SCL(src[1])*dim + SCL(src[2])) * 3;
*dst++ = *p1++;
@@ -794,7 +786,7 @@ static void trilinear(unsigned char *p, unsigned char *out, unsigned char *d, in
d000, d001, d010, d011,
d100, d101, d110, d111,
dx00, dx01, dx10, dx11,
- dxy0, dxy1, dxyz;
+ dxy0, dxy1;
float scale;
scale = 255.0 / (dim-1);
diff --git a/Xprint/pcl/PclCursor.c b/Xprint/pcl/PclCursor.c
index 88a76f6bf..7e463d498 100644
--- a/Xprint/pcl/PclCursor.c
+++ b/Xprint/pcl/PclCursor.c
@@ -44,6 +44,7 @@ not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from said
copyright holders.
*/
+/* $XFree86: xc/programs/Xserver/Xprint/pcl/PclCursor.c,v 1.4 2001/01/17 22:36:30 dawes Exp $ */
#include <stdio.h>
@@ -52,59 +53,59 @@ copyright holders.
#include "windowstr.h"
void
-PclConstrainCursor( pScreen, pBox )
- ScreenPtr pScreen;
- BoxPtr pBox;
+PclConstrainCursor(
+ ScreenPtr pScreen,
+ BoxPtr pBox)
{
}
void
-PclCursorLimits( pScreen, pCursor, pHotBox, pTopLeftBox )
- ScreenPtr pScreen;
- CursorPtr pCursor;
- BoxPtr pHotBox;
- BoxPtr pTopLeftBox;
+PclCursorLimits(
+ ScreenPtr pScreen,
+ CursorPtr pCursor,
+ BoxPtr pHotBox,
+ BoxPtr pTopLeftBox)
{
}
Bool
-PclDisplayCursor( pScreen, pCursor )
- ScreenPtr pScreen;
- CursorPtr pCursor;
+PclDisplayCursor(
+ ScreenPtr pScreen,
+ CursorPtr pCursor)
{
return True;
}
Bool
-PclRealizeCursor( pScreen, pCursor )
- ScreenPtr pScreen;
- CursorPtr pCursor;
+PclRealizeCursor(
+ ScreenPtr pScreen,
+ CursorPtr pCursor)
{
return True;
}
Bool
-PclUnrealizeCursor( pScreen, pCursor )
- ScreenPtr pScreen;
- CursorPtr pCursor;
+PclUnrealizeCursor(
+ ScreenPtr pScreen,
+ CursorPtr pCursor)
{
return True;
}
void
-PclRecolorCursor( pScreen, pCursor, displayed )
- ScreenPtr pScreen;
- CursorPtr pCursor;
- Bool displayed;
+PclRecolorCursor(
+ ScreenPtr pScreen,
+ CursorPtr pCursor,
+ Bool displayed)
{
}
Bool
-PclSetCursorPosition( pScreen, x, y, generateEvent )
- ScreenPtr pScreen;
- int x;
- int y;
- Bool generateEvent;
+PclSetCursorPosition(
+ ScreenPtr pScreen,
+ int x,
+ int y,
+ Bool generateEvent)
{
return True;
}
diff --git a/Xprint/pcl/PclGC.c b/Xprint/pcl/PclGC.c
index 7f0039e1f..e1fe772bd 100644
--- a/Xprint/pcl/PclGC.c
+++ b/Xprint/pcl/PclGC.c
@@ -44,6 +44,7 @@ not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from said
copyright holders.
*/
+/* $XFree86: xc/programs/Xserver/Xprint/pcl/PclGC.c,v 1.10 2001/10/28 03:32:54 tsi Exp $ */
#include "gcstruct.h"
@@ -51,6 +52,8 @@ copyright holders.
#include "pixmapstr.h"
#include "colormapst.h"
#include "windowstr.h"
+#include "cfb.h"
+#include "cfb32.h"
#include "migc.h"
#include "scrnintstr.h"
#include "resource.h"
@@ -97,11 +100,8 @@ static GCFuncs PclGCFuncs =
;
Bool
-PclCreateGC( pGC )
- GCPtr pGC;
+PclCreateGC(GCPtr pGC)
{
- PclGCPrivPtr pPriv = pGC->devPrivates[PclGCPrivateIndex].ptr;
-
if( pGC->depth == 1 )
{
if( mfbCreateGC( pGC ) == FALSE )
@@ -125,36 +125,25 @@ PclCreateGC( pGC )
pGC->ops = &PclGCOps;
pGC->funcs = &PclGCFuncs;
- pPriv->pCompositeClip = NULL;
- pPriv->freeCompClip = FALSE;
-
return TRUE;
}
void
PclDestroyGC(GCPtr pGC)
{
- PclGCPrivPtr pPriv = pGC->devPrivates[PclGCPrivateIndex].ptr;
- extern int mfbGCPrivateIndex;
-
/* Handle the mfb and cfb, which share a GC private struct */
- miRegisterGCPrivateIndex( mfbGCPrivateIndex );
miDestroyGC( pGC );
-
- if( pPriv->freeCompClip == TRUE )
- REGION_DESTROY( pGC->pScreen, pPriv->pCompositeClip );
}
int
-PclGetDrawablePrivateStuff( pDrawable, gc, valid, file )
- DrawablePtr pDrawable;
- GC *gc;
- unsigned long *valid;
- FILE **file;
+PclGetDrawablePrivateStuff(
+ DrawablePtr pDrawable,
+ GC *gc,
+ unsigned long *valid,
+ FILE **file)
{
XpContextPtr pCon;
- PclPixmapPrivPtr pPriv;
PclContextPrivPtr cPriv;
switch( pDrawable->type )
@@ -185,9 +174,9 @@ PclGetDrawablePrivateStuff( pDrawable, gc, valid, file )
}
void
-PclSetDrawablePrivateGC( pDrawable, gc )
- DrawablePtr pDrawable;
- GC gc;
+PclSetDrawablePrivateGC(
+ DrawablePtr pDrawable,
+ GC gc)
{
PixmapPtr pix;
XpContextPtr pCon;
@@ -332,19 +321,17 @@ PclSendPattern(char *bits,
}
int
-PclUpdateDrawableGC( pGC, pDrawable, outFile )
- GCPtr pGC;
- DrawablePtr pDrawable;
- FILE **outFile;
+PclUpdateDrawableGC(
+ GCPtr pGC,
+ DrawablePtr pDrawable,
+ FILE **outFile)
{
- Mask drawableMask, changeMask = 0;
+ Mask changeMask = 0;
GC dGC;
unsigned long valid;
int i;
XpContextPtr pCon;
PclContextPrivPtr cPriv;
- Colormap c;
- ColormapPtr cmap;
PclGCPrivPtr gcPriv = (PclGCPrivPtr)
(pGC->devPrivates[PclGCPrivateIndex].ptr);
@@ -403,12 +390,14 @@ PclUpdateDrawableGC( pGC, pDrawable, outFile )
changeMask |= GCTileStipYOrigin;
if( dGC.numInDashList == pGC->numInDashList )
+ {
for( i = 0; i < dGC.numInDashList; i++ )
if( cPriv->dash[i] != pGC->dash[i] )
{
changeMask |= GCDashList;
break;
}
+ }
else
changeMask |= GCDashList;
}
@@ -513,9 +502,11 @@ PclUpdateDrawableGC( pGC, pDrawable, outFile )
if( changeMask & GCForeground )
{
+#ifdef XP_PCL_COLOR
+ ColormapPtr cmap;
+ Colormap c;
char t[40];
-#ifdef XP_PCL_COLOR
c = wColormap( ((WindowPtr)pDrawable) );
cmap = (ColormapPtr)LookupIDByType( c, RT_COLORMAP );
@@ -538,7 +529,7 @@ PclUpdateDrawableGC( pGC, pDrawable, outFile )
}
else /* PseudoColor or StaticGray */
{
- sprintf( t, "SP%d;", pGC->fgPixel );
+ sprintf( t, "SP%ld;", (long) pGC->fgPixel );
SEND_PCL( *outFile, t );
}
#else
@@ -654,9 +645,8 @@ PclUpdateDrawableGC( pGC, pDrawable, outFile )
if( changeMask & GCTile && !pGC->tileIsPixel )
{
- char t[80], *bits, *row, *mod;
- int h, w, w2, sz;
- int i, j;
+ char *bits;
+ int h, w, sz;
h = pGC->tile.pixmap->drawable.height;
w = pGC->tile.pixmap->drawable.width;
@@ -666,7 +656,7 @@ PclUpdateDrawableGC( pGC, pDrawable, outFile )
sz = h * BitmapBytePad( w );
bits = (char *)xalloc( sz );
- mfbGetImage(pGC->tile.pixmap, 0, 0, w, h, XYPixmap, ~0, bits);
+ mfbGetImage(&(pGC->tile.pixmap->drawable), 0, 0, w, h, XYPixmap, ~0, bits);
PclSendPattern( bits, sz, 1, h, w, 100, *outFile );
xfree( bits );
}
@@ -674,7 +664,7 @@ PclUpdateDrawableGC( pGC, pDrawable, outFile )
{
sz = h * PixmapBytePad( w, 8 );
bits = (char *)xalloc( sz );
- cfbGetImage(pGC->tile.pixmap, 0, 0, w, h, ZPixmap, ~0, bits);
+ cfbGetImage(&(pGC->tile.pixmap->drawable), 0, 0, w, h, ZPixmap, ~0, bits);
PclSendPattern( bits, sz, 8, h, w, 100, *outFile );
xfree( bits );
}
@@ -684,7 +674,7 @@ PclUpdateDrawableGC( pGC, pDrawable, outFile )
sz = h * PixmapBytePad( w, 24 );
bits = (char *)xalloc( sz );
- cfb32GetImage(pGC->tile.pixmap, 0, 0, w, h, ZPixmap, ~0, bits);
+ cfb32GetImage(&(pGC->tile.pixmap->drawable), 0, 0, w, h, ZPixmap, ~0, bits);
PclSendPattern( bits, sz, 24, h, w, 100, *outFile );
xfree( bits );
}
@@ -723,7 +713,7 @@ PclUpdateDrawableGC( pGC, pDrawable, outFile )
sz = h * BitmapBytePad( w );
bits = (char *)xalloc( sz );
- mfbGetImage( pGC->stipple, 0, 0, w, h, XYPixmap, ~0, bits );
+ mfbGetImage( &(pGC->stipple->drawable), 0, 0, w, h, XYPixmap, ~0, bits );
w2 = ( w / 8 ) + ( ( w%8 ) ? 1 : 0 );
/*
@@ -766,10 +756,10 @@ PclUpdateDrawableGC( pGC, pDrawable, outFile )
{
mfbValidateGC( scratchGC, ~0L,
(DrawablePtr)scratchPix );
- mfbCopyPlane( pGC->stipple,
+ mfbCopyPlane( &(pGC->stipple->drawable),
(DrawablePtr)scratchPix, scratchGC, 0,
0, w, h, 0, 0, 1 );
- mfbGetImage( scratchPix, 0, 0, w, h, XYPixmap, ~0,
+ mfbGetImage( &(scratchPix->drawable), 0, 0, w, h, XYPixmap, ~0,
bits );
}
else if( pGC->depth <= 32 )
@@ -777,10 +767,10 @@ PclUpdateDrawableGC( pGC, pDrawable, outFile )
#if PSZ == 8
cfbValidateGC( scratchGC, ~0L,
(DrawablePtr)scratchPix );
- cfbCopyPlane( pGC->stipple,
+ cfbCopyPlane( &(pGC->stipple->drawable),
(DrawablePtr)scratchPix, scratchGC, 0,
0, w, h, 0, 0, 1 );
- cfbGetImage( scratchPix, 0, 0, w, h, ZPixmap, ~0,
+ cfbGetImage( &(scratchPix->drawable), 0, 0, w, h, ZPixmap, ~0,
bits );
#else
cfb32ValidateGC( scratchGC, ~0L,
@@ -868,14 +858,10 @@ PclUpdateDrawableGC( pGC, pDrawable, outFile )
void
-PclComputeCompositeClip(pGC, pDrawable)
- GCPtr pGC;
- DrawablePtr pDrawable;
+PclComputeCompositeClip(
+ GCPtr pGC,
+ DrawablePtr pDrawable)
{
- ScreenPtr pScreen = pGC->pScreen;
- PclGCPrivPtr devPriv = (PclGCPrivPtr)
- (pGC->devPrivates[PclGCPrivateIndex].ptr);
-
if (pDrawable->type == DRAWABLE_WINDOW)
{
WindowPtr pWin = (WindowPtr) pDrawable;
@@ -892,7 +878,7 @@ PclComputeCompositeClip(pGC, pDrawable)
pregWin = &pWin->clipList;
freeTmpClip = FALSE;
}
- freeCompClip = devPriv->freeCompClip;
+ freeCompClip = pGC->freeCompClip;
/*
* if there is no client clip, we can get by with just keeping the
@@ -904,9 +890,9 @@ PclComputeCompositeClip(pGC, pDrawable)
if (pGC->clientClipType == CT_NONE)
{
if (freeCompClip)
- REGION_DESTROY(pScreen, devPriv->pCompositeClip);
- devPriv->pCompositeClip = pregWin;
- devPriv->freeCompClip = freeTmpClip;
+ REGION_DESTROY(pGC->pScreen, pGC->pCompositeClip);
+ pGC->pCompositeClip = pregWin;
+ pGC->freeCompClip = freeTmpClip;
}
else
{
@@ -919,30 +905,31 @@ PclComputeCompositeClip(pGC, pDrawable)
* clip. if neither is real, create a new region.
*/
- REGION_TRANSLATE(pScreen, pGC->clientClip,
+ REGION_TRANSLATE(pGC->pScreen, pGC->clientClip,
pDrawable->x + pGC->clipOrg.x,
pDrawable->y + pGC->clipOrg.y);
if (freeCompClip)
{
- REGION_INTERSECT(pGC->pScreen, devPriv->pCompositeClip,
+ REGION_INTERSECT(pGC->pScreen, pGC->pCompositeClip,
pregWin, pGC->clientClip);
if (freeTmpClip)
- REGION_DESTROY(pScreen, pregWin);
+ REGION_DESTROY(pGC->pScreen, pregWin);
}
else if (freeTmpClip)
{
- REGION_INTERSECT(pScreen, pregWin, pregWin, pGC->clientClip);
- devPriv->pCompositeClip = pregWin;
+ REGION_INTERSECT(pGC->pScreen, pregWin, pregWin,
+ pGC->clientClip);
+ pGC->pCompositeClip = pregWin;
}
else
{
- devPriv->pCompositeClip = REGION_CREATE(pScreen, NullBox, 0);
- REGION_INTERSECT(pScreen, devPriv->pCompositeClip,
+ pGC->pCompositeClip = REGION_CREATE(pGC->pScreen, NullBox, 0);
+ REGION_INTERSECT(pGC->pScreen, pGC->pCompositeClip,
pregWin, pGC->clientClip);
}
- devPriv->freeCompClip = TRUE;
- REGION_TRANSLATE(pScreen, pGC->clientClip,
+ pGC->freeCompClip = TRUE;
+ REGION_TRANSLATE(pGC->pScreen, pGC->clientClip,
-(pDrawable->x + pGC->clipOrg.x),
-(pDrawable->y + pGC->clipOrg.y));
}
@@ -957,23 +944,23 @@ PclComputeCompositeClip(pGC, pDrawable)
pixbounds.x2 = pDrawable->width;
pixbounds.y2 = pDrawable->height;
- if (devPriv->freeCompClip)
+ if (pGC->freeCompClip)
{
- REGION_RESET(pScreen, devPriv->pCompositeClip, &pixbounds);
+ REGION_RESET(pGC->pScreen, pGC->pCompositeClip, &pixbounds);
}
else
{
- devPriv->freeCompClip = TRUE;
- devPriv->pCompositeClip = REGION_CREATE(pScreen, &pixbounds, 1);
+ pGC->freeCompClip = TRUE;
+ pGC->pCompositeClip = REGION_CREATE(pGC->pScreen, &pixbounds, 1);
}
if (pGC->clientClipType == CT_REGION)
{
- REGION_TRANSLATE(pScreen, devPriv->pCompositeClip,
+ REGION_TRANSLATE(pGC->pScreen, pGC->pCompositeClip,
-pGC->clipOrg.x, -pGC->clipOrg.y);
- REGION_INTERSECT(pScreen, devPriv->pCompositeClip,
- devPriv->pCompositeClip, pGC->clientClip);
- REGION_TRANSLATE(pScreen, devPriv->pCompositeClip,
+ REGION_INTERSECT(pGC->pScreen, pGC->pCompositeClip,
+ pGC->pCompositeClip, pGC->clientClip);
+ REGION_TRANSLATE(pGC->pScreen, pGC->pCompositeClip,
pGC->clipOrg.x, pGC->clipOrg.y);
}
} /* end of composite clip for pixmap */
@@ -992,16 +979,11 @@ PclComputeCompositeClip(pGC, pDrawable)
/*ARGSUSED*/
void
-PclValidateGC( pGC, changes, pDrawable )
- GCPtr pGC;
- Mask changes;
- DrawablePtr pDrawable;
+PclValidateGC(
+ GCPtr pGC,
+ unsigned long changes,
+ DrawablePtr pDrawable)
{
- XpContextPtr pCon;
- PclContextPrivPtr pConPriv;
- extern int mfbGCPrivateIndex;
- extern int cfbGCPrivateIndex;
-
/*
* Pixmaps should be handled by their respective validation
* functions.
@@ -1010,16 +992,13 @@ PclValidateGC( pGC, changes, pDrawable )
{
if( pDrawable->depth == 1 )
{
- miRegisterGCPrivateIndex( mfbGCPrivateIndex );
mfbValidateGC( pGC, ~0, pDrawable );
}
else if( pDrawable->depth <= 32 )
{
#if PSZ == 8
- miRegisterGCPrivateIndex( cfbGCPrivateIndex );
cfbValidateGC( pGC, ~0, pDrawable );
#else
- miRegisterGCPrivateIndex( cfbGCPrivateIndex );
cfb32ValidateGC( pGC, ~0, pDrawable );
#endif
}
@@ -1061,4 +1040,3 @@ PclValidateGC( pGC, changes, pDrawable )
PclSetDrawablePrivateGC( pDrawable, *pGC, changes );
*/
}
-
diff --git a/Xprint/pcl/PclInit.c b/Xprint/pcl/PclInit.c
index 791a33dfe..5ee49631e 100644
--- a/Xprint/pcl/PclInit.c
+++ b/Xprint/pcl/PclInit.c
@@ -76,30 +76,26 @@ not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from said
copyright holders.
*/
+/* $XFree86: xc/programs/Xserver/Xprint/pcl/PclInit.c,v 1.12 2002/10/16 21:13:32 dawes Exp $ */
#include <stdio.h>
#include <string.h>
+#include <sys/types.h>
#include <sys/wait.h>
#include "Pcl.h"
-#include "AttrValid.h"
#include "cfb.h"
+#include "Xos.h" /* for unlink() */
#include "attributes.h"
-#include "windowstr.h"
+#include "DiPrint.h"
#define MODELDIRNAME "/models"
-extern char *XpGetConfigDir();
-static void AllocatePclPrivates(
- ScreenPtr pScreen);
+static void AllocatePclPrivates(ScreenPtr pScreen);
static int PclInitContext(XpContextPtr pCon);
-
-extern Bool _XpBoolNoop();
-extern void _XpVoidNoop();
-
-extern unsigned char *PclReadMap(char *, int *);
+static Bool PclDestroyContext(XpContextPtr pCon);
int PclScreenPrivateIndex;
int PclContextPrivateIndex;
@@ -153,46 +149,24 @@ Bool
PclCloseScreen(int index,
ScreenPtr pScreen)
{
- Bool status = Success;
PclScreenPrivPtr pPriv = pScreen->devPrivates[PclScreenPrivateIndex].ptr;
-/*
- if( pPriv->CloseScreen != (Bool (*)())NULL )
- {
- pScreen->CloseScreen = pPriv->CloseScreen;
- status = pScreen->CloseScreen( index, pScreen );
- pScreen->CloseScreen = PclCloseScreen;
- }
-*/
-
- /*
- * Finish cleaning up cfb (code taken from cfbCloseScreen)
- */
-#ifdef XP_PCL_COLOR
-#ifdef CFB_NEED_SCREEN_PRIVATE
- xfree( pScreen->devPrivates[cfbScreenPrivateIndex].ptr );
-#else
- xfree( pScreen->devPrivate );
-#endif
-#endif
-
+ pScreen->CloseScreen = pPriv->CloseScreen;
xfree( pPriv );
- return status;
+ return (*pScreen->CloseScreen)(index, pScreen);
}
Bool
-InitializePclDriver(ndx, pScreen, argc, argv)
- int ndx;
- ScreenPtr pScreen;
- int argc;
- char **argv;
+InitializePclDriver(
+ int ndx,
+ ScreenPtr pScreen,
+ int argc,
+ char **argv)
{
- int maxRes, xRes, yRes, maxWidth, maxHeight, maxDim, numBytes;
- int i;
+ int maxRes, xRes, yRes, maxDim;
+ unsigned i;
PclScreenPrivPtr pPriv;
- char **printerNames;
- int numPrinters;
/*
* Register this driver's InitContext function with the print
@@ -227,7 +201,7 @@ InitializePclDriver(ndx, pScreen, argc, argv)
/*
* Clean up the fields that we stomp (code taken from cfbCloseScreen)
*/
- for( i = 0; i < pScreen->numDepths; i++ )
+ for( i = 0; (int) i < pScreen->numDepths; i++ )
xfree( pScreen->allowedDepths[i].vids );
xfree( pScreen->allowedDepths );
xfree( pScreen->visuals );
@@ -236,19 +210,19 @@ InitializePclDriver(ndx, pScreen, argc, argv)
maxRes );
#endif /* XP_PCL_COLOR */
+ miInitializeBackingStore ( pScreen );
+
pScreen->defColormap = FakeClientID(0);
pScreen->blackPixel = 1;
pScreen->whitePixel = 0;
-/*
pPriv->CloseScreen = pScreen->CloseScreen;
-*/
pScreen->CloseScreen = PclCloseScreen;
pScreen->QueryBestSize = (QueryBestSizeProcPtr)PclQueryBestSize;
- pScreen->SaveScreen = _XpBoolNoop;
- pScreen->GetImage = _XpVoidNoop;
- pScreen->GetSpans = _XpVoidNoop;
+ pScreen->SaveScreen = (SaveScreenProcPtr)_XpBoolNoop;
+ pScreen->GetImage = (GetImageProcPtr)_XpVoidNoop;
+ pScreen->GetSpans = (GetSpansProcPtr)_XpVoidNoop;
pScreen->CreateWindow = PclCreateWindow;
pScreen->DestroyWindow = PclDestroyWindow;
/*
@@ -316,30 +290,29 @@ InitializePclDriver(ndx, pScreen, argc, argv)
}
static void
-AllocatePclPrivates(
- ScreenPtr pScreen)
+AllocatePclPrivates(ScreenPtr pScreen)
{
- static int PclGeneration = -1;
+ static unsigned long PclGeneration = 0;
- if(PclGeneration != serverGeneration)
+ if((unsigned long) PclGeneration != serverGeneration)
{
PclScreenPrivateIndex = AllocateScreenPrivateIndex();
PclWindowPrivateIndex = AllocateWindowPrivateIndex();
- AllocateWindowPrivate( pScreen, PclWindowPrivateIndex,
- sizeof( PclWindowPrivRec ) );
+ AllocateWindowPrivate( pScreen, PclWindowPrivateIndex,
+ sizeof( PclWindowPrivRec ) );
PclContextPrivateIndex = XpAllocateContextPrivateIndex();
- XpAllocateContextPrivate( PclContextPrivateIndex,
- sizeof( PclContextPrivRec ) );
+ XpAllocateContextPrivate( PclContextPrivateIndex,
+ sizeof( PclContextPrivRec ) );
PclGCPrivateIndex = AllocateGCPrivateIndex();
- AllocateGCPrivate( pScreen, PclGCPrivateIndex,
- sizeof( PclGCPrivRec ) );
+ AllocateGCPrivate( pScreen, PclGCPrivateIndex,
+ sizeof( PclGCPrivRec ) );
PclPixmapPrivateIndex = AllocatePixmapPrivateIndex();
- AllocatePixmapPrivate( pScreen, PclPixmapPrivateIndex,
- sizeof( PclPixmapPrivRec ) );
+ AllocatePixmapPrivate( pScreen, PclPixmapPrivateIndex,
+ sizeof( PclPixmapPrivRec ) );
PclGeneration = serverGeneration;
}
@@ -364,8 +337,7 @@ static char PAGE_ATT_VAL[]="content-orientation default-printer-resolution \
default-input-tray default-medium plex";
static int
-PclInitContext( pCon )
- XpContextPtr pCon;
+PclInitContext(XpContextPtr pCon)
{
XpDriverFuncsPtr pFuncs;
PclContextPrivPtr pConPriv;
@@ -373,7 +345,6 @@ PclInitContext( pCon )
char *modelID;
char *configDir;
char *pathName;
- extern XpValidatePoolsRec PclValidatePoolsRec;
int i, j;
float width, height;
XpOidMediumDiscreteSizeList* ds_list;
@@ -392,16 +363,16 @@ PclInitContext( pCon )
pFuncs = &( pCon->funcs );
pFuncs->StartJob = PclStartJob;
pFuncs->EndJob = PclEndJob;
- pFuncs->StartDoc = (int (*)())PclStartDoc;
+ pFuncs->StartDoc = PclStartDoc;
pFuncs->EndDoc = PclEndDoc;
pFuncs->StartPage = PclStartPage;
pFuncs->EndPage = PclEndPage;
pFuncs->PutDocumentData = PclDocumentData;
pFuncs->GetDocumentData = PclGetDocumentData;
- pFuncs->GetAttributes = (char *(*)())PclGetAttributes;
- pFuncs->SetAttributes = (int (*)())PclSetAttributes;
- pFuncs->AugmentAttributes = (int (*)())PclAugmentAttributes;
- pFuncs->GetOneAttribute = (char *(*)())PclGetOneAttribute;
+ pFuncs->GetAttributes = PclGetAttributes;
+ pFuncs->SetAttributes = PclSetAttributes;
+ pFuncs->AugmentAttributes = PclAugmentAttributes;
+ pFuncs->GetOneAttribute = PclGetOneAttribute;
pFuncs->DestroyContext = PclDestroyContext;
pFuncs->GetMediumDimensions = PclGetMediumDimensions;
pFuncs->GetReproducibleArea = PclGetReproducibleArea;
@@ -541,8 +512,7 @@ PclInitContext( pCon )
}
static Bool
-PclDestroyContext( pCon )
- XpContextPtr pCon;
+PclDestroyContext(XpContextPtr pCon)
{
PclContextPrivPtr pConPriv = (PclContextPrivPtr)
pCon->devPrivates[PclContextPrivateIndex].ptr;
@@ -639,8 +609,7 @@ PclDestroyContext( pCon )
}
XpContextPtr
-PclGetContextFromWindow( win )
- WindowPtr win;
+PclGetContextFromWindow(WindowPtr win)
{
PclWindowPrivPtr pPriv;
diff --git a/Xprint/pcl/PclLine.c b/Xprint/pcl/PclLine.c
index 271bdfb16..3c10f97ca 100644
--- a/Xprint/pcl/PclLine.c
+++ b/Xprint/pcl/PclLine.c
@@ -11,7 +11,7 @@
** * Created: 10/11/95
** *
** *********************************************************
-**
+**
********************************************************************/
/*
(c) Copyright 1996 Hewlett-Packard Company
@@ -44,6 +44,7 @@ not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from said
copyright holders.
*/
+/* $XFree86: xc/programs/Xserver/Xprint/pcl/PclLine.c,v 1.7 2001/01/17 22:36:30 dawes Exp $ */
#include "Pcl.h"
#include "gcstruct.h"
@@ -80,16 +81,16 @@ copyright holders.
*/
void
-PclPolyLine( pDrawable, pGC, mode, nPoints, pPoints )
- DrawablePtr pDrawable;
- GCPtr pGC;
- int mode;
- int nPoints;
- xPoint *pPoints;
+PclPolyLine(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int mode,
+ int nPoints,
+ xPoint *pPoints)
{
- char t[80], window[80];
+ char t[80];
FILE *outFile;
- int xoffset, yoffset;
+ int xoffset = 0, yoffset = 0;
int nbox;
BoxPtr pbox;
xRectangle *drawRects, *r;
@@ -98,7 +99,7 @@ PclPolyLine( pDrawable, pGC, mode, nPoints, pPoints )
int i;
XpContextPtr pCon;
PclContextPrivPtr pConPriv;
-
+
if( PclUpdateDrawableGC( pGC, pDrawable, &outFile ) == FALSE )
return;
@@ -110,7 +111,7 @@ PclPolyLine( pDrawable, pGC, mode, nPoints, pPoints )
* Allocate the storage required to deal with the clipping
* regions.
*/
- region = miRegionCreate( NULL, 0 );
+ region = REGION_CREATE( pGC->pScreen, NULL, 0 );
drawRects = (xRectangle *)
xalloc( ( nPoints - 1 ) * sizeof( xRectangle ) );
@@ -120,7 +121,7 @@ PclPolyLine( pDrawable, pGC, mode, nPoints, pPoints )
* XXX I need to think of a way to test this.
*/
fudge = 3 * pGC->lineWidth + 1;
-
+
/*
* Generate the PCL code to draw the polyline, by defining it as a
* macro which uses the HP-GL/2 line drawing function.
@@ -132,20 +133,20 @@ PclPolyLine( pDrawable, pGC, mode, nPoints, pPoints )
sprintf( t, "PU%d,%dPD\n", pPoints[0].x + pDrawable->x,
pPoints[0].y + pDrawable->y );
SAVE_PCL( outFile, pConPriv, t ); /* Move to the start of the polyline */
-
+
switch( mode )
{
case CoordModeOrigin:
xoffset = pDrawable->x;
yoffset = pDrawable->y;
- SAVE_PCL( outFile, pConPriv, "PA" );
+ SAVE_PCL( outFile, pConPriv, "PA" );
break;
case CoordModePrevious:
xoffset = yoffset = 0;
- SAVE_PCL( outFile, pConPriv, "PR" );
+ SAVE_PCL( outFile, pConPriv, "PR" );
break;
}
-
+
/*
* Build the "drawing region" as we build the PCL to draw the
* line.
@@ -154,13 +155,13 @@ PclPolyLine( pDrawable, pGC, mode, nPoints, pPoints )
{
if( i != 1 )
SAVE_PCL( outFile, pConPriv, "," );
-
+
sprintf( t, "%d,%d", pPoints[i].x + xoffset,
pPoints[i].y + yoffset );
SAVE_PCL( outFile, pConPriv, t );
r->x = MIN( pPoints[i-1].x, pPoints[i].x ) + xoffset - fudge;
- r->y = MIN( pPoints[i-1].y, pPoints[i].y ) + yoffset - fudge;
+ r->y = MIN( pPoints[i-1].y, pPoints[i].y ) + yoffset - fudge;
r->width = abs( pPoints[i-1].x - pPoints[i].x ) + 2 * fudge;
r->height = abs( pPoints[i-1].y - pPoints[i].y ) + 2 * fudge;
}
@@ -171,36 +172,35 @@ PclPolyLine( pDrawable, pGC, mode, nPoints, pPoints )
* Convert the collection of rectangles into a proper region, then
* intersect it with the clip region.
*/
- drawRegion = miRectsToRegion( nPoints - 1, drawRects, CT_UNSORTED );
+ drawRegion = RECTS_TO_REGION( pGC->pScreen, nPoints - 1,
+ drawRects, CT_UNSORTED );
if( mode == CoordModePrevious )
- miTranslateRegion( drawRegion, pPoints[0].x, pPoints[0].y );
- miIntersect( region, drawRegion,
- ((PclGCPrivPtr)pGC->devPrivates[PclGCPrivateIndex].ptr)
- ->pCompositeClip );
-
+ REGION_TRANSLATE( pGC->pScreen, drawRegion, pPoints[0].x, pPoints[0].y );
+ REGION_INTERSECT( pGC->pScreen, region, drawRegion, pGC->pCompositeClip );
+
/*
* For each rectangle in the clip region, set the HP-GL/2 "input
* window" and render the entire polyline to it.
*/
pbox = REGION_RECTS( region );
nbox = REGION_NUM_RECTS( region );
-
+
PclSendData(outFile, pConPriv, pbox, nbox, 1.0);
/*
* Clean up the temporary regions
*/
- miRegionDestroy( drawRegion );
- miRegionDestroy( region );
+ REGION_DESTROY( pGC->pScreen, drawRegion );
+ REGION_DESTROY( pGC->pScreen, region );
xfree( drawRects );
}
void
-PclPolySegment( pDrawable, pGC, nSegments, pSegments )
- DrawablePtr pDrawable;
- GCPtr pGC;
- int nSegments;
- xSegment *pSegments;
+PclPolySegment(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int nSegments,
+ xSegment *pSegments)
{
FILE *outFile, *dummy;
char t[80];
@@ -214,8 +214,8 @@ PclPolySegment( pDrawable, pGC, nSegments, pSegments )
XpContextPtr pCon;
PclContextPrivPtr pConPriv;
GC cacheGC;
-
-
+
+
if( PclUpdateDrawableGC( pGC, pDrawable, &outFile ) == FALSE )
return;
@@ -226,7 +226,7 @@ PclPolySegment( pDrawable, pGC, nSegments, pSegments )
/*
* Allocate the storage for the temporary regions.
*/
- region = miRegionCreate( NULL, 0 );
+ region = REGION_CREATE( pGC->pScreen, NULL, 0 );
drawRects = (xRectangle *)
xalloc( nSegments * sizeof( xRectangle ) );
@@ -234,12 +234,12 @@ PclPolySegment( pDrawable, pGC, nSegments, pSegments )
* Calculate the fudge factor, based on the line width
*/
fudge = pGC->lineWidth * 3 + 1;
-
+
/*
* Turn off line joining.
*/
SEND_PCL( outFile, "\033%0BLA2,6;\033%0A" );
-
+
/*
* Generate the PCL code to draw the segments, by defining them as
* a macro which uses the HP-GL/2 line drawing function.
@@ -254,7 +254,7 @@ PclPolySegment( pDrawable, pGC, nSegments, pSegments )
xoffset = pDrawable->x;
yoffset = pDrawable->y;
-
+
for( i = 0, r = drawRects; i < nSegments; i++, r++ )
{
r->x = MIN( pSegments[i].x1, pSegments[i].x2 ) + xoffset;
@@ -279,18 +279,17 @@ PclPolySegment( pDrawable, pGC, nSegments, pSegments )
* Convert the collection of rectangles into a proper region, then
* intersect it with the clip region.
*/
- drawRegion = miRectsToRegion( nSegments, drawRects, CT_UNSORTED );
- miIntersect( region, drawRegion,
- ((PclGCPrivPtr)pGC->devPrivates[PclGCPrivateIndex].ptr)
- ->pCompositeClip );
-
+ drawRegion = RECTS_TO_REGION( pGC->pScreen, nSegments,
+ drawRects, CT_UNSORTED );
+ REGION_INTERSECT( pGC->pScreen, region, drawRegion, pGC->pCompositeClip );
+
/*
* For each rectangle in the clip region, set the HP-GL/2 "input
* window" and render the entire set of segments to it.
*/
pbox = REGION_RECTS( region );
nbox = REGION_NUM_RECTS( region );
-
+
PclSendData(outFile, pConPriv, pbox, nbox, 1.0);
/*
@@ -303,12 +302,11 @@ PclPolySegment( pDrawable, pGC, nSegments, pSegments )
cacheGC.joinStyle = !cacheGC.joinStyle;
PclSetDrawablePrivateGC( pDrawable, cacheGC );
PclUpdateDrawableGC( pGC, pDrawable, &outFile );
-
+
/*
- * Clean up
+ * Clean up
*/
- miRegionDestroy( drawRegion );
- miRegionDestroy( region );
+ REGION_DESTROY( pGC->pScreen, drawRegion );
+ REGION_DESTROY( pGC->pScreen, region );
xfree( drawRects );
}
-
diff --git a/Xprint/pcl/PclMisc.c b/Xprint/pcl/PclMisc.c
index 867393a46..f5d36a263 100644
--- a/Xprint/pcl/PclMisc.c
+++ b/Xprint/pcl/PclMisc.c
@@ -44,9 +44,13 @@ not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from said
copyright holders.
*/
+/* $XFree86: xc/programs/Xserver/Xprint/pcl/PclMisc.c,v 1.10 2001/12/02 13:35:28 herrb Exp $ */
+#include <stdlib.h>
+#include <signal.h>
+#include <sys/types.h>
+#include <sys/wait.h>
#include "Xos.h" /* for SIGCLD on pre-POSIX systems */
-#include <stdio.h>
#include "Pcl.h"
#include "cursor.h"
@@ -54,6 +58,7 @@ copyright holders.
#include "windowstr.h"
#include "propertyst.h"
+#include "attributes.h"
/*ARGSUSED*/
@@ -142,12 +147,14 @@ GetPropString(
}
#include <signal.h>
+#include <errno.h>
/* ARGSUSED */
static void SigchldHndlr (
int dummy)
{
int status, w;
+ int olderrno = errno;
struct sigaction act;
sigfillset(&act.sa_mask);
act.sa_flags = 0;
@@ -159,6 +166,7 @@ static void SigchldHndlr (
* Is this really necessary?
*/
sigaction(SIGCHLD, &act, (struct sigaction *)NULL);
+ errno = olderrno;
}
/*
@@ -248,6 +256,7 @@ char *ptr;
* in the clipped area.
* For XP-PCL-LJ3, it draws the spooled figures in the clipped area.
*/
+void
PclSendData(
FILE *outFile,
PclContextPrivPtr pConPriv,
diff --git a/Xprint/pcl/PclPixel.c b/Xprint/pcl/PclPixel.c
index 23ec464e5..b9685fd1b 100644
--- a/Xprint/pcl/PclPixel.c
+++ b/Xprint/pcl/PclPixel.c
@@ -44,6 +44,7 @@ not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from said
copyright holders.
*/
+/* $XFree86: xc/programs/Xserver/Xprint/pcl/PclPixel.c,v 1.6 2001/10/28 03:32:55 tsi Exp $ */
#include <stdio.h>
@@ -60,7 +61,7 @@ PclPolyPoint( pDrawable, pGC, mode, nPoints, pPoints )
int nPoints;
xPoint *pPoints;
{
- char t[80], *command;
+ char t[80];
FILE *outFile;
int xoffset, yoffset;
BoxRec box;
@@ -84,7 +85,7 @@ PclPolyPoint( pDrawable, pGC, mode, nPoints, pPoints )
xloc = pPoints[0].x + pDrawable->x;
yloc = pPoints[0].y + pDrawable->y;
- sprintf( t, "\27%0BPW0,0;LT0;PU;PA%d,%d", xloc, yloc );
+ sprintf( t, "\27%%0BPW0,0;LT0;PU;PA%d,%d", xloc, yloc );
SEND_PCL( outFile, t );
/*
@@ -94,7 +95,7 @@ PclPolyPoint( pDrawable, pGC, mode, nPoints, pPoints )
for( i = 0; i < nPoints; i++ )
{
- if( miPointInRegion( pGC->clientClip, xloc, yloc, &box ) )
+ if( POINT_IN_REGION( pGC->pScreen, pGC->clientClip, xloc, yloc, &box ) )
{
sprintf( t, ",%d,%d", xloc, yloc );
SEND_PCL( outFile, t );
diff --git a/Xprint/pcl/PclPixmap.c b/Xprint/pcl/PclPixmap.c
index fe8d169b1..ba91fc9ec 100644
--- a/Xprint/pcl/PclPixmap.c
+++ b/Xprint/pcl/PclPixmap.c
@@ -44,10 +44,12 @@ not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from said
copyright holders.
*/
+/* $XFree86: xc/programs/Xserver/Xprint/pcl/PclPixmap.c,v 1.4 2001/01/17 22:36:30 dawes Exp $ */
#include "Pcl.h"
-/*#include "cfb.h"*/
-/* #include "mfb.h" */
+#include "cfb.h"
+#include "cfb32.h"
+#include "mfb.h"
#include "pixmapstr.h"
PixmapPtr
@@ -56,25 +58,24 @@ PclCreatePixmap(ScreenPtr pScreen,
int height,
int depth)
{
-extern PixmapPtr mfbCreatePixmap(), cfbCreatePixmap(), cfb32CreatePixmap();
-
if( depth == 1 )
return mfbCreatePixmap( pScreen, width, height, depth );
else if( depth <= 8 )
return cfbCreatePixmap( pScreen, width, height, depth );
else if( depth <= 32 )
return cfb32CreatePixmap( pScreen, width, height, depth );
+ return 0;
}
Bool
PclDestroyPixmap(PixmapPtr pPixmap)
{
-extern Bool mfbDestroyPixmap(), cfbDestroyPixmap(), cfb32DestroyPixmap();
if( pPixmap->drawable.depth == 1 )
return mfbDestroyPixmap( pPixmap );
else if( pPixmap->drawable.depth <= 8 )
return cfbDestroyPixmap( pPixmap );
else if( pPixmap->drawable.depth <= 32 )
return cfb32DestroyPixmap( pPixmap );
+ return 0;
}
diff --git a/Xprint/pcl/PclPolygon.c b/Xprint/pcl/PclPolygon.c
index badbdf18a..a5de77399 100644
--- a/Xprint/pcl/PclPolygon.c
+++ b/Xprint/pcl/PclPolygon.c
@@ -11,7 +11,7 @@
** * Created: 10/23/95
** *
** *********************************************************
-**
+**
********************************************************************/
/*
(c) Copyright 1996 Hewlett-Packard Company
@@ -44,6 +44,7 @@ not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from said
copyright holders.
*/
+/* $XFree86: xc/programs/Xserver/Xprint/pcl/PclPolygon.c,v 1.7 2001/01/17 22:36:30 dawes Exp $ */
#include "Pcl.h"
@@ -51,11 +52,11 @@ copyright holders.
#include "windowstr.h"
void
-PclPolyRectangle( pDrawable, pGC, nRects, pRects )
- DrawablePtr pDrawable;
- GCPtr pGC;
- int nRects;
- xRectangle *pRects;
+PclPolyRectangle(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int nRects,
+ xRectangle *pRects)
{
char t[80];
FILE *outFile;
@@ -67,23 +68,23 @@ PclPolyRectangle( pDrawable, pGC, nRects, pRects )
int xoffset, yoffset;
XpContextPtr pCon;
PclContextPrivPtr pConPriv;
-
+
if( PclUpdateDrawableGC( pGC, pDrawable, &outFile ) == FALSE )
return;
pCon = PclGetContextFromWindow( (WindowPtr) pDrawable );
pConPriv = (PclContextPrivPtr)
pCon->devPrivates[PclContextPrivateIndex].ptr;
-
+
/*
* Allocate the storage required to deal with the clipping
- * regions.
+ * regions.
*/
- region = miRegionCreate( NULL, 0 );
+ region = REGION_CREATE( pGC->pScreen, NULL, 0 );
drawRects = (xRectangle *)xalloc( nRects * sizeof( xRectangle ) );
-
+
fudge = 3 * pGC->lineWidth + 1;
-
+
/*
* Generate the PCL code to draw the rectangles, by defining them
* as a macro which uses the HP-GL/2 rectangle drawing function.
@@ -93,13 +94,13 @@ PclPolyRectangle( pDrawable, pGC, nRects, pRects )
xoffset = pDrawable->x;
yoffset = pDrawable->y;
-
+
for( i = 0, r = drawRects; i < nRects; i++, r++ )
{
xRectangle rect = pRects[i];
-
+
/* Draw the rectangle */
- sprintf( t, "PU%d,%d;ER%d,%d;", rect.x + xoffset,
+ sprintf( t, "PU%d,%d;ER%d,%d;", rect.x + xoffset,
rect.y + yoffset, rect.width, rect.height );
SAVE_PCL( outFile, pConPriv, t );
@@ -113,49 +114,47 @@ PclPolyRectangle( pDrawable, pGC, nRects, pRects )
}
SAVE_PCL( outFile, pConPriv, ";\033%0A" ); /* End the macro */
MACRO_END( outFile );
-
+
/*
* Convert the collection of rectangles to a proper region, then
* intersect it with the clip region.
*/
- drawRegion = miRectsToRegion( nRects, drawRects, CT_UNSORTED );
+ drawRegion = RECTS_TO_REGION( pGC->pScreen, nRects,
+ drawRects, CT_UNSORTED );
+
+ REGION_INTERSECT( pGC->pScreen, region, drawRegion, pGC->pCompositeClip );
- miIntersect( region, drawRegion,
- ((PclGCPrivPtr)pGC->devPrivates[PclGCPrivateIndex].ptr)
- ->pCompositeClip );
-
/*
* For each rectangle in the clip region, set the HP-GL/2 "input
* window" and render the set of rectangles to it.
*/
pbox = REGION_RECTS( region );
nbox = REGION_NUM_RECTS( region );
-
+
PclSendData(outFile, pConPriv, pbox, nbox, 1.0);
-
+
/*
* Clean up the temporary regions
*/
- miRegionDestroy( drawRegion );
- miRegionDestroy( region );
+ REGION_DESTROY( pGC->pScreen, drawRegion );
+ REGION_DESTROY( pGC->pScreen, region );
xfree( drawRects );
}
void
-PclFillPolygon( pDrawable, pGC, shape, mode, nPoints, pPoints )
- DrawablePtr pDrawable;
- GCPtr pGC;
- int shape;
- int mode;
- int nPoints;
- DDXPointPtr pPoints;
+PclFillPolygon(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int shape,
+ int mode,
+ int nPoints,
+ DDXPointPtr pPoints)
{
char t[80];
FILE *outFile;
int nbox, i;
BoxPtr pbox;
BoxRec box;
- xRectangle *drawRects, *r;
RegionPtr drawRegion, region;
int xoffset, yoffset;
int xtop, xbottom, yleft, yright;
@@ -163,14 +162,14 @@ PclFillPolygon( pDrawable, pGC, shape, mode, nPoints, pPoints )
XpContextPtr pCon;
PclContextPrivPtr pConPriv;
char *command;
-
+
if( PclUpdateDrawableGC( pGC, pDrawable, &outFile ) == FALSE )
return;
pCon = PclGetContextFromWindow( (WindowPtr) pDrawable );
pConPriv = (PclContextPrivPtr)
pCon->devPrivates[PclContextPrivateIndex].ptr;
-
+
/*
* Generate the PCL code to draw the filled polygon, by defining
* it as a macro which uses the HP-GL/2 polygon drawing function.
@@ -189,7 +188,7 @@ PclFillPolygon( pDrawable, pGC, shape, mode, nPoints, pPoints )
xoffset = yoffset = 0;
command = "PR";
}
-
+
/* Begin the polygon */
sprintf( t, "PU%d,%d;PM0;%s", pPoints[0].x + xoffset, pPoints[0].y
+ yoffset, command );
@@ -198,13 +197,13 @@ PclFillPolygon( pDrawable, pGC, shape, mode, nPoints, pPoints )
/* Seed the bounding box */
xtop = xbottom = pPoints[0].x + xoffset;
yleft = yright = pPoints[0].y + yoffset;
-
+
/* Add the rest of the points to the polygon */
for( i = 1; i < nPoints; i++ )
{
if( i != 1 )
SAVE_PCL( outFile, pConPriv, "," );
-
+
sprintf( t, "%d,%d", pPoints[i].x + xoffset, pPoints[i].y +
yoffset );
SAVE_PCL( outFile, pConPriv, t );
@@ -222,7 +221,7 @@ PclFillPolygon( pDrawable, pGC, shape, mode, nPoints, pPoints )
fillRule = 0;
else
fillRule = 1;
-
+
sprintf( t, ";PM2;FP%d;\033%%0A", fillRule );
SAVE_PCL( outFile, pConPriv, t );
MACRO_END ( outFile );
@@ -234,16 +233,14 @@ PclFillPolygon( pDrawable, pGC, shape, mode, nPoints, pPoints )
box.y1 = yleft;
box.x2 = xbottom;
box.y2 = yright;
- drawRegion = miRegionCreate( &box, 0 );
+ drawRegion = REGION_CREATE( pGC->pScreen, &box, 0 );
if( mode == CoordModePrevious )
- miTranslateRegion( drawRegion, pPoints[0].x, pPoints[0].y );
-
- region = miRegionCreate( NULL, 0 );
+ REGION_TRANSLATE( pGC->pScreen, drawRegion, pPoints[0].x, pPoints[0].y );
- miIntersect( region, drawRegion,
- ((PclGCPrivPtr)pGC->devPrivates[PclGCPrivateIndex].ptr)
- ->pCompositeClip );
+ region = REGION_CREATE( pGC->pScreen, NULL, 0 );
+
+ REGION_INTERSECT( pGC->pScreen, region, drawRegion, pGC->pCompositeClip );
/*
* For each rectangle in the clip region, set the HP-GL/2 "input
@@ -251,22 +248,22 @@ PclFillPolygon( pDrawable, pGC, shape, mode, nPoints, pPoints )
*/
pbox = REGION_RECTS( region );
nbox = REGION_NUM_RECTS( region );
-
+
PclSendData(outFile, pConPriv, pbox, nbox, 1.0);
/*
* Clean up the temporary regions
*/
- miRegionDestroy( drawRegion );
- miRegionDestroy( region );
+ REGION_DESTROY( pGC->pScreen, drawRegion );
+ REGION_DESTROY( pGC->pScreen, region );
}
void
-PclPolyFillRect( pDrawable, pGC, nRects, pRects )
- DrawablePtr pDrawable;
- GCPtr pGC;
- int nRects;
- xRectangle *pRects;
+PclPolyFillRect(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int nRects,
+ xRectangle *pRects)
{
char t[80];
FILE *outFile;
@@ -278,24 +275,24 @@ PclPolyFillRect( pDrawable, pGC, nRects, pRects )
short fudge;
XpContextPtr pCon;
PclContextPrivPtr pConPriv;
-
+
if( PclUpdateDrawableGC( pGC, pDrawable, &outFile ) == FALSE )
return;
pCon = PclGetContextFromWindow( (WindowPtr) pDrawable );
pConPriv = (PclContextPrivPtr)
pCon->devPrivates[PclContextPrivateIndex].ptr;
-
+
/*
* Allocate the storage required to deal with the clipping
* regions.
*/
- region = miRegionCreate( NULL, 0 );
+ region = REGION_CREATE( pGC->pScreen, NULL, 0 );
drawRects = (xRectangle *)xalloc( nRects * sizeof( xRectangle ) );
fudge = 3 * pGC->lineWidth + 1;
-
+
/*
* Generate the PCL code to draw the filled rectangles, by
* defining them as a macro which uses the HP-GL/2 rectangle
@@ -303,19 +300,19 @@ PclPolyFillRect( pDrawable, pGC, nRects, pRects )
*/
MACRO_START( outFile, pConPriv );
SAVE_PCL( outFile, pConPriv, "\033%0B" );
-
+
xoffset = pDrawable->x;
yoffset = pDrawable->y;
-
+
for( i = 0, r = drawRects; i < nRects; i++, r++ )
{
xRectangle rect = pRects[i];
-
+
/* Draw the rectangle */
sprintf( t, "PU%d,%d;RR%d,%d;", rect.x + xoffset, rect.y +
yoffset, rect.width, rect.height );
SAVE_PCL( outFile, pConPriv, t );
-
+
/* Build the bounding box */
r->x = MIN( rect.x, rect.x + rect.width ) + xoffset - fudge;
r->y = MIN( rect.y, rect.y + rect.height ) + yoffset -
@@ -325,30 +322,28 @@ PclPolyFillRect( pDrawable, pGC, nRects, pRects )
}
SAVE_PCL( outFile, pConPriv, ";\033%0A" ); /* End the macro */
MACRO_END( outFile );
-
+
/*
* Convert the collection of rectangles to a proper region, then
* intersect it with the clip region.
*/
- drawRegion = miRectsToRegion( nRects, drawRects, CT_UNSORTED );
- miIntersect( region, drawRegion,
- ((PclGCPrivPtr)pGC->devPrivates[PclGCPrivateIndex].ptr)
- ->pCompositeClip );
-
+ drawRegion = RECTS_TO_REGION( pGC->pScreen, nRects,
+ drawRects, CT_UNSORTED );
+ REGION_INTERSECT( pGC->pScreen, region, drawRegion, pGC->pCompositeClip );
+
/*
* For each rectangle in the clip region, set the HP-GL/2 "input
* window" and render the set of rectangles to it.
*/
pbox = REGION_RECTS( region );
nbox = REGION_NUM_RECTS( region );
-
+
PclSendData(outFile, pConPriv, pbox, nbox, 1.0);
-
+
/*
* Clean up the temporary regions
*/
- miRegionDestroy( drawRegion );
- miRegionDestroy( region );
+ REGION_DESTROY( pGC->pScreen, drawRegion );
+ REGION_DESTROY( pGC->pScreen, region );
xfree( drawRects );
}
-
diff --git a/Xprint/pcl/PclPrint.c b/Xprint/pcl/PclPrint.c
index 2bfd92d15..f21d6c22a 100644
--- a/Xprint/pcl/PclPrint.c
+++ b/Xprint/pcl/PclPrint.c
@@ -43,6 +43,7 @@ not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from said
copyright holders.
*/
+/* $XFree86: xc/programs/Xserver/Xprint/pcl/PclPrint.c,v 1.7 2001/10/28 03:32:55 tsi Exp $ */
#include <stdio.h>
#include <string.h>
@@ -63,20 +64,14 @@ copyright holders.
#include "AttrValid.h"
#include "Oid.h"
-extern PclSoftFontInfoPtr PclCreateSoftFontInfo();
-extern void PclDestroySoftFontInfo(PclSoftFontInfoPtr);
-
int
-PclStartJob( pCon, sendClientData, client )
- XpContextPtr pCon;
- Bool sendClientData;
- ClientPtr client;
-
+PclStartJob(
+ XpContextPtr pCon,
+ Bool sendClientData,
+ ClientPtr client)
{
PclContextPrivPtr pConPriv =
(PclContextPrivPtr)pCon->devPrivates[PclContextPrivateIndex].ptr;
- char *jobHeader;
- char s[40];
PclPaletteMap *pal;
/*
@@ -128,9 +123,9 @@ PclStartJob( pCon, sendClientData, client )
}
int
-PclEndJob( pCon, cancel )
- XpContextPtr pCon;
- Bool cancel;
+PclEndJob(
+ XpContextPtr pCon,
+ Bool cancel)
{
PclContextPrivPtr priv = (PclContextPrivPtr)
pCon->devPrivates[PclContextPrivateIndex].ptr;
@@ -143,7 +138,7 @@ PclEndJob( pCon, cancel )
char *fileName, *trailer;
struct stat statBuf;
int n;
- PclPaletteMapPtr p, t;
+ PclPaletteMapPtr p;
trailer = "\033%-12345X@PJL RESET\n";
@@ -152,7 +147,7 @@ PclEndJob( pCon, cancel )
if( priv->getDocClient != (ClientPtr)NULL ) {
XpFinishDocData( priv->getDocClient );
- priv->getDocClient == NULL;
+ priv->getDocClient = NULL;
priv->getDocBufSize = 0;
}
@@ -183,7 +178,7 @@ PclEndJob( pCon, cancel )
if( priv->getDocClient != (ClientPtr)NULL ) {
XpFinishDocData( priv->getDocClient );
- priv->getDocClient == NULL;
+ priv->getDocClient = NULL;
priv->getDocBufSize = 0;
}
@@ -249,11 +244,10 @@ PclEndJob( pCon, cancel )
* ClearArea the window and all descendant windows
*/
int
-PclStartPage( pCon, pWin )
- XpContextPtr pCon;
- WindowPtr pWin;
+PclStartPage(
+ XpContextPtr pCon,
+ WindowPtr pWin)
{
- register WindowPtr pChild;
PclContextPrivPtr pConPriv = (PclContextPrivPtr)
pCon->devPrivates[PclContextPrivateIndex].ptr;
PclWindowPrivPtr pWinPriv =
@@ -261,9 +255,7 @@ PclStartPage( pCon, pWin )
xRectangle repro;
char t[80];
XpOid orient, plex, tray, medium;
- unsigned short wid, ht;
int dir, plexNum, num;
- xEvent event;
/*
* Put a pointer to the context in the window private structure
@@ -490,14 +482,12 @@ SendDocData( PclContextPrivPtr pPriv )
* Write page file to job file
*/
int
-PclEndPage( pCon, pWin )
- XpContextPtr pCon;
- WindowPtr pWin;
+PclEndPage(
+ XpContextPtr pCon,
+ WindowPtr pWin)
{
PclContextPrivPtr pConPriv = (PclContextPrivPtr)
pCon->devPrivates[PclContextPrivateIndex].ptr;
- PclWindowPrivPtr pWinPriv =
- (PclWindowPrivPtr)pWin->devPrivates[PclWindowPrivateIndex].ptr;
struct stat statBuf;
@@ -566,9 +556,9 @@ PclStartDoc(XpContextPtr pCon,
}
int
-PclEndDoc( pCon, cancel )
- XpContextPtr pCon;
- Bool cancel;
+PclEndDoc(
+ XpContextPtr pCon,
+ Bool cancel)
{
/*
* XXX What should I do if I get cancel == TRUE?
@@ -588,18 +578,18 @@ PclEndDoc( pCon, cancel )
#define DOC_HPGL 2
int
-PclDocumentData( pCon, pDraw, pData, len_data, pFmt, len_fmt, pOpt, len_opt, client)
- XpContextPtr pCon;
- DrawablePtr pDraw;
- char *pData;
- int len_data;
- char *pFmt;
- int len_fmt;
- char *pOpt;
- int len_opt;
- ClientPtr client;
+PclDocumentData(
+ XpContextPtr pCon,
+ DrawablePtr pDraw,
+ char *pData,
+ int len_data,
+ char *pFmt,
+ int len_fmt,
+ char *pOpt,
+ int len_opt,
+ ClientPtr client)
{
- int type;
+ int type = 0;
PclContextPrivPtr pPriv = (PclContextPrivPtr)
pCon->devPrivates[PclContextPrivateIndex].ptr;
XpOidDocFmtList *formats;
@@ -703,10 +693,10 @@ PclDocumentData( pCon, pDraw, pData, len_data, pFmt, len_fmt, pOpt, len_opt, cli
*/
int
-PclGetDocumentData( pCon, client, maxBufferSize )
- XpContextPtr pCon;
- ClientPtr client;
- int maxBufferSize;
+PclGetDocumentData(
+ XpContextPtr pCon,
+ ClientPtr client,
+ int maxBufferSize)
{
PclContextPrivPtr pPriv = (PclContextPrivPtr)
pCon->devPrivates[PclContextPrivateIndex].ptr;
diff --git a/Xprint/pcl/PclSFonts.c b/Xprint/pcl/PclSFonts.c
index 9f19a2387..2f33ab857 100644
--- a/Xprint/pcl/PclSFonts.c
+++ b/Xprint/pcl/PclSFonts.c
@@ -45,6 +45,7 @@ not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from said
copyright holders.
*/
+/* $XFree86: xc/programs/Xserver/Xprint/pcl/PclSFonts.c,v 1.6 2001/10/28 03:32:55 tsi Exp $ */
#include <stdio.h>
@@ -75,8 +76,7 @@ PclDownloadSoftFont8(
PclSoftFontInfoPtr pSoftFontInfo,
PclFontHead8Ptr pfh,
PclCharDataPtr pcd,
- unsigned char *code,
- int flag
+ unsigned char *code
)
{
/*
@@ -103,8 +103,7 @@ PclDownloadSoftFont16(
PclFontHead16Ptr pfh,
PclCharDataPtr pcd,
unsigned char row,
- unsigned char col,
- int flag
+ unsigned char col
)
{
/*
@@ -129,8 +128,7 @@ PclDownloadSoftFont16(
* of the downloaded soft font.
* **************************************************************************/
PclSoftFontInfoPtr
-PclCreateSoftFontInfo(
-)
+PclCreateSoftFontInfo(void)
{
PclSoftFontInfoPtr pSoftFontInfo;
@@ -154,7 +152,7 @@ PclFontHead8Ptr pfh8, pfh8_next;
PclFontHead16Ptr pfh16, pfh16_next;
PclInternalFontPtr pin, pin_next;
unsigned char nindex_row, nindex_col;
-int i, j;
+int i;
if ( pSoftFontInfo == (PclSoftFontInfoPtr) NULL )
return;
diff --git a/Xprint/pcl/PclSpans.c b/Xprint/pcl/PclSpans.c
index 38d1b7b01..98c17dcf9 100644
--- a/Xprint/pcl/PclSpans.c
+++ b/Xprint/pcl/PclSpans.c
@@ -11,7 +11,7 @@
** * Created: 10/23/95
** *
** *********************************************************
-**
+**
********************************************************************/
/*
(c) Copyright 1996 Hewlett-Packard Company
@@ -44,6 +44,7 @@ not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from said
copyright holders.
*/
+/* $XFree86: xc/programs/Xserver/Xprint/pcl/PclSpans.c,v 1.6 2001/01/17 22:36:30 dawes Exp $ */
#include "Pcl.h"
@@ -51,33 +52,33 @@ copyright holders.
#include "windowstr.h"
void
-PclFillSpans( pDrawable, pGC, nSpans, pPoints, pWidths, fSorted )
- DrawablePtr pDrawable;
- GCPtr pGC;
- int nSpans;
- DDXPointPtr pPoints;
- int *pWidths;
- int fSorted;
+PclFillSpans(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int nSpans,
+ DDXPointPtr pPoints,
+ int *pWidths,
+ int fSorted)
{
char t[80];
FILE *outFile;
int xoffset, yoffset;
xRectangle *rects, *r;
- RegionPtr fillRegion, region;
+ RegionPtr fillRegion, region = 0;
int i;
int nbox;
BoxPtr pbox;
-
+
if( PclUpdateDrawableGC( pGC, pDrawable, &outFile ) == FALSE )
return;
-
+
/*
* Build a region out of the spans
*/
rects = (xRectangle *)xalloc( nSpans * sizeof( xRectangle ) );
xoffset = pDrawable->x;
yoffset = pDrawable->y;
-
+
for( i = 0, r = rects; i < nSpans; i++, r++ )
{
r->x = pPoints[i].x + xoffset;
@@ -85,15 +86,15 @@ PclFillSpans( pDrawable, pGC, nSpans, pPoints, pWidths, fSorted )
r->width = pWidths[i];
r->height = 1;
}
- fillRegion = miRectsToRegion( nSpans, rects, ( fSorted ) ?
+ fillRegion = RECTS_TO_REGION( pGC->pScreen, nSpans, rects, ( fSorted ) ?
CT_YSORTED : CT_UNSORTED );
-
+
/*
* Intersect this region with the clip region. Whatever's left,
* should be filled.
*/
- miIntersect( region, fillRegion, pGC->clientClip );
-
+ REGION_INTERSECT( pGC->pScreen, region, fillRegion, pGC->clientClip );
+
pbox = REGION_RECTS( region );
nbox = REGION_NUM_RECTS( region );
@@ -102,35 +103,33 @@ PclFillSpans( pDrawable, pGC, nSpans, pPoints, pWidths, fSorted )
while( nbox )
{
- sprintf( t, "PU%d,%d;RR%d,%d;", pbox->x1, pbox->y1,
+ sprintf( t, "PU%d,%d;RR%d,%d;", pbox->x1, pbox->y1,
pbox->x2, pbox->y2 );
SEND_PCL( outFile, t );
-
+
nbox--;
pbox++;
}
/* Go back to PCL */
SEND_PCL( outFile, "\27%0A" );
-
+
/*
* Clean up the temporary regions
*/
- miRegionDestroy( fillRegion );
- miRegionDestroy( region );
+ REGION_DESTROY( pGC->pScreen, fillRegion );
+ REGION_DESTROY( pGC->pScreen, region );
xfree( rects );
}
void
-PclSetSpans( pDrawable, pGC, pSrc, pPoints, pWidths, nSpans, fSorted )
- DrawablePtr pDrawable;
- GCPtr pGC;
- char *pSrc;
- DDXPointPtr pPoints;
- int *pWidths;
- int nSpans;
- int fSorted;
+PclSetSpans(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ char *pSrc,
+ DDXPointPtr pPoints,
+ int *pWidths,
+ int nSpans,
+ int fSorted)
{
}
-
-
diff --git a/Xprint/pcl/PclText.c b/Xprint/pcl/PclText.c
index d01baabfa..ae5446a85 100644
--- a/Xprint/pcl/PclText.c
+++ b/Xprint/pcl/PclText.c
@@ -44,6 +44,7 @@ not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from said
copyright holders.
*/
+/* $XFree86: xc/programs/Xserver/Xprint/pcl/PclText.c,v 1.10 2001/12/19 21:55:58 dawes Exp $ */
#ifdef DO_TWO_BYTE_PCL
#include "iconv.h"
@@ -81,13 +82,13 @@ static void code_conv(PclSoftFontInfoPtr, FontPtr, char *, char *);
#define INTERNAL_FONT 1
int
-PclPolyText8( pDrawable, pGC, x, y, count, string )
- DrawablePtr pDrawable;
- GCPtr pGC;
- int x;
- int y;
- int count;
- char *string;
+PclPolyText8(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int x,
+ int y,
+ int count,
+ char *string)
{
XpContextPtr pCon;
PclContextPrivPtr pConPriv;
@@ -181,8 +182,6 @@ char font_type;
MACRO_END( outFile );
} else {
- char *internalFont;
- int pixel_size;
int fid = 0;
pin = makeInternalFont(pGC->font, pSoftFontInfo);
@@ -231,9 +230,7 @@ char font_type;
drawRegion = miRegionCreate( &box, 0 );
region = miRegionCreate( NULL, 0 );
- miIntersect( region, drawRegion,
- ((PclGCPrivPtr)pGC->devPrivates[PclGCPrivateIndex].ptr)
- ->pCompositeClip );
+ miIntersect( region, drawRegion, pGC->pCompositeClip );
/*
* For each rectangle in the clip region, set the HP-GL/2 "input
@@ -247,20 +244,20 @@ char font_type;
/*
* Clean up the temporary regions
*/
- miRegionDestroy( drawRegion );
- miRegionDestroy( region );
+ REGION_DESTROY( pGC->pScreen, drawRegion );
+ REGION_DESTROY( pGC->pScreen, region );
return x+w;
}
int
-PclPolyText16( pDrawable, pGC, x, y, count, string )
- DrawablePtr pDrawable;
- GCPtr pGC;
- int x;
- int y;
- int count;
- unsigned short *string;
+PclPolyText16(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int x,
+ int y,
+ int count,
+ unsigned short *string)
{
XpContextPtr pCon;
PclContextPrivPtr pConPriv;
@@ -271,7 +268,6 @@ CharInfoPtr charinfo[255], *chinfo;
FILE *outFile;
PclSoftFontInfoPtr pSoftFontInfo;
PclFontHead16Ptr pfh16 = (PclFontHead16Ptr)NULL;
-PclInternalFontPtr pin = (PclInternalFontPtr)NULL;
PclCharDataRec cd;
FontInfoPtr pfi;
unsigned char row, col;
@@ -321,8 +317,8 @@ char font_type;
col = col - pfi->firstCol;
} else {
def = pfi->defaultCh;
- row = (def>>8)&0xff - pfi->firstRow;
- col = def&0xff - pfi->firstCol;
+ row = ((def>>8)&0xff) - pfi->firstRow;
+ col = (def&0xff) - pfi->firstCol;
}
if ( !pfh16->index[row][col].fid ) {
fillCharDescData(&cd, *chinfo);
@@ -356,8 +352,8 @@ char font_type;
col = col - pfi->firstCol;
} else {
def = pfi->defaultCh;
- row = (def>>8)&0xff - pfi->firstRow;
- col = def&0xff - pfi->firstCol;
+ row = ((def>>8)&0xff) - pfi->firstRow;
+ col = (def&0xff) - pfi->firstCol;
}
if ( last_fid != pfh16->index[row][col].fid ) {
sprintf(t, "%cFI%d;SS;LB",
@@ -380,8 +376,7 @@ char font_type;
} else {
#ifdef DO_TWO_BYTE_PCL
- char *internalFont;
- int pixel_size;
+ PclInternalFontPtr pin;
int fid = 0;
pin = makeInternalFont(pGC->font, pSoftFontInfo);
@@ -432,9 +427,7 @@ char font_type;
drawRegion = miRegionCreate( &box, 0 );
region = miRegionCreate( NULL, 0 );
- miIntersect( region, drawRegion,
- ((PclGCPrivPtr)pGC->devPrivates[PclGCPrivateIndex].ptr)
- ->pCompositeClip );
+ miIntersect( region, drawRegion, pGC->pCompositeClip );
/*
* For each rectangle in the clip region, set the HP-GL/2 "input
@@ -448,52 +441,52 @@ char font_type;
/*
* Clean up the temporary regions
*/
- miRegionDestroy( drawRegion );
- miRegionDestroy( region );
+ REGION_DESTROY( pGC->pScreen, drawRegion );
+ REGION_DESTROY( pGC->pScreen, region );
return x+w;
}
void
-PclImageText8( pDrawable, pGC, x, y, count, string )
- DrawablePtr pDrawable;
- GCPtr pGC;
- int x, y;
- int count;
- char *string;
+PclImageText8(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int x, int y,
+ int count,
+ char *string)
{
}
void
-PclImageText16( pDrawable, pGC, x, y, count, string )
- DrawablePtr pDrawable;
- GCPtr pGC;
- int x;
- int y;
- int count;
- unsigned short *string;
+PclImageText16(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int x,
+ int y,
+ int count,
+ unsigned short *string)
{
}
void
-PclImageGlyphBlt( pDrawable, pGC, x, y, nGlyphs, pCharInfo, pGlyphBase )
- DrawablePtr pDrawable;
- GCPtr pGC;
- int x, y;
- unsigned int nGlyphs;
- CharInfoPtr *pCharInfo;
- pointer pGlyphBase;
+PclImageGlyphBlt(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int x, int y,
+ unsigned int nGlyphs,
+ CharInfoPtr *pCharInfo,
+ pointer pGlyphBase)
{
}
void
-PclPolyGlyphBlt( pDrawable, pGC, x, y, nGlyphs, pCharInfo, pGlyphBase )
- DrawablePtr pDrawable;
- GCPtr pGC;
- int x, y;
- unsigned int nGlyphs;
- CharInfoPtr *pCharInfo;
- pointer pGlyphBase;
+PclPolyGlyphBlt(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int x, int y,
+ unsigned int nGlyphs,
+ CharInfoPtr *pCharInfo,
+ pointer pGlyphBase)
{
}
@@ -509,7 +502,7 @@ PclFontHead8Ptr prev = (PclFontHead8Ptr)NULL;
FontInfoPtr pfi;
char *fontname;
unsigned char nindex;
-int i, j;
+int i;
unsigned long n;
CharInfoPtr charinfo[1];
unsigned int space_width;
@@ -680,7 +673,7 @@ FontPropPtr props;
FontInfoPtr pfi;
char *fontname;
Atom xa_pcl_font_name, xa_res, xa_ave_width, xa_spacing;
-int res, width;
+int res, width = 1;
int mask;
int i;
@@ -723,19 +716,19 @@ int i;
mask = 0;
for (i=0; i<pfi->nprops; i++, props++) {
- if ( props->name == xa_pcl_font_name ) {
+ if ( (Atom) props->name == xa_pcl_font_name ) {
pin->pcl_font_name = NameForAtom(props->value);
mask |= 0x1;
} else if ( props->name == XA_POINT_SIZE ) {
pin->height = (float) props->value / 10.0;
mask |= 0x2;
- } else if ( props->name == xa_res ) {
+ } else if ( (Atom) props->name == xa_res ) {
res = (int) props->value;
mask |= 0x4;
- } else if ( props->name == xa_ave_width ) {
+ } else if ( (Atom) props->name == xa_ave_width ) {
width = (int) props->value / 10;
mask |= 0x8;
- } else if ( props->name == xa_spacing ) {
+ } else if ( (Atom) props->name == xa_spacing ) {
pin->spacing = NameForAtom(props->value);
mask |= 0x10;
}
@@ -746,8 +739,11 @@ int i;
return (PclInternalFontPtr) NULL;
}
- if ( *pin->spacing != 'P' || *pin->spacing != 'p' )
+ if ( *pin->spacing != 'P' || *pin->spacing != 'p' ) {
+ if (width == 0)
+ width = 1;
pin->pitch = (float) 300.0 / width; /* Hard-Code: Resolution is 300 */
+ }
pin->next = (PclInternalFontPtr)NULL;
if ( prev == (PclInternalFontPtr) NULL)
@@ -791,7 +787,7 @@ unsigned int byte_width;
unsigned char *p;
register int nbyGlyphWidth;
unsigned char *pglyph, *pg;
-int i, j;
+unsigned int i, j;
pcd->h_offset = pci->metrics.leftSideBearing;
pcd->v_offset = pci->metrics.ascent;
@@ -868,7 +864,7 @@ Atom dest;
pfi = (FontInfoRec *)&pfont->info;
props = pfi->props;
for (i=0; i<pfi->nprops; i++, props++) {
- if ( props->name == dest && props->value == 2 )
+ if ( (Atom) props->name == dest && props->value == 2 )
return INTERNAL_FONT;
}
return DOWNLOAD_FONT;
diff --git a/Xprint/pcl/PclWindow.c b/Xprint/pcl/PclWindow.c
index 7c830b897..b58bd43a1 100644
--- a/Xprint/pcl/PclWindow.c
+++ b/Xprint/pcl/PclWindow.c
@@ -44,10 +44,12 @@ not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from said
copyright holders.
*/
+/* $XFree86: xc/programs/Xserver/Xprint/pcl/PclWindow.c,v 1.10 2001/12/19 21:55:58 dawes Exp $ */
#include <stdio.h>
#include <string.h>
+#include <sys/types.h>
#include <sys/wait.h>
#include "mistruct.h"
@@ -57,8 +59,7 @@ copyright holders.
#include "Pcl.h"
-extern WindowPtr *WindowTable;
-
+#if 0
/*
* The following list of strings defines the properties which will be
* placed on the screen's root window if the property was defined in
@@ -75,7 +76,7 @@ static /* const */ char *propStrings[] = {
DT_PRINT_PAGE_COMMAND,
(char *)NULL
};
-
+#endif
/*
* PclCreateWindow - watch for the creation of the root window.
@@ -207,7 +208,6 @@ PclPaintWindow(
RegionPtr pRegion,
int what)
{
- int status;
WindowPtr pRoot;
#define FUNCTION 0
@@ -367,13 +367,13 @@ PclPaintWindow(
}
break;
case GCClipMask:
- if ((pointer) pGC->clientClipType != (pointer)CT_NONE) {
+ if ((pointer)(long) pGC->clientClipType != (pointer)CT_NONE) {
gcmask |= index;
gcval[i++] = (pointer)CT_NONE;
}
break;
case GCSubwindowMode:
- if ((pointer) pGC->subWindowMode != newValues[SUBWINDOW]) {
+ if ((pointer)(long) pGC->subWindowMode != newValues[SUBWINDOW]) {
gcmask |= index;
gcval[i++] = newValues[SUBWINDOW];
}
@@ -387,7 +387,7 @@ PclPaintWindow(
}
break;
case GCFillStyle:
- if ((pointer) pGC->fillStyle != newValues[FILLSTYLE]) {
+ if ((pointer)(long) pGC->fillStyle != newValues[FILLSTYLE]) {
gcmask |= index;
gcval[i++] = newValues[FILLSTYLE];
}
diff --git a/Xprint/pcl/Pclmap.h b/Xprint/pcl/Pclmap.h
index ecec35776..1386b0ab4 100644
--- a/Xprint/pcl/Pclmap.h
+++ b/Xprint/pcl/Pclmap.h
@@ -30,166 +30,180 @@ not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from said
copyright holders.
*/
+/* $XFree86: xc/programs/Xserver/Xprint/pcl/Pclmap.h,v 1.6 2001/12/21 21:02:05 dawes Exp $ */
#ifndef _PCLMAP_H_
#define _PCLMAP_H_
#ifdef XP_PCL_COLOR
-#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP)
-#define NAME(subname) PclCr##subname
+#ifdef CATNAME
+#undef CATNAME
+#endif
+#if !defined(UNIXCPP) || defined(ANSICPP)
+#define PCLNAME(subname) PclCr##subname
#define CATNAME(prefix,subname) prefix##Color##subname
#else
-#define NAME(subname) PclCr/**/subname
+#define PCLNAME(subname) PclCr/**/subname
#define CATNAME(prefix,subname) prefix/**/Color/**/subname
#endif
#endif /* XP_PCL_COLOR */
#ifdef XP_PCL_MONO
-#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP)
-#define NAME(subname) PclMn##subname
+#ifdef CATNAME
+#undef CATNAME
+#endif
+#if !defined(UNIXCPP) || defined(ANSICPP)
+#define PCLNAME(subname) PclMn##subname
#define CATNAME(prefix,subname) prefix##Mono##subname
#else
-#define NAME(subname) PclMn/**/subname
+#define PCLNAME(subname) PclMn/**/subname
#define CATNAME(prefix,subname) prefix/**/Mono/**/subname
#endif
#endif /* XP_PCL_MONO */
#ifdef XP_PCL_LJ3
-#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP)
-#define NAME(subname) PclLj3##subname
+#ifdef CATNAME
+#undef CATNAME
+#endif
+#if !defined(UNIXCPP) || defined(ANSICPP)
+#define PCLNAME(subname) PclLj3##subname
#define CATNAME(prefix,subname) prefix##Lj3##subname
#else
-#define NAME(subname) PclLj3/**/subname
+#define PCLNAME(subname) PclLj3/**/subname
#define CATNAME(prefix,subname) prefix/**/Lj3/**/subname
#endif
#endif /* XP_PCL_LJ3 */
+#ifdef PCLNAME
+
/* PclInit.c */
#define InitializePclDriver CATNAME(Initialize, PclDriver)
-#define PclCloseScreen NAME(CloseScreen)
-#define PclGetContextFromWindow NAME(GetContextFromWindow)
-#define PclScreenPrivateIndex NAME(ScreenPrivateIndex)
-#define PclWindowPrivateIndex NAME(WindowPrivateIndex)
-#define PclContextPrivateIndex NAME(ContextPrivateIndex)
-#define PclPixmapPrivateIndex NAME(PixmapPrivateIndex)
-#define PclGCPrivateIndex NAME(GCPrivateIndex)
+#define PclCloseScreen PCLNAME(CloseScreen)
+#define PclGetContextFromWindow PCLNAME(GetContextFromWindow)
+#define PclScreenPrivateIndex PCLNAME(ScreenPrivateIndex)
+#define PclWindowPrivateIndex PCLNAME(WindowPrivateIndex)
+#define PclContextPrivateIndex PCLNAME(ContextPrivateIndex)
+#define PclPixmapPrivateIndex PCLNAME(PixmapPrivateIndex)
+#define PclGCPrivateIndex PCLNAME(GCPrivateIndex)
/* PclPrint.c */
-#define PclStartJob NAME(StartJob)
-#define PclEndJob NAME(EndJob)
-#define PclStartPage NAME(StartPage)
-#define PclEndPage NAME(EndPage)
-#define PclStartDoc NAME(StartDoc)
-#define PclEndDoc NAME(EndDoc)
-#define PclDocumentData NAME(DocumentData)
-#define PclGetDocumentData NAME(GetDocumentData)
+#define PclStartJob PCLNAME(StartJob)
+#define PclEndJob PCLNAME(EndJob)
+#define PclStartPage PCLNAME(StartPage)
+#define PclEndPage PCLNAME(EndPage)
+#define PclStartDoc PCLNAME(StartDoc)
+#define PclEndDoc PCLNAME(EndDoc)
+#define PclDocumentData PCLNAME(DocumentData)
+#define PclGetDocumentData PCLNAME(GetDocumentData)
/* PclWindow.c */
-#define PclCreateWindow NAME(CreateWindow)
-#define PclMapWindow NAME(MapWindow)
-#define PclPositionWindow NAME(PositionWindow)
-#define PclUnmapWindow NAME(UnmapWindow)
-#define PclCopyWindow NAME(CopyWindow)
-#define PclChangeWindowAttributes NAME(ChangeWindowAttributes)
-#define PclPaintWindow NAME(PaintWindow)
-#define PclDestroyWindow NAME(DestroyWindow)
+#define PclCreateWindow PCLNAME(CreateWindow)
+#define PclMapWindow PCLNAME(MapWindow)
+#define PclPositionWindow PCLNAME(PositionWindow)
+#define PclUnmapWindow PCLNAME(UnmapWindow)
+#define PclCopyWindow PCLNAME(CopyWindow)
+#define PclChangeWindowAttributes PCLNAME(ChangeWindowAttributes)
+#define PclPaintWindow PCLNAME(PaintWindow)
+#define PclDestroyWindow PCLNAME(DestroyWindow)
/* PclGC.c */
-#define PclCreateGC NAME(CreateGC)
-#define PclDestroyGC NAME(DestroyGC)
-#define PclGetDrawablePrivateStuff NAME(GetDrawablePrivateStuff)
-#define PclSetDrawablePrivateGC NAME(SetDrawablePrivateGC)
-#define PclSendPattern NAME(SendPattern)
-#define PclUpdateDrawableGC NAME(UpdateDrawableGC)
-#define PclComputeCompositeClip NAME(ComputeCompositeClip)
-#define PclValidateGC NAME(ValidateGC)
+#define PclCreateGC PCLNAME(CreateGC)
+#define PclDestroyGC PCLNAME(DestroyGC)
+#define PclGetDrawablePrivateStuff PCLNAME(GetDrawablePrivateStuff)
+#define PclSetDrawablePrivateGC PCLNAME(SetDrawablePrivateGC)
+#define PclSendPattern PCLNAME(SendPattern)
+#define PclUpdateDrawableGC PCLNAME(UpdateDrawableGC)
+#define PclComputeCompositeClip PCLNAME(ComputeCompositeClip)
+#define PclValidateGC PCLNAME(ValidateGC)
/* PclAttr.c */
-#define PclGetAttributes NAME(GetAttributes)
-#define PclGetOneAttribute NAME(GetOneAttribute)
-#define PclAugmentAttributes NAME(AugmentAttributes)
-#define PclSetAttributes NAME(SetAttributes)
+#define PclGetAttributes PCLNAME(GetAttributes)
+#define PclGetOneAttribute PCLNAME(GetOneAttribute)
+#define PclAugmentAttributes PCLNAME(AugmentAttributes)
+#define PclSetAttributes PCLNAME(SetAttributes)
/* PclColor.c */
-#define PclLookUp NAME(LookUp)
-#define PclCreateDefColormap NAME(CreateDefColormap)
-#define PclCreateColormap NAME(CreateColormap)
-#define PclDestroyColormap NAME(DestroyColormap)
-#define PclInstallColormap NAME(InstallColormap)
-#define PclUninstallColormap NAME(UninstallColormap)
-#define PclListInstalledColormaps NAME(ListInstalledColormaps)
-#define PclStoreColors NAME(StoreColors)
-#define PclResolveColor NAME(ResolveColor)
-#define PclFindPaletteMap NAME(FindPaletteMap)
-#define PclUpdateColormap NAME(UpdateColormap)
-#define PclReadMap NAME(ReadMap)
+#define PclLookUp PCLNAME(LookUp)
+#define PclCreateDefColormap PCLNAME(CreateDefColormap)
+#define PclCreateColormap PCLNAME(CreateColormap)
+#define PclDestroyColormap PCLNAME(DestroyColormap)
+#define PclInstallColormap PCLNAME(InstallColormap)
+#define PclUninstallColormap PCLNAME(UninstallColormap)
+#define PclListInstalledColormaps PCLNAME(ListInstalledColormaps)
+#define PclStoreColors PCLNAME(StoreColors)
+#define PclResolveColor PCLNAME(ResolveColor)
+#define PclFindPaletteMap PCLNAME(FindPaletteMap)
+#define PclUpdateColormap PCLNAME(UpdateColormap)
+#define PclReadMap PCLNAME(ReadMap)
/* PclPixmap.c */
-#define PclCreatePixmap NAME(CreatePixmap)
-#define PclDestroyPixmap NAME(DestroyPixmap)
+#define PclCreatePixmap PCLNAME(CreatePixmap)
+#define PclDestroyPixmap PCLNAME(DestroyPixmap)
/* PclArc.c */
-#define PclDoArc NAME(DoArc)
-#define PclPolyArc NAME(PolyArc)
-#define PclPolyFillArc NAME(PolyFillArc)
+#define PclDoArc PCLNAME(DoArc)
+#define PclPolyArc PCLNAME(PolyArc)
+#define PclPolyFillArc PCLNAME(PolyFillArc)
/* PclArea.c */
-#define PclPutImage NAME(PutImage)
-#define PclCopyArea NAME(CopyArea)
-#define PclCopyPlane NAME(CopyPlane)
+#define PclPutImage PCLNAME(PutImage)
+#define PclCopyArea PCLNAME(CopyArea)
+#define PclCopyPlane PCLNAME(CopyPlane)
/* PclLine */
-#define PclPolyLine NAME(PolyLine)
-#define PclPolySegment NAME(PolySegment)
+#define PclPolyLine PCLNAME(PolyLine)
+#define PclPolySegment PCLNAME(PolySegment)
/* PclPixel.c */
-#define PclPolyPoint NAME(PolyPoint)
-#define PclPushPixels NAME(PushPixels)
+#define PclPolyPoint PCLNAME(PolyPoint)
+#define PclPushPixels PCLNAME(PushPixels)
/* PclPolygon.c */
-#define PclPolyRectangle NAME(PolyRectangle)
-#define PclFillPolygon NAME(FillPolygon)
-#define PclPolyFillRect NAME(PolyFillRect)
+#define PclPolyRectangle PCLNAME(PolyRectangle)
+#define PclFillPolygon PCLNAME(FillPolygon)
+#define PclPolyFillRect PCLNAME(PolyFillRect)
/* PclSpans.c */
-#define PclFillSpans NAME(FillSpans)
-#define PclSetSpans NAME(SetSpans)
+#define PclFillSpans PCLNAME(FillSpans)
+#define PclSetSpans PCLNAME(SetSpans)
/* PclText.c */
-#define PclPolyText8 NAME(PolyText8)
-#define PclPolyText16 NAME(PolyText16)
-#define PclImageText8 NAME(ImageText8)
-#define PclImageText16 NAME(ImageText16)
-#define PclImageGlyphBlt NAME(ImageGlyphBlt)
-#define PclPolyGlyphBlt NAME(PolyGlyphBlt)
-#define PclPolyGlyphBlt NAME(PolyGlyphBlt)
+#define PclPolyText8 PCLNAME(PolyText8)
+#define PclPolyText16 PCLNAME(PolyText16)
+#define PclImageText8 PCLNAME(ImageText8)
+#define PclImageText16 PCLNAME(ImageText16)
+#define PclImageGlyphBlt PCLNAME(ImageGlyphBlt)
+#define PclPolyGlyphBlt PCLNAME(PolyGlyphBlt)
+#define PclPolyGlyphBlt PCLNAME(PolyGlyphBlt)
/* PclFonts.c */
-#define PclRealizeFont NAME(RealizeFont)
-#define PclUnrealizeFont NAME(UnrealizeFont)
+#define PclRealizeFont PCLNAME(RealizeFont)
+#define PclUnrealizeFont PCLNAME(UnrealizeFont)
/* PclSFonts.c */
-#define PclDownloadSoftFont8 NAME(DownloadSoftFont8)
-#define PclDownloadSoftFont16 NAME(DownloadSoftFont16)
-#define PclCreateSoftFontInfo NAME(CreateSoftFontInfo)
-#define PclDestroySoftFontInfo NAME(DestroySoftFontInfo)
+#define PclDownloadSoftFont8 PCLNAME(DownloadSoftFont8)
+#define PclDownloadSoftFont16 PCLNAME(DownloadSoftFont16)
+#define PclCreateSoftFontInfo PCLNAME(CreateSoftFontInfo)
+#define PclDestroySoftFontInfo PCLNAME(DestroySoftFontInfo)
/* PclMisc.c */
-#define PclQueryBestSize NAME(QueryBestSize)
-#define GetPropString NAME(GetPropString)
-#define SystemCmd NAME(SystemCmd)
-#define PclGetMediumDimensions NAME(GetMediumDimensions)
-#define PclGetReproducibleArea NAME(GetReproducibleArea)
-#define PclSpoolFigs NAME(SpoolFigs)
-#define PclSendData NAME(SendData)
+#define PclQueryBestSize PCLNAME(QueryBestSize)
+#define GetPropString PCLNAME(GetPropString)
+#define SystemCmd PCLNAME(SystemCmd)
+#define PclGetMediumDimensions PCLNAME(GetMediumDimensions)
+#define PclGetReproducibleArea PCLNAME(GetReproducibleArea)
+#define PclSpoolFigs PCLNAME(SpoolFigs)
+#define PclSendData PCLNAME(SendData)
/* PclCursor.c */
-#define PclConstrainCursor NAME(ConstrainCursor)
-#define PclCursorLimits NAME(CursorLimits)
-#define PclDisplayCursor NAME(DisplayCursor)
-#define PclRealizeCursor NAME(RealizeCursor)
-#define PclUnrealizeCursor NAME(UnrealizeCursor)
-#define PclRecolorCursor NAME(RecolorCursor)
-#define PclSetCursorPosition NAME(SetCursorPosition)
+#define PclConstrainCursor PCLNAME(ConstrainCursor)
+#define PclCursorLimits PCLNAME(CursorLimits)
+#define PclDisplayCursor PCLNAME(DisplayCursor)
+#define PclRealizeCursor PCLNAME(RealizeCursor)
+#define PclUnrealizeCursor PCLNAME(UnrealizeCursor)
+#define PclRecolorCursor PCLNAME(RecolorCursor)
+#define PclSetCursorPosition PCLNAME(SetCursorPosition)
+
+#endif
#endif /* _PCLMAP_H_ */
diff --git a/Xprint/ps/Ps.h b/Xprint/ps/Ps.h
index 942e8f9f8..9c65dc26f 100644
--- a/Xprint/ps/Ps.h
+++ b/Xprint/ps/Ps.h
@@ -7,7 +7,6 @@ Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
-documentation.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
@@ -74,6 +73,7 @@ in this Software without prior written authorization from The Open Group.
** *********************************************************
**
********************************************************************/
+/* $XFree86: xc/programs/Xserver/Xprint/ps/Ps.h,v 1.13 2001/12/21 21:02:05 dawes Exp $ */
#ifndef _PS_H_
#define _PS_H_
@@ -87,24 +87,11 @@ in this Software without prior written authorization from The Open Group.
#include "scrnintstr.h"
#include "dix.h"
-/*
-#include "X.h"
-#include "Xproto.h"
-#include "Xatom.h"
-#include "misc.h"
-#include "screenint.h"
-#include "colormapst.h"
-#include "windowstr.h"
-#include "propertyst.h"
-#include "servermd.h"*/ /* needed for IMAGE_BUFSIZE */
-
#include "PsDef.h"
#include "psout.h"
-#define _XP_PRINT_SERVER_
-#include "Print.h"
-#include "extensions/Printstr.h"
-#undef _XP_PRINT_SERVER_
+#include <X11/extensions/Print.h>
+#include <X11/extensions/Printstr.h>
#include "miscstruct.h"
#include "fontstruct.h"
@@ -114,13 +101,17 @@ in this Software without prior written authorization from The Open Group.
/*
* Some sleazes to force the XrmDB stuff into the server
*/
+#ifndef HAVE_XPointer
typedef char *XPointer;
#define Status int
#define True 1
#define False 0
+#endif
+
#include "misc.h"
-#include <Xfuncproto.h>
-#include "../Xresource.h"
+#include <X11/Xfuncproto.h>
+#include <X11/Xresource.h>
+#include "attributes.h"
/*
* Public index variables from PsInit.c
@@ -130,7 +121,7 @@ extern int PsScreenPrivateIndex;
extern int PsWindowPrivateIndex;
extern int PsContextPrivateIndex;
extern int PsPixmapPrivateIndex;
-extern int PsGCPrivateIndex;
+extern XpValidatePoolsRec PsValidatePoolsRec;
/*
* Display list structures
@@ -255,7 +246,7 @@ typedef struct
{
XrmDatabase resDB;
ColormapPtr CMap;
- Bool (*DestroyWindow)();
+ Bool (*DestroyWindow)(WindowPtr);
} PsScreenPrivRec, *PsScreenPrivPtr;
typedef struct
@@ -278,12 +269,6 @@ typedef struct
typedef struct
{
- unsigned freeCompClip;
- RegionPtr pCompositeClip;
-} PsGCPrivRec, *PsGCPrivPtr;
-
-typedef struct
-{
XpContextPtr context;
GC lastGC;
int validGC;
@@ -296,7 +281,9 @@ typedef struct
#define SEND_PS(f,c) fwrite( c, sizeof( char ), strlen( c ), f )
#define MIN(a,b) (((a)<(b))?(a):(b))
+#ifndef MAX
#define MAX(a,b) (((a)>(b))?(a):(b))
+#endif
/*
* Functions in PsInit.c
@@ -304,7 +291,6 @@ typedef struct
extern Bool InitializePsDriver(int ndx, ScreenPtr pScreen, int argc,
char **argv);
-static Bool PsDestroyContext(XpContextPtr pCon);
extern XpContextPtr PsGetContextFromWindow(WindowPtr win);
/*
@@ -328,9 +314,6 @@ extern int PsGetDocumentData(XpContextPtr pCon, ClientPtr client,
*/
extern Bool PsCreateGC(GCPtr pGC);
-static int PsGetDrawablePrivateStuff(DrawablePtr pDrawable, GC *gc,
- unsigned long *valid, PsOutPtr *psOut,
- ColormapPtr *cMap);
extern int PsUpdateDrawableGC(GCPtr pGC, DrawablePtr pDrawable,
PsOutPtr *psOut, ColormapPtr *cMap);
extern void PsValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable);
@@ -383,6 +366,9 @@ extern void PsPutScaledImage(DrawablePtr pDrawable, GCPtr pGC, int depth,
extern void PsPutImage(DrawablePtr pDrawable, GCPtr pGC, int depth,
int x, int y, int w, int h, int leftPad, int format,
char *pImage);
+extern void PsPutImageMask(DrawablePtr pDrawable, GCPtr pGC, int depth,
+ int x, int y, int w, int h, int leftPad, int format,
+ char *pImage);
extern RegionPtr PsCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
int srcx, int srcy, int width, int height,
int dstx, int dsty);
@@ -517,4 +503,14 @@ extern PsElmPtr PsCreateFillElementList(PixmapPtr pix, int *nElms);
extern PsElmPtr PsCloneFillElementList(int nElms, PsElmPtr elms);
extern void PsDestroyFillElementList(int nElms, PsElmPtr elms);
+/*
+ * Functions in PsCache.c
+ */
+
+#ifdef BM_CACHE
+extern int PsBmIsImageCached(int gWidth, int gHeight, char *pBuffer);
+extern int PsBmPutImageInCache(int gWidth, int gHeight, char *pBuffer);
+extern void PsBmClearImageCache(void);
+#endif
+
#endif /* _PS_H_ */
diff --git a/Xprint/ps/PsArea.c b/Xprint/ps/PsArea.c
index 134686a87..eed650ada 100644
--- a/Xprint/ps/PsArea.c
+++ b/Xprint/ps/PsArea.c
@@ -228,7 +228,7 @@ error:
return;
}
-void
+static void
PsPutScaledImageIM(DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y,
int w, int h, int leftPad, int format, int imageRes, char *pImage)
{
@@ -269,9 +269,9 @@ PsPutScaledImageIM(DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y,
ColormapPtr cMap;
int pageRes, sw, sh;
#ifdef BM_CACHE
- long cache_id = 0;
+ long cache_id = 0;
#endif
-
+
if( PsUpdateDrawableGC(pGC, pDrawable, &psOut, &cMap)==FALSE ) return;
if (!imageRes) {
sw = w;
@@ -296,100 +296,100 @@ PsPutScaledImageIM(DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y,
PsOut_BeginImageCache(psOut, cache_id);
#endif
- if( depth==24 )
+ if( depth==24 )
+ {
+ PsOut_BeginImageIM(psOut, 0, 0, x, y, w, h, sw, sh, 3);
+ if( format==XYPixmap )
{
- PsOut_BeginImageIM(psOut, 0, 0, x, y, w, h, sw, sh, 3);
- if( format==XYPixmap )
- {
- int rowsiz = PixmapBytePad(w, depth);
- char *planes[3];
- planes[0] = pImage;
- planes[1] = &pImage[rowsiz*h];
- planes[2] = &pImage[rowsiz*h*2];
- for( r=0 ; r<h ; r++ )
- {
- char *pt[3];
- for( i=0 ; i<3 ; i++ ) pt[i] = &planes[i][rowsiz*r];
- for( c=0 ; c<w ; c++ )
- {
- for( i=0 ; i<3 ; i++ )
- { PsOut_OutImageBytes(psOut, 1, &pt[i][c]); pt[i]++; }
- }
- }
- }
- else if( format==ZPixmap )
+ int rowsiz = PixmapBytePad(w, depth);
+ char *planes[3];
+ planes[0] = pImage;
+ planes[1] = &pImage[rowsiz*h];
+ planes[2] = &pImage[rowsiz*h*2];
+ for( r=0 ; r<h ; r++ )
{
- int rowsiz = PixmapBytePad(w, depth);
- for( r=0 ; r<h ; r++ )
+ char *pt[3];
+ for( i=0 ; i<3 ; i++ ) pt[i] = &planes[i][rowsiz*r];
+ for( c=0 ; c<w ; c++ )
{
- char *pt = &pImage[rowsiz*r];
- for( c=0 ; c<w ; c++,pt+=4 )
- {
- if( swap )
- {
- char tmp[4];
- tmp[0] = pt[3]; tmp[1] = pt[2]; tmp[2] = pt[1]; tmp[3] = pt[0];
- PsOut_OutImageBytes(psOut, 3, &tmp[1]);
- }
- else
- PsOut_OutImageBytes(psOut, 3, &pt[1]);
- }
+ for( i=0 ; i<3 ; i++ )
+ { PsOut_OutImageBytes(psOut, 1, &pt[i][c]); pt[i]++; }
}
}
- else goto error;
- PsOut_EndImage(psOut);
}
- else if( depth==8 )
+ else if( format==ZPixmap )
{
int rowsiz = PixmapBytePad(w, depth);
- PsOut_BeginImageIM(psOut, 0, 0, x, y, w, h, sw, sh, 3);
for( r=0 ; r<h ; r++ )
{
char *pt = &pImage[rowsiz*r];
- for( c=0 ; c<w ; c++,pt++ )
+ for( c=0 ; c<w ; c++,pt+=4 )
{
- int val = PsGetPixelColor(cMap, (int)(*pt)&0xFF);
- char *ipt = (char *)&val;
if( swap )
{
char tmp[4];
- tmp[0] = ipt[3]; tmp[1] = ipt[2]; tmp[2] = ipt[1]; tmp[3] = ipt[0];
+ tmp[0] = pt[3]; tmp[1] = pt[2]; tmp[2] = pt[1]; tmp[3] = pt[0];
PsOut_OutImageBytes(psOut, 3, &tmp[1]);
}
else
- PsOut_OutImageBytes(psOut, 3, &ipt[1]);
+ PsOut_OutImageBytes(psOut, 3, &pt[1]);
}
}
- PsOut_EndImage(psOut);
}
- else if( depth==1 )
+ else goto error;
+ PsOut_EndImage(psOut);
+ }
+ else if( depth==8 )
+ {
+ int rowsiz = PixmapBytePad(w, depth);
+ PsOut_BeginImageIM(psOut, 0, 0, x, y, w, h, sw, sh, 3);
+ for( r=0 ; r<h ; r++ )
{
+ char *pt = &pImage[rowsiz*r];
+ for( c=0 ; c<w ; c++,pt++ )
{
- int rowsiz = BitmapBytePad(w);
- int psrsiz = (w+7)/8;
- PsOut_BeginImageIM(psOut, PsGetPixelColor(cMap, pGC->bgPixel),
- PsGetPixelColor(cMap, pGC->fgPixel),
- x, y, w, h, sw, sh, 1);
- for( r=0 ; r<h ; r++ )
+ int val = PsGetPixelColor(cMap, (int)(*pt)&0xFF);
+ char *ipt = (char *)&val;
+ if( swap )
{
- char *pt = &pImage[rowsiz*r];
- for( i=0 ; i<psrsiz ; i++ )
- {
- int iv_, iv = (int)pt[i]&0xFF;
- char c;
- if( swap )
- { for( j=0,iv_=0 ; j<8 ; j++ ) iv_ |= (((iv>>j)&1)<<(7-j)); }
- else
- iv_ = iv;
- c = iv_;
- PsOut_OutImageBytes(psOut, 1, &c);
- }
+ char tmp[4];
+ tmp[0] = ipt[3]; tmp[1] = ipt[2]; tmp[2] = ipt[1]; tmp[3] = ipt[0];
+ PsOut_OutImageBytes(psOut, 3, &tmp[1]);
}
- PsOut_EndImage(psOut);
+ else
+ PsOut_OutImageBytes(psOut, 3, &ipt[1]);
}
}
+ PsOut_EndImage(psOut);
+ }
+ else if( depth==1 )
+ {
+ {
+ int rowsiz = BitmapBytePad(w);
+ int psrsiz = (w+7)/8;
+ PsOut_BeginImageIM(psOut, PsGetPixelColor(cMap, pGC->bgPixel),
+ PsGetPixelColor(cMap, pGC->fgPixel),
+ x, y, w, h, sw, sh, 1);
+ for( r=0 ; r<h ; r++ )
+ {
+ char *pt = &pImage[rowsiz*r];
+ for( i=0 ; i<psrsiz ; i++ )
+ {
+ int iv_, iv = (int)pt[i]&0xFF;
+ char c;
+ if( swap )
+ { for( j=0,iv_=0 ; j<8 ; j++ ) iv_ |= (((iv>>j)&1)<<(7-j)); }
+ else
+ iv_ = iv;
+ c = iv_;
+ PsOut_OutImageBytes(psOut, 1, &c);
+ }
+ }
+ PsOut_EndImage(psOut);
+ }
+ }
#ifdef BM_CACHE
- PsOut_EndImageCache(psOut);
+ PsOut_EndImageCache(psOut);
}
PsOut_ImageCache(psOut, x, y, cache_id, PsGetPixelColor(cMap, pGC->bgPixel),
PsGetPixelColor(cMap, pGC->fgPixel));
diff --git a/Xprint/ps/PsAttVal.c b/Xprint/ps/PsAttVal.c
index 83133e53a..a6a375487 100644
--- a/Xprint/ps/PsAttVal.c
+++ b/Xprint/ps/PsAttVal.c
@@ -32,6 +32,7 @@ not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from said
copyright holders.
*/
+/* $XFree86: xc/programs/Xserver/Xprint/ps/PsAttVal.c,v 1.5 2001/12/19 21:28:44 dawes Exp $ */
#include "Ps.h"
#include "AttrValid.h"
@@ -142,6 +143,13 @@ static XpOidDocFmtList DefaultEmbeddedFormatsSupported = {
DefaultEmbeddedFormatsSupportedFmts, XpNumber(DefaultEmbeddedFormatsSupportedFmts)
};
+/*
+** So filtered printers that accept other raw formats can be
+** used with this driver.
+**
+** Noah Roberts (jik-)
+*/
+#if 0
static XpOidDocFmt ValidRawFormatsSupportedFmts[] = {
{ "Postscript", "2", NULL }
@@ -149,6 +157,7 @@ static XpOidDocFmt ValidRawFormatsSupportedFmts[] = {
static XpOidDocFmtList ValidRawFormatsSupported = {
ValidRawFormatsSupportedFmts, XpNumber(ValidRawFormatsSupportedFmts)
};
+#endif
static XpOidDocFmt DefaultRawFormatsSupportedFmts[] = {
{ "Postscript", "2", NULL }
@@ -196,7 +205,7 @@ XpValidatePoolsRec PsValidatePoolsRec = {
&ValidPrinterResolutions, &DefaultPrinterResolutions,
&ValidEmbeddedFormatsSupported, &DefaultEmbeddedFormatsSupported,
&ValidListfontsModes, &DefaultListfontsModes,
- &ValidRawFormatsSupported, &DefaultRawFormatsSupported,
+ NULL /* Any raw format specified (NR)*/, &DefaultRawFormatsSupported,
&ValidSetupProviso,
&DefaultDocumentFormat
};
diff --git a/Xprint/ps/PsAttr.c b/Xprint/ps/PsAttr.c
index 8a5bee9e3..13c4e1978 100644
--- a/Xprint/ps/PsAttr.c
+++ b/Xprint/ps/PsAttr.c
@@ -57,6 +57,7 @@ in this Software without prior written authorization from The Open Group.
* or other dealings in this Software without prior written authorization
* from said copyright holders.
*/
+/* $XFree86: xc/programs/Xserver/Xprint/ps/PsAttr.c,v 1.5 2001/12/14 19:59:15 dawes Exp $ */
/*******************************************************************
**
@@ -75,7 +76,6 @@ in this Software without prior written authorization from The Open Group.
********************************************************************/
#include "Ps.h"
-#include "attributes.h"
char *
PsGetAttributes(
diff --git a/Xprint/ps/PsCache.c b/Xprint/ps/PsCache.c
index 8c9f4a926..b688fbba1 100644
--- a/Xprint/ps/PsCache.c
+++ b/Xprint/ps/PsCache.c
@@ -79,21 +79,21 @@ in this Software without prior written authorization from The Open Group.
#include "fntfil.h"
#include "fntfilst.h"
-#define GET 0
-#define RESET 1
+#define GET 0
+#define RESET 1
struct bm_cache_list {
- struct bm_cache_list *next;
- struct bm_cache_list *prev;
+ struct bm_cache_list *next;
+ struct bm_cache_list *prev;
int height;
- long id;
+ long id;
char *pBuffer;
};
struct bm_cache_head {
- struct bm_cache_list *head;
- int width;
- struct bm_cache_head *next;
+ struct bm_cache_list *head;
+ int width;
+ struct bm_cache_head *next;
struct bm_cache_head *prev;
};
@@ -106,14 +106,14 @@ PsBmUniqueId(int func)
if(func == RESET)
{
- unique_id = 0;
- return 0;
+ unique_id = 0;
+ return 0;
}
else
- return ++unique_id;
+ return ++unique_id;
}
-int
+int
PsBmIsImageCached(
int gWidth,
int gHeight,
@@ -126,28 +126,28 @@ PsBmIsImageCached(
{
if(pList->width == gWidth)
{
- struct bm_cache_list *pItem = pList->head;
-
- while(pItem != NULL)
- {
- if(pItem->height == gHeight)
- {
- int length = 4*(gWidth/32+(gWidth%32!=0))*gHeight;
-
- if(!memcmp(pItem->pBuffer, pBuffer, sizeof(char)*length))
- {
- return_val = pItem->id;
- break;
- }
- }
- else if(pItem->height > gHeight)
- break;
-
- pItem = pItem->next;
- }
+ struct bm_cache_list *pItem = pList->head;
+
+ while(pItem != NULL)
+ {
+ if(pItem->height == gHeight)
+ {
+ int length = 4*(gWidth/32+(gWidth%32!=0))*gHeight;
+
+ if(!memcmp(pItem->pBuffer, pBuffer, sizeof(char)*length))
+ {
+ return_val = pItem->id;
+ break;
+ }
+ }
+ else if(pItem->height > gHeight)
+ break;
+
+ pItem = pItem->next;
+ }
}
- else if(pList->width > gWidth)
- break;
+ else if(pList->width > gWidth)
+ break;
pList = pList->next;
}
@@ -180,39 +180,39 @@ PsBmPutImageInCache(
while(pList != NULL)
{
if(pList->width == gWidth)
- {
- struct bm_cache_list *pItem = pList->head;
-
- while(pItem != NULL)
- {
- if(pItem->height >= gHeight)
- {
- pNew->next = pItem;
- pNew->prev = pItem->prev;
- if(pItem->prev != NULL)
- pItem->prev->next = pNew;
+ {
+ struct bm_cache_list *pItem = pList->head;
+
+ while(pItem != NULL)
+ {
+ if(pItem->height >= gHeight)
+ {
+ pNew->next = pItem;
+ pNew->prev = pItem->prev;
+ if(pItem->prev != NULL)
+ pItem->prev->next = pNew;
else
- pList->head = pNew;
+ pList->head = pNew;
pItem->prev = pNew;
- return_val = pNew->id;
+ return_val = pNew->id;
- break;
- }
- else if(pItem->next == NULL)
- {
- pNew->prev = pItem;
- pItem->next = pNew;
+ break;
+ }
+ else if(pItem->next == NULL)
+ {
+ pNew->prev = pItem;
+ pItem->next = pNew;
- return_val = pNew->id;
+ return_val = pNew->id;
- break;
- }
+ break;
+ }
- pItem = pItem->next;
- }
+ pItem = pItem->next;
+ }
- break;
+ break;
}
pList = pList->next;
@@ -223,50 +223,50 @@ PsBmPutImageInCache(
struct bm_cache_head *pNewList;
pNewList = (struct bm_cache_head *)malloc(sizeof(struct bm_cache_head));
-
+
pNewList->next = NULL;
pNewList->prev = NULL;
pNewList->width = gWidth;
pNewList->head = pNew;
-
+
if(bm_cache == NULL)
{
- bm_cache = pNewList;
- return_val = pNew->id;
+ bm_cache = pNewList;
+ return_val = pNew->id;
}
else
{
- pList = bm_cache;
+ pList = bm_cache;
- while(pList != NULL)
- {
- if(pList->width > gWidth)
- {
- pNewList->next = pList;
- pNewList->prev = pList->prev;
+ while(pList != NULL)
+ {
+ if(pList->width > gWidth)
+ {
+ pNewList->next = pList;
+ pNewList->prev = pList->prev;
- if(pList->prev != NULL)
- pList->prev->next = pNewList;
+ if(pList->prev != NULL)
+ pList->prev->next = pNewList;
else
- bm_cache = pNewList;
- pList->prev = pNewList;
+ bm_cache = pNewList;
+ pList->prev = pNewList;
- return_val = pNew->id;
+ return_val = pNew->id;
- break;
- }
- else if(pList->next == NULL)
+ break;
+ }
+ else if(pList->next == NULL)
{
- pNewList->prev = pList;
- pList->next = pNewList;
+ pNewList->prev = pList;
+ pList->next = pNewList;
- return_val = pNew->id;
+ return_val = pNew->id;
- break;
- }
+ break;
+ }
- pList = pList->next;
- }
+ pList = pList->next;
+ }
}
}
@@ -280,35 +280,35 @@ PsBmClearImageCacheItem(
{
if(pItem != NULL)
{
- if(pItem->pBuffer != NULL)
- free(pItem->pBuffer);
+ if(pItem->pBuffer != NULL)
+ free(pItem->pBuffer);
pItem->pBuffer = NULL;
- if(pItem->next)
- PsBmClearImageCacheItem(pItem->next);
+ if(pItem->next)
+ PsBmClearImageCacheItem(pItem->next);
pItem->next = NULL;
- free(pItem);
- pItem = NULL;
+ free(pItem);
+ pItem = NULL;
}
}
-static void
+static void
PsBmClearImageCacheList(
struct bm_cache_head *pList)
{
if(pList != NULL)
{
- if(pList->head)
- PsBmClearImageCacheItem(pList->head);
+ if(pList->head)
+ PsBmClearImageCacheItem(pList->head);
pList->head = NULL;
- if(pList->next)
- PsBmClearImageCacheList(pList->next);
+ if(pList->next)
+ PsBmClearImageCacheList(pList->next);
pList->next = NULL;
- free(pList);
- pList = NULL;
+ free(pList);
+ pList = NULL;
}
}
diff --git a/Xprint/ps/PsColor.c b/Xprint/ps/PsColor.c
index 9c76904d6..92082226f 100644
--- a/Xprint/ps/PsColor.c
+++ b/Xprint/ps/PsColor.c
@@ -73,6 +73,7 @@ in this Software without prior written authorization from The Open Group.
** *********************************************************
**
********************************************************************/
+/* $XFree86: xc/programs/Xserver/Xprint/ps/PsColor.c,v 1.3 2001/12/14 19:59:15 dawes Exp $ */
#include "Ps.h"
#include "gcstruct.h"
@@ -85,7 +86,6 @@ PsCreateColormap(ColormapPtr pColor)
int i;
unsigned short rgb;
VisualPtr pVisual = pColor->pVisual;
- Pixel pix;
if( pVisual->class==TrueColor )
{
diff --git a/Xprint/ps/PsFonts.c b/Xprint/ps/PsFonts.c
index 1a4692692..15abc4b88 100644
--- a/Xprint/ps/PsFonts.c
+++ b/Xprint/ps/PsFonts.c
@@ -57,6 +57,7 @@ in this Software without prior written authorization from The Open Group.
* or other dealings in this Software without prior written authorization
* from said copyright holders.
*/
+/* $XFree86: xc/programs/Xserver/Xprint/ps/PsFonts.c,v 1.6 2001/12/19 21:55:59 dawes Exp $ */
/*******************************************************************
**
@@ -109,7 +110,7 @@ PsGetFontName(FontPtr pFont)
for( i=0 ; i<nprops ; i++ )
{
- if( props[i].name==name )
+ if( (Atom)props[i].name == name )
{ value = props[i].value; break; }
}
if( !value ) return (char *)0;
@@ -149,7 +150,7 @@ PsGetPSFontName(FontPtr pFont)
for( i=0 ; i<nprops ; i++ )
{
- if( props[i].name==name )
+ if( (Atom)props[i].name == name )
{ value = props[i].value; break; }
}
if( !value ) return (char *)0;
@@ -170,8 +171,8 @@ PsIsISOLatin1Encoding(FontPtr pFont)
for( i=0 ; i<nprops ; i++ )
{
- if( props[i].name==reg ) rv = props[i].value;
- if( props[i].name==enc ) ev = props[i].value;
+ if( (Atom)props[i].name == reg ) rv = props[i].value;
+ if( (Atom)props[i].name == enc ) ev = props[i].value;
}
if( rv ) rp = NameForAtom(rv);
if( ev ) ep = NameForAtom(ev);
diff --git a/Xprint/ps/PsGC.c b/Xprint/ps/PsGC.c
index c6e352279..c1e12f57c 100644
--- a/Xprint/ps/PsGC.c
+++ b/Xprint/ps/PsGC.c
@@ -57,6 +57,7 @@ in this Software without prior written authorization from The Open Group.
* or other dealings in this Software without prior written authorization
* from said copyright holders.
*/
+/* $XFree86: xc/programs/Xserver/Xprint/ps/PsGC.c,v 1.6 2001/12/14 19:59:15 dawes Exp $ */
/*******************************************************************
**
@@ -144,7 +145,6 @@ PsGetDrawablePrivateStuff(
ColormapPtr *cMap)
{
XpContextPtr pCon;
- PsPixmapPrivPtr pPriv;
PsContextPrivPtr cPriv;
PsScreenPrivPtr sPriv;
@@ -229,7 +229,7 @@ PsUpdateDrawableGC(
}
}
- if( freeClip ) (*pGC->pScreen->RegionDestroy)(pReg);
+ if( freeClip ) REGION_DESTROY(pGC->pScreen, pReg);
PsOut_Offset(*psOut, pDrawable->x, pDrawable->y);
PsOut_Clip(*psOut, pGC->clientClipType, (PsClipPtr)pGC->clientClip);
}
@@ -293,7 +293,7 @@ PsChangeClip(GCPtr pGC, int type, pointer pValue, int nrects)
clp->rects[i].w = (boxes[i].x2-boxes[i].x1)+1;
clp->rects[i].h = (boxes[i].y2-boxes[i].y1)+1;
}
- (*pGC->pScreen->RegionDestroy)((RegionPtr)pValue);
+ REGION_DESTROY(pGC->pScreen, (RegionPtr)pValue);
break;
case CT_UNSORTED:
case CT_YSORTED:
diff --git a/Xprint/ps/PsInit.c b/Xprint/ps/PsInit.c
index 72c83448e..fe2471185 100644
--- a/Xprint/ps/PsInit.c
+++ b/Xprint/ps/PsInit.c
@@ -71,33 +71,35 @@ in this Software without prior written authorization from The Open Group.
** * Copyright: Copyright 1996 The Open Group, Inc.
** *
** *********************************************************
-**
+**
********************************************************************/
+/* $XFree86: xc/programs/Xserver/Xprint/ps/PsInit.c,v 1.13 2002/10/16 21:13:33 dawes Exp $ */
#include <stdio.h>
#include <string.h>
+#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include "Ps.h"
+#include "mi.h"
#include "AttrValid.h"
#include "../../mfb/mfb.h"
#include "windowstr.h"
+#include "DiPrint.h"
static void AllocatePsPrivates(ScreenPtr pScreen);
static int PsInitContext(XpContextPtr pCon);
+static int PsDestroyContext(XpContextPtr pCon);
-extern Bool _XpBoolNoop();
-extern void _XpVoidNoop();
extern Bool cfbCreateDefColormap(ScreenPtr pScreen);
int PsScreenPrivateIndex;
int PsContextPrivateIndex;
int PsPixmapPrivateIndex;
int PsWindowPrivateIndex;
-int PsGCPrivateIndex;
Bool
InitializePsDriver(ndx, pScreen, argc, argv)
@@ -106,11 +108,7 @@ InitializePsDriver(ndx, pScreen, argc, argv)
int argc;
char **argv;
{
- int maxXres, maxYres, maxWidth, maxHeight;
- int maxRes, maxDim, numBytes;
PsScreenPrivPtr pPriv;
- char **printerNames;
- int numPrinters;
int nVisuals;
int nDepths;
VisualPtr visuals;
@@ -134,9 +132,9 @@ InitializePsDriver(ndx, pScreen, argc, argv)
pScreen->blackPixel = 1;
pScreen->whitePixel = 0;
pScreen->QueryBestSize = (QueryBestSizeProcPtr)PsQueryBestSize;
- pScreen->SaveScreen = _XpBoolNoop;
- pScreen->GetImage = _XpVoidNoop;
- pScreen->GetSpans = _XpVoidNoop;
+ pScreen->SaveScreen = (SaveScreenProcPtr)_XpBoolNoop;
+ pScreen->GetImage = (GetImageProcPtr)_XpVoidNoop;
+ pScreen->GetSpans = (GetSpansProcPtr)_XpVoidNoop;
pScreen->CreateWindow = PsCreateWindow;
pScreen->DestroyWindow = PsDestroyWindow;
pScreen->PositionWindow = PsPositionWindow;
@@ -207,18 +205,18 @@ InitializePsDriver(ndx, pScreen, argc, argv)
/* THE FOLLOWING CAUSES SERVER DEFAULT VISUAL TO BE 24 BIT */
/* miScreenInit(pScreen, (pointer)0,
pScreen->width, pScreen->height,
- pScreen->width / (pScreen->mmWidth / 25.40),
+ pScreen->width / (pScreen->mmWidth / 25.40),
pScreen->height / (pScreen->mmHeight / 25.40),
0, 24, nDepths,
- depths, visuals[1].vid, nVisuals, visuals, (miBSFuncPtr)0); */
+ depths, visuals[1].vid, nVisuals, visuals); */
/* THE FOLLOWING CAUSES SERVER DEFAULT VISUAL TO BE 8 BIT */
miScreenInit(pScreen, (pointer)0,
pScreen->width, pScreen->height,
- (int) (pScreen->width / (pScreen->mmWidth / 25.40)),
+ (int) (pScreen->width / (pScreen->mmWidth / 25.40)),
(int) (pScreen->height / (pScreen->mmHeight / 25.40)),
0, 8, nDepths,
- depths, visuals[1].vid, nVisuals, visuals, (miBSFuncPtr)0);
+ depths, visuals[1].vid, nVisuals, visuals);
if( cfbCreateDefColormap(pScreen)==FALSE ) return FALSE;
@@ -230,9 +228,9 @@ InitializePsDriver(ndx, pScreen, argc, argv)
static void
AllocatePsPrivates(ScreenPtr pScreen)
{
- static int PsGeneration = -1;
+ static unsigned long PsGeneration = 0;
- if(PsGeneration != serverGeneration)
+ if((unsigned long)PsGeneration != serverGeneration)
{
PsScreenPrivateIndex = AllocateScreenPrivateIndex();
@@ -241,13 +239,9 @@ AllocatePsPrivates(ScreenPtr pScreen)
sizeof(PsWindowPrivRec));
PsContextPrivateIndex = XpAllocateContextPrivateIndex();
- XpAllocateContextPrivate(PsContextPrivateIndex,
+ XpAllocateContextPrivate(PsContextPrivateIndex,
sizeof(PsContextPrivRec));
- PsGCPrivateIndex = AllocateGCPrivateIndex();
- AllocateGCPrivate(pScreen, PsGCPrivateIndex,
- sizeof(PsGCPrivRec));
-
PsPixmapPrivateIndex = AllocatePixmapPrivateIndex();
AllocatePixmapPrivate(pScreen, PsPixmapPrivateIndex,
sizeof(PsPixmapPrivRec));
@@ -280,8 +274,7 @@ PsInitContext(pCon)
XpDriverFuncsPtr pFuncs;
PsContextPrivPtr pConPriv;
char *server, *attrStr;
- extern XpValidatePoolsRec PsValidatePoolsRec;
-
+
/*
* Initialize the attribute store for this printer.
*/
@@ -299,15 +292,15 @@ PsInitContext(pCon)
pFuncs->EndPage = PsEndPage;
pFuncs->PutDocumentData = PsDocumentData;
pFuncs->GetDocumentData = PsGetDocumentData;
- pFuncs->GetAttributes = (char *(*)())PsGetAttributes;
- pFuncs->SetAttributes = (int (*)())PsSetAttributes;
- pFuncs->AugmentAttributes = (int (*)())PsAugmentAttributes;
- pFuncs->GetOneAttribute = (char *(*)())PsGetOneAttribute;
+ pFuncs->GetAttributes = PsGetAttributes;
+ pFuncs->SetAttributes = PsSetAttributes;
+ pFuncs->AugmentAttributes = PsAugmentAttributes;
+ pFuncs->GetOneAttribute = PsGetOneAttribute;
pFuncs->DestroyContext = PsDestroyContext;
pFuncs->GetMediumDimensions = PsGetMediumDimensions;
pFuncs->GetReproducibleArea = PsGetReproducibleArea;
pFuncs->SetImageResolution = PsSetImageResolution;
-
+
/*
* Set up the context privates
*/
@@ -326,15 +319,15 @@ PsInitContext(pCon)
server = XpGetOneAttribute( pCon, XPServerAttr, DOC_ATT_SUPP );
if ((attrStr = (char *) xalloc(strlen(server) +
strlen(DOC_ATT_SUPP) + strlen(DOC_ATT_VAL)
- + strlen(PAGE_ATT_VAL) + 6)) == NULL)
+ + strlen(PAGE_ATT_VAL) + 6)) == NULL)
{
return BadAlloc;
}
- sprintf(attrStr, "*%s:\t%s %s %s",
+ sprintf(attrStr, "*%s:\t%s %s %s",
DOC_ATT_SUPP, server, DOC_ATT_VAL, PAGE_ATT_VAL);
XpAugmentAttributes( pCon, XPPrinterAttr, attrStr);
xfree(attrStr);
-
+
/*
* job-attributes-supported
*/
@@ -347,7 +340,7 @@ PsInitContext(pCon)
sprintf(attrStr, "*%s:\t%s %s", JOB_ATT_SUPP, server, JOB_ATT_VAL);
XpAugmentAttributes(pCon, XPPrinterAttr, attrStr);
xfree(attrStr);
-
+
/*
* xp-page-attributes-supported
*/
@@ -378,7 +371,7 @@ PsDestroyContext(pCon)
{
PsContextPrivPtr pConPriv =
(PsContextPrivPtr)pCon->devPrivates[PsContextPrivateIndex].ptr;
-
+
if( pConPriv->pJobFile!=(FILE *)NULL )
{
fclose(pConPriv->pJobFile);
diff --git a/Xprint/ps/PsLine.c b/Xprint/ps/PsLine.c
index 23e105804..ff4c6da80 100644
--- a/Xprint/ps/PsLine.c
+++ b/Xprint/ps/PsLine.c
@@ -73,6 +73,7 @@ in this Software without prior written authorization from The Open Group.
** *********************************************************
**
********************************************************************/
+/* $XFree86: xc/programs/Xserver/Xprint/ps/PsLine.c,v 1.6 2001/12/14 19:59:16 dawes Exp $ */
#include "Ps.h"
#include "gcstruct.h"
diff --git a/Xprint/ps/PsMisc.c b/Xprint/ps/PsMisc.c
index 86d862ce1..75f692d56 100644
--- a/Xprint/ps/PsMisc.c
+++ b/Xprint/ps/PsMisc.c
@@ -73,6 +73,7 @@ in this Software without prior written authorization from The Open Group.
** *********************************************************
**
********************************************************************/
+/* $XFree86: xc/programs/Xserver/Xprint/ps/PsMisc.c,v 1.6 2001/12/14 19:59:16 dawes Exp $ */
#include "Xos.h" /* for SIGCLD on pre-POSIX systems */
#include <stdio.h>
diff --git a/Xprint/ps/PsPixel.c b/Xprint/ps/PsPixel.c
index c2c360d2e..09a89fa2d 100644
--- a/Xprint/ps/PsPixel.c
+++ b/Xprint/ps/PsPixel.c
@@ -73,6 +73,7 @@ in this Software without prior written authorization from The Open Group.
** *********************************************************
**
********************************************************************/
+/* $XFree86: xc/programs/Xserver/Xprint/ps/PsPixel.c,v 1.6 2001/12/14 19:59:16 dawes Exp $ */
#include <stdio.h>
diff --git a/Xprint/ps/PsPixmap.c b/Xprint/ps/PsPixmap.c
index 2c3e43245..2e821aa1c 100644
--- a/Xprint/ps/PsPixmap.c
+++ b/Xprint/ps/PsPixmap.c
@@ -57,7 +57,7 @@ in this Software without prior written authorization from The Open Group.
* or other dealings in this Software without prior written authorization
* from said copyright holders.
*/
-
+/* $XFree86: xc/programs/Xserver/Xprint/ps/PsPixmap.c,v 1.5 2001/12/14 19:59:16 dawes Exp $ */
/*******************************************************************
**
** *********************************************************
@@ -79,10 +79,6 @@ in this Software without prior written authorization from The Open Group.
#include "Ps.h"
-#define BitsPerPixel(d) (\
- (1 << PixmapWidthPaddingInfo[d].padBytesLog2) * 8 / \
- (PixmapWidthPaddingInfo[d].padRoundUp+1))
-
PixmapPtr
PsCreatePixmap(
ScreenPtr pScreen,
@@ -203,7 +199,7 @@ PsGetFreeDisplayBlock(PsPixmapPrivPtr priv)
return(disp);
}
-void
+static void
PsReplay(DisplayElmPtr elm, DrawablePtr pDrawable)
{
switch(elm->type)
@@ -492,6 +488,8 @@ PsCreateFillElementList(PixmapPtr pix, int *nElms)
case PolyFillArcCmd:
*nElms += elm->c.arcs.nArcs;
break;
+ default:
+ break;
}
}
}
@@ -554,6 +552,8 @@ PsCreateFillElementList(PixmapPtr pix, int *nElms)
*nElms += 1;
}
break;
+ default:
+ break;
}
}
}
diff --git a/Xprint/ps/PsPolygon.c b/Xprint/ps/PsPolygon.c
index e1f0b9003..0cd826f43 100644
--- a/Xprint/ps/PsPolygon.c
+++ b/Xprint/ps/PsPolygon.c
@@ -73,6 +73,7 @@ in this Software without prior written authorization from The Open Group.
** *********************************************************
**
********************************************************************/
+/* $XFree86: xc/programs/Xserver/Xprint/ps/PsPolygon.c,v 1.7 2001/12/14 19:59:17 dawes Exp $ */
#include "Ps.h"
#include "gcstruct.h"
@@ -175,7 +176,7 @@ PsFillPolygon(
}
else
{
- pts[0].x = pPoints[i].x; pts[0].y = pPoints[i].y;
+ pts[0].x = pPoints[0].x; pts[0].y = pPoints[0].y;
for( i=1 ; i<nPoints ; i++ )
{
pts[i].x = pts[i-1].x+pPoints[i].x;
diff --git a/Xprint/ps/PsPrint.c b/Xprint/ps/PsPrint.c
index 49ed97583..8a06205e5 100644
--- a/Xprint/ps/PsPrint.c
+++ b/Xprint/ps/PsPrint.c
@@ -73,6 +73,7 @@ in this Software without prior written authorization from The Open Group.
** *********************************************************
**
********************************************************************/
+/* $XFree86: xc/programs/Xserver/Xprint/ps/PsPrint.c,v 1.11 2001/12/21 21:02:06 dawes Exp $ */
#include <stdio.h>
#include <string.h>
@@ -90,7 +91,6 @@ in this Software without prior written authorization from The Open Group.
#include "Ps.h"
#include "windowstr.h"
-#include "attributes.h"
#include "Oid.h"
/* static utility function to get document/page attributes */
@@ -268,7 +268,7 @@ PsEndJob(
#ifdef BM_CACHE
PsBmClearImageCache();
#endif
-
+
return r;
}
@@ -281,13 +281,10 @@ PsStartPage(
{
int iorient, iplex, icount, ires;
unsigned short iwd, iht;
- register WindowPtr pChild;
PsContextPrivPtr pConPriv =
(PsContextPrivPtr)pCon->devPrivates[PsContextPrivateIndex].ptr;
PsWindowPrivPtr pWinPriv =
(PsWindowPrivPtr)pWin->devPrivates[PsWindowPrivateIndex].ptr;
- char s[80];
- xEvent event;
/*
* Put a pointer to the context in the window private structure
diff --git a/Xprint/ps/PsSpans.c b/Xprint/ps/PsSpans.c
index 4d8fb3459..32ca58d20 100644
--- a/Xprint/ps/PsSpans.c
+++ b/Xprint/ps/PsSpans.c
@@ -73,6 +73,7 @@ in this Software without prior written authorization from The Open Group.
** *********************************************************
**
********************************************************************/
+/* $XFree86: xc/programs/Xserver/Xprint/ps/PsSpans.c,v 1.9 2001/12/14 19:59:17 dawes Exp $ */
#include "Ps.h"
#include "gcstruct.h"
@@ -87,11 +88,10 @@ PsFillSpans(
int *pWidths,
int fSorted)
{
- char t[80];
PsOutPtr psOut;
int xoffset, yoffset;
xRectangle *rects, *r;
- RegionPtr fillRegion, region;
+ RegionPtr fillRegion, region = 0;
int i;
int nbox;
BoxPtr pbox;
@@ -113,14 +113,14 @@ PsFillSpans(
r->width = pWidths[i];
r->height = 1;
}
- fillRegion = miRectsToRegion(nSpans, rects,
+ fillRegion = RECTS_TO_REGION(pGC->pScreen, nSpans, rects,
(fSorted)?CT_YSORTED:CT_UNSORTED);
/*
* Intersect this region with the clip region. Whatever's left,
* should be filled.
*/
-/*miIntersect(region, fillRegion, pGC->clientClip);*/
+/*REGION_INTERSECT(pGC->pScreen, region, fillRegion, pGC->clientClip);*/
pbox = REGION_RECTS(region);
nbox = REGION_NUM_RECTS(region);
@@ -144,8 +144,8 @@ PsFillSpans(
/*
* Clean up the temporary regions
*/
- miRegionDestroy(fillRegion);
- miRegionDestroy(region);
+ REGION_DESTROY(pGC->pScreen, fillRegion);
+ REGION_DESTROY(pGC->pScreen, region);
xfree(rects);
}
diff --git a/Xprint/ps/PsText.c b/Xprint/ps/PsText.c
index 618d0a163..41ba592f6 100644
--- a/Xprint/ps/PsText.c
+++ b/Xprint/ps/PsText.c
@@ -73,11 +73,11 @@ in this Software without prior written authorization from The Open Group.
** *********************************************************
**
********************************************************************/
+/* $XFree86: xc/programs/Xserver/Xprint/ps/PsText.c,v 1.12 2001/12/14 19:59:17 dawes Exp $ */
#include "Ps.h"
#include "gcstruct.h"
#include "windowstr.h"
-#include "fntfil.h"
#include "fntfilst.h"
#include <sys/stat.h>
@@ -85,9 +85,8 @@ static int readFontName(char *fileName, char *file_name, char *dlfnam)
{
FILE *file;
struct stat statb;
- int count, i, status;
char buf[256];
- char *front, *end, *fn;
+ char *front, *fn;
file = fopen(fileName, "r");
if(file)
@@ -389,7 +388,7 @@ PsPolyGlyphBlt(
pointer pGlyphBase)
{
int width, height;
- PixmapPtr pPixmap;
+ PixmapPtr pPixmap = NullPixmap;
int nbyLine; /* bytes per line of padded pixmap */
FontPtr pfont;
GCPtr pGCtmp;
diff --git a/Xprint/ps/PsWindow.c b/Xprint/ps/PsWindow.c
index 3a9a7ed2a..87d8143aa 100644
--- a/Xprint/ps/PsWindow.c
+++ b/Xprint/ps/PsWindow.c
@@ -73,9 +73,11 @@ in this Software without prior written authorization from The Open Group.
** *********************************************************
**
********************************************************************/
+/* $XFree86: xc/programs/Xserver/Xprint/ps/PsWindow.c,v 1.12 2001/12/19 21:55:59 dawes Exp $ */
#include <stdio.h>
#include <string.h>
+#include <sys/types.h>
#include <sys/wait.h>
#include "mistruct.h"
@@ -85,8 +87,7 @@ in this Software without prior written authorization from The Open Group.
#include "Ps.h"
-extern WindowPtr *WindowTable;
-
+#if 0
/*
* The following list of strings defines the properties which will be
* placed on the screen's root window if the property was defined in
@@ -103,7 +104,7 @@ static char *propStrings[] = {
DT_PRINT_PAGE_COMMAND,
(char *)NULL
};
-
+#endif
/*
* PsCreateWindow - watch for the creation of the root window.
@@ -218,7 +219,6 @@ PsPaintWindow(
RegionPtr pRegion,
int what)
{
- int status;
WindowPtr pRoot;
#define FUNCTION 0
@@ -377,14 +377,14 @@ PsPaintWindow(
}
break;
case GCClipMask:
- if( (pointer)pGC->clientClipType!=(pointer)CT_NONE )
+ if( (pointer)(long)pGC->clientClipType!=(pointer)CT_NONE )
{
gcmask |= index;
gcval[i++] = (pointer)CT_NONE;
}
break;
case GCSubwindowMode:
- if( (pointer)pGC->subWindowMode!=newValues[SUBWINDOW] )
+ if( (pointer)(long)pGC->subWindowMode!=newValues[SUBWINDOW] )
{
gcmask |= index;
gcval[i++] = newValues[SUBWINDOW];
@@ -398,7 +398,7 @@ PsPaintWindow(
}
break;
case GCFillStyle:
- if( (pointer)pGC->fillStyle!=newValues[FILLSTYLE] )
+ if( (pointer)(long)pGC->fillStyle!=newValues[FILLSTYLE] )
{
gcmask |= index;
gcval[i++] = newValues[FILLSTYLE];
diff --git a/Xprint/ps/psout.c b/Xprint/ps/psout.c
index d4a64eacb..f1507d849 100644
--- a/Xprint/ps/psout.c
+++ b/Xprint/ps/psout.c
@@ -73,13 +73,24 @@ in this Software without prior written authorization from The Open Group.
** *********************************************************
**
********************************************************************/
+/* $XFree86: xc/programs/Xserver/Xprint/ps/psout.c,v 1.12 2001/12/21 21:02:06 dawes Exp $ */
+
+/*
+ * For XFree86 3.3.3:
+ *
+ * As a *quick* way of preventing some buffers overflowing onto the stack,
+ * they have been made static. There are potential problems with
+ * PsOutRec.Buf overflowing too which should be investigated as part of a
+ * review of this code, but that is at least always allocated with malloc
+ * and shouldn't pose an immediate stack trashing problem.
+ *
+ */
#include <stdlib.h>
#include "os.h"
+#include "Ps.h"
#include "psout.h"
-PsElmPtr PsCloneFillElementList(int nElms, PsElmPtr elms);
-
typedef void *voidPtr;
typedef struct PsPatRec_
@@ -398,7 +409,7 @@ static void
S_OutNum(PsOutPtr self, float num)
{
int i;
- char buf[64];
+ static char buf[64];
sprintf(buf, "%.3f", num);
for( i=strlen(buf)-1 ; buf[i]=='0' ; i-- ); buf[i+1] = '\0';
if( buf[strlen(buf)-1]=='.' ) buf[strlen(buf)-1] = '\0';
@@ -411,7 +422,7 @@ static void
S_OutStr(PsOutPtr self, char *txt, int txtl)
{
int i, k;
- char buf[512];
+ static char buf[512];
for( i=0,k=0 ; i<txtl ; i++ )
{
if( (txt[i]>=' ' && txt[i]<='~') &&
@@ -948,7 +959,7 @@ void
PsOut_TextAttrs(PsOutPtr self, char *fnam, int siz, int iso)
{
int i;
- char buf[256];
+ static char buf[256];
if( self->FontName && strcmp(fnam, self->FontName)==0 &&
siz==self->FontSize ) return;
if( self->FontName ) xfree(self->FontName);
@@ -968,7 +979,7 @@ void
PsOut_TextAttrsMtx(PsOutPtr self, char *fnam, float *mtx, int iso)
{
int i;
- char buf[256];
+ static char buf[256];
if( self->FontName && strcmp(fnam, self->FontName)==0 &&
mtx[0]==self->FontMtx[0] && mtx[1]==self->FontMtx[1] &&
mtx[2]==self->FontMtx[2] && mtx[3]==self->FontMtx[3] ) return;
@@ -1170,7 +1181,7 @@ PsOut_ImageCache(PsOutPtr self, int x, int y, long cache_id, int bclr, int fclr)
if( self->InFrame || self->InTile ) xo = yo = 0;
x += xo; y += yo;
- sprintf(cacheID, "c%di", cache_id);
+ sprintf(cacheID, "c%ldi", cache_id);
S_OutNum(self, (float)x);
S_OutNum(self, (float)y);
@@ -1203,7 +1214,7 @@ PsOut_BeginImageCache(PsOutPtr self, long cache_id)
{
char cacheID[10];
- sprintf(cacheID, "/c%di {", cache_id);
+ sprintf(cacheID, "/c%ldi {", cache_id);
S_OutTok(self, cacheID, 0);
} /* new */
@@ -1214,7 +1225,7 @@ PsOut_EndImageCache(PsOutPtr self)
S_OutTok(self, "}bd", 1);
} /* new */
#endif
-
+
void
PsOut_BeginImage(PsOutPtr self, int bclr, int fclr, int x, int y,
int w, int h, int sw, int sh, int format)
@@ -1477,11 +1488,13 @@ PsOut_BeginPattern(PsOutPtr self, void *tag, int w, int h, PsFillEnum type,
}
self->Patterns[self->NPatterns].tag = tag;
self->Patterns[self->NPatterns].type = type;
- sprintf(key, "/ %d", (int)tag);
+ sprintf(key, "/ %ld", (long)tag);
switch(type) {
case PsTile: key[1] = 't'; break;
case PsStip: key[1] = 's'; break;
- case PsOpStip: key[1] = 'o'; break; }
+ case PsOpStip: key[1] = 'o'; break;
+ default: break;
+ }
S_OutTok(self, key, 0);
S_OutTok(self, "db/PatternType 1 d/PaintType 1 d", 0);
S_OutTok(self, "/TilingType 1 d/BBox[0 0", 0);
@@ -1522,11 +1535,13 @@ PsOut_SetPattern(PsOutPtr self, void *tag, PsFillEnum type)
for( i=0 ; i<self->NPatterns ; i++ )
{ if( tag==self->Patterns[i].tag && type==self->Patterns[i].type ) break; }
if( i>=self->NPatterns ) return;
- sprintf(key, " %d", (int)tag);
+ sprintf(key, " %ld", (long)tag);
switch(type) {
case PsTile: key[0] = 't'; break;
case PsStip: key[0] = 's'; break;
- case PsOpStip: key[0] = 'o'; break; }
+ case PsOpStip: key[0] = 'o'; break;
+ default: break;
+ }
S_OutTok(self, key, 0);
S_OutTok(self, "spt", 1);
self->CurColor = 0xFFFFFFFF;
@@ -1546,7 +1561,7 @@ PsOut_DownloadType1(PsOutPtr self, char *name, char *fname)
{
int i;
int stt;
- char buf[256];
+ static char buf[256];
FILE *fp;
for( i=0 ; i<self->NDownloads ; i++ )
diff --git a/Xprint/ps/psout.h b/Xprint/ps/psout.h
index e8ca56458..2fe83ffc7 100644
--- a/Xprint/ps/psout.h
+++ b/Xprint/ps/psout.h
@@ -57,6 +57,7 @@ in this Software without prior written authorization from The Open Group.
* or other dealings in this Software without prior written authorization
* from said copyright holders.
*/
+/* $XFree86: xc/programs/Xserver/Xprint/ps/psout.h,v 1.5 2001/12/21 21:02:06 dawes Exp $ */
/*******************************************************************
**
@@ -182,8 +183,10 @@ extern void PsOut_DrawArc(PsOutPtr self, int x, int y, int w, int h,
extern void PsOut_Text(PsOutPtr self, int x, int y, char *text, int textl,
int bclr);
-extern void PsOut_BeginImage(PsOutPtr self, int bclr, int fclr, int x, int y,
+extern void PsOut_BeginImage(PsOutPtr self, int bclr, int fclr, int x, int y,
int w, int h, int sw, int sh, int format);
+extern void PsOut_BeginImageIM(PsOutPtr self, int bclr, int fclr, int x, int y,
+ int w, int h, int sw, int sh, int format);
extern void PsOut_EndImage(PsOutPtr self);
extern void PsOut_OutImageBytes(PsOutPtr self, int nBytes, char *bytes);
@@ -199,4 +202,14 @@ extern void PsOut_SetPattern(PsOutPtr self, void *tag, PsFillEnum type);
extern void PsOut_RawData(PsOutPtr self, char *data, int len);
extern void PsOut_DownloadType1(PsOutPtr self, char *name, char *fname);
+#ifdef BM_CACHE
+extern void PsOut_BeginImageCache(PsOutPtr self, long cache_id);
+extern void PsOut_EndImageCache(PsOutPtr self);
+extern void PsOut_ImageCache(PsOutPtr self, int x, int y, long cache_id,
+ int bclr, int fclr);
+#endif
+
+extern FILE *PsOut_ChangeFile(PsOutPtr self, FILE *fp);
+
+
#endif
diff --git a/Xprint/raster/Raster.c b/Xprint/raster/Raster.c
index db72b9b32..c7264c39a 100644
--- a/Xprint/raster/Raster.c
+++ b/Xprint/raster/Raster.c
@@ -30,6 +30,9 @@ not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from said
copyright holders.
*/
+
+/* $XFree86: xc/programs/Xserver/Xprint/raster/Raster.c,v 1.11 2001/12/21 21:02:06 dawes Exp $ */
+
/*******************************************************************
**
** *********************************************************
@@ -45,6 +48,7 @@ copyright holders.
**
********************************************************************/
+#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <sys/stat.h>
@@ -66,14 +70,15 @@ copyright holders.
#include "windowstr.h"
#include "propertyst.h"
#include "servermd.h" /* needed for IMAGE_BUFSIZE */
+#include "mfb.h"
+#include "mi.h"
-#define _XP_PRINT_SERVER_
-#include "extensions/Print.h"
-#undef _XP_PRINT_SERVER_
+#include <X11/extensions/Print.h>
#include "Raster.h"
#include "attributes.h"
#include "AttrValid.h"
+#include "DiPrint.h"
static void AllocateRasterPrivates(
ScreenPtr pScreen);
@@ -82,12 +87,14 @@ static Bool RasterChangeWindowAttributes(
unsigned long mask);
static int StartJob(
XpContextPtr pCon,
- Bool sendClientData);
+ Bool sendClientData,
+ ClientPtr client);
static int StartPage(
XpContextPtr pCon,
WindowPtr pWin);
static int StartDoc(
- XpContextPtr pCon);
+ XpContextPtr pCon,
+ XPDocumentType type);
static int EndDoc(
XpContextPtr pCon,
Bool cancel);
@@ -96,8 +103,7 @@ static int EndJob(
Bool cancel);
static int EndPage(
XpContextPtr pCon,
- WindowPtr pWin,
- Bool cancel);
+ WindowPtr pWin);
static int DocumentData(
XpContextPtr pCon,
DrawablePtr pDraw,
@@ -127,10 +133,10 @@ static char *RasterGetAttributes(
static char *RasterGetOneAttribute(XpContextPtr pCon,
XPAttributes class,
char *attribute);
-static void RasterSetAttributes(XpContextPtr pCon,
+static int RasterSetAttributes(XpContextPtr pCon,
XPAttributes class,
char *attributes);
-static void RasterAugmentAttributes(XpContextPtr pCon,
+static int RasterAugmentAttributes(XpContextPtr pCon,
XPAttributes class,
char *attributes);
static int RasterMediumDimensions(XpContextPtr pCon,
@@ -143,17 +149,6 @@ static int RasterReproducibleArea(XpContextPtr pCon,
#define DOC_PCL 1
#define DOC_RASTER 2
-extern Bool _XpBoolNoop();
-extern void _XpVoidNoop();
-extern void XpDestroyAttributes();
-extern char *ReplaceFileString(
- char *string,
- char *inFileName,
- char *outFileName);
-extern char *XpGetConfigDir();
-
-extern XpValidatePoolsRec RasterValidatePoolsRec; /* From RasterAttVal.c */
-
static int RasterScreenPrivateIndex, RasterContextPrivateIndex;
static int RasterGeneration = 0;
static char RASTER_DRIV_NAME[] = "XP-RASTER";
@@ -189,13 +184,9 @@ InitializeRasterDriver(
int argc,
char **argv)
{
- char specifier[MAX_TOKEN_LEN];
- int xRes, yRes, maxWidth, maxHeight;
+ int xRes, yRes;
int maxRes, maxDim, numBytes;
RasterScreenPrivPtr pPriv;
- XpDriverFuncsPtr pFuncs;
- char **printerNames, *printDescFile;
- int numPrinters;
/*
* Register this driver's InitContext function with the print extension.
@@ -229,6 +220,7 @@ InitializeRasterDriver(
*/
mfbScreenInit(pScreen, pPriv->pBits, maxDim, maxDim, maxRes,
maxRes, maxDim);
+ miInitializeBackingStore(pScreen);
pScreen->blackPixel = 1;
pScreen->whitePixel = 0;
if(mfbCreateDefColormap(pScreen) == FALSE)
@@ -237,10 +229,11 @@ InitializeRasterDriver(
/*
cfbScreenInit(pScreen, pPriv->pBits, maxWidth, maxHeight, maxXres,
maxYres, maxWidth);
+ miInitializeBackingStore(pScreen);
scalingScreenInit(pScreen);
*/
- pScreen->SaveScreen = _XpBoolNoop;
+ pScreen->SaveScreen = (SaveScreenProcPtr)_XpBoolNoop;
pPriv->ChangeWindowAttributes = pScreen->ChangeWindowAttributes;
pScreen->ChangeWindowAttributes = RasterChangeWindowAttributes;
pPriv->CloseScreen = pScreen->CloseScreen;
@@ -379,11 +372,11 @@ SetDocumentType(
static int
StartJob(
XpContextPtr pCon,
- Bool sendClientData)
+ Bool sendClientData,
+ ClientPtr client)
{
RasterContextPrivPtr pConPriv = (RasterContextPrivPtr)
pCon->devPrivates[RasterContextPrivateIndex].ptr;
- char *jobHeader;
SetDocumentType( pCon );
@@ -424,7 +417,8 @@ StartJob(
static int
StartDoc(
- XpContextPtr pCon)
+ XpContextPtr pCon,
+ XPDocumentType type)
{
return Success;
}
@@ -436,6 +430,10 @@ static int EndDoc(
return Success;
}
+#if 0
+
+/* XXX Not used. */
+
/*
* BuidArgVector takes a pointer to a comma-separated list of command
* options and splits it out into an array of argument pointers. The
@@ -453,7 +451,6 @@ BuildArgVector(
int argCount)
{
char *curArg, *lastChar, *endArg;
- int optionLen;
curArg = optionList;
lastChar = optionList + strlen(optionList); /* includes final NULL */
@@ -488,6 +485,7 @@ BuildArgVector(
return argVector;
}
+#endif
static int
EndJob(
@@ -555,11 +553,8 @@ StartPage(
XpContextPtr pCon,
WindowPtr pWin)
{
- register WindowPtr pChild;
RasterContextPrivPtr pConPriv = (RasterContextPrivPtr)
pCon->devPrivates[RasterContextPrivateIndex].ptr;
- unsigned short width, height;
- xEvent event;
if(pConPriv->pPageFile != (FILE *)NULL)
{
@@ -652,7 +647,7 @@ Get_XWDColors(
return(colors);
}
-static
+static void
_swapshort (
register char *bp,
register unsigned n)
@@ -668,7 +663,7 @@ _swapshort (
}
}
-static
+static void
_swaplong (
register char *bp,
register unsigned n)
@@ -879,19 +874,14 @@ SendPage( XpContextPtr pCon )
static int
EndPage(
XpContextPtr pCon,
- WindowPtr pWin,
- Bool cancel)
+ WindowPtr pWin)
{
RasterContextPrivPtr pConPriv = (RasterContextPrivPtr)
pCon->devPrivates[RasterContextPrivateIndex].ptr;
struct stat statBuf;
- char *rasterFileName = (char *)NULL, *pCommand = (char *)NULL,
- *pHeader = (char *)NULL, *pTrailer = (char *)NULL;
+ char *rasterFileName = (char *)NULL, *pCommand = (char *)NULL;
FILE *pRasterFile = (FILE *)NULL;
- if( cancel == True )
- return Success;
-
if(pConPriv->pageFileName == (char *)NULL)
{
/*
@@ -1194,14 +1184,13 @@ RasterChangeWindowAttributes(
mask |= CWBackingStore;
}
- if(pScreenPriv->ChangeWindowAttributes != (Bool (*)())NULL)
+ if(pScreenPriv->ChangeWindowAttributes != NULL)
{
pScreen->ChangeWindowAttributes = pScreenPriv->ChangeWindowAttributes;
status = pScreen->ChangeWindowAttributes(pWin, mask);
pScreen->ChangeWindowAttributes = RasterChangeWindowAttributes;
}
- if(status != TRUE)
- return status;
+ return status;
}
/*
@@ -1275,12 +1264,12 @@ RasterInitContext(
pFuncs->PutDocumentData = DocumentData;
pFuncs->GetDocumentData = GetDocumentData;
pFuncs->DestroyContext = RasterDestroyContext;
- pFuncs->GetAttributes = (char *(*)())RasterGetAttributes;
- pFuncs->GetOneAttribute = (char *(*)())RasterGetOneAttribute;
- pFuncs->SetAttributes = (int(*)())RasterSetAttributes;
- pFuncs->AugmentAttributes = (int(*)())RasterAugmentAttributes;
- pFuncs->GetMediumDimensions = (int(*)())RasterMediumDimensions;
- pFuncs->GetReproducibleArea = (int(*)())RasterReproducibleArea;
+ pFuncs->GetAttributes = RasterGetAttributes;
+ pFuncs->GetOneAttribute = RasterGetOneAttribute;
+ pFuncs->SetAttributes = RasterSetAttributes;
+ pFuncs->AugmentAttributes = RasterAugmentAttributes;
+ pFuncs->GetMediumDimensions = RasterMediumDimensions;
+ pFuncs->GetReproducibleArea = RasterReproducibleArea;
/*
* Set up the context privates
@@ -1415,21 +1404,21 @@ RasterGetOneAttribute(
return XpGetOneAttribute( pContext, class, attr );
}
-static void
+static int
RasterSetAttributes(XpContextPtr pCon,
XPAttributes class,
char *attributes)
{
- XpSetAttributes( pCon, class, attributes );
+ return XpSetAttributes( pCon, class, attributes );
}
-static void
+static int
RasterAugmentAttributes(
XpContextPtr pCon,
XPAttributes class,
char *attributes)
{
- XpAugmentAttributes( pCon, class, attributes );
+ return XpAugmentAttributes( pCon, class, attributes );
}
static void
@@ -1498,7 +1487,7 @@ RasterCloseScreen(
/*
* Call any wrapped CloseScreen proc.
*/
- if(pScreenPriv->CloseScreen != (Bool (*)())NULL)
+ if(pScreenPriv->CloseScreen != NULL)
{
pScreen->CloseScreen = pScreenPriv->CloseScreen;
status = pScreen->CloseScreen(index, pScreen);
@@ -1517,6 +1506,7 @@ RasterCloseScreen(
static void SigchldHndlr (int dummy)
{
int status, w;
+ int olderrno = errno;
struct sigaction act;
sigfillset(&act.sa_mask);
act.sa_flags = 0;
@@ -1528,6 +1518,7 @@ static void SigchldHndlr (int dummy)
* Is this really necessary?
*/
sigaction(SIGCHLD, &act, (struct sigaction *)NULL);
+ errno = olderrno;
}
/*
diff --git a/Xprint/raster/Raster.h b/Xprint/raster/Raster.h
index b793f89a0..0533cd5b2 100644
--- a/Xprint/raster/Raster.h
+++ b/Xprint/raster/Raster.h
@@ -30,6 +30,8 @@ not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from said
copyright holders.
*/
+/* $XFree86: xc/programs/Xserver/Xprint/raster/Raster.h,v 1.4 2001/12/21 21:02:06 dawes Exp $ */
+
/*******************************************************************
**
** *********************************************************
@@ -50,17 +52,18 @@ copyright holders.
/*
* Some sleazes to force the XrmDB stuff into the server
*/
+#ifndef HAVE_XPointer
typedef char *XPointer;
+#endif
#define Status int
#define True 1
#define False 0
#include "misc.h"
#include <Xfuncproto.h>
-#include "../Xresource.h"
+#include <X11/Xresource.h>
+#include "attributes.h"
-#define _XP_PRINT_SERVER_
-#include "extensions/Printstr.h"
-#undef _XP_PRINT_SERVER_
+#include <X11/extensions/Printstr.h>
#define MAX_TOKEN_LEN 512
@@ -81,10 +84,10 @@ typedef char *XPointer;
typedef struct {
char *pBits;
- Bool (* CreateWindow)(); /* pWin */
- Bool (* ChangeWindowAttributes)(); /* pWin, mask */
- Bool (* DestroyWindow)(); /* pWin */
- Bool (* CloseScreen)(); /* index, pScreen */
+ CreateWindowProcPtr CreateWindow;
+ ChangeWindowAttributesProcPtr ChangeWindowAttributes;
+ DestroyWindowProcPtr DestroyWindow;
+ CloseScreenProcPtr CloseScreen;
} RasterScreenPrivRec, *RasterScreenPrivPtr;
typedef struct {
@@ -103,4 +106,10 @@ typedef struct {
int getDocBufSize;
} RasterContextPrivRec, *RasterContextPrivPtr;
+
+extern XpValidatePoolsRec RasterValidatePoolsRec;
+
+extern Bool InitializeRasterDriver(int ndx, ScreenPtr pScreen, int argc,
+ char **argv);
+
#endif /* _RASTER_H_ */
diff --git a/Xprint/raster/RasterAttVal.c b/Xprint/raster/RasterAttVal.c
index f76a890d3..7cce3f22a 100644
--- a/Xprint/raster/RasterAttVal.c
+++ b/Xprint/raster/RasterAttVal.c
@@ -30,15 +30,15 @@ not be used in advertising or otherwise to promote the sale, use or other
dealings in this Software without prior written authorization from said
copyright holders.
*/
+/* $XFree86: xc/programs/Xserver/Xprint/raster/RasterAttVal.c,v 1.4 2001/12/21 21:02:06 dawes Exp $ */
+
#include <stdio.h>
#include "X.h"
#include "misc.h"
#include "dixstruct.h"
#include "scrnintstr.h"
#include "screenint.h"
-#define _XP_PRINT_SERVER_
-#include "extensions/Print.h"
-#undef _XP_PRINT_SERVER_
+#include <X11/extensions/Print.h>
#include "Raster.h"
#include "attributes.h"