~ubuntu-branches/ubuntu/oneiric/ghostscript/oneiric

« back to all changes in this revision

Viewing changes to base/gdevadmp.c

  • Committer: Bazaar Package Importer
  • Author(s): Till Kamppeter
  • Date: 2011-07-15 16:49:55 UTC
  • mfrom: (1.1.23 upstream)
  • Revision ID: james.westby@ubuntu.com-20110715164955-uga6qibao6kez05c
Tags: 9.04~dfsg~20110715-0ubuntu1
* New upstream release
   - GIT snapshot from Jult, 12 2011.
* debian/patches/020110406~a54df2d.patch,
  debian/patches/020110408~0791cc8.patch,
  debian/patches/020110408~507cbee.patch,
  debian/patches/020110411~4509a49.patch,
  debian/patches/020110412~78bb9a6.patch,
  debian/patches/020110418~a05ab8a.patch,
  debian/patches/020110420~20b6c78.patch,
  debian/patches/020110420~4ddefa2.patch: Removed upstream patches.
* debian/rules: Generate ABI version number (variable "abi") correctly,
  cutting off repackaging and pre-release parts.
* debian/rules: Added ./lcms2/ directory to DEB_UPSTREAM_REPACKAGE_EXCLUDES.
* debian/copyright: Added lcms2/* to the list of excluded files.
* debian/symbols.common: Updated for new upstream source. Applied patch
  which dpkg-gensymbols generated for debian/libgs9.symbols to this file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* Copyright (C) 2001-2006 Artifex Software, Inc.
2
2
   All Rights Reserved.
3
 
  
 
3
 
4
4
   This software is provided AS-IS with no warranty, either express or
5
5
   implied.
6
6
 
10
10
   or contact Artifex Software, Inc.,  7 Mt. Lassen Drive - Suite A-134,
11
11
   San Rafael, CA  94903, U.S.A., +1(415)492-9861, for further information.
12
12
*/
13
 
/* $Id: gdevadmp.c 8250 2007-09-25 13:31:24Z giles $*/
 
13
/* $Id$*/
14
14
/*
15
15
 * Apple DMP / Imagewriter driver
16
16
 *
17
 
 * This is a modification of Mark Wedel's Apple DMP and 
 
17
 * This is a modification of Mark Wedel's Apple DMP and
18
18
 * Jonathan Luckey's Imagewriter II driver to
19
19
 * support the Imagewriter LQ's higher resolution (320x216):
20
20
 *      appledmp:  120dpi x  72dpi is still supported (yuck)
45
45
 * the formfeed will skip a whole page.  As a work around, I reverse
46
46
 * the paper about a 1.5 inches at the end of the page before the
47
47
 * formfeed to make it think its on the 'right' page.  bah. hack!
48
 
 * 
 
48
 *
49
49
 * This is  my first attempt to work with gs, so your milage may vary
50
50
 *
51
51
 * Jonathan Luckey (luckey@rtfm.mlb.fl.us)
106
106
 * Dot Matrix Code by Mark Wedel (master@cats.ucsc.edu)
107
107
 */
108
108
 
109
 
 
110
109
#include "gdevprn.h"
111
110
 
112
111
/* The device descriptors */
115
114
/* Standard DMP device */
116
115
const gx_device_printer far_data gs_appledmp_device =
117
116
prn_device(prn_std_procs, "appledmp",
118
 
        85,                             /* width_10ths, 8.5" */
119
 
        110,                            /* height_10ths, 11" */
120
 
        120, 72,                        /* X_DPI, Y_DPI */
121
 
        0, 0.5, 0.5, 0,         /* margins */
122
 
        1, dmp_print_page);
123
 
 
 
117
        85,                             /* width_10ths, 8.5" */
 
118
        110,                            /* height_10ths, 11" */
 
119
        120, 72,                        /* X_DPI, Y_DPI */
 
120
        0, 0.5, 0.5, 0,         /* margins */
 
121
        1, dmp_print_page);
124
122
 
125
123
/*  lowrez Imagewriter device */
126
124
const gx_device_printer far_data gs_iwlo_device =
127
125
prn_device(prn_std_procs, "iwlo",
128
 
        85,                             /* width_10ths, 8.5" */
129
 
        110,                            /* height_10ths, 11" */
130
 
        160, 72,                        /* X_DPI, Y_DPI */
131
 
        0, 0.5, 0.5, 0,         /* margins */
132
 
        1, dmp_print_page);
133
 
 
 
126
        85,                             /* width_10ths, 8.5" */
 
127
        110,                            /* height_10ths, 11" */
 
128
        160, 72,                        /* X_DPI, Y_DPI */
 
129
        0, 0.5, 0.5, 0,         /* margins */
 
130
        1, dmp_print_page);
134
131
 
135
132
/*  hirez Imagewriter device */
136
133
const gx_device_printer far_data gs_iwhi_device =
137
134
prn_device(prn_std_procs, "iwhi",
138
 
        85,                             /* width_10ths, 8.5" */
139
 
        110,                            /* height_10ths, 11" */
140
 
        160, 144,                       /* X_DPI, Y_DPI */
141
 
        0, 0.5, 0.5, 0,         /* margins */
142
 
        1, dmp_print_page);
143
 
 
 
135
        85,                             /* width_10ths, 8.5" */
 
136
        110,                            /* height_10ths, 11" */
 
137
        160, 144,                       /* X_DPI, Y_DPI */
 
138
        0, 0.5, 0.5, 0,         /* margins */
 
139
        1, dmp_print_page);
144
140
 
145
141
/* LQ hirez Imagewriter device */
146
142
const gx_device_printer far_data gs_iwlq_device =
147
143
prn_device(prn_std_procs, "iwlq",
148
 
        85,                             /* width_10ths, 8.5" */
149
 
        110,                            /* height_10ths, 11" */
150
 
        320, 216,
151
 
        0, 0, 0.5, 0,           /* margins */
152
 
        1, dmp_print_page);
153
 
 
 
144
        85,                             /* width_10ths, 8.5" */
 
145
        110,                            /* height_10ths, 11" */
 
146
        320, 216,
 
147
        0, 0, 0.5, 0,           /* margins */
 
148
        1, dmp_print_page);
154
149
 
155
150
/* ------ Internal routines ------ */
156
151
 
162
157
/* Send the page to the printer. */
163
158
static int
164
159
dmp_print_page(gx_device_printer *pdev, FILE *prn_stream)
165
 
{       
166
 
        int dev_type;
167
 
 
168
 
        int line_size = gdev_mem_bytes_per_scan_line((gx_device *)pdev);
169
 
        /* Note that in_size is a multiple of 8. */
170
 
        int in_size = line_size * 8;
171
 
  
172
 
        byte *buf1 = (byte *)gs_malloc(pdev->memory, in_size, 1, "dmp_print_page(buf1)");
173
 
        byte *buf2 = (byte *)gs_malloc(pdev->memory, in_size, 1, "dmp_print_page(buf2)");
174
 
        byte *prn = (byte *)gs_malloc(pdev->memory, 3*in_size, 1, "dmp_print_page(prn)");
175
 
  
176
 
        byte *in = buf1;
177
 
        byte *out = buf2;
178
 
        int lnum = 0;
179
 
 
180
 
        /* Check allocations */
181
 
        if ( buf1 == 0 || buf2 == 0 || prn == 0 )
182
 
        {
183
 
                if ( buf1 ) 
184
 
                        gs_free(pdev->memory, (char *)buf1, in_size, 1,
185
 
                        "dmp_print_page(buf1)");
186
 
                if ( buf2 ) 
187
 
                        gs_free(pdev->memory, (char *)buf2, in_size, 1,
188
 
                        "dmp_print_page(buf2)");
189
 
                if ( prn ) 
190
 
                        gs_free(pdev->memory, (char *)prn, in_size, 1,
191
 
                        "dmp_print_page(prn)");
192
 
                return_error(gs_error_VMerror);
193
 
        }
194
 
 
195
 
        if ( pdev->y_pixels_per_inch == 216 )
196
 
                dev_type = IWLQ;
197
 
        else if ( pdev->y_pixels_per_inch == 144 )
198
 
                dev_type = IWHI;
199
 
        else if ( pdev->x_pixels_per_inch == 160 )
200
 
                dev_type = IWLO;
201
 
        else
202
 
                dev_type = DMP;
203
 
 
204
 
        /* Initialize the printer and reset the margins. */
205
 
 
206
 
        fputs("\r\n\033>\033T16", prn_stream);
207
 
 
208
 
        switch(dev_type)
209
 
        {
210
 
        case IWLQ:
211
 
                fputs("\033P\033a3", prn_stream);
212
 
                break;
213
 
        case IWHI:
214
 
        case IWLO:
215
 
                fputs("\033P", prn_stream);
216
 
                break;
217
 
        case DMP: 
218
 
        default:
219
 
                fputs("\033q", prn_stream);
220
 
                break;
221
 
        }
222
 
 
223
 
        /* Print lines of graphics */
224
 
        while ( lnum < pdev->height )
225
 
        {       
226
 
                byte *inp;
227
 
                byte *in_end;
228
 
                byte *out_end;
229
 
                int lcnt,ltmp;
230
 
                int count, passes;
231
 
                byte *prn_blk, *prn_end, *prn_tmp;
 
160
{
 
161
        int dev_type;
 
162
 
 
163
        int line_size = gdev_mem_bytes_per_scan_line((gx_device *)pdev);
 
164
        /* Note that in_size is a multiple of 8. */
 
165
        int in_size = line_size * 8;
 
166
 
 
167
        byte *buf1 = (byte *)gs_malloc(pdev->memory, in_size, 1, "dmp_print_page(buf1)");
 
168
        byte *buf2 = (byte *)gs_malloc(pdev->memory, in_size, 1, "dmp_print_page(buf2)");
 
169
        byte *prn = (byte *)gs_malloc(pdev->memory, 3*in_size, 1, "dmp_print_page(prn)");
 
170
 
 
171
        byte *in = buf1;
 
172
        byte *out = buf2;
 
173
        int lnum = 0;
 
174
 
 
175
        /* Check allocations */
 
176
        if ( buf1 == 0 || buf2 == 0 || prn == 0 )
 
177
        {
 
178
                if ( buf1 )
 
179
                        gs_free(pdev->memory, (char *)buf1, in_size, 1,
 
180
                        "dmp_print_page(buf1)");
 
181
                if ( buf2 )
 
182
                        gs_free(pdev->memory, (char *)buf2, in_size, 1,
 
183
                        "dmp_print_page(buf2)");
 
184
                if ( prn )
 
185
                        gs_free(pdev->memory, (char *)prn, in_size, 1,
 
186
                        "dmp_print_page(prn)");
 
187
                return_error(gs_error_VMerror);
 
188
        }
 
189
 
 
190
        if ( pdev->y_pixels_per_inch == 216 )
 
191
                dev_type = IWLQ;
 
192
        else if ( pdev->y_pixels_per_inch == 144 )
 
193
                dev_type = IWHI;
 
194
        else if ( pdev->x_pixels_per_inch == 160 )
 
195
                dev_type = IWLO;
 
196
        else
 
197
                dev_type = DMP;
 
198
 
 
199
        /* Initialize the printer and reset the margins. */
 
200
 
 
201
        fputs("\r\n\033>\033T16", prn_stream);
 
202
 
 
203
        switch(dev_type)
 
204
        {
 
205
        case IWLQ:
 
206
                fputs("\033P\033a3", prn_stream);
 
207
                break;
 
208
        case IWHI:
 
209
        case IWLO:
 
210
                fputs("\033P", prn_stream);
 
211
                break;
 
212
        case DMP:
 
213
        default:
 
214
                fputs("\033q", prn_stream);
 
215
                break;
 
216
        }
 
217
 
 
218
        /* Print lines of graphics */
 
219
        while ( lnum < pdev->height )
 
220
        {
 
221
                byte *inp;
 
222
                byte *in_end;
 
223
                byte *out_end;
 
224
                int lcnt,ltmp;
 
225
                int count, passes;
 
226
                byte *prn_blk, *prn_end, *prn_tmp;
232
227
 
233
228
/* The apple DMP printer seems to be odd in that the bit order on
234
229
 * each line is reverse what might be expected.  Meaning, an
237
232
 * scan line in reverse order.
238
233
 */
239
234
 
240
 
                switch (dev_type)
241
 
                {
242
 
                case IWLQ: passes = 3; break;
243
 
                case IWHI: passes = 2; break;
244
 
                case IWLO:
245
 
                case DMP:
246
 
                default: passes = 1; break;
247
 
                }
248
 
 
249
 
                for (count = 0; count < passes; count++)
250
 
                {
251
 
                        for (lcnt=0; lcnt<8; lcnt++)
252
 
                        {
253
 
                                switch(dev_type)
254
 
                                {
255
 
                                case IWLQ: ltmp = lcnt + 8*count; break;
256
 
                                case IWHI: ltmp = 2*lcnt + count; break;
257
 
                                case IWLO:
258
 
                                case DMP:
259
 
                                default: ltmp = lcnt; break;
260
 
                                }
261
 
 
262
 
                                if ((lnum+ltmp)>pdev->height) 
263
 
                                        memset(in+lcnt*line_size,0,line_size);
264
 
                                else
265
 
                                        gdev_prn_copy_scan_lines(pdev,
266
 
                                        lnum+ltmp, in + line_size*(7 - lcnt),
267
 
                                        line_size);
268
 
                        }
269
 
 
270
 
                        out_end = out;
271
 
                        inp = in;
272
 
                        in_end = inp + line_size;
273
 
                        for ( ; inp < in_end; inp++, out_end += 8 )
274
 
                        {
275
 
                                gdev_prn_transpose_8x8(inp, line_size,
276
 
                                out_end, 1);
277
 
                        }
278
 
 
279
 
                        out_end = out;
280
 
 
281
 
                        switch (dev_type)
282
 
                        {
283
 
                        case IWLQ: prn_end = prn + count; break;
284
 
                        case IWHI: prn_end = prn + in_size*count; break;
285
 
                        case IWLO:
286
 
                        case DMP:
287
 
                        default: prn_end = prn; break;
288
 
                        }
289
 
 
290
 
                        while ( (int)(out_end-out) < in_size)
291
 
                        {
292
 
                                *prn_end = *(out_end++);
293
 
                                if ((dev_type) == IWLQ) prn_end += 3;
294
 
                                else prn_end++;
295
 
                        }
296
 
                }
297
 
      
298
 
                switch (dev_type)
299
 
                {
300
 
                case IWLQ:
301
 
                        prn_blk = prn;
302
 
                        prn_end = prn_blk + in_size * 3;
303
 
                        while (prn_end > prn && prn_end[-1] == 0 &&
304
 
                                prn_end[-2] == 0 && prn_end[-3] == 0)
305
 
                        {
306
 
                                prn_end -= 3;
307
 
                        }
308
 
                        while (prn_blk < prn_end && prn_blk[0] == 0 &&
309
 
                                prn_blk[1] == 0 && prn_blk[2] == 0)
310
 
                        {
311
 
                                prn_blk += 3;
312
 
                        }
313
 
                        if (prn_end != prn_blk)
314
 
                        {
315
 
                                if ((prn_blk - prn) > 7)
316
 
                                        fprintf(prn_stream,"\033U%04d%c%c%c",
317
 
                                                (int)((prn_blk - prn)/3),
318
 
                                                0, 0, 0);
319
 
                                else
320
 
                                        prn_blk = prn;
321
 
                                fprintf(prn_stream,"\033C%04d",
322
 
                                        (int)((prn_end - prn_blk)/3));
323
 
                                fwrite(prn_blk, 1, (int)(prn_end - prn_blk),
324
 
                                        prn_stream);
325
 
                        }
326
 
                        break;
327
 
                case IWHI:
328
 
                        for (count = 0; count < 2; count++)
329
 
                        {
330
 
                                prn_blk = prn_tmp = prn + in_size*count;
331
 
                                prn_end = prn_blk + in_size;
332
 
                                while (prn_end > prn_blk && prn_end[-1] == 0)
333
 
                                        prn_end--;
334
 
                                while (prn_blk < prn_end && prn_blk[0] == 0)
335
 
                                        prn_blk++;
336
 
                                if (prn_end != prn_blk)
337
 
                                {
338
 
                                        if ((prn_blk - prn_tmp) > 7)
339
 
                                                fprintf(prn_stream,
340
 
                                                        "\033V%04d%c",
341
 
                                                        (int)(prn_blk-prn_tmp),
342
 
                                                         0);
343
 
                                        else
344
 
                                                prn_blk = prn_tmp;
345
 
                                        fprintf(prn_stream,"\033G%04d",
346
 
                                                (int)(prn_end - prn_blk));
347
 
                                        fwrite(prn_blk, 1,
348
 
                                                (int)(prn_end - prn_blk),
349
 
                                                prn_stream);
350
 
                                }
351
 
                                if (!count) fputs("\033T01\r\n",prn_stream);
352
 
                        }
353
 
                        fputs("\033T15",prn_stream);
354
 
                        break;
355
 
                case IWLO:
356
 
                case DMP:
357
 
                default:
358
 
                        prn_blk = prn;
359
 
                        prn_end = prn_blk + in_size;
360
 
                        while (prn_end > prn_blk && prn_end[-1] == 0)
361
 
                                prn_end--;
362
 
                        while (prn_blk < prn_end && prn_blk[0] == 0)
363
 
                                prn_blk++;
364
 
                        if (prn_end != prn_blk)
365
 
                        {
366
 
                                if ((prn_blk - prn) > 7)
367
 
                                        fprintf(prn_stream,"\033V%04d%c",
368
 
                                                (int)(prn_blk - prn), 0);
369
 
                                else
370
 
                                        prn_blk = prn;
371
 
                                fprintf(prn_stream,"\033G%04d",
372
 
                                        (int)(prn_end - prn_blk));
373
 
                                fwrite(prn_blk, 1, (int)(prn_end - prn_blk),
374
 
                                        prn_stream);
375
 
                        }
376
 
                        break;
377
 
                }
378
 
 
379
 
                fputs("\r\n",prn_stream);
380
 
 
381
 
                switch (dev_type)
382
 
                {
383
 
                        case IWLQ: lnum += 24 ; break;
384
 
                        case IWHI: lnum += 16 ; break;
385
 
                        case IWLO:
386
 
                        case DMP:
387
 
                        default: lnum += 8 ; break;
388
 
                }
389
 
        }
390
 
 
391
 
        /* ImageWriter will skip a whole page if too close to end */
392
 
        /* so skip back more than an inch */
393
 
        if ( !(dev_type == DMP) )
394
 
                fputs("\033T99\n\n\033r\n\n\n\n\033f", prn_stream);
395
 
  
396
 
        /* Formfeed and Reset printer */
397
 
        fputs("\033T16\f\033<\033B\033E", prn_stream);
398
 
        fflush(prn_stream);
399
 
 
400
 
        gs_free(pdev->memory, (char *)prn, in_size, 1, "dmp_print_page(prn)");
401
 
        gs_free(pdev->memory, (char *)buf2, in_size, 1, "dmp_print_page(buf2)");
402
 
        gs_free(pdev->memory, (char *)buf1, in_size, 1, "dmp_print_page(buf1)");
403
 
        return 0;
 
235
                switch (dev_type)
 
236
                {
 
237
                case IWLQ: passes = 3; break;
 
238
                case IWHI: passes = 2; break;
 
239
                case IWLO:
 
240
                case DMP:
 
241
                default: passes = 1; break;
 
242
                }
 
243
 
 
244
                for (count = 0; count < passes; count++)
 
245
                {
 
246
                        for (lcnt=0; lcnt<8; lcnt++)
 
247
                        {
 
248
                                switch(dev_type)
 
249
                                {
 
250
                                case IWLQ: ltmp = lcnt + 8*count; break;
 
251
                                case IWHI: ltmp = 2*lcnt + count; break;
 
252
                                case IWLO:
 
253
                                case DMP:
 
254
                                default: ltmp = lcnt; break;
 
255
                                }
 
256
 
 
257
                                if ((lnum+ltmp)>pdev->height)
 
258
                                        memset(in+lcnt*line_size,0,line_size);
 
259
                                else
 
260
                                        gdev_prn_copy_scan_lines(pdev,
 
261
                                        lnum+ltmp, in + line_size*(7 - lcnt),
 
262
                                        line_size);
 
263
                        }
 
264
 
 
265
                        out_end = out;
 
266
                        inp = in;
 
267
                        in_end = inp + line_size;
 
268
                        for ( ; inp < in_end; inp++, out_end += 8 )
 
269
                        {
 
270
                                gdev_prn_transpose_8x8(inp, line_size,
 
271
                                out_end, 1);
 
272
                        }
 
273
 
 
274
                        out_end = out;
 
275
 
 
276
                        switch (dev_type)
 
277
                        {
 
278
                        case IWLQ: prn_end = prn + count; break;
 
279
                        case IWHI: prn_end = prn + in_size*count; break;
 
280
                        case IWLO:
 
281
                        case DMP:
 
282
                        default: prn_end = prn; break;
 
283
                        }
 
284
 
 
285
                        while ( (int)(out_end-out) < in_size)
 
286
                        {
 
287
                                *prn_end = *(out_end++);
 
288
                                if ((dev_type) == IWLQ) prn_end += 3;
 
289
                                else prn_end++;
 
290
                        }
 
291
                }
 
292
 
 
293
                switch (dev_type)
 
294
                {
 
295
                case IWLQ:
 
296
                        prn_blk = prn;
 
297
                        prn_end = prn_blk + in_size * 3;
 
298
                        while (prn_end > prn && prn_end[-1] == 0 &&
 
299
                                prn_end[-2] == 0 && prn_end[-3] == 0)
 
300
                        {
 
301
                                prn_end -= 3;
 
302
                        }
 
303
                        while (prn_blk < prn_end && prn_blk[0] == 0 &&
 
304
                                prn_blk[1] == 0 && prn_blk[2] == 0)
 
305
                        {
 
306
                                prn_blk += 3;
 
307
                        }
 
308
                        if (prn_end != prn_blk)
 
309
                        {
 
310
                                if ((prn_blk - prn) > 7)
 
311
                                        fprintf(prn_stream,"\033U%04d%c%c%c",
 
312
                                                (int)((prn_blk - prn)/3),
 
313
                                                0, 0, 0);
 
314
                                else
 
315
                                        prn_blk = prn;
 
316
                                fprintf(prn_stream,"\033C%04d",
 
317
                                        (int)((prn_end - prn_blk)/3));
 
318
                                fwrite(prn_blk, 1, (int)(prn_end - prn_blk),
 
319
                                        prn_stream);
 
320
                        }
 
321
                        break;
 
322
                case IWHI:
 
323
                        for (count = 0; count < 2; count++)
 
324
                        {
 
325
                                prn_blk = prn_tmp = prn + in_size*count;
 
326
                                prn_end = prn_blk + in_size;
 
327
                                while (prn_end > prn_blk && prn_end[-1] == 0)
 
328
                                        prn_end--;
 
329
                                while (prn_blk < prn_end && prn_blk[0] == 0)
 
330
                                        prn_blk++;
 
331
                                if (prn_end != prn_blk)
 
332
                                {
 
333
                                        if ((prn_blk - prn_tmp) > 7)
 
334
                                                fprintf(prn_stream,
 
335
                                                        "\033V%04d%c",
 
336
                                                        (int)(prn_blk-prn_tmp),
 
337
                                                         0);
 
338
                                        else
 
339
                                                prn_blk = prn_tmp;
 
340
                                        fprintf(prn_stream,"\033G%04d",
 
341
                                                (int)(prn_end - prn_blk));
 
342
                                        fwrite(prn_blk, 1,
 
343
                                                (int)(prn_end - prn_blk),
 
344
                                                prn_stream);
 
345
                                }
 
346
                                if (!count) fputs("\033T01\r\n",prn_stream);
 
347
                        }
 
348
                        fputs("\033T15",prn_stream);
 
349
                        break;
 
350
                case IWLO:
 
351
                case DMP:
 
352
                default:
 
353
                        prn_blk = prn;
 
354
                        prn_end = prn_blk + in_size;
 
355
                        while (prn_end > prn_blk && prn_end[-1] == 0)
 
356
                                prn_end--;
 
357
                        while (prn_blk < prn_end && prn_blk[0] == 0)
 
358
                                prn_blk++;
 
359
                        if (prn_end != prn_blk)
 
360
                        {
 
361
                                if ((prn_blk - prn) > 7)
 
362
                                        fprintf(prn_stream,"\033V%04d%c",
 
363
                                                (int)(prn_blk - prn), 0);
 
364
                                else
 
365
                                        prn_blk = prn;
 
366
                                fprintf(prn_stream,"\033G%04d",
 
367
                                        (int)(prn_end - prn_blk));
 
368
                                fwrite(prn_blk, 1, (int)(prn_end - prn_blk),
 
369
                                        prn_stream);
 
370
                        }
 
371
                        break;
 
372
                }
 
373
 
 
374
                fputs("\r\n",prn_stream);
 
375
 
 
376
                switch (dev_type)
 
377
                {
 
378
                        case IWLQ: lnum += 24 ; break;
 
379
                        case IWHI: lnum += 16 ; break;
 
380
                        case IWLO:
 
381
                        case DMP:
 
382
                        default: lnum += 8 ; break;
 
383
                }
 
384
        }
 
385
 
 
386
        /* ImageWriter will skip a whole page if too close to end */
 
387
        /* so skip back more than an inch */
 
388
        if ( !(dev_type == DMP) )
 
389
                fputs("\033T99\n\n\033r\n\n\n\n\033f", prn_stream);
 
390
 
 
391
        /* Formfeed and Reset printer */
 
392
        fputs("\033T16\f\033<\033B\033E", prn_stream);
 
393
        fflush(prn_stream);
 
394
 
 
395
        gs_free(pdev->memory, (char *)prn, in_size, 1, "dmp_print_page(prn)");
 
396
        gs_free(pdev->memory, (char *)buf2, in_size, 1, "dmp_print_page(buf2)");
 
397
        gs_free(pdev->memory, (char *)buf1, in_size, 1, "dmp_print_page(buf1)");
 
398
        return 0;
404
399
}