Sophie

Sophie

distrib > Fedora > 16 > x86_64 > by-pkgid > be029e624d77f7fb6b0da5cd35f85be8 > files > 13

Judy-devel-1.0.5-2.fc15.i686.rpm

<HTML>
<HEAD>
<!-- @(#) $Revision: 4.5 $ $Source: /cvsroot/judy/doc/ext/JudySL_funcs_3.htm,v $ --->
<TITLE>JudySL_funcs(3)</TITLE>
</HEAD>
<BODY>
<TABLE border=0 width="100%"><TR>
<TD width="40%" align="left">JudySL_funcs(3)</TD>
<TD width="10%" align="center">     </TD>
<TD width="40%" align="right">JudySL_funcs(3)</TD>
</TR></TABLE>
<P>
<DL>
<!----------------->
<DT><B>NAME</B></DT>
<DD>
JudySL functions -
C library for creating and accessing a dynamic array, using
a null-terminated string as an index (associative array)
<!----------------->
<P>
<DT><B>SYNOPSIS</B></DT>
<DD>
<B><PRE>

PPvoid_t <A href="#JudySLIns"      >JudySLIns</A>(      PPvoid_t PPJSLArray, const uint8_t * Index, PJError_t PJError);
int      <A href="#JudySLDel"      >JudySLDel</A>(      PPvoid_t PPJSLArray, const uint8_t * Index, PJError_t PJError);
PPvoid_t <A href="#JudySLGet"      >JudySLGet</A>(      Pcvoid_t  PJSLArray, const uint8_t * Index, PJError_t PJError);
Word_t   <A href="#JudySLFreeArray">JudySLFreeArray</A>(PPvoid_t PPJSLArray, PJError_t PJError);
PPvoid_t <A href="#JudySLFirst"    >JudySLFirst</A>(    Pcvoid_t  PJSLArray,       uint8_t * Index, PJError_t PJError);
PPvoid_t <A href="#JudySLNext"     >JudySLNext</A>(     Pcvoid_t  PJSLArray,       uint8_t * Index, PJError_t PJError);
PPvoid_t <A href="#JudySLLast"     >JudySLLast</A>(     Pcvoid_t  PJSLArray,       uint8_t * Index, PJError_t PJError);
PPvoid_t <A href="#JudySLPrev"     >JudySLPrev</A>(     Pcvoid_t  PJSLArray,       uint8_t * Index, PJError_t PJError);
</PRE></B>
<!----------------->
<P>
<DT><B>DESCRIPTION</B></DT>
<DD>
A macro equivalent exists for each function call.
Because the macro forms are sometimes faster and have a simpler error
handling interface than the equivalent functions,
they are the preferred way of calling the JudySL functions.
See <A href="JudySL_3.htm">JudySL(3)</A>
for more information.
The function call definitions are included here for completeness.
<P>
One of the difficulties in using the JudySL function calls lies in
determining whether to pass a pointer or the address of a pointer.
Since the functions that modify the JudySL array must also modify the
pointer to the JudySL array, you must pass the address of the pointer
rather than the pointer itself.
This often leads to hard-to-debug programmatic errors.
In practice, the macros allow the compiler to catch programming
errors when pointers instead of addresses of pointers are passed.
<P>
The JudySL function calls have an additional parameter beyond
those specified in the macro calls.  This parameter is either a
pointer to an error structure, or <B>NULL</B> (in which case the
detailed error information is not returned).
<P>
In the following descriptions, the functions are described in
terms of how the macros use them (only in the case of
<B>#define JUDYERROR_NOTEST 1</B>).  This is the suggested use
of the macros after your program has been fully debugged.
When the <B>JUDYERROR_NOTEST</B> macro is not specified,
an error structure is declared to store error information
returned from the JudySL functions when an error occurs.
<P>
Notice the placement of the <B>&amp;</B> in the different functions.
<P>
<DL>
<DT><A name="JudySLIns"><B>JudySLIns(&amp;PJSLArray, Index, &amp;JError)</B></A></DT>
<DD>
<PRE>
#define JSLI(PValue, PJSLArray, Index) \
   PValue = JudyLIns(&amp;PJSLArray, Index, PJE0)

</PRE>
<P>
<DT><A name="JudySLDel"><B>JudySLDel(&amp;PJSLArray, Index, &amp;JError)</B></A></DT>
<DD>
<PRE>
#define JSLD(Rc_int, PJSLArray, Index) \
   Rc_int = JudySLDel(&amp;PJSLArray, Index, PJE0)

</PRE>
<P>
<DT><A name="JudySLGet"><B>JudySLGet(PJSLArray, Index, &amp;JError)</B></A></DT>
<DD>
<PRE>
#define JSLG(PValue, PJSLArray, Index) \
   PValue = JudySLIns(PJSLArray, Index, PJE0)

</PRE>
<P>
<DT><A name="JudySLFreeArray"><B>JudySLFreeArray(&amp;PJSLArray, &amp;JError)</B></A></DT>
<DD>
<PRE>
#define JSLFA(Rc_word, PJSLArray) \
   Rc_word = JudySLFreeArray(&amp;PJSLArray, PJE0)

</PRE>
<P>
<DT><A name="JudySLFirst"><B>JudySLFirst(PJSLArray, Index, &amp;JError)</B></A></DT>
<DD>
<PRE>
#define JSLF(PValue, PJSLArray, Index) \
   PValue = JudySLFirst(PJSLArray, Index, PJE0)

</PRE>
<P>
<DT><A name="JudySLNext"><B>JudySLNext(PJSLArray, Index, &amp;JError)</B></A></DT>
<DD>
<PRE>
#define JSLN(PValue, PJSLArray, Index) \
   PValue = JudySLNext(PJSLArray, Index, PJE0)

</PRE>
<P>
<DT><A name="JudySLLast"><B>JudySLLast(PJSLArray, Index, &amp;JError)</B></A></DT>
<DD>
<PRE>
#define JSLL(PValue, PJSLArray, Index) \
   PValue = JudySLLast(PJSLArray, Index, PJE0)

</PRE>
<P>
<DT><A name="JudySLPrev"><B>JudySLPrev(PJSLArray, Index, &amp;JError)</B></A></DT>
<DD>
<PRE>
#define JSLP(PValue, PJSLArray, Index) \
   PValue = JudySLPrev(PJSLArray, Index, PJE0)

</PRE>
</DL>
<P>
Definitions for all the Judy functions, the types
<B>Pvoid_t</B>,
<B>Pcvoid_t</B>,
<B>PPvoid_t</B>,
<B>Word_t </B>,
<B>JError_t</B>,
and
<B>PJError_t</B>,
the constants
<B>NULL</B>,
<B>JU_ERRNO_*</B>,
<B>JERR</B>,
<B>PPJERR</B>,
and
<B>PJE0</B>
are provided in the <B>Judy.h</B> header file
(/usr/include/Judy.h).
<B>Note</B>:  Callers should define JudySL arrays as type <B>Pvoid_t</B>,
which can be passed by value to functions that take
<B>Pcvoid_t</B> (constant <B>Pvoid_t</B>),
and also by address to functions that take <B>PPvoid_t</B>.
<P>
The return type from most <B>JudySL</B> functions is <B>PPvoid_t</B> so
that the values stored in the array can be pointers to other objects,
which is a typical usage, or cast to a <B>Word_t  *</B> when a pointer
to a value is required instead of a pointer to a pointer.
<!----------------->
<P>
<DT><B>AUTHOR</B></DT>
<DD>
Judy was invented by Doug Baskins and implemented by Hewlett-Packard.
<!----------------->
<P>
<DT><B>SEE ALSO</B></DT>
<DD>
<A href="Judy_3.htm">Judy(3)</A>,
<A href="Judy1_3.htm">Judy1(3)</A>,
<A href="JudyL_3.htm">JudyL(3)</A>,
<A href="JudySL_3.htm">JudySL(3)</A>,
<A href="JudyHS_3.htm">JudyHS(3)</A>,
<BR>
<I>malloc()</I>,
<BR>
the Judy website,
<A href="http://judy.sourceforge.net">
http://judy.sourceforge.net</A>,
for more information and Application Notes.
</DL>
</BODY>
</HTML>