xref: /original-bsd/usr.bin/make/buf.h (revision 04218a6a)
1 /*
2  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
3  * Copyright (c) 1988, 1989 by Adam de Boor
4  * Copyright (c) 1989 by Berkeley Softworks
5  * All rights reserved.
6  *
7  * This code is derived from software contributed to Berkeley by
8  * Adam de Boor.
9  *
10  * Redistribution and use in source and binary forms are permitted
11  * provided that the above copyright notice and this paragraph are
12  * duplicated in all such forms and that any documentation,
13  * advertising materials, and other materials related to such
14  * distribution and use acknowledge that the software was developed
15  * by the University of California, Berkeley.  The name of the
16  * University may not be used to endorse or promote products derived
17  * from this software without specific prior written permission.
18  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
19  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
20  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
21  *
22  *	@(#)buf.h	5.2 (Berkeley) 03/11/90
23  */
24 
25 /*-
26  * buf.h --
27  *	Header for users of the buf library.
28  */
29 
30 #ifndef _BUF_H
31 #define _BUF_H
32 
33 #include    "sprite.h"
34 
35 typedef struct Buffer *Buffer;
36 typedef unsigned char Byte;
37 
38 Buffer	    	  Buf_Init();	    /* Initialize a buffer */
39 void	    	  Buf_Destroy();    /* Destroy a buffer */
40 void	    	  Buf_AddByte();    /* Add a single byte to a buffer */
41 void	    	  Buf_AddBytes();   /* Add a range of bytes to a buffer */
42 int	    	  Buf_GetByte();    /* Get a byte from a buffer */
43 int	    	  Buf_GetBytes();   /* Get multiple bytes */
44 void		  Buf_UngetByte();  /* Push a byte back into the buffer */
45 void		  Buf_UngetBytes(); /* Push many bytes back into the buf */
46 Byte	    	  *Buf_GetAll();    /* Get them all */
47 void	    	  Buf_Discard();    /* Throw away some of the bytes */
48 int	    	  Buf_Size();	    /* See how many are there */
49 
50 #define BUF_ERROR 256
51 
52 #endif _BUF_H
53