| 1 |
<HTML> |
| 2 |
<HEAD> |
| 3 |
<!-- @(#) $Revision: 4.5 $ $Source: /cvsroot/judy/doc/ext/JudyL_funcs_3.htm,v $ ---> |
| 4 |
<TITLE>JudyL_funcs(3)</TITLE> |
| 5 |
</HEAD> |
| 6 |
<BODY> |
| 7 |
<TABLE border=0 width="100%"><TR> |
| 8 |
<TD width="40%" align="left">JudyL_funcs(3)</TD> |
| 9 |
<TD width="10%" align="center"> </TD> |
| 10 |
<TD width="40%" align="right">JudyL_funcs(3)</TD> |
| 11 |
</TR></TABLE> |
| 12 |
<P> |
| 13 |
<DL> |
| 14 |
<!-----------------> |
| 15 |
<DT><B>NAME</B></DT> |
| 16 |
<DD> |
| 17 |
JudyL functions - |
| 18 |
C library for creating and accessing a dynamic array of words, using |
| 19 |
any value of a word as an index |
| 20 |
<!-----------------> |
| 21 |
<P> |
| 22 |
<DT><B>SYNOPSIS</B></DT> |
| 23 |
<DD> |
| 24 |
<B><PRE> |
| 25 |
PPvoid_t <A href="#JudyLIns" >JudyLIns</A>( PPvoid_t PPJLArray, Word_t Index, PJError_t PJError); |
| 26 |
int <A href="#JudyLDel" >JudyLDel</A>( PPvoid_t PPJLArray, Word_t Index, PJError_t PJError); |
| 27 |
PPvoid_t <A href="#JudyLGet" >JudyLGet</A>( Pcvoid_t PJLArray, Word_t Index, PJError_t PJError); |
| 28 |
Word_t <A href="#JudyLCount" >JudyLCount</A>( Pcvoid_t PJLArray, Word_t Index1, Word_t Index2, PJError_t PJError); |
| 29 |
PPvoid_t <A href="#JudyLByCount" >JudyLByCount</A>( Pcvoid_t PJLArray, Word_t Nth, Word_t * PIndex, PJError_t PJError); |
| 30 |
Word_t <A href="#JudyLFreeArray ">JudyLFreeArray</A>( PPvoid_t PPJLArray, PJError_t PJError); |
| 31 |
Word_t <A href="#JudyLMemUsed" >JudyLMemUsed</A>( Pcvoid_t PJLArray); |
| 32 |
PPvoid_t <A href="#JudyLFirst" >JudyLFirst</A>( Pcvoid_t PJLArray, Word_t * PIndex, PJError_t PJError); |
| 33 |
PPvoid_t <A href="#JudyLNext" >JudyLNext</A>( Pcvoid_t PJLArray, Word_t * PIndex, PJError_t PJError); |
| 34 |
PPvoid_t <A href="#JudyLLast" >JudyLLast</A>( Pcvoid_t PJLArray, Word_t * PIndex, PJError_t PJError); |
| 35 |
PPvoid_t <A href="#JudyLPrev" >JudyLPrev</A>( Pcvoid_t PJLArray, Word_t * PIndex, PJError_t PJError); |
| 36 |
int <A href="#JudyLFirstEmpty">JudyLFirstEmpty</A>(Pcvoid_t PJLArray, Word_t * PIndex, PJError_t PJError); |
| 37 |
int <A href="#JudyLNextEmpty" >JudyLNextEmpty</A>( Pcvoid_t PJLArray, Word_t * PIndex, PJError_t PJError); |
| 38 |
int <A href="#JudyLLastEmpty" >JudyLLastEmpty</A>( Pcvoid_t PJLArray, Word_t * PIndex, PJError_t PJError); |
| 39 |
int <A href="#JudyLPrevEmpty" >JudyLPrevEmpty</A>( Pcvoid_t PJLArray, Word_t * PIndex, PJError_t PJError); |
| 40 |
</PRE></B> |
| 41 |
<!-----------------> |
| 42 |
<P> |
| 43 |
<DT><B>DESCRIPTION</B></DT> |
| 44 |
<DD> |
| 45 |
A macro equivalent exists for each function call. |
| 46 |
Because the macro forms are sometimes faster and have a simpler error |
| 47 |
handling interface than the equivalent functions, |
| 48 |
they are the preferred way of calling the JudyL functions. |
| 49 |
See <A href="JudyL_3.htm">JudyL(3)</A> |
| 50 |
for more information. |
| 51 |
The function call definitions are included here for completeness. |
| 52 |
<P> |
| 53 |
One of the difficulties in using the JudyL function calls lies in |
| 54 |
determining whether to pass a pointer or the address of a pointer. |
| 55 |
Since the functions that modify the JudyL array must also modify the |
| 56 |
pointer to the JudyL array, you must pass the address of the pointer |
| 57 |
rather than the pointer itself. |
| 58 |
This often leads to hard-to-debug programmatic errors. |
| 59 |
In practice, the macros allow the compiler to catch programming |
| 60 |
errors when pointers instead of addresses of pointers are passed. |
| 61 |
<P> |
| 62 |
The JudyL function calls have an additional parameter beyond |
| 63 |
those specified in the macro calls. This parameter is either a |
| 64 |
pointer to an error structure, or <B>NULL</B> (in which case the |
| 65 |
detailed error information is not returned). |
| 66 |
<P> |
| 67 |
In the following descriptions, the functions are described in |
| 68 |
terms of how the macros use them (only in the case of |
| 69 |
<B>#define JUDYERROR_NOTEST 1</B>). This is the suggested use |
| 70 |
of the macros after your program has been fully debugged. |
| 71 |
When the <B>JUDYERROR_NOTEST</B> macro is not specified, |
| 72 |
an error structure is declared to store error information |
| 73 |
returned from the JudyL functions when an error occurs. |
| 74 |
<P> |
| 75 |
Notice the placement of the <B>&</B> in the different functions. |
| 76 |
<P> |
| 77 |
<DL> |
| 78 |
<DT><A name="JudyLIns"><B>JudyLIns(&PJLArray, Index, &JError)</B></A></DT> |
| 79 |
<DD> |
| 80 |
<PRE> |
| 81 |
#define JLI(PValue, PJLArray, Index) \ |
| 82 |
PValue = JudyLIns(&PJLArray, Index, PJE0) |
| 83 |
|
| 84 |
</PRE> |
| 85 |
<P> |
| 86 |
<DT><A name="JudyLDel"><B>JudyLDel(&PJLArray, Index, &JError)</B></A></DT> |
| 87 |
<DD> |
| 88 |
<PRE> |
| 89 |
#define JLD(Rc_int, PJLArray, Index) \ |
| 90 |
Rc_int = JudyLDel(&PJLArray, Index, PJE0) |
| 91 |
|
| 92 |
</PRE> |
| 93 |
<P> |
| 94 |
<DT><A name="JudyLGet"><B>JudyLGet(PJLArray, Index, &JError)</B></A></DT> |
| 95 |
<DD> |
| 96 |
<PRE> |
| 97 |
#define JLG(PValue, PJLArray, Index) \ |
| 98 |
PValue = JudyLGet(PJLArray, Index, PJE0) |
| 99 |
|
| 100 |
</PRE> |
| 101 |
<P> |
| 102 |
<DT><A name="JudyLCount"><B>JudyLCount(PJLArray, Index1, Index2, &JError)</B></A></DT> |
| 103 |
<DD> |
| 104 |
<PRE> |
| 105 |
#define JLC(Rc_word, PJLArray, Index1, Index2) \ |
| 106 |
Rc_word = JudyLCount(PJLArray, Index1, Index2, PJE0) |
| 107 |
|
| 108 |
</PRE> |
| 109 |
<P> |
| 110 |
<DT><A name="JudyLByCount"><B>JudyLByCount(PJLArray, Nth, &Index, &JError)</B></A></DT> |
| 111 |
<DD> |
| 112 |
<PRE> |
| 113 |
#define JLBC(PValue, PJLArray, Nth, Index) \ |
| 114 |
PValue = JudyLByCount(PJLArray, Nth, &Index, PJE0) |
| 115 |
|
| 116 |
</PRE> |
| 117 |
<P> |
| 118 |
<DT><A name="JudyLFreeArray"><B>JudyLFreeArray(&PJLArray, &JError)</B></A></DT> |
| 119 |
<DD> |
| 120 |
<PRE> |
| 121 |
#define JLFA(Rc_word, PJLArray) \ |
| 122 |
Rc_word = JudyLFreeArray(&PJLArray, PJE0) |
| 123 |
|
| 124 |
</PRE> |
| 125 |
<P> |
| 126 |
<DT><A name="JudyLMemUsed"><B>JudyLMemUsed(PJLArray)</B></A></DT> |
| 127 |
<DD> |
| 128 |
<PRE> |
| 129 |
#define JLMU(Rc_word, PJLArray) \ |
| 130 |
Rc_word = JudyLMemUsed(PJLArray) |
| 131 |
|
| 132 |
</PRE> |
| 133 |
<P> |
| 134 |
<DT><A name="JudyLFirst"><B>JudyLFirst(PJLArray, &Index, &JError)</B></A></DT> |
| 135 |
<DD> |
| 136 |
<PRE> |
| 137 |
#define JLF(PValue, PJLArray, Index) \ |
| 138 |
PValue = JudyLFirst(PJLArray, &Index, PJEO) |
| 139 |
|
| 140 |
</PRE> |
| 141 |
<P> |
| 142 |
<DT><A name="JudyLNext"><B>JudyLNext(PJLArray, &Index, &JError)</B></A></DT> |
| 143 |
<DD> |
| 144 |
<PRE> |
| 145 |
#define JLN(PValue, PJLArray, Index) \ |
| 146 |
PValue = JudyLNext(PJLArray, &Index, PJEO) |
| 147 |
|
| 148 |
</PRE> |
| 149 |
<P> |
| 150 |
<DT><A name="JudyLLast"><B>JudyLLast(PJLArray, &Index, &JError)</B></A></DT> |
| 151 |
<DD> |
| 152 |
<PRE> |
| 153 |
#define JLL(PValue, PJLArray, Index) \ |
| 154 |
PValue = JudyLLast(PJLArray, &Index, PJEO) |
| 155 |
|
| 156 |
</PRE> |
| 157 |
<P> |
| 158 |
<DT><A name="JudyLPrev"><B>JudyLPrev(PJLArray, &Index, &JError)</B></A></DT> |
| 159 |
<DD> |
| 160 |
<PRE> |
| 161 |
#define JLP(PValue, PJLArray, Index) \ |
| 162 |
PValue = JudyLPrev(PJLArray, &Index, PJEO) |
| 163 |
|
| 164 |
</PRE> |
| 165 |
<P> |
| 166 |
<DT><A name="JudyLFirstEmpty"><B>JudyLFirstEmpty(PJLArray, &Index, &JError)</B></A></DT> |
| 167 |
<DD> |
| 168 |
<PRE> |
| 169 |
#define JLFE(Rc_int, PJLArray, Index) \ |
| 170 |
Rc_int = JudyLFirstEmpty(PJLArray, &Index, PJEO) |
| 171 |
|
| 172 |
</PRE> |
| 173 |
<P> |
| 174 |
<DT><A name="JudyLNextEmpty"><B>JudyLNextEmpty(PJLArray, &Index, &JError)</B></A></DT> |
| 175 |
<DD> |
| 176 |
<PRE> |
| 177 |
#define JLNE(Rc_int, PJLArray, Index) \ |
| 178 |
Rc_int = JudyLNextEmpty(PJLArray, &Index, PJEO) |
| 179 |
|
| 180 |
</PRE> |
| 181 |
<P> |
| 182 |
<DT><A name="JudyLLastEmpty"><B>JudyLLastEmpty(PJLArray, &Index, &JError)</B></A></DT> |
| 183 |
<DD> |
| 184 |
<PRE> |
| 185 |
#define JLLE(Rc_int, PJLArray, Index) \ |
| 186 |
Rc_int = JudyLLastEmpty(PJLArray, &Index, PJEO) |
| 187 |
|
| 188 |
</PRE> |
| 189 |
<P> |
| 190 |
<DT><A name="JudyLPrevEmpty"><B>JudyLPrevEmpty(PJLArray, &Index, &JError)</B></A></DT> |
| 191 |
<DD> |
| 192 |
<PRE> |
| 193 |
#define JLPE(Rc_int, PJLArray, Index) \ |
| 194 |
Rc_int = JudyLPrevEmpty(PJLArray, &Index, PJEO) |
| 195 |
|
| 196 |
</PRE> |
| 197 |
</DL> |
| 198 |
<P> |
| 199 |
Definitions for all the Judy functions, the types |
| 200 |
<B>Pvoid_t</B>, |
| 201 |
<B>Pcvoid_t</B>, |
| 202 |
<B>PPvoid_t</B>, |
| 203 |
<B>Word_t</B>, |
| 204 |
<B>JError_t</B>, |
| 205 |
and |
| 206 |
<B>PJError_t</B>, |
| 207 |
the constants |
| 208 |
<B>NULL</B>, |
| 209 |
<B>JU_ERRNO_*</B>, |
| 210 |
<B>JERR</B>, |
| 211 |
<B>PPJERR</B>, |
| 212 |
and |
| 213 |
<B>PJE0</B>, |
| 214 |
are provided in the <B>Judy.h</B> header file |
| 215 |
(/usr/include/Judy.h). |
| 216 |
<B>Note</B>: Callers should define JudyL arrays as type <B>Pvoid_t</B>, |
| 217 |
which can be passed by value to functions that take |
| 218 |
<B>Pcvoid_t</B> (constant <B>Pvoid_t</B>), |
| 219 |
and also by address to functions that take <B>PPvoid_t</B>. |
| 220 |
<P> |
| 221 |
The return type from most <B>JudyL</B> functions is <B>PPvoid_t</B> so |
| 222 |
that the values stored in the array can be pointers to other objects, |
| 223 |
which is a typical usage, or cast to a <B>Word_t *</B> when a pointer |
| 224 |
to a <B>Value</B> is required instead of a pointer to a pointer. |
| 225 |
<!-----------------> |
| 226 |
<P> |
| 227 |
<DT><B>AUTHOR</B></DT> |
| 228 |
<DD> |
| 229 |
Judy was invented by Doug Baskins and implemented by Hewlett-Packard. |
| 230 |
<!-----------------> |
| 231 |
<P> |
| 232 |
<DT><B>SEE ALSO</B></DT> |
| 233 |
<DD> |
| 234 |
<A href="Judy_3.htm">Judy(3)</A>, |
| 235 |
<A href="Judy1_3.htm">Judy1(3)</A>, |
| 236 |
<A href="JudyL_3.htm">JudyL(3)</A>, |
| 237 |
<A href="JudySL_3.htm">JudySL(3)</A>, |
| 238 |
<A href="JudyHS_3.htm">JudyHS(3)</A>, |
| 239 |
<BR> |
| 240 |
<I>malloc()</I>, |
| 241 |
<BR> |
| 242 |
the Judy website, |
| 243 |
<A href="http://judy.sourceforge.net"> |
| 244 |
http://judy.sourceforge.net</A>, |
| 245 |
for more information and Application Notes. |
| 246 |
</DL> |
| 247 |
</BODY> |
| 248 |
</HTML> |