1/* 2 3Copyright 1993, 1998 The Open Group 4 5Permission to use, copy, modify, distribute, and sell this software and its 6documentation for any purpose is hereby granted without fee, provided that 7the above copyright notice appear in all copies and that both that 8copyright notice and this permission notice appear in supporting 9documentation. 10 11The above copyright notice and this permission notice shall be included 12in all copies or substantial portions of the Software. 13 14THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 17IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR 18OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 19ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 20OTHER DEALINGS IN THE SOFTWARE. 21 22Except as contained in this notice, the name of The Open Group shall 23not be used in advertising or otherwise to promote the sale, use or 24other dealings in this Software without prior written authorization 25from The Open Group. 26 27*/ 28 29#ifndef ___BUFIO_H___ 30#define ___BUFIO_H___ 1 31 32#include <X11/Xfuncproto.h> 33 34#define BUFFILESIZE 8192 35#define BUFFILEEOF -1 36 37typedef unsigned char BufChar; 38typedef struct _buffile *BufFilePtr; 39 40typedef struct _buffile { 41 BufChar *bufp; 42 int left; 43 int eof; 44 BufChar buffer[BUFFILESIZE]; 45 int (*input)(BufFilePtr /* f */ ); 46 int (*output)(int /* c */ , BufFilePtr /* f */ ); 47 int (*skip)(BufFilePtr /* f */ , int /* count */ ); 48 int (*close)(BufFilePtr /* f */ , int /* doClose */ ); 49 char *private; 50} BufFileRec; 51 52extern BufFilePtr BufFileOpenRead(int); 53extern BufFilePtr BufFileOpenWrite(int); 54extern BufFilePtr BufFilePushCompressed(BufFilePtr); 55 56#ifdef X_GZIP_FONT_COMPRESSION 57extern BufFilePtr BufFilePushZIP(BufFilePtr); 58#endif 59#ifdef X_BZIP2_FONT_COMPRESSION 60extern BufFilePtr BufFilePushBZIP2(BufFilePtr); 61#endif 62extern int BufFileClose(BufFilePtr, int); 63extern int BufFileWrite(BufFilePtr, char *, int); 64 65#define BufFileGet(f) \ 66 ((f)->left-- ? *(f)->bufp++ : ((f)->eof = (*(f)->input) (f))) 67#define BufFilePut(c,f) \ 68 (--(f)->left ? *(f)->bufp++ = ((unsigned char)(c)) \ 69 : (*(f)->output) ((unsigned char)(c),f)) 70#define BufFileSkip(f,c) ((f)->eof = (*(f)->skip) (f, c)) 71 72#ifndef TRUE 73#define TRUE 1 74#endif 75#ifndef FALSE 76#define FALSE 0 77#endif 78 79#endif /* ___BUFIO_H___ */ 80