/*
* 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 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/*
*
* Picture inclusion code for PostScript printers.
*
*/
#include <stdio.h>
#include "ps_include.h"
typedef struct {
long start;
long end;
} Section;
/*
* fin, fout - input and output files
* page_no physical page number from *fin
* whiteout - erase picture area
* outline - draw a box around it and
* scaleboth - scale both dimensions - if not zero
* cx, cy - center of the picture and
* sx, sy - its size - in current coordinates
* ax, ay - left-right, up-down adjustment
* rot - rotation - in clockwise degrees
*/
void
{
/* found the page when non zero */
int foundpage = 0;
/* number of global defs so far */
int nglobal = 0;
/* and the number we've got room for */
int maxglobal = 0;
/* prologue, page, and trailer offsets */
/* offsets for all global definitions */
/* lower left and */
/* upper right corners - default coords */
/* mostly for the var() macro */
double w = whiteout != 0;
double o = outline != 0;
double s = scaleboth != 0;
int i;
/*
*
* 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.
*
*/
/* default BoundingBox - 8.5x11 inches */
/* 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:"))
has("%%EndDocumentSetup"))
else if (has("%%Trailer"))
else if (has("%%BeginGlobal")) {
maxglobal += 20;
}
}
} else if (has("%%EndGlobal"))
/* all output here */
for (i = 0; i < nglobal; i++)
if (nglobal)
}
static void
{
while (*s)
}
static void
{
return;
if (buf[0] != '%')
}