chiark / gitweb /
Remove some unnecessary definitions.
[mLib] / selbuf.h
1 /* -*-c-*-
2  *
3  * $Id: selbuf.h,v 1.1 1999/05/14 21:01:15 mdw Exp $
4  *
5  * Line-buffering select handler
6  *
7  * (c) 1999 Straylight/Edgeware
8  */
9
10 /*----- Licensing notice --------------------------------------------------* 
11  *
12  * This file is part of the mLib utilities library.
13  *
14  * mLib is free software; you can redistribute it and/or modify
15  * it under the terms of the GNU Library General Public License as
16  * published by the Free Software Foundation; either version 2 of the
17  * License, or (at your option) any later version.
18  * 
19  * mLib is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22  * GNU Library General Public License for more details.
23  * 
24  * You should have received a copy of the GNU Library General Public
25  * License along with mLib; if not, write to the Free
26  * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
27  * MA 02111-1307, USA.
28  */
29
30 /*----- Revision history --------------------------------------------------* 
31  *
32  * $Log: selbuf.h,v $
33  * Revision 1.1  1999/05/14 21:01:15  mdw
34  * Integrated `select' handling bits from the background resolver project.
35  *
36  */
37
38 #ifndef SELBUF_H
39 #define SELBUF_H
40
41 #ifdef __cplusplus
42   extern "C" {
43 #endif
44
45 /*----- Header files ------------------------------------------------------*/
46
47 #ifndef LBUF_H
48 #  include "lbuf.h"
49 #endif
50
51 #ifndef SEL_H
52 #  include "sel.h"
53 #endif
54
55 /*----- Data structures ---------------------------------------------------*/
56
57 typedef struct selbuf {
58   sel_file reader;                      /* File selection object */
59   lbuf b;                               /* Line buffering object */
60 } selbuf;
61
62 /*----- Functions provided ------------------------------------------------*/
63
64 /* --- @selbuf_enable@ --- *
65  *
66  * Arguments:   @selbuf *b@ = pointer to buffer block
67  *
68  * Returns:     ---
69  *
70  * Use:         Enables a buffer for reading, and emits any queued lines
71  *              to the buffer's owner.
72  */
73
74 extern void selbuf_enable(selbuf */*b*/);
75
76 /* --- @selbuf_disable@ --- *
77  *
78  * Arguments:   @selbuf *b@ = pointer to a buffer block
79  *
80  * Returns:     ---
81  *
82  * Use:         Disables a buffer.  It won't be read from until it's
83  *              enabled again.
84  */
85
86 extern void selbuf_disable(selbuf */*b*/);
87
88 /* --- @selbuf_init@ --- *
89  *
90  * Arguments:   @selbuf *b@ = pointer to buffer block
91  *              @sel_state *s@ = pointer to select state to attach to
92  *              @int fd@ = file descriptor to listen to
93  *              @void (*func)(char *s, void *p)@ = function to call
94  *              @void *p@ = argument for function
95  *
96  * Returns:     ---
97  *
98  * Use:         Initializes a buffer block.
99  */
100
101 extern void selbuf_init(selbuf */*b*/,
102                         sel_state */*s*/,
103                         int /*fd*/,
104                         void (*/*func*/)(char */*s*/, void */*p*/),
105                         void */*p*/);
106
107 /*----- That's all, folks -------------------------------------------------*/
108
109 #ifdef __cplusplus
110   }
111 #endif
112
113 #endif