3
<!-- @(#) $Revision: 4.5 $ $Source: /cvsroot/judy/doc/ext/JudySL_funcs_3.htm,v $ --->
4
<TITLE>JudySL_funcs(3)</TITLE>
7
<TABLE border=0 width="100%"><TR>
8
<TD width="40%" align="left">JudySL_funcs(3)</TD>
9
<TD width="10%" align="center"> </TD>
10
<TD width="40%" align="right">JudySL_funcs(3)</TD>
18
C library for creating and accessing a dynamic array, using
19
a null-terminated string as an index (associative array)
22
<DT><B>SYNOPSIS</B></DT>
26
PPvoid_t <A href="#JudySLIns" >JudySLIns</A>( PPvoid_t PPJSLArray, const uint8_t * Index, PJError_t PJError);
27
int <A href="#JudySLDel" >JudySLDel</A>( PPvoid_t PPJSLArray, const uint8_t * Index, PJError_t PJError);
28
PPvoid_t <A href="#JudySLGet" >JudySLGet</A>( Pcvoid_t PJSLArray, const uint8_t * Index, PJError_t PJError);
29
Word_t <A href="#JudySLFreeArray">JudySLFreeArray</A>(PPvoid_t PPJSLArray, PJError_t PJError);
30
PPvoid_t <A href="#JudySLFirst" >JudySLFirst</A>( Pcvoid_t PJSLArray, uint8_t * Index, PJError_t PJError);
31
PPvoid_t <A href="#JudySLNext" >JudySLNext</A>( Pcvoid_t PJSLArray, uint8_t * Index, PJError_t PJError);
32
PPvoid_t <A href="#JudySLLast" >JudySLLast</A>( Pcvoid_t PJSLArray, uint8_t * Index, PJError_t PJError);
33
PPvoid_t <A href="#JudySLPrev" >JudySLPrev</A>( Pcvoid_t PJSLArray, uint8_t * Index, PJError_t PJError);
37
<DT><B>DESCRIPTION</B></DT>
39
A macro equivalent exists for each function call.
40
Because the macro forms are sometimes faster and have a simpler error
41
handling interface than the equivalent functions,
42
they are the preferred way of calling the JudySL functions.
43
See <A href="JudySL_3.htm">JudySL(3)</A>
45
The function call definitions are included here for completeness.
47
One of the difficulties in using the JudySL function calls lies in
48
determining whether to pass a pointer or the address of a pointer.
49
Since the functions that modify the JudySL array must also modify the
50
pointer to the JudySL array, you must pass the address of the pointer
51
rather than the pointer itself.
52
This often leads to hard-to-debug programmatic errors.
53
In practice, the macros allow the compiler to catch programming
54
errors when pointers instead of addresses of pointers are passed.
56
The JudySL function calls have an additional parameter beyond
57
those specified in the macro calls. This parameter is either a
58
pointer to an error structure, or <B>NULL</B> (in which case the
59
detailed error information is not returned).
61
In the following descriptions, the functions are described in
62
terms of how the macros use them (only in the case of
63
<B>#define JUDYERROR_NOTEST 1</B>). This is the suggested use
64
of the macros after your program has been fully debugged.
65
When the <B>JUDYERROR_NOTEST</B> macro is not specified,
66
an error structure is declared to store error information
67
returned from the JudySL functions when an error occurs.
69
Notice the placement of the <B>&</B> in the different functions.
72
<DT><A name="JudySLIns"><B>JudySLIns(&PJSLArray, Index, &JError)</B></A></DT>
75
#define JSLI(PValue, PJSLArray, Index) \
76
PValue = JudyLIns(&PJSLArray, Index, PJE0)
80
<DT><A name="JudySLDel"><B>JudySLDel(&PJSLArray, Index, &JError)</B></A></DT>
83
#define JSLD(Rc_int, PJSLArray, Index) \
84
Rc_int = JudySLDel(&PJSLArray, Index, PJE0)
88
<DT><A name="JudySLGet"><B>JudySLGet(PJSLArray, Index, &JError)</B></A></DT>
91
#define JSLG(PValue, PJSLArray, Index) \
92
PValue = JudySLIns(PJSLArray, Index, PJE0)
96
<DT><A name="JudySLFreeArray"><B>JudySLFreeArray(&PJSLArray, &JError)</B></A></DT>
99
#define JSLFA(Rc_word, PJSLArray) \
100
Rc_word = JudySLFreeArray(&PJSLArray, PJE0)
104
<DT><A name="JudySLFirst"><B>JudySLFirst(PJSLArray, Index, &JError)</B></A></DT>
107
#define JSLF(PValue, PJSLArray, Index) \
108
PValue = JudySLFirst(PJSLArray, Index, PJE0)
112
<DT><A name="JudySLNext"><B>JudySLNext(PJSLArray, Index, &JError)</B></A></DT>
115
#define JSLN(PValue, PJSLArray, Index) \
116
PValue = JudySLNext(PJSLArray, Index, PJE0)
120
<DT><A name="JudySLLast"><B>JudySLLast(PJSLArray, Index, &JError)</B></A></DT>
123
#define JSLL(PValue, PJSLArray, Index) \
124
PValue = JudySLLast(PJSLArray, Index, PJE0)
128
<DT><A name="JudySLPrev"><B>JudySLPrev(PJSLArray, Index, &JError)</B></A></DT>
131
#define JSLP(PValue, PJSLArray, Index) \
132
PValue = JudySLPrev(PJSLArray, Index, PJE0)
137
Definitions for all the Judy functions, the types
152
are provided in the <B>Judy.h</B> header file
153
(/usr/include/Judy.h).
154
<B>Note</B>: Callers should define JudySL arrays as type <B>Pvoid_t</B>,
155
which can be passed by value to functions that take
156
<B>Pcvoid_t</B> (constant <B>Pvoid_t</B>),
157
and also by address to functions that take <B>PPvoid_t</B>.
159
The return type from most <B>JudySL</B> functions is <B>PPvoid_t</B> so
160
that the values stored in the array can be pointers to other objects,
161
which is a typical usage, or cast to a <B>Word_t *</B> when a pointer
162
to a value is required instead of a pointer to a pointer.
165
<DT><B>AUTHOR</B></DT>
167
Judy was invented by Doug Baskins and implemented by Hewlett-Packard.
170
<DT><B>SEE ALSO</B></DT>
172
<A href="Judy_3.htm">Judy(3)</A>,
173
<A href="Judy1_3.htm">Judy1(3)</A>,
174
<A href="JudyL_3.htm">JudyL(3)</A>,
175
<A href="JudySL_3.htm">JudySL(3)</A>,
176
<A href="JudyHS_3.htm">JudyHS(3)</A>,
181
<A href="http://judy.sourceforge.net">
182
http://judy.sourceforge.net</A>,
183
for more information and Application Notes.