ps_include.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.3 */
/*
*
* Picture inclusion code for PostScript printers.
*
*/
#include <stdio.h>
#include "ps_include.h"
#if defined(__STDC__)
#else
#define lq(x) "x
#define rq(x) x"
#endif
char buf[512];
/*****************************************************************************/
int page_no; /* physical page number from *fin */
int whiteout; /* erase picture area */
int outline; /* draw a box around it and */
int scaleboth; /* scale both dimensions - if not zero */
double rot; /* rotation - in clockwise degrees */
{
int foundpage = 0; /* found the page when non zero */
int nglobal = 0; /* number of global defs so far */
int maxglobal = 0; /* and the number we've got room for */
double w = whiteout != 0; /* mostly for the var() macro */
double o = outline != 0;
double s = scaleboth != 0;
int i; /* loop index */
/*
*
* Reads a PostScript file (*fin), and uses structuring comments to locate the
* prologue, trailer, global definitions, and the requested page. After the whole
* file is scanned, the special ps_include PostScript definitions are copied to
* *fout, followed by the prologue, global definitions, the requested page, and
* the trailer. Before returning the initial environment (saved in PS_head) is
* restored.
*
* By default we assume the picture is 8.5 by 11 inches, but the BoundingBox
* comment, if found, takes precedence.
*
*/
/* section boundaries and bounding box */
if (!has("%%"))
continue;
else if (has("%%Page: ")) {
if (!foundpage)
if (i == page_no)
foundpage = 1;
} else if (has("%%EndPage: ")) {
if (i == page_no) {
foundpage = 1;
}
if (!foundpage)
} else if (has("%%BoundingBox:"))
else if (has("%%Trailer"))
else if (has("%%BeginGlobal")) {
maxglobal += 20;
}
}
} else if (has("%%EndGlobal"))
/*
fprintf(stderr, "prolog=(%d,%d)\n", prolog.start, prolog.end);
fprintf(stderr, "page=(%d,%d)\n", page.start, page.end);
for(i = 0; i < nglobal; i++)
fprintf(stderr, "global[%d]=(%d,%d)\n", i, global[i].start, global[i].end);
fprintf(stderr, "trailer=(%d,%d)\n", trailer.start, trailer.end);
*/
/* all output here */
for(i = 0; i < nglobal; i++)
if(nglobal)
}
static
char **s;
{
while (*s)
}
static
Section *s;
{
return;
if (buf[0] != '%')
}