1 /***********************************************************************
3 * This software is part of the ast package *
4 * Copyright (c) 1985-2010 AT&T Intellectual Property *
5 * and is licensed under the *
6 * Common Public License, Version 1.0 *
7 * by AT&T Intellectual Property *
9 * A copy of the License is available at *
10 * http://www.opensource.org/licenses/cpl1.0.txt *
11 * (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9) *
13 * Information and Software Systems Research *
17 * Glenn Fowler <gsf@research.att.com> *
18 * David Korn <dgk@research.att.com> *
19 * Phong Vo <kpv@research.att.com> *
21 ***********************************************************************/
24 /* Invoke event handlers for a stream
26 ** Written by Kiem-Phong Vo.
30 static int _sfraiseall(int type
, Void_t
* data
)
32 static int _sfraiseall(type
, data
)
33 int type
; /* type of event */
34 Void_t
* data
; /* associated data */
42 for(p
= &_Sfpool
; p
; p
= next
)
44 for(next
= p
->next
; next
; next
= next
->next
)
47 for(n
= 0; n
< p
->n_sf
; ++n
)
49 if(sfraise(f
, type
, data
) < 0)
57 int sfraise(Sfio_t
* f
, int type
, Void_t
* data
)
59 int sfraise(f
, type
, data
)
60 Sfio_t
* f
; /* stream */
61 int type
; /* type of event */
62 Void_t
* data
; /* associated data */
65 reg Sfdisc_t
*disc
, *next
, *d
;
70 return _sfraiseall(type
,data
);
77 (type
== SF_NEW
|| type
== SF_CLOSING
||
78 type
== SF_FINAL
|| type
== SF_ATEXIT
)) &&
79 SFMODE(f
,local
) != (f
->mode
&SF_RDWR
) && _sfmode(f
,0,local
) < 0)
83 for(disc
= f
->disc
; disc
; )
90 if((rv
= (*disc
->exceptf
)(f
,type
,data
,disc
)) != 0 )
96 { /* make sure that "next" hasn't been popped */
97 for(d
= f
->disc
; d
; d
= d
->disc
)