.fp 5 CW
.de Af
.ds ;G \\*(;G\\f\\$1\\$3\\f\\$2
.if !\\$4 .Af \\$2 \\$1 "\\$4" "\\$5" "\\$6" "\\$7" "\\$8" "\\$9"
..
.de aF
.ie \\$3 .ft \\$1
.el \{\
.ds ;G \&
.nr ;G \\n(.f
.Af "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7" "\\$8" "\\$9"
\\*(;G
.ft \\n(;G \}
..
.de L
.aF 5 \\n(.f "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7"
..
.de LR
.aF 5 1 "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7"
..
.de RL
.aF 1 5 "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7"
..
.de EX \" start example
.ta 1i 2i 3i 4i 5i 6i
.PP
.RS
.PD 0
.ft 5
.nf
..
.de EE \" end example
.fi
.ft
.PD
.RE
.PP
..
.TH TAB 3
.SH NAME
tab \- simple table lookup routines
.SH SYNOPSIS
.L "#include <ast.h>"
.sp
.L "int tabindex(const void* tab, int size, const char* name);"
.L "void* tablook(const void* tab, int size, const char* name);"
.SH DESCRIPTION
These routines do linear lookups in
.I small
tables (on the order of 32 elements).
Each table element has a size of
.L size
bytes and the beginning of the element points to a name that is
matched by the lookup routines.
.PP
.L tabindex
returns the index of the table element in
.L tab
that matches
.LR name .
If there is no match then
.L \-1
is returned.
.PP
.L tablook
returns a pointer to the table element in
.L tab
that matches
.LR name .
If there is no match then
.L 0
is returned.
.SH "SEE ALSO"
hash(3)