1
/* $TOG: bufio.h /main/8 1998/05/07 13:44:07 kaleb $ */
5
Copyright 1993, 1998 The Open Group
9
The above copyright notice and this permission notice shall be included
10
in all copies or substantial portions of the Software.
12
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
13
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
14
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
15
IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
16
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
17
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
18
OTHER DEALINGS IN THE SOFTWARE.
20
Except as contained in this notice, the name of The Open Group shall
21
not be used in advertising or otherwise to promote the sale, use or
22
other dealings in this Software without prior written authorization
26
/* $XFree86: xc/lib/font/include/bufio.h,v 1.3 1999/07/17 05:30:46 dawes Exp $ */
29
#define ___BUFIO_H___ 1
31
#include <X11/Xfuncproto.h>
35
#define xalloc(s) malloc(s)
36
#define xfree(s) free(s)
40
#define BUFFILESIZE 8192
43
typedef unsigned char BufChar;
44
typedef struct _buffile *BufFilePtr;
46
typedef struct _buffile {
49
BufChar buffer[BUFFILESIZE];
50
int (*input)( BufFilePtr /* f */);
51
int (*output)( int /* c */, BufFilePtr /* f */);
52
int (*skip)( BufFilePtr /* f */, int /* count */);
53
int (*close)( BufFilePtr /* f */, int /* doClose */);
57
extern BufFilePtr BufFileCreate (
60
int (*)(int, BufFilePtr),
61
int (*)(BufFilePtr, int),
62
int (*)(BufFilePtr, int));
63
extern BufFilePtr BufFileOpenRead ( int );
64
extern BufFilePtr BufFileOpenWrite ( int );
65
extern BufFilePtr BufFilePushCompressed ( BufFilePtr );
66
#ifdef X_GZIP_FONT_COMPRESSION
67
extern BufFilePtr BufFilePushZIP ( BufFilePtr );
69
extern int BufFileClose ( BufFilePtr, int );
70
extern int BufFileFlush ( BufFilePtr, int );
71
extern int BufFileRead ( BufFilePtr, char*, int );
72
extern int BufFileWrite ( BufFilePtr, char*, int );
73
extern void BufFileFree ( BufFilePtr );
75
#define BufFileGet(f) ((f)->left-- ? *(f)->bufp++ : (*(f)->input) (f))
76
#define BufFilePut(c,f) (--(f)->left ? *(f)->bufp++ = (c) : (*(f)->output) (c,f))
77
#define BufFileSkip(f,c) ((*(f)->skip) (f, c))
86
#endif /* ___BUFIO_H___ */