"Fossies" - the Fresh Open Source Software Archive 
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style:
standard) with prefixed line numbers and
code folding option.
Alternatively you can here
view or
download the uninterpreted source code file.
1 /*
2 * ps.h -- Include file for PostScript routines.
3 * Copyright (C) 1992 Timothy O. Theisen
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 *
19 * Author: Tim Theisen Systems Programmer
20 * Internet: tim@cs.wisc.edu Department of Computer Sciences
21 * UUCP: uwvax!tim University of Wisconsin-Madison
22 * Phone: (608)262-0438 1210 West Dayton Street
23 * FAX: (608)262-9777 Madison, WI 53706
24 */
25
26 #ifndef NeedFunctionPrototypes
27 #if defined(FUNCPROTO) || defined(__STDC__) || defined(__cplusplus) || defined(c_plusplus)
28 #define NeedFunctionPrototypes 1
29 #else
30 #define NeedFunctionPrototypes 0
31 #endif /* __STDC__ */
32 #endif /* NeedFunctionPrototypes */
33
34 /* Constants used to index into the bounding box array. */
35
36 #define LLX 0
37 #define LLY 1
38 #define URX 2
39 #define URY 3
40
41 /* Constants used to store keywords that are scanned. */
42 /* NONE is not a keyword, it tells when a field was not set */
43
44 enum {ATEND = -1, NONE = 0, PORTRAIT, LANDSCAPE, ASCEND, DESCEND, SPECIAL};
45
46 #define PSLINELENGTH 257 /* 255 characters + 1 newline + 1 NULL */
47
48 struct document {
49 int epsf; /* Encapsulated PostScript flag. */
50 char *title; /* Title of document. */
51 char *date; /* Creation date. */
52 int pageorder; /* ASCEND, DESCEND, SPECIAL */
53 long beginheader, endheader; /* offsets into file */
54 unsigned int lenheader;
55 long beginpreview, endpreview;
56 unsigned int lenpreview;
57 long begindefaults, enddefaults;
58 unsigned int lendefaults;
59 long beginprolog, endprolog;
60 unsigned int lenprolog;
61 long beginsetup, endsetup;
62 unsigned int lensetup;
63 long begintrailer, endtrailer;
64 unsigned int lentrailer;
65 int boundingbox[4];
66 int default_page_boundingbox[4];
67 int orientation; /* PORTRAIT, LANDSCAPE */
68 int default_page_orientation; /* PORTRAIT, LANDSCAPE */
69 unsigned int nummedia;
70 struct documentmedia *media;
71 struct documentmedia *default_page_media;
72 unsigned int numpages;
73 struct page *pages;
74 };
75
76 struct page {
77 char *label;
78 int boundingbox[4];
79 struct documentmedia *media;
80 int orientation; /* PORTRAIT, LANDSCAPE */
81 long begin, end; /* offsets into file */
82 unsigned int len;
83 };
84
85 struct documentmedia {
86 char *name;
87 int width, height;
88 };
89
90 /* list of standard paper sizes from Adobe's PPD. */
91
92 extern struct documentmedia papersizes[];
93
94 /* scans a PostScript file and return a pointer to the document
95 structure. Returns NULL if file does not Conform to commenting
96 conventions . */
97
98 #if NeedFunctionPrototypes
99 struct document *psscan(FILE *);
100 #else
101 struct document *psscan();
102 #endif
103
104 /* free data structure malloc'ed by psscan */
105
106 #if NeedFunctionPrototypes
107 void psfree(struct document *);
108 #else
109 void psfree();
110 #endif
111
112 /* Copy a portion of the PostScript file */
113
114 #if NeedFunctionPrototypes
115 void pscopy(FILE *from, FILE *to, long begin, long end);
116 #else
117 void pscopy();
118 #endif
119
120 /* Copy a portion of the PostScript file upto a comment */
121
122 #if NeedFunctionPrototypes
123 char *pscopyuntil(FILE *from, FILE *to, long begin, long end,
124 const char *comment);
125 #else
126 char *pscopyuntil();
127 #endif