Debian Codegraph @

doc/ext/JudySL_funcs_3.htm

raw
1 <HTML>
2 <HEAD>
3 <!-- @(#) $Revision: 4.5 $ $Source: /cvsroot/judy/doc/ext/JudySL_funcs_3.htm,v $ --->
4 <TITLE>JudySL_funcs(3)</TITLE>
5 </HEAD>
6 <BODY>
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>
11 </TR></TABLE>
12 <P>
13 <DL>
14 <!----------------->
15 <DT><B>NAME</B></DT>
16 <DD>
17 JudySL functions -
18 C library for creating and accessing a dynamic array, using
19 a null-terminated string as an index (associative array)
20 <!----------------->
21 <P>
22 <DT><B>SYNOPSIS</B></DT>
23 <DD>
24 <B><PRE>
25
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);
34 </PRE></B>
35 <!----------------->
36 <P>
37 <DT><B>DESCRIPTION</B></DT>
38 <DD>
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>
44 for more information.
45 The function call definitions are included here for completeness.
46 <P>
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.
55 <P>
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).
60 <P>
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.
68 <P>
69 Notice the placement of the <B>&amp;</B> in the different functions.
70 <P>
71 <DL>
72 <DT><A name="JudySLIns"><B>JudySLIns(&amp;PJSLArray, Index, &amp;JError)</B></A></DT>
73 <DD>
74 <PRE>
75 #define JSLI(PValue, PJSLArray, Index) \
76 PValue = JudyLIns(&amp;PJSLArray, Index, PJE0)
77
78 </PRE>
79 <P>
80 <DT><A name="JudySLDel"><B>JudySLDel(&amp;PJSLArray, Index, &amp;JError)</B></A></DT>
81 <DD>
82 <PRE>
83 #define JSLD(Rc_int, PJSLArray, Index) \
84 Rc_int = JudySLDel(&amp;PJSLArray, Index, PJE0)
85
86 </PRE>
87 <P>
88 <DT><A name="JudySLGet"><B>JudySLGet(PJSLArray, Index, &amp;JError)</B></A></DT>
89 <DD>
90 <PRE>
91 #define JSLG(PValue, PJSLArray, Index) \
92 PValue = JudySLIns(PJSLArray, Index, PJE0)
93
94 </PRE>
95 <P>
96 <DT><A name="JudySLFreeArray"><B>JudySLFreeArray(&amp;PJSLArray, &amp;JError)</B></A></DT>
97 <DD>
98 <PRE>
99 #define JSLFA(Rc_word, PJSLArray) \
100 Rc_word = JudySLFreeArray(&amp;PJSLArray, PJE0)
101
102 </PRE>
103 <P>
104 <DT><A name="JudySLFirst"><B>JudySLFirst(PJSLArray, Index, &amp;JError)</B></A></DT>
105 <DD>
106 <PRE>
107 #define JSLF(PValue, PJSLArray, Index) \
108 PValue = JudySLFirst(PJSLArray, Index, PJE0)
109
110 </PRE>
111 <P>
112 <DT><A name="JudySLNext"><B>JudySLNext(PJSLArray, Index, &amp;JError)</B></A></DT>
113 <DD>
114 <PRE>
115 #define JSLN(PValue, PJSLArray, Index) \
116 PValue = JudySLNext(PJSLArray, Index, PJE0)
117
118 </PRE>
119 <P>
120 <DT><A name="JudySLLast"><B>JudySLLast(PJSLArray, Index, &amp;JError)</B></A></DT>
121 <DD>
122 <PRE>
123 #define JSLL(PValue, PJSLArray, Index) \
124 PValue = JudySLLast(PJSLArray, Index, PJE0)
125
126 </PRE>
127 <P>
128 <DT><A name="JudySLPrev"><B>JudySLPrev(PJSLArray, Index, &amp;JError)</B></A></DT>
129 <DD>
130 <PRE>
131 #define JSLP(PValue, PJSLArray, Index) \
132 PValue = JudySLPrev(PJSLArray, Index, PJE0)
133
134 </PRE>
135 </DL>
136 <P>
137 Definitions for all the Judy functions, the types
138 <B>Pvoid_t</B>,
139 <B>Pcvoid_t</B>,
140 <B>PPvoid_t</B>,
141 <B>Word_t </B>,
142 <B>JError_t</B>,
143 and
144 <B>PJError_t</B>,
145 the constants
146 <B>NULL</B>,
147 <B>JU_ERRNO_*</B>,
148 <B>JERR</B>,
149 <B>PPJERR</B>,
150 and
151 <B>PJE0</B>
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>.
158 <P>
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.
163 <!----------------->
164 <P>
165 <DT><B>AUTHOR</B></DT>
166 <DD>
167 Judy was invented by Doug Baskins and implemented by Hewlett-Packard.
168 <!----------------->
169 <P>
170 <DT><B>SEE ALSO</B></DT>
171 <DD>
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>,
177 <BR>
178 <I>malloc()</I>,
179 <BR>
180 the Judy website,
181 <A href="http://judy.sourceforge.net">
182 http://judy.sourceforge.net</A>,
183 for more information and Application Notes.
184 </DL>
185 </BODY>
186 </HTML>