w32tex
About: TeX Live provides a comprehensive TeX system including all the major TeX-related programs, macro packages, and fonts that are free software. Windows sources.
  Fossies Dox: w32tex-src.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

sh12.c File Reference
#include <sys/types.h>
#include <sys/stat.h>
#include <stdio.h>
#include <string.h>
#include <setjmp.h>
#include <unistd.h>
#include <limits.h>
#include "sh.h"
Include dependency graph for sh12.c:

Go to the source code of this file.

Classes

struct  node_s
 

Macros

#define L   ((_SibIndex_t) 0)
 
#define R   ((_SibIndex_t) 1)
 
#define LEFT   sibls[L]/* left sibling pointer _ts_NODE_t field */
 
#define RIGHT   sibls[R]/* right sibling pointer _ts_NODE_t field */
 
#define direction(p, c)   ((_SibIndex_t) ((p)->RIGHT == (c)))
 
#define cmp_dir(v)   ((_SibIndex_t) ((v) > 0))
 
#define siblingp(n, d)   ((n)->sibls + (d))
 
#define parentp(r, n)
 
#define dir_bal(d)   ((d) == L ? -1 : 1)
 

Typedefs

typedef struct node_s _ts_NODE_t
 
typedef int _SibIndex_t
 

Functions

static _ts_NODE_tbalance (_ts_NODE_t **, _ts_NODE_t *, int)
 
static _ts_NODE_tsingle_rotation (_ts_NODE_t **, _ts_NODE_t *, _ts_NODE_t *, _SibIndex_t)
 
static _ts_NODE_tdouble_rotation (_ts_NODE_t **, _ts_NODE_t *, _ts_NODE_t *, _SibIndex_t)
 
voidtsearch (void *key, void **root, int *compar)
 
voidtdelete (void *key, void **root, int *compar)
 
voidtfind (void *key, void **root, int *compar)
 
void twalk (void *start, void *action) const
 

Macro Definition Documentation

◆ cmp_dir

#define cmp_dir (   v)    ((_SibIndex_t) ((v) > 0))

Definition at line 115 of file sh12.c.

◆ dir_bal

#define dir_bal (   d)    ((d) == L ? -1 : 1)

Definition at line 134 of file sh12.c.

◆ direction

#define direction (   p,
  c 
)    ((_SibIndex_t) ((p)->RIGHT == (c)))

Definition at line 109 of file sh12.c.

◆ L

#define L   ((_SibIndex_t) 0)

Definition at line 98 of file sh12.c.

◆ LEFT

#define LEFT   sibls[L]/* left sibling pointer _ts_NODE_t field */

Definition at line 101 of file sh12.c.

◆ parentp

#define parentp (   r,
  n 
)
Value:
((n)->parent == (_ts_NODE_t *)NULL ? (r) : \
siblingp((n)->parent, direction((n)->parent, (n))))
#define n
Definition: t4ht.c:1290
#define NULL
Definition: ftobjs.h:61
int r
Definition: ppmqvga.c:68
#define parent(a, t)
Definition: interp.c:105
#define direction(p, c)
Definition: sh12.c:109
#define siblingp(n, d)
Definition: sh12.c:121
Definition: sh12.c:90

Definition at line 127 of file sh12.c.

◆ R

#define R   ((_SibIndex_t) 1)

Definition at line 99 of file sh12.c.

◆ RIGHT

#define RIGHT   sibls[R]/* right sibling pointer _ts_NODE_t field */

Definition at line 102 of file sh12.c.

◆ siblingp

#define siblingp (   n,
  d 
)    ((n)->sibls + (d))

Definition at line 121 of file sh12.c.

Typedef Documentation

◆ _SibIndex_t

typedef int _SibIndex_t

Definition at line 97 of file sh12.c.

◆ _ts_NODE_t

typedef struct node_s _ts_NODE_t

Function Documentation

◆ balance()

◆ double_rotation()

static _ts_NODE_t * double_rotation ( _ts_NODE_t **  rootp,
_ts_NODE_t sb,
_ts_NODE_t sb_next,
_SibIndex_t  d 
)
static

Definition at line 403 of file sh12.c.

References node_s::balance, d, NULL, node_s::parent, parent, parentp, and siblingp.

Referenced by balance().

◆ single_rotation()

static _ts_NODE_t * single_rotation ( _ts_NODE_t **  rootp,
_ts_NODE_t sb,
_ts_NODE_t sb_next,
_SibIndex_t  d 
)
static

Definition at line 367 of file sh12.c.

References node_s::balance, d, NULL, node_s::parent, parent, parentp, and siblingp.

Referenced by balance().

◆ tdelete()

void* tdelete ( void key,
void **  root,
int compar 
)

◆ tfind()

void* tfind ( void key,
void **  root,
int compar 
)

Definition at line 447 of file sh12.c.

References cmp(), cmp_dir, key, NULL, root, and siblingp.

◆ tsearch()

void* tsearch ( void key,
void **  root,
int compar 
)

◆ twalk()

void twalk ( void start,
void action 
) const

Definition at line 480 of file sh12.c.

References direction, endorder, L, leaf, level, NULL, postorder, preorder, start, and mpark::visit().