From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from exchange-server.intranet.ggtg.net ([195.137.15.66]) by metis.ext.pengutronix.de with esmtp (Exim 4.72) (envelope-from ) id 1WKqIH-0001gl-H1 for ptxdist@pengutronix.de; Tue, 04 Mar 2014 15:26:28 +0100 From: David Thomas Date: Tue, 4 Mar 2014 14:25:54 +0000 Message-ID: <63F3A45AB9EA8943A92845E4748C0F4B010E55E8@exchange-server.intranet.ggtg.net> Content-Language: en-US MIME-Version: 1.0 Subject: [ptxdist] [PATCH 2/2] Added cups patches. Reply-To: ptxdist@pengutronix.de List-Id: PTXdist Development Mailing List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: ptxdist-bounces@pengutronix.de Errors-To: ptxdist-bounces@pengutronix.de To: "ptxdist@pengutronix.de" --- patches/cups-1.3.9/enable-network-setup | 46 + patches/cups-1.3.9/fix_install_paths | 44 + patches/cups-1.3.9/man2html_remove | 13 + patches/cups-1.3.9/printrex_drivers | 6199 +++++++++++++++++++++++++++++++ patches/cups-1.3.9/series | 4 + 5 files changed, 6306 insertions(+) create mode 100644 patches/cups-1.3.9/enable-network-setup create mode 100644 patches/cups-1.3.9/fix_install_paths create mode 100644 patches/cups-1.3.9/man2html_remove create mode 100644 patches/cups-1.3.9/printrex_drivers create mode 100644 patches/cups-1.3.9/series diff --git a/patches/cups-1.3.9/enable-network-setup b/patches/cups-1.3.9/enable-network-setup new file mode 100644 index 0000000..55177c2 --- /dev/null +++ b/patches/cups-1.3.9/enable-network-setup @@ -0,0 +1,46 @@ +Index: cups-1.3.9/conf/cupsd.conf.in +=================================================================== +--- cups-1.3.9.orig/conf/cupsd.conf.in 2008-01-08 00:16:30.000000000 +0000 ++++ cups-1.3.9/conf/cupsd.conf.in 2014-02-25 17:29:09.088204676 +0000 +@@ -14,27 +14,30 @@ + SystemGroup @CUPS_SYSTEM_GROUPS@ + @CUPS_SYSTEM_AUTHKEY@ + +-# Only listen for connections from the local machine. +-Listen localhost:@DEFAULT_IPP_PORT@ ++# Listen for connections from any network machine. ++Port @DEFAULT_IPP_PORT@ + @CUPS_LISTEN_DOMAINSOCKET@ + + # Show shared printers on the local network. + Browsing On + BrowseOrder allow,deny + BrowseAllow all ++BrowseAddress all + + # Default authentication type, when authentication is required... + DefaultAuthType Basic ++DefaultEncryption Never + + # Restrict access to the server... + + Order allow,deny ++ Allow all + + + # Restrict access to the admin pages... + +-@ENCRYPTION_REQUIRED@ + Order allow,deny ++ Allow all + + + # Restrict access to configuration files... +@@ -42,6 +45,7 @@ + AuthType Default + Require user @SYSTEM + Order allow,deny ++ Allow all + + + # Set the default printer/job policies... diff --git a/patches/cups-1.3.9/fix_install_paths b/patches/cups-1.3.9/fix_install_paths new file mode 100644 index 0000000..9e2b5d5 --- /dev/null +++ b/patches/cups-1.3.9/fix_install_paths @@ -0,0 +1,44 @@ +Index: cups-1.3.9-source/Makedefs.in +=================================================================== +--- cups-1.3.9-source.orig/Makedefs.in 2008-01-22 22:37:21.000000000 +0000 ++++ cups-1.3.9-source/Makedefs.in 2013-11-01 10:47:15.575330087 +0000 +@@ -35,6 +35,7 @@ + SED = @SED@ + SHELL = /bin/sh + STRIP = @STRIP@ ++MKDIR_P = /bin/mkdir -p + + # + # Installation programs... +@@ -197,6 +198,7 @@ + sysconfdir = @sysconfdir@ + top_srcdir = @top_srcdir@ + ++DSTROOT = @srcdir@ + BUILDROOT = $(DSTROOT) + + AMANDIR = $(BUILDROOT)@AMANDIR@ +Index: cups-1.3.9-source/cups/Makefile +=================================================================== +--- cups-1.3.9-source.orig/cups/Makefile 2008-09-06 01:30:39.000000000 +0100 ++++ cups-1.3.9-source/cups/Makefile 2013-11-01 10:47:15.575330087 +0000 +@@ -178,6 +178,7 @@ + $(RANLIB) $(LIBDIR)/libcups.a + + installhdrs: ++ $(MKDIR_P) $(INCLUDEDIR)/cups + $(INSTALL_DIR) -m 755 $(INCLUDEDIR)/cups + for file in $(HEADERS); do \ + $(INSTALL_DATA) $$file $(INCLUDEDIR)/cups; \ +Index: cups-1.3.9-source/conf/Makefile +=================================================================== +--- cups-1.3.9-source.orig/conf/Makefile 2008-09-12 00:54:21.000000000 +0100 ++++ cups-1.3.9-source/conf/Makefile 2013-11-01 10:48:16.999327491 +0000 +@@ -49,6 +49,7 @@ + # + + install: all ++ $(MKDIR_P) $(SERVERROOT) + for file in $(KEEP); do \ + if test -r $(SERVERROOT)/$$file ; then \ + $(INSTALL_CONFIG) $$file $(SERVERROOT)/$$file.N ; \ diff --git a/patches/cups-1.3.9/man2html_remove b/patches/cups-1.3.9/man2html_remove new file mode 100644 index 0000000..9200b7c --- /dev/null +++ b/patches/cups-1.3.9/man2html_remove @@ -0,0 +1,13 @@ +Index: cups-1.3.9-source/man/Makefile +=================================================================== +--- cups-1.3.9-source.orig/man/Makefile 2013-10-30 15:29:11.092446619 +0000 ++++ cups-1.3.9-source/man/Makefile 2013-10-30 16:08:18.984467322 +0000 +@@ -62,7 +62,7 @@ + # Make everything... + # + +-all: $(MAN1) $(MAN5) $(MAN7) $(MAN8) html ++all: $(MAN1) $(MAN5) $(MAN7) $(MAN8) + + + # diff --git a/patches/cups-1.3.9/printrex_drivers b/patches/cups-1.3.9/printrex_drivers new file mode 100644 index 0000000..c1e4bbf --- /dev/null +++ b/patches/cups-1.3.9/printrex_drivers @@ -0,0 +1,6199 @@ +Index: cups-1.3.9/filter/Makefile +=================================================================== +--- cups-1.3.9.orig/filter/Makefile 2008-09-06 01:30:39.000000000 +0100 ++++ cups-1.3.9/filter/Makefile 2014-02-25 16:42:17.830598192 +0000 +@@ -19,7 +19,16 @@ + + + FILTERS = gziptoany hpgltops texttops pstops $(IMGFILTERS) \ +- rastertolabel rastertoepson rastertohp ++ rastertolabel rastertoepson rastertohp \ ++ rastertoprx20 \ ++ rastertoprx22 \ ++ rastertoprx23 \ ++ rastertoprx40 \ ++ rastertoprx42 \ ++ rastertoprx43 \ ++ rastertoprx920 \ ++ rastertoprx1242 ++ + TARGETS = $(FILTERS) \ + $(LIBCUPSIMAGE) \ + libcupsimage.a \ +@@ -41,7 +50,15 @@ + OBJS = $(HPGLOBJS) $(IMAGEOBJS) $(FORMOBJS) \ + gziptoany.o imagetops.o imagetoraster.o common.o pstops.o \ + rasterbench.o rastertoepson.o rastertohp.o rastertolabel.o \ +- testimage.o testraster.o textcommon.o texttops.o ++ testimage.o testraster.o textcommon.o texttops.o \ ++ rastertoprx20.o \ ++ rastertoprx22.o \ ++ rastertoprx23.o \ ++ rastertoprx40.o \ ++ rastertoprx42.o \ ++ rastertoprx43.o \ ++ rastertoprx920.o \ ++ rastertoprx1242.o + + + # +@@ -380,6 +397,43 @@ + + + # ++# rastertoprx* ++# ++ ++rastertoprx20: rastertoprx20.o ../cups/$(LIBCUPS) $(LIBCUPSIMAGE) ++ echo Linking $@... ++ $(CC) $(LDFLAGS) -o $@ rastertoprx20.o $(LINKCUPSIMAGE) $(IMGLIBS) $(LIBS) ++ ++rastertoprx22: rastertoprx22.o ../cups/$(LIBCUPS) $(LIBCUPSIMAGE) ++ echo Linking $@... ++ $(CC) $(LDFLAGS) -o $@ rastertoprx22.o $(LINKCUPSIMAGE) $(IMGLIBS) $(LIBS) ++ ++rastertoprx23: rastertoprx23.o ../cups/$(LIBCUPS) $(LIBCUPSIMAGE) ++ echo Linking $@... ++ $(CC) $(LDFLAGS) -o $@ rastertoprx23.o $(LINKCUPSIMAGE) $(IMGLIBS) $(LIBS) ++ ++rastertoprx40: rastertoprx40.o ../cups/$(LIBCUPS) $(LIBCUPSIMAGE) ++ echo Linking $@... ++ $(CC) $(LDFLAGS) -o $@ rastertoprx40.o $(LINKCUPSIMAGE) $(IMGLIBS) $(LIBS) ++ ++rastertoprx42: rastertoprx42.o ../cups/$(LIBCUPS) $(LIBCUPSIMAGE) ++ echo Linking $@... ++ $(CC) $(LDFLAGS) -o $@ rastertoprx42.o $(LINKCUPSIMAGE) $(IMGLIBS) $(LIBS) ++ ++rastertoprx43: rastertoprx43.o ../cups/$(LIBCUPS) $(LIBCUPSIMAGE) ++ echo Linking $@... ++ $(CC) $(LDFLAGS) -o $@ rastertoprx43.o $(LINKCUPSIMAGE) $(IMGLIBS) $(LIBS) ++ ++rastertoprx920: rastertoprx920.o ../cups/$(LIBCUPS) $(LIBCUPSIMAGE) ++ echo Linking $@... ++ $(CC) $(LDFLAGS) -o $@ rastertoprx920.o $(LINKCUPSIMAGE) $(IMGLIBS) $(LIBS) ++ ++rastertoprx1242: rastertoprx1242.o ../cups/$(LIBCUPS) $(LIBCUPSIMAGE) ++ echo Linking $@... ++ $(CC) $(LDFLAGS) -o $@ rastertoprx1242.o $(LINKCUPSIMAGE) $(IMGLIBS) $(LIBS) ++ ++ ++# + # Dependencies... + # + +Index: cups-1.3.9/filter/rastertoprx1242.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ cups-1.3.9/filter/rastertoprx1242.c 2014-02-25 16:36:17.093182452 +0000 +@@ -0,0 +1,530 @@ ++/* ++ * Printrex 1242 raster driver for CUPS. ++ * Revision ++ * 1 Initial release ++ * ++ * Copyright 2007 by Apple Inc. ++ * Copyright 1993-2005 by Easy Software Products. ++ * Copyright 2009 by Printrex, Inc. ++ * ++ * These coded instructions, statements, and computer programs are the ++ * property of Apple Inc. and are protected by Federal copyright ++ * law. Distribution and use rights are outlined in the file "LICENSE.txt" ++ * which should have been included with this file. If this file is ++ * file is missing or damaged, see the license at "http://www.cups.org/". ++ * ++ * Contents: ++ * ++ * Setup() - Prepare the printer for graphics output. ++ * StartPage() - Start a page of graphics. ++ * EndPage() - Finish a page of graphics. ++ * Shutdown() - Shutdown a printer. ++ * CompressData() - Compress a line of graphics. ++ * ProcessLine() - Read graphics from the page stream and output ++ * as needed. ++ * main() - Main entry and processing of driver. ++ */ ++ ++/* ++ This code uses PPD parameters in the following way: ++ cupsCompression - 1 is grayscale. 0 is Bimodal. Speed set to 19mm/s in grayscale ++ cupsBytesPerLine - Used to allocate the PixelBuffer memory, and avoid buffer ++ overrun. ++*/ ++/* ++ * Include necessary headers... ++ */ ++ ++#include "string.h" ++#include ++#include ++#include "raster.h" ++#include ++#include ++#include ++ ++#define cupsWritePrintData(s,n) (fwrite((s),1,(n),stdout)) ++ ++/* ++ * Globals... ++ */ ++ ++unsigned char *PixelBuffer, /* Pixel buffer */ ++ *CompBuffer; /* Compression buffer */ ++int OutputFeed; /* Number of lines to skip */ ++int SpeedSet; /* Flag to indicate the speed has been set */ ++ ++/* ++ * Prototypes... ++ */ ++ ++void Setup(ppd_file_t *in); ++void StartPage(ppd_file_t *in, cups_page_header_t *); ++void EndPage(ppd_file_t *, cups_page_header_t *); ++void Shutdown(ppd_file_t *); ++ ++void CompressData(ppd_file_t *, const unsigned char *, const int, ++ int, int); ++void ProcessLine(ppd_file_t *, cups_raster_t *, ++ cups_page_header_t *); ++ ++/* ++ * 'Setup()' - Set the printer up for printing this job. ++ */ ++ ++void ++Setup(ppd_file_t *ppd) /* I - PPD file */ ++{ ++ SpeedSet = 0; ++} ++ ++ ++/* ++ * 'StartPage()' - Start a page of graphics. ++ */ ++ ++const unsigned char modulation[2][12] = ++{ ++ {25, 0, 70, 2, 38, 40, 0, 56, 1, 184, 148, 224}, ++ {25, 0, 100, 2, 138, 40, 0, 95, 2, 38, 110, 224} ++}; ++ ++void StartPage(ppd_file_t *ppd, /* I - PPD file */ ++ cups_page_header_t *header) /* I - Page header */ ++{ ++ signed char resolution[PPD_MAX_NAME]; /* Resolution string */ ++ signed char intensitystr[10]; /* Used for calculating intensity */ ++ int intensity; ++ ++ fprintf(stderr, "DEBUG: StartPage...\n"); ++ fprintf(stderr, "DEBUG: MediaClass = \"%s\"\n", header->MediaClass); ++ fprintf(stderr, "DEBUG: MediaColor = \"%s\"\n", header->MediaColor); ++ fprintf(stderr, "DEBUG: MediaType = \"%s\"\n", header->MediaType); ++ fprintf(stderr, "DEBUG: OutputType = \"%s\"\n", header->OutputType); ++ ++ fprintf(stderr, "DEBUG: AdvanceDistance = %d\n", header->AdvanceDistance); ++ fprintf(stderr, "DEBUG: AdvanceMedia = %d\n", header->AdvanceMedia); ++ fprintf(stderr, "DEBUG: Collate = %d\n", header->Collate); ++ fprintf(stderr, "DEBUG: CutMedia = %d\n", header->CutMedia); ++ fprintf(stderr, "DEBUG: Duplex = %d\n", header->Duplex); ++ fprintf(stderr, "DEBUG: HWResolution = [ %d %d ]\n", header->HWResolution[0], ++ header->HWResolution[1]); ++ fprintf(stderr, "DEBUG: ImagingBoundingBox = [ %d %d %d %d ]\n", ++ header->ImagingBoundingBox[0], header->ImagingBoundingBox[1], ++ header->ImagingBoundingBox[2], header->ImagingBoundingBox[3]); ++ fprintf(stderr, "DEBUG: InsertSheet = %d\n", header->InsertSheet); ++ fprintf(stderr, "DEBUG: Jog = %d\n", header->Jog); ++ fprintf(stderr, "DEBUG: LeadingEdge = %d\n", header->LeadingEdge); ++ fprintf(stderr, "DEBUG: Margins = [ %d %d ]\n", header->Margins[0], ++ header->Margins[1]); ++ fprintf(stderr, "DEBUG: ManualFeed = %d\n", header->ManualFeed); ++ fprintf(stderr, "DEBUG: MediaPosition = %d\n", header->MediaPosition); ++ fprintf(stderr, "DEBUG: MediaWeight = %d\n", header->MediaWeight); ++ fprintf(stderr, "DEBUG: MirrorPrint = %d\n", header->MirrorPrint); ++ fprintf(stderr, "DEBUG: NegativePrint = %d\n", header->NegativePrint); ++ fprintf(stderr, "DEBUG: NumCopies = %d\n", header->NumCopies); ++ fprintf(stderr, "DEBUG: Orientation = %d\n", header->Orientation); ++ fprintf(stderr, "DEBUG: OutputFaceUp = %d\n", header->OutputFaceUp); ++ fprintf(stderr, "DEBUG: PageSize = [ %d %d ]\n", header->PageSize[0], ++ header->PageSize[1]); ++ fprintf(stderr, "DEBUG: Separations = %d\n", header->Separations); ++ fprintf(stderr, "DEBUG: TraySwitch = %d\n", header->TraySwitch); ++ fprintf(stderr, "DEBUG: Tumble = %d\n", header->Tumble); ++ fprintf(stderr, "DEBUG: cupsWidth = %d\n", header->cupsWidth); ++ fprintf(stderr, "DEBUG: cupsHeight = %d\n", header->cupsHeight); ++ fprintf(stderr, "DEBUG: cupsMediaType = %d\n", header->cupsMediaType); ++ fprintf(stderr, "DEBUG: cupsBitsPerColor = %d\n", header->cupsBitsPerColor); ++ fprintf(stderr, "DEBUG: cupsBitsPerPixel = %d\n", header->cupsBitsPerPixel); ++ fprintf(stderr, "DEBUG: cupsBytesPerLine = %d\n", header->cupsBytesPerLine); ++ fprintf(stderr, "DEBUG: cupsColorOrder = %d\n", header->cupsColorOrder); ++ fprintf(stderr, "DEBUG: cupsColorSpace = %d\n", header->cupsColorSpace); ++ fprintf(stderr, "DEBUG: cupsCompression = %d\n", header->cupsCompression); ++ fprintf(stderr, "DEBUG: cupsRowCount = %d\n", header->cupsRowCount); ++ fprintf(stderr, "DEBUG: cupsRowFeed = %d\n", header->cupsRowFeed); ++ fprintf(stderr, "DEBUG: cupsRowStep = %d\n", header->cupsRowStep); ++ ++ /* ++ * Set the resolution and Media Type ++ */ ++ ++ if (header->HWResolution[0] != header->HWResolution[1]) ++ snprintf(resolution, sizeof(resolution), "%dx%ddpi", ++ header->HWResolution[0], header->HWResolution[1]); ++ else ++ snprintf(resolution, sizeof(resolution), "%ddpi", ++ header->HWResolution[0]); ++ ++ if (!header->MediaType[0]) ++ strcpy(header->MediaType, "Plain"); ++ ++ fprintf(stderr, "DEBUG: MediaType = %s\n", header->MediaType); ++ fprintf(stderr, "DEBUG: Resolution = %s\n", resolution); ++ ++ if (!SpeedSet) ++ { ++ cupsWritePrintData("\033_X\015M",5); ++ if (strcmp(header->MediaType, "PrintrexRoll") == 0) ++ { ++ cupsWritePrintData(modulation[0],12); ++ fprintf(stderr, "DEBUG: Setting Roll\n"); ++ } ++ else if (strcmp(header->MediaType, "ClearFilm") == 0) ++ { ++ cupsWritePrintData(modulation[1],12); ++ fprintf(stderr, "DEBUG: Setting ClearFilm\n"); ++ } ++ ++ // If not 1, it's gray scale. Set the speed, Sat, and White level ++ // according to the media selected. ++ if (header->cupsBitsPerPixel != 1) ++ { ++ cupsWritePrintData("\033_X\005Q",5); ++ putchar(17); ++ cupsWritePrintData("\377\200\377",3); ++ if (strcmp(header->MediaType, "PrintrexRoll") == 0) ++ cupsWritePrintData("\033_P\340\000\000",6); ++ else if (strcmp(header->MediaType, "ClearFilm") == 0) ++ cupsWritePrintData("\033_P\300\020\000",6); ++ } ++ else ++ { ++ if (strcmp(header->OutputType, "1ips") == 0) ++ { ++ fprintf(stderr,"DEBUG: Going 1ips\n"); ++ cupsWritePrintData("\033_X\005Q",5); ++ putchar(25); ++ cupsWritePrintData("\377\200\377",3); ++ } ++ else if (strcmp(header->OutputType, "2ips") == 0) ++ { ++ cupsWritePrintData("\033_X\005Q",5); ++ putchar(50); ++ cupsWritePrintData("\377\200\377",3); ++ fprintf(stderr, "DEBUG: Going 2ips\n"); ++ } ++ else if (strcmp(header->OutputType, "3ips") == 0) ++ { ++ cupsWritePrintData("\033_X\005Q",5); ++ putchar(75); ++ cupsWritePrintData("\377\200\377",3); ++ fprintf(stderr, "DEBUG: Going 3ips\n"); ++ } ++ else if (strcmp(header->OutputType, "4ips") == 0) ++ { ++ cupsWritePrintData("\033_X\005Q",5); ++ putchar(100); ++ cupsWritePrintData("\377\200\377",3); ++ fprintf(stderr, "DEBUG: Going 4ips\n"); ++ } ++ strcpy(intensitystr, header->MediaClass); ++ sscanf(intensitystr,"%d",&intensity); ++ fprintf(stderr,"DEBUG: Intensity is %d\n", intensity); ++ ++ cupsWritePrintData("\033_P",3); ++ putchar(intensity & 0xFF); ++ putchar(0); ++ putchar(0); ++ } ++ SpeedSet = 1; ++ } ++ ++ PixelBuffer = malloc(header->cupsBytesPerLine + 20); ++ CompBuffer = malloc(header->cupsBytesPerLine + 20); ++} ++ ++ ++/* ++ * 'EndPage()' - Finish a page of graphics. ++ */ ++ ++void EndPage(ppd_file_t *ppd, /* I - PPD file */ ++ cups_page_header_t *header) /* I - Page header */ ++{ ++ free(PixelBuffer); ++ free(CompBuffer); ++} ++ ++ ++/* ++ * 'Shutdown()' - Shutdown a printer. ++ */ ++ ++void Shutdown(ppd_file_t *ppd) /* I - PPD file */ ++{ ++ /* ++ * Reset the printer... ++ */ ++ ++ printf("\032"); ++} ++ ++/* ++ * 'CompressData()' - Compress a line of graphics. ++ */ ++ ++void CompressData(ppd_file_t *ppd, /* I - PPD file information */ ++ const unsigned char *line, /* I - Data to compress */ ++ const int length,/* I - Number of bytes */ ++ int type, /* I - Type of compression */ ++ int bits) /* I - Bits Per Pixel */ ++{ ++ register const unsigned char *line_ptr, ++ /* Current byte pointer */ ++ *line_end, /* End-of-line byte pointer */ ++ *start; /* Start of compression sequence */ ++ register unsigned char *comp_ptr; /* Pointer into compression buffer */ ++ register int count; /* Count of bytes for output */ ++ register int bytes; /* Number of bytes per row */ ++ ++ ++ switch (type) ++ { ++ case 0 : ++ /* ++ * Do no compression... ++ */ ++ ++ line_ptr = (const unsigned char *)line; ++ line_end = (const unsigned char *)line + length; ++ bytes = 296; ++ memcpy(CompBuffer, PixelBuffer, bytes); ++ break; ++ ++ default : ++ /* ++ * Do TIFF pack-bits encoding... ++ */ ++ ++ line_ptr = (const unsigned char *)line; ++ line_end = (const unsigned char *)line + length; ++ comp_ptr = (unsigned char*)CompBuffer; ++ ++ while (line_ptr < line_end && (comp_ptr - CompBuffer) < length) ++ { ++ if ((line_ptr + 1) >= line_end) ++ { ++ /* ++ * Single byte on the end... ++ */ ++ ++ *comp_ptr++ = 0x00; ++ *comp_ptr++ = *line_ptr++; ++ } ++ else if (line_ptr[0] == line_ptr[1]) ++ { ++ /* ++ * Repeated sequence... ++ */ ++ ++ line_ptr ++; ++ count = 2; ++ ++ while (line_ptr < (line_end - 1) && ++ line_ptr[0] == line_ptr[1] && ++ count < 127) ++ { ++ line_ptr ++; ++ count ++; ++ } ++ ++ *comp_ptr++ = 257 - count; ++ *comp_ptr++ = *line_ptr++; ++ } ++ else ++ { ++ /* ++ * Non-repeated sequence... ++ */ ++ ++ start = line_ptr; ++ line_ptr ++; ++ count = 1; ++ ++ while (line_ptr < (line_end - 1) && ++ line_ptr[0] != line_ptr[1] && ++ count < 127) ++ { ++ line_ptr ++; ++ count ++; ++ } ++ ++ *comp_ptr++ = count - 1; ++ ++ memcpy(comp_ptr, start, count); ++ comp_ptr += count; ++ } ++ } ++ line_end = comp_ptr; ++ bytes = comp_ptr - CompBuffer; ++ } ++ ++ /* ++ * Send the graphics... ++ */ ++ ++ if (type == 0) ++ cupsWritePrintData("\033Z\001\000",4); ++ else ++ { ++ cupsWritePrintData("\033_R\001",4); ++ putchar(bits); ++ putchar(bytes >> 8); ++ putchar(bytes & 0xFF); ++ } ++ ++ cupsWritePrintData(CompBuffer, bytes); ++} ++ ++/* ++ * 'ProcessLine()' - Read graphics from the page stream and output as needed. ++ */ ++ ++void ProcessLine(ppd_file_t *ppd, /* I - PPD file */ ++ cups_raster_t *ras, /* I - Raster stream */ ++ cups_page_header_t *header) /* I - Page header */ ++{ ++ ++ /* ++ * Read a row of graphics... ++ */ ++ ++ if (!cupsRasterReadPixels(ras, PixelBuffer, header->cupsBytesPerLine)) ++ return; ++ ++ CompressData(ppd, PixelBuffer, header->cupsBytesPerLine, header->cupsCompression, ++ header->cupsBitsPerPixel); ++ fflush(stdout); ++ ++ OutputFeed ++; ++} ++ ++ ++/* ++ * 'main()' - Main entry and processing of driver. ++ */ ++ ++ /* O - Exit status */ ++int main(int argc, /* I - Number of command-line arguments */ ++ char *argv[]) /* I - Command-line arguments */ ++{ ++ int fd; /* File descriptor */ ++ cups_raster_t *ras; /* Raster stream for printing */ ++ cups_page_header_t header; /* Page header from file */ ++ int page; /* Current page */ ++ int y; /* Current line */ ++ ppd_file_t *ppd; /* PPD file */ ++ int num_options; /* Number of options */ ++ cups_option_t *options; /* Options */ ++ ++ ++ /* ++ * Make sure status messages are not buffered... ++ */ ++ ++ fputs("DEBUG: Got here\n", stderr); ++ setbuf(stderr, NULL); ++ ++ /* ++ * Check command-line... ++ */ ++ ++ if (argc < 6 || argc > 7) ++ { ++ fputs("ERROR: rastertoprx22 job-id user title copies options [file]\n", stderr); ++ return (1); ++ } ++ ++ num_options = cupsParseOptions(argv[5], 0, &options); ++ ++ /* ++ * Open the PPD file... ++ */ ++ ++ ppd = ppdOpenFile(getenv("PPD")); ++ ++ if (!ppd) ++ { ++ fputs("ERROR: Unable to open PPD file!\n", stderr); ++ return (1); ++ } ++ ++ ppdMarkDefaults(ppd); ++ cupsMarkOptions(ppd, num_options, options); ++ ++ /* ++ * Open the page stream... ++ */ ++ ++ if (argc == 7) ++ { ++ if ((fd = open(argv[6], O_RDONLY)) == -1) ++ { ++ perror("ERROR: Unable to open raster file - "); ++ return (1); ++ } ++ } ++ else ++ fd = 0; ++ ++ ras = cupsRasterOpen(fd, CUPS_RASTER_READ); ++ ++ /* ++ * Initialize the print device... ++ */ ++ ++ Setup(ppd); ++ ++ /* ++ * Process pages as needed... ++ */ ++ ++ page = 0; ++ ++ while (cupsRasterReadHeader(ras, &header)) ++ { ++ page ++; ++ ++ fprintf(stderr, "PAGE: %d 1\n", page); ++ fprintf(stderr, "INFO: Starting page %d...\n", page); ++ ++ StartPage(ppd, &header); ++ ++ fprintf(stderr,"DEBUG: Now printing %d rasters\n\r",header.cupsHeight); ++ for (y = 0; y < header.cupsHeight; y ++) ++ { ++ if ((y & 127) == 0) ++ fprintf(stderr, "INFO: Printing page %d, %d%% complete...\n", page, ++ 100 * y / header.cupsHeight); ++ ++ ProcessLine(ppd, ras, &header); ++ } ++ ++ fprintf(stderr, "INFO: Finished page %d...\n", page); ++ ++ EndPage(ppd, &header); ++ if (header.AdvanceDistance == 2) ++ printf("%c",11); ++ else if (header.AdvanceDistance == 3) ++ printf("%c",12); ++ } ++ ++ Shutdown(ppd); ++ ++ cupsRasterClose(ras); ++ ++ if (fd != 0) ++ close(fd); ++ ++ if (page == 0) ++ { ++ fputs("ERROR: No pages found!\n", stderr); ++ return (1); ++ } ++ else ++ { ++ fputs("INFO: Ready to print.\n", stderr); ++ return (0); ++ } ++} ++ ++ +Index: cups-1.3.9/filter/rastertoprx20.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ cups-1.3.9/filter/rastertoprx20.c 2014-02-25 16:36:17.093182452 +0000 +@@ -0,0 +1,510 @@ ++/* ++ * Printrex 820 raster driver for CUPS. ++ * Revision ++ * 1 Initial release ++ * ++ * Copyright 2007 by Apple Inc. ++ * Copyright 1993-2005 by Easy Software Products. ++ * Copyright 2009 by Printrex, Inc. ++ * ++ * These coded instructions, statements, and computer programs are the ++ * property of Apple Inc. and are protected by Federal copyright ++ * law. Distribution and use rights are outlined in the file "LICENSE.txt" ++ * which should have been included with this file. If this file is ++ * file is missing or damaged, see the license at "http://www.cups.org/". ++ * ++ * Contents: ++ * ++ * Setup() - Prepare the printer for graphics output. ++ * StartPage() - Start a page of graphics. ++ * EndPage() - Finish a page of graphics. ++ * Shutdown() - Shutdown a printer. ++ * CompressData() - Compress a line of graphics. ++ * ProcessLine() - Read graphics from the page stream and output ++ * as needed. ++ * main() - Main entry and processing of driver. ++ */ ++ ++/* ++ This code uses PPD parameters in the following way: ++ cupsCompression - 0 is Bimodal. ++ cupsBytesPerLine - Used to allocate the PixelBuffer memory, and avoid buffer ++ overrun. ++*/ ++/* ++ * Include necessary headers... ++ */ ++ ++#include "string.h" ++#include ++#include ++#include "raster.h" ++#include ++#include ++#include ++ ++#define cupsWritePrintData(s,n) (fwrite((s),1,(n),stdout)) ++ ++/* ++ * Globals... ++ */ ++ ++unsigned char *PixelBuffer, /* Pixel buffer */ ++ *CompBuffer; /* Compression buffer */ ++int OutputFeed; /* Number of lines to skip */ ++int SpeedSet; /* Flag to indicate the speed has been set */ ++ ++/* ++ * Prototypes... ++ */ ++ ++void Setup(ppd_file_t *in); ++void StartPage(ppd_file_t *in, cups_page_header_t *); ++void EndPage(ppd_file_t *, cups_page_header_t *); ++void Shutdown(ppd_file_t *); ++ ++void CompressData(ppd_file_t *, const unsigned char *, const int, ++ int, int); ++void ProcessLine(ppd_file_t *, cups_raster_t *, ++ cups_page_header_t *); ++ ++/* ++ * 'Setup()' - Set the printer up for printing this job. ++ */ ++ ++void ++Setup(ppd_file_t *ppd) /* I - PPD file */ ++{ ++ SpeedSet = 0; ++} ++ ++ ++/* ++ * 'StartPage()' - Start a page of graphics. ++ */ ++/* ++ 0 = paper ++ 1 = film ++*/ ++const unsigned char mediaSetting[2][3] = ++{ ++ {27,'T', 0}, ++ {27,'T', 1} ++}; ++ ++void StartPage(ppd_file_t *ppd, /* I - PPD file */ ++ cups_page_header_t *header) /* I - Page header */ ++{ ++ signed char resolution[PPD_MAX_NAME]; /* Resolution string */ ++ signed char intensitystr[10]; /* Used for calculating intensity */ ++ int intensity; ++ ++ fprintf(stderr, "DEBUG: StartPage...\n"); ++ fprintf(stderr, "DEBUG: MediaClass = \"%s\"\n", header->MediaClass); ++ fprintf(stderr, "DEBUG: MediaColor = \"%s\"\n", header->MediaColor); ++ fprintf(stderr, "DEBUG: MediaType = \"%s\"\n", header->MediaType); ++ fprintf(stderr, "DEBUG: OutputType = \"%s\"\n", header->OutputType); ++ ++ fprintf(stderr, "DEBUG: AdvanceDistance = %d\n", header->AdvanceDistance); ++ fprintf(stderr, "DEBUG: AdvanceMedia = %d\n", header->AdvanceMedia); ++ fprintf(stderr, "DEBUG: Collate = %d\n", header->Collate); ++ fprintf(stderr, "DEBUG: CutMedia = %d\n", header->CutMedia); ++ fprintf(stderr, "DEBUG: Duplex = %d\n", header->Duplex); ++ fprintf(stderr, "DEBUG: HWResolution = [ %d %d ]\n", header->HWResolution[0], ++ header->HWResolution[1]); ++ fprintf(stderr, "DEBUG: ImagingBoundingBox = [ %d %d %d %d ]\n", ++ header->ImagingBoundingBox[0], header->ImagingBoundingBox[1], ++ header->ImagingBoundingBox[2], header->ImagingBoundingBox[3]); ++ fprintf(stderr, "DEBUG: InsertSheet = %d\n", header->InsertSheet); ++ fprintf(stderr, "DEBUG: Jog = %d\n", header->Jog); ++ fprintf(stderr, "DEBUG: LeadingEdge = %d\n", header->LeadingEdge); ++ fprintf(stderr, "DEBUG: Margins = [ %d %d ]\n", header->Margins[0], ++ header->Margins[1]); ++ fprintf(stderr, "DEBUG: ManualFeed = %d\n", header->ManualFeed); ++ fprintf(stderr, "DEBUG: MediaPosition = %d\n", header->MediaPosition); ++ fprintf(stderr, "DEBUG: MediaWeight = %d\n", header->MediaWeight); ++ fprintf(stderr, "DEBUG: MirrorPrint = %d\n", header->MirrorPrint); ++ fprintf(stderr, "DEBUG: NegativePrint = %d\n", header->NegativePrint); ++ fprintf(stderr, "DEBUG: NumCopies = %d\n", header->NumCopies); ++ fprintf(stderr, "DEBUG: Orientation = %d\n", header->Orientation); ++ fprintf(stderr, "DEBUG: OutputFaceUp = %d\n", header->OutputFaceUp); ++ fprintf(stderr, "DEBUG: PageSize = [ %d %d ]\n", header->PageSize[0], ++ header->PageSize[1]); ++ fprintf(stderr, "DEBUG: Separations = %d\n", header->Separations); ++ fprintf(stderr, "DEBUG: TraySwitch = %d\n", header->TraySwitch); ++ fprintf(stderr, "DEBUG: Tumble = %d\n", header->Tumble); ++ fprintf(stderr, "DEBUG: cupsWidth = %d\n", header->cupsWidth); ++ fprintf(stderr, "DEBUG: cupsHeight = %d\n", header->cupsHeight); ++ fprintf(stderr, "DEBUG: cupsMediaType = %d\n", header->cupsMediaType); ++ fprintf(stderr, "DEBUG: cupsBitsPerColor = %d\n", header->cupsBitsPerColor); ++ fprintf(stderr, "DEBUG: cupsBitsPerPixel = %d\n", header->cupsBitsPerPixel); ++ fprintf(stderr, "DEBUG: cupsBytesPerLine = %d\n", header->cupsBytesPerLine); ++ fprintf(stderr, "DEBUG: cupsColorOrder = %d\n", header->cupsColorOrder); ++ fprintf(stderr, "DEBUG: cupsColorSpace = %d\n", header->cupsColorSpace); ++ fprintf(stderr, "DEBUG: cupsCompression = %d\n", header->cupsCompression); ++ fprintf(stderr, "DEBUG: cupsRowCount = %d\n", header->cupsRowCount); ++ fprintf(stderr, "DEBUG: cupsRowFeed = %d\n", header->cupsRowFeed); ++ fprintf(stderr, "DEBUG: cupsRowStep = %d\n", header->cupsRowStep); ++ ++ /* ++ * Set the resolution and Media Type ++ */ ++ ++ if (header->HWResolution[0] != header->HWResolution[1]) ++ snprintf(resolution, sizeof(resolution), "%dx%ddpi", ++ header->HWResolution[0], header->HWResolution[1]); ++ else ++ snprintf(resolution, sizeof(resolution), "%ddpi", ++ header->HWResolution[0]); ++ ++ if (!header->MediaType[0]) ++ strcpy(header->MediaType, "Plain"); ++ ++ fprintf(stderr, "DEBUG: MediaType = %s\n", header->MediaType); ++ fprintf(stderr, "DEBUG: Resolution = %s\n", resolution); ++ ++ if (!SpeedSet) ++ { ++ cupsWritePrintData("\033_X\015M",5); ++ if (strcmp(header->MediaType, "Paper") == 0) ++ { ++ cupsWritePrintData(mediaSetting[0],3); ++ fprintf(stderr, "DEBUG: Setting Paper\n"); ++ } ++ else if (strcmp(header->MediaType, "Film") == 0) ++ { ++ cupsWritePrintData(mediaSetting[1],3); ++ fprintf(stderr, "DEBUG: Setting film\n"); ++ } ++ ++ // If not 1, it's gray scale. Set the speed, Sat, and White level ++ // according to the media selected. ++ if (strcmp(header->OutputType, "Quart") == 0) ++ { ++ fprintf(stderr,"DEBUG: Going Quater Speed\n"); ++ cupsWritePrintData("\033<",2); ++ } ++ else if (strcmp(header->OutputType, "Half") == 0) ++ { ++ cupsWritePrintData("\033*",2); ++ fprintf(stderr, "DEBUG: Going Half Speed\n"); ++ } ++ else if (strcmp(header->OutputType, "Threq") == 0) ++ { ++ cupsWritePrintData("\033>",2); ++ fprintf(stderr, "DEBUG: Going Three Quaters Speed\n"); ++ } ++ else if (strcmp(header->OutputType, "Full") == 0) ++ { ++ cupsWritePrintData("\033+",2); ++ fprintf(stderr, "DEBUG: Going Full Speed\n"); ++ } ++ strcpy(intensitystr, header->MediaClass); ++ sscanf(intensitystr,"%d",&intensity); ++ fprintf(stderr,"DEBUG: Intensity is %d\n", intensity); ++ ++ cupsWritePrintData("\033S",2); ++ putchar(intensity & 0xFF); ++ SpeedSet = 1; ++ } ++ ++ PixelBuffer = malloc(header->cupsBytesPerLine + 20); ++ CompBuffer = malloc(header->cupsBytesPerLine + 20); ++} ++ ++ ++/* ++ * 'EndPage()' - Finish a page of graphics. ++ */ ++ ++void EndPage(ppd_file_t *ppd, /* I - PPD file */ ++ cups_page_header_t *header) /* I - Page header */ ++{ ++ free(PixelBuffer); ++ free(CompBuffer); ++} ++ ++ ++/* ++ * 'Shutdown()' - Shutdown a printer. ++ */ ++ ++void Shutdown(ppd_file_t *ppd) /* I - PPD file */ ++{ ++ /* ++ * Reset the printer... ++ */ ++ ++ printf("\032"); ++} ++ ++/* ++ * 'CompressData()' - Compress a line of graphics. ++ */ ++ ++void CompressData(ppd_file_t *ppd, /* I - PPD file information */ ++ const unsigned char *line, /* I - Data to compress */ ++ const int length,/* I - Number of bytes */ ++ int type, /* I - Type of compression */ ++ int bits) /* I - Bits Per Pixel */ ++{ ++ register const unsigned char *line_ptr, ++ /* Current byte pointer */ ++ *line_end, /* End-of-line byte pointer */ ++ *start; /* Start of compression sequence */ ++ register unsigned char *comp_ptr; /* Pointer into compression buffer */ ++ register int count; /* Count of bytes for output */ ++ register int bytes; /* Number of bytes per row */ ++ ++ ++ switch (type) ++ { ++ case 0 : ++ /* ++ * Do no compression... ++ */ ++ ++ line_ptr = (const unsigned char *)line; ++ line_end = (const unsigned char *)line + length; ++ bytes = 216; ++ memcpy(CompBuffer, PixelBuffer, bytes); ++ break; ++ ++ default : ++ /* ++ * Do TIFF pack-bits encoding... ++ */ ++ ++ line_ptr = (const unsigned char *)line; ++ line_end = (const unsigned char *)line + length; ++ comp_ptr = (unsigned char*)CompBuffer; ++ ++ while (line_ptr < line_end && (comp_ptr - CompBuffer) < length) ++ { ++ if ((line_ptr + 1) >= line_end) ++ { ++ /* ++ * Single byte on the end... ++ */ ++ ++ *comp_ptr++ = 0x00; ++ *comp_ptr++ = *line_ptr++; ++ } ++ else if (line_ptr[0] == line_ptr[1]) ++ { ++ /* ++ * Repeated sequence... ++ */ ++ ++ line_ptr ++; ++ count = 2; ++ ++ while (line_ptr < (line_end - 1) && ++ line_ptr[0] == line_ptr[1] && ++ count < 127) ++ { ++ line_ptr ++; ++ count ++; ++ } ++ ++ *comp_ptr++ = 257 - count; ++ *comp_ptr++ = *line_ptr++; ++ } ++ else ++ { ++ /* ++ * Non-repeated sequence... ++ */ ++ ++ start = line_ptr; ++ line_ptr ++; ++ count = 1; ++ ++ while (line_ptr < (line_end - 1) && ++ line_ptr[0] != line_ptr[1] && ++ count < 127) ++ { ++ line_ptr ++; ++ count ++; ++ } ++ ++ *comp_ptr++ = count - 1; ++ ++ memcpy(comp_ptr, start, count); ++ comp_ptr += count; ++ } ++ } ++ line_end = comp_ptr; ++ bytes = comp_ptr - CompBuffer; ++ } ++ ++ /* ++ * Send the graphics... ++ */ ++ ++ if (type == 0) ++ cupsWritePrintData("\033Z\001\000",4); ++ else ++ { ++ cupsWritePrintData("\033_R\001",4); ++ putchar(bits); ++ putchar(bytes >> 8); ++ putchar(bytes & 0xFF); ++ } ++ ++ cupsWritePrintData(CompBuffer, bytes); ++} ++ ++/* ++ * 'ProcessLine()' - Read graphics from the page stream and output as needed. ++ */ ++ ++void ProcessLine(ppd_file_t *ppd, /* I - PPD file */ ++ cups_raster_t *ras, /* I - Raster stream */ ++ cups_page_header_t *header) /* I - Page header */ ++{ ++ ++ /* ++ * Read a row of graphics... ++ */ ++ ++ if (!cupsRasterReadPixels(ras, PixelBuffer, header->cupsBytesPerLine)) ++ return; ++ ++ CompressData(ppd, PixelBuffer, header->cupsBytesPerLine, header->cupsCompression, ++ header->cupsBitsPerPixel); ++ fflush(stdout); ++ ++ OutputFeed ++; ++} ++ ++ ++/* ++ * 'main()' - Main entry and processing of driver. ++ */ ++ ++ /* O - Exit status */ ++int main(int argc, /* I - Number of command-line arguments */ ++ char *argv[]) /* I - Command-line arguments */ ++{ ++ int fd; /* File descriptor */ ++ cups_raster_t *ras; /* Raster stream for printing */ ++ cups_page_header_t header; /* Page header from file */ ++ int page; /* Current page */ ++ int y; /* Current line */ ++ ppd_file_t *ppd; /* PPD file */ ++ int num_options; /* Number of options */ ++ cups_option_t *options; /* Options */ ++ ++ ++ /* ++ * Make sure status messages are not buffered... ++ */ ++ ++ fputs("DEBUG: Got here\n", stderr); ++ setbuf(stderr, NULL); ++ ++ /* ++ * Check command-line... ++ */ ++ ++ if (argc < 6 || argc > 7) ++ { ++ fputs("ERROR: rastertoprx20 job-id user title copies options [file]\n", stderr); ++ return (1); ++ } ++ ++ num_options = cupsParseOptions(argv[5], 0, &options); ++ ++ /* ++ * Open the PPD file... ++ */ ++ ++ ppd = ppdOpenFile(getenv("PPD")); ++ ++ if (!ppd) ++ { ++ fputs("ERROR: Unable to open PPD file!\n", stderr); ++ return (1); ++ } ++ ++ ppdMarkDefaults(ppd); ++ cupsMarkOptions(ppd, num_options, options); ++ ++ /* ++ * Open the page stream... ++ */ ++ ++ if (argc == 7) ++ { ++ if ((fd = open(argv[6], O_RDONLY)) == -1) ++ { ++ perror("ERROR: Unable to open raster file - "); ++ return (1); ++ } ++ } ++ else ++ fd = 0; ++ ++ ras = cupsRasterOpen(fd, CUPS_RASTER_READ); ++ ++ /* ++ * Initialize the print device... ++ */ ++ ++ Setup(ppd); ++ ++ /* ++ * Process pages as needed... ++ */ ++ ++ page = 0; ++ ++ while (cupsRasterReadHeader(ras, &header)) ++ { ++ page ++; ++ ++ fprintf(stderr, "PAGE: %d 1\n", page); ++ fprintf(stderr, "INFO: Starting page %d...\n", page); ++ ++ StartPage(ppd, &header); ++ ++ fprintf(stderr,"DEBUG: Now printing %d rasters\n\r",header.cupsHeight); ++ for (y = 0; y < header.cupsHeight; y ++) ++ { ++ if ((y & 127) == 0) ++ fprintf(stderr, "INFO: Printing page %d, %d%% complete...\n", page, ++ 100 * y / header.cupsHeight); ++ ++ ProcessLine(ppd, ras, &header); ++ } ++ ++ fprintf(stderr, "INFO: Finished page %d...\n", page); ++ ++ EndPage(ppd, &header); ++ if (header.AdvanceDistance == 2) ++ printf("%c",11); ++ else if (header.AdvanceDistance == 3) ++ printf("%c",12); ++ } ++ ++ Shutdown(ppd); ++ ++ cupsRasterClose(ras); ++ ++ if (fd != 0) ++ close(fd); ++ ++ if (page == 0) ++ { ++ fputs("ERROR: No pages found!\n", stderr); ++ return (1); ++ } ++ else ++ { ++ fputs("INFO: Ready to print.\n", stderr); ++ return (0); ++ } ++} ++ ++ +Index: cups-1.3.9/filter/rastertoprx22.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ cups-1.3.9/filter/rastertoprx22.c 2014-02-25 16:36:17.093182452 +0000 +@@ -0,0 +1,530 @@ ++/* ++ * Printrex 822 raster driver for CUPS. ++ * Revision ++ * 1 Initial release ++ * ++ * Copyright 2007 by Apple Inc. ++ * Copyright 1993-2005 by Easy Software Products. ++ * Copyright 2009 by Printrex, Inc. ++ * ++ * These coded instructions, statements, and computer programs are the ++ * property of Apple Inc. and are protected by Federal copyright ++ * law. Distribution and use rights are outlined in the file "LICENSE.txt" ++ * which should have been included with this file. If this file is ++ * file is missing or damaged, see the license at "http://www.cups.org/". ++ * ++ * Contents: ++ * ++ * Setup() - Prepare the printer for graphics output. ++ * StartPage() - Start a page of graphics. ++ * EndPage() - Finish a page of graphics. ++ * Shutdown() - Shutdown a printer. ++ * CompressData() - Compress a line of graphics. ++ * ProcessLine() - Read graphics from the page stream and output ++ * as needed. ++ * main() - Main entry and processing of driver. ++ */ ++ ++/* ++ This code uses PPD parameters in the following way: ++ cupsCompression - 1 is grayscale. 0 is Bimodal. Speed set to 19mm/s in grayscale ++ cupsBytesPerLine - Used to allocate the PixelBuffer memory, and avoid buffer ++ overrun. ++*/ ++/* ++ * Include necessary headers... ++ */ ++ ++#include "string.h" ++#include ++#include ++#include "raster.h" ++#include ++#include ++#include ++ ++#define cupsWritePrintData(s,n) (fwrite((s),1,(n),stdout)) ++ ++/* ++ * Globals... ++ */ ++ ++unsigned char *PixelBuffer, /* Pixel buffer */ ++ *CompBuffer; /* Compression buffer */ ++int OutputFeed; /* Number of lines to skip */ ++int SpeedSet; /* Flag to indicate the speed has been set */ ++ ++/* ++ * Prototypes... ++ */ ++ ++void Setup(ppd_file_t *in); ++void StartPage(ppd_file_t *in, cups_page_header_t *); ++void EndPage(ppd_file_t *, cups_page_header_t *); ++void Shutdown(ppd_file_t *); ++ ++void CompressData(ppd_file_t *, const unsigned char *, const int, ++ int, int); ++void ProcessLine(ppd_file_t *, cups_raster_t *, ++ cups_page_header_t *); ++ ++/* ++ * 'Setup()' - Set the printer up for printing this job. ++ */ ++ ++void ++Setup(ppd_file_t *ppd) /* I - PPD file */ ++{ ++ SpeedSet = 0; ++} ++ ++ ++/* ++ * 'StartPage()' - Start a page of graphics. ++ */ ++ ++const unsigned char modulation[2][12] = ++{ ++ {25, 0, 55, 2, 198, 40, 0, 45, 2, 78, 136, 224}, ++ {25, 0, 75, 4, 206, 40, 0, 42, 2, 213, 103, 224} ++}; ++ ++void StartPage(ppd_file_t *ppd, /* I - PPD file */ ++ cups_page_header_t *header) /* I - Page header */ ++{ ++ signed char resolution[PPD_MAX_NAME]; /* Resolution string */ ++ signed char intensitystr[10]; /* Used for calculating intensity */ ++ int intensity; ++ ++ fprintf(stderr, "DEBUG: StartPage...\n"); ++ fprintf(stderr, "DEBUG: MediaClass = \"%s\"\n", header->MediaClass); ++ fprintf(stderr, "DEBUG: MediaColor = \"%s\"\n", header->MediaColor); ++ fprintf(stderr, "DEBUG: MediaType = \"%s\"\n", header->MediaType); ++ fprintf(stderr, "DEBUG: OutputType = \"%s\"\n", header->OutputType); ++ ++ fprintf(stderr, "DEBUG: AdvanceDistance = %d\n", header->AdvanceDistance); ++ fprintf(stderr, "DEBUG: AdvanceMedia = %d\n", header->AdvanceMedia); ++ fprintf(stderr, "DEBUG: Collate = %d\n", header->Collate); ++ fprintf(stderr, "DEBUG: CutMedia = %d\n", header->CutMedia); ++ fprintf(stderr, "DEBUG: Duplex = %d\n", header->Duplex); ++ fprintf(stderr, "DEBUG: HWResolution = [ %d %d ]\n", header->HWResolution[0], ++ header->HWResolution[1]); ++ fprintf(stderr, "DEBUG: ImagingBoundingBox = [ %d %d %d %d ]\n", ++ header->ImagingBoundingBox[0], header->ImagingBoundingBox[1], ++ header->ImagingBoundingBox[2], header->ImagingBoundingBox[3]); ++ fprintf(stderr, "DEBUG: InsertSheet = %d\n", header->InsertSheet); ++ fprintf(stderr, "DEBUG: Jog = %d\n", header->Jog); ++ fprintf(stderr, "DEBUG: LeadingEdge = %d\n", header->LeadingEdge); ++ fprintf(stderr, "DEBUG: Margins = [ %d %d ]\n", header->Margins[0], ++ header->Margins[1]); ++ fprintf(stderr, "DEBUG: ManualFeed = %d\n", header->ManualFeed); ++ fprintf(stderr, "DEBUG: MediaPosition = %d\n", header->MediaPosition); ++ fprintf(stderr, "DEBUG: MediaWeight = %d\n", header->MediaWeight); ++ fprintf(stderr, "DEBUG: MirrorPrint = %d\n", header->MirrorPrint); ++ fprintf(stderr, "DEBUG: NegativePrint = %d\n", header->NegativePrint); ++ fprintf(stderr, "DEBUG: NumCopies = %d\n", header->NumCopies); ++ fprintf(stderr, "DEBUG: Orientation = %d\n", header->Orientation); ++ fprintf(stderr, "DEBUG: OutputFaceUp = %d\n", header->OutputFaceUp); ++ fprintf(stderr, "DEBUG: PageSize = [ %d %d ]\n", header->PageSize[0], ++ header->PageSize[1]); ++ fprintf(stderr, "DEBUG: Separations = %d\n", header->Separations); ++ fprintf(stderr, "DEBUG: TraySwitch = %d\n", header->TraySwitch); ++ fprintf(stderr, "DEBUG: Tumble = %d\n", header->Tumble); ++ fprintf(stderr, "DEBUG: cupsWidth = %d\n", header->cupsWidth); ++ fprintf(stderr, "DEBUG: cupsHeight = %d\n", header->cupsHeight); ++ fprintf(stderr, "DEBUG: cupsMediaType = %d\n", header->cupsMediaType); ++ fprintf(stderr, "DEBUG: cupsBitsPerColor = %d\n", header->cupsBitsPerColor); ++ fprintf(stderr, "DEBUG: cupsBitsPerPixel = %d\n", header->cupsBitsPerPixel); ++ fprintf(stderr, "DEBUG: cupsBytesPerLine = %d\n", header->cupsBytesPerLine); ++ fprintf(stderr, "DEBUG: cupsColorOrder = %d\n", header->cupsColorOrder); ++ fprintf(stderr, "DEBUG: cupsColorSpace = %d\n", header->cupsColorSpace); ++ fprintf(stderr, "DEBUG: cupsCompression = %d\n", header->cupsCompression); ++ fprintf(stderr, "DEBUG: cupsRowCount = %d\n", header->cupsRowCount); ++ fprintf(stderr, "DEBUG: cupsRowFeed = %d\n", header->cupsRowFeed); ++ fprintf(stderr, "DEBUG: cupsRowStep = %d\n", header->cupsRowStep); ++ ++ /* ++ * Set the resolution and Media Type ++ */ ++ ++ if (header->HWResolution[0] != header->HWResolution[1]) ++ snprintf(resolution, sizeof(resolution), "%dx%ddpi", ++ header->HWResolution[0], header->HWResolution[1]); ++ else ++ snprintf(resolution, sizeof(resolution), "%ddpi", ++ header->HWResolution[0]); ++ ++ if (!header->MediaType[0]) ++ strcpy(header->MediaType, "Plain"); ++ ++ fprintf(stderr, "DEBUG: MediaType = %s\n", header->MediaType); ++ fprintf(stderr, "DEBUG: Resolution = %s\n", resolution); ++ ++ if (!SpeedSet) ++ { ++ cupsWritePrintData("\033_X\015M",5); ++ if (strcmp(header->MediaType, "PrintrexRoll") == 0) ++ { ++ cupsWritePrintData(modulation[0],12); ++ fprintf(stderr, "DEBUG: Setting Roll\n"); ++ } ++ else if (strcmp(header->MediaType, "Heavyweight") == 0) ++ { ++ cupsWritePrintData(modulation[1],12); ++ fprintf(stderr, "DEBUG: Setting Heavyweight\n"); ++ } ++ ++ // If not 1, it's gray scale. Set the speed, Sat, and White level ++ // according to the media selected. ++ if (header->cupsBitsPerPixel != 1) ++ { ++ cupsWritePrintData("\033_X\005Q",5); ++ putchar(17); ++ cupsWritePrintData("\377\200\377",3); ++ if (strcmp(header->MediaType, "PrintrexRoll") == 0) ++ cupsWritePrintData("\033_P\340\000\000",6); ++ else if (strcmp(header->MediaType, "Heavyweight") == 0) ++ cupsWritePrintData("\033_P\300\020\000",6); ++ } ++ else ++ { ++ if (strcmp(header->OutputType, "1ips") == 0) ++ { ++ fprintf(stderr,"DEBUG: Going 1ips\n"); ++ cupsWritePrintData("\033_X\005Q",5); ++ putchar(25); ++ cupsWritePrintData("\377\200\377",3); ++ } ++ else if (strcmp(header->OutputType, "2ips") == 0) ++ { ++ cupsWritePrintData("\033_X\005Q",5); ++ putchar(50); ++ cupsWritePrintData("\377\200\377",3); ++ fprintf(stderr, "DEBUG: Going 2ips\n"); ++ } ++ else if (strcmp(header->OutputType, "3ips") == 0) ++ { ++ cupsWritePrintData("\033_X\005Q",5); ++ putchar(75); ++ cupsWritePrintData("\377\200\377",3); ++ fprintf(stderr, "DEBUG: Going 3ips\n"); ++ } ++ else if (strcmp(header->OutputType, "4ips") == 0) ++ { ++ cupsWritePrintData("\033_X\005Q",5); ++ putchar(100); ++ cupsWritePrintData("\377\200\377",3); ++ fprintf(stderr, "DEBUG: Going 4ips\n"); ++ } ++ strcpy(intensitystr, header->MediaClass); ++ sscanf(intensitystr,"%d",&intensity); ++ fprintf(stderr,"DEBUG: Intensity is %d\n", intensity); ++ ++ cupsWritePrintData("\033_P",3); ++ putchar(intensity & 0xFF); ++ putchar(0); ++ putchar(0); ++ } ++ SpeedSet = 1; ++ } ++ ++ PixelBuffer = malloc(header->cupsBytesPerLine + 20); ++ CompBuffer = malloc(header->cupsBytesPerLine + 20); ++} ++ ++ ++/* ++ * 'EndPage()' - Finish a page of graphics. ++ */ ++ ++void EndPage(ppd_file_t *ppd, /* I - PPD file */ ++ cups_page_header_t *header) /* I - Page header */ ++{ ++ free(PixelBuffer); ++ free(CompBuffer); ++} ++ ++ ++/* ++ * 'Shutdown()' - Shutdown a printer. ++ */ ++ ++void Shutdown(ppd_file_t *ppd) /* I - PPD file */ ++{ ++ /* ++ * Reset the printer... ++ */ ++ ++ printf("\032"); ++} ++ ++/* ++ * 'CompressData()' - Compress a line of graphics. ++ */ ++ ++void CompressData(ppd_file_t *ppd, /* I - PPD file information */ ++ const unsigned char *line, /* I - Data to compress */ ++ const int length,/* I - Number of bytes */ ++ int type, /* I - Type of compression */ ++ int bits) /* I - Bits Per Pixel */ ++{ ++ register const unsigned char *line_ptr, ++ /* Current byte pointer */ ++ *line_end, /* End-of-line byte pointer */ ++ *start; /* Start of compression sequence */ ++ register unsigned char *comp_ptr; /* Pointer into compression buffer */ ++ register int count; /* Count of bytes for output */ ++ register int bytes; /* Number of bytes per row */ ++ ++ ++ switch (type) ++ { ++ case 0 : ++ /* ++ * Do no compression... ++ */ ++ ++ line_ptr = (const unsigned char *)line; ++ line_end = (const unsigned char *)line + length; ++ bytes = 216; ++ memcpy(CompBuffer, PixelBuffer, bytes); ++ break; ++ ++ default : ++ /* ++ * Do TIFF pack-bits encoding... ++ */ ++ ++ line_ptr = (const unsigned char *)line; ++ line_end = (const unsigned char *)line + length; ++ comp_ptr = (unsigned char*)CompBuffer; ++ ++ while (line_ptr < line_end && (comp_ptr - CompBuffer) < length) ++ { ++ if ((line_ptr + 1) >= line_end) ++ { ++ /* ++ * Single byte on the end... ++ */ ++ ++ *comp_ptr++ = 0x00; ++ *comp_ptr++ = *line_ptr++; ++ } ++ else if (line_ptr[0] == line_ptr[1]) ++ { ++ /* ++ * Repeated sequence... ++ */ ++ ++ line_ptr ++; ++ count = 2; ++ ++ while (line_ptr < (line_end - 1) && ++ line_ptr[0] == line_ptr[1] && ++ count < 127) ++ { ++ line_ptr ++; ++ count ++; ++ } ++ ++ *comp_ptr++ = 257 - count; ++ *comp_ptr++ = *line_ptr++; ++ } ++ else ++ { ++ /* ++ * Non-repeated sequence... ++ */ ++ ++ start = line_ptr; ++ line_ptr ++; ++ count = 1; ++ ++ while (line_ptr < (line_end - 1) && ++ line_ptr[0] != line_ptr[1] && ++ count < 127) ++ { ++ line_ptr ++; ++ count ++; ++ } ++ ++ *comp_ptr++ = count - 1; ++ ++ memcpy(comp_ptr, start, count); ++ comp_ptr += count; ++ } ++ } ++ line_end = comp_ptr; ++ bytes = comp_ptr - CompBuffer; ++ } ++ ++ /* ++ * Send the graphics... ++ */ ++ ++ if (type == 0) ++ cupsWritePrintData("\033Z\001\000",4); ++ else ++ { ++ cupsWritePrintData("\033_R\001",4); ++ putchar(bits); ++ putchar(bytes >> 8); ++ putchar(bytes & 0xFF); ++ } ++ ++ cupsWritePrintData(CompBuffer, bytes); ++} ++ ++/* ++ * 'ProcessLine()' - Read graphics from the page stream and output as needed. ++ */ ++ ++void ProcessLine(ppd_file_t *ppd, /* I - PPD file */ ++ cups_raster_t *ras, /* I - Raster stream */ ++ cups_page_header_t *header) /* I - Page header */ ++{ ++ ++ /* ++ * Read a row of graphics... ++ */ ++ ++ if (!cupsRasterReadPixels(ras, PixelBuffer, header->cupsBytesPerLine)) ++ return; ++ ++ CompressData(ppd, PixelBuffer, header->cupsBytesPerLine, header->cupsCompression, ++ header->cupsBitsPerPixel); ++ fflush(stdout); ++ ++ OutputFeed ++; ++} ++ ++ ++/* ++ * 'main()' - Main entry and processing of driver. ++ */ ++ ++ /* O - Exit status */ ++int main(int argc, /* I - Number of command-line arguments */ ++ char *argv[]) /* I - Command-line arguments */ ++{ ++ int fd; /* File descriptor */ ++ cups_raster_t *ras; /* Raster stream for printing */ ++ cups_page_header_t header; /* Page header from file */ ++ int page; /* Current page */ ++ int y; /* Current line */ ++ ppd_file_t *ppd; /* PPD file */ ++ int num_options; /* Number of options */ ++ cups_option_t *options; /* Options */ ++ ++ ++ /* ++ * Make sure status messages are not buffered... ++ */ ++ ++ fputs("DEBUG: Got here\n", stderr); ++ setbuf(stderr, NULL); ++ ++ /* ++ * Check command-line... ++ */ ++ ++ if (argc < 6 || argc > 7) ++ { ++ fputs("ERROR: rastertoprx22 job-id user title copies options [file]\n", stderr); ++ return (1); ++ } ++ ++ num_options = cupsParseOptions(argv[5], 0, &options); ++ ++ /* ++ * Open the PPD file... ++ */ ++ ++ ppd = ppdOpenFile(getenv("PPD")); ++ ++ if (!ppd) ++ { ++ fputs("ERROR: Unable to open PPD file!\n", stderr); ++ return (1); ++ } ++ ++ ppdMarkDefaults(ppd); ++ cupsMarkOptions(ppd, num_options, options); ++ ++ /* ++ * Open the page stream... ++ */ ++ ++ if (argc == 7) ++ { ++ if ((fd = open(argv[6], O_RDONLY)) == -1) ++ { ++ perror("ERROR: Unable to open raster file - "); ++ return (1); ++ } ++ } ++ else ++ fd = 0; ++ ++ ras = cupsRasterOpen(fd, CUPS_RASTER_READ); ++ ++ /* ++ * Initialize the print device... ++ */ ++ ++ Setup(ppd); ++ ++ /* ++ * Process pages as needed... ++ */ ++ ++ page = 0; ++ ++ while (cupsRasterReadHeader(ras, &header)) ++ { ++ page ++; ++ ++ fprintf(stderr, "PAGE: %d 1\n", page); ++ fprintf(stderr, "INFO: Starting page %d...\n", page); ++ ++ StartPage(ppd, &header); ++ ++ fprintf(stderr,"DEBUG: Now printing %d rasters\n\r",header.cupsHeight); ++ for (y = 0; y < header.cupsHeight; y ++) ++ { ++ if ((y & 127) == 0) ++ fprintf(stderr, "INFO: Printing page %d, %d%% complete...\n", page, ++ 100 * y / header.cupsHeight); ++ ++ ProcessLine(ppd, ras, &header); ++ } ++ ++ fprintf(stderr, "INFO: Finished page %d...\n", page); ++ ++ EndPage(ppd, &header); ++ if (header.AdvanceDistance == 2) ++ printf("%c",11); ++ else if (header.AdvanceDistance == 3) ++ printf("%c",12); ++ } ++ ++ Shutdown(ppd); ++ ++ cupsRasterClose(ras); ++ ++ if (fd != 0) ++ close(fd); ++ ++ if (page == 0) ++ { ++ fputs("ERROR: No pages found!\n", stderr); ++ return (1); ++ } ++ else ++ { ++ fputs("INFO: Ready to print.\n", stderr); ++ return (0); ++ } ++} ++ ++ +Index: cups-1.3.9/filter/rastertoprx23.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ cups-1.3.9/filter/rastertoprx23.c 2014-02-25 16:36:17.093182452 +0000 +@@ -0,0 +1,530 @@ ++/* ++ * Printrex 823 raster driver for CUPS. ++ * Revision ++ * 1 Initial release ++ * ++ * Copyright 2007 by Apple Inc. ++ * Copyright 1993-2005 by Easy Software Products. ++ * Copyright 2009 by Printrex, Inc. ++ * ++ * These coded instructions, statements, and computer programs are the ++ * property of Apple Inc. and are protected by Federal copyright ++ * law. Distribution and use rights are outlined in the file "LICENSE.txt" ++ * which should have been included with this file. If this file is ++ * file is missing or damaged, see the license at "http://www.cups.org/". ++ * ++ * Contents: ++ * ++ * Setup() - Prepare the printer for graphics output. ++ * StartPage() - Start a page of graphics. ++ * EndPage() - Finish a page of graphics. ++ * Shutdown() - Shutdown a printer. ++ * CompressData() - Compress a line of graphics. ++ * ProcessLine() - Read graphics from the page stream and output ++ * as needed. ++ * main() - Main entry and processing of driver. ++ */ ++ ++/* ++ This code uses PPD parameters in the following way: ++ cupsCompression - 1 is grayscale. 0 is Bimodal. Speed set to 19mm/s in grayscale ++ cupsBytesPerLine - Used to allocate the PixelBuffer memory, and avoid buffer ++ overrun. ++*/ ++/* ++ * Include necessary headers... ++ */ ++ ++#include "string.h" ++#include ++#include ++#include "raster.h" ++#include ++#include ++#include ++ ++#define cupsWritePrintData(s,n) (fwrite((s),1,(n),stdout)) ++ ++/* ++ * Globals... ++ */ ++ ++unsigned char *PixelBuffer, /* Pixel buffer */ ++ *CompBuffer; /* Compression buffer */ ++int OutputFeed; /* Number of lines to skip */ ++int SpeedSet; /* Flag to indicate the speed has been set */ ++ ++/* ++ * Prototypes... ++ */ ++ ++void Setup(ppd_file_t *in); ++void StartPage(ppd_file_t *in, cups_page_header_t *); ++void EndPage(ppd_file_t *, cups_page_header_t *); ++void Shutdown(ppd_file_t *); ++ ++void CompressData(ppd_file_t *, const unsigned char *, const int, ++ int, int); ++void ProcessLine(ppd_file_t *, cups_raster_t *, ++ cups_page_header_t *); ++ ++/* ++ * 'Setup()' - Set the printer up for printing this job. ++ */ ++ ++void ++Setup(ppd_file_t *ppd) /* I - PPD file */ ++{ ++ SpeedSet = 0; ++} ++ ++ ++/* ++ * 'StartPage()' - Start a page of graphics. ++ */ ++ ++const unsigned char modulation[2][13] = ++{ ++ {25, 0, 30, 1, 194, 40, 0, 22, 1, 91, 170, 224,'3'}, ++ {25, 0, 48, 2, 188, 40, 0, 40, 2, 88, 170, 224,'3'} ++}; ++ ++void StartPage(ppd_file_t *ppd, /* I - PPD file */ ++ cups_page_header_t *header) /* I - Page header */ ++{ ++ signed char resolution[PPD_MAX_NAME]; /* Resolution string */ ++ signed char intensitystr[10]; /* Used for calculating intensity */ ++ int intensity; ++ ++ fprintf(stderr, "DEBUG: StartPage...\n"); ++ fprintf(stderr, "DEBUG: MediaClass = \"%s\"\n", header->MediaClass); ++ fprintf(stderr, "DEBUG: MediaColor = \"%s\"\n", header->MediaColor); ++ fprintf(stderr, "DEBUG: MediaType = \"%s\"\n", header->MediaType); ++ fprintf(stderr, "DEBUG: OutputType = \"%s\"\n", header->OutputType); ++ ++ fprintf(stderr, "DEBUG: AdvanceDistance = %d\n", header->AdvanceDistance); ++ fprintf(stderr, "DEBUG: AdvanceMedia = %d\n", header->AdvanceMedia); ++ fprintf(stderr, "DEBUG: Collate = %d\n", header->Collate); ++ fprintf(stderr, "DEBUG: CutMedia = %d\n", header->CutMedia); ++ fprintf(stderr, "DEBUG: Duplex = %d\n", header->Duplex); ++ fprintf(stderr, "DEBUG: HWResolution = [ %d %d ]\n", header->HWResolution[0], ++ header->HWResolution[1]); ++ fprintf(stderr, "DEBUG: ImagingBoundingBox = [ %d %d %d %d ]\n", ++ header->ImagingBoundingBox[0], header->ImagingBoundingBox[1], ++ header->ImagingBoundingBox[2], header->ImagingBoundingBox[3]); ++ fprintf(stderr, "DEBUG: InsertSheet = %d\n", header->InsertSheet); ++ fprintf(stderr, "DEBUG: Jog = %d\n", header->Jog); ++ fprintf(stderr, "DEBUG: LeadingEdge = %d\n", header->LeadingEdge); ++ fprintf(stderr, "DEBUG: Margins = [ %d %d ]\n", header->Margins[0], ++ header->Margins[1]); ++ fprintf(stderr, "DEBUG: ManualFeed = %d\n", header->ManualFeed); ++ fprintf(stderr, "DEBUG: MediaPosition = %d\n", header->MediaPosition); ++ fprintf(stderr, "DEBUG: MediaWeight = %d\n", header->MediaWeight); ++ fprintf(stderr, "DEBUG: MirrorPrint = %d\n", header->MirrorPrint); ++ fprintf(stderr, "DEBUG: NegativePrint = %d\n", header->NegativePrint); ++ fprintf(stderr, "DEBUG: NumCopies = %d\n", header->NumCopies); ++ fprintf(stderr, "DEBUG: Orientation = %d\n", header->Orientation); ++ fprintf(stderr, "DEBUG: OutputFaceUp = %d\n", header->OutputFaceUp); ++ fprintf(stderr, "DEBUG: PageSize = [ %d %d ]\n", header->PageSize[0], ++ header->PageSize[1]); ++ fprintf(stderr, "DEBUG: Separations = %d\n", header->Separations); ++ fprintf(stderr, "DEBUG: TraySwitch = %d\n", header->TraySwitch); ++ fprintf(stderr, "DEBUG: Tumble = %d\n", header->Tumble); ++ fprintf(stderr, "DEBUG: cupsWidth = %d\n", header->cupsWidth); ++ fprintf(stderr, "DEBUG: cupsHeight = %d\n", header->cupsHeight); ++ fprintf(stderr, "DEBUG: cupsMediaType = %d\n", header->cupsMediaType); ++ fprintf(stderr, "DEBUG: cupsBitsPerColor = %d\n", header->cupsBitsPerColor); ++ fprintf(stderr, "DEBUG: cupsBitsPerPixel = %d\n", header->cupsBitsPerPixel); ++ fprintf(stderr, "DEBUG: cupsBytesPerLine = %d\n", header->cupsBytesPerLine); ++ fprintf(stderr, "DEBUG: cupsColorOrder = %d\n", header->cupsColorOrder); ++ fprintf(stderr, "DEBUG: cupsColorSpace = %d\n", header->cupsColorSpace); ++ fprintf(stderr, "DEBUG: cupsCompression = %d\n", header->cupsCompression); ++ fprintf(stderr, "DEBUG: cupsRowCount = %d\n", header->cupsRowCount); ++ fprintf(stderr, "DEBUG: cupsRowFeed = %d\n", header->cupsRowFeed); ++ fprintf(stderr, "DEBUG: cupsRowStep = %d\n", header->cupsRowStep); ++ ++ /* ++ * Set the resolution and Media Type ++ */ ++ ++ if (header->HWResolution[0] != header->HWResolution[1]) ++ snprintf(resolution, sizeof(resolution), "%dx%ddpi", ++ header->HWResolution[0], header->HWResolution[1]); ++ else ++ snprintf(resolution, sizeof(resolution), "%ddpi", ++ header->HWResolution[0]); ++ ++ if (!header->MediaType[0]) ++ strcpy(header->MediaType, "Plain"); ++ ++ fprintf(stderr, "DEBUG: MediaType = %s\n", header->MediaType); ++ fprintf(stderr, "DEBUG: Resolution = %s\n", resolution); ++ ++ if (!SpeedSet) ++ { ++ cupsWritePrintData("\033_X\016M",5); ++ if (strcmp(header->MediaType, "PrintrexRoll") == 0) ++ { ++ cupsWritePrintData(modulation[0],13); ++ fprintf(stderr, "DEBUG: Setting Roll\n"); ++ } ++ else if (strcmp(header->MediaType, "Heavyweight") == 0) ++ { ++ cupsWritePrintData(modulation[1],13); ++ fprintf(stderr, "DEBUG: Setting Heavyweight\n"); ++ } ++ ++ // If not 1, it's gray scale. Set the speed, Sat, and White level ++ // according to the media selected. ++ if (header->cupsBitsPerPixel != 1) ++ { ++ cupsWritePrintData("\033_X\005Q",5); ++ putchar(20); ++ cupsWritePrintData("\377\200\377",3); ++ if (strcmp(header->MediaType, "PrintrexRoll") == 0) ++ cupsWritePrintData("\033_P\340\000\000",6); ++ else if (strcmp(header->MediaType, "Heavyweight") == 0) ++ cupsWritePrintData("\033_P\300\020\000",6); ++ } ++ else ++ { ++ if (strcmp(header->OutputType, "1ips") == 0) ++ { ++ fprintf(stderr,"DEBUG: Going 1ips\n"); ++ cupsWritePrintData("\033_X\005Q",5); ++ putchar(25); ++ cupsWritePrintData("\377\200\377",3); ++ } ++ else if (strcmp(header->OutputType, "2ips") == 0) ++ { ++ cupsWritePrintData("\033_X\005Q",5); ++ putchar(50); ++ cupsWritePrintData("\377\200\377",3); ++ fprintf(stderr, "DEBUG: Going 2ips\n"); ++ } ++ else if (strcmp(header->OutputType, "3ips") == 0) ++ { ++ cupsWritePrintData("\033_X\005Q",5); ++ putchar(75); ++ cupsWritePrintData("\377\200\377",3); ++ fprintf(stderr, "DEBUG: Going 3ips\n"); ++ } ++ else if (strcmp(header->OutputType, "4ips") == 0) ++ { ++ cupsWritePrintData("\033_X\005Q",5); ++ putchar(100); ++ cupsWritePrintData("\377\200\377",3); ++ fprintf(stderr, "DEBUG: Going 4ips\n"); ++ } ++ strcpy(intensitystr, header->MediaClass); ++ sscanf(intensitystr,"%d",&intensity); ++ fprintf(stderr,"DEBUG: Intensity is %d\n", intensity); ++ ++ cupsWritePrintData("\033_P",3); ++ putchar(intensity & 0xFF); ++ putchar(0); ++ putchar(0); ++ } ++ SpeedSet = 1; ++ } ++ ++ PixelBuffer = malloc(header->cupsBytesPerLine + 20); ++ CompBuffer = malloc(header->cupsBytesPerLine + 20); ++} ++ ++ ++/* ++ * 'EndPage()' - Finish a page of graphics. ++ */ ++ ++void EndPage(ppd_file_t *ppd, /* I - PPD file */ ++ cups_page_header_t *header) /* I - Page header */ ++{ ++ free(PixelBuffer); ++ free(CompBuffer); ++} ++ ++ ++/* ++ * 'Shutdown()' - Shutdown a printer. ++ */ ++ ++void Shutdown(ppd_file_t *ppd) /* I - PPD file */ ++{ ++ /* ++ * Reset the printer... ++ */ ++ ++ printf("\032"); ++} ++ ++/* ++ * 'CompressData()' - Compress a line of graphics. ++ */ ++ ++void CompressData(ppd_file_t *ppd, /* I - PPD file information */ ++ const unsigned char *line, /* I - Data to compress */ ++ const int length,/* I - Number of bytes */ ++ int type, /* I - Type of compression */ ++ int bits) /* I - Bits Per Pixel */ ++{ ++ register const unsigned char *line_ptr, ++ /* Current byte pointer */ ++ *line_end, /* End-of-line byte pointer */ ++ *start; /* Start of compression sequence */ ++ register unsigned char *comp_ptr; /* Pointer into compression buffer */ ++ register int count; /* Count of bytes for output */ ++ register int bytes; /* Number of bytes per row */ ++ ++ ++ switch (type) ++ { ++ case 0 : ++ /* ++ * Do no compression... ++ */ ++ ++ line_ptr = (const unsigned char *)line; ++ line_end = (const unsigned char *)line + length; ++ bytes = 216; ++ memcpy(CompBuffer, PixelBuffer, bytes); ++ break; ++ ++ default : ++ /* ++ * Do TIFF pack-bits encoding... ++ */ ++ ++ line_ptr = (const unsigned char *)line; ++ line_end = (const unsigned char *)line + length; ++ comp_ptr = (unsigned char*)CompBuffer; ++ ++ while (line_ptr < line_end && (comp_ptr - CompBuffer) < length) ++ { ++ if ((line_ptr + 1) >= line_end) ++ { ++ /* ++ * Single byte on the end... ++ */ ++ ++ *comp_ptr++ = 0x00; ++ *comp_ptr++ = *line_ptr++; ++ } ++ else if (line_ptr[0] == line_ptr[1]) ++ { ++ /* ++ * Repeated sequence... ++ */ ++ ++ line_ptr ++; ++ count = 2; ++ ++ while (line_ptr < (line_end - 1) && ++ line_ptr[0] == line_ptr[1] && ++ count < 127) ++ { ++ line_ptr ++; ++ count ++; ++ } ++ ++ *comp_ptr++ = 257 - count; ++ *comp_ptr++ = *line_ptr++; ++ } ++ else ++ { ++ /* ++ * Non-repeated sequence... ++ */ ++ ++ start = line_ptr; ++ line_ptr ++; ++ count = 1; ++ ++ while (line_ptr < (line_end - 1) && ++ line_ptr[0] != line_ptr[1] && ++ count < 127) ++ { ++ line_ptr ++; ++ count ++; ++ } ++ ++ *comp_ptr++ = count - 1; ++ ++ memcpy(comp_ptr, start, count); ++ comp_ptr += count; ++ } ++ } ++ line_end = comp_ptr; ++ bytes = comp_ptr - CompBuffer; ++ } ++ ++ /* ++ * Send the graphics... ++ */ ++ ++ if (type == 0) ++ cupsWritePrintData("\033Z\001\000",4); ++ else ++ { ++ cupsWritePrintData("\033_R\001",4); ++ putchar(bits); ++ putchar(bytes >> 8); ++ putchar(bytes & 0xFF); ++ } ++ ++ cupsWritePrintData(CompBuffer, bytes); ++} ++ ++/* ++ * 'ProcessLine()' - Read graphics from the page stream and output as needed. ++ */ ++ ++void ProcessLine(ppd_file_t *ppd, /* I - PPD file */ ++ cups_raster_t *ras, /* I - Raster stream */ ++ cups_page_header_t *header) /* I - Page header */ ++{ ++ ++ /* ++ * Read a row of graphics... ++ */ ++ ++ if (!cupsRasterReadPixels(ras, PixelBuffer, header->cupsBytesPerLine)) ++ return; ++ ++ CompressData(ppd, PixelBuffer, header->cupsBytesPerLine, header->cupsCompression, ++ header->cupsBitsPerPixel); ++ fflush(stdout); ++ ++ OutputFeed ++; ++} ++ ++ ++/* ++ * 'main()' - Main entry and processing of driver. ++ */ ++ ++ /* O - Exit status */ ++int main(int argc, /* I - Number of command-line arguments */ ++ char *argv[]) /* I - Command-line arguments */ ++{ ++ int fd; /* File descriptor */ ++ cups_raster_t *ras; /* Raster stream for printing */ ++ cups_page_header_t header; /* Page header from file */ ++ int page; /* Current page */ ++ int y; /* Current line */ ++ ppd_file_t *ppd; /* PPD file */ ++ int num_options; /* Number of options */ ++ cups_option_t *options; /* Options */ ++ ++ ++ /* ++ * Make sure status messages are not buffered... ++ */ ++ ++ fputs("DEBUG: Got here\n", stderr); ++ setbuf(stderr, NULL); ++ ++ /* ++ * Check command-line... ++ */ ++ ++ if (argc < 6 || argc > 7) ++ { ++ fputs("ERROR: rastertoprx23 job-id user title copies options [file]\n", stderr); ++ return (1); ++ } ++ ++ num_options = cupsParseOptions(argv[5], 0, &options); ++ ++ /* ++ * Open the PPD file... ++ */ ++ ++ ppd = ppdOpenFile(getenv("PPD")); ++ ++ if (!ppd) ++ { ++ fputs("ERROR: Unable to open PPD file!\n", stderr); ++ return (1); ++ } ++ ++ ppdMarkDefaults(ppd); ++ cupsMarkOptions(ppd, num_options, options); ++ ++ /* ++ * Open the page stream... ++ */ ++ ++ if (argc == 7) ++ { ++ if ((fd = open(argv[6], O_RDONLY)) == -1) ++ { ++ perror("ERROR: Unable to open raster file - "); ++ return (1); ++ } ++ } ++ else ++ fd = 0; ++ ++ ras = cupsRasterOpen(fd, CUPS_RASTER_READ); ++ ++ /* ++ * Initialize the print device... ++ */ ++ ++ Setup(ppd); ++ ++ /* ++ * Process pages as needed... ++ */ ++ ++ page = 0; ++ ++ while (cupsRasterReadHeader(ras, &header)) ++ { ++ page ++; ++ ++ fprintf(stderr, "PAGE: %d 1\n", page); ++ fprintf(stderr, "INFO: Starting page %d...\n", page); ++ ++ StartPage(ppd, &header); ++ ++ fprintf(stderr,"DEBUG: Now printing %d rasters\n\r",header.cupsHeight); ++ for (y = 0; y < header.cupsHeight; y ++) ++ { ++ if ((y & 127) == 0) ++ fprintf(stderr, "INFO: Printing page %d, %d%% complete...\n", page, ++ 100 * y / header.cupsHeight); ++ ++ ProcessLine(ppd, ras, &header); ++ } ++ ++ fprintf(stderr, "INFO: Finished page %d...\n", page); ++ ++ EndPage(ppd, &header); ++ if (header.AdvanceDistance == 2) ++ printf("%c",11); ++ else if (header.AdvanceDistance == 3) ++ printf("%c",12); ++ } ++ ++ Shutdown(ppd); ++ ++ cupsRasterClose(ras); ++ ++ if (fd != 0) ++ close(fd); ++ ++ if (page == 0) ++ { ++ fputs("ERROR: No pages found!\n", stderr); ++ return (1); ++ } ++ else ++ { ++ fputs("INFO: Ready to print.\n", stderr); ++ return (0); ++ } ++} ++ ++ +Index: cups-1.3.9/filter/rastertoprx40.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ cups-1.3.9/filter/rastertoprx40.c 2014-02-25 16:36:17.097182556 +0000 +@@ -0,0 +1,523 @@ ++/* ++ * Printrex 840 raster driver for CUPS. ++ * Revision ++ * 1 Initial release. ++ * ++ * Copyright 2009 by Printrex, Inc. ++ * ++ * ++ * Contents: ++ * ++ * Setup() - Prepare the printer for graphics output. ++ * StartPage() - Start a page of graphics. ++ * EndPage() - Finish a page of graphics. ++ * Shutdown() - Shutdown a printer. ++ * CompressData() - Compress a line of graphics. ++ * ProcessLine() - Read graphics from the page stream and output ++ * as needed. ++ * main() - Main entry and processing of driver. ++ */ ++ ++/* ++ This code uses PPD parameters in the following way: ++ cupsCompression - 1 is grayscale. 0 is Bimodal. Speed set to 19mm/s in grayscale ++ cupsBytesPerLine - Used to allocate the PixelBuffer memory, and avoid buffer ++ overrun. ++*/ ++/* ++ * Include necessary headers... ++ */ ++ ++#include "string.h" ++#include ++#include ++#include "raster.h" ++#include ++#include ++#include ++ ++#define cupsWritePrintData(s,n) (fwrite((s),1,(n),stdout)) ++ ++/* ++ * Globals... ++ */ ++ ++unsigned char *PixelBuffer, /* Pixel buffer */ ++ *CompBuffer; /* Compression buffer */ ++int OutputFeed; /* Number of lines to skip */ ++int SpeedSet; /* Flag to indicate the speed has been set */ ++ ++/* ++ * Prototypes... ++ */ ++ ++void Setup(ppd_file_t *in); ++void StartPage(ppd_file_t *in, cups_page_header_t *); ++void EndPage(ppd_file_t *, cups_page_header_t *); ++void Shutdown(ppd_file_t *); ++ ++void CompressData(ppd_file_t *, const unsigned char *, const int, ++ int, int); ++void ProcessLine(ppd_file_t *, cups_raster_t *, ++ cups_page_header_t *); ++ ++/* ++ * 'Setup()' - Set the printer up for printing this job. ++ */ ++ ++void ++Setup(ppd_file_t *ppd) /* I - PPD file */ ++{ ++ SpeedSet = 0; ++} ++ ++ ++/* ++ * 'StartPage()' - Start a page of graphics. ++ */ ++ ++const unsigned char modulation[2][12] = ++{ ++ {25, 0, 91, 3, 17, 40, 0, 68, 2, 62, 30, 60}, ++ {25, 0, 103, 3, 185, 40, 0, 74, 2, 244, 10, 20} ++}; ++ ++void StartPage(ppd_file_t *ppd, /* I - PPD file */ ++ cups_page_header_t *header) /* I - Page header */ ++{ ++ signed char resolution[PPD_MAX_NAME]; /* Resolution string */ ++ signed char intensitystr[10]; /* Used for calculating intensity */ ++ int intensity; ++ ++ fprintf(stderr, "DEBUG: StartPage...\n"); ++ fprintf(stderr, "DEBUG: MediaClass = \"%s\"\n", header->MediaClass); ++ fprintf(stderr, "DEBUG: MediaColor = \"%s\"\n", header->MediaColor); ++ fprintf(stderr, "DEBUG: MediaType = \"%s\"\n", header->MediaType); ++ fprintf(stderr, "DEBUG: OutputType = \"%s\"\n", header->OutputType); ++ ++ fprintf(stderr, "DEBUG: AdvanceDistance = %d\n", header->AdvanceDistance); ++ fprintf(stderr, "DEBUG: AdvanceMedia = %d\n", header->AdvanceMedia); ++ fprintf(stderr, "DEBUG: Collate = %d\n", header->Collate); ++ fprintf(stderr, "DEBUG: CutMedia = %d\n", header->CutMedia); ++ fprintf(stderr, "DEBUG: Duplex = %d\n", header->Duplex); ++ fprintf(stderr, "DEBUG: HWResolution = [ %d %d ]\n", header->HWResolution[0], ++ header->HWResolution[1]); ++ fprintf(stderr, "DEBUG: ImagingBoundingBox = [ %d %d %d %d ]\n", ++ header->ImagingBoundingBox[0], header->ImagingBoundingBox[1], ++ header->ImagingBoundingBox[2], header->ImagingBoundingBox[3]); ++ fprintf(stderr, "DEBUG: InsertSheet = %d\n", header->InsertSheet); ++ fprintf(stderr, "DEBUG: Jog = %d\n", header->Jog); ++ fprintf(stderr, "DEBUG: LeadingEdge = %d\n", header->LeadingEdge); ++ fprintf(stderr, "DEBUG: Margins = [ %d %d ]\n", header->Margins[0], ++ header->Margins[1]); ++ fprintf(stderr, "DEBUG: ManualFeed = %d\n", header->ManualFeed); ++ fprintf(stderr, "DEBUG: MediaPosition = %d\n", header->MediaPosition); ++ fprintf(stderr, "DEBUG: MediaWeight = %d\n", header->MediaWeight); ++ fprintf(stderr, "DEBUG: MirrorPrint = %d\n", header->MirrorPrint); ++ fprintf(stderr, "DEBUG: NegativePrint = %d\n", header->NegativePrint); ++ fprintf(stderr, "DEBUG: NumCopies = %d\n", header->NumCopies); ++ fprintf(stderr, "DEBUG: Orientation = %d\n", header->Orientation); ++ fprintf(stderr, "DEBUG: OutputFaceUp = %d\n", header->OutputFaceUp); ++ fprintf(stderr, "DEBUG: PageSize = [ %d %d ]\n", header->PageSize[0], ++ header->PageSize[1]); ++ fprintf(stderr, "DEBUG: Separations = %d\n", header->Separations); ++ fprintf(stderr, "DEBUG: TraySwitch = %d\n", header->TraySwitch); ++ fprintf(stderr, "DEBUG: Tumble = %d\n", header->Tumble); ++ fprintf(stderr, "DEBUG: cupsWidth = %d\n", header->cupsWidth); ++ fprintf(stderr, "DEBUG: cupsHeight = %d\n", header->cupsHeight); ++ fprintf(stderr, "DEBUG: cupsMediaType = %d\n", header->cupsMediaType); ++ fprintf(stderr, "DEBUG: cupsBitsPerColor = %d\n", header->cupsBitsPerColor); ++ fprintf(stderr, "DEBUG: cupsBitsPerPixel = %d\n", header->cupsBitsPerPixel); ++ fprintf(stderr, "DEBUG: cupsBytesPerLine = %d\n", header->cupsBytesPerLine); ++ fprintf(stderr, "DEBUG: cupsColorOrder = %d\n", header->cupsColorOrder); ++ fprintf(stderr, "DEBUG: cupsColorSpace = %d\n", header->cupsColorSpace); ++ fprintf(stderr, "DEBUG: cupsCompression = %d\n", header->cupsCompression); ++ fprintf(stderr, "DEBUG: cupsRowCount = %d\n", header->cupsRowCount); ++ fprintf(stderr, "DEBUG: cupsRowFeed = %d\n", header->cupsRowFeed); ++ fprintf(stderr, "DEBUG: cupsRowStep = %d\n", header->cupsRowStep); ++ ++ /* ++ * Set the resolution and Media Type ++ */ ++ ++ if (header->HWResolution[0] != header->HWResolution[1]) ++ snprintf(resolution, sizeof(resolution), "%dx%ddpi", ++ header->HWResolution[0], header->HWResolution[1]); ++ else ++ snprintf(resolution, sizeof(resolution), "%ddpi", ++ header->HWResolution[0]); ++ ++ if (!header->MediaType[0]) ++ strcpy(header->MediaType, "Plain"); ++ ++ fprintf(stderr, "DEBUG: MediaType = %s\n", header->MediaType); ++ fprintf(stderr, "DEBUG: Resolution = %s\n", resolution); ++ ++ if (!SpeedSet) ++ { ++ cupsWritePrintData("\033_X\015M",5); ++ if (strcmp(header->MediaType, "PrintrexRoll") == 0) ++ { ++ cupsWritePrintData(modulation[0],12); ++ fprintf(stderr, "DEBUG: Setting Roll\n"); ++ } ++ else if (strcmp(header->MediaType, "Heavyweight") == 0) ++ { ++ cupsWritePrintData(modulation[1],12); ++ fprintf(stderr, "DEBUG: Setting Heavyweight\n"); ++ } ++ ++ // If not 1, it's gray scale. Set the speed, Sat, and White level ++ // according to the media selected. ++ if (header->cupsBitsPerPixel != 1) ++ { ++ cupsWritePrintData("\033_X\005Q",5); ++ putchar(17); ++ cupsWritePrintData("\377\200\377",3); ++ if (strcmp(header->MediaType, "PrintrexRoll") == 0) ++ cupsWritePrintData("\033_P\340\000\000",6); ++ else if (strcmp(header->MediaType, "Heavyweight") == 0) ++ cupsWritePrintData("\033_P\300\020\000",6); ++ } ++ else ++ { ++ if (strcmp(header->OutputType, "1ips") == 0) ++ { ++ fprintf(stderr,"DEBUG: Going 1ips\n"); ++ cupsWritePrintData("\033_X\005Q",5); ++ putchar(25); ++ cupsWritePrintData("\377\200\377",3); ++ } ++ else if (strcmp(header->OutputType, "2ips") == 0) ++ { ++ cupsWritePrintData("\033_X\005Q",5); ++ putchar(50); ++ cupsWritePrintData("\377\200\377",3); ++ fprintf(stderr, "DEBUG: Going 2ips\n"); ++ } ++ else if (strcmp(header->OutputType, "3ips") == 0) ++ { ++ cupsWritePrintData("\033_X\005Q",5); ++ putchar(75); ++ cupsWritePrintData("\377\200\377",3); ++ fprintf(stderr, "DEBUG: Going 3ips\n"); ++ } ++ else if (strcmp(header->OutputType, "4ips") == 0) ++ { ++ cupsWritePrintData("\033_X\005Q",5); ++ putchar(100); ++ cupsWritePrintData("\377\200\377",3); ++ fprintf(stderr, "DEBUG: Going 4ips\n"); ++ } ++ strcpy(intensitystr, header->MediaClass); ++ sscanf(intensitystr,"%d",&intensity); ++ fprintf(stderr,"DEBUG: Intensity is %d\n", intensity); ++ ++ cupsWritePrintData("\033_P",3); ++ putchar(intensity & 0xFF); ++ putchar(0); ++ putchar(0); ++ } ++ SpeedSet = 1; ++ } ++ ++ PixelBuffer = malloc(header->cupsBytesPerLine + 20); ++ CompBuffer = malloc(header->cupsBytesPerLine + 20); ++} ++ ++ ++/* ++ * 'EndPage()' - Finish a page of graphics. ++ */ ++ ++void EndPage(ppd_file_t *ppd, /* I - PPD file */ ++ cups_page_header_t *header) /* I - Page header */ ++{ ++ free(PixelBuffer); ++ free(CompBuffer); ++} ++ ++ ++/* ++ * 'Shutdown()' - Shutdown a printer. ++ */ ++ ++void Shutdown(ppd_file_t *ppd) /* I - PPD file */ ++{ ++ /* ++ * Reset the printer... ++ */ ++ ++ printf("\032"); ++} ++ ++/* ++ * 'CompressData()' - Compress a line of graphics. ++ */ ++ ++void CompressData(ppd_file_t *ppd, /* I - PPD file information */ ++ const unsigned char *line, /* I - Data to compress */ ++ const int length,/* I - Number of bytes */ ++ int type, /* I - Type of compression */ ++ int bits) /* I - Bits Per Pixel */ ++{ ++ register const unsigned char *line_ptr, ++ /* Current byte pointer */ ++ *line_end, /* End-of-line byte pointer */ ++ *start; /* Start of compression sequence */ ++ register unsigned char *comp_ptr; /* Pointer into compression buffer */ ++ register int count; /* Count of bytes for output */ ++ register int bytes; /* Number of bytes per row */ ++ ++ ++ switch (type) ++ { ++ case 0 : ++ /* ++ * Do no compression... ++ */ ++ ++ line_ptr = (const unsigned char *)line; ++ line_end = (const unsigned char *)line + length; ++ bytes = 216; ++ memcpy(CompBuffer, PixelBuffer, bytes); ++ break; ++ ++ default : ++ /* ++ * Do TIFF pack-bits encoding... ++ */ ++ ++ line_ptr = (const unsigned char *)line; ++ line_end = (const unsigned char *)line + length; ++ comp_ptr = (unsigned char*)CompBuffer; ++ ++ while (line_ptr < line_end && (comp_ptr - CompBuffer) < length) ++ { ++ if ((line_ptr + 1) >= line_end) ++ { ++ /* ++ * Single byte on the end... ++ */ ++ ++ *comp_ptr++ = 0x00; ++ *comp_ptr++ = *line_ptr++; ++ } ++ else if (line_ptr[0] == line_ptr[1]) ++ { ++ /* ++ * Repeated sequence... ++ */ ++ ++ line_ptr ++; ++ count = 2; ++ ++ while (line_ptr < (line_end - 1) && ++ line_ptr[0] == line_ptr[1] && ++ count < 127) ++ { ++ line_ptr ++; ++ count ++; ++ } ++ ++ *comp_ptr++ = 257 - count; ++ *comp_ptr++ = *line_ptr++; ++ } ++ else ++ { ++ /* ++ * Non-repeated sequence... ++ */ ++ ++ start = line_ptr; ++ line_ptr ++; ++ count = 1; ++ ++ while (line_ptr < (line_end - 1) && ++ line_ptr[0] != line_ptr[1] && ++ count < 127) ++ { ++ line_ptr ++; ++ count ++; ++ } ++ ++ *comp_ptr++ = count - 1; ++ ++ memcpy(comp_ptr, start, count); ++ comp_ptr += count; ++ } ++ } ++ line_end = comp_ptr; ++ bytes = comp_ptr - CompBuffer; ++ } ++ ++ /* ++ * Send the graphics... ++ */ ++ ++ if (type == 0) ++ cupsWritePrintData("\033Z\001\000",4); ++ else ++ { ++ cupsWritePrintData("\033_R\001",4); ++ putchar(bits); ++ putchar(bytes >> 8); ++ putchar(bytes & 0xFF); ++ } ++ ++ cupsWritePrintData(CompBuffer, bytes); ++} ++ ++/* ++ * 'ProcessLine()' - Read graphics from the page stream and output as needed. ++ */ ++ ++void ProcessLine(ppd_file_t *ppd, /* I - PPD file */ ++ cups_raster_t *ras, /* I - Raster stream */ ++ cups_page_header_t *header) /* I - Page header */ ++{ ++ ++ /* ++ * Read a row of graphics... ++ */ ++ ++ if (!cupsRasterReadPixels(ras, PixelBuffer, header->cupsBytesPerLine)) ++ return; ++ ++ CompressData(ppd, PixelBuffer, header->cupsBytesPerLine, header->cupsCompression, ++ header->cupsBitsPerPixel); ++ fflush(stdout); ++ ++ OutputFeed ++; ++} ++ ++ ++/* ++ * 'main()' - Main entry and processing of driver. ++ */ ++ ++ /* O - Exit status */ ++int main(int argc, /* I - Number of command-line arguments */ ++ char *argv[]) /* I - Command-line arguments */ ++{ ++ int fd; /* File descriptor */ ++ cups_raster_t *ras; /* Raster stream for printing */ ++ cups_page_header_t header; /* Page header from file */ ++ int page; /* Current page */ ++ int y; /* Current line */ ++ ppd_file_t *ppd; /* PPD file */ ++ int num_options; /* Number of options */ ++ cups_option_t *options; /* Options */ ++ ++ ++ /* ++ * Make sure status messages are not buffered... ++ */ ++ ++ fputs("DEBUG: Got here\n", stderr); ++ setbuf(stderr, NULL); ++ ++ /* ++ * Check command-line... ++ */ ++ ++ if (argc < 6 || argc > 7) ++ { ++ fputs("ERROR: rastertoprx40 job-id user title copies options [file]\n", stderr); ++ return (1); ++ } ++ ++ num_options = cupsParseOptions(argv[5], 0, &options); ++ ++ /* ++ * Open the PPD file... ++ */ ++ ++ ppd = ppdOpenFile(getenv("PPD")); ++ ++ if (!ppd) ++ { ++ fputs("ERROR: Unable to open PPD file!\n", stderr); ++ return (1); ++ } ++ ++ ppdMarkDefaults(ppd); ++ cupsMarkOptions(ppd, num_options, options); ++ ++ /* ++ * Open the page stream... ++ */ ++ ++ if (argc == 7) ++ { ++ if ((fd = open(argv[6], O_RDONLY)) == -1) ++ { ++ perror("ERROR: Unable to open raster file - "); ++ return (1); ++ } ++ } ++ else ++ fd = 0; ++ ++ ras = cupsRasterOpen(fd, CUPS_RASTER_READ); ++ ++ /* ++ * Initialize the print device... ++ */ ++ ++ Setup(ppd); ++ ++ /* ++ * Process pages as needed... ++ */ ++ ++ page = 0; ++ ++ while (cupsRasterReadHeader(ras, &header)) ++ { ++ page ++; ++ ++ fprintf(stderr, "PAGE: %d 1\n", page); ++ fprintf(stderr, "INFO: Starting page %d...\n", page); ++ ++ StartPage(ppd, &header); ++ ++ fprintf(stderr,"DEBUG: Now printing %d rasters\n\r",header.cupsHeight); ++ for (y = 0; y < header.cupsHeight; y ++) ++ { ++ if ((y & 127) == 0) ++ fprintf(stderr, "INFO: Printing page %d, %d%% complete...\n", page, ++ 100 * y / header.cupsHeight); ++ ++ ProcessLine(ppd, ras, &header); ++ } ++ ++ fprintf(stderr, "INFO: Finished page %d...\n", page); ++ ++ EndPage(ppd, &header); ++ if (header.AdvanceDistance == 2) ++ printf("%c",11); ++ else if (header.AdvanceDistance == 3) ++ printf("%c",12); ++ } ++ ++ Shutdown(ppd); ++ ++ cupsRasterClose(ras); ++ ++ if (fd != 0) ++ close(fd); ++ ++ if (page == 0) ++ { ++ fputs("ERROR: No pages found!\n", stderr); ++ return (1); ++ } ++ else ++ { ++ fputs("INFO: Ready to print.\n", stderr); ++ return (0); ++ } ++} ++ ++ +Index: cups-1.3.9/filter/rastertoprx42.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ cups-1.3.9/filter/rastertoprx42.c 2014-02-25 16:36:17.097182556 +0000 +@@ -0,0 +1,530 @@ ++/* ++ * Printrex 842 raster driver for CUPS. ++ * Revision ++ * 1 Initial release. ++ * ++ * Copyright 2007 by Apple Inc. ++ * Copyright 1993-2005 by Easy Software Products. ++ * Copyright 2009 by Printrex, Inc. ++ * ++ * These coded instructions, statements, and computer programs are the ++ * property of Apple Inc. and are protected by Federal copyright ++ * law. Distribution and use rights are outlined in the file "LICENSE.txt" ++ * which should have been included with this file. If this file is ++ * file is missing or damaged, see the license at "http://www.cups.org/". ++ * ++ * Contents: ++ * ++ * Setup() - Prepare the printer for graphics output. ++ * StartPage() - Start a page of graphics. ++ * EndPage() - Finish a page of graphics. ++ * Shutdown() - Shutdown a printer. ++ * CompressData() - Compress a line of graphics. ++ * ProcessLine() - Read graphics from the page stream and output ++ * as needed. ++ * main() - Main entry and processing of driver. ++ */ ++ ++/* ++ This code uses PPD parameters in the following way: ++ cupsCompression - 1 is grayscale. 0 is Bimodal. Speed set to 19mm/s in grayscale ++ cupsBytesPerLine - Used to allocate the PixelBuffer memory, and avoid buffer ++ overrun. ++*/ ++/* ++ * Include necessary headers... ++ */ ++ ++#include "string.h" ++#include ++#include ++#include "raster.h" ++#include ++#include ++#include ++ ++#define cupsWritePrintData(s,n) (fwrite((s),1,(n),stdout)) ++ ++/* ++ * Globals... ++ */ ++ ++unsigned char *PixelBuffer, /* Pixel buffer */ ++ *CompBuffer; /* Compression buffer */ ++int OutputFeed; /* Number of lines to skip */ ++int SpeedSet; /* Flag to indicate the speed has been set */ ++ ++/* ++ * Prototypes... ++ */ ++ ++void Setup(ppd_file_t *in); ++void StartPage(ppd_file_t *in, cups_page_header_t *); ++void EndPage(ppd_file_t *, cups_page_header_t *); ++void Shutdown(ppd_file_t *); ++ ++void CompressData(ppd_file_t *, const unsigned char *, const int, ++ int, int); ++void ProcessLine(ppd_file_t *, cups_raster_t *, ++ cups_page_header_t *); ++ ++/* ++ * 'Setup()' - Set the printer up for printing this job. ++ */ ++ ++void ++Setup(ppd_file_t *ppd) /* I - PPD file */ ++{ ++ SpeedSet = 0; ++} ++ ++ ++/* ++ * 'StartPage()' - Start a page of graphics. ++ */ ++ ++const unsigned char modulation[2][12] = ++{ ++ {25, 0, 55, 2, 198, 40, 0, 45, 2, 78, 136, 224}, ++ {25, 0, 75, 4, 206, 40, 0, 42, 2, 213, 103, 224} ++}; ++ ++void StartPage(ppd_file_t *ppd, /* I - PPD file */ ++ cups_page_header_t *header) /* I - Page header */ ++{ ++ signed char resolution[PPD_MAX_NAME]; /* Resolution string */ ++ signed char intensitystr[10]; /* Used for calculating intensity */ ++ int intensity; ++ ++ fprintf(stderr, "DEBUG: StartPage...\n"); ++ fprintf(stderr, "DEBUG: MediaClass = \"%s\"\n", header->MediaClass); ++ fprintf(stderr, "DEBUG: MediaColor = \"%s\"\n", header->MediaColor); ++ fprintf(stderr, "DEBUG: MediaType = \"%s\"\n", header->MediaType); ++ fprintf(stderr, "DEBUG: OutputType = \"%s\"\n", header->OutputType); ++ ++ fprintf(stderr, "DEBUG: AdvanceDistance = %d\n", header->AdvanceDistance); ++ fprintf(stderr, "DEBUG: AdvanceMedia = %d\n", header->AdvanceMedia); ++ fprintf(stderr, "DEBUG: Collate = %d\n", header->Collate); ++ fprintf(stderr, "DEBUG: CutMedia = %d\n", header->CutMedia); ++ fprintf(stderr, "DEBUG: Duplex = %d\n", header->Duplex); ++ fprintf(stderr, "DEBUG: HWResolution = [ %d %d ]\n", header->HWResolution[0], ++ header->HWResolution[1]); ++ fprintf(stderr, "DEBUG: ImagingBoundingBox = [ %d %d %d %d ]\n", ++ header->ImagingBoundingBox[0], header->ImagingBoundingBox[1], ++ header->ImagingBoundingBox[2], header->ImagingBoundingBox[3]); ++ fprintf(stderr, "DEBUG: InsertSheet = %d\n", header->InsertSheet); ++ fprintf(stderr, "DEBUG: Jog = %d\n", header->Jog); ++ fprintf(stderr, "DEBUG: LeadingEdge = %d\n", header->LeadingEdge); ++ fprintf(stderr, "DEBUG: Margins = [ %d %d ]\n", header->Margins[0], ++ header->Margins[1]); ++ fprintf(stderr, "DEBUG: ManualFeed = %d\n", header->ManualFeed); ++ fprintf(stderr, "DEBUG: MediaPosition = %d\n", header->MediaPosition); ++ fprintf(stderr, "DEBUG: MediaWeight = %d\n", header->MediaWeight); ++ fprintf(stderr, "DEBUG: MirrorPrint = %d\n", header->MirrorPrint); ++ fprintf(stderr, "DEBUG: NegativePrint = %d\n", header->NegativePrint); ++ fprintf(stderr, "DEBUG: NumCopies = %d\n", header->NumCopies); ++ fprintf(stderr, "DEBUG: Orientation = %d\n", header->Orientation); ++ fprintf(stderr, "DEBUG: OutputFaceUp = %d\n", header->OutputFaceUp); ++ fprintf(stderr, "DEBUG: PageSize = [ %d %d ]\n", header->PageSize[0], ++ header->PageSize[1]); ++ fprintf(stderr, "DEBUG: Separations = %d\n", header->Separations); ++ fprintf(stderr, "DEBUG: TraySwitch = %d\n", header->TraySwitch); ++ fprintf(stderr, "DEBUG: Tumble = %d\n", header->Tumble); ++ fprintf(stderr, "DEBUG: cupsWidth = %d\n", header->cupsWidth); ++ fprintf(stderr, "DEBUG: cupsHeight = %d\n", header->cupsHeight); ++ fprintf(stderr, "DEBUG: cupsMediaType = %d\n", header->cupsMediaType); ++ fprintf(stderr, "DEBUG: cupsBitsPerColor = %d\n", header->cupsBitsPerColor); ++ fprintf(stderr, "DEBUG: cupsBitsPerPixel = %d\n", header->cupsBitsPerPixel); ++ fprintf(stderr, "DEBUG: cupsBytesPerLine = %d\n", header->cupsBytesPerLine); ++ fprintf(stderr, "DEBUG: cupsColorOrder = %d\n", header->cupsColorOrder); ++ fprintf(stderr, "DEBUG: cupsColorSpace = %d\n", header->cupsColorSpace); ++ fprintf(stderr, "DEBUG: cupsCompression = %d\n", header->cupsCompression); ++ fprintf(stderr, "DEBUG: cupsRowCount = %d\n", header->cupsRowCount); ++ fprintf(stderr, "DEBUG: cupsRowFeed = %d\n", header->cupsRowFeed); ++ fprintf(stderr, "DEBUG: cupsRowStep = %d\n", header->cupsRowStep); ++ ++ /* ++ * Set the resolution and Media Type ++ */ ++ ++ if (header->HWResolution[0] != header->HWResolution[1]) ++ snprintf(resolution, sizeof(resolution), "%dx%ddpi", ++ header->HWResolution[0], header->HWResolution[1]); ++ else ++ snprintf(resolution, sizeof(resolution), "%ddpi", ++ header->HWResolution[0]); ++ ++ if (!header->MediaType[0]) ++ strcpy(header->MediaType, "Plain"); ++ ++ fprintf(stderr, "DEBUG: MediaType = %s\n", header->MediaType); ++ fprintf(stderr, "DEBUG: Resolution = %s\n", resolution); ++ ++ if (!SpeedSet) ++ { ++ cupsWritePrintData("\033_X\015M",5); ++ if (strcmp(header->MediaType, "PrintrexRoll") == 0) ++ { ++ cupsWritePrintData(modulation[0],12); ++ fprintf(stderr, "DEBUG: Setting Roll\n"); ++ } ++ else if (strcmp(header->MediaType, "Heavyweight") == 0) ++ { ++ cupsWritePrintData(modulation[1],12); ++ fprintf(stderr, "DEBUG: Setting Heavyweight\n"); ++ } ++ ++ // If not 1, it's gray scale. Set the speed, Sat, and White level ++ // according to the media selected. ++ if (header->cupsBitsPerPixel != 1) ++ { ++ cupsWritePrintData("\033_X\005Q",5); ++ putchar(17); ++ cupsWritePrintData("\377\200\377",3); ++ if (strcmp(header->MediaType, "PrintrexRoll") == 0) ++ cupsWritePrintData("\033_P\340\000\000",6); ++ else if (strcmp(header->MediaType, "Heavyweight") == 0) ++ cupsWritePrintData("\033_P\300\020\000",6); ++ } ++ else ++ { ++ if (strcmp(header->OutputType, "1ips") == 0) ++ { ++ fprintf(stderr,"DEBUG: Going 1ips\n"); ++ cupsWritePrintData("\033_X\005Q",5); ++ putchar(25); ++ cupsWritePrintData("\377\200\377",3); ++ } ++ else if (strcmp(header->OutputType, "2ips") == 0) ++ { ++ cupsWritePrintData("\033_X\005Q",5); ++ putchar(50); ++ cupsWritePrintData("\377\200\377",3); ++ fprintf(stderr, "DEBUG: Going 2ips\n"); ++ } ++ else if (strcmp(header->OutputType, "3ips") == 0) ++ { ++ cupsWritePrintData("\033_X\005Q",5); ++ putchar(75); ++ cupsWritePrintData("\377\200\377",3); ++ fprintf(stderr, "DEBUG: Going 3ips\n"); ++ } ++ else if (strcmp(header->OutputType, "4ips") == 0) ++ { ++ cupsWritePrintData("\033_X\005Q",5); ++ putchar(100); ++ cupsWritePrintData("\377\200\377",3); ++ fprintf(stderr, "DEBUG: Going 4ips\n"); ++ } ++ strcpy(intensitystr, header->MediaClass); ++ sscanf(intensitystr,"%d",&intensity); ++ fprintf(stderr,"DEBUG: Intensity is %d\n", intensity); ++ ++ cupsWritePrintData("\033_P",3); ++ putchar(intensity & 0xFF); ++ putchar(0); ++ putchar(0); ++ } ++ SpeedSet = 1; ++ } ++ ++ PixelBuffer = malloc(header->cupsBytesPerLine + 20); ++ CompBuffer = malloc(header->cupsBytesPerLine + 20); ++} ++ ++ ++/* ++ * 'EndPage()' - Finish a page of graphics. ++ */ ++ ++void EndPage(ppd_file_t *ppd, /* I - PPD file */ ++ cups_page_header_t *header) /* I - Page header */ ++{ ++ free(PixelBuffer); ++ free(CompBuffer); ++} ++ ++ ++/* ++ * 'Shutdown()' - Shutdown a printer. ++ */ ++ ++void Shutdown(ppd_file_t *ppd) /* I - PPD file */ ++{ ++ /* ++ * Reset the printer... ++ */ ++ ++ printf("\032"); ++} ++ ++/* ++ * 'CompressData()' - Compress a line of graphics. ++ */ ++ ++void CompressData(ppd_file_t *ppd, /* I - PPD file information */ ++ const unsigned char *line, /* I - Data to compress */ ++ const int length,/* I - Number of bytes */ ++ int type, /* I - Type of compression */ ++ int bits) /* I - Bits Per Pixel */ ++{ ++ register const unsigned char *line_ptr, ++ /* Current byte pointer */ ++ *line_end, /* End-of-line byte pointer */ ++ *start; /* Start of compression sequence */ ++ register unsigned char *comp_ptr; /* Pointer into compression buffer */ ++ register int count; /* Count of bytes for output */ ++ register int bytes; /* Number of bytes per row */ ++ ++ ++ switch (type) ++ { ++ case 0 : ++ /* ++ * Do no compression... ++ */ ++ ++ line_ptr = (const unsigned char *)line; ++ line_end = (const unsigned char *)line + length; ++ bytes = 216; ++ memcpy(CompBuffer, PixelBuffer, bytes); ++ break; ++ ++ default : ++ /* ++ * Do TIFF pack-bits encoding... ++ */ ++ ++ line_ptr = (const unsigned char *)line; ++ line_end = (const unsigned char *)line + length; ++ comp_ptr = (unsigned char*)CompBuffer; ++ ++ while (line_ptr < line_end && (comp_ptr - CompBuffer) < length) ++ { ++ if ((line_ptr + 1) >= line_end) ++ { ++ /* ++ * Single byte on the end... ++ */ ++ ++ *comp_ptr++ = 0x00; ++ *comp_ptr++ = *line_ptr++; ++ } ++ else if (line_ptr[0] == line_ptr[1]) ++ { ++ /* ++ * Repeated sequence... ++ */ ++ ++ line_ptr ++; ++ count = 2; ++ ++ while (line_ptr < (line_end - 1) && ++ line_ptr[0] == line_ptr[1] && ++ count < 127) ++ { ++ line_ptr ++; ++ count ++; ++ } ++ ++ *comp_ptr++ = 257 - count; ++ *comp_ptr++ = *line_ptr++; ++ } ++ else ++ { ++ /* ++ * Non-repeated sequence... ++ */ ++ ++ start = line_ptr; ++ line_ptr ++; ++ count = 1; ++ ++ while (line_ptr < (line_end - 1) && ++ line_ptr[0] != line_ptr[1] && ++ count < 127) ++ { ++ line_ptr ++; ++ count ++; ++ } ++ ++ *comp_ptr++ = count - 1; ++ ++ memcpy(comp_ptr, start, count); ++ comp_ptr += count; ++ } ++ } ++ line_end = comp_ptr; ++ bytes = comp_ptr - CompBuffer; ++ } ++ ++ /* ++ * Send the graphics... ++ */ ++ ++ if (type == 0) ++ cupsWritePrintData("\033Z\001\000",4); ++ else ++ { ++ cupsWritePrintData("\033_R\001",4); ++ putchar(bits); ++ putchar(bytes >> 8); ++ putchar(bytes & 0xFF); ++ } ++ ++ cupsWritePrintData(CompBuffer, bytes); ++} ++ ++/* ++ * 'ProcessLine()' - Read graphics from the page stream and output as needed. ++ */ ++ ++void ProcessLine(ppd_file_t *ppd, /* I - PPD file */ ++ cups_raster_t *ras, /* I - Raster stream */ ++ cups_page_header_t *header) /* I - Page header */ ++{ ++ ++ /* ++ * Read a row of graphics... ++ */ ++ ++ if (!cupsRasterReadPixels(ras, PixelBuffer, header->cupsBytesPerLine)) ++ return; ++ ++ CompressData(ppd, PixelBuffer, header->cupsBytesPerLine, header->cupsCompression, ++ header->cupsBitsPerPixel); ++ fflush(stdout); ++ ++ OutputFeed ++; ++} ++ ++ ++/* ++ * 'main()' - Main entry and processing of driver. ++ */ ++ ++ /* O - Exit status */ ++int main(int argc, /* I - Number of command-line arguments */ ++ char *argv[]) /* I - Command-line arguments */ ++{ ++ int fd; /* File descriptor */ ++ cups_raster_t *ras; /* Raster stream for printing */ ++ cups_page_header_t header; /* Page header from file */ ++ int page; /* Current page */ ++ int y; /* Current line */ ++ ppd_file_t *ppd; /* PPD file */ ++ int num_options; /* Number of options */ ++ cups_option_t *options; /* Options */ ++ ++ ++ /* ++ * Make sure status messages are not buffered... ++ */ ++ ++ fputs("DEBUG: Got here\n", stderr); ++ setbuf(stderr, NULL); ++ ++ /* ++ * Check command-line... ++ */ ++ ++ if (argc < 6 || argc > 7) ++ { ++ fputs("ERROR: rastertoprx42 job-id user title copies options [file]\n", stderr); ++ return (1); ++ } ++ ++ num_options = cupsParseOptions(argv[5], 0, &options); ++ ++ /* ++ * Open the PPD file... ++ */ ++ ++ ppd = ppdOpenFile(getenv("PPD")); ++ ++ if (!ppd) ++ { ++ fputs("ERROR: Unable to open PPD file!\n", stderr); ++ return (1); ++ } ++ ++ ppdMarkDefaults(ppd); ++ cupsMarkOptions(ppd, num_options, options); ++ ++ /* ++ * Open the page stream... ++ */ ++ ++ if (argc == 7) ++ { ++ if ((fd = open(argv[6], O_RDONLY)) == -1) ++ { ++ perror("ERROR: Unable to open raster file - "); ++ return (1); ++ } ++ } ++ else ++ fd = 0; ++ ++ ras = cupsRasterOpen(fd, CUPS_RASTER_READ); ++ ++ /* ++ * Initialize the print device... ++ */ ++ ++ Setup(ppd); ++ ++ /* ++ * Process pages as needed... ++ */ ++ ++ page = 0; ++ ++ while (cupsRasterReadHeader(ras, &header)) ++ { ++ page ++; ++ ++ fprintf(stderr, "PAGE: %d 1\n", page); ++ fprintf(stderr, "INFO: Starting page %d...\n", page); ++ ++ StartPage(ppd, &header); ++ ++ fprintf(stderr,"DEBUG: Now printing %d rasters\n\r",header.cupsHeight); ++ for (y = 0; y < header.cupsHeight; y ++) ++ { ++ if ((y & 127) == 0) ++ fprintf(stderr, "INFO: Printing page %d, %d%% complete...\n", page, ++ 100 * y / header.cupsHeight); ++ ++ ProcessLine(ppd, ras, &header); ++ } ++ ++ fprintf(stderr, "INFO: Finished page %d...\n", page); ++ ++ EndPage(ppd, &header); ++ if (header.AdvanceDistance == 2) ++ printf("%c",11); ++ else if (header.AdvanceDistance == 3) ++ printf("%c",12); ++ } ++ ++ Shutdown(ppd); ++ ++ cupsRasterClose(ras); ++ ++ if (fd != 0) ++ close(fd); ++ ++ if (page == 0) ++ { ++ fputs("ERROR: No pages found!\n", stderr); ++ return (1); ++ } ++ else ++ { ++ fputs("INFO: Ready to print.\n", stderr); ++ return (0); ++ } ++} ++ ++ +Index: cups-1.3.9/filter/rastertoprx43.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ cups-1.3.9/filter/rastertoprx43.c 2014-02-25 16:41:26.933266538 +0000 +@@ -0,0 +1,526 @@ ++/* ++ * Printrex raster driver for CUPS. ++ * Revision ++ * 1 Initial release ++ * ++ * Copyright 2007 by Apple Inc. ++ * Copyright 1993-2005 by Easy Software Products. ++ * Copyright 2009 by Printrex Inc. ++ * ++ * These coded instructions, statements, and computer programs are the ++ * property of Apple Inc. and are protected by Federal copyright ++ * law. Distribution and use rights are outlined in the file "LICENSE.txt" ++ * which should have been included with this file. If this file is ++ * file is missing or damaged, see the license at "http://www.cups.org/". ++ * ++ * Contents: ++ * ++ * Setup() - Prepare the printer for graphics output. ++ * StartPage() - Start a page of graphics. ++ * EndPage() - Finish a page of graphics. ++ * Shutdown() - Shutdown a printer. ++ * CompressData() - Compress a line of graphics. ++ * ProcessLine() - Read graphics from the page stream and output ++ * as needed. ++ * main() - Main entry and processing of driver. ++ */ ++ ++/* ++ This code uses PPD parameters in the following way: ++ cupsCompression - 1 is grayscale. 0 is Bimodal. Speed set to 19mm/s in grayscale ++ cupsBytesPerLine - Used to allocate the PixelBuffer memory, and avoid buffer ++ overrun. ++*/ ++/* ++ * Include necessary headers... ++ */ ++ ++#include "string.h" ++#include ++#include ++#include "raster.h" ++#include ++#include ++#include ++ ++#define cupsWritePrintData(s,n) (fwrite((s),1,(n),stdout)) ++ ++/* ++ * Globals... ++ */ ++ ++unsigned char *PixelBuffer, /* Pixel buffer */ ++ *CompBuffer; /* Compression buffer */ ++ ++int OutputFeed; /* Number of lines to skip */ ++int SpeedSet; /* Flag to indicate the speed has been set */ ++ ++/* ++ * Prototypes... ++ */ ++ ++void Setup(ppd_file_t *); ++void StartPage(ppd_file_t *, cups_page_header_t *); ++void EndPage(ppd_file_t *, cups_page_header_t *); ++void Shutdown(ppd_file_t *); ++ ++void CompressData(ppd_file_t *, const unsigned char *, const int, ++ int, int); ++void ProcessLine(ppd_file_t *, cups_raster_t *, ++ cups_page_header_t *); ++ ++/* ++ * 'Setup()' - Set the printer up for printing this job. ++ */ ++ ++void Setup(ppd_file_t *ppd) /* I - PPD file */ ++{ ++ SpeedSet = 0; ++} ++ ++/* ++ * 'StartPage()' - Start a page of graphics. ++ */ ++ ++const unsigned char modulation[2][13] = ++{ ++ {25, 0, 42, 2, 38, 40, 0, 35, 1, 194, 170, 224,'3'}, ++ {25, 0, 75, 4, 206, 40, 0, 42, 2, 234, 103, 224,'3'} ++}; ++ ++void StartPage(ppd_file_t *ppd, /* I - PPD file */ ++ cups_page_header_t *header) /* I - Page header */ ++{ ++ char resolution[PPD_MAX_NAME]; /* Resolution string */ ++ char intensitystr[10]; /* Used for calculating intensity */ ++ int intensity; ++ ++ fprintf(stderr, "DEBUG: StartPage...\n"); ++ fprintf(stderr, "DEBUG: MediaClass = \"%s\"\n", header->MediaClass); ++ fprintf(stderr, "DEBUG: MediaColor = \"%s\"\n", header->MediaColor); ++ fprintf(stderr, "DEBUG: MediaType = \"%s\"\n", header->MediaType); ++ fprintf(stderr, "DEBUG: OutputType = \"%s\"\n", header->OutputType); ++ ++ fprintf(stderr, "DEBUG: AdvanceDistance = %d\n", header->AdvanceDistance); ++ fprintf(stderr, "DEBUG: AdvanceMedia = %d\n", header->AdvanceMedia); ++ fprintf(stderr, "DEBUG: Collate = %d\n", header->Collate); ++ fprintf(stderr, "DEBUG: CutMedia = %d\n", header->CutMedia); ++ fprintf(stderr, "DEBUG: Duplex = %d\n", header->Duplex); ++ fprintf(stderr, "DEBUG: HWResolution = [ %d %d ]\n", header->HWResolution[0], ++ header->HWResolution[1]); ++ fprintf(stderr, "DEBUG: ImagingBoundingBox = [ %d %d %d %d ]\n", ++ header->ImagingBoundingBox[0], header->ImagingBoundingBox[1], ++ header->ImagingBoundingBox[2], header->ImagingBoundingBox[3]); ++ fprintf(stderr, "DEBUG: InsertSheet = %d\n", header->InsertSheet); ++ fprintf(stderr, "DEBUG: Jog = %d\n", header->Jog); ++ fprintf(stderr, "DEBUG: LeadingEdge = %d\n", header->LeadingEdge); ++ fprintf(stderr, "DEBUG: Margins = [ %d %d ]\n", header->Margins[0], ++ header->Margins[1]); ++ fprintf(stderr, "DEBUG: ManualFeed = %d\n", header->ManualFeed); ++ fprintf(stderr, "DEBUG: MediaPosition = %d\n", header->MediaPosition); ++ fprintf(stderr, "DEBUG: MediaWeight = %d\n", header->MediaWeight); ++ fprintf(stderr, "DEBUG: MirrorPrint = %d\n", header->MirrorPrint); ++ fprintf(stderr, "DEBUG: NegativePrint = %d\n", header->NegativePrint); ++ fprintf(stderr, "DEBUG: NumCopies = %d\n", header->NumCopies); ++ fprintf(stderr, "DEBUG: Orientation = %d\n", header->Orientation); ++ fprintf(stderr, "DEBUG: OutputFaceUp = %d\n", header->OutputFaceUp); ++ fprintf(stderr, "DEBUG: PageSize = [ %d %d ]\n", header->PageSize[0], ++ header->PageSize[1]); ++ fprintf(stderr, "DEBUG: Separations = %d\n", header->Separations); ++ fprintf(stderr, "DEBUG: TraySwitch = %d\n", header->TraySwitch); ++ fprintf(stderr, "DEBUG: Tumble = %d\n", header->Tumble); ++ fprintf(stderr, "DEBUG: cupsWidth = %d\n", header->cupsWidth); ++ fprintf(stderr, "DEBUG: cupsHeight = %d\n", header->cupsHeight); ++ fprintf(stderr, "DEBUG: cupsMediaType = %d\n", header->cupsMediaType); ++ fprintf(stderr, "DEBUG: cupsBitsPerColor = %d\n", header->cupsBitsPerColor); ++ fprintf(stderr, "DEBUG: cupsBitsPerPixel = %d\n", header->cupsBitsPerPixel); ++ fprintf(stderr, "DEBUG: cupsBytesPerLine = %d\n", header->cupsBytesPerLine); ++ fprintf(stderr, "DEBUG: cupsColorOrder = %d\n", header->cupsColorOrder); ++ fprintf(stderr, "DEBUG: cupsColorSpace = %d\n", header->cupsColorSpace); ++ fprintf(stderr, "DEBUG: cupsCompression = %d\n", header->cupsCompression); ++ fprintf(stderr, "DEBUG: cupsRowCount = %d\n", header->cupsRowCount); ++ fprintf(stderr, "DEBUG: cupsRowFeed = %d\n", header->cupsRowFeed); ++ fprintf(stderr, "DEBUG: cupsRowStep = %d\n", header->cupsRowStep); ++ ++ /* ++ * Create resolution and set Media type. ++ */ ++ ++ if (header->HWResolution[0] != header->HWResolution[1]) ++ snprintf(resolution, sizeof(resolution), "%dx%ddpi", ++ header->HWResolution[0], header->HWResolution[1]); ++ else ++ snprintf(resolution, sizeof(resolution), "%ddpi", ++ header->HWResolution[0]); ++ ++ if (!header->MediaType[0]) ++ strcpy(header->MediaType, "Plain"); ++ ++ fprintf(stderr, "DEBUG: MediaType = %s\n", header->MediaType); ++ fprintf(stderr, "DEBUG: Resolution = %s\n", resolution); ++ ++ if (!SpeedSet) ++ { ++ cupsWritePrintData("\033_X\016M",5); ++ if (strcmp(header->MediaType, "PrintrexRoll") == 0) ++ { ++ cupsWritePrintData(modulation[0],13); ++ fprintf(stderr, "DEBUG: Setting Roll\n"); ++ } ++ else if (strcmp(header->MediaType, "Heavyweight") == 0) ++ { ++ cupsWritePrintData(modulation[1],13); ++ fprintf(stderr, "DEBUG: Setting Heavyweight\n"); ++ } ++ ++ // If not 1, it's gray scale. Set the speed, Sat, and White level ++ // according to the media selected. ++ if (header->cupsBitsPerPixel != 1) ++ { ++ cupsWritePrintData("\033_X\005Q",5); ++ putchar(20); ++ cupsWritePrintData("\377\200\377",3); ++ if (strcmp(header->MediaType, "PrintrexRoll") == 0) ++ cupsWritePrintData("\033_P\340\000\000",6); ++ else if (strcmp(header->MediaType, "Heavyweight") == 0) ++ cupsWritePrintData("\033_P\300\020\000",6); ++ } ++ else ++ { ++ if (strcmp(header->OutputType, "1ips") == 0) ++ { ++ fprintf(stderr,"DEBUG: Going 1ips\n"); ++ cupsWritePrintData("\033_X\005Q",5); ++ putchar(25); ++ cupsWritePrintData("\377\200\377",3); ++ } ++ else if (strcmp(header->OutputType, "2ips") == 0) ++ { ++ cupsWritePrintData("\033_X\005Q",5); ++ putchar(50); ++ cupsWritePrintData("\377\200\377",3); ++ fprintf(stderr, "DEBUG: Going 2ips\n"); ++ } ++ else if (strcmp(header->OutputType, "3ips") == 0) ++ { ++ cupsWritePrintData("\033_X\005Q",5); ++ putchar(75); ++ cupsWritePrintData("\377\200\377",3); ++ fprintf(stderr, "DEBUG: Going 3ips\n"); ++ } ++ else if (strcmp(header->OutputType, "4ips") == 0) ++ { ++ cupsWritePrintData("\033_X\005Q",5); ++ putchar(100); ++ cupsWritePrintData("\377\200\377",3); ++ fprintf(stderr, "DEBUG: Going 4ips\n"); ++ } ++ strcpy(intensitystr, header->MediaClass); ++ sscanf(intensitystr,"%d",&intensity); ++ fprintf(stderr,"DEBUG: Intensity is %d\n", intensity); ++ ++ cupsWritePrintData("\033_P",3); ++ putchar(intensity & 0xFF); ++ putchar(0); ++ putchar(0); ++ } ++ SpeedSet = 1; ++ } ++ ++ PixelBuffer = malloc(header->cupsBytesPerLine + 20); ++ CompBuffer = malloc(header->cupsBytesPerLine + 20); ++} ++ ++/* ++ * 'EndPage()' - Finish a page of graphics. ++ */ ++ ++void EndPage(ppd_file_t *ppd, /* I - PPD file */ ++ cups_page_header_t *header) /* I - Page header */ ++{ ++ free(PixelBuffer); ++ free(CompBuffer); ++} ++ ++ ++/* ++ * 'Shutdown()' - Shutdown a printer. ++ */ ++ ++void Shutdown(ppd_file_t *ppd) /* I - PPD file */ ++{ ++ /* ++ * Reset the printer... ++ */ ++ ++ printf("\032"); ++} ++ ++/* ++ * 'CompressData()' - Compress a line of graphics. ++ */ ++ ++void CompressData(ppd_file_t *ppd, /* I - PPD file information */ ++ const unsigned char *line, /* I - Data to compress */ ++ const int length,/* I - Number of bytes */ ++ int type, /* I - Type of compression */ ++ int bits) /* I - Bits Per Pixel */ ++{ ++ register const unsigned char *line_ptr, /* Current byte pointer */ ++ *line_end, /* End-of-line byte pointer */ ++ *start; /* Start of compression sequence */ ++ register unsigned char *comp_ptr; /* Pointer into compression buffer */ ++ register int count; /* Count of bytes for output */ ++ register int bytes; /* Number of bytes per row */ ++ ++ ++ switch (type) ++ { ++ case 0 : ++ /* ++ * Do no compression... ++ */ ++ ++ line_ptr = (const unsigned char *)line; ++ line_end = (const unsigned char *)line + length; ++ bytes = 216; ++ memcpy(CompBuffer, PixelBuffer,216); ++ break; ++ ++ default : ++ /* ++ * Do TIFF pack-bits encoding... ++ */ ++ ++ line_ptr = (const unsigned char *)line; ++ line_end = (const unsigned char *)line + length; ++ comp_ptr = (unsigned char*)CompBuffer; ++ ++ while (line_ptr < line_end && (comp_ptr - CompBuffer) < length) ++ { ++ if ((line_ptr + 1) >= line_end) ++ { ++ /* ++ * Single byte on the end... ++ */ ++ ++ *comp_ptr++ = 0x00; ++ *comp_ptr++ = *line_ptr++; ++ } ++ else if (line_ptr[0] == line_ptr[1]) ++ { ++ /* ++ * Repeated sequence... ++ */ ++ ++ line_ptr ++; ++ count = 2; ++ ++ while (line_ptr < (line_end - 1) && ++ line_ptr[0] == line_ptr[1] && ++ count < 127) ++ { ++ line_ptr ++; ++ count ++; ++ } ++ ++ *comp_ptr++ = 257 - count; ++ *comp_ptr++ = *line_ptr++; ++ } ++ else ++ { ++ /* ++ * Non-repeated sequence... ++ */ ++ ++ start = line_ptr; ++ line_ptr ++; ++ count = 1; ++ ++ while (line_ptr < (line_end - 1) && ++ line_ptr[0] != line_ptr[1] && ++ count < 127) ++ { ++ line_ptr ++; ++ count ++; ++ } ++ ++ *comp_ptr++ = count - 1; ++ ++ memcpy(comp_ptr, start, count); ++ comp_ptr += count; ++ } ++ } ++ line_end = comp_ptr; ++ bytes = comp_ptr - CompBuffer; ++ } ++ ++ /* ++ * Send the graphics... ++ */ ++ ++ if (type == 0) ++ cupsWritePrintData("\033Z\001\000",4); ++ else ++ { ++ cupsWritePrintData("\033_R\001",4); ++ putchar(bits); ++ putchar(bytes >> 8); ++ putchar(bytes & 0xFF); ++ } ++ ++ cupsWritePrintData(CompBuffer, bytes); ++} ++ ++/* ++ * 'ProcessLine()' - Read graphics from the page stream and output as needed. ++ */ ++ ++void ProcessLine(ppd_file_t *ppd, /* I - PPD file */ ++ cups_raster_t *ras, /* I - Raster stream */ ++ cups_page_header_t *header) /* I - Page header */ ++{ ++ ++ /* ++ * Read a row of graphics... ++ */ ++ ++ if (!cupsRasterReadPixels(ras, PixelBuffer, header->cupsBytesPerLine)) ++ return; ++ ++ CompressData(ppd, PixelBuffer, header->cupsBytesPerLine, header->cupsCompression, ++ header->cupsBitsPerPixel); ++ fflush(stdout); ++ ++ OutputFeed ++; ++} ++ ++ ++/* ++ * 'main()' - Main entry and processing of driver. ++ */ ++ ++ /* O - Exit status */ ++int main(int argc, /* I - Number of command-line arguments */ ++ char *argv[]) /* I - Command-line arguments */ ++{ ++ int fd; /* File descriptor */ ++ cups_raster_t *ras; /* Raster stream for printing */ ++ cups_page_header_t header; /* Page header from file */ ++ int page; /* Current page */ ++ int y; /* Current line */ ++ ppd_file_t *ppd; /* PPD file */ ++ int num_options; /* Number of options */ ++ cups_option_t *options; /* Options */ ++ ++ ++ /* ++ * Make sure status messages are not buffered... ++ */ ++ ++ fputs("DEBUG: Got here\n", stderr); ++ setbuf(stderr, NULL); ++ ++ /* ++ * Check command-line... ++ */ ++ ++ if (argc < 6 || argc > 7) ++ { ++ fputs("ERROR: rastertoprx job-id user title copies options [file]\n", stderr); ++ return (1); ++ } ++ ++ num_options = cupsParseOptions(argv[5], 0, &options); ++ ++ /* ++ * Open the PPD file... ++ */ ++ ++ ppd = ppdOpenFile(getenv("PPD")); ++ ++ if (!ppd) ++ { ++ fputs("ERROR: Unable to open PPD file!\n", stderr); ++ return (1); ++ } ++ ++ ppdMarkDefaults(ppd); ++ cupsMarkOptions(ppd, num_options, options); ++ ++ /* ++ * Open the page stream... ++ */ ++ ++ if (argc == 7) ++ { ++ if ((fd = open(argv[6], O_RDONLY)) == -1) ++ { ++ perror("ERROR: Unable to open raster file - "); ++ return (1); ++ } ++ } ++ else ++ fd = 0; ++ ++ ras = cupsRasterOpen(fd, CUPS_RASTER_READ); ++ ++ /* ++ * Initialize the print device... ++ */ ++ ++ Setup(ppd); ++ ++ /* ++ * Process pages as needed... ++ */ ++ ++ page = 0; ++ ++ while (cupsRasterReadHeader(ras, &header)) ++ { ++ page ++; ++ ++ fprintf(stderr, "PAGE: %d 1\n", page); ++ fprintf(stderr, "INFO: Starting page %d...\n", page); ++ ++ StartPage(ppd, &header); ++ ++ fprintf(stderr,"DEBUG: Now printing %d rasters\n\r",header.cupsHeight); ++ for (y = 0; y < header.cupsHeight; y ++) ++ { ++ if ((y & 127) == 0) ++ fprintf(stderr, "INFO: Printing page %d, %d%% complete...\n", page, ++ 100 * y / header.cupsHeight); ++ ++ ProcessLine(ppd, ras, &header); ++ } ++ ++ fprintf(stderr, "INFO: Finished page %d...\n", page); ++ ++ EndPage(ppd, &header); ++ if (header.AdvanceDistance == 2) ++ printf("%c",11); ++ else if (header.AdvanceDistance == 3) ++ printf("%c",12); ++ } ++ ++ Shutdown(ppd); ++ ++ cupsRasterClose(ras); ++ ++ if (fd != 0) ++ close(fd); ++ ++ if (page == 0) ++ { ++ fputs("ERROR: No pages found!\n", stderr); ++ return (1); ++ } ++ else ++ { ++ fputs("INFO: Ready to print.\n", stderr); ++ return (0); ++ } ++} ++ +Index: cups-1.3.9/filter/rastertoprx920.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ cups-1.3.9/filter/rastertoprx920.c 2014-02-25 16:36:17.097182556 +0000 +@@ -0,0 +1,1461 @@ ++/* ++ * Printrex 920 Color raster driver for CUPS. ++ * Revision ++ * 1 Initial release. ++ * 2 Fixed interference between Black & white and Color that was preventing selection of Graphic intent MRB 05-16-2013 ++ * ++ * Copyright 1993-2005 by Easy Software Products. ++ * Copyright 2007 by Apple Inc. ++ * Copyright 2013 by Printrex, Inc. ++ * ++ * These coded instructions, statements, and computer programs are the ++ * property of Apple Inc. and are protected by Federal copyright ++ * law. Distribution and use rights are outlined in the file "LICENSE.txt" ++ * which should have been included with this file. If this file is ++ * file is missing or damaged, see the license at "http://www.cups.org/". ++ * ++ * Contents: ++ * ++ * Setup() - Prepare the printer for graphics output. ++ * StartPage() - Start a page of graphics. ++ * EndPage() - Finish a page of graphics. ++ * Shutdown() - Shutdown a printer. ++ * CompressData() - Compress a line of graphics. ++ * ProcessLine() - Read graphics from the page stream and output ++ * as needed. ++ * main() - Main entry and processing of driver. ++ */ ++ ++/* ++ This code uses PPD parameters in the following way: ++ cupsCompression - 1 is grayscale. 0 is Bimodal. Speed set to 19mm/s in grayscale ++ cupsBytesPerLine - Used to allocate the PixelBuffer memory, and avoid buffer ++ overrun. ++*/ ++/* ++ * Include necessary headers... ++ */ ++ ++#include "string.h" ++#include ++#include ++#include "raster.h" ++#include ++#include ++#include ++#include ++ ++#define cupsWritePrintData(s,n) (fwrite((s),1,(n),stdout)) ++ ++/* ++ * Globals... ++ */ ++ ++unsigned char *PixelBuffer, /* Pixel buffer */ ++ *CompBuffer; /* Compression buffer */ ++int OutputFeed; /* Number of lines to skip */ ++int SpeedSet; /* Flag to indicate the speed has been set */ ++ ++cups_cspace_t cupsColorSpace; ++ ++typedef struct xyztyp_st ++{ ++ float X; ++ float Y; ++ float Z; ++}XYZTYP; ++ ++typedef struct rgbray_st ++{ ++ float r; ++ float g; ++ float b; ++}RGBIN_TYP; ++ ++typedef struct inputmodel ++{ ++ double Redxlat; ++ double Greenxlat; ++ double Bluexlat; ++}INPUTMODEL; ++typedef struct iccheader_st ++{ ++ unsigned long ProfileSize; ++ unsigned char CMMtype[4]; ++ unsigned char ProfileVersion[4]; ++ unsigned char ProfileDevice[4]; ++ unsigned char ColorSpace[4]; ++ unsigned char PCS[4]; ++ unsigned long DatenTime[3]; ++ unsigned char profileSig[4]; ++ unsigned char PrimaryPlat[4]; ++ unsigned char profileFlags[4]; ++ unsigned char DevMfg[4]; ++ unsigned char DevModel[4]; ++ unsigned char DevAttrib[8]; ++ unsigned char RendIntent[4]; ++ unsigned long PCSIll[3]; ++ unsigned char profileCreattor[4]; ++ unsigned long profileID[4]; ++ unsigned char reserved[28]; ++}ICCHEADERTYP; ++ ++typedef struct tag_st ++{ ++ unsigned char sig[4]; ++ unsigned long offset; ++ unsigned long size; ++}TAGTYP; ++ ++typedef struct lutcore_st ++{ ++ unsigned short r; ++ unsigned short g; ++ unsigned short b; ++}LUTCORETYP; ++typedef struct lut16_st ++{ ++ unsigned char typSig[4]; ++ unsigned char reserved[4]; ++ unsigned char numinputchannels; ++ unsigned char numoutputchannels; ++ unsigned char numGridPoints; ++ unsigned char reserved1; ++ unsigned long eparameters[9]; ++ unsigned short numInTabEntries; ++ unsigned short numOutTabEntries; ++ unsigned short InTabEntries[256*3]; ++ LUTCORETYP CLUT[17][17][17]; ++ unsigned short OutTabEntries[256*3]; ++}LUT16TYP; ++ ++LUT16TYP Pictures; ++LUT16TYP Graphs; ++ ++typedef const RGBIN_TYP TLTRAY[17][17][17]; ++ ++//rgbray is a [17][17][17] array of RGBIN_TYP (above) that is the gamut mapping for the printer ++//#include "rgbrayK.c" ++RGBIN_TYP rgbray[17][17][17]; ++ ++const int gridpnts = 17; ++ ++/* ++ * Prototypes... ++ */ ++ ++void Setup(ppd_file_t *in); ++void StartPage(ppd_file_t *in, cups_page_header_t *); ++void EndPage(ppd_file_t *, cups_page_header_t *); ++void Shutdown(ppd_file_t *); ++ ++void CompressData(ppd_file_t *ppd, /* I - PPD file information */ ++ const unsigned char *line, /* I - Data to compress */ ++ const int length, ++ int bits);/* I - Number of bytes */ ++ ++void ProcessLine(ppd_file_t *, cups_raster_t *, ++ cups_page_header_t *); ++ ++void trilininterp(unsigned char redin, unsigned char greenin, ++ unsigned char bluein, unsigned char *redout, unsigned char *greenout, ++ unsigned char *blueout); ++ ++void labtoxyz(float Lst, float ast, float bst, XYZTYP *xyz); ++void xyztorgb(float X, float Y, float Z, RGBIN_TYP *rgb); ++void xyztolab(float X, float Y, float Z, float *lab); ++void GetXYZ(float rin, float gin, float bin, float *xyzin); ++ ++/* ++ * 'Setup()' - Set the printer up for printing this job. ++ */ ++ ++void ++Setup(ppd_file_t *ppd) /* I - PPD file */ ++{ ++ SpeedSet = 0; ++} ++ ++ ++/* ++ * 'StartPage()' - Start a page of graphics. ++ */ ++ ++const unsigned char modulation[2][12] = ++{ ++ {25, 0, 55, 2, 238, 40, 0, 45, 2, 188, 173, 80}, ++ {25, 0, 55, 2, 238, 40, 0, 42, 2, 188, 173, 80} ++}; ++ ++void StartPage(ppd_file_t *ppd, /* I - PPD file */ ++ cups_page_header_t *header) /* I - Page header */ ++{ ++ signed char resolution[PPD_MAX_NAME]; /* Resolution string */ ++ signed char intensitystr[10]; /* Used for calculating intensity */ ++ int intensity; ++ unsigned short tofpos; ++ signed char stofpos; ++ ++ fprintf(stderr, "DEBUG: StartPage...\n"); ++ fprintf(stderr, "DEBUG: MediaClass = \"%s\"\n", header->MediaClass); ++ fprintf(stderr, "DEBUG: MediaColor = \"%s\"\n", header->MediaColor); ++ fprintf(stderr, "DEBUG: MediaType = \"%s\"\n", header->MediaType); ++ fprintf(stderr, "DEBUG: OutputType = \"%s\"\n", header->OutputType); ++ ++ fprintf(stderr, "DEBUG: AdvanceDistance = %d\n", header->AdvanceDistance); ++ fprintf(stderr, "DEBUG: AdvanceMedia = %d\n", header->AdvanceMedia); ++ fprintf(stderr, "DEBUG: Collate = %d\n", header->Collate); ++ fprintf(stderr, "DEBUG: CutMedia = %d\n", header->CutMedia); ++ fprintf(stderr, "DEBUG: Duplex = %d\n", header->Duplex); ++ fprintf(stderr, "DEBUG: HWResolution = [ %d %d ]\n", header->HWResolution[0], ++ header->HWResolution[1]); ++ fprintf(stderr, "DEBUG: ImagingBoundingBox = [ %d %d %d %d ]\n", ++ header->ImagingBoundingBox[0], header->ImagingBoundingBox[1], ++ header->ImagingBoundingBox[2], header->ImagingBoundingBox[3]); ++ fprintf(stderr, "DEBUG: InsertSheet = %d\n", header->InsertSheet); ++ fprintf(stderr, "DEBUG: Jog = %d\n", header->Jog); ++ fprintf(stderr, "DEBUG: LeadingEdge = %d\n", header->LeadingEdge); ++ fprintf(stderr, "DEBUG: Margins = [ %d %d ]\n", header->Margins[0], ++ header->Margins[1]); ++ fprintf(stderr, "DEBUG: ManualFeed = %d\n", header->ManualFeed); ++ fprintf(stderr, "DEBUG: MediaPosition = %d\n", header->MediaPosition); ++ fprintf(stderr, "DEBUG: MediaWeight = %d\n", header->MediaWeight); ++ fprintf(stderr, "DEBUG: MirrorPrint = %d\n", header->MirrorPrint); ++ fprintf(stderr, "DEBUG: NegativePrint = %d\n", header->NegativePrint); ++ fprintf(stderr, "DEBUG: NumCopies = %d\n", header->NumCopies); ++ fprintf(stderr, "DEBUG: Orientation = %d\n", header->Orientation); ++ fprintf(stderr, "DEBUG: OutputFaceUp = %d\n", header->OutputFaceUp); ++ fprintf(stderr, "DEBUG: PageSize = [ %d %d ]\n", header->PageSize[0], ++ header->PageSize[1]); ++ fprintf(stderr, "DEBUG: Separations = %d\n", header->Separations); ++ fprintf(stderr, "DEBUG: TraySwitch = %d\n", header->TraySwitch); ++ fprintf(stderr, "DEBUG: Tumble = %d\n", header->Tumble); ++ fprintf(stderr, "DEBUG: cupsWidth = %d\n", header->cupsWidth); ++ fprintf(stderr, "DEBUG: cupsHeight = %d\n", header->cupsHeight); ++ fprintf(stderr, "DEBUG: cupsMediaType = %d\n", header->cupsMediaType); ++ fprintf(stderr, "DEBUG: cupsBitsPerColor = %d\n", header->cupsBitsPerColor); ++ fprintf(stderr, "DEBUG: cupsBitsPerPixel = %d\n", header->cupsBitsPerPixel); ++ fprintf(stderr, "DEBUG: cupsBytesPerLine = %d\n", header->cupsBytesPerLine); ++ fprintf(stderr, "DEBUG: cupsColorOrder = %d\n", header->cupsColorOrder); ++ fprintf(stderr, "DEBUG: cupsColorSpace = %d\n", header->cupsColorSpace); ++ fprintf(stderr, "DEBUG: cupsCompression = %d\n", header->cupsCompression); ++ fprintf(stderr, "DEBUG: cupsRowCount = %d\n", header->cupsRowCount); ++ fprintf(stderr, "DEBUG: cupsRowFeed = %d\n", header->cupsRowFeed); ++ fprintf(stderr, "DEBUG: cupsRowStep = %d\n", header->cupsRowStep); ++ ++ /* ++ * Set the resolution and Media Type ++ */ ++ ++ if (header->HWResolution[0] != header->HWResolution[1]) ++ snprintf(resolution, sizeof(resolution), "%dx%ddpi", ++ header->HWResolution[0], header->HWResolution[1]); ++ else ++ snprintf(resolution, sizeof(resolution), "%ddpi", ++ header->HWResolution[0]); ++ ++ if (!header->MediaType[0]) ++ strcpy(header->MediaType, "Plain"); ++ ++ fprintf(stderr, "DEBUG: MediaType = %s\n", header->MediaType); ++ fprintf(stderr, "DEBUG: Resolution = %s\n", resolution); ++ ++ cupsColorSpace = header->cupsColorSpace; ++ ++ if (header->cupsColorSpace == CUPS_CSPACE_K) //Black and white (CUPS_CSPACE_K definition found in raster.h) ++ { ++ if (!SpeedSet) ++ { ++ cupsWritePrintData("\033_X\015M",5); ++ if (strcmp(header->MediaType, "PrintrexRoll") == 0) ++ { ++ cupsWritePrintData(modulation[0],12); ++ fprintf(stderr, "DEBUG: Setting Roll\n"); ++ } ++ else if (strcmp(header->MediaType, "Heavyweight") == 0) ++ { ++ cupsWritePrintData(modulation[1],12); ++ fprintf(stderr, "DEBUG: Setting Heavyweight\n"); ++ } ++ ++ // If not 1, it's gray scale. Set the speed, Sat, and White level ++ // according to the media selected. ++ if (header->cupsBitsPerPixel != 1) ++ { ++ cupsWritePrintData("\033_X\005Q",5); ++ putchar(12); ++ cupsWritePrintData("\377\200\377",3); ++ if (strcmp(header->MediaType, "PrintrexRoll") == 0) ++ cupsWritePrintData("\033_P\340\000\000",6); ++ else if (strcmp(header->MediaType, "Heavyweight") == 0) ++ cupsWritePrintData("\033_P\300\020\000",6); ++ } ++ else ++ { ++ ++ if (strcmp(header->OutputType, "p5ips") == 0) ++ { ++ fprintf(stderr,"DEBUG: Going 0.5ips\n"); ++ cupsWritePrintData("\033_X\005Q",5); ++ putchar(12); ++ cupsWritePrintData("\377\200\377",3); ++ } ++ else if (strcmp(header->OutputType, "1ips") == 0) ++ { ++ fprintf(stderr,"DEBUG: Going 1ips\n"); ++ cupsWritePrintData("\033_X\005Q",5); ++ putchar(25); ++ cupsWritePrintData("\377\200\377",3); ++ } ++ else if (strcmp(header->OutputType, "2ips") == 0) ++ { ++ cupsWritePrintData("\033_X\005Q",5); ++ putchar(50); ++ cupsWritePrintData("\377\200\377",3); ++ fprintf(stderr, "DEBUG: Going 2ips\n"); ++ } ++ else if (strcmp(header->OutputType, "3ips") == 0) ++ { ++ cupsWritePrintData("\033_X\005Q",5); ++ putchar(75); ++ cupsWritePrintData("\377\200\377",3); ++ fprintf(stderr, "DEBUG: Going 3ips\n"); ++ } ++ strcpy(intensitystr, header->MediaClass); ++ sscanf(intensitystr,"%d",&intensity); ++ fprintf(stderr,"DEBUG: Intensity is %d\n", intensity); ++ ++ cupsWritePrintData("\033_P",3); ++ putchar(intensity & 0xFF); ++ putchar(0); ++ putchar(0); ++ ++ } ++ ++ /* Set Form Feed interpretation. Must be done once per document. */ ++ stofpos = header->MediaPosition; ++ tofpos = 0x8000 + stofpos; ++ fprintf(stderr,"DEBUG: TOF posisition is %-d\n", tofpos); ++ cupsWritePrintData("\033_F\377",4); ++ if (header->AdvanceMedia & 2) ++ putchar(1); ++ else ++ putchar(0); ++ putchar(255); ++ putchar(tofpos & 0xFF); ++ putchar(tofpos >> 8); ++ cupsWritePrintData("\377\377",2); ++ SpeedSet = 1; ++ ++ fprintf(stderr,"DEBUG: DLA %d\n",header->cupsRowStep); ++ cupsWritePrintData("\033_D",3); ++ putchar(header->cupsRowStep); ++ } ++ cupsWritePrintData("\033_X",3); ++ putchar(2); ++ cupsWritePrintData("NM",2); ++ } ++ else //Is Color ++ { ++ if (!SpeedSet) ++ { ++ /* Set Form Feed interpretation (Identical to above) Must be done once per document.*/ ++ stofpos = header->MediaPosition; ++ tofpos = 0x8000 + stofpos; ++ fprintf(stderr,"DEBUG: TOF posisition is %-d\n", tofpos); ++ cupsWritePrintData("\033_F\377",4); ++ if (header->AdvanceMedia & 2) ++ putchar(1); ++ else ++ putchar(0); ++ putchar(255); ++ putchar(tofpos & 0xFF); ++ putchar(tofpos >> 8); ++ cupsWritePrintData("\377\377",2); ++ ++ SpeedSet = 1; ++ } ++ ++ cupsWritePrintData("\033_X",3); ++ putchar(2); ++ cupsWritePrintData("NC",2); ++ } ++ ++ ++ /******************************************************* ++ The spec for color paper says we will print 2480 ++ wide. ++ Since we are working in points(1/72) and 300 dpi, ++ we need an integral value after being multiplied ++ by 72p/300d. The GCD for these is 12. ++ This gives 6/25. So we get integers at intervals ++ of 25 -> 2475 is the closest number divisible by ++ 25. ++ The full width is 2560. We need to center, and ++ don't have to worry about padding the right side. ++ (2560 -2475)/2 = 42.5 -> 42. Pad with 42 pixels ++ on the left. Add 20 for escape sequences and ++ buffering. 2475 + 42 = ++ ********************************************************/ ++ ++ PixelBuffer = malloc(header->cupsBytesPerLine + 20 + 42*3); ++ CompBuffer = malloc(header->cupsBytesPerLine + 20 + 42*3); ++} ++ ++ ++/* ++ * 'EndPage()' - Finish a page of graphics. ++ */ ++ ++void EndPage(ppd_file_t *ppd, /* I - PPD file */ ++ cups_page_header_t *header) /* I - Page header */ ++{ ++ if (header->AdvanceMedia & 4) ++ putchar(12); ++ free(PixelBuffer); ++ free(CompBuffer); ++} ++ ++ ++/* ++ * 'Shutdown()' - Shutdown a printer. ++ */ ++ ++void Shutdown(ppd_file_t *ppd) /* I - PPD file */ ++{ ++ /* ++ * End of Job ++ */ ++ ++ cupsWritePrintData("\033_E",3); ++} ++ ++/* ++ * 'CompressData()' - Compress a line of graphics. ++ */ ++ ++#define LINEDATA 2475 ++#define LINEPADDING 42 ++#define PADDEDLINE (LINEDATA + LINEPADDING) ++ ++void CompressData(ppd_file_t *ppd, /* I - PPD file information */ ++ const unsigned char *line, /* I - Data to compress */ ++ const int length, ++ int bits) /* I - Number of bytes */ ++{ ++ ++ unsigned char *Y_Com_ptr; ++ unsigned char *M_Com_ptr; ++ unsigned char *C_Com_ptr; ++ ++ unsigned char *R_Pix_ptr; ++ unsigned char *G_Pix_ptr; ++ unsigned char *B_Pix_ptr; ++ ++ unsigned char redout; ++ unsigned char greenout; ++ unsigned char blueout; ++ XYZTYP xyz; ++ RGBIN_TYP rgb; ++ float xyzin[3]; ++ float lab[3]; ++ ++ int ctr; ++ const unsigned char *line_ptr, ++ /* Current byte pointer */ ++ *line_end, /* End-of-line byte pointer */ ++ *start; /* Start of compression sequence */ ++ unsigned char *comp_ptr; /* Pointer into compression buffer */ ++ int count; /* Count of bytes for output */ ++ int bytes; /* Number of bytes per row */ ++ ++ ++ if (cupsColorSpace == CUPS_CSPACE_K) ++ { ++ /* ++ * Do TIFF pack-bits encoding... ++ */ ++ ++ line_ptr = (const unsigned char *)line; ++ line_end = (const unsigned char *)line + length; ++ comp_ptr = (unsigned char*)CompBuffer; ++ ++ while (line_ptr < line_end && (comp_ptr - CompBuffer) < length) ++ { ++ if ((line_ptr + 1) >= line_end) ++ { ++ /* ++ * Single byte on the end... ++ */ ++ ++ *comp_ptr++ = 0x00; ++ *comp_ptr++ = *line_ptr++; ++ } ++ else if (line_ptr[0] == line_ptr[1]) ++ { ++ /* ++ * Repeated sequence... ++ */ ++ ++ line_ptr ++; ++ count = 2; ++ ++ while (line_ptr < (line_end - 1) && line_ptr[0] == line_ptr[1] && count < 127) ++ { ++ line_ptr ++; ++ count ++; ++ } ++ ++ *comp_ptr++ = 257 - count; ++ *comp_ptr++ = *line_ptr++; ++ } ++ else ++ { ++ /* ++ * Non-repeated sequence... ++ */ ++ ++ start = line_ptr; ++ line_ptr ++; ++ count = 1; ++ ++ while (line_ptr < (line_end - 1) && line_ptr[0] != line_ptr[1] && count < 127) ++ { ++ line_ptr ++; ++ count ++; ++ } ++ ++ *comp_ptr++ = count - 1; ++ ++ memcpy(comp_ptr, start, count); ++ comp_ptr += count; ++ } ++ } ++ line_end = comp_ptr; ++ bytes = comp_ptr - CompBuffer; ++ ++ /* ++ * Send the graphics... ++ */ ++ ++ cupsWritePrintData("\033_R\001",4); ++ putchar(bits); ++ putchar(bytes >> 8); ++ putchar(bytes & 0xFF); ++ ++ cupsWritePrintData(CompBuffer, bytes); ++ } ++ //Color portion of the code ++ else ++ { ++ ++ Y_Com_ptr = &CompBuffer[0]; ++ M_Com_ptr = &CompBuffer[PADDEDLINE+6]; ++ C_Com_ptr = &CompBuffer[(PADDEDLINE+6) * 2]; ++ ++ R_Pix_ptr = &PixelBuffer[0]; ++ G_Pix_ptr = &PixelBuffer[LINEDATA]; ++ B_Pix_ptr = &PixelBuffer[LINEDATA * 2]; ++ ++ Y_Com_ptr += sprintf(Y_Com_ptr,"\033_Z"); ++ *Y_Com_ptr++ = 'Y'; ++ *Y_Com_ptr++ = PADDEDLINE >> 8; ++ *Y_Com_ptr++ = PADDEDLINE & 0xFF; ++ ++ ++ M_Com_ptr += sprintf(M_Com_ptr,"\033_Z"); ++ *M_Com_ptr++ = 'M'; ++ *M_Com_ptr++ = PADDEDLINE >> 8; ++ *M_Com_ptr++ = PADDEDLINE & 0xFF; ++ ++ C_Com_ptr += sprintf(C_Com_ptr,"\033_Z"); ++ *C_Com_ptr++ = 'C'; ++ *C_Com_ptr++ = PADDEDLINE >> 8; ++ *C_Com_ptr++ = PADDEDLINE & 0xFF; ++ ++ //Pad the first 42 in each space ++ for (ctr = 0; ctr < LINEPADDING; ctr++) ++ { ++ *Y_Com_ptr++ = 0; ++ *M_Com_ptr++ = 0; ++ *C_Com_ptr++ = 0; ++ } ++ ++ for (ctr = 0; ctr < LINEDATA; ctr++) ++ { ++ GetXYZ( *R_Pix_ptr++, *G_Pix_ptr++, *B_Pix_ptr++, xyzin); ++ xyztolab( xyzin[0], xyzin[1], xyzin[2], lab); ++ // labtoxyz( lab[0], lab[1], lab[2], &xyz); ++ // xyztorgb( xyz.X, xyz.Y, xyz.Z, &rgb); ++ ++ trilininterp(lab[0]*255.0/100.0, lab[1]+128.0, lab[2]+128.0, &redout, &greenout, &blueout); ++ ++ *Y_Com_ptr++ = 255 - blueout; ++ *M_Com_ptr++ = 255 - greenout; ++ *C_Com_ptr++ = 255 - redout; ++ } ++ ++ cupsWritePrintData(CompBuffer, (PADDEDLINE + 6)*3); ++ } ++} ++ ++/* ++ * 'ProcessLine()' - Read graphics from the page stream and output as needed. ++ */ ++ ++void ProcessLine(ppd_file_t *ppd, /* I - PPD file */ ++ cups_raster_t *ras, /* I - Raster stream */ ++ cups_page_header_t *header) /* I - Page header */ ++{ ++ ++ /* ++ * Read a row of graphics... ++ */ ++ ++ if (!cupsRasterReadPixels(ras, PixelBuffer, header->cupsBytesPerLine)) ++ return; ++ ++ CompressData(ppd, PixelBuffer, header->cupsBytesPerLine, header->cupsBitsPerPixel); ++ ++ fflush(stdout); ++ ++ OutputFeed ++; ++} ++ ++ ++/* ++ This routine accepts r,g,b inputs, does the interpolation within rgbray, and returns the correction in redout, greenout, and blueout ++*/ ++void trilininterp(unsigned char redin, unsigned char greenin, unsigned char bluein, unsigned char *redout, unsigned char *greenout, unsigned char *blueout) ++{ ++ INPUTMODEL cube[2][2][2]; ++ int rdex[2]; ++ int gdex[2]; ++ int bdex[2]; ++ ++ ++ int rorig; ++ int gorig; ++ int borig; ++ ++ int roffs; ++ int goffs; ++ int boffs; ++ ++ int rcnt; ++ int gcnt; ++ int bcnt; ++ ++ double dcolorout; ++ double droffs; ++ double dgoffs; ++ double dboffs; ++ ++ double dK1, dK2, dK3, dK4, dK5, dK6, dK7, dK8; ++ ++ ++ //Convert the inputs to ints ++ rorig = redin; ++ gorig = greenin; ++ borig = bluein; ++ ++ //The cube moves in steps of 16 ++ //Get remainders of ints divided by 16 ++ roffs = rorig - ((rorig / 16) * 16); ++ goffs = gorig - ((gorig / 16) * 16); ++ boffs = borig - ((borig / 16) * 16); ++ ++ //Convert offset into 16ths ++ droffs = (double)roffs / 16.0; ++ dgoffs = (double)goffs / 16.0; ++ dboffs = (double)boffs / 16.0; ++ ++ ++ //Calculate indicies ++ rdex[0] = rorig / 16; ++ gdex[0] = gorig / 16; ++ bdex[0] = borig / 16; ++ ++ rdex[1] = rdex[0] + 1; ++ gdex[1] = gdex[0] + 1; ++ bdex[1] = bdex[0] + 1; ++ ++ //Perform interpolation ++ for (rcnt = 0; rcnt < 2; rcnt++) ++ for (gcnt = 0; gcnt < 2; gcnt++) ++ for (bcnt = 0; bcnt < 2; bcnt++) ++ { ++ cube[rcnt][gcnt][bcnt].Redxlat = rgbray[rdex[rcnt]][gdex[gcnt]][bdex[bcnt]].r; ++ cube[rcnt][gcnt][bcnt].Greenxlat = rgbray[rdex[rcnt]][gdex[gcnt]][bdex[bcnt]].g; ++ cube[rcnt][gcnt][bcnt].Bluexlat = rgbray[rdex[rcnt]][gdex[gcnt]][bdex[bcnt]].b; ++ } ++#if 1 ++ dK1 = (1.0 - droffs) * (1.0 - dgoffs) * (1.0 - dboffs); ++ dK2 = droffs * (1 - dgoffs) * (1 - dboffs); ++ dK3 = (1 - droffs) * (dgoffs) * (1 - dboffs); ++ dK4 = (1 - droffs) * (1 - dgoffs) * dboffs; ++ dK5 = droffs * (1 - dgoffs) * dboffs; ++ dK6 = (1 - droffs) * dgoffs * dboffs; ++ dK7 = droffs * dgoffs * (1 - dboffs); ++ dK8 = droffs * dgoffs * dboffs; ++ ++ ++ //Get Red ++ dcolorout = cube[0][0][0].Redxlat * dK1 + ++ cube[1][0][ 0].Redxlat * dK2 + ++ cube[0][1][0].Redxlat * dK3 + ++ cube[0][0][1].Redxlat * dK4 + ++ cube[1][0][1].Redxlat * dK5 + ++ cube[0][1][1].Redxlat * dK6 + ++ cube[1][1][0].Redxlat * dK7 + ++ cube[1][1][1].Redxlat * dK8; ++ *redout = (unsigned char)dcolorout; ++ ++ //Get Green ++ dcolorout = cube[0][0][0].Greenxlat * dK1 + ++ cube[1][0][0].Greenxlat * dK2 + ++ cube[0][1][0].Greenxlat * dK3 + ++ cube[0][0][1].Greenxlat * dK4 + ++ cube[1][0][1].Greenxlat * dK5 + ++ cube[0][1][1].Greenxlat * dK6 + ++ cube[1][1][0].Greenxlat * dK7 + ++ cube[1][1][1].Greenxlat * dK8; ++ *greenout = (unsigned char)dcolorout; ++ ++ //Get Blue ++ dcolorout = cube[0][0][0].Bluexlat * dK1 + ++ cube[1][0][0].Bluexlat * dK2 + ++ cube[0][1][0].Bluexlat * dK3 + ++ cube[0][0][1].Bluexlat * dK4 + ++ cube[1][0][1].Bluexlat * dK5 + ++ cube[0][1][1].Bluexlat * dK6 + ++ cube[1][1][0].Bluexlat * dK7 + ++ cube[1][1][1].Bluexlat * dK8; ++ *blueout = (unsigned char)dcolorout; ++ ++ ++#else ++ //Get Red ++ dcolorout = cube[0, 0, 0].Redxlat * (1.0 - droffs) * (1.0 - dgoffs) * (1.0 - dboffs) + ++ cube[1, 0, 0].Redxlat * droffs * (1 - dgoffs) * (1 - dboffs) + ++ cube[0, 1, 0].Redxlat * (1 - droffs) * (dgoffs) * (1 - dboffs) + ++ cube[0, 0, 1].Redxlat * (1-droffs) * (1-dgoffs) * dboffs + ++ cube[1, 0, 1].Redxlat * droffs * (1-dgoffs) * dboffs + ++ cube[0, 1, 1].Redxlat * (1 - droffs) * dgoffs * dboffs + ++ cube[1, 1, 0].Redxlat * droffs * dgoffs * (1 - dboffs) + ++ cube[1, 1, 1].Redxlat * droffs * dgoffs * dboffs; ++ redout = (byte)dcolorout; ++ ++ //Get Green ++ dcolorout = cube[0, 0, 0].Greenxlat * (1.0 - droffs) * (1.0 - dgoffs) * (1.0 - dboffs) + ++ cube[1, 0, 0].Greenxlat * droffs * (1 - dgoffs) * (1 - dboffs) + ++ cube[0, 1, 0].Greenxlat * (1 - droffs) * (dgoffs) * (1 - dboffs) + ++ cube[0, 0, 1].Greenxlat * (1 - droffs) * (1 - dgoffs) * dboffs + ++ cube[1, 0, 1].Greenxlat * droffs * (1 - dgoffs) * dboffs + ++ cube[0, 1, 1].Greenxlat * (1 - droffs) * dgoffs * dboffs + ++ cube[1, 1, 0].Greenxlat * droffs * dgoffs * (1 - dboffs) + ++ cube[1, 1, 1].Greenxlat * droffs * dgoffs * dboffs; ++ greenout = (byte)dcolorout; ++ ++ //Get Blue ++ dcolorout = cube[0, 0, 0].Bluexlat * (1.0 - droffs) * (1.0 - dgoffs) * (1.0 - dboffs) + ++ cube[1, 0, 0].Bluexlat * droffs * (1 - dgoffs) * (1 - dboffs) + ++ cube[0, 1, 0].Bluexlat * (1 - droffs) * (dgoffs) * (1 - dboffs) + ++ cube[0, 0, 1].Bluexlat * (1 - droffs) * (1 - dgoffs) * dboffs + ++ cube[1, 0, 1].Bluexlat * droffs * (1 - dgoffs) * dboffs + ++ cube[0, 1, 1].Bluexlat * (1 - droffs) * dgoffs * dboffs + ++ cube[1, 1, 0].Bluexlat * droffs * dgoffs * (1 - dboffs) + ++ cube[1, 1, 1].Bluexlat * droffs * dgoffs * dboffs; ++ blueout = (byte)dcolorout; ++#endif ++ ++} ++//Convert Lab to XYZ ++void labtoxyz(float Lst, float ast, float bst, XYZTYP *xyz) ++{ ++ const float REF_X = 96.422; ++ const float REF_Y = 100.0; ++ const float REF_Z = 82.521; ++ ++ float Y; ++ float X; ++ float Z; ++ ++ Y = (Lst + 16.0) / 116; //Y ++ X = ast / 500.0 + Y; //X ++ Z = Y - bst / 200.0; //Z ++ ++ if (pow(Y,3) > 0.008856) ++ Y = pow(Y,3); ++ else ++ Y = (Y - (16.0 / 116.0)) / 7.787; ++ ++ ++ if (pow(X,3) > 0.008856) ++ X = pow(X,3); ++ else ++ X = (X - (16.0 / 116.0)) / 7.787; ++ ++ if (pow(Z,3) > 0.008856) ++ Z = pow(Z,3); ++ else ++ Z = (Z - (16.0 / 116.0)) / 7.787; ++ ++ X *= REF_X; ++ Y *= REF_Y; ++ Z *= REF_Z; ++ ++ xyz->X = X; ++ xyz->Y = Y; ++ xyz->Z = Z; ++} ++ ++//Convert XYZ to RGB ++void xyztorgb(float X, float Y, float Z, RGBIN_TYP *rgb) ++{ ++ double r; ++ double g; ++ double blue; ++ ++ X = X / 100.0; ++ Y = Y / 100.0; ++ Z = Z / 100.0; ++ ++ r = X * 3.1339 + Y * -1.617 + Z * -0.4906; ++ g = X * -0.9785 + Y * 1.916 + Z * 0.0333; ++ blue = X * 0.072 + Y * -0.229 + Z * 1.4057; ++ ++ if (r > 0.0031308) ++ r = 1.055 * pow(r,(1.0/2.4)) - 0.055; ++ else ++ r = 12.92 * r; ++ ++ r = r * 255; ++ ++ if (r < 0 ) ++ r = 0; ++ ++ if (r > 255) ++ r = 255; ++ ++ if (g > 0.0031308) ++ g = 1.055 * pow(g,1.0/2.4) - 0.055; ++ else ++ g = 12.92 * g; ++ ++ g = g * 255; ++ ++ if (g < 0 ) ++ g = 0; ++ ++ if (g > 255) ++ g = 255; ++ ++ if (blue > 0.0031308) ++ blue = 1.055 * pow(blue,1.0/2.4) - 0.055; ++ else ++ blue = 12.92 * blue; ++ ++ blue = blue * 255; ++ ++ if (blue < 0 ) ++ blue = 0; ++ ++ if (blue > 255) ++ blue = 255; ++ ++ rgb->r = r; ++ rgb->g = g; ++ rgb->b = blue; ++} ++ ++ ++void xyztolab(float X, float Y, float Z, float *lab) ++{ ++ // get Lab from XYZ ++ ++ float refx; ++ float refy; ++ float refz; ++ double cx; ++ double cy; ++ double cz; ++ ++ // These are the D50 numbers ++ ++ refx = 96.422; ++ refy = 100; ++ refz = 82.521; ++ ++ cx = X / refx; ++ cy = Y / refy; ++ cz = Z / refz; ++ ++ if (cx > 0.008856) ++ cx = pow(cx,(1.0 / 3.0)); ++ else ++ cx = (7.787 * cx) + (16.0 / 116.0); ++ ++ ++ if (cy > 0.008856) ++ cy = pow(cy,(1.0 / 3.0)); ++ else ++ cy = (7.787 * cy) + (16.0 / 116.0); ++ ++ ++ if (cz > 0.008856) ++ cz = pow(cz,(1.0 / 3.0)); ++ else ++ cz = (7.787 * cz) + (16.0 / 116.0); ++ ++ lab[0] = (116.0 * cy) - 16.0; ++ lab[1] = 500.0 * (cx - cy); ++ lab[2] = 200.0 * (cy - cz); ++ ++ if (lab[0] > 100) ++ lab[0] = 100.0; ++ ++ if (lab[1] > 128.0) ++ lab[1] = 128.0; ++ ++ if (lab[2] > 128.0) ++ lab[2] = 128.0; ++} ++ ++void GetXYZ(float rin, float gin, float bin, float *xyzin) ++{ ++ ++// get XYZ from rgb ++ ++ float R; ++ float G; ++ float b; ++ ++ R = rin / 255.0; ++ G = gin / 255.0; ++ b = bin / 255.0; ++ ++ if (R > 0.04045) ++ R = pow(((R + 0.055) / 1.055), 2.4); ++ else ++ R = R / 12.92; ++ ++ if (G > 0.04045) ++ G = pow(((G + 0.055) / 1.055), 2.4); ++ else ++ G = G / 12.92; ++ ++ if (b > 0.04045) ++ b = pow(((b + 0.055) / 1.055), 2.4); ++ else ++ b = b / 12.92; ++ ++ R = R * 100.0; ++ G = G * 100.0; ++ b = b * 100.0; ++ ++ xyzin[0] = R * 0.436129 + G * 0.385371 + b * 0.143083; ++ xyzin[1] = R * 0.222605 + G * 0.717416 + b * 0.060696; ++ xyzin[2] = R * 0.013926 + G * 0.097134 + b * 0.713943; ++} ++ ++#if 0 ++/***************************************************************** ++ Read in the ICC profile ++******************************************************************/ ++void readInProfile(int intent) ++{ ++ FILE *f1; /* File pointer*/ ++ int linecnt; /* input line counter */ ++ int rdex; /* red index */ ++ int gdex; /* green index */ ++ int bdex; /* blue index */ ++ int successfulread; /* Did we successfully read the file? */ ++ RGBIN_TYP tmpgrid[4913]; /* grid input from file */ ++ ++ successfulread = 0; ++ ++ f1 = NULL; ++ ++ switch (intent) ++ { ++ case 0: ++ f1 = fopen("/usr/share/cups/profiles/Pictures.ict","r"); ++ break; ++ case 1: ++ f1 = fopen("/usr/share/cups/profiles/Graphs.ict","r"); ++ break; ++ }; ++ ++ if (f1 == NULL) ++ { ++ fputs("ERROR: Couldn't open .ict file\n", stderr); ++ } ++ else ++ successfulread = 1; ++ ++ if (successfulread) ++ { ++ for (linecnt = 0; linecnt < 4913; linecnt++) ++ fscanf(f1, "%f %f %f\n", &tmpgrid[linecnt].r, &tmpgrid[linecnt].g, &tmpgrid[linecnt].b); ++ ++ for (linecnt = rdex = 0; rdex < gridpnts; rdex++) ++ for(gdex = 0; gdex < gridpnts; gdex++) ++ for(bdex = 0; bdex < gridpnts; bdex++) ++ { ++ rgbray[rdex][gdex][bdex].r = tmpgrid[linecnt].r; ++ rgbray[rdex][gdex][bdex].g = tmpgrid[linecnt].g; ++ rgbray[rdex][gdex][bdex].b = tmpgrid[linecnt].b; ++ linecnt++; ++ } ++ } ++ else ++ { ++ for (linecnt = rdex = 0; rdex < gridpnts; rdex++) ++ for(gdex = 0; gdex < gridpnts; gdex++) ++ for(bdex = 0; bdex < gridpnts; bdex++) ++ { ++ rgbray[rdex][gdex][bdex].r = rgbrayK[rdex][gdex][bdex].r; ++ rgbray[rdex][gdex][bdex].g = rgbrayK[rdex][gdex][bdex].g; ++ rgbray[rdex][gdex][bdex].b = rgbrayK[rdex][gdex][bdex].b; ++ linecnt++; ++ } ++ } ++ ++ fclose(f1); ++} ++#endif ++ ++// ReadICCProfile.c Reads in the tables from the ICC profile ++// ++ ++/*********************************************************************************** ++ FUNCTIONS ++*************************************************************************************/ ++void readInProfile(int intent) ++{ ++ FILE *f1; ++ char ch; ++ unsigned char *alldata; ++ unsigned char *data; ++ unsigned long lswapper; ++ unsigned short sswapper; ++ unsigned long tagCount; ++ unsigned long result; ++ unsigned long lSize; ++ int cnt; ++ int rdex; ++ int gdex; ++ int bdex; ++ char tmpstr[5]; ++ ICCHEADERTYP header; ++ TAGTYP tag1, tag2; ++ ++ if ((f1 = fopen("/usr/share/cups/profiles/ICC48.icc","rb")) == NULL) ++ { ++ fputs("ERROR: Couldn't open ICC48.icc\n",stderr); ++ return; ++ } ++ ++ // obtain file size: ++ fseek (f1 , 0 , SEEK_END); ++ lSize = ftell (f1); ++ rewind (f1); ++ ++ // allocate memory to contain the whole file: ++ data = alldata = (unsigned char*) malloc (sizeof(char)*lSize); ++ if (alldata == NULL) ++ { ++ fputs ("ERROR: Memory error",stderr); ++ return; ++ } ++ ++ // copy the file into the buffer: ++ result = fread (alldata,1,lSize,f1); ++ if (result != lSize) ++ { ++ fputs ("ERROR: Reading error",stderr); ++ return; ++ } ++ ++ /* the whole file is now loaded in the memory buffer. */ ++ ++ header = *(ICCHEADERTYP *)data; ++ data += 128; ++ ++/* ++ unsigned long ProfileSize; ++ unsigned char CMMtype[4]; ++ unsigned char ProfileVersion[4]; ++ unsigned char ProfileDevice[4]; ++ unsigned char ColorSpace[4]; ++ unsigned char PCS[4]; ++ unsigned long DatenTime[3]; ++ unsigned char profileSig[4]; ++ unsigned char PrimaryPlat[4]; ++ unsigned char profileFlags[4]; ++ unsigned char DevMfg[4]; ++ unsigned char DevModel[4]; ++ unsigned char DevAttrib[4]; ++ unsigned char RendIntent[4]; ++ unsigned long PCSIll[3]; ++ unsigned char profileCreattor[4]; ++ unsigned long profileID[4]; ++*/ ++ ++ lswapper = header.ProfileSize; ++ lswapper = (lswapper << 24) | ((lswapper << 8) & 0x00FF0000) | ((lswapper >> 8) & 0x0000FF00) | (lswapper >> 24); ++ header.ProfileSize = lswapper; ++#if 0 ++ fprintf(stderr,"DEBUG: ProfileSize %ld\n", lswapper); ++ fprintf(stderr,"DEBUG: ProfileSize %0X\n", header.ProfileSize); ++ fprintf(stderr,"DEBUG: CMMtype[4] %c%c%c%c\n", header.CMMtype[0], header.CMMtype[1], header.CMMtype[2], header.CMMtype[3]); ++ fprintf(stderr,"DEBUG: ProfileVersion[4] %2X%2X%2X%2X\n", header.ProfileVersion[0], header.ProfileVersion[1], header.ProfileVersion[2], header.ProfileVersion[3]); ++ fprintf(stderr,"DEBUG: ProfileDevice[4] %c%c%c%c\n", header.ProfileDevice[0], header.ProfileDevice[1], header.ProfileDevice[2], header.ProfileDevice[3]); ++ fprintf(stderr,"DEBUG: ColorSpace[4] %c%c%c%c\n", header.ColorSpace[0], header.ColorSpace[1], header.ColorSpace[2], header.ColorSpace[3]); ++ fprintf(stderr,"DEBUG: PCS[4] %c%c%c%c\n", header.PCS[0], header.PCS[1], header.PCS[2], header.PCS[3]); ++ fprintf(stderr,"DEBUG: DatenTime[3] %lX%lX%lX\n", header.DatenTime[0], header.DatenTime[1], header.DatenTime[2]); ++ fprintf(stderr,"DEBUG: profileSig[4] %c%c%c%c\n", header.profileSig[0], header.profileSig[1], header.profileSig[2], header.profileSig[3]); ++ fprintf(stderr,"DEBUG: PrimaryPlat[4] %c%c%c%c\n", header.PrimaryPlat[0], header.PrimaryPlat[1], header.PrimaryPlat[2], header.PrimaryPlat[3]); ++ fprintf(stderr,"DEBUG: profileFlags[4] %02X %02X %02X %02X\n", header.profileFlags[0], header.profileFlags[1], header.profileFlags[2], header.profileFlags[3]); ++ fprintf(stderr,"DEBUG: DevMfg[4] %c%c%c%c\n", header.DevMfg[0], header.DevMfg[1], header.DevMfg[2], header.DevMfg[3]); ++ fprintf(stderr,"DEBUG: DevModel[4] %c%c%c%c\n", header.DevModel[0], header.DevModel[1], header.DevModel[2], header.DevModel[3]); ++ fprintf(stderr,"DEBUG: DevAttrib[8] %02X%02X%02X%02X%02X%02X%02X%02X\n", ++ header.DevAttrib[0], header.DevAttrib[1], header.DevAttrib[2], header.DevAttrib[3], ++ header.DevAttrib[4], header.DevAttrib[5], header.DevAttrib[6], header.DevAttrib[7]); ++ fprintf(stderr,"DEBUG: RendIntent[4] %02X %02X %02X %02X\n", header.RendIntent[0], header.RendIntent[1], header.RendIntent[2], header.RendIntent[3]); ++ fprintf(stderr,"DEBUG: PCSIll[3] %ld %ld %ld\n", header.PCSIll[0], header.PCSIll[1], header.PCSIll[2]); ++ fprintf(stderr,"DEBUG: profileCreattor[4] %c%c%c%c\n", header.profileCreattor[0], header.profileCreattor[1], header.profileCreattor[2], header.profileCreattor[3]); ++ fprintf(stderr,"DEBUG: profileID[4] %lX%lX%lX%lX\n\n", header.profileID[0], header.profileID[1], header.profileID[2], header.profileID[3]); ++#endif ++ ++ /* Read in Tag info */ ++ ++ lswapper = *(unsigned long *)data; ++ data += 4; ++ lswapper = (lswapper << 24) | ((lswapper << 8) & 0x00FF0000) | ((lswapper >> 8) & 0x0000FF00) | (lswapper >> 24); ++ tagCount = lswapper; ++ ++#if 0 ++ printf("Tag Count is %ld\n", tagCount); ++#endif ++ ++ for (cnt = 0; cnt < tagCount; cnt++) ++ { ++ tag1 = *(TAGTYP *)data; ++ data += 12; ++ if (strncmp((const char *)&tag1.sig[0],"B2A0",4) == 0) ++ break; ++ } ++ ++ if (cnt < tagCount) ++ { ++ for (;cnt < tagCount; cnt++) ++ { ++ tag2 = *(TAGTYP *)data; ++ data += 12; ++ if (strncmp((const char *)&tag2.sig[0],"B2A2",4) == 0) ++ break; ++ } ++ } ++ ++ tmpstr[4] = '\0'; ++ strncpy(tmpstr,(const char *)&tag1.sig[0],4); ++ lswapper = tag1.offset; ++ lswapper = (lswapper << 24) | ((lswapper << 8) & 0x00FF0000) | ((lswapper >> 8) & 0x0000FF00) | (lswapper >> 24); ++ tag1.offset = lswapper; ++ ++ lswapper = tag1.size; ++ lswapper = (lswapper << 24) | ((lswapper << 8) & 0x00FF0000) | ((lswapper >> 8) & 0x0000FF00) | (lswapper >> 24); ++ tag1.size = lswapper; ++ ++#if 1 ++ fprintf(stderr,"DEBUG:Tag1 is %s at %d, and has %d bytes\n", tmpstr, tag1.offset, tag1.size); ++#endif ++ ++ strncpy(tmpstr,(const char *)&tag2.sig[0],4); ++ lswapper = tag2.offset; ++ lswapper = (lswapper << 24) | ((lswapper << 8) & 0x00FF0000) | ((lswapper >> 8) & 0x0000FF00) | (lswapper >> 24); ++ tag2.offset = lswapper; ++ lswapper = tag2.size; ++ lswapper = (lswapper << 24) | ((lswapper << 8) & 0x00FF0000) | ((lswapper >> 8) & 0x0000FF00) | (lswapper >> 24); ++ tag2.size = lswapper; ++ ++#if 1 ++ fprintf(stderr,"DEBUG:Tag2 is %s at %d, and has %d bytes\n\n\n", tmpstr, tag2.offset, tag2.size); ++#endif ++ ++ data = alldata + tag1.offset; ++ ++ Pictures = *(LUT16TYP *)data; ++ ++/* ++ unsigned char typSig[4]; ++ unsigned char reserved[4]; ++ unsigned char numinputchannels; ++ unsigned char numoutputchannels; ++ unsigned char numGridPoints; ++ unsigned char reserved1; ++ unsigned long eparameters[9]; ++ unsigned long numInTabEntries; ++ unsigned long numOutTabEntries; ++ unsigned short InTabEntries[256*3]; ++ unsigned short CLUT[4913*3]; ++ unsigned short OutTabEntries[256*3]; ++*/ ++ ++#if 0 ++ printf("typSig[4] %c%c%c%c\n", Pictures.typSig[0], Pictures.typSig[1], Pictures.typSig[2], Pictures.typSig[3]); ++ printf("reserved[4] %02X %02X %02X %02X \n", Pictures.reserved[0], Pictures.reserved[1], Pictures.reserved[2], Pictures.reserved[3]); ++ printf("numinputchannels %d\n", Pictures.numinputchannels); ++ printf("numoutputchannels %d\n",Pictures.numoutputchannels); ++ printf("numGridPoints %d\n", Pictures.numGridPoints); ++ printf("reserved1 %d\n", Pictures.reserved1); ++#endif ++ ++ ++ sswapper = Pictures.numInTabEntries; ++ sswapper = (sswapper >> 8)|(sswapper << 8); ++ Pictures.numInTabEntries = sswapper & 0xFFFF; ++ ++ sswapper = Pictures.numOutTabEntries; ++ sswapper = (sswapper >> 8)|(sswapper << 8); ++ Pictures.numOutTabEntries = sswapper & 0xFFFF; ++ ++#if 0 ++ printf("numInTabEntries %d\n", Pictures.numInTabEntries); ++ printf("numOutTabEntries %d\n", Pictures.numOutTabEntries); ++#endif ++ ++ data = alldata + tag2.offset; ++ ++ Graphs = *(LUT16TYP *)data; ++ ++#if 0 ++ printf("typSig[4] %c%c%c%c\n", Graphs.typSig[0], Graphs.typSig[1], Pictures.typSig[2], Graphs.typSig[3]); ++ printf("reserved[4] %02X %02X %02X %02X \n", Graphs.reserved[0], Graphs.reserved[1], Graphs.reserved[2], Graphs.reserved[3]); ++ printf("numinputchannels %d\n", Graphs.numinputchannels); ++ printf("numoutputchannels %d\n",Graphs.numoutputchannels); ++ printf("numGridPoints %d\n", Graphs.numGridPoints); ++ printf("reserved1 %d\n", Graphs.reserved1); ++#endif ++ ++ sswapper = Graphs.numInTabEntries; ++ sswapper = (sswapper >> 8)|(sswapper << 8); ++ Graphs.numInTabEntries = sswapper & 0xFFFF; ++ ++ sswapper = Graphs.numOutTabEntries; ++ sswapper = (sswapper >> 8)|(sswapper << 8); ++ Graphs.numOutTabEntries = sswapper & 0xFFFF; ++ ++#if 0 ++ printf("numInTabEntries %d\n", Graphs.numInTabEntries); ++ printf("numOutTabEntries %d\n", Graphs.numOutTabEntries); ++#endif ++ ++ free(alldata); ++ ++#if 0 ++ printf("Pictures\n"); ++#endif ++#if 1 ++ fprintf(stderr,"DEBUG: Intent is %d\n",intent); ++#endif ++ switch (intent) ++ { ++ case 0: ++ for (rdex = 0; rdex < 17; rdex++) ++ for (gdex = 0; gdex < 17; gdex++) ++ for (bdex = 0; bdex < 17; bdex++) ++ { ++ rgbray[rdex][gdex][bdex].r = (float)Pictures.CLUT[rdex][gdex][bdex].r/256.0; ++ rgbray[rdex][gdex][bdex].g = (float)Pictures.CLUT[rdex][gdex][bdex].g/256.0; ++ rgbray[rdex][gdex][bdex].b = (float)Pictures.CLUT[rdex][gdex][bdex].b/256.0; ++ } ++ break; ++#if 0 ++ printf("%.2f %.2f %.2f\n", ++ (float)Pictures.CLUT[rdex][gdex][bdex].r/256.0, ++ (float)Pictures.CLUT[rdex][gdex][bdex].g/256.0, ++ (float)Pictures.CLUT[rdex][gdex][bdex].b/256.0); ++#endif ++ ++ ++#if 0 ++ printf("\n\n"); ++ ++ printf("Graphs\n"); ++#endif ++ case 1: ++ for (rdex = 0; rdex < 17; rdex++) ++ for (gdex = 0; gdex < 17; gdex++) ++ for (bdex = 0; bdex < 17; bdex++) ++ { ++ rgbray[rdex][gdex][bdex].r = (float)Graphs.CLUT[rdex][gdex][bdex].r/256.0; ++ rgbray[rdex][gdex][bdex].g = (float)Graphs.CLUT[rdex][gdex][bdex].g/256.0; ++ rgbray[rdex][gdex][bdex].b = (float)Graphs.CLUT[rdex][gdex][bdex].b/256.0; ++ } ++#if 0 ++ printf("%.2f %.2f %.2f\n", ++ (float)Graphs.CLUT[rdex][gdex][bdex].r/256.0, ++ (float)Graphs.CLUT[rdex][gdex][bdex].g/256.0, ++ (float)Graphs.CLUT[rdex][gdex][bdex].b/256.0); ++#endif ++ ++ }; ++ fclose(f1); ++ ++// std::cin >> ch; ++ ++} ++ /* ++ * 'main()' - Main entry and processing of driver. ++ */ ++ ++ ++ /* O - Exit status */ ++int main(int argc, /* I - Number of command-line arguments */ ++ char *argv[]) /* I - Command-line arguments */ ++{ ++ int fd; /* File descriptor */ ++ cups_raster_t *ras; /* Raster stream for printing */ ++ cups_page_header_t header; /* Page header from file */ ++ int page; /* Current page */ ++ int y; /* Current line */ ++ ppd_file_t *ppd; /* PPD file */ ++ int num_options; /* Number of options */ ++ cups_option_t *options; /* Options */ ++ int profileRead; /* Read the profile once */ ++ int intent; /* Selected intent */ ++ ++ profileRead = 0; ++ /* ++ * Make sure status messages are not buffered... ++ */ ++ ++ setbuf(stderr, NULL); ++ ++ /* ++ Load ICC profile. ++ */ ++ /* ++ * Check command-line... ++ */ ++ ++ if (argc < 6 || argc > 7) ++ { ++ fputs("ERROR: rastertoprx920 job-id user title copies options [file]\n", stderr); ++ return (1); ++ } ++ ++ num_options = cupsParseOptions(argv[5], 0, &options); ++ ++ /* ++ * Open the PPD file... ++ */ ++ ++ ppd = ppdOpenFile(getenv("PPD")); ++ ++ if (!ppd) ++ { ++ fputs("ERROR: Unable to open PPD file!\n", stderr); ++ return (1); ++ } ++ ++ ppdMarkDefaults(ppd); ++ cupsMarkOptions(ppd, num_options, options); ++ ++ /* ++ * Open the page stream... ++ */ ++ ++ if (argc == 7) ++ { ++ if ((fd = open(argv[6], O_RDONLY)) == -1) ++ { ++ perror("ERROR: Unable to open raster file - "); ++ return (1); ++ } ++ } ++ else ++ fd = 0; ++ ++ ras = cupsRasterOpen(fd, CUPS_RASTER_READ); ++ ++ /* ++ * Initialize the print device... ++ */ ++ ++ Setup(ppd); ++ ++ /* ++ * Process pages as needed... ++ */ ++ ++ page = 0; ++ ++ ++ while (cupsRasterReadHeader(ras, &header)) ++ { ++ if (!profileRead) ++ { ++ intent = 0; ++ if (header.MediaWeight == 0) ++ intent = 0; ++ if (header.MediaWeight == 1) ++ intent = 1; ++ ++ readInProfile(intent); ++ profileRead = 1; ++ ++ // If form feed at start of job ++ if (header.AdvanceMedia & 1) ++ putchar(12); ++ } ++ page ++; ++ ++ fprintf(stderr, "PAGE: %d 1\n", page); ++ fprintf(stderr, "DEBUG: Starting page %d...\n", page); ++ ++ StartPage(ppd, &header); ++ ++ fprintf(stderr,"DEBUG: Now printing %d rasters\n\r",header.cupsHeight); ++ for (y = 0; y < header.cupsHeight; y ++) ++ { ++ if ((y & 127) == 0) ++ fprintf(stderr, "DEBUG: Printing page %d, %d%% complete...\n", page, ++ 100 * y / header.cupsHeight); ++ ++ ProcessLine(ppd, ras, &header); ++ } ++ ++ fprintf(stderr, "DEBUG: Finished page %d...\n", page); ++ ++ EndPage(ppd, &header); ++ ++ if (header.AdvanceDistance == 2) ++ printf("%c",11); ++ else if (header.AdvanceDistance == 3) ++ printf("%c",12); ++ } ++ ++ Shutdown(ppd); ++ ++ cupsRasterClose(ras); ++ ++ if (fd != 0) ++ close(fd); ++ ++ if (page == 0) ++ { ++ fputs("ERROR: No pages found!\n", stderr); ++ return (1); ++ } ++ else ++ { ++ fputs("INFO: Ready to print.\n", stderr); ++ return (0); ++ } ++} ++ ++ +Index: cups-1.3.9/ppd/printrex1242.ppd +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ cups-1.3.9/ppd/printrex1242.ppd 2014-02-25 16:36:17.097182556 +0000 +@@ -0,0 +1,103 @@ ++*PPD-Adobe: "4.3" ++*% PPD file for 1242 with CUPS. ++*% Revision 1 Initial release ++*FormatVersion: "4.3" ++*FileVersion: "1.0" ++*LanguageVersion: English ++*LanguageEncoding: ISOLatin1 ++*PCFileName: "printrex1242.ppd" ++*Product: "(ESP Ghostscript)" ++*Product: "(GPL Ghostscript)" ++*Product: "(GNU Ghostscript)" ++*Manufacturer: "Printrex" ++*ModelName: "Printrex 1242" ++*ShortNickName: "Printrex 1242" ++*NickName: "Prx _1242, 1.0" ++*PSVersion: "(3010.000) 705" ++*PSVersion: "(3010.000) 707" ++*PSVersion: "(3010.000) 815" ++*PSVersion: "(3010.000) 853" ++*LanguageLevel: "3" ++*ColorDevice: False ++*DefaultColorSpace: Gray ++*FileSystem: False ++*Throughput: "1" ++*LandscapeOrientation: Plus90 ++*TTRasterizer: None ++*% Driver-defined attributes... ++*cupsVersion: 1.2 ++*cupsModelNumber: 0 ++*cupsManualCopies: False ++*cupsFilter: "application/vnd.cups-raster 0 rastertoprx1242" ++*OpenUI *Resolution ++*DefaultResolution: 203dpi ++*Resolution 203dpi/203 DPI: "<>setpagedevice" ++*CloseUI: *Resolution ++*OpenUI *PageSize/Media Size: PickOne ++*OrderDependency: 10 AnySetup *PageSize ++*DefaultPageSize: Letter ++*PageSize Letter/Letter - 12x11in: "<>setpagedevice" ++*CloseUI: *PageSize ++*OpenUI *Pagination: PickOne ++*DefaultPagination: Continuous ++*Pagination Continuous: "<>setpagedevice" ++*Pagination Paginated: "<>setpagedevice" ++*Pagination FormFeed: "<>setpagedevice" ++*CloseUI: *AdvanceDistance ++*OpenUI *PrintSpeed: PickOne ++*DefaultPrintSpeed: 4ips ++*PrintSpeed 1ips: "<>setpagedevice" ++*PrintSpeed 2ips: "<>setpagedevice" ++*PrintSpeed 3ips: "<>setpagedevice" ++*PrintSpeed 4ips: "<>setpagedevice" ++*CloseUI: *PrintSpeed ++*OpenUI *PageRegion/Media Size: PickOne ++*OrderDependency: 10 AnySetup *PageRegion ++*DefaultPageRegion: Letter ++*PageRegion Letter/Letter - 12x11in: "<>setpagedevice" ++*CloseUI: *PageRegion ++*DefaultImageableArea: Letter ++*ImageableArea Letter/Letter - 12x11in: "0.00 0.00 840.00 792.00" ++*DefaultPaperDimension: Letter ++*PaperDimension Letter/Letter - 12x11in: "840.00 792.00" ++*RequiresPageRegion All: True ++*OpenUI *MediaType/Media Type: PickOne ++*OrderDependency: 10.0 AnySetup *MediaType ++*DefaultMediaType: PrintrexRoll ++*MediaType PrintrexRoll: "<>setpagedevice" ++*MediaType ClearFilm: "<>setpagedevice" ++*CloseUI: *MediaType ++*OpenUI *ColorModel/Color Mode: PickOne ++*OrderDependency: 10.0 AnySetup *ColorModel ++*DefaultColorModel: Black ++*ColorModel Black: "<>setpagedevice" ++*ColorModel Grayscale: "<>setpagedevice" ++*CloseUI: *ColorModel ++*OpenUI *PrintIntensity ++*OrderDependency: 10.0 AnySetup *PrintIntensity ++*DefaultPrintIntensity: Normal ++*PrintIntensity Down50: "<>setpagedevice" ++*PrintIntensity Down45: "<>setpagedevice" ++*PrintIntensity Down40: "<>setpagedevice" ++*PrintIntensity Down35: "<>setpagedevice" ++*PrintIntensity Down30: "<>setpagedevice" ++*PrintIntensity Down25: "<>setpagedevice" ++*PrintIntensity Down20: "<>setpagedevice" ++*PrintIntensity Down15: "<>setpagedevice" ++*PrintIntensity Down10: "<>setpagedevice" ++*PrintIntensity Down5: "<>setpagedevice" ++*PrintIntensity Normal: "<>setpagedevice" ++*PrintIntensity Up5: "<>setpagedevice" ++*PrintIntensity Up10: "<>setpagedevice" ++*PrintIntensity Up15: "<>setpagedevice" ++*PrintIntensity Up20: "<>setpagedevice" ++*PrintIntensity Up25: "<>setpagedevice" ++*PrintIntensity Up30: "<>setpagedevice" ++*PrintIntensity Up35: "<>setpagedevice" ++*PrintIntensity Up40: "<>setpagedevice" ++*PrintIntensity Up45: "<>setpagedevice" ++*PrintIntensity Up50: "<>setpagedevice" ++*CloseUI: *PrintIntensity ++*DefaultFont: Courier ++*Font Courier:: Standard "(1.05)" Standard ROM ++*% End of printrex.ppd, 02968 bytes. +Index: cups-1.3.9/ppd/printrex820.ppd +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ cups-1.3.9/ppd/printrex820.ppd 2014-02-25 16:36:17.097182556 +0000 +@@ -0,0 +1,80 @@ ++*PPD-Adobe: "4.3" ++*% PPD file for 820 with CUPS. ++*% Revision 1 Initial release ++*FormatVersion: "4.3" ++*FileVersion: "1.0" ++*LanguageVersion: English ++*LanguageEncoding: ISOLatin1 ++*PCFileName: "printrex820.ppd" ++*Product: "(ESP Ghostscript)" ++*Product: "(GPL Ghostscript)" ++*Product: "(GNU Ghostscript)" ++*Manufacturer: "Printrex" ++*ModelName: "Printrex 820" ++*ShortNickName: "Printrex 820" ++*NickName: "Prx _820DL, 1.0" ++*PSVersion: "(3010.000) 705" ++*PSVersion: "(3010.000) 707" ++*PSVersion: "(3010.000) 815" ++*PSVersion: "(3010.000) 853" ++*LanguageLevel: "3" ++*ColorDevice: False ++*DefaultColorSpace: Gray ++*FileSystem: False ++*Throughput: "1" ++*LandscapeOrientation: Plus90 ++*TTRasterizer: None ++*% Driver-defined attributes... ++*cupsVersion: 1.2 ++*cupsModelNumber: 0 ++*cupsManualCopies: False ++*cupsFilter: "application/vnd.cups-raster 0 rastertoprx20" ++*OpenUI *Resolution ++*DefaultResolution: 203dpi ++*Resolution 203dpi/203 DPI: "<>setpagedevice" ++*CloseUI: *Resolution ++*OpenUI *PageSize/Media Size: PickOne ++*OrderDependency: 10 AnySetup *PageSize ++*DefaultPageSize: Letter ++*PageSize Letter/Letter - 8.5x11in: "<>setpagedevice" ++*CloseUI: *PageSize ++*OpenUI *Pagination: PickOne ++*DefaultPagination: Continuous ++*Pagination Continuous: "<>setpagedevice" ++*Pagination Paginated: "<>setpagedevice" ++*Pagination FormFeed: "<>setpagedevice" ++*CloseUI: *AdvanceDistance ++*OpenUI *PrintSpeed: PickOne ++*DefaultPrintSpeed: Full ++*PrintSpeed Quarter: "<>setpagedevice" ++*PrintSpeed Half: "<>setpagedevice" ++*PrintSpeed ThreeQuarter: "<>setpagedevice" ++*PrintSpeed Full: "<>setpagedevice" ++*CloseUI: *PrintSpeed ++*OpenUI *PageRegion/Media Size: PickOne ++*OrderDependency: 10 AnySetup *PageRegion ++*DefaultPageRegion: Letter ++*PageRegion Letter/Letter - 8.5x11in: "<>setpagedevice" ++*CloseUI: *PageRegion ++*DefaultImageableArea: Letter ++*ImageableArea Letter/Letter - 8.5x11in: "0.00 0.00 612.00 792.00" ++*DefaultPaperDimension: Letter ++*PaperDimension Letter/Letter - 8.5x11in: "612.00 792.00" ++*RequiresPageRegion All: True ++*ColorModel Black: "<>setpagedevice" ++*OpenUI *MediaType/Media Type: PickOne ++*OrderDependency: 10.0 AnySetup *MediaType ++*DefaultMediaType: Paper ++*MediaType Paper: "<>setpagedevice" ++*MediaType Film: "<>setpagedevice" ++*CloseUI: *MediaType ++*OpenUI *PrintIntensity ++*OrderDependency: 10.0 AnySetup *PrintIntensity ++*DefaultPrintIntensity: Normal ++*PrintIntensity Low: "<>setpagedevice" ++*PrintIntensity Normal: "<>setpagedevice" ++*PrintIntensity High: "<>setpagedevice" ++*CloseUI: *PrintIntensity ++*DefaultFont: Courier ++*Font Courier:: Standard "(1.05)" Standard ROM ++*% End of printrex.ppd, 02968 bytes. +Index: cups-1.3.9/ppd/printrex822.ppd +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ cups-1.3.9/ppd/printrex822.ppd 2014-02-25 16:36:17.097182556 +0000 +@@ -0,0 +1,101 @@ ++*PPD-Adobe: "4.3" ++*% PPD file for 822 with CUPS. ++*% Revision 1 Initial release ++*FormatVersion: "4.3" ++*FileVersion: "1.0" ++*LanguageVersion: English ++*LanguageEncoding: ISOLatin1 ++*PCFileName: "printrex822.ppd" ++*Product: "(ESP Ghostscript)" ++*Product: "(GPL Ghostscript)" ++*Product: "(GNU Ghostscript)" ++*Manufacturer: "Printrex" ++*ModelName: "Printrex 822" ++*ShortNickName: "Printrex 822" ++*NickName: "Prx _822DLG, 1.0" ++*PSVersion: "(3010.000) 705" ++*PSVersion: "(3010.000) 707" ++*PSVersion: "(3010.000) 815" ++*PSVersion: "(3010.000) 853" ++*LanguageLevel: "3" ++*ColorDevice: False ++*DefaultColorSpace: Gray ++*FileSystem: False ++*Throughput: "1" ++*LandscapeOrientation: Plus90 ++*TTRasterizer: None ++*% Driver-defined attributes... ++*cupsVersion: 1.2 ++*cupsModelNumber: 0 ++*cupsManualCopies: False ++*cupsFilter: "application/vnd.cups-raster 0 rastertoprx22" ++*OpenUI *Resolution ++*DefaultResolution: 203dpi ++*Resolution 203dpi/203 DPI: "<>setpagedevice" ++*CloseUI: *Resolution ++*OpenUI *PageSize/Media Size: PickOne ++*OrderDependency: 10 AnySetup *PageSize ++*DefaultPageSize: Letter ++*PageSize Letter/Letter - 8.5x11in: "<>setpagedevice" ++*CloseUI: *PageSize ++*OpenUI *Pagination: PickOne ++*DefaultPagination: Continuous ++*Pagination Continuous: "<>setpagedevice" ++*Pagination Paginated: "<>setpagedevice" ++*Pagination FormFeed: "<>setpagedevice" ++*CloseUI: *AdvanceDistance ++*OpenUI *PrintSpeed: PickOne ++*DefaultPrintSpeed: 2ips ++*PrintSpeed 1ips: "<>setpagedevice" ++*PrintSpeed 2ips: "<>setpagedevice" ++*CloseUI: *PrintSpeed ++*OpenUI *PageRegion/Media Size: PickOne ++*OrderDependency: 10 AnySetup *PageRegion ++*DefaultPageRegion: Letter ++*PageRegion Letter/Letter - 8.5x11in: "<>setpagedevice" ++*CloseUI: *PageRegion ++*DefaultImageableArea: Letter ++*ImageableArea Letter/Letter - 8.5x11in: "0.00 0.00 612.00 792.00" ++*DefaultPaperDimension: Letter ++*PaperDimension Letter/Letter - 8.5x11in: "612.00 792.00" ++*RequiresPageRegion All: True ++*OpenUI *MediaType/Media Type: PickOne ++*OrderDependency: 10.0 AnySetup *MediaType ++*DefaultMediaType: PrintrexRoll ++*MediaType PrintrexRoll: "<>setpagedevice" ++*MediaType Heavyweight: "<>setpagedevice" ++*CloseUI: *MediaType ++*OpenUI *ColorModel/Color Mode: PickOne ++*OrderDependency: 10.0 AnySetup *ColorModel ++*DefaultColorModel: Black ++*ColorModel Black: "<>setpagedevice" ++*ColorModel Grayscale: "<>setpagedevice" ++*CloseUI: *ColorModel ++*OpenUI *PrintIntensity ++*OrderDependency: 10.0 AnySetup *PrintIntensity ++*DefaultPrintIntensity: Normal ++*PrintIntensity Down50: "<>setpagedevice" ++*PrintIntensity Down45: "<>setpagedevice" ++*PrintIntensity Down40: "<>setpagedevice" ++*PrintIntensity Down35: "<>setpagedevice" ++*PrintIntensity Down30: "<>setpagedevice" ++*PrintIntensity Down25: "<>setpagedevice" ++*PrintIntensity Down20: "<>setpagedevice" ++*PrintIntensity Down15: "<>setpagedevice" ++*PrintIntensity Down10: "<>setpagedevice" ++*PrintIntensity Down5: "<>setpagedevice" ++*PrintIntensity Normal: "<>setpagedevice" ++*PrintIntensity Up5: "<>setpagedevice" ++*PrintIntensity Up10: "<>setpagedevice" ++*PrintIntensity Up15: "<>setpagedevice" ++*PrintIntensity Up20: "<>setpagedevice" ++*PrintIntensity Up25: "<>setpagedevice" ++*PrintIntensity Up30: "<>setpagedevice" ++*PrintIntensity Up35: "<>setpagedevice" ++*PrintIntensity Up40: "<>setpagedevice" ++*PrintIntensity Up45: "<>setpagedevice" ++*PrintIntensity Up50: "<>setpagedevice" ++*CloseUI: *PrintIntensity ++*DefaultFont: Courier ++*Font Courier:: Standard "(1.05)" Standard ROM ++*% End of printrex.ppd, 02968 bytes. +Index: cups-1.3.9/ppd/printrex823.ppd +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ cups-1.3.9/ppd/printrex823.ppd 2014-02-25 16:36:17.097182556 +0000 +@@ -0,0 +1,101 @@ ++*PPD-Adobe: "4.3" ++*% PPD file for 823 with CUPS. ++*% Revision 1 Initial release ++*FormatVersion: "4.3" ++*FileVersion: "1.0" ++*LanguageVersion: English ++*LanguageEncoding: ISOLatin1 ++*PCFileName: "printrex823.ppd" ++*Product: "(ESP Ghostscript)" ++*Product: "(GPL Ghostscript)" ++*Product: "(GNU Ghostscript)" ++*Manufacturer: "Printrex" ++*ModelName: "Printrex 823" ++*ShortNickName: "Printrex 823" ++*NickName: "Prx _823DLG, 1.0" ++*PSVersion: "(3010.000) 705" ++*PSVersion: "(3010.000) 707" ++*PSVersion: "(3010.000) 815" ++*PSVersion: "(3010.000) 853" ++*LanguageLevel: "3" ++*ColorDevice: False ++*DefaultColorSpace: Gray ++*FileSystem: False ++*Throughput: "1" ++*LandscapeOrientation: Plus90 ++*TTRasterizer: None ++*% Driver-defined attributes... ++*cupsVersion: 1.2 ++*cupsModelNumber: 0 ++*cupsManualCopies: False ++*cupsFilter: "application/vnd.cups-raster 0 rastertoprx23" ++*OpenUI *Resolution ++*DefaultResolution: 300dpi ++*Resolution 300dpi/300 DPI: "<>setpagedevice" ++*CloseUI: *Resolution ++*OpenUI *PageSize/Media Size: PickOne ++*OrderDependency: 10 AnySetup *PageSize ++*DefaultPageSize: Letter ++*PageSize Letter/Letter - 8.5x11in: "<>setpagedevice" ++*CloseUI: *PageSize ++*OpenUI *Pagination: PickOne ++*DefaultPagination: Continuous ++*Pagination Continuous: "<>setpagedevice" ++*Pagination Paginated: "<>setpagedevice" ++*Pagination FormFeed: "<>setpagedevice" ++*CloseUI: *AdvanceDistance ++*OpenUI *PrintSpeed: PickOne ++*DefaultPrintSpeed: 2ips ++*PrintSpeed 1ips: "<>setpagedevice" ++*PrintSpeed 2ips: "<>setpagedevice" ++*CloseUI: *PrintSpeed ++*OpenUI *PageRegion/Media Size: PickOne ++*OrderDependency: 10 AnySetup *PageRegion ++*DefaultPageRegion: Letter ++*PageRegion Letter/Letter - 8.5x11in: "<>setpagedevice" ++*CloseUI: *PageRegion ++*DefaultImageableArea: Letter ++*ImageableArea Letter/Letter - 8.5x11in: "0.00 0.00 612.00 792.00" ++*DefaultPaperDimension: Letter ++*PaperDimension Letter/Letter - 8.5x11in: "612.00 792.00" ++*RequiresPageRegion All: True ++*OpenUI *MediaType/Media Type: PickOne ++*OrderDependency: 10.0 AnySetup *MediaType ++*DefaultMediaType: PrintrexRoll ++*MediaType PrintrexRoll: "<>setpagedevice" ++*MediaType Heavyweight: "<>setpagedevice" ++*CloseUI: *MediaType ++*OpenUI *ColorModel/Color Interpretation: PickOne ++*OrderDependency: 10.0 AnySetup *ColorModel ++*DefaultColorModel: Black ++*ColorModel Black: "<>setpagedevice" ++*ColorModel Grayscale: "<>setpagedevice" ++*CloseUI: *ColorModel ++*OpenUI *PrintIntensity ++*OrderDependency: 10.0 AnySetup *PrintIntensity ++*DefaultPrintIntensity: Normal ++*PrintIntensity Down50: "<>setpagedevice" ++*PrintIntensity Down45: "<>setpagedevice" ++*PrintIntensity Down40: "<>setpagedevice" ++*PrintIntensity Down35: "<>setpagedevice" ++*PrintIntensity Down30: "<>setpagedevice" ++*PrintIntensity Down25: "<>setpagedevice" ++*PrintIntensity Down20: "<>setpagedevice" ++*PrintIntensity Down15: "<>setpagedevice" ++*PrintIntensity Down10: "<>setpagedevice" ++*PrintIntensity Down5: "<>setpagedevice" ++*PrintIntensity Normal: "<>setpagedevice" ++*PrintIntensity Up5: "<>setpagedevice" ++*PrintIntensity Up10: "<>setpagedevice" ++*PrintIntensity Up15: "<>setpagedevice" ++*PrintIntensity Up20: "<>setpagedevice" ++*PrintIntensity Up25: "<>setpagedevice" ++*PrintIntensity Up30: "<>setpagedevice" ++*PrintIntensity Up35: "<>setpagedevice" ++*PrintIntensity Up40: "<>setpagedevice" ++*PrintIntensity Up45: "<>setpagedevice" ++*PrintIntensity Up50: "<>setpagedevice" ++*CloseUI: *PrintIntensity ++*DefaultFont: Courier ++*Font Courier:: Standard "(1.05)" Standard ROM ++*% End of printrex.ppd, 02968 bytes. +Index: cups-1.3.9/ppd/printrex840.ppd +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ cups-1.3.9/ppd/printrex840.ppd 2014-02-25 16:36:17.097182556 +0000 +@@ -0,0 +1,103 @@ ++*PPD-Adobe: "4.3" ++*% PPD file for 840 with CUPS. ++*% Revision 1 Initial release ++*FormatVersion: "4.3" ++*FileVersion: "1.0" ++*LanguageVersion: English ++*LanguageEncoding: ISOLatin1 ++*PCFileName: "printrex840.ppd" ++*Product: "(ESP Ghostscript)" ++*Product: "(GPL Ghostscript)" ++*Product: "(GNU Ghostscript)" ++*Manufacturer: "Printrex" ++*ModelName: "Printrex 840" ++*ShortNickName: "Printrex 840" ++*NickName: "Prx _840DLG, 1.0" ++*PSVersion: "(3010.000) 705" ++*PSVersion: "(3010.000) 707" ++*PSVersion: "(3010.000) 815" ++*PSVersion: "(3010.000) 853" ++*LanguageLevel: "3" ++*ColorDevice: False ++*DefaultColorSpace: Gray ++*FileSystem: False ++*Throughput: "1" ++*LandscapeOrientation: Plus90 ++*TTRasterizer: None ++*% Driver-defined attributes... ++*cupsVersion: 1.2 ++*cupsModelNumber: 0 ++*cupsManualCopies: False ++*cupsFilter: "application/vnd.cups-raster 0 rastertoprx40" ++*OpenUI *Resolution ++*DefaultResolution: 203dpi ++*Resolution 203dpi/203 DPI: "<>setpagedevice" ++*CloseUI: *Resolution ++*OpenUI *PageSize/Media Size: PickOne ++*OrderDependency: 10 AnySetup *PageSize ++*DefaultPageSize: Letter ++*PageSize Letter/Letter - 8.5x11in: "<>setpagedevice" ++*CloseUI: *PageSize ++*OpenUI *Pagination: PickOne ++*DefaultPagination: Continuous ++*Pagination Continuous: "<>setpagedevice" ++*Pagination Paginated: "<>setpagedevice" ++*Pagination FormFeed: "<>setpagedevice" ++*CloseUI: *AdvanceDistance ++*OpenUI *PrintSpeed: PickOne ++*DefaultPrintSpeed: 2ips ++*PrintSpeed 1ips: "<>setpagedevice" ++*PrintSpeed 2ips: "<>setpagedevice" ++*PrintSpeed 3ips: "<>setpagedevice" ++*PrintSpeed 4ips: "<>setpagedevice" ++*CloseUI: *PrintSpeed ++*OpenUI *PageRegion/Media Size: PickOne ++*OrderDependency: 10 AnySetup *PageRegion ++*DefaultPageRegion: Letter ++*PageRegion Letter/Letter - 8.5x11in: "<>setpagedevice" ++*CloseUI: *PageRegion ++*DefaultImageableArea: Letter ++*ImageableArea Letter/Letter - 8.5x11in: "0.00 0.00 612.00 792.00" ++*DefaultPaperDimension: Letter ++*PaperDimension Letter/Letter - 8.5x11in: "612.00 792.00" ++*RequiresPageRegion All: True ++*OpenUI *MediaType/Media Type: PickOne ++*OrderDependency: 10.0 AnySetup *MediaType ++*DefaultMediaType: PrintrexRoll ++*MediaType PrintrexRoll: "<>setpagedevice" ++*MediaType Heavyweight: "<>setpagedevice" ++*CloseUI: *MediaType ++*OpenUI *ColorModel/Color Mode: PickOne ++*OrderDependency: 10.0 AnySetup *ColorModel ++*DefaultColorModel: Black ++*ColorModel Black: "<>setpagedevice" ++*ColorModel Grayscale: "<>setpagedevice" ++*CloseUI: *ColorModel ++*OpenUI *PrintIntensity ++*OrderDependency: 10.0 AnySetup *PrintIntensity ++*DefaultPrintIntensity: Normal ++*PrintIntensity Down50: "<>setpagedevice" ++*PrintIntensity Down45: "<>setpagedevice" ++*PrintIntensity Down40: "<>setpagedevice" ++*PrintIntensity Down35: "<>setpagedevice" ++*PrintIntensity Down30: "<>setpagedevice" ++*PrintIntensity Down25: "<>setpagedevice" ++*PrintIntensity Down20: "<>setpagedevice" ++*PrintIntensity Down15: "<>setpagedevice" ++*PrintIntensity Down10: "<>setpagedevice" ++*PrintIntensity Down5: "<>setpagedevice" ++*PrintIntensity Normal: "<>setpagedevice" ++*PrintIntensity Up5: "<>setpagedevice" ++*PrintIntensity Up10: "<>setpagedevice" ++*PrintIntensity Up15: "<>setpagedevice" ++*PrintIntensity Up20: "<>setpagedevice" ++*PrintIntensity Up25: "<>setpagedevice" ++*PrintIntensity Up30: "<>setpagedevice" ++*PrintIntensity Up35: "<>setpagedevice" ++*PrintIntensity Up40: "<>setpagedevice" ++*PrintIntensity Up45: "<>setpagedevice" ++*PrintIntensity Up50: "<>setpagedevice" ++*CloseUI: *PrintIntensity ++*DefaultFont: Courier ++*Font Courier:: Standard "(1.05)" Standard ROM ++*% End of printrex.ppd, 02968 bytes. +Index: cups-1.3.9/ppd/printrex842.ppd +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ cups-1.3.9/ppd/printrex842.ppd 2014-02-25 16:36:17.097182556 +0000 +@@ -0,0 +1,103 @@ ++*PPD-Adobe: "4.3" ++*% PPD file for 842 with CUPS. ++*% Revision 1 Initial release ++*FormatVersion: "4.3" ++*FileVersion: "1.0" ++*LanguageVersion: English ++*LanguageEncoding: ISOLatin1 ++*PCFileName: "printrex842.ppd" ++*Product: "(ESP Ghostscript)" ++*Product: "(GPL Ghostscript)" ++*Product: "(GNU Ghostscript)" ++*Manufacturer: "Printrex" ++*ModelName: "Printrex 842" ++*ShortNickName: "Printrex 842" ++*NickName: "Prx _842DLG, 1.0" ++*PSVersion: "(3010.000) 705" ++*PSVersion: "(3010.000) 707" ++*PSVersion: "(3010.000) 815" ++*PSVersion: "(3010.000) 853" ++*LanguageLevel: "3" ++*ColorDevice: False ++*DefaultColorSpace: Gray ++*FileSystem: False ++*Throughput: "1" ++*LandscapeOrientation: Plus90 ++*TTRasterizer: None ++*% Driver-defined attributes... ++*cupsVersion: 1.2 ++*cupsModelNumber: 0 ++*cupsManualCopies: False ++*cupsFilter: "application/vnd.cups-raster 0 rastertoprx42" ++*OpenUI *Resolution ++*DefaultResolution: 203dpi ++*Resolution 203dpi/203 DPI: "<>setpagedevice" ++*CloseUI: *Resolution ++*OpenUI *PageSize/Media Size: PickOne ++*OrderDependency: 10 AnySetup *PageSize ++*DefaultPageSize: Letter ++*PageSize Letter/Letter - 8.5x11in: "<>setpagedevice" ++*CloseUI: *PageSize ++*OpenUI *Pagination: PickOne ++*DefaultPagination: Continuous ++*Pagination Continuous: "<>setpagedevice" ++*Pagination Paginated: "<>setpagedevice" ++*Pagination FormFeed: "<>setpagedevice" ++*CloseUI: *AdvanceDistance ++*OpenUI *PrintSpeed: PickOne ++*DefaultPrintSpeed: 2ips ++*PrintSpeed 1ips: "<>setpagedevice" ++*PrintSpeed 2ips: "<>setpagedevice" ++*PrintSpeed 3ips: "<>setpagedevice" ++*PrintSpeed 4ips: "<>setpagedevice" ++*CloseUI: *PrintSpeed ++*OpenUI *PageRegion/Media Size: PickOne ++*OrderDependency: 10 AnySetup *PageRegion ++*DefaultPageRegion: Letter ++*PageRegion Letter/Letter - 8.5x11in: "<>setpagedevice" ++*CloseUI: *PageRegion ++*DefaultImageableArea: Letter ++*ImageableArea Letter/Letter - 8.5x11in: "0.00 0.00 612.00 792.00" ++*DefaultPaperDimension: Letter ++*PaperDimension Letter/Letter - 8.5x11in: "612.00 792.00" ++*RequiresPageRegion All: True ++*OpenUI *MediaType/Media Type: PickOne ++*OrderDependency: 10.0 AnySetup *MediaType ++*DefaultMediaType: PrintrexRoll ++*MediaType PrintrexRoll: "<>setpagedevice" ++*MediaType Heavyweight: "<>setpagedevice" ++*CloseUI: *MediaType ++*OpenUI *ColorModel/Color Mode: PickOne ++*OrderDependency: 10.0 AnySetup *ColorModel ++*DefaultColorModel: Black ++*ColorModel Black: "<>setpagedevice" ++*ColorModel Grayscale: "<>setpagedevice" ++*CloseUI: *ColorModel ++*OpenUI *PrintIntensity ++*OrderDependency: 10.0 AnySetup *PrintIntensity ++*DefaultPrintIntensity: Normal ++*PrintIntensity Down50: "<>setpagedevice" ++*PrintIntensity Down45: "<>setpagedevice" ++*PrintIntensity Down40: "<>setpagedevice" ++*PrintIntensity Down35: "<>setpagedevice" ++*PrintIntensity Down30: "<>setpagedevice" ++*PrintIntensity Down25: "<>setpagedevice" ++*PrintIntensity Down20: "<>setpagedevice" ++*PrintIntensity Down15: "<>setpagedevice" ++*PrintIntensity Down10: "<>setpagedevice" ++*PrintIntensity Down5: "<>setpagedevice" ++*PrintIntensity Normal: "<>setpagedevice" ++*PrintIntensity Up5: "<>setpagedevice" ++*PrintIntensity Up10: "<>setpagedevice" ++*PrintIntensity Up15: "<>setpagedevice" ++*PrintIntensity Up20: "<>setpagedevice" ++*PrintIntensity Up25: "<>setpagedevice" ++*PrintIntensity Up30: "<>setpagedevice" ++*PrintIntensity Up35: "<>setpagedevice" ++*PrintIntensity Up40: "<>setpagedevice" ++*PrintIntensity Up45: "<>setpagedevice" ++*PrintIntensity Up50: "<>setpagedevice" ++*CloseUI: *PrintIntensity ++*DefaultFont: Courier ++*Font Courier:: Standard "(1.05)" Standard ROM ++*% End of printrex.ppd, 02968 bytes. +Index: cups-1.3.9/ppd/printrex843.ppd +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ cups-1.3.9/ppd/printrex843.ppd 2014-02-25 16:36:17.097182556 +0000 +@@ -0,0 +1,103 @@ ++*PPD-Adobe: "4.3" ++*% PPD file for 843 with CUPS. ++*% Revision 1 Initial release ++*FormatVersion: "4.3" ++*FileVersion: "1.0" ++*LanguageVersion: English ++*LanguageEncoding: ISOLatin1 ++*PCFileName: "printrex843.ppd" ++*Product: "(ESP Ghostscript)" ++*Product: "(GPL Ghostscript)" ++*Product: "(GNU Ghostscript)" ++*Manufacturer: "Printrex" ++*ModelName: "Printrex 843" ++*ShortNickName: "Printrex 843" ++*NickName: "Prx _843DLG, 1.0" ++*PSVersion: "(3010.000) 705" ++*PSVersion: "(3010.000) 707" ++*PSVersion: "(3010.000) 815" ++*PSVersion: "(3010.000) 853" ++*LanguageLevel: "3" ++*ColorDevice: False ++*DefaultColorSpace: Gray ++*FileSystem: False ++*Throughput: "1" ++*LandscapeOrientation: Plus90 ++*TTRasterizer: None ++*% Driver-defined attributes... ++*cupsVersion: 1.2 ++*cupsModelNumber: 0 ++*cupsManualCopies: False ++*cupsFilter: "application/vnd.cups-raster 0 rastertoprx43" ++*OpenUI *Resolution ++*DefaultResolution: 300dpi ++*Resolution 300dpi/300 DPI: "<>setpagedevice" ++*CloseUI: *Resolution ++*OpenUI *PageSize/Media Size: PickOne ++*OrderDependency: 10 AnySetup *PageSize ++*DefaultPageSize: Letter ++*PageSize Letter/Letter - 8.5x11in: "<>setpagedevice" ++*CloseUI: *PageSize ++*OpenUI *Pagination: PickOne ++*DefaultPagination: Continuous ++*Pagination Continuous: "<>setpagedevice" ++*Pagination Paginated: "<>setpagedevice" ++*Pagination FormFeed: "<>setpagedevice" ++*CloseUI: *AdvanceDistance ++*OpenUI *PrintSpeed: PickOne ++*DefaultPrintSpeed: 4ips ++*PrintSpeed 1ips: "<>setpagedevice" ++*PrintSpeed 2ips: "<>setpagedevice" ++*PrintSpeed 3ips: "<>setpagedevice" ++*PrintSpeed 4ips: "<>setpagedevice" ++*CloseUI: *PrintSpeed ++*OpenUI *PageRegion/Media Size: PickOne ++*OrderDependency: 10 AnySetup *PageRegion ++*DefaultPageRegion: Letter ++*PageRegion Letter/Letter - 8.5x11in: "<>setpagedevice" ++*CloseUI: *PageRegion ++*DefaultImageableArea: Letter ++*ImageableArea Letter/Letter - 8.5x11in: "0.00 0.00 612.00 792.00" ++*DefaultPaperDimension: Letter ++*PaperDimension Letter/Letter - 8.5x11in: "612.00 792.00" ++*RequiresPageRegion All: True ++*OpenUI *MediaType/Media Type: PickOne ++*OrderDependency: 10.0 AnySetup *MediaType ++*DefaultMediaType: PrintrexRoll ++*MediaType PrintrexRoll: "<>setpagedevice" ++*MediaType Heavyweight: "<>setpagedevice" ++*CloseUI: *MediaType ++*OpenUI *ColorModel/Color Interpretation: PickOne ++*OrderDependency: 10.0 AnySetup *ColorModel ++*DefaultColorModel: Black ++*ColorModel Black: "<>setpagedevice" ++*ColorModel Grayscale: "<>setpagedevice" ++*CloseUI: *ColorModel ++*OpenUI *PrintIntensity ++*OrderDependency: 10.0 AnySetup *PrintIntensity ++*DefaultPrintIntensity: Normal ++*PrintIntensity Down50: "<>setpagedevice" ++*PrintIntensity Down45: "<>setpagedevice" ++*PrintIntensity Down40: "<>setpagedevice" ++*PrintIntensity Down35: "<>setpagedevice" ++*PrintIntensity Down30: "<>setpagedevice" ++*PrintIntensity Down25: "<>setpagedevice" ++*PrintIntensity Down20: "<>setpagedevice" ++*PrintIntensity Down15: "<>setpagedevice" ++*PrintIntensity Down10: "<>setpagedevice" ++*PrintIntensity Down5: "<>setpagedevice" ++*PrintIntensity Normal: "<>setpagedevice" ++*PrintIntensity Up5: "<>setpagedevice" ++*PrintIntensity Up10: "<>setpagedevice" ++*PrintIntensity Up15: "<>setpagedevice" ++*PrintIntensity Up20: "<>setpagedevice" ++*PrintIntensity Up25: "<>setpagedevice" ++*PrintIntensity Up30: "<>setpagedevice" ++*PrintIntensity Up35: "<>setpagedevice" ++*PrintIntensity Up40: "<>setpagedevice" ++*PrintIntensity Up45: "<>setpagedevice" ++*PrintIntensity Up50: "<>setpagedevice" ++*CloseUI: *PrintIntensity ++*DefaultFont: Courier ++*Font Courier:: Standard "(1.05)" Standard ROM ++*% End of printrex.ppd, 02968 bytes. +Index: cups-1.3.9/ppd/printrex920.ppd +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ cups-1.3.9/ppd/printrex920.ppd 2014-02-25 16:36:17.097182556 +0000 +@@ -0,0 +1,202 @@ ++*PPD-Adobe: "4.3" ++*% PPD file for 920 with CUPS. ++*% Revision 1 Initial release ++*% Revision 2 Fixed Graphic intent selection problem ++*FormatVersion: "4.3" ++*FileVersion: "1.0" ++*LanguageVersion: English ++*LanguageEncoding: ISOLatin1 ++*PCFileName: "printrex920.ppd" ++*Product: "(ESP Ghostscript)" ++*Product: "(GPL Ghostscript)" ++*Product: "(GNU Ghostscript)" ++*Manufacturer: "Printrex" ++*ModelName: "Printrex 920" ++*ShortNickName: "Printrex 920" ++*NickName: "Prx _920, 1.0" ++*PSVersion: "(3010.000) 705" ++*PSVersion: "(3010.000) 707" ++*PSVersion: "(3010.000) 815" ++*PSVersion: "(3010.000) 853" ++*%============== Basic Capabilities =================== ++*LanguageLevel: "3" ++*ColorDevice: True ++*DefaultColorSpace: RGB ++*FileSystem: False ++*Throughput: "1" ++*LandscapeOrientation: Plus90 ++*TTRasterizer: None ++*% ========================== Driver-defined attributes... ++*cupsVersion: 1.2 ++*cupsModelNumber: 0 ++*cupsManualCopies: False ++*cupsFilter: "application/vnd.cups-raster 0 rastertoprx920" ++*%=============== CONSTRAINTS ==================== ++*UIConstraints: *ColorModel Color *Pagesize BWLetter ++*UIConstraints: *Pagesize BWLetter *ColorModel Color ++*%=============== CONSTRAINTS DONE ==================== ++*% The resolution will be set inside the ColorModel ++*% selection ++*%=================================================== ++*OpenUI *ColorModel/Color Mode: PickOne ++*OrderDependency: 10.0 AnySetup *ColorModel ++*DefaultColorModel: Color ++*ColorModel Color: "<>setpagedevice" ++*ColorModel Monochrome/B&W: "<>setpagedevice" ++*ColorModel Grayscale: "<>setpagedevice" ++*CloseUI: *ColorModel ++*OpenUI *ColorIntent: PickOne ++*DefaultColorIntent: Pictures ++*ColorIntent Pictures: "<>setpagedevice" ++*ColorIntent Graphs: "<>setpagedevice" ++*CloseUI: *ColorIntent ++*OpenUI *PageSize: PickOne ++*OrderDependency: 10 AnySetup *PageSize ++*DefaultPageSize: Letter ++*PageSize Letter/Color Letter - 8.25x11in: "<>setpagedevice" ++*PageSize BWLetter/BW Letter - 8.25x11in: "<>setpagedevice" ++*PageSize Long/Long PDFs - 8.25x36in: "<>setpagedevice" ++*PageSize BWLong/BW Long PDFs - 8.25x36in: "<>setpagedevice" ++*CloseUI: *PageSize ++*DefaultPageRegion: Letter ++*PageRegion Letter/Letter - 8.25x11in: "<>setpagedevice" ++*PageRegion BWLetter/BWLetter - 8.25x11in: "<>setpagedevice" ++*PageRegion Long/Long PDF - 8.25x36in: "<>setpagedevice" ++*PageRegion BWLong/BW Long PDF - 8.25x36in: "<>setpagedevice" ++*DefaultImageableArea: Letter ++*ImageableArea Letter/Letter - 8.5x11in: "0.00 0.00 594.00 792.00" ++*ImageableArea BWLetter/BWLetter - 8.5x11in: "0.00 0.00 612.00 792.00" ++*ImageableArea Long/Long PDF - 8.5x36in: "0.00 0.00 594.00 2592.00" ++*ImageableArea BWLong/BW Long PDF - 8.5x36in: "0.00 0.00 612.00 2592.00" ++*DefaultPaperDimension: Letter ++*PaperDimension Letter/Letter - 8.5x11in: "594.00 792.00" ++*PaperDimension BWLetter/BWLetter - 8.5x11in: "612.00 792.00" ++*PaperDimension Long/Long PDF - 8.5x36in: "594.00 2592.00" ++*PaperDimension BWLong/BW Long PDF - 8.5x36in: "612.00 2592.00" ++*OpenUI *MediaType/B&W Media Type: PickOne ++*OrderDependency: 10.0 AnySetup *MediaType ++*DefaultMediaType: PrintrexRoll ++*MediaType PrintrexRoll: "<>setpagedevice" ++*MediaType Heavyweight: "<>setpagedevice" ++*CloseUI: *MediaType ++*RequiresPageRegion All: True ++*OpenUI *PrintSpeed/B&W Print Speed: PickOne ++*DefaultPrintSpeed: 2ips ++*PrintSpeed p5ips/0.5 ips: "<>setpagedevice" ++*PrintSpeed 1ips/1 ips: "<>setpagedevice" ++*PrintSpeed 2ips/2 ips: "<>setpagedevice" ++*PrintSpeed 3ips/3 ips: "<>setpagedevice" ++*CloseUI: *PrintSpeed ++*OpenUI *PrintIntensity/B&W PrintIntensity ++*OrderDependency: 10.0 AnySetup *PrintIntensity ++*DefaultPrintIntensity: Normal ++*PrintIntensity Down50: "<>setpagedevice" ++*PrintIntensity Down45: "<>setpagedevice" ++*PrintIntensity Down40: "<>setpagedevice" ++*PrintIntensity Down35: "<>setpagedevice" ++*PrintIntensity Down30: "<>setpagedevice" ++*PrintIntensity Down25: "<>setpagedevice" ++*PrintIntensity Down20: "<>setpagedevice" ++*PrintIntensity Down15: "<>setpagedevice" ++*PrintIntensity Down10: "<>setpagedevice" ++*PrintIntensity Down5: "<>setpagedevice" ++*PrintIntensity Normal: "<>setpagedevice" ++*PrintIntensity Up5: "<>setpagedevice" ++*PrintIntensity Up10: "<>setpagedevice" ++*PrintIntensity Up15: "<>setpagedevice" ++*PrintIntensity Up20: "<>setpagedevice" ++*PrintIntensity Up25: "<>setpagedevice" ++*PrintIntensity Up30: "<>setpagedevice" ++*PrintIntensity Up35: "<>setpagedevice" ++*PrintIntensity Up40: "<>setpagedevice" ++*PrintIntensity Up45: "<>setpagedevice" ++*PrintIntensity Up50: "<>setpagedevice" ++*CloseUI: *PrintIntensity ++*OpenUI *Pagination: PickOne ++*DefaultPagination: Continuous ++*Pagination Continuous: "<>setpagedevice" ++*Pagination Paginated: "<>setpagedevice" ++*Pagination FormFeed: "<>setpagedevice" ++*CloseUI: *Pagination ++*OpenUI *DLA/Dot Line Adjustment: PickOne ++*DefaultDLA: Inc3/No Change: 0 ++*DLA Inc1/-0.103 in per 5in: "<>setpagedevice" ++*DLA Inc2/-0.095 in per 5in: "<>setpagedevice" ++*DLA Inc2/-0.090 in per 5in: "<>setpagedevice" ++*DLA Inc2/-0.085 in per 5in: "<>setpagedevice" ++*DLA Inc2/-0.080 in per 5in: "<>setpagedevice" ++*DLA Inc2/-0.075 in per 5in: "<>setpagedevice" ++*DLA Inc2/-0.070 in per 5in: "<>setpagedevice" ++*DLA Inc2/-0.065 in per 5in: "<>setpagedevice" ++*DLA Inc2/-0.060 in per 5in: "<>setpagedevice" ++*DLA Inc2/-0.055 in per 5in: "<>setpagedevice" ++*DLA Inc2/-0.050 in per 5in: "<>setpagedevice" ++*DLA Inc2/-0.045 in per 5in: "<>setpagedevice" ++*DLA Inc2/-0.040 in per 5in: "<>setpagedevice" ++*DLA Inc2/-0.035 in per 5in: "<>setpagedevice" ++*DLA Inc2/-0.030 in per 5in: "<>setpagedevice" ++*DLA Inc2/-0.025 in per 5in: "<>setpagedevice" ++*DLA Inc2/-0.020 in per 5in: "<>setpagedevice" ++*DLA Inc2/-0.015 in per 5in: "<>setpagedevice" ++*DLA Inc2/-0.010 in per 5in: "<>setpagedevice" ++*DLA Inc2/-0.005 in per 5in: "<>setpagedevice" ++*DLA Inc3/No change: "<>setpagedevice" ++*DLA Inc4/+0.005 in per 5in: "<>setpagedevice" ++*DLA Inc4/+0.010 in per 5in: "<>setpagedevice" ++*DLA Inc4/+0.015 in per 5in: "<>setpagedevice" ++*DLA Inc4/+0.020 in per 5in: "<>setpagedevice" ++*DLA Inc4/+0.025 in per 5in: "<>setpagedevice" ++*DLA Inc4/+0.030 in per 5in: "<>setpagedevice" ++*DLA Inc4/+0.035 in per 5in: "<>setpagedevice" ++*DLA Inc4/+0.040 in per 5in: "<>setpagedevice" ++*DLA Inc4/+0.045 in per 5in: "<>setpagedevice" ++*DLA Inc4/+0.050 in per 5in: "<>setpagedevice" ++*DLA Inc4/+0.055 in per 5in: "<>setpagedevice" ++*DLA Inc4/+0.060 in per 5in: "<>setpagedevice" ++*DLA Inc4/+0.065 in per 5in: "<>setpagedevice" ++*DLA Inc4/+0.070 in per 5in: "<>setpagedevice" ++*DLA Inc4/+0.075 in per 5in: "<>setpagedevice" ++*DLA Inc4/+0.080 in per 5in: "<>setpagedevice" ++*DLA Inc4/+0.085 in per 5in: "<>setpagedevice" ++*DLA Inc4/+0.090 in per 5in: "<>setpagedevice" ++*DLA Inc4/+0.095 in per 5in: "<>setpagedevice" ++*DLA Inc5/+0.103 in per 5in: "<>setpagedevice" ++*CloseUI: *DLA ++*OpenUI *FFBehavior/Form Feed behavior: PickOne ++*DefaultFFBehavior: NoFF/No Form Feed ++*FFBehavior NoFF/No Form Feed: "<>setpagedevice" ++*FFBehavior SoJ/Job Start: "<>setpagedevice" ++*FFBehavior EoJ/End Job: "<>setpagedevice" ++*FFBehavior SoEoJ/Start & End Job: "<>setpagedevice" ++*FFBehavior Ep/End Page: "<>setpagedevice" ++*FFBehavior SojEp/Start Job & End Page: "<>setpagedevice" ++*FFBehavior EoJEp/End Job & End Page: "<>setpagedevice" ++*FFBehavior SoEoJEp/Start End Job & Page: "<>setpagedevice" ++*CloseUI: *FFBehavior ++*OpenUI *FormPos/Form Position: PickOne ++*DefaultFormPos: Nom/Nominal ++*FormPos Pos1/-10mm: "<>setpagedevice" ++*FormPos Pos2/-9mm: "<>setpagedevice" ++*FormPos Pos3/-8mm: "<>setpagedevice" ++*FormPos Pos4/-7mm: "<>setpagedevice" ++*FormPos Pos5/-6mm: "<>setpagedevice" ++*FormPos Pos6/-5mm: "<>setpagedevice" ++*FormPos Pos7/-4mm: "<>setpagedevice" ++*FormPos Pos8/-3mm: "<>setpagedevice" ++*FormPos Pos9/-2mm: "<>setpagedevice" ++*FormPos Pos10/-1mm: "<>setpagedevice" ++*FormPos Nom/Nominal: "<>setpagedevice" ++*FormPos Pos11/+1mm: "<>setpagedevice" ++*FormPos Pos12/+2mm: "<>setpagedevice" ++*FormPos Pos13/+3mm: "<>setpagedevice" ++*FormPos Pos14/+4mm: "<>setpagedevice" ++*FormPos Pos15/+5mm: "<>setpagedevice" ++*FormPos Pos16/+6mm: "<>setpagedevice" ++*FormPos Pos17/+7mm: "<>setpagedevice" ++*FormPos Pos18/+8mm: "<>setpagedevice" ++*FormPos Pos19/+9mm: "<>setpagedevice" ++*FormPos Pos20/+10mm: "<>setpagedevice" ++*CloseUI: *FormPos ++*DefaultFont: Courier ++*Font Courier:: Standard "(1.05)" Standard ROM ++*% End of printrex920.ppd, 04200 bytes. diff --git a/patches/cups-1.3.9/series b/patches/cups-1.3.9/series new file mode 100644 index 0000000..c7ff715 --- /dev/null +++ b/patches/cups-1.3.9/series @@ -0,0 +1,4 @@ +man2html_remove +fix_install_paths +printrex_drivers +enable-network-setup -- 1.7.9.5 -- ptxdist mailing list ptxdist@pengutronix.de