Home | History | Annotate | Line # | Download | only in btree
btree.h revision 1.8
      1  1.8  cgd /*	$NetBSD: btree.h,v 1.8 1995/02/27 13:21:08 cgd Exp $	*/
      2  1.8  cgd 
      3  1.1  cgd /*-
      4  1.7  cgd  * Copyright (c) 1991, 1993, 1994
      5  1.2  cgd  *	The Regents of the University of California.  All rights reserved.
      6  1.1  cgd  *
      7  1.1  cgd  * This code is derived from software contributed to Berkeley by
      8  1.1  cgd  * Mike Olson.
      9  1.1  cgd  *
     10  1.1  cgd  * Redistribution and use in source and binary forms, with or without
     11  1.1  cgd  * modification, are permitted provided that the following conditions
     12  1.1  cgd  * are met:
     13  1.1  cgd  * 1. Redistributions of source code must retain the above copyright
     14  1.1  cgd  *    notice, this list of conditions and the following disclaimer.
     15  1.1  cgd  * 2. Redistributions in binary form must reproduce the above copyright
     16  1.1  cgd  *    notice, this list of conditions and the following disclaimer in the
     17  1.1  cgd  *    documentation and/or other materials provided with the distribution.
     18  1.1  cgd  * 3. All advertising materials mentioning features or use of this software
     19  1.1  cgd  *    must display the following acknowledgement:
     20  1.1  cgd  *	This product includes software developed by the University of
     21  1.1  cgd  *	California, Berkeley and its contributors.
     22  1.1  cgd  * 4. Neither the name of the University nor the names of its contributors
     23  1.1  cgd  *    may be used to endorse or promote products derived from this software
     24  1.1  cgd  *    without specific prior written permission.
     25  1.1  cgd  *
     26  1.1  cgd  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     27  1.1  cgd  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     28  1.1  cgd  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     29  1.1  cgd  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     30  1.1  cgd  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     31  1.1  cgd  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     32  1.1  cgd  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     33  1.1  cgd  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     34  1.1  cgd  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     35  1.1  cgd  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     36  1.1  cgd  * SUCH DAMAGE.
     37  1.2  cgd  *
     38  1.7  cgd  *	@(#)btree.h	8.6 (Berkeley) 5/31/94
     39  1.1  cgd  */
     40  1.1  cgd 
     41  1.2  cgd #include <mpool.h>
     42  1.1  cgd 
     43  1.2  cgd #define	DEFMINKEYPAGE	(2)		/* Minimum keys per page */
     44  1.2  cgd #define	MINCACHE	(5)		/* Minimum cached pages */
     45  1.2  cgd #define	MINPSIZE	(512)		/* Minimum page size */
     46  1.1  cgd 
     47  1.1  cgd /*
     48  1.2  cgd  * Page 0 of a btree file contains a copy of the meta-data.  This page is also
     49  1.2  cgd  * used as an out-of-band page, i.e. page pointers that point to nowhere point
     50  1.2  cgd  * to page 0.  Page 1 is the root of the btree.
     51  1.1  cgd  */
     52  1.2  cgd #define	P_INVALID	 0		/* Invalid tree page number. */
     53  1.2  cgd #define	P_META		 0		/* Tree metadata page number. */
     54  1.2  cgd #define	P_ROOT		 1		/* Tree root page number. */
     55  1.1  cgd 
     56  1.1  cgd /*
     57  1.2  cgd  * There are five page layouts in the btree: btree internal pages (BINTERNAL),
     58  1.2  cgd  * btree leaf pages (BLEAF), recno internal pages (RINTERNAL), recno leaf pages
     59  1.2  cgd  * (RLEAF) and overflow pages.  All five page types have a page header (PAGE).
     60  1.7  cgd  * This implementation requires that values within structures NOT be padded.
     61  1.2  cgd  * (ANSI C permits random padding.)  If your compiler pads randomly you'll have
     62  1.2  cgd  * to do some work to get this package to run.
     63  1.1  cgd  */
     64  1.4  cgd typedef struct _page {
     65  1.2  cgd 	pgno_t	pgno;			/* this page's page number */
     66  1.2  cgd 	pgno_t	prevpg;			/* left sibling */
     67  1.2  cgd 	pgno_t	nextpg;			/* right sibling */
     68  1.1  cgd 
     69  1.2  cgd #define	P_BINTERNAL	0x01		/* btree internal page */
     70  1.2  cgd #define	P_BLEAF		0x02		/* leaf page */
     71  1.2  cgd #define	P_OVERFLOW	0x04		/* overflow page */
     72  1.2  cgd #define	P_RINTERNAL	0x08		/* recno internal page */
     73  1.2  cgd #define	P_RLEAF		0x10		/* leaf page */
     74  1.2  cgd #define P_TYPE		0x1f		/* type mask */
     75  1.2  cgd #define	P_PRESERVE	0x20		/* never delete this chain of pages */
     76  1.7  cgd 	u_int32_t flags;
     77  1.1  cgd 
     78  1.2  cgd 	indx_t	lower;			/* lower bound of free space on page */
     79  1.2  cgd 	indx_t	upper;			/* upper bound of free space on page */
     80  1.7  cgd 	indx_t	linp[1];		/* indx_t-aligned VAR. LENGTH DATA */
     81  1.2  cgd } PAGE;
     82  1.1  cgd 
     83  1.2  cgd /* First and next index. */
     84  1.2  cgd #define	BTDATAOFF	(sizeof(pgno_t) + sizeof(pgno_t) + sizeof(pgno_t) + \
     85  1.7  cgd 			    sizeof(u_int32_t) + sizeof(indx_t) + sizeof(indx_t))
     86  1.2  cgd #define	NEXTINDEX(p)	(((p)->lower - BTDATAOFF) / sizeof(indx_t))
     87  1.1  cgd 
     88  1.1  cgd /*
     89  1.2  cgd  * For pages other than overflow pages, there is an array of offsets into the
     90  1.2  cgd  * rest of the page immediately following the page header.  Each offset is to
     91  1.2  cgd  * an item which is unique to the type of page.  The h_lower offset is just
     92  1.2  cgd  * past the last filled-in index.  The h_upper offset is the first item on the
     93  1.2  cgd  * page.  Offsets are from the beginning of the page.
     94  1.1  cgd  *
     95  1.2  cgd  * If an item is too big to store on a single page, a flag is set and the item
     96  1.2  cgd  * is a { page, size } pair such that the page is the first page of an overflow
     97  1.2  cgd  * chain with size bytes of item.  Overflow pages are simply bytes without any
     98  1.2  cgd  * external structure.
     99  1.1  cgd  *
    100  1.7  cgd  * The page number and size fields in the items are pgno_t-aligned so they can
    101  1.7  cgd  * be manipulated without copying.  (This presumes that 32 bit items can be
    102  1.7  cgd  * manipulated on this system.)
    103  1.1  cgd  */
    104  1.7  cgd #define	LALIGN(n) \
    105  1.7  cgd 	(((n) + sizeof(pgno_t) - 1) & ~(sizeof(pgno_t) - 1))
    106  1.7  cgd #define	NOVFLSIZE	(sizeof(pgno_t) + sizeof(u_int32_t))
    107  1.1  cgd 
    108  1.1  cgd /*
    109  1.2  cgd  * For the btree internal pages, the item is a key.  BINTERNALs are {key, pgno}
    110  1.2  cgd  * pairs, such that the key compares less than or equal to all of the records
    111  1.2  cgd  * on that page.  For a tree without duplicate keys, an internal page with two
    112  1.2  cgd  * consecutive keys, a and b, will have all records greater than or equal to a
    113  1.2  cgd  * and less than b stored on the page associated with a.  Duplicate keys are
    114  1.2  cgd  * somewhat special and can cause duplicate internal and leaf page records and
    115  1.2  cgd  * some minor modifications of the above rule.
    116  1.2  cgd  */
    117  1.4  cgd typedef struct _binternal {
    118  1.7  cgd 	u_int32_t ksize;		/* key size */
    119  1.2  cgd 	pgno_t	pgno;			/* page number stored on */
    120  1.2  cgd #define	P_BIGDATA	0x01		/* overflow data */
    121  1.2  cgd #define	P_BIGKEY	0x02		/* overflow key */
    122  1.2  cgd 	u_char	flags;
    123  1.2  cgd 	char	bytes[1];		/* data */
    124  1.2  cgd } BINTERNAL;
    125  1.2  cgd 
    126  1.2  cgd /* Get the page's BINTERNAL structure at index indx. */
    127  1.2  cgd #define	GETBINTERNAL(pg, indx) \
    128  1.2  cgd 	((BINTERNAL *)((char *)(pg) + (pg)->linp[indx]))
    129  1.2  cgd 
    130  1.2  cgd /* Get the number of bytes in the entry. */
    131  1.2  cgd #define NBINTERNAL(len) \
    132  1.7  cgd 	LALIGN(sizeof(u_int32_t) + sizeof(pgno_t) + sizeof(u_char) + (len))
    133  1.2  cgd 
    134  1.2  cgd /* Copy a BINTERNAL entry to the page. */
    135  1.7  cgd #define	WR_BINTERNAL(p, size, pgno, flags) {				\
    136  1.7  cgd 	*(u_int32_t *)p = size;						\
    137  1.7  cgd 	p += sizeof(u_int32_t);						\
    138  1.7  cgd 	*(pgno_t *)p = pgno;						\
    139  1.7  cgd 	p += sizeof(pgno_t);						\
    140  1.7  cgd 	*(u_char *)p = flags;						\
    141  1.7  cgd 	p += sizeof(u_char);						\
    142  1.2  cgd }
    143  1.2  cgd 
    144  1.2  cgd /*
    145  1.2  cgd  * For the recno internal pages, the item is a page number with the number of
    146  1.2  cgd  * keys found on that page and below.
    147  1.2  cgd  */
    148  1.4  cgd typedef struct _rinternal {
    149  1.2  cgd 	recno_t	nrecs;			/* number of records */
    150  1.2  cgd 	pgno_t	pgno;			/* page number stored below */
    151  1.2  cgd } RINTERNAL;
    152  1.2  cgd 
    153  1.2  cgd /* Get the page's RINTERNAL structure at index indx. */
    154  1.2  cgd #define	GETRINTERNAL(pg, indx) \
    155  1.2  cgd 	((RINTERNAL *)((char *)(pg) + (pg)->linp[indx]))
    156  1.2  cgd 
    157  1.2  cgd /* Get the number of bytes in the entry. */
    158  1.2  cgd #define NRINTERNAL \
    159  1.2  cgd 	LALIGN(sizeof(recno_t) + sizeof(pgno_t))
    160  1.2  cgd 
    161  1.2  cgd /* Copy a RINTERAL entry to the page. */
    162  1.2  cgd #define	WR_RINTERNAL(p, nrecs, pgno) { \
    163  1.2  cgd 	*(recno_t *)p = nrecs; \
    164  1.2  cgd 	p += sizeof(recno_t); \
    165  1.2  cgd 	*(pgno_t *)p = pgno; \
    166  1.2  cgd }
    167  1.2  cgd 
    168  1.2  cgd /* For the btree leaf pages, the item is a key and data pair. */
    169  1.4  cgd typedef struct _bleaf {
    170  1.7  cgd 	u_int32_t	ksize;		/* size of key */
    171  1.7  cgd 	u_int32_t	dsize;		/* size of data */
    172  1.2  cgd 	u_char	flags;			/* P_BIGDATA, P_BIGKEY */
    173  1.2  cgd 	char	bytes[1];		/* data */
    174  1.2  cgd } BLEAF;
    175  1.2  cgd 
    176  1.2  cgd /* Get the page's BLEAF structure at index indx. */
    177  1.2  cgd #define	GETBLEAF(pg, indx) \
    178  1.2  cgd 	((BLEAF *)((char *)(pg) + (pg)->linp[indx]))
    179  1.2  cgd 
    180  1.2  cgd /* Get the number of bytes in the entry. */
    181  1.2  cgd #define NBLEAF(p)	NBLEAFDBT((p)->ksize, (p)->dsize)
    182  1.2  cgd 
    183  1.2  cgd /* Get the number of bytes in the user's key/data pair. */
    184  1.2  cgd #define NBLEAFDBT(ksize, dsize) \
    185  1.7  cgd 	LALIGN(sizeof(u_int32_t) + sizeof(u_int32_t) + sizeof(u_char) + \
    186  1.2  cgd 	    (ksize) + (dsize))
    187  1.2  cgd 
    188  1.2  cgd /* Copy a BLEAF entry to the page. */
    189  1.7  cgd #define	WR_BLEAF(p, key, data, flags) {					\
    190  1.7  cgd 	*(u_int32_t *)p = key->size;					\
    191  1.7  cgd 	p += sizeof(u_int32_t);						\
    192  1.7  cgd 	*(u_int32_t *)p = data->size;					\
    193  1.7  cgd 	p += sizeof(u_int32_t);						\
    194  1.7  cgd 	*(u_char *)p = flags;						\
    195  1.7  cgd 	p += sizeof(u_char);						\
    196  1.7  cgd 	memmove(p, key->data, key->size);				\
    197  1.7  cgd 	p += key->size;							\
    198  1.7  cgd 	memmove(p, data->data, data->size);				\
    199  1.2  cgd }
    200  1.2  cgd 
    201  1.2  cgd /* For the recno leaf pages, the item is a data entry. */
    202  1.4  cgd typedef struct _rleaf {
    203  1.7  cgd 	u_int32_t	dsize;		/* size of data */
    204  1.2  cgd 	u_char	flags;			/* P_BIGDATA */
    205  1.2  cgd 	char	bytes[1];
    206  1.2  cgd } RLEAF;
    207  1.2  cgd 
    208  1.2  cgd /* Get the page's RLEAF structure at index indx. */
    209  1.2  cgd #define	GETRLEAF(pg, indx) \
    210  1.2  cgd 	((RLEAF *)((char *)(pg) + (pg)->linp[indx]))
    211  1.2  cgd 
    212  1.2  cgd /* Get the number of bytes in the entry. */
    213  1.2  cgd #define NRLEAF(p)	NRLEAFDBT((p)->dsize)
    214  1.2  cgd 
    215  1.2  cgd /* Get the number of bytes from the user's data. */
    216  1.2  cgd #define	NRLEAFDBT(dsize) \
    217  1.7  cgd 	LALIGN(sizeof(u_int32_t) + sizeof(u_char) + (dsize))
    218  1.2  cgd 
    219  1.2  cgd /* Copy a RLEAF entry to the page. */
    220  1.7  cgd #define	WR_RLEAF(p, data, flags) {					\
    221  1.7  cgd 	*(u_int32_t *)p = data->size;					\
    222  1.7  cgd 	p += sizeof(u_int32_t);						\
    223  1.7  cgd 	*(u_char *)p = flags;						\
    224  1.7  cgd 	p += sizeof(u_char);						\
    225  1.7  cgd 	memmove(p, data->data, data->size);				\
    226  1.2  cgd }
    227  1.2  cgd 
    228  1.2  cgd /*
    229  1.2  cgd  * A record in the tree is either a pointer to a page and an index in the page
    230  1.2  cgd  * or a page number and an index.  These structures are used as a cursor, stack
    231  1.2  cgd  * entry and search returns as well as to pass records to other routines.
    232  1.1  cgd  *
    233  1.2  cgd  * One comment about searches.  Internal page searches must find the largest
    234  1.2  cgd  * record less than key in the tree so that descents work.  Leaf page searches
    235  1.2  cgd  * must find the smallest record greater than key so that the returned index
    236  1.2  cgd  * is the record's correct position for insertion.
    237  1.1  cgd  *
    238  1.2  cgd  * One comment about cursors.  The cursor key is never removed from the tree,
    239  1.2  cgd  * even if deleted.  This is because it is quite difficult to decide where the
    240  1.2  cgd  * cursor should be when other keys have been inserted/deleted in the tree;
    241  1.2  cgd  * duplicate keys make it impossible.  This scheme does require extra work
    242  1.2  cgd  * though, to make sure that we don't perform an operation on a deleted key.
    243  1.2  cgd  */
    244  1.4  cgd typedef struct _epgno {
    245  1.2  cgd 	pgno_t	pgno;			/* the page number */
    246  1.2  cgd 	indx_t	index;			/* the index on the page */
    247  1.2  cgd } EPGNO;
    248  1.2  cgd 
    249  1.4  cgd typedef struct _epg {
    250  1.2  cgd 	PAGE	*page;			/* the (pinned) page */
    251  1.2  cgd 	indx_t	 index;			/* the index on the page */
    252  1.2  cgd } EPG;
    253  1.2  cgd 
    254  1.2  cgd /*
    255  1.2  cgd  * The metadata of the tree.  The m_nrecs field is used only by the RECNO code.
    256  1.2  cgd  * This is because the btree doesn't really need it and it requires that every
    257  1.2  cgd  * put or delete call modify the metadata.
    258  1.1  cgd  */
    259  1.4  cgd typedef struct _btmeta {
    260  1.7  cgd 	u_int32_t	m_magic;	/* magic number */
    261  1.7  cgd 	u_int32_t	m_version;	/* version */
    262  1.7  cgd 	u_int32_t	m_psize;	/* page size */
    263  1.7  cgd 	u_int32_t	m_free;		/* page number of first free page */
    264  1.7  cgd 	u_int32_t	m_nrecs;	/* R: number of records */
    265  1.2  cgd #define	SAVEMETA	(B_NODUPS | R_RECNO)
    266  1.7  cgd 	u_int32_t	m_flags;	/* bt_flags & SAVEMETA */
    267  1.7  cgd 	u_int32_t	m_unused;	/* unused */
    268  1.2  cgd } BTMETA;
    269  1.1  cgd 
    270  1.2  cgd /* The in-memory btree/recno data structure. */
    271  1.4  cgd typedef struct _btree {
    272  1.2  cgd 	MPOOL	*bt_mp;			/* memory pool cookie */
    273  1.2  cgd 
    274  1.2  cgd 	DB	*bt_dbp;		/* pointer to enclosing DB */
    275  1.2  cgd 
    276  1.5  cgd 	EPG	bt_cur;			/* current (pinned) page */
    277  1.4  cgd 	PAGE	*bt_pinned;		/* page pinned across calls */
    278  1.4  cgd 
    279  1.2  cgd 	EPGNO	bt_bcursor;		/* B: btree cursor */
    280  1.2  cgd 	recno_t	bt_rcursor;		/* R: recno cursor (1-based) */
    281  1.2  cgd 
    282  1.2  cgd #define	BT_POP(t)	(t->bt_sp ? t->bt_stack + --t->bt_sp : NULL)
    283  1.2  cgd #define	BT_CLR(t)	(t->bt_sp = 0)
    284  1.2  cgd 	EPGNO	*bt_stack;		/* stack of parent pages */
    285  1.2  cgd 	u_int	bt_sp;			/* current stack pointer */
    286  1.2  cgd 	u_int	bt_maxstack;		/* largest stack */
    287  1.2  cgd 
    288  1.2  cgd 	char	*bt_kbuf;		/* key buffer */
    289  1.2  cgd 	size_t	bt_kbufsz;		/* key buffer size */
    290  1.2  cgd 	char	*bt_dbuf;		/* data buffer */
    291  1.2  cgd 	size_t	bt_dbufsz;		/* data buffer size */
    292  1.2  cgd 
    293  1.2  cgd 	int	bt_fd;			/* tree file descriptor */
    294  1.2  cgd 
    295  1.2  cgd 	pgno_t	bt_free;		/* next free page */
    296  1.7  cgd 	u_int32_t bt_psize;		/* page size */
    297  1.2  cgd 	indx_t	bt_ovflsize;		/* cut-off for key/data overflow */
    298  1.2  cgd 	int	bt_lorder;		/* byte order */
    299  1.2  cgd 					/* sorted order */
    300  1.6  cgd 	enum { NOT, BACK, FORWARD } bt_order;
    301  1.2  cgd 	EPGNO	bt_last;		/* last insert */
    302  1.2  cgd 
    303  1.2  cgd 					/* B: key comparison function */
    304  1.2  cgd 	int	(*bt_cmp) __P((const DBT *, const DBT *));
    305  1.2  cgd 					/* B: prefix comparison function */
    306  1.7  cgd 	size_t	(*bt_pfx) __P((const DBT *, const DBT *));
    307  1.2  cgd 					/* R: recno input function */
    308  1.4  cgd 	int	(*bt_irec) __P((struct _btree *, recno_t));
    309  1.2  cgd 
    310  1.2  cgd 	FILE	*bt_rfp;		/* R: record FILE pointer */
    311  1.2  cgd 	int	bt_rfd;			/* R: record file descriptor */
    312  1.2  cgd 
    313  1.2  cgd 	caddr_t	bt_cmap;		/* R: current point in mapped space */
    314  1.2  cgd 	caddr_t	bt_smap;		/* R: start of mapped space */
    315  1.2  cgd 	caddr_t bt_emap;		/* R: end of mapped space */
    316  1.2  cgd 	size_t	bt_msize;		/* R: size of mapped region. */
    317  1.2  cgd 
    318  1.2  cgd 	recno_t	bt_nrecs;		/* R: number of records */
    319  1.2  cgd 	size_t	bt_reclen;		/* R: fixed record length */
    320  1.2  cgd 	u_char	bt_bval;		/* R: delimiting byte/pad character */
    321  1.2  cgd 
    322  1.2  cgd /*
    323  1.2  cgd  * NB:
    324  1.2  cgd  * B_NODUPS and R_RECNO are stored on disk, and may not be changed.
    325  1.2  cgd  */
    326  1.2  cgd #define	B_DELCRSR	0x00001		/* cursor has been deleted */
    327  1.2  cgd #define	B_INMEM		0x00002		/* in-memory tree */
    328  1.2  cgd #define	B_METADIRTY	0x00004		/* need to write metadata */
    329  1.2  cgd #define	B_MODIFIED	0x00008		/* tree modified */
    330  1.2  cgd #define	B_NEEDSWAP	0x00010		/* if byte order requires swapping */
    331  1.2  cgd #define	B_NODUPS	0x00020		/* no duplicate keys permitted */
    332  1.2  cgd #define	B_RDONLY	0x00040		/* read-only tree */
    333  1.4  cgd #define	R_RECNO		0x00080		/* record oriented tree */
    334  1.2  cgd #define	B_SEQINIT	0x00100		/* sequential scan initialized */
    335  1.2  cgd 
    336  1.2  cgd #define	R_CLOSEFP	0x00200		/* opened a file pointer */
    337  1.2  cgd #define	R_EOF		0x00400		/* end of input file reached. */
    338  1.2  cgd #define	R_FIXLEN	0x00800		/* fixed length records */
    339  1.2  cgd #define	R_MEMMAPPED	0x01000		/* memory mapped file. */
    340  1.2  cgd #define	R_INMEM		0x02000		/* in-memory file */
    341  1.2  cgd #define	R_MODIFIED	0x04000		/* modified file */
    342  1.2  cgd #define	R_RDONLY	0x08000		/* read-only file */
    343  1.4  cgd 
    344  1.4  cgd #define	B_DB_LOCK	0x10000		/* DB_LOCK specified. */
    345  1.4  cgd #define	B_DB_SHMEM	0x20000		/* DB_SHMEM specified. */
    346  1.4  cgd #define	B_DB_TXN	0x40000		/* DB_TXN specified. */
    347  1.2  cgd 
    348  1.7  cgd 	u_int32_t	bt_flags;	/* btree state */
    349  1.2  cgd } BTREE;
    350  1.2  cgd 
    351  1.2  cgd #define	SET(t, f)	((t)->bt_flags |= (f))
    352  1.2  cgd #define	CLR(t, f)	((t)->bt_flags &= ~(f))
    353  1.2  cgd #define	ISSET(t, f)	((t)->bt_flags & (f))
    354  1.1  cgd 
    355  1.2  cgd #include "extern.h"
    356