1JudyHS_funcs(3)            Library Functions Manual            JudyHS_funcs(3)
2
3
4

NAME

6       JudyHS  functions  - C library for creating and accessing a dynamic ar‐
7       ray, using an array-of-bytes of a length: Length as an Index and a word
8       as a Value.
9

SYNOPSIS

11       PPvoid_t JudyHSIns(PPvoid_t PPJHS, void *Index, Word_t Length, PJError_t PJError);
12       int      JudyHSDel(PPvoid_t PPJHS, void *Index, Word_t Length, PJError_t PJError);
13       PPvoid_t JudyHSGet(Pcvoid_t  PJHS, void *Index, Word_t Length, PJError_t PJError);
14       Word_t   JudyHSFreeArray(PPvoid_t PPJHS, PJError_t PJError);
15

DESCRIPTION

17       A  macro  equivalent  exists for each function call.  Because the macro
18       forms are sometimes faster and have a simpler error handling  interface
19       than  the  equivalent  functions, they are the preferred way of calling
20       the JudyHS functions.  See JudyHS(3) for more information.   The  func‐
21       tion call definitions are included here for completeness.
22
23       One  of the difficulties in using the JudyHS function calls lies in de‐
24       termining whether to pass a pointer or the address of a pointer.  Since
25       the functions that modify the JudyHS array must also modify the pointer
26       to the JudyHS array, you must pass the address of  the  pointer  rather
27       than  the  pointer  itself.  This often leads to hard-to-debug program‐
28       matic errors.  In practice, the macros allow the compiler to catch pro‐
29       gramming  errors  when  pointers  instead  of addresses of pointers are
30       passed.
31
32       The JudyHS function calls have an  additional  parameter  beyond  those
33       specified in the macro calls.  This parameter is either a pointer to an
34       error structure, or NULL (in which case the error  information  is  not
35       returned -- only PJERR in the return parameter).
36
37       In  the following descriptions, the functions are described in terms of
38       how the macros use them.  This is the suggested use of the macros after
39       your  program has been fully debugged.  When the JUDYERROR_NOTEST macro
40       is not specified, an error structure is declared to store error  infor‐
41       mation returned from the JudyHS functions when an error occurs.
42
43       Notice the placement of the & in the different functions.
44
45        JudyHSIns(&PJHS, Index, Length, &JError)
46
47                      #define JHSI(PValue, PJHS, Index) \
48                         PValue = JudyLIns(&PJHS, Index, PJE0)
49
50        JudyHSDel(&PJHS, Index, Length, &JError)
51
52                      #define JHSD(Rc_int, PJHS, Index, Length) \
53                         Rc_int = JudyHSDel(&PJHS, Index, Length, PJE0)
54
55        JudyHSGet(PJHS, Index, Length)
56
57                      #define JHSG(PValue, PJHS, Index, Length) \
58                         PValue = JudyHSIns(PJHS, Index, Length)
59
60        JudyHSFreeArray(&PJHS, &JError)
61
62                      #define JHSFA(Rc_word, PJHS) \
63                         Rc_word = JudyHSFreeArray(&PJHS, PJE0)
64
65       Definitions  for  all  the Judy functions, the types Pvoid_t, Pcvoid_t,
66       PPvoid_t, Word_t , JError_t, and PJError_t, the constants NULL,  JU_ER‐
67       RNO_*,  JERR,  PPJERR,  and PJE0 are provided in the Judy.h header file
68       (/usr/include/Judy.h).  Note:  Callers should define JudyHS  arrays  as
69       type  Pvoid_t,  which  can  be  passed  by value to functions that take
70       Pcvoid_t (constant Pvoid_t), and also by address to functions that take
71       PPvoid_t.
72
73       The return type from most JudyHS functions is PPvoid_t so that the val‐
74       ues stored in the array can be pointers to other objects,  which  is  a
75       typical  usage,  or cast to a Word_t * when a pointer to a value is re‐
76       quired instead of a pointer to a pointer.
77

AUTHOR

79       JudyHS was invented and implemented by Doug Baskins after retiring from
80       Hewlett-Packard.
81

SEE ALSO

83       Judy(3), Judy1(3), JudyL(3), JudySL(3), JudyHS(3),
84       malloc(),
85       the Judy website, http://judy.sourceforge.net, for more information and
86       Application Notes.
87
88
89
90                                                               JudyHS_funcs(3)
Impressum