1JudyL_funcs(3) Library Functions Manual JudyL_funcs(3)
2
3
4
6 JudyL functions - C library for creating and accessing a dynamic array
7 of words, using any value of a word as an index
8
10 PPvoid_t JudyLIns( PPvoid_t PPJLArray, Word_t Index, PJError_t PJError);
11 int JudyLDel( PPvoid_t PPJLArray, Word_t Index, PJError_t PJError);
12 PPvoid_t JudyLGet( Pcvoid_t PJLArray, Word_t Index, PJError_t PJError);
13 Word_t JudyLCount( Pcvoid_t PJLArray, Word_t Index1, Word_t Index2, PJError_t PJError);
14 PPvoid_t JudyLByCount( Pcvoid_t PJLArray, Word_t Nth, Word_t * PIndex, PJError_t PJError);
15 Word_t JudyLFreeArray( PPvoid_t PPJLArray, PJError_t PJError);
16 Word_t JudyLMemUsed( Pcvoid_t PJLArray);
17 PPvoid_t JudyLFirst( Pcvoid_t PJLArray, Word_t * PIndex, PJError_t PJError);
18 PPvoid_t JudyLNext( Pcvoid_t PJLArray, Word_t * PIndex, PJError_t PJError);
19 PPvoid_t JudyLLast( Pcvoid_t PJLArray, Word_t * PIndex, PJError_t PJError);
20 PPvoid_t JudyLPrev( Pcvoid_t PJLArray, Word_t * PIndex, PJError_t PJError);
21 int JudyLFirstEmpty(Pcvoid_t PJLArray, Word_t * PIndex, PJError_t PJError);
22 int JudyLNextEmpty( Pcvoid_t PJLArray, Word_t * PIndex, PJError_t PJError);
23 int JudyLLastEmpty( Pcvoid_t PJLArray, Word_t * PIndex, PJError_t PJError);
24 int JudyLPrevEmpty( Pcvoid_t PJLArray, Word_t * PIndex, PJError_t PJError);
25
27 A macro equivalent exists for each function call. Because the macro
28 forms are sometimes faster and have a simpler error handling interface
29 than the equivalent functions, they are the preferred way of calling
30 the JudyL functions. See JudyL(3) for more information. The function
31 call definitions are included here for completeness.
32
33 One of the difficulties in using the JudyL function calls lies in
34 determining whether to pass a pointer or the address of a pointer.
35 Since the functions that modify the JudyL array must also modify the
36 pointer to the JudyL array, you must pass the address of the pointer
37 rather than the pointer itself. This often leads to hard-to-debug pro‐
38 grammatic errors. In practice, the macros allow the compiler to catch
39 programming errors when pointers instead of addresses of pointers are
40 passed.
41
42 The JudyL function calls have an additional parameter beyond those
43 specified in the macro calls. This parameter is either a pointer to an
44 error structure, or NULL (in which case the detailed error information
45 is not returned).
46
47 In the following descriptions, the functions are described in terms of
48 how the macros use them (only in the case of #define JUDYERROR_NOTEST
49 1). This is the suggested use of the macros after your program has
50 been fully debugged. When the JUDYERROR_NOTEST macro is not specified,
51 an error structure is declared to store error information returned from
52 the JudyL functions when an error occurs.
53
54 Notice the placement of the & in the different functions.
55
56 JudyLIns(&PJLArray, Index, &JError)
57
58 #define JLI(PValue, PJLArray, Index) \
59 PValue = JudyLIns(&PJLArray, Index, PJE0)
60
61 JudyLDel(&PJLArray, Index, &JError)
62
63 #define JLD(Rc_int, PJLArray, Index) \
64 Rc_int = JudyLDel(&PJLArray, Index, PJE0)
65
66 JudyLGet(PJLArray, Index, &JError)
67
68 #define JLG(PValue, PJLArray, Index) \
69 PValue = JudyLGet(PJLArray, Index, PJE0)
70
71 JudyLCount(PJLArray, Index1, Index2, &JError)
72
73 #define JLC(Rc_word, PJLArray, Index1, Index2) \
74 Rc_word = JudyLCount(PJLArray, Index1, Index2, PJE0)
75
76 JudyLByCount(PJLArray, Nth, &Index, &JError)
77
78 #define JLBC(PValue, PJLArray, Nth, Index) \
79 PValue = JudyLByCount(PJLArray, Nth, &Index, PJE0)
80
81 JudyLFreeArray(&PJLArray, &JError)
82
83 #define JLFA(Rc_word, PJLArray) \
84 Rc_word = JudyLFreeArray(&PJLArray, PJE0)
85
86 JudyLMemUsed(PJLArray)
87
88 #define JLMU(Rc_word, PJLArray) \
89 Rc_word = JudyLMemUsed(PJLArray)
90
91 JudyLFirst(PJLArray, &Index, &JError)
92
93 #define JLF(PValue, PJLArray, Index) \
94 PValue = JudyLFirst(PJLArray, &Index, PJEO)
95
96 JudyLNext(PJLArray, &Index, &JError)
97
98 #define JLN(PValue, PJLArray, Index) \
99 PValue = JudyLNext(PJLArray, &Index, PJEO)
100
101 JudyLLast(PJLArray, &Index, &JError)
102
103 #define JLL(PValue, PJLArray, Index) \
104 PValue = JudyLLast(PJLArray, &Index, PJEO)
105
106 JudyLPrev(PJLArray, &Index, &JError)
107
108 #define JLP(PValue, PJLArray, Index) \
109 PValue = JudyLPrev(PJLArray, &Index, PJEO)
110
111 JudyLFirstEmpty(PJLArray, &Index, &JError)
112
113 #define JLFE(Rc_int, PJLArray, Index) \
114 Rc_int = JudyLFirstEmpty(PJLArray, &Index, PJEO)
115
116 JudyLNextEmpty(PJLArray, &Index, &JError)
117
118 #define JLNE(Rc_int, PJLArray, Index) \
119 Rc_int = JudyLNextEmpty(PJLArray, &Index, PJEO)
120
121 JudyLLastEmpty(PJLArray, &Index, &JError)
122
123 #define JLLE(Rc_int, PJLArray, Index) \
124 Rc_int = JudyLLastEmpty(PJLArray, &Index, PJEO)
125
126 JudyLPrevEmpty(PJLArray, &Index, &JError)
127
128 #define JLPE(Rc_int, PJLArray, Index) \
129 Rc_int = JudyLPrevEmpty(PJLArray, &Index, PJEO)
130
131 Definitions for all the Judy functions, the types Pvoid_t, Pcvoid_t,
132 PPvoid_t, Word_t, JError_t, and PJError_t, the constants NULL,
133 JU_ERRNO_*, JERR, PPJERR, and PJE0, are provided in the Judy.h header
134 file (/usr/include/Judy.h). Note: Callers should define JudyL arrays
135 as type Pvoid_t, which can be passed by value to functions that take
136 Pcvoid_t (constant Pvoid_t), and also by address to functions that take
137 PPvoid_t.
138
139 The return type from most JudyL functions is PPvoid_t so that the val‐
140 ues stored in the array can be pointers to other objects, which is a
141 typical usage, or cast to a Word_t * when a pointer to a Value is
142 required instead of a pointer to a pointer.
143
145 Judy was invented by Doug Baskins and implemented by Hewlett-Packard.
146
148 Judy(3), Judy1(3), JudyL(3), JudySL(3), JudyHS(3),
149 malloc(),
150 the Judy website, http://judy.sourceforge.net, for more information and
151 Application Notes.
152
153
154
155 JudyL_funcs(3)