|
NAMEJudy1 functions - C library for creating and accessing a dynamic array of bits, using any value of a word as an indexSYNOPSISint Judy1Set( PPvoid_t PPJ1Array, Word_t Index, PJError_t PJError); int Judy1Unset( PPvoid_t PPJ1Array, Word_t Index, PJError_t PJError); int Judy1Test( Pcvoid_t PJ1Array, Word_t Index, PJError_t PJError); Word_t Judy1Count( Pcvoid_t PJ1Array, Word_t Index1, Word_t Index2, PJError_t PJError); int Judy1ByCount( Pcvoid_t PJ1Array, Word_t Nth, Word_t * PIndex, PJError_t PJError); Word_t Judy1FreeArray( PPvoid_t PPJ1Array, PJError_t PJError); Word_t Judy1MemUsed( Pcvoid_t PJ1Array); int Judy1First( Pcvoid_t PJ1Array, Word_t * PIndex, PJError_t PJError); int Judy1Next( Pcvoid_t PJ1Array, Word_t * PIndex, PJError_t PJError); int Judy1Last( Pcvoid_t PJ1Array, Word_t * PIndex, PJError_t PJError); int Judy1Prev( Pcvoid_t PJ1Array, Word_t * PIndex, PJError_t PJError); int Judy1FirstEmpty(Pcvoid_t PJ1Array, Word_t * PIndex, PJError_t PJError); int Judy1NextEmpty( Pcvoid_t PJ1Array, Word_t * PIndex, PJError_t PJError); int Judy1LastEmpty( Pcvoid_t PJ1Array, Word_t * PIndex, PJError_t PJError); int Judy1PrevEmpty( Pcvoid_t PJ1Array, Word_t * PIndex, PJError_t PJError); DESCRIPTIONA macro equivalent exists for each function call. Because the macro forms are sometimes faster and have a simpler error handling interface than the equivalent functions, they are the preferred way of calling the Judy1 functions. See Judy1(3) for more information. The function call definitions are included here for completeness.One of the difficulties in using the Judy1 function calls lies in determining whether to pass a pointer or the address of a pointer. Since the functions that modify the Judy1 array must also modify the pointer to the Judy1 array, you must pass the address of the pointer rather than the pointer itself. This often leads to hard-to-debug programmatic errors. In practice, the macros allow the compiler to catch programming errors when pointers instead of addresses of pointers are passed. The Judy1 function calls have an additional parameter beyond those specified in the macro calls. This parameter is either a pointer to an error structure, or NULL (in which case the detailed error information is not returned). In the following descriptions, the functions are described in terms of how the macros use them (only in the case of #define JUDYERROR_NOTEST 1). This is the suggested use of the macros after your program has been fully debugged. When the JUDYERROR_NOTEST macro is not specified, an error structure is declared to store error information returned from the Judy1 functions when an error occurs. Notice the placement of the & in the different functions.
Definitions for all of the Judy functions, the types Pvoid_t, Pcvoid_t, PPvoid_t, Word_t, JError_t, and PJError_t, the constants NULL, JU_ERRNO_*, JERR, and PJE0, are provided in the Judy.h header file (/usr/include/Judy.h). Note: Callers should define Judy1 arrays as type Pvoid_t, which can be passed by value to functions that take Pcvoid_t (constant Pvoid_t), and also by address to functions that take PPvoid_t. AUTHORJudy was invented by Doug Baskins and implemented by Hewlett-Packard.SEE ALSOJudy(3), JudyL(3), JudySL(3), JudyHS(3),malloc(), the Judy website, http://judy.sourceforge.net, for more information and Application Notes. Visit the GSP FreeBSD Man Page Interface. |