Annotation of sbbs/sbbs3/ringbuf.h, revision 1.1

1.1     ! root        1: /* ringbuf.h */
        !             2: 
        !             3: /* Synchronet ring buffer routines */
        !             4: 
        !             5: /* $Id: ringbuf.h,v 1.2 2000/10/21 02:58:16 rswindell Exp $ */
        !             6: 
        !             7: /****************************************************************************
        !             8:  * @format.tab-size 4          (Plain Text/Source Code File Header)                    *
        !             9:  * @format.use-tabs true       (see http://www.synchro.net/ptsc_hdr.html)              *
        !            10:  *                                                                                                                                                     *
        !            11:  * Copyright 2000 Rob Swindell - http://www.synchro.net/copyright.html         *
        !            12:  *                                                                                                                                                     *
        !            13:  * This program is free software; you can redistribute it and/or                       *
        !            14:  * modify it under the terms of the GNU General Public License                         *
        !            15:  * as published by the Free Software Foundation; either version 2                      *
        !            16:  * of the License, or (at your option) any later version.                                      *
        !            17:  * See the GNU General Public License for more details: gpl.txt or                     *
        !            18:  * http://www.fsf.org/copyleft/gpl.html                                                                                *
        !            19:  *                                                                                                                                                     *
        !            20:  * Anonymous FTP access to the most recent released source is available at     *
        !            21:  * ftp://vert.synchro.net, ftp://cvs.synchro.net and ftp://ftp.synchro.net     *
        !            22:  *                                                                                                                                                     *
        !            23:  * Anonymous CVS access to the development source and modification history     *
        !            24:  * is available at cvs.synchro.net:/cvsroot/sbbs, example:                                     *
        !            25:  * cvs -d :pserver:[email protected]:/cvsroot/sbbs login                       *
        !            26:  *     (just hit return, no password is necessary)                                                     *
        !            27:  * cvs -d :pserver:[email protected]:/cvsroot/sbbs checkout src                *
        !            28:  *                                                                                                                                                     *
        !            29:  * For Synchronet coding style and modification guidelines, see                                *
        !            30:  * http://www.synchro.net/source.html                                                                          *
        !            31:  *                                                                                                                                                     *
        !            32:  * You are encouraged to submit any modifications (preferably in Unix diff     *
        !            33:  * format) via e-mail to [email protected]                                                                      *
        !            34:  *                                                                                                                                                     *
        !            35:  * Note: If this box doesn't appear square, then you need to fix your tabs.    *
        !            36:  ****************************************************************************/
        !            37: 
        !            38: 
        !            39: // Pre-define RINGBUF_USE_STD_RTL to use standard C runtime library symbols
        !            40: // for malloc, free, and memcpy
        !            41: 
        !            42: #ifndef _RINGBUF_H_
        !            43: #define _RINGBUF_H_
        !            44: 
        !            45: #ifndef DWORD
        !            46: #define DWORD unsigned long
        !            47: #endif
        !            48: 
        !            49: #ifndef BYTE
        !            50: #define BYTE unsigned char
        !            51: #endif
        !            52: 
        !            53: #ifndef NULL
        !            54: #define NULL   0
        !            55: #endif
        !            56: 
        !            57: #define RINGBUF_USE_STD_RTL
        !            58: 
        !            59: #if defined(_WIN32) && !defined(__GNUC__)
        !            60: #define RINGBUFCALL    _cdecl
        !            61: #else
        !            62: #define RINGBUFCALL
        !            63: #endif
        !            64: 
        !            65: /************/
        !            66: /* Typedefs */
        !            67: /************/
        !            68: 
        !            69: typedef struct {
        !            70: 
        !            71:        BYTE*   pStart;                 /* buffer must be accessable at interrupt time */
        !            72:        BYTE*   pHead;                  /* next space available for data */
        !            73:        BYTE*   pTail;                  /* next byte to be consumed */
        !            74:        BYTE*   pEnd;                   /* end of the buffer, used for wrap around */
        !            75:     DWORD      size;
        !            76: 
        !            77: } RingBuf;
        !            78: 
        !            79: #ifdef __cplusplus
        !            80: extern "C" {
        !            81: #endif
        !            82: 
        !            83: /***********************/
        !            84: /* Function Prototypes */
        !            85: /***********************/
        !            86: 
        !            87: int    RINGBUFCALL RingBufInit( RingBuf* rb, DWORD size
        !            88: #ifndef RINGBUF_USE_STD_RTL
        !            89:                        ,void *(os_malloc)(size_t)
        !            90:                        ,void (os_free)(void *)
        !            91:                        ,void *(os_memcpy)(void *, const void *, size_t)
        !            92: #endif
        !            93:                        );
        !            94: void   RINGBUFCALL RingBufDispose( RingBuf* rb );
        !            95: DWORD  RINGBUFCALL RingBufFull( RingBuf* rb );
        !            96: DWORD  RINGBUFCALL RingBufFree( RingBuf* rb );
        !            97: DWORD  RINGBUFCALL RingBufWrite( RingBuf* rb, BYTE *src,       DWORD cnt );
        !            98: DWORD  RINGBUFCALL RingBufRead( RingBuf* rb, BYTE *dst,  DWORD cnt );
        !            99: DWORD  RINGBUFCALL RingBufPeek( RingBuf* rb, BYTE *dst,  DWORD cnt );
        !           100: void   RINGBUFCALL RingBufReInit( RingBuf* rb );
        !           101: 
        !           102: #ifdef __cplusplus
        !           103: }
        !           104: #endif
        !           105: 
        !           106: #endif // Don't add anything afterthis endif

unix.superglobalmegacorp.com

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