pike.git / src / rbtree_low.h

version» Context lines:

pike.git/src/rbtree_low.h:1:   /*   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: rbtree_low.h,v 1.10 2009/04/06 00:34:16 mast Exp $ + || $Id$   */      /* The lower level api for using rbtree. This is in a separate file    * since it's quite macro heavy.    *    * Created 2001-04-27 by Martin Stjernholm    */      #ifndef RBTREE_LOW_H   #define RBTREE_LOW_H
pike.git/src/rbtree_low.h:34:    struct rbstack_slice *up;    struct rb_node_hdr *stack[STACK_SLICE_SIZE];   };      struct rbstack_ptr   {    struct rbstack_slice *slice;    size_t ssp; /* Only zero when the stack is empty. */   };    - void rbstack_push (struct rbstack_ptr *rbstack, struct rb_node_hdr *node); - void rbstack_pop (struct rbstack_ptr *rbstack); - void rbstack_up (struct rbstack_ptr *rbstack); - void rbstack_up_to_root (struct rbstack_ptr *rbstack); - void rbstack_free (struct rbstack_ptr *rbstack); + void rbstack_low_push (struct rbstack_ptr *rbstack, struct rb_node_hdr *node); + void rbstack_low_pop (struct rbstack_ptr *rbstack); + void rbstack_low_up (struct rbstack_ptr *rbstack); + void rbstack_low_up_to_root (struct rbstack_ptr *rbstack); + void rbstack_low_free (struct rbstack_ptr *rbstack);   void rbstack_insert (struct rbstack_ptr *top, struct rbstack_ptr *pos,    struct rb_node_hdr *node);   void rbstack_assign (struct rbstack_ptr *target, struct rbstack_ptr *source);   void rbstack_copy (struct rbstack_ptr *target, struct rbstack_ptr *source);   void rbstack_shift (struct rbstack_ptr rbstack,    struct rb_node_hdr *oldbase,    struct rb_node_hdr *newbase);      #define RBSTACK_INIT(rbstack) \    struct rbstack_slice PIKE_CONCAT3 (_, rbstack, _top_) = { \
pike.git/src/rbtree_low.h:63:    struct rbstack_ptr rbstack = { \    NULL, \    0 \    }; \    rbstack.slice = &PIKE_CONCAT3 (_, rbstack, _top_)      #define RBSTACK_PUSH(rbstack, node) do { \    if ((rbstack).ssp < STACK_SLICE_SIZE) { \    (rbstack).slice->stack[(rbstack).ssp++] = (node); \    } \ -  else rbstack_push (&(rbstack), node); \ +  else rbstack_low_push (&(rbstack), node); \    DO_IF_RB_STATS ( \    if (++(rbstack).slice->depth > (rbstack).slice->maxdepth) \    (rbstack).slice->maxdepth = (rbstack).slice->depth; \    ); \    } while (0)      #define RBSTACK_POP(rbstack, node) do { \    if ((rbstack).ssp) { \    (node) = (rbstack).slice->stack[--(rbstack).ssp]; \    DO_IF_RB_STATS ((rbstack).slice->depth--); \    if (!(rbstack).ssp && (rbstack).slice->up) \ -  rbstack_pop (&(rbstack)); \ +  rbstack_low_pop (&(rbstack)); \    } \    else (node) = NULL; \    } while (0)      #define RBSTACK_POP_IGNORE(rbstack) do { \    if ((rbstack).ssp && !--(rbstack).ssp) { \    DO_IF_RB_STATS ((rbstack).slice->depth--); \    if ((rbstack).slice->up) \ -  rbstack_pop (&(rbstack)); \ +  rbstack_low_pop (&(rbstack)); \    } \    } while (0)      #define RBSTACK_UP(rbstack, node) do { \    if ((rbstack).ssp) { \    (node) = (rbstack).slice->stack[--(rbstack).ssp]; \    if (!(rbstack).ssp && (rbstack).slice->up) \ -  rbstack_up (&(rbstack)); \ +  rbstack_low_up (&(rbstack)); \    } \    else (node) = NULL; \    } while (0)      #define RBSTACK_UP_IGNORE(rbstack) do { \    if ((rbstack).ssp && !--(rbstack).ssp && (rbstack).slice->up) \ -  rbstack_up (&(rbstack)); \ +  rbstack_low_up (&(rbstack)); \    } while (0)      #define RBSTACK_PEEK(rbstack) \    ((rbstack).ssp ? (rbstack).slice->stack[(rbstack).ssp - 1] : NULL)      #define RBSTACK_POKE(rbstack, node) do { \    DO_IF_DEBUG (if (!(rbstack).ssp) Pike_fatal ("Using free stack pointer.\n")); \    (rbstack).slice->stack[(rbstack).ssp - 1] = (node); \    } while (0)      #define RBSTACK_UP_TO_ROOT(rbstack, node) do { \    if ((rbstack).ssp) { \ -  rbstack_up_to_root (&(rbstack)); \ +  rbstack_low_up_to_root (&(rbstack)); \    (node) = (rbstack).slice->stack[0]; \    } \    } while (0)      #define RBSTACK_FREE(rbstack) do { \    if ((rbstack).ssp) { \ -  if ((rbstack).slice->up) rbstack_free (&(rbstack)); \ +  if ((rbstack).slice->up) rbstack_low_free (&(rbstack)); \    (rbstack).ssp = 0; \    } \    DO_IF_RB_STATS ( \    rb_num_tracks++; \    rb_track_depth += (rbstack).slice->maxdepth; \    if ((rbstack).slice->maxdepth > rb_max_depth) \    rb_max_depth = (rbstack).slice->maxdepth; \    (rbstack).slice->depth = (rbstack).slice->maxdepth = 0; \    ); \    } while (0)      #define RBSTACK_FREE_SET_ROOT(rbstack, node) do { \    if ((rbstack).ssp) { \ -  if ((rbstack).slice->up) rbstack_free (&(rbstack)); \ +  if ((rbstack).slice->up) rbstack_low_free (&(rbstack)); \    (rbstack).ssp = 0; \    (node) = (rbstack).slice->stack[0]; \    } \    DO_IF_RB_STATS ( \    rb_num_tracks++; \    rb_track_depth += (rbstack).slice->maxdepth; \    if ((rbstack).slice->maxdepth > rb_max_depth) \    rb_max_depth = (rbstack).slice->maxdepth; \    (rbstack).slice->depth = (rbstack).slice->maxdepth = 0; \    ); \