~ubuntu-branches/ubuntu/lucid/graphviz/lucid-security

« back to all changes in this revision

Viewing changes to tools/sfio/sfextern.c

  • Committer: Bazaar Package Importer
  • Author(s): Stephen M Moraco
  • Date: 2002-02-05 18:52:12 UTC
  • Revision ID: james.westby@ubuntu.com-20020205185212-8i04c70te00rc40y
Tags: upstream-1.7.16
ImportĀ upstreamĀ versionĀ 1.7.16

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include        "sfhdr.h"
 
2
 
 
3
/*      External variables and functions used only by Sfio
 
4
**      Written by Kiem-Phong Vo
 
5
*/
 
6
 
 
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);
 
16
        _Sfdone = 1;
 
17
}
 
18
 
 
19
/* global variables used internally to the package */
 
20
Sfextern_t _Sfextern =
 
21
{       0,                                              /* _Sfpage      */
 
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     */
 
28
          NIL(Sfwrite_f),
 
29
          NIL(Sfseek_f),
 
30
          NIL(Sfexcept_f),
 
31
          NIL(Sfdisc_t*)
 
32
        },
 
33
        NIL(void(*)_ARG_((void)) ),                     /* _Sfcleanup   */
 
34
        0,                                              /* _Sfexiting   */
 
35
        0,                                              /* _Sfdone      */
 
36
        &Sfonce,                                        /* _Sfonce      */
 
37
        _sfoncef,                                       /* _Sfoncef     */
 
38
        &Sfmutex                                        /* _Sfmutex     */
 
39
};
 
40
 
 
41
/* accessible to application code for a few fast macro functions */
 
42
ssize_t _Sfi = -1;
 
43
 
 
44
#if vt_threaded
 
45
static Vtmutex_t        _Sfmtxin, _Sfmtxout, _Sfmtxerr;
 
46
#define SFMTXIN         (&_Sfmtxin)
 
47
#define SFMTXOUT        (&_Sfmtxout)
 
48
#define SFMTXERR        (&_Sfmtxerr)
 
49
#else
 
50
#define SFMTXIN         (0)
 
51
#define SFMTXOUT        (0)
 
52
#define SFMTXERR        (0)
 
53
#endif
 
54
 
 
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);
 
61
 
 
62
Sfio_t* sfstdin  = &_Sfstdin;
 
63
Sfio_t* sfstdout = &_Sfstdout;
 
64
Sfio_t* sfstderr = &_Sfstderr;
 
65
 
 
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);