]> git.sesse.net Git - rdpsrv/blob - Xserver/lib/font/include/bufio.h
Import X server from vnc-3.3.7.
[rdpsrv] / Xserver / lib / font / include / bufio.h
1 /* $XConsortium: bufio.h /main/5 1996/11/03 19:32:07 kaleb $ */
2
3 /*
4
5 Copyright (c) 1993  X Consortium
6
7 Permission is hereby granted, free of charge, to any person obtaining
8 a copy of this software and associated documentation files (the
9 "Software"), to deal in the Software without restriction, including
10 without limitation the rights to use, copy, modify, merge, publish,
11 distribute, sublicense, and/or sell copies of the Software, and to
12 permit persons to whom the Software is furnished to do so, subject to
13 the following conditions:
14
15 The above copyright notice and this permission notice shall be included
16 in all copies or substantial portions of the Software.
17
18 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
21 IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR
22 OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
23 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
24 OTHER DEALINGS IN THE SOFTWARE.
25
26 Except as contained in this notice, the name of the X Consortium shall
27 not be used in advertising or otherwise to promote the sale, use or
28 other dealings in this Software without prior written authorization
29 from the X Consortium.
30
31 */
32
33 #ifdef TEST
34
35 #define xalloc(s)   malloc(s)
36 #define xfree(s)    free(s)
37
38 #endif
39
40 #define BUFFILESIZE     8192
41 #define BUFFILEEOF      -1
42
43 typedef unsigned char BufChar;
44
45 typedef struct _buffile {
46     BufChar *bufp;
47     int     left;
48     BufChar buffer[BUFFILESIZE];
49     int     (*io)(/* BufFilePtr f */);
50     int     (*skip)(/* BufFilePtr f, int count */);
51     int     (*close)(/* BufFilePtr f */);
52     char    *private;
53 } BufFileRec, *BufFilePtr;
54
55 extern BufFilePtr   BufFileCreate ();
56 extern BufFilePtr   BufFileOpenRead (), BufFileOpenWrite ();
57 extern BufFilePtr   BufFilePushCompressed ();
58 #ifdef X_GZIP_FONT_COMPRESSION
59 extern BufFilePtr   BufFilePushZIP ();
60 #endif
61 extern int          BufFileClose ();
62 extern int          BufFileFlush ();
63 #define BufFileGet(f)   ((f)->left-- ? *(f)->bufp++ : (*(f)->io) (f))
64 #define BufFilePut(c,f) (--(f)->left ? *(f)->bufp++ = (c) : (*(f)->io) (c,f))
65 #define BufFileSkip(f,c)    ((*(f)->skip) (f, c))
66
67 #ifndef TRUE
68 #define TRUE 1
69 #endif
70 #ifndef FALSE
71 #define FALSE 0
72 #endif