1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214
|
/* Copyright (C) 2001-2024 Artifex Software, Inc.
All Rights Reserved.
This software is provided AS-IS with no warranty, either express or
implied.
This software is distributed under license and may not be copied,
modified or distributed except as expressly authorized under the terms
of the license contained in the file LICENSE in this distribution.
Refer to licensing information at http://www.artifex.com or contact
Artifex Software, Inc., 39 Mesa Street, Suite 108A, San Francisco,
CA 94129, USA, for further information.
*/
/* pxstate.h */
/* State definitions for PCL XL interpreter */
#ifndef pxstate_INCLUDED
# define pxstate_INCLUDED
#include "gsmemory.h"
#include "pxgstate.h"
#include "pltop.h"
#include "gslibctx.h"
#include "gxtext.h"
#include "pcparse.h"
#include "pgmand.h"
/* Define an abstract type for an image enumerator. */
#ifndef px_image_enum_DEFINED
# define px_image_enum_DEFINED
typedef struct px_image_enum_s px_image_enum_t;
#endif
/* Define an abstract type for an pattern enumerator. */
#ifndef px_pattern_enum_DEFINED
# define px_pattern_enum_DEFINED
typedef struct px_pattern_enum_s px_pattern_enum_t;
#endif
/* Define the type of the PCL XL state. */
#ifndef px_state_DEFINED
# define px_state_DEFINED
typedef struct px_state_s px_state_t;
#endif
/* NB need a separate header file for media */
typedef struct px_media_s
{
pxeMediaSize_t ms_enum;
const char *mname;
short width, height;
short m_left, m_top, m_right, m_bottom;
} px_media_t;
/* This structure captures the entire state of the PCL XL "virtual */
/* machine", except for graphics state parameters in the gs_gstate. */
struct px_state_s
{
gs_memory_t *memory;
/* Hook back to client data, for callback procedures */
void *client_data;
gs_id known_fonts_base_id;
/* Session state */
pxeMeasure_t measure;
gs_point units_per_measure;
pxeErrorReport_t error_report;
/* Pattern dictionary */
px_dict_t session_pattern_dict;
/* Page state */
pxeOrientation_t orientation;
pxeMediaSource_t media_source;
gs_point media_dims;
bool duplex;
int copies;
pxeDuplexPageMode_t duplex_page_mode;
bool duplex_back_side;
pxeMediaDestination_t media_destination;
/* NB media needs reorganization. */
pxeMediaType_t media_type;
px_media_t media_with_dims;
px_media_t *pm;
pxeMediaSize_t media_size;
short media_height;
short media_width;
int (*end_page) (px_state_t * pxs, int num_copies, int flush);
/* Pattern dictionary */
px_dict_t page_pattern_dict;
/* Internal variables */
bool have_page; /* true if anything has been written on page */
/* Cached values */
gs_matrix initial_matrix;
/* Data source */
bool data_source_open;
bool data_source_big_endian;
/* Stream dictionary */
px_dict_t stream_dict;
/* Stream reading state */
gs_string stream_name;
int stream_level; /* recursion depth */
struct sd2_
{
byte *data;
uint size;
} stream_def;
/* Font dictionary */
px_dict_t font_dict;
px_dict_t builtin_font_dict;
/* Font/character downloading state */
pl_font_t *download_font;
int font_format;
/* Global structures */
gs_font_dir *font_dir;
pl_font_t *error_page_font;
/* Graphics state */
gs_gstate *pgs; /* PostScript graphics state */
px_gstate_t *pxgs;
/* Image/pattern reading state */
px_image_enum_t *image_enum;
px_pattern_enum_t *pattern_enum;
/* Miscellaneous */
bool interpolate; /* image interpolation */
bool nocache; /* disable the cache */
struct db_
{
byte *data;
uint size;
} download_bytes; /* font/character/halftone data */
gs_string download_string; /* ditto */
struct sp_n
{
int x;
double y0, y1;
} scan_point; /* position when reading scan lines */
/* We put the warning table and error line buffer at the end */
/* so that the offsets of the scalars will stay small. */
#define px_max_error_line 120
char error_line[px_max_error_line + 1]; /* for errors with their own msg */
#define px_max_warning_message 500
uint warning_length;
char warnings[px_max_warning_message + 1];
/* ---------------- PJL state -------------------- */
pl_interp_implementation_t *pjls;
/* ---------------- PCL state -------------------- */
pl_interp_implementation_t *pcls;
struct pcl_state_s *pcs;
pcl_parser_state_t pcl_parser_state;
hpgl_parser_state_t gl_parser_state;
/* if this is a contiguous passthrough meaning that 2 passtrough
operators have been given back to back and pxl should not regain
control. */
bool this_pass_contiguous;
bool pass_first;
/* store away the current font attributes PCL can't set these,
* they persist for XL */
gs_point char_shear;
gs_point char_scale;
float char_bold_value;
float char_angle;
/* For the benefit of pdfwrite and friends */
bool high_level_device;
bool supports_rasterops;
};
/* Allocate a px_state_t. */
px_state_t *px_state_alloc(gs_memory_t *);
/* Release a px_state_t */
void px_state_release(px_state_t * pxs);
/* Do one-time state initialization. */
void px_state_init(px_state_t *, gs_gstate *);
/* Define the default end-of-page procedure. */
int px_default_end_page(px_state_t *, int, int);
/* Clean up after an error or UEL. */
void px_state_cleanup(px_state_t *);
/* Do one-time finalization. */
void px_state_finit(px_state_t *);
/* get media size */
void px_get_default_media_size(px_state_t * pxs, gs_point * pt);
/* special begin page operator for passthrough mode. */
int pxBeginPageFromPassthrough(px_state_t * pxs);
#endif /* pxstate_INCLUDED */
|