"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 /* Copyright (C) 2000-2005, Ghostgum Software Pty Ltd. All rights reserved.
2
3 This file is part of GSview.
4
5 This program is distributed with NO WARRANTY OF ANY KIND. No author
6 or distributor accepts any responsibility for the consequences of using it,
7 or for whether it serves any particular purpose or works at all, unless he
8 or she says so in writing. Refer to the GSview Licence (the "Licence")
9 for full details.
10
11 Every copy of GSview must include a copy of the Licence, normally in a
12 plain ASCII text file named LICENCE. The Licence grants you the right
13 to copy, modify and redistribute GSview, but only under certain conditions
14 described in the Licence. Among other things, the Licence requires that
15 the copyright notice and this notice be preserved on all copies.
16 */
17
18 /* $Id: dscparse.h,v 1.18 2005/01/14 08:15:52 ghostgum Exp $ */
19 /* Interface for the DSC parser. */
20
21 #ifndef dscparse_INCLUDED
22 # define dscparse_INCLUDED
23
24 /* Some local types that may need modification */
25 typedef int GSBOOL;
26 typedef unsigned long GSDWORD; /* must be at least 32 bits */
27 typedef unsigned int GSWORD; /* must be at least 16 bits */
28
29 #ifndef FALSE
30 # define FALSE ((GSBOOL)0)
31 # define TRUE ((GSBOOL)(!FALSE))
32 #endif
33
34 /* DSC_OFFSET is an unsigned integer which holds the offset
35 * from the start of a file to a particular DSC comment,
36 * or the length of a file.
37 * Normally it is "unsigned long" which is commonly 32 bits.
38 * Change it if you need to handle larger files.
39 */
40 #ifndef DSC_OFFSET
41 # define DSC_OFFSET unsigned long
42 #endif
43 #ifndef DSC_OFFSET_FORMAT
44 # define DSC_OFFSET_FORMAT "lu" /* for printf */
45 #endif
46
47 #ifndef dsc_private
48 # ifdef private
49 # define dsc_private private
50 # else
51 # define dsc_private static
52 # endif
53 #endif
54
55 #ifndef min
56 # define min(a,b) ((a) < (b) ? (a) : (b))
57 #endif
58 #ifndef max
59 # define max(a,b) ((a) > (b) ? (a) : (b))
60 #endif
61
62 /* maximum legal length of lines in a DSC compliant file */
63 #define DSC_LINE_LENGTH 255
64
65 /* memory for strings is allocated in chunks of this length */
66 #define CDSC_STRING_CHUNK 4096
67
68 /* page array is allocated in chunks of this many pages */
69 #define CDSC_PAGE_CHUNK 128
70
71 /* buffer length for storing lines passed to dsc_scan_data() */
72 /* must be at least 2 * DSC_LINE_LENGTH */
73 /* We choose 8192 as twice the length passed to us by GSview */
74 #define CDSC_DATA_LENGTH 8192
75
76 /* Return codes from dsc_scan_data()
77 * < 0 = error
78 * >=0 = OK
79 *
80 * -1 = error, usually insufficient memory.
81 * 0-9 = normal
82 * 10-99 = internal codes, should not be seen.
83 * 100-999 = identifier of last DSC comment processed.
84 */
85
86 typedef enum CDSC_RETURN_CODE_e {
87 CDSC_ERROR = -1, /* Fatal error, usually insufficient memory */
88
89 CDSC_OK = 0, /* OK, no DSC comment found */
90 CDSC_NOTDSC = 1, /* Not DSC, or DSC is being ignored */
91
92 /* Any section */
93 CDSC_UNKNOWNDSC = 100, /* DSC comment not recognised */
94
95 /* Header section */
96 CDSC_PSADOBE = 200, /* %!PS-Adobe- */
97 CDSC_BEGINCOMMENTS = 201, /* %%BeginComments */
98 CDSC_ENDCOMMENTS = 202, /* %%EndComments */
99 CDSC_PAGES = 203, /* %%Pages: */
100 CDSC_CREATOR = 204, /* %%Creator: */
101 CDSC_CREATIONDATE = 205, /* %%CreationDate: */
102 CDSC_TITLE = 206, /* %%Title: */
103 CDSC_FOR = 207, /* %%For: */
104 CDSC_LANGUAGELEVEL = 208, /* %%LanguageLevel: */
105 CDSC_BOUNDINGBOX = 209, /* %%BoundingBox: */
106 CDSC_ORIENTATION = 210, /* %%Orientation: */
107 CDSC_PAGEORDER = 211, /* %%PageOrder: */
108 CDSC_DOCUMENTMEDIA = 212, /* %%DocumentMedia: */
109 CDSC_DOCUMENTPAPERSIZES = 213, /* %%DocumentPaperSizes: */
110 CDSC_DOCUMENTPAPERFORMS = 214, /* %%DocumentPaperForms: */
111 CDSC_DOCUMENTPAPERCOLORS = 215, /* %%DocumentPaperColors: */
112 CDSC_DOCUMENTPAPERWEIGHTS = 216, /* %%DocumentPaperWeights: */
113 CDSC_DOCUMENTDATA = 217, /* %%DocumentData: */
114 CDSC_REQUIREMENTS = 218, /* IGNORED %%Requirements: */
115 CDSC_DOCUMENTNEEDEDFONTS = 219, /* IGNORED %%DocumentNeededFonts: */
116 CDSC_DOCUMENTSUPPLIEDFONTS = 220, /* IGNORED %%DocumentSuppliedFonts: */
117 CDSC_HIRESBOUNDINGBOX = 221, /* %%HiResBoundingBox: */
118 CDSC_CROPBOX = 222, /* %%CropBox: */
119 CDSC_PLATEFILE = 223, /* %%PlateFile: (DCS 2.0) */
120 CDSC_DOCUMENTPROCESSCOLORS = 224, /* %%DocumentProcessColors: */
121 CDSC_DOCUMENTCUSTOMCOLORS = 225, /* %%DocumentCustomColors: */
122 CDSC_CMYKCUSTOMCOLOR = 226, /* %%CMYKCustomColor: */
123 CDSC_RGBCUSTOMCOLOR = 227, /* %%RGBCustomColor: */
124
125 /* Preview section */
126 CDSC_BEGINPREVIEW = 301, /* %%BeginPreview */
127 CDSC_ENDPREVIEW = 302, /* %%EndPreview */
128
129 /* Defaults section */
130 CDSC_BEGINDEFAULTS = 401, /* %%BeginDefaults */
131 CDSC_ENDDEFAULTS = 402, /* %%EndDefaults */
132 /* also %%PageMedia, %%PageOrientation, %%PageBoundingBox */
133
134 /* Prolog section */
135 CDSC_BEGINPROLOG = 501, /* %%BeginProlog */
136 CDSC_ENDPROLOG = 502, /* %%EndProlog */
137 CDSC_BEGINFONT = 503, /* IGNORED %%BeginFont */
138 CDSC_ENDFONT = 504, /* IGNORED %%EndFont */
139 CDSC_BEGINFEATURE = 505, /* IGNORED %%BeginFeature */
140 CDSC_ENDFEATURE = 506, /* IGNORED %%EndFeature */
141 CDSC_BEGINRESOURCE = 507, /* IGNORED %%BeginResource */
142 CDSC_ENDRESOURCE = 508, /* IGNORED %%EndResource */
143 CDSC_BEGINPROCSET = 509, /* IGNORED %%BeginProcSet */
144 CDSC_ENDPROCSET = 510, /* IGNORED %%EndProcSet */
145
146 /* Setup section */
147 CDSC_BEGINSETUP = 601, /* %%BeginSetup */
148 CDSC_ENDSETUP = 602, /* %%EndSetup */
149 CDSC_FEATURE = 603, /* IGNORED %%Feature: */
150 CDSC_PAPERCOLOR = 604, /* IGNORED %%PaperColor: */
151 CDSC_PAPERFORM = 605, /* IGNORED %%PaperForm: */
152 CDSC_PAPERWEIGHT = 606, /* IGNORED %%PaperWeight: */
153 CDSC_PAPERSIZE = 607, /* %%PaperSize: */
154 /* also %%Begin/EndFeature, %%Begin/EndResource */
155
156 /* Page section */
157 CDSC_PAGE = 700, /* %%Page: */
158 CDSC_PAGETRAILER = 701, /* IGNORED %%PageTrailer */
159 CDSC_BEGINPAGESETUP = 702, /* IGNORED %%BeginPageSetup */
160 CDSC_ENDPAGESETUP = 703, /* IGNORED %%EndPageSetup */
161 CDSC_PAGEMEDIA = 704, /* %%PageMedia: */
162 /* also %%PaperColor, %%PaperForm, %%PaperWeight, %%PaperSize */
163 CDSC_PAGEORIENTATION = 705, /* %%PageOrientation: */
164 CDSC_PAGEBOUNDINGBOX = 706, /* %%PageBoundingBox: */
165 /* also %%Begin/EndFont, %%Begin/EndFeature */
166 /* also %%Begin/EndResource, %%Begin/EndProcSet */
167 CDSC_INCLUDEFONT = 707, /* IGNORED %%IncludeFont: */
168 CDSC_VIEWINGORIENTATION = 708, /* %%ViewingOrientation: */
169 CDSC_PAGECROPBOX = 709, /* %%PageCropBox: */
170
171 /* Trailer section */
172 CDSC_TRAILER = 800, /* %%Trailer */
173 /* also %%Pages, %%BoundingBox, %%Orientation, %%PageOrder, %%DocumentMedia */
174 /* %%Page is recognised as an error */
175 /* also %%DocumentNeededFonts, %%DocumentSuppliedFonts */
176
177 /* End of File */
178 CDSC_EOF = 900 /* %%EOF */
179 } CDSC_RETURN_CODE;
180
181
182 /* stored in dsc->preview */
183 typedef enum CDSC_PREVIEW_TYPE_e {
184 CDSC_NOPREVIEW = 0,
185 CDSC_EPSI = 1,
186 CDSC_TIFF = 2,
187 CDSC_WMF = 3,
188 CDSC_PICT = 4
189 } CDSC_PREVIEW_TYPE;
190
191 /* stored in dsc->page_order */
192 typedef enum CDSC_PAGE_ORDER_e {
193 CDSC_ORDER_UNKNOWN = 0,
194 CDSC_ASCEND = 1,
195 CDSC_DESCEND = 2,
196 CDSC_SPECIAL = 3
197 } CDSC_PAGE_ORDER;
198
199 /* stored in dsc->page_orientation and dsc->page[pagenum-1].orientation */
200 typedef enum CDSC_ORIENTATION_ENUM_e {
201 CDSC_ORIENT_UNKNOWN = 0,
202 CDSC_PORTRAIT = 1,
203 CDSC_LANDSCAPE = 2,
204 CDSC_UPSIDEDOWN = 3,
205 CDSC_SEASCAPE = 4
206 } CDSC_ORIENTATION_ENUM;
207
208 /* stored in dsc->document_data */
209 typedef enum CDSC_DOCUMENT_DATA_e {
210 CDSC_DATA_UNKNOWN = 0,
211 CDSC_CLEAN7BIT = 1,
212 CDSC_CLEAN8BIT = 2,
213 CDSC_BINARY = 3
214 } CDSC_DOCUMENT_DATA ;
215
216 typedef struct CDSCBBOX_S {
217 int llx;
218 int lly;
219 int urx;
220 int ury;
221 } CDSCBBOX;
222
223 typedef struct CDSCFBBOX_S {
224 float fllx;
225 float flly;
226 float furx;
227 float fury;
228 } CDSCFBBOX;
229
230 typedef struct CDSCMEDIA_S {
231 const char *name;
232 float width; /* PostScript points */
233 float height;
234 float weight; /* GSM */
235 const char *colour;
236 const char *type;
237 CDSCBBOX *mediabox; /* Used by GSview for PDF MediaBox */
238 } CDSCMEDIA;
239
240 #define CDSC_KNOWN_MEDIA 25
241 extern const CDSCMEDIA dsc_known_media[CDSC_KNOWN_MEDIA];
242
243 typedef struct CDSCCTM_S { /* used for %%ViewingOrientation */
244 float xx;
245 float xy;
246 float yx;
247 float yy;
248 /* float ty; */
249 /* float ty; */
250 } CDSCCTM;
251
252 typedef struct CDSCPAGE_S {
253 int ordinal;
254 const char *label;
255 DSC_OFFSET begin;
256 DSC_OFFSET end;
257 unsigned int orientation;
258 const CDSCMEDIA *media;
259 CDSCBBOX *bbox; /* PageBoundingBox, also used by GSview for PDF CropBox */
260 CDSCCTM *viewing_orientation;
261 /* Added 2001-10-19 */
262 CDSCFBBOX *crop_box; /* CropBox */
263 } CDSCPAGE;
264
265 /* binary DOS EPS header */
266 typedef struct CDSCDOSEPS_S {
267 GSDWORD ps_begin;
268 GSDWORD ps_length;
269 GSDWORD wmf_begin;
270 GSDWORD wmf_length;
271 GSDWORD tiff_begin;
272 GSDWORD tiff_length;
273 GSWORD checksum;
274 } CDSCDOSEPS;
275
276 /* macbinary header */
277 typedef struct CDSCMACBIN_S {
278 GSDWORD data_begin; /* EPS */
279 GSDWORD data_length;
280 GSDWORD resource_begin; /* PICT */
281 GSDWORD resource_length;
282 } CDSCMACBIN;
283
284 /* rather than allocated every string with malloc, we allocate
285 * chunks of 4k and place the (usually) short strings in these
286 * chunks.
287 */
288 typedef struct CDSCSTRING_S CDSCSTRING;
289 struct CDSCSTRING_S {
290 unsigned int index;
291 unsigned int length;
292 char *data;
293 CDSCSTRING *next;
294 };
295
296 /* Desktop Color Separations - DCS 2.0 */
297 typedef struct CDCS2_S CDCS2;
298 struct CDCS2_S {
299 char *colourname;
300 char *filetype; /* Usually EPS */
301 /* For multiple file DCS, location and filename will be set */
302 char *location; /* Local or NULL */
303 char *filename;
304 /* For single file DCS, begin will be not equals to end */
305 DSC_OFFSET begin;
306 DSC_OFFSET end;
307 /* We maintain the separations as a linked list */
308 CDCS2 *next;
309 };
310
311 typedef enum CDSC_COLOUR_TYPE_e {
312 CDSC_COLOUR_UNKNOWN=0,
313 CDSC_COLOUR_PROCESS=1, /* %%DocumentProcessColors: */
314 CDSC_COLOUR_CUSTOM=2 /* %%DocumentCustomColors: */
315 } CDSC_COLOUR_TYPE;
316
317 typedef enum CDSC_CUSTOM_COLOUR_e {
318 CDSC_CUSTOM_COLOUR_UNKNOWN=0,
319 CDSC_CUSTOM_COLOUR_RGB=1, /* %%RGBCustomColor: */
320 CDSC_CUSTOM_COLOUR_CMYK=2 /* %%CMYKCustomColor: */
321 } CDSC_CUSTOM_COLOUR;
322
323 typedef struct CDSCCOLOUR_S CDSCCOLOUR;
324 struct CDSCCOLOUR_S {
325 char *name;
326 CDSC_COLOUR_TYPE type;
327 CDSC_CUSTOM_COLOUR custom;
328 /* If custom is CDSC_CUSTOM_COLOUR_RGB, the next three are correct */
329 float red;
330 float green;
331 float blue;
332 /* If colourtype is CDSC_CUSTOM_COLOUR_CMYK, the next four are correct */
333 float cyan;
334 float magenta;
335 float yellow;
336 float black;
337 /* Next colour */
338 CDSCCOLOUR *next;
339 };
340
341 /* DSC error reporting */
342
343 typedef enum CDSC_MESSAGE_ERROR_e {
344 CDSC_MESSAGE_BBOX = 0,
345 CDSC_MESSAGE_EARLY_TRAILER = 1,
346 CDSC_MESSAGE_EARLY_EOF = 2,
347 CDSC_MESSAGE_PAGE_IN_TRAILER = 3,
348 CDSC_MESSAGE_PAGE_ORDINAL = 4,
349 CDSC_MESSAGE_PAGES_WRONG = 5,
350 CDSC_MESSAGE_EPS_NO_BBOX = 6,
351 CDSC_MESSAGE_EPS_PAGES = 7,
352 CDSC_MESSAGE_NO_MEDIA = 8,
353 CDSC_MESSAGE_ATEND = 9,
354 CDSC_MESSAGE_DUP_COMMENT = 10,
355 CDSC_MESSAGE_DUP_TRAILER = 11,
356 CDSC_MESSAGE_BEGIN_END = 12,
357 CDSC_MESSAGE_BAD_SECTION = 13,
358 CDSC_MESSAGE_LONG_LINE = 14,
359 CDSC_MESSAGE_INCORRECT_USAGE = 15
360 } CDSC_MESSAGE_ERROR;
361
362 /* severity */
363 typedef enum CDSC_MESSAGE_SEVERITY_e {
364 CDSC_ERROR_NONE = -1, /* Not an error */
365 CDSC_ERROR_INFORM = 0, /* Not an error, but a common abuse */
366 CDSC_ERROR_WARN = 1, /* Not a DSC error itself */
367 CDSC_ERROR_ERROR = 2 /* DSC error */
368 } CDSC_MESSAGE_SEVERITY;
369
370 /* response */
371 typedef enum CDSC_RESPONSE_e {
372 CDSC_RESPONSE_OK = 0,
373 CDSC_RESPONSE_CANCEL = 1,
374 CDSC_RESPONSE_IGNORE_ALL = 2
375 } CDSC_RESPONSE;
376
377 extern const char * const dsc_message[];
378
379 #ifndef CDSC_TYPEDEF
380 #define CDSC_TYPEDEF
381 typedef struct CDSC_s CDSC;
382 #endif
383
384 struct CDSC_s {
385 char dummy[1024];
386 /* public data */
387 GSBOOL dsc; /* TRUE if DSC comments found */
388 GSBOOL ctrld; /* TRUE if has CTRLD at start of stream */
389 GSBOOL pjl; /* TRUE if has HP PJL at start of stream */
390 GSBOOL epsf; /* TRUE if EPSF */
391 GSBOOL pdf; /* TRUE if Portable Document Format */
392 unsigned int preview; /* enum CDSC_PREVIEW_TYPE */
393 char *dsc_version; /* first line of file */
394 unsigned int language_level;
395 unsigned int document_data; /* Clean7Bit, Clean8Bit, Binary */
396 /* enum CDSC_DOCUMENT_DATA */
397 /* DSC sections */
398 DSC_OFFSET begincomments;
399 DSC_OFFSET endcomments;
400 DSC_OFFSET beginpreview;
401 DSC_OFFSET endpreview;
402 DSC_OFFSET begindefaults;
403 DSC_OFFSET enddefaults;
404 DSC_OFFSET beginprolog;
405 DSC_OFFSET endprolog;
406 DSC_OFFSET beginsetup;
407 DSC_OFFSET endsetup;
408 DSC_OFFSET begintrailer;
409 DSC_OFFSET endtrailer;
410 CDSCPAGE *page;
411 unsigned int page_count; /* number of %%Page: pages in document */
412 unsigned int page_pages; /* number of pages in document from %%Pages: */
413 unsigned int page_order; /* enum CDSC_PAGE_ORDER */
414 unsigned int page_orientation; /* the default page orientation */
415 /* enum CDSC_ORIENTATION */
416 CDSCCTM *viewing_orientation;
417 unsigned int media_count; /* number of media items */
418 CDSCMEDIA **media; /* the array of media */
419 const CDSCMEDIA *page_media;/* the default page media */
420 CDSCBBOX *bbox; /* the document bounding box */
421 CDSCBBOX *page_bbox; /* the default page bounding box */
422 CDSCDOSEPS *doseps; /* DOS binary header */
423 char *dsc_title;
424 char *dsc_creator;
425 char *dsc_date;
426 char *dsc_for;
427
428 unsigned int max_error; /* highest error number that will be reported */
429 const int *severity; /* array of severity values, one per error */
430
431
432 /* private data */
433 void *caller_data; /* pointer to be provided when calling */
434 /* error and debug callbacks */
435 int id; /* last DSC comment found */
436 int scan_section; /* section currently being scanned */
437 /* enum CDSC_SECTION */
438
439 DSC_OFFSET doseps_end; /* ps_begin+ps_length, otherwise 0 */
440 unsigned int page_chunk_length; /* number of pages allocated */
441 DSC_OFFSET file_length; /* length of document */
442 /* If provided we try to recognise %%Trailer and %%EOF */
443 /* incorrectly embedded inside document. */
444 /* We will not parse DSC comments beyond this point. */
445 /* Can be left set to default value of 0 */
446 int skip_document; /* recursion level of %%BeginDocument: */
447 int skip_bytes; /* #bytes to ignore from BeginData: */
448 /* or DOSEPS preview section */
449 int skip_lines; /* #lines to ignore from BeginData: */
450 GSBOOL skip_pjl; /* TRUE if skip PJL until first PS comment */
451 int begin_font_count; /* recursion level of %%BeginFont */
452 int begin_feature_count; /* recursion level of %%BeginFeature */
453 int begin_resource_count; /* recursion level of %%BeginResource */
454 int begin_procset_count; /* recursion level of %%BeginProcSet */
455
456 /* buffer for input */
457 char data[CDSC_DATA_LENGTH];/* start of buffer */
458 unsigned int data_length; /* length of data in buffer */
459 unsigned int data_index; /* offset to next char in buffer */
460 DSC_OFFSET data_offset; /* offset from start of document */
461 /* to byte in data[0] */
462 GSBOOL eof; /* TRUE if there is no more data */
463
464 /* information about DSC line */
465 char *line; /* pointer to last read DSC line */
466 /* not null terminated */
467 unsigned int line_length; /* number of characters in line */
468 GSBOOL eol; /* TRUE if dsc_line contains EOL */
469 GSBOOL last_cr; /* TRUE if last line ended in \r */
470 /* check next time for \n */
471 unsigned int line_count; /* line number */
472 GSBOOL long_line; /* TRUE if found a line longer than 255 characters */
473 char last_line[256]; /* previous DSC line, used for %%+ */
474
475 /* more efficient string storage (for short strings) than malloc */
476 CDSCSTRING *string_head; /* linked list head */
477 CDSCSTRING *string; /* current list item */
478
479 /* memory allocation routines */
480 void *(*memalloc)(size_t size, void *closure_data);
481 void (*memfree)(void *ptr, void *closure_data);
482 void *mem_closure_data;
483
484 /* function for printing debug messages */
485 void (*debug_print_fn)(void *caller_data, const char *str);
486
487 /* function for reporting errors in DSC comments */
488 int (*dsc_error_fn)(void *caller_data, CDSC *dsc,
489 unsigned int explanation, const char *line, unsigned int line_len);
490
491 /* public data */
492 /* Added 2001-10-01 */
493 CDSCFBBOX *hires_bbox; /* the hires document bounding box */
494 CDSCFBBOX *crop_box; /* the size of the trimmed page */
495 CDCS2 *dcs2; /* Desktop Color Separations 2.0 */
496 CDSCCOLOUR *colours; /* Process and custom colours */
497
498 /* private data */
499 /* Added 2002-03-30 */
500 int ref_count;
501
502 /* public data */
503 /* Added 2003-07-15 */
504 CDSCMACBIN *macbin; /* Mac Binary header */
505 /* Added 2004-04-28 */
506 GSBOOL dcs1; /* True if dcs2 set but really DCS 1.0 */
507
508 /* public data */
509 /* Added 2005-01-14 */
510 CDSC_MESSAGE_SEVERITY worst_error; /* CDSC_MESSAGE_SEVERITY */
511 };
512
513
514 /* Public functions */
515
516 /* Create and initialise DSC parser */
517 CDSC *dsc_init(void *caller_data);
518
519 CDSC *dsc_init_with_alloc(
520 void *caller_data,
521 void *(*memalloc)(size_t size, void *closure_data),
522 void (*memfree)(void *ptr, void *closure_data),
523 void *closure_data);
524
525 /* Free the DSC parser */
526 void dsc_free(CDSC *dsc);
527
528 /* Reference counting for dsc structure */
529 /* dsc_new is the same as dsc_init */
530 /* dsc_ref is called by dsc_new */
531 /* If dsc_unref decrements to 0, dsc_free will be called */
532 CDSC *dsc_new(void *caller_data);
533 int dsc_ref(CDSC *dsc);
534 int dsc_unref(CDSC *dsc);
535
536 /* Tell DSC parser how long document will be, to allow ignoring
537 * of early %%Trailer and %%EOF. This is optional.
538 */
539 void dsc_set_length(CDSC *dsc, DSC_OFFSET len);
540
541 /* Process a buffer containing DSC comments and PostScript */
542 int dsc_scan_data(CDSC *dsc, const char *data, int len);
543
544 /* All data has been processed, fixup any DSC errors */
545 int dsc_fixup(CDSC *dsc);
546
547 /* Install error query function */
548 void dsc_set_error_function(CDSC *dsc,
549 int (*dsc_error_fn)(void *caller_data, CDSC *dsc,
550 unsigned int explanation, const char *line, unsigned int line_len));
551
552 /* Install print function for debug messages */
553 void dsc_set_debug_function(CDSC *dsc,
554 void (*debug_fn)(void *caller_data, const char *str));
555
556 /* Print a message to debug output, if provided */
557 void dsc_debug_print(CDSC *dsc, const char *str);
558
559 /* Given a page number, find the filename for multi-file DCS 2.0 */
560 const char * dsc_find_platefile(CDSC *dsc, int page);
561
562 /* Compare two strings, case insensitive */
563 int dsc_stricmp(const char *s, const char *t);
564
565 /* should be internal only functions, but made available to
566 * GSview for handling PDF
567 */
568 int dsc_add_page(CDSC *dsc, int ordinal, char *label);
569 int dsc_add_media(CDSC *dsc, CDSCMEDIA *media);
570 int dsc_set_page_bbox(CDSC *dsc, unsigned int page_number,
571 int llx, int lly, int urx, int ury);
572
573 /* in dscutil.c */
574 void dsc_display(CDSC *dsc, void (*dfn)(void *ptr, const char *str));
575 #endif /* dscparse_INCLUDED */