summaryrefslogtreecommitdiff
path: root/pl/pltoputl.h
blob: ecaddeee37a4f56bf7d03cf4013b05c6180361df (plain)
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
/* Portions Copyright (C) 2001 artofcode LLC.
   Portions Copyright (C) 1996, 2001 Artifex Software Inc.
   Portions Copyright (C) 1988, 2000 Aladdin Enterprises.
   This software is based in part on the work of the Independent JPEG Group.
   All Rights Reserved.

   This software is distributed under license and may not be copied, modified
   or distributed except as expressly authorized under the terms of that
   license.  Refer to licensing information at http://www.artifex.com/ or
   contact Artifex Software, Inc., 101 Lucas Valley Road #110,
   San Rafael, CA  94903, (415)492-9861, for further information. */
/*$Id$ */

/* pltoputl.h   Useful utilities for use w/pltop.c interface */

#ifndef pltoputl_INCLUDED
#  define pltoputl_INCLUDED

#include "scommon.h"

/* -------------- Read file cursor operations ---------- */
/*
 * Stream-driven reading cursor
 */
typedef struct pl_top_cursor_s {
        stream_cursor_read         cursor;        /* cursor actually used to read */
        FILE                       *strm;         /* stream that data comes from */
        unsigned char              *buffer;       /* buffer to use */
   unsigned                   buffer_length; /* # bytes in buffer */
        int                        status;        /* if <=0, status to report to caller */
} pl_top_cursor_t;

/* Init a read cursor w/specified open stream */
int pl_top_cursor_init(pl_top_cursor_t *cursor, FILE *strm, byte *buffer, unsigned bufferLength);

/* Refill from input */
int pl_top_cursor_next(pl_top_cursor_t *cursor);

/* Close read cursor */
int pl_top_cursor_close(pl_top_cursor_t *cursor);

/* Deinit a read cursor */
void pl_top_cursor_dnit(pl_top_cursor_t *cursor);

/* renew a cursor if EOD condition has been set.  This can happen if a
   PDL does not consume any data even though data is avaiable */
void pl_renew_cursor_status(pl_top_cursor_t *cursor);

#endif				/* pltoputl_INCLUDED */