~ubuntu-branches/ubuntu/karmic/iterm/karmic

« back to all changes in this revision

Viewing changes to unix/fbiterm/include/bufio.h

  • Committer: Bazaar Package Importer
  • Author(s): Anthony Fok
  • Date: 2004-02-27 04:13:16 UTC
  • Revision ID: james.westby@ubuntu.com-20040227041316-q0jn37sia8mt0t9u
Tags: upstream-0.5
ImportĀ upstreamĀ versionĀ 0.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* $TOG: bufio.h /main/8 1998/05/07 13:44:07 kaleb $ */
 
2
 
 
3
/*
 
4
 
 
5
Copyright 1993, 1998  The Open Group
 
6
 
 
7
All Rights Reserved.
 
8
 
 
9
The above copyright notice and this permission notice shall be included
 
10
in all copies or substantial portions of the Software.
 
11
 
 
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.
 
19
 
 
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
 
23
from The Open Group.
 
24
 
 
25
*/
 
26
/* $XFree86: xc/lib/font/include/bufio.h,v 1.3 1999/07/17 05:30:46 dawes Exp $ */
 
27
 
 
28
#ifndef ___BUFIO_H___
 
29
#define ___BUFIO_H___ 1
 
30
 
 
31
#include <X11/Xfuncproto.h>
 
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
typedef struct _buffile *BufFilePtr;
 
45
 
 
46
typedef struct _buffile {
 
47
    BufChar *bufp;
 
48
    int     left;
 
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 */);
 
54
    char    *private;
 
55
} BufFileRec;
 
56
 
 
57
extern BufFilePtr BufFileCreate (
 
58
    char*,
 
59
    int (*)(BufFilePtr),
 
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 );
 
68
#endif
 
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 );
 
74
 
 
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))
 
78
 
 
79
#ifndef TRUE
 
80
#define TRUE 1
 
81
#endif
 
82
#ifndef FALSE
 
83
#define FALSE 0
 
84
#endif
 
85
 
 
86
#endif /* ___BUFIO_H___ */