1JudySL_funcs(3) Library Functions Manual JudySL_funcs(3)
2
3
4
6 JudySL functions - C library for creating and accessing a dynamic ar‐
7 ray, using a null-terminated string as an index (associative array)
8
10 PPvoid_t JudySLIns( PPvoid_t PPJSLArray, const uint8_t * Index, PJError_t PJError);
11 int JudySLDel( PPvoid_t PPJSLArray, const uint8_t * Index, PJError_t PJError);
12 PPvoid_t JudySLGet( Pcvoid_t PJSLArray, const uint8_t * Index, PJError_t PJError);
13 Word_t JudySLFreeArray(PPvoid_t PPJSLArray, PJError_t PJError);
14 PPvoid_t JudySLFirst( Pcvoid_t PJSLArray, uint8_t * Index, PJError_t PJError);
15 PPvoid_t JudySLNext( Pcvoid_t PJSLArray, uint8_t * Index, PJError_t PJError);
16 PPvoid_t JudySLLast( Pcvoid_t PJSLArray, uint8_t * Index, PJError_t PJError);
17 PPvoid_t JudySLPrev( Pcvoid_t PJSLArray, uint8_t * Index, PJError_t PJError);
18
20 A macro equivalent exists for each function call. Because the macro
21 forms are sometimes faster and have a simpler error handling interface
22 than the equivalent functions, they are the preferred way of calling
23 the JudySL functions. See JudySL(3) for more information. The func‐
24 tion call definitions are included here for completeness.
25
26 One of the difficulties in using the JudySL function calls lies in de‐
27 termining whether to pass a pointer or the address of a pointer. Since
28 the functions that modify the JudySL array must also modify the pointer
29 to the JudySL array, you must pass the address of the pointer rather
30 than the pointer itself. This often leads to hard-to-debug program‐
31 matic errors. In practice, the macros allow the compiler to catch pro‐
32 gramming errors when pointers instead of addresses of pointers are
33 passed.
34
35 The JudySL function calls have an additional parameter beyond those
36 specified in the macro calls. This parameter is either a pointer to an
37 error structure, or NULL (in which case the detailed error information
38 is not returned).
39
40 In the following descriptions, the functions are described in terms of
41 how the macros use them (only in the case of #define JUDYERROR_NOTEST
42 1). This is the suggested use of the macros after your program has
43 been fully debugged. When the JUDYERROR_NOTEST macro is not specified,
44 an error structure is declared to store error information returned from
45 the JudySL functions when an error occurs.
46
47 Notice the placement of the & in the different functions.
48
49 JudySLIns(&PJSLArray, Index, &JError)
50
51 #define JSLI(PValue, PJSLArray, Index) \
52 PValue = JudyLIns(&PJSLArray, Index, PJE0)
53
54 JudySLDel(&PJSLArray, Index, &JError)
55
56 #define JSLD(Rc_int, PJSLArray, Index) \
57 Rc_int = JudySLDel(&PJSLArray, Index, PJE0)
58
59 JudySLGet(PJSLArray, Index, &JError)
60
61 #define JSLG(PValue, PJSLArray, Index) \
62 PValue = JudySLIns(PJSLArray, Index, PJE0)
63
64 JudySLFreeArray(&PJSLArray, &JError)
65
66 #define JSLFA(Rc_word, PJSLArray) \
67 Rc_word = JudySLFreeArray(&PJSLArray, PJE0)
68
69 JudySLFirst(PJSLArray, Index, &JError)
70
71 #define JSLF(PValue, PJSLArray, Index) \
72 PValue = JudySLFirst(PJSLArray, Index, PJE0)
73
74 JudySLNext(PJSLArray, Index, &JError)
75
76 #define JSLN(PValue, PJSLArray, Index) \
77 PValue = JudySLNext(PJSLArray, Index, PJE0)
78
79 JudySLLast(PJSLArray, Index, &JError)
80
81 #define JSLL(PValue, PJSLArray, Index) \
82 PValue = JudySLLast(PJSLArray, Index, PJE0)
83
84 JudySLPrev(PJSLArray, Index, &JError)
85
86 #define JSLP(PValue, PJSLArray, Index) \
87 PValue = JudySLPrev(PJSLArray, Index, PJE0)
88
89 Definitions for all the Judy functions, the types Pvoid_t, Pcvoid_t,
90 PPvoid_t, Word_t , JError_t, and PJError_t, the constants NULL, JU_ER‐
91 RNO_*, JERR, PPJERR, and PJE0 are provided in the Judy.h header file
92 (/usr/include/Judy.h). Note: Callers should define JudySL arrays as
93 type Pvoid_t, which can be passed by value to functions that take
94 Pcvoid_t (constant Pvoid_t), and also by address to functions that take
95 PPvoid_t.
96
97 The return type from most JudySL functions is PPvoid_t so that the val‐
98 ues stored in the array can be pointers to other objects, which is a
99 typical usage, or cast to a Word_t * when a pointer to a value is re‐
100 quired instead of a pointer to a pointer.
101
103 Judy was invented by Doug Baskins and implemented by Hewlett-Packard.
104
106 Judy(3), Judy1(3), JudyL(3), JudySL(3), JudyHS(3),
107 malloc(),
108 the Judy website, http://judy.sourceforge.net, for more information and
109 Application Notes.
110
111
112
113 JudySL_funcs(3)