1
/* $Xorg: bufio.h,v 1.4 2001/02/09 02:04:04 xorgcvs Exp $ */
5
Copyright 1993, 1998 The Open Group
7
Permission to use, copy, modify, distribute, and sell this software and its
8
documentation for any purpose is hereby granted without fee, provided that
9
the above copyright notice appear in all copies and that both that
10
copyright notice and this permission notice appear in supporting
13
The above copyright notice and this permission notice shall be included
14
in all copies or substantial portions of the Software.
16
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19
IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
20
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22
OTHER DEALINGS IN THE SOFTWARE.
24
Except as contained in this notice, the name of The Open Group shall
25
not be used in advertising or otherwise to promote the sale, use or
26
other dealings in this Software without prior written authorization
30
/* $XFree86: xc/lib/font/include/bufio.h,v 1.7 2001/12/14 19:56:53 dawes Exp $ */
33
#define ___BUFIO_H___ 1
35
#include <X11/Xfuncproto.h>
39
#define xalloc(s) malloc(s)
40
#define xfree(s) free(s)
44
#define BUFFILESIZE 8192
47
typedef unsigned char BufChar;
48
typedef struct _buffile *BufFilePtr;
50
typedef struct _buffile {
54
BufChar buffer[BUFFILESIZE];
55
int (*input)( BufFilePtr /* f */);
56
int (*output)( int /* c */, BufFilePtr /* f */);
57
int (*skip)( BufFilePtr /* f */, int /* count */);
58
int (*close)( BufFilePtr /* f */, int /* doClose */);
62
extern BufFilePtr BufFileCreate (
65
int (*)(int, BufFilePtr),
66
int (*)(BufFilePtr, int),
67
int (*)(BufFilePtr, int));
68
extern BufFilePtr BufFileOpenRead ( int );
69
extern BufFilePtr BufFileOpenWrite ( int );
70
extern BufFilePtr BufFilePushCompressed ( BufFilePtr );
71
#ifdef X_GZIP_FONT_COMPRESSION
72
extern BufFilePtr BufFilePushZIP ( BufFilePtr );
74
extern int BufFileClose ( BufFilePtr, int );
75
extern int BufFileFlush ( BufFilePtr, int );
76
extern int BufFileRead ( BufFilePtr, char*, int );
77
extern int BufFileWrite ( BufFilePtr, char*, int );
78
extern void BufFileFree ( BufFilePtr );
80
#define BufFileGet(f) ((f)->left-- ? *(f)->bufp++ : ((f)->eof = (*(f)->input) (f)))
81
#define BufFilePut(c,f) (--(f)->left ? *(f)->bufp++ = ((unsigned char)(c)) : (*(f)->output) ((unsigned char)(c),f))
82
#define BufFileSkip(f,c) ((f)->eof = (*(f)->skip) (f, c))
91
#endif /* ___BUFIO_H___ */