Alien-Judy

 view release on metacpan or  search on metacpan

src/judy-1.0.5/doc/ext/Judy1_3.htm  view on Meta::CPAN

<HTML>
<HEAD>
<!-- @(#) $Revision: 4.48 $ $Source: /cvsroot/judy/judy/doc/ext/Judy1_3.htm,v $ --->
<TITLE>Judy1(3)</TITLE>
</HEAD>

<BODY>
<TABLE border=0 width="100%"><TR>
<TD width="40%" align="left">Judy1(3)</TD>
<TD width="10%" align="center">     </TD>
<TD width="40%" align="right">Judy1(3)</TD>
</TR></TABLE>
<P>
<DL>
<!----------------->
<DT><B>NAME</B></DT>
<DD>
Judy1 macros -
C library for creating and accessing a dynamic array of bits, using
any value of a word as an index.
<!----------------->
<P>
<DT><B>SYNOPSIS</B></DT>
<DD>
<B><PRE>
cc [flags] <I>sourcefiles</I> -lJudy
</PRE></B>
<P>
<B><PRE>
#include &lt;Judy.h&gt;

int     Rc_int;                          // return code - integer
Word_t  Rc_word;                         // return code - unsigned word
Word_t  Index, Index1, Index2, Nth;

Pvoid_t PJ1Array = (Pvoid_t) NULL;       // initialize Judy1 array

<A href="#J1S" >J1S</A>( Rc_int,  PJ1Array, Index);          // <A href="Judy1_funcs_3.htm#Judy1Set">Judy1Set()</A>
<A href="#J1U" >J1U</A>( Rc_int,  PJ1Array, Index);          // <A href="Judy1_funcs_3.htm#Judy1Unset">Judy1Unset()</A>
<A href="#J1T" >J1T</A>( Rc_int,  PJ1Array, Index);          // <A href="Judy1_funcs_3.htm#Judy1Test">Judy1Test()</A>
<A href="#J1C" >J1C</A>( Rc_word, PJ1Array, Index1, Index2); // <A href="Judy1_funcs_3.htm#Judy1Count">Judy1Count()</A>
<A href="#J1BC">J1BC</A>(Rc_int,  PJ1Array, Nth, Index);     // <A href="Judy1_funcs_3.htm#Judy1ByCount">Judy1ByCount()</A>
<A href="#J1FA">J1FA</A>(Rc_word, PJ1Array);                 // <A href="Judy1_funcs_3.htm#Judy1FreeArray">Judy1FreeArray()</A>
<A href="#J1MU">J1MU</A>(Rc_word, PJ1Array);                 // <A href="Judy1_funcs_3.htm#Judy1MemUsed">Judy1MemUsed()</A>
<A href="#J1F" >J1F</A>( Rc_int,  PJ1Array, Index);          // <A href="Judy1_funcs_3.htm#Judy1First">Judy1First()</A>
<A href="#J1N" >J1N</A>( Rc_int,  PJ1Array, Index);          // <A href="Judy1_funcs_3.htm#Judy1Next">Judy1Next()</A>
<A href="#J1L" >J1L</A>( Rc_int,  PJ1Array, Index);          // <A href="Judy1_funcs_3.htm#Judy1Last">Judy1Last()</A>
<A href="#J1P" >J1P</A>( Rc_int,  PJ1Array, Index);          // <A href="Judy1_funcs_3.htm#Judy1Prev">Judy1Prev()</A>
<A href="#J1FE">J1FE</A>(Rc_int,  PJ1Array, Index);          // <A href="Judy1_funcs_3.htm#Judy1FirstEmpty">Judy1FirstEmpty()</A>
<A href="#J1NE">J1NE</A>(Rc_int,  PJ1Array, Index);          // <A href="Judy1_funcs_3.htm#Judy1NextEmpty">Judy1NextEmpty()</A>
<A href="#J1LE">J1LE</A>(Rc_int,  PJ1Array, Index);          // <A href="Judy1_funcs_3.htm#Judy1LastEmpty">Judy1LastEmpty()</A>
<A href="#J1PE">J1PE</A>(Rc_int,  PJ1Array, Index);          // <A href="Judy1_funcs_3.htm#Judy1PrevEmpty">Judy1PrevEmpty()</A>
</PRE></B>
<!----------------->
<P>
<DT><B>DESCRIPTION</B></DT>
<DD>
A Judy1 array is the equivalent of a bit array or bit map.
A bit is addressed by an <B>Index</B> (key).
The array may be sparse, and the <B>Index</B> may be any word-sized <B>Value</B>.
If an index is present, it represents a set bit
(a bit set represents an index present).
If an index is absent, it represents an unset bit
(a bit unset represents an absent index).
<P>
A Judy1 array is allocated with a <B>NULL</B> pointer
<PRE>
Pvoid_t PJ1Array = (Pvoid_t) NULL;
</PRE>
Memory to support the array is allocated as bits are set,
and released as bits are unset.
If the Judy1 pointer (<B>PJ1Array</B>) is NULL, all bits are unset (and
the Judy1 array requires no memory).
<P>
As with an ordinary array, a Judy1 array contains no duplicate indexes.
<P>
Using the macros described here, rather than the
<A href="Judy1_funcs_3.htm">Judy1 function calls</A>,
the default error handling sends a
message to the standard error and terminates the program with
<B>exit(1)</B>.
For other error handling methods, see the
<A href="#J1ERR">ERRORS</A> section.
<P>
Because the macro forms are sometimes faster and have a simpler error
handling interface than the equivalent



( run in 0.518 second using v1.01-cache-2.11-cpan-140bd7fdf52 )