3
/* External variables and functions used only by Sfio
4
** Written by Kiem-Phong Vo
7
/* code to initialize mutexes */
8
static Vtmutex_t Sfmutex;
9
static Vtonce_t Sfonce = VTONCE_INITDATA;
10
static void _sfoncef()
11
{ vtmtxopen(_Sfmutex, VT_INIT);
12
vtmtxopen(&_Sfpool.mutex, VT_INIT);
13
vtmtxopen(sfstdin->mutex, VT_INIT);
14
vtmtxopen(sfstdout->mutex, VT_INIT);
15
vtmtxopen(sfstderr->mutex, VT_INIT);
19
/* global variables used internally to the package */
20
Sfextern_t _Sfextern =
22
{ NIL(Sfpool_t*), 0, 0, 0, NIL(Sfio_t**) }, /* _Sfpool */
23
NIL(int(*)_ARG_((Sfio_t*,int))), /* _Sfpmove */
24
NIL(Sfio_t*(*)_ARG_((Sfio_t*, Sfio_t*))), /* _Sfstack */
25
NIL(void(*)_ARG_((Sfio_t*, int, int))), /* _Sfnotify */
26
NIL(int(*)_ARG_((Sfio_t*))), /* _Sfstdsync */
27
{ NIL(Sfread_f), /* _Sfudisc */
33
NIL(void(*)_ARG_((void)) ), /* _Sfcleanup */
36
&Sfonce, /* _Sfonce */
37
_sfoncef, /* _Sfoncef */
38
&Sfmutex /* _Sfmutex */
41
/* accessible to application code for a few fast macro functions */
45
static Vtmutex_t _Sfmtxin, _Sfmtxout, _Sfmtxerr;
46
#define SFMTXIN (&_Sfmtxin)
47
#define SFMTXOUT (&_Sfmtxout)
48
#define SFMTXERR (&_Sfmtxerr)
55
Sfio_t _Sfstdin = SFNEW(NIL(char*),-1,0,
56
(SF_READ |SF_STATIC|SF_MTSAFE),NIL(Sfdisc_t*),SFMTXIN);
57
Sfio_t _Sfstdout = SFNEW(NIL(char*),-1,1,
58
(SF_WRITE|SF_STATIC|SF_MTSAFE),NIL(Sfdisc_t*),SFMTXOUT);
59
Sfio_t _Sfstderr = SFNEW(NIL(char*),-1,2,
60
(SF_WRITE|SF_STATIC|SF_MTSAFE),NIL(Sfdisc_t*),SFMTXERR);
62
Sfio_t* sfstdin = &_Sfstdin;
63
Sfio_t* sfstdout = &_Sfstdout;
64
Sfio_t* sfstderr = &_Sfstderr;
66
__EXTERN__(ssize_t,_Sfi);
67
__EXTERN__(Sfio_t,_Sfstdin);
68
__EXTERN__(Sfio_t,_Sfstdout);
69
__EXTERN__(Sfio_t,_Sfstderr);
70
__EXTERN__(Sfio_t*,sfstdin);
71
__EXTERN__(Sfio_t*,sfstdout);
72
__EXTERN__(Sfio_t*,sfstderr);