3
<!-- @(#) $Revision: 4.5 $ $Source: /cvsroot/judy/doc/ext/JudyHS_funcs_3.htm,v $ --->
4
<TITLE>JudyHS_funcs(3)</TITLE>
7
<TABLE border=0 width="100%"><TR>
8
<TD width="40%" align="left">JudyHS_funcs(3)</TD>
9
<TD width="10%" align="center"> </TD>
10
<TD width="40%" align="right">JudyHS_funcs(3)</TD>
18
C library for creating and accessing a dynamic array,
19
using an array-of-bytes of a length: <B>Length</B> as an <B>Index</B> and a word
23
<DT><B>SYNOPSIS</B></DT>
26
PPvoid_t <A href="#JudyHSIns" >JudyHSIns</A>(PPvoid_t PPJHS, void *Index, Word_t Length, PJError_t PJError);
27
int <A href="#JudyHSDel" >JudyHSDel</A>(PPvoid_t PPJHS, void *Index, Word_t Length, PJError_t PJError);
28
PPvoid_t <A href="#JudyHSGet" >JudyHSGet</A>(Pcvoid_t PJHS, void *Index, Word_t Length, PJError_t PJError);
29
Word_t <A href="#JudyHSFreeArray">JudyHSFreeArray</A>(PPvoid_t PPJHS, PJError_t PJError);
33
<DT><B>DESCRIPTION</B></DT>
35
A macro equivalent exists for each function call. Because the macro
36
forms are sometimes faster and have a simpler error handling interface
37
than the equivalent functions, they are the preferred way of calling the
39
See <A href="JudyHS_3.htm">JudyHS(3)</A>
41
The function call definitions are included here for completeness.
43
One of the difficulties in using the JudyHS function calls lies in
44
determining whether to pass a pointer or the address of a pointer.
45
Since the functions that modify the JudyHS array must also modify the
46
pointer to the JudyHS array, you must pass the address of the pointer
47
rather than the pointer itself.
48
This often leads to hard-to-debug programmatic errors.
49
In practice, the macros allow the compiler to catch programming
50
errors when pointers instead of addresses of pointers are passed.
52
The JudyHS function calls have an additional parameter beyond those
53
specified in the macro calls. This parameter is either a pointer to an
54
error structure, or <B>NULL</B> (in which case the error information is
55
not returned -- only <B>PJERR</B> in the return parameter).
57
In the following descriptions, the functions are described in
58
terms of how the macros use them.
59
This is the suggested use
60
of the macros after your program has been fully debugged.
61
When the <B>JUDYERROR_NOTEST</B> macro is not specified,
62
an error structure is declared to store error information
63
returned from the JudyHS functions when an error occurs.
65
Notice the placement of the <B>&</B> in the different functions.
68
<DT><A name="JudyHSIns"><B>JudyHSIns(&PJHS, Index, Length, &JError)</B></A></DT>
71
#define JHSI(PValue, PJHS, Index) \
72
PValue = JudyLIns(&PJHS, Index, PJE0)
76
<DT><A name="JudyHSDel"><B>JudyHSDel(&PJHS, Index, Length, &JError)</B></A></DT>
79
#define JHSD(Rc_int, PJHS, Index, Length) \
80
Rc_int = JudyHSDel(&PJHS, Index, Length, PJE0)
84
<DT><A name="JudyHSGet"><B>JudyHSGet(PJHS, Index, Length)</B></A></DT>
87
#define JHSG(PValue, PJHS, Index, Length) \
88
PValue = JudyHSIns(PJHS, Index, Length)
92
<DT><A name="JudyHSFreeArray"><B>JudyHSFreeArray(&PJHS, &JError)</B></A></DT>
95
#define JHSFA(Rc_word, PJHS) \
96
Rc_word = JudyHSFreeArray(&PJHS, PJE0)
101
Definitions for all the Judy functions, the types
116
are provided in the <B>Judy.h</B> header file
117
(/usr/include/Judy.h).
118
<B>Note</B>: Callers should define JudyHS arrays as type <B>Pvoid_t</B>,
119
which can be passed by value to functions that take
120
<B>Pcvoid_t</B> (constant <B>Pvoid_t</B>),
121
and also by address to functions that take <B>PPvoid_t</B>.
123
The return type from most <B>JudyHS</B> functions is <B>PPvoid_t</B> so
124
that the values stored in the array can be pointers to other objects,
125
which is a typical usage, or cast to a <B>Word_t *</B> when a pointer
126
to a value is required instead of a pointer to a pointer.
129
<DT><B>AUTHOR</B></DT>
131
JudyHS was invented and implemented by Doug Baskins after retiring from Hewlett-Packard.
134
<DT><B>SEE ALSO</B></DT>
136
<A href="Judy_3.htm">Judy(3)</A>,
137
<A href="Judy1_3.htm">Judy1(3)</A>,
138
<A href="JudyL_3.htm">JudyL(3)</A>,
139
<A href="JudySL_3.htm">JudySL(3)</A>,
140
<A href="JudyHS_3.htm">JudyHS(3)</A>,
145
<A href="http://judy.sourceforge.net">
146
http://judy.sourceforge.net</A>,
147
for more information and Application Notes.