Alien-Judy

 view release on metacpan or  search on metacpan

src/judy-1.0.5/src/Judy.h  view on Meta::CPAN

extern int      Judy1LastEmpty(  Pcvoid_t  PArray, Word_t * PIndex,  P_JE);
extern int      Judy1PrevEmpty(  Pcvoid_t  PArray, Word_t * PIndex,  P_JE);

extern PPvoid_t JudyLGet(        Pcvoid_t  PArray, Word_t    Index,  P_JE);
extern PPvoid_t JudyLIns(        PPvoid_t PPArray, Word_t    Index,  P_JE);
extern int      JudyLInsArray(   PPvoid_t PPArray, Word_t    Count,
                                             const Word_t * const PIndex,
                                             const Word_t * const PValue,

// ****************************************************************************
// JUDYL FUNCTIONS:
                                                                     P_JE);
extern int      JudyLDel(        PPvoid_t PPArray, Word_t    Index,  P_JE);
extern Word_t   JudyLCount(      Pcvoid_t  PArray, Word_t    Index1,
                                                   Word_t    Index2, P_JE);
extern PPvoid_t JudyLByCount(    Pcvoid_t  PArray, Word_t    Count,
                                                   Word_t *  PIndex, P_JE);
extern Word_t   JudyLFreeArray(  PPvoid_t PPArray,                   P_JE);
extern Word_t   JudyLMemUsed(    Pcvoid_t  PArray);
extern Word_t   JudyLMemActive(  Pcvoid_t  PArray);
extern PPvoid_t JudyLFirst(      Pcvoid_t  PArray, Word_t * PIndex,  P_JE);
extern PPvoid_t JudyLNext(       Pcvoid_t  PArray, Word_t * PIndex,  P_JE);
extern PPvoid_t JudyLLast(       Pcvoid_t  PArray, Word_t * PIndex,  P_JE);
extern PPvoid_t JudyLPrev(       Pcvoid_t  PArray, Word_t * PIndex,  P_JE);
extern int      JudyLFirstEmpty( Pcvoid_t  PArray, Word_t * PIndex,  P_JE);
extern int      JudyLNextEmpty(  Pcvoid_t  PArray, Word_t * PIndex,  P_JE);
extern int      JudyLLastEmpty(  Pcvoid_t  PArray, Word_t * PIndex,  P_JE);
extern int      JudyLPrevEmpty(  Pcvoid_t  PArray, Word_t * PIndex,  P_JE);

// ****************************************************************************
// JUDYSL FUNCTIONS:

extern PPvoid_t JudySLGet(       Pcvoid_t, const uint8_t * Index, P_JE);
extern PPvoid_t JudySLIns(       PPvoid_t, const uint8_t * Index, P_JE);
extern int      JudySLDel(       PPvoid_t, const uint8_t * Index, P_JE);
extern Word_t   JudySLFreeArray( PPvoid_t,                        P_JE);
extern PPvoid_t JudySLFirst(     Pcvoid_t,       uint8_t * Index, P_JE);
extern PPvoid_t JudySLNext(      Pcvoid_t,       uint8_t * Index, P_JE);
extern PPvoid_t JudySLLast(      Pcvoid_t,       uint8_t * Index, P_JE);
extern PPvoid_t JudySLPrev(      Pcvoid_t,       uint8_t * Index, P_JE);

// ****************************************************************************
// JUDYHSL FUNCTIONS:

extern PPvoid_t JudyHSGet(       Pcvoid_t,  void *, Word_t);
extern PPvoid_t JudyHSIns(       PPvoid_t,  void *, Word_t, P_JE);
extern int      JudyHSDel(       PPvoid_t,  void *, Word_t, P_JE);
extern Word_t   JudyHSFreeArray( PPvoid_t,                  P_JE);

extern const char *Judy1MallocSizes;
extern const char *JudyLMallocSizes;

// ****************************************************************************
// JUDY memory interface to malloc() FUNCTIONS:

extern Word_t JudyMalloc(Word_t);               // words reqd => words allocd.
extern Word_t JudyMallocVirtual(Word_t);        // words reqd => words allocd.
extern void   JudyFree(Pvoid_t, Word_t);        // free, size in words.
extern void   JudyFreeVirtual(Pvoid_t, Word_t); // free, size in words.

#define JLAP_INVALID    0x1     /* flag to mark pointer "not a Judy array" */

// ****************************************************************************
// MACRO EQUIVALENTS FOR JUDY FUNCTIONS:
//
// The following macros, such as J1T, are shorthands for calling Judy functions
// with parameter address-of and detailed error checking included.  Since they
// are macros, the error checking code is replicated each time the macro is
// used, but it runs fast in the normal case of no error.
//
// If the caller does not like the way the default JUDYERROR macro handles
// errors (such as an exit(1) call when out of memory), they may define their
// own before the "#include <Judy.h>".  A routine such as HandleJudyError
// could do checking on specific error numbers and print a different message
// dependent on the error.  The following is one example:
//
// Note: the back-slashes are removed because some compilers will not accept
// them in comments.
//
// void HandleJudyError(uint8_t *, int, uint8_t *, int, int);
// #define JUDYERROR(CallerFile, CallerLine, JudyFunc, JudyErrno, JudyErrID)
// {
//    HandleJudyError(CallerFile, CallerLine, JudyFunc, JudyErrno, JudyErrID);
// }
//
// The routine HandleJudyError could do checking on specific error numbers and
// print a different message dependent on the error.
//
// The macro receives five parameters that are:
//
// 1.  CallerFile:  Source filename where a Judy call returned a serious error.
// 2.  CallerLine:  Line number in that source file.
// 3.  JudyFunc:    Name of Judy function reporting the error.
// 4.  JudyErrno:   One of the JU_ERRNO* values enumerated above.
// 5.  JudyErrID:   The je_ErrID field described above.

#ifndef JUDYERROR_NOTEST
#ifndef JUDYERROR       /* supply a default error macro */
#include <stdio.h>

#define JUDYERROR(CallerFile, CallerLine, JudyFunc, JudyErrno, JudyErrID) \
    {                                                                     \
        (void) fprintf(stderr, "File '%s', line %d: %s(), "               \
           "JU_ERRNO_* == %d, ID == %d\n",                                \
           CallerFile, CallerLine,                                        \
           JudyFunc, JudyErrno, JudyErrID);                               \
        exit(1);                                                          \
    }

#endif /* JUDYERROR */
#endif /* JUDYERROR_NOTEST */

// If the JUDYERROR macro is not desired at all, then the following eliminates
// it.  However, the return code from each Judy function (that is, the first
// parameter of each macro) must be checked by the caller to assure that an
// error did not occur.
//
// Example:
//
//   #define JUDYERROR_NOTEST 1
//   #include <Judy.h>



( run in 1.294 second using v1.01-cache-2.11-cpan-cdf2f3d4e48 )