~ubuntu-branches/ubuntu/jaunty/ghostscript/jaunty-updates

« back to all changes in this revision

Viewing changes to doc/Source.htm

  • Committer: Bazaar Package Importer
  • Author(s): Till Kamppeter
  • Date: 2009-01-20 16:40:45 UTC
  • mfrom: (1.1.10 upstream)
  • Revision ID: james.westby@ubuntu.com-20090120164045-lnfhi0n30o5lwhwa
Tags: 8.64.dfsg.1~svn9377-0ubuntu1
* New upstream release (SVN rev 9377)
   o Fixes many bugs concerning PDF rendering, to make the PDF printing
     workflow correctly working.
   o Fixes long-standing bugs in many drivers, like input paper tray and
     duplex options not working for the built-in PCL 4, 5, 5c, 5e, and
     6/XL drivers, PDF input not working for bjc600, bjc800, and cups
     output devices, several options not working and uninitialized
     memory with cups output device.
   o Merged nearly all patches of the Ubuntu and Debian packages upstream.
   o Fixes LP: #317810, LP: #314439, LP: #314018.
* debian/patches/03_libpaper_support.dpatch,
  debian/patches/11_gs-cjk_font_glyph_handling_fix.dpatch,
  debian/patches/12_gs-cjk_vertical_writing_metrics_fix.dpatch,
  debian/patches/13_gs-cjk_cjkps_examples.dpatch,
  debian/patches/20_bbox_segv_fix.dpatch,
  debian/patches/21_brother_7x0_gdi_fix.dpatch,
  debian/patches/22_epsn_margin_workaround.dpatch,
  debian/patches/24_gs_man_fix.dpatch,
  debian/patches/25_toolbin_insecure_tmp_usage_fix.dpatch,
  debian/patches/26_assorted_script_fixes.dpatch,
  debian/patches/29_gs_css_fix.dpatch,
  debian/patches/30_ps2pdf_man_improvement.dpatch,
  debian/patches/31_fix-gc-sigbus.dpatch,
  debian/patches/34_ftbfs-on-hurd-fix.dpatch,
  debian/patches/35_disable_libcairo.dpatch,
  debian/patches/38_pxl-duplex.dpatch,
  debian/patches/39_pxl-resolution.dpatch,
  debian/patches/42_gs-init-ps-delaybind-fix.dpatch,
  debian/patches/45_bjc600-bjc800-pdf-input.dpatch,
  debian/patches/48_cups-output-device-pdf-duplex-uninitialized-memory-fix.dpatch,
  debian/patches/50_lips4-floating-point-exception.dpatch,
  debian/patches/52_cups-device-logging.dpatch,
  debian/patches/55_pcl-input-slot-fix.dpatch,
  debian/patches/57_pxl-input-slot-fix.dpatch,
  debian/patches/60_pxl-cups-driver-pdf.dpatch,
  debian/patches/62_onebitcmyk-pdf.dpatch,
  debian/patches/65_too-big-temp-files-1.dpatch,
  debian/patches/67_too-big-temp-files-2.dpatch,
  debian/patches/70_take-into-account-data-in-stream-buffer-before-refill.dpatch:
  Removed, applied upstream.
* debian/patches/01_docdir_fix_for_debian.dpatch,
  debian/patches/02_gs_man_fix_debian.dpatch,
  debian/patches/01_docdir-fix-for-debian.dpatch,
  debian/patches/02_docdir-fix-for-debian.dpatch: Renamed patches to
  make merging with Debian easier.
* debian/patches/32_improve-handling-of-media-size-changes-from-gv.dpatch, 
  debian/patches/33_bad-params-to-xinitimage-on-large-bitmaps.dpatch:
  regenerated for new source directory structure.
* debian/rules: Corrected paths to remove cidfmap (it is in Resource/Init/
  in GS 8.64) and to install headers (source paths are psi/ and base/ now).
* debian/rules: Remove all fontmaps, as DeFoMa replaces them.
* debian/local/pdftoraster/pdftoraster.c,
  debian/local/pdftoraster/pdftoraster.convs, debian/rules: Removed
  added pdftoraster filter and use the one which comes with Ghostscript.
* debian/ghostscript.links: s/8.63/8.64/

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
<html>
3
3
<head>
4
4
<title>Guide to Ghostscript source code</title>
5
 
<!-- $Id: Source.htm 8909 2008-08-01 17:53:17Z giles $ -->
 
5
<!-- $Id: Source.htm 9030 2008-08-27 02:14:10Z giles $ -->
6
6
<!-- Originally: source.txt -->
7
7
<link rel="stylesheet" type="text/css" href="gs.css" title="Ghostscript Style">
8
8
</head>
61
61
<tr valign=top> <td>&nbsp;&nbsp;&nbsp;&nbsp;
62
62
        <td>PostScript operators
63
63
        <td>&nbsp;&nbsp;&nbsp;&nbsp;
64
 
        <td><b><tt>z</tt></b>*<b><tt>.h</tt></b> and <b><tt>z</tt></b>*<b><tt>.c</tt></b>
 
64
        <td><code>z</code>*<b><tt>.h</tt></b> and <b><tt>z</tt></b>*<b><tt>.c</tt></b>
65
65
<tr valign=top> <td>&nbsp;
66
66
        <td>Other interpreter code
67
67
        <td>&nbsp;
68
 
        <td><b><tt>i</tt></b>*<b><tt>.h</tt></b> and <b><tt>i</tt></b>*<b><tt>.c</tt></b>
 
68
        <td><code>i</code>*<b><tt>.h</tt></b> and <b><tt>i</tt></b>*<b><tt>.c</tt></b>
69
69
<tr valign=top> <td>&nbsp;
70
70
        <td>PostScript code
71
71
        <td>&nbsp;
72
 
        <td><b><tt>gs_</tt></b>*<b><tt>.ps</tt></b>
 
72
        <td><code>gs_</code>*<b><tt>.ps</tt></b>
73
73
<tr valign=top> <th align=left colspan=4><a href="#PDF_interpreter">PDF interpreter</a>:
74
74
<tr valign=top> <td>&nbsp;
75
75
        <td>PostScript code
76
76
        <td>&nbsp;
77
 
        <td><b><tt>pdf_</tt></b>*<b><tt>.ps</tt></b>
 
77
        <td><code>pdf_</code>*<b><tt>.ps</tt></b>
78
78
<tr valign=top> <th align=left colspan=4><a href="#Graphics_library">Graphics library</a>:
79
79
<tr valign=top> <td>&nbsp;
80
80
        <td>Main library code
81
81
        <td>&nbsp;
82
 
        <td><b><tt>g</tt></b>*<b><tt>.h</tt></b> and <b><tt>g</tt></b>*<b><tt>.c</tt></b>
 
82
        <td><code>g</code>*<b><tt>.h</tt></b> and <b><tt>g</tt></b>*<b><tt>.c</tt></b>
83
83
<tr valign=top> <td>&nbsp;
84
84
        <td>Streams
85
85
        <td>&nbsp;
86
 
        <td><b><tt>s</tt></b>*<b><tt>.h</tt></b> and <b><tt>s</tt></b>*<b><tt>.c</tt></b>
 
86
        <td><code>s</code>*<b><tt>.h</tt></b> and <b><tt>s</tt></b>*<b><tt>.c</tt></b>
87
87
<tr valign=top> <td>&nbsp;
88
88
        <td><a href="#Drivers">Device drivers</a>
89
89
        <td>&nbsp;
90
 
        <td><b><tt>gdev</tt></b>*<b><tt>.h</tt></b> and <b><tt>gdev</tt></b>*<b><tt>.c</tt></b>
 
90
        <td><code>gdev</code>*<b><tt>.h</tt></b> and <b><tt>gdev</tt></b>*<b><tt>.c</tt></b>
91
91
<tr valign=top> <td>&nbsp;
92
92
        <td><a href="#Platform_specific_code">Platform-specific code</a>
93
93
        <td>&nbsp;
94
 
        <td><b><tt>gp</tt></b>*<b><tt>.h</tt></b> and <b><tt>gp</tt></b>*<b><tt>.c</tt></b>
 
94
        <td><code>gp</code>*<b><tt>.h</tt></b> and <b><tt>gp</tt></b>*<b><tt>.c</tt></b>
95
95
</table></blockquote>
96
96
 
97
97
<hr>
99
99
<h2><a name="PostScript_interpreter"></a>PostScript Interpreter</h2>
100
100
 
101
101
<p>
102
 
<b><tt>gs.c</tt></b> is the main program for the interactive language
103
 
interpreter; <b><tt>gserver.c</tt></b> is an alternative main program that
 
102
<code>gs.c</code> is the main program for the interactive language
 
103
interpreter; <code>gserver.c</code> is an alternative main program that
104
104
is a rudimentary server.  If you configure Ghostscript as a server rather
105
 
than an interactive program, you will use <b><tt>gserver.c</tt></b> instead
106
 
of <b><tt>gs.c</tt></b>.
 
105
than an interactive program, you will use <code>gserver.c</code> instead
 
106
of <code>gs.c</code>.
107
107
 
108
108
<p>
109
 
Files named <b><tt>z</tt></b>*<b><tt>.c</tt></b> are Ghostscript operator
 
109
Files named <code>z</code>*<b><tt>.c</tt></b> are Ghostscript operator
110
110
files.  The names of the files generally follow the section headings of the
111
111
operator summary in section 6.2 (Second Edition) or 8.2 (Third Edition) of
112
112
the PostScript Language Reference Manual.  Each operator XXX is implemented
113
 
by a procedure named <b><tt>z</tt></b>XXX, for example,
114
 
<b><tt>zfill</tt></b> and <b><tt>zarray</tt></b>.
 
113
by a procedure named <code>z</code>XXX, for example,
 
114
<code>zfill</code> and <b><tt>zarray</tt></b>.
115
115
 
116
116
<p>
117
 
Files named <b><tt>i</tt></b>*<b><tt>.c</tt></b>, and *<b><tt>.h</tt></b>
118
 
other than <b><tt>g</tt></b>*<b><tt>.h</tt></b>, are the rest of the
 
117
Files named <code>i</code>*<b><tt>.c</tt></b>, and *<b><tt>.h</tt></b>
 
118
other than <code>g</code>*<b><tt>.h</tt></b>, are the rest of the
119
119
interpreter.  See the makefile for a little more information on how the
120
120
files are divided functionally.
121
121
 
122
122
<p>
123
 
The main loop of the PostScript interpreter is the <b><tt>interp</tt></b>
124
 
procedure in <b><tt>interp.c</tt></b>.  When the interpreter is reading
 
123
The main loop of the PostScript interpreter is the <code>interp</code>
 
124
procedure in <code>interp.c</code>.  When the interpreter is reading
125
125
from an input file, it calls the token scanner in
126
 
<b><tt>iscan</tt></b>*<b><tt>.c</tt></b>.
 
126
<code>iscan</code>*<b><tt>.c</tt></b>.
127
127
 
128
128
<p>
129
 
<b><tt>idebug.c</tt></b> contains a lot of debugger-callable routines
 
129
<code>idebug.c</code> contains a lot of debugger-callable routines
130
130
useful for printing PostScript objects when debugging.
131
131
 
132
132
<hr>
135
135
 
136
136
<p>
137
137
The PDF interpreter is written entirely in PostScript.  Its main loop is
138
 
the <b><tt>.pdfrun</tt></b> procedure in <b><tt>pdf_base.ps</tt></b>.  When
 
138
the <code>.pdfrun</code> procedure in <b><tt>pdf_base.ps</tt></b>.  When
139
139
the PDF interpreter is configured into the build, it redefines the
140
 
"<b><tt>run</tt></b>" operator to test whether the file is a PDF file.
141
 
This redefinition is near the beginning of <b><tt>pdf_main.ps</tt></b>.
 
140
"<code>run</code>" operator to test whether the file is a PDF file.
 
141
This redefinition is near the beginning of <code>pdf_main.ps</code>.
142
142
 
143
143
<hr>
144
144
 
145
145
<h2><a name="Graphics_library"></a>Graphics library</h2>
146
146
 
147
147
<p>
148
 
Files beginning with <b><tt>gs</tt></b>, <b><tt>gx</tt></b>, or
149
 
<b><tt>gz</tt></b> (both <b><tt>.c</tt></b> and <b><tt>.h</tt></b>), other
150
 
than <b><tt>gs.c</tt></b> and <b><tt>gserver.c</tt></b>, are the
151
 
Ghostscript library.  Files beginning with <b><tt>gdev</tt></b> are device
 
148
Files beginning with <code>gs</code>, <b><tt>gx</tt></b>, or
 
149
<code>gz</code> (both <b><tt>.c</tt></b> and <b><tt>.h</tt></b>), other
 
150
than <code>gs.c</code> and <b><tt>gserver.c</tt></b>, are the
 
151
Ghostscript library.  Files beginning with <code>gdev</code> are device
152
152
drivers or related code, also part of the library.  Other files beginning
153
 
with <b><tt>g</tt></b> are library files that don't fall neatly into either
 
153
with <code>g</code> are library files that don't fall neatly into either
154
154
the kernel or the driver category.
155
155
 
156
156
<p>
157
 
Files named <b><tt>s</tt></b>*<b><tt>.c</tt></b> and
158
 
<b><tt>s</tt></b>*<b><tt>.h</tt></b> are a flexible stream package,
 
157
Files named <code>s</code>*<b><tt>.c</tt></b> and
 
158
<code>s</code>*<b><tt>.h</tt></b> are a flexible stream package,
159
159
including the Level 2 PostScript "filters" supported by Ghostscript.  See
160
 
<b><tt>stream.h</tt></b>, <b><tt>scommon.h</tt></b>, and
161
 
<b><tt>strimpl.h</tt></b> for all the details.
 
160
<code>stream.h</code>, <b><tt>scommon.h</tt></b>, and
 
161
<code>strimpl.h</code> for all the details.
162
162
 
163
163
<h3><a name="Drivers"></a>Device drivers</h3>
164
164
 
169
169
 
170
170
<p>
171
171
In addition to many real device and file format drivers listed in
172
 
<b><tt>devs.mak</tt></b> and <b><tt>contrib.mak</tt></b>, a number of
 
172
<code>devs.mak</code> and <b><tt>contrib.mak</tt></b>, a number of
173
173
drivers are used for internal purposes.  You can search
174
 
<b><tt>lib.mak</tt></b> for files named
175
 
<b><tt>gdev</tt></b>*<b><tt>.c</tt></b> to find almost all of them.
 
174
<code>lib.mak</code> for files named
 
175
<code>gdev</code>*<b><tt>.c</tt></b> to find almost all of them.
176
176
 
177
177
<p>
178
178
Drivers are divided into "printer" drivers, which support banding, and
179
179
non-printer drivers, which don't.  The decision whether banding is
180
180
required is made (by default on the basis of how much memory is available)
181
 
in the procedure <b><tt>gdev_prn_alloc</tt></b> in
182
 
<b><tt>gdevprn.c</tt></b>: it implements this decision by filling the
 
181
in the procedure <code>gdev_prn_alloc</code> in
 
182
<code>gdevprn.c</code>: it implements this decision by filling the
183
183
virtual procedure table for the printer device in one of two different
184
184
ways.
185
185
 
186
186
<p>
187
187
A good simple "printer" (bandable) driver to read is
188
 
<b><tt>gdevmiff.c</tt></b>: it's less than 100 lines, of which much is
 
188
<code>gdevmiff.c</code>: it's less than 100 lines, of which much is
189
189
boilerplate.  There are no simple non-printer drivers that actually drive
190
190
devices: probably the simplest non-printer driver for reading is
191
 
<b><tt>gdevm8.c</tt></b>, which implements 8-bit-deep devices that only
 
191
<code>gdevm8.c</code>, which implements 8-bit-deep devices that only
192
192
store the bits in memory.
193
193
 
194
194
<h3><a name="Platform_specific_code"></a>Platform-specific code</h3>
198
198
with them in three ways:
199
199
 
200
200
<ul>
201
 
<li>Files named *<b><tt>_.h</tt></b> substitute for the corresponding
202
 
<b><tt>&lt;</tt></b>*<b><tt>.h&gt;</tt></b> file by adding conditionals
 
201
<li>Files named *<code>_.h</code> substitute for the corresponding
 
202
<code>&lt;</code>*<b><tt>.h&gt;</tt></b> file by adding conditionals
203
203
that provide a uniform set of system interfaces on all platforms.
204
204
 
205
 
<li>The file <b><tt>arch.h</tt></b> contains a set of
 
205
<li>The file <code>arch.h</code> contains a set of
206
206
mechanically-discovered platform properties like byte order, size of
207
 
<b><tt>int</tt></b>, etc.  These properties, <b>not</b> the names of
 
207
<code>int</code>, etc.  These properties, <b>not</b> the names of
208
208
specific platforms, are used to select between different algorithms or
209
209
parameters at compile time.
210
210
 
211
 
<li>Files named <b><tt>gp</tt></b>*<b><tt>.h</tt></b> define interfaces
 
211
<li>Files named <code>gp</code>*<b><tt>.h</tt></b> define interfaces
212
212
that are intended to be implemented differently on each platform, but whose
213
213
specification is common to all platforms.
214
214
</ul>
215
215
 
216
216
<p>
217
217
The platform-specific implementations of the
218
 
<b><tt>gp</tt></b>*<b><tt>.h</tt></b> interfaces have names of the form
219
 
"<b><tt>gp_</tt></b><em>{platform}</em><b><tt>.c</tt></b>, specifically
 
218
<code>gp</code>*<b><tt>.h</tt></b> interfaces have names of the form
 
219
"<code>gp_</code><em>{platform}</em><b><tt>.c</tt></b>, specifically
220
220
(this list may be out of date):
221
221
 
222
222
<blockquote><table cellpadding=0 cellspacing=0>
226
226
        <td>&nbsp;&nbsp;&nbsp;&nbsp;
227
227
        <th align=left>Platform
228
228
<tr>    <td colspan=3><hr>
229
 
<tr valign=top> <td><b><tt>gp_dosfb.c</tt></b>
 
229
<tr valign=top> <td><code>gp_dosfb.c</code>
230
230
        <td>&nbsp;
231
231
        <td>DOS
232
 
<tr valign=top> <td><b><tt>gp_dosfs.c</tt></b>
 
232
<tr valign=top> <td><code>gp_dosfs.c</code>
233
233
        <td>&nbsp;
234
234
        <td>DOS and MS Windows
235
 
<tr valign=top> <td><b><tt>gp_itbc.c</tt></b>
 
235
<tr valign=top> <td><code>gp_itbc.c</code>
236
236
        <td>&nbsp;
237
237
        <td>DOS, Borland compilers
238
 
<tr valign=top> <td><b><tt>gp_iwatc.c</tt></b>
 
238
<tr valign=top> <td><code>gp_iwatc.c</code>
239
239
        <td>&nbsp;
240
240
        <td>DOS, Watcom or Microsoft compiler
241
 
<tr valign=top> <td><b><tt>gp_msdos.c</tt></b>
 
241
<tr valign=top> <td><code>gp_msdos.c</code>
242
242
        <td>&nbsp;
243
243
        <td>DOS and MS Windows
244
 
<tr valign=top> <td><b><tt>gp_ntfs.c</tt></b>
 
244
<tr valign=top> <td><code>gp_ntfs.c</code>
245
245
        <td>&nbsp;
246
246
        <td>MS Windows NT
247
 
<tr valign=top> <td><b><tt>gp_os2.c</tt></b>
 
247
<tr valign=top> <td><code>gp_os2.c</code>
248
248
        <td>&nbsp;
249
249
        <td>OS/2
250
 
<tr valign=top> <td><b><tt>gp_os9.c</tt></b>
 
250
<tr valign=top> <td><code>gp_os9.c</code>
251
251
        <td>&nbsp;
252
252
        <td>OS-9
253
 
<tr valign=top> <td><b><tt>gp_unifs.c</tt></b>
 
253
<tr valign=top> <td><code>gp_unifs.c</code>
254
254
        <td>&nbsp;
255
255
        <td>Unix, OS-9, and QNX
256
 
<tr valign=top> <td><b><tt>gp_unix.c</tt></b>
 
256
<tr valign=top> <td><code>gp_unix.c</code>
257
257
        <td>&nbsp;
258
258
        <td>Unix and QNX
259
 
<tr valign=top> <td><b><tt>gp_sysv.c</tt></b>
 
259
<tr valign=top> <td><code>gp_sysv.c</code>
260
260
        <td>&nbsp;
261
261
        <td>System V Unix
262
 
<tr valign=top> <td><b><tt>gp_vms.c</tt></b>
 
262
<tr valign=top> <td><code>gp_vms.c</code>
263
263
        <td>&nbsp;
264
264
        <td>VMS
265
 
<tr valign=top> <td><b><tt>gp_win32.c</tt></b>
 
265
<tr valign=top> <td><code>gp_win32.c</code>
266
266
        <td>&nbsp;
267
267
        <td>MS Windows NT
268
268
</table></blockquote>
269
269
 
270
270
<p>
271
271
If you are going to extend Ghostscript to new machines or operating
272
 
systems, check the *<b><tt>_.h</tt></b> files for <b><tt>ifdef</tt></b> on
273
 
things other than <b><tt>DEBUG</tt></b>.  You should probably plan to make
274
 
a new makefile and a new <b><tt>gp_</tt></b>XXX<b><tt>.c</tt></b> file.
 
272
systems, check the *<code>_.h</code> files for <b><tt>ifdef</tt></b> on
 
273
things other than <code>DEBUG</code>.  You should probably plan to make
 
274
a new makefile and a new <code>gp_</code>XXX<b><tt>.c</tt></b> file.
275
275
 
276
276
<hr>
277
277
 
305
305
<ul>
306
306
 
307
307
<li>Rules and definitions shared by all builds are in
308
 
<b><tt>gs.mak</tt></b>.
 
308
<code>gs.mak</code>.
309
309
 
310
310
<li>Rules and definitions specific to the library (on all platforms) are in
311
 
<b><tt>lib.mak</tt></b>.  In principle this could be merged with
312
 
<b><tt>gs.mak</tt></b>, but we wanted to leave open the possibility that
313
 
<b><tt>gs.mak</tt></b> might be useful with hypothetical interpreter-only
 
311
<code>lib.mak</code>.  In principle this could be merged with
 
312
<code>gs.mak</code>, but we wanted to leave open the possibility that
 
313
<code>gs.mak</code> might be useful with hypothetical interpreter-only
314
314
products.
315
315
 
316
316
<li>Stuff specific to interpreters (on all platforms) is in
317
 
<b><tt>int.mak</tt></b>.
 
317
<code>int.mak</code>.
318
318
 
319
319
<li>Stuff specific to all Unix platforms should be in a single
320
 
<b><tt>unix.mak</tt></b> file, but because <b><tt>make</tt></b> sometimes
 
320
<code>unix.mak</code> file, but because <b><tt>make</tt></b> sometimes
321
321
cares about the order of definitions, and because some of it is shared with
322
 
DV/X, it got split between <b><tt>unix-aux.mak</tt></b>,
323
 
<b><tt>unix-end.mak</tt></b>, <b><tt>unixhead.mak</tt></b>,
324
 
<b><tt>unixinst.mak</tt></b>, and <b><tt>unixlink.mak</tt></b>.
 
322
DV/X, it got split between <code>unix-aux.mak</code>,
 
323
<code>unix-end.mak</code>, <b><tt>unixhead.mak</tt></b>,
 
324
<code>unixinst.mak</code>, and <b><tt>unixlink.mak</tt></b>.
325
325
 
326
326
</ul>
327
327