1 /* Copyright (C) 1999 Aladdin Enterprises. All rights reserved. 2 3 This software is provided AS-IS with no warranty, either express or 4 implied. 5 6 This software is distributed under license and may not be copied, 7 modified or distributed except as expressly authorized under the terms 8 of the license contained in the file LICENSE in this distribution. 9 10 For more information about licensing, please refer to 11 http://www.ghostscript.com/licensing/. For information on 12 commercial licensing, go to http://www.artifex.com/licensing/ or 13 contact Artifex Software, Inc., 101 Lucas Valley Road #110, 14 San Rafael, CA 94903, U.S.A., +1(415)492-9861. 15 */ 16 17 /* $Id: gdevpxut.h,v 1.6 2005/07/07 16:44:17 stefan Exp $ */ 18 /* Utilities for PCL XL generation */ 19 /* Requires gdevpxat.h, gdevpxen.h, gdevpxop.h */ 20 21 #ifndef gdevpxut_INCLUDED 22 # define gdevpxut_INCLUDED 23 24 /* ---------------- High-level constructs ---------------- */ 25 26 /* Write the file header, including the resolution. */ 27 int px_write_file_header(stream *s, const gx_device *dev); 28 29 /* Write the page header, including orientation. */ 30 int px_write_page_header(stream *s, const gx_device *dev); 31 32 /* Write the media selection command if needed, updating the media size. */ 33 int px_write_select_media(stream *s, const gx_device *dev, 34 pxeMediaSize_t *pms, 35 byte *media_source); 36 37 /* 38 * Write the file trailer. Note that this takes a FILE *, not a stream *, 39 * since it may be called after the stream is closed. 40 */ 41 int px_write_file_trailer(FILE *file); 42 43 /* ---------------- Low-level data output ---------------- */ 44 45 /* Write a sequence of bytes. */ 46 #define PX_PUT_LIT(s, bytes) px_put_bytes(s, bytes, sizeof(bytes)) 47 void px_put_bytes(stream * s, const byte * data, uint count); 48 49 /* Utilities for writing data values. */ 50 /* H-P printers only support little-endian data, so that's what we emit. */ 51 52 #define DA(a) pxt_attr_ubyte, (a) 53 void px_put_a(stream * s, px_attribute_t a); 54 void px_put_ac(stream *s, px_attribute_t a, px_tag_t op); 55 56 #define DUB(b) pxt_ubyte, (byte)(b) 57 void px_put_ub(stream * s, byte b); 58 void px_put_uba(stream *s, byte b, px_attribute_t a); 59 60 #define DS(i) (byte)(i), (byte)((i) >> 8) 61 void px_put_s(stream * s, uint i); 62 63 #define DUS(i) pxt_uint16, DS(i) 64 void px_put_us(stream * s, uint i); 65 void px_put_usa(stream *s, uint i, px_attribute_t a); 66 void px_put_u(stream * s, uint i); 67 68 #define DUSP(ix,iy) pxt_uint16_xy, DS(ix), DS(iy) 69 void px_put_usp(stream * s, uint ix, uint iy); 70 void px_put_usq_fixed(stream * s, fixed x0, fixed y0, fixed x1, fixed y1); 71 72 void px_put_ss(stream * s, int i); 73 void px_put_ssp(stream * s, int ix, int iy); 74 75 void px_put_l(stream * s, ulong l); 76 77 void px_put_r(stream * s, floatp r); /* no tag */ 78 void px_put_rl(stream * s, floatp r); /* pxt_real32 tag */ 79 80 void px_put_data_length(stream * s, uint num_bytes); 81 82 #endif /* gdevpxut_INCLUDED */ 83