~ubuntu-branches/ubuntu/lucid/judy/lucid

« back to all changes in this revision

Viewing changes to doc/ext/JudySL_funcs_3x.htm

  • Committer: Bazaar Package Importer
  • Author(s): Theodore Y. Ts'o
  • Date: 2004-01-17 00:04:53 UTC
  • Revision ID: james.westby@ubuntu.com-20040117000453-d5sj6uoon2v1g4gf
Tags: upstream-0.0.4
ImportĀ upstreamĀ versionĀ 0.0.4

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<HTML>
 
2
<HEAD>
 
3
<!-- @(#) $Revision: 4.3 $ $Source: /judy/doc/ext/JudySL_funcs_3x.htm $ --->
 
4
<TITLE>JudySL_funcs(3X)</TITLE>
 
5
</HEAD>
 
6
 
 
7
<BODY>
 
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>
 
12
</TR></TABLE>
 
13
 
 
14
<P>
 
15
<DL>
 
16
 
 
17
<!----------------->
 
18
<DT><B>NAME</B></DT>
 
19
<DD>
 
20
JudySL functions -
 
21
C library for creating and accessing a dynamic array, using
 
22
a null-terminated string as an index (associative array)
 
23
 
 
24
<!----------------->
 
25
<P>
 
26
<DT><B>SYNOPSIS</B></DT>
 
27
<DD>
 
28
<B><PRE>
 
29
 
 
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);
 
38
</PRE></B>
 
39
 
 
40
<!----------------->
 
41
<P>
 
42
<DT><B>DESCRIPTION</B></DT>
 
43
<DD>
 
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>
 
49
for more information.
 
50
The function call definitions are included here for completeness.
 
51
<P>
 
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.
 
60
<P>
 
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).
 
65
<P>
 
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.
 
73
<P>
 
74
Notice the placement of the <B>&amp;</B> in the different functions.
 
75
 
 
76
<P>
 
77
<DL>
 
78
<DT><A name="JudySLIns"><B>JudySLIns(&amp;PJSLArray, Index, &amp;JError)</B></A></DT>
 
79
<DD>
 
80
<PRE>
 
81
#define JSLI(PValue, PJSLArray, Index) \
 
82
   PValue = JudyLIns(&amp;PJSLArray, Index, PJE0)
 
83
 
 
84
</PRE>
 
85
 
 
86
<P>
 
87
<DT><A name="JudySLDel"><B>JudySLDel(&amp;PJSLArray, Index, &amp;JError)</B></A></DT>
 
88
<DD>
 
89
<PRE>
 
90
#define JSLD(Rc_int, PJSLArray, Index) \
 
91
   Rc_int = JudySLDel(&amp;PJSLArray, Index, PJE0)
 
92
 
 
93
</PRE>
 
94
 
 
95
<P>
 
96
<DT><A name="JudySLGet"><B>JudySLGet(PJSLArray, Index, &amp;JError)</B></A></DT>
 
97
<DD>
 
98
<PRE>
 
99
#define JSLG(PValue, PJSLArray, Index) \
 
100
   PValue = JudySLIns(PJSLArray, Index, PJE0)
 
101
 
 
102
</PRE>
 
103
 
 
104
 
 
105
<P>
 
106
<DT><A name="JudySLFreeArray"><B>JudySLFreeArray(&amp;PJSLArray, &amp;JError)</B></A></DT>
 
107
<DD>
 
108
<PRE>
 
109
#define JSLFA(Rc_word, PJSLArray) \
 
110
   Rc_word = JudySLFreeArray(&amp;PJSLArray, PJE0)
 
111
 
 
112
</PRE>
 
113
 
 
114
<P>
 
115
<DT><A name="JudySLFirst"><B>JudySLFirst(PJSLArray, Index, &amp;JError)</B></A></DT>
 
116
<DD>
 
117
<PRE>
 
118
#define JSLF(PValue, PJSLArray, Index) \
 
119
   PValue = JudySLFirst(PJSLArray, Index, PJE0)
 
120
 
 
121
</PRE>
 
122
 
 
123
<P>
 
124
<DT><A name="JudySLNext"><B>JudySLNext(PJSLArray, Index, &amp;JError)</B></A></DT>
 
125
<DD>
 
126
<PRE>
 
127
#define JSLN(PValue, PJSLArray, Index) \
 
128
   PValue = JudySLNext(PJSLArray, Index, PJE0)
 
129
 
 
130
</PRE>
 
131
 
 
132
<P>
 
133
<DT><A name="JudySLLast"><B>JudySLLast(PJSLArray, Index, &amp;JError)</B></A></DT>
 
134
<DD>
 
135
<PRE>
 
136
#define JSLL(PValue, PJSLArray, Index) \
 
137
   PValue = JudySLLast(PJSLArray, Index, PJE0)
 
138
 
 
139
</PRE>
 
140
 
 
141
<P>
 
142
<DT><A name="JudySLPrev"><B>JudySLPrev(PJSLArray, Index, &amp;JError)</B></A></DT>
 
143
<DD>
 
144
<PRE>
 
145
#define JSLP(PValue, PJSLArray, Index) \
 
146
   PValue = JudySLPrev(PJSLArray, Index, PJE0)
 
147
 
 
148
</PRE>
 
149
</DL>
 
150
 
 
151
<P>
 
152
Definitions for all the Judy functions, the types
 
153
<B>Pvoid_t</B>,
 
154
<B>Pcvoid_t</B>,
 
155
<B>PPvoid_t</B>,
 
156
<B>Word_t </B>,
 
157
<B>JError_t</B>,
 
158
and
 
159
<B>PJError_t</B>,
 
160
the constants
 
161
<B>NULL</B>,
 
162
<B>JU_ERRNO_*</B>,
 
163
<B>JERR</B>,
 
164
<B>PPJERR</B>,
 
165
and
 
166
<B>PJE0</B>
 
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>.
 
173
<P>
 
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.
 
178
 
 
179
<!----------------->
 
180
<P>
 
181
<DT><B>AUTHOR</B></DT>
 
182
<DD>
 
183
Judy was invented by Doug Baskins and implemented by Hewlett-Packard.
 
184
 
 
185
<!----------------->
 
186
<P>
 
187
<DT><B>SEE ALSO</B></DT>
 
188
<DD>
 
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>,
 
195
<BR>
 
196
<I>malloc</I>(3),
 
197
<BR>
 
198
the Judy website,
 
199
<A href="http://www.sourcejudy.com/">
 
200
http://www.sourcejudy.com/</A>,
 
201
for more information and Application Notes.
 
202
</DL>
 
203
 
 
204
</BODY>
 
205
</HTML>