123a0898aSmrg/* 223a0898aSmrg 323a0898aSmrgCopyright 1993, 1998 The Open Group 423a0898aSmrg 523a0898aSmrgPermission to use, copy, modify, distribute, and sell this software and its 623a0898aSmrgdocumentation for any purpose is hereby granted without fee, provided that 723a0898aSmrgthe above copyright notice appear in all copies and that both that 823a0898aSmrgcopyright notice and this permission notice appear in supporting 923a0898aSmrgdocumentation. 1023a0898aSmrg 1123a0898aSmrgThe above copyright notice and this permission notice shall be included 1223a0898aSmrgin all copies or substantial portions of the Software. 1323a0898aSmrg 1423a0898aSmrgTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 1523a0898aSmrgOR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 1623a0898aSmrgMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 1723a0898aSmrgIN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR 1823a0898aSmrgOTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 1923a0898aSmrgARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 2023a0898aSmrgOTHER DEALINGS IN THE SOFTWARE. 2123a0898aSmrg 2223a0898aSmrgExcept as contained in this notice, the name of The Open Group shall 2323a0898aSmrgnot be used in advertising or otherwise to promote the sale, use or 2423a0898aSmrgother dealings in this Software without prior written authorization 2523a0898aSmrgfrom The Open Group. 2623a0898aSmrg 2723a0898aSmrg*/ 2823a0898aSmrg 2923a0898aSmrg#ifndef ___BUFIO_H___ 3023a0898aSmrg#define ___BUFIO_H___ 1 3123a0898aSmrg 3223a0898aSmrg#include <X11/Xfuncproto.h> 3323a0898aSmrg 3423a0898aSmrg#define BUFFILESIZE 8192 3523a0898aSmrg#define BUFFILEEOF -1 3623a0898aSmrg 3723a0898aSmrgtypedef unsigned char BufChar; 3823a0898aSmrgtypedef struct _buffile *BufFilePtr; 3923a0898aSmrg 4023a0898aSmrgtypedef struct _buffile { 4123a0898aSmrg BufChar *bufp; 4223a0898aSmrg int left; 4323a0898aSmrg int eof; 4423a0898aSmrg BufChar buffer[BUFFILESIZE]; 4523a0898aSmrg int (*input)( BufFilePtr /* f */); 4623a0898aSmrg int (*output)( int /* c */, BufFilePtr /* f */); 4723a0898aSmrg int (*skip)( BufFilePtr /* f */, int /* count */); 4823a0898aSmrg int (*close)( BufFilePtr /* f */, int /* doClose */); 4923a0898aSmrg char *private; 5023a0898aSmrg} BufFileRec; 5123a0898aSmrg 5223a0898aSmrgextern BufFilePtr BufFileCreate ( 5323a0898aSmrg char*, 5423a0898aSmrg int (*)(BufFilePtr), 5523a0898aSmrg int (*)(int, BufFilePtr), 5623a0898aSmrg int (*)(BufFilePtr, int), 5723a0898aSmrg int (*)(BufFilePtr, int)); 5823a0898aSmrgextern BufFilePtr BufFileOpenRead ( int ); 5923a0898aSmrgextern BufFilePtr BufFileOpenWrite ( int ); 6023a0898aSmrgextern BufFilePtr BufFilePushCompressed ( BufFilePtr ); 6123a0898aSmrg#ifdef X_GZIP_FONT_COMPRESSION 6223a0898aSmrgextern BufFilePtr BufFilePushZIP ( BufFilePtr ); 6323a0898aSmrg#endif 647f7f5e4eSmrg#ifdef X_BZIP2_FONT_COMPRESSION 657f7f5e4eSmrgextern BufFilePtr BufFilePushBZIP2 ( BufFilePtr ); 667f7f5e4eSmrg#endif 6723a0898aSmrgextern int BufFileClose ( BufFilePtr, int ); 6823a0898aSmrgextern int BufFileRead ( BufFilePtr, char*, int ); 6923a0898aSmrgextern int BufFileWrite ( BufFilePtr, char*, int ); 7023a0898aSmrg 7123a0898aSmrg#define BufFileGet(f) ((f)->left-- ? *(f)->bufp++ : ((f)->eof = (*(f)->input) (f))) 7223a0898aSmrg#define BufFilePut(c,f) (--(f)->left ? *(f)->bufp++ = ((unsigned char)(c)) : (*(f)->output) ((unsigned char)(c),f)) 7323a0898aSmrg#define BufFileSkip(f,c) ((f)->eof = (*(f)->skip) (f, c)) 7423a0898aSmrg 7523a0898aSmrg#ifndef TRUE 7623a0898aSmrg#define TRUE 1 7723a0898aSmrg#endif 7823a0898aSmrg#ifndef FALSE 7923a0898aSmrg#define FALSE 0 8023a0898aSmrg#endif 8123a0898aSmrg 8223a0898aSmrg#endif /* ___BUFIO_H___ */ 8323a0898aSmrg 84