Annotation of researchv10no/cmd/odist/pax/include/stak.h, revision 1.1

1.1     ! root        1: #ifndef STAK_SMALL
        !             2: /*
        !             3:  * David Korn
        !             4:  * AT&T Bell Laboratories
        !             5:  *
        !             6:  * Interface definitions for a stack-like storage library
        !             7:  *
        !             8:  */
        !             9: 
        !            10: #if defined(__STDC__) || __cplusplus || c_plusplus
        !            11: #   define __ARGS(args)        args
        !            12: #else
        !            13: #    define const      /*empty*/
        !            14: #   define __ARGS(args)        ()
        !            15: #endif
        !            16: 
        !            17: typedef struct _stak_
        !            18: {
        !            19:        int             stakleft;       /* number of bytes left in frame */
        !            20:        char            *staktop;       /* current stack location */
        !            21:        char            *stakbot;       /* last returned stack location */
        !            22:        short           stakref;        /* reference count */
        !            23: #ifdef _STAK_PRIVATE
        !            24:        _STAK_PRIVATE
        !            25: #endif /* _STAK_PRIVATE */
        !            26: } Stak_t;
        !            27: 
        !            28: #define STAK_SMALL     1       /* argument to stakcreate */
        !            29: 
        !            30: #if __cplusplus
        !            31:     extern "C"
        !            32:     {
        !            33: #endif
        !            34:        extern Stak_t   *stakcreate __ARGS((int));
        !            35:        extern Stak_t   *stakinstall __ARGS((Stak_t*, char *(*)(int)));
        !            36:        extern int      stakdelete __ARGS((Stak_t*));
        !            37:        extern char     *stakalloc __ARGS((unsigned));
        !            38:        extern char     *stakcopy __ARGS((const char*));
        !            39:        extern char     *stakset __ARGS((char*, unsigned));
        !            40:        extern char     *stakseek __ARGS((unsigned));
        !            41:        extern int      stakputs __ARGS((const char*));
        !            42:        extern char     *stakfreeze __ARGS((unsigned));
        !            43:        extern char     *_stakgrow __ARGS((unsigned));
        !            44: #if __cplusplus
        !            45:     }
        !            46: #endif
        !            47: 
        !            48: extern Stak_t          _stak_cur;      /* used by macros */
        !            49: 
        !            50: #define        staklink(sp)    ((sp)->stakref++)
        !            51: #define        stakptr(n)      (_stak_cur.stakbot+(n))
        !            52: #define        staktell()      (_stak_cur.staktop-_stak_cur.stakbot)
        !            53: #define stakputc(c)    ((--_stak_cur.stakleft<0? _stakgrow(1):0), \
        !            54:                                        *_stak_cur.staktop++=(c))
        !            55: 
        !            56: #endif /* STAK_SMALL */

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.