summaryrefslogtreecommitdiff
path: root/gs/src
diff options
context:
space:
mode:
authorHenry Stiles <henry.stiles@artifex.com>1998-08-08 05:57:31 +0000
committerHenry Stiles <henry.stiles@artifex.com>1998-08-08 05:57:31 +0000
commitb8cb922d73b866149ca3da2288f1edcf959c45c9 (patch)
treec1cab95009d6c0aca63dfb810a5e0ff5858fc2e1 /gs/src
parent049831bbe312e8a7ba47fa1e3b583a21052464de (diff)
This commit was generated by cvs2svn to compensate for changes in r274,
which included commits to RCS files with non-trunk default branches. git-svn-id: http://svn.ghostscript.com/ghostpcl/trunk/ghostpcl@275 06663e23-700e-0410-b217-a244a6096597
Diffstat (limited to 'gs/src')
-rw-r--r--gs/src/ansi2knr.c828
-rw-r--r--gs/src/bcwin32.mak161
-rw-r--r--gs/src/bench.c10
-rw-r--r--gs/src/bfont.h69
-rw-r--r--gs/src/btoken.h91
-rw-r--r--gs/src/ccfont.h88
-rw-r--r--gs/src/ccgs58
-rw-r--r--gs/src/cfonts.mak1
-rwxr-xr-xgs/src/cp.cmd1
-rw-r--r--gs/src/ctype_.h43
-rw-r--r--gs/src/devs.mak1338
-rw-r--r--gs/src/dirent_.h63
-rw-r--r--gs/src/dos_.h43
-rw-r--r--gs/src/dpmainc.c2
-rw-r--r--gs/src/dstack.h457
-rwxr-xr-xgs/src/dvx-gcc.mak5496
-rw-r--r--gs/src/dvx-head.mak28
-rw-r--r--gs/src/dvx-tail.mak31
-rw-r--r--gs/src/dwdll.cpp20
-rw-r--r--gs/src/dwdll.h202
-rw-r--r--gs/src/dwimg.cpp2
-rw-r--r--gs/src/dwimg.h93
-rw-r--r--gs/src/dwmain.cpp2
-rw-r--r--gs/src/dwmain.h3
-rw-r--r--gs/src/dwmain.rc2
-rw-r--r--gs/src/dwmainc.cpp15
-rw-r--r--gs/src/dwnodll.cpp2
-rw-r--r--gs/src/dwtext.cpp2
-rw-r--r--gs/src/dwtext.h259
-rw-r--r--gs/src/echogs.c2
-rw-r--r--gs/src/errno_.h46
-rw-r--r--gs/src/errors.h111
-rw-r--r--gs/src/estack.h96
-rw-r--r--gs/src/files.h130
-rw-r--r--gs/src/fname.h65
-rw-r--r--gs/src/gconf.c83
-rw-r--r--gs/src/gdebug.h131
-rw-r--r--gs/src/gdev3852.c298
-rw-r--r--gs/src/gdev3b1.c603
-rw-r--r--gs/src/gdev4081.c158
-rw-r--r--gs/src/gdev4693.c227
-rw-r--r--gs/src/gdev8510.c229
-rw-r--r--gs/src/gdev8bcm.c2
-rw-r--r--gs/src/gdev8bcm.h50
-rw-r--r--gs/src/gdevabuf.c13
-rw-r--r--gs/src/gdevadmp.c522
-rw-r--r--gs/src/gdevbbox.c151
-rw-r--r--gs/src/gdevbbox.h87
-rw-r--r--gs/src/gdevbit.c81
-rw-r--r--gs/src/gdevbj10.c575
-rw-r--r--gs/src/gdevbjc.h10
-rw-r--r--gs/src/gdevbmp.c198
-rw-r--r--gs/src/gdevccr.c359
-rw-r--r--gs/src/gdevcdj.c5401
-rw-r--r--gs/src/gdevcgm.c6
-rw-r--r--gs/src/gdevcgml.c134
-rw-r--r--gs/src/gdevcgml.h481
-rw-r--r--gs/src/gdevcgmx.h342
-rw-r--r--gs/src/gdevcif.c138
-rw-r--r--gs/src/gdevcmap.c13
-rw-r--r--gs/src/gdevcmap.h46
-rw-r--r--gs/src/gdevcp50.c269
-rw-r--r--gs/src/gdevddrw.c150
-rw-r--r--gs/src/gdevdfax.c137
-rw-r--r--gs/src/gdevdflt.c790
-rw-r--r--gs/src/gdevdjet.c41
-rw-r--r--gs/src/gdevdjtc.c325
-rw-r--r--gs/src/gdevdm24.c421
-rw-r--r--gs/src/gdevegaa.asm1
-rw-r--r--gs/src/gdevemap.c8
-rw-r--r--gs/src/gdevepsc.c724
-rw-r--r--gs/src/gdevepsn.c592
-rw-r--r--gs/src/gdevescp.c589
-rw-r--r--gs/src/gdevevga.c2
-rw-r--r--gs/src/gdevherc.c669
-rw-r--r--gs/src/gdevht.c245
-rw-r--r--gs/src/gdevht.h67
-rw-r--r--gs/src/gdevimgn.c850
-rw-r--r--gs/src/gdevjpeg.c31
-rw-r--r--gs/src/gdevl256.c2
-rw-r--r--gs/src/gdevlbp8.c323
-rw-r--r--gs/src/gdevlj56.c6
-rw-r--r--gs/src/gdevlp8k.c611
-rw-r--r--gs/src/gdevm1.c551
-rw-r--r--gs/src/gdevm16.c6
-rw-r--r--gs/src/gdevm2.c12
-rw-r--r--gs/src/gdevm24.c17
-rw-r--r--gs/src/gdevm32.c16
-rw-r--r--gs/src/gdevm4.c149
-rw-r--r--gs/src/gdevm8.c12
-rw-r--r--gs/src/gdevmem.c123
-rw-r--r--gs/src/gdevmem.h122
-rw-r--r--gs/src/gdevmgr.c629
-rw-r--r--gs/src/gdevmgr.h7
-rw-r--r--gs/src/gdevmiff.c6
-rw-r--r--gs/src/gdevmpla.c15
-rw-r--r--gs/src/gdevmrop.c838
-rw-r--r--gs/src/gdevmrop.h98
-rw-r--r--gs/src/gdevmswn.c2
-rw-r--r--gs/src/gdevmswn.h50
-rw-r--r--gs/src/gp.h107
101 files changed, 11514 insertions, 18297 deletions
diff --git a/gs/src/ansi2knr.c b/gs/src/ansi2knr.c
index a0ad1ca03..56871e954 100644
--- a/gs/src/ansi2knr.c
+++ b/gs/src/ansi2knr.c
@@ -1,32 +1,38 @@
-/* ansi2knr.c */
+/* Copyright (C) 1989, 1997 Aladdin Enterprises. All rights reserved. */
+
+/*Id: ansi2knr.c */
/* Convert ANSI C function definitions to K&R ("traditional C") syntax */
/*
- ansi2knr is distributed in the hope that it will be useful, but WITHOUT ANY
- WARRANTY. No author or distributor accepts responsibility to anyone for the
- consequences of using it or for whether it serves any particular purpose or
- works at all, unless he says so in writing. Refer to the GNU General Public
- License (the "GPL") for full details.
-
- Everyone is granted permission to copy, modify and redistribute ansi2knr,
- but only under the conditions described in the GPL. A copy of this license
- is supposed to have been given to you along with ansi2knr so you can know
- your rights and responsibilities. It should be in a file named COPYLEFT.
- Among other things, the copyright notice and this notice must be preserved
- on all copies.
-
- We explicitly state here what we believe is already implied by the GPL: if
- the ansi2knr program is distributed as a separate set of sources and a
- separate executable file which are aggregated on a storage medium together
- with another program, this in itself does not bring the other program under
- the GPL, nor does the mere fact that such a program or the procedures for
- constructing it invoke the ansi2knr executable bring any other part of the
- program under the GPL.
- */
+ansi2knr is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY. No author or distributor accepts responsibility to anyone for the
+consequences of using it or for whether it serves any particular purpose or
+works at all, unless he says so in writing. Refer to the GNU General Public
+License (the "GPL") for full details.
+
+Everyone is granted permission to copy, modify and redistribute ansi2knr,
+but only under the conditions described in the GPL. A copy of this license
+is supposed to have been given to you along with ansi2knr so you can know
+your rights and responsibilities. It should be in a file named COPYLEFT,
+or, if there is no file named COPYLEFT, a file named COPYING. Among other
+things, the copyright notice and this notice must be preserved on all
+copies.
+
+We explicitly state here what we believe is already implied by the GPL: if
+the ansi2knr program is distributed as a separate set of sources and a
+separate executable file which are aggregated on a storage medium together
+with another program, this in itself does not bring the other program under
+the GPL, nor does the mere fact that such a program or the procedures for
+constructing it invoke the ansi2knr executable bring any other part of the
+program under the GPL.
+*/
/*
* Usage:
- ansi2knr input_file [output_file]
+ ansi2knr [--filename FILENAME] [INPUT_FILE [OUTPUT_FILE]]
+ * --filename provides the file name for the #line directive in the output,
+ * overriding input_file (if present).
+ * If no input_file is supplied, input is read from stdin.
* If no output_file is supplied, output goes to stdout.
* There are no error messages.
*
@@ -40,39 +46,44 @@
* These algorithms ignore whitespace and comments, except that
* the function name must be the first thing on the line.
* The following constructs will confuse it:
- * - Any other construct that starts at the left margin and
- * follows the above syntax (such as a macro or function call).
- * - Some macros that tinker with the syntax of the function header.
+ * - Any other construct that starts at the left margin and
+ * follows the above syntax (such as a macro or function call).
+ * - Some macros that tinker with the syntax of the function header.
*/
/*
* The original and principal author of ansi2knr is L. Peter Deutsch
* <ghost@aladdin.com>. Other authors are noted in the change history
* that follows (in reverse chronological order):
- lpd 96-01-21 added code to cope with not HAVE_CONFIG_H and with
- compilers that don't understand void, as suggested by
- Tom Lane
- lpd 96-01-15 changed to require that the first non-comment token
- on the line following a function header be a left brace,
- to reduce sensitivity to macros, as suggested by Tom Lane
- <tgl@sss.pgh.pa.us>
- lpd 95-06-22 removed #ifndefs whose sole purpose was to define
- undefined preprocessor symbols as 0; changed all #ifdefs
- for configuration symbols to #ifs
- lpd 95-04-05 changed copyright notice to make it clear that
- including ansi2knr in a program does not bring the entire
- program under the GPL
- lpd 94-12-18 added conditionals for systems where ctype macros
- don't handle 8-bit characters properly, suggested by
- Francois Pinard <pinard@iro.umontreal.ca>;
- removed --varargs switch (this is now the default)
- lpd 94-10-10 removed CONFIG_BROKETS conditional
- lpd 94-07-16 added some conditionals to help GNU `configure',
- suggested by Francois Pinard <pinard@iro.umontreal.ca>;
- properly erase prototype args in function parameters,
- contributed by Jim Avera <jima@netcom.com>;
- correct error in writeblanks (it shouldn't erase EOLs)
- lpd 89-xx-xx original version
+ lpd 97-12-08 made input_file optional; only closes input and/or
+ output file if not stdin or stdout respectively; prints
+ usage message on stderr rather than stdout; adds
+ --filename switch (changes suggested by
+ <ceder@lysator.liu.se>)
+ lpd 96-01-21 added code to cope with not HAVE_CONFIG_H and with
+ compilers that don't understand void, as suggested by
+ Tom Lane
+ lpd 96-01-15 changed to require that the first non-comment token
+ on the line following a function header be a left brace,
+ to reduce sensitivity to macros, as suggested by Tom Lane
+ <tgl@sss.pgh.pa.us>
+ lpd 95-06-22 removed #ifndefs whose sole purpose was to define
+ undefined preprocessor symbols as 0; changed all #ifdefs
+ for configuration symbols to #ifs
+ lpd 95-04-05 changed copyright notice to make it clear that
+ including ansi2knr in a program does not bring the entire
+ program under the GPL
+ lpd 94-12-18 added conditionals for systems where ctype macros
+ don't handle 8-bit characters properly, suggested by
+ Francois Pinard <pinard@iro.umontreal.ca>;
+ removed --varargs switch (this is now the default)
+ lpd 94-10-10 removed CONFIG_BROKETS conditional
+ lpd 94-07-16 added some conditionals to help GNU `configure',
+ suggested by Francois Pinard <pinard@iro.umontreal.ca>;
+ properly erase prototype args in function parameters,
+ contributed by Jim Avera <jima@netcom.com>;
+ correct error in writeblanks (it shouldn't erase EOLs)
+ lpd 89-xx-xx original version
*/
/* Most of the conditionals here are to make ansi2knr work with */
@@ -106,8 +117,7 @@
# include <strings.h>
# else
# ifdef VMS
-extern int strlen(), strncmp();
-
+ extern int strlen(), strncmp();
# else
# include <string.h>
# endif
@@ -126,13 +136,11 @@ extern int strlen(), strncmp();
# include <malloc.h>
# else
# ifdef VMS
-extern char *malloc();
-extern void free();
-
+ extern char *malloc();
+ extern void free();
# else
-extern char *malloc();
-extern int free();
-
+ extern char *malloc();
+ extern int free();
# endif
# endif
@@ -170,131 +178,147 @@ int convert1();
/* The main program */
int
main(argc, argv)
- int argc;
- char *argv[];
-{
- FILE *in, *out;
-
-#define bufsize 5000 /* arbitrary size */
- char *buf;
- char *line;
- char *more;
-
- /*
- * In previous versions, ansi2knr recognized a --varargs switch.
- * If this switch was supplied, ansi2knr would attempt to convert
- * a ... argument to va_alist and va_dcl; if this switch was not
- * supplied, ansi2knr would simply drop any such arguments.
- * Now, ansi2knr always does this conversion, and we only
- * check for this switch for backward compatibility.
- */
- int convert_varargs = 1;
-
- if (argc > 1 && argv[1][0] == '-') {
- if (!strcmp(argv[1], "--varargs")) {
+ int argc;
+ char *argv[];
+{ FILE *in = stdin;
+ FILE *out = stdout;
+ char *filename = 0;
+#define bufsize 5000 /* arbitrary size */
+ char *buf;
+ char *line;
+ char *more;
+ char *usage =
+ "Usage: ansi2knr [--filename FILENAME] [INPUT_FILE [OUTPUT_FILE]]\n";
+ /*
+ * In previous versions, ansi2knr recognized a --varargs switch.
+ * If this switch was supplied, ansi2knr would attempt to convert
+ * a ... argument to va_alist and va_dcl; if this switch was not
+ * supplied, ansi2knr would simply drop any such arguments.
+ * Now, ansi2knr always does this conversion, and we only
+ * check for this switch for backward compatibility.
+ */
+ int convert_varargs = 1;
+
+ while ( argc > 1 && argv[1][0] == '-' ) {
+ if ( !strcmp(argv[1], "--varargs") ) {
convert_varargs = 1;
argc--;
argv++;
- } else {
- fprintf(stderr, "Unrecognized switch: %s\n", argv[1]);
- exit(1);
+ continue;
+ }
+ if ( !strcmp(argv[1], "--filename") && argc > 2 ) {
+ filename = argv[2];
+ argc -= 2;
+ argv += 2;
+ continue;
+ }
+ fprintf(stderr, "Unrecognized switch: %s\n", argv[1]);
+ fprintf(stderr, usage);
+ exit(1);
}
- }
- switch (argc) {
+ switch ( argc )
+ {
default:
- printf("Usage: ansi2knr input_file [output_file]\n");
- exit(0);
- case 2:
- out = stdout;
- break;
+ fprintf(stderr, usage);
+ exit(0);
case 3:
- out = fopen(argv[2], "w");
- if (out == NULL) {
- fprintf(stderr, "Cannot open output file %s\n", argv[2]);
- exit(1);
- }
- }
- in = fopen(argv[1], "r");
- if (in == NULL) {
- fprintf(stderr, "Cannot open input file %s\n", argv[1]);
- exit(1);
- }
- fprintf(out, "#line 1 \"%s\"\n", argv[1]);
- buf = malloc(bufsize);
- line = buf;
- while (fgets(line, (unsigned)(buf + bufsize - line), in) != NULL) {
- test:line += strlen(line);
- switch (test1(buf)) {
- case 2: /* a function header */
- convert1(buf, out, 1, convert_varargs);
- break;
- case 1: /* a function */
- /* Check for a { at the start of the next line. */
- more = ++line;
- f:if (line >= buf + (bufsize - 1)) /* overflow check */
- goto wl;
- if (fgets(line, (unsigned)(buf + bufsize - line), in) == NULL)
- goto wl;
- switch (*skipspace(more, 1)) {
- case '{':
- /* Definitely a function header. */
- convert1(buf, out, 0, convert_varargs);
- fputs(more, out);
- break;
- case 0:
- /* The next line was blank or a comment: */
- /* keep scanning for a non-comment. */
- line += strlen(line);
- goto f;
- default:
- /* buf isn't a function header, but */
- /* more might be. */
- fputs(buf, out);
- strcpy(buf, more);
- line = buf;
- goto test;
+ out = fopen(argv[2], "w");
+ if ( out == NULL ) {
+ fprintf(stderr, "Cannot open output file %s\n", argv[2]);
+ exit(1);
}
- break;
- case -1: /* maybe the start of a function */
- if (line != buf + (bufsize - 1)) /* overflow check */
- continue;
/* falls through */
- default: /* not a function */
- wl:fputs(buf, out);
+ case 2:
+ in = fopen(argv[1], "r");
+ if ( in == NULL ) {
+ fprintf(stderr, "Cannot open input file %s\n", argv[1]);
+ exit(1);
+ }
+ if ( filename == 0 )
+ filename = argv[1];
+ /* falls through */
+ case 1:
break;
- }
+ }
+ if ( filename )
+ fprintf(out, "#line 1 \"%s\"\n", filename);
+ buf = malloc(bufsize);
line = buf;
- }
- if (line != buf)
- fputs(buf, out);
- free(buf);
- fclose(out);
- fclose(in);
- return 0;
+ while ( fgets(line, (unsigned)(buf + bufsize - line), in) != NULL )
+ {
+test: line += strlen(line);
+ switch ( test1(buf) )
+ {
+ case 2: /* a function header */
+ convert1(buf, out, 1, convert_varargs);
+ break;
+ case 1: /* a function */
+ /* Check for a { at the start of the next line. */
+ more = ++line;
+f: if ( line >= buf + (bufsize - 1) ) /* overflow check */
+ goto wl;
+ if ( fgets(line, (unsigned)(buf + bufsize - line), in) == NULL )
+ goto wl;
+ switch ( *skipspace(more, 1) )
+ {
+ case '{':
+ /* Definitely a function header. */
+ convert1(buf, out, 0, convert_varargs);
+ fputs(more, out);
+ break;
+ case 0:
+ /* The next line was blank or a comment: */
+ /* keep scanning for a non-comment. */
+ line += strlen(line);
+ goto f;
+ default:
+ /* buf isn't a function header, but */
+ /* more might be. */
+ fputs(buf, out);
+ strcpy(buf, more);
+ line = buf;
+ goto test;
+ }
+ break;
+ case -1: /* maybe the start of a function */
+ if ( line != buf + (bufsize - 1) ) /* overflow check */
+ continue;
+ /* falls through */
+ default: /* not a function */
+wl: fputs(buf, out);
+ break;
+ }
+ line = buf;
+ }
+ if ( line != buf )
+ fputs(buf, out);
+ free(buf);
+ if ( out != stdout )
+ fclose(out);
+ if ( in != stdin )
+ fclose(in);
+ return 0;
}
/* Skip over space and comments, in either direction. */
char *
skipspace(p, dir)
- register char *p;
- register int dir; /* 1 for forward, -1 for backward */
-{
- for (;;) {
- while (is_space(*p))
- p += dir;
- if (!(*p == '/' && p[dir] == '*'))
- break;
- p += dir;
- p += dir;
- while (!(*p == '*' && p[dir] == '/')) {
- if (*p == 0)
- return p; /* multi-line comment?? */
- p += dir;
- }
- p += dir;
- p += dir;
- }
- return p;
+ register char *p;
+ register int dir; /* 1 for forward, -1 for backward */
+{ for ( ; ; )
+ { while ( is_space(*p) )
+ p += dir;
+ if ( !(*p == '/' && p[dir] == '*') )
+ break;
+ p += dir; p += dir;
+ while ( !(*p == '*' && p[dir] == '/') )
+ { if ( *p == 0 )
+ return p; /* multi-line comment?? */
+ p += dir;
+ }
+ p += dir; p += dir;
+ }
+ return p;
}
/*
@@ -303,266 +327,248 @@ skipspace(p, dir)
*/
int
writeblanks(start, end)
- char *start;
- char *end;
-{
- char *p;
-
- for (p = start; p < end; p++)
- if (*p != '\r' && *p != '\n')
+ char *start;
+ char *end;
+{ char *p;
+ for ( p = start; p < end; p++ )
+ if ( *p != '\r' && *p != '\n' )
*p = ' ';
- return 0;
+ return 0;
}
/*
* Test whether the string in buf is a function definition.
* The string may contain and/or end with a newline.
* Return as follows:
- * 0 - definitely not a function definition;
- * 1 - definitely a function definition;
- * 2 - definitely a function prototype (NOT USED);
- * -1 - may be the beginning of a function definition,
- * append another line and look again.
+ * 0 - definitely not a function definition;
+ * 1 - definitely a function definition;
+ * 2 - definitely a function prototype (NOT USED);
+ * -1 - may be the beginning of a function definition,
+ * append another line and look again.
* The reason we don't attempt to convert function prototypes is that
* Ghostscript's declaration-generating macros look too much like
* prototypes, and confuse the algorithms.
*/
int
test1(buf)
- char *buf;
-{
- register char *p = buf;
- char *bend;
- char *endfn;
- int contin;
-
- if (!isidfirstchar(*p))
- return 0; /* no name at left margin */
- bend = skipspace(buf + strlen(buf) - 1, -1);
- switch (*bend) {
- case ';':
- contin = 0 /*2 */ ;
- break;
- case ')':
- contin = 1;
- break;
- case '{':
- return 0; /* not a function */
- case '}':
- return 0; /* not a function */
- default:
- contin = -1;
- }
- while (isidchar(*p))
- p++;
- endfn = p;
- p = skipspace(p, 1);
- if (*p++ != '(')
- return 0; /* not a function */
- p = skipspace(p, 1);
- if (*p == ')')
- return 0; /* no parameters */
- /* Check that the apparent function name isn't a keyword. */
- /* We only need to check for keywords that could be followed */
- /* by a left parenthesis (which, unfortunately, is most of them). */
- {
- static char *words[] =
- {"asm", "auto", "case", "char", "const", "double",
- "extern", "float", "for", "if", "int", "long",
- "register", "return", "short", "signed", "sizeof",
- "static", "switch", "typedef", "unsigned",
- "void", "volatile", "while", 0
- };
- char **key = words;
- char *kp;
- int len = endfn - buf;
-
- while ((kp = *key) != 0) {
- if (strlen(kp) == len && !strncmp(kp, buf, len))
- return 0; /* name is a keyword */
- key++;
- }
- }
- return contin;
+ char *buf;
+{ register char *p = buf;
+ char *bend;
+ char *endfn;
+ int contin;
+
+ if ( !isidfirstchar(*p) )
+ return 0; /* no name at left margin */
+ bend = skipspace(buf + strlen(buf) - 1, -1);
+ switch ( *bend )
+ {
+ case ';': contin = 0 /*2*/; break;
+ case ')': contin = 1; break;
+ case '{': return 0; /* not a function */
+ case '}': return 0; /* not a function */
+ default: contin = -1;
+ }
+ while ( isidchar(*p) )
+ p++;
+ endfn = p;
+ p = skipspace(p, 1);
+ if ( *p++ != '(' )
+ return 0; /* not a function */
+ p = skipspace(p, 1);
+ if ( *p == ')' )
+ return 0; /* no parameters */
+ /* Check that the apparent function name isn't a keyword. */
+ /* We only need to check for keywords that could be followed */
+ /* by a left parenthesis (which, unfortunately, is most of them). */
+ { static char *words[] =
+ { "asm", "auto", "case", "char", "const", "double",
+ "extern", "float", "for", "if", "int", "long",
+ "register", "return", "short", "signed", "sizeof",
+ "static", "switch", "typedef", "unsigned",
+ "void", "volatile", "while", 0
+ };
+ char **key = words;
+ char *kp;
+ int len = endfn - buf;
+
+ while ( (kp = *key) != 0 )
+ { if ( strlen(kp) == len && !strncmp(kp, buf, len) )
+ return 0; /* name is a keyword */
+ key++;
+ }
+ }
+ return contin;
}
/* Convert a recognized function definition or header to K&R syntax. */
int
convert1(buf, out, header, convert_varargs)
- char *buf;
- FILE *out;
- int header; /* Boolean */
- int convert_varargs; /* Boolean */
-{
- char *endfn;
- register char *p;
-
- /*
- * The breaks table contains pointers to the beginning and end
- * of each argument.
- */
- char **breaks;
- unsigned num_breaks = 2; /* for testing */
- char **btop;
- char **bp;
- char **ap;
- char *vararg = 0;
-
- /* Pre-ANSI implementations don't agree on whether strchr */
- /* is called strchr or index, so we open-code it here. */
- for (endfn = buf; *(endfn++) != '(';);
- top:p = endfn;
- breaks = (char **)malloc(sizeof(char *) * num_breaks * 2);
-
- if (breaks == 0) { /* Couldn't allocate break table, give up */
- fprintf(stderr, "Unable to allocate break table!\n");
- fputs(buf, out);
- return -1;
- }
- btop = breaks + num_breaks * 2 - 2;
- bp = breaks;
- /* Parse the argument list */
- do {
- int level = 0;
- char *lp = NULL;
- char *rp;
- char *end = NULL;
-
- if (bp >= btop) { /* Filled up break table. */
- /* Allocate a bigger one and start over. */
- free((char *)breaks);
- num_breaks <<= 1;
- goto top;
- }
- *bp++ = p;
- /* Find the end of the argument */
- for (; end == NULL; p++) {
- switch (*p) {
- case ',':
- if (!level)
- end = p;
- break;
- case '(':
- if (!level)
- lp = p;
- level++;
- break;
- case ')':
- if (--level < 0)
- end = p;
- else
- rp = p;
- break;
- case '/':
- p = skipspace(p, 1) - 1;
- break;
- default:
- ;
- }
- }
- /* Erase any embedded prototype parameters. */
- if (lp)
- writeblanks(lp + 1, rp);
- p--; /* back up over terminator */
- /* Find the name being declared. */
- /* This is complicated because of procedure and */
- /* array modifiers. */
- for (;;) {
- p = skipspace(p - 1, -1);
- switch (*p) {
- case ']': /* skip array dimension(s) */
- case ')': /* skip procedure args OR name */
- {
- int level = 1;
-
- while (level)
- switch (*--p) {
- case ']':
- case ')':
- level++;
- break;
- case '[':
- case '(':
- level--;
- break;
- case '/':
- p = skipspace(p, -1) + 1;
- break;
- default:;
- }
- }
- if (*p == '(' && *skipspace(p + 1, 1) == '*') { /* We found the name being declared */
- while (!isidfirstchar(*p))
- p = skipspace(p, 1) + 1;
- goto found;
- }
- break;
- default:
- goto found;
- }
- }
- found:if (*p == '.' && p[-1] == '.' && p[-2] == '.') {
- if (convert_varargs) {
- *bp++ = "va_alist";
- vararg = p - 2;
- } else {
- p++;
- if (bp == breaks + 1) /* sole argument */
- writeblanks(breaks[0], p);
+ char *buf;
+ FILE *out;
+ int header; /* Boolean */
+ int convert_varargs; /* Boolean */
+{ char *endfn;
+ register char *p;
+ /*
+ * The breaks table contains pointers to the beginning and end
+ * of each argument.
+ */
+ char **breaks;
+ unsigned num_breaks = 2; /* for testing */
+ char **btop;
+ char **bp;
+ char **ap;
+ char *vararg = 0;
+
+ /* Pre-ANSI implementations don't agree on whether strchr */
+ /* is called strchr or index, so we open-code it here. */
+ for ( endfn = buf; *(endfn++) != '('; )
+ ;
+top: p = endfn;
+ breaks = (char **)malloc(sizeof(char *) * num_breaks * 2);
+ if ( breaks == 0 )
+ { /* Couldn't allocate break table, give up */
+ fprintf(stderr, "Unable to allocate break table!\n");
+ fputs(buf, out);
+ return -1;
+ }
+ btop = breaks + num_breaks * 2 - 2;
+ bp = breaks;
+ /* Parse the argument list */
+ do
+ { int level = 0;
+ char *lp = NULL;
+ char *rp;
+ char *end = NULL;
+
+ if ( bp >= btop )
+ { /* Filled up break table. */
+ /* Allocate a bigger one and start over. */
+ free((char *)breaks);
+ num_breaks <<= 1;
+ goto top;
+ }
+ *bp++ = p;
+ /* Find the end of the argument */
+ for ( ; end == NULL; p++ )
+ { switch(*p)
+ {
+ case ',':
+ if ( !level ) end = p;
+ break;
+ case '(':
+ if ( !level ) lp = p;
+ level++;
+ break;
+ case ')':
+ if ( --level < 0 ) end = p;
+ else rp = p;
+ break;
+ case '/':
+ p = skipspace(p, 1) - 1;
+ break;
+ default:
+ ;
+ }
+ }
+ /* Erase any embedded prototype parameters. */
+ if ( lp )
+ writeblanks(lp + 1, rp);
+ p--; /* back up over terminator */
+ /* Find the name being declared. */
+ /* This is complicated because of procedure and */
+ /* array modifiers. */
+ for ( ; ; )
+ { p = skipspace(p - 1, -1);
+ switch ( *p )
+ {
+ case ']': /* skip array dimension(s) */
+ case ')': /* skip procedure args OR name */
+ { int level = 1;
+ while ( level )
+ switch ( *--p )
+ {
+ case ']': case ')': level++; break;
+ case '[': case '(': level--; break;
+ case '/': p = skipspace(p, -1) + 1; break;
+ default: ;
+ }
+ }
+ if ( *p == '(' && *skipspace(p + 1, 1) == '*' )
+ { /* We found the name being declared */
+ while ( !isidfirstchar(*p) )
+ p = skipspace(p, 1) + 1;
+ goto found;
+ }
+ break;
+ default:
+ goto found;
+ }
+ }
+found: if ( *p == '.' && p[-1] == '.' && p[-2] == '.' )
+ { if ( convert_varargs )
+ { *bp++ = "va_alist";
+ vararg = p-2;
+ }
+ else
+ { p++;
+ if ( bp == breaks + 1 ) /* sole argument */
+ writeblanks(breaks[0], p);
+ else
+ writeblanks(bp[-1] - 1, p);
+ bp--;
+ }
+ }
else
- writeblanks(bp[-1] - 1, p);
- bp--;
- }
- } else {
- while (isidchar(*p))
- p--;
- *bp++ = p + 1;
- }
- p = end;
- }
- while (*p++ == ',');
- *bp = p;
- /* Make a special check for 'void' arglist */
- if (bp == breaks + 2) {
- p = skipspace(breaks[0], 1);
- if (!strncmp(p, "void", 4)) {
- p = skipspace(p + 4, 1);
- if (p == breaks[2] - 1) {
- bp = breaks; /* yup, pretend arglist is empty */
- writeblanks(breaks[0], p + 1);
- }
- }
- }
- /* Put out the function name and left parenthesis. */
- p = buf;
- while (p != endfn)
- putc(*p, out), p++;
- /* Put out the declaration. */
- if (header) {
- fputs(");", out);
- for (p = breaks[0]; *p; p++)
- if (*p == '\r' || *p == '\n')
- putc(*p, out);
- } else {
- for (ap = breaks + 1; ap < bp; ap += 2) {
- p = *ap;
- while (isidchar(*p))
- putc(*p, out), p++;
- if (ap < bp - 1)
- fputs(", ", out);
- }
- fputs(") ", out);
- /* Put out the argument declarations */
- for (ap = breaks + 2; ap <= bp; ap += 2)
- (*ap)[-1] = ';';
- if (vararg != 0) {
- *vararg = 0;
- fputs(breaks[0], out); /* any prior args */
- fputs("va_dcl", out); /* the final arg */
- fputs(bp[0], out);
- } else
- fputs(breaks[0], out);
- }
- free((char *)breaks);
- return 0;
+ { while ( isidchar(*p) ) p--;
+ *bp++ = p+1;
+ }
+ p = end;
+ }
+ while ( *p++ == ',' );
+ *bp = p;
+ /* Make a special check for 'void' arglist */
+ if ( bp == breaks+2 )
+ { p = skipspace(breaks[0], 1);
+ if ( !strncmp(p, "void", 4) )
+ { p = skipspace(p+4, 1);
+ if ( p == breaks[2] - 1 )
+ { bp = breaks; /* yup, pretend arglist is empty */
+ writeblanks(breaks[0], p + 1);
+ }
+ }
+ }
+ /* Put out the function name and left parenthesis. */
+ p = buf;
+ while ( p != endfn ) putc(*p, out), p++;
+ /* Put out the declaration. */
+ if ( header )
+ { fputs(");", out);
+ for ( p = breaks[0]; *p; p++ )
+ if ( *p == '\r' || *p == '\n' )
+ putc(*p, out);
+ }
+ else
+ { for ( ap = breaks+1; ap < bp; ap += 2 )
+ { p = *ap;
+ while ( isidchar(*p) )
+ putc(*p, out), p++;
+ if ( ap < bp - 1 )
+ fputs(", ", out);
+ }
+ fputs(") ", out);
+ /* Put out the argument declarations */
+ for ( ap = breaks+2; ap <= bp; ap += 2 )
+ (*ap)[-1] = ';';
+ if ( vararg != 0 )
+ { *vararg = 0;
+ fputs(breaks[0], out); /* any prior args */
+ fputs("va_dcl", out); /* the final arg */
+ fputs(bp[0], out);
+ }
+ else
+ fputs(breaks[0], out);
+ }
+ free((char *)breaks);
+ return 0;
}
diff --git a/gs/src/bcwin32.mak b/gs/src/bcwin32.mak
index 5bfbefb8f..410bd5eb7 100644
--- a/gs/src/bcwin32.mak
+++ b/gs/src/bcwin32.mak
@@ -1,4 +1,4 @@
-# Copyright (C) 1989-1997 Aladdin Enterprises. All rights reserved.
+# Copyright (C) 1989-1998 Aladdin Enterprises. All rights reserved.
#
# This file is part of Aladdin Ghostscript.
#
@@ -15,7 +15,7 @@
# License requires that the copyright notice and this notice be preserved on
# all copies.
-# bcwin32.mak
+# Id: bcwin32.mak
# makefile for (MS-Windows 3.1/Win32s / Windows 95 / Windows NT) +
# Borland C++ 4.5 platform.
@@ -55,18 +55,18 @@ GS_INIT=gs_init.ps
# Code runs substantially slower even if no debugging switches are set,
# and also takes about another 25K of memory.
-DEBUG=0
+DEBUG=1
# Setting TDEBUG=1 includes symbol table information for the debugger,
# and also enables stack checking. Code is substantially slower and larger.
-TDEBUG=0
+TDEBUG=1
# Setting NOPRIVATE=1 makes private (static) procedures and variables public,
# so they are visible to the debugger and profiler.
# No execution time or space penalty, just larger .OBJ and .EXE files.
-NOPRIVATE=0
+NOPRIVATE=1
# Define the names of the executable files.
@@ -79,12 +79,22 @@ GSDLL=gsdll32
MAKEDLL=1
+# Define the source, generated intermediate file, and object directories
+# for the graphics library (GL) and the PostScript/PDF interpreter (PS).
+
+GLSRCDIR=.
+GLGENDIR=debugobj
+GLOBJDIR=debugobj
+PSSRCDIR=.
+PSGENDIR=debugobj
+PSOBJDIR=debugobj
+
# Define the directory where the IJG JPEG library sources are stored,
# and the major version of the library that is stored there.
# You may need to change this if the IJG library version changes.
# See jpeg.mak for more information.
-JSRCDIR=jpeg-6a
+JSRCDIR=jpeg
JVERSION=6
# Define the directory where the PNG library sources are stored,
@@ -145,7 +155,7 @@ CPU_FAMILY=i386
# Define the processor (CPU) type. (386, 486 or 586)
-CPU_TYPE=386
+CPU_TYPE=586
# Define the math coprocessor (FPU) type.
# Options are -1 (optimize for no FPU), 0 (optimize for FPU present,
@@ -158,13 +168,13 @@ CPU_TYPE=386
# of that type (or higher) is available: this is NOT currently checked
# at runtime.
-FPU_TYPE=0
+FPU_TYPE=387
# ------ Devices and features ------ #
# Choose the language feature(s) to include. See gs.mak for details.
-FEATURE_DEVS=level2.dev pdf.dev ttfont.dev
+FEATURE_DEVS=psl3.dev pdf.dev ttfont.dev
# Choose whether to compile the .ps initialization files into the executable.
# See gs.mak for details.
@@ -187,7 +197,8 @@ BAND_LIST_COMPRESSOR=zlib
FILE_IMPLEMENTATION=stdio
-# Choose the device(s) to include. See devs.mak for details.
+# Choose the device(s) to include. See devs.mak for details,
+# devs.mak and contrib.mak for the list of available devices.
DEVICE_DEVS=mswindll.dev mswinprn.dev mswinpr2.dev
DEVICE_DEVS2=epson.dev eps9high.dev eps9mid.dev epsonc.dev ibmpro.dev
@@ -209,7 +220,7 @@ DEVICE_DEVS15=pdfwrite.dev pswrite.dev epswrite.dev pxlmono.dev pxlcolor.dev
# Define the name of the makefile -- used in dependencies.
-MAKEFILE=bcwin32.mak winlib.mak winint.mak
+MAKEFILE=$(GLSRCDIR)\bcwin32.mak
# Define the current directory prefix and shell invocations.
@@ -222,10 +233,8 @@ SHP=
# Define the arguments for genconf.
-#CONFILES=-p %s+ -o $(ld_tr) -l lib.tr
-# We can't use $(ld_tr) because Borland make expands macro usages in
-# macro definitions at definition time, not at use time.
-CONFILES=-p %s+ -o ld$(CONFIG).tr -l lib.tr
+CONFILES=-p %s+ -l lib.tr
+CONFLDTR=-o
# Define the generic compilation flags.
@@ -236,7 +245,11 @@ PCFBASM=
# Make sure we get the right default target for make.
-dosdefault: default gs16spl.exe
+dosdefault: default $(GLOBJDIR)\gs16spl.exe
+
+# Define the switch for output files.
+
+O_=-o
# Define the compilation flags.
@@ -292,9 +305,6 @@ CS=-N
CS=
!endif
-# Specify output object name
-CCOBJNAME=-o
-
# Specify function prolog type
COMPILE_FOR_DLL=-WDE
COMPILE_FOR_EXE=-WE
@@ -311,49 +321,45 @@ WX=$(COMPILE_FOR_DLL)
!else
WX=$(COMPILE_FOR_EXE)
!endif
-CCC=$(CC) $(WX) $(CO) -c
-CCD=$(CC) $(WX) -c
-CCINT=$(CC) $(WX) -c
-CCCF=$(CCC)
-CCLEAF=$(CCC)
-
-# Compiler for auxiliary programs
-
-CCAUX=$(COMPAUX) -ml -I$(INCDIR) -L$(LIBDIR) -O
-
-# Compiler for Windows headers includes
+CC_WX=$(CC) $(WX)
+CC_=$(CC_WX) $(CO)
+CC_D=$(CC_WX)
+CC_INT=$(CC_WX)
+CC_LEAF=$(CC_)
-CCCWIN=$(CCC)
-
-# Define the generic compilation rules.
-
-.c.obj:
- $(CCC) { $<}
-
-.cpp.obj:
- $(CCC) { $<}
+# No additional flags are needed for Windows compilation.
+CCWINFLAGS=
# Define the files to be removed by `make clean'.
# nmake expands macros when encountered, not when used,
# so this must precede the !include statements.
-BEGINFILES2=gs16spl.exe
+BEGINFILES2=$(GLOBJDIR)\gs16spl.exe
# Include the generic makefiles.
-!include winlib.mak
-!include winint.mak
+!include $(GLSRCDIR)\winlib.mak
+!include $(GLSRCDIR)\winint.mak
# -------------------------- Auxiliary programs --------------------------- #
+# Compiler for auxiliary programs
+
+CCAUX=$(COMPAUX) -ml -I$(INCDIR) -L$(LIBDIR) -n$(AUXGENDIR) -O
+CCAUX_TAIL=
+
ccf32.tr: $(MAKEFILE) makefile
echo -a1 -d -r -G -N -X -I$(INCDIR) $(CCFLAGS0) -DCHECK_INTERRUPTS > ccf32.tr
# Since we are running in a Windows environment with a different compiler
-# for the DOS utilities, we have to invoke genarch by hand:
-$(GENARCH_XE): genarch.c $(stdpre_h) $(iref_h) ccf32.tr
- $(COMP) -I$(INCDIR) -L$(LIBDIR) -O genarch.c
- echo ***** Run "win genarch arch.h", then continue make. *****
+# for the DOS utilities, we have to invoke genarch by hand.
+# For unfathomable reasons, the 'win' program requires /, not \,
+# in the name of the program to be run, and apparently also in any
+# file names passed on the command line (?!).
+$(GENARCH_XE): $(GLSRC)genarch.c $(stdpre_h) $(iref_h) ccf32.tr
+ $(COMP) -I$(INCDIR) -L$(LIBDIR) -n$(AUXGENDIR) -O $(GLSRC)genarch.c
+ echo win $(AUXGENDIR)/genarch $(GLGENDIR)/arch.h >_genarch.bat
+ echo ***** Run "_genarch.bat", then continue make. *****
# -------------------------------- Library -------------------------------- #
@@ -362,73 +368,78 @@ $(GENARCH_XE): genarch.c $(stdpre_h) $(iref_h) ccf32.tr
# ----------------------------- Main program ------------------------------ #
LIBCTR=libc32.tr
+GSCONSOLE_XE=$(GLOBJ)$(GSCONSOLE).exe
$(LIBCTR): $(MAKEFILE) $(ECHOGS_XE)
- echogs -w $(LIBCTR) $(LIBDIR)\import32.lib+
- echogs -a $(LIBCTR) $(LIBDIR)\cw32.lib
+ echo $(LIBDIR)\import32.lib $(LIBDIR)\cw32.lib >$(LIBCTR)
!if $(MAKEDLL)
# The graphical small EXE loader
-$(GS_XE): $(GSDLL).dll $(DWOBJ) $(GSCONSOLE).exe
+$(GS_XE): $(GSDLL_OBJ).dll $(DWOBJ) $(GSCONSOLE_XE)\
+ $(GS_OBJ).res $(GLSRC)dwmain32.def
$(LINK) /Tpe $(LCT) @&&!
$(LIBDIR)\c0w32 +
$(DWOBJ) +
,$(GS_XE),$(GS), +
$(LIBDIR)\import32 +
$(LIBDIR)\cw32, +
-dwmain32.def, +
-$(GS).res
+$(GLSRC)dwmain32.def, +
+$(GS_OBJ).res
!
# The console mode small EXE loader
-$(GSCONSOLE).exe: $(OBJC) $(GS).res dw32c.def
+$(GSCONSOLE_XE): $(OBJC) $(GS_OBJ).res $(GLSRC)dw32c.def
$(LINK) /Tpe /ap $(LCT) $(DEBUGLINK) @&&!
$(LIBDIR)\c0w32 +
$(OBJC) +
-,$(GSCONSOLE).exe,$(GSCONSOLE), +
+,$(GSCONSOLE_XE),$(GSCONSOLE), +
$(LIBDIR)\import32 +
$(LIBDIR)\cw32, +
-dw32c.def, +
-$(GS).res
+$(GLSRC)dw32c.def, +
+$(GS_OBJ).res
!
# The big DLL
-$(GSDLL).dll: $(GS_ALL) $(DEVS_ALL) gsdll.$(OBJ) $(GSDLL).res
- $(LINK) $(LCT) /Tpd $(LIBDIR)\c0d32 gsdll @$(ld_tr) $(INTASM) ,$(GSDLL).dll,$(GSDLL),@lib.tr @$(LIBCTR),$(GSDLL).def,$(GSDLL).res
+$(GSDLL_OBJ).dll: $(GS_ALL) $(DEVS_ALL) $(GLOBJ)gsdll.$(OBJ)\
+ $(GSDLL_OBJ).res $(GSDLL_SRC).def
+ echo $(LIBDIR)\c0d32 $(GLOBJ)gsdll + > gswin32.tr
+ copy /Y gswin32.tr+$(ld_tr)
+ $(LINK) $(LCT) /Tpd @gswin32.tr $(INTASM) ,$(GSDLL_OBJ).dll,$(GSDLL),@lib.tr @$(LIBCTR),$(GSDLL_SRC).def,$(GSDLL_OBJ).res
!else
# The big graphical EXE
-$(GS_XE): $(GSCONSOLE).exe $(GS_ALL) $(DEVS_ALL) gsdll.$(OBJ) $(DWOBJNO) $(GS).res dwmain32.def
- copy $(ld_tr) gswin32.tr
- echo $(DWOBJNO) + >> gswin32.tr
- $(LINK) $(LCT) /Tpe $(LIBDIR)\c0w32 gsdll @gswin32.tr $(INTASM) ,$(GS_XE),$(GS),@lib.tr @$(LIBCTR),dwmain32.def,$(GS).res
+$(GS_XE): $(GSCONSOLE_XE) $(GS_ALL) $(DEVS_ALL)\
+ $(GLOBJ)gsdll.$(OBJ) $(DWOBJNO) $(GS_OBJ).res $(GLSRC)dwmain32.def
+ echo $(LIBDIR)\c0w32 $(GLOBJ)gsdll + > gswin32.tr
+ copy /Y gswin32.tr+$(ld_tr)
+ echo $(DWOBJNO) $(INTASM) >> gswin32.tr
+ $(LINK) $(LCT) /Tpe @gswin32.tr ,$(GS_XE),$(GS),@lib.tr @$(LIBCTR),$(GLSRC)dwmain32.def,$(GS_OBJ).res
-del gswin32.tr
# The big console mode EXE
-$(GSCONSOLE).exe: $(GS_ALL) $(DEVS_ALL) gsdll.$(OBJ) $(OBJCNO) $(GS).res dw32c.def
- copy $(ld_tr) gswin32.tr
- echo $(OBJCNO) + >> gswin32.tr
- $(LINK) $(LCT) /Tpe /ap $(LIBDIR)\c0w32 gsdll @gswin32.tr $(INTASM) ,$(GSCONSOLE),$(GSCONSOLE),@lib.tr @$(LIBCTR),dw32c.def,$(GS).res
+$(GSCONSOLE_XE): $(GS_ALL) $(DEVS_ALL)\
+ $(GLOBJ)gsdll.$(OBJ) $(OBJCNO) $(GS_OBJ).res $(GLSRC)dw32c.def
+ echo $(LIBDIR)\c0w32 $(GLOBJ)gsdll + > gswin32.tr
+ copy /Y gswin32.tr+$(ld_tr)
+ echo $(OBJCNO) $(INTASM) >> gswin32.tr
+ $(LINK) $(LCT) /Tpe /ap @gswin32.tr ,$(GSCONSOLE_XE),$(GSCONSOLE),@lib.tr @$(LIBCTR),$(GLSRC)dw32c.def,$(GS_OBJ).res
-del gswin32.tr
!endif
# Access to 16 spooler from Win32s
-gs16spl.exe: gs16spl.c gs16spl.rc
- $(CCAUX) -W -ms -c -v -I$(INCDIR) $*.c
- $(COMPDIR)\brcc -i$(INCDIR) -r $*.rc
+$(GLOBJ)gs16spl.exe: $(GLSRC)gs16spl.c $(GLSRC)gs16spl.rc
+ $(CCAUX) -W -ms -v -I$(INCDIR) $(GLO_)gs16spl.obj -c $(GLSRC)gs16spl.c
+ $(COMPDIR)\brcc -i$(INCDIR) -r -fo$(GLOBJ)gs16spl.res $(GLSRC)gs16spl.rc
$(COMPDIR)\tlink /Twe /c /m /s /l @&&!
$(LIBDIR)\c0ws +
-$*.obj +
-,$*.exe,$*, +
+$(GLOBJ)gs16spl.obj +
+,$(GLOBJ)gs16spl.exe,$(GLOBJ)gs16spl, +
$(LIBDIR)\import +
$(LIBDIR)\mathws +
$(LIBDIR)\cws, +
-$*.def
+$(GLSRC)gs16spl.def
!
- $(COMPDIR)\rlink -t $*.res $*.exe
+ $(COMPDIR)\rlink -t $(GLOBJ)gs16spl.res $(GLOBJ)gs16spl.exe
# end of makefile
-
-
-
diff --git a/gs/src/bench.c b/gs/src/bench.c
index bf36d700a..f7d7653ce 100644
--- a/gs/src/bench.c
+++ b/gs/src/bench.c
@@ -17,7 +17,7 @@
all copies.
*/
-/* bench.c */
+/*Id: bench.c */
/* Simple hardware benchmarking suite (C and PostScript) */
#include <stdio.h>
#include <stdlib.h>
@@ -32,7 +32,7 @@ extern void gp_get_usertime(long ptm[2]);
FILE *gs_stdout;
FILE *gs_stderr;
const char gp_scratch_file_name_prefix[] = "gs_";
-void
+void
gp_init_console()
{
}
@@ -41,16 +41,16 @@ gp_open_scratch_file(const char *prefix, char *fname, const char *mode)
{
return NULL;
}
-void
+void
gp_set_printer_binary(int prnfno, int binary)
{
}
-void
+void
gs_exit(n)
{
exit(n);
}
-void
+void
lprintf_file_and_line(FILE * f, const char *file, int line)
{
fprintf(f, "%s(%d): ", file, line);
diff --git a/gs/src/bfont.h b/gs/src/bfont.h
index 3d140030f..ce92decf8 100644
--- a/gs/src/bfont.h
+++ b/gs/src/bfont.h
@@ -1,28 +1,33 @@
-/* Copyright (C) 1992, 1995, 1996 Aladdin Enterprises. All rights reserved.
-
- This file is part of Aladdin Ghostscript.
-
- Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
- or distributor accepts any responsibility for the consequences of using it,
- or for whether it serves any particular purpose or works at all, unless he
- or she says so in writing. Refer to the Aladdin Ghostscript Free Public
- License (the "License") for full details.
-
- Every copy of Aladdin Ghostscript must include a copy of the License,
- normally in a plain ASCII text file named PUBLIC. The License grants you
- the right to copy, modify and redistribute Aladdin Ghostscript, but only
- under certain conditions described in the License. Among other things, the
- License requires that the copyright notice and this notice be preserved on
- all copies.
-*/
-
-/* bfont.h */
+/* Copyright (C) 1992, 1995, 1996, 1998 Aladdin Enterprises. All rights reserved.
+
+ This file is part of Aladdin Ghostscript.
+
+ Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
+ or distributor accepts any responsibility for the consequences of using it,
+ or for whether it serves any particular purpose or works at all, unless he
+ or she says so in writing. Refer to the Aladdin Ghostscript Free Public
+ License (the "License") for full details.
+
+ Every copy of Aladdin Ghostscript must include a copy of the License,
+ normally in a plain ASCII text file named PUBLIC. The License grants you
+ the right to copy, modify and redistribute Aladdin Ghostscript, but only
+ under certain conditions described in the License. Among other things, the
+ License requires that the copyright notice and this notice be preserved on
+ all copies.
+ */
+
+/*Id: bfont.h */
/* Interpreter internal routines and data needed for building fonts */
/* Requires gxfont.h */
+
+#ifndef bfont_INCLUDED
+# define bfont_INCLUDED
+
#include "ifont.h"
/* In zfont.c */
-int add_FID(P2(ref *pfdict, gs_font *pfont));
+int add_FID(P2(ref * pfdict, gs_font * pfont));
+
font_proc_make_font(zdefault_make_font);
font_proc_make_font(zbase_make_font);
/* The global font directory */
@@ -30,25 +35,25 @@ extern gs_font_dir *ifont_dir;
/* Structure for passing BuildChar and BuildGlyph procedures. */
typedef struct build_proc_refs_s {
- ref BuildChar;
- ref BuildGlyph;
+ ref BuildChar;
+ ref BuildGlyph;
} build_proc_refs;
/* Options for collecting parameters from a font dictionary. */
/* The comment indicates where the option is tested. */
typedef enum {
- bf_options_none = 0,
- bf_Encoding_optional = 1, /* build_gs_font */
- bf_FontBBox_required = 2, /* build_gs_simple_font */
- bf_UniqueID_ignored = 4, /* build_gs_simple_font */
- bf_CharStrings_optional = 8, /* build_gs_primitive_font */
- bf_notdef_required = 16 /* build_gs_primitive_font */
+ bf_options_none = 0,
+ bf_Encoding_optional = 1, /* build_gs_font */
+ bf_FontBBox_required = 2, /* build_gs_simple_font */
+ bf_UniqueID_ignored = 4, /* build_gs_simple_font */
+ bf_CharStrings_optional = 8, /* build_gs_primitive_font */
+ bf_notdef_required = 16 /* build_gs_primitive_font */
} build_font_options_t;
/* In zfont2.c */
-int build_proc_name_refs(P3(build_proc_refs *pbuild,
- const char _ds *bcstr,
- const char _ds *bgstr));
+int build_proc_name_refs(P3(build_proc_refs * pbuild,
+ const char *bcstr,
+ const char *bgstr));
int build_gs_font_procs(P2(os_ptr, build_proc_refs *));
int build_gs_primitive_font(P6(os_ptr, gs_font_base **, font_type,
gs_memory_type_ptr_t, const build_proc_refs *,
@@ -61,3 +66,5 @@ int build_gs_font(P6(os_ptr, gs_font **, font_type,
gs_memory_type_ptr_t, const build_proc_refs *,
build_font_options_t));
int define_gs_font(P1(gs_font *));
+
+#endif /* bfont_INCLUDED */
diff --git a/gs/src/btoken.h b/gs/src/btoken.h
index f880e6fc9..ae7ec1182 100644
--- a/gs/src/btoken.h
+++ b/gs/src/btoken.h
@@ -1,60 +1,35 @@
-/* Copyright (C) 1990 Aladdin Enterprises. All rights reserved.
-
- This file is part of Aladdin Ghostscript.
-
- Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
- or distributor accepts any responsibility for the consequences of using it,
- or for whether it serves any particular purpose or works at all, unless he
- or she says so in writing. Refer to the Aladdin Ghostscript Free Public
- License (the "License") for full details.
-
- Every copy of Aladdin Ghostscript must include a copy of the License,
- normally in a plain ASCII text file named PUBLIC. The License grants you
- the right to copy, modify and redistribute Aladdin Ghostscript, but only
- under certain conditions described in the License. Among other things, the
- License requires that the copyright notice and this notice be preserved on
- all copies.
-*/
-
-/* btoken.h */
+/* Copyright (C) 1990, 1998 Aladdin Enterprises. All rights reserved.
+
+ This file is part of Aladdin Ghostscript.
+
+ Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
+ or distributor accepts any responsibility for the consequences of using it,
+ or for whether it serves any particular purpose or works at all, unless he
+ or she says so in writing. Refer to the Aladdin Ghostscript Free Public
+ License (the "License") for full details.
+
+ Every copy of Aladdin Ghostscript must include a copy of the License,
+ normally in a plain ASCII text file named PUBLIC. The License grants you
+ the right to copy, modify and redistribute Aladdin Ghostscript, but only
+ under certain conditions described in the License. Among other things, the
+ License requires that the copyright notice and this notice be preserved on
+ all copies.
+ */
+
+/*Id: btoken.h */
/* Definitions for Level 2 binary tokens */
-/* Binary token types */
-typedef enum {
- bt_seq = 128,
- bt_seq_IEEE_msb = 128, /* binary object sequence, */
- /* IEEE floats, big-endian */
- bt_seq_IEEE_lsb = 129, /* ditto, little-endian */
- bt_seq_native_msb = 130, /* ditto, native floats, big-endian */
- bt_seq_native_lsb = 131, /* ditto, little-endian */
- bt_int32_msb = 132,
- bt_int32_lsb = 133,
- bt_int16_msb = 134,
- bt_int16_lsb = 135,
- bt_int8 = 136,
- bt_fixed = 137,
- bt_float_IEEE_msb = 138,
- bt_float_IEEE_lsb = 139,
- bt_float_native = 140,
- bt_boolean = 141,
- bt_string_256 = 142,
- bt_string_64k_msb = 143,
- bt_string_64k_lsb = 144,
- bt_litname_system = 145,
- bt_execname_system = 146,
- bt_litname_user = 147,
- bt_execname_user = 148,
- bt_num_array = 149
-} bt_char;
-#define bt_char_min 128
-#define bt_char_max 159
-
-/* Define the number of required initial bytes for binary tokens */
-/* (including the token type byte). */
-extern const byte bin_token_bytes[]; /* in iscan2.c */
-#define bin_token_bytes_values\
- 4, 4, 4, 4, 5, 5, 3, 3, 2, 2, 5, 5, 5,\
- 2, 2, 3, 3, 2, 2, 2, 2, 4,\
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 /* undefined */
-#define binary_token_bytes(btchar)\
- (bin_token_bytes[(btchar) - bt_char_min])
+#ifndef btoken_INCLUDED
+# define btoken_INCLUDED
+
+/* Define accessors for pointers to the system and user name tables. */
+extern ref binary_token_names; /* array of size 2 */
+
+#define system_names_p (binary_token_names.value.refs)
+#define user_names_p (binary_token_names.value.refs + 1)
+
+/* Convert an object to its representation in a binary object sequence. */
+int encode_binary_token(P4(const ref * obj, long *ref_offset, long *char_offset,
+ byte * str));
+
+#endif /* btoken_INCLUDED */
diff --git a/gs/src/ccfont.h b/gs/src/ccfont.h
index 8a381ad96..790eaf5de 100644
--- a/gs/src/ccfont.h
+++ b/gs/src/ccfont.h
@@ -1,22 +1,22 @@
/* Copyright (C) 1992, 1995 Aladdin Enterprises. All rights reserved.
-
- This file is part of Aladdin Ghostscript.
-
- Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
- or distributor accepts any responsibility for the consequences of using it,
- or for whether it serves any particular purpose or works at all, unless he
- or she says so in writing. Refer to the Aladdin Ghostscript Free Public
- License (the "License") for full details.
-
- Every copy of Aladdin Ghostscript must include a copy of the License,
- normally in a plain ASCII text file named PUBLIC. The License grants you
- the right to copy, modify and redistribute Aladdin Ghostscript, but only
- under certain conditions described in the License. Among other things, the
- License requires that the copyright notice and this notice be preserved on
- all copies.
-*/
-/* ccfont.h */
+ This file is part of Aladdin Ghostscript.
+
+ Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
+ or distributor accepts any responsibility for the consequences of using it,
+ or for whether it serves any particular purpose or works at all, unless he
+ or she says so in writing. Refer to the Aladdin Ghostscript Free Public
+ License (the "License") for full details.
+
+ Every copy of Aladdin Ghostscript must include a copy of the License,
+ normally in a plain ASCII text file named PUBLIC. The License grants you
+ the right to copy, modify and redistribute Aladdin Ghostscript, but only
+ under certain conditions described in the License. Among other things, the
+ License requires that the copyright notice and this notice be preserved on
+ all copies.
+ */
+
+/*Id: ccfont.h */
/* Header for fonts compiled into C. */
#ifndef ccfont_INCLUDED
@@ -37,7 +37,10 @@
#define real_v(v) { {t_real<<r_type_shift}, (float)(v) }
/* Define other initialization structures. */
-typedef struct { byte encx, charx; } charindex;
+typedef struct {
+ byte encx, charx;
+} charindex;
+
/*
* We represent mostly-string arrays by byte strings. Each element
* starts with length bytes. If the first length byte is not 255,
@@ -50,33 +53,34 @@ typedef const char *cfont_string_array;
/* Support routines in iccfont.c */
typedef struct {
- const charindex *enc_keys; /* keys from encoding vectors */
- uint num_enc_keys;
- uint num_str_keys;
- uint extra_slots; /* (need extra for fonts) */
- uint dict_attrs; /* protection for dictionary */
- uint value_attrs; /* protection for values */
- /* (only used for string dicts) */
+ const charindex *enc_keys; /* keys from encoding vectors */
+ uint num_enc_keys;
+ uint num_str_keys;
+ uint extra_slots; /* (need extra for fonts) */
+ uint dict_attrs; /* protection for dictionary */
+ uint value_attrs; /* protection for values */
+ /* (only used for string dicts) */
} cfont_dict_keys;
+
/* We pass a procedure vector to the font initialization routine */
/* to avoid having externs, which compromise sharability. */
/* On MS-DOS, each compiled font has its own data segment, */
/* so all of these procedures must be declared 'huge' for Borland C. */
typedef struct cfont_procs_s {
- int huge (*ref_dict_create)(P4(ref *, const cfont_dict_keys *,
- cfont_string_array, const ref *));
- int huge (*string_dict_create)(P4(ref *, const cfont_dict_keys *,
- cfont_string_array,
- cfont_string_array));
- int huge (*num_dict_create)(P5(ref *, const cfont_dict_keys *,
- cfont_string_array, const ref *,
- const char *));
- int huge (*name_array_create)(P3(ref *, cfont_string_array, int));
- int huge (*string_array_create)(P4(ref *, cfont_string_array,
- int /*size*/,
- uint /*protection*/));
- int huge (*name_create)(P2(ref *, const char *));
- int huge (*ref_from_string)(P3(ref *, const char *, uint));
+ int huge(*ref_dict_create) (P4(ref *, const cfont_dict_keys *,
+ cfont_string_array, const ref *));
+ int huge(*string_dict_create) (P4(ref *, const cfont_dict_keys *,
+ cfont_string_array,
+ cfont_string_array));
+ int huge(*num_dict_create) (P5(ref *, const cfont_dict_keys *,
+ cfont_string_array, const ref *,
+ const char *));
+ int huge(*name_array_create) (P3(ref *, cfont_string_array, int));
+ int huge(*string_array_create) (P4(ref *, cfont_string_array,
+ int /*size */ ,
+ uint /*protection */ ));
+ int huge(*name_create) (P2(ref *, const char *));
+ int huge(*ref_from_string) (P3(ref *, const char *, uint));
} cfont_procs;
/*
@@ -85,9 +89,11 @@ typedef struct cfont_procs_s {
* a tiny procedural interface for getting access to the compiled font table.
*/
typedef huge int ccfont_fproc(P2(const cfont_procs *, ref *));
+
/* There should be some consts in the *** below, but a number of */
/* C compilers don't handle const properly in such situations. */
extern int ccfont_fprocs(P2(int *, ccfont_fproc ***));
-#define ccfont_version 17 /* for checking against libraries */
-#endif /* ccfont_INCLUDED */
+#define ccfont_version 17 /* for checking against libraries */
+
+#endif /* ccfont_INCLUDED */
diff --git a/gs/src/ccgs b/gs/src/ccgs
index 49cc5dfcd..cefd0618c 100644
--- a/gs/src/ccgs
+++ b/gs/src/ccgs
@@ -1,40 +1,20 @@
-# This file is a hack. If `make' had macros with parameters,
-# this file would be unnecessary!
-if ( test -n "$6" ) then
- ./ansi2knr $6 _temp_$$.c
- $1 $2 $3 _temp_$$.c
- rm -f $5
- mv _temp_$$.o $5
-else
-# Modified this bit here for more compilation flags ...
-if ( test -n "$5" ) then
- ./ansi2knr $5 _temp_$$.c
- $1 $2 $3 $4 _temp_$$.c
- if ( test "$2" != "-o" ) then
- rm -f `basename $5 .c` .o
- mv _temp_$$.o `basename $5 .c`.o
- fi
-else
-if ( test -n "$4" ) then
- ./ansi2knr $4 _temp_$$.c
- $1 $2 $3 _temp_$$.c
- if ( test "$2" != "-o" ) then
- rm -f `basename $4 .c`.o
- mv _temp_$$.o `basename $4 .c`.o
- fi
-else
-if ( test -n "$3" ) then
- ./ansi2knr $3 _temp_$$.c
- $1 $2 _temp_$$.c
- rm -f `basename $3 .c`.o
- mv _temp_$$.o `basename $3 .c`.o
-else
- ./ansi2knr $2 _temp_$$.c
- $1 _temp_$$.c
- rm -f `basename $2 .c`.o
- mv _temp_$$.o `basename $2 .c`.o
-fi
-fi
-fi
-fi
+#!/bin/sh
+# Id: ccgs
+# Pre-process ANSI C files with ansi2knr before compiling.
+# Usage: ccgs "cc switches..." ...switches... -c inputfile ... -o outputfile
+
+CFILE=""
+OFILE=""
+CMD=$1
+while [ $# -gt 1 ]
+do
+ shift
+ case "$1" in
+ -c) CFILE=$2; shift;;
+ -o) OFILE=$2; shift;;
+ *) CMD="$CMD $1";;
+ esac
+done
+./ansi2knr $CFILE _temp_$$.c
+$CMD -c _temp_$$.c -o $OFILE
rm -f _temp_$$.c
diff --git a/gs/src/cfonts.mak b/gs/src/cfonts.mak
index 777783dde..a07915879 100644
--- a/gs/src/cfonts.mak
+++ b/gs/src/cfonts.mak
@@ -15,6 +15,7 @@
# License requires that the copyright notice and this notice be preserved on
# all copies.
+# Id: cfonts.mak
# Makefile for compiling PostScript Type 1 fonts into C.
# For more information about fonts, consult the Fontmap file,
# and also fonts.txt.
diff --git a/gs/src/cp.cmd b/gs/src/cp.cmd
index e6ad951c7..069addfc1 100755
--- a/gs/src/cp.cmd
+++ b/gs/src/cp.cmd
@@ -1,2 +1,3 @@
@copy /B %1 %2
+@rem Id: cp.cmd
@if not "%2"=="." touch %2
diff --git a/gs/src/ctype_.h b/gs/src/ctype_.h
index 88034b94b..45199dbd7 100644
--- a/gs/src/ctype_.h
+++ b/gs/src/ctype_.h
@@ -1,26 +1,31 @@
-/* Copyright (C) 1993 Aladdin Enterprises. All rights reserved.
-
- This file is part of Aladdin Ghostscript.
-
- Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
- or distributor accepts any responsibility for the consequences of using it,
- or for whether it serves any particular purpose or works at all, unless he
- or she says so in writing. Refer to the Aladdin Ghostscript Free Public
- License (the "License") for full details.
-
- Every copy of Aladdin Ghostscript must include a copy of the License,
- normally in a plain ASCII text file named PUBLIC. The License grants you
- the right to copy, modify and redistribute Aladdin Ghostscript, but only
- under certain conditions described in the License. Among other things, the
- License requires that the copyright notice and this notice be preserved on
- all copies.
-*/
-
-/* ctype_.h */
+/* Copyright (C) 1993, 1998 Aladdin Enterprises. All rights reserved.
+
+ This file is part of Aladdin Ghostscript.
+
+ Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
+ or distributor accepts any responsibility for the consequences of using it,
+ or for whether it serves any particular purpose or works at all, unless he
+ or she says so in writing. Refer to the Aladdin Ghostscript Free Public
+ License (the "License") for full details.
+
+ Every copy of Aladdin Ghostscript must include a copy of the License,
+ normally in a plain ASCII text file named PUBLIC. The License grants you
+ the right to copy, modify and redistribute Aladdin Ghostscript, but only
+ under certain conditions described in the License. Among other things, the
+ License requires that the copyright notice and this notice be preserved on
+ all copies.
+ */
+
+/*Id: ctype_.h */
/* Wrapper for ctype.h */
+#ifndef ctype__INCLUDED
+# define ctype__INCLUDED
+
/* We must include std.h before any file that includes sys/types.h. */
#include "std.h"
/* ... and that's the only reason for having this file at all. */
#include <ctype.h>
+
+#endif /* ctype__INCLUDED */
diff --git a/gs/src/devs.mak b/gs/src/devs.mak
index ff10b8d05..6bd7ead45 100644
--- a/gs/src/devs.mak
+++ b/gs/src/devs.mak
@@ -1,4 +1,4 @@
-# Copyright (C) 1989, 1996, 1997 Aladdin Enterprises. All rights reserved.
+# Copyright (C) 1989, 1996, 1997, 1998 Aladdin Enterprises. All rights reserved.
#
# This file is part of Aladdin Ghostscript.
#
@@ -15,16 +15,37 @@
# License requires that the copyright notice and this notice be preserved on
# all copies.
-# makefile for device drivers.
+# Id: devs.mak
+# makefile for Aladdin's device drivers.
# Define the name of this makefile.
-DEVS_MAK=devs.mak
+DEVS_MAK=$(GLSRC)devs.mak
-###### --------------------------- Catalog -------------------------- ######
+# All device drivers depend on the following:
+GDEVH=$(gserrors_h) $(gx_h) $(gxdevice_h)
+GDEV=$(AK) $(ECHOGS_XE) $(GDEVH)
+
+###### --------------------------- Overview -------------------------- ######
+
+# It is possible to build Ghostscript with an arbitrary collection of device
+# drivers, although some drivers are supported only on a subset of the
+# target platforms.
-# It is possible to build configurations with an arbitrary collection of
-# device drivers, although some drivers are supported only on a subset
-# of the target platforms. The currently available drivers are:
+# The catalog in this file, devs.mak, lists all the drivers that were
+# written by Aladdin, or by people working closely with Aladdin, and for
+# which Aladdin is willing to take problem reports (although since
+# Ghostscript is provided with NO WARRANTY and NO SUPPORT, we can't promise
+# that we'll solve your problem). Another file, contrib.mak, lists all the
+# drivers contributed by other people that are distributed by Aladdin with
+# Ghostscript. Note in particular that all drivers for color inkjets and
+# other non-PostScript-capable color printers are in contrib.mak.
+
+# If you haven't configured Ghostscript before, or if you want to add a
+# driver that that isn't included in the catalogs (for which you have the
+# source code), we suggest you skip to the "End of catalog" below and read
+# the documentation there before continuing.
+
+###### --------------------------- Catalog -------------------------- ######
# MS-DOS displays (note: not usable with Desqview/X):
# MS-DOS EGA and VGA:
@@ -33,6 +54,7 @@ DEVS_MAK=devs.mak
# MS-DOS SuperVGA:
# * ali SuperVGA using Avance Logic Inc. chipset, 256-color modes
# * atiw ATI Wonder SuperVGA, 256-color modes
+# * cirr SuperVGA using Cirrus Logic CL-GD54XX chips, 256-color modes
# * s3vga SuperVGA using S3 86C911 chip (e.g., Diamond Stealth board)
# svga16 Generic SuperVGA in 800x600, 16-color mode
# * tseng SuperVGA using Tseng Labs ET3000/4000 chips, 256-color modes
@@ -40,10 +62,6 @@ DEVS_MAK=devs.mak
# ****** NOTE: The vesa device does not work with the Watcom (32-bit MS-DOS)
# ****** compiler or executable.
# vesa SuperVGA with VESA standard API driver
-# MS-DOS other:
-# bgi Borland Graphics Interface (CGA) [MS-DOS only]
-# * herc Hercules Graphics display [MS-DOS only]
-# * pe Private Eye display
# Other displays:
# MS Windows:
# mswindll Microsoft Windows 3.1 DLL [MS Windows only]
@@ -56,107 +74,30 @@ DEVS_MAK=devs.mak
# Unix and VMS:
# ****** NOTE: For direct frame buffer addressing under SCO Unix or Xenix,
# ****** edit the definition of EGAVGA below.
-# * att3b1 AT&T 3b1/Unixpc monochrome display [3b1 only]
# * lvga256 Linux vgalib, 256-color VGA modes [Linux only]
-# * sonyfb Sony Microsystems monochrome display [Sony only]
-# * sunview SunView window system [SunOS only]
# + vgalib Linux PC with VGALIB [Linux only]
# x11 X Windows version 11, release >=4 [Unix and VMS only]
# x11alpha X Windows masquerading as a device with alpha capability
# x11cmyk X Windows masquerading as a 1-bit-per-plane CMYK device
# x11gray2 X Windows as a 2-bit gray-scale device
# x11mono X Windows masquerading as a black-and-white device
-# Platform-independent:
-# * sxlcrt CRT sixels, e.g. for VT240-like terminals
# Printers:
-# * ap3250 Epson AP3250 printer
-# * appledmp Apple Dot Matrix Printer (should also work with Imagewriter)
-# bj10e Canon BubbleJet BJ10e
-# * bj200 Canon BubbleJet BJ200
-# * bjc600 Canon Color BubbleJet BJC-600, BJC-4000 and BJC-70
-# also good for Apple printers like the StyleWriter 2x00
-# * bjc800 Canon Color BubbleJet BJC-800
-# * ccr CalComp Raster format
-# * cdeskjet H-P DeskJet 500C with 1 bit/pixel color
-# * cdjcolor H-P DeskJet 500C with 24 bit/pixel color and
-# high-quality color (Floyd-Steinberg) dithering;
-# also good for DeskJet 540C and Citizen Projet IIc (-r200x300)
-# * cdjmono H-P DeskJet 500C printing black only;
-# also good for DeskJet 510, 520, and 540C (black only)
-# * cdj500 H-P DeskJet 500C (same as cdjcolor)
-# * cdj550 H-P DeskJet 550C/560C/660C/660Cse
-# * cp50 Mitsubishi CP50 color printer
-# * declj250 alternate DEC LJ250 driver
# + deskjet H-P DeskJet and DeskJet Plus
# djet500 H-P DeskJet 500; use -r600 for DJ 600 series
-# * djet500c H-P DeskJet 500C alternate driver
-# (does not work on 550C or 560C)
-# * dnj650c H-P DesignJet 650C
-# epson Epson-compatible dot matrix printers (9- or 24-pin)
-# * eps9mid Epson-compatible 9-pin, interleaved lines
-# (intermediate resolution)
-# * eps9high Epson-compatible 9-pin, interleaved lines
-# (triple resolution)
-# * epsonc Epson LQ-2550 and Fujitsu 3400/2400/1200 color printers
-# * ibmpro IBM 9-pin Proprinter
-# * imagen Imagen ImPress printers
-# * iwhi Apple Imagewriter in high-resolution mode
-# * iwlo Apple Imagewriter in low-resolution mode
-# * iwlq Apple Imagewriter LQ in 320 x 216 dpi mode
-# * jetp3852 IBM Jetprinter ink-jet color printer (Model #3852)
# + laserjet H-P LaserJet
-# * la50 DEC LA50 printer
-# * la70 DEC LA70 printer
-# * la70t DEC LA70 printer with low-resolution text enhancement
-# * la75 DEC LA75 printer
-# * la75plus DEC LA75plus printer
-# * lbp8 Canon LBP-8II laser printer
-# * lips3 Canon LIPS III laser printer in English (CaPSL) mode
-# * ln03 DEC LN03 printer
-# * lj250 DEC LJ250 Companion color printer
# + ljet2p H-P LaserJet IId/IIp/III* with TIFF compression
# + ljet3 H-P LaserJet III* with Delta Row compression
# + ljet3d H-P LaserJet IIID with duplex capability
# + ljet4 H-P LaserJet 4 (defaults to 600 dpi)
-# + lj4dith H-P LaserJet 4 with Floyd-Steinberg dithering
# + ljetplus H-P LaserJet Plus
# lj5mono H-P LaserJet 5 & 6 family (PCL XL), bitmap:
# see below for restrictions & advice
# lj5gray H-P LaserJet 5 & 6 family, gray-scale bitmap;
# see below for restrictions & advice
# * lp2563 H-P 2563B line printer
-# * lp8000 Epson LP-8000 laser printer
-# * lq850 Epson LQ850 printer at 360 x 360 DPI resolution;
-# also good for Canon BJ300 with LQ850 emulation
-# * m8510 C.Itoh M8510 printer
-# * necp6 NEC P6/P6+/P60 printers at 360 x 360 DPI resolution
-# * nwp533 Sony Microsystems NWP533 laser printer [Sony only]
# * oce9050 OCE 9050 printer
-# * oki182 Okidata MicroLine 182
-# * okiibm Okidata MicroLine IBM-compatible printers
-# * paintjet alternate H-P PaintJet color printer
-# * pj H-P PaintJet XL driver
-# * pjetxl alternate H-P PaintJet XL driver
-# * pjxl H-P PaintJet XL color printer
-# * pjxl300 H-P PaintJet XL300 color printer;
-# also good for PaintJet 1200C
# (pxlmono) H-P black-and-white PCL XL printers (LaserJet 5 and 6 family)
# (pxlcolor) H-P color PCL XL printers (none available yet)
-# * r4081 Ricoh 4081 laser printer
-# * sj48 StarJet 48 inkjet printer
-# * sparc SPARCprinter
-# * st800 Epson Stylus 800 printer
-# * stcolor Epson Stylus Color
-# * t4693d2 Tektronix 4693d color printer, 2 bits per R/G/B component
-# * t4693d4 Tektronix 4693d color printer, 4 bits per R/G/B component
-# * t4693d8 Tektronix 4693d color printer, 8 bits per R/G/B component
-# * tek4696 Tektronix 4695/4696 inkjet plotter
-# * uniprint Unified printer driver -- Configurable Color ESC/P-,
-# ESC/P2-, HP-RTL/PCL mono/color driver
-# * xes Xerox XES printers (2700, 3700, 4045, etc.)
-# Fax systems:
-# * dfaxhigh DigiBoard, Inc.'s DigiFAX software format (high resolution)
-# * dfaxlow DigiFAX low (normal) resolution
# Fax file format:
# ****** NOTE: all of these drivers adjust the page size to match
# ****** one of the three CCITT standard sizes (U.S. letter with A4 width,
@@ -185,16 +126,9 @@ DEVS_MAK=devs.mak
# cgmmono Monochrome (black-and-white) CGM -- LOW LEVEL OUTPUT ONLY
# cgm8 8-bit (256-color) CGM -- DITTO
# cgm24 24-bit color CGM -- DITTO
-# * cif CIF file format for VLSI
# jpeg JPEG format, RGB output
# jpeggray JPEG format, gray output
# miff24 ImageMagick MIFF format, 24-bit direct color, RLE compressed
-# * mgrmono 1-bit monochrome MGR devices
-# * mgrgray2 2-bit gray scale MGR devices
-# * mgrgray4 4-bit gray scale MGR devices
-# * mgrgray8 8-bit gray scale MGR devices
-# * mgr4 4-bit (VGA) color MGR devices
-# * mgr8 8-bit color MGR devices
# pcxmono PCX file format, monochrome (1-bit black and white)
# pcxgray PCX file format, 8-bit gray scale
# pcx16 PCX file format, 4-bit planar (EGA/VGA) color
@@ -215,6 +149,7 @@ DEVS_MAK=devs.mak
# ppmraw Portable Pixmap (raw format) (RGB)
# pkm Portable inKmap (plain format) (4-bit CMYK => RGB)
# pkmraw Portable inKmap (raw format) (4-bit CMYK => RGB)
+# * plan9bm Plan 9 bitmap format
# pngmono Monochrome Portable Network Graphics (PNG)
# pnggray 8-bit gray Portable Network Graphics (PNG)
# png16 4-bit color Portable Network Graphics (PNG)
@@ -222,12 +157,17 @@ DEVS_MAK=devs.mak
# png16m 24-bit color Portable Network Graphics (PNG)
# psmono PostScript (Level 1) monochrome image
# psgray PostScript (Level 1) 8-bit gray image
-# sgirgb SGI RGB pixmap format
+# psrgb PostScript (Level 2) 24-bit color image
# tiff12nc TIFF 12-bit RGB, no compression
# tiff24nc TIFF 24-bit RGB, no compression (NeXT standard format)
# tifflzw TIFF LZW (tag = 5) (monochrome)
# tiffpack TIFF PackBits (tag = 32773) (monochrome)
+# Note that MS Windows-specific drivers are defined in msdevs.mak, not here,
+# because they have special compilation requirements that require defining
+# parameter macros not relevant to other platforms; the OS/2-specific
+# drivers are there too, because they share some definitions.
+
# User-contributed drivers marked with * require hardware or software
# that is not available to Aladdin Enterprises. Please contact the
# original contributors, not Aladdin Enterprises, if you have questions.
@@ -269,29 +209,28 @@ DEVS_MAK=devs.mak
# Note that all drivers other than displays must include page.dev in their
# dependencies and use $(SETPDEV) rather than $(SETDEV) in their rule bodies.
-# All device drivers depend on the following:
-GDEV=$(AK) $(ECHOGS_XE) $(gserrors_h) $(gx_h) $(gxdevice_h)
-
# "Printer" drivers depend on the following:
PDEVH=$(AK) $(gdevprn_h)
# Define the header files for device drivers. Every header file used by
# more than one device driver family must be listed here.
-gdev8bcm_h=gdev8bcm.h
-gdevpccm_h=gdevpccm.h
-gdevpcfb_h=gdevpcfb.h $(dos__h)
-gdevpcl_h=gdevpcl.h
-gdevsvga_h=gdevsvga.h
-gdevx_h=gdevx.h
+gdev8bcm_h=$(GLSRC)gdev8bcm.h
+gdevpccm_h=$(GLSRC)gdevpccm.h
+gdevpcfb_h=$(GLSRC)gdevpcfb.h $(dos__h)
+gdevpcl_h=$(GLSRC)gdevpcl.h
+gdevsvga_h=$(GLSRC)gdevsvga.h
###### ----------------------- Device support ----------------------- ######
-# Provide a mapping between StandardEncoding and ISOLatin1Encoding.
-gdevemap.$(OBJ): gdevemap.c $(AK) $(std_h)
-
# Implement dynamic color management for 8-bit mapped color displays.
-gdev8bcm.$(OBJ): gdev8bcm.c $(AK) \
- $(gx_h) $(gxdevice_h) $(gdev8bcm_h)
+$(GLOBJ)gdev8bcm.$(OBJ): $(GLSRC)gdev8bcm.c $(AK)\
+ $(gx_h) $(gxdevice_h) $(gdev8bcm_h)
+ $(GLCC) $(GLO_)gdev8bcm.$(OBJ) $(C_) $(GLSRC)gdev8bcm.c
+
+# PC display color mapping
+$(GLOBJ)gdevpccm.$(OBJ): $(GLSRC)gdevpccm.c $(AK)\
+ $(gx_h) $(gsmatrix_h) $(gxdevice_h) $(gdevpccm_h)
+ $(GLCC) $(GLO_)gdevpccm.$(OBJ) $(C_) $(GLSRC)gdevpccm.c
###### ------------------- MS-DOS display devices ------------------- ######
@@ -299,37 +238,36 @@ gdev8bcm.$(OBJ): gdev8bcm.c $(AK) \
# plane-addressed), a SuperVGA driver (8 bit-planes, byte addressed),
# and a special driver for the S3 chip.
-# PC display color mapping
-gdevpccm.$(OBJ): gdevpccm.c $(AK) \
- $(gx_h) $(gsmatrix_h) $(gxdevice_h) $(gdevpccm_h)
-
### ----------------------- EGA and VGA displays ----------------------- ###
# The shared MS-DOS makefile defines PCFBASM as either gdevegaa.$(OBJ)
# or an empty string.
-gdevegaa.$(OBJ): gdevegaa.asm
+$(GLOBJ)gdevegaa.$(OBJ): $(GLSRC)gdevegaa.asm
+ $(GLCC) $(GLO_)gdevegaa.$(OBJ) $(C_) $(GLSRC)gdevegaa.c
# NOTE: for direct frame buffer addressing under SCO Unix or Xenix,
# change gdevevga to gdevsco in the following line. Also, since
# SCO's /bin/as does not support the "out" instructions, you must build
# the gnu assembler and have it on your path as "as".
-EGAVGA=gdevevga.$(OBJ) gdevpcfb.$(OBJ) gdevpccm.$(OBJ) $(PCFBASM)
-#EGAVGA=gdevsco.$(OBJ) gdevpcfb.$(OBJ) gdevpccm.$(OBJ) $(PCFBASM)
+EGAVGA=$(GLOBJ)gdevevga.$(OBJ) $(GLOBJ)gdevpcfb.$(OBJ) $(GLOBJ)gdevpccm.$(OBJ) $(PCFBASM)
+#EGAVGA=$(GLOBJ)gdevsco.$(OBJ) $(GLOBJ)gdevpcfb.$(OBJ) $(GLOBJ)gdevpccm.$(OBJ) $(PCFBASM)
-gdevevga.$(OBJ): gdevevga.c $(GDEV) $(memory__h) $(gdevpcfb_h)
- $(CCD) gdevevga.c
+#**************** $(CCD) gdevevga.c
+$(GLOBJ)gdevevga.$(OBJ): $(GLSRC)gdevevga.c $(GDEV) $(memory__h) $(gdevpcfb_h)
+ $(GLCC) $(GLO_)gdevevga.$(OBJ) $(C_) $(GLSRC)gdevevga.c
-gdevsco.$(OBJ): gdevsco.c $(GDEV) $(memory__h) $(gdevpcfb_h)
+$(GLOBJ)gdevsco.$(OBJ): $(GLSRC)gdevsco.c $(GDEV) $(memory__h) $(gdevpcfb_h)
+ $(GLCC) $(GLO_)gdevsco.$(OBJ) $(C_) $(GLSRC)gdevsco.c
# Common code for MS-DOS and SCO.
-gdevpcfb.$(OBJ): gdevpcfb.c $(GDEV) $(memory__h) $(gconfigv_h)\
+#**************** $(CCD) gdevpcfb.c
+$(GLOBJ)gdevpcfb.$(OBJ): $(GLSRC)gdevpcfb.c $(GDEV) $(memory__h) $(gconfigv_h)\
$(gdevpccm_h) $(gdevpcfb_h) $(gsparam_h)
- $(CCD) gdevpcfb.c
+ $(GLCC) $(GLO_)gdevpcfb.$(OBJ) $(C_) $(GLSRC)gdevpcfb.c
# The EGA/VGA family includes EGA and VGA. Many SuperVGAs in 800x600,
# 16-color mode can share the same code; see the next section below.
-
ega.dev: $(EGAVGA)
$(SETDEV) ega $(EGAVGA)
@@ -351,11 +289,12 @@ svga16.dev: $(EGAVGA)
# More capable SuperVGAs have a wide variety of slightly differing
# interfaces, so we need a separate driver for each one.
-SVGA=gdevsvga.$(OBJ) gdevpccm.$(OBJ) $(PCFBASM)
+SVGA=$(GLOBJ)gdevsvga.$(OBJ) $(GLOBJ)gdevpccm.$(OBJ) $(PCFBASM)
-gdevsvga.$(OBJ): gdevsvga.c $(GDEV) $(memory__h) $(gconfigv_h)\
+#**************** $(CCD) gdevsvga.c
+$(GLOBJ)gdevsvga.$(OBJ): $(GLSRC)gdevsvga.c $(GDEV) $(memory__h) $(gconfigv_h)\
$(gsparam_h) $(gxarith_h) $(gdevpccm_h) $(gdevpcfb_h) $(gdevsvga_h)
- $(CCD) gdevsvga.c
+ $(GLCC) $(GLO_)gdevsvga.$(OBJ) $(C_) $(GLSRC)gdevsvga.c
# The SuperVGA family includes: Avance Logic Inc., ATI Wonder, S3,
# Trident, Tseng ET3000/4000, and VESA.
@@ -366,6 +305,9 @@ ali.dev: $(SVGA)
atiw.dev: $(SVGA)
$(SETDEV) atiw $(SVGA)
+cirr.dev: $(SVGA)
+ $(SETDEV) cirr $(SVGA)
+
tseng.dev: $(SVGA)
$(SETDEV) tseng $(SVGA)
@@ -377,130 +319,17 @@ vesa.dev: $(SVGA)
# The S3 driver doesn't share much code with the others.
-s3vga_=gdevs3ga.$(OBJ) gdevsvga.$(OBJ) gdevpccm.$(OBJ)
+s3vga_=$(GLOBJ)gdevs3ga.$(OBJ) $(GLOBJ)gdevsvga.$(OBJ) $(GLOBJ)gdevpccm.$(OBJ)
s3vga.dev: $(SVGA) $(s3vga_)
$(SETDEV) s3vga $(SVGA)
$(ADDMOD) s3vga -obj $(s3vga_)
-gdevs3ga.$(OBJ): gdevs3ga.c $(GDEV) $(gdevpcfb_h) $(gdevsvga_h)
- $(CCD) gdevs3ga.c
-
-### ------------ The BGI (Borland Graphics Interface) device ----------- ###
-
-cgaf.$(OBJ): $(BGIDIR)\cga.bgi
- $(BGIDIR)\bgiobj /F $(BGIDIR)\cga
-
-egavgaf.$(OBJ): $(BGIDIR)\egavga.bgi
- $(BGIDIR)\bgiobj /F $(BGIDIR)\egavga
-
-# Include egavgaf.$(OBJ) for debugging only.
-bgi_=gdevbgi.$(OBJ) cgaf.$(OBJ)
-bgi.dev: $(bgi_)
- $(SETDEV) bgi $(bgi_)
- $(ADDMOD) bgi -lib $(LIBDIR)\graphics
-
-gdevbgi.$(OBJ): gdevbgi.c $(GDEV) $(MAKEFILE) $(gxxfont_h)
- $(CCC) -DBGI_LIB="$(BGIDIRSTR)" gdevbgi.c
-
-### ------------------- The Hercules Graphics display ------------------- ###
-
-herc_=gdevherc.$(OBJ)
-herc.dev: $(herc_)
- $(SETDEV) herc $(herc_)
-
-gdevherc.$(OBJ): gdevherc.c $(GDEV) $(dos__h) $(gsmatrix_h) $(gxbitmap_h)
- $(CCC) gdevherc.c
-
-### ---------------------- The Private Eye display ---------------------- ###
-### Note: this driver was contributed by a user: ###
-### please contact narf@media-lab.media.mit.edu if you have questions. ###
-
-pe_=gdevpe.$(OBJ)
-pe.dev: $(pe_)
- $(SETDEV) pe $(pe_)
-
-gdevpe.$(OBJ): gdevpe.c $(GDEV) $(memory__h)
+#**************** $(CCD) gdevs3ga.c
+$(GLOBJ)gdevs3ga.$(OBJ): $(GLSRC)gdevs3ga.c $(GDEV) $(gdevpcfb_h) $(gdevsvga_h)
+ $(GLCC) $(GLO_)gdevs3ga.$(OBJ) $(C_) $(GLSRC)gdevs3ga.c
###### ----------------------- Other displays ------------------------ ######
-### -------------------- The MS-Windows 3.n DLL ------------------------- ###
-
-gsdll_h=gsdll.h
-
-gdevmswn_h=gdevmswn.h $(GDEV)\
- $(dos__h) $(memory__h) $(string__h) $(windows__h)\
- gp_mswin.h
-
-gdevmswn.$(OBJ): gdevmswn.c $(gdevmswn_h) $(gp_h) $(gpcheck_h) \
- $(gsdll_h) $(gsparam_h) $(gdevpccm_h)
- $(CCCWIN) gdevmswn.c
-
-gdevmsxf.$(OBJ): gdevmsxf.c $(ctype__h) $(math__h) $(memory__h) $(string__h)\
- $(gdevmswn_h) $(gsstruct_h) $(gsutil_h) $(gxxfont_h)
- $(CCCWIN) gdevmsxf.c
-
-# An implementation using a DIB filled by an image device.
-gdevwdib.$(OBJ): gdevwdib.c $(gdevmswn_h) $(gsdll_h) $(gxdevmem_h)
- $(CCCWIN) gdevwdib.c
-
-mswindll_=gdevmswn.$(OBJ) gdevmsxf.$(OBJ) gdevwdib.$(OBJ) \
- gdevemap.$(OBJ) gdevpccm.$(OBJ)
-mswindll.dev: $(mswindll_)
- $(SETDEV) mswindll $(mswindll_)
-
-### -------------------- The MS-Windows DDB 3.n printer ----------------- ###
-
-mswinprn_=gdevwprn.$(OBJ) gdevmsxf.$(OBJ)
-mswinprn.dev: $(mswinprn_)
- $(SETDEV) mswinprn $(mswinprn_)
-
-gdevwprn.$(OBJ): gdevwprn.c $(gdevmswn_h) $(gp_h)
- $(CCCWIN) gdevwprn.c
-
-### -------------------- The MS-Windows DIB 3.n printer ----------------- ###
-
-mswinpr2_=gdevwpr2.$(OBJ)
-mswinpr2.dev: $(mswinpr2_) page.dev
- $(SETPDEV) mswinpr2 $(mswinpr2_)
-
-gdevwpr2.$(OBJ): gdevwpr2.c $(PDEVH) $(windows__h)\
- $(gdevpccm_h) $(gp_h) gp_mswin.h
- $(CCCWIN) gdevwpr2.c
-
-### ------------------ OS/2 Presentation Manager device ----------------- ###
-
-os2pm_=gdevpm.$(OBJ) gdevpccm.$(OBJ)
-os2pm.dev: $(os2pm_)
- $(SETDEV) os2pm $(os2pm_)
-
-os2dll_=gdevpm.$(OBJ) gdevpccm.$(OBJ)
-os2dll.dev: $(os2dll_)
- $(SETDEV) os2dll $(os2dll_)
-
-gdevpm.$(OBJ): gdevpm.c $(string__h)\
- $(gp_h) $(gpcheck_h)\
- $(gsdll_h) $(gserrors_h) $(gsexit_h) $(gsparam_h)\
- $(gx_h) $(gxdevice_h) $(gxdevmem_h)\
- $(gdevpccm_h) gdevpm.h
-
-### --------------------------- The OS/2 printer ------------------------ ###
-
-os2prn_=gdevos2p.$(OBJ)
-os2prn.dev: $(os2prn_) page.dev
- $(SETPDEV) os2prn $(os2prn_)
-
-os2prn.$(OBJ): os2prn.c $(gp_h)
-
-### -------------- The AT&T 3b1 Unixpc monochrome display --------------- ###
-### Note: this driver was contributed by a user: please contact ###
-### Andy Fyfe (andy@cs.caltech.edu) if you have questions. ###
-
-att3b1_=gdev3b1.$(OBJ)
-att3b1.dev: $(att3b1_)
- $(SETDEV) att3b1 $(att3b1_)
-
-gdev3b1.$(OBJ): gdev3b1.c $(GDEV)
-
### ---------------------- Linux PC with vgalib ------------------------- ###
### Note: these drivers were contributed by users. ###
### For questions about the lvga256 driver, please contact ###
@@ -508,151 +337,76 @@ gdev3b1.$(OBJ): gdev3b1.c $(GDEV)
### For questions about the vgalib driver, please contact ###
### Erik Talvola (talvola@gnu.ai.mit.edu). ###
-lvga256_=gdevl256.$(OBJ)
+lvga256_=$(GLOBJ)gdevl256.$(OBJ)
lvga256.dev: $(lvga256_)
$(SETDEV) lvga256 $(lvga256_)
$(ADDMOD) lvga256 -lib vga vgagl
-gdevl256.$(OBJ): gdevl256.c $(GDEV)
+$(GLOBJ)gdevl256.$(OBJ): $(GLSRC)gdevl256.c $(GDEV)
+ $(GLCC) $(GLO_)gdevl256.$(OBJ) $(C_) $(GLSRC)gdevl256.c
-vgalib_=gdevvglb.$(OBJ) gdevpccm.$(OBJ)
+vgalib_=$(GLOBJ)gdevvglb.$(OBJ) $(GLOBJ)gdevpccm.$(OBJ)
vgalib.dev: $(vgalib_)
- $(SETDEV) vgalib $(vgalib_)
+ $(SETDEV2) vgalib $(vgalib_)
$(ADDMOD) vgalib -lib vga
-gdevvglb.$(OBJ): gdevvglb.c $(GDEV) $(gdevpccm_h) $(gsparam_h)
-
-### ------------------- Sony NeWS frame buffer device ------------------ ###
-### Note: this driver was contributed by a user: please contact ###
-### Mike Smolenski (mike@intertech.com) if you have questions. ###
-
-# This is implemented as a 'printer' device.
-sonyfb_=gdevsnfb.$(OBJ)
-sonyfb.dev: $(sonyfb_) page.dev
- $(SETPDEV) sonyfb $(sonyfb_)
-
-gdevsnfb.$(OBJ): gdevsnfb.c $(PDEVH)
-
-### ------------------------ The SunView device ------------------------ ###
-### Note: this driver is maintained by a user: if you have questions, ###
-### please contact Andreas Stolcke (stolcke@icsi.berkeley.edu). ###
-
-sunview_=gdevsun.$(OBJ)
-sunview.dev: $(sunview_)
- $(SETDEV) sunview $(sunview_)
- $(ADDMOD) sunview -lib suntool sunwindow pixrect
-
-gdevsun.$(OBJ): gdevsun.c $(GDEV) $(malloc__h)\
- $(gscdefs_h) $(gserrors_h) $(gsmatrix_h)
+$(GLOBJ)gdevvglb.$(OBJ): $(GLSRC)gdevvglb.c $(GDEV) $(gdevpccm_h) $(gsparam_h)
+ $(GLCC) $(GLO_)gdevvglb.$(OBJ) $(C_) $(GLSRC)gdevvglb.c
### -------------------------- The X11 device -------------------------- ###
# Aladdin Enterprises does not support Ghostview. For more information
# about Ghostview, please contact Tim Theisen (ghostview@cs.wisc.edu).
+gdevx_h=$(GLSRC)gdevx.h
+
# See the main makefile for the definition of XLIBS.
-x11_=gdevx.$(OBJ) gdevxini.$(OBJ) gdevxxf.$(OBJ) gdevemap.$(OBJ)
+x11_=$(GLOBJ)gdevx.$(OBJ) $(GLOBJ)gdevxini.$(OBJ) $(GLOBJ)gdevxxf.$(OBJ) $(GLOBJ)gdevemap.$(OBJ)
x11.dev: $(x11_)
- $(SETDEV) x11 $(x11_)
+ $(SETDEV2) x11 $(x11_)
$(ADDMOD) x11 -lib $(XLIBS)
# See the main makefile for the definition of XINCLUDE.
-GDEVX=$(GDEV) x_.h gdevx.h $(MAKEFILE)
-gdevx.$(OBJ): gdevx.c $(GDEVX) $(math__h) $(memory__h) $(gsparam_h)
- $(CCC) $(XINCLUDE) gdevx.c
+GDEVX=$(GDEV) $(GLSRC)x_.h $(GLSRC)gdevx.h $(MAKEFILE)
+$(GLOBJ)gdevx.$(OBJ): $(GLSRC)gdevx.c $(GDEVX) $(math__h) $(memory__h)\
+ $(gscoord_h) $(gsdevice_h) $(gsiparm2_h) $(gsmatrix_h) $(gsparam_h)\
+ $(gxgetbit_h) $(gxiparam_h) $(gxpath_h)
+ $(GLCC) $(XINCLUDE) $(GLO_)gdevx.$(OBJ) $(C_) $(GLSRC)gdevx.c
-gdevxini.$(OBJ): gdevxini.c $(GDEVX) $(math__h) $(memory__h) $(gserrors_h)
- $(CCC) $(XINCLUDE) gdevxini.c
+$(GLOBJ)gdevxini.$(OBJ): $(GLSRC)gdevxini.c $(GDEVX) $(math__h) $(memory__h) $(gserrors_h)
+ $(GLCC) $(XINCLUDE) $(GLO_)gdevxini.$(OBJ) $(C_) $(GLSRC)gdevxini.c
-gdevxxf.$(OBJ): gdevxxf.c $(GDEVX) $(math__h) $(memory__h)\
+$(GLOBJ)gdevxxf.$(OBJ): $(GLSRC)gdevxxf.c $(GDEVX) $(math__h) $(memory__h)\
$(gsstruct_h) $(gsutil_h) $(gxxfont_h)
- $(CCC) $(XINCLUDE) gdevxxf.c
+ $(GLCC) $(XINCLUDE) $(GLO_)gdevxxf.$(OBJ) $(C_) $(GLSRC)gdevxxf.c
# Alternate X11-based devices to help debug other drivers.
# x11alpha pretends to have 4 bits of alpha channel.
# x11cmyk pretends to be a CMYK device with 1 bit each of C,M,Y,K.
# x11gray2 pretends to be a 2-bit gray-scale device.
# x11mono pretends to be a black-and-white device.
-x11alt_=$(x11_) gdevxalt.$(OBJ)
+x11alt_=$(x11_) $(GLOBJ)gdevxalt.$(OBJ)
x11alpha.dev: $(x11alt_)
- $(SETDEV) x11alpha $(x11alt_)
+ $(SETDEV2) x11alpha $(x11alt_)
$(ADDMOD) x11alpha -lib $(XLIBS)
x11cmyk.dev: $(x11alt_)
- $(SETDEV) x11cmyk $(x11alt_)
+ $(SETDEV2) x11cmyk $(x11alt_)
$(ADDMOD) x11cmyk -lib $(XLIBS)
x11gray2.dev: $(x11alt_)
- $(SETDEV) x11gray2 $(x11alt_)
+ $(SETDEV2) x11gray2 $(x11alt_)
$(ADDMOD) x11gray2 -lib $(XLIBS)
x11mono.dev: $(x11alt_)
- $(SETDEV) x11mono $(x11alt_)
+ $(SETDEV2) x11mono $(x11alt_)
$(ADDMOD) x11mono -lib $(XLIBS)
-gdevxalt.$(OBJ): gdevxalt.c $(GDEVX) $(math__h) $(memory__h) $(gsparam_h)
- $(CCC) $(XINCLUDE) gdevxalt.c
-
-### ------------------------- DEC sixel displays ------------------------ ###
-### Note: this driver was contributed by a user: please contact ###
-### Phil Keegstra (keegstra@tonga.gsfc.nasa.gov) if you have questions. ###
-
-# This is a "printer" device, but it probably shouldn't be.
-# I don't know why the implementor chose to do it this way.
-sxlcrt_=gdevln03.$(OBJ)
-sxlcrt.dev: $(sxlcrt_) page.dev
- $(SETPDEV) sxlcrt $(sxlcrt_)
+$(GLOBJ)gdevxalt.$(OBJ): $(GLSRC)gdevxalt.c $(GDEVX) $(math__h) $(memory__h) $(gsparam_h)
+ $(GLCC) $(XINCLUDE) $(GLO_)gdevxalt.$(OBJ) $(C_) $(GLSRC)gdevxalt.c
###### --------------- Memory-buffered printer devices --------------- ######
-### --------------------- The Apple printer devices --------------------- ###
-### Note: these drivers were contributed by users. ###
-### If you have questions about the DMP driver, please contact ###
-### Mark Wedel (master@cats.ucsc.edu). ###
-### If you have questions about the Imagewriter drivers, please contact ###
-### Jonathan Luckey (luckey@rtfm.mlb.fl.us). ###
-### If you have questions about the Imagewriter LQ driver, please ###
-### contact Scott Barker (barkers@cuug.ab.ca). ###
-
-appledmp_=gdevadmp.$(OBJ)
-
-gdevadmp.$(OBJ): gdevadmp.c $(PDEVH)
-
-appledmp.dev: $(appledmp_) page.dev
- $(SETPDEV) appledmp $(appledmp_)
-
-iwhi.dev: $(appledmp_) page.dev
- $(SETPDEV) iwhi $(appledmp_)
-
-iwlo.dev: $(appledmp_) page.dev
- $(SETPDEV) iwlo $(appledmp_)
-
-iwlq.dev: $(appledmp_) page.dev
- $(SETPDEV) iwlq $(appledmp_)
-
-### ------------ The Canon BubbleJet BJ10e and BJ200 devices ------------ ###
-
-bj10e_=gdevbj10.$(OBJ)
-
-bj10e.dev: $(bj10e_) page.dev
- $(SETPDEV) bj10e $(bj10e_)
-
-bj200.dev: $(bj10e_) page.dev
- $(SETPDEV) bj200 $(bj10e_)
-
-gdevbj10.$(OBJ): gdevbj10.c $(PDEVH)
-
-### ------------- The CalComp Raster Format ----------------------------- ###
-### Note: this driver was contributed by a user: please contact ###
-### Ernst Muellner (ernst.muellner@oenzl.siemens.de) if you have ###
-### questions. ###
-
-ccr_=gdevccr.$(OBJ)
-ccr.dev: $(ccr_) page.dev
- $(SETPDEV) ccr $(ccr_)
-
-gdevccr.$(OBJ): gdevccr.c $(PDEVH)
-
### ----------- The H-P DeskJet and LaserJet printer devices ----------- ###
### These are essentially the same device.
@@ -661,52 +415,54 @@ gdevccr.$(OBJ): gdevccr.c $(PDEVH)
### Note that the lj4dith driver is included with the H-P color printer
### drivers below.
-HPPCL=gdevpcl.$(OBJ)
-HPMONO=gdevdjet.$(OBJ) $(HPPCL)
+HPPCL=$(GLOBJ)gdevpcl.$(OBJ)
+HPMONO=$(GLOBJ)gdevdjet.$(OBJ) $(HPPCL)
-gdevpcl.$(OBJ): gdevpcl.c $(PDEVH) $(gdevpcl_h)
+$(GLOBJ)gdevpcl.$(OBJ): $(GLSRC)gdevpcl.c $(PDEVH) $(gdevpcl_h)
+ $(GLCC) $(GLO_)gdevpcl.$(OBJ) $(C_) $(GLSRC)gdevpcl.c
-gdevdjet.$(OBJ): gdevdjet.c $(PDEVH) $(gdevpcl_h)
+$(GLOBJ)gdevdjet.$(OBJ): $(GLSRC)gdevdjet.c $(PDEVH) $(gdevpcl_h)
+ $(GLCC) $(GLO_)gdevdjet.$(OBJ) $(C_) $(GLSRC)gdevdjet.c
deskjet.dev: $(HPMONO) page.dev
- $(SETPDEV) deskjet $(HPMONO)
+ $(SETPDEV2) deskjet $(HPMONO)
djet500.dev: $(HPMONO) page.dev
- $(SETPDEV) djet500 $(HPMONO)
+ $(SETPDEV2) djet500 $(HPMONO)
laserjet.dev: $(HPMONO) page.dev
- $(SETPDEV) laserjet $(HPMONO)
+ $(SETPDEV2) laserjet $(HPMONO)
ljetplus.dev: $(HPMONO) page.dev
- $(SETPDEV) ljetplus $(HPMONO)
+ $(SETPDEV2) ljetplus $(HPMONO)
### Selecting ljet2p provides TIFF (mode 2) compression on LaserJet III,
### IIIp, IIId, IIIsi, IId, and IIp.
ljet2p.dev: $(HPMONO) page.dev
- $(SETPDEV) ljet2p $(HPMONO)
+ $(SETPDEV2) ljet2p $(HPMONO)
### Selecting ljet3 provides Delta Row (mode 3) compression on LaserJet III,
### IIIp, IIId, IIIsi.
ljet3.dev: $(HPMONO) page.dev
- $(SETPDEV) ljet3 $(HPMONO)
+ $(SETPDEV2) ljet3 $(HPMONO)
### Selecting ljet3d also provides duplex printing capability.
ljet3d.dev: $(HPMONO) page.dev
- $(SETPDEV) ljet3d $(HPMONO)
+ $(SETPDEV2) ljet3d $(HPMONO)
### Selecting ljet4 also provides Delta Row compression on LaserJet IV series.
ljet4.dev: $(HPMONO) page.dev
- $(SETPDEV) ljet4 $(HPMONO)
+ $(SETPDEV2) ljet4 $(HPMONO)
lp2563.dev: $(HPMONO) page.dev
- $(SETPDEV) lp2563 $(HPMONO)
+ $(SETPDEV2) lp2563 $(HPMONO)
oce9050.dev: $(HPMONO) page.dev
- $(SETPDEV) oce9050 $(HPMONO)
+ $(SETPDEV2) oce9050 $(HPMONO)
### ------------------ The H-P LaserJet 5 and 6 devices ----------------- ###
@@ -718,424 +474,20 @@ oce9050.dev: $(HPMONO) page.dev
### - If you have any other model of LJ 5 or 6, use the pxlmono
### driver, which often produces much more compact output.
-gdevpxat_h=gdevpxat.h
-gdevpxen_h=gdevpxen.h
-gdevpxop_h=gdevpxop.h
+gdevpxat_h=$(GLSRC)gdevpxat.h
+gdevpxen_h=$(GLSRC)gdevpxen.h
+gdevpxop_h=$(GLSRC)gdevpxop.h
-ljet5_=gdevlj56.$(OBJ) $(HPPCL)
+ljet5_=$(GLOBJ)gdevlj56.$(OBJ) $(HPPCL)
lj5mono.dev: $(ljet5_) page.dev
$(SETPDEV) lj5mono $(ljet5_)
lj5gray.dev: $(ljet5_) page.dev
$(SETPDEV) lj5gray $(ljet5_)
-gdevlj56.$(OBJ): gdevlj56.c $(PDEVH) $(gdevpcl_h)\
+$(GLOBJ)gdevlj56.$(OBJ): $(GLSRC)gdevlj56.c $(PDEVH) $(gdevpcl_h)\
$(gdevpxat_h) $(gdevpxen_h) $(gdevpxop_h)
-
-### The H-P DeskJet, PaintJet, and DesignJet family color printer devices.###
-### Note: there are two different 500C drivers, both contributed by users.###
-### If you have questions about the djet500c driver, ###
-### please contact AKayser@et.tudelft.nl. ###
-### If you have questions about the cdj* drivers, ###
-### please contact g.cameron@biomed.abdn.ac.uk. ###
-### If you have questions about the dnj560c driver, ###
-### please contact koert@zen.cais.com. ###
-### If you have questions about the lj4dith driver, ###
-### please contact Eckhard.Rueggeberg@ts.go.dlr.de. ###
-### If you have questions about the BJC600/BJC4000, BJC800, or ESCP ###
-### drivers, please contact Yves.Arrouye@imag.fr. ###
-
-cdeskjet_=gdevcdj.$(OBJ) $(HPPCL)
-
-cdeskjet.dev: $(cdeskjet_) page.dev
- $(SETPDEV) cdeskjet $(cdeskjet_)
-
-cdjcolor.dev: $(cdeskjet_) page.dev
- $(SETPDEV) cdjcolor $(cdeskjet_)
-
-cdjmono.dev: $(cdeskjet_) page.dev
- $(SETPDEV) cdjmono $(cdeskjet_)
-
-cdj500.dev: $(cdeskjet_) page.dev
- $(SETPDEV) cdj500 $(cdeskjet_)
-
-cdj550.dev: $(cdeskjet_) page.dev
- $(SETPDEV) cdj550 $(cdeskjet_)
-
-declj250.dev: $(cdeskjet_) page.dev
- $(SETPDEV) declj250 $(cdeskjet_)
-
-dnj650c.dev: $(cdeskjet_) page.dev
- $(SETPDEV) dnj650c $(cdeskjet_)
-
-lj4dith.dev: $(cdeskjet_) page.dev
- $(SETPDEV) lj4dith $(cdeskjet_)
-
-pj.dev: $(cdeskjet_) page.dev
- $(SETPDEV) pj $(cdeskjet_)
-
-pjxl.dev: $(cdeskjet_) page.dev
- $(SETPDEV) pjxl $(cdeskjet_)
-
-pjxl300.dev: $(cdeskjet_) page.dev
- $(SETPDEV) pjxl300 $(cdeskjet_)
-
-# Note: the BJC600 driver also works for the BJC4000.
-bjc600.dev: $(cdeskjet_) page.dev
- $(SETPDEV) bjc600 $(cdeskjet_)
-
-bjc800.dev: $(cdeskjet_) page.dev
- $(SETPDEV) bjc800 $(cdeskjet_)
-
-escp.dev: $(cdeskjet_) page.dev
- $(SETPDEV) escp $(cdeskjet_)
-
-# NB: you can also customise the build if required, using
-# -DBitsPerPixel=<number> if you wish the default to be other than 24
-# for the generic drivers (cdj500, cdj550, pjxl300, pjtest, pjxltest).
-gdevcdj.$(OBJ): gdevcdj.c $(std_h) $(PDEVH) gdevbjc.h\
- $(gsparam_h) $(gsstate_h) $(gxlum_h)\
- $(gdevpcl_h)
-
-djet500c_=gdevdjtc.$(OBJ) $(HPPCL)
-djet500c.dev: $(djet500c_) page.dev
- $(SETPDEV) djet500c $(djet500c_)
-
-gdevdjtc.$(OBJ): gdevdjtc.c $(PDEVH) $(malloc__h) $(gdevpcl_h)
-
-### -------------------- The Mitsubishi CP50 printer -------------------- ###
-### Note: this driver was contributed by a user: please contact ###
-### Michael Hu (michael@ximage.com) if you have questions. ###
-
-cp50_=gdevcp50.$(OBJ)
-cp50.dev: $(cp50_) page.dev
- $(SETPDEV) cp50 $(cp50_)
-
-gdevcp50.$(OBJ): gdevcp50.c $(PDEVH)
-
-### ----------------- The generic Epson printer device ----------------- ###
-### Note: most of this code was contributed by users. Please contact ###
-### the following people if you have questions: ###
-### eps9mid - Guenther Thomsen (thomsen@cs.tu-berlin.de) ###
-### eps9high - David Wexelblat (dwex@mtgzfs3.att.com) ###
-### ibmpro - James W. Birdsall (jwbirdsa@picarefy.picarefy.com) ###
-
-epson_=gdevepsn.$(OBJ)
-
-epson.dev: $(epson_) page.dev
- $(SETPDEV) epson $(epson_)
-
-eps9mid.dev: $(epson_) page.dev
- $(SETPDEV) eps9mid $(epson_)
-
-eps9high.dev: $(epson_) page.dev
- $(SETPDEV) eps9high $(epson_)
-
-gdevepsn.$(OBJ): gdevepsn.c $(PDEVH)
-
-### ----------------- The IBM Proprinter printer device ---------------- ###
-
-ibmpro.dev: $(epson_) page.dev
- $(SETPDEV) ibmpro $(epson_)
-
-### -------------- The Epson LQ-2550 color printer device -------------- ###
-### Note: this driver was contributed by users: please contact ###
-### Dave St. Clair (dave@exlog.com) if you have questions. ###
-
-epsonc_=gdevepsc.$(OBJ)
-epsonc.dev: $(epsonc_) page.dev
- $(SETPDEV) epsonc $(epsonc_)
-
-gdevepsc.$(OBJ): gdevepsc.c $(PDEVH)
-
-### ------------- The Epson ESC/P 2 language printer devices ------------- ###
-### Note: these drivers were contributed by users. ###
-### For questions about the Stylus 800 and AP3250 drivers, please contact ###
-### Richard Brown (rab@tauon.ph.unimelb.edu.au). ###
-### For questions about the Stylus Color drivers, please contact ###
-### Gunther Hess (gunther@elmos.de). ###
-
-ESCP2=gdevescp.$(OBJ)
-
-gdevescp.$(OBJ): gdevescp.c $(PDEVH)
-
-ap3250.dev: $(ESCP2) page.dev
- $(SETPDEV) ap3250 $(ESCP2)
-
-st800.dev: $(ESCP2) page.dev
- $(SETPDEV) st800 $(ESCP2)
-
-stcolor1_=gdevstc.$(OBJ) gdevstc1.$(OBJ) gdevstc2.$(OBJ)
-stcolor2_=gdevstc3.$(OBJ) gdevstc4.$(OBJ)
-stcolor.dev: $(stcolor1_) $(stcolor2_) page.dev
- $(SETPDEV) stcolor $(stcolor1_)
- $(ADDMOD) stcolor -obj $(stcolor2_)
-
-gdevstc.$(OBJ): gdevstc.c gdevstc.h $(PDEVH)
-
-gdevstc1.$(OBJ): gdevstc1.c gdevstc.h $(PDEVH)
-
-gdevstc2.$(OBJ): gdevstc2.c gdevstc.h $(PDEVH)
-
-gdevstc3.$(OBJ): gdevstc3.c gdevstc.h $(PDEVH)
-
-gdevstc4.$(OBJ): gdevstc4.c gdevstc.h $(PDEVH)
-
-### --------------- Ugly/Update -> Unified Printer Driver ---------------- ###
-### For questions about this driver, please contact: ###
-### Gunther Hess (gunther@elmos.de) ###
-
-uniprint_=gdevupd.$(OBJ)
-uniprint.dev: $(uniprint_) page.dev
- $(SETPDEV) uniprint $(uniprint_)
-
-gdevupd.$(OBJ): gdevupd.c $(PDEVH) $(gsparam_h)
-
-### -------------- cdj850 - HP 850c Driver under development ------------- ###
-### Since this driver is in the development-phase it is not distributed ###
-### with ghostscript, but it is available via anonymous ftp from: ###
-### ftp://bonk.ethz.ch ###
-### For questions about this driver, please contact: ###
-### Uli Wortmann (E-Mail address inside the driver-package) ###
-
-cdeskjet8_=gdevcd8.$(OBJ) $(HPPCL)
-
-cdj850.dev: $(cdeskjet8_) page.dev
- $(SETPDEV) cdj850 $(cdeskjet8_)
-
-### ------------ The H-P PaintJet color printer device ----------------- ###
-### Note: this driver also supports the DEC LJ250 color printer, which ###
-### has a PaintJet-compatible mode, and the PaintJet XL. ###
-### If you have questions about the XL, please contact Rob Reiss ###
-### (rob@moray.berkeley.edu). ###
-
-PJET=gdevpjet.$(OBJ) $(HPPCL)
-
-gdevpjet.$(OBJ): gdevpjet.c $(PDEVH) $(gdevpcl_h)
-
-lj250.dev: $(PJET) page.dev
- $(SETPDEV) lj250 $(PJET)
-
-paintjet.dev: $(PJET) page.dev
- $(SETPDEV) paintjet $(PJET)
-
-pjetxl.dev: $(PJET) page.dev
- $(SETPDEV) pjetxl $(PJET)
-
-### -------------- Imagen ImPress Laser Printer device ----------------- ###
-### Note: this driver was contributed by a user: please contact ###
-### Alan Millar (AMillar@bolis.sf-bay.org) if you have questions. ###
-### Set USE_BYTE_STREAM if using parallel interface; ###
-### Don't set it if using 'ipr' spooler (default). ###
-### You may also add -DA4 if needed for A4 paper. ###
-
-imagen_=gdevimgn.$(OBJ)
-imagen.dev: $(imagen_) page.dev
- $(SETPDEV) imagen $(imagen_)
-
-gdevimgn.$(OBJ): gdevimgn.c $(PDEVH)
- $(CCC) gdevimgn.c # for ipr spooler
-# $(CCC) -DUSE_BYTE_STREAM gdevimgn.c # for parallel
-
-### ------- The IBM 3852 JetPrinter color inkjet printer device -------- ###
-### Note: this driver was contributed by users: please contact ###
-### Kevin Gift (kgift@draper.com) if you have questions. ###
-### Note that the paper size that can be addressed by the graphics mode ###
-### used in this driver is fixed at 7-1/2 inches wide (the printable ###
-### width of the jetprinter itself.) ###
-
-jetp3852_=gdev3852.$(OBJ)
-jetp3852.dev: $(jetp3852_) page.dev
- $(SETPDEV) jetp3852 $(jetp3852_)
-
-gdev3852.$(OBJ): gdev3852.c $(PDEVH) $(gdevpcl_h)
-
-### ---------- The Canon LBP-8II and LIPS III printer devices ---------- ###
-### Note: these drivers were contributed by users. ###
-### For questions about these drivers, please contact ###
-### Lauri Paatero, lauri.paatero@paatero.pp.fi ###
-
-lbp8_=gdevlbp8.$(OBJ)
-lbp8.dev: $(lbp8_) page.dev
- $(SETPDEV) lbp8 $(lbp8_)
-
-lips3.dev: $(lbp8_) page.dev
- $(SETPDEV) lips3 $(lbp8_)
-
-gdevlbp8.$(OBJ): gdevlbp8.c $(PDEVH)
-
-### ----------- The DEC LN03/LA50/LA70/LA75 printer devices ------------ ###
-### Note: this driver was contributed by users: please contact ###
-### Ulrich Mueller (ulm@vsnhd1.cern.ch) if you have questions. ###
-### For questions about LA50 and LA75, please contact ###
-### Ian MacPhedran (macphed@dvinci.USask.CA). ###
-### For questions about the LA70, please contact ###
-### Bruce Lowekamp (lowekamp@csugrad.cs.vt.edu). ###
-### For questions about the LA75plus, please contact ###
-### Andre' Beck (Andre_Beck@IRS.Inf.TU-Dresden.de). ###
-
-ln03_=gdevln03.$(OBJ)
-ln03.dev: $(ln03_) page.dev
- $(SETPDEV) ln03 $(ln03_)
-
-la50.dev: $(ln03_) page.dev
- $(SETPDEV) la50 $(ln03_)
-
-la70.dev: $(ln03_) page.dev
- $(SETPDEV) la70 $(ln03_)
-
-la75.dev: $(ln03_) page.dev
- $(SETPDEV) la75 $(ln03_)
-
-la75plus.dev: $(ln03_) page.dev
- $(SETPDEV) la75plus $(ln03_)
-
-gdevln03.$(OBJ): gdevln03.c $(PDEVH)
-
-# LA70 driver with low-resolution text enhancement.
-
-la70t_=gdevla7t.$(OBJ)
-la70t.dev: $(la70t_) page.dev
- $(SETPDEV) la70t $(la70t_)
-
-gdevla7t.$(OBJ): gdevla7t.c $(PDEVH)
-
-### -------------- The Epson LP-8000 laser printer device -------------- ###
-### Note: this driver was contributed by a user: please contact Oleg ###
-### Oleg Fat'yanov <faty1@rlem.titech.ac.jp> if you have questions.###
-
-lp8000_=gdevlp8k.$(OBJ)
-lp8000.dev: $(lp8000_) page.dev
- $(SETPDEV) lp8000 $(lp8000_)
-
-gdevlp8k.$(OBJ): gdevlp8k.c $(PDEVH)
-
-### -------------- The C.Itoh M8510 printer device --------------------- ###
-### Note: this driver was contributed by a user: please contact Bob ###
-### Smith <bob@snuffy.penfield.ny.us> if you have questions. ###
-
-m8510_=gdev8510.$(OBJ)
-m8510.dev: $(m8510_) page.dev
- $(SETPDEV) m8510 $(m8510_)
-
-gdev8510.$(OBJ): gdev8510.c $(PDEVH)
-
-### -------------- 24pin Dot-matrix printer with 360DPI ---------------- ###
-### Note: this driver was contributed by users. Please contact: ###
-### Andreas Schwab (schwab@ls5.informatik.uni-dortmund.de) for ###
-### questions about the NEC P6; ###
-### Christian Felsch (felsch@tu-harburg.d400.de) for ###
-### questions about the Epson LQ850. ###
-
-dm24_=gdevdm24.$(OBJ)
-gdevdm24.$(OBJ): gdevdm24.c $(PDEVH)
-
-necp6.dev: $(dm24_) page.dev
- $(SETPDEV) necp6 $(dm24_)
-
-lq850.dev: $(dm24_) page.dev
- $(SETPDEV) lq850 $(dm24_)
-
-### ----------------- The Okidata MicroLine 182 device ----------------- ###
-### Note: this driver was contributed by a user: please contact ###
-### Maarten Koning (smeg@bnr.ca) if you have questions. ###
-
-oki182_=gdevo182.$(OBJ)
-oki182.dev: $(oki182_) page.dev
- $(SETPDEV) oki182 $(oki182_)
-
-gdevo182.$(OBJ): gdevo182.c $(PDEVH)
-
-### ------------- The Okidata IBM compatible printer device ------------ ###
-### Note: this driver was contributed by a user: please contact ###
-### Charles Mack (chasm@netcom.com) if you have questions. ###
-
-okiibm_=gdevokii.$(OBJ)
-okiibm.dev: $(okiibm_) page.dev
- $(SETPDEV) okiibm $(okiibm_)
-
-gdevokii.$(OBJ): gdevokii.c $(PDEVH)
-
-### ------------- The Ricoh 4081 laser printer device ------------------ ###
-### Note: this driver was contributed by users: ###
-### please contact kdw@oasis.icl.co.uk if you have questions. ###
-
-r4081_=gdev4081.$(OBJ)
-r4081.dev: $(r4081_) page.dev
- $(SETPDEV) r4081 $(r4081_)
-
-
-gdev4081.$(OBJ): gdev4081.c $(PDEVH)
-
-### -------------------- Sony NWP533 printer device -------------------- ###
-### Note: this driver was contributed by a user: please contact Tero ###
-### Kivinen (kivinen@joker.cs.hut.fi) if you have questions. ###
-
-nwp533_=gdevn533.$(OBJ)
-nwp533.dev: $(nwp533_) page.dev
- $(SETPDEV) nwp533 $(nwp533_)
-
-gdevn533.$(OBJ): gdevn533.c $(PDEVH)
-
-### ------------------------- The SPARCprinter ------------------------- ###
-### Note: this driver was contributed by users: please contact Martin ###
-### Schulte (schulte@thp.uni-koeln.de) if you have questions. ###
-### He would also like to hear from anyone using the driver. ###
-### Please consult the source code for additional documentation. ###
-
-sparc_=gdevsppr.$(OBJ)
-sparc.dev: $(sparc_) page.dev
- $(SETPDEV) sparc $(sparc_)
-
-gdevsppr.$(OBJ): gdevsppr.c $(PDEVH)
-
-### ----------------- The StarJet SJ48 device -------------------------- ###
-### Note: this driver was contributed by a user: if you have questions, ###
-### . ###
-### please contact Mats Akerblom (f86ma@dd.chalmers.se). ###
-
-sj48_=gdevsj48.$(OBJ)
-sj48.dev: $(sj48_) page.dev
- $(SETPDEV) sj48 $(sj48_)
-
-gdevsj48.$(OBJ): gdevsj48.c $(PDEVH)
-
-### ----------------- Tektronix 4396d color printer -------------------- ###
-### Note: this driver was contributed by a user: please contact ###
-### Karl Hakimian (hakimian@haney.eecs.wsu.edu) ###
-### if you have questions. ###
-
-t4693d_=gdev4693.$(OBJ)
-t4693d2.dev: $(t4693d_) page.dev
- $(SETPDEV) t4693d2 $(t4693d_)
-
-t4693d4.dev: $(t4693d_) page.dev
- $(SETPDEV) t4693d4 $(t4693d_)
-
-t4693d8.dev: $(t4693d_) page.dev
- $(SETPDEV) t4693d8 $(t4693d_)
-
-gdev4693.$(OBJ): gdev4693.c $(PDEVH)
-
-### -------------------- Tektronix ink-jet printers -------------------- ###
-### Note: this driver was contributed by a user: please contact ###
-### Karsten Spang (spang@nbivax.nbi.dk) if you have questions. ###
-
-tek4696_=gdevtknk.$(OBJ)
-tek4696.dev: $(tek4696_) page.dev
- $(SETPDEV) tek4696 $(tek4696_)
-
-gdevtknk.$(OBJ): gdevtknk.c $(PDEVH) $(malloc__h)
-
-### ----------------- The Xerox XES printer device --------------------- ###
-### Note: this driver was contributed by users: please contact ###
-### Peter Flass (flass@lbdrscs.bitnet) if you have questions. ###
-
-xes_=gdevxes.$(OBJ)
-xes.dev: $(xes_) page.dev
- $(SETPDEV) xes $(xes_)
-
-gdevxes.$(OBJ): gdevxes.c $(PDEVH)
+ $(GLCC) $(GLO_)gdevlj56.$(OBJ) $(C_) $(GLSRC)gdevlj56.c
###### ------------------------- Fax devices ------------------------- ######
@@ -1143,33 +495,15 @@ gdevxes.$(OBJ): gdevxes.c $(PDEVH)
# This code doesn't work yet. Don't even think about using it.
-PSFAX=gdevpfax.$(OBJ)
+PSFAX=$(GLOBJ)gdevpfax.$(OBJ)
psfax_=$(PSFAX)
psfax.dev: $(psfax_) page.dev
$(SETPDEV) psfax $(psfax_)
$(ADDMOD) psfax -iodev Fax
-gdevpfax.$(OBJ): gdevpfax.c $(PDEVH) $(gsparam_h) $(gxiodev_h)
-
-### ------------------------- The DigiFAX device ------------------------ ###
-### This driver outputs images in a format suitable for use with ###
-### DigiBoard, Inc.'s DigiFAX software. Use -sDEVICE=dfaxhigh for ###
-### high resolution output, -sDEVICE=dfaxlow for normal output. ###
-### Note: this driver was contributed by a user: please contact ###
-### Rick Richardson (rick@digibd.com) if you have questions. ###
-
-dfax_=gdevdfax.$(OBJ) gdevtfax.$(OBJ)
-
-dfaxlow.dev: $(dfax_) page.dev
- $(SETPDEV) dfaxlow $(dfax_)
- $(ADDMOD) dfaxlow -include cfe
-
-dfaxhigh.dev: $(dfax_) page.dev
- $(SETPDEV) dfaxhigh $(dfax_)
- $(ADDMOD) dfaxhigh -include cfe
-
-gdevdfax.$(OBJ): gdevdfax.c $(PDEVH) $(scfx_h) $(strimpl_h)
+$(GLOBJ)gdevpfax.$(OBJ): $(GLSRC)gdevpfax.c $(PDEVH) $(gsparam_h) $(gxiodev_h)
+ $(GLCC) $(GLO_)gdevpfax.$(OBJ) $(C_) $(GLSRC)gdevpfax.c
### --------------See under TIFF below for fax-format TIFF -------------- ###
@@ -1177,125 +511,188 @@ gdevdfax.$(OBJ): gdevdfax.c $(PDEVH) $(scfx_h) $(strimpl_h)
# Support for PostScript and PDF
-gdevpsdf_h=gdevpsdf.h $(gdevvec_h) $(strimpl_h)
-gdevpstr_h=gdevpstr.h
-
-gdevpsdf.$(OBJ): gdevpsdf.c $(stdio__h) $(string__h)\
- $(gserror_h) $(gserrors_h) $(gsmemory_h) $(gsparam_h) $(gstypes_h)\
- $(gxdevice_h)\
- $(scfx_h) $(slzwx_h) $(srlx_h) $(strimpl_h)\
+gdevpsdf_h=$(GLSRC)gdevpsdf.h $(gdevvec_h) $(gsparam_h) $(scfx_h) $(strimpl_h)
+gdevpsds_h=$(GLSRC)gdevpsds.h $(strimpl_h)
+gdevpstr_h=$(GLSRC)gdevpstr.h
+
+psdf_1=$(GLOBJ)gdevpsde.$(OBJ) $(GLOBJ)gdevpsdf.$(OBJ) $(GLOBJ)gdevpsdi.$(OBJ)
+psdf_2=$(GLOBJ)gdevpsdp.$(OBJ) $(GLOBJ)gdevpsds.$(OBJ) $(GLOBJ)gdevpstr.$(OBJ)
+psdf_3=$(GLOBJ)scfparam.$(OBJ) $(GLOBJ)sdcparam.$(OBJ) $(GLOBJ)sdeparam.$(OBJ)
+psdf_=$(psdf_1) $(psdf_2) $(psdf_3)
+psdf.dev: $(ECHOGS_XE) $(psdf_) vector.dev
+ $(SETMOD) psdf $(psdf_1)
+ $(ADDMOD) psdf -obj $(psdf_2)
+ $(ADDMOD) psdf -obj $(psdf_3)
+ $(ADDMOD) psdf -include vector
+
+$(GLOBJ)gdevpsde.$(OBJ): $(GLSRC)gdevpsde.c $(GXERR) $(memory__h)\
+ $(gsccode_h) $(gsmatrix_h) $(gxfixed_h) $(gxfont_h) $(gxfont1_h)\
+ $(stream_h)\
$(gdevpsdf_h) $(gdevpstr_h)
+ $(GLCC) $(GLO_)gdevpsde.$(OBJ) $(C_) $(GLSRC)gdevpsde.c
-gdevpstr.$(OBJ): gdevpstr.c $(math__h) $(stdio__h) $(string__h)\
+$(GLOBJ)gdevpsdf.$(OBJ): $(GLSRC)gdevpsdf.c $(GXERR) $(string__h)\
+ $(sa85x_h) $(scanchar_h) $(scfx_h) $(sstring_h) $(strimpl_h)\
+ $(gdevpsdf_h) $(gdevpstr_h)
+ $(GLCC) $(GLO_)gdevpsdf.$(OBJ) $(C_) $(GLSRC)gdevpsdf.c
+
+$(GLOBJ)gdevpsdi.$(OBJ): $(GLSRC)gdevpsdi.c $(GXERR) $(math__h)\
+ $(gscspace_h)\
+ $(scfx_h) $(sdct_h) $(slzwx_h) $(srlx_h) $(spngpx_h)\
+ $(strimpl_h) $(szlibx_h)\
+ $(gdevpsdf_h) $(gdevpsds_h)\
+ $(GLGEN)jpeglib.h
+ $(GLJZCC) $(GLO_)gdevpsdi.$(OBJ) $(C_) $(GLSRC)gdevpsdi.c
+
+$(GLOBJ)gdevpsdp.$(OBJ): $(GLSRC)gdevpsdp.c $(GDEVH) $(string__h)\
+ $(scfx_h) $(sdct_h) $(slzwx_h) $(srlx_h) $(strimpl_h) $(szlibx_h)\
+ $(gdevpsdf_h) $(gdevpstr_h) $(GLGEN)jpeglib.h
+ $(GLJZCC) $(GLO_)gdevpsdp.$(OBJ) $(C_) $(GLSRC)gdevpsdp.c
+
+$(GLOBJ)gdevpsds.$(OBJ): $(GLSRC)gdevpsds.c $(GX) $(memory__h)\
+ $(gdevpsds_h) $(gserrors_h) $(gxdcconv_h)
+ $(GLCC) $(GLO_)gdevpsds.$(OBJ) $(C_) $(GLSRC)gdevpsds.c
+
+$(GLOBJ)gdevpstr.$(OBJ): $(GLSRC)gdevpstr.c\
+ $(math__h) $(stdio__h) $(string__h)\
$(gdevpstr_h) $(stream_h)
+ $(GLCC) $(GLO_)gdevpstr.$(OBJ) $(C_) $(GLSRC)gdevpstr.c
# PostScript and EPS writers
-pswrite1_=gdevps.$(OBJ) gdevpsdf.$(OBJ) gdevpstr.$(OBJ)
-pswrite2_=scantab.$(OBJ) sfilter2.$(OBJ)
-pswrite_=$(pswrite1_) $(pswrite2_)
-epswrite.dev: $(ECHOGS_XE) $(pswrite_) vector.dev
- $(SETDEV) epswrite $(pswrite1_)
- $(ADDMOD) epswrite $(pswrite2_)
- $(ADDMOD) epswrite -include vector
-
-pswrite.dev: $(ECHOGS_XE) $(pswrite_) vector.dev
- $(SETDEV) pswrite $(pswrite1_)
- $(ADDMOD) pswrite $(pswrite2_)
- $(ADDMOD) pswrite -include vector
-
-gdevps.$(OBJ): gdevps.c $(GDEV) $(math__h) $(time__h)\
- $(gscdefs_h) $(gscspace_h) $(gsparam_h) $(gsiparam_h) $(gsmatrix_h)\
- $(gxdcolor_h)\
+pswrite_=$(GLOBJ)gdevps.$(OBJ) $(GLOBJ)scantab.$(OBJ) $(GLOBJ)sfilter2.$(OBJ)
+epswrite.dev: $(ECHOGS_XE) $(pswrite_) psdf.dev
+ $(SETDEV2) epswrite $(pswrite_)
+ $(ADDMOD) epswrite -include psdf
+
+pswrite.dev: $(ECHOGS_XE) $(pswrite_) psdf.dev
+ $(SETDEV2) pswrite $(pswrite_)
+ $(ADDMOD) pswrite -include psdf
+
+$(GLOBJ)gdevps.$(OBJ): $(GLSRC)gdevps.c $(GDEV)\
+ $(math__h) $(memory__h) $(time__h)\
+ $(gscdefs_h) $(gscspace_h) $(gsline_h) $(gsparam_h) $(gsiparam_h) $(gsmatrix_h)\
+ $(gxdcolor_h) $(gzpath_h)\
$(sa85x_h) $(strimpl_h)\
$(gdevpsdf_h) $(gdevpstr_h)
+ $(GLCC) $(GLO_)gdevps.$(OBJ) $(C_) $(GLSRC)gdevps.c
# PDF writer
# Note that gs_pdfwr.ps will only actually be loaded if the configuration
# includes a PostScript interpreter.
-pdfwrite1_=gdevpdf.$(OBJ) gdevpdfd.$(OBJ) gdevpdfi.$(OBJ) gdevpdfm.$(OBJ)
-pdfwrite2_=gdevpdfp.$(OBJ) gdevpdft.$(OBJ) gdevpsdf.$(OBJ) gdevpstr.$(OBJ)
-pdfwrite3_=gsflip.$(OBJ) scantab.$(OBJ) sfilter2.$(OBJ) sstring.$(OBJ)
-pdfwrite_=$(pdfwrite1_) $(pdfwrite2_) $(pdfwrite3_)
-pdfwrite.dev: $(ECHOGS_XE) $(pdfwrite_) \
- cmyklib.dev cfe.dev dcte.dev lzwe.dev rle.dev vector.dev
- $(SETDEV) pdfwrite $(pdfwrite1_)
+pdfwrite1_=$(GLOBJ)gdevpdf.$(OBJ) $(GLOBJ)gdevpdfd.$(OBJ) $(GLOBJ)gdevpdfi.$(OBJ)
+pdfwrite2_=$(GLOBJ)gdevpdfm.$(OBJ) $(GLOBJ)gdevpdfo.$(OBJ) $(GLOBJ)gdevpdfp.$(OBJ)
+pdfwrite3_=$(GLOBJ)gdevpdft.$(OBJ) $(GLOBJ)gsflip.$(OBJ)
+pdfwrite4_=$(GLOBJ)scantab.$(OBJ) $(GLOBJ)sfilter2.$(OBJ) $(GLOBJ)sstring.$(OBJ)
+pdfwrite_=$(pdfwrite1_) $(pdfwrite2_) $(pdfwrite3_) $(pdfwrite4_)
+pdfwrite.dev: $(ECHOGS_XE) $(pdfwrite_)\
+ cmyklib.dev cfe.dev dcte.dev lzwe.dev rle.dev szlibe.dev psdf.dev
+ $(SETDEV2) pdfwrite $(pdfwrite1_)
$(ADDMOD) pdfwrite $(pdfwrite2_)
$(ADDMOD) pdfwrite $(pdfwrite3_)
+ $(ADDMOD) pdfwrite $(pdfwrite4_)
$(ADDMOD) pdfwrite -ps gs_pdfwr
- $(ADDMOD) pdfwrite -include cmyklib cfe dcte lzwe rle vector
+ $(ADDMOD) pdfwrite -include cmyklib cfe dcte lzwe rle szlibe psdf
-gdevpdfx_h=gdevpdfx.h $(gsparam_h) $(gxdevice_h) $(gxline_h) $(stream_h)\
+gdevpdfx_h=$(GLSRC)gdevpdfx.h\
+ $(gsparam_h) $(gxdevice_h) $(gxline_h) $(stream_h)\
$(gdevpsdf_h) $(gdevpstr_h)
-gdevpdf.$(OBJ): gdevpdf.c $(math__h) $(memory__h) $(string__h) $(time__h)\
+$(GLOBJ)gdevpdf.$(OBJ): $(GLSRC)gdevpdf.c $(GDEVH)\
+ $(math__h) $(memory__h) $(string__h) $(time__h)\
$(gp_h)\
- $(gdevpdfx_h) $(gscdefs_h) $(gserrors_h)\
- $(gx_h) $(gxdevice_h) $(gxfixed_h) $(gxistate_h) $(gxpaint_h)\
+ $(gdevpdfx_h) $(gscdefs_h)\
+ $(gxfixed_h) $(gxistate_h) $(gxpaint_h)\
$(gzcpath_h) $(gzpath_h)\
$(scanchar_h) $(scfx_h) $(slzwx_h) $(sstring_h) $(strimpl_h) $(szlibx_h)
- $(CCCZ) gdevpdf.c
+ $(GLZCC) $(GLO_)gdevpdf.$(OBJ) $(C_) $(GLSRC)gdevpdf.c
-gdevpdfd.$(OBJ): gdevpdfd.c $(math__h)\
+$(GLOBJ)gdevpdfd.$(OBJ): $(GLSRC)gdevpdfd.c $(math__h)\
$(gdevpdfx_h)\
$(gx_h) $(gxdevice_h) $(gxfixed_h) $(gxistate_h) $(gxpaint_h)\
$(gzcpath_h) $(gzpath_h)
+ $(GLCC) $(GLO_)gdevpdfd.$(OBJ) $(C_) $(GLSRC)gdevpdfd.c
-gdevpdfi.$(OBJ): gdevpdfi.c $(math__h) $(memory__h) $(gx_h) \
- $(gdevpdfx_h) $(gscie_h) $(gscolor2_h) $(gserrors_h) $(gsflip_h)\
- $(gxcspace_h) $(gxistate_h) \
- $(sa85x_h) $(scfx_h) $(srlx_h) $(strimpl_h)
-
-gdevpdfm.$(OBJ): gdevpdfm.c $(memory__h) $(string__h) $(gx_h) \
- $(gdevpdfx_h) $(gserrors_h) $(gsutil_h) $(scanchar_h)
+$(GLOBJ)gdevpdfi.$(OBJ): $(GLSRC)gdevpdfi.c\
+ $(math__h) $(memory__h) $(string__h) $(gx_h)\
+ $(gdevpdfx_h)\
+ $(gscie_h) $(gscolor2_h) $(gserrors_h) $(gsflip_h)\
+ $(gxcspace_h) $(gxistate_h)\
+ $(sa85x_h) $(scfx_h) $(sdct_h) $(slzwx_h) $(spngpx_h) $(srlx_h) $(strimpl_h)\
+ $(szlibx_h)\
+ $(GLGEN)jpeglib.h
+ $(GLJZCC) $(GLO_)gdevpdfi.$(OBJ) $(C_) $(GLSRC)gdevpdfi.c
+
+$(GLOBJ)gdevpdfm.$(OBJ): $(GLSRC)gdevpdfm.c\
+ $(memory__h) $(string__h) $(gx_h)\
+ $(gdevpdfx_h) $(gserrors_h) $(gsutil_h) $(scanchar_h)
+ $(GLCC) $(GLO_)gdevpdfm.$(OBJ) $(C_) $(GLSRC)gdevpdfm.c
+
+$(GLOBJ)gdevpdfo.$(OBJ): $(GLSRC)gdevpdfo.c $(memory__h) $(gx_h)\
+ $(gdevpdfx_h) $(gserrors_h) $(gsutil_h)\
+ $(sstring_h) $(strimpl_h)
+ $(GLCC) $(GLO_)gdevpdfo.$(OBJ) $(C_) $(GLSRC)gdevpdfo.c
-gdevpdfp.$(OBJ): gdevpdfp.c $(gx_h)\
+$(GLOBJ)gdevpdfp.$(OBJ): $(GLSRC)gdevpdfp.c $(gx_h)\
$(gdevpdfx_h) $(gserrors_h)
+ $(GLCC) $(GLO_)gdevpdfp.$(OBJ) $(C_) $(GLSRC)gdevpdfp.c
-gdevpdft.$(OBJ): gdevpdft.c $(math__h) $(memory__h) $(string__h) $(gx_h)\
+$(GLOBJ)gdevpdft.$(OBJ): $(GLSRC)gdevpdft.c\
+ $(math__h) $(memory__h) $(string__h) $(gx_h)\
$(gdevpdfx_h) $(gserrors_h) $(gsutil_h)\
$(scommon_h)
+ $(GLCC) $(GLO_)gdevpdft.$(OBJ) $(C_) $(GLSRC)gdevpdft.c
# High-level PCL XL writer
-pxl_=gdevpx.$(OBJ)
+pxl_=$(GLOBJ)gdevpx.$(OBJ)
pxlmono.dev: $(pxl_) $(GDEV) vector.dev
- $(SETDEV) pxlmono $(pxl_)
+ $(SETDEV2) pxlmono $(pxl_)
$(ADDMOD) pxlmono -include vector
pxlcolor.dev: $(pxl_) $(GDEV) vector.dev
- $(SETDEV) pxlcolor $(pxl_)
+ $(SETDEV2) pxlcolor $(pxl_)
$(ADDMOD) pxlcolor -include vector
-gdevpx.$(OBJ): gdevpx.c $(math__h) $(memory__h) $(string__h)\
+$(GLOBJ)gdevpx.$(OBJ): $(GLSRC)gdevpx.c\
+ $(math__h) $(memory__h) $(string__h)\
$(gx_h) $(gsccolor_h) $(gsdcolor_h) $(gserrors_h)\
$(gxcspace_h) $(gxdevice_h) $(gxpath_h)\
$(gdevpxat_h) $(gdevpxen_h) $(gdevpxop_h) $(gdevvec_h)\
$(srlx_h) $(strimpl_h)
+ $(GLCC) $(GLO_)gdevpx.$(OBJ) $(C_) $(GLSRC)gdevpx.c
###### --------------------- Raster file formats --------------------- ######
### --------------------- The "plain bits" devices ---------------------- ###
-bit_=gdevbit.$(OBJ)
+bit_=$(GLOBJ)gdevbit.$(OBJ)
bit.dev: $(bit_) page.dev
- $(SETPDEV) bit $(bit_)
+ $(SETPDEV2) bit $(bit_)
bitrgb.dev: $(bit_) page.dev
- $(SETPDEV) bitrgb $(bit_)
+ $(SETPDEV2) bitrgb $(bit_)
bitcmyk.dev: $(bit_) page.dev
- $(SETPDEV) bitcmyk $(bit_)
+ $(SETPDEV2) bitcmyk $(bit_)
-gdevbit.$(OBJ): gdevbit.c $(PDEVH) $(gsparam_h) $(gxlum_h)
+$(GLOBJ)gdevbit.$(OBJ): $(GLSRC)gdevbit.c $(PDEVH)\
+ $(gscrd_h) $(gscrdp_h) $(gsparam_h) $(gxlum_h)
+ $(GLCC) $(GLO_)gdevbit.$(OBJ) $(C_) $(GLSRC)gdevbit.c
### ------------------------- .BMP file formats ------------------------- ###
-bmp_=gdevbmp.$(OBJ) gdevpccm.$(OBJ)
+gdevbmp_h=$(GLSRC)gdevbmp.h
+
+bmp_=$(GLOBJ)gdevbmp.$(OBJ) $(GLOBJ)gdevbmpc.$(OBJ) $(GLOBJ)gdevpccm.$(OBJ)
-gdevbmp.$(OBJ): gdevbmp.c $(PDEVH) $(gdevpccm_h)
+$(GLOBJ)gdevbmp.$(OBJ): $(GLSRC)gdevbmp.c $(PDEVH) $(gdevbmp_h) $(gdevpccm_h)
+ $(GLCC) $(GLO_)gdevbmp.$(OBJ) $(C_) $(GLSRC)gdevbmp.c
+
+$(GLOBJ)gdevbmpc.$(OBJ): $(GLSRC)gdevbmpc.c $(PDEVH) $(gdevbmp_h)
+ $(GLCC) $(GLO_)gdevbmpc.$(OBJ) $(C_) $(GLSRC)gdevbmpc.c
bmpmono.dev: $(bmp_) page.dev
$(SETPDEV) bmpmono $(bmp_)
@@ -1310,31 +707,34 @@ bmp16m.dev: $(bmp_) page.dev
$(SETPDEV) bmp16m $(bmp_)
### ------------- BMP driver that serves as demo of async rendering ---- ###
-devasync_=gdevasyn.$(OBJ) gdevpccm.$(OBJ) gxsync.$(OBJ)
-gdevasyn.$(OBJ): gdevasyn.c $(AK) $(stdio__h) $(gdevprna_h) $(gdevpccm_h)\
- $(gserrors_h) $(gpsync_h)
+bmpa_=$(GLOBJ)gdevbmpa.$(OBJ) $(GLOBJ)gdevbmpc.$(OBJ) $(GLOBJ)gdevpccm.$(OBJ)
-asynmono.dev: $(devasync_) page.dev async.dev
- $(SETPDEV) asynmono $(devasync_)
- $(ADDMOD) asynmono -include async
+$(GLOBJ)gdevbmpa.$(OBJ): $(GLSRC)gdevbmpa.c $(AK) $(stdio__h)\
+ $(gdevbmp_h) $(gdevprna_h) $(gdevpccm_h) $(gserrors_h) $(gpsync_h)
+ $(GLCC) $(GLO_)gdevbmpa.$(OBJ) $(C_) $(GLSRC)gdevbmpa.c
+bmpamono.dev: $(bmpa_) page.dev async.dev
+ $(SETPDEV) bmpamono $(bmpa_)
+ $(ADDMOD) bmpamono -include async
### -------------------------- CGM file format ------------------------- ###
### This driver is under development. Use at your own risk. ###
### The output is very low-level, consisting only of rectangles and ###
### cell arrays. ###
-cgm_=gdevcgm.$(OBJ) gdevcgml.$(OBJ)
+cgm_=$(GLOBJ)gdevcgm.$(OBJ) $(GLOBJ)gdevcgml.$(OBJ)
-gdevcgml_h=gdevcgml.h
-gdevcgmx_h=gdevcgmx.h $(gdevcgml_h)
+gdevcgml_h=$(GLSRC)gdevcgml.h
+gdevcgmx_h=$(GLSRC)gdevcgmx.h $(gdevcgml_h)
-gdevcgm.$(OBJ): gdevcgm.c $(GDEV) $(memory__h)\
+$(GLOBJ)gdevcgm.$(OBJ): $(GLSRC)gdevcgm.c $(GDEV) $(memory__h)\
$(gsparam_h) $(gdevpccm_h) $(gdevcgml_h)
+ $(GLCC) $(GLO_)gdevcgm.$(OBJ) $(C_) $(GLSRC)gdevcgm.c
-gdevcgml.$(OBJ): gdevcgml.c $(memory__h) $(stdio__h)\
+$(GLOBJ)gdevcgml.$(OBJ): $(GLSRC)gdevcgml.c $(memory__h) $(stdio__h)\
$(gdevcgmx_h)
+ $(GLCC) $(GLO_)gdevcgml.$(OBJ) $(C_) $(GLSRC)gdevcgml.c
cgmmono.dev: $(cgm_)
$(SETDEV) cgmmono $(cgm_)
@@ -1345,210 +745,193 @@ cgm8.dev: $(cgm_)
cgm24.dev: $(cgm_)
$(SETDEV) cgm24 $(cgm_)
-### -------------------- The CIF file format for VLSI ------------------ ###
-### Note: this driver was contributed by a user: please contact ###
-### Frederic Petrot (petrot@masi.ibp.fr) if you have questions. ###
-
-cif_=gdevcif.$(OBJ)
-cif.dev: $(cif_) page.dev
- $(SETPDEV) cif $(cif_)
-
-gdevcif.$(OBJ): gdevcif.c $(PDEVH)
-
### ------------------------- JPEG file format ------------------------- ###
-jpeg_=gdevjpeg.$(OBJ)
+jpeg_=$(GLOBJ)gdevjpeg.$(OBJ)
# RGB output
jpeg.dev: $(jpeg_) sdcte.dev page.dev
- $(SETPDEV) jpeg $(jpeg_)
+ $(SETPDEV2) jpeg $(jpeg_)
$(ADDMOD) jpeg -include sdcte
# Gray output
jpeggray.dev: $(jpeg_) sdcte.dev page.dev
- $(SETPDEV) jpeggray $(jpeg_)
+ $(SETPDEV2) jpeggray $(jpeg_)
$(ADDMOD) jpeggray -include sdcte
-gdevjpeg.$(OBJ): gdevjpeg.c $(stdio__h) $(PDEVH)\
- $(sdct_h) $(sjpeg_h) $(stream_h) $(strimpl_h) jpeglib.h
+$(GLOBJ)gdevjpeg.$(OBJ): $(GLSRC)gdevjpeg.c $(stdio__h) $(PDEVH)\
+ $(sdct_h) $(sjpeg_h) $(stream_h) $(strimpl_h) $(GLGEN)jpeglib.h
+ $(GLCC) $(GLO_)gdevjpeg.$(OBJ) $(C_) $(GLSRC)gdevjpeg.c
### ------------------------- MIFF file format ------------------------- ###
### Right now we support only 24-bit direct color, but we might add more ###
### formats in the future. ###
-miff_=gdevmiff.$(OBJ)
+miff_=$(GLOBJ)gdevmiff.$(OBJ)
miff24.dev: $(miff_) page.dev
$(SETPDEV) miff24 $(miff_)
-gdevmiff.$(OBJ): gdevmiff.c $(PDEVH)
-
-### --------------------------- MGR devices ---------------------------- ###
-### Note: these drivers were contributed by a user: please contact ###
-### Carsten Emde (carsten@ce.pr.net.ch) if you have questions. ###
-
-MGR=gdevmgr.$(OBJ) gdevpccm.$(OBJ)
-
-gdevmgr.$(OBJ): gdevmgr.c $(PDEVH) $(gdevpccm_h) gdevmgr.h
-
-mgrmono.dev: $(MGR) page.dev
- $(SETPDEV) mgrmono $(MGR)
-
-mgrgray2.dev: $(MGR) page.dev
- $(SETPDEV) mgrgray2 $(MGR)
-
-mgrgray4.dev: $(MGR) page.dev
- $(SETPDEV) mgrgray4 $(MGR)
-
-mgrgray8.dev: $(MGR) page.dev
- $(SETPDEV) mgrgray8 $(MGR)
-
-mgr4.dev: $(MGR) page.dev
- $(SETPDEV) mgr4 $(MGR)
-
-mgr8.dev: $(MGR) page.dev
- $(SETPDEV) mgr8 $(MGR)
+$(GLOBJ)gdevmiff.$(OBJ): $(GLSRC)gdevmiff.c $(PDEVH)
+ $(GLCC) $(GLO_)gdevmiff.$(OBJ) $(C_) $(GLSRC)gdevmiff.c
### ------------------------- PCX file formats ------------------------- ###
-pcx_=gdevpcx.$(OBJ) gdevpccm.$(OBJ)
+pcx_=$(GLOBJ)gdevpcx.$(OBJ) $(GLOBJ)gdevpccm.$(OBJ)
-gdevpcx.$(OBJ): gdevpcx.c $(PDEVH) $(gdevpccm_h) $(gxlum_h)
+$(GLOBJ)gdevpcx.$(OBJ): $(GLSRC)gdevpcx.c $(PDEVH) $(gdevpccm_h) $(gxlum_h)
+ $(GLCC) $(GLO_)gdevpcx.$(OBJ) $(C_) $(GLSRC)gdevpcx.c
pcxmono.dev: $(pcx_) page.dev
- $(SETPDEV) pcxmono $(pcx_)
+ $(SETPDEV2) pcxmono $(pcx_)
pcxgray.dev: $(pcx_) page.dev
- $(SETPDEV) pcxgray $(pcx_)
+ $(SETPDEV2) pcxgray $(pcx_)
pcx16.dev: $(pcx_) page.dev
- $(SETPDEV) pcx16 $(pcx_)
+ $(SETPDEV2) pcx16 $(pcx_)
pcx256.dev: $(pcx_) page.dev
- $(SETPDEV) pcx256 $(pcx_)
+ $(SETPDEV2) pcx256 $(pcx_)
pcx24b.dev: $(pcx_) page.dev
- $(SETPDEV) pcx24b $(pcx_)
+ $(SETPDEV2) pcx24b $(pcx_)
pcxcmyk.dev: $(pcx_) page.dev
- $(SETPDEV) pcxcmyk $(pcx_)
+ $(SETPDEV2) pcxcmyk $(pcx_)
# The 2-up PCX device is here only as an example, and for testing.
+
pcx2up.dev: $(LIB_MAK) $(ECHOGS_XE) gdevp2up.$(OBJ) page.dev pcx256.dev
- $(SETPDEV) pcx2up gdevp2up.$(OBJ)
+ $(SETPDEV) pcx2up $(GLOBJ)gdevp2up.$(OBJ)
$(ADDMOD) pcx2up -include pcx256
-gdevp2up.$(OBJ): gdevp2up.c $(AK)\
+$(GLOBJ)gdevp2up.$(OBJ): $(GLSRC)gdevp2up.c $(AK)\
$(gdevpccm_h) $(gdevprn_h) $(gxclpage_h)
+ $(GLCC) $(GLO_)gdevp2up.$(OBJ) $(C_) $(GLSRC)gdevp2up.c
### ------------------- Portable Bitmap file formats ------------------- ###
### For more information, see the pbm(5), pgm(5), and ppm(5) man pages. ###
-pxm_=gdevpbm.$(OBJ)
+pxm_=$(GLOBJ)gdevpbm.$(OBJ)
-gdevpbm.$(OBJ): gdevpbm.c $(PDEVH) $(gscdefs_h) $(gxlum_h)
+$(GLOBJ)gdevpbm.$(OBJ): $(GLSRC)gdevpbm.c $(PDEVH) $(gscdefs_h) $(gxlum_h)
+ $(GLCC) $(GLO_)gdevpbm.$(OBJ) $(C_) $(GLSRC)gdevpbm.c
### Portable Bitmap (PBM, plain or raw format, magic numbers "P1" or "P4")
pbm.dev: $(pxm_) page.dev
- $(SETPDEV) pbm $(pxm_)
+ $(SETPDEV2) pbm $(pxm_)
pbmraw.dev: $(pxm_) page.dev
- $(SETPDEV) pbmraw $(pxm_)
+ $(SETPDEV2) pbmraw $(pxm_)
### Portable Graymap (PGM, plain or raw format, magic numbers "P2" or "P5")
pgm.dev: $(pxm_) page.dev
- $(SETPDEV) pgm $(pxm_)
+ $(SETPDEV2) pgm $(pxm_)
pgmraw.dev: $(pxm_) page.dev
- $(SETPDEV) pgmraw $(pxm_)
+ $(SETPDEV2) pgmraw $(pxm_)
# PGM with automatic optimization to PBM if this is possible.
pgnm.dev: $(pxm_) page.dev
- $(SETPDEV) pgnm $(pxm_)
+ $(SETPDEV2) pgnm $(pxm_)
pgnmraw.dev: $(pxm_) page.dev
- $(SETPDEV) pgnmraw $(pxm_)
+ $(SETPDEV2) pgnmraw $(pxm_)
### Portable Pixmap (PPM, plain or raw format, magic numbers "P3" or "P6")
ppm.dev: $(pxm_) page.dev
- $(SETPDEV) ppm $(pxm_)
+ $(SETPDEV2) ppm $(pxm_)
ppmraw.dev: $(pxm_) page.dev
- $(SETPDEV) ppmraw $(pxm_)
+ $(SETPDEV2) ppmraw $(pxm_)
# PPM with automatic optimization to PGM or PBM if possible.
pnm.dev: $(pxm_) page.dev
- $(SETPDEV) pnm $(pxm_)
+ $(SETPDEV2) pnm $(pxm_)
pnmraw.dev: $(pxm_) page.dev
- $(SETPDEV) pnmraw $(pxm_)
+ $(SETPDEV2) pnmraw $(pxm_)
### Portable inKmap (CMYK internally, converted to PPM=RGB at output time)
pkm.dev: $(pxm_) page.dev
- $(SETPDEV) pkm $(pxm_)
+ $(SETPDEV2) pkm $(pxm_)
pkmraw.dev: $(pxm_) page.dev
- $(SETPDEV) pkmraw $(pxm_)
+ $(SETPDEV2) pkmraw $(pxm_)
+
+### Plan 9 bitmap format
+
+plan9bm.dev: $(pxm_) page.dev
+ $(SETPDEV2) plan9bm $(pxm_)
### --------------- Portable Network Graphics file format --------------- ###
### Requires libpng 0.81 and zlib 0.95 (or more recent versions). ###
### See libpng.mak and zlib.mak for more details. ###
-png_=gdevpng.$(OBJ) gdevpccm.$(OBJ)
+png_=$(GLOBJ)gdevpng.$(OBJ) $(GLOBJ)gdevpccm.$(OBJ)
+libpng_dev=$(PNGGENDIR)$(D)libpng.dev
+png_i_=-include $(PNGGENDIR)$(D)libpng
-gdevpng.$(OBJ): gdevpng.c $(gdevprn_h) $(gdevpccm_h) $(gscdefs_h) $(PSRC)png.h
- $(CCCP) gdevpng.c
+$(GLOBJ)gdevpng.$(OBJ): $(GLSRC)gdevpng.c\
+ $(gdevprn_h) $(gdevpccm_h) $(gscdefs_h) $(PNGSRC)png.h
+ $(CC_) $(I_)$(GLI_) $(II)$(PI_)$(_I) $(GLF_) $(GLO_)gdevpng.$(OBJ) $(C_) $(GLSRC)gdevpng.c
-pngmono.dev: libpng.dev $(png_) page.dev
- $(SETPDEV) pngmono $(png_)
- $(ADDMOD) pngmono -include libpng
+pngmono.dev: $(libpng_dev) $(png_) page.dev
+ $(SETPDEV2) pngmono $(png_)
+ $(ADDMOD) pngmono $(png_i_)
-pnggray.dev: libpng.dev $(png_) page.dev
- $(SETPDEV) pnggray $(png_)
- $(ADDMOD) pnggray -include libpng
+pnggray.dev: $(libpng_dev) $(png_) page.dev
+ $(SETPDEV2) pnggray $(png_)
+ $(ADDMOD) pnggray $(png_i_)
-png16.dev: libpng.dev $(png_) page.dev
- $(SETPDEV) png16 $(png_)
- $(ADDMOD) png16 -include libpng
+png16.dev: $(libpng_dev) $(png_) page.dev
+ $(SETPDEV2) png16 $(png_)
+ $(ADDMOD) png16 $(png_i_)
-png256.dev: libpng.dev $(png_) page.dev
- $(SETPDEV) png256 $(png_)
- $(ADDMOD) png256 -include libpng
+png256.dev: $(libpng_dev) $(png_) page.dev
+ $(SETPDEV2) png256 $(png_)
+ $(ADDMOD) png256 $(png_i_)
-png16m.dev: libpng.dev $(png_) page.dev
- $(SETPDEV) png16m $(png_)
- $(ADDMOD) png16m -include libpng
+png16m.dev: $(libpng_dev) $(png_) page.dev
+ $(SETPDEV2) png16m $(png_)
+ $(ADDMOD) png16m $(png_i_)
### ---------------------- PostScript image format ---------------------- ###
-### These devices make it possible to print Level 2 files on a Level 1 ###
-### printer, by converting them to a bitmap in PostScript format. ###
+### These devices make it possible to print monochrome Level 2 files on a ###
+### Level 1 printer, by converting them to a bitmap in PostScript ###
+### format. They also can convert big, complex color PostScript files ###
+### to (often) smaller and more easily printed bitmaps. ###
-ps_=gdevpsim.$(OBJ)
+# Monochrome, Level 1 output
-gdevpsim.$(OBJ): gdevpsim.c $(PDEVH)
+psim_=$(GLOBJ)gdevpsim.$(OBJ)
-psmono.dev: $(ps_) page.dev
- $(SETPDEV) psmono $(ps_)
+$(GLOBJ)gdevpsim.$(OBJ): $(GLSRC)gdevpsim.c $(PDEVH)
+ $(GLCC) $(GLO_)gdevpsim.$(OBJ) $(C_) $(GLSRC)gdevpsim.c
-psgray.dev: $(ps_) page.dev
- $(SETPDEV) psgray $(ps_)
+psmono.dev: $(psim_) page.dev
+ $(SETPDEV2) psmono $(psim_)
-# Someday there will be RGB and CMYK variants....
+psgray.dev: $(psim_) page.dev
+ $(SETPDEV2) psgray $(psim_)
-### -------------------------- SGI RGB pixmaps -------------------------- ###
+# RGB, Level 2 output
-sgirgb_=gdevsgi.$(OBJ)
+psci_=$(GLOBJ)gdevpsci.$(OBJ)
-gdevsgi.$(OBJ): gdevsgi.c $(PDEVH) gdevsgi.h
+$(GLOBJ)gdevpsci.$(OBJ): $(GLSRC)gdevpsci.c $(PDEVH)\
+ $(srlx_h) $(stream_h) $(strimpl_h)
+ $(GLCC) $(GLO_)gdevpsci.$(OBJ) $(C_) $(GLSRC)gdevpsci.c
-sgirgb.dev: $(sgirgb_) page.dev
- $(SETPDEV) sgirgb $(sgirgb_)
+psrgb.dev: $(psci_) page.dev
+ $(SETPDEV2) psrgb $(psci_)
### -------------------- Plain or TIFF fax encoding --------------------- ###
### Use -sDEVICE=tiffg3 or tiffg4 and ###
@@ -1556,71 +939,74 @@ sgirgb.dev: $(sgirgb_) page.dev
### -r204x196 for high resolution output ###
### These drivers recognize 3 page sizes: letter, A4, and B4. ###
-gdevtifs_h=gdevtifs.h
+gdevtifs_h=$(GLSRC)gdevtifs.h
-tfax_=gdevtfax.$(OBJ)
+tfax_=$(GLOBJ)gdevtfax.$(OBJ)
tfax.dev: $(tfax_) cfe.dev lzwe.dev rle.dev tiffs.dev
$(SETMOD) tfax $(tfax_)
$(ADDMOD) tfax -include cfe lzwe rle tiffs
-gdevtfax.$(OBJ): gdevtfax.c $(PDEVH)\
+$(GLOBJ)gdevtfax.$(OBJ): $(GLSRC)gdevtfax.c $(PDEVH)\
$(gdevtifs_h) $(scfx_h) $(slzwx_h) $(srlx_h) $(strimpl_h)
+ $(GLCC) $(GLO_)gdevtfax.$(OBJ) $(C_) $(GLSRC)gdevtfax.c
### Plain G3/G4 fax with no header
faxg3.dev: tfax.dev
- $(SETDEV) faxg3 -include tfax
+ $(SETDEV2) faxg3 -include tfax
faxg32d.dev: tfax.dev
- $(SETDEV) faxg32d -include tfax
+ $(SETDEV2) faxg32d -include tfax
faxg4.dev: tfax.dev
- $(SETDEV) faxg4 -include tfax
+ $(SETDEV2) faxg4 -include tfax
### ---------------------------- TIFF formats --------------------------- ###
-tiffs_=gdevtifs.$(OBJ)
+tiffs_=$(GLOBJ)gdevtifs.$(OBJ)
tiffs.dev: $(tiffs_) page.dev
$(SETMOD) tiffs $(tiffs_)
$(ADDMOD) tiffs -include page
-gdevtifs.$(OBJ): gdevtifs.c $(PDEVH) $(stdio__h) $(time__h) \
+$(GLOBJ)gdevtifs.$(OBJ): $(GLSRC)gdevtifs.c $(PDEVH) $(stdio__h) $(time__h)\
$(gdevtifs_h) $(gscdefs_h) $(gstypes_h)
+ $(GLCC) $(GLO_)gdevtifs.$(OBJ) $(C_) $(GLSRC)gdevtifs.c
# Black & white, G3/G4 fax
tiffcrle.dev: tfax.dev
- $(SETDEV) tiffcrle -include tfax
+ $(SETDEV2) tiffcrle -include tfax
tiffg3.dev: tfax.dev
- $(SETDEV) tiffg3 -include tfax
+ $(SETDEV2) tiffg3 -include tfax
tiffg32d.dev: tfax.dev
- $(SETDEV) tiffg32d -include tfax
+ $(SETDEV2) tiffg32d -include tfax
tiffg4.dev: tfax.dev
- $(SETDEV) tiffg4 -include tfax
+ $(SETDEV2) tiffg4 -include tfax
# Black & white, LZW compression
tifflzw.dev: tfax.dev
- $(SETDEV) tifflzw -include tfax
+ $(SETDEV2) tifflzw -include tfax
# Black & white, PackBits compression
tiffpack.dev: tfax.dev
- $(SETDEV) tiffpack -include tfax
+ $(SETDEV2) tiffpack -include tfax
# RGB, no compression
-tiffrgb_=gdevtfnx.$(OBJ)
+tiffrgb_=$(GLOBJ)gdevtfnx.$(OBJ)
tiff12nc.dev: $(tiffrgb_) tiffs.dev
- $(SETPDEV) tiff12nc $(tiffrgb_)
+ $(SETPDEV2) tiff12nc $(tiffrgb_)
$(ADDMOD) tiff12nc -include tiffs
tiff24nc.dev: $(tiffrgb_) tiffs.dev
- $(SETPDEV) tiff24nc $(tiffrgb_)
+ $(SETPDEV2) tiff24nc $(tiffrgb_)
$(ADDMOD) tiff24nc -include tiffs
-gdevtfnx.$(OBJ): gdevtfnx.c $(PDEVH) $(gdevtifs_h)
+$(GLOBJ)gdevtfnx.$(OBJ): $(GLSRC)gdevtfnx.c $(PDEVH) $(gdevtifs_h)
+ $(GLCC) $(GLO_)gdevtfnx.$(OBJ) $(C_) $(GLSRC)gdevtfnx.c
diff --git a/gs/src/dirent_.h b/gs/src/dirent_.h
index 0f7ab2b6a..33c70df42 100644
--- a/gs/src/dirent_.h
+++ b/gs/src/dirent_.h
@@ -1,38 +1,46 @@
-/* Copyright (C) 1993, 1997 Aladdin Enterprises. All rights reserved.
-
- This file is part of Aladdin Ghostscript.
-
- Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
- or distributor accepts any responsibility for the consequences of using it,
- or for whether it serves any particular purpose or works at all, unless he
- or she says so in writing. Refer to the Aladdin Ghostscript Free Public
- License (the "License") for full details.
-
- Every copy of Aladdin Ghostscript must include a copy of the License,
- normally in a plain ASCII text file named PUBLIC. The License grants you
- the right to copy, modify and redistribute Aladdin Ghostscript, but only
- under certain conditions described in the License. Among other things, the
- License requires that the copyright notice and this notice be preserved on
- all copies.
-*/
-
-/* dirent_.h */
+/* Copyright (C) 1993, 1997, 1998 Aladdin Enterprises. All rights reserved.
+
+ This file is part of Aladdin Ghostscript.
+
+ Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
+ or distributor accepts any responsibility for the consequences of using it,
+ or for whether it serves any particular purpose or works at all, unless he
+ or she says so in writing. Refer to the Aladdin Ghostscript Free Public
+ License (the "License") for full details.
+
+ Every copy of Aladdin Ghostscript must include a copy of the License,
+ normally in a plain ASCII text file named PUBLIC. The License grants you
+ the right to copy, modify and redistribute Aladdin Ghostscript, but only
+ under certain conditions described in the License. Among other things, the
+ License requires that the copyright notice and this notice be preserved on
+ all copies.
+ */
+
+/*Id: dirent_.h */
/* Generic substitute for Unix dirent.h */
+#ifndef dirent__INCLUDED
+# define dirent__INCLUDED
+
/* We must include std.h before any file that includes sys/types.h. */
#include "std.h"
-/* The location (or existence) of certain system headers is */
-/* environment-dependent. We detect this in the makefile */
-/* and conditionally define switches in gconfig_.h. */
+/*
+ * The location (or existence) of certain system headers is
+ * environment-dependent. We detect this in the makefile
+ * and conditionally define switches in gconfig_.h.
+ */
#include "gconfig_.h"
-/* Directory entries may be defined in quite a number of different */
-/* header files. The following switches are defined in gconfig_.h. */
+/*
+ * Directory entries may be defined in quite a number of different
+ * header files. The following switches are defined in gconfig_.h.
+ */
#ifdef HAVE_DIRENT_H
# include <dirent.h>
typedef struct dirent dir_entry;
-#else /* sys/ndir or ndir or sys/dir, i.e., no dirent */
+
+#else /* sys/ndir or ndir or sys/dir, i.e., no dirent */
# ifdef HAVE_SYS_DIR_H
# include <sys/dir.h>
# endif
@@ -43,4 +51,7 @@ typedef struct dirent dir_entry;
# include <ndir.h>
# endif
typedef struct direct dir_entry;
-#endif /* sys/ndir or ndir or sys/dir */
+
+#endif /* sys/ndir or ndir or sys/dir */
+
+#endif /* dirent__INCLUDED */
diff --git a/gs/src/dos_.h b/gs/src/dos_.h
index b98586a5b..046c2be35 100644
--- a/gs/src/dos_.h
+++ b/gs/src/dos_.h
@@ -1,24 +1,27 @@
-/* Copyright (C) 1991, 1992 Aladdin Enterprises. All rights reserved.
-
- This file is part of Aladdin Ghostscript.
-
- Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
- or distributor accepts any responsibility for the consequences of using it,
- or for whether it serves any particular purpose or works at all, unless he
- or she says so in writing. Refer to the Aladdin Ghostscript Free Public
- License (the "License") for full details.
-
- Every copy of Aladdin Ghostscript must include a copy of the License,
- normally in a plain ASCII text file named PUBLIC. The License grants you
- the right to copy, modify and redistribute Aladdin Ghostscript, but only
- under certain conditions described in the License. Among other things, the
- License requires that the copyright notice and this notice be preserved on
- all copies.
-*/
+/* Copyright (C) 1991, 1992, 1998 Aladdin Enterprises. All rights reserved.
-/* dos_.h */
+ This file is part of Aladdin Ghostscript.
+
+ Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
+ or distributor accepts any responsibility for the consequences of using it,
+ or for whether it serves any particular purpose or works at all, unless he
+ or she says so in writing. Refer to the Aladdin Ghostscript Free Public
+ License (the "License") for full details.
+
+ Every copy of Aladdin Ghostscript must include a copy of the License,
+ normally in a plain ASCII text file named PUBLIC. The License grants you
+ the right to copy, modify and redistribute Aladdin Ghostscript, but only
+ under certain conditions described in the License. Among other things, the
+ License requires that the copyright notice and this notice be preserved on
+ all copies.
+ */
+
+/*Id: dos_.h */
/* Generic MS-DOS interface */
+#ifndef dos__INCLUDED
+# define dos__INCLUDED
+
/* This file is needed because the various DOS compilers */
/* provide slightly different procedures for interfacing to DOS and */
/* the I/O hardware, and because the Watcom compiler is 32-bit. */
@@ -60,7 +63,7 @@
# define stdprn _stdprn
# endif
-#else /* not Watcom or Microsoft */
+#else /* not Watcom or Microsoft */
/* ---------------- Borland compiler, 16:16 pseudo-segmented model. */
/* ---------------- ffblk is in dir.h, not dos.h. */
@@ -75,3 +78,5 @@
#define dos_findnext(b) findnext(b)
#endif
+
+#endif /* dos__INCLUDED */
diff --git a/gs/src/dpmainc.c b/gs/src/dpmainc.c
index efa84d90d..d4309a89b 100644
--- a/gs/src/dpmainc.c
+++ b/gs/src/dpmainc.c
@@ -17,7 +17,7 @@
*/
-/* dpmainc.c */
+/*Id: dpmainc.c */
/* Ghostscript DLL loader for OS/2 */
/* For WINDOWCOMPAT (console mode) application */
diff --git a/gs/src/dstack.h b/gs/src/dstack.h
index 51e3340a4..8ca87eb3c 100644
--- a/gs/src/dstack.h
+++ b/gs/src/dstack.h
@@ -1,33 +1,49 @@
-/* Copyright (C) 1992, 1996, 1997 Aladdin Enterprises. All rights reserved.
-
- This file is part of Aladdin Ghostscript.
-
- Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
- or distributor accepts any responsibility for the consequences of using it,
- or for whether it serves any particular purpose or works at all, unless he
- or she says so in writing. Refer to the Aladdin Ghostscript Free Public
- License (the "License") for full details.
-
- Every copy of Aladdin Ghostscript must include a copy of the License,
- normally in a plain ASCII text file named PUBLIC. The License grants you
- the right to copy, modify and redistribute Aladdin Ghostscript, but only
- under certain conditions described in the License. Among other things, the
- License requires that the copyright notice and this notice be preserved on
- all copies.
-*/
+/* Copyright (C) 1992, 1996, 1997, 1998 Aladdin Enterprises. All rights reserved.
+
+ This file is part of Aladdin Ghostscript.
+
+ Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
+ or distributor accepts any responsibility for the consequences of using it,
+ or for whether it serves any particular purpose or works at all, unless he
+ or she says so in writing. Refer to the Aladdin Ghostscript Free Public
+ License (the "License") for full details.
+
+ Every copy of Aladdin Ghostscript must include a copy of the License,
+ normally in a plain ASCII text file named PUBLIC. The License grants you
+ the right to copy, modify and redistribute Aladdin Ghostscript, but only
+ under certain conditions described in the License. Among other things, the
+ License requires that the copyright notice and this notice be preserved on
+ all copies.
+ */
+
+/*Id: dstack.h */
+/* Definitions for the interpreter's dictionary stack */
+
+#ifndef dstack_INCLUDED
+# define dstack_INCLUDED
-/* dstack.h */
-/* Definitions for the dictionary stack */
-#include "istack.h"
+#include "idstack.h"
-/* Define the dictionary stack and systemdict. */
-extern ref_stack d_stack;
-extern ref ref_systemdict;
-#define systemdict (&ref_systemdict)
+/* Define the (currently static) dictionary stack instance. */
+extern dict_stack_t idict_stack;
+
+#define d_stack (idict_stack.stack)
+
+/* Define the interpreter-specific versions of the generic dstack API. */
+#define min_dstack_size (idict_stack.min_size)
+#define dstack_userdict_index (idict_stack.userdict_index)
+#define dsspace (idict_stack.def_space)
+#define dtop_can_store(pvalue) ((int)r_space(pvalue) <= dsspace)
+#define dtop_keys (idict_stack.top_keys)
+#define dtop_npairs (idict_stack.top_npairs)
+#define dtop_values (idict_stack.top_values)
+#define dict_set_top() dstack_set_top(&idict_stack);
+#define dict_is_permanent_on_dstack(pdict)\
+ dstack_dict_is_permanent(&idict_stack, pdict)
+#define dicts_gc_cleanup() dstack_gc_cleanup(&idict_stack)
+#define systemdict (&idict_stack.system_dict)
/* Define the dictionary stack pointers. */
-typedef s_ptr ds_ptr;
-typedef const_s_ptr const_ds_ptr;
#define dsbot (d_stack.bot)
#define dsp (d_stack.p)
#define dstop (d_stack.top)
@@ -37,243 +53,178 @@ typedef const_s_ptr const_ds_ptr;
if ( dstop - dsp < (n) )\
{ d_stack.requested = (n); return_error(e_dictstackoverflow); }
-/* Check whether a dictionary is one of the permanent ones on the d-stack. */
-bool dict_is_permanent_on_dstack(P1(const ref *));
-
-/*
- * Switching between Level 1 and Level 2 involves inserting and removing
- * globaldict on the dictionary stack. Instead of truly inserting and
- * removing entries, we replace globaldict by a copy of systemdict in
- * Level 1 mode. min_dstack_size, the minimum number of entries, does not
- * change depending on language level; the countdictstack and dictstack
- * operators must take this into account.
- */
-extern uint min_dstack_size;
-
/*
* The dictionary stack is implemented as a linked list of blocks;
* operators that access the entire d-stack must take this into account.
* These are:
- * countdictstack dictstack
+ * countdictstack dictstack
* In addition, name lookup requires searching the entire stack, not just
* the top block, and the underflow check for the dictionary stack
* (`end' operator) is not just a check for underflowing the top block.
*/
-/*
- * Cache a value for fast checking of def operations.
- * If the top entry on the dictionary stack is a writable dictionary,
- * dsspace is the space of the dictionary; if it is a non-writable
- * dictionary, dsspace = -1. Then def is legal precisely if
- * r_space(pvalue) <= dsspace. Note that in order for this trick to work,
- * the result of r_space must be a signed integer; some compilers treat
- * enums as unsigned, probably in violation of the ANSI standard.
- */
-extern int dsspace;
-#define dtop_can_store(pvalue) ((int)r_space(pvalue) <= dsspace)
-/*
- * Cache values for fast name lookup. If the top entry on the dictionary
- * stack is a readable dictionary with packed keys, dtop_keys, dtop_npairs,
- * and dtop_values are keys.value.packed, npairs, and values.value.refs
- * for that dictionary; otherwise, these variables point to a dummy
- * empty dictionary.
- */
-extern const ref_packed *dtop_keys;
-extern uint dtop_npairs;
-extern ref *dtop_values;
-/*
- * Reset the cached top values. Every routine that alters the
- * dictionary stack (including changing the protection or size of the
- * top dictionary on the stack) must call this.
- */
-void dict_set_top(P0());
-
-/*
- * Define a special fast entry for name lookup in the interpreter.
- * The key is known to be a name; search the entire dict stack.
- * Return the pointer to the value slot.
- * If the name isn't found, just return 0.
- */
-ref *dict_find_name_by_index(P1(uint nidx));
+/* Name lookup */
+#define dict_find_name_by_index(nidx)\
+ dstack_find_name_by_index(&idict_stack, nidx)
#define dict_find_name(pnref) dict_find_name_by_index(name_index(pnref))
-
-/* Define the hashing function for names. */
-/* We don't have to scramble the index, because */
-/* indices are assigned in a scattered order (see name_ref in iname.c). */
-#define dict_name_index_hash(nidx) (nidx)
-
-/*
- * Define an extra-fast macro for name lookup, optimized for
- * a single-probe lookup in the top dictionary on the stack.
- * Amazingly enough, this seems to hit over 90% of the time
- * (aside from operators, of course, which are handled either with
- * the special cache pointer or with 'bind').
- */
-#define dict_find_name_by_index_inline(nidx,htemp)\
- (dtop_keys[htemp = dict_hash_mod_inline(dict_name_index_hash(nidx),\
- dtop_npairs) + 1] == pt_tag(pt_literal_name) + (nidx) ?\
- dtop_values + htemp : dict_find_name_by_index(nidx))
-/*
- * Define a similar macro that only checks the top dictionary on the stack.
- */
-#define if_dict_find_name_by_index_top(nidx,htemp,pvslot)\
- if ( ((dtop_keys[htemp = dict_hash_mod_inline(dict_name_index_hash(nidx),\
- dtop_npairs) + 1] == pt_tag(pt_literal_name) + (nidx)) ?\
- ((pvslot) = dtop_values + (htemp), 1) :\
- 0)\
- )
+#define dict_find_name_by_index_inline(nidx, htemp)\
+ dstack_find_name_by_index_inline(&idict_stack, nidx, htemp)
+#define if_dict_find_name_by_index_top(nidx, htemp, pvslot)\
+ if_dstack_find_name_by_index_top(&idict_stack, nidx, htemp, pvslot)
/*
-Notes on dictionary lookup performance
---------------------------------------
-
-We mark heavily used operations with a * below; moderately heavily used
-operations with a +.
-
-The following operations change the dictionary stack:
- +begin, +end
- readonly (on a dictionary that is on the stack)
- noaccess (on a dictionary that is on the stack)
-We implement cleardictstack as a series of ends.
-
-The following operations change the contents of dictionaries:
- *def, +put
- undef
- restore
- .setmaxlength
-We implement store in PostScript, and copy as a series of puts. Many
-other operators also do puts (e.g., ScaleMatrix in makefont,
-Implementation in makepattern, ...). Note that put can do an implicit
-.setmaxlength (if it has to grow the dictionary).
-
-The following operations look up keys on the dictionary stack:
- *(interpreter name lookup)
- load
- where
-
-Current design
---------------
-
-Each name has a pointer that has one of 3 states:
- - This name has no definitions.
- - This name has exactly one definition, in systemdict or userdict.
- In this case, the pointer points to the value slot.
- - This name has some other status.
-
-We cache some pointers to the top dictionary on the stack if it is a
-readable dictionary with packed keys, which allows us to do fast,
-single-probe lookups in this dictionary. We also cache a value that
-allows us to do a fast check for stores into the top dictionary
-(writability + space check).
-
-Full shallow binding
---------------------
-
-We implement shallow binding with a pointer in each name that points to
-the value slot that holds the name's definition. If the name is
-undefined, or if we don't know where the slot is, the binding pointer
-points to a ref with a special type t__invalid, which cannot occur
-anywhere else. "Clearing" the pointer means setting it to point to this
-ref.
-
-We also maintain a pair of pointers that bracket the value region of the
-top dictionary on the stack, for fast checking in def. If the top
-dictionary is readonly or noaccess, the pointers designate an empty area.
-We call this the "def region" cache.
-
-We implement the above operations as follows:
- begin - push the dictionary on the stack; set the pointers of
- all name keys to point to the corresponding value slots.
- end - pop the stack; clear the pointers of all name keys.
- readonly - if the dictionary is the top one on the stack,
- reset the def region cache.
- noaccess - clear the pointers of all name keys. (This is overly
- conservative, but this is a very rare operation.)
- Also reset the def region cache if the dictionary is
- the top one on the stack.
- def - if the key is a name and its pointer points within the cached
- def region, store the value through the pointer; otherwise,
- look up the key in the top dictionary, store the value,
- and if the key is a name, set its pointer to the value slot.
- put - if the key is a name and wasn't in the dictionary before,
- clear its pointer. (Conservative, but rare.)
- undef - if the key is a name, clear its pointer. (Overly
- conservative, but rare.)
- restore - if either the old or the new value of a change is a name
- (possibly in a packed array), clear its pointer. This is
- conservative, but easy to detect, and probably not *too*
- conservative.
- .setmaxlength - clear all the pointers, like noaccess.
- (name lookup) - fetch the value through the pointer and dispatch
- on its type; if the type is t__invalid, do a full search
- and set the pointer. This avoids a separate check for a
- clear pointer in the usual case where the pointer is valid.
- load - if the pointer is clear, do a search and set the pointer;
- then fetch the value.
- where - always do a full search and set the pointer.
- (Conservative, but rare.)
-
-One place where shallow binding will result in major new overhead is the
-extra push of systemdict for loading fonts. This probably isn't a problem
-in real life.
-
-Adaptive shallow binding
-------------------------
-
-We do validity checking for the name value cache using an epoch counter.
-For each dictionary D, we keep an on-stack flag F. Each dictionary stack
-entry is <D,M,F,E> where D is the actual dictionary, M is a mark vector of
-V bits (V is a system constant, probably 64), F is D's former on-stack
-flag, and E is the epoch at which the entry was made. For each name K, we
-keep a cache <P,E> where P is a pointer to the dictionary value slot that
-holds the current value of K, and E is an epoch value; the cache is valid
-if K->E >= dsp->E. Here is what happens for each operation:
-
-****** Still need to handle names defined only in systemdict or userdict?
+ Notes on dictionary lookup performance
+ --------------------------------------
+
+ We mark heavily used operations with a * below; moderately heavily used
+ operations with a +.
+
+ The following operations change the dictionary stack:
+ +begin, +end
+ readonly (on a dictionary that is on the stack)
+ noaccess (on a dictionary that is on the stack)
+ We implement cleardictstack as a series of ends.
+
+ The following operations change the contents of dictionaries:
+ *def, +put
+ undef
+ restore
+ .setmaxlength
+ We implement store in PostScript, and copy as a series of puts. Many
+ other operators also do puts (e.g., ScaleMatrix in makefont,
+ Implementation in makepattern, ...). Note that put can do an implicit
+ .setmaxlength (if it has to grow the dictionary).
+
+ The following operations look up keys on the dictionary stack:
+ *(interpreter name lookup)
+ load
+ where
+
+ Current design
+ --------------
+
+ Each name has a pointer that has one of 3 states:
+ - This name has no definitions.
+ - This name has exactly one definition, in systemdict or userdict.
+ In this case, the pointer points to the value slot.
+ - This name has some other status.
+
+ We cache some pointers to the top dictionary on the stack if it is a
+ readable dictionary with packed keys, which allows us to do fast,
+ single-probe lookups in this dictionary. We also cache a value that
+ allows us to do a fast check for stores into the top dictionary
+ (writability + space check).
+
+ Full shallow binding
+ --------------------
+
+ We implement shallow binding with a pointer in each name that points to
+ the value slot that holds the name's definition. If the name is
+ undefined, or if we don't know where the slot is, the binding pointer
+ points to a ref with a special type t__invalid, which cannot occur
+ anywhere else. "Clearing" the pointer means setting it to point to this
+ ref.
+
+ We also maintain a pair of pointers that bracket the value region of the
+ top dictionary on the stack, for fast checking in def. If the top
+ dictionary is readonly or noaccess, the pointers designate an empty area.
+ We call this the "def region" cache.
+
+ We implement the above operations as follows:
+ begin - push the dictionary on the stack; set the pointers of
+ all name keys to point to the corresponding value slots.
+ end - pop the stack; clear the pointers of all name keys.
+ readonly - if the dictionary is the top one on the stack,
+ reset the def region cache.
+ noaccess - clear the pointers of all name keys. (This is overly
+ conservative, but this is a very rare operation.)
+ Also reset the def region cache if the dictionary is
+ the top one on the stack.
+ def - if the key is a name and its pointer points within the cached
+ def region, store the value through the pointer; otherwise,
+ look up the key in the top dictionary, store the value,
+ and if the key is a name, set its pointer to the value slot.
+ put - if the key is a name and wasn't in the dictionary before,
+ clear its pointer. (Conservative, but rare.)
+ undef - if the key is a name, clear its pointer. (Overly
+ conservative, but rare.)
+ restore - if either the old or the new value of a change is a name
+ (possibly in a packed array), clear its pointer. This is
+ conservative, but easy to detect, and probably not *too*
+ conservative.
+ .setmaxlength - clear all the pointers, like noaccess.
+ (name lookup) - fetch the value through the pointer and dispatch
+ on its type; if the type is t__invalid, do a full search
+ and set the pointer. This avoids a separate check for a
+ clear pointer in the usual case where the pointer is valid.
+ load - if the pointer is clear, do a search and set the pointer;
+ then fetch the value.
+ where - always do a full search and set the pointer.
+ (Conservative, but rare.)
+
+ One place where shallow binding will result in major new overhead is the
+ extra push of systemdict for loading fonts. This probably isn't a problem
+ in real life.
+
+ Adaptive shallow binding
+ ------------------------
+
+ We do validity checking for the name value cache using an epoch counter.
+ For each dictionary D, we keep an on-stack flag F. Each dictionary stack
+ entry is <D,M,F,E> where D is the actual dictionary, M is a mark vector of
+ V bits (V is a system constant, probably 64), F is D's former on-stack
+ flag, and E is the epoch at which the entry was made. For each name K, we
+ keep a cache <P,E> where P is a pointer to the dictionary value slot that
+ holds the current value of K, and E is an epoch value; the cache is valid
+ if K->E >= dsp->E. Here is what happens for each operation:
+
+ ****** Still need to handle names defined only in systemdict or userdict?
+
+ To initialize:
+ Epoch = 0
+ To clear the cache entry for K:
+ *K = <ptr to invalid value, 0>
+ begin(D):
+ *++dsp = <D, {0...}, D->F, ++Epoch>
+ set D->F
+ value = lookup(K):
+ if K->E >= dsp->E
+ value = *K->P
+ else
+ do lookup as usual
+ *K = <ptr to value, Epoch>
+ set dp->M[i mod V] where dp is the dstack slot of the dictionary
+ where K was found and i is the index within that dictionary
+ end:
+ for each i such that dsp->M[i] is set,
+ clear the cache entry for dsp->D->keys[i, i+V, ...]
+ dsp->D->F = dsp->F
+ --dsp
+ noaccess(D):
+ if D->F is set,
+ clear the cache entries for all name keys of D
+ readonly(D):
+ << nothing >>
+ .setmaxlength(D,N):
+ same as noaccess
+ restore:
+ If either the old or the new value of a change is a name
+ (possibly in a packed array), clear its cache entry. This is
+ conservative, but easy to detect, and probably not *too*
+ conservative.
+ def(K,V):
+ if K->P points into dsp->D
+ *K->P = V
+ else
+ put the new value in dsp->D
+ set *K and dsp->M[i mod V] as for a lookup
+ put(D,K,V):
+ if K is already defined in D, do nothing special
+ otherwise, if D->F isn't set, do nothing special
+ otherwise, clear K's cache entry
+ undef(D,K):
+ if D->F is set,
+ clear K's cache entry
+ */
-To initialize:
- Epoch = 0
-To clear the cache entry for K:
- *K = <ptr to invalid value, 0>
-begin(D):
- *++dsp = <D, {0...}, D->F, ++Epoch>
- set D->F
-value = lookup(K):
- if K->E >= dsp->E
- value = *K->P
- else
- do lookup as usual
- *K = <ptr to value, Epoch>
- set dp->M[i mod V] where dp is the dstack slot of the dictionary
- where K was found and i is the index within that dictionary
-end:
- for each i such that dsp->M[i] is set,
- clear the cache entry for dsp->D->keys[i, i+V, ...]
- dsp->D->F = dsp->F
- --dsp
-noaccess(D):
- if D->F is set,
- clear the cache entries for all name keys of D
-readonly(D):
- << nothing >>
-.setmaxlength(D,N):
- same as noaccess
-restore:
- If either the old or the new value of a change is a name
- (possibly in a packed array), clear its cache entry. This is
- conservative, but easy to detect, and probably not *too*
- conservative.
-def(K,V):
- if K->P points into dsp->D
- *K->P = V
- else
- put the new value in dsp->D
- set *K and dsp->M[i mod V] as for a lookup
-put(D,K,V):
- if K is already defined in D, do nothing special
- otherwise, if D->F isn't set, do nothing special
- otherwise, clear K's cache entry
-undef(D,K):
- if D->F is set,
- clear K's cache entry
-*/
+#endif /* dstack_INCLUDED */
diff --git a/gs/src/dvx-gcc.mak b/gs/src/dvx-gcc.mak
index d4bbd9b13..e9801153d 100755
--- a/gs/src/dvx-gcc.mak
+++ b/gs/src/dvx-gcc.mak
@@ -15,47 +15,13 @@
# License requires that the copyright notice and this notice be preserved on
# all copies.
-# Makefile fragment containing the current revision identification.
-
-# Define the name of this makefile.
-VERSION_MAK=version.mak
-
-# Major and minor version numbers.
-# MINOR0 is different from MINOR only if MINOR is a single digit.
-GS_VERSION_MAJOR=5
-GS_VERSION_MINOR=14
-GS_VERSION_MINOR0=14
-# Revision date: year x 10000 + month x 100 + day.
-GS_REVISIONDATE=19980616
-
-# Derived values
-GS_VERSION=$(GS_VERSION_MAJOR)$(GS_VERSION_MINOR0)
-GS_DOT_VERSION=$(GS_VERSION_MAJOR).$(GS_VERSION_MINOR)
-GS_REVISION=$(GS_VERSION)
-# Copyright (C) 1994, 1995, 1996, 1997 Aladdin Enterprises. All rights reserved.
-#
-# This file is part of Aladdin Ghostscript.
-#
-# Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
-# or distributor accepts any responsibility for the consequences of using it,
-# or for whether it serves any particular purpose or works at all, unless he
-# or she says so in writing. Refer to the Aladdin Ghostscript Free Public
-# License (the "License") for full details.
-#
-# Every copy of Aladdin Ghostscript must include a copy of the License,
-# normally in a plain ASCII text file named PUBLIC. The License grants you
-# the right to copy, modify and redistribute Aladdin Ghostscript, but only
-# under certain conditions described in the License. Among other things, the
-# License requires that the copyright notice and this notice be preserved on
-# all copies.
-
+# Id: dvx-gcc.mak
# makefile for DesqView/X/gcc/X11 configuration.
-# Note: this makefile assumes you are using gcc in ANSI mode.
-#****************************************************************#
-# If you want to change options, DO NOT edit dvx-gcc.mak #
-# or makefile. Edit dgc-head.mak and run the tar_cat script. #
-#****************************************************************#
+#include $(COMMONDIR)/gccdefs.mak
+#include $(COMMONDIR)/dvxdefs.mak
+#include $(COMMONDIR)/generic.mak
+include $(GLSRCDIR)/version.mak
# ------------------------------- Options ------------------------------- #
@@ -117,14 +83,34 @@ GENOPT=
GS=gs
+# Define the source, generated intermediate file, and object directories
+# for the graphics library (GL) and the PostScript/PDF interpreter (PS).
+
+GLSRCDIR=.
+GLGENDIR=.
+GLOBJDIR=.
+PSSRCDIR=.
+PSGENDIR=.
+PSOBJDIR=.
+
# Define the directory where the IJG JPEG library sources are stored,
# and the major version of the library that is stored there.
# You may need to change this if the IJG library version changes.
# See jpeg.mak for more information.
-JSRCDIR=jpeg-6a
+JSRCDIR=jpeg
JVERSION=6
+# Choose whether to use a shared version of the IJG JPEG library (-ljpeg).
+# DON'T DO THIS. If you do, the resulting executable will not be able to
+# read some PostScript files containing JPEG data, because Adobe chose to
+# define PostScript's JPEG capabilities in a way that is slightly
+# incompatible with the JPEG standard. See make.txt for more details.
+
+# DON'T SET THIS TO 1! See the comment just above.
+SHARE_JPEG=0
+JPEG_NAME=jpeg
+
# Define the directory where the PNG library sources are stored,
# and the version of the library that is stored there.
# You may need to change this if the libpng version changes.
@@ -147,6 +133,7 @@ ZSRCDIR=zlib
# See gs.mak and make.txt for more information.
SHARE_ZLIB=0
+ZLIB_NAME=gz
# Define the configuration ID. Read gs.mak carefully before changing this.
@@ -237,7 +224,7 @@ FPU_TYPE=1
# Choose the language feature(s) to include. See gs.mak for details.
-FEATURE_DEVS=level2.dev pdf.dev
+FEATURE_DEVS=psl3.dev pdf.dev
# Choose whether to compile the .ps initialization files into the executable.
# See gs.mak for details.
@@ -260,7 +247,8 @@ BAND_LIST_COMPRESSOR=zlib
FILE_IMPLEMENTATION=stdio
-# Choose the device(s) to include. See devs.mak for details.
+# Choose the device(s) to include. See devs.mak for details,
+# devs.mak and contrib.mak for the list of available devices.
DEVICE_DEVS=x11.dev
DEVICE_DEVS1=
@@ -277,14 +265,14 @@ DEVICE_DEVS11=tiff12nc.dev tiff24nc.dev
DEVICE_DEVS12=psmono.dev psgray.dev bit.dev bitrgb.dev bitcmyk.dev
DEVICE_DEVS13=
DEVICE_DEVS14=
-DEVICE_DEVS15=
+DEVICE_DEVS15=pdfwrite.dev
# ---------------------------- End of options --------------------------- #
# Define the name of the partial makefile that specifies options --
# used in dependencies.
-MAKEFILE=dgc-head.mak
+MAKEFILE=$(GLSRCDIR)/dvx-gcc.mak
# Define the ANSI-to-K&R dependency. (gcc accepts ANSI syntax.)
@@ -292,5406 +280,22 @@ AK=
# Define the compilation rules and flags.
-CCC=$(CC) $(CCFLAGS) -c
-CCLEAF=$(CCC) -fomit-frame-pointer
-
-# --------------------------- Generic makefile ---------------------------- #
-
-# The remainder of the makefile (unixhead.mak, gs.mak, devs.mak, unixtail.mak)
-# is generic. tar_cat concatenates all these together.
-# Copyright (C) 1994, 1996 Aladdin Enterprises. All rights reserved.
-#
-# This file is part of Aladdin Ghostscript.
-#
-# Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
-# or distributor accepts any responsibility for the consequences of using it,
-# or for whether it serves any particular purpose or works at all, unless he
-# or she says so in writing. Refer to the Aladdin Ghostscript Free Public
-# License (the "License") for full details.
-#
-# Every copy of Aladdin Ghostscript must include a copy of the License,
-# normally in a plain ASCII text file named PUBLIC. The License grants you
-# the right to copy, modify and redistribute Aladdin Ghostscript, but only
-# under certain conditions described in the License. Among other things, the
-# License requires that the copyright notice and this notice be preserved on
-# all copies.
-
-# Partial makefile, common to all Desqview/X configurations.
-
-# This part of the makefile gets inserted after the compiler-specific part
-# (xxx-head.mak) and before gs.mak and devs.mak.
-
-# ----------------------------- Generic stuff ----------------------------- #
-
-# Define the platform name.
-
-PLATFORM=dvx_
-
-# Define the syntax for command, object, and executable files.
-
-CMD=.bat
-O=-o ./
-OBJ=o
-XE=.exe
-XEAUX=.exe
-
-# Define the current directory prefix and command invocations.
-
-CAT=type
-D=\\
-EXP=
-SHELL=
-SH=
-SHP=
-
-# Define generic commands.
-
-CP_=cp
-RM_=rm -f
-
-# Define the arguments for genconf.
-
-CONFILES=-p -pl &-l%%s -ol ld.tr
-
-# Define the compilation rules and flags.
-
CCFLAGS=$(GENOPT) $(CFLAGS)
-
-.c.o: $(AK)
- $(CCC) $*.c
-
-CCCF=$(CCC)
-CCD=$(CCC)
-CCINT=$(CCC)
-
-# Patch a couple of PC-specific things that aren't relevant to DV/X builds,
-# but that cause `make' to produce warnings.
-
-BGIDIR=***UNUSED***
-PCFBASM=
-# Copyright (C) 1989, 1996, 1997 Aladdin Enterprises. All rights reserved.
-#
-# This file is part of Aladdin Ghostscript.
-#
-# Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
-# or distributor accepts any responsibility for the consequences of using it,
-# or for whether it serves any particular purpose or works at all, unless he
-# or she says so in writing. Refer to the Aladdin Ghostscript Free Public
-# License (the "License") for full details.
-#
-# Every copy of Aladdin Ghostscript must include a copy of the License,
-# normally in a plain ASCII text file named PUBLIC. The License grants you
-# the right to copy, modify and redistribute Aladdin Ghostscript, but only
-# under certain conditions described in the License. Among other things, the
-# License requires that the copyright notice and this notice be preserved on
-# all copies.
-
-# Generic makefile, common to all platforms.
-# The platform-specific makefiles `include' this file.
-# They define the following symbols:
-# GS - the name of the executable (without the extension, if any).
-# GS_LIB_DEFAULT - the default directory/ies for searching for the
-# initialization and font files at run time.
-# SEARCH_HERE_FIRST - the default setting of -P (whether or not to
-# look for files in the current directory first).
-# GS_DOCDIR - the directory where documentation will be available
-# at run time.
-# JSRCDIR - the directory where the IJG JPEG library source code
-# is stored (at compilation time).
-# JVERSION - the major version number of the IJG JPEG library.
-# PSRCDIR, PVERSION - the same for libpng.
-# ZSRCDIR - the same for zlib.
-# SHARE_LIBPNG - normally 0; if set to 1, asks the linker to use
-# an existing compiled libpng (-lpng) instead of compiling and
-# linking libpng explicitly.
-# LIBPNG_NAME, the name of the shared libpng, currently always
-# png (libpng, -lpng).
-# SHARE_ZLIB - normally 0; if set to 1, asks the linker to use
-# an existing compiled zlib (-lgz or -lz) instead of compiling
-# and linking libgz/libz explicitly.
-# ZLIB_NAME - the name of the shared zlib, either gz (for libgz, -lgz)
-# or z (for libz, -lz).
-# CONFIG - a configuration ID, added at the request of a customer,
-# that is supposed to help in maintaining multiple variants in
-# a single directory. Normally this is an empty string;
-# it may be any string that is legal as part of a file name.
-# DEVICE_DEVS - the devices to include in the executable.
-# See devs.mak for details.
-# DEVICE_DEVS1...DEVICE_DEVS15 - additional devices, if the definition
-# of DEVICE_DEVS doesn't fit on one line. See devs.mak for details.
-# FEATURE_DEVS - what features to include in the executable.
-# Normally this is one of:
-# level1 - a standard PostScript Level 1 language
-# interpreter.
-# level2 - a standard PostScript Level 2 language
-# interpreter.
-# pdf - a PDF-capable interpreter.
-# You may include both level1 and pdf, or both level2 and pdf.
-# The following feature may be added to either of the standard
-# configurations:
-# ccfonts - precompile fonts into C, and link them
-# with the executable. See fonts.txt for details.
-# The remaining features are of interest primarily to developers
-# who want to "mix and match" features to create custom
-# configurations:
-# dps - (partial) support for Display PostScript extensions:
-# see language.txt for details.
-# btoken - support for binary token encodings.
-# Included automatically in the dps and level2 features.
-# cidfont - (currently partial) support for CID-keyed fonts.
-# color - support for the Level 1 CMYK color extensions.
-# Included automatically in the dps and level2 features.
-# compfont - support for composite (type 0) fonts.
-# Included automatically in the level2 feature.
-# dct - support for DCTEncode/Decode filters.
-# Included automatically in the level2 feature.
-# epsf - support for recognizing and skipping the binary
-# header of MS-DOS EPSF files.
-# filter - support for Level 2 filters (other than eexec,
-# ASCIIHexEncode/Decode, NullEncode, PFBDecode,
-# RunLengthEncode/Decode, and SubFileDecode, which are
-# always included, and DCTEncode/Decode,
-# which are separate).
-# Included automatically in the level2 feature.
-# fzlib - support for zlibEncode/Decode filters.
-# ttfont - support for TrueType fonts.
-# type1 - support for Type 1 fonts and eexec;
-# normally included automatically in all configurations.
-# type42 - support for Type 42 (embedded TrueType) fonts.
-# Included automatically in the level2 feature.
-# There are quite a number of other sub-features that can be
-# selectively included in or excluded from a configuration,
-# but the above are the ones that are most likely to be of
-# interest.
-# COMPILE_INITS - normally 0; if set to 1, compiles the PostScript
-# language initialization files (gs_init.ps et al) into the
-# executable, eliminating the need for these files to be present
-# at run time.
-# BAND_LIST_STORAGE - normally file; if set to memory, stores band
-# lists in memory (with compression if needed).
-# BAND_LIST_COMPRESSOR - normally zlib: selects the compression method
-# to use for band lists in memory.
-# FILE_IMPLEMENTATION - normally stdio; if set to fd, uses file
-# descriptors instead of buffered stdio for file I/O; if set to
-# both, provides both implementations with different procedure
-# names for the fd-based implementation (see sfxfd.c for
-# more information).
-# EXTEND_NAMES - a value N between 0 and 6, indicating that the name
-# table should have a capacity of 2^(16+N) names. This normally
-# should be set to 0 (or left undefined), since non-zero values
-# result in a larger fixed space overhead and slightly slower code.
-# EXTEND_NAMES is ignored in 16-bit environments.
-#
-# It is very unlikely that anyone would want to edit the remaining
-# symbols, but we describe them here for completeness:
-# GS_INIT - the name of the initialization file for the interpreter,
-# normally gs_init.ps.
-# PLATFORM - a "device" name for the platform, so that platforms can
-# add various kinds of resources like devices and features.
-# CMD - the suffix for shell command files (e.g., null or .bat).
-# (This is only needed in a few places.)
-# D - the directory separator character (\ for MS-DOS, / for Unix).
-# O - the string for specifying the output file from the C compiler
-# (-o for MS-DOS, -o ./ for Unix).
-# OBJ - the extension for relocatable object files (e.g., o or obj).
-# XE - the extension for executable files (e.g., null or .exe).
-# XEAUX - the extension for the executable files (e.g., null or .exe)
-# for the utility programs (ansi2knr and those compiled with
-# CCAUX).
-# BEGINFILES - the list of files that `make begin' and `make clean'
-# should delete.
-# CCA2K - the C invocation for the ansi2knr program, which is the only
-# one that doesn't use ANSI C syntax. (It is only needed if
-# the main C compiler also isn't an ANSI compiler.)
-# CCAUX - the C invocation for auxiliary programs (echogs, genarch,
-# genconf, geninit).
-# CCBEGIN - the compilation command for `make begin', normally
-# $(CCC) *.c.
-# CCC - the C invocation for normal compilation.
-# CCD - the C invocation for files that store into frame buffers or
-# device registers. Needed because some optimizing compilers
-# will eliminate necessary stores.
-# CCCF - the C invocation for compiled fonts and other large,
-# self-contained data modules. Needed because MS-DOS
-# requires using the 'huge' memory model for these.
-# CCINT - the C invocation for compiling the main interpreter module,
-# normally the same as CCC: this is needed because the
-# Borland compiler generates *worse* code for this module
-# (but only this module) when optimization (-O) is turned on.
-# CCLEAF - the C invocation for compiling modules that contain only
-# leaf procedures, which don't need to build stack frames.
-# This is needed only because many compilers aren't able to
-# recognize leaf procedures on their own.
-# AK - if source files must be converted from ANSI to K&R syntax,
-# this is $(ANSI2KNR_XE); if not, it is null.
-# If a particular platform requires other utility programs
-# to be built, AK must include them too.
-# SHP - the prefix for invoking a shell script in the current directory
-# (null for MS-DOS, $(SH) ./ for Unix).
-# EXPP, EXP - the prefix for invoking an executable program in the
-# current directory (null for MS-DOS, ./ for Unix).
-# SH - the shell for scripts (null on MS-DOS, sh on Unix).
-# CONFILES - the arguments for genconf to generate the appropriate
-# linker control files (various).
-# CP_ - the command for copying one file to another. Because of
-# limitations in the MS-DOS/MS Windows environment, the
-# second argument must either be '.' (in which case the
-# write date may be either preserved or set to the current
-# date) or a file name (in which case the write date is
-# always updated).
-# RM_ - the command for deleting (a) file(s) (including wild cards,
-# but limited to a single file or pattern).
-# RMN_ = the command for deleting multiple files / patterns.
-#
-# The platform-specific makefiles must also include rules for creating
-# certain dynamically generated files:
-# gconfig_.h - this indicates the presence or absence of
-# certain system header files that are located in different
-# places on different systems. (It could be generated by
-# the GNU `configure' program.)
-# gconfigv.h - this indicates the status of certain machine-
-# and configuration-specific features derived from definitions
-# in the platform-specific makefile.
-
-# Define the name of this makefile.
-GS_MAK=gs.mak
-
-# Define the names of the executables.
-GS_XE=$(GS)$(XE)
-ANSI2KNR_XE=ansi2knr$(XEAUX)
-ECHOGS_XE=echogs$(XEAUX)
-GENARCH_XE=genarch$(XEAUX)
-GENCONF_XE=genconf$(XEAUX)
-GENINIT_XE=geninit$(XEAUX)
-
-# Define the names of the CONFIG-dependent header files.
-# gconfig*.h and gconfx*.h are generated dynamically.
-gconfig_h=gconfxx$(CONFIG).h
-gconfigf_h=gconfxc$(CONFIG).h
-
-# Watcom make insists that rules have a non-empty body!
-all default: $(GS_XE)
- $(RM_) _temp_*
-
-distclean maintainer-clean realclean: clean
- $(RM_) makefile
-
-clean: mostlyclean
- $(RM_) arch.h
- $(RM_) $(GS_XE)
-
-mostlyclean:
- $(RMN_) *.$(OBJ) *.a core gmon.out
- $(RMN_) *.dev *.d_* devs*.tr gconfig*.h gconfx*.h j*.h o*.tr l*.tr
- $(RMN_) deflate.h zutil.h
- $(RMN_) gconfig*.c gscdefs*.c iconfig*.c
- $(RMN_) _temp_* _temp_*.* *.map *.sym
- $(RMN_) $(ANSI2KNR_XE) $(ECHOGS_XE) $(GENARCH_XE) $(GENCONF_XE) $(GENINIT_XE)
- $(RMN_) gs_init.c $(BEGINFILES)
-
-# Remove only configuration-dependent information.
-config-clean:
- $(RMN_) *.dev devs*.tr gconfig*.h gconfx*.h o*.tr l*.tr
-
-# A rule to do a quick and dirty compilation attempt when first installing
-# the interpreter. Many of the compilations will fail:
-# follow this with 'make'.
-
-begin:
- $(RMN_) arch.h gconfig*.h gconfx*.h $(GENARCH_XE) $(GS_XE)
- $(RMN_) gconfig*.c gscdefs*.c iconfig*.c
- $(RMN_) gs_init.c $(BEGINFILES)
- make arch.h gconfigv.h
- - $(CCBEGIN)
- $(RMN_) gconfig.$(OBJ) gdev*.$(OBJ) gp_*.$(OBJ) gscdefs.$(OBJ) gsmisc.$(OBJ)
- $(RMN_) icfontab.$(OBJ) iconfig.$(OBJ) iinit.$(OBJ) interp.$(OBJ)
-
-# Auxiliary programs
-
-arch.h: $(GENARCH_XE)
- $(EXPP) $(EXP)genarch arch.h
-
-# Macros for constructing the *.dev files that describe features and
-# devices.
-SETDEV=$(EXP)echogs -e .dev -w- -l-dev -F -s -l-obj
-SETPDEV=$(EXP)echogs -e .dev -w- -l-dev -F -s -l-include -lpage -l-obj
-SETMOD=$(EXP)echogs -e .dev -w- -l-obj
-ADDMOD=$(EXP)echogs -e .dev -a-
-
-# Define the compilation commands for the third-party libraries.
-CCCP=$(CCC) -I$(PSRCDIR) -I$(ZSRCDIR) -DPNG_USE_CONST
-CCCJ=$(CCC) -I. -I$(JSRCDIR)
-CCCZ=$(CCC) -I. -I$(ZSRCDIR)
-
-######################## How to define new 'features' #######################
-#
-# One defines new 'features' exactly like devices (see devs.mak for details).
-# For example, one would define a feature abc by adding the following to
-# gs.mak:
-#
-# abc_=abc1.$(OBJ) ...
-# abc.dev: $(GS_MAK) $(ECHOGS_XE) $(abc_)
-# $(SETMOD) abc $(abc_)
-# $(ADDMOD) abc -obj ... [if needed]
-# $(ADDMOD) abc -oper ... [if appropriate]
-# $(ADDMOD) abc -ps ... [if appropriate]
-#
-# If the abc feature requires the presence of some other features jkl and
-# pqr, then the rules must look like this:
-#
-# abc_=abc1.$(OBJ) ...
-# abc.dev: $(GS_MAK) $(ECHOGS_XE) $(abc_) jkl.dev pqr.dev
-# $(SETMOD) abc $(abc_)
-# ...
-# $(ADDMOD) abc -include jkl pqr
-
-# --------------------- Configuration-dependent files --------------------- #
-
-# gconfig.h shouldn't have to depend on DEVS_ALL, but that would
-# involve rewriting gsconfig to only save the device name, not the
-# contents of the <device>.dev files.
-# FEATURE_DEVS must precede DEVICE_DEVS so that devices can override
-# features in obscure cases.
-
-DEVS_ALL=$(PLATFORM).dev $(FEATURE_DEVS) \
- $(DEVICE_DEVS) $(DEVICE_DEVS1) \
- $(DEVICE_DEVS2) $(DEVICE_DEVS3) $(DEVICE_DEVS4) $(DEVICE_DEVS5) \
- $(DEVICE_DEVS6) $(DEVICE_DEVS7) $(DEVICE_DEVS8) $(DEVICE_DEVS9) \
- $(DEVICE_DEVS10) $(DEVICE_DEVS11) $(DEVICE_DEVS12) $(DEVICE_DEVS13) \
- $(DEVICE_DEVS14) $(DEVICE_DEVS15)
-
-devs_tr=devs.tr$(CONFIG)
-$(devs_tr): $(GS_MAK) $(MAKEFILE) $(ECHOGS_XE)
- $(EXP)echogs -w $(devs_tr) - -include $(PLATFORM).dev
- $(EXP)echogs -a $(devs_tr) - $(FEATURE_DEVS)
- $(EXP)echogs -a $(devs_tr) - $(DEVICE_DEVS)
- $(EXP)echogs -a $(devs_tr) - $(DEVICE_DEVS1)
- $(EXP)echogs -a $(devs_tr) - $(DEVICE_DEVS2)
- $(EXP)echogs -a $(devs_tr) - $(DEVICE_DEVS3)
- $(EXP)echogs -a $(devs_tr) - $(DEVICE_DEVS4)
- $(EXP)echogs -a $(devs_tr) - $(DEVICE_DEVS5)
- $(EXP)echogs -a $(devs_tr) - $(DEVICE_DEVS6)
- $(EXP)echogs -a $(devs_tr) - $(DEVICE_DEVS7)
- $(EXP)echogs -a $(devs_tr) - $(DEVICE_DEVS8)
- $(EXP)echogs -a $(devs_tr) - $(DEVICE_DEVS9)
- $(EXP)echogs -a $(devs_tr) - $(DEVICE_DEVS10)
- $(EXP)echogs -a $(devs_tr) - $(DEVICE_DEVS11)
- $(EXP)echogs -a $(devs_tr) - $(DEVICE_DEVS12)
- $(EXP)echogs -a $(devs_tr) - $(DEVICE_DEVS13)
- $(EXP)echogs -a $(devs_tr) - $(DEVICE_DEVS14)
- $(EXP)echogs -a $(devs_tr) - $(DEVICE_DEVS15)
-
-# GCONFIG_EXTRAS can be set on the command line.
-# Note that it consists of arguments for echogs, i.e.,
-# it isn't just literal text.
-GCONFIG_EXTRAS=
-
-ld_tr=ld$(CONFIG).tr
-$(gconfig_h) $(ld_tr) lib.tr: \
- $(GS_MAK) $(MAKEFILE) version.mak $(GENCONF_XE) $(ECHOGS_XE) $(devs_tr) $(DEVS_ALL) libcore.dev
- $(EXP)genconf $(devs_tr) libcore.dev -h $(gconfig_h) $(CONFILES)
- $(EXP)echogs -a $(gconfig_h) -x 23 define -s -u GS_LIB_DEFAULT -x 2022 $(GS_LIB_DEFAULT) -x 22
- $(EXP)echogs -a $(gconfig_h) -x 23 define -s -u SEARCH_HERE_FIRST -s $(SEARCH_HERE_FIRST)
- $(EXP)echogs -a $(gconfig_h) -x 23 define -s -u GS_DOCDIR -x 2022 $(GS_DOCDIR) -x 22
- $(EXP)echogs -a $(gconfig_h) -x 23 define -s -u GS_INIT -x 2022 $(GS_INIT) -x 22
- $(EXP)echogs -a $(gconfig_h) -x 23 define -s -u GS_REVISION -s $(GS_REVISION)
- $(EXP)echogs -a $(gconfig_h) -x 23 define -s -u GS_REVISIONDATE -s $(GS_REVISIONDATE)
- $(EXP)echogs -a $(gconfig_h) $(GCONFIG_EXTRAS)
-
-################################################################
-# The other platform-independent makefiles are concatenated
-# (or included) after this one:
-# lib.mak
-# int.mak
-# jpeg.mak
-# libpng.mak
-# zlib.mak
-# devs.mak
-################################################################
-# Copyright (C) 1995, 1996, 1997, 1998 Aladdin Enterprises. All rights reserved.
-#
-# This file is part of Aladdin Ghostscript.
-#
-# Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
-# or distributor accepts any responsibility for the consequences of using it,
-# or for whether it serves any particular purpose or works at all, unless he
-# or she says so in writing. Refer to the Aladdin Ghostscript Free Public
-# License (the "License") for full details.
-#
-# Every copy of Aladdin Ghostscript must include a copy of the License,
-# normally in a plain ASCII text file named PUBLIC. The License grants you
-# the right to copy, modify and redistribute Aladdin Ghostscript, but only
-# under certain conditions described in the License. Among other things, the
-# License requires that the copyright notice and this notice be preserved on
-# all copies.
-
-# (Platform-independent) makefile for graphics library and other support code.
-# See the end of gs.mak for where this fits into the build process.
-
-# Define the name of this makefile.
-LIB_MAK=lib.mak
-
-# Define the inter-dependencies of the .h files.
-# Since not all versions of `make' defer expansion of macros,
-# we must list these in bottom-to-top order.
-
-# Generic files
-
-arch_h=arch.h
-stdpre_h=stdpre.h
-std_h=std.h $(arch_h) $(stdpre_h)
-
-# Platform interfaces
-
-gp_h=gp.h
-gpcheck_h=gpcheck.h
-gpsync_h=gpsync.h
-
-# Configuration definitions
-
-# gconfig*.h are generated dynamically.
-gconfig__h=gconfig_.h
-gconfigv_h=gconfigv.h
-gscdefs_h=gscdefs.h
-
-# C library interfaces
-
-# Because of variations in the "standard" header files between systems, and
-# because we must include std.h before any file that includes sys/types.h,
-# we define local include files named *_.h to substitute for <*.h>.
-
-vmsmath_h=vmsmath.h
-
-dos__h=dos_.h
-ctype__h=ctype_.h $(std_h)
-dirent__h=dirent_.h $(std_h) $(gconfig__h)
-errno__h=errno_.h $(std_h)
-malloc__h=malloc_.h $(std_h)
-math__h=math_.h $(std_h) $(vmsmath_h)
-memory__h=memory_.h $(std_h)
-stat__h=stat_.h $(std_h)
-stdio__h=stdio_.h $(std_h)
-string__h=string_.h $(std_h)
-time__h=time_.h $(std_h) $(gconfig__h)
-windows__h=windows_.h
-
-# Miscellaneous
-
-gdebug_h=gdebug.h
-gsalloc_h=gsalloc.h
-gsargs_h=gsargs.h
-gserror_h=gserror.h
-gserrors_h=gserrors.h
-gsexit_h=gsexit.h
-gsgc_h=gsgc.h
-gsio_h=gsio.h
-gsmdebug_h=gsmdebug.h
-gsmemraw_h=gsmemraw.h
-gsmemory_h=gsmemory.h $(gsmemraw_h)
-gsrefct_h=gsrefct.h
-gsstruct_h=gsstruct.h
-gstypes_h=gstypes.h
-gx_h=gx.h $(stdio__h) $(gdebug_h) $(gserror_h) $(gsio_h) $(gsmemory_h) $(gstypes_h)
-
-GX=$(AK) $(gx_h)
-GXERR=$(GX) $(gserrors_h)
-
-###### Support
-
-### Include files
-
-gsbitmap_h=gsbitmap.h $(gsstruct_h)
-gsbitops_h=gsbitops.h
-gsbittab_h=gsbittab.h
-gsflip_h=gsflip.h
-gsuid_h=gsuid.h
-gsutil_h=gsutil.h
-gxarith_h=gxarith.h
-gxbitmap_h=gxbitmap.h $(gsbitmap_h) $(gstypes_h)
-gxfarith_h=gxfarith.h $(gconfigv_h) $(gxarith_h)
-gxfixed_h=gxfixed.h
-gxobj_h=gxobj.h $(gxbitmap_h)
-# Out of order
-gxalloc_h=gxalloc.h $(gsalloc_h) $(gxobj_h)
-
-### Executable code
-
-gsalloc.$(OBJ): gsalloc.c $(GX) $(memory__h) $(string__h) \
- $(gsmdebug_h) $(gsstruct_h) $(gxalloc_h)
-
-gsargs.$(OBJ): gsargs.c $(ctype__h) $(stdio__h) $(string__h)\
- $(gsargs_h) $(gsexit_h) $(gsmemory_h)
-
-gsbitops.$(OBJ): gsbitops.c $(AK) $(memory__h) $(stdio__h)\
- $(gdebug_h) $(gsbitops_h) $(gstypes_h)
-
-gsbittab.$(OBJ): gsbittab.c $(AK) $(stdpre_h) $(gsbittab_h)
-
-# gsfemu is only used in FPU-less configurations, and currently only with gcc.
-# We thought using CCLEAF would produce smaller code, but it actually
-# produces larger code!
-gsfemu.$(OBJ): gsfemu.c $(AK) $(std_h)
-
-# gsflip is not part of the standard configuration: it's rather large,
-# and no standard facility requires it.
-gsflip.$(OBJ): gsflip.c $(GX) $(gsbittab_h) $(gsflip_h)
- $(CCLEAF) gsflip.c
-
-gsmemory.$(OBJ): gsmemory.c $(GX) $(malloc__h) $(memory__h) \
- $(gsmdebug_h) $(gsrefct_h) $(gsstruct_h) $(gsmemraw_h)
-
-gsmisc.$(OBJ): gsmisc.c $(GXERR) $(gconfigv_h) \
- $(malloc__h) $(math__h) $(memory__h) $(gpcheck_h) $(gxfarith_h) $(gxfixed_h)
-
-# gsnogc currently is only used in library-only configurations.
-gsnogc.$(OBJ): gsnogc.c $(GX)\
- $(gsgc_h) $(gsmdebug_h) $(gsstruct_h) $(gxalloc_h)
-
-gsutil.$(OBJ): gsutil.c $(AK) $(memory__h) $(string__h) $(gconfigv_h)\
- $(gstypes_h) $(gsuid_h) $(gsutil_h)
-
-###### Low-level facilities and utilities
-
-### Include files
-
-gdevbbox_h=gdevbbox.h
-gdevmem_h=gdevmem.h $(gsbitops_h)
-gdevmrop_h=gdevmrop.h
-
-gsccode_h=gsccode.h
-gsccolor_h=gsccolor.h $(gsstruct_h)
-gscsel_h=gscsel.h
-gscolor1_h=gscolor1.h
-gscoord_h=gscoord.h
-gscpm_h=gscpm.h
-gsdevice_h=gsdevice.h
-gsfcmap_h=gsfcmap.h $(gsccode_h)
-gsfont_h=gsfont.h
-gshsb_h=gshsb.h
-gsht_h=gsht.h
-gsht1_h=gsht1.h $(gsht_h)
-gsiparam_h=gsiparam.h
-gsjconf_h=gsjconf.h $(std_h)
-gslib_h=gslib.h
-gslparam_h=gslparam.h
-gsmatrix_h=gsmatrix.h
-gspaint_h=gspaint.h
-gsparam_h=gsparam.h
-gsparams_h=gsparams.h $(gsparam_h)
-gspath2_h=gspath2.h
-gspenum_h=gspenum.h
-gsropt_h=gsropt.h
-gsxfont_h=gsxfont.h
-# Out of order
-gschar_h=gschar.h $(gsccode_h) $(gscpm_h)
-gscolor2_h=gscolor2.h $(gsccolor_h) $(gsuid_h) $(gxbitmap_h)
-gsimage_h=gsimage.h $(gsiparam_h)
-gsline_h=gsline.h $(gslparam_h)
-gspath_h=gspath.h $(gspenum_h)
-gsrop_h=gsrop.h $(gsropt_h)
-
-gxbcache_h=gxbcache.h $(gxbitmap_h)
-gxchar_h=gxchar.h $(gschar_h)
-gxcindex_h=gxcindex.h
-gxcvalue_h=gxcvalue.h
-gxclio_h=gxclio.h
-gxclip2_h=gxclip2.h
-gxcolor2_h=gxcolor2.h $(gscolor2_h) $(gsrefct_h) $(gxbitmap_h)
-gxcoord_h=gxcoord.h $(gscoord_h)
-gxcpath_h=gxcpath.h
-gxdda_h=gxdda.h
-gxdevrop_h=gxdevrop.h
-gxdevmem_h=gxdevmem.h
-gxdither_h=gxdither.h
-gxfcmap_h=gxfcmap.h $(gsfcmap_h) $(gsuid_h)
-gxfont0_h=gxfont0.h
-gxfrac_h=gxfrac.h
-gxftype_h=gxftype.h
-gxhttile_h=gxhttile.h
-gxhttype_h=gxhttype.h
-gxiodev_h=gxiodev.h $(stat__h)
-gxline_h=gxline.h $(gslparam_h)
-gxlum_h=gxlum.h
-gxmatrix_h=gxmatrix.h $(gsmatrix_h)
-gxpaint_h=gxpaint.h
-gxpath_h=gxpath.h $(gscpm_h) $(gslparam_h) $(gspenum_h)
-gxpcache_h=gxpcache.h
-gxpcolor_h=gxpcolor.h $(gxpcache_h)
-gxsample_h=gxsample.h
-gxstate_h=gxstate.h
-gxtmap_h=gxtmap.h
-gxxfont_h=gxxfont.h $(gsccode_h) $(gsmatrix_h) $(gsuid_h) $(gsxfont_h)
-# The following are out of order because they include other files.
-gsdcolor_h=gsdcolor.h $(gsccolor_h) $(gxarith_h) $(gxbitmap_h) $(gxcindex_h) $(gxhttile_h)
-gxdcolor_h=gxdcolor.h $(gscsel_h) $(gsdcolor_h) $(gsropt_h) $(gsstruct_h)
-gxdevice_h=gxdevice.h $(stdio__h) $(gsdcolor_h) $(gsiparam_h) $(gsmatrix_h) \
- $(gsropt_h) $(gsstruct_h) $(gsxfont_h) \
- $(gxbitmap_h) $(gxcindex_h) $(gxcvalue_h) $(gxfixed_h)
-gxdht_h=gxdht.h $(gsrefct_h) $(gxarith_h) $(gxhttype_h)
-gxctable_h=gxctable.h $(gxfixed_h) $(gxfrac_h)
-gxfcache_h=gxfcache.h $(gsuid_h) $(gsxfont_h) $(gxbcache_h) $(gxftype_h)
-gxfont_h=gxfont.h $(gsfont_h) $(gsuid_h) $(gsstruct_h) $(gxftype_h)
-gscie_h=gscie.h $(gsrefct_h) $(gxctable_h)
-gscsepr_h=gscsepr.h
-gscspace_h=gscspace.h
-gxdcconv_h=gxdcconv.h $(gxfrac_h)
-gxfmap_h=gxfmap.h $(gsrefct_h) $(gxfrac_h) $(gxtmap_h)
-gxistate_h=gxistate.h $(gscsel_h) $(gsropt_h) $(gxcvalue_h) $(gxfixed_h) $(gxline_h) $(gxmatrix_h) $(gxtmap_h)
-gxband_h=gxband.h $(gxclio_h)
-gxclist_h=gxclist.h $(gscspace_h) $(gxbcache_h) $(gxclio_h) $(gxistate_h) $(gxband_h)
-gxcmap_h=gxcmap.h $(gscsel_h) $(gxcvalue_h) $(gxfmap_h)
-gxcspace_h=gxcspace.h $(gscspace_h) $(gsccolor_h) $(gscsel_h) $(gsstruct_h) $(gxfrac_h)
-gxht_h=gxht.h $(gsht1_h) $(gsrefct_h) $(gxhttype_h) $(gxtmap_h)
-gscolor_h=gscolor.h $(gxtmap_h)
-gsstate_h=gsstate.h $(gscolor_h) $(gscsel_h) $(gsdevice_h) $(gsht_h) $(gsline_h)
-
-gzacpath_h=gzacpath.h
-gzcpath_h=gzcpath.h $(gxcpath_h)
-gzht_h=gzht.h $(gscsel_h) $(gxdht_h) $(gxfmap_h) $(gxht_h) $(gxhttile_h)
-gzline_h=gzline.h $(gxline_h)
-gzpath_h=gzpath.h $(gsstruct_h) $(gxpath_h)
-gzstate_h=gzstate.h $(gscpm_h) $(gsrefct_h) $(gsstate_h)\
- $(gxdcolor_h) $(gxistate_h) $(gxstate_h)
-
-gdevprn_h=gdevprn.h $(memory__h) $(string__h) $(gx_h) \
- $(gserrors_h) $(gsmatrix_h) $(gsparam_h) $(gsutil_h) \
- $(gxdevice_h) $(gxdevmem_h) $(gxclist_h)
-
-sa85x_h=sa85x.h
-sbtx_h=sbtx.h
-scanchar_h=scanchar.h
-scommon_h=scommon.h $(gsmemory_h) $(gstypes_h) $(gsstruct_h)
-sdct_h=sdct.h
-shc_h=shc.h $(gsbittab_h)
-siscale_h=siscale.h $(gconfigv_h)
-sjpeg_h=sjpeg.h
-slzwx_h=slzwx.h
-spcxx_h=spcxx.h
-spdiffx_h=spdiffx.h
-spngpx_h=spngpx.h
-srlx_h=srlx.h
-sstring_h=sstring.h
-strimpl_h=strimpl.h $(scommon_h) $(gstypes_h) $(gsstruct_h)
-szlibx_h=szlibx.h
-# Out of order
-scf_h=scf.h $(shc_h)
-scfx_h=scfx.h $(shc_h)
-gximage_h=gximage.h $(gsiparam_h) $(gxcspace_h) $(gxdda_h) $(gxsample_h)\
- $(siscale_h) $(strimpl_h)
-
-### Executable code
-
-# gconfig and gscdefs are handled specially. Currently they go in psbase
-# rather than in libcore, which is clearly wrong.
-gconfig=gconfig$(CONFIG)
-$(gconfig).$(OBJ): gconf.c $(GX) \
- $(gscdefs_h) $(gconfig_h) $(gxdevice_h) $(gxiodev_h) $(MAKEFILE)
- $(RM_) gconfig.h
- $(RM_) $(gconfig).c
- $(CP_) $(gconfig_h) gconfig.h
- $(CP_) gconf.c $(gconfig).c
- $(CCC) $(gconfig).c
- $(RM_) gconfig.h
- $(RM_) $(gconfig).c
-
-gscdefs=gscdefs$(CONFIG)
-$(gscdefs).$(OBJ): gscdef.c $(stdpre_h) $(gscdefs_h) $(gconfig_h) $(MAKEFILE)
- $(RM_) gconfig.h
- $(RM_) $(gscdefs).c
- $(CP_) $(gconfig_h) gconfig.h
- $(CP_) gscdef.c $(gscdefs).c
- $(CCC) $(gscdefs).c
- $(RM_) gconfig.h
- $(RM_) $(gscdefs).c
-
-gxacpath.$(OBJ): gxacpath.c $(GXERR) \
- $(gsdcolor_h) $(gsrop_h) $(gsstruct_h) $(gsutil_h) \
- $(gxdevice_h) $(gxfixed_h) $(gxpaint_h) \
- $(gzacpath_h) $(gzcpath_h) $(gzpath_h)
-
-gxbcache.$(OBJ): gxbcache.c $(GX) $(memory__h) \
- $(gsmdebug_h) $(gxbcache_h)
-
-gxccache.$(OBJ): gxccache.c $(GXERR) $(gpcheck_h) \
- $(gscspace_h) $(gsimage_h) $(gsstruct_h) \
- $(gxchar_h) $(gxdevice_h) $(gxdevmem_h) $(gxfcache_h) \
- $(gxfixed_h) $(gxfont_h) $(gxhttile_h) $(gxmatrix_h) $(gxxfont_h) \
- $(gzstate_h) $(gzpath_h) $(gzcpath_h)
-
-gxccman.$(OBJ): gxccman.c $(GXERR) $(memory__h) $(gpcheck_h)\
- $(gsbitops_h) $(gsstruct_h) $(gsutil_h) $(gxfixed_h) $(gxmatrix_h)\
- $(gxdevice_h) $(gxdevmem_h) $(gxfont_h) $(gxfcache_h) $(gxchar_h)\
- $(gxxfont_h) $(gzstate_h) $(gzpath_h)
-
-gxcht.$(OBJ): gxcht.c $(GXERR) $(memory__h)\
- $(gsutil_h)\
- $(gxcmap_h) $(gxdcolor_h) $(gxdevice_h) $(gxfixed_h) $(gxistate_h)\
- $(gxmatrix_h) $(gzht_h)
-
-gxcmap.$(OBJ): gxcmap.c $(GXERR) \
- $(gsccolor_h) \
- $(gxcmap_h) $(gxcspace_h) $(gxdcconv_h) $(gxdevice_h) $(gxdither_h) \
- $(gxfarith_h) $(gxfrac_h) $(gxlum_h) $(gzstate_h)
-
-gxcpath.$(OBJ): gxcpath.c $(GXERR)\
- $(gscoord_h) $(gsstruct_h) $(gsutil_h)\
- $(gxdevice_h) $(gxfixed_h) $(gzpath_h) $(gzcpath_h)
-
-gxdcconv.$(OBJ): gxdcconv.c $(GX) \
- $(gsdcolor_h) $(gxcmap_h) $(gxdcconv_h) $(gxdevice_h) \
- $(gxfarith_h) $(gxistate_h) $(gxlum_h)
-
-gxdcolor.$(OBJ): gxdcolor.c $(GX) \
- $(gsbittab_h) $(gxdcolor_h) $(gxdevice_h)
-
-gxdither.$(OBJ): gxdither.c $(GX) \
- $(gsstruct_h) $(gsdcolor_h) \
- $(gxcmap_h) $(gxdevice_h) $(gxdither_h) $(gxlum_h) $(gzht_h)
-
-gxfill.$(OBJ): gxfill.c $(GXERR) $(math__h) \
- $(gsstruct_h) \
- $(gxdcolor_h) $(gxdevice_h) $(gxfixed_h) $(gxhttile_h) \
- $(gxistate_h) $(gxpaint_h) \
- $(gzcpath_h) $(gzpath_h)
-
-gxht.$(OBJ): gxht.c $(GXERR) $(memory__h)\
- $(gsbitops_h) $(gsstruct_h) $(gsutil_h)\
- $(gxdcolor_h) $(gxdevice_h) $(gxfixed_h) $(gxistate_h) $(gzht_h)
-
-gximage.$(OBJ): gximage.c $(GXERR) $(math__h) $(memory__h) $(gpcheck_h)\
- $(gsccolor_h) $(gspaint_h) $(gsstruct_h)\
- $(gxfixed_h) $(gxfrac_h) $(gxarith_h) $(gxmatrix_h)\
- $(gxdevice_h) $(gzpath_h) $(gzstate_h)\
- $(gzcpath_h) $(gxdevmem_h) $(gximage_h) $(gdevmrop_h)
-
-gximage0.$(OBJ): gximage0.c $(GXERR) $(memory__h)\
- $(gxcpath_h) $(gxdevice_h) $(gximage_h)
-
-gximage1.$(OBJ): gximage1.c $(GXERR) $(memory__h) $(gpcheck_h)\
- $(gdevmem_h) $(gsbittab_h) $(gsccolor_h) $(gspaint_h) $(gsutil_h)\
- $(gxarith_h) $(gxcmap_h) $(gxcpath_h) $(gxdcolor_h) $(gxdevice_h)\
- $(gxdevmem_h) $(gxfixed_h) $(gximage_h) $(gxistate_h) $(gxmatrix_h)\
- $(gzht_h) $(gzpath_h)
-
-gximage2.$(OBJ): gximage2.c $(GXERR) $(memory__h) $(gpcheck_h)\
- $(gdevmem_h) $(gsccolor_h) $(gspaint_h) $(gsutil_h)\
- $(gxarith_h) $(gxcmap_h) $(gxcpath_h) $(gxdcolor_h) $(gxdevice_h)\
- $(gxdevmem_h) $(gxfixed_h) $(gximage_h) $(gxistate_h) $(gxmatrix_h)\
- $(gzht_h) $(gzpath_h)
-
-gxpaint.$(OBJ): gxpaint.c $(GX) \
- $(gxdevice_h) $(gxhttile_h) $(gxpaint_h) $(gxpath_h) $(gzstate_h)
-
-gxpath.$(OBJ): gxpath.c $(GXERR) \
- $(gsstruct_h) $(gxfixed_h) $(gzpath_h)
-
-gxpath2.$(OBJ): gxpath2.c $(GXERR) $(math__h) \
- $(gxfixed_h) $(gxarith_h) $(gzpath_h)
-
-gxpcopy.$(OBJ): gxpcopy.c $(GXERR) $(math__h) $(gconfigv_h) \
- $(gxfarith_h) $(gxfixed_h) $(gzpath_h)
-
-gxpdash.$(OBJ): gxpdash.c $(GX) $(math__h) \
- $(gscoord_h) $(gsline_h) $(gsmatrix_h) \
- $(gxfixed_h) $(gzline_h) $(gzpath_h)
-
-gxpflat.$(OBJ): gxpflat.c $(GX)\
- $(gxarith_h) $(gxfixed_h) $(gzpath_h)
-
-gxsample.$(OBJ): gxsample.c $(GX)\
- $(gxsample_h)
-
-gxstroke.$(OBJ): gxstroke.c $(GXERR) $(math__h) $(gpcheck_h) \
- $(gscoord_h) $(gsdcolor_h) $(gsdevice_h) \
- $(gxdevice_h) $(gxfarith_h) $(gxfixed_h) \
- $(gxhttile_h) $(gxistate_h) $(gxmatrix_h) $(gxpaint_h) \
- $(gzcpath_h) $(gzline_h) $(gzpath_h)
-
-###### Higher-level facilities
-
-gschar.$(OBJ): gschar.c $(GXERR) $(memory__h) $(string__h)\
- $(gspath_h) $(gsstruct_h) \
- $(gxfixed_h) $(gxarith_h) $(gxmatrix_h) $(gxcoord_h) $(gxdevice_h) $(gxdevmem_h) \
- $(gxfont_h) $(gxfont0_h) $(gxchar_h) $(gxfcache_h) $(gzpath_h) $(gzstate_h)
-
-gscolor.$(OBJ): gscolor.c $(GXERR) \
- $(gsccolor_h) $(gsstruct_h) $(gsutil_h) \
- $(gxcmap_h) $(gxcspace_h) $(gxdcconv_h) $(gxdevice_h) $(gzstate_h)
-
-gscoord.$(OBJ): gscoord.c $(GXERR) $(math__h) \
- $(gsccode_h) $(gxcoord_h) $(gxdevice_h) $(gxfarith_h) $(gxfixed_h) $(gxfont_h) \
- $(gxmatrix_h) $(gxpath_h) $(gzstate_h)
-
-gsdevice.$(OBJ): gsdevice.c $(GXERR) $(ctype__h) $(memory__h) $(string__h) $(gp_h)\
- $(gscdefs_h) $(gscoord_h) $(gsmatrix_h) $(gspaint_h) $(gspath_h) $(gsstruct_h)\
- $(gxcmap_h) $(gxdevice_h) $(gxdevmem_h) $(gzstate_h)
-
-gsdevmem.$(OBJ): gsdevmem.c $(GXERR) $(math__h) $(memory__h) \
- $(gxarith_h) $(gxdevice_h) $(gxdevmem_h)
-
-gsdparam.$(OBJ): gsdparam.c $(GXERR) $(memory__h) $(string__h) \
- $(gsparam_h) $(gxdevice_h) $(gxfixed_h)
-
-gsfont.$(OBJ): gsfont.c $(GXERR) $(memory__h)\
- $(gschar_h) $(gsstruct_h) \
- $(gxdevice_h) $(gxfixed_h) $(gxmatrix_h) $(gxfont_h) $(gxfcache_h)\
- $(gzstate_h)
-
-gsht.$(OBJ): gsht.c $(GXERR) $(memory__h)\
- $(gsstruct_h) $(gsutil_h) $(gxarith_h) $(gxdevice_h) $(gzht_h) $(gzstate_h)
-
-gshtscr.$(OBJ): gshtscr.c $(GXERR) $(math__h) \
- $(gsstruct_h) $(gxarith_h) $(gxdevice_h) $(gzht_h) $(gzstate_h)
-
-gsimage.$(OBJ): gsimage.c $(GXERR) $(memory__h)\
- $(gscspace_h) $(gsimage_h) $(gsmatrix_h) $(gsstruct_h) \
- $(gxarith_h) $(gxdevice_h) $(gzstate_h)
-
-gsimpath.$(OBJ): gsimpath.c $(GXERR) \
- $(gsmatrix_h) $(gsstate_h) $(gspath_h)
-
-gsinit.$(OBJ): gsinit.c $(memory__h) $(stdio__h) \
- $(gdebug_h) $(gp_h) $(gscdefs_h) $(gslib_h) $(gsmemory_h)
-
-gsiodev.$(OBJ): gsiodev.c $(GXERR) $(errno__h) $(string__h) \
- $(gp_h) $(gsparam_h) $(gxiodev_h)
-
-gsline.$(OBJ): gsline.c $(GXERR) $(math__h) $(memory__h)\
- $(gsline_h) $(gxfixed_h) $(gxmatrix_h) $(gzstate_h) $(gzline_h)
-
-gsmatrix.$(OBJ): gsmatrix.c $(GXERR) $(math__h) \
- $(gxfarith_h) $(gxfixed_h) $(gxmatrix_h)
-
-gspaint.$(OBJ): gspaint.c $(GXERR) $(math__h) $(gpcheck_h)\
- $(gspaint_h) $(gspath_h) $(gsropt_h)\
- $(gxcpath_h) $(gxdevmem_h) $(gxdevice_h) $(gxfixed_h) $(gxmatrix_h) $(gxpaint_h)\
- $(gzpath_h) $(gzstate_h)
-
-gsparam.$(OBJ): gsparam.c $(GXERR) $(memory__h) $(string__h)\
- $(gsparam_h) $(gsstruct_h)
-
-gsparams.$(OBJ): gsparams.c $(gx_h) $(memory__h) $(gserrors_h) $(gsparam_h)
-
-gspath.$(OBJ): gspath.c $(GXERR) \
- $(gscoord_h) $(gxdevice_h) $(gxfixed_h) $(gxmatrix_h) \
- $(gzcpath_h) $(gzpath_h) $(gzstate_h)
-
-gsstate.$(OBJ): gsstate.c $(GXERR) $(memory__h)\
- $(gscie_h) $(gscolor2_h) $(gscoord_h) $(gspath_h) $(gsstruct_h) $(gsutil_h) \
- $(gxcmap_h) $(gxcspace_h) $(gxdevice_h) $(gxpcache_h) \
- $(gzstate_h) $(gzht_h) $(gzline_h) $(gzpath_h) $(gzcpath_h)
-
-###### The internal devices
-
-### The built-in device implementations:
-
-# The bounding box device is not normally a free-standing device.
-# To configure it as one for testing, change SETMOD to SETDEV, and also
-# define TEST in gdevbbox.c.
-bbox.dev: $(LIB_MAK) $(ECHOGS_XE) gdevbbox.$(OBJ)
- $(SETMOD) bbox gdevbbox.$(OBJ)
-
-gdevbbox.$(OBJ): gdevbbox.c $(GXERR) $(math__h) $(memory__h) \
- $(gdevbbox_h) $(gsdevice_h) $(gsparam_h) \
- $(gxcpath_h) $(gxdevice_h) $(gxistate_h) $(gxpaint_h) $(gxpath_h)
-
-gdevddrw.$(OBJ): gdevddrw.c $(GXERR) $(math__h) $(gpcheck_h) \
- $(gxdcolor_h) $(gxdevice_h) $(gxfixed_h) $(gxmatrix_h)
-
-gdevdflt.$(OBJ): gdevdflt.c $(GXERR) $(gpcheck_h)\
- $(gsbittab_h) $(gsropt_h)\
- $(gxcpath_h) $(gxdcolor_h) $(gxdevice_h) $(gxdevmem_h)
-
-gdevnfwd.$(OBJ): gdevnfwd.c $(GX) \
- $(gxdevice_h)
-
-# The render/RGB device is only here as an example, but we can configure
-# it as a real device for testing.
-rrgb.dev: $(LIB_MAK) $(ECHOGS_XE) gdevrrgb.$(OBJ) page.dev
- $(SETPDEV) rrgb gdevrrgb.$(OBJ)
-
-gdevrrgb.$(OBJ): gdevrrgb.c $(AK)\
- $(gdevprn_h)
-
-### The memory devices:
-
-gdevabuf.$(OBJ): gdevabuf.c $(GXERR) $(memory__h)\
- $(gxdevice_h) $(gxdevmem_h) $(gdevmem_h)
-
-gdevmem.$(OBJ): gdevmem.c $(GXERR) $(memory__h)\
- $(gsstruct_h) $(gxdevice_h) $(gxdevmem_h) $(gdevmem_h)
-
-gdevm1.$(OBJ): gdevm1.c $(GX) $(memory__h) $(gsrop_h)\
- $(gxdevice_h) $(gxdevmem_h) $(gdevmem_h)
-
-gdevm2.$(OBJ): gdevm2.c $(GX) $(memory__h)\
- $(gxdevice_h) $(gxdevmem_h) $(gdevmem_h)
-
-gdevm4.$(OBJ): gdevm4.c $(GX) $(memory__h)\
- $(gxdevice_h) $(gxdevmem_h) $(gdevmem_h)
-
-gdevm8.$(OBJ): gdevm8.c $(GX) $(memory__h)\
- $(gxdevice_h) $(gxdevmem_h) $(gdevmem_h)
-
-gdevm16.$(OBJ): gdevm16.c $(GX) $(memory__h)\
- $(gxdevice_h) $(gxdevmem_h) $(gdevmem_h)
-
-gdevm24.$(OBJ): gdevm24.c $(GX) $(memory__h)\
- $(gxdevice_h) $(gxdevmem_h) $(gdevmem_h)
-
-gdevm32.$(OBJ): gdevm32.c $(GX) $(memory__h)\
- $(gxdevice_h) $(gxdevmem_h) $(gdevmem_h)
-
-gdevmpla.$(OBJ): gdevmpla.c $(GX) $(memory__h)\
- $(gxdevice_h) $(gxdevmem_h) $(gdevmem_h)
-
-# Create a pseudo-"feature" for the entire graphics library.
-
-LIB1s=gsalloc.$(OBJ) gsbitops.$(OBJ) gsbittab.$(OBJ)
-LIB2s=gschar.$(OBJ) gscolor.$(OBJ) gscoord.$(OBJ) gsdevice.$(OBJ) gsdevmem.$(OBJ)
-LIB3s=gsdparam.$(OBJ) gsfont.$(OBJ) gsht.$(OBJ) gshtscr.$(OBJ)
-LIB4s=gsimage.$(OBJ) gsimpath.$(OBJ) gsinit.$(OBJ) gsiodev.$(OBJ)
-LIB5s=gsline.$(OBJ) gsmatrix.$(OBJ) gsmemory.$(OBJ) gsmisc.$(OBJ)
-LIB6s=gspaint.$(OBJ) gsparam.$(OBJ) gsparams.$(OBJ) gspath.$(OBJ) gsstate.$(OBJ) gsutil.$(OBJ)
-LIB1x=gxacpath.$(OBJ) gxbcache.$(OBJ)
-LIB2x=gxccache.$(OBJ) gxccman.$(OBJ) gxcht.$(OBJ) gxcmap.$(OBJ) gxcpath.$(OBJ)
-LIB3x=gxdcconv.$(OBJ) gxdcolor.$(OBJ) gxdither.$(OBJ) gxfill.$(OBJ) gxht.$(OBJ)
-LIB4x=gximage.$(OBJ) gximage0.$(OBJ) gximage1.$(OBJ) gximage2.$(OBJ)
-LIB5x=gxpaint.$(OBJ) gxpath.$(OBJ) gxpath2.$(OBJ) gxpcopy.$(OBJ)
-LIB6x=gxpdash.$(OBJ) gxpflat.$(OBJ) gxsample.$(OBJ) gxstroke.$(OBJ)
-LIB1d=gdevabuf.$(OBJ) gdevddrw.$(OBJ) gdevdflt.$(OBJ) gdevnfwd.$(OBJ)
-LIB2d=gdevmem.$(OBJ) gdevm1.$(OBJ) gdevm2.$(OBJ) gdevm4.$(OBJ) gdevm8.$(OBJ)
-LIB3d=gdevm16.$(OBJ) gdevm24.$(OBJ) gdevm32.$(OBJ) gdevmpla.$(OBJ)
-LIBs=$(LIB1s) $(LIB2s) $(LIB3s) $(LIB4s) $(LIB5s) $(LIB6s)
-LIBx=$(LIB1x) $(LIB2x) $(LIB3x) $(LIB4x) $(LIB5x) $(LIB6x)
-LIBd=$(LIB1d) $(LIB2d) $(LIB3d)
-LIB_ALL=$(LIBs) $(LIBx) $(LIBd)
-libs.dev: $(LIB_MAK) $(ECHOGS_XE) $(LIBs)
- $(EXP)echogs -w libs.dev $(LIB1s)
- $(EXP)echogs -a libs.dev $(LIB2s)
- $(EXP)echogs -a libs.dev $(LIB3s)
- $(EXP)echogs -a libs.dev $(LIB4s)
- $(EXP)echogs -a libs.dev $(LIB5s)
- $(EXP)echogs -a libs.dev $(LIB6s)
- $(ADDMOD) libs -init gscolor
-
-libx.dev: $(LIB_MAK) $(ECHOGS_XE) $(LIBx)
- $(EXP)echogs -w libx.dev $(LIB1x)
- $(EXP)echogs -a libx.dev $(LIB2x)
- $(EXP)echogs -a libx.dev $(LIB3x)
- $(EXP)echogs -a libx.dev $(LIB4x)
- $(EXP)echogs -a libx.dev $(LIB5x)
- $(EXP)echogs -a libx.dev $(LIB6x)
- $(ADDMOD) libx -init gximage1 gximage2
-
-libd.dev: $(LIB_MAK) $(ECHOGS_XE) $(LIBd)
- $(EXP)echogs -w libd.dev $(LIB1d)
- $(EXP)echogs -a libd.dev $(LIB2d)
- $(EXP)echogs -a libd.dev $(LIB3d)
-
-include 51x.mak
-# roplib and 51xlib shouldn't be required....
-libcore.dev: $(LIB_MAK) $(ECHOGS_XE) 51x.mak \
- libs.dev libx.dev libd.dev iscale.dev roplib.dev 51xlib.dev
- $(SETMOD) libcore
- $(ADDMOD) libcore -dev nullpage
- $(ADDMOD) libcore -include libs libx libd iscale roplib 51xlib
-
-# ---------------- Stream support ---------------- #
-# Currently the only things in the library that use this are clists
-# and file streams.
-
-stream_h=stream.h $(scommon_h)
-
-stream.$(OBJ): stream.c $(AK) $(stdio__h) $(memory__h) \
- $(gdebug_h) $(gpcheck_h) $(stream_h) $(strimpl_h)
-
-# ---------------- File streams ---------------- #
-# Currently only the high-level drivers use these, but more drivers will
-# probably use them eventually.
-
-sfile_=sfx$(FILE_IMPLEMENTATION).$(OBJ) stream.$(OBJ)
-sfile.dev: $(LIB_MAK) $(ECHOGS_XE) $(sfile_)
- $(SETMOD) sfile $(sfile_)
-
-sfxstdio.$(OBJ): sfxstdio.c $(AK) $(stdio__h) $(memory__h) \
- $(gdebug_h) $(gpcheck_h) $(stream_h) $(strimpl_h)
-
-sfxfd.$(OBJ): sfxfd.c $(AK) $(stdio__h) $(errno__h) $(memory__h) \
- $(gdebug_h) $(gpcheck_h) $(stream_h) $(strimpl_h)
-
-sfxboth.$(OBJ): sfxboth.c sfxstdio.c sfxfd.c
-
-# ---------------- CCITTFax filters ---------------- #
-# These are used by clists, some drivers, and Level 2 in general.
-
-cfe_=scfe.$(OBJ) scfetab.$(OBJ) shc.$(OBJ)
-cfe.dev: $(LIB_MAK) $(ECHOGS_XE) $(cfe_)
- $(SETMOD) cfe $(cfe_)
-
-scfe.$(OBJ): scfe.c $(AK) $(memory__h) $(stdio__h) $(gdebug_h)\
- $(scf_h) $(strimpl_h) $(scfx_h)
-
-scfetab.$(OBJ): scfetab.c $(AK) $(std_h) $(scommon_h) $(scf_h)
-
-shc.$(OBJ): shc.c $(AK) $(std_h) $(scommon_h) $(shc_h)
-
-cfd_=scfd.$(OBJ) scfdtab.$(OBJ)
-cfd.dev: $(LIB_MAK) $(ECHOGS_XE) $(cfd_)
- $(SETMOD) cfd $(cfd_)
-
-scfd.$(OBJ): scfd.c $(AK) $(memory__h) $(stdio__h) $(gdebug_h)\
- $(scf_h) $(strimpl_h) $(scfx_h)
-
-scfdtab.$(OBJ): scfdtab.c $(AK) $(std_h) $(scommon_h) $(scf_h)
-
-# ---------------- DCT (JPEG) filters ---------------- #
-# These are used by Level 2, and by the JPEG-writing driver.
-
-# Common code
-
-sdctc_=sdctc.$(OBJ) sjpegc.$(OBJ)
-
-sdctc.$(OBJ): sdctc.c $(AK) $(stdio__h)\
- $(sdct_h) $(strimpl_h)\
- jpeglib.h
-
-sjpegc.$(OBJ): sjpegc.c $(AK) $(stdio__h) $(string__h) $(gx_h)\
- $(gserrors_h) $(sjpeg_h) $(sdct_h) $(strimpl_h) \
- jerror.h jpeglib.h
-
-# Encoding (compression)
-
-sdcte_=$(sdctc_) sdcte.$(OBJ) sjpege.$(OBJ)
-sdcte.dev: $(LIB_MAK) $(ECHOGS_XE) $(sdcte_) jpege.dev
- $(SETMOD) sdcte $(sdcte_)
- $(ADDMOD) sdcte -include jpege
-
-sdcte.$(OBJ): sdcte.c $(AK) $(memory__h) $(stdio__h) $(gdebug_h)\
- $(sdct_h) $(sjpeg_h) $(strimpl_h) \
- jerror.h jpeglib.h
-
-sjpege.$(OBJ): sjpege.c $(AK) $(stdio__h) $(string__h) $(gx_h)\
- $(gserrors_h) $(sjpeg_h) $(sdct_h) $(strimpl_h) \
- jerror.h jpeglib.h
-
-# Decoding (decompression)
-
-sdctd_=$(sdctc_) sdctd.$(OBJ) sjpegd.$(OBJ)
-sdctd.dev: $(LIB_MAK) $(ECHOGS_XE) $(sdctd_) jpegd.dev
- $(SETMOD) sdctd $(sdctd_)
- $(ADDMOD) sdctd -include jpegd
-
-sdctd.$(OBJ): sdctd.c $(AK) $(memory__h) $(stdio__h) $(gdebug_h)\
- $(sdct_h) $(sjpeg_h) $(strimpl_h) \
- jerror.h jpeglib.h
-
-sjpegd.$(OBJ): sjpegd.c $(AK) $(stdio__h) $(string__h) $(gx_h)\
- $(gserrors_h) $(sjpeg_h) $(sdct_h) $(strimpl_h)\
- jerror.h jpeglib.h
-
-# ---------------- LZW filters ---------------- #
-# These are used by Level 2 in general.
-
-slzwe_=slzwce
-#slzwe_=slzwe
-lzwe_=$(slzwe_).$(OBJ) slzwc.$(OBJ)
-lzwe.dev: $(LIB_MAK) $(ECHOGS_XE) $(lzwe_)
- $(SETMOD) lzwe $(lzwe_)
-
-# We need slzwe.dev as a synonym for lzwe.dev for BAND_LIST_STORAGE = memory.
-slzwe.dev: lzwe.dev
- $(CP_) lzwe.dev slzwe.dev
-
-slzwce.$(OBJ): slzwce.c $(AK) $(stdio__h) $(gdebug_h)\
- $(slzwx_h) $(strimpl_h)
-
-slzwe.$(OBJ): slzwe.c $(AK) $(stdio__h) $(gdebug_h)\
- $(slzwx_h) $(strimpl_h)
-
-slzwc.$(OBJ): slzwc.c $(AK) $(std_h)\
- $(slzwx_h) $(strimpl_h)
-
-lzwd_=slzwd.$(OBJ) slzwc.$(OBJ)
-lzwd.dev: $(LIB_MAK) $(ECHOGS_XE) $(lzwd_)
- $(SETMOD) lzwd $(lzwd_)
-
-# We need slzwd.dev as a synonym for lzwd.dev for BAND_LIST_STORAGE = memory.
-slzwd.dev: lzwd.dev
- $(CP_) lzwd.dev slzwd.dev
-
-slzwd.$(OBJ): slzwd.c $(AK) $(stdio__h) $(gdebug_h)\
- $(slzwx_h) $(strimpl_h)
-
-# ---------------- PCX decoding filter ---------------- #
-# This is an adhoc filter not used by anything in the standard configuration.
-
-pcxd_=spcxd.$(OBJ)
-pcxd.dev: $(LIB_MAK) $(ECHOGS_XE) $(pcxd_)
- $(SETMOD) pcxd $(pcxd_)
-
-spcxd.$(OBJ): spcxd.c $(AK) $(stdio__h) $(memory__h) \
- $(spcxx_h) $(strimpl_h)
-
-# ---------------- Pixel-difference filters ---------------- #
-# The Predictor facility of the LZW and Flate filters uses these.
-
-pdiff_=spdiff.$(OBJ)
-pdiff.dev: $(LIB_MAK) $(ECHOGS_XE) $(pdiff_)
- $(SETMOD) pdiff $(pdiff_)
-
-spdiff.$(OBJ): spdiff.c $(AK) $(stdio__h)\
- $(spdiffx_h) $(strimpl_h)
-
-# ---------------- PNG pixel prediction filters ---------------- #
-# The Predictor facility of the LZW and Flate filters uses these.
-
-pngp_=spngp.$(OBJ)
-pngp.dev: $(LIB_MAK) $(ECHOGS_XE) $(pngp_)
- $(SETMOD) pngp $(pngp_)
-
-spngp.$(OBJ): spngp.c $(AK) $(memory__h)\
- $(spngpx_h) $(strimpl_h)
-
-# ---------------- RunLength filters ---------------- #
-# These are used by clists and also by Level 2 in general.
-
-rle_=srle.$(OBJ)
-rle.dev: $(LIB_MAK) $(ECHOGS_XE) $(rle_)
- $(SETMOD) rle $(rle_)
-
-srle.$(OBJ): srle.c $(AK) $(stdio__h) $(memory__h) \
- $(srlx_h) $(strimpl_h)
-
-rld_=srld.$(OBJ)
-rld.dev: $(LIB_MAK) $(ECHOGS_XE) $(rld_)
- $(SETMOD) rld $(rld_)
-
-srld.$(OBJ): srld.c $(AK) $(stdio__h) $(memory__h) \
- $(srlx_h) $(strimpl_h)
-
-# ---------------- String encoding/decoding filters ---------------- #
-# These are used by the PostScript and PDF writers, and also by the
-# PostScript interpreter.
-
-scantab.$(OBJ): scantab.c $(AK) $(stdpre_h)\
- $(scanchar_h) $(scommon_h)
-
-sfilter2.$(OBJ): sfilter2.c $(AK) $(memory__h) $(stdio__h)\
- $(sa85x_h) $(scanchar_h) $(sbtx_h) $(strimpl_h)
-
-sstring.$(OBJ): sstring.c $(AK) $(stdio__h) $(memory__h) $(string__h)\
- $(scanchar_h) $(sstring_h) $(strimpl_h)
-
-# ---------------- zlib filters ---------------- #
-# These are used by clists and are also available as filters.
-
-szlibc_=szlibc.$(OBJ)
-
-szlibc.$(OBJ): szlibc.c $(AK) $(std_h) \
- $(gsmemory_h) $(gsstruct_h) $(gstypes_h) $(strimpl_h) $(szlibx_h)
- $(CCCZ) szlibc.c
-
-szlibe_=$(szlibc_) szlibe.$(OBJ)
-szlibe.dev: $(LIB_MAK) $(ECHOGS_XE) zlibe.dev $(szlibe_)
- $(SETMOD) szlibe $(szlibe_)
- $(ADDMOD) szlibe -include zlibe
-
-szlibe.$(OBJ): szlibe.c $(AK) $(std_h) \
- $(gsmemory_h) $(strimpl_h) $(szlibx_h)
- $(CCCZ) szlibe.c
-
-szlibd_=$(szlibc_) szlibd.$(OBJ)
-szlibd.dev: $(LIB_MAK) $(ECHOGS_XE) zlibd.dev $(szlibd_)
- $(SETMOD) szlibd $(szlibd_)
- $(ADDMOD) szlibd -include zlibd
-
-szlibd.$(OBJ): szlibd.c $(AK) $(std_h) \
- $(gsmemory_h) $(strimpl_h) $(szlibx_h)
- $(CCCZ) szlibd.c
-
-# ---------------- Command lists ---------------- #
-
-gxcldev_h=gxcldev.h $(gxclist_h) $(gsropt_h) $(gxht_h) $(gxtmap_h) $(gxdht_h)\
- $(strimpl_h) $(scfx_h) $(srlx_h)
-gxclpage_h=gxclpage.h $(gxclio_h)
-gxclpath_h=gxclpath.h $(gxfixed_h)
-
-# Command list package. Currently the higher-level facilities are required,
-# but eventually they will be optional.
-clist.dev: $(LIB_MAK) $(ECHOGS_XE) clbase.dev clpath.dev
- $(SETMOD) clist -include clbase clpath
-
-# Base command list facility.
-clbase1_=gxclist.$(OBJ) gxclbits.$(OBJ) gxclpage.$(OBJ)
-clbase2_=gxclread.$(OBJ) gxclrect.$(OBJ) stream.$(OBJ)
-clbase_=$(clbase1_) $(clbase2_)
-clbase.dev: $(LIB_MAK) $(ECHOGS_XE) $(clbase_) cl$(BAND_LIST_STORAGE).dev \
- cfe.dev cfd.dev rle.dev rld.dev
- $(SETMOD) clbase $(clbase1_)
- $(ADDMOD) clbase -obj $(clbase2_)
- $(ADDMOD) clbase -include cl$(BAND_LIST_STORAGE) cfe cfd rle rld
-
-gdevht_h=gdevht.h $(gzht_h)
-
-gdevht.$(OBJ): gdevht.c $(GXERR) \
- $(gdevht_h) $(gxdcconv_h) $(gxdcolor_h) $(gxdevice_h) $(gxdither_h)
-
-gxclist.$(OBJ): gxclist.c $(GXERR) $(memory__h) $(string__h)\
- $(gp_h) $(gpcheck_h)\
- $(gxcldev_h) $(gxclpath_h) $(gxdevice_h) $(gxdevmem_h) $(gsparams_h)
-
-gxclbits.$(OBJ): gxclbits.c $(GXERR) $(memory__h) $(gpcheck_h)\
- $(gsbitops_h) $(gxcldev_h) $(gxdevice_h) $(gxdevmem_h) $(gxfmap_h)
-
-gxclpage.$(OBJ): gxclpage.c $(AK)\
- $(gdevprn_h) $(gxcldev_h) $(gxclpage_h)
-
-# (gxclread shouldn't need gxclpath.h)
-gxclread.$(OBJ): gxclread.c $(GXERR) $(memory__h) $(gp_h) $(gpcheck_h)\
- $(gdevht_h)\
- $(gsbitops_h) $(gscoord_h) $(gsdevice_h) $(gsstate_h)\
- $(gxcldev_h) $(gxclpath_h) $(gxcmap_h) $(gxcspace_h) $(gxdcolor_h)\
- $(gxdevice_h) $(gxdevmem_h) $(gsparams_h)\
- $(gxhttile_h) $(gxpaint_h) $(gzacpath_h) $(gzcpath_h) $(gzpath_h)\
- $(stream_h) $(strimpl_h)
-
-gxclrect.$(OBJ): gxclrect.c $(GXERR)\
- $(gsutil_h) $(gxcldev_h) $(gxdevice_h) $(gxdevmem_h)
-
-# Higher-level command list facilities.
-clpath_=gxclimag.$(OBJ) gxclpath.$(OBJ)
-clpath.dev: $(LIB_MAK) $(ECHOGS_XE) $(clpath_) psl2cs.dev
- $(SETMOD) clpath $(clpath_)
- $(ADDMOD) clpath -include psl2cs
- $(ADDMOD) clpath -init climag clpath
-
-gxclimag.$(OBJ): gxclimag.c $(GXERR) $(math__h) $(memory__h)\
- $(gscspace_h)\
- $(gxarith_h) $(gxcldev_h) $(gxclpath_h) $(gxdevice_h) $(gxdevmem_h)\
- $(gxpath_h) $(gxfmap_h)\
- $(siscale_h) $(strimpl_h)
-
-gxclpath.$(OBJ): gxclpath.c $(GXERR) $(math__h) $(memory__h) $(gpcheck_h)\
- $(gxcldev_h) $(gxclpath_h) $(gxcolor2_h) $(gxdevice_h) $(gxdevmem_h)\
- $(gxpaint_h) \
- $(gzcpath_h) $(gzpath_h)
-
-# Implement band lists on files.
-
-clfile_=gxclfile.$(OBJ)
-clfile.dev: $(LIB_MAK) $(ECHOGS_XE) $(clfile_)
- $(SETMOD) clfile $(clfile_)
-
-gxclfile.$(OBJ): gxclfile.c $(stdio__h) $(string__h) \
- $(gp_h) $(gsmemory_h) $(gserror_h) $(gserrors_h) $(gxclio_h)
-
-# Implement band lists in memory (RAM).
-
-clmemory_=gxclmem.$(OBJ) gxcl$(BAND_LIST_COMPRESSOR).$(OBJ)
-clmemory.dev: $(LIB_MAK) $(ECHOGS_XE) $(clmemory_) s$(BAND_LIST_COMPRESSOR)e.dev s$(BAND_LIST_COMPRESSOR)d.dev
- $(SETMOD) clmemory $(clmemory_)
- $(ADDMOD) clmemory -include s$(BAND_LIST_COMPRESSOR)e s$(BAND_LIST_COMPRESSOR)d
- $(ADDMOD) clmemory -init cl_$(BAND_LIST_COMPRESSOR)
-
-gxclmem_h=gxclmem.h $(gxclio_h) $(strimpl_h)
-
-gxclmem.$(OBJ): gxclmem.c $(GXERR) $(LIB_MAK) $(memory__h) \
- $(gxclmem_h)
-
-# Implement the compression method for RAM-based band lists.
-
-gxcllzw.$(OBJ): gxcllzw.c $(std_h)\
- $(gsmemory_h) $(gstypes_h) $(gxclmem_h) $(slzwx_h)
-
-gxclzlib.$(OBJ): gxclzlib.c $(std_h)\
- $(gsmemory_h) $(gstypes_h) $(gxclmem_h) $(szlibx_h)
- $(CCCZ) gxclzlib.c
-
-# ---------------- Page devices ---------------- #
-# We include this here, rather than in devs.mak, because it is more like
-# a feature than a simple device.
-
-page_=gdevprn.$(OBJ)
-page.dev: $(LIB_MAK) $(ECHOGS_XE) $(page_) clist.dev
- $(SETMOD) page $(page_)
- $(ADDMOD) page -include clist
-
-gdevprn.$(OBJ): gdevprn.c $(ctype__h) \
- $(gdevprn_h) $(gp_h) $(gsparam_h) $(gxclio_h)
-
-# ---------------- Vector devices ---------------- #
-# We include this here for the same reasons as page.dev.
-
-gdevvec_h=gdevvec.h $(gdevbbox_h) $(gsropt_h) $(gxdevice_h) $(gxistate_h) $(stream_h)
-
-vector_=gdevvec.$(OBJ)
-vector.dev: $(LIB_MAK) $(ECHOGS_XE) $(vector_) bbox.dev sfile.dev
- $(SETMOD) vector $(vector_)
- $(ADDMOD) vector -include bbox sfile
-
-gdevvec.$(OBJ): gdevvec.c $(GXERR) $(math__h) $(memory__h) $(string__h)\
- $(gdevvec_h) $(gp_h) $(gscspace_h) $(gsparam_h) $(gsutil_h)\
- $(gxdcolor_h) $(gxfixed_h) $(gxpaint_h)\
- $(gzcpath_h) $(gzpath_h)
-
-# ---------------- Image scaling filter ---------------- #
-
-iscale_=siscale.$(OBJ)
-iscale.dev: $(LIB_MAK) $(ECHOGS_XE) $(iscale_)
- $(SETMOD) iscale $(iscale_)
-
-siscale.$(OBJ): siscale.c $(AK) $(math__h) $(memory__h) $(stdio__h) \
- $(siscale_h) $(strimpl_h)
-
-# ---------------- RasterOp et al ---------------- #
-# Currently this module is required, but it should be optional.
-
-roplib_=gdevmrop.$(OBJ) gsrop.$(OBJ) gsroptab.$(OBJ)
-roplib.dev: $(LIB_MAK) $(ECHOGS_XE) $(roplib_)
- $(SETMOD) roplib $(roplib_)
- $(ADDMOD) roplib -init roplib
-
-gdevrun.$(OBJ): gdevrun.c $(GXERR) $(memory__h) \
- $(gxdevice_h) $(gxdevmem_h)
-
-gdevmrop.$(OBJ): gdevmrop.c $(GXERR) $(memory__h) \
- $(gsbittab_h) $(gsropt_h) \
- $(gxdcolor_h) $(gxdevice_h) $(gxdevmem_h) $(gxdevrop_h) \
- $(gdevmrop_h)
-
-gsrop.$(OBJ): gsrop.c $(GXERR) \
- $(gsrop_h) $(gzstate_h)
-
-gsroptab.$(OBJ): gsroptab.c $(stdpre_h) $(gsropt_h)
- $(CCLEAF) gsroptab.c
-
-# ---------------- Async rendering ---------------- #
-
-gsmemfix_h=gsmemfix.h $(gsmemraw_h)
-gxsync_h=gxsync.h $(gpsync_h) $(gsmemory_h)
-gxpageq_h=gxpageq.h $(gsmemory_h) $(gxband_h) $(gxsync_h)
-gsmemlok_h=gsmemlok.h $(gsmemory_h) $(gxsync_h)
-gdevprna_h=gdevprna.h $(gdevprn_h) $(gxsync_h)
-
-async_=gdevprna.$(OBJ) gxsync.$(OBJ) gxpageq.$(OBJ) gsmemlok.$(OBJ)\
- gsmemfix.$(OBJ)
-async.dev: $(INT_MAK) $(ECHOGS_XE) $(async_) clist.dev
- $(SETMOD) async $(async_)
-
-gdevprna.$(OBJ): gdevprna.c $(AK) $(ctype__h) $(gdevprna_h) $(gsparam_h)\
- $(gsdevice_h) $(gxcldev_h) $(gxclpath_h) $(gxpageq_h) $(gsmemory_h)\
- $(gsmemlok_h) $(gsmemfix_h)
-
-gsmemfix.$(OBJ): gsmemfix.c $(AK) $(memory__h) $(gsmemraw_h) $(gsmemfix_h)
-
-gxsync.$(OBJ): gxsync.c $(AK) $(gxsync_h) $(memory__h) $(gx_h) $(gserrors_h)\
- $(gsmemory_h)
-
-gxpageq.$(OBJ): gxpageq.c $(GXERR) $(gxdevice_h) $(gxclist_h)\
- $(gxpageq_h) $(gserrors_h)
-
-gsmemlok.$(OBJ): gsmemlok.c $(GXERR) $(gsmemlok_h) $(gserrors_h)
-
-# -------- Composite (PostScript Type 0) font support -------- #
-
-cmaplib_=gsfcmap.$(OBJ)
-cmaplib.dev: $(LIB_MAK) $(ECHOGS_XE) $(cmaplib_)
- $(SETMOD) cmaplib $(cmaplib_)
-
-gsfcmap.$(OBJ): gsfcmap.c $(GXERR)\
- $(gsstruct_h) $(gxfcmap_h)
-
-psf0lib_=gschar0.$(OBJ) gsfont0.$(OBJ)
-psf0lib.dev: $(LIB_MAK) $(ECHOGS_XE) cmaplib.dev $(psf0lib_)
- $(SETMOD) psf0lib $(psf0lib_)
- $(ADDMOD) psf0lib -include cmaplib
-
-gschar0.$(OBJ): gschar0.c $(GXERR) $(memory__h)\
- $(gsstruct_h) $(gxfixed_h) $(gxdevice_h) $(gxdevmem_h)\
- $(gsfcmap_h) $(gxfont_h) $(gxfont0_h) $(gxchar_h)
-
-gsfont0.$(OBJ): gsfont0.c $(GXERR) $(memory__h)\
- $(gsmatrix_h) $(gsstruct_h) $(gxfixed_h) $(gxdevmem_h) $(gxfcache_h)\
- $(gxfont_h) $(gxfont0_h) $(gxchar_h) $(gxdevice_h)
-
-# ---------------- Pattern color ---------------- #
-
-patlib_=gspcolor.$(OBJ) gxclip2.$(OBJ) gxpcmap.$(OBJ)
-patlib.dev: $(LIB_MAK) $(ECHOGS_XE) cmyklib.dev psl2cs.dev $(patlib_)
- $(SETMOD) patlib -include cmyklib psl2cs
- $(ADDMOD) patlib -obj $(patlib_)
-
-gspcolor.$(OBJ): gspcolor.c $(GXERR) $(math__h) \
- $(gsimage_h) $(gspath_h) $(gsrop_h) $(gsstruct_h) $(gsutil_h) \
- $(gxarith_h) $(gxcolor2_h) $(gxcoord_h) $(gxclip2_h) $(gxcspace_h) \
- $(gxdcolor_h) $(gxdevice_h) $(gxdevmem_h) \
- $(gxfixed_h) $(gxmatrix_h) $(gxpath_h) $(gxpcolor_h) $(gzstate_h)
-
-gxclip2.$(OBJ): gxclip2.c $(GXERR) $(memory__h) \
- $(gsstruct_h) $(gxclip2_h) $(gxdevice_h) $(gxdevmem_h)
-
-gxpcmap.$(OBJ): gxpcmap.c $(GXERR) $(math__h) $(memory__h)\
- $(gsstruct_h) $(gsutil_h)\
- $(gxcolor2_h) $(gxcspace_h) $(gxdcolor_h) $(gxdevice_h) $(gxdevmem_h)\
- $(gxfixed_h) $(gxmatrix_h) $(gxpcolor_h)\
- $(gzcpath_h) $(gzpath_h) $(gzstate_h)
-
-# ---------------- PostScript Type 1 (and Type 4) fonts ---------------- #
-
-type1lib_=gxtype1.$(OBJ) gxhint1.$(OBJ) gxhint2.$(OBJ) gxhint3.$(OBJ)
-
-gscrypt1_h=gscrypt1.h
-gstype1_h=gstype1.h
-gxfont1_h=gxfont1.h
-gxop1_h=gxop1.h
-gxtype1_h=gxtype1.h $(gscrypt1_h) $(gstype1_h) $(gxop1_h)
-
-gxtype1.$(OBJ): gxtype1.c $(GXERR) $(math__h)\
- $(gsccode_h) $(gsline_h) $(gsstruct_h)\
- $(gxarith_h) $(gxcoord_h) $(gxfixed_h) $(gxmatrix_h)\
- $(gxfont_h) $(gxfont1_h) $(gxistate_h) $(gxtype1_h)\
- $(gzpath_h)
-
-gxhint1.$(OBJ): gxhint1.c $(GXERR)\
- $(gxarith_h) $(gxfixed_h) $(gxmatrix_h) $(gxchar_h)\
- $(gxfont_h) $(gxfont1_h) $(gxtype1_h)
-
-gxhint2.$(OBJ): gxhint2.c $(GXERR) $(memory__h)\
- $(gxarith_h) $(gxfixed_h) $(gxmatrix_h) $(gxchar_h)\
- $(gxfont_h) $(gxfont1_h) $(gxtype1_h)
-
-gxhint3.$(OBJ): gxhint3.c $(GXERR) $(math__h)\
- $(gxarith_h) $(gxfixed_h) $(gxmatrix_h) $(gxchar_h)\
- $(gxfont_h) $(gxfont1_h) $(gxtype1_h)\
- $(gzpath_h)
-
-# Type 1 charstrings
-
-psf1lib_=gstype1.$(OBJ)
-psf1lib.dev: $(LIB_MAK) $(ECHOGS_XE) $(psf1lib_) $(type1lib_)
- $(SETMOD) psf1lib $(psf1lib_)
- $(ADDMOD) psf1lib $(type1lib_)
- $(ADDMOD) psf1lib -init gstype1
-
-gstype1.$(OBJ): gstype1.c $(GXERR) $(math__h) $(memory__h)\
- $(gsstruct_h)\
- $(gxarith_h) $(gxcoord_h) $(gxfixed_h) $(gxmatrix_h) $(gxchar_h)\
- $(gxfont_h) $(gxfont1_h) $(gxistate_h) $(gxtype1_h)\
- $(gzpath_h)
-
-# Type 2 charstrings
-
-psf2lib_=gstype2.$(OBJ)
-psf2lib.dev: $(LIB_MAK) $(ECHOGS_XE) $(psf2lib_) $(type1lib_)
- $(SETMOD) psf2lib $(psf2lib_)
- $(ADDMOD) psf2lib $(type1lib_)
- $(ADDMOD) psf2lib -init gstype2
-
-gstype2.$(OBJ): gstype2.c $(GXERR) $(math__h) $(memory__h)\
- $(gsstruct_h)\
- $(gxarith_h) $(gxcoord_h) $(gxfixed_h) $(gxmatrix_h) $(gxchar_h)\
- $(gxfont_h) $(gxfont1_h) $(gxistate_h) $(gxtype1_h)\
- $(gzpath_h)
-
-# ---------------- TrueType and PostScript Type 42 fonts ---------------- #
-
-ttflib_=gstype42.$(OBJ)
-ttflib.dev: $(LIB_MAK) $(ECHOGS_XE) $(ttflib_)
- $(SETMOD) ttflib $(ttflib_)
-
-gxfont42_h=gxfont42.h
-
-gstype42.$(OBJ): gstype42.c $(GXERR) $(memory__h) \
- $(gsccode_h) $(gsmatrix_h) $(gsstruct_h) \
- $(gxfixed_h) $(gxfont_h) $(gxfont42_h) $(gxistate_h) $(gxpath_h)
-
-# -------- Level 1 color extensions (CMYK color and colorimage) -------- #
-
-cmyklib_=gscolor1.$(OBJ) gsht1.$(OBJ)
-cmyklib.dev: $(LIB_MAK) $(ECHOGS_XE) $(cmyklib_)
- $(SETMOD) cmyklib $(cmyklib_)
- $(ADDMOD) cmyklib -init gscolor1
-
-gscolor1.$(OBJ): gscolor1.c $(GXERR) \
- $(gsccolor_h) $(gscolor1_h) $(gsstruct_h) $(gsutil_h) \
- $(gxcmap_h) $(gxcspace_h) $(gxdcconv_h) $(gxdevice_h) \
- $(gzstate_h)
-
-gsht1.$(OBJ): gsht1.c $(GXERR) $(memory__h)\
- $(gsstruct_h) $(gsutil_h) $(gxdevice_h) $(gzht_h) $(gzstate_h)
-
-colimlib_=gximage3.$(OBJ)
-colimlib.dev: $(LIB_MAK) $(ECHOGS_XE) $(colimlib_)
- $(SETMOD) colimlib $(colimlib_)
- $(ADDMOD) colimlib -init gximage3
-
-gximage3.$(OBJ): gximage3.c $(GXERR) $(memory__h) $(gpcheck_h)\
- $(gsccolor_h) $(gspaint_h)\
- $(gxarith_h) $(gxcmap_h) $(gxcpath_h) $(gxdcconv_h) $(gxdcolor_h)\
- $(gxdevice_h) $(gxdevmem_h) $(gxfixed_h) $(gxfrac_h)\
- $(gximage_h) $(gxistate_h) $(gxmatrix_h)\
- $(gzpath_h) $(gzstate_h)
-
-# ---------------- HSB color ---------------- #
-
-hsblib_=gshsb.$(OBJ)
-hsblib.dev: $(LIB_MAK) $(ECHOGS_XE) $(hsblib_)
- $(SETMOD) hsblib $(hsblib_)
-
-gshsb.$(OBJ): gshsb.c $(GX) \
- $(gscolor_h) $(gshsb_h) $(gxfrac_h)
-
-# ---- Level 1 path miscellany (arcs, pathbbox, path enumeration) ---- #
-
-path1lib_=gspath1.$(OBJ)
-path1lib.dev: $(LIB_MAK) $(ECHOGS_XE) $(path1lib_)
- $(SETMOD) path1lib $(path1lib_)
-
-gspath1.$(OBJ): gspath1.c $(GXERR) $(math__h) \
- $(gscoord_h) $(gspath_h) $(gsstruct_h) \
- $(gxfarith_h) $(gxfixed_h) $(gxmatrix_h) \
- $(gzstate_h) $(gzpath_h)
-
-# --------------- Level 2 color space and color image support --------------- #
-
-psl2cs_=gscolor2.$(OBJ)
-psl2cs.dev: $(LIB_MAK) $(ECHOGS_XE) $(psl2cs_)
- $(SETMOD) psl2cs $(psl2cs_)
-
-gscolor2.$(OBJ): gscolor2.c $(GXERR) \
- $(gxarith_h) $(gxcolor2_h) $(gxcspace_h) $(gxfixed_h) $(gxmatrix_h) \
- $(gzstate_h)
-
-psl2lib_=gximage4.$(OBJ) gximage5.$(OBJ)
-psl2lib.dev: $(LIB_MAK) $(ECHOGS_XE) $(psl2lib_) colimlib.dev psl2cs.dev
- $(SETMOD) psl2lib $(psl2lib_)
- $(ADDMOD) psl2lib -init gximage4 gximage5
- $(ADDMOD) psl2lib -include colimlib psl2cs
-
-gximage4.$(OBJ): gximage4.c $(GXERR) $(memory__h) $(gpcheck_h)\
- $(gsccolor_h) $(gspaint_h)\
- $(gxarith_h) $(gxcmap_h) $(gxcpath_h) $(gxdcolor_h) $(gxdevice_h)\
- $(gxdevmem_h) $(gxfixed_h) $(gxfrac_h) $(gximage_h) $(gxistate_h)\
- $(gxmatrix_h)\
- $(gzpath_h)
-
-gximage5.$(OBJ): gximage5.c $(GXERR) $(math__h) $(memory__h) $(gpcheck_h)\
- $(gsccolor_h) $(gspaint_h)\
- $(gxarith_h) $(gxcmap_h) $(gxcpath_h) $(gxdcolor_h) $(gxdevice_h)\
- $(gxdevmem_h) $(gxfixed_h) $(gxfrac_h) $(gximage_h) $(gxistate_h)\
- $(gxmatrix_h)\
- $(gzpath_h)
-
-# ---------------- Display Postscript / Level 2 support ---------------- #
-
-dps2lib_=gsdps1.$(OBJ)
-dps2lib.dev: $(LIB_MAK) $(ECHOGS_XE) $(dps2lib_)
- $(SETMOD) dps2lib $(dps2lib_)
-
-gsdps1.$(OBJ): gsdps1.c $(GXERR) $(math__h)\
- $(gscoord_h) $(gsmatrix_h) $(gspaint_h) $(gspath_h) $(gspath2_h)\
- $(gxdevice_h) $(gxfixed_h) $(gxmatrix_h) $(gzcpath_h) $(gzpath_h) $(gzstate_h)
-
-# ---------------- Display Postscript extensions ---------------- #
-
-gsdps_h=gsdps.h
-
-dpslib_=gsdps.$(OBJ)
-dpslib.dev: $(LIB_MAK) $(ECHOGS_XE) $(dpslib_)
- $(SETMOD) dpslib $(dpslib_)
-
-gsdps.$(OBJ): gsdps.c $(GX) $(gsdps_h)\
- $(gsdps_h) $(gspath_h) $(gxdevice_h) $(gzcpath_h) $(gzpath_h) $(gzstate_h)
-
-# ---------------- CIE color ---------------- #
-
-cielib_=gscie.$(OBJ) gxctable.$(OBJ)
-cielib.dev: $(LIB_MAK) $(ECHOGS_XE) $(cielib_)
- $(SETMOD) cielib $(cielib_)
-
-gscie.$(OBJ): gscie.c $(GXERR) $(math__h) \
- $(gscie_h) $(gscolor2_h) $(gsmatrix_h) $(gsstruct_h) \
- $(gxarith_h) $(gxcmap_h) $(gxcspace_h) $(gxdevice_h) $(gzstate_h)
-
-gxctable.$(OBJ): gxctable.c $(GX) \
- $(gxfixed_h) $(gxfrac_h) $(gxctable_h)
-
-# ---------------- Separation colors ---------------- #
-
-seprlib_=gscsepr.$(OBJ)
-seprlib.dev: $(LIB_MAK) $(ECHOGS_XE) $(seprlib_)
- $(SETMOD) seprlib $(seprlib_)
-
-gscsepr.$(OBJ): gscsepr.c $(GXERR)\
- $(gscsepr_h) $(gsmatrix_h) $(gsrefct_h)\
- $(gxcolor2_h) $(gxcspace_h) $(gxfixed_h) $(gzstate_h)
-
-# ---------------- Functions ---------------- #
-
-gsdsrc_h=gsdsrc.h $(gsstruct_h)
-gsfunc_h=gsfunc.h
-gsfunc0_h=gsfunc0.h $(gsdsrc_h) $(gsfunc_h)
-gxfunc_h=gxfunc.h $(gsfunc_h) $(gsstruct_h)
-
-# Generic support, and FunctionType 0.
-funclib_=gsdsrc.$(OBJ) gsfunc.$(OBJ) gsfunc0.$(OBJ)
-funclib.dev: $(LIB_MAK) $(ECHOGS_XE) $(funclib_)
- $(SETMOD) funclib $(funclib_)
-
-gsdsrc.$(OBJ): gsdsrc.c $(GX) $(memory__h)\
- $(gsdsrc_h) $(gserrors_h) $(stream_h)
-
-gsfunc.$(OBJ): gsfunc.c $(GX)\
- $(gserrors_h) $(gxfunc_h)
-
-gsfunc0.$(OBJ): gsfunc0.c $(GX) $(math__h)\
- $(gserrors_h) $(gsfunc0_h) $(gxfunc_h)
-
-# ----------------------- Platform-specific modules ----------------------- #
-# Platform-specific code doesn't really belong here: this is code that is
-# shared among multiple platforms.
-
-# Frame buffer implementations.
-
-gp_nofb.$(OBJ): gp_nofb.c $(GX) \
- $(gp_h) $(gxdevice_h)
-
-gp_dosfb.$(OBJ): gp_dosfb.c $(AK) $(malloc__h) $(memory__h)\
- $(gx_h) $(gp_h) $(gserrors_h) $(gxdevice_h)
-
-# MS-DOS file system, also used by Desqview/X.
-gp_dosfs.$(OBJ): gp_dosfs.c $(AK) $(dos__h) $(gp_h) $(gx_h)
-
-# MS-DOS file enumeration, *not* used by Desqview/X.
-gp_dosfe.$(OBJ): gp_dosfe.c $(AK) $(stdio__h) $(memory__h) $(string__h) \
- $(dos__h) $(gstypes_h) $(gsmemory_h) $(gsstruct_h) $(gp_h) $(gsutil_h)
-
-# Other MS-DOS facilities.
-gp_msdos.$(OBJ): gp_msdos.c $(AK) $(dos__h) $(stdio__h) $(string__h)\
- $(gsmemory_h) $(gstypes_h) $(gp_h)
-
-# Unix(-like) file system, also used by Desqview/X.
-gp_unifs.$(OBJ): gp_unifs.c $(AK) $(memory__h) $(string__h) $(gx_h) $(gp_h) \
- $(gsstruct_h) $(gsutil_h) $(stat__h) $(dirent__h)
-
-# Unix(-like) file name syntax, *not* used by Desqview/X.
-gp_unifn.$(OBJ): gp_unifn.c $(AK) $(gx_h) $(gp_h)
-
-# ----------------------------- Main program ------------------------------ #
-
-# Main program for library testing
-
-gslib.$(OBJ): gslib.c $(AK) $(math__h) \
- $(gx_h) $(gp_h) $(gserrors_h) $(gsmatrix_h) $(gsstate_h) $(gscspace_h) \
- $(gscdefs_h) $(gscolor2_h) $(gscoord_h) $(gslib_h) $(gsparam_h) \
- $(gspaint_h) $(gspath_h) $(gsstruct_h) $(gsutil_h) \
- $(gxalloc_h) $(gxdevice_h)
-# Copyright (C) 1995, 1996, 1997 Aladdin Enterprises. All rights reserved.
-#
-# This file is part of Aladdin Ghostscript.
-#
-# Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
-# or distributor accepts any responsibility for the consequences of using it,
-# or for whether it serves any particular purpose or works at all, unless he
-# or she says so in writing. Refer to the Aladdin Ghostscript Free Public
-# License (the "License") for full details.
-#
-# Every copy of Aladdin Ghostscript must include a copy of the License,
-# normally in a plain ASCII text file named PUBLIC. The License grants you
-# the right to copy, modify and redistribute Aladdin Ghostscript, but only
-# under certain conditions described in the License. Among other things, the
-# License requires that the copyright notice and this notice be preserved on
-# all copies.
-
-# (Platform-independent) makefile for language interpreters.
-# See the end of gs.mak for where this fits into the build process.
-
-# Define the name of this makefile.
-INT_MAK=int.mak
-
-# ======================== Interpreter support ======================== #
-
-# This is support code for all interpreters, not just PostScript and PDF.
-# It knows about the PostScript data types, but isn't supposed to
-# depend on anything outside itself.
-
-errors_h=errors.h
-idebug_h=idebug.h
-idict_h=idict.h
-igc_h=igc.h
-igcstr_h=igcstr.h
-iname_h=iname.h
-inamedef_h=inamedef.h $(gconfigv_h) $(iname_h)
-ipacked_h=ipacked.h
-iref_h=iref.h
-isave_h=isave.h
-isstate_h=isstate.h
-istruct_h=istruct.h $(gsstruct_h)
-iutil_h=iutil.h
-ivmspace_h=ivmspace.h $(gsgc_h)
-opdef_h=opdef.h
-# Nested include files
-ghost_h=ghost.h $(gx_h) $(iref_h)
-imemory_h=imemory.h $(gsalloc_h) $(ivmspace_h)
-ialloc_h=ialloc.h $(imemory_h)
-iastruct_h=iastruct.h $(gxobj_h) $(ialloc_h)
-iastate_h=iastate.h $(gxalloc_h) $(ialloc_h) $(istruct_h)
-store_h=store.h $(ialloc_h)
-
-GH=$(AK) $(ghost_h)
-
-isupport1_=ialloc.$(OBJ) igc.$(OBJ) igcref.$(OBJ) igcstr.$(OBJ)
-isupport2_=ilocate.$(OBJ) iname.$(OBJ) isave.$(OBJ)
-isupport_=$(isupport1_) $(isupport2_)
-isupport.dev: $(INT_MAK) $(ECHOGS_XE) $(isupport_)
- $(SETMOD) isupport $(isupport1_)
- $(ADDMOD) isupport -obj $(isupport2_)
- $(ADDMOD) isupport -init igcref
-
-ialloc.$(OBJ): ialloc.c $(AK) $(memory__h) $(gx_h)\
- $(errors_h) $(gsstruct_h) $(gxarith_h)\
- $(iastate_h) $(iref_h) $(ivmspace_h) $(store_h)
-
-# igc.c, igcref.c, and igcstr.c should really be in the dpsand2 list,
-# but since all the GC enumeration and relocation routines refer to them,
-# it's too hard to separate them out from the Level 1 base.
-igc.$(OBJ): igc.c $(GH) $(memory__h)\
- $(errors_h) $(gsexit_h) $(gsmdebug_h) $(gsstruct_h) $(gsutil_h) \
- $(iastate_h) $(idict_h) $(igc_h) $(igcstr_h) $(inamedef_h) \
- $(ipacked_h) $(isave_h) $(isstate_h) $(istruct_h) $(opdef_h)
-
-igcref.$(OBJ): igcref.c $(GH) $(memory__h)\
- $(gsexit_h) $(gsstruct_h)\
- $(iastate_h) $(idebug_h) $(igc_h) $(iname_h) $(ipacked_h) $(store_h)
-
-igcstr.$(OBJ): igcstr.c $(GH) $(memory__h)\
- $(gsmdebug_h) $(gsstruct_h) $(iastate_h) $(igcstr_h)
-
-ilocate.$(OBJ): ilocate.c $(GH) $(memory__h)\
- $(errors_h) $(gsexit_h) $(gsstruct_h)\
- $(iastate_h) $(idict_h) $(igc_h) $(igcstr_h) $(iname_h)\
- $(ipacked_h) $(isstate_h) $(iutil_h) $(ivmspace_h)\
- $(store_h)
-
-iname.$(OBJ): iname.c $(GH) $(memory__h) $(string__h)\
- $(gsstruct_h) $(gxobj_h)\
- $(errors_h) $(imemory_h) $(inamedef_h) $(isave_h) $(store_h)
-
-isave.$(OBJ): isave.c $(GH) $(memory__h)\
- $(errors_h) $(gsexit_h) $(gsstruct_h) $(gsutil_h)\
- $(iastate_h) $(inamedef_h) $(isave_h) $(isstate_h) $(ivmspace_h)\
- $(ipacked_h) $(store_h)
-
-### Include files
-
-idparam_h=idparam.h
-ilevel_h=ilevel.h
-iparam_h=iparam.h $(gsparam_h)
-istack_h=istack.h
-iutil2_h=iutil2.h
-opcheck_h=opcheck.h
-opextern_h=opextern.h
-# Nested include files
-dstack_h=dstack.h $(istack_h)
-estack_h=estack.h $(istack_h)
-ostack_h=ostack.h $(istack_h)
-oper_h=oper.h $(iutil_h) $(opcheck_h) $(opdef_h) $(opextern_h) $(ostack_h)
-
-idebug.$(OBJ): idebug.c $(GH) $(string__h)\
- $(ialloc_h) $(idebug_h) $(idict_h) $(iname_h) $(istack_h) $(iutil_h) $(ivmspace_h)\
- $(ostack_h) $(opdef_h) $(ipacked_h) $(store_h)
-
-idict.$(OBJ): idict.c $(GH) $(string__h) $(errors_h)\
- $(ialloc_h) $(idebug_h) $(ivmspace_h) $(inamedef_h) $(ipacked_h)\
- $(isave_h) $(store_h) $(iutil_h) $(idict_h) $(dstack_h)
-
-idparam.$(OBJ): idparam.c $(GH) $(memory__h) $(string__h) $(errors_h)\
- $(gsmatrix_h) $(gsuid_h)\
- $(idict_h) $(idparam_h) $(ilevel_h) $(imemory_h) $(iname_h) $(iutil_h)\
- $(oper_h) $(store_h)
-
-iparam.$(OBJ): iparam.c $(GH) $(memory__h) $(string__h) $(errors_h)\
- $(ialloc_h) $(idict_h) $(iname_h) $(imemory_h) $(iparam_h) $(istack_h) $(iutil_h) $(ivmspace_h)\
- $(opcheck_h) $(store_h)
-
-istack.$(OBJ): istack.c $(GH) $(memory__h) \
- $(errors_h) $(gsstruct_h) $(gsutil_h) \
- $(ialloc_h) $(istack_h) $(istruct_h) $(iutil_h) $(ivmspace_h) $(store_h)
-
-iutil.$(OBJ): iutil.c $(GH) $(math__h) $(memory__h) $(string__h)\
- $(gsccode_h) $(gsmatrix_h) $(gsutil_h) $(gxfont_h)\
- $(errors_h) $(idict_h) $(imemory_h) $(iutil_h) $(ivmspace_h)\
- $(iname_h) $(ipacked_h) $(oper_h) $(store_h)
-
-# ======================== PostScript Level 1 ======================== #
-
-###### Include files
-
-files_h=files.h
-fname_h=fname.h
-ichar_h=ichar.h
-icharout_h=icharout.h
-icolor_h=icolor.h
-icontext_h=icontext.h $(imemory_h) $(istack_h)
-icsmap_h=icsmap.h
-ifont_h=ifont.h $(gsccode_h) $(gsstruct_h)
-iht_h=iht.h
-iimage_h=iimage.h
-imain_h=imain.h $(gsexit_h)
-imainarg_h=imainarg.h
-iminst_h=iminst.h $(imain_h)
-interp_h=interp.h
-iparray_h=iparray.h
-iscannum_h=iscannum.h
-istream_h=istream.h
-main_h=main.h $(iminst_h)
-overlay_h=overlay.h
-sbwbs_h=sbwbs.h
-sfilter_h=sfilter.h $(gstypes_h)
-shcgen_h=shcgen.h
-smtf_h=smtf.h
-# Nested include files
-bfont_h=bfont.h $(ifont_h)
-ifilter_h=ifilter.h $(istream_h) $(ivmspace_h)
-igstate_h=igstate.h $(gsstate_h) $(gxstate_h) $(istruct_h)
-iscan_h=iscan.h $(sa85x_h) $(sstring_h)
-sbhc_h=sbhc.h $(shc_h)
-# Include files for optional features
-ibnum_h=ibnum.h
-
-### Initialization and scanning
-
-iconfig=iconfig$(CONFIG)
-$(iconfig).$(OBJ): iconf.c $(stdio__h) \
- $(gconfig_h) $(gscdefs_h) $(gsmemory_h) \
- $(files_h) $(iminst_h) $(iref_h) $(ivmspace_h) $(opdef_h) $(stream_h)
- $(RM_) gconfig.h
- $(RM_) $(iconfig).c
- $(CP_) $(gconfig_h) gconfig.h
- $(CP_) iconf.c $(iconfig).c
- $(CCC) $(iconfig).c
- $(RM_) gconfig.h
- $(RM_) $(iconfig).c
-
-iinit.$(OBJ): iinit.c $(GH) $(string__h)\
- $(gscdefs_h) $(gsexit_h) $(gsstruct_h)\
- $(ialloc_h) $(idict_h) $(dstack_h) $(errors_h)\
- $(ilevel_h) $(iname_h) $(interp_h) $(opdef_h)\
- $(ipacked_h) $(iparray_h) $(iutil_h) $(ivmspace_h) $(store_h)
-
-iscan.$(OBJ): iscan.c $(GH) $(memory__h)\
- $(ialloc_h) $(idict_h) $(dstack_h) $(errors_h) $(files_h)\
- $(ilevel_h) $(iutil_h) $(iscan_h) $(iscannum_h) $(istruct_h) $(ivmspace_h)\
- $(iname_h) $(ipacked_h) $(iparray_h) $(istream_h) $(ostack_h) $(store_h)\
- $(stream_h) $(strimpl_h) $(sfilter_h) $(scanchar_h)
-
-iscannum.$(OBJ): iscannum.c $(GH) $(math__h)\
- $(errors_h) $(iscannum_h) $(scanchar_h) $(scommon_h) $(store_h)
-
-### Streams
-
-sfilter1.$(OBJ): sfilter1.c $(AK) $(stdio__h) $(memory__h) \
- $(sfilter_h) $(strimpl_h)
-
-###### Operators
-
-OP=$(GH) $(errors_h) $(oper_h)
-
-### Non-graphics operators
-
-zarith.$(OBJ): zarith.c $(OP) $(math__h) $(store_h)
-
-zarray.$(OBJ): zarray.c $(OP) $(memory__h) $(ialloc_h) $(ipacked_h) $(store_h)
-
-zcontrol.$(OBJ): zcontrol.c $(OP) $(string__h)\
- $(estack_h) $(files_h) $(ipacked_h) $(iutil_h) $(store_h) $(stream_h)
-
-zdict.$(OBJ): zdict.c $(OP) \
- $(dstack_h) $(idict_h) $(ilevel_h) $(iname_h) $(ipacked_h) $(ivmspace_h) \
- $(store_h)
-
-zfile.$(OBJ): zfile.c $(OP) $(memory__h) $(string__h) $(gp_h)\
- $(gsstruct_h) $(gxiodev_h) \
- $(ialloc_h) $(estack_h) $(files_h) $(fname_h) $(ilevel_h) $(interp_h) $(iutil_h)\
- $(isave_h) $(main_h) $(sfilter_h) $(stream_h) $(strimpl_h) $(store_h)
-
-zfileio.$(OBJ): zfileio.c $(OP) $(gp_h) \
- $(files_h) $(ifilter_h) $(store_h) $(stream_h) $(strimpl_h) \
- $(gsmatrix_h) $(gxdevice_h) $(gxdevmem_h)
-
-zfilter.$(OBJ): zfilter.c $(OP) $(memory__h)\
- $(gsstruct_h) $(files_h) $(ialloc_h) $(idict_h) $(idparam_h) $(ifilter_h) \
- $(sfilter_h) $(srlx_h) $(sstring_h) $(store_h) $(stream_h) $(strimpl_h)
-
-zfname.$(OBJ): zfname.c $(OP) $(memory__h)\
- $(fname_h) $(gxiodev_h) $(ialloc_h) $(stream_h)
-
-zfproc.$(OBJ): zfproc.c $(GH) $(memory__h)\
- $(errors_h) $(oper_h)\
- $(estack_h) $(files_h) $(gsstruct_h) $(ialloc_h) $(ifilter_h) $(istruct_h)\
- $(store_h) $(stream_h) $(strimpl_h)
-
-zgeneric.$(OBJ): zgeneric.c $(OP) $(memory__h)\
- $(idict_h) $(estack_h) $(ivmspace_h) $(iname_h) $(ipacked_h) $(store_h)
-
-ziodev.$(OBJ): ziodev.c $(OP) $(memory__h) $(stdio__h) $(string__h)\
- $(gp_h) $(gpcheck_h)\
- $(gsstruct_h) $(gxiodev_h)\
- $(files_h) $(ialloc_h) $(ivmspace_h) $(store_h) $(stream_h)
-
-zmath.$(OBJ): zmath.c $(OP) $(math__h) $(gxfarith_h) $(store_h)
-
-zmisc.$(OBJ): zmisc.c $(OP) $(gscdefs_h) $(gp_h) \
- $(errno__h) $(memory__h) $(string__h) \
- $(ialloc_h) $(idict_h) $(dstack_h) $(iname_h) $(ivmspace_h) $(ipacked_h) $(store_h)
-
-zpacked.$(OBJ): zpacked.c $(OP) \
- $(ialloc_h) $(idict_h) $(ivmspace_h) $(iname_h) $(ipacked_h) $(iparray_h) \
- $(istack_h) $(store_h)
-
-zrelbit.$(OBJ): zrelbit.c $(OP) $(gsutil_h) $(store_h) $(idict_h)
-
-zstack.$(OBJ): zstack.c $(OP) $(memory__h)\
- $(ialloc_h) $(istack_h) $(store_h)
-
-zstring.$(OBJ): zstring.c $(OP) $(memory__h)\
- $(gsutil_h)\
- $(ialloc_h) $(iname_h) $(ivmspace_h) $(store_h)
-
-zsysvm.$(OBJ): zsysvm.c $(GH)\
- $(ialloc_h) $(ivmspace_h) $(oper_h) $(store_h)
-
-ztoken.$(OBJ): ztoken.c $(OP) \
- $(estack_h) $(files_h) $(gsstruct_h) $(iscan_h) \
- $(sfilter_h) $(store_h) $(stream_h) $(strimpl_h)
-
-ztype.$(OBJ): ztype.c $(OP) $(math__h) $(memory__h) $(string__h)\
- $(dstack_h) $(idict_h) $(imemory_h) $(iname_h)\
- $(iscan_h) $(iutil_h) $(sfilter_h) $(store_h) $(stream_h) $(strimpl_h)
-
-zvmem.$(OBJ): zvmem.c $(OP)\
- $(dstack_h) $(estack_h) $(files_h)\
- $(ialloc_h) $(idict_h) $(igstate_h) $(isave_h) $(store_h) $(stream_h)\
- $(gsmatrix_h) $(gsstate_h) $(gsstruct_h)
-
-### Graphics operators
-
-zchar.$(OBJ): zchar.c $(OP)\
- $(gsstruct_h) $(gxarith_h) $(gxfixed_h) $(gxmatrix_h)\
- $(gxchar_h) $(gxdevice_h) $(gxfont_h) $(gzpath_h) $(gzstate_h)\
- $(dstack_h) $(estack_h) $(ialloc_h) $(ichar_h) $(idict_h) $(ifont_h)\
- $(ilevel_h) $(iname_h) $(igstate_h) $(ipacked_h) $(store_h)
-
-# zcharout is used for Type 1 and Type 42 fonts only.
-zcharout.$(OBJ): zcharout.c $(OP)\
- $(gschar_h) $(gxdevice_h) $(gxfont_h)\
- $(dstack_h) $(estack_h) $(ichar_h) $(icharout_h)\
- $(idict_h) $(ifont_h) $(igstate_h) $(store_h)
-
-zcolor.$(OBJ): zcolor.c $(OP) \
- $(gxfixed_h) $(gxmatrix_h) $(gzstate_h) $(gxdevice_h) $(gxcmap_h) \
- $(ialloc_h) $(icolor_h) $(estack_h) $(iutil_h) $(igstate_h) $(store_h)
-
-zdevice.$(OBJ): zdevice.c $(OP) $(string__h)\
- $(ialloc_h) $(idict_h) $(igstate_h) $(iname_h) $(interp_h) $(iparam_h) $(ivmspace_h)\
- $(gsmatrix_h) $(gsstate_h) $(gxdevice_h) $(store_h)
-
-zfont.$(OBJ): zfont.c $(OP)\
- $(gschar_h) $(gsstruct_h) $(gxdevice_h) $(gxfont_h) $(gxfcache_h)\
- $(gzstate_h)\
- $(ialloc_h) $(idict_h) $(igstate_h) $(iname_h) $(isave_h) $(ivmspace_h)\
- $(bfont_h) $(store_h)
-
-zfont2.$(OBJ): zfont2.c $(OP) $(memory__h) $(string__h)\
- $(gsmatrix_h) $(gxdevice_h) $(gschar_h) $(gxfixed_h) $(gxfont_h)\
- $(ialloc_h) $(bfont_h) $(idict_h) $(idparam_h) $(ilevel_h) $(iname_h) $(istruct_h)\
- $(ipacked_h) $(store_h)
-
-zgstate.$(OBJ): zgstate.c $(OP) $(math__h)\
- $(gsmatrix_h) $(ialloc_h) $(idict_h) $(igstate_h) $(istruct_h) $(store_h)
-
-zht.$(OBJ): zht.c $(OP) $(memory__h)\
- $(gsmatrix_h) $(gsstate_h) $(gsstruct_h) $(gxdevice_h) $(gzht_h) \
- $(ialloc_h) $(estack_h) $(igstate_h) $(iht_h) $(store_h)
-
-zimage.$(OBJ): zimage.c $(OP) \
- $(estack_h) $(ialloc_h) $(ifilter_h) $(igstate_h) $(iimage_h) $(ilevel_h) \
- $(gscspace_h) $(gsimage_h) $(gsmatrix_h) $(gsstruct_h) \
- $(store_h) $(stream_h)
-
-zmatrix.$(OBJ): zmatrix.c $(OP)\
- $(gsmatrix_h) $(igstate_h) $(gscoord_h) $(store_h)
-
-zpaint.$(OBJ): zpaint.c $(OP)\
- $(gspaint_h) $(igstate_h)
-
-zpath.$(OBJ): zpath.c $(OP) $(math__h) \
- $(gsmatrix_h) $(gspath_h) $(igstate_h) $(store_h)
-
-# Define the base PostScript language interpreter.
-# This is the subset of PostScript Level 1 required by our PDF reader.
-
-INT1=idebug.$(OBJ) idict.$(OBJ) idparam.$(OBJ)
-INT2=iinit.$(OBJ) interp.$(OBJ) iparam.$(OBJ) ireclaim.$(OBJ)
-INT3=iscan.$(OBJ) iscannum.$(OBJ) istack.$(OBJ) iutil.$(OBJ)
-INT4=scantab.$(OBJ) sfilter1.$(OBJ) sstring.$(OBJ) stream.$(OBJ)
-Z1=zarith.$(OBJ) zarray.$(OBJ) zcontrol.$(OBJ) zdict.$(OBJ)
-Z1OPS=zarith zarray zcontrol zdict
-Z2=zfile.$(OBJ) zfileio.$(OBJ) zfilter.$(OBJ) zfname.$(OBJ) zfproc.$(OBJ)
-Z2OPS=zfile zfileio zfilter zfproc
-Z3=zgeneric.$(OBJ) ziodev.$(OBJ) zmath.$(OBJ) zmisc.$(OBJ) zpacked.$(OBJ)
-Z3OPS=zgeneric ziodev zmath zmisc zpacked
-Z4=zrelbit.$(OBJ) zstack.$(OBJ) zstring.$(OBJ) zsysvm.$(OBJ)
-Z4OPS=zrelbit zstack zstring zsysvm
-Z5=ztoken.$(OBJ) ztype.$(OBJ) zvmem.$(OBJ)
-Z5OPS=ztoken ztype zvmem
-Z6=zchar.$(OBJ) zcolor.$(OBJ) zdevice.$(OBJ) zfont.$(OBJ) zfont2.$(OBJ)
-Z6OPS=zchar zcolor zdevice zfont zfont2
-Z7=zgstate.$(OBJ) zht.$(OBJ) zimage.$(OBJ) zmatrix.$(OBJ) zpaint.$(OBJ) zpath.$(OBJ)
-Z7OPS=zgstate zht zimage zmatrix zpaint zpath
-# We have to be a little underhanded with *config.$(OBJ) so as to avoid
-# circular definitions.
-INT_OBJS=imainarg.$(OBJ) gsargs.$(OBJ) imain.$(OBJ) \
- $(INT1) $(INT2) $(INT3) $(INT4) \
- $(Z1) $(Z2) $(Z3) $(Z4) $(Z5) $(Z6) $(Z7)
-INT_CONFIG=$(gconfig).$(OBJ) $(gscdefs).$(OBJ) $(iconfig).$(OBJ) \
- iccinit$(COMPILE_INITS).$(OBJ)
-INT_ALL=$(INT_OBJS) $(INT_CONFIG)
-# We omit libcore.dev, which should be included here, because problems
-# with the Unix linker require libcore to appear last in the link list
-# when libcore is really a library.
-# We omit $(INT_CONFIG) from the dependency list because they have special
-# dependency requirements and are added to the link list at the very end.
-# zfilter.c shouldn't include the RLE and RLD filters, but we don't want to
-# change this now.
-psbase.dev: $(INT_MAK) $(ECHOGS_XE) $(INT_OBJS)\
- isupport.dev rld.dev rle.dev sfile.dev
- $(SETMOD) psbase imainarg.$(OBJ) gsargs.$(OBJ) imain.$(OBJ)
- $(ADDMOD) psbase -obj $(INT_CONFIG)
- $(ADDMOD) psbase -obj $(INT1)
- $(ADDMOD) psbase -obj $(INT2)
- $(ADDMOD) psbase -obj $(INT3)
- $(ADDMOD) psbase -obj $(INT4)
- $(ADDMOD) psbase -obj $(Z1)
- $(ADDMOD) psbase -oper $(Z1OPS)
- $(ADDMOD) psbase -obj $(Z2)
- $(ADDMOD) psbase -oper $(Z2OPS)
- $(ADDMOD) psbase -obj $(Z3)
- $(ADDMOD) psbase -oper $(Z3OPS)
- $(ADDMOD) psbase -obj $(Z4)
- $(ADDMOD) psbase -oper $(Z4OPS)
- $(ADDMOD) psbase -obj $(Z5)
- $(ADDMOD) psbase -oper $(Z5OPS)
- $(ADDMOD) psbase -obj $(Z6)
- $(ADDMOD) psbase -oper $(Z6OPS)
- $(ADDMOD) psbase -obj $(Z7)
- $(ADDMOD) psbase -oper $(Z7OPS)
- $(ADDMOD) psbase -iodev stdin stdout stderr lineedit statementedit
- $(ADDMOD) psbase -include isupport rld rle sfile
-
-# -------------------------- Feature definitions -------------------------- #
-
-# ---------------- Full Level 1 interpreter ---------------- #
-
-level1.dev: $(INT_MAK) $(ECHOGS_XE) psbase.dev bcp.dev hsb.dev path1.dev type1.dev
- $(SETMOD) level1 -include psbase bcp hsb path1 type1
- $(ADDMOD) level1 -emulator PostScript PostScriptLevel1
-
-# -------- Level 1 color extensions (CMYK color and colorimage) -------- #
-
-color.dev: $(INT_MAK) $(ECHOGS_XE) cmyklib.dev colimlib.dev cmykread.dev
- $(SETMOD) color -include cmyklib colimlib cmykread
-
-cmykread_=zcolor1.$(OBJ) zht1.$(OBJ)
-cmykread.dev: $(INT_MAK) $(ECHOGS_XE) $(cmykread_)
- $(SETMOD) cmykread $(cmykread_)
- $(ADDMOD) cmykread -oper zcolor1 zht1
-
-zcolor1.$(OBJ): zcolor1.c $(OP) \
- $(gscolor1_h) \
- $(gxcmap_h) $(gxcspace_h) $(gxdevice_h) $(gxfixed_h) $(gxmatrix_h) \
- $(gzstate_h) \
- $(ialloc_h) $(icolor_h) $(iimage_h) $(estack_h) $(iutil_h) $(igstate_h) $(store_h)
-
-zht1.$(OBJ): zht1.c $(OP) $(memory__h)\
- $(gsmatrix_h) $(gsstate_h) $(gsstruct_h) $(gxdevice_h) $(gzht_h)\
- $(ialloc_h) $(estack_h) $(igstate_h) $(iht_h) $(store_h)
-
-# ---------------- HSB color ---------------- #
-
-hsb_=zhsb.$(OBJ)
-hsb.dev: $(INT_MAK) $(ECHOGS_XE) $(hsb_) hsblib.dev
- $(SETMOD) hsb $(hsb_)
- $(ADDMOD) hsb -include hsblib
- $(ADDMOD) hsb -oper zhsb
-
-zhsb.$(OBJ): zhsb.c $(OP) \
- $(gshsb_h) $(igstate_h) $(store_h)
-
-# ---- Level 1 path miscellany (arcs, pathbbox, path enumeration) ---- #
-
-path1_=zpath1.$(OBJ)
-path1.dev: $(INT_MAK) $(ECHOGS_XE) $(path1_) path1lib.dev
- $(SETMOD) path1 $(path1_)
- $(ADDMOD) path1 -include path1lib
- $(ADDMOD) path1 -oper zpath1
-
-zpath1.$(OBJ): zpath1.c $(OP) $(memory__h)\
- $(ialloc_h) $(estack_h) $(gspath_h) $(gsstruct_h) $(igstate_h) $(store_h)
-
-# ================ Level-independent PostScript options ================ #
-
-# ---------------- BCP filters ---------------- #
-
-bcp_=sbcp.$(OBJ) zfbcp.$(OBJ)
-bcp.dev: $(INT_MAK) $(ECHOGS_XE) $(bcp_)
- $(SETMOD) bcp $(bcp_)
- $(ADDMOD) bcp -oper zfbcp
-
-sbcp.$(OBJ): sbcp.c $(AK) $(stdio__h) \
- $(sfilter_h) $(strimpl_h)
-
-zfbcp.$(OBJ): zfbcp.c $(OP) $(memory__h)\
- $(gsstruct_h) $(ialloc_h) $(ifilter_h)\
- $(sfilter_h) $(stream_h) $(strimpl_h)
-
-# ---------------- Incremental font loading ---------------- #
-# (This only works for Type 1 fonts without eexec encryption.)
-
-diskfont.dev: $(INT_MAK) $(ECHOGS_XE)
- $(SETMOD) diskfont -ps gs_diskf
-
-# ---------------- Double-precision floats ---------------- #
-
-double_=zdouble.$(OBJ)
-double.dev: $(INT_MAK) $(ECHOGS_XE) $(double_)
- $(SETMOD) double $(double_)
- $(ADDMOD) double -oper zdouble
-
-zdouble.$(OBJ): zdouble.c $(OP) $(ctype__h) $(math__h) $(memory__h) $(string__h) \
- $(gxfarith_h) $(store_h)
-
-# ---------------- EPSF files with binary headers ---------------- #
-
-epsf.dev: $(INT_MAK) $(ECHOGS_XE)
- $(SETMOD) epsf -ps gs_epsf
-
-# ---------------- RasterOp ---------------- #
-# This should be a separable feature in the core also....
-
-rasterop.dev: $(INT_MAK) $(ECHOGS_XE) roplib.dev ropread.dev
- $(SETMOD) rasterop -include roplib ropread
-
-ropread_=zrop.$(OBJ)
-ropread.dev: $(INT_MAK) $(ECHOGS_XE) $(ropread_)
- $(SETMOD) ropread $(ropread_)
- $(ADDMOD) ropread -oper zrop
-
-zrop.$(OBJ): zrop.c $(OP) $(memory__h)\
- $(gsrop_h) $(gsutil_h) $(gxdevice_h)\
- $(idict_h) $(idparam_h) $(igstate_h) $(store_h)
-
-# ---------------- PostScript Type 1 (and Type 4) fonts ---------------- #
-
-type1.dev: $(INT_MAK) $(ECHOGS_XE) psf1lib.dev psf1read.dev
- $(SETMOD) type1 -include psf1lib psf1read
-
-psf1read_=seexec.$(OBJ) zchar1.$(OBJ) zcharout.$(OBJ) zfont1.$(OBJ) zmisc1.$(OBJ)
-psf1read.dev: $(INT_MAK) $(ECHOGS_XE) $(psf1read_)
- $(SETMOD) psf1read $(psf1read_)
- $(ADDMOD) psf1read -oper zchar1 zfont1 zmisc1
- $(ADDMOD) psf1read -ps gs_type1
-
-seexec.$(OBJ): seexec.c $(AK) $(stdio__h) \
- $(gscrypt1_h) $(scanchar_h) $(sfilter_h) $(strimpl_h)
-
-zchar1.$(OBJ): zchar1.c $(OP) \
- $(gspaint_h) $(gspath_h) $(gsstruct_h) \
- $(gxchar_h) $(gxdevice_h) $(gxfixed_h) $(gxmatrix_h) \
- $(gxfont_h) $(gxfont1_h) $(gxtype1_h) $(gzstate_h) \
- $(estack_h) $(ialloc_h) $(ichar_h) $(icharout_h) \
- $(idict_h) $(ifont_h) $(igstate_h) $(store_h)
-
-zfont1.$(OBJ): zfont1.c $(OP) \
- $(gsmatrix_h) $(gxdevice_h) $(gschar_h) \
- $(gxfixed_h) $(gxfont_h) $(gxfont1_h) \
- $(bfont_h) $(ialloc_h) $(idict_h) $(idparam_h) $(store_h)
-
-zmisc1.$(OBJ): zmisc1.c $(OP) $(memory__h)\
- $(gscrypt1_h)\
- $(idict_h) $(idparam_h) $(ifilter_h)\
- $(sfilter_h) $(stream_h) $(strimpl_h)
-
-# -------------- Compact Font Format and Type 2 charstrings ------------- #
-
-cff.dev: $(INT_MAK) $(ECHOGS_XE) gs_cff.ps psl2int.dev
- $(SETMOD) cff -ps gs_cff
-
-type2.dev: $(INT_MAK) $(ECHOGS_XE) type1.dev psf2lib.dev
- $(SETMOD) type2 -include psf2lib
-
-# ---------------- TrueType and PostScript Type 42 fonts ---------------- #
-
-# Native TrueType support
-ttfont.dev: $(INT_MAK) $(ECHOGS_XE) type42.dev
- $(SETMOD) ttfont -include type42
- $(ADDMOD) ttfont -ps gs_mro_e gs_wan_e gs_ttf
-
-# Type 42 (embedded TrueType) support
-type42read_=zchar42.$(OBJ) zcharout.$(OBJ) zfont42.$(OBJ)
-type42.dev: $(INT_MAK) $(ECHOGS_XE) $(type42read_) ttflib.dev
- $(SETMOD) type42 $(type42read_)
- $(ADDMOD) type42 -include ttflib
- $(ADDMOD) type42 -oper zchar42 zfont42
- $(ADDMOD) type42 -ps gs_typ42
-
-zchar42.$(OBJ): zchar42.c $(OP) \
- $(gsmatrix_h) $(gspaint_h) $(gspath_h) \
- $(gxfixed_h) $(gxchar_h) $(gxfont_h) $(gxfont42_h) \
- $(gxistate_h) $(gxpath_h) $(gzstate_h) \
- $(dstack_h) $(estack_h) $(ichar_h) $(icharout_h) \
- $(ifont_h) $(igstate_h) $(store_h)
-
-zfont42.$(OBJ): zfont42.c $(OP) \
- $(gsccode_h) $(gsmatrix_h) $(gxfont_h) $(gxfont42_h) \
- $(bfont_h) $(idict_h) $(idparam_h) $(store_h)
-
-# ======================== Precompilation options ======================== #
-
-# ---------------- Precompiled fonts ---------------- #
-# See fonts.txt for more information.
-
-ccfont_h=ccfont.h $(std_h) $(gsmemory_h) $(iref_h) $(ivmspace_h) $(store_h)
-
-CCFONT=$(OP) $(ccfont_h)
-
-# List the fonts we are going to compile.
-# Because of intrinsic limitations in `make', we have to list
-# the object file names and the font names separately.
-# Because of limitations in the DOS shell, we have to break the fonts up
-# into lists that will fit on a single line (120 characters).
-# The rules for constructing the .c files from the fonts themselves,
-# and for compiling the .c files, are in cfonts.mak, not here.
-# For example, to compile the Courier fonts, you should invoke
-# make -f cfonts.mak Courier_o
-# By convention, the names of the 35 standard compiled fonts use '0' for
-# the foundry name. This allows users to substitute different foundries
-# without having to change this makefile.
-ccfonts_ps=gs_ccfnt
-ccfonts1_=0agk.$(OBJ) 0agko.$(OBJ) 0agd.$(OBJ) 0agdo.$(OBJ)
-ccfonts1=agk agko agd agdo
-ccfonts2_=0bkl.$(OBJ) 0bkli.$(OBJ) 0bkd.$(OBJ) 0bkdi.$(OBJ)
-ccfonts2=bkl bkli bkd bkdi
-ccfonts3_=0crr.$(OBJ) 0cri.$(OBJ) 0crb.$(OBJ) 0crbi.$(OBJ)
-ccfonts3=crr cri crb crbi
-ccfonts4_=0hvr.$(OBJ) 0hvro.$(OBJ) 0hvb.$(OBJ) 0hvbo.$(OBJ)
-ccfonts4=hvr hvro hvb hvbo
-ccfonts5_=0hvrrn.$(OBJ) 0hvrorn.$(OBJ) 0hvbrn.$(OBJ) 0hvborn.$(OBJ)
-ccfonts5=hvrrn hvrorn hvbrn hvborn
-ccfonts6_=0ncr.$(OBJ) 0ncri.$(OBJ) 0ncb.$(OBJ) 0ncbi.$(OBJ)
-ccfonts6=ncr ncri ncb ncbi
-ccfonts7_=0plr.$(OBJ) 0plri.$(OBJ) 0plb.$(OBJ) 0plbi.$(OBJ)
-ccfonts7=plr plri plb plbi
-ccfonts8_=0tmr.$(OBJ) 0tmri.$(OBJ) 0tmb.$(OBJ) 0tmbi.$(OBJ)
-ccfonts8=tmr tmri tmb tmbi
-ccfonts9_=0syr.$(OBJ) 0zcmi.$(OBJ) 0zdr.$(OBJ)
-ccfonts9=syr zcmi zdr
-# The free distribution includes Bitstream Charter, Utopia, and
-# freeware Cyrillic and Kana fonts. We only provide for compiling
-# Charter and Utopia.
-ccfonts10free_=bchr.$(OBJ) bchri.$(OBJ) bchb.$(OBJ) bchbi.$(OBJ)
-ccfonts10free=chr chri chb chbi
-ccfonts11free_=putr.$(OBJ) putri.$(OBJ) putb.$(OBJ) putbi.$(OBJ)
-ccfonts11free=utr utri utb utbi
-# Uncomment the alternatives in the next 4 lines if you want
-# Charter and Utopia compiled in.
-#ccfonts10_=$(ccfonts10free_)
-ccfonts10_=
-#ccfonts10=$(ccfonts10free)
-ccfonts10=
-#ccfonts11_=$(ccfonts11free_)
-ccfonts11_=
-#ccfonts11=$(ccfonts11free)
-ccfonts11=
-# Add your own fonts here if desired.
-ccfonts12_=
-ccfonts12=
-ccfonts13_=
-ccfonts13=
-ccfonts14_=
-ccfonts14=
-ccfonts15_=
-ccfonts15=
-
-# It's OK for ccfonts_.dev not to be CONFIG-dependent, because it only
-# exists during the execution of the following rule.
-# font2c has the prefix "gs" built into it, so we need to instruct
-# genconf to use the same one.
-$(gconfigf_h): $(MAKEFILE) $(INT_MAK) $(GENCONF_XE)
- $(SETMOD) ccfonts_ -font $(ccfonts1)
- $(ADDMOD) ccfonts_ -font $(ccfonts2)
- $(ADDMOD) ccfonts_ -font $(ccfonts3)
- $(ADDMOD) ccfonts_ -font $(ccfonts4)
- $(ADDMOD) ccfonts_ -font $(ccfonts5)
- $(ADDMOD) ccfonts_ -font $(ccfonts6)
- $(ADDMOD) ccfonts_ -font $(ccfonts7)
- $(ADDMOD) ccfonts_ -font $(ccfonts8)
- $(ADDMOD) ccfonts_ -font $(ccfonts9)
- $(ADDMOD) ccfonts_ -font $(ccfonts10)
- $(ADDMOD) ccfonts_ -font $(ccfonts11)
- $(ADDMOD) ccfonts_ -font $(ccfonts12)
- $(ADDMOD) ccfonts_ -font $(ccfonts13)
- $(ADDMOD) ccfonts_ -font $(ccfonts14)
- $(ADDMOD) ccfonts_ -font $(ccfonts15)
- $(EXP)genconf ccfonts_.dev -n gs -f $(gconfigf_h)
-
-# We separate icfontab.dev from ccfonts.dev so that a customer can put
-# compiled fonts into a separate shared library.
-
-icfontab=icfontab$(CONFIG)
-
-# Define ccfont_table separately, so it can be set from the command line
-# to select an alternate compiled font table.
-ccfont_table=$(icfontab)
-
-$(icfontab).dev: $(MAKEFILE) $(INT_MAK) $(ECHOGS_XE) $(icfontab).$(OBJ) \
- $(ccfonts1_) $(ccfonts2_) $(ccfonts3_) $(ccfonts4_) $(ccfonts5_) \
- $(ccfonts6_) $(ccfonts7_) $(ccfonts8_) $(ccfonts9_) $(ccfonts10_) \
- $(ccfonts11_) $(ccfonts12_) $(ccfonts13_) $(ccfonts14_) $(ccfonts15_)
- $(SETMOD) $(icfontab) -obj $(icfontab).$(OBJ)
- $(ADDMOD) $(icfontab) -obj $(ccfonts1_)
- $(ADDMOD) $(icfontab) -obj $(ccfonts2_)
- $(ADDMOD) $(icfontab) -obj $(ccfonts3_)
- $(ADDMOD) $(icfontab) -obj $(ccfonts4_)
- $(ADDMOD) $(icfontab) -obj $(ccfonts5_)
- $(ADDMOD) $(icfontab) -obj $(ccfonts6_)
- $(ADDMOD) $(icfontab) -obj $(ccfonts7_)
- $(ADDMOD) $(icfontab) -obj $(ccfonts8_)
- $(ADDMOD) $(icfontab) -obj $(ccfonts9_)
- $(ADDMOD) $(icfontab) -obj $(ccfonts10_)
- $(ADDMOD) $(icfontab) -obj $(ccfonts11_)
- $(ADDMOD) $(icfontab) -obj $(ccfonts12_)
- $(ADDMOD) $(icfontab) -obj $(ccfonts13_)
- $(ADDMOD) $(icfontab) -obj $(ccfonts14_)
- $(ADDMOD) $(icfontab) -obj $(ccfonts15_)
-
-$(icfontab).$(OBJ): icfontab.c $(AK) $(ccfont_h) $(gconfigf_h)
- $(CP_) $(gconfigf_h) gconfigf.h
- $(CCCF) icfontab.c
-
-# Strictly speaking, ccfonts shouldn't need to include type1,
-# since one could choose to precompile only Type 0 fonts,
-# but getting this exactly right would be too much work.
-ccfonts=ccfonts$(CONFIG)
-$(ccfonts).dev: $(MAKEFILE) $(INT_MAK) type1.dev iccfont.$(OBJ) \
- $(ccfont_table).dev
- $(SETMOD) $(ccfonts) -include type1
- $(ADDMOD) $(ccfonts) -include $(ccfont_table)
- $(ADDMOD) $(ccfonts) -obj iccfont.$(OBJ)
- $(ADDMOD) $(ccfonts) -oper ccfonts
- $(ADDMOD) $(ccfonts) -ps $(ccfonts_ps)
-
-iccfont.$(OBJ): iccfont.c $(GH) $(string__h)\
- $(gsstruct_h) $(ccfont_h) $(errors_h)\
- $(ialloc_h) $(idict_h) $(ifont_h) $(iname_h) $(isave_h) $(iutil_h)\
- $(oper_h) $(ostack_h) $(store_h) $(stream_h) $(strimpl_h) $(sfilter_h) $(iscan_h)
- $(CCCF) iccfont.c
-
-# ---------------- Compiled initialization code ---------------- #
-
-# We select either iccinit0 or iccinit1 depending on COMPILE_INITS.
-
-iccinit0.$(OBJ): iccinit0.c $(stdpre_h)
- $(CCCF) iccinit0.c
-
-iccinit1.$(OBJ): gs_init.$(OBJ)
- $(CP_) gs_init.$(OBJ) iccinit1.$(OBJ)
-
-# All the gs_*.ps files should be prerequisites of gs_init.c,
-# but we don't have any convenient list of them.
-gs_init.c: $(GS_INIT) $(GENINIT_XE) $(gconfig_h)
- $(EXP)geninit $(GS_INIT) $(gconfig_h) -c gs_init.c
-
-gs_init.$(OBJ): gs_init.c $(stdpre_h)
- $(CCCF) gs_init.c
-
-# ======================== PostScript Level 2 ======================== #
-
-level2.dev: $(INT_MAK) $(ECHOGS_XE) \
- cidfont.dev cie.dev cmapread.dev compfont.dev dct.dev devctrl.dev dpsand2.dev\
- filter.dev level1.dev pattern.dev psl2lib.dev psl2read.dev sepr.dev\
- type42.dev xfilter.dev
- $(SETMOD) level2 -include cidfont cie cmapread compfont
- $(ADDMOD) level2 -include dct devctrl dpsand2 filter
- $(ADDMOD) level2 -include level1 pattern psl2lib psl2read
- $(ADDMOD) level2 -include sepr type42 xfilter
- $(ADDMOD) level2 -emulator PostScript PostScriptLevel2
-
-# Define basic Level 2 language support.
-# This is the minimum required for CMap and CIDFont support.
-
-psl2int_=iutil2.$(OBJ) zmisc2.$(OBJ) zusparam.$(OBJ)
-psl2int.dev: $(INT_MAK) $(ECHOGS_XE) $(psl2int_) dps2int.dev
- $(SETMOD) psl2int $(psl2int_)
- $(ADDMOD) psl2int -include dps2int
- $(ADDMOD) psl2int -oper zmisc2 zusparam
- $(ADDMOD) psl2int -ps gs_lev2 gs_res
-
-iutil2.$(OBJ): iutil2.c $(GH) $(memory__h) $(string__h)\
- $(gsparam_h) $(gsutil_h)\
- $(errors_h) $(opcheck_h) $(imemory_h) $(iutil_h) $(iutil2_h)
-
-zmisc2.$(OBJ): zmisc2.c $(OP) $(memory__h) $(string__h)\
- $(idict_h) $(idparam_h) $(iparam_h) $(dstack_h) $(estack_h)\
- $(ilevel_h) $(iname_h) $(iutil2_h) $(ivmspace_h) $(store_h)
-
-# Note that zusparam includes both Level 1 and Level 2 operators.
-zusparam.$(OBJ): zusparam.c $(OP) $(memory__h) $(string__h)\
- $(gscdefs_h) $(gsfont_h) $(gsstruct_h) $(gsutil_h) $(gxht_h)\
- $(ialloc_h) $(idict_h) $(idparam_h) $(iparam_h) $(dstack_h) $(estack_h)\
- $(iname_h) $(iutil2_h) $(store_h)
-
-# Define full Level 2 support.
-
-psl2read_=zcolor2.$(OBJ) zcsindex.$(OBJ) zht2.$(OBJ) zimage2.$(OBJ)
-# Note that zmisc2 includes both Level 1 and Level 2 operators.
-psl2read.dev: $(INT_MAK) $(ECHOGS_XE) $(psl2read_) psl2int.dev dps2read.dev
- $(SETMOD) psl2read $(psl2read_)
- $(ADDMOD) psl2read -include psl2int dps2read
- $(ADDMOD) psl2read -oper zcolor2_l2 zcsindex_l2
- $(ADDMOD) psl2read -oper zht2_l2 zimage2_l2
-
-zcolor2.$(OBJ): zcolor2.c $(OP)\
- $(gscolor_h) $(gsmatrix_h) $(gsstruct_h)\
- $(gxcolor2_h) $(gxcspace_h) $(gxdcolor_h) $(gxdevice_h) $(gxdevmem_h) $(gxfixed_h) $(gxpcolor_h)\
- $(estack_h) $(ialloc_h) $(idict_h) $(idparam_h) $(igstate_h) $(istruct_h)\
- $(store_h)
-
-zcsindex.$(OBJ): zcsindex.c $(OP) $(memory__h) \
- $(gscolor_h) $(gsstruct_h) $(gxfixed_h) $(gxcolor2_h) $(gxcspace_h) $(gsmatrix_h) \
- $(ialloc_h) $(icsmap_h) $(estack_h) $(igstate_h) $(ivmspace_h) $(store_h)
-
-zht2.$(OBJ): zht2.c $(OP) \
- $(gsstruct_h) $(gxdevice_h) $(gzht_h) \
- $(estack_h) $(ialloc_h) $(icolor_h) $(idict_h) $(idparam_h) $(igstate_h) \
- $(iht_h) $(store_h)
-
-zimage2.$(OBJ): zimage2.c $(OP) $(math__h) $(memory__h)\
- $(gscolor_h) $(gscolor2_h) $(gscspace_h) $(gsimage_h) $(gsmatrix_h)\
- $(idict_h) $(idparam_h) $(iimage_h) $(ilevel_h) $(igstate_h)
-
-# ---------------- Device control ---------------- #
-# This is a catch-all for setpagedevice and IODevices.
-
-devctrl_=zdevice2.$(OBJ) ziodev2.$(OBJ) zmedia2.$(OBJ) zdevcal.$(OBJ)
-devctrl.dev: $(INT_MAK) $(ECHOGS_XE) $(devctrl_)
- $(SETMOD) devctrl $(devctrl_)
- $(ADDMOD) devctrl -oper zdevice2_l2 ziodev2_l2 zmedia2_l2
- $(ADDMOD) devctrl -iodev null ram calendar
- $(ADDMOD) devctrl -ps gs_setpd
-
-zdevice2.$(OBJ): zdevice2.c $(OP) $(math__h) $(memory__h)\
- $(dstack_h) $(estack_h) $(idict_h) $(idparam_h) $(igstate_h) $(iname_h) $(store_h)\
- $(gxdevice_h) $(gsstate_h)
-
-ziodev2.$(OBJ): ziodev2.c $(OP) $(string__h) $(gp_h)\
- $(gxiodev_h) $(stream_h) $(files_h) $(iparam_h) $(iutil2_h) $(store_h)
-
-zmedia2.$(OBJ): zmedia2.c $(OP) $(math__h) $(memory__h) \
- $(gsmatrix_h) $(idict_h) $(idparam_h) $(iname_h) $(store_h)
-
-zdevcal.$(OBJ): zdevcal.c $(GH) $(time__h) \
- $(gxiodev_h) $(iparam_h) $(istack_h)
-
-# ---------------- Filters other than the ones in sfilter.c ---------------- #
-
-# Standard Level 2 decoding filters only. The PDF configuration uses this.
-fdecode_=scantab.$(OBJ) sfilter2.$(OBJ) zfdecode.$(OBJ)
-fdecode.dev: $(INT_MAK) $(ECHOGS_XE) $(fdecode_) cfd.dev lzwd.dev pdiff.dev pngp.dev rld.dev
- $(SETMOD) fdecode $(fdecode_)
- $(ADDMOD) fdecode -include cfd lzwd pdiff pngp rld
- $(ADDMOD) fdecode -oper zfdecode
-
-zfdecode.$(OBJ): zfdecode.c $(OP) $(memory__h)\
- $(gsstruct_h) $(ialloc_h) $(idict_h) $(idparam_h) $(ifilter_h) \
- $(sa85x_h) $(scf_h) $(scfx_h) $(sfilter_h) $(slzwx_h) $(spdiffx_h) $(spngpx_h) \
- $(store_h) $(stream_h) $(strimpl_h)
-
-# Complete Level 2 filter capability.
-filter_=zfilter2.$(OBJ)
-filter.dev: $(INT_MAK) $(ECHOGS_XE) fdecode.dev $(filter_) cfe.dev lzwe.dev rle.dev
- $(SETMOD) filter -include fdecode
- $(ADDMOD) filter -obj $(filter_)
- $(ADDMOD) filter -include cfe lzwe rle
- $(ADDMOD) filter -oper zfilter2
-
-zfilter2.$(OBJ): zfilter2.c $(OP) $(memory__h)\
- $(gsstruct_h) $(ialloc_h) $(idict_h) $(idparam_h) $(ifilter_h) $(store_h) \
- $(sfilter_h) $(scfx_h) $(slzwx_h) $(spdiffx_h) $(spngpx_h) $(strimpl_h)
-
-# Extensions beyond Level 2 standard.
-xfilter_=sbhc.$(OBJ) sbwbs.$(OBJ) shcgen.$(OBJ) smtf.$(OBJ) \
- zfilterx.$(OBJ)
-xfilter.dev: $(INT_MAK) $(ECHOGS_XE) $(xfilter_) pcxd.dev pngp.dev
- $(SETMOD) xfilter $(xfilter_)
- $(ADDMOD) xfilter -include pcxd
- $(ADDMOD) xfilter -oper zfilterx
-
-sbhc.$(OBJ): sbhc.c $(AK) $(memory__h) $(stdio__h)\
- $(gdebug_h) $(sbhc_h) $(shcgen_h) $(strimpl_h)
-
-sbwbs.$(OBJ): sbwbs.c $(AK) $(stdio__h) $(memory__h) \
- $(gdebug_h) $(sbwbs_h) $(sfilter_h) $(strimpl_h)
-
-shcgen.$(OBJ): shcgen.c $(AK) $(memory__h) $(stdio__h)\
- $(gdebug_h) $(gserror_h) $(gserrors_h) $(gsmemory_h)\
- $(scommon_h) $(shc_h) $(shcgen_h)
-
-smtf.$(OBJ): smtf.c $(AK) $(stdio__h) \
- $(smtf_h) $(strimpl_h)
-
-zfilterx.$(OBJ): zfilterx.c $(OP) $(memory__h)\
- $(gsstruct_h) $(ialloc_h) $(idict_h) $(idparam_h) $(ifilter_h)\
- $(store_h) $(sfilter_h) $(sbhc_h) $(sbtx_h) $(sbwbs_h) $(shcgen_h)\
- $(smtf_h) $(spcxx_h) $(strimpl_h)
-
-# ---------------- Binary tokens ---------------- #
-
-btoken_=iscanbin.$(OBJ) zbseq.$(OBJ)
-btoken.dev: $(INT_MAK) $(ECHOGS_XE) $(btoken_)
- $(SETMOD) btoken $(btoken_)
- $(ADDMOD) btoken -oper zbseq_l2
- $(ADDMOD) btoken -ps gs_btokn
-
-bseq_h=bseq.h
-btoken_h=btoken.h
-
-iscanbin.$(OBJ): iscanbin.c $(GH) $(math__h) $(memory__h) $(errors_h)\
- $(gsutil_h) $(ialloc_h) $(ibnum_h) $(idict_h) $(iname_h)\
- $(iscan_h) $(iutil_h) $(ivmspace_h)\
- $(bseq_h) $(btoken_h) $(dstack_h) $(ostack_h)\
- $(sfilter_h) $(store_h) $(stream_h) $(strimpl_h)
-
-zbseq.$(OBJ): zbseq.c $(OP) $(memory__h)\
- $(ialloc_h) $(idict_h) $(isave_h)\
- $(sfilter_h) $(store_h) $(stream_h) $(strimpl_h)\
- $(iname_h) $(ibnum_h) $(btoken_h) $(bseq_h)
-
-# ---------------- User paths & insideness testing ---------------- #
-
-upath_=zupath.$(OBJ) ibnum.$(OBJ)
-upath.dev: $(INT_MAK) $(ECHOGS_XE) $(upath_)
- $(SETMOD) upath $(upath_)
- $(ADDMOD) upath -oper zupath_l2
-
-zupath.$(OBJ): zupath.c $(OP) \
- $(idict_h) $(dstack_h) $(iutil_h) $(igstate_h) $(store_h) $(stream_h) $(ibnum_h) \
- $(gscoord_h) $(gsmatrix_h) $(gspaint_h) $(gspath_h) $(gsstate_h) \
- $(gxfixed_h) $(gxdevice_h) $(gzpath_h) $(gzstate_h)
-
-# -------- Additions common to Display PostScript and Level 2 -------- #
-
-dpsand2.dev: $(INT_MAK) $(ECHOGS_XE) btoken.dev color.dev upath.dev dps2lib.dev dps2read.dev
- $(SETMOD) dpsand2 -include btoken color upath dps2lib dps2read
-
-dps2int_=zvmem2.$(OBJ) zdps1.$(OBJ)
-# Note that zvmem2 includes both Level 1 and Level 2 operators.
-dps2int.dev: $(INT_MAK) $(ECHOGS_XE) $(dps2int_)
- $(SETMOD) dps2int $(dps2int_)
- $(ADDMOD) dps2int -oper zvmem2 zdps1_l2
- $(ADDMOD) dps2int -ps gs_dps1
-
-dps2read_=ibnum.$(OBJ) zchar2.$(OBJ)
-dps2read.dev: $(INT_MAK) $(ECHOGS_XE) $(dps2read_) dps2int.dev
- $(SETMOD) dps2read $(dps2read_)
- $(ADDMOD) dps2read -include dps2int
- $(ADDMOD) dps2read -oper ireclaim_l2 zchar2_l2
- $(ADDMOD) dps2read -ps gs_dps2
-
-ibnum.$(OBJ): ibnum.c $(GH) $(math__h) $(memory__h)\
- $(errors_h) $(stream_h) $(ibnum_h) $(imemory_h) $(iutil_h)
-
-zchar2.$(OBJ): zchar2.c $(OP)\
- $(gschar_h) $(gsmatrix_h) $(gspath_h) $(gsstruct_h)\
- $(gxchar_h) $(gxfixed_h) $(gxfont_h)\
- $(ialloc_h) $(ichar_h) $(estack_h) $(ifont_h) $(iname_h) $(igstate_h)\
- $(store_h) $(stream_h) $(ibnum_h)
-
-zdps1.$(OBJ): zdps1.c $(OP) \
- $(gsmatrix_h) $(gspath_h) $(gspath2_h) $(gsstate_h) \
- $(ialloc_h) $(ivmspace_h) $(igstate_h) $(store_h) $(stream_h) $(ibnum_h)
-
-zvmem2.$(OBJ): zvmem2.c $(OP) \
- $(estack_h) $(ialloc_h) $(ivmspace_h) $(store_h)
-
-# ---------------- Display PostScript ---------------- #
-
-dps_=zdps.$(OBJ) icontext.$(OBJ) zcontext.$(OBJ)
-dps.dev: $(INT_MAK) $(ECHOGS_XE) dpslib.dev level2.dev $(dps_)
- $(SETMOD) dps -include dpslib level2
- $(ADDMOD) dps -obj $(dps_)
- $(ADDMOD) dps -oper zcontext zdps
- $(ADDMOD) dps -ps gs_dps
-
-icontext.$(OBJ): icontext.c $(GH)\
- $(gsstruct_h) $(gxalloc_h)\
- $(dstack_h) $(errors_h) $(estack_h) $(ostack_h)\
- $(icontext_h) $(igstate_h) $(interp_h) $(store_h)
-
-zdps.$(OBJ): zdps.c $(OP)\
- $(gsdps_h) $(gsstate_h) $(igstate_h) $(iname_h) $(store_h)
-
-zcontext.$(OBJ): zcontext.c $(OP) $(gp_h) $(memory__h)\
- $(gsexit_h) $(gsstruct_h) $(gsutil_h) $(gxalloc_h)\
- $(icontext_h) $(idict_h) $(igstate_h) $(istruct_h)\
- $(dstack_h) $(estack_h) $(ostack_h) $(store_h)
-
-# The following #ifdef ... #endif are just a comment to mark a DPNEXT area.
-#ifdef DPNEXT
-
-# ---------------- NeXT Display PostScript ---------------- #
-#**************** NOT READY FOR USE YET ****************#
-
-# There should be a gsdpnext.c, but there isn't yet.
-#dpsnext_=zdpnext.$(OBJ) gsdpnext.$(OBJ)
-dpsnext_=zdpnext.$(OBJ)
-dpsnext.dev: $(INT_MAK) $(ECHOGS_XE) dps.dev $(dpsnext_) gs_dpnxt.ps
- $(SETMOD) dpsnext -include dps
- $(ADDMOD) dpsnext -obj $(dpsnext_)
- $(ADDMOD) dpsnext -oper zdpnext
- $(ADDMOD) dpsnext -ps gs_dpnxt
-
-zdpnext.$(OBJ): zdpnext.c $(OP)\
- $(gscspace_h) $(gsiparam_h) $(gsmatrix_h) $(gxcvalue_h) $(gxsample_h)\
- $(ialloc_h) $(igstate_h) $(iimage_h)
-
-# See above re the following.
-#endif /* DPNEXT */
-
-# -------- Composite (PostScript Type 0) font support -------- #
-
-compfont.dev: $(INT_MAK) $(ECHOGS_XE) psf0lib.dev psf0read.dev
- $(SETMOD) compfont -include psf0lib psf0read
-
-# We always include zfcmap.$(OBJ) because zfont0.c refers to it,
-# and it's not worth the trouble to exclude.
-psf0read_=zchar2.$(OBJ) zfcmap.$(OBJ) zfont0.$(OBJ)
-psf0read.dev: $(INT_MAK) $(ECHOGS_XE) $(psf0read_)
- $(SETMOD) psf0read $(psf0read_)
- $(ADDMOD) psf0read -oper zfont0 zchar2 zfcmap
-
-zfcmap.$(OBJ): zfcmap.c $(OP)\
- $(gsmatrix_h) $(gsstruct_h) $(gsutil_h)\
- $(gxfcmap_h) $(gxfont_h)\
- $(ialloc_h) $(idict_h) $(idparam_h) $(ifont_h) $(iname_h) $(store_h)
-
-zfont0.$(OBJ): zfont0.c $(OP)\
- $(gschar_h) $(gsstruct_h)\
- $(gxdevice_h) $(gxfcmap_h) $(gxfixed_h) $(gxfont_h) $(gxfont0_h) $(gxmatrix_h)\
- $(gzstate_h)\
- $(bfont_h) $(ialloc_h) $(idict_h) $(idparam_h) $(igstate_h) $(iname_h)\
- $(store_h)
-
-# ---------------- CMap support ---------------- #
-# Note that this requires at least minimal Level 2 support,
-# because it requires findresource.
-
-cmapread_=zfcmap.$(OBJ)
-cmapread.dev: $(INT_MAK) $(ECHOGS_XE) $(cmapread_) cmaplib.dev psl2int.dev
- $(SETMOD) cmapread $(cmapread_)
- $(ADDMOD) cmapread -include cmaplib psl2int
- $(ADDMOD) cmapread -oper zfcmap
- $(ADDMOD) cmapread -ps gs_cmap
-
-# ---------------- CIDFont support ---------------- #
-# Note that this requires at least minimal Level 2 support,
-# because it requires findresource.
-
-cidread_=zcid.$(OBJ)
-cidfont.dev: $(INT_MAK) $(ECHOGS_XE) psf1read.dev psl2int.dev type42.dev\
- $(cidread_)
- $(SETMOD) cidfont $(cidread_)
- $(ADDMOD) cidfont -include psf1read psl2int type42
- $(ADDMOD) cidfont -ps gs_cidfn
- $(ADDMOD) cidfont -oper zcid
-
-zcid.$(OBJ): zcid.c $(OP)\
- $(gsccode_h) $(gsmatrix_h) $(gxfont_h)\
- $(bfont_h) $(iname_h) $(store_h)
-
-# ---------------- CIE color ---------------- #
-
-cieread_=zcie.$(OBJ) zcrd.$(OBJ)
-cie.dev: $(INT_MAK) $(ECHOGS_XE) $(cieread_) cielib.dev
- $(SETMOD) cie $(cieread_)
- $(ADDMOD) cie -oper zcie_l2 zcrd_l2
- $(ADDMOD) cie -include cielib
-
-icie_h=icie.h
-
-zcie.$(OBJ): zcie.c $(OP) $(math__h) $(memory__h) \
- $(gscolor2_h) $(gscie_h) $(gsstruct_h) $(gxcspace_h) \
- $(ialloc_h) $(icie_h) $(idict_h) $(idparam_h) $(estack_h) \
- $(isave_h) $(igstate_h) $(ivmspace_h) $(store_h)
-
-zcrd.$(OBJ): zcrd.c $(OP) $(math__h) \
- $(gscspace_h) $(gscolor2_h) $(gscie_h) $(gsstruct_h) \
- $(ialloc_h) $(icie_h) $(idict_h) $(idparam_h) $(estack_h) \
- $(isave_h) $(igstate_h) $(ivmspace_h) $(store_h)
-
-# ---------------- Pattern color ---------------- #
-
-pattern.dev: $(INT_MAK) $(ECHOGS_XE) patlib.dev patread.dev
- $(SETMOD) pattern -include patlib patread
-
-patread_=zpcolor.$(OBJ)
-patread.dev: $(INT_MAK) $(ECHOGS_XE) $(patread_)
- $(SETMOD) patread $(patread_)
- $(ADDMOD) patread -oper zpcolor_l2
-
-zpcolor.$(OBJ): zpcolor.c $(OP)\
- $(gscolor_h) $(gsmatrix_h) $(gsstruct_h)\
- $(gxcolor2_h) $(gxcspace_h) $(gxdcolor_h) $(gxdevice_h) $(gxdevmem_h)\
- $(gxfixed_h) $(gxpcolor_h)\
- $(estack_h) $(ialloc_h) $(idict_h) $(idparam_h) $(igstate_h) $(istruct_h)\
- $(store_h)
-
-# ---------------- Separation color ---------------- #
-
-seprread_=zcssepr.$(OBJ)
-sepr.dev: $(INT_MAK) $(ECHOGS_XE) $(seprread_) seprlib.dev
- $(SETMOD) sepr $(seprread_)
- $(ADDMOD) sepr -oper zcssepr_l2
- $(ADDMOD) sepr -include seprlib
-
-zcssepr.$(OBJ): zcssepr.c $(OP) \
- $(gscolor_h) $(gscsepr_h) $(gsmatrix_h) $(gsstruct_h) \
- $(gxcolor2_h) $(gxcspace_h) $(gxfixed_h) \
- $(ialloc_h) $(icsmap_h) $(estack_h) $(igstate_h) $(ivmspace_h) $(store_h)
-
-# ---------------- Functions ---------------- #
-
-ifunc_h=ifunc.h
-
-# Generic support, and FunctionType 0.
-funcread_=zfunc.$(OBJ) zfunc0.$(OBJ)
-func.dev: $(INT_MAK) $(ECHOGS_XE) $(funcread_) funclib.dev
- $(SETMOD) func $(funcread_)
- $(ADDMOD) func -oper zfunc zfunc0
- $(ADDMOD) func -include funclib
-
-zfunc.$(OBJ): zfunc.c $(OP) $(memory__h)\
- $(gsfunc_h) $(gsstruct_h)\
- $(ialloc_h) $(idict_h) $(idparam_h) $(ifunc_h) $(store_h)
-
-zfunc0.$(OBJ): zfunc0.c $(OP) $(memory__h)\
- $(gsdsrc_h) $(gsfunc_h) $(gsfunc0_h)\
- $(stream_h)\
- $(files_h) $(ialloc_h) $(idict_h) $(idparam_h) $(ifunc_h)
-
-# ---------------- DCT filters ---------------- #
-# The definitions for jpeg*.dev are in jpeg.mak.
-
-dct.dev: $(INT_MAK) $(ECHOGS_XE) dcte.dev dctd.dev
- $(SETMOD) dct -include dcte dctd
-
-# Common code
-
-dctc_=zfdctc.$(OBJ)
-
-zfdctc.$(OBJ): zfdctc.c $(GH) $(memory__h) $(stdio__h)\
- $(errors_h) $(opcheck_h)\
- $(idict_h) $(idparam_h) $(imemory_h) $(ipacked_h) $(iutil_h)\
- $(sdct_h) $(sjpeg_h) $(strimpl_h)\
- jpeglib.h
-
-# Encoding (compression)
-
-dcte_=$(dctc_) zfdcte.$(OBJ)
-dcte.dev: $(INT_MAK) $(ECHOGS_XE) sdcte.dev $(dcte_)
- $(SETMOD) dcte -include sdcte
- $(ADDMOD) dcte -obj $(dcte_)
- $(ADDMOD) dcte -oper zfdcte
-
-zfdcte.$(OBJ): zfdcte.c $(OP) $(memory__h) $(stdio__h)\
- $(idict_h) $(idparam_h) $(ifilter_h) $(sdct_h) $(sjpeg_h) $(strimpl_h) \
- jpeglib.h
-
-# Decoding (decompression)
-
-dctd_=$(dctc_) zfdctd.$(OBJ)
-dctd.dev: $(INT_MAK) $(ECHOGS_XE) sdctd.dev $(dctd_)
- $(SETMOD) dctd -include sdctd
- $(ADDMOD) dctd -obj $(dctd_)
- $(ADDMOD) dctd -oper zfdctd
-
-zfdctd.$(OBJ): zfdctd.c $(OP) $(memory__h) $(stdio__h)\
- $(ifilter_h) $(sdct_h) $(sjpeg_h) $(strimpl_h) \
- jpeglib.h
-
-# ---------------- zlib/Flate filters ---------------- #
-
-fzlib.dev: $(INT_MAK) $(ECHOGS_XE) zfzlib.$(OBJ) szlibe.dev szlibd.dev
- $(SETMOD) fzlib -include szlibe szlibd
- $(ADDMOD) fzlib -obj zfzlib.$(OBJ)
- $(ADDMOD) fzlib -oper zfzlib
-
-zfzlib.$(OBJ): zfzlib.c $(OP) \
- $(errors_h) $(idict_h) $(ifilter_h) \
- $(spdiffx_h) $(spngpx_h) $(strimpl_h) $(szlibx_h)
- $(CCCZ) zfzlib.c
-
-# ================================ PDF ================================ #
-
-# We need most of the Level 2 interpreter to do PDF, but not all of it.
-# In fact, we don't even need all of a Level 1 interpreter.
-
-# Because of the way the PDF encodings are defined, they must get loaded
-# before we install the Level 2 resource machinery.
-# On the other hand, the PDF .ps files must get loaded after
-# level2dict is defined.
-pdfmin.dev: $(INT_MAK) $(ECHOGS_XE)\
- psbase.dev color.dev dps2lib.dev dps2read.dev\
- fdecode.dev type1.dev pdffonts.dev psl2lib.dev psl2read.dev pdfread.dev
- $(SETMOD) pdfmin -include psbase color dps2lib dps2read
- $(ADDMOD) pdfmin -include fdecode type1
- $(ADDMOD) pdfmin -include pdffonts psl2lib psl2read pdfread
- $(ADDMOD) pdfmin -emulator PDF
-
-pdf.dev: $(INT_MAK) $(ECHOGS_XE)\
- pdfmin.dev cff.dev cidfont.dev cie.dev compfont.dev cmapread.dev dctd.dev\
- func.dev ttfont.dev type2.dev
- $(SETMOD) pdf -include pdfmin cff cidfont cie cmapread compfont dctd
- $(ADDMOD) pdf -include func ttfont type2
-
-# Reader only
-
-pdffonts.dev: $(INT_MAK) $(ECHOGS_XE) \
- gs_mex_e.ps gs_mro_e.ps gs_pdf_e.ps gs_wan_e.ps
- $(SETMOD) pdffonts -ps gs_mex_e gs_mro_e gs_pdf_e gs_wan_e
-
-# pdf_2ps must be the last .ps file loaded.
-pdfread.dev: $(INT_MAK) $(ECHOGS_XE) fzlib.dev
- $(SETMOD) pdfread -include fzlib
- $(ADDMOD) pdfread -ps gs_pdf gs_l2img
- $(ADDMOD) pdfread -ps pdf_base pdf_draw pdf_font pdf_main pdf_sec
- $(ADDMOD) pdfread -ps pdf_2ps
-
-# ============================= Main program ============================== #
-
-gs.$(OBJ): gs.c $(GH) \
- $(imain_h) $(imainarg_h) $(iminst_h)
-
-imainarg.$(OBJ): imainarg.c $(GH) $(ctype__h) $(memory__h) $(string__h) \
- $(gp_h) \
- $(gsargs_h) $(gscdefs_h) $(gsdevice_h) $(gsmdebug_h) $(gxdevice_h) $(gxdevmem_h) \
- $(errors_h) $(estack_h) $(files_h) \
- $(ialloc_h) $(imain_h) $(imainarg_h) $(iminst_h) \
- $(iname_h) $(interp_h) $(iscan_h) $(iutil_h) $(ivmspace_h) \
- $(ostack_h) $(sfilter_h) $(store_h) $(stream_h) $(strimpl_h)
-
-imain.$(OBJ): imain.c $(GH) $(memory__h) $(string__h)\
- $(gp_h) $(gslib_h) $(gsmatrix_h) $(gsutil_h) $(gxdevice_h)\
- $(dstack_h) $(errors_h) $(estack_h) $(files_h)\
- $(ialloc_h) $(idebug_h) $(idict_h) $(iname_h) $(interp_h)\
- $(isave_h) $(iscan_h) $(ivmspace_h)\
- $(main_h) $(oper_h) $(ostack_h)\
- $(sfilter_h) $(store_h) $(stream_h) $(strimpl_h)
-
-interp.$(OBJ): interp.c $(GH) $(memory__h) $(string__h)\
- $(gsstruct_h)\
- $(dstack_h) $(errors_h) $(estack_h) $(files_h)\
- $(ialloc_h) $(iastruct_h) $(inamedef_h) $(idict_h) $(interp_h) $(ipacked_h)\
- $(iscan_h) $(isave_h) $(istack_h) $(iutil_h) $(ivmspace_h)\
- $(oper_h) $(ostack_h) $(sfilter_h) $(store_h) $(stream_h) $(strimpl_h)
- $(CCINT) interp.c
-
-ireclaim.$(OBJ): ireclaim.c $(GH) \
- $(errors_h) $(gsstruct_h) $(iastate_h) $(opdef_h) $(store_h) \
- $(dstack_h) $(estack_h) $(ostack_h)
-# Copyright (C) 1994, 1996, 1997 Aladdin Enterprises. All rights reserved.
-#
-# This file is part of Aladdin Ghostscript.
-#
-# Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
-# or distributor accepts any responsibility for the consequences of using it,
-# or for whether it serves any particular purpose or works at all, unless he
-# or she says so in writing. Refer to the Aladdin Ghostscript Free Public
-# License (the "License") for full details.
-#
-# Every copy of Aladdin Ghostscript must include a copy of the License,
-# normally in a plain ASCII text file named PUBLIC. The License grants you
-# the right to copy, modify and redistribute Aladdin Ghostscript, but only
-# under certain conditions described in the License. Among other things, the
-# License requires that the copyright notice and this notice be preserved on
-# all copies.
-
-# makefile for Independent JPEG Group library code.
-
-# NOTE: This makefile is only known to work with the following versions
-# of the IJG library: 6, 6a.
-# As of May 11, 1996, version 6a is the current version.
-#
-# You can get the IJG library by Internet anonymous FTP from the following
-# places:
-# Standard distribution (tar + gzip format, Unix end-of-line):
-# ftp.uu.net:/graphics/jpeg/jpegsrc.v*.tar.gz
-# ftp.cs.wisc.edu:/ghost/jpegsrc.v*.tar.gz
-# MS-DOS archive (PKZIP a.k.a. zip format, MS-DOS end-of-line):
-# ftp.simtel.net:/pub/simtelnet/msdos/graphics/jpegsr*.zip
-# ftp.cs.wisc.edu:/ghost/jpeg-*.zip
-# The first site named above (ftp.uu.net and ftp.simtel.net) is supposed
-# to be the master distribution site, so it may have a more up-to-date
-# version; the ftp.cs.wisc.edu site is the master distribution site for
-# Ghostscript, so it will always have IJG library versions known to be
-# compatible with Ghostscript.
-#
-# If the version number, and hence the subdirectory name, changes, you
-# will probably want to change the definitions of JSRCDIR and possibly
-# JVERSION (in the platform-specific makefile, not here) to reflect this,
-# since that way you can use the IJG archive without change.
-#
-# NOTE: For some obscure reason (probably a bug in djtarx), if you are
-# compiling on a DesqView/X system, you should use the zip version of the
-# IJG library, not the tar.gz version.
-
-# Define the name of this makefile.
-JPEG_MAK=jpeg.mak
-
-# JSRCDIR is defined in the platform-specific makefile, not here,
-# as the directory where the IJG library sources are stored.
-#JSRCDIR=jpeg-6a
-# JVERSION is defined in the platform-specific makefile, not here,
-# as the IJG library major version number (currently "5" or "6").
-#JVERSION=6
-
-JSRC=$(JSRCDIR)$(D)
-# CCCJ is defined in gs.mak.
-#CCCJ=$(CCC) -I. -I$(JSRCDIR)
-
-# We keep all of the IJG code in a separate directory so as not to
-# inadvertently mix it up with Aladdin Enterprises' own code.
-# However, we need our own version of jconfig.h, and our own "wrapper" for
-# jmorecfg.h. We also need a substitute for jerror.c, in order to
-# keep the error strings out of the automatic data segment in
-# 16-bit environments. For v5*, we also need our own version of jpeglib.h
-# in order to change MAX_BLOCKS_IN_MCU for Adobe compatibility.
-# (This need will go away when IJG v6 is released.)
-
-# Because this file is included after lib.mak, we can't use _h macros
-# to express indirect dependencies; instead, we build the dependencies
-# into the rules for copying the files.
-jconfig_h=jconfig.h
-jerror_h=jerror.h
-jmorecfg_h=jmorecfg.h
-jpeglib_h=jpeglib.h
-
-jconfig.h: gsjconf.h $(std_h)
- $(CP_) gsjconf.h jconfig.h
-
-jmorecfg.h: gsjmorec.h jmcorig.h
- $(CP_) gsjmorec.h jmorecfg.h
-
-jmcorig.h: $(JSRC)jmorecfg.h
- $(CP_) $(JSRC)jmorecfg.h jmcorig.h
-
-jpeglib.h: jlib$(JVERSION).h jconfig.h jmorecfg.h
- $(CP_) jlib$(JVERSION).h jpeglib.h
-
-jlib5.h: gsjpglib.h
- $(CP_) gsjpglib.h jlib5.h
-
-jlib6.h: $(JSRC)jpeglib.h
- $(CP_) $(JSRC)jpeglib.h jlib6.h
-
-# To ensure that the compiler finds our versions of jconfig.h and jmorecfg.h,
-# regardless of the compiler's search rule, we must copy up all .c files,
-# and all .h files that include either of these files, directly or
-# indirectly. The only such .h files currently are jinclude.h and jpeglib.h.
-# (Currently, we supply our own version of jpeglib.h -- see above.)
-# Also, to avoid including the JSRCDIR directory name in our source files,
-# we must also copy up any other .h files that our own code references.
-# Currently, the only such .h files are jerror.h and jversion.h.
-
-JHCOPY=jinclude.h jpeglib.h jerror.h jversion.h
-
-jinclude.h: $(JSRC)jinclude.h
- $(CP_) $(JSRC)jinclude.h jinclude.h
-
-#jpeglib.h: $(JSRC)jpeglib.h
-# $(CP_) $(JSRC)jpeglib.h jpeglib.h
-
-jerror.h: $(JSRC)jerror.h
- $(CP_) $(JSRC)jerror.h jerror.h
-
-jversion.h: $(JSRC)jversion.h
- $(CP_) $(JSRC)jversion.h jversion.h
-
-# In order to avoid having to keep the dependency lists for the IJG code
-# accurate, we simply make all of them depend on the only files that
-# we are ever going to change, and on all the .h files that must be copied up.
-# This is too conservative, but only hurts us if we are changing our own
-# j*.h files, which happens only rarely during development.
-
-JDEP=$(AK) $(jconfig_h) $(jerror_h) $(jmorecfg_h) $(JHCOPY)
-
-# Code common to compression and decompression.
-
-jpegc_=jcomapi.$(OBJ) jutils.$(OBJ) sjpegerr.$(OBJ) jmemmgr.$(OBJ)
-jpegc.dev: $(JPEG_MAK) $(ECHOGS_XE) $(jpegc_)
- $(SETMOD) jpegc $(jpegc_)
-
-jcomapi.$(OBJ): $(JSRC)jcomapi.c $(JDEP)
- $(CP_) $(JSRC)jcomapi.c .
- $(CCCJ) jcomapi.c
- $(RM_) jcomapi.c
-
-jutils.$(OBJ): $(JSRC)jutils.c $(JDEP)
- $(CP_) $(JSRC)jutils.c .
- $(CCCJ) jutils.c
- $(RM_) jutils.c
-
-# Note that sjpegerr replaces jerror.
-sjpegerr.$(OBJ): sjpegerr.c $(JDEP)
- $(CCCF) sjpegerr.c
-
-jmemmgr.$(OBJ): $(JSRC)jmemmgr.c $(JDEP)
- $(CP_) $(JSRC)jmemmgr.c .
- $(CCCJ) jmemmgr.c
- $(RM_) jmemmgr.c
-
-# Encoding (compression) code.
-
-jpege.dev: jpege$(JVERSION).dev
- $(CP_) jpege$(JVERSION).dev jpege.dev
-
-jpege5=jcapi.$(OBJ)
-jpege6=jcapimin.$(OBJ) jcapistd.$(OBJ) jcinit.$(OBJ)
-
-jpege_1=jccoefct.$(OBJ) jccolor.$(OBJ) jcdctmgr.$(OBJ)
-jpege_2=jchuff.$(OBJ) jcmainct.$(OBJ) jcmarker.$(OBJ) jcmaster.$(OBJ)
-jpege_3=jcparam.$(OBJ) jcprepct.$(OBJ) jcsample.$(OBJ) jfdctint.$(OBJ)
-
-jpege5.dev: $(JPEG_MAK) $(ECHOGS_XE) jpegc.dev $(jpege5) $(jpege_1) $(jpege_2) $(jpege_3)
- $(SETMOD) jpege5 $(jpege5)
- $(ADDMOD) jpege5 -include jpegc
- $(ADDMOD) jpege5 -obj $(jpege_1)
- $(ADDMOD) jpege5 -obj $(jpege_2)
- $(ADDMOD) jpege5 -obj $(jpege_3)
-
-jpege6.dev: $(JPEG_MAK) $(ECHOGS_XE) jpegc.dev $(jpege6) $(jpege_1) $(jpege_2) $(jpege_3)
- $(SETMOD) jpege6 $(jpege6)
- $(ADDMOD) jpege6 -include jpegc
- $(ADDMOD) jpege6 -obj $(jpege_1)
- $(ADDMOD) jpege6 -obj $(jpege_2)
- $(ADDMOD) jpege6 -obj $(jpege_3)
-
-# jcapi.c is v5* only
-jcapi.$(OBJ): $(JSRC)jcapi.c $(JDEP)
- $(CP_) $(JSRC)jcapi.c .
- $(CCCJ) jcapi.c
- $(RM_) jcapi.c
-
-# jcapimin.c is new in v6
-jcapimin.$(OBJ): $(JSRC)jcapimin.c $(JDEP)
- $(CP_) $(JSRC)jcapimin.c .
- $(CCCJ) jcapimin.c
- $(RM_) jcapimin.c
-
-# jcapistd.c is new in v6
-jcapistd.$(OBJ): $(JSRC)jcapistd.c $(JDEP)
- $(CP_) $(JSRC)jcapistd.c .
- $(CCCJ) jcapistd.c
- $(RM_) jcapistd.c
-
-# jcinit.c is new in v6
-jcinit.$(OBJ): $(JSRC)jcinit.c $(JDEP)
- $(CP_) $(JSRC)jcinit.c .
- $(CCCJ) jcinit.c
- $(RM_) jcinit.c
-
-jccoefct.$(OBJ): $(JSRC)jccoefct.c $(JDEP)
- $(CP_) $(JSRC)jccoefct.c .
- $(CCCJ) jccoefct.c
- $(RM_) jccoefct.c
-
-jccolor.$(OBJ): $(JSRC)jccolor.c $(JDEP)
- $(CP_) $(JSRC)jccolor.c .
- $(CCCJ) jccolor.c
- $(RM_) jccolor.c
-
-jcdctmgr.$(OBJ): $(JSRC)jcdctmgr.c $(JDEP)
- $(CP_) $(JSRC)jcdctmgr.c .
- $(CCCJ) jcdctmgr.c
- $(RM_) jcdctmgr.c
-
-jchuff.$(OBJ): $(JSRC)jchuff.c $(JDEP)
- $(CP_) $(JSRC)jchuff.c .
- $(CCCJ) jchuff.c
- $(RM_) jchuff.c
-
-jcmainct.$(OBJ): $(JSRC)jcmainct.c $(JDEP)
- $(CP_) $(JSRC)jcmainct.c .
- $(CCCJ) jcmainct.c
- $(RM_) jcmainct.c
-
-jcmarker.$(OBJ): $(JSRC)jcmarker.c $(JDEP)
- $(CP_) $(JSRC)jcmarker.c .
- $(CCCJ) jcmarker.c
- $(RM_) jcmarker.c
-
-jcmaster.$(OBJ): $(JSRC)jcmaster.c $(JDEP)
- $(CP_) $(JSRC)jcmaster.c .
- $(CCCJ) jcmaster.c
- $(RM_) jcmaster.c
-
-jcparam.$(OBJ): $(JSRC)jcparam.c $(JDEP)
- $(CP_) $(JSRC)jcparam.c .
- $(CCCJ) jcparam.c
- $(RM_) jcparam.c
-
-jcprepct.$(OBJ): $(JSRC)jcprepct.c $(JDEP)
- $(CP_) $(JSRC)jcprepct.c .
- $(CCCJ) jcprepct.c
- $(RM_) jcprepct.c
-
-jcsample.$(OBJ): $(JSRC)jcsample.c $(JDEP)
- $(CP_) $(JSRC)jcsample.c .
- $(CCCJ) jcsample.c
- $(RM_) jcsample.c
-
-jfdctint.$(OBJ): $(JSRC)jfdctint.c $(JDEP)
- $(CP_) $(JSRC)jfdctint.c .
- $(CCCJ) jfdctint.c
- $(RM_) jfdctint.c
-
-# Decompression code
-
-jpegd.dev: jpegd$(JVERSION).dev
- $(CP_) jpegd$(JVERSION).dev jpegd.dev
-
-jpegd5=jdapi.$(OBJ)
-jpegd6=jdapimin.$(OBJ) jdapistd.$(OBJ) jdinput.$(OBJ) jdphuff.$(OBJ)
-
-jpegd_1=jdcoefct.$(OBJ) jdcolor.$(OBJ)
-jpegd_2=jddctmgr.$(OBJ) jdhuff.$(OBJ) jdmainct.$(OBJ) jdmarker.$(OBJ)
-jpegd_3=jdmaster.$(OBJ) jdpostct.$(OBJ) jdsample.$(OBJ) jidctint.$(OBJ)
-
-jpegd5.dev: $(JPEG_MAK) $(ECHOGS_XE) jpegc.dev $(jpegd5) $(jpegd_1) $(jpegd_2) $(jpegd_3)
- $(SETMOD) jpegd5 $(jpegd5)
- $(ADDMOD) jpegd5 -include jpegc
- $(ADDMOD) jpegd5 -obj $(jpegd_1)
- $(ADDMOD) jpegd5 -obj $(jpegd_2)
- $(ADDMOD) jpegd5 -obj $(jpegd_3)
-
-jpegd6.dev: $(JPEG_MAK) $(ECHOGS_XE) jpegc.dev $(jpegd6) $(jpegd_1) $(jpegd_2) $(jpegd_3)
- $(SETMOD) jpegd6 $(jpegd6)
- $(ADDMOD) jpegd6 -include jpegc
- $(ADDMOD) jpegd6 -obj $(jpegd_1)
- $(ADDMOD) jpegd6 -obj $(jpegd_2)
- $(ADDMOD) jpegd6 -obj $(jpegd_3)
-
-# jdapi.c is v5* only
-jdapi.$(OBJ): $(JSRC)jdapi.c $(JDEP)
- $(CP_) $(JSRC)jdapi.c .
- $(CCCJ) jdapi.c
- $(RM_) jdapi.c
-
-# jdapimin.c is new in v6
-jdapimin.$(OBJ): $(JSRC)jdapimin.c $(JDEP)
- $(CP_) $(JSRC)jdapimin.c .
- $(CCCJ) jdapimin.c
- $(RM_) jdapimin.c
-
-# jdapistd.c is new in v6
-jdapistd.$(OBJ): $(JSRC)jdapistd.c $(JDEP)
- $(CP_) $(JSRC)jdapistd.c .
- $(CCCJ) jdapistd.c
- $(RM_) jdapistd.c
-
-jdcoefct.$(OBJ): $(JSRC)jdcoefct.c $(JDEP)
- $(CP_) $(JSRC)jdcoefct.c .
- $(CCCJ) jdcoefct.c
- $(RM_) jdcoefct.c
-
-jdcolor.$(OBJ): $(JSRC)jdcolor.c $(JDEP)
- $(CP_) $(JSRC)jdcolor.c .
- $(CCCJ) jdcolor.c
- $(RM_) jdcolor.c
-
-jddctmgr.$(OBJ): $(JSRC)jddctmgr.c $(JDEP)
- $(CP_) $(JSRC)jddctmgr.c .
- $(CCCJ) jddctmgr.c
- $(RM_) jddctmgr.c
-
-jdhuff.$(OBJ): $(JSRC)jdhuff.c $(JDEP)
- $(CP_) $(JSRC)jdhuff.c .
- $(CCCJ) jdhuff.c
- $(RM_) jdhuff.c
-
-# jdinput.c is new in v6
-jdinput.$(OBJ): $(JSRC)jdinput.c $(JDEP)
- $(CP_) $(JSRC)jdinput.c .
- $(CCCJ) jdinput.c
- $(RM_) jdinput.c
-
-jdmainct.$(OBJ): $(JSRC)jdmainct.c $(JDEP)
- $(CP_) $(JSRC)jdmainct.c .
- $(CCCJ) jdmainct.c
- $(RM_) jdmainct.c
-
-jdmarker.$(OBJ): $(JSRC)jdmarker.c $(JDEP)
- $(CP_) $(JSRC)jdmarker.c .
- $(CCCJ) jdmarker.c
- $(RM_) jdmarker.c
-
-jdmaster.$(OBJ): $(JSRC)jdmaster.c $(JDEP)
- $(CP_) $(JSRC)jdmaster.c .
- $(CCCJ) jdmaster.c
- $(RM_) jdmaster.c
-
-# jdphuff.c is new in v6
-jdphuff.$(OBJ): $(JSRC)jdphuff.c $(JDEP)
- $(CP_) $(JSRC)jdphuff.c .
- $(CCCJ) jdphuff.c
- $(RM_) jdphuff.c
-
-jdpostct.$(OBJ): $(JSRC)jdpostct.c $(JDEP)
- $(CP_) $(JSRC)jdpostct.c .
- $(CCCJ) jdpostct.c
- $(RM_) jdpostct.c
-
-jdsample.$(OBJ): $(JSRC)jdsample.c $(JDEP)
- $(CP_) $(JSRC)jdsample.c .
- $(CCCJ) jdsample.c
- $(RM_) jdsample.c
-
-jidctint.$(OBJ): $(JSRC)jidctint.c $(JDEP)
- $(CP_) $(JSRC)jidctint.c .
- $(CCCJ) jidctint.c
- $(RM_) jidctint.c
-# Copyright (C) 1995, 1996, 1997 Aladdin Enterprises. All rights reserved.
-#
-# This file is part of Aladdin Ghostscript.
-#
-# Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
-# or distributor accepts any responsibility for the consequences of using it,
-# or for whether it serves any particular purpose or works at all, unless he
-# or she says so in writing. Refer to the Aladdin Ghostscript Free Public
-# License (the "License") for full details.
-#
-# Every copy of Aladdin Ghostscript must include a copy of the License,
-# normally in a plain ASCII text file named PUBLIC. The License grants you
-# the right to copy, modify and redistribute Aladdin Ghostscript, but only
-# under certain conditions described in the License. Among other things, the
-# License requires that the copyright notice and this notice be preserved on
-# all copies.
-
-# makefile for PNG (Portable Network Graphics) code.
-
-# This partial makefile compiles the png library for use in the Ghostscript
-# PNG drivers. You can get the source code for this library from:
-# ftp://swrinde.nde.swri.edu/pub/png/src/
-# The makefile is known to work with the following library versions:
-# 0.89, 0.90, 0.95, and 0.96. NOTE: the archive for libpng 0.95 may
-# be inconsistent: if you have compilation problems, use an older version.
-# Please see Ghostscript's `make.txt' file for instructions about how to
-# unpack these archives.
-#
-# The specification for the PNG file format is available from:
-# http://www.group42.com/png.htm
-# http://www.w3.org/pub/WWW/TR/WD-png
-
-# Define the name of this makefile.
-LIBPNG_MAK=libpng.mak
-
-# PSRCDIR is defined in the platform-specific makefile, not here,
-# as the directory where the PNG library sources are stored.
-#PSRCDIR=libpng
-# PVERSION is defined in the platform-specific makefile, not here,
-# as the libpng version number ("89", "90", "95", or "96").
-#PVERSION=96
-
-PSRC=$(PSRCDIR)$(D)
-# CCCP is defined in gs.mak.
-#CCCP=$(CCC) -I$(PSRCDIR) -I$(ZSRCDIR)
-
-# We keep all of the PNG code in a separate directory so as not to
-# inadvertently mix it up with Aladdin Enterprises' own code.
-PDEP=$(AK)
-
-png_1=png.$(OBJ) pngmem.$(OBJ) pngerror.$(OBJ)
-png_2=pngtrans.$(OBJ) pngwrite.$(OBJ) pngwtran.$(OBJ) pngwutil.$(OBJ)
-
-# libpng modules
-
-png.$(OBJ): $(PSRC)png.c $(PDEP)
- $(CCCP) $(PSRC)png.c
-
-# version 0.89 uses pngwio.c
-pngwio.$(OBJ): $(PSRC)pngwio.c $(PDEP)
- $(CCCP) $(PSRC)pngwio.c
-
-pngmem.$(OBJ): $(PSRC)pngmem.c $(PDEP)
- $(CCCP) $(PSRC)pngmem.c
-
-pngerror.$(OBJ): $(PSRC)pngerror.c $(PDEP)
- $(CCCP) $(PSRC)pngerror.c
-
-pngtrans.$(OBJ): $(PSRC)pngtrans.c $(PDEP)
- $(CCCP) $(PSRC)pngtrans.c
-
-pngwrite.$(OBJ): $(PSRC)pngwrite.c $(PDEP)
- $(CCCP) $(PSRC)pngwrite.c
-
-pngwtran.$(OBJ): $(PSRC)pngwtran.c $(PDEP)
- $(CCCP) $(PSRC)pngwtran.c
-
-pngwutil.$(OBJ): $(PSRC)pngwutil.c $(PDEP)
- $(CCCP) $(PSRC)pngwutil.c
-
-# Define the version of libpng.dev that we are actually using.
-libpng.dev: $(MAKEFILE) libpng_$(SHARE_LIBPNG).dev
- $(CP_) libpng_$(SHARE_LIBPNG).dev libpng.dev
-
-# Define the shared version of libpng.
-# Note that it requires libz, which must be searched *after* libpng.
-libpng_1.dev: $(MAKEFILE) $(LIBPNG_MAK) $(ECHOGS_XE) zlibe.dev
- $(SETMOD) libpng_1 -lib $(LIBPNG_NAME)
- $(ADDMOD) libpng_1 -include zlibe
-
-# Define the non-shared version of libpng.
-libpng_0.dev: $(LIBPNG_MAK) $(ECHOGS_XE) $(png_1) $(png_2)\
- zlibe.dev libpng$(PVERSION).dev
- $(SETMOD) libpng_0 $(png_1)
- $(ADDMOD) libpng_0 $(png_2)
- $(ADDMOD) libpng_0 -include zlibe libpng$(PVERSION)
-
-libpng89.dev: $(LIBPNG_MAK) $(ECHOGS_XE) pngwio.$(OBJ)
- $(SETMOD) libpng89 pngwio.$(OBJ)
-
-libpng90.dev: $(LIBPNG_MAK) $(ECHOGS_XE) pngwio.$(OBJ) crc32.dev
- $(SETMOD) libpng90 pngwio.$(OBJ) -include crc32
-
-libpng95.dev: $(LIBPNG_MAK) $(ECHOGS_XE) pngwio.$(OBJ) crc32.dev
- $(SETMOD) libpng95 pngwio.$(OBJ) -include crc32
-
-libpng96.dev: $(LIBPNG_MAK) $(ECHOGS_XE) pngwio.$(OBJ) crc32.dev
- $(SETMOD) libpng96 pngwio.$(OBJ) -include crc32
-# Copyright (C) 1995, 1996, 1997 Aladdin Enterprises. All rights reserved.
-#
-# This file is part of Aladdin Ghostscript.
-#
-# Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
-# or distributor accepts any responsibility for the consequences of using it,
-# or for whether it serves any particular purpose or works at all, unless he
-# or she says so in writing. Refer to the Aladdin Ghostscript Free Public
-# License (the "License") for full details.
-#
-# Every copy of Aladdin Ghostscript must include a copy of the License,
-# normally in a plain ASCII text file named PUBLIC. The License grants you
-# the right to copy, modify and redistribute Aladdin Ghostscript, but only
-# under certain conditions described in the License. Among other things, the
-# License requires that the copyright notice and this notice be preserved on
-# all copies.
-
-# makefile for zlib library code.
-
-# This partial makefile compiles the zlib library for use in Ghostscript.
-# You can get the source code for this library from:
-# ftp://ftp.uu.net/pub/archiving/zip/zlib/zlib104.zip (zlib 1.0.4)
-# or zlib-1.0.4.tar.gz
-# Please see Ghostscript's `make.txt' file for instructions about how to
-# unpack these archives.
-
-# Define the name of this makefile.
-ZLIB_MAK=zlib.mak
-
-# ZSRCDIR is defined in the platform-specific makefile, not here,
-# as the directory where the zlib sources are stored.
-#ZSRCDIR=zlib
-ZSRC=$(ZSRCDIR)$(D)
-# We would like to define
-#CCCZ=$(CCC) -I$(ZSRCDIR) -Dverbose=-1
-# but the Watcom C compiler has strange undocumented restrictions on what can
-# follow a -D=, and it doesn't allow negative numbers. Instead, we define
-# (in gs.mak):
-#CCCZ=$(CCC) -I. -I$(ZSRCDIR)
-# and handle the definition of verbose in a different, more awkward way.
-
-# We keep all of the zlib code in a separate directory so as not to
-# inadvertently mix it up with Aladdin Enterprises' own code.
-ZDEP=$(AK)
-
-# Contrary to what some portability bigots assert as fact, C compilers are
-# not consistent about where they start searching for #included files:
-# some always start by looking in the same directory as the .c file being
-# compiled, before using the search path specified with -I on the command
-# line, while others do not do this. For this reason, we must explicitly
-# copy and then delete all the .c files, because they need to obtain our
-# modified version of zutil.h. We must also copy all header files that
-# reference zutil.h directly or indirectly.
-
-# Code common to compression and decompression.
-
-zlibc_=zutil.$(OBJ)
-zlibc.dev: $(ZLIB_MAK) $(ECHOGS_XE) $(zlibc_)
- $(SETMOD) zlibc $(zlibc_)
-
-zutil.h: $(ZSRC)zutil.h $(ECHOGS_XE)
- $(EXP)echogs -w zutil.h -x 23 define verbose -s - -1
- $(EXP)echogs -a zutil.h -+R $(ZSRC)zutil.h
-
-zutil.$(OBJ): $(ZSRC)zutil.c $(ZDEP) zutil.h
- $(CP_) $(ZSRC)zutil.c .
- $(CCCZ) zutil.c
- $(RM_) zutil.c
-
-# Encoding (compression) code.
-
-deflate.h: $(ZSRC)deflate.h zutil.h
- $(CP_) $(ZSRC)deflate.h .
-
-zlibe.dev: $(MAKEFILE) zlibe_$(SHARE_ZLIB).dev
- $(CP_) zlibe_$(SHARE_ZLIB).dev zlibe.dev
-
-zlibe_1.dev: $(MAKEFILE) $(ZLIB_MAK) $(ECHOGS_XE)
- $(SETMOD) zlibe_1 -lib $(ZLIB_NAME)
-
-zlibe_=adler32.$(OBJ) deflate.$(OBJ) trees.$(OBJ)
-zlibe_0.dev: $(ZLIB_MAK) $(ECHOGS_XE) zlibc.dev $(zlibe_)
- $(SETMOD) zlibe_0 $(zlibe_)
- $(ADDMOD) zlibe_0 -include zlibc
-
-adler32.$(OBJ): $(ZSRC)adler32.c $(ZDEP)
- $(CP_) $(ZSRC)adler32.c .
- $(CCCZ) adler32.c
- $(RM_) adler32.c
-
-deflate.$(OBJ): $(ZSRC)deflate.c $(ZDEP) deflate.h
- $(CP_) $(ZSRC)deflate.c .
- $(CCCZ) deflate.c
- $(RM_) deflate.c
-
-trees.$(OBJ): $(ZSRC)trees.c $(ZDEP) deflate.h
- $(CP_) $(ZSRC)trees.c .
- $(CCCZ) trees.c
- $(RM_) trees.c
-
-# The zlib filters per se don't need crc32, but libpng versions starting
-# with 0.90 do.
-
-crc32.dev: $(MAKEFILE) crc32_$(SHARE_ZLIB).dev
- $(CP_) crc32_$(SHARE_ZLIB).dev crc32.dev
-
-crc32_1.dev: $(MAKEFILE) $(ZLIB_MAK) $(ECHOGS_XE)
- $(SETMOD) crc32_1 -lib $(ZLIB_NAME)
-
-crc32_0.dev: $(ZLIB_MAK) $(ECHOGS_XE) crc32.$(OBJ)
- $(SETMOD) crc32_0 crc32.$(OBJ)
-
-crc32.$(OBJ): $(ZSRC)crc32.c $(ZDEP) deflate.h
- $(CP_) $(ZSRC)crc32.c .
- $(CCCZ) crc32.c
- $(RM_) crc32.c
-
-# Decoding (decompression) code.
-
-zlibd.dev: $(MAKEFILE) zlibd_$(SHARE_ZLIB).dev
- $(CP_) zlibd_$(SHARE_ZLIB).dev zlibd.dev
-
-zlibd_1.dev: $(MAKEFILE) $(ZLIB_MAK) $(ECHOGS_XE)
- $(SETMOD) zlibd_1 -lib $(ZLIB_NAME)
-
-zlibd1_=infblock.$(OBJ) infcodes.$(OBJ) inffast.$(OBJ)
-zlibd2_=inflate.$(OBJ) inftrees.$(OBJ) infutil.$(OBJ)
-zlibd_ = $(zlibd1_) $(zlibd2_)
-zlibd_0.dev: $(ZLIB_MAK) $(ECHOGS_XE) zlibc.dev $(zlibd_)
- $(SETMOD) zlibd_0 $(zlibd1_)
- $(ADDMOD) zlibd_0 -obj $(zlibd2_)
- $(ADDMOD) zlibd_0 -include zlibc
-
-infblock.$(OBJ): $(ZSRC)infblock.c $(ZDEP) zutil.h
- $(CP_) $(ZSRC)infblock.c .
- $(CCCZ) infblock.c
- $(RM_) infblock.c
-
-infcodes.$(OBJ): $(ZSRC)infcodes.c $(ZDEP) zutil.h
- $(CP_) $(ZSRC)infcodes.c .
- $(CCCZ) infcodes.c
- $(RM_) infcodes.c
-
-inffast.$(OBJ): $(ZSRC)inffast.c $(ZDEP) zutil.h
- $(CP_) $(ZSRC)inffast.c .
- $(CCCZ) inffast.c
- $(RM_) inffast.c
-
-inflate.$(OBJ): $(ZSRC)inflate.c $(ZDEP) zutil.h
- $(CP_) $(ZSRC)inflate.c .
- $(CCCZ) inflate.c
- $(RM_) inflate.c
-
-inftrees.$(OBJ): $(ZSRC)inftrees.c $(ZDEP) zutil.h
- $(CP_) $(ZSRC)inftrees.c .
- $(CCCZ) inftrees.c
- $(RM_) inftrees.c
-
-infutil.$(OBJ): $(ZSRC)infutil.c $(ZDEP) zutil.h
- $(CP_) $(ZSRC)infutil.c .
- $(CCCZ) infutil.c
- $(RM_) infutil.c
-# Copyright (C) 1989, 1996, 1997 Aladdin Enterprises. All rights reserved.
-#
-# This file is part of Aladdin Ghostscript.
-#
-# Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
-# or distributor accepts any responsibility for the consequences of using it,
-# or for whether it serves any particular purpose or works at all, unless he
-# or she says so in writing. Refer to the Aladdin Ghostscript Free Public
-# License (the "License") for full details.
-#
-# Every copy of Aladdin Ghostscript must include a copy of the License,
-# normally in a plain ASCII text file named PUBLIC. The License grants you
-# the right to copy, modify and redistribute Aladdin Ghostscript, but only
-# under certain conditions described in the License. Among other things, the
-# License requires that the copyright notice and this notice be preserved on
-# all copies.
-
-# makefile for device drivers.
-
-# Define the name of this makefile.
-DEVS_MAK=devs.mak
-
-###### --------------------------- Catalog -------------------------- ######
-
-# It is possible to build configurations with an arbitrary collection of
-# device drivers, although some drivers are supported only on a subset
-# of the target platforms. The currently available drivers are:
-
-# MS-DOS displays (note: not usable with Desqview/X):
-# MS-DOS EGA and VGA:
-# ega EGA (640x350, 16-color)
-# vga VGA (640x480, 16-color)
-# MS-DOS SuperVGA:
-# * ali SuperVGA using Avance Logic Inc. chipset, 256-color modes
-# * atiw ATI Wonder SuperVGA, 256-color modes
-# * s3vga SuperVGA using S3 86C911 chip (e.g., Diamond Stealth board)
-# svga16 Generic SuperVGA in 800x600, 16-color mode
-# * tseng SuperVGA using Tseng Labs ET3000/4000 chips, 256-color modes
-# * tvga SuperVGA using Trident chipset, 256-color modes
-# ****** NOTE: The vesa device does not work with the Watcom (32-bit MS-DOS)
-# ****** compiler or executable.
-# vesa SuperVGA with VESA standard API driver
-# MS-DOS other:
-# bgi Borland Graphics Interface (CGA) [MS-DOS only]
-# * herc Hercules Graphics display [MS-DOS only]
-# * pe Private Eye display
-# Other displays:
-# MS Windows:
-# mswindll Microsoft Windows 3.1 DLL [MS Windows only]
-# mswinprn Microsoft Windows 3.0, 3.1 DDB printer [MS Windows only]
-# mswinpr2 Microsoft Windows 3.0, 3.1 DIB printer [MS Windows only]
-# OS/2:
-# * os2pm OS/2 Presentation Manager [OS/2 only]
-# * os2dll OS/2 DLL bitmap [OS/2 only]
-# * os2prn OS/2 printer [OS/2 only]
-# Unix and VMS:
-# ****** NOTE: For direct frame buffer addressing under SCO Unix or Xenix,
-# ****** edit the definition of EGAVGA below.
-# * att3b1 AT&T 3b1/Unixpc monochrome display [3b1 only]
-# * lvga256 Linux vgalib, 256-color VGA modes [Linux only]
-# * sonyfb Sony Microsystems monochrome display [Sony only]
-# * sunview SunView window system [SunOS only]
-# + vgalib Linux PC with VGALIB [Linux only]
-# x11 X Windows version 11, release >=4 [Unix and VMS only]
-# x11alpha X Windows masquerading as a device with alpha capability
-# x11cmyk X Windows masquerading as a 1-bit-per-plane CMYK device
-# x11gray2 X Windows as a 2-bit gray-scale device
-# x11mono X Windows masquerading as a black-and-white device
-# Platform-independent:
-# * sxlcrt CRT sixels, e.g. for VT240-like terminals
-# Printers:
-# * ap3250 Epson AP3250 printer
-# * appledmp Apple Dot Matrix Printer (should also work with Imagewriter)
-# bj10e Canon BubbleJet BJ10e
-# * bj200 Canon BubbleJet BJ200
-# * bjc600 Canon Color BubbleJet BJC-600, BJC-4000 and BJC-70
-# also good for Apple printers like the StyleWriter 2x00
-# * bjc800 Canon Color BubbleJet BJC-800
-# * ccr CalComp Raster format
-# * cdeskjet H-P DeskJet 500C with 1 bit/pixel color
-# * cdjcolor H-P DeskJet 500C with 24 bit/pixel color and
-# high-quality color (Floyd-Steinberg) dithering;
-# also good for DeskJet 540C and Citizen Projet IIc (-r200x300)
-# * cdjmono H-P DeskJet 500C printing black only;
-# also good for DeskJet 510, 520, and 540C (black only)
-# * cdj500 H-P DeskJet 500C (same as cdjcolor)
-# * cdj550 H-P DeskJet 550C/560C/660C/660Cse
-# * cp50 Mitsubishi CP50 color printer
-# * declj250 alternate DEC LJ250 driver
-# + deskjet H-P DeskJet and DeskJet Plus
-# djet500 H-P DeskJet 500; use -r600 for DJ 600 series
-# * djet500c H-P DeskJet 500C alternate driver
-# (does not work on 550C or 560C)
-# * dnj650c H-P DesignJet 650C
-# epson Epson-compatible dot matrix printers (9- or 24-pin)
-# * eps9mid Epson-compatible 9-pin, interleaved lines
-# (intermediate resolution)
-# * eps9high Epson-compatible 9-pin, interleaved lines
-# (triple resolution)
-# * epsonc Epson LQ-2550 and Fujitsu 3400/2400/1200 color printers
-# * ibmpro IBM 9-pin Proprinter
-# * imagen Imagen ImPress printers
-# * iwhi Apple Imagewriter in high-resolution mode
-# * iwlo Apple Imagewriter in low-resolution mode
-# * iwlq Apple Imagewriter LQ in 320 x 216 dpi mode
-# * jetp3852 IBM Jetprinter ink-jet color printer (Model #3852)
-# + laserjet H-P LaserJet
-# * la50 DEC LA50 printer
-# * la70 DEC LA70 printer
-# * la70t DEC LA70 printer with low-resolution text enhancement
-# * la75 DEC LA75 printer
-# * la75plus DEC LA75plus printer
-# * lbp8 Canon LBP-8II laser printer
-# * lips3 Canon LIPS III laser printer in English (CaPSL) mode
-# * ln03 DEC LN03 printer
-# * lj250 DEC LJ250 Companion color printer
-# + ljet2p H-P LaserJet IId/IIp/III* with TIFF compression
-# + ljet3 H-P LaserJet III* with Delta Row compression
-# + ljet3d H-P LaserJet IIID with duplex capability
-# + ljet4 H-P LaserJet 4 (defaults to 600 dpi)
-# + lj4dith H-P LaserJet 4 with Floyd-Steinberg dithering
-# + ljetplus H-P LaserJet Plus
-# lj5mono H-P LaserJet 5 & 6 family (PCL XL), bitmap:
-# see below for restrictions & advice
-# lj5gray H-P LaserJet 5 & 6 family, gray-scale bitmap;
-# see below for restrictions & advice
-# * lp2563 H-P 2563B line printer
-# * lp8000 Epson LP-8000 laser printer
-# * lq850 Epson LQ850 printer at 360 x 360 DPI resolution;
-# also good for Canon BJ300 with LQ850 emulation
-# * m8510 C.Itoh M8510 printer
-# * necp6 NEC P6/P6+/P60 printers at 360 x 360 DPI resolution
-# * nwp533 Sony Microsystems NWP533 laser printer [Sony only]
-# * oce9050 OCE 9050 printer
-# * oki182 Okidata MicroLine 182
-# * okiibm Okidata MicroLine IBM-compatible printers
-# * paintjet alternate H-P PaintJet color printer
-# * pj H-P PaintJet XL driver
-# * pjetxl alternate H-P PaintJet XL driver
-# * pjxl H-P PaintJet XL color printer
-# * pjxl300 H-P PaintJet XL300 color printer;
-# also good for PaintJet 1200C
-# (pxlmono) H-P black-and-white PCL XL printers (LaserJet 5 and 6 family)
-# (pxlcolor) H-P color PCL XL printers (none available yet)
-# * r4081 Ricoh 4081 laser printer
-# * sj48 StarJet 48 inkjet printer
-# * sparc SPARCprinter
-# * st800 Epson Stylus 800 printer
-# * stcolor Epson Stylus Color
-# * t4693d2 Tektronix 4693d color printer, 2 bits per R/G/B component
-# * t4693d4 Tektronix 4693d color printer, 4 bits per R/G/B component
-# * t4693d8 Tektronix 4693d color printer, 8 bits per R/G/B component
-# * tek4696 Tektronix 4695/4696 inkjet plotter
-# * uniprint Unified printer driver -- Configurable Color ESC/P-,
-# ESC/P2-, HP-RTL/PCL mono/color driver
-# * xes Xerox XES printers (2700, 3700, 4045, etc.)
-# Fax systems:
-# * dfaxhigh DigiBoard, Inc.'s DigiFAX software format (high resolution)
-# * dfaxlow DigiFAX low (normal) resolution
-# Fax file format:
-# ****** NOTE: all of these drivers adjust the page size to match
-# ****** one of the three CCITT standard sizes (U.S. letter with A4 width,
-# ****** A4, or B4).
-# faxg3 Group 3 fax, with EOLs but no header or EOD
-# faxg32d Group 3 2-D fax, with EOLs but no header or EOD
-# faxg4 Group 4 fax, with EOLs but no header or EOD
-# tiffcrle TIFF "CCITT RLE 1-dim" (= Group 3 fax with no EOLs)
-# tiffg3 TIFF Group 3 fax (with EOLs)
-# tiffg32d TIFF Group 3 2-D fax
-# tiffg4 TIFF Group 4 fax
-# High-level file formats:
-# epswrite EPS output (like PostScript Distillery)
-# pdfwrite PDF output (like Adobe Acrobat Distiller)
-# pswrite PostScript output (like PostScript Distillery)
-# pxlmono Black-and-white PCL XL
-# pxlcolor Color PCL XL
-# Other raster file formats and devices:
-# bit Plain bits, monochrome
-# bitrgb Plain bits, RGB
-# bitcmyk Plain bits, CMYK
-# bmpmono Monochrome MS Windows .BMP file format
-# bmp16 4-bit (EGA/VGA) .BMP file format
-# bmp256 8-bit (256-color) .BMP file format
-# bmp16m 24-bit .BMP file format
-# cgmmono Monochrome (black-and-white) CGM -- LOW LEVEL OUTPUT ONLY
-# cgm8 8-bit (256-color) CGM -- DITTO
-# cgm24 24-bit color CGM -- DITTO
-# * cif CIF file format for VLSI
-# jpeg JPEG format, RGB output
-# jpeggray JPEG format, gray output
-# miff24 ImageMagick MIFF format, 24-bit direct color, RLE compressed
-# * mgrmono 1-bit monochrome MGR devices
-# * mgrgray2 2-bit gray scale MGR devices
-# * mgrgray4 4-bit gray scale MGR devices
-# * mgrgray8 8-bit gray scale MGR devices
-# * mgr4 4-bit (VGA) color MGR devices
-# * mgr8 8-bit color MGR devices
-# pcxmono PCX file format, monochrome (1-bit black and white)
-# pcxgray PCX file format, 8-bit gray scale
-# pcx16 PCX file format, 4-bit planar (EGA/VGA) color
-# pcx256 PCX file format, 8-bit chunky color
-# pcx24b PCX file format, 24-bit color (3 8-bit planes)
-# pcxcmyk PCX file format, 4-bit chunky CMYK color
-# pbm Portable Bitmap (plain format)
-# pbmraw Portable Bitmap (raw format)
-# pgm Portable Graymap (plain format)
-# pgmraw Portable Graymap (raw format)
-# pgnm Portable Graymap (plain format), optimizing to PBM if possible
-# pgnmraw Portable Graymap (raw format), optimizing to PBM if possible
-# pnm Portable Pixmap (plain format) (RGB), optimizing to PGM or PBM
-# if possible
-# pnmraw Portable Pixmap (raw format) (RGB), optimizing to PGM or PBM
-# if possible
-# ppm Portable Pixmap (plain format) (RGB)
-# ppmraw Portable Pixmap (raw format) (RGB)
-# pkm Portable inKmap (plain format) (4-bit CMYK => RGB)
-# pkmraw Portable inKmap (raw format) (4-bit CMYK => RGB)
-# pngmono Monochrome Portable Network Graphics (PNG)
-# pnggray 8-bit gray Portable Network Graphics (PNG)
-# png16 4-bit color Portable Network Graphics (PNG)
-# png256 8-bit color Portable Network Graphics (PNG)
-# png16m 24-bit color Portable Network Graphics (PNG)
-# psmono PostScript (Level 1) monochrome image
-# psgray PostScript (Level 1) 8-bit gray image
-# sgirgb SGI RGB pixmap format
-# tiff12nc TIFF 12-bit RGB, no compression
-# tiff24nc TIFF 24-bit RGB, no compression (NeXT standard format)
-# tifflzw TIFF LZW (tag = 5) (monochrome)
-# tiffpack TIFF PackBits (tag = 32773) (monochrome)
-
-# User-contributed drivers marked with * require hardware or software
-# that is not available to Aladdin Enterprises. Please contact the
-# original contributors, not Aladdin Enterprises, if you have questions.
-# Contact information appears in the driver entry below.
-#
-# Drivers marked with a + are maintained by Aladdin Enterprises with
-# the assistance of users, since Aladdin Enterprises doesn't have access to
-# the hardware for these either.
-
-# If you add drivers, it would be nice if you kept each list
-# in alphabetical order.
-
-###### ----------------------- End of catalog ----------------------- ######
-
-# As noted in gs.mak, DEVICE_DEVS and DEVICE_DEVS1..15 select the devices
-# that should be included in a given configuration. By convention, these
-# are used as follows. Each of these must be limited to about 10 devices
-# so as not to overflow the 120 character limit on MS-DOS command lines.
-# DEVICE_DEVS - the default device, and any display devices.
-# DEVICE_DEVS1 - additional display devices if needed.
-# DEVICE_DEVS2 - dot matrix printers.
-# DEVICE_DEVS3 - H-P monochrome printers.
-# DEVICE_DEVS4 - H-P color printers.
-# DEVICE_DEVS5 - additional H-P printers if needed.
-# DEVICE_DEVS6 - other ink-jet and laser printers.
-# DEVICE_DEVS7 - fax file formats.
-# DEVICE_DEVS8 - PCX file formats.
-# DEVICE_DEVS9 - PBM/PGM/PPM file formats.
-# DEVICE_DEVS10 - black-and-white TIFF file formats.
-# DEVICE_DEVS11 - BMP and color TIFF file formats.
-# DEVICE_DEVS12 - PostScript image and 'bit' file formats.
-# DEVICE_DEVS13 - PNG file formats.
-# DEVICE_DEVS14 - CGM, JPEG, and MIFF file formats.
-# DEVICE_DEVS15 - high-level (PostScript and PDF) file formats.
-# Feel free to disregard this convention if it gets in your way.
-
-# If you want to add a new device driver, the examples below should be
-# enough of a guide to the correct form for the makefile rules.
-# Note that all drivers other than displays must include page.dev in their
-# dependencies and use $(SETPDEV) rather than $(SETDEV) in their rule bodies.
-
-# All device drivers depend on the following:
-GDEV=$(AK) $(ECHOGS_XE) $(gserrors_h) $(gx_h) $(gxdevice_h)
-
-# "Printer" drivers depend on the following:
-PDEVH=$(AK) $(gdevprn_h)
-
-# Define the header files for device drivers. Every header file used by
-# more than one device driver family must be listed here.
-gdev8bcm_h=gdev8bcm.h
-gdevpccm_h=gdevpccm.h
-gdevpcfb_h=gdevpcfb.h $(dos__h)
-gdevpcl_h=gdevpcl.h
-gdevsvga_h=gdevsvga.h
-gdevx_h=gdevx.h
-
-###### ----------------------- Device support ----------------------- ######
-
-# Provide a mapping between StandardEncoding and ISOLatin1Encoding.
-gdevemap.$(OBJ): gdevemap.c $(AK) $(std_h)
-
-# Implement dynamic color management for 8-bit mapped color displays.
-gdev8bcm.$(OBJ): gdev8bcm.c $(AK) \
- $(gx_h) $(gxdevice_h) $(gdev8bcm_h)
-
-###### ------------------- MS-DOS display devices ------------------- ######
-
-# There are really only three drivers: an EGA/VGA driver (4 bit-planes,
-# plane-addressed), a SuperVGA driver (8 bit-planes, byte addressed),
-# and a special driver for the S3 chip.
-
-# PC display color mapping
-gdevpccm.$(OBJ): gdevpccm.c $(AK) \
- $(gx_h) $(gsmatrix_h) $(gxdevice_h) $(gdevpccm_h)
-
-### ----------------------- EGA and VGA displays ----------------------- ###
-
-# The shared MS-DOS makefile defines PCFBASM as either gdevegaa.$(OBJ)
-# or an empty string.
-
-gdevegaa.$(OBJ): gdevegaa.asm
-
-# NOTE: for direct frame buffer addressing under SCO Unix or Xenix,
-# change gdevevga to gdevsco in the following line. Also, since
-# SCO's /bin/as does not support the "out" instructions, you must build
-# the gnu assembler and have it on your path as "as".
-EGAVGA=gdevevga.$(OBJ) gdevpcfb.$(OBJ) gdevpccm.$(OBJ) $(PCFBASM)
-#EGAVGA=gdevsco.$(OBJ) gdevpcfb.$(OBJ) gdevpccm.$(OBJ) $(PCFBASM)
-
-gdevevga.$(OBJ): gdevevga.c $(GDEV) $(memory__h) $(gdevpcfb_h)
- $(CCD) gdevevga.c
-
-gdevsco.$(OBJ): gdevsco.c $(GDEV) $(memory__h) $(gdevpcfb_h)
-
-# Common code for MS-DOS and SCO.
-gdevpcfb.$(OBJ): gdevpcfb.c $(GDEV) $(memory__h) $(gconfigv_h)\
- $(gdevpccm_h) $(gdevpcfb_h) $(gsparam_h)
- $(CCD) gdevpcfb.c
-
-# The EGA/VGA family includes EGA and VGA. Many SuperVGAs in 800x600,
-# 16-color mode can share the same code; see the next section below.
-
-ega.dev: $(EGAVGA)
- $(SETDEV) ega $(EGAVGA)
-
-vga.dev: $(EGAVGA)
- $(SETDEV) vga $(EGAVGA)
-
-### ------------------------- SuperVGA displays ------------------------ ###
-
-# SuperVGA displays in 16-color, 800x600 mode are really just slightly
-# glorified VGA's, so we can handle them all with a single driver.
-# The way to select them on the command line is with
-# -sDEVICE=svga16 -dDisplayMode=NNN
-# where NNN is the display mode in decimal. See use.txt for the modes
-# for some popular display chipsets.
-
-svga16.dev: $(EGAVGA)
- $(SETDEV) svga16 $(EGAVGA)
-
-# More capable SuperVGAs have a wide variety of slightly differing
-# interfaces, so we need a separate driver for each one.
-
-SVGA=gdevsvga.$(OBJ) gdevpccm.$(OBJ) $(PCFBASM)
-
-gdevsvga.$(OBJ): gdevsvga.c $(GDEV) $(memory__h) $(gconfigv_h)\
- $(gsparam_h) $(gxarith_h) $(gdevpccm_h) $(gdevpcfb_h) $(gdevsvga_h)
- $(CCD) gdevsvga.c
-
-# The SuperVGA family includes: Avance Logic Inc., ATI Wonder, S3,
-# Trident, Tseng ET3000/4000, and VESA.
-
-ali.dev: $(SVGA)
- $(SETDEV) ali $(SVGA)
-
-atiw.dev: $(SVGA)
- $(SETDEV) atiw $(SVGA)
-
-tseng.dev: $(SVGA)
- $(SETDEV) tseng $(SVGA)
-
-tvga.dev: $(SVGA)
- $(SETDEV) tvga $(SVGA)
-
-vesa.dev: $(SVGA)
- $(SETDEV) vesa $(SVGA)
-
-# The S3 driver doesn't share much code with the others.
-
-s3vga_=gdevs3ga.$(OBJ) gdevsvga.$(OBJ) gdevpccm.$(OBJ)
-s3vga.dev: $(SVGA) $(s3vga_)
- $(SETDEV) s3vga $(SVGA)
- $(ADDMOD) s3vga -obj $(s3vga_)
-
-gdevs3ga.$(OBJ): gdevs3ga.c $(GDEV) $(gdevpcfb_h) $(gdevsvga_h)
- $(CCD) gdevs3ga.c
-
-### ------------ The BGI (Borland Graphics Interface) device ----------- ###
-
-cgaf.$(OBJ): $(BGIDIR)\cga.bgi
- $(BGIDIR)\bgiobj /F $(BGIDIR)\cga
-
-egavgaf.$(OBJ): $(BGIDIR)\egavga.bgi
- $(BGIDIR)\bgiobj /F $(BGIDIR)\egavga
-
-# Include egavgaf.$(OBJ) for debugging only.
-bgi_=gdevbgi.$(OBJ) cgaf.$(OBJ)
-bgi.dev: $(bgi_)
- $(SETDEV) bgi $(bgi_)
- $(ADDMOD) bgi -lib $(LIBDIR)\graphics
-
-gdevbgi.$(OBJ): gdevbgi.c $(GDEV) $(MAKEFILE) $(gxxfont_h)
- $(CCC) -DBGI_LIB="$(BGIDIRSTR)" gdevbgi.c
-
-### ------------------- The Hercules Graphics display ------------------- ###
-
-herc_=gdevherc.$(OBJ)
-herc.dev: $(herc_)
- $(SETDEV) herc $(herc_)
-
-gdevherc.$(OBJ): gdevherc.c $(GDEV) $(dos__h) $(gsmatrix_h) $(gxbitmap_h)
- $(CCC) gdevherc.c
-
-### ---------------------- The Private Eye display ---------------------- ###
-### Note: this driver was contributed by a user: ###
-### please contact narf@media-lab.media.mit.edu if you have questions. ###
-
-pe_=gdevpe.$(OBJ)
-pe.dev: $(pe_)
- $(SETDEV) pe $(pe_)
-
-gdevpe.$(OBJ): gdevpe.c $(GDEV) $(memory__h)
-
-###### ----------------------- Other displays ------------------------ ######
-
-### -------------------- The MS-Windows 3.n DLL ------------------------- ###
-
-gsdll_h=gsdll.h
-
-gdevmswn_h=gdevmswn.h $(GDEV)\
- $(dos__h) $(memory__h) $(string__h) $(windows__h)\
- gp_mswin.h
-
-gdevmswn.$(OBJ): gdevmswn.c $(gdevmswn_h) $(gp_h) $(gpcheck_h) \
- $(gsdll_h) $(gsparam_h) $(gdevpccm_h)
- $(CCCWIN) gdevmswn.c
-
-gdevmsxf.$(OBJ): gdevmsxf.c $(ctype__h) $(math__h) $(memory__h) $(string__h)\
- $(gdevmswn_h) $(gsstruct_h) $(gsutil_h) $(gxxfont_h)
- $(CCCWIN) gdevmsxf.c
-
-# An implementation using a DIB filled by an image device.
-gdevwdib.$(OBJ): gdevwdib.c $(gdevmswn_h) $(gsdll_h) $(gxdevmem_h)
- $(CCCWIN) gdevwdib.c
-
-mswindll_=gdevmswn.$(OBJ) gdevmsxf.$(OBJ) gdevwdib.$(OBJ) \
- gdevemap.$(OBJ) gdevpccm.$(OBJ)
-mswindll.dev: $(mswindll_)
- $(SETDEV) mswindll $(mswindll_)
-
-### -------------------- The MS-Windows DDB 3.n printer ----------------- ###
-
-mswinprn_=gdevwprn.$(OBJ) gdevmsxf.$(OBJ)
-mswinprn.dev: $(mswinprn_)
- $(SETDEV) mswinprn $(mswinprn_)
-
-gdevwprn.$(OBJ): gdevwprn.c $(gdevmswn_h) $(gp_h)
- $(CCCWIN) gdevwprn.c
-
-### -------------------- The MS-Windows DIB 3.n printer ----------------- ###
-
-mswinpr2_=gdevwpr2.$(OBJ)
-mswinpr2.dev: $(mswinpr2_) page.dev
- $(SETPDEV) mswinpr2 $(mswinpr2_)
-
-gdevwpr2.$(OBJ): gdevwpr2.c $(PDEVH) $(windows__h)\
- $(gdevpccm_h) $(gp_h) gp_mswin.h
- $(CCCWIN) gdevwpr2.c
-
-### ------------------ OS/2 Presentation Manager device ----------------- ###
-
-os2pm_=gdevpm.$(OBJ) gdevpccm.$(OBJ)
-os2pm.dev: $(os2pm_)
- $(SETDEV) os2pm $(os2pm_)
-
-os2dll_=gdevpm.$(OBJ) gdevpccm.$(OBJ)
-os2dll.dev: $(os2dll_)
- $(SETDEV) os2dll $(os2dll_)
-
-gdevpm.$(OBJ): gdevpm.c $(string__h)\
- $(gp_h) $(gpcheck_h)\
- $(gsdll_h) $(gserrors_h) $(gsexit_h) $(gsparam_h)\
- $(gx_h) $(gxdevice_h) $(gxdevmem_h)\
- $(gdevpccm_h) gdevpm.h
-
-### --------------------------- The OS/2 printer ------------------------ ###
-
-os2prn_=gdevos2p.$(OBJ)
-os2prn.dev: $(os2prn_) page.dev
- $(SETPDEV) os2prn $(os2prn_)
-
-os2prn.$(OBJ): os2prn.c $(gp_h)
-
-### -------------- The AT&T 3b1 Unixpc monochrome display --------------- ###
-### Note: this driver was contributed by a user: please contact ###
-### Andy Fyfe (andy@cs.caltech.edu) if you have questions. ###
-
-att3b1_=gdev3b1.$(OBJ)
-att3b1.dev: $(att3b1_)
- $(SETDEV) att3b1 $(att3b1_)
-
-gdev3b1.$(OBJ): gdev3b1.c $(GDEV)
-
-### ---------------------- Linux PC with vgalib ------------------------- ###
-### Note: these drivers were contributed by users. ###
-### For questions about the lvga256 driver, please contact ###
-### Ludger Kunz (ludger.kunz@fernuni-hagen.de). ###
-### For questions about the vgalib driver, please contact ###
-### Erik Talvola (talvola@gnu.ai.mit.edu). ###
-
-lvga256_=gdevl256.$(OBJ)
-lvga256.dev: $(lvga256_)
- $(SETDEV) lvga256 $(lvga256_)
- $(ADDMOD) lvga256 -lib vga vgagl
-
-gdevl256.$(OBJ): gdevl256.c $(GDEV)
-
-vgalib_=gdevvglb.$(OBJ) gdevpccm.$(OBJ)
-vgalib.dev: $(vgalib_)
- $(SETDEV) vgalib $(vgalib_)
- $(ADDMOD) vgalib -lib vga
-
-gdevvglb.$(OBJ): gdevvglb.c $(GDEV) $(gdevpccm_h) $(gsparam_h)
-
-### ------------------- Sony NeWS frame buffer device ------------------ ###
-### Note: this driver was contributed by a user: please contact ###
-### Mike Smolenski (mike@intertech.com) if you have questions. ###
-
-# This is implemented as a 'printer' device.
-sonyfb_=gdevsnfb.$(OBJ)
-sonyfb.dev: $(sonyfb_) page.dev
- $(SETPDEV) sonyfb $(sonyfb_)
-
-gdevsnfb.$(OBJ): gdevsnfb.c $(PDEVH)
-
-### ------------------------ The SunView device ------------------------ ###
-### Note: this driver is maintained by a user: if you have questions, ###
-### please contact Andreas Stolcke (stolcke@icsi.berkeley.edu). ###
-
-sunview_=gdevsun.$(OBJ)
-sunview.dev: $(sunview_)
- $(SETDEV) sunview $(sunview_)
- $(ADDMOD) sunview -lib suntool sunwindow pixrect
-
-gdevsun.$(OBJ): gdevsun.c $(GDEV) $(malloc__h)\
- $(gscdefs_h) $(gserrors_h) $(gsmatrix_h)
-
-### -------------------------- The X11 device -------------------------- ###
-
-# Aladdin Enterprises does not support Ghostview. For more information
-# about Ghostview, please contact Tim Theisen (ghostview@cs.wisc.edu).
-
-# See the main makefile for the definition of XLIBS.
-x11_=gdevx.$(OBJ) gdevxini.$(OBJ) gdevxxf.$(OBJ) gdevemap.$(OBJ)
-x11.dev: $(x11_)
- $(SETDEV) x11 $(x11_)
- $(ADDMOD) x11 -lib $(XLIBS)
-
-# See the main makefile for the definition of XINCLUDE.
-GDEVX=$(GDEV) x_.h gdevx.h $(MAKEFILE)
-gdevx.$(OBJ): gdevx.c $(GDEVX) $(math__h) $(memory__h) $(gsparam_h)
- $(CCC) $(XINCLUDE) gdevx.c
-
-gdevxini.$(OBJ): gdevxini.c $(GDEVX) $(math__h) $(memory__h) $(gserrors_h)
- $(CCC) $(XINCLUDE) gdevxini.c
-
-gdevxxf.$(OBJ): gdevxxf.c $(GDEVX) $(math__h) $(memory__h)\
- $(gsstruct_h) $(gsutil_h) $(gxxfont_h)
- $(CCC) $(XINCLUDE) gdevxxf.c
-
-# Alternate X11-based devices to help debug other drivers.
-# x11alpha pretends to have 4 bits of alpha channel.
-# x11cmyk pretends to be a CMYK device with 1 bit each of C,M,Y,K.
-# x11gray2 pretends to be a 2-bit gray-scale device.
-# x11mono pretends to be a black-and-white device.
-x11alt_=$(x11_) gdevxalt.$(OBJ)
-x11alpha.dev: $(x11alt_)
- $(SETDEV) x11alpha $(x11alt_)
- $(ADDMOD) x11alpha -lib $(XLIBS)
-
-x11cmyk.dev: $(x11alt_)
- $(SETDEV) x11cmyk $(x11alt_)
- $(ADDMOD) x11cmyk -lib $(XLIBS)
-
-x11gray2.dev: $(x11alt_)
- $(SETDEV) x11gray2 $(x11alt_)
- $(ADDMOD) x11gray2 -lib $(XLIBS)
-
-x11mono.dev: $(x11alt_)
- $(SETDEV) x11mono $(x11alt_)
- $(ADDMOD) x11mono -lib $(XLIBS)
-
-gdevxalt.$(OBJ): gdevxalt.c $(GDEVX) $(math__h) $(memory__h) $(gsparam_h)
- $(CCC) $(XINCLUDE) gdevxalt.c
-
-### ------------------------- DEC sixel displays ------------------------ ###
-### Note: this driver was contributed by a user: please contact ###
-### Phil Keegstra (keegstra@tonga.gsfc.nasa.gov) if you have questions. ###
-
-# This is a "printer" device, but it probably shouldn't be.
-# I don't know why the implementor chose to do it this way.
-sxlcrt_=gdevln03.$(OBJ)
-sxlcrt.dev: $(sxlcrt_) page.dev
- $(SETPDEV) sxlcrt $(sxlcrt_)
-
-###### --------------- Memory-buffered printer devices --------------- ######
-
-### --------------------- The Apple printer devices --------------------- ###
-### Note: these drivers were contributed by users. ###
-### If you have questions about the DMP driver, please contact ###
-### Mark Wedel (master@cats.ucsc.edu). ###
-### If you have questions about the Imagewriter drivers, please contact ###
-### Jonathan Luckey (luckey@rtfm.mlb.fl.us). ###
-### If you have questions about the Imagewriter LQ driver, please ###
-### contact Scott Barker (barkers@cuug.ab.ca). ###
-
-appledmp_=gdevadmp.$(OBJ)
-
-gdevadmp.$(OBJ): gdevadmp.c $(PDEVH)
-
-appledmp.dev: $(appledmp_) page.dev
- $(SETPDEV) appledmp $(appledmp_)
-
-iwhi.dev: $(appledmp_) page.dev
- $(SETPDEV) iwhi $(appledmp_)
-
-iwlo.dev: $(appledmp_) page.dev
- $(SETPDEV) iwlo $(appledmp_)
-
-iwlq.dev: $(appledmp_) page.dev
- $(SETPDEV) iwlq $(appledmp_)
-
-### ------------ The Canon BubbleJet BJ10e and BJ200 devices ------------ ###
-
-bj10e_=gdevbj10.$(OBJ)
-
-bj10e.dev: $(bj10e_) page.dev
- $(SETPDEV) bj10e $(bj10e_)
-
-bj200.dev: $(bj10e_) page.dev
- $(SETPDEV) bj200 $(bj10e_)
-
-gdevbj10.$(OBJ): gdevbj10.c $(PDEVH)
-
-### ------------- The CalComp Raster Format ----------------------------- ###
-### Note: this driver was contributed by a user: please contact ###
-### Ernst Muellner (ernst.muellner@oenzl.siemens.de) if you have ###
-### questions. ###
-
-ccr_=gdevccr.$(OBJ)
-ccr.dev: $(ccr_) page.dev
- $(SETPDEV) ccr $(ccr_)
-
-gdevccr.$(OBJ): gdevccr.c $(PDEVH)
-
-### ----------- The H-P DeskJet and LaserJet printer devices ----------- ###
-
-### These are essentially the same device.
-### NOTE: printing at full resolution (300 DPI) requires a printer
-### with at least 1.5 Mb of memory. 150 DPI only requires .5 Mb.
-### Note that the lj4dith driver is included with the H-P color printer
-### drivers below.
-
-HPPCL=gdevpcl.$(OBJ)
-HPMONO=gdevdjet.$(OBJ) $(HPPCL)
-
-gdevpcl.$(OBJ): gdevpcl.c $(PDEVH) $(gdevpcl_h)
-
-gdevdjet.$(OBJ): gdevdjet.c $(PDEVH) $(gdevpcl_h)
-
-deskjet.dev: $(HPMONO) page.dev
- $(SETPDEV) deskjet $(HPMONO)
-
-djet500.dev: $(HPMONO) page.dev
- $(SETPDEV) djet500 $(HPMONO)
-
-laserjet.dev: $(HPMONO) page.dev
- $(SETPDEV) laserjet $(HPMONO)
-
-ljetplus.dev: $(HPMONO) page.dev
- $(SETPDEV) ljetplus $(HPMONO)
-
-### Selecting ljet2p provides TIFF (mode 2) compression on LaserJet III,
-### IIIp, IIId, IIIsi, IId, and IIp.
-
-ljet2p.dev: $(HPMONO) page.dev
- $(SETPDEV) ljet2p $(HPMONO)
-
-### Selecting ljet3 provides Delta Row (mode 3) compression on LaserJet III,
-### IIIp, IIId, IIIsi.
-
-ljet3.dev: $(HPMONO) page.dev
- $(SETPDEV) ljet3 $(HPMONO)
-
-### Selecting ljet3d also provides duplex printing capability.
-
-ljet3d.dev: $(HPMONO) page.dev
- $(SETPDEV) ljet3d $(HPMONO)
-
-### Selecting ljet4 also provides Delta Row compression on LaserJet IV series.
-
-ljet4.dev: $(HPMONO) page.dev
- $(SETPDEV) ljet4 $(HPMONO)
-
-lp2563.dev: $(HPMONO) page.dev
- $(SETPDEV) lp2563 $(HPMONO)
-
-oce9050.dev: $(HPMONO) page.dev
- $(SETPDEV) oce9050 $(HPMONO)
-
-### ------------------ The H-P LaserJet 5 and 6 devices ----------------- ###
-
-### These drivers use H-P's new PCL XL printer language, like H-P's
-### LaserJet 5 Enhanced driver for MS Windows. We don't recommend using
-### them:
-### - If you have a LJ 5L or 5P, which isn't a "real" LaserJet 5,
-### use the ljet4 driver instead. (The lj5 drivers won't work.)
-### - If you have any other model of LJ 5 or 6, use the pxlmono
-### driver, which often produces much more compact output.
-
-gdevpxat_h=gdevpxat.h
-gdevpxen_h=gdevpxen.h
-gdevpxop_h=gdevpxop.h
-
-ljet5_=gdevlj56.$(OBJ) $(HPPCL)
-lj5mono.dev: $(ljet5_) page.dev
- $(SETPDEV) lj5mono $(ljet5_)
-
-lj5gray.dev: $(ljet5_) page.dev
- $(SETPDEV) lj5gray $(ljet5_)
-
-gdevlj56.$(OBJ): gdevlj56.c $(PDEVH) $(gdevpcl_h)\
- $(gdevpxat_h) $(gdevpxen_h) $(gdevpxop_h)
-
-### The H-P DeskJet, PaintJet, and DesignJet family color printer devices.###
-### Note: there are two different 500C drivers, both contributed by users.###
-### If you have questions about the djet500c driver, ###
-### please contact AKayser@et.tudelft.nl. ###
-### If you have questions about the cdj* drivers, ###
-### please contact g.cameron@biomed.abdn.ac.uk. ###
-### If you have questions about the dnj560c driver, ###
-### please contact koert@zen.cais.com. ###
-### If you have questions about the lj4dith driver, ###
-### please contact Eckhard.Rueggeberg@ts.go.dlr.de. ###
-### If you have questions about the BJC600/BJC4000, BJC800, or ESCP ###
-### drivers, please contact Yves.Arrouye@imag.fr. ###
-
-cdeskjet_=gdevcdj.$(OBJ) $(HPPCL)
-
-cdeskjet.dev: $(cdeskjet_) page.dev
- $(SETPDEV) cdeskjet $(cdeskjet_)
-
-cdjcolor.dev: $(cdeskjet_) page.dev
- $(SETPDEV) cdjcolor $(cdeskjet_)
-
-cdjmono.dev: $(cdeskjet_) page.dev
- $(SETPDEV) cdjmono $(cdeskjet_)
-
-cdj500.dev: $(cdeskjet_) page.dev
- $(SETPDEV) cdj500 $(cdeskjet_)
-
-cdj550.dev: $(cdeskjet_) page.dev
- $(SETPDEV) cdj550 $(cdeskjet_)
-
-declj250.dev: $(cdeskjet_) page.dev
- $(SETPDEV) declj250 $(cdeskjet_)
-
-dnj650c.dev: $(cdeskjet_) page.dev
- $(SETPDEV) dnj650c $(cdeskjet_)
-
-lj4dith.dev: $(cdeskjet_) page.dev
- $(SETPDEV) lj4dith $(cdeskjet_)
-
-pj.dev: $(cdeskjet_) page.dev
- $(SETPDEV) pj $(cdeskjet_)
-
-pjxl.dev: $(cdeskjet_) page.dev
- $(SETPDEV) pjxl $(cdeskjet_)
-
-pjxl300.dev: $(cdeskjet_) page.dev
- $(SETPDEV) pjxl300 $(cdeskjet_)
-
-# Note: the BJC600 driver also works for the BJC4000.
-bjc600.dev: $(cdeskjet_) page.dev
- $(SETPDEV) bjc600 $(cdeskjet_)
-
-bjc800.dev: $(cdeskjet_) page.dev
- $(SETPDEV) bjc800 $(cdeskjet_)
-
-escp.dev: $(cdeskjet_) page.dev
- $(SETPDEV) escp $(cdeskjet_)
-
-# NB: you can also customise the build if required, using
-# -DBitsPerPixel=<number> if you wish the default to be other than 24
-# for the generic drivers (cdj500, cdj550, pjxl300, pjtest, pjxltest).
-gdevcdj.$(OBJ): gdevcdj.c $(std_h) $(PDEVH) gdevbjc.h\
- $(gsparam_h) $(gsstate_h) $(gxlum_h)\
- $(gdevpcl_h)
-
-djet500c_=gdevdjtc.$(OBJ) $(HPPCL)
-djet500c.dev: $(djet500c_) page.dev
- $(SETPDEV) djet500c $(djet500c_)
-
-gdevdjtc.$(OBJ): gdevdjtc.c $(PDEVH) $(malloc__h) $(gdevpcl_h)
-
-### -------------------- The Mitsubishi CP50 printer -------------------- ###
-### Note: this driver was contributed by a user: please contact ###
-### Michael Hu (michael@ximage.com) if you have questions. ###
-
-cp50_=gdevcp50.$(OBJ)
-cp50.dev: $(cp50_) page.dev
- $(SETPDEV) cp50 $(cp50_)
-
-gdevcp50.$(OBJ): gdevcp50.c $(PDEVH)
-
-### ----------------- The generic Epson printer device ----------------- ###
-### Note: most of this code was contributed by users. Please contact ###
-### the following people if you have questions: ###
-### eps9mid - Guenther Thomsen (thomsen@cs.tu-berlin.de) ###
-### eps9high - David Wexelblat (dwex@mtgzfs3.att.com) ###
-### ibmpro - James W. Birdsall (jwbirdsa@picarefy.picarefy.com) ###
-
-epson_=gdevepsn.$(OBJ)
-
-epson.dev: $(epson_) page.dev
- $(SETPDEV) epson $(epson_)
-
-eps9mid.dev: $(epson_) page.dev
- $(SETPDEV) eps9mid $(epson_)
-
-eps9high.dev: $(epson_) page.dev
- $(SETPDEV) eps9high $(epson_)
-
-gdevepsn.$(OBJ): gdevepsn.c $(PDEVH)
-
-### ----------------- The IBM Proprinter printer device ---------------- ###
-
-ibmpro.dev: $(epson_) page.dev
- $(SETPDEV) ibmpro $(epson_)
-
-### -------------- The Epson LQ-2550 color printer device -------------- ###
-### Note: this driver was contributed by users: please contact ###
-### Dave St. Clair (dave@exlog.com) if you have questions. ###
-
-epsonc_=gdevepsc.$(OBJ)
-epsonc.dev: $(epsonc_) page.dev
- $(SETPDEV) epsonc $(epsonc_)
-
-gdevepsc.$(OBJ): gdevepsc.c $(PDEVH)
-
-### ------------- The Epson ESC/P 2 language printer devices ------------- ###
-### Note: these drivers were contributed by users. ###
-### For questions about the Stylus 800 and AP3250 drivers, please contact ###
-### Richard Brown (rab@tauon.ph.unimelb.edu.au). ###
-### For questions about the Stylus Color drivers, please contact ###
-### Gunther Hess (gunther@elmos.de). ###
-
-ESCP2=gdevescp.$(OBJ)
-
-gdevescp.$(OBJ): gdevescp.c $(PDEVH)
-
-ap3250.dev: $(ESCP2) page.dev
- $(SETPDEV) ap3250 $(ESCP2)
-
-st800.dev: $(ESCP2) page.dev
- $(SETPDEV) st800 $(ESCP2)
-
-stcolor1_=gdevstc.$(OBJ) gdevstc1.$(OBJ) gdevstc2.$(OBJ)
-stcolor2_=gdevstc3.$(OBJ) gdevstc4.$(OBJ)
-stcolor.dev: $(stcolor1_) $(stcolor2_) page.dev
- $(SETPDEV) stcolor $(stcolor1_)
- $(ADDMOD) stcolor -obj $(stcolor2_)
-
-gdevstc.$(OBJ): gdevstc.c gdevstc.h $(PDEVH)
-
-gdevstc1.$(OBJ): gdevstc1.c gdevstc.h $(PDEVH)
-
-gdevstc2.$(OBJ): gdevstc2.c gdevstc.h $(PDEVH)
-
-gdevstc3.$(OBJ): gdevstc3.c gdevstc.h $(PDEVH)
-
-gdevstc4.$(OBJ): gdevstc4.c gdevstc.h $(PDEVH)
-
-### --------------- Ugly/Update -> Unified Printer Driver ---------------- ###
-### For questions about this driver, please contact: ###
-### Gunther Hess (gunther@elmos.de) ###
-
-uniprint_=gdevupd.$(OBJ)
-uniprint.dev: $(uniprint_) page.dev
- $(SETPDEV) uniprint $(uniprint_)
-
-gdevupd.$(OBJ): gdevupd.c $(PDEVH) $(gsparam_h)
-
-### -------------- cdj850 - HP 850c Driver under development ------------- ###
-### Since this driver is in the development-phase it is not distributed ###
-### with ghostscript, but it is available via anonymous ftp from: ###
-### ftp://bonk.ethz.ch ###
-### For questions about this driver, please contact: ###
-### Uli Wortmann (E-Mail address inside the driver-package) ###
-
-cdeskjet8_=gdevcd8.$(OBJ) $(HPPCL)
-
-cdj850.dev: $(cdeskjet8_) page.dev
- $(SETPDEV) cdj850 $(cdeskjet8_)
-
-### ------------ The H-P PaintJet color printer device ----------------- ###
-### Note: this driver also supports the DEC LJ250 color printer, which ###
-### has a PaintJet-compatible mode, and the PaintJet XL. ###
-### If you have questions about the XL, please contact Rob Reiss ###
-### (rob@moray.berkeley.edu). ###
-
-PJET=gdevpjet.$(OBJ) $(HPPCL)
-
-gdevpjet.$(OBJ): gdevpjet.c $(PDEVH) $(gdevpcl_h)
-
-lj250.dev: $(PJET) page.dev
- $(SETPDEV) lj250 $(PJET)
-
-paintjet.dev: $(PJET) page.dev
- $(SETPDEV) paintjet $(PJET)
-
-pjetxl.dev: $(PJET) page.dev
- $(SETPDEV) pjetxl $(PJET)
-
-### -------------- Imagen ImPress Laser Printer device ----------------- ###
-### Note: this driver was contributed by a user: please contact ###
-### Alan Millar (AMillar@bolis.sf-bay.org) if you have questions. ###
-### Set USE_BYTE_STREAM if using parallel interface; ###
-### Don't set it if using 'ipr' spooler (default). ###
-### You may also add -DA4 if needed for A4 paper. ###
-
-imagen_=gdevimgn.$(OBJ)
-imagen.dev: $(imagen_) page.dev
- $(SETPDEV) imagen $(imagen_)
-
-gdevimgn.$(OBJ): gdevimgn.c $(PDEVH)
- $(CCC) gdevimgn.c # for ipr spooler
-# $(CCC) -DUSE_BYTE_STREAM gdevimgn.c # for parallel
-
-### ------- The IBM 3852 JetPrinter color inkjet printer device -------- ###
-### Note: this driver was contributed by users: please contact ###
-### Kevin Gift (kgift@draper.com) if you have questions. ###
-### Note that the paper size that can be addressed by the graphics mode ###
-### used in this driver is fixed at 7-1/2 inches wide (the printable ###
-### width of the jetprinter itself.) ###
-
-jetp3852_=gdev3852.$(OBJ)
-jetp3852.dev: $(jetp3852_) page.dev
- $(SETPDEV) jetp3852 $(jetp3852_)
-
-gdev3852.$(OBJ): gdev3852.c $(PDEVH) $(gdevpcl_h)
-
-### ---------- The Canon LBP-8II and LIPS III printer devices ---------- ###
-### Note: these drivers were contributed by users. ###
-### For questions about these drivers, please contact ###
-### Lauri Paatero, lauri.paatero@paatero.pp.fi ###
-
-lbp8_=gdevlbp8.$(OBJ)
-lbp8.dev: $(lbp8_) page.dev
- $(SETPDEV) lbp8 $(lbp8_)
-
-lips3.dev: $(lbp8_) page.dev
- $(SETPDEV) lips3 $(lbp8_)
-
-gdevlbp8.$(OBJ): gdevlbp8.c $(PDEVH)
-
-### ----------- The DEC LN03/LA50/LA70/LA75 printer devices ------------ ###
-### Note: this driver was contributed by users: please contact ###
-### Ulrich Mueller (ulm@vsnhd1.cern.ch) if you have questions. ###
-### For questions about LA50 and LA75, please contact ###
-### Ian MacPhedran (macphed@dvinci.USask.CA). ###
-### For questions about the LA70, please contact ###
-### Bruce Lowekamp (lowekamp@csugrad.cs.vt.edu). ###
-### For questions about the LA75plus, please contact ###
-### Andre' Beck (Andre_Beck@IRS.Inf.TU-Dresden.de). ###
-
-ln03_=gdevln03.$(OBJ)
-ln03.dev: $(ln03_) page.dev
- $(SETPDEV) ln03 $(ln03_)
-
-la50.dev: $(ln03_) page.dev
- $(SETPDEV) la50 $(ln03_)
-
-la70.dev: $(ln03_) page.dev
- $(SETPDEV) la70 $(ln03_)
-
-la75.dev: $(ln03_) page.dev
- $(SETPDEV) la75 $(ln03_)
-
-la75plus.dev: $(ln03_) page.dev
- $(SETPDEV) la75plus $(ln03_)
-
-gdevln03.$(OBJ): gdevln03.c $(PDEVH)
-
-# LA70 driver with low-resolution text enhancement.
-
-la70t_=gdevla7t.$(OBJ)
-la70t.dev: $(la70t_) page.dev
- $(SETPDEV) la70t $(la70t_)
-
-gdevla7t.$(OBJ): gdevla7t.c $(PDEVH)
-
-### -------------- The Epson LP-8000 laser printer device -------------- ###
-### Note: this driver was contributed by a user: please contact Oleg ###
-### Oleg Fat'yanov <faty1@rlem.titech.ac.jp> if you have questions.###
-
-lp8000_=gdevlp8k.$(OBJ)
-lp8000.dev: $(lp8000_) page.dev
- $(SETPDEV) lp8000 $(lp8000_)
-
-gdevlp8k.$(OBJ): gdevlp8k.c $(PDEVH)
-
-### -------------- The C.Itoh M8510 printer device --------------------- ###
-### Note: this driver was contributed by a user: please contact Bob ###
-### Smith <bob@snuffy.penfield.ny.us> if you have questions. ###
-
-m8510_=gdev8510.$(OBJ)
-m8510.dev: $(m8510_) page.dev
- $(SETPDEV) m8510 $(m8510_)
-
-gdev8510.$(OBJ): gdev8510.c $(PDEVH)
-
-### -------------- 24pin Dot-matrix printer with 360DPI ---------------- ###
-### Note: this driver was contributed by users. Please contact: ###
-### Andreas Schwab (schwab@ls5.informatik.uni-dortmund.de) for ###
-### questions about the NEC P6; ###
-### Christian Felsch (felsch@tu-harburg.d400.de) for ###
-### questions about the Epson LQ850. ###
-
-dm24_=gdevdm24.$(OBJ)
-gdevdm24.$(OBJ): gdevdm24.c $(PDEVH)
-
-necp6.dev: $(dm24_) page.dev
- $(SETPDEV) necp6 $(dm24_)
-
-lq850.dev: $(dm24_) page.dev
- $(SETPDEV) lq850 $(dm24_)
-
-### ----------------- The Okidata MicroLine 182 device ----------------- ###
-### Note: this driver was contributed by a user: please contact ###
-### Maarten Koning (smeg@bnr.ca) if you have questions. ###
-
-oki182_=gdevo182.$(OBJ)
-oki182.dev: $(oki182_) page.dev
- $(SETPDEV) oki182 $(oki182_)
-
-gdevo182.$(OBJ): gdevo182.c $(PDEVH)
-
-### ------------- The Okidata IBM compatible printer device ------------ ###
-### Note: this driver was contributed by a user: please contact ###
-### Charles Mack (chasm@netcom.com) if you have questions. ###
-
-okiibm_=gdevokii.$(OBJ)
-okiibm.dev: $(okiibm_) page.dev
- $(SETPDEV) okiibm $(okiibm_)
-
-gdevokii.$(OBJ): gdevokii.c $(PDEVH)
-
-### ------------- The Ricoh 4081 laser printer device ------------------ ###
-### Note: this driver was contributed by users: ###
-### please contact kdw@oasis.icl.co.uk if you have questions. ###
-
-r4081_=gdev4081.$(OBJ)
-r4081.dev: $(r4081_) page.dev
- $(SETPDEV) r4081 $(r4081_)
-
-
-gdev4081.$(OBJ): gdev4081.c $(PDEVH)
-
-### -------------------- Sony NWP533 printer device -------------------- ###
-### Note: this driver was contributed by a user: please contact Tero ###
-### Kivinen (kivinen@joker.cs.hut.fi) if you have questions. ###
-
-nwp533_=gdevn533.$(OBJ)
-nwp533.dev: $(nwp533_) page.dev
- $(SETPDEV) nwp533 $(nwp533_)
-
-gdevn533.$(OBJ): gdevn533.c $(PDEVH)
-
-### ------------------------- The SPARCprinter ------------------------- ###
-### Note: this driver was contributed by users: please contact Martin ###
-### Schulte (schulte@thp.uni-koeln.de) if you have questions. ###
-### He would also like to hear from anyone using the driver. ###
-### Please consult the source code for additional documentation. ###
-
-sparc_=gdevsppr.$(OBJ)
-sparc.dev: $(sparc_) page.dev
- $(SETPDEV) sparc $(sparc_)
-
-gdevsppr.$(OBJ): gdevsppr.c $(PDEVH)
-
-### ----------------- The StarJet SJ48 device -------------------------- ###
-### Note: this driver was contributed by a user: if you have questions, ###
-### . ###
-### please contact Mats Akerblom (f86ma@dd.chalmers.se). ###
-
-sj48_=gdevsj48.$(OBJ)
-sj48.dev: $(sj48_) page.dev
- $(SETPDEV) sj48 $(sj48_)
-
-gdevsj48.$(OBJ): gdevsj48.c $(PDEVH)
-
-### ----------------- Tektronix 4396d color printer -------------------- ###
-### Note: this driver was contributed by a user: please contact ###
-### Karl Hakimian (hakimian@haney.eecs.wsu.edu) ###
-### if you have questions. ###
-
-t4693d_=gdev4693.$(OBJ)
-t4693d2.dev: $(t4693d_) page.dev
- $(SETPDEV) t4693d2 $(t4693d_)
-
-t4693d4.dev: $(t4693d_) page.dev
- $(SETPDEV) t4693d4 $(t4693d_)
-
-t4693d8.dev: $(t4693d_) page.dev
- $(SETPDEV) t4693d8 $(t4693d_)
-
-gdev4693.$(OBJ): gdev4693.c $(PDEVH)
-
-### -------------------- Tektronix ink-jet printers -------------------- ###
-### Note: this driver was contributed by a user: please contact ###
-### Karsten Spang (spang@nbivax.nbi.dk) if you have questions. ###
-
-tek4696_=gdevtknk.$(OBJ)
-tek4696.dev: $(tek4696_) page.dev
- $(SETPDEV) tek4696 $(tek4696_)
-
-gdevtknk.$(OBJ): gdevtknk.c $(PDEVH) $(malloc__h)
-
-### ----------------- The Xerox XES printer device --------------------- ###
-### Note: this driver was contributed by users: please contact ###
-### Peter Flass (flass@lbdrscs.bitnet) if you have questions. ###
-
-xes_=gdevxes.$(OBJ)
-xes.dev: $(xes_) page.dev
- $(SETPDEV) xes $(xes_)
-
-gdevxes.$(OBJ): gdevxes.c $(PDEVH)
-
-###### ------------------------- Fax devices ------------------------- ######
-
-### --------------- Generic PostScript system compatible fax ------------ ###
-
-# This code doesn't work yet. Don't even think about using it.
-
-PSFAX=gdevpfax.$(OBJ)
-
-psfax_=$(PSFAX)
-psfax.dev: $(psfax_) page.dev
- $(SETPDEV) psfax $(psfax_)
- $(ADDMOD) psfax -iodev Fax
-
-gdevpfax.$(OBJ): gdevpfax.c $(PDEVH) $(gsparam_h) $(gxiodev_h)
-
-### ------------------------- The DigiFAX device ------------------------ ###
-### This driver outputs images in a format suitable for use with ###
-### DigiBoard, Inc.'s DigiFAX software. Use -sDEVICE=dfaxhigh for ###
-### high resolution output, -sDEVICE=dfaxlow for normal output. ###
-### Note: this driver was contributed by a user: please contact ###
-### Rick Richardson (rick@digibd.com) if you have questions. ###
-
-dfax_=gdevdfax.$(OBJ) gdevtfax.$(OBJ)
-
-dfaxlow.dev: $(dfax_) page.dev
- $(SETPDEV) dfaxlow $(dfax_)
- $(ADDMOD) dfaxlow -include cfe
-
-dfaxhigh.dev: $(dfax_) page.dev
- $(SETPDEV) dfaxhigh $(dfax_)
- $(ADDMOD) dfaxhigh -include cfe
-
-gdevdfax.$(OBJ): gdevdfax.c $(PDEVH) $(scfx_h) $(strimpl_h)
-
-### --------------See under TIFF below for fax-format TIFF -------------- ###
-
-###### ------------------- High-level file formats ------------------- ######
-
-# Support for PostScript and PDF
-
-gdevpsdf_h=gdevpsdf.h $(gdevvec_h) $(strimpl_h)
-gdevpstr_h=gdevpstr.h
-
-gdevpsdf.$(OBJ): gdevpsdf.c $(stdio__h) $(string__h)\
- $(gserror_h) $(gserrors_h) $(gsmemory_h) $(gsparam_h) $(gstypes_h)\
- $(gxdevice_h)\
- $(scfx_h) $(slzwx_h) $(srlx_h) $(strimpl_h)\
- $(gdevpsdf_h) $(gdevpstr_h)
-
-gdevpstr.$(OBJ): gdevpstr.c $(math__h) $(stdio__h) $(string__h)\
- $(gdevpstr_h) $(stream_h)
-
-# PostScript and EPS writers
-
-pswrite1_=gdevps.$(OBJ) gdevpsdf.$(OBJ) gdevpstr.$(OBJ)
-pswrite2_=scantab.$(OBJ) sfilter2.$(OBJ)
-pswrite_=$(pswrite1_) $(pswrite2_)
-epswrite.dev: $(ECHOGS_XE) $(pswrite_) vector.dev
- $(SETDEV) epswrite $(pswrite1_)
- $(ADDMOD) epswrite $(pswrite2_)
- $(ADDMOD) epswrite -include vector
-
-pswrite.dev: $(ECHOGS_XE) $(pswrite_) vector.dev
- $(SETDEV) pswrite $(pswrite1_)
- $(ADDMOD) pswrite $(pswrite2_)
- $(ADDMOD) pswrite -include vector
-
-gdevps.$(OBJ): gdevps.c $(GDEV) $(math__h) $(time__h)\
- $(gscdefs_h) $(gscspace_h) $(gsparam_h) $(gsiparam_h) $(gsmatrix_h)\
- $(gxdcolor_h)\
- $(sa85x_h) $(strimpl_h)\
- $(gdevpsdf_h) $(gdevpstr_h)
-
-# PDF writer
-# Note that gs_pdfwr.ps will only actually be loaded if the configuration
-# includes a PostScript interpreter.
-
-pdfwrite1_=gdevpdf.$(OBJ) gdevpdfd.$(OBJ) gdevpdfi.$(OBJ) gdevpdfm.$(OBJ)
-pdfwrite2_=gdevpdfp.$(OBJ) gdevpdft.$(OBJ) gdevpsdf.$(OBJ) gdevpstr.$(OBJ)
-pdfwrite3_=gsflip.$(OBJ) scantab.$(OBJ) sfilter2.$(OBJ) sstring.$(OBJ)
-pdfwrite_=$(pdfwrite1_) $(pdfwrite2_) $(pdfwrite3_)
-pdfwrite.dev: $(ECHOGS_XE) $(pdfwrite_) \
- cmyklib.dev cfe.dev dcte.dev lzwe.dev rle.dev vector.dev
- $(SETDEV) pdfwrite $(pdfwrite1_)
- $(ADDMOD) pdfwrite $(pdfwrite2_)
- $(ADDMOD) pdfwrite $(pdfwrite3_)
- $(ADDMOD) pdfwrite -ps gs_pdfwr
- $(ADDMOD) pdfwrite -include cmyklib cfe dcte lzwe rle vector
-
-gdevpdfx_h=gdevpdfx.h $(gsparam_h) $(gxdevice_h) $(gxline_h) $(stream_h)\
- $(gdevpsdf_h) $(gdevpstr_h)
-
-gdevpdf.$(OBJ): gdevpdf.c $(math__h) $(memory__h) $(string__h) $(time__h)\
- $(gp_h)\
- $(gdevpdfx_h) $(gscdefs_h) $(gserrors_h)\
- $(gx_h) $(gxdevice_h) $(gxfixed_h) $(gxistate_h) $(gxpaint_h)\
- $(gzcpath_h) $(gzpath_h)\
- $(scanchar_h) $(scfx_h) $(slzwx_h) $(sstring_h) $(strimpl_h) $(szlibx_h)
- $(CCCZ) gdevpdf.c
-
-gdevpdfd.$(OBJ): gdevpdfd.c $(math__h)\
- $(gdevpdfx_h)\
- $(gx_h) $(gxdevice_h) $(gxfixed_h) $(gxistate_h) $(gxpaint_h)\
- $(gzcpath_h) $(gzpath_h)
-
-gdevpdfi.$(OBJ): gdevpdfi.c $(math__h) $(memory__h) $(gx_h) \
- $(gdevpdfx_h) $(gscie_h) $(gscolor2_h) $(gserrors_h) $(gsflip_h)\
- $(gxcspace_h) $(gxistate_h) \
- $(sa85x_h) $(scfx_h) $(srlx_h) $(strimpl_h)
-
-gdevpdfm.$(OBJ): gdevpdfm.c $(memory__h) $(string__h) $(gx_h) \
- $(gdevpdfx_h) $(gserrors_h) $(gsutil_h) $(scanchar_h)
-
-gdevpdfp.$(OBJ): gdevpdfp.c $(gx_h)\
- $(gdevpdfx_h) $(gserrors_h)
-
-gdevpdft.$(OBJ): gdevpdft.c $(math__h) $(memory__h) $(string__h) $(gx_h)\
- $(gdevpdfx_h) $(gserrors_h) $(gsutil_h)\
- $(scommon_h)
-
-# High-level PCL XL writer
-
-pxl_=gdevpx.$(OBJ)
-pxlmono.dev: $(pxl_) $(GDEV) vector.dev
- $(SETDEV) pxlmono $(pxl_)
- $(ADDMOD) pxlmono -include vector
-
-pxlcolor.dev: $(pxl_) $(GDEV) vector.dev
- $(SETDEV) pxlcolor $(pxl_)
- $(ADDMOD) pxlcolor -include vector
-
-gdevpx.$(OBJ): gdevpx.c $(math__h) $(memory__h) $(string__h)\
- $(gx_h) $(gsccolor_h) $(gsdcolor_h) $(gserrors_h)\
- $(gxcspace_h) $(gxdevice_h) $(gxpath_h)\
- $(gdevpxat_h) $(gdevpxen_h) $(gdevpxop_h) $(gdevvec_h)\
- $(srlx_h) $(strimpl_h)
-
-###### --------------------- Raster file formats --------------------- ######
-
-### --------------------- The "plain bits" devices ---------------------- ###
-
-bit_=gdevbit.$(OBJ)
-
-bit.dev: $(bit_) page.dev
- $(SETPDEV) bit $(bit_)
-
-bitrgb.dev: $(bit_) page.dev
- $(SETPDEV) bitrgb $(bit_)
-
-bitcmyk.dev: $(bit_) page.dev
- $(SETPDEV) bitcmyk $(bit_)
-
-gdevbit.$(OBJ): gdevbit.c $(PDEVH) $(gsparam_h) $(gxlum_h)
-
-### ------------------------- .BMP file formats ------------------------- ###
-
-bmp_=gdevbmp.$(OBJ) gdevpccm.$(OBJ)
-
-gdevbmp.$(OBJ): gdevbmp.c $(PDEVH) $(gdevpccm_h)
-
-bmpmono.dev: $(bmp_) page.dev
- $(SETPDEV) bmpmono $(bmp_)
-
-bmp16.dev: $(bmp_) page.dev
- $(SETPDEV) bmp16 $(bmp_)
-
-bmp256.dev: $(bmp_) page.dev
- $(SETPDEV) bmp256 $(bmp_)
-
-bmp16m.dev: $(bmp_) page.dev
- $(SETPDEV) bmp16m $(bmp_)
-
-### ------------- BMP driver that serves as demo of async rendering ---- ###
-devasync_=gdevasyn.$(OBJ) gdevpccm.$(OBJ) gxsync.$(OBJ)
-
-gdevasyn.$(OBJ): gdevasyn.c $(AK) $(stdio__h) $(gdevprna_h) $(gdevpccm_h)\
- $(gserrors_h) $(gpsync_h)
-
-asynmono.dev: $(devasync_) page.dev async.dev
- $(SETPDEV) asynmono $(devasync_)
- $(ADDMOD) asynmono -include async
-
-
-### -------------------------- CGM file format ------------------------- ###
-### This driver is under development. Use at your own risk. ###
-### The output is very low-level, consisting only of rectangles and ###
-### cell arrays. ###
-
-cgm_=gdevcgm.$(OBJ) gdevcgml.$(OBJ)
-
-gdevcgml_h=gdevcgml.h
-gdevcgmx_h=gdevcgmx.h $(gdevcgml_h)
-
-gdevcgm.$(OBJ): gdevcgm.c $(GDEV) $(memory__h)\
- $(gsparam_h) $(gdevpccm_h) $(gdevcgml_h)
-
-gdevcgml.$(OBJ): gdevcgml.c $(memory__h) $(stdio__h)\
- $(gdevcgmx_h)
-
-cgmmono.dev: $(cgm_)
- $(SETDEV) cgmmono $(cgm_)
-
-cgm8.dev: $(cgm_)
- $(SETDEV) cgm8 $(cgm_)
-
-cgm24.dev: $(cgm_)
- $(SETDEV) cgm24 $(cgm_)
-
-### -------------------- The CIF file format for VLSI ------------------ ###
-### Note: this driver was contributed by a user: please contact ###
-### Frederic Petrot (petrot@masi.ibp.fr) if you have questions. ###
-
-cif_=gdevcif.$(OBJ)
-cif.dev: $(cif_) page.dev
- $(SETPDEV) cif $(cif_)
-
-gdevcif.$(OBJ): gdevcif.c $(PDEVH)
-
-### ------------------------- JPEG file format ------------------------- ###
-
-jpeg_=gdevjpeg.$(OBJ)
-
-# RGB output
-jpeg.dev: $(jpeg_) sdcte.dev page.dev
- $(SETPDEV) jpeg $(jpeg_)
- $(ADDMOD) jpeg -include sdcte
-
-# Gray output
-jpeggray.dev: $(jpeg_) sdcte.dev page.dev
- $(SETPDEV) jpeggray $(jpeg_)
- $(ADDMOD) jpeggray -include sdcte
-
-gdevjpeg.$(OBJ): gdevjpeg.c $(stdio__h) $(PDEVH)\
- $(sdct_h) $(sjpeg_h) $(stream_h) $(strimpl_h) jpeglib.h
-
-### ------------------------- MIFF file format ------------------------- ###
-### Right now we support only 24-bit direct color, but we might add more ###
-### formats in the future. ###
-
-miff_=gdevmiff.$(OBJ)
-
-miff24.dev: $(miff_) page.dev
- $(SETPDEV) miff24 $(miff_)
-
-gdevmiff.$(OBJ): gdevmiff.c $(PDEVH)
-
-### --------------------------- MGR devices ---------------------------- ###
-### Note: these drivers were contributed by a user: please contact ###
-### Carsten Emde (carsten@ce.pr.net.ch) if you have questions. ###
-
-MGR=gdevmgr.$(OBJ) gdevpccm.$(OBJ)
-
-gdevmgr.$(OBJ): gdevmgr.c $(PDEVH) $(gdevpccm_h) gdevmgr.h
-
-mgrmono.dev: $(MGR) page.dev
- $(SETPDEV) mgrmono $(MGR)
-
-mgrgray2.dev: $(MGR) page.dev
- $(SETPDEV) mgrgray2 $(MGR)
-
-mgrgray4.dev: $(MGR) page.dev
- $(SETPDEV) mgrgray4 $(MGR)
-
-mgrgray8.dev: $(MGR) page.dev
- $(SETPDEV) mgrgray8 $(MGR)
-
-mgr4.dev: $(MGR) page.dev
- $(SETPDEV) mgr4 $(MGR)
-
-mgr8.dev: $(MGR) page.dev
- $(SETPDEV) mgr8 $(MGR)
-
-### ------------------------- PCX file formats ------------------------- ###
-
-pcx_=gdevpcx.$(OBJ) gdevpccm.$(OBJ)
-
-gdevpcx.$(OBJ): gdevpcx.c $(PDEVH) $(gdevpccm_h) $(gxlum_h)
-
-pcxmono.dev: $(pcx_) page.dev
- $(SETPDEV) pcxmono $(pcx_)
-
-pcxgray.dev: $(pcx_) page.dev
- $(SETPDEV) pcxgray $(pcx_)
-
-pcx16.dev: $(pcx_) page.dev
- $(SETPDEV) pcx16 $(pcx_)
-
-pcx256.dev: $(pcx_) page.dev
- $(SETPDEV) pcx256 $(pcx_)
-
-pcx24b.dev: $(pcx_) page.dev
- $(SETPDEV) pcx24b $(pcx_)
-
-pcxcmyk.dev: $(pcx_) page.dev
- $(SETPDEV) pcxcmyk $(pcx_)
-
-# The 2-up PCX device is here only as an example, and for testing.
-pcx2up.dev: $(LIB_MAK) $(ECHOGS_XE) gdevp2up.$(OBJ) page.dev pcx256.dev
- $(SETPDEV) pcx2up gdevp2up.$(OBJ)
- $(ADDMOD) pcx2up -include pcx256
-
-gdevp2up.$(OBJ): gdevp2up.c $(AK)\
- $(gdevpccm_h) $(gdevprn_h) $(gxclpage_h)
-
-### ------------------- Portable Bitmap file formats ------------------- ###
-### For more information, see the pbm(5), pgm(5), and ppm(5) man pages. ###
-
-pxm_=gdevpbm.$(OBJ)
-
-gdevpbm.$(OBJ): gdevpbm.c $(PDEVH) $(gscdefs_h) $(gxlum_h)
-
-### Portable Bitmap (PBM, plain or raw format, magic numbers "P1" or "P4")
-
-pbm.dev: $(pxm_) page.dev
- $(SETPDEV) pbm $(pxm_)
-
-pbmraw.dev: $(pxm_) page.dev
- $(SETPDEV) pbmraw $(pxm_)
-
-### Portable Graymap (PGM, plain or raw format, magic numbers "P2" or "P5")
-
-pgm.dev: $(pxm_) page.dev
- $(SETPDEV) pgm $(pxm_)
-
-pgmraw.dev: $(pxm_) page.dev
- $(SETPDEV) pgmraw $(pxm_)
-
-# PGM with automatic optimization to PBM if this is possible.
-
-pgnm.dev: $(pxm_) page.dev
- $(SETPDEV) pgnm $(pxm_)
-
-pgnmraw.dev: $(pxm_) page.dev
- $(SETPDEV) pgnmraw $(pxm_)
-
-### Portable Pixmap (PPM, plain or raw format, magic numbers "P3" or "P6")
-
-ppm.dev: $(pxm_) page.dev
- $(SETPDEV) ppm $(pxm_)
-
-ppmraw.dev: $(pxm_) page.dev
- $(SETPDEV) ppmraw $(pxm_)
-
-# PPM with automatic optimization to PGM or PBM if possible.
-
-pnm.dev: $(pxm_) page.dev
- $(SETPDEV) pnm $(pxm_)
-
-pnmraw.dev: $(pxm_) page.dev
- $(SETPDEV) pnmraw $(pxm_)
-
-### Portable inKmap (CMYK internally, converted to PPM=RGB at output time)
-
-pkm.dev: $(pxm_) page.dev
- $(SETPDEV) pkm $(pxm_)
-
-pkmraw.dev: $(pxm_) page.dev
- $(SETPDEV) pkmraw $(pxm_)
-
-### --------------- Portable Network Graphics file format --------------- ###
-### Requires libpng 0.81 and zlib 0.95 (or more recent versions). ###
-### See libpng.mak and zlib.mak for more details. ###
-
-png_=gdevpng.$(OBJ) gdevpccm.$(OBJ)
-
-gdevpng.$(OBJ): gdevpng.c $(gdevprn_h) $(gdevpccm_h) $(gscdefs_h) $(PSRC)png.h
- $(CCCP) gdevpng.c
-
-pngmono.dev: libpng.dev $(png_) page.dev
- $(SETPDEV) pngmono $(png_)
- $(ADDMOD) pngmono -include libpng
-
-pnggray.dev: libpng.dev $(png_) page.dev
- $(SETPDEV) pnggray $(png_)
- $(ADDMOD) pnggray -include libpng
-
-png16.dev: libpng.dev $(png_) page.dev
- $(SETPDEV) png16 $(png_)
- $(ADDMOD) png16 -include libpng
-
-png256.dev: libpng.dev $(png_) page.dev
- $(SETPDEV) png256 $(png_)
- $(ADDMOD) png256 -include libpng
-
-png16m.dev: libpng.dev $(png_) page.dev
- $(SETPDEV) png16m $(png_)
- $(ADDMOD) png16m -include libpng
-
-### ---------------------- PostScript image format ---------------------- ###
-### These devices make it possible to print Level 2 files on a Level 1 ###
-### printer, by converting them to a bitmap in PostScript format. ###
-
-ps_=gdevpsim.$(OBJ)
-
-gdevpsim.$(OBJ): gdevpsim.c $(PDEVH)
-
-psmono.dev: $(ps_) page.dev
- $(SETPDEV) psmono $(ps_)
-
-psgray.dev: $(ps_) page.dev
- $(SETPDEV) psgray $(ps_)
-
-# Someday there will be RGB and CMYK variants....
-
-### -------------------------- SGI RGB pixmaps -------------------------- ###
-
-sgirgb_=gdevsgi.$(OBJ)
-
-gdevsgi.$(OBJ): gdevsgi.c $(PDEVH) gdevsgi.h
-
-sgirgb.dev: $(sgirgb_) page.dev
- $(SETPDEV) sgirgb $(sgirgb_)
-
-### -------------------- Plain or TIFF fax encoding --------------------- ###
-### Use -sDEVICE=tiffg3 or tiffg4 and ###
-### -r204x98 for low resolution output, or ###
-### -r204x196 for high resolution output ###
-### These drivers recognize 3 page sizes: letter, A4, and B4. ###
-
-gdevtifs_h=gdevtifs.h
-
-tfax_=gdevtfax.$(OBJ)
-tfax.dev: $(tfax_) cfe.dev lzwe.dev rle.dev tiffs.dev
- $(SETMOD) tfax $(tfax_)
- $(ADDMOD) tfax -include cfe lzwe rle tiffs
-
-gdevtfax.$(OBJ): gdevtfax.c $(PDEVH)\
- $(gdevtifs_h) $(scfx_h) $(slzwx_h) $(srlx_h) $(strimpl_h)
-
-### Plain G3/G4 fax with no header
-
-faxg3.dev: tfax.dev
- $(SETDEV) faxg3 -include tfax
-
-faxg32d.dev: tfax.dev
- $(SETDEV) faxg32d -include tfax
-
-faxg4.dev: tfax.dev
- $(SETDEV) faxg4 -include tfax
-
-### ---------------------------- TIFF formats --------------------------- ###
-
-tiffs_=gdevtifs.$(OBJ)
-tiffs.dev: $(tiffs_) page.dev
- $(SETMOD) tiffs $(tiffs_)
- $(ADDMOD) tiffs -include page
-
-gdevtifs.$(OBJ): gdevtifs.c $(PDEVH) $(stdio__h) $(time__h) \
- $(gdevtifs_h) $(gscdefs_h) $(gstypes_h)
-
-# Black & white, G3/G4 fax
-
-tiffcrle.dev: tfax.dev
- $(SETDEV) tiffcrle -include tfax
-
-tiffg3.dev: tfax.dev
- $(SETDEV) tiffg3 -include tfax
-
-tiffg32d.dev: tfax.dev
- $(SETDEV) tiffg32d -include tfax
-
-tiffg4.dev: tfax.dev
- $(SETDEV) tiffg4 -include tfax
-
-# Black & white, LZW compression
-
-tifflzw.dev: tfax.dev
- $(SETDEV) tifflzw -include tfax
-
-# Black & white, PackBits compression
-
-tiffpack.dev: tfax.dev
- $(SETDEV) tiffpack -include tfax
-
-# RGB, no compression
-
-tiffrgb_=gdevtfnx.$(OBJ)
-
-tiff12nc.dev: $(tiffrgb_) tiffs.dev
- $(SETPDEV) tiff12nc $(tiffrgb_)
- $(ADDMOD) tiff12nc -include tiffs
-
-tiff24nc.dev: $(tiffrgb_) tiffs.dev
- $(SETPDEV) tiff24nc $(tiffrgb_)
- $(ADDMOD) tiff24nc -include tiffs
-
-gdevtfnx.$(OBJ): gdevtfnx.c $(PDEVH) $(gdevtifs_h)
-# Copyright (C) 1994, 1995, 1997 Aladdin Enterprises. All rights reserved.
-#
-# This file is part of Aladdin Ghostscript.
-#
-# Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
-# or distributor accepts any responsibility for the consequences of using it,
-# or for whether it serves any particular purpose or works at all, unless he
-# or she says so in writing. Refer to the Aladdin Ghostscript Free Public
-# License (the "License") for full details.
-#
-# Every copy of Aladdin Ghostscript must include a copy of the License,
-# normally in a plain ASCII text file named PUBLIC. The License grants you
-# the right to copy, modify and redistribute Aladdin Ghostscript, but only
-# under certain conditions described in the License. Among other things, the
-# License requires that the copyright notice and this notice be preserved on
-# all copies.
-
-# Partial makefile, common to all Desqview/X configurations.
-
-# This is the last part of the makefile for Desqview/X configurations.
-# Since Unix make doesn't have an 'include' facility, we concatenate
-# the various parts of the makefile together by brute force (in tar_cat).
-
-# The following prevents GNU make from constructing argument lists that
-# include all environment variables, which can easily be longer than
-# brain-damaged system V allows.
-
-.NOEXPORT:
-
-# -------------------------------- Library -------------------------------- #
-
-## The Desqview/X platform
-
-dvx__=gp_nofb.$(OBJ) gp_dvx.$(OBJ) gp_unifs.$(OBJ) gp_dosfs.$(OBJ)
-dvx_.dev: $(dvx__)
- $(SETMOD) dvx_ $(dvx__)
-
-gp_dvx.$(OBJ): gp_dvx.c $(AK) $(string__h) $(gx_h) $(gsexit_h) $(gp_h) \
- $(time__h) $(dos__h)
- $(CCC) -D__DVX__ gp_dvx.c
-
-# -------------------------- Auxiliary programs --------------------------- #
-
-$(ANSI2KNR_XE): ansi2knr.c $(stdio__h) $(string__h) $(malloc__h)
- $(CC) -o ansi2knr $(CFLAGS) ansi2knr.c
-
-$(ECHOGS_XE): echogs.c
- $(CC) -o echogs $(CFLAGS) echogs.c
- strip echogs
- coff2exe echogs
- del echogs
-
-$(GENARCH_XE): genarch.c $(stdpre_h)
- $(CC) -o genarch genarch.c
- strip genarch
- coff2exe genarch
- del genarch
-
-$(GENCONF_XE): genconf.c $(stdpre_h)
- $(CC) -o genconf genconf.c
- strip genconf
- coff2exe genconf
- del genconf
-
-$(GENINIT_XE): geninit.c $(stdio__h) $(string__h)
- $(CC) -o geninit geninit.c
- strip geninit
- coff2exe geninit
- del geninit
-
-# Construct gconfig_.h to reflect the environment.
-INCLUDE=/djgpp/include
-gconfig_.h: dvx-tail.mak $(ECHOGS_XE)
- echogs -w gconfig_.h -x 2f2a -s This file was generated automatically. -s -x 2a2f
- echogs -a gconfig_.h -x 23 define HAVE_SYS_TIME_H
- echogs -a gconfig_.h -x 23 define HAVE_DIRENT_H
-
-# ----------------------------- Main program ------------------------------ #
-
-BEGINFILES=
-CCBEGIN=$(CCC) *.c
-
-# Interpreter main program
-
-$(GS_XE): ld.tr gs.$(OBJ) $(INT_ALL) $(LIB_ALL) $(DEVS_ALL)
- $(CP_) ld.tr _temp_
- echo $(EXTRALIBS) -lm >>_temp_
- $(CC) $(LDFLAGS) $(XLIBDIRS) -o $(GS) gs.$(OBJ) @_temp_
- strip $(GS)
- coff2exe $(GS)
- del $(GS)
-# Copyright (C) 1994, 1995, 1996, 1997 Aladdin Enterprises. All rights reserved.
-#
-# This file is part of Aladdin Ghostscript.
-#
-# Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
-# or distributor accepts any responsibility for the consequences of using it,
-# or for whether it serves any particular purpose or works at all, unless he
-# or she says so in writing. Refer to the Aladdin Ghostscript Free Public
-# License (the "License") for full details.
-#
-# Every copy of Aladdin Ghostscript must include a copy of the License,
-# normally in a plain ASCII text file named PUBLIC. The License grants you
-# the right to copy, modify and redistribute Aladdin Ghostscript, but only
-# under certain conditions described in the License. Among other things, the
-# License requires that the copyright notice and this notice be preserved on
-# all copies.
-
-# Partial makefile common to all Unix and Desqview/X configurations.
-
-# This is the very last part of the makefile for these configurations.
-# Since Unix make doesn't have an 'include' facility, we concatenate
-# the various parts of the makefile together by brute force (in tar_cat).
-
-# Define a rule for building profiling configurations.
-pg:
- make GENOPT='' CFLAGS='-pg -O $(GCFLAGS) $(XCFLAGS)' LDFLAGS='$(XLDFLAGS) -pg' XLIBS='Xt SM ICE Xext X11' CCLEAF='$(CCC)'
-
-# Define a rule for building debugging configurations.
-debug:
- make GENOPT='-DDEBUG' CFLAGS='-g -O $(GCFLAGS) $(XCFLAGS)'
-
-# The rule for gconfigv.h is here because it is shared between Unix and
-# DV/X environments.
-gconfigv.h: unix-end.mak $(MAKEFILE) $(ECHOGS_XE)
- $(EXP)echogs -w gconfigv.h -x 23 define USE_ASM -x 2028 -q $(USE_ASM)-0 -x 29
- $(EXP)echogs -a gconfigv.h -x 23 define USE_FPU -x 2028 -q $(FPU_TYPE)-0 -x 29
- $(EXP)echogs -a gconfigv.h -x 23 define EXTEND_NAMES 0$(EXTEND_NAMES)
-
-# The following rules are equivalent to what tar_cat does.
-# The rm -f is so that we don't overwrite a file that `make'
-# may currently be reading from.
-GENERIC_MAK_LIST=$(GS_MAK) $(LIB_MAK) $(INT_MAK) $(JPEG_MAK) $(LIBPNG_MAK) $(ZLIB_MAK) $(DEVS_MAK)
-UNIX_MAK_LIST=dvx-gcc.mak unixansi.mak unix-cc.mak unix-gcc.mak
-
-unix.mak: $(UNIX_MAK_LIST)
-
-DVX_GCC_MAK=$(VERSION_MAK) dgc-head.mak dvx-head.mak $(GENERIC_MAK_LIST) dvx-tail.mak unix-end.mak
-dvx-gcc.mak: $(DVX_GCC_MAK)
- rm -f dvx-gcc.mak
- $(CAT) $(DVX_GCC_MAK) >dvx-gcc.mak
-
-UNIXANSI_MAK=$(VERSION_MAK) ansihead.mak unixhead.mak $(GENERIC_MAK_LIST) unixtail.mak unix-end.mak
-unixansi.mak: $(UNIXANSI_MAK)
- rm -f unixansi.mak
- $(CAT) $(UNIXANSI_MAK) >unixansi.mak
-
-UNIX_CC_MAK=$(VERSION_MAK) cc-head.mak unixhead.mak $(GENERIC_MAK_LIST) unixtail.mak unix-end.mak
-unix-cc.mak: $(UNIX_CC_MAK)
- rm -f unix-cc.mak
- $(CAT) $(UNIX_CC_MAK) >unix-cc.mak
-
-UNIX_GCC_MAK=$(VERSION_MAK) gcc-head.mak unixhead.mak $(GENERIC_MAK_LIST) unixtail.mak unix-end.mak
-unix-gcc.mak: $(UNIX_GCC_MAK)
- rm -f unix-gcc.mak
- $(CAT) $(UNIX_GCC_MAK) >unix-gcc.mak
-
-# Installation
-
-TAGS:
- etags -t *.c *.h
-
-install: install-exec install-scripts install-data
-
-# The sh -c in the rules below is required because Ultrix's implementation
-# of sh -e terminates execution of a command if any error occurs, even if
-# the command traps the error with ||.
-
-install-exec: $(GS)
- -mkdir $(bindir)
- $(INSTALL_PROGRAM) $(GS) $(bindir)/$(GS)
-
-install-scripts: gsnd
- -mkdir $(scriptdir)
- sh -c 'for f in gsbj gsdj gsdj500 gslj gslp gsnd bdftops font2c \
-pdf2dsc pdf2ps printafm ps2ascii ps2epsi ps2pdf wftopfa ;\
- do if ( test -f $$f ); then $(INSTALL_PROGRAM) $$f $(scriptdir)/$$f; fi;\
- done'
-
-MAN1_PAGES=gs pdf2dsc pdf2ps ps2ascii ps2epsi ps2pdf
-install-data: gs.1
- -mkdir $(mandir)
- -mkdir $(man1dir)
- sh -c 'for f in $(MAN1_PAGES) ;\
- do if ( test -f $$f.1 ); then $(INSTALL_DATA) $$f.1 $(man1dir)/$$f.$(man1ext); fi;\
- done'
- -mkdir $(datadir)
- -mkdir $(gsdir)
- -mkdir $(gsdatadir)
- sh -c 'for f in Fontmap \
-cbjc600.ppd cbjc800.ppd *.upp \
-gs_init.ps gs_btokn.ps gs_ccfnt.ps gs_cff.ps gs_cidfn.ps gs_cmap.ps \
-gs_diskf.ps gs_dpnxt.ps gs_dps.ps gs_dps1.ps gs_dps2.ps gs_epsf.ps \
-gs_fonts.ps gs_kanji.ps gs_lev2.ps \
-gs_pfile.ps gs_res.ps gs_setpd.ps gs_statd.ps \
-gs_ttf.ps gs_typ42.ps gs_type1.ps \
-gs_dbt_e.ps gs_iso_e.ps gs_ksb_e.ps gs_std_e.ps gs_sym_e.ps \
-acctest.ps align.ps bdftops.ps caption.ps decrypt.ps docie.ps \
-font2c.ps gslp.ps impath.ps landscap.ps level1.ps lines.ps \
-markhint.ps markpath.ps \
-packfile.ps pcharstr.ps pfbtogs.ps ppath.ps prfont.ps printafm.ps \
-ps2ai.ps ps2ascii.ps ps2epsi.ps ps2image.ps \
-quit.ps showchar.ps showpage.ps stcinfo.ps stcolor.ps \
-traceimg.ps traceop.ps type1enc.ps type1ops.ps uninfo.ps unprot.ps \
-viewcmyk.ps viewgif.ps viewjpeg.ps viewpcx.ps viewpbm.ps viewps2a.ps \
-winmaps.ps wftopfa.ps wrfont.ps zeroline.ps \
-gs_l2img.ps gs_pdf.ps \
-pdf2dsc.ps \
-pdf_base.ps pdf_draw.ps pdf_font.ps pdf_main.ps pdf_sec.ps pdf_2ps.ps \
-gs_mex_e.ps gs_mro_e.ps gs_pdf_e.ps gs_wan_e.ps \
-gs_pdfwr.ps ;\
- do if ( test -f $$f ); then $(INSTALL_DATA) $$f $(gsdatadir)/$$f; fi;\
- done'
- -mkdir $(docdir)
- sh -c 'for f in COPYING NEWS PUBLIC README \
-bug-form.txt c-style.txt current.txt devices.txt drivers.txt fonts.txt \
-helpers.txt hershey.txt history1.txt history2.txt history3.txt humor.txt \
-install.txt language.txt lib.txt make.txt new-user.txt \
-ps2epsi.txt ps2pdf.txt psfiles.txt public.txt \
-unix-lpr.txt use.txt xfonts.txt ;\
- do if ( test -f $$f ); then $(INSTALL_DATA) $$f $(docdir)/$$f; fi;\
- done'
- -mkdir $(exdir)
- for f in alphabet.ps chess.ps cheq.ps colorcir.ps escher.ps golfer.ps \
-grayalph.ps snowflak.ps tiger.ps waterfal.ps \
-ridt91.eps ;\
- do $(INSTALL_DATA) $$f $(exdir)/$$f ;\
- done
+CC_=$(CC) $(CCFLAGS)
+CC_LEAF=$(CC_) -fomit-frame-pointer
+
+# ---------------- End of platform-specific section ---------------- #
+
+include $(GLSRCDIR)/dvx-head.mak
+include $(GLSRCDIR)/gs.mak
+include $(GLSRCDIR)/lib.mak
+include $(GLSRCDIR)/int.mak
+include $(GLSRCDIR)/jpeg.mak
+# zlib.mak must precede libpng.mak
+include $(GLSRCDIR)/zlib.mak
+include $(GLSRCDIR)/libpng.mak
+include $(GLSRCDIR)/devs.mak
+include $(GLSRCDIR)/contrib.mak
+include $(GLSRCDIR)/dvx-tail.mak
+include $(GLSRCDIR)/unix-end.mak
+include $(GLSRCDIR)/unixinst.mak
diff --git a/gs/src/dvx-head.mak b/gs/src/dvx-head.mak
index 5c165ef37..c070c8c67 100644
--- a/gs/src/dvx-head.mak
+++ b/gs/src/dvx-head.mak
@@ -1,4 +1,4 @@
-# Copyright (C) 1994, 1996 Aladdin Enterprises. All rights reserved.
+# Copyright (C) 1994, 1996, 1997, 1998 Aladdin Enterprises. All rights reserved.
#
# This file is part of Aladdin Ghostscript.
#
@@ -15,10 +15,11 @@
# License requires that the copyright notice and this notice be preserved on
# all copies.
+# Id: dvx-head.mak
# Partial makefile, common to all Desqview/X configurations.
# This part of the makefile gets inserted after the compiler-specific part
-# (xxx-head.mak) and before gs.mak and devs.mak.
+# (xxx-head.mak) and before gs.mak, devs.mak, and contrib.mak.
# ----------------------------- Generic stuff ----------------------------- #
@@ -29,7 +30,14 @@ PLATFORM=dvx_
# Define the syntax for command, object, and executable files.
CMD=.bat
-O=-o ./
+I_=-I
+II=-I
+_I=
+# There should be a <space> at the end of the definition of O_,
+# but we have to work around the fact that some `make' programs
+# drop trailing spaces in macro definitions.
+NULL=
+O_=-o $(NULL)
OBJ=o
XE=.exe
XEAUX=.exe
@@ -50,21 +58,15 @@ RM_=rm -f
# Define the arguments for genconf.
-CONFILES=-p -pl &-l%%s -ol ld.tr
+CONFILES=-p -pl &-l%%s
+CONFLDTR=-ol
# Define the compilation rules and flags.
-CCFLAGS=$(GENOPT) $(CFLAGS)
-
-.c.o: $(AK)
- $(CCC) $*.c
-
-CCCF=$(CCC)
-CCD=$(CCC)
-CCINT=$(CCC)
+CC_D=$(CC_)
+CC_INT=$(CC_)
# Patch a couple of PC-specific things that aren't relevant to DV/X builds,
# but that cause `make' to produce warnings.
-BGIDIR=***UNUSED***
PCFBASM=
diff --git a/gs/src/dvx-tail.mak b/gs/src/dvx-tail.mak
index eb11ac310..0cfda6c3d 100644
--- a/gs/src/dvx-tail.mak
+++ b/gs/src/dvx-tail.mak
@@ -1,4 +1,4 @@
-# Copyright (C) 1994, 1995, 1997 Aladdin Enterprises. All rights reserved.
+# Copyright (C) 1994, 1995, 1997, 1998 Aladdin Enterprises. All rights reserved.
#
# This file is part of Aladdin Ghostscript.
#
@@ -15,11 +15,9 @@
# License requires that the copyright notice and this notice be preserved on
# all copies.
+# Id: dvx-tail.mak
# Partial makefile, common to all Desqview/X configurations.
-
# This is the last part of the makefile for Desqview/X configurations.
-# Since Unix make doesn't have an 'include' facility, we concatenate
-# the various parts of the makefile together by brute force (in tar_cat).
# The following prevents GNU make from constructing argument lists that
# include all environment variables, which can easily be longer than
@@ -31,13 +29,13 @@
## The Desqview/X platform
-dvx__=gp_nofb.$(OBJ) gp_dvx.$(OBJ) gp_unifs.$(OBJ) gp_dosfs.$(OBJ)
+dvx__=$(GLOBJ)gp_getnv.$(OBJ) $(GLOBJ)gp_nofb.$(OBJ) $(GLOBJ)gp_dvx.$(OBJ) $(GLOBJ)gp_unifs.$(OBJ) $(GLOBJ)gp_dosfs.$(OBJ)
dvx_.dev: $(dvx__)
$(SETMOD) dvx_ $(dvx__)
-gp_dvx.$(OBJ): gp_dvx.c $(AK) $(string__h) $(gx_h) $(gsexit_h) $(gp_h) \
+$(GLOBJ)gp_dvx.$(OBJ): $(GLSRC)gp_dvx.c $(AK) $(string__h) $(gx_h) $(gsexit_h) $(gp_h) \
$(time__h) $(dos__h)
- $(CCC) -D__DVX__ gp_dvx.c
+ $(CC_) -D__DVX__ -c $(GLSRC)gp_dvx.c -o $(GLOBJ)gp_dvx.$(OBJ)
# -------------------------- Auxiliary programs --------------------------- #
@@ -62,24 +60,27 @@ $(GENCONF_XE): genconf.c $(stdpre_h)
coff2exe genconf
del genconf
+$(GENDEV_XE): gendev.c $(stdpre_h)
+ $(CC) -o gendev gendev.c
+ strip gendev
+ coff2exe gendev
+ del gendev
+
$(GENINIT_XE): geninit.c $(stdio__h) $(string__h)
$(CC) -o geninit geninit.c
strip geninit
coff2exe geninit
del geninit
-# Construct gconfig_.h to reflect the environment.
+# Construct $(gconfig__h) to reflect the environment.
INCLUDE=/djgpp/include
-gconfig_.h: dvx-tail.mak $(ECHOGS_XE)
- echogs -w gconfig_.h -x 2f2a -s This file was generated automatically. -s -x 2a2f
- echogs -a gconfig_.h -x 23 define HAVE_SYS_TIME_H
- echogs -a gconfig_.h -x 23 define HAVE_DIRENT_H
+$(gconfig__h): $(GLSRCDIR)/dvx-tail.mak $(ECHOGS_XE)
+ $(ECHOGS_XE) -w $(gconfig__h) -x 2f2a -s This file was generated automatically. -s -x 2a2f
+ $(ECHOGS_XE) -a $(gconfig__h) -x 23 define HAVE_SYS_TIME_H
+ $(ECHOGS_XE) -a $(gconfig__h) -x 23 define HAVE_DIRENT_H
# ----------------------------- Main program ------------------------------ #
-BEGINFILES=
-CCBEGIN=$(CCC) *.c
-
# Interpreter main program
$(GS_XE): ld.tr gs.$(OBJ) $(INT_ALL) $(LIB_ALL) $(DEVS_ALL)
diff --git a/gs/src/dwdll.cpp b/gs/src/dwdll.cpp
index 6e3ae1f73..406589a92 100644
--- a/gs/src/dwdll.cpp
+++ b/gs/src/dwdll.cpp
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, Russell Lang. All rights reserved.
+/* Copyright (C) 1996, 1998, Russell Lang. All rights reserved.
This file is part of Aladdin Ghostscript.
@@ -17,7 +17,7 @@
*/
-// dwdll.cpp
+// Id: dwdll.cpp
// gsdll class for MS-Windows
@@ -27,7 +27,11 @@
#include <stdio.h>
extern "C" {
+#include "stdpre.h"
+#undef public
+#include "gpgetenv.h"
#include "gsdll.h"
+#include "gscdefs.h"
}
#include "dwdll.h" // gsdll_class
@@ -44,6 +48,7 @@ char fullname[1024];
const char *shortname;
char *p;
long version;
+int len;
// Don't load if already loaded
if (hmodule)
@@ -52,8 +57,15 @@ long version;
initialized = FALSE;
- // Try to load DLL first with given path
- hmodule = LoadLibrary(name);
+ // First try to load DLL with name in registry or environment variable
+ hmodule = (HINSTANCE)NULL;
+ len = sizeof(fullname);
+ if (gp_getenv("GS_DLL", fullname, &len) == 0)
+ hmodule = LoadLibrary(fullname);
+
+ // Next try to load DLL first with given path
+ if (hmodule < (HINSTANCE)HINSTANCE_ERROR)
+ hmodule = LoadLibrary(name);
if (hmodule < (HINSTANCE)HINSTANCE_ERROR) {
// failed
// try again, with path of EXE
diff --git a/gs/src/dwdll.h b/gs/src/dwdll.h
index 805e2c3e5..3e0520f9e 100644
--- a/gs/src/dwdll.h
+++ b/gs/src/dwdll.h
@@ -1,23 +1,23 @@
/* Copyright (C) 1996, Russell Lang. All rights reserved.
-
- This file is part of Aladdin Ghostscript.
-
- Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
- or distributor accepts any responsibility for the consequences of using it,
- or for whether it serves any particular purpose or works at all, unless he
- or she says so in writing. Refer to the Aladdin Ghostscript Free Public
- License (the "License") for full details.
-
- Every copy of Aladdin Ghostscript must include a copy of the License,
- normally in a plain ASCII text file named PUBLIC. The License grants you
- the right to copy, modify and redistribute Aladdin Ghostscript, but only
- under certain conditions described in the License. Among other things, the
- License requires that the copyright notice and this notice be preserved on
- all copies.
-*/
-
-
-// dwdll.h
+
+ This file is part of Aladdin Ghostscript.
+
+ Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
+ or distributor accepts any responsibility for the consequences of using it,
+ or for whether it serves any particular purpose or works at all, unless he
+ or she says so in writing. Refer to the Aladdin Ghostscript Free Public
+ License (the "License") for full details.
+
+ Every copy of Aladdin Ghostscript must include a copy of the License,
+ normally in a plain ASCII text file named PUBLIC. The License grants you
+ the right to copy, modify and redistribute Aladdin Ghostscript, but only
+ under certain conditions described in the License. Among other things, the
+ License requires that the copyright notice and this notice be preserved on
+ all copies.
+ */
+
+
+// Id: dwdll.h
// gsdll_class for MS-Windows
@@ -26,93 +26,91 @@ extern "C" {
#include "gsdll.h"
}
#endif
-
#ifndef _GSDLL_CLASS_H
#define _GSDLL_CLASS_H
class gsdll_class {
- // instance of caller
- HINSTANCE hinstance;
- // handle to DLL. Non-zero of loaded.
- HINSTANCE hmodule;
- // handle to parent window. Can be NULL.
- HWND hwnd;
- // text description of last error
- char last_error[128];
- // true if init and execute_begin have been called
- BOOL initialized;
- // return code from last c_execute_end
- int execute_code;
-
- // pointer to callback from DLL
- GSDLL_CALLBACK callback;
-
- // pointers to DLL functions
- PFN_gsdll_revision c_revision;
- PFN_gsdll_init c_init;
- PFN_gsdll_execute_begin c_execute_begin;
- PFN_gsdll_execute_cont c_execute_cont;
- PFN_gsdll_execute_end c_execute_end;
- PFN_gsdll_exit c_exit;
- PFN_gsdll_lock_device c_lock_device;
- PFN_gsdll_copy_dib c_copy_dib;
- PFN_gsdll_copy_palette c_copy_palette;
- PFN_gsdll_draw c_draw;
-
- // pointer to os2dll or mswindll device
- // this needs to be extended to support multiple devices
- // also need to have one window per device
- char FAR *device;
-
-
-public:
- // Load DLL
- // Arguments:
- // instance of calling EXE
- // name of DLL, may include path
- // expected version number of DLL
- // Returns:
- // zero on success
- // non-zero on error. Error message available from get_last_error()
- // do nothing if DLL already loaded
- int load(const HINSTANCE hinstance, const char *name, const long version);
-
- // Get revision number of DLL
- int revision(char FAR * FAR *, char FAR * FAR *, long FAR *, long FAR *);
-
- // Unload DLL
- int unload(void);
-
- // Initialise DLL
- // Arguments:
- // pointer to C callback function
- // window handle of parent
- // argc (normal C command line)
- // argv (normal C command line)
- int init(GSDLL_CALLBACK callback, HWND hwnd, int argc, char FAR * FAR *argv);
-
- // Restart DLL
- int restart(int argc, char FAR * FAR *argv);
-
- // Execute string
- int execute(const char FAR *, int len);
-
- // Get last error string
- int get_last_error(char *str, int len);
-
- // lock device
- int gsdll_class::lock_device(const char FAR *device, int lock);
-
- // draw bitmap
- int gsdll_class::draw(const char FAR *device, HDC hdc, int dx, int dy, int wx, int wy, int sx, int sy);
-
- // copy bitmap
- HGLOBAL gsdll_class::copy_dib(const char FAR *device);
-
- // copy palette
- HPALETTE gsdll_class::copy_palette(const char FAR *device);
+ // instance of caller
+ HINSTANCE hinstance;
+ // handle to DLL. Non-zero of loaded.
+ HINSTANCE hmodule;
+ // handle to parent window. Can be NULL.
+ HWND hwnd;
+ // text description of last error
+ char last_error[128];
+ // true if init and execute_begin have been called
+ BOOL initialized;
+ // return code from last c_execute_end
+ int execute_code;
+
+ // pointer to callback from DLL
+ GSDLL_CALLBACK callback;
+
+ // pointers to DLL functions
+ PFN_gsdll_revision c_revision;
+ PFN_gsdll_init c_init;
+ PFN_gsdll_execute_begin c_execute_begin;
+ PFN_gsdll_execute_cont c_execute_cont;
+ PFN_gsdll_execute_end c_execute_end;
+ PFN_gsdll_exit c_exit;
+ PFN_gsdll_lock_device c_lock_device;
+ PFN_gsdll_copy_dib c_copy_dib;
+ PFN_gsdll_copy_palette c_copy_palette;
+ PFN_gsdll_draw c_draw;
+
+ // pointer to os2dll or mswindll device
+ // this needs to be extended to support multiple devices
+ // also need to have one window per device
+ char FAR *device;
+
+
+ public:
+ // Load DLL
+ // Arguments:
+ // instance of calling EXE
+ // name of DLL, may include path
+ // expected version number of DLL
+ // Returns:
+ // zero on success
+ // non-zero on error. Error message available from get_last_error()
+ // do nothing if DLL already loaded
+ int load(const HINSTANCE hinstance, const char *name, const long version);
+
+ // Get revision number of DLL
+ int revision(char FAR * FAR *, char FAR * FAR *, long FAR *, long FAR *);
+
+ // Unload DLL
+ int unload(void);
+
+ // Initialise DLL
+ // Arguments:
+ // pointer to C callback function
+ // window handle of parent
+ // argc (normal C command line)
+ // argv (normal C command line)
+ int init(GSDLL_CALLBACK callback, HWND hwnd, int argc, char FAR * FAR * argv);
+
+ // Restart DLL
+ int restart(int argc, char FAR * FAR * argv);
+
+ // Execute string
+ int execute(const char FAR *, int len);
+
+ // Get last error string
+ int get_last_error(char *str, int len);
+
+ // lock device
+ int gsdll_class::lock_device(const char FAR * device, int lock);
+
+ // draw bitmap
+ int gsdll_class::draw(const char FAR * device, HDC hdc, int dx, int dy, int wx, int wy, int sx, int sy);
+
+ // copy bitmap
+ HGLOBAL gsdll_class::copy_dib(const char FAR * device);
+
+ // copy palette
+ HPALETTE gsdll_class::copy_palette(const char FAR * device);
};
-#endif // _GSDLL_CLASS_H
-
+#endif // _GSDLL_CLASS_H
diff --git a/gs/src/dwimg.cpp b/gs/src/dwimg.cpp
index 9cdcc56bd..a0ee65830 100644
--- a/gs/src/dwimg.cpp
+++ b/gs/src/dwimg.cpp
@@ -16,7 +16,7 @@
all copies.
*/
-// dwimg.cpp
+// Id: dwimg.cpp
#define STRICT
diff --git a/gs/src/dwimg.h b/gs/src/dwimg.h
index ad468a093..47a3dfcd7 100644
--- a/gs/src/dwimg.h
+++ b/gs/src/dwimg.h
@@ -1,51 +1,52 @@
/* Copyright (C) 1996, Russell Lang. All rights reserved.
-
- This file is part of Aladdin Ghostscript.
-
- Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
- or distributor accepts any responsibility for the consequences of using it,
- or for whether it serves any particular purpose or works at all, unless he
- or she says so in writing. Refer to the Aladdin Ghostscript Free Public
- License (the "License") for full details.
-
- Every copy of Aladdin Ghostscript must include a copy of the License,
- normally in a plain ASCII text file named PUBLIC. The License grants you
- the right to copy, modify and redistribute Aladdin Ghostscript, but only
- under certain conditions described in the License. Among other things, the
- License requires that the copyright notice and this notice be preserved on
- all copies.
-*/
-
-
-// dwimg.h
+
+ This file is part of Aladdin Ghostscript.
+
+ Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
+ or distributor accepts any responsibility for the consequences of using it,
+ or for whether it serves any particular purpose or works at all, unless he
+ or she says so in writing. Refer to the Aladdin Ghostscript Free Public
+ License (the "License") for full details.
+
+ Every copy of Aladdin Ghostscript must include a copy of the License,
+ normally in a plain ASCII text file named PUBLIC. The License grants you
+ the right to copy, modify and redistribute Aladdin Ghostscript, but only
+ under certain conditions described in the License. Among other things, the
+ License requires that the copyright notice and this notice be preserved on
+ all copies.
+ */
+
+
+// Id: dwimg.h
class ImageWindow {
- static ImageWindow *first;
- ImageWindow *next;
-
- HWND hwnd;
- char FAR *device; // handle to Ghostscript device
- int width, height;
-
- // Window scrolling stuff
- int cxClient, cyClient;
- int cxAdjust, cyAdjust;
- int nVscrollPos, nVscrollMax;
- int nHscrollPos, nHscrollMax;
-
- void register_class(void);
-
-public:
- static HINSTANCE hInstance; // instance of EXE
- static HWND hwndtext; // handle to text window
- friend ImageWindow *FindImageWindow(char FAR *dev);
- void open(char FAR *dev);
- void close(void);
- void sync(void);
- void page(void);
- void size(int x, int y);
- void create_window(void);
- LRESULT WndProc(HWND, UINT, WPARAM, LPARAM);
-};
+ static ImageWindow *first;
+ ImageWindow *next;
+ HWND hwnd;
+ char FAR *device; // handle to Ghostscript device
+ int width, height;
+
+ // Window scrolling stuff
+ int cxClient, cyClient;
+ int cxAdjust, cyAdjust;
+ int nVscrollPos, nVscrollMax;
+ int nHscrollPos, nHscrollMax;
+
+ void register_class(void);
+
+ public:
+ static HINSTANCE hInstance; // instance of EXE
+
+ static HWND hwndtext; // handle to text window
+
+ friend ImageWindow *FindImageWindow(char FAR * dev);
+ void open(char FAR * dev);
+ void close(void);
+ void sync(void);
+ void page(void);
+ void size(int x, int y);
+ void create_window(void);
+ LRESULT WndProc(HWND, UINT, WPARAM, LPARAM);
+};
diff --git a/gs/src/dwmain.cpp b/gs/src/dwmain.cpp
index 75d573e2e..9a10cb445 100644
--- a/gs/src/dwmain.cpp
+++ b/gs/src/dwmain.cpp
@@ -17,7 +17,7 @@
*/
-// dwmain.cpp
+// Id: dwmain.cpp
// Ghostscript DLL loader for Windows
#define STRICT
diff --git a/gs/src/dwmain.h b/gs/src/dwmain.h
index cafe03d33..a70fd37a8 100644
--- a/gs/src/dwmain.h
+++ b/gs/src/dwmain.h
@@ -1,5 +1,4 @@
-// dwmain.h
+// Id: dwmain.h
#define GSTEXT_ICON 50
#define GSIMAGE_ICON 51
-
diff --git a/gs/src/dwmain.rc b/gs/src/dwmain.rc
index 3b5591870..ee2adcfdb 100644
--- a/gs/src/dwmain.rc
+++ b/gs/src/dwmain.rc
@@ -17,7 +17,7 @@
*/
-/* dwmain.rc */
+/*Id: dwmain.rc */
#include <windows.h>
#include "dwmain.h"
diff --git a/gs/src/dwmainc.cpp b/gs/src/dwmainc.cpp
index 6ab6daeb1..8044aa9e6 100644
--- a/gs/src/dwmainc.cpp
+++ b/gs/src/dwmainc.cpp
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997, Russell Lang. All rights reserved.
+/* Copyright (C) 1996-1998, Russell Lang. All rights reserved.
This file is part of Aladdin Ghostscript.
@@ -17,7 +17,7 @@
*/
-// dwmainc.cpp
+// Id: dwmainc.cpp
// Ghostscript DLL loader for Windows 95/NT
// For WINDOWCOMPAT (console mode) application
@@ -28,6 +28,8 @@
#include <string.h>
#include <stdlib.h>
#include <dos.h>
+#include <fcntl.h>
+#include <io.h>
extern "C" {
#include "gscdefs.h"
#define GSREVISION gs_revision
@@ -60,6 +62,8 @@ new_main(int argc, char *argv[])
typedef char FAR * FARARGV_PTR;
int rc;
+ setmode(fileno(stdin), O_BINARY);
+
// load DLL
if (gsdll.load(ghInstance, szDllName, GSREVISION)) {
char buf[256];
@@ -197,9 +201,10 @@ char buf[256];
return count;
case GSDLL_DEVICE:
if (count) {
- fputs("mswindll device not supported by the command\n\
-line version of Ghostscript. Select a different device using\n\
--sDEVICE= as described in use.txt.\n", stdout);
+ fputs("\n\
+The mswindll device is not supported by the command line version of\n\
+Ghostscript. Select a different device using -sDEVICE= as described\n\
+in use.txt.\n", stdout);
}
break;
case GSDLL_SYNC:
diff --git a/gs/src/dwnodll.cpp b/gs/src/dwnodll.cpp
index 57516768a..0414cf375 100644
--- a/gs/src/dwnodll.cpp
+++ b/gs/src/dwnodll.cpp
@@ -17,7 +17,7 @@
*/
-// dwnodll.cpp
+// Id: dwnodll.cpp
// gsdll class for MS-Windows
diff --git a/gs/src/dwtext.cpp b/gs/src/dwtext.cpp
index 03176b839..585adfbe9 100644
--- a/gs/src/dwtext.cpp
+++ b/gs/src/dwtext.cpp
@@ -17,7 +17,7 @@
*/
-// dwtext.cpp
+// Id: dwtext.cpp
// Microsoft Windows 3.n text window for Ghostscript.
diff --git a/gs/src/dwtext.h b/gs/src/dwtext.h
index 210adcad8..47d221a25 100644
--- a/gs/src/dwtext.h
+++ b/gs/src/dwtext.h
@@ -1,23 +1,23 @@
/* Copyright (C) 1996, Russell Lang. All rights reserved.
-
- This file is part of Aladdin Ghostscript.
-
- Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
- or distributor accepts any responsibility for the consequences of using it,
- or for whether it serves any particular purpose or works at all, unless he
- or she says so in writing. Refer to the Aladdin Ghostscript Free Public
- License (the "License") for full details.
-
- Every copy of Aladdin Ghostscript must include a copy of the License,
- normally in a plain ASCII text file named PUBLIC. The License grants you
- the right to copy, modify and redistribute Aladdin Ghostscript, but only
- under certain conditions described in the License. Among other things, the
- License requires that the copyright notice and this notice be preserved on
- all copies.
-*/
-
-
-// dwtext.h
+
+ This file is part of Aladdin Ghostscript.
+
+ Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
+ or distributor accepts any responsibility for the consequences of using it,
+ or for whether it serves any particular purpose or works at all, unless he
+ or she says so in writing. Refer to the Aladdin Ghostscript Free Public
+ License (the "License") for full details.
+
+ Every copy of Aladdin Ghostscript must include a copy of the License,
+ normally in a plain ASCII text file named PUBLIC. The License grants you
+ the right to copy, modify and redistribute Aladdin Ghostscript, but only
+ under certain conditions described in the License. Among other things, the
+ License requires that the copyright notice and this notice be preserved on
+ all copies.
+ */
+
+
+// Id: dwtext.h
// Text Window class
@@ -25,120 +25,123 @@
#define _Windows
#endif
-
+
/* ================================== */
/* text window class */
class TextWindow {
- HINSTANCE hInstance; /* required */
- LPSTR Title; /* required */
- HICON hIcon; /* optional */
-
- BYTE FAR *ScreenBuffer;
- POINT ScreenSize; /* optional */
- char *DragPre; /* optional */
- char *DragPost; /* optional */
- int nCmdShow; /* optional */
- HWND hwnd;
-
- BYTE FAR *KeyBuf;
- BYTE FAR *KeyBufIn;
- BYTE FAR *KeyBufOut;
- unsigned int KeyBufSize;
- BOOL quitnow;
-
- BOOL bFocus;
- BOOL bGetCh;
- char *fontname; // font name
- int fontsize; // font size in pts
- HFONT hfont;
- int CharAscent;
-
- int CaretHeight;
- int CursorFlag;
- POINT CursorPos;
- POINT ClientSize;
- POINT CharSize;
- POINT ScrollPos;
- POINT ScrollMax;
-
- void error(char *message);
- void new_line(void);
- void update_text(int count);
- void drag_drop(HDROP hdrop);
- void copy_to_clipboard(void);
-
-public:
- // constructor
- TextWindow(void);
-
- // destructor
- ~TextWindow(void);
-
- // register window class
- int register_class(HINSTANCE hinst, HICON hicon);
-
- // test if a key has been pressed
- // return TRUE if key hit
- // return FALSE if no key
- int kbhit(void);
-
- // Get a character from the keyboard, waiting if necessary
- int getch(void);
-
- // Get a line from the keyboard
- // store line in buf, with no more than len characters
- // including null character
- // return number of characters read
- int gets(LPSTR buf, int len);
-
- // Get a line from the keyboard
- // store line in buf, with no more than len characters
- // line is not null terminated
- // return number of characters read
- int read_line(LPSTR buf, int len);
-
- // Put a character to the window
- int putch(int ch);
-
- // Write cnt character from buf to the window
- void write_buf(LPSTR buf, int cnt);
-
- // Put a string to the window
- void puts(LPSTR str);
-
- // Scroll window to make cursor visible
- void to_cursor(void);
-
- // Create and show window with given name and min/max/normal state
- // return 0 on success, non-zero on error
- int create(LPSTR title, int cmdShow);
-
- // Destroy window
- int destroy(void);
-
- // Set window font and size
- // a must choose monospaced
- void font(const char *fontname, int fontsize);
-
- // Set screen size in characters
- void size(int width, int height);
-
- // Set pre drag and post drag strings
- // If a file is dropped on the window, the following will
- // be poked into the keyboard buffer:
- // the pre_drag string
- // the file name
- // the post_drag string
- void drag(const char *pre_drag, const char *post_drag);
-
- // member window procedure
- LRESULT WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
-
- // provide access to window handle
- HWND get_handle(void) { return hwnd; };
+ HINSTANCE hInstance; /* required */
+ LPSTR Title; /* required */
+ HICON hIcon; /* optional */
+
+ BYTE FAR *ScreenBuffer;
+ POINT ScreenSize; /* optional */
+ char *DragPre; /* optional */
+ char *DragPost; /* optional */
+ int nCmdShow; /* optional */
+ HWND hwnd;
+
+ BYTE FAR *KeyBuf;
+ BYTE FAR *KeyBufIn;
+ BYTE FAR *KeyBufOut;
+ unsigned int KeyBufSize;
+ BOOL quitnow;
+
+ BOOL bFocus;
+ BOOL bGetCh;
+ char *fontname; // font name
+
+ int fontsize; // font size in pts
+
+ HFONT hfont;
+ int CharAscent;
+
+ int CaretHeight;
+ int CursorFlag;
+ POINT CursorPos;
+ POINT ClientSize;
+ POINT CharSize;
+ POINT ScrollPos;
+ POINT ScrollMax;
+
+ void error(char *message);
+ void new_line(void);
+ void update_text(int count);
+ void drag_drop(HDROP hdrop);
+ void copy_to_clipboard(void);
+
+ public:
+ // constructor
+ TextWindow(void);
+
+ // destructor
+ ~TextWindow(void);
+
+ // register window class
+ int register_class(HINSTANCE hinst, HICON hicon);
+
+ // test if a key has been pressed
+ // return TRUE if key hit
+ // return FALSE if no key
+ int kbhit(void);
+
+ // Get a character from the keyboard, waiting if necessary
+ int getch(void);
+
+ // Get a line from the keyboard
+ // store line in buf, with no more than len characters
+ // including null character
+ // return number of characters read
+ int gets(LPSTR buf, int len);
+
+ // Get a line from the keyboard
+ // store line in buf, with no more than len characters
+ // line is not null terminated
+ // return number of characters read
+ int read_line(LPSTR buf, int len);
+
+ // Put a character to the window
+ int putch(int ch);
+
+ // Write cnt character from buf to the window
+ void write_buf(LPSTR buf, int cnt);
+
+ // Put a string to the window
+ void puts(LPSTR str);
+
+ // Scroll window to make cursor visible
+ void to_cursor(void);
+
+ // Create and show window with given name and min/max/normal state
+ // return 0 on success, non-zero on error
+ int create(LPSTR title, int cmdShow);
+
+ // Destroy window
+ int destroy(void);
+
+ // Set window font and size
+ // a must choose monospaced
+ void font(const char *fontname, int fontsize);
+
+ // Set screen size in characters
+ void size(int width, int height);
+
+ // Set pre drag and post drag strings
+ // If a file is dropped on the window, the following will
+ // be poked into the keyboard buffer:
+ // the pre_drag string
+ // the file name
+ // the post_drag string
+ void drag(const char *pre_drag, const char *post_drag);
+
+ // member window procedure
+ LRESULT WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
+
+ // provide access to window handle
+ HWND get_handle(void) {
+ return hwnd;
+ };
};
/* ================================== */
-
diff --git a/gs/src/echogs.c b/gs/src/echogs.c
index 755d723b0..a3f69f406 100644
--- a/gs/src/echogs.c
+++ b/gs/src/echogs.c
@@ -16,7 +16,7 @@
all copies.
*/
-/* echogs.c */
+/*Id: echogs.c */
/* 'echo'-like utility */
#include <stdio.h>
/* Some brain-damaged environments (e.g. Sun) don't include */
diff --git a/gs/src/errno_.h b/gs/src/errno_.h
index 729ca77cf..14df45e0b 100644
--- a/gs/src/errno_.h
+++ b/gs/src/errno_.h
@@ -1,30 +1,36 @@
-/* Copyright (C) 1993 Aladdin Enterprises. All rights reserved.
-
- This file is part of Aladdin Ghostscript.
-
- Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
- or distributor accepts any responsibility for the consequences of using it,
- or for whether it serves any particular purpose or works at all, unless he
- or she says so in writing. Refer to the Aladdin Ghostscript Free Public
- License (the "License") for full details.
-
- Every copy of Aladdin Ghostscript must include a copy of the License,
- normally in a plain ASCII text file named PUBLIC. The License grants you
- the right to copy, modify and redistribute Aladdin Ghostscript, but only
- under certain conditions described in the License. Among other things, the
- License requires that the copyright notice and this notice be preserved on
- all copies.
-*/
-
-/* errno_.h */
+/* Copyright (C) 1993, 1998 Aladdin Enterprises. All rights reserved.
+
+ This file is part of Aladdin Ghostscript.
+
+ Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
+ or distributor accepts any responsibility for the consequences of using it,
+ or for whether it serves any particular purpose or works at all, unless he
+ or she says so in writing. Refer to the Aladdin Ghostscript Free Public
+ License (the "License") for full details.
+
+ Every copy of Aladdin Ghostscript must include a copy of the License,
+ normally in a plain ASCII text file named PUBLIC. The License grants you
+ the right to copy, modify and redistribute Aladdin Ghostscript, but only
+ under certain conditions described in the License. Among other things, the
+ License requires that the copyright notice and this notice be preserved on
+ all copies.
+ */
+
+/*Id: errno_.h */
/* Generic substitute for Unix errno.h */
+#ifndef errno__INCLUDED
+# define errno__INCLUDED
+
/* We must include std.h before any file that includes sys/types.h. */
#include "std.h"
/* All environments provide errno.h, but in some of them, errno.h */
/* only defines the error numbers, and doesn't declare errno. */
#include <errno.h>
-#ifndef errno /* in case it was #defined (very implausible!) */
+#ifndef errno /* in case it was #defined (very implausible!) */
extern int errno;
+
#endif
+
+#endif /* errno__INCLUDED */
diff --git a/gs/src/errors.h b/gs/src/errors.h
index 0e67e755f..66b51209e 100644
--- a/gs/src/errors.h
+++ b/gs/src/errors.h
@@ -1,24 +1,27 @@
-/* Copyright (C) 1989, 1995 Aladdin Enterprises. All rights reserved.
-
- This file is part of Aladdin Ghostscript.
-
- Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
- or distributor accepts any responsibility for the consequences of using it,
- or for whether it serves any particular purpose or works at all, unless he
- or she says so in writing. Refer to the Aladdin Ghostscript Free Public
- License (the "License") for full details.
-
- Every copy of Aladdin Ghostscript must include a copy of the License,
- normally in a plain ASCII text file named PUBLIC. The License grants you
- the right to copy, modify and redistribute Aladdin Ghostscript, but only
- under certain conditions described in the License. Among other things, the
- License requires that the copyright notice and this notice be preserved on
- all copies.
-*/
-
-/* errors.h */
+/* Copyright (C) 1989, 1995, 1998 Aladdin Enterprises. All rights reserved.
+
+ This file is part of Aladdin Ghostscript.
+
+ Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
+ or distributor accepts any responsibility for the consequences of using it,
+ or for whether it serves any particular purpose or works at all, unless he
+ or she says so in writing. Refer to the Aladdin Ghostscript Free Public
+ License (the "License") for full details.
+
+ Every copy of Aladdin Ghostscript must include a copy of the License,
+ normally in a plain ASCII text file named PUBLIC. The License grants you
+ the right to copy, modify and redistribute Aladdin Ghostscript, but only
+ under certain conditions described in the License. Among other things, the
+ License requires that the copyright notice and this notice be preserved on
+ all copies.
+ */
+
+/*Id: errors.h */
/* Definition of error codes */
+#ifndef errors_INCLUDED
+# define errors_INCLUDED
+
/*
* A procedure that may return an error always returns
* a non-negative value (zero, unless otherwise noted) for success,
@@ -26,102 +29,62 @@
* We use ints rather than an enum to avoid a lot of casting.
*/
-/*
- * The following peculiar structure allows us to include this file
- * wherever error code definitions are needed, and use the same file
- * to generate the table of error names by setting INCLUDE_ERROR_NAMES.
- */
-
-# ifdef INCLUDE_ERROR_NAMES
-
/* Define the error name table */
-const char _ds *gs_error_names[] = {
-#define _e_(code,name) name,
-
-# else /* !INCLUDE_ERROR_NAMES */
-
-extern const char _ds *gs_error_names[];
-# define _e_(code,name)
-
-#endif /* (!)INCLUDE_ERROR_NAMES */
+extern const char *const gs_error_names[];
/* ------ PostScript Level 1 errors ------ */
-#define e_unknownerror (-1) /* unknown error */
- _e_(e_unknown, "unknownerror")
+#define e_unknownerror (-1) /* unknown error */
#define e_dictfull (-2)
- _e_(e_dictfull, "dictfull")
#define e_dictstackoverflow (-3)
- _e_(e_dictstackoverflow, "dictstackoverflow")
#define e_dictstackunderflow (-4)
- _e_(e_dictstackunderflow, "dictstackunderflow")
#define e_execstackoverflow (-5)
- _e_(e_execstackoverflow, "execstackoverflow")
#define e_interrupt (-6)
/* We also need to define gs_error_interrupt, for gpcheck.h. */
#undef gs_error_interrupt
#define gs_error_interrupt e_interrupt
- _e_(e_interrupt, "interrupt")
#define e_invalidaccess (-7)
- _e_(e_invalidaccess, "invalidaccess")
#define e_invalidexit (-8)
- _e_(e_invalidexit, "invalidexit")
#define e_invalidfileaccess (-9)
- _e_(e_invalidfileaccess, "invalidfileaccess")
#define e_invalidfont (-10)
- _e_(e_invalidfont, "invalidfont")
#define e_invalidrestore (-11)
- _e_(e_invalidrestore, "invalidrestore")
#define e_ioerror (-12)
- _e_(e_ioerror, "ioerror")
#define e_limitcheck (-13)
- _e_(e_limitcheck, "limitcheck")
#define e_nocurrentpoint (-14)
- _e_(e_nocurrentpoint, "nocurrentpoint")
#define e_rangecheck (-15)
- _e_(e_rangecheck, "rangecheck")
#define e_stackoverflow (-16)
- _e_(e_stackoverflow, "stackoverflow")
#define e_stackunderflow (-17)
- _e_(e_stackunderflow, "stackunderflow")
#define e_syntaxerror (-18)
- _e_(e_syntaxerror, "syntaxerror")
#define e_timeout (-19)
- _e_(e_timeout, "timeout")
#define e_typecheck (-20)
- _e_(e_typecheck, "typecheck")
#define e_undefined (-21)
- _e_(e_undefined, "undefined")
#define e_undefinedfilename (-22)
- _e_(e_undefinedfilename, "undefinedfilename")
#define e_undefinedresult (-23)
- _e_(e_undefinedresult, "undefinedresult")
#define e_unmatchedmark (-24)
- _e_(e_unmatchedmark, "unmatchedmark")
#define e_VMerror (-25)
- _e_(e_VMerror, "VMerror")
+
+#define LEVEL1_ERROR_NAMES\
+ "unknownerror", "dictfull", "dictstackoverflow", "dictstackunderflow",\
+ "execstackoverflow", "interrupt", "invalidaccess", "invalidexit",\
+ "invalidfileaccess", "invalidfont", "invalidrestore", "ioerror",\
+ "limitcheck", "nocurrentpoint", "rangecheck", "stackoverflow",\
+ "stackunderflow", "syntaxerror", "timeout", "typecheck", "undefined",\
+ "undefinedfilename", "undefinedresult", "unmatchedmark", "VMerror"
/* ------ Additional Level 2 and DPS errors ------ */
#define e_configurationerror (-26)
- _e_(e_configurationerror, "configurationerror")
#define e_invalidcontext (-27)
- _e_(e_invalidcontext, "invalidcontext")
#define e_undefinedresource (-28)
- _e_(e_undefinedresource, "undefinedresource")
#define e_unregistered (-29)
- _e_(e_unregistered, "unregistered")
/* invalidid is for the NeXT DPS extension. */
#define e_invalidid (-30)
- _e_(e_invalidid, "invalidid")
-
-# ifdef INCLUDE_ERROR_NAMES
-/* End of error name table */
- 0
-};
+#define LEVEL2_ERROR_NAMES\
+ "configurationerror", "invalidcontext", "undefinedresource",\
+ "unregistered", "invalidid"
-# endif /* INCLUDE_ERROR_NAMES */
+#define ERROR_NAMES LEVEL1_ERROR_NAMES, LEVEL2_ERROR_NAMES
/* ------ Pseudo-errors used internally ------ */
@@ -175,3 +138,5 @@ extern const char _ds *gs_error_names[];
*/
#define error_is_interrupt(ecode)\
((ecode) == e_interrupt || (ecode) == e_timeout)
+
+#endif /* errors_INCLUDED */
diff --git a/gs/src/estack.h b/gs/src/estack.h
index 82f4987b9..859a5853d 100644
--- a/gs/src/estack.h
+++ b/gs/src/estack.h
@@ -1,62 +1,57 @@
-/* Copyright (C) 1989, 1992, 1993, 1994, 1996, 1997 Aladdin Enterprises. All rights reserved.
-
- This file is part of Aladdin Ghostscript.
-
- Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
- or distributor accepts any responsibility for the consequences of using it,
- or for whether it serves any particular purpose or works at all, unless he
- or she says so in writing. Refer to the Aladdin Ghostscript Free Public
- License (the "License") for full details.
-
- Every copy of Aladdin Ghostscript must include a copy of the License,
- normally in a plain ASCII text file named PUBLIC. The License grants you
- the right to copy, modify and redistribute Aladdin Ghostscript, but only
- under certain conditions described in the License. Among other things, the
- License requires that the copyright notice and this notice be preserved on
- all copies.
-*/
-
-/* estack.h */
-/* Definitions for the execution stack */
-#include "istack.h"
+/* Copyright (C) 1989, 1992, 1993, 1994, 1996, 1997, 1998 Aladdin Enterprises. All rights reserved.
-/* Define the execution stack pointers. */
-typedef s_ptr es_ptr;
-typedef const_s_ptr const_es_ptr;
-extern ref_stack e_stack;
-#define esbot (e_stack.bot)
-#define esp (e_stack.p)
-#define estop (e_stack.top)
+ This file is part of Aladdin Ghostscript.
-/*
- * To improve performance, we cache the currentfile pointer
- * (i.e., `shallow-bind' it in Lisp terminology). The invariant is as
- * follows: either esfile points to the currentfile slot on the estack
- * (i.e., the topmost slot with an executable file), or it is 0.
- * To maintain the invariant, it is sufficient that whenever a routine
- * pushes or pops anything on the estack, if the object *might* be
- * an executable file, invoke esfile_clear_cache(); alternatively,
- * immediately after pushing an object, invoke esfile_check_cache().
+ Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
+ or distributor accepts any responsibility for the consequences of using it,
+ or for whether it serves any particular purpose or works at all, unless he
+ or she says so in writing. Refer to the Aladdin Ghostscript Free Public
+ License (the "License") for full details.
+
+ Every copy of Aladdin Ghostscript must include a copy of the License,
+ normally in a plain ASCII text file named PUBLIC. The License grants you
+ the right to copy, modify and redistribute Aladdin Ghostscript, but only
+ under certain conditions described in the License. Among other things, the
+ License requires that the copyright notice and this notice be preserved on
+ all copies.
*/
-extern ref *esfile;
+
+/*Id: estack.h */
+/* Definitions for the execution stack */
+
+#ifndef estack_INCLUDED
+# define estack_INCLUDED
+
+#include "iestack.h"
+
+/* There's only one exec stack right now.... */
+#define esfile (iexec_stack.current_file)
#define esfile_clear_cache() (esfile = 0)
#define esfile_set_cache(pref) (esfile = (pref))
#define esfile_check_cache()\
if ( r_has_type_attrs(esp, t_file, a_executable) )\
esfile_set_cache(esp)
+/* Define the execution stack pointers. */
+extern exec_stack_t iexec_stack;
+
+#define e_stack (iexec_stack.stack)
+#define esbot (e_stack.bot)
+#define esp (e_stack.p)
+#define estop (e_stack.top)
+
/*
* The execution stack is used for three purposes:
*
- * - Procedures being executed are held here. They always have
+ * - Procedures being executed are held here. They always have
* type = t_array, t_mixedarray, or t_shortarray, with a_executable set.
* More specifically, the e-stack holds the as yet unexecuted tail of the
* procedure.
*
- * - if, ifelse, etc. push arguments to be executed here.
+ * - if, ifelse, etc. push arguments to be executed here.
* They may be any kind of object whatever.
*
- * - Control operators (filenameforall, for, repeat, loop, forall,
+ * - Control operators (filenameforall, for, repeat, loop, forall,
* pathforall, run, stopped, ...) mark the stack by pushing whatever state
* they need to save or keep track of and then an object with type = t_null,
* attrs = a_executable, size = es_xxx (see below), and value.opproc = a
@@ -105,10 +100,10 @@ extern ref *esfile;
{ e_stack.requested = (n); return_error(e_ExecStackUnderflow); }
/* Define the various kinds of execution stack marks. */
-#define es_other 0 /* internal use */
-#define es_show 1 /* show operators */
-#define es_for 2 /* iteration operators */
-#define es_stopped 3 /* stopped operator */
+#define es_other 0 /* internal use */
+#define es_show 1 /* show operators */
+#define es_for 2 /* iteration operators */
+#define es_stopped 3 /* stopped operator */
/*
* Pop a given number of elements off the execution stack,
@@ -119,10 +114,11 @@ void pop_estack(P1(uint));
/*
* The execution stack is implemented as a linked list of blocks;
* operators that can push or pop an unbounded number of values, or that
- * access the entire o-stack, must take this into account. These are:
- * exit .stop .instopped countexecstack execstack currentfile
- * pop_estack(exit, stop, error recovery)
- * gs_show_find(all the show operators)
+ * access the entire e-stack, must take this into account. These are:
+ * exit .stop .instopped countexecstack execstack currentfile
+ * .execn
+ * pop_estack(exit, stop, error recovery)
+ * gs_show_find(all the show operators)
* In addition, for e-stack entries created by control operators, we must
* ensure that the mark and its data are never separated. We do this
* by ensuring that when splitting the top block, at least N items
@@ -133,3 +129,5 @@ void pop_estack(P1(uint));
* that contains a procedure that returns an internal "exec stack block
* underflow" error.
*/
+
+#endif /* estack_INCLUDED */
diff --git a/gs/src/files.h b/gs/src/files.h
index 4189f698b..436c1a6ab 100644
--- a/gs/src/files.h
+++ b/gs/src/files.h
@@ -1,30 +1,27 @@
-/* Copyright (C) 1989, 1995, 1996 Aladdin Enterprises. All rights reserved.
-
- This file is part of Aladdin Ghostscript.
-
- Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
- or distributor accepts any responsibility for the consequences of using it,
- or for whether it serves any particular purpose or works at all, unless he
- or she says so in writing. Refer to the Aladdin Ghostscript Free Public
- License (the "License") for full details.
-
- Every copy of Aladdin Ghostscript must include a copy of the License,
- normally in a plain ASCII text file named PUBLIC. The License grants you
- the right to copy, modify and redistribute Aladdin Ghostscript, but only
- under certain conditions described in the License. Among other things, the
- License requires that the copyright notice and this notice be preserved on
- all copies.
-*/
-
-/* files.h */
-/* Common declarations for zfile.c and zfileio.c */
-/* Requires stream.h */
+/* Copyright (C) 1989, 1995, 1996, 1997, 1998 Aladdin Enterprises. All rights reserved.
-/*
- * In many places below, a do {...} while (0) avoids problems with a possible
- * enclosing 'if'.
+ This file is part of Aladdin Ghostscript.
+
+ Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
+ or distributor accepts any responsibility for the consequences of using it,
+ or for whether it serves any particular purpose or works at all, unless he
+ or she says so in writing. Refer to the Aladdin Ghostscript Free Public
+ License (the "License") for full details.
+
+ Every copy of Aladdin Ghostscript must include a copy of the License,
+ normally in a plain ASCII text file named PUBLIC. The License grants you
+ the right to copy, modify and redistribute Aladdin Ghostscript, but only
+ under certain conditions described in the License. Among other things, the
+ License requires that the copyright notice and this notice be preserved on
+ all copies.
*/
+/*Id: files.h */
+/* Requires stream.h */
+
+#ifndef files_INCLUDED
+# define files_INCLUDED
+
/*
* File objects store a pointer to a stream in value.pfile.
* A file object is valid if its "size" matches the read_id or write_id
@@ -42,18 +39,30 @@ int zget_stdin(P1(stream **));
int zget_stdout(P1(stream **));
int zget_stderr(P1(stream **));
extern bool gs_stdin_is_interactive;
+
+/* Export the stdio refs for switching contexts. */
+extern ref ref_stdio[3];
+
+#define ref_stdin ref_stdio[0]
+#define ref_stdout ref_stdio[1]
+#define ref_stderr ref_stdio[2]
/* An invalid (closed) file. */
extern stream *invalid_file_entry;
-/* Macros for checking file validity. */
+/*
+ * Macros for checking file validity.
+ * NOTE: in order to work around a bug in the Borland 5.0 compiler,
+ * you must use file_is_invalid rather than !file_is_valid.
+ */
#define file_is_valid(svar,op)\
(svar = fptr(op), (svar->read_id | svar->write_id) == r_size(op))
+#define file_is_invalid(svar,op)\
+ (svar = fptr(op), (svar->read_id | svar->write_id) != r_size(op))
#define check_file(svar,op)\
- do\
- { check_type(*(op), t_file);\
- if ( !file_is_valid(svar, op) ) return_error(e_invalidaccess);\
- }\
- while (0)
+ BEGIN\
+ check_type(*(op), t_file);\
+ if ( file_is_invalid(svar, op) ) return_error(e_invalidaccess);\
+ END
/*
* If a file is open for both reading and writing, its read_id, write_id,
@@ -61,43 +70,41 @@ extern stream *invalid_file_entry;
* an id check failure will switch it to the other mode.
*/
int file_switch_to_read(P1(const ref *));
+
#define check_read_file(svar,op)\
- do\
- { check_read_type(*(op), t_file);\
- check_read_known_file(svar, op, return);\
- }\
- while (0)
+ BEGIN\
+ check_read_type(*(op), t_file);\
+ check_read_known_file(svar, op, return);\
+ END
#define check_read_known_file(svar,op,error_return)\
check_read_known_file_else(svar, op, error_return, svar = invalid_file_entry)
/* The do... avoids problems with a possible enclosed 'if'. */
#define check_read_known_file_else(svar,op,error_return,invalid_action)\
- do\
- { svar = fptr(op);\
+ BEGIN\
+ svar = fptr(op);\
if ( svar->read_id != r_size(op) )\
{ if ( svar->read_id == 0 && svar->write_id == r_size(op) )\
{ int fcode = file_switch_to_read(op);\
if ( fcode < 0 ) error_return(fcode);\
}\
- else do { invalid_action; } while (0); /* closed or reopened file */\
+ else BEGIN invalid_action; END; /* closed or reopened file */\
}\
- }\
- while (0)
+ END
int file_switch_to_write(P1(const ref *));
+
#define check_write_file(svar,op)\
- do\
- { check_write_type(*(op), t_file);\
- check_write_known_file(svar, op, return);\
- }\
- while (0)
+ BEGIN\
+ check_write_type(*(op), t_file);\
+ check_write_known_file(svar, op, return);\
+ END
#define check_write_known_file(svar,op,error_return)\
- do\
- { svar = fptr(op);\
- if ( svar->write_id != r_size(op) )\
+ BEGIN\
+ svar = fptr(op);\
+ if ( svar->write_id != r_size(op) )\
{ int fcode = file_switch_to_write(op);\
if ( fcode < 0 ) error_return(fcode);\
}\
- }\
- while (0)
+ END
/* Data exported by zfile.c. */
/* for zfilter.c and ziodev.c */
@@ -106,32 +113,39 @@ extern const uint file_default_buffer_size;
/* Procedures exported by zfile.c. */
/* for gs.c */
FILE *lib_fopen(P1(const char *));
+
/* for gsmain.c */
int lib_file_open(P6(const char *, uint, byte *, uint, uint *, ref *));
+
/* for iccinit.c */
int file_read_string(P3(const byte *, uint, ref *));
+
/* for os_open in ziodev.c */
-#ifdef iodev_proc_fopen /* in gxiodev.h */
+#ifdef iodev_proc_fopen /* in gxiodev.h */
int file_open_stream(P6(const char *, uint, const char *, uint,
- stream **, iodev_proc_fopen_t));
+ stream **, iodev_proc_fopen_t));
+
#endif
/* for zfilter.c */
-int filter_open(P6(const char *, uint, ref *, const stream_procs _ds *,
- const stream_template *, const stream_state *));
+int filter_open(P6(const char *, uint, ref *, const stream_procs *,
+ const stream_template *, const stream_state *));
+
/* for zfileio.c */
void make_stream_file(P3(ref *, stream *, const char *));
+
/* for ziodev.c */
int file_close_finish(P1(stream *));
int file_close_disable(P1(stream *));
int file_close_file(P1(stream *));
+
/* for gsmain.c, interp.c */
int file_close(P1(ref *));
- /* for ziodev.c */
+
+ /* for zfproc.c, ziodev.c */
stream *file_alloc_stream(P2(gs_memory_t *, client_name_t));
- /* for isave.c */
-void file_save(P0());
-/*void file_restore(P1(const alloc_save_t *));*/
/* Procedures exported by zfileio.c. */
/* for ziodev.c */
int zreadline_from(P5(stream *, byte *, uint, uint *, bool *));
+
+#endif /* files_INCLUDED */
diff --git a/gs/src/fname.h b/gs/src/fname.h
index c01106dad..871e32e0f 100644
--- a/gs/src/fname.h
+++ b/gs/src/fname.h
@@ -1,33 +1,48 @@
-/* Copyright (C) 1993 Aladdin Enterprises. All rights reserved.
-
- This file is part of Aladdin Ghostscript.
-
- Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
- or distributor accepts any responsibility for the consequences of using it,
- or for whether it serves any particular purpose or works at all, unless he
- or she says so in writing. Refer to the Aladdin Ghostscript Free Public
- License (the "License") for full details.
-
- Every copy of Aladdin Ghostscript must include a copy of the License,
- normally in a plain ASCII text file named PUBLIC. The License grants you
- the right to copy, modify and redistribute Aladdin Ghostscript, but only
- under certain conditions described in the License. Among other things, the
- License requires that the copyright notice and this notice be preserved on
- all copies.
-*/
-
-/* fname.h */
-/* File name parsing interface */
+/* Copyright (C) 1993, 1998 Aladdin Enterprises. All rights reserved.
+
+ This file is part of Aladdin Ghostscript.
+
+ Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
+ or distributor accepts any responsibility for the consequences of using it,
+ or for whether it serves any particular purpose or works at all, unless he
+ or she says so in writing. Refer to the Aladdin Ghostscript Free Public
+ License (the "License") for full details.
+
+ Every copy of Aladdin Ghostscript must include a copy of the License,
+ normally in a plain ASCII text file named PUBLIC. The License grants you
+ the right to copy, modify and redistribute Aladdin Ghostscript, but only
+ under certain conditions described in the License. Among other things, the
+ License requires that the copyright notice and this notice be preserved on
+ all copies.
+ */
+
+/*Id: fname.h */
/* Requires gxiodev.h */
-/* Parsed file name type. Note that the file name may be either a */
-/* gs_string (no terminator) or a C string (null terminator). */
+#ifndef fname_INCLUDED
+# define fname_INCLUDED
+
+/*
+ * Define a structure for representing a parsed file name, consisting of
+ * an IODevice name in %'s, a file name, or both. Note that the file name
+ * may be either a gs_string (no terminator) or a C string (null terminator).
+ */
typedef struct parsed_file_name_s {
- gx_io_device *iodev;
- const char *fname;
- uint len;
+ gx_io_device *iodev;
+ const char *fname;
+ uint len;
} parsed_file_name;
+
+/* Parse a file name into device and individual name. */
int parse_file_name(P2(const ref *, parsed_file_name *));
+
+/* Parse a real (non-device) file name and convert to a C string. */
int parse_real_file_name(P3(const ref *, parsed_file_name *, client_name_t));
+
+/* Convert a file name to a C string by adding a null terminator. */
int terminate_file_name(P2(parsed_file_name *, client_name_t));
+
+/* Free a file name that was copied to a C string. */
void free_file_name(P2(parsed_file_name *, client_name_t));
+
+#endif /* fname_INCLUDED */
diff --git a/gs/src/gconf.c b/gs/src/gconf.c
index f834f6c8c..b0ebf351e 100644
--- a/gs/src/gconf.c
+++ b/gs/src/gconf.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1989, 1995, 1996 Aladdin Enterprises. All rights reserved.
+/* Copyright (C) 1989, 1995, 1996, 1997, 1998 Aladdin Enterprises. All rights reserved.
This file is part of Aladdin Ghostscript.
@@ -16,17 +16,12 @@
all copies.
*/
-/* gconf.c */
+/*Id: gconf.c */
/* Configuration tables */
+#include "memory_.h"
#include "gx.h"
#include "gscdefs.h" /* interface */
-#include "gconfig.h" /* for #defines */
-/*
- * Since we only declare variables of type gx_device *,
- * it should be sufficient to define struct gx_device_s as
- * an abstract (undefined) structure. However, the VAX VMS compiler
- * isn't happy with this, so we have to include the full definition.
- */
+#include "gconf.h" /* for #defines */
#include "gxdevice.h"
#include "gxiodev.h"
@@ -34,8 +29,10 @@
* The makefile generates the file gconfig.h, which consists of
* lines of the form
* device_(gs_xxx_device)
+ * or
+ * device2_(gs_xxx_device)
* for each installed device;
- * emulator_("emulator")
+ * emulator_("emulator", strlen("emulator"))
* for each known emulator;
* init_(gs_xxx_init)
* for each initialization procedure;
@@ -43,7 +40,7 @@
* for each known IODevice;
* oper_(xxx_op_defs)
* for each operator option;
- * psfile_("gs_xxxx.ps")
+ * psfile_("gs_xxxx.ps", strlen("gs_xxxx.ps"))
* for each optional initialization file.
*
* We include this file multiple times to generate various different
@@ -55,18 +52,22 @@
/* Declare devices, init procedures, and IODevices as extern. */
#define device_(dev) extern far_data gx_device dev;
+#define device2_(dev) extern const gx_device dev;
#define init_(proc) extern void proc(P1(gs_memory_t *));
-#define io_device_(iodev) extern gx_io_device iodev;
-#include "gconfig.h"
+#define io_device_(iodev) extern const gx_io_device iodev;
+#include "gconf.h"
#undef init_
#undef io_device_
+#undef device2_
#undef device_
/* Set up the initialization procedure table. */
extern_gx_init_table();
+private void gconf_init(P1(gs_memory_t *));
#define init_(proc) proc,
-void (*gx_init_table[]) (P1(gs_memory_t *)) = {
-#include "gconfig.h"
+const gx_init_proc gx_init_table[] = {
+#include "gconf.h"
+ gconf_init,
0
};
#undef init_
@@ -75,52 +76,42 @@ void (*gx_init_table[]) (P1(gs_memory_t *)) = {
/* since it is the default for files with no explicit device specified. */
extern_gx_io_device_table();
extern gx_io_device gs_iodev_os;
-
#define io_device_(iodev) &iodev,
-gx_io_device *gx_io_device_table[] =
-{
+const gx_io_device *const gx_io_device_table[] = {
&gs_iodev_os,
-#include "gconfig.h"
+#include "gconf.h"
0
};
-
#undef io_device_
-uint gx_io_device_table_count =
-countof(gx_io_device_table) - 1;
+const uint gx_io_device_table_count = countof(gx_io_device_table) - 1;
/* Set up the device table. */
-#define device_(dev) &dev,
- private const gx_device *gx_device_list[] =
- {
-#include "gconfig.h"
+#define device_(dev) (const gx_device *)&dev,
+#define device2_(dev) &dev,
+private const gx_device *const gx_device_list[] = {
+#include "gconf.h"
0
- };
-
+};
+#undef device2_
#undef device_
-/*
- * Allocate structure descriptors for the devices.
- * We can't fill in the structure sizes, because we don't know them
- * statically, and we also don't know statically which devices are
- * forwarders; so we fill all of this in when we need to
- * (in gs_copydevice in gsdevice.c).
- */
-#define device_(dev) { 0 },
-/* Because of a bug in the Borland C++ 4.5 compiler, */
-/* we can't declare the following far_data but not static. */
- static /*private */ far_data gs_memory_struct_type_t gx_device_st_list[] =
- {
-#include "gconfig.h"
- {0}
- };
+/* Allocate and initialize structure descriptors for the devices. */
+private gs_memory_struct_type_t gx_device_st_list[countof(gx_device_list) - 1];
+private void
+gconf_init(gs_memory_t *mem)
+{
+ int i;
-#undef device_
+ for (i = 0; i < countof(gx_device_list) - 1; ++i)
+ gx_device_make_struct_type(&gx_device_st_list[i], gx_device_list[i]);
+}
/* Return the list of device prototypes, the list of their structure */
/* descriptors, and (as the value) the length of the lists. */
extern_gs_lib_device_list();
- int
- gs_lib_device_list(const gx_device *** plist, gs_memory_struct_type_t ** pst)
+int
+gs_lib_device_list(const gx_device * const **plist,
+ gs_memory_struct_type_t ** pst)
{
if (plist != 0)
*plist = gx_device_list;
diff --git a/gs/src/gdebug.h b/gs/src/gdebug.h
index 89b4f61fc..80be76bb1 100644
--- a/gs/src/gdebug.h
+++ b/gs/src/gdebug.h
@@ -1,42 +1,70 @@
-/* Copyright (C) 1989, 1992, 1993, 1994, 1995, 1996, 1997 Aladdin Enterprises. All rights reserved.
-
- This file is part of Aladdin Ghostscript.
-
- Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
- or distributor accepts any responsibility for the consequences of using it,
- or for whether it serves any particular purpose or works at all, unless he
- or she says so in writing. Refer to the Aladdin Ghostscript Free Public
- License (the "License") for full details.
-
- Every copy of Aladdin Ghostscript must include a copy of the License,
- normally in a plain ASCII text file named PUBLIC. The License grants you
- the right to copy, modify and redistribute Aladdin Ghostscript, but only
- under certain conditions described in the License. Among other things, the
- License requires that the copyright notice and this notice be preserved on
- all copies.
-*/
+/* Copyright (C) 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998 Aladdin Enterprises. All rights reserved.
-/* gdebug.h */
+ This file is part of Aladdin Ghostscript.
+
+ Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
+ or distributor accepts any responsibility for the consequences of using it,
+ or for whether it serves any particular purpose or works at all, unless he
+ or she says so in writing. Refer to the Aladdin Ghostscript Free Public
+ License (the "License") for full details.
+
+ Every copy of Aladdin Ghostscript must include a copy of the License,
+ normally in a plain ASCII text file named PUBLIC. The License grants you
+ the right to copy, modify and redistribute Aladdin Ghostscript, but only
+ under certain conditions described in the License. Among other things, the
+ License requires that the copyright notice and this notice be preserved on
+ all copies.
+ */
+
+/*Id: gdebug.h */
/* Debugging machinery definitions */
#ifndef gdebug_INCLUDED
# define gdebug_INCLUDED
+/*
+ * The compile-time DEBUG symbol determines whether debugging/tracing
+ * code is included in the compiled code. DEBUG may be set or not set
+ * independently for every compilation; however, a small amount of support
+ * machinery in gsmisc.c is always included in the executable, just
+ * in case *some* file was compiled with DEBUG set.
+ *
+ * When DEBUG is set, it does not cause debugging/tracing printout to occur.
+ * Rather, it includes code that produces such printout *if* (a) given
+ * one(s) of 128 debugging flags is set. In this way, one can selectively
+ * turn printout on and off during debugging. (In fact, we even provide a
+ * PostScript operator, .setdebug, that does this.)
+ *
+ * The debugging flags are normally indexed by character code. This is more
+ * than a convention: gs_debug_c, which tests whether a given flag is set,
+ * considers that if a flag named by a given upper-case letter is set, the
+ * flag named by the corresponding lower-case letter is also set.
+ *
+ * If the output selected by a given flag can be printed by a single
+ * printf, the conventional way to produce the output is
+ * if_debugN('x', "...format...", v1, ..., vN);
+ * Usually the flag appears in the output explicitly:
+ * if_debugN('x', "[x]...format...", v1, ..., vN);
+ * If the output is more complex, the conventional way to produce the
+ * output is
+ * if ( gs_debug_c('x') ) {
+ * ... start each line with dlprintfN(...)
+ * ... produce additional output within a line with dprintfN(...)
+ * } */
+
/* Define the array of debugging flags, indexed by character code. */
extern char gs_debug[128];
-#define gs_debug_c(c)\
- ((c)>='a' && (c)<='z' ? gs_debug[c] | gs_debug[(c)^32] : gs_debug[c])
-#ifdef DEBUG
-# define gs_if_debug_c(c) gs_debug_c(c)
-#else
-# define gs_if_debug_c(c) 0
-#endif
-/* Define an alias for a specialized debugging flag */
-/* that used to be a separate variable. */
+bool gs_debug_c(P1(int /*char */ ));
+
+/*
+ * Define an alias for a specialized debugging flag
+ * that used to be a separate variable.
+ */
#define gs_log_errors gs_debug['#']
/* If debugging, direct all error output to gs_debug_out. */
extern FILE *gs_debug_out;
+
#ifdef DEBUG
#undef dstderr
#define dstderr gs_debug_out
@@ -44,49 +72,34 @@ extern FILE *gs_debug_out;
#define estderr gs_debug_out
#endif
-/* Redefine eprintf_program_name and lprintf_file_and_line as procedures */
-/* so one can set breakpoints on them. */
-#undef eprintf_program_name
-extern void eprintf_program_name(P2(FILE *, const char *));
-#undef lprintf_file_and_line
-extern void lprintf_file_and_line(P3(FILE *, const char *, int));
-
-/* Insert code conditionally if debugging. */
-#ifdef DEBUG
-# define do_debug(x) x
-#else
-# define do_debug(x)
-#endif
-
/* Debugging printout macros. */
-/* The do...while construct is to avoid capturing a following 'else'. */
#ifdef DEBUG
# define if_debug0(c,s)\
- do { if (gs_debug_c(c)) dprintf(s); } while (0)
+ BEGIN if (gs_debug_c(c)) dlprintf(s); END
# define if_debug1(c,s,a1)\
- do { if (gs_debug_c(c)) dprintf1(s,a1); } while (0)
+ BEGIN if (gs_debug_c(c)) dlprintf1(s,a1); END
# define if_debug2(c,s,a1,a2)\
- do { if (gs_debug_c(c)) dprintf2(s,a1,a2); } while (0)
+ BEGIN if (gs_debug_c(c)) dlprintf2(s,a1,a2); END
# define if_debug3(c,s,a1,a2,a3)\
- do { if (gs_debug_c(c)) dprintf3(s,a1,a2,a3); } while (0)
+ BEGIN if (gs_debug_c(c)) dlprintf3(s,a1,a2,a3); END
# define if_debug4(c,s,a1,a2,a3,a4)\
- do { if (gs_debug_c(c)) dprintf4(s,a1,a2,a3,a4); } while (0)
+ BEGIN if (gs_debug_c(c)) dlprintf4(s,a1,a2,a3,a4); END
# define if_debug5(c,s,a1,a2,a3,a4,a5)\
- do { if (gs_debug_c(c)) dprintf5(s,a1,a2,a3,a4,a5); } while (0)
+ BEGIN if (gs_debug_c(c)) dlprintf5(s,a1,a2,a3,a4,a5); END
# define if_debug6(c,s,a1,a2,a3,a4,a5,a6)\
- do { if (gs_debug_c(c)) dprintf6(s,a1,a2,a3,a4,a5,a6); } while (0)
+ BEGIN if (gs_debug_c(c)) dlprintf6(s,a1,a2,a3,a4,a5,a6); END
# define if_debug7(c,s,a1,a2,a3,a4,a5,a6,a7)\
- do { if (gs_debug_c(c)) dprintf7(s,a1,a2,a3,a4,a5,a6,a7); } while (0)
+ BEGIN if (gs_debug_c(c)) dlprintf7(s,a1,a2,a3,a4,a5,a6,a7); END
# define if_debug8(c,s,a1,a2,a3,a4,a5,a6,a7,a8)\
- do { if (gs_debug_c(c)) dprintf8(s,a1,a2,a3,a4,a5,a6,a7,a8); } while (0)
+ BEGIN if (gs_debug_c(c)) dlprintf8(s,a1,a2,a3,a4,a5,a6,a7,a8); END
# define if_debug9(c,s,a1,a2,a3,a4,a5,a6,a7,a8,a9)\
- do { if (gs_debug_c(c)) dprintf9(s,a1,a2,a3,a4,a5,a6,a7,a8,a9); } while (0)
+ BEGIN if (gs_debug_c(c)) dlprintf9(s,a1,a2,a3,a4,a5,a6,a7,a8,a9); END
# define if_debug10(c,s,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10)\
- do { if (gs_debug_c(c)) dprintf10(s,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10); } while (0)
+ BEGIN if (gs_debug_c(c)) dlprintf10(s,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10); END
# define if_debug11(c,s,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11)\
- do { if (gs_debug_c(c)) dprintf11(s,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11); } while (0)
+ BEGIN if (gs_debug_c(c)) dlprintf11(s,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11); END
# define if_debug12(c,s,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12)\
- do { if (gs_debug_c(c)) dprintf12(s,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12); } while (0)
+ BEGIN if (gs_debug_c(c)) dlprintf12(s,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12); END
#else
# define if_debug0(c,s) DO_NOTHING
# define if_debug1(c,s,a1) DO_NOTHING
@@ -104,10 +117,10 @@ extern void lprintf_file_and_line(P3(FILE *, const char *, int));
#endif
/* Debugging support procedures in gsmisc.c */
-void debug_dump_bytes(P3(const byte *from, const byte *to,
+void debug_dump_bytes(P3(const byte * from, const byte * to,
const char *msg));
-void debug_dump_bitmap(P4(const byte *from, uint raster, uint height,
+void debug_dump_bitmap(P4(const byte * from, uint raster, uint height,
const char *msg));
-void debug_print_string(P2(const byte *str, uint len));
+void debug_print_string(P2(const byte * str, uint len));
-#endif /* gdebug_INCLUDED */
+#endif /* gdebug_INCLUDED */
diff --git a/gs/src/gdev3852.c b/gs/src/gdev3852.c
index 60781677b..b237ec9ea 100644
--- a/gs/src/gdev3852.c
+++ b/gs/src/gdev3852.c
@@ -1,30 +1,30 @@
/* Copyright (C) 1989, 1992, 1993, 1996 Aladdin Enterprises. All rights reserved.
-
- This file is part of Aladdin Ghostscript.
-
- Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
- or distributor accepts any responsibility for the consequences of using it,
- or for whether it serves any particular purpose or works at all, unless he
- or she says so in writing. Refer to the Aladdin Ghostscript Free Public
- License (the "License") for full details.
-
- Every copy of Aladdin Ghostscript must include a copy of the License,
- normally in a plain ASCII text file named PUBLIC. The License grants you
- the right to copy, modify and redistribute Aladdin Ghostscript, but only
- under certain conditions described in the License. Among other things, the
- License requires that the copyright notice and this notice be preserved on
- all copies.
- */
+
+ This file is part of Aladdin Ghostscript.
+
+ Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
+ or distributor accepts any responsibility for the consequences of using it,
+ or for whether it serves any particular purpose or works at all, unless he
+ or she says so in writing. Refer to the Aladdin Ghostscript Free Public
+ License (the "License") for full details.
+
+ Every copy of Aladdin Ghostscript must include a copy of the License,
+ normally in a plain ASCII text file named PUBLIC. The License grants you
+ the right to copy, modify and redistribute Aladdin Ghostscript, but only
+ under certain conditions described in the License. Among other things, the
+ License requires that the copyright notice and this notice be preserved on
+ all copies.
+*/
/*
- This driver program created by Kevin M. Gift <kgift@draper.com> in Sept. 1992.
- Modified 3/93 to correct bug in cnt_2prn size.
- Modified 3/93 to dimension page back to 8.5, which seems to
+This driver program created by Kevin M. Gift <kgift@draper.com> in Sept. 1992.
+Modified 3/93 to correct bug in cnt_2prn size.
+Modified 3/93 to dimension page back to 8.5, which seems to
work better than the actual page width of 7.6, ie. it uses
- the full printing width of the printer.
- It was modeled after the V2.4.1 HP Paintjet driver (gdevpjet.c) */
+ the full printing width of the printer.
+ It was modeled after the V2.4.1 HP Paintjet driver (gdevpjet.c) */
-/* gdev3852.c */
+/*Id: gdev3852.c */
/* IBM 3852 JetPrinter color ink jet driver for Ghostscript */
#include "gdevprn.h"
@@ -43,141 +43,145 @@
/* The device descriptor */
private dev_proc_print_page(jetp3852_print_page);
private gx_device_procs jetp3852_procs =
-prn_color_procs(gdev_prn_open, gdev_prn_output_page, gdev_prn_close,
- gdev_pcl_3bit_map_rgb_color, gdev_pcl_3bit_map_color_rgb);
+ prn_color_procs(gdev_prn_open, gdev_prn_output_page, gdev_prn_close,
+ gdev_pcl_3bit_map_rgb_color, gdev_pcl_3bit_map_color_rgb);
gx_device_printer far_data gs_jetp3852_device =
-prn_device(jetp3852_procs, "jetp3852",
- 86, /* width_10ths, 8.6" (?) */
- 110, /* height_10ths, 11" */
- X_DPI, Y_DPI,
- 0.0, 0, 0.0, 0, /* left, bottom, right, top margins */
- 3, jetp3852_print_page);
+ prn_device(jetp3852_procs, "jetp3852",
+ 86, /* width_10ths, 8.6" (?) */
+ 110, /* height_10ths, 11" */
+ X_DPI, Y_DPI,
+ 0.0, 0, 0.0, 0, /* left, bottom, right, top margins */
+ 3, jetp3852_print_page);
/* ------ Internal routines ------ */
/* Send the page to the printer. */
private int
-jetp3852_print_page(gx_device_printer * pdev, FILE * prn_stream)
+jetp3852_print_page(gx_device_printer *pdev, FILE *prn_stream)
{
#define DATA_SIZE (LINE_SIZE * 8)
- unsigned int cnt_2prn;
- unsigned int count, tempcnt;
- unsigned char vtp, cntc1, cntc2;
- int line_size_color_plane;
-
- byte data[DATA_SIZE];
- byte plane_data[LINE_SIZE * 3];
-
- /* Set initial condition for printer */
- fputs("\033@", prn_stream);
-
- /* Send each scan line in turn */
- {
- int lnum;
- int line_size = gdev_mem_bytes_per_scan_line((gx_device *) pdev);
- int num_blank_lines = 0;
-
- for (lnum = 0; lnum < pdev->height; lnum++) {
- byte _ss *end_data = data + line_size;
-
- gdev_prn_copy_scan_lines(pdev, lnum,
- (byte *) data, line_size);
- /* Remove trailing 0s. */
- while (end_data > data && end_data[-1] == 0)
- end_data--;
- if (end_data == data) { /* Blank line */
- num_blank_lines++;
- } else {
- int i;
- byte _ss *odp;
- byte _ss *row;
-
- /* Pad with 0s to fill out the last */
- /* block of 8 bytes. */
- memset(end_data, 0, 7);
-
- /* Transpose the data to get pixel planes. */
- for (i = 0, odp = plane_data; i < DATA_SIZE;
- i += 8, odp++
- ) { /* The following is for 16-bit machines */
+ unsigned int cnt_2prn;
+ unsigned int count,tempcnt;
+ unsigned char vtp,cntc1,cntc2;
+ int line_size_color_plane;
+
+ byte data[DATA_SIZE];
+ byte plane_data[LINE_SIZE * 3];
+
+ /* Set initial condition for printer */
+ fputs("\033@",prn_stream);
+
+ /* Send each scan line in turn */
+ { int lnum;
+ int line_size = gdev_mem_bytes_per_scan_line((gx_device *)pdev);
+ int num_blank_lines = 0;
+ for ( lnum = 0; lnum < pdev->height; lnum++ )
+ { byte _ss *end_data = data + line_size;
+ gdev_prn_copy_scan_lines(pdev, lnum,
+ (byte *)data, line_size);
+ /* Remove trailing 0s. */
+ while ( end_data > data && end_data[-1] == 0 )
+ end_data--;
+ if ( end_data == data )
+ { /* Blank line */
+ num_blank_lines++;
+ }
+ else
+ { int i;
+ byte _ss *odp;
+ byte _ss *row;
+
+ /* Pad with 0s to fill out the last */
+ /* block of 8 bytes. */
+ memset(end_data, 0, 7);
+
+ /* Transpose the data to get pixel planes. */
+ for ( i = 0, odp = plane_data; i < DATA_SIZE;
+ i += 8, odp++
+ )
+ { /* The following is for 16-bit machines */
#define spread3(c)\
{ 0, c, c*0x100, c*0x101, c*0x10000L, c*0x10001L, c*0x10100L, c*0x10101L }
- static ulong spr40[8] = spread3(0x40);
- static ulong spr8[8] = spread3(8);
- static ulong spr2[8] = spread3(2);
- register byte _ss *dp = data + i;
- register ulong pword =
- (spr40[dp[0]] << 1) +
- (spr40[dp[1]]) +
- (spr40[dp[2]] >> 1) +
- (spr8[dp[3]] << 1) +
- (spr8[dp[4]]) +
- (spr8[dp[5]] >> 1) +
- (spr2[dp[6]]) +
- (spr2[dp[7]] >> 1);
-
- odp[0] = (byte) (pword >> 16);
- odp[LINE_SIZE] = (byte) (pword >> 8);
- odp[LINE_SIZE * 2] = (byte) (pword);
- }
- /* Skip blank lines if any */
- if (num_blank_lines > 0) {
- if (lnum == 0) { /* Skip down the page from the top */
- /* set line spacing = 1/8 inch */
- fputs("\0330", prn_stream);
- /* Set vertical tab */
- vtp = (num_blank_lines / 8);
- fprintf(prn_stream, "\033B%c\000", vtp);
- /* Do vertical tab */
- fputs("\013", prn_stream);
- num_blank_lines = 0;
- } else { /* Do "dot skips" */
- while (num_blank_lines > 255) {
- fputs("\033e\377", prn_stream);
- num_blank_lines -= 255;
- }
- vtp = num_blank_lines;
- fprintf(prn_stream, "\033e%c", vtp);
- num_blank_lines = 0;
- }
- }
- /* Transfer raster graphics in the order R, G, B. */
- /* Apparently it is stored in B, G, R */
- /* Calculate the amount of data to send by what */
- /* Ghostscript tells us the scan line_size in (bytes) */
-
- count = line_size / 3;
- line_size_color_plane = count / 3;
- cnt_2prn = line_size_color_plane * 3 + 5;
- tempcnt = cnt_2prn;
- cntc1 = (tempcnt & 0xFF00) >> 8;
- cntc2 = (tempcnt & 0x00FF);
- fprintf(prn_stream, "\033[O%c%c\200\037", cntc2, cntc1);
- fputc('\000', prn_stream);
- fputs("\124\124", prn_stream);
-
- for (row = plane_data + LINE_SIZE * 2, i = 0;
- i < 3; row -= LINE_SIZE, i++) {
- int jj;
- byte ctemp;
-
- odp = row;
- /* Complement bytes */
- for (jj = 0; jj < line_size_color_plane; jj++) {
- ctemp = *odp;
- *odp++ = ~ctemp;
- }
- fwrite(row, sizeof(byte),
- line_size_color_plane, prn_stream);
- }
- }
- }
- }
-
- /* eject page */
- fputs("\014", prn_stream);
-
- return 0;
+ static ulong spr40[8] = spread3(0x40);
+ static ulong spr8[8] = spread3(8);
+ static ulong spr2[8] = spread3(2);
+ register byte _ss *dp = data + i;
+ register ulong pword =
+ (spr40[dp[0]] << 1) +
+ (spr40[dp[1]]) +
+ (spr40[dp[2]] >> 1) +
+ (spr8[dp[3]] << 1) +
+ (spr8[dp[4]]) +
+ (spr8[dp[5]] >> 1) +
+ (spr2[dp[6]]) +
+ (spr2[dp[7]] >> 1);
+ odp[0] = (byte)(pword >> 16);
+ odp[LINE_SIZE] = (byte)(pword >> 8);
+ odp[LINE_SIZE*2] = (byte)(pword);
+ }
+ /* Skip blank lines if any */
+ if ( num_blank_lines > 0 )
+ {
+ if (lnum == 0)
+ { /* Skip down the page from the top */
+ /* set line spacing = 1/8 inch */
+ fputs("\0330",prn_stream);
+ /* Set vertical tab */
+ vtp = (num_blank_lines / 8);
+ fprintf(prn_stream,"\033B%c\000",vtp);
+ /* Do vertical tab */
+ fputs("\013",prn_stream);
+ num_blank_lines = 0;
+ }
+ else
+ { /* Do "dot skips" */
+ while(num_blank_lines > 255)
+ {
+ fputs("\033e\377",prn_stream);
+ num_blank_lines -= 255;
+ }
+ vtp = num_blank_lines;
+ fprintf(prn_stream,"\033e%c",vtp);
+ num_blank_lines = 0;
+ }
+ }
+
+ /* Transfer raster graphics in the order R, G, B. */
+ /* Apparently it is stored in B, G, R */
+ /* Calculate the amount of data to send by what */
+ /* Ghostscript tells us the scan line_size in (bytes) */
+
+ count = line_size / 3;
+ line_size_color_plane = count / 3;
+ cnt_2prn = line_size_color_plane * 3 + 5;
+ tempcnt = cnt_2prn;
+ cntc1 = (tempcnt & 0xFF00) >> 8;
+ cntc2 = (tempcnt & 0x00FF);
+ fprintf(prn_stream, "\033[O%c%c\200\037",cntc2,cntc1);
+ fputc('\000',prn_stream);
+ fputs("\124\124",prn_stream);
+
+ for ( row = plane_data + LINE_SIZE * 2, i = 0;
+ i < 3; row -= LINE_SIZE, i++ )
+ { int jj;
+ byte ctemp;
+ odp = row;
+ /* Complement bytes */
+ for (jj=0; jj< line_size_color_plane; jj++)
+ { ctemp = *odp;
+ *odp++ = ~ctemp;
+ }
+ fwrite(row, sizeof(byte),
+ line_size_color_plane, prn_stream);
+ }
+ }
+ }
+ }
+
+ /* eject page */
+ fputs("\014", prn_stream);
+
+ return 0;
}
diff --git a/gs/src/gdev3b1.c b/gs/src/gdev3b1.c
index e058d4ec2..cda21b4a5 100644
--- a/gs/src/gdev3b1.c
+++ b/gs/src/gdev3b1.c
@@ -1,24 +1,23 @@
/* Copyright (C) 1992, 1994 Aladdin Enterprises. All rights reserved.
-
- This file is part of Aladdin Ghostscript.
-
- Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
- or distributor accepts any responsibility for the consequences of using it,
- or for whether it serves any particular purpose or works at all, unless he
- or she says so in writing. Refer to the Aladdin Ghostscript Free Public
- License (the "License") for full details.
-
- Every copy of Aladdin Ghostscript must include a copy of the License,
- normally in a plain ASCII text file named PUBLIC. The License grants you
- the right to copy, modify and redistribute Aladdin Ghostscript, but only
- under certain conditions described in the License. Among other things, the
- License requires that the copyright notice and this notice be preserved on
- all copies.
- */
-
+
+ This file is part of Aladdin Ghostscript.
+
+ Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
+ or distributor accepts any responsibility for the consequences of using it,
+ or for whether it serves any particular purpose or works at all, unless he
+ or she says so in writing. Refer to the Aladdin Ghostscript Free Public
+ License (the "License") for full details.
+
+ Every copy of Aladdin Ghostscript must include a copy of the License,
+ normally in a plain ASCII text file named PUBLIC. The License grants you
+ the right to copy, modify and redistribute Aladdin Ghostscript, but only
+ under certain conditions described in the License. Among other things, the
+ License requires that the copyright notice and this notice be preserved on
+ all copies.
+*/
+
+/*Id: gdev3b1.c */
/*
- * gdev3b1.c
- *
* This is a driver for the AT&T 3b1/7300/UnixPC console display.
*
* The image is built in a buffer the size of the page. Once complete,
@@ -69,16 +68,15 @@
typedef struct gx_device_att3b1_s {
gx_device_common;
- int fd; /* window file descriptor */
- uchar *screen; /* pointer to screen image */
- ushort line_size; /* size of screen line in bytes */
- ulong screen_size; /* size of screen image in bytes */
- int page_num; /* page number */
+ int fd; /* window file descriptor */
+ uchar *screen; /* pointer to screen image */
+ ushort line_size; /* size of screen line in bytes */
+ ulong screen_size; /* size of screen image in bytes */
+ int page_num; /* page number */
#ifdef ATT3B1_PERF
char *no_output, *no_fill, *no_copy;
#endif
} gx_device_att3b1;
-
#define att3b1dev ((gx_device_att3b1 *)dev)
#define XDPI 100 /* to get a more-or-less square aspect ratio */
@@ -86,31 +84,29 @@ typedef struct gx_device_att3b1_s {
#define XSIZE (8.5 * XDPI) /* 8.5 x 11 inch page, by default */
#define YSIZE (11 * YDPI)
-static const ushort masks[] =
-{0,
- 0x0001, 0x0003, 0x0007, 0x000f,
- 0x001f, 0x003f, 0x007f, 0x00ff,
- 0x01ff, 0x03ff, 0x07ff, 0x0fff,
- 0x1fff, 0x3fff, 0x7fff, 0xffff,
+static const ushort masks[] = { 0,
+ 0x0001, 0x0003, 0x0007, 0x000f,
+ 0x001f, 0x003f, 0x007f, 0x00ff,
+ 0x01ff, 0x03ff, 0x07ff, 0x0fff,
+ 0x1fff, 0x3fff, 0x7fff, 0xffff,
};
-static uchar reverse_bits[256] =
-{
- 0, 128, 64, 192, 32, 160, 96, 224, 16, 144, 80, 208, 48, 176, 112, 240,
- 8, 136, 72, 200, 40, 168, 104, 232, 24, 152, 88, 216, 56, 184, 120, 248,
- 4, 132, 68, 196, 36, 164, 100, 228, 20, 148, 84, 212, 52, 180, 116, 244,
- 12, 140, 76, 204, 44, 172, 108, 236, 28, 156, 92, 220, 60, 188, 124, 252,
- 2, 130, 66, 194, 34, 162, 98, 226, 18, 146, 82, 210, 50, 178, 114, 242,
- 10, 138, 74, 202, 42, 170, 106, 234, 26, 154, 90, 218, 58, 186, 122, 250,
- 6, 134, 70, 198, 38, 166, 102, 230, 22, 150, 86, 214, 54, 182, 118, 246,
- 14, 142, 78, 206, 46, 174, 110, 238, 30, 158, 94, 222, 62, 190, 126, 254,
- 1, 129, 65, 193, 33, 161, 97, 225, 17, 145, 81, 209, 49, 177, 113, 241,
- 9, 137, 73, 201, 41, 169, 105, 233, 25, 153, 89, 217, 57, 185, 121, 249,
- 5, 133, 69, 197, 37, 165, 101, 229, 21, 149, 85, 213, 53, 181, 117, 245,
- 13, 141, 77, 205, 45, 173, 109, 237, 29, 157, 93, 221, 61, 189, 125, 253,
- 3, 131, 67, 195, 35, 163, 99, 227, 19, 147, 83, 211, 51, 179, 115, 243,
- 11, 139, 75, 203, 43, 171, 107, 235, 27, 155, 91, 219, 59, 187, 123, 251,
- 7, 135, 71, 199, 39, 167, 103, 231, 23, 151, 87, 215, 55, 183, 119, 247,
- 15, 143, 79, 207, 47, 175, 111, 239, 31, 159, 95, 223, 63, 191, 127, 255
+static uchar reverse_bits[256] = {
+ 0, 128, 64, 192, 32, 160, 96, 224, 16, 144, 80, 208, 48, 176, 112, 240,
+ 8, 136, 72, 200, 40, 168, 104, 232, 24, 152, 88, 216, 56, 184, 120, 248,
+ 4, 132, 68, 196, 36, 164, 100, 228, 20, 148, 84, 212, 52, 180, 116, 244,
+ 12, 140, 76, 204, 44, 172, 108, 236, 28, 156, 92, 220, 60, 188, 124, 252,
+ 2, 130, 66, 194, 34, 162, 98, 226, 18, 146, 82, 210, 50, 178, 114, 242,
+ 10, 138, 74, 202, 42, 170, 106, 234, 26, 154, 90, 218, 58, 186, 122, 250,
+ 6, 134, 70, 198, 38, 166, 102, 230, 22, 150, 86, 214, 54, 182, 118, 246,
+ 14, 142, 78, 206, 46, 174, 110, 238, 30, 158, 94, 222, 62, 190, 126, 254,
+ 1, 129, 65, 193, 33, 161, 97, 225, 17, 145, 81, 209, 49, 177, 113, 241,
+ 9, 137, 73, 201, 41, 169, 105, 233, 25, 153, 89, 217, 57, 185, 121, 249,
+ 5, 133, 69, 197, 37, 165, 101, 229, 21, 149, 85, 213, 53, 181, 117, 245,
+ 13, 141, 77, 205, 45, 173, 109, 237, 29, 157, 93, 221, 61, 189, 125, 253,
+ 3, 131, 67, 195, 35, 163, 99, 227, 19, 147, 83, 211, 51, 179, 115, 243,
+ 11, 139, 75, 203, 43, 171, 107, 235, 27, 155, 91, 219, 59, 187, 123, 251,
+ 7, 135, 71, 199, 39, 167, 103, 231, 23, 151, 87, 215, 55, 183, 119, 247,
+ 15, 143, 79, 207, 47, 175, 111, 239, 31, 159, 95, 223, 63, 191, 127, 255
};
dev_proc_open_device(att3b1_open);
@@ -119,8 +115,7 @@ dev_proc_fill_rectangle(att3b1_fill_rectangle);
dev_proc_copy_mono(att3b1_copy_mono);
dev_proc_output_page(att3b1_output_page);
-private gx_device_procs att3b1_procs =
-{
+private gx_device_procs att3b1_procs = {
att3b1_open,
gx_default_get_initial_matrix,
gx_default_sync_output,
@@ -136,11 +131,10 @@ private gx_device_procs att3b1_procs =
gx_default_get_bits
};
-gx_device_att3b1 gs_att3b1_device =
-{
+gx_device_att3b1 gs_att3b1_device = {
std_device_std_body(gx_device_att3b1, &att3b1_procs, "att3b1",
- XSIZE, YSIZE, XDPI, YDPI),
- {0}, /* std_procs */
+ XSIZE, YSIZE, XDPI, YDPI),
+ { 0 }, /* std_procs */
-1, 0, 0, /* fd, screen, line_size, */
0, 0, /* screen size, page */
#ifdef ATT3B1_PERF
@@ -149,30 +143,32 @@ gx_device_att3b1 gs_att3b1_device =
};
int
-att3b1_open(gx_device * dev)
+att3b1_open(gx_device *dev)
{
struct uwdata uw;
#ifdef ATT3B1_PERF
char *getenv(const char *);
-
#endif
if (att3b1dev->fd >= 0) {
close(att3b1dev->fd);
att3b1dev->fd = -1;
}
+
if (att3b1dev->screen != NULL) {
gs_free((char *)att3b1dev->screen,
att3b1dev->screen_size, 1, "att3b1_open");
att3b1dev->screen = 0;
att3b1dev->screen_size = 0;
}
+
att3b1dev->fd = open("/dev/tty", 2);
if (att3b1dev->fd < 0) {
lprintf1("att3b1_open: open /dev/tty failed [%d]\n", errno);
return_error(gs_error_ioerror);
}
+
/* Verify that /dev/tty is associated with a console window. */
if (ioctl(att3b1dev->fd, WIOCGETD, &uw) < 0) {
lprintf1("att3b1_open: can not obtain window data [%d]\n", errno);
@@ -180,16 +176,18 @@ att3b1_open(gx_device * dev)
att3b1_close(dev);
return_error(gs_error_ioerror);
}
+
/* we need an even number of bytes per line */
att3b1dev->line_size = ((att3b1dev->width + 15) / 16) * 2;
att3b1dev->screen_size = att3b1dev->line_size * att3b1dev->height;
att3b1dev->screen =
- (uchar *) gs_malloc(att3b1dev->screen_size, 1, "att3b1_open");
+ (uchar *)gs_malloc(att3b1dev->screen_size, 1, "att3b1_open");
if (att3b1dev->screen == NULL) {
att3b1_close(dev);
return_error(gs_error_VMerror);
}
+
att3b1dev->page_num = 1;
#ifdef ATT3B1_PERF
@@ -202,45 +200,46 @@ att3b1_open(gx_device * dev)
}
int
-att3b1_close(gx_device * dev)
+att3b1_close(gx_device *dev)
{
if (att3b1dev->fd >= 0) {
close(att3b1dev->fd);
att3b1dev->fd = -1;
}
+
if (att3b1dev->screen != NULL) {
gs_free((char *)att3b1dev->screen,
att3b1dev->screen_size, 1, "att3b1_close");
att3b1dev->screen = 0;
att3b1dev->screen_size = 0;
}
+
return 0;
}
int
-att3b1_fill_rectangle(gx_device * dev, int x, int y, int w, int h,
- gx_color_index colour)
+att3b1_fill_rectangle(gx_device *dev, int x, int y, int w, int h,
+ gx_color_index colour)
{
uint o, b, wl, wr, w2;
ushort *p, *q, maskl, maskr;
#ifdef ATT3B1_PERF
- if (att3b1dev->no_fill)
- return 0;
+ if (att3b1dev->no_fill) return 0;
#endif
fit_fill(dev, x, y, w, h);
/* following fit_fill, we can assume x, y, w, h are unsigned. */
- p = (ushort *) & att3b1dev->screen[(ushort) y * att3b1dev->line_size] +
- (uint) x / 16;
- o = (uint) x % 16;
+ p = (ushort *)&att3b1dev->screen[(ushort)y*att3b1dev->line_size] +
+ (uint)x/16;
+ o = (uint)x % 16;
b = 16 - o;
- wl = ((uint) w < b) ? (uint) w : b;
+ wl = ((uint)w < b) ? (uint)w : b;
maskl = masks[wl] << o;
w -= wl;
- wr = (uint) w % 16;
+ wr = (uint)w % 16;
maskr = masks[wr];
if (colour == 0) {
@@ -257,7 +256,8 @@ att3b1_fill_rectangle(gx_device * dev, int x, int y, int w, int h,
*q &= maskr;
p += (att3b1dev->line_size / 2);
}
- } else {
+ }
+ else {
while (h-- > 0) {
q = p;
w2 = w;
@@ -283,9 +283,9 @@ att3b1_fill_rectangle(gx_device * dev, int x, int y, int w, int h,
#endif
int
-att3b1_copy_mono(gx_device * dev, const uchar * data,
+att3b1_copy_mono(gx_device *dev, const uchar *data,
int data_x, int raster, gx_bitmap_id id,
- int x, int y, int width, int height,
+ int x, int y, int width, int height,
gx_color_index colour0, gx_color_index colour1)
{
const ushort *src_p, *src_q;
@@ -295,11 +295,10 @@ att3b1_copy_mono(gx_device * dev, const uchar * data,
uint w1, w2;
#ifdef ATT3B1_PERF
- if (att3b1dev->no_copy)
- return 0;
+ if (att3b1dev->no_copy) return 0;
#endif
- if (colour1 == colour0) /* vacuous case */
+ if (colour1 == colour0) /* vacuous case */
return att3b1_fill_rectangle(dev, x, y, width, height, colour0);
fit_copy(dev, data, data_x, raster, id, x, y, width, height);
@@ -310,16 +309,16 @@ att3b1_copy_mono(gx_device * dev, const uchar * data,
* In what follows, we're assuming that each row of the input bitmap
* is short-aligned, that is, that both "data" and "raster" are even.
*/
- src_p = ((const ushort *)data) + (uint) data_x / 16;
- src_o = (uint) data_x % 16;
+ src_p = ((const ushort *)data) + (uint)data_x/16;
+ src_o = (uint)data_x % 16;
src_b = 16 - src_o;
- dst_p = (ushort *) & att3b1dev->screen[(ushort) y * att3b1dev->line_size] +
- (uint) x / 16;
- dst_o = (uint) x % 16;
+ dst_p = (ushort *)&att3b1dev->screen[(ushort)y*att3b1dev->line_size] +
+ (uint)x/16;
+ dst_o = (uint)x % 16;
dst_b = 16 - dst_o;
- op = (int)colour0 *3 + (int)colour1 + 4;
+ op = (int)colour0 * 3 + (int)colour1 + 4;
while (height-- > 0) {
w2 = width;
@@ -337,52 +336,52 @@ att3b1_copy_mono(gx_device * dev, const uchar * data,
if (src_o == 0)
bits = *src_q++;
else {
- bits = *((ulong *) src_q) >> src_b;
+ bits = *((ulong *)src_q) >> src_b;
bits &= 0xffff;
src_q++;
}
if (w1 <= 8)
- bits = reverse_bits[bits >> 8];
+ bits = reverse_bits[bits>>8];
else
- bits = (reverse_bits[bits & 0xff] << 8) | reverse_bits[bits >> 8];
+ bits = (reverse_bits[bits&0xff] << 8) | reverse_bits[bits>>8];
/*
* While the input bit map is assumed to be typically aligned, we
* assume that the place in the image is not. Thus we don't
* separate out the aligned case. Doing so would cost a test,
* and only reduce the average shift by about 1.
*/
- p = (ulong *) dst_q;
- switch (op) {
- case 1: /* not src and dst */
- bits = ~(bits & mask);
- rotate(bits, dst_b);
- *p &= bits;
- break;
- case 2: /* src or dst */
- bits = bits & mask;
- rotate(bits, dst_b);
- *p |= bits;
- break;
- case 3: /* src and dst */
- bits = bits | ~mask;
- rotate(bits, dst_b);
- *p &= bits;
- break;
- case 5: /* src */
- rotate(bits, dst_b);
- rotate(mask, dst_b);
- *p = (*p & ~mask) | (bits & mask);
- break;
- case 6: /* not src or dst */
- bits = ~bits & mask;
- rotate(bits, dst_b);
- *p |= bits;
- break;
- case 7: /* not src */
- rotate(bits, dst_b);
- rotate(mask, dst_b);
- *p = (*p & ~mask) | (~bits & mask);
- break;
+ p = (ulong *)dst_q;
+ switch(op) {
+ case 1: /* not src and dst */
+ bits = ~(bits & mask);
+ rotate(bits,dst_b);
+ *p &= bits;
+ break;
+ case 2: /* src or dst */
+ bits = bits & mask;
+ rotate(bits,dst_b);
+ *p |= bits;
+ break;
+ case 3: /* src and dst */
+ bits = bits | ~mask;
+ rotate(bits,dst_b);
+ *p &= bits;
+ break;
+ case 5: /* src */
+ rotate(bits,dst_b);
+ rotate(mask,dst_b);
+ *p = (*p & ~mask) | (bits & mask);
+ break;
+ case 6: /* not src or dst */
+ bits = ~bits & mask;
+ rotate(bits,dst_b);
+ *p |= bits;
+ break;
+ case 7: /* not src */
+ rotate(bits,dst_b);
+ rotate(mask,dst_b);
+ *p = (*p & ~mask) | (~bits & mask);
+ break;
}
dst_q++;
w2 -= w1;
@@ -397,13 +396,12 @@ att3b1_copy_mono(gx_device * dev, const uchar * data,
static int getKeyboard(gx_device *);
-const char *help_msg[] =
-{
+const char *help_msg[] = {
"h, j, k, l, UP, DOWN, LEFT, RIGHT move the page (0.25\" h, 0.5\" v)",
"H, J, K, L, BEG, END move to far edge of the page",
"^U, ^D, ROLL UP, ROLL DOWN scroll up or down (1/2 screen height)",
"^F, ^B, PAGE UP, PAGE DOWN scroll up or down (full screen height)",
- "c, C centre page horizontally, vertically",
+ "c, C centre page horizontally, vertically",
"<, >, ^, _ fine movements (single pixel)",
"^L, ^R, r, HOME move to default position",
"=, MARK make current position the default",
@@ -414,7 +412,7 @@ const char *help_msg[] =
};
static void
-do_help(gx_device * dev)
+do_help(gx_device *dev)
{
int i;
struct utdata ut;
@@ -423,7 +421,7 @@ do_help(gx_device * dev)
write(att3b1dev->fd, "\033[2J\033[H", 7);
/* write help screen */
- for (i = 0; i < sizeof(help_msg) / sizeof(help_msg[0]); ++i) {
+ for (i=0; i < sizeof(help_msg)/sizeof(help_msg[0]); ++i) {
write(att3b1dev->fd, help_msg[i], strlen(help_msg[i]));
write(att3b1dev->fd, "\n", 1);
}
@@ -439,7 +437,7 @@ do_help(gx_device * dev)
}
int
-att3b1_output_page(gx_device * dev, int num_copies, int flush)
+att3b1_output_page(gx_device *dev, int num_copies, int flush)
{
struct urdata ur;
struct utdata ut, ut_orig;
@@ -456,8 +454,7 @@ att3b1_output_page(gx_device * dev, int num_copies, int flush)
ushort save_image[WINWIDTH * WINHEIGHT / 16];
#ifdef ATT3B1_PERF
- if (att3b1dev->no_output)
- return 0;
+ if (att3b1dev->no_output) return 0;
#endif
/*
@@ -466,10 +463,11 @@ att3b1_output_page(gx_device * dev, int num_copies, int flush)
if (ioctl(att3b1dev->fd, WIOCGETD, &uw) < 0) {
lprintf1("att3b1_output_page: window WIOCGETD ioctl failed [%d]\n",
- errno);
+ errno);
att3b1_close(dev);
return_error(gs_error_ioerror);
}
+
/*
* we assume, henceforth, that screen ioctl calls will succeed
*/
@@ -481,6 +479,7 @@ att3b1_output_page(gx_device * dev, int num_copies, int flush)
uw.uw_uflags = BORDHSCROLL | BORDVSCROLL | BORDHELP | BORDCANCEL;
ioctl(att3b1dev->fd, WIOCSETD, &uw);
}
+
ut_orig.ut_num = WTXTSLK1;
ioctl(att3b1dev->fd, WIOCGETTEXT, &ut_orig);
@@ -510,9 +509,9 @@ att3b1_output_page(gx_device * dev, int num_copies, int flush)
ioctl(att3b1dev->fd, TCSETAF, &new);
screen_width = (uw.uw_width < att3b1dev->width) ? uw.uw_width
- : att3b1dev->width;
+ : att3b1dev->width;
screen_height = (uw.uw_height < att3b1dev->height) ? uw.uw_height
- : att3b1dev->height;
+ : att3b1dev->height;
write(att3b1dev->fd, "\033[2J", 4);
@@ -531,161 +530,163 @@ att3b1_output_page(gx_device * dev, int num_copies, int flush)
while (1) {
/* Things go bad if ur_srcx >= 2048 */
- ur.ur_srcbase = (ushort *) att3b1dev->screen + (xorigin >> 4);
+ ur.ur_srcbase = (ushort *)att3b1dev->screen + (xorigin >> 4);
ur.ur_srcx = xorigin & 15;
ur.ur_srcy = yorigin;
if (ioctl(att3b1dev->fd, WIOCRASTOP, &ur) < 0) {
lprintf1(
"att3b1_output_page: window WIOCRASTOP ioctl failed [%d]\n",
- errno);
+ errno);
error = gs_error_ioerror;
}
+
ut.ut_num = WTXTSLK1;
sprintf(ut.ut_text,
- "%s %d, top right (%d,%d), size (%d,%d), press '?' for help.",
- flush ? "Showpage" : "Copypage", att3b1dev->page_num, xorigin, yorigin,
- att3b1dev->width, att3b1dev->height);
+ "%s %d, top right (%d,%d), size (%d,%d), press '?' for help.",
+ flush ? "Showpage" : "Copypage", att3b1dev->page_num, xorigin, yorigin,
+ att3b1dev->width, att3b1dev->height);
ioctl(att3b1dev->fd, WIOCSETTEXT, &ut);
ch = error ? 'q' : getKeyboard(dev);
- switch (ch) {
- case 'h':
- xorigin -= ((uint) (int)att3b1dev->x_pixels_per_inch + 3) / 4;
- break;
-
- case 'k':
- yorigin -= ((uint) (int)att3b1dev->y_pixels_per_inch + 1) / 2;
- break;
-
- case 'l':
- xorigin += ((uint) (int)att3b1dev->x_pixels_per_inch + 3) / 4;
- break;
-
- case 'j':
- yorigin += ((uint) (int)att3b1dev->y_pixels_per_inch + 1) / 2;
- break;
-
- case 'H':
- xorigin = 0;
- break;
-
- case 'K':
- yorigin = 0;
- break;
+ switch(ch) {
+ case 'h':
+ xorigin -= ((uint)(int)att3b1dev->x_pixels_per_inch+3)/4;
+ break;
- case 'L':
- xorigin = att3b1dev->width - screen_width;
- break;
+ case 'k':
+ yorigin -= ((uint)(int)att3b1dev->y_pixels_per_inch+1)/2;
+ break;
- case 'J':
- yorigin = att3b1dev->height - screen_height;
- break;
+ case 'l':
+ xorigin += ((uint)(int)att3b1dev->x_pixels_per_inch+3)/4;
+ break;
- case '<':
- xorigin -= 1;
- break;
+ case 'j':
+ yorigin += ((uint)(int)att3b1dev->y_pixels_per_inch+1)/2;
+ break;
- case '>':
- xorigin += 1;
- break;
+ case 'H':
+ xorigin = 0;
+ break;
- case '^':
- yorigin -= 1;
- break;
+ case 'K':
+ yorigin = 0;
+ break;
- case '_':
- yorigin += 1;
- break;
+ case 'L':
+ xorigin = att3b1dev->width - screen_width;
+ break;
+ case 'J':
+ yorigin = att3b1dev->height - screen_height;
+ break;
- case '\025': /* control-U */
- yorigin -= screen_height / 2;
- break;
+ case '<':
+ xorigin -= 1;
+ break;
- case '\004': /* control-D */
- yorigin += screen_height / 2;
- break;
+ case '>':
+ xorigin += 1;
+ break;
- case '\002': /* control-B */
- yorigin -= screen_height;
- break;
+ case '^':
+ yorigin -= 1;
+ break;
- case '\006': /* control-F */
- yorigin += screen_height;
- break;
+ case '_':
+ yorigin += 1;
+ break;
- case '\f':
- case 'r':
- case '\022': /* control-R */
- xorigin = def_xorigin;
- yorigin = def_yorigin;
- break;
+
+ case '\025': /* control-U */
+ yorigin -= screen_height/2;
+ break;
- case 'c': /* centre horizontally */
- xorigin = (att3b1dev->width - screen_width) / 2;
- break;
+ case '\004': /* control-D */
+ yorigin += screen_height/2;
+ break;
- case 'C': /* centre vertically */
- yorigin = (att3b1dev->height - screen_height) / 2;
- break;
+ case '\002': /* control-B */
+ yorigin -= screen_height;
+ break;
- case '=':
- def_xorigin = xorigin;
- def_yorigin = yorigin;
- break;
+ case '\006': /* control-F */
+ yorigin += screen_height;
+ break;
- case 'I':
- for (p = (ushort *) att3b1dev->screen;
- p < (ushort *) & att3b1dev->screen[att3b1dev->screen_size]; ++p)
- *p = ~*p;
- inverted = !inverted;
- break;
+ case '\f':
+ case 'r' :
+ case '\022': /* control-R */
+ xorigin = def_xorigin;
+ yorigin = def_yorigin;
+ break;
+
+ case 'c': /* centre horizontally */
+ xorigin = (att3b1dev->width - screen_width) / 2;
+ break;
+
+ case 'C': /* centre vertically */
+ yorigin = (att3b1dev->height - screen_height) / 2;
+ break;
- case '?':
- do_help(dev);
- break;
+ case '=':
+ def_xorigin = xorigin;
+ def_yorigin = yorigin;
+ break;
- case -1:
- error = gs_error_ioerror;
- /* fall through, for cleanup */
-
- case 'q':
- case 'x':
- case '\003': /* control-C */
- case 'n':
- case 'f':
- case ' ':
- case '\n':
- case '\r':
- if (flush)
- att3b1dev->page_num++;
- else if (inverted) /* restore inverted image for copypage */
- for (p = (ushort *) att3b1dev->screen;
- p < (ushort *) & att3b1dev->screen[att3b1dev->screen_size]; ++p)
- *p = ~*p;
- if (!(uflags & NBORDER)) {
- ioctl(att3b1dev->fd, WIOCGETD, &uw); /*window may have moved */
- uw.uw_uflags = uflags;
- ioctl(att3b1dev->fd, WIOCSETD, &uw);
- }
- ur.ur_srcbase = save_image;
- ur.ur_srcwidth = WINWIDTH / 8;
- ur.ur_width = uw.uw_width;
- ur.ur_height = uw.uw_height;
- ur.ur_srcx = 0;
- ur.ur_srcy = 0;
- ioctl(att3b1dev->fd, WIOCRASTOP, &ur);
- ioctl(att3b1dev->fd, WIOCSETTEXT, &ut_orig);
- ioctl(att3b1dev->fd, TCSETAF, &old);
- write(att3b1dev->fd, "\033[=0C", 5);
-
- if (error) {
- att3b1_close(dev);
- return_error(error);
- } else
- return 0;
+ case 'I':
+ for (p = (ushort *)att3b1dev->screen;
+ p < (ushort *)&att3b1dev->screen[att3b1dev->screen_size]; ++p)
+ *p = ~ *p;
+ inverted = !inverted;
+ break;
+
+ case '?':
+ do_help(dev);
+ break;
+
+ case -1:
+ error = gs_error_ioerror;
+ /* fall through, for cleanup */
+
+ case 'q':
+ case 'x':
+ case '\003': /* control-C */
+ case 'n':
+ case 'f':
+ case ' ':
+ case '\n':
+ case '\r':
+ if (flush)
+ att3b1dev->page_num++;
+ else if (inverted) /* restore inverted image for copypage */
+ for (p = (ushort *)att3b1dev->screen;
+ p < (ushort *)&att3b1dev->screen[att3b1dev->screen_size]; ++p)
+ *p = ~ *p;
+ if (!(uflags & NBORDER)) {
+ ioctl(att3b1dev->fd, WIOCGETD, &uw); /*window may have moved*/
+ uw.uw_uflags = uflags;
+ ioctl(att3b1dev->fd, WIOCSETD, &uw);
+ }
+ ur.ur_srcbase = save_image;
+ ur.ur_srcwidth = WINWIDTH / 8;
+ ur.ur_width = uw.uw_width;
+ ur.ur_height = uw.uw_height;
+ ur.ur_srcx = 0;
+ ur.ur_srcy = 0;
+ ioctl(att3b1dev->fd, WIOCRASTOP, &ur);
+ ioctl(att3b1dev->fd, WIOCSETTEXT, &ut_orig);
+ ioctl(att3b1dev->fd, TCSETAF, &old);
+ write(att3b1dev->fd, "\033[=0C", 5);
+
+ if (error) {
+ att3b1_close(dev);
+ return_error(error);
+ }
+ else
+ return 0;
}
if (xorigin >= att3b1dev->width - screen_width)
@@ -700,7 +701,7 @@ att3b1_output_page(gx_device * dev, int num_copies, int flush)
}
static int
-get_char(gx_device * dev)
+get_char(gx_device *dev)
{
char ch;
int count;
@@ -715,7 +716,7 @@ get_char(gx_device * dev)
}
static int
-getKeyboard(gx_device * dev)
+getKeyboard(gx_device *dev)
{
char ch;
@@ -734,56 +735,56 @@ getKeyboard(gx_device * dev)
*/
switch (get_char(dev)) {
- case '[':
- switch (get_char(dev)) {
- case 'A': /* up arrow */
- return 'k';
- case 'T': /* shift up arrow (roll up) */
- return '\025';
- case 'B': /* down arrow */
- return 'j';
- case 'S': /* shift down arrow (roll down) */
- return '\004';
- case 'C': /* right arrow */
- return 'l';
- case 'D': /* left arrow */
- return 'h';
- case 'H': /* home */
- return 'r';
- case 'U': /* page down */
- return '\006';
- case 'V': /* page up */
- return '\002';
- }
- break;
- case 'O':
- switch (get_char(dev)) {
- case 'm': /* help */
- case 'M': /* shift help */
- return '?';
- case 'k': /* exit */
- case 'K': /* shift exit */
- case 'w': /* cancl */
- case 'W': /* shift cancl */
- return 'q';
- }
- break;
- case 'N':
- switch (get_char(dev)) {
- case 'h': /* next */
- return 'f';
- case 'i': /* mark */
- return '=';
- case 'L': /* shift right arrow */
- return 'l';
- case 'K': /* shift left arrow */
- return 'h';
- }
- break;
- case '9': /* Beg */
- return 'K';
- case '0': /* End */
- return 'J';
+ case '[':
+ switch(get_char(dev)) {
+ case 'A': /* up arrow */
+ return 'k';
+ case 'T': /* shift up arrow (roll up) */
+ return '\025';
+ case 'B': /* down arrow */
+ return 'j';
+ case 'S': /* shift down arrow (roll down) */
+ return '\004';
+ case 'C': /* right arrow */
+ return 'l';
+ case 'D': /* left arrow */
+ return 'h';
+ case 'H': /* home */
+ return 'r';
+ case 'U': /* page down */
+ return '\006';
+ case 'V': /* page up */
+ return '\002';
+ }
+ break;
+ case 'O':
+ switch(get_char(dev)) {
+ case 'm': /* help */
+ case 'M': /* shift help */
+ return '?';
+ case 'k': /* exit */
+ case 'K': /* shift exit */
+ case 'w': /* cancl */
+ case 'W': /* shift cancl */
+ return 'q';
+ }
+ break;
+ case 'N':
+ switch(get_char(dev)) {
+ case 'h': /* next */
+ return 'f';
+ case 'i': /* mark */
+ return '=';
+ case 'L': /* shift right arrow */
+ return 'l';
+ case 'K': /* shift left arrow */
+ return 'h';
+ }
+ break;
+ case '9': /* Beg */
+ return 'K';
+ case '0': /* End */
+ return 'J';
}
return '\0';
}
diff --git a/gs/src/gdev4081.c b/gs/src/gdev4081.c
index 0889b7774..cb2d34977 100644
--- a/gs/src/gdev4081.c
+++ b/gs/src/gdev4081.c
@@ -1,93 +1,95 @@
/* Copyright (C) 1991, 1996 Aladdin Enterprises. All rights reserved.
-
- This file is part of Aladdin Ghostscript.
-
- Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
- or distributor accepts any responsibility for the consequences of using it,
- or for whether it serves any particular purpose or works at all, unless he
- or she says so in writing. Refer to the Aladdin Ghostscript Free Public
- License (the "License") for full details.
-
- Every copy of Aladdin Ghostscript must include a copy of the License,
- normally in a plain ASCII text file named PUBLIC. The License grants you
- the right to copy, modify and redistribute Aladdin Ghostscript, but only
- under certain conditions described in the License. Among other things, the
- License requires that the copyright notice and this notice be preserved on
- all copies.
- */
-
-/* gdev4081.c */
+
+ This file is part of Aladdin Ghostscript.
+
+ Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
+ or distributor accepts any responsibility for the consequences of using it,
+ or for whether it serves any particular purpose or works at all, unless he
+ or she says so in writing. Refer to the Aladdin Ghostscript Free Public
+ License (the "License") for full details.
+
+ Every copy of Aladdin Ghostscript must include a copy of the License,
+ normally in a plain ASCII text file named PUBLIC. The License grants you
+ the right to copy, modify and redistribute Aladdin Ghostscript, but only
+ under certain conditions described in the License. Among other things, the
+ License requires that the copyright notice and this notice be preserved on
+ all copies.
+*/
+
+/*Id: gdev4081.c */
/* Ricoh 4081 laser printer driver */
#include "gdevprn.h"
-#define X_DPI 300 /* pixels per inch */
-#define Y_DPI 300 /* pixels per inch */
+#define X_DPI 300 /* pixels per inch */
+#define Y_DPI 300 /* pixels per inch */
/* The device descriptor */
private dev_proc_print_page(r4081_print_page);
gx_device_printer far_data gs_r4081_device =
-prn_device(prn_std_procs, "r4081",
- 85, /* width_10ths, 8.5" */
- 110, /* height_10ths, 11" */
- X_DPI, Y_DPI,
- 0.25, 0.16, 0.25, 0.16, /* margins */
- 1, r4081_print_page);
+ prn_device(prn_std_procs, "r4081",
+ 85, /* width_10ths, 8.5" */
+ 110, /* height_10ths, 11" */
+ X_DPI, Y_DPI,
+ 0.25, 0.16, 0.25, 0.16, /* margins */
+ 1, r4081_print_page);
/* ------ Internal routines ------ */
/* Send the page to the printer. */
private int
-r4081_print_page(gx_device_printer * pdev, FILE * prn_stream)
-{
- int line_size = gdev_mem_bytes_per_scan_line((gx_device *) pdev);
- int out_size = ((pdev->width + 7) & -8);
- byte *out = (byte *) gs_malloc(out_size, 1, "r4081_print_page(out)");
- int lnum = 0;
- int last = pdev->height;
-
- /* Check allocations */
- if (out == 0) {
- if (out)
- gs_free((char *)out, out_size, 1,
- "r4081_print_page(out)");
- return -1;
- }
- /* find the first line which has something to print */
- while (lnum < last) {
- gdev_prn_copy_scan_lines(pdev, lnum, (byte *) out, line_size);
- if (out[0] != 0 ||
- memcmp((char *)out, (char *)out + 1, line_size - 1)
- )
- break;
- lnum++;
- }
-
- /* find the last line which has something to print */
- while (last > lnum) {
- gdev_prn_copy_scan_lines(pdev, last - 1, (byte *) out, line_size);
- if (out[0] != 0 ||
- memcmp((char *)out, (char *)out + 1, line_size - 1)
- )
- break;
- last--;
- }
-
- /* Initialize the printer and set the starting position. */
- fprintf(prn_stream, "\033\rP\033\022YB2 \033\022G3,%d,%d,1,1,1,%d@",
- out_size, last - lnum, (lnum + 1) * 720 / Y_DPI);
-
- /* Print lines of graphics */
- while (lnum < last) {
- gdev_prn_copy_scan_lines(pdev, lnum, (byte *) out, line_size);
- fwrite(out, sizeof(char), line_size, prn_stream);
-
- lnum++;
- }
-
- /* Eject the page and reinitialize the printer */
- fputs("\f\033\rP", prn_stream);
-
- gs_free((char *)out, out_size, 1, "r4081_print_page(out)");
- return 0;
+r4081_print_page(gx_device_printer *pdev, FILE *prn_stream)
+{
+ int line_size = gdev_mem_bytes_per_scan_line((gx_device *)pdev);
+ int out_size = ((pdev->width + 7) & -8) ;
+ byte *out = (byte *)gs_malloc(out_size, 1, "r4081_print_page(out)");
+ int lnum = 0;
+ int last = pdev->height;
+
+ /* Check allocations */
+ if ( out == 0 )
+ { if ( out )
+ gs_free((char *)out, out_size, 1,
+ "r4081_print_page(out)");
+ return -1;
+ }
+
+ /* find the first line which has something to print */
+ while ( lnum < last )
+ {
+ gdev_prn_copy_scan_lines(pdev, lnum, (byte *)out, line_size);
+ if ( out[0] != 0 ||
+ memcmp((char *)out, (char *)out+1, line_size-1)
+ )
+ break;
+ lnum ++;
+ }
+
+ /* find the last line which has something to print */
+ while (last > lnum) {
+ gdev_prn_copy_scan_lines(pdev, last-1, (byte *)out, line_size);
+ if ( out[0] != 0 ||
+ memcmp((char *)out, (char *)out+1, line_size-1)
+ )
+ break;
+ last --;
+ }
+
+ /* Initialize the printer and set the starting position. */
+ fprintf(prn_stream,"\033\rP\033\022YB2 \033\022G3,%d,%d,1,1,1,%d@",
+ out_size, last-lnum, (lnum+1)*720/Y_DPI);
+
+ /* Print lines of graphics */
+ while ( lnum < last )
+ {
+ gdev_prn_copy_scan_lines(pdev, lnum, (byte *)out, line_size);
+ fwrite(out, sizeof(char), line_size, prn_stream);
+ lnum ++;
+ }
+
+ /* Eject the page and reinitialize the printer */
+ fputs("\f\033\rP", prn_stream);
+
+ gs_free((char *)out, out_size, 1, "r4081_print_page(out)");
+ return 0;
}
diff --git a/gs/src/gdev4693.c b/gs/src/gdev4693.c
index dc610e554..28137651c 100644
--- a/gs/src/gdev4693.c
+++ b/gs/src/gdev4693.c
@@ -1,12 +1,12 @@
/*
- * Copyright 1992 Washington State University. All rights reserved.
+ * Copyright 1992 Washington State University. All rights reserved.
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose and without fee is hereby granted.
* This software is provided "as is" without express or implied warranty.
*/
-/* gdev4693.c */
+/*Id: gdev4693.c */
/* Driver for the Tektronix 4693d color plotter. */
#include "gdevprn.h"
@@ -23,7 +23,7 @@ private dev_proc_map_rgb_color(gdev_t4693d_map_rgb_color);
private dev_proc_map_color_rgb(gdev_t4693d_map_color_rgb);
private gx_device_procs t4693d_procs =
-prn_color_procs(gdev_prn_open, gdev_prn_output_page, gdev_prn_close,
+ prn_color_procs(gdev_prn_open, gdev_prn_output_page, gdev_prn_close,
gdev_t4693d_map_rgb_color, gdev_t4693d_map_color_rgb);
#define t4693d_prn_device(name,depth,max_rgb) {prn_device_body( \
@@ -32,136 +32,137 @@ prn_color_procs(gdev_prn_open, gdev_prn_output_page, gdev_prn_close,
3,depth,max_rgb,max_rgb,max_rgb + 1,max_rgb + 1, \
t4693d_print_page)}
-gx_device_printer gs_t4693d2_device = t4693d_prn_device("t4693d2", 8, 3);
-gx_device_printer gs_t4693d4_device = t4693d_prn_device("t4693d4", 16, 15);
-gx_device_printer gs_t4693d8_device = t4693d_prn_device("t4693d8", 24, 255);
+gx_device_printer gs_t4693d2_device = t4693d_prn_device("t4693d2",8, 3);
+gx_device_printer gs_t4693d4_device = t4693d_prn_device("t4693d4",16, 15);
+gx_device_printer gs_t4693d8_device = t4693d_prn_device("t4693d8",24, 255);
private gx_color_index
-gdev_t4693d_map_rgb_color(gx_device * dev,
- gx_color_value r, gx_color_value g, gx_color_value b)
+gdev_t4693d_map_rgb_color(gx_device *dev,
+ gx_color_value r, gx_color_value g, gx_color_value b)
{
- ushort bitspercolor = prn_dev->color_info.depth / 3;
- ulong max_value = (1 << bitspercolor) - 1;
-
- if (bitspercolor == 5) {
- bitspercolor--;
- max_value = (1 << bitspercolor) - 1;
- }
- return ((r * max_value / gx_max_color_value) << (bitspercolor * 2)) +
- ((g * max_value / gx_max_color_value) << bitspercolor) +
- (b * max_value / gx_max_color_value);
+ ushort bitspercolor = prn_dev->color_info.depth / 3;
+ ulong max_value = (1 << bitspercolor) - 1;
+
+ if (bitspercolor == 5) {
+ bitspercolor--;
+ max_value = (1 << bitspercolor) - 1;
+ }
+
+ return ((r*max_value/gx_max_color_value) << (bitspercolor*2)) +
+ ((g*max_value/gx_max_color_value) << bitspercolor) +
+ (b*max_value/gx_max_color_value);
}
private int
-gdev_t4693d_map_color_rgb(gx_device * dev, gx_color_index color, ushort prgb[3])
+gdev_t4693d_map_color_rgb(gx_device *dev, gx_color_index color, ushort prgb[3])
{
- gx_color_value gray = color * gx_max_color_value / dev->color_info.max_gray;
-
- prgb[0] = gray;
- prgb[1] = gray;
- prgb[2] = gray;
- return (0);
+ gx_color_value gray = color*gx_max_color_value/dev->color_info.max_gray;
+ prgb[0] = gray;
+ prgb[1] = gray;
+ prgb[2] = gray;
+ return(0);
}
private int
-t4693d_print_page(gx_device_printer * dev, FILE * ps_stream)
+t4693d_print_page(gx_device_printer *dev, FILE *ps_stream)
{
- char header[32];
- int depth = prn_dev->color_info.depth;
- int line_size = gdev_mem_bytes_per_scan_line(prn_dev);
- byte *data = (byte *) gs_malloc(line_size, 1, "t4693d_print_page");
- char *p;
- ushort data_size = line_size / prn_dev->width;
- int checksum;
- int lnum;
- int i;
-
+ char header[32];
+ int depth = prn_dev->color_info.depth;
+ int line_size = gdev_mem_bytes_per_scan_line(prn_dev);
+ byte *data = (byte *)gs_malloc(line_size, 1, "t4693d_print_page");
+ char *p;
+ ushort data_size = line_size/prn_dev->width;
+ int checksum;
+ int lnum;
+ int i;
#if !arch_is_big_endian
- byte swap;
-
+ byte swap;
#endif
- if (data == 0)
- return_error(gs_error_VMerror);
- /* build header. */
- p = header;
- *p++ = 0x14; /* Print request */
- *p++ = 0xc0 | 20; /* Length of header */
- *p++ = 0xc0 | ((prn_dev->width >> 6) & 0x3f);
- *p++ = 0x80 | (prn_dev->width & 0x3f);
- *p++ = 0xc0 | ((prn_dev->height >> 6) & 0x3f);
- *p++ = 0x80 | (prn_dev->height & 0x3f);
- *p++ = 0xc1; /* Handshake */
- *p++ = 0xc0; /* Get number of prints from printer. */
- *p++ = 0xc0; /* Get pixel shape from printer. */
- *p++ = (depth == 8) ? 0xcb : (depth == 16) ? 0xcc : 0xcd;
- *p++ = 0xc1; /* Pixel-data order 1. */
- *p++ = 0xc3; /* Interpolate to maximum size. */
- *p++ = 0xc3; /* Full color range 1. */
- *p++ = 0xc0; /* Color conversion from printer. */
- *p++ = 0xc0; /* Color manipulation from printer. */
- *p++ = 0xc0; /* B/W inversion from printer. */
- *p++ = 0xc3; /* Portrait mode centered. */
- *p++ = 0xc9; /* Use printer default for media and printing. */
- *p++ = 0x95;
- *p++ = 0x81;
-
- for (checksum = 0, i = 0; &header[i] != p; i++)
- checksum += header[i];
-
- *p++ = ((checksum % 128) & 0x7f) | 0x80;
- *p = 0x02; /* end of line. */
- /* write header */
- if (fwrite(header, 1, 22, ps_stream) != 22) {
- fprintf(stderr, "Could not write header (t4693d).\n");
- gs_free(data, line_size, 1, "t4693d_print_page");
- return_error(gs_error_ioerror);
- }
- for (lnum = 0; lnum < prn_dev->height; lnum++) {
- gdev_prn_copy_scan_lines(prn_dev, lnum, data, line_size);
-
- for (i = 0; i < line_size; i += data_size) {
-
- switch (depth) {
- case 8:
- data[i] &= 0x3f;
- break;
- case 16:
+ if (data == 0) return_error(gs_error_VMerror);
+ /* build header. */
+ p = header;
+ *p++ = 0x14; /* Print request */
+ *p++ = 0xc0|20; /* Length of header */
+ *p++ = 0xc0 | ((prn_dev->width >> 6)&0x3f);
+ *p++ = 0x80 | (prn_dev->width&0x3f);
+ *p++ = 0xc0 | ((prn_dev->height >> 6)&0x3f);
+ *p++ = 0x80 | (prn_dev->height&0x3f);
+ *p++ = 0xc1; /* Handshake */
+ *p++ = 0xc0; /* Get number of prints from printer. */
+ *p++ = 0xc0; /* Get pixel shape from printer. */
+ *p++ = (depth == 8) ? 0xcb : (depth == 16) ? 0xcc : 0xcd;
+ *p++ = 0xc1; /* Pixel-data order 1. */
+ *p++ = 0xc3; /* Interpolate to maximum size. */
+ *p++ = 0xc3; /* Full color range 1. */
+ *p++ = 0xc0; /* Color conversion from printer. */
+ *p++ = 0xc0; /* Color manipulation from printer. */
+ *p++ = 0xc0; /* B/W inversion from printer. */
+ *p++ = 0xc3; /* Portrait mode centered. */
+ *p++ = 0xc9; /* Use printer default for media and printing. */
+ *p++ = 0x95;
+ *p++ = 0x81;
+
+ for (checksum = 0, i = 0; &header[i] != p; i++)
+ checksum += header[i];
+
+ *p++ = ((checksum%128)&0x7f) | 0x80;
+ *p = 0x02; /* end of line. */
+ /* write header */
+ if (fwrite(header,1,22,ps_stream) != 22) {
+ fprintf(stderr,"Could not write header (t4693d).\n");
+ gs_free(data, line_size, 1, "t4693d_print_page");
+ return_error(gs_error_ioerror);
+ }
+
+ for (lnum = 0; lnum < prn_dev->height; lnum++) {
+ gdev_prn_copy_scan_lines(prn_dev,lnum,data,line_size);
+
+ for (i = 0; i < line_size; i += data_size) {
+
+ switch (depth) {
+ case 8:
+ data[i] &= 0x3f;
+ break;
+ case 16:
#if arch_is_big_endian
- data[i] &= 0x0f;
+ data[i] &= 0x0f;
#else
- swap = data[i];
- data[i] = data[i + 1] & 0x0f;
- data[i + 1] = swap;
+ swap = data[i];
+ data[i] = data[i + 1]&0x0f;
+ data[i + 1] = swap;
#endif
- break;
- case 24:
- break;
- default:
- fprintf(stderr, "Bad depth (%d) t4693d.\n", depth);
- gs_free(data, line_size, 1, "t4693d_print_page");
- return_error(gs_error_rangecheck);
- }
-
- if (fwrite(&data[i], 1, data_size, ps_stream) != data_size) {
- fprintf(stderr, "Could not write pixel (t4693d).\n");
- gs_free(data, line_size, 1, "t4693d_print_page");
- return_error(gs_error_ioerror);
- }
+ break;
+ case 24:
+ break;
+ default:
+ fprintf(stderr,"Bad depth (%d) t4693d.\n",depth);
+ gs_free(data, line_size, 1, "t4693d_print_page");
+ return_error(gs_error_rangecheck);
+ }
+
+ if (fwrite(&data[i],1,data_size,ps_stream) != data_size) {
+ fprintf(stderr,"Could not write pixel (t4693d).\n");
+ gs_free(data, line_size, 1, "t4693d_print_page");
+ return_error(gs_error_ioerror);
+ }
+
+ }
+
+ if (fputc(0x02,ps_stream) != 0x02) {
+ fprintf(stderr,"Could not write EOL (t4693d).\n");
+ gs_free(data, line_size, 1, "t4693d_print_page");
+ return_error(gs_error_ioerror);
+ }
+
}
- if (fputc(0x02, ps_stream) != 0x02) {
- fprintf(stderr, "Could not write EOL (t4693d).\n");
- gs_free(data, line_size, 1, "t4693d_print_page");
- return_error(gs_error_ioerror);
+ if (fputc(0x01,ps_stream) != 0x01) {
+ fprintf(stderr,"Could not write EOT (t4693d).\n");
+ gs_free(data, line_size, 1, "t4693d_print_page");
+ return_error(gs_error_ioerror);
}
- }
- if (fputc(0x01, ps_stream) != 0x01) {
- fprintf(stderr, "Could not write EOT (t4693d).\n");
gs_free(data, line_size, 1, "t4693d_print_page");
- return_error(gs_error_ioerror);
- }
- gs_free(data, line_size, 1, "t4693d_print_page");
- return (0);
+ return(0);
}
diff --git a/gs/src/gdev8510.c b/gs/src/gdev8510.c
index c84ba4f8a..15bbf0f9a 100644
--- a/gs/src/gdev8510.c
+++ b/gs/src/gdev8510.c
@@ -1,24 +1,23 @@
/* Copyright (C) 1990, 1992, 1993 Aladdin Enterprises. All rights reserved.
-
- This file is part of Aladdin Ghostscript.
-
- Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
- or distributor accepts any responsibility for the consequences of using it,
- or for whether it serves any particular purpose or works at all, unless he
- or she says so in writing. Refer to the Aladdin Ghostscript Free Public
- License (the "License") for full details.
-
- Every copy of Aladdin Ghostscript must include a copy of the License,
- normally in a plain ASCII text file named PUBLIC. The License grants you
- the right to copy, modify and redistribute Aladdin Ghostscript, but only
- under certain conditions described in the License. Among other things, the
- License requires that the copyright notice and this notice be preserved on
- all copies.
- */
-
+
+ This file is part of Aladdin Ghostscript.
+
+ Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
+ or distributor accepts any responsibility for the consequences of using it,
+ or for whether it serves any particular purpose or works at all, unless he
+ or she says so in writing. Refer to the Aladdin Ghostscript Free Public
+ License (the "License") for full details.
+
+ Every copy of Aladdin Ghostscript must include a copy of the License,
+ normally in a plain ASCII text file named PUBLIC. The License grants you
+ the right to copy, modify and redistribute Aladdin Ghostscript, but only
+ under certain conditions described in the License. Among other things, the
+ License requires that the copyright notice and this notice be preserved on
+ all copies.
+*/
+
+/*Id: gdev8510.c */
/*
- * gdev8510.c
- *
* C.Itoh M8510 printer driver for ghostscript.
* by Bob Smith <bob@snuffy.penfield.ny.us>
*/
@@ -28,119 +27,117 @@
/* The device descriptor */
private dev_proc_print_page(m8510_print_page);
gx_device_printer far_data gs_m8510_device =
-prn_device(prn_std_procs, "m8510",
- 85, /* width_10ths, 8.5" */
- 110, /* height_10ths, 11" */
- 160, /* x_dpi */
- 144, /* y_dpi */
- 0, 0, 0.5, 0, /* left, bottom, right, and top margins */
- 1, m8510_print_page);
+ prn_device(prn_std_procs, "m8510",
+ 85, /* width_10ths, 8.5" */
+ 110, /* height_10ths, 11" */
+ 160, /* x_dpi */
+ 144, /* y_dpi */
+ 0,0,0.5,0, /* left, bottom, right, and top margins */
+ 1, m8510_print_page);
/* ------ forward declarations ------ */
-private void m8510_output_run(P4(gx_device_printer * pdev,
- byte * out, int pass, FILE * prn_stream));
+private void m8510_output_run(P4(gx_device_printer *pdev,
+ byte *out, int pass, FILE *prn_stream));
/* ------ internal routines ------ */
/* Send the page to the printer. */
private int
-m8510_print_page(gx_device_printer * pdev, FILE * prn_stream)
+m8510_print_page(gx_device_printer *pdev, FILE *prn_stream)
{
- int line_size = gdev_mem_bytes_per_scan_line((gx_device *) pdev);
- byte *in1 = (byte *) gs_malloc(8, line_size, "m8510_print_page(in1)");
- byte *in2 = (byte *) gs_malloc(8, line_size, "m8510_print_page(in2)");
- byte *out = (byte *) gs_malloc(8, line_size, "m8510_print_page(out)");
- int lnum = 0;
- int code = 0;
- byte *inp, *in_end, *outp;
- int i;
-
- if (in1 == 0 || in2 == 0 || out == 0) {
- code = gs_error_VMerror;
- gs_note_error(code);
- goto out;
- }
- /*
- * Initialize the printer.
- * NLQ mode, proportional print (160x144 dpi).
- * and 16/144" linefeeds.
- */
- fwrite("\033m2\033P\033T16", 1, 9, prn_stream);
-
- /* Transfer pixels to printer */
- while (lnum < pdev->height) {
- /* get a raster */
- for (i = 7; i >= 0; i--) {
- gdev_prn_copy_scan_lines(pdev, lnum, &in1[i * line_size], line_size);
- lnum++;
- gdev_prn_copy_scan_lines(pdev, lnum, &in2[i * line_size], line_size);
- lnum++;
+ int line_size = gdev_mem_bytes_per_scan_line((gx_device *)pdev);
+ byte *in1 = (byte *) gs_malloc(8, line_size, "m8510_print_page(in1)");
+ byte *in2 = (byte *) gs_malloc(8, line_size, "m8510_print_page(in2)");
+ byte *out = (byte *) gs_malloc(8, line_size, "m8510_print_page(out)");
+ int lnum = 0;
+ int code = 0;
+ byte *inp, *in_end, *outp;
+ int i;
+
+ if (in1 == 0 || in2 == 0 || out == 0) {
+ code = gs_error_VMerror;
+ gs_note_error(code);
+ goto out;
}
- /* Transpose the 1st pass of data. */
- in_end = in1 + line_size;
- for (inp = in1, outp = out; inp < in_end; inp++, outp += 8)
- gdev_prn_transpose_8x8(inp, line_size, outp, 1);
-
- /* send the 1st line */
- m8510_output_run(pdev, out, 0, prn_stream);
-
- /* Transpose the 2nd pass of data. */
- in_end = in2 + line_size;
- for (inp = in2, outp = out; inp < in_end; inp++, outp += 8)
- gdev_prn_transpose_8x8(inp, line_size, outp, 1);
-
- /* send the 2nd line */
- m8510_output_run(pdev, out, 1, prn_stream);
- }
+ /*
+ * Initialize the printer.
+ * NLQ mode, proportional print (160x144 dpi).
+ * and 16/144" linefeeds.
+ */
+ fwrite("\033m2\033P\033T16", 1, 9, prn_stream);
+
+ /* Transfer pixels to printer */
+ while ( lnum < pdev->height ) {
+ /* get a raster */
+ for (i = 7; i >= 0; i--) {
+ gdev_prn_copy_scan_lines(pdev, lnum, &in1[i*line_size], line_size);
+ lnum++;
+ gdev_prn_copy_scan_lines(pdev, lnum, &in2[i*line_size], line_size);
+ lnum++;
+ }
+
+ /* Transpose the 1st pass of data. */
+ in_end = in1 + line_size;
+ for (inp = in1, outp = out; inp < in_end; inp++, outp += 8)
+ gdev_prn_transpose_8x8(inp, line_size, outp, 1);
+
+ /* send the 1st line */
+ m8510_output_run(pdev, out, 0, prn_stream);
+
+ /* Transpose the 2nd pass of data. */
+ in_end = in2 + line_size;
+ for (inp = in2, outp = out; inp < in_end; inp++, outp += 8)
+ gdev_prn_transpose_8x8(inp, line_size, outp, 1);
+
+ /* send the 2nd line */
+ m8510_output_run(pdev, out, 1, prn_stream);
+ }
- /* reset the printer. */
- fwrite("\033c1", 1, 3, prn_stream);
- fflush(prn_stream);
+ /* reset the printer. */
+ fwrite("\033c1", 1, 3, prn_stream);
+ fflush(prn_stream);
- out:;
- if (out)
- gs_free((char *)out, 8, line_size, "m8510_print_page(out)");
- if (in2)
- gs_free((char *)in2, 8, line_size, "m8510_print_page(in2)");
- if (in1)
- gs_free((char *)in1, 8, line_size, "m8510_print_page(in1)");
+out:;
+ if (out) gs_free((char *) out, 8, line_size, "m8510_print_page(out)");
+ if (in2) gs_free((char *) in2, 8, line_size, "m8510_print_page(in2)");
+ if (in1) gs_free((char *) in1, 8, line_size, "m8510_print_page(in1)");
- return code;
+ return code;
}
private void
-m8510_output_run(gx_device_printer * pdev,
- byte * out, int pass, FILE * prn_stream)
+m8510_output_run(gx_device_printer *pdev,
+ byte *out, int pass, FILE *prn_stream)
{
- byte *out_end = out + pdev->width;
- char tmp[10];
- int count;
-
- /*
- * Remove trailing 0s.
- * out must be a multiple of 8 bytes.
- */
- while (out_end > out
- && out_end[-1] == 0
- && out_end[-2] == 0
- && out_end[-3] == 0
- && out_end[-4] == 0
- && out_end[-5] == 0
- && out_end[-6] == 0
- && out_end[-7] == 0
- && out_end[-8] == 0)
- out_end -= 8;
-
- /* Transfer the line of data. */
- count = out_end - out;
- if (count) {
- sprintf(tmp, "\033g%03d", count / 8);
- fwrite(tmp, 1, 5, prn_stream);
- fwrite(out, 1, count, prn_stream);
- fwrite("\r", 1, 1, prn_stream);
- }
- if (pass)
- fwrite("\n", 1, 1, prn_stream);
+ byte *out_end = out + pdev->width;
+ char tmp[10];
+ int count;
+
+ /*
+ * Remove trailing 0s.
+ * out must be a multiple of 8 bytes.
+ */
+ while (out_end > out
+ && out_end[-1] == 0
+ && out_end[-2] == 0
+ && out_end[-3] == 0
+ && out_end[-4] == 0
+ && out_end[-5] == 0
+ && out_end[-6] == 0
+ && out_end[-7] == 0
+ && out_end[-8] == 0)
+ out_end -= 8;
+
+ /* Transfer the line of data. */
+ count = out_end - out;
+ if (count) {
+ sprintf(tmp, "\033g%03d", count/8);
+ fwrite(tmp, 1, 5, prn_stream);
+ fwrite(out, 1, count, prn_stream);
+ fwrite("\r", 1, 1, prn_stream);
+ }
+
+ if (pass) fwrite("\n", 1, 1, prn_stream);
}
diff --git a/gs/src/gdev8bcm.c b/gs/src/gdev8bcm.c
index e9412148e..2f008d71f 100644
--- a/gs/src/gdev8bcm.c
+++ b/gs/src/gdev8bcm.c
@@ -16,7 +16,7 @@
all copies.
*/
-/* gdev8bcm.c */
+/*Id: gdev8bcm.c */
/* Dynamic color mapping for 8-bit displays */
#include "gx.h"
#include "gxdevice.h"
diff --git a/gs/src/gdev8bcm.h b/gs/src/gdev8bcm.h
index 209837803..93ddb5cb3 100644
--- a/gs/src/gdev8bcm.h
+++ b/gs/src/gdev8bcm.h
@@ -1,25 +1,27 @@
/* Copyright (C) 1994 Aladdin Enterprises. All rights reserved.
-
- This file is part of Aladdin Ghostscript.
-
- Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
- or distributor accepts any responsibility for the consequences of using it,
- or for whether it serves any particular purpose or works at all, unless he
- or she says so in writing. Refer to the Aladdin Ghostscript Free Public
- License (the "License") for full details.
-
- Every copy of Aladdin Ghostscript must include a copy of the License,
- normally in a plain ASCII text file named PUBLIC. The License grants you
- the right to copy, modify and redistribute Aladdin Ghostscript, but only
- under certain conditions described in the License. Among other things, the
- License requires that the copyright notice and this notice be preserved on
- all copies.
-*/
-/* gdev8bcm.h */
-/* Dynamic color mapping for 8-bit displays */
+ This file is part of Aladdin Ghostscript.
+
+ Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
+ or distributor accepts any responsibility for the consequences of using it,
+ or for whether it serves any particular purpose or works at all, unless he
+ or she says so in writing. Refer to the Aladdin Ghostscript Free Public
+ License (the "License") for full details.
+
+ Every copy of Aladdin Ghostscript must include a copy of the License,
+ normally in a plain ASCII text file named PUBLIC. The License grants you
+ the right to copy, modify and redistribute Aladdin Ghostscript, but only
+ under certain conditions described in the License. Among other things, the
+ License requires that the copyright notice and this notice be preserved on
+ all copies.
+ */
+
+/*Id: gdev8bcm.h */
/* Requires gxdevice.h (for gx_color_value) */
+#ifndef gdev8bcm_INCLUDED
+# define gdev8bcm_INCLUDED
+
/*
* The MS-DOS, MS Windows, and X Windows drivers all use (at least on
* some platforms) an 8-bit color map in which some fraction is reserved
@@ -36,18 +38,18 @@
#define gx_8bit_map_size 323
#define gx_8bit_map_spreader 123 /* approx. 323 - (1.618 * 323) */
typedef struct gx_8bit_map_entry_s {
- ushort rgb; /* key = 0rrrrrgggggbbbbb */
+ ushort rgb; /* key = 0rrrrrgggggbbbbb */
#define gx_8bit_no_rgb ((ushort)0xffff)
#define gx_8bit_rgb_key(r, g, b)\
(((r >> (gx_color_value_bits - 5)) << 10) +\
((g >> (gx_color_value_bits - 5)) << 5) +\
(b >> (gx_color_value_bits - 5)))
- short index; /* value */
+ short index; /* value */
} gx_8bit_map_entry;
typedef struct gx_8bit_color_map_s {
- int count; /* # of occupied entries */
- int max_count; /* max # of occupied entries */
- gx_8bit_map_entry map[gx_8bit_map_size + 1];
+ int count; /* # of occupied entries */
+ int max_count; /* max # of occupied entries */
+ gx_8bit_map_entry map[gx_8bit_map_size + 1];
} gx_8bit_color_map;
/* Initialize an 8-bit color map. */
@@ -66,3 +68,5 @@ int gx_8bit_map_rgb_color(P4(const gx_8bit_color_map *, gx_color_value,
/* Return -1 if the map is full. */
int gx_8bit_add_rgb_color(P4(gx_8bit_color_map *, gx_color_value,
gx_color_value, gx_color_value));
+
+#endif /* gdev8bcm_INCLUDED */
diff --git a/gs/src/gdevabuf.c b/gs/src/gdevabuf.c
index 2f942022a..bb7bbe47a 100644
--- a/gs/src/gdevabuf.c
+++ b/gs/src/gdevabuf.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1994, 1995, 1996 Aladdin Enterprises. All rights reserved.
+/* Copyright (C) 1994, 1995, 1996, 1998 Aladdin Enterprises. All rights reserved.
This file is part of Aladdin Ghostscript.
@@ -16,7 +16,7 @@
all copies.
*/
-/* gdevabuf.c */
+/*Id: gdevabuf.c */
/* Alpha-buffering memory devices */
#include "memory_.h"
#include "gx.h"
@@ -150,7 +150,7 @@ private dev_proc_fill_rectangle(mem_abuf_fill_rectangle);
private dev_proc_get_clipping_box(mem_abuf_get_clipping_box);
/* The device descriptor. */
-private const gx_device_memory far_data mem_alpha_buffer_device =
+private const gx_device_memory mem_alpha_buffer_device =
mem_device("image(alpha buffer)", 0, 1,
gx_forward_map_rgb_color, gx_forward_map_color_rgb,
mem_abuf_copy_mono, gx_default_copy_color, mem_abuf_fill_rectangle,
@@ -336,7 +336,9 @@ mem_abuf_copy_mono(gx_device * dev,
if (zero != gx_no_color_index || one == gx_no_color_index)
return_error(gs_error_undefinedresult);
x -= mdev->mapped_x;
- fit_copy_xwh(dev, base, sourcex, sraster, id, x, y, w, h); /* don't limit y */
+ fit_copy_xyw(dev, base, sourcex, sraster, id, x, y, w, h); /* don't limit h */
+ if (w <= 0 || h <= 0)
+ return 0;
mdev->save_color = one;
y_transfer_init(&yt, dev, y, h);
while (yt.height_left > 0) {
@@ -358,7 +360,8 @@ mem_abuf_fill_rectangle(gx_device * dev, int x, int y, int w, int h,
y_transfer yt;
x -= mdev->mapped_x;
- fit_fill_xyw(dev, x, y, w, h); /* don't limit h */
+ fit_fill_xy(dev, x, y, w, h);
+ fit_fill_w(dev, x, w); /* don't limit h */
/* or check w <= 0, h <= 0 */
mdev->save_color = color;
y_transfer_init(&yt, dev, y, h);
diff --git a/gs/src/gdevadmp.c b/gs/src/gdevadmp.c
index ce5e82da2..0af15c9ea 100644
--- a/gs/src/gdevadmp.c
+++ b/gs/src/gdevadmp.c
@@ -1,28 +1,29 @@
/* Copyright (C) 1989, 1995 Aladdin Enterprises. All rights reserved.
-
- This file is part of Aladdin Ghostscript.
-
- Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
- or distributor accepts any responsibility for the consequences of using it,
- or for whether it serves any particular purpose or works at all, unless he
- or she says so in writing. Refer to the Aladdin Ghostscript Free Public
- License (the "License") for full details.
-
- Every copy of Aladdin Ghostscript must include a copy of the License,
- normally in a plain ASCII text file named PUBLIC. The License grants you
- the right to copy, modify and redistribute Aladdin Ghostscript, but only
- under certain conditions described in the License. Among other things, the
- License requires that the copyright notice and this notice be preserved on
- all copies.
- */
-
+
+ This file is part of Aladdin Ghostscript.
+
+ Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
+ or distributor accepts any responsibility for the consequences of using it,
+ or for whether it serves any particular purpose or works at all, unless he
+ or she says so in writing. Refer to the Aladdin Ghostscript Free Public
+ License (the "License") for full details.
+
+ Every copy of Aladdin Ghostscript must include a copy of the License,
+ normally in a plain ASCII text file named PUBLIC. The License grants you
+ the right to copy, modify and redistribute Aladdin Ghostscript, but only
+ under certain conditions described in the License. Among other things, the
+ License requires that the copyright notice and this notice be preserved on
+ all copies.
+*/
+
+/*Id: gdevadmp.c */
/*
* This is a modification of Mark Wedel's Apple DMP and
* Jonathan Luckey's Imagewriter II driver to
* support the Imagewriter LQ's higher resolution (320x216):
* appledmp: 120dpi x 72dpi is still supported (yuck)
- * iwlo: 160dpi x 72dpi
- * iwhi: 160dpi x 144dpi
+ * iwlo: 160dpi x 72dpi
+ * iwhi: 160dpi x 144dpi
* iwlq: 320dpi x 216dpi
*
* This is also my first attempt to work with gs. I have not included the LQ's
@@ -38,8 +39,8 @@
* This is a modification of Mark Wedel's Apple DMP driver to
* support 2 higher resolutions:
* appledmp: 120dpi x 72dpi is still supported (yuck)
- * iwlo: 160dpi x 72dpi
- * iwhi: 160dpi x 144dpi
+ * iwlo: 160dpi x 72dpi
+ * iwhi: 160dpi x 144dpi
*
* The Imagewriter II is a bit odd. In pinfeed mode, it thinks its
* First line is 1 inch from the top of the page. If you set the top
@@ -118,41 +119,41 @@ private dev_proc_print_page(dmp_print_page);
/* Standard DMP device */
gx_device_printer far_data gs_appledmp_device =
prn_device(prn_std_procs, "appledmp",
- 85, /* width_10ths, 8.5" */
- 110, /* height_10ths, 11" */
- 120, 72, /* X_DPI, Y_DPI */
- 0, 0.5, 0.5, 0, /* margins */
- 1, dmp_print_page);
+ 85, /* width_10ths, 8.5" */
+ 110, /* height_10ths, 11" */
+ 120, 72, /* X_DPI, Y_DPI */
+ 0, 0.5, 0.5, 0, /* margins */
+ 1, dmp_print_page);
/* lowrez Imagewriter device */
gx_device_printer far_data gs_iwlo_device =
prn_device(prn_std_procs, "iwlo",
- 85, /* width_10ths, 8.5" */
- 110, /* height_10ths, 11" */
- 160, 72, /* X_DPI, Y_DPI */
- 0, 0.5, 0.5, 0, /* margins */
- 1, dmp_print_page);
+ 85, /* width_10ths, 8.5" */
+ 110, /* height_10ths, 11" */
+ 160, 72, /* X_DPI, Y_DPI */
+ 0, 0.5, 0.5, 0, /* margins */
+ 1, dmp_print_page);
/* hirez Imagewriter device */
gx_device_printer far_data gs_iwhi_device =
prn_device(prn_std_procs, "iwhi",
- 85, /* width_10ths, 8.5" */
- 110, /* height_10ths, 11" */
- 160, 144, /* X_DPI, Y_DPI */
- 0, 0.5, 0.5, 0, /* margins */
- 1, dmp_print_page);
+ 85, /* width_10ths, 8.5" */
+ 110, /* height_10ths, 11" */
+ 160, 144, /* X_DPI, Y_DPI */
+ 0, 0.5, 0.5, 0, /* margins */
+ 1, dmp_print_page);
/* LQ hirez Imagewriter device */
gx_device_printer far_data gs_iwlq_device =
prn_device(prn_std_procs, "iwlq",
- 85, /* width_10ths, 8.5" */
- 110, /* height_10ths, 11" */
- 320, 216,
- 0, 0, 0.5, 0, /* margins */
- 1, dmp_print_page);
+ 85, /* width_10ths, 8.5" */
+ 110, /* height_10ths, 11" */
+ 320, 216,
+ 0, 0, 0.5, 0, /* margins */
+ 1, dmp_print_page);
/* ------ Internal routines ------ */
@@ -164,71 +165,74 @@ prn_device(prn_std_procs, "iwlq",
/* Send the page to the printer. */
private int
-dmp_print_page(gx_device_printer * pdev, FILE * prn_stream)
-{
- int dev_type;
-
- int line_size = gdev_mem_bytes_per_scan_line((gx_device *) pdev);
-
- /* Note that in_size is a multiple of 8. */
- int in_size = line_size * 8;
-
- byte *buf1 = (byte *) gs_malloc(in_size, 1, "dmp_print_page(buf1)");
- byte *buf2 = (byte *) gs_malloc(in_size, 1, "dmp_print_page(buf2)");
- byte *prn = (byte *) gs_malloc(3 * in_size, 1, "dmp_print_page(prn)");
-
- byte *in = buf1;
- byte *out = buf2;
- int lnum = 0;
-
- /* Check allocations */
- if (buf1 == 0 || buf2 == 0 || prn == 0) {
- if (buf1)
- gs_free((char *)buf1, in_size, 1,
- "dmp_print_page(buf1)");
- if (buf2)
- gs_free((char *)buf2, in_size, 1,
- "dmp_print_page(buf2)");
- if (prn)
- gs_free((char *)prn, in_size, 1,
- "dmp_print_page(prn)");
- return_error(gs_error_VMerror);
- }
- if (pdev->y_pixels_per_inch == 216)
- dev_type = IWLQ;
- else if (pdev->y_pixels_per_inch == 144)
- dev_type = IWHI;
- else if (pdev->x_pixels_per_inch == 160)
- dev_type = IWLO;
- else
- dev_type = DMP;
-
- /* Initialize the printer and reset the margins. */
-
- fputs("\r\n\033>\033T16", prn_stream);
-
- switch (dev_type) {
+dmp_print_page(gx_device_printer *pdev, FILE *prn_stream)
+{
+ int dev_type;
+
+ int line_size = gdev_mem_bytes_per_scan_line((gx_device *)pdev);
+ /* Note that in_size is a multiple of 8. */
+ int in_size = line_size * 8;
+
+ byte *buf1 = (byte *)gs_malloc(in_size, 1, "dmp_print_page(buf1)");
+ byte *buf2 = (byte *)gs_malloc(in_size, 1, "dmp_print_page(buf2)");
+ byte *prn = (byte *)gs_malloc(3*in_size, 1, "dmp_print_page(prn)");
+
+ byte *in = buf1;
+ byte *out = buf2;
+ int lnum = 0;
+
+ /* Check allocations */
+ if ( buf1 == 0 || buf2 == 0 || prn == 0 )
+ {
+ if ( buf1 )
+ gs_free((char *)buf1, in_size, 1,
+ "dmp_print_page(buf1)");
+ if ( buf2 )
+ gs_free((char *)buf2, in_size, 1,
+ "dmp_print_page(buf2)");
+ if ( prn )
+ gs_free((char *)prn, in_size, 1,
+ "dmp_print_page(prn)");
+ return_error(gs_error_VMerror);
+ }
+
+ if ( pdev->y_pixels_per_inch == 216 )
+ dev_type = IWLQ;
+ else if ( pdev->y_pixels_per_inch == 144 )
+ dev_type = IWHI;
+ else if ( pdev->x_pixels_per_inch == 160 )
+ dev_type = IWLO;
+ else
+ dev_type = DMP;
+
+ /* Initialize the printer and reset the margins. */
+
+ fputs("\r\n\033>\033T16", prn_stream);
+
+ switch(dev_type)
+ {
case IWLQ:
- fputs("\033P\033a3", prn_stream);
- break;
+ fputs("\033P\033a3", prn_stream);
+ break;
case IWHI:
case IWLO:
- fputs("\033P", prn_stream);
- break;
- case DMP:
+ fputs("\033P", prn_stream);
+ break;
+ case DMP:
default:
- fputs("\033q", prn_stream);
- break;
- }
-
- /* Print lines of graphics */
- while (lnum < pdev->height) {
- byte *inp;
- byte *in_end;
- byte *out_end;
- int lcnt, ltmp;
- int count, passes;
- byte *prn_blk, *prn_end, *prn_tmp;
+ fputs("\033q", prn_stream);
+ break;
+ }
+
+ /* Print lines of graphics */
+ while ( lnum < pdev->height )
+ {
+ byte *inp;
+ byte *in_end;
+ byte *out_end;
+ int lcnt,ltmp;
+ int count, passes;
+ byte *prn_blk, *prn_end, *prn_tmp;
/* The apple DMP printer seems to be odd in that the bit order on
* each line is reverse what might be expected. Meaning, an
@@ -237,180 +241,168 @@ dmp_print_page(gx_device_printer * pdev, FILE * prn_stream)
* scan line in reverse order.
*/
- switch (dev_type) {
- case IWLQ:
- passes = 3;
- break;
- case IWHI:
- passes = 2;
- break;
- case IWLO:
- case DMP:
- default:
- passes = 1;
- break;
- }
-
- for (count = 0; count < passes; count++) {
- for (lcnt = 0; lcnt < 8; lcnt++) {
- switch (dev_type) {
- case IWLQ:
- ltmp = lcnt + 8 * count;
- break;
- case IWHI:
- ltmp = 2 * lcnt + count;
- break;
- case IWLO:
- case DMP:
- default:
- ltmp = lcnt;
- break;
+ switch (dev_type)
+ {
+ case IWLQ: passes = 3; break;
+ case IWHI: passes = 2; break;
+ case IWLO:
+ case DMP:
+ default: passes = 1; break;
}
- if ((lnum + ltmp) > pdev->height)
- memset(in + lcnt * line_size, 0, line_size);
- else
- gdev_prn_copy_scan_lines(pdev,
- lnum + ltmp, in + line_size * (7 - lcnt),
- line_size);
- }
-
- out_end = out;
- inp = in;
- in_end = inp + line_size;
- for (; inp < in_end; inp++, out_end += 8) {
- gdev_prn_transpose_8x8(inp, line_size,
- out_end, 1);
- }
-
- out_end = out;
-
- switch (dev_type) {
+ for (count = 0; count < passes; count++)
+ {
+ for (lcnt=0; lcnt<8; lcnt++)
+ {
+ switch(dev_type)
+ {
+ case IWLQ: ltmp = lcnt + 8*count; break;
+ case IWHI: ltmp = 2*lcnt + count; break;
+ case IWLO:
+ case DMP:
+ default: ltmp = lcnt; break;
+ }
+
+ if ((lnum+ltmp)>pdev->height)
+ memset(in+lcnt*line_size,0,line_size);
+ else
+ gdev_prn_copy_scan_lines(pdev,
+ lnum+ltmp, in + line_size*(7 - lcnt),
+ line_size);
+ }
+
+ out_end = out;
+ inp = in;
+ in_end = inp + line_size;
+ for ( ; inp < in_end; inp++, out_end += 8 )
+ {
+ gdev_prn_transpose_8x8(inp, line_size,
+ out_end, 1);
+ }
+
+ out_end = out;
+
+ switch (dev_type)
+ {
+ case IWLQ: prn_end = prn + count; break;
+ case IWHI: prn_end = prn + in_size*count; break;
+ case IWLO:
+ case DMP:
+ default: prn_end = prn; break;
+ }
+
+ while ( (int)(out_end-out) < in_size)
+ {
+ *prn_end = *(out_end++);
+ if ((dev_type) == IWLQ) prn_end += 3;
+ else prn_end++;
+ }
+ }
+
+ switch (dev_type)
+ {
case IWLQ:
- prn_end = prn + count;
- break;
+ prn_blk = prn;
+ prn_end = prn_blk + in_size * 3;
+ while (prn_end > prn && prn_end[-1] == 0 &&
+ prn_end[-2] == 0 && prn_end[-3] == 0)
+ {
+ prn_end -= 3;
+ }
+ while (prn_blk < prn_end && prn_blk[0] == 0 &&
+ prn_blk[1] == 0 && prn_blk[2] == 0)
+ {
+ prn_blk += 3;
+ }
+ if (prn_end != prn_blk)
+ {
+ if ((prn_blk - prn) > 7)
+ fprintf(prn_stream,"\033U%04d%c%c%c",
+ (int)((prn_blk - prn)/3),
+ 0, 0, 0);
+ else
+ prn_blk = prn;
+ fprintf(prn_stream,"\033C%04d",
+ (int)((prn_end - prn_blk)/3));
+ fwrite(prn_blk, 1, (int)(prn_end - prn_blk),
+ prn_stream);
+ }
+ break;
case IWHI:
- prn_end = prn + in_size * count;
- break;
+ for (count = 0; count < 2; count++)
+ {
+ prn_blk = prn_tmp = prn + in_size*count;
+ prn_end = prn_blk + in_size;
+ while (prn_end > prn_blk && prn_end[-1] == 0)
+ prn_end--;
+ while (prn_blk < prn_end && prn_blk[0] == 0)
+ prn_blk++;
+ if (prn_end != prn_blk)
+ {
+ if ((prn_blk - prn_tmp) > 7)
+ fprintf(prn_stream,
+ "\033V%04d%c",
+ (int)(prn_blk-prn_tmp),
+ 0);
+ else
+ prn_blk = prn_tmp;
+ fprintf(prn_stream,"\033G%04d",
+ (int)(prn_end - prn_blk));
+ fwrite(prn_blk, 1,
+ (int)(prn_end - prn_blk),
+ prn_stream);
+ }
+ if (!count) fputs("\033T01\r\n",prn_stream);
+ }
+ fputs("\033T15",prn_stream);
+ break;
case IWLO:
case DMP:
default:
- prn_end = prn;
- break;
- }
-
- while ((int)(out_end - out) < in_size) {
- *prn_end = *(out_end++);
- if ((dev_type) == IWLQ)
- prn_end += 3;
- else
- prn_end++;
- }
- }
-
- switch (dev_type) {
- case IWLQ:
- prn_blk = prn;
- prn_end = prn_blk + in_size * 3;
- while (prn_end > prn && prn_end[-1] == 0 &&
- prn_end[-2] == 0 && prn_end[-3] == 0) {
- prn_end -= 3;
- }
- while (prn_blk < prn_end && prn_blk[0] == 0 &&
- prn_blk[1] == 0 && prn_blk[2] == 0) {
- prn_blk += 3;
- }
- if (prn_end != prn_blk) {
- if ((prn_blk - prn) > 7)
- fprintf(prn_stream, "\033U%04d%c%c%c",
- (int)((prn_blk - prn) / 3),
- 0, 0, 0);
- else
prn_blk = prn;
- fprintf(prn_stream, "\033C%04d",
- (int)((prn_end - prn_blk) / 3));
- fwrite(prn_blk, 1, (int)(prn_end - prn_blk),
- prn_stream);
- }
- break;
- case IWHI:
- for (count = 0; count < 2; count++) {
- prn_blk = prn_tmp = prn + in_size * count;
- prn_end = prn_blk + in_size;
- while (prn_end > prn_blk && prn_end[-1] == 0)
- prn_end--;
- while (prn_blk < prn_end && prn_blk[0] == 0)
- prn_blk++;
- if (prn_end != prn_blk) {
- if ((prn_blk - prn_tmp) > 7)
- fprintf(prn_stream,
- "\033V%04d%c",
- (int)(prn_blk - prn_tmp),
- 0);
- else
- prn_blk = prn_tmp;
- fprintf(prn_stream, "\033G%04d",
- (int)(prn_end - prn_blk));
- fwrite(prn_blk, 1,
- (int)(prn_end - prn_blk),
- prn_stream);
- }
- if (!count)
- fputs("\033T01\r\n", prn_stream);
- }
- fputs("\033T15", prn_stream);
- break;
- case IWLO:
- case DMP:
- default:
- prn_blk = prn;
- prn_end = prn_blk + in_size;
- while (prn_end > prn_blk && prn_end[-1] == 0)
- prn_end--;
- while (prn_blk < prn_end && prn_blk[0] == 0)
- prn_blk++;
- if (prn_end != prn_blk) {
- if ((prn_blk - prn) > 7)
- fprintf(prn_stream, "\033V%04d%c",
- (int)(prn_blk - prn), 0);
- else
- prn_blk = prn;
- fprintf(prn_stream, "\033G%04d",
- (int)(prn_end - prn_blk));
- fwrite(prn_blk, 1, (int)(prn_end - prn_blk),
- prn_stream);
+ prn_end = prn_blk + in_size;
+ while (prn_end > prn_blk && prn_end[-1] == 0)
+ prn_end--;
+ while (prn_blk < prn_end && prn_blk[0] == 0)
+ prn_blk++;
+ if (prn_end != prn_blk)
+ {
+ if ((prn_blk - prn) > 7)
+ fprintf(prn_stream,"\033V%04d%c",
+ (int)(prn_blk - prn), 0);
+ else
+ prn_blk = prn;
+ fprintf(prn_stream,"\033G%04d",
+ (int)(prn_end - prn_blk));
+ fwrite(prn_blk, 1, (int)(prn_end - prn_blk),
+ prn_stream);
+ }
+ break;
}
- break;
- }
- fputs("\r\n", prn_stream);
+ fputs("\r\n",prn_stream);
- switch (dev_type) {
- case IWLQ:
- lnum += 24;
- break;
- case IWHI:
- lnum += 16;
- break;
- case IWLO:
- case DMP:
- default:
- lnum += 8;
- break;
+ switch (dev_type)
+ {
+ case IWLQ: lnum += 24 ; break;
+ case IWHI: lnum += 16 ; break;
+ case IWLO:
+ case DMP:
+ default: lnum += 8 ; break;
+ }
}
- }
-
- /* ImageWriter will skip a whole page if too close to end */
- /* so skip back more than an inch */
- if (!(dev_type == DMP))
- fputs("\033T99\n\n\033r\n\n\n\n\033f", prn_stream);
-
- /* Formfeed and Reset printer */
- fputs("\033T16\f\033<\033B\033E", prn_stream);
- fflush(prn_stream);
- gs_free((char *)prn, in_size, 1, "dmp_print_page(prn)");
- gs_free((char *)buf2, in_size, 1, "dmp_print_page(buf2)");
- gs_free((char *)buf1, in_size, 1, "dmp_print_page(buf1)");
- return 0;
+ /* ImageWriter will skip a whole page if too close to end */
+ /* so skip back more than an inch */
+ if ( !(dev_type == DMP) )
+ fputs("\033T99\n\n\033r\n\n\n\n\033f", prn_stream);
+
+ /* Formfeed and Reset printer */
+ fputs("\033T16\f\033<\033B\033E", prn_stream);
+ fflush(prn_stream);
+
+ gs_free((char *)prn, in_size, 1, "dmp_print_page(prn)");
+ gs_free((char *)buf2, in_size, 1, "dmp_print_page(buf2)");
+ gs_free((char *)buf1, in_size, 1, "dmp_print_page(buf1)");
+ return 0;
}
diff --git a/gs/src/gdevbbox.c b/gs/src/gdevbbox.c
index 09e087d40..84243cce1 100644
--- a/gs/src/gdevbbox.c
+++ b/gs/src/gdevbbox.c
@@ -26,6 +26,7 @@
#include "gxdevice.h"
#include "gsdevice.h" /* requires gsmatrix.h */
#include "gdevbbox.h"
+#include "gxdcolor.h" /* for gx_device_black/white */
#include "gxiparam.h" /* for image source size */
#include "gxistate.h"
#include "gxpaint.h"
@@ -55,6 +56,8 @@ private dev_proc_draw_thin_line(bbox_draw_thin_line);
private dev_proc_strip_tile_rectangle(bbox_strip_tile_rectangle);
private dev_proc_strip_copy_rop(bbox_strip_copy_rop);
private dev_proc_begin_typed_image(bbox_begin_typed_image);
+private dev_proc_create_compositor(bbox_create_compositor);
+private dev_proc_text_begin(bbox_text_begin);
/* The device prototype */
/*
@@ -74,7 +77,7 @@ private dev_proc_begin_typed_image(bbox_begin_typed_image);
* the page size in inches is limited to the maximum representable pixel
* size divided by R, which gives a limit of about 120" in each dimension.
*/
-#define max_coord (min(max_int, fixed2int(max_fixed)) - 1000)
+#define max_coord (max_int_in_fixed - 1000)
#define max_resolution 4000
gx_device_bbox far_data gs_bbox_device =
{
@@ -118,8 +121,12 @@ gx_device_bbox far_data gs_bbox_device =
bbox_strip_tile_rectangle,
bbox_strip_copy_rop,
NULL, /* get_clipping_box */
+ bbox_begin_typed_image,
+ NULL, /* get_bits_rectangle */
+ NULL, /* map_color_rgb_alpha */
+ bbox_create_compositor,
NULL, /* get_hardware_params */
- bbox_begin_typed_image
+ bbox_text_begin
},
0, /* target */
1 /*true *//* free_standing */
@@ -151,10 +158,7 @@ bbox_copy_params(gx_device_bbox * bdev, bool remap_white)
#undef COPY_ARRAY_PARAM
}
if (remap_white)
- bdev->white =
- (*dev_proc(bdev, map_rgb_color))
- ((gx_device *) bdev, gx_max_color_value, gx_max_color_value,
- gx_max_color_value);
+ bdev->white = gx_device_white((gx_device *)bdev);
}
#define gx_dc_is_white(pdevc, bdev)\
@@ -935,3 +939,138 @@ bbox_image_end_image(gx_device * dev, gx_image_enum_common_t * info,
gs_free_object(pbe->memory, pbe, "bbox_end_image");
return code;
}
+
+private int
+bbox_create_compositor(gx_device * dev,
+ gx_device ** pcdev, const gs_composite_t * pcte,
+ const gs_imager_state * pis, gs_memory_t * memory)
+{
+ gx_device_bbox *const bdev = (gx_device_bbox *) dev;
+ gx_device *target = bdev->target;
+
+ /*
+ * If there isn't a target, all we care about is the bounding box,
+ * so don't bother with actually compositing.
+ */
+ if (target == 0) {
+ *pcdev = dev;
+ return 0;
+ }
+ /*
+ * Create a compositor for the target, and then wrap another
+ * bbox device around it, but still accumulating the bounding
+ * box in the same place.
+ */
+ {
+ gx_device *cdev;
+ gx_device_bbox *bbcdev;
+ int code = (*dev_proc(target, create_compositor))
+ (target, &cdev, pcte, pis, memory);
+
+ if (code < 0)
+ return code;
+ bbcdev = gs_alloc_struct_immovable(memory, gx_device_bbox,
+ &st_device_bbox,
+ "bbox_create_compositor");
+ if (bbcdev == 0) {
+ (*dev_proc(cdev, close_device)) (cdev);
+ return_error(gs_error_VMerror);
+ }
+ gx_device_bbox_init(bbcdev, target);
+ bbcdev->target = cdev;
+ bbcdev->box_device = bdev;
+ *pcdev = (gx_device *) bbcdev;
+ return 0;
+ }
+}
+
+/* ------ Text imaging ------ */
+
+extern_st(st_gs_text_enum);
+
+typedef struct bbox_text_enum_s {
+ gs_text_enum_common;
+ gs_text_enum_t *target_info;
+} bbox_text_enum;
+
+gs_private_st_suffix_add1(st_bbox_text_enum, bbox_text_enum, "bbox_text_enum",
+ bbox_text_enum_enum_ptrs, bbox_text_enum_reloc_ptrs,
+ st_gs_text_enum, target_info);
+
+private text_enum_proc_process(bbox_text_process);
+private text_enum_proc_set_cache(bbox_text_set_cache);
+private rc_free_proc(bbox_text_free);
+
+private const gs_text_enum_procs_t bbox_text_procs =
+{
+ bbox_text_process, bbox_text_set_cache
+};
+
+private int
+bbox_text_begin(gx_device * dev, gs_imager_state * pis,
+ const gs_text_params_t * text, const gs_font * font,
+gx_path * path, const gx_device_color * pdcolor, const gx_clip_path * pcpath,
+ gs_memory_t * memory, gs_text_enum_t ** ppenum)
+{
+ gx_device_bbox *const bdev = (gx_device_bbox *) dev;
+ gx_device *tdev = bdev->target;
+ bbox_text_enum *pbte;
+ int code;
+
+ if (tdev == 0)
+ return gx_default_text_begin(dev, pis, text, font, path, pdcolor,
+ pcpath, memory, ppenum);
+ rc_alloc_struct_1(pbte, bbox_text_enum, &st_bbox_text_enum, memory,
+ return_error(gs_error_VMerror),
+ "bbox_text_begin");
+ pbte->rc.free = bbox_text_free;
+ code =
+ (*dev_proc(tdev, text_begin))
+ (tdev, pis, text, font, path, pdcolor, pcpath, memory,
+ &pbte->target_info);
+ if (code < 0) {
+ gs_free_object(memory, pbte, "bbox_text_begin");
+ return code;
+ }
+ *(gs_text_enum_t *) pbte = *pbte->target_info; /* copy common info */
+ pbte->procs = &bbox_text_procs;
+ *ppenum = (gs_text_enum_t *) pbte;
+ return code;
+}
+
+private int
+bbox_text_process(gs_text_enum_t * pte)
+{
+ bbox_text_enum *const pbte = (bbox_text_enum *) pte;
+ int code = gs_text_process(pbte->target_info);
+
+ if (code < 0)
+ return code;
+ /* Copy back the dynamic information for the client. */
+ pte->index = pbte->target_info->index;
+ return code;
+}
+
+private int
+bbox_text_set_cache(gs_text_enum_t * pte, const double *values,
+ gs_text_cache_control_t control)
+{
+ bbox_text_enum *const pbte = (bbox_text_enum *) pte;
+ gs_text_enum_t *tpte = pbte->target_info;
+ int code = tpte->procs->set_cache(tpte, values, control);
+
+ if (code < 0)
+ return code;
+ /* Copy back the dynamic information for the client. */
+ pte->index = tpte->index;
+ return code;
+}
+
+private void
+bbox_text_free(gs_memory_t * memory, void *vpte, client_name_t cname)
+{
+ bbox_text_enum *const pbte = (bbox_text_enum *) vpte;
+
+ gs_text_release(pbte->target_info, cname);
+ rc_free_struct_only(memory, vpte, cname);
+}
diff --git a/gs/src/gdevbbox.h b/gs/src/gdevbbox.h
index 3b6d1bf44..23a06d44e 100644
--- a/gs/src/gdevbbox.h
+++ b/gs/src/gdevbbox.h
@@ -1,25 +1,27 @@
/* Copyright (C) 1996, 1997, 1998 Aladdin Enterprises. All rights reserved.
-
- This file is part of Aladdin Ghostscript.
-
- Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
- or distributor accepts any responsibility for the consequences of using it,
- or for whether it serves any particular purpose or works at all, unless he
- or she says so in writing. Refer to the Aladdin Ghostscript Free Public
- License (the "License") for full details.
-
- Every copy of Aladdin Ghostscript must include a copy of the License,
- normally in a plain ASCII text file named PUBLIC. The License grants you
- the right to copy, modify and redistribute Aladdin Ghostscript, but only
- under certain conditions described in the License. Among other things, the
- License requires that the copyright notice and this notice be preserved on
- all copies.
-*/
-/*Id: gdevbbox.h */
-/* Interface to bounding box device */
+ This file is part of Aladdin Ghostscript.
+
+ Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
+ or distributor accepts any responsibility for the consequences of using it,
+ or for whether it serves any particular purpose or works at all, unless he
+ or she says so in writing. Refer to the Aladdin Ghostscript Free Public
+ License (the "License") for full details.
+
+ Every copy of Aladdin Ghostscript must include a copy of the License,
+ normally in a plain ASCII text file named PUBLIC. The License grants you
+ the right to copy, modify and redistribute Aladdin Ghostscript, but only
+ under certain conditions described in the License. Among other things, the
+ License requires that the copyright notice and this notice be preserved on
+ all copies.
+ */
+
+/*Id: gdevbbox.h */
/* Requires gxdevice.h */
+#ifndef gdevbbox_INCLUDED
+# define gdevbbox_INCLUDED
+
/*
* This device keeps track of the per-page bounding box, and also optionally
* forwards all drawing commands to a target. It can be used either as a
@@ -34,34 +36,34 @@
* The other way to use a bounding box device is from C code as a component
* in a device pipeline. To set up a bounding box device that doesn't do
* any drawing:
- * gx_device_bbox *bdev =
- * gs_alloc_struct_immovable(some_memory,
- * gx_device_bbox, &st_device_bbox,
- * "some identifying string for debugging");
- * gx_device_bbox_init(bdev, NULL);
+ * gx_device_bbox *bdev =
+ * gs_alloc_struct_immovable(some_memory,
+ * gx_device_bbox, &st_device_bbox,
+ * "some identifying string for debugging");
+ * gx_device_bbox_init(bdev, NULL);
* Non-drawing bounding box devices have an "infinite" page size.
*
* To set up a bounding box device that draws to another device tdev:
- * gx_device_bbox *bdev =
- * gs_alloc_struct_immovable(some_memory,
- * gx_device_bbox, &st_device_bbox,
- * "some identifying string for debugging");
- * gx_device_bbox_init(bdev, tdev);
+ * gx_device_bbox *bdev =
+ * gs_alloc_struct_immovable(some_memory,
+ * gx_device_bbox, &st_device_bbox,
+ * "some identifying string for debugging");
+ * gx_device_bbox_init(bdev, tdev);
* Bounding box devices that draw to a real device appear to have the
* same page size as that device.
*
* To intercept the end-of-page to call a routine eop of your own, after
* setting up the device:
- * dev_proc_output_page(eop); -- declare a prototype for eop
- * ...
- * set_dev_proc(bdev, output_page, eop);
- * ...
- * int eop(gx_device *dev, int num_copies, int flush)
- * { gs_rect bbox;
- * gx_device_bbox_bbox((gx_device_bbox *)dev, &bbox);
- * << do whatever you want >>
- * return gx_forward_output_page(dev, num_copies, flush);
- * }
+ * dev_proc_output_page(eop); -- declare a prototype for eop
+ * ...
+ * set_dev_proc(bdev, output_page, eop);
+ * ...
+ * int eop(gx_device *dev, int num_copies, int flush)
+ * { gs_rect bbox;
+ * gx_device_bbox_bbox((gx_device_bbox *)dev, &bbox);
+ * << do whatever you want >>
+ * return gx_forward_output_page(dev, num_copies, flush);
+ * }
*/
#define gx_device_bbox_common\
gx_device_forward_common;\
@@ -74,8 +76,9 @@
gx_color_index white
typedef struct gx_device_bbox_s gx_device_bbox;
struct gx_device_bbox_s {
- gx_device_bbox_common;
+ gx_device_bbox_common;
};
+
extern_st(st_device_bbox);
#define public_st_device_bbox() /* in gdevbbox.c */\
gs_public_st_suffix_add1_final(st_device_bbox, gx_device_bbox,\
@@ -83,7 +86,9 @@ extern_st(st_device_bbox);
gx_device_finalize, st_device_forward, box_device)
/* Initialize a bounding box device. */
-void gx_device_bbox_init(P2(gx_device_bbox *dev, gx_device *target));
+void gx_device_bbox_init(P2(gx_device_bbox * dev, gx_device * target));
/* Read back the bounding box in 1/72" units. */
-void gx_device_bbox_bbox(P2(gx_device_bbox *dev, gs_rect *pbbox));
+void gx_device_bbox_bbox(P2(gx_device_bbox * dev, gs_rect * pbbox));
+
+#endif /* gdevbbox_INCLUDED */
diff --git a/gs/src/gdevbit.c b/gs/src/gdevbit.c
index 68e8e9eb7..8cd71cac9 100644
--- a/gs/src/gdevbit.c
+++ b/gs/src/gdevbit.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1995, 1996 Aladdin Enterprises. All rights reserved.
+/* Copyright (C) 1991, 1995, 1996, 1997, 1998 Aladdin Enterprises. All rights reserved.
This file is part of Aladdin Ghostscript.
@@ -16,10 +16,12 @@
all copies.
*/
-/* gdevbit.c */
+/*Id: gdevbit.c */
/* "Plain bits" devices to measure rendering time. */
#include "gdevprn.h"
#include "gsparam.h"
+#include "gscrd.h"
+#include "gscrdp.h"
#include "gxlum.h"
/*
@@ -50,6 +52,7 @@ private dev_proc_map_rgb_color(bit_mono_map_rgb_color);
private dev_proc_map_rgb_color(bit_map_rgb_color);
private dev_proc_map_color_rgb(bit_map_color_rgb);
private dev_proc_map_cmyk_color(bit_map_cmyk_color);
+private dev_proc_put_params(bit_get_params);
private dev_proc_put_params(bit_put_params);
private dev_proc_print_page(bit_print_page);
@@ -67,7 +70,7 @@ private dev_proc_print_page(bit_print_page);
NULL, /* copy_color */\
NULL, /* draw_line */\
NULL, /* get_bits */\
- gdev_prn_get_params,\
+ bit_get_params,\
bit_put_params,\
map_cmyk_color,\
NULL, /* get_xfont_procs */\
@@ -76,9 +79,9 @@ private dev_proc_print_page(bit_print_page);
gx_page_device_get_page_device /* get_page_device */\
}
-private gx_device_procs bitmono_procs =
+private const gx_device_procs bitmono_procs =
bit_procs(bit_mono_map_rgb_color, NULL);
-gx_device_printer far_data gs_bit_device =
+const gx_device_printer gs_bit_device =
{prn_device_body(gx_device_printer, bitmono_procs, "bit",
DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
X_DPI, Y_DPI,
@@ -86,9 +89,9 @@ gx_device_printer far_data gs_bit_device =
1, 1, 1, 0, 2, 1, bit_print_page)
};
-private gx_device_procs bitrgb_procs =
+private const gx_device_procs bitrgb_procs =
bit_procs(bit_map_rgb_color, NULL);
-gx_device_printer far_data gs_bitrgb_device =
+const gx_device_printer gs_bitrgb_device =
{prn_device_body(gx_device_printer, bitrgb_procs, "bitrgb",
DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
X_DPI, Y_DPI,
@@ -96,9 +99,9 @@ gx_device_printer far_data gs_bitrgb_device =
3, 4, 1, 1, 2, 2, bit_print_page)
};
-private gx_device_procs bitcmyk_procs =
+private const gx_device_procs bitcmyk_procs =
bit_procs(NULL, bit_map_cmyk_color);
-gx_device_printer far_data gs_bitcmyk_device =
+const gx_device_printer gs_bitcmyk_device =
{prn_device_body(gx_device_printer, bitcmyk_procs, "bitcmyk",
DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
X_DPI, Y_DPI,
@@ -203,6 +206,64 @@ bit_map_cmyk_color(gx_device * dev, gx_color_value cyan,
return (color == gx_no_color_index ? color ^ 1 : color);
}
+/* Get parameters. We provide a default CRD. */
+private int
+my_tpqr(int index, floatp in, const gs_cie_wbsd * pwbsd,
+ gs_cie_render * pcrd, float *out)
+{
+ *out = (in < 0.5 ? in / 2 : in * 3 / 2 - 0.5);
+ return 0;
+}
+private int
+bit_get_params(gx_device * pdev, gs_param_list * plist)
+{
+ int ecode = gdev_prn_get_params(pdev, plist);
+ int code;
+
+ if (param_requested(plist, "CRDDefault") > 0) {
+ gs_cie_render *pcrd;
+
+ code = gs_cie_render1_build(&pcrd, pdev->memory, "bit_get_params");
+ if (code >= 0) {
+ static const gs_vector3 my_white_point = {1, 1, 1};
+ static const gs_cie_transform_proc3 my_TransformPQR = {
+ 0, "bitTPQRDefault", {0, 0}, 0
+ };
+ gs_cie_transform_proc3 tpqr;
+
+ tpqr = my_TransformPQR;
+ tpqr.driver_name = pdev->dname;
+ code = gs_cie_render1_initialize(pcrd, NULL,
+ &my_white_point, NULL,
+ NULL, NULL, &tpqr,
+ NULL, NULL, NULL,
+ NULL, NULL, NULL,
+ NULL);
+ if (code >= 0) {
+ code = param_write_cie_render1(plist, "CRDDefault", pcrd,
+ pdev->memory);
+ }
+ rc_decrement(pcrd, "bit_get_params"); /* release */
+ }
+ if (code < 0)
+ ecode = code;
+ }
+ if (param_requested(plist, "bitTPQRDefault") > 0) {
+ gs_cie_transform_proc my_proc = my_tpqr;
+ static byte my_addr[sizeof(gs_cie_transform_proc)];
+ gs_param_string as;
+
+ memcpy(my_addr, &my_proc, sizeof(gs_cie_transform_proc));
+ as.data = my_addr;
+ as.size = sizeof(gs_cie_transform_proc);
+ as.persistent = true;
+ code = param_write_string(plist, "bitTPQRDefault", &as);
+ if (code < 0)
+ ecode = code;
+ }
+ return ecode;
+}
+
/* Set parameters. We allow setting the number of bits per component. */
private int
bit_put_params(gx_device * pdev, gs_param_list * plist)
@@ -220,7 +281,7 @@ bit_put_params(gx_device * pdev, gs_param_list * plist)
{4, 8, 0, 16, 16, 0, 0, 24},
{4, 8, 0, 16, 32, 0, 0, 32}
};
- const char _ds *vname;
+ const char *vname;
if ((code = param_read_int(plist, (vname = "GrayValues"), &v)) != 1 ||
(code = param_read_int(plist, (vname = "RedValues"), &v)) != 1 ||
diff --git a/gs/src/gdevbj10.c b/gs/src/gdevbj10.c
index bef716cf9..ae6f27520 100644
--- a/gs/src/gdevbj10.c
+++ b/gs/src/gdevbj10.c
@@ -1,22 +1,22 @@
/* Copyright (C) 1990, 1995, 1997 Aladdin Enterprises. All rights reserved.
-
- This file is part of Aladdin Ghostscript.
-
- Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
- or distributor accepts any responsibility for the consequences of using it,
- or for whether it serves any particular purpose or works at all, unless he
- or she says so in writing. Refer to the Aladdin Ghostscript Free Public
- License (the "License") for full details.
-
- Every copy of Aladdin Ghostscript must include a copy of the License,
- normally in a plain ASCII text file named PUBLIC. The License grants you
- the right to copy, modify and redistribute Aladdin Ghostscript, but only
- under certain conditions described in the License. Among other things, the
- License requires that the copyright notice and this notice be preserved on
- all copies.
- */
-
-/* gdevbj10.c */
+
+ This file is part of Aladdin Ghostscript.
+
+ Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
+ or distributor accepts any responsibility for the consequences of using it,
+ or for whether it serves any particular purpose or works at all, unless he
+ or she says so in writing. Refer to the Aladdin Ghostscript Free Public
+ License (the "License") for full details.
+
+ Every copy of Aladdin Ghostscript must include a copy of the License,
+ normally in a plain ASCII text file named PUBLIC. The License grants you
+ the right to copy, modify and redistribute Aladdin Ghostscript, but only
+ under certain conditions described in the License. Among other things, the
+ License requires that the copyright notice and this notice be preserved on
+ all copies.
+*/
+
+/*Id: gdevbj10.c */
/* Canon Bubble Jet BJ-10e and BJ200 printer driver */
#include "gdevprn.h"
@@ -84,16 +84,16 @@ private dev_proc_open_device(bj200_open);
private dev_proc_print_page(bj10e_print_page);
private gx_device_procs prn_bj200_procs =
-prn_procs(bj200_open, gdev_prn_output_page, gdev_prn_close);
+ prn_procs(bj200_open, gdev_prn_output_page, gdev_prn_close);
gx_device_printer far_data gs_bj200_device =
-prn_device(prn_bj200_procs, "bj200",
- DEFAULT_WIDTH_10THS,
- DEFAULT_HEIGHT_10THS,
- 360, /* x_dpi */
- 360, /* y_dpi */
- 0, 0, 0, 0, /* margins filled in by bj200_open */
- 1, bj10e_print_page);
+ prn_device(prn_bj200_procs, "bj200",
+ DEFAULT_WIDTH_10THS,
+ DEFAULT_HEIGHT_10THS,
+ 360, /* x_dpi */
+ 360, /* y_dpi */
+ 0, 0, 0, 0, /* margins filled in by bj200_open */
+ 1, bj10e_print_page);
/*
* (<simon@pogner.demon.co.uk>, aka <sjwright@cix.compulink.co.uk>):
@@ -102,285 +102,284 @@ prn_device(prn_bj200_procs, "bj200",
*/
gx_device_printer far_data gs_bj10e_device =
-prn_device(prn_bj200_procs, "bj10e",
- DEFAULT_WIDTH_10THS,
- DEFAULT_HEIGHT_10THS,
- 360, /* x_dpi */
- 360, /* y_dpi */
- 0, 0, 0, 0, /* margins */
- 1, bj10e_print_page);
+ prn_device(prn_bj200_procs, "bj10e",
+ DEFAULT_WIDTH_10THS,
+ DEFAULT_HEIGHT_10THS,
+ 360, /* x_dpi */
+ 360, /* y_dpi */
+ 0,0,0,0, /* margins */
+ 1, bj10e_print_page);
/*
* Notes on the BJ10e/BJ200 command set.
*
- According to the BJ200 manual, the "set initial condition" sequence (ESC [
- K) has 2 bytes which can override the DIP switches -- these are the last 2
- bytes. Several bits are listed as "reserved" -- one or more may possibly
- affect the sheet feeder. The first is referred to as <P1>, with the
- following meaning:
- 1 0
- bit 7 ignore/process P1 ignore process
- bit 6 reserved
- bit 5 alarm disabled enabled
- bit 4 automatic CR CR+LF CR
- bit 3 automatic LF CR+LF LF
- bit 2 page length 12 inches 11 inches
- bit 1 style for zero slashed not slashed
- bit 0 character set set 2 set 1
-
- The last byte is <P2>, with the following meaning:
- 1 0
- bit 7 ignore/process P2 ignore process
- bit 6 code page 850 437
- bit 5 reserved
- bit 4 reserved
- bit 3 reserved
- bit 2 reserved
- bit 1 reserved
- bit 0 reserved
-
- The automatic CR setting is important to gs, but the rest shouldn't matter
- (gs doesn't print characters or send LF, and it explicitly sets the page
- length). The sequence ESC 5 <n> controls automatic CR -- if <n> is 0x00,
- it is turned off (CR only) and if <n> is 0x01, it is turned on (CR + LF).
- So we do following: Change the initialization string to so that the last 2
- of the 9 bytes are \200 rather than \000. Then add
- |* Turn off automatic carriage return, otherwise we get line feeds. *|
- fwrite("\0335\000", 1, 3, prn_stream);
- after the initialization. (Actually, instead of setting the last 2 bytes
- to \200, we suppress them altogether by changing the byte count from \004
- to \002 (the byte count is the 4th (low 8 bits) and 5th (high 8 bits) bytes
- in the initialization sequence).)
-
- */
+According to the BJ200 manual, the "set initial condition" sequence (ESC [
+K) has 2 bytes which can override the DIP switches -- these are the last 2
+bytes. Several bits are listed as "reserved" -- one or more may possibly
+affect the sheet feeder. The first is referred to as <P1>, with the
+following meaning:
+ 1 0
+bit 7 ignore/process P1 ignore process
+bit 6 reserved
+bit 5 alarm disabled enabled
+bit 4 automatic CR CR+LF CR
+bit 3 automatic LF CR+LF LF
+bit 2 page length 12 inches 11 inches
+bit 1 style for zero slashed not slashed
+bit 0 character set set 2 set 1
+
+The last byte is <P2>, with the following meaning:
+ 1 0
+bit 7 ignore/process P2 ignore process
+bit 6 code page 850 437
+bit 5 reserved
+bit 4 reserved
+bit 3 reserved
+bit 2 reserved
+bit 1 reserved
+bit 0 reserved
+
+The automatic CR setting is important to gs, but the rest shouldn't matter
+(gs doesn't print characters or send LF, and it explicitly sets the page
+length). The sequence ESC 5 <n> controls automatic CR -- if <n> is 0x00,
+it is turned off (CR only) and if <n> is 0x01, it is turned on (CR + LF).
+So we do following: Change the initialization string to so that the last 2
+of the 9 bytes are \200 rather than \000. Then add
+ |* Turn off automatic carriage return, otherwise we get line feeds. *|
+ fwrite("\0335\000", 1, 3, prn_stream);
+after the initialization. (Actually, instead of setting the last 2 bytes
+to \200, we suppress them altogether by changing the byte count from \004
+to \002 (the byte count is the 4th (low 8 bits) and 5th (high 8 bits) bytes
+in the initialization sequence).)
+
+*/
/* ------ Internal routines ------ */
/* Open the printer, and set the margins. */
private int
-bj200_open(gx_device * pdev)
+bj200_open(gx_device *pdev)
{
- /* Change the margins according to the paper size.
- The top and bottom margins don't seem to depend on the
- page length, but on the paper handling mechanism;
- The side margins do depend on the paper width, as the
- printer centres the 8" print line on the page. */
-
- static const float a4_margins[4] =
- {BJ200_A4_SIDE_MARGIN, BJ200_BOTTOM_MARGIN,
- BJ200_A4_SIDE_MARGIN, BJ200_TOP_MARGIN
- };
- static const float letter_margins[4] =
- {BJ200_LETTER_SIDE_MARGIN, BJ200_BOTTOM_MARGIN,
- BJ200_LETTER_SIDE_MARGIN, BJ200_TOP_MARGIN
- };
-
- gx_device_set_margins(pdev,
- (pdev->width / pdev->x_pixels_per_inch <= 8.4 ?
- a4_margins : letter_margins),
- true);
- return gdev_prn_open(pdev);
+ /* Change the margins according to the paper size.
+ The top and bottom margins don't seem to depend on the
+ page length, but on the paper handling mechanism;
+ The side margins do depend on the paper width, as the
+ printer centres the 8" print line on the page. */
+
+ static const float a4_margins[4] =
+ { BJ200_A4_SIDE_MARGIN, BJ200_BOTTOM_MARGIN,
+ BJ200_A4_SIDE_MARGIN, BJ200_TOP_MARGIN
+ };
+ static const float letter_margins[4] =
+ { BJ200_LETTER_SIDE_MARGIN, BJ200_BOTTOM_MARGIN,
+ BJ200_LETTER_SIDE_MARGIN, BJ200_TOP_MARGIN
+ };
+
+ gx_device_set_margins(pdev,
+ (pdev->width / pdev->x_pixels_per_inch <= 8.4 ?
+ a4_margins : letter_margins),
+ true);
+ return gdev_prn_open(pdev);
}
/* Send the page to the printer. */
private int
-bj10e_print_page(gx_device_printer * pdev, FILE * prn_stream)
-{
- int line_size = gx_device_raster((gx_device *) pdev, 0);
- int xres = pdev->x_pixels_per_inch;
- int yres = pdev->y_pixels_per_inch;
- int mode = (yres == 180 ?
- (xres == 180 ? 11 : 12) :
- (xres == 180 ? 14 : 16));
- int bytes_per_column = (yres == 180) ? 3 : 6;
- int bits_per_column = bytes_per_column * 8;
- int skip_unit = bytes_per_column * 3;
- byte *in = (byte *) gs_malloc(8, line_size, "bj10e_print_page(in)");
- byte *out = (byte *) gs_malloc(bits_per_column, line_size, "bj10e_print_page(out)");
- int lnum = 0;
- int skip = 0;
- int code = 0;
- int last_row = dev_print_scan_lines(pdev);
- int limit = last_row - bits_per_column;
-
- if (in == 0 || out == 0) {
- code = gs_note_error(gs_error_VMerror);
- goto fin;
- }
- /* Initialize the printer. */
+bj10e_print_page(gx_device_printer *pdev, FILE *prn_stream)
+{ int line_size = gx_device_raster((gx_device *)pdev, 0);
+ int xres = pdev->x_pixels_per_inch;
+ int yres = pdev->y_pixels_per_inch;
+ int mode = (yres == 180 ?
+ (xres == 180 ? 11 : 12) :
+ (xres == 180 ? 14 : 16));
+ int bytes_per_column = (yres == 180) ? 3 : 6;
+ int bits_per_column = bytes_per_column * 8;
+ int skip_unit = bytes_per_column * 3;
+ byte *in = (byte *)gs_malloc(8, line_size, "bj10e_print_page(in)");
+ byte *out = (byte *)gs_malloc(bits_per_column, line_size, "bj10e_print_page(out)");
+ int lnum = 0;
+ int skip = 0;
+ int code = 0;
+ int last_row = dev_print_scan_lines(pdev);
+ int limit = last_row - bits_per_column;
+
+ if ( in == 0 || out == 0 )
+ { code = gs_note_error(gs_error_VMerror);
+ goto fin;
+ }
+
+ /* Initialize the printer. */
#ifdef USE_FACTORY_DEFAULTS
- /* Check for U.S. letter vs. A4 paper. */
- fwrite((pdev->width / pdev->x_pixels_per_inch <= 8.4 ?
- "\033[K\002\000\000\044" /*A4--DIP switch defaults */ :
- "\033[K\002\000\004\044" /*letter--factory defaults */ ),
- 1, 7, prn_stream);
+ /* Check for U.S. letter vs. A4 paper. */
+ fwrite(( pdev->width / pdev->x_pixels_per_inch <= 8.4 ?
+ "\033[K\002\000\000\044" /*A4--DIP switch defaults*/ :
+ "\033[K\002\000\004\044" /*letter--factory defaults*/ ),
+ 1, 7, prn_stream);
#else
- fwrite("\033[K\002\000\000\044", 1, 7, prn_stream);
+ fwrite("\033[K\002\000\000\044", 1, 7, prn_stream);
#endif
- /* Turn off automatic carriage return, otherwise we get line feeds. */
- fwrite("\0335\000", 1, 3, prn_stream);
-
- /* Set vertical spacing. */
- fwrite("\033[\\\004\000\000\000", 1, 7, prn_stream);
- fputc(yres & 0xff, prn_stream);
- fputc(yres >> 8, prn_stream);
-
- /* Set the page length. This is the printable length, in inches. */
- fwrite("\033C\000", 1, 3, prn_stream);
- fputc((last_row + yres - 1) / yres, prn_stream);
-
- /* Transfer pixels to printer. The last row we can print is defined
- by "last_row". Only the bottom of the print head can print at the
- bottom margin, and so we align the final printing pass. The print
- head is kept from moving below "limit", which is exactly one pass
- above the bottom margin. Once it reaches this limit, we make our
- final printing pass of a full "bits_per_column" rows. */
- while (lnum < last_row) {
- byte *in_data;
- byte *in_end = in + line_size;
- byte *out_beg = out;
- byte *out_end = out + bytes_per_column * pdev->width;
- byte *outl = out;
- int bnum;
-
- /* Copy 1 scan line and test for all zero. */
- code = gdev_prn_get_bits(pdev, lnum, in, &in_data);
- if (code < 0)
- goto xit;
- /* The mem... or str... functions should be faster than */
- /* the following code, but all systems seem to implement */
- /* them so badly that this code is faster. */
- {
- register const long *zip = (const long *)in_data;
- register int zcnt = line_size;
- register const byte *zipb;
- for (; zcnt >= 4 * sizeof(long); zip += 4, zcnt -= 4 * sizeof(long)) {
- if (zip[0] | zip[1] | zip[2] | zip[3])
- goto notz;
- }
- zipb = (const byte *)zip;
- while (--zcnt >= 0) {
- if (*zipb++)
- goto notz;
- }
- /* Line is all zero, skip */
- lnum++;
- skip++;
- continue;
- notz:;
- }
-
- /* Vertical tab to the appropriate position. Note here that
- we make sure we don't move below limit. */
- if (lnum > limit) {
- skip -= (lnum - limit);
- lnum = limit;
- }
- while (skip > 255) {
- fputs("\033J\377", prn_stream);
- skip -= 255;
- }
- if (skip)
- fprintf(prn_stream, "\033J%c", skip);
-
- /* If we've printed as far as "limit", then reset "limit"
- to "last_row" for the final printing pass. */
- if (lnum == limit)
- limit = last_row;
- skip = 0;
-
- /* Transpose in blocks of 8 scan lines. */
- for (bnum = 0; bnum < bits_per_column; bnum += 8) {
- int lcnt = min(8, limit - lnum);
- byte *inp = in;
- byte *outp = outl;
-
- lcnt = gdev_prn_copy_scan_lines(pdev,
- lnum, in, lcnt * line_size);
- if (lcnt < 0) {
- code = lcnt;
- goto xit;
- }
- if (lcnt < 8)
- memset(in + lcnt * line_size, 0,
- (8 - lcnt) * line_size);
- for (; inp < in_end; inp++, outp += bits_per_column) {
- gdev_prn_transpose_8x8(inp, line_size,
- outp, bytes_per_column);
- }
- outl++;
- lnum += lcnt;
- skip += lcnt;
- }
-
- /* Send the bits to the printer. We alternate horizontal
- skips with the data. The horizontal skips are in units
- of 1/120 inches, so we look at the data in groups of
- 3 columns, since 3/360 = 1/120, and 3/180 = 2/120. */
- outl = out;
- do {
- int count;
- int n;
- byte *out_ptr;
-
- /* First look for blank groups of columns. */
- while (outl < out_end) {
- n = count = min(out_end - outl, skip_unit);
- out_ptr = outl;
- while (--count >= 0) {
- if (*out_ptr++)
- break;
- }
- if (count >= 0)
- break;
- else
- outl = out_ptr;
- }
- if (outl >= out_end)
- break;
- if (outl > out_beg) {
- count = (outl - out_beg) / skip_unit;
- if (xres == 180)
- count <<= 1;
- fprintf(prn_stream, "\033d%c%c",
- count & 0xff, count >> 8);
- }
- /* Next look for non-blank groups of columns. */
- out_beg = outl;
- outl += n;
- while (outl < out_end) {
- n = count = min(out_end - outl, skip_unit);
- out_ptr = outl;
- while (--count >= 0) {
- if (*out_ptr++)
- break;
- }
- if (count < 0)
- break;
- else
- outl += n;
- }
- count = outl - out_beg + 1;
- fprintf(prn_stream, "\033[g%c%c%c",
- count & 0xff, count >> 8, mode);
- fwrite(out_beg, 1, count - 1, prn_stream);
- out_beg = outl;
- outl += n;
- }
- while (out_beg < out_end);
-
- fputc('\r', prn_stream);
- }
-
- /* Eject the page */
- xit:fputc(014, prn_stream); /* form feed */
- fflush(prn_stream);
- fin:if (out != 0)
- gs_free((char *)out, bits_per_column, line_size,
- "bj10e_print_page(out)");
- if (in != 0)
- gs_free((char *)in, 8, line_size, "bj10e_print_page(in)");
- return code;
+ /* Turn off automatic carriage return, otherwise we get line feeds. */
+ fwrite("\0335\000", 1, 3, prn_stream);
+
+ /* Set vertical spacing. */
+ fwrite("\033[\\\004\000\000\000", 1, 7, prn_stream);
+ fputc(yres & 0xff, prn_stream);
+ fputc(yres >> 8, prn_stream);
+
+ /* Set the page length. This is the printable length, in inches. */
+ fwrite("\033C\000", 1, 3, prn_stream);
+ fputc((last_row + yres - 1)/yres, prn_stream);
+
+ /* Transfer pixels to printer. The last row we can print is defined
+ by "last_row". Only the bottom of the print head can print at the
+ bottom margin, and so we align the final printing pass. The print
+ head is kept from moving below "limit", which is exactly one pass
+ above the bottom margin. Once it reaches this limit, we make our
+ final printing pass of a full "bits_per_column" rows. */
+ while ( lnum < last_row )
+ {
+ byte *in_data;
+ byte *in_end = in + line_size;
+ byte *out_beg = out;
+ byte *out_end = out + bytes_per_column * pdev->width;
+ byte *outl = out;
+ int bnum;
+
+ /* Copy 1 scan line and test for all zero. */
+ code = gdev_prn_get_bits(pdev, lnum, in, &in_data);
+ if ( code < 0 ) goto xit;
+ /* The mem... or str... functions should be faster than */
+ /* the following code, but all systems seem to implement */
+ /* them so badly that this code is faster. */
+ { register const long *zip = (const long *)in_data;
+ register int zcnt = line_size;
+ register const byte *zipb;
+ for ( ; zcnt >= 4 * sizeof(long); zip += 4, zcnt -= 4 * sizeof(long) )
+ { if ( zip[0] | zip[1] | zip[2] | zip[3] )
+ goto notz;
+ }
+ zipb = (const byte *)zip;
+ while ( --zcnt >= 0 )
+ {
+ if ( *zipb++ )
+ goto notz;
+ }
+ /* Line is all zero, skip */
+ lnum++;
+ skip++;
+ continue;
+notz: ;
+ }
+
+ /* Vertical tab to the appropriate position. Note here that
+ we make sure we don't move below limit. */
+ if ( lnum > limit )
+ { skip -= (lnum - limit);
+ lnum = limit;
+ }
+ while ( skip > 255 )
+ { fputs("\033J\377", prn_stream);
+ skip -= 255;
+ }
+ if ( skip )
+ fprintf(prn_stream, "\033J%c", skip);
+
+ /* If we've printed as far as "limit", then reset "limit"
+ to "last_row" for the final printing pass. */
+ if ( lnum == limit )
+ limit = last_row;
+ skip = 0;
+
+ /* Transpose in blocks of 8 scan lines. */
+ for ( bnum = 0; bnum < bits_per_column; bnum += 8 )
+ { int lcnt = min(8, limit - lnum);
+ byte *inp = in;
+ byte *outp = outl;
+ lcnt = gdev_prn_copy_scan_lines(pdev,
+ lnum, in, lcnt * line_size);
+ if ( lcnt < 0 )
+ { code = lcnt;
+ goto xit;
+ }
+ if ( lcnt < 8 )
+ memset(in + lcnt * line_size, 0,
+ (8 - lcnt) * line_size);
+ for ( ; inp < in_end; inp++, outp += bits_per_column )
+ { gdev_prn_transpose_8x8(inp, line_size,
+ outp, bytes_per_column);
+ }
+ outl++;
+ lnum += lcnt;
+ skip += lcnt;
+ }
+
+ /* Send the bits to the printer. We alternate horizontal
+ skips with the data. The horizontal skips are in units
+ of 1/120 inches, so we look at the data in groups of
+ 3 columns, since 3/360 = 1/120, and 3/180 = 2/120. */
+ outl = out;
+ do
+ { int count;
+ int n;
+ byte *out_ptr;
+
+ /* First look for blank groups of columns. */
+ while(outl < out_end)
+ { n = count = min(out_end - outl, skip_unit);
+ out_ptr = outl;
+ while ( --count >= 0 )
+ { if ( *out_ptr++ )
+ break;
+ }
+ if ( count >= 0 )
+ break;
+ else
+ outl = out_ptr;
+ }
+ if (outl >= out_end)
+ break;
+ if (outl > out_beg)
+ { count = (outl - out_beg) / skip_unit;
+ if ( xres == 180 ) count <<= 1;
+ fprintf(prn_stream, "\033d%c%c",
+ count & 0xff, count >> 8);
+ }
+
+ /* Next look for non-blank groups of columns. */
+ out_beg = outl;
+ outl += n;
+ while(outl < out_end)
+ { n = count = min(out_end - outl, skip_unit);
+ out_ptr = outl;
+ while ( --count >= 0 )
+ { if ( *out_ptr++ )
+ break;
+ }
+ if ( count < 0 )
+ break;
+ else
+ outl += n;
+ }
+ count = outl - out_beg + 1;
+ fprintf(prn_stream, "\033[g%c%c%c",
+ count & 0xff, count >> 8, mode);
+ fwrite(out_beg, 1, count - 1, prn_stream);
+ out_beg = outl;
+ outl += n;
+ }
+ while ( out_beg < out_end );
+
+ fputc('\r', prn_stream);
+ }
+
+ /* Eject the page */
+xit: fputc(014, prn_stream); /* form feed */
+ fflush(prn_stream);
+fin: if ( out != 0 )
+ gs_free((char *)out, bits_per_column, line_size,
+ "bj10e_print_page(out)");
+ if ( in != 0 )
+ gs_free((char *)in, 8, line_size, "bj10e_print_page(in)");
+ return code;
}
diff --git a/gs/src/gdevbjc.h b/gs/src/gdevbjc.h
index 77ad6c399..79e495cb7 100644
--- a/gs/src/gdevbjc.h
+++ b/gs/src/gdevbjc.h
@@ -16,11 +16,15 @@
all copies.
*/
-/* gdevbjc.h */
+/*Id: gdevbjc.h */
+
+#ifndef gdevbjc_INCLUDED
+# define gdevbjc_INCLUDED
+
/*
* Definitions for Canon BJC printers and the associated drivers.
*
- * Copyright (C) Yves Arrouye <Yves.Arrouye@imag.fr>, 1995, 1996.
+ * Copyright (C) Yves Arrouye <yves.arrouye@usa.net>, 1995, 1996.
*
*/
@@ -280,3 +284,5 @@
#endif
#endif /* _GDEVBJC_H */
+
+#endif /* gdevbjc_INCLUDED */
diff --git a/gs/src/gdevbmp.c b/gs/src/gdevbmp.c
index b5c0dc18f..38efd46fc 100644
--- a/gs/src/gdevbmp.c
+++ b/gs/src/gdevbmp.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992, 1993 Aladdin Enterprises. All rights reserved.
+/* Copyright (C) 1992, 1993, 1997, 1998 Aladdin Enterprises. All rights reserved.
This file is part of Aladdin Ghostscript.
@@ -16,19 +16,14 @@
all copies.
*/
-/* gdevbmp.c */
+/*Id: gdevbmp.c */
/* .BMP file format output drivers */
#include "gdevprn.h"
#include "gdevpccm.h"
+#include "gdevbmp.h"
/* ------ The device descriptors ------ */
-/*
- * Default X and Y resolution.
- */
-#define X_DPI 72
-#define Y_DPI 72
-
private dev_proc_print_page(bmp_print_page);
/* Monochrome. */
@@ -42,7 +37,7 @@ prn_device(prn_std_procs, "bmpmono",
/* 4-bit planar (EGA/VGA-style) color. */
-private gx_device_procs bmp16_procs =
+private const gx_device_procs bmp16_procs =
prn_color_procs(gdev_prn_open, gdev_prn_output_page, gdev_prn_close,
pc_4bit_map_rgb_color, pc_4bit_map_color_rgb);
gx_device_printer far_data gs_bmp16_device =
@@ -55,7 +50,7 @@ prn_device(bmp16_procs, "bmp16",
/* 8-bit (SuperVGA-style) color. */
/* (Uses a fixed palette of 3,3,2 bits.) */
-private gx_device_procs bmp256_procs =
+private const gx_device_procs bmp256_procs =
prn_color_procs(gdev_prn_open, gdev_prn_output_page, gdev_prn_close,
pc_8bit_map_rgb_color, pc_8bit_map_color_rgb);
gx_device_printer far_data gs_bmp256_device =
@@ -67,11 +62,9 @@ prn_device(bmp256_procs, "bmp256",
/* 24-bit color. */
-private dev_proc_map_rgb_color(map_16m_rgb_color);
-private dev_proc_map_color_rgb(map_16m_color_rgb);
-private gx_device_procs bmp16m_procs =
+private const gx_device_procs bmp16m_procs =
prn_color_procs(gdev_prn_open, gdev_prn_output_page, gdev_prn_close,
- map_16m_rgb_color, map_16m_color_rgb);
+ bmp_map_16m_rgb_color, bmp_map_16m_color_rgb);
gx_device_printer far_data gs_bmp16m_device =
prn_device(bmp16m_procs, "bmp16m",
DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
@@ -81,196 +74,37 @@ prn_device(bmp16m_procs, "bmp16m",
/* ------ Private definitions ------ */
-/* All multi-byte quantities are stored LSB-first! */
-typedef ushort word;
-
-#if arch_sizeof_int == 4
-typedef uint dword;
-
-#else
-# if arch_sizeof_long == 4
-typedef ulong dword;
-
-# endif
-#endif
-#if arch_is_big_endian
-# define assign_word(a,v) a = ((v) >> 8) + ((v) << 8)
-# define assign_dword(a,v)\
- a = ((v) >> 24) + (((v) >> 8) & 0xff00L) +\
- (((dword)(v) << 8) & 0xff0000L) + ((dword)(v) << 24)
-#else
-# define assign_word(a,v) a = (v)
-# define assign_dword(a,v) a = (v)
-#endif
-
-typedef struct bmp_file_header_s {
-
- /* BITMAPFILEHEADER */
-
- /*
- * This structure actually begins with two bytes
- * containing the characters 'BM', but we must omit them,
- * because some compilers would insert padding to force
- * the size member to a 32- or 64-bit boundary.
- */
-
- /*byte typeB, typeM; *//* always 'BM' */
- dword size; /* total size of file */
- word reserved1;
- word reserved2;
- dword offBits; /* offset of bits from start of file */
-
-} bmp_file_header;
-
-#define sizeof_bmp_file_header (2 + sizeof(bmp_file_header))
-
-typedef struct bmp_info_header_s {
-
- /* BITMAPINFOHEADER */
-
- dword size; /* size of info header in bytes */
- dword width; /* width in pixels */
- dword height; /* height in pixels */
- word planes; /* # of planes, always 1 */
- word bitCount; /* bits per pixel */
- dword compression; /* compression scheme, always 0 */
- dword sizeImage; /* size of bits */
- dword xPelsPerMeter; /* X pixels per meter */
- dword yPelsPerMeter; /* Y pixels per meter */
- dword clrUsed; /* # of colors used */
- dword clrImportant; /* # of important colors */
-
- /* This is followed by (1 << bitCount) bmp_quad structures, */
- /* unless bitCount == 24. */
-
-} bmp_info_header;
-
-typedef struct bmp_quad_s {
-
- /* RGBQUAD */
-
- byte blue, green, red, reserved;
-
-} bmp_quad;
-
/* Write out a page in BMP format. */
/* This routine is used for all formats. */
private int
bmp_print_page(gx_device_printer * pdev, FILE * file)
{
- int raster = gdev_prn_raster(pdev);
-
+ uint raster = gdev_prn_raster(pdev);
/* BMP scan lines are padded to 32 bits. */
- ulong bmp_raster = raster + (-raster & 3);
- int height = pdev->height;
- int depth = pdev->color_info.depth;
- int quads = (depth <= 8 ? sizeof(bmp_quad) << depth : 0);
- byte *row = (byte *) gs_malloc(bmp_raster, 1, "bmp file buffer");
+ uint bmp_raster = raster + (-raster & 3);
+ byte *row = (byte *)gs_malloc(bmp_raster, 1, "bmp file buffer");
int y;
- int code = 0; /* return code */
+ int code; /* return code */
if (row == 0) /* can't allocate row buffer */
return_error(gs_error_VMerror);
/* Write the file header. */
- fputc('B', file);
- fputc('M', file);
- {
- bmp_file_header fhdr;
-
- assign_dword(fhdr.size,
- sizeof_bmp_file_header +
- sizeof(bmp_info_header) + quads +
- bmp_raster * height);
- assign_word(fhdr.reserved1, 0);
- assign_word(fhdr.reserved2, 0);
- assign_dword(fhdr.offBits,
- sizeof_bmp_file_header +
- sizeof(bmp_info_header) + quads);
- if (fwrite((const char *)&fhdr, 1, sizeof(fhdr), file) != sizeof(fhdr)) {
- code = gs_error_ioerror;
- goto bmp_done;
- }
- }
-
- /* Write the info header. */
-
- {
- bmp_info_header ihdr;
-
- assign_dword(ihdr.size, sizeof(ihdr));
- assign_dword(ihdr.width, pdev->width);
- assign_dword(ihdr.height, height);
- assign_word(ihdr.planes, 1);
- assign_word(ihdr.bitCount, depth);
- assign_dword(ihdr.compression, 0);
- assign_dword(ihdr.sizeImage, bmp_raster * height);
- /* Even though we could compute the resolution correctly, */
- /* the convention seems to be to leave it unspecified. */
- assign_dword(ihdr.xPelsPerMeter, 0);
- /*(dword)(pdev->x_pixels_per_inch * (1000.0 / 30.48))); */
- assign_dword(ihdr.yPelsPerMeter, 0);
- /*(dword)(pdev->y_pixels_per_inch * (1000.0 / 30.48))); */
- assign_dword(ihdr.clrUsed, 0);
- assign_dword(ihdr.clrImportant, 0);
- if (fwrite((const char *)&ihdr, 1, sizeof(ihdr), file) != sizeof(ihdr)) {
- code = gs_error_ioerror;
- goto bmp_done;
- }
- }
-
- /* Write the palette. */
-
- if (depth <= 8) {
- int i;
- gx_color_value rgb[3];
- bmp_quad q;
+ code = write_bmp_header(pdev, file);
+ if (code < 0)
+ goto done;
- q.reserved = 0;
- for (i = 0; i != 1 << depth; i++) {
- (*dev_proc(pdev, map_color_rgb)) ((gx_device *) pdev,
- (gx_color_index) i, rgb);
- q.red = gx_color_value_to_byte(rgb[0]);
- q.green = gx_color_value_to_byte(rgb[1]);
- q.blue = gx_color_value_to_byte(rgb[2]);
- fwrite((const char *)&q, sizeof(q), 1, file);
- }
- }
/* Write the contents of the image. */
/* BMP files want the image in bottom-to-top order! */
- for (y = height - 1; y >= 0; y--) {
+ for (y = pdev->height - 1; y >= 0; y--) {
gdev_prn_copy_scan_lines(pdev, y, row, raster);
fwrite((const char *)row, bmp_raster, 1, file);
}
- bmp_done:
+done:
gs_free((char *)row, bmp_raster, 1, "bmp file buffer");
return code;
}
-
-/* 24-bit color mappers (taken from gdevmem2.c). */
-/* Note that Windows expects RGB values in the order B,G,R. */
-
-/* Map a r-g-b color to a color index. */
-private gx_color_index
-map_16m_rgb_color(gx_device * dev, gx_color_value r, gx_color_value g,
- gx_color_value b)
-{
- return gx_color_value_to_byte(r) +
- ((uint) gx_color_value_to_byte(g) << 8) +
- ((ulong) gx_color_value_to_byte(b) << 16);
-}
-
-/* Map a color index to a r-g-b color. */
-private int
-map_16m_color_rgb(gx_device * dev, gx_color_index color,
- gx_color_value prgb[3])
-{
- prgb[2] = gx_color_value_from_byte(color >> 16);
- prgb[1] = gx_color_value_from_byte((color >> 8) & 0xff);
- prgb[0] = gx_color_value_from_byte(color & 0xff);
- return 0;
-}
diff --git a/gs/src/gdevccr.c b/gs/src/gdevccr.c
index 7e39ffa09..f8df4430f 100644
--- a/gs/src/gdevccr.c
+++ b/gs/src/gdevccr.c
@@ -1,22 +1,22 @@
-/* Copyright (C) 1996 Aladdin Enterprises. All rights reserved.
-
- This file is part of Aladdin Ghostscript.
-
- Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
- or distributor accepts any responsibility for the consequences of using it,
- or for whether it serves any particular purpose or works at all, unless he
- or she says so in writing. Refer to the Aladdin Ghostscript Free Public
- License (the "License") for full details.
-
- Every copy of Aladdin Ghostscript must include a copy of the License,
- normally in a plain ASCII text file named PUBLIC. The License grants you
- the right to copy, modify and redistribute Aladdin Ghostscript, but only
- under certain conditions described in the License. Among other things, the
- License requires that the copyright notice and this notice be preserved on
- all copies.
- */
-
-/* gdevccr.c */
+/* Copyright (C) 1996, 1997 Aladdin Enterprises. All rights reserved.
+
+ This file is part of Aladdin Ghostscript.
+
+ Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
+ or distributor accepts any responsibility for the consequences of using it,
+ or for whether it serves any particular purpose or works at all, unless he
+ or she says so in writing. Refer to the Aladdin Ghostscript Free Public
+ License (the "License") for full details.
+
+ Every copy of Aladdin Ghostscript must include a copy of the License,
+ normally in a plain ASCII text file named PUBLIC. The License grants you
+ the right to copy, modify and redistribute Aladdin Ghostscript, but only
+ under certain conditions described in the License. Among other things, the
+ License requires that the copyright notice and this notice be preserved on
+ all copies.
+*/
+
+/*Id: gdevccr.c */
/* CalComp Raster Format driver */
#include "gdevprn.h"
@@ -38,15 +38,16 @@
#define NPASS (3)
-typedef struct cmyrow_s {
- int current;
- int _cmylen[NPASS];
- int is_used;
- char cname[4];
- char mname[4];
- char yname[4];
- unsigned char *_cmybuf[NPASS];
-} cmyrow;
+typedef struct cmyrow_s
+ {
+ int current;
+ int _cmylen[NPASS];
+ int is_used;
+ char cname[4];
+ char mname[4];
+ char yname[4];
+ unsigned char *_cmybuf[NPASS];
+ } cmyrow;
#define clen _cmylen[CPASS]
#define mlen _cmylen[MPASS]
@@ -58,16 +59,16 @@ typedef struct cmyrow_s {
#define ybuf _cmybuf[YPASS]
#define cmybuf _cmybuf
-private int alloc_rb(cmyrow ** rb, int rows);
-private int alloc_line(cmyrow * row, int cols);
-private void add_cmy8(cmyrow * rb, char c, char m, char y);
-private void write_cpass(cmyrow * buf, int rows, int pass, FILE * pstream);
-private void free_rb_line(cmyrow * rbuf, int rows, int cols);
+private int alloc_rb( cmyrow **rb, int rows);
+private int alloc_line( cmyrow *row, int cols);
+private void add_cmy8(cmyrow *rb, char c, char m, char y);
+private void write_cpass(cmyrow *buf, int rows, int pass, FILE * pstream);
+private void free_rb_line( cmyrow *rbuf, int rows, int cols);
struct gx_device_ccr_s {
- gx_device_common;
- gx_prn_device_common;
- /* optional parameters */
+ gx_device_common;
+ gx_prn_device_common;
+ /* optional parameters */
};
typedef struct gx_device_ccr_s gx_device_ccr;
@@ -102,194 +103,192 @@ private dev_proc_print_page(ccr_print_page);
/* The device procedures */
private gx_device_procs ccr_procs =
-prn_color_procs(gdev_prn_open, gdev_prn_output_page, gdev_prn_close,
- ccr_map_rgb_color, ccr_map_color_rgb);
+ prn_color_procs(gdev_prn_open, gdev_prn_output_page, gdev_prn_close,
+ ccr_map_rgb_color, ccr_map_color_rgb);
/* The device descriptors themselves */
gx_device_ccr far_data gs_ccr_device =
-ccr_prn_device(ccr_procs, "ccr", 0.2, 3, 8, 1, 1,
- ccr_print_page);
+ ccr_prn_device(ccr_procs, "ccr", 0.2, 3, 8, 1, 1,
+ ccr_print_page);
/* ------ Color mapping routines ------ */
/* map an rgb color to a ccr cmy bitmap */
private gx_color_index
-ccr_map_rgb_color(gx_device * pdev, ushort r, ushort g, ushort b)
+ccr_map_rgb_color(gx_device *pdev, ushort r, ushort g, ushort b)
{
- register int shift = gx_color_value_bits - 1;
+ register int shift = gx_color_value_bits - 1;
+ r>>=shift;
+ g>>=shift;
+ b>>=shift;
- r >>= shift;
- g >>= shift;
- b >>= shift;
-
- r = 1 - r;
- g = 1 - g;
- b = 1 - b; /* rgb -> cmy */
- return r << 2 | g << 1 | b;
+ r=1-r; g=1-g; b=1-b; /* rgb -> cmy */
+ return r<<2 | g<<1 | b;
}
-/* map an ccr cmy bitmap to a rgb color */
+/* map an ccr cmy bitmap to a rgb color */
private int
-ccr_map_color_rgb(gx_device * pdev, gx_color_index color, ushort rgb[3])
+ccr_map_color_rgb(gx_device *pdev, gx_color_index color, ushort rgb[3])
{
- rgb[2] = (1 - (color >> 2)) * gx_max_color_value; /* r */
- rgb[1] = (1 - ((color & 0x2) >> 1)) * gx_max_color_value; /* g */
- rgb[0] = (1 - (color & 0x1)) * gx_max_color_value; /* b */
- return 0;
+ rgb[2]=(1-(color >>2))*gx_max_color_value; /* r */
+ rgb[1]=(1-( (color & 0x2) >> 1))*gx_max_color_value; /* g */
+ rgb[0]=(1-(color & 0x1))*gx_max_color_value; /* b */
+ return 0;
}
/* ------ print page routine ------ */
private int
-ccr_print_page(gx_device_printer * pdev, FILE * pstream)
+ccr_print_page(gx_device_printer *pdev, FILE *pstream)
{
- cmyrow *linebuf;
- int line_size = gdev_prn_raster((gx_device *) pdev);
- int pixnum = pdev->width;
- int lnum = pdev->height;
- int l, p, b;
- int cmy, c, m, y;
- byte *in;
- byte *data;
-
- if ((in = (byte *) gs_malloc(line_size, 1, "gsline")) == NULL)
- return_error(gs_error_VMerror);
-
- if (alloc_rb(&linebuf, lnum)) {
- gs_free(in, line_size, 1, "gsline");
- return_error(gs_error_VMerror);
+ cmyrow *linebuf;
+ int line_size = gdev_prn_raster((gx_device *)pdev);
+ int pixnum = pdev->width;
+ int lnum = pdev->height;
+ int l, p, b;
+ int cmy, c, m, y;
+ byte *in;
+ byte *data;
+
+ if((in = (byte *)gs_malloc(line_size, 1, "gsline")) == NULL)
+ return_error(gs_error_VMerror);
+
+ if(alloc_rb( &linebuf, lnum))
+ {
+ gs_free(in, line_size, 1, "gsline");
+ return_error(gs_error_VMerror);
}
- for (l = 0; l < lnum; l++) {
- gdev_prn_get_bits(pdev, l, in, &data);
- if (alloc_line(&linebuf[l], pixnum)) {
+
+ for ( l = 0; l < lnum; l++ )
+ { gdev_prn_get_bits(pdev, l, in, &data);
+ if(alloc_line(&linebuf[l], pixnum))
+ {
gs_free(in, line_size, 1, "gsline");
- free_rb_line(linebuf, lnum, pixnum);
+ free_rb_line( linebuf, lnum, pixnum );
return_error(gs_error_VMerror);
- }
- for (p = 0; p < pixnum; p += 8) {
- c = m = y = 0;
- for (b = 0; b < 8; b++) {
- c <<= 1;
- m <<= 1;
- y <<= 1;
- if (p + b < pixnum)
- cmy = *data;
- else
- cmy = 0;
-
- c |= cmy >> 2;
- m |= (cmy >> 1) & 0x1;
- y |= cmy & 0x1;
- data++;
+ }
+ for ( p=0; p< pixnum; p+=8)
+ {
+ c=m=y=0;
+ for(b=0; b<8; b++)
+ {
+ c <<= 1; m <<= 1; y <<= 1;
+ if(p+b < pixnum)
+ cmy = *data;
+ else
+ cmy = 0;
+
+ c |= cmy>>2;
+ m |= (cmy>>1) & 0x1;
+ y |= cmy & 0x1;
+ data++;
}
add_cmy8(&linebuf[l], c, m, y);
- }
- }
- CCFILESTART(pstream);
- write_cpass(linebuf, lnum, YPASS, pstream);
- CCNEWPASS(pstream);
- write_cpass(linebuf, lnum, MPASS, pstream);
- CCNEWPASS(pstream);
- write_cpass(linebuf, lnum, CPASS, pstream);
- CCFILEEND(pstream);
-
-/* clean up */
- gs_free(in, line_size, 1, "gsline");
- free_rb_line(linebuf, lnum, pixnum);
- return 0;
+ }
+ }
+CCFILESTART(pstream);
+write_cpass(linebuf, lnum, YPASS, pstream);
+CCNEWPASS(pstream);
+write_cpass(linebuf, lnum, MPASS, pstream);
+CCNEWPASS(pstream);
+write_cpass(linebuf, lnum, CPASS, pstream);
+CCFILEEND(pstream);
+
+/* clean up */
+gs_free(in, line_size, 1, "gsline");
+free_rb_line( linebuf, lnum, pixnum );
+return 0;
}
/* ------ Internal routines ------ */
-private int
-alloc_rb(cmyrow ** rb, int rows)
-{
- *rb = (cmyrow *) gs_malloc(rows, sizeof(cmyrow), "rb");
- if (*rb == 0)
- return_error(gs_error_VMerror);
- else {
- int r;
-
- for (r = 0; r < rows; r++) {
- sprintf((*rb)[r].cname, "C%02x", r);
- sprintf((*rb)[r].mname, "M%02x", r);
- sprintf((*rb)[r].yname, "Y%02x", r);
- (*rb)[r].is_used = 0;
+private int alloc_rb( cmyrow **rb, int rows)
+ {
+ *rb = (cmyrow*) gs_malloc(rows, sizeof(cmyrow), "rb");
+ if( *rb == 0)
+ return_error(gs_error_VMerror);
+ else
+ {
+ int r;
+ for(r=0; r<rows; r++)
+ {
+ sprintf((*rb)[r].cname, "C%02x", r);
+ sprintf((*rb)[r].mname, "M%02x", r);
+ sprintf((*rb)[r].yname, "Y%02x", r);
+ (*rb)[r].is_used=0;
}
- return 0;
+ return 0;
}
}
-private int
-alloc_line(cmyrow * row, int cols)
+private int alloc_line( cmyrow *row, int cols)
{
- int suc;
-
- suc = ((row->cbuf = (char *)gs_malloc(cols, 1, row->cname)) &&
- (row->mbuf = (char *)gs_malloc(cols, 1, row->mname)) &&
- (row->ybuf = (char *)gs_malloc(cols, 1, row->yname)));
- if (suc == 0) {
- gs_free(row->cbuf, cols, 1, row->cname);
- gs_free(row->mbuf, cols, 1, row->mname);
- gs_free(row->ybuf, cols, 1, row->yname);
-
- return_error(gs_error_VMerror);
- }
- row->is_used = 1;
- row->current = row->clen = row->mlen = row->ylen = 0;
- return 0;
+ int suc;
+ suc=((row->cbuf = (unsigned char *) gs_malloc(cols,1, row->cname)) &&
+ (row->mbuf = (unsigned char *) gs_malloc(cols,1, row->mname)) &&
+ (row->ybuf = (unsigned char *) gs_malloc(cols,1, row->yname)));
+ if(suc == 0)
+ {
+ gs_free(row->cbuf, cols,1, row->cname);
+ gs_free(row->mbuf, cols,1, row->mname);
+ gs_free(row->ybuf, cols,1, row->yname);
+
+ return_error(gs_error_VMerror);
+ }
+ row->is_used = 1;
+ row->current = row->clen = row->mlen = row->ylen = 0;
+ return 0;
}
-private void
-add_cmy8(cmyrow * rb, char c, char m, char y)
+private void add_cmy8(cmyrow *rb, char c, char m, char y)
{
- int cur = rb->current;
-
- rb->cbuf[cur] = c;
- if (c)
- rb->clen = cur + 1;
- rb->mbuf[cur] = m;
- if (m)
- rb->mlen = cur + 1;
- rb->ybuf[cur] = y;
- if (y)
- rb->ylen = cur + 1;
- rb->current++;
- return;
+ int cur=rb->current;
+ rb->cbuf[cur]=c;
+ if(c)
+ rb->clen=cur+1;
+ rb->mbuf[cur]=m;
+ if(m)
+ rb->mlen=cur+1;
+ rb->ybuf[cur]=y;
+ if(y)
+ rb->ylen=cur+1;
+ rb->current++;
+ return;
}
-private void
-write_cpass(cmyrow * buf, int rows, int pass, FILE * pstream)
+private void write_cpass(cmyrow *buf, int rows, int pass, FILE * pstream)
{
- int row, len;
-
- for (row = 0; row < rows; row++) {
- len = buf[row].cmylen[pass];
- if (len == 0)
- CCEMPTYLINE(pstream);
- else {
- CCLINESTART(len, pstream);
- fwrite(buf[row].cmybuf[pass], len, 1, pstream);
- }
+ int row, len;
+ for(row=0; row<rows; row++)
+ {
+ len=buf[row].cmylen[pass];
+ if(len == 0)
+ CCEMPTYLINE(pstream);
+ else
+ {
+ CCLINESTART(len,pstream);
+ fwrite( buf[row].cmybuf[pass], len, 1, pstream);
+ }
}
- return;
+ return;
}
-private void
-free_rb_line(cmyrow * rbuf, int rows, int cols)
+private void free_rb_line( cmyrow *rbuf, int rows, int cols)
{
- int i;
-
- for (i = 0; i < rows; i++) {
- if (rbuf[i].is_used) {
- gs_free(rbuf[i].cbuf, cols, 1, rbuf[i].cname);
- gs_free(rbuf[i].mbuf, cols, 1, rbuf[i].mname);
- gs_free(rbuf[i].ybuf, cols, 1, rbuf[i].yname);
- rbuf[i].is_used = 0;
- } else
- break;
+ int i;
+ for(i=0; i<rows; i++)
+ {
+ if(rbuf[i].is_used)
+ {
+ gs_free(rbuf[i].cbuf, cols, 1, rbuf[i].cname);
+ gs_free(rbuf[i].mbuf, cols, 1, rbuf[i].mname);
+ gs_free(rbuf[i].ybuf, cols, 1, rbuf[i].yname);
+ rbuf[i].is_used = 0;
+ }
+ else
+ break;
}
- gs_free(rbuf, rows, sizeof(cmyrow), "rb");
- return;
+ gs_free( rbuf, rows, sizeof(cmyrow), "rb");
+ return;
}
diff --git a/gs/src/gdevcdj.c b/gs/src/gdevcdj.c
index 375e3875f..7168b21e0 100644
--- a/gs/src/gdevcdj.c
+++ b/gs/src/gdevcdj.c
@@ -1,22 +1,22 @@
/* Copyright (C) 1991, 1995, 1996, 1997 Aladdin Enterprises. All rights reserved.
-
- This file is part of Aladdin Ghostscript.
-
- Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
- or distributor accepts any responsibility for the consequences of using it,
- or for whether it serves any particular purpose or works at all, unless he
- or she says so in writing. Refer to the Aladdin Ghostscript Free Public
- License (the "License") for full details.
-
- Every copy of Aladdin Ghostscript must include a copy of the License,
- normally in a plain ASCII text file named PUBLIC. The License grants you
- the right to copy, modify and redistribute Aladdin Ghostscript, but only
- under certain conditions described in the License. Among other things, the
- License requires that the copyright notice and this notice be preserved on
- all copies.
- */
-
-/* gdevcdj.c */
+
+ This file is part of Aladdin Ghostscript.
+
+ Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
+ or distributor accepts any responsibility for the consequences of using it,
+ or for whether it serves any particular purpose or works at all, unless he
+ or she says so in writing. Refer to the Aladdin Ghostscript Free Public
+ License (the "License") for full details.
+
+ Every copy of Aladdin Ghostscript must include a copy of the License,
+ normally in a plain ASCII text file named PUBLIC. The License grants you
+ the right to copy, modify and redistribute Aladdin Ghostscript, but only
+ under certain conditions described in the License. Among other things, the
+ License requires that the copyright notice and this notice be preserved on
+ all copies.
+*/
+
+/*Id: gdevcdj.c */
/* H-P and Canon colour printer drivers */
/****************************************************************
@@ -38,14 +38,14 @@
* You may also try the cdj550cmyk driver after having defined
* USE_CDJ550_CMYK and added the needed definition in devs.mak. Not tried!
* (I have a BJC!) If you ty that, please report success/failure to me,
- * Yves.Arrouye@imag.fr. Also note that modes descriptions of CMYK printing
+ * yves.arrouye@usa.net. Also note that modes descriptions of CMYK printing
* is done under the BJC section of devices.doc.
*
* CMYK to RGB conversion is made a la GhostScript unless you define
* the preprocessor symbol USE_ADOBE_CMYK_RGB.
*
- * Ghostscript: R = (1.0 - C) * (1.0 - K)
- * Adobe: R = 1.0 - min(1.0, C + K)
+ * Ghostscript: R = (1.0 - C) * (1.0 - K)
+ * Adobe: R = 1.0 - min(1.0, C + K)
*
* (and similarly for G and B). Ghostscript claims its method achieves
* better results.
@@ -99,7 +99,7 @@
* 9 - esc/p: Epson ESC/P-compatible printers
*** The BJC600 driver (which also works for BJC4000) was written first
*** by Yoshio Kuniyoshi <yoshio@nak.math.keio.ac.jp> and later modified by
- *** Yves Arrouye <Yves.Arrouye@imag.fr>. The current driver has been
+ *** Yves Arrouye <yves.arrouye@usa.net>. The current driver has been
*** completely rewritten by me (YA) for good color handling.
* 10 - bjc600: BJC 600//4000 printers
*** The BJC800 driver is based on the bjc600 one. By YA too.
@@ -140,7 +140,7 @@
case 0:\
if ( pa.size != psize )\
code = gs_error_rangecheck;\
- else {
+ else {
/* The body of the processing code goes here. */
/* If it succeeds, it should do a 'break'; */
/* if it fails, it should set ecode and fall through. */
@@ -156,7 +156,6 @@ e: param_signal_error(plist, oname, code);\
private int cdj_param_check_bytes(P5(gs_param_list *, gs_param_name, const byte *, uint, bool));
private int cdj_param_check_float(P4(gs_param_list *, gs_param_name, floatp, bool));
-
#define cdj_param_check_string(plist, pname, str, defined)\
cdj_param_check_bytes(plist, pname, (const byte *)str, strlen(str), defined)
@@ -223,12 +222,12 @@ private int cdj_param_check_float(P4(gs_param_list *, gs_param_name, floatp, boo
#define HEAD_ROWS_COLOUR 16
/* Colour mapping procedures */
-private dev_proc_map_cmyk_color(gdev_cmyk_map_cmyk_color);
-private dev_proc_map_rgb_color(gdev_cmyk_map_rgb_color);
-private dev_proc_map_color_rgb(gdev_cmyk_map_color_rgb);
+private dev_proc_map_cmyk_color (gdev_cmyk_map_cmyk_color);
+private dev_proc_map_rgb_color (gdev_cmyk_map_rgb_color);
+private dev_proc_map_color_rgb (gdev_cmyk_map_color_rgb);
-private dev_proc_map_rgb_color(gdev_pcl_map_rgb_color);
-private dev_proc_map_color_rgb(gdev_pcl_map_color_rgb);
+private dev_proc_map_rgb_color (gdev_pcl_map_rgb_color);
+private dev_proc_map_color_rgb (gdev_pcl_map_color_rgb);
/* Print-page, parameters and miscellaneous procedures */
private dev_proc_open_device(dj500c_open);
@@ -255,14 +254,12 @@ private dev_proc_print_page(bjc_print_page);
private dev_proc_get_params(cdj_get_params);
private dev_proc_get_params(pjxl_get_params);
private dev_proc_get_params(bjc_get_params);
-
#define ep_get_params cdj_get_params
private dev_proc_put_params(cdj_put_params);
private dev_proc_put_params(pj_put_params);
private dev_proc_put_params(pjxl_put_params);
private dev_proc_put_params(bjc_put_params);
-
#define ep_put_params cdj_put_params
/* The device descriptors */
@@ -276,24 +273,24 @@ private dev_proc_put_params(bjc_put_params);
typedef struct gx_device_cdj_s gx_device_cdj;
struct gx_device_cdj_s {
- gx_device_common;
- gx_prn_colour_device_common;
- int shingling; /* Interlaced, multi-pass printing */
- int depletion; /* 'Intelligent' dot-removal */
+ gx_device_common;
+ gx_prn_colour_device_common;
+ int shingling; /* Interlaced, multi-pass printing */
+ int depletion; /* 'Intelligent' dot-removal */
};
typedef struct gx_device_pjxl_s gx_device_pjxl;
struct gx_device_pjxl_s {
- gx_device_common;
- gx_prn_colour_device_common;
- int printqual; /* Mechanical print quality */
- int rendertype; /* Driver or printer dithering control */
+ gx_device_common;
+ gx_prn_colour_device_common;
+ int printqual; /* Mechanical print quality */
+ int rendertype; /* Driver or printer dithering control */
};
typedef struct gx_device_hp_s gx_device_hp;
struct gx_device_hp_s {
- gx_device_common;
- gx_prn_colour_device_common;
+ gx_device_common;
+ gx_prn_colour_device_common;
};
typedef struct gx_device_hp_s gx_device_pj;
@@ -334,12 +331,12 @@ typedef bjc_params bjc800_params;
float printLimit
struct gx_device_bjc600_s {
- gx_bjc_device_common;
- bjc600_params bjc_p;
+ gx_bjc_device_common;
+ bjc600_params bjc_p;
};
struct gx_device_bjc800_s {
- gx_bjc_device_common;
- bjc800_params bjc_p;
+ gx_bjc_device_common;
+ bjc800_params bjc_p;
};
typedef struct {
@@ -473,7 +470,6 @@ hp_colour_procs(dj550c_open, cdj_get_params, cdj_put_params);
#ifdef USE_CDJ550_CMYK
private gx_device_procs cdj550cmyk_procs =
cmyk_colour_procs(dj550c_open, cdj_get_params, cdj_put_params);
-
#endif
private gx_device_procs dnj650c_procs =
@@ -518,12 +514,10 @@ cdj_device(cdj550_procs, "cdj550", 300, 300, BITSPERPIXEL,
dj550c_print_page, 0, 2, 1);
#ifdef USE_CDJ550_CMYK
-gx_device_cdj far_data gs_cdj550cmyk_device =
-{
+gx_device_cdj far_data gs_cdj550cmyk_device = {
prn_cmyk_colour_device(cdj550cmyk_procs, "cdj550cmyk", 300, 300,
- BITSPERPIXEL, dj550c_print_page, 0), 2, 1
+ BITSPERPIXEL, dj550c_print_page, 0), 2, 1
};
-
#endif
gx_device_pj far_data gs_declj250_device =
@@ -533,7 +527,7 @@ pj_device(pj_procs, "declj250", 180, 180, BITSPERPIXEL,
gx_device_cdj far_data gs_dnj650c_device =
cdj_device(dnj650c_procs, "dnj650c", 300, 300, BITSPERPIXEL,
dnj650c_print_page, 0, 2, 1);
-
+
gx_device_cdj far_data gs_lj4dith_device =
cdj_device(lj4dith_procs, "lj4dith", 600, 600, 8,
lj4dith_print_page, 4, 0, 1);
@@ -562,41 +556,41 @@ cdj_device(escp_procs, "escpc", 360, 360, 24,
mediaWeight_isSet, mediaWeight, (monochromePrint) */
gx_device_bjc600 far_data gs_bjc600_device =
-bjc600_device(
- bjc_procs,
- BJC_BJC600,
- BJC600_DEFAULT_RESOLUTION,
- BJC600_DEFAULT_RESOLUTION,
- BJC600_DEFAULT_BITSPERPIXEL,
- bjc_print_page,
- BJC600,
- BJC600_DEFAULT_MANUALFEED,
- BJC600_DEFAULT_MEDIATYPE,
- BJC600_DEFAULT_SETMEDIAWEIGHT,
- BJC600_DEFAULT_MEDIAWEIGHT,
- BJC600_DEFAULT_PRINTQUALITY,
- BJC600_DEFAULT_DITHERINGTYPE,
- BJC600_DEFAULT_COLORCOMPONENTS,
- BJC600_DEFAULT_PRINTCOLORS,
- BJC600_DEFAULT_MONOCHROMEPRINT);
+ bjc600_device(
+ bjc_procs,
+ BJC_BJC600,
+ BJC600_DEFAULT_RESOLUTION,
+ BJC600_DEFAULT_RESOLUTION,
+ BJC600_DEFAULT_BITSPERPIXEL,
+ bjc_print_page,
+ BJC600,
+ BJC600_DEFAULT_MANUALFEED,
+ BJC600_DEFAULT_MEDIATYPE,
+ BJC600_DEFAULT_SETMEDIAWEIGHT,
+ BJC600_DEFAULT_MEDIAWEIGHT,
+ BJC600_DEFAULT_PRINTQUALITY,
+ BJC600_DEFAULT_DITHERINGTYPE,
+ BJC600_DEFAULT_COLORCOMPONENTS,
+ BJC600_DEFAULT_PRINTCOLORS,
+ BJC600_DEFAULT_MONOCHROMEPRINT);
gx_device_bjc800 far_data gs_bjc800_device =
-bjc800_device(
- bjc_procs,
- BJC_BJC800,
- BJC800_DEFAULT_RESOLUTION,
- BJC800_DEFAULT_RESOLUTION,
- BJC800_DEFAULT_BITSPERPIXEL,
- bjc_print_page,
- BJC800,
- BJC800_DEFAULT_MANUALFEED,
- BJC800_DEFAULT_MEDIATYPE,
- BJC800_DEFAULT_SETMEDIAWEIGHT,
- BJC800_DEFAULT_MEDIAWEIGHT,
- BJC800_DEFAULT_PRINTQUALITY,
- BJC800_DEFAULT_DITHERINGTYPE,
- BJC600_DEFAULT_COLORCOMPONENTS,
- BJC800_DEFAULT_PRINTCOLORS);
+ bjc800_device(
+ bjc_procs,
+ BJC_BJC800,
+ BJC800_DEFAULT_RESOLUTION,
+ BJC800_DEFAULT_RESOLUTION,
+ BJC800_DEFAULT_BITSPERPIXEL,
+ bjc_print_page,
+ BJC800,
+ BJC800_DEFAULT_MANUALFEED,
+ BJC800_DEFAULT_MEDIATYPE,
+ BJC800_DEFAULT_SETMEDIAWEIGHT,
+ BJC800_DEFAULT_MEDIAWEIGHT,
+ BJC800_DEFAULT_PRINTQUALITY,
+ BJC800_DEFAULT_DITHERINGTYPE,
+ BJC600_DEFAULT_COLORCOMPONENTS,
+ BJC800_DEFAULT_PRINTCOLORS);
/* Forward references */
private int gdev_pcl_mode1compress(P3(const byte *, const byte *, byte *));
@@ -608,178 +602,159 @@ private uint gdev_prn_rasterwidth(P2(const gx_device_printer *, int));
private int cdj_put_param_bpp(P5(gx_device *, gs_param_list *, int, int, int));
private int cdj_set_bpp(P3(gx_device *, int, int));
private void cdj_expand_line(P5(word *, int, short, int, int));
-private int bjc_fscmyk(P5(byte **, byte *[4][4], int **, int, int));
+private int bjc_fscmyk(P5(byte**, byte*[4][4], int**, int, int));
/* String parameters manipulation */
typedef struct {
- const char *p_name;
+ const char* p_name;
int p_value;
} stringParamDescription;
-private const byte *paramValueToString(P2(const stringParamDescription *, int));
-private int paramStringValue(P4(const stringParamDescription *,
- const byte *, int, int *));
+private const byte* paramValueToString(P2(const stringParamDescription*, int));
+private int paramStringValue(P4(const stringParamDescription*,
+ const byte*, int, int*));
-private int put_param_string(P6(gs_param_list *, const byte *,
- gs_param_string *, const stringParamDescription *, int *, int));
-private int get_param_string(P7(gs_param_list *, const byte *,
- gs_param_string *, const stringParamDescription *, int, bool, int));
+private int put_param_string(P6(gs_param_list*, const byte*,
+ gs_param_string*, const stringParamDescription*, int *, int));
+private int get_param_string(P7(gs_param_list*, const byte*,
+ gs_param_string*, const stringParamDescription*, int, bool, int));
/* Open the printer and set up the margins. */
private int
-dj500c_open(gx_device * pdev)
-{
- return hp_colour_open(pdev, DJ500C);
+dj500c_open(gx_device *pdev)
+{ return hp_colour_open(pdev, DJ500C);
}
private int
-dj550c_open(gx_device * pdev)
-{
- return hp_colour_open(pdev, DJ550C);
+dj550c_open(gx_device *pdev)
+{ return hp_colour_open(pdev, DJ550C);
}
private int
-dnj650c_open(gx_device * pdev)
-{
- return hp_colour_open(pdev, DNJ650C);
+dnj650c_open(gx_device *pdev)
+{ return hp_colour_open(pdev, DNJ650C);
}
private int
-lj4dith_open(gx_device * pdev)
-{
- return hp_colour_open(pdev, LJ4DITH);
+lj4dith_open(gx_device *pdev)
+{ return hp_colour_open(pdev, LJ4DITH);
}
private int
-pjxl300_open(gx_device * pdev)
-{
- return hp_colour_open(pdev, PJXL300);
+pjxl300_open(gx_device *pdev)
+{ return hp_colour_open(pdev, PJXL300);
}
private int
-pj_open(gx_device * pdev)
-{
- return hp_colour_open(pdev, PJ180);
+pj_open(gx_device *pdev)
+{ return hp_colour_open(pdev, PJ180);
}
private int
-pjxl_open(gx_device * pdev)
-{
- return hp_colour_open(pdev, PJXL180);
+pjxl_open(gx_device *pdev)
+{ return hp_colour_open(pdev, PJXL180);
}
private int
-escp_open(gx_device * pdev)
-{
- return hp_colour_open(pdev, ESC_P);
+escp_open(gx_device *pdev)
+{ return hp_colour_open(pdev, ESC_P);
}
private int
-bjc_open(gx_device * pdev)
-{
- return hp_colour_open(pdev, bjc->ptype);
+bjc_open(gx_device *pdev)
+{ return hp_colour_open(pdev, bjc->ptype);
}
private int
-hp_colour_open(gx_device * pdev, int ptype)
-{ /* Change the margins if necessary. */
- static const float dj_a4[4] =
- {DESKJET_MARGINS_A4};
- static const float dj_letter[4] =
- {DESKJET_MARGINS_LETTER};
- static const float lj4_all[4] =
- {LJET4_MARGINS};
- static const float pj_all[4] =
- {PAINTJET_MARGINS};
- static const float dnj_all[4] =
- {DESIGNJET_MARGINS};
- static const float ep_a4[4] =
- {ESC_P_MARGINS_A4};
- static const float ep_letter[4] =
- {ESC_P_MARGINS_LETTER};
-
- static float bjc_a3[4] =
- {BJC_MARGINS_A3}; /* Not const! */
- static float bjc_letter[4] =
- {BJC_MARGINS_LETTER}; /* Not const! */
- static float bjc_a4[4] =
- {BJC_MARGINS_A4}; /* Not const! */
-
- const float _ds *m = (float _ds *)0;
-
- /* Set up colour params if put_params has not already done so */
- if (pdev->color_info.num_components == 0) {
- int code = cdj_set_bpp(pdev, pdev->color_info.depth,
- pdev->color_info.num_components);
-
- if (code < 0)
- return code;
+hp_colour_open(gx_device *pdev, int ptype)
+{ /* Change the margins if necessary. */
+ static const float dj_a4[4] = { DESKJET_MARGINS_A4 };
+ static const float dj_letter[4] = { DESKJET_MARGINS_LETTER };
+ static const float lj4_all[4] = { LJET4_MARGINS };
+ static const float pj_all[4] = { PAINTJET_MARGINS };
+ static const float dnj_all[4] = { DESIGNJET_MARGINS };
+ static const float ep_a4[4] = { ESC_P_MARGINS_A4 };
+ static const float ep_letter[4] = { ESC_P_MARGINS_LETTER };
+
+ static float bjc_a3[4] = { BJC_MARGINS_A3 }; /* Not const! */
+ static float bjc_letter[4] = { BJC_MARGINS_LETTER }; /* Not const! */
+ static float bjc_a4[4] = { BJC_MARGINS_A4 }; /* Not const! */
+
+ const float _ds *m = (float _ds*) 0;
+
+ /* Set up colour params if put_params has not already done so */
+ if (pdev->color_info.num_components == 0)
+ { int code = cdj_set_bpp(pdev, pdev->color_info.depth,
+ pdev->color_info.num_components);
+ if ( code < 0 )
+ return code;
}
- switch (ptype) {
- case DJ500C:
- case DJ550C:
- m = (gdev_pcl_paper_size(pdev) == PAPER_SIZE_A4 ? dj_a4 :
- dj_letter);
- break;
- case DNJ650C:
- m = dnj_all;
- break;
- case LJ4DITH:
- m = lj4_all;
- break;
- case PJ180:
- case PJXL300:
- case PJXL180:
- m = pj_all;
+
+ switch (ptype) {
+ case DJ500C:
+ case DJ550C:
+ m = (gdev_pcl_paper_size(pdev) == PAPER_SIZE_A4 ? dj_a4 :
+ dj_letter);
+ break;
+ case DNJ650C:
+ m = dnj_all;
+ break;
+ case LJ4DITH:
+ m = lj4_all;
+ break;
+ case PJ180:
+ case PJXL300:
+ case PJXL180:
+ m = pj_all;
+ break;
+ case ESC_P:
+ m = (gdev_pcl_paper_size(pdev) == PAPER_SIZE_A4 ? ep_a4 :
+ ep_letter);
+ break;
+ case BJC600:
+ case BJC800:
+ switch (gdev_pcl_paper_size(pdev)) {
+ case PAPER_SIZE_LEGAL:
+ case PAPER_SIZE_LETTER:
+ m = bjc_letter;
break;
- case ESC_P:
- m = (gdev_pcl_paper_size(pdev) == PAPER_SIZE_A4 ? ep_a4 :
- ep_letter);
+
+ case PAPER_SIZE_A0:
+ case PAPER_SIZE_A1:
+ case PAPER_SIZE_A3:
+ m = bjc_a3;
break;
- case BJC600:
- case BJC800:
- switch (gdev_pcl_paper_size(pdev)) {
- case PAPER_SIZE_LEGAL:
- case PAPER_SIZE_LETTER:
- m = bjc_letter;
- break;
-
- case PAPER_SIZE_A0:
- case PAPER_SIZE_A1:
- case PAPER_SIZE_A3:
- m = bjc_a3;
- break;
-
- default:
- m = bjc_a4;
- }
+
+ default:
+ m = bjc_a4;
+ }
#ifndef USE_FIXED_MARGINS
- if (ptype == BJC800) {
- ((float _ds *)m)[1] = BJC_HARD_LOWER_LIMIT;
- }
+ if (ptype == BJC800) {
+ ((float _ds*) m)[1] = BJC_HARD_LOWER_LIMIT;
+ }
#endif
- bjc->printLimit = m[3]; /* The real hardware limit. */
+ bjc->printLimit = m[3]; /* The real hardware limit. */
#ifdef BJC_DEFAULT_CENTEREDAREA
- if (m[3] < m[1]) {
- ((float _ds *)m)[3] = m[1]; /* Top margin = bottom one. */
- } else {
- ((float _ds *)m)[1] = m[3]; /* Bottom margin = top one. */
- }
+ if (m[3] < m[1]) {
+ ((float _ds*) m)[3] = m[1]; /* Top margin = bottom one. */
+ } else {
+ ((float _ds*) m)[1] = m[3]; /* Bottom margin = top one. */
+ }
#endif
- break;
+ break;
- /*NOTREACHED */
+ /*NOTREACHED*/
- /*
- * The margins must be set so that the resulting page length will be
- * expressed exactly as a multiple of tenthes of inches.
- *
- */
+ /*
+ * The margins must be set so that the resulting page length will be
+ * expressed exactly as a multiple of tenthes of inches.
+ *
+ */
/**/ {
float _ds *bjcm = (float _ds*) m;
@@ -805,183 +780,191 @@ hp_colour_open(gx_device * pdev, int ptype)
/* Get parameters. In addition to the standard and printer
* parameters, we supply shingling and depletion parameters,
* and control over the bits-per-pixel used in output rendering */
- private int
- cdj_get_params(gx_device * pdev, gs_param_list * plist) {
- int code = gdev_prn_get_params(pdev, plist);
- if (code < 0 ||
- (code = param_write_int(plist, "BlackCorrect", (int *)&cdj->correction)) < 0 ||
- (code = param_write_int(plist, "Shingling", &cdj->shingling)) < 0 ||
- (code = param_write_int(plist, "Depletion", &cdj->depletion)) < 0
- )
- return code;
-
- return code;
- } /* Put parameters. */
- private int
- cdj_put_params(gx_device * pdev, gs_param_list * plist) {
- int correction = cdj->correction;
- int shingling = cdj->shingling;
- int depletion = cdj->depletion;
- int bpp = 0;
- int code = 0;
-
- code = cdj_put_param_int(plist, "BlackCorrect", &correction, 0, 9, code);
- code = cdj_put_param_int(plist, "Shingling", &shingling, 0, 2, code);
- code = cdj_put_param_int(plist, "Depletion", &depletion, 1, 3, code);
- code = cdj_put_param_int(plist, "BitsPerPixel", &bpp, 1, 32, code);
-
- if (code < 0)
- return code;
- code = cdj_put_param_bpp(pdev, plist, bpp, bpp, 0);
- if (code < 0)
- return code;
-
- cdj->correction = correction;
- cdj->shingling = shingling;
- cdj->depletion = depletion;
- return 0;
- } /* Added parameters for PaintJet XL and PaintJet XL300 *//* Get parameters. In addition to the standard and printer
- * parameters, we supply print_quality and render_type
- * parameters, together with bpp control. */
- private int
- pjxl_get_params(gx_device * pdev, gs_param_list * plist) {
- int code = gdev_prn_get_params(pdev, plist);
- if (code < 0 ||
- (code = param_write_int(plist, "PrintQuality", &pjxl->printqual)) < 0 ||
- (code = param_write_int(plist, "RenderType", &pjxl->rendertype)) < 0
- )
- return code;
-
- return code;
- } /* Put parameters. */
- private int
- pjxl_put_params(gx_device * pdev, gs_param_list * plist) {
- int printqual = pjxl->printqual;
- int rendertype = pjxl->rendertype;
- int bpp = 0, real_bpp = 0;
- int code = 0;
-
- code = cdj_put_param_int(plist, "PrintQuality", &printqual, -1, 1, code);
- code = cdj_put_param_int(plist, "RenderType", &rendertype, 0, 10, code);
- code = cdj_put_param_int(plist, "BitsPerPixel", &bpp, 1, 32, code);
-
- if (code < 0)
- return code;
- real_bpp = bpp;
- if (rendertype > 0) { /* If printer is doing the dithering, we must have a
- * true-colour mode, ie. 16 or 24 bits per pixel */
- if (bpp > 0 && bpp < 16)
- real_bpp = 24;
- }
- code = cdj_put_param_bpp(pdev, plist, bpp, real_bpp, 0);
+private int
+cdj_get_params(gx_device *pdev, gs_param_list *plist)
+{ int code = gdev_prn_get_params(pdev, plist);
+ if ( code < 0 ||
+ (code = param_write_int(plist, "BlackCorrect", (int *)&cdj->correction)) < 0 ||
+ (code = param_write_int(plist, "Shingling", &cdj->shingling)) < 0 ||
+ (code = param_write_int(plist, "Depletion", &cdj->depletion)) < 0
+ )
+ return code;
- if (code < 0)
- return code;
+ return code;
+}
- pjxl->printqual = printqual;
- pjxl->rendertype = rendertype;
- return 0;
- }
+/* Put parameters. */
+private int
+cdj_put_params(gx_device *pdev, gs_param_list *plist)
+{ int correction = cdj->correction;
+ int shingling = cdj->shingling;
+ int depletion = cdj->depletion;
+ int bpp = 0;
+ int code = 0;
+
+ code = cdj_put_param_int(plist, "BlackCorrect", &correction, 0, 9, code);
+ code = cdj_put_param_int(plist, "Shingling", &shingling, 0, 2, code);
+ code = cdj_put_param_int(plist, "Depletion", &depletion, 1, 3, code);
+ code = cdj_put_param_int(plist, "BitsPerPixel", &bpp, 1, 32, code);
+
+ if ( code < 0 )
+ return code;
+ code = cdj_put_param_bpp(pdev, plist, bpp, bpp, 0);
+ if ( code < 0 )
+ return code;
+
+ cdj->correction = correction;
+ cdj->shingling = shingling;
+ cdj->depletion = depletion;
+ return 0;
+}
+
+/* Added parameters for PaintJet XL and PaintJet XL300 */
+
+/* Get parameters. In addition to the standard and printer
+ * parameters, we supply print_quality and render_type
+ * parameters, together with bpp control. */
+private int
+pjxl_get_params(gx_device *pdev, gs_param_list *plist)
+{ int code = gdev_prn_get_params(pdev, plist);
+ if ( code < 0 ||
+ (code = param_write_int(plist, "PrintQuality", &pjxl->printqual)) < 0 ||
+ (code = param_write_int(plist, "RenderType", &pjxl->rendertype)) < 0
+ )
+ return code;
+
+ return code;
+}
+
+/* Put parameters. */
+private int
+pjxl_put_params(gx_device *pdev, gs_param_list *plist)
+{ int printqual = pjxl->printqual;
+ int rendertype = pjxl->rendertype;
+ int bpp = 0, real_bpp = 0;
+ int code = 0;
+
+ code = cdj_put_param_int(plist, "PrintQuality", &printqual, -1, 1, code);
+ code = cdj_put_param_int(plist, "RenderType", &rendertype, 0, 10, code);
+ code = cdj_put_param_int(plist, "BitsPerPixel", &bpp, 1, 32, code);
+
+ if ( code < 0 )
+ return code;
+ real_bpp = bpp;
+ if ( rendertype > 0 )
+ { /* If printer is doing the dithering, we must have a
+ * true-colour mode, ie. 16 or 24 bits per pixel */
+ if ( bpp > 0 && bpp < 16 )
+ real_bpp = 24;
+ }
+ code = cdj_put_param_bpp(pdev, plist, bpp, real_bpp, 0);
+ if ( code < 0 )
+ return code;
+
+ pjxl->printqual = printqual;
+ pjxl->rendertype = rendertype;
+ return 0;
+}
/* Added parameters for PaintJet */
/* Put parameters. In addition to the standard and printer */
/* parameters, we allow control of the bits-per-pixel */
- private int
- pj_put_params(gx_device * pdev, gs_param_list * plist) {
- int bpp = 0;
- int code = cdj_put_param_int(plist, "BitsPerPixel", &bpp, 1, 32, 0);
-
- if (code < 0)
- return code;
- return cdj_put_param_bpp(pdev, plist, bpp, bpp, 0);
- }
- private stringParamDescription bjc_processColorsStrings[] =
- {
- {"DeviceGray", 1},
- {"DeviceRGB", 3},
- {"DeviceCMYK", 4},
- {0}
- };
-
- private stringParamDescription bjc_mediaTypeStrings[] =
- {
- {"PlainPaper", BJC_MEDIA_PLAINPAPER},
- {"CoatedPaper", BJC_MEDIA_COATEDPAPER},
- {"TransparencyFilm", BJC_MEDIA_TRANSPARENCYFILM},
- {"Envelope", BJC_MEDIA_ENVELOPE},
- {"Card", BJC_MEDIA_CARD},
- {"Other", BJC_MEDIA_OTHER},
- {0}
- };
-
- private stringParamDescription bjc600_printQualityStrings[] =
- {
- {"Normal", 0},
- {"High", 1},
- {"Draft", 2},
- {0}
- };
-
- private stringParamDescription bjc800_printQualityStrings[] =
- {
- {"Normal", 0},
- {"High", 1},
- {"Low", 3},
- {"Draft", 4},
- {0},
- };
-
- private stringParamDescription bjc_ditheringTypeStrings[] =
- {
- {"None", BJC_DITHER_NONE},
- {"Floyd-Steinberg", BJC_DITHER_FS},
- {0}
- };
-
- private int
- bjc_get_params(gx_device * pdev, gs_param_list * plist) {
- int code = gdev_prn_get_params(pdev, plist);
- int ncode;
-
- gs_param_string pmedia;
- gs_param_string pquality;
- gs_param_string dithering;
-
- if (code < 0)
- return_error(code);
-
- if ((ncode = param_write_bool(plist, BJC_OPTION_MANUALFEED,
- &bjcparams.manualFeed)) < 0) {
- code = ncode;
- }
- code = get_param_string(plist, (unsigned char *)BJC_OPTION_MEDIATYPE, &pmedia,
- bjc_mediaTypeStrings, bjcparams.mediaType, true, code);
+private int
+pj_put_params(gx_device *pdev, gs_param_list *plist)
+{ int bpp = 0;
+ int code = cdj_put_param_int(plist, "BitsPerPixel", &bpp, 1, 32, 0);
- code = get_param_string(plist, (unsigned char *)BJC_OPTION_PRINTQUALITY, &pquality,
- (bjc->ptype == BJC800 ? bjc800_printQualityStrings :
- bjc600_printQualityStrings), bjcparams.printQuality,
- true, code);
+ if ( code < 0 )
+ return code;
+ return cdj_put_param_bpp(pdev, plist, bpp, bpp, 0);
+}
- code = get_param_string(plist, (unsigned char *)BJC_OPTION_DITHERINGTYPE, &dithering,
- bjc_ditheringTypeStrings, bjcparams.ditheringType, true, code);
+private stringParamDescription bjc_processColorsStrings[] = {
+ { "DeviceGray", 1 },
+ { "DeviceRGB", 3 },
+ { "DeviceCMYK", 4 },
+ { 0 }
+};
+
+private stringParamDescription bjc_mediaTypeStrings[] = {
+ { "PlainPaper", BJC_MEDIA_PLAINPAPER },
+ { "CoatedPaper", BJC_MEDIA_COATEDPAPER },
+ { "TransparencyFilm", BJC_MEDIA_TRANSPARENCYFILM },
+ { "Envelope", BJC_MEDIA_ENVELOPE },
+ { "Card", BJC_MEDIA_CARD},
+ { "Other", BJC_MEDIA_OTHER },
+ { 0 }
+};
+
+private stringParamDescription bjc600_printQualityStrings[] = {
+ { "Normal", 0 },
+ { "High", 1 },
+ { "Draft", 2 },
+ { 0 }
+};
+
+private stringParamDescription bjc800_printQualityStrings[] = {
+ { "Normal", 0 },
+ { "High", 1 },
+ { "Low", 3 },
+ { "Draft", 4 },
+ { 0 },
+};
+
+private stringParamDescription bjc_ditheringTypeStrings[] = {
+ { "None", BJC_DITHER_NONE },
+ { "Floyd-Steinberg", BJC_DITHER_FS },
+ { 0 }
+};
+
+private int
+bjc_get_params(gx_device *pdev, gs_param_list *plist)
+{
+ int code = gdev_prn_get_params(pdev, plist);
+ int ncode;
+
+ gs_param_string pmedia;
+ gs_param_string pquality;
+ gs_param_string dithering;
+
+ if (code < 0) return_error(code);
+
+ if ((ncode = param_write_bool(plist, BJC_OPTION_MANUALFEED,
+ &bjcparams.manualFeed)) < 0) {
+ code = ncode;
+ }
+
+ code = get_param_string(plist, (unsigned char *)BJC_OPTION_MEDIATYPE, &pmedia,
+ bjc_mediaTypeStrings, bjcparams.mediaType, true, code);
+
+ code = get_param_string(plist, (unsigned char *)BJC_OPTION_PRINTQUALITY, &pquality,
+ (bjc->ptype == BJC800 ? bjc800_printQualityStrings :
+ bjc600_printQualityStrings), bjcparams.printQuality,
+ true, code);
+
+ code = get_param_string(plist, (unsigned char *)BJC_OPTION_DITHERINGTYPE, &dithering,
+ bjc_ditheringTypeStrings, bjcparams.ditheringType, true, code);
+
+ if ((ncode = param_write_int(plist, BJC_OPTION_PRINTCOLORS,
+ &bjcparams.printColors)) < 0) {
+ code = ncode;
+ }
+
+ if ((ncode = (bjcparams.mediaWeight_isSet ?
+ param_write_int(plist, BJC_OPTION_MEDIAWEIGHT,
+ &bjcparams.mediaWeight) :
+ param_write_null(plist, BJC_OPTION_MEDIAWEIGHT))) < 0) {
+ code = ncode;
+ }
+
+ if (bjc->ptype != BJC800) {
+ if ((ncode = param_write_bool(plist, BJC_OPTION_MONOCHROMEPRINT,
+ &bjc600params.monochromePrint)) < 0) {
+ code = ncode;
+ }
+ }
- if ((ncode = param_write_int(plist, BJC_OPTION_PRINTCOLORS,
- &bjcparams.printColors)) < 0) {
- code = ncode;
- }
- if ((ncode = (bjcparams.mediaWeight_isSet ?
- param_write_int(plist, BJC_OPTION_MEDIAWEIGHT,
- &bjcparams.mediaWeight) :
- param_write_null(plist, BJC_OPTION_MEDIAWEIGHT))) < 0) {
- code = ncode;
- }
- if (bjc->ptype != BJC800) {
- if ((ncode = param_write_bool(plist, BJC_OPTION_MONOCHROMEPRINT,
- &bjc600params.monochromePrint)) < 0) {
- code = ncode;
- }
- }
/**/ {
float version;
gs_param_string versionString;
@@ -1014,120 +997,126 @@ hp_colour_open(gx_device * pdev, int ptype)
/* Put properties for the bjc drivers. */
- private int
- bjc_put_params(gx_device * pdev, gs_param_list * plist) {
- int bpp = 0, ccomps = 0;
+private int
+bjc_put_params(gx_device *pdev, gs_param_list *plist)
+{
+ int bpp = 0, ccomps = 0;
- int code = 0;
- int ncode;
+ int code = 0;
+ int ncode;
- bool aBool = true;
+ bool aBool = true;
- const char *oname = (const char *)0;
+ const char* oname = (const char*) 0;
- bjc600_params new600Params;
- bjc800_params new800Params;
+ bjc600_params new600Params;
+ bjc800_params new800Params;
- bjc_params *params;
+ bjc_params* params;
- gs_param_string pprocesscolors;
- gs_param_string pmedia;
- gs_param_string pquality;
+ gs_param_string pprocesscolors;
+ gs_param_string pmedia;
+ gs_param_string pquality;
- gs_param_float_array hwra;
+ gs_param_float_array hwra;
- if (bjc->ptype != BJC800) {
- new600Params = bjc600params;
- params = (bjc_params *) & new600Params;
- } else {
- new800Params = bjc800params;
- params = (bjc_params *) & new800Params;
- }
+ if (bjc->ptype != BJC800) {
+ new600Params = bjc600params;
+ params = (bjc_params*) &new600Params;
+ } else {
+ new800Params = bjc800params;
+ params = (bjc_params*) &new800Params;
+ }
- if ((code = cdj_put_param_int(plist, "BitsPerPixel",
- &bpp, 1, 32, code)) != 1) {
- bpp = pdev->color_info.depth;
- }
- if ((code = put_param_string(plist, (unsigned char *)"ProcessColorModel",
- &pprocesscolors, bjc_processColorsStrings, &ccomps, code)) != 1) {
- ccomps = pdev->color_info.num_components;
- }
- if ((ncode = param_read_bool(plist, oname = BJC_OPTION_MANUALFEED,
- &params->manualFeed)) < 0) {
- param_signal_error(plist, oname, code = ncode);
- }
- code = put_param_string(plist, (unsigned char *)BJC_OPTION_MEDIATYPE, &pmedia,
- bjc_mediaTypeStrings, &params->mediaType, code);
-
- code = cdj_put_param_int(plist, BJC_OPTION_PRINTCOLORS,
- &params->printColors, 0, 15, code);
-
- code = put_param_string(plist, (unsigned char *)BJC_OPTION_PRINTQUALITY, &pquality,
- (bjc->ptype == BJC800 ? bjc800_printQualityStrings :
- bjc600_printQualityStrings), &params->printQuality, code);
-
- switch (ncode = param_read_int(plist,
- oname = BJC_OPTION_MEDIAWEIGHT, &params->mediaWeight)) {
- case 0:
- if (params->mediaWeight <= 0) {
- ncode = gs_error_rangecheck;
- } else {
- params->mediaWeight_isSet = 1;
- break;
- }
- goto mwe;
-
- default:
- if ((ncode = param_read_null(plist, oname)) == 0) {
- params->mediaWeight_isSet = 0;
- break;
- }
- mwe:param_signal_error(plist, oname, code = ncode);
-
- case 1:
- break;
- }
+ if ((code = cdj_put_param_int(plist, "BitsPerPixel",
+ &bpp, 1, 32, code)) != 1) {
+ bpp = pdev->color_info.depth;
+ }
- if (bjc->ptype != BJC800) {
- bjc600_params *params600 = (bjc600_params *) params;
+ if ((code = put_param_string(plist, (unsigned char *)"ProcessColorModel",
+ &pprocesscolors, bjc_processColorsStrings, &ccomps, code)) != 1) {
+ ccomps = pdev->color_info.num_components;
+ }
- if ((ncode = param_read_bool(plist,
- oname = BJC_OPTION_MONOCHROMEPRINT,
- &params600->monochromePrint)) < 0) {
- param_signal_error(plist, oname, code = ncode);
- }
- }
- if ((ncode = cdj_param_check_float(plist, BJC_DEVINFO_VERSION,
- bjcversion(pdev), true)) < 0) {
- code = ncode;
- }
- if ((ncode = cdj_param_check_string(plist, BJC_DEVINFO_VERSIONSTRING,
- bjcversionstring(pdev), true)) < 0) {
- code = ncode;
- }
- if ((ncode = param_read_bool(plist, oname = BJC_DEVINFO_OUTPUTFACEUP,
- &aBool)) < 0) {
- param_signal_error(plist, oname, code = ncode);
- } else if (aBool != true) {
- param_signal_error(plist, oname, code = ncode = gs_error_rangecheck);
- }
- /* Check for invalid resolution. The array macros are taken from
- gsdparam.c and modified to use oname, ncode and code instead
- of param_name, code and ecode respectively. */
+ if ((ncode = param_read_bool(plist, oname = BJC_OPTION_MANUALFEED,
+ &params->manualFeed)) < 0) {
+ param_signal_error(plist, oname, code = ncode);
+ }
- BEGIN_ARRAY_PARAM(param_read_float_array, "HWResolution", hwra, 2, hwre)
- if (hwra.data[0] <= 0 || hwra.data[1] <= 0 ||
- hwra.data[0] != hwra.data[1])
- ncode = gs_error_rangecheck;
- else {
+ code = put_param_string(plist, (unsigned char *)BJC_OPTION_MEDIATYPE, &pmedia,
+ bjc_mediaTypeStrings, &params->mediaType, code);
+
+ code = cdj_put_param_int(plist, BJC_OPTION_PRINTCOLORS,
+ &params->printColors, 0, 15, code);
+
+ code = put_param_string(plist, (unsigned char *)BJC_OPTION_PRINTQUALITY, &pquality,
+ (bjc->ptype == BJC800 ? bjc800_printQualityStrings :
+ bjc600_printQualityStrings), &params->printQuality, code);
+
+ switch (ncode = param_read_int(plist,
+ oname = BJC_OPTION_MEDIAWEIGHT, &params->mediaWeight)) {
+ case 0:
+ if (params->mediaWeight <= 0) {
+ ncode = gs_error_rangecheck;
+ } else {
+ params->mediaWeight_isSet = 1;
+ break;
+ }
+ goto mwe;
+
+ default:
+ if ((ncode = param_read_null(plist, oname)) == 0) {
+ params->mediaWeight_isSet = 0;
+ break;
+ }
+mwe: param_signal_error(plist, oname, code = ncode);
+
+ case 1:
+ break;
+ }
+
+ if (bjc->ptype != BJC800) {
+ bjc600_params* params600 = (bjc600_params*) params;
+ if ((ncode = param_read_bool(plist,
+ oname = BJC_OPTION_MONOCHROMEPRINT,
+ &params600->monochromePrint)) < 0) {
+ param_signal_error(plist, oname, code = ncode);
+ }
+ }
+
+ if ((ncode = cdj_param_check_float(plist, BJC_DEVINFO_VERSION,
+ bjcversion(pdev), true)) < 0) {
+ code = ncode;
+ }
+ if ((ncode = cdj_param_check_string(plist, BJC_DEVINFO_VERSIONSTRING,
+ bjcversionstring(pdev), true)) < 0) {
+ code = ncode;
+ }
+
+ if ((ncode = param_read_bool(plist, oname = BJC_DEVINFO_OUTPUTFACEUP,
+ &aBool)) < 0) {
+ param_signal_error(plist, oname, code = ncode);
+ } else if (aBool != true) {
+ param_signal_error(plist, oname, code = ncode = gs_error_rangecheck);
+ }
+
+ /* Check for invalid resolution. The array macros are taken from
+ gsdparam.c and modified to use oname, ncode and code instead
+ of param_name, code and ecode respectively. */
+
+ BEGIN_ARRAY_PARAM(param_read_float_array, "HWResolution", hwra, 2, hwre)
+ if ( hwra.data[0] <= 0 || hwra.data[1] <= 0 ||
+ hwra.data[0] != hwra.data[1] )
+ ncode = gs_error_rangecheck;
+ else {
#ifdef BJC_STRICT
- if (hwra.data[0] != BJC_RESOLUTION_LOW &&
- hwra.data[0] != BJC_RESOLUTION_NORMAL &&
- hwra.data[0] != BJC_RESOLUTION_HIGH) {
- ncode = gs_error_rangecheck;
- }
+ if (hwra.data[0] != BJC_RESOLUTION_LOW &&
+ hwra.data[0] != BJC_RESOLUTION_NORMAL &&
+ hwra.data[0] != BJC_RESOLUTION_HIGH) {
+ ncode = gs_error_rangecheck;
+ }
#else
- /* A small hack for checking resolution without logarithms. */
+ /* A small hack for checking resolution without logarithms. */
/**/ {
int n;
@@ -1168,73 +1157,102 @@ hp_colour_open(gx_device * pdev, int ptype)
/* Write values that did change */
- if (bjc->ptype != BJC800) {
- bjc600params = new600Params;
- } else {
- bjc800params = new800Params;
- }
+ if (bjc->ptype != BJC800) {
+ bjc600params = new600Params;
+ } else {
+ bjc800params = new800Params;
+ }
- return code;
- }
+ return code;
+}
/* ------ Internal routines ------ */
/* The DeskJet500C can compress (mode 9) */
- private int
- dj500c_print_page(gx_device_printer * pdev, FILE * prn_stream) {
- return hp_colour_print_page(pdev, prn_stream, DJ500C);
- } /* The DeskJet550C can compress (mode 9) */
- private int
- dj550c_print_page(gx_device_printer * pdev, FILE * prn_stream) {
- return hp_colour_print_page(pdev, prn_stream, DJ550C);
- } /* The DesignJet650C can compress (mode 1) */
- private int
- dnj650c_print_page(gx_device_printer * pdev, FILE * prn_stream) {
- return hp_colour_print_page(pdev, prn_stream, DNJ650C);
- }
- private int
- lj4dith_print_page(gx_device_printer * pdev, FILE * prn_stream) {
- return hp_colour_print_page(pdev, prn_stream, LJ4DITH);
- } /* The PJXL300 can compress (modes 2 & 3) */
- private int
- pjxl300_print_page(gx_device_printer * pdev, FILE * prn_stream) {
- int ret_code;
- /* Ensure we're operating in PCL mode */
- fputs("\033%-12345X@PJL enter language = PCL\n", prn_stream);
- ret_code = hp_colour_print_page(pdev, prn_stream, PJXL300);
- /* Reenter switch-configured language */
- fputs("\033%-12345X", prn_stream);
- return ret_code;
- } /* The PaintJet XL can compress (modes 2 & 3) */
- private int
- pjxl_print_page(gx_device_printer * pdev, FILE * prn_stream) {
- return hp_colour_print_page(pdev, prn_stream, PJXL180);
- } /* The PaintJet can compress (mode 1) */
- private int
- pj_print_page(gx_device_printer * pdev, FILE * prn_stream) {
- return hp_colour_print_page(pdev, prn_stream, PJ180);
- } /* The LJ250 can compress (mode 1) */
- private int
- declj250_print_page(gx_device_printer * pdev, FILE * prn_stream) {
- int ret_code;
- fputs("\033%8", prn_stream); /* Enter PCL emulation mode */
- ret_code = hp_colour_print_page(pdev, prn_stream, DECLJ250);
- fputs("\033%@", prn_stream); /* Exit PCL emulation mode */
- return ret_code;
- } /* The BJC-600 cannot compress w/o raster image commands. */
- private int
- escp_print_page(gx_device_printer * pdev, FILE * prn_stream) {
- return hp_colour_print_page(pdev, prn_stream, ESC_P);
- } /* The BJC-600 can compress w/ raster image commands. */
- private int
- bjc_print_page(gx_device_printer * pdev, FILE * prn_stream) {
- return hp_colour_print_page(pdev, prn_stream, bjc->ptype);
- } /* MACROS FOR DITHERING (we use macros for compact source and faster code) *//* Floyd-Steinberg dithering. Often results in a dramatic improvement in
- * subjective image quality, but can also produce dramatic increases in
- * amount of printer data generated and actual printing time!! Mode 9 2D
- * compression is still useful for fairly flat colour or blank areas but its
- * compression is much less effective in areas where the dithering has
- * effectively randomised the dot distribution. */
+private int
+dj500c_print_page(gx_device_printer * pdev, FILE * prn_stream)
+{
+ return hp_colour_print_page(pdev, prn_stream, DJ500C);
+}
+
+/* The DeskJet550C can compress (mode 9) */
+private int
+dj550c_print_page(gx_device_printer * pdev, FILE * prn_stream)
+{
+ return hp_colour_print_page(pdev, prn_stream, DJ550C);
+}
+
+/* The DesignJet650C can compress (mode 1) */
+private int
+dnj650c_print_page(gx_device_printer * pdev, FILE * prn_stream)
+{
+ return hp_colour_print_page(pdev, prn_stream, DNJ650C);
+}
+
+private int
+lj4dith_print_page(gx_device_printer * pdev, FILE * prn_stream)
+{
+ return hp_colour_print_page(pdev, prn_stream, LJ4DITH);
+}
+
+/* The PJXL300 can compress (modes 2 & 3) */
+private int
+pjxl300_print_page(gx_device_printer * pdev, FILE * prn_stream)
+{ int ret_code;
+ /* Ensure we're operating in PCL mode */
+ fputs("\033%-12345X@PJL enter language = PCL\n", prn_stream);
+ ret_code = hp_colour_print_page(pdev, prn_stream, PJXL300);
+ /* Reenter switch-configured language */
+ fputs("\033%-12345X", prn_stream);
+ return ret_code;
+}
+
+/* The PaintJet XL can compress (modes 2 & 3) */
+private int
+pjxl_print_page(gx_device_printer * pdev, FILE * prn_stream)
+{
+ return hp_colour_print_page(pdev, prn_stream, PJXL180);
+}
+
+/* The PaintJet can compress (mode 1) */
+private int
+pj_print_page(gx_device_printer * pdev, FILE * prn_stream)
+{
+ return hp_colour_print_page(pdev, prn_stream, PJ180);
+}
+
+/* The LJ250 can compress (mode 1) */
+private int
+declj250_print_page(gx_device_printer * pdev, FILE * prn_stream)
+{ int ret_code;
+ fputs("\033%8", prn_stream); /* Enter PCL emulation mode */
+ ret_code = hp_colour_print_page(pdev, prn_stream, DECLJ250);
+ fputs("\033%@", prn_stream); /* Exit PCL emulation mode */
+ return ret_code;
+}
+
+/* The BJC-600 cannot compress w/o raster image commands. */
+private int
+escp_print_page(gx_device_printer * pdev, FILE * prn_stream)
+{
+ return hp_colour_print_page(pdev, prn_stream, ESC_P);
+}
+
+/* The BJC-600 can compress w/ raster image commands. */
+private int
+bjc_print_page(gx_device_printer * pdev, FILE * prn_stream)
+{
+ return hp_colour_print_page(pdev, prn_stream, bjc->ptype);
+}
+
+/* MACROS FOR DITHERING (we use macros for compact source and faster code) */
+/* Floyd-Steinberg dithering. Often results in a dramatic improvement in
+ * subjective image quality, but can also produce dramatic increases in
+ * amount of printer data generated and actual printing time!! Mode 9 2D
+ * compression is still useful for fairly flat colour or blank areas but its
+ * compression is much less effective in areas where the dithering has
+ * effectively randomised the dot distribution. */
+
#define SHIFT ((I * 8) - 13)
#define RSHIFT ((I * 8) - 16)
#define RANDOM (((rand() << RSHIFT) % (MAXVALUE / 2)) - MAXVALUE / 4);
@@ -1242,6 +1260,7 @@ hp_colour_open(gx_device * pdev, int ptype)
#define MAXVALUE (255 << SHIFT)
#define THRESHOLD (128 << SHIFT)
#define C 8
+
#define FSdither(inP, out, errP, Err, Bit, Offset, Element)\
oldErr = Err;\
Err = (errP[Element] + ((Err * 7 + C) >> 4) + ((int)inP[Element] << SHIFT));\
@@ -1250,11 +1269,17 @@ hp_colour_open(gx_device * pdev, int ptype)
Err -= MAXVALUE;\
}\
errP[Element + Offset] += ((Err * 3 + C) >> 4);\
- errP[Element] = ((Err * 5 + oldErr + C) >> 4); /* Here we rely on compiler optimisation to remove lines of the form
- * (if (1 >= 4) {...}, ie. the constant boolean expressions */ /* The original code is in the #else part. Since by default NEW_DITHER
- is not defined, the old code is used. No enhancement is visible for the
- bjc600 drivers with the new code, anyway :-( */
+ errP[Element] = ((Err * 5 + oldErr + C) >> 4);
+
+/* Here we rely on compiler optimisation to remove lines of the form
+ * (if (1 >= 4) {...}, ie. the constant boolean expressions */
+
+/* The original code is in the #else part. Since by default NEW_DITHER
+ is not defined, the old code is used. No enhancement is visible for the
+ bjc600 drivers with the new code, anyway :-( */
+
#ifdef NEW_DITHER
+
#define FSDline(scan, i, j, plane_size, cErr, mErr, yErr, kErr, cP, mP, yP, kP, n)\
{\
if (scan == 0) { /* going_up */\
@@ -1307,7 +1332,9 @@ hp_colour_open(gx_device * pdev, int ptype)
}\
}\
}
+
#else
+
#define FSDline(scan, i, j, plane_size, cErr, mErr, yErr, kErr, cP, mP, yP, kP, n)\
{\
if (scan == 0) { /* going_up */\
@@ -1376,11 +1403,16 @@ hp_colour_open(gx_device * pdev, int ptype)
}\
}\
}
-#endif /* END MACROS FOR DITHERING */
+
+#endif
+
+/* END MACROS FOR DITHERING */
+
#define CPbit(inP, out, Bit, Element)\
if (inP[Element]) {\
out |= Bit;\
}
+
#define COPYline(scan, i, j, plane_size, cP, mP, yP, kP, n)\
{\
if (scan == 0) { /* going_up */\
@@ -1430,286 +1462,299 @@ hp_colour_open(gx_device * pdev, int ptype)
*--kP = k;\
}\
}\
-} /* Some convenient shorthand .. */
+}
+
+/* Some convenient shorthand .. */
#define x_dpi (pdev->x_pixels_per_inch)
#define y_dpi (pdev->y_pixels_per_inch)
#define CONFIG_16BIT "\033*v6W\000\003\000\005\006\005"
-#define CONFIG_24BIT "\033*v6W\000\003\000\010\010\010" /* To calculate buffer size as next greater multiple of both parameter and W */
-#define calc_buffsize(a, b) (((((a) + ((b) * W) - 1) / ((b) * W))) * W) /*
- * Miscellaneous functions for Canon BJC-600 printers in raster command mode.
- */
-#define fputshort(n, f) fputc((n)%256,f);fputc((n)/256,f) private int bjc_cmd(byte cmd, int argsize, byte * arg, gx_device_printer * pdev,
- FILE * stream) {
- fputs("\033(", stream);
- putc(cmd, stream);
- fputshort(argsize, stream);
- fwrite(arg, sizeof(byte), argsize, stream);
-
- return 0;
- }
- private int
- bjc_raster_cmd_sub(char c, int rastsize, byte * data, FILE * stream) {
- fputs("\033(A", stream);
- fputshort(rastsize + 1, stream);
- putc(c, stream);
- fwrite(data, sizeof(byte), rastsize, stream);
- putc('\015', stream);
-
- return 0;
- }
- private int
- bjc_raster_cmd(int c_id, int rastsize, byte * data, gx_device_printer * pdev,
- FILE * stream) {
- if (bjcparams.printColors == BJC_COLOR_ALLBLACK) {
- bjc_raster_cmd_sub('K', rastsize, data, stream);
- } else if (pdev->color_info.num_components == 1) {
- if (bjcparams.printColors & BJC_COLOR_BLACK) {
- bjc_raster_cmd_sub('K', rastsize, data, stream);
- } else {
- if (bjcparams.printColors & BJC_COLOR_YELLOW)
- bjc_raster_cmd_sub('Y', rastsize, data, stream);
- if (bjcparams.printColors & BJC_COLOR_MAGENTA)
- bjc_raster_cmd_sub('M', rastsize, data, stream);
- if (bjcparams.printColors & BJC_COLOR_CYAN)
- bjc_raster_cmd_sub('C', rastsize, data, stream);
- }
- } else { /* Color decomposition */
- private byte ymckCodes[] =
- {
- BJC_COLOR_YELLOW,
- BJC_COLOR_MAGENTA,
- BJC_COLOR_CYAN,
- BJC_COLOR_BLACK,
- };
-
- if (bjcparams.printColors & (int)ymckCodes[c_id]) {
- bjc_raster_cmd_sub("YMCK"[c_id], rastsize, data, stream);
- }
- }
-
- return 0;
- }
+#define CONFIG_24BIT "\033*v6W\000\003\000\010\010\010"
+
+/* To calculate buffer size as next greater multiple of both parameter and W */
+#define calc_buffsize(a, b) (((((a) + ((b) * W) - 1) / ((b) * W))) * W)
+
+
+/*
+ * Miscellaneous functions for Canon BJC-600 printers in raster command mode.
+ */
+#define fputshort(n, f) fputc((n)%256,f);fputc((n)/256,f)
+
+private int
+bjc_cmd(byte cmd, int argsize, byte* arg, gx_device_printer* pdev,
+ FILE* stream)
+{
+ fputs("\033(", stream);
+ putc(cmd, stream);
+ fputshort(argsize, stream);
+ fwrite(arg, sizeof(byte), argsize, stream);
- private int
- bjc_init_page(gx_device_printer * pdev, FILE * stream) {
- byte pagemargins[3], resolution[2], paperloading[2];
+ return 0;
+}
- /* Compute page margins. */
- pagemargins[0] = (byte) ((float)pdev->height / pdev->y_pixels_per_inch
- * 10 + .5);
- pagemargins[1] = (byte) 1;
- pagemargins[2] = (byte) ((pdev->width / pdev->x_pixels_per_inch * 10) -
- pdev->HWMargins[0] / 7.2 - pdev->HWMargins[2] / 7.2 + .5);
+private int
+bjc_raster_cmd_sub(char c, int rastsize, byte* data, FILE* stream)
+{
+ fputs("\033(A", stream);
+ fputshort(rastsize + 1, stream);
+ putc(c, stream);
+ fwrite(data, sizeof(byte), rastsize, stream);
+ putc('\015', stream);
- /* Cheat to keep margins into bounds (while waiting to have the right
- margins for big papers. */
+ return 0;
+}
- switch (bjc->ptype) {
- case BJC800:
- if (pagemargins[2] > 114)
- pagemargins[2] = 114;
- break;
+private int
+bjc_raster_cmd(int c_id, int rastsize, byte* data, gx_device_printer* pdev,
+ FILE* stream)
+{
+ if (bjcparams.printColors == BJC_COLOR_ALLBLACK) {
+ bjc_raster_cmd_sub('K', rastsize, data, stream);
+ } else if (pdev->color_info.num_components == 1) {
+ if (bjcparams.printColors & BJC_COLOR_BLACK) {
+ bjc_raster_cmd_sub('K', rastsize, data, stream);
+ } else {
+ if (bjcparams.printColors & BJC_COLOR_YELLOW)
+ bjc_raster_cmd_sub('Y', rastsize, data, stream);
+ if (bjcparams.printColors & BJC_COLOR_MAGENTA)
+ bjc_raster_cmd_sub('M', rastsize, data, stream);
+ if (bjcparams.printColors & BJC_COLOR_CYAN)
+ bjc_raster_cmd_sub('C', rastsize, data, stream);
+ }
+ }else { /* Color decomposition */
+ private byte ymckCodes[] = {
+ BJC_COLOR_YELLOW,
+ BJC_COLOR_MAGENTA,
+ BJC_COLOR_CYAN,
+ BJC_COLOR_BLACK,
+ };
+
+ if (bjcparams.printColors & (int) ymckCodes[c_id]) {
+ bjc_raster_cmd_sub("YMCK"[c_id], rastsize, data, stream);
+ }
+ }
- default:
- if (pagemargins[2] > 80)
- pagemargins[2] = 80;
- break;
- } /* Initialize resolution argument. */
- resolution[0] = (byte) ((int)pdev->x_pixels_per_inch / 256);
+ return 0;
+}
- resolution[1] = (byte) ((int)pdev->x_pixels_per_inch % 256);
+private int
+bjc_init_page(gx_device_printer* pdev, FILE* stream)
+{
+ byte pagemargins[3], resolution[2], paperloading[2];
- /* Initialize paper loading argument. */
+ /* Compute page margins. */
- paperloading[0] = 0x10 + ((1 - bjcparams.manualFeed) << 2);
- paperloading[1] = bjcparams.mediaType << 4;
+ pagemargins[0] = (byte) ((float) pdev->height / pdev->y_pixels_per_inch
+ * 10 + .5);
+ pagemargins[1] = (byte) 1;
+ pagemargins[2] = (byte) ((pdev->width / pdev->x_pixels_per_inch * 10) -
+ pdev->HWMargins[0] / 7.2 - pdev->HWMargins[2] / 7.2 + .5);
- /* Reinitialize printer in raster mode. */
+ /* Cheat to keep margins into bounds (while waiting to have the right
+ margins for big papers. */
- fputs("\033[K", stream);
- fputshort(2, stream);
- fputc(0x00, stream);
- fputc(0x0f, stream);
+ switch (bjc->ptype) {
+ case BJC800:
+ if (pagemargins[2] > 114) pagemargins[2] = 114;
+ break;
+
+ default:
+ if (pagemargins[2] > 80) pagemargins[2] = 80;
+ break;
+ }
- /* Set page mode on (ignore data at end of page) */
+ /* Initialize resolution argument. */
- bjc_cmd('a', 1, (byte *) "\001", pdev, stream);
+ resolution[0] = (byte) ((int)pdev->x_pixels_per_inch / 256);
+ resolution[1] = (byte) ((int)pdev->x_pixels_per_inch % 256);
- /* Set page margins */
+ /* Initialize paper loading argument. */
- bjc_cmd('g', 3, pagemargins, pdev, stream);
+ paperloading[0] = 0x10 + ((1 - bjcparams.manualFeed) << 2);
+ paperloading[1] = bjcparams.mediaType << 4;
- /* Set compression on (this is PackBits compression a la TIFF/Mac) */
+ /* Reinitialize printer in raster mode. */
- bjc_cmd('b', 1, (byte *) "\001", pdev, stream);
+ fputs("\033[K", stream);
+ fputshort(2, stream);
+ fputc(0x00, stream);
+ fputc(0x0f, stream);
- /* Set paper loading. */
+ /* Set page mode on (ignore data at end of page) */
- bjc_cmd('l', 2, paperloading, pdev, stream);
+ bjc_cmd('a', 1, (byte*) "\001", pdev, stream);
- /* Set printing method. */
+ /* Set page margins */
+
+ bjc_cmd('g', 3, pagemargins, pdev, stream);
+
+ /* Set compression on (this is PackBits compression a la TIFF/Mac) */
+
+ bjc_cmd('b', 1, (byte*) "\001", pdev, stream);
+
+ /* Set paper loading. */
+
+ bjc_cmd('l', 2, paperloading, pdev, stream);
+
+ /* Set printing method. */
#ifndef BJC_INIT_800_AS_600
- if (bjc->ptype == BJC800) {
+ if (bjc->ptype == BJC800) {
#else
- if (0) {
+ if (0) {
#endif
- byte printmode[2];
+ byte printmode[2];
+
+ printmode[0] = bjcparams.printQuality;
- printmode[0] = bjcparams.printQuality;
+ /* Modes not used are 3 (CN, Color Normal) and 2 (TP+ (?)) */
- /* Modes not used are 3 (CN, Color Normal) and 2 (TP+ (?)) */
+ switch (bjcparams.printQuality) {
+ case BJC_QUALITY_DRAFT:
+ printmode[0] = 4; /* Draft */
+ break;
+ }
- switch (bjcparams.printQuality) {
- case BJC_QUALITY_DRAFT:
- printmode[0] = 4; /* Draft */
- break;
- }
+ printmode[1] = (bjcparams.mediaType >= BJC_MEDIA_ENVELOPE ? 1 :
+ bjc800thickpaper());
- printmode[1] = (bjcparams.mediaType >= BJC_MEDIA_ENVELOPE ? 1 :
- bjc800thickpaper());
+ bjc_cmd('c', 2, printmode, pdev, stream);
+ } else /* BJC600 */ {
+ byte printmeth[3];
- bjc_cmd('c', 2, printmode, pdev, stream);
- } else { /* BJC600 */
- byte printmeth[3];
+ printmeth[0] = 0x10 + ((1 - bjcparams.manualFeed) << 2);
+ printmeth[1] = (bjcparams.mediaType << 4) + bjcparams.printQuality;
+ printmeth[2] = (bjcparams.printQuality == BJC_QUALITY_HIGH ?
+ 0x10 : 0) + (bjcparams.mediaType >= BJC_MEDIA_ENVELOPE ? 1 :
+ bjc600thickpaper());
- printmeth[0] = 0x10 + ((1 - bjcparams.manualFeed) << 2);
- printmeth[1] = (bjcparams.mediaType << 4) + bjcparams.printQuality;
- printmeth[2] = (bjcparams.printQuality == BJC_QUALITY_HIGH ?
- 0x10 : 0) + (bjcparams.mediaType >= BJC_MEDIA_ENVELOPE ? 1 :
- bjc600thickpaper());
+ bjc_cmd('c', 3, printmeth, pdev, stream);
+ }
- bjc_cmd('c', 3, printmeth, pdev, stream);
- }
+ /* Set raster resolution */
- /* Set raster resolution */
+ bjc_cmd('d', 2, resolution, pdev, stream);
- bjc_cmd('d', 2, resolution, pdev, stream);
+ return 0;
+}
- return 0;
- }
+private int
+bjc_v_skip(int n, gx_device_printer* pdev, FILE* stream)
+{
+ if (n) {
+ fputs("\033(e", stream);
+ putc(2, stream);
+ putc(0, stream);
+ putc(n / 256, stream);
+ putc(n % 256, stream);
+ }
- private int
- bjc_v_skip(int n, gx_device_printer * pdev, FILE * stream) {
- if (n) {
- fputs("\033(e", stream);
- putc(2, stream);
- putc(0, stream);
- putc(n / 256, stream);
- putc(n % 256, stream);
- }
- return 0;
- }
+ return 0;
+}
- private int
- bjc_finish_page(gx_device_printer * pdev, FILE * stream) {
- bjc_cmd('a', 1, (byte *) "\000", pdev, stream);
- bjc_cmd('b', 1, (byte *) "\000", pdev, stream);
- fputc('\014', stream);
- fputs("\033@", stream);
-
- return 0;
- } /* 1D runlength compression for BJC-600
- * this code is borrowed from gdevpcl.c:gdev_pcl_mode2compress.
- */
- private int
- bjc_compress(const byte * row, const byte * end_row, byte * compressed) {
- register const byte *exam = row;
- register byte *cptr = compressed; /* output pointer into compressed bytes */
-
-
- while (exam < end_row) {
- /* Search ahead in the input looking for a run */
- /* of at least 4 identical bytes. */
- const byte *compr = exam;
- const byte *end_dis;
- const byte *next;
- register byte test, test2;
-
- test = *exam;
- while (exam < end_row) {
- test2 = *++exam;
- if (test == test2)
- break;
- test = test2;
- } /* Find out how long the run is */
- end_dis = exam - 1;
-
- if (exam == end_row) { /* no run */
- next = --end_row;
- } else {
-
- next = exam + 1;
- while (next < end_row && *next == test)
- next++;
- }
-
-
- /* Now [compr..end_dis) should be encoded as dissimilar, */
- /* and [end_dis..next) should be encoded as similar. */
- /* Note that either of these ranges may be empty. */
-
-
- for (;;) { /* Encode up to 128 dissimilar bytes */
- uint count = end_dis - compr; /* uint for faster switch */
-
- switch (count) { /* Use memcpy only if it's worthwhile. */
- case 6:
- cptr[6] = compr[5];
- case 5:
- cptr[5] = compr[4];
- case 4:
- cptr[4] = compr[3];
- case 3:
- cptr[3] = compr[2];
- case 2:
- cptr[2] = compr[1];
- case 1:
- cptr[1] = compr[0];
- *cptr = count - 1;
- cptr += count + 1;
- case 0: /* all done */
- break;
- default:
- if (count > 128)
- count = 128;
- *cptr++ = count - 1;
- memcpy(cptr, compr, count);
- cptr += count, compr += count;
- continue;
- }
- break;
- }
-
-
- { /* Encode up to 128 similar bytes. */
- /* Note that count may be <0 at end of row. */
- int count = next - end_dis;
-
- if (next < end_row || test != 0)
- while (count > 0) {
-
- int this = (count > 128 ? 128 : count);
-
- *cptr++ = 257 - this;
- *cptr++ = (byte) test;
- count -= this;
- }
- exam = next;
- }
- }
- return cptr - compressed;
- }
+private int
+bjc_finish_page(gx_device_printer* pdev, FILE* stream)
+{
+ bjc_cmd('a', 1, (byte*) "\000", pdev, stream);
+ bjc_cmd('b', 1, (byte*) "\000", pdev, stream);
+ fputc('\014', stream);
+ fputs("\033@", stream);
+
+ return 0;
+}
+
+/* 1D runlength compression for BJC-600
+ * this code is borrowed from gdevpcl.c:gdev_pcl_mode2compress.
+ */
+private int
+bjc_compress(const byte *row, const byte *end_row, byte *compressed)
+{
+ register const byte *exam = row;
+ register byte *cptr = compressed; /* output pointer into compressed bytes */
+
+
+ while ( exam < end_row ) {
+ /* Search ahead in the input looking for a run */
+ /* of at least 4 identical bytes. */
+ const byte *compr = exam;
+ const byte *end_dis;
+ const byte *next;
+ register byte test, test2;
+
+ test = *exam;
+ while ( exam < end_row ) {
+ test2 = *++exam;
+ if ( test == test2 )
+ break;
+ test = test2;
+ }
+
+
+ /* Find out how long the run is */
+ end_dis = exam - 1;
+ if ( exam == end_row ) { /* no run */
+ next = --end_row;
+ } else {
+
+ next = exam + 1;
+ while ( next < end_row && *next == test ) next++;
+ }
+
+
+ /* Now [compr..end_dis) should be encoded as dissimilar, */
+ /* and [end_dis..next) should be encoded as similar. */
+ /* Note that either of these ranges may be empty. */
+
+
+ for ( ; ; ) { /* Encode up to 128 dissimilar bytes */
+ uint count = end_dis - compr; /* uint for faster switch */
+ switch ( count ) { /* Use memcpy only if it's worthwhile. */
+ case 6: cptr[6] = compr[5];
+ case 5: cptr[5] = compr[4];
+ case 4: cptr[4] = compr[3];
+ case 3: cptr[3] = compr[2];
+ case 2: cptr[2] = compr[1];
+ case 1: cptr[1] = compr[0];
+ *cptr = count - 1;
+ cptr += count + 1;
+ case 0: /* all done */
+ break;
+ default:
+ if ( count > 128 ) count = 128;
+ *cptr++ = count - 1;
+ memcpy(cptr, compr, count);
+ cptr += count, compr += count;
+ continue;
+ }
+ break;
+ }
+
+
+ { /* Encode up to 128 similar bytes. */
+ /* Note that count may be <0 at end of row. */
+ int count = next - end_dis;
+ if (next < end_row || test != 0)
+ while ( count > 0 ) {
+
+ int this = (count > 128 ? 128 : count);
+ *cptr++ = 257 - this;
+ *cptr++ = (byte)test;
+ count -= this;
+ }
+ exam = next;
+ }
+ }
+ return cptr - compressed;
+}
/*
* For the ESC/P mode, resolution is fixed as 360dpi and we must transform
* image data to serialized data.
*/
- private word *ep_storage;
- private uint ep_storage_size_words;
- private byte *ep_raster_buf[4][BJC_HEAD_ROWS], *ep_print_buf;
- private int ep_num_comps, ep_plane_size, img_rows = BJC_HEAD_ROWS;
+private word *ep_storage;
+private uint ep_storage_size_words;
+private byte *ep_raster_buf[4][BJC_HEAD_ROWS], *ep_print_buf;
+private int ep_num_comps, ep_plane_size, img_rows=BJC_HEAD_ROWS;
#define row_bytes (img_rows / 8)
@@ -1717,853 +1762,850 @@ hp_colour_open(gx_device * pdev, int ptype)
#define min_rows (32) /* for optimization of text image printing */
- private int
- ep_print_image(FILE * prn_stream, char cmd, byte * data, int size) {
- static int ln_idx = 0, vskip1 = 0, vskip2 = 0,
- real_rows;
- int i;
- static const char color[4] =
- {4, 1, 2, 0};
-
-
- switch (cmd) {
- case 3: /* Black */
- case 2: /* Cyan */
- case 1: /* Magenta */
- case 0: /* Yellow */
- memcpy(ep_raster_buf[((int)cmd)][ln_idx + vskip2], data, size);
- return 0;
- case 'B': /* blank line skip */
- if (!ln_idx) {
- vskip1 += size;
- } else if (size >= img_rows - (ln_idx + vskip2) || ln_idx + vskip2 >= min_rows) {
- /* The 'I' cmd must precede 'B' cmd! */
- vskip2 += size;
- ep_print_image(prn_stream, 'F', 0, 0); /* flush and reset status */
- } else {
- vskip2 += size;
- }
- return 0;
- case 'I': /* Increment index */
- ln_idx += vskip2 + 1;
- vskip2 = 0;
- if (ln_idx < img_rows)
- return 0;
- /* if ep_raster_buf filled up, then fall through here and flush buffer */
- case 'F': /* flush print buffer */
- if (!ln_idx)
- return 0; /* The end of the page. */
-
-
- /* before print the image, perform vertical skip. */
- while (vskip1 >= (255 * 2)) {
- fputs("\033J\377", prn_stream); /* n/180in. feeding */
- vskip1 -= (255 * 2);
- }
- if (vskip1 > 255) {
- fputs("\033J\200", prn_stream);
- vskip1 -= 256;
- }
- if (vskip1) {
- /* n/360in. feeding */
- fputs("\033|J", prn_stream);
- putc(0, prn_stream);
- putc(vskip1, prn_stream);
- }
- /* Optimize the number of nozzles to be used. */
- if (ln_idx > 56) { /* use 64 nozzles */
- real_rows = 64;
- } else if (ln_idx > 48) { /* use 56 nozzles */
- real_rows = 56;
- } else if (ln_idx > 32) { /* use 48 nozzles */
- real_rows = 48;
- } else { /* use 32 nozzles */
- real_rows = 32;
- }
-
-
- for (i = 0; i < ep_num_comps; i++) {
- int lnum, hskip, print_size, img_rows;
- byte *p0, *p1, *p2, *p3;
- byte *inp, *inbuf, *outp, *outbuf;
-
-
- img_rows = real_rows; /* Note that this img_rows is not the one that
- * defined out of this function. */
- outbuf = ep_print_buf;
-
-
- /* Transpose raster image for serial printer image */
- for (lnum = 0; lnum < img_rows; lnum += 8, outbuf++) {
- inbuf = inp = ep_raster_buf[i][lnum];
- for (outp = outbuf; inp < inbuf + ep_plane_size; inp++, outp += img_rows) {
- memflip8x8(inp, ep_plane_size, outp, row_bytes);
- }
- }
-
-
- /* Set color */
- if (ep_num_comps == 1) {
- /* Don't set color (to enable user setting). */
- putc('\015', prn_stream);
- } else {
- /* set color to one of CMYK. */
- fputs("\015\033r", prn_stream);
- putc(color[i], prn_stream);
- }
-
-
- *(outp = ep_print_buf + ep_plane_size * img_rows) = 1; /* sentinel */
-
-
- p0 = p3 = ep_print_buf;
-
-
- /* print image p0 to p1 and h skip p1 to p2 if p2<outp,
- * then make p0=p2 and continue */
- while (p0 < outp) {
- static const word zeros[8] =
- {0, 0, 0, 0, 0, 0, 0, 0};
-
-
- if (p3 < outp) {
- /* p1 is the head of running zeros. */
- /* note that h skip unit is 1/180inch */
- for (p1 = p3; !memcmp(p3, zeros, row_bytes * 2); p3 += row_bytes * 2);
- /* p2 is the head of non zero image. */
- p2 = p3;
- redo:
- for (p3 += row_bytes; memcmp(p3, zeros, row_bytes); p3 += row_bytes);
- if (p3 < outp && memcmp(p3 + row_bytes, zeros, row_bytes))
- goto redo;
- } else
- p1 = p2 = outp;
-
-
- if (p0 < p1) { /* print the image between p0 and p1 */
- print_size = ((p1 < outp) ? p1 : outp) - p0;
- fputs("\033|B", prn_stream);
- putc(img_rows, prn_stream);
- fputshort(print_size, prn_stream);
- fwrite(p0, sizeof(byte), print_size, prn_stream);
- }
- if (p1 < p2) { /* skip running zeros from p1 to p2 */
- hskip = (((p2 < outp) ? p2 : outp) - p1) / row_bytes / 2;
- fputs("\033\\", prn_stream);
- fputshort(hskip, prn_stream);
- }
- p0 = p2;
- }
- }
- return ep_print_image(prn_stream, 'R', 0, vskip2 + ln_idx);
- case 'R': /* Reset status */
- ln_idx = 0;
- vskip1 = size;
- vskip2 = 0;
- memset(ep_storage, 0, ep_storage_size_words * W);
- return 0;
- default: /* This should not happen */
- fprintf(stderr, "ep_print_image: illegal command character `%c'.\n", cmd);
- return 1;
- }
-
-
- /* NOT REACHED */
- }
+private int
+ep_print_image(FILE *prn_stream, char cmd, byte *data, int size)
+{
+ static int ln_idx=0, vskip1=0, vskip2=0, real_rows;
+ int i;
+ static const char color[4] = {4,1,2,0};
+
+
+ switch (cmd) {
+ case 3: /* Black */
+ case 2: /* Cyan */
+ case 1: /* Magenta */
+ case 0: /* Yellow */
+ memcpy(ep_raster_buf[((int) cmd)][ln_idx+vskip2], data, size);
+ return 0;
+ case 'B': /* blank line skip */
+ if (!ln_idx) {
+ vskip1 += size;
+ } else if (size >= img_rows - (ln_idx+vskip2) || ln_idx+vskip2 >= min_rows) {
+ /* The 'I' cmd must precede 'B' cmd! */
+ vskip2 += size;
+ ep_print_image(prn_stream, 'F', 0, 0); /* flush and reset status */
+ } else {
+ vskip2 += size;
+ }
+ return 0;
+ case 'I': /* Increment index */
+ ln_idx += vskip2 + 1;
+ vskip2 = 0;
+ if (ln_idx < img_rows) return 0;
+ /* if ep_raster_buf filled up, then fall through here and flush buffer */
+ case 'F': /* flush print buffer */
+ if (!ln_idx) return 0; /* The end of the page. */
+
+
+ /* before print the image, perform vertical skip. */
+ while (vskip1 >= (255*2)) {
+ fputs("\033J\377", prn_stream); /* n/180in. feeding */
+ vskip1 -= (255*2);
+ }
+ if (vskip1 > 255) {
+ fputs("\033J\200", prn_stream);
+ vskip1 -= 256;
+ }
+ if (vskip1) {
+ /* n/360in. feeding */
+ fputs("\033|J", prn_stream); putc(0, prn_stream); putc(vskip1, prn_stream);
+ }
+
+
+ /* Optimize the number of nozzles to be used. */
+ if (ln_idx > 56) { /* use 64 nozzles */
+ real_rows = 64;
+ } else if (ln_idx > 48) { /* use 56 nozzles */
+ real_rows = 56;
+ } else if (ln_idx > 32) { /* use 48 nozzles */
+ real_rows = 48;
+ } else { /* use 32 nozzles */
+ real_rows = 32;
+ }
+
+
+ for (i = 0; i < ep_num_comps; i++) {
+ int lnum, hskip, print_size, img_rows;
+ byte *p0, *p1, *p2, *p3;
+ byte *inp, *inbuf, *outp, *outbuf;
+
+
+ img_rows = real_rows; /* Note that this img_rows is not the one that
+ * defined out of this function. */
+ outbuf = ep_print_buf;
+
+
+ /* Transpose raster image for serial printer image */
+ for (lnum=0; lnum < img_rows; lnum+=8, outbuf++) {
+ inbuf = inp = ep_raster_buf[i][lnum];
+ for (outp = outbuf; inp < inbuf+ep_plane_size; inp++, outp += img_rows) {
+ memflip8x8(inp, ep_plane_size, outp, row_bytes);
+ }
+ }
+
+
+ /* Set color */
+ if (ep_num_comps == 1) {
+ /* Don't set color (to enable user setting). */
+ putc('\015', prn_stream);
+ } else {
+ /* set color to one of CMYK. */
+ fputs("\015\033r", prn_stream);
+ putc(color[i], prn_stream);
+ }
+
+
+ *(outp = ep_print_buf + ep_plane_size * img_rows) = 1; /* sentinel */
+
+
+ p0 = p3 = ep_print_buf;
+
+
+ /* print image p0 to p1 and h skip p1 to p2 if p2<outp,
+ * then make p0=p2 and continue */
+ while (p0 < outp) {
+ static const word zeros[8] = {0,0,0,0,0,0,0,0};
+
+
+ if (p3 < outp) {
+ /* p1 is the head of running zeros. */
+ /* note that h skip unit is 1/180inch */
+ for (p1 = p3; !memcmp(p3, zeros, row_bytes*2); p3 += row_bytes*2);
+ /* p2 is the head of non zero image. */
+ p2 = p3;
+ redo:
+ for (p3 += row_bytes; memcmp(p3, zeros, row_bytes); p3 += row_bytes);
+ if (p3 < outp && memcmp(p3+row_bytes, zeros, row_bytes)) goto redo;
+ } else p1 = p2 = outp;
+
+
+ if (p0 < p1) { /* print the image between p0 and p1 */
+ print_size = ((p1 < outp) ? p1 : outp) - p0;
+ fputs("\033|B", prn_stream); putc(img_rows, prn_stream);
+ fputshort(print_size, prn_stream);
+ fwrite(p0, sizeof(byte), print_size, prn_stream);
+ }
+ if (p1 < p2) { /* skip running zeros from p1 to p2 */
+ hskip = (((p2 < outp) ? p2 : outp) - p1) / row_bytes / 2;
+ fputs("\033\\", prn_stream);
+ fputshort(hskip, prn_stream);
+ }
+ p0 = p2;
+ }
+ }
+ return ep_print_image(prn_stream, 'R', 0, vskip2 + ln_idx);
+ case 'R': /* Reset status */
+ ln_idx = 0;
+ vskip1 = size;
+ vskip2 = 0;
+ memset(ep_storage, 0, ep_storage_size_words * W);
+ return 0;
+ default: /* This should not happen */
+ fprintf(stderr, "ep_print_image: illegal command character `%c'.\n", cmd);
+ return 1;
+ }
+
+
+ /* NOT REACHED */
+}
/* Send the page to the printer. Compress each scan line. */
- private int
- hp_colour_print_page(gx_device_printer * pdev, FILE * prn_stream, int ptype) {
- uint raster_width = gdev_prn_rasterwidth(pdev, 1);
+private int
+hp_colour_print_page(gx_device_printer * pdev, FILE * prn_stream, int ptype)
+{
+ uint raster_width = gdev_prn_rasterwidth(pdev, 1);
/* int line_size = gdev_prn_rasterwidth(pdev, 0); */
- int line_size = gdev_prn_raster(pdev);
- int line_size_words = (line_size + W - 1) / W;
- int paper_size = gdev_pcl_paper_size((gx_device *) pdev);
- int num_comps = pdev->color_info.num_components;
- int bits_per_pixel = pdev->color_info.depth;
- int storage_bpp = bits_per_pixel;
- int expanded_bpp = bits_per_pixel;
- int plane_size, databuff_size;
- int combined_escapes = 1;
- int errbuff_size = 0;
- int outbuff_size = 0;
- int compression = 0;
- int scan = 0;
- int *errors[2];
- const char *cid_string = (const char *)0;
- byte *data[4], *plane_data[4][4], *out_data;
- byte *out_row, *out_row_alt;
- word *storage;
- uint storage_size_words;
-
- /* Tricks and cheats ... */
- switch (ptype) {
- case DJ550C:
- if (num_comps == 3 && !cprn_device->cmyk)
- num_comps = 4; /* 4-component printing */
- break;
- case ESC_P:
- if (bits_per_pixel == 24) /* prefer 3-component printing for bpp=24. */
- num_comps = 3;
- else if (num_comps != 1)
- num_comps = 4;
- break;
- case PJXL300:
- case PJXL180:
- if (pjxl->rendertype > 0) {
- if (bits_per_pixel < 16)
- pjxl->rendertype = 0;
- else {
- /* Control codes for CID sequence */
- cid_string = (bits_per_pixel == 16) ? CONFIG_16BIT : CONFIG_24BIT;
- /* Pretend we're a monobit device so we send the data out unchanged */
- bits_per_pixel = storage_bpp = expanded_bpp = 1;
- num_comps = 1;
- }
- }
- break;
- }
-
- if (cprn_device->cmyk <= 0) {
- if (storage_bpp == 8 && num_comps >= 3)
- bits_per_pixel = expanded_bpp = 3; /* Only 3 bits of each byte used */
- }
- plane_size = calc_buffsize(line_size, storage_bpp);
- ep_plane_size = plane_size;
-
- if (bits_per_pixel == 1) { /* Data printed direct from i/p */
- databuff_size = 0; /* so no data buffer required, */
- outbuff_size = plane_size * 4; /* but need separate output buffers */
- }
- if (bits_per_pixel > 4) { /* Error buffer for FS dithering */
- storage_bpp = expanded_bpp =
- num_comps * 8; /* 8, 24 or 32 bits */
-
- if (cprn_device->cmyk > 0) { /* Use CMYK dithering algorithm. */
- errbuff_size = 4 * (5 + 1 + 1 + line_size + 1 + 2) * I;
- } else { /* Use original (RGB) dithering. */
- errbuff_size = /* 4n extra values for line ends */
- calc_buffsize((plane_size * expanded_bpp + num_comps * 4) * I, 1);
- }
- }
- databuff_size = plane_size * storage_bpp;
-
- storage_size_words = ((plane_size + plane_size) * num_comps +
- databuff_size + errbuff_size + outbuff_size) / W;
-
- storage = (ulong *) gs_malloc(storage_size_words, W, "hp_colour_print_page");
- ep_storage_size_words = (plane_size * (num_comps + 1)) / W * img_rows
- + 16; /* Redundant space for sentinel and aligning. */
- ep_storage = (word *) gs_malloc(ep_storage_size_words, W, "ep_print_buffer");
-
- /*
- * The principal data pointers are stored as pairs of values, with
- * the selection being made by the 'scan' variable. The function of the
- * scan variable is overloaded, as it controls both the alternating
- * raster scan direction used in the Floyd-Steinberg dithering and also
- * the buffer alternation required for line-difference compression.
- *
- * Thus, the number of pointers required is as follows:
- *
- * errors: 2 (scan direction only)
- * data: 4 (scan direction and alternating buffers)
- * plane_data: 4 (scan direction and alternating buffers)
- */
-
- if (storage == 0 || ep_storage == 0) /* can't allocate working area */
- return_error(gs_error_VMerror);
- else {
- int i, j;
- byte *p = out_data = out_row = (byte *) storage;
- byte *ep_p = (byte *) ep_storage;
-
- data[0] = data[1] = data[2] = p;
- data[3] = p + databuff_size;
- out_row_alt = out_row + plane_size * 2;
- if (bits_per_pixel > 1) {
- p += databuff_size;
- }
- if (bits_per_pixel > 4) {
- errors[0] = (int *)p + num_comps * 2;
- errors[1] = errors[0] + databuff_size;
- p += errbuff_size;
- }
- for (i = 0; i < num_comps; i++) {
- plane_data[0][i] = plane_data[2][i] = p;
- p += plane_size;
- }
- for (i = 0; i < num_comps; i++) {
- plane_data[1][i] = p;
- plane_data[3][i] = p + plane_size;
- p += plane_size;
- }
- if (bits_per_pixel == 1) {
- out_data = out_row = p; /* size is outbuff_size * 4 */
- out_row_alt = out_row + plane_size * 2;
- data[1] += databuff_size; /* coincides with plane_data pointers */
- data[3] += databuff_size;
- }
- for (i = 0; i < num_comps; i++) {
- for (j = 0; j < img_rows; j++) {
- ep_raster_buf[i][j] = ep_p;
- ep_p += plane_size;
- }
- /* Make a sentinel and align to word size. */
- ep_print_buf = (byte *) ((word) (ep_p + sizeof(word)) & ~(sizeof(word) - 1));
- }
- ep_num_comps = num_comps;
- }
-
- /* Initialize printer. */
- if (ptype == BJC600 || ptype == BJC800) {
- bjc_init_page(pdev, prn_stream);
- } else {
- if (ptype == LJ4DITH) {
- fputs("\033*rB", prn_stream);
- } else {
- fputs("\033*rbC", prn_stream); /* End raster graphics */
- }
- fprintf(prn_stream, "\033*t%dR", (int)x_dpi);
- /* Set resolution */
- }
-
- /* Clear temp storage */
- memset(storage, 0, storage_size_words * W);
+ int line_size = gdev_prn_raster(pdev);
+ int line_size_words = (line_size + W - 1) / W;
+ int paper_size = gdev_pcl_paper_size((gx_device *)pdev);
+ int num_comps = pdev->color_info.num_components;
+ int bits_per_pixel = pdev->color_info.depth;
+ int storage_bpp = bits_per_pixel;
+ int expanded_bpp = bits_per_pixel;
+ int plane_size, databuff_size;
+ int combined_escapes = 1;
+ int errbuff_size = 0;
+ int outbuff_size = 0;
+ int compression = 0;
+ int scan = 0;
+ int *errors[2];
+ const char *cid_string = (const char*) 0;
+ byte *data[4], *plane_data[4][4], *out_data;
+ byte *out_row, *out_row_alt;
+ word *storage;
+ uint storage_size_words;
+
+ /* Tricks and cheats ... */
+ switch (ptype) {
+ case DJ550C:
+ if (num_comps == 3 && !cprn_device->cmyk)
+ num_comps = 4; /* 4-component printing */
+ break;
+ case ESC_P:
+ if (bits_per_pixel == 24) /* prefer 3-component printing for bpp=24. */
+ num_comps = 3;
+ else
+ if (num_comps != 1)
+ num_comps = 4;
+ break;
+ case PJXL300:
+ case PJXL180:
+ if (pjxl->rendertype > 0) {
+ if (bits_per_pixel < 16)
+ pjxl->rendertype = 0;
+ else {
+ /* Control codes for CID sequence */
+ cid_string = (bits_per_pixel == 16) ? CONFIG_16BIT : CONFIG_24BIT;
+ /* Pretend we're a monobit device so we send the data out unchanged */
+ bits_per_pixel = storage_bpp = expanded_bpp = 1;
+ num_comps = 1;
+ }
+ }
+ break;
+ }
+
+ if (cprn_device->cmyk <= 0) {
+ if (storage_bpp == 8 && num_comps >= 3)
+ bits_per_pixel = expanded_bpp = 3; /* Only 3 bits of each byte used */
+ }
+
+ plane_size = calc_buffsize(line_size, storage_bpp);
+ ep_plane_size = plane_size;
+
+ if (bits_per_pixel == 1) { /* Data printed direct from i/p */
+ databuff_size = 0; /* so no data buffer required, */
+ outbuff_size = plane_size * 4; /* but need separate output buffers */
+ }
+
+ if (bits_per_pixel > 4) { /* Error buffer for FS dithering */
+ storage_bpp = expanded_bpp =
+ num_comps * 8; /* 8, 24 or 32 bits */
+
+ if (cprn_device->cmyk > 0) { /* Use CMYK dithering algorithm. */
+ errbuff_size = 4 * (5 + 1 + 1 + line_size + 1 + 2) * I;
+ } else { /* Use original (RGB) dithering. */
+ errbuff_size = /* 4n extra values for line ends */
+ calc_buffsize((plane_size * expanded_bpp + num_comps * 4) * I, 1);
+ }
+ }
+
+ databuff_size = plane_size * storage_bpp;
+
+ storage_size_words = ((plane_size + plane_size) * num_comps +
+ databuff_size + errbuff_size + outbuff_size) / W;
+
+ storage = (ulong *) gs_malloc(storage_size_words, W, "hp_colour_print_page");
+ ep_storage_size_words = (plane_size * (num_comps + 1)) / W * img_rows
+ + 16; /* Redundant space for sentinel and aligning. */
+ ep_storage = (word *) gs_malloc(ep_storage_size_words, W, "ep_print_buffer");
+
+ /*
+ * The principal data pointers are stored as pairs of values, with
+ * the selection being made by the 'scan' variable. The function of the
+ * scan variable is overloaded, as it controls both the alternating
+ * raster scan direction used in the Floyd-Steinberg dithering and also
+ * the buffer alternation required for line-difference compression.
+ *
+ * Thus, the number of pointers required is as follows:
+ *
+ * errors: 2 (scan direction only)
+ * data: 4 (scan direction and alternating buffers)
+ * plane_data: 4 (scan direction and alternating buffers)
+ */
+
+ if (storage == 0 || ep_storage == 0) /* can't allocate working area */
+ return_error(gs_error_VMerror);
+ else {
+ int i, j;
+ byte *p = out_data = out_row = (byte *)storage;
+ byte *ep_p = (byte *)ep_storage;
+ data[0] = data[1] = data[2] = p;
+ data[3] = p + databuff_size;
+ out_row_alt = out_row + plane_size * 2;
+ if (bits_per_pixel > 1) {
+ p += databuff_size;
+ }
+ if (bits_per_pixel > 4) {
+ errors[0] = (int *)p + num_comps * 2;
+ errors[1] = errors[0] + databuff_size;
+ p += errbuff_size;
+ }
+ for (i = 0; i < num_comps; i++) {
+ plane_data[0][i] = plane_data[2][i] = p;
+ p += plane_size;
+ }
+ for (i = 0; i < num_comps; i++) {
+ plane_data[1][i] = p;
+ plane_data[3][i] = p + plane_size;
+ p += plane_size;
+ }
+ if (bits_per_pixel == 1) {
+ out_data = out_row = p; /* size is outbuff_size * 4 */
+ out_row_alt = out_row + plane_size * 2;
+ data[1] += databuff_size; /* coincides with plane_data pointers */
+ data[3] += databuff_size;
+ }
+ for (i = 0; i < num_comps; i++) {
+ for (j = 0; j < img_rows; j++) {
+ ep_raster_buf[i][j] = ep_p;
+ ep_p += plane_size;
+ }
+ /* Make a sentinel and align to word size. */
+ ep_print_buf = (byte *)((word)(ep_p + sizeof(word)) & ~(sizeof(word)-1));
+ }
+ ep_num_comps = num_comps;
+ }
+
+ /* Initialize printer. */
+ if (ptype == BJC600 || ptype == BJC800) {
+ bjc_init_page(pdev, prn_stream);
+ } else {
+ if (ptype == LJ4DITH) {
+ fputs("\033*rB", prn_stream);
+ } else {
+ fputs("\033*rbC", prn_stream); /* End raster graphics */
+ }
+ fprintf(prn_stream, "\033*t%dR", (int)x_dpi);
+ /* Set resolution */
+ }
+
+ /* Clear temp storage */
+ memset(storage, 0, storage_size_words * W);
#define DOFFSET (dev_t_margin(pdev) - DESKJET_PRINT_LIMIT) /* Print position */
#define POFFSET (dev_t_margin(pdev) - PAINTJET_PRINT_LIMIT)
#define EOFFSET (dev_t_margin(pdev) - ESC_P_PRINT_LIMIT)
#define BOFFSET (dev_t_margin(pdev) - bjc->printLimit)
- switch (ptype) {
- case LJ4DITH:
- /* Page size, orientation, top margin & perforation skip */
- fprintf(prn_stream, "\033&l26A\033&l0o0e0L\033*r0F");
- fprintf(prn_stream, "\033*p0x0Y"); /* These Offsets are hacked ! */
- fprintf(prn_stream, "\033&u600D\033*r1A");
- /* Select data compression */
- compression = 3;
- combined_escapes = 0;
- break;
- case DJ500C:
- case DJ550C:
- /* Page size, orientation, top margin & perforation skip */
- fprintf(prn_stream, "\033&l%daolE", paper_size);
- /* Set depletion and shingling levels */
- fprintf(prn_stream, "\033*o%dd%dQ", cdj->depletion, cdj->shingling);
- /* Move to top left of printed area */
- fprintf(prn_stream, "\033*p%dY", (int)(300 * DOFFSET));
- /* Set number of planes ((-)1 is mono, (-)3 is (cmy)rgb, -4 is cmyk),
- * and raster width, then start raster graphics */
- fprintf(prn_stream, "\033*r%ds-%du0A", raster_width, num_comps);
- /* Select data compression */
- compression = 9;
- break;
- case DNJ650C:
- fprintf(prn_stream, "\033%%0B"); /* Enter HPGL/2 mode */
- fprintf(prn_stream, "BP5,1"); /* Turn off autorotation */
- fprintf(prn_stream, "PS%d,%d",
- (int)((pdev->height / pdev->y_pixels_per_inch) * 1016),
- (int)((pdev->width / pdev->x_pixels_per_inch) * 1016)); /* Set length/width of page */
- fprintf(prn_stream, "PU"); /* Pen up */
- fprintf(prn_stream, "PA%d,%d", 0, 0); /* Move pen to upper-left */
- fprintf(prn_stream, "\033%%1A"); /* Enter HP-RTL mode */
- fprintf(prn_stream, "\033&a1N"); /* No negative motion - allow plotting
- while receiving */
- {
- static const char temp[] =
- {
- 033, '*', 'v', '6', 'W',
- 000 /* color model */ ,
- 000 /* pixel encoding mode */ ,
- 003 /* number of bits per index */ ,
- 010 /* bits red */ ,
- 010 /* bits green */ ,
- 010 /* bits blue */
- };
-
- fwrite(temp, 1, sizeof(temp), prn_stream);
- }
-
- /* Set raster width */
- fprintf(prn_stream, "\033*r%dS", raster_width);
- /* Start raster graphics */
- fprintf(prn_stream, "\033*r1A");
-
- /* Select data compression */
- compression = 1;
- /* No combined escapes for raster transfers */
- combined_escapes = 0;
- break;
- case PJXL300:
- /* Page size, orientation, top margin & perforation skip */
- fprintf(prn_stream, "\033&l%daolE", paper_size);
- /* Set no-negative-motion mode, for faster (unbuffered) printing */
- fprintf(prn_stream, "\033&a1N");
- /* Set print quality */
- fprintf(prn_stream, "\033*o%dQ", pjxl->printqual);
- /* Move to top left of printed area */
- fprintf(prn_stream, "\033*p%dY", (int)(300 * POFFSET));
- /* Configure colour setup */
- if (pjxl->rendertype > 0) {
- /* Set render type */
- fprintf(prn_stream, "\033*t%dJ", pjxl->rendertype);
- /* Configure image data */
- fputs(cid_string, prn_stream);
- /* Set raster width, then start raster graphics */
- fprintf(prn_stream, "\033*r%ds1A", raster_width);
- } else {
- /* Set number of planes (1 is mono, 3 is rgb),
- * and raster width, then start raster graphics */
- fprintf(prn_stream, "\033*r%ds-%du0A", raster_width, num_comps);
- }
- /* No combined escapes for raster transfers */
- combined_escapes = 0;
- break;
- case PJXL180:
- /* Page size, orientation, top margin & perforation skip */
- fprintf(prn_stream, "\033&l%daolE", paper_size);
- /* Set print quality */
- fprintf(prn_stream, "\033*o%dQ", pjxl->printqual);
- /* Move to top left of printed area */
- fprintf(prn_stream, "\033*p%dY", (int)(180 * POFFSET));
- /* Configure colour setup */
- if (pjxl->rendertype > 0) {
- /* Set render type */
- fprintf(prn_stream, "\033*t%dJ", pjxl->rendertype);
- /* Configure image data */
- fputs(cid_string, prn_stream);
- /* Set raster width, then start raster graphics */
- fprintf(prn_stream, "\033*r%ds1A", raster_width);
- } else {
- /* Set number of planes (1 is mono, 3 is rgb),
- * and raster width, then start raster graphics */
- fprintf(prn_stream, "\033*r%ds%du0A", raster_width, num_comps);
- }
- break;
- case PJ180:
- case DECLJ250:
- /* Disable perforation skip */
- fprintf(prn_stream, "\033&lL");
- /* Move to top left of printed area */
- fprintf(prn_stream, "\033&a%dV", (int)(720 * POFFSET));
- /* Set number of planes (1 is mono, 3 is rgb),
- * and raster width, then start raster graphics */
- fprintf(prn_stream, "\033*r%ds%du0A", raster_width, num_comps);
- if (ptype == DECLJ250) {
- /* No combined escapes for raster transfers */
- combined_escapes = 0;
- /* From here on, we're a standard Paintjet .. */
- ptype = PJ180;
- }
- /* Select data compression */
- compression = 1;
- break;
- case ESC_P:
- /* Move to top left of printed area (must be modified for large movement(YK)) */
- if ((int)(EOFFSET * 360))
- fprintf(prn_stream, "\033|J%c%c", 0, (int)(360 * EOFFSET));
- combined_escapes = 0;
- break;
- case BJC600:
- case BJC800:
- /* Move to top left of printed area */
- bjc_v_skip((int)(pdev->HWResolution[1] * BOFFSET), pdev, prn_stream);
- combined_escapes = 0;
- compression = 2; /* BJC600 uses the same method as mode 2 compression */
- break;
- }
-
- /* Unfortunately, the Paintjet XL300 PCL interpreter introduces a
- * version of the PCL language which is different to all earlier HP
- * colour and mono inkjets, in that it loses the very useful ability
- * to use combined escape sequences with the raster transfer
- * commands. In this respect, it is incompatible even with the older
- * 180 dpi PaintJet and PaintJet XL printers! Another regrettable
- * omission is that 'mode 9' compression is not supported, as this
- * mode can give both computational and PCL file size advantages. */
-
- if (combined_escapes) {
- /* From now on, all escape commands start with \033*b, so we
- * combine them (if the printer supports this). */
- fputs("\033*b", prn_stream);
- /* Set compression if the mode has been defined. */
- if (compression)
- fprintf(prn_stream, "%dm", compression);
- } else if (ptype == BJC600 || ptype == BJC800); /* Currently, nothing to do. */
- else if (compression)
- fprintf(prn_stream, "\033*b%dM", compression);
-
- /* Send each scan line in turn */
- {
- int cErr, mErr, yErr, kErr;
- int this_pass, lnum, i;
- int start_rows;
- int lend, num_blank_lines = 0;
-
- word rmask = ~(word) 0 << ((-pdev->width * storage_bpp) & (W * 8 - 1));
-
- lend = pdev->height - (dev_t_margin(pdev) + dev_b_margin(pdev)) * y_dpi;
-
- switch (ptype) {
- case BJC600:
- case BJC800:
- start_rows = BJC_HEAD_ROWS;
- break;
-
- /* Inhibit blank line printing for RGB-only printers, since in
- * this case 'blank' means black! Also disabled for XL300 due to
- * an obscure bug in the printer's firmware */
-
- case PJ180:
- case PJXL180:
- case PJXL300:
- start_rows = -1;
- break;
-
- default:
- start_rows = (num_comps == 1) ? HEAD_ROWS_MONO - 1 :
- HEAD_ROWS_COLOUR - 1;
- break;
- }
-
- cErr = mErr = yErr = kErr = 0;
-
- if (bits_per_pixel > 4) { /* Randomly seed initial error buffer */
- if (cprn_device->cmyk > 0 && expanded_bpp == 32) {
- bjc_fscmyk(data, plane_data, errors, plane_size, -1);
- } else {
- int *ep = errors[0];
-
- for (i = 0; i < databuff_size; i++) {
- *ep++ = RANDOM;
- }
- }
- }
- this_pass = start_rows;
- for (lnum = 0; lnum < lend; lnum++) {
- word *data_words = (word *) data[scan];
- register word *end_data = data_words + line_size_words;
-
- gdev_prn_copy_scan_lines(pdev, lnum, data[scan], line_size);
-
- /* Mask off 1-bits beyond the line width. */
- end_data[-1] &= rmask;
-
- /* Remove trailing 0s. */
- while (end_data > data_words && end_data[-1] == 0)
- end_data--;
- if (ptype != DNJ650C) /* DesignJet can't skip blank lines ? ? */
- if (end_data == data_words) { /* Blank line */
- num_blank_lines++;
- continue;
- }
- /* Skip blank lines if any */
- if (num_blank_lines > 0) {
- if (ptype == ESC_P) {
- ep_print_image(prn_stream, 'B', 0, num_blank_lines);
- } else if (ptype == BJC600 || ptype == BJC800) {
- bjc_v_skip(num_blank_lines, pdev, prn_stream);
- } else if (num_blank_lines < this_pass) {
- /* Moving down from current position
- * causes head motion on the DeskJets, so
- * if the number of lines is within the
- * current pass of the print head, we're
- * better off printing blanks. */
- this_pass -= num_blank_lines;
- if (combined_escapes) {
- fputc('y', prn_stream); /* Clear current and seed rows */
- for (; num_blank_lines; num_blank_lines--)
- fputc('w', prn_stream);
- } else {
+ switch (ptype) {
+ case LJ4DITH:
+ /* Page size, orientation, top margin & perforation skip */
+ fprintf(prn_stream, "\033&l26A\033&l0o0e0L\033*r0F" );
+ fprintf(prn_stream, "\033*p0x0Y" ); /* These Offsets are hacked ! */
+ fprintf(prn_stream, "\033&u600D\033*r1A" );
+ /* Select data compression */
+ compression = 3;
+ combined_escapes = 0;
+ break;
+ case DJ500C:
+ case DJ550C:
+ /* Page size, orientation, top margin & perforation skip */
+ fprintf(prn_stream, "\033&l%daolE", paper_size);
+ /* Set depletion and shingling levels */
+ fprintf(prn_stream, "\033*o%dd%dQ", cdj->depletion, cdj->shingling);
+ /* Move to top left of printed area */
+ fprintf(prn_stream, "\033*p%dY", (int)(300 * DOFFSET));
+ /* Set number of planes ((-)1 is mono, (-)3 is (cmy)rgb, -4 is cmyk),
+ * and raster width, then start raster graphics */
+ fprintf(prn_stream, "\033*r%ds-%du0A", raster_width, num_comps);
+ /* Select data compression */
+ compression = 9;
+ break;
+ case DNJ650C:
+ fprintf (prn_stream, "\033%%0B"); /* Enter HPGL/2 mode */
+ fprintf (prn_stream, "BP5,1"); /* Turn off autorotation */
+ fprintf (prn_stream, "PS%d,%d",
+ (int)((pdev->height/pdev->y_pixels_per_inch)*1016),
+ (int)((pdev->width/pdev->x_pixels_per_inch)*1016)); /* Set length/width of page */
+ fprintf (prn_stream, "PU"); /* Pen up */
+ fprintf (prn_stream, "PA%d,%d", 0, 0); /* Move pen to upper-left */
+ fprintf (prn_stream, "\033%%1A"); /* Enter HP-RTL mode */
+ fprintf (prn_stream, "\033&a1N"); /* No negative motion - allow plotting
+ while receiving */
+ { static const char temp[] = {
+ 033, '*', 'v', '6', 'W',
+ 000 /* color model */,
+ 000 /* pixel encoding mode */,
+ 003 /* number of bits per index */,
+ 010 /* bits red */,
+ 010 /* bits green */,
+ 010 /* bits blue */
+ };
+ fwrite (temp, 1, sizeof(temp), prn_stream);
+ }
+
+ /* Set raster width */
+ fprintf(prn_stream, "\033*r%dS", raster_width);
+ /* Start raster graphics */
+ fprintf(prn_stream, "\033*r1A");
+
+ /* Select data compression */
+ compression = 1;
+ /* No combined escapes for raster transfers */
+ combined_escapes = 0;
+ break;
+ case PJXL300:
+ /* Page size, orientation, top margin & perforation skip */
+ fprintf(prn_stream, "\033&l%daolE", paper_size);
+ /* Set no-negative-motion mode, for faster (unbuffered) printing */
+ fprintf(prn_stream, "\033&a1N");
+ /* Set print quality */
+ fprintf(prn_stream, "\033*o%dQ", pjxl->printqual);
+ /* Move to top left of printed area */
+ fprintf(prn_stream, "\033*p%dY", (int)(300 * POFFSET));
+ /* Configure colour setup */
+ if (pjxl->rendertype > 0) {
+ /* Set render type */
+ fprintf(prn_stream, "\033*t%dJ", pjxl->rendertype);
+ /* Configure image data */
+ fputs(cid_string, prn_stream);
+ /* Set raster width, then start raster graphics */
+ fprintf(prn_stream, "\033*r%ds1A", raster_width);
+ } else {
+ /* Set number of planes (1 is mono, 3 is rgb),
+ * and raster width, then start raster graphics */
+ fprintf(prn_stream, "\033*r%ds-%du0A", raster_width, num_comps);
+ }
+ /* No combined escapes for raster transfers */
+ combined_escapes = 0;
+ break;
+ case PJXL180:
+ /* Page size, orientation, top margin & perforation skip */
+ fprintf(prn_stream, "\033&l%daolE", paper_size);
+ /* Set print quality */
+ fprintf(prn_stream, "\033*o%dQ", pjxl->printqual);
+ /* Move to top left of printed area */
+ fprintf(prn_stream, "\033*p%dY", (int)(180 * POFFSET));
+ /* Configure colour setup */
+ if (pjxl->rendertype > 0) {
+ /* Set render type */
+ fprintf(prn_stream, "\033*t%dJ", pjxl->rendertype);
+ /* Configure image data */
+ fputs(cid_string, prn_stream);
+ /* Set raster width, then start raster graphics */
+ fprintf(prn_stream, "\033*r%ds1A", raster_width);
+ } else {
+ /* Set number of planes (1 is mono, 3 is rgb),
+ * and raster width, then start raster graphics */
+ fprintf(prn_stream, "\033*r%ds%du0A", raster_width, num_comps);
+ }
+ break;
+ case PJ180:
+ case DECLJ250:
+ /* Disable perforation skip */
+ fprintf(prn_stream, "\033&lL");
+ /* Move to top left of printed area */
+ fprintf(prn_stream, "\033&a%dV", (int)(720 * POFFSET));
+ /* Set number of planes (1 is mono, 3 is rgb),
+ * and raster width, then start raster graphics */
+ fprintf(prn_stream, "\033*r%ds%du0A", raster_width, num_comps);
+ if (ptype == DECLJ250) {
+ /* No combined escapes for raster transfers */
+ combined_escapes = 0;
+ /* From here on, we're a standard Paintjet .. */
+ ptype = PJ180;
+ }
+ /* Select data compression */
+ compression = 1;
+ break;
+ case ESC_P:
+ /* Move to top left of printed area (must be modified for large movement(YK))*/
+ if ((int)(EOFFSET*360)) fprintf(prn_stream, "\033|J%c%c", 0, (int)(360*EOFFSET));
+ combined_escapes = 0;
+ break;
+ case BJC600:
+ case BJC800:
+ /* Move to top left of printed area */
+ bjc_v_skip((int)(pdev->HWResolution[1] * BOFFSET), pdev, prn_stream);
+ combined_escapes = 0;
+ compression = 2; /* BJC600 uses the same method as mode 2 compression */
+ break;
+ }
+
+ /* Unfortunately, the Paintjet XL300 PCL interpreter introduces a
+ * version of the PCL language which is different to all earlier HP
+ * colour and mono inkjets, in that it loses the very useful ability
+ * to use combined escape sequences with the raster transfer
+ * commands. In this respect, it is incompatible even with the older
+ * 180 dpi PaintJet and PaintJet XL printers! Another regrettable
+ * omission is that 'mode 9' compression is not supported, as this
+ * mode can give both computational and PCL file size advantages. */
+
+ if (combined_escapes) {
+ /* From now on, all escape commands start with \033*b, so we
+ * combine them (if the printer supports this). */
+ fputs("\033*b", prn_stream);
+ /* Set compression if the mode has been defined. */
+ if (compression)
+ fprintf(prn_stream, "%dm", compression);
+ }
+ else if (ptype == BJC600 || ptype == BJC800)
+ ; /* Currently, nothing to do. */
+ else
+ if (compression)
+ fprintf(prn_stream, "\033*b%dM", compression);
+
+ /* Send each scan line in turn */
+ {
+ int cErr, mErr, yErr, kErr;
+ int this_pass, lnum, i;
+ int start_rows;
+ int lend, num_blank_lines = 0;
+
+ word rmask = ~(word) 0 << ((-pdev->width * storage_bpp) & (W * 8 - 1));
+
+ lend = pdev->height - (dev_t_margin(pdev) + dev_b_margin(pdev)) * y_dpi;
+
+ switch (ptype) {
+ case BJC600:
+ case BJC800:
+ start_rows = BJC_HEAD_ROWS;
+ break;
+
+ /* Inhibit blank line printing for RGB-only printers, since in
+ * this case 'blank' means black! Also disabled for XL300 due to
+ * an obscure bug in the printer's firmware */
+
+ case PJ180:
+ case PJXL180:
+ case PJXL300:
+ start_rows = -1;
+ break;
+
+ default:
+ start_rows = (num_comps == 1) ? HEAD_ROWS_MONO - 1 :
+ HEAD_ROWS_COLOUR - 1;
+ break;
+ }
+
+ cErr = mErr = yErr = kErr = 0;
+
+ if (bits_per_pixel > 4) { /* Randomly seed initial error buffer */
+ if (cprn_device->cmyk > 0 && expanded_bpp == 32) {
+ bjc_fscmyk(data, plane_data, errors, plane_size, -1);
+ } else {
+ int *ep = errors[0];
+ for (i = 0; i < databuff_size; i++) {
+ *ep++ = RANDOM;
+ }
+ }
+ }
+
+ this_pass = start_rows;
+ for (lnum = 0; lnum < lend; lnum++) {
+ word *data_words = (word *)data[scan];
+ register word *end_data = data_words + line_size_words;
+
+ gdev_prn_copy_scan_lines(pdev, lnum, data[scan], line_size);
+
+ /* Mask off 1-bits beyond the line width. */
+ end_data[-1] &= rmask;
+
+ /* Remove trailing 0s. */
+ while (end_data > data_words && end_data[-1] == 0)
+ end_data--;
+ if (ptype != DNJ650C) /* DesignJet can't skip blank lines ? ? */
+ if (end_data == data_words) { /* Blank line */
+ num_blank_lines++;
+ continue;
+ }
+ /* Skip blank lines if any */
+ if (num_blank_lines > 0) {
+ if (ptype == ESC_P) {
+ ep_print_image(prn_stream, 'B', 0, num_blank_lines);
+ } else if (ptype == BJC600 || ptype == BJC800) {
+ bjc_v_skip(num_blank_lines, pdev, prn_stream);
+ } else if (num_blank_lines < this_pass) {
+ /* Moving down from current position
+ * causes head motion on the DeskJets, so
+ * if the number of lines is within the
+ * current pass of the print head, we're
+ * better off printing blanks. */
+ this_pass -= num_blank_lines;
+ if (combined_escapes) {
+ fputc('y', prn_stream); /* Clear current and seed rows */
+ for (; num_blank_lines; num_blank_lines--)
+ fputc('w', prn_stream);
+ } else {
#if 0
/**************** The following code has been proposed ****************/
/**************** as a replacement: ****************/
- fputs("\033*b1Y", prn_stream); /* Clear current and seed rows */
- if (num_blank_lines > 1)
- fprintf(prn_stream, "\033*b%dY", num_blank_lines - 1);
- num_blank_lines = 0;
+ fputs("\033*b1Y", prn_stream); /* Clear current and seed rows */
+ if ( num_blank_lines > 1 )
+ fprintf(prn_stream, "\033*b%dY", num_blank_lines - 1);
+ num_blank_lines = 0;
#else
- fputs("\033*bY", prn_stream); /* Clear current and seed rows */
- if (ptype == DNJ650C) {
- fprintf(prn_stream, "\033*b%dY", num_blank_lines);
- num_blank_lines = 0;
- } else {
- for (; num_blank_lines; num_blank_lines--)
- fputs("\033*bW", prn_stream);
- }
+ fputs("\033*bY", prn_stream); /* Clear current and seed rows */
+ if (ptype == DNJ650C) {
+ fprintf (prn_stream, "\033*b%dY", num_blank_lines);
+ num_blank_lines = 0;
+ }
+ else {
+ for (; num_blank_lines; num_blank_lines--)
+ fputs("\033*bW", prn_stream);
+ }
#endif
- }
- } else {
- if (combined_escapes)
- fprintf(prn_stream, "%dy", num_blank_lines);
- else
- fprintf(prn_stream, "\033*b%dY", num_blank_lines);
- }
- memset(plane_data[1 - scan][0], 0, plane_size * num_comps);
- num_blank_lines = 0;
- this_pass = start_rows;
- } { /* Printing non-blank lines */
- register byte *kP = plane_data[scan + 2][3];
- register byte *cP = plane_data[scan + 2][2];
- register byte *mP = plane_data[scan + 2][1];
- register byte *yP = plane_data[scan + 2][0];
- register byte *dp = data[scan + 2];
- register int *ep = errors[scan];
- int zero_row_count;
- int i, j;
- byte *odp;
-
- if (this_pass)
- this_pass--;
- else
- this_pass = start_rows;
-
- if (expanded_bpp > bits_per_pixel) { /* Expand line if required */
- cdj_expand_line(data_words, line_size,
- cprn_device->cmyk,
- bits_per_pixel, expanded_bpp);
- }
- /* In colour modes, we have some bit-shuffling to do before
- * we can print the data; in FS mode we also have the
- * dithering to take care of. */
- switch (expanded_bpp) { /* Can be 1, 3, 8, 24 or 32 */
- case 3:
- /* Transpose the data to get pixel planes. */
- for (i = 0, odp = plane_data[scan][0]; i < databuff_size;
- i += 8, odp++) { /* The following is for 16-bit
- * machines */
+ }
+ } else {
+ if (combined_escapes)
+ fprintf(prn_stream, "%dy", num_blank_lines);
+ else
+ fprintf(prn_stream, "\033*b%dY", num_blank_lines);
+ }
+ memset(plane_data[1 - scan][0], 0, plane_size * num_comps);
+ num_blank_lines = 0;
+ this_pass = start_rows;
+ }
+ { /* Printing non-blank lines */
+ register byte *kP = plane_data[scan + 2][3];
+ register byte *cP = plane_data[scan + 2][2];
+ register byte *mP = plane_data[scan + 2][1];
+ register byte *yP = plane_data[scan + 2][0];
+ register byte *dp = data[scan + 2];
+ register int *ep = errors[scan];
+ int zero_row_count;
+ int i, j;
+ byte *odp;
+
+ if (this_pass)
+ this_pass--;
+ else
+ this_pass = start_rows;
+
+ if (expanded_bpp > bits_per_pixel) { /* Expand line if required */
+ cdj_expand_line(data_words, line_size,
+ cprn_device->cmyk,
+ bits_per_pixel, expanded_bpp);
+ }
+
+ /* In colour modes, we have some bit-shuffling to do before
+ * we can print the data; in FS mode we also have the
+ * dithering to take care of. */
+ switch (expanded_bpp) { /* Can be 1, 3, 8, 24 or 32 */
+ case 3:
+ /* Transpose the data to get pixel planes. */
+ for (i = 0, odp = plane_data[scan][0]; i < databuff_size;
+ i += 8, odp++) { /* The following is for 16-bit
+ * machines */
#define spread3(c)\
{ 0, c, c*0x100, c*0x101, c*0x10000L, c*0x10001L, c*0x10100L, c*0x10101L }
- static ulong spr40[8] = spread3(0x40);
- static ulong spr08[8] = spread3(8);
- static ulong spr02[8] = spread3(2);
- register byte *dp = data[scan] + i;
- register ulong pword =
- (spr40[dp[0]] << 1) +
- (spr40[dp[1]]) +
- (spr40[dp[2]] >> 1) +
- (spr08[dp[3]] << 1) +
- (spr08[dp[4]]) +
- (spr08[dp[5]] >> 1) +
- (spr02[dp[6]]) +
- (spr02[dp[7]] >> 1);
-
- odp[0] = (byte) (pword >> 16);
- odp[plane_size] = (byte) (pword >> 8);
- odp[plane_size * 2] = (byte) (pword);
- }
- break;
-
- case 8:
- switch (ptype) {
- case BJC600:
- case BJC800:
- if (bjcparams.ditheringType == BJC_DITHER_NONE) {
- COPYline(scan, i, j, plane_size, cP, mP, yP, kP, 1);
- break;
- }
- default:
- FSDline(scan, i, j, plane_size, cErr, mErr, yErr, kErr,
- cP, mP, yP, kP, 1);
- }
- break;
- case 24:
- FSDline(scan, i, j, plane_size, cErr, mErr, yErr, kErr,
- cP, mP, yP, kP, 3);
- break;
- case 32:
- if (cprn_device->cmyk > 0) {
- bjc_fscmyk(data, plane_data, errors, plane_size, scan);
- } else {
- FSDline(scan, i, j, plane_size, cErr, mErr, yErr, kErr,
- cP, mP, yP, kP, 4);
- }
- break;
-
- } /* switch(expanded_bpp) */
-
- /* Make sure all black is in the k plane */
-
- if (num_comps == 4 && (cprn_device->cmyk <= 0 || expanded_bpp != 32)) {
- register word *kp = (word *) plane_data[scan][3];
- register word *cp = (word *) plane_data[scan][2];
- register word *mp = (word *) plane_data[scan][1];
- register word *yp = (word *) plane_data[scan][0];
-
- if (bits_per_pixel > 4) { /* Done as 4 planes */
- for (i = 0; i < plane_size / W; i++) {
- word bits = *cp & *mp & *yp;
-
- *kp++ |= bits;
- bits = ~bits;
- *cp++ &= bits;
- *mp++ &= bits;
- *yp++ &= bits;
- }
- } else { /* This has really been done as 3 planes */
- for (i = 0; i < plane_size / W; i++) {
- word bits = *cp & *mp & *yp;
-
- *kp++ = bits;
- bits = ~bits;
- *cp++ &= bits;
- *mp++ &= bits;
- *yp++ &= bits;
- }
- }
- }
- /* Transfer raster graphics in the order (K), C, M, Y */
-
- for (zero_row_count = 0, i = num_comps - 1; i >= 0; i--) {
- int output_plane = 1;
- int out_count = 0;
-
- switch (ptype) {
- case DJ500C: /* Always compress using mode 9 */
- case DJ550C:
- out_count = gdev_pcl_mode9compress(plane_size,
- plane_data[scan][i],
- plane_data[1 - scan][i],
- out_data);
-
- /* This optimisation allows early termination of the
- * row, but this doesn't work correctly in an alternating
- * mode 2 / mode 3 regime, so we only use it with mode 9
- * compression */
- if (out_count == 0) {
- output_plane = 0; /* No further output for this plane */
- if (i == 0)
- fputc('w', prn_stream);
- else
- zero_row_count++;
- } else {
- for (; zero_row_count; zero_row_count--)
- fputc('v', prn_stream);
- }
- break;
- case PJ180:
- case DNJ650C:
- if (num_comps > 1) {
- word *wp = (word *) plane_data[scan][i];
-
- for (j = 0; j < plane_size / W; j++, wp++)
- *wp = ~*wp;
- }
- out_count = gdev_pcl_mode1compress((const byte *)
- plane_data[scan][i],
- (const byte *)
- plane_data[scan][i] + plane_size - 1,
- out_data);
- break;
- case PJXL180: /* Need to invert data as CMY not supported */
- if (num_comps > 1) {
- word *wp = (word *) plane_data[scan][i];
-
- for (j = 0; j < plane_size / W; j++, wp++)
- *wp = ~*wp;
- }
- /* fall through .. */
- case PJXL300: /* Compression modes 2 and 3 are both
- * available. Try both and see which one
- * produces the least output data. */
- case LJ4DITH:
- {
- const byte *plane = plane_data[scan][i];
- byte *prev_plane = plane_data[1 - scan][i];
- const word *row = (word *) plane;
- const word *end_row = row + plane_size / W;
- int count2 = gdev_pcl_mode2compress(row, end_row, out_row_alt);
- int count3 = gdev_pcl_mode3compress(plane_size, plane, prev_plane, out_row);
- int penalty = combined_escapes ? strlen("#m") : strlen("\033*b#M");
- int penalty2 = (compression == 2 ? 0 : penalty);
- int penalty3 = (compression == 3 ? 0 : penalty);
-
- if (count3 + penalty3 < count2 + penalty2) {
- if (compression != 3) {
- if (combined_escapes)
- fputs("3m", prn_stream);
- else
- fputs("\033*b3M", prn_stream);
- compression = 3;
- }
- out_data = out_row;
- out_count = count3;
- } else {
- if (compression != 2) {
- if (combined_escapes)
- fputs("2m", prn_stream);
- else
- fputs("\033*b2M", prn_stream);
- compression = 2;
- }
- out_data = out_row_alt;
- out_count = count2;
- }
- }
- break;
- case BJC600:
- case BJC800:
- {
- const byte *plane = (byte *) plane_data[scan][i];
- int count2 = bjc_compress(plane, plane + plane_size, out_row_alt);
-
- out_data = out_row_alt;
- out_count = count2;
- }
- break;
- }
- if (output_plane) {
- if (combined_escapes)
- fprintf(prn_stream, "%d%c", out_count, "wvvv"[i]);
- else if (ptype == BJC600 || ptype == BJC800) {
- if (out_count)
- bjc_raster_cmd(num_comps == 1 ? 3 : i,
- out_count, out_data, pdev, prn_stream);
- if (i == 0)
- bjc_v_skip(1, pdev, prn_stream);
- } else if (ptype == ESC_P)
- ep_print_image(prn_stream, i, plane_data[scan][i], plane_size);
- else
- fprintf(prn_stream, "\033*b%d%c", out_count, "WVVV"[i]);
- if (ptype < ESC_P)
- fwrite(out_data, sizeof(byte), out_count, prn_stream);
- }
- } /* Transfer Raster Graphics ... */
- if (ptype == ESC_P)
- ep_print_image(prn_stream, 'I', 0, 0); /* increment line index */
- scan = 1 - scan; /* toggle scan direction */
- } /* Printing non-blank lines */
- } /* for lnum ... */
- } /* send each scan line in turn */
-
- if (combined_escapes)
- fputs("0M", prn_stream);
-
- /* end raster graphics */
- if (ptype == BJC600 || ptype == BJC800) {
- bjc_finish_page(pdev, prn_stream);
- } else if (ptype != ESC_P)
- fputs("\033*rbC\033E", prn_stream);
-
- /* eject page */
- if (ptype == PJ180)
- fputc('\f', prn_stream);
- else if (ptype == DNJ650C)
- fputs("\033*rC\033%0BPG;", prn_stream);
- else if (ptype == BJC600 || ptype == BJC800); /* Already done */
- else if (ptype == ESC_P) {
- ep_print_image(prn_stream, 'F', 0, 0); /* flush print buffer */
- fputs("\014\033@", prn_stream); /* reset after eject page */
- } else
- fputs("\033&l0H", prn_stream);
-
- /* free temporary storage */
- gs_free((char *)ep_storage, ep_storage_size_words, W, "ep_print_buffer");
- gs_free((char *)storage, storage_size_words, W, "hp_colour_print_page");
-
- return 0;
- }
+ static ulong spr40[8] = spread3(0x40);
+ static ulong spr08[8] = spread3(8);
+ static ulong spr02[8] = spread3(2);
+ register byte *dp = data[scan] + i;
+ register ulong pword =
+ (spr40[dp[0]] << 1) +
+ (spr40[dp[1]]) +
+ (spr40[dp[2]] >> 1) +
+ (spr08[dp[3]] << 1) +
+ (spr08[dp[4]]) +
+ (spr08[dp[5]] >> 1) +
+ (spr02[dp[6]]) +
+ (spr02[dp[7]] >> 1);
+ odp[0] = (byte) (pword >> 16);
+ odp[plane_size] = (byte) (pword >> 8);
+ odp[plane_size * 2] = (byte) (pword);
+ }
+ break;
+
+ case 8:
+ switch (ptype) {
+ case BJC600:
+ case BJC800:
+ if (bjcparams.ditheringType == BJC_DITHER_NONE) {
+ COPYline(scan, i, j, plane_size, cP, mP, yP, kP, 1);
+ break;
+ }
+
+ default:
+ FSDline(scan, i, j, plane_size, cErr, mErr, yErr, kErr,
+ cP, mP, yP, kP, 1);
+ }
+ break;
+ case 24:
+ FSDline(scan, i, j, plane_size, cErr, mErr, yErr, kErr,
+ cP, mP, yP, kP, 3);
+ break;
+ case 32:
+ if (cprn_device->cmyk > 0) {
+ bjc_fscmyk(data, plane_data, errors, plane_size, scan);
+ } else {
+ FSDline(scan, i, j, plane_size, cErr, mErr, yErr, kErr,
+ cP, mP, yP, kP, 4);
+ }
+ break;
+
+ } /* switch(expanded_bpp) */
+
+ /* Make sure all black is in the k plane */
+
+ if (num_comps == 4 && (cprn_device->cmyk <= 0 || expanded_bpp != 32)) {
+ register word *kp = (word *)plane_data[scan][3];
+ register word *cp = (word *)plane_data[scan][2];
+ register word *mp = (word *)plane_data[scan][1];
+ register word *yp = (word *)plane_data[scan][0];
+ if (bits_per_pixel > 4) { /* Done as 4 planes */
+ for (i = 0; i < plane_size / W; i++) {
+ word bits = *cp & *mp & *yp;
+ *kp++ |= bits;
+ bits = ~bits;
+ *cp++ &= bits;
+ *mp++ &= bits;
+ *yp++ &= bits;
+ }
+ } else { /* This has really been done as 3 planes */
+ for (i = 0; i < plane_size / W; i++) {
+ word bits = *cp & *mp & *yp;
+ *kp++ = bits;
+ bits = ~bits;
+ *cp++ &= bits;
+ *mp++ &= bits;
+ *yp++ &= bits;
+ }
+ }
+ }
+
+ /* Transfer raster graphics in the order (K), C, M, Y */
+
+ for (zero_row_count = 0, i = num_comps - 1; i >= 0; i--) {
+ int output_plane = 1;
+ int out_count = 0;
+
+ switch (ptype) {
+ case DJ500C: /* Always compress using mode 9 */
+ case DJ550C:
+ out_count = gdev_pcl_mode9compress(plane_size,
+ plane_data[scan][i],
+ plane_data[1 - scan][i],
+ out_data);
+
+ /* This optimisation allows early termination of the
+ * row, but this doesn't work correctly in an alternating
+ * mode 2 / mode 3 regime, so we only use it with mode 9
+ * compression */
+ if (out_count == 0)
+ { output_plane = 0; /* No further output for this plane */
+ if (i == 0)
+ fputc('w', prn_stream);
+ else
+ zero_row_count++;
+ }
+ else
+ { for (; zero_row_count; zero_row_count--)
+ fputc('v', prn_stream);
+ }
+ break;
+ case PJ180:
+ case DNJ650C:
+ if (num_comps > 1)
+ { word *wp = (word *)plane_data[scan][i];
+ for (j = 0; j < plane_size / W; j++, wp++)
+ *wp = ~*wp;
+ }
+ out_count = gdev_pcl_mode1compress((const byte *)
+ plane_data[scan][i],
+ (const byte *)
+ plane_data[scan][i] + plane_size - 1,
+ out_data);
+ break;
+ case PJXL180: /* Need to invert data as CMY not supported */
+ if (num_comps > 1)
+ { word *wp = (word *)plane_data[scan][i];
+ for (j = 0; j < plane_size / W; j++, wp++)
+ *wp = ~*wp;
+ }
+ /* fall through .. */
+ case PJXL300: /* Compression modes 2 and 3 are both
+ * available. Try both and see which one
+ * produces the least output data. */
+ case LJ4DITH:
+ { const byte *plane = plane_data[scan][i];
+ byte *prev_plane = plane_data[1 - scan][i];
+ const word *row = (word *)plane;
+ const word *end_row = row + plane_size/W;
+ int count2 = gdev_pcl_mode2compress(row, end_row, out_row_alt);
+ int count3 = gdev_pcl_mode3compress(plane_size, plane, prev_plane, out_row);
+ int penalty = combined_escapes ? strlen("#m") : strlen("\033*b#M");
+ int penalty2 = (compression == 2 ? 0 : penalty);
+ int penalty3 = (compression == 3 ? 0 : penalty);
+
+ if (count3 + penalty3 < count2 + penalty2)
+ { if ( compression != 3 ) {
+ if (combined_escapes)
+ fputs("3m", prn_stream);
+ else
+ fputs("\033*b3M", prn_stream);
+ compression = 3;
+ }
+ out_data = out_row;
+ out_count = count3;
+ }
+ else
+ { if ( compression != 2 ) {
+ if (combined_escapes)
+ fputs("2m", prn_stream);
+ else
+ fputs("\033*b2M", prn_stream);
+ compression = 2;
+ }
+ out_data = out_row_alt;
+ out_count = count2;
+ }
+ }
+ break;
+ case BJC600:
+ case BJC800:
+ { const byte *plane = (byte *)plane_data[scan][i];
+ int count2 = bjc_compress(plane, plane + plane_size, out_row_alt);
+
+ out_data = out_row_alt;
+ out_count = count2;
+ }
+ break;
+ }
+ if (output_plane) {
+ if (combined_escapes)
+ fprintf(prn_stream, "%d%c", out_count, "wvvv"[i]);
+ else if (ptype == BJC600 || ptype == BJC800) {
+ if (out_count)
+ bjc_raster_cmd(num_comps == 1 ? 3 : i,
+ out_count, out_data, pdev, prn_stream);
+ if (i == 0) bjc_v_skip(1, pdev, prn_stream);
+ } else if (ptype == ESC_P)
+ ep_print_image(prn_stream, i, plane_data[scan][i], plane_size);
+ else
+ fprintf(prn_stream, "\033*b%d%c", out_count, "WVVV"[i]);
+ if (ptype < ESC_P)
+ fwrite(out_data, sizeof(byte), out_count, prn_stream);
+ }
+
+ } /* Transfer Raster Graphics ... */
+ if (ptype == ESC_P)
+ ep_print_image(prn_stream, 'I', 0, 0); /* increment line index */
+ scan = 1 - scan; /* toggle scan direction */
+ } /* Printing non-blank lines */
+ } /* for lnum ... */
+ } /* send each scan line in turn */
+
+ if (combined_escapes)
+ fputs("0M", prn_stream);
+
+ /* end raster graphics */
+ if (ptype == BJC600 || ptype == BJC800) {
+ bjc_finish_page(pdev, prn_stream);
+ }
+ else if (ptype != ESC_P)
+ fputs("\033*rbC\033E", prn_stream);
+
+ /* eject page */
+ if (ptype == PJ180)
+ fputc('\f', prn_stream);
+ else if (ptype == DNJ650C)
+ fputs ("\033*rC\033%0BPG;", prn_stream);
+ else if (ptype == BJC600 || ptype == BJC800)
+ ; /* Already done */
+ else if (ptype == ESC_P) {
+ ep_print_image(prn_stream, 'F', 0, 0); /* flush print buffer */
+ fputs("\014\033@", prn_stream); /* reset after eject page */
+ } else
+ fputs("\033&l0H", prn_stream);
+
+ /* free temporary storage */
+ gs_free((char *) ep_storage, ep_storage_size_words, W, "ep_print_buffer");
+ gs_free((char *) storage, storage_size_words, W, "hp_colour_print_page");
+
+ return 0;
+}
/*
* Mode 9 2D compression for the HP DeskJet 5xxC. This mode can give
@@ -2572,126 +2614,124 @@ hp_colour_open(gx_device * pdev, int ptype)
* printing in particular because of the very large amounts of data which
* can be generated
*/
- private int
- gdev_pcl_mode9compress(int bytecount, const byte * current, const byte * previous, byte * compressed) {
- register const byte *cur = current;
- register const byte *prev = previous;
- register byte *out = compressed;
- const byte *end = current + bytecount;
-
- while (cur < end) { /* Detect a run of unchanged bytes. */
- const byte *run = cur;
- register const byte *diff;
- int offset;
- while (cur < end && *cur == *prev) {
- cur++, prev++;
- }
- if (cur == end)
- break; /* rest of row is unchanged */
-
- /* Detect a run of changed bytes. */
- /* We know that *cur != *prev. */
- diff = cur;
- do {
- prev++;
- cur++;
- }
- while (cur < end && *cur != *prev);
- /* Now [run..diff) are unchanged, and */
- /* [diff..cur) are changed. */
- offset = diff - run;
- {
- const byte *stop_test = cur - 4;
- int dissimilar, similar;
-
- while (diff < cur) {
- const byte *compr = diff;
- const byte *next; /* end of run */
- byte value = 0;
-
- while (diff <= stop_test &&
- ((value = *diff) != diff[1] ||
- value != diff[2] ||
- value != diff[3]))
- diff++;
-
- /* Find out how long the run is */
- if (diff > stop_test) /* no run */
- next = diff = cur;
- else {
- next = diff + 4;
- while (next < cur && *next == value)
- next++;
- }
+private int
+gdev_pcl_mode9compress(int bytecount, const byte * current, const byte * previous, byte * compressed)
+{
+ register const byte *cur = current;
+ register const byte *prev = previous;
+ register byte *out = compressed;
+ const byte *end = current + bytecount;
+
+ while (cur < end) { /* Detect a run of unchanged bytes. */
+ const byte *run = cur;
+ register const byte *diff;
+ int offset;
+ while (cur < end && *cur == *prev) {
+ cur++, prev++;
+ }
+ if (cur == end)
+ break; /* rest of row is unchanged */
+ /* Detect a run of changed bytes. */
+ /* We know that *cur != *prev. */
+ diff = cur;
+ do {
+ prev++;
+ cur++;
+ }
+ while (cur < end && *cur != *prev);
+ /* Now [run..diff) are unchanged, and */
+ /* [diff..cur) are changed. */
+ offset = diff - run;
+ {
+ const byte *stop_test = cur - 4;
+ int dissimilar, similar;
+
+ while (diff < cur) {
+ const byte *compr = diff;
+ const byte *next; /* end of run */
+ byte value = 0;
+ while (diff <= stop_test &&
+ ((value = *diff) != diff[1] ||
+ value != diff[2] ||
+ value != diff[3]))
+ diff++;
+
+ /* Find out how long the run is */
+ if (diff > stop_test) /* no run */
+ next = diff = cur;
+ else {
+ next = diff + 4;
+ while (next < cur && *next == value)
+ next++;
+ }
#define MAXOFFSETU 15
#define MAXCOUNTU 7
- /* output 'dissimilar' bytes, uncompressed */
- if ((dissimilar = diff - compr)) {
- int temp, i;
-
- if ((temp = --dissimilar) > MAXCOUNTU)
- temp = MAXCOUNTU;
- if (offset < MAXOFFSETU)
- *out++ = (offset << 3) | (byte) temp;
- else {
- *out++ = (MAXOFFSETU << 3) | (byte) temp;
- offset -= MAXOFFSETU;
- while (offset >= 255) {
- *out++ = 255;
- offset -= 255;
- }
- *out++ = offset;
- }
- if (temp == MAXCOUNTU) {
- temp = dissimilar - MAXCOUNTU;
- while (temp >= 255) {
- *out++ = 255;
- temp -= 255;
- }
- *out++ = (byte) temp;
- }
- for (i = 0; i <= dissimilar; i++)
- *out++ = *compr++;
- offset = 0;
- } /* end uncompressed */
- adefine MAXOFFSETC 3
+ /* output 'dissimilar' bytes, uncompressed */
+ if ((dissimilar = diff - compr)) {
+ int temp, i;
+
+ if ((temp = --dissimilar) > MAXCOUNTU)
+ temp = MAXCOUNTU;
+ if (offset < MAXOFFSETU)
+ *out++ = (offset << 3) | (byte) temp;
+ else {
+ *out++ = (MAXOFFSETU << 3) | (byte) temp;
+ offset -= MAXOFFSETU;
+ while (offset >= 255) {
+ *out++ = 255;
+ offset -= 255;
+ }
+ *out++ = offset;
+ }
+ if (temp == MAXCOUNTU) {
+ temp = dissimilar - MAXCOUNTU;
+ while (temp >= 255) {
+ *out++ = 255;
+ temp -= 255;
+ }
+ *out++ = (byte) temp;
+ }
+ for (i = 0; i <= dissimilar; i++)
+ *out++ = *compr++;
+ offset = 0;
+ } /* end uncompressed */
+#define MAXOFFSETC 3
#define MAXCOUNTC 31
- /* output 'similar' bytes, run-length encoded */
- if ((similar = next - diff))
- {
- int temp;
-
- if ((temp = (similar -= 2)) > MAXCOUNTC)
- temp = MAXCOUNTC;
- if (offset < MAXOFFSETC)
- * out++ = 0x80 | (offset << 5) | (byte) temp;
- else {
- *out++ = 0x80 | (MAXOFFSETC << 5) | (byte) temp;
- offset -= MAXOFFSETC;
- while (offset >= 255) {
- *out++ = 255;
- offset -= 255;
- }
- *out++ = offset;
- }
- if (temp == MAXCOUNTC) {
- temp = similar - MAXCOUNTC;
- while (temp >= 255) {
- *out++ = 255;
- temp -= 255;
- }
- *out++ = (byte) temp;
- }
- *out++ = value;
- offset = 0;
- } /* end compressed */
- diff = next;
- }
- }
- }
- return out - compressed;
- }
+ /* output 'similar' bytes, run-length encoded */
+ if ((similar = next - diff)) {
+ int temp;
+
+ if ((temp = (similar -= 2)) > MAXCOUNTC)
+ temp = MAXCOUNTC;
+ if (offset < MAXOFFSETC)
+ *out++ = 0x80 | (offset << 5) | (byte) temp;
+ else {
+ *out++ = 0x80 | (MAXOFFSETC << 5) | (byte) temp;
+ offset -= MAXOFFSETC;
+ while (offset >= 255) {
+ *out++ = 255;
+ offset -= 255;
+ }
+ *out++ = offset;
+ }
+ if (temp == MAXCOUNTC) {
+ temp = similar - MAXCOUNTC;
+ while (temp >= 255) {
+ *out++ = 255;
+ temp -= 255;
+ }
+ *out++ = (byte) temp;
+ }
+ *out++ = value;
+ offset = 0;
+ } /* end compressed */
+ diff = next;
+ }
+ }
+ }
+ return out - compressed;
+}
/*
* Row compression for the H-P PaintJet.
@@ -2704,27 +2744,25 @@ hp_colour_open(gx_device * pdev, int ptype)
* We complement the bytes at the same time, because
* we accumulated the image in complemented form.
*/
- private int
- gdev_pcl_mode1compress(const byte * row, const byte * end_row, byte * compressed) {
- register const byte * in = row;
- register byte * out = compressed;
- while (in < end_row) {
- byte test = *in++;
- const byte * run = in;
- while (in < end_row && *in == test)
- in++;
- /* Note that in - run + 1 is the repetition count. */
- while (in - run > 255) {
- *out++ = 255;
- *out++ = test;
- run += 256;
- }
- *out++ = in - run;
-
- *out++ = test;
- }
- return out - compressed;
- }
+private int
+gdev_pcl_mode1compress(const byte *row, const byte *end_row, byte *compressed)
+{ register const byte *in = row;
+ register byte *out = compressed;
+ while ( in < end_row )
+ { byte test = *in++;
+ const byte *run = in;
+ while ( in < end_row && *in == test ) in++;
+ /* Note that in - run + 1 is the repetition count. */
+ while ( in - run > 255 )
+ { *out++ = 255;
+ *out++ = test;
+ run += 256;
+ }
+ *out++ = in - run;
+ *out++ = test;
+ }
+ return out - compressed;
+}
/*
* Map a CMYK color to a color index. We just use depth / 4 bits per color
@@ -2752,134 +2790,136 @@ hp_colour_open(gx_device * pdev, int ptype)
(m) = gx_bits_to_color_value(((v) >> (b)) & ((1 << (b)) - 1), (b)), \
(y) = gx_bits_to_color_value((v) & ((1 << (b)) - 1), (b))
- private gx_color_index
- gdev_cmyk_map_cmyk_color(gx_device * pdev,
- gx_color_value cyan, gx_color_value magenta, gx_color_value yellow,
- gx_color_value black) {
+private gx_color_index
+gdev_cmyk_map_cmyk_color(gx_device* pdev,
+ gx_color_value cyan, gx_color_value magenta, gx_color_value yellow,
+ gx_color_value black) {
- gx_color_index color;
+ gx_color_index color;
- switch (pdev->color_info.depth) {
+ switch (pdev->color_info.depth) {
case 1:
- color = (cyan | magenta | yellow | black) > gx_max_color_value / 2 ?
- (gx_color_index) 1 : (gx_color_index) 0;
- break;
+ color = (cyan | magenta | yellow | black) > gx_max_color_value / 2 ?
+ (gx_color_index) 1 : (gx_color_index) 0;
+ break;
- default: {
- int nbits = pdev->color_info.depth;
+ default: {
+ int nbits = pdev->color_info.depth;
- if (cyan == magenta && magenta == yellow) {
+ if (cyan == magenta && magenta == yellow) {
- /* Convert CMYK to gray -- Red Book 6.2.2 */
+ /* Convert CMYK to gray -- Red Book 6.2.2 */
- float bpart = ((float)cyan) * (lum_red_weight / 100.) +
- ((float)magenta) * (lum_green_weight / 100.) +
- ((float)yellow) * (lum_blue_weight / 100.) +
- (float)black;
+ float bpart = ((float) cyan) * (lum_red_weight / 100.) +
+ ((float) magenta) * (lum_green_weight / 100.) +
+ ((float) yellow) * (lum_blue_weight / 100.) +
+ (float) black;
- cyan = magenta = yellow = (gx_color_index) 0;
- black = (gx_color_index) (bpart > gx_max_color_value ?
- gx_max_color_value : bpart);
- }
- color = gx_cmyk_value_bits(cyan, magenta, yellow, black,
- nbits >> 2);
- }
- }
+ cyan = magenta = yellow = (gx_color_index) 0;
+ black = (gx_color_index) (bpart > gx_max_color_value ?
+ gx_max_color_value : bpart);
+ }
- return color;
- }
+ color = gx_cmyk_value_bits(cyan, magenta, yellow, black,
+ nbits >> 2);
+ }
+ }
-/* Mapping of RGB colors to gray values. */
+ return color;
+}
- private gx_color_index
- gdev_cmyk_map_rgb_color(gx_device * pdev, gx_color_value r, gx_color_value g, gx_color_value b) {
+/* Mapping of RGB colors to gray values. */
- if (gx_color_value_to_byte(r & g & b) == 0xff) {
- return (gx_color_index) 0; /* White */
- }
- else {
- gx_color_value c = gx_max_color_value - r;
- gx_color_value m = gx_max_color_value - g;
- gx_color_value y = gx_max_color_value - b;
+private gx_color_index
+gdev_cmyk_map_rgb_color(gx_device *pdev, gx_color_value r, gx_color_value g, gx_color_value b)
+{
- switch (pdev->color_info.depth) {
- case 1:
- return (c | m | y) > gx_max_color_value / 2 ?
- (gx_color_index) 1 : (gx_color_index) 0;
- /*NOTREACHED */
- break;
+ if (gx_color_value_to_byte(r & g & b) == 0xff) {
+ return (gx_color_index) 0; /* White */
+ } else {
+ gx_color_value c = gx_max_color_value - r;
+ gx_color_value m = gx_max_color_value - g;
+ gx_color_value y = gx_max_color_value - b;
+
+ switch (pdev->color_info.depth) {
+ case 1:
+ return (c | m | y) > gx_max_color_value / 2 ?
+ (gx_color_index) 1 : (gx_color_index) 0;
+ /*NOTREACHED*/
+ break;
+
+ case 8:
+ return ((ulong) c * lum_red_weight * 10
+ + (ulong) m * lum_green_weight * 10
+ + (ulong) y * lum_blue_weight * 10)
+ >> (gx_color_value_bits + 2);
+ /*NOTREACHED*/
+ break;
+ }
+ }
- case 8:
- return ((ulong) c * lum_red_weight * 10
- + (ulong) m * lum_green_weight * 10
- + (ulong) y * lum_blue_weight * 10)
- >> (gx_color_value_bits + 2);
- /*NOTREACHED */
- break;
- }
- }
-
- return (gx_color_index) 0; /* This should never happen. */
- }
+ return (gx_color_index) 0; /* This should never happen. */
+}
/* Mapping of CMYK colors. */
- private int
- gdev_cmyk_map_color_rgb(gx_device * pdev, gx_color_index color, gx_color_value prgb[3]) {
- switch (pdev->color_info.depth) {
+private int
+gdev_cmyk_map_color_rgb(gx_device *pdev, gx_color_index color, gx_color_value prgb[3])
+{
+ switch (pdev->color_info.depth) {
case 1:
- prgb[0] = prgb[1] = prgb[2] = gx_max_color_value * (1 - color);
- break;
+ prgb[0] = prgb[1] = prgb[2] = gx_max_color_value * (1 - color);
+ break;
case 8:
- if (pdev->color_info.num_components == 1) {
- gx_color_value value = (gx_color_value) color ^ 0xff;
+ if (pdev->color_info.num_components == 1) {
+ gx_color_value value = (gx_color_value) color ^ 0xff;
- prgb[0] = prgb[1] = prgb[2] = (value << 8) + value;
+ prgb[0] = prgb[1] = prgb[2] = (value << 8) + value;
- break;
- }
- default: {
- unsigned long bcyan, bmagenta, byellow,
- black;
- int nbits = pdev->color_info.depth;
+ break;
+ }
- gx_value_cmyk_bits(color, bcyan, bmagenta, byellow, black,
- nbits >> 2);
+ default: {
+ unsigned long bcyan, bmagenta, byellow, black;
+ int nbits = pdev->color_info.depth;
+
+ gx_value_cmyk_bits(color, bcyan, bmagenta, byellow, black,
+ nbits >> 2);
#ifdef USE_ADOBE_CMYK_RGB
- /* R = 1.0 - min(1.0, C + K), etc. */
+ /* R = 1.0 - min(1.0, C + K), etc. */
- bcyan += black, bmagenta += black, byellow += black;
- prgb[0] = (bcyan > gx_max_color_value ? (gx_color_value) 0 :
- gx_max_color_value - bcyan);
- prgb[1] = (bmagenta > gx_max_color_value ? (gx_color_value) 0 :
- gx_max_color_value - bmagenta);
- prgb[2] = (byellow > gx_max_color_value ? (gx_color_value) 0 :
- gx_max_color_value - byellow);
+ bcyan += black, bmagenta += black, byellow += black;
+ prgb[0] = (bcyan > gx_max_color_value ? (gx_color_value) 0 :
+ gx_max_color_value - bcyan);
+ prgb[1] = (bmagenta > gx_max_color_value ? (gx_color_value) 0 :
+ gx_max_color_value - bmagenta);
+ prgb[2] = (byellow > gx_max_color_value ? (gx_color_value) 0 :
+ gx_max_color_value - byellow);
#else
- /* R = (1.0 - C) * (1.0 - K), etc. */
+ /* R = (1.0 - C) * (1.0 - K), etc. */
- prgb[0] = (gx_color_value)
- ((ulong) (gx_max_color_value - bcyan) *
- (gx_max_color_value - black) / gx_max_color_value);
- prgb[1] = (gx_color_value)
- ((ulong) (gx_max_color_value - bmagenta) *
- (gx_max_color_value - black) / gx_max_color_value);
- prgb[2] = (gx_color_value)
- ((ulong) (gx_max_color_value - byellow) *
- (gx_max_color_value - black) / gx_max_color_value);
+ prgb[0] = (gx_color_value)
+ ((ulong)(gx_max_color_value - bcyan) *
+ (gx_max_color_value - black) / gx_max_color_value);
+ prgb[1] = (gx_color_value)
+ ((ulong)(gx_max_color_value - bmagenta) *
+ (gx_max_color_value - black) / gx_max_color_value);
+ prgb[2] = (gx_color_value)
+ ((ulong)(gx_max_color_value - byellow) *
+ (gx_max_color_value - black) / gx_max_color_value);
#endif
- }
- }
+ }
+ }
- return 0;
- }
+ return 0;
+}
/*
* Map a r-g-b color to a color index.
@@ -2901,142 +2941,137 @@ hp_colour_open(gx_device * pdev, int ptype)
y = yv - kv; m = mv - kv; c = cv -kv; k = kv; \
} while (0)
- private gx_color_index
- gdev_pcl_map_rgb_color(gx_device * pdev, gx_color_value r,
- gx_color_value g, gx_color_value b) {
- if (gx_color_value_to_byte(r & g & b) == 0xff)
- return (gx_color_index) 0; /* white */
- else {
- int correction = cprn_device->correction;
- gx_color_value c = gx_max_color_value - r;
- gx_color_value m = gx_max_color_value - g;
- gx_color_value y = gx_max_color_value - b;
-
- /* Colour correction for better blacks when using the colour ink
- * cartridge (on the DeskJet 500C only). We reduce the cyan component
- * by some fraction (eg. 4/5) to correct the slightly greenish cast
- * resulting from an equal mix of the three inks */
- if (correction) {
- ulong maxval, minval, range;
-
- maxval = c >= m ? (c >= y ? c : y) : (m >= y ? m : y);
- if (maxval > 0) {
- minval = c <= m ? (c <= y ? c : y) : (m <= y ? m : y);
- range = maxval - minval;
-
+private gx_color_index
+gdev_pcl_map_rgb_color(gx_device *pdev, gx_color_value r,
+ gx_color_value g, gx_color_value b)
+{
+ if (gx_color_value_to_byte(r & g & b) == 0xff)
+ return (gx_color_index)0; /* white */
+ else {
+ int correction = cprn_device->correction;
+ gx_color_value c = gx_max_color_value - r;
+ gx_color_value m = gx_max_color_value - g;
+ gx_color_value y = gx_max_color_value - b;
+
+ /* Colour correction for better blacks when using the colour ink
+ * cartridge (on the DeskJet 500C only). We reduce the cyan component
+ * by some fraction (eg. 4/5) to correct the slightly greenish cast
+ * resulting from an equal mix of the three inks */
+ if (correction) {
+ ulong maxval, minval, range;
+
+ maxval = c >= m ? (c >= y ? c : y) : (m >= y ? m : y);
+ if (maxval > 0) {
+ minval = c <= m ? (c <= y ? c : y) : (m <= y? m : y);
+ range = maxval - minval;
+
#define shift (gx_color_value_bits - 12)
- c = ((c >> shift) * (range + (maxval * correction))) /
- ((maxval * (correction + 1)) >> shift);
- }
- }
- switch (pdev->color_info.depth) {
- case 1:
- return ((c | m | y) > gx_max_color_value / 2 ?
- (gx_color_index) 1 : (gx_color_index) 0);
- case 8:
- if (pdev->color_info.num_components >= 3)
+ c = ((c >> shift) * (range + (maxval * correction))) /
+ ((maxval * (correction + 1)) >> shift);
+ }
+ }
+
+ switch (pdev->color_info.depth) {
+ case 1:
+ return ((c | m | y) > gx_max_color_value / 2 ?
+ (gx_color_index)1 : (gx_color_index)0);
+ case 8:
+ if (pdev->color_info.num_components >= 3)
#define gx_color_value_to_1bit(cv) ((cv) >> (gx_color_value_bits - 1))
- return (gx_color_value_to_1bit(c) +
- (gx_color_value_to_1bit(m) << 1) +
- (gx_color_value_to_1bit(y) << 2));
- else
+ return (gx_color_value_to_1bit(c) +
+ (gx_color_value_to_1bit(m) << 1) +
+ (gx_color_value_to_1bit(y) << 2));
+ else
#define red_weight 306
#define green_weight 601
#define blue_weight 117
- return ((((ulong) c * red_weight +
- (ulong) m * green_weight +
- (ulong) y * blue_weight)
- >> (gx_color_value_bits + 2)));
- case 16:
+ return ((((ulong)c * red_weight +
+ (ulong)m * green_weight +
+ (ulong)y * blue_weight)
+ >> (gx_color_value_bits + 2)));
+ case 16:
#define gx_color_value_to_5bits(cv) ((cv) >> (gx_color_value_bits - 5))
#define gx_color_value_to_6bits(cv) ((cv) >> (gx_color_value_bits - 6))
- return (gx_color_value_to_5bits(y) +
- (gx_color_value_to_6bits(m) << 5) +
- (gx_color_value_to_5bits(c) << 11));
- case 24:
- return (gx_color_value_to_byte(y) +
- (gx_color_value_to_byte(m) << 8) +
- ((ulong) gx_color_value_to_byte(c) << 16));
- case 32:
- {
- return ((c == m && c == y) ? ((ulong) gx_color_value_to_byte(c) << 24)
- : (gx_color_value_to_byte(y) +
- (gx_color_value_to_byte(m) << 8) +
- ((ulong) gx_color_value_to_byte(c) << 16)));
- }
- }
- }
- return (gx_color_index) 0; /* This never happens */
- }
-
+ return (gx_color_value_to_5bits(y) +
+ (gx_color_value_to_6bits(m) << 5) +
+ (gx_color_value_to_5bits(c) << 11));
+ case 24:
+ return (gx_color_value_to_byte(y) +
+ (gx_color_value_to_byte(m) << 8) +
+ ((ulong)gx_color_value_to_byte(c) << 16));
+ case 32:
+ { return ((c == m && c == y) ? ((ulong)gx_color_value_to_byte(c) << 24)
+ : (gx_color_value_to_byte(y) +
+ (gx_color_value_to_byte(m) << 8) +
+ ((ulong)gx_color_value_to_byte(c) << 16)));
+ }
+ }
+ }
+ return (gx_color_index)0; /* This never happens */
+}
+
/* Map a color index to a r-g-b color. */
- private int
- gdev_pcl_map_color_rgb(gx_device * pdev, gx_color_index color,
- gx_color_value prgb[3]) {
- /* For the moment, we simply ignore any black correction */
- switch (pdev->color_info.depth) {
- case 1:
- prgb[0] = prgb[1] = prgb[2] = -((gx_color_value) color ^ 1);
- break;
- case 8:
- if (pdev->color_info.num_components >= 3) {
- gx_color_value c = (gx_color_value) color ^ 7;
- prgb[0] = -(c & 1);
- prgb[1] = -((c >> 1) & 1);
- prgb[2] = -(c >> 2);
- }
- else {
- gx_color_value value = (gx_color_value) color ^ 0xff;
-
- prgb[0] = prgb[1] = prgb[2] = (value << 8) + value;
- }
- break;
- case 16:
- {
- gx_color_value c = (gx_color_value) color ^ 0xffff;
- ushort value = c >> 11;
-
- prgb[0] = ((value << 11) + (value << 6) + (value << 1) +
- (value >> 4)) >> (16 - gx_color_value_bits);
- value = (c >> 6) & 0x3f;
- prgb[1] = ((value << 10) + (value << 4) + (value >> 2))
- >> (16 - gx_color_value_bits);
- value = c & 0x1f;
- prgb[2] = ((value << 11) + (value << 6) + (value << 1) +
- (value >> 4)) >> (16 - gx_color_value_bits);
- }
- break;
- case 24:
- {
- gx_color_value c = (gx_color_value) color ^ 0xffffff;
-
- prgb[0] = gx_color_value_from_byte(c >> 16);
- prgb[1] = gx_color_value_from_byte((c >> 8) & 0xff);
- prgb[2] = gx_color_value_from_byte(c & 0xff);
- }
- break;
- case 32:
+private int
+gdev_pcl_map_color_rgb(gx_device *pdev, gx_color_index color,
+ gx_color_value prgb[3])
+{
+ /* For the moment, we simply ignore any black correction */
+ switch (pdev->color_info.depth) {
+ case 1:
+ prgb[0] = prgb[1] = prgb[2] = -((gx_color_value)color ^ 1);
+ break;
+ case 8:
+ if (pdev->color_info.num_components >= 3)
+ { gx_color_value c = (gx_color_value)color ^ 7;
+ prgb[0] = -(c & 1);
+ prgb[1] = -((c >> 1) & 1);
+ prgb[2] = -(c >> 2);
+ }
+ else
+ { gx_color_value value = (gx_color_value)color ^ 0xff;
+ prgb[0] = prgb[1] = prgb[2] = (value << 8) + value;
+ }
+ break;
+ case 16:
+ { gx_color_value c = (gx_color_value)color ^ 0xffff;
+ ushort value = c >> 11;
+ prgb[0] = ((value << 11) + (value << 6) + (value << 1) +
+ (value >> 4)) >> (16 - gx_color_value_bits);
+ value = (c >> 6) & 0x3f;
+ prgb[1] = ((value << 10) + (value << 4) + (value >> 2))
+ >> (16 - gx_color_value_bits);
+ value = c & 0x1f;
+ prgb[2] = ((value << 11) + (value << 6) + (value << 1) +
+ (value >> 4)) >> (16 - gx_color_value_bits);
+ }
+ break;
+ case 24:
+ { gx_color_value c = (gx_color_value)color ^ 0xffffff;
+ prgb[0] = gx_color_value_from_byte(c >> 16);
+ prgb[1] = gx_color_value_from_byte((c >> 8) & 0xff);
+ prgb[2] = gx_color_value_from_byte(c & 0xff);
+ }
+ break;
+ case 32:
#define gx_maxcol gx_color_value_from_byte(gx_color_value_to_byte(gx_max_color_value))
- {
- gx_color_value w = gx_maxcol - gx_color_value_from_byte(color >> 24);
-
- prgb[0] = w - gx_color_value_from_byte((color >> 16) & 0xff);
- prgb[1] = w - gx_color_value_from_byte((color >> 8) & 0xff);
- prgb[2] = w - gx_color_value_from_byte(color & 0xff);
- }
- break;
- }
- return 0;
- }
+ { gx_color_value w = gx_maxcol - gx_color_value_from_byte(color >> 24);
+ prgb[0] = w - gx_color_value_from_byte((color >> 16) & 0xff);
+ prgb[1] = w - gx_color_value_from_byte((color >> 8) & 0xff);
+ prgb[2] = w - gx_color_value_from_byte(color & 0xff);
+ }
+ break;
+ }
+ return 0;
+}
/*
* Convert and expand scanlines:
*
* For devices with 3 components:
*
- * (a) 16 -> 24 bit (1-stage)
- * (b) 16 -> 32 bit (2-stage)
- * or (c) 24 -> 32 bit (1-stage)
+ * (a) 16 -> 24 bit (1-stage)
+ * (b) 16 -> 32 bit (2-stage)
+ * or (c) 24 -> 32 bit (1-stage)
*
* For devices with 4 components:
*
@@ -3046,522 +3081,530 @@ hp_colour_open(gx_device * pdev, int ptype)
*
*/
- private void
- cdj_expand_line(word * line, int linesize, short cmyk, int bpp, int ebpp) {
- int endline = linesize;
- byte * start = (byte *) line;
- register byte * in, *out;
-
- if (cmyk > 0) {
- if (bpp == 8) {
- in = start + endline;
- out = start + (endline *= 2);
-
- while (in > start) {
- register byte b0;
- register byte bs0, bs1, bs2, bs3;
-
- b0 = *--in;
-
- bs0 = b0 & 0x03;
- bs1 = (b0 >> 2) & 0x03;
- bs2 = (b0 >> 4) & 0x03;
- bs3 = (b0 >> 6) & 0x03;
-
- *--out = (bs0 << 2) + bs0 + (bs1 << 6) + (bs1 << 4);
- *--out = (bs2 << 2) + bs2 + (bs3 << 6) + (bs3 << 4);
- }
- }
- if (bpp == 24) {
- endline = (endline + 2) / 3;
-
- in = start + endline * 3;
- out = start + endline * 4;
-
- while (in > start) {
- register byte b0, b1, b2;
-
- b0 = *--in;
- b1 = *--in;
- b2 = *--in;
-
- *--out = (b0 << 2) + ((b0 >> 4) & 0x03);
- *--out = ((b1 & 0x0f) << 4) + ((b0 >> 6) << 2)
- + ((b1 >> 2) & 0x03);
- *--out = ((b2 & 0x03) << 6) + ((b1 >> 4) << 2) + (b2 & 0x03);
- *--out = (b2 & 0xfc) + ((b2 >> 6) & 0x03);
- }
- } else
- if (ebpp == 32) {
- endline = (endline + 1) / 2;
-
- in = start + endline * 2;
- out = start + (endline *= 4);
-
- while (in > start) {
- register byte b0, b1;
-
- b0 = *--in;
- b1 = *--in;
-
- *--out = (b0 << 4) + ((b0 >> 4) & 0x07);
- *--out = (b0 & 0xf0) + ((b0 >> 4) & 0xf);
- *--out = (b1 << 4) + ((b1 >> 4) & 0x0f);
- *--out = (b1 & 0xf0) + ((b1 >> 4) & 0xf);
- }
- }
- } else { /* cmyk > 0 */
- if (bpp == 16) { /* 16 to 24 (cmy) if required */
- register byte b0, b1;
-
- endline = ((endline + 1) / 2);
- in = start + endline * 2;
- out = start + (endline *= 3);
-
- while (in > start) {
- b0 = *--in;
- b1 = *--in;
- *--out = (b0 << 3) + ((b0 >> 2) & 0x7);
- *--out = (b1 << 5) + ((b0 >> 3) & 0x1c) + ((b1 >> 1) & 0x3);
- *--out = (b1 & 0xf8) + (b1 >> 5);
- }
- }
- if (ebpp == 32) { /* 24/32 (cmy) to 32 (cmyk) if required */
- register byte c, m, y;
-
- endline = ((endline + 2) / 3);
- in = start + endline * 3;
- out = start + endline * 4;
-
- while (in > start) {
- y = *--in;
- m = *--in;
- c = *--in;
-
- if (c == y && c == m) {
- *--out = 0, *--out = 0, *--out = 0;
- *--out = c;
- }
- else {
- *--out = y, *--out = m, *--out = c;
- *--out = 0;
- }
- }
- }
- }
- }
-
- private int near
- cdj_put_param_int(gs_param_list * plist, gs_param_name pname, int *pvalue,
- int minval, int maxval, int ecode) {
- int code, value;
- switch (code = param_read_int(plist, pname, &value)) {
+private void
+cdj_expand_line(word *line, int linesize, short cmyk, int bpp, int ebpp)
+{
+ int endline = linesize;
+ byte *start = (byte *)line;
+ register byte *in, *out;
+
+ if (cmyk > 0) {
+ if (bpp == 8) {
+ in = start + endline;
+ out = start + (endline *= 2);
+
+ while (in > start) {
+ register byte b0;
+ register byte bs0, bs1, bs2, bs3;
+
+ b0 = *--in;
+
+ bs0 = b0 & 0x03;
+ bs1 = (b0 >> 2) & 0x03;
+ bs2 = (b0 >> 4) & 0x03;
+ bs3 = (b0 >> 6) & 0x03;
+
+ *--out = (bs0 << 2) + bs0 + (bs1 << 6) + (bs1 << 4);
+ *--out = (bs2 << 2) + bs2 + (bs3 << 6) + (bs3 << 4);
+ }
+ }
+
+ if (bpp == 24) {
+ endline = (endline + 2) / 3;
+
+ in = start + endline * 3;
+ out = start + endline * 4;
+
+ while (in > start) {
+ register byte b0, b1, b2;
+
+ b0 = *--in;
+ b1 = *--in;
+ b2 = *--in;
+
+ *--out = (b0 << 2) + ((b0 >> 4) & 0x03);
+ *--out = ((b1 & 0x0f) << 4) + ((b0 >> 6) << 2)
+ + ((b1 >> 2) & 0x03);
+ *--out = ((b2 & 0x03) << 6) + ((b1 >> 4) << 2) + (b2 & 0x03);
+ *--out = (b2 & 0xfc) + ((b2 >> 6) & 0x03);
+ }
+ } else if (ebpp == 32) {
+ endline = (endline + 1) / 2;
+
+ in = start + endline * 2;
+ out = start + (endline *= 4);
+
+ while (in > start) {
+ register byte b0, b1;
+
+ b0 = *--in;
+ b1 = *--in;
+
+ *--out = (b0 << 4) + ((b0 >> 4) & 0x07);
+ *--out = (b0 & 0xf0) + ((b0 >> 4) & 0xf);
+ *--out = (b1 << 4) + ((b1 >> 4) & 0x0f);
+ *--out = (b1 & 0xf0) + ((b1 >> 4) & 0xf);
+ }
+ }
+ } else /* cmyk > 0 */ {
+ if (bpp == 16) /* 16 to 24 (cmy) if required */
+ { register byte b0, b1;
+ endline = ((endline + 1) / 2);
+ in = start + endline * 2;
+ out = start + (endline *= 3);
+
+ while (in > start)
+ { b0 = *--in;
+ b1 = *--in;
+ *--out = (b0 << 3) + ((b0 >> 2) & 0x7);
+ *--out = (b1 << 5) + ((b0 >> 3) & 0x1c) + ((b1 >> 1) & 0x3);
+ *--out = (b1 & 0xf8) + (b1 >> 5);
+ }
+ }
+
+ if (ebpp == 32) /* 24/32 (cmy) to 32 (cmyk) if required */
+ { register byte c, m, y;
+ endline = ((endline + 2) / 3);
+ in = start + endline * 3;
+ out = start + endline * 4;
+
+ while (in > start)
+ {
+ y = *--in;
+ m = *--in;
+ c = *--in;
+
+ if (c == y && c == m) {
+ *--out = 0, *--out = 0, *--out = 0;
+ *--out = c;
+ } else {
+ *--out = y, *--out = m, *--out = c;
+ *--out = 0;
+ }
+ }
+ }
+ }
+}
+
+private int near
+cdj_put_param_int(gs_param_list *plist, gs_param_name pname, int *pvalue,
+ int minval, int maxval, int ecode)
+{ int code, value;
+ switch ( code = param_read_int(plist, pname, &value) )
+ {
default:
- return code;
+ return code;
case 1:
- return ecode;
+ return ecode;
case 0:
- if (value < minval || value > maxval)
- param_signal_error(plist, pname, gs_error_rangecheck);
- *pvalue = value;
- return (ecode < 0 ? ecode : 1);
- }
- }
- private int
- cdj_set_bpp(gx_device * pdev, int bpp, int ccomps) {
- gx_device_color_info * ci = &pdev->color_info;
-
- if (ccomps && bpp == 0) {
- if (cprn_device->cmyk) {
- switch (ccomps) {
- default:
- return gs_error_rangecheck;
- /*NOTREACHED */
- break;
+ if ( value < minval || value > maxval )
+ param_signal_error(plist, pname, gs_error_rangecheck);
+ *pvalue = value;
+ return (ecode < 0 ? ecode : 1);
+ }
+}
- case 1:
- bpp = 1;
- break;
+private int
+cdj_set_bpp(gx_device *pdev, int bpp, int ccomps)
+{ gx_device_color_info *ci = &pdev->color_info;
+
+ if (ccomps && bpp == 0) {
+ if (cprn_device->cmyk) {
+ switch (ccomps) {
+ default:
+ return gs_error_rangecheck;
+ /*NOTREACHED*/
+ break;
+
+ case 1:
+ bpp = 1;
+ break;
+
+ case 3:
+ bpp = 24;
+ break;
+
+ case 4:
+ switch (ci->depth) {
+ case 8:
+ case 16:
+ case 24:
+ case 32:
+ break;
+
+ default:
+ bpp = cprn_device->default_depth;
+ break;
+ }
+ break;
+ }
+ }
+ }
- case 3:
- bpp = 24;
- break;
+ if (bpp == 0) {
+ bpp = ci->depth; /* Use the current setting. */
+ }
- case 4:
- switch (ci->depth) {
- case 8:
- case 16:
- case 24:
- case 32:
- break;
+ if (cprn_device->cmyk < 0) {
- default:
- bpp = cprn_device->default_depth;
- break;
- }
- break;
- }
- }
- }
- if (bpp == 0) {
- bpp = ci->depth; /* Use the current setting. */
- }
- if (cprn_device->cmyk < 0) {
-
- /* Reset procedures because we may have been in another mode. */
-
- dev_proc(pdev, map_cmyk_color) = gdev_cmyk_map_cmyk_color;
- dev_proc(pdev, map_rgb_color) = NULL;
- dev_proc(pdev, map_color_rgb) = gdev_cmyk_map_color_rgb;
-
- if (pdev->is_open)
- gs_closedevice(pdev);
- }
- /* Check for valid bpp values */
-
- switch (bpp) {
- case 16:
- case 32:
- if (cprn_device->cmyk && ccomps && ccomps != 4)
- goto bppe;
- break;
+ /* Reset procedures because we may have been in another mode. */
- case 24:
- if (!cprn_device->cmyk || ccomps == 0 || ccomps == 4) {
- break;
- }
- else
- if (ccomps == 1) {
- goto bppe;
- }
- else {
+ dev_proc(pdev, map_cmyk_color) = gdev_cmyk_map_cmyk_color;
+ dev_proc(pdev, map_rgb_color) = NULL;
+ dev_proc(pdev, map_color_rgb) = gdev_cmyk_map_color_rgb;
- /* 3 components 24 bpp printing for CMYK device. */
+ if (pdev->is_open) gs_closedevice(pdev);
+ }
- cprn_device->cmyk = -1;
- }
- break;
+ /* Check for valid bpp values */
+
+ switch ( bpp )
+ {
+ case 16:
+ case 32:
+ if (cprn_device->cmyk && ccomps && ccomps != 4) goto bppe;
+ break;
+
+ case 24:
+ if (!cprn_device->cmyk || ccomps == 0 || ccomps == 4) {
+ break;
+ } else if (ccomps == 1) {
+ goto bppe;
+ } else {
+
+ /* 3 components 24 bpp printing for CMYK device. */
+
+ cprn_device->cmyk = -1;
+ }
+ break;
+
+ case 8:
+ if (cprn_device->cmyk) {
+ if (ccomps) {
+ if (ccomps == 3) {
+ cprn_device->cmyk = -1;
+ bpp = 3;
+ } else if (ccomps != 1 && ccomps != 4) {
+ goto bppe;
+ }
+ }
+ if (ccomps != 1) break;
+ } else {
+ break;
+ }
- case 8:
- if (cprn_device->cmyk) {
- if (ccomps) {
- if (ccomps == 3) {
- cprn_device->cmyk = -1;
- bpp = 3;
- }
- else
- if (ccomps != 1 && ccomps != 4) {
- goto bppe;
- }
- }
- if (ccomps != 1)
- break;
- }
- else {
- break;
- }
+ case 1:
+ if (ccomps != 1) goto bppe;
- case 1:
- if (ccomps != 1)
- goto bppe;
+ if (cprn_device->cmyk && bpp != pdev->color_info.depth) {
+ dev_proc(pdev, map_cmyk_color) = NULL;
+ dev_proc(pdev, map_rgb_color) = gdev_cmyk_map_rgb_color;
- if (cprn_device->cmyk && bpp != pdev->color_info.depth) {
- dev_proc(pdev, map_cmyk_color) = NULL;
- dev_proc(pdev, map_rgb_color) = gdev_cmyk_map_rgb_color;
+ if (pdev->is_open) {
+ gs_closedevice(pdev);
+ }
+ }
+ break;
- if (pdev->is_open) {
- gs_closedevice(pdev);
- }
- }
- break;
+ case 3:
+ if (!cprn_device->cmyk) {
+ break;
+ }
- case 3:
- if (!cprn_device->cmyk) {
- break;
- }
- default:
- bppe: return gs_error_rangecheck;
- }
+ default:
+bppe: return gs_error_rangecheck;
+ }
- if (cprn_device->cmyk == -1) {
- dev_proc(pdev, map_cmyk_color) = NULL;
- dev_proc(pdev, map_rgb_color) = gdev_pcl_map_rgb_color;
- dev_proc(pdev, map_color_rgb) = gdev_pcl_map_color_rgb;
+ if (cprn_device->cmyk == -1) {
+ dev_proc(pdev, map_cmyk_color) = NULL;
+ dev_proc(pdev, map_rgb_color) = gdev_pcl_map_rgb_color;
+ dev_proc(pdev, map_color_rgb) = gdev_pcl_map_color_rgb;
- if (pdev->is_open) {
- gs_closedevice(pdev);
- }
- }
- switch (ccomps) {
- case 0:
- break;
+ if (pdev->is_open) {
+ gs_closedevice(pdev);
+ }
+ }
- case 1:
- if (bpp != 1 && bpp != 8)
- goto cce;
- break;
-
- case 4:
- if (cprn_device->cmyk) {
- if (bpp >= 8)
- break;
- }
- case 3:
- if (bpp == 1 || bpp == 3 || bpp == 8 || bpp == 16
- || bpp == 24 || bpp == 32) {
- break;
- }
- cce: default:
- return gs_error_rangecheck;
- }
-
- if (cprn_device->cmyk) {
- if (cprn_device->cmyk > 0) {
- ci->num_components = ccomps ? ccomps : (bpp < 8 ? 1 : 4);
- }
- else {
- ci->num_components = ccomps ? ccomps : (bpp < 8 ? 1 : 3);
- }
- if (bpp != 1 && ci->num_components == 1) { /* We do dithered grays. */
- bpp = bpp < 8 ? 8 : bpp;
- }
- ci->max_color = (1 << (bpp >> 2)) - 1;
- ci->max_gray = (bpp >= 8 ? 255 : 1);
-
- if (ci->num_components == 1) {
- ci->dither_grays = (bpp >= 8 ? 5 : 2);
- ci->dither_colors = (bpp >= 8 ? 5 : bpp > 1 ? 2 : 0);
- }
- else {
- ci->dither_grays = (bpp > 8 ? 5 : 2);
- ci->dither_colors = (bpp > 8 ? 5 : bpp > 1 ? 2 : 0);
- }
- }
- else {
- ci->num_components = (bpp == 1 || bpp == 8 ? 1 : 3);
- ci->max_color = (bpp >= 8 ? 255 : bpp > 1 ? 1 : 0);
- ci->max_gray = (bpp >= 8 ? 255 : 1);
- ci->dither_grays = (bpp >= 8 ? 5 : 2);
- ci->dither_colors = (bpp >= 8 ? 5 : bpp > 1 ? 2 : 0);
- }
-
- ci->depth = ((bpp > 1) && (bpp < 8) ? 8 : bpp);
-
- return 0;
- }
+ switch (ccomps) {
+ case 0:
+ break;
+
+ case 1:
+ if (bpp != 1 && bpp != 8) goto cce;
+ break;
+
+ case 4:
+ if (cprn_device->cmyk) {
+ if (bpp >= 8) break;
+ }
+
+ case 3:
+ if (bpp == 1 || bpp == 3 || bpp == 8 || bpp == 16
+ || bpp == 24 || bpp == 32) {
+ break;
+ }
+
+cce: default: return gs_error_rangecheck;
+ }
+
+ if (cprn_device->cmyk) {
+ if (cprn_device->cmyk > 0) {
+ ci->num_components = ccomps ? ccomps : (bpp < 8 ? 1 : 4);
+ } else {
+ ci->num_components = ccomps ? ccomps : (bpp < 8 ? 1 : 3);
+ }
+ if (bpp != 1 && ci->num_components == 1) { /* We do dithered grays. */
+ bpp = bpp < 8 ? 8 : bpp;
+ }
+
+ ci->max_color = (1 << (bpp >> 2)) - 1;
+ ci->max_gray = (bpp >= 8 ? 255 : 1);
+
+ if (ci->num_components == 1) {
+ ci->dither_grays = (bpp >= 8 ? 5 : 2);
+ ci->dither_colors = (bpp >= 8 ? 5 : bpp > 1 ? 2 : 0);
+ } else {
+ ci->dither_grays = (bpp > 8 ? 5 : 2);
+ ci->dither_colors = (bpp > 8 ? 5 : bpp > 1 ? 2 : 0);
+ }
+ } else {
+ ci->num_components = (bpp == 1 || bpp == 8 ? 1 : 3);
+ ci->max_color = (bpp >= 8 ? 255 : bpp > 1 ? 1 : 0);
+ ci->max_gray = (bpp >= 8 ? 255 : 1);
+ ci->dither_grays = (bpp >= 8 ? 5 : 2);
+ ci->dither_colors = (bpp >= 8 ? 5 : bpp > 1 ? 2 : 0);
+ }
+
+ ci->depth = ((bpp > 1) && (bpp < 8) ? 8 : bpp);
+
+ return 0;
+}
/* new_bpp == save_bpp or new_bpp == 0 means don't change bpp.
ccomps == 0 means don't change number of color comps.
If new_bpp != 0, it must be the value of the BitsPerPixel element of
- the plist; real_bpp may differ from new_bpp.
- */
- private int
- cdj_put_param_bpp(gx_device * pdev, gs_param_list * plist, int new_bpp,
- int real_bpp, int ccomps) {
- if (new_bpp == 0 && ccomps == 0)
- return gdev_prn_put_params(pdev, plist);
- else {
- gx_device_color_info save_info;
- int save_bpp;
- int code;
-
- save_info = pdev->color_info;
- save_bpp = save_info.depth;
+ the plist; real_bpp may differ from new_bpp.
+*/
+private int
+cdj_put_param_bpp(gx_device *pdev, gs_param_list *plist, int new_bpp,
+ int real_bpp, int ccomps)
+{
+ if (new_bpp == 0 && ccomps == 0)
+ return gdev_prn_put_params(pdev, plist);
+ else
+ {
+ gx_device_color_info save_info;
+ int save_bpp;
+ int code;
+
+ save_info = pdev->color_info;
+ save_bpp = save_info.depth;
#define save_ccomps save_info.num_components
- if (save_bpp == 8 && save_ccomps == 3 && !cprn_device->cmyk)
- save_bpp = 3;
- code = cdj_set_bpp(pdev, real_bpp, ccomps);
- if (code < 0) {
- param_signal_error(plist, "BitsPerPixel", code);
- param_signal_error(plist, "ProcessColorModel", code);
- return code;
- }
- pdev->color_info.depth = new_bpp; /* cdj_set_bpp maps 3/6 to 8 */
-
- code = gdev_prn_put_params(pdev, plist);
- if (code < 0) {
- cdj_set_bpp(pdev, save_bpp, save_ccomps);
- return code;
- }
- cdj_set_bpp(pdev, real_bpp, ccomps); /* reset depth if needed */
- if ((cdj->color_info.depth != save_bpp ||
- (ccomps != 0 && ccomps != save_ccomps))
- && pdev->is_open)
- return gs_closedevice(pdev);
- return 0;
+ if ( save_bpp == 8 && save_ccomps == 3 && !cprn_device->cmyk)
+ save_bpp = 3;
+ code = cdj_set_bpp(pdev, real_bpp, ccomps);
+ if ( code < 0 ) {
+ param_signal_error(plist, "BitsPerPixel", code);
+ param_signal_error(plist, "ProcessColorModel", code);
+ return code;
+ }
+ pdev->color_info.depth = new_bpp; /* cdj_set_bpp maps 3/6 to 8 */
+ code = gdev_prn_put_params(pdev, plist);
+ if ( code < 0 )
+ { cdj_set_bpp(pdev, save_bpp, save_ccomps);
+ return code;
+ }
+ cdj_set_bpp(pdev, real_bpp, ccomps); /* reset depth if needed */
+ if ((cdj->color_info.depth != save_bpp ||
+ (ccomps != 0 && ccomps != save_ccomps))
+ && pdev->is_open )
+ return gs_closedevice(pdev);
+ return 0;
#undef save_ccomps
- }
- }
+ }
+}
/* This returns either the number of pixels in a scan line, or the number
* of bytes required to store the line, both clipped to the page margins */
- private uint
- gdev_prn_rasterwidth(const gx_device_printer * pdev, int pixelcount) {
- ulong raster_width =
- pdev->width - pdev->x_pixels_per_inch * (dev_l_margin(pdev) + dev_r_margin(pdev));
- return (pixelcount ?
- (uint) raster_width :
- (uint) ((raster_width * pdev->color_info.depth + 7) >> 3));
- } /* Functions for manipulation params strings */
- private const byte *
- paramValueToString(const stringParamDescription * params, int value) {
-
- for (; params->p_name; ++params) {
- if (params->p_value == value) {
- return (const byte *)params->p_name;
- }
- } return (const byte *)0;
- }
-
- private int
- paramStringValue(const stringParamDescription * params,
- const byte * name, int namelen, int *value) {
-
- for (; params->p_name; ++params) {
- if (strncmp(params->p_name, (char *)name, namelen) == 0 &&
- params->p_name[namelen] == 0) {
- *value = params->p_value;
- return 1;
- }
- }
- return 0;
- }
-
- private int
- put_param_string(gs_param_list * plist,
- const byte * pname, gs_param_string * pstring,
- const stringParamDescription * params, int *pvalue, int code) {
-
- int ncode;
-
- if ((ncode = param_read_string(plist, (char *)pname, pstring)) < 0) {
- param_signal_error(plist, (char *)pname, code = ncode);
- } else
- if (ncode == 1) {
- pstring->data = 0, pstring->size = 0;
- }
- else {
- int value = 0;
-
- if (paramStringValue(params, pstring->data, pstring->size,
- &value) == 0) {
- param_signal_error(plist, (char *)pname, code = gs_error_rangecheck);
- } else {
- *pvalue = value;
- }
- }
-
- return code;
- }
-
- private int
- get_param_string(gs_param_list * plist,
- const byte * pname, gs_param_string * pstring,
- const stringParamDescription * params, int pvalue, bool persist, int code) {
-
- int ncode;
-
- pstring->data = paramValueToString(params, pvalue);
-
- if (pstring->data == (byte *) 0) {
- param_signal_error(plist, (char *)pname, ncode = gs_error_unknownerror);
- } else {
- pstring->size = strlen((char *)pstring->data);
- pstring->persistent = persist;
- }
-
- if ((ncode = param_write_string(plist, (char *)pname, pstring)) < 0) {
- code = ncode;
- }
- return code;
- }
+private uint
+gdev_prn_rasterwidth(const gx_device_printer *pdev, int pixelcount)
+{
+ ulong raster_width =
+ pdev->width - pdev->x_pixels_per_inch * (dev_l_margin(pdev) + dev_r_margin(pdev));
+ return (pixelcount ?
+ (uint)raster_width :
+ (uint)((raster_width * pdev->color_info.depth + 7) >> 3));
+}
+
+/* Functions for manipulation params strings */
+
+private const byte*
+paramValueToString(const stringParamDescription* params, int value)
+{
+
+ for (; params->p_name; ++params) {
+ if (params->p_value == value) {
+ return (const byte *)params->p_name;
+ }
+ }
+
+ return (const byte*) 0;
+}
+
+private int
+paramStringValue(const stringParamDescription* params,
+ const byte* name, int namelen, int* value)
+{
+
+ for (; params->p_name; ++params) {
+ if (strncmp(params->p_name, (char *)name, namelen) == 0 &&
+ params->p_name[namelen] == 0) {
+ *value = params->p_value;
+ return 1;
+ }
+ }
+
+ return 0;
+}
+
+private int
+put_param_string(gs_param_list* plist,
+ const byte* pname, gs_param_string* pstring,
+ const stringParamDescription* params, int *pvalue, int code)
+{
+
+ int ncode;
+
+ if ((ncode = param_read_string(plist, (char *)pname, pstring)) < 0) {
+ param_signal_error(plist, (char *)pname, code = ncode);
+ } else if (ncode == 1) {
+ pstring->data = 0, pstring->size = 0;
+ } else {
+ int value = 0;
+
+ if (paramStringValue(params, pstring->data, pstring->size,
+ &value) == 0) {
+ param_signal_error(plist, (char *)pname, code = gs_error_rangecheck);
+ } else {
+ *pvalue = value;
+ }
+ }
+
+ return code;
+}
+
+private int
+get_param_string(gs_param_list* plist,
+ const byte* pname, gs_param_string* pstring,
+ const stringParamDescription* params, int pvalue, bool persist, int code)
+{
+
+ int ncode;
+
+ pstring->data = paramValueToString(params, pvalue);
+
+ if (pstring->data == (byte*) 0) {
+ param_signal_error(plist, (char *)pname, ncode = gs_error_unknownerror);
+ } else {
+ pstring->size = strlen((char *)pstring->data);
+ pstring->persistent = persist;
+ }
+
+ if ((ncode = param_write_string(plist, (char *)pname, pstring)) < 0) {
+ code = ncode;
+ }
+
+ return code;
+}
/*
* This taken from gsdparam.c. I hope it will be useable directly some day.
*
*/
- private int
- cdj_param_check_bytes(gs_param_list * plist, gs_param_name pname, const byte * str,
- uint size, bool defined) {
- int code;
- gs_param_string new_value;
- switch (code = param_read_string(plist, pname, &new_value)) {
- case 0:
- if (defined && new_value.size == size &&
- !memcmp((const char *)str, (const char *)new_value.data,
- size)
- )
- break;
- code = gs_note_error(gs_error_rangecheck);
- goto e;
- default:
- if (param_read_null(plist, pname) == 0)
- return 1;
- e: param_signal_error(plist, pname, code);
- case 1:
- ;
- }
- return code;
- }
+private int
+cdj_param_check_bytes(gs_param_list *plist, gs_param_name pname, const byte *str,
+ uint size, bool defined)
+{ int code;
+ gs_param_string new_value;
+ switch ( code = param_read_string(plist, pname, &new_value) )
+ {
+ case 0:
+ if ( defined && new_value.size == size &&
+ !memcmp((const char *)str, (const char *)new_value.data,
+ size)
+ )
+ break;
+ code = gs_note_error(gs_error_rangecheck);
+ goto e;
+ default:
+ if ( param_read_null(plist, pname) == 0 )
+ return 1;
+e: param_signal_error(plist, pname, code);
+ case 1:
+ ;
+ }
+ return code;
+}
/* This is original code. */
- private int
- cdj_param_check_float(gs_param_list * plist, gs_param_name pname, floatp fval,
- bool defined) {
- int code;
- float new_value;
- switch (code = param_read_float(plist, pname, &new_value)) {
- case 0:
- if (defined && new_value == fval)
- break;
- code = gs_note_error(gs_error_rangecheck);
- goto e;
- default:
- if (param_read_null(plist, pname) == 0)
- return 1;
- e: param_signal_error(plist, pname, code);
- case 1:
- ;
- }
- return code;
- }
+private int
+cdj_param_check_float(gs_param_list *plist, gs_param_name pname, floatp fval,
+ bool defined)
+{ int code;
+ float new_value;
+ switch ( code = param_read_float(plist, pname, &new_value) )
+ {
+ case 0:
+ if ( defined && new_value == fval)
+ break;
+ code = gs_note_error(gs_error_rangecheck);
+ goto e;
+ default:
+ if ( param_read_null(plist, pname) == 0 )
+ return 1;
+e: param_signal_error(plist, pname, code);
+ case 1:
+ ;
+ }
+ return code;
+}
/* The following dithering algorithm has been kindly given to me (YA) by
* Klaus-Gunther Hess, I just adapted it for use with the code here. */
/*
- (From KGH:)
+(From KGH:)
- Just about the features of the code:
+Just about the features of the code:
- - Stored Color-Values are BYTES in the order C-M-Y-K.
- (Indices need to change with gdevcdj.c)
+ - Stored Color-Values are BYTES in the order C-M-Y-K.
+ (Indices need to change with gdevcdj.c)
- - There are individual THRESHOLDs and SPOTSIZEs for
- the color-components. The following relation should
- be maintained:
- SPOTSIZE = 2 * THRESHOLD + 1
- (The internal calculation is dedicated for limiting
- ink-density at the 720x720DpI-Resolution of the
- Epson-Printers, without loss of dynamic color-range)
+ - There are individual THRESHOLDs and SPOTSIZEs for
+ the color-components. The following relation should
+ be maintained:
+ SPOTSIZE = 2 * THRESHOLD + 1
+ (The internal calculation is dedicated for limiting
+ ink-density at the 720x720DpI-Resolution of the
+ Epson-Printers, without loss of dynamic color-range)
- - In addition to that there are EMIN & EMAX-Values
- for the components. The Values are computed from
- the dithering-algorithm and can be replaced by
- constants, if neither the implementation nor
- THRESHOLD and SPOTSIZE can change.
+ - In addition to that there are EMIN & EMAX-Values
+ for the components. The Values are computed from
+ the dithering-algorithm and can be replaced by
+ constants, if neither the implementation nor
+ THRESHOLD and SPOTSIZE can change.
- - The algorithm is tuned for speed. (K-only, if gray-
- levels are detected, with EMIN/EMAX-clipping of
- stored CMY-Errors. [Notice: cerr, merr, yerr are
- *not* reset to zero! Clearing them would cause
- regular patterns & "Halos" to appear!])
+ - The algorithm is tuned for speed. (K-only, if gray-
+ levels are detected, with EMIN/EMAX-clipping of
+ stored CMY-Errors. [Notice: cerr, merr, yerr are
+ *not* reset to zero! Clearing them would cause
+ regular patterns & "Halos" to appear!])
- */
+*/
/*
* Macros, that represent the undisturbed dithering-algorithm
@@ -3604,294 +3647,270 @@ hp_colour_open(gx_device * pdev, int ptype)
#define ODX_Y 0
#define ODX_K 3
- private int
- bjc_fscmyk(byte ** inplanes, byte * outplanes[4][4], int **errplanes,
- int plane_size, int scan) {
+private int
+bjc_fscmyk(byte** inplanes, byte* outplanes[4][4], int** errplanes,
+ int plane_size, int scan) {
- byte * err = (byte *) errplanes[0];
+ byte* err = (byte*) errplanes[0];
/* =========================================================== */
- if (scan < 0) { /* scan < 0 -> initialize private buffer */
+ if(scan < 0) { /* scan < 0 -> initialize private buffer */
/* =========================================================== */
- int p, i, v;
- int *direction, *threshold, *spotsize, *emin,
- *emax;
- int *errv, *errc;
+ int p,i,v;
+ int *direction,*threshold,*spotsize,*emin,*emax;
+ int *errv,*errc;
/*
* allocate the error-buffer
*/
- /*KGHorig
- i = 4 * (5 + 1 + 1 + sd->stc.prt_pixels + 1) * sizeof(errv[0]);
- if((sd->stc.err_size < i) || (NULL == sd->stc.err)) {
- if(NULL != sd->stc.err)
- gs_free(sd->stc.err,sd->stc.err_size,1,"stcm/err");
- sd->stc.err_size = i;
- sd->stc.err = gs_malloc(sd->stc.err_size,1,"stcm/err");
- if(sd->stc.err == NULL) return_error(gs_error_VMerror);
- }
- */
-
- direction = (int *)err;
- threshold = direction + 4;
- spotsize = threshold + 4;
- emin = spotsize + 4;
- emax = emin + 4;
- errc = emax + 4;
- errv = errc + 2 * 4;
+ /*KGHorig
+ i = 4 * (5 + 1 + 1 + sd->stc.prt_pixels + 1) * sizeof(errv[0]);
+ if((sd->stc.err_size < i) || (NULL == sd->stc.err)) {
+ if(NULL != sd->stc.err)
+ gs_free(sd->stc.err,sd->stc.err_size,1,"stcm/err");
+ sd->stc.err_size = i;
+ sd->stc.err = gs_malloc(sd->stc.err_size,1,"stcm/err");
+ if(sd->stc.err == NULL) return_error(gs_error_VMerror);
+ }
+ */
+
+ direction = (int *) err;
+ threshold = direction + 4;
+ spotsize = threshold + 4;
+ emin = spotsize + 4;
+ emax = emin + 4;
+ errc = emax + 4;
+ errv = errc + 2*4;
/*
* compute initial values
*/
- DIRECTION = -1;
- for (i = 0; i < 4; ++i) {
- int j;
- float maxv = 1.0;
- /*KGHorig
- if((sd->stc.xfer[i].size < 1) || (sd->stc.xfer[i].data == NULL)) {
- maxv = 1.0;
- } else {
- maxv = 1.0/255.0;
- for(j = 0; j < sd->stc.xfer[i].size; ++j)
- if(maxv < sd->stc.xfer[i].data[j])
- maxv = sd->stc.xfer[i].data[j];
- }
- */
- CMYK_THRESHOLD(i) = 127.0 / maxv + 0.5;
- SPOTSIZE(i) = ((int)CMYK_THRESHOLD(i) << 1) + 1;
- j = CMYK_THRESHOLD(i); /* Maximum Error-Value */
- errc[3] = 0;
- FSdiffuse(CMYK_THRESHOLD(i), errv[0], errc[0], errv[-4]);
- FSdiffuse(CMYK_THRESHOLD(i), errv[0], errc[0], errv[-4]);
- EMAX(i) = errv[0];
- errc[0] = 0;
- FSdiffuse((-CMYK_THRESHOLD(i)), errv[0], errc[0], errv[-4]);
- FSdiffuse((-CMYK_THRESHOLD(i)), errv[0], errc[0], errv[-4]);
- EMIN(i) = errv[0];
- }
-#ifdef CDJ_DEBUG_FS for (i = 0; i < 4; ++i)
- fprintf(stderr,
- "CMYK_THRESHOLD(%d)=%5d, spotsize(%d)=%5d, emin(%d)=%5d, emax(%d)=%5d\n",
- i, CMYK_THRESHOLD(i), i, SPOTSIZE(i), i, EMIN(i), i, EMAX(i));
+ DIRECTION = -1;
+ for(i = 0; i < 4; ++i) {
+ int j;
+ float maxv = 1.0;
+ /*KGHorig
+ if((sd->stc.xfer[i].size < 1) || (sd->stc.xfer[i].data == NULL)) {
+ maxv = 1.0;
+ } else {
+ maxv = 1.0/255.0;
+ for(j = 0; j < sd->stc.xfer[i].size; ++j)
+ if(maxv < sd->stc.xfer[i].data[j])
+ maxv = sd->stc.xfer[i].data[j];
+ }
+ */
+ CMYK_THRESHOLD(i) = 127.0 / maxv + 0.5;
+ SPOTSIZE(i) = ((int) CMYK_THRESHOLD(i)<<1)+1;
+ j = CMYK_THRESHOLD(i); /* Maximum Error-Value */
+ errc[3] = 0;
+ FSdiffuse(CMYK_THRESHOLD(i),errv[0],errc[0],errv[-4]);
+ FSdiffuse(CMYK_THRESHOLD(i),errv[0],errc[0],errv[-4]);
+ EMAX(i) = errv[0];
+ errc[0] = 0;
+ FSdiffuse((-CMYK_THRESHOLD(i)),errv[0],errc[0],errv[-4]);
+ FSdiffuse((-CMYK_THRESHOLD(i)),errv[0],errc[0],errv[-4]);
+ EMIN(i) = errv[0];
+ }
+
+#ifdef CDJ_DEBUG_FS
+ for(i = 0; i < 4; ++i) fprintf(stderr,
+ "CMYK_THRESHOLD(%d)=%5d, spotsize(%d)=%5d, emin(%d)=%5d, emax(%d)=%5d\n",
+ i,CMYK_THRESHOLD(i),i,SPOTSIZE(i),i,EMIN(i),i,EMAX(i));
#endif
- for (i = 0; i < 4; ++i)
- errc[i] = 0;
-
- for (p = 0; p < NPIXEL; ++p) {
- for (i = 0; i < 4; ++i) {
- /*KHGOrig
- if(sd->stc.flags & STCDFLAG0) v = 0;
- */
- if (0)
- v = 0; /* Must provide a default for that. */
- else
- v = (rand() % SPOTSIZE(i)) - CMYK_THRESHOLD(i);
- FSdiffuse(v, errv[i], errc[i], errv[i - 4]);
- }
- errv += i;
- }
+ for(i = 0; i < 4; ++i) errc[i] = 0;
+
+ for(p = 0; p < NPIXEL; ++p) {
+ for(i = 0; i < 4; ++i) {
+ /*KHGOrig
+ if(sd->stc.flags & STCDFLAG0) v = 0;
+ */
+ if (0) v = 0; /* Must provide a default for that. */
+ else v = (rand() % SPOTSIZE(i)) - CMYK_THRESHOLD(i);
+ FSdiffuse(v,errv[i],errc[i],errv[i-4]);
+ }
+ errv += i;
+ }
/* =========================================================== */
- }
- else { /* scan >= 0 -> scanline-processing */
+ } else { /* scan >= 0 -> scanline-processing */
/* =========================================================== */
- int w, p, dir, thedir;
- byte * out[4], pixel[4], bit;
-
- /*KGHorig
- int *width = outplanes[scan];
- */
- int *direction = (int *)err;
- int *threshold = direction + 4;
- int *spotsize = threshold + 4;
- int *emin = spotsize + 4;
- int *emax = emin + 4;
- int *errc = emax + 4;
- int *errv = errc + 2 * 4;
- int kerr, cerr, merr, yerr;
-
- byte * in;
-
- /*KGHorig
- if(sd->stc.flags & STCDFLAG1) {
- */
- if (0) { /* Eventually will provide a flag for this. */
- cerr = merr = yerr = kerr = 0;
- }
- else {
- cerr = errc[0];
- merr = errc[1];
- yerr = errc[2];
- kerr = errc[3];
- }
-
- out[0] = outplanes[scan + 2][ODX_C];
- out[1] = outplanes[scan + 2][ODX_M];
- out[2] = outplanes[scan + 2][ODX_Y];
- out[3] = outplanes[scan + 2][ODX_K];
- pixel[0] = pixel[1] = pixel[2] = pixel[3] = 0;
-
- if (DIRECTION < 0) { /* scan == 0, run backward */
- w = NPIXEL;
- in = inplanes[2] + 4 * (NPIXEL - 1);
- errv += (w - 1) << 2;
- dir = -4;
- /*KGHorig
- if(w > 8) for(p = 0; p < 4; ++p) out[p] += (w-1)>>3;
- */
- thedir = -1;
- for (p = 0; p < 4; ++p) {
- out[p] += plane_size - 1;
- }
- }
- else { /* run forward */
- w = 1;
- in = inplanes[3] - 4 * NPIXEL;
- dir = 4;
- thedir = 1;
- for (p = 0; p < 4; ++p) {
- out[p] -= plane_size;
- }
- } /* run backward/forward */
-
- /*KGHorig
- if(0 == (sd->stc.flags & STCDFLAG1)) DIRECTION = -DIRECTION;
- */
- if (1)
- DIRECTION = -DIRECTION; /* Scan in other direction. */
-
- bit = 0x80 >> ((w - 1) & 7);
- w = (w + 7) >> 3;
-
- for (p = NPIXEL; p; --p) { /* loop over pixels */
-
- int cmy = in[IDX_C] | in[IDX_M] | in[IDX_Y];
- int kv = FSerror(in[IDX_K], errv[3], kerr);
- int cv;
-
- FSdecide(kv, CMYK_THRESHOLD(3), SPOTSIZE(3), pixel[3], bit);
-
- if (cmy) {
-
- if (pixel[3] & bit) { /* black known to fire */
-
- FSdiffuse(kv, errv[3], kerr, errv[3 - dir]);
-
- cv = FSerror(in[IDX_C], errv[0], cerr);
- cv -= SPOTSIZE(0);
- if ((cv + CMYK_THRESHOLD(0)) < 0)
- cv = -CMYK_THRESHOLD(0);
- FSdiffuse(cv, errv[0], cerr, errv[0 - dir]);
-
- cv = FSerror(in[IDX_M], errv[1], merr);
- cv -= SPOTSIZE(1);
- if ((cv + CMYK_THRESHOLD(1)) < 0)
- cv = -CMYK_THRESHOLD(1);
-
- FSdiffuse(cv, errv[1], merr, errv[1 - dir]);
-
- cv = FSerror(in[IDX_Y], errv[2], yerr);
- cv -= SPOTSIZE(2);
- if ((cv + CMYK_THRESHOLD(2)) < 0)
- cv = -CMYK_THRESHOLD(2);
- FSdiffuse(cv, errv[2], yerr, errv[2 - dir]);
-
- }
- else {
-
- cv = FSerror(in[IDX_C], errv[0], cerr);
- FSdecide(cv, CMYK_THRESHOLD(0), SPOTSIZE(0), pixel[0], bit);
- FSdiffuse(cv, errv[0], cerr, errv[0 - dir]);
-
- cv = FSerror(in[IDX_M], errv[1], merr);
- FSdecide(cv, CMYK_THRESHOLD(1), SPOTSIZE(1), pixel[1], bit);
- FSdiffuse(cv, errv[1], merr, errv[1 - dir]);
-
- cv = FSerror(in[IDX_Y], errv[2], yerr);
- FSdecide(cv, CMYK_THRESHOLD(2), SPOTSIZE(2), pixel[2], bit);
- FSdiffuse(cv, errv[2], yerr, errv[2 - dir]);
-
- if (pixel[0] & pixel[1] & pixel[2] & bit) {
- pixel[0] &= ~bit;
- pixel[1] &= ~bit;
- pixel[2] &= ~bit;
- pixel[3] |= bit;
- kv -= SPOTSIZE(3);
- if ((kv + CMYK_THRESHOLD(3)) < 0)
- kv = -CMYK_THRESHOLD(0);
- FSdiffuse(kv, errv[3], kerr, errv[3 - dir]);
- }
- }
-
- }
- else {
-
- FSdiffuse(kv, errv[3], kerr, errv[3 - dir]);
-
- if (errv[0] > EMAX(0))
- errv[0] = EMAX(0);
- else
- if (errv[0] < EMIN(0))
- errv[0] = EMIN(0);
-
- if (errv[1] > EMAX(1))
- errv[1] = EMAX(1);
- else
- if (errv[1] < EMIN(1))
- errv[1] = EMIN(1);
-
- if (errv[2] > EMAX(2))
- errv[2] = EMAX(2);
- else
- if (errv[2] < EMIN(2))
- errv[2] = EMIN(2);
-
- }
+ int w,p,dir,thedir;
+ byte *out[4],pixel[4],bit;
+ /*KGHorig
+ int *width = outplanes[scan];
+ */
+ int *direction = (int *) err;
+ int *threshold = direction + 4;
+ int *spotsize = threshold + 4;
+ int *emin = spotsize + 4;
+ int *emax = emin + 4;
+ int *errc = emax + 4;
+ int *errv = errc + 2*4;
+ int kerr,cerr,merr,yerr;
+
+ byte* in;
+
+ /*KGHorig
+ if(sd->stc.flags & STCDFLAG1) {
+ */
+ if (0) { /* Eventually will provide a flag for this. */
+ cerr = merr = yerr = kerr = 0;
+ } else {
+ cerr = errc[0];
+ merr = errc[1];
+ yerr = errc[2];
+ kerr = errc[3];
+ }
+
+ out[0] = outplanes[scan + 2][ODX_C];
+ out[1] = outplanes[scan + 2][ODX_M];
+ out[2] = outplanes[scan + 2][ODX_Y];
+ out[3] = outplanes[scan + 2][ODX_K];
+ pixel[0] = pixel[1] = pixel[2] = pixel[3] = 0;
+
+ if(DIRECTION < 0) { /* scan == 0, run backward */
+ w = NPIXEL;
+ in = inplanes[2] + 4 * (NPIXEL - 1);
+ errv += (w-1)<<2;
+ dir = -4;
+ /*KGHorig
+ if(w > 8) for(p = 0; p < 4; ++p) out[p] += (w-1)>>3;
+ */
+ thedir = -1;
+ for (p = 0; p < 4; ++p) {
+ out[p] += plane_size - 1;
+ }
+ } else { /* run forward */
+ w = 1;
+ in = inplanes[3] - 4 * NPIXEL;
+ dir = 4;
+ thedir = 1;
+ for (p = 0; p < 4; ++p) {
+ out[p] -= plane_size;
+ }
+ } /* run backward/forward */
+
+ /*KGHorig
+ if(0 == (sd->stc.flags & STCDFLAG1)) DIRECTION = -DIRECTION;
+ */
+ if (1) DIRECTION = -DIRECTION; /* Scan in other direction. */
+
+ bit = 0x80>>((w-1) & 7);
+ w = (w+7)>>3;
+
+ for(p = NPIXEL; p; --p) { /* loop over pixels */
+
+ int cmy = in[IDX_C] | in[IDX_M] | in[IDX_Y];
+ int kv = FSerror(in[IDX_K],errv[3],kerr);
+ int cv;
+
+ FSdecide(kv,CMYK_THRESHOLD(3),SPOTSIZE(3),pixel[3],bit);
+
+ if(cmy) {
+
+ if(pixel[3] & bit) { /* black known to fire */
+
+ FSdiffuse(kv,errv[3],kerr,errv[3-dir]);
+
+ cv = FSerror(in[IDX_C],errv[0],cerr);
+ cv -= SPOTSIZE(0);
+ if ((cv+CMYK_THRESHOLD(0)) < 0) cv = -CMYK_THRESHOLD(0);
+ FSdiffuse(cv,errv[0],cerr,errv[0-dir]);
+
+ cv = FSerror(in[IDX_M],errv[1],merr);
+ cv -= SPOTSIZE(1);
+ if ((cv+CMYK_THRESHOLD(1)) < 0) cv = -CMYK_THRESHOLD(1);
+
+ FSdiffuse(cv,errv[1],merr,errv[1-dir]);
+
+ cv = FSerror(in[IDX_Y],errv[2],yerr);
+ cv -= SPOTSIZE(2);
+ if ((cv+CMYK_THRESHOLD(2)) < 0) cv = -CMYK_THRESHOLD(2);
+ FSdiffuse(cv,errv[2],yerr,errv[2-dir]);
+
+ } else {
+
+ cv = FSerror(in[IDX_C],errv[0],cerr);
+ FSdecide(cv,CMYK_THRESHOLD(0),SPOTSIZE(0),pixel[0],bit);
+ FSdiffuse(cv,errv[0],cerr,errv[0-dir]);
+
+ cv = FSerror(in[IDX_M],errv[1],merr);
+ FSdecide(cv,CMYK_THRESHOLD(1),SPOTSIZE(1),pixel[1],bit);
+ FSdiffuse(cv,errv[1],merr,errv[1-dir]);
+
+ cv = FSerror(in[IDX_Y],errv[2],yerr);
+ FSdecide(cv,CMYK_THRESHOLD(2),SPOTSIZE(2),pixel[2],bit);
+ FSdiffuse(cv,errv[2],yerr,errv[2-dir]);
+
+ if(pixel[0] & pixel[1] & pixel[2] & bit) {
+ pixel[0] &= ~bit;
+ pixel[1] &= ~bit;
+ pixel[2] &= ~bit;
+ pixel[3] |= bit;
+ kv -= SPOTSIZE(3);
+ if ((kv+CMYK_THRESHOLD(3)) < 0) kv = -CMYK_THRESHOLD(0);
+ FSdiffuse(kv,errv[3],kerr,errv[3-dir]);
+ }
+ }
+
+ } else {
+
+ FSdiffuse(kv,errv[3],kerr,errv[3-dir]);
+
+ if( errv[0] > EMAX(0)) errv[0] = EMAX(0);
+ else if(errv[0] < EMIN(0)) errv[0] = EMIN(0);
+
+ if( errv[1] > EMAX(1)) errv[1] = EMAX(1);
+ else if(errv[1] < EMIN(1)) errv[1] = EMIN(1);
+
+ if( errv[2] > EMAX(2)) errv[2] = EMAX(2);
+ else if(errv[2] < EMIN(2)) errv[2] = EMIN(2);
+
+ }
/*
* Adjust indices
*/
- bit = dir > 0 ? (bit >> 1) : (bit << 1);
- if (bit == 0) {
- /*KGHorig
- if(((*out[0] = pixel[0]) != 0) && (width[0] < w)) width[0] = w;
- if(((*out[1] = pixel[1]) != 0) && (width[1] < w)) width[1] = w;
- if(((*out[2] = pixel[2]) != 0) && (width[2] < w)) width[2] = w;
- if(((*out[3] = pixel[3]) != 0) && (width[3] < w)) width[3] = w;
- */
- *out[0] = pixel[0];
- *out[1] = pixel[1];
- *out[2] = pixel[2];
- *out[3] = pixel[3];
- out[0] += thedir;
- out[1] += thedir;
- out[2] += thedir;
- out[3] += thedir;
- pixel[0] = pixel[1] = pixel[2] = pixel[3] = 0;
-
- if (dir > 0)
- bit = 0x80;
- else
- bit = 0x01;
- w += dir >> 2;
- }
- in += dir;
- errv += dir;
- } /* loop over pixels */
-
- /*KGHorig
- if(0 == (sd->stc.flags & STCDFLAG1)) {
- */
- if (1) {
- cerr = errc[0] = cerr;
- merr = errc[1] = merr;
- yerr = errc[2] = yerr;
- kerr = errc[3] = kerr;
- }
+ bit = dir > 0 ? (bit>>1) : (bit<<1);
+ if(bit == 0) {
+ /*KGHorig
+ if(((*out[0] = pixel[0]) != 0) && (width[0] < w)) width[0] = w;
+ if(((*out[1] = pixel[1]) != 0) && (width[1] < w)) width[1] = w;
+ if(((*out[2] = pixel[2]) != 0) && (width[2] < w)) width[2] = w;
+ if(((*out[3] = pixel[3]) != 0) && (width[3] < w)) width[3] = w;
+ */
+ *out[0] = pixel[0];
+ *out[1] = pixel[1];
+ *out[2] = pixel[2];
+ *out[3] = pixel[3];
+ out[0] += thedir; out[1] += thedir;
+ out[2] += thedir; out[3] += thedir;
+ pixel[0] = pixel[1] = pixel[2] = pixel[3] = 0;
+
+ if(dir > 0) bit = 0x80;
+ else bit = 0x01;
+ w += dir>>2;
+ }
+
+ in += dir;
+ errv += dir;
+ } /* loop over pixels */
+
+ /*KGHorig
+ if(0 == (sd->stc.flags & STCDFLAG1)) {
+ */
+ if (1) {
+ cerr = errc[0] = cerr;
+ merr = errc[1] = merr;
+ yerr = errc[2] = yerr;
+ kerr = errc[3] = kerr;
+ }
+
/* =========================================================== */
- } /* initialization or scanline-Processing */
+ } /* initialization or scanline-Processing */
/* =========================================================== */
- return 0;
- }
+ return 0;
+}
+
diff --git a/gs/src/gdevcgm.c b/gs/src/gdevcgm.c
index ca31f85a1..3ff741582 100644
--- a/gs/src/gdevcgm.c
+++ b/gs/src/gdevcgm.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995, 1996 Aladdin Enterprises. All rights reserved.
+/* Copyright (C) 1995, 1996, 1998 Aladdin Enterprises. All rights reserved.
This file is part of Aladdin Ghostscript.
@@ -16,7 +16,7 @@
all copies.
*/
-/* gdevcgm.c */
+/*Id: gdevcgm.c */
/* CGM (Computer Graphics Metafile) driver */
#include "memory_.h"
#include "gx.h"
@@ -249,7 +249,7 @@ cgm_put_params(gx_device * dev, gs_param_list * plist)
gx_device_cgm *cdev = (gx_device_cgm *) dev;
int ecode = 0;
int code;
- const char _ds *param_name;
+ const char *param_name;
gs_param_string ofs;
switch (code = param_read_string(plist, (param_name = "OutputFile"), &ofs)) {
diff --git a/gs/src/gdevcgml.c b/gs/src/gdevcgml.c
index 865fb8630..7d2cab8e1 100644
--- a/gs/src/gdevcgml.c
+++ b/gs/src/gdevcgml.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995, 1996 Aladdin Enterprises. All rights reserved.
+/* Copyright (C) 1995, 1996, 1998 Aladdin Enterprises. All rights reserved.
This file is part of Aladdin Ghostscript.
@@ -16,7 +16,7 @@
all copies.
*/
-/* gdevcgml.c */
+/*Id: gdevcgml.c */
/* CGM-writing library */
#include "memory_.h"
#include "stdio_.h"
@@ -29,7 +29,7 @@ private void begin_command(P2(cgm_state *, cgm_op_index));
private cgm_result end_command(P1(cgm_state *));
#define END_OP (void)end_command(st)
-#define END return end_command(st)
+#define DONE return end_command(st)
/* Parameters */
private void put_int(P3(cgm_state *, cgm_int, int));
@@ -164,7 +164,7 @@ cgm_BEGIN_METAFILE(cgm_state * st, const char *str, uint len)
{
OP(BEGIN_METAFILE);
S(str, len);
- END;
+ DONE;
}
cgm_result
@@ -262,7 +262,7 @@ cgm_result
cgm_END_METAFILE(cgm_state * st)
{
OP(END_METAFILE);
- END;
+ DONE;
}
/* ---------------- Picture elements ---------------- */
@@ -272,7 +272,7 @@ cgm_BEGIN_PICTURE(cgm_state * st, const char *str, uint len)
{
OP(BEGIN_PICTURE);
S(str, len);
- END;
+ DONE;
}
cgm_result
@@ -321,7 +321,7 @@ cgm_set_picture_elements(cgm_state * st, const cgm_picture_elements * pic, long
if ((mask & cgm_set_BACKGROUND_COLOR)) {
OP(BACKGROUND_COLOR);
CD(&pic->background_color.rgb);
- END;
+ DONE;
st->picture.background_color = pic->background_color;
}
return st->result;
@@ -331,14 +331,14 @@ cgm_result
cgm_BEGIN_PICTURE_BODY(cgm_state * st)
{
OP(BEGIN_PICTURE_BODY);
- END;
+ DONE;
}
cgm_result
cgm_END_PICTURE(cgm_state * st)
{
OP(END_PICTURE);
- END;
+ DONE;
}
/* ---------------- Control elements ---------------- */
@@ -350,7 +350,7 @@ cgm_VDC_INTEGER_PRECISION(cgm_state * st, int precision)
OP(VDC_INTEGER_PRECISION);
I(precision);
st->vdc_integer_precision = precision;
- END;
+ DONE;
} else
return cgm_result_ok;
}
@@ -361,7 +361,7 @@ cgm_VDC_REAL_PRECISION(cgm_state * st, const cgm_precision * precision)
OP(VDC_REAL_PRECISION);
put_real_precision(st, precision);
st->vdc_real_precision = *precision;
- END;
+ DONE;
}
cgm_result
@@ -370,7 +370,7 @@ cgm_AUXILIARY_COLOR(cgm_state * st, const cgm_color * color)
OP(AUXILIARY_COLOR);
CO(color);
st->auxiliary_color = *color;
- END;
+ DONE;
}
cgm_result
@@ -379,7 +379,7 @@ cgm_TRANSPARENCY(cgm_state * st, cgm_transparency transparency)
OP(TRANSPARENCY);
E(transparency);
st->transparency = transparency;
- END;
+ DONE;
}
cgm_result
@@ -390,7 +390,7 @@ cgm_CLIP_RECTANGLE(cgm_state * st, const cgm_point rectangle[2])
st->clip_rectangle[0] = rectangle[0];
P(&rectangle[1]);
st->clip_rectangle[1] = rectangle[1];
- END;
+ DONE;
}
cgm_result
@@ -399,7 +399,7 @@ cgm_CLIP_INDICATOR(cgm_state * st, cgm_clip_indicator clip)
OP(CLIP_INDICATOR);
E(clip);
st->clip_indicator = clip;
- END;
+ DONE;
}
/* ---------------- Graphical primitive elements ---------------- */
@@ -409,7 +409,7 @@ cgm_POLYLINE(cgm_state * st, const cgm_point * vertices, int count)
{
OP(POLYLINE);
nP(vertices, count);
- END;
+ DONE;
}
cgm_result
@@ -417,7 +417,7 @@ cgm_DISJOINT_POLYLINE(cgm_state * st, const cgm_point * endpoints, int count)
{
OP(DISJOINT_POLYLINE);
nP(endpoints, count);
- END;
+ DONE;
}
cgm_result
@@ -425,7 +425,7 @@ cgm_POLYMARKER(cgm_state * st, const cgm_point * positions, int count)
{
OP(POLYMARKER);
nP(positions, count);
- END;
+ DONE;
}
cgm_result
@@ -435,7 +435,7 @@ cgm_TEXT(cgm_state * st, const cgm_point * position, bool final, const char *str
P(position);
E(final);
S(str, len);
- END;
+ DONE;
}
cgm_result
@@ -446,7 +446,7 @@ cgm_RESTRICTED_TEXT(cgm_state * st, const cgm_vdc * delta_width, const cgm_vdc *
P(position);
E(final);
S(str, len);
- END;
+ DONE;
}
cgm_result
@@ -455,7 +455,7 @@ cgm_APPEND_TEXT(cgm_state * st, bool final, const char *str, uint len)
OP(APPEND_TEXT);
E(final);
S(str, len);
- END;
+ DONE;
}
cgm_result
@@ -463,7 +463,7 @@ cgm_POLYGON(cgm_state * st, const cgm_point * vertices, int count)
{
OP(POLYGON);
nP(vertices, count);
- END;
+ DONE;
}
cgm_result
@@ -476,7 +476,7 @@ cgm_POLYGON_SET(cgm_state * st, const cgm_polygon_edge * vertices, int count)
P(&vertices[i].vertex);
E(vertices[i].edge_out);
}
- END;
+ DONE;
}
cgm_result
@@ -524,7 +524,7 @@ cgm_CELL_ARRAY(cgm_state * st, const cgm_point * pqr /*[3] */ , cgm_int nx, cgm_
put_byte(st, 0);
}
}
- END;
+ DONE;
}
cgm_result
@@ -533,7 +533,7 @@ cgm_RECTANGLE(cgm_state * st, const cgm_point * corner1, const cgm_point * corne
OP(RECTANGLE);
P(corner1);
P(corner2);
- END;
+ DONE;
}
cgm_result
@@ -542,7 +542,7 @@ cgm_CIRCLE(cgm_state * st, const cgm_point * center, const cgm_vdc * radius)
OP(CIRCLE);
P(center);
VDC(radius);
- END;
+ DONE;
}
cgm_result
@@ -552,7 +552,7 @@ cgm_CIRCULAR_ARC_3_POINT(cgm_state * st, const cgm_point * start, const cgm_poin
P(start);
P(intermediate);
P(end);
- END;
+ DONE;
}
cgm_result
@@ -563,7 +563,7 @@ cgm_CIRCULAR_ARC_3_POINT_CLOSE(cgm_state * st, const cgm_point * start, const cg
P(intermediate);
P(end);
E(closure);
- END;
+ DONE;
}
cgm_result
@@ -573,7 +573,7 @@ cgm_CIRCULAR_ARC_CENTER(cgm_state * st, const cgm_point * center, const cgm_vdc
P(center);
VDC4(dx_start, dy_start, dx_end, dy_end);
VDC(radius);
- END;
+ DONE;
}
cgm_result
@@ -584,7 +584,7 @@ cgm_CIRCULAR_ARC_CENTER_CLOSE(cgm_state * st, const cgm_point * center, const cg
VDC4(dx_start, dy_start, dx_end, dy_end);
VDC(radius);
E(closure);
- END;
+ DONE;
}
cgm_result
@@ -594,7 +594,7 @@ cgm_ELLIPSE(cgm_state * st, const cgm_point * center, const cgm_point * cd1_end,
P(center);
P(cd1_end);
P(cd2_end);
- END;
+ DONE;
}
cgm_result
@@ -605,7 +605,7 @@ cgm_ELLIPTICAL_ARC(cgm_state * st, const cgm_point * center, const cgm_point * c
P(cd1_end);
P(cd2_end);
VDC4(dx_start, dy_start, dx_end, dy_end);
- END;
+ DONE;
}
cgm_result
@@ -617,7 +617,7 @@ cgm_ELLIPTICAL_ARC_CLOSE(cgm_state * st, const cgm_point * center, const cgm_poi
P(cd2_end);
VDC4(dx_start, dy_start, dx_end, dy_end);
E(closure);
- END;
+ DONE;
}
/* ---------------- Attribute elements ---------------- */
@@ -628,7 +628,7 @@ cgm_LINE_BUNDLE_INDEX(cgm_state * st, cgm_int index)
OP(LINE_BUNDLE_INDEX);
IX(index);
st->line_bundle_index = index;
- END;
+ DONE;
}
cgm_result
@@ -637,7 +637,7 @@ cgm_LINE_TYPE(cgm_state * st, cgm_line_type line_type)
OP(LINE_TYPE);
IX((int)line_type);
st->line_type = line_type;
- END;
+ DONE;
}
cgm_result
@@ -646,7 +646,7 @@ cgm_LINE_WIDTH(cgm_state * st, const cgm_line_width * line_width)
OP(LINE_WIDTH);
VDC_R(line_width, st->picture.line_width_specification_mode);
st->line_width = *line_width;
- END;
+ DONE;
}
cgm_result
@@ -655,7 +655,7 @@ cgm_LINE_COLOR(cgm_state * st, const cgm_color * color)
OP(LINE_COLOR);
CO(color);
st->line_color = *color;
- END;
+ DONE;
}
cgm_result
@@ -664,7 +664,7 @@ cgm_MARKER_BUNDLE_INDEX(cgm_state * st, cgm_int index)
OP(MARKER_BUNDLE_INDEX);
IX(index);
st->marker_bundle_index = index;
- END;
+ DONE;
}
cgm_result
@@ -673,7 +673,7 @@ cgm_MARKER_TYPE(cgm_state * st, cgm_marker_type marker_type)
OP(MARKER_TYPE);
IX((int)marker_type);
st->marker_type = marker_type;
- END;
+ DONE;
}
cgm_result
@@ -682,7 +682,7 @@ cgm_MARKER_SIZE(cgm_state * st, const cgm_marker_size * marker_size)
OP(MARKER_SIZE);
VDC_R(marker_size, st->picture.marker_size_specification_mode);
st->marker_size = *marker_size;
- END;
+ DONE;
}
cgm_result
@@ -691,7 +691,7 @@ cgm_MARKER_COLOR(cgm_state * st, const cgm_color * color)
OP(MARKER_COLOR);
CO(color);
st->marker_color = *color;
- END;
+ DONE;
}
cgm_result
@@ -700,7 +700,7 @@ cgm_TEXT_BUNDLE_INDEX(cgm_state * st, cgm_int index)
OP(TEXT_BUNDLE_INDEX);
IX(index);
st->text_bundle_index = index;
- END;
+ DONE;
}
cgm_result
@@ -709,7 +709,7 @@ cgm_TEXT_FONT_INDEX(cgm_state * st, cgm_int index)
OP(TEXT_FONT_INDEX);
IX(index);
st->text_font_index = index;
- END;
+ DONE;
}
cgm_result
@@ -718,7 +718,7 @@ cgm_TEXT_PRECISION(cgm_state * st, cgm_text_precision precision)
OP(TEXT_PRECISION);
E(precision);
st->text_precision = precision;
- END;
+ DONE;
}
cgm_result
@@ -727,7 +727,7 @@ cgm_CHARACTER_EXPANSION_FACTOR(cgm_state * st, cgm_real factor)
OP(CHARACTER_EXPANSION_FACTOR);
R(factor);
st->character_expansion_factor = factor;
- END;
+ DONE;
}
cgm_result
@@ -736,7 +736,7 @@ cgm_CHARACTER_SPACING(cgm_state * st, cgm_real spacing)
OP(CHARACTER_SPACING);
R(spacing);
st->character_spacing = spacing;
- END;
+ DONE;
}
cgm_result
@@ -745,7 +745,7 @@ cgm_TEXT_COLOR(cgm_state * st, const cgm_color * color)
OP(TEXT_COLOR);
CO(color);
st->text_color = *color;
- END;
+ DONE;
}
cgm_result
@@ -754,7 +754,7 @@ cgm_CHARACTER_HEIGHT(cgm_state * st, const cgm_vdc * height)
OP(CHARACTER_HEIGHT);
VDC(height);
st->character_height = *height;
- END;
+ DONE;
}
cgm_result
@@ -766,7 +766,7 @@ cgm_CHARACTER_ORIENTATION(cgm_state * st, const cgm_vdc * x_up, const cgm_vdc *
st->character_orientation[1] = *y_up;
st->character_orientation[2] = *x_base;
st->character_orientation[3] = *y_base;
- END;
+ DONE;
}
cgm_result
@@ -775,7 +775,7 @@ cgm_TEXT_PATH(cgm_state * st, cgm_text_path text_path)
OP(TEXT_PATH);
E(text_path);
st->text_path = text_path;
- END;
+ DONE;
}
cgm_result
@@ -786,7 +786,7 @@ cgm_TEXT_ALIGNMENT(cgm_state * st, cgm_text_alignment_horizontal align_h, cgm_te
E(align_v);
R(align_cont_h);
R(align_cont_v);
- END;
+ DONE;
}
cgm_result
@@ -795,7 +795,7 @@ cgm_CHARACTER_SET_INDEX(cgm_state * st, cgm_int index)
OP(CHARACTER_SET_INDEX);
IX(index);
st->character_set_index = index;
- END;
+ DONE;
}
/* See gdevcgml.c for why this isn't named cgm_ALTERNATE_.... */
@@ -805,7 +805,7 @@ cgm_ALT_CHARACTER_SET_INDEX(cgm_state * st, cgm_int index)
OP(ALTERNATE_CHARACTER_SET_INDEX);
IX(index);
st->alternate_character_set_index = index;
- END;
+ DONE;
}
cgm_result
@@ -814,7 +814,7 @@ cgm_FILL_BUNDLE_INDEX(cgm_state * st, cgm_int index)
OP(FILL_BUNDLE_INDEX);
IX(index);
st->fill_bundle_index = index;
- END;
+ DONE;
}
cgm_result
@@ -823,7 +823,7 @@ cgm_INTERIOR_STYLE(cgm_state * st, cgm_interior_style interior_style)
OP(INTERIOR_STYLE);
E(interior_style);
st->interior_style = interior_style;
- END;
+ DONE;
}
cgm_result
@@ -832,7 +832,7 @@ cgm_FILL_COLOR(cgm_state * st, const cgm_color * color)
OP(FILL_COLOR);
CO(color);
st->fill_color = *color;
- END;
+ DONE;
}
cgm_result
@@ -841,7 +841,7 @@ cgm_HATCH_INDEX(cgm_state * st, cgm_hatch_index hatch_index)
OP(HATCH_INDEX);
IX((int)hatch_index);
st->hatch_index = hatch_index;
- END;
+ DONE;
}
cgm_result
@@ -850,7 +850,7 @@ cgm_PATTERN_INDEX(cgm_state * st, cgm_int index)
OP(PATTERN_INDEX);
IX(index);
st->pattern_index = index;
- END;
+ DONE;
}
cgm_result
@@ -859,7 +859,7 @@ cgm_EDGE_BUNDLE_INDEX(cgm_state * st, cgm_int index)
OP(EDGE_BUNDLE_INDEX);
IX(index);
st->edge_bundle_index = index;
- END;
+ DONE;
}
cgm_result
@@ -868,7 +868,7 @@ cgm_EDGE_TYPE(cgm_state * st, cgm_edge_type edge_type)
OP(EDGE_TYPE);
IX((int)edge_type);
st->edge_type = edge_type;
- END;
+ DONE;
}
cgm_result
@@ -877,7 +877,7 @@ cgm_EDGE_WIDTH(cgm_state * st, const cgm_edge_width * edge_width)
OP(EDGE_WIDTH);
VDC_R(edge_width, st->picture.edge_width_specification_mode);
st->edge_width = *edge_width;
- END;
+ DONE;
}
cgm_result
@@ -885,7 +885,7 @@ cgm_EDGE_COLOR(cgm_state * st, const cgm_color * color)
{
OP(EDGE_COLOR);
CO(color);
- END;
+ DONE;
}
cgm_result
@@ -894,7 +894,7 @@ cgm_EDGE_VISIBILITY(cgm_state * st, bool visibility)
OP(EDGE_VISIBILITY);
E(visibility);
st->edge_visibility = visibility;
- END;
+ DONE;
}
cgm_result
@@ -903,7 +903,7 @@ cgm_FILL_REFERENCE_POINT(cgm_state * st, const cgm_point * reference_point)
OP(FILL_REFERENCE_POINT);
P(reference_point);
st->fill_reference_point = *reference_point;
- END;
+ DONE;
}
/* PATTERN_TABLE */
@@ -917,7 +917,7 @@ cgm_PATTERN_SIZE(cgm_state * st, const cgm_vdc * x_height, const cgm_vdc * y_hei
st->pattern_size[1] = *y_height;
st->pattern_size[2] = *x_width;
st->pattern_size[3] = *y_width;
- END;
+ DONE;
}
cgm_result
@@ -929,7 +929,7 @@ cgm_COLOR_TABLE(cgm_state * st, cgm_int index, const cgm_color * values, int cou
CI(index);
for (i = 0; i < count; ++i)
CD(&values[i].rgb);
- END;
+ DONE;
}
cgm_result
@@ -943,7 +943,7 @@ cgm_ASPECT_SOURCE_FLAGS(cgm_state * st, const cgm_aspect_source_flag * flags, in
E(flags[i].source);
st->source_flags[flags[i].type] = (byte) flags[i].source;
}
- END;
+ DONE;
}
/* ================ Internal routines ================ */
diff --git a/gs/src/gdevcgml.h b/gs/src/gdevcgml.h
index eebe84374..d62bd101e 100644
--- a/gs/src/gdevcgml.h
+++ b/gs/src/gdevcgml.h
@@ -1,24 +1,27 @@
/* Copyright (C) 1995, 1996 Aladdin Enterprises. All rights reserved.
-
- This file is part of Aladdin Ghostscript.
-
- Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
- or distributor accepts any responsibility for the consequences of using it,
- or for whether it serves any particular purpose or works at all, unless he
- or she says so in writing. Refer to the Aladdin Ghostscript Free Public
- License (the "License") for full details.
-
- Every copy of Aladdin Ghostscript must include a copy of the License,
- normally in a plain ASCII text file named PUBLIC. The License grants you
- the right to copy, modify and redistribute Aladdin Ghostscript, but only
- under certain conditions described in the License. Among other things, the
- License requires that the copyright notice and this notice be preserved on
- all copies.
-*/
-/* gdevcgml.h */
+ This file is part of Aladdin Ghostscript.
+
+ Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
+ or distributor accepts any responsibility for the consequences of using it,
+ or for whether it serves any particular purpose or works at all, unless he
+ or she says so in writing. Refer to the Aladdin Ghostscript Free Public
+ License (the "License") for full details.
+
+ Every copy of Aladdin Ghostscript must include a copy of the License,
+ normally in a plain ASCII text file named PUBLIC. The License grants you
+ the right to copy, modify and redistribute Aladdin Ghostscript, but only
+ under certain conditions described in the License. Among other things, the
+ License requires that the copyright notice and this notice be preserved on
+ all copies.
+ */
+
+/*Id: gdevcgml.h */
/* Interface definitions for CGM-writing library */
+#ifndef gdevcgml_INCLUDED
+# define gdevcgml_INCLUDED
+
/* The names in the following follow the CGM standard exactly, */
/* except that we have substituted the American spellings of */
/* color (colour) and center (centre). */
@@ -30,36 +33,36 @@ typedef struct cgm_state_s cgm_state;
/* Define the type for the allocator used by the CGM writer. */
typedef struct cgm_allocator_s {
- void *private_data;
- void *(*alloc)(P2(void *, uint));
- void (*free)(P2(void *, void *));
+ void *private_data;
+ void *(*alloc) (P2(void *, uint));
+ void (*free) (P2(void *, void *));
} cgm_allocator;
/* Define types for CGM coordinates. */
typedef int cgm_int;
typedef double cgm_real;
typedef union cgm_vdc_s {
- cgm_int integer;
- cgm_real real;
+ cgm_int integer;
+ cgm_real real;
} cgm_vdc;
typedef struct cgm_int_point_s {
- cgm_int x, y;
+ cgm_int x, y;
} cgm_int_point;
typedef struct cgm_real_point_s {
- cgm_real x, y;
+ cgm_real x, y;
} cgm_real_point;
typedef union cgm_point_s {
- cgm_int_point integer;
- cgm_real_point real;
+ cgm_int_point integer;
+ cgm_real_point real;
} cgm_point;
/* Define types for colors. */
typedef struct cgm_rgb_s {
- cgm_int r, g, b;
+ cgm_int r, g, b;
} cgm_rgb;
typedef union cgm_color_s {
- cgm_int index;
- cgm_rgb rgb;
+ cgm_int index;
+ cgm_rgb rgb;
} cgm_color;
/*
@@ -69,165 +72,167 @@ typedef union cgm_color_s {
* of the enumerated type are named cgm_xxx'_yyy.
*/
typedef enum {
- cgm_vdc_integer = 0,
- cgm_vdc_real
+ cgm_vdc_integer = 0,
+ cgm_vdc_real
} cgm_vdc_type;
typedef struct cgm_string_s {
- const char *chars;
- uint length;
+ const char *chars;
+ uint length;
} cgm_string;
typedef enum {
- cgm_scaling_abstract = 0,
- cgm_scaling_metric
+ cgm_scaling_abstract = 0,
+ cgm_scaling_metric
} cgm_scaling_mode;
typedef enum {
- cgm_color_selection_indexed = 0,
- cgm_color_selection_direct
+ cgm_color_selection_indexed = 0,
+ cgm_color_selection_direct
} cgm_color_selection_mode;
typedef enum {
- cgm_line_marker_absolute = 0,
- cgm_line_marker_scaled
+ cgm_line_marker_absolute = 0,
+ cgm_line_marker_scaled
} cgm_line_marker_specification_mode;
typedef cgm_line_marker_specification_mode
- cgm_line_width_specification_mode, cgm_marker_size_specification_mode,
- cgm_edge_width_specification_mode;
+ cgm_line_width_specification_mode, cgm_marker_size_specification_mode,
+ cgm_edge_width_specification_mode;
typedef union cgm_line_marker_extent_s {
- cgm_vdc absolute;
- cgm_real scaled;
+ cgm_vdc absolute;
+ cgm_real scaled;
} cgm_line_marker_extent;
typedef cgm_line_marker_extent
- cgm_line_width, cgm_marker_size, cgm_edge_width;
+ cgm_line_width, cgm_marker_size, cgm_edge_width;
typedef enum {
- cgm_transparency_off = 0,
- cgm_transparency_on
+ cgm_transparency_off = 0,
+ cgm_transparency_on
} cgm_transparency;
typedef enum {
- cgm_clip_off = 0,
- cgm_clip_on
+ cgm_clip_off = 0,
+ cgm_clip_on
} cgm_clip_indicator;
typedef struct cgm_precision_s {
- enum { cgm_representation_floating, cgm_representation_fixed } representation;
- int exponent_or_whole_width;
- int fraction_width;
+ enum {
+ cgm_representation_floating, cgm_representation_fixed
+ } representation;
+ int exponent_or_whole_width;
+ int fraction_width;
} cgm_precision;
typedef enum {
- cgm_line_solid = 1,
- cgm_line_dash,
- cgm_line_dot,
- cgm_line_dash_dot,
- cgm_line_dash_dot_dot
+ cgm_line_solid = 1,
+ cgm_line_dash,
+ cgm_line_dot,
+ cgm_line_dash_dot,
+ cgm_line_dash_dot_dot
} cgm_line_type;
typedef enum {
- cgm_marker_dot = 1,
- cgm_marker_plus,
- cgm_marker_asterisk,
- cgm_marker_circle,
- cgm_marker_cross
+ cgm_marker_dot = 1,
+ cgm_marker_plus,
+ cgm_marker_asterisk,
+ cgm_marker_circle,
+ cgm_marker_cross
} cgm_marker_type;
typedef enum {
- cgm_text_precision_string = 0,
- cgm_text_precision_character,
- cgm_text_precision_stroke
+ cgm_text_precision_string = 0,
+ cgm_text_precision_character,
+ cgm_text_precision_stroke
} cgm_text_precision;
typedef enum {
- cgm_text_path_right = 0,
- cgm_text_path_left,
- cgm_text_path_up,
- cgm_text_path_down
+ cgm_text_path_right = 0,
+ cgm_text_path_left,
+ cgm_text_path_up,
+ cgm_text_path_down
} cgm_text_path;
typedef enum {
- cgm_text_horizontal_normal = 0,
- cgm_text_horizontal_left,
- cgm_text_horizontal_center,
- cgm_text_horizontal_right,
- cgm_text_horizontal_continuous
+ cgm_text_horizontal_normal = 0,
+ cgm_text_horizontal_left,
+ cgm_text_horizontal_center,
+ cgm_text_horizontal_right,
+ cgm_text_horizontal_continuous
} cgm_text_alignment_horizontal;
typedef enum {
- cgm_text_vertical_normal = 0,
- cgm_text_vertical_top,
- cgm_text_vertical_cap,
- cgm_text_vertical_half,
- cgm_text_vertical_base,
- cgm_text_vertical_bottom,
- cgm_text_vertical_continuous
+ cgm_text_vertical_normal = 0,
+ cgm_text_vertical_top,
+ cgm_text_vertical_cap,
+ cgm_text_vertical_half,
+ cgm_text_vertical_base,
+ cgm_text_vertical_bottom,
+ cgm_text_vertical_continuous
} cgm_text_alignment_vertical;
typedef enum {
- cgm_interior_style_hollow = 0,
- cgm_interior_style_solid,
- cgm_interior_style_pattern,
- cgm_interior_style_hatch,
- cgm_interior_style_empty
+ cgm_interior_style_hollow = 0,
+ cgm_interior_style_solid,
+ cgm_interior_style_pattern,
+ cgm_interior_style_hatch,
+ cgm_interior_style_empty
} cgm_interior_style;
typedef enum {
- cgm_hatch_horizontal = 1,
- cgm_hatch_vertical,
- cgm_hatch_positive_slope,
- cgm_hatch_negative_slope,
- cgm_hatch_combined_v_h_slant,
- cgm_hatch_combined_l_r_slant
+ cgm_hatch_horizontal = 1,
+ cgm_hatch_vertical,
+ cgm_hatch_positive_slope,
+ cgm_hatch_negative_slope,
+ cgm_hatch_combined_v_h_slant,
+ cgm_hatch_combined_l_r_slant
} cgm_hatch_index;
typedef enum {
- cgm_arc_closure_pie = 0,
- cgm_arc_closure_chord
+ cgm_arc_closure_pie = 0,
+ cgm_arc_closure_chord
} cgm_arc_closure;
typedef enum {
- cgm_edge_out_invisible = 0,
- cgm_edge_out_visible,
- cgm_edge_out_close_invisible,
- cgm_edge_out_close_visible
+ cgm_edge_out_invisible = 0,
+ cgm_edge_out_visible,
+ cgm_edge_out_close_invisible,
+ cgm_edge_out_close_visible
} cgm_edge_out;
typedef struct cgm_polygon_edge_s {
- cgm_point vertex;
- cgm_edge_out edge_out;
+ cgm_point vertex;
+ cgm_edge_out edge_out;
} cgm_polygon_edge;
typedef enum {
- cgm_cell_mode_run_length = 0,
- cgm_cell_mode_packed
+ cgm_cell_mode_run_length = 0,
+ cgm_cell_mode_packed
} cgm_cell_representation_mode;
typedef enum {
- cgm_edge_solid = 1,
- cgm_edge_dash,
- cgm_edge_dot,
- cgm_edge_dash_dot,
- cgm_edge_dash_dot_dot
+ cgm_edge_solid = 1,
+ cgm_edge_dash,
+ cgm_edge_dot,
+ cgm_edge_dash_dot,
+ cgm_edge_dash_dot_dot
} cgm_edge_type;
typedef enum {
- cgm_aspect_source_individual = 0,
- cgm_aspect_source_bundled
+ cgm_aspect_source_individual = 0,
+ cgm_aspect_source_bundled
} cgm_aspect_source;
typedef enum {
- cgm_aspect_line_type = 0,
- cgm_aspect_line_width,
- cgm_aspect_line_color,
- cgm_aspect_marker_type,
- cgm_aspect_marker_size,
- cgm_aspect_marker_color,
- cgm_aspect_text_font_index,
- cgm_aspect_text_precision,
- cgm_aspect_character_expansion_factor,
- cgm_aspect_character_spacing,
- cgm_aspect_text_color,
- cgm_aspect_interior_style,
- cgm_aspect_fill_color,
- cgm_aspect_hatch_index,
- cgm_aspect_pattern_index,
- cgm_aspect_edge_type,
- cgm_aspect_edge_width,
- cgm_aspect_edge_color
+ cgm_aspect_line_type = 0,
+ cgm_aspect_line_width,
+ cgm_aspect_line_color,
+ cgm_aspect_marker_type,
+ cgm_aspect_marker_size,
+ cgm_aspect_marker_color,
+ cgm_aspect_text_font_index,
+ cgm_aspect_text_precision,
+ cgm_aspect_character_expansion_factor,
+ cgm_aspect_character_spacing,
+ cgm_aspect_text_color,
+ cgm_aspect_interior_style,
+ cgm_aspect_fill_color,
+ cgm_aspect_hatch_index,
+ cgm_aspect_pattern_index,
+ cgm_aspect_edge_type,
+ cgm_aspect_edge_width,
+ cgm_aspect_edge_color
} cgm_aspect_type;
typedef struct cgm_aspect_source_flag_s {
- cgm_aspect_type type;
- cgm_aspect_source source;
+ cgm_aspect_type type;
+ cgm_aspect_source source;
} cgm_aspect_source_flag;
/* ================ API ================ */
typedef enum {
- cgm_result_ok = 0,
- cgm_result_wrong_state = -1,
- cgm_result_out_of_range = -2,
- cgm_result_io_error = -3,
- cgm_result_out_of_memory = -4
+ cgm_result_ok = 0,
+ cgm_result_wrong_state = -1,
+ cgm_result_out_of_range = -2,
+ cgm_result_io_error = -3,
+ cgm_result_out_of_memory = -4
} cgm_result;
/* ---------------- Initialize/terminate ---------------- */
@@ -238,23 +243,24 @@ cgm_result cgm_terminate(P1(cgm_state *));
/* ---------------- Metafile elements ---------------- */
typedef struct cgm_metafile_elements_s {
- cgm_int metafile_version;
- cgm_string metafile_description;
- cgm_vdc_type vdc_type;
- int integer_precision;
- cgm_precision real_precision;
- int index_precision;
- int color_precision;
- int color_index_precision;
- cgm_int maximum_color_index;
- cgm_color color_value_extent[2];
- const int *metafile_element_list;
- int metafile_element_list_count;
- const cgm_string *font_list;
- int font_list_count;
- /* character_set_list */
- /* character_coding_announcer */
+ cgm_int metafile_version;
+ cgm_string metafile_description;
+ cgm_vdc_type vdc_type;
+ int integer_precision;
+ cgm_precision real_precision;
+ int index_precision;
+ int color_precision;
+ int color_index_precision;
+ cgm_int maximum_color_index;
+ cgm_color color_value_extent[2];
+ const int *metafile_element_list;
+ int metafile_element_list_count;
+ const cgm_string *font_list;
+ int font_list_count;
+ /* character_set_list */
+ /* character_coding_announcer */
} cgm_metafile_elements;
+
#define cgm_set_METAFILE_VERSION (1L<<0)
#define cgm_set_METAFILE_DESCRIPTION (1L<<1)
#define cgm_set_VDC_TYPE (1L<<2)
@@ -271,23 +277,23 @@ typedef struct cgm_metafile_elements_s {
#define cgm_set_CHARACTER_CODING_ANNOUNCER (1L<<13)
cgm_result
- cgm_BEGIN_METAFILE(P3(cgm_state *, const char *, uint)),
- cgm_set_metafile_elements(P3(cgm_state *,
- const cgm_metafile_elements *, long)),
- cgm_END_METAFILE(P1(cgm_state *));
+cgm_BEGIN_METAFILE(P3(cgm_state *, const char *, uint)), cgm_set_metafile_elements(P3(cgm_state *,
+ const cgm_metafile_elements *, long)),
+ cgm_END_METAFILE(P1(cgm_state *));
/* ---------------- Picture elements ---------------- */
typedef struct cgm_picture_elements_s {
- cgm_scaling_mode scaling_mode;
- cgm_real scale_factor;
- cgm_color_selection_mode color_selection_mode;
- cgm_line_width_specification_mode line_width_specification_mode;
- cgm_marker_size_specification_mode marker_size_specification_mode;
- cgm_edge_width_specification_mode edge_width_specification_mode;
- cgm_point vdc_extent[2];
- cgm_color background_color;
+ cgm_scaling_mode scaling_mode;
+ cgm_real scale_factor;
+ cgm_color_selection_mode color_selection_mode;
+ cgm_line_width_specification_mode line_width_specification_mode;
+ cgm_marker_size_specification_mode marker_size_specification_mode;
+ cgm_edge_width_specification_mode edge_width_specification_mode;
+ cgm_point vdc_extent[2];
+ cgm_color background_color;
} cgm_picture_elements;
+
#define cgm_set_SCALING_MODE (1L<<0)
#define cgm_set_COLOR_SELECTION_MODE (1L<<1)
#define cgm_set_LINE_WIDTH_SPECIFICATION_MODE (1L<<2)
@@ -297,107 +303,82 @@ typedef struct cgm_picture_elements_s {
#define cgm_set_BACKGROUND_COLOR (1L<<6)
cgm_result
- cgm_BEGIN_PICTURE(P3(cgm_state *, const char *, uint)),
- cgm_set_picture_elements(P3(cgm_state *,
- const cgm_picture_elements *, long)),
- cgm_BEGIN_PICTURE_BODY(P1(cgm_state *)),
- cgm_END_PICTURE(P1(cgm_state *));
+cgm_BEGIN_PICTURE(P3(cgm_state *, const char *, uint)), cgm_set_picture_elements(P3(cgm_state *,
+ const cgm_picture_elements *, long)),
+ cgm_BEGIN_PICTURE_BODY(P1(cgm_state *)), cgm_END_PICTURE(P1(cgm_state *));
/* ---------------- Control elements ---------------- */
cgm_result
- cgm_VDC_INTEGER_PRECISION(P2(cgm_state *, int)),
- cgm_VDC_REAL_PRECISION(P2(cgm_state *, const cgm_precision *)),
- cgm_AUXILIARY_COLOR(P2(cgm_state *, const cgm_color *)),
- cgm_TRANSPARENCY(P2(cgm_state *, cgm_transparency)),
- cgm_CLIP_RECTANGLE(P2(cgm_state *, const cgm_point [2])),
- cgm_CLIP_INDICATOR(P2(cgm_state *, cgm_clip_indicator));
+cgm_VDC_INTEGER_PRECISION(P2(cgm_state *, int)), cgm_VDC_REAL_PRECISION(P2(cgm_state *, const cgm_precision *)),
+ cgm_AUXILIARY_COLOR(P2(cgm_state *, const cgm_color *)), cgm_TRANSPARENCY(P2(cgm_state *, cgm_transparency)),
+ cgm_CLIP_RECTANGLE(P2(cgm_state *, const cgm_point[2])), cgm_CLIP_INDICATOR(P2(cgm_state *, cgm_clip_indicator));
/* ---------------- Graphical primitive elements ---------------- */
cgm_result
- cgm_POLYLINE(P3(cgm_state *, const cgm_point *, int)),
- cgm_DISJOINT_POLYLINE(P3(cgm_state *, const cgm_point *, int)),
- cgm_POLYMARKER(P3(cgm_state *, const cgm_point *, int)),
- cgm_TEXT(P5(cgm_state *, const cgm_point *, bool, const char *, uint)),
- cgm_RESTRICTED_TEXT(P7(cgm_state *, const cgm_vdc *, const cgm_vdc *,
- const cgm_point *, bool, const char *, uint)),
- cgm_APPEND_TEXT(P4(cgm_state *, bool, const char *, uint)),
- cgm_POLYGON(P3(cgm_state *, const cgm_point *, int)),
- cgm_POLYGON_SET(P3(cgm_state *, const cgm_polygon_edge *, int)),
- cgm_CELL_ARRAY(P9(cgm_state *, const cgm_point * /*[3]*/, cgm_int,
- cgm_int, cgm_int, cgm_cell_representation_mode,
- const byte *, uint, uint)),
- cgm_RECTANGLE(P3(cgm_state *, const cgm_point *, const cgm_point *)),
- cgm_CIRCLE(P3(cgm_state *, const cgm_point *, const cgm_vdc *)),
- cgm_CIRCULAR_ARC_3_POINT(P4(cgm_state *, const cgm_point *,
- const cgm_point *, const cgm_point *)),
- cgm_CIRCULAR_ARC_3_POINT_CLOSE(P5(cgm_state *, const cgm_point *,
- const cgm_point *,
- const cgm_point *, cgm_arc_closure)),
- cgm_CIRCULAR_ARC_CENTER(P7(cgm_state *, const cgm_point *,
- const cgm_vdc *, const cgm_vdc *,
- const cgm_vdc *, const cgm_vdc *,
- const cgm_vdc *)),
- cgm_CIRCULAR_ARC_CENTER_CLOSE(P8(cgm_state *, const cgm_point *,
- const cgm_vdc *, const cgm_vdc *,
- const cgm_vdc *, const cgm_vdc *,
+cgm_POLYLINE(P3(cgm_state *, const cgm_point *, int)), cgm_DISJOINT_POLYLINE(P3(cgm_state *, const cgm_point *, int)),
+ cgm_POLYMARKER(P3(cgm_state *, const cgm_point *, int)), cgm_TEXT(P5(cgm_state *, const cgm_point *, bool, const char *, uint)),
+ cgm_RESTRICTED_TEXT(P7(cgm_state *, const cgm_vdc *, const cgm_vdc *,
+ const cgm_point *, bool, const char *, uint)),
+ cgm_APPEND_TEXT(P4(cgm_state *, bool, const char *, uint)), cgm_POLYGON(P3(cgm_state *, const cgm_point *, int)),
+ cgm_POLYGON_SET(P3(cgm_state *, const cgm_polygon_edge *, int)), cgm_CELL_ARRAY(P9(cgm_state *, const cgm_point * /*[3] */ , cgm_int,
+ cgm_int, cgm_int, cgm_cell_representation_mode,
+ const byte *, uint, uint)),
+ cgm_RECTANGLE(P3(cgm_state *, const cgm_point *, const cgm_point *)),
+ cgm_CIRCLE(P3(cgm_state *, const cgm_point *, const cgm_vdc *)),
+ cgm_CIRCULAR_ARC_3_POINT(P4(cgm_state *, const cgm_point *,
+ const cgm_point *, const cgm_point *)),
+ cgm_CIRCULAR_ARC_3_POINT_CLOSE(P5(cgm_state *, const cgm_point *,
+ const cgm_point *,
+ const cgm_point *, cgm_arc_closure)),
+ cgm_CIRCULAR_ARC_CENTER(P7(cgm_state *, const cgm_point *,
+ const cgm_vdc *, const cgm_vdc *,
+ const cgm_vdc *, const cgm_vdc *,
+ const cgm_vdc *)), cgm_CIRCULAR_ARC_CENTER_CLOSE(P8(cgm_state *, const cgm_point *,
+ const cgm_vdc *, const cgm_vdc *,
+ const cgm_vdc *, const cgm_vdc *,
const cgm_vdc *, cgm_arc_closure)),
- cgm_ELLIPSE(P4(cgm_state *, const cgm_point *, const cgm_point *,
- const cgm_point *)),
- cgm_ELLIPTICAL_ARC(P8(cgm_state *, const cgm_point *,
- const cgm_point *, const cgm_point *,
- const cgm_vdc *, const cgm_vdc *,
- const cgm_vdc *, const cgm_vdc *)),
- cgm_ELLIPTICAL_ARC_CLOSE(P9(cgm_state *, const cgm_point *,
- const cgm_point *, const cgm_point *,
- const cgm_vdc *, const cgm_vdc *,
- const cgm_vdc *, const cgm_vdc *,
- cgm_arc_closure));
+ cgm_ELLIPSE(P4(cgm_state *, const cgm_point *, const cgm_point *,
+ const cgm_point *)), cgm_ELLIPTICAL_ARC(P8(cgm_state *, const cgm_point *,
+ const cgm_point *, const cgm_point *,
+ const cgm_vdc *, const cgm_vdc *,
+ const cgm_vdc *, const cgm_vdc *)),
+ cgm_ELLIPTICAL_ARC_CLOSE(P9(cgm_state *, const cgm_point *,
+ const cgm_point *, const cgm_point *,
+ const cgm_vdc *, const cgm_vdc *,
+ const cgm_vdc *, const cgm_vdc *,
+ cgm_arc_closure));
/* ---------------- Attribute elements ---------------- */
cgm_result
- cgm_LINE_BUNDLE_INDEX(P2(cgm_state *, cgm_int)),
- cgm_LINE_TYPE(P2(cgm_state *, cgm_line_type)),
- cgm_LINE_WIDTH(P2(cgm_state *, const cgm_line_width *)),
- cgm_LINE_COLOR(P2(cgm_state *, const cgm_color *)),
- cgm_MARKER_BUNDLE_INDEX(P2(cgm_state *, cgm_int)),
- cgm_MARKER_TYPE(P2(cgm_state *, cgm_marker_type)),
- cgm_MARKER_SIZE(P2(cgm_state *, const cgm_marker_size *)),
- cgm_MARKER_COLOR(P2(cgm_state *, const cgm_color *)),
- cgm_TEXT_BUNDLE_INDEX(P2(cgm_state *, cgm_int)),
- cgm_TEXT_FONT_INDEX(P2(cgm_state *, cgm_int)),
- cgm_TEXT_PRECISION(P2(cgm_state *, cgm_text_precision)),
- cgm_CHARACTER_EXPANSION_FACTOR(P2(cgm_state *, cgm_real)),
- cgm_CHARACTER_SPACING(P2(cgm_state *, cgm_real)),
- cgm_TEXT_COLOR(P2(cgm_state *, const cgm_color *)),
- cgm_CHARACTER_HEIGHT(P2(cgm_state *, const cgm_vdc *)),
- cgm_CHARACTER_ORIENTATION(P5(cgm_state *, const cgm_vdc *,
- const cgm_vdc *, const cgm_vdc *,
- const cgm_vdc *)),
- cgm_TEXT_PATH(P2(cgm_state *, cgm_text_path)),
- cgm_TEXT_ALIGNMENT(P5(cgm_state *, cgm_text_alignment_horizontal,
- cgm_text_alignment_vertical,
- cgm_real, cgm_real)),
- cgm_CHARACTER_SET_INDEX(P2(cgm_state *, cgm_int)),
- /* The following should be cgm_ALTERNATE_..., but the VAX DEC C */
+cgm_LINE_BUNDLE_INDEX(P2(cgm_state *, cgm_int)),
+cgm_LINE_TYPE(P2(cgm_state *, cgm_line_type)),
+cgm_LINE_WIDTH(P2(cgm_state *, const cgm_line_width *)), cgm_LINE_COLOR(P2(cgm_state *, const cgm_color *)),
+ cgm_MARKER_BUNDLE_INDEX(P2(cgm_state *, cgm_int)), cgm_MARKER_TYPE(P2(cgm_state *, cgm_marker_type)),
+ cgm_MARKER_SIZE(P2(cgm_state *, const cgm_marker_size *)), cgm_MARKER_COLOR(P2(cgm_state *, const cgm_color *)),
+ cgm_TEXT_BUNDLE_INDEX(P2(cgm_state *, cgm_int)), cgm_TEXT_FONT_INDEX(P2(cgm_state *, cgm_int)),
+ cgm_TEXT_PRECISION(P2(cgm_state *, cgm_text_precision)), cgm_CHARACTER_EXPANSION_FACTOR(P2(cgm_state *, cgm_real)),
+ cgm_CHARACTER_SPACING(P2(cgm_state *, cgm_real)), cgm_TEXT_COLOR(P2(cgm_state *, const cgm_color *)),
+ cgm_CHARACTER_HEIGHT(P2(cgm_state *, const cgm_vdc *)), cgm_CHARACTER_ORIENTATION(P5(cgm_state *, const cgm_vdc *,
+ const cgm_vdc *, const cgm_vdc *,
+ const cgm_vdc *)),
+ cgm_TEXT_PATH(P2(cgm_state *, cgm_text_path)), cgm_TEXT_ALIGNMENT(P5(cgm_state *, cgm_text_alignment_horizontal,
+ cgm_text_alignment_vertical,
+ cgm_real, cgm_real)),
+ cgm_CHARACTER_SET_INDEX(P2(cgm_state *, cgm_int)), /* The following should be cgm_ALTERNATE_..., but the VAX DEC C */
/* compiler gives an error for names longer than 31 characters. */
- cgm_ALT_CHARACTER_SET_INDEX(P2(cgm_state *, cgm_int)),
- cgm_FILL_BUNDLE_INDEX(P2(cgm_state *, cgm_int)),
- cgm_INTERIOR_STYLE(P2(cgm_state *, cgm_interior_style)),
- cgm_FILL_COLOR(P2(cgm_state *, const cgm_color *)),
- cgm_HATCH_INDEX(P2(cgm_state *, cgm_hatch_index)),
- cgm_PATTERN_INDEX(P2(cgm_state *, cgm_int)),
- cgm_EDGE_BUNDLE_INDEX(P2(cgm_state *, cgm_int)),
- cgm_EDGE_TYPE(P2(cgm_state *, cgm_edge_type)),
- cgm_EDGE_WIDTH(P2(cgm_state *, const cgm_edge_width *)),
- cgm_EDGE_COLOR(P2(cgm_state *, const cgm_color *)),
- cgm_EDGE_VISIBILITY(P2(cgm_state *, bool)),
- cgm_FILL_REFERENCE_POINT(P2(cgm_state *, const cgm_point *)),
+ cgm_ALT_CHARACTER_SET_INDEX(P2(cgm_state *, cgm_int)), cgm_FILL_BUNDLE_INDEX(P2(cgm_state *, cgm_int)),
+ cgm_INTERIOR_STYLE(P2(cgm_state *, cgm_interior_style)), cgm_FILL_COLOR(P2(cgm_state *, const cgm_color *)),
+ cgm_HATCH_INDEX(P2(cgm_state *, cgm_hatch_index)), cgm_PATTERN_INDEX(P2(cgm_state *, cgm_int)),
+ cgm_EDGE_BUNDLE_INDEX(P2(cgm_state *, cgm_int)), cgm_EDGE_TYPE(P2(cgm_state *, cgm_edge_type)),
+ cgm_EDGE_WIDTH(P2(cgm_state *, const cgm_edge_width *)), cgm_EDGE_COLOR(P2(cgm_state *, const cgm_color *)),
+ cgm_EDGE_VISIBILITY(P2(cgm_state *, bool)), cgm_FILL_REFERENCE_POINT(P2(cgm_state *, const cgm_point *)),
/* PATTERN_TABLE */
- cgm_PATTERN_SIZE(P5(cgm_state *, const cgm_vdc *, const cgm_vdc *,
- const cgm_vdc *, const cgm_vdc *)),
- cgm_COLOR_TABLE(P4(cgm_state *, cgm_int, const cgm_color *, int)),
- cgm_ASPECT_SOURCE_FLAGS(P3(cgm_state *,
- const cgm_aspect_source_flag *, int));
+ cgm_PATTERN_SIZE(P5(cgm_state *, const cgm_vdc *, const cgm_vdc *,
+ const cgm_vdc *, const cgm_vdc *)), cgm_COLOR_TABLE(P4(cgm_state *, cgm_int, const cgm_color *, int)),
+ cgm_ASPECT_SOURCE_FLAGS(P3(cgm_state *,
+ const cgm_aspect_source_flag *, int));
+
+#endif /* gdevcgml_INCLUDED */
diff --git a/gs/src/gdevcgmx.h b/gs/src/gdevcgmx.h
index d9d6e7fbb..09cd9a2fe 100644
--- a/gs/src/gdevcgmx.h
+++ b/gs/src/gdevcgmx.h
@@ -1,182 +1,188 @@
/* Copyright (C) 1995 Aladdin Enterprises. All rights reserved.
-
- This file is part of Aladdin Ghostscript.
-
- Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
- or distributor accepts any responsibility for the consequences of using it,
- or for whether it serves any particular purpose or works at all, unless he
- or she says so in writing. Refer to the Aladdin Ghostscript Free Public
- License (the "License") for full details.
-
- Every copy of Aladdin Ghostscript must include a copy of the License,
- normally in a plain ASCII text file named PUBLIC. The License grants you
- the right to copy, modify and redistribute Aladdin Ghostscript, but only
- under certain conditions described in the License. Among other things, the
- License requires that the copyright notice and this notice be preserved on
- all copies.
-*/
-/* gdevcgmx.h */
+ This file is part of Aladdin Ghostscript.
+
+ Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
+ or distributor accepts any responsibility for the consequences of using it,
+ or for whether it serves any particular purpose or works at all, unless he
+ or she says so in writing. Refer to the Aladdin Ghostscript Free Public
+ License (the "License") for full details.
+
+ Every copy of Aladdin Ghostscript must include a copy of the License,
+ normally in a plain ASCII text file named PUBLIC. The License grants you
+ the right to copy, modify and redistribute Aladdin Ghostscript, but only
+ under certain conditions described in the License. Among other things, the
+ License requires that the copyright notice and this notice be preserved on
+ all copies.
+ */
+
+/*Id: gdevcgmx.h */
/* Internal definitions for CGM-writing library */
+
+#ifndef gdevcgmx_INCLUDED
+# define gdevcgmx_INCLUDED
+
#include "gdevcgml.h"
/* Define the internal representations of the CGM opcodes. */
#define cgm_op_class_shift 7
#define cgm_op_id_shift 5
typedef enum {
- /* Class 0 */
- BEGIN_METAFILE = (0 << cgm_op_class_shift) + 1,
- END_METAFILE,
- BEGIN_PICTURE,
- BEGIN_PICTURE_BODY,
- END_PICTURE,
- /* Class 1 */
- METAFILE_VERSION = (1 << cgm_op_class_shift) + 1,
- METAFILE_DESCRIPTION,
- VDC_TYPE,
- INTEGER_PRECISION,
- REAL_PRECISION,
- INDEX_PRECISION,
- COLOR_PRECISION,
- COLOR_INDEX_PRECISION,
- MAXIMUM_COLOR_INDEX,
- COLOR_VALUE_EXTENT,
- METAFILE_ELEMENT_LIST,
- METAFILE_DEFAULTS_REPLACEMENT,
- FONT_LIST,
- CHARACTER_SET_LIST,
- CHARACTER_CODING_ANNOUNCER,
- /* Class 2 */
- SCALING_MODE = (2 << cgm_op_class_shift) + 1,
- COLOR_SELECTION_MODE,
- LINE_WIDTH_SPECIFICATION_MODE,
- MARKER_SIZE_SPECIFICATION_MODE,
- EDGE_WIDTH_SPECIFICATION_MODE,
- VDC_EXTENT,
- BACKGROUND_COLOR,
- /* Class 3 */
- VDC_INTEGER_PRECISION = (3 << cgm_op_class_shift) + 1,
- VDC_REAL_PRECISION,
- AUXILIARY_COLOR,
- TRANSPARENCY,
- CLIP_RECTANGLE,
- CLIP_INDICATOR,
- /* Class 4 */
- POLYLINE = (4 << cgm_op_class_shift) + 1,
- DISJOINT_POLYLINE,
- POLYMARKER,
- TEXT,
- RESTRICTED_TEXT,
- APPEND_TEXT,
- POLYGON,
- POLYGON_SET,
- CELL_ARRAY,
- GENERALIZED_DRAWING_PRIMITIVE,
- RECTANGLE,
- CIRCLE,
- CIRCULAR_ARC_3_POINT,
- CIRCULAR_ARC_3_POINT_CLOSE,
- CIRCULAR_ARC_CENTER,
- CIRCULAR_ARC_CENTER_CLOSE,
- ELLIPSE,
- ELLIPTICAL_ARC,
- ELLIPTICAL_ARC_CLOSE,
- /* Class 5 */
- LINE_BUNDLE_INDEX = (5 << cgm_op_class_shift) + 1,
- LINE_TYPE,
- LINE_WIDTH,
- LINE_COLOR,
- MARKER_BUNDLE_INDEX,
- MARKER_TYPE,
- MARKER_SIZE,
- MARKER_COLOR,
- TEXT_BUNDLE_INDEX,
- TEXT_FONT_INDEX,
- TEXT_PRECISION,
- CHARACTER_EXPANSION_FACTOR,
- CHARACTER_SPACING,
- TEXT_COLOR,
- CHARACTER_HEIGHT,
- CHARACTER_ORIENTATION,
- TEXT_PATH,
- TEXT_ALIGNMENT,
- CHARACTER_SET_INDEX,
- ALTERNATE_CHARACTER_SET_INDEX,
- FILL_BUNDLE_INDEX,
- INTERIOR_STYLE,
- FILL_COLOR,
- HATCH_INDEX,
- PATTERN_INDEX,
- EDGE_BUNDLE_INDEX,
- EDGE_TYPE,
- EDGE_WIDTH,
- EDGE_COLOR,
- EDGE_VISIBILITY,
- FILL_REFERENCE_POINT,
- PATTERN_TABLE,
- PATTERN_SIZE,
- COLOR_TABLE,
- ASPECT_SOURCE_FLAGS,
- /* Class 6 */
- ESCAPE = (6 << cgm_op_class_shift) + 1,
- /* Class 7 */
- MESSAGE = (7 << cgm_op_class_shift) + 1,
- APPLICATION_DATA
+ /* Class 0 */
+ BEGIN_METAFILE = (0 << cgm_op_class_shift) + 1,
+ END_METAFILE,
+ BEGIN_PICTURE,
+ BEGIN_PICTURE_BODY,
+ END_PICTURE,
+ /* Class 1 */
+ METAFILE_VERSION = (1 << cgm_op_class_shift) + 1,
+ METAFILE_DESCRIPTION,
+ VDC_TYPE,
+ INTEGER_PRECISION,
+ REAL_PRECISION,
+ INDEX_PRECISION,
+ COLOR_PRECISION,
+ COLOR_INDEX_PRECISION,
+ MAXIMUM_COLOR_INDEX,
+ COLOR_VALUE_EXTENT,
+ METAFILE_ELEMENT_LIST,
+ METAFILE_DEFAULTS_REPLACEMENT,
+ FONT_LIST,
+ CHARACTER_SET_LIST,
+ CHARACTER_CODING_ANNOUNCER,
+ /* Class 2 */
+ SCALING_MODE = (2 << cgm_op_class_shift) + 1,
+ COLOR_SELECTION_MODE,
+ LINE_WIDTH_SPECIFICATION_MODE,
+ MARKER_SIZE_SPECIFICATION_MODE,
+ EDGE_WIDTH_SPECIFICATION_MODE,
+ VDC_EXTENT,
+ BACKGROUND_COLOR,
+ /* Class 3 */
+ VDC_INTEGER_PRECISION = (3 << cgm_op_class_shift) + 1,
+ VDC_REAL_PRECISION,
+ AUXILIARY_COLOR,
+ TRANSPARENCY,
+ CLIP_RECTANGLE,
+ CLIP_INDICATOR,
+ /* Class 4 */
+ POLYLINE = (4 << cgm_op_class_shift) + 1,
+ DISJOINT_POLYLINE,
+ POLYMARKER,
+ TEXT,
+ RESTRICTED_TEXT,
+ APPEND_TEXT,
+ POLYGON,
+ POLYGON_SET,
+ CELL_ARRAY,
+ GENERALIZED_DRAWING_PRIMITIVE,
+ RECTANGLE,
+ CIRCLE,
+ CIRCULAR_ARC_3_POINT,
+ CIRCULAR_ARC_3_POINT_CLOSE,
+ CIRCULAR_ARC_CENTER,
+ CIRCULAR_ARC_CENTER_CLOSE,
+ ELLIPSE,
+ ELLIPTICAL_ARC,
+ ELLIPTICAL_ARC_CLOSE,
+ /* Class 5 */
+ LINE_BUNDLE_INDEX = (5 << cgm_op_class_shift) + 1,
+ LINE_TYPE,
+ LINE_WIDTH,
+ LINE_COLOR,
+ MARKER_BUNDLE_INDEX,
+ MARKER_TYPE,
+ MARKER_SIZE,
+ MARKER_COLOR,
+ TEXT_BUNDLE_INDEX,
+ TEXT_FONT_INDEX,
+ TEXT_PRECISION,
+ CHARACTER_EXPANSION_FACTOR,
+ CHARACTER_SPACING,
+ TEXT_COLOR,
+ CHARACTER_HEIGHT,
+ CHARACTER_ORIENTATION,
+ TEXT_PATH,
+ TEXT_ALIGNMENT,
+ CHARACTER_SET_INDEX,
+ ALTERNATE_CHARACTER_SET_INDEX,
+ FILL_BUNDLE_INDEX,
+ INTERIOR_STYLE,
+ FILL_COLOR,
+ HATCH_INDEX,
+ PATTERN_INDEX,
+ EDGE_BUNDLE_INDEX,
+ EDGE_TYPE,
+ EDGE_WIDTH,
+ EDGE_COLOR,
+ EDGE_VISIBILITY,
+ FILL_REFERENCE_POINT,
+ PATTERN_TABLE,
+ PATTERN_SIZE,
+ COLOR_TABLE,
+ ASPECT_SOURCE_FLAGS,
+ /* Class 6 */
+ ESCAPE = (6 << cgm_op_class_shift) + 1,
+ /* Class 7 */
+ MESSAGE = (7 << cgm_op_class_shift) + 1,
+ APPLICATION_DATA
} cgm_op_index;
/* Define the state of the CGM writer. */
-/*typedef struct cgm_state_s cgm_state;*/ /* in gdevcgml.h */
+ /*typedef struct cgm_state_s cgm_state; *//* in gdevcgml.h */
struct cgm_state_s {
- /* The following are set at initialization time. */
- FILE *file;
- cgm_allocator allocator;
- /* The following are set by specific calls. */
- cgm_metafile_elements metafile;
- cgm_picture_elements picture;
- int vdc_integer_precision;
- cgm_precision vdc_real_precision;
- cgm_color auxiliary_color;
- cgm_transparency transparency;
- cgm_point clip_rectangle[2];
- cgm_clip_indicator clip_indicator;
- int line_bundle_index;
- cgm_line_type line_type;
- cgm_line_width line_width;
- cgm_color line_color;
- int marker_bundle_index;
- cgm_marker_type marker_type;
- cgm_marker_size marker_size;
- cgm_color marker_color;
- int text_bundle_index;
- int text_font_index;
- cgm_text_precision text_precision;
- cgm_real character_expansion_factor;
- cgm_real character_spacing;
- cgm_color text_color;
- cgm_vdc character_height;
- cgm_vdc character_orientation[4];
- cgm_text_path text_path;
- /****** text_alignment ******/
- int character_set_index;
- int alternate_character_set_index;
- int fill_bundle_index;
- cgm_interior_style interior_style;
- cgm_color fill_color;
- cgm_hatch_index hatch_index;
- int pattern_index;
- int edge_bundle_index;
- cgm_edge_type edge_type;
- cgm_edge_width edge_width;
- bool edge_visibility;
- cgm_point fill_reference_point;
- /****** pattern_table ******/
- cgm_vdc pattern_size[4];
- /****** color_table ******/
- byte /*cgm_aspect_source*/ source_flags[18];
- /* The following change dynamically. */
-#define command_max_count 400 /* (must be even) */
- byte command[command_max_count];
- int command_count;
- bool command_first;
- cgm_result result;
+ /* The following are set at initialization time. */
+ FILE *file;
+ cgm_allocator allocator;
+ /* The following are set by specific calls. */
+ cgm_metafile_elements metafile;
+ cgm_picture_elements picture;
+ int vdc_integer_precision;
+ cgm_precision vdc_real_precision;
+ cgm_color auxiliary_color;
+ cgm_transparency transparency;
+ cgm_point clip_rectangle[2];
+ cgm_clip_indicator clip_indicator;
+ int line_bundle_index;
+ cgm_line_type line_type;
+ cgm_line_width line_width;
+ cgm_color line_color;
+ int marker_bundle_index;
+ cgm_marker_type marker_type;
+ cgm_marker_size marker_size;
+ cgm_color marker_color;
+ int text_bundle_index;
+ int text_font_index;
+ cgm_text_precision text_precision;
+ cgm_real character_expansion_factor;
+ cgm_real character_spacing;
+ cgm_color text_color;
+ cgm_vdc character_height;
+ cgm_vdc character_orientation[4];
+ cgm_text_path text_path;
+/****** text_alignment ******/
+ int character_set_index;
+ int alternate_character_set_index;
+ int fill_bundle_index;
+ cgm_interior_style interior_style;
+ cgm_color fill_color;
+ cgm_hatch_index hatch_index;
+ int pattern_index;
+ int edge_bundle_index;
+ cgm_edge_type edge_type;
+ cgm_edge_width edge_width;
+ bool edge_visibility;
+ cgm_point fill_reference_point;
+/****** pattern_table ******/
+ cgm_vdc pattern_size[4];
+/****** color_table ******/
+ byte /*cgm_aspect_source */ source_flags[18];
+ /* The following change dynamically. */
+#define command_max_count 400 /* (must be even) */
+ byte command[command_max_count];
+ int command_count;
+ bool command_first;
+ cgm_result result;
};
+
+#endif /* gdevcgmx_INCLUDED */
diff --git a/gs/src/gdevcif.c b/gs/src/gdevcif.c
index 82e0f5af5..7d69b5a70 100644
--- a/gs/src/gdevcif.c
+++ b/gs/src/gdevcif.c
@@ -1,22 +1,22 @@
/* Copyright (C) 1993 Aladdin Enterprises. All rights reserved.
+
+ This file is part of Aladdin Ghostscript.
+
+ Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
+ or distributor accepts any responsibility for the consequences of using it,
+ or for whether it serves any particular purpose or works at all, unless he
+ or she says so in writing. Refer to the Aladdin Ghostscript Free Public
+ License (the "License") for full details.
+
+ Every copy of Aladdin Ghostscript must include a copy of the License,
+ normally in a plain ASCII text file named PUBLIC. The License grants you
+ the right to copy, modify and redistribute Aladdin Ghostscript, but only
+ under certain conditions described in the License. Among other things, the
+ License requires that the copyright notice and this notice be preserved on
+ all copies.
+*/
- This file is part of Aladdin Ghostscript.
-
- Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
- or distributor accepts any responsibility for the consequences of using it,
- or for whether it serves any particular purpose or works at all, unless he
- or she says so in writing. Refer to the Aladdin Ghostscript Free Public
- License (the "License") for full details.
-
- Every copy of Aladdin Ghostscript must include a copy of the License,
- normally in a plain ASCII text file named PUBLIC. The License grants you
- the right to copy, modify and redistribute Aladdin Ghostscript, but only
- under certain conditions described in the License. Among other things, the
- License requires that the copyright notice and this notice be preserved on
- all copies.
- */
-
-/* gdevcif.c */
+/*Id: gdevcif.c */
/* The `Fake bitmapped device to estimate rendering time'
slightly modified to produce CIF files from PostScript.
So anyone can put a nice logo free on its chip!
@@ -35,66 +35,64 @@
/* The device descriptor */
private dev_proc_print_page(cif_print_page);
gx_device_printer far_data gs_cif_device =
-prn_device(prn_std_procs, "cif",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- X_DPI, Y_DPI,
- 0, 0, 0, 0,
- 1, cif_print_page);
+ prn_device(prn_std_procs, "cif",
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ X_DPI, Y_DPI,
+ 0,0,0,0,
+ 1, cif_print_page);
/* Send the page to the output. */
private int
-cif_print_page(gx_device_printer * pdev, FILE * prn_stream)
-{
- int line_size = gdev_mem_bytes_per_scan_line((gx_device *) pdev);
- int lnum;
- byte *in = (byte *) gs_malloc(line_size, 1, "cif_print_page(in)");
- char *s;
- int scanline, scanbyte;
- int length, start; /* length is the number of successive 1 bits, */
-
- /* start is the set of 1 bit start position */
+cif_print_page(gx_device_printer *pdev, FILE *prn_stream)
+{ int line_size = gdev_mem_bytes_per_scan_line((gx_device *)pdev);
+ int lnum;
+ byte *in = (byte *)gs_malloc(line_size, 1, "cif_print_page(in)");
+ char *s;
+ int scanline, scanbyte;
+ int length, start; /* length is the number of successive 1 bits, */
+ /* start is the set of 1 bit start position */
- if (in == 0)
- return_error(gs_error_VMerror);
+ if (in == 0)
+ return_error(gs_error_VMerror);
- if ((s = strchr(pdev->fname, '.')) == NULL)
- length = strlen(pdev->fname) + 1;
- else
- length = s - pdev->fname;
- s = (char *)gs_malloc(length, sizeof(char), "cif_print_page(s)");
+ if ((s = strchr(pdev->fname, '.')) == NULL)
+ length = strlen(pdev->fname) + 1;
+ else
+ length = s - pdev->fname;
+ s = (char *)gs_malloc(length, sizeof(char), "cif_print_page(s)");
- strncpy(s, pdev->fname, length);
- *(s + length) = '\0';
- fprintf(prn_stream, "DS1 25 1;\n9 %s;\nLCP;\n", s);
- gs_free(s, length, 1, "cif_print_page(s)");
+ strncpy(s, pdev->fname, length);
+ *(s + length) = '\0';
+ fprintf(prn_stream, "DS1 25 1;\n9 %s;\nLCP;\n", s);
+ gs_free(s, length, 1, "cif_print_page(s)");
- for (lnum = 0; lnum < pdev->height; lnum++) {
- gdev_prn_copy_scan_lines(pdev, lnum, in, line_size);
- length = 0;
- for (scanline = 0; scanline < line_size; scanline++)
+ for (lnum = 0; lnum < pdev->height; lnum++) {
+ gdev_prn_copy_scan_lines(pdev, lnum, in, line_size);
+ length = 0;
+ for (scanline = 0; scanline < line_size; scanline++)
#ifdef TILE /* original, simple, inefficient algorithm */
- for (scanbyte = 0; scanbyte < 8; scanbyte++)
- if (((in[scanline] >> scanbyte) & 1) != 0)
- fprintf(prn_stream, "B4 4 %d %d;\n",
- (scanline * 8 + (7 - scanbyte)) * 4,
- (pdev->height - lnum) * 4);
-#else /* better algorithm */
- for (scanbyte = 7; scanbyte >= 0; scanbyte--)
- /* cheap linear reduction of rectangles in lines */
- if (((in[scanline] >> scanbyte) & 1) != 0) {
- if (length == 0)
- start = (scanline * 8 + (7 - scanbyte));
- length++;
- } else {
- if (length != 0)
- fprintf(prn_stream, "B%d 4 %d %d;\n", length * 4,
- start * 4 + length * 2,
- (pdev->height - lnum) * 4);
- length = 0;
- }
+ for (scanbyte = 0; scanbyte < 8; scanbyte++)
+ if (((in[scanline] >> scanbyte) & 1) != 0)
+ fprintf(prn_stream, "B4 4 %d %d;\n",
+ (scanline * 8 + (7 - scanbyte)) * 4,
+ (pdev->height - lnum) * 4);
+#else /* better algorithm */
+ for (scanbyte = 7; scanbyte >= 0; scanbyte--)
+ /* cheap linear reduction of rectangles in lines */
+ if (((in[scanline] >> scanbyte) & 1) != 0) {
+ if (length == 0)
+ start = (scanline * 8 + (7 - scanbyte));
+ length++;
+ } else {
+ if (length != 0)
+ fprintf(prn_stream, "B%d 4 %d %d;\n", length * 4,
+ start * 4 + length * 2,
+ (pdev->height - lnum) * 4);
+ length = 0;
+ }
#endif
- }
- fprintf(prn_stream, "DF;\nC1;\nE\n");
- gs_free(in, line_size, 1, "cif_print_page(in)");
- return 0;
+ }
+ fprintf(prn_stream, "DF;\nC1;\nE\n");
+ gs_free(in, line_size, 1, "cif_print_page(in)");
+ return 0;
}
diff --git a/gs/src/gdevcmap.c b/gs/src/gdevcmap.c
index c0d34fb84..677e6a341 100644
--- a/gs/src/gdevcmap.c
+++ b/gs/src/gdevcmap.c
@@ -20,7 +20,7 @@
/* Special color mapping device */
#include "gx.h"
#include "gserrors.h"
-#include "gxiparam.h"
+#include "gxdevice.h"
#include "gxlum.h"
#include "gdevcmap.h"
@@ -57,8 +57,9 @@ private const gx_device_cmap gs_cmap_device =
0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0,
- 0, /* get_hardware_params (5.14) */
- cmap_begin_typed_image
+ cmap_begin_typed_image,
+ 0,
+ 0 /* map_color_rgb_alpha */
},
0, /* target */
device_cmap_identity
@@ -167,7 +168,7 @@ cmap_map_rgb_color(gx_device * dev, gx_color_value red,
rgb.green = green;
rgb.blue = blue;
cmap_convert_rgb_color(cmdev, &rgb);
- return target->std_procs.map_rgb_color(target, rgb.red, rgb.green, rgb.blue);
+ return target->procs.map_rgb_color(target, rgb.red, rgb.green, rgb.blue);
}
private gx_color_index
cmap_map_rgb_alpha_color(gx_device * dev, gx_color_value red,
@@ -182,8 +183,8 @@ cmap_map_rgb_alpha_color(gx_device * dev, gx_color_value red,
rgb.green = green;
rgb.blue = blue;
cmap_convert_rgb_color(cmdev, &rgb);
- return target->std_procs.map_rgb_alpha_color(target, rgb.red, rgb.green,
- rgb.blue, alpha);
+ return target->procs.map_rgb_alpha_color(target, rgb.red, rgb.green,
+ rgb.blue, alpha);
}
/*
diff --git a/gs/src/gdevcmap.h b/gs/src/gdevcmap.h
index 4c1915f13..cb5b06898 100644
--- a/gs/src/gdevcmap.h
+++ b/gs/src/gdevcmap.h
@@ -1,22 +1,22 @@
/* Copyright (C) 1998 Aladdin Enterprises. All rights reserved.
-
- This file is part of Aladdin Ghostscript.
-
- Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
- or distributor accepts any responsibility for the consequences of using it,
- or for whether it serves any particular purpose or works at all, unless he
- or she says so in writing. Refer to the Aladdin Ghostscript Free Public
- License (the "License") for full details.
-
- Every copy of Aladdin Ghostscript must include a copy of the License,
- normally in a plain ASCII text file named PUBLIC. The License grants you
- the right to copy, modify and redistribute Aladdin Ghostscript, but only
- under certain conditions described in the License. Among other things, the
- License requires that the copyright notice and this notice be preserved on
- all copies.
-*/
-
-/*Id: gdevcmap.h */
+
+ This file is part of Aladdin Ghostscript.
+
+ Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
+ or distributor accepts any responsibility for the consequences of using it,
+ or for whether it serves any particular purpose or works at all, unless he
+ or she says so in writing. Refer to the Aladdin Ghostscript Free Public
+ License (the "License") for full details.
+
+ Every copy of Aladdin Ghostscript must include a copy of the License,
+ normally in a plain ASCII text file named PUBLIC. The License grants you
+ the right to copy, modify and redistribute Aladdin Ghostscript, but only
+ under certain conditions described in the License. Among other things, the
+ License requires that the copyright notice and this notice be preserved on
+ all copies.
+ */
+
+/*Id: gdevcmap.h */
/* Interface to special color mapping device */
#ifndef gdevcmap_INCLUDED
@@ -42,6 +42,7 @@ typedef enum {
device_cmap_monochrome
} gx_device_color_mapping_method_t;
+
#define device_cmap_max_method device_cmap_monochrome
/* Define the color mapping forwarding device. */
@@ -49,6 +50,7 @@ typedef struct gx_device_cmap_s {
gx_device_forward_common;
gx_device_color_mapping_method_t mapping_method;
} gx_device_cmap;
+
extern_st(st_device_cmap);
#define public_st_device_cmap() /* in gdevcmap.c */\
gs_public_st_suffix_add0_final(st_device_cmap, gx_device_cmap,\
@@ -56,11 +58,11 @@ extern_st(st_device_cmap);
gx_device_finalize, st_device_forward)
/* Initialize a color mapping device. Do this just once after allocation. */
-int gdev_cmap_init(P3(gx_device_cmap *dev, gx_device *target,
+int gdev_cmap_init(P3(gx_device_cmap * dev, gx_device * target,
gx_device_color_mapping_method_t mapping_method));
/* Set the color mapping method. This may be called at any time. */
-int gdev_cmap_set_method(P2(gx_device_cmap *dev,
- gx_device_color_mapping_method_t mapping_method));
+int gdev_cmap_set_method(P2(gx_device_cmap * dev,
+ gx_device_color_mapping_method_t mapping_method));
-#endif /* gdevcmap_INCLUDED */
+#endif /* gdevcmap_INCLUDED */
diff --git a/gs/src/gdevcp50.c b/gs/src/gdevcp50.c
index 380da326f..60e62dcd5 100644
--- a/gs/src/gdevcp50.c
+++ b/gs/src/gdevcp50.c
@@ -1,22 +1,22 @@
/* Copyright (C) 1991, 1994, 1996 Aladdin Enterprises. All rights reserved.
-
- This file is part of Aladdin Ghostscript.
-
- Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
- or distributor accepts any responsibility for the consequences of using it,
- or for whether it serves any particular purpose or works at all, unless he
- or she says so in writing. Refer to the Aladdin Ghostscript Free Public
- License (the "License") for full details.
-
- Every copy of Aladdin Ghostscript must include a copy of the License,
- normally in a plain ASCII text file named PUBLIC. The License grants you
- the right to copy, modify and redistribute Aladdin Ghostscript, but only
- under certain conditions described in the License. Among other things, the
- License requires that the copyright notice and this notice be preserved on
- all copies.
- */
-
-/* gdevcp50.c */
+
+ This file is part of Aladdin Ghostscript.
+
+ Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
+ or distributor accepts any responsibility for the consequences of using it,
+ or for whether it serves any particular purpose or works at all, unless he
+ or she says so in writing. Refer to the Aladdin Ghostscript Free Public
+ License (the "License") for full details.
+
+ Every copy of Aladdin Ghostscript must include a copy of the License,
+ normally in a plain ASCII text file named PUBLIC. The License grants you
+ the right to copy, modify and redistribute Aladdin Ghostscript, but only
+ under certain conditions described in the License. Among other things, the
+ License requires that the copyright notice and this notice be preserved on
+ all copies.
+*/
+
+/*Id: gdevcp50.c */
/* Mitsubishi CP50 color printer driver */
#include "gdevprn.h"
#define ppdev ((gx_device_printer *)pdev)
@@ -40,7 +40,7 @@
#define FIRST_COLUMN 180
/* The value of X_DPI and Y_DPI is gained by experiment */
-#define X_DPI 154 /* pixels per inch */
+#define X_DPI 154 /* pixels per inch */
#define Y_DPI 187 /* pixels per inch */
/* The device descriptor */
@@ -51,16 +51,16 @@ private dev_proc_map_rgb_color(cp50_rgb_color);
private dev_proc_map_color_rgb(cp50_color_rgb);
private gx_device_procs cp50_procs =
-prn_color_procs(gdev_prn_open, cp50_output_page, gdev_prn_close,
- cp50_rgb_color, cp50_color_rgb);
+ prn_color_procs(gdev_prn_open, cp50_output_page, gdev_prn_close,
+ cp50_rgb_color, cp50_color_rgb);
gx_device_printer far_data gs_cp50_device =
-prn_device(cp50_procs, "cp50",
- 39, /* width_10ths, 100mm */
- 59, /* height_10ths,150mm */
- X_DPI, Y_DPI,
- 0.39, 0.91, 0.43, 0.75, /* margins */
- 24, cp50_print_page);
+ prn_device(cp50_procs, "cp50",
+ 39, /* width_10ths, 100mm */
+ 59, /* height_10ths,150mm */
+ X_DPI, Y_DPI,
+ 0.39, 0.91, 0.43, 0.75, /* margins */
+ 24, cp50_print_page);
int copies;
@@ -69,57 +69,58 @@ int copies;
/* Send the page to the printer. */
private int
-cp50_print_page(gx_device_printer * pdev, FILE * prn_stream)
-{
- int line_size = gdev_mem_bytes_per_scan_line((gx_device *) pdev);
- byte *out = (byte *) gs_malloc(line_size, 1, "cp50_print_page(out)");
- byte *r_plane = (byte *) gs_malloc(X_PIXEL * Y_PIXEL, 1, "cp50_print_page(r_plane)");
- byte *g_plane = (byte *) gs_malloc(X_PIXEL * Y_PIXEL, 1, "cp50_print_page(g_plane)");
- byte *b_plane = (byte *) gs_malloc(X_PIXEL * Y_PIXEL, 1, "cp50_print_page(b_plane)");
- byte *t_plane = (byte *) gs_malloc(X_PIXEL * Y_PIXEL, 1, "cp50_print_page(t_plane)");
- int lnum = FIRST_LINE;
- int last = LAST_LINE;
+cp50_print_page(gx_device_printer *pdev, FILE *prn_stream)
+{
+ int line_size = gdev_mem_bytes_per_scan_line((gx_device *)pdev);
+ byte *out = (byte *)gs_malloc(line_size, 1, "cp50_print_page(out)");
+ byte *r_plane = (byte *)gs_malloc(X_PIXEL*Y_PIXEL, 1, "cp50_print_page(r_plane)");
+ byte *g_plane = (byte *)gs_malloc(X_PIXEL*Y_PIXEL, 1, "cp50_print_page(g_plane)");
+ byte *b_plane = (byte *)gs_malloc(X_PIXEL*Y_PIXEL, 1, "cp50_print_page(b_plane)");
+ byte *t_plane = (byte *)gs_malloc(X_PIXEL*Y_PIXEL, 1, "cp50_print_page(t_plane)");
+ int lnum = FIRST_LINE;
+ int last = LAST_LINE;
int lines = X_PIXEL;
byte hi_lines, lo_lines;
byte num_copies;
- int i, j;
-
-
-/*fprintf(prn_stream, "%d,%d,%d,", pdev->width, pdev->height, line_size); */
-
- /* Check allocations */
- if (out == 0 || r_plane == 0 || g_plane == 0 || b_plane == 0 ||
- t_plane == 0) {
- if (out)
- gs_free((char *)out, line_size, 1,
- "cp50_print_page(out)");
- if (r_plane)
- gs_free((char *)r_plane, X_PIXEL * Y_PIXEL, 1,
- "cp50_print_page(r_plane)");
- if (g_plane)
- gs_free((char *)g_plane, X_PIXEL * Y_PIXEL, 1,
- "cp50_print_page(g_plane)");
- if (b_plane)
- gs_free((char *)b_plane, X_PIXEL * Y_PIXEL, 1,
- "cp50_print_page(b_plane)");
- if (t_plane)
- gs_free((char *)t_plane, X_PIXEL * Y_PIXEL, 1,
- "cp50_print_page(t_plane)");
- return -1;
- }
+ int i,j;
+
+
+/*fprintf(prn_stream, "%d,%d,%d,", pdev->width, pdev->height, line_size);*/
+
+ /* Check allocations */
+ if ( out == 0 || r_plane == 0 || g_plane == 0 || b_plane == 0 ||
+ t_plane == 0)
+ { if ( out )
+ gs_free((char *)out, line_size, 1,
+ "cp50_print_page(out)");
+ if (r_plane)
+ gs_free((char *)r_plane, X_PIXEL*Y_PIXEL, 1,
+ "cp50_print_page(r_plane)");
+ if (g_plane)
+ gs_free((char *)g_plane, X_PIXEL*Y_PIXEL, 1,
+ "cp50_print_page(g_plane)");
+ if (b_plane)
+ gs_free((char *)b_plane, X_PIXEL*Y_PIXEL, 1,
+ "cp50_print_page(b_plane)");
+ if (t_plane)
+ gs_free((char *)t_plane, X_PIXEL*Y_PIXEL, 1,
+ "cp50_print_page(t_plane)");
+ return -1;
+ }
+
/* set each plane as white */
- memset(r_plane, -1, X_PIXEL * Y_PIXEL);
- memset(g_plane, -1, X_PIXEL * Y_PIXEL);
- memset(b_plane, -1, X_PIXEL * Y_PIXEL);
- memset(t_plane, -1, X_PIXEL * Y_PIXEL);
+ memset(r_plane, -1, X_PIXEL*Y_PIXEL);
+ memset(g_plane, -1, X_PIXEL*Y_PIXEL);
+ memset(b_plane, -1, X_PIXEL*Y_PIXEL);
+ memset(t_plane, -1, X_PIXEL*Y_PIXEL);
- /* Initialize the printer *//* see programmer manual for CP50 */
- fprintf(prn_stream, "\033\101");
- fprintf(prn_stream, "\033\106\010\001");
- fprintf(prn_stream, "\033\106\010\003");
+ /* Initialize the printer */ /* see programmer manual for CP50 */
+ fprintf(prn_stream,"\033\101");
+ fprintf(prn_stream,"\033\106\010\001");
+ fprintf(prn_stream,"\033\106\010\003");
/* set number of copies */
- fprintf(prn_stream, "\033\116");
+ fprintf(prn_stream,"\033\116");
num_copies = copies & 0xFF;
fwrite(&num_copies, sizeof(char), 1, prn_stream);
@@ -127,103 +128,95 @@ cp50_print_page(gx_device_printer * pdev, FILE * prn_stream)
hi_lines = lines >> 8;
lo_lines = lines & 0xFF;
- fprintf(prn_stream, "\033\123\062");
+ fprintf(prn_stream,"\033\123\062");
fwrite(&hi_lines, sizeof(char), 1, prn_stream);
fwrite(&lo_lines, sizeof(char), 1, prn_stream);
-
- fprintf(prn_stream, "\001"); /* dummy */
-
- /* Print lines of graphics */
- while (lnum <= last) {
- int i, col;
-
- gdev_prn_copy_scan_lines(pdev, lnum, (byte *) out, line_size);
- /*fwrite(out, sizeof(char), line_size, prn_stream); */
- for (i = 0; i < X_PIXEL; i++) {
- col = (lnum - FIRST_LINE) * X_PIXEL + i;
- r_plane[col] = out[i * 3 + FIRST_COLUMN];
- g_plane[col] = out[i * 3 + 1 + FIRST_COLUMN];
- b_plane[col] = out[i * 3 + 2 + FIRST_COLUMN];
- }
- lnum++;
- }
+ fprintf(prn_stream,"\001"); /* dummy */
+
+ /* Print lines of graphics */
+ while ( lnum <= last )
+ {
+ int i, col;
+ gdev_prn_copy_scan_lines(pdev, lnum, (byte *)out, line_size);
+ /*fwrite(out, sizeof(char), line_size, prn_stream);*/
+ for(i=0; i<X_PIXEL; i++)
+ {
+ col = (lnum-FIRST_LINE) * X_PIXEL + i;
+ r_plane[col] = out[i*3+FIRST_COLUMN];
+ g_plane[col] = out[i*3+1+FIRST_COLUMN];
+ b_plane[col] = out[i*3+2+FIRST_COLUMN];
+ }
+ lnum ++;
+ }
/* rotate each plane and download it */
- for (i = 0; i < X_PIXEL; i++)
- for (j = Y_PIXEL - 1; j >= 0; j--)
- t_plane[(Y_PIXEL - 1 - j) + i * Y_PIXEL] = r_plane[i + j * X_PIXEL];
- fwrite(t_plane, sizeof(char), X_PIXEL * Y_PIXEL, prn_stream);
+ for(i=0;i<X_PIXEL;i++)
+ for(j=Y_PIXEL-1;j>=0;j--)
+ t_plane[(Y_PIXEL-1-j)+i*Y_PIXEL] = r_plane[i+j*X_PIXEL];
+ fwrite(t_plane, sizeof(char), X_PIXEL*Y_PIXEL, prn_stream);
- for (i = 0; i < X_PIXEL; i++)
- for (j = Y_PIXEL - 1; j >= 0; j--)
- t_plane[(Y_PIXEL - 1 - j) + i * Y_PIXEL] = g_plane[i + j * X_PIXEL];
- fwrite(t_plane, sizeof(char), X_PIXEL * Y_PIXEL, prn_stream);
+ for(i=0;i<X_PIXEL;i++)
+ for(j=Y_PIXEL-1;j>=0;j--)
+ t_plane[(Y_PIXEL-1-j)+i*Y_PIXEL] = g_plane[i+j*X_PIXEL];
+ fwrite(t_plane, sizeof(char), X_PIXEL*Y_PIXEL, prn_stream);
- for (i = 0; i < X_PIXEL; i++)
- for (j = Y_PIXEL - 1; j >= 0; j--)
- t_plane[(Y_PIXEL - 1 - j) + i * Y_PIXEL] = b_plane[i + j * X_PIXEL];
- fwrite(t_plane, sizeof(char), X_PIXEL * Y_PIXEL, prn_stream);
+ for(i=0;i<X_PIXEL;i++)
+ for(j=Y_PIXEL-1;j>=0;j--)
+ t_plane[(Y_PIXEL-1-j)+i*Y_PIXEL] = b_plane[i+j*X_PIXEL];
+ fwrite(t_plane, sizeof(char), X_PIXEL*Y_PIXEL, prn_stream);
- gs_free((char *)out, line_size, 1, "cp50_print_page(out)");
- gs_free((char *)r_plane, X_PIXEL * Y_PIXEL, 1, "cp50_print_page(r_plane)");
- gs_free((char *)g_plane, X_PIXEL * Y_PIXEL, 1, "cp50_print_page(g_plane)");
- gs_free((char *)b_plane, X_PIXEL * Y_PIXEL, 1, "cp50_print_page(b_plane)");
- gs_free((char *)t_plane, X_PIXEL * Y_PIXEL, 1, "cp50_print_page(t_plane)");
+ gs_free((char *)out, line_size, 1, "cp50_print_page(out)");
+ gs_free((char *)r_plane, X_PIXEL*Y_PIXEL, 1, "cp50_print_page(r_plane)");
+ gs_free((char *)g_plane, X_PIXEL*Y_PIXEL, 1, "cp50_print_page(g_plane)");
+ gs_free((char *)b_plane, X_PIXEL*Y_PIXEL, 1, "cp50_print_page(b_plane)");
+ gs_free((char *)t_plane, X_PIXEL*Y_PIXEL, 1, "cp50_print_page(t_plane)");
- return 0;
+ return 0;
}
-int private
-cp50_output_page(gx_device * pdev, int num_copies, int flush)
-{
- int code, outcode, closecode;
+int private
+cp50_output_page(gx_device *pdev, int num_copies, int flush)
+{ int code, outcode, closecode;
code = gdev_prn_open_printer(pdev, 1);
- if (code < 0)
- return code;
+ if ( code < 0 ) return code;
- copies = num_copies; /* using global variable to pass */
+ copies = num_copies; /* using global variable to pass */
/* Print the accumulated page description. */
- outcode = (*ppdev->printer_procs.print_page) (ppdev, ppdev->file);
- if (code < 0)
- return code;
+ outcode = (*ppdev->printer_procs.print_page)(ppdev, ppdev->file);
+ if ( code < 0 ) return code;
closecode = gdev_prn_close_printer(pdev);
- if (code < 0)
- return code;
+ if ( code < 0 ) return code;
- if (ppdev->buffer_space) /* reinitialize clist for writing */
- code = (*gs_clist_device_procs.output_page) (pdev, num_copies, flush);
-
- if (outcode < 0)
- return outcode;
- if (closecode < 0)
- return closecode;
+ if ( ppdev->buffer_space ) /* reinitialize clist for writing */
+ code = (*gs_clist_device_procs.output_page)(pdev, num_copies, flush);
+
+ if ( outcode < 0 ) return outcode;
+ if ( closecode < 0 ) return closecode;
return code;
}
/* 24-bit color mappers (taken from gdevmem2.c). */
/* Note that Windows expects RGB values in the order B,G,R. */
-
+
/* Map a r-g-b color to a color index. */
private gx_color_index
-cp50_rgb_color(gx_device * dev, gx_color_value r, gx_color_value g,
- gx_color_value b)
-{
- return ((ulong) gx_color_value_to_byte(r) << 16) +
- ((uint) gx_color_value_to_byte(g) << 8) +
- gx_color_value_to_byte(b);
+cp50_rgb_color(gx_device *dev, gx_color_value r, gx_color_value g,
+ gx_color_value b)
+{ return ((ulong)gx_color_value_to_byte(r) << 16)+
+ ((uint)gx_color_value_to_byte(g) << 8) +
+ gx_color_value_to_byte(b);
}
-
+
/* Map a color index to a r-g-b color. */
private int
-cp50_color_rgb(gx_device * dev, gx_color_index color,
- gx_color_value prgb[3])
-{
- prgb[2] = gx_color_value_from_byte(color & 0xff);
+cp50_color_rgb(gx_device *dev, gx_color_index color,
+ gx_color_value prgb[3])
+{ prgb[2] = gx_color_value_from_byte(color & 0xff);
prgb[1] = gx_color_value_from_byte((color >> 8) & 0xff);
prgb[0] = gx_color_value_from_byte(color >> 16);
return 0;
diff --git a/gs/src/gdevddrw.c b/gs/src/gdevddrw.c
index 350360f14..a6e07aebc 100644
--- a/gs/src/gdevddrw.c
+++ b/gs/src/gdevddrw.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1989, 1995, 1996 Aladdin Enterprises. All rights reserved.
+/* Copyright (C) 1989, 1995, 1996, 1997, 1998 Aladdin Enterprises. All rights reserved.
This file is part of Aladdin Ghostscript.
@@ -16,9 +16,10 @@
all copies.
*/
-/* gdevddrw.c */
+/*Id: gdevddrw.c */
/* Default polygon and image drawing device procedures */
#include "math_.h"
+#include "memory_.h"
#include "gx.h"
#include "gpcheck.h"
#include "gserrors.h"
@@ -26,6 +27,8 @@
#include "gxmatrix.h"
#include "gxdcolor.h"
#include "gxdevice.h"
+#include "gxiparam.h"
+#include "gxistate.h"
/* ---------------- Polygon and line drawing ---------------- */
@@ -435,13 +438,7 @@ gx_default_draw_thin_line(gx_device * dev,
gx_fill_rectangle_device_rop(ix, itoy, 1, iy - itoy + 1,
pdevc, dev, lop)
);
- }
- if (color_writes_pure(pdevc, lop) &&
- (*dev_proc(dev, draw_line)) (dev, ix, iy, itox, itoy,
- pdevc->colors.pure) >= 0
- )
- return 0;
- {
+ } {
fixed h = fy1 - fy0;
fixed w = fx1 - fx0;
fixed tf;
@@ -482,3 +479,138 @@ gx_default_draw_line(gx_device * dev,
{
return -1;
}
+
+/* ---------------- Image drawing ---------------- */
+
+/* GC structures for image enumerator */
+public_st_gx_image_enum_common();
+
+#define eptr ((gx_image_enum_common_t *)vptr)
+
+private
+ENUM_PTRS_BEGIN(image_enum_common_enum_ptrs) return 0;
+
+case 0:
+return ENUM_OBJ(gx_device_enum_ptr(eptr->dev));
+ENUM_PTRS_END
+
+private RELOC_PTRS_BEGIN(image_enum_common_reloc_ptrs)
+{
+ eptr->dev = gx_device_reloc_ptr(eptr->dev, gcst);
+}
+RELOC_PTRS_END
+
+#undef eptr
+
+/*
+ * gx_default_begin_image is only invoked for ImageType 1 images. However,
+ * the argument types are different, and if the device provides a
+ * begin_typed_image procedure, we should use it. See gxdevice.h.
+ */
+private int
+gx_no_begin_image(gx_device * dev,
+ const gs_imager_state * pis, const gs_image_t * pim,
+ gs_image_format_t format, const gs_int_rect * prect,
+ const gx_drawing_color * pdcolor, const gx_clip_path * pcpath,
+ gs_memory_t * memory, gx_image_enum_common_t ** pinfo)
+{
+ return -1;
+}
+int
+gx_default_begin_image(gx_device * dev,
+ const gs_imager_state * pis, const gs_image_t * pim,
+ gs_image_format_t format, const gs_int_rect * prect,
+ const gx_drawing_color * pdcolor, const gx_clip_path * pcpath,
+ gs_memory_t * memory, gx_image_enum_common_t ** pinfo)
+{
+ /*
+ * Hand off to begin_typed_image, being careful to avoid a
+ * possible recursion loop.
+ */
+ dev_proc_begin_image((*save_begin_image)) = dev_proc(dev, begin_image);
+ gs_image_t image;
+ const gs_image_t *ptim;
+ int code;
+
+ set_dev_proc(dev, begin_image, gx_no_begin_image);
+ if (pim->format == format)
+ ptim = pim;
+ else {
+ image = *pim;
+ image.format = format;
+ ptim = &image;
+ }
+ code = (*dev_proc(dev, begin_typed_image))
+ (dev, pis, NULL, (const gs_image_common_t *)ptim, prect, pdcolor,
+ pcpath, memory, pinfo);
+ set_dev_proc(dev, begin_image, save_begin_image);
+ return code;
+}
+
+int
+gx_default_begin_typed_image(gx_device * dev,
+ const gs_imager_state * pis, const gs_matrix * pmat,
+ const gs_image_common_t * pic, const gs_int_rect * prect,
+ const gx_drawing_color * pdcolor, const gx_clip_path * pcpath,
+ gs_memory_t * memory, gx_image_enum_common_t ** pinfo)
+{ /*
+ * If this is an ImageType 1 image using the imager's CTM,
+ * defer to begin_image.
+ */
+ if (pic->type->begin_typed_image == gx_begin_image1) {
+ const gs_image_t *pim = (const gs_image_t *)pic;
+
+ if (pmat == 0 ||
+ (pis != 0 && !memcmp(pmat, &ctm_only(pis), sizeof(*pmat)))
+ ) {
+ int code = (*dev_proc(dev, begin_image))
+ (dev, pis, pim, pim->format, prect, pdcolor,
+ pcpath, memory, pinfo);
+
+ if (code >= 0)
+ return code;
+ }
+ }
+ return (*pic->type->begin_typed_image)
+ (dev, pis, pmat, pic, prect, pdcolor, pcpath, memory, pinfo);
+}
+
+int
+gx_device_image_data(gx_device * dev,
+ gx_image_enum_common_t * info, const byte ** plane_data, int data_x,
+ uint raster, int height)
+{
+ int num_planes = info->num_planes;
+ gx_image_plane_t planes[gs_image_max_components];
+ int i;
+
+#ifdef DEBUG
+ if (num_planes > gs_image_max_components) {
+ lprintf2("num_planes=%d > gs_image_max_components=%d!\n",
+ num_planes, gs_image_max_components);
+ return_error(gs_error_Fatal);
+ }
+#endif
+ for (i = 0; i < num_planes; ++i) {
+ planes[i].data = plane_data[i];
+ planes[i].data_x = data_x;
+ planes[i].raster = raster;
+ }
+ return gx_device_image_plane_data(dev, info, planes, height);
+}
+
+int
+gx_device_image_plane_data(gx_device * dev,
+ gx_image_enum_common_t * info, const gx_image_plane_t * planes, int height)
+{
+ /* We must use the device in the enumerator, not the argument. */
+ return info->procs->plane_data(info->dev, info, planes, height);
+}
+
+int
+gx_device_end_image(gx_device * dev,
+ gx_image_enum_common_t * info, bool draw_last)
+{
+ /* We must use the device in the enumerator, not the argument. */
+ return info->procs->end_image(info->dev, info, draw_last);
+}
diff --git a/gs/src/gdevdfax.c b/gs/src/gdevdfax.c
index 7755535b0..90ac40455 100644
--- a/gs/src/gdevdfax.c
+++ b/gs/src/gdevdfax.c
@@ -1,22 +1,22 @@
/* Copyright (C) 1994, 1995 Aladdin Enterprises. All rights reserved.
-
- This file is part of Aladdin Ghostscript.
-
- Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
- or distributor accepts any responsibility for the consequences of using it,
- or for whether it serves any particular purpose or works at all, unless he
- or she says so in writing. Refer to the Aladdin Ghostscript Free Public
- License (the "License") for full details.
-
- Every copy of Aladdin Ghostscript must include a copy of the License,
- normally in a plain ASCII text file named PUBLIC. The License grants you
- the right to copy, modify and redistribute Aladdin Ghostscript, but only
- under certain conditions described in the License. Among other things, the
- License requires that the copyright notice and this notice be preserved on
- all copies.
- */
-
-/* gdevdfax.c */
+
+ This file is part of Aladdin Ghostscript.
+
+ Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
+ or distributor accepts any responsibility for the consequences of using it,
+ or for whether it serves any particular purpose or works at all, unless he
+ or she says so in writing. Refer to the Aladdin Ghostscript Free Public
+ License (the "License") for full details.
+
+ Every copy of Aladdin Ghostscript must include a copy of the License,
+ normally in a plain ASCII text file named PUBLIC. The License grants you
+ the right to copy, modify and redistribute Aladdin Ghostscript, but only
+ under certain conditions described in the License. Among other things, the
+ License requires that the copyright notice and this notice be preserved on
+ all copies.
+*/
+
+/*Id: gdevdfax.c */
/* DigiBoard fax device. */
/***
*** Note: this driver is maintained by a user: please contact
@@ -41,80 +41,71 @@ private dev_proc_open_device(dfax_prn_open);
private dev_proc_print_page(dfax_print_page);
struct gx_device_dfax_s {
- gx_device_common;
- gx_prn_device_common;
- long pageno;
- uint iwidth; /* width of image data in pixels */
+ gx_device_common;
+ gx_prn_device_common;
+ long pageno;
+ uint iwidth; /* width of image data in pixels */
};
typedef struct gx_device_dfax_s gx_device_dfax;
private gx_device_procs dfax_procs =
-prn_procs(dfax_prn_open, gdev_prn_output_page, gdev_prn_close);
+ prn_procs(dfax_prn_open, gdev_prn_output_page, gdev_prn_close);
gx_device_dfax far_data gs_dfaxlow_device =
-{prn_device_std_body(gx_device_dfax, dfax_procs, "dfaxlow",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- X_DPI, Y_DPI / 2,
- 0, 0, 0, 0, /* margins */
- 1, dfax_print_page)
+{ prn_device_std_body(gx_device_dfax, dfax_procs, "dfaxlow",
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ X_DPI, Y_DPI/2,
+ 0,0,0,0, /* margins */
+ 1, dfax_print_page)
};
gx_device_dfax far_data gs_dfaxhigh_device =
-{prn_device_std_body(gx_device_dfax, dfax_procs, "dfaxhigh",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- X_DPI, Y_DPI,
- 0, 0, 0, 0, /* margins */
- 1, dfax_print_page)
+{ prn_device_std_body(gx_device_dfax, dfax_procs, "dfaxhigh",
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ X_DPI, Y_DPI,
+ 0,0,0,0, /* margins */
+ 1, dfax_print_page)
};
#define dfdev ((gx_device_dfax *)dev)
/* Open the device, adjusting the paper size. */
private int
-dfax_prn_open(gx_device * dev)
-{
- dfdev->pageno = 0;
- return gdev_fax_open(dev);
+dfax_prn_open(gx_device *dev)
+{ dfdev->pageno = 0;
+ return gdev_fax_open(dev);
}
/* Print a DigiFAX page. */
private int
-dfax_print_page(gx_device_printer * dev, FILE * prn_stream)
-{
- stream_CFE_state state;
- static char hdr[64] = "\000PC Research, Inc\000\000\000\000\000\000";
- int code;
-
- gdev_fax_init_state(&state, dev);
- state.EndOfLine = true;
- state.EncodedByteAlign = true;
-
- /* Start a page: write the header */
- hdr[24] = 0;
- hdr[28] = 1;
- hdr[26] = ++dfdev->pageno;
- hdr[27] = dfdev->pageno >> 8;
- if (dev->y_pixels_per_inch == Y_DPI) {
- hdr[45] = 0x40;
- hdr[29] = 1;
- }
- /* high res */
- else {
- hdr[45] = hdr[29] = 0;
- } /* low res */
- fseek(prn_stream, 0, SEEK_END);
- fwrite(hdr, sizeof(hdr), 1, prn_stream);
-
- /* Write the page */
- code = gdev_fax_print_page(dev, prn_stream, &state);
-
- /* Fixup page count */
- fseek(prn_stream, 24L, SEEK_SET);
- hdr[24] = dfdev->pageno;
- hdr[25] = dfdev->pageno >> 8;
- fwrite(hdr + 24, 2, 1, prn_stream);
-
- return code;
+dfax_print_page(gx_device_printer *dev, FILE *prn_stream)
+{ stream_CFE_state state;
+ static char hdr[64] = "\000PC Research, Inc\000\000\000\000\000\000";
+ int code;
+
+ gdev_fax_init_state(&state, dev);
+ state.EndOfLine = true;
+ state.EncodedByteAlign = true;
+
+ /* Start a page: write the header */
+ hdr[24] = 0; hdr[28] = 1;
+ hdr[26] = ++dfdev->pageno; hdr[27] = dfdev->pageno >> 8;
+ if (dev->y_pixels_per_inch == Y_DPI)
+ { hdr[45] = 0x40; hdr[29] = 1; } /* high res */
+ else
+ { hdr[45] = hdr[29] = 0; } /* low res */
+ fseek(prn_stream, 0, SEEK_END);
+ fwrite(hdr, sizeof(hdr), 1, prn_stream);
+
+ /* Write the page */
+ code = gdev_fax_print_page(dev, prn_stream, &state);
+
+ /* Fixup page count */
+ fseek(prn_stream, 24L, SEEK_SET);
+ hdr[24] = dfdev->pageno; hdr[25] = dfdev->pageno >> 8;
+ fwrite(hdr+24, 2, 1, prn_stream);
+
+ return code;
}
#undef dfdev
diff --git a/gs/src/gdevdflt.c b/gs/src/gdevdflt.c
index beff04b5b..7f461176e 100644
--- a/gs/src/gdevdflt.c
+++ b/gs/src/gdevdflt.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995, 1996, 1997 Aladdin Enterprises. All rights reserved.
+/* Copyright (C) 1995, 1996, 1997, 1998 Aladdin Enterprises. All rights reserved.
This file is part of Aladdin Ghostscript.
@@ -16,28 +16,18 @@
all copies.
*/
-/* gdevdflt.c */
+/*Id: gdevdflt.c */
/* Default device implementation */
#include "gx.h"
-#include "gpcheck.h"
#include "gserrors.h"
-#include "gsbittab.h"
#include "gsropt.h"
-#include "gxdcolor.h"
+#include "gxcomp.h"
#include "gxdevice.h"
#include "gxdevmem.h"
-#include "gxcpath.h"
+#undef mdev
/* ---------------- Default device procedures ---------------- */
-/* Define the default implementations of RasterOp procedures. */
-/* If the RasterOp option is linked in, it initializes these */
-/* to different values. */
-dev_proc_copy_rop((*gx_default_copy_rop_proc)) = gx_no_copy_rop;
-dev_proc_copy_rop((*gx_forward_copy_rop_proc)) = gx_no_copy_rop;
-dev_proc_strip_copy_rop((*gx_default_strip_copy_rop_proc)) = gx_no_strip_copy_rop;
-dev_proc_strip_copy_rop((*gx_forward_strip_copy_rop_proc)) = gx_no_strip_copy_rop;
-
/* Fill in NULL procedures in a device procedure record. */
void
gx_device_fill_in_procs(register gx_device * dev)
@@ -54,7 +44,7 @@ gx_device_fill_in_procs(register gx_device * dev)
fill_dev_proc(dev, tile_rectangle, gx_default_tile_rectangle);
fill_dev_proc(dev, copy_mono, gx_default_copy_mono);
fill_dev_proc(dev, copy_color, gx_default_copy_color);
- fill_dev_proc(dev, draw_line, gx_default_draw_line);
+ fill_dev_proc(dev, obsolete_draw_line, gx_default_draw_line);
fill_dev_proc(dev, get_bits, gx_default_get_bits);
fill_dev_proc(dev, get_params, gx_default_get_params);
fill_dev_proc(dev, put_params, gx_default_put_params);
@@ -66,7 +56,7 @@ gx_device_fill_in_procs(register gx_device * dev)
fill_dev_proc(dev, get_alpha_bits, gx_default_get_alpha_bits);
fill_dev_proc(dev, copy_alpha, gx_default_copy_alpha);
fill_dev_proc(dev, get_band, gx_default_get_band);
- fill_dev_proc(dev, copy_rop, gx_default_copy_rop_proc);
+ fill_dev_proc(dev, copy_rop, gx_default_copy_rop);
fill_dev_proc(dev, fill_path, gx_default_fill_path);
fill_dev_proc(dev, stroke_path, gx_default_stroke_path);
fill_dev_proc(dev, fill_mask, gx_default_fill_mask);
@@ -80,31 +70,31 @@ gx_device_fill_in_procs(register gx_device * dev)
* procedures, and, if in a DEBUG configuration, print a warning
* if the definitions aren't the default ones.
*/
- {
- extern dev_proc_image_data(gx_device_image_data);
- extern dev_proc_end_image(gx_device_end_image);
-
#ifdef DEBUG
- if (dev_proc(dev, image_data) != NULL &&
- dev_proc(dev, image_data) != gx_default_image_data &&
- dev_proc(dev, image_data) != gx_device_image_data
- )
- dprintf1("**** Warning: device %s implements obsolete image_data procedure\n", \
- dev->dname);
- if (dev_proc(dev, end_image) != NULL &&
- dev_proc(dev, end_image) != gx_default_end_image &&
- dev_proc(dev, end_image) != gx_device_end_image
- )
- dprintf1("**** Warning: device %s implements obsolete end_image procedure\n", \
- dev->dname);
+# define CHECK_NON_DEFAULT(proc, default, procname)\
+ BEGIN\
+ if ( dev_proc(dev, proc) != NULL && dev_proc(dev, proc) != default )\
+ dprintf2("**** Warning: device %s implements obsolete procedure %s\n",\
+ dev->dname, procname);\
+ END
+#else
+# define CHECK_NON_DEFAULT(proc, default, procname)\
+ DO_NOTHING
#endif
- set_dev_proc(dev, image_data, gx_device_image_data);
- set_dev_proc(dev, end_image, gx_device_end_image);
- }
+ CHECK_NON_DEFAULT(image_data, gx_device_image_data, "image_data");
+ set_dev_proc(dev, image_data, gx_device_image_data);
+ CHECK_NON_DEFAULT(end_image, gx_device_end_image, "end_image");
+ set_dev_proc(dev, end_image, gx_device_end_image);
+#undef CHECK_NON_DEFAULT
fill_dev_proc(dev, strip_tile_rectangle, gx_default_strip_tile_rectangle);
- fill_dev_proc(dev, strip_copy_rop, gx_default_strip_copy_rop_proc);
+ fill_dev_proc(dev, strip_copy_rop, gx_default_strip_copy_rop);
fill_dev_proc(dev, get_clipping_box, gx_default_get_clipping_box);
+ fill_dev_proc(dev, begin_typed_image, gx_default_begin_typed_image);
+ fill_dev_proc(dev, get_bits_rectangle, gx_default_get_bits_rectangle);
+ fill_dev_proc(dev, map_color_rgb_alpha, gx_default_map_color_rgb_alpha);
+ fill_dev_proc(dev, create_compositor, gx_default_create_compositor);
fill_dev_proc(dev, get_hardware_params, gx_default_get_hardware_params);
+ fill_dev_proc(dev, text_begin, gx_default_text_begin);
}
int
@@ -160,127 +150,7 @@ gx_default_close_device(gx_device * dev)
return 0;
}
-/* By default, implement tile_rectangle using strip_tile_rectangle. */
-int
-gx_default_tile_rectangle(gx_device * dev, const gx_tile_bitmap * tile,
- int x, int y, int w, int h, gx_color_index color0, gx_color_index color1,
- int px, int py)
-{
- gx_strip_bitmap tiles;
-
- *(gx_tile_bitmap *) & tiles = *tile;
- tiles.shift = tiles.rep_shift = 0;
- return (*dev_proc(dev, strip_tile_rectangle))
- (dev, &tiles, x, y, w, h, color0, color1, px, py);
-}
-
-/* Implement copy_mono by filling lots of small rectangles. */
-/* This is very inefficient, but it works as a default. */
-int
-gx_default_copy_mono(gx_device * dev, const byte * data,
- int dx, int raster, gx_bitmap_id id, int x, int y, int w, int h,
- gx_color_index zero, gx_color_index one)
-{
- bool invert;
- gx_color_index color;
- gx_device_color devc;
-
- fit_copy(dev, data, dx, raster, id, x, y, w, h);
- if (one != gx_no_color_index) {
- invert = false;
- color = one;
- if (zero != gx_no_color_index) {
- int code = (*dev_proc(dev, fill_rectangle))
- (dev, x, y, w, h, zero);
-
- if (code < 0)
- return code;
- }
- } else {
- invert = true;
- color = zero;
- }
- color_set_pure(&devc, color);
- return gx_dc_default_fill_masked
- (&devc, data, dx, raster, id, x, y, w, h, dev, rop3_T, invert);
-}
-
-/* Implement copy_color by filling lots of small rectangles. */
-/* This is very inefficient, but it works as a default. */
-int
-gx_default_copy_color(gx_device * dev, const byte * data,
- int dx, int raster, gx_bitmap_id id,
- int x, int y, int w, int h)
-{
- int depth = dev->color_info.depth;
- byte mask;
-
- dev_proc_fill_rectangle((*fill));
- const byte *row;
- int iy;
-
- if (depth == 1)
- return (*dev_proc(dev, copy_mono)) (dev, data, dx, raster, id,
- x, y, w, h,
- (gx_color_index) 0, (gx_color_index) 1);
- fit_copy(dev, data, dx, raster, id, x, y, w, h);
- fill = dev_proc(dev, fill_rectangle);
- mask = (byte) ((1 << depth) - 1);
- for (row = data, iy = 0; iy < h; row += raster, ++iy) {
- int ix;
- gx_color_index c0 = gx_no_color_index;
- const byte *ptr = row + ((dx * depth) >> 3);
- int i0;
-
- for (i0 = ix = 0; ix < w; ++ix) {
- gx_color_index color;
-
- if (depth >= 8) {
- color = *ptr++;
- switch (depth) {
- case 32:
- color = (color << 8) + *ptr++;
- case 24:
- color = (color << 8) + *ptr++;
- case 16:
- color = (color << 8) + *ptr++;
- }
- } else {
- uint dbit = (-(ix + dx + 1) * depth) & 7;
-
- color = (*ptr >> dbit) & mask;
- if (dbit == 0)
- ptr++;
- }
- if (color != c0) {
- if (ix > i0) {
- int code = (*fill)
- (dev, i0 + x, iy + y, ix - i0, 1, c0);
-
- if (code < 0)
- return code;
- }
- c0 = color;
- i0 = ix;
- }
- }
- if (ix > i0) {
- int code = (*fill) (dev, i0 + x, iy + y, ix - i0, 1, c0);
-
- if (code < 0)
- return code;
- }
- }
- return 0;
-}
-
-int
-gx_default_get_bits(gx_device * dev, int y, byte * data, byte ** actual_data)
-{
- return_error(gs_error_unknownerror);
-}
-
-gx_xfont_procs *
+const gx_xfont_procs *
gx_default_get_xfont_procs(gx_device * dev)
{
return NULL;
@@ -310,470 +180,11 @@ gx_default_get_alpha_bits(gx_device * dev, graphics_object_type type)
}
int
-gx_no_copy_alpha(gx_device * dev, const byte * data, int data_x,
- int raster, gx_bitmap_id id, int x, int y, int width, int height,
- gx_color_index color, int depth)
-{
- return_error(gs_error_unknownerror);
-}
-
-int
-gx_default_copy_alpha(gx_device * dev, const byte * data, int data_x,
- int raster, gx_bitmap_id id, int x, int y, int width, int height,
- gx_color_index color, int depth)
-{ /* This might be called with depth = 1.... */
- if (depth == 1)
- return (*dev_proc(dev, copy_mono)) (dev, data, data_x, raster, id,
- x, y, width, height,
- gx_no_color_index, color);
- /*
- * Simulate alpha by weighted averaging of RGB values.
- * This is very slow, but functionally correct.
- */
- {
- const byte *row;
- gs_memory_t *mem = dev->memory ? dev->memory : &gs_memory_default;
- int bpp = dev->color_info.depth;
- uint in_size = gx_device_raster(dev, false);
- byte *lin;
- uint out_size;
- byte *lout;
- int code = 0;
- gx_color_value color_rgb[3];
- int ry;
-
- fit_copy(dev, data, data_x, raster, id, x, y, width, height);
- row = data;
- out_size = bitmap_raster(width * bpp);
- lin = gs_alloc_bytes(mem, in_size, "copy_alpha(lin)");
- lout = gs_alloc_bytes(mem, out_size, "copy_alpha(lout)");
- if (lin == 0 || lout == 0) {
- code = gs_note_error(gs_error_VMerror);
- goto out;
- }
- (*dev_proc(dev, map_color_rgb)) (dev, color, color_rgb);
- for (ry = y; ry < y + height; row += raster, ++ry) {
- byte *line;
- int sx, rx;
-
- declare_line_accum(lout, bpp, x);
-
- code = (*dev_proc(dev, get_bits)) (dev, ry, lin, &line);
- if (code < 0)
- break;
- for (sx = data_x, rx = x; sx < data_x + width; ++sx, ++rx) {
- gx_color_index previous = gx_no_color_index;
- gx_color_index composite;
- int alpha2, alpha;
-
- if (depth == 2) /* map 0 - 3 to 0 - 15 */
- alpha = ((row[sx >> 2] >> ((3 - (sx & 3)) << 1)) & 3) * 5;
- else
- alpha2 = row[sx >> 1],
- alpha = (sx & 1 ? alpha2 & 0xf : alpha2 >> 4);
- blend:if (alpha == 15) { /* Just write the new color. */
- composite = color;
- } else {
- if (previous == gx_no_color_index) { /* Extract the old color. */
- if (bpp < 8) {
- const uint bit = rx * bpp;
- const byte *src = line + (bit >> 3);
-
- previous =
- (*src >> (8 - (bit + bpp))) &
- ((1 << bpp) - 1);
- } else {
- const byte *src = line + (rx * (bpp >> 3));
-
- previous = 0;
- switch (bpp >> 3) {
- case 4:
- previous += (gx_color_index) * src++ << 24;
- case 3:
- previous += (gx_color_index) * src++ << 16;
- case 2:
- previous += (gx_color_index) * src++ << 8;
- case 1:
- previous += *src++;
- }
- }
- }
- if (alpha == 0) { /* Just write the old color. */
- composite = previous;
- } else { /* Blend RGB values. */
- gx_color_value rgb[3];
-
- (*dev_proc(dev, map_color_rgb)) (dev, previous, rgb);
-#if arch_ints_are_short
-# define b_int long
-#else
-# define b_int int
-#endif
-#define make_shade(old, clr, alpha, amax) \
- (old) + (((b_int)(clr) - (b_int)(old)) * (alpha) / (amax))
- rgb[0] = make_shade(rgb[0], color_rgb[0], alpha, 15);
- rgb[1] = make_shade(rgb[1], color_rgb[1], alpha, 15);
- rgb[2] = make_shade(rgb[2], color_rgb[2], alpha, 15);
-#undef b_int
-#undef make_shade
- composite =
- (*dev_proc(dev, map_rgb_color)) (dev, rgb[0],
- rgb[1], rgb[2]);
- if (composite == gx_no_color_index) { /* The device can't represent this color. */
- /* Move the alpha value towards 0 or 1. */
- if (alpha == 7) /* move 1/2 towards 1 */
- ++alpha;
- alpha = (alpha & 8) | (alpha >> 1);
- goto blend;
- }
- }
- }
- line_accum(composite, bpp);
- }
- line_accum_copy(dev, lout, bpp, x, rx, raster, ry);
- }
- out:gs_free_object(mem, lout, "copy_alpha(lout)");
- gs_free_object(mem, lin, "copy_alpha(lin)");
- return code;
- }
-}
-
-int
gx_default_get_band(gx_device * dev, int y, int *band_start)
{
return 0;
}
-int
-gx_no_copy_rop(gx_device * dev,
- const byte * sdata, int sourcex, uint sraster, gx_bitmap_id id,
- const gx_color_index * scolors,
- const gx_tile_bitmap * texture, const gx_color_index * tcolors,
- int x, int y, int width, int height,
- int phase_x, int phase_y, gs_logical_operation_t lop)
-{
- return_error(gs_error_unknownerror); /* not implemented */
-}
-int
-gx_default_copy_rop(gx_device * dev,
- const byte * sdata, int sourcex, uint sraster, gx_bitmap_id id,
- const gx_color_index * scolors,
- const gx_tile_bitmap * texture, const gx_color_index * tcolors,
- int x, int y, int width, int height,
- int phase_x, int phase_y, gs_logical_operation_t lop)
-{
- return (*gx_default_copy_rop_proc)
- (dev, sdata, sourcex, sraster, id, scolors, texture, tcolors,
- x, y, width, height, phase_x, phase_y, lop);
-}
-
-int
-gx_default_fill_mask(gx_device * orig_dev,
- const byte * data, int dx, int raster, gx_bitmap_id id,
- int x, int y, int w, int h,
- const gx_drawing_color * pdcolor, int depth,
- gs_logical_operation_t lop, const gx_clip_path * pcpath)
-{
- gx_device *dev;
- gx_device_clip cdev;
- gx_color_index colors[2];
- gx_strip_bitmap *tile;
-
- if (gx_dc_is_pure(pdcolor)) {
- tile = 0;
- colors[0] = gx_no_color_index;
- colors[1] = gx_dc_pure_color(pdcolor);
- } else if (gx_dc_is_binary_halftone(pdcolor)) {
- tile = gx_dc_binary_tile(pdcolor);
- colors[0] = gx_dc_binary_color0(pdcolor);
- colors[1] = gx_dc_binary_color1(pdcolor);
- } else
- return_error(gs_error_unknownerror); /* not implemented */
- if (pcpath != 0) {
- gx_make_clip_path_device(&cdev, pcpath);
- cdev.target = orig_dev;
- dev = (gx_device *) & cdev;
- (*dev_proc(dev, open_device)) (dev);
- } else
- dev = orig_dev;
- if (depth > 1) {
-/****** CAN'T DO ROP OR HALFTONE WITH ALPHA ******/
- return (*dev_proc(dev, copy_alpha))
- (dev, data, dx, raster, id, x, y, w, h, colors[1], depth);
- }
- if (lop != lop_default) {
- gx_color_index scolors[2];
-
- scolors[0] = /* white */
- (*dev_proc(dev, map_rgb_color))
- (dev, gx_max_color_value, gx_max_color_value, gx_max_color_value);
- scolors[1] = /* black */
- (*dev_proc(dev, map_rgb_color))
- (dev, (gx_color_value) 0, (gx_color_value) 0, (gx_color_value) 0);
- if (tile == 0)
- colors[0] = colors[1]; /* pure color */
- /* We want to write only where the mask is a 1, */
- /* so enable source transparency. */
- return (*dev_proc(dev, strip_copy_rop))
- (dev, data, dx, raster, id, scolors, tile, colors,
- x, y, w, h,
- gx_dc_phase(pdcolor).x, gx_dc_phase(pdcolor).y,
- /*
- * We have to include S in the operation, otherwise
- * S_transparent will be ignored.
- */
- lop | (rop3_S | lop_S_transparent));
- }
- if (tile == 0) {
- return (*dev_proc(dev, copy_mono))
- (dev, data, dx, raster, id, x, y, w, h,
- gx_no_color_index, colors[1]);
- }
- /*
- * Use the same approach as the default copy_mono (above). We
- * should really clip to the intersection of the bounding boxes of
- * the device and the clipping path, but it's too much work.
- */
- fit_copy(orig_dev, data, dx, raster, id, x, y, w, h);
- {
- dev_proc_strip_tile_rectangle((*tile_proc)) =
- dev_proc(dev, strip_tile_rectangle);
- const byte *row = data + (dx >> 3);
- int dx_bit = dx & 7;
- int wdx = w + dx_bit;
- int iy;
-
- for (row = data, iy = 0; iy < h; row += raster, iy++) {
- int ix;
-
- for (ix = dx_bit; ix < wdx;) {
- int i0;
- uint b;
- uint len;
- int code;
-
- /* Skip 0-bits. */
- b = row[ix >> 3];
- len = byte_bit_run_length[ix & 7][b ^ 0xff];
- if (len) {
- ix += ((len - 1) & 7) + 1;
- continue;
- }
- /* Scan 1-bits. */
- i0 = ix;
- for (;;) {
- b = row[ix >> 3];
- len = byte_bit_run_length[ix & 7][b];
- if (!len)
- break;
- ix += ((len - 1) & 7) + 1;
- if (ix >= wdx) {
- ix = wdx;
- break;
- }
- if (len < 8)
- break;
- }
- /* Now color the run from i0 to ix. */
- code = (*tile_proc)
- (dev, tile, i0 - dx_bit + x, iy + y, ix - i0, 1,
- colors[0], colors[1],
- gx_dc_phase(pdcolor).x, gx_dc_phase(pdcolor).y);
- if (code < 0)
- return code;
-#undef row_bit
- }
- }
- }
- return 0;
-}
-
-/* Default implementation of strip_tile_rectangle */
-int
-gx_default_strip_tile_rectangle(gx_device * dev, const gx_strip_bitmap * tiles,
- int x, int y, int w, int h, gx_color_index color0, gx_color_index color1,
- int px, int py)
-{ /* Fill the rectangle in chunks. */
- int width = tiles->size.x;
- int height = tiles->size.y;
- int raster = tiles->raster;
- int rwidth = tiles->rep_width;
- int rheight = tiles->rep_height;
- int shift = tiles->shift;
-
- fit_fill_xy(dev, x, y, w, h);
-
-#ifdef DEBUG
- if (gs_debug_c('t')) {
- int ptx, pty;
- const byte *ptp = tiles->data;
-
- dprintf3("[t]tile %dx%d raster=%d;",
- tiles->size.x, tiles->size.y, tiles->raster);
- dprintf6(" x,y=%d,%d w,h=%d,%d p=%d,%d\n",
- x, y, w, h, px, py);
- for (pty = 0; pty < tiles->size.y; pty++) {
- dprintf(" ");
- for (ptx = 0; ptx < tiles->raster; ptx++)
- dprintf1("%3x", *ptp++);
- }
- dputc('\n');
- }
-#endif
-
- if (dev_proc(dev, tile_rectangle) != gx_default_tile_rectangle) {
- if (shift == 0) { /*
- * Temporarily patch the tile_rectangle procedure in the
- * device so we don't get into a recursion loop if the
- * device has a tile_rectangle procedure that conditionally
- * calls the strip_tile_rectangle procedure.
- */
- dev_proc_tile_rectangle((*tile_proc)) =
- dev_proc(dev, tile_rectangle);
- int code;
-
- set_dev_proc(dev, tile_rectangle, gx_default_tile_rectangle);
- code = (*tile_proc)
- (dev, (const gx_tile_bitmap *)tiles, x, y, w, h,
- color0, color1, px, py);
- set_dev_proc(dev, tile_rectangle, tile_proc);
- return code;
- }
- /* We should probably optimize this case too, for the benefit */
- /* of window systems, but we don't yet. */
- } { /*
- * Note: we can't do the following computations until after
- * the fit_fill_xy.
- */
- int xoff =
- (shift == 0 ? px :
- px + (y + py) / rheight * tiles->rep_shift);
- int irx = ((rwidth & (rwidth - 1)) == 0 ? /* power of 2 */
- (x + xoff) & (rwidth - 1) :
- (x + xoff) % rwidth);
- int ry = ((rheight & (rheight - 1)) == 0 ? /* power of 2 */
- (y + py) & (rheight - 1) :
- (y + py) % rheight);
- int icw = width - irx;
- int ch = height - ry;
- byte *row = tiles->data + ry * raster;
-
- dev_proc_copy_mono((*proc_mono));
- dev_proc_copy_color((*proc_color));
- int code;
-
- if (color0 == gx_no_color_index && color1 == gx_no_color_index)
- proc_color = dev_proc(dev, copy_color);
- else
- proc_color = 0, proc_mono = dev_proc(dev, copy_mono);
-
-/****** SHOULD ALSO PASS id IF COPYING A FULL TILE ******/
-#define real_copy_tile(srcx, tx, ty, tw, th)\
- code =\
- (proc_color != 0 ?\
- (*proc_color)(dev, row, srcx, raster, gx_no_bitmap_id, tx, ty, tw, th) :\
- (*proc_mono)(dev, row, srcx, raster, gx_no_bitmap_id, tx, ty, tw, th, color0, color1));\
- if ( code < 0 ) return_error(code);\
- return_if_interrupt()
-#ifdef DEBUG
-#define copy_tile(sx, tx, ty, tw, th)\
- if ( gs_debug_c('t') )\
- dprintf5(" copy sx=%d x=%d y=%d w=%d h=%d\n",\
- sx, tx, ty, tw, th);\
- real_copy_tile(sx, tx, ty, tw, th)
-#else
-#define copy_tile(sx, tx, ty, tw, th)\
- real_copy_tile(sx, tx, ty, tw, th)
-#endif
- if (ch >= h) { /* Shallow operation */
- if (icw >= w) { /* Just one (partial) tile to transfer. */
- copy_tile(irx, x, y, w, h);
- } else {
- int ex = x + w;
- int fex = ex - width;
- int cx = x + icw;
-
- copy_tile(irx, x, y, icw, h);
- while (cx <= fex) {
- copy_tile(0, cx, y, width, h);
- cx += width;
- }
- if (cx < ex) {
- copy_tile(0, cx, y, ex - cx, h);
- }
- }
- } else if (icw >= w && shift == 0) { /* Narrow operation, no shift */
- int ey = y + h;
- int fey = ey - height;
- int cy = y + ch;
-
- copy_tile(irx, x, y, w, ch);
- row = tiles->data;
- do {
- ch = (cy > fey ? ey - cy : height);
- copy_tile(irx, x, cy, w, ch);
- }
- while ((cy += ch) < ey);
- } else { /* Full operation. If shift != 0, some scan lines */
- /* may be narrow. We could test shift == 0 in advance */
- /* and use a slightly faster loop, but right now */
- /* we don't bother. */
- int ex = x + w, ey = y + h;
- int fex = ex - width, fey = ey - height;
- int cx, cy;
-
- for (cy = y;;) {
- if (icw >= w) {
- copy_tile(irx, x, cy, w, ch);
- } else {
- copy_tile(irx, x, cy, icw, ch);
- cx = x + icw;
- while (cx <= fex) {
- copy_tile(0, cx, cy, width, ch);
- cx += width;
- }
- if (cx < ex) {
- copy_tile(0, cx, cy, ex - cx, ch);
- }
- }
- if ((cy += ch) >= ey)
- break;
- ch = (cy > fey ? ey - cy : height);
- if ((irx += shift) >= rwidth)
- irx -= rwidth;
- icw = width - irx;
- row = tiles->data;
- }
- }
-#undef copy_tile
-#undef real_copy_tile
- }
- return 0;
-}
-
-int
-gx_no_strip_copy_rop(gx_device * dev,
- const byte * sdata, int sourcex, uint sraster, gx_bitmap_id id,
- const gx_color_index * scolors,
- const gx_strip_bitmap * textures, const gx_color_index * tcolors,
- int x, int y, int width, int height,
- int phase_x, int phase_y, gs_logical_operation_t lop)
-{
- return_error(gs_error_unknownerror); /* not implemented */
-}
-int
-gx_default_strip_copy_rop(gx_device * dev,
- const byte * sdata, int sourcex, uint sraster, gx_bitmap_id id,
- const gx_color_index * scolors,
- const gx_strip_bitmap * textures, const gx_color_index * tcolors,
- int x, int y, int width, int height,
- int phase_x, int phase_y, gs_logical_operation_t lop)
-{
- return (*gx_default_strip_copy_rop_proc)
- (dev, sdata, sourcex, sraster, id, scolors, textures, tcolors,
- x, y, width, height, phase_x, phase_y, lop);
-}
-
void
gx_default_get_clipping_box(gx_device * dev, gs_fixed_rect * pbox)
{
@@ -791,6 +202,27 @@ gx_get_largest_clipping_box(gx_device * dev, gs_fixed_rect * pbox)
pbox->q.y = max_fixed;
}
+int
+gx_no_create_compositor(gx_device * dev, gx_device ** pcdev,
+ const gs_composite_t * pcte, const gs_imager_state * pis, gs_memory_t * memory)
+{
+ return_error(gs_error_unknownerror); /* not implemented */
+}
+int
+gx_default_create_compositor(gx_device * dev, gx_device ** pcdev,
+ const gs_composite_t * pcte, const gs_imager_state * pis, gs_memory_t * memory)
+{
+ return (*pcte->type->procs.create_default_compositor)
+ (pcte, pcdev, dev, pis, memory);
+}
+int
+gx_non_imaging_create_compositor(gx_device * dev, gx_device ** pcdev,
+ const gs_composite_t * pcte, const gs_imager_state * pis, gs_memory_t * memory)
+{
+ *pcdev = dev;
+ return 0;
+}
+
/* The following is not really a device procedure. See gxdevice.h. */
/* Create an ordinary memory device for page or band buffering. */
@@ -804,7 +236,7 @@ gx_default_make_buffer_device(gx_device_memory * mdev,
if (mdproto == 0)
return_error(gs_error_rangecheck);
if (target == (gx_device *) mdev)
- mdev->std_procs = mdproto->std_procs;
+ assign_dev_procs(mdev, mdproto);
else
gs_make_mem_device(mdev, mdproto, mem, (for_band ? 1 : 0),
(target == (gx_device *) mdev ? 0 : target));
@@ -830,127 +262,3 @@ gx_default_end_page(gx_device * dev, int reason, gs_state * pgs)
{
return (reason != 2 ? 1 : 0);
}
-
-/* ---------------- Unaligned copy operations ---------------- */
-
-/*
- * Implementing unaligned operations in terms of the standard aligned
- * operations requires adjusting the bitmap origin and/or the raster to be
- * aligned. Adjusting the origin is simple; adjusting the raster requires
- * doing the operation one scan line at a time.
- */
-int
-gx_copy_mono_unaligned(gx_device * dev, const byte * data,
- int dx, int raster, gx_bitmap_id id, int x, int y, int w, int h,
- gx_color_index zero, gx_color_index one)
-{
- dev_proc_copy_mono((*copy_mono)) = dev_proc(dev, copy_mono);
- uint offset = alignment_mod(data, align_bitmap_mod);
- int step = raster & (align_bitmap_mod - 1);
-
- /* Adjust the origin. */
- data -= offset;
- dx += offset << 3;
-
- /* Adjust the raster. */
- if (!step) { /* No adjustment needed. */
- return (*copy_mono) (dev, data, dx, raster, id,
- x, y, w, h, zero, one);
- }
- /* Do the transfer one scan line at a time. */
- {
- const byte *p = data;
- int d = dx;
- int code = 0;
- int i;
-
- for (i = 0; i < h && code >= 0;
- ++i, p += raster - step, d += step << 3
- )
- code = (*copy_mono) (dev, p, d, raster, gx_no_bitmap_id,
- x, y + i, w, 1, zero, one);
- return code;
- }
-}
-
-int
-gx_copy_color_unaligned(gx_device * dev, const byte * data,
- int data_x, int raster, gx_bitmap_id id,
- int x, int y, int width, int height)
-{
- dev_proc_copy_color((*copy_color)) = dev_proc(dev, copy_color);
- int depth = dev->color_info.depth;
- uint offset = (uint) (data - (const byte *)0) & (align_bitmap_mod - 1);
- int step = raster & (align_bitmap_mod - 1);
-
- /*
- * Adjust the origin.
- * We have to do something very special for 24-bit data,
- * because that is the only depth that doesn't divide
- * align_bitmap_mod exactly. In particular, we need to find
- * M*B + R == 0 mod 3, where M is align_bitmap_mod, R is the
- * offset value just calculated, and B is an integer unknown;
- * the new value of offset will be M*B + R.
- */
- if (depth == 24)
- offset += (offset % 3) *
- (align_bitmap_mod * (3 - (align_bitmap_mod % 3)));
- data -= offset;
- data_x += (offset << 3) / depth;
-
- /* Adjust the raster. */
- if (!step) { /* No adjustment needed. */
- return (*copy_color) (dev, data, data_x, raster, id,
- x, y, width, height);
- }
- /* Do the transfer one scan line at a time. */
- {
- const byte *p = data;
- int d = data_x;
- int dstep = (step << 3) / depth;
- int code = 0;
- int i;
-
- for (i = 0; i < height && code >= 0;
- ++i, p += raster - step, d += dstep
- )
- code = (*copy_color) (dev, p, d, raster, gx_no_bitmap_id,
- x, y + i, width, 1);
- return code;
- }
-}
-
-int
-gx_copy_alpha_unaligned(gx_device * dev, const byte * data, int data_x,
- int raster, gx_bitmap_id id, int x, int y, int width, int height,
- gx_color_index color, int depth)
-{
- dev_proc_copy_alpha((*copy_alpha)) = dev_proc(dev, copy_alpha);
- uint offset = (uint) (data - (const byte *)0) & (align_bitmap_mod - 1);
- int step = raster & (align_bitmap_mod - 1);
-
- /* Adjust the origin. */
- data -= offset;
- data_x += (offset << 3) / depth;
-
- /* Adjust the raster. */
- if (!step) { /* No adjustment needed. */
- return (*copy_alpha) (dev, data, data_x, raster, id,
- x, y, width, height, color, depth);
- }
- /* Do the transfer one scan line at a time. */
- {
- const byte *p = data;
- int d = data_x;
- int dstep = (step << 3) / depth;
- int code = 0;
- int i;
-
- for (i = 0; i < height && code >= 0;
- ++i, p += raster - step, d += dstep
- )
- code = (*copy_alpha) (dev, p, d, raster, gx_no_bitmap_id,
- x, y + i, width, 1, color, depth);
- return code;
- }
-}
diff --git a/gs/src/gdevdjet.c b/gs/src/gdevdjet.c
index 450b198d3..b3bd6a959 100644
--- a/gs/src/gdevdjet.c
+++ b/gs/src/gdevdjet.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1989, 1995, 1996, 1997 Aladdin Enterprises. All rights reserved.
+/* Copyright (C) 1989, 1995, 1996, 1997, 1998 Aladdin Enterprises. All rights reserved.
This file is part of Aladdin Ghostscript.
@@ -16,7 +16,7 @@
all copies.
*/
-/* gdevdjet.c */
+/*Id: gdevdjet.c */
/* HP LaserJet/DeskJet driver for Ghostscript */
#include "gdevprn.h"
#include "gdevpcl.h"
@@ -145,74 +145,74 @@ private dev_proc_print_page(ljet4_print_page);
private dev_proc_print_page(lp2563_print_page);
private dev_proc_print_page(oce9050_print_page);
-private gx_device_procs prn_hp_procs =
+private const gx_device_procs prn_hp_procs =
prn_params_procs(hpjet_open, gdev_prn_output_page, hpjet_close,
gdev_prn_get_params, gdev_prn_put_params);
-gx_device_printer far_data gs_deskjet_device =
+const gx_device_printer gs_deskjet_device =
prn_device(prn_hp_procs, "deskjet",
DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
X_DPI, Y_DPI,
0, 0, 0, 0, /* margins filled in by hpjet_open */
1, djet_print_page);
-gx_device_printer far_data gs_djet500_device =
+const gx_device_printer gs_djet500_device =
prn_device(prn_hp_procs, "djet500",
DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
X_DPI, Y_DPI,
0, 0, 0, 0, /* margins filled in by hpjet_open */
1, djet500_print_page);
-gx_device_printer far_data gs_laserjet_device =
+const gx_device_printer gs_laserjet_device =
prn_device(prn_hp_procs, "laserjet",
DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
X_DPI, Y_DPI,
0.05, 0.25, 0.55, 0.25, /* margins */
1, ljet_print_page);
-gx_device_printer far_data gs_ljetplus_device =
+const gx_device_printer gs_ljetplus_device =
prn_device(prn_hp_procs, "ljetplus",
DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
X_DPI, Y_DPI,
0.05, 0.25, 0.55, 0.25, /* margins */
1, ljetplus_print_page);
-gx_device_printer far_data gs_ljet2p_device =
+const gx_device_printer gs_ljet2p_device =
prn_device(prn_hp_procs, "ljet2p",
DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
X_DPI, Y_DPI,
0.20, 0.25, 0.25, 0.25, /* margins */
1, ljet2p_print_page);
-gx_device_printer far_data gs_ljet3_device =
+const gx_device_printer gs_ljet3_device =
prn_device(prn_hp_procs, "ljet3",
DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
X_DPI, Y_DPI,
0.20, 0.25, 0.25, 0.25, /* margins */
1, ljet3_print_page);
-gx_device_printer far_data gs_ljet3d_device =
+const gx_device_printer gs_ljet3d_device =
prn_device(prn_hp_procs, "ljet3d",
DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
X_DPI, Y_DPI,
0.20, 0.25, 0.25, 0.25, /* margins */
1, ljet3d_print_page);
-gx_device_printer far_data gs_ljet4_device =
+const gx_device_printer gs_ljet4_device =
prn_device(prn_hp_procs, "ljet4",
DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
X_DPI2, Y_DPI2,
0, 0, 0, 0, /* margins */
1, ljet4_print_page);
-gx_device_printer far_data gs_lp2563_device =
+const gx_device_printer gs_lp2563_device =
prn_device(prn_hp_procs, "lp2563",
DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
X_DPI, Y_DPI,
0, 0, 0, 0, /* margins */
1, lp2563_print_page);
-gx_device_printer far_data gs_oce9050_device =
+const gx_device_printer gs_oce9050_device =
prn_device(prn_hp_procs, "oce9050",
24 * 10, 24 * 10, /* 24 inch roll (can print 32" also) */
400, 400, /* 400 dpi */
@@ -231,7 +231,7 @@ private int hpjet_print_page(P6(gx_device_printer * pdev, FILE * prn_stream,
private int
hpjet_open(gx_device * pdev)
{ /* Change the margins if necessary. */
- const float _ds *m = 0;
+ const float *m = 0;
bool move_origin = true;
if (ppdev->printer_procs.print_page == djet_print_page ||
@@ -265,14 +265,15 @@ hpjet_open(gx_device * pdev)
return gdev_prn_open(pdev);
}
-/* hpjet_close is only here to eject odd numbered pages in duplex mode. */
+/* hpjet_close is only here to eject odd numbered pages in duplex mode, */
+/* and to reset the printer so the ink cartridge doesn't clog up. */
private int
hpjet_close(gx_device * pdev)
{
- if (ppdev->Duplex_set >= 0 && ppdev->Duplex) {
- gdev_prn_open_printer(pdev, 1);
+ gdev_prn_open_printer(pdev, 1);
+ if (ppdev->Duplex_set >= 0 && ppdev->Duplex)
fputs("\033&l0H", ppdev->file);
- }
+ fputs("\033E", ppdev->file);
return gdev_prn_close(pdev);
}
@@ -408,8 +409,8 @@ hpjet_print_page(gx_device_printer * pdev, FILE * prn_stream, int ptype,
int out_count;
int compression = -1;
- static const char *from2to3 = "\033*b3M";
- static const char *from3to2 = "\033*b2M";
+ static const char *const from2to3 = "\033*b3M";
+ static const char *const from3to2 = "\033*b2M";
int penalty_from2to3 = strlen(from2to3);
int penalty_from3to2 = strlen(from3to2);
int paper_size = gdev_pcl_paper_size((gx_device *) pdev);
diff --git a/gs/src/gdevdjtc.c b/gs/src/gdevdjtc.c
index d45f166f2..db96ba173 100644
--- a/gs/src/gdevdjtc.c
+++ b/gs/src/gdevdjtc.c
@@ -1,22 +1,22 @@
/* Copyright (C) 1989, 1990, 1991 Aladdin Enterprises. All rights reserved.
-
- This file is part of Aladdin Ghostscript.
-
- Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
- or distributor accepts any responsibility for the consequences of using it,
- or for whether it serves any particular purpose or works at all, unless he
- or she says so in writing. Refer to the Aladdin Ghostscript Free Public
- License (the "License") for full details.
-
- Every copy of Aladdin Ghostscript must include a copy of the License,
- normally in a plain ASCII text file named PUBLIC. The License grants you
- the right to copy, modify and redistribute Aladdin Ghostscript, but only
- under certain conditions described in the License. Among other things, the
- License requires that the copyright notice and this notice be preserved on
- all copies.
- */
-
-/* gdevdjtc.c */
+
+ This file is part of Aladdin Ghostscript.
+
+ Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
+ or distributor accepts any responsibility for the consequences of using it,
+ or for whether it serves any particular purpose or works at all, unless he
+ or she says so in writing. Refer to the Aladdin Ghostscript Free Public
+ License (the "License") for full details.
+
+ Every copy of Aladdin Ghostscript must include a copy of the License,
+ normally in a plain ASCII text file named PUBLIC. The License grants you
+ the right to copy, modify and redistribute Aladdin Ghostscript, but only
+ under certain conditions described in the License. Among other things, the
+ License requires that the copyright notice and this notice be preserved on
+ all copies.
+*/
+
+/*Id: gdevdjtc.c */
/* HP DeskJet 500C driver */
#include "gdevprn.h"
#include "gdevpcl.h"
@@ -26,14 +26,14 @@
*** Note: this driver was contributed by a user, Alfred Kayser:
*** please contact AKayser@et.tudelft.nl if you have questions.
***/
-
-#ifndef SHINGLING /* Interlaced, multi-pass printing */
-#define SHINGLING 1 /* 0 = none, 1 = 50%, 2 = 25%, 2 is best & slowest */
+
+#ifndef SHINGLING /* Interlaced, multi-pass printing */
+#define SHINGLING 1 /* 0 = none, 1 = 50%, 2 = 25%, 2 is best & slowest */
#endif
-#ifndef DEPLETION /* 'Intelligent' dot-removal */
-#define DEPLETION 1 /* 0 = none, 1 = 25%, 2 = 50%, 1 best for graphics? */
-#endif /* Use 0 for transparencies */
+#ifndef DEPLETION /* 'Intelligent' dot-removal */
+#define DEPLETION 1 /* 0 = none, 1 = 25%, 2 = 50%, 1 best for graphics? */
+#endif /* Use 0 for transparencies */
#define X_DPI 300
#define Y_DPI 300
@@ -44,21 +44,21 @@
private dev_proc_print_page(djet500c_print_page);
private gx_device_procs djet500c_procs =
-prn_color_procs(gdev_prn_open, gdev_prn_output_page, gdev_prn_close,
- gdev_pcl_3bit_map_rgb_color, gdev_pcl_3bit_map_color_rgb);
+ prn_color_procs(gdev_prn_open, gdev_prn_output_page, gdev_prn_close,
+ gdev_pcl_3bit_map_rgb_color, gdev_pcl_3bit_map_color_rgb);
gx_device_printer far_data gs_djet500c_device =
-prn_device(djet500c_procs, "djet500c",
- 85, /* width_10ths, 8.5" */
- 120, /* height_10ths, 12" */
- X_DPI, Y_DPI,
- 0.25, 0.25, 0.25, 0.25, /* margins */
- 3, djet500c_print_page);
+ prn_device(djet500c_procs, "djet500c",
+ 85, /* width_10ths, 8.5" */
+ 120, /* height_10ths, 12" */
+ X_DPI, Y_DPI,
+ 0.25, 0.25, 0.25, 0.25, /* margins */
+ 3, djet500c_print_page);
/* Forward references */
private int djet500c_print_page(P2(gx_device_printer *, FILE *));
-static int mode2compress(P3(byte * row, byte * end_row, byte * compressed));
+static int mode2compress(P3(byte *row, byte *end_row, byte *compressed));
/* The DeskJet 500C uses additive colors in separate planes. */
/* We only keep one bit of color, with 1 = R, 2 = G, 4 = B. */
@@ -70,150 +70,146 @@ static int mode2compress(P3(byte * row, byte * end_row, byte * compressed));
/* The DeskJet Color can compress (mode 2) */
private int
-djet500c_print_page(gx_device_printer * pdev, FILE * fprn)
+djet500c_print_page(gx_device_printer *pdev, FILE *fprn)
{
- byte *bitData = NULL;
- byte *plane1 = NULL;
- byte *plane2 = NULL;
- byte *plane3 = NULL;
- int bitSize = 0;
- int planeSize = 0;
+ byte *bitData=NULL;
+ byte *plane1=NULL;
+ byte *plane2=NULL;
+ byte *plane3=NULL;
+ int bitSize=0;
+ int planeSize=0;
/* select the most compressed mode available & clear tmp storage */
/* put printer in known state */
- fputs("\033E", fprn);
-
+ fputs("\033E",fprn);
+
/* ends raster graphics to set raster graphics resolution */
fputs("\033*rbC", fprn); /* was \033*rB */
/* set raster graphics resolution -- 300 dpi */
- fputs("\033*t300R", fprn);
-
- /* A4, skip perf, def. paper tray */
- fputs("\033&l26a0l1H", fprn);
+ fputs("\033*t300R", fprn);
+
+ /* A4, skip perf, def. paper tray */
+ fputs("\033&l26a0l1H", fprn);
/* RGB Mode */
- fputs("\033*r3U", fprn);
-
+ fputs("\033*r3U", fprn);
+
/* set depletion level */
fprintf(fprn, "\033*o%dD", DEPLETION);
-
+
/* set shingling level */
fprintf(fprn, "\033*o%dQ", SHINGLING);
-
+
/* move to top left of page & set current position */
- fputs("\033*p0x0Y", fprn); /* cursor pos: 0,0 */
-
+ fputs("\033*p0x0Y", fprn); /* cursor pos: 0,0 */
+
fputs("\033*b2M", fprn); /* mode 2 compression for now */
-
- fputs("\033*r0A", fprn); /* start graf. left */
-
+
+ fputs("\033*r0A", fprn); /* start graf. left */
+
/* Send each scan line in turn */
- {
- int lnum;
+ { int lnum;
int num_blank_lines = 0;
- int lineSize = gdev_mem_bytes_per_scan_line((gx_device *) pdev);
-
- if (lineSize > bitSize) {
- if (bitData)
- free(bitData);
- bitSize = lineSize;
- bitData = (byte *) malloc(bitSize + 16);
+ int lineSize = gdev_mem_bytes_per_scan_line((gx_device *)pdev);
+ if (lineSize>bitSize)
+ {
+ if (bitData) free(bitData);
+ bitSize=lineSize;
+ bitData=(byte*)malloc(bitSize+16);
}
- for (lnum = 0; lnum < pdev->height; lnum++) {
- byte *endData;
-
- gdev_prn_copy_scan_lines(pdev, lnum, bitData, lineSize);
-
- /* Remove trailing 0s. */
- endData = bitData + lineSize;
- while ((endData > bitData) && (endData[-1] == 0))
+ for (lnum=0; lnum<pdev->height; lnum++)
+ {
+ byte *endData;
+
+ gdev_prn_copy_scan_lines(pdev, lnum, bitData, lineSize);
+
+ /* Remove trailing 0s. */
+ endData = bitData + lineSize;
+ while ( (endData>bitData) && (endData[-1] == 0) )
endData--;
- if (endData == bitData)
+ if (endData == bitData)
num_blank_lines++;
- else {
- int count, k, i, lineLen;
+ else
+ { int count, k, i, lineLen;
/* Pad with 0s to fill out the last */
/* block of 8 bytes. */
memset(endData, 0, 7);
-
- lineLen = ((endData - bitData) + 7) / 8; /* Round to next 8multiple */
- if (planeSize < lineLen) {
- if (plane1)
- free(plane1);
- if (plane2)
- free(plane2);
- if (plane3)
- free(plane3);
- planeSize = lineLen;
- plane1 = (byte *) malloc(planeSize + 8);
- plane2 = (byte *) malloc(planeSize + 8);
- plane3 = (byte *) malloc(planeSize + 8);
+
+ lineLen=((endData-bitData)+7)/8; /* Round to next 8multiple */
+ if (planeSize<lineLen)
+ {
+ if (plane1) free(plane1);
+ if (plane2) free(plane2);
+ if (plane3) free(plane3);
+ planeSize=lineLen;
+ plane1=(byte*)malloc(planeSize+8);
+ plane2=(byte*)malloc(planeSize+8);
+ plane3=(byte*)malloc(planeSize+8);
}
/* Transpose the data to get pixel planes. */
- for (k = i = 0; k < lineLen; i += 8, k++) {
- register ushort t, c;
-
- /* Three smaller loops are better optimizable and use less
- vars, so most of them can be in registers even on pc's */
- for (c = t = 0; t < 8; t++)
- c = (c << 1) | (bitData[t + i] & 4);
- plane3[k] = ~(byte) (c >> 2);
- for (c = t = 0; t < 8; t++)
- c = (c << 1) | (bitData[t + i] & 2);
- plane2[k] = ~(byte) (c >> 1);
- for (c = t = 0; t < 8; t++)
- c = (c << 1) | (bitData[t + i] & 1);
- plane1[k] = ~(byte) (c);
- }
+ for (k=i=0; k<lineLen; i+=8, k++)
+ {
+ register ushort t, c;
+
+ /* Three smaller loops are better optimizable and use less
+ vars, so most of them can be in registers even on pc's */
+ for (c=t=0;t<8;t++)
+ c = (c<<1) | (bitData[t+i]&4);
+ plane3[k] = ~(byte)(c>>2);
+ for (c=t=0;t<8;t++)
+ c = (c<<1) | (bitData[t+i]&2);
+ plane2[k] = ~(byte)(c>>1);
+ for (c=t=0;t<8;t++)
+ c = (c<<1) | (bitData[t+i]&1);
+ plane1[k] = ~(byte)(c);
+ }
/* Skip blank lines if any */
- if (num_blank_lines > 0) { /* move down from current position */
- fprintf(fprn, "\033*b%dY", num_blank_lines);
- num_blank_lines = 0;
+ if (num_blank_lines > 0)
+ { /* move down from current position */
+ fprintf(fprn, "\033*b%dY", num_blank_lines);
+ num_blank_lines = 0;
}
+
/* Transfer raster graphics */
/* in the order R, G, B. */
/* lineLen is at least bitSize/8, so bitData can easily be used to store
- lineLen of bytes */
+ lineLen of bytes */
/* P.s. mode9 compression is akward(??) to use, because the lineLenght's
- are different, so we are stuck with mode 2, which is good enough */
-
+ are different, so we are stuck with mode 2, which is good enough */
+
/* set the line width */
- fprintf(fprn, "\033*r%dS", lineLen * 8);
+ fprintf(fprn, "\033*r%dS", lineLen*8);
count = mode2compress(plane1, plane1 + lineLen, bitData);
fprintf(fprn, "\033*b%dV", count);
- fwrite(bitData, sizeof(byte), count, fprn);
+ fwrite(bitData, sizeof(byte), count, fprn);
count = mode2compress(plane2, plane2 + lineLen, bitData);
fprintf(fprn, "\033*b%dV", count);
- fwrite(bitData, sizeof(byte), count, fprn);
+ fwrite(bitData, sizeof(byte), count, fprn);
count = mode2compress(plane3, plane3 + lineLen, bitData);
fprintf(fprn, "\033*b%dW", count);
- fwrite(bitData, sizeof(byte), count, fprn);
- }
+ fwrite(bitData, sizeof(byte), count, fprn);
+ }
}
}
/* end raster graphics */
fputs("\033*rbC", fprn); /* was \033*rB */
fputs("\033*r1U", fprn); /* back to 1 plane */
- /* put printer in known state */
- fputs("\033E", fprn);
-
+ /* put printer in known state */
+ fputs("\033E",fprn);
+
/* eject page */
- fputs("\033&l0H", fprn);
-
+ fputs("\033&l0H", fprn);
+
/* release allocated memory */
- if (bitData)
- free(bitData);
- if (plane1)
- free(plane1);
- if (plane2)
- free(plane2);
- if (plane3)
- free(plane3);
+ if (bitData) free(bitData);
+ if (plane1) free(plane1);
+ if (plane2) free(plane2);
+ if (plane3) free(plane3);
return 0;
}
@@ -232,52 +228,49 @@ djet500c_print_page(gx_device_printer * pdev, FILE * fprn)
*/
static int
-mode2compress(byte * row, byte * end_row, byte * compressed)
-{
- register byte *exam; /* word being examined in the row to compress */
- register byte *cptr = compressed; /* output pointer into compressed bytes */
+mode2compress(byte *row, byte *end_row, byte *compressed)
+{
+ register byte *exam; /* word being examined in the row to compress */
+ register byte *cptr = compressed; /* output pointer into compressed bytes */
int i, count, len;
byte test;
exam = row;
- while (1) {
+ while (1)
+ {
test = *exam++;
/* Advance exam until test==*exam or exam==end_row */
while ((test != *exam) && (exam < end_row))
- test = *exam++;
+ test = *exam++;
/* row points to start of differing bytes,
- exam points to start of consequtive series
- or to end of row */
- if (exam < end_row)
- exam--;
- len = exam - row;
- while (len > 0) {
- count = len;
- if (count > 127)
- count = 127;
- *cptr++ = count - 1;
- for (i = 0; i < count; i++)
- *cptr++ = *row++;
- len -= count;
- }
- if (exam >= end_row)
- break; /* done */
- exam++; /* skip first same byte */
- while ((test == *exam) && (exam < end_row)) /* skip all same bytes */
- exam++;
+ exam points to start of consequtive series
+ or to end of row */
+ if (exam<end_row) exam--;
+ len=exam-row;
+ while (len>0)
+ {
+ count=len;
+ if (count>127) count=127;
+ *cptr++=count-1;
+ for (i=0;i<count;i++) *cptr++ = *row++;
+ len-=count;
+ }
+ if (exam>=end_row) break; /* done */
+ exam++; /* skip first same byte */
+ while ((test == *exam) && (exam < end_row)) /* skip all same bytes */
+ exam++;
/* exam points now first different word or to end of data */
- len = exam - row;
- while (len > 0) {
- count = len;
- if (count > 127)
- count = 127;
- *cptr++ = (257 - count);
- *cptr++ = test;
- len -= count;
- }
- if (exam >= end_row)
- break; /* end of data */
- row = exam; /* row points to first dissimular byte */
- }
- return (cptr - compressed);
+ len = exam-row;
+ while (len>0)
+ {
+ count=len;
+ if (count>127) count=127;
+ *cptr++=(257-count);
+ *cptr++=test;
+ len-=count;
+ }
+ if (exam>=end_row) break; /* end of data */
+ row = exam; /* row points to first dissimular byte */
+ }
+ return (cptr-compressed);
}
diff --git a/gs/src/gdevdm24.c b/gs/src/gdevdm24.c
index 922ccee23..513fee28e 100644
--- a/gs/src/gdevdm24.c
+++ b/gs/src/gdevdm24.c
@@ -1,25 +1,25 @@
/* Copyright (C) 1992, 1996, 1997 Aladdin Enterprises. All rights reserved.
-
- This file is part of Aladdin Ghostscript.
-
- Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
- or distributor accepts any responsibility for the consequences of using it,
- or for whether it serves any particular purpose or works at all, unless he
- or she says so in writing. Refer to the Aladdin Ghostscript Free Public
- License (the "License") for full details.
-
- Every copy of Aladdin Ghostscript must include a copy of the License,
- normally in a plain ASCII text file named PUBLIC. The License grants you
- the right to copy, modify and redistribute Aladdin Ghostscript, but only
- under certain conditions described in the License. Among other things, the
- License requires that the copyright notice and this notice be preserved on
- all copies.
- */
+
+ This file is part of Aladdin Ghostscript.
+
+ Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
+ or distributor accepts any responsibility for the consequences of using it,
+ or for whether it serves any particular purpose or works at all, unless he
+ or she says so in writing. Refer to the Aladdin Ghostscript Free Public
+ License (the "License") for full details.
+
+ Every copy of Aladdin Ghostscript must include a copy of the License,
+ normally in a plain ASCII text file named PUBLIC. The License grants you
+ the right to copy, modify and redistribute Aladdin Ghostscript, but only
+ under certain conditions described in the License. Among other things, the
+ License requires that the copyright notice and this notice be preserved on
+ all copies.
+*/
#include "gdevprn.h"
-/* gdevdm24.c */
+/*Id: gdevdm24.c */
/* High-res 24Dot-matrix printer driver */
/* Supported printers
@@ -28,241 +28,262 @@
*/
/* Driver for NEC P6 */
-private dev_proc_print_page(necp6_print_page);
+private dev_proc_print_page (necp6_print_page);
gx_device_printer far_data gs_necp6_device =
-prn_device(prn_std_procs, "necp6",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- 360, 360,
- 0, 0, 0.5, 0, /* margins */
- 1, necp6_print_page);
+ prn_device (prn_std_procs, "necp6",
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ 360, 360,
+ 0, 0, 0.5, 0, /* margins */
+ 1, necp6_print_page);
/* Driver for Epson LQ850 */
/* I've tested this driver on a BJ300 with LQ850 emulation and there it produce correct 360x360dpi output. */
-private dev_proc_print_page(lq850_print_page);
+private dev_proc_print_page (lq850_print_page);
gx_device_printer gs_lq850_device =
-prn_device(prn_std_procs, "lq850",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- 360, 360,
- 0, 0, 0.5, 0, /* margins */
- 1, lq850_print_page);
+ prn_device (prn_std_procs, "lq850",
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ 360, 360,
+ 0, 0, 0.5, 0, /* margins */
+ 1, lq850_print_page);
/* ------ Internal routines ------ */
/* Forward references */
-private void dot24_output_run(P4(byte *, int, int, FILE *));
-private void dot24_improve_bitmap(P2(byte *, int));
+private void dot24_output_run (P4 (byte *, int, int, FILE *));
+private void dot24_improve_bitmap (P2 (byte *, int));
/* Send the page to the printer. */
private int
-dot24_print_page(gx_device_printer * pdev, FILE * prn_stream, char *init_string, int init_len)
+dot24_print_page (gx_device_printer *pdev, FILE *prn_stream, char *init_string, int init_len)
{
- int xres = pdev->x_pixels_per_inch;
- int yres = pdev->y_pixels_per_inch;
- int x_high = (xres == 360);
- int y_high = (yres == 360);
- int bits_per_column = (y_high ? 48 : 24);
- uint line_size = gdev_prn_raster(pdev);
- uint in_size = line_size * bits_per_column;
- byte *in = (byte *) gs_malloc(in_size, 1, "dot24_print_page (in)");
- uint out_size = ((pdev->width + 7) & -8) * 3;
- byte *out = (byte *) gs_malloc(out_size, 1, "dot24_print_page (out)");
- int y_passes = (y_high ? 2 : 1);
- int dots_per_space = xres / 10; /* pica space = 1/10" */
- int bytes_per_space = dots_per_space * 3;
- int skip = 0, lnum = 0, ypass;
-
- /* Check allocations */
- if (in == 0 || out == 0) {
- if (out)
- gs_free((char *)out, out_size, 1, "dot24_print_page (out)");
- if (in)
- gs_free((char *)in, in_size, 1, "dot24_print_page (in)");
- return_error(gs_error_VMerror);
+ int xres = pdev->x_pixels_per_inch;
+ int yres = pdev->y_pixels_per_inch;
+ int x_high = (xres == 360);
+ int y_high = (yres == 360);
+ int bits_per_column = (y_high ? 48 : 24);
+ uint line_size = gdev_prn_raster (pdev);
+ uint in_size = line_size * bits_per_column;
+ byte *in = (byte *) gs_malloc (in_size, 1, "dot24_print_page (in)");
+ uint out_size = ((pdev->width + 7) & -8) * 3;
+ byte *out = (byte *) gs_malloc (out_size, 1, "dot24_print_page (out)");
+ int y_passes = (y_high ? 2 : 1);
+ int dots_per_space = xres / 10; /* pica space = 1/10" */
+ int bytes_per_space = dots_per_space * 3;
+ int skip = 0, lnum = 0, ypass;
+
+ /* Check allocations */
+ if (in == 0 || out == 0)
+ {
+ if (out)
+ gs_free ((char *) out, out_size, 1, "dot24_print_page (out)");
+ if (in)
+ gs_free ((char *) in, in_size, 1, "dot24_print_page (in)");
+ return_error (gs_error_VMerror);
}
- /* Initialize the printer and reset the margins. */
- fwrite(init_string, init_len - 1, sizeof(char), prn_stream);
-
- fputc((int)(pdev->width / pdev->x_pixels_per_inch * 10) + 2,
- prn_stream);
-
- /* Print lines of graphics */
- while (lnum < pdev->height) {
- byte *inp;
- byte *in_end;
- byte *out_end;
- byte *out_blk;
- register byte *outp;
- int lcnt;
-
- /* Copy 1 scan line and test for all zero. */
- gdev_prn_copy_scan_lines(pdev, lnum, in, line_size);
- if (in[0] == 0
- && !memcmp((char *)in, (char *)in + 1, line_size - 1)) {
- lnum++;
- skip += 2 - y_high;
- continue;
+
+ /* Initialize the printer and reset the margins. */
+ fwrite (init_string, init_len - 1, sizeof (char), prn_stream);
+ fputc ((int) (pdev->width / pdev->x_pixels_per_inch * 10) + 2,
+ prn_stream);
+
+ /* Print lines of graphics */
+ while (lnum < pdev->height)
+ {
+ byte *inp;
+ byte *in_end;
+ byte *out_end;
+ byte *out_blk;
+ register byte *outp;
+ int lcnt;
+
+ /* Copy 1 scan line and test for all zero. */
+ gdev_prn_copy_scan_lines (pdev, lnum, in, line_size);
+ if (in[0] == 0
+ && !memcmp ((char *) in, (char *) in + 1, line_size - 1))
+ {
+ lnum++;
+ skip += 2 - y_high;
+ continue;
}
- /* Vertical tab to the appropriate position. */
- while ((skip >> 1) > 255) {
- fputs("\033J\377", prn_stream);
- skip -= 255 * 2;
+
+ /* Vertical tab to the appropriate position. */
+ while ((skip >> 1) > 255)
+ {
+ fputs ("\033J\377", prn_stream);
+ skip -= 255 * 2;
}
- if (skip) {
- if (skip >> 1)
- fprintf(prn_stream, "\033J%c", skip >> 1);
- if (skip & 1)
- fputc('\n', prn_stream);
+ if (skip)
+ {
+ if (skip >> 1)
+ fprintf (prn_stream, "\033J%c", skip >> 1);
+ if (skip & 1)
+ fputc ('\n', prn_stream);
}
- /* Copy the rest of the scan lines. */
- if (y_high) {
- inp = in + line_size;
- for (lcnt = 1; lcnt < 24; lcnt++, inp += line_size)
- if (!gdev_prn_copy_scan_lines(pdev, lnum + lcnt * 2, inp,
- line_size)) {
- memset(inp, 0, (24 - lcnt) * line_size);
- break;
- }
- inp = in + line_size * 24;
- for (lcnt = 0; lcnt < 24; lcnt++, inp += line_size)
- if (!gdev_prn_copy_scan_lines(pdev, lnum + lcnt * 2 + 1, inp,
- line_size)) {
- memset(inp, 0, (24 - lcnt) * line_size);
- break;
- }
- } else {
- lcnt = 1 + gdev_prn_copy_scan_lines(pdev, lnum + 1, in + line_size,
- in_size - line_size);
- if (lcnt < 24)
- /* Pad with lines of zeros. */
- memset(in + lcnt * line_size, 0, in_size - lcnt * line_size);
+
+ /* Copy the rest of the scan lines. */
+ if (y_high)
+ {
+ inp = in + line_size;
+ for (lcnt = 1; lcnt < 24; lcnt++, inp += line_size)
+ if (!gdev_prn_copy_scan_lines (pdev, lnum + lcnt * 2, inp,
+ line_size))
+ {
+ memset (inp, 0, (24 - lcnt) * line_size);
+ break;
+ }
+ inp = in + line_size * 24;
+ for (lcnt = 0; lcnt < 24; lcnt++, inp += line_size)
+ if (!gdev_prn_copy_scan_lines (pdev, lnum + lcnt * 2 + 1, inp,
+ line_size))
+ {
+ memset (inp, 0, (24 - lcnt) * line_size);
+ break;
+ }
+ }
+ else
+ {
+ lcnt = 1 + gdev_prn_copy_scan_lines (pdev, lnum + 1, in + line_size,
+ in_size - line_size);
+ if (lcnt < 24)
+ /* Pad with lines of zeros. */
+ memset (in + lcnt * line_size, 0, in_size - lcnt * line_size);
}
- for (ypass = 0; ypass < y_passes; ypass++) {
- out_end = out;
- inp = in;
- if (ypass)
- inp += line_size * 24;
- in_end = inp + line_size;
-
- for (; inp < in_end; inp++, out_end += 24) {
- memflip8x8(inp, line_size, out_end, 3);
- memflip8x8(inp + line_size * 8, line_size, out_end + 1, 3);
- memflip8x8(inp + line_size * 16, line_size, out_end + 2, 3);
+ for (ypass = 0; ypass < y_passes; ypass++)
+ {
+ out_end = out;
+ inp = in;
+ if (ypass)
+ inp += line_size * 24;
+ in_end = inp + line_size;
+
+ for (; inp < in_end; inp++, out_end += 24)
+ {
+ memflip8x8 (inp, line_size, out_end, 3);
+ memflip8x8 (inp + line_size * 8, line_size, out_end + 1, 3);
+ memflip8x8 (inp + line_size * 16, line_size, out_end + 2, 3);
}
- /* Remove trailing 0s. */
- while (out_end - 3 >= out && out_end[-1] == 0
- && out_end[-2] == 0 && out_end[-3] == 0)
- out_end -= 3;
-
- for (out_blk = outp = out; outp < out_end;) {
- /* Skip a run of leading 0s. */
- /* At least 10 are needed to make tabbing worth it. */
-
- if (outp[0] == 0 && outp + 12 <= out_end
- && outp[1] == 0 && outp[2] == 0
- && outp[3] == 0 && outp[4] == 0 && outp[5] == 0
- && outp[6] == 0 && outp[7] == 0 && outp[8] == 0
- && outp[9] == 0 && outp[10] == 0 && outp[11] == 0) {
- byte *zp = outp;
- int tpos;
- byte *newp;
-
- outp += 12;
- while (outp + 3 <= out_end
- && outp[0] == 0 && outp[1] == 0 && outp[2] == 0)
- outp += 3;
- tpos = (outp - out) / bytes_per_space;
- newp = out + tpos * bytes_per_space;
- if (newp > zp + 10) {
- /* Output preceding bit data. */
- /* only false at beginning of line */
- if (zp > out_blk) {
- if (x_high)
- dot24_improve_bitmap(out_blk, (int)(zp - out_blk));
- dot24_output_run(out_blk, (int)(zp - out_blk),
- x_high, prn_stream);
+ /* Remove trailing 0s. */
+ while (out_end - 3 >= out && out_end[-1] == 0
+ && out_end[-2] == 0 && out_end[-3] == 0)
+ out_end -= 3;
+
+ for (out_blk = outp = out; outp < out_end;)
+ {
+ /* Skip a run of leading 0s. */
+ /* At least 10 are needed to make tabbing worth it. */
+
+ if (outp[0] == 0 && outp + 12 <= out_end
+ && outp[1] == 0 && outp[2] == 0
+ && outp[3] == 0 && outp[4] == 0 && outp[5] == 0
+ && outp[6] == 0 && outp[7] == 0 && outp[8] == 0
+ && outp[9] == 0 && outp[10] == 0 && outp[11] == 0)
+ {
+ byte *zp = outp;
+ int tpos;
+ byte *newp;
+ outp += 12;
+ while (outp + 3 <= out_end
+ && outp[0] == 0 && outp[1] == 0 && outp[2] == 0)
+ outp += 3;
+ tpos = (outp - out) / bytes_per_space;
+ newp = out + tpos * bytes_per_space;
+ if (newp > zp + 10)
+ {
+ /* Output preceding bit data. */
+ /* only false at beginning of line */
+ if (zp > out_blk)
+ {
+ if (x_high)
+ dot24_improve_bitmap (out_blk, (int) (zp - out_blk));
+ dot24_output_run (out_blk, (int) (zp - out_blk),
+ x_high, prn_stream);
}
- /* Tab over to the appropriate position. */
- fprintf(prn_stream, "\033D%c%c\t", tpos, 0);
- out_blk = outp = newp;
+ /* Tab over to the appropriate position. */
+ fprintf (prn_stream, "\033D%c%c\t", tpos, 0);
+ out_blk = outp = newp;
}
- } else
- outp += 3;
+ }
+ else
+ outp += 3;
}
- if (outp > out_blk) {
- if (x_high)
- dot24_improve_bitmap(out_blk, (int)(outp - out_blk));
- dot24_output_run(out_blk, (int)(outp - out_blk), x_high,
- prn_stream);
+ if (outp > out_blk)
+ {
+ if (x_high)
+ dot24_improve_bitmap (out_blk, (int) (outp - out_blk));
+ dot24_output_run (out_blk, (int) (outp - out_blk), x_high,
+ prn_stream);
}
- fputc('\r', prn_stream);
- if (ypass < y_passes - 1)
- fputc('\n', prn_stream);
+
+ fputc ('\r', prn_stream);
+ if (ypass < y_passes - 1)
+ fputc ('\n', prn_stream);
}
- skip = 48 - y_high;
- lnum += bits_per_column;
+ skip = 48 - y_high;
+ lnum += bits_per_column;
}
- /* Eject the page and reinitialize the printer */
- fputs("\f\033@", prn_stream);
- fflush(prn_stream);
+ /* Eject the page and reinitialize the printer */
+ fputs ("\f\033@", prn_stream);
+ fflush (prn_stream);
- gs_free((char *)out, out_size, 1, "dot24_print_page (out)");
- gs_free((char *)in, in_size, 1, "dot24_print_page (in)");
+ gs_free ((char *) out, out_size, 1, "dot24_print_page (out)");
+ gs_free ((char *) in, in_size, 1, "dot24_print_page (in)");
- return 0;
+ return 0;
}
/* Output a single graphics command. */
private void
-dot24_output_run(byte * data, int count, int x_high, FILE * prn_stream)
+dot24_output_run (byte *data, int count, int x_high, FILE *prn_stream)
{
- int xcount = count / 3;
-
- fputc(033, prn_stream);
- fputc('*', prn_stream);
- fputc((x_high ? 40 : 39), prn_stream);
- fputc(xcount & 0xff, prn_stream);
- fputc(xcount >> 8, prn_stream);
- fwrite(data, 1, count, prn_stream);
+ int xcount = count / 3;
+ fputc (033, prn_stream);
+ fputc ('*', prn_stream);
+ fputc ((x_high ? 40 : 39), prn_stream);
+ fputc (xcount & 0xff, prn_stream);
+ fputc (xcount >> 8, prn_stream);
+ fwrite (data, 1, count, prn_stream);
}
/* If xdpi == 360, the P6 / LQ850 cannot print adjacent pixels. Clear the
second last pixel of every run of set pixels, so that the last pixel
is always printed. */
private void
-dot24_improve_bitmap(byte * data, int count)
+dot24_improve_bitmap (byte *data, int count)
{
- int i;
- register byte *p = data + 6;
-
- for (i = 6; i < count; i += 3, p += 3) {
- p[-6] &= ~(~p[0] & p[-3]);
- p[-5] &= ~(~p[1] & p[-2]);
- p[-4] &= ~(~p[2] & p[-1]);
- }
- p[-6] &= ~p[-3];
- p[-5] &= ~p[-2];
- p[-4] &= ~p[-1];
+ int i;
+ register byte *p = data + 6;
+
+ for (i = 6; i < count; i += 3, p += 3)
+ {
+ p[-6] &= ~(~p[0] & p[-3]);
+ p[-5] &= ~(~p[1] & p[-2]);
+ p[-4] &= ~(~p[2] & p[-1]);
+ }
+ p[-6] &= ~p[-3];
+ p[-5] &= ~p[-2];
+ p[-4] &= ~p[-1];
}
private int
-necp6_print_page(gx_device_printer * pdev, FILE * prn_stream)
+necp6_print_page(gx_device_printer *pdev, FILE *prn_stream)
{
- char necp6_init_string[] = "\033@\033P\033l\000\r\034\063\001\033Q";
-
- return dot24_print_page(pdev, prn_stream, necp6_init_string, sizeof(necp6_init_string));
+ char necp6_init_string [] = "\033@\033P\033l\000\r\034\063\001\033Q";
+
+ return dot24_print_page(pdev, prn_stream, necp6_init_string, sizeof(necp6_init_string));
}
private int
-lq850_print_page(gx_device_printer * pdev, FILE * prn_stream)
+lq850_print_page(gx_device_printer *pdev, FILE *prn_stream)
{
- char lq850_init_string[] = "\033@\033P\033l\000\r\033\053\001\033Q";
-
- return dot24_print_page(pdev, prn_stream, lq850_init_string, sizeof(lq850_init_string));
+ char lq850_init_string [] = "\033@\033P\033l\000\r\033\053\001\033Q";
+
+ return dot24_print_page(pdev, prn_stream, lq850_init_string, sizeof(lq850_init_string));
}
+
diff --git a/gs/src/gdevegaa.asm b/gs/src/gdevegaa.asm
index d2de0e365..4cf91d2c3 100644
--- a/gs/src/gdevegaa.asm
+++ b/gs/src/gdevegaa.asm
@@ -15,6 +15,7 @@
; License requires that the copyright notice and this notice be preserved on
; all copies.
+; Id: gdevegaa.asm
; gdevegaasm.asm
; Assembly code for Ghostscript PC frame buffer driver
diff --git a/gs/src/gdevemap.c b/gs/src/gdevemap.c
index b30b9f90e..816e958fc 100644
--- a/gs/src/gdevemap.c
+++ b/gs/src/gdevemap.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993 Aladdin Enterprises. All rights reserved.
+/* Copyright (C) 1993, 1998 Aladdin Enterprises. All rights reserved.
This file is part of Aladdin Ghostscript.
@@ -16,11 +16,11 @@
all copies.
*/
-/* gdevemap.c */
+/*Id: gdevemap.c */
/* Mappings between StandardEncoding and ISOLatin1Encoding */
#include "std.h"
-const byte far_data gs_map_std_to_iso[256] =
+const byte gs_map_std_to_iso[256] =
{
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -40,7 +40,7 @@ const byte far_data gs_map_std_to_iso[256] =
0, 230, 0, 0, 0, 144, 0, 0, 0, 248, 0, 223, 0, 0, 0, 0
};
-const byte far_data gs_map_iso_to_std[256] =
+const byte gs_map_iso_to_std[256] =
{
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
diff --git a/gs/src/gdevepsc.c b/gs/src/gdevepsc.c
index 219d35ae1..8650e54fc 100644
--- a/gs/src/gdevepsc.c
+++ b/gs/src/gdevepsc.c
@@ -1,22 +1,22 @@
/* Copyright (C) 1989, 1992, 1995 Aladdin Enterprises. All rights reserved.
-
- This file is part of Aladdin Ghostscript.
-
- Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
- or distributor accepts any responsibility for the consequences of using it,
- or for whether it serves any particular purpose or works at all, unless he
- or she says so in writing. Refer to the Aladdin Ghostscript Free Public
- License (the "License") for full details.
-
- Every copy of Aladdin Ghostscript must include a copy of the License,
- normally in a plain ASCII text file named PUBLIC. The License grants you
- the right to copy, modify and redistribute Aladdin Ghostscript, but only
- under certain conditions described in the License. Among other things, the
- License requires that the copyright notice and this notice be preserved on
- all copies.
- */
-
-/* gdevepsc.c */
+
+ This file is part of Aladdin Ghostscript.
+
+ Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
+ or distributor accepts any responsibility for the consequences of using it,
+ or for whether it serves any particular purpose or works at all, unless he
+ or she says so in writing. Refer to the Aladdin Ghostscript Free Public
+ License (the "License") for full details.
+
+ Every copy of Aladdin Ghostscript must include a copy of the License,
+ normally in a plain ASCII text file named PUBLIC. The License grants you
+ the right to copy, modify and redistribute Aladdin Ghostscript, but only
+ under certain conditions described in the License. Among other things, the
+ License requires that the copyright notice and this notice be preserved on
+ all copies.
+*/
+
+/*Id: gdevepsc.c */
/* Epson color dot-matrix printer driver by dave@exlog.com */
#include "gdevprn.h"
@@ -44,17 +44,17 @@
*/
#ifndef X_DPI
-# define X_DPI 180 /* pixels per inch */
+# define X_DPI 180 /* pixels per inch */
#endif
#ifndef Y_DPI
-# define Y_DPI 180 /* pixels per inch */
+# define Y_DPI 180 /* pixels per inch */
#endif
/*
- ** Colors for EPSON LQ-2550.
- **
- ** We map VIOLET to BLUE since this is the best we can do.
- */
+** Colors for EPSON LQ-2550.
+**
+** We map VIOLET to BLUE since this is the best we can do.
+*/
#define BLACK 0
#define MAGENTA 1
#define CYAN 2
@@ -65,96 +65,76 @@
#define WHITE 7
/*
- ** The offset in this array correspond to
- ** the ESC-r n value
- */
-static char rgb_color[2][2][2] =
-{
- BLACK, VIOLET, GREEN,
- CYAN, RED, MAGENTA,
- YELLOW, WHITE,
-};
+** The offset in this array correspond to
+** the ESC-r n value
+*/
+static char rgb_color[2][2][2] = {
+ BLACK, VIOLET, GREEN,
+ CYAN, RED, MAGENTA,
+ YELLOW, WHITE,
+ };
/* Map an RGB color to a printer color. */
#define cv_shift (sizeof(gx_color_value) * 8 - 1)
private gx_color_index
-epson_map_rgb_color(gx_device * dev,
- gx_color_value r, gx_color_value g, gx_color_value b)
+epson_map_rgb_color(gx_device *dev,
+ gx_color_value r, gx_color_value g, gx_color_value b)
{
- if (gx_device_has_color(dev)) {
+if (gx_device_has_color(dev))
+ {
/* use ^7 so WHITE is 0 for internal calculations */
- return (gx_color_index) rgb_color[r >> cv_shift][g >> cv_shift][b >> cv_shift] ^ 7;
- } else {
+ return (gx_color_index)rgb_color[r >> cv_shift][g >> cv_shift][b >> cv_shift] ^ 7;
+ }
+else
+ {
return gx_default_map_rgb_color(dev, r, g, b);
- }
+ }
}
/* Map the printer color back to RGB. */
private int
-epson_map_color_rgb(gx_device * dev, gx_color_index color,
- gx_color_value prgb[3])
+epson_map_color_rgb(gx_device *dev, gx_color_index color,
+ gx_color_value prgb[3])
{
#define c1 gx_max_color_value
- if (gx_device_has_color(dev))
- switch ((ushort) color ^ 7) {
- case BLACK:
- prgb[0] = 0;
- prgb[1] = 0;
- prgb[2] = 0;
- break;
- case VIOLET:
- prgb[0] = 0;
- prgb[1] = 0;
- prgb[2] = c1;
- break;
- case GREEN:
- prgb[0] = 0;
- prgb[1] = c1;
- prgb[2] = 0;
- break;
- case CYAN:
- prgb[0] = 0;
- prgb[1] = c1;
- prgb[2] = c1;
- break;
- case RED:
- prgb[0] = c1;
- prgb[1] = 0;
- prgb[2] = 0;
- break;
- case MAGENTA:
- prgb[0] = c1;
- prgb[1] = 0;
- prgb[2] = c1;
- break;
- case YELLOW:
- prgb[0] = c1;
- prgb[1] = c1;
- prgb[2] = 0;
- break;
- case WHITE:
- prgb[0] = c1;
- prgb[1] = c1;
- prgb[2] = c1;
- break;
- } else
- return gx_default_map_color_rgb(dev, color, prgb);
- return 0;
+if (gx_device_has_color(dev))
+ switch ((ushort)color ^ 7)
+ {
+ case BLACK:
+ prgb[0] = 0; prgb[1] = 0; prgb[2] = 0; break;
+ case VIOLET:
+ prgb[0] = 0; prgb[1] = 0; prgb[2] = c1; break;
+ case GREEN:
+ prgb[0] = 0; prgb[1] = c1; prgb[2] = 0; break;
+ case CYAN:
+ prgb[0] = 0; prgb[1] = c1; prgb[2] = c1; break;
+ case RED:
+ prgb[0] = c1; prgb[1] = 0; prgb[2] = 0; break;
+ case MAGENTA:
+ prgb[0] = c1; prgb[1] = 0; prgb[2] = c1; break;
+ case YELLOW:
+ prgb[0] = c1; prgb[1] = c1; prgb[2] = 0; break;
+ case WHITE:
+ prgb[0] = c1; prgb[1] = c1; prgb[2] = c1; break;
+ }
+ else
+ return gx_default_map_color_rgb(dev, color, prgb);
+ return 0;
}
/* The device descriptor */
private dev_proc_print_page(epsc_print_page);
private gx_device_procs epson_procs =
-prn_color_procs(gdev_prn_open, gdev_prn_output_page, gdev_prn_close,
- epson_map_rgb_color, epson_map_color_rgb);
+ prn_color_procs(gdev_prn_open, gdev_prn_output_page, gdev_prn_close,
+ epson_map_rgb_color, epson_map_color_rgb);
gx_device_printer far_data gs_epsonc_device =
-prn_device(epson_procs, "epsonc",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- X_DPI, Y_DPI,
- 0, 0, 0.25, 0, /* margins */
- 3, epsc_print_page);
+ prn_device(epson_procs, "epsonc",
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ X_DPI, Y_DPI,
+ 0, 0, 0.25, 0, /* margins */
+ 3, epsc_print_page);
/* ------ Internal routines ------ */
@@ -162,293 +142,317 @@ prn_device(epson_procs, "epsonc",
private void epsc_output_run(P6(byte *, int, int, char, FILE *, int));
/* Send the page to the printer. */
-#define DD 0x80 /* double density flag */
+#define DD 0x80 /* double density flag */
private int
-epsc_print_page(gx_device_printer * pdev, FILE * prn_stream)
-{
- static char graphics_modes_9[5] =
- {-1, 0 /*60 */ , 1 /*120 */ , -1, DD + 3 /*240 */
- };
- static char graphics_modes_24[7] =
- {-1, 32 /*60 */ , 33 /*120 */ , 39 /*180 */ ,
- -1, -1, DD + 40 /*360 */
- };
- int y_24pin = pdev->y_pixels_per_inch > 72;
- int y_mult = (y_24pin ? 3 : 1);
- int line_size = (pdev->width + 7) >> 3; /* always mono */
- int in_size = line_size * (8 * y_mult);
- byte *in = (byte *) gs_malloc(in_size + 1, 1, "epsc_print_page(in)");
- int out_size = ((pdev->width + 7) & -8) * y_mult;
- byte *out = (byte *) gs_malloc(out_size + 1, 1, "epsc_print_page(out)");
- int x_dpi = pdev->x_pixels_per_inch;
- char start_graphics =
- (y_24pin ? graphics_modes_24 : graphics_modes_9)[x_dpi / 60];
- int first_pass = (start_graphics & DD ? 1 : 0);
- int last_pass = first_pass * 2;
- int dots_per_space = x_dpi / 10; /* pica space = 1/10" */
- int bytes_per_space = dots_per_space * y_mult;
- int skip = 0, lnum = 0, pass;
-
+epsc_print_page(gx_device_printer *pdev, FILE *prn_stream)
+{ static char graphics_modes_9[5] =
+ { -1, 0 /*60*/, 1 /*120*/, -1, DD+3 /*240*/
+ };
+ static char graphics_modes_24[7] =
+ { -1, 32 /*60*/, 33 /*120*/, 39 /*180*/,
+ -1, -1, DD+40 /*360*/
+ };
+ int y_24pin = pdev->y_pixels_per_inch > 72;
+ int y_mult = (y_24pin ? 3 : 1);
+ int line_size = (pdev->width + 7) >> 3; /* always mono */
+ int in_size = line_size * (8 * y_mult);
+ byte *in = (byte *)gs_malloc(in_size+1, 1, "epsc_print_page(in)");
+ int out_size = ((pdev->width + 7) & -8) * y_mult;
+ byte *out = (byte *)gs_malloc(out_size+1, 1, "epsc_print_page(out)");
+ int x_dpi = pdev->x_pixels_per_inch;
+ char start_graphics =
+ (y_24pin ? graphics_modes_24 : graphics_modes_9)[x_dpi / 60];
+ int first_pass = (start_graphics & DD ? 1 : 0);
+ int last_pass = first_pass * 2;
+ int dots_per_space = x_dpi / 10; /* pica space = 1/10" */
+ int bytes_per_space = dots_per_space * y_mult;
+ int skip = 0, lnum = 0, pass;
/* declare color buffer and related vars */
- byte *color_in;
- int color_line_size, color_in_size;
- int spare_bits = (pdev->width % 8); /* left over bits to go to margin */
- int whole_bits = pdev->width - spare_bits;
-
- /* Check allocations */
- if (in == 0 || out == 0) {
- if (in)
- gs_free((char *)in, in_size + 1, 1, "epsc_print_page(in)");
- if (out)
- gs_free((char *)out, out_size + 1, 1, "epsc_print_page(out)");
- return -1;
- }
- /* Initialize the printer and reset the margins. */
- fwrite("\033@\033P\033l\000\033Q\377\033U\001\r", 1, 14, prn_stream);
-
-/* Create color buffer */
- if (gx_device_has_color(pdev)) {
- color_line_size = gdev_mem_bytes_per_scan_line((gx_device *) pdev);
- color_in_size = color_line_size * (8 * y_mult);
- if ((color_in = (byte *) gs_malloc(color_in_size + 1, 1,
- "epsc_print_page(color)")) == 0) {
- gs_free((char *)in, in_size + 1, 1, "epsc_print_page(in)");
- gs_free((char *)out, out_size + 1, 1, "epsc_print_page(out)");
- return (-1);
- }
- } else {
- color_in = in;
- color_in_size = in_size;
- color_line_size = line_size;
- }
-
- /* Print lines of graphics */
- while (lnum < pdev->height) {
- int lcnt;
- byte *nextcolor = NULL; /* position where next color appears */
- byte *nextmono = NULL; /* position to map next color */
-
- /* Copy 1 scan line and test for all zero. */
- gdev_prn_copy_scan_lines(pdev, lnum, color_in, color_line_size);
-
- if (color_in[0] == 0 &&
- !memcmp((char *)color_in, (char *)color_in + 1, color_line_size - 1)
- ) {
- lnum++;
- skip += 3 / y_mult;
- continue;
- }
- /* Vertical tab to the appropriate position. */
- while (skip > 255) {
- fputs("\033J\377", prn_stream);
- skip -= 255;
- }
- if (skip)
- fprintf(prn_stream, "\033J%c", skip);
-
- /* Copy the rest of the scan lines. */
- lcnt = 1 + gdev_prn_copy_scan_lines(pdev, lnum + 1,
- color_in + color_line_size, color_in_size - color_line_size);
-
- if (lcnt < 8 * y_mult) {
- memset((char *)(color_in + lcnt * color_line_size), 0,
- color_in_size - lcnt * color_line_size);
- if (gx_device_has_color(pdev)) /* clear the work buffer */
- memset((char *)(in + lcnt * line_size), 0,
- in_size - lcnt * line_size);
- }
-/*
- ** We need to create a normal epson scan line from our color scan line
- ** We do this by setting a bit in the "in" buffer if the pixel byte is set
- ** to any color. We then search for any more pixels of that color, setting
- ** "in" accordingly. If any other color is found, we save it for the next
- ** pass. There may be up to 7 passes.
- ** In the future, we should make the passes so as to maximize the
- ** life of the color ribbon (i.e. go lightest to darkest).
- */
- do {
- byte *inp = in;
- byte *in_end = in + line_size;
- byte *out_end = out;
- byte *out_blk;
- register byte *outp;
-
- if (gx_device_has_color(pdev)) {
- register i, j;
- register byte *outbuf, *realbuf;
- byte current_color;
- int end_next_bits = whole_bits;
- int lastbits;
-
-/* Move to the point in the scanline that has a new color */
- if (nextcolor) {
- realbuf = nextcolor;
- outbuf = nextmono;
- memset((char *)in, 0, (nextmono - in));
- i = nextcolor - color_in;
- nextcolor = NULL;
- end_next_bits = (i / color_line_size) * color_line_size
- + whole_bits;
- } else {
- i = 0;
- realbuf = color_in;
- outbuf = in;
- nextcolor = NULL;
+ byte *color_in;
+ int color_line_size, color_in_size;
+ int spare_bits = (pdev->width % 8); /* left over bits to go to margin */
+ int whole_bits = pdev->width - spare_bits;
+
+ /* Check allocations */
+ if ( in == 0 || out == 0 )
+ { if ( in ) gs_free((char *)in, in_size+1, 1, "epsc_print_page(in)");
+ if ( out ) gs_free((char *)out, out_size+1, 1, "epsc_print_page(out)");
+ return -1;
+ }
+
+ /* Initialize the printer and reset the margins. */
+ fwrite("\033@\033P\033l\000\033Q\377\033U\001\r", 1, 14, prn_stream);
+
+/* Create color buffer */
+ if (gx_device_has_color(pdev))
+ {
+ color_line_size = gdev_mem_bytes_per_scan_line((gx_device *)pdev);
+ color_in_size = color_line_size * (8 * y_mult);
+ if((color_in = (byte *)gs_malloc(color_in_size+1, 1,
+ "epsc_print_page(color)")) == 0)
+ {
+ gs_free((char *)in, in_size+1, 1, "epsc_print_page(in)");
+ gs_free((char *)out, out_size+1, 1, "epsc_print_page(out)");
+ return(-1);
+ }
}
-/* move thru the color buffer, turning on the appropriate
- ** bit in the "mono" buffer", setting pointers to the next
- ** color and changing the color output of the epson
- */
- for (current_color = 0; i <= color_in_size && outbuf < in + in_size; outbuf++) {
-/* Remember, line_size is rounded up to next whole byte
- ** whereas color_line_size is the proper length
- ** We only want to set the proper bits in the last line_size byte.
- */
- if (spare_bits && i == end_next_bits) {
- end_next_bits = whole_bits + i + spare_bits;
- lastbits = 8 - spare_bits;
- } else
- lastbits = 0;
-
- for (*outbuf = 0, j = 8; --j >= lastbits && i <= color_in_size;
- realbuf++, i++) {
- if (*realbuf) {
- if (current_color > 0) {
- if (*realbuf == current_color) {
- *outbuf |= 1 << j;
- *realbuf = 0; /* throw this byte away */
+ else
+ {
+ color_in = in;
+ color_in_size = in_size;
+ color_line_size = line_size;
+ }
+
+ /* Print lines of graphics */
+ while ( lnum < pdev->height )
+ {
+ int lcnt;
+ byte *nextcolor = NULL; /* position where next color appears */
+ byte *nextmono = NULL; /* position to map next color */
+
+ /* Copy 1 scan line and test for all zero. */
+ gdev_prn_copy_scan_lines(pdev, lnum, color_in, color_line_size);
+
+ if ( color_in[0] == 0 &&
+ !memcmp((char *)color_in, (char *)color_in + 1, color_line_size - 1)
+ )
+ { lnum++;
+ skip += 3 / y_mult;
+ continue;
+ }
+
+ /* Vertical tab to the appropriate position. */
+ while ( skip > 255 )
+ { fputs("\033J\377", prn_stream);
+ skip -= 255;
+ }
+ if ( skip )
+ fprintf(prn_stream, "\033J%c", skip);
+
+ /* Copy the rest of the scan lines. */
+ lcnt = 1 + gdev_prn_copy_scan_lines(pdev, lnum + 1,
+ color_in + color_line_size, color_in_size - color_line_size);
+
+ if ( lcnt < 8 * y_mult )
+ {
+ memset((char *)(color_in + lcnt * color_line_size), 0,
+ color_in_size - lcnt * color_line_size);
+ if (gx_device_has_color(pdev)) /* clear the work buffer */
+ memset((char *)(in + lcnt * line_size), 0,
+ in_size - lcnt * line_size);
+ }
+
+/*
+** We need to create a normal epson scan line from our color scan line
+** We do this by setting a bit in the "in" buffer if the pixel byte is set
+** to any color. We then search for any more pixels of that color, setting
+** "in" accordingly. If any other color is found, we save it for the next
+** pass. There may be up to 7 passes.
+** In the future, we should make the passes so as to maximize the
+** life of the color ribbon (i.e. go lightest to darkest).
+*/
+ do
+ {
+ byte *inp = in;
+ byte *in_end = in + line_size;
+ byte *out_end = out;
+ byte *out_blk;
+ register byte *outp;
+
+ if (gx_device_has_color(pdev))
+ {
+ register i,j;
+ register byte *outbuf, *realbuf;
+ byte current_color;
+ int end_next_bits = whole_bits;
+ int lastbits;
+
+/* Move to the point in the scanline that has a new color */
+ if (nextcolor)
+ {
+ realbuf = nextcolor;
+ outbuf = nextmono;
+ memset((char *)in, 0, (nextmono - in));
+ i = nextcolor - color_in;
+ nextcolor = NULL;
+ end_next_bits = (i / color_line_size) * color_line_size
+ + whole_bits;
+ }
+ else
+ {
+ i = 0;
+ realbuf = color_in;
+ outbuf = in;
+ nextcolor = NULL;
}
- /* save this location for next pass */
- else if (nextcolor == NULL) {
- nextcolor = realbuf - (7 - j);
- nextmono = outbuf;
+/* move thru the color buffer, turning on the appropriate
+** bit in the "mono" buffer", setting pointers to the next
+** color and changing the color output of the epson
+*/
+ for (current_color = 0; i <= color_in_size && outbuf < in + in_size; outbuf++)
+ {
+/* Remember, line_size is rounded up to next whole byte
+** whereas color_line_size is the proper length
+** We only want to set the proper bits in the last line_size byte.
+*/
+ if (spare_bits && i == end_next_bits)
+ {
+ end_next_bits = whole_bits + i + spare_bits;
+ lastbits = 8 - spare_bits;
+ }
+ else
+ lastbits = 0;
+
+ for (*outbuf = 0, j = 8; --j >= lastbits && i <= color_in_size;
+ realbuf++,i++)
+ {
+ if (*realbuf)
+ {
+ if (current_color > 0)
+ {
+ if (*realbuf == current_color)
+ {
+ *outbuf |= 1 << j;
+ *realbuf = 0; /* throw this byte away */
+ }
+ /* save this location for next pass */
+ else if (nextcolor == NULL)
+ {
+ nextcolor = realbuf - (7 - j);
+ nextmono = outbuf;
+ }
+ }
+ else
+ {
+ *outbuf |= 1 << j;
+ current_color = *realbuf; /* set color */
+ *realbuf = 0;
+ }
+ }
+ }
}
- } else {
- *outbuf |= 1 << j;
- current_color = *realbuf; /* set color */
- *realbuf = 0;
- }
+ *outbuf = 0; /* zero the end, for safe keeping */
+/* Change color on the EPSON, current_color must be set
+** but lets check anyway
+*/
+ if (current_color)
+ fprintf(prn_stream,"\033r%d",current_color ^ 7);
}
+
+ /* We have to 'transpose' blocks of 8 pixels x 8 lines, */
+ /* because that's how the printer wants the data. */
+ /* If we are in a 24-pin mode, we have to transpose */
+ /* groups of 3 lines at a time. */
+
+ if ( y_24pin )
+ { for ( ; inp < in_end; inp++, out_end += 24 )
+ { gdev_prn_transpose_8x8(inp, line_size, out_end, 3);
+ gdev_prn_transpose_8x8(inp + line_size * 8, line_size, out_end + 1, 3);
+ gdev_prn_transpose_8x8(inp + line_size * 16, line_size, out_end + 2, 3);
}
- }
- *outbuf = 0; /* zero the end, for safe keeping */
-/* Change color on the EPSON, current_color must be set
- ** but lets check anyway
- */
- if (current_color)
- fprintf(prn_stream, "\033r%d", current_color ^ 7);
- }
- /* We have to 'transpose' blocks of 8 pixels x 8 lines, */
- /* because that's how the printer wants the data. */
- /* If we are in a 24-pin mode, we have to transpose */
- /* groups of 3 lines at a time. */
-
- if (y_24pin) {
- for (; inp < in_end; inp++, out_end += 24) {
- gdev_prn_transpose_8x8(inp, line_size, out_end, 3);
- gdev_prn_transpose_8x8(inp + line_size * 8, line_size, out_end + 1, 3);
- gdev_prn_transpose_8x8(inp + line_size * 16, line_size, out_end + 2, 3);
- }
- /* Remove trailing 0s. */
- while (out_end > out && out_end[-1] == 0 &&
- out_end[-2] == 0 && out_end[-3] == 0
- )
- out_end -= 3;
- } else {
- for (; inp < in_end; inp++, out_end += 8) {
- gdev_prn_transpose_8x8(inp, line_size, out_end, 1);
- }
- /* Remove trailing 0s. */
- while (out_end > out && out_end[-1] == 0)
- out_end--;
- }
-
- for (pass = first_pass; pass <= last_pass; pass++) {
- for (out_blk = outp = out; outp < out_end;) { /* Skip a run of leading 0s. */
- /* At least 10 are needed to make tabbing worth it. */
- /* We do everything by 3's to avoid having to make */
- /* different cases for 9- and 24-pin. */
-
- if (*outp == 0 && outp + 12 <= out_end &&
+ /* Remove trailing 0s. */
+ while ( out_end > out && out_end[-1] == 0 &&
+ out_end[-2] == 0 && out_end[-3] == 0
+ )
+ out_end -= 3;
+ }
+ else
+ { for ( ; inp < in_end; inp++, out_end += 8 )
+ { gdev_prn_transpose_8x8(inp, line_size, out_end, 1);
+ }
+ /* Remove trailing 0s. */
+ while ( out_end > out && out_end[-1] == 0 )
+ out_end--;
+ }
+
+ for ( pass = first_pass; pass <= last_pass; pass++ )
+ {
+ for ( out_blk = outp = out; outp < out_end; )
+ { /* Skip a run of leading 0s. */
+ /* At least 10 are needed to make tabbing worth it. */
+ /* We do everything by 3's to avoid having to make */
+ /* different cases for 9- and 24-pin. */
+
+ if ( *outp == 0 && outp + 12 <= out_end &&
outp[1] == 0 && outp[2] == 0 &&
(outp[3] | outp[4] | outp[5]) == 0 &&
(outp[6] | outp[7] | outp[8]) == 0 &&
(outp[9] | outp[10] | outp[11]) == 0
- ) {
- byte *zp = outp;
+ )
+ { byte *zp = outp;
int tpos;
byte *newp;
-
outp += 12;
- while (outp + 3 <= out_end && *outp == 0 &&
- outp[1] == 0 && outp[2] == 0
- )
- outp += 3;
+ while ( outp + 3 <= out_end && *outp == 0 &&
+ outp[1] == 0 && outp[2] == 0
+ )
+ outp += 3;
tpos = (outp - out) / bytes_per_space;
newp = out + tpos * bytes_per_space;
- if (newp > zp + 10) { /* Output preceding bit data. */
- if (zp > out_blk) /* only false at */
- /* beginning of line */
- epsc_output_run(out_blk, (int)(zp - out_blk),
- y_mult, start_graphics,
- prn_stream, pass);
- /* Tab over to the appropriate position. */
- fprintf(prn_stream, "\033D%c%c\t", tpos, 0);
- out_blk = outp = newp;
- }
- } else
+ if ( newp > zp + 10 )
+ { /* Output preceding bit data. */
+ if ( zp > out_blk ) /* only false at */
+ /* beginning of line */
+ epsc_output_run(out_blk, (int)(zp - out_blk),
+ y_mult, start_graphics,
+ prn_stream, pass);
+ /* Tab over to the appropriate position. */
+ fprintf(prn_stream, "\033D%c%c\t", tpos, 0);
+ out_blk = outp = newp;
+ }
+ }
+ else
outp += y_mult;
- }
- if (outp > out_blk)
- epsc_output_run(out_blk, (int)(outp - out_blk),
- y_mult, start_graphics,
- prn_stream, pass);
-
- fputc('\r', prn_stream);
- }
- } while (nextcolor);
- skip = 24;
- lnum += 8 * y_mult;
- }
-
- /* Eject the page and reinitialize the printer */
- fputs("\f\033@", prn_stream);
-
-
- gs_free((char *)out, out_size + 1, 1, "epsc_print_page(out)");
- gs_free((char *)in, in_size + 1, 1, "epsc_print_page(in)");
- if (gx_device_has_color(pdev))
- gs_free((char *)color_in, color_in_size + 1, 1, "epsc_print_page(rin)");
- return 0;
+ }
+ if ( outp > out_blk )
+ epsc_output_run(out_blk, (int)(outp - out_blk),
+ y_mult, start_graphics,
+ prn_stream, pass);
+
+ fputc('\r', prn_stream);
+ }
+ } while (nextcolor);
+ skip = 24;
+ lnum += 8 * y_mult;
+ }
+
+ /* Eject the page and reinitialize the printer */
+ fputs("\f\033@", prn_stream);
+
+
+ gs_free((char *)out, out_size+1, 1, "epsc_print_page(out)");
+ gs_free((char *)in, in_size+1, 1, "epsc_print_page(in)");
+ if (gx_device_has_color(pdev))
+ gs_free((char *)color_in, color_in_size+1, 1, "epsc_print_page(rin)");
+ return 0;
}
/* Output a single graphics command. */
/* pass=0 for all columns, 1 for even columns, 2 for odd columns. */
private void
-epsc_output_run(byte * data, int count, int y_mult,
- char start_graphics, FILE * prn_stream, int pass)
-{
- int xcount = count / y_mult;
-
- fputc(033, prn_stream);
- if (!(start_graphics & ~3)) {
- fputc("KLYZ"[start_graphics], prn_stream);
- } else {
- fputc('*', prn_stream);
- fputc(start_graphics & ~DD, prn_stream);
- }
- fputc(xcount & 0xff, prn_stream);
- fputc(xcount >> 8, prn_stream);
- if (!pass)
- fwrite((char *)data, 1, count, prn_stream);
- else { /* Only write every other column of y_mult bytes. */
- int which = pass;
- byte *dp = data;
- register int i, j;
-
- for (i = 0; i < xcount; i++, which++)
- for (j = 0; j < y_mult; j++, dp++) {
- putc(((which & 1) ? *dp : 0), prn_stream);
- }
- }
+epsc_output_run(byte *data, int count, int y_mult,
+ char start_graphics, FILE *prn_stream, int pass)
+{ int xcount = count / y_mult;
+ fputc(033, prn_stream);
+ if ( !(start_graphics & ~3) )
+ { fputc("KLYZ"[start_graphics], prn_stream);
+ }
+ else
+ { fputc('*', prn_stream);
+ fputc(start_graphics & ~DD, prn_stream);
+ }
+ fputc(xcount & 0xff, prn_stream);
+ fputc(xcount >> 8, prn_stream);
+ if ( !pass )
+ fwrite((char *)data, 1, count, prn_stream);
+ else
+ { /* Only write every other column of y_mult bytes. */
+ int which = pass;
+ byte *dp = data;
+ register int i, j;
+ for ( i = 0; i < xcount; i++, which++ )
+ for ( j = 0; j < y_mult; j++, dp++ )
+ { putc(((which & 1) ? *dp : 0), prn_stream);
+ }
+ }
}
diff --git a/gs/src/gdevepsn.c b/gs/src/gdevepsn.c
index 2cdc99a10..ae96ed90d 100644
--- a/gs/src/gdevepsn.c
+++ b/gs/src/gdevepsn.c
@@ -1,22 +1,22 @@
-/* Copyright (C) 1989-1994 Aladdin Enterprises. All rights reserved.
-
- This file is part of Aladdin Ghostscript.
-
- Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
- or distributor accepts any responsibility for the consequences of using it,
- or for whether it serves any particular purpose or works at all, unless he
- or she says so in writing. Refer to the Aladdin Ghostscript Free Public
- License (the "License") for full details.
-
- Every copy of Aladdin Ghostscript must include a copy of the License,
- normally in a plain ASCII text file named PUBLIC. The License grants you
- the right to copy, modify and redistribute Aladdin Ghostscript, but only
- under certain conditions described in the License. Among other things, the
- License requires that the copyright notice and this notice be preserved on
- all copies.
- */
-
-/* gdevepsn.c */
+/* Copyright (C) 1989-1994, 1998 Aladdin Enterprises. All rights reserved.
+
+ This file is part of Aladdin Ghostscript.
+
+ Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
+ or distributor accepts any responsibility for the consequences of using it,
+ or for whether it serves any particular purpose or works at all, unless he
+ or she says so in writing. Refer to the Aladdin Ghostscript Free Public
+ License (the "License") for full details.
+
+ Every copy of Aladdin Ghostscript must include a copy of the License,
+ normally in a plain ASCII text file named PUBLIC. The License grants you
+ the right to copy, modify and redistribute Aladdin Ghostscript, but only
+ under certain conditions described in the License. Among other things, the
+ License requires that the copyright notice and this notice be preserved on
+ all copies.
+*/
+
+/*Id: gdevepsn.c */
/*
* Epson (and similar) dot-matrix printer driver for Ghostscript.
*
@@ -29,10 +29,13 @@
* vertical line. 'ibmpro' is for the IBM ProPrinter, which has slightly
* (but only slightly) different control codes.
*
- * Thanks to David Wexelblat (dwex@mtgzfs3.att.com) for the 'eps9high' code,
- * to Guenther Thomsen (thomsen@cs.tu-berlin.de) for the 'eps9mid' code,
- * and to James W. Birdsall (jwbirdsa@picarefy.picarefy.com) for the
- * 'ibmpro' modifications.
+ * Thanks to:
+ * David Wexelblat (dwex@mtgzfs3.att.com) for the 'eps9high' code;
+ * Guenther Thomsen (thomsen@cs.tu-berlin.de) for the 'eps9mid' code;
+ * James W. Birdsall (jwbirdsa@picarefy.picarefy.com) for the
+ * 'ibmpro' modifications;
+ * Russell J. Lang (rjl@aladdin.com) for the 180x60 and 240x180 dpi
+ * enhancements.
*/
#include "gdevprn.h"
@@ -41,7 +44,7 @@
* support settable tabs, pitch, or left margin. (This should be a
* run-time property....) Note: the IBM ProPrinter is archaic.
*/
-/*#define ARCHAIC 1 */
+/*#define ARCHAIC 1*/
/*
* Define whether the printer is a Panasonic 9-pin printer,
@@ -49,7 +52,7 @@
* when a line contains a lot of graphics commands,
* requiring a "backspace, space" sequence before a tab.
*/
-/*#define TAB_HICCUP 1 */
+/*#define TAB_HICCUP 1*/
/*
* Define the minimum distance for which it's worth converting white space
@@ -95,42 +98,42 @@
/* The device descriptors */
private dev_proc_print_page(epson_print_page);
-private dev_proc_print_page(eps9mid_print_page);
+private dev_proc_print_page(eps9mid_print_page);
private dev_proc_print_page(eps9high_print_page);
private dev_proc_print_page(ibmpro_print_page);
/* Standard Epson device */
gx_device_printer far_data gs_epson_device =
-prn_device(prn_std_procs, "epson",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- X_DPI, Y_DPI,
- 0.2, 0.0, 0.0, 0.0, /* margins */
- 1, epson_print_page);
+ prn_device(prn_std_procs, "epson",
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ X_DPI, Y_DPI,
+ 0.2, 0.0, 0.0, 0.0, /* margins */
+ 1, epson_print_page);
/* Mid-res (interleaved, 1 pass per line) 9-pin device */
-gx_device_printer far_data gs_eps9mid_device =
-prn_device(prn_std_procs, "eps9mid",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- X_DPI, 3 * Y_BASERES,
- 0.2, 0.0, 0, 0.0, /* margins */
- 1, eps9mid_print_page);
+gx_device_printer far_data gs_eps9mid_device =
+ prn_device(prn_std_procs, "eps9mid",
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ X_DPI, 3*Y_BASERES,
+ 0.2, 0.0, 0, 0.0, /* margins */
+ 1, eps9mid_print_page);
/* High-res (interleaved) 9-pin device */
-gx_device_printer far_data gs_eps9high_device =
-prn_device(prn_std_procs, "eps9high",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- X_DPI, 3 * Y_BASERES,
- 0.2, 0.0, 0.0, 0.0, /* margins */
- 1, eps9high_print_page);
+gx_device_printer far_data gs_eps9high_device =
+ prn_device(prn_std_procs, "eps9high",
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ X_DPI, 3*Y_BASERES,
+ 0.2, 0.0, 0.0, 0.0, /* margins */
+ 1, eps9high_print_page);
/* IBM ProPrinter device */
gx_device_printer far_data gs_ibmpro_device =
-prn_device(prn_std_procs, "ibmpro",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- X_DPI, Y_DPI,
- 0.2, 0.0, 0.0, 0.0, /* margins */
- 1, ibmpro_print_page);
+ prn_device(prn_std_procs, "ibmpro",
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ X_DPI, Y_DPI,
+ 0.2, 0.0, 0.0, 0.0, /* margins */
+ 1, ibmpro_print_page);
/* ------ Driver procedures ------ */
@@ -138,198 +141,226 @@ prn_device(prn_std_procs, "ibmpro",
private void eps_output_run(P6(byte *, int, int, char, FILE *, int));
/* Send the page to the printer. */
-#define DD 0x40 /* double density flag */
+#define DD 0x40 /* double density flag */
private int
-eps_print_page(gx_device_printer * pdev, FILE * prn_stream, int y_9pin_high,
- const char *init_string, int init_length, const char *end_string,
- int archaic, int tab_hiccup)
-{
- static const char graphics_modes_9[5] =
- {
- -1, 0 /*60 */ , 1 /*120 */ , -1, DD + 3 /*240 */
- };
-
- static const char graphics_modes_24[7] =
- {
- -1, 32 /*60 */ , 33 /*120 */ , 39 /*180 */ ,
- -1, -1, DD + 40 /*360 */
- };
-
- int y_24pin = (y_9pin_high ? 0 : pdev->y_pixels_per_inch > 72);
- int in_y_mult = ((y_24pin | y_9pin_high) ? 3 : 1);
- int line_size = gdev_mem_bytes_per_scan_line((gx_device *) pdev);
-
- /* Note that in_size is a multiple of 8. */
- int in_size = line_size * (8 * in_y_mult);
- byte *buf1 = (byte *) gs_malloc(in_size, 1, "eps_print_page(buf1)");
- byte *buf2 = (byte *) gs_malloc(in_size, 1, "eps_print_page(buf2)");
- byte *in = buf1;
- byte *out = buf2;
- int out_y_mult = (y_24pin ? 3 : 1);
- int x_dpi = pdev->x_pixels_per_inch;
- char start_graphics =
- (y_24pin ? graphics_modes_24 : graphics_modes_9)[x_dpi / 60];
- int first_pass = (start_graphics & DD ? 1 : 0);
- int last_pass = first_pass * (y_9pin_high == 2 ? 1 : 2);
- int y_passes = (y_9pin_high ? 3 : 1);
- int dots_per_space = x_dpi / 10; /* pica space = 1/10" */
- int bytes_per_space = dots_per_space * out_y_mult;
- int tab_min_pixels = x_dpi * MIN_TAB_10THS / 10;
- int skip = 0, lnum = 0, pass, ypass;
-
- /* Check allocations */
- if (buf1 == 0 || buf2 == 0) {
- if (buf1)
- gs_free((char *)buf1, in_size, 1, "eps_print_page(buf1)");
- if (buf2)
- gs_free((char *)buf2, in_size, 1, "eps_print_page(buf2)");
- return_error(gs_error_VMerror);
- }
- /* Initialize the printer and reset the margins. */
- fwrite(init_string, 1, init_length, prn_stream);
- if (init_string[init_length - 1] == 'Q')
- fputc((int)(pdev->width / pdev->x_pixels_per_inch * 10) + 2,
- prn_stream);
-
- /* Calculate the minimum tab distance. */
- if (tab_min_pixels < max(MIN_TAB_PIXELS, 3))
- tab_min_pixels = max(MIN_TAB_PIXELS, 3);
- tab_min_pixels -= tab_min_pixels % 3; /* simplify life */
-
- /* Print lines of graphics */
- while (lnum < pdev->height) {
- byte *in_data;
- byte *inp;
- byte *in_end;
- byte *out_end;
- byte *out_blk;
- register byte *outp;
- int lcnt;
-
- /* Copy 1 scan line and test for all zero. */
- gdev_prn_get_bits(pdev, lnum, in, &in_data);
- if (in_data[0] == 0 &&
- !memcmp((char *)in_data, (char *)in_data + 1, line_size - 1)
- ) {
- lnum++;
- skip += 3 / in_y_mult;
- continue;
- }
- /* Vertical tab to the appropriate position. */
- while (skip > 255) {
- fputs("\033J\377", prn_stream);
- skip -= 255;
- }
- if (skip) {
- fprintf(prn_stream, "\033J%c", skip);
- }
- /* Copy the the scan lines. */
- lcnt = gdev_prn_copy_scan_lines(pdev, lnum, in, in_size);
- if (lcnt < 8 * in_y_mult) { /* Pad with lines of zeros. */
- memset(in + lcnt * line_size, 0,
- in_size - lcnt * line_size);
+eps_print_page(gx_device_printer *pdev, FILE *prn_stream, int y_9pin_high,
+ const char *init_string, int init_length, const char *end_string,
+ int archaic, int tab_hiccup)
+{
+ static const char graphics_modes_9[5] =
+ {
+ -1, 0 /*60*/, 1 /*120*/, 7 /*180*/, DD+3 /*240*/
+ };
+
+ static const char graphics_modes_24[7] =
+ {
+ -1, 32 /*60*/, 33 /*120*/, 39 /*180*/,
+ DD+35 /*240*/, -1, DD+40 /*360*/
+ };
+
+ int y_24pin = (y_9pin_high ? 0 : pdev->y_pixels_per_inch > 72);
+ int in_y_mult = ((y_24pin | y_9pin_high) ? 3 : 1);
+ int line_size = gdev_mem_bytes_per_scan_line((gx_device *)pdev);
+ /* Note that in_size is a multiple of 8. */
+ int in_size = line_size * (8 * in_y_mult);
+ byte *buf1 = (byte *)gs_malloc(in_size, 1, "eps_print_page(buf1)");
+ byte *buf2 = (byte *)gs_malloc(in_size, 1, "eps_print_page(buf2)");
+ byte *in = buf1;
+ byte *out = buf2;
+ int out_y_mult = (y_24pin ? 3 : 1);
+ int x_dpi = pdev->x_pixels_per_inch;
+ char start_graphics =
+ (y_24pin ? graphics_modes_24 : graphics_modes_9)[x_dpi / 60];
+ int first_pass = (start_graphics & DD ? 1 : 0);
+ int last_pass = first_pass * (y_9pin_high == 2 ? 1 : 2);
+ int y_passes = (y_9pin_high ? 3 : 1);
+ int dots_per_space = x_dpi / 10; /* pica space = 1/10" */
+ int bytes_per_space = dots_per_space * out_y_mult;
+ int tab_min_pixels = x_dpi * MIN_TAB_10THS / 10;
+ int skip = 0, lnum = 0, pass, ypass;
+
+ /* Check allocations */
+ if ( buf1 == 0 || buf2 == 0 )
+ { if ( buf1 )
+ gs_free((char *)buf1, in_size, 1, "eps_print_page(buf1)");
+ if ( buf2 )
+ gs_free((char *)buf2, in_size, 1, "eps_print_page(buf2)");
+ return_error(gs_error_VMerror);
}
- if (y_9pin_high == 2) { /* Force printing of every dot in one pass */
- /* by reducing vertical resolution */
- /* (ORing with the next line of data). */
- /* This is necessary because some Epson compatibles */
- /* can't print neighboring dots. */
- int i;
-
- for (i = 0; i < line_size * in_y_mult; ++i)
- in_data[i] |= in_data[i + line_size];
- }
- if (y_9pin_high) { /* Shuffle the scan lines */
- byte *p;
- int i;
- static const char index[] =
- {0, 8, 16, 1, 9, 17,
- 2, 10, 18, 3, 11, 19,
- 4, 12, 20, 5, 13, 21,
- 6, 14, 22, 7, 15, 23
- };
-
- for (i = 0; i < 24; i++) {
- memcpy(out + (index[i] * line_size),
- in + (i * line_size), line_size);
- }
- p = in;
- in = out;
- out = p;
- }
- for (ypass = 0; ypass < y_passes; ypass++) {
- for (pass = first_pass; pass <= last_pass; pass++) {
+
+ /* Initialize the printer and reset the margins. */
+ fwrite(init_string, 1, init_length, prn_stream);
+ if ( init_string[init_length - 1] == 'Q' )
+ fputc((int)(pdev->width / pdev->x_pixels_per_inch * 10) + 2,
+ prn_stream);
+
+ /* Calculate the minimum tab distance. */
+ if ( tab_min_pixels < max(MIN_TAB_PIXELS, 3) )
+ tab_min_pixels = max(MIN_TAB_PIXELS, 3);
+ tab_min_pixels -= tab_min_pixels % 3; /* simplify life */
+
+ /* Print lines of graphics */
+ while ( lnum < pdev->height )
+ {
+ byte *in_data;
+ byte *inp;
+ byte *in_end;
+ byte *out_end;
+ byte *out_blk;
+ register byte *outp;
+ int lcnt;
+
+ /* Copy 1 scan line and test for all zero. */
+ gdev_prn_get_bits(pdev, lnum, in, &in_data);
+ if ( in_data[0] == 0 &&
+ !memcmp((char *)in_data, (char *)in_data + 1, line_size - 1)
+ )
+ {
+ lnum++;
+ skip += 3 / in_y_mult;
+ continue;
+ }
+
+ /* Vertical tab to the appropriate position. */
+ while ( skip > 255 )
+ {
+ fputs("\033J\377", prn_stream);
+ skip -= 255;
+ }
+ if ( skip )
+ {
+ fprintf(prn_stream, "\033J%c", skip);
+ }
+
+ /* Copy the the scan lines. */
+ lcnt = gdev_prn_copy_scan_lines(pdev, lnum, in, in_size);
+ if ( lcnt < 8 * in_y_mult )
+ { /* Pad with lines of zeros. */
+ memset(in + lcnt * line_size, 0,
+ in_size - lcnt * line_size);
+ }
+
+ if ( y_9pin_high == 2 )
+ { /* Force printing of every dot in one pass */
+ /* by reducing vertical resolution */
+ /* (ORing with the next line of data). */
+ /* This is necessary because some Epson compatibles */
+ /* can't print neighboring dots. */
+ int i;
+ for ( i = 0; i < line_size * in_y_mult; ++i )
+ in_data[i] |= in_data[i + line_size];
+ }
+
+ if ( y_9pin_high )
+ { /* Shuffle the scan lines */
+ byte *p;
+ int i;
+ static const char index[] =
+ { 0, 8, 16, 1, 9, 17,
+ 2, 10, 18, 3, 11, 19,
+ 4, 12, 20, 5, 13, 21,
+ 6, 14, 22, 7, 15, 23
+ };
+
+ for ( i = 0; i < 24; i++ )
+ {
+ memcpy(out+(index[i]*line_size),
+ in+(i*line_size), line_size);
+ }
+ p = in;
+ in = out;
+ out = p;
+ }
+
+ for ( ypass = 0; ypass < y_passes; ypass++ )
+ {
+ for ( pass = first_pass; pass <= last_pass; pass++ )
+ {
/* We have to 'transpose' blocks of 8 pixels x 8 lines, */
/* because that's how the printer wants the data. */
/* If we are in a 24-pin mode, we have to transpose */
/* groups of 3 lines at a time. */
- if (pass == first_pass) {
+ if ( pass == first_pass )
+ {
out_end = out;
inp = in;
in_end = inp + line_size;
-
- if (y_24pin) {
- for (; inp < in_end; inp++, out_end += 24) {
- gdev_prn_transpose_8x8(inp, line_size, out_end, 3);
- gdev_prn_transpose_8x8(inp + line_size * 8,
- line_size, out_end + 1, 3);
- gdev_prn_transpose_8x8(inp + line_size * 16,
- line_size, out_end + 2, 3);
+
+ if ( y_24pin )
+ {
+ for ( ; inp < in_end; inp++, out_end += 24 )
+ {
+ gdev_prn_transpose_8x8(inp, line_size, out_end, 3);
+ gdev_prn_transpose_8x8(inp + line_size * 8,
+ line_size, out_end + 1, 3);
+ gdev_prn_transpose_8x8(inp + line_size * 16,
+ line_size, out_end + 2, 3);
}
/* Remove trailing 0s. */
- while (out_end > out && out_end[-1] == 0 &&
- out_end[-2] == 0 && out_end[-3] == 0) {
- out_end -= 3;
- }
- } else {
- for (; inp < in_end; inp++, out_end += 8) {
- gdev_prn_transpose_8x8(inp + (ypass * 8 * line_size),
- line_size, out_end, 1);
+ while ( out_end > out && out_end[-1] == 0 &&
+ out_end[-2] == 0 && out_end[-3] == 0)
+ {
+ out_end -= 3;
}
+ }
+ else
+ {
+ for ( ; inp < in_end; inp++, out_end += 8 )
+ {
+ gdev_prn_transpose_8x8(inp + (ypass * 8*line_size),
+ line_size, out_end, 1);
+ }
/* Remove trailing 0s. */
- while (out_end > out && out_end[-1] == 0) {
- out_end--;
+ while ( out_end > out && out_end[-1] == 0 )
+ {
+ out_end--;
}
- }
+ }
}
- for (out_blk = outp = out; outp < out_end;) {
- /* Skip a run of leading 0s. At least */
- /* tab_min_pixels are needed to make tabbing */
- /* worth it. We do everything by 3's to */
- /* avoid having to make different cases */
- /* for 9- and 24-pin. */
- if (!archaic &&
+
+ for ( out_blk = outp = out; outp < out_end; )
+ {
+ /* Skip a run of leading 0s. At least */
+ /* tab_min_pixels are needed to make tabbing */
+ /* worth it. We do everything by 3's to */
+ /* avoid having to make different cases */
+ /* for 9- and 24-pin. */
+ if ( !archaic &&
*outp == 0 && out_end - outp >= tab_min_pixels &&
(outp[1] | outp[2]) == 0 &&
!memcmp((char *)outp, (char *)outp + 3,
tab_min_pixels - 3)
- ) {
- byte *zp = outp;
+ )
+ {
+ byte *zp = outp;
int tpos;
byte *newp;
-
+
outp += tab_min_pixels;
- while (outp + 3 <= out_end &&
- *outp == 0 &&
- outp[1] == 0 && outp[2] == 0) {
+ while ( outp + 3 <= out_end &&
+ *outp == 0 &&
+ outp[1] == 0 && outp[2] == 0 )
+ {
outp += 3;
- }
+ }
tpos = (outp - out) / bytes_per_space;
newp = out + tpos * bytes_per_space;
- if (newp > zp + 10) {
- /* Output preceding bit data. */
- if (zp > out_blk) {
- /* only false at beginning of line */
- eps_output_run(out_blk, (int)(zp - out_blk),
- out_y_mult, start_graphics,
+ if ( newp > zp + 10 )
+ {
+ /* Output preceding bit data.*/
+ if ( zp > out_blk )
+ {
+ /* only false at beginning of line */
+ eps_output_run(out_blk, (int)(zp - out_blk),
+ out_y_mult, start_graphics,
prn_stream,
(y_9pin_high == 2 ?
- (1 + ypass) & 1 : pass));
+ (1 + ypass) & 1 : pass));
}
/* Tab over to the appropriate position. */
- if (tab_hiccup)
- fputs("\010 ", prn_stream); /* bksp, space */
+ if ( tab_hiccup )
+ fputs("\010 ", prn_stream); /* bksp, space */
/* The following statement is broken up */
/* to work around a bug in emx/gcc. */
fprintf(prn_stream, "\033D%c", tpos);
@@ -337,65 +368,77 @@ eps_print_page(gx_device_printer * pdev, FILE * prn_stream, int y_9pin_high,
fputc('\t', prn_stream);
out_blk = outp = newp;
}
- } else {
- outp += out_y_mult;
}
- }
- if (outp > out_blk) {
+ else
+ {
+ outp += out_y_mult;
+ }
+ }
+ if ( outp > out_blk )
+ {
eps_output_run(out_blk, (int)(outp - out_blk),
- out_y_mult, start_graphics,
+ out_y_mult, start_graphics,
prn_stream,
- (y_9pin_high == 2 ? (1 + ypass) & 1 : pass));
+ (y_9pin_high == 2 ? (1 + ypass) & 1 : pass));
}
+
fputc('\r', prn_stream);
}
- if (ypass < y_passes - 1)
+ if ( ypass < y_passes - 1 )
fputs("\033J\001", prn_stream);
}
- skip = 24 - y_passes + 1; /* no skip on last Y pass */
+ skip = 24 - y_passes + 1; /* no skip on last Y pass */
lnum += 8 * in_y_mult;
- }
+ }
- /* Eject the page and reinitialize the printer */
- fputs(end_string, prn_stream);
- fflush(prn_stream);
+ /* Eject the page and reinitialize the printer */
+ fputs(end_string, prn_stream);
+ fflush(prn_stream);
- gs_free((char *)buf2, in_size, 1, "eps_print_page(buf2)");
- gs_free((char *)buf1, in_size, 1, "eps_print_page(buf1)");
- return 0;
+ gs_free((char *)buf2, in_size, 1, "eps_print_page(buf2)");
+ gs_free((char *)buf1, in_size, 1, "eps_print_page(buf1)");
+ return 0;
}
/* Output a single graphics command. */
/* pass=0 for all columns, 1 for even columns, 2 for odd columns. */
private void
-eps_output_run(byte * data, int count, int y_mult,
- char start_graphics, FILE * prn_stream, int pass)
-{
- int xcount = count / y_mult;
-
- fputc(033, prn_stream);
- if (!(start_graphics & ~3)) {
- fputc("KLYZ"[start_graphics], prn_stream);
- } else {
- fputc('*', prn_stream);
- fputc(start_graphics & ~DD, prn_stream);
- }
- fputc(xcount & 0xff, prn_stream);
- fputc(xcount >> 8, prn_stream);
- if (!pass) {
- fwrite(data, 1, count, prn_stream);
- } else {
- /* Only write every other column of y_mult bytes. */
- int which = pass;
- register byte *dp = data;
- register int i, j;
-
- for (i = 0; i < xcount; i++, which++) {
- for (j = 0; j < y_mult; j++, dp++) {
- putc(((which & 1) ? *dp : 0), prn_stream);
- }
+eps_output_run(byte *data, int count, int y_mult,
+ char start_graphics, FILE *prn_stream, int pass)
+{
+ int xcount = count / y_mult;
+
+ fputc(033, prn_stream);
+ if ( !(start_graphics & ~3) )
+ {
+ fputc("KLYZ"[start_graphics], prn_stream);
+ }
+ else
+ {
+ fputc('*', prn_stream);
+ fputc(start_graphics & ~DD, prn_stream);
+ }
+ fputc(xcount & 0xff, prn_stream);
+ fputc(xcount >> 8, prn_stream);
+ if ( !pass )
+ {
+ fwrite(data, 1, count, prn_stream);
+ }
+ else
+ {
+ /* Only write every other column of y_mult bytes. */
+ int which = pass;
+ register byte *dp = data;
+ register int i, j;
+
+ for ( i = 0; i < xcount; i++, which++ )
+ {
+ for ( j = 0; j < y_mult; j++, dp++ )
+ {
+ putc(((which & 1) ? *dp : 0), prn_stream);
+ }
+ }
}
- }
}
/* The print_page procedures are here, to avoid a forward reference. */
@@ -407,41 +450,40 @@ eps_output_run(byte * data, int count, int y_mult,
#endif
#define ESC 0x1b
-private const char eps_init_string[] =
-{
+private const char eps_init_string[] = {
#if ARCHAIC
- ESC, '@', 'r', ESC, 'Q'
+ ESC, '@', 022 /*^R*/, ESC, 'Q'
#else
- ESC, '@', ESC, 'P', ESC, 'l', 0, '\r', ESC, 'Q'
+ ESC, '@', ESC, 'P', ESC, 'l', 0, '\r', ESC, 'Q'
#endif
};
private int
-epson_print_page(gx_device_printer * pdev, FILE * prn_stream)
+epson_print_page(gx_device_printer *pdev, FILE *prn_stream)
{
- return eps_print_page(pdev, prn_stream, 0, eps_init_string,
- sizeof(eps_init_string), "\f\033@",
- ARCHAIC, TAB_HICCUP);
+ return eps_print_page(pdev, prn_stream, 0, eps_init_string,
+ sizeof(eps_init_string), "\f\033@",
+ ARCHAIC, TAB_HICCUP);
}
private int
-eps9high_print_page(gx_device_printer * pdev, FILE * prn_stream)
+eps9high_print_page(gx_device_printer *pdev, FILE *prn_stream)
{
- return eps_print_page(pdev, prn_stream, 1, eps_init_string,
- sizeof(eps_init_string), "\f\033@",
- ARCHAIC, TAB_HICCUP);
+ return eps_print_page(pdev, prn_stream, 1, eps_init_string,
+ sizeof(eps_init_string), "\f\033@",
+ ARCHAIC, TAB_HICCUP);
}
private int
-eps9mid_print_page(gx_device_printer * pdev, FILE * prn_stream)
+eps9mid_print_page(gx_device_printer *pdev, FILE *prn_stream)
{
- return eps_print_page(pdev, prn_stream, 2, eps_init_string,
- sizeof(eps_init_string), "\f\033@",
- ARCHAIC, TAB_HICCUP);
+ return eps_print_page(pdev, prn_stream, 2, eps_init_string,
+ sizeof(eps_init_string), "\f\033@",
+ ARCHAIC, TAB_HICCUP);
}
private int
-ibmpro_print_page(gx_device_printer * pdev, FILE * prn_stream)
+ibmpro_print_page(gx_device_printer *pdev, FILE *prn_stream)
{
/*
* IBM Proprinter Guide to Operations, p. 4-5: "DC1: Select Printer: Sets
@@ -449,12 +491,10 @@ ibmpro_print_page(gx_device_printer * pdev, FILE * prn_stream)
* interpreting first characters as literal text.
*/
#define DC1 0x11
- static const char ibmpro_init_string[] =
- {
- DC1, ESC, '3', 0x30
- };
-
+ static const char ibmpro_init_string[] = {
+ DC1, ESC, '3', 0x30
+ };
#undef DC1
- return eps_print_page(pdev, prn_stream, 0, ibmpro_init_string,
- sizeof(ibmpro_init_string), "\f", 1, 0);
+ return eps_print_page(pdev, prn_stream, 0, ibmpro_init_string,
+ sizeof(ibmpro_init_string), "\f", 1, 0);
}
diff --git a/gs/src/gdevescp.c b/gs/src/gdevescp.c
index deffe4470..c861a915c 100644
--- a/gs/src/gdevescp.c
+++ b/gs/src/gdevescp.c
@@ -1,22 +1,22 @@
/* Copyright (C) 1993, 1994 Aladdin Enterprises. All rights reserved.
-
- This file is part of Aladdin Ghostscript.
-
- Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
- or distributor accepts any responsibility for the consequences of using it,
- or for whether it serves any particular purpose or works at all, unless he
- or she says so in writing. Refer to the Aladdin Ghostscript Free Public
- License (the "License") for full details.
-
- Every copy of Aladdin Ghostscript must include a copy of the License,
- normally in a plain ASCII text file named PUBLIC. The License grants you
- the right to copy, modify and redistribute Aladdin Ghostscript, but only
- under certain conditions described in the License. Among other things, the
- License requires that the copyright notice and this notice be preserved on
- all copies.
- */
-
-/* gdevescp.c */
+
+ This file is part of Aladdin Ghostscript.
+
+ Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
+ or distributor accepts any responsibility for the consequences of using it,
+ or for whether it serves any particular purpose or works at all, unless he
+ or she says so in writing. Refer to the Aladdin Ghostscript Free Public
+ License (the "License") for full details.
+
+ Every copy of Aladdin Ghostscript must include a copy of the License,
+ normally in a plain ASCII text file named PUBLIC. The License grants you
+ the right to copy, modify and redistribute Aladdin Ghostscript, but only
+ under certain conditions described in the License. Among other things, the
+ License requires that the copyright notice and this notice be preserved on
+ all copies.
+*/
+
+/*Id: gdevescp.c */
/*
* Epson 'ESC/P 2' language printer driver.
*
@@ -68,11 +68,11 @@
* page, you'll need to increase the top and/or bottom margin.
*/
-#define STYLUS_L_MARGIN 0.13 /*0.12 */
-#define STYLUS_B_MARGIN 0.56 /*0.51 */
-#define STYLUS_T_MARGIN 0.34 /*0.12 */
+#define STYLUS_L_MARGIN 0.13 /*0.12*/
+#define STYLUS_B_MARGIN 0.56 /*0.51*/
+#define STYLUS_T_MARGIN 0.34 /*0.12*/
#ifdef A4
-# define STYLUS_R_MARGIN 0.18 /*0.15 */
+# define STYLUS_R_MARGIN 0.18 /*0.15*/
#else
# define STYLUS_R_MARGIN 0.38
#endif
@@ -84,329 +84,332 @@
#define AP3250_L_MARGIN 0.18
#define AP3250_B_MARGIN 0.51
#define AP3250_T_MARGIN 0.34
-#define AP3250_R_MARGIN 0.28 /* US paper */
+#define AP3250_R_MARGIN 0.28 /* US paper */
/* The device descriptor */
private dev_proc_print_page(escp2_print_page);
/* Stylus 800 device */
gx_device_printer far_data gs_st800_device =
-prn_device(prn_std_procs, "st800",
- DEFAULT_WIDTH_10THS,
- DEFAULT_HEIGHT_10THS,
- X_DPI, Y_DPI,
- STYLUS_L_MARGIN, STYLUS_B_MARGIN, STYLUS_R_MARGIN, STYLUS_T_MARGIN,
- 1, escp2_print_page);
+ prn_device(prn_std_procs, "st800",
+ DEFAULT_WIDTH_10THS,
+ DEFAULT_HEIGHT_10THS,
+ X_DPI, Y_DPI,
+ STYLUS_L_MARGIN, STYLUS_B_MARGIN, STYLUS_R_MARGIN, STYLUS_T_MARGIN,
+ 1, escp2_print_page);
/* AP3250 device */
gx_device_printer far_data gs_ap3250_device =
-prn_device(prn_std_procs, "ap3250",
- DEFAULT_WIDTH_10THS,
- DEFAULT_HEIGHT_10THS,
- X_DPI, Y_DPI,
- AP3250_L_MARGIN, AP3250_B_MARGIN, AP3250_R_MARGIN, AP3250_T_MARGIN,
- 1, escp2_print_page);
+ prn_device(prn_std_procs, "ap3250",
+ DEFAULT_WIDTH_10THS,
+ DEFAULT_HEIGHT_10THS,
+ X_DPI, Y_DPI,
+ AP3250_L_MARGIN, AP3250_B_MARGIN, AP3250_R_MARGIN, AP3250_T_MARGIN,
+ 1, escp2_print_page);
/* ------ Internal routines ------ */
/* Send the page to the printer. */
private int
-escp2_print_page(gx_device_printer * pdev, FILE * prn_stream)
-{
- int line_size = gdev_prn_raster((gx_device_printer *) pdev);
- int band_size = 24; /* 1, 8, or 24 */
- int in_size = line_size * band_size;
-
- byte *buf1 = (byte *) gs_malloc(in_size, 1, "escp2_print_page(buf1)");
- byte *buf2 = (byte *) gs_malloc(in_size, 1, "escp2_print_page(buf2)");
- byte *in = buf1;
- byte *out = buf2;
-
- int skip, lnum, top, bottom, left, width;
- int auto_feed = 1;
- int count, i;
-
- /*
- ** Check for valid resolution:
- **
- ** XDPI YDPI
- ** 360 360
- ** 360 180
- ** 180 180
- */
-
- if (!((pdev->x_pixels_per_inch == 180 &&
- pdev->y_pixels_per_inch == 180) ||
- (pdev->x_pixels_per_inch == 360 &&
- (pdev->y_pixels_per_inch == 360 ||
- pdev->y_pixels_per_inch == 180))))
- return_error(gs_error_rangecheck);
-
- /*
- ** Check buffer allocations:
- */
-
- if (buf1 == 0 || buf2 == 0) {
- if (buf1)
- gs_free((char *)buf1, in_size, 1, "escp2_print_page(buf1)");
- if (buf2)
- gs_free((char *)buf2, in_size, 1, "escp2_print_page(buf2)");
- return_error(gs_error_VMerror);
- }
- /*
- ** Reset printer, enter graphics mode:
- */
-
- fwrite("\033@\033(G\001\000\001", 1, 8, prn_stream);
+escp2_print_page(gx_device_printer *pdev, FILE *prn_stream)
+{
+ int line_size = gdev_prn_raster((gx_device_printer *)pdev);
+ int band_size = 24; /* 1, 8, or 24 */
+ int in_size = line_size * band_size;
-#ifdef A4
- /*
- ** After reset, the Stylus is set up for US letter paper.
- ** We need to set the page size appropriately for A4 paper.
- ** For some bizarre reason the ESC/P2 language wants the bottom
- ** margin measured from the *top* of the page:
- */
-
- fwrite("\033(U\001\0\n\033(C\002\0t\020\033(c\004\0\0\0t\020",
- 1, 22, prn_stream);
-#endif
+ byte *buf1 = (byte *)gs_malloc(in_size, 1, "escp2_print_page(buf1)");
+ byte *buf2 = (byte *)gs_malloc(in_size, 1, "escp2_print_page(buf2)");
+ byte *in = buf1;
+ byte *out = buf2;
- /*
- ** Set the line spacing to match the band height:
- */
-
- if (pdev->y_pixels_per_inch == 360)
- fwrite("\033(U\001\0\012\033+\030", 1, 9, prn_stream);
- else
- fwrite("\033(U\001\0\024\033+\060", 1, 9, prn_stream);
-
- /*
- ** If the printer has automatic page feeding, then the paper
- ** will already be positioned at the top margin value, so we
- ** start printing the image from there. Similarly, we must not
- ** try to print or even line feed past the bottom margin, since
- ** the printer will automatically load a new page.
- ** Printers without this feature may actually need to be told
- ** to skip past the top margin.
- */
-
- if (auto_feed) {
- top = dev_t_margin(pdev) * pdev->y_pixels_per_inch;
- bottom = pdev->height - dev_b_margin(pdev) * pdev->y_pixels_per_inch;
- } else {
- top = 0;
- bottom = pdev->height;
- }
-
- /*
- ** Make left margin and width sit on byte boundaries:
- */
-
- left = ((int)(dev_l_margin(pdev) * pdev->x_pixels_per_inch)) >> 3;
-
- width = ((pdev->width - (int)(dev_r_margin(pdev) * pdev->x_pixels_per_inch)) >> 3) - left;
-
- /*
- ** Print the page:
- */
-
- for (lnum = top, skip = 0; lnum < bottom;) {
- byte *in_data;
- byte *inp;
- byte *in_end;
- byte *outp;
- register byte *p, *q;
- int lcnt;
+ int skip, lnum, top, bottom, left, width;
+ int auto_feed = 1;
+ int count, i;
/*
- ** Check buffer for 0 data. We can't do this mid-band
- */
-
- gdev_prn_get_bits(pdev, lnum, in, &in_data);
- while (in_data[0] == 0 &&
- !memcmp((char *)in_data, (char *)in_data + 1, line_size - 1) &&
- lnum < bottom) {
- lnum++;
- skip++;
- gdev_prn_get_bits(pdev, lnum, in, &in_data);
- }
-
- if (lnum == bottom)
- break; /* finished with this page */
+ ** Check for valid resolution:
+ **
+ ** XDPI YDPI
+ ** 360 360
+ ** 360 180
+ ** 180 180
+ */
+
+ if( !( (pdev->x_pixels_per_inch == 180 &&
+ pdev->y_pixels_per_inch == 180) ||
+ (pdev->x_pixels_per_inch == 360 &&
+ (pdev->y_pixels_per_inch == 360 ||
+ pdev->y_pixels_per_inch == 180) )) )
+ return_error(gs_error_rangecheck);
/*
- ** Skip blank lines if we need to:
- */
-
- if (skip) {
- fwrite("\033(v\002\000", 1, 5, prn_stream);
- fputc(skip & 0xff, prn_stream);
- fputc(skip >> 8, prn_stream);
- skip = 0;
+ ** Check buffer allocations:
+ */
+
+ if ( buf1 == 0 || buf2 == 0 )
+ { if ( buf1 )
+ gs_free((char *)buf1, in_size, 1, "escp2_print_page(buf1)");
+ if ( buf2 )
+ gs_free((char *)buf2, in_size, 1, "escp2_print_page(buf2)");
+ return_error(gs_error_VMerror);
}
- lcnt = gdev_prn_copy_scan_lines(pdev, lnum, in, in_size);
/*
- ** Check to see if we don't have enough data to fill an entire
- ** band. Padding here seems to work (the printer doesn't jump
- ** to the next (blank) page), although the ideal behaviour
- ** would probably be to reduce the band height.
- **
- ** Pad with nulls:
- */
+ ** Reset printer, enter graphics mode:
+ */
- if (lcnt < band_size)
- memset(in + lcnt * line_size, 0, in_size - lcnt * line_size);
+ fwrite("\033@\033(G\001\000\001", 1, 8, prn_stream);
+#ifdef A4
/*
- ** Now we have a band of data: try to compress it:
- */
-
- for (outp = out, i = 0; i < band_size; i++) {
-
- /*
- ** Take margins into account:
- */
+ ** After reset, the Stylus is set up for US letter paper.
+ ** We need to set the page size appropriately for A4 paper.
+ ** For some bizarre reason the ESC/P2 language wants the bottom
+ ** margin measured from the *top* of the page:
+ */
+
+ fwrite("\033(U\001\0\n\033(C\002\0t\020\033(c\004\0\0\0t\020",
+ 1, 22, prn_stream);
+#endif
- inp = in + i * line_size + left;
- in_end = inp + width;
+ /*
+ ** Set the line spacing to match the band height:
+ */
- /*
- ** walk through input buffer, looking for repeated data:
- ** Since we need more than 2 repeats to make the compression
- ** worth it, we can compare pairs, since it doesn't matter if we
- **
- */
+ if( pdev->y_pixels_per_inch == 360 )
+ fwrite("\033(U\001\0\012\033+\030", 1, 9, prn_stream);
+ else
+ fwrite("\033(U\001\0\024\033+\060", 1, 9, prn_stream);
+
+ /*
+ ** If the printer has automatic page feeding, then the paper
+ ** will already be positioned at the top margin value, so we
+ ** start printing the image from there. Similarly, we must not
+ ** try to print or even line feed past the bottom margin, since
+ ** the printer will automatically load a new page.
+ ** Printers without this feature may actually need to be told
+ ** to skip past the top margin.
+ */
+
+ if( auto_feed ) {
+ top = dev_t_margin(pdev) * pdev->y_pixels_per_inch;
+ bottom = pdev->height - dev_b_margin(pdev) * pdev->y_pixels_per_inch;
+ } else {
+ top = 0;
+ bottom = pdev->height;
+ }
+
+ /*
+ ** Make left margin and width sit on byte boundaries:
+ */
+
+ left = ( (int) (dev_l_margin(pdev) * pdev->x_pixels_per_inch) ) >> 3;
+
+ width = ((pdev->width - (int)(dev_r_margin(pdev) * pdev->x_pixels_per_inch)) >> 3) - left;
- for (p = inp, q = inp + 1; q < in_end;) {
+ /*
+ ** Print the page:
+ */
+
+ for ( lnum = top, skip = 0 ; lnum < bottom ; )
+ {
+ byte *in_data;
+ byte *inp;
+ byte *in_end;
+ byte *outp;
+ register byte *p, *q;
+ int lcnt;
- if (*p != *q) {
+ /*
+ ** Check buffer for 0 data. We can't do this mid-band
+ */
+
+ gdev_prn_get_bits(pdev, lnum, in, &in_data);
+ while ( in_data[0] == 0 &&
+ !memcmp((char *)in_data, (char *)in_data + 1, line_size - 1) &&
+ lnum < bottom )
+ {
+ lnum++;
+ skip++;
+ gdev_prn_get_bits(pdev, lnum, in, &in_data);
+ }
- p += 2;
- q += 2;
+ if(lnum == bottom ) break; /* finished with this page */
- } else {
+ /*
+ ** Skip blank lines if we need to:
+ */
+
+ if( skip ) {
+ fwrite("\033(v\002\000", 1, 5, prn_stream);
+ fputc(skip & 0xff, prn_stream);
+ fputc(skip >> 8, prn_stream);
+ skip = 0;
+ }
- /*
- ** Check behind us, just in case:
- */
+ lcnt = gdev_prn_copy_scan_lines(pdev, lnum, in, in_size);
- if (p > inp && *p == *(p - 1))
- p--;
+ /*
+ ** Check to see if we don't have enough data to fill an entire
+ ** band. Padding here seems to work (the printer doesn't jump
+ ** to the next (blank) page), although the ideal behaviour
+ ** would probably be to reduce the band height.
+ **
+ ** Pad with nulls:
+ */
- /*
- ** walk forward, looking for matches:
- */
+ if( lcnt < band_size )
+ memset(in + lcnt * line_size, 0, in_size - lcnt * line_size);
- for (q++; *q == *p && q < in_end; q++) {
- if ((q - p) >= 128) {
- if (p > inp) {
- count = p - inp;
- while (count > 128) {
+ /*
+ ** Now we have a band of data: try to compress it:
+ */
+
+ for( outp = out, i = 0 ; i < band_size ; i++ ) {
+
+ /*
+ ** Take margins into account:
+ */
+
+ inp = in + i * line_size + left;
+ in_end = inp + width;
+
+ /*
+ ** walk through input buffer, looking for repeated data:
+ ** Since we need more than 2 repeats to make the compression
+ ** worth it, we can compare pairs, since it doesn't matter if we
+ **
+ */
+
+ for( p = inp, q = inp + 1 ; q < in_end ; ) {
+
+ if( *p != *q ) {
+
+ p += 2;
+ q += 2;
+
+ } else {
+
+ /*
+ ** Check behind us, just in case:
+ */
+
+ if( p > inp && *p == *(p-1) )
+ p--;
+
+ /*
+ ** walk forward, looking for matches:
+ */
+
+ for( q++ ; *q == *p && q < in_end ; q++ ) {
+ if( (q-p) >= 128 ) {
+ if( p > inp ) {
+ count = p - inp;
+ while( count > 128 ) {
+ *outp++ = '\177';
+ memcpy(outp, inp, 128); /* data */
+ inp += 128;
+ outp += 128;
+ count -= 128;
+ }
+ *outp++ = (char) (count - 1); /* count */
+ memcpy(outp, inp, count); /* data */
+ outp += count;
+ }
+ *outp++ = '\201'; /* Repeat 128 times */
+ *outp++ = *p;
+ p += 128;
+ inp = p;
+ }
+ }
+
+ if( (q - p) > 2 ) { /* output this sequence */
+ if( p > inp ) {
+ count = p - inp;
+ while( count > 128 ) {
*outp++ = '\177';
memcpy(outp, inp, 128); /* data */
inp += 128;
outp += 128;
count -= 128;
- }
- *outp++ = (char)(count - 1); /* count */
- memcpy(outp, inp, count); /* data */
- outp += count;
- }
- *outp++ = '\201'; /* Repeat 128 times */
- *outp++ = *p;
- p += 128;
- inp = p;
- }
- }
-
- if ((q - p) > 2) { /* output this sequence */
- if (p > inp) {
- count = p - inp;
- while (count > 128) {
- *outp++ = '\177';
- memcpy(outp, inp, 128); /* data */
- inp += 128;
- outp += 128;
- count -= 128;
- }
- *outp++ = (char)(count - 1); /* byte count */
- memcpy(outp, inp, count); /* data */
- outp += count;
- }
- count = q - p;
- *outp++ = (char)(256 - count + 1);
- *outp++ = *p;
- p += count;
- inp = p;
- } else /* add to non-repeating data list */
- p = q;
- if (q < in_end)
- q++;
+ }
+ *outp++ = (char) (count - 1); /* byte count */
+ memcpy(outp, inp, count); /* data */
+ outp += count;
+ }
+ count = q - p;
+ *outp++ = (char) (256 - count + 1);
+ *outp++ = *p;
+ p += count;
+ inp = p;
+ } else /* add to non-repeating data list */
+ p = q;
+ if( q < in_end )
+ q++;
+ }
+ }
+
+ /*
+ ** copy remaining part of line:
+ */
+
+ if( inp < in_end ) {
+
+ count = in_end - inp;
+
+ /*
+ ** If we've had a long run of varying data followed by a
+ ** sequence of repeated data and then hit the end of line,
+ ** it's possible to get data counts > 128.
+ */
+
+ while( count > 128 ) {
+ *outp++ = '\177';
+ memcpy(outp, inp, 128); /* data */
+ inp += 128;
+ outp += 128;
+ count -= 128;
+ }
+
+ *outp++ = (char) (count - 1); /* byte count */
+ memcpy(outp, inp, count); /* data */
+ outp += count;
+ }
}
- }
-
- /*
- ** copy remaining part of line:
- */
-
- if (inp < in_end) {
-
- count = in_end - inp;
/*
- ** If we've had a long run of varying data followed by a
- ** sequence of repeated data and then hit the end of line,
- ** it's possible to get data counts > 128.
- */
-
- while (count > 128) {
- *outp++ = '\177';
- memcpy(outp, inp, 128); /* data */
- inp += 128;
- outp += 128;
- count -= 128;
- }
-
- *outp++ = (char)(count - 1); /* byte count */
- memcpy(outp, inp, count); /* data */
- outp += count;
- }
- }
-
- /*
- ** Output data:
- */
+ ** Output data:
+ */
- fwrite("\033.\001", 1, 3, prn_stream);
+ fwrite("\033.\001", 1, 3, prn_stream);
- if (pdev->y_pixels_per_inch == 360)
- fputc('\012', prn_stream);
- else
- fputc('\024', prn_stream);
+ if(pdev->y_pixels_per_inch == 360)
+ fputc('\012', prn_stream);
+ else
+ fputc('\024', prn_stream);
- if (pdev->x_pixels_per_inch == 360)
- fputc('\012', prn_stream);
- else
- fputc('\024', prn_stream);
+ if(pdev->x_pixels_per_inch == 360)
+ fputc('\012', prn_stream);
+ else
+ fputc('\024', prn_stream);
- fputc(band_size, prn_stream);
+ fputc(band_size, prn_stream);
- fputc((width << 3) & 0xff, prn_stream);
- fputc(width >> 5, prn_stream);
+ fputc((width << 3) & 0xff, prn_stream);
+ fputc( width >> 5, prn_stream);
- fwrite(out, 1, (outp - out), prn_stream);
+ fwrite(out, 1, (outp - out), prn_stream);
- fwrite("\r\n", 1, 2, prn_stream);
- lnum += band_size;
- }
+ fwrite("\r\n", 1, 2, prn_stream);
+ lnum += band_size;
+ }
- /* Eject the page and reinitialize the printer */
+ /* Eject the page and reinitialize the printer */
- fputs("\f\033@", prn_stream);
- fflush(prn_stream);
+ fputs("\f\033@", prn_stream);
+ fflush(prn_stream);
- gs_free((char *)buf2, in_size, 1, "escp2_print_page(buf2)");
- gs_free((char *)buf1, in_size, 1, "escp2_print_page(buf1)");
- return 0;
+ gs_free((char *)buf2, in_size, 1, "escp2_print_page(buf2)");
+ gs_free((char *)buf1, in_size, 1, "escp2_print_page(buf1)");
+ return 0;
}
diff --git a/gs/src/gdevevga.c b/gs/src/gdevevga.c
index c2bb4621c..952fb2a1e 100644
--- a/gs/src/gdevevga.c
+++ b/gs/src/gdevevga.c
@@ -16,7 +16,7 @@
all copies.
*/
-/* gdevevga.c */
+/*Id: gdevevga.c */
/* IBM PC EGA and VGA display drivers */
/* All of the real code is in gdevpcfb.c. */
#include "memory_.h"
diff --git a/gs/src/gdevherc.c b/gs/src/gdevherc.c
index 8ed762b53..4f2209a8c 100644
--- a/gs/src/gdevherc.c
+++ b/gs/src/gdevherc.c
@@ -1,22 +1,22 @@
/* Copyright (C) 1990, 1991, 1993 Aladdin Enterprises. All rights reserved.
-
- This file is part of Aladdin Ghostscript.
-
- Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
- or distributor accepts any responsibility for the consequences of using it,
- or for whether it serves any particular purpose or works at all, unless he
- or she says so in writing. Refer to the Aladdin Ghostscript Free Public
- License (the "License") for full details.
-
- Every copy of Aladdin Ghostscript must include a copy of the License,
- normally in a plain ASCII text file named PUBLIC. The License grants you
- the right to copy, modify and redistribute Aladdin Ghostscript, but only
- under certain conditions described in the License. Among other things, the
- License requires that the copyright notice and this notice be preserved on
- all copies.
- */
-
-/* gdevherc.c */
+
+ This file is part of Aladdin Ghostscript.
+
+ Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
+ or distributor accepts any responsibility for the consequences of using it,
+ or for whether it serves any particular purpose or works at all, unless he
+ or she says so in writing. Refer to the Aladdin Ghostscript Free Public
+ License (the "License") for full details.
+
+ Every copy of Aladdin Ghostscript must include a copy of the License,
+ normally in a plain ASCII text file named PUBLIC. The License grants you
+ the right to copy, modify and redistribute Aladdin Ghostscript, but only
+ under certain conditions described in the License. Among other things, the
+ License requires that the copyright notice and this notice be preserved on
+ all copies.
+*/
+
+/*Id: gdevherc.c */
/* IBM PC-compatible Hercules Graphics display driver */
/* using direct access to frame buffer */
@@ -26,12 +26,11 @@
#define VIDEO_MODE 0x07
#define regen 0xb0000000L
-#define interrupt /* patch ANSI incompatibility */
+#define interrupt /* patch ANSI incompatibility */
#include "dos_.h"
typedef union REGS registers;
-
#include "gx.h"
-#include "gsmatrix.h" /* for gxdevice.h */
+#include "gsmatrix.h" /* for gxdevice.h */
#include "gxbitmap.h"
#include "gxdevice.h"
@@ -64,31 +63,29 @@ dev_proc_copy_mono(herc_copy_mono);
dev_proc_copy_color(herc_copy_color);
/* The device descriptor */
-private gx_device_procs herc_procs =
-{
- herc_open,
- gx_default_get_initial_matrix,
- gx_default_sync_output,
- gx_default_output_page,
- herc_close,
- gx_default_map_rgb_color,
- gx_default_map_color_rgb,
- herc_fill_rectangle,
- gx_default_tile_rectangle,
- herc_copy_mono,
- herc_copy_color
+private gx_device_procs herc_procs = {
+ herc_open,
+ gx_default_get_initial_matrix,
+ gx_default_sync_output,
+ gx_default_output_page,
+ herc_close,
+ gx_default_map_rgb_color,
+ gx_default_map_color_rgb,
+ herc_fill_rectangle,
+ gx_default_tile_rectangle,
+ herc_copy_mono,
+ herc_copy_color
};
-gx_device far_data gs_herc_device =
-{
- std_device_std_body(gx_device, &herc_procs, "herc",
- screen_size_x, screen_size_y,
+gx_device far_data gs_herc_device = {
+ std_device_std_body(gx_device, &herc_procs, "herc",
+ screen_size_x, screen_size_y,
/* The following parameters map an appropriate fraction of */
/* the screen to a full-page coordinate space. */
/* This may or may not be what is desired! */
- (screen_size_y * aspect_ratio) / PAGE_HEIGHT_INCHES, /* x dpi */
- screen_size_y / PAGE_HEIGHT_INCHES /* y dpi */
- )
+ (screen_size_y * aspect_ratio) / PAGE_HEIGHT_INCHES, /* x dpi */
+ screen_size_y / PAGE_HEIGHT_INCHES /* y dpi */
+ )
};
@@ -101,11 +98,9 @@ private int herc_save_mode = -1;
/* Reinitialize the herc for text mode */
int
-herc_close(gx_device * dev)
-{
- if (herc_save_mode >= 0)
- herc_set_mode(herc_save_mode);
- return 0;
+herc_close(gx_device *dev)
+{ if ( herc_save_mode >= 0 ) herc_set_mode(herc_save_mode);
+ return 0;
}
/* ------ Internal routines ------ */
@@ -113,48 +108,41 @@ herc_close(gx_device * dev)
/* Read the device mode */
private int
herc_get_mode(void)
-{
- registers regs;
-
- regs.h.ah = 0xf;
- int86(0x10, &regs, &regs);
- return regs.h.al;
+{ registers regs;
+ regs.h.ah = 0xf;
+ int86(0x10, &regs, &regs);
+ return regs.h.al;
}
/* Set the device mode */
private void
herc_set_mode(int mode)
-{
- registers regs;
-
- regs.h.ah = 0;
- regs.h.al = mode;
- int86(0x10, &regs, &regs);
+{ registers regs;
+ regs.h.ah = 0;
+ regs.h.al = mode;
+ int86(0x10, &regs, &regs);
}
/****************************************************************/
-/* Hercules graphics card functions */
-/* */
-/* -- Taken from Jan/Feb 1988 issue of Micro Cornucopia #39 */
-/* */
-/* --rewritten for MSC 5.1 on 02/18/91 by Phillip Conrad */
+/* Hercules graphics card functions */
+/* */
+/* -- Taken from Jan/Feb 1988 issue of Micro Cornucopia #39 */
+/* */
+/* --rewritten for MSC 5.1 on 02/18/91 by Phillip Conrad */
/****************************************************************/
-static const char paramg[12] =
-{0x35, 0x2d, 0x2e, 0x07, 0x5b, 0x02,
- 0x57, 0x57, 0x02, 0x03, 0x00, 0x00};
-
+static const char paramg[12] = {0x35, 0x2d, 0x2e, 0x07, 0x5b, 0x02,
+ 0x57, 0x57, 0x02, 0x03, 0x00, 0x00};
/* (Never used)
- static const char paramt[12] = {0x61, 0x50, 0x52, 0x0f, 0x19, 0x06,
- 0x19, 0x19, 0x02, 0x0d, 0x0b, 0x0c};
- */
+static const char paramt[12] = {0x61, 0x50, 0x52, 0x0f, 0x19, 0x06,
+ 0x19, 0x19, 0x02, 0x0d, 0x0b, 0x0c};
+*/
/* Type and macro for frame buffer pointers. */
/*** Intimately tied to the 80x86 (x<2) addressing architecture. ***/
-typedef byte far *fb_ptr;
-
+typedef byte far *fb_ptr;
# define mk_fb_ptr(x, y)\
(fb_ptr)((regen) + ((0x2000 * ((y) % 4) + (90 * ((y) >> 2))) + ((int)(x) >> 3)))
@@ -163,21 +151,21 @@ typedef byte far *fb_ptr;
/* Note that this structure is known to assembly code. */
/* Not all parameters are used for every operation. */
typedef struct rop_params_s {
- fb_ptr dest; /* pointer to frame buffer */
- int draster; /* raster of frame buffer */
- const byte far *src; /* pointer to source data */
- int sraster; /* source raster */
- int width; /* width in bytes */
- int height; /* height in scan lines */
- int shift; /* amount to right shift source */
- int invert; /* 0 or -1 to invert source */
- int data; /* data for fill */
- int x_pos; /*>>added--2/24/91 */
- int y_pos;
+ fb_ptr dest; /* pointer to frame buffer */
+ int draster; /* raster of frame buffer */
+ const byte far *src; /* pointer to source data */
+ int sraster; /* source raster */
+ int width; /* width in bytes */
+ int height; /* height in scan lines */
+ int shift; /* amount to right shift source */
+ int invert; /* 0 or -1 to invert source */
+ int data; /* data for fill */
+ int x_pos; /*>>added--2/24/91 */
+ int y_pos;
} rop_params;
/* Define the device port and register numbers, and the regen map base */
-#define seq_addr 0x3b4 /* changed for HERC card (6845 ports) */
+#define seq_addr 0x3b4 /* changed for HERC card (6845 ports)*/
#define graph_mode 0x3b8
#define graph_stat 0x3ba
#define graph_config 0x3bf
@@ -189,26 +177,24 @@ typedef struct rop_params_s {
/* Initialize the display for Hercules graphics mode */
int
-herc_open(gx_device * dev)
-{
- int i;
-
- if (herc_save_mode < 0)
- herc_save_mode = herc_get_mode();
-/* herc_set_mode(graphics_video_mode); */
- outportb(graph_config, 3);
- for (i = 0; i < sizeof(paramg); i++) {
- outport2(seq_addr, i, paramg[i]);
-
- }
- outportb(graph_mode, 0x0a); /* set page 0 */
- for (i = 0; i < 0x3FFFL; i++) { /* clear the screen */
- int far *loc = (int far *)(regen + (2L * i));
-
- *loc = 0;
- }
-
- return 0;
+herc_open(gx_device *dev)
+{ int i;
+ if ( herc_save_mode < 0 ) herc_save_mode = herc_get_mode();
+/* herc_set_mode(graphics_video_mode); */
+ outportb(graph_config,3);
+ for(i=0;i<sizeof(paramg);i++)
+ {
+ outport2(seq_addr,i,paramg[i]);
+
+ }
+ outportb(graph_mode,0x0a); /* set page 0 */
+ for(i=0;i<0x3FFFL;i++) /* clear the screen */
+ {
+ int far *loc = (int far *)( regen +(2L*i));
+ *loc = 0;
+ }
+
+ return 0;
}
/* Macro for testing bit-inclusion */
@@ -217,38 +203,35 @@ herc_open(gx_device * dev)
/* Copy a monochrome bitmap. The colors are given explicitly. */
/* Color = gx_no_color_index means transparent (no effect on the image). */
int
-herc_copy_mono(gx_device * dev,
- const byte * base, int sourcex, int raster, gx_bitmap_id id,
- int x, int y, int w, int h, gx_color_index izero, gx_color_index ione)
-{
- rop_params params;
-
+herc_copy_mono(gx_device *dev,
+ const byte *base, int sourcex, int raster, gx_bitmap_id id,
+ int x, int y, int w, int h, gx_color_index izero, gx_color_index ione)
+{ rop_params params;
#define czero (int)izero
#define cone (int)ione
- int dleft, sleft, count;
- int invert, zmask, omask;
- byte mask, rmask;
-
- if (cone == czero) /* vacuous case */
- return herc_fill_rectangle(dev, x, y, w, h, izero);
-
- /* clip */
- fit_copy(dev, base, sourcex, raster, id, x, y, w, h);
- params.dest = mk_fb_ptr(x, y);
- params.draster = raster_x;
- params.src = base + (sourcex >> 3);
- params.sraster = raster;
- params.height = h;
- params.shift = (x - sourcex) & 7;
- params.y_pos = y;
- params.x_pos = x;
- params.width = w;
-
- if (czero > cone)
- params.invert = -1;
-
- /* Macros for writing partial bytes. */
- /* bits has already been inverted by xor'ing with invert. */
+ int dleft, sleft, count;
+ int invert, zmask, omask;
+ byte mask, rmask;
+
+ if ( cone == czero ) /* vacuous case */
+ return herc_fill_rectangle(dev, x, y, w, h, izero);
+
+ /* clip */
+ fit_copy(dev, base, sourcex, raster, id, x, y, w, h);
+ params.dest = mk_fb_ptr(x, y);
+ params.draster = raster_x;
+ params.src = base + (sourcex >> 3);
+ params.sraster = raster;
+ params.height = h;
+ params.shift = (x - sourcex) & 7;
+ params.y_pos = y;
+ params.x_pos = x;
+ params.width = w;
+
+ if(czero > cone) params.invert = -1;
+
+ /* Macros for writing partial bytes. */
+ /* bits has already been inverted by xor'ing with invert. */
#define write_byte_masked(ptr, bits, mask)\
*ptr = ((bits | ~mask | zmask) & (*ptr | (bits & mask & omask)))
@@ -256,124 +239,135 @@ herc_copy_mono(gx_device * dev,
#define write_byte(ptr, bits)\
*ptr = ((bits | zmask) & (*ptr | (bits & omask)))
- invert = (czero == 1 || cone == 0 ? -1 : 0);
-/* invert = (czero == 1 || cone == 1 ? -1 : 0); */
- zmask = (czero == 0 || cone == 0 ? 0 : -1);
- omask = (czero == 1 || cone == 1 ? -1 : 0);
+ invert = (czero == 1 || cone == 0 ? -1 : 0);
+/* invert = (czero == 1 || cone == 1 ? -1 : 0); */
+ zmask = (czero == 0 || cone == 0 ? 0 : -1);
+ omask = (czero == 1 || cone == 1 ? -1 : 0);
#undef czero
#undef cone
- /* Actually copy the bits. */
-
- sleft = 8 - (sourcex & 7);
- dleft = 8 - (x & 7);
- mask = 0xff >> (8 - dleft);
- count = w;
- if (w < dleft)
- mask -= mask >> w,
- rmask = 0;
- else
- rmask = 0xff00 >> ((w - dleft) & 7);
-
- if (sleft == dleft) { /* optimize the aligned case */
- w -= dleft;
- while (--h >= 0) {
- register const byte *bptr = params.src;
- register byte *optr = mk_fb_ptr(params.x_pos, params.y_pos);
- register int bits = *bptr ^ invert; /* first partial byte */
-
- count = w;
-
- write_byte_masked(optr, bits, mask);
-
- /* Do full bytes. */
-
- while ((count -= 8) >= 0) {
- bits = *++bptr ^ invert;
- params.x_pos += 8;
- optr = mk_fb_ptr(params.x_pos, params.y_pos);
- write_byte(optr, bits);
- }
- /* Do last byte */
-
- if (count > -8) {
- bits = *++bptr ^ invert;
- params.x_pos += 8;
- optr = mk_fb_ptr(params.x_pos, params.y_pos);
- write_byte_masked(optr, bits, rmask);
- }
-/* dest += BPL; */
- params.y_pos++;
- params.x_pos = x;
- params.src += raster;
+ /* Actually copy the bits. */
+
+ sleft = 8 - (sourcex & 7);
+ dleft = 8 - (x & 7);
+ mask = 0xff >> (8 - dleft);
+ count = w;
+ if ( w < dleft )
+ mask -= mask >> w,
+ rmask = 0;
+ else
+ rmask = 0xff00 >> ((w - dleft) & 7);
+
+ if (sleft == dleft) /* optimize the aligned case */
+ {
+ w -= dleft;
+ while ( --h >= 0 )
+ {
+ register const byte *bptr = params.src;
+ register byte *optr = mk_fb_ptr(params.x_pos,params.y_pos);
+ register int bits = *bptr ^ invert; /* first partial byte */
+
+ count = w;
+
+ write_byte_masked(optr, bits, mask);
+
+ /* Do full bytes. */
+
+ while ((count -= 8) >= 0)
+ {
+ bits = *++bptr ^ invert;
+ params.x_pos += 8;
+ optr = mk_fb_ptr(params.x_pos,params.y_pos);
+ write_byte(optr, bits);
+ }
+ /* Do last byte */
+
+ if (count > -8)
+ {
+ bits = *++bptr ^ invert;
+ params.x_pos += 8;
+ optr = mk_fb_ptr(params.x_pos,params.y_pos);
+ write_byte_masked(optr, bits, rmask);
+ }
+/* dest += BPL; */
+ params.y_pos++;
+ params.x_pos = x;
+ params.src += raster;
+ }
}
- } else {
- int skew = (sleft - dleft) & 7;
- int cskew = 8 - skew;
-
- while (--h >= 0) {
- const byte *bptr = params.src;
- byte *optr = mk_fb_ptr(params.x_pos, params.y_pos);
- register int bits;
-
- count = w;
-
- /* Do the first partial byte */
-
- if (sleft >= dleft) {
- bits = *bptr >> skew;
- } else { /* ( sleft < dleft ) */
- bits = *bptr++ << cskew;
- if (count > sleft)
- bits += *bptr >> skew;
- }
- bits ^= invert;
- write_byte_masked(optr, bits, mask);
- count -= dleft;
- params.x_pos += 8;
- optr = mk_fb_ptr(params.x_pos, params.y_pos);
-
- /* Do full bytes. */
-
- while (count >= 8) {
- bits = *bptr++ << cskew;
- bits += *bptr >> skew;
- bits ^= invert;
- write_byte(optr, bits);
- count -= 8;
- params.x_pos += 8;
- optr = mk_fb_ptr(params.x_pos, params.y_pos);
- }
-
- /* Do last byte */
-
- if (count > 0) {
- bits = *bptr++ << cskew;
- if (count > skew)
- bits += *bptr >> skew;
- bits ^= invert;
- write_byte_masked(optr, bits, rmask);
- }
-/* dest += BPL;
- line += raster;
- */
- params.y_pos++;
- params.x_pos = x;
- params.src += raster;
+ else
+ {
+ int skew = (sleft - dleft) & 7;
+ int cskew = 8 - skew;
+
+ while (--h >= 0)
+ {
+ const byte *bptr = params.src;
+ byte *optr = mk_fb_ptr(params.x_pos,params.y_pos);
+ register int bits;
+
+ count = w;
+
+ /* Do the first partial byte */
+
+ if (sleft >= dleft)
+ {
+ bits = *bptr >> skew;
+ }
+ else /* ( sleft < dleft ) */
+ {
+ bits = *bptr++ << cskew;
+ if (count > sleft)
+ bits += *bptr >> skew;
+ }
+ bits ^= invert;
+ write_byte_masked(optr, bits, mask);
+ count -= dleft;
+ params.x_pos += 8;
+ optr = mk_fb_ptr(params.x_pos,params.y_pos);
+
+ /* Do full bytes. */
+
+ while ( count >= 8 )
+ {
+ bits = *bptr++ << cskew;
+ bits += *bptr >> skew;
+ bits ^= invert;
+ write_byte(optr, bits);
+ count -= 8;
+ params.x_pos += 8;
+ optr = mk_fb_ptr(params.x_pos,params.y_pos);
+ }
+
+ /* Do last byte */
+
+ if (count > 0)
+ {
+ bits = *bptr++ << cskew;
+ if (count > skew)
+ bits += *bptr >> skew;
+ bits ^= invert;
+ write_byte_masked(optr, bits, rmask);
+ }
+/* dest += BPL;
+ line += raster;
+*/
+ params.y_pos++;
+ params.x_pos = x;
+ params.src += raster;
+ }
}
- }
- return 0;
+ return 0;
}
/* Copy a color pixelmap. This is just like a bitmap, */
int
-herc_copy_color(gx_device * dev,
- const byte * base, int sourcex, int raster, gx_bitmap_id id,
- int x, int y, int w, int h)
-{
- return herc_copy_mono(dev, base, sourcex, raster, id,
- x, y, w, h, (gx_color_index) 0, (gx_color_index) 1);
+herc_copy_color(gx_device *dev,
+ const byte *base, int sourcex, int raster, gx_bitmap_id id,
+ int x, int y, int w, int h)
+{ return herc_copy_mono(dev, base, sourcex, raster, id,
+ x, y, w, h,(gx_color_index)0, (gx_color_index)1);
}
# define mk_fb_yptr(x, y)\
@@ -381,103 +375,108 @@ herc_copy_color(gx_device * dev,
/* Fill a rectangle. */
int
-herc_fill_rectangle(gx_device * dev, int x, int y, int w, int h,
- gx_color_index color)
-{
- rop_params params;
-
- int x2, y2, xlen;
- byte led, red, d;
- byte far *ptr;
- int xloc;
-
- fit_fill(dev, x, y, w, h);
-
- params.dest = mk_fb_ptr(x, y);
- params.y_pos = y;
- params.x_pos = x;
-
- x2 = x + w - 1;
- y2 = y + h - 1;
-
- xlen = (x2 >> 3) - (x >> 3) - 1;
- led = 0xff >> (x & 7);
- red = 0xff << (7 - (x2 & 7));
-
- ptr = mk_fb_ptr(x, y);
-
- if (color) {
- /* here to set pixels */
-
- if (xlen == -1) {
- /* special for rectangles that fit in a byte */
-
- d = led & red;
- for (; h >= 0; h--, ptr = mk_fb_ptr(x, params.y_pos)) {
- *ptr |= d;
- params.y_pos++;
- }
- return 0;
+herc_fill_rectangle(gx_device *dev, int x, int y, int w, int h,
+ gx_color_index color)
+{ rop_params params;
+
+ int x2, y2, xlen;
+ byte led, red, d;
+ byte far *ptr;
+ int xloc;
+
+ fit_fill(dev, x, y, w, h);
+
+ params.dest = mk_fb_ptr(x, y);
+ params.y_pos = y;
+ params.x_pos = x;
+
+ x2 = x + w - 1;
+ y2 = y + h - 1;
+
+ xlen = (x2 >> 3) - (x >> 3) - 1;
+ led = 0xff >> (x & 7);
+ red = 0xff << (7 - (x2 & 7));
+
+ ptr = mk_fb_ptr(x,y);
+
+ if (color)
+ {
+ /* here to set pixels */
+
+ if (xlen == -1)
+ {
+ /* special for rectangles that fit in a byte */
+
+ d = led & red;
+ for(; h >= 0; h--, ptr = mk_fb_ptr(x,params.y_pos))
+ {
+ *ptr |= d;
+ params.y_pos++;
+ }
+ return 0;
+ }
+
+ /* normal fill */
+
+ xloc = params.x_pos >> 3;
+ for(; h >= 0; h--, ptr = mk_fb_ptr(x,params.y_pos))
+ { register int x_count = xlen;
+ register byte far *p = ptr;
+ *p |= led;
+/* params.x_pos += 8; */
+ xloc++;
+ p = mk_fb_yptr(xloc,params.y_pos);
+ while ( x_count-- ) {
+ *p = 0xff;
+/* params.x_pos += 8; */
+ xloc++;
+ p = mk_fb_yptr(xloc,params.y_pos);
+ }
+ *p |= red;
+/* params.x_pos = x; */
+ xloc = params.x_pos >> 3;
+ params.y_pos++;
+ }
}
- /* normal fill */
- xloc = params.x_pos >> 3;
- for (; h >= 0; h--, ptr = mk_fb_ptr(x, params.y_pos)) {
- register int x_count = xlen;
- register byte far *p = ptr;
-
- *p |= led;
-/* params.x_pos += 8; */
- xloc++;
- p = mk_fb_yptr(xloc, params.y_pos);
- while (x_count--) {
- *p = 0xff;
-/* params.x_pos += 8; */
- xloc++;
- p = mk_fb_yptr(xloc, params.y_pos);
- }
- *p |= red;
-/* params.x_pos = x; */
- xloc = params.x_pos >> 3;
- params.y_pos++;
+ /* here to clear pixels */
+
+ led = ~led;
+ red = ~red;
+
+ if (xlen == -1)
+ {
+ /* special for rectangles that fit in a byte */
+
+ d = led | red;
+ for(; h >= 0; h--, ptr = mk_fb_ptr(x,params.y_pos))
+ {
+ *ptr &= d;
+ params.y_pos++;
+ }
+ return 0;
}
- }
- /* here to clear pixels */
-
- led = ~led;
- red = ~red;
-
- if (xlen == -1) {
- /* special for rectangles that fit in a byte */
- d = led | red;
- for (; h >= 0; h--, ptr = mk_fb_ptr(x, params.y_pos)) {
- *ptr &= d;
- params.y_pos++;
+ /* normal fill */
+
+ xloc = x >> 3;
+ for(; h >= 0; h--, ptr = mk_fb_ptr(x,params.y_pos))
+ { register int x_count = xlen;
+ register byte far *p = ptr;
+ *p &= led;
+/* params.x_pos += 8; */
+ xloc++;
+ p = mk_fb_yptr(xloc,params.y_pos);
+ while ( x_count-- ) {
+ *p = 0x00;
+/* params.x_pos += 8; */
+ xloc++;
+ p = mk_fb_yptr(xloc,params.y_pos);
+ }
+ *p &= red;
+/* params.x_pos = x; */
+ xloc = params.x_pos >> 3;
+ params.y_pos++;
}
return 0;
- }
- /* normal fill */
-
- xloc = x >> 3;
- for (; h >= 0; h--, ptr = mk_fb_ptr(x, params.y_pos)) {
- register int x_count = xlen;
- register byte far *p = ptr;
-
- *p &= led;
-/* params.x_pos += 8; */
- xloc++;
- p = mk_fb_yptr(xloc, params.y_pos);
- while (x_count--) {
- *p = 0x00;
-/* params.x_pos += 8; */
- xloc++;
- p = mk_fb_yptr(xloc, params.y_pos);
- }
- *p &= red;
-/* params.x_pos = x; */
- xloc = params.x_pos >> 3;
- params.y_pos++;
- }
- return 0;
}
diff --git a/gs/src/gdevht.c b/gs/src/gdevht.c
index 00d8a5ab4..57192ba81 100644
--- a/gs/src/gdevht.c
+++ b/gs/src/gdevht.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995, 1996 Aladdin Enterprises. All rights reserved.
+/* Copyright (C) 1995, 1996, 1997, 1998 Aladdin Enterprises. All rights reserved.
This file is part of Aladdin Ghostscript.
@@ -16,7 +16,7 @@
all copies.
*/
-/* gdevht.c */
+/*Id: gdevht.c */
/* Halftoning device implementation */
#include "gx.h"
#include "gserrors.h"
@@ -33,7 +33,14 @@ private dev_proc_map_color_rgb(ht_map_color_rgb);
private dev_proc_fill_rectangle(ht_fill_rectangle);
private dev_proc_map_cmyk_color(ht_map_cmyk_color);
private dev_proc_map_rgb_alpha_color(ht_map_rgb_alpha_color);
-private const gx_device_ht far_data gs_ht_device =
+private dev_proc_fill_path(ht_fill_path);
+private dev_proc_stroke_path(ht_stroke_path);
+private dev_proc_fill_mask(ht_fill_mask);
+private dev_proc_fill_trapezoid(ht_fill_trapezoid);
+private dev_proc_fill_parallelogram(ht_fill_parallelogram);
+private dev_proc_fill_triangle(ht_fill_triangle);
+private dev_proc_draw_thin_line(ht_draw_thin_line);
+private const gx_device_ht gs_ht_device =
{std_device_dci_body(gx_device_ht, 0, "halftoner",
0, 0, 1, 1,
1, 8, 255, 0, 0, 0),
@@ -61,20 +68,25 @@ private const gx_device_ht far_data gs_ht_device =
gx_default_copy_alpha,
gx_forward_get_band,
gx_default_copy_rop,
- gx_default_fill_path,
- gx_default_stroke_path,
- gx_default_fill_mask,
- gx_default_fill_trapezoid,
- gx_default_fill_parallelogram,
- gx_default_fill_triangle,
- gx_default_draw_thin_line,
+ ht_fill_path,
+ ht_stroke_path,
+ ht_fill_mask,
+ ht_fill_trapezoid,
+ ht_fill_parallelogram,
+ ht_fill_triangle,
+ ht_draw_thin_line,
gx_default_begin_image,
gx_default_image_data,
gx_default_end_image,
gx_default_strip_tile_rectangle,
gx_default_strip_copy_rop,
gx_forward_get_clipping_box,
+ gx_default_begin_typed_image,
+ gx_no_get_bits_rectangle,
+ gx_default_map_color_rgb_alpha,
+ gx_no_create_compositor,
gx_forward_get_hardware_params,
+ gx_default_text_begin
}
};
@@ -83,36 +95,70 @@ private const gx_device_ht far_data gs_ht_device =
* a gx_color_index. Since C doesn't let us cast between a structure
* and a scalar, we have to use explicit shifting and masking.
*/
-#define cx_bits (sizeof(gx_color_index) * 8)
-#define cx_color_mask ((1 << ht_target_max_depth) - 1)
-#define cx_color0(color) ((color) >> (cx_bits - ht_target_max_depth))
-#define cx_color1(color) (((color) >> (ht_level_depth)) & cx_color_mask)
-#define cx_level(color) ((color) & ((1 << ht_level_depth) - 1))
+#define cx_color0(color) ((color) & htdev->color_mask)
+#define cx_color1(color) (((color) >> htdev->color_shift) & htdev->color_mask)
+#define cx_level(color) ((color) >> htdev->level_shift)
#define cx_values(c0, c1, lev)\
- ( ((((c0) << ht_target_max_depth) + (c1)) << ht_level_depth) + (lev) )
+ ( ((lev) << htdev->level_shift) + ((c1) << htdev->color_shift) + (c0) )
+
+/* ---------------- Non-drawing procedures ---------------- */
/* Open the device. Right now we just make some error checks. */
private int
ht_open(gx_device * dev)
{
- if (htdev->target == 0 ||
- htdev->target->color_info.depth > ht_target_max_depth
- )
+ gx_device_ht *htdev = (gx_device_ht *) dev;
+ const gx_device *target = htdev->target;
+ const gx_device_halftone *pdht = htdev->dev_ht;
+ int target_depth;
+ uint num_levels;
+
+ if (target == 0 || pdht == 0 || pdht->num_comp != 0)
return_error(gs_error_rangecheck);
- htdev->phase.x = imod(-htdev->ht_phase.x, htdev->dev_ht->lcm_width);
- htdev->phase.y = imod(-htdev->ht_phase.y, htdev->dev_ht->lcm_height);
+ /*
+ * Make sure we can fit a halftone level and two target colors
+ * into a gx_color_index. If we're lucky, we can pack them into
+ * even less space.
+ */
+ target_depth = target->color_info.depth;
+ num_levels = pdht->order.num_levels;
+ {
+ int depth = target_depth * 2 + num_levels;
+
+ if (depth > sizeof(gx_color_index) * 8)
+ return_error(gs_error_rangecheck);
+ /*
+ * If there are too few halftone levels (fewer than 32),
+ * we can't treat this device as contone.
+ */
+ if (num_levels < 32)
+ return_error(gs_error_rangecheck);
+ /* Set up color information. */
+ htdev->color_info.num_components = target->color_info.num_components;
+ htdev->color_info.depth = depth;
+ htdev->color_info.max_gray = num_levels - 1;
+ htdev->color_info.max_color = num_levels - 1;
+ htdev->color_info.dither_grays = num_levels;
+ htdev->color_info.dither_colors = num_levels;
+ }
+ htdev->color_shift = target_depth;
+ htdev->level_shift = target_depth * 2;
+ htdev->color_mask = ((gx_color_index) 1 << target_depth) - 1;
+ htdev->phase.x = imod(-htdev->ht_phase.x, pdht->lcm_width);
+ htdev->phase.y = imod(-htdev->ht_phase.y, pdht->lcm_height);
return 0;
}
/* Map from RGB or CMYK colors to the packed representation. */
private gx_color_index
-ht_finish_map_color(int code, const gx_device_color * pdevc)
+ht_finish_map_color(const gx_device_ht * htdev, int code,
+ const gx_device_color * pdevc)
{
if (code < 0)
return gx_no_color_index;
- if (pdevc->type == &gx_dc_pure)
+ if (gx_dc_is_pure(pdevc))
return cx_values(pdevc->colors.pure, 0, 0);
- if (pdevc->type == &gx_dc_ht_binary)
+ if (gx_dc_is_binary_halftone(pdevc))
return cx_values(pdevc->colors.binary.color[0],
pdevc->colors.binary.color[1],
pdevc->colors.binary.b_level);
@@ -125,15 +171,16 @@ ht_map_rgb_color(gx_device * dev, gx_color_value r, gx_color_value g,
{
return ht_map_rgb_alpha_color(dev, r, g, b, gx_max_color_value);
}
-gx_color_index
+private gx_color_index
ht_map_cmyk_color(gx_device * dev, gx_color_value c, gx_color_value m,
gx_color_value y, gx_color_value k)
{
+ gx_device_ht *htdev = (gx_device_ht *) dev;
gx_device_color devc;
frac fc = cv2frac(k);
frac fk = cv2frac(k);
int code =
- (c == m & m == y ?
+ (c == m && m == y ?
gx_render_device_gray(color_cmyk_to_gray(fc, fc, fc, fk, NULL),
gx_max_color_value,
&devc, htdev->target, htdev->dev_ht,
@@ -143,15 +190,16 @@ ht_map_cmyk_color(gx_device * dev, gx_color_value c, gx_color_value m,
&devc, htdev->target, htdev->dev_ht,
&htdev->ht_phase));
- return ht_finish_map_color(code, &devc);
+ return ht_finish_map_color(htdev, code, &devc);
}
-gx_color_index
+private gx_color_index
ht_map_rgb_alpha_color(gx_device * dev, gx_color_value r,
gx_color_value g, gx_color_value b, gx_color_value alpha)
{
+ gx_device_ht *htdev = (gx_device_ht *) dev;
gx_device_color devc;
int code =
- (r == g & g == b ?
+ (r == g && g == b ?
gx_render_device_gray(cv2frac(r), alpha,
&devc, htdev->target, htdev->dev_ht,
&htdev->ht_phase) :
@@ -160,7 +208,7 @@ ht_map_rgb_alpha_color(gx_device * dev, gx_color_value r,
&devc, htdev->target, htdev->dev_ht,
&htdev->ht_phase));
- return ht_finish_map_color(code, &devc);
+ return ht_finish_map_color(htdev, code, &devc);
}
/* Map back to an RGB color. */
@@ -168,9 +216,10 @@ private int
ht_map_color_rgb(gx_device * dev, gx_color_index color,
gx_color_value prgb[3])
{
+ gx_device_ht *htdev = (gx_device_ht *) dev;
+ gx_device *tdev = htdev->target;
gx_color_index color0 = cx_color0(color);
uint level = cx_level(color);
- gx_device *tdev = htdev->target;
dev_proc_map_color_rgb((*map)) = dev_proc(tdev, map_color_rgb);
@@ -191,20 +240,50 @@ ht_map_color_rgb(gx_device * dev, gx_color_index color,
}
}
+/* ---------------- Drawing procedures ---------------- */
+
+/*
+ * Map a (pure) contone color into a gx_device_color, either pure or
+ * halftoned. Return 0 if pure, 1 if halftoned, <0 if the original color
+ * wasn't pure. (This is not a driver procedure.)
+ */
+private int
+ht_map_device_color(const gx_device_ht * htdev, gx_device_color * pdevc,
+ const gx_device_color * pcdevc)
+{
+ if (!gx_dc_is_pure(pcdevc))
+ return -1;
+ {
+ gx_color_index color = pcdevc->colors.pure;
+ gx_color_index color0 = cx_color0(color);
+ uint level = cx_level(color);
+
+ if (level == 0) {
+ color_set_pure(pdevc, color0);
+ return 0;
+ } else {
+ color_set_binary_halftone(pdevc, htdev->dev_ht, color0,
+ cx_color1(color), level);
+ color_set_phase(pdevc, htdev->phase.x, htdev->phase.y);
+ return 1;
+ }
+ }
+}
+
/* Fill a rectangle by tiling with a halftone. */
private int
ht_fill_rectangle(gx_device * dev, int x, int y, int w, int h,
gx_color_index color)
{
+ gx_device_ht *htdev = (gx_device_ht *) dev;
+ gx_device *tdev = htdev->target;
gx_color_index color0 = cx_color0(color);
uint level = cx_level(color);
- gx_device *tdev = htdev->target;
if (level == 0)
return (*dev_proc(tdev, fill_rectangle))
(tdev, x, y, w, h, color0);
{
- gx_color_index color1 = cx_color1(color);
const gx_ht_order *porder = &htdev->dev_ht->order;
gx_ht_cache *pcache = porder->cache;
gx_ht_tile *tile;
@@ -217,8 +296,104 @@ ht_fill_rectangle(gx_device * dev, int x, int y, int w, int h,
if (tile == 0)
return_error(gs_error_Fatal);
/* Fill the rectangle with the tile. */
- return (*dev_proc(tdev, tile_rectangle))
- (tdev, &tile->tile, x, y, w, h, color0, color1,
+ return (*dev_proc(tdev, strip_tile_rectangle))
+ (tdev, &tile->tiles, x, y, w, h, color0, cx_color1(color),
htdev->phase.x, htdev->phase.y);
}
}
+
+/*
+ * Create a halftoned color if necessary for the high-level drawing
+ * operations.
+ */
+
+#define MAP_DRAWING_COLOR(proc, default_proc)\
+ gx_device_ht *htdev = (gx_device_ht *)dev;\
+ gx_device_color dcolor;\
+ gx_device *tdev;\
+ const gx_device_color *tdcolor;\
+\
+ if ( ht_map_device_color(htdev, &dcolor, pdcolor) < 0 )\
+ tdev = dev, tdcolor = pdcolor, proc = default_proc;\
+ else\
+ tdev = htdev->target, tdcolor = &dcolor,\
+ proc = dev_proc(tdev, proc)
+
+private int
+ht_fill_path(gx_device * dev,
+ const gs_imager_state * pis, gx_path * ppath,
+ const gx_fill_params * params,
+ const gx_drawing_color * pdcolor, const gx_clip_path * pcpath)
+{
+ dev_proc_fill_path((*fill_path));
+ MAP_DRAWING_COLOR(fill_path, gx_default_fill_path);
+ return (*fill_path) (tdev, pis, ppath, params, tdcolor, pcpath);
+}
+
+private int
+ht_stroke_path(gx_device * dev,
+ const gs_imager_state * pis, gx_path * ppath,
+ const gx_stroke_params * params,
+ const gx_drawing_color * pdcolor, const gx_clip_path * pcpath)
+{
+ dev_proc_stroke_path((*stroke_path));
+ MAP_DRAWING_COLOR(stroke_path, gx_default_stroke_path);
+ return (*stroke_path) (tdev, pis, ppath, params, tdcolor, pcpath);
+}
+
+private int
+ht_fill_mask(gx_device * dev,
+ const byte * data, int data_x, int raster, gx_bitmap_id id,
+ int x, int y, int width, int height,
+ const gx_drawing_color * pdcolor, int depth,
+ gs_logical_operation_t lop, const gx_clip_path * pcpath)
+{
+ dev_proc_fill_mask((*fill_mask));
+ MAP_DRAWING_COLOR(fill_mask, gx_default_fill_mask);
+ return (*fill_mask) (tdev, data, data_x, raster, id, x, y,
+ width, height, tdcolor, depth, lop, pcpath);
+}
+
+private int
+ht_fill_trapezoid(gx_device * dev,
+ const gs_fixed_edge * left, const gs_fixed_edge * right,
+ fixed ybot, fixed ytop, bool swap_axes,
+ const gx_drawing_color * pdcolor, gs_logical_operation_t lop)
+{
+ dev_proc_fill_trapezoid((*fill_trapezoid));
+ MAP_DRAWING_COLOR(fill_trapezoid, gx_default_fill_trapezoid);
+ return (*fill_trapezoid) (tdev, left, right, ybot, ytop, swap_axes,
+ tdcolor, lop);
+}
+
+private int
+ht_fill_parallelogram(gx_device * dev,
+ fixed px, fixed py, fixed ax, fixed ay, fixed bx, fixed by,
+ const gx_drawing_color * pdcolor, gs_logical_operation_t lop)
+{
+ dev_proc_fill_parallelogram((*fill_parallelogram));
+ MAP_DRAWING_COLOR(fill_parallelogram, gx_default_fill_parallelogram);
+ return (*fill_parallelogram) (tdev, px, py, ax, ay, bx, by,
+ tdcolor, lop);
+}
+
+private int
+ht_fill_triangle(gx_device * dev,
+ fixed px, fixed py, fixed ax, fixed ay, fixed bx, fixed by,
+ const gx_drawing_color * pdcolor, gs_logical_operation_t lop)
+{
+ dev_proc_fill_triangle((*fill_triangle));
+ MAP_DRAWING_COLOR(fill_triangle, gx_default_fill_triangle);
+ return (*fill_triangle) (tdev, px, py, ax, ay, bx, by,
+ tdcolor, lop);
+}
+
+private int
+ht_draw_thin_line(gx_device * dev,
+ fixed fx0, fixed fy0, fixed fx1, fixed fy1,
+ const gx_drawing_color * pdcolor, gs_logical_operation_t lop)
+{
+ dev_proc_draw_thin_line((*draw_thin_line));
+ MAP_DRAWING_COLOR(draw_thin_line, gx_default_draw_thin_line);
+ return (*draw_thin_line) (tdev, fx0, fy0, fx1, fy1, tdcolor, lop);
+}
diff --git a/gs/src/gdevht.h b/gs/src/gdevht.h
index 42f1c0fc8..b77079856 100644
--- a/gs/src/gdevht.h
+++ b/gs/src/gdevht.h
@@ -1,42 +1,45 @@
-/* Copyright (C) 1995 Aladdin Enterprises. All rights reserved.
-
- This file is part of Aladdin Ghostscript.
-
- Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
- or distributor accepts any responsibility for the consequences of using it,
- or for whether it serves any particular purpose or works at all, unless he
- or she says so in writing. Refer to the Aladdin Ghostscript Free Public
- License (the "License") for full details.
-
- Every copy of Aladdin Ghostscript must include a copy of the License,
- normally in a plain ASCII text file named PUBLIC. The License grants you
- the right to copy, modify and redistribute Aladdin Ghostscript, but only
- under certain conditions described in the License. Among other things, the
- License requires that the copyright notice and this notice be preserved on
- all copies.
-*/
-
-/* gdevht.h */
-/* Definitions for halftoning device */
+/* Copyright (C) 1995, 1998 Aladdin Enterprises. All rights reserved.
+
+ This file is part of Aladdin Ghostscript.
+
+ Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
+ or distributor accepts any responsibility for the consequences of using it,
+ or for whether it serves any particular purpose or works at all, unless he
+ or she says so in writing. Refer to the Aladdin Ghostscript Free Public
+ License (the "License") for full details.
+
+ Every copy of Aladdin Ghostscript must include a copy of the License,
+ normally in a plain ASCII text file named PUBLIC. The License grants you
+ the right to copy, modify and redistribute Aladdin Ghostscript, but only
+ under certain conditions described in the License. Among other things, the
+ License requires that the copyright notice and this notice be preserved on
+ all copies.
+ */
+
+/*Id: gdevht.h */
/* Requires gxdevice.h */
+
+#ifndef gdevht_INCLUDED
+# define gdevht_INCLUDED
+
#include "gzht.h"
/*
* A halftoning device converts between a non-halftoned device color space
* (e.g., 8-bit gray) and a halftoned space (e.g., 1-bit black and white).
- * Currently, the target space must not exceed 8 bits per pixel, so that
- * we can pack two target colors and a halftone level into a gx_color_index.
+ * We represent colors by packing the two colors being halftoned and the
+ * halftone level into a gx_color_index.
*/
-#define ht_target_max_depth 8
-#define ht_level_depth (sizeof(gx_color_index) * 8 - ht_target_max_depth * 2)
typedef struct gx_device_ht_s {
- gx_device_forward_common;
- /* Following are set before opening. */
- const gx_device_halftone *dev_ht;
- gs_int_point ht_phase; /* halftone phase from gstate */
- /* Following are computed when device is opened. */
- gs_int_point phase; /* halftone tile offset */
+ gx_device_forward_common;
+ /* Following + target are set before opening. */
+ const gx_device_halftone *dev_ht;
+ gs_int_point ht_phase; /* halftone phase from gstate */
+ /* Following are computed when device is opened. */
+ int color_shift; /* # of bits of color */
+ int level_shift; /* = color_shift * 2 */
+ gx_color_index color_mask; /* (1 << color_shift) - 1 */
+ gs_int_point phase; /* halftone tile offset */
} gx_device_ht;
-/* Macro for casting gx_device argument */
-#define htdev ((gx_device_ht *)dev)
+#endif /* gdevht_INCLUDED */
diff --git a/gs/src/gdevimgn.c b/gs/src/gdevimgn.c
index 460415a39..1eae82b04 100644
--- a/gs/src/gdevimgn.c
+++ b/gs/src/gdevimgn.c
@@ -1,33 +1,34 @@
/* Copyright (C) 1992, 1993, 1994, 1996 by Aladdin Enterprises. All rights reserved.
-
- This file is part of Aladdin Ghostscript.
-
- Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
- or distributor accepts any responsibility for the consequences of using it,
- or for whether it serves any particular purpose or works at all, unless he
- or she says so in writing. Refer to the Aladdin Ghostscript Free Public
- License (the "License") for full details.
-
- Every copy of Aladdin Ghostscript must include a copy of the License,
- normally in a plain ASCII text file named PUBLIC. The License grants you
- the right to copy, modify and redistribute Aladdin Ghostscript, but only
- under certain conditions described in the License. Among other things, the
- License requires that the copyright notice and this notice be preserved on
- all copies.
- */
-
-/* ---------------------------------------------------------- */
+
+ This file is part of Aladdin Ghostscript.
+
+ Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
+ or distributor accepts any responsibility for the consequences of using it,
+ or for whether it serves any particular purpose or works at all, unless he
+ or she says so in writing. Refer to the Aladdin Ghostscript Free Public
+ License (the "License") for full details.
+
+ Every copy of Aladdin Ghostscript must include a copy of the License,
+ normally in a plain ASCII text file named PUBLIC. The License grants you
+ the right to copy, modify and redistribute Aladdin Ghostscript, but only
+ under certain conditions described in the License. Among other things, the
+ License requires that the copyright notice and this notice be preserved on
+ all copies.
+*/
+
+/*Id: gdevimgn.c */
+/* ---------------------------------------------------------- */
/* gdevimgn.c - version 1.4 */
/* Imagen ImPRESS printer driver */
/* This driver uses the Impress bitmap operation to print the
page image. */
-/* -------------------------------------------------------- */
+/* -------------------------------------------------------- */
/* Written by Alan Millar (AMillar@bolis.sf-bay.org) August 4 1992.
- Basic bitmap dump. */
+ Basic bitmap dump. */
/* Updated by Alan Millar Sept 21 1992. Added resolution handling
- for 75, 150, and 300 dpi. */
+ for 75, 150, and 300 dpi. */
/* Updated by Alan Millar June 05 1993. General cleanup for
beta test release. */
/* Updated by Alan Millar June 21 1993. v1.3. Combined multipage
@@ -39,55 +40,55 @@
Swatch output redone to eliminate ALL blank swatches (swatchMap).
Buffer copying changed to multi-byte operations (BIGTYPE).
Page margins and A4 paper settings fixed, at least for Canon CX.
- */
+ */
-/* -------------------------------------------------------- */
+/* -------------------------------------------------------- */
/* Instructions:
- Add "imagen.dev" to DEVICE_DEVS in the makefile. For example:
- DEVICE_DEVS2=laserjet.dev imagen.dev
+ DEVICE_DEVS2=laserjet.dev imagen.dev
- Include or exclude USE_BYTE_STREAM in makefile as appropriate
- If you are compiling on Unix, re-run "tar_cat" to update the makefile
- from devs.mak
+ If you are compiling on Unix, re-run "tar_cat" to update the makefile
+ from devs.mak
- At run time, specify the resolution on the GS command line
- by using -r300 or -r150 or -r75
+ by using -r300 or -r150 or -r75
- At run time, specify any imPress document options in
- the IMPRESSHEADER environment variable.
- */
-
+ the IMPRESSHEADER environment variable.
+ */
+
/* -------------------------------------------------------- */
/* Hardware/software combinations tested:
- ImageStation IP3 8/300 with parallel byte-stream interface,
- using GS 2.6.1 on Linux with GCC 2.3.3;
- earlier using GS 2.5.1 on MS-Dos with Turbo C++ 1.0
+ using GS 2.6.1 on Linux with GCC 2.3.3;
+ earlier using GS 2.5.1 on MS-Dos with Turbo C++ 1.0
- Sequenced-packet-protocol interface untested.
- */
+ */
/* -------------------------------------------------------- */
/* Bugs/Enhancements:
- Driver does not use any Impress language features for
- drawing lines/arcs
+ drawing lines/arcs
- Driver does not use resident or downloadable fonts.
- Buffer output instead of system call for each byte?
- */
-
-/* -------------------------------------------------------- */
-#include "gdevprn.h"
+ */
+
+/* -------------------------------------------------------- */
+#include "gdevprn.h"
/* #include <stdio.h> should not be used in drivers */
#include <stdlib.h>
-
-/* -------------------------------------------------------- */
+
+/* -------------------------------------------------------- */
/* Working Constants */
/* Byte stream quoting: convert special characters to hex.
Specify by including/excluding -DUSE_BYTE_STREAM in makefile.
This should match printer's hardware interface configuration.
If printer interface is serial with sequenced-packet-protocol
- spooler software (ImageStation config# 11 = 01), then don't use it.
- Imagen "ipr" spooler software should not use byte stream.
+ spooler software (ImageStation config# 11 = 01), then don't use it.
+ Imagen "ipr" spooler software should not use byte stream.
If printer interface is Centronics parallel byte stream,
- (ImageStation config# 11 = 03), then use byte stream. */
+ (ImageStation config# 11 = 03), then use byte stream. */
#ifdef USE_BYTE_STREAM
# define BYTE_STREAM 1
@@ -99,48 +100,48 @@
Only needed when using byte stream */
#define QUOTE_CHAR (char) 0x02
/* Byte stream end-of-file character (ImageStation config# 14). */
-#define EOF_CHAR (char) 0x04
+#define EOF_CHAR (char) 0x04
/* Other special characters to quote. Put them here if spooler or
hardware uses flow control, etc. If not needed, set to
a redundant value such as EOF_CHAR */
-#define EXTRA_QUOTE1 (char) 0x11 /* ^Q */
-#define EXTRA_QUOTE2 (char) 0x13 /* ^S */
+#define EXTRA_QUOTE1 (char) 0x11 /* ^Q */
+#define EXTRA_QUOTE2 (char) 0x13 /* ^S */
#define EXTRA_QUOTE3 EOF_CHAR
#define EXTRA_QUOTE4 EOF_CHAR
-/* -------------------------------------------------------- */
+/* -------------------------------------------------------- */
/* imPress header default options.
Can be overridden at run-time with IMPRESSHEADER env variable */
#define IMPRESSHEADER "jobheader onerror, prerasterization off"
-/* -------------------------------------------------------- */
+/* -------------------------------------------------------- */
#define CANON_CX
/* Printer engine max resolution. 300 for Canon CX models such as
- ImageStation IP3. Others (240?) unverified */
+ ImageStation IP3. Others (240?) unverified */
#ifdef CANON_CX
-# define MAX_DPI 300
+# define MAX_DPI 300
#endif
#ifndef MAX_DPI
-# define MAX_DPI 300
+# define MAX_DPI 300
#endif
/* Determine imPress scaling factor from GS resolution.
Magnify can be 0, 1, or 2.
- 0 = MAX_DPI, 1 = MAX_DPI / 2, 2 = MAX_DPI / 4
+ 0 = MAX_DPI, 1 = MAX_DPI / 2, 2 = MAX_DPI / 4
Assuming MAX_DPI is 300, you can specify -r75 or -r150
- or -r300 on the GS command line */
+ or -r300 on the GS command line */
#define getMagnification ( \
( pdev->x_pixels_per_inch > (MAX_DPI >> 1) ) ? 0 : \
( pdev->x_pixels_per_inch > (MAX_DPI >> 2) ) ? 1 : \
2 )
-
-/* Page dimensions from gdevprn.h - specify -DA4 in makefile for A4 paper */
+
+/* Page dimensions from gdevprn.h - specify -DA4 in makefile for A4 paper */
#define WIDTH_10THS DEFAULT_WIDTH_10THS
#define HEIGHT_10THS DEFAULT_HEIGHT_10THS
-
+
/* Width in inches of unprintable edge of paper. May need fine tuning.
Canon CX engine in ImageStation IP3 8/300 will only print 8 inches
wide on any paper size. May vary for other engines */
@@ -155,16 +156,16 @@
#ifndef MARG_R
# define MARG_R 0.2
#endif
-#define MARG_T 0.1
-#define MARG_B 0.2
-
+#define MARG_T 0.1
+#define MARG_B 0.2
+
/* Flag for displaying debug messages at run-time. Higher
- number = higher detail */
+ number = higher detail */
#define IM_DEBUG 0
#define DebugMsg(Level,P1,P2) if (Level<=IM_DEBUG) {fprintf(stderr,P1,P2 );}
-/*-------------------------------------------*/
+/*-------------------------------------------*/
/* Impress bitmaps are made up of 32x32 bit swatches.
A swatch is four bytes (32 bits) wide by 32 bytes high,
totalling 128 bytes. */
@@ -172,8 +173,8 @@
#define HorzBitsPerSw (HorzBytesPerSw * 8)
#define VertBytesPerSw 32
#define TotalBytesPerSw (HorzBytesPerSw * VertBytesPerSw)
-
-/*-------------------------------------------*/
+
+/*-------------------------------------------*/
/* Attempt at optimization to something faster than byte-by-byte copying.
imPress swatches are 4 bytes wide, so type must align on a 4-byte
boundary. Swatch interleaving restricts the copy to 4 bytes in a row.
@@ -195,391 +196,378 @@
#define BIGSIZE ( sizeof( BIGTYPE ) )
-/*-------------------------------------------*/
-/* IMAGEN imPress Command opcodes */
-/* from DVIIMP.C */
-#define iSP 128 /* advance one space */
-#define iSP1 129 /* advance one space + 1 pixel */
-#define iMPLUS 131 /* Move one pixel forward */
-#define iMMINUS 132 /* Move one pixel back */
-#define iMMOVE 133 /* Move in main advance direction */
-#define iSMOVE 134 /* Move in secondary advance direction */
-
-#define iABS_H 135 /* Move to H position */
-#define iREL_H 136 /* Move in H direction */
-#define iABS_V 137 /* Move to V position */
-#define iREL_V 138 /* Move in V direction */
-
-#define iCRLF 197 /* move to beginning of next line */
-
-#define iSET_HV_SYSTEM 205 /* Define new coordinate system */
-#define iSET_ADV_DIRS 206 /* Define advance directions */
-
-#define iPAGE 213 /* Set H and V to 0 */
-#define iENDPAGE 219 /* print the current page */
-
-#define iBITMAP 235 /* Print a full bitmap */
-#define iSET_MAGNIFICATION 236
- /* magnify the page by 1, 2, 4 */
-#define iNOOP 254 /* no operation */
-#define iEOF 255 /* end of impress document */
-
-/*-------------------------------------------*/
-/*-------------------------------------------*/
-/* The device descriptor */
-
-private dev_proc_print_page(imagen_print_page);
+/*-------------------------------------------*/
+/* IMAGEN imPress Command opcodes */
+/* from DVIIMP.C */
+#define iSP 128 /* advance one space */
+#define iSP1 129 /* advance one space + 1 pixel */
+#define iMPLUS 131 /* Move one pixel forward */
+#define iMMINUS 132 /* Move one pixel back */
+#define iMMOVE 133 /* Move in main advance direction */
+#define iSMOVE 134 /* Move in secondary advance direction */
+
+#define iABS_H 135 /* Move to H position */
+#define iREL_H 136 /* Move in H direction */
+#define iABS_V 137 /* Move to V position */
+#define iREL_V 138 /* Move in V direction */
+
+#define iCRLF 197 /* move to beginning of next line */
+
+#define iSET_HV_SYSTEM 205 /* Define new coordinate system */
+#define iSET_ADV_DIRS 206 /* Define advance directions */
+
+#define iPAGE 213 /* Set H and V to 0 */
+#define iENDPAGE 219 /* print the current page */
+
+#define iBITMAP 235 /* Print a full bitmap */
+#define iSET_MAGNIFICATION 236
+ /* magnify the page by 1, 2, 4 */
+#define iNOOP 254 /* no operation */
+#define iEOF 255 /* end of impress document */
+
+/*-------------------------------------------*/
+/*-------------------------------------------*/
+/* The device descriptor */
+
+private dev_proc_print_page(imagen_print_page);
private dev_proc_open_device(imagen_prn_open);
private dev_proc_close_device(imagen_prn_close);
gx_device_procs imagen_procs =
-prn_procs(imagen_prn_open, gdev_prn_output_page, imagen_prn_close);
+ prn_procs(imagen_prn_open, gdev_prn_output_page, imagen_prn_close);
#define ppdev ((gx_device_printer *)pdev)
-/*-------------------------------------------*/
-gx_device_printer far_data gs_imagen_device =
-prn_device( /*prn_std_procs */ imagen_procs,
- "imagen",
- WIDTH_10THS,
- HEIGHT_10THS,
- MAX_DPI, /* x_dpi */
- MAX_DPI, /* y_dpi */
- MARG_L, MARG_R, MARG_T, MARG_B, /* margins */
- 1, imagen_print_page);
-
-/*-------------------------------------------*/
-
-/*-------------------------------------------*/
-private void
-iWrite(FILE * Out, byte Val)
-{ /* iWrite */
- char *hexList = "0123456789ABCDEF";
-
- /* if we are doing byte-stream, quote characters that would otherwise
- match EOF and QUOTE itself, or other special chars */
- /* Imagen quoting takes one character and writes out the QUOTE
- character followed by the hex digits of the quoted character */
- if (BYTE_STREAM &&
- (Val == QUOTE_CHAR || Val == EOF_CHAR
- || Val == EXTRA_QUOTE1 || Val == EXTRA_QUOTE2
- || Val == EXTRA_QUOTE3 || Val == EXTRA_QUOTE4)) {
- fputc(QUOTE_CHAR, Out);
- fputc((char)hexList[Val / 0x10], Out);
- fputc((char)hexList[Val % 0x10], Out);
- } else { /* quoted char */
- /* Not doing quoting, just send it out */
- fputc(Val, Out);
- } /* quoted char */
-} /* iWrite */
-
-/* Write out 16bit, high byte first */
-void
-iWrite2(FILE * Out, int Val)
-{ /* iWrite2 */
- iWrite(Out, (byte) (Val >> 8) & 0x00FF);
- iWrite(Out, (byte) Val & 0x00FF);
-} /* iWrite2 */
-
-/* --------------------------------------------------------- */
+/*-------------------------------------------*/
+gx_device_printer far_data gs_imagen_device =
+ prn_device(/*prn_std_procs*/ imagen_procs,
+ "imagen",
+ WIDTH_10THS,
+ HEIGHT_10THS,
+ MAX_DPI, /* x_dpi */
+ MAX_DPI, /* y_dpi */
+ MARG_L,MARG_R,MARG_T,MARG_B, /* margins */
+ 1, imagen_print_page);
+
+/*-------------------------------------------*/
+
+/*-------------------------------------------*/
+private void
+iWrite(FILE *Out, byte Val)
+{ /* iWrite */
+ char *hexList = "0123456789ABCDEF";
+
+ /* if we are doing byte-stream, quote characters that would otherwise
+ match EOF and QUOTE itself, or other special chars */
+ /* Imagen quoting takes one character and writes out the QUOTE
+ character followed by the hex digits of the quoted character */
+ if (BYTE_STREAM &&
+ ( Val == QUOTE_CHAR || Val == EOF_CHAR
+ || Val == EXTRA_QUOTE1 || Val == EXTRA_QUOTE2
+ || Val == EXTRA_QUOTE3 || Val == EXTRA_QUOTE4 ) ) {
+ fputc (QUOTE_CHAR, Out);
+ fputc ((char) hexList[Val / 0x10], Out);
+ fputc ((char) hexList[Val % 0x10], Out);
+ } else { /* quoted char */
+ /* Not doing quoting, just send it out */
+ fputc(Val, Out);
+ } /* quoted char */
+} /* iWrite */
+
+/* Write out 16bit, high byte first */
+void
+iWrite2(FILE *Out, int Val)
+{ /* iWrite2 */
+ iWrite(Out,(byte) (Val >> 8) & 0x00FF );
+ iWrite(Out,(byte) Val & 0x00FF );
+} /* iWrite2 */
+
+/* --------------------------------------------------------- */
private int
-imagen_prn_open(gx_device * pdev)
-{ /* imagen_prn_open */
- int code;
+imagen_prn_open(gx_device *pdev)
+{ /* imagen_prn_open */
+ int code;
- char *impHeader;
+ char *impHeader;
- /* ----------------------------------------- */
- DebugMsg(1, "%s\n", "Start of imagen_prn_open");
- DebugMsg(2, "BIGSIZE = %ld \n", BIGSIZE);
+ /* ----------------------------------------- */
+ DebugMsg(1,"%s\n","Start of imagen_prn_open");
+ DebugMsg(2,"BIGSIZE = %ld \n",BIGSIZE);
- code = gdev_prn_open(pdev);
- if (code < 0)
- return code;
+ code = gdev_prn_open(pdev);
+ if ( code < 0 ) return code;
- /* ----------------------------------------- */
+ /* ----------------------------------------- */
- DebugMsg(2, "opening file: %s\n", ppdev->fname);
- code = gdev_prn_open_printer(pdev, 1);
- if (code < 0)
- return code;
+ DebugMsg(2,"opening file: %s\n",ppdev->fname);
+ code = gdev_prn_open_printer(pdev, 1);
+ if ( code < 0 ) return code;
- impHeader = getenv("IMPRESSHEADER");
- if (impHeader == NULL) {
- impHeader = IMPRESSHEADER;
- } /* if impHeader */
- fprintf(ppdev->file, "@document(language impress, %s)", impHeader);
+ impHeader = getenv("IMPRESSHEADER");
+ if (impHeader == NULL ) {
+ impHeader = IMPRESSHEADER ;
+ } /* if impHeader */
- code = gdev_prn_close_printer(pdev);
- if (code < 0)
- return code;
+ fprintf(ppdev->file,"@document(language impress, %s)",impHeader);
+
+ code = gdev_prn_close_printer(pdev);
+ if ( code < 0 ) return code;
- /* ----------------------------------------- */
- DebugMsg(1, "%s\n", "End of imagen_prn_open");
+ /* ----------------------------------------- */
+ DebugMsg(1,"%s\n","End of imagen_prn_open");
- return code;
-} /* imagen_prn_open */
+ return code;
+} /* imagen_prn_open */
private int
-imagen_prn_close(gx_device * pdev)
-{ /* imagen_prn_close */
- int code;
-
- /* ----------------------------------------- */
- DebugMsg(1, "%s\n", "Start of imagen_prn_close");
-
- code = gdev_prn_open_printer(pdev, 1);
- if (code < 0)
- return code;
-
- /* Write imPress end of document marker */
- iWrite(ppdev->file, iEOF);
-
- /* And byte stream end of file */
- if (BYTE_STREAM) {
- /* DON'T use iWrite because actual EOF should not be quoted! */
- fputc(EOF_CHAR, ppdev->file);
- } /* if byte stream */
- fflush(ppdev->file);
-
- code = gdev_prn_close_printer(pdev);
- if (code < 0)
- return code;
-
- code = gdev_prn_close(pdev);
-
- DebugMsg(1, "%s\n", "End of imagen_prn_close");
-
- return (code);
-} /* imagen_prn_close */
-
-/*-------------------------------------------*/
-/* Send the page to the printer. */
-private int
-imagen_print_page(gx_device_printer * pdev, FILE * prn_stream)
-{
- int line_size = gdev_mem_bytes_per_scan_line((gx_device *) pdev);
-
- /* input buffer: one line of bytes rasterized by gs */
- byte *in = (byte *) gs_malloc(BIGSIZE, line_size / BIGSIZE + 1,
- "imagen_print_page(in)");
-
- /* output buffer: 32 lines, interleaved into imPress swatches */
- byte *out;
-
- /* working pointer into output buffer */
- byte *swatch;
- byte *temp;
-
- /* map of which swatches in a row are completely blank, or are non-blank */
- byte *swatchMap;
-
- /* starting line number on page of a row of swatches */
- int lnum;
-
- /* line number within a row of swatches */
- int swatchLine;
-
- /* ending line number of row of swatches */
- int lastLine;
-
- /* how many swatches can fit on a row */
- int swatchCount;
-
- /* index into row of non-blank swatch */
- int startSwatch;
- int endSwatch;
-
- /* Scaling factor for resolution */
- int Magnify;
-
- /* page totals */
- int totalBlankSwatches;
- int totalGreySwatches;
-
- /* ----------------------------------------- */
- /* Start of routine */
- /* ----------------------------------------- */
-
- DebugMsg(1, "%s\n", "Start of imagen_print_page");
-
- /* ----------------------------------------- */
- Magnify = getMagnification;
-
- /* Impress bitmaps are made up of 32x32 bit swatches.
- A swatch is four bytes wide by 32 bytes high.
- See how many swatches will fit horizontally. */
-
- swatchCount = (line_size + HorzBytesPerSw - 1) / HorzBytesPerSw;
-
- totalBlankSwatches = 0;
- totalGreySwatches = 0;
- DebugMsg(2, "Swatch count = %d\n", swatchCount);
- DebugMsg(2, "Line size = %d\n", line_size);
-
- out = (byte *) gs_malloc(TotalBytesPerSw, swatchCount + 1,
- "imagen_print_page(out)");
-
- swatchMap = (byte *) gs_malloc(BIGSIZE, swatchCount / BIGSIZE + 1,
- "imagen_print_page(swatchMap)");
-
- if (in == 0 || out == 0)
- return -1;
-
- /* Initialize the page */
- iWrite(prn_stream, iPAGE);
-
- /* Tell ImPress what resolution we will be using */
- iWrite(prn_stream, iSET_MAGNIFICATION);
- iWrite(prn_stream, Magnify);
-
-/*------------------------------------------------------*/
- /* main loop down page */
- lnum = 0;
- while (lnum <= pdev->height) {
-
- /* erase swatch map. */
- for (swatch = swatchMap; swatch < swatchMap + swatchCount;
- swatch += BIGSIZE) {
- *(BIGTYPE *) swatch = (BIGTYPE) 0;
- } /* for */
-
- /* get scan lines to fill swatches */
- swatchLine = 0;
- lastLine = VertBytesPerSw - 1;
-
- /* Check if we don't have a full-height row of swatches at end of page */
- if (lnum + lastLine > pdev->height) {
- /* back up last row so it overlaps with previous. Not a problem
- on a laser printer, because the overlapping part will be identical */
- lnum = pdev->height - lastLine;
- }; /* not full height */
-
- DebugMsg(3, "lnum = %d \n", lnum);
-
- /* ------------------------------------------------------- */
- /* get 32 lines and interleave into a row of swatches */
- for (swatchLine = 0; swatchLine <= lastLine; swatchLine++) {
- /* blank out end of buffer for BIGSIZE overlap */
- for (temp = in + line_size; temp < in + line_size + BIGSIZE; temp++) {
- *temp = 0;
- } /* for temp */
-
- /* get one line */
- gdev_prn_copy_scan_lines(pdev, lnum + swatchLine, in, line_size);
- DebugMsg(5, "Got scan line %d ", lnum + swatchLine);
- DebugMsg(5, "line %d \n", swatchLine);
-
- /* interleave scan line into swatch buffer */
- /* a swatch is a 4 byte * 32 byte square. Swatches are placed
- next to each other. The first scan line maps into the first
- four bytes of the first swatch, then the first four of the second
- swatch, etc.
- To get this on the page:
- A1 A1 A1 A1 B1 B1 B1 B1 C1 C1 C1 C1
- A2 A2 A2 A2 B2 B2 B2 B2 C2 C2 C2 C2
- ...
- A32 A32 A32 A32 B32 B32 B32 B32 C32 C32 C32 C32
- You have to send it as:
- A1 A1 A1 A1 A2 ... A32 B1 B1 .. B32 C1 C1 ... C32 */
-
- /* set initial offset into swatch buffer based on which
- line in the swatch we are processing */
- swatch = out + swatchLine * HorzBytesPerSw;
- DebugMsg(5, "offset: swatch = %d \n", (int)(swatch - out));
- temp = in;
- while (temp < in + line_size) {
- /* copy multi-byte to swatch buffer */
- *(BIGTYPE *) swatch = *(BIGTYPE *) temp;
- if (*(BIGTYPE *) temp) {
- /* mark map if not blank */
- swatchMap[(swatch - out) / TotalBytesPerSw] = (byte) 1;
- } /* if not zero */
- temp += (BIGSIZE > HorzBytesPerSw) ? HorzBytesPerSw : BIGSIZE;
- swatch += (BIGSIZE > HorzBytesPerSw) ? HorzBytesPerSw : BIGSIZE;
-
- /* if we copied four bytes, skip to next swatch */
- if (((temp - in) % HorzBytesPerSw) == 0) {
- swatch += (TotalBytesPerSw - HorzBytesPerSw);
- } /* if need to skip */
- } /* while < line_size */
-
- } /* for swatchLine */
-
- /* ------------------------------------------------- */
- /* we now have full swatches. */
- /* Send to printer */
-
- /* go through swatch map to find non-blank swatches.
- Skip over completely blank swatches */
- startSwatch = 0;
- while (startSwatch < swatchCount) {
- if (swatchMap[startSwatch] == 0) {
- /* skip blank swatch */
- DebugMsg(6, "Skip blank %d \n", startSwatch);
- totalBlankSwatches++;
- startSwatch++;
- } else { /* if swatch == 0 */
- /* we hit a non-blank swatch. */
- totalGreySwatches++;
-
- /* See how many there are in a row */
- endSwatch = startSwatch;
- while ((endSwatch < swatchCount) && swatchMap[endSwatch]) {
- endSwatch++;
- totalGreySwatches++;
- } /* while */
- /* endSwatch is one past last non-blank swatch */
- DebugMsg(6, "Grey swatches %d ", startSwatch);
- DebugMsg(6, "until %d \n", endSwatch);
-
- /* vertical position: scan line, shifted for magnification */
- iWrite(prn_stream, iABS_V);
- iWrite2(prn_stream, lnum << Magnify);
-
- /* horizontal position = swatch number * 32 bits/swatch */
- iWrite(prn_stream, iABS_H);
- iWrite2(prn_stream, startSwatch * HorzBitsPerSw << Magnify);
- iWrite(prn_stream, iBITMAP); /* start bitmap */
- iWrite(prn_stream, 0x07); /* bit OR with page */
- iWrite(prn_stream, (endSwatch - startSwatch)); /* horizontal
- number of swatches */
- iWrite(prn_stream, 1); /* vertical number of swatches */
- /* write out swatch buffer */
- for (swatch = out + startSwatch * TotalBytesPerSw;
- swatch < out + endSwatch * TotalBytesPerSw; swatch++) {
- iWrite(prn_stream, *swatch);
- } /* for swatch */
-
- /* swatches have been printed, see if there are still
- more in this row */
- startSwatch = endSwatch;
- } /* if swatch == 0 */
-
- } /* while startSwatch */
-
- /* Whole row of swatches is done. Go on to next row of swatches */
- lnum += lastLine + 1;
-
- } /* while lnum */
-
- /* Eject the page */
- iWrite(prn_stream, iENDPAGE);
-
- fflush(prn_stream);
-
- gs_free((char *)swatchMap, BIGSIZE, swatchCount / BIGSIZE + 1,
- "imagen_print_page(swatchMap)");
- gs_free((char *)out, TotalBytesPerSw, swatchCount + 1, "imagen_print_page(out)");
- gs_free((char *)in, BIGSIZE, line_size / BIGSIZE + 1, "imagen_print_page(in)");
- /* ----------------------------------------- */
-
- DebugMsg(1, "Debug: Grey: %d \n", totalGreySwatches);
- DebugMsg(1, "Debug: Blank: %d \n", totalBlankSwatches);
- DebugMsg(1, "%s\n", "End of imagen_print_page");
-
- /* ----------------------------------------- */
- return 0;
-
-} /* imagen_print_page */
+imagen_prn_close(gx_device *pdev)
+{ /* imagen_prn_close */
+ int code;
+
+ /* ----------------------------------------- */
+ DebugMsg(1,"%s\n","Start of imagen_prn_close");
+
+ code = gdev_prn_open_printer(pdev, 1);
+ if ( code < 0 ) return code;
+
+ /* Write imPress end of document marker */
+ iWrite(ppdev->file,iEOF);
+
+ /* And byte stream end of file */
+ if (BYTE_STREAM) {
+ /* DON'T use iWrite because actual EOF should not be quoted! */
+ fputc(EOF_CHAR,ppdev->file);
+ } /* if byte stream */
+
+ fflush(ppdev->file);
+
+ code = gdev_prn_close_printer(pdev);
+ if ( code < 0 ) return code;
+
+ code = gdev_prn_close(pdev);
+
+ DebugMsg(1,"%s\n","End of imagen_prn_close");
+
+ return(code);
+} /* imagen_prn_close */
+
+/*-------------------------------------------*/
+/* Send the page to the printer. */
+private int
+imagen_print_page(gx_device_printer *pdev, FILE *prn_stream)
+{
+ int line_size = gdev_mem_bytes_per_scan_line((gx_device *)pdev);
+ /* input buffer: one line of bytes rasterized by gs */
+ byte *in = (byte *)gs_malloc(BIGSIZE, line_size / BIGSIZE + 1,
+ "imagen_print_page(in)");
+ /* output buffer: 32 lines, interleaved into imPress swatches */
+ byte *out;
+ /* working pointer into output buffer */
+ byte *swatch;
+ byte *temp;
+ /* map of which swatches in a row are completely blank, or are non-blank */
+ byte *swatchMap;
+ /* starting line number on page of a row of swatches */
+ int lnum ;
+ /* line number within a row of swatches */
+ int swatchLine;
+ /* ending line number of row of swatches */
+ int lastLine;
+ /* how many swatches can fit on a row */
+ int swatchCount;
+ /* index into row of non-blank swatch */
+ int startSwatch;
+ int endSwatch;
+ /* Scaling factor for resolution */
+ int Magnify;
+ /* page totals */
+ int totalBlankSwatches;
+ int totalGreySwatches;
+
+ /* ----------------------------------------- */
+ /* Start of routine */
+ /* ----------------------------------------- */
+
+ DebugMsg(1,"%s\n","Start of imagen_print_page");
+
+ /* ----------------------------------------- */
+ Magnify = getMagnification ;
+
+ /* Impress bitmaps are made up of 32x32 bit swatches.
+ A swatch is four bytes wide by 32 bytes high.
+ See how many swatches will fit horizontally. */
+
+ swatchCount = (line_size + HorzBytesPerSw - 1) / HorzBytesPerSw;
+
+ totalBlankSwatches = 0 ;
+ totalGreySwatches = 0 ;
+ DebugMsg(2,"Swatch count = %d\n",swatchCount);
+ DebugMsg(2,"Line size = %d\n",line_size );
+
+ out = (byte *)gs_malloc(TotalBytesPerSw , swatchCount + 1,
+ "imagen_print_page(out)");
+
+ swatchMap = (byte *)gs_malloc(BIGSIZE,swatchCount / BIGSIZE + 1,
+ "imagen_print_page(swatchMap)" );
+
+ if ( in == 0 || out == 0 )
+ return -1;
+
+ /* Initialize the page */
+ iWrite(prn_stream,iPAGE);
+
+ /* Tell ImPress what resolution we will be using */
+ iWrite(prn_stream,iSET_MAGNIFICATION);
+ iWrite(prn_stream,Magnify);
+
+ /*------------------------------------------------------*/
+ /* main loop down page */
+ lnum = 0;
+ while (lnum <= pdev->height) {
+
+ /* erase swatch map. */
+ for (swatch = swatchMap; swatch < swatchMap + swatchCount ;
+ swatch += BIGSIZE ) {
+ * (BIGTYPE *)swatch = (BIGTYPE) 0;
+ } /* for */
+
+ /* get scan lines to fill swatches */
+ swatchLine = 0;
+ lastLine = VertBytesPerSw - 1;
+
+ /* Check if we don't have a full-height row of swatches at end of page */
+ if (lnum + lastLine > pdev->height ) {
+ /* back up last row so it overlaps with previous. Not a problem
+ on a laser printer, because the overlapping part will be identical */
+ lnum = pdev->height - lastLine ;
+ }; /* not full height */
+
+ DebugMsg (3,"lnum = %d \n",lnum);
+
+ /* ------------------------------------------------------- */
+ /* get 32 lines and interleave into a row of swatches */
+ for (swatchLine = 0 ; swatchLine <= lastLine; swatchLine++) {
+ /* blank out end of buffer for BIGSIZE overlap */
+ for (temp = in + line_size; temp < in + line_size + BIGSIZE;temp++){
+ *temp = 0;
+ } /* for temp */
+
+ /* get one line */
+ gdev_prn_copy_scan_lines(pdev, lnum + swatchLine, in, line_size);
+ DebugMsg(5,"Got scan line %d ", lnum + swatchLine);
+ DebugMsg(5,"line %d \n", swatchLine);
+
+ /* interleave scan line into swatch buffer */
+ /* a swatch is a 4 byte * 32 byte square. Swatches are placed
+ next to each other. The first scan line maps into the first
+ four bytes of the first swatch, then the first four of the second
+ swatch, etc.
+ To get this on the page:
+ A1 A1 A1 A1 B1 B1 B1 B1 C1 C1 C1 C1
+ A2 A2 A2 A2 B2 B2 B2 B2 C2 C2 C2 C2
+ ...
+ A32 A32 A32 A32 B32 B32 B32 B32 C32 C32 C32 C32
+ You have to send it as:
+ A1 A1 A1 A1 A2 ... A32 B1 B1 .. B32 C1 C1 ... C32 */
+
+ /* set initial offset into swatch buffer based on which
+ line in the swatch we are processing */
+ swatch = out + swatchLine * HorzBytesPerSw;
+ DebugMsg(5,"offset: swatch = %d \n",(int) (swatch - out) );
+ temp = in;
+ while ( temp < in + line_size ) {
+ /* copy multi-byte to swatch buffer */
+ * (BIGTYPE *)swatch = * (BIGTYPE *)temp;
+ if ( * (BIGTYPE *)temp ) {
+ /* mark map if not blank */
+ swatchMap[(swatch - out)/TotalBytesPerSw] = (byte) 1 ;
+ } /* if not zero */
+
+ temp += (BIGSIZE > HorzBytesPerSw) ? HorzBytesPerSw : BIGSIZE ;
+ swatch += (BIGSIZE > HorzBytesPerSw) ? HorzBytesPerSw : BIGSIZE ;
+
+ /* if we copied four bytes, skip to next swatch */
+ if ( ((temp - in) % HorzBytesPerSw ) == 0 ) {
+ swatch += (TotalBytesPerSw - HorzBytesPerSw) ;
+ } /* if need to skip */
+ } /* while < line_size */
+
+ } /* for swatchLine */
+
+ /* ------------------------------------------------- */
+ /* we now have full swatches. */
+ /* Send to printer */
+
+ /* go through swatch map to find non-blank swatches.
+ Skip over completely blank swatches */
+ startSwatch = 0;
+ while (startSwatch < swatchCount ) {
+ if (swatchMap[startSwatch] == 0 ) {
+ /* skip blank swatch */
+ DebugMsg(6,"Skip blank %d \n",startSwatch);
+ totalBlankSwatches++;
+ startSwatch++;
+ } else { /* if swatch == 0 */
+ /* we hit a non-blank swatch. */
+ totalGreySwatches++;
+
+ /* See how many there are in a row */
+ endSwatch = startSwatch;
+ while ( (endSwatch < swatchCount) && swatchMap[endSwatch] ) {
+ endSwatch++;
+ totalGreySwatches++;
+ } /* while */
+ /* endSwatch is one past last non-blank swatch */
+ DebugMsg(6,"Grey swatches %d ",startSwatch);
+ DebugMsg(6,"until %d \n",endSwatch);
+
+ /* vertical position: scan line, shifted for magnification */
+ iWrite(prn_stream, iABS_V);
+ iWrite2(prn_stream, lnum << Magnify);
+
+ /* horizontal position = swatch number * 32 bits/swatch */
+ iWrite(prn_stream,iABS_H);
+ iWrite2(prn_stream, startSwatch * HorzBitsPerSw << Magnify );
+ iWrite(prn_stream,iBITMAP); /* start bitmap */
+ iWrite(prn_stream,0x07); /* bit OR with page */
+ iWrite(prn_stream,(endSwatch - startSwatch)); /* horizontal
+ number of swatches */
+ iWrite(prn_stream, 1) ; /* vertical number of swatches */
+ /* write out swatch buffer */
+ for (swatch = out + startSwatch * TotalBytesPerSw;
+ swatch < out + endSwatch * TotalBytesPerSw; swatch++) {
+ iWrite(prn_stream,*swatch);
+ } /* for swatch */
+
+ /* swatches have been printed, see if there are still
+ more in this row */
+ startSwatch = endSwatch;
+ } /* if swatch == 0 */
+
+ } /* while startSwatch */
+
+ /* Whole row of swatches is done. Go on to next row of swatches */
+ lnum += lastLine + 1;
+
+ } /* while lnum */
+
+ /* Eject the page */
+ iWrite(prn_stream,iENDPAGE);
+
+ fflush(prn_stream);
+
+ gs_free((char *)swatchMap, BIGSIZE, swatchCount / BIGSIZE + 1,
+ "imagen_print_page(swatchMap)" );
+ gs_free((char *)out, TotalBytesPerSw, swatchCount+1, "imagen_print_page(out)");
+ gs_free((char *)in, BIGSIZE, line_size / BIGSIZE + 1, "imagen_print_page(in)");
+ /* ----------------------------------------- */
+
+ DebugMsg(1,"Debug: Grey: %d \n",totalGreySwatches);
+ DebugMsg(1,"Debug: Blank: %d \n",totalBlankSwatches );
+ DebugMsg(1,"%s\n","End of imagen_print_page");
+
+ /* ----------------------------------------- */
+ return 0;
+
+} /* imagen_print_page */
diff --git a/gs/src/gdevjpeg.c b/gs/src/gdevjpeg.c
index 321cab337..1785ec7eb 100644
--- a/gs/src/gdevjpeg.c
+++ b/gs/src/gdevjpeg.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997 Aladdin Enterprises. All rights reserved.
+/* Copyright (C) 1997, 1998 Aladdin Enterprises. All rights reserved.
This file is part of Aladdin Ghostscript.
@@ -16,7 +16,7 @@
all copies.
*/
-/* gdevjpeg.c */
+/*Id: gdevjpeg.c */
/* JPEG output driver */
#include "stdio_.h" /* for jpeglib.h */
#include "jpeglib.h"
@@ -59,7 +59,7 @@ prn_color_params_procs(gdev_prn_open, gdev_prn_output_page, gdev_prn_close,
gx_default_rgb_map_color_rgb,
jpeg_get_params, jpeg_put_params);
-gx_device_jpeg far_data gs_jpeg_device =
+const gx_device_jpeg gs_jpeg_device =
{prn_device_std_body(gx_device_jpeg, jpeg_procs, "jpeg",
DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
X_DPI, Y_DPI, 0, 0, 0, 0, 24, jpeg_print_page),
@@ -75,7 +75,7 @@ prn_color_params_procs(gdev_prn_open, gdev_prn_output_page, gdev_prn_close,
gx_default_gray_map_color_rgb,
jpeg_get_params, jpeg_put_params);
-gx_device_jpeg far_data gs_jpeggray_device =
+const gx_device_jpeg gs_jpeggray_device =
{prn_device_body(gx_device_jpeg, jpeggray_procs, "jpeggray",
DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
X_DPI, Y_DPI, 0, 0, 0, 0,
@@ -162,11 +162,9 @@ jpeg_print_page(gx_device_printer * pdev, FILE * prn_stream)
gs_memory_t *mem = pdev->memory;
int line_size = gdev_mem_bytes_per_scan_line((gx_device *) pdev);
byte *in = gs_alloc_bytes(mem, line_size, "jpeg_print_page(in)");
-
- /* The current implementation of the DCTE filter */
- /* requires that we allocate this with gs_malloc! */
- jpeg_compress_data *jcdp =
- gs_malloc(1, sizeof(*jcdp), "jpeg_print_page(jpeg_compress_data)");
+ jpeg_compress_data *jcdp = (jpeg_compress_data *)
+ gs_alloc_bytes(mem, sizeof(*jcdp),
+ "jpeg_print_page(jpeg_compress_data)");
byte *fbuf = 0;
uint fbuf_size;
byte *jbuf = 0;
@@ -176,16 +174,12 @@ jpeg_print_page(gx_device_printer * pdev, FILE * prn_stream)
stream_DCT_state state;
stream fstrm, jstrm;
- static const stream_procs filter_write_procs =
- {s_std_noavailable, s_std_noseek, s_std_write_reset,
- s_std_write_flush, s_filter_close
- };
-
if (jcdp == 0 || in == 0) {
code = gs_note_error(gs_error_VMerror);
goto fail;
}
/* Create the DCT decoder state. */
+ jcdp->template = s_DCTE_template;
state.template = &jcdp->template;
state.memory = 0;
state.QFactor = 1.0; /* disable quality adjustment in zfdcte.c */
@@ -196,6 +190,9 @@ jpeg_print_page(gx_device_printer * pdev, FILE * prn_stream)
state.Markers.data = 0;
state.Markers.size = 0;
state.data.compress = jcdp;
+ if (state.template->set_defaults)
+ (*state.template->set_defaults) ((stream_state *) & state);
+ jcdp->memory = state.jpeg_memory = mem;
if ((code = gs_jpeg_create_compress(&state)) < 0)
goto fail;
jcdp->cinfo.image_width = pdev->width;
@@ -230,7 +227,6 @@ jpeg_print_page(gx_device_printer * pdev, FILE * prn_stream)
jcdp->cinfo.X_density = pdev->HWResolution[0];
jcdp->cinfo.Y_density = pdev->HWResolution[1];
/* Create the filter. */
- jcdp->template = s_DCTE_template;
/* Make sure we get at least a full scan line of input. */
state.scan_line_size = jcdp->cinfo.input_components *
jcdp->cinfo.image_width;
@@ -250,7 +246,7 @@ jpeg_print_page(gx_device_printer * pdev, FILE * prn_stream)
goto done;
}
swrite_file(&fstrm, prn_stream, fbuf, fbuf_size);
- s_std_init(&jstrm, jbuf, jbuf_size, &filter_write_procs,
+ s_std_init(&jstrm, jbuf, jbuf_size, &s_filter_write_procs,
s_mode_write);
jstrm.memory = mem;
jstrm.state = (stream_state *) & state;
@@ -281,8 +277,7 @@ jpeg_print_page(gx_device_printer * pdev, FILE * prn_stream)
return code;
fail:
if (jcdp)
- gs_free(jcdp, 1, sizeof(*jcdp),
- "jpeg_print_page(jpeg_compress_data)");
+ gs_free_object(mem, jcdp, "jpeg_print_page(jpeg_compress_data)");
gs_free_object(mem, in, "jpeg_print_page(in)");
return code;
#undef jcdp
diff --git a/gs/src/gdevl256.c b/gs/src/gdevl256.c
index 5b6f0ff6e..c77ef7694 100644
--- a/gs/src/gdevl256.c
+++ b/gs/src/gdevl256.c
@@ -16,7 +16,7 @@
all copies.
*/
-/* gdevl256.c */
+/*Id: gdevl256.c */
/* Ghostscript driver for 256-color VGA modes with Linux and vgalib */
/* This Driver was derived from the BGI-Driver. It was written
only for my own purpose. I never planned to release it or send
diff --git a/gs/src/gdevlbp8.c b/gs/src/gdevlbp8.c
index 13084a8b1..c633e2753 100644
--- a/gs/src/gdevlbp8.c
+++ b/gs/src/gdevlbp8.c
@@ -1,46 +1,46 @@
/* Copyright (C) 1991, 1994, 1996, 1997 Aladdin Enterprises. All rights reserved.
-
- This file is part of Aladdin Ghostscript.
-
- Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
- or distributor accepts any responsibility for the consequences of using it,
- or for whether it serves any particular purpose or works at all, unless he
- or she says so in writing. Refer to the Aladdin Ghostscript Free Public
- License (the "License") for full details.
-
- Every copy of Aladdin Ghostscript must include a copy of the License,
- normally in a plain ASCII text file named PUBLIC. The License grants you
- the right to copy, modify and redistribute Aladdin Ghostscript, but only
- under certain conditions described in the License. Among other things, the
- License requires that the copyright notice and this notice be preserved on
- all copies.
- */
-
-/* gdevlbp8.c */
+
+ This file is part of Aladdin Ghostscript.
+
+ Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
+ or distributor accepts any responsibility for the consequences of using it,
+ or for whether it serves any particular purpose or works at all, unless he
+ or she says so in writing. Refer to the Aladdin Ghostscript Free Public
+ License (the "License") for full details.
+
+ Every copy of Aladdin Ghostscript must include a copy of the License,
+ normally in a plain ASCII text file named PUBLIC. The License grants you
+ the right to copy, modify and redistribute Aladdin Ghostscript, but only
+ under certain conditions described in the License. Among other things, the
+ License requires that the copyright notice and this notice be preserved on
+ all copies.
+*/
+
+/*Id: gdevlbp8.c */
/* Canon LBP-8II and LIPS III driver */
#include "gdevprn.h"
/*
- Modifications:
- 2.2.97 Lauri Paatero
- Changed CSI command into ESC [. DCS commands may still need to be changed
- (to ESC P).
- 4.9.96 Lauri Paatero
- Corrected LBP-8II margins again. Real problem was that (0,0) is NOT
- in upper left corner.
- Now using relative addressing for vertical addressing. This avoids
- problems
- when printing to paper with wrong size.
- 18.6.96 Lauri Paatero, lauri.paatero@paatero.pp.fi
- Corrected LBP-8II margins.
- Added logic to recognize (and optimize away) long strings of 00's in data.
- For LBP-8II removed use of 8-bit CSI (this does not work if 8-bit character
- set has been configured in LBP-8II. (Perhaps this should also be done
- for LBP-8III?)
- Original versions:
- LBP8 driver: Tom Quinn (trq@prg.oxford.ac.uk)
- LIPS III driver: Kenji Okamoto (okamoto@okamoto.cias.osakafu-u.ac.jp)
- */
+ Modifications:
+ 2.2.97 Lauri Paatero
+ Changed CSI command into ESC [. DCS commands may still need to be changed
+ (to ESC P).
+ 4.9.96 Lauri Paatero
+ Corrected LBP-8II margins again. Real problem was that (0,0) is NOT
+ in upper left corner.
+ Now using relative addressing for vertical addressing. This avoids
+problems
+ when printing to paper with wrong size.
+ 18.6.96 Lauri Paatero, lauri.paatero@paatero.pp.fi
+ Corrected LBP-8II margins.
+ Added logic to recognize (and optimize away) long strings of 00's in data.
+ For LBP-8II removed use of 8-bit CSI (this does not work if 8-bit character
+ set has been configured in LBP-8II. (Perhaps this should also be done
+ for LBP-8III?)
+ Original versions:
+ LBP8 driver: Tom Quinn (trq@prg.oxford.ac.uk)
+ LIPS III driver: Kenji Okamoto (okamoto@okamoto.cias.osakafu-u.ac.jp)
+*/
#define X_DPI 300
@@ -52,19 +52,19 @@ private dev_proc_print_page(lbp8_print_page);
private dev_proc_print_page(lips3_print_page);
gx_device_printer far_data gs_lbp8_device =
-prn_device(prn_std_procs, "lbp8",
- DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
- X_DPI, Y_DPI,
- 0.16, 0.2, 0.32, 0.21, /* margins: left, bottom, right, top */
- 1, lbp8_print_page);
+ prn_device(prn_std_procs, "lbp8",
+ DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
+ X_DPI, Y_DPI,
+ 0.16, 0.2, 0.32, 0.21, /* margins: left, bottom, right, top */
+ 1, lbp8_print_page);
gx_device_printer far_data gs_lips3_device =
-prn_device(prn_std_procs, "lips3",
- 82, /* width_10ths, 8.3" */
- 117, /* height_10ths, 11.7" */
- X_DPI, Y_DPI,
- 0.16, 0.27, 0.23, 0.27, /* margins */
- 1, lips3_print_page);
+ prn_device(prn_std_procs, "lips3",
+ 82, /* width_10ths, 8.3" */
+ 117, /* height_10ths, 11.7" */
+ X_DPI, Y_DPI,
+ 0.16, 0.27, 0.23, 0.27, /* margins */
+ 1, lips3_print_page);
/* ------ Internal routines ------ */
@@ -73,146 +73,141 @@ prn_device(prn_std_procs, "lips3",
#define DCS 0220
#define ST 0234
-static const char lbp8_init[] =
-{
- ESC, ';', ESC, 'c', ESC, ';', /* reset, ISO */
- ESC, '[', '2', '&', 'z', /* fullpaint mode */
- ESC, '[', '1', '4', 'p', /* select page type (A4) */
- ESC, '[', '1', '1', 'h', /* set mode */
- ESC, '[', '7', ' ', 'I', /* select unit size (300dpi) */
- ESC, '[', '6', '3', 'k', /* Move 63 dots up (to top of printable area) */
+static const char lbp8_init[] = {
+ ESC, ';', ESC, 'c', ESC, ';', /* reset, ISO */
+ ESC, '[', '2', '&', 'z', /* fullpaint mode */
+ ESC, '[', '1', '4', 'p', /* select page type (A4) */
+ ESC, '[', '1', '1', 'h', /* set mode */
+ ESC, '[', '7', ' ', 'I', /* select unit size (300dpi)*/
+ ESC, '[', '6', '3', 'k', /* Move 63 dots up (to top of printable area) */
};
static const char *lbp8_end = NULL;
-static const char lips3_init[] =
-{
- ESC, '<', /* soft reset */
- DCS, '0', 'J', ST, /* JOB END */
- DCS, '3', '1', ';', '3', '0', '0', ';', '2', 'J', ST, /* 300dpi, LIPS3 JOB START */
- ESC, '<', /* soft reset */
- DCS, '2', 'y', 'P', 'r', 'i', 'n', 't', 'i', 'n', 'g', '(', 'g', 's', ')', ST, /* Printing (gs) display */
- ESC, '[', '?', '1', 'l', /* auto cr-lf disable */
- ESC, '[', '?', '2', 'h', /* auto ff disable */
- ESC, '[', '1', '1', 'h', /* set mode */
- ESC, '[', '7', ' ', 'I', /* select unit size (300dpi) */
- ESC, '[', 'f' /* move to home position */
+static const char lips3_init[] = {
+ ESC, '<', /* soft reset */
+ DCS, '0', 'J', ST, /* JOB END */
+ DCS, '3', '1', ';', '3', '0', '0', ';', '2', 'J', ST, /* 300dpi, LIPS3 JOB START */
+ ESC, '<', /* soft reset */
+ DCS, '2', 'y', 'P', 'r', 'i', 'n', 't', 'i', 'n', 'g', '(', 'g', 's', ')', ST, /* Printing (gs) display */
+ ESC, '[', '?', '1', 'l', /* auto cr-lf disable */
+ ESC, '[', '?', '2', 'h', /* auto ff disable */
+ ESC, '[', '1', '1', 'h', /* set mode */
+ ESC, '[', '7', ' ', 'I', /* select unit size (300dpi)*/
+ ESC, '[', 'f' /* move to home position */
};
-static const char lips3_end[] =
-{
- DCS, '0', 'J', ST /* JOB END */
+static const char lips3_end[] = {
+ DCS, '0', 'J', ST /* JOB END */
};
/* Send the page to the printer. */
private int
-can_print_page(gx_device_printer * pdev, FILE * prn_stream,
- const char *init, int init_size, const char *end, int end_size)
-{
- char data[LINE_SIZE * 2];
- char *out_data;
- int last_line_nro = 0;
-
- fwrite(init, init_size, 1, prn_stream); /* initialize */
-
- /* Send each scan line in turn */
- {
- int lnum;
- int line_size = gdev_mem_bytes_per_scan_line((gx_device *) pdev);
- byte rmask = (byte) (0xff << (-pdev->width & 7));
-
- for (lnum = 0; lnum < pdev->height; lnum++) {
- char *end_data = data + LINE_SIZE;
-
- gdev_prn_copy_scan_lines(pdev, lnum,
- (byte *) data, line_size);
- /* Mask off 1-bits beyond the line width. */
- end_data[-1] &= rmask;
- /* Remove trailing 0s. */
- while (end_data > data && end_data[-1] == 0)
- end_data--;
- if (end_data != data) {
- int num_cols = 0;
- int out_count;
- int zero_count;
-
- out_data = data;
-
- /* move down */
- fprintf(prn_stream, "%c[%de",
- ESC, lnum - last_line_nro);
- last_line_nro = lnum;
-
- while (out_data < end_data) {
- /* Remove leading 0s */
- while (out_data < end_data && *out_data == 0) {
- num_cols += 8;
- out_data++;
- }
+can_print_page(gx_device_printer *pdev, FILE *prn_stream,
+ const char *init, int init_size, const char *end, int end_size)
+{
+ char data[LINE_SIZE*2];
+ char *out_data;
+ int last_line_nro = 0;
+
+ fwrite(init, init_size, 1, prn_stream); /* initialize */
+
+ /* Send each scan line in turn */
+ {
+ int lnum;
+ int line_size = gdev_mem_bytes_per_scan_line((gx_device *)pdev);
+ byte rmask = (byte)(0xff << (-pdev->width & 7));
+
+ for ( lnum = 0; lnum < pdev->height; lnum++ ) {
+ char *end_data = data + LINE_SIZE;
+ gdev_prn_copy_scan_lines(pdev, lnum,
+ (byte *)data, line_size);
+ /* Mask off 1-bits beyond the line width. */
+ end_data[-1] &= rmask;
+ /* Remove trailing 0s. */
+ while ( end_data > data && end_data[-1] == 0 )
+ end_data--;
+ if ( end_data != data ) {
+ int num_cols = 0;
+ int out_count;
+ int zero_count;
+ out_data = data;
+
+ /* move down */
+ fprintf(prn_stream, "%c[%de",
+ ESC, lnum-last_line_nro );
+ last_line_nro = lnum;
+
+ while (out_data < end_data) {
+ /* Remove leading 0s*/
+ while(out_data < end_data && *out_data == 0) {
+ num_cols += 8;
+ out_data++;
+ }
+
+ out_count = end_data - out_data;
+ zero_count = 0;
+
+ /* if there is a lot data, find if there is sequence of zeros */
+ if (out_count>22) {
+
+ out_count = 1;
+
+ while(out_data+out_count+zero_count < end_data) {
+ if (out_data[zero_count+out_count] != 0) {
+ out_count += 1+zero_count;
+ zero_count = 0;
+ }
+ else {
+ zero_count++;
+ if (zero_count>20)
+ break;
+ }
+ }
- out_count = end_data - out_data;
- zero_count = 0;
-
- /* if there is a lot data, find if there is sequence of zeros */
- if (out_count > 22) {
-
- out_count = 1;
-
- while (out_data + out_count + zero_count < end_data) {
- if (out_data[zero_count + out_count] != 0) {
- out_count += 1 + zero_count;
- zero_count = 0;
- } else {
- zero_count++;
- if (zero_count > 20)
- break;
- }
}
-
+
+ if (out_count==0)
+ break;
+
+ /* move down and across*/
+ fprintf(prn_stream, "%c[%d`",
+ ESC, num_cols );
+ /* transfer raster graphic command */
+ fprintf(prn_stream, "%c[%d;%d;300;.r",
+ ESC, out_count, out_count);
+
+ /* send the row */
+ fwrite(out_data, sizeof(char),
+ out_count, prn_stream);
+
+ out_data += out_count+zero_count;
+ num_cols += 8*(out_count+zero_count);
}
- if (out_count == 0)
- break;
-
- /* move down and across */
- fprintf(prn_stream, "%c[%d`",
- ESC, num_cols);
- /* transfer raster graphic command */
- fprintf(prn_stream, "%c[%d;%d;300;.r",
- ESC, out_count, out_count);
-
- /* send the row */
- fwrite(out_data, sizeof(char),
- out_count, prn_stream);
-
- out_data += out_count + zero_count;
- num_cols += 8 * (out_count + zero_count);
}
}
}
- }
- /* eject page */
- fprintf(prn_stream, "%c=", ESC);
+ /* eject page */
+ fprintf(prn_stream, "%c=", ESC);
- /* terminate */
- if (end != NULL)
- fwrite(end, end_size, 1, prn_stream);
+ /* terminate */
+ if (end != NULL)
+ fwrite(end, end_size, 1, prn_stream);
- return 0;
+ return 0;
}
/* Print an LBP-8 page. */
private int
-lbp8_print_page(gx_device_printer * pdev, FILE * prn_stream)
-{
- return can_print_page(pdev, prn_stream, lbp8_init, sizeof(lbp8_init),
- lbp8_end, sizeof(lbp8_end));
+lbp8_print_page(gx_device_printer *pdev, FILE *prn_stream)
+{ return can_print_page(pdev, prn_stream, lbp8_init, sizeof(lbp8_init),
+ lbp8_end, sizeof(lbp8_end));
}
/* Print a LIPS III page. */
private int
-lips3_print_page(gx_device_printer * pdev, FILE * prn_stream)
-{
- return can_print_page(pdev, prn_stream, lips3_init, sizeof(lips3_init),
- lips3_end, sizeof(lips3_end));
+lips3_print_page(gx_device_printer *pdev, FILE *prn_stream)
+{ return can_print_page(pdev, prn_stream, lips3_init, sizeof(lips3_init),
+ lips3_end, sizeof(lips3_end));
}
diff --git a/gs/src/gdevlj56.c b/gs/src/gdevlj56.c
index b5445d5fc..c2a779254 100644
--- a/gs/src/gdevlj56.c
+++ b/gs/src/gdevlj56.c
@@ -16,7 +16,7 @@
all copies.
*/
-/* gdevlj56.c */
+/*Id: gdevlj56.c */
/* H-P LaserJet 5 & 6 drivers for Ghostscript */
#include "gdevprn.h"
#include "gdevpcl.h"
@@ -43,7 +43,7 @@ private dev_proc_open_device(ljet5_open);
private dev_proc_close_device(ljet5_close);
private dev_proc_print_page(ljet5_print_page);
-private gx_device_procs ljet5_procs =
+private const gx_device_procs ljet5_procs =
prn_procs(ljet5_open, gdev_prn_output_page, ljet5_close);
gx_device_printer far_data gs_lj5mono_device =
@@ -53,7 +53,7 @@ prn_device(ljet5_procs, "lj5mono",
0, 0, 0, 0,
1, ljet5_print_page);
-private gx_device_procs lj5gray_procs =
+private const gx_device_procs lj5gray_procs =
prn_color_procs(ljet5_open, gdev_prn_output_page, ljet5_close,
gx_default_gray_map_rgb_color,
gx_default_gray_map_color_rgb);
diff --git a/gs/src/gdevlp8k.c b/gs/src/gdevlp8k.c
index d00707a48..993ff4e2c 100644
--- a/gs/src/gdevlp8k.c
+++ b/gs/src/gdevlp8k.c
@@ -1,162 +1,162 @@
/* Copyright (C) 1996 Aladdin Enterprises. All rights reserved.
-
- This file is part of Aladdin Ghostscript.
-
- Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
- or distributor accepts any responsibility for the consequences of using it,
- or for whether it serves any particular purpose or works at all, unless he
- or she says so in writing. Refer to the Aladdin Ghostscript Free Public
- License (the "License") for full details.
-
- Every copy of Aladdin Ghostscript must include a copy of the License,
- normally in a plain ASCII text file named PUBLIC. The License grants you
- the right to copy, modify and redistribute Aladdin Ghostscript, but only
- under certain conditions described in the License. Among other things, the
- License requires that the copyright notice and this notice be preserved on
- all copies.
- */
-
-/* gdevlp8k.c */
+
+ This file is part of Aladdin Ghostscript.
+
+ Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
+ or distributor accepts any responsibility for the consequences of using it,
+ or for whether it serves any particular purpose or works at all, unless he
+ or she says so in writing. Refer to the Aladdin Ghostscript Free Public
+ License (the "License") for full details.
+
+ Every copy of Aladdin Ghostscript must include a copy of the License,
+ normally in a plain ASCII text file named PUBLIC. The License grants you
+ the right to copy, modify and redistribute Aladdin Ghostscript, but only
+ under certain conditions described in the License. Among other things, the
+ License requires that the copyright notice and this notice be preserved on
+ all copies.
+*/
+
+/*Id: gdevlp8k.c */
/* EPSON LP-8000 ESC-sequence Laser Printer driver for Ghostscript.
- This driver structure is most close to that of the Epson 'ESC/P 2' language
- printer driver "gdevescp.c" contributed by Richard Brown, but all the control
- sequences and data formats are totally different.
+This driver structure is most close to that of the Epson 'ESC/P 2' language
+printer driver "gdevescp.c" contributed by Richard Brown, but all the control
+sequences and data formats are totally different.
- The main driver strategy is as follows. The driver scans lines, skips empty
- ones, removes leading and trailing zeros for other lines, compresses the
- non-zero rest of each line and finally outputs the data.
+The main driver strategy is as follows. The driver scans lines, skips empty
+ones, removes leading and trailing zeros for other lines, compresses the
+non-zero rest of each line and finally outputs the data.
- At the moment the driver supports only 300x300 DPI resolution. If somebody
- needs 240x240, another valid value for LP-8000 printer, he or she can try to
- play with the corresponding values in initialization and termination
- strings. Or I shall spend some extra time for hacking, if enough people
- encourage me to do it. (The only available in our laboratory "Operation
- guide" in Japanese does not contain any information about it. And LP-8000
- driver for Japanese Windows does not support this mode either.)
+At the moment the driver supports only 300x300 DPI resolution. If somebody
+needs 240x240, another valid value for LP-8000 printer, he or she can try to
+play with the corresponding values in initialization and termination
+strings. Or I shall spend some extra time for hacking, if enough people
+encourage me to do it. (The only available in our laboratory "Operation
+guide" in Japanese does not contain any information about it. And LP-8000
+driver for Japanese Windows does not support this mode either.)
- The output data format is the following.
+The output data format is the following.
- 1. Initialization string, pretty long and sophisticated, I don't know why it
- was necessary.
+1. Initialization string, pretty long and sophisticated, I don't know why it
+was necessary.
- 2. Data bits for each line. The most general format includes both starting X
- and Y values as well as data type (simple or compressed).
+2. Data bits for each line. The most general format includes both starting X
+and Y values as well as data type (simple or compressed).
- 3. Termination string.
+3. Termination string.
- DATA FORMATS
+ DATA FORMATS
- 1. A simple (non-compressed) data format. By evident reasons it is NOT
- SUPPORTED by the driver and is discussed here just as a starting point for
- the future explanations. "\035" here is an alias for 0x1d ESC-character :
+1. A simple (non-compressed) data format. By evident reasons it is NOT
+SUPPORTED by the driver and is discussed here just as a starting point for
+the future explanations. "\035" here is an alias for 0x1d ESC-character :
- "\035" "Starting X point in ASCII format" "X"
- "\035" "Starting Y point in ASCII format" "Y"
- "\035" "Number of data BYTES for this printer line in ASCII format" ";"
- "Number of POINTS to print in this line (equals to the
- (Number of BYTES)*8)" ";"
- "1;obi{I" "data BYTES for this line in BINARY format"
+"\035" "Starting X point in ASCII format" "X"
+"\035" "Starting Y point in ASCII format" "Y"
+"\035" "Number of data BYTES for this printer line in ASCII format" ";"
+"Number of POINTS to print in this line (equals to the
+(Number of BYTES)*8)" ";"
+"1;obi{I" "data BYTES for this line in BINARY format"
- Both X and Y printer coordinates are 60 pixels shifted from the corresponding
- coordinates of the Ghostscript display, that is X = x - 60, Y = y - 60. For
- example, 1 inch left margin requires the value of 300 - 60 = 240 for
- starting X printer coordinate. Similar, 1.5 inch top margin requires Y
- values to start from 300*1.5 - 60 = 390.
+Both X and Y printer coordinates are 60 pixels shifted from the corresponding
+coordinates of the Ghostscript display, that is X = x - 60, Y = y - 60. For
+example, 1 inch left margin requires the value of 300 - 60 = 240 for
+starting X printer coordinate. Similar, 1.5 inch top margin requires Y
+values to start from 300*1.5 - 60 = 390.
- The shortest possible abbreviation for the simple data format string is
+The shortest possible abbreviation for the simple data format string is
- "\035" "Starting Y point in ASCII format" "Y"
- "\035" "Number of data BYTES for this printer line in ASCII format" ";"
- "Number of POINTS to print in this line (equals to the
- (Number of BYTES)*8)" ";"
- "1;obi{I" "data BYTES for this line in BINARY format"
+"\035" "Starting Y point in ASCII format" "Y"
+"\035" "Number of data BYTES for this printer line in ASCII format" ";"
+"Number of POINTS to print in this line (equals to the
+(Number of BYTES)*8)" ";"
+"1;obi{I" "data BYTES for this line in BINARY format"
- In this case the value of the starting X point is assumed to be equal to
- that for the previous line.
+In this case the value of the starting X point is assumed to be equal to
+that for the previous line.
+
+An example of the data output for 2 printer lines
- An example of the data output for 2 printer lines
+"\035"315X"\035"240Y"\035"2;16;1;obi{I"0ff0""\035"241Y"\035"3;24;1;obi{I"0f000f"
- "\035"315X"\035"240Y"\035"2;16;1;obi{I"0ff0""\035"241Y"\035"3;24;1;obi{I"0f000f"
+Here "0ff0" is an alias for 0x0f 0xf0 binary data, etc. The first line of the
+above example starts from X=315, Y=240 and consists of 2 data bytes
+resulting in 4 blank (white) points followed by 8 black points followed by 4
+white points on the paper. The second line starts from X=315, Y=241 and
+contains 3 data bytes resulting in output of 4 white, 4 black, 12 white and
+finally 4 black points.
- Here "0ff0" is an alias for 0x0f 0xf0 binary data, etc. The first line of the
- above example starts from X=315, Y=240 and consists of 2 data bytes
- resulting in 4 blank (white) points followed by 8 black points followed by 4
- white points on the paper. The second line starts from X=315, Y=241 and
- contains 3 data bytes resulting in output of 4 white, 4 black, 12 white and
- finally 4 black points.
+2. Compressed data format (SUPPORTED BY THE DRIVER).
- 2. Compressed data format (SUPPORTED BY THE DRIVER).
+General description is as follows.
- General description is as follows.
+"\035" "Starting X point in ASCII format" "X"
+"\035" "Starting Y point in ASCII format" "Y"
+"\035" "3bcI"
+"\035" "Total number of compressed BYTES in ASCII format" ";"
+"Number of POINTS to print in this line" ";"
+"1;obi{I" "compressed data BYTES for this line in BINARY format"
+"\035" "0bcI"
- "\035" "Starting X point in ASCII format" "X"
- "\035" "Starting Y point in ASCII format" "Y"
- "\035" "3bcI"
- "\035" "Total number of compressed BYTES in ASCII format" ";"
- "Number of POINTS to print in this line" ";"
- "1;obi{I" "compressed data BYTES for this line in BINARY format"
- "\035" "0bcI"
+Additional ESC-sequences "\035" "3bcI" and "\035" "0bcI" mean start and end
+of the compressed data format, respectively. As in the discussed above case
+of a non-compressed data format, the shortest abbreviation has the form of
- Additional ESC-sequences "\035" "3bcI" and "\035" "0bcI" mean start and end
- of the compressed data format, respectively. As in the discussed above case
- of a non-compressed data format, the shortest abbreviation has the form of
+"\035" "Starting Y point in ASCII format" "Y"
+"\035" "Total number of compressed BYTES in ASCII format" ";"
+"Number of POINTS to print in this line" ";"
+"1;obi{I" "compressed data BYTES for this line in BINARY format"
- "\035" "Starting Y point in ASCII format" "Y"
- "\035" "Total number of compressed BYTES in ASCII format" ";"
- "Number of POINTS to print in this line" ";"
- "1;obi{I" "compressed data BYTES for this line in BINARY format"
+COMPRESSED DATA BYTES FORMAT has the form of
- COMPRESSED DATA BYTES FORMAT has the form of
+"d1 d2 d3 d4 d4 count_d4 d5 d6 d6 count_d6 ... d(n-1) d(n-1) count_d(n-1) dn"
- "d1 d2 d3 d4 d4 count_d4 d5 d6 d6 count_d6 ... d(n-1) d(n-1) count_d(n-1) dn"
+Here dx (x = 1 ... n) means data in a BINARY format. Any 2 repeated bytes
+MUST follow by the count, otherwise the printer will interpret the next
+data byte as a counter. The count value indicates how many bytes of the
+same value should be INSERTED after the repeated ones. So, the total number of
+repeated bytes is (count + 2), not count. If there are only 2 equal data
+bytes somewhere in the data stream, they MUST follow by zero.
- Here dx (x = 1 ... n) means data in a BINARY format. Any 2 repeated bytes
- MUST follow by the count, otherwise the printer will interpret the next
- data byte as a counter. The count value indicates how many bytes of the
- same value should be INSERTED after the repeated ones. So, the total number of
- repeated bytes is (count + 2), not count. If there are only 2 equal data
- bytes somewhere in the data stream, they MUST follow by zero.
+Example of 2 compressed data strings.
- Example of 2 compressed data strings.
+"\035"105X"\035"320Y"\035"3bcI"\035"3;2048;1;obi{I"0000fe"
+"\035"105X"\035"321Y"\035"11;2048;1;obi{I"0000021fffffe5fc000011"
- "\035"105X"\035"320Y"\035"3bcI"\035"3;2048;1;obi{I"0000fe"
- "\035"105X"\035"321Y"\035"11;2048;1;obi{I"0000021fffffe5fc000011"
+The first one containing 3 bytes of compressed data will result in empty
+(zero) line of 2048 blank points started from X=105, Y=320. The second one
+containing 11 compressed data bytes will produce the picture of 4*8 + 3 = 35
+white points followed by 5 + 16 + 0xe5*8 + 6 = 1859 black points followed by
+2 + 8*19 = 154 white points (total 2048 points) started from X=105, Y=321.
- The first one containing 3 bytes of compressed data will result in empty
- (zero) line of 2048 blank points started from X=105, Y=320. The second one
- containing 11 compressed data bytes will produce the picture of 4*8 + 3 = 35
- white points followed by 5 + 16 + 0xe5*8 + 6 = 1859 black points followed by
- 2 + 8*19 = 154 white points (total 2048 points) started from X=105, Y=321.
+Strictly speaking, it was not necessary to adjust the number of points to
+the byte boundary. I did it for the sake of simplicity. One more argument in
+favor of this step is that the error of positioning does not exceed (7 /
+300) inches or (7 / 118) cm, that is 0.6 mm, which is negligible, I guess.
- Strictly speaking, it was not necessary to adjust the number of points to
- the byte boundary. I did it for the sake of simplicity. One more argument in
- favor of this step is that the error of positioning does not exceed (7 /
- 300) inches or (7 / 118) cm, that is 0.6 mm, which is negligible, I guess.
+ADDITIONAL INFORMATION
- ADDITIONAL INFORMATION
+It is also possible to use LP-8000 printer with 180x180 DPI resolution as an
+"ibmpro" device from gdevepsn.c The only thing which should be corrected, is
+the value 0x30 in static const char ibmpro_init_string[]. Decimal 36
+fixes the 1,5 times elongation along the vertical axis. It is also
+recommended to choose the appropriate values for all margins. In my case it
+was 0.2, 0.6, 0, 0.3 in the device descriptor instead of the 0.2, 0.95, 0,
+1.0
- It is also possible to use LP-8000 printer with 180x180 DPI resolution as an
- "ibmpro" device from gdevepsn.c The only thing which should be corrected, is
- the value 0x30 in static const char ibmpro_init_string[]. Decimal 36
- fixes the 1,5 times elongation along the vertical axis. It is also
- recommended to choose the appropriate values for all margins. In my case it
- was 0.2, 0.6, 0, 0.3 in the device descriptor instead of the 0.2, 0.95, 0,
- 1.0
+Nevertheless, typical Latex file looked so ugly after printing in this mode,
+that I preferred to spend several days for hacking the format of the Japanese
+Windows printer output for 300 DPI resolution and create my own driver.
- Nevertheless, typical Latex file looked so ugly after printing in this mode,
- that I preferred to spend several days for hacking the format of the Japanese
- Windows printer output for 300 DPI resolution and create my own driver.
+Any suggestions, corrections, critical comments, etc. are welcome!
- Any suggestions, corrections, critical comments, etc. are welcome!
+Oleg Fat'yanov <faty1@rlem.titech.ac.jp>
- Oleg Fat'yanov <faty1@rlem.titech.ac.jp>
-
- */
+*/
#include "gdevprn.h"
@@ -164,11 +164,11 @@
#ifndef X_DPI
#define X_DPI 300
#endif
-
+
#ifndef Y_DPI
#define Y_DPI 300
#endif
-
+
#define L_MARGIN 0.25
#define B_MARGIN 0.25
#define R_MARGIN 0.25
@@ -177,225 +177,236 @@
private dev_proc_print_page(lp8000_print_page);
gx_device_printer far_data gs_lp8000_device =
-prn_device(prn_std_procs, "lp8000",
- DEFAULT_WIDTH_10THS,
- DEFAULT_HEIGHT_10THS,
- X_DPI, Y_DPI,
- L_MARGIN, B_MARGIN, R_MARGIN, T_MARGIN,
- 1, lp8000_print_page);
-
-
+ prn_device(prn_std_procs, "lp8000",
+ DEFAULT_WIDTH_10THS,
+ DEFAULT_HEIGHT_10THS,
+ X_DPI, Y_DPI,
+ L_MARGIN, B_MARGIN, R_MARGIN, T_MARGIN,
+ 1, lp8000_print_page);
+
+
private int
-lp8000_print_page(gx_device_printer * pdev, FILE * prn_stream)
+lp8000_print_page(gx_device_printer *pdev, FILE *prn_stream)
{
- int line_size = gdev_mem_bytes_per_scan_line((gx_device *) pdev);
- int in_size = line_size;
-
- byte *buf1 = (byte *) gs_malloc(in_size, 1, "lp8000_print_page(buf1)");
- byte *buf2 = (byte *) gs_malloc(in_size, 1, "lp8000_print_page(buf2)");
- byte *in = buf1;
- byte *out = buf2;
-
- int lnum, top, bottom, left, width;
- int count, i, left1, left2, left0;
-
-/* Check memory allocations */
+ int line_size = gdev_mem_bytes_per_scan_line((gx_device *)pdev);
+ int in_size = line_size;
+
+ byte *buf1 = (byte *)gs_malloc(in_size, 1, "lp8000_print_page(buf1)");
+ byte *buf2 = (byte *)gs_malloc(in_size, 1, "lp8000_print_page(buf2)");
+ byte *in = buf1;
+ byte *out = buf2;
+
+ int lnum, top, bottom, left, width;
+ int count, i, left1, left2, left0;
+
+/* Check memory allocations */
+
+ if ( buf1 == 0 || buf2 == 0 )
+ { if ( buf1 )
+ gs_free((char *)buf1, in_size, 1, "lp8000_print_page(buf1)");
+
+ if ( buf2 )
+ gs_free((char *)buf2, in_size, 1, "lp8000_print_page(buf2)");
+
+ return_error(gs_error_VMerror);
+ }
- if (buf1 == 0 || buf2 == 0) {
- if (buf1)
- gs_free((char *)buf1, in_size, 1, "lp8000_print_page(buf1)");
-
- if (buf2)
- gs_free((char *)buf2, in_size, 1, "lp8000_print_page(buf2)");
-
- return_error(gs_error_VMerror);
- }
/* Initialize the printer */
-
- fwrite("\033\001@EJL \n", 1, 8, prn_stream);
- fwrite("@EJL EN LA=ESC/PAGE\n", 1, 20, prn_stream);
- fwrite("\035rhE\033\001@EJL \n", 1, 12, prn_stream);
- fwrite("@EJL SE LA=ESC/PAGE\n", 1, 20, prn_stream);
- fwrite("@EJL SET PU=1 PS=A4 ZO=OFF\n", 1, 27, prn_stream);
- fwrite("@EJL EN LA=ESC/PAGE\n", 1, 20, prn_stream);
- fwrite("\0350;0.24muE\0352;300;300drE", 1, 23, prn_stream);
- fwrite("\0350;300;300drE\0351tsE\0351mmE", 1, 23, prn_stream);
- fwrite("\0357isE\0355iaF\0355ipP\03514psE\0350poE", 1, 26, prn_stream);
- fwrite("\03560;60loE\0350X\0350Y", 1, 15, prn_stream);
- fwrite("\0350;0;2360;3388caE", 1, 17, prn_stream);
- fwrite("\0351cmE\0350alfP", 1, 11, prn_stream);
- fwrite("\0350affP\0350boP\0350abP", 1, 16, prn_stream);
- fwrite("\0354ilG\0350bcI\0350sarG", 1, 16, prn_stream);
- fwrite("\0351;0;100spE\0352owE", 1, 16, prn_stream);
-
+
+ fwrite("\033\001@EJL \n",1,8,prn_stream);
+ fwrite("@EJL EN LA=ESC/PAGE\n",1,20,prn_stream);
+ fwrite("\035rhE\033\001@EJL \n",1,12,prn_stream);
+ fwrite("@EJL SE LA=ESC/PAGE\n",1,20,prn_stream);
+ fwrite("@EJL SET PU=1 PS=A4 ZO=OFF\n",1,27,prn_stream);
+ fwrite("@EJL EN LA=ESC/PAGE\n",1,20,prn_stream);
+ fwrite("\0350;0.24muE\0352;300;300drE",1,23,prn_stream);
+ fwrite("\0350;300;300drE\0351tsE\0351mmE",1,23,prn_stream);
+ fwrite("\0357isE\0355iaF\0355ipP\03514psE\0350poE",1,26,prn_stream);
+ fwrite("\03560;60loE\0350X\0350Y",1,15,prn_stream);
+ fwrite("\0350;0;2360;3388caE",1,17,prn_stream);
+ fwrite("\0351cmE\0350alfP",1,11,prn_stream);
+ fwrite("\0350affP\0350boP\0350abP",1,16,prn_stream);
+ fwrite("\0354ilG\0350bcI\0350sarG",1,16,prn_stream);
+ fwrite("\0351;0;100spE\0352owE",1,16,prn_stream);
+
/* Here the common part of the initialization string ends */
/* Calculate the PRINTER_LEFT_MARGIN = device_left_margin - 60 adjusted to
- the byte boundary. Save this value for future comparison and set the
- starting X value of the printer line.
- */
- left1 = (int)(L_MARGIN * pdev->x_pixels_per_inch) - 60;
- left1 = (left1 >> 3) << 3;
- left0 = left1;
-
- fwrite("\035", 1, 1, prn_stream);
- fprintf(prn_stream, "%d", left1);
- fwrite("X", 1, 1, prn_stream);
-
- /* Set the compressed data format */
- fwrite("\0353bcI", 1, 5, prn_stream);
-
- top = T_MARGIN * pdev->y_pixels_per_inch;
- bottom = pdev->height - B_MARGIN * pdev->y_pixels_per_inch;
-
- left = ((int)(L_MARGIN * pdev->x_pixels_per_inch)) >> 3;
- width = ((pdev->width - (int)(R_MARGIN * pdev->x_pixels_per_inch)) >> 3) - left;
-
- /*
- ** Print the page:
- */
-
- for (lnum = top; lnum < bottom;) {
- byte *in_data;
- byte *inp;
- byte *in_end;
- byte *outp;
- register byte *p, *q;
- int lcnt;
-
+the byte boundary. Save this value for future comparison and set the
+starting X value of the printer line.
+*/
+ left1 = (int) (L_MARGIN * pdev->x_pixels_per_inch) - 60;
+ left1 = (left1 >> 3) << 3;
+ left0 = left1;
+
+ fwrite("\035",1,1,prn_stream);
+ fprintf(prn_stream,"%d",left1);
+ fwrite("X",1,1,prn_stream);
+
+ /* Set the compressed data format */
+ fwrite("\0353bcI",1,5,prn_stream);
+
+ top = T_MARGIN * pdev->y_pixels_per_inch;
+ bottom = pdev->height - B_MARGIN * pdev->y_pixels_per_inch;
+
+ left = ( (int) (L_MARGIN * pdev->x_pixels_per_inch) ) >> 3 ;
+ width = ((pdev->width - (int)(R_MARGIN * pdev->x_pixels_per_inch)) >> 3) - left;
+
/*
- ** Check buffer for 0 data.
- */
-
- gdev_prn_get_bits(pdev, lnum, in, &in_data);
- while (in_data[0] == 0 &&
- !memcmp((char *)in_data, (char *)in_data + 1, line_size - 1) &&
- lnum < bottom) {
- lnum++;
- gdev_prn_get_bits(pdev, lnum, in, &in_data);
- }
+ ** Print the page:
+ */
+
+ for ( lnum = top; lnum < bottom ; )
+
+
+ {
+ byte *in_data;
+ byte *inp;
+ byte *in_end;
+ byte *outp;
+ register byte *p, *q;
+ int lcnt;
+
+ /*
+ ** Check buffer for 0 data.
+ */
+
+ gdev_prn_get_bits(pdev, lnum, in, &in_data);
+ while ( in_data[0] == 0 &&
+ !memcmp((char *)in_data, (char *)in_data + 1, line_size - 1) &&
+ lnum < bottom )
+ {
+ lnum++;
+ gdev_prn_get_bits(pdev, lnum, in, &in_data);
+ }
- if (lnum == bottom)
- break;
- /* finished with this page */
+ if(lnum == bottom ) break;
+ /* finished with this page */
- lcnt = gdev_prn_copy_scan_lines(pdev, lnum, in, in_size);
+ lcnt = gdev_prn_copy_scan_lines(pdev, lnum, in, in_size);
- inp = in + left;
- in_end = inp + width;
+ inp = in + left;
+ in_end = inp + width;
/* Remove trailing 0s form the scan line data */
- while (in_end > inp && in_end[-1] == 0) {
- in_end--;
- }
-
+ while (in_end > inp && in_end[-1] == 0)
+ {
+ in_end--;
+ }
+
/* Remove leading 0s form the scan line data */
-
- for (left2 = 0; inp < in_end && inp[0] == 0; inp++, left2++);
+
+ for(left2 = 0; inp < in_end && inp[0] == 0; inp++,left2++);
/* Recalculate starting X value */
-
+
left2 = left1 + (left2 << 3);
-/* Compress non-zero data for this line */
+/* Compress non-zero data for this line*/
- outp = out;
+ outp = out;
- for (p = inp, q = inp + 1; q < in_end;) {
- if (*p != *q++) {
- /*
- Copy non-repeated bytes
- to the output buffer
- */
- *outp++ = *p++;
- } else {
- for (count = 2; (*p == *q) && (q < in_end); q++, count++);
+ for( p = inp, q = inp + 1 ; q < in_end ; )
+ {
+ if( *p != *q++ )
+ {
+ /*
+ Copy non-repeated bytes
+ to the output buffer
+ */
+ *outp++ = *p++;
+ }
+ else
+ {
+ for (count = 2; ( *p == *q ) && (q < in_end); q++, count++);
/*
- Copy repeated bytes and counts to the output buffer.
- As long as count is <= 255, additional step is necessary
- for a long repeated sequence
- */
-
- while (count > 257) {
- *outp++ = *p;
- *outp++ = *p;
- *outp++ = 255;
- p += 257;
- count -= 257;
+ Copy repeated bytes and counts to the output buffer.
+ As long as count is <= 255, additional step is necessary
+ for a long repeated sequence
+ */
+
+ while (count > 257)
+ {
+ *outp++ = *p;
+ *outp++ = *p;
+ *outp++ = 255;
+ p += 257;
+ count -=257;
}
*outp++ = *p;
- *outp++ = *p;
- *outp++ = count - 2;
- p += count;
- q = p + 1;
- }
- }
+ *outp++ = *p;
+ *outp++ = count - 2;
+ p += count;
+ q = p+1;
+ }
+ }
/* The next line is necessary just in case of a single non-repeated byte at
- the end of the input buffer */
+the end of the input buffer */
- if (p == (in_end - 1))
- *outp++ = *p;
+if (p == (in_end - 1)) *outp++ = *p;
/* End of the compression procedure */
-
+
/* Set a new value of the starting X point, if necessary */
- if (left2 != left0) {
- left0 = left2;
- fwrite("\035", 1, 1, prn_stream);
- fprintf(prn_stream, "%d", left2);
- fwrite("X", 1, 1, prn_stream);
- }
-/* Output the data string to the printer.
- Y coordinate of the printer equals (lnum - 60)
- */
+if (left2 != left0)
+ {
+ left0 = left2;
+ fwrite("\035",1,1,prn_stream);
+ fprintf(prn_stream,"%d",left2);
+ fwrite("X",1,1,prn_stream);
+ }
- fwrite("\035", 1, 1, prn_stream);
- fprintf(prn_stream, "%d", lnum - 60);
- fwrite("Y\035", 1, 2, prn_stream);
- fprintf(prn_stream, "%d;", (outp - out));
- fprintf(prn_stream, "%d;", (in_end - inp) << 3);
- fwrite("1;0bi{I", 1, 7, prn_stream);
- fwrite(out, 1, (outp - out), prn_stream);
-
- lnum++;
-
- }
+/* Output the data string to the printer.
+Y coordinate of the printer equals (lnum - 60)
+*/
+
+ fwrite("\035",1,1,prn_stream);
+ fprintf(prn_stream,"%d",lnum-60);
+ fwrite("Y\035",1,2,prn_stream);
+ fprintf(prn_stream,"%d;",(outp - out));
+ fprintf(prn_stream,"%d;",(in_end - inp) << 3);
+ fwrite("1;0bi{I",1,7,prn_stream);
+ fwrite(out,1,(outp - out),prn_stream);
+
+ lnum++;
+
+ }
/* Send the termination string */
- fwrite("\0350bcI", 1, 5, prn_stream);
- fwrite("\0351coO", 1, 5, prn_stream);
- fwrite("\035rhE", 1, 4, prn_stream);
-
- fwrite("\033\001@EJL \n", 1, 8, prn_stream);
- fwrite("@EJL SE LA=ESC/PAGE\n", 1, 20, prn_stream);
- fwrite("@EJL SET PU=1 PS=A4 ZO=OFF\n", 1, 27, prn_stream);
- fwrite("@EJL EN LA=ESC/PAGE\n", 1, 20, prn_stream);
- fwrite("\0350;0.24muE\0352;300;300drE", 1, 23, prn_stream);
- fwrite("\0350;300;300drE\0351tsE\0351mmE", 1, 23, prn_stream);
- fwrite("\0357isE\0355iaF\0355ipP\03514psE\0350poE", 1, 26, prn_stream);
- fwrite("\03560;60loE\0350X\0350Y", 1, 15, prn_stream);
- fwrite("\0350;0;2360;3388caE", 1, 17, prn_stream);
- fwrite("\0351cmE\0350alfP", 1, 11, prn_stream);
- fwrite("\0350affP\0350boP\0350abP", 1, 16, prn_stream);
- fwrite("\0354ilG\0350bcI\0350sarG", 1, 16, prn_stream);
- fwrite("\035rhE", 1, 4, prn_stream);
- fwrite("\033\001@EJL \n", 1, 8, prn_stream);
- fwrite("\033\001@EJL \n", 1, 8, prn_stream);
-
- fflush(prn_stream);
-
- gs_free((char *)buf2, in_size, 1, "lp8000_print_page(buf2)");
- gs_free((char *)buf1, in_size, 1, "lp8000_print_page(buf1)");
- return 0;
+ fwrite("\0350bcI",1,5,prn_stream);
+ fwrite("\0351coO",1,5,prn_stream);
+ fwrite("\035rhE",1,4,prn_stream);
+
+ fwrite("\033\001@EJL \n",1,8,prn_stream);
+ fwrite("@EJL SE LA=ESC/PAGE\n",1,20,prn_stream);
+ fwrite("@EJL SET PU=1 PS=A4 ZO=OFF\n",1,27,prn_stream);
+ fwrite("@EJL EN LA=ESC/PAGE\n",1,20,prn_stream);
+ fwrite("\0350;0.24muE\0352;300;300drE",1,23,prn_stream);
+ fwrite("\0350;300;300drE\0351tsE\0351mmE",1,23,prn_stream);
+ fwrite("\0357isE\0355iaF\0355ipP\03514psE\0350poE",1,26,prn_stream);
+ fwrite("\03560;60loE\0350X\0350Y",1,15,prn_stream);
+ fwrite("\0350;0;2360;3388caE",1,17,prn_stream);
+ fwrite("\0351cmE\0350alfP",1,11,prn_stream);
+ fwrite("\0350affP\0350boP\0350abP",1,16,prn_stream);
+ fwrite("\0354ilG\0350bcI\0350sarG",1,16,prn_stream);
+ fwrite("\035rhE",1,4,prn_stream);
+ fwrite("\033\001@EJL \n",1,8,prn_stream);
+ fwrite("\033\001@EJL \n",1,8,prn_stream);
+
+ fflush(prn_stream);
+
+ gs_free((char *)buf2, in_size, 1, "lp8000_print_page(buf2)");
+ gs_free((char *)buf1, in_size, 1, "lp8000_print_page(buf1)");
+ return 0;
}
diff --git a/gs/src/gdevm1.c b/gs/src/gdevm1.c
index cddcb3f95..c3891eb9e 100644
--- a/gs/src/gdevm1.c
+++ b/gs/src/gdevm1.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1989, 1995, 1996 Aladdin Enterprises. All rights reserved.
+/* Copyright (C) 1989, 1995, 1996, 1997, 1998 Aladdin Enterprises. All rights reserved.
This file is part of Aladdin Ghostscript.
@@ -16,7 +16,7 @@
all copies.
*/
-/* gdevm1.c */
+/*Id: gdevm1.c */
/* Monobit "memory" (stored bitmap) device */
#include "memory_.h"
#include "gx.h"
@@ -55,12 +55,13 @@ private dev_proc_strip_tile_rectangle(mem_mono_strip_tile_rectangle);
/* The device descriptor. */
/* The instance is public. */
-const gx_device_memory far_data mem_mono_device =
+const gx_device_memory mem_mono_device =
mem_full_alpha_device("image1", 0, 1, mem_open,
mem_mono_map_rgb_color, mem_mono_map_color_rgb,
mem_mono_copy_mono, gx_default_copy_color, mem_mono_fill_rectangle,
- mem_get_bits, gx_default_map_cmyk_color, gx_no_copy_alpha,
- mem_mono_strip_tile_rectangle, mem_mono_strip_copy_rop);
+ gx_default_map_cmyk_color, gx_no_copy_alpha,
+ mem_mono_strip_tile_rectangle, mem_mono_strip_copy_rop,
+ mem_get_bits_rectangle);
/* Map color to/from RGB. This may be inverted. */
private gx_color_index
@@ -104,22 +105,31 @@ mem_mono_fill_rectangle(gx_device * dev, int x, int y, int w, int h,
#undef mono_masks
#define mono_masks mono_copy_masks
-/* Fetch a chunk from the source. */
-/* The source data are always stored big-endian. */
-/* Note that the macros always cast cptr, */
-/* so it doesn't matter what the type of cptr is. */
+/*
+ * Fetch a chunk from the source.
+ *
+ * Since source and destination are both always big-endian,
+ * fetching an aligned chunk never requires byte swapping.
+ */
+#define CFETCH_ALIGNED(cptr)\
+ (*(const chunk *)(cptr))
+
+/*
+ * Note that the macros always cast cptr,
+ * so it doesn't matter what the type of cptr is.
+ */
/* cshift = chunk_bits - shift. */
#undef chunk
#if arch_is_big_endian
# define chunk uint
-# define cfetch_right(cptr, shift, cshift)\
- (cfetch_aligned(cptr) >> shift)
-# define cfetch_left(cptr, shift, cshift)\
- (cfetch_aligned(cptr) << shift)
+# define CFETCH_RIGHT(cptr, shift, cshift)\
+ (CFETCH_ALIGNED(cptr) >> shift)
+# define CFETCH_LEFT(cptr, shift, cshift)\
+ (CFETCH_ALIGNED(cptr) << shift)
/* Fetch a chunk that straddles a chunk boundary. */
-# define cfetch2(cptr, cskew, skew)\
- (cfetch_left(cptr, cskew, skew) +\
- cfetch_right((const chunk *)(cptr) + 1, skew, cskew))
+# define CFETCH2(cptr, cskew, skew)\
+ (CFETCH_LEFT(cptr, cskew, skew) +\
+ CFETCH_RIGHT((const chunk *)(cptr) + 1, skew, cskew))
#else /* little-endian */
# define chunk bits16
private const bits16 right_masks2[9] =
@@ -131,161 +141,166 @@ private const bits16 left_masks2[9] =
0xffff, 0xfefe, 0xfcfc, 0xf8f8, 0xf0f0, 0xe0e0, 0xc0c0, 0x8080, 0x0000
};
-# define ccont(cptr, off) (((const chunk *)(cptr))[off])
-# define cfetch_right(cptr, shift, cshift)\
+# define CCONT(cptr, off) (((const chunk *)(cptr))[off])
+# define CFETCH_RIGHT(cptr, shift, cshift)\
((shift) < 8 ?\
- ((ccont(cptr, 0) >> (shift)) & right_masks2[shift]) +\
- (ccont(cptr, 0) << (cshift)) :\
+ ((CCONT(cptr, 0) >> (shift)) & right_masks2[shift]) +\
+ (CCONT(cptr, 0) << (cshift)) :\
((chunk)*(const byte *)(cptr) << (cshift)) & 0xff00)
-# define cfetch_left(cptr, shift, cshift)\
+# define CFETCH_LEFT(cptr, shift, cshift)\
((shift) < 8 ?\
- ((ccont(cptr, 0) << (shift)) & left_masks2[shift]) +\
- (ccont(cptr, 0) >> (cshift)) :\
- ((ccont(cptr, 0) & 0xff00) >> (cshift)) & 0xff)
+ ((CCONT(cptr, 0) << (shift)) & left_masks2[shift]) +\
+ (CCONT(cptr, 0) >> (cshift)) :\
+ ((CCONT(cptr, 0) & 0xff00) >> (cshift)) & 0xff)
/* Fetch a chunk that straddles a chunk boundary. */
/* We can avoid testing the shift amount twice */
-/* by expanding the cfetch_left/right macros in-line. */
-# define cfetch2(cptr, cskew, skew)\
+/* by expanding the CFETCH_LEFT/right macros in-line. */
+# define CFETCH2(cptr, cskew, skew)\
((cskew) < 8 ?\
- ((ccont(cptr, 0) << (cskew)) & left_masks2[cskew]) +\
- (ccont(cptr, 0) >> (skew)) +\
+ ((CCONT(cptr, 0) << (cskew)) & left_masks2[cskew]) +\
+ (CCONT(cptr, 0) >> (skew)) +\
(((chunk)(((const byte *)(cptr))[2]) << (cskew)) & 0xff00) :\
- (((ccont(cptr, 0) & 0xff00) >> (skew)) & 0xff) +\
- ((ccont(cptr, 1) >> (skew)) & right_masks2[skew]) +\
- (ccont(cptr, 1) << (cskew)))
+ (((CCONT(cptr, 0) & 0xff00) >> (skew)) & 0xff) +\
+ ((CCONT(cptr, 1) >> (skew)) & right_masks2[skew]) +\
+ (CCONT(cptr, 1) << (cskew)))
#endif
-/* Since source and destination are both always big-endian, */
-/* fetching an aligned chunk never requires byte swapping. */
-# define cfetch_aligned(cptr)\
- (*(const chunk *)(cptr))
-/* copy_function and copy_shift get added together for dispatch */
typedef enum {
- copy_or = 0, copy_store, copy_and, copy_funny
+ COPY_OR = 0, COPY_STORE, COPY_AND, COPY_FUNNY
} copy_function;
-
-/* copy_right/left is not an enum, because compilers complain about */
-/* an enumeration clash when these are added to a copy_function. */
-#define copy_right ((copy_function)0)
-#define copy_left ((copy_function)4)
typedef struct {
- short invert;
- ushort op; /* copy_function */
+ uint invert;
+ copy_function op;
} copy_mode;
-/* Map from <c0,c1> to copy_mode. */
-#define cm(i,op) { i, (ushort)op }
-private copy_mode copy_modes[9] =
+/*
+ * Map from <color0,color1> to copy_mode.
+ * Logically, this is a 2-D array.
+ * The indexing is (transparent, 0, 1, unused). */
+private const copy_mode copy_modes[16] =
{
- cm(-1, copy_funny), /* NN */
- cm(-1, copy_and), /* N0 */
- cm(0, copy_or), /* N1 */
- cm(0, copy_and), /* 0N */
- cm(0, copy_funny), /* 00 */
- cm(0, copy_store), /* 01 */
- cm(-1, copy_or), /* 1N */
- cm(-1, copy_store), /* 10 */
- cm(0, copy_funny), /* 11 */
+ {~0, COPY_FUNNY}, /* NN */
+ {~0, COPY_AND}, /* N0 */
+ {0, COPY_OR}, /* N1 */
+ {0, 0}, /* unused */
+ {0, COPY_AND}, /* 0N */
+ {0, COPY_FUNNY}, /* 00 */
+ {0, COPY_STORE}, /* 01 */
+ {0, 0}, /* unused */
+ {~0, COPY_OR}, /* 1N */
+ {~0, COPY_STORE}, /* 10 */
+ {0, COPY_FUNNY}, /* 11 */
+ {0, 0}, /* unused */
+ {0, 0}, /* unused */
+ {0, 0}, /* unused */
+ {0, 0}, /* unused */
+ {0, 0}, /* unused */
};
+
+/* Handle the funny cases that aren't supposed to happen. */
+#define FUNNY_CASE()\
+ (invert ? gs_note_error(-1) :\
+ mem_mono_fill_rectangle(dev, x, y, w, h, color0))
+
private int
mem_mono_copy_mono(gx_device * dev,
- const byte * base, int sourcex, int sraster, gx_bitmap_id id,
- int x, int y, int w, int h, gx_color_index zero, gx_color_index one)
+ const byte * source_data, int source_x, int source_raster, gx_bitmap_id id,
+ int x, int y, int w, int h, gx_color_index color0, gx_color_index color1)
{
#ifdef USE_COPY_ROP
- return mem_mono_copy_rop(dev, base, sourcex, sraster, id, NULL,
- NULL, NULL,
+ return mem_mono_copy_rop(dev, source_data, source_x, source_raster,
+ id, NULL, NULL, NULL,
x, y, w, h, 0, 0,
- ((zero == gx_no_color_index ? rop3_D :
- zero == 0 ? rop3_0 : rop3_1) & ~rop3_S) |
- ((one == gx_no_color_index ? rop3_D :
- one == 0 ? rop3_0 : rop3_1) & rop3_S));
+ ((color0 == gx_no_color_index ? rop3_D :
+ color0 == 0 ? rop3_0 : rop3_1) & ~rop3_S) |
+ ((color1 == gx_no_color_index ? rop3_D :
+ color1 == 0 ? rop3_0 : rop3_1) & rop3_S));
#else /* !USE_COPY_ROP */
register const byte *bptr; /* actually chunk * */
int dbit, wleft;
uint mask;
copy_mode mode;
-#define function (copy_function)(mode.op)
- declare_scan_ptr_as(dbptr, byte *);
+ DECLARE_SCAN_PTR_VARS(dbptr, byte *, dest_raster);
#define optr ((chunk *)dbptr)
register int skew;
register uint invert;
- fit_copy(dev, base, sourcex, sraster, id, x, y, w, h);
+ fit_copy(dev, source_data, source_x, source_raster, id, x, y, w, h);
#if gx_no_color_index_value != -1 /* hokey! */
- if (zero == gx_no_color_index)
- zero = -1;
- if (one == gx_no_color_index)
- one = -1;
+ if (color0 == gx_no_color_index)
+ color0 = -1;
+ if (color1 == gx_no_color_index)
+ color1 = -1;
#endif
-#define izero (int)zero
-#define ione (int)one
- mode = copy_modes[izero + izero + izero + ione + 4];
-#undef izero
-#undef ione
- invert = (uint) (int)mode.invert; /* load register */
- setup_rect_as(dbptr, byte *);
- bptr = base + ((sourcex & ~chunk_align_bit_mask) >> 3);
+ mode = copy_modes[((int)color0 << 2) + (int)color1 + 5];
+ invert = mode.invert; /* load register */
+ SETUP_RECT_VARS(dbptr, byte *, dest_raster);
+ bptr = source_data + ((source_x & ~chunk_align_bit_mask) >> 3);
dbit = x & chunk_align_bit_mask;
- skew = dbit - (sourcex & chunk_align_bit_mask);
+ skew = dbit - (source_x & chunk_align_bit_mask);
+
/* Macros for writing partial chunks. */
/* The destination pointer is always named optr, */
/* and must be declared as chunk *. */
-/* cinvert may be temporarily redefined. */
-#define cinvert(bits) ((bits) ^ invert)
-#define write_or_masked(bits, mask, off)\
- optr[off] |= (cinvert(bits) & mask)
-#define write_store_masked(bits, mask, off)\
- optr[off] = ((optr[off] & ~mask) | (cinvert(bits) & mask))
-#define write_and_masked(bits, mask, off)\
- optr[off] &= (cinvert(bits) | ~mask)
+/* CINVERT may be temporarily redefined. */
+#define CINVERT(bits) ((bits) ^ invert)
+#define WRITE_OR_MASKED(bits, mask, off)\
+ optr[off] |= (CINVERT(bits) & mask)
+#define WRITE_STORE_MASKED(bits, mask, off)\
+ optr[off] = ((optr[off] & ~mask) | (CINVERT(bits) & mask))
+#define WRITE_AND_MASKED(bits, mask, off)\
+ optr[off] &= (CINVERT(bits) | ~mask)
/* Macros for writing full chunks. */
-#define write_or(bits) *optr |= cinvert(bits)
-#define write_store(bits) *optr = cinvert(bits)
-#define write_and(bits) *optr &= cinvert(bits)
+#define WRITE_OR(bits) *optr |= CINVERT(bits)
+#define WRITE_STORE(bits) *optr = CINVERT(bits)
+#define WRITE_AND(bits) *optr &= CINVERT(bits)
/* Macro for incrementing to next chunk. */
-#define next_x_chunk\
+#define NEXT_X_CHUNK()\
bptr += chunk_bytes; dbptr += chunk_bytes
/* Common macro for the end of each scan line. */
-#define end_y_loop(sdelta, ddelta)\
- if ( --h == 0 ) break;\
+#define END_Y_LOOP(sdelta, ddelta)\
bptr += sdelta; dbptr += ddelta
+
if ((wleft = w + dbit - chunk_bits) <= 0) { /* The entire operation fits in one (destination) chunk. */
set_mono_thin_mask(mask, w, dbit);
-#define write_single(wr_op, src)\
+
+#define WRITE_SINGLE(wr_op, src)\
for ( ; ; )\
{ wr_op(src, mask, 0);\
- end_y_loop(sraster, draster);\
+ if ( --h == 0 ) break;\
+ END_Y_LOOP(source_raster, dest_raster);\
}
-#define write1_loop(src)\
- switch ( function ) {\
- case copy_or: write_single(write_or_masked, src); break;\
- case copy_store: write_single(write_store_masked, src); break;\
- case copy_and: write_single(write_and_masked, src); break;\
- default: goto funny;\
+
+#define WRITE1_LOOP(src)\
+ switch ( mode.op ) {\
+ case COPY_OR: WRITE_SINGLE(WRITE_OR_MASKED, src); break;\
+ case COPY_STORE: WRITE_SINGLE(WRITE_STORE_MASKED, src); break;\
+ case COPY_AND: WRITE_SINGLE(WRITE_AND_MASKED, src); break;\
+ default: return FUNNY_CASE();\
}
+
if (skew >= 0) { /* single -> single, right/no shift */
if (skew == 0) { /* no shift */
- write1_loop(cfetch_aligned(bptr));
+ WRITE1_LOOP(CFETCH_ALIGNED(bptr));
} else { /* right shift */
int cskew = chunk_bits - skew;
- write1_loop(cfetch_right(bptr, skew, cskew));
+ WRITE1_LOOP(CFETCH_RIGHT(bptr, skew, cskew));
}
} else if (wleft <= skew) { /* single -> single, left shift */
int cskew = chunk_bits + skew;
skew = -skew;
- write1_loop(cfetch_left(bptr, skew, cskew));
+ WRITE1_LOOP(CFETCH_LEFT(bptr, skew, cskew));
} else { /* double -> single */
int cskew = -skew;
skew += chunk_bits;
- write1_loop(cfetch2(bptr, cskew, skew));
+ WRITE1_LOOP(CFETCH2(bptr, cskew, skew));
}
-#undef write1_loop
-#undef write_single
+#undef WRITE1_LOOP
+#undef WRITE_SINGLE
} else if (wleft <= skew) { /* 1 source chunk -> 2 destination chunks. */
/* This is an important special case for */
/* both characters and halftone tiles. */
@@ -294,149 +309,156 @@ mem_mono_copy_mono(gx_device * dev,
set_mono_left_mask(mask, dbit);
set_mono_right_mask(rmask, wleft);
-#undef cinvert
-#define cinvert(bits) (bits) /* pre-inverted here */
+#undef CINVERT
+#define CINVERT(bits) (bits) /* pre-inverted here */
+
#if arch_is_big_endian /* no byte swapping */
-# define write_1to2(wr_op)\
+# define WRITE_1TO2(wr_op)\
for ( ; ; )\
- { register uint bits = cfetch_aligned(bptr) ^ invert;\
+ { register uint bits = CFETCH_ALIGNED(bptr) ^ invert;\
wr_op(bits >> skew, mask, 0);\
wr_op(bits << cskew, rmask, 1);\
- end_y_loop(sraster, draster);\
+ if ( --h == 0 ) break;\
+ END_Y_LOOP(source_raster, dest_raster);\
}
#else /* byte swapping */
-# define write_1to2(wr_op)\
+# define WRITE_1TO2(wr_op)\
for ( ; ; )\
- { wr_op(cfetch_right(bptr, skew, cskew) ^ invert, mask, 0);\
- wr_op(cfetch_left(bptr, cskew, skew) ^ invert, rmask, 1);\
- end_y_loop(sraster, draster);\
+ { wr_op(CFETCH_RIGHT(bptr, skew, cskew) ^ invert, mask, 0);\
+ wr_op(CFETCH_LEFT(bptr, cskew, skew) ^ invert, rmask, 1);\
+ if ( --h == 0 ) break;\
+ END_Y_LOOP(source_raster, dest_raster);\
}
#endif
- switch (function) {
- case copy_or:
- write_1to2(write_or_masked);
+
+ switch (mode.op) {
+ case COPY_OR:
+ WRITE_1TO2(WRITE_OR_MASKED);
break;
- case copy_store:
- write_1to2(write_store_masked);
+ case COPY_STORE:
+ WRITE_1TO2(WRITE_STORE_MASKED);
break;
- case copy_and:
- write_1to2(write_and_masked);
+ case COPY_AND:
+ WRITE_1TO2(WRITE_AND_MASKED);
break;
default:
- goto funny;
+ return FUNNY_CASE();
}
-#undef cinvert
-#define cinvert(bits) ((bits) ^ invert)
-#undef write_1to2
+#undef CINVERT
+#define CINVERT(bits) ((bits) ^ invert)
+#undef WRITE_1TO2
} else { /* More than one source chunk and more than one */
/* destination chunk are involved. */
uint rmask;
int words = (wleft & ~chunk_bit_mask) >> 3;
- uint sskip = sraster - words;
- uint dskip = draster - words;
+ uint sskip = source_raster - words;
+ uint dskip = dest_raster - words;
register uint bits;
set_mono_left_mask(mask, dbit);
set_mono_right_mask(rmask, wleft & chunk_bit_mask);
if (skew == 0) { /* optimize the aligned case */
-#define write_aligned(wr_op, wr_op_masked)\
+
+#define WRITE_ALIGNED(wr_op, wr_op_masked)\
for ( ; ; )\
{ int count = wleft;\
/* Do first partial chunk. */\
- wr_op_masked(cfetch_aligned(bptr), mask, 0);\
+ wr_op_masked(CFETCH_ALIGNED(bptr), mask, 0);\
/* Do full chunks. */\
while ( (count -= chunk_bits) >= 0 )\
- { next_x_chunk; wr_op(cfetch_aligned(bptr)); }\
+ { NEXT_X_CHUNK(); wr_op(CFETCH_ALIGNED(bptr)); }\
/* Do last chunk */\
if ( count > -chunk_bits )\
- { wr_op_masked(cfetch_aligned(bptr + chunk_bytes), rmask, 1); }\
- end_y_loop(sskip, dskip);\
+ { wr_op_masked(CFETCH_ALIGNED(bptr + chunk_bytes), rmask, 1); }\
+ if ( --h == 0 ) break;\
+ END_Y_LOOP(sskip, dskip);\
}
- switch (function) {
- case copy_or:
- write_aligned(write_or, write_or_masked);
+
+ switch (mode.op) {
+ case COPY_OR:
+ WRITE_ALIGNED(WRITE_OR, WRITE_OR_MASKED);
break;
- case copy_store:
- write_aligned(write_store, write_store_masked);
+ case COPY_STORE:
+ WRITE_ALIGNED(WRITE_STORE, WRITE_STORE_MASKED);
break;
- case copy_and:
- write_aligned(write_and, write_and_masked);
+ case COPY_AND:
+ WRITE_ALIGNED(WRITE_AND, WRITE_AND_MASKED);
break;
default:
- goto funny;
+ return FUNNY_CASE();
}
-#undef write_aligned
+#undef WRITE_ALIGNED
} else { /* not aligned */
- int ccase =
- (skew >= 0 ? copy_right :
- ((bptr += chunk_bytes), copy_left))
- + (int)function;
int cskew = -skew & chunk_bit_mask;
+ bool case_right =
+ (skew >= 0 ? true :
+ ((bptr += chunk_bytes), false));
skew &= chunk_bit_mask;
- for (;;) {
- int count = wleft;
-#define prefetch_right\
- bits = cfetch_right(bptr, skew, cskew)
-#define prefetch_left\
- bits = cfetch2(bptr - chunk_bytes, cskew, skew)
-#define write_unaligned(wr_op, wr_op_masked)\
+#define WRITE_UNALIGNED(wr_op, wr_op_masked)\
+ /* Prefetch partial word. */\
+ bits =\
+ (case_right ? CFETCH_RIGHT(bptr, skew, cskew) :\
+ CFETCH2(bptr - chunk_bytes, cskew, skew));\
wr_op_masked(bits, mask, 0);\
/* Do full chunks. */\
while ( count >= chunk_bits )\
- { bits = cfetch2(bptr, cskew, skew);\
- next_x_chunk; wr_op(bits); count -= chunk_bits;\
+ { bits = CFETCH2(bptr, cskew, skew);\
+ NEXT_X_CHUNK(); wr_op(bits); count -= chunk_bits;\
}\
/* Do last chunk */\
if ( count > 0 )\
- { bits = cfetch_left(bptr, cskew, skew);\
- if ( count > skew ) bits += cfetch_right(bptr + chunk_bytes, skew, cskew);\
+ { bits = CFETCH_LEFT(bptr, cskew, skew);\
+ if ( count > skew ) bits += CFETCH_RIGHT(bptr + chunk_bytes, skew, cskew);\
wr_op_masked(bits, rmask, 1);\
}
- switch (ccase) {
- case copy_or + copy_left:
- prefetch_left;
- goto uor;
- case copy_or + copy_right:
- prefetch_right;
- uor:write_unaligned(write_or, write_or_masked);
- break;
- case copy_store + copy_left:
- prefetch_left;
- goto ustore;
- case copy_store + copy_right:
- prefetch_right;
- ustore:write_unaligned(write_store, write_store_masked);
- break;
- case copy_and + copy_left:
- prefetch_left;
- goto uand;
- case copy_and + copy_right:
- prefetch_right;
- uand:write_unaligned(write_and, write_and_masked);
- break;
- default:
- goto funny;
- }
- end_y_loop(sskip, dskip);
-#undef write_unaligned
-#undef prefetch_left
-#undef prefetch_right
+
+ switch (mode.op) {
+ case COPY_OR:
+ for (;;) {
+ int count = wleft;
+
+ WRITE_UNALIGNED(WRITE_OR, WRITE_OR_MASKED);
+ if (--h == 0)
+ break;
+ END_Y_LOOP(sskip, dskip);
+ }
+ break;
+ case COPY_STORE:
+ for (;;) {
+ int count = wleft;
+
+ WRITE_UNALIGNED(WRITE_STORE, WRITE_STORE_MASKED);
+ if (--h == 0)
+ break;
+ END_Y_LOOP(sskip, dskip);
+ }
+ break;
+ case COPY_AND:
+ for (;;) {
+ int count = wleft;
+
+ WRITE_UNALIGNED(WRITE_AND, WRITE_AND_MASKED);
+ if (--h == 0)
+ break;
+ END_Y_LOOP(sskip, dskip);
+ }
+ break;
+ default /*case COPY_FUNNY */ :
+ return FUNNY_CASE();
}
+#undef WRITE_UNALIGNED
}
}
-#undef end_y_loop
-#undef next_x_chunk
+#undef END_Y_LOOP
+#undef NEXT_X_CHUNK
return 0;
- /* Handle the funny cases that aren't supposed to happen. */
- funny:return (invert ? gs_note_error(-1) :
- mem_mono_fill_rectangle(dev, x, y, w, h, zero));
#undef optr
#endif /* !USE_COPY_ROP */
}
-#if OPTIMIZE_TILE
+#if OPTIMIZE_TILE /**************** *************** */
/* Strip-tile with a monochrome halftone. */
/* This is a performance bottleneck for monochrome devices, */
@@ -457,9 +479,9 @@ int tx, int y, int tw, int th, gx_color_index color0, gx_color_index color1,
color1 == 0 ? rop3_0 : rop3_1) & rop3_T));
#else /* !USE_COPY_ROP */
register uint invert;
- int sraster;
+ int source_raster;
uint tile_bits_size;
- const byte *base;
+ const byte *source_data;
const byte *end;
int x, rw, w, h;
register const byte *bptr; /* actually chunk * */
@@ -467,7 +489,7 @@ int tx, int y, int tw, int th, gx_color_index color0, gx_color_index color1,
uint mask;
byte *dbase;
- declare_scan_ptr_as(dbptr, byte *);
+ DECLARE_SCAN_PTR_VARS(dbptr, byte *, dest_raster);
#define optr ((chunk *)dbptr)
register int skew;
@@ -477,32 +499,31 @@ int tx, int y, int tw, int th, gx_color_index color0, gx_color_index color1,
color0, color1, px, py);
fit_fill(dev, tx, y, tw, th);
invert = -(uint) color0;
- sraster = tiles->raster;
- base = tiles->data + ((y + py) % tiles->rep_height) * sraster;
- tile_bits_size = tiles->size.y * sraster;
+ source_raster = tiles->raster;
+ source_data = tiles->data + ((y + py) % tiles->rep_height) * source_raster;
+ tile_bits_size = tiles->size.y * source_raster;
end = tiles->data + tile_bits_size;
-#undef end_y_loop
-#define end_y_loop(sdelta, ddelta)\
- if ( --h == 0 ) break;\
+#undef END_Y_LOOP
+#define END_Y_LOOP(sdelta, ddelta)\
if ( end - bptr <= sdelta ) /* wrap around */\
bptr -= tile_bits_size;\
bptr += sdelta; dbptr += ddelta
- draster = mdev->raster;
+ dest_raster = mdev->raster;
dbase = scan_line_base(mdev, y);
x = tx;
rw = tw;
/*
* The outermost loop here works horizontally, one iteration per
* copy of the tile. Note that all iterations except the first
- * have sourcex = 0.
+ * have source_x = 0.
*/
{
- int sourcex = (x + px) % tiles->rep_width;
+ int source_x = (x + px) % tiles->rep_width;
- w = tiles->size.x - sourcex;
- bptr = base + ((sourcex & ~chunk_align_bit_mask) >> 3);
+ w = tiles->size.x - source_x;
+ bptr = source_data + ((source_x & ~chunk_align_bit_mask) >> 3);
dbit = x & chunk_align_bit_mask;
- skew = dbit - (sourcex & chunk_align_bit_mask);
+ skew = dbit - (source_x & chunk_align_bit_mask);
}
outer:if (w > rw)
w = rw;
@@ -510,31 +531,32 @@ int tx, int y, int tw, int th, gx_color_index color0, gx_color_index color1,
dbptr = dbase + ((x >> 3) & -chunk_align_bytes);
if ((wleft = w + dbit - chunk_bits) <= 0) { /* The entire operation fits in one (destination) chunk. */
set_mono_thin_mask(mask, w, dbit);
-#define write1_loop(src)\
+#define WRITE1_LOOP(src)\
for ( ; ; )\
- { write_store_masked(src, mask, 0);\
- end_y_loop(sraster, draster);\
+ { WRITE_STORE_MASKED(src, mask, 0);\
+ if ( --h == 0 ) break;\
+ END_Y_LOOP(source_raster, dest_raster);\
}
if (skew >= 0) { /* single -> single, right/no shift */
if (skew == 0) { /* no shift */
- write1_loop(cfetch_aligned(bptr));
+ WRITE1_LOOP(CFETCH_ALIGNED(bptr));
} else { /* right shift */
int cskew = chunk_bits - skew;
- write1_loop(cfetch_right(bptr, skew, cskew));
+ WRITE1_LOOP(CFETCH_RIGHT(bptr, skew, cskew));
}
} else if (wleft <= skew) { /* single -> single, left shift */
int cskew = chunk_bits + skew;
skew = -skew;
- write1_loop(cfetch_left(bptr, skew, cskew));
+ WRITE1_LOOP(CFETCH_LEFT(bptr, skew, cskew));
} else { /* double -> single */
int cskew = -skew;
skew += chunk_bits;
- write1_loop(cfetch2(bptr, cskew, skew));
+ WRITE1_LOOP(CFETCH2(bptr, cskew, skew));
}
-#undef write1_loop
+#undef WRITE1_LOOP
} else if (wleft <= skew) { /* 1 source chunk -> 2 destination chunks. */
/* This is an important special case for */
/* both characters and halftone tiles. */
@@ -544,33 +566,37 @@ int tx, int y, int tw, int th, gx_color_index color0, gx_color_index color1,
set_mono_left_mask(mask, dbit);
set_mono_right_mask(rmask, wleft);
#if arch_is_big_endian /* no byte swapping */
-#undef cinvert
-#define cinvert(bits) (bits) /* pre-inverted here */
+#undef CINVERT
+#define CINVERT(bits) (bits) /* pre-inverted here */
for (;;) {
- register uint bits = cfetch_aligned(bptr) ^ invert;
+ register uint bits = CFETCH_ALIGNED(bptr) ^ invert;
- write_store_masked(bits >> skew, mask, 0);
- write_store_masked(bits << cskew, rmask, 1);
- end_y_loop(sraster, draster);
+ WRITE_STORE_MASKED(bits >> skew, mask, 0);
+ WRITE_STORE_MASKED(bits << cskew, rmask, 1);
+ if (--h == 0)
+ break;
+ END_Y_LOOP(source_raster, dest_raster);
}
-#undef cinvert
-#define cinvert(bits) ((bits) ^ invert)
+#undef CINVERT
+#define CINVERT(bits) ((bits) ^ invert)
#else /* byte swapping */
for (;;) {
- write_store_masked(cfetch_right(bptr, skew, cskew), mask, 0);
- write_store_masked(cfetch_left(bptr, cskew, skew), rmask, 1);
- end_y_loop(sraster, draster);
+ WRITE_STORE_MASKED(CFETCH_RIGHT(bptr, skew, cskew), mask, 0);
+ WRITE_STORE_MASKED(CFETCH_LEFT(bptr, cskew, skew), rmask, 1);
+ if (--h == 0)
+ break;
+ END_Y_LOOP(source_raster, dest_raster);
}
#endif
} else { /* More than one source chunk and more than one */
/* destination chunk are involved. */
uint rmask;
int words = (wleft & ~chunk_bit_mask) >> 3;
- uint sskip = sraster - words;
- uint dskip = draster - words;
+ uint sskip = source_raster - words;
+ uint dskip = dest_raster - words;
register uint bits;
-#define next_x_chunk\
+#define NEXT_X_CHUNK()\
bptr += chunk_bytes; dbptr += chunk_bytes
set_mono_right_mask(rmask, wleft & chunk_bit_mask);
@@ -584,19 +610,21 @@ int tx, int y, int tw, int th, gx_color_index color0, gx_color_index color1,
/* Do first partial chunk. */
if (mask)
- write_store_masked(cfetch_aligned(bptr), mask, 0);
+ WRITE_STORE_MASKED(CFETCH_ALIGNED(bptr), mask, 0);
else
- write_store(cfetch_aligned(bptr));
+ WRITE_STORE(CFETCH_ALIGNED(bptr));
/* Do full chunks. */
while ((count -= chunk_bits) >= 0) {
- next_x_chunk;
- write_store(cfetch_aligned(bptr));
+ NEXT_X_CHUNK();
+ WRITE_STORE(CFETCH_ALIGNED(bptr));
}
/* Do last chunk */
if (count > -chunk_bits) {
- write_store_masked(cfetch_aligned(bptr + chunk_bytes), rmask, 1);
+ WRITE_STORE_MASKED(CFETCH_ALIGNED(bptr + chunk_bytes), rmask, 1);
}
- end_y_loop(sskip, dskip);
+ if (--h == 0)
+ break;
+ END_Y_LOOP(sskip, dskip);
}
} else { /* not aligned */
bool case_right =
@@ -610,35 +638,37 @@ int tx, int y, int tw, int th, gx_color_index color0, gx_color_index color1,
int count = wleft;
if (case_right)
- bits = cfetch_right(bptr, skew, cskew);
+ bits = CFETCH_RIGHT(bptr, skew, cskew);
else
- bits = cfetch2(bptr - chunk_bytes, cskew, skew);
- write_store_masked(bits, mask, 0);
+ bits = CFETCH2(bptr - chunk_bytes, cskew, skew);
+ WRITE_STORE_MASKED(bits, mask, 0);
/* Do full chunks. */
while (count >= chunk_bits) {
- bits = cfetch2(bptr, cskew, skew);
- next_x_chunk;
- write_store(bits);
+ bits = CFETCH2(bptr, cskew, skew);
+ NEXT_X_CHUNK();
+ WRITE_STORE(bits);
count -= chunk_bits;
}
/* Do last chunk */
if (count > 0) {
- bits = cfetch_left(bptr, cskew, skew);
+ bits = CFETCH_LEFT(bptr, cskew, skew);
if (count > skew)
- bits += cfetch_right(bptr + chunk_bytes, skew, cskew);
- write_store_masked(bits, rmask, 1);
+ bits += CFETCH_RIGHT(bptr + chunk_bytes, skew, cskew);
+ WRITE_STORE_MASKED(bits, rmask, 1);
}
- end_y_loop(sskip, dskip);
+ if (--h == 0)
+ break;
+ END_Y_LOOP(sskip, dskip);
}
}
}
-#undef end_y_loop
-#undef next_x_chunk
+#undef END_Y_LOOP
+#undef NEXT_X_CHUNK
#undef optr
if ((rw -= w) > 0) {
x += w;
w = tiles->size.x;
- bptr = base;
+ bptr = source_data;
skew = dbit = x & chunk_align_bit_mask;
goto outer;
}
@@ -646,7 +676,7 @@ int tx, int y, int tw, int th, gx_color_index color0, gx_color_index color1,
#endif /* !USE_COPY_ROP */
}
-#endif
+#endif /**************** *************** */
/* ================ "Word"-oriented device ================ */
@@ -662,12 +692,13 @@ private dev_proc_fill_rectangle(mem1_word_fill_rectangle);
#define mem1_word_strip_tile_rectangle gx_default_strip_tile_rectangle
/* Here is the device descriptor. */
-const gx_device_memory far_data mem_mono_word_device =
+const gx_device_memory mem_mono_word_device =
mem_full_alpha_device("image1w", 0, 1, mem_open,
mem_mono_map_rgb_color, mem_mono_map_color_rgb,
mem1_word_copy_mono, gx_default_copy_color, mem1_word_fill_rectangle,
- mem_word_get_bits, gx_default_map_cmyk_color, gx_no_copy_alpha,
- mem1_word_strip_tile_rectangle, gx_no_strip_copy_rop);
+ gx_default_map_cmyk_color, gx_no_copy_alpha,
+ mem1_word_strip_tile_rectangle, gx_no_strip_copy_rop,
+ mem_word_get_bits_rectangle);
/* Fill a rectangle with a color. */
private int
@@ -689,20 +720,20 @@ mem1_word_fill_rectangle(gx_device * dev, int x, int y, int w, int h,
/* Copy a bitmap. */
private int
mem1_word_copy_mono(gx_device * dev,
- const byte * base, int sourcex, int sraster, gx_bitmap_id id,
- int x, int y, int w, int h, gx_color_index zero, gx_color_index one)
+ const byte * source_data, int source_x, int source_raster, gx_bitmap_id id,
+ int x, int y, int w, int h, gx_color_index color0, gx_color_index color1)
{
byte *row;
uint raster;
bool store;
- fit_copy(dev, base, sourcex, sraster, id, x, y, w, h);
+ fit_copy(dev, source_data, source_x, source_raster, id, x, y, w, h);
row = scan_line_base(mdev, y);
raster = mdev->raster;
- store = (zero != gx_no_color_index && one != gx_no_color_index);
+ store = (color0 != gx_no_color_index && color1 != gx_no_color_index);
mem_swap_byte_rect(row, raster, x, w, h, store);
- mem_mono_copy_mono(dev, base, sourcex, sraster, id,
- x, y, w, h, zero, one);
+ mem_mono_copy_mono(dev, source_data, source_x, source_raster, id,
+ x, y, w, h, color0, color1);
mem_swap_byte_rect(row, raster, x, w, h, false);
return 0;
}
diff --git a/gs/src/gdevm16.c b/gs/src/gdevm16.c
index 9dfb5de7b..dc71e8517 100644
--- a/gs/src/gdevm16.c
+++ b/gs/src/gdevm16.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1994, 1996 Aladdin Enterprises. All rights reserved.
+/* Copyright (C) 1994, 1996, 1998 Aladdin Enterprises. All rights reserved.
This file is part of Aladdin Ghostscript.
@@ -16,7 +16,7 @@
all copies.
*/
-/* gdevm16.c */
+/*Id: gdevm16.c */
/* 16-bit-per-pixel "memory" (stored bitmap) device */
#include "memory_.h"
#include "gx.h"
@@ -35,7 +35,7 @@ declare_mem_map_procs(mem_true16_map_rgb_color, mem_true16_map_color_rgb);
declare_mem_procs(mem_true16_copy_mono, mem_true16_copy_color, mem_true16_fill_rectangle);
/* The device descriptor. */
-const gx_device_memory far_data mem_true16_device =
+const gx_device_memory mem_true16_device =
mem_device("image16", 16, 0,
mem_true16_map_rgb_color, mem_true16_map_color_rgb,
mem_true16_copy_mono, mem_true16_copy_color, mem_true16_fill_rectangle,
diff --git a/gs/src/gdevm2.c b/gs/src/gdevm2.c
index 44c5cb4d4..5c53ed35b 100644
--- a/gs/src/gdevm2.c
+++ b/gs/src/gdevm2.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1994, 1995, 1996 Aladdin Enterprises. All rights reserved.
+/* Copyright (C) 1994, 1995, 1996, 1997, 1998 Aladdin Enterprises. All rights reserved.
This file is part of Aladdin Ghostscript.
@@ -16,7 +16,7 @@
all copies.
*/
-/* gdevm2.c */
+/*Id: gdevm2.c */
/* 2-bit-per-pixel "memory" (stored bitmap) device */
#include "memory_.h"
#include "gx.h"
@@ -37,7 +37,7 @@ extern dev_proc_strip_copy_rop(mem_gray_strip_copy_rop);
declare_mem_procs(mem_mapped2_copy_mono, mem_mapped2_copy_color, mem_mapped2_fill_rectangle);
/* The device descriptor. */
-const gx_device_memory far_data mem_mapped2_device =
+const gx_device_memory mem_mapped2_device =
mem_device("image2", 2, 0,
mem_mapped_map_rgb_color, mem_mapped_map_color_rgb,
mem_mapped2_copy_mono, mem_mapped2_copy_color, mem_mapped2_fill_rectangle,
@@ -180,12 +180,12 @@ mem_mapped2_copy_color(gx_device * dev,
declare_mem_procs(mem2_word_copy_mono, mem2_word_copy_color, mem2_word_fill_rectangle);
/* Here is the device descriptor. */
-const gx_device_memory far_data mem_mapped2_word_device =
+const gx_device_memory mem_mapped2_word_device =
mem_full_device("image2w", 2, 0, mem_open,
mem_mapped_map_rgb_color, mem_mapped_map_color_rgb,
mem2_word_copy_mono, mem2_word_copy_color, mem2_word_fill_rectangle,
- mem_word_get_bits, gx_default_map_cmyk_color,
- gx_default_strip_tile_rectangle, gx_no_strip_copy_rop);
+ gx_default_map_cmyk_color, gx_default_strip_tile_rectangle,
+ gx_no_strip_copy_rop, mem_word_get_bits_rectangle);
/* Fill a rectangle with a color. */
private int
diff --git a/gs/src/gdevm24.c b/gs/src/gdevm24.c
index b13475679..59fbe50e2 100644
--- a/gs/src/gdevm24.c
+++ b/gs/src/gdevm24.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1994, 1995, 1996, 1997 Aladdin Enterprises. All rights reserved.
+/* Copyright (C) 1994, 1995, 1996, 1997, 1998 Aladdin Enterprises. All rights reserved.
This file is part of Aladdin Ghostscript.
@@ -16,7 +16,7 @@
all copies.
*/
-/* gdevm24.c */
+/*Id: gdevm24.c */
/* 24-bit-per-pixel "memory" (stored bitmap) device */
#include "memory_.h"
#include "gx.h"
@@ -38,12 +38,13 @@ declare_mem_procs(mem_true24_copy_mono, mem_true24_copy_color, mem_true24_fill_r
private dev_proc_copy_alpha(mem_true24_copy_alpha);
/* The device descriptor. */
-const gx_device_memory far_data mem_true24_device =
+const gx_device_memory mem_true24_device =
mem_full_alpha_device("image24", 24, 0, mem_open,
gx_default_rgb_map_rgb_color, gx_default_rgb_map_color_rgb,
mem_true24_copy_mono, mem_true24_copy_color, mem_true24_fill_rectangle,
- mem_get_bits, gx_default_map_cmyk_color, mem_true24_copy_alpha,
- gx_default_strip_tile_rectangle, mem_true24_strip_copy_rop);
+ gx_default_map_cmyk_color, mem_true24_copy_alpha,
+ gx_default_strip_tile_rectangle, mem_true24_strip_copy_rop,
+ mem_get_bits_rectangle);
/* Convert x coordinate to byte offset in scan line. */
#undef x_to_byte
@@ -444,12 +445,12 @@ mem_true24_copy_alpha(gx_device * dev, const byte * base, int sourcex,
declare_mem_procs(mem24_word_copy_mono, mem24_word_copy_color, mem24_word_fill_rectangle);
/* Here is the device descriptor. */
-const gx_device_memory far_data mem_true24_word_device =
+const gx_device_memory mem_true24_word_device =
mem_full_device("image24w", 24, 0, mem_open,
gx_default_rgb_map_rgb_color, gx_default_rgb_map_color_rgb,
mem24_word_copy_mono, mem24_word_copy_color, mem24_word_fill_rectangle,
- mem_word_get_bits, gx_default_map_cmyk_color,
- gx_default_strip_tile_rectangle, gx_no_strip_copy_rop);
+ gx_default_map_cmyk_color, gx_default_strip_tile_rectangle,
+ gx_no_strip_copy_rop, mem_word_get_bits_rectangle);
/* Fill a rectangle with a color. */
private int
diff --git a/gs/src/gdevm32.c b/gs/src/gdevm32.c
index 29e331258..c38b8a5d6 100644
--- a/gs/src/gdevm32.c
+++ b/gs/src/gdevm32.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1994, 1995, 1996 Aladdin Enterprises. All rights reserved.
+/* Copyright (C) 1994, 1995, 1996, 1997, 1998 Aladdin Enterprises. All rights reserved.
This file is part of Aladdin Ghostscript.
@@ -16,7 +16,7 @@
all copies.
*/
-/* gdevm32.c */
+/*Id: gdevm32.c */
/* 32-bit-per-pixel "memory" (stored bitmap) device */
#include "memory_.h"
#include "gx.h"
@@ -33,12 +33,12 @@
declare_mem_procs(mem_true32_copy_mono, mem_true32_copy_color, mem_true32_fill_rectangle);
/* The device descriptor. */
-const gx_device_memory far_data mem_true32_device =
+const gx_device_memory mem_true32_device =
mem_full_device("image32", 24, 8, mem_open,
gx_default_map_rgb_color, gx_default_map_color_rgb,
mem_true32_copy_mono, mem_true32_copy_color, mem_true32_fill_rectangle,
- mem_get_bits, gx_default_cmyk_map_cmyk_color,
- gx_default_strip_tile_rectangle, gx_no_strip_copy_rop);
+ gx_default_cmyk_map_cmyk_color, gx_default_strip_tile_rectangle,
+ gx_no_strip_copy_rop, mem_get_bits_rectangle);
/* Convert x coordinate to byte offset in scan line. */
#undef x_to_byte
@@ -190,12 +190,12 @@ mem_true32_copy_color(gx_device * dev,
declare_mem_procs(mem32_word_copy_mono, mem32_word_copy_color, mem32_word_fill_rectangle);
/* Here is the device descriptor. */
-const gx_device_memory far_data mem_true32_word_device =
+const gx_device_memory mem_true32_word_device =
mem_full_device("image32w", 24, 8, mem_open,
gx_default_map_rgb_color, gx_default_map_color_rgb,
mem32_word_copy_mono, mem32_word_copy_color, mem32_word_fill_rectangle,
- mem_word_get_bits, gx_default_cmyk_map_cmyk_color,
- gx_default_strip_tile_rectangle, gx_no_strip_copy_rop);
+ gx_default_cmyk_map_cmyk_color, gx_default_strip_tile_rectangle,
+ gx_no_strip_copy_rop, mem_word_get_bits_rectangle);
/* Fill a rectangle with a color. */
private int
diff --git a/gs/src/gdevm4.c b/gs/src/gdevm4.c
index 9c876ecd4..ced9df966 100644
--- a/gs/src/gdevm4.c
+++ b/gs/src/gdevm4.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992, 1995, 1996 Aladdin Enterprises. All rights reserved.
+/* Copyright (C) 1992, 1995, 1996, 1997, 1998 Aladdin Enterprises. All rights reserved.
This file is part of Aladdin Ghostscript.
@@ -16,7 +16,7 @@
all copies.
*/
-/* gdevm4.c */
+/*Id: gdevm4.c */
/* 4-bit-per-pixel "memory" (stored bitmap) device */
#include "memory_.h"
#include "gx.h"
@@ -37,7 +37,7 @@ extern dev_proc_strip_copy_rop(mem_gray_strip_copy_rop);
declare_mem_procs(mem_mapped4_copy_mono, mem_mapped4_copy_color, mem_mapped4_fill_rectangle);
/* The device descriptor. */
-const gx_device_memory far_data mem_mapped4_device =
+const gx_device_memory mem_mapped4_device =
mem_device("image4", 4, 0,
mem_mapped_map_rgb_color, mem_mapped_map_color_rgb,
mem_mapped4_copy_mono, mem_mapped4_copy_color, mem_mapped4_fill_rectangle,
@@ -74,42 +74,129 @@ mem_mapped4_copy_mono(gx_device * dev,
int x, int y, int w, int h, gx_color_index zero, gx_color_index one)
{
const byte *line;
- int first_bit;
- byte first_mask, b0, b1;
declare_scan_ptr(dest);
+ byte invert, bb;
+
fit_copy(dev, base, sourcex, sraster, id, x, y, w, h);
setup_rect(dest);
line = base + (sourcex >> 3);
- first_bit = 0x80 >> (sourcex & 7);
- first_mask = (x & 1 ? 0xf : 0xf0);
- b0 = ((byte) zero << 4) + (byte) zero;
- b1 = ((byte) one << 4) + (byte) one;
- while (h-- > 0) {
- register byte *pptr = (byte *) dest;
+ /* Divide into opaque and masked cases. */
+ if (one == gx_no_color_index) {
+ if (zero == gx_no_color_index)
+ return 0; /* nothing to do */
+ invert = 0xff;
+ bb = ((byte) zero << 4) | (byte) zero;
+ } else if (zero == gx_no_color_index) {
+ invert = 0;
+ bb = ((byte) one << 4) | (byte) one;
+ } else {
+ /* Opaque case. */
+ bits32 oz = (zero << 4) | zero;
+ int shift = ~(sourcex ^ x) & 1;
+
+ /* Set oz = o.o.o.z.z.o.z.z. */
+ oz = (((((((((one << 4) | one) << 4) | one) << 8) | oz) << 4) | one)
+ << 8) | oz;
+ do {
+ register byte *dptr = (byte *) dest;
+ const byte *sptr = line;
+ register uint sbyte = *sptr++;
+ register int sbit = ~sourcex & 7;
+ int count = w;
+
+ /*
+ * If the first source bit corresponds to an odd X in the
+ * destination, process it now.
+ */
+ if (x & 1) {
+ *dptr = (*dptr & 0xf0) |
+ ((sbyte >> sbit) & 1 ? one : zero);
+ --count; /* may now be 0 */
+ if (--sbit < 0)
+ sbit = 7, sbyte = *sptr++;
+ ++dptr;
+ }
+ /*
+ * Now we know the next destination X is even. We want to
+ * process 2 source bits at a time from now on, so set things up
+ * properly depending on whether the next source X (bit) is even
+ * or odd. In both even and odd cases, the active source bits
+ * are in bits 8..1 of sbyte.
+ */
+ sbyte <<= shift;
+ sbit += shift - 1;
+ /*
+ * Now bit # sbit+1 is the most significant unprocessed bit
+ * in sbyte. -1 <= sbit <= 7; sbit is odd.
+ * Note that if sbit = -1, all of sbyte has been processed.
+ *
+ * Continue processing pairs of bits in the first source byte.
+ */
+ while (count >= 2 && sbit >= 0) {
+ *dptr++ = (byte) (oz >> (((sbyte >> sbit) << 3) & 24));
+ sbit -= 2, count -= 2;
+ }
+ /*
+ * Now sbit = -1 iff we have processed the entire first source
+ * byte.
+ *
+ * Process full source bytes.
+ */
+ while (count >= 8) {
+ sbyte = (sbyte << 8) | (*sptr++ << shift);
+ dptr[0] = (byte) (oz >> ((sbyte >> 4) & 24));
+ dptr[1] = (byte) (oz >> ((sbyte >> 2) & 24));
+ dptr[2] = (byte) (oz >> (sbyte & 24));
+ dptr[3] = (byte) (oz >> ((sbyte << 2) & 24));
+ dptr += 4;
+ count -= 8;
+ }
+ if (!count)
+ continue;
+ /*
+ * Process pairs of bits in the final source byte. Note that
+ * if sbit > 0, this is still the first source byte (the
+ * full-byte loop wasn't executed).
+ */
+ if (sbit < 0) {
+ sbyte = (sbyte << 8) | (*sptr << shift);
+ sbit = 7;
+ }
+ while (count >= 2) {
+ *dptr++ = (byte) (oz >> (((sbyte >> sbit) << 3) & 24));
+ sbit -= 2, count -= 2;
+ }
+ /*
+ * If the final source bit corresponds to an even X value,
+ * process it now.
+ */
+ if (count) {
+ *dptr = (*dptr & 0x0f) |
+ (((sbyte >> sbit) & 2 ? one : zero) << 4);
+ }
+ } while ((line += sraster, inc_ptr(dest, draster), --h) > 0);
+ return 0;
+ }
+ /* Masked case. */
+ do {
+ register byte *dptr = (byte *) dest;
const byte *sptr = line;
- register int sbyte = *sptr++;
- register int bit = first_bit;
- register byte mask = first_mask;
+ register int sbyte = *sptr++ ^ invert;
+ register int sbit = 0x80 >> (sourcex & 7);
+ register byte mask = (x & 1 ? 0x0f : 0xf0);
int count = w;
do {
- if (sbyte & bit) {
- if (one != gx_no_color_index)
- *pptr = (*pptr & ~mask) + (b1 & mask);
- } else {
- if (zero != gx_no_color_index)
- *pptr = (*pptr & ~mask) + (b0 & mask);
- }
- if ((bit >>= 1) == 0)
- bit = 0x80, sbyte = *sptr++;
- if ((mask = ~mask) == 0xf0)
- pptr++;
- }
- while (--count > 0);
+ if (sbyte & sbit)
+ *dptr = (*dptr & ~mask) | (bb & mask);
+ if ((sbit >>= 1) == 0)
+ sbit = 0x80, sbyte = *sptr++ ^ invert;
+ dptr += (mask = ~mask) >> 7;
+ } while (--count > 0);
line += sraster;
inc_ptr(dest, draster);
- }
+ } while (--h > 0);
return 0;
}
@@ -144,12 +231,12 @@ mem_mapped4_copy_color(gx_device * dev,
declare_mem_procs(mem4_word_copy_mono, mem4_word_copy_color, mem4_word_fill_rectangle);
/* Here is the device descriptor. */
-const gx_device_memory far_data mem_mapped4_word_device =
+const gx_device_memory mem_mapped4_word_device =
mem_full_device("image4w", 4, 0, mem_open,
mem_mapped_map_rgb_color, mem_mapped_map_color_rgb,
mem4_word_copy_mono, mem4_word_copy_color, mem4_word_fill_rectangle,
- mem_word_get_bits, gx_default_map_cmyk_color,
- gx_default_strip_tile_rectangle, gx_no_strip_copy_rop);
+ gx_default_map_cmyk_color, gx_default_strip_tile_rectangle,
+ gx_no_strip_copy_rop, mem_word_get_bits_rectangle);
/* Fill a rectangle with a color. */
private int
diff --git a/gs/src/gdevm8.c b/gs/src/gdevm8.c
index cad84430d..28513bed4 100644
--- a/gs/src/gdevm8.c
+++ b/gs/src/gdevm8.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1994, 1995, 1996 Aladdin Enterprises. All rights reserved.
+/* Copyright (C) 1994, 1995, 1996, 1997, 1998 Aladdin Enterprises. All rights reserved.
This file is part of Aladdin Ghostscript.
@@ -16,7 +16,7 @@
all copies.
*/
-/* gdevm8.c */
+/*Id: gdevm8.c */
/* 8-bit-per-pixel "memory" (stored bitmap) device */
#include "memory_.h"
#include "gx.h"
@@ -38,7 +38,7 @@ extern dev_proc_strip_copy_rop(mem_gray8_rgb24_strip_copy_rop); /* in gdevmrop.
declare_mem_procs(mem_mapped8_copy_mono, mem_mapped8_copy_color, mem_mapped8_fill_rectangle);
/* The device descriptor. */
-const gx_device_memory far_data mem_mapped8_device =
+const gx_device_memory mem_mapped8_device =
mem_device("image8", 8, 0,
mem_mapped_map_rgb_color, mem_mapped_map_color_rgb,
mem_mapped8_copy_mono, mem_mapped8_copy_color, mem_mapped8_fill_rectangle,
@@ -167,12 +167,12 @@ mem_mapped8_copy_color(gx_device * dev,
declare_mem_procs(mem8_word_copy_mono, mem8_word_copy_color, mem8_word_fill_rectangle);
/* Here is the device descriptor. */
-const gx_device_memory far_data mem_mapped8_word_device =
+const gx_device_memory mem_mapped8_word_device =
mem_full_device("image8w", 8, 0, mem_open,
mem_mapped_map_rgb_color, mem_mapped_map_color_rgb,
mem8_word_copy_mono, mem8_word_copy_color, mem8_word_fill_rectangle,
- mem_word_get_bits, gx_default_map_cmyk_color,
- gx_default_strip_tile_rectangle, gx_no_strip_copy_rop);
+ gx_default_map_cmyk_color, gx_default_strip_tile_rectangle,
+ gx_no_strip_copy_rop, mem_word_get_bits_rectangle);
/* Fill a rectangle with a color. */
private int
diff --git a/gs/src/gdevmem.c b/gs/src/gdevmem.c
index ebfbb3244..efb8a007a 100644
--- a/gs/src/gdevmem.c
+++ b/gs/src/gdevmem.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1989, 1995 Aladdin Enterprises. All rights reserved.
+/* Copyright (C) 1989, 1995, 1997, 1998 Aladdin Enterprises. All rights reserved.
This file is part of Aladdin Ghostscript.
@@ -16,13 +16,16 @@
all copies.
*/
-/* gdevmem.c */
+/*Id: gdevmem.c */
/* Generic "memory" (stored bitmap) device */
#include "memory_.h"
#include "gx.h"
#include "gserrors.h"
+#include "gsrect.h"
#include "gsstruct.h"
+#include "gxarith.h"
#include "gxdevice.h"
+#include "gxgetbit.h"
#include "gxdevmem.h" /* semi-public definitions */
#include "gdevmem.h" /* private definitions */
@@ -34,7 +37,7 @@ public_st_device_memory();
private
ENUM_PTRS_BEGIN(device_memory_enum_ptrs)
{
- return (*st_device_forward.enum_ptrs) (vptr, sizeof(gx_device_forward), index - 2, pep);
+ return ENUM_USING(st_device_forward, vptr, sizeof(gx_device_forward), index - 2);
}
case 0:
ENUM_RETURN((mptr->foreign_bits ? NULL : (void *)mptr->base));
@@ -55,7 +58,7 @@ private RELOC_PTRS_BEGIN(device_memory_reloc_ptrs)
mptr->line_ptrs = (byte **) ((byte *) mptr->line_ptrs - reloc);
}
RELOC_CONST_STRING_PTR(gx_device_memory, palette);
- (*st_device_forward.reloc_ptrs) (vptr, sizeof(gx_device_forward), gcst);
+ RELOC_USING(st_device_forward, vptr, sizeof(gx_device_forward));
}
RELOC_PTRS_END
#undef mptr
@@ -124,19 +127,20 @@ void
gs_make_mem_device(gx_device_memory * dev, const gx_device_memory * mdproto,
gs_memory_t * mem, int page_device, gx_device * target)
{
- *dev = *mdproto;
- dev->memory = mem;
+ gx_device_init((gx_device *) dev, (const gx_device *)mdproto,
+ mem, true);
dev->stype = &st_device_memory;
switch (page_device) {
case -1:
- dev->std_procs.get_page_device = gx_default_get_page_device;
+ set_dev_proc(dev, get_page_device, gx_default_get_page_device);
break;
case 1:
- dev->std_procs.get_page_device = gx_page_device_get_page_device;
+ set_dev_proc(dev, get_page_device, gx_page_device_get_page_device);
break;
}
dev->target = target;
- if (target != 0) { /* Forward the color mapping operations to the target. */
+ if (target != 0) {
+ /* Forward the color mapping operations to the target. */
gx_device_forward_color_procs((gx_device_forward *) dev);
}
if (dev->color_info.depth == 1)
@@ -154,9 +158,10 @@ gs_make_mem_mono_device(gx_device_memory * dev, gs_memory_t * mem,
{
*dev = mem_mono_device;
dev->memory = mem;
- dev->std_procs.get_page_device = gx_default_get_page_device;
+ set_dev_proc(dev, get_page_device, gx_default_get_page_device);
mdev->target = target;
gdev_mem_mono_set_inverted(dev, true);
+ rc_init(dev, mem, 0);
}
@@ -292,30 +297,58 @@ mem_close(gx_device * dev)
return 0;
}
-/* Copy a scan line to a client. */
+/* Copy bits to a client. */
#undef chunk
#define chunk byte
int
-mem_get_bits(gx_device * dev, int y, byte * str, byte ** actual_data)
+mem_get_bits_rectangle(gx_device * dev, const gs_int_rect * prect,
+ gs_get_bits_params_t * params, gs_int_rect ** unread)
{
- byte *src;
-
- if (y < 0 || y >= dev->height)
+ gs_get_bits_options_t options = params->options;
+ int x = prect->p.x, w = prect->q.x - x, y = prect->p.y, h = prect->q.y - y;
+
+ if (options == 0) {
+ params->options =
+ (GB_ALIGN_STANDARD | GB_ALIGN_ANY) |
+ (GB_RETURN_COPY | GB_RETURN_POINTER) |
+ (GB_OFFSET_0 | GB_OFFSET_SPECIFIED | GB_OFFSET_ANY) |
+ (GB_RASTER_STANDARD | GB_RASTER_SPECIFIED | GB_RASTER_ANY) |
+ GB_PACKING_CHUNKY | GB_COLORS_NATIVE | GB_ALPHA_NONE;
return_error(gs_error_rangecheck);
- src = scan_line_base(mdev, y);
- if (actual_data == 0)
- memcpy(str, src, gx_device_raster(dev, 0));
- else
- *actual_data = src;
- return 0;
+ }
+ if ((w <= 0) | (h <= 0)) {
+ if ((w | h) < 0)
+ return_error(gs_error_rangecheck);
+ return 0;
+ }
+ if (x < 0 || w > dev->width - x ||
+ y < 0 || h > dev->height - y
+ )
+ return_error(gs_error_rangecheck);
+ {
+ byte *base = scan_line_base(mdev, y);
+ int code = gx_get_bits_return_pointer(dev, x, h, params,
+ GB_COLORS_NATIVE | GB_PACKING_CHUNKY |
+ GB_ALPHA_NONE, base);
+
+ if (code >= 0)
+ return code;
+ return gx_get_bits_copy(dev, x, w, h, params,
+ GB_COLORS_NATIVE | GB_PACKING_CHUNKY |
+ GB_ALPHA_NONE, base,
+ gx_device_raster(dev, true));
+ }
}
#if !arch_is_big_endian
-/* Swap byte order in a rectangular subset of a bitmap. */
-/* If store = true, assume the rectangle will be overwritten, */
-/* so don't swap any bytes where it doesn't matter. */
-/* The caller has already done a fit_fill or fit_copy. */
+/*
+ * Swap byte order in a rectangular subset of a bitmap. If store = true,
+ * assume the rectangle will be overwritten, so don't swap any bytes where
+ * it doesn't matter. The caller has already done a fit_fill or fit_copy.
+ * Note that the coordinates are specified in bits, not in terms of the
+ * actual device depth.
+ */
void
mem_swap_byte_rect(byte * base, uint raster, int x, int w, int h, bool store)
{
@@ -354,24 +387,36 @@ mem_swap_byte_rect(byte * base, uint raster, int x, int w, int h, bool store)
}
}
-/* Copy a word-oriented scan line to the client, swapping bytes as needed. */
+/* Copy a word-oriented rectangle to the client, swapping bytes as needed. */
int
-mem_word_get_bits(gx_device * dev, int y, byte * str, byte ** actual_data)
+mem_word_get_bits_rectangle(gx_device * dev, const gs_int_rect * prect,
+ gs_get_bits_params_t * params, gs_int_rect ** unread)
{
byte *src;
- uint raster = gx_device_raster(dev, 0); /* only doing 1 scan line */
-
- if (y < 0 || y >= dev->height)
- return_error(gs_error_rangecheck);
+ uint dev_raster = gx_device_raster(dev, 1);
+ int x = prect->p.x;
+ int w = prect->q.x - x;
+ int y = prect->p.y;
+ int h = prect->q.y - y;
+ int bit_x, bit_w;
+ int code;
+
+ fit_fill_xywh(dev, x, y, w, h);
+ if (w <= 0 || h <= 0) {
+ /*
+ * It's easiest to just keep going with an empty rectangle.
+ * We pass the original rectangle to mem_get_bits_rectangle,
+ * so unread will be filled in correctly.
+ */
+ x = y = w = h = 0;
+ }
+ bit_x = x * dev->color_info.depth;
+ bit_w = w * dev->color_info.depth;
src = scan_line_base(mdev, y);
- /* We use raster << 3 rather than dev->width so that */
- /* the right thing will happen if depth > 1. */
- mem_swap_byte_rect(src, raster, 0, raster << 3, 1, false);
- memcpy(str, src, raster);
- if (actual_data != 0)
- *actual_data = str;
- mem_swap_byte_rect(src, raster, 0, raster << 3, 1, false);
- return 0;
+ mem_swap_byte_rect(src, dev_raster, bit_x, bit_w, h, false);
+ code = mem_get_bits_rectangle(dev, prect, params, unread);
+ mem_swap_byte_rect(src, dev_raster, bit_x, bit_w, h, false);
+ return code;
}
#endif /* !arch_is_big_endian */
diff --git a/gs/src/gdevmem.h b/gs/src/gdevmem.h
index 0b99fbffd..d02d5c51e 100644
--- a/gs/src/gdevmem.h
+++ b/gs/src/gdevmem.h
@@ -1,25 +1,28 @@
-/* Copyright (C) 1991, 1995, 1996, 1997 Aladdin Enterprises. All rights reserved.
-
- This file is part of Aladdin Ghostscript.
-
- Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
- or distributor accepts any responsibility for the consequences of using it,
- or for whether it serves any particular purpose or works at all, unless he
- or she says so in writing. Refer to the Aladdin Ghostscript Free Public
- License (the "License") for full details.
-
- Every copy of Aladdin Ghostscript must include a copy of the License,
- normally in a plain ASCII text file named PUBLIC. The License grants you
- the right to copy, modify and redistribute Aladdin Ghostscript, but only
- under certain conditions described in the License. Among other things, the
- License requires that the copyright notice and this notice be preserved on
- all copies.
-*/
-
-/* gdevmem.h */
+/* Copyright (C) 1991, 1995, 1996, 1997, 1998 Aladdin Enterprises. All rights reserved.
+
+ This file is part of Aladdin Ghostscript.
+
+ Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
+ or distributor accepts any responsibility for the consequences of using it,
+ or for whether it serves any particular purpose or works at all, unless he
+ or she says so in writing. Refer to the Aladdin Ghostscript Free Public
+ License (the "License") for full details.
+
+ Every copy of Aladdin Ghostscript must include a copy of the License,
+ normally in a plain ASCII text file named PUBLIC. The License grants you
+ the right to copy, modify and redistribute Aladdin Ghostscript, but only
+ under certain conditions described in the License. Among other things, the
+ License requires that the copyright notice and this notice be preserved on
+ all copies.
+ */
+
+/*Id: gdevmem.h */
/* Private definitions for memory devices. */
-#include "gsbitops.h"
+#ifndef gdevmem_INCLUDED
+# define gdevmem_INCLUDED
+
+#include "gxbitops.h"
/*
The representation for a "memory" device is simply a
@@ -48,7 +51,7 @@
Even though the scan lines are stored contiguously, we store a table
of their base addresses, because indexing into it is faster than
the multiplication that would otherwise be needed.
-*/
+ */
/*
* Macros for scan line access.
@@ -57,14 +60,17 @@
* each procedure that uses the scanning macros should #define
* (not typedef) chunk as either uint or byte.
*/
-#define declare_scan_ptr(ptr) declare_scan_ptr_as(ptr, chunk *)
-#define declare_scan_ptr_as(ptr,ptype)\
- register ptype ptr; uint draster
-#define setup_rect(ptr) setup_rect_as(ptr, chunk *)
-#define setup_rect_as(ptr,ptype)\
+#define declare_scan_ptr(ptr)\
+ DECLARE_SCAN_PTR_VARS(ptr, chunk *, draster)
+#define DECLARE_SCAN_PTR_VARS(ptr, ptype, draster)\
+ register ptype ptr;\
+ uint draster
+#define setup_rect(ptr)\
+ SETUP_RECT_VARS(ptr, chunk *, draster)
+#define SETUP_RECT_VARS(ptr, ptype, draster)\
draster = mdev->raster;\
ptr = (ptype)(scan_line_base(mdev, y) +\
- (x_to_byte(x) & -chunk_align_bytes))
+ (x_to_byte(x) & -chunk_align_bytes))
/* ------ Generic macros ------ */
@@ -81,12 +87,12 @@ dev_proc_close_device(mem_close);
/* The following are used for all except planar or word-oriented devices. */
dev_proc_open_device(mem_open);
-dev_proc_get_bits(mem_get_bits);
+dev_proc_get_bits_rectangle(mem_get_bits_rectangle);
/* The following are for word-oriented devices. */
#if arch_is_big_endian
-# define mem_word_get_bits mem_get_bits
+# define mem_word_get_bits_rectangle mem_get_bits_rectangle
#else
-dev_proc_get_bits(mem_word_get_bits);
+dev_proc_get_bits_rectangle(mem_word_get_bits_rectangle);
#endif
/* The following are used for the non-true-color devices. */
dev_proc_map_rgb_color(mem_mapped_map_rgb_color);
@@ -96,7 +102,7 @@ dev_proc_map_color_rgb(mem_mapped_map_color_rgb);
* Macro for generating the device descriptor.
* Various compilers have problems with the obvious definition
* for max_value, namely:
- * (depth >= 8 ? 255 : (1 << depth) - 1)
+ * (depth >= 8 ? 255 : (1 << depth) - 1)
* I tried changing (1 << depth) to (1 << (depth & 15)) to forestall bogus
* error messages about invalid shift counts, but the H-P compiler chokes
* on this. Since the only values of depth we ever plan to support are
@@ -107,7 +113,7 @@ dev_proc_map_color_rgb(mem_mapped_map_color_rgb);
#define max_value_rgb(rgb_depth, gray_depth)\
(rgb_depth >= 8 ? 255 : rgb_depth == 4 ? 15 : rgb_depth == 2 ? 3 :\
rgb_depth == 1 ? 1 : (1 << gray_depth) - 1)
-#define mem_full_alpha_device(name, rgb_depth, gray_depth, open, map_rgb_color, map_color_rgb, copy_mono, copy_color, fill_rectangle, get_bits, map_cmyk_color, copy_alpha, strip_tile_rectangle, strip_copy_rop)\
+#define mem_full_alpha_device(name, rgb_depth, gray_depth, open, map_rgb_color, map_color_rgb, copy_mono, copy_color, fill_rectangle, map_cmyk_color, copy_alpha, strip_tile_rectangle, strip_copy_rop, get_bits_rectangle)\
{ std_device_dci_body(gx_device_memory, 0, name,\
0, 0, 72, 72,\
(rgb_depth ? 3 : 0) + (gray_depth ? 1 : 0), /* num_components */\
@@ -129,7 +135,7 @@ dev_proc_map_color_rgb(mem_mapped_map_color_rgb);
copy_mono, /* differs */\
copy_color, /* differs */\
gx_default_draw_line,\
- get_bits, /* differs */\
+ gx_default_get_bits,\
gx_default_get_params,\
gx_default_put_params,\
map_cmyk_color, /* differs */\
@@ -154,21 +160,27 @@ dev_proc_map_color_rgb(mem_mapped_map_color_rgb);
strip_tile_rectangle, /* differs */\
strip_copy_rop, /* differs */\
gx_default_get_clipping_box,\
- gx_default_get_hardware_params\
+ gx_default_begin_typed_image,\
+ get_bits_rectangle, /* differs */\
+ gx_default_map_color_rgb_alpha,\
+ gx_default_create_compositor,\
+ gx_default_get_hardware_params,\
+ gx_default_text_begin\
},\
0, /* target */\
mem_device_init_private /* see gxdevmem.h */\
}
-#define mem_full_device(name, rgb_depth, gray_depth, open, map_rgb_color, map_color_rgb, copy_mono, copy_color, fill_rectangle, get_bits, map_cmyk_color, strip_tile_rectangle, strip_copy_rop)\
+#define mem_full_device(name, rgb_depth, gray_depth, open, map_rgb_color, map_color_rgb, copy_mono, copy_color, fill_rectangle, map_cmyk_color, strip_tile_rectangle, strip_copy_rop, get_bits_rectangle)\
mem_full_alpha_device(name, rgb_depth, gray_depth, open, map_rgb_color,\
map_color_rgb, copy_mono, copy_color, fill_rectangle,\
- get_bits, map_cmyk_color, gx_default_copy_alpha,\
- strip_tile_rectangle, strip_copy_rop)
+ map_cmyk_color, gx_default_copy_alpha,\
+ strip_tile_rectangle, strip_copy_rop,\
+ get_bits_rectangle)
#define mem_device(name, rgb_depth, gray_depth, map_rgb_color, map_color_rgb, copy_mono, copy_color, fill_rectangle, strip_copy_rop)\
mem_full_device(name, rgb_depth, gray_depth, mem_open, map_rgb_color,\
map_color_rgb, copy_mono, copy_color, fill_rectangle,\
- mem_get_bits, gx_default_map_cmyk_color,\
- gx_default_strip_tile_rectangle, strip_copy_rop)
+ gx_default_map_cmyk_color, gx_default_strip_tile_rectangle,\
+ strip_copy_rop, mem_get_bits_rectangle)
/* Swap a rectangle of bytes, for converting between word- and */
/* byte-oriented representation. */
@@ -186,14 +198,15 @@ void mem_swap_byte_rect(P6(byte *, uint, int, int, int, bool));
/* ------ Implementations ------ */
-extern const gx_device_memory far_data mem_mono_device;
-extern const gx_device_memory far_data mem_mapped2_device;
-extern const gx_device_memory far_data mem_mapped4_device;
-extern const gx_device_memory far_data mem_mapped8_device;
-extern const gx_device_memory far_data mem_true16_device;
-extern const gx_device_memory far_data mem_true24_device;
-extern const gx_device_memory far_data mem_true32_device;
-extern const gx_device_memory far_data mem_planar_device;
+extern const gx_device_memory mem_mono_device;
+extern const gx_device_memory mem_mapped2_device;
+extern const gx_device_memory mem_mapped4_device;
+extern const gx_device_memory mem_mapped8_device;
+extern const gx_device_memory mem_true16_device;
+extern const gx_device_memory mem_true24_device;
+extern const gx_device_memory mem_true32_device;
+extern const gx_device_memory mem_planar_device;
+
#if arch_is_big_endian
# define mem_mono_word_device mem_mono_device
# define mem_mapped2_word_device mem_mapped2_device
@@ -202,13 +215,16 @@ extern const gx_device_memory far_data mem_planar_device;
# define mem_true24_word_device mem_true24_device
# define mem_true32_word_device mem_true32_device
#else
-extern const gx_device_memory far_data mem_mono_word_device;
-extern const gx_device_memory far_data mem_mapped2_word_device;
-extern const gx_device_memory far_data mem_mapped4_word_device;
-extern const gx_device_memory far_data mem_mapped8_word_device;
-extern const gx_device_memory far_data mem_true24_word_device;
-extern const gx_device_memory far_data mem_true32_word_device;
+extern const gx_device_memory mem_mono_word_device;
+extern const gx_device_memory mem_mapped2_word_device;
+extern const gx_device_memory mem_mapped4_word_device;
+extern const gx_device_memory mem_mapped8_word_device;
+extern const gx_device_memory mem_true24_word_device;
+extern const gx_device_memory mem_true32_word_device;
+
#endif
/* Provide standard palettes for 1-bit devices. */
extern const gs_const_string mem_mono_b_w_palette; /* black=1, white=0 */
extern const gs_const_string mem_mono_w_b_palette; /* black=0, white=1 */
+
+#endif /* gdevmem_INCLUDED */
diff --git a/gs/src/gdevmgr.c b/gs/src/gdevmgr.c
index f941c9ebe..42845a691 100644
--- a/gs/src/gdevmgr.c
+++ b/gs/src/gdevmgr.c
@@ -1,22 +1,22 @@
-/* Copyright (C) 1992, 1993, 1994 Aladdin Enterprises. All rights reserved.
-
- This file is part of Aladdin Ghostscript.
-
- Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
- or distributor accepts any responsibility for the consequences of using it,
- or for whether it serves any particular purpose or works at all, unless he
- or she says so in writing. Refer to the Aladdin Ghostscript Free Public
- License (the "License") for full details.
-
- Every copy of Aladdin Ghostscript must include a copy of the License,
- normally in a plain ASCII text file named PUBLIC. The License grants you
- the right to copy, modify and redistribute Aladdin Ghostscript, but only
- under certain conditions described in the License. Among other things, the
- License requires that the copyright notice and this notice be preserved on
- all copies.
- */
-
-/* gdevmgr.c */
+/* Copyright (C) 1992, 1993, 1994, 1997 Aladdin Enterprises. All rights reserved.
+
+ This file is part of Aladdin Ghostscript.
+
+ Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
+ or distributor accepts any responsibility for the consequences of using it,
+ or for whether it serves any particular purpose or works at all, unless he
+ or she says so in writing. Refer to the Aladdin Ghostscript Free Public
+ License (the "License") for full details.
+
+ Every copy of Aladdin Ghostscript must include a copy of the License,
+ normally in a plain ASCII text file named PUBLIC. The License grants you
+ the right to copy, modify and redistribute Aladdin Ghostscript, but only
+ under certain conditions described in the License. Among other things, the
+ License requires that the copyright notice and this notice be preserved on
+ all copies.
+*/
+
+/*Id: gdevmgr.c */
/* MGR device driver */
#include "gdevprn.h"
#include "gdevpccm.h"
@@ -24,10 +24,10 @@
/* Structure for MGR devices, which extend the generic printer device. */
struct gx_device_mgr_s {
- gx_device_common;
- gx_prn_device_common;
- /* Add MGR specific variables */
- int mgr_depth;
+ gx_device_common;
+ gx_prn_device_common;
+ /* Add MGR specific variables */
+ int mgr_depth;
};
typedef struct gx_device_mgr_s gx_device_mgr;
@@ -57,7 +57,7 @@ private void swap_bwords(P2(unsigned char *, int));
/* For all mgr variants we do some extra things at opening time. */
/* private dev_proc_open_device(gdev_mgr_open); */
-#define gdev_mgr_open gdev_prn_open /* no we don't! */
+#define gdev_mgr_open gdev_prn_open /* no we don't! */
/* And of course we need our own print-page routines. */
private dev_proc_print_page(mgr_print_page);
@@ -66,83 +66,80 @@ private dev_proc_print_page(cmgrN_print_page);
/* The device procedures */
private gx_device_procs mgr_procs =
-prn_procs(gdev_mgr_open, gdev_prn_output_page, gdev_prn_close);
+ prn_procs(gdev_mgr_open, gdev_prn_output_page, gdev_prn_close);
private gx_device_procs mgrN_procs =
-prn_color_procs(gdev_mgr_open, gdev_prn_output_page, gdev_prn_close,
- gx_default_gray_map_rgb_color, gx_default_gray_map_color_rgb);
+ prn_color_procs(gdev_mgr_open, gdev_prn_output_page, gdev_prn_close,
+ gx_default_gray_map_rgb_color, gx_default_gray_map_color_rgb);
private gx_device_procs cmgr4_procs =
-prn_color_procs(gdev_mgr_open, gdev_prn_output_page, gdev_prn_close,
- pc_4bit_map_rgb_color, pc_4bit_map_color_rgb);
+ prn_color_procs(gdev_mgr_open, gdev_prn_output_page, gdev_prn_close,
+ pc_4bit_map_rgb_color, pc_4bit_map_color_rgb);
private gx_device_procs cmgr8_procs =
-prn_color_procs(gdev_mgr_open, gdev_prn_output_page, gdev_prn_close,
- mgr_8bit_map_rgb_color, mgr_8bit_map_color_rgb);
+ prn_color_procs(gdev_mgr_open, gdev_prn_output_page, gdev_prn_close,
+ mgr_8bit_map_rgb_color, mgr_8bit_map_color_rgb);
/* The device descriptors themselves */
gx_device_mgr far_data gs_mgrmono_device =
-mgr_prn_device(mgr_procs, "mgrmono", 1, 1, 1, 1, 0, 2, 0, mgr_print_page);
+ mgr_prn_device( mgr_procs, "mgrmono", 1, 1, 1, 1, 0, 2, 0, mgr_print_page);
gx_device_mgr far_data gs_mgrgray2_device =
-mgr_prn_device(mgrN_procs, "mgrgray2", 1, 8, 2, 255, 0, 4, 0, mgrN_print_page);
+ mgr_prn_device(mgrN_procs, "mgrgray2",1, 8, 2, 255, 0, 4, 0, mgrN_print_page);
gx_device_mgr far_data gs_mgrgray4_device =
-mgr_prn_device(mgrN_procs, "mgrgray4", 1, 8, 4, 255, 0, 16, 0, mgrN_print_page);
+ mgr_prn_device(mgrN_procs, "mgrgray4",1, 8, 4, 255, 0,16, 0, mgrN_print_page);
gx_device_mgr far_data gs_mgrgray8_device =
-mgr_prn_device(mgrN_procs, "mgrgray8", 1, 8, 8, 255, 0, 0, 0, mgrN_print_page);
+ mgr_prn_device(mgrN_procs, "mgrgray8",1, 8, 8, 255, 0, 0, 0, mgrN_print_page);
gx_device_mgr far_data gs_mgr4_device =
-mgr_prn_device(cmgr4_procs, "mgr4", 3, 8, 4, 1, 1, 4, 3, cmgrN_print_page);
+ mgr_prn_device(cmgr4_procs, "mgr4", 3, 8, 4, 1, 1, 4, 3, cmgrN_print_page);
gx_device_mgr far_data gs_mgr8_device =
-mgr_prn_device(cmgr8_procs, "mgr8", 3, 8, 8, 255, 255, 6, 5, cmgrN_print_page);
+ mgr_prn_device(cmgr8_procs, "mgr8", 3, 8, 8, 255, 255, 6, 5, cmgrN_print_page);
/* ------ Internal routines ------ */
/* Define a "cursor" that keeps track of where we are in the page. */
typedef struct mgr_cursor_s {
- gx_device_mgr *dev;
- int bpp; /* bits per pixel */
- uint line_size; /* bytes per scan line */
- byte *data; /* output row buffer */
- int lnum; /* row within page */
+ gx_device_mgr *dev;
+ int bpp; /* bits per pixel */
+ uint line_size; /* bytes per scan line */
+ byte *data; /* output row buffer */
+ int lnum; /* row within page */
} mgr_cursor;
/* Begin an MGR output page. */
/* Write the header information and initialize the cursor. */
private int
-mgr_begin_page(gx_device_mgr * bdev, FILE * pstream, mgr_cursor _ss * pcur)
-{
- struct b_header head;
- uint line_size =
- gdev_prn_raster((gx_device_printer *) bdev) + 3;
- byte *data = (byte *) gs_malloc(line_size, 1, "mgr_begin_page");
-
- if (data == 0)
- return_error(gs_error_VMerror);
-
- /* Write the header */
- B_PUTHDR8(&head, bdev->width, bdev->height, bdev->mgr_depth);
- fprintf(pstream, "");
- if (fwrite(&head, 1, sizeof(head), pstream) < sizeof(head))
- return_error(gs_error_ioerror);
- fflush(pstream);
-
- /* Initialize the cursor. */
- pcur->dev = bdev;
- pcur->bpp = bdev->color_info.depth;
- pcur->line_size = line_size;
- pcur->data = data;
- pcur->lnum = 0;
- return 0;
+mgr_begin_page(gx_device_mgr *bdev, FILE *pstream, mgr_cursor _ss *pcur)
+{ struct b_header head;
+ uint line_size =
+ gdev_prn_raster((gx_device_printer *)bdev) + 3;
+ byte *data = (byte *)gs_malloc(line_size, 1, "mgr_begin_page");
+ if ( data == 0 )
+ return_error(gs_error_VMerror);
+
+ /* Write the header */
+ B_PUTHDR8(&head, bdev->width, bdev->height, bdev->mgr_depth);
+ fprintf(pstream, "");
+ if ( fwrite(&head, 1, sizeof(head), pstream) < sizeof(head) )
+ return_error(gs_error_ioerror);
+ fflush(pstream);
+
+ /* Initialize the cursor. */
+ pcur->dev = bdev;
+ pcur->bpp = bdev->color_info.depth;
+ pcur->line_size = line_size;
+ pcur->data = data;
+ pcur->lnum = 0;
+ return 0;
}
/* Advance to the next row. Return 0 if more, 1 if done. */
private int
-mgr_next_row(mgr_cursor _ss * pcur)
-{
- if (pcur->lnum >= pcur->dev->height) {
- gs_free((char *)pcur->data, pcur->line_size, 1,
- "mgr_next_row(done)");
- return 1;
- }
- gdev_prn_copy_scan_lines((gx_device_printer *) pcur->dev,
- pcur->lnum++, pcur->data, pcur->line_size);
- return 0;
+mgr_next_row(mgr_cursor _ss *pcur)
+{ if ( pcur->lnum >= pcur->dev->height )
+ { gs_free((char *)pcur->data, pcur->line_size, 1,
+ "mgr_next_row(done)");
+ return 1;
+ }
+ gdev_prn_copy_scan_lines((gx_device_printer *)pcur->dev,
+ pcur->lnum++, pcur->data, pcur->line_size);
+ return 0;
}
/* ------ Individual page printing routines ------ */
@@ -151,224 +148,213 @@ mgr_next_row(mgr_cursor _ss * pcur)
/* Print a monochrome page. */
private int
-mgr_print_page(gx_device_printer * pdev, FILE * pstream)
-{
- mgr_cursor cur;
- int mgr_wide;
- int code = mgr_begin_page(bdev, pstream, &cur);
-
- if (code < 0)
- return code;
-
- mgr_wide = bdev->width;
- if (mgr_wide & 7)
- mgr_wide += 8 - (mgr_wide & 7);
-
- while (!(code = mgr_next_row(&cur))) {
- if (fwrite(cur.data, sizeof(char), mgr_wide / 8, pstream) <
- mgr_wide / 8)
- return_error(gs_error_ioerror);
- }
- return (code < 0 ? code : 0);
+mgr_print_page(gx_device_printer *pdev, FILE *pstream)
+{ mgr_cursor cur;
+ int mgr_wide;
+ int code = mgr_begin_page(bdev, pstream, &cur);
+ if ( code < 0 ) return code;
+
+ mgr_wide = bdev->width;
+ if (mgr_wide & 7)
+ mgr_wide += 8 - (mgr_wide & 7);
+
+ while ( !(code = mgr_next_row(&cur)) )
+ { if ( fwrite(cur.data, sizeof(char), mgr_wide / 8, pstream) <
+ mgr_wide / 8)
+ return_error(gs_error_ioerror);
+ }
+ return (code < 0 ? code : 0);
}
/* Print a gray-mapped page. */
static unsigned char bgreytable[16], bgreybacktable[16];
-static unsigned char bgrey256table[256], bgrey256backtable[256];
-
-/* private */
-int
-mgrN_print_page(gx_device_printer * pdev, FILE * pstream)
-{
- mgr_cursor cur;
- int i = 0, j, k, mgr_wide;
- uint mgr_line_size;
- byte *bp, *data = NULL, *dp;
-
- int code = mgr_begin_page(bdev, pstream, &cur);
-
- if (code < 0)
- return code;
-
- mgr_wide = bdev->width;
- if (bdev->mgr_depth == 2 && mgr_wide & 3)
- mgr_wide += 4 - (mgr_wide & 3);
- if (bdev->mgr_depth == 4 && mgr_wide & 1)
- mgr_wide++;
- mgr_line_size = mgr_wide / (8 / bdev->mgr_depth);
-
- if (bdev->mgr_depth == 4)
- for (i = 0; i < 16; i++) {
- bgreytable[i] = mgrlut[LUT_BGREY][RGB_RED][i];
- bgreybacktable[bgreytable[i]] = i;
- }
- if (bdev->mgr_depth == 8) {
- for (i = 0; i < 16; i++) {
- bgrey256table[i] = mgrlut[LUT_BGREY][RGB_RED][i] << 4;
- bgrey256backtable[bgrey256table[i]] = i;
- }
- for (i = 16, j = 0; i < 256; i++) {
- for (k = 0; k < 16; k++)
- if (j == mgrlut[LUT_BGREY][RGB_RED][k] << 4) {
- j++;
- break;
- }
- bgrey256table[i] = j;
- bgrey256backtable[j++] = i;
- }
- }
- if (bdev->mgr_depth != 8)
- data = (byte *) gs_malloc(mgr_line_size, 1, "mgrN_print_page");
-
- while (!(code = mgr_next_row(&cur))) {
- switch (bdev->mgr_depth) {
- case 2:
- for (i = 0, dp = data, bp = cur.data; i < mgr_line_size; i++) {
- *dp = *(bp++) & 0xc0;
- *dp |= (*(bp++) & 0xc0) >> 2;
- *dp |= (*(bp++) & 0xc0) >> 4;
- *(dp++) |= (*(bp++) & 0xc0) >> 6;
- }
- if (fwrite(data, sizeof(byte), mgr_line_size, pstream) < mgr_line_size)
- return_error(gs_error_ioerror);
- break;
-
- case 4:
- for (i = 0, dp = data, bp = cur.data; i < mgr_line_size; i++) {
- *dp = bgreybacktable[*(bp++) >> 4] << 4;
- *(dp++) |= bgreybacktable[*(bp++) >> 4];
- }
- if (fwrite(data, sizeof(byte), mgr_line_size, pstream) < mgr_line_size)
- return_error(gs_error_ioerror);
- break;
-
- case 8:
- for (i = 0, bp = cur.data; i < mgr_line_size; i++, bp++)
- *bp = bgrey256backtable[*bp];
- if (fwrite(cur.data, sizeof(cur.data[0]), mgr_line_size, pstream)
- < mgr_line_size)
- return_error(gs_error_ioerror);
- break;
- }
- }
- if (bdev->mgr_depth != 8)
- gs_free((char *)data, mgr_line_size, 1, "mgrN_print_page(done)");
-
- if (bdev->mgr_depth == 2) {
- for (i = 0; i < 4; i++) {
- clut[i].colnum = i;
- clut[i].red = clut[i].green = clut[i].blue = clut2mgr(i, 2);
- }
- }
- if (bdev->mgr_depth == 4) {
- for (i = 0; i < 16; i++) {
- clut[i].colnum = i;
- clut[i].red = clut[i].green = clut[i].blue = clut2mgr(bgreytable[i], 4);
- }
- }
- if (bdev->mgr_depth == 8) {
- for (i = 0; i < 256; i++) {
- clut[i].colnum = i;
- clut[i].red = clut[i].green = clut[i].blue = clut2mgr(bgrey256table[i], 8);
+static unsigned char bgrey256table[256], bgrey256backtable[256];
+private int
+mgrN_print_page(gx_device_printer *pdev, FILE *pstream)
+{ mgr_cursor cur;
+ int i = 0, j, k, mgr_wide;
+ uint mgr_line_size;
+ byte *bp, *data = NULL, *dp;
+
+ int code = mgr_begin_page(bdev, pstream, &cur);
+ if ( code < 0 ) return code;
+
+ mgr_wide = bdev->width;
+ if ( bdev->mgr_depth == 2 && mgr_wide & 3 )
+ mgr_wide += 4 - (mgr_wide & 3);
+ if ( bdev->mgr_depth == 4 && mgr_wide & 1 )
+ mgr_wide++;
+ mgr_line_size = mgr_wide / ( 8 / bdev->mgr_depth );
+
+ if ( bdev->mgr_depth == 4 )
+ for ( i = 0; i < 16; i++ ) {
+ bgreytable[i] = mgrlut[LUT_BGREY][RGB_RED][i];
+ bgreybacktable[bgreytable[i]] = i;
+ }
+
+ if ( bdev->mgr_depth == 8 ) {
+ for ( i = 0; i < 16; i++ ) {
+ bgrey256table[i] = mgrlut[LUT_BGREY][RGB_RED][i] << 4;
+ bgrey256backtable[bgrey256table[i]] = i;
+ }
+ for ( i = 16,j = 0; i < 256; i++ ) {
+ for ( k = 0; k < 16; k++ )
+ if ( j == mgrlut[LUT_BGREY][RGB_RED][k] << 4 ) {
+ j++;
+ break;
+ }
+ bgrey256table[i] = j;
+ bgrey256backtable[j++] = i;
+ }
}
- }
-#if !arch_is_big_endian
- swap_bwords((unsigned char *)clut, sizeof(struct nclut) * i);
+ if ( bdev->mgr_depth != 8 )
+ data = (byte *)gs_malloc(mgr_line_size, 1, "mgrN_print_page");
+
+ while ( !(code = mgr_next_row(&cur)) )
+ {
+ switch (bdev->mgr_depth) {
+ case 2:
+ for (i = 0,dp = data,bp = cur.data; i < mgr_line_size; i++) {
+ *dp = *(bp++) & 0xc0;
+ *dp |= (*(bp++) & 0xc0) >> 2;
+ *dp |= (*(bp++) & 0xc0) >> 4;
+ *(dp++) |= (*(bp++) & 0xc0) >> 6;
+ }
+ if ( fwrite(data, sizeof(byte), mgr_line_size, pstream) < mgr_line_size )
+ return_error(gs_error_ioerror);
+ break;
+
+ case 4:
+ for (i = 0,dp = data, bp = cur.data; i < mgr_line_size; i++) {
+ *dp = bgreybacktable[*(bp++) >> 4] << 4;
+ *(dp++) |= bgreybacktable[*(bp++) >> 4];
+ }
+ if ( fwrite(data, sizeof(byte), mgr_line_size, pstream) < mgr_line_size )
+ return_error(gs_error_ioerror);
+ break;
+
+ case 8:
+ for (i = 0,bp = cur.data; i < mgr_line_size; i++, bp++)
+ *bp = bgrey256backtable[*bp];
+ if ( fwrite(cur.data, sizeof(cur.data[0]), mgr_line_size, pstream)
+ < mgr_line_size )
+ return_error(gs_error_ioerror);
+ break;
+ }
+ }
+ if (bdev->mgr_depth != 8)
+ gs_free((char *)data, mgr_line_size, 1, "mgrN_print_page(done)");
+
+ if (bdev->mgr_depth == 2) {
+ for (i = 0; i < 4; i++) {
+ clut[i].colnum = i;
+ clut[i].red = clut[i].green = clut[i].blue = clut2mgr(i, 2);
+ }
+ }
+ if (bdev->mgr_depth == 4) {
+ for (i = 0; i < 16; i++) {
+ clut[i].colnum = i;
+ clut[i].red = clut[i].green = clut[i].blue = clut2mgr(bgreytable[i], 4);
+ }
+ }
+ if (bdev->mgr_depth == 8) {
+ for (i = 0; i < 256; i++) {
+ clut[i].colnum = i;
+ clut[i].red = clut[i].green = clut[i].blue = clut2mgr(bgrey256table[i], 8);
+ }
+ }
+#if !arch_is_big_endian
+ swap_bwords( (unsigned char *) clut, sizeof( struct nclut ) * i );
#endif
- if (fwrite(&clut, sizeof(struct nclut), i, pstream) < i)
- return_error(gs_error_ioerror);
-
- return (code < 0 ? code : 0);
+ if ( fwrite(&clut, sizeof(struct nclut), i, pstream) < i )
+ return_error(gs_error_ioerror);
+ return (code < 0 ? code : 0);
}
/* Print a color page. */
private int
-cmgrN_print_page(gx_device_printer * pdev, FILE * pstream)
-{
- mgr_cursor cur;
- int i = 0, j, mgr_wide, r, g, b, colors8 = 0;
- uint mgr_line_size;
- byte *bp, *data, *dp;
- ushort prgb[3];
- unsigned char table[256], backtable[256];
-
- int code = mgr_begin_page(bdev, pstream, &cur);
-
- if (code < 0)
- return code;
-
- mgr_wide = bdev->width;
- if (bdev->mgr_depth == 4 && mgr_wide & 1)
- mgr_wide++;
- mgr_line_size = mgr_wide / (8 / bdev->mgr_depth);
- data = (byte *) gs_malloc(mgr_line_size, 1, "cmgrN_print_page");
-
- if (bdev->mgr_depth == 8) {
- memset(table, 0, sizeof(table));
- for (r = 0; r <= 6; r++)
- for (g = 0; g <= 6; g++)
- for (b = 0; b <= 6; b++)
- if (r == g && g == b)
- table[r + (256 - 7)] = 1;
- else
- table[(r << 5) + (g << 2) + (b >> 1)] = 1;
- for (i = j = 0; i < sizeof(table); i++)
- if (table[i] == 1) {
- backtable[i] = j;
- table[j++] = i;
- }
- colors8 = j;
- }
- while (!(code = mgr_next_row(&cur))) {
- switch (bdev->mgr_depth) {
- case 4:
- for (i = 0, dp = data, bp = cur.data; i < mgr_line_size; i++) {
- *dp = *(bp++) << 4;
- *(dp++) |= *(bp++) & 0x0f;
+cmgrN_print_page(gx_device_printer *pdev, FILE *pstream)
+{ mgr_cursor cur;
+ int i = 0, j, mgr_wide, r, g, b, colors8 = 0;
+ uint mgr_line_size;
+ byte *bp, *data, *dp;
+ ushort prgb[3];
+ unsigned char table[256], backtable[256];
+
+ int code = mgr_begin_page(bdev, pstream, &cur);
+ if ( code < 0 ) return code;
+
+ mgr_wide = bdev->width;
+ if (bdev->mgr_depth == 4 && mgr_wide & 1)
+ mgr_wide++;
+ mgr_line_size = mgr_wide / (8 / bdev->mgr_depth);
+ data = (byte *)gs_malloc(mgr_line_size, 1, "cmgrN_print_page");
+
+ if ( bdev->mgr_depth == 8 ) {
+ memset( table, 0, sizeof(table) );
+ for ( r = 0; r <= 6; r++ )
+ for ( g = 0; g <= 6; g++ )
+ for ( b = 0; b <= 6; b++ )
+ if ( r == g && g == b )
+ table[ r + (256-7) ] = 1;
+ else
+ table[ (r << 5) + (g << 2) + (b >> 1) ] = 1;
+ for ( i = j = 0; i < sizeof(table); i++ )
+ if ( table[i] == 1 ) {
+ backtable[i] = j;
+ table[j++] = i;
}
- if (fwrite(data, sizeof(byte), mgr_line_size, pstream) < mgr_line_size)
- return_error(gs_error_ioerror);
- break;
-
- case 8:
- for (i = 0, bp = cur.data; i < mgr_line_size; i++, bp++)
- *bp = backtable[*bp] + MGR_RESERVEDCOLORS;
- if (fwrite(cur.data, sizeof(cur.data[0]), mgr_line_size, pstream) < mgr_line_size)
- return_error(gs_error_ioerror);
- break;
+ colors8 = j;
}
- }
- gs_free((char *)data, mgr_line_size, 1, "cmgrN_print_page(done)");
-
- if (bdev->mgr_depth == 4) {
- for (i = 0; i < 16; i++) {
- pc_4bit_map_color_rgb((gx_device *) 0, (gx_color_index) i, prgb);
- clut[i].colnum = i;
- clut[i].red = clut2mgr(prgb[0], 16);
- clut[i].green = clut2mgr(prgb[1], 16);
- clut[i].blue = clut2mgr(prgb[2], 16);
- }
- }
- if (bdev->mgr_depth == 8) {
- for (i = 0; i < colors8; i++) {
- mgr_8bit_map_color_rgb((gx_device *) 0, (gx_color_index)
- table[i], prgb);
- clut[i].colnum = MGR_RESERVEDCOLORS + i;
- clut[i].red = clut2mgr(prgb[0], 16);
- clut[i].green = clut2mgr(prgb[1], 16);
- clut[i].blue = clut2mgr(prgb[2], 16);
- }
- }
+ while ( !(code = mgr_next_row(&cur)) )
+ {
+ switch (bdev->mgr_depth) {
+ case 4:
+ for (i = 0,dp = data, bp = cur.data; i < mgr_line_size; i++) {
+ *dp = *(bp++) << 4;
+ *(dp++) |= *(bp++) & 0x0f;
+ }
+ if ( fwrite(data, sizeof(byte), mgr_line_size, pstream) < mgr_line_size )
+ return_error(gs_error_ioerror);
+ break;
+
+ case 8:
+ for (i = 0,bp = cur.data; i < mgr_line_size; i++, bp++)
+ *bp = backtable[*bp] + MGR_RESERVEDCOLORS;
+ if ( fwrite(cur.data, sizeof(cur.data[0]), mgr_line_size, pstream) < mgr_line_size )
+ return_error(gs_error_ioerror);
+ break;
+ }
+ }
+ gs_free((char *)data, mgr_line_size, 1, "cmgrN_print_page(done)");
+
+ if (bdev->mgr_depth == 4) {
+ for (i = 0; i < 16; i++) {
+ pc_4bit_map_color_rgb((gx_device *)0, (gx_color_index) i, prgb);
+ clut[i].colnum = i;
+ clut[i].red = clut2mgr(prgb[0], 16);
+ clut[i].green = clut2mgr(prgb[1], 16);
+ clut[i].blue = clut2mgr(prgb[2], 16);
+ }
+ }
+ if (bdev->mgr_depth == 8) {
+ for (i = 0; i < colors8; i++) {
+ mgr_8bit_map_color_rgb((gx_device *)0, (gx_color_index)
+ table[i], prgb);
+ clut[i].colnum = MGR_RESERVEDCOLORS + i;
+ clut[i].red = clut2mgr(prgb[0], 16);
+ clut[i].green = clut2mgr(prgb[1], 16);
+ clut[i].blue = clut2mgr(prgb[2], 16);
+ }
+ }
#if !arch_is_big_endian
- swap_bwords((unsigned char *)clut, sizeof(struct nclut) * i);
-
-#endif
- if (fwrite(&clut, sizeof(struct nclut), i, pstream) < i)
- return_error(gs_error_ioerror);
-
- return (code < 0 ? code : 0);
+ swap_bwords( (unsigned char *) clut, sizeof( struct nclut ) * i );
+#endif
+ if ( fwrite(&clut, sizeof(struct nclut), i, pstream) < i )
+ return_error(gs_error_ioerror);
+ return (code < 0 ? code : 0);
}
@@ -380,54 +366,51 @@ cmgrN_print_page(gx_device_printer * pdev, FILE * pstream)
/* (1/6, 1/2, and 5/6), instead of the obvious 8x8x4. */
gx_color_index
-mgr_8bit_map_rgb_color(gx_device * dev, gx_color_value r, gx_color_value g,
- gx_color_value b)
-{
- uint rv = r / (gx_max_color_value / 7 + 1);
- uint gv = g / (gx_max_color_value / 7 + 1);
- uint bv = b / (gx_max_color_value / 7 + 1);
-
- return (gx_color_index)
- (rv == gv && gv == bv ? rv + (256 - 7) :
- (rv << 5) + (gv << 2) + (bv >> 1));
+mgr_8bit_map_rgb_color(gx_device *dev, gx_color_value r, gx_color_value g,
+ gx_color_value b)
+{ uint rv = r / (gx_max_color_value / 7 + 1);
+ uint gv = g / (gx_max_color_value / 7 + 1);
+ uint bv = b / (gx_max_color_value / 7 + 1);
+ return (gx_color_index)
+ (rv == gv && gv == bv ? rv + (256-7) :
+ (rv << 5) + (gv << 2) + (bv >> 1));
}
int
-mgr_8bit_map_color_rgb(gx_device * dev, gx_color_index color,
- gx_color_value prgb[3])
-{
- static const gx_color_value ramp[8] =
- {0, gx_max_color_value / 6, gx_max_color_value / 3,
- gx_max_color_value / 2, 2 * (gx_max_color_value / 3),
- 5 * (gx_max_color_value / 6), gx_max_color_value,
- /* The 8th entry is not actually ever used, */
- /* except to fill out the palette. */
- gx_max_color_value
- };
-
+mgr_8bit_map_color_rgb(gx_device *dev, gx_color_index color,
+ gx_color_value prgb[3])
+{ static const gx_color_value ramp[8] =
+ { 0, gx_max_color_value / 6, gx_max_color_value / 3,
+ gx_max_color_value / 2, 2 * (gx_max_color_value / 3),
+ 5 * (gx_max_color_value / 6), gx_max_color_value,
+ /* The 8th entry is not actually ever used, */
+ /* except to fill out the palette. */
+ gx_max_color_value
+ };
#define icolor (uint)color
- if (icolor >= 256 - 7) {
- prgb[0] = prgb[1] = prgb[2] = ramp[icolor - (256 - 7)];
- } else {
- prgb[0] = ramp[(icolor >> 5) & 7];
- prgb[1] = ramp[(icolor >> 2) & 7];
- prgb[2] = ramp[(icolor & 3) << 1];
- }
+ if ( icolor >= 256-7 )
+ { prgb[0] = prgb[1] = prgb[2] = ramp[icolor - (256-7)];
+ }
+ else
+ { prgb[0] = ramp[(icolor >> 5) & 7];
+ prgb[1] = ramp[(icolor >> 2) & 7];
+ prgb[2] = ramp[(icolor & 3) << 1];
+ }
#undef icolor
- return 0;
+ return 0;
}
/* convert the 8-bit look-up table into the standard MGR look-up table */
private unsigned int
clut2mgr(
- register int v, /* value in clut */
- register int bits /* number of bits in clut */
+ register int v, /* value in clut */
+ register int bits /* number of bits in clut */
)
{
- register unsigned int i;
+ register unsigned int i;
- i = (unsigned int)0xffffffff / ((1 << bits) - 1);
- return ((v * i) / 0x10000);
+ i = (unsigned int) 0xffffffff / ((1<<bits)-1);
+ return((v*i)/0x10000);
}
@@ -437,13 +420,13 @@ clut2mgr(
private void
swap_bwords(register unsigned char *p, int n)
{
- register unsigned char c;
-
- n /= 2;
-
- for (; n > 0; n--, p += 2) {
- c = p[0];
- p[0] = p[1];
- p[1] = c;
- }
+ register unsigned char c;
+
+ n /= 2;
+
+ for (; n > 0; n--, p += 2) {
+ c = p[0];
+ p[0] = p[1];
+ p[1] = c;
+ }
}
diff --git a/gs/src/gdevmgr.h b/gs/src/gdevmgr.h
index bcd1d7c15..c333d409f 100644
--- a/gs/src/gdevmgr.h
+++ b/gs/src/gdevmgr.h
@@ -16,9 +16,12 @@
all copies.
*/
-/* gdevmgr.h */
+/*Id: gdevmgr.h */
/* Common header file for MGR devices */
+#ifndef gdevmgr_INCLUDED
+# define gdevmgr_INCLUDED
+
#define MGR_RESERVEDCOLORS 16
/* Color mapping routines for 8-bit color (with a fixed palette). */
@@ -114,3 +117,5 @@ static char mgrlut[LUT][RGB][LUTENTRIES] = {
{ { BCT_RED }, { BCT_GREEN }, { BCT_BLUE } },
{ { USER_RED }, { USER_GREEN }, { USER_BLUE } }
};
+
+#endif /* gdevmgr_INCLUDED */
diff --git a/gs/src/gdevmiff.c b/gs/src/gdevmiff.c
index 77989dd3b..8762b8ef3 100644
--- a/gs/src/gdevmiff.c
+++ b/gs/src/gdevmiff.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996 Aladdin Enterprises. All rights reserved.
+/* Copyright (C) 1996, 1997 Aladdin Enterprises. All rights reserved.
This file is part of Aladdin Ghostscript.
@@ -16,7 +16,7 @@
all copies.
*/
-/* gdevmiff.c */
+/*Id: gdevmiff.c */
/* MIFF file format driver */
#include "gdevprn.h"
@@ -30,7 +30,7 @@
private dev_proc_print_page(miff24_print_page);
-private gx_device_procs miff24_procs =
+private const gx_device_procs miff24_procs =
prn_color_procs(gdev_prn_open, gdev_prn_output_page, gdev_prn_close,
gx_default_rgb_map_rgb_color, gx_default_rgb_map_color_rgb);
gx_device_printer far_data gs_miff24_device =
diff --git a/gs/src/gdevmpla.c b/gs/src/gdevmpla.c
index 535fa62c5..798c97bb1 100644
--- a/gs/src/gdevmpla.c
+++ b/gs/src/gdevmpla.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993, 1994 Aladdin Enterprises. All rights reserved.
+/* Copyright (C) 1993, 1994, 1997, 1998 Aladdin Enterprises. All rights reserved.
This file is part of Aladdin Ghostscript.
@@ -16,7 +16,7 @@
all copies.
*/
-/* gdevmpla.c */
+/*Id: gdevmpla.c */
/* Any-depth planar "memory" (stored bitmap) devices */
#include "memory_.h"
#include "gx.h"
@@ -42,13 +42,13 @@ declare_mem_procs(mem_planar_copy_mono, mem_planar_copy_color, mem_planar_fill_r
/* The default instance has depth = 1, but clients may set this */
/* to other values before opening the device. */
private dev_proc_open_device(mem_planar_open);
-private dev_proc_get_bits(mem_planar_get_bits);
-const gx_device_memory far_data mem_planar_device =
+private dev_proc_get_bits_rectangle(mem_planar_get_bits_rectangle);
+const gx_device_memory mem_planar_device =
mem_full_device("image(planar)", 0, 1, mem_planar_open,
mem_planar_map_rgb_color, mem_planar_map_color_rgb,
mem_planar_copy_mono, mem_planar_copy_color, mem_planar_fill_rectangle,
- mem_planar_get_bits, gx_default_map_cmyk_color,
- gx_default_strip_tile_rectangle, gx_no_strip_copy_rop);
+ gx_default_map_cmyk_color, gx_default_strip_tile_rectangle,
+ gx_no_strip_copy_rop, mem_planar_get_bits_rectangle);
/* Open a planar memory device. */
private int
@@ -184,7 +184,8 @@ mem_planar_copy_color(gx_device * dev,
/* Copy bits back from a planar memory device. */
/****** NOT IMPLEMENTED YET ******/
private int
-mem_planar_get_bits(gx_device * dev, int y, byte * str, byte ** actual_data)
+mem_planar_get_bits_rectangle(gx_device * dev, const gs_int_rect * prect,
+ gs_get_bits_params_t * params, gs_int_rect ** unread)
{
return_error(-1);
}
diff --git a/gs/src/gdevmrop.c b/gs/src/gdevmrop.c
index ccdbcdc1a..d2f984cc8 100644
--- a/gs/src/gdevmrop.c
+++ b/gs/src/gdevmrop.c
@@ -38,14 +38,6 @@
* The 16- and 32-bit cases aren't implemented.
***************** ****************/
-/*
- * Note that aside from the use of dlprintxxx and the 3 extra elements in
- * the device procedure vector, this file is usable with Ghostscript 5.1x.
- */
-
-/* Forward references */
-private gs_rop3_t gs_transparent_rop(P1(gs_logical_operation_t lop));
-
#define chunk byte
/* Calculate the X offset for a given Y value, */
@@ -54,62 +46,6 @@ private gs_rop3_t gs_transparent_rop(P1(gs_logical_operation_t lop));
((textures)->shift == 0 ? (px) :\
(px) + (ty) / (textures)->rep_height * (textures)->rep_shift)
-/* ---------------- Initialization ---------------- */
-
-void
-gs_roplib_init(gs_memory_t * mem)
-{ /* Replace the default and forwarding copy_rop procedures. */
- gx_default_copy_rop_proc = gx_real_default_copy_rop;
- gx_forward_copy_rop_proc = gx_forward_copy_rop;
- gx_default_strip_copy_rop_proc = gx_real_default_strip_copy_rop;
- gx_forward_strip_copy_rop_proc = gx_forward_strip_copy_rop;
-}
-
-/* ---------------- Debugging aids ---------------- */
-
-#ifdef DEBUG
-
-private void
-trace_copy_rop(const char *cname, gx_device * dev,
- const byte * sdata, int sourcex, uint sraster, gx_bitmap_id id,
- const gx_color_index * scolors,
- const gx_strip_bitmap * textures, const gx_color_index * tcolors,
- int x, int y, int width, int height,
- int phase_x, int phase_y, gs_logical_operation_t lop)
-{
- dlprintf4("%s: dev=0x%lx(%s) depth=%d\n",
- cname, (ulong) dev, dev->dname, dev->color_info.depth);
- dlprintf4(" source data=0x%lx x=%d raster=%u id=%lu colors=",
- (ulong) sdata, sourcex, sraster, (ulong) id);
- if (scolors)
- dprintf2("(%lu,%lu);\n", scolors[0], scolors[1]);
- else
- dputs("none;\n");
- if (textures)
- dlprintf8(" textures=0x%lx size=%dx%d(%dx%d) raster=%u shift=%d(%d)",
- (ulong) textures, textures->size.x, textures->size.y,
- textures->rep_width, textures->rep_height,
- textures->raster, textures->shift, textures->rep_shift);
- else
- dlputs(" textures=none");
- if (tcolors)
- dprintf2(" colors=(%lu,%lu)\n", tcolors[0], tcolors[1]);
- else
- dputs(" colors=none\n");
- dlprintf7(" rect=(%d,%d),(%d,%d) phase=(%d,%d) op=0x%x\n",
- x, y, x + width, y + height, phase_x, phase_y,
- (uint) lop);
- if (gs_debug_c('B')) {
- if (sdata)
- debug_dump_bitmap(sdata, sraster, height, "source bits");
- if (textures && textures->data)
- debug_dump_bitmap(textures->data, textures->raster,
- textures->size.y, "textures bits");
- }
-}
-
-#endif
-
/* ---------------- Monobit RasterOp ---------------- */
int
@@ -398,7 +334,7 @@ mem_gray_strip_copy_rop(gx_device * dev,
(tcolors && (tcolors[0] != tcolors[1]))
) {
/* We can't fake it: do it the slow, painful way. */
- return gx_real_default_strip_copy_rop(dev,
+ return gx_default_strip_copy_rop(dev,
sdata, sourcex, sraster, id, scolors, textures, tcolors,
x, y, width, height, phase_x, phase_y, lop);
}
@@ -414,7 +350,8 @@ mem_gray_strip_copy_rop(gx_device * dev,
texture2.rep_shift <<= log2_depth;
real_texture = &texture2;
}
- if (tcolors) { /* For polybit textures with colors other than */
+ if (tcolors) {
+ /* For polybit textures with colors other than */
/* all 0s or all 1s, fabricate the data. */
if (tcolors[0] != 0 && tcolors[0] != max_pixel) {
real_tcolors = 0;
@@ -462,9 +399,9 @@ mem_gray8_rgb24_strip_copy_rop(gx_device * dev,
int bpp = depth >> 3; /* bytes per pixel, 1 or 3 */
gx_color_index all_ones = ((gx_color_index) 1 << depth) - 1;
gx_color_index strans =
- (lop & lop_S_transparent ? all_ones : gx_no_color_index);
+ (lop & lop_S_transparent ? all_ones : gx_no_color_index);
gx_color_index ttrans =
- (lop & lop_T_transparent ? all_ones : gx_no_color_index);
+ (lop & lop_T_transparent ? all_ones : gx_no_color_index);
/* Check for constant source. */
if (scolors != 0 && scolors[0] == scolors[1]) { /* Constant source */
@@ -485,19 +422,48 @@ mem_gray8_rgb24_strip_copy_rop(gx_device * dev,
rop = rop3_know_T_1(rop);
} else if (!rop3_uses_T(rop))
const_texture = 0; /* arbitrary */
-
- /*
- * If this is an 8-bit device but not gray-scale, we have to use
- * the slow algorithm that converts values to and from RGB.
- */
- if (bpp == 1 && gx_device_has_color(dev) && rop != rop3_D &&
- (rop | (lop & lop_S_transparent)) != rop3_S &&
- (rop | (lop & lop_T_transparent)) != rop3_T &&
- rop != rop3_0 && rop != rop3_1
- )
- return gx_real_default_strip_copy_rop(dev,
- sdata, sourcex, sraster, id, scolors, textures, tcolors,
- x, y, width, height, phase_x, phase_y, lop);
+ if (bpp == 1 && gx_device_has_color(dev)) {
+ /*
+ * This is an 8-bit device but not gray-scale. Except in a few
+ * simple cases, we have to use the slow algorithm that converts
+ * values to and from RGB.
+ */
+ gx_color_index bw_pixel;
+
+ switch (rop) {
+ case rop3_0:
+ bw_pixel = gx_device_black(dev);
+ goto bw;
+ case rop3_1:
+ bw_pixel = gx_device_white(dev);
+bw: switch (bw_pixel) {
+ case 0x00:
+ rop = rop3_0;
+ break;
+ case 0xff:
+ rop = rop3_1;
+ break;
+ default:
+ goto df;
+ }
+ break;
+ case rop3_D:
+ break;
+ case rop3_S:
+ if (lop & lop_S_transparent)
+ goto df;
+ break;
+ case rop3_T:
+ if (lop & lop_T_transparent)
+ goto df;
+ break;
+ default:
+df: return gx_default_strip_copy_rop(dev,
+ sdata, sourcex, sraster, id, scolors,
+ textures, tcolors, x, y, width, height,
+ phase_x, phase_y, lop);
+ }
+ }
/* Adjust coordinates to be in bounds. */
if (const_source == gx_no_color_index) {
fit_copy(dev, sdata, sourcex, sraster, id,
@@ -524,9 +490,9 @@ mem_gray8_rgb24_strip_copy_rop(gx_device * dev,
/* 8-bit */
#define cbit8(base, i, colors)\
(dbit(base, i) ? (byte)colors[1] : (byte)colors[0])
-#define rop_body_8()\
- if ( s_pixel == strans || /* So = 0, s_tr = 1 */\
- t_pixel == ttrans /* Po = 0, p_tr = 1 */\
+#define rop_body_8(s_pixel, t_pixel)\
+ if ( (s_pixel) == strans || /* So = 0, s_tr = 1 */\
+ (t_pixel) == ttrans /* Po = 0, p_tr = 1 */\
)\
continue;\
*dptr = (*rop_proc_table[rop])(*dptr, s_pixel, t_pixel)
@@ -539,9 +505,9 @@ mem_gray8_rgb24_strip_copy_rop(gx_device * dev,
(ptr)[2] = (byte)(pixel)
#define cbit24(base, i, colors)\
(dbit(base, i) ? colors[1] : colors[0])
-#define rop_body_24()\
- if ( s_pixel == strans || /* So = 0, s_tr = 1 */\
- t_pixel == ttrans /* Po = 0, p_tr = 1 */\
+#define rop_body_24(s_pixel, t_pixel)\
+ if ( (s_pixel) == strans || /* So = 0, s_tr = 1 */\
+ (t_pixel) == ttrans /* Po = 0, p_tr = 1 */\
)\
continue;\
{ gx_color_index d_pixel = get24(dptr);\
@@ -559,22 +525,14 @@ mem_gray8_rgb24_strip_copy_rop(gx_device * dev,
if (bpp == 1)
/**** 8-bit destination ****/
-#define s_pixel (byte)const_source
-#define t_pixel (byte)const_texture
for (; left > 0; ++dptr, --left) {
- rop_body_8();
+ rop_body_8((byte)const_source, (byte)const_texture);
}
-#undef s_pixel
-#undef t_pixel
else
/**** 24-bit destination ****/
-#define s_pixel const_source
-#define t_pixel const_texture
for (; left > 0; dptr += 3, --left) {
- rop_body_24();
+ rop_body_24(const_source, const_texture);
}
-#undef s_pixel
-#undef t_pixel
}
} else {
/**** Data source, const texture ****/
@@ -590,44 +548,36 @@ mem_gray8_rgb24_strip_copy_rop(gx_device * dev,
if (bpp == 1)
/**** 8-bit destination ****/
-#define t_pixel (byte)const_texture
for (; left > 0; ++dptr, ++sx, --left) {
byte s_pixel = cbit8(srow, sx, scolors);
- rop_body_8();
+ rop_body_8(s_pixel, (byte)const_texture);
}
-#undef t_pixel
else
/**** 24-bit destination ****/
-#define t_pixel const_texture
for (; left > 0; dptr += 3, ++sx, --left) {
bits32 s_pixel = cbit24(srow, sx, scolors);
- rop_body_24();
+ rop_body_24(s_pixel, const_texture);
}
-#undef t_pixel
} else if (bpp == 1) {
/**** 8-bit source & dest ****/
const byte *sptr = srow + sourcex;
-#define t_pixel (byte)const_texture
for (; left > 0; ++dptr, ++sptr, --left) {
byte s_pixel = *sptr;
- rop_body_8();
+ rop_body_8(s_pixel, (byte)const_texture);
}
-#undef t_pixel
} else {
/**** 24-bit source & dest ****/
const byte *sptr = srow + sourcex * 3;
-#define t_pixel const_texture
for (; left > 0; dptr += 3, sptr += 3, --left) {
bits32 s_pixel = get24(sptr);
- rop_body_24();
+ rop_body_24(s_pixel, const_texture);
}
-#undef t_pixel
}
}
}
@@ -652,42 +602,34 @@ mem_gray8_rgb24_strip_copy_rop(gx_device * dev,
/**** 1-bit texture ****/
if (bpp == 1)
/**** 8-bit dest ****/
-#define s_pixel (byte)const_source
for (; left > 0; ++dptr, ++tx, --left) {
byte t_pixel = cbit8(tptr, tx, tcolors);
- rop_body_8();
+ rop_body_8((byte)const_source, t_pixel);
}
-#undef s_pixel
else
/**** 24-bit dest ****/
-#define s_pixel const_source
for (; left > 0; dptr += 3, ++tx, --left) {
bits32 t_pixel = cbit24(tptr, tx, tcolors);
- rop_body_24();
+ rop_body_24(const_source, t_pixel);
}
-#undef s_pixel
} else if (bpp == 1) {
/**** 8-bit T & D ****/
tptr += tx;
-#define s_pixel (byte)const_source
for (; left > 0; ++dptr, ++tptr, --left) {
byte t_pixel = *tptr;
- rop_body_8();
+ rop_body_8((byte)const_source, t_pixel);
}
-#undef s_pixel
} else {
/**** 24-bit T & D ****/
tptr += tx * 3;
-#define s_pixel const_source
for (; left > 0; dptr += 3, tptr += 3, --left) {
bits32 t_pixel = get24(tptr);
- rop_body_24();
+ rop_body_24(const_source, t_pixel);
}
-#undef s_pixel
}
}
}
@@ -728,11 +670,11 @@ mem_gray8_rgb24_strip_copy_rop(gx_device * dev,
tptr += tx;
for (; left > 0; ++dptr, ++sptr, ++tptr, ++sx, ++tx, --left) {
byte s_pixel =
- (scolors ? cbit8(srow, sx, scolors) : *sptr);
+ (scolors ? cbit8(srow, sx, scolors) : *sptr);
byte t_pixel =
- (tcolors ? cbit8(tptr, tx, tcolors) : *tptr);
+ (tcolors ? cbit8(tptr, tx, tcolors) : *tptr);
- rop_body_8();
+ rop_body_8(s_pixel, t_pixel);
}
} else {
/**** 24-bit destination ****/
@@ -741,13 +683,13 @@ mem_gray8_rgb24_strip_copy_rop(gx_device * dev,
tptr += tx * 3;
for (; left > 0; dptr += 3, sptr += 3, tptr += 3, ++sx, ++tx, --left) {
bits32 s_pixel =
- (scolors ? cbit24(srow, sx, scolors) :
- get24(sptr));
+ (scolors ? cbit24(srow, sx, scolors) :
+ get24(sptr));
bits32 t_pixel =
- (tcolors ? cbit24(tptr, tx, tcolors) :
- get24(tptr));
+ (tcolors ? cbit24(tptr, tx, tcolors) :
+ get24(tptr));
- rop_body_24();
+ rop_body_24(s_pixel, t_pixel);
}
}
}
@@ -760,641 +702,3 @@ mem_gray8_rgb24_strip_copy_rop(gx_device * dev,
#undef cbit24
return 0;
}
-
-/* ---------------- Default copy_rop implementations ---------------- */
-
-/*
- * We do the conversion between packed and standard formats explicitly here,
- * because this code must be usable with 5.1x. If it weren't for that,
- * we would simply use get_bits_rectangle, which already has the ability
- * to convert between representations.
- */
-
-private void
-unpack_to_standard(gx_device * dev, byte * dest, const byte * src, int sourcex,
- int width, int depth, int src_depth)
-{
- dev_proc_map_color_rgb((*map)) = dev_proc(dev, map_color_rgb);
- byte *dp = dest;
- int bit_x = sourcex * src_depth;
- const byte *sp = src + (bit_x >> 3);
- uint mask = (1 << src_depth) - 1;
- int shift = (~bit_x & 7) + 1;
- int x;
-
- for (x = width; --x >= 0;) {
- gx_color_index pixel;
- gx_color_value rgb[3];
-
- if ((shift -= src_depth) < 0)
- shift += 8, ++sp;
- pixel = (*sp >> shift) & mask;
- (*map) (dev, pixel, rgb);
- *dp++ = gx_color_value_to_byte(rgb[0]);
- if (depth > 8) {
- *dp++ = gx_color_value_to_byte(rgb[1]);
- *dp++ = gx_color_value_to_byte(rgb[2]);
- }
- }
-}
-
-private void
-unpack_colors_to_standard(gx_device * dev, gx_color_index real_colors[2],
- const gx_color_index * colors, int depth)
-{
- int i;
-
- for (i = 0; i < 2; ++i) {
- gx_color_value rgb[3];
- gx_color_index pixel;
-
- (*dev_proc(dev, map_color_rgb)) (dev, colors[i], rgb);
- pixel = gx_color_value_to_byte(rgb[0]);
- if (depth > 8) {
- pixel = (pixel << 16) +
- (gx_color_value_to_byte(rgb[1]) << 8) +
- gx_color_value_to_byte(rgb[2]);
- }
- real_colors[i] = pixel;
- }
-}
-
-private gx_color_index
-map_rgb_to_color_via_cmyk(gx_device * dev, gx_color_value r,
- gx_color_value g, gx_color_value b)
-{
- gx_color_value c = gx_max_color_value - r;
- gx_color_value m = gx_max_color_value - g;
- gx_color_value y = gx_max_color_value - b;
- gx_color_value k = (c < m ? min(c, y) : min(m, y));
-
- return (*dev_proc(dev, map_cmyk_color)) (dev, c - k, m - k, y - k, k);
-}
-private void
-pack_from_standard(gx_device * dev, byte * dest, int destx, const byte * src,
- int width, int depth, int src_depth)
-{
- dev_proc_map_rgb_color((*map)) =
- (dev->color_info.num_components == 4 ?
- map_rgb_to_color_via_cmyk : dev_proc(dev, map_rgb_color));
- int bit_x = destx * depth;
- byte *dp = dest + (bit_x >> 3);
- int shift = (~bit_x & 7) + 1;
- byte buf = (shift == 8 ? 0 : *dp & (0xff00 >> shift));
- const byte *sp = src;
- int x;
-
- for (x = width; --x >= 0;) {
- byte vr, vg, vb;
- gx_color_value r, g, b;
- gx_color_index pixel;
- byte chop = 0x1;
-
- if ((shift -= depth) < 0)
- shift += 8, *dp++ = buf, buf = 0;
- vr = *sp++;
- if (src_depth > 8) {
- vg = *sp++;
- vb = *sp++;
- } else
- vb = vg = vr;
- /*
- * We have to map back to some pixel value, even if the color
- * isn't accurate.
- */
- for (;;) {
- r = gx_color_value_from_byte(vr);
- g = gx_color_value_from_byte(vg);
- b = gx_color_value_from_byte(vb);
- pixel = (*map) (dev, r, g, b);
- if (pixel != gx_no_color_index)
- break;
- /* Reduce the color accuracy and try again. */
- vr = (vr >= 0x80 ? vr | chop : vr & ~chop);
- vg = (vg >= 0x80 ? vg | chop : vg & ~chop);
- vb = (vb >= 0x80 ? vb | chop : vb & ~chop);
- chop <<= 1;
- }
- buf += (byte) (pixel << shift);
- }
- if (width > 0)
- *dp = (shift == 0 ? buf : buf + (*dp & ((1 << shift) - 1)));
-}
-
-int
-gx_real_default_strip_copy_rop(gx_device * dev,
- const byte * sdata, int sourcex, uint sraster, gx_bitmap_id id,
- const gx_color_index * scolors,
- const gx_strip_bitmap * textures, const gx_color_index * tcolors,
- int x, int y, int width, int height,
- int phase_x, int phase_y, gs_logical_operation_t lop)
-{
-/*
- * The default implementation uses get_bits to read out the
- * pixels, the memory device implementation to do the operation,
- * and copy_color to write the pixels back. Note that if the
- * device is already a memory device, we need to convert the
- * pixels to standard representation (8-bit gray or 24-bit RGB),
- * do the operation, and convert them back. This is very slow,
- * but we don't see a better way.
- */
- bool expand = dev->width - width < 32 && gs_device_is_memory(dev);
- int depth = dev->color_info.depth;
- int rop_depth = (!expand ? depth : gx_device_has_color(dev) ? 24 : 8);
- gs_memory_t *mem = (dev->memory ? dev->memory : &gs_memory_default);
- const gx_device_memory *mdproto = gdev_mem_device_for_bits(rop_depth);
- gx_device_memory mdev;
- uint draster = gx_device_raster(dev, true);
- bool uses_d = rop3_uses_D(gs_transparent_rop(lop));
- bool expand_s, expand_t;
- byte *row = 0;
- byte *dest_row = 0;
- byte *source_row = 0;
- byte *texture_row = 0;
- uint traster;
- gx_color_index source_colors[2];
- const gx_color_index *real_scolors = scolors;
- gx_color_index texture_colors[2];
- const gx_color_index *real_tcolors = tcolors;
- gx_strip_bitmap rop_texture;
- const gx_strip_bitmap *real_texture = textures;
- int code;
- int py;
-
-#ifdef DEBUG
- if (gs_debug_c('b'))
- trace_copy_rop("gx_default_strip_copy_rop",
- dev, sdata, sourcex, sraster,
- id, scolors, textures, tcolors,
- x, y, width, height, phase_x, phase_y, lop);
-#endif
- if (mdproto == 0)
- return_error(gs_error_rangecheck);
- if (sdata == 0) {
- fit_fill(dev, x, y, width, height);
- } else {
- fit_copy(dev, sdata, sourcex, sraster, id, x, y, width, height);
- }
- gs_make_mem_device(&mdev, mdproto, 0, -1, dev);
- mdev.width = width;
- mdev.height = 1;
- mdev.bitmap_memory = mem;
- if (expand) {
- if (rop_depth == 8) {
- /* Mark 8-bit standard device as gray-scale only. */
- mdev.color_info.num_components = 1;
- }
- } else
- mdev.color_info = dev->color_info;
- code = (*dev_proc(&mdev, open_device)) ((gx_device *) & mdev);
- if (code < 0)
- return code;
-
-#define ALLOC_BUF(buf, size, cname)\
- BEGIN\
- buf = gs_alloc_bytes(mem, size, cname);\
- if ( buf == 0 ) {\
- code = gs_note_error(gs_error_VMerror);\
- goto out;\
- }\
- END
-
- ALLOC_BUF(row, draster, "copy_rop row");
- if (expand) {
- /* We may need intermediate buffers for all 3 operands. */
- ALLOC_BUF(dest_row, bitmap_raster(dev->width * rop_depth),
- "copy_rop dest_row");
- expand_s = scolors == 0 && rop3_uses_S(gs_transparent_rop(lop));
- if (expand_s) {
- ALLOC_BUF(source_row, bitmap_raster(width * rop_depth),
- "copy_rop source_row");
- }
- if (scolors) {
- unpack_colors_to_standard(dev, source_colors, scolors, rop_depth);
- real_scolors = source_colors;
- }
- expand_t = tcolors == 0 && rop3_uses_T(gs_transparent_rop(lop));
- if (expand_t) {
- traster = bitmap_raster(textures->rep_width * rop_depth);
- ALLOC_BUF(texture_row, traster, "copy_rop texture_row");
- rop_texture = *textures;
- rop_texture.data = texture_row;
- rop_texture.raster = traster;
- rop_texture.size.x = rop_texture.rep_width;
- rop_texture.id = gs_no_bitmap_id;
- real_texture = &rop_texture;
- }
- if (tcolors) {
- unpack_colors_to_standard(dev, texture_colors, tcolors, rop_depth);
- real_tcolors = texture_colors;
- }
- } else {
- dest_row = row;
- }
-
-#undef ALLOC_BUF
-
- for (py = y; py < y + height; ++py) {
- byte *data;
- int sx = sourcex;
- const byte *source_data = sdata + (py - y) * sraster;
-
- if (uses_d) {
- code = (*dev_proc(dev, get_bits)) (dev, py, row, &data);
- if (code < 0)
- break;
- if (expand) {
- /* Convert the destination data to standard format. */
- unpack_to_standard(dev, dest_row, data, 0, dev->width,
- rop_depth, depth);
- data = dest_row;
- }
- code = (*dev_proc(&mdev, copy_color)) ((gx_device *) & mdev,
- data, x, draster, gx_no_bitmap_id,
- 0, 0, width, 1);
- if (code < 0)
- return code;
- }
- if (expand) {
- /* Convert the source and texture to standard format. */
- if (expand_s) {
- unpack_to_standard(dev, source_row, source_data, sx, width,
- rop_depth, depth);
- source_data = source_row;
- sx = 0;
- }
- if (expand_t) {
- int rep_y = (phase_y + py) % rop_texture.rep_height;
-
- unpack_to_standard(dev, texture_row,
- textures->data +
- rep_y * textures->raster,
- 0, textures->rep_width, rop_depth, depth);
- /*
- * Compensate for the addition of rep_y * raster
- * in the subsidiary strip_copy_rop call.
- */
- rop_texture.data = texture_row - rep_y * rop_texture.raster;
- }
- }
- code = (*dev_proc(&mdev, strip_copy_rop)) ((gx_device *) & mdev,
- source_data, sx, sraster /*ad lib */ , gx_no_bitmap_id,
- real_scolors, real_texture, real_tcolors,
- 0, 0, width, 1, phase_x + x, phase_y + py,
- lop);
- if (code < 0)
- break;
- code = (*dev_proc(&mdev, get_bits)) ((gx_device *) & mdev,
- 0, dest_row, &data);
- if (code < 0)
- break;
- if (expand) {
- /* Convert the result back to the device's format. */
- pack_from_standard(dev, row, 0, data, width, depth, rop_depth);
- data = row;
- }
- code = (*dev_proc(dev, copy_color)) (dev,
- data, 0, draster, gx_no_bitmap_id,
- x, py, width, 1);
- if (code < 0)
- break;
- }
- out:
- if (dest_row != row) {
- gs_free_object(mem, texture_row, "copy_rop texture_row");
- gs_free_object(mem, source_row, "copy_rop source_row");
- gs_free_object(mem, dest_row, "copy_rop dest_row");
- }
- gs_free_object(mem, row, "copy_rop row");
- (*dev_proc(&mdev, close_device)) ((gx_device *) & mdev);
- return code;
-}
-
-/* ------ Implementation of related functions ------ */
-
-int
-gx_real_default_copy_rop(gx_device * dev,
- const byte * sdata, int sourcex, uint sraster, gx_bitmap_id id,
- const gx_color_index * scolors,
- const gx_tile_bitmap * texture, const gx_color_index * tcolors,
- int x, int y, int width, int height,
- int phase_x, int phase_y, gs_logical_operation_t lop)
-{
- const gx_strip_bitmap *textures;
- gx_strip_bitmap tiles;
-
- if (texture == 0)
- textures = 0;
- else {
- *(gx_tile_bitmap *) & tiles = *texture;
- tiles.rep_shift = tiles.shift = 0;
- textures = &tiles;
- }
- return (*dev_proc(dev, strip_copy_rop))
- (dev, sdata, sourcex, sraster, id, scolors, textures, tcolors,
- x, y, width, height, phase_x, phase_y, lop);
-}
-
-int
-gx_forward_copy_rop(gx_device * dev,
- const byte * sdata, int sourcex, uint sraster, gx_bitmap_id id,
- const gx_color_index * scolors,
- const gx_tile_bitmap * texture, const gx_color_index * tcolors,
- int x, int y, int width, int height,
- int phase_x, int phase_y, gs_logical_operation_t lop)
-{
- gx_device *tdev = ((gx_device_forward *) dev)->target;
-
- dev_proc_copy_rop((*proc));
-
- if (tdev == 0)
- tdev = dev, proc = gx_default_copy_rop;
- else
- proc = dev_proc(tdev, copy_rop);
- return (*proc) (tdev, sdata, sourcex, sraster, id, scolors,
- texture, tcolors, x, y, width, height,
- phase_x, phase_y, lop);
-}
-
-int
-gx_forward_strip_copy_rop(gx_device * dev,
- const byte * sdata, int sourcex, uint sraster, gx_bitmap_id id,
- const gx_color_index * scolors,
- const gx_strip_bitmap * textures, const gx_color_index * tcolors,
- int x, int y, int width, int height,
- int phase_x, int phase_y, gs_logical_operation_t lop)
-{
- gx_device *tdev = ((gx_device_forward *) dev)->target;
-
- dev_proc_strip_copy_rop((*proc));
-
- if (tdev == 0)
- tdev = dev, proc = gx_default_strip_copy_rop;
- else
- proc = dev_proc(tdev, strip_copy_rop);
- return (*proc) (tdev, sdata, sourcex, sraster, id, scolors,
- textures, tcolors, x, y, width, height,
- phase_x, phase_y, lop);
-}
-
-int
-gx_copy_rop_unaligned(gx_device * dev,
- const byte * sdata, int sourcex, uint sraster, gx_bitmap_id id,
- const gx_color_index * scolors,
- const gx_tile_bitmap * texture, const gx_color_index * tcolors,
- int x, int y, int width, int height,
- int phase_x, int phase_y, gs_logical_operation_t lop)
-{
- const gx_strip_bitmap *textures;
- gx_strip_bitmap tiles;
-
- if (texture == 0)
- textures = 0;
- else {
- *(gx_tile_bitmap *) & tiles = *texture;
- tiles.rep_shift = tiles.shift = 0;
- textures = &tiles;
- }
- return gx_strip_copy_rop_unaligned
- (dev, sdata, sourcex, sraster, id, scolors, textures, tcolors,
- x, y, width, height, phase_x, phase_y, lop);
-}
-
-int
-gx_strip_copy_rop_unaligned(gx_device * dev,
- const byte * sdata, int sourcex, uint sraster, gx_bitmap_id id,
- const gx_color_index * scolors,
- const gx_strip_bitmap * textures, const gx_color_index * tcolors,
- int x, int y, int width, int height,
- int phase_x, int phase_y, gs_logical_operation_t lop)
-{
- dev_proc_strip_copy_rop((*copy_rop)) = dev_proc(dev, strip_copy_rop);
- int depth = (scolors == 0 ? dev->color_info.depth : 1);
- int step = sraster & (align_bitmap_mod - 1);
-
- /* Adjust the origin. */
- if (sdata != 0) {
- uint offset =
- (uint) (sdata - (const byte *)0) & (align_bitmap_mod - 1);
-
- /* See copy_color above re the following statement. */
- if (depth == 24)
- offset += (offset % 3) *
- (align_bitmap_mod * (3 - (align_bitmap_mod % 3)));
- sdata -= offset;
- sourcex += (offset << 3) / depth;
- }
- /* Adjust the raster. */
- if (!step || sdata == 0 ||
- (scolors != 0 && scolors[0] == scolors[1])
- ) { /* No adjustment needed. */
- return (*copy_rop) (dev, sdata, sourcex, sraster, id, scolors,
- textures, tcolors, x, y, width, height,
- phase_x, phase_y, lop);
- }
- /* Do the transfer one scan line at a time. */
- {
- const byte *p = sdata;
- int d = sourcex;
- int dstep = (step << 3) / depth;
- int code = 0;
- int i;
-
- for (i = 0; i < height && code >= 0;
- ++i, p += sraster - step, d += dstep
- )
- code = (*copy_rop) (dev, p, d, sraster, gx_no_bitmap_id, scolors,
- textures, tcolors, x, y + i, width, 1,
- phase_x, phase_y, lop);
- return code;
- }
-}
-
-/* ---------------- RasterOp texture device ---------------- */
-
-public_st_device_rop_texture();
-
-/* Device for clipping with a region. */
-private dev_proc_fill_rectangle(rop_texture_fill_rectangle);
-private dev_proc_copy_mono(rop_texture_copy_mono);
-private dev_proc_copy_color(rop_texture_copy_color);
-
-/* The device descriptor. */
-private const gx_device_rop_texture far_data gs_rop_texture_device =
-{std_device_std_body(gx_device_rop_texture, 0, "rop source",
- 0, 0, 1, 1),
- {NULL, /* open_device */
- gx_forward_get_initial_matrix,
- NULL, /* default_sync_output */
- NULL, /* output_page */
- NULL, /* close_device */
- gx_forward_map_rgb_color,
- gx_forward_map_color_rgb,
- rop_texture_fill_rectangle,
- NULL, /* tile_rectangle */
- rop_texture_copy_mono,
- rop_texture_copy_color,
- NULL, /* draw_line */
- NULL, /* get_bits */
- gx_forward_get_params,
- gx_forward_put_params,
- gx_forward_map_cmyk_color,
- gx_forward_get_xfont_procs,
- gx_forward_get_xfont_device,
- gx_forward_map_rgb_alpha_color,
- gx_forward_get_page_device,
- NULL, /* get_alpha_bits (no alpha) */
- gx_no_copy_alpha, /* shouldn't be called */
- gx_forward_get_band,
- gx_no_copy_rop, /* shouldn't be called */
- NULL, /* fill_path */
- NULL, /* stroke_path */
- NULL, /* fill_mask */
- NULL, /* fill_trapezoid */
- NULL, /* fill_parallelogram */
- NULL, /* fill_triangle */
- NULL, /* draw_thin_line */
- NULL, /* begin_image */
- NULL, /* image_data */
- NULL, /* end_image */
- NULL, /* strip_tile_rectangle */
- NULL, /* strip_copy_rop */
- gx_forward_get_clipping_box,
- gx_forward_get_hardware_params
- },
- 0, /* target */
- lop_default, /* log_op */
- NULL /* texture */
-};
-
-#define rtdev ((gx_device_rop_texture *)dev)
-
-/* Initialize a RasterOp source device. */
-void
-gx_make_rop_texture_device(gx_device_rop_texture * dev, gx_device * target,
- gs_logical_operation_t log_op, const gx_device_color * texture)
-{
- *dev = gs_rop_texture_device;
- /* Drawing operations are defaulted, non-drawing are forwarded. */
- gx_device_fill_in_procs((gx_device *) dev);
- dev->color_info = target->color_info;
- dev->target = target;
- dev->log_op = log_op;
- dev->texture = texture;
-}
-
-/* Fill a rectangle */
-private int
-rop_texture_fill_rectangle(gx_device * dev, int x, int y, int w, int h,
- gx_color_index color)
-{
- gx_rop_source_t source;
-
- source.sdata = NULL;
- source.sourcex = 0;
- source.sraster = 0;
- source.id = gx_no_bitmap_id;
- source.scolors[0] = source.scolors[1] = color;
- source.use_scolors = true;
- return gx_device_color_fill_rectangle(rtdev->texture,
- x, y, w, h, rtdev->target,
- rtdev->log_op, &source);
-}
-
-/* Copy a monochrome rectangle */
-private int
-rop_texture_copy_mono(gx_device * dev,
- const byte * data, int sourcex, int raster, gx_bitmap_id id,
- int x, int y, int w, int h,
- gx_color_index color0, gx_color_index color1)
-{
- gx_rop_source_t source;
- gs_logical_operation_t lop = rtdev->log_op;
-
- source.sdata = data;
- source.sourcex = sourcex;
- source.sraster = raster;
- source.id = id;
- source.scolors[0] = color0;
- source.scolors[1] = color1;
- source.use_scolors = true;
- /* Adjust the logical operation per transparent colors. */
- if (color0 == gx_no_color_index)
- lop = rop3_use_D_when_S_0(lop);
- else if (color1 == gx_no_color_index)
- lop = rop3_use_D_when_S_1(lop);
- return gx_device_color_fill_rectangle(rtdev->texture,
- x, y, w, h, rtdev->target,
- lop, &source);
-}
-
-/* Copy a color rectangle */
-private int
-rop_texture_copy_color(gx_device * dev,
- const byte * data, int sourcex, int raster, gx_bitmap_id id,
- int x, int y, int w, int h)
-{
- gx_rop_source_t source;
-
- source.sdata = data;
- source.sourcex = sourcex;
- source.sraster = raster;
- source.id = id;
- source.scolors[0] = source.scolors[1] = gx_no_color_index;
- source.use_scolors = true;
- return gx_device_color_fill_rectangle(rtdev->texture,
- x, y, w, h, rtdev->target,
- rtdev->log_op, &source);
-}
-
-/* ---------------- Internal routines ---------------- */
-
-/* Compute the effective RasterOp for the 1-bit case, */
-/* taking transparency into account. */
-private gs_rop3_t
-gs_transparent_rop(gs_logical_operation_t lop)
-{
- gs_rop3_t rop = lop_rop(lop);
-
- /*
- * The algorithm for computing an effective RasterOp is presented,
- * albeit obfuscated, in the H-P PCL5 technical documentation.
- * Define So ("source opaque") and Po ("pattern opaque") as masks
- * that have 1-bits precisely where the source or pattern
- * respectively are not white (transparent).
- * One applies the original RasterOp to compute an intermediate
- * result R, and then computes the final result as
- * (R & M) | (D & ~M) where M depends on transparencies as follows:
- * s_tr p_tr M
- * 0 0 1
- * 0 1 ~So | Po (? Po ?)
- * 1 0 So
- * 1 1 So & Po
- * The s_tr = 0, p_tr = 1 case seems wrong, but it's clearly
- * specified that way in the "PCL 5 Color Technical Reference
- * Manual."
- *
- * In the 1-bit case, So = ~S and Po = ~P, so we can apply the
- * above table directly.
- */
-#define So rop3_not(rop3_S)
-#define Po rop3_not(rop3_T)
-#ifdef TRANSPARENCY_PER_H_P
-# define MPo (rop3_uses_S(rop) ? rop3_not(So) | Po : Po)
-#else
-# define MPo Po
-#endif
- /*
- * If the operation doesn't use S or T, we must disregard the
- * corresponding transparency flag.
- */
-#define source_transparent ((lop & lop_S_transparent) && rop3_uses_S(rop))
-#define pattern_transparent ((lop & lop_T_transparent) && rop3_uses_T(rop))
- gs_rop3_t mask =
- (source_transparent ?
- (pattern_transparent ? So & Po : So) :
- (pattern_transparent ? MPo : rop3_1));
-
-#undef MPo
- return (rop & mask) | (rop3_D & ~mask);
-}
diff --git a/gs/src/gdevmrop.h b/gs/src/gdevmrop.h
index 0a0bd0697..dd4a7cb4c 100644
--- a/gs/src/gdevmrop.h
+++ b/gs/src/gdevmrop.h
@@ -1,30 +1,50 @@
-/* Copyright (C) 1995, 1996 Aladdin Enterprises. All rights reserved.
-
- This file is part of Aladdin Ghostscript.
-
- Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
- or distributor accepts any responsibility for the consequences of using it,
- or for whether it serves any particular purpose or works at all, unless he
- or she says so in writing. Refer to the Aladdin Ghostscript Free Public
- License (the "License") for full details.
-
- Every copy of Aladdin Ghostscript must include a copy of the License,
- normally in a plain ASCII text file named PUBLIC. The License grants you
- the right to copy, modify and redistribute Aladdin Ghostscript, but only
- under certain conditions described in the License. Among other things, the
- License requires that the copyright notice and this notice be preserved on
- all copies.
-*/
-
-/* gdevmrop.h */
-/* Interfaces to RasterOp implementation */
+/* Copyright (C) 1995, 1996, 1998 Aladdin Enterprises. All rights reserved.
+
+ This file is part of Aladdin Ghostscript.
+
+ Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
+ or distributor accepts any responsibility for the consequences of using it,
+ or for whether it serves any particular purpose or works at all, unless he
+ or she says so in writing. Refer to the Aladdin Ghostscript Free Public
+ License (the "License") for full details.
+
+ Every copy of Aladdin Ghostscript must include a copy of the License,
+ normally in a plain ASCII text file named PUBLIC. The License grants you
+ the right to copy, modify and redistribute Aladdin Ghostscript, but only
+ under certain conditions described in the License. Among other things, the
+ License requires that the copyright notice and this notice be preserved on
+ all copies.
+ */
+
+/*Id: gdevmrop.h */
+/* Definitions for device RasterOp implementations. */
/* Requires gxdevmem.h, gsropt.h */
+#ifndef gdevmrop_INCLUDED
+# define gdevmrop_INCLUDED
+
/* Define the table of RasterOp implementation procedures. */
-extern const far_data rop_proc rop_proc_table[256];
+extern const rop_proc rop_proc_table[256];
/* Define the table of RasterOp operand usage. */
-extern const far_data byte /*rop_usage_t*/ rop_usage_table[256];
+extern const byte /*rop_usage_t */ rop_usage_table[256];
+
+/*
+ * Compute the effective RasterOp for the 1-bit case,
+ * taking transparency into account.
+ */
+gs_rop3_t gs_transparent_rop(P1(gs_logical_operation_t lop));
+
+#ifdef DEBUG
+/* Trace a [strip_]copy_rop call. */
+void trace_copy_rop(P16(const char *cname, gx_device * dev,
+ const byte * sdata, int sourcex, uint sraster,
+ gx_bitmap_id id, const gx_color_index * scolors,
+ const gx_strip_bitmap * textures,
+ const gx_color_index * tcolors,
+ int x, int y, int width, int height,
+ int phase_x, int phase_y, gs_logical_operation_t lop));
+#endif
/*
* PostScript colors normally act as the texture for RasterOp, with a null
@@ -32,32 +52,40 @@ extern const far_data byte /*rop_usage_t*/ rop_usage_table[256];
* a way to use the image data as the source. We implement this with a
* device that applies RasterOp with a specified texture to drawing
* operations, treating the drawing color as source rather than texture.
- * The texture is a gx_device_color; it may be any type of PostScript color,
- * even a Pattern.
+ * The texture is a gx_device_color; it may be any type of color, even a
+ * pattern.
*/
#ifndef gx_device_color_DEFINED
# define gx_device_color_DEFINED
typedef struct gx_device_color_s gx_device_color;
+
#endif
#ifndef gx_device_rop_texture_DEFINED
# define gx_device_rop_texture_DEFINED
typedef struct gx_device_rop_texture_s gx_device_rop_texture;
+
#endif
struct gx_device_rop_texture_s {
- gx_device_forward_common;
- gs_logical_operation_t log_op;
- const gx_device_color *texture;
+ gx_device_forward_common;
+ gs_logical_operation_t log_op;
+ gx_device_color texture;
};
-extern_st(st_device_rop_texture);
-#define public_st_device_rop_texture()\
- gs_public_st_suffix_add1(st_device_rop_texture, gx_device_rop_texture,\
- "gx_device_rop_texture", device_rop_texture_enum_ptrs, device_rop_texture_reloc_ptrs,\
- st_device_forward, texture)
+
+#define private_st_device_rop_texture() /* in gdevrops.c */\
+ gs_private_st_composite(st_device_rop_texture, gx_device_rop_texture,\
+ "gx_device_rop_texture", device_rop_texture_enum_ptrs, device_rop_texture_reloc_ptrs)
+
+/* Create a RasterOp source device. */
+int gx_alloc_rop_texture_device(P3(gx_device_rop_texture ** prsdev,
+ gs_memory_t * mem,
+ client_name_t cname));
/* Initialize a RasterOp source device. */
-void gx_make_rop_texture_device(P4(gx_device_rop_texture *rsdev,
- gx_device *target,
+void gx_make_rop_texture_device(P4(gx_device_rop_texture * rsdev,
+ gx_device * target,
gs_logical_operation_t lop,
- const gx_device_color *texture));
+ const gx_device_color * texture));
+
+#endif /* gdevmrop_INCLUDED */
diff --git a/gs/src/gdevmswn.c b/gs/src/gdevmswn.c
index 50fdb1045..9b5c0c71f 100644
--- a/gs/src/gdevmswn.c
+++ b/gs/src/gdevmswn.c
@@ -16,7 +16,7 @@
all copies.
*/
-/* gdevmswn.c */
+/*Id: gdevmswn.c */
/*
* Microsoft Windows 3.n driver for Ghostscript.
* Original version by Russell Lang and Maurice Castro with help from
diff --git a/gs/src/gdevmswn.h b/gs/src/gdevmswn.h
index 8d3af3c32..17b47471e 100644
--- a/gs/src/gdevmswn.h
+++ b/gs/src/gdevmswn.h
@@ -1,23 +1,27 @@
/* Copyright (C) 1989, 1992, 1993, 1994 Aladdin Enterprises. All rights reserved.
-
- This file is part of Aladdin Ghostscript.
-
- Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
- or distributor accepts any responsibility for the consequences of using it,
- or for whether it serves any particular purpose or works at all, unless he
- or she says so in writing. Refer to the Aladdin Ghostscript Free Public
- License (the "License") for full details.
-
- Every copy of Aladdin Ghostscript must include a copy of the License,
- normally in a plain ASCII text file named PUBLIC. The License grants you
- the right to copy, modify and redistribute Aladdin Ghostscript, but only
- under certain conditions described in the License. Among other things, the
- License requires that the copyright notice and this notice be preserved on
- all copies.
-*/
-
-/* gdevmswn.h */
+
+ This file is part of Aladdin Ghostscript.
+
+ Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
+ or distributor accepts any responsibility for the consequences of using it,
+ or for whether it serves any particular purpose or works at all, unless he
+ or she says so in writing. Refer to the Aladdin Ghostscript Free Public
+ License (the "License") for full details.
+
+ Every copy of Aladdin Ghostscript must include a copy of the License,
+ normally in a plain ASCII text file named PUBLIC. The License grants you
+ the right to copy, modify and redistribute Aladdin Ghostscript, but only
+ under certain conditions described in the License. Among other things, the
+ License requires that the copyright notice and this notice be preserved on
+ all copies.
+ */
+
+/*Id: gdevmswn.h */
/* Shared definitions for Microsoft Windows 3.n drivers */
+
+#ifndef gdevmswn_INCLUDED
+# define gdevmswn_INCLUDED
+
#include "string_.h"
#include <stdlib.h>
#include "dos_.h"
@@ -81,8 +85,8 @@ dev_proc_get_alpha_bits(win_get_alpha_bits);
/* The basic window device */
struct gx_device_win_s {
- gx_device_common;
- gx_device_win_common;
+ gx_device_common;
+ gx_device_win_common;
};
/* Initial values for width and height */
@@ -98,8 +102,8 @@ struct gx_device_win_s {
#define rop_write_at_0s 0xB8074AL /* BitBlt: write brush at 0's */
#define rop_write_0_at_1s 0x220326L /* BitBlt: ~S & D */
#define rop_write_0_at_0s 0x8800C6L /* BitBlt: S & D */
-#define rop_write_1s 0xFF0062L /* write 1's */
-#define rop_write_0s 0x000042L /* write 0's */
+#define rop_write_1s 0xFF0062L /* write 1's */
+#define rop_write_0s 0x000042L /* write 0's */
#define rop_write_pattern 0xF00021L /* PatBlt: write brush */
/* Compress a gx_color_value into an 8-bit Windows color value, */
@@ -107,3 +111,5 @@ struct gx_device_win_s {
#define win_color_value(z)\
((((z) >> (gx_color_value_bits - 5)) << 3) +\
((z) >> (gx_color_value_bits - 3)))
+
+#endif /* gdevmswn_INCLUDED */
diff --git a/gs/src/gp.h b/gs/src/gp.h
index b659118d2..55c26bbc3 100644
--- a/gs/src/gp.h
+++ b/gs/src/gp.h
@@ -1,30 +1,39 @@
-/* Copyright (C) 1991, 1995, 1997 Aladdin Enterprises. All rights reserved.
-
- This file is part of Aladdin Ghostscript.
-
- Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
- or distributor accepts any responsibility for the consequences of using it,
- or for whether it serves any particular purpose or works at all, unless he
- or she says so in writing. Refer to the Aladdin Ghostscript Free Public
- License (the "License") for full details.
-
- Every copy of Aladdin Ghostscript must include a copy of the License,
- normally in a plain ASCII text file named PUBLIC. The License grants you
- the right to copy, modify and redistribute Aladdin Ghostscript, but only
- under certain conditions described in the License. Among other things, the
- License requires that the copyright notice and this notice be preserved on
- all copies.
-*/
-
-/* gp.h */
+/* Copyright (C) 1991, 1995, 1997, 1998 Aladdin Enterprises. All rights reserved.
+
+ This file is part of Aladdin Ghostscript.
+
+ Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author
+ or distributor accepts any responsibility for the consequences of using it,
+ or for whether it serves any particular purpose or works at all, unless he
+ or she says so in writing. Refer to the Aladdin Ghostscript Free Public
+ License (the "License") for full details.
+
+ Every copy of Aladdin Ghostscript must include a copy of the License,
+ normally in a plain ASCII text file named PUBLIC. The License grants you
+ the right to copy, modify and redistribute Aladdin Ghostscript, but only
+ under certain conditions described in the License. Among other things, the
+ License requires that the copyright notice and this notice be preserved on
+ all copies.
+ */
+
+/*Id: gp.h */
/* Interface to platform-specific routines */
/* Requires gsmemory.h, gstypes.h */
+#ifndef gp_INCLUDED
+# define gp_INCLUDED
+
/*
- * This file defines the interface to ***ALL*** platform-specific routines.
+ * This file defines the interface to ***ALL*** platform-specific routines,
+ * with the exception of the thread/synchronization interface (gpsync.h).
* The routines are implemented in a gp_*.c file specific to each platform.
* We try very hard to keep this list short!
*/
+/*
+ * gp_getenv is declared in a separate file, because a few places need it
+ * and don't want to include any of the other gs definitions.
+ */
+#include "gpgetenv.h"
/* ------ Initialization/termination ------ */
@@ -82,6 +91,7 @@ void gp_get_usertime(P1(long ptm[2]));
#ifndef gx_device_DEFINED
# define gx_device_DEFINED
typedef struct gx_device_s gx_device;
+
#endif
/* Initialize the console. */
@@ -103,20 +113,16 @@ int gp_make_graphics_current(P1(gx_device *));
/* Get the environment variable that specifies the display to use. */
const char *gp_getenv_display(P0());
-/* ------ Printer accessing ------ */
+/* ------ File naming and accessing ------ */
/*
- * Open a connection to a printer. A null file name means use the
- * standard printer connected to the machine, if any.
- * If possible, support "|command" for opening an output pipe.
- * Return NULL if the connection could not be opened.
+ * Define the maximum size of a file name returned by gp_open_scratch_file
+ * or gp_open_printer. (This should really be passed as an additional
+ * parameter, but it would break too many clients to make this change now.)
+ * Note that this is the size of the buffer, not the maximum number of
+ * characters: the latter is one less, because of the terminating \0.
*/
-FILE *gp_open_printer(P2(char *fname, int binary_mode));
-
-/* Close the connection to the printer. */
-void gp_close_printer(P2(FILE *pfile, const char *fname));
-
-/* ------ File naming and accessing ------ */
+#define gp_file_name_sizeof 128
/* Define the character used for separating file names in a list. */
extern const char gp_file_name_list_separator;
@@ -134,6 +140,7 @@ extern const char gp_current_directory_name[];
/* for opening files without end-of-line conversion. */
/* This is always either "" or "b". */
extern const char gp_fmode_binary_suffix[];
+
/* Define the file modes for binary reading or writing. */
/* (This is just a convenience: they are "r" or "w" + the suffix.) */
extern const char gp_fmode_rb[];
@@ -141,12 +148,17 @@ extern const char gp_fmode_wb[];
/* Create and open a scratch file with a given name prefix. */
/* Write the actual file name at fname. */
-FILE *gp_open_scratch_file(P3(const char *prefix, char *fname,
- const char *mode));
+FILE *gp_open_scratch_file(P3(const char *prefix,
+ char fname[gp_file_name_sizeof],
+ const char *mode));
/* Open a file with the given name, as a stream of uninterpreted bytes. */
FILE *gp_fopen(P2(const char *fname, const char *mode));
+/* Force given file into binary mode (no eol translations, etc) */
+/* if 2nd param true, text mode if 2nd param false */
+bool gp_setmode_binary(P2(FILE * pfile, bool mode));
+
/* Answer whether a file name contains a directory/device specification, */
/* i.e. is absolute (not directory- or device-relative). */
bool gp_file_name_is_absolute(P2(const char *fname, uint len));
@@ -156,12 +168,29 @@ bool gp_file_name_is_absolute(P2(const char *fname, uint len));
const char *gp_file_name_concat_string(P4(const char *prefix, uint plen,
const char *fname, uint len));
+/* ------ Printer accessing ------ */
+
+/*
+ * Open a connection to a printer. A null file name means use the
+ * standard printer connected to the machine, if any.
+ * If possible, support "|command" for opening an output pipe.
+ * Return NULL if the connection could not be opened.
+ *
+ * Note that if the file name is null (0-length), it may be replaced with
+ * the name of a scratch file.
+ */
+FILE *gp_open_printer(P2(char fname[gp_file_name_sizeof], int binary_mode));
+
+/* Close the connection to the printer. */
+void gp_close_printer(P2(FILE * pfile, const char *fname));
+
/* ------ File enumeration ------ */
-#ifndef file_enum_DEFINED /* also defined in iodev.h */
+#ifndef file_enum_DEFINED /* also defined in iodev.h */
# define file_enum_DEFINED
-struct file_enum_s; /* opaque to client, defined by implementor */
+struct file_enum_s; /* opaque to client, defined by implementor */
typedef struct file_enum_s file_enum;
+
#endif
/*
@@ -176,7 +205,7 @@ typedef struct file_enum_s file_enum;
* the pattern also, as a quoting character.
*/
file_enum *gp_enumerate_files_init(P3(const char *pat, uint patlen,
- gs_memory_t *memory));
+ gs_memory_t * memory));
/*
* Return the next file name in the enumeration. The client passes in
@@ -185,7 +214,7 @@ file_enum *gp_enumerate_files_init(P3(const char *pat, uint patlen,
* returns max length +1. If there are no more files, the procedure
* returns -1.
*/
-uint gp_enumerate_files_next(P3(file_enum *pfen, char *ptr, uint maxlen));
+uint gp_enumerate_files_next(P3(file_enum * pfen, char *ptr, uint maxlen));
/*
* Clean up a file enumeration. This is only called to abandon
@@ -193,4 +222,6 @@ uint gp_enumerate_files_next(P3(file_enum *pfen, char *ptr, uint maxlen));
* no more files to enumerate. This should deallocate the file_enum
* structure and any subsidiary structures, strings, buffers, etc.
*/
-void gp_enumerate_files_close(P1(file_enum *pfen));
+void gp_enumerate_files_close(P1(file_enum * pfen));
+
+#endif /* gp_INCLUDED */