3
<!-- @(#) $Revision: 4.3 $ $Source: /judy/doc/ext/JudySL_funcs_3x.htm $ --->
4
<TITLE>JudySL_funcs(3X)</TITLE>
8
<TABLE border=0 width="100%"><TR>
9
<TD width="40%" align="left">JudySL_funcs(3X)</TD>
10
<TD width="10%" align="center"> </TD>
11
<TD width="40%" align="right">JudySL_funcs(3X)</TD>
21
C library for creating and accessing a dynamic array, using
22
a null-terminated string as an index (associative array)
26
<DT><B>SYNOPSIS</B></DT>
30
PPvoid_t <A href="#JudySLIns" >JudySLIns</A>( PPvoid_t PPJSLArray, const char * Index, PJError_t PJError);
31
int <A href="#JudySLDel" >JudySLDel</A>( PPvoid_t PPJSLArray, const char * Index, PJError_t PJError);
32
PPvoid_t <A href="#JudySLGet" >JudySLGet</A>( Pcvoid_t PJSLArray, const char * Index, PJError_t PJError);
33
Word_t <A href="#JudySLFreeArray">JudySLFreeArray</A>(PPvoid_t PPJSLArray, PJError_t PJError);
34
PPvoid_t <A href="#JudySLFirst" >JudySLFirst</A>( Pcvoid_t PJSLArray, char * Index, PJError_t PJError);
35
PPvoid_t <A href="#JudySLNext" >JudySLNext</A>( Pcvoid_t PJSLArray, char * Index, PJError_t PJError);
36
PPvoid_t <A href="#JudySLLast" >JudySLLast</A>( Pcvoid_t PJSLArray, char * Index, PJError_t PJError);
37
PPvoid_t <A href="#JudySLPrev" >JudySLPrev</A>( Pcvoid_t PJSLArray, char * Index, PJError_t PJError);
42
<DT><B>DESCRIPTION</B></DT>
44
A macro equivalent exists for each function call.
45
Because the macro forms are faster and have a simpler error
46
handling interface than the equivalent functions,
47
they are the preferred way of calling the JudySL functions.
48
See <A href="JudySL_3x.htm">JudySL(3X)</A>
50
The function call definitions are included here for completeness.
52
One of the difficulties in using the JudySL function calls lies in
53
determining whether to pass a pointer or the address of a pointer.
54
Since the functions that modify the JudySL array must also modify the
55
pointer to the JudySL array, you must pass the address of the pointer
56
rather than the pointer itself.
57
This often leads to hard-to-debug programmatic errors.
58
In practice, the macros allow the compiler to catch programming
59
errors when pointers instead of addresses of pointers are passed.
61
The JudySL function calls have an additional parameter beyond
62
those specified in the macro calls. This parameter is either a
63
pointer to an error structure, or <B>NULL</B> (in which case the
64
detailed error information is not returned).
66
In the following descriptions, the functions are described in
67
terms of how the macros use them (only in the case of
68
<B>#define JUDYERROR_NOTEST 1</B>). This is the suggested use
69
of the macros after your program has been fully debugged.
70
When the <B>JUDYERROR_NOTEST</B> macro is not specified,
71
an error structure is declared to store error information
72
returned from the JudySL functions when an error occurs.
74
Notice the placement of the <B>&</B> in the different functions.
78
<DT><A name="JudySLIns"><B>JudySLIns(&PJSLArray, Index, &JError)</B></A></DT>
81
#define JSLI(PValue, PJSLArray, Index) \
82
PValue = JudyLIns(&PJSLArray, Index, PJE0)
87
<DT><A name="JudySLDel"><B>JudySLDel(&PJSLArray, Index, &JError)</B></A></DT>
90
#define JSLD(Rc_int, PJSLArray, Index) \
91
Rc_int = JudySLDel(&PJSLArray, Index, PJE0)
96
<DT><A name="JudySLGet"><B>JudySLGet(PJSLArray, Index, &JError)</B></A></DT>
99
#define JSLG(PValue, PJSLArray, Index) \
100
PValue = JudySLIns(PJSLArray, Index, PJE0)
106
<DT><A name="JudySLFreeArray"><B>JudySLFreeArray(&PJSLArray, &JError)</B></A></DT>
109
#define JSLFA(Rc_word, PJSLArray) \
110
Rc_word = JudySLFreeArray(&PJSLArray, PJE0)
115
<DT><A name="JudySLFirst"><B>JudySLFirst(PJSLArray, Index, &JError)</B></A></DT>
118
#define JSLF(PValue, PJSLArray, Index) \
119
PValue = JudySLFirst(PJSLArray, Index, PJE0)
124
<DT><A name="JudySLNext"><B>JudySLNext(PJSLArray, Index, &JError)</B></A></DT>
127
#define JSLN(PValue, PJSLArray, Index) \
128
PValue = JudySLNext(PJSLArray, Index, PJE0)
133
<DT><A name="JudySLLast"><B>JudySLLast(PJSLArray, Index, &JError)</B></A></DT>
136
#define JSLL(PValue, PJSLArray, Index) \
137
PValue = JudySLLast(PJSLArray, Index, PJE0)
142
<DT><A name="JudySLPrev"><B>JudySLPrev(PJSLArray, Index, &JError)</B></A></DT>
145
#define JSLP(PValue, PJSLArray, Index) \
146
PValue = JudySLPrev(PJSLArray, Index, PJE0)
152
Definitions for all the Judy functions, the types
167
are provided in the <B>Judy.h</B> header file
168
(/usr/include/Judy.h).
169
<B>Note</B>: Callers should define JudySL arrays as type <B>Pvoid_t</B>,
170
which can be passed by value to functions that take
171
<B>Pcvoid_t</B> (constant <B>Pvoid_t</B>),
172
and also by address to functions that take <B>PPvoid_t</B>.
174
The return type from most <B>JudySL</B> functions is <B>PPvoid_t</B> so
175
that the values stored in the array can be pointers to other objects,
176
which is a typical usage, or cast to a <B>Word_t *</B> when a pointer
177
to a value is required instead of a pointer to a pointer.
181
<DT><B>AUTHOR</B></DT>
183
Judy was invented by Doug Baskins and implemented by Hewlett-Packard.
187
<DT><B>SEE ALSO</B></DT>
189
<A href="Judy_3x.htm">Judy(3X)</A>,
190
<A href="Judy1_3x.htm">Judy1(3X)</A>,
191
<A href="Judy1_funcs_3x.htm">Judy1_funcs(3X)</A>,
192
<A href="JudyL_3x.htm">JudyL(3X)</A>,
193
<A href="JudyL_funcs_3x.htm">JudyL_funcs(3X)</A>,
194
<A href="JudySL_3x.htm">JudySL(3X)</A>,
199
<A href="http://www.sourcejudy.com/">
200
http://www.sourcejudy.com/</A>,
201
for more information and Application Notes.