]> git.ipfire.org Git - thirdparty/cups.git/blob - pstoraster/gxclio.h
Import cups.org releases
[thirdparty/cups.git] / pstoraster / gxclio.h
1 /* Copyright (C) 1995, 1997, 1998 Aladdin Enterprises. All rights reserved.
2
3 This file is part of GNU Ghostscript.
4
5 GNU Ghostscript is distributed in the hope that it will be useful, but
6 WITHOUT ANY WARRANTY. No author or distributor accepts responsibility
7 to anyone for the consequences of using it or for whether it serves any
8 particular purpose or works at all, unless he says so in writing. Refer
9 to the GNU General Public License for full details.
10
11 Everyone is granted permission to copy, modify and redistribute GNU
12 Ghostscript, but only under the conditions described in the GNU General
13 Public License. A copy of this license is supposed to have been given
14 to you along with GNU Ghostscript so you can know your rights and
15 responsibilities. It should be in a file named COPYING. Among other
16 things, the copyright notice and this notice must be preserved on all
17 copies.
18
19 Aladdin Enterprises supports the work of the GNU Project, but is not
20 affiliated with the Free Software Foundation or the GNU Project. GNU
21 Ghostscript, as distributed by Aladdin Enterprises, does not require any
22 GNU software to build or run it.
23 */
24
25 /*$Id$ */
26 /* I/O interface for command lists */
27
28 #ifndef gxclio_INCLUDED
29 # define gxclio_INCLUDED
30
31 #include "gp.h" /* for gp_file_name_sizeof */
32
33 /*
34 * There are two implementations of the I/O interface for command lists --
35 * one suitable for embedded systems, which stores the "files" in RAM, and
36 * one suitable for other systems, which uses an external file system --
37 * with the choice made at compile/link time. This header file defines the
38 * API between the command list code proper and its I/O interface.
39 */
40
41 typedef void *clist_file_ptr; /* We can't do any better than this. */
42
43 /* ---------------- Open/close/unlink ---------------- */
44
45 /*
46 * If *fname = 0, generate and store a new scratch file name; otherwise,
47 * open an existing file. Only modes "r" and "w+" are supported,
48 * and only binary data (but the caller must append the "b" if needed).
49 * Mode "r" with *fname = 0 is an error.
50 */
51 int clist_fopen(P6(char fname[gp_file_name_sizeof], const char *fmode,
52 clist_file_ptr * pcf,
53 gs_memory_t * mem, gs_memory_t *data_mem,
54 bool ok_to_compress));
55
56 /*
57 * Close a file, optionally deleting it.
58 */
59 int clist_fclose(P3(clist_file_ptr cf, const char *fname, bool delete));
60
61 /*
62 * Delete a file.
63 */
64 int clist_unlink(P1(const char *fname));
65
66 /* ---------------- Writing ---------------- */
67
68 /* clist_space_available returns min(requested, available). */
69 long clist_space_available(P1(long requested));
70
71 int clist_fwrite_chars(P3(const void *data, uint len, clist_file_ptr cf));
72
73 /* ---------------- Reading ---------------- */
74
75 int clist_fread_chars(P3(void *data, uint len, clist_file_ptr cf));
76
77 /* ---------------- Position/status ---------------- */
78
79 /*
80 * Set the low-memory warning threshold. clist_ferror_code will return 1
81 * if fewer than this many bytes of memory are left for storing band data.
82 */
83 int clist_set_memory_warning(P2(clist_file_ptr cf, int bytes_left));
84
85 /*
86 * clist_ferror_code returns a negative error code per gserrors.h, not a
87 * Boolean; 0 means no error, 1 means low-memory warning.
88 */
89 int clist_ferror_code(P1(clist_file_ptr cf));
90
91 long clist_ftell(P1(clist_file_ptr cf));
92
93 /*
94 * We pass the file name to clist_rewind and clist_fseek in case the
95 * implementation has to close and reopen the file. (clist_fseek with
96 * offset = 0 and mode = SEEK_END indicates we are about to append.)
97 */
98 void clist_rewind(P3(clist_file_ptr cf, bool discard_data,
99 const char *fname));
100
101 int clist_fseek(P4(clist_file_ptr cf, long offset, int mode,
102 const char *fname));
103
104 #endif /* gxclio_INCLUDED */