Annotation of embedaddon/php/ext/xmlrpc/libxmlrpc/queue.h, revision 1.1

1.1     ! misho       1: /* 
        !             2:  * Date last modified: Jan 2001
        !             3:  * Modifications by Dan Libby (dan@libby.com), including:
        !             4:  *  - various fixes, null checks, etc
        !             5:  *  - addition of Q_Iter funcs, macros
        !             6:  */
        !             7: 
        !             8: /*
        !             9:  *  File : q.h
        !            10:  *
        !            11:  *  Peter Yard  02 Jan 1993.
        !            12:  *
        !            13:  *  Disclaimer: This code is released to the public domain.
        !            14:  */
        !            15: 
        !            16: #ifndef Q__H
        !            17: #define Q__H
        !            18: 
        !            19: #ifndef False_
        !            20:    #define False_ 0
        !            21: #endif
        !            22: 
        !            23: #ifndef True_
        !            24:    #define True_ 1
        !            25: #endif
        !            26: 
        !            27: typedef struct nodeptr datanode;
        !            28: 
        !            29: typedef struct nodeptr {
        !            30:    void        *data ;
        !            31:    datanode    *prev, *next ;
        !            32: } node ;
        !            33: 
        !            34: /* For external use with Q_Iter* funcs */
        !            35: typedef struct nodeptr* q_iter;
        !            36: 
        !            37: typedef struct {
        !            38:    node        *head, *tail, *cursor;
        !            39:    int         size, sorted, item_deleted;
        !            40: } queue;
        !            41: 
        !            42: typedef  struct {
        !            43:    void        *dataptr;
        !            44:    node        *loc ;
        !            45: } index_elt ;
        !            46: 
        !            47: 
        !            48: int    Q_Init(queue  *q);
        !            49: void   Q_Destroy(queue *q);
        !            50: int    Q_IsEmpty(queue *q);
        !            51: int    Q_Size(queue *q);
        !            52: int    Q_AtHead(queue *q);
        !            53: int    Q_AtTail(queue *q);
        !            54: int    Q_PushHead(queue *q, void *d);
        !            55: int    Q_PushTail(queue *q, void *d);
        !            56: void  *Q_Head(queue *q);
        !            57: void  *Q_Tail(queue *q);
        !            58: void  *Q_PopHead(queue *q);
        !            59: void  *Q_PopTail(queue *q);
        !            60: void  *Q_Next(queue *q);
        !            61: void  *Q_Previous(queue *q);
        !            62: void  *Q_DelCur(queue *q);
        !            63: void  *Q_Get(queue *q);
        !            64: int    Q_Put(queue *q, void *data);
        !            65: int    Q_Sort(queue *q, int (*Comp)(const void *, const void *));
        !            66: int    Q_Find(queue *q, void *data,
        !            67:               int (*Comp)(const void *, const void *));
        !            68: void  *Q_Seek(queue *q, void *data,
        !            69:               int (*Comp)(const void *, const void *));
        !            70: int    Q_Insert(queue *q, void *data,
        !            71:                 int (*Comp)(const void *, const void *));
        !            72: 
        !            73: /* read only funcs for iterating through queue. above funcs modify queue */
        !            74: q_iter Q_Iter_Head(queue *q);
        !            75: q_iter Q_Iter_Tail(queue *q);
        !            76: q_iter Q_Iter_Next(q_iter qi);
        !            77: q_iter Q_Iter_Prev(q_iter qi);
        !            78: void*  Q_Iter_Get(q_iter qi);
        !            79: int    Q_Iter_Put(q_iter qi, void* data); /* not read only! here for completeness. */
        !            80: void*  Q_Iter_Del(queue *q, q_iter iter); /* not read only! here for completeness. */
        !            81: 
        !            82: /* Fast (macro'd) versions of above */
        !            83: #define Q_Iter_Head_F(q) (q ? (q_iter)((queue*)q)->head : NULL)
        !            84: #define Q_Iter_Tail_F(q) (q ? (q_iter)((queue*)q)->tail : NULL)
        !            85: #define Q_Iter_Next_F(qi) (qi ? (q_iter)((node*)qi)->next : NULL)
        !            86: #define Q_Iter_Prev_F(qi) (qi ? (q_iter)((node*)qi)->prev : NULL)
        !            87: #define Q_Iter_Get_F(qi) (qi ? ((node*)qi)->data : NULL)
        !            88: 
        !            89: #endif /* Q__H */

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>