Added and working! Array module 1.65 is a go for release!
This commit is contained in:
parent
e8a4b46cc5
commit
a3572f7206
108
dlls/arrayx/Array.dsp
Normal file
108
dlls/arrayx/Array.dsp
Normal file
|
@ -0,0 +1,108 @@
|
|||
# Microsoft Developer Studio Project File - Name="Array" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
|
||||
|
||||
CFG=ARRAY - WIN32 RELEASE
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "Array.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "Array.mak" CFG="ARRAY - WIN32 RELEASE"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "Array - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
MTL=midl.exe
|
||||
RSC=rc.exe
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 2
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ARRAY_EXPORTS" /YX /FD /c
|
||||
# ADD CPP /nologo /MD /W3 /vmg /vms /GX /ZI /O2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ARRAY_EXPORTS" /D "_WINDLL" /D "_AFXDLL" /U "DLLEXPORT" /FR /YX /FD /c
|
||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
|
||||
# ADD LINK32 /nologo /dll /machine:I386
|
||||
# SUBTRACT LINK32 /incremental:yes
|
||||
# Begin Target
|
||||
|
||||
# Name "Array - Win32 Release"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\amxxmodule.cpp
|
||||
# SUBTRACT CPP /Z<none>
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\array.cpp
|
||||
# SUBTRACT CPP /Z<none> /u
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\amxxmodule.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\CArray.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\CHashtable.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\CKeytable.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\element.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\moduleconfig.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Resource Files"
|
||||
|
||||
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE="..\module\Judy-1.0.1\src\Judy.lib"
|
||||
# End Source File
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
BIN
dlls/arrayx/Array.ncb
Normal file
BIN
dlls/arrayx/Array.ncb
Normal file
Binary file not shown.
18
dlls/arrayx/Array.sln
Normal file
18
dlls/arrayx/Array.sln
Normal file
|
@ -0,0 +1,18 @@
|
|||
Microsoft Visual Studio Solution File, Format Version 8.00
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Array", "Array.vcproj", "{11B6F2E4-A603-4559-8E64-FFBF9541E238}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfiguration) = preSolution
|
||||
Release = Release
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfiguration) = postSolution
|
||||
{11B6F2E4-A603-4559-8E64-FFBF9541E238}.Release.ActiveCfg = Release|Win32
|
||||
{11B6F2E4-A603-4559-8E64-FFBF9541E238}.Release.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityAddIns) = postSolution
|
||||
EndGlobalSection
|
||||
EndGlobal
|
151
dlls/arrayx/Array.vcproj
Normal file
151
dlls/arrayx/Array.vcproj
Normal file
|
@ -0,0 +1,151 @@
|
|||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="7.10"
|
||||
Name="Array"
|
||||
SccProjectName=""
|
||||
SccLocalPath=""
|
||||
Keyword="MFCProj">
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"/>
|
||||
</Platforms>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory=".\Release"
|
||||
IntermediateDirectory=".\Release"
|
||||
ConfigurationType="2"
|
||||
UseOfMFC="2"
|
||||
ATLMinimizesCRunTimeLibraryUsage="FALSE"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="/vmg /vms"
|
||||
Optimization="2"
|
||||
InlineFunctionExpansion="1"
|
||||
PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS;_USRDLL;ARRAY_EXPORTS"
|
||||
StringPooling="TRUE"
|
||||
RuntimeLibrary="2"
|
||||
EnableFunctionLevelLinking="TRUE"
|
||||
UsePrecompiledHeader="2"
|
||||
PrecompiledHeaderFile=".\Release/Array.pch"
|
||||
AssemblerListingLocation=".\Release/"
|
||||
ObjectFile=".\Release/"
|
||||
ProgramDataBaseFileName=".\Release/"
|
||||
BrowseInformation="1"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="TRUE"
|
||||
DebugInformationFormat="4"
|
||||
UndefinePreprocessorDefinitions="DLLEXPORT"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile=".\Release/array_amxx.dll"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="TRUE"
|
||||
ProgramDatabaseFile=".\Release/Array.pdb"
|
||||
ImportLibrary=".\Release/Array.lib"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
MkTypLibCompatible="TRUE"
|
||||
SuppressStartupBanner="TRUE"
|
||||
TargetEnvironment="1"
|
||||
TypeLibraryName=".\Release/Array.tlb"
|
||||
HeaderFileName=""/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
Culture="1033"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
|
||||
<File
|
||||
RelativePath="amxxmodule.cpp">
|
||||
<FileConfiguration
|
||||
Name="Release|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="/vmg /vms /vmg /vms"
|
||||
Optimization="2"
|
||||
PreprocessorDefinitions=""
|
||||
BrowseInformation="1"
|
||||
DebugInformationFormat="0"
|
||||
UndefinePreprocessorDefinitions=""/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="array.cpp">
|
||||
<FileConfiguration
|
||||
Name="Release|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="/vmg /vms /vmg /vms"
|
||||
Optimization="2"
|
||||
PreprocessorDefinitions=""
|
||||
BrowseInformation="1"
|
||||
DebugInformationFormat="0"
|
||||
UndefinePreprocessorDefinitions=""/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl">
|
||||
<File
|
||||
RelativePath="amxxmodule.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="CArray.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="CHashtable.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="CKeytable.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="element.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="moduleconfig.h">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Resource Files"
|
||||
Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
|
||||
<File
|
||||
RelativePath=".\Judy-1.0.1\src\Judy.lib">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\osdefs.h">
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
734
dlls/arrayx/CArray.h
Normal file
734
dlls/arrayx/CArray.h
Normal file
|
@ -0,0 +1,734 @@
|
|||
Pvoid_t MasterArray = (Pvoid_t) NULL; //Create the control array
|
||||
|
||||
//Create an array that stores whether or not indices are used.
|
||||
Pvoid_t MasterArray_Binary = (Pvoid_t) NULL;
|
||||
|
||||
void DeleteMasterArray(void);
|
||||
|
||||
Word_t NewArray(Word_t Index, Word_t reserve = 0);
|
||||
PPvoid_t Find_Array(Word_t Index, Word_t disable_check = 1, AMX *amx = 0);
|
||||
void DeleteArray(Word_t Index);
|
||||
void ClearArray(Word_t Index);
|
||||
|
||||
template <class Type>
|
||||
void Array_Set(PPvoid_t Array, char* Index, Type value);
|
||||
|
||||
PPvoid_t Array_Get(AMX* amx, PPvoid_t Array, Word_t Index, int ignore_error = 0);
|
||||
void DeleteCell(Pvoid_t* Array, Word_t Index);
|
||||
|
||||
void Delete_MasterArray(void)
|
||||
{
|
||||
Word_t
|
||||
Index = 0,
|
||||
success = 0;
|
||||
J1F(success, MasterArray_Binary, Index);
|
||||
while( success )
|
||||
{
|
||||
DeleteArray( Index ); //Delete array.
|
||||
J1F(success, MasterArray_Binary, Index); //Get next array
|
||||
}
|
||||
}
|
||||
|
||||
Word_t NewArray(Word_t Index, Word_t reserve)
|
||||
{
|
||||
Word_t success; //Dummy for macros.
|
||||
J1T(success, MasterArray_Binary, Index); //Check if bit is already set.
|
||||
|
||||
if (success && reserve)
|
||||
return Index; //If the bit is set but it's 'reserved', return the index.
|
||||
|
||||
//Only do this if the bit is not set.
|
||||
J1FE(success, MasterArray_Binary, Index);
|
||||
J1S(success, MasterArray_Binary, Index);
|
||||
|
||||
PPvoid_t Array = JudyLIns(&MasterArray, Index, PJE0);
|
||||
*Array = (PWord_t) NULL;
|
||||
|
||||
return Index;
|
||||
}
|
||||
|
||||
PPvoid_t Find_Array(Word_t Index, Word_t disable_check, AMX *amx)
|
||||
{
|
||||
Word_t success;
|
||||
J1T(success, MasterArray_Binary, Index);
|
||||
if (success || disable_check)
|
||||
{ //Bit is valid
|
||||
if(!success)
|
||||
NewArray(Index);
|
||||
|
||||
return JudyLGet( MasterArray, Index, PJE0);
|
||||
}
|
||||
MF_LogError(amx,AMX_ERR_NATIVE,"Array %d is invalid", Index);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void DeleteArray(Word_t Index)
|
||||
{
|
||||
int success;
|
||||
J1T(success, MasterArray_Binary, Index);
|
||||
if (success)
|
||||
{ //If the bit is set, clear and delete array.
|
||||
ClearArray(Index);
|
||||
J1U(success, MasterArray_Binary, Index);
|
||||
JudyLDel(&MasterArray, Index, PJE0);
|
||||
}
|
||||
}
|
||||
|
||||
void ClearArray(Word_t Index)
|
||||
{
|
||||
int success;
|
||||
J1T(success, MasterArray_Binary, Index);
|
||||
if (success) //dont bother with unset arrays.
|
||||
{
|
||||
PPvoid_t Array = Find_Array(Index);
|
||||
Word_t index = 0;
|
||||
PPvoid_t PValue = JudyLFirst(*Array, &index, PJE0);
|
||||
while (PValue != NULL)
|
||||
{
|
||||
element elem_value = *reinterpret_cast<element*>(*PValue);
|
||||
elem_value.delete_element();
|
||||
PValue = JudyLNext(*Array, &index, PJE0);
|
||||
}
|
||||
JudyLFreeArray(Array, PJE0);
|
||||
}
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL new_array(AMX *amx,cell *params)
|
||||
{
|
||||
return NewArray(params[1], params[2]);
|
||||
}
|
||||
|
||||
template <class Type> //This will support input char*, Vector*, int, and cell_real*.
|
||||
void Array_Set(PPvoid_t Array, int Index, Type value)
|
||||
{
|
||||
PPvoid_t PValue; // pointer to array element value
|
||||
PValue = JudyLIns(Array, Index, PJE0);
|
||||
*PValue = reinterpret_cast<void*>(value);
|
||||
}
|
||||
|
||||
PPvoid_t Array_Get(AMX* amx, PPvoid_t Array, int Index, int ignore_error = 0)
|
||||
{
|
||||
PPvoid_t PValue = JudyLGet( *Array, Index, PJE0 );
|
||||
if (PValue == NULL && !ignore_error)
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "Array index %d is invalid", Index);
|
||||
return PValue;
|
||||
}
|
||||
|
||||
void DeleteCell(PPvoid_t Array, Word_t Index)
|
||||
{
|
||||
JudyLDel(Array, Index, PJE0);
|
||||
}
|
||||
|
||||
|
||||
static cell AMX_NATIVE_CALL delete_array(AMX *amx,cell *params)
|
||||
{
|
||||
DeleteArray( params[1] );
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL clear_array(AMX *amx,cell *params)
|
||||
{
|
||||
ClearArray( params[1] );
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL Array_Save(AMX *amx, cell *params)
|
||||
{
|
||||
PPvoid_t Array = Find_Array(params[1], params[3], amx);
|
||||
if (Array == NULL) return 0;
|
||||
|
||||
int filename_length;
|
||||
char *file = MF_GetAmxString(amx, params[2], 0, &filename_length);
|
||||
file = MF_BuildPathname("%s", file);
|
||||
unlink(file);
|
||||
FILE *ArrayDB = fopen(file,"w");
|
||||
if (!ArrayDB)
|
||||
return 0;
|
||||
Word_t Index = 0;
|
||||
PPvoid_t PValue = JudyLFirst(*Array, &Index, PJE0);
|
||||
element elem = NULL;
|
||||
char elem_type = 0;
|
||||
|
||||
int error;
|
||||
|
||||
REAL vector_data[3] = { 0.0, 0.0, 0.0 };
|
||||
while (PValue)
|
||||
{
|
||||
elem = *reinterpret_cast<element*>(*PValue);
|
||||
elem_type = elem.get_type();
|
||||
|
||||
if (elem_type < elem_type_int || elem_type > elem_type_vector)
|
||||
continue;
|
||||
|
||||
fwrite(&Index, sizeof(int), 1, ArrayDB);
|
||||
fwrite(&elem_type, sizeof(char), 1, ArrayDB);
|
||||
if (elem_type == elem_type_int)
|
||||
{
|
||||
int int_buffer = elem.get_int(error);
|
||||
fwrite(&int_buffer, sizeof(int), 1, ArrayDB);
|
||||
}
|
||||
else if (elem_type == elem_type_real)
|
||||
{
|
||||
REAL flo_buffer = elem.get_flo(error);
|
||||
fwrite(&flo_buffer, sizeof(REAL), 1, ArrayDB);
|
||||
}
|
||||
else if (elem_type == elem_type_char)
|
||||
{
|
||||
const char* str_buffer = elem.get_str(error);
|
||||
short buf_len = strlen(str_buffer);
|
||||
fwrite(&buf_len, sizeof(short), 1, ArrayDB);
|
||||
fwrite(str_buffer, sizeof(char), buf_len, ArrayDB);
|
||||
}
|
||||
else if (elem_type == elem_type_vector)
|
||||
{
|
||||
const Vector* vec_buffer = elem.get_vec(error);
|
||||
fwrite(vec_buffer, sizeof(Vector), 1, ArrayDB);
|
||||
}
|
||||
PValue = JudyLNext(*Array, &Index, PJE0);
|
||||
}
|
||||
fclose(ArrayDB);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL Array_Load(AMX *amx, cell *params)
|
||||
{
|
||||
//params[1]: file
|
||||
int filename_length;
|
||||
char *file = MF_GetAmxString(amx, params[1], 0, &filename_length);
|
||||
file = MF_BuildPathname("%s", file);
|
||||
FILE *ArrayDB = fopen(file, "a+");
|
||||
if (!ArrayDB)
|
||||
return 0;
|
||||
|
||||
//params[2]: array to create (optional index supplied)
|
||||
int ArrayIndex = NewArray(params[2], params[3]);
|
||||
ClearArray(ArrayIndex); //make sure the array is empty.
|
||||
PPvoid_t Array = Find_Array(ArrayIndex);
|
||||
while(!feof(ArrayDB))
|
||||
{
|
||||
int index = 0; char type = 0;
|
||||
element *elem_value = NULL;
|
||||
fread(&index, sizeof(int), 1, ArrayDB);
|
||||
if (feof(ArrayDB) || ferror(ArrayDB))
|
||||
break;
|
||||
|
||||
fread(&type, sizeof(char), 1, ArrayDB);
|
||||
|
||||
if (type < elem_type_int || type > elem_type_vector)
|
||||
{
|
||||
MF_LogError(amx, AMX_ERR_FORMAT, "Error loading array database \"%s\" into array %d. Bad file.", file, ArrayIndex);
|
||||
return ArrayIndex;
|
||||
}
|
||||
else if (type == elem_type_int)
|
||||
{
|
||||
int value = 0; fread(&value, sizeof(int), 1, ArrayDB);
|
||||
elem_value = new element(value);
|
||||
}
|
||||
else if (type == elem_type_real)
|
||||
{
|
||||
REAL value = 0; fread(&value, sizeof(REAL), 1, ArrayDB);
|
||||
elem_value = new element(value);
|
||||
}
|
||||
else if (type == elem_type_char)
|
||||
{
|
||||
short length; fread(&length, sizeof(short), 1, ArrayDB);
|
||||
char* value = new char[length+1]; fgets(value, length+1, ArrayDB);
|
||||
elem_value = new element(value);
|
||||
delete(value);
|
||||
}
|
||||
else if (type == elem_type_vector)
|
||||
{
|
||||
Vector *value = new Vector(); fread(value, sizeof(Vector), 1, ArrayDB);
|
||||
elem_value = new element(value);
|
||||
}
|
||||
Array_Set(Array,index,elem_value);
|
||||
}
|
||||
fclose(ArrayDB);
|
||||
return ArrayIndex;
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL Array_Save_ASCII(AMX *amx, cell *params)
|
||||
{
|
||||
//params[1]: file
|
||||
int filename_length;
|
||||
char *inputfile = MF_GetAmxString(amx, params[1], 0, &filename_length);
|
||||
inputfile = MF_BuildPathname("%s", inputfile);
|
||||
FILE *ArrayDB = fopen(inputfile, "a+");
|
||||
if (!ArrayDB)
|
||||
return 0;
|
||||
|
||||
char *outputfile = MF_GetAmxString(amx, params[2], 0, &filename_length);
|
||||
outputfile = MF_BuildPathname("%s", outputfile);
|
||||
FILE *ReadableDB = fopen(outputfile, "w");
|
||||
|
||||
char *buffer = "\0";
|
||||
char *buffer_two = "\0";
|
||||
|
||||
while(!feof(ArrayDB))
|
||||
{
|
||||
Word_t index = 0; char type = 0;
|
||||
fread(&index, sizeof(int), 1, ArrayDB);
|
||||
if (feof(ArrayDB) || ferror(ArrayDB))
|
||||
break;
|
||||
|
||||
fread(&type, sizeof(char), 1, ArrayDB);
|
||||
|
||||
sprintf(buffer, "Index % 11d\tType %7s,", index, elem_types[type]);
|
||||
if (type < elem_type_int || type > elem_type_vector)
|
||||
{
|
||||
MF_LogError(amx, AMX_ERR_FORMAT, "Error loading array database \"%s\" into readable format. Bad file.", inputfile);
|
||||
return 0;
|
||||
}
|
||||
else if (type == elem_type_int)
|
||||
{
|
||||
int value = 0; fread(&value, sizeof(int), 1, ArrayDB);
|
||||
sprintf(buffer, "%s\t\t\tValue: %d\n", buffer, value);
|
||||
}
|
||||
else if (type == elem_type_real)
|
||||
{
|
||||
REAL value = 0; fread(&value, sizeof(REAL), 1, ArrayDB);
|
||||
sprintf(buffer, "%s\t\t\tValue: %f\n", buffer, value);
|
||||
}
|
||||
else if (type == elem_type_char)
|
||||
{
|
||||
short length; fread(&length, sizeof(short), 1, ArrayDB);
|
||||
char* value = new char[length+1]; fgets(value, length+1, ArrayDB);
|
||||
sprintf(buffer, "%s Length: %d\tValue: \"%s\"\n", buffer, length, value);
|
||||
delete value;
|
||||
}
|
||||
else if (type == elem_type_vector)
|
||||
{
|
||||
Vector *value = new Vector(); fread(value, sizeof(Vector), 1, ArrayDB);
|
||||
sprintf(buffer, "%s\t\t\tValue: {%f,%f,%f}\n", buffer, (*value).x, (*value).y, (*value).z);
|
||||
delete value;
|
||||
}
|
||||
fwrite(buffer, sizeof(char), strlen(buffer), ReadableDB);
|
||||
}
|
||||
fclose(ArrayDB);
|
||||
fclose(ReadableDB);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL Array_SetVector(AMX *amx,cell *params)
|
||||
{
|
||||
PPvoid_t Array = Find_Array(params[1], params[4], amx);
|
||||
if (Array == NULL) return 0;
|
||||
|
||||
cell *input_vec = MF_GetAmxAddr(amx, params[3]);
|
||||
Vector *value = new Vector(
|
||||
amx_ctof(input_vec[0]),
|
||||
amx_ctof(input_vec[1]),
|
||||
amx_ctof(input_vec[2])
|
||||
);
|
||||
int Index = params[2];
|
||||
|
||||
PPvoid_t PValue = Array_Get(amx, Array, Index, 1);
|
||||
element *elem_value = NULL;
|
||||
if ( PValue == NULL )
|
||||
elem_value = new element(value);
|
||||
else
|
||||
{
|
||||
elem_value = reinterpret_cast<element*>(*PValue);
|
||||
(*elem_value).set_vec(value);
|
||||
}
|
||||
Array_Set(Array,Index,elem_value);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL Array_GetVector(AMX *amx, cell *params)
|
||||
{
|
||||
PPvoid_t Array = Find_Array(params[1], params[4], amx);
|
||||
if (Array == NULL) return 0;
|
||||
|
||||
int Index = params[2];
|
||||
PPvoid_t PValue = Array_Get(amx, Array, Index, params[4]);
|
||||
|
||||
cell *vAmx = MF_GetAmxAddr(amx, params[3]);
|
||||
|
||||
if( PValue == NULL ) {
|
||||
vAmx[0] = amx_ftoc(0);
|
||||
vAmx[1] = amx_ftoc(0);
|
||||
vAmx[2] = amx_ftoc(0);
|
||||
return 0;
|
||||
}
|
||||
element elem_value = *reinterpret_cast<element*>(*PValue);
|
||||
int error = 0;
|
||||
const Vector retr_vec = *elem_value.get_vec(error);
|
||||
if (error)
|
||||
elem_value.issue_type_error(amx, params[1], Index);
|
||||
vAmx[0] = amx_ftoc(retr_vec.x);
|
||||
vAmx[1] = amx_ftoc(retr_vec.y);
|
||||
vAmx[2] = amx_ftoc(retr_vec.z);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL Array_SetString(AMX *amx,cell *params)
|
||||
{
|
||||
//params[1]: array
|
||||
PPvoid_t Array = Find_Array(params[1], params[4], amx);
|
||||
if (Array == NULL) return 0;
|
||||
|
||||
//params[2]: index
|
||||
int Index = params[2];
|
||||
|
||||
//params[3]: value
|
||||
int iLen = 0;
|
||||
char *value = MF_GetAmxString(amx,params[3],1,&iLen);
|
||||
|
||||
//element that is stored at index
|
||||
PPvoid_t PValue = Array_Get(amx, Array, Index, 1);
|
||||
element *elem_value = NULL;
|
||||
if ( PValue == NULL )
|
||||
elem_value = new element(value);
|
||||
else
|
||||
{
|
||||
elem_value = reinterpret_cast<element*>(*PValue);
|
||||
(*elem_value).set_str(value);
|
||||
}
|
||||
Array_Set(Array,Index,elem_value);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL Array_GetString(AMX *amx,cell *params)
|
||||
{
|
||||
//params[1]: array
|
||||
PPvoid_t Array = Find_Array(params[1], params[5], amx);
|
||||
if (Array == NULL) return 0;
|
||||
|
||||
//params[2]: index
|
||||
int Index = params[2];
|
||||
|
||||
Pvoid_t * PValue = Array_Get(amx, Array, Index, params[5]);
|
||||
|
||||
//params[3] and params[4] are the return string and length respectively.
|
||||
|
||||
if( PValue == NULL ) return MF_SetAmxString( amx , params[3] , "dne", params[4] );
|
||||
|
||||
element elem_value = *reinterpret_cast<element*>(*PValue);
|
||||
|
||||
int error = 0;
|
||||
const char* str_out = elem_value.get_str(error);
|
||||
if (error)
|
||||
elem_value.issue_type_error(amx, params[1], Index);
|
||||
return MF_SetAmxString( amx , params[3] , str_out, params[4] );
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL Array_SetFloat(AMX *amx,cell *params)
|
||||
{
|
||||
//params[1]: array
|
||||
PPvoid_t Array = Find_Array(params[1], params[4], amx);
|
||||
if (Array == NULL) return 0;
|
||||
|
||||
//params[2]: index
|
||||
int Index = params[2];
|
||||
|
||||
//params[3]: value
|
||||
PPvoid_t PValue = Array_Get(amx, Array, Index, 1);
|
||||
element *elem_value = NULL;
|
||||
if ( PValue == NULL )
|
||||
elem_value = new element(amx_ctof(params[3]));
|
||||
else
|
||||
{
|
||||
elem_value = reinterpret_cast<element*>(*PValue);
|
||||
(*elem_value).set_flo(amx_ctof(params[3]));
|
||||
}
|
||||
Array_Set(Array,Index,elem_value);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL Array_GetFloat(AMX *amx,cell *params)
|
||||
{
|
||||
//params[1]: array
|
||||
PPvoid_t Array = Find_Array(params[1], params[3], amx);
|
||||
if (Array == NULL) return 0;
|
||||
|
||||
//params[2]: index
|
||||
int Index = params[2];
|
||||
|
||||
PPvoid_t PValue = Array_Get(amx, Array, Index, params[3]);
|
||||
|
||||
if( PValue == NULL ) return amx_ftoc(0.0);
|
||||
|
||||
element elem_value = *reinterpret_cast<element*>(*PValue);
|
||||
|
||||
int error = 0;
|
||||
cell retr_float = amx_ftoc(elem_value.get_flo(error));
|
||||
if (error)
|
||||
elem_value.issue_type_error(amx, params[1], Index);
|
||||
return retr_float;
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL Array_SetInt(AMX *amx,cell *params)
|
||||
{
|
||||
//params[1]: array
|
||||
PPvoid_t Array = Find_Array(params[1], params[3], amx);
|
||||
if (Array == NULL) return 0;
|
||||
|
||||
//params[2]: index
|
||||
int Index = params[2];
|
||||
|
||||
PPvoid_t PValue = Array_Get(amx, Array, Index, 1);
|
||||
element *elem_value = NULL;
|
||||
if ( PValue == NULL )
|
||||
elem_value = new element(params[3]);
|
||||
else
|
||||
{
|
||||
elem_value = reinterpret_cast<element*>(*PValue);
|
||||
(*elem_value).set_int(params[3]);
|
||||
}
|
||||
Array_Set(Array,Index,elem_value);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL Array_GetInt(AMX *amx,cell *params)
|
||||
{
|
||||
//params[1]: array
|
||||
PPvoid_t Array = Find_Array(params[1], params[3], amx);
|
||||
if (Array == NULL) return 0;
|
||||
|
||||
//params[2]: index
|
||||
int Index = params[2];
|
||||
|
||||
Pvoid_t * PValue = Array_Get(amx, Array, Index, params[3]);
|
||||
|
||||
if( PValue == NULL ) return 0;
|
||||
|
||||
element elem_value = *reinterpret_cast<element*>(*PValue);
|
||||
|
||||
int error = 0;
|
||||
cell retr_int = elem_value.get_int(error);
|
||||
if (error)
|
||||
elem_value.issue_type_error(amx, params[1], Index);
|
||||
return retr_int;
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL array_size(AMX *amx,cell *params)
|
||||
{
|
||||
Pvoid_t * Array = Find_Array(params[1],params[4],amx);
|
||||
if (Array == NULL) return 0;
|
||||
|
||||
return JudyLCount( *Array, params[2], params[3],PJE0);
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL array_count(AMX *amx,cell *params)
|
||||
{
|
||||
return JudyLCount( MasterArray, params[1], params[2],PJE0);
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL array_memory(AMX *amx,cell *params)
|
||||
{
|
||||
Pvoid_t * Array = Find_Array(params[1],params[2],amx);
|
||||
if (Array == NULL) return 0;
|
||||
|
||||
return JudyLMemUsed(*Array);
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL delete_cell(AMX *amx,cell *params)
|
||||
{
|
||||
Pvoid_t * Array = Find_Array(params[1]);
|
||||
if (Array == NULL) return 0;
|
||||
|
||||
DeleteCell( Array, params[2] );
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL array_next(AMX *amx,cell *params)
|
||||
{
|
||||
PPvoid_t Array = Find_Array(params[1],params[4],amx);
|
||||
if (Array == NULL) return 0;
|
||||
|
||||
Word_t Index = Word_t(params[2]);
|
||||
cell *success = MF_GetAmxAddr(amx, params[3]);
|
||||
|
||||
PPvoid_t pointer;
|
||||
pointer = JudyLNext(*Array, &Index, PJE0);
|
||||
|
||||
*success = (pointer == NULL) ? 0 : 1;
|
||||
return cell(Index);
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL array_prev(AMX *amx,cell *params)
|
||||
{
|
||||
PPvoid_t Array = Find_Array(params[1],params[4],amx);
|
||||
if (Array == NULL) return 0;
|
||||
|
||||
Word_t Index = Word_t(params[2]);
|
||||
cell *success = MF_GetAmxAddr(amx, params[3]);
|
||||
|
||||
PPvoid_t pointer;
|
||||
pointer = JudyLPrev(*Array, &Index, PJE0);
|
||||
|
||||
*success = (pointer == NULL) ? 0 : 1;
|
||||
return cell(Index);
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL array_first(AMX *amx,cell *params)
|
||||
{
|
||||
PPvoid_t Array = Find_Array(params[1],params[4],amx);
|
||||
if (Array == NULL) return 0;
|
||||
|
||||
Word_t Index = Word_t(params[2]);
|
||||
cell *success = MF_GetAmxAddr(amx, params[3]);
|
||||
|
||||
PPvoid_t pointer;
|
||||
pointer = JudyLFirst(*Array, &Index, PJE0);
|
||||
|
||||
*success = (pointer == NULL) ? 0 : 1;
|
||||
return cell(Index);
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL array_last(AMX *amx,cell *params)
|
||||
{
|
||||
PPvoid_t Array = Find_Array(params[1],params[4],amx);
|
||||
if (Array == NULL) return 0;
|
||||
|
||||
Word_t Index = Word_t(params[2]);
|
||||
cell *success = MF_GetAmxAddr(amx, params[3]);
|
||||
|
||||
PPvoid_t pointer;
|
||||
pointer = JudyLLast(*Array, &Index, PJE0);
|
||||
|
||||
*success = (pointer == NULL) ? 0 : 1;
|
||||
return cell(Index);
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL array_nextempty(AMX *amx,cell *params)
|
||||
{
|
||||
PPvoid_t Array = Find_Array(params[1],params[4],amx);
|
||||
if (Array == NULL) return 0;
|
||||
|
||||
Word_t Index = (Word_t)params[2];
|
||||
|
||||
cell *success = MF_GetAmxAddr(amx, params[3]);
|
||||
*success = JudyLNextEmpty(*Array, &Index, PJE0);
|
||||
|
||||
return (cell)Index;
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL array_prevempty(AMX *amx,cell *params)
|
||||
{
|
||||
PPvoid_t Array = Find_Array(params[1],params[4],amx);
|
||||
if (Array == NULL) return 0;
|
||||
|
||||
Word_t Index = (Word_t)params[2];
|
||||
|
||||
cell *success = MF_GetAmxAddr(amx, params[3]);
|
||||
*success = JudyLPrevEmpty(*Array, &Index, PJE0);
|
||||
|
||||
return (cell)Index;
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL array_firstempty(AMX *amx,cell *params)
|
||||
{
|
||||
PPvoid_t Array = Find_Array(params[1],params[4],amx);
|
||||
if (Array == NULL) return 0;
|
||||
|
||||
Word_t Index = (Word_t)params[2];
|
||||
|
||||
cell *success = MF_GetAmxAddr(amx, params[3]);
|
||||
*success = JudyLFirstEmpty(*Array, &Index, PJE0);
|
||||
|
||||
return (cell)Index;
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL array_lastempty(AMX *amx,cell *params)
|
||||
{
|
||||
PPvoid_t Array = Find_Array(params[1],params[4],amx);
|
||||
if (Array == NULL) return 0;
|
||||
|
||||
Word_t Index = (Word_t)params[2];
|
||||
|
||||
cell *success = MF_GetAmxAddr(amx, params[3]);
|
||||
*success = JudyLLastEmpty(*Array, &Index, PJE0);
|
||||
|
||||
return (cell)Index;
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL array_isempty(AMX *amx,cell *params)
|
||||
{
|
||||
PPvoid_t Array = Find_Array(params[1],params[3],amx);
|
||||
if (Array == NULL) return 0;
|
||||
|
||||
PPvoid_t pointer;
|
||||
pointer = JudyLGet(*Array, params[2], PJE0);
|
||||
|
||||
return (pointer == NULL) ? 1 : 0;
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL array_isfilled(AMX *amx,cell *params)
|
||||
{
|
||||
//params[1]: array
|
||||
PPvoid_t Array = Find_Array(params[1],params[3],amx);
|
||||
if (Array == NULL) return 0;
|
||||
|
||||
//params[2]: index
|
||||
PPvoid_t pointer;
|
||||
pointer = JudyLGet(*Array, params[2], PJE0);
|
||||
|
||||
return (pointer != NULL) ? 1 : 0;
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL Array_ByCount(AMX *amx,cell *params)
|
||||
{
|
||||
PPvoid_t Array = Find_Array(params[1],params[4],amx);
|
||||
if (Array == NULL) return 0;
|
||||
|
||||
Word_t Index = Word_t(params[3]);
|
||||
cell *success = MF_GetAmxAddr(amx, params[4]);
|
||||
|
||||
PPvoid_t pointer;
|
||||
pointer = JudyLByCount(*Array, params[2], &Index, PJE0);
|
||||
|
||||
*success = (pointer == NULL) ? 0 : 1;
|
||||
return cell(Index);
|
||||
}
|
||||
|
||||
AMX_NATIVE_INFO array_exports[] = {
|
||||
{ "array_set_string", Array_SetString },
|
||||
{ "array_get_string", Array_GetString },
|
||||
|
||||
{ "array_set_int", Array_SetInt },
|
||||
{ "array_get_int", Array_GetInt },
|
||||
|
||||
{ "array_set_float", Array_SetFloat },
|
||||
{ "array_get_float", Array_GetFloat },
|
||||
|
||||
{ "array_set_vector", Array_SetVector },
|
||||
{ "array_get_vector", Array_GetVector },
|
||||
|
||||
{ "array_isempty", array_isempty },
|
||||
{ "array_isfilled", array_isfilled },
|
||||
|
||||
{ "array_remove", delete_cell },
|
||||
|
||||
{ "array_create", new_array },
|
||||
{ "array_delete", delete_array },
|
||||
{ "array_clear", clear_array },
|
||||
|
||||
{ "array_size", array_size },
|
||||
{ "array_count", array_count },
|
||||
{ "array_memory", array_memory },
|
||||
|
||||
{ "array_nextempty", array_nextempty },
|
||||
{ "array_prevempty", array_prevempty },
|
||||
{ "array_firstempty", array_firstempty },
|
||||
{ "array_lastempty", array_lastempty },
|
||||
{ "array_next", array_next },
|
||||
{ "array_prev", array_prev },
|
||||
{ "array_first", array_first },
|
||||
{ "array_last", array_last },
|
||||
|
||||
{ "array_save", Array_Save },
|
||||
{ "array_load", Array_Load },
|
||||
|
||||
{ "array_get_nth", Array_ByCount },
|
||||
|
||||
{ "array_save_ascii", Array_Save_ASCII },
|
||||
|
||||
{ NULL, NULL }
|
||||
};
|
375
dlls/arrayx/CHashtable.h
Normal file
375
dlls/arrayx/CHashtable.h
Normal file
|
@ -0,0 +1,375 @@
|
|||
#if !defined _JUDYHS_ENABLED_
|
||||
#define _JUDYHS_ENABLED_
|
||||
|
||||
Pvoid_t MasterHashtable = (Pvoid_t) NULL; //Create the new array
|
||||
|
||||
//Create an array that stores whether or not indices are used.
|
||||
Pvoid_t MasterHashtable_Binary = (Pvoid_t) NULL;
|
||||
|
||||
void Delete_MasterHashtable(void);
|
||||
|
||||
Word_t New_Hashtable(Word_t Index, Word_t reserve = 0);
|
||||
Pvoid_t* Find_Hashtable(Word_t Index, Word_t disable_check = 1, AMX *amx = 0);
|
||||
void Delete_Hashtable(Word_t Index);
|
||||
void Clear_Hashtable(Word_t Index);
|
||||
|
||||
template <class Type>
|
||||
void Hashtable_Set(PPvoid_t Hashtable, char *Index, Word_t Length, Type value);
|
||||
|
||||
PPvoid_t Hashtable_Get(AMX* amx, Pvoid_t Hashtable, char *Index, int ignore_error = 0);
|
||||
|
||||
void Delete_MasterHashtable(void)
|
||||
{
|
||||
Word_t
|
||||
Index = 0,
|
||||
success;
|
||||
J1F(success, MasterHashtable_Binary, Index);
|
||||
while( success )
|
||||
{
|
||||
Delete_Hashtable(Index);
|
||||
J1F(success, MasterHashtable_Binary, Index);
|
||||
}
|
||||
}
|
||||
|
||||
Word_t New_Hashtable(Word_t Index, Word_t reserve)
|
||||
{
|
||||
Word_t success; //Dummy for macros.
|
||||
J1T(success, MasterHashtable_Binary, Index);
|
||||
|
||||
if (success && reserve)
|
||||
return Index; //If the bit is set but it's 'reserved', return the index.
|
||||
|
||||
//Only do this if the bit is not set or not reserved.
|
||||
J1FE(success, MasterHashtable_Binary, Index);
|
||||
J1S(success, MasterHashtable_Binary, Index);
|
||||
|
||||
PPvoid_t Hashtable = JudyLIns(&MasterHashtable, Index, PJE0);
|
||||
*Hashtable = (PWord_t) NULL;
|
||||
|
||||
return Index;
|
||||
}
|
||||
|
||||
PPvoid_t Find_Hashtable(Word_t Index, Word_t disable_check, AMX* amx)
|
||||
{
|
||||
Word_t success;
|
||||
J1T(success, MasterHashtable_Binary, Index);
|
||||
if (success || disable_check)
|
||||
{ //Bit is valid
|
||||
if(!success)
|
||||
New_Hashtable(Index);
|
||||
|
||||
return JudyLGet(MasterHashtable, Index, PJE0);
|
||||
}
|
||||
MF_LogError(amx,AMX_ERR_NATIVE,"Hashtable %d is invalid.", Index);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void Delete_Hashtable(Word_t Index)
|
||||
{
|
||||
int success;
|
||||
J1T(success, MasterHashtable_Binary, Index);
|
||||
if (success)
|
||||
{ //If the bit was set, clear, unset and delist hashtable.
|
||||
Clear_Hashtable(Index);
|
||||
J1U(success, MasterHashtable_Binary, Index);
|
||||
JudyLDel(&MasterHashtable, Index, PJE0);
|
||||
}
|
||||
}
|
||||
|
||||
void Clear_Hashtable(Word_t Index)
|
||||
{
|
||||
int success;
|
||||
J1T(success, MasterHashtable_Binary, Index);
|
||||
if (success) //dont bother with unset hashtables.
|
||||
{
|
||||
PPvoid_t Hashtable = Find_Hashtable(Index);
|
||||
JHSFA(success, *Hashtable);
|
||||
}
|
||||
}
|
||||
|
||||
template <class Type> //This will support input char*, Vector*, int, and cell_real*.
|
||||
void Hashtable_Set(PPvoid_t Hashtable, char* Index, Type value)
|
||||
{
|
||||
int Len = strlen(Index)+1;
|
||||
PPvoid_t PValue = JudyHSIns(Hashtable, Index, Len, PJE0);
|
||||
*PValue = reinterpret_cast<void*>(value);
|
||||
}
|
||||
|
||||
PPvoid_t Hashtable_Get(AMX* amx,PPvoid_t Hashtable, char *Index, int ignore_error = 0)
|
||||
{
|
||||
PPvoid_t PValue = JudyHSGet(*Hashtable, Index, strlen(Index)+1);
|
||||
if (PValue == NULL && !ignore_error)
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "Hashtable get on index \"%s\" is invalid", Index);
|
||||
return PValue;
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL Hashtable_Create(AMX *amx, cell *params)
|
||||
{
|
||||
return New_Hashtable(params[1],params[2]);
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL Hashtable_Delete(AMX *amx, cell *params)
|
||||
{
|
||||
Delete_Hashtable( params[1] );
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL Hashtable_Clear(AMX *amx, cell *params)
|
||||
{
|
||||
Clear_Hashtable( params[1] );
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL Hashtable_SetVector(AMX *amx,cell *params)
|
||||
{
|
||||
PPvoid_t Hashtable = Find_Hashtable(params[1], params[4], amx);
|
||||
if (Hashtable == NULL) return 0;
|
||||
|
||||
cell *input_vec = MF_GetAmxAddr(amx, params[3]);
|
||||
Vector *value = new Vector(
|
||||
amx_ctof(input_vec[0]),
|
||||
amx_ctof(input_vec[1]),
|
||||
amx_ctof(input_vec[2])
|
||||
);
|
||||
int strlen;
|
||||
char *Index = MF_GetAmxString(amx, params[2], 0, &strlen);
|
||||
|
||||
PPvoid_t PValue = Hashtable_Get(amx, Hashtable, Index, 1);
|
||||
element *elem_value = NULL;
|
||||
if ( PValue == NULL )
|
||||
elem_value = new element(value);
|
||||
else
|
||||
{
|
||||
elem_value = reinterpret_cast<element*>(*PValue);
|
||||
(*elem_value).set_vec(value);
|
||||
}
|
||||
Hashtable_Set(Hashtable,Index,elem_value);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
static cell AMX_NATIVE_CALL Hashtable_GetVector(AMX *amx, cell *params)
|
||||
{
|
||||
PPvoid_t Hashtable = Find_Hashtable(params[1], params[4], amx);
|
||||
if (Hashtable == NULL) return 0;
|
||||
|
||||
int strlen;
|
||||
char *Index = MF_GetAmxString(amx, params[2], 0, &strlen);
|
||||
PPvoid_t PValue = Hashtable_Get(amx, Hashtable, Index, params[4]);
|
||||
|
||||
cell *vAmx = MF_GetAmxAddr(amx, params[3]);
|
||||
|
||||
if( PValue == NULL ) {
|
||||
vAmx[0] = amx_ftoc(0);
|
||||
vAmx[1] = amx_ftoc(0);
|
||||
vAmx[2] = amx_ftoc(0);
|
||||
return 0;
|
||||
}
|
||||
element elem_value = *reinterpret_cast<element*>(*PValue);
|
||||
int error = 0;
|
||||
const Vector retr_vec = *elem_value.get_vec(error);
|
||||
if (error)
|
||||
elem_value.issue_type_error(amx, params[1], Index);
|
||||
vAmx[0] = amx_ftoc(retr_vec.x);
|
||||
vAmx[1] = amx_ftoc(retr_vec.y);
|
||||
vAmx[2] = amx_ftoc(retr_vec.z);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL Hashtable_SetString(AMX *amx,cell *params)
|
||||
{
|
||||
//params[1]: hashtable
|
||||
PPvoid_t Hashtable = Find_Hashtable(params[1], params[4], amx);
|
||||
if (Hashtable == NULL) return 0;
|
||||
|
||||
//params[2]: key
|
||||
int strlength;
|
||||
char *Index = MF_GetAmxString(amx, params[2], 0, &strlength);
|
||||
|
||||
//params[3]: value
|
||||
int iLen = 0;
|
||||
char *value = MF_GetAmxString(amx,params[3],1,&iLen);
|
||||
|
||||
PPvoid_t PValue = Hashtable_Get(amx, Hashtable, Index, 1);
|
||||
element *elem_value = NULL;
|
||||
if ( PValue == NULL )
|
||||
elem_value = new element(value);
|
||||
else
|
||||
{
|
||||
elem_value = reinterpret_cast<element*>(*PValue);
|
||||
(*elem_value).set_str(value);
|
||||
}
|
||||
Hashtable_Set(Hashtable,Index,elem_value);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL Hashtable_GetString(AMX *amx,cell *params)
|
||||
{
|
||||
//params[1]: hashtable
|
||||
PPvoid_t Hashtable = Find_Hashtable(params[1], params[5], amx);
|
||||
if (Hashtable == NULL) return 0;
|
||||
|
||||
//params[2]: key
|
||||
int strlength;
|
||||
char *Index = MF_GetAmxString(amx, params[2], 0, &strlength);
|
||||
|
||||
Pvoid_t * PValue = Hashtable_Get(amx, Hashtable, Index, params[5]);
|
||||
|
||||
//params[3] and params[4] are the return string and length respectively.
|
||||
|
||||
|
||||
if( PValue == NULL )
|
||||
return MF_SetAmxString(amx, params[3] , "dne", params[4] );
|
||||
|
||||
element elem_value = *reinterpret_cast<element*>(*PValue);
|
||||
|
||||
int error = 0;
|
||||
if (error)
|
||||
elem_value.issue_type_error(amx, params[1], Index);
|
||||
const char* str_out = elem_value.get_str(error);
|
||||
return MF_SetAmxString( amx , params[3] , str_out, params[4] );
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL Hashtable_SetFloat(AMX *amx,cell *params)
|
||||
{
|
||||
//params[1]: hashtable
|
||||
PPvoid_t Hashtable = Find_Hashtable(params[1], params[4], amx);
|
||||
if (Hashtable == NULL) return 0;
|
||||
|
||||
//params[2]: key
|
||||
int strlength;
|
||||
char *Index = MF_GetAmxString(amx, params[2], 0, &strlength);
|
||||
//params[3]: value
|
||||
PPvoid_t PValue = Hashtable_Get(amx, Hashtable, Index, 1);
|
||||
element *elem_value = NULL;
|
||||
if ( PValue == NULL )
|
||||
elem_value = new element(amx_ctof(params[3]));
|
||||
else
|
||||
{
|
||||
elem_value = reinterpret_cast<element*>(*PValue);
|
||||
(*elem_value).set_flo(amx_ctof(params[3]));
|
||||
}
|
||||
Hashtable_Set(Hashtable,Index,elem_value);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL Hashtable_GetFloat(AMX *amx,cell *params)
|
||||
{
|
||||
//params[1]: hashtable
|
||||
PPvoid_t Hashtable = Find_Hashtable(params[1], params[3], amx);
|
||||
if (Hashtable == NULL) return 0;
|
||||
|
||||
//params[2]: key
|
||||
int strlength;
|
||||
char *Index = MF_GetAmxString(amx, params[2], 0, &strlength);
|
||||
|
||||
PPvoid_t PValue = Hashtable_Get(amx, Hashtable, Index, params[3]);
|
||||
|
||||
if( PValue == NULL ) return amx_ftoc(0.0);
|
||||
|
||||
element elem_value = *reinterpret_cast<element*>(*PValue);
|
||||
|
||||
int error = 0;
|
||||
cell retr_float = amx_ftoc(elem_value.get_flo(error));
|
||||
if (error)
|
||||
elem_value.issue_type_error(amx, params[1], Index);
|
||||
return retr_float;
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL Hashtable_SetInt(AMX *amx,cell *params)
|
||||
{
|
||||
//params[1]: hashtable
|
||||
PPvoid_t Hashtable = Find_Hashtable(params[1], params[4], amx);
|
||||
if (Hashtable == NULL) return 0;
|
||||
|
||||
//params[2]: key
|
||||
int strlength;
|
||||
char *Index = MF_GetAmxString(amx, params[2], 0, &strlength);
|
||||
|
||||
PPvoid_t PValue = Hashtable_Get(amx, Hashtable, Index, 1);
|
||||
element *elem_value = NULL;
|
||||
if ( PValue == NULL )
|
||||
elem_value = new element(params[3]);
|
||||
else
|
||||
{
|
||||
elem_value = reinterpret_cast<element*>(*PValue);
|
||||
(*elem_value).set_int(params[3]);
|
||||
}
|
||||
Hashtable_Set(Hashtable,Index,elem_value);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL Hashtable_GetInt(AMX *amx,cell *params)
|
||||
{
|
||||
//params[1]: hashtable
|
||||
PPvoid_t Hashtable = Find_Hashtable(params[1], params[3], amx);
|
||||
if (Hashtable == NULL) return 0;
|
||||
//params[2]: key
|
||||
int strlength;
|
||||
char *Index = MF_GetAmxString(amx, params[2], 0, &strlength);
|
||||
|
||||
Pvoid_t * PValue = Hashtable_Get(amx, Hashtable, Index, params[3]);
|
||||
|
||||
if( PValue == NULL ) return 0;
|
||||
|
||||
element elem_value = *reinterpret_cast<element*>(*PValue);
|
||||
|
||||
int error = 0;
|
||||
cell retr_int = elem_value.get_int(error);
|
||||
if (error)
|
||||
elem_value.issue_type_error(amx, params[1], Index);
|
||||
return retr_int;
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL Hashtable_Memory(AMX *amx,cell *params)
|
||||
{
|
||||
Pvoid_t * Array = Find_Hashtable(params[1],params[2],amx);
|
||||
if (Array == NULL) return 0;
|
||||
|
||||
return JudyLMemUsed(*Array);
|
||||
}
|
||||
|
||||
|
||||
static cell AMX_NATIVE_CALL Hashtable_Remove(AMX *amx,cell *params)
|
||||
{
|
||||
//params[1]: hashtable
|
||||
PPvoid_t Hashtable = Find_Hashtable(params[1], 0, amx);
|
||||
if (Hashtable == NULL) return 0;
|
||||
|
||||
//params[2]: key
|
||||
int strlength;
|
||||
char *Index = MF_GetAmxString(amx, params[2], 0, &strlength);
|
||||
JudyHSDel(Hashtable, Index, strlength+1, PJE0 );
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
AMX_NATIVE_INFO hashtable_exports[] = {
|
||||
{ "hashtable_set_str", Hashtable_SetString },
|
||||
{ "hashtable_get_str", Hashtable_GetString },
|
||||
|
||||
{ "hashtable_set_vec", Hashtable_SetVector },
|
||||
{ "hashtable_get_vec", Hashtable_GetVector },
|
||||
|
||||
{ "hashtable_set_int", Hashtable_SetInt },
|
||||
{ "hashtable_get_int", Hashtable_GetInt },
|
||||
|
||||
{ "hashtable_set_float", Hashtable_SetFloat },
|
||||
{ "hashtable_get_float", Hashtable_GetFloat },
|
||||
|
||||
{ "hashtable_memory", Hashtable_Memory },
|
||||
|
||||
{ "hashtable_remove", Hashtable_Remove },
|
||||
|
||||
{ "hashtable_create", Hashtable_Create },
|
||||
{ "hashtable_delete", Hashtable_Delete },
|
||||
{ "hashtable_clear", Hashtable_Clear },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
#endif
|
703
dlls/arrayx/CKeytable.h
Normal file
703
dlls/arrayx/CKeytable.h
Normal file
|
@ -0,0 +1,703 @@
|
|||
#if !defined _JUDYSL_ENABLED_
|
||||
#define _JUDYSL_ENABLED_
|
||||
|
||||
#define MAXLINELEN 1024
|
||||
|
||||
Pvoid_t MasterKeytable = (Pvoid_t) NULL; //Create the control array
|
||||
|
||||
//Create an array that stores whether or not indices are used.
|
||||
Pvoid_t MasterKeytable_Binary = (Pvoid_t) NULL;
|
||||
|
||||
void Delete_MasterKeytable(void);
|
||||
|
||||
Word_t New_Keytable(Word_t Index, Word_t reserve = 0);
|
||||
PPvoid_t Find_Keytable(Word_t Index, Word_t disable_check = 1, AMX *amx = 0);
|
||||
void Delete_Keytable(Word_t Index);
|
||||
void Clear_Keytable(Word_t Index);
|
||||
|
||||
template <class Type>
|
||||
void Keytable_Set(PPvoid_t Keytable, char *Index, Type value);
|
||||
|
||||
PPvoid_t Keytable_Get(AMX* amx, Pvoid_t Keytable, char *Index, int ignore_error = 0);
|
||||
|
||||
|
||||
void Delete_MasterKeytable(void)
|
||||
{
|
||||
Word_t
|
||||
Index = 0,
|
||||
success;
|
||||
J1F(success, MasterKeytable_Binary, Index);
|
||||
while( success )
|
||||
{
|
||||
Delete_Keytable(Index);
|
||||
J1F(success, MasterKeytable_Binary, Index);
|
||||
}
|
||||
}
|
||||
|
||||
Word_t New_Keytable(Word_t Index, Word_t reserve)
|
||||
{
|
||||
Word_t success; //Dummy for macros.
|
||||
J1T(success, MasterKeytable_Binary, Index);
|
||||
|
||||
if (success && reserve)
|
||||
return Index; //If the bit is set but it's 'reserved', return the index.
|
||||
|
||||
//Only do this if the bit is not set or not reserved.
|
||||
J1FE(success, MasterKeytable_Binary, Index);
|
||||
J1S(success, MasterKeytable_Binary, Index);
|
||||
|
||||
PPvoid_t Keytable = JudyLIns(&MasterKeytable, Index, PJE0);
|
||||
*Keytable = (PWord_t) NULL;
|
||||
|
||||
return Index;
|
||||
}
|
||||
|
||||
PPvoid_t Find_Keytable(Word_t Index, Word_t disable_check, AMX* amx)
|
||||
{
|
||||
Word_t success;
|
||||
J1T(success, MasterKeytable_Binary, Index);
|
||||
if (success || disable_check)
|
||||
{ //Bit is valid
|
||||
if(!success)
|
||||
New_Keytable(Index);
|
||||
|
||||
return JudyLGet(MasterKeytable, Index, PJE0);
|
||||
}
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "Keytable \"%s\" is invalid", Index);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void Delete_Keytable(Word_t Index)
|
||||
{
|
||||
int success;
|
||||
J1T(success, MasterKeytable_Binary, Index);
|
||||
if (success)
|
||||
{ //If the bit was set, clear and delete keytable.
|
||||
Clear_Keytable(Index);
|
||||
J1U(success, MasterKeytable_Binary, Index);
|
||||
JudyLDel(&MasterKeytable, Index, PJE0);
|
||||
}
|
||||
}
|
||||
|
||||
void Clear_Keytable(Word_t Index)
|
||||
{
|
||||
int success;
|
||||
J1T(success, MasterKeytable_Binary, Index);
|
||||
if (success) //dont bother with unset Keytables.
|
||||
{
|
||||
PPvoid_t Keytable = Find_Keytable(Index);
|
||||
char *Key = "";
|
||||
PPvoid_t PValue = JudySLFirst(*Keytable, Key, PJE0);
|
||||
while (PValue != NULL)
|
||||
{
|
||||
element elem_value = *reinterpret_cast<element*>(*PValue);
|
||||
elem_value.delete_element();
|
||||
PValue = JudySLNext(*Keytable, Key, PJE0);
|
||||
}
|
||||
JudySLFreeArray(Keytable, PJE0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static cell AMX_NATIVE_CALL Keytable_Save(AMX *amx, cell *params)
|
||||
{
|
||||
PPvoid_t Keytable = Find_Keytable(params[1], params[3], amx);
|
||||
if (Keytable == NULL) return 0;
|
||||
|
||||
int filename_length;
|
||||
char *file = MF_GetAmxString(amx, params[2], 0, &filename_length);
|
||||
file = MF_BuildPathname("%s", file);
|
||||
unlink(file);
|
||||
FILE *KeytableDB = fopen(file,"w");
|
||||
if (!KeytableDB)
|
||||
return 0;
|
||||
char* Key = new char[1024]; Key[0] = '\0';
|
||||
PPvoid_t PValue = JudySLFirst(*Keytable, reinterpret_cast<uint8_t*>(Key), PJE0);
|
||||
element elem = NULL;
|
||||
char elem_type = 0;
|
||||
|
||||
int error;
|
||||
|
||||
REAL vector_data[3] = { 0.0, 0.0, 0.0 };
|
||||
while (PValue)
|
||||
{
|
||||
elem = *reinterpret_cast<element*>(*PValue);
|
||||
elem_type = elem.get_type();
|
||||
|
||||
if (elem_type < elem_type_int || elem_type > elem_type_vector)
|
||||
continue;
|
||||
|
||||
short key_len = strlen(Key);
|
||||
fwrite(&key_len, sizeof(short), 1, KeytableDB);
|
||||
fwrite(Key, sizeof(char), key_len, KeytableDB);
|
||||
fwrite(&elem_type, sizeof(char), 1, KeytableDB);
|
||||
if (elem_type == elem_type_int)
|
||||
{
|
||||
int int_buffer = elem.get_int(error);
|
||||
fwrite(&int_buffer, sizeof(int), 1, KeytableDB);
|
||||
}
|
||||
else if (elem_type == elem_type_real)
|
||||
{
|
||||
REAL flo_buffer = elem.get_flo(error);
|
||||
fwrite(&flo_buffer, sizeof(REAL), 1, KeytableDB);
|
||||
}
|
||||
else if (elem_type == elem_type_char)
|
||||
{
|
||||
const char* str_buffer = elem.get_str(error);
|
||||
short buf_len = strlen(str_buffer);
|
||||
fwrite(&buf_len, sizeof(short), 1, KeytableDB);
|
||||
fwrite(str_buffer, sizeof(char), buf_len, KeytableDB);
|
||||
}
|
||||
else if (elem_type == elem_type_vector)
|
||||
{
|
||||
const Vector* vec_buffer = elem.get_vec(error);
|
||||
fwrite(vec_buffer, sizeof(Vector), 1, KeytableDB);
|
||||
}
|
||||
PValue = JudySLNext(*Keytable, Key, PJE0);
|
||||
}
|
||||
fclose(KeytableDB);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL Keytable_Load(AMX *amx, cell *params)
|
||||
{
|
||||
//params[1]: file
|
||||
int filename_length;
|
||||
char *file = MF_GetAmxString(amx, params[1], 0, &filename_length);
|
||||
file = MF_BuildPathname("%s", file);
|
||||
FILE *KeytableDB = fopen(file, "a+");
|
||||
if (!KeytableDB)
|
||||
return 0;
|
||||
|
||||
//params[2]: keytable to create (optional index supplied)
|
||||
int KeytableIndex = New_Keytable(params[2], params[3]);
|
||||
Clear_Keytable(KeytableIndex); //make sure the keytable is empty.
|
||||
PPvoid_t Keytable = Find_Keytable(KeytableIndex);
|
||||
while(!feof(KeytableDB))
|
||||
{
|
||||
char* index = ""; char type = 0; short index_len;
|
||||
element *elem_value = NULL;
|
||||
fread(&index_len, sizeof(short), 1, KeytableDB);
|
||||
index = new char[index_len+1];
|
||||
fgets(index, index_len+1, KeytableDB);
|
||||
if (feof(KeytableDB) || ferror(KeytableDB))
|
||||
break;
|
||||
fread(&type, sizeof(char), 1, KeytableDB);
|
||||
if (type < elem_type_int || type > elem_type_vector)
|
||||
{
|
||||
MF_LogError(amx, AMX_ERR_FORMAT, "Error loading keytable database \"%s\" into keytable %d. Bad file.", file, KeytableIndex);
|
||||
return KeytableIndex;
|
||||
}
|
||||
else if (type == elem_type_int)
|
||||
{
|
||||
int value = 0; fread(&value, sizeof(int), 1, KeytableDB);
|
||||
elem_value = new element(value);
|
||||
}
|
||||
else if (type == elem_type_real)
|
||||
{
|
||||
REAL value = 0; fread(&value, sizeof(REAL), 1, KeytableDB);
|
||||
elem_value = new element(value);
|
||||
}
|
||||
else if (type == elem_type_char)
|
||||
{
|
||||
short length; fread(&length, sizeof(short), 1, KeytableDB);
|
||||
char* value = new char[length+1]; fgets(value, length+1, KeytableDB);
|
||||
elem_value = new element(value);
|
||||
delete(value);
|
||||
}
|
||||
else if (type == elem_type_vector)
|
||||
{
|
||||
Vector *value = new Vector(); fread(value, sizeof(Vector), 1, KeytableDB);
|
||||
elem_value = new element(value);
|
||||
}
|
||||
Keytable_Set(Keytable,index,elem_value);
|
||||
delete (index);
|
||||
}
|
||||
fclose(KeytableDB);
|
||||
return KeytableIndex;
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL Keytable_Save_ASCII(AMX *amx, cell *params)
|
||||
{
|
||||
//params[1]: file
|
||||
int filename_length;
|
||||
char *inputfile = MF_GetAmxString(amx, params[1], 0, &filename_length);
|
||||
inputfile = MF_BuildPathname("%s", inputfile);
|
||||
FILE *KeytableDB = fopen(inputfile, "a+");
|
||||
if (!KeytableDB)
|
||||
return 0;
|
||||
|
||||
char *outputfile = MF_GetAmxString(amx, params[2], 0, &filename_length);
|
||||
outputfile = MF_BuildPathname("%s", outputfile);
|
||||
FILE *ReadableDB = fopen(outputfile, "w");
|
||||
|
||||
char *buffer = "\0";
|
||||
|
||||
while(!feof(KeytableDB))
|
||||
{
|
||||
char* key = NULL; char type = 0; short key_len;
|
||||
fread(&key_len, sizeof(short), 1, KeytableDB);
|
||||
key = new char[key_len+1];
|
||||
fgets(key, key_len+1, KeytableDB);
|
||||
if (feof(KeytableDB) || ferror(KeytableDB))
|
||||
break;
|
||||
fread(&type, sizeof(char), 1, KeytableDB);
|
||||
|
||||
sprintf(buffer, "Key %-32s Length %3d, Type %7s", key, key_len, elem_types[type]);
|
||||
if (type < elem_type_int || type > elem_type_vector)
|
||||
{
|
||||
MF_LogError(amx, AMX_ERR_FORMAT, "Error loading array database \"%s\" into readable format. Bad file.", inputfile);
|
||||
return 0;
|
||||
}
|
||||
else if (type == elem_type_int)
|
||||
{
|
||||
int value = 0; fread(&value, sizeof(int), 1, KeytableDB);
|
||||
fprintf(ReadableDB, "%s\t\t\t\tValue: %d\n", buffer, value);
|
||||
}
|
||||
else if (type == elem_type_real)
|
||||
{
|
||||
REAL value = 0; fread(&value, sizeof(REAL), 1, KeytableDB);
|
||||
fprintf(ReadableDB, "%s\t\t\t\tValue: %f\n", buffer, value);
|
||||
}
|
||||
else if (type == elem_type_char)
|
||||
{
|
||||
short length; fread(&length, sizeof(short), 1, KeytableDB);
|
||||
char* value = new char[length+1]; fgets(value, length+1, KeytableDB);
|
||||
fprintf(ReadableDB, "%s Length %3d\tValue: \"%s\"\n", buffer, length, value);
|
||||
delete value;
|
||||
}
|
||||
else if (type == elem_type_vector)
|
||||
{
|
||||
Vector *value = new Vector(); fread(value, sizeof(Vector), 1, KeytableDB);
|
||||
fprintf(ReadableDB, "%s\t\t\t\tValue: {%f,%f,%f}\n", buffer, (*value).x, (*value).y, (*value).z);
|
||||
delete value;
|
||||
}
|
||||
}
|
||||
fclose(KeytableDB);
|
||||
fclose(ReadableDB);
|
||||
return 1;
|
||||
}
|
||||
|
||||
template <class Type> //This will support input char*, Vector*, int, and cell_real*.
|
||||
void Keytable_Set(PPvoid_t Keytable, char* Index, Type value)
|
||||
{
|
||||
PPvoid_t PValue; // pointer to keytable element value
|
||||
PValue = JudySLIns(Keytable, Index, PJE0);
|
||||
*PValue = reinterpret_cast<void*>(value);
|
||||
}
|
||||
|
||||
PPvoid_t Keytable_Get(AMX* amx, PPvoid_t Keytable, char *Index, int ignore_error = 0)
|
||||
{
|
||||
PPvoid_t PValue = JudySLGet( *Keytable, Index, PJE0 );
|
||||
if (PValue == NULL && !ignore_error)
|
||||
MF_LogError(amx, AMX_ERR_NATIVE, "Keytable get on key \"%s\" is invalid", Index);
|
||||
return PValue;
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL Keytable_Create(AMX *amx, cell *params)
|
||||
{
|
||||
return New_Keytable(params[1],params[2]);
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL Keytable_Delete(AMX *amx, cell *params)
|
||||
{
|
||||
Delete_Keytable( params[1] );
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL Keytable_Clear(AMX *amx, cell *params)
|
||||
{
|
||||
Clear_Keytable( params[1] );
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL Keytable_SetVector(AMX *amx,cell *params)
|
||||
{
|
||||
PPvoid_t Keytable = Find_Keytable(params[1], params[4], amx);
|
||||
if (Keytable == NULL) return 0;
|
||||
|
||||
cell *input_vec = MF_GetAmxAddr(amx, params[3]);
|
||||
Vector *value = new Vector(
|
||||
amx_ctof(input_vec[0]),
|
||||
amx_ctof(input_vec[1]),
|
||||
amx_ctof(input_vec[2])
|
||||
);
|
||||
int strlen;
|
||||
char *Index = MF_GetAmxString(amx, params[2], 0, &strlen);
|
||||
|
||||
PPvoid_t PValue = Keytable_Get(amx, Keytable, Index, 1);
|
||||
element *elem_value = NULL;
|
||||
if ( PValue == NULL )
|
||||
elem_value = new element(value);
|
||||
else
|
||||
{
|
||||
elem_value = reinterpret_cast<element*>(*PValue);
|
||||
(*elem_value).set_vec(value);
|
||||
}
|
||||
Keytable_Set(Keytable,Index,elem_value);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL Keytable_GetVector(AMX *amx, cell *params)
|
||||
{
|
||||
PPvoid_t Keytable = Find_Keytable(params[1], params[4], amx);
|
||||
if (Keytable == NULL) return 0;
|
||||
|
||||
int strlen;
|
||||
char *Index = MF_GetAmxString(amx, params[2], 0, &strlen);
|
||||
PPvoid_t PValue = Keytable_Get(amx, Keytable, Index, params[4]);
|
||||
|
||||
cell *vAmx = MF_GetAmxAddr(amx, params[3]);
|
||||
|
||||
if( PValue == NULL ) {
|
||||
vAmx[0] = amx_ftoc(0);
|
||||
vAmx[1] = amx_ftoc(0);
|
||||
vAmx[2] = amx_ftoc(0);
|
||||
return 0;
|
||||
}
|
||||
element elem_value = *reinterpret_cast<element*>(*PValue);
|
||||
int error = 0;
|
||||
const Vector retr_vec = *elem_value.get_vec(error);
|
||||
if (error)
|
||||
elem_value.issue_type_error(amx, params[1], Index);
|
||||
vAmx[0] = amx_ftoc(retr_vec.x);
|
||||
vAmx[1] = amx_ftoc(retr_vec.y);
|
||||
vAmx[2] = amx_ftoc(retr_vec.z);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL Keytable_SetString(AMX *amx,cell *params)
|
||||
{
|
||||
//params[1]: keytable
|
||||
PPvoid_t Keytable = Find_Keytable(params[1], params[4], amx);
|
||||
if (Keytable == NULL) return 0;
|
||||
|
||||
//params[2]: key
|
||||
int strlength;
|
||||
char *Index = MF_GetAmxString(amx, params[2], 0, &strlength);
|
||||
|
||||
//params[3]: value
|
||||
int iLen = 0;
|
||||
char *value = MF_GetAmxString(amx,params[3],1,&iLen);
|
||||
|
||||
PPvoid_t PValue = Keytable_Get(amx, Keytable, Index, 1);
|
||||
element *elem_value = NULL;
|
||||
if ( PValue == NULL )
|
||||
elem_value = new element(value);
|
||||
else
|
||||
{
|
||||
elem_value = reinterpret_cast<element*>(*PValue);
|
||||
(*elem_value).set_str(value);
|
||||
}
|
||||
Keytable_Set(Keytable,Index,elem_value);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL Keytable_GetString(AMX *amx,cell *params)
|
||||
{
|
||||
//params[1]: keytable
|
||||
PPvoid_t Keytable = Find_Keytable(params[1], params[5], amx);
|
||||
if (Keytable == NULL) return 0;
|
||||
|
||||
//params[2]: key
|
||||
int strlength;
|
||||
char *Index = MF_GetAmxString(amx, params[2], 0, &strlength);
|
||||
|
||||
Pvoid_t * PValue = Keytable_Get(amx, Keytable, Index, params[5]);
|
||||
|
||||
//params[3] and params[4] are the return string and length respectively.
|
||||
|
||||
|
||||
if( PValue == NULL )
|
||||
return MF_SetAmxString(amx, params[3] , "dne", params[4] );
|
||||
|
||||
element elem_value = *reinterpret_cast<element*>(*PValue);
|
||||
|
||||
int error = 0;
|
||||
if (error)
|
||||
elem_value.issue_type_error(amx, params[1], Index);
|
||||
const char* str_out = elem_value.get_str(error);
|
||||
return MF_SetAmxString( amx , params[3] , str_out, params[4] );
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL Keytable_SetFloat(AMX *amx,cell *params)
|
||||
{
|
||||
//params[1]: keytable
|
||||
PPvoid_t Keytable = Find_Keytable(params[1], params[4], amx);
|
||||
if (Keytable == NULL) return 0;
|
||||
|
||||
//params[2]: key
|
||||
int strlength;
|
||||
char *Index = MF_GetAmxString(amx, params[2], 0, &strlength);
|
||||
//params[3]: value
|
||||
PPvoid_t PValue = Keytable_Get(amx, Keytable, Index, 1);
|
||||
element *elem_value = NULL;
|
||||
if ( PValue == NULL )
|
||||
elem_value = new element(amx_ctof(params[3]));
|
||||
else
|
||||
{
|
||||
elem_value = reinterpret_cast<element*>(*PValue);
|
||||
(*elem_value).set_flo(amx_ctof(params[3]));
|
||||
}
|
||||
Keytable_Set(Keytable,Index,elem_value);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL Keytable_GetFloat(AMX *amx,cell *params)
|
||||
{
|
||||
//params[1]: keytable
|
||||
PPvoid_t Keytable = Find_Keytable(params[1], params[3], amx);
|
||||
if (Keytable == NULL) return 0;
|
||||
|
||||
//params[2]: key
|
||||
int strlength;
|
||||
char *Index = MF_GetAmxString(amx, params[2], 0, &strlength);
|
||||
|
||||
PPvoid_t PValue = Keytable_Get(amx, Keytable, Index, params[3]);
|
||||
|
||||
if( PValue == NULL ) return amx_ftoc(0.0);
|
||||
|
||||
element elem_value = *reinterpret_cast<element*>(*PValue);
|
||||
|
||||
int error = 0;
|
||||
cell retr_float = amx_ftoc(elem_value.get_flo(error));
|
||||
if (error)
|
||||
elem_value.issue_type_error(amx, params[1], Index);
|
||||
return retr_float;
|
||||
}
|
||||
|
||||
|
||||
static cell AMX_NATIVE_CALL Keytable_SetInt(AMX *amx,cell *params)
|
||||
{
|
||||
//params[1]: keytable
|
||||
PPvoid_t Keytable = Find_Keytable(params[1], params[4], amx);
|
||||
if (Keytable == NULL) return 0;
|
||||
|
||||
//params[2]: key
|
||||
int strlength;
|
||||
char *Index = MF_GetAmxString(amx, params[2], 0, &strlength);
|
||||
|
||||
PPvoid_t PValue = Keytable_Get(amx, Keytable, Index, 1);
|
||||
element *elem_value = NULL;
|
||||
if ( PValue == NULL )
|
||||
elem_value = new element(params[3]);
|
||||
else
|
||||
{
|
||||
elem_value = reinterpret_cast<element*>(*PValue);
|
||||
(*elem_value).set_int(params[3]);
|
||||
}
|
||||
Keytable_Set(Keytable,Index,elem_value);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL Keytable_GetInt(AMX *amx,cell *params)
|
||||
{
|
||||
//params[1]: keytable
|
||||
PPvoid_t Keytable = Find_Keytable(params[1], params[3], amx);
|
||||
if (Keytable == NULL) return 0;
|
||||
//params[2]: key
|
||||
int strlength;
|
||||
char *Index = MF_GetAmxString(amx, params[2], 0, &strlength);
|
||||
|
||||
Pvoid_t * PValue = Keytable_Get(amx, Keytable, Index, params[3]);
|
||||
|
||||
if( PValue == NULL ) return 0;
|
||||
|
||||
element elem_value = *reinterpret_cast<element*>(*PValue);
|
||||
|
||||
int error = 0;
|
||||
cell retr_int = elem_value.get_int(error);
|
||||
if (error)
|
||||
elem_value.issue_type_error(amx, params[1], Index);
|
||||
return retr_int;
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL Keytable_Memory(AMX *amx,cell *params)
|
||||
{
|
||||
Pvoid_t * Keytable = Find_Keytable(params[1],params[2],amx);
|
||||
if (Keytable == NULL) return 0;
|
||||
|
||||
return JudyLMemUsed(*Keytable);
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL Keytable_Remove(AMX *amx,cell *params)
|
||||
{
|
||||
//params[1]: keytable
|
||||
PPvoid_t Keytable = Find_Keytable(params[1], 0, amx);
|
||||
if (Keytable == NULL) return 0;
|
||||
|
||||
//params[2]: key
|
||||
int strlength;
|
||||
char *Index = MF_GetAmxString(amx, params[2], 0, &strlength);
|
||||
//Have to delete the element
|
||||
PPvoid_t PValue = JudySLGet(*Keytable, Index, PJE0);
|
||||
if (PValue == NULL) return 1;
|
||||
element elem_value = *reinterpret_cast<element*>(*PValue);
|
||||
elem_value.delete_element();
|
||||
|
||||
JudySLDel(Keytable, Index, PJE0 );
|
||||
return 1;
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL Keytable_Next(AMX *amx,cell *params)
|
||||
{
|
||||
//params[1]: keytable
|
||||
PPvoid_t Keytable = Find_Keytable(params[1], params[5], amx);
|
||||
if (Keytable == NULL) return 0;
|
||||
|
||||
//params[2]: key
|
||||
int strlength;
|
||||
char *Index = MF_GetAmxString(amx, params[2], 0, &strlength);
|
||||
//params[3], params[4]: return key and length
|
||||
|
||||
PPvoid_t pointer;
|
||||
pointer = JudySLNext(*Keytable, Index, PJE0);
|
||||
|
||||
if (pointer == NULL) {
|
||||
MF_SetAmxString(amx, params[3], "dne", 0);
|
||||
return 0;
|
||||
}
|
||||
MF_SetAmxString(amx, params[3], Index, params[4]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL Keytable_Prev(AMX *amx,cell *params)
|
||||
{
|
||||
//params[1]: keytable
|
||||
PPvoid_t Keytable = Find_Keytable(params[1], params[5], amx);
|
||||
if (Keytable == NULL) return 0;
|
||||
|
||||
//params[2]: key
|
||||
int strlength;
|
||||
char *Index = MF_GetAmxString(amx, params[2], 0, &strlength);
|
||||
//params[3], params[4]: return key and length
|
||||
|
||||
PPvoid_t pointer;
|
||||
pointer = JudySLPrev(*Keytable, Index, PJE0);
|
||||
|
||||
if (pointer == NULL) {
|
||||
MF_SetAmxString(amx, params[3], "dne", 0);
|
||||
return 0;
|
||||
}
|
||||
MF_SetAmxString(amx, params[3], Index, params[4]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
static cell AMX_NATIVE_CALL Keytable_First(AMX *amx,cell *params)
|
||||
{
|
||||
//params[1]: keytable
|
||||
PPvoid_t Keytable = Find_Keytable(params[1], params[5], amx);
|
||||
if (Keytable == NULL) return 0;
|
||||
|
||||
//params[2]: key
|
||||
int strlength;
|
||||
char *Index = MF_GetAmxString(amx, params[2], 0, &strlength);
|
||||
//params[3], params[4]: return key and length
|
||||
|
||||
PPvoid_t pointer;
|
||||
pointer = JudySLFirst(*Keytable, Index, PJE0);
|
||||
|
||||
if (pointer == NULL) {
|
||||
MF_SetAmxString(amx, params[3], "dne", 0);
|
||||
return 0;
|
||||
}
|
||||
MF_SetAmxString(amx, params[3], Index, params[4]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL Keytable_Last(AMX *amx,cell *params)
|
||||
{
|
||||
//params[1]: keytable
|
||||
PPvoid_t Keytable = Find_Keytable(params[1], params[5], amx);
|
||||
if (Keytable == NULL) return 0;
|
||||
|
||||
//params[2]: key
|
||||
int strlength;
|
||||
char *Index = MF_GetAmxString(amx, params[2], 0, &strlength);
|
||||
//params[3], params[4]: return key and length
|
||||
|
||||
PPvoid_t pointer;
|
||||
pointer = JudySLLast(*Keytable, Index, PJE0);
|
||||
|
||||
if (pointer == NULL) {
|
||||
MF_SetAmxString(amx, params[3], "dne", 0);
|
||||
return 0;
|
||||
}
|
||||
MF_SetAmxString(amx, params[3], Index, params[4]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL Key_IsEmpty(AMX *amx, cell *params)
|
||||
{
|
||||
//params[1]: keytable
|
||||
PPvoid_t Keytable = Find_Keytable(params[1], params[3], amx);
|
||||
if (Keytable == NULL) return 0;
|
||||
|
||||
//params[2]: key
|
||||
int strlength;
|
||||
char *Index = MF_GetAmxString(amx, params[2], 0, &strlength);
|
||||
|
||||
PPvoid_t pointer = JudySLGet(*Keytable, Index, PJE0);
|
||||
|
||||
return (pointer == NULL) ? 1 : 0;
|
||||
}
|
||||
|
||||
static cell AMX_NATIVE_CALL Key_IsFilled(AMX *amx, cell *params)
|
||||
{
|
||||
//params[1]: keytable
|
||||
PPvoid_t Keytable = Find_Keytable(params[1], params[3], amx);
|
||||
if (Keytable == NULL) return 0;
|
||||
|
||||
//params[2]: key
|
||||
int strlength;
|
||||
char *Index = MF_GetAmxString(amx, params[2], 0, &strlength);
|
||||
|
||||
PPvoid_t pointer = JudySLGet(*Keytable, Index, PJE0);
|
||||
|
||||
return (pointer != NULL) ? 1 : 0;
|
||||
}
|
||||
|
||||
AMX_NATIVE_INFO keytable_exports[] = {
|
||||
{ "keytable_set_string", Keytable_SetString },
|
||||
{ "keytable_get_string", Keytable_GetString },
|
||||
|
||||
{ "keytable_set_vector", Keytable_SetVector },
|
||||
{ "keytable_get_vector", Keytable_GetVector },
|
||||
|
||||
{ "keytable_set_int", Keytable_SetInt },
|
||||
{ "keytable_get_int", Keytable_GetInt },
|
||||
|
||||
{ "keytable_set_float", Keytable_SetFloat },
|
||||
{ "keytable_get_float", Keytable_GetFloat },
|
||||
|
||||
{ "keytable_isempty", Key_IsEmpty },
|
||||
{ "keytable_isfilled", Key_IsFilled },
|
||||
|
||||
{ "keytable_memory", Keytable_Memory },
|
||||
|
||||
{ "keytable_remove", Keytable_Remove },
|
||||
|
||||
{ "keytable_create", Keytable_Create },
|
||||
{ "keytable_delete", Keytable_Delete },
|
||||
{ "keytable_clear", Keytable_Clear },
|
||||
|
||||
{ "keytable_next", Keytable_Next },
|
||||
{ "keytable_prev", Keytable_Prev },
|
||||
{ "keytable_first", Keytable_First },
|
||||
{ "keytable_last", Keytable_Last },
|
||||
|
||||
{ "keytable_save", Keytable_Save },
|
||||
{ "keytable_load", Keytable_Load },
|
||||
|
||||
{ "keytable_save_ascii", Keytable_Save_ASCII },
|
||||
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
#endif
|
742
dlls/arrayx/Judy-1.0.1/src/Judy.h
Normal file
742
dlls/arrayx/Judy-1.0.1/src/Judy.h
Normal file
|
@ -0,0 +1,742 @@
|
|||
#ifndef _JUDY_INCLUDED
|
||||
#define _JUDY_INCLUDED
|
||||
// _________________
|
||||
//
|
||||
// Copyright (C) 2000 - 2002 Hewlett-Packard Company
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify it
|
||||
// under the term of the GNU Lesser General Public License as published by the
|
||||
// Free Software Foundation; either version 2 of the License, or (at your
|
||||
// option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
// for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with this program; if not, write to the Free Software Foundation,
|
||||
// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
// _________________
|
||||
|
||||
// @(#) $Revision$ $Source$
|
||||
//
|
||||
// HEADER FILE FOR EXPORTED FEATURES IN JUDY LIBRARY, libJudy.*
|
||||
//
|
||||
// See the manual entries for details.
|
||||
//
|
||||
// Note: This header file uses old-style comments on #-directive lines and
|
||||
// avoids "()" on macro names in comments for compatibility with older cc -Aa
|
||||
// and some tools on some platforms.
|
||||
|
||||
|
||||
// PLATFORM-SPECIFIC
|
||||
|
||||
#ifdef JU_WIN /* =============================================== */
|
||||
|
||||
typedef __int8 int8_t;
|
||||
//typedef __int16 int16_t;
|
||||
//typedef __int32 int32_t;
|
||||
typedef __int64 int64_t;
|
||||
|
||||
typedef char uint8_t;
|
||||
//typedef unsigned __int16 uint16_t;
|
||||
//typedef unsigned __int32 uint32_t;
|
||||
typedef unsigned __int64 uint64_t;
|
||||
|
||||
#else /* ================ ! JU_WIN ============================= */
|
||||
|
||||
// ISO C99: 7.8 Format conversion of integer types <inttypes.h>
|
||||
#include <inttypes.h> /* if this FAILS, try #include <stdint.h> */
|
||||
|
||||
// ISO C99: 7.18 Integer types uint*_t
|
||||
//#include <stdint.h>
|
||||
|
||||
#endif /* ================ ! JU_WIN ============================= */
|
||||
|
||||
// ISO C99 Standard: 7.20 General utilities
|
||||
//#include <stdlib.h>
|
||||
|
||||
// ISO C99 Standard: 7.10/5.2.4.2.1 Sizes of integer types
|
||||
#include <limits.h>
|
||||
|
||||
#ifdef __cplusplus /* support use by C++ code */
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
// ****************************************************************************
|
||||
// DECLARE SOME BASE TYPES IN CASE THEY ARE MISSING:
|
||||
//
|
||||
// These base types include "const" where appropriate, but only where of
|
||||
// interest to the caller. For example, a caller cares that a variable passed
|
||||
// by reference will not be modified, such as, "const void * Pindex", but not
|
||||
// that the called function internally does not modify the pointer itself, such
|
||||
// as, "void * const Pindex".
|
||||
//
|
||||
// Note that its OK to pass a Pvoid_t to a Pcvoid_t; the latter is the same,
|
||||
// only constant. Callers need to do this so they can also pass & Pvoid_t to
|
||||
// PPvoid_t (non-constant).
|
||||
|
||||
#ifndef _PCVOID_T
|
||||
#define _PCVOID_T
|
||||
typedef const void * Pcvoid_t;
|
||||
#endif
|
||||
|
||||
#ifndef _PVOID_T
|
||||
#define _PVOID_T
|
||||
typedef void * Pvoid_t;
|
||||
typedef void ** PPvoid_t;
|
||||
#endif
|
||||
|
||||
#ifndef _WORD_T
|
||||
#define _WORD_T
|
||||
typedef unsigned int Word_t, * PWord_t; // expect 32-bit or 64-bit words.
|
||||
#endif
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL 0
|
||||
#endif
|
||||
|
||||
|
||||
// ****************************************************************************
|
||||
// SUPPORT FOR ERROR HANDLING:
|
||||
//
|
||||
// Judy error numbers:
|
||||
//
|
||||
// Note: These are an enum so theres a related typedef, but the numbers are
|
||||
// spelled out so you can map a number back to its name.
|
||||
|
||||
typedef enum // uint8_t -- but C does not support this type of enum.
|
||||
{
|
||||
|
||||
// Note: JU_ERRNO_NONE and JU_ERRNO_FULL are not real errors. They specify
|
||||
// conditions which are otherwise impossible return values from 32-bit
|
||||
// Judy1Count, which has 2^32 + 1 valid returns (0..2^32) plus one error
|
||||
// return. These pseudo-errors support the return values that cannot otherwise
|
||||
// be unambiguously represented in a 32-bit word, and will never occur on a
|
||||
// 64-bit system.
|
||||
|
||||
JU_ERRNO_NONE = 0,
|
||||
JU_ERRNO_FULL = 1,
|
||||
JU_ERRNO_NFMAX = JU_ERRNO_FULL,
|
||||
|
||||
// JU_ERRNO_NOMEM comes from malloc(3C) when Judy cannot obtain needed memory.
|
||||
// The system errno value is also set to ENOMEM. This error can be recoverable
|
||||
// if the calling application frees other memory.
|
||||
//
|
||||
// TBD: Currently there is no guarantee the Judy array has no memory leaks
|
||||
// upon JU_ERRNO_NOMEM.
|
||||
|
||||
JU_ERRNO_NOMEM = 2,
|
||||
|
||||
// Problems with parameters from the calling program:
|
||||
//
|
||||
// JU_ERRNO_NULLPPARRAY means PPArray was null; perhaps PArray was passed where
|
||||
// &PArray was intended. Similarly, JU_ERRNO_NULLPINDEX means PIndex was null;
|
||||
// perhaps &Index was intended. Also, JU_ERRNO_NONNULLPARRAY,
|
||||
// JU_ERRNO_NULLPVALUE, and JU_ERRNO_UNSORTED, all added later (hence with
|
||||
// higher numbers), mean: A non-null array was passed in where a null pointer
|
||||
// was required; PValue was null; and unsorted indexes were detected.
|
||||
|
||||
JU_ERRNO_NULLPPARRAY = 3, // see above.
|
||||
JU_ERRNO_NONNULLPARRAY = 10, // see above.
|
||||
JU_ERRNO_NULLPINDEX = 4, // see above.
|
||||
JU_ERRNO_NULLPVALUE = 11, // see above.
|
||||
JU_ERRNO_NOTJUDY1 = 5, // PArray is not to a Judy1 array.
|
||||
JU_ERRNO_NOTJUDYL = 6, // PArray is not to a JudyL array.
|
||||
JU_ERRNO_NOTJUDYSL = 7, // PArray is not to a JudySL array.
|
||||
JU_ERRNO_UNSORTED = 12, // see above.
|
||||
|
||||
// Errors below this point are not recoverable; further tries to access the
|
||||
// Judy array might result in EFAULT and a core dump:
|
||||
//
|
||||
// JU_ERRNO_OVERRUN occurs when Judy detects, upon reallocation, that a block
|
||||
// of memory in its own freelist was modified since being freed.
|
||||
|
||||
JU_ERRNO_OVERRUN = 8,
|
||||
|
||||
// JU_ERRNO_CORRUPT occurs when Judy detects an impossible value in a Judy data
|
||||
// structure:
|
||||
//
|
||||
// Note: The Judy data structure contains some redundant elements that support
|
||||
// this type of checking.
|
||||
|
||||
JU_ERRNO_CORRUPT = 9
|
||||
|
||||
// Warning: At least some C or C++ compilers do not tolerate a trailing comma
|
||||
// above here. At least we know of one case, in aCC; see JAGad58928.
|
||||
|
||||
} JU_Errno_t;
|
||||
|
||||
|
||||
// Judy errno structure:
|
||||
//
|
||||
// WARNING: For compatibility with possible future changes, the fields of this
|
||||
// struct should not be referenced directly. Instead use the macros supplied
|
||||
// below.
|
||||
|
||||
// This structure should be declared on the stack in a threaded process.
|
||||
|
||||
typedef struct J_UDY_ERROR_STRUCT
|
||||
{
|
||||
JU_Errno_t je_Errno; // one of the enums above.
|
||||
int je_ErrID; // often an internal source line number.
|
||||
Word_t je_reserved[4]; // for future backward compatibility.
|
||||
|
||||
} JError_t, * PJError_t;
|
||||
|
||||
|
||||
// Related macros:
|
||||
//
|
||||
// Fields from error struct:
|
||||
|
||||
#define JU_ERRNO(PJError) ((PJError)->je_Errno)
|
||||
#define JU_ERRID(PJError) ((PJError)->je_ErrID)
|
||||
|
||||
// For checking return values from various Judy functions:
|
||||
//
|
||||
// Note: Define JERR as -1, not as the seemingly more portable (Word_t)
|
||||
// (~0UL), to avoid a compiler "overflow in implicit constant conversion"
|
||||
// warning.
|
||||
|
||||
#define JERR (-1) /* functions returning int or Word_t */
|
||||
#define PJERR ((Pvoid_t) (~0UL)) /* mainly for use here, see below */
|
||||
#define PPJERR ((PPvoid_t) (~0UL)) /* functions that return PPvoid_t */
|
||||
|
||||
// Convenience macro for when detailed error information (PJError_t) is not
|
||||
// desired by the caller; a purposely short name:
|
||||
|
||||
#define PJE0 ((PJError_t) NULL)
|
||||
|
||||
|
||||
// ****************************************************************************
|
||||
// JUDY FUNCTIONS:
|
||||
//
|
||||
// P_JE is a shorthand for use below:
|
||||
|
||||
#define P_JE PJError_t PJError
|
||||
|
||||
// ****************************************************************************
|
||||
// JUDY1 FUNCTIONS:
|
||||
|
||||
extern int j__udy1Test( Pvoid_t Pjpm, Word_t Index);
|
||||
extern int Judy1Test( Pcvoid_t PArray, Word_t Index, P_JE);
|
||||
extern int Judy1Set( PPvoid_t PPArray, Word_t Index, P_JE);
|
||||
extern int Judy1SetArray( PPvoid_t PPArray, Word_t Count,
|
||||
const Word_t * const PIndex,
|
||||
P_JE);
|
||||
extern int Judy1Unset( PPvoid_t PPArray, Word_t Index, P_JE);
|
||||
extern Word_t Judy1Count( Pcvoid_t PArray, Word_t Index1,
|
||||
Word_t Index2, P_JE);
|
||||
extern int Judy1ByCount( Pcvoid_t PArray, Word_t Count,
|
||||
Word_t * PIndex, P_JE);
|
||||
extern Word_t Judy1FreeArray( PPvoid_t PPArray, P_JE);
|
||||
extern Word_t Judy1MemUsed( Pcvoid_t PArray);
|
||||
extern Word_t Judy1MemActive( Pcvoid_t PArray);
|
||||
extern int Judy1First( Pcvoid_t PArray, Word_t * PIndex, P_JE);
|
||||
extern int Judy1Next( Pcvoid_t PArray, Word_t * PIndex, P_JE);
|
||||
extern int j__udy1Next( Pvoid_t Pjpm, Word_t * PIndex);
|
||||
extern int Judy1Last( Pcvoid_t PArray, Word_t * PIndex, P_JE);
|
||||
extern int Judy1Prev( Pcvoid_t PArray, Word_t * PIndex, P_JE);
|
||||
extern int Judy1FirstEmpty( Pcvoid_t PArray, Word_t * PIndex, P_JE);
|
||||
extern int Judy1NextEmpty( Pcvoid_t PArray, Word_t * PIndex, P_JE);
|
||||
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 j__udyLGet( Pvoid_t Pjpm, Word_t Index);
|
||||
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 j__udyLNext( Pvoid_t Pjpm, Word_t * PIndex);
|
||||
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>
|
||||
//
|
||||
// or use this cc option at compile time:
|
||||
//
|
||||
// cc -DJUDYERROR_NOTEST ...
|
||||
//
|
||||
// Example code:
|
||||
//
|
||||
// J1S(Rc, PArray, Index);
|
||||
// if (Rc == JERR) goto ...error
|
||||
//
|
||||
// or:
|
||||
//
|
||||
// JLI(PValue, PArray, Index);
|
||||
// if (PValue == PJERR) goto ...error
|
||||
|
||||
|
||||
// Internal shorthand macros for writing the J1S, etc. macros:
|
||||
|
||||
#ifdef JUDYERROR_NOTEST /* ============================================ */
|
||||
|
||||
// "Judy Set Error":
|
||||
|
||||
#define J_SE(FuncName,Errno) ((void) 0)
|
||||
|
||||
// Note: In each J_*() case below, the digit is the number of key parameters
|
||||
// to the Judy*() call. Just assign the Func result to the callers Rc value
|
||||
// without a cast because none is required, and this keeps the API simpler.
|
||||
// However, a family of different J_*() macros is needed to support the
|
||||
// different numbers of key parameters (0,1,2) and the Func return type.
|
||||
//
|
||||
// In the names below, "I" = integer result; "P" = pointer result. Note, the
|
||||
// Funcs for J_*P() return PPvoid_t, but cast this to a Pvoid_t for flexible,
|
||||
// error-free assignment, and then compare to PJERR.
|
||||
|
||||
#define J_0I(Rc,PArray,Func,FuncName) \
|
||||
{ (Rc) = Func(PArray, PJE0); }
|
||||
|
||||
#define J_1I(Rc,PArray,Index,Func,FuncName) \
|
||||
{ (Rc) = Func(PArray, Index, PJE0); }
|
||||
|
||||
#define J_1P(PV,PArray,Index,Func,FuncName) \
|
||||
{ (PV) = (Pvoid_t) Func(PArray, Index, PJE0); }
|
||||
|
||||
#define J_2I(Rc,PArray,Index,Arg2,Func,FuncName) \
|
||||
{ (Rc) = Func(PArray, Index, Arg2, PJE0); }
|
||||
|
||||
#define J_2C(Rc,PArray,Index1,Index2,Func,FuncName) \
|
||||
{ (Rc) = Func(PArray, Index1, Index2, PJE0); }
|
||||
|
||||
#define J_2P(PV,PArray,Index,Arg2,Func,FuncName) \
|
||||
{ (PV) = (Pvoid_t) Func(PArray, Index, Arg2, PJE0); }
|
||||
|
||||
// Variations for Judy*Set/InsArray functions:
|
||||
|
||||
#define J_2AI(Rc,PArray,Count,PIndex,Func,FuncName) \
|
||||
{ (Rc) = Func(PArray, Count, PIndex, PJE0); }
|
||||
#define J_3AI(Rc,PArray,Count,PIndex,PValue,Func,FuncName) \
|
||||
{ (Rc) = Func(PArray, Count, PIndex, PValue, PJE0); }
|
||||
|
||||
#else /* ================ ! JUDYERROR_NOTEST ============================= */
|
||||
|
||||
#define J_E(FuncName,PJE) \
|
||||
JUDYERROR(__FILE__, __LINE__, FuncName, JU_ERRNO(PJE), JU_ERRID(PJE))
|
||||
|
||||
#define J_SE(FuncName,Errno) \
|
||||
{ \
|
||||
JError_t J_Error; \
|
||||
JU_ERRNO(&J_Error) = (Errno); \
|
||||
JU_ERRID(&J_Error) = __LINE__; \
|
||||
J_E(FuncName, &J_Error); \
|
||||
}
|
||||
|
||||
// Note: In each J_*() case below, the digit is the number of key parameters
|
||||
// to the Judy*() call. Just assign the Func result to the callers Rc value
|
||||
// without a cast because none is required, and this keeps the API simpler.
|
||||
// However, a family of different J_*() macros is needed to support the
|
||||
// different numbers of key parameters (0,1,2) and the Func return type.
|
||||
//
|
||||
// In the names below, "I" = integer result; "P" = pointer result. Note, the
|
||||
// Funcs for J_*P() return PPvoid_t, but cast this to a Pvoid_t for flexible,
|
||||
// error-free assignment, and then compare to PJERR.
|
||||
|
||||
#define J_0I(Rc,PArray,Func,FuncName) \
|
||||
{ \
|
||||
JError_t J_Error; \
|
||||
if (((Rc) = Func(PArray, &J_Error)) == JERR) \
|
||||
J_E(FuncName, &J_Error); \
|
||||
}
|
||||
|
||||
#define J_1I(Rc,PArray,Index,Func,FuncName) \
|
||||
{ \
|
||||
JError_t J_Error; \
|
||||
if (((Rc) = Func(PArray, Index, &J_Error)) == JERR) \
|
||||
J_E(FuncName, &J_Error); \
|
||||
}
|
||||
|
||||
#define J_1P(Rc,PArray,Index,Func,FuncName) \
|
||||
{ \
|
||||
JError_t J_Error; \
|
||||
if (((Rc) = (Pvoid_t) Func(PArray, Index, &J_Error)) == PJERR) \
|
||||
J_E(FuncName, &J_Error); \
|
||||
}
|
||||
|
||||
#define J_2I(Rc,PArray,Index,Arg2,Func,FuncName) \
|
||||
{ \
|
||||
JError_t J_Error; \
|
||||
if (((Rc) = Func(PArray, Index, Arg2, &J_Error)) == JERR) \
|
||||
J_E(FuncName, &J_Error); \
|
||||
}
|
||||
|
||||
// Variation for Judy*Count functions, which return 0, not JERR, for error (and
|
||||
// also for other non-error cases):
|
||||
//
|
||||
// Note: JU_ERRNO_NFMAX should only apply to 32-bit Judy1, but this header
|
||||
// file lacks the necessary ifdefs to make it go away otherwise, so always
|
||||
// check against it.
|
||||
|
||||
#define J_2C(Rc,PArray,Index1,Index2,Func,FuncName) \
|
||||
{ \
|
||||
JError_t J_Error; \
|
||||
if ((((Rc) = Func(PArray, Index1, Index2, &J_Error)) == 0) \
|
||||
&& (JU_ERRNO(&J_Error) > JU_ERRNO_NFMAX)) \
|
||||
{ \
|
||||
J_E(FuncName, &J_Error); \
|
||||
} \
|
||||
}
|
||||
|
||||
#define J_2P(PV,PArray,Index,Arg2,Func,FuncName) \
|
||||
{ \
|
||||
JError_t J_Error; \
|
||||
if (((PV) = (Pvoid_t) Func(PArray, Index, Arg2, &J_Error)) \
|
||||
== PJERR) J_E(FuncName, &J_Error); \
|
||||
}
|
||||
|
||||
// Variations for Judy*Set/InsArray functions:
|
||||
|
||||
#define J_2AI(Rc,PArray,Count,PIndex,Func,FuncName) \
|
||||
{ \
|
||||
JError_t J_Error; \
|
||||
if (((Rc) = Func(PArray, Count, PIndex, &J_Error)) == JERR) \
|
||||
J_E(FuncName, &J_Error); \
|
||||
}
|
||||
|
||||
#define J_3AI(Rc,PArray,Count,PIndex,PValue,Func,FuncName) \
|
||||
{ \
|
||||
JError_t J_Error; \
|
||||
if (((Rc) = Func(PArray, Count, PIndex, PValue, &J_Error)) \
|
||||
== JERR) J_E(FuncName, &J_Error); \
|
||||
}
|
||||
|
||||
#endif /* ================ ! JUDYERROR_NOTEST ============================= */
|
||||
|
||||
// Some of the macros are special cases that use inlined shortcuts for speed
|
||||
// with root-level leaves:
|
||||
|
||||
// This is a slower version with current processors, but in the future...
|
||||
#ifdef notdef
|
||||
#define J1T(Rc,PArray,Index) \
|
||||
{ \
|
||||
PWord_t P_L = (PWord_t)(PArray); \
|
||||
(Rc) = 0; \
|
||||
if (P_L) /* cannot be a NULL pointer */ \
|
||||
{ \
|
||||
if (P_L[0] < 31) /* is a LeafL */ \
|
||||
{ \
|
||||
Word_t _pop1 = P_L[0] + 1; \
|
||||
PWord_t P_LE = P_L + _pop1; \
|
||||
Word_t _index = 0; \
|
||||
int ii = 0; \
|
||||
P_L++; \
|
||||
while (_pop1 > 4) \
|
||||
{ \
|
||||
_pop1 /=2; \
|
||||
_index = P_L[_pop1]; \
|
||||
if ((Index) > _index) P_L += _pop1 + 1; \
|
||||
} \
|
||||
while (P_L <= P_LE) \
|
||||
{ \
|
||||
ii++; \
|
||||
_index = P_L[0]; \
|
||||
if (_index >= (Index)) break; \
|
||||
P_L++; \
|
||||
} \
|
||||
if (_index == (Index)) (Rc) = 1; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
(Rc) = j__udy1Test((Pvoid_t)P_L, (Index)); \
|
||||
} \
|
||||
} \
|
||||
}
|
||||
#endif // notdef
|
||||
|
||||
#define J1T(Rc,PArray,Index) \
|
||||
{ \
|
||||
PWord_t P_L = (PWord_t)(PArray); \
|
||||
(Rc) = 0; \
|
||||
if (P_L) /* cannot be a NULL pointer */ \
|
||||
{ \
|
||||
if (P_L[0] < 31) /* is a LeafL */ \
|
||||
{ \
|
||||
Word_t _pop1 = P_L[0] + 1; \
|
||||
Word_t _EIndex = P_L[_pop1]; \
|
||||
if (_pop1 >= 16) \
|
||||
{ \
|
||||
if ((Index) > P_L[_pop1/2]) P_L += _pop1/2; \
|
||||
} \
|
||||
if ((Index) <= _EIndex) \
|
||||
{ \
|
||||
while((Index) > *(++P_L)); \
|
||||
if (*P_L == (Index)) (Rc) = 1; \
|
||||
} \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
(Rc) = j__udy1Test((Pvoid_t)P_L, Index); \
|
||||
} \
|
||||
} \
|
||||
}
|
||||
|
||||
#define J1S( Rc, PArray, Index) \
|
||||
J_1I(Rc, (&(PArray)), Index, Judy1Set, "Judy1Set")
|
||||
#define J1SA(Rc, PArray, Count, PIndex) \
|
||||
J_2AI(Rc,(&(PArray)), Count, PIndex, Judy1SetArray, "Judy1SetArray")
|
||||
#define J1U( Rc, PArray, Index) \
|
||||
J_1I(Rc, (&(PArray)), Index, Judy1Unset, "Judy1Unset")
|
||||
#define J1F( Rc, PArray, Index) \
|
||||
J_1I(Rc, PArray, &(Index), Judy1First, "Judy1First")
|
||||
#define J1N( Rc, PArray, Index) \
|
||||
J_1I(Rc, PArray, &(Index), Judy1Next, "Judy1Next")
|
||||
#define J1L( Rc, PArray, Index) \
|
||||
J_1I(Rc, PArray, &(Index), Judy1Last, "Judy1Last")
|
||||
#define J1P( Rc, PArray, Index) \
|
||||
J_1I(Rc, PArray, &(Index), Judy1Prev, "Judy1Prev")
|
||||
#define J1FE(Rc, PArray, Index) \
|
||||
J_1I(Rc, PArray, &(Index), Judy1FirstEmpty, "Judy1FirstEmpty")
|
||||
#define J1NE(Rc, PArray, Index) \
|
||||
J_1I(Rc, PArray, &(Index), Judy1NextEmpty, "Judy1NextEmpty")
|
||||
#define J1LE(Rc, PArray, Index) \
|
||||
J_1I(Rc, PArray, &(Index), Judy1LastEmpty, "Judy1LastEmpty")
|
||||
#define J1PE(Rc, PArray, Index) \
|
||||
J_1I(Rc, PArray, &(Index), Judy1PrevEmpty, "Judy1PrevEmpty")
|
||||
#define J1C( Rc, PArray, Index1, Index2) \
|
||||
J_2C(Rc, PArray, Index1, Index2, Judy1Count, "Judy1Count")
|
||||
#define J1BC(Rc, PArray, Count, Index) \
|
||||
J_2I(Rc, PArray, Count, &(Index), Judy1ByCount, "Judy1ByCount")
|
||||
#define J1FA(Rc, PArray) \
|
||||
J_0I(Rc, (&(PArray)), Judy1FreeArray, "Judy1FreeArray")
|
||||
#define J1MU(Rc, PArray) \
|
||||
(Rc) = Judy1MemUsed(PArray)
|
||||
|
||||
#define JLG(PV,PArray,Index) \
|
||||
{ \
|
||||
extern const uint8_t j__L_LeafWOffset[]; \
|
||||
PWord_t P_L = (PWord_t)(PArray); \
|
||||
(PV) = (Pvoid_t) NULL; \
|
||||
if (P_L) /* cannot be a NULL pointer */ \
|
||||
{ \
|
||||
if (P_L[0] < 31) /* is a LeafL */ \
|
||||
{ \
|
||||
Word_t _pop1 = P_L[0] + 1; \
|
||||
Word_t _EIndex = P_L[_pop1]; \
|
||||
Word_t _off = j__L_LeafWOffset[_pop1] - 1; \
|
||||
if (_pop1 >= 16) \
|
||||
{ \
|
||||
if ((Index) > P_L[_pop1/2]) P_L += _pop1/2; \
|
||||
} \
|
||||
if ((Index) <= _EIndex) \
|
||||
{ \
|
||||
while((Index) > *(++P_L)); \
|
||||
if (*P_L == (Index)) (PV) = (Pvoid_t)(P_L+_off);\
|
||||
} \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
(PV) = (Pvoid_t)j__udyLGet((Pvoid_t)P_L, Index); \
|
||||
} \
|
||||
} \
|
||||
}
|
||||
|
||||
#define JLI( PV, PArray, Index) \
|
||||
J_1P(PV, (&(PArray)), Index, JudyLIns, "JudyLIns")
|
||||
|
||||
#define JLIA(Rc, PArray, Count, PIndex, PValue) \
|
||||
J_3AI(Rc,(&(PArray)), Count, PIndex, PValue, JudyLInsArray, \
|
||||
"JudyLInsArray")
|
||||
#define JLD( Rc, PArray, Index) \
|
||||
J_1I(Rc, (&(PArray)), Index, JudyLDel, "JudyLDel")
|
||||
|
||||
#define JLF( PV, PArray, Index) \
|
||||
J_1P(PV, PArray, &(Index), JudyLFirst, "JudyLFirst")
|
||||
|
||||
#define JLN(PV,PArray,Index) \
|
||||
{ \
|
||||
extern const uint8_t j__L_LeafWOffset[]; \
|
||||
PWord_t P_L = (PWord_t) (PArray); \
|
||||
\
|
||||
(PV) = (Pvoid_t) NULL; \
|
||||
\
|
||||
if (P_L) /* cannot be a NULL pointer */ \
|
||||
{ \
|
||||
if (P_L[0] < 31) /* is a LeafL */ \
|
||||
{ \
|
||||
Word_t _pop1 = P_L[0] + 1; \
|
||||
Word_t _off = j__L_LeafWOffset[_pop1] -1; \
|
||||
if ((Index) < P_L[_pop1]) \
|
||||
{ \
|
||||
while(1) \
|
||||
{ \
|
||||
if ((Index) < *(++P_L)) \
|
||||
{ \
|
||||
(Index) = *P_L; \
|
||||
(PV) = (Pvoid_t) (P_L + _off); \
|
||||
break; \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
(PV) = (Pvoid_t)JudyLNext((Pvoid_t) PArray, &(Index), PJE0); \
|
||||
} \
|
||||
} \
|
||||
}
|
||||
|
||||
#define JLL( PV, PArray, Index) \
|
||||
J_1P(PV, PArray, &(Index), JudyLLast, "JudyLLast")
|
||||
#define JLP( PV, PArray, Index) \
|
||||
J_1P(PV, PArray, &(Index), JudyLPrev, "JudyLPrev")
|
||||
#define JLFE(Rc, PArray, Index) \
|
||||
J_1I(Rc, PArray, &(Index), JudyLFirstEmpty, "JudyLFirstEmpty")
|
||||
#define JLNE(Rc, PArray, Index) \
|
||||
J_1I(Rc, PArray, &(Index), JudyLNextEmpty, "JudyLNextEmpty")
|
||||
#define JLLE(Rc, PArray, Index) \
|
||||
J_1I(Rc, PArray, &(Index), JudyLLastEmpty, "JudyLLastEmpty")
|
||||
#define JLPE(Rc, PArray, Index) \
|
||||
J_1I(Rc, PArray, &(Index), JudyLPrevEmpty, "JudyLPrevEmpty")
|
||||
#define JLC( Rc, PArray, Index1, Index2) \
|
||||
J_2C(Rc, PArray, Index1, Index2, JudyLCount, "JudyLCount")
|
||||
#define JLBC(PV, PArray, Count, Index) \
|
||||
J_2P(PV, PArray, Count, &(Index), JudyLByCount, "JudyLByCount")
|
||||
#define JLFA(Rc, PArray) \
|
||||
J_0I(Rc, (&(PArray)), JudyLFreeArray, "JudyLFreeArray")
|
||||
#define JLMU(Rc, PArray) \
|
||||
(Rc) = JudyLMemUsed(PArray)
|
||||
|
||||
#define JHSI(PV, PArray, PIndex, Count) \
|
||||
J_2P(PV, (&(PArray)), PIndex, Count, JudyHSIns, "JudyHSIns")
|
||||
#define JHSG(PV, PArray, PIndex, Count) \
|
||||
(PV) = (Pvoid_t) JudyHSGet(PArray, PIndex, Count)
|
||||
#define JHSD(Rc, PArray, PIndex, Count) \
|
||||
J_2I(Rc, (&(PArray)), PIndex, Count, JudyHSDel, "JudyHSDel")
|
||||
#define JHSFA(Rc, PArray) \
|
||||
J_0I(Rc, (&(PArray)), JudyHSFreeArray, "JudyHSFreeArray")
|
||||
|
||||
#define JSLG( PV, PArray, Index) \
|
||||
J_1P( PV, PArray, Index, JudySLGet, "JudySLGet")
|
||||
#define JSLI( PV, PArray, Index) \
|
||||
J_1P( PV, (&(PArray)), Index, JudySLIns, "JudySLIns")
|
||||
#define JSLD( Rc, PArray, Index) \
|
||||
J_1I( Rc, (&(PArray)), Index, JudySLDel, "JudySLDel")
|
||||
#define JSLF( PV, PArray, Index) \
|
||||
J_1P( PV, PArray, Index, JudySLFirst, "JudySLFirst")
|
||||
#define JSLN( PV, PArray, Index) \
|
||||
J_1P( PV, PArray, Index, JudySLNext, "JudySLNext")
|
||||
#define JSLL( PV, PArray, Index) \
|
||||
J_1P( PV, PArray, Index, JudySLLast, "JudySLLast")
|
||||
#define JSLP( PV, PArray, Index) \
|
||||
J_1P( PV, PArray, Index, JudySLPrev, "JudySLPrev")
|
||||
#define JSLFA(Rc, PArray) \
|
||||
J_0I( Rc, (&(PArray)), JudySLFreeArray, "JudySLFreeArray")
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* ! _JUDY_INCLUDED */
|
139
dlls/arrayx/Judy-1.0.1/src/Judy.h.check.c
Normal file
139
dlls/arrayx/Judy-1.0.1/src/Judy.h.check.c
Normal file
|
@ -0,0 +1,139 @@
|
|||
// Copyright (C) 2000 - 2002 Hewlett-Packard Company
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify it
|
||||
// under the term of the GNU Lesser General Public License as published by the
|
||||
// Free Software Foundation; either version 2 of the License, or (at your
|
||||
// option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
// for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with this program; if not, write to the Free Software Foundation,
|
||||
// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
// _________________
|
||||
|
||||
// @(#) $Revision$ $Source$
|
||||
//
|
||||
// Fake "program" to test the exports in Judy.h by exercising each one. This
|
||||
// program should compile OK (with libJudy.a) but does not run OK.
|
||||
|
||||
#include "Judy.h"
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
Pvoid_t PArray = (Pvoid_t) NULL;
|
||||
PPvoid_t PPArray = &PArray;
|
||||
Word_t Index = 0;
|
||||
PWord_t PIndex = &Index;
|
||||
uint8_t *CIndex = NULL;
|
||||
PPvoid_t PPvoid;
|
||||
Word_t myword;
|
||||
Word_t Length;
|
||||
int myint;
|
||||
|
||||
// JUDY FUNCTIONS:
|
||||
|
||||
myint = Judy1Test ( PArray, Index, PJE0);
|
||||
myint = Judy1Set (PPArray, Index, PJE0);
|
||||
myint = Judy1SetArray (PPArray, Index, &Index, PJE0);
|
||||
myint = Judy1Unset (PPArray, Index, PJE0);
|
||||
myword = Judy1Count ( PArray, Index, Index, PJE0);
|
||||
myint = Judy1ByCount ( PArray, Index, PIndex, PJE0);
|
||||
myword = Judy1FreeArray (PPArray, PJE0);
|
||||
myword = Judy1MemUsed ( PArray );
|
||||
myword = Judy1MemActive ( PArray );
|
||||
myint = Judy1First ( PArray, PIndex, PJE0);
|
||||
myint = Judy1Next ( PArray, PIndex, PJE0);
|
||||
myint = Judy1Last ( PArray, PIndex, PJE0);
|
||||
myint = Judy1Prev ( PArray, PIndex, PJE0);
|
||||
myint = Judy1FirstEmpty ( PArray, PIndex, PJE0);
|
||||
myint = Judy1NextEmpty ( PArray, PIndex, PJE0);
|
||||
myint = Judy1LastEmpty ( PArray, PIndex, PJE0);
|
||||
myint = Judy1PrevEmpty ( PArray, PIndex, PJE0);
|
||||
|
||||
PPvoid = JudyLGet ( PArray, Index, PJE0);
|
||||
PPvoid = JudyLIns (PPArray, Index, PJE0);
|
||||
myint = JudyLInsArray (PPArray, Index, &Index, &Index, PJE0);
|
||||
myint = JudyLDel (PPArray, Index, PJE0);
|
||||
myword = JudyLCount ( PArray, Index, Index, PJE0);
|
||||
PPvoid = JudyLByCount ( PArray, Index, PIndex, PJE0);
|
||||
myword = JudyLFreeArray (PPArray, PJE0);
|
||||
myword = JudyLMemUsed ( PArray );
|
||||
myword = JudyLMemActive ( PArray );
|
||||
PPvoid = JudyLFirst ( PArray, PIndex, PJE0);
|
||||
PPvoid = JudyLNext ( PArray, PIndex, PJE0);
|
||||
PPvoid = JudyLLast ( PArray, PIndex, PJE0);
|
||||
PPvoid = JudyLPrev ( PArray, PIndex, PJE0);
|
||||
myint = JudyLFirstEmpty ( PArray, PIndex, PJE0);
|
||||
myint = JudyLNextEmpty ( PArray, PIndex, PJE0);
|
||||
myint = JudyLLastEmpty ( PArray, PIndex, PJE0);
|
||||
myint = JudyLPrevEmpty ( PArray, PIndex, PJE0);
|
||||
|
||||
PPvoid = JudySLGet ( PArray, CIndex, PJE0);
|
||||
PPvoid = JudySLIns (PPArray, CIndex, PJE0);
|
||||
myint = JudySLDel (PPArray, CIndex, PJE0);
|
||||
myword = JudySLFreeArray (PPArray, PJE0);
|
||||
PPvoid = JudySLFirst ( PArray, CIndex, PJE0);
|
||||
PPvoid = JudySLNext ( PArray, CIndex, PJE0);
|
||||
PPvoid = JudySLLast ( PArray, CIndex, PJE0);
|
||||
PPvoid = JudySLPrev ( PArray, CIndex, PJE0);
|
||||
|
||||
PPvoid = JudyHSGet ( PArray, CIndex, Length);
|
||||
PPvoid = JudyHSIns (PPArray, CIndex, Length, PJE0);
|
||||
myint = JudyHSDel (PPArray, CIndex, Length, PJE0);
|
||||
|
||||
|
||||
// MACRO EQUIVALENTS:
|
||||
|
||||
J1T (myint, PArray, Index);
|
||||
J1S (myint, PArray, Index);
|
||||
J1SA (myint, PArray, Index, &Index);
|
||||
J1U (myint, PArray, Index);
|
||||
J1F (myint, PArray, Index);
|
||||
J1N (myint, PArray, Index);
|
||||
J1L (myint, PArray, Index);
|
||||
J1P (myint, PArray, Index);
|
||||
J1FE (myint, PArray, Index);
|
||||
J1NE (myint, PArray, Index);
|
||||
J1LE (myint, PArray, Index);
|
||||
J1PE (myint, PArray, Index);
|
||||
J1C (myword, PArray, Index, Index);
|
||||
J1BC (myint, PArray, Index, Index);
|
||||
J1FA (myword, PArray);
|
||||
|
||||
JLG (PPvoid, PArray, Index);
|
||||
JLI (PPvoid, PArray, Index);
|
||||
JLIA (myint, PArray, Index, &Index, &Index);
|
||||
JLD (myint, PArray, Index);
|
||||
JLF (PPvoid, PArray, Index);
|
||||
JLN (PPvoid, PArray, Index);
|
||||
JLL (PPvoid, PArray, Index);
|
||||
JLP (PPvoid, PArray, Index);
|
||||
JLFE (myint, PArray, Index);
|
||||
JLNE (myint, PArray, Index);
|
||||
JLLE (myint, PArray, Index);
|
||||
JLPE (myint, PArray, Index);
|
||||
JLC (myword, PArray, Index, Index);
|
||||
JLBC (PPvoid, PArray, myword, Index);
|
||||
JLFA (myword, PArray);
|
||||
|
||||
JSLG (PPvoid, PArray, CIndex);
|
||||
JSLI (PPvoid, PArray, CIndex);
|
||||
JSLD (myint, PArray, CIndex);
|
||||
JSLF (PPvoid, PArray, CIndex);
|
||||
JSLN (PPvoid, PArray, CIndex);
|
||||
JSLL (PPvoid, PArray, CIndex);
|
||||
JSLP (PPvoid, PArray, CIndex);
|
||||
JSLFA (myword, PArray);
|
||||
|
||||
JHSI (PPvoid, PArray, CIndex, Length);
|
||||
JHSG (PPvoid, PArray, CIndex, Length);
|
||||
JHSD (myint, PArray, CIndex, Length);
|
||||
|
||||
return(0);
|
||||
|
||||
} // main()
|
BIN
dlls/arrayx/Judy-1.0.1/src/Judy.lib
Normal file
BIN
dlls/arrayx/Judy-1.0.1/src/Judy.lib
Normal file
Binary file not shown.
551
dlls/arrayx/Judy-1.0.1/src/Judy1/Judy1.h
Normal file
551
dlls/arrayx/Judy-1.0.1/src/Judy1/Judy1.h
Normal file
|
@ -0,0 +1,551 @@
|
|||
#ifndef _JUDY1_INCLUDED
|
||||
#define _JUDY1_INCLUDED
|
||||
// _________________
|
||||
//
|
||||
// Copyright (C) 2000 - 2002 Hewlett-Packard Company
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify it
|
||||
// under the term of the GNU Lesser General Public License as published by the
|
||||
// Free Software Foundation; either version 2 of the License, or (at your
|
||||
// option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
// for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with this program; if not, write to the Free Software Foundation,
|
||||
// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
// _________________
|
||||
|
||||
// @(#) $Revision$ $Source$
|
||||
|
||||
// ****************************************************************************
|
||||
// JUDY1 -- SMALL/LARGE AND/OR CLUSTERED/SPARSE BIT ARRAYS
|
||||
//
|
||||
// -by-
|
||||
//
|
||||
// Douglas L. Baskins
|
||||
// doug@sourcejudy.com
|
||||
//
|
||||
// Judy arrays are designed to be used instead of arrays. The performance
|
||||
// suggests the reason why Judy arrays are thought of as arrays, instead of
|
||||
// trees. They are remarkably memory efficient at all populations.
|
||||
// Implemented as a hybrid digital tree (but really a state machine, see
|
||||
// below), Judy arrays feature fast insert/retrievals, fast near neighbor
|
||||
// searching, and contain a population tree for extremely fast ordinal related
|
||||
// retrievals.
|
||||
//
|
||||
// CONVENTIONS:
|
||||
//
|
||||
// - The comments here refer to 32-bit [64-bit] systems.
|
||||
//
|
||||
// - BranchL, LeafL refer to linear branches and leaves (small populations),
|
||||
// except LeafL does not actually appear as such; rather, Leaf1..3 [Leaf1..7]
|
||||
// is used to represent leaf Index sizes, and LeafW refers to a Leaf with
|
||||
// full (long) word Indexes, which is also a type of linear leaf. Note that
|
||||
// root-level LeafW (Leaf4 [Leaf8]) leaves are also called LEAFW.
|
||||
//
|
||||
// - BranchB, LeafB1 refer to bitmap branches and leaves (intermediate
|
||||
// populations).
|
||||
//
|
||||
// - BranchU refers to uncompressed branches. An uncompressed branch has 256
|
||||
// JPs, some of which could be null. Note: All leaves are compressed (and
|
||||
// sorted), or else an expanse is full (FullPopu), so there is no LeafU
|
||||
// equivalent to BranchU.
|
||||
//
|
||||
// - "Popu" is short for "Population".
|
||||
// - "Pop1" refers to actual population (base 1).
|
||||
// - "Pop0" refers to Pop1 - 1 (base 0), the way populations are stored in data
|
||||
// structures.
|
||||
//
|
||||
// - Branches and Leaves are both named by the number of bytes in their Pop0
|
||||
// field. In the case of Leaves, the same number applies to the Index sizes.
|
||||
//
|
||||
// - The representation of many numbers as hex is a relatively safe and
|
||||
// portable way to get desired bitpatterns as unsigned longs.
|
||||
//
|
||||
// - Some preprocessors cant handle single apostrophe characters within
|
||||
// #ifndef code, so here, use delete all instead.
|
||||
|
||||
#include "JudyPrivate.h" // includes Judy.h in turn.
|
||||
#include "JudyPrivateBranch.h"
|
||||
|
||||
|
||||
// ****************************************************************************
|
||||
// JUDY1 ROOT POINTER (JRP) AND JUDY1 POINTER (JP) TYPE FIELDS
|
||||
// ****************************************************************************
|
||||
//
|
||||
// The following enum lists all possible JP Type fields.
|
||||
|
||||
typedef enum // uint8_t -- but C does not support this type of enum.
|
||||
{
|
||||
|
||||
// JP NULL TYPES:
|
||||
//
|
||||
// There is a series of cJ1_JPNULL* Types because each one pre-records a
|
||||
// different Index Size for when the first Index is inserted in the previously
|
||||
// null JP. They must start >= 8 (three bits).
|
||||
//
|
||||
// Note: These Types must be in sequential order for doing relative
|
||||
// calculations between them.
|
||||
|
||||
cJ1_JPNULL1 = 1,
|
||||
// Index Size 1[1] byte when 1 Index inserted.
|
||||
cJ1_JPNULL2, // Index Size 2[2] bytes when 1 Index inserted.
|
||||
cJ1_JPNULL3, // Index Size 3[3] bytes when 1 Index inserted.
|
||||
|
||||
#ifndef JU_64BIT
|
||||
#define cJ1_JPNULLMAX cJ1_JPNULL3
|
||||
#else
|
||||
cJ1_JPNULL4, // Index Size 4[4] bytes when 1 Index inserted.
|
||||
cJ1_JPNULL5, // Index Size 5[5] bytes when 1 Index inserted.
|
||||
cJ1_JPNULL6, // Index Size 6[6] bytes when 1 Index inserted.
|
||||
cJ1_JPNULL7, // Index Size 7[7] bytes when 1 Index inserted.
|
||||
#define cJ1_JPNULLMAX cJ1_JPNULL7
|
||||
#endif
|
||||
|
||||
|
||||
// JP BRANCH TYPES:
|
||||
//
|
||||
// Note: There are no state-1 branches; only leaves reside at state 1.
|
||||
|
||||
// Linear branches:
|
||||
//
|
||||
// Note: These Types must be in sequential order for doing relative
|
||||
// calculations between them.
|
||||
|
||||
cJ1_JPBRANCH_L2, // 2[2] bytes Pop0, 1[5] bytes Dcd.
|
||||
cJ1_JPBRANCH_L3, // 3[3] bytes Pop0, 0[4] bytes Dcd.
|
||||
|
||||
#ifdef JU_64BIT
|
||||
cJ1_JPBRANCH_L4, // [4] bytes Pop0, [3] bytes Dcd.
|
||||
cJ1_JPBRANCH_L5, // [5] bytes Pop0, [2] bytes Dcd.
|
||||
cJ1_JPBRANCH_L6, // [6] bytes Pop0, [1] byte Dcd.
|
||||
cJ1_JPBRANCH_L7, // [7] bytes Pop0, [0] bytes Dcd.
|
||||
#endif
|
||||
|
||||
cJ1_JPBRANCH_L, // note: DcdPopO field not used.
|
||||
|
||||
// Bitmap branches:
|
||||
//
|
||||
// Note: These Types must be in sequential order for doing relative
|
||||
// calculations between them.
|
||||
|
||||
cJ1_JPBRANCH_B2, // 2[2] bytes Pop0, 1[5] bytes Dcd.
|
||||
cJ1_JPBRANCH_B3, // 3[3] bytes Pop0, 0[4] bytes Dcd.
|
||||
|
||||
#ifdef JU_64BIT
|
||||
cJ1_JPBRANCH_B4, // [4] bytes Pop0, [3] bytes Dcd.
|
||||
cJ1_JPBRANCH_B5, // [5] bytes Pop0, [2] bytes Dcd.
|
||||
cJ1_JPBRANCH_B6, // [6] bytes Pop0, [1] byte Dcd.
|
||||
cJ1_JPBRANCH_B7, // [7] bytes Pop0, [0] bytes Dcd.
|
||||
#endif
|
||||
|
||||
cJ1_JPBRANCH_B, // note: DcdPopO field not used.
|
||||
|
||||
// Uncompressed branches:
|
||||
//
|
||||
// Note: These Types must be in sequential order for doing relative
|
||||
// calculations between them.
|
||||
|
||||
cJ1_JPBRANCH_U2, // 2[2] bytes Pop0, 1[5] bytes Dcd.
|
||||
cJ1_JPBRANCH_U3, // 3[3] bytes Pop0, 0[4] bytes Dcd.
|
||||
|
||||
#ifdef JU_64BIT
|
||||
cJ1_JPBRANCH_U4, // [4] bytes Pop0, [3] bytes Dcd.
|
||||
cJ1_JPBRANCH_U5, // [5] bytes Pop0, [2] bytes Dcd.
|
||||
cJ1_JPBRANCH_U6, // [6] bytes Pop0, [1] byte Dcd.
|
||||
cJ1_JPBRANCH_U7, // [7] bytes Pop0, [0] bytes Dcd.
|
||||
#endif
|
||||
|
||||
cJ1_JPBRANCH_U, // note: DcdPopO field not used.
|
||||
|
||||
|
||||
// JP LEAF TYPES:
|
||||
|
||||
// Linear leaves:
|
||||
//
|
||||
// Note: These Types must be in sequential order for doing relative
|
||||
// calculations between them.
|
||||
//
|
||||
// Note: There is no cJ1_JPLEAF1 for 64-bit for a subtle reason. An immediate
|
||||
// JP can hold 15 1-byte Indexes, and a bitmap leaf would be used for 17
|
||||
// Indexes, so rather than support a linear leaf for only the case of exactly
|
||||
// 16 Indexes, a bitmap leaf is used in that case. See also below regarding
|
||||
// cJ1_LEAF1_MAXPOP1 on 64-bit systems.
|
||||
//
|
||||
// Note: There is no full-word (4-byte [8-byte]) Index leaf under a JP because
|
||||
// non-root-state leaves only occur under branches that decode at least one
|
||||
// byte. Full-word, root-state leaves are under a JRP, not a JP. However, in
|
||||
// the code a "fake" JP can be created temporarily above a root-state leaf.
|
||||
|
||||
#ifndef JU_64BIT // 32-bit only; see above.
|
||||
cJ1_JPLEAF1, // 1 byte Pop0, 2 bytes Dcd.
|
||||
#endif
|
||||
|
||||
cJ1_JPLEAF2, // 2[2] bytes Pop0, 1[5] bytes Dcd.
|
||||
cJ1_JPLEAF3, // 3[3] bytes Pop0, 0[4] bytes Dcd.
|
||||
|
||||
#ifdef JU_64BIT
|
||||
cJ1_JPLEAF4, // [4] bytes Pop0, [3] bytes Dcd.
|
||||
cJ1_JPLEAF5, // [5] bytes Pop0, [2] bytes Dcd.
|
||||
cJ1_JPLEAF6, // [6] bytes Pop0, [1] byte Dcd.
|
||||
cJ1_JPLEAF7, // [7] bytes Pop0, [0] bytes Dcd.
|
||||
#endif
|
||||
|
||||
// Bitmap leaf; Index Size == 1:
|
||||
//
|
||||
// Note: These are currently only supported at state 1. At other states the
|
||||
// bitmap would grow from 256 to 256^2, 256^3, ... bits, which would not be
|
||||
// efficient..
|
||||
|
||||
cJ1_JPLEAF_B1, // 1[1] byte Pop0, 2[6] bytes Dcd.
|
||||
|
||||
|
||||
// Full population; Index Size == 1 virtual leaf:
|
||||
//
|
||||
// Note: These are currently only supported at state 1. At other states they
|
||||
// could be used, but they would be rare and the savings are dubious.
|
||||
|
||||
cJ1_JPFULLPOPU1, // 1[1] byte Pop0, 2[6] bytes Dcd.
|
||||
|
||||
#ifdef notdef // for future enhancements
|
||||
cJ1_JPFULLPOPU1m1, // Full Population - 1
|
||||
cJ1_JPFULLPOPU1m2, // Full Population - 2
|
||||
cJ1_JPFULLPOPU1m3, // Full Population - 3
|
||||
cJ1_JPFULLPOPU1m4, // Full Population - 4
|
||||
cJ1_JPFULLPOPU1m5, // Full Population - 5
|
||||
cJ1_JPFULLPOPU1m6, // Full Population - 6
|
||||
cJ1_JPFULLPOPU1m7, // Full Population - 7
|
||||
|
||||
#ifdef JU_64BIT
|
||||
cJ1_JPFULLPOPU1m8, // Full Population - 8
|
||||
cJ1_JPFULLPOPU1m9, // Full Population - 9
|
||||
cJ1_JPFULLPOPU1m10, // Full Population - 10
|
||||
cJ1_JPFULLPOPU1m11, // Full Population - 11
|
||||
cJ1_JPFULLPOPU1m12, // Full Population - 12
|
||||
cJ1_JPFULLPOPU1m13, // Full Population - 13
|
||||
cJ1_JPFULLPOPU1m14, // Full Population - 14
|
||||
cJ1_JPFULLPOPU1m15, // Full Population - 15
|
||||
#endif
|
||||
#endif // notdef -- for future enhancements
|
||||
|
||||
|
||||
// JP IMMEDIATES; leaves (Indexes) stored inside a JP:
|
||||
//
|
||||
// The second numeric suffix is the Pop1 for each type. As the Index Size
|
||||
// increases, the maximum possible population decreases.
|
||||
//
|
||||
// Note: These Types must be in sequential order in each group (Index Size),
|
||||
// and the groups in correct order too, for doing relative calculations between
|
||||
// them. For example, since these Types enumerate the Pop1 values (unlike
|
||||
// other JP Types where there is a Pop0 value in the JP), the maximum Pop1 for
|
||||
// each Index Size is computable.
|
||||
|
||||
cJ1_JPIMMED_1_01, // Index Size = 1, Pop1 = 1.
|
||||
cJ1_JPIMMED_2_01, // Index Size = 2, Pop1 = 1.
|
||||
cJ1_JPIMMED_3_01, // Index Size = 3, Pop1 = 1.
|
||||
#ifdef JU_64BIT
|
||||
cJ1_JPIMMED_4_01, // Index Size = 4, Pop1 = 1.
|
||||
cJ1_JPIMMED_5_01, // Index Size = 5, Pop1 = 1.
|
||||
cJ1_JPIMMED_6_01, // Index Size = 6, Pop1 = 1.
|
||||
cJ1_JPIMMED_7_01, // Index Size = 7, Pop1 = 1.
|
||||
#endif
|
||||
|
||||
cJ1_JPIMMED_1_02, // Index Size = 1, Pop1 = 2.
|
||||
cJ1_JPIMMED_1_03, // Index Size = 1, Pop1 = 3.
|
||||
cJ1_JPIMMED_1_04, // Index Size = 1, Pop1 = 4.
|
||||
cJ1_JPIMMED_1_05, // Index Size = 1, Pop1 = 5.
|
||||
cJ1_JPIMMED_1_06, // Index Size = 1, Pop1 = 6.
|
||||
cJ1_JPIMMED_1_07, // Index Size = 1, Pop1 = 7.
|
||||
|
||||
#ifdef JU_64BIT
|
||||
cJ1_JPIMMED_1_08, // Index Size = 1, Pop1 = 8.
|
||||
cJ1_JPIMMED_1_09, // Index Size = 1, Pop1 = 9.
|
||||
cJ1_JPIMMED_1_10, // Index Size = 1, Pop1 = 10.
|
||||
cJ1_JPIMMED_1_11, // Index Size = 1, Pop1 = 11.
|
||||
cJ1_JPIMMED_1_12, // Index Size = 1, Pop1 = 12.
|
||||
cJ1_JPIMMED_1_13, // Index Size = 1, Pop1 = 13.
|
||||
cJ1_JPIMMED_1_14, // Index Size = 1, Pop1 = 14.
|
||||
cJ1_JPIMMED_1_15, // Index Size = 1, Pop1 = 15.
|
||||
#endif
|
||||
|
||||
cJ1_JPIMMED_2_02, // Index Size = 2, Pop1 = 2.
|
||||
cJ1_JPIMMED_2_03, // Index Size = 2, Pop1 = 3.
|
||||
|
||||
#ifdef JU_64BIT
|
||||
cJ1_JPIMMED_2_04, // Index Size = 2, Pop1 = 4.
|
||||
cJ1_JPIMMED_2_05, // Index Size = 2, Pop1 = 5.
|
||||
cJ1_JPIMMED_2_06, // Index Size = 2, Pop1 = 6.
|
||||
cJ1_JPIMMED_2_07, // Index Size = 2, Pop1 = 7.
|
||||
#endif
|
||||
|
||||
cJ1_JPIMMED_3_02, // Index Size = 3, Pop1 = 2.
|
||||
|
||||
#ifdef JU_64BIT
|
||||
cJ1_JPIMMED_3_03, // Index Size = 3, Pop1 = 3.
|
||||
cJ1_JPIMMED_3_04, // Index Size = 3, Pop1 = 4.
|
||||
cJ1_JPIMMED_3_05, // Index Size = 3, Pop1 = 5.
|
||||
|
||||
cJ1_JPIMMED_4_02, // Index Size = 4, Pop1 = 2.
|
||||
cJ1_JPIMMED_4_03, // Index Size = 4, Pop1 = 3.
|
||||
|
||||
cJ1_JPIMMED_5_02, // Index Size = 5, Pop1 = 2.
|
||||
cJ1_JPIMMED_5_03, // Index Size = 3, Pop1 = 3.
|
||||
|
||||
cJ1_JPIMMED_6_02, // Index Size = 6, Pop1 = 2.
|
||||
|
||||
cJ1_JPIMMED_7_02, // Index Size = 7, Pop1 = 2.
|
||||
#endif
|
||||
|
||||
// This special Type is merely a sentinel for doing relative calculations.
|
||||
// This value should not be used in switch statements (to avoid allocating code
|
||||
// for it), which is also why it appears at the end of the enum list.
|
||||
|
||||
cJ1_JPIMMED_CAP
|
||||
|
||||
} jp1_Type_t;
|
||||
|
||||
|
||||
// RELATED VALUES:
|
||||
//
|
||||
// Index Size (state) for leaf JP, and JP type based on Index Size (state):
|
||||
|
||||
#ifndef JU_64BIT // 32-bit
|
||||
#define J1_LEAFINDEXSIZE(jpType) ((jpType) - cJ1_JPLEAF1 + 1)
|
||||
#define J1_LEAFTYPE(IndexSize) ((IndexSize) + cJ1_JPLEAF1 - 1)
|
||||
#else
|
||||
#define J1_LEAFINDEXSIZE(jpType) ((jpType) - cJ1_JPLEAF2 + 2)
|
||||
#define J1_LEAFTYPE(IndexSize) ((IndexSize) + cJ1_JPLEAF2 - 2)
|
||||
#endif
|
||||
|
||||
|
||||
// ****************************************************************************
|
||||
// JUDY1 POINTER (JP) -- RELATED MACROS AND CONSTANTS
|
||||
// ****************************************************************************
|
||||
|
||||
// MAXIMUM POPULATIONS OF LINEAR LEAVES:
|
||||
//
|
||||
// Allow up to 2 cache lines per leaf, with N bytes per index.
|
||||
//
|
||||
// J_1_MAXB is the maximum number of bytes (sort of) to allocate per leaf.
|
||||
// ALLOCSIZES is defined here, not there, for single-point control of these key
|
||||
// definitions. See JudyTables.c for "TERMINATOR".
|
||||
|
||||
#define J_1_MAXB (sizeof(Word_t) * 32)
|
||||
#define ALLOCSIZES { 3, 5, 7, 11, 15, 23, 32, 47, 64, TERMINATOR } // in words.
|
||||
#define cJ1_LEAF1_MAXWORDS 5 // Leaf1 max alloc size in words.
|
||||
|
||||
// Under JRP (root-state leaves):
|
||||
//
|
||||
// Includes a count (Population) word.
|
||||
//
|
||||
// Under JP (non-root-state leaves), which have no count (Population) words:
|
||||
//
|
||||
// When a 1-byte index leaf grows above cJ1_LEAF1_MAXPOP1 Indexes (bytes),
|
||||
// the memory chunk required grows to a size where a bitmap is just as
|
||||
// efficient, so use a bitmap instead for all greater Populations, on both
|
||||
// 32-bit and 64-bit systems. However, on a 32-bit system this occurs upon
|
||||
// going from 6 to 8 words (24 to 32 bytes) in the memory chunk, but on a
|
||||
// 64-bit system this occurs upon going from 2 to 4 words (16 to 32 bytes). It
|
||||
// would be silly to go from a 15-Index Immediate JP to a 16-Index linear leaf
|
||||
// to a 17-Index bitmap leaf, so just use a bitmap leaf for 16+ Indexes, which
|
||||
// means set cJ1_LEAF1_MAXPOP1 to cJ1_IMMED1_MAXPOP1 (15) to cause the
|
||||
// transition at that point.
|
||||
//
|
||||
// Note: cJ1_LEAF1_MAXPOP1 is not used on 64-bit systems.
|
||||
|
||||
#ifndef JU_64BIT // 32-bit
|
||||
|
||||
#define cJ1_LEAF1_MAXPOP1 (cJ1_LEAF1_MAXWORDS * cJU_BYTESPERWORD)
|
||||
#define cJ1_LEAF2_MAXPOP1 (J_1_MAXB / 2)
|
||||
#define cJ1_LEAF3_MAXPOP1 (J_1_MAXB / 3)
|
||||
#define cJ1_LEAFW_MAXPOP1 ((J_1_MAXB - cJU_BYTESPERWORD) / cJU_BYTESPERWORD)
|
||||
|
||||
#else // 64-bit
|
||||
|
||||
// #define cJ1_LEAF1_MAXPOP1 // no LEAF1 in 64-bit.
|
||||
#define cJ1_LEAF2_MAXPOP1 (J_1_MAXB / 2)
|
||||
#define cJ1_LEAF3_MAXPOP1 (J_1_MAXB / 3)
|
||||
#define cJ1_LEAF4_MAXPOP1 (J_1_MAXB / 4)
|
||||
#define cJ1_LEAF5_MAXPOP1 (J_1_MAXB / 5)
|
||||
#define cJ1_LEAF6_MAXPOP1 (J_1_MAXB / 6)
|
||||
#define cJ1_LEAF7_MAXPOP1 (J_1_MAXB / 7)
|
||||
#define cJ1_LEAFW_MAXPOP1 ((J_1_MAXB - cJU_BYTESPERWORD) / cJU_BYTESPERWORD)
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
// MAXIMUM POPULATIONS OF IMMEDIATE JPs:
|
||||
//
|
||||
// These specify the maximum Population of immediate JPs with various Index
|
||||
// Sizes (== sizes of remaining undecoded Index bits).
|
||||
|
||||
#define cJ1_IMMED1_MAXPOP1 ((sizeof(jp_t) - 1) / 1) // 7 [15].
|
||||
#define cJ1_IMMED2_MAXPOP1 ((sizeof(jp_t) - 1) / 2) // 3 [7].
|
||||
#define cJ1_IMMED3_MAXPOP1 ((sizeof(jp_t) - 1) / 3) // 2 [5].
|
||||
|
||||
#ifdef JU_64BIT
|
||||
#define cJ1_IMMED4_MAXPOP1 ((sizeof(jp_t) - 1) / 4) // [3].
|
||||
#define cJ1_IMMED5_MAXPOP1 ((sizeof(jp_t) - 1) / 5) // [3].
|
||||
#define cJ1_IMMED6_MAXPOP1 ((sizeof(jp_t) - 1) / 6) // [2].
|
||||
#define cJ1_IMMED7_MAXPOP1 ((sizeof(jp_t) - 1) / 7) // [2].
|
||||
#endif
|
||||
|
||||
|
||||
// ****************************************************************************
|
||||
// JUDY1 BITMAP LEAF (J1LB) SUPPORT
|
||||
// ****************************************************************************
|
||||
|
||||
#define J1_JLB_BITMAP(Pjlb,Subexp) ((Pjlb)->j1lb_Bitmap[Subexp])
|
||||
|
||||
typedef struct J__UDY1_BITMAP_LEAF
|
||||
{
|
||||
BITMAPL_t j1lb_Bitmap[cJU_NUMSUBEXPL];
|
||||
|
||||
} j1lb_t, * Pj1lb_t;
|
||||
|
||||
|
||||
// ****************************************************************************
|
||||
// MEMORY ALLOCATION SUPPORT
|
||||
// ****************************************************************************
|
||||
|
||||
// ARRAY-GLOBAL INFORMATION:
|
||||
//
|
||||
// At the cost of an occasional additional cache fill, this object, which is
|
||||
// pointed at by a JRP and in turn points to a JP_BRANCH*, carries array-global
|
||||
// information about a Judy1 array that has sufficient population to amortize
|
||||
// the cost. The jpm_Pop0 field prevents having to add up the total population
|
||||
// for the array in insert, delete, and count code. The jpm_JP field prevents
|
||||
// having to build a fake JP for entry to a state machine; however, the
|
||||
// jp_DcdPopO field in jpm_JP, being one byte too small, is not used.
|
||||
//
|
||||
// Note: Struct fields are ordered to keep "hot" data in the first 8 words
|
||||
// (see left-margin comments) for machines with 8-word cache lines, and to keep
|
||||
// sub-word fields together for efficient packing.
|
||||
|
||||
typedef struct J_UDY1_POPULATION_AND_MEMORY
|
||||
{
|
||||
/* 1 */ Word_t jpm_Pop0; // total population-1 in array.
|
||||
/* 2 */ jp_t jpm_JP; // JP to first branch; see above.
|
||||
/* 4 */ Word_t jpm_LastUPop0; // last jpm_Pop0 when convert to BranchU
|
||||
// Note: Field names match PJError_t for convenience in macros:
|
||||
/* 7 */ char je_Errno; // one of the enums in Judy.h.
|
||||
/* 7/8 */ int je_ErrID; // often an internal source line number.
|
||||
/* 8/9 */ Word_t jpm_TotalMemWords; // words allocated in array.
|
||||
} j1pm_t, *Pj1pm_t;
|
||||
|
||||
|
||||
// TABLES FOR DETERMINING IF LEAVES HAVE ROOM TO GROW:
|
||||
//
|
||||
// These tables indicate if a given memory chunk can support growth of a given
|
||||
// object into wasted (rounded-up) memory in the chunk. This violates the
|
||||
// hiddenness of the JudyMalloc code.
|
||||
//
|
||||
// Also define macros to hide the details in the code using these tables.
|
||||
|
||||
#ifndef JU_64BIT
|
||||
extern const uint8_t j__1_Leaf1PopToWords[cJ1_LEAF1_MAXPOP1 + 1];
|
||||
#endif
|
||||
extern const uint8_t j__1_Leaf2PopToWords[cJ1_LEAF2_MAXPOP1 + 1];
|
||||
extern const uint8_t j__1_Leaf3PopToWords[cJ1_LEAF3_MAXPOP1 + 1];
|
||||
#ifdef JU_64BIT
|
||||
extern const uint8_t j__1_Leaf4PopToWords[cJ1_LEAF4_MAXPOP1 + 1];
|
||||
extern const uint8_t j__1_Leaf5PopToWords[cJ1_LEAF5_MAXPOP1 + 1];
|
||||
extern const uint8_t j__1_Leaf6PopToWords[cJ1_LEAF6_MAXPOP1 + 1];
|
||||
extern const uint8_t j__1_Leaf7PopToWords[cJ1_LEAF7_MAXPOP1 + 1];
|
||||
#endif
|
||||
extern const uint8_t j__1_LeafWPopToWords[cJ1_LEAFW_MAXPOP1 + 1];
|
||||
|
||||
// Check if increase of population will fit in same leaf:
|
||||
|
||||
#ifndef JU_64BIT
|
||||
#define J1_LEAF1GROWINPLACE(Pop1) \
|
||||
J__U_GROWCK(Pop1, cJ1_LEAF1_MAXPOP1, j__1_Leaf1PopToWords)
|
||||
#endif
|
||||
#define J1_LEAF2GROWINPLACE(Pop1) \
|
||||
J__U_GROWCK(Pop1, cJ1_LEAF2_MAXPOP1, j__1_Leaf2PopToWords)
|
||||
#define J1_LEAF3GROWINPLACE(Pop1) \
|
||||
J__U_GROWCK(Pop1, cJ1_LEAF3_MAXPOP1, j__1_Leaf3PopToWords)
|
||||
#ifdef JU_64BIT
|
||||
#define J1_LEAF4GROWINPLACE(Pop1) \
|
||||
J__U_GROWCK(Pop1, cJ1_LEAF4_MAXPOP1, j__1_Leaf4PopToWords)
|
||||
#define J1_LEAF5GROWINPLACE(Pop1) \
|
||||
J__U_GROWCK(Pop1, cJ1_LEAF5_MAXPOP1, j__1_Leaf5PopToWords)
|
||||
#define J1_LEAF6GROWINPLACE(Pop1) \
|
||||
J__U_GROWCK(Pop1, cJ1_LEAF6_MAXPOP1, j__1_Leaf6PopToWords)
|
||||
#define J1_LEAF7GROWINPLACE(Pop1) \
|
||||
J__U_GROWCK(Pop1, cJ1_LEAF7_MAXPOP1, j__1_Leaf7PopToWords)
|
||||
#endif
|
||||
#define J1_LEAFWGROWINPLACE(Pop1) \
|
||||
J__U_GROWCK(Pop1, cJ1_LEAFW_MAXPOP1, j__1_LeafWPopToWords)
|
||||
|
||||
#ifndef JU_64BIT
|
||||
#define J1_LEAF1POPTOWORDS(Pop1) (j__1_Leaf1PopToWords[Pop1])
|
||||
#endif
|
||||
#define J1_LEAF2POPTOWORDS(Pop1) (j__1_Leaf2PopToWords[Pop1])
|
||||
#define J1_LEAF3POPTOWORDS(Pop1) (j__1_Leaf3PopToWords[Pop1])
|
||||
#ifdef JU_64BIT
|
||||
#define J1_LEAF4POPTOWORDS(Pop1) (j__1_Leaf4PopToWords[Pop1])
|
||||
#define J1_LEAF5POPTOWORDS(Pop1) (j__1_Leaf5PopToWords[Pop1])
|
||||
#define J1_LEAF6POPTOWORDS(Pop1) (j__1_Leaf6PopToWords[Pop1])
|
||||
#define J1_LEAF7POPTOWORDS(Pop1) (j__1_Leaf7PopToWords[Pop1])
|
||||
#endif
|
||||
#define J1_LEAFWPOPTOWORDS(Pop1) (j__1_LeafWPopToWords[Pop1])
|
||||
|
||||
|
||||
// FUNCTIONS TO ALLOCATE OBJECTS:
|
||||
|
||||
Pj1pm_t j__udy1AllocJ1PM(void); // constant size.
|
||||
|
||||
Pjbl_t j__udy1AllocJBL( Pj1pm_t); // constant size.
|
||||
Pjbb_t j__udy1AllocJBB( Pj1pm_t); // constant size.
|
||||
Pjp_t j__udy1AllocJBBJP(Word_t, Pj1pm_t);
|
||||
Pjbu_t j__udy1AllocJBU( Pj1pm_t); // constant size.
|
||||
|
||||
#ifndef JU_64BIT
|
||||
Pjll_t j__udy1AllocJLL1( Word_t, Pj1pm_t);
|
||||
#endif
|
||||
Pjll_t j__udy1AllocJLL2( Word_t, Pj1pm_t);
|
||||
Pjll_t j__udy1AllocJLL3( Word_t, Pj1pm_t);
|
||||
|
||||
#ifdef JU_64BIT
|
||||
Pjll_t j__udy1AllocJLL4( Word_t, Pj1pm_t);
|
||||
Pjll_t j__udy1AllocJLL5( Word_t, Pj1pm_t);
|
||||
Pjll_t j__udy1AllocJLL6( Word_t, Pj1pm_t);
|
||||
Pjll_t j__udy1AllocJLL7( Word_t, Pj1pm_t);
|
||||
#endif
|
||||
|
||||
Pjlw_t j__udy1AllocJLW( Word_t ); // no Pj1pm needed.
|
||||
Pj1lb_t j__udy1AllocJLB1( Pj1pm_t); // constant size.
|
||||
|
||||
|
||||
// FUNCTIONS TO FREE OBJECTS:
|
||||
|
||||
void j__udy1FreeJ1PM( Pj1pm_t, Pj1pm_t); // constant size.
|
||||
|
||||
void j__udy1FreeJBL( Pjbl_t, Pj1pm_t); // constant size.
|
||||
void j__udy1FreeJBB( Pjbb_t, Pj1pm_t); // constant size.
|
||||
void j__udy1FreeJBBJP(Pjp_t, Word_t, Pj1pm_t);
|
||||
void j__udy1FreeJBU( Pjbu_t, Pj1pm_t); // constant size.
|
||||
|
||||
#ifndef JU_64BIT
|
||||
void j__udy1FreeJLL1( Pjll_t, Word_t, Pj1pm_t);
|
||||
#endif
|
||||
void j__udy1FreeJLL2( Pjll_t, Word_t, Pj1pm_t);
|
||||
void j__udy1FreeJLL3( Pjll_t, Word_t, Pj1pm_t);
|
||||
|
||||
#ifdef JU_64BIT
|
||||
void j__udy1FreeJLL4( Pjll_t, Word_t, Pj1pm_t);
|
||||
void j__udy1FreeJLL5( Pjll_t, Word_t, Pj1pm_t);
|
||||
void j__udy1FreeJLL6( Pjll_t, Word_t, Pj1pm_t);
|
||||
void j__udy1FreeJLL7( Pjll_t, Word_t, Pj1pm_t);
|
||||
#endif
|
||||
|
||||
void j__udy1FreeJLW( Pjlw_t, Word_t, Pj1pm_t);
|
||||
void j__udy1FreeJLB1( Pj1lb_t, Pj1pm_t); // constant size.
|
||||
void j__udy1FreeSM( Pjp_t, Pj1pm_t); // everything below Pjp.
|
||||
|
||||
#endif // ! _JUDY1_INCLUDED
|
954
dlls/arrayx/Judy-1.0.1/src/Judy1/Judy1ByCount.c
Normal file
954
dlls/arrayx/Judy-1.0.1/src/Judy1/Judy1ByCount.c
Normal file
|
@ -0,0 +1,954 @@
|
|||
// Copyright (C) 2000 - 2002 Hewlett-Packard Company
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify it
|
||||
// under the term of the GNU Lesser General Public License as published by the
|
||||
// Free Software Foundation; either version 2 of the License, or (at your
|
||||
// option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
// for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with this program; if not, write to the Free Software Foundation,
|
||||
// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
// _________________
|
||||
|
||||
// @(#) $Revision$ $Source$
|
||||
//
|
||||
// Judy*ByCount() function for Judy1 and JudyL.
|
||||
// Compile with one of -DJUDY1 or -DJUDYL.
|
||||
//
|
||||
// Compile with -DNOSMARTJBB, -DNOSMARTJBU, and/or -DNOSMARTJLB to build a
|
||||
// version with cache line optimizations deleted, for testing.
|
||||
//
|
||||
// Judy*ByCount() is a conceptual although not literal inverse of Judy*Count().
|
||||
// Judy*Count() takes a pair of Indexes, and allows finding the ordinal of a
|
||||
// given Index (that is, its position in the list of valid indexes from the
|
||||
// beginning) as a degenerate case, because in general the count between two
|
||||
// Indexes, inclusive, is not always just the difference in their ordinals.
|
||||
// However, it suffices for Judy*ByCount() to simply be an ordinal-to-Index
|
||||
// mapper.
|
||||
//
|
||||
// Note: Like Judy*Count(), this code must "count sideways" in branches, which
|
||||
// can result in a lot of cache line fills. However, unlike Judy*Count(), this
|
||||
// code does not receive a specific Index, hence digit, where to start in each
|
||||
// branch, so it cant accurately calculate cache line fills required in each
|
||||
// direction. The best it can do is an approximation based on the total
|
||||
// population of the expanse (pop1 from Pjp) and the ordinal of the target
|
||||
// Index (see SETOFFSET()) within the expanse.
|
||||
//
|
||||
// Compile with -DSMARTMETRICS to obtain global variables containing smart
|
||||
// cache line metrics. Note: Dont turn this on simultaneously for this file
|
||||
// and JudyCount.c because they export the same globals.
|
||||
// ****************************************************************************
|
||||
|
||||
#if (! (defined(JUDY1) || defined(JUDYL)))
|
||||
#error: One of -DJUDY1 or -DJUDYL must be specified.
|
||||
#endif
|
||||
|
||||
#ifdef JUDY1
|
||||
#include "Judy1.h"
|
||||
#else
|
||||
#include "JudyL.h"
|
||||
#endif
|
||||
|
||||
#include "JudyPrivate1L.h"
|
||||
|
||||
// These are imported from JudyCount.c:
|
||||
//
|
||||
// TBD: Should this be in common code? Exported from a header file?
|
||||
|
||||
#ifdef JUDY1
|
||||
extern Word_t j__udy1JPPop1(const Pjp_t Pjp);
|
||||
#define j__udyJPPop1 j__udy1JPPop1
|
||||
#else
|
||||
extern Word_t j__udyLJPPop1(const Pjp_t Pjp);
|
||||
#define j__udyJPPop1 j__udyLJPPop1
|
||||
#endif
|
||||
|
||||
// Avoid duplicate symbols since this file is multi-compiled:
|
||||
|
||||
#ifdef SMARTMETRICS
|
||||
#ifdef JUDY1
|
||||
Word_t jbb_upward = 0; // counts of directions taken:
|
||||
Word_t jbb_downward = 0;
|
||||
Word_t jbu_upward = 0;
|
||||
Word_t jbu_downward = 0;
|
||||
Word_t jlb_upward = 0;
|
||||
Word_t jlb_downward = 0;
|
||||
#else
|
||||
extern Word_t jbb_upward;
|
||||
extern Word_t jbb_downward;
|
||||
extern Word_t jbu_upward;
|
||||
extern Word_t jbu_downward;
|
||||
extern Word_t jlb_upward;
|
||||
extern Word_t jlb_downward;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
// ****************************************************************************
|
||||
// J U D Y 1 B Y C O U N T
|
||||
// J U D Y L B Y C O U N T
|
||||
//
|
||||
// See the manual entry.
|
||||
|
||||
#ifdef JUDY1
|
||||
FUNCTION int Judy1ByCount
|
||||
#else
|
||||
FUNCTION PPvoid_t JudyLByCount
|
||||
#endif
|
||||
(
|
||||
Pcvoid_t PArray, // root pointer to first branch/leaf in SM.
|
||||
Word_t Count, // ordinal of Index to find, 1..MAX.
|
||||
Word_t * PIndex, // to return found Index.
|
||||
PJError_t PJError // optional, for returning error info.
|
||||
)
|
||||
{
|
||||
Word_t Count0; // Count, base-0, to match pop0.
|
||||
Word_t state; // current state in SM.
|
||||
Word_t pop1; // of current branch or leaf, or of expanse.
|
||||
Word_t pop1lower; // pop1 of expanses (JPs) below that for Count.
|
||||
Word_t digit; // current word in branch.
|
||||
Word_t jpcount; // JPs in a BranchB subexpanse.
|
||||
long jpnum; // JP number in a branch (base 0).
|
||||
long subexp; // for stepping through layer 1 (subexpanses).
|
||||
int offset; // index ordinal within a leaf, base 0.
|
||||
|
||||
Pjp_t Pjp; // current JP in branch.
|
||||
Pjll_t Pjll; // current Judy linear leaf.
|
||||
|
||||
|
||||
// CHECK FOR EMPTY ARRAY OR NULL PINDEX:
|
||||
|
||||
if (PArray == (Pvoid_t) NULL) JU_RET_NOTFOUND;
|
||||
|
||||
if (PIndex == (PWord_t) NULL)
|
||||
{
|
||||
JU_SET_ERRNO(PJError, JU_ERRNO_NULLPINDEX);
|
||||
JUDY1CODE(return(JERRI );)
|
||||
JUDYLCODE(return(PPJERR);)
|
||||
}
|
||||
|
||||
// Convert Count to Count0; assume special case of Count = 0 maps to ~0, as
|
||||
// desired, to represent the last index in a full array:
|
||||
//
|
||||
// Note: Think of Count0 as a reliable "number of Indexes below the target."
|
||||
|
||||
Count0 = Count - 1;
|
||||
assert((Count || Count0 == ~0)); // ensure CPU is sane about 0 - 1.
|
||||
pop1lower = 0;
|
||||
|
||||
if (JU_LEAFW_POP0(PArray) < cJU_LEAFW_MAXPOP1) // must be a LEAFW
|
||||
{
|
||||
Pjlw_t Pjlw = P_JLW(PArray); // first word of leaf.
|
||||
|
||||
if (Count0 > Pjlw[0]) JU_RET_NOTFOUND; // too high.
|
||||
|
||||
*PIndex = Pjlw[Count]; // Index, base 1.
|
||||
|
||||
JU_RET_FOUND_LEAFW(Pjlw, Pjlw[0] + 1, Count0);
|
||||
}
|
||||
else
|
||||
{
|
||||
Pjpm_t Pjpm = P_JPM(PArray);
|
||||
|
||||
if (Count0 > (Pjpm->jpm_Pop0)) JU_RET_NOTFOUND; // too high.
|
||||
|
||||
Pjp = &(Pjpm->jpm_JP);
|
||||
pop1 = (Pjpm->jpm_Pop0) + 1;
|
||||
|
||||
// goto SMByCount;
|
||||
}
|
||||
|
||||
// COMMON CODE:
|
||||
//
|
||||
// Prepare to handle a root-level or lower-level branch: Save the current
|
||||
// state, obtain the total population for the branch in a state-dependent way,
|
||||
// and then branch to common code for multiple cases.
|
||||
//
|
||||
// For root-level branches, the state is always cJU_ROOTSTATE, and the array
|
||||
// population must already be set in pop1; it is not available in jp_DcdPopO.
|
||||
//
|
||||
// Note: The total population is only needed in cases where the common code
|
||||
// "counts down" instead of up to minimize cache line fills. However, its
|
||||
// available cheaply, and its better to do it with a constant shift (constant
|
||||
// state value) instead of a variable shift later "when needed".
|
||||
|
||||
#define PREPB_ROOT(Next) \
|
||||
state = cJU_ROOTSTATE; \
|
||||
goto Next
|
||||
|
||||
// Use PREPB_DCD() to first copy the Dcd bytes to *PIndex if there are any
|
||||
// (only if state < cJU_ROOTSTATE - 1):
|
||||
|
||||
#define PREPB_DCD(Pjp,cState,Next) \
|
||||
JU_SETDCD(*PIndex, Pjp, cState); \
|
||||
PREPB((Pjp), cState, Next)
|
||||
|
||||
#define PREPB(Pjp,cState,Next) \
|
||||
state = (cState); \
|
||||
pop1 = JU_JPBRANCH_POP0(Pjp, (cState)) + 1; \
|
||||
goto Next
|
||||
|
||||
// Calculate whether the ordinal of an Index within a given expanse falls in
|
||||
// the lower or upper half of the expanses population, taking care with
|
||||
// unsigned math and boundary conditions:
|
||||
//
|
||||
// Note: Assume the ordinal falls within the expanses population, that is,
|
||||
// 0 < (Count - Pop1lower) <= Pop1exp (assuming infinite math).
|
||||
//
|
||||
// Note: If the ordinal is the middle element, it doesnt matter whether
|
||||
// LOWERHALF() is TRUE or FALSE.
|
||||
|
||||
#define LOWERHALF(Count0,Pop1lower,Pop1exp) \
|
||||
(((Count0) - (Pop1lower)) < ((Pop1exp) / 2))
|
||||
|
||||
// Calculate the (signed) offset within a leaf to the desired ordinal (Count -
|
||||
// Pop1lower; offset is one less), and optionally ensure its in range:
|
||||
|
||||
#define SETOFFSET(Offset,Count0,Pop1lower,Pjp) \
|
||||
(Offset) = (Count0) - (Pop1lower); \
|
||||
assert((Offset) >= 0); \
|
||||
assert((Offset) <= JU_JPLEAF_POP0(Pjp))
|
||||
|
||||
// Variations for immediate indexes, with and without pop1-specific assertions:
|
||||
|
||||
#define SETOFFSET_IMM_CK(Offset,Count0,Pop1lower,cPop1) \
|
||||
(Offset) = (Count0) - (Pop1lower); \
|
||||
assert((Offset) >= 0); \
|
||||
assert((Offset) < (cPop1))
|
||||
|
||||
#define SETOFFSET_IMM(Offset,Count0,Pop1lower) \
|
||||
(Offset) = (Count0) - (Pop1lower)
|
||||
|
||||
|
||||
// STATE MACHINE -- TRAVERSE TREE:
|
||||
//
|
||||
// In branches, look for the expanse (digit), if any, where the total pop1
|
||||
// below or at that expanse would meet or exceed Count, meaning the Index must
|
||||
// be in this expanse.
|
||||
|
||||
SMByCount: // return here for next branch/leaf.
|
||||
|
||||
switch (JU_JPTYPE(Pjp))
|
||||
{
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// LINEAR BRANCH; count populations in JPs in the JBL upwards until finding the
|
||||
// expanse (digit) containing Count, and "recurse".
|
||||
//
|
||||
// Note: There are no null JPs in a JBL; watch out for pop1 == 0.
|
||||
//
|
||||
// Note: A JBL should always fit in one cache line => no need to count up
|
||||
// versus down to save cache line fills.
|
||||
//
|
||||
// TBD: The previous is no longer true. Consider enhancing this code to count
|
||||
// up/down, but it can wait for a later tuning phase. In the meantime, PREPB()
|
||||
// sets pop1 for the whole array, but that value is not used here. 001215:
|
||||
// Maybe its true again?
|
||||
|
||||
case cJU_JPBRANCH_L2: PREPB_DCD(Pjp, 2, BranchL);
|
||||
#ifndef JU_64BIT
|
||||
case cJU_JPBRANCH_L3: PREPB( Pjp, 3, BranchL);
|
||||
#else
|
||||
case cJU_JPBRANCH_L3: PREPB_DCD(Pjp, 3, BranchL);
|
||||
case cJU_JPBRANCH_L4: PREPB_DCD(Pjp, 4, BranchL);
|
||||
case cJU_JPBRANCH_L5: PREPB_DCD(Pjp, 5, BranchL);
|
||||
case cJU_JPBRANCH_L6: PREPB_DCD(Pjp, 6, BranchL);
|
||||
case cJU_JPBRANCH_L7: PREPB( Pjp, 7, BranchL);
|
||||
#endif
|
||||
case cJU_JPBRANCH_L: PREPB_ROOT( BranchL);
|
||||
{
|
||||
Pjbl_t Pjbl;
|
||||
|
||||
// Common code (state-independent) for all cases of linear branches:
|
||||
|
||||
BranchL:
|
||||
Pjbl = P_JBL(Pjp->jp_Addr);
|
||||
|
||||
for (jpnum = 0; jpnum < (Pjbl->jbl_NumJPs); ++jpnum)
|
||||
{
|
||||
if ((pop1 = j__udyJPPop1((Pjbl->jbl_jp) + jpnum))
|
||||
== cJU_ALLONES)
|
||||
{
|
||||
JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT);
|
||||
JUDY1CODE(return(JERRI );)
|
||||
JUDYLCODE(return(PPJERR);)
|
||||
}
|
||||
assert(pop1 != 0);
|
||||
|
||||
// Warning: pop1lower and pop1 are unsigned, so do not subtract 1 and compare
|
||||
// >=, but instead use the following expression:
|
||||
|
||||
if (pop1lower + pop1 > Count0) // Index is in this expanse.
|
||||
{
|
||||
JU_SETDIGIT(*PIndex, Pjbl->jbl_Expanse[jpnum], state);
|
||||
Pjp = (Pjbl->jbl_jp) + jpnum;
|
||||
goto SMByCount; // look under this expanse.
|
||||
}
|
||||
|
||||
pop1lower += pop1; // add this JPs pop1.
|
||||
}
|
||||
|
||||
JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT); // should never get here.
|
||||
JUDY1CODE(return(JERRI );)
|
||||
JUDYLCODE(return(PPJERR);)
|
||||
|
||||
} // case cJU_JPBRANCH_L
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// BITMAP BRANCH; count populations in JPs in the JBB upwards or downwards
|
||||
// until finding the expanse (digit) containing Count, and "recurse".
|
||||
//
|
||||
// Note: There are no null JPs in a JBB; watch out for pop1 == 0.
|
||||
|
||||
case cJU_JPBRANCH_B2: PREPB_DCD(Pjp, 2, BranchB);
|
||||
#ifndef JU_64BIT
|
||||
case cJU_JPBRANCH_B3: PREPB( Pjp, 3, BranchB);
|
||||
#else
|
||||
case cJU_JPBRANCH_B3: PREPB_DCD(Pjp, 3, BranchB);
|
||||
case cJU_JPBRANCH_B4: PREPB_DCD(Pjp, 4, BranchB);
|
||||
case cJU_JPBRANCH_B5: PREPB_DCD(Pjp, 5, BranchB);
|
||||
case cJU_JPBRANCH_B6: PREPB_DCD(Pjp, 6, BranchB);
|
||||
case cJU_JPBRANCH_B7: PREPB( Pjp, 7, BranchB);
|
||||
#endif
|
||||
case cJU_JPBRANCH_B: PREPB_ROOT( BranchB);
|
||||
{
|
||||
Pjbb_t Pjbb;
|
||||
|
||||
// Common code (state-independent) for all cases of bitmap branches:
|
||||
|
||||
BranchB:
|
||||
Pjbb = P_JBB(Pjp->jp_Addr);
|
||||
|
||||
// Shorthand for one subexpanse in a bitmap and for one JP in a bitmap branch:
|
||||
//
|
||||
// Note: BMPJP0 exists separately to support assertions.
|
||||
|
||||
#define BMPJP0(Subexp) (P_JP(JU_JBB_PJP(Pjbb, Subexp)))
|
||||
#define BMPJP(Subexp,JPnum) (BMPJP0(Subexp) + (JPnum))
|
||||
|
||||
|
||||
// Common code for descending through a JP:
|
||||
//
|
||||
// Determine the digit for the expanse and save it in *PIndex; then "recurse".
|
||||
|
||||
#define JBB_FOUNDEXPANSE \
|
||||
{ \
|
||||
JU_BITMAPDIGITB(digit, subexp, JU_JBB_BITMAP(Pjbb,subexp), jpnum); \
|
||||
JU_SETDIGIT(*PIndex, digit, state); \
|
||||
Pjp = BMPJP(subexp, jpnum); \
|
||||
goto SMByCount; \
|
||||
}
|
||||
|
||||
|
||||
#ifndef NOSMARTJBB // enable to turn off smart code for comparison purposes.
|
||||
|
||||
// FIGURE OUT WHICH DIRECTION CAUSES FEWER CACHE LINE FILLS; adding the pop1s
|
||||
// in JPs upwards, or subtracting the pop1s in JPs downwards:
|
||||
//
|
||||
// See header comments about limitations of this for Judy*ByCount().
|
||||
|
||||
#endif
|
||||
|
||||
// COUNT UPWARD, adding each "below" JPs pop1:
|
||||
|
||||
#ifndef NOSMARTJBB // enable to turn off smart code for comparison purposes.
|
||||
|
||||
if (LOWERHALF(Count0, pop1lower, pop1))
|
||||
{
|
||||
#endif
|
||||
#ifdef SMARTMETRICS
|
||||
++jbb_upward;
|
||||
#endif
|
||||
for (subexp = 0; subexp < cJU_NUMSUBEXPB; ++subexp)
|
||||
{
|
||||
if ((jpcount = j__udyCountBitsB(JU_JBB_BITMAP(Pjbb,subexp)))
|
||||
&& (BMPJP0(subexp) == (Pjp_t) NULL))
|
||||
{
|
||||
JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT); // null ptr.
|
||||
JUDY1CODE(return(JERRI );)
|
||||
JUDYLCODE(return(PPJERR);)
|
||||
}
|
||||
|
||||
// Note: An empty subexpanse (jpcount == 0) is handled "for free":
|
||||
|
||||
for (jpnum = 0; jpnum < jpcount; ++jpnum)
|
||||
{
|
||||
if ((pop1 = j__udyJPPop1(BMPJP(subexp, jpnum)))
|
||||
== cJU_ALLONES)
|
||||
{
|
||||
JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT);
|
||||
JUDY1CODE(return(JERRI );)
|
||||
JUDYLCODE(return(PPJERR);)
|
||||
}
|
||||
assert(pop1 != 0);
|
||||
|
||||
// Warning: pop1lower and pop1 are unsigned, see earlier comment:
|
||||
|
||||
if (pop1lower + pop1 > Count0)
|
||||
JBB_FOUNDEXPANSE; // Index is in this expanse.
|
||||
|
||||
pop1lower += pop1; // add this JPs pop1.
|
||||
}
|
||||
}
|
||||
#ifndef NOSMARTJBB // enable to turn off smart code for comparison purposes.
|
||||
}
|
||||
|
||||
|
||||
// COUNT DOWNWARD, subtracting each "above" JPs pop1 from the whole expanses
|
||||
// pop1:
|
||||
|
||||
else
|
||||
{
|
||||
#ifdef SMARTMETRICS
|
||||
++jbb_downward;
|
||||
#endif
|
||||
pop1lower += pop1; // add whole branch to start.
|
||||
|
||||
for (subexp = cJU_NUMSUBEXPB - 1; subexp >= 0; --subexp)
|
||||
{
|
||||
if ((jpcount = j__udyCountBitsB(JU_JBB_BITMAP(Pjbb, subexp)))
|
||||
&& (BMPJP0(subexp) == (Pjp_t) NULL))
|
||||
{
|
||||
JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT); // null ptr.
|
||||
JUDY1CODE(return(JERRI );)
|
||||
JUDYLCODE(return(PPJERR);)
|
||||
}
|
||||
|
||||
// Note: An empty subexpanse (jpcount == 0) is handled "for free":
|
||||
|
||||
for (jpnum = jpcount - 1; jpnum >= 0; --jpnum)
|
||||
{
|
||||
if ((pop1 = j__udyJPPop1(BMPJP(subexp, jpnum)))
|
||||
== cJU_ALLONES)
|
||||
{
|
||||
JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT);
|
||||
JUDY1CODE(return(JERRI );)
|
||||
JUDYLCODE(return(PPJERR);)
|
||||
}
|
||||
assert(pop1 != 0);
|
||||
|
||||
// Warning: pop1lower and pop1 are unsigned, see earlier comment:
|
||||
|
||||
pop1lower -= pop1;
|
||||
|
||||
// Beware unsigned math problems:
|
||||
|
||||
if ((pop1lower == 0) || (pop1lower - 1 < Count0))
|
||||
JBB_FOUNDEXPANSE; // Index is in this expanse.
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // NOSMARTJBB
|
||||
|
||||
JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT); // should never get here.
|
||||
JUDY1CODE(return(JERRI );)
|
||||
JUDYLCODE(return(PPJERR);)
|
||||
|
||||
} // case cJU_JPBRANCH_B
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// UNCOMPRESSED BRANCH; count populations in JPs in the JBU upwards or
|
||||
// downwards until finding the expanse (digit) containing Count, and "recurse".
|
||||
|
||||
case cJU_JPBRANCH_U2: PREPB_DCD(Pjp, 2, BranchU);
|
||||
#ifndef JU_64BIT
|
||||
case cJU_JPBRANCH_U3: PREPB( Pjp, 3, BranchU);
|
||||
#else
|
||||
case cJU_JPBRANCH_U3: PREPB_DCD(Pjp, 3, BranchU);
|
||||
case cJU_JPBRANCH_U4: PREPB_DCD(Pjp, 4, BranchU);
|
||||
case cJU_JPBRANCH_U5: PREPB_DCD(Pjp, 5, BranchU);
|
||||
case cJU_JPBRANCH_U6: PREPB_DCD(Pjp, 6, BranchU);
|
||||
case cJU_JPBRANCH_U7: PREPB( Pjp, 7, BranchU);
|
||||
#endif
|
||||
case cJU_JPBRANCH_U: PREPB_ROOT( BranchU);
|
||||
{
|
||||
Pjbu_t Pjbu;
|
||||
|
||||
// Common code (state-independent) for all cases of uncompressed branches:
|
||||
|
||||
BranchU:
|
||||
Pjbu = P_JBU(Pjp->jp_Addr);
|
||||
|
||||
// Common code for descending through a JP:
|
||||
//
|
||||
// Save the digit for the expanse in *PIndex, then "recurse".
|
||||
|
||||
#define JBU_FOUNDEXPANSE \
|
||||
{ \
|
||||
JU_SETDIGIT(*PIndex, jpnum, state); \
|
||||
Pjp = (Pjbu->jbu_jp) + jpnum; \
|
||||
goto SMByCount; \
|
||||
}
|
||||
|
||||
|
||||
#ifndef NOSMARTJBU // enable to turn off smart code for comparison purposes.
|
||||
|
||||
// FIGURE OUT WHICH DIRECTION CAUSES FEWER CACHE LINE FILLS; adding the pop1s
|
||||
// in JPs upwards, or subtracting the pop1s in JPs downwards:
|
||||
//
|
||||
// See header comments about limitations of this for Judy*ByCount().
|
||||
|
||||
#endif
|
||||
|
||||
// COUNT UPWARD, simply adding the pop1 of each JP:
|
||||
|
||||
#ifndef NOSMARTJBU // enable to turn off smart code for comparison purposes.
|
||||
|
||||
if (LOWERHALF(Count0, pop1lower, pop1))
|
||||
{
|
||||
#endif
|
||||
#ifdef SMARTMETRICS
|
||||
++jbu_upward;
|
||||
#endif
|
||||
|
||||
for (jpnum = 0; jpnum < cJU_BRANCHUNUMJPS; ++jpnum)
|
||||
{
|
||||
// shortcut, save a function call:
|
||||
|
||||
if ((Pjbu->jbu_jp[jpnum].jp_Type) <= cJU_JPNULLMAX)
|
||||
continue;
|
||||
|
||||
if ((pop1 = j__udyJPPop1((Pjbu->jbu_jp) + jpnum))
|
||||
== cJU_ALLONES)
|
||||
{
|
||||
JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT);
|
||||
JUDY1CODE(return(JERRI );)
|
||||
JUDYLCODE(return(PPJERR);)
|
||||
}
|
||||
assert(pop1 != 0);
|
||||
|
||||
// Warning: pop1lower and pop1 are unsigned, see earlier comment:
|
||||
|
||||
if (pop1lower + pop1 > Count0)
|
||||
JBU_FOUNDEXPANSE; // Index is in this expanse.
|
||||
|
||||
pop1lower += pop1; // add this JPs pop1.
|
||||
}
|
||||
#ifndef NOSMARTJBU // enable to turn off smart code for comparison purposes.
|
||||
}
|
||||
|
||||
|
||||
// COUNT DOWNWARD, subtracting the pop1 of each JP above from the whole
|
||||
// expanses pop1:
|
||||
|
||||
else
|
||||
{
|
||||
#ifdef SMARTMETRICS
|
||||
++jbu_downward;
|
||||
#endif
|
||||
pop1lower += pop1; // add whole branch to start.
|
||||
|
||||
for (jpnum = cJU_BRANCHUNUMJPS - 1; jpnum >= 0; --jpnum)
|
||||
{
|
||||
// shortcut, save a function call:
|
||||
|
||||
if ((Pjbu->jbu_jp[jpnum].jp_Type) <= cJU_JPNULLMAX)
|
||||
continue;
|
||||
|
||||
if ((pop1 = j__udyJPPop1(Pjbu->jbu_jp + jpnum))
|
||||
== cJU_ALLONES)
|
||||
{
|
||||
JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT);
|
||||
JUDY1CODE(return(JERRI );)
|
||||
JUDYLCODE(return(PPJERR);)
|
||||
}
|
||||
assert(pop1 != 0);
|
||||
|
||||
// Warning: pop1lower and pop1 are unsigned, see earlier comment:
|
||||
|
||||
pop1lower -= pop1;
|
||||
|
||||
// Beware unsigned math problems:
|
||||
|
||||
if ((pop1lower == 0) || (pop1lower - 1 < Count0))
|
||||
JBU_FOUNDEXPANSE; // Index is in this expanse.
|
||||
}
|
||||
}
|
||||
#endif // NOSMARTJBU
|
||||
|
||||
JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT); // should never get here.
|
||||
JUDY1CODE(return(JERRI );)
|
||||
JUDYLCODE(return(PPJERR);)
|
||||
|
||||
} // case cJU_JPBRANCH_U
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// LINEAR LEAF:
|
||||
//
|
||||
// Return the Index at the proper ordinal (see SETOFFSET()) in the leaf. First
|
||||
// copy Dcd bytes, if there are any (only if state < cJU_ROOTSTATE - 1), to
|
||||
// *PIndex.
|
||||
//
|
||||
// Note: The preceding branch traversal code MIGHT set pop1 for this expanse
|
||||
// (linear leaf) as a side-effect, but dont depend on that (for JUDYL, which
|
||||
// is the only cases that need it anyway).
|
||||
|
||||
#define PREPL_DCD(cState) \
|
||||
JU_SETDCD(*PIndex, Pjp, cState); \
|
||||
PREPL
|
||||
|
||||
#ifdef JUDY1
|
||||
#define PREPL_SETPOP1 // not needed in any cases.
|
||||
#else
|
||||
#define PREPL_SETPOP1 pop1 = JU_JPLEAF_POP0(Pjp) + 1
|
||||
#endif
|
||||
|
||||
#define PREPL \
|
||||
Pjll = P_JLL(Pjp->jp_Addr); \
|
||||
PREPL_SETPOP1; \
|
||||
SETOFFSET(offset, Count0, pop1lower, Pjp)
|
||||
|
||||
#if (defined(JUDYL) || (! defined(JU_64BIT)))
|
||||
case cJU_JPLEAF1:
|
||||
|
||||
PREPL_DCD(1);
|
||||
JU_SETDIGIT1(*PIndex, ((uint8_t *) Pjll)[offset]);
|
||||
JU_RET_FOUND_LEAF1(Pjll, pop1, offset);
|
||||
#endif
|
||||
|
||||
case cJU_JPLEAF2:
|
||||
|
||||
PREPL_DCD(2);
|
||||
*PIndex = (*PIndex & (~JU_LEASTBYTESMASK(2)))
|
||||
| ((uint16_t *) Pjll)[offset];
|
||||
JU_RET_FOUND_LEAF2(Pjll, pop1, offset);
|
||||
|
||||
#ifndef JU_64BIT
|
||||
case cJU_JPLEAF3:
|
||||
{
|
||||
Word_t lsb;
|
||||
PREPL;
|
||||
JU_COPY3_PINDEX_TO_LONG(lsb, ((uint8_t *) Pjll) + (3 * offset));
|
||||
*PIndex = (*PIndex & (~JU_LEASTBYTESMASK(3))) | lsb;
|
||||
JU_RET_FOUND_LEAF3(Pjll, pop1, offset);
|
||||
}
|
||||
|
||||
#else
|
||||
case cJU_JPLEAF3:
|
||||
{
|
||||
Word_t lsb;
|
||||
PREPL_DCD(3);
|
||||
JU_COPY3_PINDEX_TO_LONG(lsb, ((uint8_t *) Pjll) + (3 * offset));
|
||||
*PIndex = (*PIndex & (~JU_LEASTBYTESMASK(3))) | lsb;
|
||||
JU_RET_FOUND_LEAF3(Pjll, pop1, offset);
|
||||
}
|
||||
|
||||
case cJU_JPLEAF4:
|
||||
|
||||
PREPL_DCD(4);
|
||||
*PIndex = (*PIndex & (~JU_LEASTBYTESMASK(4)))
|
||||
| ((uint32_t *) Pjll)[offset];
|
||||
JU_RET_FOUND_LEAF4(Pjll, pop1, offset);
|
||||
|
||||
case cJU_JPLEAF5:
|
||||
{
|
||||
Word_t lsb;
|
||||
PREPL_DCD(5);
|
||||
JU_COPY5_PINDEX_TO_LONG(lsb, ((uint8_t *) Pjll) + (5 * offset));
|
||||
*PIndex = (*PIndex & (~JU_LEASTBYTESMASK(5))) | lsb;
|
||||
JU_RET_FOUND_LEAF5(Pjll, pop1, offset);
|
||||
}
|
||||
|
||||
case cJU_JPLEAF6:
|
||||
{
|
||||
Word_t lsb;
|
||||
PREPL_DCD(6);
|
||||
JU_COPY6_PINDEX_TO_LONG(lsb, ((uint8_t *) Pjll) + (6 * offset));
|
||||
*PIndex = (*PIndex & (~JU_LEASTBYTESMASK(6))) | lsb;
|
||||
JU_RET_FOUND_LEAF6(Pjll, pop1, offset);
|
||||
}
|
||||
|
||||
case cJU_JPLEAF7:
|
||||
{
|
||||
Word_t lsb;
|
||||
PREPL;
|
||||
JU_COPY7_PINDEX_TO_LONG(lsb, ((uint8_t *) Pjll) + (7 * offset));
|
||||
*PIndex = (*PIndex & (~JU_LEASTBYTESMASK(7))) | lsb;
|
||||
JU_RET_FOUND_LEAF7(Pjll, pop1, offset);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// BITMAP LEAF:
|
||||
//
|
||||
// Return the Index at the proper ordinal (see SETOFFSET()) in the leaf by
|
||||
// counting bits. First copy Dcd bytes (always present since state 1 <
|
||||
// cJU_ROOTSTATE) to *PIndex.
|
||||
//
|
||||
// Note: The preceding branch traversal code MIGHT set pop1 for this expanse
|
||||
// (bitmap leaf) as a side-effect, but dont depend on that.
|
||||
|
||||
case cJU_JPLEAF_B1:
|
||||
{
|
||||
Pjlb_t Pjlb;
|
||||
|
||||
JU_SETDCD(*PIndex, Pjp, 1);
|
||||
Pjlb = P_JLB(Pjp->jp_Addr);
|
||||
pop1 = JU_JPLEAF_POP0(Pjp) + 1;
|
||||
|
||||
// COUNT UPWARD, adding the pop1 of each subexpanse:
|
||||
//
|
||||
// The entire bitmap should fit in one cache line, but still try to save some
|
||||
// CPU time by counting the fewest possible number of subexpanses from the
|
||||
// bitmap.
|
||||
//
|
||||
// See header comments about limitations of this for Judy*ByCount().
|
||||
|
||||
#ifndef NOSMARTJLB // enable to turn off smart code for comparison purposes.
|
||||
|
||||
if (LOWERHALF(Count0, pop1lower, pop1))
|
||||
{
|
||||
#endif
|
||||
#ifdef SMARTMETRICS
|
||||
++jlb_upward;
|
||||
#endif
|
||||
for (subexp = 0; subexp < cJU_NUMSUBEXPL; ++subexp)
|
||||
{
|
||||
pop1 = j__udyCountBitsL(JU_JLB_BITMAP(Pjlb, subexp));
|
||||
|
||||
// Warning: pop1lower and pop1 are unsigned, see earlier comment:
|
||||
|
||||
if (pop1lower + pop1 > Count0)
|
||||
goto LeafB1; // Index is in this subexpanse.
|
||||
|
||||
pop1lower += pop1; // add this subexpanses pop1.
|
||||
}
|
||||
#ifndef NOSMARTJLB // enable to turn off smart code for comparison purposes.
|
||||
}
|
||||
|
||||
|
||||
// COUNT DOWNWARD, subtracting each "above" subexpanses pop1 from the whole
|
||||
// expanses pop1:
|
||||
|
||||
else
|
||||
{
|
||||
#ifdef SMARTMETRICS
|
||||
++jlb_downward;
|
||||
#endif
|
||||
pop1lower += pop1; // add whole leaf to start.
|
||||
|
||||
for (subexp = cJU_NUMSUBEXPL - 1; subexp >= 0; --subexp)
|
||||
{
|
||||
pop1lower -= j__udyCountBitsL(JU_JLB_BITMAP(Pjlb, subexp));
|
||||
|
||||
// Beware unsigned math problems:
|
||||
|
||||
if ((pop1lower == 0) || (pop1lower - 1 < Count0))
|
||||
goto LeafB1; // Index is in this subexpanse.
|
||||
}
|
||||
}
|
||||
#endif // NOSMARTJLB
|
||||
|
||||
JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT); // should never get here.
|
||||
JUDY1CODE(return(JERRI );)
|
||||
JUDYLCODE(return(PPJERR);)
|
||||
|
||||
|
||||
// RETURN INDEX FOUND:
|
||||
//
|
||||
// Come here with subexp set to the correct subexpanse, and pop1lower set to
|
||||
// the sum for all lower expanses and subexpanses in the Judy tree. Calculate
|
||||
// and save in *PIndex the digit corresponding to the ordinal in this
|
||||
// subexpanse.
|
||||
|
||||
LeafB1:
|
||||
SETOFFSET(offset, Count0, pop1lower, Pjp);
|
||||
JU_BITMAPDIGITL(digit, subexp, JU_JLB_BITMAP(Pjlb, subexp), offset);
|
||||
JU_SETDIGIT1(*PIndex, digit);
|
||||
JU_RET_FOUND_LEAF_B1(Pjlb, subexp, offset);
|
||||
// == return((PPvoid_t) (P_JV(JL_JLB_PVALUE(Pjlb, subexp)) + offset))
|
||||
|
||||
} // case cJU_JPLEAF_B1
|
||||
|
||||
|
||||
#ifdef JUDY1
|
||||
// ----------------------------------------------------------------------------
|
||||
// FULL POPULATION:
|
||||
//
|
||||
// Copy Dcd bytes (always present since state 1 < cJU_ROOTSTATE) to *PIndex,
|
||||
// then set the appropriate digit for the ordinal (see SETOFFSET()) in the leaf
|
||||
// as the LSB in *PIndex.
|
||||
|
||||
case cJ1_JPFULLPOPU1:
|
||||
|
||||
JU_SETDCD(*PIndex, Pjp, 1);
|
||||
SETOFFSET(offset, Count0, pop1lower, Pjp);
|
||||
assert(offset >= 0);
|
||||
assert(offset <= cJU_JPFULLPOPU1_POP0);
|
||||
JU_SETDIGIT1(*PIndex, offset);
|
||||
JU_RET_FOUND_FULLPOPU1;
|
||||
#endif
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// IMMEDIATE:
|
||||
//
|
||||
// Locate the Index with the proper ordinal (see SETOFFSET()) in the Immediate,
|
||||
// depending on leaf Index Size and pop1. Note: There are no Dcd bytes in an
|
||||
// Immediate JP, but in a cJU_JPIMMED_*_01 JP, the field holds the least bytes
|
||||
// of the immediate Index.
|
||||
|
||||
#define SET_01(cState) JU_SETDIGITS(*PIndex, JU_JPDCDPOP0(Pjp), cState)
|
||||
|
||||
case cJU_JPIMMED_1_01: SET_01(1); goto Imm_01;
|
||||
case cJU_JPIMMED_2_01: SET_01(2); goto Imm_01;
|
||||
case cJU_JPIMMED_3_01: SET_01(3); goto Imm_01;
|
||||
#ifdef JU_64BIT
|
||||
case cJU_JPIMMED_4_01: SET_01(4); goto Imm_01;
|
||||
case cJU_JPIMMED_5_01: SET_01(5); goto Imm_01;
|
||||
case cJU_JPIMMED_6_01: SET_01(6); goto Imm_01;
|
||||
case cJU_JPIMMED_7_01: SET_01(7); goto Imm_01;
|
||||
#endif
|
||||
|
||||
Imm_01:
|
||||
|
||||
DBGCODE(SETOFFSET_IMM_CK(offset, Count0, pop1lower, 1);)
|
||||
JU_RET_FOUND_IMM_01(Pjp);
|
||||
|
||||
// Shorthand for where to find start of Index bytes array:
|
||||
|
||||
#ifdef JUDY1
|
||||
#define PJI (Pjp->jp_1Index)
|
||||
#else
|
||||
#define PJI (Pjp->jp_LIndex)
|
||||
#endif
|
||||
|
||||
// Optional code to check the remaining ordinal (see SETOFFSET_IMM()) against
|
||||
// the Index Size of the Immediate:
|
||||
|
||||
#ifndef DEBUG // simple placeholder:
|
||||
#define IMM(cPop1,Next) \
|
||||
goto Next
|
||||
#else // extra pop1-specific checking:
|
||||
#define IMM(cPop1,Next) \
|
||||
SETOFFSET_IMM_CK(offset, Count0, pop1lower, cPop1); \
|
||||
goto Next
|
||||
#endif
|
||||
|
||||
case cJU_JPIMMED_1_02: IMM( 2, Imm1);
|
||||
case cJU_JPIMMED_1_03: IMM( 3, Imm1);
|
||||
#if (defined(JUDY1) || defined(JU_64BIT))
|
||||
case cJU_JPIMMED_1_04: IMM( 4, Imm1);
|
||||
case cJU_JPIMMED_1_05: IMM( 5, Imm1);
|
||||
case cJU_JPIMMED_1_06: IMM( 6, Imm1);
|
||||
case cJU_JPIMMED_1_07: IMM( 7, Imm1);
|
||||
#endif
|
||||
#if (defined(JUDY1) && defined(JU_64BIT))
|
||||
case cJ1_JPIMMED_1_08: IMM( 8, Imm1);
|
||||
case cJ1_JPIMMED_1_09: IMM( 9, Imm1);
|
||||
case cJ1_JPIMMED_1_10: IMM(10, Imm1);
|
||||
case cJ1_JPIMMED_1_11: IMM(11, Imm1);
|
||||
case cJ1_JPIMMED_1_12: IMM(12, Imm1);
|
||||
case cJ1_JPIMMED_1_13: IMM(13, Imm1);
|
||||
case cJ1_JPIMMED_1_14: IMM(14, Imm1);
|
||||
case cJ1_JPIMMED_1_15: IMM(15, Imm1);
|
||||
#endif
|
||||
|
||||
Imm1: SETOFFSET_IMM(offset, Count0, pop1lower);
|
||||
JU_SETDIGIT1(*PIndex, ((uint8_t *) PJI)[offset]);
|
||||
JU_RET_FOUND_IMM(Pjp, offset);
|
||||
|
||||
#if (defined(JUDY1) || defined(JU_64BIT))
|
||||
case cJU_JPIMMED_2_02: IMM(2, Imm2);
|
||||
case cJU_JPIMMED_2_03: IMM(3, Imm2);
|
||||
#endif
|
||||
#if (defined(JUDY1) && defined(JU_64BIT))
|
||||
case cJ1_JPIMMED_2_04: IMM(4, Imm2);
|
||||
case cJ1_JPIMMED_2_05: IMM(5, Imm2);
|
||||
case cJ1_JPIMMED_2_06: IMM(6, Imm2);
|
||||
case cJ1_JPIMMED_2_07: IMM(7, Imm2);
|
||||
#endif
|
||||
|
||||
#if (defined(JUDY1) || defined(JU_64BIT))
|
||||
Imm2: SETOFFSET_IMM(offset, Count0, pop1lower);
|
||||
*PIndex = (*PIndex & (~JU_LEASTBYTESMASK(2)))
|
||||
| ((uint16_t *) PJI)[offset];
|
||||
JU_RET_FOUND_IMM(Pjp, offset);
|
||||
#endif
|
||||
|
||||
#if (defined(JUDY1) || defined(JU_64BIT))
|
||||
case cJU_JPIMMED_3_02: IMM(2, Imm3);
|
||||
#endif
|
||||
#if (defined(JUDY1) && defined(JU_64BIT))
|
||||
case cJ1_JPIMMED_3_03: IMM(3, Imm3);
|
||||
case cJ1_JPIMMED_3_04: IMM(4, Imm3);
|
||||
case cJ1_JPIMMED_3_05: IMM(5, Imm3);
|
||||
#endif
|
||||
|
||||
#if (defined(JUDY1) || defined(JU_64BIT))
|
||||
Imm3:
|
||||
{
|
||||
Word_t lsb;
|
||||
SETOFFSET_IMM(offset, Count0, pop1lower);
|
||||
JU_COPY3_PINDEX_TO_LONG(lsb, ((uint8_t *) PJI) + (3 * offset));
|
||||
*PIndex = (*PIndex & (~JU_LEASTBYTESMASK(3))) | lsb;
|
||||
JU_RET_FOUND_IMM(Pjp, offset);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if (defined(JUDY1) && defined(JU_64BIT))
|
||||
case cJ1_JPIMMED_4_02: IMM(2, Imm4);
|
||||
case cJ1_JPIMMED_4_03: IMM(3, Imm4);
|
||||
|
||||
Imm4: SETOFFSET_IMM(offset, Count0, pop1lower);
|
||||
*PIndex = (*PIndex & (~JU_LEASTBYTESMASK(4)))
|
||||
| ((uint32_t *) PJI)[offset];
|
||||
JU_RET_FOUND_IMM(Pjp, offset);
|
||||
|
||||
case cJ1_JPIMMED_5_02: IMM(2, Imm5);
|
||||
case cJ1_JPIMMED_5_03: IMM(3, Imm5);
|
||||
|
||||
Imm5:
|
||||
{
|
||||
Word_t lsb;
|
||||
SETOFFSET_IMM(offset, Count0, pop1lower);
|
||||
JU_COPY5_PINDEX_TO_LONG(lsb, ((uint8_t *) PJI) + (5 * offset));
|
||||
*PIndex = (*PIndex & (~JU_LEASTBYTESMASK(5))) | lsb;
|
||||
JU_RET_FOUND_IMM(Pjp, offset);
|
||||
}
|
||||
|
||||
case cJ1_JPIMMED_6_02: IMM(2, Imm6);
|
||||
|
||||
Imm6:
|
||||
{
|
||||
Word_t lsb;
|
||||
SETOFFSET_IMM(offset, Count0, pop1lower);
|
||||
JU_COPY6_PINDEX_TO_LONG(lsb, ((uint8_t *) PJI) + (6 * offset));
|
||||
*PIndex = (*PIndex & (~JU_LEASTBYTESMASK(6))) | lsb;
|
||||
JU_RET_FOUND_IMM(Pjp, offset);
|
||||
}
|
||||
|
||||
case cJ1_JPIMMED_7_02: IMM(2, Imm7);
|
||||
|
||||
Imm7:
|
||||
{
|
||||
Word_t lsb;
|
||||
SETOFFSET_IMM(offset, Count0, pop1lower);
|
||||
JU_COPY7_PINDEX_TO_LONG(lsb, ((uint8_t *) PJI) + (7 * offset));
|
||||
*PIndex = (*PIndex & (~JU_LEASTBYTESMASK(7))) | lsb;
|
||||
JU_RET_FOUND_IMM(Pjp, offset);
|
||||
}
|
||||
#endif // (JUDY1 && JU_64BIT)
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// UNEXPECTED JP TYPES:
|
||||
|
||||
default: JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT);
|
||||
JUDY1CODE(return(JERRI );)
|
||||
JUDYLCODE(return(PPJERR);)
|
||||
|
||||
} // SMByCount switch.
|
||||
|
||||
/*NOTREACHED*/
|
||||
|
||||
} // Judy1ByCount() / JudyLByCount()
|
1942
dlls/arrayx/Judy-1.0.1/src/Judy1/Judy1Cascade.c
Normal file
1942
dlls/arrayx/Judy-1.0.1/src/Judy1/Judy1Cascade.c
Normal file
File diff suppressed because it is too large
Load Diff
1195
dlls/arrayx/Judy-1.0.1/src/Judy1/Judy1Count.c
Normal file
1195
dlls/arrayx/Judy-1.0.1/src/Judy1/Judy1Count.c
Normal file
File diff suppressed because it is too large
Load Diff
314
dlls/arrayx/Judy-1.0.1/src/Judy1/Judy1CreateBranch.c
Normal file
314
dlls/arrayx/Judy-1.0.1/src/Judy1/Judy1CreateBranch.c
Normal file
|
@ -0,0 +1,314 @@
|
|||
// Copyright (C) 2000 - 2002 Hewlett-Packard Company
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify it
|
||||
// under the term of the GNU Lesser General Public License as published by the
|
||||
// Free Software Foundation; either version 2 of the License, or (at your
|
||||
// option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
// for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with this program; if not, write to the Free Software Foundation,
|
||||
// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
// _________________
|
||||
|
||||
// @(#) $Revision$ $Source$
|
||||
|
||||
// Branch creation functions for Judy1 and JudyL.
|
||||
// Compile with one of -DJUDY1 or -DJUDYL.
|
||||
|
||||
#if (! (defined(JUDY1) || defined(JUDYL)))
|
||||
#error: One of -DJUDY1 or -DJUDYL must be specified.
|
||||
#endif
|
||||
|
||||
#ifdef JUDY1
|
||||
#include "Judy1.h"
|
||||
#else
|
||||
#include "JudyL.h"
|
||||
#endif
|
||||
|
||||
#include "JudyPrivate1L.h"
|
||||
|
||||
|
||||
// ****************************************************************************
|
||||
// J U D Y C R E A T E B R A N C H L
|
||||
//
|
||||
// Build a BranchL from an array of JPs and associated 1 byte digits
|
||||
// (expanses). Return with Pjp pointing to the BranchL. Caller must
|
||||
// deallocate passed arrays, if necessary.
|
||||
//
|
||||
// We have no idea what kind of BranchL it is, so caller must set the jp_Type.
|
||||
//
|
||||
// Return -1 if error (details in Pjpm), otherwise return 1.
|
||||
|
||||
FUNCTION int j__udyCreateBranchL(
|
||||
Pjp_t Pjp, // Build JPs from this place
|
||||
Pjp_t PJPs, // Array of JPs to put into Bitmap branch
|
||||
uint8_t Exp[], // Array of expanses to put into bitmap
|
||||
Word_t ExpCnt, // Number of above JPs and Expanses
|
||||
Pvoid_t Pjpm)
|
||||
{
|
||||
Pjbl_t PjblRaw; // pointer to linear branch.
|
||||
Pjbl_t Pjbl;
|
||||
|
||||
assert(ExpCnt <= cJU_BRANCHLMAXJPS);
|
||||
|
||||
PjblRaw = j__udyAllocJBL(Pjpm);
|
||||
if (PjblRaw == (Pjbl_t) NULL) return(-1);
|
||||
Pjbl = P_JBL(PjblRaw);
|
||||
|
||||
// Build a Linear Branch
|
||||
Pjbl->jbl_NumJPs = ExpCnt;
|
||||
|
||||
// Copy from the Linear branch from splayed leaves
|
||||
JU_COPYMEM(Pjbl->jbl_Expanse, Exp, ExpCnt);
|
||||
JU_COPYMEM(Pjbl->jbl_jp, PJPs, ExpCnt);
|
||||
|
||||
// Pass back new pointer to the Linear branch in JP
|
||||
Pjp->jp_Addr = (Word_t) PjblRaw;
|
||||
|
||||
return(1);
|
||||
|
||||
} // j__udyCreateBranchL()
|
||||
|
||||
|
||||
// ****************************************************************************
|
||||
// J U D Y C R E A T E B R A N C H B
|
||||
//
|
||||
// Build a BranchB from an array of JPs and associated 1 byte digits
|
||||
// (expanses). Return with Pjp pointing to the BranchB. Caller must
|
||||
// deallocate passed arrays, if necessary.
|
||||
//
|
||||
// We have no idea what kind of BranchB it is, so caller must set the jp_Type.
|
||||
//
|
||||
// Return -1 if error (details in Pjpm), otherwise return 1.
|
||||
|
||||
FUNCTION int j__udyCreateBranchB(
|
||||
Pjp_t Pjp, // Build JPs from this place
|
||||
Pjp_t PJPs, // Array of JPs to put into Bitmap branch
|
||||
uint8_t Exp[], // Array of expanses to put into bitmap
|
||||
Word_t ExpCnt, // Number of above JPs and Expanses
|
||||
Pvoid_t Pjpm)
|
||||
{
|
||||
Pjbb_t PjbbRaw; // pointer to bitmap branch.
|
||||
Pjbb_t Pjbb;
|
||||
Word_t ii, jj; // Temps
|
||||
uint8_t CurrSubExp; // Current sub expanse for BM
|
||||
|
||||
// This assertion says the number of populated subexpanses is not too large.
|
||||
// This function is only called when a BranchL overflows to a BranchB or when a
|
||||
// cascade occurs, meaning a leaf overflows. Either way ExpCnt cant be very
|
||||
// large, in fact a lot smaller than cJU_BRANCHBMAXJPS. (Otherwise a BranchU
|
||||
// would be used.) Popping this assertion means something (unspecified) has
|
||||
// gone very wrong, or else Judys design criteria have changed, although in
|
||||
// fact there should be no HARM in creating a BranchB with higher actual
|
||||
// fanout.
|
||||
|
||||
assert(ExpCnt <= cJU_BRANCHBMAXJPS);
|
||||
|
||||
// Get memory for a Bitmap branch
|
||||
PjbbRaw = j__udyAllocJBB(Pjpm);
|
||||
if (PjbbRaw == (Pjbb_t) NULL) return(-1);
|
||||
Pjbb = P_JBB(PjbbRaw);
|
||||
|
||||
// Get 1st "sub" expanse (0..7) of bitmap branch
|
||||
CurrSubExp = Exp[0] / cJU_BITSPERSUBEXPB;
|
||||
|
||||
// Index thru all 1 byte sized expanses:
|
||||
|
||||
for (jj = ii = 0; ii <= ExpCnt; ii++)
|
||||
{
|
||||
Word_t SubExp; // Cannot be a uint8_t
|
||||
|
||||
// Make sure we cover the last one
|
||||
if (ii == ExpCnt)
|
||||
{
|
||||
SubExp = cJU_ALLONES; // Force last one
|
||||
}
|
||||
else
|
||||
{
|
||||
// Calculate the "sub" expanse of the byte expanse
|
||||
SubExp = Exp[ii] / cJU_BITSPERSUBEXPB; // Bits 5..7.
|
||||
|
||||
// Set the bit that represents the expanse in Exp[]
|
||||
JU_JBB_BITMAP(Pjbb, SubExp) |= JU_BITPOSMASKB(Exp[ii]);
|
||||
}
|
||||
// Check if a new "sub" expanse range needed
|
||||
if (SubExp != CurrSubExp)
|
||||
{
|
||||
// Get number of JPs in this sub expanse
|
||||
Word_t NumJP = ii - jj;
|
||||
Pjp_t PjpRaw;
|
||||
Pjp_t Pjp;
|
||||
|
||||
PjpRaw = j__udyAllocJBBJP(NumJP, Pjpm);
|
||||
Pjp = P_JP(PjpRaw);
|
||||
|
||||
if (PjpRaw == (Pjp_t) NULL) // out of memory.
|
||||
{
|
||||
|
||||
// Free any previous allocations:
|
||||
|
||||
while(CurrSubExp--)
|
||||
{
|
||||
NumJP = j__udyCountBitsB(JU_JBB_BITMAP(Pjbb,
|
||||
CurrSubExp));
|
||||
if (NumJP)
|
||||
{
|
||||
j__udyFreeJBBJP(JU_JBB_PJP(Pjbb,
|
||||
CurrSubExp), NumJP, Pjpm);
|
||||
}
|
||||
}
|
||||
j__udyFreeJBB(PjbbRaw, Pjpm);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
// Place the array of JPs in bitmap branch:
|
||||
|
||||
JU_JBB_PJP(Pjbb, CurrSubExp) = PjpRaw;
|
||||
|
||||
// Copy the JPs to new leaf:
|
||||
|
||||
JU_COPYMEM(Pjp, PJPs + jj, NumJP);
|
||||
|
||||
// On to the next bitmap branch "sub" expanse:
|
||||
|
||||
jj = ii;
|
||||
CurrSubExp = SubExp;
|
||||
}
|
||||
} // for each 1-byte expanse
|
||||
|
||||
// Pass back some of the JP to the new Bitmap branch:
|
||||
|
||||
Pjp->jp_Addr = (Word_t) PjbbRaw;
|
||||
|
||||
return(1);
|
||||
|
||||
} // j__udyCreateBranchB()
|
||||
|
||||
|
||||
// ****************************************************************************
|
||||
// J U D Y C R E A T E B R A N C H U
|
||||
//
|
||||
// Build a BranchU from a BranchB. Return with Pjp pointing to the BranchU.
|
||||
// Free the BranchB and its JP subarrays.
|
||||
//
|
||||
// Return -1 if error (details in Pjpm), otherwise return 1.
|
||||
|
||||
FUNCTION int j__udyCreateBranchU(
|
||||
Pjp_t Pjp,
|
||||
Pvoid_t Pjpm)
|
||||
{
|
||||
jp_t JPNull;
|
||||
Pjbu_t PjbuRaw;
|
||||
Pjbu_t Pjbu;
|
||||
Pjbb_t PjbbRaw;
|
||||
Pjbb_t Pjbb;
|
||||
Word_t ii, jj;
|
||||
BITMAPB_t BitMap;
|
||||
Pjp_t PDstJP;
|
||||
#ifdef JU_STAGED_EXP
|
||||
jbu_t BranchU; // Staged uncompressed branch
|
||||
#else
|
||||
|
||||
// Allocate memory for a BranchU:
|
||||
|
||||
PjbuRaw = j__udyAllocJBU(Pjpm);
|
||||
if (PjbuRaw == (Pjbu_t) NULL) return(-1);
|
||||
Pjbu = P_JBU(PjbuRaw);
|
||||
#endif
|
||||
JU_JPSETADT(&JPNull, 0, 0, JU_JPTYPE(Pjp) - cJU_JPBRANCH_B2 + cJU_JPNULL1);
|
||||
|
||||
// Get the pointer to the BranchB:
|
||||
|
||||
PjbbRaw = (Pjbb_t) (Pjp->jp_Addr);
|
||||
Pjbb = P_JBB(PjbbRaw);
|
||||
|
||||
// Set the pointer to the Uncompressed branch
|
||||
#ifdef JU_STAGED_EXP
|
||||
PDstJP = BranchU.jbu_jp;
|
||||
#else
|
||||
PDstJP = Pjbu->jbu_jp;
|
||||
#endif
|
||||
for (ii = 0; ii < cJU_NUMSUBEXPB; ii++)
|
||||
{
|
||||
Pjp_t PjpA;
|
||||
Pjp_t PjpB;
|
||||
|
||||
PjpB = PjpA = P_JP(JU_JBB_PJP(Pjbb, ii));
|
||||
|
||||
// Get the bitmap for this subexpanse
|
||||
BitMap = JU_JBB_BITMAP(Pjbb, ii);
|
||||
|
||||
// NULL empty subexpanses
|
||||
if (BitMap == 0)
|
||||
{
|
||||
// But, fill with NULLs
|
||||
for (jj = 0; jj < cJU_BITSPERSUBEXPB; jj++)
|
||||
{
|
||||
PDstJP[jj] = JPNull;
|
||||
}
|
||||
PDstJP += cJU_BITSPERSUBEXPB;
|
||||
continue;
|
||||
}
|
||||
// Check if Uncompressed subexpanse
|
||||
if (BitMap == cJU_FULLBITMAPB)
|
||||
{
|
||||
// Copy subexpanse to the Uncompressed branch intact
|
||||
JU_COPYMEM(PDstJP, PjpA, cJU_BITSPERSUBEXPB);
|
||||
|
||||
// Bump to next subexpanse
|
||||
PDstJP += cJU_BITSPERSUBEXPB;
|
||||
|
||||
// Set length of subexpanse
|
||||
jj = cJU_BITSPERSUBEXPB;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (jj = 0; jj < cJU_BITSPERSUBEXPB; jj++)
|
||||
{
|
||||
// Copy JP or NULLJP depending on bit
|
||||
if (BitMap & 1) { *PDstJP = *PjpA++; }
|
||||
else { *PDstJP = JPNull; }
|
||||
|
||||
PDstJP++; // advance to next JP
|
||||
BitMap >>= 1;
|
||||
}
|
||||
jj = PjpA - PjpB;
|
||||
}
|
||||
|
||||
// Free the subexpanse:
|
||||
|
||||
j__udyFreeJBBJP(JU_JBB_PJP(Pjbb, ii), jj, Pjpm);
|
||||
|
||||
} // for each JP in BranchU
|
||||
|
||||
#ifdef JU_STAGED_EXP
|
||||
|
||||
// Allocate memory for a BranchU:
|
||||
|
||||
PjbuRaw = j__udyAllocJBU(Pjpm);
|
||||
if (PjbuRaw == (Pjbu_t) NULL) return(-1);
|
||||
Pjbu = P_JBU(PjbuRaw);
|
||||
|
||||
// Copy staged branch to newly allocated branch:
|
||||
//
|
||||
// TBD: I think this code is broken.
|
||||
|
||||
*Pjbu = BranchU;
|
||||
|
||||
#endif // JU_STAGED_EXP
|
||||
|
||||
// Finally free the BranchB and put the BranchU in its place:
|
||||
|
||||
j__udyFreeJBB(PjbbRaw, Pjpm);
|
||||
|
||||
Pjp->jp_Addr = (Word_t) PjbuRaw;
|
||||
Pjp->jp_Type += cJU_JPBRANCH_U - cJU_JPBRANCH_B;
|
||||
|
||||
return(1);
|
||||
|
||||
} // j__udyCreateBranchU()
|
1206
dlls/arrayx/Judy-1.0.1/src/Judy1/Judy1Decascade.c
Normal file
1206
dlls/arrayx/Judy-1.0.1/src/Judy1/Judy1Decascade.c
Normal file
File diff suppressed because it is too large
Load Diff
213
dlls/arrayx/Judy-1.0.1/src/Judy1/Judy1First.c
Normal file
213
dlls/arrayx/Judy-1.0.1/src/Judy1/Judy1First.c
Normal file
|
@ -0,0 +1,213 @@
|
|||
// Copyright (C) 2000 - 2002 Hewlett-Packard Company
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify it
|
||||
// under the term of the GNU Lesser General Public License as published by the
|
||||
// Free Software Foundation; either version 2 of the License, or (at your
|
||||
// option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
// for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with this program; if not, write to the Free Software Foundation,
|
||||
// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
// _________________
|
||||
|
||||
// @(#) $Revision$ $Source$
|
||||
//
|
||||
// Judy*First[Empty]() and Judy*Last[Empty]() routines for Judy1 and JudyL.
|
||||
// Compile with one of -DJUDY1 or -DJUDYL.
|
||||
//
|
||||
// These are inclusive versions of Judy*Next[Empty]() and Judy*Prev[Empty]().
|
||||
|
||||
#if (! (defined(JUDY1) || defined(JUDYL)))
|
||||
#error: One of -DJUDY1 or -DJUDYL must be specified.
|
||||
#endif
|
||||
|
||||
#ifdef JUDY1
|
||||
#include "Judy1.h"
|
||||
#else
|
||||
#include "JudyL.h"
|
||||
#endif
|
||||
|
||||
|
||||
// ****************************************************************************
|
||||
// J U D Y 1 F I R S T
|
||||
// J U D Y L F I R S T
|
||||
//
|
||||
// See the manual entry for details.
|
||||
|
||||
#ifdef JUDY1
|
||||
FUNCTION int Judy1First
|
||||
#else
|
||||
FUNCTION PPvoid_t JudyLFirst
|
||||
#endif
|
||||
(
|
||||
Pcvoid_t PArray, // Judy array to search.
|
||||
Word_t * PIndex, // starting point and result.
|
||||
PJError_t PJError // optional, for returning error info.
|
||||
)
|
||||
{
|
||||
if (PIndex == (PWord_t) NULL) // caller error:
|
||||
{
|
||||
JU_SET_ERRNO(PJError, JU_ERRNO_NULLPINDEX);
|
||||
JUDY1CODE(return(JERRI );)
|
||||
JUDYLCODE(return(PPJERR);)
|
||||
}
|
||||
|
||||
#ifdef JUDY1
|
||||
switch (Judy1Test(PArray, *PIndex, PJError))
|
||||
{
|
||||
case 1: return(1); // found *PIndex itself.
|
||||
case 0: return(Judy1Next(PArray, PIndex, PJError));
|
||||
default: return(JERRI);
|
||||
}
|
||||
#else
|
||||
{
|
||||
PPvoid_t PValue;
|
||||
|
||||
if ((PValue = JudyLGet(PArray, *PIndex, PJError)) == PPJERR)
|
||||
return(PPJERR);
|
||||
|
||||
if (PValue != (PPvoid_t) NULL) return(PValue); // found *PIndex.
|
||||
|
||||
return(JudyLNext(PArray, PIndex, PJError));
|
||||
}
|
||||
#endif
|
||||
|
||||
} // Judy1First() / JudyLFirst()
|
||||
|
||||
|
||||
// ****************************************************************************
|
||||
// J U D Y 1 L A S T
|
||||
// J U D Y L L A S T
|
||||
//
|
||||
// See the manual entry for details.
|
||||
|
||||
#ifdef JUDY1
|
||||
FUNCTION int Judy1Last(
|
||||
#else
|
||||
FUNCTION PPvoid_t JudyLLast(
|
||||
#endif
|
||||
Pcvoid_t PArray, // Judy array to search.
|
||||
Word_t * PIndex, // starting point and result.
|
||||
PJError_t PJError) // optional, for returning error info.
|
||||
{
|
||||
if (PIndex == (PWord_t) NULL)
|
||||
{
|
||||
JU_SET_ERRNO(PJError, JU_ERRNO_NULLPINDEX); // caller error.
|
||||
JUDY1CODE(return(JERRI );)
|
||||
JUDYLCODE(return(PPJERR);)
|
||||
}
|
||||
|
||||
#ifdef JUDY1
|
||||
switch (Judy1Test(PArray, *PIndex, PJError))
|
||||
{
|
||||
case 1: return(1); // found *PIndex itself.
|
||||
case 0: return(Judy1Prev(PArray, PIndex, PJError));
|
||||
default: return(JERRI);
|
||||
}
|
||||
#else
|
||||
{
|
||||
PPvoid_t PValue;
|
||||
|
||||
if ((PValue = JudyLGet(PArray, *PIndex, PJError)) == PPJERR)
|
||||
return(PPJERR);
|
||||
|
||||
if (PValue != (PPvoid_t) NULL) return(PValue); // found *PIndex.
|
||||
|
||||
return(JudyLPrev(PArray, PIndex, PJError));
|
||||
}
|
||||
#endif
|
||||
|
||||
} // Judy1Last() / JudyLLast()
|
||||
|
||||
|
||||
// ****************************************************************************
|
||||
// J U D Y 1 F I R S T E M P T Y
|
||||
// J U D Y L F I R S T E M P T Y
|
||||
//
|
||||
// See the manual entry for details.
|
||||
|
||||
#ifdef JUDY1
|
||||
FUNCTION int Judy1FirstEmpty(
|
||||
#else
|
||||
FUNCTION int JudyLFirstEmpty(
|
||||
#endif
|
||||
Pcvoid_t PArray, // Judy array to search.
|
||||
Word_t * PIndex, // starting point and result.
|
||||
PJError_t PJError) // optional, for returning error info.
|
||||
{
|
||||
if (PIndex == (PWord_t) NULL) // caller error:
|
||||
{
|
||||
JU_SET_ERRNO(PJError, JU_ERRNO_NULLPINDEX);
|
||||
return(JERRI);
|
||||
}
|
||||
|
||||
#ifdef JUDY1
|
||||
switch (Judy1Test(PArray, *PIndex, PJError))
|
||||
{
|
||||
case 0: return(1); // found *PIndex itself.
|
||||
case 1: return(Judy1NextEmpty(PArray, PIndex, PJError));
|
||||
default: return(JERRI);
|
||||
}
|
||||
#else
|
||||
{
|
||||
PPvoid_t PValue;
|
||||
|
||||
if ((PValue = JudyLGet(PArray, *PIndex, PJError)) == PPJERR)
|
||||
return(JERRI);
|
||||
|
||||
if (PValue == (PPvoid_t) NULL) return(1); // found *PIndex.
|
||||
|
||||
return(JudyLNextEmpty(PArray, PIndex, PJError));
|
||||
}
|
||||
#endif
|
||||
|
||||
} // Judy1FirstEmpty() / JudyLFirstEmpty()
|
||||
|
||||
|
||||
// ****************************************************************************
|
||||
// J U D Y 1 L A S T E M P T Y
|
||||
// J U D Y L L A S T E M P T Y
|
||||
//
|
||||
// See the manual entry for details.
|
||||
|
||||
#ifdef JUDY1
|
||||
FUNCTION int Judy1LastEmpty(
|
||||
#else
|
||||
FUNCTION int JudyLLastEmpty(
|
||||
#endif
|
||||
Pcvoid_t PArray, // Judy array to search.
|
||||
Word_t * PIndex, // starting point and result.
|
||||
PJError_t PJError) // optional, for returning error info.
|
||||
{
|
||||
if (PIndex == (PWord_t) NULL)
|
||||
{
|
||||
JU_SET_ERRNO(PJError, JU_ERRNO_NULLPINDEX); // caller error.
|
||||
return(JERRI);
|
||||
}
|
||||
|
||||
#ifdef JUDY1
|
||||
switch (Judy1Test(PArray, *PIndex, PJError))
|
||||
{
|
||||
case 0: return(1); // found *PIndex itself.
|
||||
case 1: return(Judy1PrevEmpty(PArray, PIndex, PJError));
|
||||
default: return(JERRI);
|
||||
}
|
||||
#else
|
||||
{
|
||||
PPvoid_t PValue;
|
||||
|
||||
if ((PValue = JudyLGet(PArray, *PIndex, PJError)) == PPJERR)
|
||||
return(JERRI);
|
||||
|
||||
if (PValue == (PPvoid_t) NULL) return(1); // found *PIndex.
|
||||
|
||||
return(JudyLPrevEmpty(PArray, PIndex, PJError));
|
||||
}
|
||||
#endif
|
||||
|
||||
} // Judy1LastEmpty() / JudyLLastEmpty()
|
363
dlls/arrayx/Judy-1.0.1/src/Judy1/Judy1FreeArray.c
Normal file
363
dlls/arrayx/Judy-1.0.1/src/Judy1/Judy1FreeArray.c
Normal file
|
@ -0,0 +1,363 @@
|
|||
// Copyright (C) 2000 - 2002 Hewlett-Packard Company
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify it
|
||||
// under the term of the GNU Lesser General Public License as published by the
|
||||
// Free Software Foundation; either version 2 of the License, or (at your
|
||||
// option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
// for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with this program; if not, write to the Free Software Foundation,
|
||||
// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
// _________________
|
||||
|
||||
// @(#) $Revision$ $Source$
|
||||
//
|
||||
// Judy1FreeArray() and JudyLFreeArray() functions for Judy1 and JudyL.
|
||||
// Compile with one of -DJUDY1 or -DJUDYL.
|
||||
// Return the number of bytes freed from the array.
|
||||
|
||||
#if (! (defined(JUDY1) || defined(JUDYL)))
|
||||
#error: One of -DJUDY1 or -DJUDYL must be specified.
|
||||
#endif
|
||||
|
||||
#ifdef JUDY1
|
||||
#include "Judy1.h"
|
||||
#else
|
||||
#include "JudyL.h"
|
||||
#endif
|
||||
|
||||
#include "JudyPrivate1L.h"
|
||||
|
||||
DBGCODE(extern void JudyCheckPop(Pvoid_t PArray);)
|
||||
|
||||
|
||||
// ****************************************************************************
|
||||
// J U D Y 1 F R E E A R R A Y
|
||||
// J U D Y L F R E E A R R A Y
|
||||
//
|
||||
// See the Judy*(3C) manual entry for details.
|
||||
//
|
||||
// This code is written recursively, at least at first, because thats much
|
||||
// simpler. Hope its fast enough.
|
||||
|
||||
#ifdef JUDY1
|
||||
FUNCTION Word_t Judy1FreeArray
|
||||
#else
|
||||
FUNCTION Word_t JudyLFreeArray
|
||||
#endif
|
||||
(
|
||||
PPvoid_t PPArray, // array to free.
|
||||
PJError_t PJError // optional, for returning error info.
|
||||
)
|
||||
{
|
||||
jpm_t jpm; // local to accumulate free statistics.
|
||||
|
||||
// CHECK FOR NULL POINTER (error by caller):
|
||||
|
||||
if (PPArray == (PPvoid_t) NULL)
|
||||
{
|
||||
JU_SET_ERRNO(PJError, JU_ERRNO_NULLPPARRAY);
|
||||
return(JERR);
|
||||
}
|
||||
|
||||
DBGCODE(JudyCheckPop(*PPArray);)
|
||||
|
||||
// Zero jpm.jpm_Pop0 (meaning the array will be empty in a moment) for accurate
|
||||
// logging in TRACEMI2.
|
||||
|
||||
jpm.jpm_Pop0 = 0; // see above.
|
||||
jpm.jpm_TotalMemWords = 0; // initialize memory freed.
|
||||
|
||||
// Empty array:
|
||||
|
||||
if (P_JLW(*PPArray) == (Pjlw_t) NULL) return(0);
|
||||
|
||||
// PROCESS TOP LEVEL "JRP" BRANCHES AND LEAF:
|
||||
|
||||
if (JU_LEAFW_POP0(*PPArray) < cJU_LEAFW_MAXPOP1) // must be a LEAFW
|
||||
{
|
||||
Pjlw_t Pjlw = P_JLW(*PPArray); // first word of leaf.
|
||||
|
||||
j__udyFreeJLW(Pjlw, Pjlw[0] + 1, &jpm);
|
||||
*PPArray = (Pvoid_t) NULL; // make an empty array.
|
||||
return (-(jpm.jpm_TotalMemWords * cJU_BYTESPERWORD)); // see above.
|
||||
}
|
||||
else
|
||||
|
||||
// Rootstate leaves: just free the leaf:
|
||||
|
||||
// Common code for returning the amount of memory freed.
|
||||
//
|
||||
// Note: In a an ordinary LEAFW, pop0 = *PPArray[0].
|
||||
//
|
||||
// Accumulate (negative) words freed, while freeing objects.
|
||||
// Return the positive bytes freed.
|
||||
|
||||
{
|
||||
Pjpm_t Pjpm = P_JPM(*PPArray);
|
||||
Word_t TotalMem = Pjpm->jpm_TotalMemWords;
|
||||
|
||||
j__udyFreeSM(&(Pjpm->jpm_JP), &jpm); // recurse through tree.
|
||||
j__udyFreeJPM(Pjpm, &jpm);
|
||||
|
||||
// Verify the array was not corrupt. This means that amount of memory freed
|
||||
// (which is negative) is equal to the initial amount:
|
||||
|
||||
if (TotalMem + jpm.jpm_TotalMemWords)
|
||||
{
|
||||
JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT);
|
||||
return(JERR);
|
||||
}
|
||||
|
||||
*PPArray = (Pvoid_t) NULL; // make an empty array.
|
||||
return (TotalMem * cJU_BYTESPERWORD);
|
||||
}
|
||||
|
||||
} // Judy1FreeArray() / JudyLFreeArray()
|
||||
|
||||
|
||||
// ****************************************************************************
|
||||
// __ J U D Y F R E E S M
|
||||
//
|
||||
// Given a pointer to a JP, recursively visit and free (depth first) all nodes
|
||||
// in a Judy array BELOW the JP, but not the JP itself. Accumulate in *Pjpm
|
||||
// the total words freed (as a negative value). "SM" = State Machine.
|
||||
//
|
||||
// Note: Corruption is not detected at this level because during a FreeArray,
|
||||
// if the code hasnt already core dumped, its better to remain silent, even
|
||||
// if some memory has not been freed, than to bother the caller about the
|
||||
// corruption. TBD: Is this true? If not, must list all legitimate JPNULL
|
||||
// and JPIMMED above first, and revert to returning bool_t (see 4.34).
|
||||
|
||||
FUNCTION void j__udyFreeSM(
|
||||
Pjp_t Pjp, // top of Judy (top-state).
|
||||
Pjpm_t Pjpm) // to return words freed.
|
||||
{
|
||||
Word_t Pop1;
|
||||
|
||||
switch (JU_JPTYPE(Pjp))
|
||||
{
|
||||
|
||||
#ifdef JUDY1
|
||||
|
||||
// FULL EXPANSE -- nothing to free for this jp_Type.
|
||||
|
||||
case cJ1_JPFULLPOPU1:
|
||||
break;
|
||||
#endif
|
||||
|
||||
// JUDY BRANCH -- free the sub-tree depth first:
|
||||
|
||||
// LINEAR BRANCH -- visit each JP in the JBLs list, then free the JBL:
|
||||
//
|
||||
// Note: There are no null JPs in a JBL.
|
||||
|
||||
case cJU_JPBRANCH_L:
|
||||
case cJU_JPBRANCH_L2:
|
||||
case cJU_JPBRANCH_L3:
|
||||
#ifdef JU_64BIT
|
||||
case cJU_JPBRANCH_L4:
|
||||
case cJU_JPBRANCH_L5:
|
||||
case cJU_JPBRANCH_L6:
|
||||
case cJU_JPBRANCH_L7:
|
||||
#endif // JU_64BIT
|
||||
{
|
||||
Pjbl_t Pjbl = P_JBL(Pjp->jp_Addr);
|
||||
Word_t offset;
|
||||
|
||||
for (offset = 0; offset < Pjbl->jbl_NumJPs; ++offset)
|
||||
j__udyFreeSM((Pjbl->jbl_jp) + offset, Pjpm);
|
||||
|
||||
j__udyFreeJBL((Pjbl_t) (Pjp->jp_Addr), Pjpm);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
// BITMAP BRANCH -- visit each JP in the JBBs list based on the bitmap, also
|
||||
//
|
||||
// Note: There are no null JPs in a JBB.
|
||||
|
||||
case cJU_JPBRANCH_B:
|
||||
case cJU_JPBRANCH_B2:
|
||||
case cJU_JPBRANCH_B3:
|
||||
#ifdef JU_64BIT
|
||||
case cJU_JPBRANCH_B4:
|
||||
case cJU_JPBRANCH_B5:
|
||||
case cJU_JPBRANCH_B6:
|
||||
case cJU_JPBRANCH_B7:
|
||||
#endif // JU_64BIT
|
||||
{
|
||||
Word_t subexp;
|
||||
Word_t offset;
|
||||
Word_t jpcount;
|
||||
|
||||
Pjbb_t Pjbb = P_JBB(Pjp->jp_Addr);
|
||||
|
||||
for (subexp = 0; subexp < cJU_NUMSUBEXPB; ++subexp)
|
||||
{
|
||||
jpcount = j__udyCountBitsB(JU_JBB_BITMAP(Pjbb, subexp));
|
||||
|
||||
if (jpcount)
|
||||
{
|
||||
for (offset = 0; offset < jpcount; ++offset)
|
||||
{
|
||||
j__udyFreeSM(P_JP(JU_JBB_PJP(Pjbb, subexp)) + offset,
|
||||
Pjpm);
|
||||
}
|
||||
j__udyFreeJBBJP(JU_JBB_PJP(Pjbb, subexp), jpcount, Pjpm);
|
||||
}
|
||||
}
|
||||
j__udyFreeJBB((Pjbb_t) (Pjp->jp_Addr), Pjpm);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
// UNCOMPRESSED BRANCH -- visit each JP in the JBU array, then free the JBU
|
||||
// itself:
|
||||
//
|
||||
// Note: Null JPs are handled during recursion at a lower state.
|
||||
|
||||
case cJU_JPBRANCH_U:
|
||||
case cJU_JPBRANCH_U2:
|
||||
case cJU_JPBRANCH_U3:
|
||||
#ifdef JU_64BIT
|
||||
case cJU_JPBRANCH_U4:
|
||||
case cJU_JPBRANCH_U5:
|
||||
case cJU_JPBRANCH_U6:
|
||||
case cJU_JPBRANCH_U7:
|
||||
#endif // JU_64BIT
|
||||
{
|
||||
Word_t offset;
|
||||
Pjbu_t Pjbu = P_JBU(Pjp->jp_Addr);
|
||||
|
||||
for (offset = 0; offset < cJU_BRANCHUNUMJPS; ++offset)
|
||||
j__udyFreeSM((Pjbu->jbu_jp) + offset, Pjpm);
|
||||
|
||||
j__udyFreeJBU((Pjbu_t) (Pjp->jp_Addr), Pjpm);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
// -- Cases below here terminate and do not recurse. --
|
||||
|
||||
|
||||
// LINEAR LEAF -- just free the leaf; size is computed from jp_Type:
|
||||
//
|
||||
// Note: cJU_JPLEAF1 is a special case, see discussion in ../Judy1/Judy1.h
|
||||
|
||||
#if (defined(JUDYL) || (! defined(JU_64BIT)))
|
||||
case cJU_JPLEAF1:
|
||||
Pop1 = JU_JPLEAF_POP0(Pjp) + 1;
|
||||
j__udyFreeJLL1((Pjll_t) (Pjp->jp_Addr), Pop1, Pjpm);
|
||||
break;
|
||||
#endif
|
||||
|
||||
case cJU_JPLEAF2:
|
||||
Pop1 = JU_JPLEAF_POP0(Pjp) + 1;
|
||||
j__udyFreeJLL2((Pjll_t) (Pjp->jp_Addr), Pop1, Pjpm);
|
||||
break;
|
||||
|
||||
case cJU_JPLEAF3:
|
||||
Pop1 = JU_JPLEAF_POP0(Pjp) + 1;
|
||||
j__udyFreeJLL3((Pjll_t) (Pjp->jp_Addr), Pop1, Pjpm);
|
||||
break;
|
||||
|
||||
#ifdef JU_64BIT
|
||||
case cJU_JPLEAF4:
|
||||
Pop1 = JU_JPLEAF_POP0(Pjp) + 1;
|
||||
j__udyFreeJLL4((Pjll_t) (Pjp->jp_Addr), Pop1, Pjpm);
|
||||
break;
|
||||
|
||||
case cJU_JPLEAF5:
|
||||
Pop1 = JU_JPLEAF_POP0(Pjp) + 1;
|
||||
j__udyFreeJLL5((Pjll_t) (Pjp->jp_Addr), Pop1, Pjpm);
|
||||
break;
|
||||
|
||||
case cJU_JPLEAF6:
|
||||
Pop1 = JU_JPLEAF_POP0(Pjp) + 1;
|
||||
j__udyFreeJLL6((Pjll_t) (Pjp->jp_Addr), Pop1, Pjpm);
|
||||
break;
|
||||
|
||||
case cJU_JPLEAF7:
|
||||
Pop1 = JU_JPLEAF_POP0(Pjp) + 1;
|
||||
j__udyFreeJLL7((Pjll_t) (Pjp->jp_Addr), Pop1, Pjpm);
|
||||
break;
|
||||
#endif // JU_64BIT
|
||||
|
||||
|
||||
// BITMAP LEAF -- free sub-expanse arrays of JPs, then free the JBB.
|
||||
|
||||
case cJU_JPLEAF_B1:
|
||||
{
|
||||
#ifdef JUDYL
|
||||
Word_t subexp;
|
||||
Word_t jpcount;
|
||||
Pjlb_t Pjlb = P_JLB(Pjp->jp_Addr);
|
||||
|
||||
// Free the value areas in the bitmap leaf:
|
||||
|
||||
for (subexp = 0; subexp < cJU_NUMSUBEXPL; ++subexp)
|
||||
{
|
||||
jpcount = j__udyCountBitsL(JU_JLB_BITMAP(Pjlb, subexp));
|
||||
|
||||
if (jpcount)
|
||||
j__udyLFreeJV(JL_JLB_PVALUE(Pjlb, subexp), jpcount, Pjpm);
|
||||
}
|
||||
#endif // JUDYL
|
||||
|
||||
j__udyFreeJLB1((Pjlb_t) (Pjp->jp_Addr), Pjpm);
|
||||
break;
|
||||
|
||||
} // case cJU_JPLEAF_B1
|
||||
|
||||
#ifdef JUDYL
|
||||
|
||||
|
||||
// IMMED*:
|
||||
//
|
||||
// For JUDYL, all non JPIMMED_*_01s have a LeafV which must be freed:
|
||||
|
||||
case cJU_JPIMMED_1_02:
|
||||
case cJU_JPIMMED_1_03:
|
||||
#ifdef JU_64BIT
|
||||
case cJU_JPIMMED_1_04:
|
||||
case cJU_JPIMMED_1_05:
|
||||
case cJU_JPIMMED_1_06:
|
||||
case cJU_JPIMMED_1_07:
|
||||
#endif
|
||||
Pop1 = JU_JPTYPE(Pjp) - cJU_JPIMMED_1_02 + 2;
|
||||
j__udyLFreeJV((Pjv_t) (Pjp->jp_Addr), Pop1, Pjpm);
|
||||
break;
|
||||
|
||||
#ifdef JU_64BIT
|
||||
case cJU_JPIMMED_2_02:
|
||||
case cJU_JPIMMED_2_03:
|
||||
|
||||
Pop1 = JU_JPTYPE(Pjp) - cJU_JPIMMED_2_02 + 2;
|
||||
j__udyLFreeJV((Pjv_t) (Pjp->jp_Addr), Pop1, Pjpm);
|
||||
break;
|
||||
|
||||
case cJU_JPIMMED_3_02:
|
||||
j__udyLFreeJV((Pjv_t) (Pjp->jp_Addr), 2, Pjpm);
|
||||
break;
|
||||
|
||||
#endif // JU_64BIT
|
||||
#endif // JUDYL
|
||||
|
||||
|
||||
// OTHER JPNULL, JPIMMED, OR UNEXPECTED TYPE -- nothing to free for this type:
|
||||
//
|
||||
// Note: Lump together no-op and invalid JP types; see function header
|
||||
// comments.
|
||||
|
||||
default: break;
|
||||
|
||||
} // switch (JU_JPTYPE(Pjp))
|
||||
|
||||
} // j__udyFreeSM()
|
135
dlls/arrayx/Judy-1.0.1/src/Judy1/Judy1InsertBranch.c
Normal file
135
dlls/arrayx/Judy-1.0.1/src/Judy1/Judy1InsertBranch.c
Normal file
|
@ -0,0 +1,135 @@
|
|||
// Copyright (C) 2000 - 2002 Hewlett-Packard Company
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify it
|
||||
// under the term of the GNU Lesser General Public License as published by the
|
||||
// Free Software Foundation; either version 2 of the License, or (at your
|
||||
// option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
// for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with this program; if not, write to the Free Software Foundation,
|
||||
// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
// _________________
|
||||
|
||||
// @(#) $Revision$ $Source$
|
||||
|
||||
// BranchL insertion functions for Judy1 and JudyL.
|
||||
// Compile with one of -DJUDY1 or -DJUDYL.
|
||||
|
||||
#if (! (defined(JUDY1) || defined(JUDYL)))
|
||||
#error: One of -DJUDY1 or -DJUDYL must be specified.
|
||||
#endif
|
||||
|
||||
#ifdef JUDY1
|
||||
#include "Judy1.h"
|
||||
#else
|
||||
#include "JudyL.h"
|
||||
#endif
|
||||
|
||||
#include "JudyPrivate1L.h"
|
||||
|
||||
extern int j__udyCreateBranchL(Pjp_t, Pjp_t, uint8_t *, Word_t, Pvoid_t);
|
||||
|
||||
|
||||
// ****************************************************************************
|
||||
// __ J U D Y I N S E R T B R A N C H
|
||||
//
|
||||
// Insert 2-element BranchL in between Pjp and Pjp->jp_Addr.
|
||||
//
|
||||
// Return -1 if out of memory, otherwise return 1.
|
||||
|
||||
FUNCTION int j__udyInsertBranch(
|
||||
Pjp_t Pjp, // JP containing narrow pointer.
|
||||
Word_t Index, // outlier to Pjp.
|
||||
Word_t BranchLevel, // of what JP points to, mapped from JP type.
|
||||
Pjpm_t Pjpm) // for global accounting.
|
||||
{
|
||||
jp_t JP2 [2];
|
||||
jp_t JP;
|
||||
Pjp_t PjpNull;
|
||||
Word_t XorExp;
|
||||
Word_t Inew, Iold;
|
||||
Word_t DCDMask; // initially for original BranchLevel.
|
||||
int Ret;
|
||||
uint8_t Exp2[2];
|
||||
uint8_t DecodeByteN, DecodeByteO;
|
||||
|
||||
// Get the current mask for the DCD digits:
|
||||
|
||||
DCDMask = cJU_DCDMASK(BranchLevel);
|
||||
|
||||
// Obtain Dcd bits that differ between Index and JP, shifted so the
|
||||
// digit for BranchLevel is the LSB:
|
||||
|
||||
XorExp = ((Index ^ JU_JPDCDPOP0(Pjp)) & (cJU_ALLONES >> cJU_BITSPERBYTE))
|
||||
>> (BranchLevel * cJU_BITSPERBYTE);
|
||||
assert(XorExp); // Index must be an outlier.
|
||||
|
||||
// Count levels between object under narrow pointer and the level at which
|
||||
// the outlier diverges from it, which is always at least initial
|
||||
// BranchLevel + 1, to end up with the level (JP type) at which to insert
|
||||
// the new intervening BranchL:
|
||||
|
||||
do { ++BranchLevel; } while ((XorExp >>= cJU_BITSPERBYTE));
|
||||
assert((BranchLevel > 1) && (BranchLevel < cJU_ROOTSTATE));
|
||||
|
||||
// Get the MSB (highest digit) that differs between the old expanse and
|
||||
// the new Index to insert:
|
||||
|
||||
DecodeByteO = JU_DIGITATSTATE(JU_JPDCDPOP0(Pjp), BranchLevel);
|
||||
DecodeByteN = JU_DIGITATSTATE(Index, BranchLevel);
|
||||
|
||||
assert(DecodeByteO != DecodeByteN);
|
||||
|
||||
// Determine sorted order for old expanse and new Index digits:
|
||||
|
||||
if (DecodeByteN > DecodeByteO) { Iold = 0; Inew = 1; }
|
||||
else { Iold = 1; Inew = 0; }
|
||||
|
||||
// Copy old JP into staging area for new Branch
|
||||
JP2 [Iold] = *Pjp;
|
||||
Exp2[Iold] = DecodeByteO;
|
||||
Exp2[Inew] = DecodeByteN;
|
||||
|
||||
// Create a 2 Expanse Linear branch
|
||||
//
|
||||
// Note: Pjp->jp_Addr is set by j__udyCreateBranchL()
|
||||
|
||||
Ret = j__udyCreateBranchL(Pjp, JP2, Exp2, 2, Pjpm);
|
||||
if (Ret == -1) return(-1);
|
||||
|
||||
// Get Pjp to the NULL of where to do insert
|
||||
PjpNull = ((P_JBL(Pjp->jp_Addr))->jbl_jp) + Inew;
|
||||
|
||||
// Convert to a cJU_JPIMMED_*_01 at the correct level:
|
||||
// Build JP and set type below to: cJU_JPIMMED_X_01
|
||||
JU_JPSETADT(PjpNull, 0, Index, cJU_JPIMMED_1_01 - 2 + BranchLevel);
|
||||
|
||||
// Return pointer to Value area in cJU_JPIMMED_X_01
|
||||
JUDYLCODE(Pjpm->jpm_PValue = (Pjv_t) PjpNull;)
|
||||
|
||||
// The old JP now points to a BranchL that is at higher level. Therefore
|
||||
// it contains excess DCD bits (in the least significant position) that
|
||||
// must be removed (zeroed); that is, they become part of the Pop0
|
||||
// subfield. Note that the remaining (lower) bytes in the Pop0 field do
|
||||
// not change.
|
||||
//
|
||||
// Take from the old DCDMask, which went "down" to a lower BranchLevel,
|
||||
// and zero any high bits that are still in the mask at the new, higher
|
||||
// BranchLevel; then use this mask to zero the bits in jp_DcdPopO:
|
||||
|
||||
// Set old JP to a BranchL at correct level
|
||||
|
||||
Pjp->jp_Type = cJU_JPBRANCH_L2 - 2 + BranchLevel;
|
||||
DCDMask ^= cJU_DCDMASK(BranchLevel);
|
||||
DCDMask = ~DCDMask & JU_JPDCDPOP0(Pjp);
|
||||
JP = *Pjp;
|
||||
JU_JPSETADT(Pjp, JP.jp_Addr, DCDMask, JP.jp_Type);
|
||||
|
||||
return(1);
|
||||
|
||||
} // j__udyInsertBranch()
|
782
dlls/arrayx/Judy-1.0.1/src/Judy1/Judy1MallocIF.c
Normal file
782
dlls/arrayx/Judy-1.0.1/src/Judy1/Judy1MallocIF.c
Normal file
|
@ -0,0 +1,782 @@
|
|||
// Copyright (C) 2000 - 2002 Hewlett-Packard Company
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify it
|
||||
// under the term of the GNU Lesser General Public License as published by the
|
||||
// Free Software Foundation; either version 2 of the License, or (at your
|
||||
// option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
// for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with this program; if not, write to the Free Software Foundation,
|
||||
// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
// _________________
|
||||
|
||||
// @(#) $Revision$ $Source$
|
||||
//
|
||||
// Judy malloc/free interface functions for Judy1 and JudyL.
|
||||
//
|
||||
// Compile with one of -DJUDY1 or -DJUDYL.
|
||||
//
|
||||
// Compile with -DTRACEMI (Malloc Interface) to turn on tracing of malloc/free
|
||||
// calls at the interface level. (See also TRACEMF in lower-level code.)
|
||||
// Use -DTRACEMI2 for a terser format suitable for trace analysis.
|
||||
//
|
||||
// There can be malloc namespace bits in the LSBs of "raw" addresses from most,
|
||||
// but not all, of the j__udy*Alloc*() functions; see also JudyPrivate.h. To
|
||||
// test the Judy code, compile this file with -DMALLOCBITS and use debug flavor
|
||||
// only (for assertions). This test ensures that (a) all callers properly mask
|
||||
// the namespace bits out before dereferencing a pointer (or else a core dump
|
||||
// occurs), and (b) all callers send "raw" (unmasked) addresses to
|
||||
// j__udy*Free*() calls.
|
||||
//
|
||||
// Note: Currently -DDEBUG turns on MALLOCBITS automatically.
|
||||
|
||||
#if (! (defined(JUDY1) || defined(JUDYL)))
|
||||
#error: One of -DJUDY1 or -DJUDYL must be specified.
|
||||
#endif
|
||||
|
||||
#ifdef JUDY1
|
||||
#include "Judy1.h"
|
||||
#else
|
||||
#include "JudyL.h"
|
||||
#endif
|
||||
|
||||
#include "JudyPrivate1L.h"
|
||||
|
||||
// Set "hidden" global j__uMaxWords to the maximum number of words to allocate
|
||||
// to any one array (large enough to have a JPM, otherwise j__uMaxWords is
|
||||
// ignored), to trigger a fake malloc error when the number is exceeded. Note,
|
||||
// this code is always executed, not #ifdefd, because its virtually free.
|
||||
//
|
||||
// Note: To keep the MALLOC macro faster and simpler, set j__uMaxWords to
|
||||
// MAXINT, not zero, by default.
|
||||
|
||||
Word_t j__uMaxWords = ~0UL;
|
||||
|
||||
// This macro hides the faking of a malloc failure:
|
||||
//
|
||||
// Note: To keep this fast, just compare WordsPrev to j__uMaxWords without the
|
||||
// complexity of first adding WordsNow, meaning the trigger point is not
|
||||
// exactly where you might assume, but it shouldnt matter.
|
||||
|
||||
#define MALLOC(MallocFunc,WordsPrev,WordsNow) \
|
||||
(((WordsPrev) > j__uMaxWords) ? 0UL : MallocFunc(WordsNow))
|
||||
|
||||
// Clear words starting at address:
|
||||
//
|
||||
// Note: Only use this for objects that care; in other cases, it doesnt
|
||||
// matter if the objects memory is pre-zeroed.
|
||||
|
||||
#define ZEROWORDS(Addr,Words) \
|
||||
{ \
|
||||
Word_t Words__ = (Words); \
|
||||
PWord_t Addr__ = (PWord_t) (Addr); \
|
||||
while (Words__--) *Addr__++ = 0UL; \
|
||||
}
|
||||
|
||||
#ifdef TRACEMI
|
||||
|
||||
// TRACING SUPPORT:
|
||||
//
|
||||
// Note: For TRACEMI, use a format for address printing compatible with other
|
||||
// tracing facilities; in particular, %x not %lx, to truncate the "noisy" high
|
||||
// part on 64-bit systems.
|
||||
//
|
||||
// TBD: The trace macros need fixing for alternate address types.
|
||||
//
|
||||
// Note: TRACEMI2 supports trace analysis no matter the underlying malloc/free
|
||||
// engine used.
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
static Word_t j__udyMemSequence = 0L; // event sequence number.
|
||||
|
||||
#define TRACE_ALLOC5(a,b,c,d,e) (void) printf(a, (b), c, d)
|
||||
#define TRACE_FREE5( a,b,c,d,e) (void) printf(a, (b), c, d)
|
||||
#define TRACE_ALLOC6(a,b,c,d,e,f) (void) printf(a, (b), c, d, e)
|
||||
#define TRACE_FREE6( a,b,c,d,e,f) (void) printf(a, (b), c, d, e)
|
||||
|
||||
#else
|
||||
|
||||
#ifdef TRACEMI2
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#define b_pw cJU_BYTESPERWORD
|
||||
|
||||
#define TRACE_ALLOC5(a,b,c,d,e) \
|
||||
(void) printf("a %lx %lx %lx\n", (b), (d) * b_pw, e)
|
||||
#define TRACE_FREE5( a,b,c,d,e) \
|
||||
(void) printf("f %lx %lx %lx\n", (b), (d) * b_pw, e)
|
||||
#define TRACE_ALLOC6(a,b,c,d,e,f) \
|
||||
(void) printf("a %lx %lx %lx\n", (b), (e) * b_pw, f)
|
||||
#define TRACE_FREE6( a,b,c,d,e,f) \
|
||||
(void) printf("f %lx %lx %lx\n", (b), (e) * b_pw, f)
|
||||
|
||||
static Word_t j__udyMemSequence = 0L; // event sequence number.
|
||||
|
||||
#else
|
||||
|
||||
#define TRACE_ALLOC5(a,b,c,d,e) // null.
|
||||
#define TRACE_FREE5( a,b,c,d,e) // null.
|
||||
#define TRACE_ALLOC6(a,b,c,d,e,f) // null.
|
||||
#define TRACE_FREE6( a,b,c,d,e,f) // null.
|
||||
|
||||
#endif // ! TRACEMI2
|
||||
#endif // ! TRACEMI
|
||||
|
||||
|
||||
// MALLOC NAMESPACE SUPPORT:
|
||||
|
||||
#if (defined(DEBUG) && (! defined(MALLOCBITS))) // for now, DEBUG => MALLOCBITS:
|
||||
#define MALLOCBITS 1
|
||||
#endif
|
||||
|
||||
#ifdef MALLOCBITS
|
||||
#define MALLOCBITS_VALUE 0x3 // bit pattern to use.
|
||||
#define MALLOCBITS_MASK 0x7 // note: matches mask__ in JudyPrivate.h.
|
||||
|
||||
#define MALLOCBITS_SET( Type,Addr) \
|
||||
((Addr) = (Type) ((Word_t) (Addr) | MALLOCBITS_VALUE))
|
||||
#define MALLOCBITS_TEST(Type,Addr) \
|
||||
assert((((Word_t) (Addr)) & MALLOCBITS_MASK) == MALLOCBITS_VALUE); \
|
||||
((Addr) = (Type) ((Word_t) (Addr) & ~MALLOCBITS_VALUE))
|
||||
#else
|
||||
#define MALLOCBITS_SET( Type,Addr) // null.
|
||||
#define MALLOCBITS_TEST(Type,Addr) // null.
|
||||
#endif
|
||||
|
||||
|
||||
// SAVE ERROR INFORMATION IN A Pjpm:
|
||||
//
|
||||
// "Small" (invalid) Addr values are used to distinguish overrun and no-mem
|
||||
// errors. (TBD, non-zero invalid values are no longer returned from
|
||||
// lower-level functions, that is, JU_ERRNO_OVERRUN is no longer detected.)
|
||||
|
||||
#define J__UDYSETALLOCERROR(Addr) \
|
||||
{ \
|
||||
JU_ERRID(Pjpm) = __LINE__; \
|
||||
if ((Word_t) (Addr) > 0) JU_ERRNO(Pjpm) = JU_ERRNO_OVERRUN; \
|
||||
else JU_ERRNO(Pjpm) = JU_ERRNO_NOMEM; \
|
||||
return(0); \
|
||||
}
|
||||
|
||||
|
||||
// ****************************************************************************
|
||||
// ALLOCATION FUNCTIONS:
|
||||
//
|
||||
// To help the compiler catch coding errors, each function returns a specific
|
||||
// object type.
|
||||
//
|
||||
// Note: Only j__udyAllocJPM() and j__udyAllocJLW() return multiple values <=
|
||||
// sizeof(Word_t) to indicate the type of memory allocation failure. Other
|
||||
// allocation functions convert this failure to a JU_ERRNO.
|
||||
|
||||
|
||||
// Note: Unlike other j__udyAlloc*() functions, Pjpms are returned non-raw,
|
||||
// that is, without malloc namespace or root pointer type bits:
|
||||
|
||||
FUNCTION Pjpm_t j__udyAllocJPM(void)
|
||||
{
|
||||
Word_t Words = sizeof(jpm_t) / cJU_BYTESPERWORD;
|
||||
Pjpm_t Pjpm = (Pjpm_t) MALLOC(JudyMalloc, Words, Words);
|
||||
|
||||
assert((Words * cJU_BYTESPERWORD) == sizeof(jpm_t));
|
||||
|
||||
if ((Word_t) Pjpm > sizeof(Word_t))
|
||||
{
|
||||
ZEROWORDS(Pjpm, Words);
|
||||
Pjpm->jpm_TotalMemWords = Words;
|
||||
}
|
||||
|
||||
TRACE_ALLOC5("0x%x %8lu = j__udyAllocJPM(), Words = %lu\n",
|
||||
Pjpm, j__udyMemSequence++, Words, cJU_LEAFW_MAXPOP1 + 1);
|
||||
// MALLOCBITS_SET(Pjpm_t, Pjpm); // see above.
|
||||
return(Pjpm);
|
||||
|
||||
} // j__udyAllocJPM()
|
||||
|
||||
|
||||
FUNCTION Pjbl_t j__udyAllocJBL(Pjpm_t Pjpm)
|
||||
{
|
||||
Word_t Words = sizeof(jbl_t) / cJU_BYTESPERWORD;
|
||||
Pjbl_t PjblRaw = (Pjbl_t) MALLOC(JudyMallocVirtual,
|
||||
Pjpm->jpm_TotalMemWords, Words);
|
||||
|
||||
assert((Words * cJU_BYTESPERWORD) == sizeof(jbl_t));
|
||||
|
||||
if ((Word_t) PjblRaw > sizeof(Word_t))
|
||||
{
|
||||
ZEROWORDS(P_JBL(PjblRaw), Words);
|
||||
Pjpm->jpm_TotalMemWords += Words;
|
||||
}
|
||||
else { J__UDYSETALLOCERROR(PjblRaw); }
|
||||
|
||||
TRACE_ALLOC5("0x%x %8lu = j__udyAllocJBL(), Words = %lu\n", PjblRaw,
|
||||
j__udyMemSequence++, Words, (Pjpm->jpm_Pop0) + 2);
|
||||
MALLOCBITS_SET(Pjbl_t, PjblRaw);
|
||||
return(PjblRaw);
|
||||
|
||||
} // j__udyAllocJBL()
|
||||
|
||||
|
||||
FUNCTION Pjbb_t j__udyAllocJBB(Pjpm_t Pjpm)
|
||||
{
|
||||
Word_t Words = sizeof(jbb_t) / cJU_BYTESPERWORD;
|
||||
Pjbb_t PjbbRaw = (Pjbb_t) MALLOC(JudyMallocVirtual,
|
||||
Pjpm->jpm_TotalMemWords, Words);
|
||||
|
||||
assert((Words * cJU_BYTESPERWORD) == sizeof(jbb_t));
|
||||
|
||||
if ((Word_t) PjbbRaw > sizeof(Word_t))
|
||||
{
|
||||
ZEROWORDS(P_JBB(PjbbRaw), Words);
|
||||
Pjpm->jpm_TotalMemWords += Words;
|
||||
}
|
||||
else { J__UDYSETALLOCERROR(PjbbRaw); }
|
||||
|
||||
TRACE_ALLOC5("0x%x %8lu = j__udyAllocJBB(), Words = %lu\n", PjbbRaw,
|
||||
j__udyMemSequence++, Words, (Pjpm->jpm_Pop0) + 2);
|
||||
MALLOCBITS_SET(Pjbb_t, PjbbRaw);
|
||||
return(PjbbRaw);
|
||||
|
||||
} // j__udyAllocJBB()
|
||||
|
||||
|
||||
FUNCTION Pjp_t j__udyAllocJBBJP(Word_t NumJPs, Pjpm_t Pjpm)
|
||||
{
|
||||
Word_t Words = JU_BRANCHJP_NUMJPSTOWORDS(NumJPs);
|
||||
Pjp_t PjpRaw;
|
||||
|
||||
PjpRaw = (Pjp_t) MALLOC(JudyMalloc, Pjpm->jpm_TotalMemWords, Words);
|
||||
|
||||
if ((Word_t) PjpRaw > sizeof(Word_t))
|
||||
{
|
||||
Pjpm->jpm_TotalMemWords += Words;
|
||||
}
|
||||
else { J__UDYSETALLOCERROR(PjpRaw); }
|
||||
|
||||
TRACE_ALLOC6("0x%x %8lu = j__udyAllocJBBJP(%lu), Words = %lu\n", PjpRaw,
|
||||
j__udyMemSequence++, NumJPs, Words, (Pjpm->jpm_Pop0) + 2);
|
||||
MALLOCBITS_SET(Pjp_t, PjpRaw);
|
||||
return(PjpRaw);
|
||||
|
||||
} // j__udyAllocJBBJP()
|
||||
|
||||
|
||||
FUNCTION Pjbu_t j__udyAllocJBU(Pjpm_t Pjpm)
|
||||
{
|
||||
Word_t Words = sizeof(jbu_t) / cJU_BYTESPERWORD;
|
||||
Pjbu_t PjbuRaw = (Pjbu_t) MALLOC(JudyMallocVirtual,
|
||||
Pjpm->jpm_TotalMemWords, Words);
|
||||
|
||||
assert((Words * cJU_BYTESPERWORD) == sizeof(jbu_t));
|
||||
|
||||
if ((Word_t) PjbuRaw > sizeof(Word_t))
|
||||
{
|
||||
Pjpm->jpm_TotalMemWords += Words;
|
||||
}
|
||||
else { J__UDYSETALLOCERROR(PjbuRaw); }
|
||||
|
||||
TRACE_ALLOC5("0x%x %8lu = j__udyAllocJBU(), Words = %lu\n", PjbuRaw,
|
||||
j__udyMemSequence++, Words, (Pjpm->jpm_Pop0) + 2);
|
||||
MALLOCBITS_SET(Pjbu_t, PjbuRaw);
|
||||
return(PjbuRaw);
|
||||
|
||||
} // j__udyAllocJBU()
|
||||
|
||||
|
||||
#if (defined(JUDYL) || (! defined(JU_64BIT)))
|
||||
|
||||
FUNCTION Pjll_t j__udyAllocJLL1(Word_t Pop1, Pjpm_t Pjpm)
|
||||
{
|
||||
Word_t Words = JU_LEAF1POPTOWORDS(Pop1);
|
||||
Pjll_t PjllRaw;
|
||||
|
||||
PjllRaw = (Pjll_t) MALLOC(JudyMalloc, Pjpm->jpm_TotalMemWords, Words);
|
||||
|
||||
if ((Word_t) PjllRaw > sizeof(Word_t))
|
||||
{
|
||||
Pjpm->jpm_TotalMemWords += Words;
|
||||
}
|
||||
else { J__UDYSETALLOCERROR(PjllRaw); }
|
||||
|
||||
TRACE_ALLOC6("0x%x %8lu = j__udyAllocJLL1(%lu), Words = %lu\n", PjllRaw,
|
||||
j__udyMemSequence++, Pop1, Words, (Pjpm->jpm_Pop0) + 2);
|
||||
MALLOCBITS_SET(Pjll_t, PjllRaw);
|
||||
return(PjllRaw);
|
||||
|
||||
} // j__udyAllocJLL1()
|
||||
|
||||
#endif // (JUDYL || (! JU_64BIT))
|
||||
|
||||
|
||||
FUNCTION Pjll_t j__udyAllocJLL2(Word_t Pop1, Pjpm_t Pjpm)
|
||||
{
|
||||
Word_t Words = JU_LEAF2POPTOWORDS(Pop1);
|
||||
Pjll_t PjllRaw;
|
||||
|
||||
PjllRaw = (Pjll_t) MALLOC(JudyMalloc, Pjpm->jpm_TotalMemWords, Words);
|
||||
|
||||
if ((Word_t) PjllRaw > sizeof(Word_t))
|
||||
{
|
||||
Pjpm->jpm_TotalMemWords += Words;
|
||||
}
|
||||
else { J__UDYSETALLOCERROR(PjllRaw); }
|
||||
|
||||
TRACE_ALLOC6("0x%x %8lu = j__udyAllocJLL2(%lu), Words = %lu\n", PjllRaw,
|
||||
j__udyMemSequence++, Pop1, Words, (Pjpm->jpm_Pop0) + 2);
|
||||
MALLOCBITS_SET(Pjll_t, PjllRaw);
|
||||
return(PjllRaw);
|
||||
|
||||
} // j__udyAllocJLL2()
|
||||
|
||||
|
||||
FUNCTION Pjll_t j__udyAllocJLL3(Word_t Pop1, Pjpm_t Pjpm)
|
||||
{
|
||||
Word_t Words = JU_LEAF3POPTOWORDS(Pop1);
|
||||
Pjll_t PjllRaw;
|
||||
|
||||
PjllRaw = (Pjll_t) MALLOC(JudyMalloc, Pjpm->jpm_TotalMemWords, Words);
|
||||
|
||||
if ((Word_t) PjllRaw > sizeof(Word_t))
|
||||
{
|
||||
Pjpm->jpm_TotalMemWords += Words;
|
||||
}
|
||||
else { J__UDYSETALLOCERROR(PjllRaw); }
|
||||
|
||||
TRACE_ALLOC6("0x%x %8lu = j__udyAllocJLL3(%lu), Words = %lu\n", PjllRaw,
|
||||
j__udyMemSequence++, Pop1, Words, (Pjpm->jpm_Pop0) + 2);
|
||||
MALLOCBITS_SET(Pjll_t, PjllRaw);
|
||||
return(PjllRaw);
|
||||
|
||||
} // j__udyAllocJLL3()
|
||||
|
||||
|
||||
#ifdef JU_64BIT
|
||||
|
||||
FUNCTION Pjll_t j__udyAllocJLL4(Word_t Pop1, Pjpm_t Pjpm)
|
||||
{
|
||||
Word_t Words = JU_LEAF4POPTOWORDS(Pop1);
|
||||
Pjll_t PjllRaw;
|
||||
|
||||
PjllRaw = (Pjll_t) MALLOC(JudyMalloc, Pjpm->jpm_TotalMemWords, Words);
|
||||
|
||||
if ((Word_t) PjllRaw > sizeof(Word_t))
|
||||
{
|
||||
Pjpm->jpm_TotalMemWords += Words;
|
||||
}
|
||||
else { J__UDYSETALLOCERROR(PjllRaw); }
|
||||
|
||||
TRACE_ALLOC6("0x%x %8lu = j__udyAllocJLL4(%lu), Words = %lu\n", PjllRaw,
|
||||
j__udyMemSequence++, Pop1, Words, (Pjpm->jpm_Pop0) + 2);
|
||||
MALLOCBITS_SET(Pjll_t, PjllRaw);
|
||||
return(PjllRaw);
|
||||
|
||||
} // j__udyAllocJLL4()
|
||||
|
||||
|
||||
FUNCTION Pjll_t j__udyAllocJLL5(Word_t Pop1, Pjpm_t Pjpm)
|
||||
{
|
||||
Word_t Words = JU_LEAF5POPTOWORDS(Pop1);
|
||||
Pjll_t PjllRaw;
|
||||
|
||||
PjllRaw = (Pjll_t) MALLOC(JudyMalloc, Pjpm->jpm_TotalMemWords, Words);
|
||||
|
||||
if ((Word_t) PjllRaw > sizeof(Word_t))
|
||||
{
|
||||
Pjpm->jpm_TotalMemWords += Words;
|
||||
}
|
||||
else { J__UDYSETALLOCERROR(PjllRaw); }
|
||||
|
||||
TRACE_ALLOC6("0x%x %8lu = j__udyAllocJLL5(%lu), Words = %lu\n", PjllRaw,
|
||||
j__udyMemSequence++, Pop1, Words, (Pjpm->jpm_Pop0) + 2);
|
||||
MALLOCBITS_SET(Pjll_t, PjllRaw);
|
||||
return(PjllRaw);
|
||||
|
||||
} // j__udyAllocJLL5()
|
||||
|
||||
|
||||
FUNCTION Pjll_t j__udyAllocJLL6(Word_t Pop1, Pjpm_t Pjpm)
|
||||
{
|
||||
Word_t Words = JU_LEAF6POPTOWORDS(Pop1);
|
||||
Pjll_t PjllRaw;
|
||||
|
||||
PjllRaw = (Pjll_t) MALLOC(JudyMalloc, Pjpm->jpm_TotalMemWords, Words);
|
||||
|
||||
if ((Word_t) PjllRaw > sizeof(Word_t))
|
||||
{
|
||||
Pjpm->jpm_TotalMemWords += Words;
|
||||
}
|
||||
else { J__UDYSETALLOCERROR(PjllRaw); }
|
||||
|
||||
TRACE_ALLOC6("0x%x %8lu = j__udyAllocJLL6(%lu), Words = %lu\n", PjllRaw,
|
||||
j__udyMemSequence++, Pop1, Words, (Pjpm->jpm_Pop0) + 2);
|
||||
MALLOCBITS_SET(Pjll_t, PjllRaw);
|
||||
return(PjllRaw);
|
||||
|
||||
} // j__udyAllocJLL6()
|
||||
|
||||
|
||||
FUNCTION Pjll_t j__udyAllocJLL7(Word_t Pop1, Pjpm_t Pjpm)
|
||||
{
|
||||
Word_t Words = JU_LEAF7POPTOWORDS(Pop1);
|
||||
Pjll_t PjllRaw;
|
||||
|
||||
PjllRaw = (Pjll_t) MALLOC(JudyMalloc, Pjpm->jpm_TotalMemWords, Words);
|
||||
|
||||
if ((Word_t) PjllRaw > sizeof(Word_t))
|
||||
{
|
||||
Pjpm->jpm_TotalMemWords += Words;
|
||||
}
|
||||
else { J__UDYSETALLOCERROR(PjllRaw); }
|
||||
|
||||
TRACE_ALLOC6("0x%x %8lu = j__udyAllocJLL7(%lu), Words = %lu\n", PjllRaw,
|
||||
j__udyMemSequence++, Pop1, Words, (Pjpm->jpm_Pop0) + 2);
|
||||
MALLOCBITS_SET(Pjll_t, PjllRaw);
|
||||
return(PjllRaw);
|
||||
|
||||
} // j__udyAllocJLL7()
|
||||
|
||||
#endif // JU_64BIT
|
||||
|
||||
|
||||
// Note: Root-level leaf addresses are always whole words (Pjlw_t), and unlike
|
||||
// other j__udyAlloc*() functions, they are returned non-raw, that is, without
|
||||
// malloc namespace or root pointer type bits (the latter are added later by
|
||||
// the caller):
|
||||
|
||||
FUNCTION Pjlw_t j__udyAllocJLW(Word_t Pop1)
|
||||
{
|
||||
Word_t Words = JU_LEAFWPOPTOWORDS(Pop1);
|
||||
Pjlw_t Pjlw = (Pjlw_t) MALLOC(JudyMalloc, Words, Words);
|
||||
|
||||
TRACE_ALLOC6("0x%x %8lu = j__udyAllocJLW(%lu), Words = %lu\n", Pjlw,
|
||||
j__udyMemSequence++, Pop1, Words, Pop1);
|
||||
// MALLOCBITS_SET(Pjlw_t, Pjlw); // see above.
|
||||
return(Pjlw);
|
||||
|
||||
} // j__udyAllocJLW()
|
||||
|
||||
|
||||
FUNCTION Pjlb_t j__udyAllocJLB1(Pjpm_t Pjpm)
|
||||
{
|
||||
Word_t Words = sizeof(jlb_t) / cJU_BYTESPERWORD;
|
||||
Pjlb_t PjlbRaw;
|
||||
|
||||
PjlbRaw = (Pjlb_t) MALLOC(JudyMalloc, Pjpm->jpm_TotalMemWords, Words);
|
||||
|
||||
assert((Words * cJU_BYTESPERWORD) == sizeof(jlb_t));
|
||||
|
||||
if ((Word_t) PjlbRaw > sizeof(Word_t))
|
||||
{
|
||||
ZEROWORDS(P_JLB(PjlbRaw), Words);
|
||||
Pjpm->jpm_TotalMemWords += Words;
|
||||
}
|
||||
else { J__UDYSETALLOCERROR(PjlbRaw); }
|
||||
|
||||
TRACE_ALLOC5("0x%x %8lu = j__udyAllocJLB1(), Words = %lu\n", PjlbRaw,
|
||||
j__udyMemSequence++, Words, (Pjpm->jpm_Pop0) + 2);
|
||||
MALLOCBITS_SET(Pjlb_t, PjlbRaw);
|
||||
return(PjlbRaw);
|
||||
|
||||
} // j__udyAllocJLB1()
|
||||
|
||||
|
||||
#ifdef JUDYL
|
||||
|
||||
FUNCTION Pjv_t j__udyLAllocJV(Word_t Pop1, Pjpm_t Pjpm)
|
||||
{
|
||||
Word_t Words = JL_LEAFVPOPTOWORDS(Pop1);
|
||||
Pjv_t PjvRaw;
|
||||
|
||||
PjvRaw = (Pjv_t) MALLOC(JudyMalloc, Pjpm->jpm_TotalMemWords, Words);
|
||||
|
||||
if ((Word_t) PjvRaw > sizeof(Word_t))
|
||||
{
|
||||
Pjpm->jpm_TotalMemWords += Words;
|
||||
}
|
||||
else { J__UDYSETALLOCERROR(PjvRaw); }
|
||||
|
||||
TRACE_ALLOC6("0x%x %8lu = j__udyLAllocJV(%lu), Words = %lu\n", PjvRaw,
|
||||
j__udyMemSequence++, Pop1, Words, (Pjpm->jpm_Pop0) + 2);
|
||||
MALLOCBITS_SET(Pjv_t, PjvRaw);
|
||||
return(PjvRaw);
|
||||
|
||||
} // j__udyLAllocJV()
|
||||
|
||||
#endif // JUDYL
|
||||
|
||||
|
||||
// ****************************************************************************
|
||||
// FREE FUNCTIONS:
|
||||
//
|
||||
// To help the compiler catch coding errors, each function takes a specific
|
||||
// object type to free.
|
||||
|
||||
|
||||
// Note: j__udyFreeJPM() receives a root pointer with NO root pointer type
|
||||
// bits present, that is, they must be stripped by the caller using P_JPM():
|
||||
|
||||
FUNCTION void j__udyFreeJPM(Pjpm_t PjpmFree, Pjpm_t PjpmStats)
|
||||
{
|
||||
Word_t Words = sizeof(jpm_t) / cJU_BYTESPERWORD;
|
||||
|
||||
// MALLOCBITS_TEST(Pjpm_t, PjpmFree); // see above.
|
||||
JudyFree((Pvoid_t) PjpmFree, Words);
|
||||
|
||||
if (PjpmStats != (Pjpm_t) NULL) PjpmStats->jpm_TotalMemWords -= Words;
|
||||
|
||||
// Note: Log PjpmFree->jpm_Pop0, similar to other j__udyFree*() functions, not
|
||||
// an assumed value of cJU_LEAFW_MAXPOP1, for when the caller is
|
||||
// Judy*FreeArray(), jpm_Pop0 is set to 0, and the population after the free
|
||||
// really will be 0, not cJU_LEAFW_MAXPOP1.
|
||||
|
||||
TRACE_FREE6("0x%x %8lu = j__udyFreeJPM(%lu), Words = %lu\n", PjpmFree,
|
||||
j__udyMemSequence++, Words, Words, PjpmFree->jpm_Pop0);
|
||||
|
||||
|
||||
} // j__udyFreeJPM()
|
||||
|
||||
|
||||
FUNCTION void j__udyFreeJBL(Pjbl_t Pjbl, Pjpm_t Pjpm)
|
||||
{
|
||||
Word_t Words = sizeof(jbl_t) / cJU_BYTESPERWORD;
|
||||
|
||||
MALLOCBITS_TEST(Pjbl_t, Pjbl);
|
||||
JudyFreeVirtual((Pvoid_t) Pjbl, Words);
|
||||
|
||||
Pjpm->jpm_TotalMemWords -= Words;
|
||||
|
||||
TRACE_FREE5("0x%x %8lu = j__udyFreeJBL(), Words = %lu\n", Pjbl,
|
||||
j__udyMemSequence++, Words, Pjpm->jpm_Pop0);
|
||||
|
||||
|
||||
} // j__udyFreeJBL()
|
||||
|
||||
|
||||
FUNCTION void j__udyFreeJBB(Pjbb_t Pjbb, Pjpm_t Pjpm)
|
||||
{
|
||||
Word_t Words = sizeof(jbb_t) / cJU_BYTESPERWORD;
|
||||
|
||||
MALLOCBITS_TEST(Pjbb_t, Pjbb);
|
||||
JudyFreeVirtual((Pvoid_t) Pjbb, Words);
|
||||
|
||||
Pjpm->jpm_TotalMemWords -= Words;
|
||||
|
||||
TRACE_FREE5("0x%x %8lu = j__udyFreeJBB(), Words = %lu\n", Pjbb,
|
||||
j__udyMemSequence++, Words, Pjpm->jpm_Pop0);
|
||||
|
||||
|
||||
} // j__udyFreeJBB()
|
||||
|
||||
|
||||
FUNCTION void j__udyFreeJBBJP(Pjp_t Pjp, Word_t NumJPs, Pjpm_t Pjpm)
|
||||
{
|
||||
Word_t Words = JU_BRANCHJP_NUMJPSTOWORDS(NumJPs);
|
||||
|
||||
MALLOCBITS_TEST(Pjp_t, Pjp);
|
||||
JudyFree((Pvoid_t) Pjp, Words);
|
||||
|
||||
Pjpm->jpm_TotalMemWords -= Words;
|
||||
|
||||
TRACE_FREE6("0x%x %8lu = j__udyFreeJBBJP(%lu), Words = %lu\n", Pjp,
|
||||
j__udyMemSequence++, NumJPs, Words, Pjpm->jpm_Pop0);
|
||||
|
||||
|
||||
} // j__udyFreeJBBJP()
|
||||
|
||||
|
||||
FUNCTION void j__udyFreeJBU(Pjbu_t Pjbu, Pjpm_t Pjpm)
|
||||
{
|
||||
Word_t Words = sizeof(jbu_t) / cJU_BYTESPERWORD;
|
||||
|
||||
MALLOCBITS_TEST(Pjbu_t, Pjbu);
|
||||
JudyFreeVirtual((Pvoid_t) Pjbu, Words);
|
||||
|
||||
Pjpm->jpm_TotalMemWords -= Words;
|
||||
|
||||
TRACE_FREE5("0x%x %8lu = j__udyFreeJBU(), Words = %lu\n", Pjbu,
|
||||
j__udyMemSequence++, Words, Pjpm->jpm_Pop0);
|
||||
|
||||
|
||||
} // j__udyFreeJBU()
|
||||
|
||||
|
||||
#if (defined(JUDYL) || (! defined(JU_64BIT)))
|
||||
|
||||
FUNCTION void j__udyFreeJLL1(Pjll_t Pjll, Word_t Pop1, Pjpm_t Pjpm)
|
||||
{
|
||||
Word_t Words = JU_LEAF1POPTOWORDS(Pop1);
|
||||
|
||||
MALLOCBITS_TEST(Pjll_t, Pjll);
|
||||
JudyFree((Pvoid_t) Pjll, Words);
|
||||
|
||||
Pjpm->jpm_TotalMemWords -= Words;
|
||||
|
||||
TRACE_FREE6("0x%x %8lu = j__udyFreeJLL1(%lu), Words = %lu\n", Pjll,
|
||||
j__udyMemSequence++, Pop1, Words, Pjpm->jpm_Pop0);
|
||||
|
||||
|
||||
} // j__udyFreeJLL1()
|
||||
|
||||
#endif // (JUDYL || (! JU_64BIT))
|
||||
|
||||
|
||||
FUNCTION void j__udyFreeJLL2(Pjll_t Pjll, Word_t Pop1, Pjpm_t Pjpm)
|
||||
{
|
||||
Word_t Words = JU_LEAF2POPTOWORDS(Pop1);
|
||||
|
||||
MALLOCBITS_TEST(Pjll_t, Pjll);
|
||||
JudyFree((Pvoid_t) Pjll, Words);
|
||||
|
||||
Pjpm->jpm_TotalMemWords -= Words;
|
||||
|
||||
TRACE_FREE6("0x%x %8lu = j__udyFreeJLL2(%lu), Words = %lu\n", Pjll,
|
||||
j__udyMemSequence++, Pop1, Words, Pjpm->jpm_Pop0);
|
||||
|
||||
|
||||
} // j__udyFreeJLL2()
|
||||
|
||||
|
||||
FUNCTION void j__udyFreeJLL3(Pjll_t Pjll, Word_t Pop1, Pjpm_t Pjpm)
|
||||
{
|
||||
Word_t Words = JU_LEAF3POPTOWORDS(Pop1);
|
||||
|
||||
MALLOCBITS_TEST(Pjll_t, Pjll);
|
||||
JudyFree((Pvoid_t) Pjll, Words);
|
||||
|
||||
Pjpm->jpm_TotalMemWords -= Words;
|
||||
|
||||
TRACE_FREE6("0x%x %8lu = j__udyFreeJLL3(%lu), Words = %lu\n", Pjll,
|
||||
j__udyMemSequence++, Pop1, Words, Pjpm->jpm_Pop0);
|
||||
|
||||
|
||||
} // j__udyFreeJLL3()
|
||||
|
||||
|
||||
#ifdef JU_64BIT
|
||||
|
||||
FUNCTION void j__udyFreeJLL4(Pjll_t Pjll, Word_t Pop1, Pjpm_t Pjpm)
|
||||
{
|
||||
Word_t Words = JU_LEAF4POPTOWORDS(Pop1);
|
||||
|
||||
MALLOCBITS_TEST(Pjll_t, Pjll);
|
||||
JudyFree((Pvoid_t) Pjll, Words);
|
||||
|
||||
Pjpm->jpm_TotalMemWords -= Words;
|
||||
|
||||
TRACE_FREE6("0x%x %8lu = j__udyFreeJLL4(%lu), Words = %lu\n", Pjll,
|
||||
j__udyMemSequence++, Pop1, Words, Pjpm->jpm_Pop0);
|
||||
|
||||
|
||||
} // j__udyFreeJLL4()
|
||||
|
||||
|
||||
FUNCTION void j__udyFreeJLL5(Pjll_t Pjll, Word_t Pop1, Pjpm_t Pjpm)
|
||||
{
|
||||
Word_t Words = JU_LEAF5POPTOWORDS(Pop1);
|
||||
|
||||
MALLOCBITS_TEST(Pjll_t, Pjll);
|
||||
JudyFree((Pvoid_t) Pjll, Words);
|
||||
|
||||
Pjpm->jpm_TotalMemWords -= Words;
|
||||
|
||||
TRACE_FREE6("0x%x %8lu = j__udyFreeJLL5(%lu), Words = %lu\n", Pjll,
|
||||
j__udyMemSequence++, Pop1, Words, Pjpm->jpm_Pop0);
|
||||
|
||||
|
||||
} // j__udyFreeJLL5()
|
||||
|
||||
|
||||
FUNCTION void j__udyFreeJLL6(Pjll_t Pjll, Word_t Pop1, Pjpm_t Pjpm)
|
||||
{
|
||||
Word_t Words = JU_LEAF6POPTOWORDS(Pop1);
|
||||
|
||||
MALLOCBITS_TEST(Pjll_t, Pjll);
|
||||
JudyFree((Pvoid_t) Pjll, Words);
|
||||
|
||||
Pjpm->jpm_TotalMemWords -= Words;
|
||||
|
||||
TRACE_FREE6("0x%x %8lu = j__udyFreeJLL6(%lu), Words = %lu\n", Pjll,
|
||||
j__udyMemSequence++, Pop1, Words, Pjpm->jpm_Pop0);
|
||||
|
||||
|
||||
} // j__udyFreeJLL6()
|
||||
|
||||
|
||||
FUNCTION void j__udyFreeJLL7(Pjll_t Pjll, Word_t Pop1, Pjpm_t Pjpm)
|
||||
{
|
||||
Word_t Words = JU_LEAF7POPTOWORDS(Pop1);
|
||||
|
||||
MALLOCBITS_TEST(Pjll_t, Pjll);
|
||||
JudyFree((Pvoid_t) Pjll, Words);
|
||||
|
||||
Pjpm->jpm_TotalMemWords -= Words;
|
||||
|
||||
TRACE_FREE6("0x%x %8lu = j__udyFreeJLL7(%lu), Words = %lu\n", Pjll,
|
||||
j__udyMemSequence++, Pop1, Words, Pjpm->jpm_Pop0);
|
||||
|
||||
|
||||
} // j__udyFreeJLL7()
|
||||
|
||||
#endif // JU_64BIT
|
||||
|
||||
|
||||
// Note: j__udyFreeJLW() receives a root pointer with NO root pointer type
|
||||
// bits present, that is, they are stripped by P_JLW():
|
||||
|
||||
FUNCTION void j__udyFreeJLW(Pjlw_t Pjlw, Word_t Pop1, Pjpm_t Pjpm)
|
||||
{
|
||||
Word_t Words = JU_LEAFWPOPTOWORDS(Pop1);
|
||||
|
||||
// MALLOCBITS_TEST(Pjlw_t, Pjlw); // see above.
|
||||
JudyFree((Pvoid_t) Pjlw, Words);
|
||||
|
||||
if (Pjpm) Pjpm->jpm_TotalMemWords -= Words;
|
||||
|
||||
TRACE_FREE6("0x%x %8lu = j__udyFreeJLW(%lu), Words = %lu\n", Pjlw,
|
||||
j__udyMemSequence++, Pop1, Words, Pop1 - 1);
|
||||
|
||||
|
||||
} // j__udyFreeJLW()
|
||||
|
||||
|
||||
FUNCTION void j__udyFreeJLB1(Pjlb_t Pjlb, Pjpm_t Pjpm)
|
||||
{
|
||||
Word_t Words = sizeof(jlb_t) / cJU_BYTESPERWORD;
|
||||
|
||||
MALLOCBITS_TEST(Pjlb_t, Pjlb);
|
||||
JudyFree((Pvoid_t) Pjlb, Words);
|
||||
|
||||
Pjpm->jpm_TotalMemWords -= Words;
|
||||
|
||||
TRACE_FREE5("0x%x %8lu = j__udyFreeJLB1(), Words = %lu\n", Pjlb,
|
||||
j__udyMemSequence++, Words, Pjpm->jpm_Pop0);
|
||||
|
||||
|
||||
} // j__udyFreeJLB1()
|
||||
|
||||
|
||||
#ifdef JUDYL
|
||||
|
||||
FUNCTION void j__udyLFreeJV(Pjv_t Pjv, Word_t Pop1, Pjpm_t Pjpm)
|
||||
{
|
||||
Word_t Words = JL_LEAFVPOPTOWORDS(Pop1);
|
||||
|
||||
MALLOCBITS_TEST(Pjv_t, Pjv);
|
||||
JudyFree((Pvoid_t) Pjv, Words);
|
||||
|
||||
Pjpm->jpm_TotalMemWords -= Words;
|
||||
|
||||
TRACE_FREE6("0x%x %8lu = j__udyLFreeJV(%lu), Words = %lu\n", Pjv,
|
||||
j__udyMemSequence++, Pop1, Words, Pjpm->jpm_Pop0);
|
||||
|
||||
|
||||
} // j__udyLFreeJV()
|
||||
|
||||
#endif // JUDYL
|
259
dlls/arrayx/Judy-1.0.1/src/Judy1/Judy1MemActive.c
Normal file
259
dlls/arrayx/Judy-1.0.1/src/Judy1/Judy1MemActive.c
Normal file
|
@ -0,0 +1,259 @@
|
|||
// Copyright (C) 2000 - 2002 Hewlett-Packard Company
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify it
|
||||
// under the term of the GNU Lesser General Public License as published by the
|
||||
// Free Software Foundation; either version 2 of the License, or (at your
|
||||
// option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
// for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with this program; if not, write to the Free Software Foundation,
|
||||
// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
// _________________
|
||||
|
||||
// @(#) $Revision$ $Source$
|
||||
//
|
||||
// Return number of bytes of memory used to support a Judy1/L array.
|
||||
// Compile with one of -DJUDY1 or -DJUDYL.
|
||||
|
||||
#if (! (defined(JUDY1) || defined(JUDYL)))
|
||||
#error: One of -DJUDY1 or -DJUDYL must be specified.
|
||||
#endif
|
||||
|
||||
#ifdef JUDY1
|
||||
#include "Judy1.h"
|
||||
#else
|
||||
#include "JudyL.h"
|
||||
#endif
|
||||
|
||||
#include "JudyPrivate1L.h"
|
||||
|
||||
FUNCTION static Word_t j__udyGetMemActive(Pjp_t);
|
||||
|
||||
|
||||
// ****************************************************************************
|
||||
// J U D Y 1 M E M A C T I V E
|
||||
// J U D Y L M E M A C T I V E
|
||||
|
||||
#ifdef JUDY1
|
||||
FUNCTION Word_t Judy1MemActive
|
||||
#else
|
||||
FUNCTION Word_t JudyLMemActive
|
||||
#endif
|
||||
(
|
||||
Pcvoid_t PArray // from which to retrieve.
|
||||
)
|
||||
{
|
||||
if (PArray == (Pcvoid_t)NULL) return(0);
|
||||
|
||||
if (JU_LEAFW_POP0(PArray) < cJU_LEAFW_MAXPOP1) // must be a LEAFW
|
||||
{
|
||||
Pjlw_t Pjlw = P_JLW(PArray); // first word of leaf.
|
||||
Word_t Words = Pjlw[0] + 1; // population.
|
||||
#ifdef JUDY1
|
||||
return((Words + 1) * sizeof(Word_t));
|
||||
#else
|
||||
return(((Words * 2) + 1) * sizeof(Word_t));
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
Pjpm_t Pjpm = P_JPM(PArray);
|
||||
return(j__udyGetMemActive(&Pjpm->jpm_JP) + sizeof(jpm_t));
|
||||
}
|
||||
|
||||
} // JudyMemActive()
|
||||
|
||||
|
||||
// ****************************************************************************
|
||||
// __ J U D Y G E T M E M A C T I V E
|
||||
|
||||
FUNCTION static Word_t j__udyGetMemActive(
|
||||
Pjp_t Pjp) // top of subtree.
|
||||
{
|
||||
Word_t offset; // in a branch.
|
||||
Word_t Bytes = 0; // actual bytes used at this level.
|
||||
Word_t IdxSz; // bytes per index in leaves
|
||||
|
||||
switch (JU_JPTYPE(Pjp))
|
||||
{
|
||||
|
||||
case cJU_JPBRANCH_L2:
|
||||
case cJU_JPBRANCH_L3:
|
||||
#ifdef JU_64BIT
|
||||
case cJU_JPBRANCH_L4:
|
||||
case cJU_JPBRANCH_L5:
|
||||
case cJU_JPBRANCH_L6:
|
||||
case cJU_JPBRANCH_L7:
|
||||
#endif
|
||||
case cJU_JPBRANCH_L:
|
||||
{
|
||||
Pjbl_t Pjbl = P_JBL(Pjp->jp_Addr);
|
||||
|
||||
for (offset = 0; offset < (Pjbl->jbl_NumJPs); ++offset)
|
||||
Bytes += j__udyGetMemActive((Pjbl->jbl_jp) + offset);
|
||||
|
||||
return(Bytes + sizeof(jbl_t));
|
||||
}
|
||||
|
||||
case cJU_JPBRANCH_B2:
|
||||
case cJU_JPBRANCH_B3:
|
||||
#ifdef JU_64BIT
|
||||
case cJU_JPBRANCH_B4:
|
||||
case cJU_JPBRANCH_B5:
|
||||
case cJU_JPBRANCH_B6:
|
||||
case cJU_JPBRANCH_B7:
|
||||
#endif
|
||||
case cJU_JPBRANCH_B:
|
||||
{
|
||||
Word_t subexp;
|
||||
Word_t jpcount;
|
||||
Pjbb_t Pjbb = P_JBB(Pjp->jp_Addr);
|
||||
|
||||
for (subexp = 0; subexp < cJU_NUMSUBEXPB; ++subexp)
|
||||
{
|
||||
jpcount = j__udyCountBitsB(JU_JBB_BITMAP(Pjbb, subexp));
|
||||
Bytes += jpcount * sizeof(jp_t);
|
||||
|
||||
for (offset = 0; offset < jpcount; ++offset)
|
||||
{
|
||||
Bytes += j__udyGetMemActive(P_JP(JU_JBB_PJP(Pjbb, subexp))
|
||||
+ offset);
|
||||
}
|
||||
}
|
||||
|
||||
return(Bytes + sizeof(jbb_t));
|
||||
}
|
||||
|
||||
case cJU_JPBRANCH_U2:
|
||||
case cJU_JPBRANCH_U3:
|
||||
#ifdef JU_64BIT
|
||||
case cJU_JPBRANCH_U4:
|
||||
case cJU_JPBRANCH_U5:
|
||||
case cJU_JPBRANCH_U6:
|
||||
case cJU_JPBRANCH_U7:
|
||||
#endif
|
||||
case cJU_JPBRANCH_U:
|
||||
{
|
||||
Pjbu_t Pjbu = P_JBU(Pjp->jp_Addr);
|
||||
|
||||
for (offset = 0; offset < cJU_BRANCHUNUMJPS; ++offset)
|
||||
{
|
||||
if (((Pjbu->jbu_jp[offset].jp_Type) >= cJU_JPNULL1)
|
||||
&& ((Pjbu->jbu_jp[offset].jp_Type) <= cJU_JPNULLMAX))
|
||||
{
|
||||
continue; // skip null JP to save time.
|
||||
}
|
||||
|
||||
Bytes += j__udyGetMemActive(Pjbu->jbu_jp + offset);
|
||||
}
|
||||
|
||||
return(Bytes + sizeof(jbu_t));
|
||||
}
|
||||
|
||||
|
||||
// -- Cases below here terminate and do not recurse. --
|
||||
|
||||
#if (defined(JUDYL) || (! defined(JU_64BIT)))
|
||||
case cJU_JPLEAF1: IdxSz = 1; goto LeafWords;
|
||||
#endif
|
||||
case cJU_JPLEAF2: IdxSz = 2; goto LeafWords;
|
||||
case cJU_JPLEAF3: IdxSz = 3; goto LeafWords;
|
||||
#ifdef JU_64BIT
|
||||
case cJU_JPLEAF4: IdxSz = 4; goto LeafWords;
|
||||
case cJU_JPLEAF5: IdxSz = 5; goto LeafWords;
|
||||
case cJU_JPLEAF6: IdxSz = 6; goto LeafWords;
|
||||
case cJU_JPLEAF7: IdxSz = 7; goto LeafWords;
|
||||
#endif
|
||||
LeafWords:
|
||||
|
||||
#ifdef JUDY1
|
||||
return(IdxSz * (JU_JPLEAF_POP0(Pjp) + 1));
|
||||
#else
|
||||
return((IdxSz + sizeof(Word_t))
|
||||
* (JU_JPLEAF_POP0(Pjp) + 1));
|
||||
#endif
|
||||
case cJU_JPLEAF_B1:
|
||||
{
|
||||
#ifdef JUDY1
|
||||
return(sizeof(jlb_t));
|
||||
#else
|
||||
Bytes = (JU_JPLEAF_POP0(Pjp) + 1) * sizeof(Word_t);
|
||||
|
||||
return(Bytes + sizeof(jlb_t));
|
||||
#endif
|
||||
}
|
||||
|
||||
JUDY1CODE(case cJ1_JPFULLPOPU1: return(0);)
|
||||
|
||||
#ifdef JUDY1
|
||||
#define J__Mpy 0
|
||||
#else
|
||||
#define J__Mpy sizeof(Word_t)
|
||||
#endif
|
||||
|
||||
case cJU_JPIMMED_1_01: return(0);
|
||||
case cJU_JPIMMED_2_01: return(0);
|
||||
case cJU_JPIMMED_3_01: return(0);
|
||||
#ifdef JU_64BIT
|
||||
case cJU_JPIMMED_4_01: return(0);
|
||||
case cJU_JPIMMED_5_01: return(0);
|
||||
case cJU_JPIMMED_6_01: return(0);
|
||||
case cJU_JPIMMED_7_01: return(0);
|
||||
#endif
|
||||
|
||||
case cJU_JPIMMED_1_02: return(J__Mpy * 2);
|
||||
case cJU_JPIMMED_1_03: return(J__Mpy * 3);
|
||||
#if (defined(JUDY1) || defined(JU_64BIT))
|
||||
case cJU_JPIMMED_1_04: return(J__Mpy * 4);
|
||||
case cJU_JPIMMED_1_05: return(J__Mpy * 5);
|
||||
case cJU_JPIMMED_1_06: return(J__Mpy * 6);
|
||||
case cJU_JPIMMED_1_07: return(J__Mpy * 7);
|
||||
#endif
|
||||
#if (defined(JUDY1) && defined(JU_64BIT))
|
||||
case cJ1_JPIMMED_1_08: return(0);
|
||||
case cJ1_JPIMMED_1_09: return(0);
|
||||
case cJ1_JPIMMED_1_10: return(0);
|
||||
case cJ1_JPIMMED_1_11: return(0);
|
||||
case cJ1_JPIMMED_1_12: return(0);
|
||||
case cJ1_JPIMMED_1_13: return(0);
|
||||
case cJ1_JPIMMED_1_14: return(0);
|
||||
case cJ1_JPIMMED_1_15: return(0);
|
||||
#endif
|
||||
|
||||
#if (defined(JUDY1) || defined(JU_64BIT))
|
||||
case cJU_JPIMMED_2_02: return(J__Mpy * 2);
|
||||
case cJU_JPIMMED_2_03: return(J__Mpy * 3);
|
||||
#endif
|
||||
#if (defined(JUDY1) && defined(JU_64BIT))
|
||||
case cJ1_JPIMMED_2_04: return(0);
|
||||
case cJ1_JPIMMED_2_05: return(0);
|
||||
case cJ1_JPIMMED_2_06: return(0);
|
||||
case cJ1_JPIMMED_2_07: return(0);
|
||||
#endif
|
||||
|
||||
#if (defined(JUDY1) || defined(JU_64BIT))
|
||||
case cJU_JPIMMED_3_02: return(J__Mpy * 2);
|
||||
#endif
|
||||
#if (defined(JUDY1) && defined(JU_64BIT))
|
||||
case cJ1_JPIMMED_3_03: return(0);
|
||||
case cJ1_JPIMMED_3_04: return(0);
|
||||
case cJ1_JPIMMED_3_05: return(0);
|
||||
|
||||
case cJ1_JPIMMED_4_02: return(0);
|
||||
case cJ1_JPIMMED_4_03: return(0);
|
||||
case cJ1_JPIMMED_5_02: return(0);
|
||||
case cJ1_JPIMMED_5_03: return(0);
|
||||
case cJ1_JPIMMED_6_02: return(0);
|
||||
case cJ1_JPIMMED_7_02: return(0);
|
||||
#endif
|
||||
|
||||
} // switch (JU_JPTYPE(Pjp))
|
||||
|
||||
return(0); // to make some compilers happy.
|
||||
|
||||
} // j__udyGetMemActive()
|
61
dlls/arrayx/Judy-1.0.1/src/Judy1/Judy1MemUsed.c
Normal file
61
dlls/arrayx/Judy-1.0.1/src/Judy1/Judy1MemUsed.c
Normal file
|
@ -0,0 +1,61 @@
|
|||
// Copyright (C) 2000 - 2002 Hewlett-Packard Company
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify it
|
||||
// under the term of the GNU Lesser General Public License as published by the
|
||||
// Free Software Foundation; either version 2 of the License, or (at your
|
||||
// option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
// for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with this program; if not, write to the Free Software Foundation,
|
||||
// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
// _________________
|
||||
|
||||
// @(#) $Revision$ $Source$
|
||||
//
|
||||
// Return number of bytes of memory used to support a Judy1/L array.
|
||||
// Compile with one of -DJUDY1 or -DJUDYL.
|
||||
|
||||
#if (! (defined(JUDY1) || defined(JUDYL)))
|
||||
#error: One of -DJUDY1 or -DJUDYL must be specified.
|
||||
#endif
|
||||
|
||||
#ifdef JUDY1
|
||||
#include "Judy1.h"
|
||||
#else
|
||||
#include "JudyL.h"
|
||||
#endif
|
||||
|
||||
#include "JudyPrivate1L.h"
|
||||
|
||||
#ifdef JUDY1
|
||||
FUNCTION Word_t Judy1MemUsed
|
||||
#else // JUDYL
|
||||
FUNCTION Word_t JudyLMemUsed
|
||||
#endif
|
||||
(
|
||||
Pcvoid_t PArray // from which to retrieve.
|
||||
)
|
||||
{
|
||||
Word_t Words = 0;
|
||||
|
||||
if (PArray == (Pcvoid_t) NULL) return(0);
|
||||
|
||||
if (JU_LEAFW_POP0(PArray) < cJU_LEAFW_MAXPOP1) // must be a LEAFW
|
||||
{
|
||||
Pjlw_t Pjlw = P_JLW(PArray); // first word of leaf.
|
||||
Words = JU_LEAFWPOPTOWORDS(Pjlw[0] + 1); // based on pop1.
|
||||
}
|
||||
else
|
||||
{
|
||||
Pjpm_t Pjpm = P_JPM(PArray);
|
||||
Words = Pjpm->jpm_TotalMemWords;
|
||||
}
|
||||
|
||||
return(Words * sizeof(Word_t)); // convert to bytes.
|
||||
|
||||
} // Judy1MemUsed() / JudyLMemUsed()
|
1890
dlls/arrayx/Judy-1.0.1/src/Judy1/Judy1Next.c
Normal file
1890
dlls/arrayx/Judy-1.0.1/src/Judy1/Judy1Next.c
Normal file
File diff suppressed because it is too large
Load Diff
1390
dlls/arrayx/Judy-1.0.1/src/Judy1/Judy1NextEmpty.c
Normal file
1390
dlls/arrayx/Judy-1.0.1/src/Judy1/Judy1NextEmpty.c
Normal file
File diff suppressed because it is too large
Load Diff
1890
dlls/arrayx/Judy-1.0.1/src/Judy1/Judy1Prev.c
Normal file
1890
dlls/arrayx/Judy-1.0.1/src/Judy1/Judy1Prev.c
Normal file
File diff suppressed because it is too large
Load Diff
1390
dlls/arrayx/Judy-1.0.1/src/Judy1/Judy1PrevEmpty.c
Normal file
1390
dlls/arrayx/Judy-1.0.1/src/Judy1/Judy1PrevEmpty.c
Normal file
File diff suppressed because it is too large
Load Diff
1873
dlls/arrayx/Judy-1.0.1/src/Judy1/Judy1Set.c
Normal file
1873
dlls/arrayx/Judy-1.0.1/src/Judy1/Judy1Set.c
Normal file
File diff suppressed because it is too large
Load Diff
1178
dlls/arrayx/Judy-1.0.1/src/Judy1/Judy1SetArray.c
Normal file
1178
dlls/arrayx/Judy-1.0.1/src/Judy1/Judy1SetArray.c
Normal file
File diff suppressed because it is too large
Load Diff
72
dlls/arrayx/Judy-1.0.1/src/Judy1/Judy1Tables.c
Normal file
72
dlls/arrayx/Judy-1.0.1/src/Judy1/Judy1Tables.c
Normal file
|
@ -0,0 +1,72 @@
|
|||
// @(#) From generation tool: $Revision$ $Source$
|
||||
//
|
||||
|
||||
#include "Judy1.h"
|
||||
// Leave the malloc() sizes readable in the binary (via strings(1)):
|
||||
const char * Judy1MallocSizes = "Judy1MallocSizes = 3, 5, 7, 11, 15, 23, 32, 47, 64, Leaf1 = 20";
|
||||
|
||||
|
||||
// object uses 64 words
|
||||
// cJU_BITSPERSUBEXPB = 32
|
||||
const uint8_t
|
||||
j__1_BranchBJPPopToWords[cJU_BITSPERSUBEXPB + 1] =
|
||||
{
|
||||
0,
|
||||
3, 5, 7, 11, 11, 15, 15, 23,
|
||||
23, 23, 23, 32, 32, 32, 32, 32,
|
||||
47, 47, 47, 47, 47, 47, 47, 64,
|
||||
64, 64, 64, 64, 64, 64, 64, 64
|
||||
};
|
||||
|
||||
// object uses 5 words
|
||||
// cJ1_LEAF1_MAXPOP1 = 20
|
||||
const uint8_t
|
||||
j__1_Leaf1PopToWords[cJ1_LEAF1_MAXPOP1 + 1] =
|
||||
{
|
||||
0,
|
||||
3, 3, 3, 3, 3, 3, 3, 3,
|
||||
3, 3, 3, 3, 5, 5, 5, 5,
|
||||
5, 5, 5, 5
|
||||
};
|
||||
|
||||
// object uses 32 words
|
||||
// cJ1_LEAF2_MAXPOP1 = 64
|
||||
const uint8_t
|
||||
j__1_Leaf2PopToWords[cJ1_LEAF2_MAXPOP1 + 1] =
|
||||
{
|
||||
0,
|
||||
3, 3, 3, 3, 3, 3, 5, 5,
|
||||
5, 5, 7, 7, 7, 7, 11, 11,
|
||||
11, 11, 11, 11, 11, 11, 15, 15,
|
||||
15, 15, 15, 15, 15, 15, 23, 23,
|
||||
23, 23, 23, 23, 23, 23, 23, 23,
|
||||
23, 23, 23, 23, 23, 23, 32, 32,
|
||||
32, 32, 32, 32, 32, 32, 32, 32,
|
||||
32, 32, 32, 32, 32, 32, 32, 32
|
||||
};
|
||||
|
||||
// object uses 32 words
|
||||
// cJ1_LEAF3_MAXPOP1 = 42
|
||||
const uint8_t
|
||||
j__1_Leaf3PopToWords[cJ1_LEAF3_MAXPOP1 + 1] =
|
||||
{
|
||||
0,
|
||||
3, 3, 3, 3, 5, 5, 7, 7,
|
||||
7, 11, 11, 11, 11, 11, 15, 15,
|
||||
15, 15, 15, 15, 23, 23, 23, 23,
|
||||
23, 23, 23, 23, 23, 23, 32, 32,
|
||||
32, 32, 32, 32, 32, 32, 32, 32,
|
||||
32, 32
|
||||
};
|
||||
|
||||
// object uses 32 words
|
||||
// cJ1_LEAFW_MAXPOP1 = 31
|
||||
const uint8_t
|
||||
j__1_LeafWPopToWords[cJ1_LEAFW_MAXPOP1 + 1] =
|
||||
{
|
||||
0,
|
||||
3, 3, 5, 5, 7, 7, 11, 11,
|
||||
11, 11, 15, 15, 15, 15, 23, 23,
|
||||
23, 23, 23, 23, 23, 23, 32, 32,
|
||||
32, 32, 32, 32, 32, 32, 32
|
||||
};
|
296
dlls/arrayx/Judy-1.0.1/src/Judy1/Judy1TablesGen.c
Normal file
296
dlls/arrayx/Judy-1.0.1/src/Judy1/Judy1TablesGen.c
Normal file
|
@ -0,0 +1,296 @@
|
|||
// Copyright (C) 2000 - 2002 Hewlett-Packard Company
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify it
|
||||
// under the term of the GNU Lesser General Public License as published by the
|
||||
// Free Software Foundation; either version 2 of the License, or (at your
|
||||
// option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
// for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with this program; if not, write to the Free Software Foundation,
|
||||
// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
// _________________
|
||||
|
||||
// @(#) $Revision$ $Source$
|
||||
|
||||
#ifndef JU_WIN
|
||||
#include <unistd.h> // unavailable on win_*.
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#if (! (defined(JUDY1) || defined(JUDYL)))
|
||||
#error: One of -DJUDY1 or -DJUDYL must be specified.
|
||||
#endif
|
||||
|
||||
#define TERMINATOR 999 // terminator for Alloc tables
|
||||
|
||||
#define BPW sizeof(Word_t) // define bytes per word
|
||||
|
||||
#ifdef JUDY1
|
||||
#include "Judy1.h"
|
||||
#else
|
||||
#include "JudyL.h"
|
||||
#endif
|
||||
|
||||
FILE *fd;
|
||||
|
||||
// Definitions come from header files Judy1.h and JudyL.h:
|
||||
|
||||
int AllocSizes[] = ALLOCSIZES;
|
||||
|
||||
#define ROUNDUP(BYTES,BPW,OFFSETW) \
|
||||
((((BYTES) + (BPW) - 1) / (BPW)) + (OFFSETW))
|
||||
|
||||
|
||||
// ****************************************************************************
|
||||
// G E N T A B L E
|
||||
//
|
||||
// Note: "const" is required for newer compilers.
|
||||
|
||||
FUNCTION void GenTable(
|
||||
const char * TableName, // name of table string
|
||||
const char * TableSize, // dimentioned size string
|
||||
int IndexBytes, // bytes per Index
|
||||
int LeafSize, // number elements in object
|
||||
int ValueBytes, // bytes per Value
|
||||
int OffsetWords) // 1 for LEAFW
|
||||
{
|
||||
int * PAllocSizes = AllocSizes;
|
||||
int OWord;
|
||||
int CurWord;
|
||||
int IWord;
|
||||
int ii;
|
||||
int BytesOfIndex;
|
||||
int BytesOfObject;
|
||||
int Index;
|
||||
int LastWords;
|
||||
int Words [1000] = { 0 };
|
||||
int Offset[1000] = { 0 };
|
||||
int MaxWords;
|
||||
|
||||
MaxWords = ROUNDUP((IndexBytes + ValueBytes) * LeafSize, BPW, OffsetWords);
|
||||
Words[0] = 0;
|
||||
Offset[0] = 0;
|
||||
CurWord = TERMINATOR;
|
||||
|
||||
// Walk through all number of Indexes in table:
|
||||
|
||||
for (Index = 1; /* null */; ++Index)
|
||||
{
|
||||
|
||||
// Calculate byte required for next size:
|
||||
|
||||
BytesOfIndex = IndexBytes * Index;
|
||||
BytesOfObject = (IndexBytes + ValueBytes) * Index;
|
||||
|
||||
// Round up and calculate words required for next size:
|
||||
|
||||
OWord = ROUNDUP(BytesOfObject, BPW, OffsetWords);
|
||||
IWord = ROUNDUP(BytesOfIndex, BPW, OffsetWords);
|
||||
|
||||
// Root-level leaves of population of 1 and 2 do not have the 1 word offset:
|
||||
|
||||
// Save minimum value of offset:
|
||||
|
||||
Offset[Index] = IWord;
|
||||
|
||||
// Round up to next available size of words:
|
||||
|
||||
while (OWord > *PAllocSizes) PAllocSizes++;
|
||||
|
||||
if (Index == LeafSize)
|
||||
{
|
||||
CurWord = Words[Index] = OWord;
|
||||
break;
|
||||
}
|
||||
// end of available sizes ?
|
||||
|
||||
if (*PAllocSizes == TERMINATOR)
|
||||
{
|
||||
fprintf(stderr, "BUG, in %sPopToWords, sizes not big enough for object\n", TableName);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// Save words required and last word:
|
||||
|
||||
if (*PAllocSizes < MaxWords) { CurWord = Words[Index] = *PAllocSizes; }
|
||||
else { CurWord = Words[Index] = MaxWords; }
|
||||
|
||||
} // for each index
|
||||
|
||||
LastWords = TERMINATOR;
|
||||
|
||||
// Round up to largest size in each group of malloc sizes:
|
||||
|
||||
for (ii = LeafSize; ii > 0; ii--)
|
||||
{
|
||||
if (LastWords > (Words[ii] - ii)) LastWords = Offset[ii];
|
||||
else Offset[ii] = LastWords;
|
||||
}
|
||||
|
||||
// Print the PopToWords[] table:
|
||||
|
||||
fprintf(fd,"\n//\tobject uses %d words\n", CurWord);
|
||||
fprintf(fd,"//\t%s = %d\n", TableSize, LeafSize);
|
||||
|
||||
fprintf(fd,"const uint8_t\n");
|
||||
fprintf(fd,"%sPopToWords[%s + 1] =\n", TableName, TableSize);
|
||||
fprintf(fd,"{\n\t 0,");
|
||||
|
||||
for (ii = 1; ii <= LeafSize; ii++)
|
||||
{
|
||||
|
||||
// 8 columns per line, starting with 1:
|
||||
|
||||
if ((ii % 8) == 1) fprintf(fd,"\n\t");
|
||||
|
||||
fprintf(fd,"%2d", Words[ii]);
|
||||
|
||||
// If not last number place comma:
|
||||
|
||||
if (ii != LeafSize) fprintf(fd,", ");
|
||||
}
|
||||
fprintf(fd,"\n};\n");
|
||||
|
||||
// Print the Offset table if needed:
|
||||
|
||||
if (! ValueBytes) return;
|
||||
|
||||
fprintf(fd,"const uint8_t\n");
|
||||
fprintf(fd,"%sOffset[%s + 1] =\n", TableName, TableSize);
|
||||
fprintf(fd,"{\n");
|
||||
fprintf(fd,"\t 0,");
|
||||
|
||||
for (ii = 1; ii <= LeafSize; ii++)
|
||||
{
|
||||
if ((ii % 8) == 1) fprintf(fd,"\n\t");
|
||||
|
||||
fprintf(fd,"%2d", Offset[ii]);
|
||||
|
||||
if (ii != LeafSize) fprintf(fd,", ");
|
||||
}
|
||||
fprintf(fd,"\n};\n");
|
||||
|
||||
} // GenTable()
|
||||
|
||||
|
||||
// ****************************************************************************
|
||||
// M A I N
|
||||
|
||||
FUNCTION int main()
|
||||
{
|
||||
int ii;
|
||||
|
||||
#ifdef JUDY1
|
||||
char *fname = "Judy1Tables.c";
|
||||
#else
|
||||
char *fname = "JudyLTables.c";
|
||||
#endif
|
||||
|
||||
if ((fd = fopen(fname, "w")) == NULL){
|
||||
perror("FATAL ERROR: could not write to Judy[1L]Tables.c file\n");
|
||||
return (-1);
|
||||
}
|
||||
|
||||
|
||||
fprintf(fd,"// @(#) From generation tool: $Revision$ $Source$\n");
|
||||
fprintf(fd,"//\n\n");
|
||||
|
||||
|
||||
// ================================ Judy1 =================================
|
||||
#ifdef JUDY1
|
||||
|
||||
fprintf(fd,"#include \"Judy1.h\"\n");
|
||||
|
||||
fprintf(fd,"// Leave the malloc() sizes readable in the binary (via "
|
||||
"strings(1)):\n");
|
||||
fprintf(fd,"const char * Judy1MallocSizes = \"Judy1MallocSizes =");
|
||||
|
||||
for (ii = 0; AllocSizes[ii] != TERMINATOR; ii++)
|
||||
fprintf(fd," %d,", AllocSizes[ii]);
|
||||
|
||||
#ifndef JU_64BIT
|
||||
fprintf(fd," Leaf1 = %d\";\n\n", cJ1_LEAF1_MAXPOP1);
|
||||
#else
|
||||
fprintf(fd,"\";\n\n"); // no Leaf1 in this case.
|
||||
#endif
|
||||
|
||||
// ================================ 32 bit ================================
|
||||
#ifndef JU_64BIT
|
||||
|
||||
GenTable("j__1_BranchBJP","cJU_BITSPERSUBEXPB", 8, cJU_BITSPERSUBEXPB,0,0);
|
||||
|
||||
GenTable("j__1_Leaf1", "cJ1_LEAF1_MAXPOP1", 1, cJ1_LEAF1_MAXPOP1, 0, 0);
|
||||
GenTable("j__1_Leaf2", "cJ1_LEAF2_MAXPOP1", 2, cJ1_LEAF2_MAXPOP1, 0, 0);
|
||||
GenTable("j__1_Leaf3", "cJ1_LEAF3_MAXPOP1", 3, cJ1_LEAF3_MAXPOP1, 0, 0);
|
||||
GenTable("j__1_LeafW", "cJ1_LEAFW_MAXPOP1", 4, cJ1_LEAFW_MAXPOP1, 0, 1);
|
||||
|
||||
#endif
|
||||
|
||||
// ================================ 64 bit ================================
|
||||
#ifdef JU_64BIT
|
||||
GenTable("j__1_BranchBJP","cJU_BITSPERSUBEXPB",16, cJU_BITSPERSUBEXPB,0,0);
|
||||
|
||||
GenTable("j__1_Leaf2", "cJ1_LEAF2_MAXPOP1", 2, cJ1_LEAF2_MAXPOP1, 0, 0);
|
||||
GenTable("j__1_Leaf3", "cJ1_LEAF3_MAXPOP1", 3, cJ1_LEAF3_MAXPOP1, 0, 0);
|
||||
GenTable("j__1_Leaf4", "cJ1_LEAF4_MAXPOP1", 4, cJ1_LEAF4_MAXPOP1, 0, 0);
|
||||
GenTable("j__1_Leaf5", "cJ1_LEAF5_MAXPOP1", 5, cJ1_LEAF5_MAXPOP1, 0, 0);
|
||||
GenTable("j__1_Leaf6", "cJ1_LEAF6_MAXPOP1", 6, cJ1_LEAF6_MAXPOP1, 0, 0);
|
||||
GenTable("j__1_Leaf7", "cJ1_LEAF7_MAXPOP1", 7, cJ1_LEAF7_MAXPOP1, 0, 0);
|
||||
GenTable("j__1_LeafW", "cJ1_LEAFW_MAXPOP1", 8, cJ1_LEAFW_MAXPOP1, 0, 1);
|
||||
#endif
|
||||
#endif // JUDY1
|
||||
|
||||
|
||||
// ================================ JudyL =================================
|
||||
#ifdef JUDYL
|
||||
|
||||
fprintf(fd,"#include \"JudyL.h\"\n");
|
||||
|
||||
fprintf(fd,"// Leave the malloc() sizes readable in the binary (via "
|
||||
"strings(1)):\n");
|
||||
fprintf(fd,"const char * JudyLMallocSizes = \"JudyLMallocSizes =");
|
||||
|
||||
for (ii = 0; AllocSizes[ii] != TERMINATOR; ii++)
|
||||
fprintf(fd," %d,", AllocSizes[ii]);
|
||||
|
||||
fprintf(fd," Leaf1 = %ld\";\n\n", (Word_t)cJL_LEAF1_MAXPOP1);
|
||||
|
||||
#ifndef JU_64BIT
|
||||
// ================================ 32 bit ================================
|
||||
GenTable("j__L_BranchBJP","cJU_BITSPERSUBEXPB", 8, cJU_BITSPERSUBEXPB, 0,0);
|
||||
|
||||
GenTable("j__L_Leaf1", "cJL_LEAF1_MAXPOP1", 1, cJL_LEAF1_MAXPOP1, BPW,0);
|
||||
GenTable("j__L_Leaf2", "cJL_LEAF2_MAXPOP1", 2, cJL_LEAF2_MAXPOP1, BPW,0);
|
||||
GenTable("j__L_Leaf3", "cJL_LEAF3_MAXPOP1", 3, cJL_LEAF3_MAXPOP1, BPW,0);
|
||||
GenTable("j__L_LeafW", "cJL_LEAFW_MAXPOP1", 4, cJL_LEAFW_MAXPOP1, BPW,1);
|
||||
GenTable("j__L_LeafV", "cJU_BITSPERSUBEXPL", 4, cJU_BITSPERSUBEXPL, 0,0);
|
||||
#endif // 32 BIT
|
||||
|
||||
#ifdef JU_64BIT
|
||||
// ================================ 64 bit ================================
|
||||
GenTable("j__L_BranchBJP","cJU_BITSPERSUBEXPB",16, cJU_BITSPERSUBEXPB, 0,0);
|
||||
|
||||
GenTable("j__L_Leaf1", "cJL_LEAF1_MAXPOP1", 1, cJL_LEAF1_MAXPOP1, BPW,0);
|
||||
GenTable("j__L_Leaf2", "cJL_LEAF2_MAXPOP1", 2, cJL_LEAF2_MAXPOP1, BPW,0);
|
||||
GenTable("j__L_Leaf3", "cJL_LEAF3_MAXPOP1", 3, cJL_LEAF3_MAXPOP1, BPW,0);
|
||||
GenTable("j__L_Leaf4", "cJL_LEAF4_MAXPOP1", 4, cJL_LEAF4_MAXPOP1, BPW,0);
|
||||
GenTable("j__L_Leaf5", "cJL_LEAF5_MAXPOP1", 5, cJL_LEAF5_MAXPOP1, BPW,0);
|
||||
GenTable("j__L_Leaf6", "cJL_LEAF6_MAXPOP1", 6, cJL_LEAF6_MAXPOP1, BPW,0);
|
||||
GenTable("j__L_Leaf7", "cJL_LEAF7_MAXPOP1", 7, cJL_LEAF7_MAXPOP1, BPW,0);
|
||||
GenTable("j__L_LeafW", "cJL_LEAFW_MAXPOP1", 8, cJL_LEAFW_MAXPOP1, BPW,1);
|
||||
GenTable("j__L_LeafV", "cJU_BITSPERSUBEXPL", 8, cJU_BITSPERSUBEXPL, 0,0);
|
||||
#endif // 64 BIT
|
||||
|
||||
#endif // JUDYL
|
||||
fclose(fd);
|
||||
|
||||
return(0);
|
||||
|
||||
} // main()
|
BIN
dlls/arrayx/Judy-1.0.1/src/Judy1/Judy1TablesGen.exe
Normal file
BIN
dlls/arrayx/Judy-1.0.1/src/Judy1/Judy1TablesGen.exe
Normal file
Binary file not shown.
1094
dlls/arrayx/Judy-1.0.1/src/Judy1/Judy1Test.c
Normal file
1094
dlls/arrayx/Judy-1.0.1/src/Judy1/Judy1Test.c
Normal file
File diff suppressed because it is too large
Load Diff
2146
dlls/arrayx/Judy-1.0.1/src/Judy1/Judy1Unset.c
Normal file
2146
dlls/arrayx/Judy-1.0.1/src/Judy1/Judy1Unset.c
Normal file
File diff suppressed because it is too large
Load Diff
48
dlls/arrayx/Judy-1.0.1/src/Judy1/Makefile.am
Normal file
48
dlls/arrayx/Judy-1.0.1/src/Judy1/Makefile.am
Normal file
|
@ -0,0 +1,48 @@
|
|||
INCLUDES = -I. -I.. -I../JudyCommon/
|
||||
AM_CFLAGS = -DJUDY1 @WARN_CFLAGS@
|
||||
|
||||
noinst_LTLIBRARIES = libJudy1.la libnext.la libprev.la libcount.la libinline.la
|
||||
|
||||
libJudy1_la_SOURCES = Judy1Test.c Judy1Tables.c Judy1Set.c Judy1SetArray.c Judy1Unset.c Judy1Cascade.c Judy1Count.c Judy1CreateBranch.c Judy1Decascade.c Judy1First.c Judy1FreeArray.c Judy1InsertBranch.c Judy1MallocIF.c Judy1MemActive.c Judy1MemUsed.c
|
||||
|
||||
libnext_la_SOURCES = Judy1Next.c Judy1NextEmpty.c
|
||||
libnext_la_CFLAGS = $(AM_CFLAGS) -DJUDYNEXT
|
||||
|
||||
libprev_la_SOURCES = Judy1Prev.c Judy1PrevEmpty.c
|
||||
libprev_la_CFLAGS = $(AM_CFLAGS) -DJUDYPREV
|
||||
|
||||
libcount_la_SOURCES = Judy1ByCount.c
|
||||
libcount_la_CFLAGS = $(AM_CFLAGS) -DNOSMARTJBB -DNOSMARTJBU -DNOSMARTJLB
|
||||
|
||||
libinline_la_SOURCES = j__udy1Test.c
|
||||
libinline_la_CFLAGS = $(AM_CFLAGS) -DJUDYGETINLINE
|
||||
|
||||
Judy1Tables.c: Judy1TablesGen.c
|
||||
$(CC) $(INCLUDES) $(AM_CFLAGS) @CFLAGS@ -o Judy1TablesGen Judy1TablesGen.c; ./Judy1TablesGen
|
||||
|
||||
|
||||
Judy1Test.c: copies
|
||||
|
||||
copies:
|
||||
cp -f ../JudyCommon/JudyByCount.c Judy1ByCount.c
|
||||
cp -f ../JudyCommon/JudyCascade.c Judy1Cascade.c
|
||||
cp -f ../JudyCommon/JudyCount.c Judy1Count.c
|
||||
cp -f ../JudyCommon/JudyCreateBranch.c Judy1CreateBranch.c
|
||||
cp -f ../JudyCommon/JudyDecascade.c Judy1Decascade.c
|
||||
cp -f ../JudyCommon/JudyDel.c Judy1Unset.c
|
||||
cp -f ../JudyCommon/JudyFirst.c Judy1First.c
|
||||
cp -f ../JudyCommon/JudyFreeArray.c Judy1FreeArray.c
|
||||
cp -f ../JudyCommon/JudyGet.c Judy1Test.c
|
||||
cp -f ../JudyCommon/JudyGet.c j__udy1Test.c
|
||||
cp -f ../JudyCommon/JudyInsArray.c Judy1SetArray.c
|
||||
cp -f ../JudyCommon/JudyIns.c Judy1Set.c
|
||||
cp -f ../JudyCommon/JudyInsertBranch.c Judy1InsertBranch.c
|
||||
cp -f ../JudyCommon/JudyMallocIF.c Judy1MallocIF.c
|
||||
cp -f ../JudyCommon/JudyMemActive.c Judy1MemActive.c
|
||||
cp -f ../JudyCommon/JudyMemUsed.c Judy1MemUsed.c
|
||||
cp -f ../JudyCommon/JudyPrevNext.c Judy1Next.c
|
||||
cp -f ../JudyCommon/JudyPrevNext.c Judy1Prev.c
|
||||
cp -f ../JudyCommon/JudyPrevNextEmpty.c Judy1NextEmpty.c
|
||||
cp -f ../JudyCommon/JudyPrevNextEmpty.c Judy1PrevEmpty.c
|
||||
cp -f ../JudyCommon/JudyTables.c Judy1TablesGen.c
|
||||
|
558
dlls/arrayx/Judy-1.0.1/src/Judy1/Makefile.in
Normal file
558
dlls/arrayx/Judy-1.0.1/src/Judy1/Makefile.in
Normal file
|
@ -0,0 +1,558 @@
|
|||
# Makefile.in generated by automake 1.9.3 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
# 2003, 2004 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
|
||||
SOURCES = $(libJudy1_la_SOURCES) $(libcount_la_SOURCES) $(libinline_la_SOURCES) $(libnext_la_SOURCES) $(libprev_la_SOURCES)
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
top_builddir = ../..
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
INSTALL = @INSTALL@
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
subdir = src/Judy1
|
||||
DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_HEADER = $(top_builddir)/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
LTLIBRARIES = $(noinst_LTLIBRARIES)
|
||||
libJudy1_la_LIBADD =
|
||||
am_libJudy1_la_OBJECTS = Judy1Test.lo Judy1Tables.lo Judy1Set.lo \
|
||||
Judy1SetArray.lo Judy1Unset.lo Judy1Cascade.lo Judy1Count.lo \
|
||||
Judy1CreateBranch.lo Judy1Decascade.lo Judy1First.lo \
|
||||
Judy1FreeArray.lo Judy1InsertBranch.lo Judy1MallocIF.lo \
|
||||
Judy1MemActive.lo Judy1MemUsed.lo
|
||||
libJudy1_la_OBJECTS = $(am_libJudy1_la_OBJECTS)
|
||||
libcount_la_LIBADD =
|
||||
am_libcount_la_OBJECTS = libcount_la-Judy1ByCount.lo
|
||||
libcount_la_OBJECTS = $(am_libcount_la_OBJECTS)
|
||||
libinline_la_LIBADD =
|
||||
am_libinline_la_OBJECTS = libinline_la-j__udy1Test.lo
|
||||
libinline_la_OBJECTS = $(am_libinline_la_OBJECTS)
|
||||
libnext_la_LIBADD =
|
||||
am_libnext_la_OBJECTS = libnext_la-Judy1Next.lo \
|
||||
libnext_la-Judy1NextEmpty.lo
|
||||
libnext_la_OBJECTS = $(am_libnext_la_OBJECTS)
|
||||
libprev_la_LIBADD =
|
||||
am_libprev_la_OBJECTS = libprev_la-Judy1Prev.lo \
|
||||
libprev_la-Judy1PrevEmpty.lo
|
||||
libprev_la_OBJECTS = $(am_libprev_la_OBJECTS)
|
||||
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
|
||||
depcomp = $(SHELL) $(top_srcdir)/depcomp
|
||||
am__depfiles_maybe = depfiles
|
||||
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
|
||||
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \
|
||||
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
|
||||
$(AM_CFLAGS) $(CFLAGS)
|
||||
CCLD = $(CC)
|
||||
LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
|
||||
$(AM_LDFLAGS) $(LDFLAGS) -o $@
|
||||
SOURCES = $(libJudy1_la_SOURCES) $(libcount_la_SOURCES) \
|
||||
$(libinline_la_SOURCES) $(libnext_la_SOURCES) \
|
||||
$(libprev_la_SOURCES)
|
||||
DIST_SOURCES = $(libJudy1_la_SOURCES) $(libcount_la_SOURCES) \
|
||||
$(libinline_la_SOURCES) $(libnext_la_SOURCES) \
|
||||
$(libprev_la_SOURCES)
|
||||
ETAGS = etags
|
||||
CTAGS = ctags
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AMDEP_FALSE = @AMDEP_FALSE@
|
||||
AMDEP_TRUE = @AMDEP_TRUE@
|
||||
AMTAR = @AMTAR@
|
||||
AR = @AR@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CXX = @CXX@
|
||||
CXXCPP = @CXXCPP@
|
||||
CXXDEPMODE = @CXXDEPMODE@
|
||||
CXXFLAGS = @CXXFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
ECHO = @ECHO@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
F77 = @F77@
|
||||
FFLAGS = @FFLAGS@
|
||||
FLAVOR = @FLAVOR@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
LD = @LD@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LN_S = @LN_S@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAINT = @MAINT@
|
||||
MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
|
||||
MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
OBJEXT = @OBJEXT@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
RANLIB = @RANLIB@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
STRIP = @STRIP@
|
||||
VERSION = @VERSION@
|
||||
VERSION_INFO = @VERSION_INFO@
|
||||
WARN_CFLAGS = @WARN_CFLAGS@
|
||||
ac_ct_AR = @ac_ct_AR@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_CXX = @ac_ct_CXX@
|
||||
ac_ct_F77 = @ac_ct_F77@
|
||||
ac_ct_LD = @ac_ct_LD@
|
||||
ac_ct_RANLIB = @ac_ct_RANLIB@
|
||||
ac_ct_STRIP = @ac_ct_STRIP@
|
||||
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
|
||||
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
|
||||
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
|
||||
am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
build_cpu = @build_cpu@
|
||||
build_os = @build_os@
|
||||
build_vendor = @build_vendor@
|
||||
datadir = @datadir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host = @host@
|
||||
host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
host_os = @host_os@
|
||||
host_vendor = @host_vendor@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target_alias = @target_alias@
|
||||
INCLUDES = -I. -I.. -I../JudyCommon/
|
||||
AM_CFLAGS = -DJUDY1 @WARN_CFLAGS@
|
||||
noinst_LTLIBRARIES = libJudy1.la libnext.la libprev.la libcount.la libinline.la
|
||||
libJudy1_la_SOURCES = Judy1Test.c Judy1Tables.c Judy1Set.c Judy1SetArray.c Judy1Unset.c Judy1Cascade.c Judy1Count.c Judy1CreateBranch.c Judy1Decascade.c Judy1First.c Judy1FreeArray.c Judy1InsertBranch.c Judy1MallocIF.c Judy1MemActive.c Judy1MemUsed.c
|
||||
libnext_la_SOURCES = Judy1Next.c Judy1NextEmpty.c
|
||||
libnext_la_CFLAGS = $(AM_CFLAGS) -DJUDYNEXT
|
||||
libprev_la_SOURCES = Judy1Prev.c Judy1PrevEmpty.c
|
||||
libprev_la_CFLAGS = $(AM_CFLAGS) -DJUDYPREV
|
||||
libcount_la_SOURCES = Judy1ByCount.c
|
||||
libcount_la_CFLAGS = $(AM_CFLAGS) -DNOSMARTJBB -DNOSMARTJBU -DNOSMARTJLB
|
||||
libinline_la_SOURCES = j__udy1Test.c
|
||||
libinline_la_CFLAGS = $(AM_CFLAGS) -DJUDYGETINLINE
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .c .lo .o .obj
|
||||
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
|
||||
&& exit 0; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Judy1/Makefile'; \
|
||||
cd $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu src/Judy1/Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
clean-noinstLTLIBRARIES:
|
||||
-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
|
||||
@list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
|
||||
dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
|
||||
test "$$dir" != "$$p" || dir=.; \
|
||||
echo "rm -f \"$${dir}/so_locations\""; \
|
||||
rm -f "$${dir}/so_locations"; \
|
||||
done
|
||||
libJudy1.la: $(libJudy1_la_OBJECTS) $(libJudy1_la_DEPENDENCIES)
|
||||
$(LINK) $(libJudy1_la_LDFLAGS) $(libJudy1_la_OBJECTS) $(libJudy1_la_LIBADD) $(LIBS)
|
||||
libcount.la: $(libcount_la_OBJECTS) $(libcount_la_DEPENDENCIES)
|
||||
$(LINK) $(libcount_la_LDFLAGS) $(libcount_la_OBJECTS) $(libcount_la_LIBADD) $(LIBS)
|
||||
libinline.la: $(libinline_la_OBJECTS) $(libinline_la_DEPENDENCIES)
|
||||
$(LINK) $(libinline_la_LDFLAGS) $(libinline_la_OBJECTS) $(libinline_la_LIBADD) $(LIBS)
|
||||
libnext.la: $(libnext_la_OBJECTS) $(libnext_la_DEPENDENCIES)
|
||||
$(LINK) $(libnext_la_LDFLAGS) $(libnext_la_OBJECTS) $(libnext_la_LIBADD) $(LIBS)
|
||||
libprev.la: $(libprev_la_OBJECTS) $(libprev_la_DEPENDENCIES)
|
||||
$(LINK) $(libprev_la_LDFLAGS) $(libprev_la_OBJECTS) $(libprev_la_LIBADD) $(LIBS)
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.$(OBJEXT)
|
||||
|
||||
distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Judy1Cascade.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Judy1Count.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Judy1CreateBranch.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Judy1Decascade.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Judy1First.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Judy1FreeArray.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Judy1InsertBranch.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Judy1MallocIF.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Judy1MemActive.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Judy1MemUsed.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Judy1Set.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Judy1SetArray.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Judy1Tables.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Judy1Test.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Judy1Unset.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcount_la-Judy1ByCount.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libinline_la-j__udy1Test.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnext_la-Judy1Next.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnext_la-Judy1NextEmpty.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libprev_la-Judy1Prev.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libprev_la-Judy1PrevEmpty.Plo@am__quote@
|
||||
|
||||
.c.o:
|
||||
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
|
||||
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
|
||||
|
||||
.c.obj:
|
||||
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
|
||||
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
|
||||
|
||||
.c.lo:
|
||||
@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
|
||||
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
|
||||
|
||||
libcount_la-Judy1ByCount.lo: Judy1ByCount.c
|
||||
@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcount_la_CFLAGS) $(CFLAGS) -MT libcount_la-Judy1ByCount.lo -MD -MP -MF "$(DEPDIR)/libcount_la-Judy1ByCount.Tpo" -c -o libcount_la-Judy1ByCount.lo `test -f 'Judy1ByCount.c' || echo '$(srcdir)/'`Judy1ByCount.c; \
|
||||
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libcount_la-Judy1ByCount.Tpo" "$(DEPDIR)/libcount_la-Judy1ByCount.Plo"; else rm -f "$(DEPDIR)/libcount_la-Judy1ByCount.Tpo"; exit 1; fi
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='Judy1ByCount.c' object='libcount_la-Judy1ByCount.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcount_la_CFLAGS) $(CFLAGS) -c -o libcount_la-Judy1ByCount.lo `test -f 'Judy1ByCount.c' || echo '$(srcdir)/'`Judy1ByCount.c
|
||||
|
||||
libinline_la-j__udy1Test.lo: j__udy1Test.c
|
||||
@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libinline_la_CFLAGS) $(CFLAGS) -MT libinline_la-j__udy1Test.lo -MD -MP -MF "$(DEPDIR)/libinline_la-j__udy1Test.Tpo" -c -o libinline_la-j__udy1Test.lo `test -f 'j__udy1Test.c' || echo '$(srcdir)/'`j__udy1Test.c; \
|
||||
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libinline_la-j__udy1Test.Tpo" "$(DEPDIR)/libinline_la-j__udy1Test.Plo"; else rm -f "$(DEPDIR)/libinline_la-j__udy1Test.Tpo"; exit 1; fi
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='j__udy1Test.c' object='libinline_la-j__udy1Test.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libinline_la_CFLAGS) $(CFLAGS) -c -o libinline_la-j__udy1Test.lo `test -f 'j__udy1Test.c' || echo '$(srcdir)/'`j__udy1Test.c
|
||||
|
||||
libnext_la-Judy1Next.lo: Judy1Next.c
|
||||
@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnext_la_CFLAGS) $(CFLAGS) -MT libnext_la-Judy1Next.lo -MD -MP -MF "$(DEPDIR)/libnext_la-Judy1Next.Tpo" -c -o libnext_la-Judy1Next.lo `test -f 'Judy1Next.c' || echo '$(srcdir)/'`Judy1Next.c; \
|
||||
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libnext_la-Judy1Next.Tpo" "$(DEPDIR)/libnext_la-Judy1Next.Plo"; else rm -f "$(DEPDIR)/libnext_la-Judy1Next.Tpo"; exit 1; fi
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='Judy1Next.c' object='libnext_la-Judy1Next.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnext_la_CFLAGS) $(CFLAGS) -c -o libnext_la-Judy1Next.lo `test -f 'Judy1Next.c' || echo '$(srcdir)/'`Judy1Next.c
|
||||
|
||||
libnext_la-Judy1NextEmpty.lo: Judy1NextEmpty.c
|
||||
@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnext_la_CFLAGS) $(CFLAGS) -MT libnext_la-Judy1NextEmpty.lo -MD -MP -MF "$(DEPDIR)/libnext_la-Judy1NextEmpty.Tpo" -c -o libnext_la-Judy1NextEmpty.lo `test -f 'Judy1NextEmpty.c' || echo '$(srcdir)/'`Judy1NextEmpty.c; \
|
||||
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libnext_la-Judy1NextEmpty.Tpo" "$(DEPDIR)/libnext_la-Judy1NextEmpty.Plo"; else rm -f "$(DEPDIR)/libnext_la-Judy1NextEmpty.Tpo"; exit 1; fi
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='Judy1NextEmpty.c' object='libnext_la-Judy1NextEmpty.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnext_la_CFLAGS) $(CFLAGS) -c -o libnext_la-Judy1NextEmpty.lo `test -f 'Judy1NextEmpty.c' || echo '$(srcdir)/'`Judy1NextEmpty.c
|
||||
|
||||
libprev_la-Judy1Prev.lo: Judy1Prev.c
|
||||
@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libprev_la_CFLAGS) $(CFLAGS) -MT libprev_la-Judy1Prev.lo -MD -MP -MF "$(DEPDIR)/libprev_la-Judy1Prev.Tpo" -c -o libprev_la-Judy1Prev.lo `test -f 'Judy1Prev.c' || echo '$(srcdir)/'`Judy1Prev.c; \
|
||||
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libprev_la-Judy1Prev.Tpo" "$(DEPDIR)/libprev_la-Judy1Prev.Plo"; else rm -f "$(DEPDIR)/libprev_la-Judy1Prev.Tpo"; exit 1; fi
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='Judy1Prev.c' object='libprev_la-Judy1Prev.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libprev_la_CFLAGS) $(CFLAGS) -c -o libprev_la-Judy1Prev.lo `test -f 'Judy1Prev.c' || echo '$(srcdir)/'`Judy1Prev.c
|
||||
|
||||
libprev_la-Judy1PrevEmpty.lo: Judy1PrevEmpty.c
|
||||
@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libprev_la_CFLAGS) $(CFLAGS) -MT libprev_la-Judy1PrevEmpty.lo -MD -MP -MF "$(DEPDIR)/libprev_la-Judy1PrevEmpty.Tpo" -c -o libprev_la-Judy1PrevEmpty.lo `test -f 'Judy1PrevEmpty.c' || echo '$(srcdir)/'`Judy1PrevEmpty.c; \
|
||||
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libprev_la-Judy1PrevEmpty.Tpo" "$(DEPDIR)/libprev_la-Judy1PrevEmpty.Plo"; else rm -f "$(DEPDIR)/libprev_la-Judy1PrevEmpty.Tpo"; exit 1; fi
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='Judy1PrevEmpty.c' object='libprev_la-Judy1PrevEmpty.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libprev_la_CFLAGS) $(CFLAGS) -c -o libprev_la-Judy1PrevEmpty.lo `test -f 'Judy1PrevEmpty.c' || echo '$(srcdir)/'`Judy1PrevEmpty.c
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
|
||||
distclean-libtool:
|
||||
-rm -f libtool
|
||||
uninstall-info-am:
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
mkid -fID $$unique
|
||||
tags: TAGS
|
||||
|
||||
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
|
||||
test -n "$$unique" || unique=$$empty_fix; \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
$$tags $$unique; \
|
||||
fi
|
||||
ctags: CTAGS
|
||||
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|
||||
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
||||
$$tags $$unique
|
||||
|
||||
GTAGS:
|
||||
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||
&& cd $(top_srcdir) \
|
||||
&& gtags -i $(GTAGS_ARGS) $$here
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
|
||||
list='$(DISTFILES)'; for file in $$list; do \
|
||||
case $$file in \
|
||||
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
|
||||
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
|
||||
esac; \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
|
||||
dir="/$$dir"; \
|
||||
$(mkdir_p) "$(distdir)$$dir"; \
|
||||
else \
|
||||
dir=''; \
|
||||
fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
|
||||
fi; \
|
||||
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
|
||||
else \
|
||||
test -f $(distdir)/$$file \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
check-am: all-am
|
||||
check: check-am
|
||||
all-am: Makefile $(LTLIBRARIES)
|
||||
installdirs:
|
||||
install: install-am
|
||||
install-exec: install-exec-am
|
||||
install-data: install-data-am
|
||||
uninstall: uninstall-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-am
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
`test -z '$(STRIP)' || \
|
||||
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-am
|
||||
|
||||
clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
|
||||
mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -rf ./$(DEPDIR)
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-compile distclean-generic \
|
||||
distclean-libtool distclean-tags
|
||||
|
||||
dvi: dvi-am
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-am
|
||||
|
||||
info: info-am
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am:
|
||||
|
||||
install-exec-am:
|
||||
|
||||
install-info: install-info-am
|
||||
|
||||
install-man:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
-rm -rf ./$(DEPDIR)
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
|
||||
mostlyclean-libtool
|
||||
|
||||
pdf: pdf-am
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-am
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am: uninstall-info-am
|
||||
|
||||
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
|
||||
clean-libtool clean-noinstLTLIBRARIES ctags distclean \
|
||||
distclean-compile distclean-generic distclean-libtool \
|
||||
distclean-tags distdir dvi dvi-am html html-am info info-am \
|
||||
install install-am install-data install-data-am install-exec \
|
||||
install-exec-am install-info install-info-am install-man \
|
||||
install-strip installcheck installcheck-am installdirs \
|
||||
maintainer-clean maintainer-clean-generic mostlyclean \
|
||||
mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
|
||||
pdf pdf-am ps ps-am tags uninstall uninstall-am \
|
||||
uninstall-info-am
|
||||
|
||||
|
||||
Judy1Tables.c: Judy1TablesGen.c
|
||||
$(CC) $(INCLUDES) $(AM_CFLAGS) @CFLAGS@ -o Judy1TablesGen Judy1TablesGen.c; ./Judy1TablesGen
|
||||
|
||||
Judy1Test.c: copies
|
||||
|
||||
copies:
|
||||
cp -f ../JudyCommon/JudyByCount.c Judy1ByCount.c
|
||||
cp -f ../JudyCommon/JudyCascade.c Judy1Cascade.c
|
||||
cp -f ../JudyCommon/JudyCount.c Judy1Count.c
|
||||
cp -f ../JudyCommon/JudyCreateBranch.c Judy1CreateBranch.c
|
||||
cp -f ../JudyCommon/JudyDecascade.c Judy1Decascade.c
|
||||
cp -f ../JudyCommon/JudyDel.c Judy1Unset.c
|
||||
cp -f ../JudyCommon/JudyFirst.c Judy1First.c
|
||||
cp -f ../JudyCommon/JudyFreeArray.c Judy1FreeArray.c
|
||||
cp -f ../JudyCommon/JudyGet.c Judy1Test.c
|
||||
cp -f ../JudyCommon/JudyGet.c j__udy1Test.c
|
||||
cp -f ../JudyCommon/JudyInsArray.c Judy1SetArray.c
|
||||
cp -f ../JudyCommon/JudyIns.c Judy1Set.c
|
||||
cp -f ../JudyCommon/JudyInsertBranch.c Judy1InsertBranch.c
|
||||
cp -f ../JudyCommon/JudyMallocIF.c Judy1MallocIF.c
|
||||
cp -f ../JudyCommon/JudyMemActive.c Judy1MemActive.c
|
||||
cp -f ../JudyCommon/JudyMemUsed.c Judy1MemUsed.c
|
||||
cp -f ../JudyCommon/JudyPrevNext.c Judy1Next.c
|
||||
cp -f ../JudyCommon/JudyPrevNext.c Judy1Prev.c
|
||||
cp -f ../JudyCommon/JudyPrevNextEmpty.c Judy1NextEmpty.c
|
||||
cp -f ../JudyCommon/JudyPrevNextEmpty.c Judy1PrevEmpty.c
|
||||
cp -f ../JudyCommon/JudyTables.c Judy1TablesGen.c
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
11
dlls/arrayx/Judy-1.0.1/src/Judy1/README
Normal file
11
dlls/arrayx/Judy-1.0.1/src/Judy1/README
Normal file
|
@ -0,0 +1,11 @@
|
|||
# @(#) $Revision$ $Source$
|
||||
|
||||
# This tree contains sources for the Judy1*() functions.
|
||||
#
|
||||
# Note: At one time, all of the Judy sources were split between Judy1/ and
|
||||
# JudyL/ variants, but now most of them are merged in JudyCommon/ and this
|
||||
# directory is vestigal.
|
||||
|
||||
Judy1.h header for following functions
|
||||
|
||||
lint.waivers see usage in makefile
|
1094
dlls/arrayx/Judy-1.0.1/src/Judy1/j__udy1Test.c
Normal file
1094
dlls/arrayx/Judy-1.0.1/src/Judy1/j__udy1Test.c
Normal file
File diff suppressed because it is too large
Load Diff
954
dlls/arrayx/Judy-1.0.1/src/JudyCommon/JudyByCount.c
Normal file
954
dlls/arrayx/Judy-1.0.1/src/JudyCommon/JudyByCount.c
Normal file
|
@ -0,0 +1,954 @@
|
|||
// Copyright (C) 2000 - 2002 Hewlett-Packard Company
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify it
|
||||
// under the term of the GNU Lesser General Public License as published by the
|
||||
// Free Software Foundation; either version 2 of the License, or (at your
|
||||
// option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
// for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with this program; if not, write to the Free Software Foundation,
|
||||
// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
// _________________
|
||||
|
||||
// @(#) $Revision$ $Source$
|
||||
//
|
||||
// Judy*ByCount() function for Judy1 and JudyL.
|
||||
// Compile with one of -DJUDY1 or -DJUDYL.
|
||||
//
|
||||
// Compile with -DNOSMARTJBB, -DNOSMARTJBU, and/or -DNOSMARTJLB to build a
|
||||
// version with cache line optimizations deleted, for testing.
|
||||
//
|
||||
// Judy*ByCount() is a conceptual although not literal inverse of Judy*Count().
|
||||
// Judy*Count() takes a pair of Indexes, and allows finding the ordinal of a
|
||||
// given Index (that is, its position in the list of valid indexes from the
|
||||
// beginning) as a degenerate case, because in general the count between two
|
||||
// Indexes, inclusive, is not always just the difference in their ordinals.
|
||||
// However, it suffices for Judy*ByCount() to simply be an ordinal-to-Index
|
||||
// mapper.
|
||||
//
|
||||
// Note: Like Judy*Count(), this code must "count sideways" in branches, which
|
||||
// can result in a lot of cache line fills. However, unlike Judy*Count(), this
|
||||
// code does not receive a specific Index, hence digit, where to start in each
|
||||
// branch, so it cant accurately calculate cache line fills required in each
|
||||
// direction. The best it can do is an approximation based on the total
|
||||
// population of the expanse (pop1 from Pjp) and the ordinal of the target
|
||||
// Index (see SETOFFSET()) within the expanse.
|
||||
//
|
||||
// Compile with -DSMARTMETRICS to obtain global variables containing smart
|
||||
// cache line metrics. Note: Dont turn this on simultaneously for this file
|
||||
// and JudyCount.c because they export the same globals.
|
||||
// ****************************************************************************
|
||||
|
||||
#if (! (defined(JUDY1) || defined(JUDYL)))
|
||||
#error: One of -DJUDY1 or -DJUDYL must be specified.
|
||||
#endif
|
||||
|
||||
#ifdef JUDY1
|
||||
#include "Judy1.h"
|
||||
#else
|
||||
#include "JudyL.h"
|
||||
#endif
|
||||
|
||||
#include "JudyPrivate1L.h"
|
||||
|
||||
// These are imported from JudyCount.c:
|
||||
//
|
||||
// TBD: Should this be in common code? Exported from a header file?
|
||||
|
||||
#ifdef JUDY1
|
||||
extern Word_t j__udy1JPPop1(const Pjp_t Pjp);
|
||||
#define j__udyJPPop1 j__udy1JPPop1
|
||||
#else
|
||||
extern Word_t j__udyLJPPop1(const Pjp_t Pjp);
|
||||
#define j__udyJPPop1 j__udyLJPPop1
|
||||
#endif
|
||||
|
||||
// Avoid duplicate symbols since this file is multi-compiled:
|
||||
|
||||
#ifdef SMARTMETRICS
|
||||
#ifdef JUDY1
|
||||
Word_t jbb_upward = 0; // counts of directions taken:
|
||||
Word_t jbb_downward = 0;
|
||||
Word_t jbu_upward = 0;
|
||||
Word_t jbu_downward = 0;
|
||||
Word_t jlb_upward = 0;
|
||||
Word_t jlb_downward = 0;
|
||||
#else
|
||||
extern Word_t jbb_upward;
|
||||
extern Word_t jbb_downward;
|
||||
extern Word_t jbu_upward;
|
||||
extern Word_t jbu_downward;
|
||||
extern Word_t jlb_upward;
|
||||
extern Word_t jlb_downward;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
// ****************************************************************************
|
||||
// J U D Y 1 B Y C O U N T
|
||||
// J U D Y L B Y C O U N T
|
||||
//
|
||||
// See the manual entry.
|
||||
|
||||
#ifdef JUDY1
|
||||
FUNCTION int Judy1ByCount
|
||||
#else
|
||||
FUNCTION PPvoid_t JudyLByCount
|
||||
#endif
|
||||
(
|
||||
Pcvoid_t PArray, // root pointer to first branch/leaf in SM.
|
||||
Word_t Count, // ordinal of Index to find, 1..MAX.
|
||||
Word_t * PIndex, // to return found Index.
|
||||
PJError_t PJError // optional, for returning error info.
|
||||
)
|
||||
{
|
||||
Word_t Count0; // Count, base-0, to match pop0.
|
||||
Word_t state; // current state in SM.
|
||||
Word_t pop1; // of current branch or leaf, or of expanse.
|
||||
Word_t pop1lower; // pop1 of expanses (JPs) below that for Count.
|
||||
Word_t digit; // current word in branch.
|
||||
Word_t jpcount; // JPs in a BranchB subexpanse.
|
||||
long jpnum; // JP number in a branch (base 0).
|
||||
long subexp; // for stepping through layer 1 (subexpanses).
|
||||
int offset; // index ordinal within a leaf, base 0.
|
||||
|
||||
Pjp_t Pjp; // current JP in branch.
|
||||
Pjll_t Pjll; // current Judy linear leaf.
|
||||
|
||||
|
||||
// CHECK FOR EMPTY ARRAY OR NULL PINDEX:
|
||||
|
||||
if (PArray == (Pvoid_t) NULL) JU_RET_NOTFOUND;
|
||||
|
||||
if (PIndex == (PWord_t) NULL)
|
||||
{
|
||||
JU_SET_ERRNO(PJError, JU_ERRNO_NULLPINDEX);
|
||||
JUDY1CODE(return(JERRI );)
|
||||
JUDYLCODE(return(PPJERR);)
|
||||
}
|
||||
|
||||
// Convert Count to Count0; assume special case of Count = 0 maps to ~0, as
|
||||
// desired, to represent the last index in a full array:
|
||||
//
|
||||
// Note: Think of Count0 as a reliable "number of Indexes below the target."
|
||||
|
||||
Count0 = Count - 1;
|
||||
assert((Count || Count0 == ~0)); // ensure CPU is sane about 0 - 1.
|
||||
pop1lower = 0;
|
||||
|
||||
if (JU_LEAFW_POP0(PArray) < cJU_LEAFW_MAXPOP1) // must be a LEAFW
|
||||
{
|
||||
Pjlw_t Pjlw = P_JLW(PArray); // first word of leaf.
|
||||
|
||||
if (Count0 > Pjlw[0]) JU_RET_NOTFOUND; // too high.
|
||||
|
||||
*PIndex = Pjlw[Count]; // Index, base 1.
|
||||
|
||||
JU_RET_FOUND_LEAFW(Pjlw, Pjlw[0] + 1, Count0);
|
||||
}
|
||||
else
|
||||
{
|
||||
Pjpm_t Pjpm = P_JPM(PArray);
|
||||
|
||||
if (Count0 > (Pjpm->jpm_Pop0)) JU_RET_NOTFOUND; // too high.
|
||||
|
||||
Pjp = &(Pjpm->jpm_JP);
|
||||
pop1 = (Pjpm->jpm_Pop0) + 1;
|
||||
|
||||
// goto SMByCount;
|
||||
}
|
||||
|
||||
// COMMON CODE:
|
||||
//
|
||||
// Prepare to handle a root-level or lower-level branch: Save the current
|
||||
// state, obtain the total population for the branch in a state-dependent way,
|
||||
// and then branch to common code for multiple cases.
|
||||
//
|
||||
// For root-level branches, the state is always cJU_ROOTSTATE, and the array
|
||||
// population must already be set in pop1; it is not available in jp_DcdPopO.
|
||||
//
|
||||
// Note: The total population is only needed in cases where the common code
|
||||
// "counts down" instead of up to minimize cache line fills. However, its
|
||||
// available cheaply, and its better to do it with a constant shift (constant
|
||||
// state value) instead of a variable shift later "when needed".
|
||||
|
||||
#define PREPB_ROOT(Next) \
|
||||
state = cJU_ROOTSTATE; \
|
||||
goto Next
|
||||
|
||||
// Use PREPB_DCD() to first copy the Dcd bytes to *PIndex if there are any
|
||||
// (only if state < cJU_ROOTSTATE - 1):
|
||||
|
||||
#define PREPB_DCD(Pjp,cState,Next) \
|
||||
JU_SETDCD(*PIndex, Pjp, cState); \
|
||||
PREPB((Pjp), cState, Next)
|
||||
|
||||
#define PREPB(Pjp,cState,Next) \
|
||||
state = (cState); \
|
||||
pop1 = JU_JPBRANCH_POP0(Pjp, (cState)) + 1; \
|
||||
goto Next
|
||||
|
||||
// Calculate whether the ordinal of an Index within a given expanse falls in
|
||||
// the lower or upper half of the expanses population, taking care with
|
||||
// unsigned math and boundary conditions:
|
||||
//
|
||||
// Note: Assume the ordinal falls within the expanses population, that is,
|
||||
// 0 < (Count - Pop1lower) <= Pop1exp (assuming infinite math).
|
||||
//
|
||||
// Note: If the ordinal is the middle element, it doesnt matter whether
|
||||
// LOWERHALF() is TRUE or FALSE.
|
||||
|
||||
#define LOWERHALF(Count0,Pop1lower,Pop1exp) \
|
||||
(((Count0) - (Pop1lower)) < ((Pop1exp) / 2))
|
||||
|
||||
// Calculate the (signed) offset within a leaf to the desired ordinal (Count -
|
||||
// Pop1lower; offset is one less), and optionally ensure its in range:
|
||||
|
||||
#define SETOFFSET(Offset,Count0,Pop1lower,Pjp) \
|
||||
(Offset) = (Count0) - (Pop1lower); \
|
||||
assert((Offset) >= 0); \
|
||||
assert((Offset) <= JU_JPLEAF_POP0(Pjp))
|
||||
|
||||
// Variations for immediate indexes, with and without pop1-specific assertions:
|
||||
|
||||
#define SETOFFSET_IMM_CK(Offset,Count0,Pop1lower,cPop1) \
|
||||
(Offset) = (Count0) - (Pop1lower); \
|
||||
assert((Offset) >= 0); \
|
||||
assert((Offset) < (cPop1))
|
||||
|
||||
#define SETOFFSET_IMM(Offset,Count0,Pop1lower) \
|
||||
(Offset) = (Count0) - (Pop1lower)
|
||||
|
||||
|
||||
// STATE MACHINE -- TRAVERSE TREE:
|
||||
//
|
||||
// In branches, look for the expanse (digit), if any, where the total pop1
|
||||
// below or at that expanse would meet or exceed Count, meaning the Index must
|
||||
// be in this expanse.
|
||||
|
||||
SMByCount: // return here for next branch/leaf.
|
||||
|
||||
switch (JU_JPTYPE(Pjp))
|
||||
{
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// LINEAR BRANCH; count populations in JPs in the JBL upwards until finding the
|
||||
// expanse (digit) containing Count, and "recurse".
|
||||
//
|
||||
// Note: There are no null JPs in a JBL; watch out for pop1 == 0.
|
||||
//
|
||||
// Note: A JBL should always fit in one cache line => no need to count up
|
||||
// versus down to save cache line fills.
|
||||
//
|
||||
// TBD: The previous is no longer true. Consider enhancing this code to count
|
||||
// up/down, but it can wait for a later tuning phase. In the meantime, PREPB()
|
||||
// sets pop1 for the whole array, but that value is not used here. 001215:
|
||||
// Maybe its true again?
|
||||
|
||||
case cJU_JPBRANCH_L2: PREPB_DCD(Pjp, 2, BranchL);
|
||||
#ifndef JU_64BIT
|
||||
case cJU_JPBRANCH_L3: PREPB( Pjp, 3, BranchL);
|
||||
#else
|
||||
case cJU_JPBRANCH_L3: PREPB_DCD(Pjp, 3, BranchL);
|
||||
case cJU_JPBRANCH_L4: PREPB_DCD(Pjp, 4, BranchL);
|
||||
case cJU_JPBRANCH_L5: PREPB_DCD(Pjp, 5, BranchL);
|
||||
case cJU_JPBRANCH_L6: PREPB_DCD(Pjp, 6, BranchL);
|
||||
case cJU_JPBRANCH_L7: PREPB( Pjp, 7, BranchL);
|
||||
#endif
|
||||
case cJU_JPBRANCH_L: PREPB_ROOT( BranchL);
|
||||
{
|
||||
Pjbl_t Pjbl;
|
||||
|
||||
// Common code (state-independent) for all cases of linear branches:
|
||||
|
||||
BranchL:
|
||||
Pjbl = P_JBL(Pjp->jp_Addr);
|
||||
|
||||
for (jpnum = 0; jpnum < (Pjbl->jbl_NumJPs); ++jpnum)
|
||||
{
|
||||
if ((pop1 = j__udyJPPop1((Pjbl->jbl_jp) + jpnum))
|
||||
== cJU_ALLONES)
|
||||
{
|
||||
JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT);
|
||||
JUDY1CODE(return(JERRI );)
|
||||
JUDYLCODE(return(PPJERR);)
|
||||
}
|
||||
assert(pop1 != 0);
|
||||
|
||||
// Warning: pop1lower and pop1 are unsigned, so do not subtract 1 and compare
|
||||
// >=, but instead use the following expression:
|
||||
|
||||
if (pop1lower + pop1 > Count0) // Index is in this expanse.
|
||||
{
|
||||
JU_SETDIGIT(*PIndex, Pjbl->jbl_Expanse[jpnum], state);
|
||||
Pjp = (Pjbl->jbl_jp) + jpnum;
|
||||
goto SMByCount; // look under this expanse.
|
||||
}
|
||||
|
||||
pop1lower += pop1; // add this JPs pop1.
|
||||
}
|
||||
|
||||
JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT); // should never get here.
|
||||
JUDY1CODE(return(JERRI );)
|
||||
JUDYLCODE(return(PPJERR);)
|
||||
|
||||
} // case cJU_JPBRANCH_L
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// BITMAP BRANCH; count populations in JPs in the JBB upwards or downwards
|
||||
// until finding the expanse (digit) containing Count, and "recurse".
|
||||
//
|
||||
// Note: There are no null JPs in a JBB; watch out for pop1 == 0.
|
||||
|
||||
case cJU_JPBRANCH_B2: PREPB_DCD(Pjp, 2, BranchB);
|
||||
#ifndef JU_64BIT
|
||||
case cJU_JPBRANCH_B3: PREPB( Pjp, 3, BranchB);
|
||||
#else
|
||||
case cJU_JPBRANCH_B3: PREPB_DCD(Pjp, 3, BranchB);
|
||||
case cJU_JPBRANCH_B4: PREPB_DCD(Pjp, 4, BranchB);
|
||||
case cJU_JPBRANCH_B5: PREPB_DCD(Pjp, 5, BranchB);
|
||||
case cJU_JPBRANCH_B6: PREPB_DCD(Pjp, 6, BranchB);
|
||||
case cJU_JPBRANCH_B7: PREPB( Pjp, 7, BranchB);
|
||||
#endif
|
||||
case cJU_JPBRANCH_B: PREPB_ROOT( BranchB);
|
||||
{
|
||||
Pjbb_t Pjbb;
|
||||
|
||||
// Common code (state-independent) for all cases of bitmap branches:
|
||||
|
||||
BranchB:
|
||||
Pjbb = P_JBB(Pjp->jp_Addr);
|
||||
|
||||
// Shorthand for one subexpanse in a bitmap and for one JP in a bitmap branch:
|
||||
//
|
||||
// Note: BMPJP0 exists separately to support assertions.
|
||||
|
||||
#define BMPJP0(Subexp) (P_JP(JU_JBB_PJP(Pjbb, Subexp)))
|
||||
#define BMPJP(Subexp,JPnum) (BMPJP0(Subexp) + (JPnum))
|
||||
|
||||
|
||||
// Common code for descending through a JP:
|
||||
//
|
||||
// Determine the digit for the expanse and save it in *PIndex; then "recurse".
|
||||
|
||||
#define JBB_FOUNDEXPANSE \
|
||||
{ \
|
||||
JU_BITMAPDIGITB(digit, subexp, JU_JBB_BITMAP(Pjbb,subexp), jpnum); \
|
||||
JU_SETDIGIT(*PIndex, digit, state); \
|
||||
Pjp = BMPJP(subexp, jpnum); \
|
||||
goto SMByCount; \
|
||||
}
|
||||
|
||||
|
||||
#ifndef NOSMARTJBB // enable to turn off smart code for comparison purposes.
|
||||
|
||||
// FIGURE OUT WHICH DIRECTION CAUSES FEWER CACHE LINE FILLS; adding the pop1s
|
||||
// in JPs upwards, or subtracting the pop1s in JPs downwards:
|
||||
//
|
||||
// See header comments about limitations of this for Judy*ByCount().
|
||||
|
||||
#endif
|
||||
|
||||
// COUNT UPWARD, adding each "below" JPs pop1:
|
||||
|
||||
#ifndef NOSMARTJBB // enable to turn off smart code for comparison purposes.
|
||||
|
||||
if (LOWERHALF(Count0, pop1lower, pop1))
|
||||
{
|
||||
#endif
|
||||
#ifdef SMARTMETRICS
|
||||
++jbb_upward;
|
||||
#endif
|
||||
for (subexp = 0; subexp < cJU_NUMSUBEXPB; ++subexp)
|
||||
{
|
||||
if ((jpcount = j__udyCountBitsB(JU_JBB_BITMAP(Pjbb,subexp)))
|
||||
&& (BMPJP0(subexp) == (Pjp_t) NULL))
|
||||
{
|
||||
JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT); // null ptr.
|
||||
JUDY1CODE(return(JERRI );)
|
||||
JUDYLCODE(return(PPJERR);)
|
||||
}
|
||||
|
||||
// Note: An empty subexpanse (jpcount == 0) is handled "for free":
|
||||
|
||||
for (jpnum = 0; jpnum < jpcount; ++jpnum)
|
||||
{
|
||||
if ((pop1 = j__udyJPPop1(BMPJP(subexp, jpnum)))
|
||||
== cJU_ALLONES)
|
||||
{
|
||||
JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT);
|
||||
JUDY1CODE(return(JERRI );)
|
||||
JUDYLCODE(return(PPJERR);)
|
||||
}
|
||||
assert(pop1 != 0);
|
||||
|
||||
// Warning: pop1lower and pop1 are unsigned, see earlier comment:
|
||||
|
||||
if (pop1lower + pop1 > Count0)
|
||||
JBB_FOUNDEXPANSE; // Index is in this expanse.
|
||||
|
||||
pop1lower += pop1; // add this JPs pop1.
|
||||
}
|
||||
}
|
||||
#ifndef NOSMARTJBB // enable to turn off smart code for comparison purposes.
|
||||
}
|
||||
|
||||
|
||||
// COUNT DOWNWARD, subtracting each "above" JPs pop1 from the whole expanses
|
||||
// pop1:
|
||||
|
||||
else
|
||||
{
|
||||
#ifdef SMARTMETRICS
|
||||
++jbb_downward;
|
||||
#endif
|
||||
pop1lower += pop1; // add whole branch to start.
|
||||
|
||||
for (subexp = cJU_NUMSUBEXPB - 1; subexp >= 0; --subexp)
|
||||
{
|
||||
if ((jpcount = j__udyCountBitsB(JU_JBB_BITMAP(Pjbb, subexp)))
|
||||
&& (BMPJP0(subexp) == (Pjp_t) NULL))
|
||||
{
|
||||
JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT); // null ptr.
|
||||
JUDY1CODE(return(JERRI );)
|
||||
JUDYLCODE(return(PPJERR);)
|
||||
}
|
||||
|
||||
// Note: An empty subexpanse (jpcount == 0) is handled "for free":
|
||||
|
||||
for (jpnum = jpcount - 1; jpnum >= 0; --jpnum)
|
||||
{
|
||||
if ((pop1 = j__udyJPPop1(BMPJP(subexp, jpnum)))
|
||||
== cJU_ALLONES)
|
||||
{
|
||||
JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT);
|
||||
JUDY1CODE(return(JERRI );)
|
||||
JUDYLCODE(return(PPJERR);)
|
||||
}
|
||||
assert(pop1 != 0);
|
||||
|
||||
// Warning: pop1lower and pop1 are unsigned, see earlier comment:
|
||||
|
||||
pop1lower -= pop1;
|
||||
|
||||
// Beware unsigned math problems:
|
||||
|
||||
if ((pop1lower == 0) || (pop1lower - 1 < Count0))
|
||||
JBB_FOUNDEXPANSE; // Index is in this expanse.
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // NOSMARTJBB
|
||||
|
||||
JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT); // should never get here.
|
||||
JUDY1CODE(return(JERRI );)
|
||||
JUDYLCODE(return(PPJERR);)
|
||||
|
||||
} // case cJU_JPBRANCH_B
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// UNCOMPRESSED BRANCH; count populations in JPs in the JBU upwards or
|
||||
// downwards until finding the expanse (digit) containing Count, and "recurse".
|
||||
|
||||
case cJU_JPBRANCH_U2: PREPB_DCD(Pjp, 2, BranchU);
|
||||
#ifndef JU_64BIT
|
||||
case cJU_JPBRANCH_U3: PREPB( Pjp, 3, BranchU);
|
||||
#else
|
||||
case cJU_JPBRANCH_U3: PREPB_DCD(Pjp, 3, BranchU);
|
||||
case cJU_JPBRANCH_U4: PREPB_DCD(Pjp, 4, BranchU);
|
||||
case cJU_JPBRANCH_U5: PREPB_DCD(Pjp, 5, BranchU);
|
||||
case cJU_JPBRANCH_U6: PREPB_DCD(Pjp, 6, BranchU);
|
||||
case cJU_JPBRANCH_U7: PREPB( Pjp, 7, BranchU);
|
||||
#endif
|
||||
case cJU_JPBRANCH_U: PREPB_ROOT( BranchU);
|
||||
{
|
||||
Pjbu_t Pjbu;
|
||||
|
||||
// Common code (state-independent) for all cases of uncompressed branches:
|
||||
|
||||
BranchU:
|
||||
Pjbu = P_JBU(Pjp->jp_Addr);
|
||||
|
||||
// Common code for descending through a JP:
|
||||
//
|
||||
// Save the digit for the expanse in *PIndex, then "recurse".
|
||||
|
||||
#define JBU_FOUNDEXPANSE \
|
||||
{ \
|
||||
JU_SETDIGIT(*PIndex, jpnum, state); \
|
||||
Pjp = (Pjbu->jbu_jp) + jpnum; \
|
||||
goto SMByCount; \
|
||||
}
|
||||
|
||||
|
||||
#ifndef NOSMARTJBU // enable to turn off smart code for comparison purposes.
|
||||
|
||||
// FIGURE OUT WHICH DIRECTION CAUSES FEWER CACHE LINE FILLS; adding the pop1s
|
||||
// in JPs upwards, or subtracting the pop1s in JPs downwards:
|
||||
//
|
||||
// See header comments about limitations of this for Judy*ByCount().
|
||||
|
||||
#endif
|
||||
|
||||
// COUNT UPWARD, simply adding the pop1 of each JP:
|
||||
|
||||
#ifndef NOSMARTJBU // enable to turn off smart code for comparison purposes.
|
||||
|
||||
if (LOWERHALF(Count0, pop1lower, pop1))
|
||||
{
|
||||
#endif
|
||||
#ifdef SMARTMETRICS
|
||||
++jbu_upward;
|
||||
#endif
|
||||
|
||||
for (jpnum = 0; jpnum < cJU_BRANCHUNUMJPS; ++jpnum)
|
||||
{
|
||||
// shortcut, save a function call:
|
||||
|
||||
if ((Pjbu->jbu_jp[jpnum].jp_Type) <= cJU_JPNULLMAX)
|
||||
continue;
|
||||
|
||||
if ((pop1 = j__udyJPPop1((Pjbu->jbu_jp) + jpnum))
|
||||
== cJU_ALLONES)
|
||||
{
|
||||
JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT);
|
||||
JUDY1CODE(return(JERRI );)
|
||||
JUDYLCODE(return(PPJERR);)
|
||||
}
|
||||
assert(pop1 != 0);
|
||||
|
||||
// Warning: pop1lower and pop1 are unsigned, see earlier comment:
|
||||
|
||||
if (pop1lower + pop1 > Count0)
|
||||
JBU_FOUNDEXPANSE; // Index is in this expanse.
|
||||
|
||||
pop1lower += pop1; // add this JPs pop1.
|
||||
}
|
||||
#ifndef NOSMARTJBU // enable to turn off smart code for comparison purposes.
|
||||
}
|
||||
|
||||
|
||||
// COUNT DOWNWARD, subtracting the pop1 of each JP above from the whole
|
||||
// expanses pop1:
|
||||
|
||||
else
|
||||
{
|
||||
#ifdef SMARTMETRICS
|
||||
++jbu_downward;
|
||||
#endif
|
||||
pop1lower += pop1; // add whole branch to start.
|
||||
|
||||
for (jpnum = cJU_BRANCHUNUMJPS - 1; jpnum >= 0; --jpnum)
|
||||
{
|
||||
// shortcut, save a function call:
|
||||
|
||||
if ((Pjbu->jbu_jp[jpnum].jp_Type) <= cJU_JPNULLMAX)
|
||||
continue;
|
||||
|
||||
if ((pop1 = j__udyJPPop1(Pjbu->jbu_jp + jpnum))
|
||||
== cJU_ALLONES)
|
||||
{
|
||||
JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT);
|
||||
JUDY1CODE(return(JERRI );)
|
||||
JUDYLCODE(return(PPJERR);)
|
||||
}
|
||||
assert(pop1 != 0);
|
||||
|
||||
// Warning: pop1lower and pop1 are unsigned, see earlier comment:
|
||||
|
||||
pop1lower -= pop1;
|
||||
|
||||
// Beware unsigned math problems:
|
||||
|
||||
if ((pop1lower == 0) || (pop1lower - 1 < Count0))
|
||||
JBU_FOUNDEXPANSE; // Index is in this expanse.
|
||||
}
|
||||
}
|
||||
#endif // NOSMARTJBU
|
||||
|
||||
JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT); // should never get here.
|
||||
JUDY1CODE(return(JERRI );)
|
||||
JUDYLCODE(return(PPJERR);)
|
||||
|
||||
} // case cJU_JPBRANCH_U
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// LINEAR LEAF:
|
||||
//
|
||||
// Return the Index at the proper ordinal (see SETOFFSET()) in the leaf. First
|
||||
// copy Dcd bytes, if there are any (only if state < cJU_ROOTSTATE - 1), to
|
||||
// *PIndex.
|
||||
//
|
||||
// Note: The preceding branch traversal code MIGHT set pop1 for this expanse
|
||||
// (linear leaf) as a side-effect, but dont depend on that (for JUDYL, which
|
||||
// is the only cases that need it anyway).
|
||||
|
||||
#define PREPL_DCD(cState) \
|
||||
JU_SETDCD(*PIndex, Pjp, cState); \
|
||||
PREPL
|
||||
|
||||
#ifdef JUDY1
|
||||
#define PREPL_SETPOP1 // not needed in any cases.
|
||||
#else
|
||||
#define PREPL_SETPOP1 pop1 = JU_JPLEAF_POP0(Pjp) + 1
|
||||
#endif
|
||||
|
||||
#define PREPL \
|
||||
Pjll = P_JLL(Pjp->jp_Addr); \
|
||||
PREPL_SETPOP1; \
|
||||
SETOFFSET(offset, Count0, pop1lower, Pjp)
|
||||
|
||||
#if (defined(JUDYL) || (! defined(JU_64BIT)))
|
||||
case cJU_JPLEAF1:
|
||||
|
||||
PREPL_DCD(1);
|
||||
JU_SETDIGIT1(*PIndex, ((uint8_t *) Pjll)[offset]);
|
||||
JU_RET_FOUND_LEAF1(Pjll, pop1, offset);
|
||||
#endif
|
||||
|
||||
case cJU_JPLEAF2:
|
||||
|
||||
PREPL_DCD(2);
|
||||
*PIndex = (*PIndex & (~JU_LEASTBYTESMASK(2)))
|
||||
| ((uint16_t *) Pjll)[offset];
|
||||
JU_RET_FOUND_LEAF2(Pjll, pop1, offset);
|
||||
|
||||
#ifndef JU_64BIT
|
||||
case cJU_JPLEAF3:
|
||||
{
|
||||
Word_t lsb;
|
||||
PREPL;
|
||||
JU_COPY3_PINDEX_TO_LONG(lsb, ((uint8_t *) Pjll) + (3 * offset));
|
||||
*PIndex = (*PIndex & (~JU_LEASTBYTESMASK(3))) | lsb;
|
||||
JU_RET_FOUND_LEAF3(Pjll, pop1, offset);
|
||||
}
|
||||
|
||||
#else
|
||||
case cJU_JPLEAF3:
|
||||
{
|
||||
Word_t lsb;
|
||||
PREPL_DCD(3);
|
||||
JU_COPY3_PINDEX_TO_LONG(lsb, ((uint8_t *) Pjll) + (3 * offset));
|
||||
*PIndex = (*PIndex & (~JU_LEASTBYTESMASK(3))) | lsb;
|
||||
JU_RET_FOUND_LEAF3(Pjll, pop1, offset);
|
||||
}
|
||||
|
||||
case cJU_JPLEAF4:
|
||||
|
||||
PREPL_DCD(4);
|
||||
*PIndex = (*PIndex & (~JU_LEASTBYTESMASK(4)))
|
||||
| ((uint32_t *) Pjll)[offset];
|
||||
JU_RET_FOUND_LEAF4(Pjll, pop1, offset);
|
||||
|
||||
case cJU_JPLEAF5:
|
||||
{
|
||||
Word_t lsb;
|
||||
PREPL_DCD(5);
|
||||
JU_COPY5_PINDEX_TO_LONG(lsb, ((uint8_t *) Pjll) + (5 * offset));
|
||||
*PIndex = (*PIndex & (~JU_LEASTBYTESMASK(5))) | lsb;
|
||||
JU_RET_FOUND_LEAF5(Pjll, pop1, offset);
|
||||
}
|
||||
|
||||
case cJU_JPLEAF6:
|
||||
{
|
||||
Word_t lsb;
|
||||
PREPL_DCD(6);
|
||||
JU_COPY6_PINDEX_TO_LONG(lsb, ((uint8_t *) Pjll) + (6 * offset));
|
||||
*PIndex = (*PIndex & (~JU_LEASTBYTESMASK(6))) | lsb;
|
||||
JU_RET_FOUND_LEAF6(Pjll, pop1, offset);
|
||||
}
|
||||
|
||||
case cJU_JPLEAF7:
|
||||
{
|
||||
Word_t lsb;
|
||||
PREPL;
|
||||
JU_COPY7_PINDEX_TO_LONG(lsb, ((uint8_t *) Pjll) + (7 * offset));
|
||||
*PIndex = (*PIndex & (~JU_LEASTBYTESMASK(7))) | lsb;
|
||||
JU_RET_FOUND_LEAF7(Pjll, pop1, offset);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// BITMAP LEAF:
|
||||
//
|
||||
// Return the Index at the proper ordinal (see SETOFFSET()) in the leaf by
|
||||
// counting bits. First copy Dcd bytes (always present since state 1 <
|
||||
// cJU_ROOTSTATE) to *PIndex.
|
||||
//
|
||||
// Note: The preceding branch traversal code MIGHT set pop1 for this expanse
|
||||
// (bitmap leaf) as a side-effect, but dont depend on that.
|
||||
|
||||
case cJU_JPLEAF_B1:
|
||||
{
|
||||
Pjlb_t Pjlb;
|
||||
|
||||
JU_SETDCD(*PIndex, Pjp, 1);
|
||||
Pjlb = P_JLB(Pjp->jp_Addr);
|
||||
pop1 = JU_JPLEAF_POP0(Pjp) + 1;
|
||||
|
||||
// COUNT UPWARD, adding the pop1 of each subexpanse:
|
||||
//
|
||||
// The entire bitmap should fit in one cache line, but still try to save some
|
||||
// CPU time by counting the fewest possible number of subexpanses from the
|
||||
// bitmap.
|
||||
//
|
||||
// See header comments about limitations of this for Judy*ByCount().
|
||||
|
||||
#ifndef NOSMARTJLB // enable to turn off smart code for comparison purposes.
|
||||
|
||||
if (LOWERHALF(Count0, pop1lower, pop1))
|
||||
{
|
||||
#endif
|
||||
#ifdef SMARTMETRICS
|
||||
++jlb_upward;
|
||||
#endif
|
||||
for (subexp = 0; subexp < cJU_NUMSUBEXPL; ++subexp)
|
||||
{
|
||||
pop1 = j__udyCountBitsL(JU_JLB_BITMAP(Pjlb, subexp));
|
||||
|
||||
// Warning: pop1lower and pop1 are unsigned, see earlier comment:
|
||||
|
||||
if (pop1lower + pop1 > Count0)
|
||||
goto LeafB1; // Index is in this subexpanse.
|
||||
|
||||
pop1lower += pop1; // add this subexpanses pop1.
|
||||
}
|
||||
#ifndef NOSMARTJLB // enable to turn off smart code for comparison purposes.
|
||||
}
|
||||
|
||||
|
||||
// COUNT DOWNWARD, subtracting each "above" subexpanses pop1 from the whole
|
||||
// expanses pop1:
|
||||
|
||||
else
|
||||
{
|
||||
#ifdef SMARTMETRICS
|
||||
++jlb_downward;
|
||||
#endif
|
||||
pop1lower += pop1; // add whole leaf to start.
|
||||
|
||||
for (subexp = cJU_NUMSUBEXPL - 1; subexp >= 0; --subexp)
|
||||
{
|
||||
pop1lower -= j__udyCountBitsL(JU_JLB_BITMAP(Pjlb, subexp));
|
||||
|
||||
// Beware unsigned math problems:
|
||||
|
||||
if ((pop1lower == 0) || (pop1lower - 1 < Count0))
|
||||
goto LeafB1; // Index is in this subexpanse.
|
||||
}
|
||||
}
|
||||
#endif // NOSMARTJLB
|
||||
|
||||
JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT); // should never get here.
|
||||
JUDY1CODE(return(JERRI );)
|
||||
JUDYLCODE(return(PPJERR);)
|
||||
|
||||
|
||||
// RETURN INDEX FOUND:
|
||||
//
|
||||
// Come here with subexp set to the correct subexpanse, and pop1lower set to
|
||||
// the sum for all lower expanses and subexpanses in the Judy tree. Calculate
|
||||
// and save in *PIndex the digit corresponding to the ordinal in this
|
||||
// subexpanse.
|
||||
|
||||
LeafB1:
|
||||
SETOFFSET(offset, Count0, pop1lower, Pjp);
|
||||
JU_BITMAPDIGITL(digit, subexp, JU_JLB_BITMAP(Pjlb, subexp), offset);
|
||||
JU_SETDIGIT1(*PIndex, digit);
|
||||
JU_RET_FOUND_LEAF_B1(Pjlb, subexp, offset);
|
||||
// == return((PPvoid_t) (P_JV(JL_JLB_PVALUE(Pjlb, subexp)) + offset))
|
||||
|
||||
} // case cJU_JPLEAF_B1
|
||||
|
||||
|
||||
#ifdef JUDY1
|
||||
// ----------------------------------------------------------------------------
|
||||
// FULL POPULATION:
|
||||
//
|
||||
// Copy Dcd bytes (always present since state 1 < cJU_ROOTSTATE) to *PIndex,
|
||||
// then set the appropriate digit for the ordinal (see SETOFFSET()) in the leaf
|
||||
// as the LSB in *PIndex.
|
||||
|
||||
case cJ1_JPFULLPOPU1:
|
||||
|
||||
JU_SETDCD(*PIndex, Pjp, 1);
|
||||
SETOFFSET(offset, Count0, pop1lower, Pjp);
|
||||
assert(offset >= 0);
|
||||
assert(offset <= cJU_JPFULLPOPU1_POP0);
|
||||
JU_SETDIGIT1(*PIndex, offset);
|
||||
JU_RET_FOUND_FULLPOPU1;
|
||||
#endif
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// IMMEDIATE:
|
||||
//
|
||||
// Locate the Index with the proper ordinal (see SETOFFSET()) in the Immediate,
|
||||
// depending on leaf Index Size and pop1. Note: There are no Dcd bytes in an
|
||||
// Immediate JP, but in a cJU_JPIMMED_*_01 JP, the field holds the least bytes
|
||||
// of the immediate Index.
|
||||
|
||||
#define SET_01(cState) JU_SETDIGITS(*PIndex, JU_JPDCDPOP0(Pjp), cState)
|
||||
|
||||
case cJU_JPIMMED_1_01: SET_01(1); goto Imm_01;
|
||||
case cJU_JPIMMED_2_01: SET_01(2); goto Imm_01;
|
||||
case cJU_JPIMMED_3_01: SET_01(3); goto Imm_01;
|
||||
#ifdef JU_64BIT
|
||||
case cJU_JPIMMED_4_01: SET_01(4); goto Imm_01;
|
||||
case cJU_JPIMMED_5_01: SET_01(5); goto Imm_01;
|
||||
case cJU_JPIMMED_6_01: SET_01(6); goto Imm_01;
|
||||
case cJU_JPIMMED_7_01: SET_01(7); goto Imm_01;
|
||||
#endif
|
||||
|
||||
Imm_01:
|
||||
|
||||
DBGCODE(SETOFFSET_IMM_CK(offset, Count0, pop1lower, 1);)
|
||||
JU_RET_FOUND_IMM_01(Pjp);
|
||||
|
||||
// Shorthand for where to find start of Index bytes array:
|
||||
|
||||
#ifdef JUDY1
|
||||
#define PJI (Pjp->jp_1Index)
|
||||
#else
|
||||
#define PJI (Pjp->jp_LIndex)
|
||||
#endif
|
||||
|
||||
// Optional code to check the remaining ordinal (see SETOFFSET_IMM()) against
|
||||
// the Index Size of the Immediate:
|
||||
|
||||
#ifndef DEBUG // simple placeholder:
|
||||
#define IMM(cPop1,Next) \
|
||||
goto Next
|
||||
#else // extra pop1-specific checking:
|
||||
#define IMM(cPop1,Next) \
|
||||
SETOFFSET_IMM_CK(offset, Count0, pop1lower, cPop1); \
|
||||
goto Next
|
||||
#endif
|
||||
|
||||
case cJU_JPIMMED_1_02: IMM( 2, Imm1);
|
||||
case cJU_JPIMMED_1_03: IMM( 3, Imm1);
|
||||
#if (defined(JUDY1) || defined(JU_64BIT))
|
||||
case cJU_JPIMMED_1_04: IMM( 4, Imm1);
|
||||
case cJU_JPIMMED_1_05: IMM( 5, Imm1);
|
||||
case cJU_JPIMMED_1_06: IMM( 6, Imm1);
|
||||
case cJU_JPIMMED_1_07: IMM( 7, Imm1);
|
||||
#endif
|
||||
#if (defined(JUDY1) && defined(JU_64BIT))
|
||||
case cJ1_JPIMMED_1_08: IMM( 8, Imm1);
|
||||
case cJ1_JPIMMED_1_09: IMM( 9, Imm1);
|
||||
case cJ1_JPIMMED_1_10: IMM(10, Imm1);
|
||||
case cJ1_JPIMMED_1_11: IMM(11, Imm1);
|
||||
case cJ1_JPIMMED_1_12: IMM(12, Imm1);
|
||||
case cJ1_JPIMMED_1_13: IMM(13, Imm1);
|
||||
case cJ1_JPIMMED_1_14: IMM(14, Imm1);
|
||||
case cJ1_JPIMMED_1_15: IMM(15, Imm1);
|
||||
#endif
|
||||
|
||||
Imm1: SETOFFSET_IMM(offset, Count0, pop1lower);
|
||||
JU_SETDIGIT1(*PIndex, ((uint8_t *) PJI)[offset]);
|
||||
JU_RET_FOUND_IMM(Pjp, offset);
|
||||
|
||||
#if (defined(JUDY1) || defined(JU_64BIT))
|
||||
case cJU_JPIMMED_2_02: IMM(2, Imm2);
|
||||
case cJU_JPIMMED_2_03: IMM(3, Imm2);
|
||||
#endif
|
||||
#if (defined(JUDY1) && defined(JU_64BIT))
|
||||
case cJ1_JPIMMED_2_04: IMM(4, Imm2);
|
||||
case cJ1_JPIMMED_2_05: IMM(5, Imm2);
|
||||
case cJ1_JPIMMED_2_06: IMM(6, Imm2);
|
||||
case cJ1_JPIMMED_2_07: IMM(7, Imm2);
|
||||
#endif
|
||||
|
||||
#if (defined(JUDY1) || defined(JU_64BIT))
|
||||
Imm2: SETOFFSET_IMM(offset, Count0, pop1lower);
|
||||
*PIndex = (*PIndex & (~JU_LEASTBYTESMASK(2)))
|
||||
| ((uint16_t *) PJI)[offset];
|
||||
JU_RET_FOUND_IMM(Pjp, offset);
|
||||
#endif
|
||||
|
||||
#if (defined(JUDY1) || defined(JU_64BIT))
|
||||
case cJU_JPIMMED_3_02: IMM(2, Imm3);
|
||||
#endif
|
||||
#if (defined(JUDY1) && defined(JU_64BIT))
|
||||
case cJ1_JPIMMED_3_03: IMM(3, Imm3);
|
||||
case cJ1_JPIMMED_3_04: IMM(4, Imm3);
|
||||
case cJ1_JPIMMED_3_05: IMM(5, Imm3);
|
||||
#endif
|
||||
|
||||
#if (defined(JUDY1) || defined(JU_64BIT))
|
||||
Imm3:
|
||||
{
|
||||
Word_t lsb;
|
||||
SETOFFSET_IMM(offset, Count0, pop1lower);
|
||||
JU_COPY3_PINDEX_TO_LONG(lsb, ((uint8_t *) PJI) + (3 * offset));
|
||||
*PIndex = (*PIndex & (~JU_LEASTBYTESMASK(3))) | lsb;
|
||||
JU_RET_FOUND_IMM(Pjp, offset);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if (defined(JUDY1) && defined(JU_64BIT))
|
||||
case cJ1_JPIMMED_4_02: IMM(2, Imm4);
|
||||
case cJ1_JPIMMED_4_03: IMM(3, Imm4);
|
||||
|
||||
Imm4: SETOFFSET_IMM(offset, Count0, pop1lower);
|
||||
*PIndex = (*PIndex & (~JU_LEASTBYTESMASK(4)))
|
||||
| ((uint32_t *) PJI)[offset];
|
||||
JU_RET_FOUND_IMM(Pjp, offset);
|
||||
|
||||
case cJ1_JPIMMED_5_02: IMM(2, Imm5);
|
||||
case cJ1_JPIMMED_5_03: IMM(3, Imm5);
|
||||
|
||||
Imm5:
|
||||
{
|
||||
Word_t lsb;
|
||||
SETOFFSET_IMM(offset, Count0, pop1lower);
|
||||
JU_COPY5_PINDEX_TO_LONG(lsb, ((uint8_t *) PJI) + (5 * offset));
|
||||
*PIndex = (*PIndex & (~JU_LEASTBYTESMASK(5))) | lsb;
|
||||
JU_RET_FOUND_IMM(Pjp, offset);
|
||||
}
|
||||
|
||||
case cJ1_JPIMMED_6_02: IMM(2, Imm6);
|
||||
|
||||
Imm6:
|
||||
{
|
||||
Word_t lsb;
|
||||
SETOFFSET_IMM(offset, Count0, pop1lower);
|
||||
JU_COPY6_PINDEX_TO_LONG(lsb, ((uint8_t *) PJI) + (6 * offset));
|
||||
*PIndex = (*PIndex & (~JU_LEASTBYTESMASK(6))) | lsb;
|
||||
JU_RET_FOUND_IMM(Pjp, offset);
|
||||
}
|
||||
|
||||
case cJ1_JPIMMED_7_02: IMM(2, Imm7);
|
||||
|
||||
Imm7:
|
||||
{
|
||||
Word_t lsb;
|
||||
SETOFFSET_IMM(offset, Count0, pop1lower);
|
||||
JU_COPY7_PINDEX_TO_LONG(lsb, ((uint8_t *) PJI) + (7 * offset));
|
||||
*PIndex = (*PIndex & (~JU_LEASTBYTESMASK(7))) | lsb;
|
||||
JU_RET_FOUND_IMM(Pjp, offset);
|
||||
}
|
||||
#endif // (JUDY1 && JU_64BIT)
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// UNEXPECTED JP TYPES:
|
||||
|
||||
default: JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT);
|
||||
JUDY1CODE(return(JERRI );)
|
||||
JUDYLCODE(return(PPJERR);)
|
||||
|
||||
} // SMByCount switch.
|
||||
|
||||
/*NOTREACHED*/
|
||||
|
||||
} // Judy1ByCount() / JudyLByCount()
|
1942
dlls/arrayx/Judy-1.0.1/src/JudyCommon/JudyCascade.c
Normal file
1942
dlls/arrayx/Judy-1.0.1/src/JudyCommon/JudyCascade.c
Normal file
File diff suppressed because it is too large
Load Diff
1195
dlls/arrayx/Judy-1.0.1/src/JudyCommon/JudyCount.c
Normal file
1195
dlls/arrayx/Judy-1.0.1/src/JudyCommon/JudyCount.c
Normal file
File diff suppressed because it is too large
Load Diff
314
dlls/arrayx/Judy-1.0.1/src/JudyCommon/JudyCreateBranch.c
Normal file
314
dlls/arrayx/Judy-1.0.1/src/JudyCommon/JudyCreateBranch.c
Normal file
|
@ -0,0 +1,314 @@
|
|||
// Copyright (C) 2000 - 2002 Hewlett-Packard Company
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify it
|
||||
// under the term of the GNU Lesser General Public License as published by the
|
||||
// Free Software Foundation; either version 2 of the License, or (at your
|
||||
// option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
// for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with this program; if not, write to the Free Software Foundation,
|
||||
// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
// _________________
|
||||
|
||||
// @(#) $Revision$ $Source$
|
||||
|
||||
// Branch creation functions for Judy1 and JudyL.
|
||||
// Compile with one of -DJUDY1 or -DJUDYL.
|
||||
|
||||
#if (! (defined(JUDY1) || defined(JUDYL)))
|
||||
#error: One of -DJUDY1 or -DJUDYL must be specified.
|
||||
#endif
|
||||
|
||||
#ifdef JUDY1
|
||||
#include "Judy1.h"
|
||||
#else
|
||||
#include "JudyL.h"
|
||||
#endif
|
||||
|
||||
#include "JudyPrivate1L.h"
|
||||
|
||||
|
||||
// ****************************************************************************
|
||||
// J U D Y C R E A T E B R A N C H L
|
||||
//
|
||||
// Build a BranchL from an array of JPs and associated 1 byte digits
|
||||
// (expanses). Return with Pjp pointing to the BranchL. Caller must
|
||||
// deallocate passed arrays, if necessary.
|
||||
//
|
||||
// We have no idea what kind of BranchL it is, so caller must set the jp_Type.
|
||||
//
|
||||
// Return -1 if error (details in Pjpm), otherwise return 1.
|
||||
|
||||
FUNCTION int j__udyCreateBranchL(
|
||||
Pjp_t Pjp, // Build JPs from this place
|
||||
Pjp_t PJPs, // Array of JPs to put into Bitmap branch
|
||||
uint8_t Exp[], // Array of expanses to put into bitmap
|
||||
Word_t ExpCnt, // Number of above JPs and Expanses
|
||||
Pvoid_t Pjpm)
|
||||
{
|
||||
Pjbl_t PjblRaw; // pointer to linear branch.
|
||||
Pjbl_t Pjbl;
|
||||
|
||||
assert(ExpCnt <= cJU_BRANCHLMAXJPS);
|
||||
|
||||
PjblRaw = j__udyAllocJBL(Pjpm);
|
||||
if (PjblRaw == (Pjbl_t) NULL) return(-1);
|
||||
Pjbl = P_JBL(PjblRaw);
|
||||
|
||||
// Build a Linear Branch
|
||||
Pjbl->jbl_NumJPs = ExpCnt;
|
||||
|
||||
// Copy from the Linear branch from splayed leaves
|
||||
JU_COPYMEM(Pjbl->jbl_Expanse, Exp, ExpCnt);
|
||||
JU_COPYMEM(Pjbl->jbl_jp, PJPs, ExpCnt);
|
||||
|
||||
// Pass back new pointer to the Linear branch in JP
|
||||
Pjp->jp_Addr = (Word_t) PjblRaw;
|
||||
|
||||
return(1);
|
||||
|
||||
} // j__udyCreateBranchL()
|
||||
|
||||
|
||||
// ****************************************************************************
|
||||
// J U D Y C R E A T E B R A N C H B
|
||||
//
|
||||
// Build a BranchB from an array of JPs and associated 1 byte digits
|
||||
// (expanses). Return with Pjp pointing to the BranchB. Caller must
|
||||
// deallocate passed arrays, if necessary.
|
||||
//
|
||||
// We have no idea what kind of BranchB it is, so caller must set the jp_Type.
|
||||
//
|
||||
// Return -1 if error (details in Pjpm), otherwise return 1.
|
||||
|
||||
FUNCTION int j__udyCreateBranchB(
|
||||
Pjp_t Pjp, // Build JPs from this place
|
||||
Pjp_t PJPs, // Array of JPs to put into Bitmap branch
|
||||
uint8_t Exp[], // Array of expanses to put into bitmap
|
||||
Word_t ExpCnt, // Number of above JPs and Expanses
|
||||
Pvoid_t Pjpm)
|
||||
{
|
||||
Pjbb_t PjbbRaw; // pointer to bitmap branch.
|
||||
Pjbb_t Pjbb;
|
||||
Word_t ii, jj; // Temps
|
||||
uint8_t CurrSubExp; // Current sub expanse for BM
|
||||
|
||||
// This assertion says the number of populated subexpanses is not too large.
|
||||
// This function is only called when a BranchL overflows to a BranchB or when a
|
||||
// cascade occurs, meaning a leaf overflows. Either way ExpCnt cant be very
|
||||
// large, in fact a lot smaller than cJU_BRANCHBMAXJPS. (Otherwise a BranchU
|
||||
// would be used.) Popping this assertion means something (unspecified) has
|
||||
// gone very wrong, or else Judys design criteria have changed, although in
|
||||
// fact there should be no HARM in creating a BranchB with higher actual
|
||||
// fanout.
|
||||
|
||||
assert(ExpCnt <= cJU_BRANCHBMAXJPS);
|
||||
|
||||
// Get memory for a Bitmap branch
|
||||
PjbbRaw = j__udyAllocJBB(Pjpm);
|
||||
if (PjbbRaw == (Pjbb_t) NULL) return(-1);
|
||||
Pjbb = P_JBB(PjbbRaw);
|
||||
|
||||
// Get 1st "sub" expanse (0..7) of bitmap branch
|
||||
CurrSubExp = Exp[0] / cJU_BITSPERSUBEXPB;
|
||||
|
||||
// Index thru all 1 byte sized expanses:
|
||||
|
||||
for (jj = ii = 0; ii <= ExpCnt; ii++)
|
||||
{
|
||||
Word_t SubExp; // Cannot be a uint8_t
|
||||
|
||||
// Make sure we cover the last one
|
||||
if (ii == ExpCnt)
|
||||
{
|
||||
SubExp = cJU_ALLONES; // Force last one
|
||||
}
|
||||
else
|
||||
{
|
||||
// Calculate the "sub" expanse of the byte expanse
|
||||
SubExp = Exp[ii] / cJU_BITSPERSUBEXPB; // Bits 5..7.
|
||||
|
||||
// Set the bit that represents the expanse in Exp[]
|
||||
JU_JBB_BITMAP(Pjbb, SubExp) |= JU_BITPOSMASKB(Exp[ii]);
|
||||
}
|
||||
// Check if a new "sub" expanse range needed
|
||||
if (SubExp != CurrSubExp)
|
||||
{
|
||||
// Get number of JPs in this sub expanse
|
||||
Word_t NumJP = ii - jj;
|
||||
Pjp_t PjpRaw;
|
||||
Pjp_t Pjp;
|
||||
|
||||
PjpRaw = j__udyAllocJBBJP(NumJP, Pjpm);
|
||||
Pjp = P_JP(PjpRaw);
|
||||
|
||||
if (PjpRaw == (Pjp_t) NULL) // out of memory.
|
||||
{
|
||||
|
||||
// Free any previous allocations:
|
||||
|
||||
while(CurrSubExp--)
|
||||
{
|
||||
NumJP = j__udyCountBitsB(JU_JBB_BITMAP(Pjbb,
|
||||
CurrSubExp));
|
||||
if (NumJP)
|
||||
{
|
||||
j__udyFreeJBBJP(JU_JBB_PJP(Pjbb,
|
||||
CurrSubExp), NumJP, Pjpm);
|
||||
}
|
||||
}
|
||||
j__udyFreeJBB(PjbbRaw, Pjpm);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
// Place the array of JPs in bitmap branch:
|
||||
|
||||
JU_JBB_PJP(Pjbb, CurrSubExp) = PjpRaw;
|
||||
|
||||
// Copy the JPs to new leaf:
|
||||
|
||||
JU_COPYMEM(Pjp, PJPs + jj, NumJP);
|
||||
|
||||
// On to the next bitmap branch "sub" expanse:
|
||||
|
||||
jj = ii;
|
||||
CurrSubExp = SubExp;
|
||||
}
|
||||
} // for each 1-byte expanse
|
||||
|
||||
// Pass back some of the JP to the new Bitmap branch:
|
||||
|
||||
Pjp->jp_Addr = (Word_t) PjbbRaw;
|
||||
|
||||
return(1);
|
||||
|
||||
} // j__udyCreateBranchB()
|
||||
|
||||
|
||||
// ****************************************************************************
|
||||
// J U D Y C R E A T E B R A N C H U
|
||||
//
|
||||
// Build a BranchU from a BranchB. Return with Pjp pointing to the BranchU.
|
||||
// Free the BranchB and its JP subarrays.
|
||||
//
|
||||
// Return -1 if error (details in Pjpm), otherwise return 1.
|
||||
|
||||
FUNCTION int j__udyCreateBranchU(
|
||||
Pjp_t Pjp,
|
||||
Pvoid_t Pjpm)
|
||||
{
|
||||
jp_t JPNull;
|
||||
Pjbu_t PjbuRaw;
|
||||
Pjbu_t Pjbu;
|
||||
Pjbb_t PjbbRaw;
|
||||
Pjbb_t Pjbb;
|
||||
Word_t ii, jj;
|
||||
BITMAPB_t BitMap;
|
||||
Pjp_t PDstJP;
|
||||
#ifdef JU_STAGED_EXP
|
||||
jbu_t BranchU; // Staged uncompressed branch
|
||||
#else
|
||||
|
||||
// Allocate memory for a BranchU:
|
||||
|
||||
PjbuRaw = j__udyAllocJBU(Pjpm);
|
||||
if (PjbuRaw == (Pjbu_t) NULL) return(-1);
|
||||
Pjbu = P_JBU(PjbuRaw);
|
||||
#endif
|
||||
JU_JPSETADT(&JPNull, 0, 0, JU_JPTYPE(Pjp) - cJU_JPBRANCH_B2 + cJU_JPNULL1);
|
||||
|
||||
// Get the pointer to the BranchB:
|
||||
|
||||
PjbbRaw = (Pjbb_t) (Pjp->jp_Addr);
|
||||
Pjbb = P_JBB(PjbbRaw);
|
||||
|
||||
// Set the pointer to the Uncompressed branch
|
||||
#ifdef JU_STAGED_EXP
|
||||
PDstJP = BranchU.jbu_jp;
|
||||
#else
|
||||
PDstJP = Pjbu->jbu_jp;
|
||||
#endif
|
||||
for (ii = 0; ii < cJU_NUMSUBEXPB; ii++)
|
||||
{
|
||||
Pjp_t PjpA;
|
||||
Pjp_t PjpB;
|
||||
|
||||
PjpB = PjpA = P_JP(JU_JBB_PJP(Pjbb, ii));
|
||||
|
||||
// Get the bitmap for this subexpanse
|
||||
BitMap = JU_JBB_BITMAP(Pjbb, ii);
|
||||
|
||||
// NULL empty subexpanses
|
||||
if (BitMap == 0)
|
||||
{
|
||||
// But, fill with NULLs
|
||||
for (jj = 0; jj < cJU_BITSPERSUBEXPB; jj++)
|
||||
{
|
||||
PDstJP[jj] = JPNull;
|
||||
}
|
||||
PDstJP += cJU_BITSPERSUBEXPB;
|
||||
continue;
|
||||
}
|
||||
// Check if Uncompressed subexpanse
|
||||
if (BitMap == cJU_FULLBITMAPB)
|
||||
{
|
||||
// Copy subexpanse to the Uncompressed branch intact
|
||||
JU_COPYMEM(PDstJP, PjpA, cJU_BITSPERSUBEXPB);
|
||||
|
||||
// Bump to next subexpanse
|
||||
PDstJP += cJU_BITSPERSUBEXPB;
|
||||
|
||||
// Set length of subexpanse
|
||||
jj = cJU_BITSPERSUBEXPB;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (jj = 0; jj < cJU_BITSPERSUBEXPB; jj++)
|
||||
{
|
||||
// Copy JP or NULLJP depending on bit
|
||||
if (BitMap & 1) { *PDstJP = *PjpA++; }
|
||||
else { *PDstJP = JPNull; }
|
||||
|
||||
PDstJP++; // advance to next JP
|
||||
BitMap >>= 1;
|
||||
}
|
||||
jj = PjpA - PjpB;
|
||||
}
|
||||
|
||||
// Free the subexpanse:
|
||||
|
||||
j__udyFreeJBBJP(JU_JBB_PJP(Pjbb, ii), jj, Pjpm);
|
||||
|
||||
} // for each JP in BranchU
|
||||
|
||||
#ifdef JU_STAGED_EXP
|
||||
|
||||
// Allocate memory for a BranchU:
|
||||
|
||||
PjbuRaw = j__udyAllocJBU(Pjpm);
|
||||
if (PjbuRaw == (Pjbu_t) NULL) return(-1);
|
||||
Pjbu = P_JBU(PjbuRaw);
|
||||
|
||||
// Copy staged branch to newly allocated branch:
|
||||
//
|
||||
// TBD: I think this code is broken.
|
||||
|
||||
*Pjbu = BranchU;
|
||||
|
||||
#endif // JU_STAGED_EXP
|
||||
|
||||
// Finally free the BranchB and put the BranchU in its place:
|
||||
|
||||
j__udyFreeJBB(PjbbRaw, Pjpm);
|
||||
|
||||
Pjp->jp_Addr = (Word_t) PjbuRaw;
|
||||
Pjp->jp_Type += cJU_JPBRANCH_U - cJU_JPBRANCH_B;
|
||||
|
||||
return(1);
|
||||
|
||||
} // j__udyCreateBranchU()
|
1206
dlls/arrayx/Judy-1.0.1/src/JudyCommon/JudyDecascade.c
Normal file
1206
dlls/arrayx/Judy-1.0.1/src/JudyCommon/JudyDecascade.c
Normal file
File diff suppressed because it is too large
Load Diff
2146
dlls/arrayx/Judy-1.0.1/src/JudyCommon/JudyDel.c
Normal file
2146
dlls/arrayx/Judy-1.0.1/src/JudyCommon/JudyDel.c
Normal file
File diff suppressed because it is too large
Load Diff
213
dlls/arrayx/Judy-1.0.1/src/JudyCommon/JudyFirst.c
Normal file
213
dlls/arrayx/Judy-1.0.1/src/JudyCommon/JudyFirst.c
Normal file
|
@ -0,0 +1,213 @@
|
|||
// Copyright (C) 2000 - 2002 Hewlett-Packard Company
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify it
|
||||
// under the term of the GNU Lesser General Public License as published by the
|
||||
// Free Software Foundation; either version 2 of the License, or (at your
|
||||
// option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
// for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with this program; if not, write to the Free Software Foundation,
|
||||
// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
// _________________
|
||||
|
||||
// @(#) $Revision$ $Source$
|
||||
//
|
||||
// Judy*First[Empty]() and Judy*Last[Empty]() routines for Judy1 and JudyL.
|
||||
// Compile with one of -DJUDY1 or -DJUDYL.
|
||||
//
|
||||
// These are inclusive versions of Judy*Next[Empty]() and Judy*Prev[Empty]().
|
||||
|
||||
#if (! (defined(JUDY1) || defined(JUDYL)))
|
||||
#error: One of -DJUDY1 or -DJUDYL must be specified.
|
||||
#endif
|
||||
|
||||
#ifdef JUDY1
|
||||
#include "Judy1.h"
|
||||
#else
|
||||
#include "JudyL.h"
|
||||
#endif
|
||||
|
||||
|
||||
// ****************************************************************************
|
||||
// J U D Y 1 F I R S T
|
||||
// J U D Y L F I R S T
|
||||
//
|
||||
// See the manual entry for details.
|
||||
|
||||
#ifdef JUDY1
|
||||
FUNCTION int Judy1First
|
||||
#else
|
||||
FUNCTION PPvoid_t JudyLFirst
|
||||
#endif
|
||||
(
|
||||
Pcvoid_t PArray, // Judy array to search.
|
||||
Word_t * PIndex, // starting point and result.
|
||||
PJError_t PJError // optional, for returning error info.
|
||||
)
|
||||
{
|
||||
if (PIndex == (PWord_t) NULL) // caller error:
|
||||
{
|
||||
JU_SET_ERRNO(PJError, JU_ERRNO_NULLPINDEX);
|
||||
JUDY1CODE(return(JERRI );)
|
||||
JUDYLCODE(return(PPJERR);)
|
||||
}
|
||||
|
||||
#ifdef JUDY1
|
||||
switch (Judy1Test(PArray, *PIndex, PJError))
|
||||
{
|
||||
case 1: return(1); // found *PIndex itself.
|
||||
case 0: return(Judy1Next(PArray, PIndex, PJError));
|
||||
default: return(JERRI);
|
||||
}
|
||||
#else
|
||||
{
|
||||
PPvoid_t PValue;
|
||||
|
||||
if ((PValue = JudyLGet(PArray, *PIndex, PJError)) == PPJERR)
|
||||
return(PPJERR);
|
||||
|
||||
if (PValue != (PPvoid_t) NULL) return(PValue); // found *PIndex.
|
||||
|
||||
return(JudyLNext(PArray, PIndex, PJError));
|
||||
}
|
||||
#endif
|
||||
|
||||
} // Judy1First() / JudyLFirst()
|
||||
|
||||
|
||||
// ****************************************************************************
|
||||
// J U D Y 1 L A S T
|
||||
// J U D Y L L A S T
|
||||
//
|
||||
// See the manual entry for details.
|
||||
|
||||
#ifdef JUDY1
|
||||
FUNCTION int Judy1Last(
|
||||
#else
|
||||
FUNCTION PPvoid_t JudyLLast(
|
||||
#endif
|
||||
Pcvoid_t PArray, // Judy array to search.
|
||||
Word_t * PIndex, // starting point and result.
|
||||
PJError_t PJError) // optional, for returning error info.
|
||||
{
|
||||
if (PIndex == (PWord_t) NULL)
|
||||
{
|
||||
JU_SET_ERRNO(PJError, JU_ERRNO_NULLPINDEX); // caller error.
|
||||
JUDY1CODE(return(JERRI );)
|
||||
JUDYLCODE(return(PPJERR);)
|
||||
}
|
||||
|
||||
#ifdef JUDY1
|
||||
switch (Judy1Test(PArray, *PIndex, PJError))
|
||||
{
|
||||
case 1: return(1); // found *PIndex itself.
|
||||
case 0: return(Judy1Prev(PArray, PIndex, PJError));
|
||||
default: return(JERRI);
|
||||
}
|
||||
#else
|
||||
{
|
||||
PPvoid_t PValue;
|
||||
|
||||
if ((PValue = JudyLGet(PArray, *PIndex, PJError)) == PPJERR)
|
||||
return(PPJERR);
|
||||
|
||||
if (PValue != (PPvoid_t) NULL) return(PValue); // found *PIndex.
|
||||
|
||||
return(JudyLPrev(PArray, PIndex, PJError));
|
||||
}
|
||||
#endif
|
||||
|
||||
} // Judy1Last() / JudyLLast()
|
||||
|
||||
|
||||
// ****************************************************************************
|
||||
// J U D Y 1 F I R S T E M P T Y
|
||||
// J U D Y L F I R S T E M P T Y
|
||||
//
|
||||
// See the manual entry for details.
|
||||
|
||||
#ifdef JUDY1
|
||||
FUNCTION int Judy1FirstEmpty(
|
||||
#else
|
||||
FUNCTION int JudyLFirstEmpty(
|
||||
#endif
|
||||
Pcvoid_t PArray, // Judy array to search.
|
||||
Word_t * PIndex, // starting point and result.
|
||||
PJError_t PJError) // optional, for returning error info.
|
||||
{
|
||||
if (PIndex == (PWord_t) NULL) // caller error:
|
||||
{
|
||||
JU_SET_ERRNO(PJError, JU_ERRNO_NULLPINDEX);
|
||||
return(JERRI);
|
||||
}
|
||||
|
||||
#ifdef JUDY1
|
||||
switch (Judy1Test(PArray, *PIndex, PJError))
|
||||
{
|
||||
case 0: return(1); // found *PIndex itself.
|
||||
case 1: return(Judy1NextEmpty(PArray, PIndex, PJError));
|
||||
default: return(JERRI);
|
||||
}
|
||||
#else
|
||||
{
|
||||
PPvoid_t PValue;
|
||||
|
||||
if ((PValue = JudyLGet(PArray, *PIndex, PJError)) == PPJERR)
|
||||
return(JERRI);
|
||||
|
||||
if (PValue == (PPvoid_t) NULL) return(1); // found *PIndex.
|
||||
|
||||
return(JudyLNextEmpty(PArray, PIndex, PJError));
|
||||
}
|
||||
#endif
|
||||
|
||||
} // Judy1FirstEmpty() / JudyLFirstEmpty()
|
||||
|
||||
|
||||
// ****************************************************************************
|
||||
// J U D Y 1 L A S T E M P T Y
|
||||
// J U D Y L L A S T E M P T Y
|
||||
//
|
||||
// See the manual entry for details.
|
||||
|
||||
#ifdef JUDY1
|
||||
FUNCTION int Judy1LastEmpty(
|
||||
#else
|
||||
FUNCTION int JudyLLastEmpty(
|
||||
#endif
|
||||
Pcvoid_t PArray, // Judy array to search.
|
||||
Word_t * PIndex, // starting point and result.
|
||||
PJError_t PJError) // optional, for returning error info.
|
||||
{
|
||||
if (PIndex == (PWord_t) NULL)
|
||||
{
|
||||
JU_SET_ERRNO(PJError, JU_ERRNO_NULLPINDEX); // caller error.
|
||||
return(JERRI);
|
||||
}
|
||||
|
||||
#ifdef JUDY1
|
||||
switch (Judy1Test(PArray, *PIndex, PJError))
|
||||
{
|
||||
case 0: return(1); // found *PIndex itself.
|
||||
case 1: return(Judy1PrevEmpty(PArray, PIndex, PJError));
|
||||
default: return(JERRI);
|
||||
}
|
||||
#else
|
||||
{
|
||||
PPvoid_t PValue;
|
||||
|
||||
if ((PValue = JudyLGet(PArray, *PIndex, PJError)) == PPJERR)
|
||||
return(JERRI);
|
||||
|
||||
if (PValue == (PPvoid_t) NULL) return(1); // found *PIndex.
|
||||
|
||||
return(JudyLPrevEmpty(PArray, PIndex, PJError));
|
||||
}
|
||||
#endif
|
||||
|
||||
} // Judy1LastEmpty() / JudyLLastEmpty()
|
363
dlls/arrayx/Judy-1.0.1/src/JudyCommon/JudyFreeArray.c
Normal file
363
dlls/arrayx/Judy-1.0.1/src/JudyCommon/JudyFreeArray.c
Normal file
|
@ -0,0 +1,363 @@
|
|||
// Copyright (C) 2000 - 2002 Hewlett-Packard Company
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify it
|
||||
// under the term of the GNU Lesser General Public License as published by the
|
||||
// Free Software Foundation; either version 2 of the License, or (at your
|
||||
// option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
// for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with this program; if not, write to the Free Software Foundation,
|
||||
// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
// _________________
|
||||
|
||||
// @(#) $Revision$ $Source$
|
||||
//
|
||||
// Judy1FreeArray() and JudyLFreeArray() functions for Judy1 and JudyL.
|
||||
// Compile with one of -DJUDY1 or -DJUDYL.
|
||||
// Return the number of bytes freed from the array.
|
||||
|
||||
#if (! (defined(JUDY1) || defined(JUDYL)))
|
||||
#error: One of -DJUDY1 or -DJUDYL must be specified.
|
||||
#endif
|
||||
|
||||
#ifdef JUDY1
|
||||
#include "Judy1.h"
|
||||
#else
|
||||
#include "JudyL.h"
|
||||
#endif
|
||||
|
||||
#include "JudyPrivate1L.h"
|
||||
|
||||
DBGCODE(extern void JudyCheckPop(Pvoid_t PArray);)
|
||||
|
||||
|
||||
// ****************************************************************************
|
||||
// J U D Y 1 F R E E A R R A Y
|
||||
// J U D Y L F R E E A R R A Y
|
||||
//
|
||||
// See the Judy*(3C) manual entry for details.
|
||||
//
|
||||
// This code is written recursively, at least at first, because thats much
|
||||
// simpler. Hope its fast enough.
|
||||
|
||||
#ifdef JUDY1
|
||||
FUNCTION Word_t Judy1FreeArray
|
||||
#else
|
||||
FUNCTION Word_t JudyLFreeArray
|
||||
#endif
|
||||
(
|
||||
PPvoid_t PPArray, // array to free.
|
||||
PJError_t PJError // optional, for returning error info.
|
||||
)
|
||||
{
|
||||
jpm_t jpm; // local to accumulate free statistics.
|
||||
|
||||
// CHECK FOR NULL POINTER (error by caller):
|
||||
|
||||
if (PPArray == (PPvoid_t) NULL)
|
||||
{
|
||||
JU_SET_ERRNO(PJError, JU_ERRNO_NULLPPARRAY);
|
||||
return(JERR);
|
||||
}
|
||||
|
||||
DBGCODE(JudyCheckPop(*PPArray);)
|
||||
|
||||
// Zero jpm.jpm_Pop0 (meaning the array will be empty in a moment) for accurate
|
||||
// logging in TRACEMI2.
|
||||
|
||||
jpm.jpm_Pop0 = 0; // see above.
|
||||
jpm.jpm_TotalMemWords = 0; // initialize memory freed.
|
||||
|
||||
// Empty array:
|
||||
|
||||
if (P_JLW(*PPArray) == (Pjlw_t) NULL) return(0);
|
||||
|
||||
// PROCESS TOP LEVEL "JRP" BRANCHES AND LEAF:
|
||||
|
||||
if (JU_LEAFW_POP0(*PPArray) < cJU_LEAFW_MAXPOP1) // must be a LEAFW
|
||||
{
|
||||
Pjlw_t Pjlw = P_JLW(*PPArray); // first word of leaf.
|
||||
|
||||
j__udyFreeJLW(Pjlw, Pjlw[0] + 1, &jpm);
|
||||
*PPArray = (Pvoid_t) NULL; // make an empty array.
|
||||
return (-(jpm.jpm_TotalMemWords * cJU_BYTESPERWORD)); // see above.
|
||||
}
|
||||
else
|
||||
|
||||
// Rootstate leaves: just free the leaf:
|
||||
|
||||
// Common code for returning the amount of memory freed.
|
||||
//
|
||||
// Note: In a an ordinary LEAFW, pop0 = *PPArray[0].
|
||||
//
|
||||
// Accumulate (negative) words freed, while freeing objects.
|
||||
// Return the positive bytes freed.
|
||||
|
||||
{
|
||||
Pjpm_t Pjpm = P_JPM(*PPArray);
|
||||
Word_t TotalMem = Pjpm->jpm_TotalMemWords;
|
||||
|
||||
j__udyFreeSM(&(Pjpm->jpm_JP), &jpm); // recurse through tree.
|
||||
j__udyFreeJPM(Pjpm, &jpm);
|
||||
|
||||
// Verify the array was not corrupt. This means that amount of memory freed
|
||||
// (which is negative) is equal to the initial amount:
|
||||
|
||||
if (TotalMem + jpm.jpm_TotalMemWords)
|
||||
{
|
||||
JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT);
|
||||
return(JERR);
|
||||
}
|
||||
|
||||
*PPArray = (Pvoid_t) NULL; // make an empty array.
|
||||
return (TotalMem * cJU_BYTESPERWORD);
|
||||
}
|
||||
|
||||
} // Judy1FreeArray() / JudyLFreeArray()
|
||||
|
||||
|
||||
// ****************************************************************************
|
||||
// __ J U D Y F R E E S M
|
||||
//
|
||||
// Given a pointer to a JP, recursively visit and free (depth first) all nodes
|
||||
// in a Judy array BELOW the JP, but not the JP itself. Accumulate in *Pjpm
|
||||
// the total words freed (as a negative value). "SM" = State Machine.
|
||||
//
|
||||
// Note: Corruption is not detected at this level because during a FreeArray,
|
||||
// if the code hasnt already core dumped, its better to remain silent, even
|
||||
// if some memory has not been freed, than to bother the caller about the
|
||||
// corruption. TBD: Is this true? If not, must list all legitimate JPNULL
|
||||
// and JPIMMED above first, and revert to returning bool_t (see 4.34).
|
||||
|
||||
FUNCTION void j__udyFreeSM(
|
||||
Pjp_t Pjp, // top of Judy (top-state).
|
||||
Pjpm_t Pjpm) // to return words freed.
|
||||
{
|
||||
Word_t Pop1;
|
||||
|
||||
switch (JU_JPTYPE(Pjp))
|
||||
{
|
||||
|
||||
#ifdef JUDY1
|
||||
|
||||
// FULL EXPANSE -- nothing to free for this jp_Type.
|
||||
|
||||
case cJ1_JPFULLPOPU1:
|
||||
break;
|
||||
#endif
|
||||
|
||||
// JUDY BRANCH -- free the sub-tree depth first:
|
||||
|
||||
// LINEAR BRANCH -- visit each JP in the JBLs list, then free the JBL:
|
||||
//
|
||||
// Note: There are no null JPs in a JBL.
|
||||
|
||||
case cJU_JPBRANCH_L:
|
||||
case cJU_JPBRANCH_L2:
|
||||
case cJU_JPBRANCH_L3:
|
||||
#ifdef JU_64BIT
|
||||
case cJU_JPBRANCH_L4:
|
||||
case cJU_JPBRANCH_L5:
|
||||
case cJU_JPBRANCH_L6:
|
||||
case cJU_JPBRANCH_L7:
|
||||
#endif // JU_64BIT
|
||||
{
|
||||
Pjbl_t Pjbl = P_JBL(Pjp->jp_Addr);
|
||||
Word_t offset;
|
||||
|
||||
for (offset = 0; offset < Pjbl->jbl_NumJPs; ++offset)
|
||||
j__udyFreeSM((Pjbl->jbl_jp) + offset, Pjpm);
|
||||
|
||||
j__udyFreeJBL((Pjbl_t) (Pjp->jp_Addr), Pjpm);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
// BITMAP BRANCH -- visit each JP in the JBBs list based on the bitmap, also
|
||||
//
|
||||
// Note: There are no null JPs in a JBB.
|
||||
|
||||
case cJU_JPBRANCH_B:
|
||||
case cJU_JPBRANCH_B2:
|
||||
case cJU_JPBRANCH_B3:
|
||||
#ifdef JU_64BIT
|
||||
case cJU_JPBRANCH_B4:
|
||||
case cJU_JPBRANCH_B5:
|
||||
case cJU_JPBRANCH_B6:
|
||||
case cJU_JPBRANCH_B7:
|
||||
#endif // JU_64BIT
|
||||
{
|
||||
Word_t subexp;
|
||||
Word_t offset;
|
||||
Word_t jpcount;
|
||||
|
||||
Pjbb_t Pjbb = P_JBB(Pjp->jp_Addr);
|
||||
|
||||
for (subexp = 0; subexp < cJU_NUMSUBEXPB; ++subexp)
|
||||
{
|
||||
jpcount = j__udyCountBitsB(JU_JBB_BITMAP(Pjbb, subexp));
|
||||
|
||||
if (jpcount)
|
||||
{
|
||||
for (offset = 0; offset < jpcount; ++offset)
|
||||
{
|
||||
j__udyFreeSM(P_JP(JU_JBB_PJP(Pjbb, subexp)) + offset,
|
||||
Pjpm);
|
||||
}
|
||||
j__udyFreeJBBJP(JU_JBB_PJP(Pjbb, subexp), jpcount, Pjpm);
|
||||
}
|
||||
}
|
||||
j__udyFreeJBB((Pjbb_t) (Pjp->jp_Addr), Pjpm);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
// UNCOMPRESSED BRANCH -- visit each JP in the JBU array, then free the JBU
|
||||
// itself:
|
||||
//
|
||||
// Note: Null JPs are handled during recursion at a lower state.
|
||||
|
||||
case cJU_JPBRANCH_U:
|
||||
case cJU_JPBRANCH_U2:
|
||||
case cJU_JPBRANCH_U3:
|
||||
#ifdef JU_64BIT
|
||||
case cJU_JPBRANCH_U4:
|
||||
case cJU_JPBRANCH_U5:
|
||||
case cJU_JPBRANCH_U6:
|
||||
case cJU_JPBRANCH_U7:
|
||||
#endif // JU_64BIT
|
||||
{
|
||||
Word_t offset;
|
||||
Pjbu_t Pjbu = P_JBU(Pjp->jp_Addr);
|
||||
|
||||
for (offset = 0; offset < cJU_BRANCHUNUMJPS; ++offset)
|
||||
j__udyFreeSM((Pjbu->jbu_jp) + offset, Pjpm);
|
||||
|
||||
j__udyFreeJBU((Pjbu_t) (Pjp->jp_Addr), Pjpm);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
// -- Cases below here terminate and do not recurse. --
|
||||
|
||||
|
||||
// LINEAR LEAF -- just free the leaf; size is computed from jp_Type:
|
||||
//
|
||||
// Note: cJU_JPLEAF1 is a special case, see discussion in ../Judy1/Judy1.h
|
||||
|
||||
#if (defined(JUDYL) || (! defined(JU_64BIT)))
|
||||
case cJU_JPLEAF1:
|
||||
Pop1 = JU_JPLEAF_POP0(Pjp) + 1;
|
||||
j__udyFreeJLL1((Pjll_t) (Pjp->jp_Addr), Pop1, Pjpm);
|
||||
break;
|
||||
#endif
|
||||
|
||||
case cJU_JPLEAF2:
|
||||
Pop1 = JU_JPLEAF_POP0(Pjp) + 1;
|
||||
j__udyFreeJLL2((Pjll_t) (Pjp->jp_Addr), Pop1, Pjpm);
|
||||
break;
|
||||
|
||||
case cJU_JPLEAF3:
|
||||
Pop1 = JU_JPLEAF_POP0(Pjp) + 1;
|
||||
j__udyFreeJLL3((Pjll_t) (Pjp->jp_Addr), Pop1, Pjpm);
|
||||
break;
|
||||
|
||||
#ifdef JU_64BIT
|
||||
case cJU_JPLEAF4:
|
||||
Pop1 = JU_JPLEAF_POP0(Pjp) + 1;
|
||||
j__udyFreeJLL4((Pjll_t) (Pjp->jp_Addr), Pop1, Pjpm);
|
||||
break;
|
||||
|
||||
case cJU_JPLEAF5:
|
||||
Pop1 = JU_JPLEAF_POP0(Pjp) + 1;
|
||||
j__udyFreeJLL5((Pjll_t) (Pjp->jp_Addr), Pop1, Pjpm);
|
||||
break;
|
||||
|
||||
case cJU_JPLEAF6:
|
||||
Pop1 = JU_JPLEAF_POP0(Pjp) + 1;
|
||||
j__udyFreeJLL6((Pjll_t) (Pjp->jp_Addr), Pop1, Pjpm);
|
||||
break;
|
||||
|
||||
case cJU_JPLEAF7:
|
||||
Pop1 = JU_JPLEAF_POP0(Pjp) + 1;
|
||||
j__udyFreeJLL7((Pjll_t) (Pjp->jp_Addr), Pop1, Pjpm);
|
||||
break;
|
||||
#endif // JU_64BIT
|
||||
|
||||
|
||||
// BITMAP LEAF -- free sub-expanse arrays of JPs, then free the JBB.
|
||||
|
||||
case cJU_JPLEAF_B1:
|
||||
{
|
||||
#ifdef JUDYL
|
||||
Word_t subexp;
|
||||
Word_t jpcount;
|
||||
Pjlb_t Pjlb = P_JLB(Pjp->jp_Addr);
|
||||
|
||||
// Free the value areas in the bitmap leaf:
|
||||
|
||||
for (subexp = 0; subexp < cJU_NUMSUBEXPL; ++subexp)
|
||||
{
|
||||
jpcount = j__udyCountBitsL(JU_JLB_BITMAP(Pjlb, subexp));
|
||||
|
||||
if (jpcount)
|
||||
j__udyLFreeJV(JL_JLB_PVALUE(Pjlb, subexp), jpcount, Pjpm);
|
||||
}
|
||||
#endif // JUDYL
|
||||
|
||||
j__udyFreeJLB1((Pjlb_t) (Pjp->jp_Addr), Pjpm);
|
||||
break;
|
||||
|
||||
} // case cJU_JPLEAF_B1
|
||||
|
||||
#ifdef JUDYL
|
||||
|
||||
|
||||
// IMMED*:
|
||||
//
|
||||
// For JUDYL, all non JPIMMED_*_01s have a LeafV which must be freed:
|
||||
|
||||
case cJU_JPIMMED_1_02:
|
||||
case cJU_JPIMMED_1_03:
|
||||
#ifdef JU_64BIT
|
||||
case cJU_JPIMMED_1_04:
|
||||
case cJU_JPIMMED_1_05:
|
||||
case cJU_JPIMMED_1_06:
|
||||
case cJU_JPIMMED_1_07:
|
||||
#endif
|
||||
Pop1 = JU_JPTYPE(Pjp) - cJU_JPIMMED_1_02 + 2;
|
||||
j__udyLFreeJV((Pjv_t) (Pjp->jp_Addr), Pop1, Pjpm);
|
||||
break;
|
||||
|
||||
#ifdef JU_64BIT
|
||||
case cJU_JPIMMED_2_02:
|
||||
case cJU_JPIMMED_2_03:
|
||||
|
||||
Pop1 = JU_JPTYPE(Pjp) - cJU_JPIMMED_2_02 + 2;
|
||||
j__udyLFreeJV((Pjv_t) (Pjp->jp_Addr), Pop1, Pjpm);
|
||||
break;
|
||||
|
||||
case cJU_JPIMMED_3_02:
|
||||
j__udyLFreeJV((Pjv_t) (Pjp->jp_Addr), 2, Pjpm);
|
||||
break;
|
||||
|
||||
#endif // JU_64BIT
|
||||
#endif // JUDYL
|
||||
|
||||
|
||||
// OTHER JPNULL, JPIMMED, OR UNEXPECTED TYPE -- nothing to free for this type:
|
||||
//
|
||||
// Note: Lump together no-op and invalid JP types; see function header
|
||||
// comments.
|
||||
|
||||
default: break;
|
||||
|
||||
} // switch (JU_JPTYPE(Pjp))
|
||||
|
||||
} // j__udyFreeSM()
|
1094
dlls/arrayx/Judy-1.0.1/src/JudyCommon/JudyGet.c
Normal file
1094
dlls/arrayx/Judy-1.0.1/src/JudyCommon/JudyGet.c
Normal file
File diff suppressed because it is too large
Load Diff
1873
dlls/arrayx/Judy-1.0.1/src/JudyCommon/JudyIns.c
Normal file
1873
dlls/arrayx/Judy-1.0.1/src/JudyCommon/JudyIns.c
Normal file
File diff suppressed because it is too large
Load Diff
1178
dlls/arrayx/Judy-1.0.1/src/JudyCommon/JudyInsArray.c
Normal file
1178
dlls/arrayx/Judy-1.0.1/src/JudyCommon/JudyInsArray.c
Normal file
File diff suppressed because it is too large
Load Diff
135
dlls/arrayx/Judy-1.0.1/src/JudyCommon/JudyInsertBranch.c
Normal file
135
dlls/arrayx/Judy-1.0.1/src/JudyCommon/JudyInsertBranch.c
Normal file
|
@ -0,0 +1,135 @@
|
|||
// Copyright (C) 2000 - 2002 Hewlett-Packard Company
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify it
|
||||
// under the term of the GNU Lesser General Public License as published by the
|
||||
// Free Software Foundation; either version 2 of the License, or (at your
|
||||
// option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
// for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with this program; if not, write to the Free Software Foundation,
|
||||
// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
// _________________
|
||||
|
||||
// @(#) $Revision$ $Source$
|
||||
|
||||
// BranchL insertion functions for Judy1 and JudyL.
|
||||
// Compile with one of -DJUDY1 or -DJUDYL.
|
||||
|
||||
#if (! (defined(JUDY1) || defined(JUDYL)))
|
||||
#error: One of -DJUDY1 or -DJUDYL must be specified.
|
||||
#endif
|
||||
|
||||
#ifdef JUDY1
|
||||
#include "Judy1.h"
|
||||
#else
|
||||
#include "JudyL.h"
|
||||
#endif
|
||||
|
||||
#include "JudyPrivate1L.h"
|
||||
|
||||
extern int j__udyCreateBranchL(Pjp_t, Pjp_t, uint8_t *, Word_t, Pvoid_t);
|
||||
|
||||
|
||||
// ****************************************************************************
|
||||
// __ J U D Y I N S E R T B R A N C H
|
||||
//
|
||||
// Insert 2-element BranchL in between Pjp and Pjp->jp_Addr.
|
||||
//
|
||||
// Return -1 if out of memory, otherwise return 1.
|
||||
|
||||
FUNCTION int j__udyInsertBranch(
|
||||
Pjp_t Pjp, // JP containing narrow pointer.
|
||||
Word_t Index, // outlier to Pjp.
|
||||
Word_t BranchLevel, // of what JP points to, mapped from JP type.
|
||||
Pjpm_t Pjpm) // for global accounting.
|
||||
{
|
||||
jp_t JP2 [2];
|
||||
jp_t JP;
|
||||
Pjp_t PjpNull;
|
||||
Word_t XorExp;
|
||||
Word_t Inew, Iold;
|
||||
Word_t DCDMask; // initially for original BranchLevel.
|
||||
int Ret;
|
||||
uint8_t Exp2[2];
|
||||
uint8_t DecodeByteN, DecodeByteO;
|
||||
|
||||
// Get the current mask for the DCD digits:
|
||||
|
||||
DCDMask = cJU_DCDMASK(BranchLevel);
|
||||
|
||||
// Obtain Dcd bits that differ between Index and JP, shifted so the
|
||||
// digit for BranchLevel is the LSB:
|
||||
|
||||
XorExp = ((Index ^ JU_JPDCDPOP0(Pjp)) & (cJU_ALLONES >> cJU_BITSPERBYTE))
|
||||
>> (BranchLevel * cJU_BITSPERBYTE);
|
||||
assert(XorExp); // Index must be an outlier.
|
||||
|
||||
// Count levels between object under narrow pointer and the level at which
|
||||
// the outlier diverges from it, which is always at least initial
|
||||
// BranchLevel + 1, to end up with the level (JP type) at which to insert
|
||||
// the new intervening BranchL:
|
||||
|
||||
do { ++BranchLevel; } while ((XorExp >>= cJU_BITSPERBYTE));
|
||||
assert((BranchLevel > 1) && (BranchLevel < cJU_ROOTSTATE));
|
||||
|
||||
// Get the MSB (highest digit) that differs between the old expanse and
|
||||
// the new Index to insert:
|
||||
|
||||
DecodeByteO = JU_DIGITATSTATE(JU_JPDCDPOP0(Pjp), BranchLevel);
|
||||
DecodeByteN = JU_DIGITATSTATE(Index, BranchLevel);
|
||||
|
||||
assert(DecodeByteO != DecodeByteN);
|
||||
|
||||
// Determine sorted order for old expanse and new Index digits:
|
||||
|
||||
if (DecodeByteN > DecodeByteO) { Iold = 0; Inew = 1; }
|
||||
else { Iold = 1; Inew = 0; }
|
||||
|
||||
// Copy old JP into staging area for new Branch
|
||||
JP2 [Iold] = *Pjp;
|
||||
Exp2[Iold] = DecodeByteO;
|
||||
Exp2[Inew] = DecodeByteN;
|
||||
|
||||
// Create a 2 Expanse Linear branch
|
||||
//
|
||||
// Note: Pjp->jp_Addr is set by j__udyCreateBranchL()
|
||||
|
||||
Ret = j__udyCreateBranchL(Pjp, JP2, Exp2, 2, Pjpm);
|
||||
if (Ret == -1) return(-1);
|
||||
|
||||
// Get Pjp to the NULL of where to do insert
|
||||
PjpNull = ((P_JBL(Pjp->jp_Addr))->jbl_jp) + Inew;
|
||||
|
||||
// Convert to a cJU_JPIMMED_*_01 at the correct level:
|
||||
// Build JP and set type below to: cJU_JPIMMED_X_01
|
||||
JU_JPSETADT(PjpNull, 0, Index, cJU_JPIMMED_1_01 - 2 + BranchLevel);
|
||||
|
||||
// Return pointer to Value area in cJU_JPIMMED_X_01
|
||||
JUDYLCODE(Pjpm->jpm_PValue = (Pjv_t) PjpNull;)
|
||||
|
||||
// The old JP now points to a BranchL that is at higher level. Therefore
|
||||
// it contains excess DCD bits (in the least significant position) that
|
||||
// must be removed (zeroed); that is, they become part of the Pop0
|
||||
// subfield. Note that the remaining (lower) bytes in the Pop0 field do
|
||||
// not change.
|
||||
//
|
||||
// Take from the old DCDMask, which went "down" to a lower BranchLevel,
|
||||
// and zero any high bits that are still in the mask at the new, higher
|
||||
// BranchLevel; then use this mask to zero the bits in jp_DcdPopO:
|
||||
|
||||
// Set old JP to a BranchL at correct level
|
||||
|
||||
Pjp->jp_Type = cJU_JPBRANCH_L2 - 2 + BranchLevel;
|
||||
DCDMask ^= cJU_DCDMASK(BranchLevel);
|
||||
DCDMask = ~DCDMask & JU_JPDCDPOP0(Pjp);
|
||||
JP = *Pjp;
|
||||
JU_JPSETADT(Pjp, JP.jp_Addr, DCDMask, JP.jp_Type);
|
||||
|
||||
return(1);
|
||||
|
||||
} // j__udyInsertBranch()
|
87
dlls/arrayx/Judy-1.0.1/src/JudyCommon/JudyMalloc.c
Normal file
87
dlls/arrayx/Judy-1.0.1/src/JudyCommon/JudyMalloc.c
Normal file
|
@ -0,0 +1,87 @@
|
|||
// Copyright (C) 2000 - 2002 Hewlett-Packard Company
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify it
|
||||
// under the term of the GNU Lesser General Public License as published by the
|
||||
// Free Software Foundation; either version 2 of the License, or (at your
|
||||
// option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
// for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with this program; if not, write to the Free Software Foundation,
|
||||
// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
// _________________
|
||||
|
||||
// @(#) $Revision$ $Source$
|
||||
// ************************************************************************ //
|
||||
// JUDY - Memory Allocater //
|
||||
// -by- //
|
||||
// Douglas L. Baskins //
|
||||
// Hewlett Packard //
|
||||
// Fort Collins, Co //
|
||||
// (970) 229-2027 //
|
||||
// //
|
||||
// ************************************************************************ //
|
||||
|
||||
// JUDY INCLUDE FILES
|
||||
#include "Judy.h"
|
||||
|
||||
// ****************************************************************************
|
||||
// J U D Y M A L L O C
|
||||
//
|
||||
// Allocate RAM. This is the single location in Judy code that calls
|
||||
// malloc(3C). Note: JPM accounting occurs at a higher level.
|
||||
|
||||
Word_t JudyMalloc(
|
||||
Word_t Words)
|
||||
{
|
||||
Word_t Addr;
|
||||
|
||||
Addr = (Word_t) malloc(Words * sizeof(Word_t));
|
||||
return(Addr);
|
||||
|
||||
} // JudyMalloc()
|
||||
|
||||
|
||||
// ****************************************************************************
|
||||
// J U D Y F R E E
|
||||
|
||||
void JudyFree(
|
||||
void * PWord,
|
||||
Word_t Words)
|
||||
{
|
||||
(void) Words;
|
||||
free(PWord);
|
||||
|
||||
} // JudyFree()
|
||||
|
||||
|
||||
// ****************************************************************************
|
||||
// J U D Y M A L L O C
|
||||
//
|
||||
// Higher-level "wrapper" for allocating objects that need not be in RAM,
|
||||
// although at this time they are in fact only in RAM. Later we hope that some
|
||||
// entire subtrees (at a JPM or branch) can be "virtual", so their allocations
|
||||
// and frees should go through this level.
|
||||
|
||||
Word_t JudyMallocVirtual(
|
||||
Word_t Words)
|
||||
{
|
||||
return(JudyMalloc(Words));
|
||||
|
||||
} // JudyMallocVirtual()
|
||||
|
||||
|
||||
// ****************************************************************************
|
||||
// J U D Y F R E E
|
||||
|
||||
void JudyFreeVirtual(
|
||||
void * PWord,
|
||||
Word_t Words)
|
||||
{
|
||||
JudyFree(PWord, Words);
|
||||
|
||||
} // JudyFreeVirtual()
|
782
dlls/arrayx/Judy-1.0.1/src/JudyCommon/JudyMallocIF.c
Normal file
782
dlls/arrayx/Judy-1.0.1/src/JudyCommon/JudyMallocIF.c
Normal file
|
@ -0,0 +1,782 @@
|
|||
// Copyright (C) 2000 - 2002 Hewlett-Packard Company
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify it
|
||||
// under the term of the GNU Lesser General Public License as published by the
|
||||
// Free Software Foundation; either version 2 of the License, or (at your
|
||||
// option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
// for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with this program; if not, write to the Free Software Foundation,
|
||||
// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
// _________________
|
||||
|
||||
// @(#) $Revision$ $Source$
|
||||
//
|
||||
// Judy malloc/free interface functions for Judy1 and JudyL.
|
||||
//
|
||||
// Compile with one of -DJUDY1 or -DJUDYL.
|
||||
//
|
||||
// Compile with -DTRACEMI (Malloc Interface) to turn on tracing of malloc/free
|
||||
// calls at the interface level. (See also TRACEMF in lower-level code.)
|
||||
// Use -DTRACEMI2 for a terser format suitable for trace analysis.
|
||||
//
|
||||
// There can be malloc namespace bits in the LSBs of "raw" addresses from most,
|
||||
// but not all, of the j__udy*Alloc*() functions; see also JudyPrivate.h. To
|
||||
// test the Judy code, compile this file with -DMALLOCBITS and use debug flavor
|
||||
// only (for assertions). This test ensures that (a) all callers properly mask
|
||||
// the namespace bits out before dereferencing a pointer (or else a core dump
|
||||
// occurs), and (b) all callers send "raw" (unmasked) addresses to
|
||||
// j__udy*Free*() calls.
|
||||
//
|
||||
// Note: Currently -DDEBUG turns on MALLOCBITS automatically.
|
||||
|
||||
#if (! (defined(JUDY1) || defined(JUDYL)))
|
||||
#error: One of -DJUDY1 or -DJUDYL must be specified.
|
||||
#endif
|
||||
|
||||
#ifdef JUDY1
|
||||
#include "Judy1.h"
|
||||
#else
|
||||
#include "JudyL.h"
|
||||
#endif
|
||||
|
||||
#include "JudyPrivate1L.h"
|
||||
|
||||
// Set "hidden" global j__uMaxWords to the maximum number of words to allocate
|
||||
// to any one array (large enough to have a JPM, otherwise j__uMaxWords is
|
||||
// ignored), to trigger a fake malloc error when the number is exceeded. Note,
|
||||
// this code is always executed, not #ifdefd, because its virtually free.
|
||||
//
|
||||
// Note: To keep the MALLOC macro faster and simpler, set j__uMaxWords to
|
||||
// MAXINT, not zero, by default.
|
||||
|
||||
Word_t j__uMaxWords = ~0UL;
|
||||
|
||||
// This macro hides the faking of a malloc failure:
|
||||
//
|
||||
// Note: To keep this fast, just compare WordsPrev to j__uMaxWords without the
|
||||
// complexity of first adding WordsNow, meaning the trigger point is not
|
||||
// exactly where you might assume, but it shouldnt matter.
|
||||
|
||||
#define MALLOC(MallocFunc,WordsPrev,WordsNow) \
|
||||
(((WordsPrev) > j__uMaxWords) ? 0UL : MallocFunc(WordsNow))
|
||||
|
||||
// Clear words starting at address:
|
||||
//
|
||||
// Note: Only use this for objects that care; in other cases, it doesnt
|
||||
// matter if the objects memory is pre-zeroed.
|
||||
|
||||
#define ZEROWORDS(Addr,Words) \
|
||||
{ \
|
||||
Word_t Words__ = (Words); \
|
||||
PWord_t Addr__ = (PWord_t) (Addr); \
|
||||
while (Words__--) *Addr__++ = 0UL; \
|
||||
}
|
||||
|
||||
#ifdef TRACEMI
|
||||
|
||||
// TRACING SUPPORT:
|
||||
//
|
||||
// Note: For TRACEMI, use a format for address printing compatible with other
|
||||
// tracing facilities; in particular, %x not %lx, to truncate the "noisy" high
|
||||
// part on 64-bit systems.
|
||||
//
|
||||
// TBD: The trace macros need fixing for alternate address types.
|
||||
//
|
||||
// Note: TRACEMI2 supports trace analysis no matter the underlying malloc/free
|
||||
// engine used.
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
static Word_t j__udyMemSequence = 0L; // event sequence number.
|
||||
|
||||
#define TRACE_ALLOC5(a,b,c,d,e) (void) printf(a, (b), c, d)
|
||||
#define TRACE_FREE5( a,b,c,d,e) (void) printf(a, (b), c, d)
|
||||
#define TRACE_ALLOC6(a,b,c,d,e,f) (void) printf(a, (b), c, d, e)
|
||||
#define TRACE_FREE6( a,b,c,d,e,f) (void) printf(a, (b), c, d, e)
|
||||
|
||||
#else
|
||||
|
||||
#ifdef TRACEMI2
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#define b_pw cJU_BYTESPERWORD
|
||||
|
||||
#define TRACE_ALLOC5(a,b,c,d,e) \
|
||||
(void) printf("a %lx %lx %lx\n", (b), (d) * b_pw, e)
|
||||
#define TRACE_FREE5( a,b,c,d,e) \
|
||||
(void) printf("f %lx %lx %lx\n", (b), (d) * b_pw, e)
|
||||
#define TRACE_ALLOC6(a,b,c,d,e,f) \
|
||||
(void) printf("a %lx %lx %lx\n", (b), (e) * b_pw, f)
|
||||
#define TRACE_FREE6( a,b,c,d,e,f) \
|
||||
(void) printf("f %lx %lx %lx\n", (b), (e) * b_pw, f)
|
||||
|
||||
static Word_t j__udyMemSequence = 0L; // event sequence number.
|
||||
|
||||
#else
|
||||
|
||||
#define TRACE_ALLOC5(a,b,c,d,e) // null.
|
||||
#define TRACE_FREE5( a,b,c,d,e) // null.
|
||||
#define TRACE_ALLOC6(a,b,c,d,e,f) // null.
|
||||
#define TRACE_FREE6( a,b,c,d,e,f) // null.
|
||||
|
||||
#endif // ! TRACEMI2
|
||||
#endif // ! TRACEMI
|
||||
|
||||
|
||||
// MALLOC NAMESPACE SUPPORT:
|
||||
|
||||
#if (defined(DEBUG) && (! defined(MALLOCBITS))) // for now, DEBUG => MALLOCBITS:
|
||||
#define MALLOCBITS 1
|
||||
#endif
|
||||
|
||||
#ifdef MALLOCBITS
|
||||
#define MALLOCBITS_VALUE 0x3 // bit pattern to use.
|
||||
#define MALLOCBITS_MASK 0x7 // note: matches mask__ in JudyPrivate.h.
|
||||
|
||||
#define MALLOCBITS_SET( Type,Addr) \
|
||||
((Addr) = (Type) ((Word_t) (Addr) | MALLOCBITS_VALUE))
|
||||
#define MALLOCBITS_TEST(Type,Addr) \
|
||||
assert((((Word_t) (Addr)) & MALLOCBITS_MASK) == MALLOCBITS_VALUE); \
|
||||
((Addr) = (Type) ((Word_t) (Addr) & ~MALLOCBITS_VALUE))
|
||||
#else
|
||||
#define MALLOCBITS_SET( Type,Addr) // null.
|
||||
#define MALLOCBITS_TEST(Type,Addr) // null.
|
||||
#endif
|
||||
|
||||
|
||||
// SAVE ERROR INFORMATION IN A Pjpm:
|
||||
//
|
||||
// "Small" (invalid) Addr values are used to distinguish overrun and no-mem
|
||||
// errors. (TBD, non-zero invalid values are no longer returned from
|
||||
// lower-level functions, that is, JU_ERRNO_OVERRUN is no longer detected.)
|
||||
|
||||
#define J__UDYSETALLOCERROR(Addr) \
|
||||
{ \
|
||||
JU_ERRID(Pjpm) = __LINE__; \
|
||||
if ((Word_t) (Addr) > 0) JU_ERRNO(Pjpm) = JU_ERRNO_OVERRUN; \
|
||||
else JU_ERRNO(Pjpm) = JU_ERRNO_NOMEM; \
|
||||
return(0); \
|
||||
}
|
||||
|
||||
|
||||
// ****************************************************************************
|
||||
// ALLOCATION FUNCTIONS:
|
||||
//
|
||||
// To help the compiler catch coding errors, each function returns a specific
|
||||
// object type.
|
||||
//
|
||||
// Note: Only j__udyAllocJPM() and j__udyAllocJLW() return multiple values <=
|
||||
// sizeof(Word_t) to indicate the type of memory allocation failure. Other
|
||||
// allocation functions convert this failure to a JU_ERRNO.
|
||||
|
||||
|
||||
// Note: Unlike other j__udyAlloc*() functions, Pjpms are returned non-raw,
|
||||
// that is, without malloc namespace or root pointer type bits:
|
||||
|
||||
FUNCTION Pjpm_t j__udyAllocJPM(void)
|
||||
{
|
||||
Word_t Words = sizeof(jpm_t) / cJU_BYTESPERWORD;
|
||||
Pjpm_t Pjpm = (Pjpm_t) MALLOC(JudyMalloc, Words, Words);
|
||||
|
||||
assert((Words * cJU_BYTESPERWORD) == sizeof(jpm_t));
|
||||
|
||||
if ((Word_t) Pjpm > sizeof(Word_t))
|
||||
{
|
||||
ZEROWORDS(Pjpm, Words);
|
||||
Pjpm->jpm_TotalMemWords = Words;
|
||||
}
|
||||
|
||||
TRACE_ALLOC5("0x%x %8lu = j__udyAllocJPM(), Words = %lu\n",
|
||||
Pjpm, j__udyMemSequence++, Words, cJU_LEAFW_MAXPOP1 + 1);
|
||||
// MALLOCBITS_SET(Pjpm_t, Pjpm); // see above.
|
||||
return(Pjpm);
|
||||
|
||||
} // j__udyAllocJPM()
|
||||
|
||||
|
||||
FUNCTION Pjbl_t j__udyAllocJBL(Pjpm_t Pjpm)
|
||||
{
|
||||
Word_t Words = sizeof(jbl_t) / cJU_BYTESPERWORD;
|
||||
Pjbl_t PjblRaw = (Pjbl_t) MALLOC(JudyMallocVirtual,
|
||||
Pjpm->jpm_TotalMemWords, Words);
|
||||
|
||||
assert((Words * cJU_BYTESPERWORD) == sizeof(jbl_t));
|
||||
|
||||
if ((Word_t) PjblRaw > sizeof(Word_t))
|
||||
{
|
||||
ZEROWORDS(P_JBL(PjblRaw), Words);
|
||||
Pjpm->jpm_TotalMemWords += Words;
|
||||
}
|
||||
else { J__UDYSETALLOCERROR(PjblRaw); }
|
||||
|
||||
TRACE_ALLOC5("0x%x %8lu = j__udyAllocJBL(), Words = %lu\n", PjblRaw,
|
||||
j__udyMemSequence++, Words, (Pjpm->jpm_Pop0) + 2);
|
||||
MALLOCBITS_SET(Pjbl_t, PjblRaw);
|
||||
return(PjblRaw);
|
||||
|
||||
} // j__udyAllocJBL()
|
||||
|
||||
|
||||
FUNCTION Pjbb_t j__udyAllocJBB(Pjpm_t Pjpm)
|
||||
{
|
||||
Word_t Words = sizeof(jbb_t) / cJU_BYTESPERWORD;
|
||||
Pjbb_t PjbbRaw = (Pjbb_t) MALLOC(JudyMallocVirtual,
|
||||
Pjpm->jpm_TotalMemWords, Words);
|
||||
|
||||
assert((Words * cJU_BYTESPERWORD) == sizeof(jbb_t));
|
||||
|
||||
if ((Word_t) PjbbRaw > sizeof(Word_t))
|
||||
{
|
||||
ZEROWORDS(P_JBB(PjbbRaw), Words);
|
||||
Pjpm->jpm_TotalMemWords += Words;
|
||||
}
|
||||
else { J__UDYSETALLOCERROR(PjbbRaw); }
|
||||
|
||||
TRACE_ALLOC5("0x%x %8lu = j__udyAllocJBB(), Words = %lu\n", PjbbRaw,
|
||||
j__udyMemSequence++, Words, (Pjpm->jpm_Pop0) + 2);
|
||||
MALLOCBITS_SET(Pjbb_t, PjbbRaw);
|
||||
return(PjbbRaw);
|
||||
|
||||
} // j__udyAllocJBB()
|
||||
|
||||
|
||||
FUNCTION Pjp_t j__udyAllocJBBJP(Word_t NumJPs, Pjpm_t Pjpm)
|
||||
{
|
||||
Word_t Words = JU_BRANCHJP_NUMJPSTOWORDS(NumJPs);
|
||||
Pjp_t PjpRaw;
|
||||
|
||||
PjpRaw = (Pjp_t) MALLOC(JudyMalloc, Pjpm->jpm_TotalMemWords, Words);
|
||||
|
||||
if ((Word_t) PjpRaw > sizeof(Word_t))
|
||||
{
|
||||
Pjpm->jpm_TotalMemWords += Words;
|
||||
}
|
||||
else { J__UDYSETALLOCERROR(PjpRaw); }
|
||||
|
||||
TRACE_ALLOC6("0x%x %8lu = j__udyAllocJBBJP(%lu), Words = %lu\n", PjpRaw,
|
||||
j__udyMemSequence++, NumJPs, Words, (Pjpm->jpm_Pop0) + 2);
|
||||
MALLOCBITS_SET(Pjp_t, PjpRaw);
|
||||
return(PjpRaw);
|
||||
|
||||
} // j__udyAllocJBBJP()
|
||||
|
||||
|
||||
FUNCTION Pjbu_t j__udyAllocJBU(Pjpm_t Pjpm)
|
||||
{
|
||||
Word_t Words = sizeof(jbu_t) / cJU_BYTESPERWORD;
|
||||
Pjbu_t PjbuRaw = (Pjbu_t) MALLOC(JudyMallocVirtual,
|
||||
Pjpm->jpm_TotalMemWords, Words);
|
||||
|
||||
assert((Words * cJU_BYTESPERWORD) == sizeof(jbu_t));
|
||||
|
||||
if ((Word_t) PjbuRaw > sizeof(Word_t))
|
||||
{
|
||||
Pjpm->jpm_TotalMemWords += Words;
|
||||
}
|
||||
else { J__UDYSETALLOCERROR(PjbuRaw); }
|
||||
|
||||
TRACE_ALLOC5("0x%x %8lu = j__udyAllocJBU(), Words = %lu\n", PjbuRaw,
|
||||
j__udyMemSequence++, Words, (Pjpm->jpm_Pop0) + 2);
|
||||
MALLOCBITS_SET(Pjbu_t, PjbuRaw);
|
||||
return(PjbuRaw);
|
||||
|
||||
} // j__udyAllocJBU()
|
||||
|
||||
|
||||
#if (defined(JUDYL) || (! defined(JU_64BIT)))
|
||||
|
||||
FUNCTION Pjll_t j__udyAllocJLL1(Word_t Pop1, Pjpm_t Pjpm)
|
||||
{
|
||||
Word_t Words = JU_LEAF1POPTOWORDS(Pop1);
|
||||
Pjll_t PjllRaw;
|
||||
|
||||
PjllRaw = (Pjll_t) MALLOC(JudyMalloc, Pjpm->jpm_TotalMemWords, Words);
|
||||
|
||||
if ((Word_t) PjllRaw > sizeof(Word_t))
|
||||
{
|
||||
Pjpm->jpm_TotalMemWords += Words;
|
||||
}
|
||||
else { J__UDYSETALLOCERROR(PjllRaw); }
|
||||
|
||||
TRACE_ALLOC6("0x%x %8lu = j__udyAllocJLL1(%lu), Words = %lu\n", PjllRaw,
|
||||
j__udyMemSequence++, Pop1, Words, (Pjpm->jpm_Pop0) + 2);
|
||||
MALLOCBITS_SET(Pjll_t, PjllRaw);
|
||||
return(PjllRaw);
|
||||
|
||||
} // j__udyAllocJLL1()
|
||||
|
||||
#endif // (JUDYL || (! JU_64BIT))
|
||||
|
||||
|
||||
FUNCTION Pjll_t j__udyAllocJLL2(Word_t Pop1, Pjpm_t Pjpm)
|
||||
{
|
||||
Word_t Words = JU_LEAF2POPTOWORDS(Pop1);
|
||||
Pjll_t PjllRaw;
|
||||
|
||||
PjllRaw = (Pjll_t) MALLOC(JudyMalloc, Pjpm->jpm_TotalMemWords, Words);
|
||||
|
||||
if ((Word_t) PjllRaw > sizeof(Word_t))
|
||||
{
|
||||
Pjpm->jpm_TotalMemWords += Words;
|
||||
}
|
||||
else { J__UDYSETALLOCERROR(PjllRaw); }
|
||||
|
||||
TRACE_ALLOC6("0x%x %8lu = j__udyAllocJLL2(%lu), Words = %lu\n", PjllRaw,
|
||||
j__udyMemSequence++, Pop1, Words, (Pjpm->jpm_Pop0) + 2);
|
||||
MALLOCBITS_SET(Pjll_t, PjllRaw);
|
||||
return(PjllRaw);
|
||||
|
||||
} // j__udyAllocJLL2()
|
||||
|
||||
|
||||
FUNCTION Pjll_t j__udyAllocJLL3(Word_t Pop1, Pjpm_t Pjpm)
|
||||
{
|
||||
Word_t Words = JU_LEAF3POPTOWORDS(Pop1);
|
||||
Pjll_t PjllRaw;
|
||||
|
||||
PjllRaw = (Pjll_t) MALLOC(JudyMalloc, Pjpm->jpm_TotalMemWords, Words);
|
||||
|
||||
if ((Word_t) PjllRaw > sizeof(Word_t))
|
||||
{
|
||||
Pjpm->jpm_TotalMemWords += Words;
|
||||
}
|
||||
else { J__UDYSETALLOCERROR(PjllRaw); }
|
||||
|
||||
TRACE_ALLOC6("0x%x %8lu = j__udyAllocJLL3(%lu), Words = %lu\n", PjllRaw,
|
||||
j__udyMemSequence++, Pop1, Words, (Pjpm->jpm_Pop0) + 2);
|
||||
MALLOCBITS_SET(Pjll_t, PjllRaw);
|
||||
return(PjllRaw);
|
||||
|
||||
} // j__udyAllocJLL3()
|
||||
|
||||
|
||||
#ifdef JU_64BIT
|
||||
|
||||
FUNCTION Pjll_t j__udyAllocJLL4(Word_t Pop1, Pjpm_t Pjpm)
|
||||
{
|
||||
Word_t Words = JU_LEAF4POPTOWORDS(Pop1);
|
||||
Pjll_t PjllRaw;
|
||||
|
||||
PjllRaw = (Pjll_t) MALLOC(JudyMalloc, Pjpm->jpm_TotalMemWords, Words);
|
||||
|
||||
if ((Word_t) PjllRaw > sizeof(Word_t))
|
||||
{
|
||||
Pjpm->jpm_TotalMemWords += Words;
|
||||
}
|
||||
else { J__UDYSETALLOCERROR(PjllRaw); }
|
||||
|
||||
TRACE_ALLOC6("0x%x %8lu = j__udyAllocJLL4(%lu), Words = %lu\n", PjllRaw,
|
||||
j__udyMemSequence++, Pop1, Words, (Pjpm->jpm_Pop0) + 2);
|
||||
MALLOCBITS_SET(Pjll_t, PjllRaw);
|
||||
return(PjllRaw);
|
||||
|
||||
} // j__udyAllocJLL4()
|
||||
|
||||
|
||||
FUNCTION Pjll_t j__udyAllocJLL5(Word_t Pop1, Pjpm_t Pjpm)
|
||||
{
|
||||
Word_t Words = JU_LEAF5POPTOWORDS(Pop1);
|
||||
Pjll_t PjllRaw;
|
||||
|
||||
PjllRaw = (Pjll_t) MALLOC(JudyMalloc, Pjpm->jpm_TotalMemWords, Words);
|
||||
|
||||
if ((Word_t) PjllRaw > sizeof(Word_t))
|
||||
{
|
||||
Pjpm->jpm_TotalMemWords += Words;
|
||||
}
|
||||
else { J__UDYSETALLOCERROR(PjllRaw); }
|
||||
|
||||
TRACE_ALLOC6("0x%x %8lu = j__udyAllocJLL5(%lu), Words = %lu\n", PjllRaw,
|
||||
j__udyMemSequence++, Pop1, Words, (Pjpm->jpm_Pop0) + 2);
|
||||
MALLOCBITS_SET(Pjll_t, PjllRaw);
|
||||
return(PjllRaw);
|
||||
|
||||
} // j__udyAllocJLL5()
|
||||
|
||||
|
||||
FUNCTION Pjll_t j__udyAllocJLL6(Word_t Pop1, Pjpm_t Pjpm)
|
||||
{
|
||||
Word_t Words = JU_LEAF6POPTOWORDS(Pop1);
|
||||
Pjll_t PjllRaw;
|
||||
|
||||
PjllRaw = (Pjll_t) MALLOC(JudyMalloc, Pjpm->jpm_TotalMemWords, Words);
|
||||
|
||||
if ((Word_t) PjllRaw > sizeof(Word_t))
|
||||
{
|
||||
Pjpm->jpm_TotalMemWords += Words;
|
||||
}
|
||||
else { J__UDYSETALLOCERROR(PjllRaw); }
|
||||
|
||||
TRACE_ALLOC6("0x%x %8lu = j__udyAllocJLL6(%lu), Words = %lu\n", PjllRaw,
|
||||
j__udyMemSequence++, Pop1, Words, (Pjpm->jpm_Pop0) + 2);
|
||||
MALLOCBITS_SET(Pjll_t, PjllRaw);
|
||||
return(PjllRaw);
|
||||
|
||||
} // j__udyAllocJLL6()
|
||||
|
||||
|
||||
FUNCTION Pjll_t j__udyAllocJLL7(Word_t Pop1, Pjpm_t Pjpm)
|
||||
{
|
||||
Word_t Words = JU_LEAF7POPTOWORDS(Pop1);
|
||||
Pjll_t PjllRaw;
|
||||
|
||||
PjllRaw = (Pjll_t) MALLOC(JudyMalloc, Pjpm->jpm_TotalMemWords, Words);
|
||||
|
||||
if ((Word_t) PjllRaw > sizeof(Word_t))
|
||||
{
|
||||
Pjpm->jpm_TotalMemWords += Words;
|
||||
}
|
||||
else { J__UDYSETALLOCERROR(PjllRaw); }
|
||||
|
||||
TRACE_ALLOC6("0x%x %8lu = j__udyAllocJLL7(%lu), Words = %lu\n", PjllRaw,
|
||||
j__udyMemSequence++, Pop1, Words, (Pjpm->jpm_Pop0) + 2);
|
||||
MALLOCBITS_SET(Pjll_t, PjllRaw);
|
||||
return(PjllRaw);
|
||||
|
||||
} // j__udyAllocJLL7()
|
||||
|
||||
#endif // JU_64BIT
|
||||
|
||||
|
||||
// Note: Root-level leaf addresses are always whole words (Pjlw_t), and unlike
|
||||
// other j__udyAlloc*() functions, they are returned non-raw, that is, without
|
||||
// malloc namespace or root pointer type bits (the latter are added later by
|
||||
// the caller):
|
||||
|
||||
FUNCTION Pjlw_t j__udyAllocJLW(Word_t Pop1)
|
||||
{
|
||||
Word_t Words = JU_LEAFWPOPTOWORDS(Pop1);
|
||||
Pjlw_t Pjlw = (Pjlw_t) MALLOC(JudyMalloc, Words, Words);
|
||||
|
||||
TRACE_ALLOC6("0x%x %8lu = j__udyAllocJLW(%lu), Words = %lu\n", Pjlw,
|
||||
j__udyMemSequence++, Pop1, Words, Pop1);
|
||||
// MALLOCBITS_SET(Pjlw_t, Pjlw); // see above.
|
||||
return(Pjlw);
|
||||
|
||||
} // j__udyAllocJLW()
|
||||
|
||||
|
||||
FUNCTION Pjlb_t j__udyAllocJLB1(Pjpm_t Pjpm)
|
||||
{
|
||||
Word_t Words = sizeof(jlb_t) / cJU_BYTESPERWORD;
|
||||
Pjlb_t PjlbRaw;
|
||||
|
||||
PjlbRaw = (Pjlb_t) MALLOC(JudyMalloc, Pjpm->jpm_TotalMemWords, Words);
|
||||
|
||||
assert((Words * cJU_BYTESPERWORD) == sizeof(jlb_t));
|
||||
|
||||
if ((Word_t) PjlbRaw > sizeof(Word_t))
|
||||
{
|
||||
ZEROWORDS(P_JLB(PjlbRaw), Words);
|
||||
Pjpm->jpm_TotalMemWords += Words;
|
||||
}
|
||||
else { J__UDYSETALLOCERROR(PjlbRaw); }
|
||||
|
||||
TRACE_ALLOC5("0x%x %8lu = j__udyAllocJLB1(), Words = %lu\n", PjlbRaw,
|
||||
j__udyMemSequence++, Words, (Pjpm->jpm_Pop0) + 2);
|
||||
MALLOCBITS_SET(Pjlb_t, PjlbRaw);
|
||||
return(PjlbRaw);
|
||||
|
||||
} // j__udyAllocJLB1()
|
||||
|
||||
|
||||
#ifdef JUDYL
|
||||
|
||||
FUNCTION Pjv_t j__udyLAllocJV(Word_t Pop1, Pjpm_t Pjpm)
|
||||
{
|
||||
Word_t Words = JL_LEAFVPOPTOWORDS(Pop1);
|
||||
Pjv_t PjvRaw;
|
||||
|
||||
PjvRaw = (Pjv_t) MALLOC(JudyMalloc, Pjpm->jpm_TotalMemWords, Words);
|
||||
|
||||
if ((Word_t) PjvRaw > sizeof(Word_t))
|
||||
{
|
||||
Pjpm->jpm_TotalMemWords += Words;
|
||||
}
|
||||
else { J__UDYSETALLOCERROR(PjvRaw); }
|
||||
|
||||
TRACE_ALLOC6("0x%x %8lu = j__udyLAllocJV(%lu), Words = %lu\n", PjvRaw,
|
||||
j__udyMemSequence++, Pop1, Words, (Pjpm->jpm_Pop0) + 2);
|
||||
MALLOCBITS_SET(Pjv_t, PjvRaw);
|
||||
return(PjvRaw);
|
||||
|
||||
} // j__udyLAllocJV()
|
||||
|
||||
#endif // JUDYL
|
||||
|
||||
|
||||
// ****************************************************************************
|
||||
// FREE FUNCTIONS:
|
||||
//
|
||||
// To help the compiler catch coding errors, each function takes a specific
|
||||
// object type to free.
|
||||
|
||||
|
||||
// Note: j__udyFreeJPM() receives a root pointer with NO root pointer type
|
||||
// bits present, that is, they must be stripped by the caller using P_JPM():
|
||||
|
||||
FUNCTION void j__udyFreeJPM(Pjpm_t PjpmFree, Pjpm_t PjpmStats)
|
||||
{
|
||||
Word_t Words = sizeof(jpm_t) / cJU_BYTESPERWORD;
|
||||
|
||||
// MALLOCBITS_TEST(Pjpm_t, PjpmFree); // see above.
|
||||
JudyFree((Pvoid_t) PjpmFree, Words);
|
||||
|
||||
if (PjpmStats != (Pjpm_t) NULL) PjpmStats->jpm_TotalMemWords -= Words;
|
||||
|
||||
// Note: Log PjpmFree->jpm_Pop0, similar to other j__udyFree*() functions, not
|
||||
// an assumed value of cJU_LEAFW_MAXPOP1, for when the caller is
|
||||
// Judy*FreeArray(), jpm_Pop0 is set to 0, and the population after the free
|
||||
// really will be 0, not cJU_LEAFW_MAXPOP1.
|
||||
|
||||
TRACE_FREE6("0x%x %8lu = j__udyFreeJPM(%lu), Words = %lu\n", PjpmFree,
|
||||
j__udyMemSequence++, Words, Words, PjpmFree->jpm_Pop0);
|
||||
|
||||
|
||||
} // j__udyFreeJPM()
|
||||
|
||||
|
||||
FUNCTION void j__udyFreeJBL(Pjbl_t Pjbl, Pjpm_t Pjpm)
|
||||
{
|
||||
Word_t Words = sizeof(jbl_t) / cJU_BYTESPERWORD;
|
||||
|
||||
MALLOCBITS_TEST(Pjbl_t, Pjbl);
|
||||
JudyFreeVirtual((Pvoid_t) Pjbl, Words);
|
||||
|
||||
Pjpm->jpm_TotalMemWords -= Words;
|
||||
|
||||
TRACE_FREE5("0x%x %8lu = j__udyFreeJBL(), Words = %lu\n", Pjbl,
|
||||
j__udyMemSequence++, Words, Pjpm->jpm_Pop0);
|
||||
|
||||
|
||||
} // j__udyFreeJBL()
|
||||
|
||||
|
||||
FUNCTION void j__udyFreeJBB(Pjbb_t Pjbb, Pjpm_t Pjpm)
|
||||
{
|
||||
Word_t Words = sizeof(jbb_t) / cJU_BYTESPERWORD;
|
||||
|
||||
MALLOCBITS_TEST(Pjbb_t, Pjbb);
|
||||
JudyFreeVirtual((Pvoid_t) Pjbb, Words);
|
||||
|
||||
Pjpm->jpm_TotalMemWords -= Words;
|
||||
|
||||
TRACE_FREE5("0x%x %8lu = j__udyFreeJBB(), Words = %lu\n", Pjbb,
|
||||
j__udyMemSequence++, Words, Pjpm->jpm_Pop0);
|
||||
|
||||
|
||||
} // j__udyFreeJBB()
|
||||
|
||||
|
||||
FUNCTION void j__udyFreeJBBJP(Pjp_t Pjp, Word_t NumJPs, Pjpm_t Pjpm)
|
||||
{
|
||||
Word_t Words = JU_BRANCHJP_NUMJPSTOWORDS(NumJPs);
|
||||
|
||||
MALLOCBITS_TEST(Pjp_t, Pjp);
|
||||
JudyFree((Pvoid_t) Pjp, Words);
|
||||
|
||||
Pjpm->jpm_TotalMemWords -= Words;
|
||||
|
||||
TRACE_FREE6("0x%x %8lu = j__udyFreeJBBJP(%lu), Words = %lu\n", Pjp,
|
||||
j__udyMemSequence++, NumJPs, Words, Pjpm->jpm_Pop0);
|
||||
|
||||
|
||||
} // j__udyFreeJBBJP()
|
||||
|
||||
|
||||
FUNCTION void j__udyFreeJBU(Pjbu_t Pjbu, Pjpm_t Pjpm)
|
||||
{
|
||||
Word_t Words = sizeof(jbu_t) / cJU_BYTESPERWORD;
|
||||
|
||||
MALLOCBITS_TEST(Pjbu_t, Pjbu);
|
||||
JudyFreeVirtual((Pvoid_t) Pjbu, Words);
|
||||
|
||||
Pjpm->jpm_TotalMemWords -= Words;
|
||||
|
||||
TRACE_FREE5("0x%x %8lu = j__udyFreeJBU(), Words = %lu\n", Pjbu,
|
||||
j__udyMemSequence++, Words, Pjpm->jpm_Pop0);
|
||||
|
||||
|
||||
} // j__udyFreeJBU()
|
||||
|
||||
|
||||
#if (defined(JUDYL) || (! defined(JU_64BIT)))
|
||||
|
||||
FUNCTION void j__udyFreeJLL1(Pjll_t Pjll, Word_t Pop1, Pjpm_t Pjpm)
|
||||
{
|
||||
Word_t Words = JU_LEAF1POPTOWORDS(Pop1);
|
||||
|
||||
MALLOCBITS_TEST(Pjll_t, Pjll);
|
||||
JudyFree((Pvoid_t) Pjll, Words);
|
||||
|
||||
Pjpm->jpm_TotalMemWords -= Words;
|
||||
|
||||
TRACE_FREE6("0x%x %8lu = j__udyFreeJLL1(%lu), Words = %lu\n", Pjll,
|
||||
j__udyMemSequence++, Pop1, Words, Pjpm->jpm_Pop0);
|
||||
|
||||
|
||||
} // j__udyFreeJLL1()
|
||||
|
||||
#endif // (JUDYL || (! JU_64BIT))
|
||||
|
||||
|
||||
FUNCTION void j__udyFreeJLL2(Pjll_t Pjll, Word_t Pop1, Pjpm_t Pjpm)
|
||||
{
|
||||
Word_t Words = JU_LEAF2POPTOWORDS(Pop1);
|
||||
|
||||
MALLOCBITS_TEST(Pjll_t, Pjll);
|
||||
JudyFree((Pvoid_t) Pjll, Words);
|
||||
|
||||
Pjpm->jpm_TotalMemWords -= Words;
|
||||
|
||||
TRACE_FREE6("0x%x %8lu = j__udyFreeJLL2(%lu), Words = %lu\n", Pjll,
|
||||
j__udyMemSequence++, Pop1, Words, Pjpm->jpm_Pop0);
|
||||
|
||||
|
||||
} // j__udyFreeJLL2()
|
||||
|
||||
|
||||
FUNCTION void j__udyFreeJLL3(Pjll_t Pjll, Word_t Pop1, Pjpm_t Pjpm)
|
||||
{
|
||||
Word_t Words = JU_LEAF3POPTOWORDS(Pop1);
|
||||
|
||||
MALLOCBITS_TEST(Pjll_t, Pjll);
|
||||
JudyFree((Pvoid_t) Pjll, Words);
|
||||
|
||||
Pjpm->jpm_TotalMemWords -= Words;
|
||||
|
||||
TRACE_FREE6("0x%x %8lu = j__udyFreeJLL3(%lu), Words = %lu\n", Pjll,
|
||||
j__udyMemSequence++, Pop1, Words, Pjpm->jpm_Pop0);
|
||||
|
||||
|
||||
} // j__udyFreeJLL3()
|
||||
|
||||
|
||||
#ifdef JU_64BIT
|
||||
|
||||
FUNCTION void j__udyFreeJLL4(Pjll_t Pjll, Word_t Pop1, Pjpm_t Pjpm)
|
||||
{
|
||||
Word_t Words = JU_LEAF4POPTOWORDS(Pop1);
|
||||
|
||||
MALLOCBITS_TEST(Pjll_t, Pjll);
|
||||
JudyFree((Pvoid_t) Pjll, Words);
|
||||
|
||||
Pjpm->jpm_TotalMemWords -= Words;
|
||||
|
||||
TRACE_FREE6("0x%x %8lu = j__udyFreeJLL4(%lu), Words = %lu\n", Pjll,
|
||||
j__udyMemSequence++, Pop1, Words, Pjpm->jpm_Pop0);
|
||||
|
||||
|
||||
} // j__udyFreeJLL4()
|
||||
|
||||
|
||||
FUNCTION void j__udyFreeJLL5(Pjll_t Pjll, Word_t Pop1, Pjpm_t Pjpm)
|
||||
{
|
||||
Word_t Words = JU_LEAF5POPTOWORDS(Pop1);
|
||||
|
||||
MALLOCBITS_TEST(Pjll_t, Pjll);
|
||||
JudyFree((Pvoid_t) Pjll, Words);
|
||||
|
||||
Pjpm->jpm_TotalMemWords -= Words;
|
||||
|
||||
TRACE_FREE6("0x%x %8lu = j__udyFreeJLL5(%lu), Words = %lu\n", Pjll,
|
||||
j__udyMemSequence++, Pop1, Words, Pjpm->jpm_Pop0);
|
||||
|
||||
|
||||
} // j__udyFreeJLL5()
|
||||
|
||||
|
||||
FUNCTION void j__udyFreeJLL6(Pjll_t Pjll, Word_t Pop1, Pjpm_t Pjpm)
|
||||
{
|
||||
Word_t Words = JU_LEAF6POPTOWORDS(Pop1);
|
||||
|
||||
MALLOCBITS_TEST(Pjll_t, Pjll);
|
||||
JudyFree((Pvoid_t) Pjll, Words);
|
||||
|
||||
Pjpm->jpm_TotalMemWords -= Words;
|
||||
|
||||
TRACE_FREE6("0x%x %8lu = j__udyFreeJLL6(%lu), Words = %lu\n", Pjll,
|
||||
j__udyMemSequence++, Pop1, Words, Pjpm->jpm_Pop0);
|
||||
|
||||
|
||||
} // j__udyFreeJLL6()
|
||||
|
||||
|
||||
FUNCTION void j__udyFreeJLL7(Pjll_t Pjll, Word_t Pop1, Pjpm_t Pjpm)
|
||||
{
|
||||
Word_t Words = JU_LEAF7POPTOWORDS(Pop1);
|
||||
|
||||
MALLOCBITS_TEST(Pjll_t, Pjll);
|
||||
JudyFree((Pvoid_t) Pjll, Words);
|
||||
|
||||
Pjpm->jpm_TotalMemWords -= Words;
|
||||
|
||||
TRACE_FREE6("0x%x %8lu = j__udyFreeJLL7(%lu), Words = %lu\n", Pjll,
|
||||
j__udyMemSequence++, Pop1, Words, Pjpm->jpm_Pop0);
|
||||
|
||||
|
||||
} // j__udyFreeJLL7()
|
||||
|
||||
#endif // JU_64BIT
|
||||
|
||||
|
||||
// Note: j__udyFreeJLW() receives a root pointer with NO root pointer type
|
||||
// bits present, that is, they are stripped by P_JLW():
|
||||
|
||||
FUNCTION void j__udyFreeJLW(Pjlw_t Pjlw, Word_t Pop1, Pjpm_t Pjpm)
|
||||
{
|
||||
Word_t Words = JU_LEAFWPOPTOWORDS(Pop1);
|
||||
|
||||
// MALLOCBITS_TEST(Pjlw_t, Pjlw); // see above.
|
||||
JudyFree((Pvoid_t) Pjlw, Words);
|
||||
|
||||
if (Pjpm) Pjpm->jpm_TotalMemWords -= Words;
|
||||
|
||||
TRACE_FREE6("0x%x %8lu = j__udyFreeJLW(%lu), Words = %lu\n", Pjlw,
|
||||
j__udyMemSequence++, Pop1, Words, Pop1 - 1);
|
||||
|
||||
|
||||
} // j__udyFreeJLW()
|
||||
|
||||
|
||||
FUNCTION void j__udyFreeJLB1(Pjlb_t Pjlb, Pjpm_t Pjpm)
|
||||
{
|
||||
Word_t Words = sizeof(jlb_t) / cJU_BYTESPERWORD;
|
||||
|
||||
MALLOCBITS_TEST(Pjlb_t, Pjlb);
|
||||
JudyFree((Pvoid_t) Pjlb, Words);
|
||||
|
||||
Pjpm->jpm_TotalMemWords -= Words;
|
||||
|
||||
TRACE_FREE5("0x%x %8lu = j__udyFreeJLB1(), Words = %lu\n", Pjlb,
|
||||
j__udyMemSequence++, Words, Pjpm->jpm_Pop0);
|
||||
|
||||
|
||||
} // j__udyFreeJLB1()
|
||||
|
||||
|
||||
#ifdef JUDYL
|
||||
|
||||
FUNCTION void j__udyLFreeJV(Pjv_t Pjv, Word_t Pop1, Pjpm_t Pjpm)
|
||||
{
|
||||
Word_t Words = JL_LEAFVPOPTOWORDS(Pop1);
|
||||
|
||||
MALLOCBITS_TEST(Pjv_t, Pjv);
|
||||
JudyFree((Pvoid_t) Pjv, Words);
|
||||
|
||||
Pjpm->jpm_TotalMemWords -= Words;
|
||||
|
||||
TRACE_FREE6("0x%x %8lu = j__udyLFreeJV(%lu), Words = %lu\n", Pjv,
|
||||
j__udyMemSequence++, Pop1, Words, Pjpm->jpm_Pop0);
|
||||
|
||||
|
||||
} // j__udyLFreeJV()
|
||||
|
||||
#endif // JUDYL
|
259
dlls/arrayx/Judy-1.0.1/src/JudyCommon/JudyMemActive.c
Normal file
259
dlls/arrayx/Judy-1.0.1/src/JudyCommon/JudyMemActive.c
Normal file
|
@ -0,0 +1,259 @@
|
|||
// Copyright (C) 2000 - 2002 Hewlett-Packard Company
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify it
|
||||
// under the term of the GNU Lesser General Public License as published by the
|
||||
// Free Software Foundation; either version 2 of the License, or (at your
|
||||
// option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
// for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with this program; if not, write to the Free Software Foundation,
|
||||
// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
// _________________
|
||||
|
||||
// @(#) $Revision$ $Source$
|
||||
//
|
||||
// Return number of bytes of memory used to support a Judy1/L array.
|
||||
// Compile with one of -DJUDY1 or -DJUDYL.
|
||||
|
||||
#if (! (defined(JUDY1) || defined(JUDYL)))
|
||||
#error: One of -DJUDY1 or -DJUDYL must be specified.
|
||||
#endif
|
||||
|
||||
#ifdef JUDY1
|
||||
#include "Judy1.h"
|
||||
#else
|
||||
#include "JudyL.h"
|
||||
#endif
|
||||
|
||||
#include "JudyPrivate1L.h"
|
||||
|
||||
FUNCTION static Word_t j__udyGetMemActive(Pjp_t);
|
||||
|
||||
|
||||
// ****************************************************************************
|
||||
// J U D Y 1 M E M A C T I V E
|
||||
// J U D Y L M E M A C T I V E
|
||||
|
||||
#ifdef JUDY1
|
||||
FUNCTION Word_t Judy1MemActive
|
||||
#else
|
||||
FUNCTION Word_t JudyLMemActive
|
||||
#endif
|
||||
(
|
||||
Pcvoid_t PArray // from which to retrieve.
|
||||
)
|
||||
{
|
||||
if (PArray == (Pcvoid_t)NULL) return(0);
|
||||
|
||||
if (JU_LEAFW_POP0(PArray) < cJU_LEAFW_MAXPOP1) // must be a LEAFW
|
||||
{
|
||||
Pjlw_t Pjlw = P_JLW(PArray); // first word of leaf.
|
||||
Word_t Words = Pjlw[0] + 1; // population.
|
||||
#ifdef JUDY1
|
||||
return((Words + 1) * sizeof(Word_t));
|
||||
#else
|
||||
return(((Words * 2) + 1) * sizeof(Word_t));
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
Pjpm_t Pjpm = P_JPM(PArray);
|
||||
return(j__udyGetMemActive(&Pjpm->jpm_JP) + sizeof(jpm_t));
|
||||
}
|
||||
|
||||
} // JudyMemActive()
|
||||
|
||||
|
||||
// ****************************************************************************
|
||||
// __ J U D Y G E T M E M A C T I V E
|
||||
|
||||
FUNCTION static Word_t j__udyGetMemActive(
|
||||
Pjp_t Pjp) // top of subtree.
|
||||
{
|
||||
Word_t offset; // in a branch.
|
||||
Word_t Bytes = 0; // actual bytes used at this level.
|
||||
Word_t IdxSz; // bytes per index in leaves
|
||||
|
||||
switch (JU_JPTYPE(Pjp))
|
||||
{
|
||||
|
||||
case cJU_JPBRANCH_L2:
|
||||
case cJU_JPBRANCH_L3:
|
||||
#ifdef JU_64BIT
|
||||
case cJU_JPBRANCH_L4:
|
||||
case cJU_JPBRANCH_L5:
|
||||
case cJU_JPBRANCH_L6:
|
||||
case cJU_JPBRANCH_L7:
|
||||
#endif
|
||||
case cJU_JPBRANCH_L:
|
||||
{
|
||||
Pjbl_t Pjbl = P_JBL(Pjp->jp_Addr);
|
||||
|
||||
for (offset = 0; offset < (Pjbl->jbl_NumJPs); ++offset)
|
||||
Bytes += j__udyGetMemActive((Pjbl->jbl_jp) + offset);
|
||||
|
||||
return(Bytes + sizeof(jbl_t));
|
||||
}
|
||||
|
||||
case cJU_JPBRANCH_B2:
|
||||
case cJU_JPBRANCH_B3:
|
||||
#ifdef JU_64BIT
|
||||
case cJU_JPBRANCH_B4:
|
||||
case cJU_JPBRANCH_B5:
|
||||
case cJU_JPBRANCH_B6:
|
||||
case cJU_JPBRANCH_B7:
|
||||
#endif
|
||||
case cJU_JPBRANCH_B:
|
||||
{
|
||||
Word_t subexp;
|
||||
Word_t jpcount;
|
||||
Pjbb_t Pjbb = P_JBB(Pjp->jp_Addr);
|
||||
|
||||
for (subexp = 0; subexp < cJU_NUMSUBEXPB; ++subexp)
|
||||
{
|
||||
jpcount = j__udyCountBitsB(JU_JBB_BITMAP(Pjbb, subexp));
|
||||
Bytes += jpcount * sizeof(jp_t);
|
||||
|
||||
for (offset = 0; offset < jpcount; ++offset)
|
||||
{
|
||||
Bytes += j__udyGetMemActive(P_JP(JU_JBB_PJP(Pjbb, subexp))
|
||||
+ offset);
|
||||
}
|
||||
}
|
||||
|
||||
return(Bytes + sizeof(jbb_t));
|
||||
}
|
||||
|
||||
case cJU_JPBRANCH_U2:
|
||||
case cJU_JPBRANCH_U3:
|
||||
#ifdef JU_64BIT
|
||||
case cJU_JPBRANCH_U4:
|
||||
case cJU_JPBRANCH_U5:
|
||||
case cJU_JPBRANCH_U6:
|
||||
case cJU_JPBRANCH_U7:
|
||||
#endif
|
||||
case cJU_JPBRANCH_U:
|
||||
{
|
||||
Pjbu_t Pjbu = P_JBU(Pjp->jp_Addr);
|
||||
|
||||
for (offset = 0; offset < cJU_BRANCHUNUMJPS; ++offset)
|
||||
{
|
||||
if (((Pjbu->jbu_jp[offset].jp_Type) >= cJU_JPNULL1)
|
||||
&& ((Pjbu->jbu_jp[offset].jp_Type) <= cJU_JPNULLMAX))
|
||||
{
|
||||
continue; // skip null JP to save time.
|
||||
}
|
||||
|
||||
Bytes += j__udyGetMemActive(Pjbu->jbu_jp + offset);
|
||||
}
|
||||
|
||||
return(Bytes + sizeof(jbu_t));
|
||||
}
|
||||
|
||||
|
||||
// -- Cases below here terminate and do not recurse. --
|
||||
|
||||
#if (defined(JUDYL) || (! defined(JU_64BIT)))
|
||||
case cJU_JPLEAF1: IdxSz = 1; goto LeafWords;
|
||||
#endif
|
||||
case cJU_JPLEAF2: IdxSz = 2; goto LeafWords;
|
||||
case cJU_JPLEAF3: IdxSz = 3; goto LeafWords;
|
||||
#ifdef JU_64BIT
|
||||
case cJU_JPLEAF4: IdxSz = 4; goto LeafWords;
|
||||
case cJU_JPLEAF5: IdxSz = 5; goto LeafWords;
|
||||
case cJU_JPLEAF6: IdxSz = 6; goto LeafWords;
|
||||
case cJU_JPLEAF7: IdxSz = 7; goto LeafWords;
|
||||
#endif
|
||||
LeafWords:
|
||||
|
||||
#ifdef JUDY1
|
||||
return(IdxSz * (JU_JPLEAF_POP0(Pjp) + 1));
|
||||
#else
|
||||
return((IdxSz + sizeof(Word_t))
|
||||
* (JU_JPLEAF_POP0(Pjp) + 1));
|
||||
#endif
|
||||
case cJU_JPLEAF_B1:
|
||||
{
|
||||
#ifdef JUDY1
|
||||
return(sizeof(jlb_t));
|
||||
#else
|
||||
Bytes = (JU_JPLEAF_POP0(Pjp) + 1) * sizeof(Word_t);
|
||||
|
||||
return(Bytes + sizeof(jlb_t));
|
||||
#endif
|
||||
}
|
||||
|
||||
JUDY1CODE(case cJ1_JPFULLPOPU1: return(0);)
|
||||
|
||||
#ifdef JUDY1
|
||||
#define J__Mpy 0
|
||||
#else
|
||||
#define J__Mpy sizeof(Word_t)
|
||||
#endif
|
||||
|
||||
case cJU_JPIMMED_1_01: return(0);
|
||||
case cJU_JPIMMED_2_01: return(0);
|
||||
case cJU_JPIMMED_3_01: return(0);
|
||||
#ifdef JU_64BIT
|
||||
case cJU_JPIMMED_4_01: return(0);
|
||||
case cJU_JPIMMED_5_01: return(0);
|
||||
case cJU_JPIMMED_6_01: return(0);
|
||||
case cJU_JPIMMED_7_01: return(0);
|
||||
#endif
|
||||
|
||||
case cJU_JPIMMED_1_02: return(J__Mpy * 2);
|
||||
case cJU_JPIMMED_1_03: return(J__Mpy * 3);
|
||||
#if (defined(JUDY1) || defined(JU_64BIT))
|
||||
case cJU_JPIMMED_1_04: return(J__Mpy * 4);
|
||||
case cJU_JPIMMED_1_05: return(J__Mpy * 5);
|
||||
case cJU_JPIMMED_1_06: return(J__Mpy * 6);
|
||||
case cJU_JPIMMED_1_07: return(J__Mpy * 7);
|
||||
#endif
|
||||
#if (defined(JUDY1) && defined(JU_64BIT))
|
||||
case cJ1_JPIMMED_1_08: return(0);
|
||||
case cJ1_JPIMMED_1_09: return(0);
|
||||
case cJ1_JPIMMED_1_10: return(0);
|
||||
case cJ1_JPIMMED_1_11: return(0);
|
||||
case cJ1_JPIMMED_1_12: return(0);
|
||||
case cJ1_JPIMMED_1_13: return(0);
|
||||
case cJ1_JPIMMED_1_14: return(0);
|
||||
case cJ1_JPIMMED_1_15: return(0);
|
||||
#endif
|
||||
|
||||
#if (defined(JUDY1) || defined(JU_64BIT))
|
||||
case cJU_JPIMMED_2_02: return(J__Mpy * 2);
|
||||
case cJU_JPIMMED_2_03: return(J__Mpy * 3);
|
||||
#endif
|
||||
#if (defined(JUDY1) && defined(JU_64BIT))
|
||||
case cJ1_JPIMMED_2_04: return(0);
|
||||
case cJ1_JPIMMED_2_05: return(0);
|
||||
case cJ1_JPIMMED_2_06: return(0);
|
||||
case cJ1_JPIMMED_2_07: return(0);
|
||||
#endif
|
||||
|
||||
#if (defined(JUDY1) || defined(JU_64BIT))
|
||||
case cJU_JPIMMED_3_02: return(J__Mpy * 2);
|
||||
#endif
|
||||
#if (defined(JUDY1) && defined(JU_64BIT))
|
||||
case cJ1_JPIMMED_3_03: return(0);
|
||||
case cJ1_JPIMMED_3_04: return(0);
|
||||
case cJ1_JPIMMED_3_05: return(0);
|
||||
|
||||
case cJ1_JPIMMED_4_02: return(0);
|
||||
case cJ1_JPIMMED_4_03: return(0);
|
||||
case cJ1_JPIMMED_5_02: return(0);
|
||||
case cJ1_JPIMMED_5_03: return(0);
|
||||
case cJ1_JPIMMED_6_02: return(0);
|
||||
case cJ1_JPIMMED_7_02: return(0);
|
||||
#endif
|
||||
|
||||
} // switch (JU_JPTYPE(Pjp))
|
||||
|
||||
return(0); // to make some compilers happy.
|
||||
|
||||
} // j__udyGetMemActive()
|
61
dlls/arrayx/Judy-1.0.1/src/JudyCommon/JudyMemUsed.c
Normal file
61
dlls/arrayx/Judy-1.0.1/src/JudyCommon/JudyMemUsed.c
Normal file
|
@ -0,0 +1,61 @@
|
|||
// Copyright (C) 2000 - 2002 Hewlett-Packard Company
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify it
|
||||
// under the term of the GNU Lesser General Public License as published by the
|
||||
// Free Software Foundation; either version 2 of the License, or (at your
|
||||
// option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
// for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with this program; if not, write to the Free Software Foundation,
|
||||
// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
// _________________
|
||||
|
||||
// @(#) $Revision$ $Source$
|
||||
//
|
||||
// Return number of bytes of memory used to support a Judy1/L array.
|
||||
// Compile with one of -DJUDY1 or -DJUDYL.
|
||||
|
||||
#if (! (defined(JUDY1) || defined(JUDYL)))
|
||||
#error: One of -DJUDY1 or -DJUDYL must be specified.
|
||||
#endif
|
||||
|
||||
#ifdef JUDY1
|
||||
#include "Judy1.h"
|
||||
#else
|
||||
#include "JudyL.h"
|
||||
#endif
|
||||
|
||||
#include "JudyPrivate1L.h"
|
||||
|
||||
#ifdef JUDY1
|
||||
FUNCTION Word_t Judy1MemUsed
|
||||
#else // JUDYL
|
||||
FUNCTION Word_t JudyLMemUsed
|
||||
#endif
|
||||
(
|
||||
Pcvoid_t PArray // from which to retrieve.
|
||||
)
|
||||
{
|
||||
Word_t Words = 0;
|
||||
|
||||
if (PArray == (Pcvoid_t) NULL) return(0);
|
||||
|
||||
if (JU_LEAFW_POP0(PArray) < cJU_LEAFW_MAXPOP1) // must be a LEAFW
|
||||
{
|
||||
Pjlw_t Pjlw = P_JLW(PArray); // first word of leaf.
|
||||
Words = JU_LEAFWPOPTOWORDS(Pjlw[0] + 1); // based on pop1.
|
||||
}
|
||||
else
|
||||
{
|
||||
Pjpm_t Pjpm = P_JPM(PArray);
|
||||
Words = Pjpm->jpm_TotalMemWords;
|
||||
}
|
||||
|
||||
return(Words * sizeof(Word_t)); // convert to bytes.
|
||||
|
||||
} // Judy1MemUsed() / JudyLMemUsed()
|
1890
dlls/arrayx/Judy-1.0.1/src/JudyCommon/JudyPrevNext.c
Normal file
1890
dlls/arrayx/Judy-1.0.1/src/JudyCommon/JudyPrevNext.c
Normal file
File diff suppressed because it is too large
Load Diff
1390
dlls/arrayx/Judy-1.0.1/src/JudyCommon/JudyPrevNextEmpty.c
Normal file
1390
dlls/arrayx/Judy-1.0.1/src/JudyCommon/JudyPrevNextEmpty.c
Normal file
File diff suppressed because it is too large
Load Diff
401
dlls/arrayx/Judy-1.0.1/src/JudyCommon/JudyPrintJP.c
Normal file
401
dlls/arrayx/Judy-1.0.1/src/JudyCommon/JudyPrintJP.c
Normal file
|
@ -0,0 +1,401 @@
|
|||
// Copyright (C) 2000 - 2002 Hewlett-Packard Company
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify it
|
||||
// under the term of the GNU Lesser General Public License as published by the
|
||||
// Free Software Foundation; either version 2 of the License, or (at your
|
||||
// option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
// for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with this program; if not, write to the Free Software Foundation,
|
||||
// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
// _________________
|
||||
|
||||
// @(#) $Revision$ $Source$
|
||||
//
|
||||
// JudyPrintJP() debugging/tracing function for Judy1 or JudyL code.
|
||||
// The caller should #include this file, with its static function (replicated
|
||||
// in each compilation unit), in another *.c file, and compile with one of
|
||||
// -DJUDY1 or -DJUDYL.
|
||||
//
|
||||
// The caller can set j__udyIndex and/or j__udyPopulation non-zero to have
|
||||
// those values reported, and also to control trace-enabling (see below).
|
||||
//
|
||||
// Tracing is disabled by default unless one or both of two env parameters is
|
||||
// set (regardless of value). If either value is set but null or evaluates to
|
||||
// zero, tracing is immediately enabled. To disable tracing until a particular
|
||||
// j__udy*Index value is seen, set STARTINDEX=<hex-index> in the env. To
|
||||
// disable it until a particular j__udy*Population value is seen, set
|
||||
// STARTPOP=<decimal-population> in the env. Once either condition is met,
|
||||
// tracing "latches on".
|
||||
//
|
||||
// Example:
|
||||
//
|
||||
// STARTPOP=0 // immediate tracing.
|
||||
// STARTINDEX=f35430a8 // not until one of these is met.
|
||||
// STARTPOP=1000000
|
||||
//
|
||||
// Note: Trace-enabling does nothing unless the caller sets the appropriate
|
||||
// global variable non-zero.
|
||||
|
||||
#if (! (defined(JUDY1) || defined(JUDYL)))
|
||||
#error: One of -DJUDY1 or -DJUDYL must be specified.
|
||||
#endif
|
||||
|
||||
#include <stdlib.h> // for getenv() and strtoul().
|
||||
|
||||
|
||||
// GLOBALS FROM CALLER:
|
||||
//
|
||||
// Note: This storage is declared once in each compilation unit that includes
|
||||
// this file, but the linker should merge all cases into single locations, but
|
||||
// ONLY if these are uninitialized, so ASSUME they are 0 to start.
|
||||
|
||||
Word_t j__udyIndex; // current Index itself, optional from caller.
|
||||
Word_t j__udyPopulation; // Indexes in array, optional from caller.
|
||||
|
||||
// Other globals:
|
||||
|
||||
static Word_t startindex = 0; // see usage below.
|
||||
static Word_t startpop = 0;
|
||||
static bool_t enabled = FALSE; // by default, unless env params set.
|
||||
|
||||
// Shorthand for announcing JP addresses, Desc (in context), and JP types:
|
||||
//
|
||||
// Note: Width is at least one blank wider than any JP type name, and the line
|
||||
// is left unfinished.
|
||||
//
|
||||
// Note: Use a format for address printing compatible with other tracing
|
||||
// facilities; in particular, %x not %lx, to truncate the "noisy" high part on
|
||||
// 64-bit systems.
|
||||
|
||||
#define JPTYPE(Type) printf("0x%lx %s %-17s", (Word_t) Pjp, Desc, Type)
|
||||
|
||||
// Shorthands for announcing expanse populations from DcdPopO fields:
|
||||
|
||||
#define POP0 printf("Pop1 = 0 ")
|
||||
#define POP1 printf("Pop1 = %ld ", (Word_t) ((JU_JPDCDPOP0(Pjp) & 0xff) + 1))
|
||||
#define POP2 printf("Pop1 = %ld ", (Word_t) ((JU_JPDCDPOP0(Pjp) & 0xffff) + 1))
|
||||
#define POP3 printf("Pop1 = %ld ", (Word_t) ((JU_JPDCDPOP0(Pjp) & 0xffffff) + 1))
|
||||
#ifdef JU_64BIT
|
||||
#define POP4 printf("Pop1 = %ld ", (Word_t) ((JU_JPDCDPOP0(Pjp) & 0xffffffff) + 1))
|
||||
#define POP5 printf("Pop1 = %ld ", (Word_t) ((JU_JPDCDPOP0(Pjp) & 0xffffffffff) + 1))
|
||||
#define POP6 printf("Pop1 = %ld ", (Word_t) ((JU_JPDCDPOP0(Pjp) & 0xffffffffffff) + 1))
|
||||
#define POP7 printf("Pop1 = %ld ", (Word_t) ((JU_JPDCDPOP0(Pjp) & 0xffffffffffffff) + 1))
|
||||
#endif
|
||||
|
||||
// Shorthands for announcing populations of Immeds:
|
||||
//
|
||||
// Note: Line up the small populations that often occur together, but beyond
|
||||
// that, dont worry about it because populations can get arbitrarily large.
|
||||
|
||||
#define POP_1 printf("Pop1 = 1 ")
|
||||
#define POP_2 printf("Pop1 = 2 ")
|
||||
#define POP_3 printf("Pop1 = 3 ")
|
||||
#define POP_4 printf("Pop1 = 4 ")
|
||||
#define POP_5 printf("Pop1 = 5 ")
|
||||
#define POP_6 printf("Pop1 = 6 ")
|
||||
#define POP_7 printf("Pop1 = 7 ")
|
||||
#define POP_8 printf("Pop1 = 8 ")
|
||||
#define POP_9 printf("Pop1 = 8 ")
|
||||
#define POP_10 printf("Pop1 = 10 ")
|
||||
#define POP_11 printf("Pop1 = 11 ")
|
||||
#define POP_12 printf("Pop1 = 12 ")
|
||||
#define POP_13 printf("Pop1 = 13 ")
|
||||
#define POP_14 printf("Pop1 = 14 ")
|
||||
#define POP_15 printf("Pop1 = 15 ")
|
||||
|
||||
// Shorthands for other announcements:
|
||||
|
||||
#define NUMJPSL printf("NumJPs = %d ", P_JBL(Pjp->jp_Addr)->jbl_NumJPs)
|
||||
#define OOPS printf("-- OOPS, invalid Type\n"); exit(1)
|
||||
|
||||
// This is harder to compute:
|
||||
|
||||
#define NUMJPSB \
|
||||
{ \
|
||||
Pjbb_t Pjbb = P_JBB(Pjp->jp_Addr); \
|
||||
Word_t subexp; \
|
||||
int numJPs = 0; \
|
||||
\
|
||||
for (subexp = 0; subexp < cJU_NUMSUBEXPB; ++subexp) \
|
||||
numJPs += j__udyCountBitsB(JU_JBB_BITMAP(Pjbb, subexp));\
|
||||
\
|
||||
printf("NumJPs = %d ", numJPs); \
|
||||
}
|
||||
|
||||
|
||||
// ****************************************************************************
|
||||
// J U D Y P R I N T J P
|
||||
//
|
||||
// Dump information about a JP, at least its address, type, population, and
|
||||
// number of JPs, as appropriate. Error out upon any unexpected JP type.
|
||||
//
|
||||
// TBD: Dump more detailed information about the JP?
|
||||
|
||||
FUNCTION static void JudyPrintJP(
|
||||
Pjp_t Pjp, // JP to describe.
|
||||
char * Desc, // brief description of caller, such as "i".
|
||||
int Line) // callers source line number.
|
||||
{
|
||||
static bool_t checked = FALSE; // set upon first entry and check for params.
|
||||
char * value; // for getenv().
|
||||
|
||||
|
||||
// CHECK FOR EXTERNAL ENABLING:
|
||||
//
|
||||
// If a parameter is set, report the value, even if it is null or otherwise
|
||||
// evaluates to zero, in which case enable tracing immediately; otherwise wait
|
||||
// for the value to be hit.
|
||||
|
||||
#define GETENV(Name,Value,Base) \
|
||||
if ((value = getenv (Name)) != (char *) NULL) \
|
||||
{ \
|
||||
(Value) = strtoul (value, (char **) NULL, Base); \
|
||||
enabled |= ((Value) == 0); /* see above */ \
|
||||
\
|
||||
(void) printf ("JudyPrintJP(\"%s\"): $%s = %lu\n", \
|
||||
Desc, Name, Value); \
|
||||
}
|
||||
|
||||
if (! checked) // only check once.
|
||||
{
|
||||
checked = TRUE;
|
||||
|
||||
GETENV ("STARTINDEX", startindex, 16);
|
||||
GETENV ("STARTPOP", startpop, 10);
|
||||
|
||||
(void) printf ("JudyPrintJP(\"%s\"): Tracing present %s\n", Desc,
|
||||
enabled ? "and immediately enabled" :
|
||||
(startindex || startpop) ?
|
||||
"but disabled until start condition met" :
|
||||
"but not enabled by env parameter");
|
||||
}
|
||||
|
||||
if (! enabled) // check repeatedly until latched enabled:
|
||||
{
|
||||
if (startindex && (startindex == j__udyIndex))
|
||||
{
|
||||
(void) printf ("=== TRACING ENABLED (\"%s\"), "
|
||||
"startindex = 0x%lx\n", Desc, startindex);
|
||||
enabled = TRUE;
|
||||
}
|
||||
else if (startpop && (startpop == j__udyPopulation))
|
||||
{
|
||||
(void) printf ("=== TRACING ENABLED (\"%s\"), "
|
||||
"startpop = %lu\n", Desc, startpop);
|
||||
enabled = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
return; // print nothing this time.
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// SWITCH ON JP TYPE:
|
||||
|
||||
switch (JU_JPTYPE(Pjp))
|
||||
{
|
||||
|
||||
// Note: The following COULD be merged more tightly between Judy1 and JudyL,
|
||||
// but we decided that the output should say cJ1*/cJL*, not cJU*, to be more
|
||||
// specific.
|
||||
|
||||
#ifdef JUDY1
|
||||
case cJ1_JPNULL1: JPTYPE("cJ1_JPNULL1"); POP0; break;
|
||||
case cJ1_JPNULL2: JPTYPE("cJ1_JPNULL2"); POP0; break;
|
||||
case cJ1_JPNULL3: JPTYPE("cJ1_JPNULL3"); POP0; break;
|
||||
#ifdef JU_64BIT
|
||||
case cJ1_JPNULL4: JPTYPE("cJ1_JPNULL4"); POP0; break;
|
||||
case cJ1_JPNULL5: JPTYPE("cJ1_JPNULL5"); POP0; break;
|
||||
case cJ1_JPNULL6: JPTYPE("cJ1_JPNULL6"); POP0; break;
|
||||
case cJ1_JPNULL7: JPTYPE("cJ1_JPNULL7"); POP0; break;
|
||||
#endif
|
||||
|
||||
case cJ1_JPBRANCH_L2: JPTYPE("cJ1_JPBRANCH_L2"); POP2;NUMJPSL;break;
|
||||
case cJ1_JPBRANCH_L3: JPTYPE("cJ1_JPBRANCH_L3"); POP3;NUMJPSL;break;
|
||||
#ifdef JU_64BIT
|
||||
case cJ1_JPBRANCH_L4: JPTYPE("cJ1_JPBRANCH_L4"); POP4;NUMJPSL;break;
|
||||
case cJ1_JPBRANCH_L5: JPTYPE("cJ1_JPBRANCH_L5"); POP5;NUMJPSL;break;
|
||||
case cJ1_JPBRANCH_L6: JPTYPE("cJ1_JPBRANCH_L6"); POP6;NUMJPSL;break;
|
||||
case cJ1_JPBRANCH_L7: JPTYPE("cJ1_JPBRANCH_L7"); POP7;NUMJPSL;break;
|
||||
#endif
|
||||
case cJ1_JPBRANCH_L: JPTYPE("cJ1_JPBRANCH_L"); NUMJPSL;break;
|
||||
|
||||
case cJ1_JPBRANCH_B2: JPTYPE("cJ1_JPBRANCH_B2"); POP2;NUMJPSB;break;
|
||||
case cJ1_JPBRANCH_B3: JPTYPE("cJ1_JPBRANCH_B3"); POP3;NUMJPSB;break;
|
||||
#ifdef JU_64BIT
|
||||
case cJ1_JPBRANCH_B4: JPTYPE("cJ1_JPBRANCH_B4"); POP4;NUMJPSB;break;
|
||||
case cJ1_JPBRANCH_B5: JPTYPE("cJ1_JPBRANCH_B5"); POP5;NUMJPSB;break;
|
||||
case cJ1_JPBRANCH_B6: JPTYPE("cJ1_JPBRANCH_B6"); POP6;NUMJPSB;break;
|
||||
case cJ1_JPBRANCH_B7: JPTYPE("cJ1_JPBRANCH_B7"); POP7;NUMJPSB;break;
|
||||
#endif
|
||||
case cJ1_JPBRANCH_B: JPTYPE("cJ1_JPBRANCH_B"); NUMJPSB;break;
|
||||
|
||||
case cJ1_JPBRANCH_U2: JPTYPE("cJ1_JPBRANCH_U2"); POP2; break;
|
||||
case cJ1_JPBRANCH_U3: JPTYPE("cJ1_JPBRANCH_U3"); POP3; break;
|
||||
#ifdef JU_64BIT
|
||||
case cJ1_JPBRANCH_U4: JPTYPE("cJ1_JPBRANCH_U4"); POP4; break;
|
||||
case cJ1_JPBRANCH_U5: JPTYPE("cJ1_JPBRANCH_U5"); POP5; break;
|
||||
case cJ1_JPBRANCH_U6: JPTYPE("cJ1_JPBRANCH_U6"); POP6; break;
|
||||
case cJ1_JPBRANCH_U7: JPTYPE("cJ1_JPBRANCH_U7"); POP7; break;
|
||||
#endif
|
||||
case cJ1_JPBRANCH_U: JPTYPE("cJ1_JPBRANCH_U"); break;
|
||||
|
||||
#ifndef JU_64BIT
|
||||
case cJ1_JPLEAF1: JPTYPE("cJ1_JPLEAF1"); POP1; break;
|
||||
#endif
|
||||
case cJ1_JPLEAF2: JPTYPE("cJ1_JPLEAF2"); POP2; break;
|
||||
case cJ1_JPLEAF3: JPTYPE("cJ1_JPLEAF3"); POP3; break;
|
||||
#ifdef JU_64BIT
|
||||
case cJ1_JPLEAF4: JPTYPE("cJ1_JPLEAF4"); POP4; break;
|
||||
case cJ1_JPLEAF5: JPTYPE("cJ1_JPLEAF5"); POP5; break;
|
||||
case cJ1_JPLEAF6: JPTYPE("cJ1_JPLEAF6"); POP6; break;
|
||||
case cJ1_JPLEAF7: JPTYPE("cJ1_JPLEAF7"); POP7; break;
|
||||
#endif
|
||||
|
||||
case cJ1_JPLEAF_B1: JPTYPE("cJ1_JPLEAF_B1"); POP1; break;
|
||||
case cJ1_JPFULLPOPU1: JPTYPE("cJ1_JPFULLPOPU1"); POP1; break;
|
||||
|
||||
case cJ1_JPIMMED_1_01: JPTYPE("cJ1_JPIMMED_1_01"); POP_1; break;
|
||||
case cJ1_JPIMMED_2_01: JPTYPE("cJ1_JPIMMED_2_01"); POP_1; break;
|
||||
case cJ1_JPIMMED_3_01: JPTYPE("cJ1_JPIMMED_3_01"); POP_1; break;
|
||||
#ifdef JU_64BIT
|
||||
case cJ1_JPIMMED_4_01: JPTYPE("cJ1_JPIMMED_4_01"); POP_1; break;
|
||||
case cJ1_JPIMMED_5_01: JPTYPE("cJ1_JPIMMED_5_01"); POP_1; break;
|
||||
case cJ1_JPIMMED_6_01: JPTYPE("cJ1_JPIMMED_6_01"); POP_1; break;
|
||||
case cJ1_JPIMMED_7_01: JPTYPE("cJ1_JPIMMED_7_01"); POP_1; break;
|
||||
#endif
|
||||
|
||||
case cJ1_JPIMMED_1_02: JPTYPE("cJ1_JPIMMED_1_02"); POP_2; break;
|
||||
case cJ1_JPIMMED_1_03: JPTYPE("cJ1_JPIMMED_1_03"); POP_3; break;
|
||||
case cJ1_JPIMMED_1_04: JPTYPE("cJ1_JPIMMED_1_04"); POP_4; break;
|
||||
case cJ1_JPIMMED_1_05: JPTYPE("cJ1_JPIMMED_1_05"); POP_5; break;
|
||||
case cJ1_JPIMMED_1_06: JPTYPE("cJ1_JPIMMED_1_06"); POP_6; break;
|
||||
case cJ1_JPIMMED_1_07: JPTYPE("cJ1_JPIMMED_1_07"); POP_7; break;
|
||||
#ifdef JU_64BIT
|
||||
case cJ1_JPIMMED_1_08: JPTYPE("cJ1_JPIMMED_1_08"); POP_8; break;
|
||||
case cJ1_JPIMMED_1_09: JPTYPE("cJ1_JPIMMED_1_09"); POP_9; break;
|
||||
case cJ1_JPIMMED_1_10: JPTYPE("cJ1_JPIMMED_1_10"); POP_10; break;
|
||||
case cJ1_JPIMMED_1_11: JPTYPE("cJ1_JPIMMED_1_11"); POP_11; break;
|
||||
case cJ1_JPIMMED_1_12: JPTYPE("cJ1_JPIMMED_1_12"); POP_12; break;
|
||||
case cJ1_JPIMMED_1_13: JPTYPE("cJ1_JPIMMED_1_13"); POP_13; break;
|
||||
case cJ1_JPIMMED_1_14: JPTYPE("cJ1_JPIMMED_1_14"); POP_14; break;
|
||||
case cJ1_JPIMMED_1_15: JPTYPE("cJ1_JPIMMED_1_15"); POP_15; break;
|
||||
#endif
|
||||
case cJ1_JPIMMED_2_02: JPTYPE("cJ1_JPIMMED_2_02"); POP_2; break;
|
||||
case cJ1_JPIMMED_2_03: JPTYPE("cJ1_JPIMMED_2_03"); POP_3; break;
|
||||
#ifdef JU_64BIT
|
||||
case cJ1_JPIMMED_2_04: JPTYPE("cJ1_JPIMMED_2_04"); POP_4; break;
|
||||
case cJ1_JPIMMED_2_05: JPTYPE("cJ1_JPIMMED_2_05"); POP_5; break;
|
||||
case cJ1_JPIMMED_2_06: JPTYPE("cJ1_JPIMMED_2_06"); POP_6; break;
|
||||
case cJ1_JPIMMED_2_07: JPTYPE("cJ1_JPIMMED_2_07"); POP_7; break;
|
||||
#endif
|
||||
|
||||
case cJ1_JPIMMED_3_02: JPTYPE("cJ1_JPIMMED_3_02"); POP_2; break;
|
||||
#ifdef JU_64BIT
|
||||
case cJ1_JPIMMED_3_03: JPTYPE("cJ1_JPIMMED_3_03"); POP_3; break;
|
||||
case cJ1_JPIMMED_3_04: JPTYPE("cJ1_JPIMMED_3_04"); POP_4; break;
|
||||
case cJ1_JPIMMED_3_05: JPTYPE("cJ1_JPIMMED_3_05"); POP_5; break;
|
||||
case cJ1_JPIMMED_4_02: JPTYPE("cJ1_JPIMMED_4_02"); POP_2; break;
|
||||
case cJ1_JPIMMED_4_03: JPTYPE("cJ1_JPIMMED_4_03"); POP_3; break;
|
||||
case cJ1_JPIMMED_5_02: JPTYPE("cJ1_JPIMMED_5_02"); POP_2; break;
|
||||
case cJ1_JPIMMED_5_03: JPTYPE("cJ1_JPIMMED_5_03"); POP_3; break;
|
||||
case cJ1_JPIMMED_6_02: JPTYPE("cJ1_JPIMMED_6_02"); POP_2; break;
|
||||
case cJ1_JPIMMED_7_02: JPTYPE("cJ1_JPIMMED_7_02"); POP_2; break;
|
||||
#endif
|
||||
case cJ1_JPIMMED_CAP: JPTYPE("cJ1_JPIMMED_CAP"); OOPS;
|
||||
|
||||
#else // JUDYL ===============================================================
|
||||
|
||||
case cJL_JPNULL1: JPTYPE("cJL_JPNULL1"); POP0; break;
|
||||
case cJL_JPNULL2: JPTYPE("cJL_JPNULL2"); POP0; break;
|
||||
case cJL_JPNULL3: JPTYPE("cJL_JPNULL3"); POP0; break;
|
||||
#ifdef JU_64BIT
|
||||
case cJL_JPNULL4: JPTYPE("cJL_JPNULL4"); POP0; break;
|
||||
case cJL_JPNULL5: JPTYPE("cJL_JPNULL5"); POP0; break;
|
||||
case cJL_JPNULL6: JPTYPE("cJL_JPNULL6"); POP0; break;
|
||||
case cJL_JPNULL7: JPTYPE("cJL_JPNULL7"); POP0; break;
|
||||
#endif
|
||||
|
||||
case cJL_JPBRANCH_L2: JPTYPE("cJL_JPBRANCH_L2"); POP2;NUMJPSL;break;
|
||||
case cJL_JPBRANCH_L3: JPTYPE("cJL_JPBRANCH_L3"); POP3;NUMJPSL;break;
|
||||
#ifdef JU_64BIT
|
||||
case cJL_JPBRANCH_L4: JPTYPE("cJL_JPBRANCH_L4"); POP4;NUMJPSL;break;
|
||||
case cJL_JPBRANCH_L5: JPTYPE("cJL_JPBRANCH_L5"); POP5;NUMJPSL;break;
|
||||
case cJL_JPBRANCH_L6: JPTYPE("cJL_JPBRANCH_L6"); POP6;NUMJPSL;break;
|
||||
case cJL_JPBRANCH_L7: JPTYPE("cJL_JPBRANCH_L7"); POP7;NUMJPSL;break;
|
||||
#endif
|
||||
case cJL_JPBRANCH_L: JPTYPE("cJL_JPBRANCH_L"); NUMJPSL;break;
|
||||
|
||||
case cJL_JPBRANCH_B2: JPTYPE("cJL_JPBRANCH_B2"); POP2;NUMJPSB;break;
|
||||
case cJL_JPBRANCH_B3: JPTYPE("cJL_JPBRANCH_B3"); POP3;NUMJPSB;break;
|
||||
#ifdef JU_64BIT
|
||||
case cJL_JPBRANCH_B4: JPTYPE("cJL_JPBRANCH_B4"); POP4;NUMJPSB;break;
|
||||
case cJL_JPBRANCH_B5: JPTYPE("cJL_JPBRANCH_B5"); POP5;NUMJPSB;break;
|
||||
case cJL_JPBRANCH_B6: JPTYPE("cJL_JPBRANCH_B6"); POP6;NUMJPSB;break;
|
||||
case cJL_JPBRANCH_B7: JPTYPE("cJL_JPBRANCH_B7"); POP7;NUMJPSB;break;
|
||||
#endif
|
||||
case cJL_JPBRANCH_B: JPTYPE("cJL_JPBRANCH_B"); NUMJPSB;break;
|
||||
|
||||
case cJL_JPBRANCH_U2: JPTYPE("cJL_JPBRANCH_U2"); POP2; break;
|
||||
case cJL_JPBRANCH_U3: JPTYPE("cJL_JPBRANCH_U3"); POP3; break;
|
||||
#ifdef JU_64BIT
|
||||
case cJL_JPBRANCH_U4: JPTYPE("cJL_JPBRANCH_U4"); POP4; break;
|
||||
case cJL_JPBRANCH_U5: JPTYPE("cJL_JPBRANCH_U5"); POP5; break;
|
||||
case cJL_JPBRANCH_U6: JPTYPE("cJL_JPBRANCH_U6"); POP6; break;
|
||||
case cJL_JPBRANCH_U7: JPTYPE("cJL_JPBRANCH_U7"); POP7; break;
|
||||
#endif
|
||||
case cJL_JPBRANCH_U: JPTYPE("cJL_JPBRANCH_U"); break;
|
||||
|
||||
case cJL_JPLEAF1: JPTYPE("cJL_JPLEAF1"); POP1; break;
|
||||
case cJL_JPLEAF2: JPTYPE("cJL_JPLEAF2"); POP2; break;
|
||||
case cJL_JPLEAF3: JPTYPE("cJL_JPLEAF3"); POP3; break;
|
||||
#ifdef JU_64BIT
|
||||
case cJL_JPLEAF4: JPTYPE("cJL_JPLEAF4"); POP4; break;
|
||||
case cJL_JPLEAF5: JPTYPE("cJL_JPLEAF5"); POP5; break;
|
||||
case cJL_JPLEAF6: JPTYPE("cJL_JPLEAF6"); POP6; break;
|
||||
case cJL_JPLEAF7: JPTYPE("cJL_JPLEAF7"); POP7; break;
|
||||
#endif
|
||||
|
||||
case cJL_JPLEAF_B1: JPTYPE("cJL_JPLEAF_B1"); POP1; break;
|
||||
|
||||
case cJL_JPIMMED_1_01: JPTYPE("cJL_JPIMMED_1_01"); POP_1; break;
|
||||
case cJL_JPIMMED_2_01: JPTYPE("cJL_JPIMMED_2_01"); POP_1; break;
|
||||
case cJL_JPIMMED_3_01: JPTYPE("cJL_JPIMMED_3_01"); POP_1; break;
|
||||
#ifdef JU_64BIT
|
||||
case cJL_JPIMMED_4_01: JPTYPE("cJL_JPIMMED_4_01"); POP_1; break;
|
||||
case cJL_JPIMMED_5_01: JPTYPE("cJL_JPIMMED_5_01"); POP_1; break;
|
||||
case cJL_JPIMMED_6_01: JPTYPE("cJL_JPIMMED_6_01"); POP_1; break;
|
||||
case cJL_JPIMMED_7_01: JPTYPE("cJL_JPIMMED_7_01"); POP_1; break;
|
||||
#endif
|
||||
|
||||
case cJL_JPIMMED_1_02: JPTYPE("cJL_JPIMMED_1_02"); POP_2; break;
|
||||
case cJL_JPIMMED_1_03: JPTYPE("cJL_JPIMMED_1_03"); POP_3; break;
|
||||
#ifdef JU_64BIT
|
||||
case cJL_JPIMMED_1_04: JPTYPE("cJL_JPIMMED_1_04"); POP_4; break;
|
||||
case cJL_JPIMMED_1_05: JPTYPE("cJL_JPIMMED_1_05"); POP_5; break;
|
||||
case cJL_JPIMMED_1_06: JPTYPE("cJL_JPIMMED_1_06"); POP_6; break;
|
||||
case cJL_JPIMMED_1_07: JPTYPE("cJL_JPIMMED_1_07"); POP_7; break;
|
||||
case cJL_JPIMMED_2_02: JPTYPE("cJL_JPIMMED_2_02"); POP_2; break;
|
||||
case cJL_JPIMMED_2_03: JPTYPE("cJL_JPIMMED_2_03"); POP_3; break;
|
||||
case cJL_JPIMMED_3_02: JPTYPE("cJL_JPIMMED_3_02"); POP_2; break;
|
||||
#endif
|
||||
case cJL_JPIMMED_CAP: JPTYPE("cJL_JPIMMED_CAP"); OOPS;
|
||||
|
||||
#endif // JUDYL
|
||||
|
||||
default: printf("Unknown Type = %d", JU_JPTYPE(Pjp)); OOPS;
|
||||
}
|
||||
|
||||
if (j__udyIndex) printf("Index = 0x%lx", j__udyIndex);
|
||||
if (j__udyPopulation) printf("Pop = %lu", j__udyPopulation);
|
||||
|
||||
printf("line = %d\n", Line);
|
||||
|
||||
} // JudyPrintJP()
|
1613
dlls/arrayx/Judy-1.0.1/src/JudyCommon/JudyPrivate.h
Normal file
1613
dlls/arrayx/Judy-1.0.1/src/JudyCommon/JudyPrivate.h
Normal file
File diff suppressed because it is too large
Load Diff
485
dlls/arrayx/Judy-1.0.1/src/JudyCommon/JudyPrivate1L.h
Normal file
485
dlls/arrayx/Judy-1.0.1/src/JudyCommon/JudyPrivate1L.h
Normal file
|
@ -0,0 +1,485 @@
|
|||
#ifndef _JUDYPRIVATE1L_INCLUDED
|
||||
#define _JUDYPRIVATE1L_INCLUDED
|
||||
// _________________
|
||||
//
|
||||
// Copyright (C) 2000 - 2002 Hewlett-Packard Company
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify it
|
||||
// under the term of the GNU Lesser General Public License as published by the
|
||||
// Free Software Foundation; either version 2 of the License, or (at your
|
||||
// option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
// for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with this program; if not, write to the Free Software Foundation,
|
||||
// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
// _________________
|
||||
|
||||
// @(#) $Revision$ $Source$
|
||||
|
||||
// ****************************************************************************
|
||||
// Declare common cJU_* names for JP Types that occur in both Judy1 and JudyL,
|
||||
// for use by code that ifdefs JUDY1 and JUDYL. Only JP Types common to both
|
||||
// Judy1 and JudyL are #defined here with equivalent cJU_* names. JP Types
|
||||
// unique to only Judy1 or JudyL are listed in comments, so the type lists
|
||||
// match the Judy1.h and JudyL.h files.
|
||||
//
|
||||
// This file also defines cJU_* for other JP-related constants and functions
|
||||
// that some shared JUDY1/JUDYL code finds handy.
|
||||
//
|
||||
// At least in principle this file should be included AFTER Judy1.h or JudyL.h.
|
||||
//
|
||||
// WARNING: This file must be kept consistent with the enums in Judy1.h and
|
||||
// JudyL.h.
|
||||
//
|
||||
// TBD: You might think, why not define common cJU_* enums in, say,
|
||||
// JudyPrivate.h, and then inherit them into superset enums in Judy1.h and
|
||||
// JudyL.h? The problem is that the enum lists for each class (cJ1_* and
|
||||
// cJL_*) must be numerically "packed" into the correct order, for two reasons:
|
||||
// (1) allow the compiler to generate "tight" switch statements with no wasted
|
||||
// slots (although this is not very big), and (2) allow calculations using the
|
||||
// enum values, although this is also not an issue if the calculations are only
|
||||
// within each cJ*_JPIMMED_*_* class and the members are packed within the
|
||||
// class.
|
||||
|
||||
#ifdef JUDY1
|
||||
|
||||
#define cJU_JRPNULL cJ1_JRPNULL
|
||||
#define cJU_JPNULL1 cJ1_JPNULL1
|
||||
#define cJU_JPNULL2 cJ1_JPNULL2
|
||||
#define cJU_JPNULL3 cJ1_JPNULL3
|
||||
#ifdef JU_64BIT
|
||||
#define cJU_JPNULL4 cJ1_JPNULL4
|
||||
#define cJU_JPNULL5 cJ1_JPNULL5
|
||||
#define cJU_JPNULL6 cJ1_JPNULL6
|
||||
#define cJU_JPNULL7 cJ1_JPNULL7
|
||||
#endif
|
||||
#define cJU_JPNULLMAX cJ1_JPNULLMAX
|
||||
#define cJU_JPBRANCH_L2 cJ1_JPBRANCH_L2
|
||||
#define cJU_JPBRANCH_L3 cJ1_JPBRANCH_L3
|
||||
#ifdef JU_64BIT
|
||||
#define cJU_JPBRANCH_L4 cJ1_JPBRANCH_L4
|
||||
#define cJU_JPBRANCH_L5 cJ1_JPBRANCH_L5
|
||||
#define cJU_JPBRANCH_L6 cJ1_JPBRANCH_L6
|
||||
#define cJU_JPBRANCH_L7 cJ1_JPBRANCH_L7
|
||||
#endif
|
||||
#define cJU_JPBRANCH_L cJ1_JPBRANCH_L
|
||||
#define j__U_BranchBJPPopToWords j__1_BranchBJPPopToWords
|
||||
#define cJU_JPBRANCH_B2 cJ1_JPBRANCH_B2
|
||||
#define cJU_JPBRANCH_B3 cJ1_JPBRANCH_B3
|
||||
#ifdef JU_64BIT
|
||||
#define cJU_JPBRANCH_B4 cJ1_JPBRANCH_B4
|
||||
#define cJU_JPBRANCH_B5 cJ1_JPBRANCH_B5
|
||||
#define cJU_JPBRANCH_B6 cJ1_JPBRANCH_B6
|
||||
#define cJU_JPBRANCH_B7 cJ1_JPBRANCH_B7
|
||||
#endif
|
||||
#define cJU_JPBRANCH_B cJ1_JPBRANCH_B
|
||||
#define cJU_JPBRANCH_U2 cJ1_JPBRANCH_U2
|
||||
#define cJU_JPBRANCH_U3 cJ1_JPBRANCH_U3
|
||||
#ifdef JU_64BIT
|
||||
#define cJU_JPBRANCH_U4 cJ1_JPBRANCH_U4
|
||||
#define cJU_JPBRANCH_U5 cJ1_JPBRANCH_U5
|
||||
#define cJU_JPBRANCH_U6 cJ1_JPBRANCH_U6
|
||||
#define cJU_JPBRANCH_U7 cJ1_JPBRANCH_U7
|
||||
#endif
|
||||
#define cJU_JPBRANCH_U cJ1_JPBRANCH_U
|
||||
#ifndef JU_64BIT
|
||||
#define cJU_JPLEAF1 cJ1_JPLEAF1
|
||||
#endif
|
||||
#define cJU_JPLEAF2 cJ1_JPLEAF2
|
||||
#define cJU_JPLEAF3 cJ1_JPLEAF3
|
||||
#ifdef JU_64BIT
|
||||
#define cJU_JPLEAF4 cJ1_JPLEAF4
|
||||
#define cJU_JPLEAF5 cJ1_JPLEAF5
|
||||
#define cJU_JPLEAF6 cJ1_JPLEAF6
|
||||
#define cJU_JPLEAF7 cJ1_JPLEAF7
|
||||
#endif
|
||||
#define cJU_JPLEAF_B1 cJ1_JPLEAF_B1
|
||||
// cJ1_JPFULLPOPU1
|
||||
#define cJU_JPIMMED_1_01 cJ1_JPIMMED_1_01
|
||||
#define cJU_JPIMMED_2_01 cJ1_JPIMMED_2_01
|
||||
#define cJU_JPIMMED_3_01 cJ1_JPIMMED_3_01
|
||||
#ifdef JU_64BIT
|
||||
#define cJU_JPIMMED_4_01 cJ1_JPIMMED_4_01
|
||||
#define cJU_JPIMMED_5_01 cJ1_JPIMMED_5_01
|
||||
#define cJU_JPIMMED_6_01 cJ1_JPIMMED_6_01
|
||||
#define cJU_JPIMMED_7_01 cJ1_JPIMMED_7_01
|
||||
#endif
|
||||
#define cJU_JPIMMED_1_02 cJ1_JPIMMED_1_02
|
||||
#define cJU_JPIMMED_1_03 cJ1_JPIMMED_1_03
|
||||
#define cJU_JPIMMED_1_04 cJ1_JPIMMED_1_04
|
||||
#define cJU_JPIMMED_1_05 cJ1_JPIMMED_1_05
|
||||
#define cJU_JPIMMED_1_06 cJ1_JPIMMED_1_06
|
||||
#define cJU_JPIMMED_1_07 cJ1_JPIMMED_1_07
|
||||
#ifdef JU_64BIT
|
||||
// cJ1_JPIMMED_1_08
|
||||
// cJ1_JPIMMED_1_09
|
||||
// cJ1_JPIMMED_1_10
|
||||
// cJ1_JPIMMED_1_11
|
||||
// cJ1_JPIMMED_1_12
|
||||
// cJ1_JPIMMED_1_13
|
||||
// cJ1_JPIMMED_1_14
|
||||
// cJ1_JPIMMED_1_15
|
||||
#endif
|
||||
#define cJU_JPIMMED_2_02 cJ1_JPIMMED_2_02
|
||||
#define cJU_JPIMMED_2_03 cJ1_JPIMMED_2_03
|
||||
#ifdef JU_64BIT
|
||||
// cJ1_JPIMMED_2_04
|
||||
// cJ1_JPIMMED_2_05
|
||||
// cJ1_JPIMMED_2_06
|
||||
// cJ1_JPIMMED_2_07
|
||||
#endif
|
||||
#define cJU_JPIMMED_3_02 cJ1_JPIMMED_3_02
|
||||
#ifdef JU_64BIT
|
||||
// cJ1_JPIMMED_3_03
|
||||
// cJ1_JPIMMED_3_04
|
||||
// cJ1_JPIMMED_3_05
|
||||
// cJ1_JPIMMED_4_02
|
||||
// cJ1_JPIMMED_4_03
|
||||
// cJ1_JPIMMED_5_02
|
||||
// cJ1_JPIMMED_5_03
|
||||
// cJ1_JPIMMED_6_02
|
||||
// cJ1_JPIMMED_7_02
|
||||
#endif
|
||||
#define cJU_JPIMMED_CAP cJ1_JPIMMED_CAP
|
||||
|
||||
#else // JUDYL ****************************************************************
|
||||
|
||||
#define cJU_JRPNULL cJL_JRPNULL
|
||||
#define cJU_JPNULL1 cJL_JPNULL1
|
||||
#define cJU_JPNULL2 cJL_JPNULL2
|
||||
#define cJU_JPNULL3 cJL_JPNULL3
|
||||
#ifdef JU_64BIT
|
||||
#define cJU_JPNULL4 cJL_JPNULL4
|
||||
#define cJU_JPNULL5 cJL_JPNULL5
|
||||
#define cJU_JPNULL6 cJL_JPNULL6
|
||||
#define cJU_JPNULL7 cJL_JPNULL7
|
||||
#endif
|
||||
#define cJU_JPNULLMAX cJL_JPNULLMAX
|
||||
#define cJU_JPBRANCH_L2 cJL_JPBRANCH_L2
|
||||
#define cJU_JPBRANCH_L3 cJL_JPBRANCH_L3
|
||||
#ifdef JU_64BIT
|
||||
#define cJU_JPBRANCH_L4 cJL_JPBRANCH_L4
|
||||
#define cJU_JPBRANCH_L5 cJL_JPBRANCH_L5
|
||||
#define cJU_JPBRANCH_L6 cJL_JPBRANCH_L6
|
||||
#define cJU_JPBRANCH_L7 cJL_JPBRANCH_L7
|
||||
#endif
|
||||
#define cJU_JPBRANCH_L cJL_JPBRANCH_L
|
||||
#define j__U_BranchBJPPopToWords j__L_BranchBJPPopToWords
|
||||
#define cJU_JPBRANCH_B2 cJL_JPBRANCH_B2
|
||||
#define cJU_JPBRANCH_B3 cJL_JPBRANCH_B3
|
||||
#ifdef JU_64BIT
|
||||
#define cJU_JPBRANCH_B4 cJL_JPBRANCH_B4
|
||||
#define cJU_JPBRANCH_B5 cJL_JPBRANCH_B5
|
||||
#define cJU_JPBRANCH_B6 cJL_JPBRANCH_B6
|
||||
#define cJU_JPBRANCH_B7 cJL_JPBRANCH_B7
|
||||
#endif
|
||||
#define cJU_JPBRANCH_B cJL_JPBRANCH_B
|
||||
#define cJU_JPBRANCH_U2 cJL_JPBRANCH_U2
|
||||
#define cJU_JPBRANCH_U3 cJL_JPBRANCH_U3
|
||||
#ifdef JU_64BIT
|
||||
#define cJU_JPBRANCH_U4 cJL_JPBRANCH_U4
|
||||
#define cJU_JPBRANCH_U5 cJL_JPBRANCH_U5
|
||||
#define cJU_JPBRANCH_U6 cJL_JPBRANCH_U6
|
||||
#define cJU_JPBRANCH_U7 cJL_JPBRANCH_U7
|
||||
#endif
|
||||
#define cJU_JPBRANCH_U cJL_JPBRANCH_U
|
||||
#define cJU_JPLEAF1 cJL_JPLEAF1
|
||||
#define cJU_JPLEAF2 cJL_JPLEAF2
|
||||
#define cJU_JPLEAF3 cJL_JPLEAF3
|
||||
#ifdef JU_64BIT
|
||||
#define cJU_JPLEAF4 cJL_JPLEAF4
|
||||
#define cJU_JPLEAF5 cJL_JPLEAF5
|
||||
#define cJU_JPLEAF6 cJL_JPLEAF6
|
||||
#define cJU_JPLEAF7 cJL_JPLEAF7
|
||||
#endif
|
||||
#define cJU_JPLEAF_B1 cJL_JPLEAF_B1
|
||||
#define cJU_JPIMMED_1_01 cJL_JPIMMED_1_01
|
||||
#define cJU_JPIMMED_2_01 cJL_JPIMMED_2_01
|
||||
#define cJU_JPIMMED_3_01 cJL_JPIMMED_3_01
|
||||
#ifdef JU_64BIT
|
||||
#define cJU_JPIMMED_4_01 cJL_JPIMMED_4_01
|
||||
#define cJU_JPIMMED_5_01 cJL_JPIMMED_5_01
|
||||
#define cJU_JPIMMED_6_01 cJL_JPIMMED_6_01
|
||||
#define cJU_JPIMMED_7_01 cJL_JPIMMED_7_01
|
||||
#endif
|
||||
#define cJU_JPIMMED_1_02 cJL_JPIMMED_1_02
|
||||
#define cJU_JPIMMED_1_03 cJL_JPIMMED_1_03
|
||||
#ifdef JU_64BIT
|
||||
#define cJU_JPIMMED_1_04 cJL_JPIMMED_1_04
|
||||
#define cJU_JPIMMED_1_05 cJL_JPIMMED_1_05
|
||||
#define cJU_JPIMMED_1_06 cJL_JPIMMED_1_06
|
||||
#define cJU_JPIMMED_1_07 cJL_JPIMMED_1_07
|
||||
#define cJU_JPIMMED_2_02 cJL_JPIMMED_2_02
|
||||
#define cJU_JPIMMED_2_03 cJL_JPIMMED_2_03
|
||||
#define cJU_JPIMMED_3_02 cJL_JPIMMED_3_02
|
||||
#endif
|
||||
#define cJU_JPIMMED_CAP cJL_JPIMMED_CAP
|
||||
|
||||
#endif // JUDYL
|
||||
|
||||
|
||||
// ****************************************************************************
|
||||
// cJU*_ other than JP types:
|
||||
|
||||
#ifdef JUDY1
|
||||
|
||||
#define cJU_LEAFW_MAXPOP1 cJ1_LEAFW_MAXPOP1
|
||||
#ifndef JU_64BIT
|
||||
#define cJU_LEAF1_MAXPOP1 cJ1_LEAF1_MAXPOP1
|
||||
#endif
|
||||
#define cJU_LEAF2_MAXPOP1 cJ1_LEAF2_MAXPOP1
|
||||
#define cJU_LEAF3_MAXPOP1 cJ1_LEAF3_MAXPOP1
|
||||
#ifdef JU_64BIT
|
||||
#define cJU_LEAF4_MAXPOP1 cJ1_LEAF4_MAXPOP1
|
||||
#define cJU_LEAF5_MAXPOP1 cJ1_LEAF5_MAXPOP1
|
||||
#define cJU_LEAF6_MAXPOP1 cJ1_LEAF6_MAXPOP1
|
||||
#define cJU_LEAF7_MAXPOP1 cJ1_LEAF7_MAXPOP1
|
||||
#endif
|
||||
#define cJU_IMMED1_MAXPOP1 cJ1_IMMED1_MAXPOP1
|
||||
#define cJU_IMMED2_MAXPOP1 cJ1_IMMED2_MAXPOP1
|
||||
#define cJU_IMMED3_MAXPOP1 cJ1_IMMED3_MAXPOP1
|
||||
#ifdef JU_64BIT
|
||||
#define cJU_IMMED4_MAXPOP1 cJ1_IMMED4_MAXPOP1
|
||||
#define cJU_IMMED5_MAXPOP1 cJ1_IMMED5_MAXPOP1
|
||||
#define cJU_IMMED6_MAXPOP1 cJ1_IMMED6_MAXPOP1
|
||||
#define cJU_IMMED7_MAXPOP1 cJ1_IMMED7_MAXPOP1
|
||||
#endif
|
||||
|
||||
#define JU_LEAF1POPTOWORDS(Pop1) J1_LEAF1POPTOWORDS(Pop1)
|
||||
#define JU_LEAF2POPTOWORDS(Pop1) J1_LEAF2POPTOWORDS(Pop1)
|
||||
#define JU_LEAF3POPTOWORDS(Pop1) J1_LEAF3POPTOWORDS(Pop1)
|
||||
#ifdef JU_64BIT
|
||||
#define JU_LEAF4POPTOWORDS(Pop1) J1_LEAF4POPTOWORDS(Pop1)
|
||||
#define JU_LEAF5POPTOWORDS(Pop1) J1_LEAF5POPTOWORDS(Pop1)
|
||||
#define JU_LEAF6POPTOWORDS(Pop1) J1_LEAF6POPTOWORDS(Pop1)
|
||||
#define JU_LEAF7POPTOWORDS(Pop1) J1_LEAF7POPTOWORDS(Pop1)
|
||||
#endif
|
||||
#define JU_LEAFWPOPTOWORDS(Pop1) J1_LEAFWPOPTOWORDS(Pop1)
|
||||
|
||||
#ifndef JU_64BIT
|
||||
#define JU_LEAF1GROWINPLACE(Pop1) J1_LEAF1GROWINPLACE(Pop1)
|
||||
#endif
|
||||
#define JU_LEAF2GROWINPLACE(Pop1) J1_LEAF2GROWINPLACE(Pop1)
|
||||
#define JU_LEAF3GROWINPLACE(Pop1) J1_LEAF3GROWINPLACE(Pop1)
|
||||
#ifdef JU_64BIT
|
||||
#define JU_LEAF4GROWINPLACE(Pop1) J1_LEAF4GROWINPLACE(Pop1)
|
||||
#define JU_LEAF5GROWINPLACE(Pop1) J1_LEAF5GROWINPLACE(Pop1)
|
||||
#define JU_LEAF6GROWINPLACE(Pop1) J1_LEAF6GROWINPLACE(Pop1)
|
||||
#define JU_LEAF7GROWINPLACE(Pop1) J1_LEAF7GROWINPLACE(Pop1)
|
||||
#endif
|
||||
#define JU_LEAFWGROWINPLACE(Pop1) J1_LEAFWGROWINPLACE(Pop1)
|
||||
|
||||
#define j__udyCreateBranchL j__udy1CreateBranchL
|
||||
#define j__udyCreateBranchB j__udy1CreateBranchB
|
||||
#define j__udyCreateBranchU j__udy1CreateBranchU
|
||||
#define j__udyCascade1 j__udy1Cascade1
|
||||
#define j__udyCascade2 j__udy1Cascade2
|
||||
#define j__udyCascade3 j__udy1Cascade3
|
||||
#ifdef JU_64BIT
|
||||
#define j__udyCascade4 j__udy1Cascade4
|
||||
#define j__udyCascade5 j__udy1Cascade5
|
||||
#define j__udyCascade6 j__udy1Cascade6
|
||||
#define j__udyCascade7 j__udy1Cascade7
|
||||
#endif
|
||||
#define j__udyCascadeL j__udy1CascadeL
|
||||
#define j__udyInsertBranch j__udy1InsertBranch
|
||||
|
||||
#define j__udyBranchBToBranchL j__udy1BranchBToBranchL
|
||||
#ifndef JU_64BIT
|
||||
#define j__udyLeafB1ToLeaf1 j__udy1LeafB1ToLeaf1
|
||||
#endif
|
||||
#define j__udyLeaf1ToLeaf2 j__udy1Leaf1ToLeaf2
|
||||
#define j__udyLeaf2ToLeaf3 j__udy1Leaf2ToLeaf3
|
||||
#ifndef JU_64BIT
|
||||
#define j__udyLeaf3ToLeafW j__udy1Leaf3ToLeafW
|
||||
#else
|
||||
#define j__udyLeaf3ToLeaf4 j__udy1Leaf3ToLeaf4
|
||||
#define j__udyLeaf4ToLeaf5 j__udy1Leaf4ToLeaf5
|
||||
#define j__udyLeaf5ToLeaf6 j__udy1Leaf5ToLeaf6
|
||||
#define j__udyLeaf6ToLeaf7 j__udy1Leaf6ToLeaf7
|
||||
#define j__udyLeaf7ToLeafW j__udy1Leaf7ToLeafW
|
||||
#endif
|
||||
|
||||
#define jpm_t j1pm_t
|
||||
#define Pjpm_t Pj1pm_t
|
||||
|
||||
#define jlb_t j1lb_t
|
||||
#define Pjlb_t Pj1lb_t
|
||||
|
||||
#define JU_JLB_BITMAP J1_JLB_BITMAP
|
||||
|
||||
#define j__udyAllocJPM j__udy1AllocJ1PM
|
||||
#define j__udyAllocJBL j__udy1AllocJBL
|
||||
#define j__udyAllocJBB j__udy1AllocJBB
|
||||
#define j__udyAllocJBBJP j__udy1AllocJBBJP
|
||||
#define j__udyAllocJBU j__udy1AllocJBU
|
||||
#ifndef JU_64BIT
|
||||
#define j__udyAllocJLL1 j__udy1AllocJLL1
|
||||
#endif
|
||||
#define j__udyAllocJLL2 j__udy1AllocJLL2
|
||||
#define j__udyAllocJLL3 j__udy1AllocJLL3
|
||||
#ifdef JU_64BIT
|
||||
#define j__udyAllocJLL4 j__udy1AllocJLL4
|
||||
#define j__udyAllocJLL5 j__udy1AllocJLL5
|
||||
#define j__udyAllocJLL6 j__udy1AllocJLL6
|
||||
#define j__udyAllocJLL7 j__udy1AllocJLL7
|
||||
#endif
|
||||
#define j__udyAllocJLW j__udy1AllocJLW
|
||||
#define j__udyAllocJLB1 j__udy1AllocJLB1
|
||||
#define j__udyFreeJPM j__udy1FreeJ1PM
|
||||
#define j__udyFreeJBL j__udy1FreeJBL
|
||||
#define j__udyFreeJBB j__udy1FreeJBB
|
||||
#define j__udyFreeJBBJP j__udy1FreeJBBJP
|
||||
#define j__udyFreeJBU j__udy1FreeJBU
|
||||
#ifndef JU_64BIT
|
||||
#define j__udyFreeJLL1 j__udy1FreeJLL1
|
||||
#endif
|
||||
#define j__udyFreeJLL2 j__udy1FreeJLL2
|
||||
#define j__udyFreeJLL3 j__udy1FreeJLL3
|
||||
#ifdef JU_64BIT
|
||||
#define j__udyFreeJLL4 j__udy1FreeJLL4
|
||||
#define j__udyFreeJLL5 j__udy1FreeJLL5
|
||||
#define j__udyFreeJLL6 j__udy1FreeJLL6
|
||||
#define j__udyFreeJLL7 j__udy1FreeJLL7
|
||||
#endif
|
||||
#define j__udyFreeJLW j__udy1FreeJLW
|
||||
#define j__udyFreeJLB1 j__udy1FreeJLB1
|
||||
#define j__udyFreeSM j__udy1FreeSM
|
||||
|
||||
#define j__uMaxWords j__u1MaxWords
|
||||
|
||||
#ifdef DEBUG
|
||||
#define JudyCheckPop Judy1CheckPop
|
||||
#endif
|
||||
|
||||
#else // JUDYL ****************************************************************
|
||||
|
||||
#define cJU_LEAFW_MAXPOP1 cJL_LEAFW_MAXPOP1
|
||||
#define cJU_LEAF1_MAXPOP1 cJL_LEAF1_MAXPOP1
|
||||
#define cJU_LEAF2_MAXPOP1 cJL_LEAF2_MAXPOP1
|
||||
#define cJU_LEAF3_MAXPOP1 cJL_LEAF3_MAXPOP1
|
||||
#ifdef JU_64BIT
|
||||
#define cJU_LEAF4_MAXPOP1 cJL_LEAF4_MAXPOP1
|
||||
#define cJU_LEAF5_MAXPOP1 cJL_LEAF5_MAXPOP1
|
||||
#define cJU_LEAF6_MAXPOP1 cJL_LEAF6_MAXPOP1
|
||||
#define cJU_LEAF7_MAXPOP1 cJL_LEAF7_MAXPOP1
|
||||
#endif
|
||||
#define cJU_IMMED1_MAXPOP1 cJL_IMMED1_MAXPOP1
|
||||
#define cJU_IMMED2_MAXPOP1 cJL_IMMED2_MAXPOP1
|
||||
#define cJU_IMMED3_MAXPOP1 cJL_IMMED3_MAXPOP1
|
||||
#ifdef JU_64BIT
|
||||
#define cJU_IMMED4_MAXPOP1 cJL_IMMED4_MAXPOP1
|
||||
#define cJU_IMMED5_MAXPOP1 cJL_IMMED5_MAXPOP1
|
||||
#define cJU_IMMED6_MAXPOP1 cJL_IMMED6_MAXPOP1
|
||||
#define cJU_IMMED7_MAXPOP1 cJL_IMMED7_MAXPOP1
|
||||
#endif
|
||||
|
||||
#define JU_LEAF1POPTOWORDS(Pop1) JL_LEAF1POPTOWORDS(Pop1)
|
||||
#define JU_LEAF2POPTOWORDS(Pop1) JL_LEAF2POPTOWORDS(Pop1)
|
||||
#define JU_LEAF3POPTOWORDS(Pop1) JL_LEAF3POPTOWORDS(Pop1)
|
||||
#ifdef JU_64BIT
|
||||
#define JU_LEAF4POPTOWORDS(Pop1) JL_LEAF4POPTOWORDS(Pop1)
|
||||
#define JU_LEAF5POPTOWORDS(Pop1) JL_LEAF5POPTOWORDS(Pop1)
|
||||
#define JU_LEAF6POPTOWORDS(Pop1) JL_LEAF6POPTOWORDS(Pop1)
|
||||
#define JU_LEAF7POPTOWORDS(Pop1) JL_LEAF7POPTOWORDS(Pop1)
|
||||
#endif
|
||||
#define JU_LEAFWPOPTOWORDS(Pop1) JL_LEAFWPOPTOWORDS(Pop1)
|
||||
|
||||
#define JU_LEAF1GROWINPLACE(Pop1) JL_LEAF1GROWINPLACE(Pop1)
|
||||
#define JU_LEAF2GROWINPLACE(Pop1) JL_LEAF2GROWINPLACE(Pop1)
|
||||
#define JU_LEAF3GROWINPLACE(Pop1) JL_LEAF3GROWINPLACE(Pop1)
|
||||
#ifdef JU_64BIT
|
||||
#define JU_LEAF4GROWINPLACE(Pop1) JL_LEAF4GROWINPLACE(Pop1)
|
||||
#define JU_LEAF5GROWINPLACE(Pop1) JL_LEAF5GROWINPLACE(Pop1)
|
||||
#define JU_LEAF6GROWINPLACE(Pop1) JL_LEAF6GROWINPLACE(Pop1)
|
||||
#define JU_LEAF7GROWINPLACE(Pop1) JL_LEAF7GROWINPLACE(Pop1)
|
||||
#endif
|
||||
#define JU_LEAFWGROWINPLACE(Pop1) JL_LEAFWGROWINPLACE(Pop1)
|
||||
|
||||
#define j__udyCreateBranchL j__udyLCreateBranchL
|
||||
#define j__udyCreateBranchB j__udyLCreateBranchB
|
||||
#define j__udyCreateBranchU j__udyLCreateBranchU
|
||||
#define j__udyCascade1 j__udyLCascade1
|
||||
#define j__udyCascade2 j__udyLCascade2
|
||||
#define j__udyCascade3 j__udyLCascade3
|
||||
#ifdef JU_64BIT
|
||||
#define j__udyCascade4 j__udyLCascade4
|
||||
#define j__udyCascade5 j__udyLCascade5
|
||||
#define j__udyCascade6 j__udyLCascade6
|
||||
#define j__udyCascade7 j__udyLCascade7
|
||||
#endif
|
||||
#define j__udyCascadeL j__udyLCascadeL
|
||||
#define j__udyInsertBranch j__udyLInsertBranch
|
||||
|
||||
#define j__udyBranchBToBranchL j__udyLBranchBToBranchL
|
||||
#define j__udyLeafB1ToLeaf1 j__udyLLeafB1ToLeaf1
|
||||
#define j__udyLeaf1ToLeaf2 j__udyLLeaf1ToLeaf2
|
||||
#define j__udyLeaf2ToLeaf3 j__udyLLeaf2ToLeaf3
|
||||
#ifndef JU_64BIT
|
||||
#define j__udyLeaf3ToLeafW j__udyLLeaf3ToLeafW
|
||||
#else
|
||||
#define j__udyLeaf3ToLeaf4 j__udyLLeaf3ToLeaf4
|
||||
#define j__udyLeaf4ToLeaf5 j__udyLLeaf4ToLeaf5
|
||||
#define j__udyLeaf5ToLeaf6 j__udyLLeaf5ToLeaf6
|
||||
#define j__udyLeaf6ToLeaf7 j__udyLLeaf6ToLeaf7
|
||||
#define j__udyLeaf7ToLeafW j__udyLLeaf7ToLeafW
|
||||
#endif
|
||||
|
||||
#define jpm_t jLpm_t
|
||||
#define Pjpm_t PjLpm_t
|
||||
|
||||
#define jlb_t jLlb_t
|
||||
#define Pjlb_t PjLlb_t
|
||||
|
||||
#define JU_JLB_BITMAP JL_JLB_BITMAP
|
||||
|
||||
#define j__udyAllocJPM j__udyLAllocJLPM
|
||||
#define j__udyAllocJBL j__udyLAllocJBL
|
||||
#define j__udyAllocJBB j__udyLAllocJBB
|
||||
#define j__udyAllocJBBJP j__udyLAllocJBBJP
|
||||
#define j__udyAllocJBU j__udyLAllocJBU
|
||||
#define j__udyAllocJLL1 j__udyLAllocJLL1
|
||||
#define j__udyAllocJLL2 j__udyLAllocJLL2
|
||||
#define j__udyAllocJLL3 j__udyLAllocJLL3
|
||||
#ifdef JU_64BIT
|
||||
#define j__udyAllocJLL4 j__udyLAllocJLL4
|
||||
#define j__udyAllocJLL5 j__udyLAllocJLL5
|
||||
#define j__udyAllocJLL6 j__udyLAllocJLL6
|
||||
#define j__udyAllocJLL7 j__udyLAllocJLL7
|
||||
#endif
|
||||
#define j__udyAllocJLW j__udyLAllocJLW
|
||||
#define j__udyAllocJLB1 j__udyLAllocJLB1
|
||||
// j__udyLAllocJV
|
||||
#define j__udyFreeJPM j__udyLFreeJLPM
|
||||
#define j__udyFreeJBL j__udyLFreeJBL
|
||||
#define j__udyFreeJBB j__udyLFreeJBB
|
||||
#define j__udyFreeJBBJP j__udyLFreeJBBJP
|
||||
#define j__udyFreeJBU j__udyLFreeJBU
|
||||
#define j__udyFreeJLL1 j__udyLFreeJLL1
|
||||
#define j__udyFreeJLL2 j__udyLFreeJLL2
|
||||
#define j__udyFreeJLL3 j__udyLFreeJLL3
|
||||
#ifdef JU_64BIT
|
||||
#define j__udyFreeJLL4 j__udyLFreeJLL4
|
||||
#define j__udyFreeJLL5 j__udyLFreeJLL5
|
||||
#define j__udyFreeJLL6 j__udyLFreeJLL6
|
||||
#define j__udyFreeJLL7 j__udyLFreeJLL7
|
||||
#endif
|
||||
#define j__udyFreeJLW j__udyLFreeJLW
|
||||
#define j__udyFreeJLB1 j__udyLFreeJLB1
|
||||
#define j__udyFreeSM j__udyLFreeSM
|
||||
// j__udyLFreeJV
|
||||
|
||||
#define j__uMaxWords j__uLMaxWords
|
||||
|
||||
#ifdef DEBUG
|
||||
#define JudyCheckPop JudyLCheckPop
|
||||
#endif
|
||||
|
||||
#endif // JUDYL
|
||||
|
||||
#endif // _JUDYPRIVATE1L_INCLUDED
|
779
dlls/arrayx/Judy-1.0.1/src/JudyCommon/JudyPrivateBranch.h
Normal file
779
dlls/arrayx/Judy-1.0.1/src/JudyCommon/JudyPrivateBranch.h
Normal file
|
@ -0,0 +1,779 @@
|
|||
#ifndef _JUDY_PRIVATE_BRANCH_INCLUDED
|
||||
#define _JUDY_PRIVATE_BRANCH_INCLUDED
|
||||
// _________________
|
||||
//
|
||||
// Copyright (C) 2000 - 2002 Hewlett-Packard Company
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify it
|
||||
// under the term of the GNU Lesser General Public License as published by the
|
||||
// Free Software Foundation; either version 2 of the License, or (at your
|
||||
// option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
// for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with this program; if not, write to the Free Software Foundation,
|
||||
// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
// _________________
|
||||
|
||||
// @(#) $Revision$ $Source$
|
||||
//
|
||||
// Header file for all Judy sources, for global but private (non-exported)
|
||||
// declarations specific to branch support.
|
||||
//
|
||||
// See also the "Judy Shop Manual" (try judy/doc/int/JudyShopManual.*).
|
||||
|
||||
|
||||
// ****************************************************************************
|
||||
// JUDY POINTER (JP) SUPPORT
|
||||
// ****************************************************************************
|
||||
//
|
||||
// This "rich pointer" object is pivotal to Judy execution.
|
||||
//
|
||||
// JP CONTAINING OTHER THAN IMMEDIATE INDEXES:
|
||||
//
|
||||
// If the JP points to a linear or bitmap leaf, jp_DcdPopO contains the
|
||||
// Population-1 in LSbs and Decode (Dcd) bytes in the MSBs. (In practice the
|
||||
// Decode bits are masked off while accessing the Pop0 bits.)
|
||||
//
|
||||
// The Decode Size, the number of Dcd bytes available, is encoded in jpo_Type.
|
||||
// It can also be thought of as the number of states "skipped" in the SM, where
|
||||
// each state decodes 8 bits = 1 byte.
|
||||
//
|
||||
// TBD: Dont need two structures, except possibly to force jp_Type to highest
|
||||
// address!
|
||||
//
|
||||
// Note: The jpo_u union is not required by HP-UX or Linux but Win32 because
|
||||
// the cl.exe compiler otherwise refuses to pack a bitfield (DcdPopO) with
|
||||
// anything else, even with the -Zp option. This is pretty ugly, but
|
||||
// fortunately portable, and its all hide-able by macros (see below).
|
||||
|
||||
typedef struct J_UDY_POINTER_OTHERS // JPO.
|
||||
{
|
||||
Word_t j_po_Addr; // first word: Pjp_t, Word_t, etc.
|
||||
union {
|
||||
// Word_t j_po_DcdPop0:cJU_BITSPERWORD-cJU_BITSPERBYTE;
|
||||
uint8_t j_po_DcdP0[sizeof(Word_t) - 1];
|
||||
uint8_t j_po_Bytes[sizeof(Word_t)]; // last byte = jp_Type.
|
||||
} jpo_u;
|
||||
} jpo_t;
|
||||
|
||||
|
||||
// JP CONTAINING IMMEDIATE INDEXES:
|
||||
//
|
||||
// j_pi_1Index[] plus j_pi_LIndex[] together hold as many N-byte (1..3-byte
|
||||
// [1..7-byte]) Indexes as will fit in sizeof(jpi_t) less 1 byte for j_pi_Type
|
||||
// (that is, 7..1 [15..1] Indexes).
|
||||
//
|
||||
// For Judy1, j_pi_1Index[] is used and j_pi_LIndex[] is not used.
|
||||
// For JudyL, j_pi_LIndex[] is used and j_pi_1Index[] is not used.
|
||||
//
|
||||
// Note: Actually when Pop1 = 1, jpi_t is not used, and the least bytes of the
|
||||
// single Index are stored in j_po_DcdPopO, for both Judy1 and JudyL, so for
|
||||
// JudyL the j_po_Addr field can hold the target value.
|
||||
//
|
||||
// TBD: Revise this structure to not overload j_po_DcdPopO this way? The
|
||||
// current arrangement works, its just confusing.
|
||||
|
||||
typedef struct _JUDY_POINTER_IMMED // JPI.
|
||||
{
|
||||
uint8_t j_pi_1Index[sizeof(Word_t)]; // see above.
|
||||
uint8_t j_pi_LIndex[sizeof(Word_t) - 1]; // see above.
|
||||
uint8_t j_pi_Type; // JP type, 1 of cJ*_JPIMMED*.
|
||||
} jpi_t;
|
||||
|
||||
|
||||
// UNION OF JP TYPES:
|
||||
//
|
||||
// A branch is an array of cJU_BRANCHUNUMJPS (256) of this object, or an
|
||||
// alternate data type such as: A linear branch which is a list of 2..7 JPs,
|
||||
// or a bitmap branch which contains 8 lists of 0..32 JPs. JPs reside only in
|
||||
// branches of a Judy SM.
|
||||
|
||||
typedef union J_UDY_POINTER // JP.
|
||||
{
|
||||
jpo_t j_po; // other than immediate indexes.
|
||||
jpi_t j_pi; // immediate indexes.
|
||||
} jp_t, *Pjp_t;
|
||||
|
||||
// For coding convenience:
|
||||
//
|
||||
// Note, jp_Type has the same bits in jpo_t and jpi_t.
|
||||
|
||||
#define jp_1Index j_pi.j_pi_1Index // for storing Indexes in first word.
|
||||
#define jp_LIndex j_pi.j_pi_LIndex // for storing Indexes in second word.
|
||||
#define jp_Addr j_po.j_po_Addr
|
||||
//#define jp_DcdPop0 j_po.jpo_u.j_po_DcdPop0
|
||||
#define jp_Type j_po.jpo_u.j_po_Bytes[sizeof(Word_t) - 1]
|
||||
#define jp_DcdP0 j_po.jpo_u.j_po_DcdP0
|
||||
|
||||
|
||||
// ****************************************************************************
|
||||
// JUDY POINTER (JP) -- RELATED MACROS AND CONSTANTS
|
||||
// ****************************************************************************
|
||||
|
||||
// EXTRACT VALUES FROM JP:
|
||||
//
|
||||
// Masks for the bytes in the Dcd and Pop0 parts of jp_DcdPopO:
|
||||
//
|
||||
// cJU_DCDMASK() consists of a mask that excludes the (LSb) Pop0 bytes and
|
||||
// also, just to be safe, the top byte of the word, since jp_DcdPopO is 1 byte
|
||||
// less than a full word.
|
||||
//
|
||||
// Note: These are constant macros (cJU) because cPopBytes should be a
|
||||
// constant. Also note cPopBytes == state in the SM.
|
||||
|
||||
#define cJU_POP0MASK(cPopBytes) JU_LEASTBYTESMASK(cPopBytes)
|
||||
|
||||
#define cJU_DCDMASK(cPopBytes) \
|
||||
((cJU_ALLONES >> cJU_BITSPERBYTE) & (~cJU_POP0MASK(cPopBytes)))
|
||||
|
||||
// Mask off the high byte from INDEX to it can be compared to DcdPopO:
|
||||
|
||||
#define JU_TRIMTODCDSIZE(INDEX) ((cJU_ALLONES >> cJU_BITSPERBYTE) & (INDEX))
|
||||
|
||||
// Get from jp_DcdPopO the Pop0 for various branch JP Types:
|
||||
//
|
||||
// Note: There are no simple macros for cJU_BRANCH* Types because their
|
||||
// populations must be added up and dont reside in an already-calculated
|
||||
// place.
|
||||
|
||||
#define JU_JPBRANCH_POP0(PJP,cPopBytes) \
|
||||
(JU_JPDCDPOP0(PJP) & cJU_POP0MASK(cPopBytes))
|
||||
|
||||
// METHOD FOR DETERMINING IF OBJECTS HAVE ROOM TO GROW:
|
||||
//
|
||||
// J__U_GROWCK() is a generic method to determine if an object can grow in
|
||||
// place, based on whether the next population size (one more) would use the
|
||||
// same space.
|
||||
|
||||
#define J__U_GROWCK(POP1,MAXPOP1,POPTOWORDS) \
|
||||
(((POP1) != (MAXPOP1)) && (POPTOWORDS[POP1] == POPTOWORDS[(POP1) + 1]))
|
||||
|
||||
#define JU_BRANCHBJPGROWINPLACE(NumJPs) \
|
||||
J__U_GROWCK(NumJPs, cJU_BITSPERSUBEXPB, j__U_BranchBJPPopToWords)
|
||||
|
||||
|
||||
// DETERMINE IF AN INDEX IS (NOT) IN A JPS EXPANSE:
|
||||
|
||||
#define JU_DCDNOTMATCHINDEX(INDEX,PJP,POP0BYTES) \
|
||||
(((INDEX) ^ JU_JPDCDPOP0(PJP)) & cJU_DCDMASK(POP0BYTES))
|
||||
|
||||
|
||||
// NUMBER OF JPs IN AN UNCOMPRESSED BRANCH:
|
||||
//
|
||||
// An uncompressed branch is simply an array of 256 Judy Pointers (JPs). It is
|
||||
// a minimum cacheline fill object. Define it here before its first needed.
|
||||
|
||||
#define cJU_BRANCHUNUMJPS cJU_SUBEXPPERSTATE
|
||||
|
||||
|
||||
// ****************************************************************************
|
||||
// JUDY BRANCH LINEAR (JBL) SUPPORT
|
||||
// ****************************************************************************
|
||||
//
|
||||
// A linear branch is a way of compressing empty expanses (null JPs) out of an
|
||||
// uncompressed 256-way branch, when the number of populated expanses is so
|
||||
// small that even a bitmap branch is excessive.
|
||||
//
|
||||
// The maximum number of JPs in a Judy linear branch:
|
||||
//
|
||||
// Note: This number results in a 1-cacheline sized structure. Previous
|
||||
// versions had a larger struct so a linear branch didnt become a bitmap
|
||||
// branch until the memory consumed was even, but for speed, its better to
|
||||
// switch "sooner" and keep a linear branch fast.
|
||||
|
||||
#define cJU_BRANCHLMAXJPS 7
|
||||
|
||||
|
||||
// LINEAR BRANCH STRUCT:
|
||||
//
|
||||
// 1-byte count, followed by array of byte-sized expanses, followed by JPs.
|
||||
|
||||
typedef struct J__UDY_BRANCH_LINEAR
|
||||
{
|
||||
uint8_t jbl_NumJPs; // num of JPs (Pjp_t), 1..N.
|
||||
uint8_t jbl_Expanse[cJU_BRANCHLMAXJPS]; // 1..7 MSbs of pop exps.
|
||||
jp_t jbl_jp [cJU_BRANCHLMAXJPS]; // JPs for populated exps.
|
||||
} jbl_t, * Pjbl_t;
|
||||
|
||||
|
||||
// ****************************************************************************
|
||||
// JUDY BRANCH BITMAP (JBB) SUPPORT
|
||||
// ****************************************************************************
|
||||
//
|
||||
// A bitmap branch is a way of compressing empty expanses (null JPs) out of
|
||||
// uncompressed 256-way branch. This costs 1 additional cache line fill, but
|
||||
// can save a lot of memory when it matters most, near the leaves, and
|
||||
// typically there will be only one at most in the path to any Index (leaf).
|
||||
//
|
||||
// The bitmap indicates which of the cJU_BRANCHUNUMJPS (256) JPs in the branch
|
||||
// are NOT null, that is, their expanses are populated. The jbb_t also
|
||||
// contains N pointers to "mini" Judy branches ("subexpanses") of up to M JPs
|
||||
// each (see BITMAP_BRANCHMxN, for example, BITMAP_BRANCH32x8), where M x N =
|
||||
// cJU_BRANCHUNUMJPS. These are dynamically allocated and never contain
|
||||
// cJ*_JPNULL* jp_Types. An empty subexpanse is represented by no bit sets in
|
||||
// the corresponding subexpanse bitmap, in which case the corresponding
|
||||
// jbbs_Pjp pointers value is unused.
|
||||
//
|
||||
// Note that the number of valid JPs in each 1-of-N subexpanses is determined
|
||||
// by POPULATION rather than by EXPANSE -- the desired outcome to save memory
|
||||
// when near the leaves. Note that the memory required for 185 JPs is about as
|
||||
// much as an uncompressed 256-way branch, therefore 184 is set as the maximum.
|
||||
// However, it is expected that a conversion to an uncompressed 256-way branch
|
||||
// will normally take place before this limit is reached for other reasons,
|
||||
// such as improving performance when the "wasted" memory is well amortized by
|
||||
// the population under the branch, preserving an acceptable overall
|
||||
// bytes/Index in the Judy array.
|
||||
//
|
||||
// The number of pointers to arrays of JPs in the Judy bitmap branch:
|
||||
//
|
||||
// Note: The numbers below are the same in both 32 and 64 bit systems.
|
||||
|
||||
#define cJU_BRANCHBMAXJPS 184 // maximum JPs for bitmap branches.
|
||||
|
||||
// Convenience wrappers for referencing BranchB bitmaps or JP subarray
|
||||
// pointers:
|
||||
//
|
||||
// Note: JU_JBB_PJP produces a "raw" memory address that must pass through
|
||||
// P_JP before use, except when freeing memory:
|
||||
|
||||
#define JU_JBB_BITMAP(Pjbb, SubExp) ((Pjbb)->jbb_jbbs[SubExp].jbbs_Bitmap)
|
||||
#define JU_JBB_PJP( Pjbb, SubExp) ((Pjbb)->jbb_jbbs[SubExp].jbbs_Pjp)
|
||||
|
||||
#define JU_SUBEXPB(Digit) (((Digit) / cJU_BITSPERSUBEXPB) & (cJU_NUMSUBEXPB-1))
|
||||
|
||||
#define JU_BITMAPTESTB(Pjbb, Index) \
|
||||
(JU_JBB_BITMAP(Pjbb, JU_SUBEXPB(Index)) & JU_BITPOSMASKB(Index))
|
||||
|
||||
#define JU_BITMAPSETB(Pjbb, Index) \
|
||||
(JU_JBB_BITMAP(Pjbb, JU_SUBEXPB(Index)) |= JU_BITPOSMASKB(Index))
|
||||
|
||||
// Note: JU_BITMAPCLEARB is not defined because the code does it a faster way.
|
||||
|
||||
typedef struct J__UDY_BRANCH_BITMAP_SUBEXPANSE
|
||||
{
|
||||
BITMAPB_t jbbs_Bitmap;
|
||||
Pjp_t jbbs_Pjp;
|
||||
|
||||
} jbbs_t;
|
||||
|
||||
typedef struct J__UDY_BRANCH_BITMAP
|
||||
{
|
||||
jbbs_t jbb_jbbs [cJU_NUMSUBEXPB];
|
||||
#ifdef SUBEXPCOUNTS
|
||||
Word_t jbb_subPop1[cJU_NUMSUBEXPB];
|
||||
#endif
|
||||
} jbb_t, * Pjbb_t;
|
||||
|
||||
#define JU_BRANCHJP_NUMJPSTOWORDS(NumJPs) (j__U_BranchBJPPopToWords[NumJPs])
|
||||
|
||||
#ifdef SUBEXPCOUNTS
|
||||
#define cJU_NUMSUBEXPU 16 // number of subexpanse counts.
|
||||
#endif
|
||||
|
||||
|
||||
// ****************************************************************************
|
||||
// JUDY BRANCH UNCOMPRESSED (JBU) SUPPORT
|
||||
// ****************************************************************************
|
||||
|
||||
// Convenience wrapper for referencing BranchU JPs:
|
||||
//
|
||||
// Note: This produces a non-"raw" address already passed through P_JBU().
|
||||
|
||||
#define JU_JBU_PJP(Pjp,Index,Level) \
|
||||
(&((P_JBU((Pjp)->jp_Addr))->jbu_jp[JU_DIGITATSTATE(Index, Level)]))
|
||||
#define JU_JBU_PJP0(Pjp) \
|
||||
(&((P_JBU((Pjp)->jp_Addr))->jbu_jp[0]))
|
||||
|
||||
typedef struct J__UDY_BRANCH_UNCOMPRESSED
|
||||
{
|
||||
jp_t jbu_jp [cJU_BRANCHUNUMJPS]; // JPs for populated exp.
|
||||
#ifdef SUBEXPCOUNTS
|
||||
Word_t jbu_subPop1[cJU_NUMSUBEXPU];
|
||||
#endif
|
||||
} jbu_t, * Pjbu_t;
|
||||
|
||||
|
||||
// ****************************************************************************
|
||||
// OTHER SUPPORT FOR JUDY STATE MACHINES (SMs)
|
||||
// ****************************************************************************
|
||||
|
||||
// OBJECT SIZES IN WORDS:
|
||||
//
|
||||
// Word_ts per various JudyL structures that have constant sizes.
|
||||
// cJU_WORDSPERJP should always be 2; this is fundamental to the Judy
|
||||
// structures.
|
||||
|
||||
#define cJU_WORDSPERJP (sizeof(jp_t) / cJU_BYTESPERWORD)
|
||||
#define cJU_WORDSPERCL (cJU_BYTESPERCL / cJU_BYTESPERWORD)
|
||||
|
||||
|
||||
// OPPORTUNISTIC UNCOMPRESSION:
|
||||
//
|
||||
// Define populations at which a BranchL or BranchB must convert to BranchU.
|
||||
// Earlier conversion is possible with good memory efficiency -- see below.
|
||||
|
||||
#ifndef NO_BRANCHU
|
||||
|
||||
// Max population below BranchL, then convert to BranchU:
|
||||
|
||||
#define JU_BRANCHL_MAX_POP 1000
|
||||
|
||||
// Minimum global population increment before next conversion of a BranchB to a
|
||||
// BranchU:
|
||||
//
|
||||
// This is was done to allow malloc() to coalesce memory before the next big
|
||||
// (~512 words) allocation.
|
||||
|
||||
#define JU_BTOU_POP_INCREMENT 300
|
||||
|
||||
// Min/max population below BranchB, then convert to BranchU:
|
||||
|
||||
#define JU_BRANCHB_MIN_POP 135
|
||||
#define JU_BRANCHB_MAX_POP 750
|
||||
|
||||
#else // NO_BRANCHU
|
||||
|
||||
// These are set up to have conservative conversion schedules to BranchU:
|
||||
|
||||
#define JU_BRANCHL_MAX_POP (-1UL)
|
||||
#define JU_BTOU_POP_INCREMENT 300
|
||||
#define JU_BRANCHB_MIN_POP 1000
|
||||
#define JU_BRANCHB_MAX_POP (-1UL)
|
||||
|
||||
#endif // NO_BRANCHU
|
||||
|
||||
|
||||
// MISCELLANEOUS MACROS:
|
||||
|
||||
// Get N most significant bits from the shifted Index word:
|
||||
//
|
||||
// As Index words are decoded, they are shifted left so only relevant,
|
||||
// undecoded Index bits remain.
|
||||
|
||||
#define JU_BITSFROMSFTIDX(SFTIDX, N) ((SFTIDX) >> (cJU_BITSPERWORD - (N)))
|
||||
|
||||
// TBD: I have my doubts about the necessity of these macros (dlb):
|
||||
|
||||
// Produce 1-digit mask at specified state:
|
||||
|
||||
#define cJU_MASKATSTATE(State) (0xffL << (((State) - 1) * cJU_BITSPERBYTE))
|
||||
|
||||
// Get byte (digit) from Index at the specified state, right justified:
|
||||
//
|
||||
// Note: State must be 1..cJU_ROOTSTATE, and Digits must be 1..(cJU_ROOTSTATE
|
||||
// - 1), but theres no way to assert these within an expression.
|
||||
|
||||
#define JU_DIGITATSTATE(Index,cState) \
|
||||
((uint8_t)((Index) >> (((cState) - 1) * cJU_BITSPERBYTE)))
|
||||
|
||||
// Similarly, place byte (digit) at correct position for the specified state:
|
||||
//
|
||||
// Note: Cast digit to a Word_t first so there are no complaints or problems
|
||||
// about shifting it more than 32 bits on a 64-bit system, say, when it is a
|
||||
// uint8_t from jbl_Expanse[]. (Believe it or not, the C standard says to
|
||||
// promote an unsigned char to a signed int; -Ac does not do this, but -Ae
|
||||
// does.)
|
||||
//
|
||||
// Also, to make lint happy, cast the whole result again because apparently
|
||||
// shifting a Word_t does not result in a Word_t!
|
||||
|
||||
#define JU_DIGITTOSTATE(Digit,cState) \
|
||||
((Word_t) (((Word_t) (Digit)) << (((cState) - 1) * cJU_BITSPERBYTE)))
|
||||
|
||||
#endif // ! _JUDY_PRIVATE_BRANCH_INCLUDED
|
||||
|
||||
|
||||
#ifdef TEST_INSDEL
|
||||
|
||||
// ****************************************************************************
|
||||
// TEST CODE FOR INSERT/DELETE MACROS
|
||||
// ****************************************************************************
|
||||
//
|
||||
// To use this, compile a temporary *.c file containing:
|
||||
//
|
||||
// #define DEBUG
|
||||
// #define JUDY_ASSERT
|
||||
// #define TEST_INSDEL
|
||||
// #include "JudyPrivate.h"
|
||||
// #include "JudyPrivateBranch.h"
|
||||
//
|
||||
// Use a command like this: cc -Ae +DD64 -I. -I JudyCommon -o t t.c
|
||||
// For best results, include +DD64 on a 64-bit system.
|
||||
//
|
||||
// This test code exercises some tricky macros, but the output must be studied
|
||||
// manually to verify it. Assume that for even-index testing, whole words
|
||||
// (Word_t) suffices.
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#define INDEXES 3 // in each array.
|
||||
|
||||
|
||||
// ****************************************************************************
|
||||
// I N I T
|
||||
//
|
||||
// Set up variables for next test. See usage.
|
||||
|
||||
FUNCTION void Init (
|
||||
int base,
|
||||
PWord_t PeIndex,
|
||||
PWord_t PoIndex,
|
||||
PWord_t Peleaf, // always whole words.
|
||||
#ifndef JU_64BIT
|
||||
uint8_t * Poleaf3)
|
||||
#else
|
||||
uint8_t * Poleaf3,
|
||||
uint8_t * Poleaf5,
|
||||
uint8_t * Poleaf6,
|
||||
uint8_t * Poleaf7)
|
||||
#endif
|
||||
{
|
||||
int offset;
|
||||
|
||||
*PeIndex = 99;
|
||||
|
||||
for (offset = 0; offset <= INDEXES; ++offset)
|
||||
Peleaf[offset] = base + offset;
|
||||
|
||||
for (offset = 0; offset < (INDEXES + 1) * 3; ++offset)
|
||||
Poleaf3[offset] = base + offset;
|
||||
|
||||
#ifndef JU_64BIT
|
||||
*PoIndex = (91 << 24) | (92 << 16) | (93 << 8) | 94;
|
||||
#else
|
||||
|
||||
*PoIndex = (91L << 56) | (92L << 48) | (93L << 40) | (94L << 32)
|
||||
| (95L << 24) | (96L << 16) | (97L << 8) | 98L;
|
||||
|
||||
for (offset = 0; offset < (INDEXES + 1) * 5; ++offset)
|
||||
Poleaf5[offset] = base + offset;
|
||||
|
||||
for (offset = 0; offset < (INDEXES + 1) * 6; ++offset)
|
||||
Poleaf6[offset] = base + offset;
|
||||
|
||||
for (offset = 0; offset < (INDEXES + 1) * 7; ++offset)
|
||||
Poleaf7[offset] = base + offset;
|
||||
#endif
|
||||
|
||||
} // Init()
|
||||
|
||||
|
||||
// ****************************************************************************
|
||||
// P R I N T L E A F
|
||||
//
|
||||
// Print the byte values in a leaf.
|
||||
|
||||
FUNCTION void PrintLeaf (
|
||||
char * Label, // for output.
|
||||
int IOffset, // insertion offset in array.
|
||||
int Indsize, // index size in bytes.
|
||||
uint8_t * PLeaf) // array of Index bytes.
|
||||
{
|
||||
int offset; // in PLeaf.
|
||||
int byte; // in one word.
|
||||
|
||||
(void) printf("%s %u: ", Label, IOffset);
|
||||
|
||||
for (offset = 0; offset <= INDEXES; ++offset)
|
||||
{
|
||||
for (byte = 0; byte < Indsize; ++byte)
|
||||
(void) printf("%2d", PLeaf[(offset * Indsize) + byte]);
|
||||
|
||||
(void) printf(" ");
|
||||
}
|
||||
|
||||
(void) printf("\n");
|
||||
|
||||
} // PrintLeaf()
|
||||
|
||||
|
||||
// ****************************************************************************
|
||||
// M A I N
|
||||
//
|
||||
// Test program.
|
||||
|
||||
FUNCTION main()
|
||||
{
|
||||
Word_t eIndex; // even, to insert.
|
||||
Word_t oIndex; // odd, to insert.
|
||||
Word_t eleaf [ INDEXES + 1]; // even leaf, index size 4.
|
||||
uint8_t oleaf3[(INDEXES + 1) * 3]; // odd leaf, index size 3.
|
||||
#ifdef JU_64BIT
|
||||
uint8_t oleaf5[(INDEXES + 1) * 5]; // odd leaf, index size 5.
|
||||
uint8_t oleaf6[(INDEXES + 1) * 6]; // odd leaf, index size 6.
|
||||
uint8_t oleaf7[(INDEXES + 1) * 7]; // odd leaf, index size 7.
|
||||
#endif
|
||||
Word_t eleaf_2 [ INDEXES + 1]; // same, but second arrays:
|
||||
uint8_t oleaf3_2[(INDEXES + 1) * 3];
|
||||
#ifdef JU_64BIT
|
||||
uint8_t oleaf5_2[(INDEXES + 1) * 5];
|
||||
uint8_t oleaf6_2[(INDEXES + 1) * 6];
|
||||
uint8_t oleaf7_2[(INDEXES + 1) * 7];
|
||||
#endif
|
||||
int ioffset; // index insertion offset.
|
||||
|
||||
#ifndef JU_64BIT
|
||||
#define INIT Init( 0, & eIndex, & oIndex, eleaf, oleaf3)
|
||||
#define INIT2 INIT; Init(50, & eIndex, & oIndex, eleaf_2, oleaf3_2)
|
||||
#else
|
||||
#define INIT Init( 0, & eIndex, & oIndex, eleaf, oleaf3, \
|
||||
oleaf5, oleaf6, oleaf7)
|
||||
#define INIT2 INIT; Init(50, & eIndex, & oIndex, eleaf_2, oleaf3_2, \
|
||||
oleaf5_2, oleaf6_2, oleaf7_2)
|
||||
#endif
|
||||
|
||||
#define WSIZE sizeof (Word_t) // shorthand.
|
||||
|
||||
#ifdef PRINTALL // to turn on "noisy" printouts.
|
||||
#define PRINTLEAF(Label,IOffset,Indsize,PLeaf) \
|
||||
PrintLeaf(Label,IOffset,Indsize,PLeaf)
|
||||
#else
|
||||
#define PRINTLEAF(Label,IOffset,Indsize,PLeaf) \
|
||||
if (ioffset == 0) \
|
||||
PrintLeaf(Label,IOffset,Indsize,PLeaf)
|
||||
#endif
|
||||
|
||||
(void) printf(
|
||||
"In each case, tests operate on an initial array of %d indexes. Even-index\n"
|
||||
"tests set index values to 0,1,2...; odd-index tests set byte values to\n"
|
||||
"0,1,2... Inserted indexes have a value of 99 or else byte values 91,92,...\n",
|
||||
INDEXES);
|
||||
|
||||
(void) puts("\nJU_INSERTINPLACE():");
|
||||
|
||||
for (ioffset = 0; ioffset <= INDEXES; ++ioffset)
|
||||
{
|
||||
INIT;
|
||||
PRINTLEAF("Before", ioffset, WSIZE, (uint8_t *) eleaf);
|
||||
JU_INSERTINPLACE(eleaf, INDEXES, ioffset, eIndex);
|
||||
PrintLeaf("After ", ioffset, WSIZE, (uint8_t *) eleaf);
|
||||
}
|
||||
|
||||
(void) puts("\nJU_INSERTINPLACE3():");
|
||||
|
||||
for (ioffset = 0; ioffset <= INDEXES; ++ioffset)
|
||||
{
|
||||
INIT;
|
||||
PRINTLEAF("Before", ioffset, 3, oleaf3);
|
||||
JU_INSERTINPLACE3(oleaf3, INDEXES, ioffset, oIndex);
|
||||
PrintLeaf("After ", ioffset, 3, oleaf3);
|
||||
}
|
||||
|
||||
#ifdef JU_64BIT
|
||||
(void) puts("\nJU_INSERTINPLACE5():");
|
||||
|
||||
for (ioffset = 0; ioffset <= INDEXES; ++ioffset)
|
||||
{
|
||||
INIT;
|
||||
PRINTLEAF("Before", ioffset, 5, oleaf5);
|
||||
JU_INSERTINPLACE5(oleaf5, INDEXES, ioffset, oIndex);
|
||||
PrintLeaf("After ", ioffset, 5, oleaf5);
|
||||
}
|
||||
|
||||
(void) puts("\nJU_INSERTINPLACE6():");
|
||||
|
||||
for (ioffset = 0; ioffset <= INDEXES; ++ioffset)
|
||||
{
|
||||
INIT;
|
||||
PRINTLEAF("Before", ioffset, 6, oleaf6);
|
||||
JU_INSERTINPLACE6(oleaf6, INDEXES, ioffset, oIndex);
|
||||
PrintLeaf("After ", ioffset, 6, oleaf6);
|
||||
}
|
||||
|
||||
(void) puts("\nJU_INSERTINPLACE7():");
|
||||
|
||||
for (ioffset = 0; ioffset <= INDEXES; ++ioffset)
|
||||
{
|
||||
INIT;
|
||||
PRINTLEAF("Before", ioffset, 7, oleaf7);
|
||||
JU_INSERTINPLACE7(oleaf7, INDEXES, ioffset, oIndex);
|
||||
PrintLeaf("After ", ioffset, 7, oleaf7);
|
||||
}
|
||||
#endif // JU_64BIT
|
||||
|
||||
(void) puts("\nJU_DELETEINPLACE():");
|
||||
|
||||
for (ioffset = 0; ioffset < INDEXES; ++ioffset)
|
||||
{
|
||||
INIT;
|
||||
PRINTLEAF("Before", ioffset, WSIZE, (uint8_t *) eleaf);
|
||||
JU_DELETEINPLACE(eleaf, INDEXES, ioffset);
|
||||
PrintLeaf("After ", ioffset, WSIZE, (uint8_t *) eleaf);
|
||||
}
|
||||
|
||||
(void) puts("\nJU_DELETEINPLACE_ODD(3):");
|
||||
|
||||
for (ioffset = 0; ioffset < INDEXES; ++ioffset)
|
||||
{
|
||||
INIT;
|
||||
PRINTLEAF("Before", ioffset, 3, oleaf3);
|
||||
JU_DELETEINPLACE_ODD(oleaf3, INDEXES, ioffset, 3);
|
||||
PrintLeaf("After ", ioffset, 3, oleaf3);
|
||||
}
|
||||
|
||||
#ifdef JU_64BIT
|
||||
(void) puts("\nJU_DELETEINPLACE_ODD(5):");
|
||||
|
||||
for (ioffset = 0; ioffset < INDEXES; ++ioffset)
|
||||
{
|
||||
INIT;
|
||||
PRINTLEAF("Before", ioffset, 5, oleaf5);
|
||||
JU_DELETEINPLACE_ODD(oleaf5, INDEXES, ioffset, 5);
|
||||
PrintLeaf("After ", ioffset, 5, oleaf5);
|
||||
}
|
||||
|
||||
(void) puts("\nJU_DELETEINPLACE_ODD(6):");
|
||||
|
||||
for (ioffset = 0; ioffset < INDEXES; ++ioffset)
|
||||
{
|
||||
INIT;
|
||||
PRINTLEAF("Before", ioffset, 6, oleaf6);
|
||||
JU_DELETEINPLACE_ODD(oleaf6, INDEXES, ioffset, 6);
|
||||
PrintLeaf("After ", ioffset, 6, oleaf6);
|
||||
}
|
||||
|
||||
(void) puts("\nJU_DELETEINPLACE_ODD(7):");
|
||||
|
||||
for (ioffset = 0; ioffset < INDEXES; ++ioffset)
|
||||
{
|
||||
INIT;
|
||||
PRINTLEAF("Before", ioffset, 7, oleaf7);
|
||||
JU_DELETEINPLACE_ODD(oleaf7, INDEXES, ioffset, 7);
|
||||
PrintLeaf("After ", ioffset, 7, oleaf7);
|
||||
}
|
||||
#endif // JU_64BIT
|
||||
|
||||
(void) puts("\nJU_INSERTCOPY():");
|
||||
|
||||
for (ioffset = 0; ioffset <= INDEXES; ++ioffset)
|
||||
{
|
||||
INIT2;
|
||||
PRINTLEAF("Before, src ", ioffset, WSIZE, (uint8_t *) eleaf);
|
||||
PRINTLEAF("Before, dest", ioffset, WSIZE, (uint8_t *) eleaf_2);
|
||||
JU_INSERTCOPY(eleaf_2, eleaf, INDEXES, ioffset, eIndex);
|
||||
PRINTLEAF("After, src ", ioffset, WSIZE, (uint8_t *) eleaf);
|
||||
PrintLeaf("After, dest", ioffset, WSIZE, (uint8_t *) eleaf_2);
|
||||
}
|
||||
|
||||
(void) puts("\nJU_INSERTCOPY3():");
|
||||
|
||||
for (ioffset = 0; ioffset <= INDEXES; ++ioffset)
|
||||
{
|
||||
INIT2;
|
||||
PRINTLEAF("Before, src ", ioffset, 3, oleaf3);
|
||||
PRINTLEAF("Before, dest", ioffset, 3, oleaf3_2);
|
||||
JU_INSERTCOPY3(oleaf3_2, oleaf3, INDEXES, ioffset, oIndex);
|
||||
PRINTLEAF("After, src ", ioffset, 3, oleaf3);
|
||||
PrintLeaf("After, dest", ioffset, 3, oleaf3_2);
|
||||
}
|
||||
|
||||
#ifdef JU_64BIT
|
||||
(void) puts("\nJU_INSERTCOPY5():");
|
||||
|
||||
for (ioffset = 0; ioffset <= INDEXES; ++ioffset)
|
||||
{
|
||||
INIT2;
|
||||
PRINTLEAF("Before, src ", ioffset, 5, oleaf5);
|
||||
PRINTLEAF("Before, dest", ioffset, 5, oleaf5_2);
|
||||
JU_INSERTCOPY5(oleaf5_2, oleaf5, INDEXES, ioffset, oIndex);
|
||||
PRINTLEAF("After, src ", ioffset, 5, oleaf5);
|
||||
PrintLeaf("After, dest", ioffset, 5, oleaf5_2);
|
||||
}
|
||||
|
||||
(void) puts("\nJU_INSERTCOPY6():");
|
||||
|
||||
for (ioffset = 0; ioffset <= INDEXES; ++ioffset)
|
||||
{
|
||||
INIT2;
|
||||
PRINTLEAF("Before, src ", ioffset, 6, oleaf6);
|
||||
PRINTLEAF("Before, dest", ioffset, 6, oleaf6_2);
|
||||
JU_INSERTCOPY6(oleaf6_2, oleaf6, INDEXES, ioffset, oIndex);
|
||||
PRINTLEAF("After, src ", ioffset, 6, oleaf6);
|
||||
PrintLeaf("After, dest", ioffset, 6, oleaf6_2);
|
||||
}
|
||||
|
||||
(void) puts("\nJU_INSERTCOPY7():");
|
||||
|
||||
for (ioffset = 0; ioffset <= INDEXES; ++ioffset)
|
||||
{
|
||||
INIT2;
|
||||
PRINTLEAF("Before, src ", ioffset, 7, oleaf7);
|
||||
PRINTLEAF("Before, dest", ioffset, 7, oleaf7_2);
|
||||
JU_INSERTCOPY7(oleaf7_2, oleaf7, INDEXES, ioffset, oIndex);
|
||||
PRINTLEAF("After, src ", ioffset, 7, oleaf7);
|
||||
PrintLeaf("After, dest", ioffset, 7, oleaf7_2);
|
||||
}
|
||||
#endif // JU_64BIT
|
||||
|
||||
(void) puts("\nJU_DELETECOPY():");
|
||||
|
||||
for (ioffset = 0; ioffset < INDEXES; ++ioffset)
|
||||
{
|
||||
INIT2;
|
||||
PRINTLEAF("Before, src ", ioffset, WSIZE, (uint8_t *) eleaf);
|
||||
PRINTLEAF("Before, dest", ioffset, WSIZE, (uint8_t *) eleaf_2);
|
||||
JU_DELETECOPY(eleaf_2, eleaf, INDEXES, ioffset, ignore);
|
||||
PRINTLEAF("After, src ", ioffset, WSIZE, (uint8_t *) eleaf);
|
||||
PrintLeaf("After, dest", ioffset, WSIZE, (uint8_t *) eleaf_2);
|
||||
}
|
||||
|
||||
(void) puts("\nJU_DELETECOPY_ODD(3):");
|
||||
|
||||
for (ioffset = 0; ioffset < INDEXES; ++ioffset)
|
||||
{
|
||||
INIT2;
|
||||
PRINTLEAF("Before, src ", ioffset, 3, oleaf3);
|
||||
PRINTLEAF("Before, dest", ioffset, 3, oleaf3_2);
|
||||
JU_DELETECOPY_ODD(oleaf3_2, oleaf3, INDEXES, ioffset, 3);
|
||||
PRINTLEAF("After, src ", ioffset, 3, oleaf3);
|
||||
PrintLeaf("After, dest", ioffset, 3, oleaf3_2);
|
||||
}
|
||||
|
||||
#ifdef JU_64BIT
|
||||
(void) puts("\nJU_DELETECOPY_ODD(5):");
|
||||
|
||||
for (ioffset = 0; ioffset < INDEXES; ++ioffset)
|
||||
{
|
||||
INIT2;
|
||||
PRINTLEAF("Before, src ", ioffset, 5, oleaf5);
|
||||
PRINTLEAF("Before, dest", ioffset, 5, oleaf5_2);
|
||||
JU_DELETECOPY_ODD(oleaf5_2, oleaf5, INDEXES, ioffset, 5);
|
||||
PRINTLEAF("After, src ", ioffset, 5, oleaf5);
|
||||
PrintLeaf("After, dest", ioffset, 5, oleaf5_2);
|
||||
}
|
||||
|
||||
(void) puts("\nJU_DELETECOPY_ODD(6):");
|
||||
|
||||
for (ioffset = 0; ioffset < INDEXES; ++ioffset)
|
||||
{
|
||||
INIT2;
|
||||
PRINTLEAF("Before, src ", ioffset, 6, oleaf6);
|
||||
PRINTLEAF("Before, dest", ioffset, 6, oleaf6_2);
|
||||
JU_DELETECOPY_ODD(oleaf6_2, oleaf6, INDEXES, ioffset, 6);
|
||||
PRINTLEAF("After, src ", ioffset, 6, oleaf6);
|
||||
PrintLeaf("After, dest", ioffset, 6, oleaf6_2);
|
||||
}
|
||||
|
||||
(void) puts("\nJU_DELETECOPY_ODD(7):");
|
||||
|
||||
for (ioffset = 0; ioffset < INDEXES; ++ioffset)
|
||||
{
|
||||
INIT2;
|
||||
PRINTLEAF("Before, src ", ioffset, 7, oleaf7);
|
||||
PRINTLEAF("Before, dest", ioffset, 7, oleaf7_2);
|
||||
JU_DELETECOPY_ODD(oleaf7_2, oleaf7, INDEXES, ioffset, 7);
|
||||
PRINTLEAF("After, src ", ioffset, 7, oleaf7);
|
||||
PrintLeaf("After, dest", ioffset, 7, oleaf7_2);
|
||||
}
|
||||
#endif // JU_64BIT
|
||||
|
||||
return(0);
|
||||
|
||||
} // main()
|
||||
|
||||
#endif // TEST_INSDEL
|
296
dlls/arrayx/Judy-1.0.1/src/JudyCommon/JudyTables.c
Normal file
296
dlls/arrayx/Judy-1.0.1/src/JudyCommon/JudyTables.c
Normal file
|
@ -0,0 +1,296 @@
|
|||
// Copyright (C) 2000 - 2002 Hewlett-Packard Company
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify it
|
||||
// under the term of the GNU Lesser General Public License as published by the
|
||||
// Free Software Foundation; either version 2 of the License, or (at your
|
||||
// option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
// for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with this program; if not, write to the Free Software Foundation,
|
||||
// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
// _________________
|
||||
|
||||
// @(#) $Revision$ $Source$
|
||||
|
||||
#ifndef JU_WIN
|
||||
#include <unistd.h> // unavailable on win_*.
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#if (! (defined(JUDY1) || defined(JUDYL)))
|
||||
#error: One of -DJUDY1 or -DJUDYL must be specified.
|
||||
#endif
|
||||
|
||||
#define TERMINATOR 999 // terminator for Alloc tables
|
||||
|
||||
#define BPW sizeof(Word_t) // define bytes per word
|
||||
|
||||
#ifdef JUDY1
|
||||
#include "Judy1.h"
|
||||
#else
|
||||
#include "JudyL.h"
|
||||
#endif
|
||||
|
||||
FILE *fd;
|
||||
|
||||
// Definitions come from header files Judy1.h and JudyL.h:
|
||||
|
||||
int AllocSizes[] = ALLOCSIZES;
|
||||
|
||||
#define ROUNDUP(BYTES,BPW,OFFSETW) \
|
||||
((((BYTES) + (BPW) - 1) / (BPW)) + (OFFSETW))
|
||||
|
||||
|
||||
// ****************************************************************************
|
||||
// G E N T A B L E
|
||||
//
|
||||
// Note: "const" is required for newer compilers.
|
||||
|
||||
FUNCTION void GenTable(
|
||||
const char * TableName, // name of table string
|
||||
const char * TableSize, // dimentioned size string
|
||||
int IndexBytes, // bytes per Index
|
||||
int LeafSize, // number elements in object
|
||||
int ValueBytes, // bytes per Value
|
||||
int OffsetWords) // 1 for LEAFW
|
||||
{
|
||||
int * PAllocSizes = AllocSizes;
|
||||
int OWord;
|
||||
int CurWord;
|
||||
int IWord;
|
||||
int ii;
|
||||
int BytesOfIndex;
|
||||
int BytesOfObject;
|
||||
int Index;
|
||||
int LastWords;
|
||||
int Words [1000] = { 0 };
|
||||
int Offset[1000] = { 0 };
|
||||
int MaxWords;
|
||||
|
||||
MaxWords = ROUNDUP((IndexBytes + ValueBytes) * LeafSize, BPW, OffsetWords);
|
||||
Words[0] = 0;
|
||||
Offset[0] = 0;
|
||||
CurWord = TERMINATOR;
|
||||
|
||||
// Walk through all number of Indexes in table:
|
||||
|
||||
for (Index = 1; /* null */; ++Index)
|
||||
{
|
||||
|
||||
// Calculate byte required for next size:
|
||||
|
||||
BytesOfIndex = IndexBytes * Index;
|
||||
BytesOfObject = (IndexBytes + ValueBytes) * Index;
|
||||
|
||||
// Round up and calculate words required for next size:
|
||||
|
||||
OWord = ROUNDUP(BytesOfObject, BPW, OffsetWords);
|
||||
IWord = ROUNDUP(BytesOfIndex, BPW, OffsetWords);
|
||||
|
||||
// Root-level leaves of population of 1 and 2 do not have the 1 word offset:
|
||||
|
||||
// Save minimum value of offset:
|
||||
|
||||
Offset[Index] = IWord;
|
||||
|
||||
// Round up to next available size of words:
|
||||
|
||||
while (OWord > *PAllocSizes) PAllocSizes++;
|
||||
|
||||
if (Index == LeafSize)
|
||||
{
|
||||
CurWord = Words[Index] = OWord;
|
||||
break;
|
||||
}
|
||||
// end of available sizes ?
|
||||
|
||||
if (*PAllocSizes == TERMINATOR)
|
||||
{
|
||||
fprintf(stderr, "BUG, in %sPopToWords, sizes not big enough for object\n", TableName);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// Save words required and last word:
|
||||
|
||||
if (*PAllocSizes < MaxWords) { CurWord = Words[Index] = *PAllocSizes; }
|
||||
else { CurWord = Words[Index] = MaxWords; }
|
||||
|
||||
} // for each index
|
||||
|
||||
LastWords = TERMINATOR;
|
||||
|
||||
// Round up to largest size in each group of malloc sizes:
|
||||
|
||||
for (ii = LeafSize; ii > 0; ii--)
|
||||
{
|
||||
if (LastWords > (Words[ii] - ii)) LastWords = Offset[ii];
|
||||
else Offset[ii] = LastWords;
|
||||
}
|
||||
|
||||
// Print the PopToWords[] table:
|
||||
|
||||
fprintf(fd,"\n//\tobject uses %d words\n", CurWord);
|
||||
fprintf(fd,"//\t%s = %d\n", TableSize, LeafSize);
|
||||
|
||||
fprintf(fd,"const uint8_t\n");
|
||||
fprintf(fd,"%sPopToWords[%s + 1] =\n", TableName, TableSize);
|
||||
fprintf(fd,"{\n\t 0,");
|
||||
|
||||
for (ii = 1; ii <= LeafSize; ii++)
|
||||
{
|
||||
|
||||
// 8 columns per line, starting with 1:
|
||||
|
||||
if ((ii % 8) == 1) fprintf(fd,"\n\t");
|
||||
|
||||
fprintf(fd,"%2d", Words[ii]);
|
||||
|
||||
// If not last number place comma:
|
||||
|
||||
if (ii != LeafSize) fprintf(fd,", ");
|
||||
}
|
||||
fprintf(fd,"\n};\n");
|
||||
|
||||
// Print the Offset table if needed:
|
||||
|
||||
if (! ValueBytes) return;
|
||||
|
||||
fprintf(fd,"const uint8_t\n");
|
||||
fprintf(fd,"%sOffset[%s + 1] =\n", TableName, TableSize);
|
||||
fprintf(fd,"{\n");
|
||||
fprintf(fd,"\t 0,");
|
||||
|
||||
for (ii = 1; ii <= LeafSize; ii++)
|
||||
{
|
||||
if ((ii % 8) == 1) fprintf(fd,"\n\t");
|
||||
|
||||
fprintf(fd,"%2d", Offset[ii]);
|
||||
|
||||
if (ii != LeafSize) fprintf(fd,", ");
|
||||
}
|
||||
fprintf(fd,"\n};\n");
|
||||
|
||||
} // GenTable()
|
||||
|
||||
|
||||
// ****************************************************************************
|
||||
// M A I N
|
||||
|
||||
FUNCTION int main()
|
||||
{
|
||||
int ii;
|
||||
|
||||
#ifdef JUDY1
|
||||
char *fname = "Judy1Tables.c";
|
||||
#else
|
||||
char *fname = "JudyLTables.c";
|
||||
#endif
|
||||
|
||||
if ((fd = fopen(fname, "w")) == NULL){
|
||||
perror("FATAL ERROR: could not write to Judy[1L]Tables.c file\n");
|
||||
return (-1);
|
||||
}
|
||||
|
||||
|
||||
fprintf(fd,"// @(#) From generation tool: $Revision$ $Source$\n");
|
||||
fprintf(fd,"//\n\n");
|
||||
|
||||
|
||||
// ================================ Judy1 =================================
|
||||
#ifdef JUDY1
|
||||
|
||||
fprintf(fd,"#include \"Judy1.h\"\n");
|
||||
|
||||
fprintf(fd,"// Leave the malloc() sizes readable in the binary (via "
|
||||
"strings(1)):\n");
|
||||
fprintf(fd,"const char * Judy1MallocSizes = \"Judy1MallocSizes =");
|
||||
|
||||
for (ii = 0; AllocSizes[ii] != TERMINATOR; ii++)
|
||||
fprintf(fd," %d,", AllocSizes[ii]);
|
||||
|
||||
#ifndef JU_64BIT
|
||||
fprintf(fd," Leaf1 = %d\";\n\n", cJ1_LEAF1_MAXPOP1);
|
||||
#else
|
||||
fprintf(fd,"\";\n\n"); // no Leaf1 in this case.
|
||||
#endif
|
||||
|
||||
// ================================ 32 bit ================================
|
||||
#ifndef JU_64BIT
|
||||
|
||||
GenTable("j__1_BranchBJP","cJU_BITSPERSUBEXPB", 8, cJU_BITSPERSUBEXPB,0,0);
|
||||
|
||||
GenTable("j__1_Leaf1", "cJ1_LEAF1_MAXPOP1", 1, cJ1_LEAF1_MAXPOP1, 0, 0);
|
||||
GenTable("j__1_Leaf2", "cJ1_LEAF2_MAXPOP1", 2, cJ1_LEAF2_MAXPOP1, 0, 0);
|
||||
GenTable("j__1_Leaf3", "cJ1_LEAF3_MAXPOP1", 3, cJ1_LEAF3_MAXPOP1, 0, 0);
|
||||
GenTable("j__1_LeafW", "cJ1_LEAFW_MAXPOP1", 4, cJ1_LEAFW_MAXPOP1, 0, 1);
|
||||
|
||||
#endif
|
||||
|
||||
// ================================ 64 bit ================================
|
||||
#ifdef JU_64BIT
|
||||
GenTable("j__1_BranchBJP","cJU_BITSPERSUBEXPB",16, cJU_BITSPERSUBEXPB,0,0);
|
||||
|
||||
GenTable("j__1_Leaf2", "cJ1_LEAF2_MAXPOP1", 2, cJ1_LEAF2_MAXPOP1, 0, 0);
|
||||
GenTable("j__1_Leaf3", "cJ1_LEAF3_MAXPOP1", 3, cJ1_LEAF3_MAXPOP1, 0, 0);
|
||||
GenTable("j__1_Leaf4", "cJ1_LEAF4_MAXPOP1", 4, cJ1_LEAF4_MAXPOP1, 0, 0);
|
||||
GenTable("j__1_Leaf5", "cJ1_LEAF5_MAXPOP1", 5, cJ1_LEAF5_MAXPOP1, 0, 0);
|
||||
GenTable("j__1_Leaf6", "cJ1_LEAF6_MAXPOP1", 6, cJ1_LEAF6_MAXPOP1, 0, 0);
|
||||
GenTable("j__1_Leaf7", "cJ1_LEAF7_MAXPOP1", 7, cJ1_LEAF7_MAXPOP1, 0, 0);
|
||||
GenTable("j__1_LeafW", "cJ1_LEAFW_MAXPOP1", 8, cJ1_LEAFW_MAXPOP1, 0, 1);
|
||||
#endif
|
||||
#endif // JUDY1
|
||||
|
||||
|
||||
// ================================ JudyL =================================
|
||||
#ifdef JUDYL
|
||||
|
||||
fprintf(fd,"#include \"JudyL.h\"\n");
|
||||
|
||||
fprintf(fd,"// Leave the malloc() sizes readable in the binary (via "
|
||||
"strings(1)):\n");
|
||||
fprintf(fd,"const char * JudyLMallocSizes = \"JudyLMallocSizes =");
|
||||
|
||||
for (ii = 0; AllocSizes[ii] != TERMINATOR; ii++)
|
||||
fprintf(fd," %d,", AllocSizes[ii]);
|
||||
|
||||
fprintf(fd," Leaf1 = %ld\";\n\n", (Word_t)cJL_LEAF1_MAXPOP1);
|
||||
|
||||
#ifndef JU_64BIT
|
||||
// ================================ 32 bit ================================
|
||||
GenTable("j__L_BranchBJP","cJU_BITSPERSUBEXPB", 8, cJU_BITSPERSUBEXPB, 0,0);
|
||||
|
||||
GenTable("j__L_Leaf1", "cJL_LEAF1_MAXPOP1", 1, cJL_LEAF1_MAXPOP1, BPW,0);
|
||||
GenTable("j__L_Leaf2", "cJL_LEAF2_MAXPOP1", 2, cJL_LEAF2_MAXPOP1, BPW,0);
|
||||
GenTable("j__L_Leaf3", "cJL_LEAF3_MAXPOP1", 3, cJL_LEAF3_MAXPOP1, BPW,0);
|
||||
GenTable("j__L_LeafW", "cJL_LEAFW_MAXPOP1", 4, cJL_LEAFW_MAXPOP1, BPW,1);
|
||||
GenTable("j__L_LeafV", "cJU_BITSPERSUBEXPL", 4, cJU_BITSPERSUBEXPL, 0,0);
|
||||
#endif // 32 BIT
|
||||
|
||||
#ifdef JU_64BIT
|
||||
// ================================ 64 bit ================================
|
||||
GenTable("j__L_BranchBJP","cJU_BITSPERSUBEXPB",16, cJU_BITSPERSUBEXPB, 0,0);
|
||||
|
||||
GenTable("j__L_Leaf1", "cJL_LEAF1_MAXPOP1", 1, cJL_LEAF1_MAXPOP1, BPW,0);
|
||||
GenTable("j__L_Leaf2", "cJL_LEAF2_MAXPOP1", 2, cJL_LEAF2_MAXPOP1, BPW,0);
|
||||
GenTable("j__L_Leaf3", "cJL_LEAF3_MAXPOP1", 3, cJL_LEAF3_MAXPOP1, BPW,0);
|
||||
GenTable("j__L_Leaf4", "cJL_LEAF4_MAXPOP1", 4, cJL_LEAF4_MAXPOP1, BPW,0);
|
||||
GenTable("j__L_Leaf5", "cJL_LEAF5_MAXPOP1", 5, cJL_LEAF5_MAXPOP1, BPW,0);
|
||||
GenTable("j__L_Leaf6", "cJL_LEAF6_MAXPOP1", 6, cJL_LEAF6_MAXPOP1, BPW,0);
|
||||
GenTable("j__L_Leaf7", "cJL_LEAF7_MAXPOP1", 7, cJL_LEAF7_MAXPOP1, BPW,0);
|
||||
GenTable("j__L_LeafW", "cJL_LEAFW_MAXPOP1", 8, cJL_LEAFW_MAXPOP1, BPW,1);
|
||||
GenTable("j__L_LeafV", "cJU_BITSPERSUBEXPL", 8, cJU_BITSPERSUBEXPL, 0,0);
|
||||
#endif // 64 BIT
|
||||
|
||||
#endif // JUDYL
|
||||
fclose(fd);
|
||||
|
||||
return(0);
|
||||
|
||||
} // main()
|
6
dlls/arrayx/Judy-1.0.1/src/JudyCommon/Makefile.am
Normal file
6
dlls/arrayx/Judy-1.0.1/src/JudyCommon/Makefile.am
Normal file
|
@ -0,0 +1,6 @@
|
|||
INCLUDES = -I. -I..
|
||||
AM_CFLAGS = @CFLAGS@ @WARN_CFLAGS@
|
||||
|
||||
noinst_LTLIBRARIES = libJudyMalloc.la
|
||||
|
||||
libJudyMalloc_la_SOURCES = JudyMalloc.c
|
430
dlls/arrayx/Judy-1.0.1/src/JudyCommon/Makefile.in
Normal file
430
dlls/arrayx/Judy-1.0.1/src/JudyCommon/Makefile.in
Normal file
|
@ -0,0 +1,430 @@
|
|||
# Makefile.in generated by automake 1.9.3 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
# 2003, 2004 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
|
||||
SOURCES = $(libJudyMalloc_la_SOURCES)
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
top_builddir = ../..
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
INSTALL = @INSTALL@
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
subdir = src/JudyCommon
|
||||
DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_HEADER = $(top_builddir)/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
LTLIBRARIES = $(noinst_LTLIBRARIES)
|
||||
libJudyMalloc_la_LIBADD =
|
||||
am_libJudyMalloc_la_OBJECTS = JudyMalloc.lo
|
||||
libJudyMalloc_la_OBJECTS = $(am_libJudyMalloc_la_OBJECTS)
|
||||
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
|
||||
depcomp = $(SHELL) $(top_srcdir)/depcomp
|
||||
am__depfiles_maybe = depfiles
|
||||
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
|
||||
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \
|
||||
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
|
||||
$(AM_CFLAGS) $(CFLAGS)
|
||||
CCLD = $(CC)
|
||||
LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
|
||||
$(AM_LDFLAGS) $(LDFLAGS) -o $@
|
||||
SOURCES = $(libJudyMalloc_la_SOURCES)
|
||||
DIST_SOURCES = $(libJudyMalloc_la_SOURCES)
|
||||
ETAGS = etags
|
||||
CTAGS = ctags
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AMDEP_FALSE = @AMDEP_FALSE@
|
||||
AMDEP_TRUE = @AMDEP_TRUE@
|
||||
AMTAR = @AMTAR@
|
||||
AR = @AR@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CXX = @CXX@
|
||||
CXXCPP = @CXXCPP@
|
||||
CXXDEPMODE = @CXXDEPMODE@
|
||||
CXXFLAGS = @CXXFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
ECHO = @ECHO@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
F77 = @F77@
|
||||
FFLAGS = @FFLAGS@
|
||||
FLAVOR = @FLAVOR@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
LD = @LD@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LN_S = @LN_S@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAINT = @MAINT@
|
||||
MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
|
||||
MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
OBJEXT = @OBJEXT@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
RANLIB = @RANLIB@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
STRIP = @STRIP@
|
||||
VERSION = @VERSION@
|
||||
VERSION_INFO = @VERSION_INFO@
|
||||
WARN_CFLAGS = @WARN_CFLAGS@
|
||||
ac_ct_AR = @ac_ct_AR@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_CXX = @ac_ct_CXX@
|
||||
ac_ct_F77 = @ac_ct_F77@
|
||||
ac_ct_LD = @ac_ct_LD@
|
||||
ac_ct_RANLIB = @ac_ct_RANLIB@
|
||||
ac_ct_STRIP = @ac_ct_STRIP@
|
||||
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
|
||||
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
|
||||
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
|
||||
am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
build_cpu = @build_cpu@
|
||||
build_os = @build_os@
|
||||
build_vendor = @build_vendor@
|
||||
datadir = @datadir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host = @host@
|
||||
host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
host_os = @host_os@
|
||||
host_vendor = @host_vendor@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target_alias = @target_alias@
|
||||
INCLUDES = -I. -I..
|
||||
AM_CFLAGS = @CFLAGS@ @WARN_CFLAGS@
|
||||
noinst_LTLIBRARIES = libJudyMalloc.la
|
||||
libJudyMalloc_la_SOURCES = JudyMalloc.c
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .c .lo .o .obj
|
||||
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
|
||||
&& exit 0; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/JudyCommon/Makefile'; \
|
||||
cd $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu src/JudyCommon/Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
clean-noinstLTLIBRARIES:
|
||||
-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
|
||||
@list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
|
||||
dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
|
||||
test "$$dir" != "$$p" || dir=.; \
|
||||
echo "rm -f \"$${dir}/so_locations\""; \
|
||||
rm -f "$${dir}/so_locations"; \
|
||||
done
|
||||
libJudyMalloc.la: $(libJudyMalloc_la_OBJECTS) $(libJudyMalloc_la_DEPENDENCIES)
|
||||
$(LINK) $(libJudyMalloc_la_LDFLAGS) $(libJudyMalloc_la_OBJECTS) $(libJudyMalloc_la_LIBADD) $(LIBS)
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.$(OBJEXT)
|
||||
|
||||
distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/JudyMalloc.Plo@am__quote@
|
||||
|
||||
.c.o:
|
||||
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
|
||||
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
|
||||
|
||||
.c.obj:
|
||||
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
|
||||
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
|
||||
|
||||
.c.lo:
|
||||
@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
|
||||
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
|
||||
distclean-libtool:
|
||||
-rm -f libtool
|
||||
uninstall-info-am:
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
mkid -fID $$unique
|
||||
tags: TAGS
|
||||
|
||||
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
|
||||
test -n "$$unique" || unique=$$empty_fix; \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
$$tags $$unique; \
|
||||
fi
|
||||
ctags: CTAGS
|
||||
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|
||||
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
||||
$$tags $$unique
|
||||
|
||||
GTAGS:
|
||||
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||
&& cd $(top_srcdir) \
|
||||
&& gtags -i $(GTAGS_ARGS) $$here
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
|
||||
list='$(DISTFILES)'; for file in $$list; do \
|
||||
case $$file in \
|
||||
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
|
||||
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
|
||||
esac; \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
|
||||
dir="/$$dir"; \
|
||||
$(mkdir_p) "$(distdir)$$dir"; \
|
||||
else \
|
||||
dir=''; \
|
||||
fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
|
||||
fi; \
|
||||
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
|
||||
else \
|
||||
test -f $(distdir)/$$file \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
check-am: all-am
|
||||
check: check-am
|
||||
all-am: Makefile $(LTLIBRARIES)
|
||||
installdirs:
|
||||
install: install-am
|
||||
install-exec: install-exec-am
|
||||
install-data: install-data-am
|
||||
uninstall: uninstall-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-am
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
`test -z '$(STRIP)' || \
|
||||
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-am
|
||||
|
||||
clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
|
||||
mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -rf ./$(DEPDIR)
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-compile distclean-generic \
|
||||
distclean-libtool distclean-tags
|
||||
|
||||
dvi: dvi-am
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-am
|
||||
|
||||
info: info-am
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am:
|
||||
|
||||
install-exec-am:
|
||||
|
||||
install-info: install-info-am
|
||||
|
||||
install-man:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
-rm -rf ./$(DEPDIR)
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
|
||||
mostlyclean-libtool
|
||||
|
||||
pdf: pdf-am
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-am
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am: uninstall-info-am
|
||||
|
||||
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
|
||||
clean-libtool clean-noinstLTLIBRARIES ctags distclean \
|
||||
distclean-compile distclean-generic distclean-libtool \
|
||||
distclean-tags distdir dvi dvi-am html html-am info info-am \
|
||||
install install-am install-data install-data-am install-exec \
|
||||
install-exec-am install-info install-info-am install-man \
|
||||
install-strip installcheck installcheck-am installdirs \
|
||||
maintainer-clean maintainer-clean-generic mostlyclean \
|
||||
mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
|
||||
pdf pdf-am ps ps-am tags uninstall uninstall-am \
|
||||
uninstall-info-am
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
66
dlls/arrayx/Judy-1.0.1/src/JudyCommon/README
Normal file
66
dlls/arrayx/Judy-1.0.1/src/JudyCommon/README
Normal file
|
@ -0,0 +1,66 @@
|
|||
# @(#) $Revision$ $Source$
|
||||
#
|
||||
# This tree contains sources for Judy common files. These include shared
|
||||
# header files, ifdef'd common source files for Judy1/JudyL functions, and
|
||||
# shared utility functions.
|
||||
|
||||
|
||||
# SHARED HEADER FILES:
|
||||
|
||||
JudyPrivate.h global private header file for all Judy internal
|
||||
sources
|
||||
|
||||
JudyPrivateBranch.h global private header file for all Judy internal
|
||||
sources, specifically for branch-related
|
||||
declarations
|
||||
|
||||
JudyPrivate1L.h global private header file for Judy internal
|
||||
sources that generate both Judy1 and JudyL
|
||||
object files, via -DJUDY1 or -DJUDYL, using
|
||||
common names for JP Types, plus some other
|
||||
generic declarations too
|
||||
|
||||
|
||||
# IFDEF'D COMMON SOURCE FILES FOR JUDY1/JUDYL FUNCTIONS:
|
||||
#
|
||||
# See Judy(3C) manual entry about these sources for exported functions.
|
||||
|
||||
JudyGet.c common code for Judy1Test() and JudyLGet()
|
||||
JudyIns.c common code for Judy1Set() and JudyLIns()
|
||||
JudyDel.c common code for Judy1Unset() and JudyLDel()
|
||||
JudyFirst.c common code for Judy1 and JudyL
|
||||
JudyPrevNext.c common code for Judy1, JudyL; Judy*Prev(), Judy*Next()
|
||||
JudyPrevNextEmpty.c common code for Judy1, JudyL; Judy*PrevEmpty(),
|
||||
Judy*NextEmpty()
|
||||
JudyCount.c common code for Judy1 and JudyL
|
||||
JudyByCount.c common code for Judy1 and JudyL
|
||||
JudyFreeArray.c common code for Judy1 and JudyL
|
||||
JudyMemUsed.c common code for Judy1 and JudyL
|
||||
JudyMemActive.c common code for Judy1 and JudyL
|
||||
|
||||
JudyInsArray.c common code for Judy1 and JudyL
|
||||
|
||||
|
||||
# SHARED UTILITY FUNCTIONS:
|
||||
|
||||
JudyMalloc.c source file
|
||||
|
||||
JudyTables.c static definitions of translation tables; a main
|
||||
program is #ifdef-embedded to generate these tables
|
||||
|
||||
# Common code for Judy1 and JudyL that is compiled twice with -DJUDY1 or
|
||||
# -DJUDYL:
|
||||
|
||||
JudyInsertBranch.c insert a linear branch between a branch and a leaf
|
||||
JudyCreateBranch.c create and copy all types of branches
|
||||
|
||||
JudyCascade.c handles overflow insertion of an Index, including
|
||||
common Decode bytes and branch creation
|
||||
|
||||
JudyDecascade.c handles underflow deletion of an Index, including
|
||||
common Decode bytes and branch deletion
|
||||
|
||||
JudyMallocIF.c a Judy malloc/free interface, for statistics and
|
||||
debugging
|
||||
|
||||
JudyPrintJP.c debug/trace code #included in other *.c files
|
771
dlls/arrayx/Judy-1.0.1/src/JudyHS/JudyHS.c
Normal file
771
dlls/arrayx/Judy-1.0.1/src/JudyHS/JudyHS.c
Normal file
|
@ -0,0 +1,771 @@
|
|||
// @(#) $Revision$ $Source: /judy/src/JudyHS/JudyHS.c
|
||||
//=======================================================================
|
||||
// Author Douglas L. Baskins, Dec 2003.
|
||||
// Permission to use this code is freely granted, provided that this
|
||||
// statement is retained.
|
||||
// email - doug@sourcejudy.com -or- dougbaskins@yahoo.com
|
||||
//=======================================================================
|
||||
|
||||
#include <string.h> // for memcmp(), memcpy()
|
||||
|
||||
#include <Judy.h> // for JudyL* routines/macros
|
||||
|
||||
/*
|
||||
This routine is a very fast "string" version of an ADT that stores
|
||||
(JudyHSIns()), retrieves (JudyHSGet()), deletes (JudyHSDel()) and
|
||||
frees the entire ADT (JudyHSFreeArray()) strings. It uses the "Judy
|
||||
arrays" JudyL() API as the main workhorse. The length of the string
|
||||
is included in the calling parameters so that strings with embedded
|
||||
\0s can be used. The string lengths can be from 0 bytes to whatever
|
||||
malloc() can handle (~2GB).
|
||||
|
||||
Compile:
|
||||
|
||||
cc -O JudyHS.c -c needs to link with -lJudy (libJudy.a)
|
||||
|
||||
Note: in gcc version 3.3.1, -O2 generates faster code than -O
|
||||
Note: in gcc version 3.3.2, -O3 generates faster code than -O2
|
||||
|
||||
NOTES:
|
||||
|
||||
1) There may be some performance issues with 64 bit machines, because I
|
||||
have not characterized that it yet.
|
||||
|
||||
2) It appears that a modern CPU (>2Ghz) that the instruction times are
|
||||
much faster that a RAM access, so building up a word from bytes takes
|
||||
no longer that a whole word access. I am taking advantage of this to
|
||||
make this code endian neutral. A side effect of this is strings do
|
||||
not need to be aligned, nor tested to be on to a word boundry. In
|
||||
older and in slow (RISC) machines, this may be a performance issue.
|
||||
I have given up trying to optimize for machines that have very slow
|
||||
mpy, mod, variable shifts and call returns.
|
||||
|
||||
3) JudyHS is very scalable from 1 string to billions (with enough RAM).
|
||||
The memory usage is also scales with population. I have attempted to
|
||||
combine the best characteristics of JudyL arrays with Hashing methods
|
||||
and well designed modern processors (such as the 1.3Ghz Intel
|
||||
Centrino this is being written on).
|
||||
|
||||
HOW JudyHS WORKS: ( 4[8] means 4 bytes in 32 bit machine and 8 in 64)
|
||||
|
||||
A) A JudyL array is used to separate strings of equal lengths into
|
||||
their own structures (a different hash table is used for each length
|
||||
of string). The additional time overhead is very near zero because
|
||||
of the CPU cache. The space efficiency is improved because the
|
||||
length need not be stored with the string (ls_t). The "JLHash" ADT
|
||||
in the test program "StringCompare" is verification of both these
|
||||
assumptions.
|
||||
|
||||
B) A 32 bit hash value is produced from the string. Many thanks to
|
||||
the Internet and the author (Bob Jenkins) for coming up with a very
|
||||
good and fast universal string hash. Next the 32 bit hash number is
|
||||
used as an Index to another JudyL array. Notice that one (1) JudyL
|
||||
array is used as a hash table per each string length. If there are
|
||||
no hash collisions (normally) then the string is copied to a
|
||||
structure (ls_t) along with room for storing a Value. A flag is
|
||||
added to the pointer to note it is pointing to a ls_t structure.
|
||||
Since the lengths of the strings are the same, there is no need to
|
||||
stored length of string in the ls_t structure. This saves about a
|
||||
word per string of memory.
|
||||
|
||||
C) When there is a hashing collision (very rare), a JudyL array is
|
||||
used to decode the next 4[8] bytes of the string. That is, the next
|
||||
4[8] bytes of the string are used as the Index. This process is
|
||||
repeated until the remaining string is unique. The remaining string
|
||||
(if any) is stored in a (now smaller) ls_t structure. If the
|
||||
remaining string is less or equal to 4[8] bytes, then the ls_t
|
||||
structure is not needed and the Value area in the JudyL array is
|
||||
used. A compile option -DDONOTUSEHASH is available to test this
|
||||
structure without using hashing (only the JudyL tree is used). This
|
||||
is equivalent to having all strings hashed to the same bucket. The
|
||||
speed is still better than all other tree based ADTs I have tested.
|
||||
An added benefit of this is a very fast "hash collision" resolving.
|
||||
It could foil hackers that exploit the slow synonym (linked-list)
|
||||
collision handling property used with most hashing algorithms. If
|
||||
this is not a necessary property, then a simpler ADT "JLHash" that is
|
||||
documented the the test program "StringCompare.c" may be used with a
|
||||
little loss of memory efficiency (because it includes the string
|
||||
length with the ls_t structure). JudyHS was written to be the
|
||||
fastest, very scalable, memory efficient, general purpose string ADT
|
||||
possible. (However, I would like to eat those words someday). (dlb)
|
||||
|
||||
*/
|
||||
|
||||
#ifdef EXAMPLE_CODE
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <Judy.h>
|
||||
|
||||
//#include "JudyHS.h" // for Judy.h without JudyHS*()
|
||||
|
||||
// By Doug Baskins Apr 2004 - for JudyHS man page
|
||||
|
||||
#define MAXLINE 1000000 /* max length of line */
|
||||
char Index[MAXLINE]; // string to check
|
||||
|
||||
int // Usage: CheckDupLines < file
|
||||
main()
|
||||
{
|
||||
Pvoid_t PJArray = (PWord_t)NULL; // Judy array.
|
||||
PWord_t PValue; // ^ Judy array element.
|
||||
Word_t Bytes; // size of JudyHS array.
|
||||
Word_t LineNumb = 0; // current line number
|
||||
Word_t Dups = 0; // number of duplicate lines
|
||||
|
||||
while (fgets(Index, MAXLINE, stdin) != (char *)NULL)
|
||||
{
|
||||
LineNumb++; // line number
|
||||
|
||||
// store string into array
|
||||
JHSI(PValue, PJArray, Index, strlen(Index));
|
||||
if (*PValue) // check if duplicate
|
||||
{
|
||||
Dups++; // count duplicates
|
||||
printf("Duplicate lines %lu:%lu:%s", *PValue, LineNumb, Index);
|
||||
}
|
||||
else
|
||||
{
|
||||
*PValue = LineNumb; // store Line number
|
||||
}
|
||||
}
|
||||
printf("%lu Duplicates, free JudyHS array of %lu Lines\n",
|
||||
Dups, LineNumb - Dups);
|
||||
JHSFA(Bytes, PJArray); // free array
|
||||
printf("The JudyHS array allocated %lu bytes of memory\n", Bytes);
|
||||
return (0);
|
||||
}
|
||||
#endif // EXAMPLE_CODE
|
||||
|
||||
// Note: Use JLAP_INVALID, which is non-zero, to mark pointers to a ls_t
|
||||
// This makes it compatable with previous versions of JudyL()
|
||||
|
||||
#define IS_PLS(PLS) (((Word_t) (PLS)) & JLAP_INVALID)
|
||||
#define CLEAR_PLS(PLS) (((Word_t) (PLS)) & (~JLAP_INVALID))
|
||||
#define SET_PLS(PLS) (((Word_t) (PLS)) | JLAP_INVALID)
|
||||
|
||||
#define WORDSIZE (sizeof(Word_t))
|
||||
|
||||
// this is the struct used for "leaf" strings. Note that
|
||||
// the Value is followed by a "variable" length ls_String array.
|
||||
//
|
||||
typedef struct L_EAFSTRING
|
||||
{
|
||||
Word_t ls_Value; // Value area (cannot change size)
|
||||
uint8_t ls_String[WORDSIZE]; // to fill out to a Word_t size
|
||||
} ls_t , *Pls_t;
|
||||
|
||||
#define LS_STRUCTOVD (sizeof(ls_t) - WORDSIZE)
|
||||
|
||||
// Calculate size of ls_t including the string of length of LEN.
|
||||
//
|
||||
#define LS_WORDLEN(LEN) (((LEN) + LS_STRUCTOVD + WORDSIZE - 1) / WORDSIZE)
|
||||
|
||||
// Copy from 0..4[8] bytes from string to a Word_t
|
||||
// NOTE: the copy in in little-endian order to take advantage of improved
|
||||
// memory efficiency of JudyLIns() with smaller numbers
|
||||
//
|
||||
#define COPYSTRING4toWORD(WORD,STR,LEN) \
|
||||
{ \
|
||||
WORD = 0; \
|
||||
switch(LEN) \
|
||||
{ \
|
||||
default: /* four and greater */ \
|
||||
case 4: \
|
||||
WORD += (Word_t)(((uint8_t *)(STR))[3] << 24); \
|
||||
case 3: \
|
||||
WORD += (Word_t)(((uint8_t *)(STR))[2] << 16); \
|
||||
case 2: \
|
||||
WORD += (Word_t)(((uint8_t *)(STR))[1] << 8); \
|
||||
case 1: \
|
||||
WORD += (Word_t)(((uint8_t *)(STR))[0]); \
|
||||
case 0: break; \
|
||||
} \
|
||||
}
|
||||
|
||||
#ifdef JU_64BIT
|
||||
|
||||
// copy from 0..8 bytes from string to Word_t
|
||||
//
|
||||
#define COPYSTRING8toWORD(WORD,STR,LEN) \
|
||||
{ \
|
||||
WORD = 0UL; \
|
||||
switch(LEN) \
|
||||
{ \
|
||||
default: /* eight and greater */ \
|
||||
case 8: \
|
||||
WORD += ((Word_t)((uint8_t *)(STR))[7] << 56); \
|
||||
case 7: \
|
||||
WORD += ((Word_t)((uint8_t *)(STR))[6] << 48); \
|
||||
case 6: \
|
||||
WORD += ((Word_t)((uint8_t *)(STR))[5] << 40); \
|
||||
case 5: \
|
||||
WORD += ((Word_t)((uint8_t *)(STR))[4] << 32); \
|
||||
case 4: \
|
||||
WORD += ((Word_t)((uint8_t *)(STR))[3] << 24); \
|
||||
case 3: \
|
||||
WORD += ((Word_t)((uint8_t *)(STR))[2] << 16); \
|
||||
case 2: \
|
||||
WORD += ((Word_t)((uint8_t *)(STR))[1] << 8); \
|
||||
case 1: \
|
||||
WORD += ((Word_t)((uint8_t *)(STR))[0]); \
|
||||
case 0: break; \
|
||||
} \
|
||||
}
|
||||
|
||||
#define COPYSTRINGtoWORD COPYSTRING8toWORD
|
||||
|
||||
#else // JU_32BIT
|
||||
|
||||
#define COPYSTRINGtoWORD COPYSTRING4toWORD
|
||||
|
||||
#endif // JU_32BIT
|
||||
|
||||
// set JError_t locally
|
||||
|
||||
#define JU_SET_ERRNO(PJERROR, JERRNO) \
|
||||
{ \
|
||||
if (PJERROR != (PJError_t) NULL) \
|
||||
{ \
|
||||
if (JERRNO) \
|
||||
JU_ERRNO(PJError) = (JERRNO); \
|
||||
JU_ERRID(PJERROR) = __LINE__; \
|
||||
} \
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// This routine must hash string to 24..32 bits. The "goodness" of
|
||||
// the hash is not as important as its speed.
|
||||
//=======================================================================
|
||||
|
||||
// hash to no more than 32 bits
|
||||
|
||||
// extern Word_t gHmask; for hash bits experiments
|
||||
|
||||
#define JUDYHASHSTR(HVALUE,STRING,LENGTH) \
|
||||
{ \
|
||||
uint8_t *p_ = (uint8_t *)(STRING); \
|
||||
uint8_t *q_ = p_ + (LENGTH); \
|
||||
uint32_t c_ = 0; \
|
||||
for (; p_ != q_; ++p_) \
|
||||
{ \
|
||||
c_ = (c_ * 31) + *p_; \
|
||||
} \
|
||||
/* c_ &= gHmask; see above */ \
|
||||
(HVALUE) = c_; \
|
||||
}
|
||||
|
||||
// Find String of Len in JudyHS structure, return pointer to associated Value
|
||||
|
||||
PPvoid_t
|
||||
JudyHSGet(Pcvoid_t PArray, // pointer (^) to structure
|
||||
void * Str, // pointer to string
|
||||
Word_t Len // length of string
|
||||
)
|
||||
{
|
||||
uint8_t *String = (uint8_t *)Str;
|
||||
PPvoid_t PPValue; // pointer to Value
|
||||
Word_t Index; // 4[8] bytes of String
|
||||
|
||||
JLG(PPValue, PArray, Len); // find hash table for strings of Len
|
||||
if (PPValue == (PPvoid_t) NULL)
|
||||
return ((PPvoid_t) NULL); // no strings of this Len
|
||||
|
||||
// check for caller error (null pointer)
|
||||
//
|
||||
if ((String == (void *) NULL) && (Len != 0))
|
||||
return ((PPvoid_t) NULL); // avoid null-pointer dereference
|
||||
|
||||
#ifndef DONOTUSEHASH
|
||||
if (Len > WORDSIZE) // Hash table not necessary with short
|
||||
{
|
||||
uint32_t HValue; // hash of input string
|
||||
JUDYHASHSTR(HValue, String, Len); // hash to no more than 32 bits
|
||||
JLG(PPValue, *PPValue, (Word_t)HValue); // get ^ to hash bucket
|
||||
if (PPValue == (PPvoid_t) NULL)
|
||||
return ((PPvoid_t) NULL); // no entry in Hash table
|
||||
}
|
||||
#endif // DONOTUSEHASH
|
||||
|
||||
/*
|
||||
Each JudyL array decodes 4[8] bytes of the string. Since the hash
|
||||
collisions occur very infrequently, the performance is not important.
|
||||
However, even if the Hash code is not used this method still is
|
||||
significantly faster than common tree methods (AVL, Red-Black, Splay,
|
||||
b-tree, etc..). You can compare it yourself with #define DONOTUSEHASH
|
||||
1 or putting -DDONOTUSEHASH in the cc line. Use the "StringCompare.c"
|
||||
code to compare (9Dec2003 dlb).
|
||||
*/
|
||||
while (Len > WORDSIZE) // traverse tree of JudyL arrays
|
||||
{
|
||||
if (IS_PLS(*PPValue)) // ^ to JudyL array or ls_t struct?
|
||||
{
|
||||
Pls_t Pls; // ls_t struct, termination of tree
|
||||
Pls = (Pls_t) CLEAR_PLS(*PPValue); // remove flag from ^
|
||||
|
||||
// if remaining string matches, return ^ to Value, else NULL
|
||||
|
||||
if (memcmp(String, Pls->ls_String, Len) == 0)
|
||||
return ((PPvoid_t) (&(Pls->ls_Value)));
|
||||
else
|
||||
return ((PPvoid_t) NULL); // string does not match
|
||||
}
|
||||
else
|
||||
{
|
||||
COPYSTRINGtoWORD(Index, String, WORDSIZE);
|
||||
|
||||
JLG(PPValue, *PPValue, Index); // decode next 4[8] bytes
|
||||
if (PPValue == (PPvoid_t) NULL) // if NULL array, bail out
|
||||
return ((PPvoid_t) NULL); // string does not match
|
||||
|
||||
String += WORDSIZE; // advance
|
||||
Len -= WORDSIZE;
|
||||
}
|
||||
}
|
||||
|
||||
// Get remaining 1..4[8] bytes left in string
|
||||
|
||||
COPYSTRINGtoWORD(Index, String, Len);
|
||||
JLG(PPValue, *PPValue, Index); // decode last 1-4[8] bytes
|
||||
return (PPValue);
|
||||
}
|
||||
|
||||
// Add string to a tree of JudyL arrays (all lengths must be same)
|
||||
|
||||
static PPvoid_t
|
||||
insStrJudyLTree(uint8_t * String, // string to add to tree of JudyL arrays
|
||||
Word_t Len, // length of string
|
||||
PPvoid_t PPValue, // pointer to root pointer
|
||||
PJError_t PJError // for returning error info
|
||||
)
|
||||
{
|
||||
Word_t Index; // next 4[8] bytes of String
|
||||
|
||||
while (Len > WORDSIZE) // add to JudyL tree
|
||||
{
|
||||
// CASE 1, pointer is to a NULL, make a new ls_t leaf
|
||||
|
||||
if (*PPValue == (Pvoid_t)NULL)
|
||||
{
|
||||
Pls_t Pls; // memory for a ls_t
|
||||
Pls = (Pls_t) JudyMalloc(LS_WORDLEN(Len));
|
||||
if (Pls == NULL)
|
||||
{
|
||||
JU_SET_ERRNO(PJError, JU_ERRNO_NOMEM);
|
||||
return (PPJERR);
|
||||
}
|
||||
Pls->ls_Value = 0; // clear Value word
|
||||
memcpy(Pls->ls_String, String, Len); // copy to new struct
|
||||
*PPValue = (Pvoid_t)SET_PLS(Pls); // mark pointer
|
||||
return ((PPvoid_t) (&Pls->ls_Value)); // return ^ to Value
|
||||
} // no exit here
|
||||
// CASE 2: is a ls_t, free (and shorten), then decode into JudyL tree
|
||||
|
||||
if (IS_PLS(*PPValue)) // pointer to a ls_t? (leaf)
|
||||
{
|
||||
Pls_t Pls; // ^ to ls_t
|
||||
uint8_t *String0; // ^ to string in ls_t
|
||||
Word_t Index0; // 4[8] bytes in string
|
||||
Word_t FreeLen; // length of ls_t
|
||||
PPvoid_t PPsplit;
|
||||
|
||||
FreeLen = LS_WORDLEN(Len); // length of ls_t
|
||||
|
||||
Pls = (Pls_t) CLEAR_PLS(*PPValue); // demangle ^ to ls_t
|
||||
String0 = Pls->ls_String;
|
||||
if (memcmp(String, String0, Len) == 0) // check if match?
|
||||
{
|
||||
return ((PPvoid_t) (&Pls->ls_Value)); // yes, duplicate
|
||||
}
|
||||
|
||||
*PPValue = NULL; // clear ^ to ls_t and make JudyL
|
||||
|
||||
// This do loop is technically not required, saves multiple JudyFree()
|
||||
// when storing already sorted strings into structure
|
||||
|
||||
do // decode next 4[8] bytes of string
|
||||
{ // with a JudyL array
|
||||
// Note: string0 is always aligned
|
||||
|
||||
COPYSTRINGtoWORD(Index0, String0, WORDSIZE);
|
||||
String0 += WORDSIZE;
|
||||
COPYSTRINGtoWORD(Index, String, WORDSIZE);
|
||||
String += WORDSIZE;
|
||||
Len -= WORDSIZE;
|
||||
PPsplit = PPValue; // save for split below
|
||||
PPValue = JudyLIns(PPValue, Index0, PJError);
|
||||
if (PPValue == PPJERR)
|
||||
{
|
||||
JU_SET_ERRNO(PJError, 0);
|
||||
return (PPJERR);
|
||||
}
|
||||
|
||||
} while ((Index0 == Index) && (Len > WORDSIZE));
|
||||
|
||||
// finish storing remainder of string that was in the ls_t
|
||||
|
||||
PPValue = insStrJudyLTree(String0, Len, PPValue, PJError);
|
||||
if (PPValue == PPJERR)
|
||||
{
|
||||
return (PPJERR);
|
||||
}
|
||||
// copy old Value to Value in new struct
|
||||
|
||||
*(PWord_t)PPValue = Pls->ls_Value;
|
||||
|
||||
// free the string buffer (ls_t)
|
||||
|
||||
JudyFree((Pvoid_t)Pls, FreeLen);
|
||||
PPValue = JudyLIns(PPsplit, Index, PJError);
|
||||
if (PPValue == PPJERR)
|
||||
{
|
||||
JU_SET_ERRNO(PJError, 0);
|
||||
return (PPValue);
|
||||
}
|
||||
|
||||
// finish remainder of newly inserted string
|
||||
|
||||
PPValue = insStrJudyLTree(String, Len, PPValue, PJError);
|
||||
return (PPValue);
|
||||
} // no exit here
|
||||
// CASE 3, more JudyL arrays, decode to next tree
|
||||
|
||||
COPYSTRINGtoWORD(Index, String, WORDSIZE);
|
||||
Len -= WORDSIZE;
|
||||
String += WORDSIZE;
|
||||
|
||||
PPValue = JudyLIns(PPValue, Index, PJError); // next 4[8] bytes
|
||||
if (PPValue == PPJERR)
|
||||
{
|
||||
JU_SET_ERRNO(PJError, 0);
|
||||
return (PPValue);
|
||||
}
|
||||
}
|
||||
// this is done outside of loop so "Len" can be an unsigned number
|
||||
|
||||
COPYSTRINGtoWORD(Index, String, Len);
|
||||
PPValue = JudyLIns(PPValue, Index, PJError); // remaining 4[8] bytes
|
||||
|
||||
return (PPValue);
|
||||
}
|
||||
|
||||
|
||||
// Insert string to JudyHS structure, return pointer to associated Value
|
||||
|
||||
PPvoid_t
|
||||
JudyHSIns(PPvoid_t PPArray, // ^ to JudyHashArray name
|
||||
void * Str, // pointer to string
|
||||
Word_t Len, // length of string
|
||||
PJError_t PJError // optional, for returning error info
|
||||
)
|
||||
{
|
||||
uint8_t * String = (uint8_t *)Str;
|
||||
PPvoid_t PPValue;
|
||||
|
||||
// string can only be NULL if Len is 0.
|
||||
|
||||
if ((String == (uint8_t *) NULL) && (Len != 0UL))
|
||||
{
|
||||
JU_SET_ERRNO(PJError, JU_ERRNO_NULLPINDEX);
|
||||
return (PPJERR);
|
||||
}
|
||||
JLG(PPValue, *PPArray, Len); // JudyL hash table for strings of Len
|
||||
if (PPValue == (PPvoid_t) NULL) // make new if missing, (very rare)
|
||||
{
|
||||
PPValue = JudyLIns(PPArray, Len, PJError);
|
||||
if (PPValue == PPJERR)
|
||||
{
|
||||
JU_SET_ERRNO(PJError, 0);
|
||||
return (PPJERR);
|
||||
}
|
||||
}
|
||||
#ifndef DONOTUSEHASH
|
||||
if (Len > WORDSIZE)
|
||||
{
|
||||
uint32_t HValue; // hash of input string
|
||||
JUDYHASHSTR(HValue, String, Len); // hash to no more than 32 bits
|
||||
PPValue = JudyLIns(PPValue, (Word_t)HValue, PJError);
|
||||
if (PPValue == PPJERR)
|
||||
{
|
||||
JU_SET_ERRNO(PJError, 0);
|
||||
return (PPJERR);
|
||||
}
|
||||
}
|
||||
#endif // DONOTUSEHASH
|
||||
|
||||
PPValue = insStrJudyLTree(String, Len, PPValue, PJError); // add string
|
||||
return (PPValue); // ^ to Value
|
||||
}
|
||||
|
||||
// Delete string from tree of JudyL arrays (all Lens must be same)
|
||||
|
||||
static int
|
||||
delStrJudyLTree(uint8_t * String, // delete from tree of JudyL arrays
|
||||
Word_t Len, // length of string
|
||||
PPvoid_t PPValue, // ^ to hash bucket
|
||||
PJError_t PJError // for returning error info
|
||||
)
|
||||
{
|
||||
PPvoid_t PPValueN; // next pointer
|
||||
Word_t Index;
|
||||
int Ret; // -1=failed, 1=success, 2=quit del
|
||||
|
||||
if (IS_PLS(*PPValue)) // is pointer to ls_t?
|
||||
{
|
||||
Pls_t Pls;
|
||||
Pls = (Pls_t) CLEAR_PLS(*PPValue); // demangle pointer
|
||||
JudyFree((Pvoid_t)Pls, LS_WORDLEN(Len)); // free the ls_t
|
||||
|
||||
*PPValue = (Pvoid_t)NULL; // clean pointer
|
||||
return (1); // successfully deleted
|
||||
}
|
||||
|
||||
if (Len > WORDSIZE) // delete from JudyL tree, not leaf
|
||||
{
|
||||
COPYSTRINGtoWORD(Index, String, WORDSIZE); // get Index
|
||||
JLG(PPValueN, *PPValue, Index); // get pointer to next JudyL array
|
||||
|
||||
String += WORDSIZE; // advance to next 4[8] bytes
|
||||
Len -= WORDSIZE;
|
||||
|
||||
Ret = delStrJudyLTree(String, Len, PPValueN, PJError);
|
||||
if (Ret != 1) return(Ret);
|
||||
|
||||
if (*PPValueN == (PPvoid_t) NULL)
|
||||
{
|
||||
// delete JudyL element from tree
|
||||
|
||||
Ret = JudyLDel(PPValue, Index, PJError);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
COPYSTRINGtoWORD(Index, String, Len); // get leaf element
|
||||
|
||||
// delete last 1-4[8] bytes from leaf element
|
||||
|
||||
Ret = JudyLDel(PPValue, Index, PJError);
|
||||
}
|
||||
return (Ret);
|
||||
}
|
||||
|
||||
// Delete string from JHS structure
|
||||
|
||||
int
|
||||
JudyHSDel(PPvoid_t PPArray, // ^ to JudyHashArray struct
|
||||
void * Str, // pointer to string
|
||||
Word_t Len, // length of string
|
||||
PJError_t PJError // optional, for returning error info
|
||||
)
|
||||
{
|
||||
uint8_t * String = (uint8_t *)Str;
|
||||
PPvoid_t PPBucket, PPHtble;
|
||||
int Ret; // return bool from Delete routine
|
||||
#ifndef DONOTUSEHASH
|
||||
uint32_t HValue = 0; // hash value of input string
|
||||
#endif // DONOTUSEHASH
|
||||
|
||||
if (PPArray == NULL)
|
||||
return (0); // no pointer, return not found
|
||||
|
||||
// This is a little slower than optimum method, but not much in new CPU
|
||||
// Verify that string is in the structure -- simplifies future assumptions
|
||||
|
||||
if (JudyHSGet(*PPArray, String, Len) == (PPvoid_t) NULL)
|
||||
return (0); // string not found, return
|
||||
|
||||
// string is in structure, so testing for absence is not necessary
|
||||
|
||||
JLG(PPHtble, *PPArray, Len); // JudyL hash table for strings of Len
|
||||
|
||||
#ifdef DONOTUSEHASH
|
||||
PPBucket = PPHtble; // simulate below code
|
||||
#else // USEHASH
|
||||
if (Len > WORDSIZE)
|
||||
{
|
||||
JUDYHASHSTR(HValue, String, Len); // hash to no more than 32 bits
|
||||
|
||||
// get pointer to hash bucket
|
||||
|
||||
JLG(PPBucket, *PPHtble, (Word_t)HValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
PPBucket = PPHtble; // no bucket to JLGet
|
||||
}
|
||||
#endif // USEHASH
|
||||
|
||||
// delete from JudyL tree
|
||||
//
|
||||
Ret = delStrJudyLTree(String, Len, PPBucket, PJError);
|
||||
if (Ret != 1)
|
||||
{
|
||||
JU_SET_ERRNO(PJError, 0);
|
||||
return(-1);
|
||||
}
|
||||
// handle case of missing JudyL array from hash table and length table
|
||||
|
||||
if (*PPBucket == (Pvoid_t)NULL) // if JudyL tree gone
|
||||
{
|
||||
#ifndef DONOTUSEHASH
|
||||
if (Len > WORDSIZE)
|
||||
{
|
||||
// delete entry in Hash table
|
||||
|
||||
Ret = JudyLDel(PPHtble, (Word_t)HValue, PJError);
|
||||
if (Ret != 1)
|
||||
{
|
||||
JU_SET_ERRNO(PJError, 0);
|
||||
return(-1);
|
||||
}
|
||||
}
|
||||
#endif // USEHASH
|
||||
if (*PPHtble == (PPvoid_t) NULL) // if Hash table gone
|
||||
{
|
||||
// delete entry from the String length table
|
||||
|
||||
Ret = JudyLDel(PPArray, Len, PJError);
|
||||
if (Ret != 1)
|
||||
{
|
||||
JU_SET_ERRNO(PJError, 0);
|
||||
return(-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
return (1); // success
|
||||
}
|
||||
|
||||
static Word_t
|
||||
delJudyLTree(PPvoid_t PPValue, // ^ to JudyL root pointer
|
||||
Word_t Len, // length of string
|
||||
PJError_t PJError) // for returning error info
|
||||
{
|
||||
Word_t bytes_freed = 0; // bytes freed at point
|
||||
Word_t bytes_total = 0; // accumulated bytes freed
|
||||
PPvoid_t PPValueN;
|
||||
|
||||
// Pointer is to another tree of JudyL arrays or ls_t struct
|
||||
|
||||
if (Len > WORDSIZE) // more depth to tree
|
||||
{
|
||||
Word_t NEntry;
|
||||
|
||||
// Pointer is to a ls_t struct
|
||||
|
||||
if (IS_PLS(*PPValue))
|
||||
{
|
||||
Pls_t Pls;
|
||||
Word_t freewords;
|
||||
|
||||
freewords = LS_WORDLEN(Len); // calculate length
|
||||
Pls = (Pls_t)CLEAR_PLS(*PPValue); // demangle pointer
|
||||
|
||||
// *PPValue = (Pvoid_t)NULL; // clean pointer
|
||||
JudyFree((Pvoid_t)Pls, freewords); // free the ls_t
|
||||
|
||||
return(freewords * WORDSIZE);
|
||||
}
|
||||
// else
|
||||
// Walk all the entrys in the JudyL array
|
||||
|
||||
NEntry = 0; // start at beginning
|
||||
for (PPValueN = JudyLFirst(*PPValue, &NEntry, PJError);
|
||||
(PPValueN != (PPvoid_t) NULL) && (PPValueN != PPJERR);
|
||||
PPValueN = JudyLNext(*PPValue, &NEntry, PJError))
|
||||
{
|
||||
// recurse to the next level in the tree of arrays
|
||||
|
||||
bytes_freed = delJudyLTree(PPValueN, Len - WORDSIZE, PJError);
|
||||
if (bytes_freed == JERR) return(JERR);
|
||||
bytes_total += bytes_freed;
|
||||
}
|
||||
if (PPValueN == PPJERR) return(JERR);
|
||||
|
||||
// now free this JudyL array
|
||||
|
||||
bytes_freed = JudyLFreeArray(PPValue, PJError);
|
||||
if (bytes_freed == JERR) return(JERR);
|
||||
bytes_total += bytes_freed;
|
||||
|
||||
return(bytes_total); // return amount freed
|
||||
}
|
||||
// else
|
||||
|
||||
// Pointer to simple JudyL array
|
||||
|
||||
bytes_freed = JudyLFreeArray(PPValue, PJError);
|
||||
|
||||
return(bytes_freed);
|
||||
}
|
||||
|
||||
|
||||
Word_t // bytes freed
|
||||
JudyHSFreeArray(PPvoid_t PPArray, // ^ to JudyHashArray struct
|
||||
PJError_t PJError // optional, for returning error info
|
||||
)
|
||||
{
|
||||
Word_t Len; // start at beginning
|
||||
Word_t bytes_freed; // bytes freed at this level.
|
||||
Word_t bytes_total; // bytes total at all levels.
|
||||
PPvoid_t PPHtble;
|
||||
|
||||
if (PPArray == NULL)
|
||||
return (0); // no pointer, return none
|
||||
|
||||
// Walk the string length table for subsidary hash structs
|
||||
// NOTE: This is necessary to determine the depth of the tree
|
||||
|
||||
bytes_freed = 0;
|
||||
bytes_total = 0;
|
||||
Len = 0; // walk to length table
|
||||
|
||||
for (PPHtble = JudyLFirst(*PPArray, &Len, PJError);
|
||||
(PPHtble != (PPvoid_t) NULL) && (PPHtble != PPJERR);
|
||||
PPHtble = JudyLNext(*PPArray, &Len, PJError))
|
||||
{
|
||||
PPvoid_t PPValueH;
|
||||
|
||||
#ifndef DONOTUSEHASH
|
||||
if (Len > WORDSIZE)
|
||||
{
|
||||
Word_t HEntry = 0; // walk the hash tables
|
||||
|
||||
for (PPValueH = JudyLFirst(*PPHtble, &HEntry, PJError);
|
||||
(PPValueH != (PPvoid_t) NULL) && (PPValueH != PPJERR);
|
||||
PPValueH = JudyLNext(*PPHtble, &HEntry, PJError))
|
||||
{
|
||||
bytes_freed = delJudyLTree(PPValueH, Len, PJError);
|
||||
if (bytes_freed == JERR) return(JERR);
|
||||
bytes_total += bytes_freed;
|
||||
}
|
||||
|
||||
if (PPValueH == PPJERR) return(JERR);
|
||||
|
||||
// free the Hash table for this length of string
|
||||
|
||||
bytes_freed = JudyLFreeArray(PPHtble, PJError);
|
||||
if (bytes_freed == JERR) return(JERR);
|
||||
bytes_total += bytes_freed;
|
||||
}
|
||||
else
|
||||
#endif // DONOTUSEHASH
|
||||
{
|
||||
PPValueH = PPHtble; // simulate hash table
|
||||
|
||||
bytes_freed = delJudyLTree(PPValueH, Len, PJError);
|
||||
if (bytes_freed == JERR) return(JERR);
|
||||
bytes_total += bytes_freed;
|
||||
}
|
||||
}
|
||||
if (PPHtble == PPJERR) return(JERR);
|
||||
|
||||
// free the length table
|
||||
|
||||
bytes_freed = JudyLFreeArray(PPArray, PJError);
|
||||
if (bytes_freed == JERR) return(JERR);
|
||||
|
||||
bytes_total += bytes_freed;
|
||||
|
||||
return(bytes_total); // return bytes freed
|
||||
}
|
35
dlls/arrayx/Judy-1.0.1/src/JudyHS/JudyHS.h
Normal file
35
dlls/arrayx/Judy-1.0.1/src/JudyHS/JudyHS.h
Normal file
|
@ -0,0 +1,35 @@
|
|||
// ****************************************************************************
|
||||
// Quick and dirty header file for use with old Judy.h without JudyHS defs
|
||||
// May 2004 (dlb) - No copyright or license -- it is free period.
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
// ****************************************************************************
|
||||
// JUDYHSL MACROS:
|
||||
|
||||
#define JHSI(PV, PArray, PIndex, Count) \
|
||||
J_2P(PV, (&(PArray)), PIndex, Count, JudyHSIns, "JudyHSIns")
|
||||
#define JHSG(PV, PArray, PIndex, Count) \
|
||||
(PV) = (Pvoid_t) JudyHSGet(PArray, PIndex, Count)
|
||||
#define JHSD(Rc, PArray, PIndex, Count) \
|
||||
J_2I(Rc, (&(PArray)), PIndex, Count, JudyHSDel, "JudyHSDel")
|
||||
#define JHSFA(Rc, PArray) \
|
||||
J_0I(Rc, (&(PArray)), JudyHSFreeArray, "JudyHSFreeArray")
|
||||
|
||||
// ****************************************************************************
|
||||
// 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); // block to free and its size in words.
|
||||
extern void JudyFreeVirtual(Pvoid_t, Word_t); // block to free and its size in words.
|
||||
|
||||
// ****************************************************************************
|
||||
// JUDYHS 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 uint32_t JudyHashStr( void *, Word_t);
|
6
dlls/arrayx/Judy-1.0.1/src/JudyHS/Makefile.am
Normal file
6
dlls/arrayx/Judy-1.0.1/src/JudyHS/Makefile.am
Normal file
|
@ -0,0 +1,6 @@
|
|||
INCLUDES = -I. -I.. -I../JudyCommon/
|
||||
AM_CFLAGS = @CFLAGS@ @WARN_CFLAGS@
|
||||
|
||||
noinst_LTLIBRARIES = libJudyHS.la
|
||||
|
||||
libJudyHS_la_SOURCES = JudyHS.c
|
430
dlls/arrayx/Judy-1.0.1/src/JudyHS/Makefile.in
Normal file
430
dlls/arrayx/Judy-1.0.1/src/JudyHS/Makefile.in
Normal file
|
@ -0,0 +1,430 @@
|
|||
# Makefile.in generated by automake 1.9.3 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
# 2003, 2004 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
|
||||
SOURCES = $(libJudyHS_la_SOURCES)
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
top_builddir = ../..
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
INSTALL = @INSTALL@
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
subdir = src/JudyHS
|
||||
DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_HEADER = $(top_builddir)/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
LTLIBRARIES = $(noinst_LTLIBRARIES)
|
||||
libJudyHS_la_LIBADD =
|
||||
am_libJudyHS_la_OBJECTS = JudyHS.lo
|
||||
libJudyHS_la_OBJECTS = $(am_libJudyHS_la_OBJECTS)
|
||||
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
|
||||
depcomp = $(SHELL) $(top_srcdir)/depcomp
|
||||
am__depfiles_maybe = depfiles
|
||||
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
|
||||
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \
|
||||
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
|
||||
$(AM_CFLAGS) $(CFLAGS)
|
||||
CCLD = $(CC)
|
||||
LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
|
||||
$(AM_LDFLAGS) $(LDFLAGS) -o $@
|
||||
SOURCES = $(libJudyHS_la_SOURCES)
|
||||
DIST_SOURCES = $(libJudyHS_la_SOURCES)
|
||||
ETAGS = etags
|
||||
CTAGS = ctags
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AMDEP_FALSE = @AMDEP_FALSE@
|
||||
AMDEP_TRUE = @AMDEP_TRUE@
|
||||
AMTAR = @AMTAR@
|
||||
AR = @AR@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CXX = @CXX@
|
||||
CXXCPP = @CXXCPP@
|
||||
CXXDEPMODE = @CXXDEPMODE@
|
||||
CXXFLAGS = @CXXFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
ECHO = @ECHO@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
F77 = @F77@
|
||||
FFLAGS = @FFLAGS@
|
||||
FLAVOR = @FLAVOR@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
LD = @LD@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LN_S = @LN_S@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAINT = @MAINT@
|
||||
MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
|
||||
MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
OBJEXT = @OBJEXT@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
RANLIB = @RANLIB@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
STRIP = @STRIP@
|
||||
VERSION = @VERSION@
|
||||
VERSION_INFO = @VERSION_INFO@
|
||||
WARN_CFLAGS = @WARN_CFLAGS@
|
||||
ac_ct_AR = @ac_ct_AR@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_CXX = @ac_ct_CXX@
|
||||
ac_ct_F77 = @ac_ct_F77@
|
||||
ac_ct_LD = @ac_ct_LD@
|
||||
ac_ct_RANLIB = @ac_ct_RANLIB@
|
||||
ac_ct_STRIP = @ac_ct_STRIP@
|
||||
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
|
||||
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
|
||||
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
|
||||
am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
build_cpu = @build_cpu@
|
||||
build_os = @build_os@
|
||||
build_vendor = @build_vendor@
|
||||
datadir = @datadir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host = @host@
|
||||
host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
host_os = @host_os@
|
||||
host_vendor = @host_vendor@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target_alias = @target_alias@
|
||||
INCLUDES = -I. -I.. -I../JudyCommon/
|
||||
AM_CFLAGS = @CFLAGS@ @WARN_CFLAGS@
|
||||
noinst_LTLIBRARIES = libJudyHS.la
|
||||
libJudyHS_la_SOURCES = JudyHS.c
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .c .lo .o .obj
|
||||
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
|
||||
&& exit 0; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/JudyHS/Makefile'; \
|
||||
cd $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu src/JudyHS/Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
clean-noinstLTLIBRARIES:
|
||||
-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
|
||||
@list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
|
||||
dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
|
||||
test "$$dir" != "$$p" || dir=.; \
|
||||
echo "rm -f \"$${dir}/so_locations\""; \
|
||||
rm -f "$${dir}/so_locations"; \
|
||||
done
|
||||
libJudyHS.la: $(libJudyHS_la_OBJECTS) $(libJudyHS_la_DEPENDENCIES)
|
||||
$(LINK) $(libJudyHS_la_LDFLAGS) $(libJudyHS_la_OBJECTS) $(libJudyHS_la_LIBADD) $(LIBS)
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.$(OBJEXT)
|
||||
|
||||
distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/JudyHS.Plo@am__quote@
|
||||
|
||||
.c.o:
|
||||
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
|
||||
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
|
||||
|
||||
.c.obj:
|
||||
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
|
||||
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
|
||||
|
||||
.c.lo:
|
||||
@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
|
||||
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
|
||||
distclean-libtool:
|
||||
-rm -f libtool
|
||||
uninstall-info-am:
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
mkid -fID $$unique
|
||||
tags: TAGS
|
||||
|
||||
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
|
||||
test -n "$$unique" || unique=$$empty_fix; \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
$$tags $$unique; \
|
||||
fi
|
||||
ctags: CTAGS
|
||||
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|
||||
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
||||
$$tags $$unique
|
||||
|
||||
GTAGS:
|
||||
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||
&& cd $(top_srcdir) \
|
||||
&& gtags -i $(GTAGS_ARGS) $$here
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
|
||||
list='$(DISTFILES)'; for file in $$list; do \
|
||||
case $$file in \
|
||||
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
|
||||
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
|
||||
esac; \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
|
||||
dir="/$$dir"; \
|
||||
$(mkdir_p) "$(distdir)$$dir"; \
|
||||
else \
|
||||
dir=''; \
|
||||
fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
|
||||
fi; \
|
||||
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
|
||||
else \
|
||||
test -f $(distdir)/$$file \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
check-am: all-am
|
||||
check: check-am
|
||||
all-am: Makefile $(LTLIBRARIES)
|
||||
installdirs:
|
||||
install: install-am
|
||||
install-exec: install-exec-am
|
||||
install-data: install-data-am
|
||||
uninstall: uninstall-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-am
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
`test -z '$(STRIP)' || \
|
||||
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-am
|
||||
|
||||
clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
|
||||
mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -rf ./$(DEPDIR)
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-compile distclean-generic \
|
||||
distclean-libtool distclean-tags
|
||||
|
||||
dvi: dvi-am
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-am
|
||||
|
||||
info: info-am
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am:
|
||||
|
||||
install-exec-am:
|
||||
|
||||
install-info: install-info-am
|
||||
|
||||
install-man:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
-rm -rf ./$(DEPDIR)
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
|
||||
mostlyclean-libtool
|
||||
|
||||
pdf: pdf-am
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-am
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am: uninstall-info-am
|
||||
|
||||
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
|
||||
clean-libtool clean-noinstLTLIBRARIES ctags distclean \
|
||||
distclean-compile distclean-generic distclean-libtool \
|
||||
distclean-tags distdir dvi dvi-am html html-am info info-am \
|
||||
install install-am install-data install-data-am install-exec \
|
||||
install-exec-am install-info install-info-am install-man \
|
||||
install-strip installcheck installcheck-am installdirs \
|
||||
maintainer-clean maintainer-clean-generic mostlyclean \
|
||||
mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
|
||||
pdf pdf-am ps ps-am tags uninstall uninstall-am \
|
||||
uninstall-info-am
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
10
dlls/arrayx/Judy-1.0.1/src/JudyHS/README
Normal file
10
dlls/arrayx/Judy-1.0.1/src/JudyHS/README
Normal file
|
@ -0,0 +1,10 @@
|
|||
# @(#) $Revision$ $Source$
|
||||
|
||||
# This tree contains sources for the JudyHS*() functions.
|
||||
#
|
||||
# Note: At one time, all of the Judy sources were split between Judy1/ and
|
||||
# JudyL/ variants, but now most of them are merged in JudyCommon/ and this
|
||||
# directory is vestigal.
|
||||
|
||||
JudyHS.h header for using JudyHS.c with older versions of Judy.h
|
||||
JudyHS.c source of JudyHS functions
|
505
dlls/arrayx/Judy-1.0.1/src/JudyL/JudyL.h
Normal file
505
dlls/arrayx/Judy-1.0.1/src/JudyL/JudyL.h
Normal file
|
@ -0,0 +1,505 @@
|
|||
#ifndef _JUDYL_INCLUDED
|
||||
#define _JUDYL_INCLUDED
|
||||
// _________________
|
||||
//
|
||||
// Copyright (C) 2000 - 2002 Hewlett-Packard Company
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify it
|
||||
// under the term of the GNU Lesser General Public License as published by the
|
||||
// Free Software Foundation; either version 2 of the License, or (at your
|
||||
// option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
// for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with this program; if not, write to the Free Software Foundation,
|
||||
// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
// _________________
|
||||
|
||||
// @(#) $Revision$ $Source$
|
||||
|
||||
// ****************************************************************************
|
||||
// JUDYL -- SMALL/LARGE AND/OR CLUSTERED/SPARSE ARRAYS
|
||||
//
|
||||
// -by-
|
||||
//
|
||||
// Douglas L. Baskins
|
||||
// doug@sourcejudy.com
|
||||
//
|
||||
// Judy arrays are designed to be used instead of arrays. The performance
|
||||
// suggests the reason why Judy arrays are thought of as arrays, instead of
|
||||
// trees. They are remarkably memory efficient at all populations.
|
||||
// Implemented as a hybrid digital tree (but really a state machine, see
|
||||
// below), Judy arrays feature fast insert/retrievals, fast near neighbor
|
||||
// searching, and contain a population tree for extremely fast ordinal related
|
||||
// retrievals.
|
||||
//
|
||||
// CONVENTIONS:
|
||||
//
|
||||
// - The comments here refer to 32-bit [64-bit] systems.
|
||||
//
|
||||
// - BranchL, LeafL refer to linear branches and leaves (small populations),
|
||||
// except LeafL does not actually appear as such; rather, Leaf1..3 [Leaf1..7]
|
||||
// is used to represent leaf Index sizes, and LeafW refers to a Leaf with
|
||||
// full (Long) word Indexes, which is also a type of linear leaf. Note that
|
||||
// root-level LeafW (Leaf4 [Leaf8]) leaves are called LEAFW.
|
||||
//
|
||||
// - BranchB, LeafB1 refer to bitmap branches and leaves (intermediate
|
||||
// populations).
|
||||
//
|
||||
// - BranchU refers to uncompressed branches. An uncompressed branch has 256
|
||||
// JPs, some of which could be null. Note: All leaves are compressed (and
|
||||
// sorted), or else an expanse is full (FullPopu), so there is no LeafU
|
||||
// equivalent to BranchU.
|
||||
//
|
||||
// - "Popu" is short for "Population".
|
||||
// - "Pop1" refers to actual population (base 1).
|
||||
// - "Pop0" refers to Pop1 - 1 (base 0), the way populations are stored in data
|
||||
// structures.
|
||||
//
|
||||
// - Branches and Leaves are both named by the number of bytes in their Pop0
|
||||
// field. In the case of Leaves, the same number applies to the Index sizes.
|
||||
//
|
||||
// - The representation of many numbers as hex is a relatively safe and
|
||||
// portable way to get desired bitpatterns as unsigned longs.
|
||||
//
|
||||
// - Some preprocessors cant handle single apostrophe characters within
|
||||
// #ifndef code, so here, delete all instead.
|
||||
|
||||
|
||||
#include "JudyPrivate.h" // includes Judy.h in turn.
|
||||
#include "JudyPrivateBranch.h" // support for branches.
|
||||
|
||||
|
||||
// ****************************************************************************
|
||||
// JUDYL ROOT POINTER (JRP) AND JUDYL POINTER (JP) TYPE FIELDS
|
||||
// ****************************************************************************
|
||||
|
||||
typedef enum // uint8_t -- but C does not support this type of enum.
|
||||
{
|
||||
|
||||
// JP NULL TYPES:
|
||||
//
|
||||
// There is a series of cJL_JPNULL* Types because each one pre-records a
|
||||
// different Index Size for when the first Index is inserted in the previously
|
||||
// null JP. They must start >= 8 (three bits).
|
||||
//
|
||||
// Note: These Types must be in sequential order for doing relative
|
||||
// calculations between them.
|
||||
|
||||
cJL_JPNULL1 = 1,
|
||||
// Index Size 1[1] byte when 1 Index inserted.
|
||||
cJL_JPNULL2, // Index Size 2[2] bytes when 1 Index inserted.
|
||||
cJL_JPNULL3, // Index Size 3[3] bytes when 1 Index inserted.
|
||||
|
||||
#ifndef JU_64BIT
|
||||
#define cJL_JPNULLMAX cJL_JPNULL3
|
||||
#else
|
||||
cJL_JPNULL4, // Index Size 4[4] bytes when 1 Index inserted.
|
||||
cJL_JPNULL5, // Index Size 5[5] bytes when 1 Index inserted.
|
||||
cJL_JPNULL6, // Index Size 6[6] bytes when 1 Index inserted.
|
||||
cJL_JPNULL7, // Index Size 7[7] bytes when 1 Index inserted.
|
||||
#define cJL_JPNULLMAX cJL_JPNULL7
|
||||
#endif
|
||||
|
||||
|
||||
// JP BRANCH TYPES:
|
||||
//
|
||||
// Note: There are no state-1 branches; only leaves reside at state 1.
|
||||
|
||||
// Linear branches:
|
||||
//
|
||||
// Note: These Types must be in sequential order for doing relative
|
||||
// calculations between them.
|
||||
|
||||
cJL_JPBRANCH_L2, // 2[2] bytes Pop0, 1[5] bytes Dcd.
|
||||
cJL_JPBRANCH_L3, // 3[3] bytes Pop0, 0[4] bytes Dcd.
|
||||
|
||||
#ifdef JU_64BIT
|
||||
cJL_JPBRANCH_L4, // [4] bytes Pop0, [3] bytes Dcd.
|
||||
cJL_JPBRANCH_L5, // [5] bytes Pop0, [2] bytes Dcd.
|
||||
cJL_JPBRANCH_L6, // [6] bytes Pop0, [1] byte Dcd.
|
||||
cJL_JPBRANCH_L7, // [7] bytes Pop0, [0] bytes Dcd.
|
||||
#endif
|
||||
|
||||
cJL_JPBRANCH_L, // note: DcdPopO field not used.
|
||||
|
||||
// Bitmap branches:
|
||||
//
|
||||
// Note: These Types must be in sequential order for doing relative
|
||||
// calculations between them.
|
||||
|
||||
cJL_JPBRANCH_B2, // 2[2] bytes Pop0, 1[5] bytes Dcd.
|
||||
cJL_JPBRANCH_B3, // 3[3] bytes Pop0, 0[4] bytes Dcd.
|
||||
|
||||
#ifdef JU_64BIT
|
||||
cJL_JPBRANCH_B4, // [4] bytes Pop0, [3] bytes Dcd.
|
||||
cJL_JPBRANCH_B5, // [5] bytes Pop0, [2] bytes Dcd.
|
||||
cJL_JPBRANCH_B6, // [6] bytes Pop0, [1] byte Dcd.
|
||||
cJL_JPBRANCH_B7, // [7] bytes Pop0, [0] bytes Dcd.
|
||||
#endif
|
||||
|
||||
cJL_JPBRANCH_B, // note: DcdPopO field not used.
|
||||
|
||||
// Uncompressed branches:
|
||||
//
|
||||
// Note: These Types must be in sequential order for doing relative
|
||||
// calculations between them.
|
||||
|
||||
cJL_JPBRANCH_U2, // 2[2] bytes Pop0, 1[5] bytes Dcd.
|
||||
cJL_JPBRANCH_U3, // 3[3] bytes Pop0, 0[4] bytes Dcd.
|
||||
|
||||
#ifdef JU_64BIT
|
||||
cJL_JPBRANCH_U4, // [4] bytes Pop0, [3] bytes Dcd.
|
||||
cJL_JPBRANCH_U5, // [5] bytes Pop0, [2] bytes Dcd.
|
||||
cJL_JPBRANCH_U6, // [6] bytes Pop0, [1] byte Dcd.
|
||||
cJL_JPBRANCH_U7, // [7] bytes Pop0, [0] bytes Dcd.
|
||||
#endif
|
||||
|
||||
cJL_JPBRANCH_U, // note: DcdPopO field not used.
|
||||
|
||||
|
||||
// JP LEAF TYPES:
|
||||
|
||||
// Linear leaves:
|
||||
//
|
||||
// Note: These Types must be in sequential order for doing relative
|
||||
// calculations between them.
|
||||
//
|
||||
// Note: There is no full-word (4-byte [8-byte]) Index leaf under a JP because
|
||||
// non-root-state leaves only occur under branches that decode at least one
|
||||
// byte. Full-word, root-state leaves are under a JRP, not a JP. However, in
|
||||
// the code a "fake" JP can be created temporarily above a root-state leaf.
|
||||
|
||||
cJL_JPLEAF1, // 1[1] byte Pop0, 2 bytes Dcd.
|
||||
cJL_JPLEAF2, // 2[2] bytes Pop0, 1[5] bytes Dcd.
|
||||
cJL_JPLEAF3, // 3[3] bytes Pop0, 0[4] bytes Dcd.
|
||||
|
||||
#ifdef JU_64BIT
|
||||
cJL_JPLEAF4, // [4] bytes Pop0, [3] bytes Dcd.
|
||||
cJL_JPLEAF5, // [5] bytes Pop0, [2] bytes Dcd.
|
||||
cJL_JPLEAF6, // [6] bytes Pop0, [1] byte Dcd.
|
||||
cJL_JPLEAF7, // [7] bytes Pop0, [0] bytes Dcd.
|
||||
#endif
|
||||
|
||||
// Bitmap leaf; Index Size == 1:
|
||||
//
|
||||
// Note: These are currently only supported at state 1. At other states the
|
||||
// bitmap would grow from 256 to 256^2, 256^3, ... bits, which would not be
|
||||
// efficient..
|
||||
|
||||
cJL_JPLEAF_B1, // 1[1] byte Pop0, 2[6] bytes Dcd.
|
||||
|
||||
// Full population; Index Size == 1 virtual leaf:
|
||||
//
|
||||
// Note: JudyL has no cJL_JPFULLPOPU1 equivalent to cJ1_JPFULLPOPU1, because
|
||||
// in the JudyL case this could result in a values-only leaf of up to 256 words
|
||||
// (value areas) that would be slow to insert/delete.
|
||||
|
||||
|
||||
// JP IMMEDIATES; leaves (Indexes) stored inside a JP:
|
||||
//
|
||||
// The second numeric suffix is the Pop1 for each type. As the Index Size
|
||||
// increases, the maximum possible population decreases.
|
||||
//
|
||||
// Note: These Types must be in sequential order in each group (Index Size),
|
||||
// and the groups in correct order too, for doing relative calculations between
|
||||
// them. For example, since these Types enumerate the Pop1 values (unlike
|
||||
// other JP Types where there is a Pop0 value in the JP), the maximum Pop1 for
|
||||
// each Index Size is computable.
|
||||
//
|
||||
// All enums equal or above this point are cJL_JPIMMEDs.
|
||||
|
||||
cJL_JPIMMED_1_01, // Index Size = 1, Pop1 = 1.
|
||||
cJL_JPIMMED_2_01, // Index Size = 2, Pop1 = 1.
|
||||
cJL_JPIMMED_3_01, // Index Size = 3, Pop1 = 1.
|
||||
|
||||
#ifdef JU_64BIT
|
||||
cJL_JPIMMED_4_01, // Index Size = 4, Pop1 = 1.
|
||||
cJL_JPIMMED_5_01, // Index Size = 5, Pop1 = 1.
|
||||
cJL_JPIMMED_6_01, // Index Size = 6, Pop1 = 1.
|
||||
cJL_JPIMMED_7_01, // Index Size = 7, Pop1 = 1.
|
||||
#endif
|
||||
|
||||
cJL_JPIMMED_1_02, // Index Size = 1, Pop1 = 2.
|
||||
cJL_JPIMMED_1_03, // Index Size = 1, Pop1 = 3.
|
||||
|
||||
#ifdef JU_64BIT
|
||||
cJL_JPIMMED_1_04, // Index Size = 1, Pop1 = 4.
|
||||
cJL_JPIMMED_1_05, // Index Size = 1, Pop1 = 5.
|
||||
cJL_JPIMMED_1_06, // Index Size = 1, Pop1 = 6.
|
||||
cJL_JPIMMED_1_07, // Index Size = 1, Pop1 = 7.
|
||||
|
||||
cJL_JPIMMED_2_02, // Index Size = 2, Pop1 = 2.
|
||||
cJL_JPIMMED_2_03, // Index Size = 2, Pop1 = 3.
|
||||
|
||||
cJL_JPIMMED_3_02, // Index Size = 3, Pop1 = 2.
|
||||
#endif
|
||||
|
||||
// This special Type is merely a sentinel for doing relative calculations.
|
||||
// This value should not be used in switch statements (to avoid allocating code
|
||||
// for it), which is also why it appears at the end of the enum list.
|
||||
|
||||
cJL_JPIMMED_CAP
|
||||
|
||||
} jpL_Type_t;
|
||||
|
||||
|
||||
// RELATED VALUES:
|
||||
|
||||
// Index Size (state) for leaf JP, and JP type based on Index Size (state):
|
||||
|
||||
#define JL_LEAFINDEXSIZE(jpType) ((jpType) - cJL_JPLEAF1 + 1)
|
||||
#define JL_LEAFTYPE(IndexSize) ((IndexSize) + cJL_JPLEAF1 - 1)
|
||||
|
||||
|
||||
// MAXIMUM POPULATIONS OF LINEAR LEAVES:
|
||||
|
||||
#ifndef JU_64BIT // 32-bit
|
||||
|
||||
#define J_L_MAXB (sizeof(Word_t) * 64)
|
||||
#define ALLOCSIZES { 3, 5, 7, 11, 15, 23, 32, 47, 64, TERMINATOR } // in words.
|
||||
#define cJL_LEAF1_MAXWORDS (32) // max Leaf1 size in words.
|
||||
|
||||
// Note: cJL_LEAF1_MAXPOP1 is chosen such that the index portion is less than
|
||||
// 32 bytes -- the number of bytes the index takes in a bitmap leaf.
|
||||
|
||||
#define cJL_LEAF1_MAXPOP1 \
|
||||
((cJL_LEAF1_MAXWORDS * cJU_BYTESPERWORD)/(1 + cJU_BYTESPERWORD))
|
||||
#define cJL_LEAF2_MAXPOP1 (J_L_MAXB / (2 + cJU_BYTESPERWORD))
|
||||
#define cJL_LEAF3_MAXPOP1 (J_L_MAXB / (3 + cJU_BYTESPERWORD))
|
||||
#define cJL_LEAFW_MAXPOP1 \
|
||||
((J_L_MAXB - cJU_BYTESPERWORD) / (2 * cJU_BYTESPERWORD))
|
||||
|
||||
#else // 64-bit
|
||||
|
||||
#define J_L_MAXB (sizeof(Word_t) * 64)
|
||||
#define ALLOCSIZES { 3, 5, 7, 11, 15, 23, 32, 47, 64, TERMINATOR } // in words.
|
||||
#define cJL_LEAF1_MAXWORDS (15) // max Leaf1 size in words.
|
||||
|
||||
#define cJL_LEAF1_MAXPOP1 \
|
||||
((cJL_LEAF1_MAXWORDS * cJU_BYTESPERWORD)/(1 + cJU_BYTESPERWORD))
|
||||
#define cJL_LEAF2_MAXPOP1 (J_L_MAXB / (2 + cJU_BYTESPERWORD))
|
||||
#define cJL_LEAF3_MAXPOP1 (J_L_MAXB / (3 + cJU_BYTESPERWORD))
|
||||
#define cJL_LEAF4_MAXPOP1 (J_L_MAXB / (4 + cJU_BYTESPERWORD))
|
||||
#define cJL_LEAF5_MAXPOP1 (J_L_MAXB / (5 + cJU_BYTESPERWORD))
|
||||
#define cJL_LEAF6_MAXPOP1 (J_L_MAXB / (6 + cJU_BYTESPERWORD))
|
||||
#define cJL_LEAF7_MAXPOP1 (J_L_MAXB / (7 + cJU_BYTESPERWORD))
|
||||
#define cJL_LEAFW_MAXPOP1 \
|
||||
((J_L_MAXB - cJU_BYTESPERWORD) / (2 * cJU_BYTESPERWORD))
|
||||
|
||||
#endif // 64-bit
|
||||
|
||||
|
||||
// MAXIMUM POPULATIONS OF IMMEDIATE JPs:
|
||||
//
|
||||
// These specify the maximum Population of immediate JPs with various Index
|
||||
// Sizes (== sizes of remaining undecoded Index bits). Since the JP Types enum
|
||||
// already lists all the immediates in order by state and size, calculate these
|
||||
// values from it to avoid redundancy.
|
||||
|
||||
#define cJL_IMMED1_MAXPOP1 ((cJU_BYTESPERWORD - 1) / 1) // 3 [7].
|
||||
#define cJL_IMMED2_MAXPOP1 ((cJU_BYTESPERWORD - 1) / 2) // 1 [3].
|
||||
#define cJL_IMMED3_MAXPOP1 ((cJU_BYTESPERWORD - 1) / 3) // 1 [2].
|
||||
|
||||
#ifdef JU_64BIT
|
||||
#define cJL_IMMED4_MAXPOP1 ((cJU_BYTESPERWORD - 1) / 4) // [1].
|
||||
#define cJL_IMMED5_MAXPOP1 ((cJU_BYTESPERWORD - 1) / 5) // [1].
|
||||
#define cJL_IMMED6_MAXPOP1 ((cJU_BYTESPERWORD - 1) / 6) // [1].
|
||||
#define cJL_IMMED7_MAXPOP1 ((cJU_BYTESPERWORD - 1) / 7) // [1].
|
||||
#endif
|
||||
|
||||
|
||||
// ****************************************************************************
|
||||
// JUDYL LEAF BITMAP (JLLB) SUPPORT
|
||||
// ****************************************************************************
|
||||
//
|
||||
// Assemble bitmap leaves out of smaller units that put bitmap subexpanses
|
||||
// close to their associated pointers. Why not just use a bitmap followed by a
|
||||
// series of pointers? (See 4.27.) Turns out this wastes a cache fill on
|
||||
// systems with smaller cache lines than the assumed value cJU_WORDSPERCL.
|
||||
|
||||
#define JL_JLB_BITMAP(Pjlb, Subexp) ((Pjlb)->jLlb_jLlbs[Subexp].jLlbs_Bitmap)
|
||||
#define JL_JLB_PVALUE(Pjlb, Subexp) ((Pjlb)->jLlb_jLlbs[Subexp].jLlbs_PValue)
|
||||
|
||||
typedef struct J__UDYL_LEAF_BITMAP_SUBEXPANSE
|
||||
{
|
||||
BITMAPL_t jLlbs_Bitmap;
|
||||
Pjv_t jLlbs_PValue;
|
||||
|
||||
} jLlbs_t;
|
||||
|
||||
typedef struct J__UDYL_LEAF_BITMAP
|
||||
{
|
||||
jLlbs_t jLlb_jLlbs[cJU_NUMSUBEXPL];
|
||||
|
||||
} jLlb_t, * PjLlb_t;
|
||||
|
||||
// Words per bitmap leaf:
|
||||
|
||||
#define cJL_WORDSPERLEAFB1 (sizeof(jLlb_t) / cJU_BYTESPERWORD)
|
||||
|
||||
|
||||
// ****************************************************************************
|
||||
// MEMORY ALLOCATION SUPPORT
|
||||
// ****************************************************************************
|
||||
|
||||
// ARRAY-GLOBAL INFORMATION:
|
||||
//
|
||||
// At the cost of an occasional additional cache fill, this object, which is
|
||||
// pointed at by a JRP and in turn points to a JP_BRANCH*, carries array-global
|
||||
// information about a JudyL array that has sufficient population to amortize
|
||||
// the cost. The jpm_Pop0 field prevents having to add up the total population
|
||||
// for the array in insert, delete, and count code. The jpm_JP field prevents
|
||||
// having to build a fake JP for entry to a state machine; however, the
|
||||
// jp_DcdPopO field in jpm_JP, being one byte too small, is not used.
|
||||
//
|
||||
// Note: Struct fields are ordered to keep "hot" data in the first 8 words
|
||||
// (see left-margin comments) for machines with 8-word cache lines, and to keep
|
||||
// sub-word fields together for efficient packing.
|
||||
|
||||
typedef struct J_UDYL_POPULATION_AND_MEMORY
|
||||
{
|
||||
/* 1 */ Word_t jpm_Pop0; // total population-1 in array.
|
||||
/* 2 */ jp_t jpm_JP; // JP to first branch; see above.
|
||||
/* 4 */ Word_t jpm_LastUPop0; // last jpm_Pop0 when convert to BranchU
|
||||
/* 7 */ Pjv_t jpm_PValue; // pointer to value to return.
|
||||
// Note: Field names match PJError_t for convenience in macros:
|
||||
/* 8 */ char je_Errno; // one of the enums in Judy.h.
|
||||
/* 8/9 */ int je_ErrID; // often an internal source line number.
|
||||
/* 9/10 */ Word_t jpm_TotalMemWords; // words allocated in array.
|
||||
} jLpm_t, *PjLpm_t;
|
||||
|
||||
|
||||
// TABLES FOR DETERMINING IF LEAVES HAVE ROOM TO GROW:
|
||||
//
|
||||
// These tables indicate if a given memory chunk can support growth of a given
|
||||
// object into wasted (rounded-up) memory in the chunk. Note: This violates
|
||||
// the hiddenness of the JudyMalloc code.
|
||||
|
||||
extern const uint8_t j__L_Leaf1PopToWords[cJL_LEAF1_MAXPOP1 + 1];
|
||||
extern const uint8_t j__L_Leaf2PopToWords[cJL_LEAF2_MAXPOP1 + 1];
|
||||
extern const uint8_t j__L_Leaf3PopToWords[cJL_LEAF3_MAXPOP1 + 1];
|
||||
#ifdef JU_64BIT
|
||||
extern const uint8_t j__L_Leaf4PopToWords[cJL_LEAF4_MAXPOP1 + 1];
|
||||
extern const uint8_t j__L_Leaf5PopToWords[cJL_LEAF5_MAXPOP1 + 1];
|
||||
extern const uint8_t j__L_Leaf6PopToWords[cJL_LEAF6_MAXPOP1 + 1];
|
||||
extern const uint8_t j__L_Leaf7PopToWords[cJL_LEAF7_MAXPOP1 + 1];
|
||||
#endif
|
||||
extern const uint8_t j__L_LeafWPopToWords[cJL_LEAFW_MAXPOP1 + 1];
|
||||
extern const uint8_t j__L_LeafVPopToWords[];
|
||||
|
||||
// These tables indicate where value areas start:
|
||||
|
||||
extern const uint8_t j__L_Leaf1Offset [cJL_LEAF1_MAXPOP1 + 1];
|
||||
extern const uint8_t j__L_Leaf2Offset [cJL_LEAF2_MAXPOP1 + 1];
|
||||
extern const uint8_t j__L_Leaf3Offset [cJL_LEAF3_MAXPOP1 + 1];
|
||||
#ifdef JU_64BIT
|
||||
extern const uint8_t j__L_Leaf4Offset [cJL_LEAF4_MAXPOP1 + 1];
|
||||
extern const uint8_t j__L_Leaf5Offset [cJL_LEAF5_MAXPOP1 + 1];
|
||||
extern const uint8_t j__L_Leaf6Offset [cJL_LEAF6_MAXPOP1 + 1];
|
||||
extern const uint8_t j__L_Leaf7Offset [cJL_LEAF7_MAXPOP1 + 1];
|
||||
#endif
|
||||
extern const uint8_t j__L_LeafWOffset [cJL_LEAFW_MAXPOP1 + 1];
|
||||
|
||||
// Also define macros to hide the details in the code using these tables.
|
||||
|
||||
#define JL_LEAF1GROWINPLACE(Pop1) \
|
||||
J__U_GROWCK(Pop1, cJL_LEAF1_MAXPOP1, j__L_Leaf1PopToWords)
|
||||
#define JL_LEAF2GROWINPLACE(Pop1) \
|
||||
J__U_GROWCK(Pop1, cJL_LEAF2_MAXPOP1, j__L_Leaf2PopToWords)
|
||||
#define JL_LEAF3GROWINPLACE(Pop1) \
|
||||
J__U_GROWCK(Pop1, cJL_LEAF3_MAXPOP1, j__L_Leaf3PopToWords)
|
||||
#ifdef JU_64BIT
|
||||
#define JL_LEAF4GROWINPLACE(Pop1) \
|
||||
J__U_GROWCK(Pop1, cJL_LEAF4_MAXPOP1, j__L_Leaf4PopToWords)
|
||||
#define JL_LEAF5GROWINPLACE(Pop1) \
|
||||
J__U_GROWCK(Pop1, cJL_LEAF5_MAXPOP1, j__L_Leaf5PopToWords)
|
||||
#define JL_LEAF6GROWINPLACE(Pop1) \
|
||||
J__U_GROWCK(Pop1, cJL_LEAF6_MAXPOP1, j__L_Leaf6PopToWords)
|
||||
#define JL_LEAF7GROWINPLACE(Pop1) \
|
||||
J__U_GROWCK(Pop1, cJL_LEAF7_MAXPOP1, j__L_Leaf7PopToWords)
|
||||
#endif
|
||||
#define JL_LEAFWGROWINPLACE(Pop1) \
|
||||
J__U_GROWCK(Pop1, cJL_LEAFW_MAXPOP1, j__L_LeafWPopToWords)
|
||||
#define JL_LEAFVGROWINPLACE(Pop1) \
|
||||
J__U_GROWCK(Pop1, cJU_BITSPERSUBEXPL, j__L_LeafVPopToWords)
|
||||
|
||||
#define JL_LEAF1VALUEAREA(Pjv,Pop1) (((PWord_t)(Pjv)) + j__L_Leaf1Offset[Pop1])
|
||||
#define JL_LEAF2VALUEAREA(Pjv,Pop1) (((PWord_t)(Pjv)) + j__L_Leaf2Offset[Pop1])
|
||||
#define JL_LEAF3VALUEAREA(Pjv,Pop1) (((PWord_t)(Pjv)) + j__L_Leaf3Offset[Pop1])
|
||||
#ifdef JU_64BIT
|
||||
#define JL_LEAF4VALUEAREA(Pjv,Pop1) (((PWord_t)(Pjv)) + j__L_Leaf4Offset[Pop1])
|
||||
#define JL_LEAF5VALUEAREA(Pjv,Pop1) (((PWord_t)(Pjv)) + j__L_Leaf5Offset[Pop1])
|
||||
#define JL_LEAF6VALUEAREA(Pjv,Pop1) (((PWord_t)(Pjv)) + j__L_Leaf6Offset[Pop1])
|
||||
#define JL_LEAF7VALUEAREA(Pjv,Pop1) (((PWord_t)(Pjv)) + j__L_Leaf7Offset[Pop1])
|
||||
#endif
|
||||
#define JL_LEAFWVALUEAREA(Pjv,Pop1) (((PWord_t)(Pjv)) + j__L_LeafWOffset[Pop1])
|
||||
|
||||
#define JL_LEAF1POPTOWORDS(Pop1) (j__L_Leaf1PopToWords[Pop1])
|
||||
#define JL_LEAF2POPTOWORDS(Pop1) (j__L_Leaf2PopToWords[Pop1])
|
||||
#define JL_LEAF3POPTOWORDS(Pop1) (j__L_Leaf3PopToWords[Pop1])
|
||||
#ifdef JU_64BIT
|
||||
#define JL_LEAF4POPTOWORDS(Pop1) (j__L_Leaf4PopToWords[Pop1])
|
||||
#define JL_LEAF5POPTOWORDS(Pop1) (j__L_Leaf5PopToWords[Pop1])
|
||||
#define JL_LEAF6POPTOWORDS(Pop1) (j__L_Leaf6PopToWords[Pop1])
|
||||
#define JL_LEAF7POPTOWORDS(Pop1) (j__L_Leaf7PopToWords[Pop1])
|
||||
#endif
|
||||
#define JL_LEAFWPOPTOWORDS(Pop1) (j__L_LeafWPopToWords[Pop1])
|
||||
#define JL_LEAFVPOPTOWORDS(Pop1) (j__L_LeafVPopToWords[Pop1])
|
||||
|
||||
|
||||
// FUNCTIONS TO ALLOCATE OBJECTS:
|
||||
|
||||
PjLpm_t j__udyLAllocJLPM(void); // constant size.
|
||||
|
||||
Pjbl_t j__udyLAllocJBL( PjLpm_t); // constant size.
|
||||
Pjbb_t j__udyLAllocJBB( PjLpm_t); // constant size.
|
||||
Pjp_t j__udyLAllocJBBJP(Word_t, PjLpm_t);
|
||||
Pjbu_t j__udyLAllocJBU( PjLpm_t); // constant size.
|
||||
|
||||
Pjll_t j__udyLAllocJLL1( Word_t, PjLpm_t);
|
||||
Pjll_t j__udyLAllocJLL2( Word_t, PjLpm_t);
|
||||
Pjll_t j__udyLAllocJLL3( Word_t, PjLpm_t);
|
||||
|
||||
#ifdef JU_64BIT
|
||||
Pjll_t j__udyLAllocJLL4( Word_t, PjLpm_t);
|
||||
Pjll_t j__udyLAllocJLL5( Word_t, PjLpm_t);
|
||||
Pjll_t j__udyLAllocJLL6( Word_t, PjLpm_t);
|
||||
Pjll_t j__udyLAllocJLL7( Word_t, PjLpm_t);
|
||||
#endif
|
||||
|
||||
Pjlw_t j__udyLAllocJLW( Word_t ); // no PjLpm_t needed.
|
||||
PjLlb_t j__udyLAllocJLB1( PjLpm_t); // constant size.
|
||||
Pjv_t j__udyLAllocJV( Word_t, PjLpm_t);
|
||||
|
||||
|
||||
// FUNCTIONS TO FREE OBJECTS:
|
||||
|
||||
void j__udyLFreeJLPM( PjLpm_t, PjLpm_t); // constant size.
|
||||
|
||||
void j__udyLFreeJBL( Pjbl_t, PjLpm_t); // constant size.
|
||||
void j__udyLFreeJBB( Pjbb_t, PjLpm_t); // constant size.
|
||||
void j__udyLFreeJBBJP(Pjp_t, Word_t, PjLpm_t);
|
||||
void j__udyLFreeJBU( Pjbu_t, PjLpm_t); // constant size.
|
||||
|
||||
void j__udyLFreeJLL1( Pjll_t, Word_t, PjLpm_t);
|
||||
void j__udyLFreeJLL2( Pjll_t, Word_t, PjLpm_t);
|
||||
void j__udyLFreeJLL3( Pjll_t, Word_t, PjLpm_t);
|
||||
|
||||
#ifdef JU_64BIT
|
||||
void j__udyLFreeJLL4( Pjll_t, Word_t, PjLpm_t);
|
||||
void j__udyLFreeJLL5( Pjll_t, Word_t, PjLpm_t);
|
||||
void j__udyLFreeJLL6( Pjll_t, Word_t, PjLpm_t);
|
||||
void j__udyLFreeJLL7( Pjll_t, Word_t, PjLpm_t);
|
||||
#endif
|
||||
|
||||
void j__udyLFreeJLW( Pjlw_t, Word_t, PjLpm_t);
|
||||
void j__udyLFreeJLB1( PjLlb_t, PjLpm_t); // constant size.
|
||||
void j__udyLFreeJV( Pjv_t, Word_t, PjLpm_t);
|
||||
void j__udyLFreeSM( Pjp_t, PjLpm_t); // everything below Pjp.
|
||||
|
||||
#endif // ! _JUDYL_INCLUDED
|
954
dlls/arrayx/Judy-1.0.1/src/JudyL/JudyLByCount.c
Normal file
954
dlls/arrayx/Judy-1.0.1/src/JudyL/JudyLByCount.c
Normal file
|
@ -0,0 +1,954 @@
|
|||
// Copyright (C) 2000 - 2002 Hewlett-Packard Company
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify it
|
||||
// under the term of the GNU Lesser General Public License as published by the
|
||||
// Free Software Foundation; either version 2 of the License, or (at your
|
||||
// option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
// for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with this program; if not, write to the Free Software Foundation,
|
||||
// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
// _________________
|
||||
|
||||
// @(#) $Revision$ $Source$
|
||||
//
|
||||
// Judy*ByCount() function for Judy1 and JudyL.
|
||||
// Compile with one of -DJUDY1 or -DJUDYL.
|
||||
//
|
||||
// Compile with -DNOSMARTJBB, -DNOSMARTJBU, and/or -DNOSMARTJLB to build a
|
||||
// version with cache line optimizations deleted, for testing.
|
||||
//
|
||||
// Judy*ByCount() is a conceptual although not literal inverse of Judy*Count().
|
||||
// Judy*Count() takes a pair of Indexes, and allows finding the ordinal of a
|
||||
// given Index (that is, its position in the list of valid indexes from the
|
||||
// beginning) as a degenerate case, because in general the count between two
|
||||
// Indexes, inclusive, is not always just the difference in their ordinals.
|
||||
// However, it suffices for Judy*ByCount() to simply be an ordinal-to-Index
|
||||
// mapper.
|
||||
//
|
||||
// Note: Like Judy*Count(), this code must "count sideways" in branches, which
|
||||
// can result in a lot of cache line fills. However, unlike Judy*Count(), this
|
||||
// code does not receive a specific Index, hence digit, where to start in each
|
||||
// branch, so it cant accurately calculate cache line fills required in each
|
||||
// direction. The best it can do is an approximation based on the total
|
||||
// population of the expanse (pop1 from Pjp) and the ordinal of the target
|
||||
// Index (see SETOFFSET()) within the expanse.
|
||||
//
|
||||
// Compile with -DSMARTMETRICS to obtain global variables containing smart
|
||||
// cache line metrics. Note: Dont turn this on simultaneously for this file
|
||||
// and JudyCount.c because they export the same globals.
|
||||
// ****************************************************************************
|
||||
|
||||
#if (! (defined(JUDY1) || defined(JUDYL)))
|
||||
#error: One of -DJUDY1 or -DJUDYL must be specified.
|
||||
#endif
|
||||
|
||||
#ifdef JUDY1
|
||||
#include "Judy1.h"
|
||||
#else
|
||||
#include "JudyL.h"
|
||||
#endif
|
||||
|
||||
#include "JudyPrivate1L.h"
|
||||
|
||||
// These are imported from JudyCount.c:
|
||||
//
|
||||
// TBD: Should this be in common code? Exported from a header file?
|
||||
|
||||
#ifdef JUDY1
|
||||
extern Word_t j__udy1JPPop1(const Pjp_t Pjp);
|
||||
#define j__udyJPPop1 j__udy1JPPop1
|
||||
#else
|
||||
extern Word_t j__udyLJPPop1(const Pjp_t Pjp);
|
||||
#define j__udyJPPop1 j__udyLJPPop1
|
||||
#endif
|
||||
|
||||
// Avoid duplicate symbols since this file is multi-compiled:
|
||||
|
||||
#ifdef SMARTMETRICS
|
||||
#ifdef JUDY1
|
||||
Word_t jbb_upward = 0; // counts of directions taken:
|
||||
Word_t jbb_downward = 0;
|
||||
Word_t jbu_upward = 0;
|
||||
Word_t jbu_downward = 0;
|
||||
Word_t jlb_upward = 0;
|
||||
Word_t jlb_downward = 0;
|
||||
#else
|
||||
extern Word_t jbb_upward;
|
||||
extern Word_t jbb_downward;
|
||||
extern Word_t jbu_upward;
|
||||
extern Word_t jbu_downward;
|
||||
extern Word_t jlb_upward;
|
||||
extern Word_t jlb_downward;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
// ****************************************************************************
|
||||
// J U D Y 1 B Y C O U N T
|
||||
// J U D Y L B Y C O U N T
|
||||
//
|
||||
// See the manual entry.
|
||||
|
||||
#ifdef JUDY1
|
||||
FUNCTION int Judy1ByCount
|
||||
#else
|
||||
FUNCTION PPvoid_t JudyLByCount
|
||||
#endif
|
||||
(
|
||||
Pcvoid_t PArray, // root pointer to first branch/leaf in SM.
|
||||
Word_t Count, // ordinal of Index to find, 1..MAX.
|
||||
Word_t * PIndex, // to return found Index.
|
||||
PJError_t PJError // optional, for returning error info.
|
||||
)
|
||||
{
|
||||
Word_t Count0; // Count, base-0, to match pop0.
|
||||
Word_t state; // current state in SM.
|
||||
Word_t pop1; // of current branch or leaf, or of expanse.
|
||||
Word_t pop1lower; // pop1 of expanses (JPs) below that for Count.
|
||||
Word_t digit; // current word in branch.
|
||||
Word_t jpcount; // JPs in a BranchB subexpanse.
|
||||
long jpnum; // JP number in a branch (base 0).
|
||||
long subexp; // for stepping through layer 1 (subexpanses).
|
||||
int offset; // index ordinal within a leaf, base 0.
|
||||
|
||||
Pjp_t Pjp; // current JP in branch.
|
||||
Pjll_t Pjll; // current Judy linear leaf.
|
||||
|
||||
|
||||
// CHECK FOR EMPTY ARRAY OR NULL PINDEX:
|
||||
|
||||
if (PArray == (Pvoid_t) NULL) JU_RET_NOTFOUND;
|
||||
|
||||
if (PIndex == (PWord_t) NULL)
|
||||
{
|
||||
JU_SET_ERRNO(PJError, JU_ERRNO_NULLPINDEX);
|
||||
JUDY1CODE(return(JERRI );)
|
||||
JUDYLCODE(return(PPJERR);)
|
||||
}
|
||||
|
||||
// Convert Count to Count0; assume special case of Count = 0 maps to ~0, as
|
||||
// desired, to represent the last index in a full array:
|
||||
//
|
||||
// Note: Think of Count0 as a reliable "number of Indexes below the target."
|
||||
|
||||
Count0 = Count - 1;
|
||||
assert((Count || Count0 == ~0)); // ensure CPU is sane about 0 - 1.
|
||||
pop1lower = 0;
|
||||
|
||||
if (JU_LEAFW_POP0(PArray) < cJU_LEAFW_MAXPOP1) // must be a LEAFW
|
||||
{
|
||||
Pjlw_t Pjlw = P_JLW(PArray); // first word of leaf.
|
||||
|
||||
if (Count0 > Pjlw[0]) JU_RET_NOTFOUND; // too high.
|
||||
|
||||
*PIndex = Pjlw[Count]; // Index, base 1.
|
||||
|
||||
JU_RET_FOUND_LEAFW(Pjlw, Pjlw[0] + 1, Count0);
|
||||
}
|
||||
else
|
||||
{
|
||||
Pjpm_t Pjpm = P_JPM(PArray);
|
||||
|
||||
if (Count0 > (Pjpm->jpm_Pop0)) JU_RET_NOTFOUND; // too high.
|
||||
|
||||
Pjp = &(Pjpm->jpm_JP);
|
||||
pop1 = (Pjpm->jpm_Pop0) + 1;
|
||||
|
||||
// goto SMByCount;
|
||||
}
|
||||
|
||||
// COMMON CODE:
|
||||
//
|
||||
// Prepare to handle a root-level or lower-level branch: Save the current
|
||||
// state, obtain the total population for the branch in a state-dependent way,
|
||||
// and then branch to common code for multiple cases.
|
||||
//
|
||||
// For root-level branches, the state is always cJU_ROOTSTATE, and the array
|
||||
// population must already be set in pop1; it is not available in jp_DcdPopO.
|
||||
//
|
||||
// Note: The total population is only needed in cases where the common code
|
||||
// "counts down" instead of up to minimize cache line fills. However, its
|
||||
// available cheaply, and its better to do it with a constant shift (constant
|
||||
// state value) instead of a variable shift later "when needed".
|
||||
|
||||
#define PREPB_ROOT(Next) \
|
||||
state = cJU_ROOTSTATE; \
|
||||
goto Next
|
||||
|
||||
// Use PREPB_DCD() to first copy the Dcd bytes to *PIndex if there are any
|
||||
// (only if state < cJU_ROOTSTATE - 1):
|
||||
|
||||
#define PREPB_DCD(Pjp,cState,Next) \
|
||||
JU_SETDCD(*PIndex, Pjp, cState); \
|
||||
PREPB((Pjp), cState, Next)
|
||||
|
||||
#define PREPB(Pjp,cState,Next) \
|
||||
state = (cState); \
|
||||
pop1 = JU_JPBRANCH_POP0(Pjp, (cState)) + 1; \
|
||||
goto Next
|
||||
|
||||
// Calculate whether the ordinal of an Index within a given expanse falls in
|
||||
// the lower or upper half of the expanses population, taking care with
|
||||
// unsigned math and boundary conditions:
|
||||
//
|
||||
// Note: Assume the ordinal falls within the expanses population, that is,
|
||||
// 0 < (Count - Pop1lower) <= Pop1exp (assuming infinite math).
|
||||
//
|
||||
// Note: If the ordinal is the middle element, it doesnt matter whether
|
||||
// LOWERHALF() is TRUE or FALSE.
|
||||
|
||||
#define LOWERHALF(Count0,Pop1lower,Pop1exp) \
|
||||
(((Count0) - (Pop1lower)) < ((Pop1exp) / 2))
|
||||
|
||||
// Calculate the (signed) offset within a leaf to the desired ordinal (Count -
|
||||
// Pop1lower; offset is one less), and optionally ensure its in range:
|
||||
|
||||
#define SETOFFSET(Offset,Count0,Pop1lower,Pjp) \
|
||||
(Offset) = (Count0) - (Pop1lower); \
|
||||
assert((Offset) >= 0); \
|
||||
assert((Offset) <= JU_JPLEAF_POP0(Pjp))
|
||||
|
||||
// Variations for immediate indexes, with and without pop1-specific assertions:
|
||||
|
||||
#define SETOFFSET_IMM_CK(Offset,Count0,Pop1lower,cPop1) \
|
||||
(Offset) = (Count0) - (Pop1lower); \
|
||||
assert((Offset) >= 0); \
|
||||
assert((Offset) < (cPop1))
|
||||
|
||||
#define SETOFFSET_IMM(Offset,Count0,Pop1lower) \
|
||||
(Offset) = (Count0) - (Pop1lower)
|
||||
|
||||
|
||||
// STATE MACHINE -- TRAVERSE TREE:
|
||||
//
|
||||
// In branches, look for the expanse (digit), if any, where the total pop1
|
||||
// below or at that expanse would meet or exceed Count, meaning the Index must
|
||||
// be in this expanse.
|
||||
|
||||
SMByCount: // return here for next branch/leaf.
|
||||
|
||||
switch (JU_JPTYPE(Pjp))
|
||||
{
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// LINEAR BRANCH; count populations in JPs in the JBL upwards until finding the
|
||||
// expanse (digit) containing Count, and "recurse".
|
||||
//
|
||||
// Note: There are no null JPs in a JBL; watch out for pop1 == 0.
|
||||
//
|
||||
// Note: A JBL should always fit in one cache line => no need to count up
|
||||
// versus down to save cache line fills.
|
||||
//
|
||||
// TBD: The previous is no longer true. Consider enhancing this code to count
|
||||
// up/down, but it can wait for a later tuning phase. In the meantime, PREPB()
|
||||
// sets pop1 for the whole array, but that value is not used here. 001215:
|
||||
// Maybe its true again?
|
||||
|
||||
case cJU_JPBRANCH_L2: PREPB_DCD(Pjp, 2, BranchL);
|
||||
#ifndef JU_64BIT
|
||||
case cJU_JPBRANCH_L3: PREPB( Pjp, 3, BranchL);
|
||||
#else
|
||||
case cJU_JPBRANCH_L3: PREPB_DCD(Pjp, 3, BranchL);
|
||||
case cJU_JPBRANCH_L4: PREPB_DCD(Pjp, 4, BranchL);
|
||||
case cJU_JPBRANCH_L5: PREPB_DCD(Pjp, 5, BranchL);
|
||||
case cJU_JPBRANCH_L6: PREPB_DCD(Pjp, 6, BranchL);
|
||||
case cJU_JPBRANCH_L7: PREPB( Pjp, 7, BranchL);
|
||||
#endif
|
||||
case cJU_JPBRANCH_L: PREPB_ROOT( BranchL);
|
||||
{
|
||||
Pjbl_t Pjbl;
|
||||
|
||||
// Common code (state-independent) for all cases of linear branches:
|
||||
|
||||
BranchL:
|
||||
Pjbl = P_JBL(Pjp->jp_Addr);
|
||||
|
||||
for (jpnum = 0; jpnum < (Pjbl->jbl_NumJPs); ++jpnum)
|
||||
{
|
||||
if ((pop1 = j__udyJPPop1((Pjbl->jbl_jp) + jpnum))
|
||||
== cJU_ALLONES)
|
||||
{
|
||||
JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT);
|
||||
JUDY1CODE(return(JERRI );)
|
||||
JUDYLCODE(return(PPJERR);)
|
||||
}
|
||||
assert(pop1 != 0);
|
||||
|
||||
// Warning: pop1lower and pop1 are unsigned, so do not subtract 1 and compare
|
||||
// >=, but instead use the following expression:
|
||||
|
||||
if (pop1lower + pop1 > Count0) // Index is in this expanse.
|
||||
{
|
||||
JU_SETDIGIT(*PIndex, Pjbl->jbl_Expanse[jpnum], state);
|
||||
Pjp = (Pjbl->jbl_jp) + jpnum;
|
||||
goto SMByCount; // look under this expanse.
|
||||
}
|
||||
|
||||
pop1lower += pop1; // add this JPs pop1.
|
||||
}
|
||||
|
||||
JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT); // should never get here.
|
||||
JUDY1CODE(return(JERRI );)
|
||||
JUDYLCODE(return(PPJERR);)
|
||||
|
||||
} // case cJU_JPBRANCH_L
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// BITMAP BRANCH; count populations in JPs in the JBB upwards or downwards
|
||||
// until finding the expanse (digit) containing Count, and "recurse".
|
||||
//
|
||||
// Note: There are no null JPs in a JBB; watch out for pop1 == 0.
|
||||
|
||||
case cJU_JPBRANCH_B2: PREPB_DCD(Pjp, 2, BranchB);
|
||||
#ifndef JU_64BIT
|
||||
case cJU_JPBRANCH_B3: PREPB( Pjp, 3, BranchB);
|
||||
#else
|
||||
case cJU_JPBRANCH_B3: PREPB_DCD(Pjp, 3, BranchB);
|
||||
case cJU_JPBRANCH_B4: PREPB_DCD(Pjp, 4, BranchB);
|
||||
case cJU_JPBRANCH_B5: PREPB_DCD(Pjp, 5, BranchB);
|
||||
case cJU_JPBRANCH_B6: PREPB_DCD(Pjp, 6, BranchB);
|
||||
case cJU_JPBRANCH_B7: PREPB( Pjp, 7, BranchB);
|
||||
#endif
|
||||
case cJU_JPBRANCH_B: PREPB_ROOT( BranchB);
|
||||
{
|
||||
Pjbb_t Pjbb;
|
||||
|
||||
// Common code (state-independent) for all cases of bitmap branches:
|
||||
|
||||
BranchB:
|
||||
Pjbb = P_JBB(Pjp->jp_Addr);
|
||||
|
||||
// Shorthand for one subexpanse in a bitmap and for one JP in a bitmap branch:
|
||||
//
|
||||
// Note: BMPJP0 exists separately to support assertions.
|
||||
|
||||
#define BMPJP0(Subexp) (P_JP(JU_JBB_PJP(Pjbb, Subexp)))
|
||||
#define BMPJP(Subexp,JPnum) (BMPJP0(Subexp) + (JPnum))
|
||||
|
||||
|
||||
// Common code for descending through a JP:
|
||||
//
|
||||
// Determine the digit for the expanse and save it in *PIndex; then "recurse".
|
||||
|
||||
#define JBB_FOUNDEXPANSE \
|
||||
{ \
|
||||
JU_BITMAPDIGITB(digit, subexp, JU_JBB_BITMAP(Pjbb,subexp), jpnum); \
|
||||
JU_SETDIGIT(*PIndex, digit, state); \
|
||||
Pjp = BMPJP(subexp, jpnum); \
|
||||
goto SMByCount; \
|
||||
}
|
||||
|
||||
|
||||
#ifndef NOSMARTJBB // enable to turn off smart code for comparison purposes.
|
||||
|
||||
// FIGURE OUT WHICH DIRECTION CAUSES FEWER CACHE LINE FILLS; adding the pop1s
|
||||
// in JPs upwards, or subtracting the pop1s in JPs downwards:
|
||||
//
|
||||
// See header comments about limitations of this for Judy*ByCount().
|
||||
|
||||
#endif
|
||||
|
||||
// COUNT UPWARD, adding each "below" JPs pop1:
|
||||
|
||||
#ifndef NOSMARTJBB // enable to turn off smart code for comparison purposes.
|
||||
|
||||
if (LOWERHALF(Count0, pop1lower, pop1))
|
||||
{
|
||||
#endif
|
||||
#ifdef SMARTMETRICS
|
||||
++jbb_upward;
|
||||
#endif
|
||||
for (subexp = 0; subexp < cJU_NUMSUBEXPB; ++subexp)
|
||||
{
|
||||
if ((jpcount = j__udyCountBitsB(JU_JBB_BITMAP(Pjbb,subexp)))
|
||||
&& (BMPJP0(subexp) == (Pjp_t) NULL))
|
||||
{
|
||||
JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT); // null ptr.
|
||||
JUDY1CODE(return(JERRI );)
|
||||
JUDYLCODE(return(PPJERR);)
|
||||
}
|
||||
|
||||
// Note: An empty subexpanse (jpcount == 0) is handled "for free":
|
||||
|
||||
for (jpnum = 0; jpnum < jpcount; ++jpnum)
|
||||
{
|
||||
if ((pop1 = j__udyJPPop1(BMPJP(subexp, jpnum)))
|
||||
== cJU_ALLONES)
|
||||
{
|
||||
JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT);
|
||||
JUDY1CODE(return(JERRI );)
|
||||
JUDYLCODE(return(PPJERR);)
|
||||
}
|
||||
assert(pop1 != 0);
|
||||
|
||||
// Warning: pop1lower and pop1 are unsigned, see earlier comment:
|
||||
|
||||
if (pop1lower + pop1 > Count0)
|
||||
JBB_FOUNDEXPANSE; // Index is in this expanse.
|
||||
|
||||
pop1lower += pop1; // add this JPs pop1.
|
||||
}
|
||||
}
|
||||
#ifndef NOSMARTJBB // enable to turn off smart code for comparison purposes.
|
||||
}
|
||||
|
||||
|
||||
// COUNT DOWNWARD, subtracting each "above" JPs pop1 from the whole expanses
|
||||
// pop1:
|
||||
|
||||
else
|
||||
{
|
||||
#ifdef SMARTMETRICS
|
||||
++jbb_downward;
|
||||
#endif
|
||||
pop1lower += pop1; // add whole branch to start.
|
||||
|
||||
for (subexp = cJU_NUMSUBEXPB - 1; subexp >= 0; --subexp)
|
||||
{
|
||||
if ((jpcount = j__udyCountBitsB(JU_JBB_BITMAP(Pjbb, subexp)))
|
||||
&& (BMPJP0(subexp) == (Pjp_t) NULL))
|
||||
{
|
||||
JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT); // null ptr.
|
||||
JUDY1CODE(return(JERRI );)
|
||||
JUDYLCODE(return(PPJERR);)
|
||||
}
|
||||
|
||||
// Note: An empty subexpanse (jpcount == 0) is handled "for free":
|
||||
|
||||
for (jpnum = jpcount - 1; jpnum >= 0; --jpnum)
|
||||
{
|
||||
if ((pop1 = j__udyJPPop1(BMPJP(subexp, jpnum)))
|
||||
== cJU_ALLONES)
|
||||
{
|
||||
JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT);
|
||||
JUDY1CODE(return(JERRI );)
|
||||
JUDYLCODE(return(PPJERR);)
|
||||
}
|
||||
assert(pop1 != 0);
|
||||
|
||||
// Warning: pop1lower and pop1 are unsigned, see earlier comment:
|
||||
|
||||
pop1lower -= pop1;
|
||||
|
||||
// Beware unsigned math problems:
|
||||
|
||||
if ((pop1lower == 0) || (pop1lower - 1 < Count0))
|
||||
JBB_FOUNDEXPANSE; // Index is in this expanse.
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // NOSMARTJBB
|
||||
|
||||
JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT); // should never get here.
|
||||
JUDY1CODE(return(JERRI );)
|
||||
JUDYLCODE(return(PPJERR);)
|
||||
|
||||
} // case cJU_JPBRANCH_B
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// UNCOMPRESSED BRANCH; count populations in JPs in the JBU upwards or
|
||||
// downwards until finding the expanse (digit) containing Count, and "recurse".
|
||||
|
||||
case cJU_JPBRANCH_U2: PREPB_DCD(Pjp, 2, BranchU);
|
||||
#ifndef JU_64BIT
|
||||
case cJU_JPBRANCH_U3: PREPB( Pjp, 3, BranchU);
|
||||
#else
|
||||
case cJU_JPBRANCH_U3: PREPB_DCD(Pjp, 3, BranchU);
|
||||
case cJU_JPBRANCH_U4: PREPB_DCD(Pjp, 4, BranchU);
|
||||
case cJU_JPBRANCH_U5: PREPB_DCD(Pjp, 5, BranchU);
|
||||
case cJU_JPBRANCH_U6: PREPB_DCD(Pjp, 6, BranchU);
|
||||
case cJU_JPBRANCH_U7: PREPB( Pjp, 7, BranchU);
|
||||
#endif
|
||||
case cJU_JPBRANCH_U: PREPB_ROOT( BranchU);
|
||||
{
|
||||
Pjbu_t Pjbu;
|
||||
|
||||
// Common code (state-independent) for all cases of uncompressed branches:
|
||||
|
||||
BranchU:
|
||||
Pjbu = P_JBU(Pjp->jp_Addr);
|
||||
|
||||
// Common code for descending through a JP:
|
||||
//
|
||||
// Save the digit for the expanse in *PIndex, then "recurse".
|
||||
|
||||
#define JBU_FOUNDEXPANSE \
|
||||
{ \
|
||||
JU_SETDIGIT(*PIndex, jpnum, state); \
|
||||
Pjp = (Pjbu->jbu_jp) + jpnum; \
|
||||
goto SMByCount; \
|
||||
}
|
||||
|
||||
|
||||
#ifndef NOSMARTJBU // enable to turn off smart code for comparison purposes.
|
||||
|
||||
// FIGURE OUT WHICH DIRECTION CAUSES FEWER CACHE LINE FILLS; adding the pop1s
|
||||
// in JPs upwards, or subtracting the pop1s in JPs downwards:
|
||||
//
|
||||
// See header comments about limitations of this for Judy*ByCount().
|
||||
|
||||
#endif
|
||||
|
||||
// COUNT UPWARD, simply adding the pop1 of each JP:
|
||||
|
||||
#ifndef NOSMARTJBU // enable to turn off smart code for comparison purposes.
|
||||
|
||||
if (LOWERHALF(Count0, pop1lower, pop1))
|
||||
{
|
||||
#endif
|
||||
#ifdef SMARTMETRICS
|
||||
++jbu_upward;
|
||||
#endif
|
||||
|
||||
for (jpnum = 0; jpnum < cJU_BRANCHUNUMJPS; ++jpnum)
|
||||
{
|
||||
// shortcut, save a function call:
|
||||
|
||||
if ((Pjbu->jbu_jp[jpnum].jp_Type) <= cJU_JPNULLMAX)
|
||||
continue;
|
||||
|
||||
if ((pop1 = j__udyJPPop1((Pjbu->jbu_jp) + jpnum))
|
||||
== cJU_ALLONES)
|
||||
{
|
||||
JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT);
|
||||
JUDY1CODE(return(JERRI );)
|
||||
JUDYLCODE(return(PPJERR);)
|
||||
}
|
||||
assert(pop1 != 0);
|
||||
|
||||
// Warning: pop1lower and pop1 are unsigned, see earlier comment:
|
||||
|
||||
if (pop1lower + pop1 > Count0)
|
||||
JBU_FOUNDEXPANSE; // Index is in this expanse.
|
||||
|
||||
pop1lower += pop1; // add this JPs pop1.
|
||||
}
|
||||
#ifndef NOSMARTJBU // enable to turn off smart code for comparison purposes.
|
||||
}
|
||||
|
||||
|
||||
// COUNT DOWNWARD, subtracting the pop1 of each JP above from the whole
|
||||
// expanses pop1:
|
||||
|
||||
else
|
||||
{
|
||||
#ifdef SMARTMETRICS
|
||||
++jbu_downward;
|
||||
#endif
|
||||
pop1lower += pop1; // add whole branch to start.
|
||||
|
||||
for (jpnum = cJU_BRANCHUNUMJPS - 1; jpnum >= 0; --jpnum)
|
||||
{
|
||||
// shortcut, save a function call:
|
||||
|
||||
if ((Pjbu->jbu_jp[jpnum].jp_Type) <= cJU_JPNULLMAX)
|
||||
continue;
|
||||
|
||||
if ((pop1 = j__udyJPPop1(Pjbu->jbu_jp + jpnum))
|
||||
== cJU_ALLONES)
|
||||
{
|
||||
JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT);
|
||||
JUDY1CODE(return(JERRI );)
|
||||
JUDYLCODE(return(PPJERR);)
|
||||
}
|
||||
assert(pop1 != 0);
|
||||
|
||||
// Warning: pop1lower and pop1 are unsigned, see earlier comment:
|
||||
|
||||
pop1lower -= pop1;
|
||||
|
||||
// Beware unsigned math problems:
|
||||
|
||||
if ((pop1lower == 0) || (pop1lower - 1 < Count0))
|
||||
JBU_FOUNDEXPANSE; // Index is in this expanse.
|
||||
}
|
||||
}
|
||||
#endif // NOSMARTJBU
|
||||
|
||||
JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT); // should never get here.
|
||||
JUDY1CODE(return(JERRI );)
|
||||
JUDYLCODE(return(PPJERR);)
|
||||
|
||||
} // case cJU_JPBRANCH_U
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// LINEAR LEAF:
|
||||
//
|
||||
// Return the Index at the proper ordinal (see SETOFFSET()) in the leaf. First
|
||||
// copy Dcd bytes, if there are any (only if state < cJU_ROOTSTATE - 1), to
|
||||
// *PIndex.
|
||||
//
|
||||
// Note: The preceding branch traversal code MIGHT set pop1 for this expanse
|
||||
// (linear leaf) as a side-effect, but dont depend on that (for JUDYL, which
|
||||
// is the only cases that need it anyway).
|
||||
|
||||
#define PREPL_DCD(cState) \
|
||||
JU_SETDCD(*PIndex, Pjp, cState); \
|
||||
PREPL
|
||||
|
||||
#ifdef JUDY1
|
||||
#define PREPL_SETPOP1 // not needed in any cases.
|
||||
#else
|
||||
#define PREPL_SETPOP1 pop1 = JU_JPLEAF_POP0(Pjp) + 1
|
||||
#endif
|
||||
|
||||
#define PREPL \
|
||||
Pjll = P_JLL(Pjp->jp_Addr); \
|
||||
PREPL_SETPOP1; \
|
||||
SETOFFSET(offset, Count0, pop1lower, Pjp)
|
||||
|
||||
#if (defined(JUDYL) || (! defined(JU_64BIT)))
|
||||
case cJU_JPLEAF1:
|
||||
|
||||
PREPL_DCD(1);
|
||||
JU_SETDIGIT1(*PIndex, ((uint8_t *) Pjll)[offset]);
|
||||
JU_RET_FOUND_LEAF1(Pjll, pop1, offset);
|
||||
#endif
|
||||
|
||||
case cJU_JPLEAF2:
|
||||
|
||||
PREPL_DCD(2);
|
||||
*PIndex = (*PIndex & (~JU_LEASTBYTESMASK(2)))
|
||||
| ((uint16_t *) Pjll)[offset];
|
||||
JU_RET_FOUND_LEAF2(Pjll, pop1, offset);
|
||||
|
||||
#ifndef JU_64BIT
|
||||
case cJU_JPLEAF3:
|
||||
{
|
||||
Word_t lsb;
|
||||
PREPL;
|
||||
JU_COPY3_PINDEX_TO_LONG(lsb, ((uint8_t *) Pjll) + (3 * offset));
|
||||
*PIndex = (*PIndex & (~JU_LEASTBYTESMASK(3))) | lsb;
|
||||
JU_RET_FOUND_LEAF3(Pjll, pop1, offset);
|
||||
}
|
||||
|
||||
#else
|
||||
case cJU_JPLEAF3:
|
||||
{
|
||||
Word_t lsb;
|
||||
PREPL_DCD(3);
|
||||
JU_COPY3_PINDEX_TO_LONG(lsb, ((uint8_t *) Pjll) + (3 * offset));
|
||||
*PIndex = (*PIndex & (~JU_LEASTBYTESMASK(3))) | lsb;
|
||||
JU_RET_FOUND_LEAF3(Pjll, pop1, offset);
|
||||
}
|
||||
|
||||
case cJU_JPLEAF4:
|
||||
|
||||
PREPL_DCD(4);
|
||||
*PIndex = (*PIndex & (~JU_LEASTBYTESMASK(4)))
|
||||
| ((uint32_t *) Pjll)[offset];
|
||||
JU_RET_FOUND_LEAF4(Pjll, pop1, offset);
|
||||
|
||||
case cJU_JPLEAF5:
|
||||
{
|
||||
Word_t lsb;
|
||||
PREPL_DCD(5);
|
||||
JU_COPY5_PINDEX_TO_LONG(lsb, ((uint8_t *) Pjll) + (5 * offset));
|
||||
*PIndex = (*PIndex & (~JU_LEASTBYTESMASK(5))) | lsb;
|
||||
JU_RET_FOUND_LEAF5(Pjll, pop1, offset);
|
||||
}
|
||||
|
||||
case cJU_JPLEAF6:
|
||||
{
|
||||
Word_t lsb;
|
||||
PREPL_DCD(6);
|
||||
JU_COPY6_PINDEX_TO_LONG(lsb, ((uint8_t *) Pjll) + (6 * offset));
|
||||
*PIndex = (*PIndex & (~JU_LEASTBYTESMASK(6))) | lsb;
|
||||
JU_RET_FOUND_LEAF6(Pjll, pop1, offset);
|
||||
}
|
||||
|
||||
case cJU_JPLEAF7:
|
||||
{
|
||||
Word_t lsb;
|
||||
PREPL;
|
||||
JU_COPY7_PINDEX_TO_LONG(lsb, ((uint8_t *) Pjll) + (7 * offset));
|
||||
*PIndex = (*PIndex & (~JU_LEASTBYTESMASK(7))) | lsb;
|
||||
JU_RET_FOUND_LEAF7(Pjll, pop1, offset);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// BITMAP LEAF:
|
||||
//
|
||||
// Return the Index at the proper ordinal (see SETOFFSET()) in the leaf by
|
||||
// counting bits. First copy Dcd bytes (always present since state 1 <
|
||||
// cJU_ROOTSTATE) to *PIndex.
|
||||
//
|
||||
// Note: The preceding branch traversal code MIGHT set pop1 for this expanse
|
||||
// (bitmap leaf) as a side-effect, but dont depend on that.
|
||||
|
||||
case cJU_JPLEAF_B1:
|
||||
{
|
||||
Pjlb_t Pjlb;
|
||||
|
||||
JU_SETDCD(*PIndex, Pjp, 1);
|
||||
Pjlb = P_JLB(Pjp->jp_Addr);
|
||||
pop1 = JU_JPLEAF_POP0(Pjp) + 1;
|
||||
|
||||
// COUNT UPWARD, adding the pop1 of each subexpanse:
|
||||
//
|
||||
// The entire bitmap should fit in one cache line, but still try to save some
|
||||
// CPU time by counting the fewest possible number of subexpanses from the
|
||||
// bitmap.
|
||||
//
|
||||
// See header comments about limitations of this for Judy*ByCount().
|
||||
|
||||
#ifndef NOSMARTJLB // enable to turn off smart code for comparison purposes.
|
||||
|
||||
if (LOWERHALF(Count0, pop1lower, pop1))
|
||||
{
|
||||
#endif
|
||||
#ifdef SMARTMETRICS
|
||||
++jlb_upward;
|
||||
#endif
|
||||
for (subexp = 0; subexp < cJU_NUMSUBEXPL; ++subexp)
|
||||
{
|
||||
pop1 = j__udyCountBitsL(JU_JLB_BITMAP(Pjlb, subexp));
|
||||
|
||||
// Warning: pop1lower and pop1 are unsigned, see earlier comment:
|
||||
|
||||
if (pop1lower + pop1 > Count0)
|
||||
goto LeafB1; // Index is in this subexpanse.
|
||||
|
||||
pop1lower += pop1; // add this subexpanses pop1.
|
||||
}
|
||||
#ifndef NOSMARTJLB // enable to turn off smart code for comparison purposes.
|
||||
}
|
||||
|
||||
|
||||
// COUNT DOWNWARD, subtracting each "above" subexpanses pop1 from the whole
|
||||
// expanses pop1:
|
||||
|
||||
else
|
||||
{
|
||||
#ifdef SMARTMETRICS
|
||||
++jlb_downward;
|
||||
#endif
|
||||
pop1lower += pop1; // add whole leaf to start.
|
||||
|
||||
for (subexp = cJU_NUMSUBEXPL - 1; subexp >= 0; --subexp)
|
||||
{
|
||||
pop1lower -= j__udyCountBitsL(JU_JLB_BITMAP(Pjlb, subexp));
|
||||
|
||||
// Beware unsigned math problems:
|
||||
|
||||
if ((pop1lower == 0) || (pop1lower - 1 < Count0))
|
||||
goto LeafB1; // Index is in this subexpanse.
|
||||
}
|
||||
}
|
||||
#endif // NOSMARTJLB
|
||||
|
||||
JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT); // should never get here.
|
||||
JUDY1CODE(return(JERRI );)
|
||||
JUDYLCODE(return(PPJERR);)
|
||||
|
||||
|
||||
// RETURN INDEX FOUND:
|
||||
//
|
||||
// Come here with subexp set to the correct subexpanse, and pop1lower set to
|
||||
// the sum for all lower expanses and subexpanses in the Judy tree. Calculate
|
||||
// and save in *PIndex the digit corresponding to the ordinal in this
|
||||
// subexpanse.
|
||||
|
||||
LeafB1:
|
||||
SETOFFSET(offset, Count0, pop1lower, Pjp);
|
||||
JU_BITMAPDIGITL(digit, subexp, JU_JLB_BITMAP(Pjlb, subexp), offset);
|
||||
JU_SETDIGIT1(*PIndex, digit);
|
||||
JU_RET_FOUND_LEAF_B1(Pjlb, subexp, offset);
|
||||
// == return((PPvoid_t) (P_JV(JL_JLB_PVALUE(Pjlb, subexp)) + offset))
|
||||
|
||||
} // case cJU_JPLEAF_B1
|
||||
|
||||
|
||||
#ifdef JUDY1
|
||||
// ----------------------------------------------------------------------------
|
||||
// FULL POPULATION:
|
||||
//
|
||||
// Copy Dcd bytes (always present since state 1 < cJU_ROOTSTATE) to *PIndex,
|
||||
// then set the appropriate digit for the ordinal (see SETOFFSET()) in the leaf
|
||||
// as the LSB in *PIndex.
|
||||
|
||||
case cJ1_JPFULLPOPU1:
|
||||
|
||||
JU_SETDCD(*PIndex, Pjp, 1);
|
||||
SETOFFSET(offset, Count0, pop1lower, Pjp);
|
||||
assert(offset >= 0);
|
||||
assert(offset <= cJU_JPFULLPOPU1_POP0);
|
||||
JU_SETDIGIT1(*PIndex, offset);
|
||||
JU_RET_FOUND_FULLPOPU1;
|
||||
#endif
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// IMMEDIATE:
|
||||
//
|
||||
// Locate the Index with the proper ordinal (see SETOFFSET()) in the Immediate,
|
||||
// depending on leaf Index Size and pop1. Note: There are no Dcd bytes in an
|
||||
// Immediate JP, but in a cJU_JPIMMED_*_01 JP, the field holds the least bytes
|
||||
// of the immediate Index.
|
||||
|
||||
#define SET_01(cState) JU_SETDIGITS(*PIndex, JU_JPDCDPOP0(Pjp), cState)
|
||||
|
||||
case cJU_JPIMMED_1_01: SET_01(1); goto Imm_01;
|
||||
case cJU_JPIMMED_2_01: SET_01(2); goto Imm_01;
|
||||
case cJU_JPIMMED_3_01: SET_01(3); goto Imm_01;
|
||||
#ifdef JU_64BIT
|
||||
case cJU_JPIMMED_4_01: SET_01(4); goto Imm_01;
|
||||
case cJU_JPIMMED_5_01: SET_01(5); goto Imm_01;
|
||||
case cJU_JPIMMED_6_01: SET_01(6); goto Imm_01;
|
||||
case cJU_JPIMMED_7_01: SET_01(7); goto Imm_01;
|
||||
#endif
|
||||
|
||||
Imm_01:
|
||||
|
||||
DBGCODE(SETOFFSET_IMM_CK(offset, Count0, pop1lower, 1);)
|
||||
JU_RET_FOUND_IMM_01(Pjp);
|
||||
|
||||
// Shorthand for where to find start of Index bytes array:
|
||||
|
||||
#ifdef JUDY1
|
||||
#define PJI (Pjp->jp_1Index)
|
||||
#else
|
||||
#define PJI (Pjp->jp_LIndex)
|
||||
#endif
|
||||
|
||||
// Optional code to check the remaining ordinal (see SETOFFSET_IMM()) against
|
||||
// the Index Size of the Immediate:
|
||||
|
||||
#ifndef DEBUG // simple placeholder:
|
||||
#define IMM(cPop1,Next) \
|
||||
goto Next
|
||||
#else // extra pop1-specific checking:
|
||||
#define IMM(cPop1,Next) \
|
||||
SETOFFSET_IMM_CK(offset, Count0, pop1lower, cPop1); \
|
||||
goto Next
|
||||
#endif
|
||||
|
||||
case cJU_JPIMMED_1_02: IMM( 2, Imm1);
|
||||
case cJU_JPIMMED_1_03: IMM( 3, Imm1);
|
||||
#if (defined(JUDY1) || defined(JU_64BIT))
|
||||
case cJU_JPIMMED_1_04: IMM( 4, Imm1);
|
||||
case cJU_JPIMMED_1_05: IMM( 5, Imm1);
|
||||
case cJU_JPIMMED_1_06: IMM( 6, Imm1);
|
||||
case cJU_JPIMMED_1_07: IMM( 7, Imm1);
|
||||
#endif
|
||||
#if (defined(JUDY1) && defined(JU_64BIT))
|
||||
case cJ1_JPIMMED_1_08: IMM( 8, Imm1);
|
||||
case cJ1_JPIMMED_1_09: IMM( 9, Imm1);
|
||||
case cJ1_JPIMMED_1_10: IMM(10, Imm1);
|
||||
case cJ1_JPIMMED_1_11: IMM(11, Imm1);
|
||||
case cJ1_JPIMMED_1_12: IMM(12, Imm1);
|
||||
case cJ1_JPIMMED_1_13: IMM(13, Imm1);
|
||||
case cJ1_JPIMMED_1_14: IMM(14, Imm1);
|
||||
case cJ1_JPIMMED_1_15: IMM(15, Imm1);
|
||||
#endif
|
||||
|
||||
Imm1: SETOFFSET_IMM(offset, Count0, pop1lower);
|
||||
JU_SETDIGIT1(*PIndex, ((uint8_t *) PJI)[offset]);
|
||||
JU_RET_FOUND_IMM(Pjp, offset);
|
||||
|
||||
#if (defined(JUDY1) || defined(JU_64BIT))
|
||||
case cJU_JPIMMED_2_02: IMM(2, Imm2);
|
||||
case cJU_JPIMMED_2_03: IMM(3, Imm2);
|
||||
#endif
|
||||
#if (defined(JUDY1) && defined(JU_64BIT))
|
||||
case cJ1_JPIMMED_2_04: IMM(4, Imm2);
|
||||
case cJ1_JPIMMED_2_05: IMM(5, Imm2);
|
||||
case cJ1_JPIMMED_2_06: IMM(6, Imm2);
|
||||
case cJ1_JPIMMED_2_07: IMM(7, Imm2);
|
||||
#endif
|
||||
|
||||
#if (defined(JUDY1) || defined(JU_64BIT))
|
||||
Imm2: SETOFFSET_IMM(offset, Count0, pop1lower);
|
||||
*PIndex = (*PIndex & (~JU_LEASTBYTESMASK(2)))
|
||||
| ((uint16_t *) PJI)[offset];
|
||||
JU_RET_FOUND_IMM(Pjp, offset);
|
||||
#endif
|
||||
|
||||
#if (defined(JUDY1) || defined(JU_64BIT))
|
||||
case cJU_JPIMMED_3_02: IMM(2, Imm3);
|
||||
#endif
|
||||
#if (defined(JUDY1) && defined(JU_64BIT))
|
||||
case cJ1_JPIMMED_3_03: IMM(3, Imm3);
|
||||
case cJ1_JPIMMED_3_04: IMM(4, Imm3);
|
||||
case cJ1_JPIMMED_3_05: IMM(5, Imm3);
|
||||
#endif
|
||||
|
||||
#if (defined(JUDY1) || defined(JU_64BIT))
|
||||
Imm3:
|
||||
{
|
||||
Word_t lsb;
|
||||
SETOFFSET_IMM(offset, Count0, pop1lower);
|
||||
JU_COPY3_PINDEX_TO_LONG(lsb, ((uint8_t *) PJI) + (3 * offset));
|
||||
*PIndex = (*PIndex & (~JU_LEASTBYTESMASK(3))) | lsb;
|
||||
JU_RET_FOUND_IMM(Pjp, offset);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if (defined(JUDY1) && defined(JU_64BIT))
|
||||
case cJ1_JPIMMED_4_02: IMM(2, Imm4);
|
||||
case cJ1_JPIMMED_4_03: IMM(3, Imm4);
|
||||
|
||||
Imm4: SETOFFSET_IMM(offset, Count0, pop1lower);
|
||||
*PIndex = (*PIndex & (~JU_LEASTBYTESMASK(4)))
|
||||
| ((uint32_t *) PJI)[offset];
|
||||
JU_RET_FOUND_IMM(Pjp, offset);
|
||||
|
||||
case cJ1_JPIMMED_5_02: IMM(2, Imm5);
|
||||
case cJ1_JPIMMED_5_03: IMM(3, Imm5);
|
||||
|
||||
Imm5:
|
||||
{
|
||||
Word_t lsb;
|
||||
SETOFFSET_IMM(offset, Count0, pop1lower);
|
||||
JU_COPY5_PINDEX_TO_LONG(lsb, ((uint8_t *) PJI) + (5 * offset));
|
||||
*PIndex = (*PIndex & (~JU_LEASTBYTESMASK(5))) | lsb;
|
||||
JU_RET_FOUND_IMM(Pjp, offset);
|
||||
}
|
||||
|
||||
case cJ1_JPIMMED_6_02: IMM(2, Imm6);
|
||||
|
||||
Imm6:
|
||||
{
|
||||
Word_t lsb;
|
||||
SETOFFSET_IMM(offset, Count0, pop1lower);
|
||||
JU_COPY6_PINDEX_TO_LONG(lsb, ((uint8_t *) PJI) + (6 * offset));
|
||||
*PIndex = (*PIndex & (~JU_LEASTBYTESMASK(6))) | lsb;
|
||||
JU_RET_FOUND_IMM(Pjp, offset);
|
||||
}
|
||||
|
||||
case cJ1_JPIMMED_7_02: IMM(2, Imm7);
|
||||
|
||||
Imm7:
|
||||
{
|
||||
Word_t lsb;
|
||||
SETOFFSET_IMM(offset, Count0, pop1lower);
|
||||
JU_COPY7_PINDEX_TO_LONG(lsb, ((uint8_t *) PJI) + (7 * offset));
|
||||
*PIndex = (*PIndex & (~JU_LEASTBYTESMASK(7))) | lsb;
|
||||
JU_RET_FOUND_IMM(Pjp, offset);
|
||||
}
|
||||
#endif // (JUDY1 && JU_64BIT)
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// UNEXPECTED JP TYPES:
|
||||
|
||||
default: JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT);
|
||||
JUDY1CODE(return(JERRI );)
|
||||
JUDYLCODE(return(PPJERR);)
|
||||
|
||||
} // SMByCount switch.
|
||||
|
||||
/*NOTREACHED*/
|
||||
|
||||
} // Judy1ByCount() / JudyLByCount()
|
1942
dlls/arrayx/Judy-1.0.1/src/JudyL/JudyLCascade.c
Normal file
1942
dlls/arrayx/Judy-1.0.1/src/JudyL/JudyLCascade.c
Normal file
File diff suppressed because it is too large
Load Diff
1195
dlls/arrayx/Judy-1.0.1/src/JudyL/JudyLCount.c
Normal file
1195
dlls/arrayx/Judy-1.0.1/src/JudyL/JudyLCount.c
Normal file
File diff suppressed because it is too large
Load Diff
314
dlls/arrayx/Judy-1.0.1/src/JudyL/JudyLCreateBranch.c
Normal file
314
dlls/arrayx/Judy-1.0.1/src/JudyL/JudyLCreateBranch.c
Normal file
|
@ -0,0 +1,314 @@
|
|||
// Copyright (C) 2000 - 2002 Hewlett-Packard Company
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify it
|
||||
// under the term of the GNU Lesser General Public License as published by the
|
||||
// Free Software Foundation; either version 2 of the License, or (at your
|
||||
// option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
// for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with this program; if not, write to the Free Software Foundation,
|
||||
// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
// _________________
|
||||
|
||||
// @(#) $Revision$ $Source$
|
||||
|
||||
// Branch creation functions for Judy1 and JudyL.
|
||||
// Compile with one of -DJUDY1 or -DJUDYL.
|
||||
|
||||
#if (! (defined(JUDY1) || defined(JUDYL)))
|
||||
#error: One of -DJUDY1 or -DJUDYL must be specified.
|
||||
#endif
|
||||
|
||||
#ifdef JUDY1
|
||||
#include "Judy1.h"
|
||||
#else
|
||||
#include "JudyL.h"
|
||||
#endif
|
||||
|
||||
#include "JudyPrivate1L.h"
|
||||
|
||||
|
||||
// ****************************************************************************
|
||||
// J U D Y C R E A T E B R A N C H L
|
||||
//
|
||||
// Build a BranchL from an array of JPs and associated 1 byte digits
|
||||
// (expanses). Return with Pjp pointing to the BranchL. Caller must
|
||||
// deallocate passed arrays, if necessary.
|
||||
//
|
||||
// We have no idea what kind of BranchL it is, so caller must set the jp_Type.
|
||||
//
|
||||
// Return -1 if error (details in Pjpm), otherwise return 1.
|
||||
|
||||
FUNCTION int j__udyCreateBranchL(
|
||||
Pjp_t Pjp, // Build JPs from this place
|
||||
Pjp_t PJPs, // Array of JPs to put into Bitmap branch
|
||||
uint8_t Exp[], // Array of expanses to put into bitmap
|
||||
Word_t ExpCnt, // Number of above JPs and Expanses
|
||||
Pvoid_t Pjpm)
|
||||
{
|
||||
Pjbl_t PjblRaw; // pointer to linear branch.
|
||||
Pjbl_t Pjbl;
|
||||
|
||||
assert(ExpCnt <= cJU_BRANCHLMAXJPS);
|
||||
|
||||
PjblRaw = j__udyAllocJBL(Pjpm);
|
||||
if (PjblRaw == (Pjbl_t) NULL) return(-1);
|
||||
Pjbl = P_JBL(PjblRaw);
|
||||
|
||||
// Build a Linear Branch
|
||||
Pjbl->jbl_NumJPs = ExpCnt;
|
||||
|
||||
// Copy from the Linear branch from splayed leaves
|
||||
JU_COPYMEM(Pjbl->jbl_Expanse, Exp, ExpCnt);
|
||||
JU_COPYMEM(Pjbl->jbl_jp, PJPs, ExpCnt);
|
||||
|
||||
// Pass back new pointer to the Linear branch in JP
|
||||
Pjp->jp_Addr = (Word_t) PjblRaw;
|
||||
|
||||
return(1);
|
||||
|
||||
} // j__udyCreateBranchL()
|
||||
|
||||
|
||||
// ****************************************************************************
|
||||
// J U D Y C R E A T E B R A N C H B
|
||||
//
|
||||
// Build a BranchB from an array of JPs and associated 1 byte digits
|
||||
// (expanses). Return with Pjp pointing to the BranchB. Caller must
|
||||
// deallocate passed arrays, if necessary.
|
||||
//
|
||||
// We have no idea what kind of BranchB it is, so caller must set the jp_Type.
|
||||
//
|
||||
// Return -1 if error (details in Pjpm), otherwise return 1.
|
||||
|
||||
FUNCTION int j__udyCreateBranchB(
|
||||
Pjp_t Pjp, // Build JPs from this place
|
||||
Pjp_t PJPs, // Array of JPs to put into Bitmap branch
|
||||
uint8_t Exp[], // Array of expanses to put into bitmap
|
||||
Word_t ExpCnt, // Number of above JPs and Expanses
|
||||
Pvoid_t Pjpm)
|
||||
{
|
||||
Pjbb_t PjbbRaw; // pointer to bitmap branch.
|
||||
Pjbb_t Pjbb;
|
||||
Word_t ii, jj; // Temps
|
||||
uint8_t CurrSubExp; // Current sub expanse for BM
|
||||
|
||||
// This assertion says the number of populated subexpanses is not too large.
|
||||
// This function is only called when a BranchL overflows to a BranchB or when a
|
||||
// cascade occurs, meaning a leaf overflows. Either way ExpCnt cant be very
|
||||
// large, in fact a lot smaller than cJU_BRANCHBMAXJPS. (Otherwise a BranchU
|
||||
// would be used.) Popping this assertion means something (unspecified) has
|
||||
// gone very wrong, or else Judys design criteria have changed, although in
|
||||
// fact there should be no HARM in creating a BranchB with higher actual
|
||||
// fanout.
|
||||
|
||||
assert(ExpCnt <= cJU_BRANCHBMAXJPS);
|
||||
|
||||
// Get memory for a Bitmap branch
|
||||
PjbbRaw = j__udyAllocJBB(Pjpm);
|
||||
if (PjbbRaw == (Pjbb_t) NULL) return(-1);
|
||||
Pjbb = P_JBB(PjbbRaw);
|
||||
|
||||
// Get 1st "sub" expanse (0..7) of bitmap branch
|
||||
CurrSubExp = Exp[0] / cJU_BITSPERSUBEXPB;
|
||||
|
||||
// Index thru all 1 byte sized expanses:
|
||||
|
||||
for (jj = ii = 0; ii <= ExpCnt; ii++)
|
||||
{
|
||||
Word_t SubExp; // Cannot be a uint8_t
|
||||
|
||||
// Make sure we cover the last one
|
||||
if (ii == ExpCnt)
|
||||
{
|
||||
SubExp = cJU_ALLONES; // Force last one
|
||||
}
|
||||
else
|
||||
{
|
||||
// Calculate the "sub" expanse of the byte expanse
|
||||
SubExp = Exp[ii] / cJU_BITSPERSUBEXPB; // Bits 5..7.
|
||||
|
||||
// Set the bit that represents the expanse in Exp[]
|
||||
JU_JBB_BITMAP(Pjbb, SubExp) |= JU_BITPOSMASKB(Exp[ii]);
|
||||
}
|
||||
// Check if a new "sub" expanse range needed
|
||||
if (SubExp != CurrSubExp)
|
||||
{
|
||||
// Get number of JPs in this sub expanse
|
||||
Word_t NumJP = ii - jj;
|
||||
Pjp_t PjpRaw;
|
||||
Pjp_t Pjp;
|
||||
|
||||
PjpRaw = j__udyAllocJBBJP(NumJP, Pjpm);
|
||||
Pjp = P_JP(PjpRaw);
|
||||
|
||||
if (PjpRaw == (Pjp_t) NULL) // out of memory.
|
||||
{
|
||||
|
||||
// Free any previous allocations:
|
||||
|
||||
while(CurrSubExp--)
|
||||
{
|
||||
NumJP = j__udyCountBitsB(JU_JBB_BITMAP(Pjbb,
|
||||
CurrSubExp));
|
||||
if (NumJP)
|
||||
{
|
||||
j__udyFreeJBBJP(JU_JBB_PJP(Pjbb,
|
||||
CurrSubExp), NumJP, Pjpm);
|
||||
}
|
||||
}
|
||||
j__udyFreeJBB(PjbbRaw, Pjpm);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
// Place the array of JPs in bitmap branch:
|
||||
|
||||
JU_JBB_PJP(Pjbb, CurrSubExp) = PjpRaw;
|
||||
|
||||
// Copy the JPs to new leaf:
|
||||
|
||||
JU_COPYMEM(Pjp, PJPs + jj, NumJP);
|
||||
|
||||
// On to the next bitmap branch "sub" expanse:
|
||||
|
||||
jj = ii;
|
||||
CurrSubExp = SubExp;
|
||||
}
|
||||
} // for each 1-byte expanse
|
||||
|
||||
// Pass back some of the JP to the new Bitmap branch:
|
||||
|
||||
Pjp->jp_Addr = (Word_t) PjbbRaw;
|
||||
|
||||
return(1);
|
||||
|
||||
} // j__udyCreateBranchB()
|
||||
|
||||
|
||||
// ****************************************************************************
|
||||
// J U D Y C R E A T E B R A N C H U
|
||||
//
|
||||
// Build a BranchU from a BranchB. Return with Pjp pointing to the BranchU.
|
||||
// Free the BranchB and its JP subarrays.
|
||||
//
|
||||
// Return -1 if error (details in Pjpm), otherwise return 1.
|
||||
|
||||
FUNCTION int j__udyCreateBranchU(
|
||||
Pjp_t Pjp,
|
||||
Pvoid_t Pjpm)
|
||||
{
|
||||
jp_t JPNull;
|
||||
Pjbu_t PjbuRaw;
|
||||
Pjbu_t Pjbu;
|
||||
Pjbb_t PjbbRaw;
|
||||
Pjbb_t Pjbb;
|
||||
Word_t ii, jj;
|
||||
BITMAPB_t BitMap;
|
||||
Pjp_t PDstJP;
|
||||
#ifdef JU_STAGED_EXP
|
||||
jbu_t BranchU; // Staged uncompressed branch
|
||||
#else
|
||||
|
||||
// Allocate memory for a BranchU:
|
||||
|
||||
PjbuRaw = j__udyAllocJBU(Pjpm);
|
||||
if (PjbuRaw == (Pjbu_t) NULL) return(-1);
|
||||
Pjbu = P_JBU(PjbuRaw);
|
||||
#endif
|
||||
JU_JPSETADT(&JPNull, 0, 0, JU_JPTYPE(Pjp) - cJU_JPBRANCH_B2 + cJU_JPNULL1);
|
||||
|
||||
// Get the pointer to the BranchB:
|
||||
|
||||
PjbbRaw = (Pjbb_t) (Pjp->jp_Addr);
|
||||
Pjbb = P_JBB(PjbbRaw);
|
||||
|
||||
// Set the pointer to the Uncompressed branch
|
||||
#ifdef JU_STAGED_EXP
|
||||
PDstJP = BranchU.jbu_jp;
|
||||
#else
|
||||
PDstJP = Pjbu->jbu_jp;
|
||||
#endif
|
||||
for (ii = 0; ii < cJU_NUMSUBEXPB; ii++)
|
||||
{
|
||||
Pjp_t PjpA;
|
||||
Pjp_t PjpB;
|
||||
|
||||
PjpB = PjpA = P_JP(JU_JBB_PJP(Pjbb, ii));
|
||||
|
||||
// Get the bitmap for this subexpanse
|
||||
BitMap = JU_JBB_BITMAP(Pjbb, ii);
|
||||
|
||||
// NULL empty subexpanses
|
||||
if (BitMap == 0)
|
||||
{
|
||||
// But, fill with NULLs
|
||||
for (jj = 0; jj < cJU_BITSPERSUBEXPB; jj++)
|
||||
{
|
||||
PDstJP[jj] = JPNull;
|
||||
}
|
||||
PDstJP += cJU_BITSPERSUBEXPB;
|
||||
continue;
|
||||
}
|
||||
// Check if Uncompressed subexpanse
|
||||
if (BitMap == cJU_FULLBITMAPB)
|
||||
{
|
||||
// Copy subexpanse to the Uncompressed branch intact
|
||||
JU_COPYMEM(PDstJP, PjpA, cJU_BITSPERSUBEXPB);
|
||||
|
||||
// Bump to next subexpanse
|
||||
PDstJP += cJU_BITSPERSUBEXPB;
|
||||
|
||||
// Set length of subexpanse
|
||||
jj = cJU_BITSPERSUBEXPB;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (jj = 0; jj < cJU_BITSPERSUBEXPB; jj++)
|
||||
{
|
||||
// Copy JP or NULLJP depending on bit
|
||||
if (BitMap & 1) { *PDstJP = *PjpA++; }
|
||||
else { *PDstJP = JPNull; }
|
||||
|
||||
PDstJP++; // advance to next JP
|
||||
BitMap >>= 1;
|
||||
}
|
||||
jj = PjpA - PjpB;
|
||||
}
|
||||
|
||||
// Free the subexpanse:
|
||||
|
||||
j__udyFreeJBBJP(JU_JBB_PJP(Pjbb, ii), jj, Pjpm);
|
||||
|
||||
} // for each JP in BranchU
|
||||
|
||||
#ifdef JU_STAGED_EXP
|
||||
|
||||
// Allocate memory for a BranchU:
|
||||
|
||||
PjbuRaw = j__udyAllocJBU(Pjpm);
|
||||
if (PjbuRaw == (Pjbu_t) NULL) return(-1);
|
||||
Pjbu = P_JBU(PjbuRaw);
|
||||
|
||||
// Copy staged branch to newly allocated branch:
|
||||
//
|
||||
// TBD: I think this code is broken.
|
||||
|
||||
*Pjbu = BranchU;
|
||||
|
||||
#endif // JU_STAGED_EXP
|
||||
|
||||
// Finally free the BranchB and put the BranchU in its place:
|
||||
|
||||
j__udyFreeJBB(PjbbRaw, Pjpm);
|
||||
|
||||
Pjp->jp_Addr = (Word_t) PjbuRaw;
|
||||
Pjp->jp_Type += cJU_JPBRANCH_U - cJU_JPBRANCH_B;
|
||||
|
||||
return(1);
|
||||
|
||||
} // j__udyCreateBranchU()
|
1206
dlls/arrayx/Judy-1.0.1/src/JudyL/JudyLDecascade.c
Normal file
1206
dlls/arrayx/Judy-1.0.1/src/JudyL/JudyLDecascade.c
Normal file
File diff suppressed because it is too large
Load Diff
2146
dlls/arrayx/Judy-1.0.1/src/JudyL/JudyLDel.c
Normal file
2146
dlls/arrayx/Judy-1.0.1/src/JudyL/JudyLDel.c
Normal file
File diff suppressed because it is too large
Load Diff
213
dlls/arrayx/Judy-1.0.1/src/JudyL/JudyLFirst.c
Normal file
213
dlls/arrayx/Judy-1.0.1/src/JudyL/JudyLFirst.c
Normal file
|
@ -0,0 +1,213 @@
|
|||
// Copyright (C) 2000 - 2002 Hewlett-Packard Company
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify it
|
||||
// under the term of the GNU Lesser General Public License as published by the
|
||||
// Free Software Foundation; either version 2 of the License, or (at your
|
||||
// option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
// for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with this program; if not, write to the Free Software Foundation,
|
||||
// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
// _________________
|
||||
|
||||
// @(#) $Revision$ $Source$
|
||||
//
|
||||
// Judy*First[Empty]() and Judy*Last[Empty]() routines for Judy1 and JudyL.
|
||||
// Compile with one of -DJUDY1 or -DJUDYL.
|
||||
//
|
||||
// These are inclusive versions of Judy*Next[Empty]() and Judy*Prev[Empty]().
|
||||
|
||||
#if (! (defined(JUDY1) || defined(JUDYL)))
|
||||
#error: One of -DJUDY1 or -DJUDYL must be specified.
|
||||
#endif
|
||||
|
||||
#ifdef JUDY1
|
||||
#include "Judy1.h"
|
||||
#else
|
||||
#include "JudyL.h"
|
||||
#endif
|
||||
|
||||
|
||||
// ****************************************************************************
|
||||
// J U D Y 1 F I R S T
|
||||
// J U D Y L F I R S T
|
||||
//
|
||||
// See the manual entry for details.
|
||||
|
||||
#ifdef JUDY1
|
||||
FUNCTION int Judy1First
|
||||
#else
|
||||
FUNCTION PPvoid_t JudyLFirst
|
||||
#endif
|
||||
(
|
||||
Pcvoid_t PArray, // Judy array to search.
|
||||
Word_t * PIndex, // starting point and result.
|
||||
PJError_t PJError // optional, for returning error info.
|
||||
)
|
||||
{
|
||||
if (PIndex == (PWord_t) NULL) // caller error:
|
||||
{
|
||||
JU_SET_ERRNO(PJError, JU_ERRNO_NULLPINDEX);
|
||||
JUDY1CODE(return(JERRI );)
|
||||
JUDYLCODE(return(PPJERR);)
|
||||
}
|
||||
|
||||
#ifdef JUDY1
|
||||
switch (Judy1Test(PArray, *PIndex, PJError))
|
||||
{
|
||||
case 1: return(1); // found *PIndex itself.
|
||||
case 0: return(Judy1Next(PArray, PIndex, PJError));
|
||||
default: return(JERRI);
|
||||
}
|
||||
#else
|
||||
{
|
||||
PPvoid_t PValue;
|
||||
|
||||
if ((PValue = JudyLGet(PArray, *PIndex, PJError)) == PPJERR)
|
||||
return(PPJERR);
|
||||
|
||||
if (PValue != (PPvoid_t) NULL) return(PValue); // found *PIndex.
|
||||
|
||||
return(JudyLNext(PArray, PIndex, PJError));
|
||||
}
|
||||
#endif
|
||||
|
||||
} // Judy1First() / JudyLFirst()
|
||||
|
||||
|
||||
// ****************************************************************************
|
||||
// J U D Y 1 L A S T
|
||||
// J U D Y L L A S T
|
||||
//
|
||||
// See the manual entry for details.
|
||||
|
||||
#ifdef JUDY1
|
||||
FUNCTION int Judy1Last(
|
||||
#else
|
||||
FUNCTION PPvoid_t JudyLLast(
|
||||
#endif
|
||||
Pcvoid_t PArray, // Judy array to search.
|
||||
Word_t * PIndex, // starting point and result.
|
||||
PJError_t PJError) // optional, for returning error info.
|
||||
{
|
||||
if (PIndex == (PWord_t) NULL)
|
||||
{
|
||||
JU_SET_ERRNO(PJError, JU_ERRNO_NULLPINDEX); // caller error.
|
||||
JUDY1CODE(return(JERRI );)
|
||||
JUDYLCODE(return(PPJERR);)
|
||||
}
|
||||
|
||||
#ifdef JUDY1
|
||||
switch (Judy1Test(PArray, *PIndex, PJError))
|
||||
{
|
||||
case 1: return(1); // found *PIndex itself.
|
||||
case 0: return(Judy1Prev(PArray, PIndex, PJError));
|
||||
default: return(JERRI);
|
||||
}
|
||||
#else
|
||||
{
|
||||
PPvoid_t PValue;
|
||||
|
||||
if ((PValue = JudyLGet(PArray, *PIndex, PJError)) == PPJERR)
|
||||
return(PPJERR);
|
||||
|
||||
if (PValue != (PPvoid_t) NULL) return(PValue); // found *PIndex.
|
||||
|
||||
return(JudyLPrev(PArray, PIndex, PJError));
|
||||
}
|
||||
#endif
|
||||
|
||||
} // Judy1Last() / JudyLLast()
|
||||
|
||||
|
||||
// ****************************************************************************
|
||||
// J U D Y 1 F I R S T E M P T Y
|
||||
// J U D Y L F I R S T E M P T Y
|
||||
//
|
||||
// See the manual entry for details.
|
||||
|
||||
#ifdef JUDY1
|
||||
FUNCTION int Judy1FirstEmpty(
|
||||
#else
|
||||
FUNCTION int JudyLFirstEmpty(
|
||||
#endif
|
||||
Pcvoid_t PArray, // Judy array to search.
|
||||
Word_t * PIndex, // starting point and result.
|
||||
PJError_t PJError) // optional, for returning error info.
|
||||
{
|
||||
if (PIndex == (PWord_t) NULL) // caller error:
|
||||
{
|
||||
JU_SET_ERRNO(PJError, JU_ERRNO_NULLPINDEX);
|
||||
return(JERRI);
|
||||
}
|
||||
|
||||
#ifdef JUDY1
|
||||
switch (Judy1Test(PArray, *PIndex, PJError))
|
||||
{
|
||||
case 0: return(1); // found *PIndex itself.
|
||||
case 1: return(Judy1NextEmpty(PArray, PIndex, PJError));
|
||||
default: return(JERRI);
|
||||
}
|
||||
#else
|
||||
{
|
||||
PPvoid_t PValue;
|
||||
|
||||
if ((PValue = JudyLGet(PArray, *PIndex, PJError)) == PPJERR)
|
||||
return(JERRI);
|
||||
|
||||
if (PValue == (PPvoid_t) NULL) return(1); // found *PIndex.
|
||||
|
||||
return(JudyLNextEmpty(PArray, PIndex, PJError));
|
||||
}
|
||||
#endif
|
||||
|
||||
} // Judy1FirstEmpty() / JudyLFirstEmpty()
|
||||
|
||||
|
||||
// ****************************************************************************
|
||||
// J U D Y 1 L A S T E M P T Y
|
||||
// J U D Y L L A S T E M P T Y
|
||||
//
|
||||
// See the manual entry for details.
|
||||
|
||||
#ifdef JUDY1
|
||||
FUNCTION int Judy1LastEmpty(
|
||||
#else
|
||||
FUNCTION int JudyLLastEmpty(
|
||||
#endif
|
||||
Pcvoid_t PArray, // Judy array to search.
|
||||
Word_t * PIndex, // starting point and result.
|
||||
PJError_t PJError) // optional, for returning error info.
|
||||
{
|
||||
if (PIndex == (PWord_t) NULL)
|
||||
{
|
||||
JU_SET_ERRNO(PJError, JU_ERRNO_NULLPINDEX); // caller error.
|
||||
return(JERRI);
|
||||
}
|
||||
|
||||
#ifdef JUDY1
|
||||
switch (Judy1Test(PArray, *PIndex, PJError))
|
||||
{
|
||||
case 0: return(1); // found *PIndex itself.
|
||||
case 1: return(Judy1PrevEmpty(PArray, PIndex, PJError));
|
||||
default: return(JERRI);
|
||||
}
|
||||
#else
|
||||
{
|
||||
PPvoid_t PValue;
|
||||
|
||||
if ((PValue = JudyLGet(PArray, *PIndex, PJError)) == PPJERR)
|
||||
return(JERRI);
|
||||
|
||||
if (PValue == (PPvoid_t) NULL) return(1); // found *PIndex.
|
||||
|
||||
return(JudyLPrevEmpty(PArray, PIndex, PJError));
|
||||
}
|
||||
#endif
|
||||
|
||||
} // Judy1LastEmpty() / JudyLLastEmpty()
|
363
dlls/arrayx/Judy-1.0.1/src/JudyL/JudyLFreeArray.c
Normal file
363
dlls/arrayx/Judy-1.0.1/src/JudyL/JudyLFreeArray.c
Normal file
|
@ -0,0 +1,363 @@
|
|||
// Copyright (C) 2000 - 2002 Hewlett-Packard Company
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify it
|
||||
// under the term of the GNU Lesser General Public License as published by the
|
||||
// Free Software Foundation; either version 2 of the License, or (at your
|
||||
// option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
// for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with this program; if not, write to the Free Software Foundation,
|
||||
// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
// _________________
|
||||
|
||||
// @(#) $Revision$ $Source$
|
||||
//
|
||||
// Judy1FreeArray() and JudyLFreeArray() functions for Judy1 and JudyL.
|
||||
// Compile with one of -DJUDY1 or -DJUDYL.
|
||||
// Return the number of bytes freed from the array.
|
||||
|
||||
#if (! (defined(JUDY1) || defined(JUDYL)))
|
||||
#error: One of -DJUDY1 or -DJUDYL must be specified.
|
||||
#endif
|
||||
|
||||
#ifdef JUDY1
|
||||
#include "Judy1.h"
|
||||
#else
|
||||
#include "JudyL.h"
|
||||
#endif
|
||||
|
||||
#include "JudyPrivate1L.h"
|
||||
|
||||
DBGCODE(extern void JudyCheckPop(Pvoid_t PArray);)
|
||||
|
||||
|
||||
// ****************************************************************************
|
||||
// J U D Y 1 F R E E A R R A Y
|
||||
// J U D Y L F R E E A R R A Y
|
||||
//
|
||||
// See the Judy*(3C) manual entry for details.
|
||||
//
|
||||
// This code is written recursively, at least at first, because thats much
|
||||
// simpler. Hope its fast enough.
|
||||
|
||||
#ifdef JUDY1
|
||||
FUNCTION Word_t Judy1FreeArray
|
||||
#else
|
||||
FUNCTION Word_t JudyLFreeArray
|
||||
#endif
|
||||
(
|
||||
PPvoid_t PPArray, // array to free.
|
||||
PJError_t PJError // optional, for returning error info.
|
||||
)
|
||||
{
|
||||
jpm_t jpm; // local to accumulate free statistics.
|
||||
|
||||
// CHECK FOR NULL POINTER (error by caller):
|
||||
|
||||
if (PPArray == (PPvoid_t) NULL)
|
||||
{
|
||||
JU_SET_ERRNO(PJError, JU_ERRNO_NULLPPARRAY);
|
||||
return(JERR);
|
||||
}
|
||||
|
||||
DBGCODE(JudyCheckPop(*PPArray);)
|
||||
|
||||
// Zero jpm.jpm_Pop0 (meaning the array will be empty in a moment) for accurate
|
||||
// logging in TRACEMI2.
|
||||
|
||||
jpm.jpm_Pop0 = 0; // see above.
|
||||
jpm.jpm_TotalMemWords = 0; // initialize memory freed.
|
||||
|
||||
// Empty array:
|
||||
|
||||
if (P_JLW(*PPArray) == (Pjlw_t) NULL) return(0);
|
||||
|
||||
// PROCESS TOP LEVEL "JRP" BRANCHES AND LEAF:
|
||||
|
||||
if (JU_LEAFW_POP0(*PPArray) < cJU_LEAFW_MAXPOP1) // must be a LEAFW
|
||||
{
|
||||
Pjlw_t Pjlw = P_JLW(*PPArray); // first word of leaf.
|
||||
|
||||
j__udyFreeJLW(Pjlw, Pjlw[0] + 1, &jpm);
|
||||
*PPArray = (Pvoid_t) NULL; // make an empty array.
|
||||
return (-(jpm.jpm_TotalMemWords * cJU_BYTESPERWORD)); // see above.
|
||||
}
|
||||
else
|
||||
|
||||
// Rootstate leaves: just free the leaf:
|
||||
|
||||
// Common code for returning the amount of memory freed.
|
||||
//
|
||||
// Note: In a an ordinary LEAFW, pop0 = *PPArray[0].
|
||||
//
|
||||
// Accumulate (negative) words freed, while freeing objects.
|
||||
// Return the positive bytes freed.
|
||||
|
||||
{
|
||||
Pjpm_t Pjpm = P_JPM(*PPArray);
|
||||
Word_t TotalMem = Pjpm->jpm_TotalMemWords;
|
||||
|
||||
j__udyFreeSM(&(Pjpm->jpm_JP), &jpm); // recurse through tree.
|
||||
j__udyFreeJPM(Pjpm, &jpm);
|
||||
|
||||
// Verify the array was not corrupt. This means that amount of memory freed
|
||||
// (which is negative) is equal to the initial amount:
|
||||
|
||||
if (TotalMem + jpm.jpm_TotalMemWords)
|
||||
{
|
||||
JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT);
|
||||
return(JERR);
|
||||
}
|
||||
|
||||
*PPArray = (Pvoid_t) NULL; // make an empty array.
|
||||
return (TotalMem * cJU_BYTESPERWORD);
|
||||
}
|
||||
|
||||
} // Judy1FreeArray() / JudyLFreeArray()
|
||||
|
||||
|
||||
// ****************************************************************************
|
||||
// __ J U D Y F R E E S M
|
||||
//
|
||||
// Given a pointer to a JP, recursively visit and free (depth first) all nodes
|
||||
// in a Judy array BELOW the JP, but not the JP itself. Accumulate in *Pjpm
|
||||
// the total words freed (as a negative value). "SM" = State Machine.
|
||||
//
|
||||
// Note: Corruption is not detected at this level because during a FreeArray,
|
||||
// if the code hasnt already core dumped, its better to remain silent, even
|
||||
// if some memory has not been freed, than to bother the caller about the
|
||||
// corruption. TBD: Is this true? If not, must list all legitimate JPNULL
|
||||
// and JPIMMED above first, and revert to returning bool_t (see 4.34).
|
||||
|
||||
FUNCTION void j__udyFreeSM(
|
||||
Pjp_t Pjp, // top of Judy (top-state).
|
||||
Pjpm_t Pjpm) // to return words freed.
|
||||
{
|
||||
Word_t Pop1;
|
||||
|
||||
switch (JU_JPTYPE(Pjp))
|
||||
{
|
||||
|
||||
#ifdef JUDY1
|
||||
|
||||
// FULL EXPANSE -- nothing to free for this jp_Type.
|
||||
|
||||
case cJ1_JPFULLPOPU1:
|
||||
break;
|
||||
#endif
|
||||
|
||||
// JUDY BRANCH -- free the sub-tree depth first:
|
||||
|
||||
// LINEAR BRANCH -- visit each JP in the JBLs list, then free the JBL:
|
||||
//
|
||||
// Note: There are no null JPs in a JBL.
|
||||
|
||||
case cJU_JPBRANCH_L:
|
||||
case cJU_JPBRANCH_L2:
|
||||
case cJU_JPBRANCH_L3:
|
||||
#ifdef JU_64BIT
|
||||
case cJU_JPBRANCH_L4:
|
||||
case cJU_JPBRANCH_L5:
|
||||
case cJU_JPBRANCH_L6:
|
||||
case cJU_JPBRANCH_L7:
|
||||
#endif // JU_64BIT
|
||||
{
|
||||
Pjbl_t Pjbl = P_JBL(Pjp->jp_Addr);
|
||||
Word_t offset;
|
||||
|
||||
for (offset = 0; offset < Pjbl->jbl_NumJPs; ++offset)
|
||||
j__udyFreeSM((Pjbl->jbl_jp) + offset, Pjpm);
|
||||
|
||||
j__udyFreeJBL((Pjbl_t) (Pjp->jp_Addr), Pjpm);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
// BITMAP BRANCH -- visit each JP in the JBBs list based on the bitmap, also
|
||||
//
|
||||
// Note: There are no null JPs in a JBB.
|
||||
|
||||
case cJU_JPBRANCH_B:
|
||||
case cJU_JPBRANCH_B2:
|
||||
case cJU_JPBRANCH_B3:
|
||||
#ifdef JU_64BIT
|
||||
case cJU_JPBRANCH_B4:
|
||||
case cJU_JPBRANCH_B5:
|
||||
case cJU_JPBRANCH_B6:
|
||||
case cJU_JPBRANCH_B7:
|
||||
#endif // JU_64BIT
|
||||
{
|
||||
Word_t subexp;
|
||||
Word_t offset;
|
||||
Word_t jpcount;
|
||||
|
||||
Pjbb_t Pjbb = P_JBB(Pjp->jp_Addr);
|
||||
|
||||
for (subexp = 0; subexp < cJU_NUMSUBEXPB; ++subexp)
|
||||
{
|
||||
jpcount = j__udyCountBitsB(JU_JBB_BITMAP(Pjbb, subexp));
|
||||
|
||||
if (jpcount)
|
||||
{
|
||||
for (offset = 0; offset < jpcount; ++offset)
|
||||
{
|
||||
j__udyFreeSM(P_JP(JU_JBB_PJP(Pjbb, subexp)) + offset,
|
||||
Pjpm);
|
||||
}
|
||||
j__udyFreeJBBJP(JU_JBB_PJP(Pjbb, subexp), jpcount, Pjpm);
|
||||
}
|
||||
}
|
||||
j__udyFreeJBB((Pjbb_t) (Pjp->jp_Addr), Pjpm);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
// UNCOMPRESSED BRANCH -- visit each JP in the JBU array, then free the JBU
|
||||
// itself:
|
||||
//
|
||||
// Note: Null JPs are handled during recursion at a lower state.
|
||||
|
||||
case cJU_JPBRANCH_U:
|
||||
case cJU_JPBRANCH_U2:
|
||||
case cJU_JPBRANCH_U3:
|
||||
#ifdef JU_64BIT
|
||||
case cJU_JPBRANCH_U4:
|
||||
case cJU_JPBRANCH_U5:
|
||||
case cJU_JPBRANCH_U6:
|
||||
case cJU_JPBRANCH_U7:
|
||||
#endif // JU_64BIT
|
||||
{
|
||||
Word_t offset;
|
||||
Pjbu_t Pjbu = P_JBU(Pjp->jp_Addr);
|
||||
|
||||
for (offset = 0; offset < cJU_BRANCHUNUMJPS; ++offset)
|
||||
j__udyFreeSM((Pjbu->jbu_jp) + offset, Pjpm);
|
||||
|
||||
j__udyFreeJBU((Pjbu_t) (Pjp->jp_Addr), Pjpm);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
// -- Cases below here terminate and do not recurse. --
|
||||
|
||||
|
||||
// LINEAR LEAF -- just free the leaf; size is computed from jp_Type:
|
||||
//
|
||||
// Note: cJU_JPLEAF1 is a special case, see discussion in ../Judy1/Judy1.h
|
||||
|
||||
#if (defined(JUDYL) || (! defined(JU_64BIT)))
|
||||
case cJU_JPLEAF1:
|
||||
Pop1 = JU_JPLEAF_POP0(Pjp) + 1;
|
||||
j__udyFreeJLL1((Pjll_t) (Pjp->jp_Addr), Pop1, Pjpm);
|
||||
break;
|
||||
#endif
|
||||
|
||||
case cJU_JPLEAF2:
|
||||
Pop1 = JU_JPLEAF_POP0(Pjp) + 1;
|
||||
j__udyFreeJLL2((Pjll_t) (Pjp->jp_Addr), Pop1, Pjpm);
|
||||
break;
|
||||
|
||||
case cJU_JPLEAF3:
|
||||
Pop1 = JU_JPLEAF_POP0(Pjp) + 1;
|
||||
j__udyFreeJLL3((Pjll_t) (Pjp->jp_Addr), Pop1, Pjpm);
|
||||
break;
|
||||
|
||||
#ifdef JU_64BIT
|
||||
case cJU_JPLEAF4:
|
||||
Pop1 = JU_JPLEAF_POP0(Pjp) + 1;
|
||||
j__udyFreeJLL4((Pjll_t) (Pjp->jp_Addr), Pop1, Pjpm);
|
||||
break;
|
||||
|
||||
case cJU_JPLEAF5:
|
||||
Pop1 = JU_JPLEAF_POP0(Pjp) + 1;
|
||||
j__udyFreeJLL5((Pjll_t) (Pjp->jp_Addr), Pop1, Pjpm);
|
||||
break;
|
||||
|
||||
case cJU_JPLEAF6:
|
||||
Pop1 = JU_JPLEAF_POP0(Pjp) + 1;
|
||||
j__udyFreeJLL6((Pjll_t) (Pjp->jp_Addr), Pop1, Pjpm);
|
||||
break;
|
||||
|
||||
case cJU_JPLEAF7:
|
||||
Pop1 = JU_JPLEAF_POP0(Pjp) + 1;
|
||||
j__udyFreeJLL7((Pjll_t) (Pjp->jp_Addr), Pop1, Pjpm);
|
||||
break;
|
||||
#endif // JU_64BIT
|
||||
|
||||
|
||||
// BITMAP LEAF -- free sub-expanse arrays of JPs, then free the JBB.
|
||||
|
||||
case cJU_JPLEAF_B1:
|
||||
{
|
||||
#ifdef JUDYL
|
||||
Word_t subexp;
|
||||
Word_t jpcount;
|
||||
Pjlb_t Pjlb = P_JLB(Pjp->jp_Addr);
|
||||
|
||||
// Free the value areas in the bitmap leaf:
|
||||
|
||||
for (subexp = 0; subexp < cJU_NUMSUBEXPL; ++subexp)
|
||||
{
|
||||
jpcount = j__udyCountBitsL(JU_JLB_BITMAP(Pjlb, subexp));
|
||||
|
||||
if (jpcount)
|
||||
j__udyLFreeJV(JL_JLB_PVALUE(Pjlb, subexp), jpcount, Pjpm);
|
||||
}
|
||||
#endif // JUDYL
|
||||
|
||||
j__udyFreeJLB1((Pjlb_t) (Pjp->jp_Addr), Pjpm);
|
||||
break;
|
||||
|
||||
} // case cJU_JPLEAF_B1
|
||||
|
||||
#ifdef JUDYL
|
||||
|
||||
|
||||
// IMMED*:
|
||||
//
|
||||
// For JUDYL, all non JPIMMED_*_01s have a LeafV which must be freed:
|
||||
|
||||
case cJU_JPIMMED_1_02:
|
||||
case cJU_JPIMMED_1_03:
|
||||
#ifdef JU_64BIT
|
||||
case cJU_JPIMMED_1_04:
|
||||
case cJU_JPIMMED_1_05:
|
||||
case cJU_JPIMMED_1_06:
|
||||
case cJU_JPIMMED_1_07:
|
||||
#endif
|
||||
Pop1 = JU_JPTYPE(Pjp) - cJU_JPIMMED_1_02 + 2;
|
||||
j__udyLFreeJV((Pjv_t) (Pjp->jp_Addr), Pop1, Pjpm);
|
||||
break;
|
||||
|
||||
#ifdef JU_64BIT
|
||||
case cJU_JPIMMED_2_02:
|
||||
case cJU_JPIMMED_2_03:
|
||||
|
||||
Pop1 = JU_JPTYPE(Pjp) - cJU_JPIMMED_2_02 + 2;
|
||||
j__udyLFreeJV((Pjv_t) (Pjp->jp_Addr), Pop1, Pjpm);
|
||||
break;
|
||||
|
||||
case cJU_JPIMMED_3_02:
|
||||
j__udyLFreeJV((Pjv_t) (Pjp->jp_Addr), 2, Pjpm);
|
||||
break;
|
||||
|
||||
#endif // JU_64BIT
|
||||
#endif // JUDYL
|
||||
|
||||
|
||||
// OTHER JPNULL, JPIMMED, OR UNEXPECTED TYPE -- nothing to free for this type:
|
||||
//
|
||||
// Note: Lump together no-op and invalid JP types; see function header
|
||||
// comments.
|
||||
|
||||
default: break;
|
||||
|
||||
} // switch (JU_JPTYPE(Pjp))
|
||||
|
||||
} // j__udyFreeSM()
|
1094
dlls/arrayx/Judy-1.0.1/src/JudyL/JudyLGet.c
Normal file
1094
dlls/arrayx/Judy-1.0.1/src/JudyL/JudyLGet.c
Normal file
File diff suppressed because it is too large
Load Diff
1873
dlls/arrayx/Judy-1.0.1/src/JudyL/JudyLIns.c
Normal file
1873
dlls/arrayx/Judy-1.0.1/src/JudyL/JudyLIns.c
Normal file
File diff suppressed because it is too large
Load Diff
1178
dlls/arrayx/Judy-1.0.1/src/JudyL/JudyLInsArray.c
Normal file
1178
dlls/arrayx/Judy-1.0.1/src/JudyL/JudyLInsArray.c
Normal file
File diff suppressed because it is too large
Load Diff
135
dlls/arrayx/Judy-1.0.1/src/JudyL/JudyLInsertBranch.c
Normal file
135
dlls/arrayx/Judy-1.0.1/src/JudyL/JudyLInsertBranch.c
Normal file
|
@ -0,0 +1,135 @@
|
|||
// Copyright (C) 2000 - 2002 Hewlett-Packard Company
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify it
|
||||
// under the term of the GNU Lesser General Public License as published by the
|
||||
// Free Software Foundation; either version 2 of the License, or (at your
|
||||
// option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
// for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with this program; if not, write to the Free Software Foundation,
|
||||
// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
// _________________
|
||||
|
||||
// @(#) $Revision$ $Source$
|
||||
|
||||
// BranchL insertion functions for Judy1 and JudyL.
|
||||
// Compile with one of -DJUDY1 or -DJUDYL.
|
||||
|
||||
#if (! (defined(JUDY1) || defined(JUDYL)))
|
||||
#error: One of -DJUDY1 or -DJUDYL must be specified.
|
||||
#endif
|
||||
|
||||
#ifdef JUDY1
|
||||
#include "Judy1.h"
|
||||
#else
|
||||
#include "JudyL.h"
|
||||
#endif
|
||||
|
||||
#include "JudyPrivate1L.h"
|
||||
|
||||
extern int j__udyCreateBranchL(Pjp_t, Pjp_t, uint8_t *, Word_t, Pvoid_t);
|
||||
|
||||
|
||||
// ****************************************************************************
|
||||
// __ J U D Y I N S E R T B R A N C H
|
||||
//
|
||||
// Insert 2-element BranchL in between Pjp and Pjp->jp_Addr.
|
||||
//
|
||||
// Return -1 if out of memory, otherwise return 1.
|
||||
|
||||
FUNCTION int j__udyInsertBranch(
|
||||
Pjp_t Pjp, // JP containing narrow pointer.
|
||||
Word_t Index, // outlier to Pjp.
|
||||
Word_t BranchLevel, // of what JP points to, mapped from JP type.
|
||||
Pjpm_t Pjpm) // for global accounting.
|
||||
{
|
||||
jp_t JP2 [2];
|
||||
jp_t JP;
|
||||
Pjp_t PjpNull;
|
||||
Word_t XorExp;
|
||||
Word_t Inew, Iold;
|
||||
Word_t DCDMask; // initially for original BranchLevel.
|
||||
int Ret;
|
||||
uint8_t Exp2[2];
|
||||
uint8_t DecodeByteN, DecodeByteO;
|
||||
|
||||
// Get the current mask for the DCD digits:
|
||||
|
||||
DCDMask = cJU_DCDMASK(BranchLevel);
|
||||
|
||||
// Obtain Dcd bits that differ between Index and JP, shifted so the
|
||||
// digit for BranchLevel is the LSB:
|
||||
|
||||
XorExp = ((Index ^ JU_JPDCDPOP0(Pjp)) & (cJU_ALLONES >> cJU_BITSPERBYTE))
|
||||
>> (BranchLevel * cJU_BITSPERBYTE);
|
||||
assert(XorExp); // Index must be an outlier.
|
||||
|
||||
// Count levels between object under narrow pointer and the level at which
|
||||
// the outlier diverges from it, which is always at least initial
|
||||
// BranchLevel + 1, to end up with the level (JP type) at which to insert
|
||||
// the new intervening BranchL:
|
||||
|
||||
do { ++BranchLevel; } while ((XorExp >>= cJU_BITSPERBYTE));
|
||||
assert((BranchLevel > 1) && (BranchLevel < cJU_ROOTSTATE));
|
||||
|
||||
// Get the MSB (highest digit) that differs between the old expanse and
|
||||
// the new Index to insert:
|
||||
|
||||
DecodeByteO = JU_DIGITATSTATE(JU_JPDCDPOP0(Pjp), BranchLevel);
|
||||
DecodeByteN = JU_DIGITATSTATE(Index, BranchLevel);
|
||||
|
||||
assert(DecodeByteO != DecodeByteN);
|
||||
|
||||
// Determine sorted order for old expanse and new Index digits:
|
||||
|
||||
if (DecodeByteN > DecodeByteO) { Iold = 0; Inew = 1; }
|
||||
else { Iold = 1; Inew = 0; }
|
||||
|
||||
// Copy old JP into staging area for new Branch
|
||||
JP2 [Iold] = *Pjp;
|
||||
Exp2[Iold] = DecodeByteO;
|
||||
Exp2[Inew] = DecodeByteN;
|
||||
|
||||
// Create a 2 Expanse Linear branch
|
||||
//
|
||||
// Note: Pjp->jp_Addr is set by j__udyCreateBranchL()
|
||||
|
||||
Ret = j__udyCreateBranchL(Pjp, JP2, Exp2, 2, Pjpm);
|
||||
if (Ret == -1) return(-1);
|
||||
|
||||
// Get Pjp to the NULL of where to do insert
|
||||
PjpNull = ((P_JBL(Pjp->jp_Addr))->jbl_jp) + Inew;
|
||||
|
||||
// Convert to a cJU_JPIMMED_*_01 at the correct level:
|
||||
// Build JP and set type below to: cJU_JPIMMED_X_01
|
||||
JU_JPSETADT(PjpNull, 0, Index, cJU_JPIMMED_1_01 - 2 + BranchLevel);
|
||||
|
||||
// Return pointer to Value area in cJU_JPIMMED_X_01
|
||||
JUDYLCODE(Pjpm->jpm_PValue = (Pjv_t) PjpNull;)
|
||||
|
||||
// The old JP now points to a BranchL that is at higher level. Therefore
|
||||
// it contains excess DCD bits (in the least significant position) that
|
||||
// must be removed (zeroed); that is, they become part of the Pop0
|
||||
// subfield. Note that the remaining (lower) bytes in the Pop0 field do
|
||||
// not change.
|
||||
//
|
||||
// Take from the old DCDMask, which went "down" to a lower BranchLevel,
|
||||
// and zero any high bits that are still in the mask at the new, higher
|
||||
// BranchLevel; then use this mask to zero the bits in jp_DcdPopO:
|
||||
|
||||
// Set old JP to a BranchL at correct level
|
||||
|
||||
Pjp->jp_Type = cJU_JPBRANCH_L2 - 2 + BranchLevel;
|
||||
DCDMask ^= cJU_DCDMASK(BranchLevel);
|
||||
DCDMask = ~DCDMask & JU_JPDCDPOP0(Pjp);
|
||||
JP = *Pjp;
|
||||
JU_JPSETADT(Pjp, JP.jp_Addr, DCDMask, JP.jp_Type);
|
||||
|
||||
return(1);
|
||||
|
||||
} // j__udyInsertBranch()
|
782
dlls/arrayx/Judy-1.0.1/src/JudyL/JudyLMallocIF.c
Normal file
782
dlls/arrayx/Judy-1.0.1/src/JudyL/JudyLMallocIF.c
Normal file
|
@ -0,0 +1,782 @@
|
|||
// Copyright (C) 2000 - 2002 Hewlett-Packard Company
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify it
|
||||
// under the term of the GNU Lesser General Public License as published by the
|
||||
// Free Software Foundation; either version 2 of the License, or (at your
|
||||
// option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
// for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with this program; if not, write to the Free Software Foundation,
|
||||
// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
// _________________
|
||||
|
||||
// @(#) $Revision$ $Source$
|
||||
//
|
||||
// Judy malloc/free interface functions for Judy1 and JudyL.
|
||||
//
|
||||
// Compile with one of -DJUDY1 or -DJUDYL.
|
||||
//
|
||||
// Compile with -DTRACEMI (Malloc Interface) to turn on tracing of malloc/free
|
||||
// calls at the interface level. (See also TRACEMF in lower-level code.)
|
||||
// Use -DTRACEMI2 for a terser format suitable for trace analysis.
|
||||
//
|
||||
// There can be malloc namespace bits in the LSBs of "raw" addresses from most,
|
||||
// but not all, of the j__udy*Alloc*() functions; see also JudyPrivate.h. To
|
||||
// test the Judy code, compile this file with -DMALLOCBITS and use debug flavor
|
||||
// only (for assertions). This test ensures that (a) all callers properly mask
|
||||
// the namespace bits out before dereferencing a pointer (or else a core dump
|
||||
// occurs), and (b) all callers send "raw" (unmasked) addresses to
|
||||
// j__udy*Free*() calls.
|
||||
//
|
||||
// Note: Currently -DDEBUG turns on MALLOCBITS automatically.
|
||||
|
||||
#if (! (defined(JUDY1) || defined(JUDYL)))
|
||||
#error: One of -DJUDY1 or -DJUDYL must be specified.
|
||||
#endif
|
||||
|
||||
#ifdef JUDY1
|
||||
#include "Judy1.h"
|
||||
#else
|
||||
#include "JudyL.h"
|
||||
#endif
|
||||
|
||||
#include "JudyPrivate1L.h"
|
||||
|
||||
// Set "hidden" global j__uMaxWords to the maximum number of words to allocate
|
||||
// to any one array (large enough to have a JPM, otherwise j__uMaxWords is
|
||||
// ignored), to trigger a fake malloc error when the number is exceeded. Note,
|
||||
// this code is always executed, not #ifdefd, because its virtually free.
|
||||
//
|
||||
// Note: To keep the MALLOC macro faster and simpler, set j__uMaxWords to
|
||||
// MAXINT, not zero, by default.
|
||||
|
||||
Word_t j__uMaxWords = ~0UL;
|
||||
|
||||
// This macro hides the faking of a malloc failure:
|
||||
//
|
||||
// Note: To keep this fast, just compare WordsPrev to j__uMaxWords without the
|
||||
// complexity of first adding WordsNow, meaning the trigger point is not
|
||||
// exactly where you might assume, but it shouldnt matter.
|
||||
|
||||
#define MALLOC(MallocFunc,WordsPrev,WordsNow) \
|
||||
(((WordsPrev) > j__uMaxWords) ? 0UL : MallocFunc(WordsNow))
|
||||
|
||||
// Clear words starting at address:
|
||||
//
|
||||
// Note: Only use this for objects that care; in other cases, it doesnt
|
||||
// matter if the objects memory is pre-zeroed.
|
||||
|
||||
#define ZEROWORDS(Addr,Words) \
|
||||
{ \
|
||||
Word_t Words__ = (Words); \
|
||||
PWord_t Addr__ = (PWord_t) (Addr); \
|
||||
while (Words__--) *Addr__++ = 0UL; \
|
||||
}
|
||||
|
||||
#ifdef TRACEMI
|
||||
|
||||
// TRACING SUPPORT:
|
||||
//
|
||||
// Note: For TRACEMI, use a format for address printing compatible with other
|
||||
// tracing facilities; in particular, %x not %lx, to truncate the "noisy" high
|
||||
// part on 64-bit systems.
|
||||
//
|
||||
// TBD: The trace macros need fixing for alternate address types.
|
||||
//
|
||||
// Note: TRACEMI2 supports trace analysis no matter the underlying malloc/free
|
||||
// engine used.
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
static Word_t j__udyMemSequence = 0L; // event sequence number.
|
||||
|
||||
#define TRACE_ALLOC5(a,b,c,d,e) (void) printf(a, (b), c, d)
|
||||
#define TRACE_FREE5( a,b,c,d,e) (void) printf(a, (b), c, d)
|
||||
#define TRACE_ALLOC6(a,b,c,d,e,f) (void) printf(a, (b), c, d, e)
|
||||
#define TRACE_FREE6( a,b,c,d,e,f) (void) printf(a, (b), c, d, e)
|
||||
|
||||
#else
|
||||
|
||||
#ifdef TRACEMI2
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#define b_pw cJU_BYTESPERWORD
|
||||
|
||||
#define TRACE_ALLOC5(a,b,c,d,e) \
|
||||
(void) printf("a %lx %lx %lx\n", (b), (d) * b_pw, e)
|
||||
#define TRACE_FREE5( a,b,c,d,e) \
|
||||
(void) printf("f %lx %lx %lx\n", (b), (d) * b_pw, e)
|
||||
#define TRACE_ALLOC6(a,b,c,d,e,f) \
|
||||
(void) printf("a %lx %lx %lx\n", (b), (e) * b_pw, f)
|
||||
#define TRACE_FREE6( a,b,c,d,e,f) \
|
||||
(void) printf("f %lx %lx %lx\n", (b), (e) * b_pw, f)
|
||||
|
||||
static Word_t j__udyMemSequence = 0L; // event sequence number.
|
||||
|
||||
#else
|
||||
|
||||
#define TRACE_ALLOC5(a,b,c,d,e) // null.
|
||||
#define TRACE_FREE5( a,b,c,d,e) // null.
|
||||
#define TRACE_ALLOC6(a,b,c,d,e,f) // null.
|
||||
#define TRACE_FREE6( a,b,c,d,e,f) // null.
|
||||
|
||||
#endif // ! TRACEMI2
|
||||
#endif // ! TRACEMI
|
||||
|
||||
|
||||
// MALLOC NAMESPACE SUPPORT:
|
||||
|
||||
#if (defined(DEBUG) && (! defined(MALLOCBITS))) // for now, DEBUG => MALLOCBITS:
|
||||
#define MALLOCBITS 1
|
||||
#endif
|
||||
|
||||
#ifdef MALLOCBITS
|
||||
#define MALLOCBITS_VALUE 0x3 // bit pattern to use.
|
||||
#define MALLOCBITS_MASK 0x7 // note: matches mask__ in JudyPrivate.h.
|
||||
|
||||
#define MALLOCBITS_SET( Type,Addr) \
|
||||
((Addr) = (Type) ((Word_t) (Addr) | MALLOCBITS_VALUE))
|
||||
#define MALLOCBITS_TEST(Type,Addr) \
|
||||
assert((((Word_t) (Addr)) & MALLOCBITS_MASK) == MALLOCBITS_VALUE); \
|
||||
((Addr) = (Type) ((Word_t) (Addr) & ~MALLOCBITS_VALUE))
|
||||
#else
|
||||
#define MALLOCBITS_SET( Type,Addr) // null.
|
||||
#define MALLOCBITS_TEST(Type,Addr) // null.
|
||||
#endif
|
||||
|
||||
|
||||
// SAVE ERROR INFORMATION IN A Pjpm:
|
||||
//
|
||||
// "Small" (invalid) Addr values are used to distinguish overrun and no-mem
|
||||
// errors. (TBD, non-zero invalid values are no longer returned from
|
||||
// lower-level functions, that is, JU_ERRNO_OVERRUN is no longer detected.)
|
||||
|
||||
#define J__UDYSETALLOCERROR(Addr) \
|
||||
{ \
|
||||
JU_ERRID(Pjpm) = __LINE__; \
|
||||
if ((Word_t) (Addr) > 0) JU_ERRNO(Pjpm) = JU_ERRNO_OVERRUN; \
|
||||
else JU_ERRNO(Pjpm) = JU_ERRNO_NOMEM; \
|
||||
return(0); \
|
||||
}
|
||||
|
||||
|
||||
// ****************************************************************************
|
||||
// ALLOCATION FUNCTIONS:
|
||||
//
|
||||
// To help the compiler catch coding errors, each function returns a specific
|
||||
// object type.
|
||||
//
|
||||
// Note: Only j__udyAllocJPM() and j__udyAllocJLW() return multiple values <=
|
||||
// sizeof(Word_t) to indicate the type of memory allocation failure. Other
|
||||
// allocation functions convert this failure to a JU_ERRNO.
|
||||
|
||||
|
||||
// Note: Unlike other j__udyAlloc*() functions, Pjpms are returned non-raw,
|
||||
// that is, without malloc namespace or root pointer type bits:
|
||||
|
||||
FUNCTION Pjpm_t j__udyAllocJPM(void)
|
||||
{
|
||||
Word_t Words = sizeof(jpm_t) / cJU_BYTESPERWORD;
|
||||
Pjpm_t Pjpm = (Pjpm_t) MALLOC(JudyMalloc, Words, Words);
|
||||
|
||||
assert((Words * cJU_BYTESPERWORD) == sizeof(jpm_t));
|
||||
|
||||
if ((Word_t) Pjpm > sizeof(Word_t))
|
||||
{
|
||||
ZEROWORDS(Pjpm, Words);
|
||||
Pjpm->jpm_TotalMemWords = Words;
|
||||
}
|
||||
|
||||
TRACE_ALLOC5("0x%x %8lu = j__udyAllocJPM(), Words = %lu\n",
|
||||
Pjpm, j__udyMemSequence++, Words, cJU_LEAFW_MAXPOP1 + 1);
|
||||
// MALLOCBITS_SET(Pjpm_t, Pjpm); // see above.
|
||||
return(Pjpm);
|
||||
|
||||
} // j__udyAllocJPM()
|
||||
|
||||
|
||||
FUNCTION Pjbl_t j__udyAllocJBL(Pjpm_t Pjpm)
|
||||
{
|
||||
Word_t Words = sizeof(jbl_t) / cJU_BYTESPERWORD;
|
||||
Pjbl_t PjblRaw = (Pjbl_t) MALLOC(JudyMallocVirtual,
|
||||
Pjpm->jpm_TotalMemWords, Words);
|
||||
|
||||
assert((Words * cJU_BYTESPERWORD) == sizeof(jbl_t));
|
||||
|
||||
if ((Word_t) PjblRaw > sizeof(Word_t))
|
||||
{
|
||||
ZEROWORDS(P_JBL(PjblRaw), Words);
|
||||
Pjpm->jpm_TotalMemWords += Words;
|
||||
}
|
||||
else { J__UDYSETALLOCERROR(PjblRaw); }
|
||||
|
||||
TRACE_ALLOC5("0x%x %8lu = j__udyAllocJBL(), Words = %lu\n", PjblRaw,
|
||||
j__udyMemSequence++, Words, (Pjpm->jpm_Pop0) + 2);
|
||||
MALLOCBITS_SET(Pjbl_t, PjblRaw);
|
||||
return(PjblRaw);
|
||||
|
||||
} // j__udyAllocJBL()
|
||||
|
||||
|
||||
FUNCTION Pjbb_t j__udyAllocJBB(Pjpm_t Pjpm)
|
||||
{
|
||||
Word_t Words = sizeof(jbb_t) / cJU_BYTESPERWORD;
|
||||
Pjbb_t PjbbRaw = (Pjbb_t) MALLOC(JudyMallocVirtual,
|
||||
Pjpm->jpm_TotalMemWords, Words);
|
||||
|
||||
assert((Words * cJU_BYTESPERWORD) == sizeof(jbb_t));
|
||||
|
||||
if ((Word_t) PjbbRaw > sizeof(Word_t))
|
||||
{
|
||||
ZEROWORDS(P_JBB(PjbbRaw), Words);
|
||||
Pjpm->jpm_TotalMemWords += Words;
|
||||
}
|
||||
else { J__UDYSETALLOCERROR(PjbbRaw); }
|
||||
|
||||
TRACE_ALLOC5("0x%x %8lu = j__udyAllocJBB(), Words = %lu\n", PjbbRaw,
|
||||
j__udyMemSequence++, Words, (Pjpm->jpm_Pop0) + 2);
|
||||
MALLOCBITS_SET(Pjbb_t, PjbbRaw);
|
||||
return(PjbbRaw);
|
||||
|
||||
} // j__udyAllocJBB()
|
||||
|
||||
|
||||
FUNCTION Pjp_t j__udyAllocJBBJP(Word_t NumJPs, Pjpm_t Pjpm)
|
||||
{
|
||||
Word_t Words = JU_BRANCHJP_NUMJPSTOWORDS(NumJPs);
|
||||
Pjp_t PjpRaw;
|
||||
|
||||
PjpRaw = (Pjp_t) MALLOC(JudyMalloc, Pjpm->jpm_TotalMemWords, Words);
|
||||
|
||||
if ((Word_t) PjpRaw > sizeof(Word_t))
|
||||
{
|
||||
Pjpm->jpm_TotalMemWords += Words;
|
||||
}
|
||||
else { J__UDYSETALLOCERROR(PjpRaw); }
|
||||
|
||||
TRACE_ALLOC6("0x%x %8lu = j__udyAllocJBBJP(%lu), Words = %lu\n", PjpRaw,
|
||||
j__udyMemSequence++, NumJPs, Words, (Pjpm->jpm_Pop0) + 2);
|
||||
MALLOCBITS_SET(Pjp_t, PjpRaw);
|
||||
return(PjpRaw);
|
||||
|
||||
} // j__udyAllocJBBJP()
|
||||
|
||||
|
||||
FUNCTION Pjbu_t j__udyAllocJBU(Pjpm_t Pjpm)
|
||||
{
|
||||
Word_t Words = sizeof(jbu_t) / cJU_BYTESPERWORD;
|
||||
Pjbu_t PjbuRaw = (Pjbu_t) MALLOC(JudyMallocVirtual,
|
||||
Pjpm->jpm_TotalMemWords, Words);
|
||||
|
||||
assert((Words * cJU_BYTESPERWORD) == sizeof(jbu_t));
|
||||
|
||||
if ((Word_t) PjbuRaw > sizeof(Word_t))
|
||||
{
|
||||
Pjpm->jpm_TotalMemWords += Words;
|
||||
}
|
||||
else { J__UDYSETALLOCERROR(PjbuRaw); }
|
||||
|
||||
TRACE_ALLOC5("0x%x %8lu = j__udyAllocJBU(), Words = %lu\n", PjbuRaw,
|
||||
j__udyMemSequence++, Words, (Pjpm->jpm_Pop0) + 2);
|
||||
MALLOCBITS_SET(Pjbu_t, PjbuRaw);
|
||||
return(PjbuRaw);
|
||||
|
||||
} // j__udyAllocJBU()
|
||||
|
||||
|
||||
#if (defined(JUDYL) || (! defined(JU_64BIT)))
|
||||
|
||||
FUNCTION Pjll_t j__udyAllocJLL1(Word_t Pop1, Pjpm_t Pjpm)
|
||||
{
|
||||
Word_t Words = JU_LEAF1POPTOWORDS(Pop1);
|
||||
Pjll_t PjllRaw;
|
||||
|
||||
PjllRaw = (Pjll_t) MALLOC(JudyMalloc, Pjpm->jpm_TotalMemWords, Words);
|
||||
|
||||
if ((Word_t) PjllRaw > sizeof(Word_t))
|
||||
{
|
||||
Pjpm->jpm_TotalMemWords += Words;
|
||||
}
|
||||
else { J__UDYSETALLOCERROR(PjllRaw); }
|
||||
|
||||
TRACE_ALLOC6("0x%x %8lu = j__udyAllocJLL1(%lu), Words = %lu\n", PjllRaw,
|
||||
j__udyMemSequence++, Pop1, Words, (Pjpm->jpm_Pop0) + 2);
|
||||
MALLOCBITS_SET(Pjll_t, PjllRaw);
|
||||
return(PjllRaw);
|
||||
|
||||
} // j__udyAllocJLL1()
|
||||
|
||||
#endif // (JUDYL || (! JU_64BIT))
|
||||
|
||||
|
||||
FUNCTION Pjll_t j__udyAllocJLL2(Word_t Pop1, Pjpm_t Pjpm)
|
||||
{
|
||||
Word_t Words = JU_LEAF2POPTOWORDS(Pop1);
|
||||
Pjll_t PjllRaw;
|
||||
|
||||
PjllRaw = (Pjll_t) MALLOC(JudyMalloc, Pjpm->jpm_TotalMemWords, Words);
|
||||
|
||||
if ((Word_t) PjllRaw > sizeof(Word_t))
|
||||
{
|
||||
Pjpm->jpm_TotalMemWords += Words;
|
||||
}
|
||||
else { J__UDYSETALLOCERROR(PjllRaw); }
|
||||
|
||||
TRACE_ALLOC6("0x%x %8lu = j__udyAllocJLL2(%lu), Words = %lu\n", PjllRaw,
|
||||
j__udyMemSequence++, Pop1, Words, (Pjpm->jpm_Pop0) + 2);
|
||||
MALLOCBITS_SET(Pjll_t, PjllRaw);
|
||||
return(PjllRaw);
|
||||
|
||||
} // j__udyAllocJLL2()
|
||||
|
||||
|
||||
FUNCTION Pjll_t j__udyAllocJLL3(Word_t Pop1, Pjpm_t Pjpm)
|
||||
{
|
||||
Word_t Words = JU_LEAF3POPTOWORDS(Pop1);
|
||||
Pjll_t PjllRaw;
|
||||
|
||||
PjllRaw = (Pjll_t) MALLOC(JudyMalloc, Pjpm->jpm_TotalMemWords, Words);
|
||||
|
||||
if ((Word_t) PjllRaw > sizeof(Word_t))
|
||||
{
|
||||
Pjpm->jpm_TotalMemWords += Words;
|
||||
}
|
||||
else { J__UDYSETALLOCERROR(PjllRaw); }
|
||||
|
||||
TRACE_ALLOC6("0x%x %8lu = j__udyAllocJLL3(%lu), Words = %lu\n", PjllRaw,
|
||||
j__udyMemSequence++, Pop1, Words, (Pjpm->jpm_Pop0) + 2);
|
||||
MALLOCBITS_SET(Pjll_t, PjllRaw);
|
||||
return(PjllRaw);
|
||||
|
||||
} // j__udyAllocJLL3()
|
||||
|
||||
|
||||
#ifdef JU_64BIT
|
||||
|
||||
FUNCTION Pjll_t j__udyAllocJLL4(Word_t Pop1, Pjpm_t Pjpm)
|
||||
{
|
||||
Word_t Words = JU_LEAF4POPTOWORDS(Pop1);
|
||||
Pjll_t PjllRaw;
|
||||
|
||||
PjllRaw = (Pjll_t) MALLOC(JudyMalloc, Pjpm->jpm_TotalMemWords, Words);
|
||||
|
||||
if ((Word_t) PjllRaw > sizeof(Word_t))
|
||||
{
|
||||
Pjpm->jpm_TotalMemWords += Words;
|
||||
}
|
||||
else { J__UDYSETALLOCERROR(PjllRaw); }
|
||||
|
||||
TRACE_ALLOC6("0x%x %8lu = j__udyAllocJLL4(%lu), Words = %lu\n", PjllRaw,
|
||||
j__udyMemSequence++, Pop1, Words, (Pjpm->jpm_Pop0) + 2);
|
||||
MALLOCBITS_SET(Pjll_t, PjllRaw);
|
||||
return(PjllRaw);
|
||||
|
||||
} // j__udyAllocJLL4()
|
||||
|
||||
|
||||
FUNCTION Pjll_t j__udyAllocJLL5(Word_t Pop1, Pjpm_t Pjpm)
|
||||
{
|
||||
Word_t Words = JU_LEAF5POPTOWORDS(Pop1);
|
||||
Pjll_t PjllRaw;
|
||||
|
||||
PjllRaw = (Pjll_t) MALLOC(JudyMalloc, Pjpm->jpm_TotalMemWords, Words);
|
||||
|
||||
if ((Word_t) PjllRaw > sizeof(Word_t))
|
||||
{
|
||||
Pjpm->jpm_TotalMemWords += Words;
|
||||
}
|
||||
else { J__UDYSETALLOCERROR(PjllRaw); }
|
||||
|
||||
TRACE_ALLOC6("0x%x %8lu = j__udyAllocJLL5(%lu), Words = %lu\n", PjllRaw,
|
||||
j__udyMemSequence++, Pop1, Words, (Pjpm->jpm_Pop0) + 2);
|
||||
MALLOCBITS_SET(Pjll_t, PjllRaw);
|
||||
return(PjllRaw);
|
||||
|
||||
} // j__udyAllocJLL5()
|
||||
|
||||
|
||||
FUNCTION Pjll_t j__udyAllocJLL6(Word_t Pop1, Pjpm_t Pjpm)
|
||||
{
|
||||
Word_t Words = JU_LEAF6POPTOWORDS(Pop1);
|
||||
Pjll_t PjllRaw;
|
||||
|
||||
PjllRaw = (Pjll_t) MALLOC(JudyMalloc, Pjpm->jpm_TotalMemWords, Words);
|
||||
|
||||
if ((Word_t) PjllRaw > sizeof(Word_t))
|
||||
{
|
||||
Pjpm->jpm_TotalMemWords += Words;
|
||||
}
|
||||
else { J__UDYSETALLOCERROR(PjllRaw); }
|
||||
|
||||
TRACE_ALLOC6("0x%x %8lu = j__udyAllocJLL6(%lu), Words = %lu\n", PjllRaw,
|
||||
j__udyMemSequence++, Pop1, Words, (Pjpm->jpm_Pop0) + 2);
|
||||
MALLOCBITS_SET(Pjll_t, PjllRaw);
|
||||
return(PjllRaw);
|
||||
|
||||
} // j__udyAllocJLL6()
|
||||
|
||||
|
||||
FUNCTION Pjll_t j__udyAllocJLL7(Word_t Pop1, Pjpm_t Pjpm)
|
||||
{
|
||||
Word_t Words = JU_LEAF7POPTOWORDS(Pop1);
|
||||
Pjll_t PjllRaw;
|
||||
|
||||
PjllRaw = (Pjll_t) MALLOC(JudyMalloc, Pjpm->jpm_TotalMemWords, Words);
|
||||
|
||||
if ((Word_t) PjllRaw > sizeof(Word_t))
|
||||
{
|
||||
Pjpm->jpm_TotalMemWords += Words;
|
||||
}
|
||||
else { J__UDYSETALLOCERROR(PjllRaw); }
|
||||
|
||||
TRACE_ALLOC6("0x%x %8lu = j__udyAllocJLL7(%lu), Words = %lu\n", PjllRaw,
|
||||
j__udyMemSequence++, Pop1, Words, (Pjpm->jpm_Pop0) + 2);
|
||||
MALLOCBITS_SET(Pjll_t, PjllRaw);
|
||||
return(PjllRaw);
|
||||
|
||||
} // j__udyAllocJLL7()
|
||||
|
||||
#endif // JU_64BIT
|
||||
|
||||
|
||||
// Note: Root-level leaf addresses are always whole words (Pjlw_t), and unlike
|
||||
// other j__udyAlloc*() functions, they are returned non-raw, that is, without
|
||||
// malloc namespace or root pointer type bits (the latter are added later by
|
||||
// the caller):
|
||||
|
||||
FUNCTION Pjlw_t j__udyAllocJLW(Word_t Pop1)
|
||||
{
|
||||
Word_t Words = JU_LEAFWPOPTOWORDS(Pop1);
|
||||
Pjlw_t Pjlw = (Pjlw_t) MALLOC(JudyMalloc, Words, Words);
|
||||
|
||||
TRACE_ALLOC6("0x%x %8lu = j__udyAllocJLW(%lu), Words = %lu\n", Pjlw,
|
||||
j__udyMemSequence++, Pop1, Words, Pop1);
|
||||
// MALLOCBITS_SET(Pjlw_t, Pjlw); // see above.
|
||||
return(Pjlw);
|
||||
|
||||
} // j__udyAllocJLW()
|
||||
|
||||
|
||||
FUNCTION Pjlb_t j__udyAllocJLB1(Pjpm_t Pjpm)
|
||||
{
|
||||
Word_t Words = sizeof(jlb_t) / cJU_BYTESPERWORD;
|
||||
Pjlb_t PjlbRaw;
|
||||
|
||||
PjlbRaw = (Pjlb_t) MALLOC(JudyMalloc, Pjpm->jpm_TotalMemWords, Words);
|
||||
|
||||
assert((Words * cJU_BYTESPERWORD) == sizeof(jlb_t));
|
||||
|
||||
if ((Word_t) PjlbRaw > sizeof(Word_t))
|
||||
{
|
||||
ZEROWORDS(P_JLB(PjlbRaw), Words);
|
||||
Pjpm->jpm_TotalMemWords += Words;
|
||||
}
|
||||
else { J__UDYSETALLOCERROR(PjlbRaw); }
|
||||
|
||||
TRACE_ALLOC5("0x%x %8lu = j__udyAllocJLB1(), Words = %lu\n", PjlbRaw,
|
||||
j__udyMemSequence++, Words, (Pjpm->jpm_Pop0) + 2);
|
||||
MALLOCBITS_SET(Pjlb_t, PjlbRaw);
|
||||
return(PjlbRaw);
|
||||
|
||||
} // j__udyAllocJLB1()
|
||||
|
||||
|
||||
#ifdef JUDYL
|
||||
|
||||
FUNCTION Pjv_t j__udyLAllocJV(Word_t Pop1, Pjpm_t Pjpm)
|
||||
{
|
||||
Word_t Words = JL_LEAFVPOPTOWORDS(Pop1);
|
||||
Pjv_t PjvRaw;
|
||||
|
||||
PjvRaw = (Pjv_t) MALLOC(JudyMalloc, Pjpm->jpm_TotalMemWords, Words);
|
||||
|
||||
if ((Word_t) PjvRaw > sizeof(Word_t))
|
||||
{
|
||||
Pjpm->jpm_TotalMemWords += Words;
|
||||
}
|
||||
else { J__UDYSETALLOCERROR(PjvRaw); }
|
||||
|
||||
TRACE_ALLOC6("0x%x %8lu = j__udyLAllocJV(%lu), Words = %lu\n", PjvRaw,
|
||||
j__udyMemSequence++, Pop1, Words, (Pjpm->jpm_Pop0) + 2);
|
||||
MALLOCBITS_SET(Pjv_t, PjvRaw);
|
||||
return(PjvRaw);
|
||||
|
||||
} // j__udyLAllocJV()
|
||||
|
||||
#endif // JUDYL
|
||||
|
||||
|
||||
// ****************************************************************************
|
||||
// FREE FUNCTIONS:
|
||||
//
|
||||
// To help the compiler catch coding errors, each function takes a specific
|
||||
// object type to free.
|
||||
|
||||
|
||||
// Note: j__udyFreeJPM() receives a root pointer with NO root pointer type
|
||||
// bits present, that is, they must be stripped by the caller using P_JPM():
|
||||
|
||||
FUNCTION void j__udyFreeJPM(Pjpm_t PjpmFree, Pjpm_t PjpmStats)
|
||||
{
|
||||
Word_t Words = sizeof(jpm_t) / cJU_BYTESPERWORD;
|
||||
|
||||
// MALLOCBITS_TEST(Pjpm_t, PjpmFree); // see above.
|
||||
JudyFree((Pvoid_t) PjpmFree, Words);
|
||||
|
||||
if (PjpmStats != (Pjpm_t) NULL) PjpmStats->jpm_TotalMemWords -= Words;
|
||||
|
||||
// Note: Log PjpmFree->jpm_Pop0, similar to other j__udyFree*() functions, not
|
||||
// an assumed value of cJU_LEAFW_MAXPOP1, for when the caller is
|
||||
// Judy*FreeArray(), jpm_Pop0 is set to 0, and the population after the free
|
||||
// really will be 0, not cJU_LEAFW_MAXPOP1.
|
||||
|
||||
TRACE_FREE6("0x%x %8lu = j__udyFreeJPM(%lu), Words = %lu\n", PjpmFree,
|
||||
j__udyMemSequence++, Words, Words, PjpmFree->jpm_Pop0);
|
||||
|
||||
|
||||
} // j__udyFreeJPM()
|
||||
|
||||
|
||||
FUNCTION void j__udyFreeJBL(Pjbl_t Pjbl, Pjpm_t Pjpm)
|
||||
{
|
||||
Word_t Words = sizeof(jbl_t) / cJU_BYTESPERWORD;
|
||||
|
||||
MALLOCBITS_TEST(Pjbl_t, Pjbl);
|
||||
JudyFreeVirtual((Pvoid_t) Pjbl, Words);
|
||||
|
||||
Pjpm->jpm_TotalMemWords -= Words;
|
||||
|
||||
TRACE_FREE5("0x%x %8lu = j__udyFreeJBL(), Words = %lu\n", Pjbl,
|
||||
j__udyMemSequence++, Words, Pjpm->jpm_Pop0);
|
||||
|
||||
|
||||
} // j__udyFreeJBL()
|
||||
|
||||
|
||||
FUNCTION void j__udyFreeJBB(Pjbb_t Pjbb, Pjpm_t Pjpm)
|
||||
{
|
||||
Word_t Words = sizeof(jbb_t) / cJU_BYTESPERWORD;
|
||||
|
||||
MALLOCBITS_TEST(Pjbb_t, Pjbb);
|
||||
JudyFreeVirtual((Pvoid_t) Pjbb, Words);
|
||||
|
||||
Pjpm->jpm_TotalMemWords -= Words;
|
||||
|
||||
TRACE_FREE5("0x%x %8lu = j__udyFreeJBB(), Words = %lu\n", Pjbb,
|
||||
j__udyMemSequence++, Words, Pjpm->jpm_Pop0);
|
||||
|
||||
|
||||
} // j__udyFreeJBB()
|
||||
|
||||
|
||||
FUNCTION void j__udyFreeJBBJP(Pjp_t Pjp, Word_t NumJPs, Pjpm_t Pjpm)
|
||||
{
|
||||
Word_t Words = JU_BRANCHJP_NUMJPSTOWORDS(NumJPs);
|
||||
|
||||
MALLOCBITS_TEST(Pjp_t, Pjp);
|
||||
JudyFree((Pvoid_t) Pjp, Words);
|
||||
|
||||
Pjpm->jpm_TotalMemWords -= Words;
|
||||
|
||||
TRACE_FREE6("0x%x %8lu = j__udyFreeJBBJP(%lu), Words = %lu\n", Pjp,
|
||||
j__udyMemSequence++, NumJPs, Words, Pjpm->jpm_Pop0);
|
||||
|
||||
|
||||
} // j__udyFreeJBBJP()
|
||||
|
||||
|
||||
FUNCTION void j__udyFreeJBU(Pjbu_t Pjbu, Pjpm_t Pjpm)
|
||||
{
|
||||
Word_t Words = sizeof(jbu_t) / cJU_BYTESPERWORD;
|
||||
|
||||
MALLOCBITS_TEST(Pjbu_t, Pjbu);
|
||||
JudyFreeVirtual((Pvoid_t) Pjbu, Words);
|
||||
|
||||
Pjpm->jpm_TotalMemWords -= Words;
|
||||
|
||||
TRACE_FREE5("0x%x %8lu = j__udyFreeJBU(), Words = %lu\n", Pjbu,
|
||||
j__udyMemSequence++, Words, Pjpm->jpm_Pop0);
|
||||
|
||||
|
||||
} // j__udyFreeJBU()
|
||||
|
||||
|
||||
#if (defined(JUDYL) || (! defined(JU_64BIT)))
|
||||
|
||||
FUNCTION void j__udyFreeJLL1(Pjll_t Pjll, Word_t Pop1, Pjpm_t Pjpm)
|
||||
{
|
||||
Word_t Words = JU_LEAF1POPTOWORDS(Pop1);
|
||||
|
||||
MALLOCBITS_TEST(Pjll_t, Pjll);
|
||||
JudyFree((Pvoid_t) Pjll, Words);
|
||||
|
||||
Pjpm->jpm_TotalMemWords -= Words;
|
||||
|
||||
TRACE_FREE6("0x%x %8lu = j__udyFreeJLL1(%lu), Words = %lu\n", Pjll,
|
||||
j__udyMemSequence++, Pop1, Words, Pjpm->jpm_Pop0);
|
||||
|
||||
|
||||
} // j__udyFreeJLL1()
|
||||
|
||||
#endif // (JUDYL || (! JU_64BIT))
|
||||
|
||||
|
||||
FUNCTION void j__udyFreeJLL2(Pjll_t Pjll, Word_t Pop1, Pjpm_t Pjpm)
|
||||
{
|
||||
Word_t Words = JU_LEAF2POPTOWORDS(Pop1);
|
||||
|
||||
MALLOCBITS_TEST(Pjll_t, Pjll);
|
||||
JudyFree((Pvoid_t) Pjll, Words);
|
||||
|
||||
Pjpm->jpm_TotalMemWords -= Words;
|
||||
|
||||
TRACE_FREE6("0x%x %8lu = j__udyFreeJLL2(%lu), Words = %lu\n", Pjll,
|
||||
j__udyMemSequence++, Pop1, Words, Pjpm->jpm_Pop0);
|
||||
|
||||
|
||||
} // j__udyFreeJLL2()
|
||||
|
||||
|
||||
FUNCTION void j__udyFreeJLL3(Pjll_t Pjll, Word_t Pop1, Pjpm_t Pjpm)
|
||||
{
|
||||
Word_t Words = JU_LEAF3POPTOWORDS(Pop1);
|
||||
|
||||
MALLOCBITS_TEST(Pjll_t, Pjll);
|
||||
JudyFree((Pvoid_t) Pjll, Words);
|
||||
|
||||
Pjpm->jpm_TotalMemWords -= Words;
|
||||
|
||||
TRACE_FREE6("0x%x %8lu = j__udyFreeJLL3(%lu), Words = %lu\n", Pjll,
|
||||
j__udyMemSequence++, Pop1, Words, Pjpm->jpm_Pop0);
|
||||
|
||||
|
||||
} // j__udyFreeJLL3()
|
||||
|
||||
|
||||
#ifdef JU_64BIT
|
||||
|
||||
FUNCTION void j__udyFreeJLL4(Pjll_t Pjll, Word_t Pop1, Pjpm_t Pjpm)
|
||||
{
|
||||
Word_t Words = JU_LEAF4POPTOWORDS(Pop1);
|
||||
|
||||
MALLOCBITS_TEST(Pjll_t, Pjll);
|
||||
JudyFree((Pvoid_t) Pjll, Words);
|
||||
|
||||
Pjpm->jpm_TotalMemWords -= Words;
|
||||
|
||||
TRACE_FREE6("0x%x %8lu = j__udyFreeJLL4(%lu), Words = %lu\n", Pjll,
|
||||
j__udyMemSequence++, Pop1, Words, Pjpm->jpm_Pop0);
|
||||
|
||||
|
||||
} // j__udyFreeJLL4()
|
||||
|
||||
|
||||
FUNCTION void j__udyFreeJLL5(Pjll_t Pjll, Word_t Pop1, Pjpm_t Pjpm)
|
||||
{
|
||||
Word_t Words = JU_LEAF5POPTOWORDS(Pop1);
|
||||
|
||||
MALLOCBITS_TEST(Pjll_t, Pjll);
|
||||
JudyFree((Pvoid_t) Pjll, Words);
|
||||
|
||||
Pjpm->jpm_TotalMemWords -= Words;
|
||||
|
||||
TRACE_FREE6("0x%x %8lu = j__udyFreeJLL5(%lu), Words = %lu\n", Pjll,
|
||||
j__udyMemSequence++, Pop1, Words, Pjpm->jpm_Pop0);
|
||||
|
||||
|
||||
} // j__udyFreeJLL5()
|
||||
|
||||
|
||||
FUNCTION void j__udyFreeJLL6(Pjll_t Pjll, Word_t Pop1, Pjpm_t Pjpm)
|
||||
{
|
||||
Word_t Words = JU_LEAF6POPTOWORDS(Pop1);
|
||||
|
||||
MALLOCBITS_TEST(Pjll_t, Pjll);
|
||||
JudyFree((Pvoid_t) Pjll, Words);
|
||||
|
||||
Pjpm->jpm_TotalMemWords -= Words;
|
||||
|
||||
TRACE_FREE6("0x%x %8lu = j__udyFreeJLL6(%lu), Words = %lu\n", Pjll,
|
||||
j__udyMemSequence++, Pop1, Words, Pjpm->jpm_Pop0);
|
||||
|
||||
|
||||
} // j__udyFreeJLL6()
|
||||
|
||||
|
||||
FUNCTION void j__udyFreeJLL7(Pjll_t Pjll, Word_t Pop1, Pjpm_t Pjpm)
|
||||
{
|
||||
Word_t Words = JU_LEAF7POPTOWORDS(Pop1);
|
||||
|
||||
MALLOCBITS_TEST(Pjll_t, Pjll);
|
||||
JudyFree((Pvoid_t) Pjll, Words);
|
||||
|
||||
Pjpm->jpm_TotalMemWords -= Words;
|
||||
|
||||
TRACE_FREE6("0x%x %8lu = j__udyFreeJLL7(%lu), Words = %lu\n", Pjll,
|
||||
j__udyMemSequence++, Pop1, Words, Pjpm->jpm_Pop0);
|
||||
|
||||
|
||||
} // j__udyFreeJLL7()
|
||||
|
||||
#endif // JU_64BIT
|
||||
|
||||
|
||||
// Note: j__udyFreeJLW() receives a root pointer with NO root pointer type
|
||||
// bits present, that is, they are stripped by P_JLW():
|
||||
|
||||
FUNCTION void j__udyFreeJLW(Pjlw_t Pjlw, Word_t Pop1, Pjpm_t Pjpm)
|
||||
{
|
||||
Word_t Words = JU_LEAFWPOPTOWORDS(Pop1);
|
||||
|
||||
// MALLOCBITS_TEST(Pjlw_t, Pjlw); // see above.
|
||||
JudyFree((Pvoid_t) Pjlw, Words);
|
||||
|
||||
if (Pjpm) Pjpm->jpm_TotalMemWords -= Words;
|
||||
|
||||
TRACE_FREE6("0x%x %8lu = j__udyFreeJLW(%lu), Words = %lu\n", Pjlw,
|
||||
j__udyMemSequence++, Pop1, Words, Pop1 - 1);
|
||||
|
||||
|
||||
} // j__udyFreeJLW()
|
||||
|
||||
|
||||
FUNCTION void j__udyFreeJLB1(Pjlb_t Pjlb, Pjpm_t Pjpm)
|
||||
{
|
||||
Word_t Words = sizeof(jlb_t) / cJU_BYTESPERWORD;
|
||||
|
||||
MALLOCBITS_TEST(Pjlb_t, Pjlb);
|
||||
JudyFree((Pvoid_t) Pjlb, Words);
|
||||
|
||||
Pjpm->jpm_TotalMemWords -= Words;
|
||||
|
||||
TRACE_FREE5("0x%x %8lu = j__udyFreeJLB1(), Words = %lu\n", Pjlb,
|
||||
j__udyMemSequence++, Words, Pjpm->jpm_Pop0);
|
||||
|
||||
|
||||
} // j__udyFreeJLB1()
|
||||
|
||||
|
||||
#ifdef JUDYL
|
||||
|
||||
FUNCTION void j__udyLFreeJV(Pjv_t Pjv, Word_t Pop1, Pjpm_t Pjpm)
|
||||
{
|
||||
Word_t Words = JL_LEAFVPOPTOWORDS(Pop1);
|
||||
|
||||
MALLOCBITS_TEST(Pjv_t, Pjv);
|
||||
JudyFree((Pvoid_t) Pjv, Words);
|
||||
|
||||
Pjpm->jpm_TotalMemWords -= Words;
|
||||
|
||||
TRACE_FREE6("0x%x %8lu = j__udyLFreeJV(%lu), Words = %lu\n", Pjv,
|
||||
j__udyMemSequence++, Pop1, Words, Pjpm->jpm_Pop0);
|
||||
|
||||
|
||||
} // j__udyLFreeJV()
|
||||
|
||||
#endif // JUDYL
|
259
dlls/arrayx/Judy-1.0.1/src/JudyL/JudyLMemActive.c
Normal file
259
dlls/arrayx/Judy-1.0.1/src/JudyL/JudyLMemActive.c
Normal file
|
@ -0,0 +1,259 @@
|
|||
// Copyright (C) 2000 - 2002 Hewlett-Packard Company
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify it
|
||||
// under the term of the GNU Lesser General Public License as published by the
|
||||
// Free Software Foundation; either version 2 of the License, or (at your
|
||||
// option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
// for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with this program; if not, write to the Free Software Foundation,
|
||||
// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
// _________________
|
||||
|
||||
// @(#) $Revision$ $Source$
|
||||
//
|
||||
// Return number of bytes of memory used to support a Judy1/L array.
|
||||
// Compile with one of -DJUDY1 or -DJUDYL.
|
||||
|
||||
#if (! (defined(JUDY1) || defined(JUDYL)))
|
||||
#error: One of -DJUDY1 or -DJUDYL must be specified.
|
||||
#endif
|
||||
|
||||
#ifdef JUDY1
|
||||
#include "Judy1.h"
|
||||
#else
|
||||
#include "JudyL.h"
|
||||
#endif
|
||||
|
||||
#include "JudyPrivate1L.h"
|
||||
|
||||
FUNCTION static Word_t j__udyGetMemActive(Pjp_t);
|
||||
|
||||
|
||||
// ****************************************************************************
|
||||
// J U D Y 1 M E M A C T I V E
|
||||
// J U D Y L M E M A C T I V E
|
||||
|
||||
#ifdef JUDY1
|
||||
FUNCTION Word_t Judy1MemActive
|
||||
#else
|
||||
FUNCTION Word_t JudyLMemActive
|
||||
#endif
|
||||
(
|
||||
Pcvoid_t PArray // from which to retrieve.
|
||||
)
|
||||
{
|
||||
if (PArray == (Pcvoid_t)NULL) return(0);
|
||||
|
||||
if (JU_LEAFW_POP0(PArray) < cJU_LEAFW_MAXPOP1) // must be a LEAFW
|
||||
{
|
||||
Pjlw_t Pjlw = P_JLW(PArray); // first word of leaf.
|
||||
Word_t Words = Pjlw[0] + 1; // population.
|
||||
#ifdef JUDY1
|
||||
return((Words + 1) * sizeof(Word_t));
|
||||
#else
|
||||
return(((Words * 2) + 1) * sizeof(Word_t));
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
Pjpm_t Pjpm = P_JPM(PArray);
|
||||
return(j__udyGetMemActive(&Pjpm->jpm_JP) + sizeof(jpm_t));
|
||||
}
|
||||
|
||||
} // JudyMemActive()
|
||||
|
||||
|
||||
// ****************************************************************************
|
||||
// __ J U D Y G E T M E M A C T I V E
|
||||
|
||||
FUNCTION static Word_t j__udyGetMemActive(
|
||||
Pjp_t Pjp) // top of subtree.
|
||||
{
|
||||
Word_t offset; // in a branch.
|
||||
Word_t Bytes = 0; // actual bytes used at this level.
|
||||
Word_t IdxSz; // bytes per index in leaves
|
||||
|
||||
switch (JU_JPTYPE(Pjp))
|
||||
{
|
||||
|
||||
case cJU_JPBRANCH_L2:
|
||||
case cJU_JPBRANCH_L3:
|
||||
#ifdef JU_64BIT
|
||||
case cJU_JPBRANCH_L4:
|
||||
case cJU_JPBRANCH_L5:
|
||||
case cJU_JPBRANCH_L6:
|
||||
case cJU_JPBRANCH_L7:
|
||||
#endif
|
||||
case cJU_JPBRANCH_L:
|
||||
{
|
||||
Pjbl_t Pjbl = P_JBL(Pjp->jp_Addr);
|
||||
|
||||
for (offset = 0; offset < (Pjbl->jbl_NumJPs); ++offset)
|
||||
Bytes += j__udyGetMemActive((Pjbl->jbl_jp) + offset);
|
||||
|
||||
return(Bytes + sizeof(jbl_t));
|
||||
}
|
||||
|
||||
case cJU_JPBRANCH_B2:
|
||||
case cJU_JPBRANCH_B3:
|
||||
#ifdef JU_64BIT
|
||||
case cJU_JPBRANCH_B4:
|
||||
case cJU_JPBRANCH_B5:
|
||||
case cJU_JPBRANCH_B6:
|
||||
case cJU_JPBRANCH_B7:
|
||||
#endif
|
||||
case cJU_JPBRANCH_B:
|
||||
{
|
||||
Word_t subexp;
|
||||
Word_t jpcount;
|
||||
Pjbb_t Pjbb = P_JBB(Pjp->jp_Addr);
|
||||
|
||||
for (subexp = 0; subexp < cJU_NUMSUBEXPB; ++subexp)
|
||||
{
|
||||
jpcount = j__udyCountBitsB(JU_JBB_BITMAP(Pjbb, subexp));
|
||||
Bytes += jpcount * sizeof(jp_t);
|
||||
|
||||
for (offset = 0; offset < jpcount; ++offset)
|
||||
{
|
||||
Bytes += j__udyGetMemActive(P_JP(JU_JBB_PJP(Pjbb, subexp))
|
||||
+ offset);
|
||||
}
|
||||
}
|
||||
|
||||
return(Bytes + sizeof(jbb_t));
|
||||
}
|
||||
|
||||
case cJU_JPBRANCH_U2:
|
||||
case cJU_JPBRANCH_U3:
|
||||
#ifdef JU_64BIT
|
||||
case cJU_JPBRANCH_U4:
|
||||
case cJU_JPBRANCH_U5:
|
||||
case cJU_JPBRANCH_U6:
|
||||
case cJU_JPBRANCH_U7:
|
||||
#endif
|
||||
case cJU_JPBRANCH_U:
|
||||
{
|
||||
Pjbu_t Pjbu = P_JBU(Pjp->jp_Addr);
|
||||
|
||||
for (offset = 0; offset < cJU_BRANCHUNUMJPS; ++offset)
|
||||
{
|
||||
if (((Pjbu->jbu_jp[offset].jp_Type) >= cJU_JPNULL1)
|
||||
&& ((Pjbu->jbu_jp[offset].jp_Type) <= cJU_JPNULLMAX))
|
||||
{
|
||||
continue; // skip null JP to save time.
|
||||
}
|
||||
|
||||
Bytes += j__udyGetMemActive(Pjbu->jbu_jp + offset);
|
||||
}
|
||||
|
||||
return(Bytes + sizeof(jbu_t));
|
||||
}
|
||||
|
||||
|
||||
// -- Cases below here terminate and do not recurse. --
|
||||
|
||||
#if (defined(JUDYL) || (! defined(JU_64BIT)))
|
||||
case cJU_JPLEAF1: IdxSz = 1; goto LeafWords;
|
||||
#endif
|
||||
case cJU_JPLEAF2: IdxSz = 2; goto LeafWords;
|
||||
case cJU_JPLEAF3: IdxSz = 3; goto LeafWords;
|
||||
#ifdef JU_64BIT
|
||||
case cJU_JPLEAF4: IdxSz = 4; goto LeafWords;
|
||||
case cJU_JPLEAF5: IdxSz = 5; goto LeafWords;
|
||||
case cJU_JPLEAF6: IdxSz = 6; goto LeafWords;
|
||||
case cJU_JPLEAF7: IdxSz = 7; goto LeafWords;
|
||||
#endif
|
||||
LeafWords:
|
||||
|
||||
#ifdef JUDY1
|
||||
return(IdxSz * (JU_JPLEAF_POP0(Pjp) + 1));
|
||||
#else
|
||||
return((IdxSz + sizeof(Word_t))
|
||||
* (JU_JPLEAF_POP0(Pjp) + 1));
|
||||
#endif
|
||||
case cJU_JPLEAF_B1:
|
||||
{
|
||||
#ifdef JUDY1
|
||||
return(sizeof(jlb_t));
|
||||
#else
|
||||
Bytes = (JU_JPLEAF_POP0(Pjp) + 1) * sizeof(Word_t);
|
||||
|
||||
return(Bytes + sizeof(jlb_t));
|
||||
#endif
|
||||
}
|
||||
|
||||
JUDY1CODE(case cJ1_JPFULLPOPU1: return(0);)
|
||||
|
||||
#ifdef JUDY1
|
||||
#define J__Mpy 0
|
||||
#else
|
||||
#define J__Mpy sizeof(Word_t)
|
||||
#endif
|
||||
|
||||
case cJU_JPIMMED_1_01: return(0);
|
||||
case cJU_JPIMMED_2_01: return(0);
|
||||
case cJU_JPIMMED_3_01: return(0);
|
||||
#ifdef JU_64BIT
|
||||
case cJU_JPIMMED_4_01: return(0);
|
||||
case cJU_JPIMMED_5_01: return(0);
|
||||
case cJU_JPIMMED_6_01: return(0);
|
||||
case cJU_JPIMMED_7_01: return(0);
|
||||
#endif
|
||||
|
||||
case cJU_JPIMMED_1_02: return(J__Mpy * 2);
|
||||
case cJU_JPIMMED_1_03: return(J__Mpy * 3);
|
||||
#if (defined(JUDY1) || defined(JU_64BIT))
|
||||
case cJU_JPIMMED_1_04: return(J__Mpy * 4);
|
||||
case cJU_JPIMMED_1_05: return(J__Mpy * 5);
|
||||
case cJU_JPIMMED_1_06: return(J__Mpy * 6);
|
||||
case cJU_JPIMMED_1_07: return(J__Mpy * 7);
|
||||
#endif
|
||||
#if (defined(JUDY1) && defined(JU_64BIT))
|
||||
case cJ1_JPIMMED_1_08: return(0);
|
||||
case cJ1_JPIMMED_1_09: return(0);
|
||||
case cJ1_JPIMMED_1_10: return(0);
|
||||
case cJ1_JPIMMED_1_11: return(0);
|
||||
case cJ1_JPIMMED_1_12: return(0);
|
||||
case cJ1_JPIMMED_1_13: return(0);
|
||||
case cJ1_JPIMMED_1_14: return(0);
|
||||
case cJ1_JPIMMED_1_15: return(0);
|
||||
#endif
|
||||
|
||||
#if (defined(JUDY1) || defined(JU_64BIT))
|
||||
case cJU_JPIMMED_2_02: return(J__Mpy * 2);
|
||||
case cJU_JPIMMED_2_03: return(J__Mpy * 3);
|
||||
#endif
|
||||
#if (defined(JUDY1) && defined(JU_64BIT))
|
||||
case cJ1_JPIMMED_2_04: return(0);
|
||||
case cJ1_JPIMMED_2_05: return(0);
|
||||
case cJ1_JPIMMED_2_06: return(0);
|
||||
case cJ1_JPIMMED_2_07: return(0);
|
||||
#endif
|
||||
|
||||
#if (defined(JUDY1) || defined(JU_64BIT))
|
||||
case cJU_JPIMMED_3_02: return(J__Mpy * 2);
|
||||
#endif
|
||||
#if (defined(JUDY1) && defined(JU_64BIT))
|
||||
case cJ1_JPIMMED_3_03: return(0);
|
||||
case cJ1_JPIMMED_3_04: return(0);
|
||||
case cJ1_JPIMMED_3_05: return(0);
|
||||
|
||||
case cJ1_JPIMMED_4_02: return(0);
|
||||
case cJ1_JPIMMED_4_03: return(0);
|
||||
case cJ1_JPIMMED_5_02: return(0);
|
||||
case cJ1_JPIMMED_5_03: return(0);
|
||||
case cJ1_JPIMMED_6_02: return(0);
|
||||
case cJ1_JPIMMED_7_02: return(0);
|
||||
#endif
|
||||
|
||||
} // switch (JU_JPTYPE(Pjp))
|
||||
|
||||
return(0); // to make some compilers happy.
|
||||
|
||||
} // j__udyGetMemActive()
|
61
dlls/arrayx/Judy-1.0.1/src/JudyL/JudyLMemUsed.c
Normal file
61
dlls/arrayx/Judy-1.0.1/src/JudyL/JudyLMemUsed.c
Normal file
|
@ -0,0 +1,61 @@
|
|||
// Copyright (C) 2000 - 2002 Hewlett-Packard Company
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify it
|
||||
// under the term of the GNU Lesser General Public License as published by the
|
||||
// Free Software Foundation; either version 2 of the License, or (at your
|
||||
// option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
// for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with this program; if not, write to the Free Software Foundation,
|
||||
// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
// _________________
|
||||
|
||||
// @(#) $Revision$ $Source$
|
||||
//
|
||||
// Return number of bytes of memory used to support a Judy1/L array.
|
||||
// Compile with one of -DJUDY1 or -DJUDYL.
|
||||
|
||||
#if (! (defined(JUDY1) || defined(JUDYL)))
|
||||
#error: One of -DJUDY1 or -DJUDYL must be specified.
|
||||
#endif
|
||||
|
||||
#ifdef JUDY1
|
||||
#include "Judy1.h"
|
||||
#else
|
||||
#include "JudyL.h"
|
||||
#endif
|
||||
|
||||
#include "JudyPrivate1L.h"
|
||||
|
||||
#ifdef JUDY1
|
||||
FUNCTION Word_t Judy1MemUsed
|
||||
#else // JUDYL
|
||||
FUNCTION Word_t JudyLMemUsed
|
||||
#endif
|
||||
(
|
||||
Pcvoid_t PArray // from which to retrieve.
|
||||
)
|
||||
{
|
||||
Word_t Words = 0;
|
||||
|
||||
if (PArray == (Pcvoid_t) NULL) return(0);
|
||||
|
||||
if (JU_LEAFW_POP0(PArray) < cJU_LEAFW_MAXPOP1) // must be a LEAFW
|
||||
{
|
||||
Pjlw_t Pjlw = P_JLW(PArray); // first word of leaf.
|
||||
Words = JU_LEAFWPOPTOWORDS(Pjlw[0] + 1); // based on pop1.
|
||||
}
|
||||
else
|
||||
{
|
||||
Pjpm_t Pjpm = P_JPM(PArray);
|
||||
Words = Pjpm->jpm_TotalMemWords;
|
||||
}
|
||||
|
||||
return(Words * sizeof(Word_t)); // convert to bytes.
|
||||
|
||||
} // Judy1MemUsed() / JudyLMemUsed()
|
1890
dlls/arrayx/Judy-1.0.1/src/JudyL/JudyLNext.c
Normal file
1890
dlls/arrayx/Judy-1.0.1/src/JudyL/JudyLNext.c
Normal file
File diff suppressed because it is too large
Load Diff
1390
dlls/arrayx/Judy-1.0.1/src/JudyL/JudyLNextEmpty.c
Normal file
1390
dlls/arrayx/Judy-1.0.1/src/JudyL/JudyLNextEmpty.c
Normal file
File diff suppressed because it is too large
Load Diff
1890
dlls/arrayx/Judy-1.0.1/src/JudyL/JudyLPrev.c
Normal file
1890
dlls/arrayx/Judy-1.0.1/src/JudyL/JudyLPrev.c
Normal file
File diff suppressed because it is too large
Load Diff
1390
dlls/arrayx/Judy-1.0.1/src/JudyL/JudyLPrevEmpty.c
Normal file
1390
dlls/arrayx/Judy-1.0.1/src/JudyL/JudyLPrevEmpty.c
Normal file
File diff suppressed because it is too large
Load Diff
121
dlls/arrayx/Judy-1.0.1/src/JudyL/JudyLTables.c
Normal file
121
dlls/arrayx/Judy-1.0.1/src/JudyL/JudyLTables.c
Normal file
|
@ -0,0 +1,121 @@
|
|||
// @(#) From generation tool: $Revision$ $Source$
|
||||
//
|
||||
|
||||
#include "JudyL.h"
|
||||
// Leave the malloc() sizes readable in the binary (via strings(1)):
|
||||
const char * JudyLMallocSizes = "JudyLMallocSizes = 3, 5, 7, 11, 15, 23, 32, 47, 64, Leaf1 = 25";
|
||||
|
||||
|
||||
// object uses 64 words
|
||||
// cJU_BITSPERSUBEXPB = 32
|
||||
const uint8_t
|
||||
j__L_BranchBJPPopToWords[cJU_BITSPERSUBEXPB + 1] =
|
||||
{
|
||||
0,
|
||||
3, 5, 7, 11, 11, 15, 15, 23,
|
||||
23, 23, 23, 32, 32, 32, 32, 32,
|
||||
47, 47, 47, 47, 47, 47, 47, 64,
|
||||
64, 64, 64, 64, 64, 64, 64, 64
|
||||
};
|
||||
|
||||
// object uses 32 words
|
||||
// cJL_LEAF1_MAXPOP1 = 25
|
||||
const uint8_t
|
||||
j__L_Leaf1PopToWords[cJL_LEAF1_MAXPOP1 + 1] =
|
||||
{
|
||||
0,
|
||||
3, 3, 5, 5, 7, 11, 11, 11,
|
||||
15, 15, 15, 15, 23, 23, 23, 23,
|
||||
23, 23, 32, 32, 32, 32, 32, 32,
|
||||
32
|
||||
};
|
||||
const uint8_t
|
||||
j__L_Leaf1Offset[cJL_LEAF1_MAXPOP1 + 1] =
|
||||
{
|
||||
0,
|
||||
1, 1, 1, 1, 2, 3, 3, 3,
|
||||
3, 3, 3, 3, 5, 5, 5, 5,
|
||||
5, 5, 7, 7, 7, 7, 7, 7,
|
||||
7
|
||||
};
|
||||
|
||||
// object uses 63 words
|
||||
// cJL_LEAF2_MAXPOP1 = 42
|
||||
const uint8_t
|
||||
j__L_Leaf2PopToWords[cJL_LEAF2_MAXPOP1 + 1] =
|
||||
{
|
||||
0,
|
||||
3, 3, 5, 7, 11, 11, 11, 15,
|
||||
15, 15, 23, 23, 23, 23, 23, 32,
|
||||
32, 32, 32, 32, 32, 47, 47, 47,
|
||||
47, 47, 47, 47, 47, 47, 47, 63,
|
||||
63, 63, 63, 63, 63, 63, 63, 63,
|
||||
63, 63
|
||||
};
|
||||
const uint8_t
|
||||
j__L_Leaf2Offset[cJL_LEAF2_MAXPOP1 + 1] =
|
||||
{
|
||||
0,
|
||||
1, 1, 2, 2, 4, 4, 4, 5,
|
||||
5, 5, 8, 8, 8, 8, 8, 11,
|
||||
11, 11, 11, 11, 11, 16, 16, 16,
|
||||
16, 16, 16, 16, 16, 16, 16, 21,
|
||||
21, 21, 21, 21, 21, 21, 21, 21,
|
||||
21, 21
|
||||
};
|
||||
|
||||
// object uses 63 words
|
||||
// cJL_LEAF3_MAXPOP1 = 36
|
||||
const uint8_t
|
||||
j__L_Leaf3PopToWords[cJL_LEAF3_MAXPOP1 + 1] =
|
||||
{
|
||||
0,
|
||||
3, 5, 7, 7, 11, 11, 15, 15,
|
||||
23, 23, 23, 23, 23, 32, 32, 32,
|
||||
32, 32, 47, 47, 47, 47, 47, 47,
|
||||
47, 47, 63, 63, 63, 63, 63, 63,
|
||||
63, 63, 63, 63
|
||||
};
|
||||
const uint8_t
|
||||
j__L_Leaf3Offset[cJL_LEAF3_MAXPOP1 + 1] =
|
||||
{
|
||||
0,
|
||||
1, 3, 3, 3, 5, 5, 6, 6,
|
||||
10, 10, 10, 10, 10, 14, 14, 14,
|
||||
14, 14, 20, 20, 20, 20, 20, 20,
|
||||
20, 20, 27, 27, 27, 27, 27, 27,
|
||||
27, 27, 27, 27
|
||||
};
|
||||
|
||||
// object uses 63 words
|
||||
// cJL_LEAFW_MAXPOP1 = 31
|
||||
const uint8_t
|
||||
j__L_LeafWPopToWords[cJL_LEAFW_MAXPOP1 + 1] =
|
||||
{
|
||||
0,
|
||||
3, 5, 7, 11, 11, 15, 15, 23,
|
||||
23, 23, 23, 32, 32, 32, 32, 47,
|
||||
47, 47, 47, 47, 47, 47, 47, 63,
|
||||
63, 63, 63, 63, 63, 63, 63
|
||||
};
|
||||
const uint8_t
|
||||
j__L_LeafWOffset[cJL_LEAFW_MAXPOP1 + 1] =
|
||||
{
|
||||
0,
|
||||
2, 3, 4, 6, 6, 8, 8, 12,
|
||||
12, 12, 12, 16, 16, 16, 16, 24,
|
||||
24, 24, 24, 24, 24, 24, 24, 32,
|
||||
32, 32, 32, 32, 32, 32, 32
|
||||
};
|
||||
|
||||
// object uses 32 words
|
||||
// cJU_BITSPERSUBEXPL = 32
|
||||
const uint8_t
|
||||
j__L_LeafVPopToWords[cJU_BITSPERSUBEXPL + 1] =
|
||||
{
|
||||
0,
|
||||
3, 3, 3, 5, 5, 7, 7, 11,
|
||||
11, 11, 11, 15, 15, 15, 15, 23,
|
||||
23, 23, 23, 23, 23, 23, 23, 32,
|
||||
32, 32, 32, 32, 32, 32, 32, 32
|
||||
};
|
296
dlls/arrayx/Judy-1.0.1/src/JudyL/JudyLTablesGen.c
Normal file
296
dlls/arrayx/Judy-1.0.1/src/JudyL/JudyLTablesGen.c
Normal file
|
@ -0,0 +1,296 @@
|
|||
// Copyright (C) 2000 - 2002 Hewlett-Packard Company
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify it
|
||||
// under the term of the GNU Lesser General Public License as published by the
|
||||
// Free Software Foundation; either version 2 of the License, or (at your
|
||||
// option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
// for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with this program; if not, write to the Free Software Foundation,
|
||||
// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
// _________________
|
||||
|
||||
// @(#) $Revision$ $Source$
|
||||
|
||||
#ifndef JU_WIN
|
||||
#include <unistd.h> // unavailable on win_*.
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#if (! (defined(JUDY1) || defined(JUDYL)))
|
||||
#error: One of -DJUDY1 or -DJUDYL must be specified.
|
||||
#endif
|
||||
|
||||
#define TERMINATOR 999 // terminator for Alloc tables
|
||||
|
||||
#define BPW sizeof(Word_t) // define bytes per word
|
||||
|
||||
#ifdef JUDY1
|
||||
#include "Judy1.h"
|
||||
#else
|
||||
#include "JudyL.h"
|
||||
#endif
|
||||
|
||||
FILE *fd;
|
||||
|
||||
// Definitions come from header files Judy1.h and JudyL.h:
|
||||
|
||||
int AllocSizes[] = ALLOCSIZES;
|
||||
|
||||
#define ROUNDUP(BYTES,BPW,OFFSETW) \
|
||||
((((BYTES) + (BPW) - 1) / (BPW)) + (OFFSETW))
|
||||
|
||||
|
||||
// ****************************************************************************
|
||||
// G E N T A B L E
|
||||
//
|
||||
// Note: "const" is required for newer compilers.
|
||||
|
||||
FUNCTION void GenTable(
|
||||
const char * TableName, // name of table string
|
||||
const char * TableSize, // dimentioned size string
|
||||
int IndexBytes, // bytes per Index
|
||||
int LeafSize, // number elements in object
|
||||
int ValueBytes, // bytes per Value
|
||||
int OffsetWords) // 1 for LEAFW
|
||||
{
|
||||
int * PAllocSizes = AllocSizes;
|
||||
int OWord;
|
||||
int CurWord;
|
||||
int IWord;
|
||||
int ii;
|
||||
int BytesOfIndex;
|
||||
int BytesOfObject;
|
||||
int Index;
|
||||
int LastWords;
|
||||
int Words [1000] = { 0 };
|
||||
int Offset[1000] = { 0 };
|
||||
int MaxWords;
|
||||
|
||||
MaxWords = ROUNDUP((IndexBytes + ValueBytes) * LeafSize, BPW, OffsetWords);
|
||||
Words[0] = 0;
|
||||
Offset[0] = 0;
|
||||
CurWord = TERMINATOR;
|
||||
|
||||
// Walk through all number of Indexes in table:
|
||||
|
||||
for (Index = 1; /* null */; ++Index)
|
||||
{
|
||||
|
||||
// Calculate byte required for next size:
|
||||
|
||||
BytesOfIndex = IndexBytes * Index;
|
||||
BytesOfObject = (IndexBytes + ValueBytes) * Index;
|
||||
|
||||
// Round up and calculate words required for next size:
|
||||
|
||||
OWord = ROUNDUP(BytesOfObject, BPW, OffsetWords);
|
||||
IWord = ROUNDUP(BytesOfIndex, BPW, OffsetWords);
|
||||
|
||||
// Root-level leaves of population of 1 and 2 do not have the 1 word offset:
|
||||
|
||||
// Save minimum value of offset:
|
||||
|
||||
Offset[Index] = IWord;
|
||||
|
||||
// Round up to next available size of words:
|
||||
|
||||
while (OWord > *PAllocSizes) PAllocSizes++;
|
||||
|
||||
if (Index == LeafSize)
|
||||
{
|
||||
CurWord = Words[Index] = OWord;
|
||||
break;
|
||||
}
|
||||
// end of available sizes ?
|
||||
|
||||
if (*PAllocSizes == TERMINATOR)
|
||||
{
|
||||
fprintf(stderr, "BUG, in %sPopToWords, sizes not big enough for object\n", TableName);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// Save words required and last word:
|
||||
|
||||
if (*PAllocSizes < MaxWords) { CurWord = Words[Index] = *PAllocSizes; }
|
||||
else { CurWord = Words[Index] = MaxWords; }
|
||||
|
||||
} // for each index
|
||||
|
||||
LastWords = TERMINATOR;
|
||||
|
||||
// Round up to largest size in each group of malloc sizes:
|
||||
|
||||
for (ii = LeafSize; ii > 0; ii--)
|
||||
{
|
||||
if (LastWords > (Words[ii] - ii)) LastWords = Offset[ii];
|
||||
else Offset[ii] = LastWords;
|
||||
}
|
||||
|
||||
// Print the PopToWords[] table:
|
||||
|
||||
fprintf(fd,"\n//\tobject uses %d words\n", CurWord);
|
||||
fprintf(fd,"//\t%s = %d\n", TableSize, LeafSize);
|
||||
|
||||
fprintf(fd,"const uint8_t\n");
|
||||
fprintf(fd,"%sPopToWords[%s + 1] =\n", TableName, TableSize);
|
||||
fprintf(fd,"{\n\t 0,");
|
||||
|
||||
for (ii = 1; ii <= LeafSize; ii++)
|
||||
{
|
||||
|
||||
// 8 columns per line, starting with 1:
|
||||
|
||||
if ((ii % 8) == 1) fprintf(fd,"\n\t");
|
||||
|
||||
fprintf(fd,"%2d", Words[ii]);
|
||||
|
||||
// If not last number place comma:
|
||||
|
||||
if (ii != LeafSize) fprintf(fd,", ");
|
||||
}
|
||||
fprintf(fd,"\n};\n");
|
||||
|
||||
// Print the Offset table if needed:
|
||||
|
||||
if (! ValueBytes) return;
|
||||
|
||||
fprintf(fd,"const uint8_t\n");
|
||||
fprintf(fd,"%sOffset[%s + 1] =\n", TableName, TableSize);
|
||||
fprintf(fd,"{\n");
|
||||
fprintf(fd,"\t 0,");
|
||||
|
||||
for (ii = 1; ii <= LeafSize; ii++)
|
||||
{
|
||||
if ((ii % 8) == 1) fprintf(fd,"\n\t");
|
||||
|
||||
fprintf(fd,"%2d", Offset[ii]);
|
||||
|
||||
if (ii != LeafSize) fprintf(fd,", ");
|
||||
}
|
||||
fprintf(fd,"\n};\n");
|
||||
|
||||
} // GenTable()
|
||||
|
||||
|
||||
// ****************************************************************************
|
||||
// M A I N
|
||||
|
||||
FUNCTION int main()
|
||||
{
|
||||
int ii;
|
||||
|
||||
#ifdef JUDY1
|
||||
char *fname = "Judy1Tables.c";
|
||||
#else
|
||||
char *fname = "JudyLTables.c";
|
||||
#endif
|
||||
|
||||
if ((fd = fopen(fname, "w")) == NULL){
|
||||
perror("FATAL ERROR: could not write to Judy[1L]Tables.c file\n");
|
||||
return (-1);
|
||||
}
|
||||
|
||||
|
||||
fprintf(fd,"// @(#) From generation tool: $Revision$ $Source$\n");
|
||||
fprintf(fd,"//\n\n");
|
||||
|
||||
|
||||
// ================================ Judy1 =================================
|
||||
#ifdef JUDY1
|
||||
|
||||
fprintf(fd,"#include \"Judy1.h\"\n");
|
||||
|
||||
fprintf(fd,"// Leave the malloc() sizes readable in the binary (via "
|
||||
"strings(1)):\n");
|
||||
fprintf(fd,"const char * Judy1MallocSizes = \"Judy1MallocSizes =");
|
||||
|
||||
for (ii = 0; AllocSizes[ii] != TERMINATOR; ii++)
|
||||
fprintf(fd," %d,", AllocSizes[ii]);
|
||||
|
||||
#ifndef JU_64BIT
|
||||
fprintf(fd," Leaf1 = %d\";\n\n", cJ1_LEAF1_MAXPOP1);
|
||||
#else
|
||||
fprintf(fd,"\";\n\n"); // no Leaf1 in this case.
|
||||
#endif
|
||||
|
||||
// ================================ 32 bit ================================
|
||||
#ifndef JU_64BIT
|
||||
|
||||
GenTable("j__1_BranchBJP","cJU_BITSPERSUBEXPB", 8, cJU_BITSPERSUBEXPB,0,0);
|
||||
|
||||
GenTable("j__1_Leaf1", "cJ1_LEAF1_MAXPOP1", 1, cJ1_LEAF1_MAXPOP1, 0, 0);
|
||||
GenTable("j__1_Leaf2", "cJ1_LEAF2_MAXPOP1", 2, cJ1_LEAF2_MAXPOP1, 0, 0);
|
||||
GenTable("j__1_Leaf3", "cJ1_LEAF3_MAXPOP1", 3, cJ1_LEAF3_MAXPOP1, 0, 0);
|
||||
GenTable("j__1_LeafW", "cJ1_LEAFW_MAXPOP1", 4, cJ1_LEAFW_MAXPOP1, 0, 1);
|
||||
|
||||
#endif
|
||||
|
||||
// ================================ 64 bit ================================
|
||||
#ifdef JU_64BIT
|
||||
GenTable("j__1_BranchBJP","cJU_BITSPERSUBEXPB",16, cJU_BITSPERSUBEXPB,0,0);
|
||||
|
||||
GenTable("j__1_Leaf2", "cJ1_LEAF2_MAXPOP1", 2, cJ1_LEAF2_MAXPOP1, 0, 0);
|
||||
GenTable("j__1_Leaf3", "cJ1_LEAF3_MAXPOP1", 3, cJ1_LEAF3_MAXPOP1, 0, 0);
|
||||
GenTable("j__1_Leaf4", "cJ1_LEAF4_MAXPOP1", 4, cJ1_LEAF4_MAXPOP1, 0, 0);
|
||||
GenTable("j__1_Leaf5", "cJ1_LEAF5_MAXPOP1", 5, cJ1_LEAF5_MAXPOP1, 0, 0);
|
||||
GenTable("j__1_Leaf6", "cJ1_LEAF6_MAXPOP1", 6, cJ1_LEAF6_MAXPOP1, 0, 0);
|
||||
GenTable("j__1_Leaf7", "cJ1_LEAF7_MAXPOP1", 7, cJ1_LEAF7_MAXPOP1, 0, 0);
|
||||
GenTable("j__1_LeafW", "cJ1_LEAFW_MAXPOP1", 8, cJ1_LEAFW_MAXPOP1, 0, 1);
|
||||
#endif
|
||||
#endif // JUDY1
|
||||
|
||||
|
||||
// ================================ JudyL =================================
|
||||
#ifdef JUDYL
|
||||
|
||||
fprintf(fd,"#include \"JudyL.h\"\n");
|
||||
|
||||
fprintf(fd,"// Leave the malloc() sizes readable in the binary (via "
|
||||
"strings(1)):\n");
|
||||
fprintf(fd,"const char * JudyLMallocSizes = \"JudyLMallocSizes =");
|
||||
|
||||
for (ii = 0; AllocSizes[ii] != TERMINATOR; ii++)
|
||||
fprintf(fd," %d,", AllocSizes[ii]);
|
||||
|
||||
fprintf(fd," Leaf1 = %ld\";\n\n", (Word_t)cJL_LEAF1_MAXPOP1);
|
||||
|
||||
#ifndef JU_64BIT
|
||||
// ================================ 32 bit ================================
|
||||
GenTable("j__L_BranchBJP","cJU_BITSPERSUBEXPB", 8, cJU_BITSPERSUBEXPB, 0,0);
|
||||
|
||||
GenTable("j__L_Leaf1", "cJL_LEAF1_MAXPOP1", 1, cJL_LEAF1_MAXPOP1, BPW,0);
|
||||
GenTable("j__L_Leaf2", "cJL_LEAF2_MAXPOP1", 2, cJL_LEAF2_MAXPOP1, BPW,0);
|
||||
GenTable("j__L_Leaf3", "cJL_LEAF3_MAXPOP1", 3, cJL_LEAF3_MAXPOP1, BPW,0);
|
||||
GenTable("j__L_LeafW", "cJL_LEAFW_MAXPOP1", 4, cJL_LEAFW_MAXPOP1, BPW,1);
|
||||
GenTable("j__L_LeafV", "cJU_BITSPERSUBEXPL", 4, cJU_BITSPERSUBEXPL, 0,0);
|
||||
#endif // 32 BIT
|
||||
|
||||
#ifdef JU_64BIT
|
||||
// ================================ 64 bit ================================
|
||||
GenTable("j__L_BranchBJP","cJU_BITSPERSUBEXPB",16, cJU_BITSPERSUBEXPB, 0,0);
|
||||
|
||||
GenTable("j__L_Leaf1", "cJL_LEAF1_MAXPOP1", 1, cJL_LEAF1_MAXPOP1, BPW,0);
|
||||
GenTable("j__L_Leaf2", "cJL_LEAF2_MAXPOP1", 2, cJL_LEAF2_MAXPOP1, BPW,0);
|
||||
GenTable("j__L_Leaf3", "cJL_LEAF3_MAXPOP1", 3, cJL_LEAF3_MAXPOP1, BPW,0);
|
||||
GenTable("j__L_Leaf4", "cJL_LEAF4_MAXPOP1", 4, cJL_LEAF4_MAXPOP1, BPW,0);
|
||||
GenTable("j__L_Leaf5", "cJL_LEAF5_MAXPOP1", 5, cJL_LEAF5_MAXPOP1, BPW,0);
|
||||
GenTable("j__L_Leaf6", "cJL_LEAF6_MAXPOP1", 6, cJL_LEAF6_MAXPOP1, BPW,0);
|
||||
GenTable("j__L_Leaf7", "cJL_LEAF7_MAXPOP1", 7, cJL_LEAF7_MAXPOP1, BPW,0);
|
||||
GenTable("j__L_LeafW", "cJL_LEAFW_MAXPOP1", 8, cJL_LEAFW_MAXPOP1, BPW,1);
|
||||
GenTable("j__L_LeafV", "cJU_BITSPERSUBEXPL", 8, cJU_BITSPERSUBEXPL, 0,0);
|
||||
#endif // 64 BIT
|
||||
|
||||
#endif // JUDYL
|
||||
fclose(fd);
|
||||
|
||||
return(0);
|
||||
|
||||
} // main()
|
BIN
dlls/arrayx/Judy-1.0.1/src/JudyL/JudyLTablesGen.exe
Normal file
BIN
dlls/arrayx/Judy-1.0.1/src/JudyL/JudyLTablesGen.exe
Normal file
Binary file not shown.
48
dlls/arrayx/Judy-1.0.1/src/JudyL/Makefile.am
Normal file
48
dlls/arrayx/Judy-1.0.1/src/JudyL/Makefile.am
Normal file
|
@ -0,0 +1,48 @@
|
|||
INCLUDES = -I. -I.. -I../JudyCommon/
|
||||
AM_CFLAGS = -DJUDYL @WARN_CFLAGS@
|
||||
|
||||
noinst_LTLIBRARIES = libJudyL.la libnext.la libprev.la libcount.la libinline.la
|
||||
|
||||
libJudyL_la_SOURCES = JudyLCascade.c JudyLTables.c JudyLCount.c JudyLCreateBranch.c JudyLDecascade.c JudyLDel.c JudyLFirst.c JudyLFreeArray.c JudyLGet.c JudyLInsArray.c JudyLIns.c JudyLInsertBranch.c JudyLMallocIF.c JudyLMemActive.c JudyLMemUsed.c
|
||||
|
||||
libnext_la_SOURCES = JudyLNext.c JudyLNextEmpty.c
|
||||
libnext_la_CFLAGS = $(AM_CFLAGS) -DJUDYNEXT
|
||||
|
||||
libprev_la_SOURCES = JudyLPrev.c JudyLPrevEmpty.c
|
||||
libprev_la_CFLAGS = $(AM_CFLAGS) -DJUDYPREV
|
||||
|
||||
libcount_la_SOURCES = JudyLByCount.c
|
||||
libcount_la_CFLAGS = $(AM_CFLAGS) -DNOSMARTJBB -DNOSMARTJBU -DNOSMARTJLB
|
||||
|
||||
libinline_la_SOURCES = j__udyLGet.c
|
||||
libinline_la_CFLAGS = $(AM_CFLAGS) -DJUDYGETINLINE
|
||||
|
||||
JudyLTables.c: JudyLTablesGen.c
|
||||
$(CC) $(INCLUDES) $(AM_CFLAGS) @CFLAGS@ -o JudyLTablesGen JudyLTablesGen.c; ./JudyLTablesGen
|
||||
|
||||
|
||||
JudyLCascade.c: copies
|
||||
|
||||
copies:
|
||||
cp -f ../JudyCommon/JudyByCount.c JudyLByCount.c
|
||||
cp -f ../JudyCommon/JudyCascade.c JudyLCascade.c
|
||||
cp -f ../JudyCommon/JudyCount.c JudyLCount.c
|
||||
cp -f ../JudyCommon/JudyCreateBranch.c JudyLCreateBranch.c
|
||||
cp -f ../JudyCommon/JudyDecascade.c JudyLDecascade.c
|
||||
cp -f ../JudyCommon/JudyDel.c JudyLDel.c
|
||||
cp -f ../JudyCommon/JudyFirst.c JudyLFirst.c
|
||||
cp -f ../JudyCommon/JudyFreeArray.c JudyLFreeArray.c
|
||||
cp -f ../JudyCommon/JudyGet.c JudyLGet.c
|
||||
cp -f ../JudyCommon/JudyGet.c j__udyLGet.c
|
||||
cp -f ../JudyCommon/JudyInsArray.c JudyLInsArray.c
|
||||
cp -f ../JudyCommon/JudyIns.c JudyLIns.c
|
||||
cp -f ../JudyCommon/JudyInsertBranch.c JudyLInsertBranch.c
|
||||
cp -f ../JudyCommon/JudyMallocIF.c JudyLMallocIF.c
|
||||
cp -f ../JudyCommon/JudyMemActive.c JudyLMemActive.c
|
||||
cp -f ../JudyCommon/JudyMemUsed.c JudyLMemUsed.c
|
||||
cp -f ../JudyCommon/JudyPrevNext.c JudyLNext.c
|
||||
cp -f ../JudyCommon/JudyPrevNext.c JudyLPrev.c
|
||||
cp -f ../JudyCommon/JudyPrevNextEmpty.c JudyLNextEmpty.c
|
||||
cp -f ../JudyCommon/JudyPrevNextEmpty.c JudyLPrevEmpty.c
|
||||
cp -f ../JudyCommon/JudyTables.c JudyLTablesGen.c
|
||||
|
558
dlls/arrayx/Judy-1.0.1/src/JudyL/Makefile.in
Normal file
558
dlls/arrayx/Judy-1.0.1/src/JudyL/Makefile.in
Normal file
|
@ -0,0 +1,558 @@
|
|||
# Makefile.in generated by automake 1.9.3 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
# 2003, 2004 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
|
||||
SOURCES = $(libJudyL_la_SOURCES) $(libcount_la_SOURCES) $(libinline_la_SOURCES) $(libnext_la_SOURCES) $(libprev_la_SOURCES)
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
top_builddir = ../..
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
INSTALL = @INSTALL@
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
subdir = src/JudyL
|
||||
DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_HEADER = $(top_builddir)/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
LTLIBRARIES = $(noinst_LTLIBRARIES)
|
||||
libJudyL_la_LIBADD =
|
||||
am_libJudyL_la_OBJECTS = JudyLCascade.lo JudyLTables.lo JudyLCount.lo \
|
||||
JudyLCreateBranch.lo JudyLDecascade.lo JudyLDel.lo \
|
||||
JudyLFirst.lo JudyLFreeArray.lo JudyLGet.lo JudyLInsArray.lo \
|
||||
JudyLIns.lo JudyLInsertBranch.lo JudyLMallocIF.lo \
|
||||
JudyLMemActive.lo JudyLMemUsed.lo
|
||||
libJudyL_la_OBJECTS = $(am_libJudyL_la_OBJECTS)
|
||||
libcount_la_LIBADD =
|
||||
am_libcount_la_OBJECTS = libcount_la-JudyLByCount.lo
|
||||
libcount_la_OBJECTS = $(am_libcount_la_OBJECTS)
|
||||
libinline_la_LIBADD =
|
||||
am_libinline_la_OBJECTS = libinline_la-j__udyLGet.lo
|
||||
libinline_la_OBJECTS = $(am_libinline_la_OBJECTS)
|
||||
libnext_la_LIBADD =
|
||||
am_libnext_la_OBJECTS = libnext_la-JudyLNext.lo \
|
||||
libnext_la-JudyLNextEmpty.lo
|
||||
libnext_la_OBJECTS = $(am_libnext_la_OBJECTS)
|
||||
libprev_la_LIBADD =
|
||||
am_libprev_la_OBJECTS = libprev_la-JudyLPrev.lo \
|
||||
libprev_la-JudyLPrevEmpty.lo
|
||||
libprev_la_OBJECTS = $(am_libprev_la_OBJECTS)
|
||||
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
|
||||
depcomp = $(SHELL) $(top_srcdir)/depcomp
|
||||
am__depfiles_maybe = depfiles
|
||||
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
|
||||
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \
|
||||
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
|
||||
$(AM_CFLAGS) $(CFLAGS)
|
||||
CCLD = $(CC)
|
||||
LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
|
||||
$(AM_LDFLAGS) $(LDFLAGS) -o $@
|
||||
SOURCES = $(libJudyL_la_SOURCES) $(libcount_la_SOURCES) \
|
||||
$(libinline_la_SOURCES) $(libnext_la_SOURCES) \
|
||||
$(libprev_la_SOURCES)
|
||||
DIST_SOURCES = $(libJudyL_la_SOURCES) $(libcount_la_SOURCES) \
|
||||
$(libinline_la_SOURCES) $(libnext_la_SOURCES) \
|
||||
$(libprev_la_SOURCES)
|
||||
ETAGS = etags
|
||||
CTAGS = ctags
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AMDEP_FALSE = @AMDEP_FALSE@
|
||||
AMDEP_TRUE = @AMDEP_TRUE@
|
||||
AMTAR = @AMTAR@
|
||||
AR = @AR@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CXX = @CXX@
|
||||
CXXCPP = @CXXCPP@
|
||||
CXXDEPMODE = @CXXDEPMODE@
|
||||
CXXFLAGS = @CXXFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
ECHO = @ECHO@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
F77 = @F77@
|
||||
FFLAGS = @FFLAGS@
|
||||
FLAVOR = @FLAVOR@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
LD = @LD@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LN_S = @LN_S@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAINT = @MAINT@
|
||||
MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
|
||||
MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
OBJEXT = @OBJEXT@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
RANLIB = @RANLIB@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
STRIP = @STRIP@
|
||||
VERSION = @VERSION@
|
||||
VERSION_INFO = @VERSION_INFO@
|
||||
WARN_CFLAGS = @WARN_CFLAGS@
|
||||
ac_ct_AR = @ac_ct_AR@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_CXX = @ac_ct_CXX@
|
||||
ac_ct_F77 = @ac_ct_F77@
|
||||
ac_ct_LD = @ac_ct_LD@
|
||||
ac_ct_RANLIB = @ac_ct_RANLIB@
|
||||
ac_ct_STRIP = @ac_ct_STRIP@
|
||||
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
|
||||
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
|
||||
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
|
||||
am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
build_cpu = @build_cpu@
|
||||
build_os = @build_os@
|
||||
build_vendor = @build_vendor@
|
||||
datadir = @datadir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host = @host@
|
||||
host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
host_os = @host_os@
|
||||
host_vendor = @host_vendor@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target_alias = @target_alias@
|
||||
INCLUDES = -I. -I.. -I../JudyCommon/
|
||||
AM_CFLAGS = -DJUDYL @WARN_CFLAGS@
|
||||
noinst_LTLIBRARIES = libJudyL.la libnext.la libprev.la libcount.la libinline.la
|
||||
libJudyL_la_SOURCES = JudyLCascade.c JudyLTables.c JudyLCount.c JudyLCreateBranch.c JudyLDecascade.c JudyLDel.c JudyLFirst.c JudyLFreeArray.c JudyLGet.c JudyLInsArray.c JudyLIns.c JudyLInsertBranch.c JudyLMallocIF.c JudyLMemActive.c JudyLMemUsed.c
|
||||
libnext_la_SOURCES = JudyLNext.c JudyLNextEmpty.c
|
||||
libnext_la_CFLAGS = $(AM_CFLAGS) -DJUDYNEXT
|
||||
libprev_la_SOURCES = JudyLPrev.c JudyLPrevEmpty.c
|
||||
libprev_la_CFLAGS = $(AM_CFLAGS) -DJUDYPREV
|
||||
libcount_la_SOURCES = JudyLByCount.c
|
||||
libcount_la_CFLAGS = $(AM_CFLAGS) -DNOSMARTJBB -DNOSMARTJBU -DNOSMARTJLB
|
||||
libinline_la_SOURCES = j__udyLGet.c
|
||||
libinline_la_CFLAGS = $(AM_CFLAGS) -DJUDYGETINLINE
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .c .lo .o .obj
|
||||
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
|
||||
&& exit 0; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/JudyL/Makefile'; \
|
||||
cd $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu src/JudyL/Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
clean-noinstLTLIBRARIES:
|
||||
-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
|
||||
@list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
|
||||
dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
|
||||
test "$$dir" != "$$p" || dir=.; \
|
||||
echo "rm -f \"$${dir}/so_locations\""; \
|
||||
rm -f "$${dir}/so_locations"; \
|
||||
done
|
||||
libJudyL.la: $(libJudyL_la_OBJECTS) $(libJudyL_la_DEPENDENCIES)
|
||||
$(LINK) $(libJudyL_la_LDFLAGS) $(libJudyL_la_OBJECTS) $(libJudyL_la_LIBADD) $(LIBS)
|
||||
libcount.la: $(libcount_la_OBJECTS) $(libcount_la_DEPENDENCIES)
|
||||
$(LINK) $(libcount_la_LDFLAGS) $(libcount_la_OBJECTS) $(libcount_la_LIBADD) $(LIBS)
|
||||
libinline.la: $(libinline_la_OBJECTS) $(libinline_la_DEPENDENCIES)
|
||||
$(LINK) $(libinline_la_LDFLAGS) $(libinline_la_OBJECTS) $(libinline_la_LIBADD) $(LIBS)
|
||||
libnext.la: $(libnext_la_OBJECTS) $(libnext_la_DEPENDENCIES)
|
||||
$(LINK) $(libnext_la_LDFLAGS) $(libnext_la_OBJECTS) $(libnext_la_LIBADD) $(LIBS)
|
||||
libprev.la: $(libprev_la_OBJECTS) $(libprev_la_DEPENDENCIES)
|
||||
$(LINK) $(libprev_la_LDFLAGS) $(libprev_la_OBJECTS) $(libprev_la_LIBADD) $(LIBS)
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.$(OBJEXT)
|
||||
|
||||
distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/JudyLCascade.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/JudyLCount.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/JudyLCreateBranch.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/JudyLDecascade.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/JudyLDel.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/JudyLFirst.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/JudyLFreeArray.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/JudyLGet.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/JudyLIns.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/JudyLInsArray.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/JudyLInsertBranch.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/JudyLMallocIF.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/JudyLMemActive.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/JudyLMemUsed.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/JudyLTables.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcount_la-JudyLByCount.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libinline_la-j__udyLGet.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnext_la-JudyLNext.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnext_la-JudyLNextEmpty.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libprev_la-JudyLPrev.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libprev_la-JudyLPrevEmpty.Plo@am__quote@
|
||||
|
||||
.c.o:
|
||||
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
|
||||
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
|
||||
|
||||
.c.obj:
|
||||
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
|
||||
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
|
||||
|
||||
.c.lo:
|
||||
@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
|
||||
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
|
||||
|
||||
libcount_la-JudyLByCount.lo: JudyLByCount.c
|
||||
@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcount_la_CFLAGS) $(CFLAGS) -MT libcount_la-JudyLByCount.lo -MD -MP -MF "$(DEPDIR)/libcount_la-JudyLByCount.Tpo" -c -o libcount_la-JudyLByCount.lo `test -f 'JudyLByCount.c' || echo '$(srcdir)/'`JudyLByCount.c; \
|
||||
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libcount_la-JudyLByCount.Tpo" "$(DEPDIR)/libcount_la-JudyLByCount.Plo"; else rm -f "$(DEPDIR)/libcount_la-JudyLByCount.Tpo"; exit 1; fi
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='JudyLByCount.c' object='libcount_la-JudyLByCount.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcount_la_CFLAGS) $(CFLAGS) -c -o libcount_la-JudyLByCount.lo `test -f 'JudyLByCount.c' || echo '$(srcdir)/'`JudyLByCount.c
|
||||
|
||||
libinline_la-j__udyLGet.lo: j__udyLGet.c
|
||||
@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libinline_la_CFLAGS) $(CFLAGS) -MT libinline_la-j__udyLGet.lo -MD -MP -MF "$(DEPDIR)/libinline_la-j__udyLGet.Tpo" -c -o libinline_la-j__udyLGet.lo `test -f 'j__udyLGet.c' || echo '$(srcdir)/'`j__udyLGet.c; \
|
||||
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libinline_la-j__udyLGet.Tpo" "$(DEPDIR)/libinline_la-j__udyLGet.Plo"; else rm -f "$(DEPDIR)/libinline_la-j__udyLGet.Tpo"; exit 1; fi
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='j__udyLGet.c' object='libinline_la-j__udyLGet.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libinline_la_CFLAGS) $(CFLAGS) -c -o libinline_la-j__udyLGet.lo `test -f 'j__udyLGet.c' || echo '$(srcdir)/'`j__udyLGet.c
|
||||
|
||||
libnext_la-JudyLNext.lo: JudyLNext.c
|
||||
@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnext_la_CFLAGS) $(CFLAGS) -MT libnext_la-JudyLNext.lo -MD -MP -MF "$(DEPDIR)/libnext_la-JudyLNext.Tpo" -c -o libnext_la-JudyLNext.lo `test -f 'JudyLNext.c' || echo '$(srcdir)/'`JudyLNext.c; \
|
||||
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libnext_la-JudyLNext.Tpo" "$(DEPDIR)/libnext_la-JudyLNext.Plo"; else rm -f "$(DEPDIR)/libnext_la-JudyLNext.Tpo"; exit 1; fi
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='JudyLNext.c' object='libnext_la-JudyLNext.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnext_la_CFLAGS) $(CFLAGS) -c -o libnext_la-JudyLNext.lo `test -f 'JudyLNext.c' || echo '$(srcdir)/'`JudyLNext.c
|
||||
|
||||
libnext_la-JudyLNextEmpty.lo: JudyLNextEmpty.c
|
||||
@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnext_la_CFLAGS) $(CFLAGS) -MT libnext_la-JudyLNextEmpty.lo -MD -MP -MF "$(DEPDIR)/libnext_la-JudyLNextEmpty.Tpo" -c -o libnext_la-JudyLNextEmpty.lo `test -f 'JudyLNextEmpty.c' || echo '$(srcdir)/'`JudyLNextEmpty.c; \
|
||||
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libnext_la-JudyLNextEmpty.Tpo" "$(DEPDIR)/libnext_la-JudyLNextEmpty.Plo"; else rm -f "$(DEPDIR)/libnext_la-JudyLNextEmpty.Tpo"; exit 1; fi
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='JudyLNextEmpty.c' object='libnext_la-JudyLNextEmpty.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnext_la_CFLAGS) $(CFLAGS) -c -o libnext_la-JudyLNextEmpty.lo `test -f 'JudyLNextEmpty.c' || echo '$(srcdir)/'`JudyLNextEmpty.c
|
||||
|
||||
libprev_la-JudyLPrev.lo: JudyLPrev.c
|
||||
@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libprev_la_CFLAGS) $(CFLAGS) -MT libprev_la-JudyLPrev.lo -MD -MP -MF "$(DEPDIR)/libprev_la-JudyLPrev.Tpo" -c -o libprev_la-JudyLPrev.lo `test -f 'JudyLPrev.c' || echo '$(srcdir)/'`JudyLPrev.c; \
|
||||
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libprev_la-JudyLPrev.Tpo" "$(DEPDIR)/libprev_la-JudyLPrev.Plo"; else rm -f "$(DEPDIR)/libprev_la-JudyLPrev.Tpo"; exit 1; fi
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='JudyLPrev.c' object='libprev_la-JudyLPrev.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libprev_la_CFLAGS) $(CFLAGS) -c -o libprev_la-JudyLPrev.lo `test -f 'JudyLPrev.c' || echo '$(srcdir)/'`JudyLPrev.c
|
||||
|
||||
libprev_la-JudyLPrevEmpty.lo: JudyLPrevEmpty.c
|
||||
@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libprev_la_CFLAGS) $(CFLAGS) -MT libprev_la-JudyLPrevEmpty.lo -MD -MP -MF "$(DEPDIR)/libprev_la-JudyLPrevEmpty.Tpo" -c -o libprev_la-JudyLPrevEmpty.lo `test -f 'JudyLPrevEmpty.c' || echo '$(srcdir)/'`JudyLPrevEmpty.c; \
|
||||
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libprev_la-JudyLPrevEmpty.Tpo" "$(DEPDIR)/libprev_la-JudyLPrevEmpty.Plo"; else rm -f "$(DEPDIR)/libprev_la-JudyLPrevEmpty.Tpo"; exit 1; fi
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='JudyLPrevEmpty.c' object='libprev_la-JudyLPrevEmpty.lo' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libprev_la_CFLAGS) $(CFLAGS) -c -o libprev_la-JudyLPrevEmpty.lo `test -f 'JudyLPrevEmpty.c' || echo '$(srcdir)/'`JudyLPrevEmpty.c
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
|
||||
distclean-libtool:
|
||||
-rm -f libtool
|
||||
uninstall-info-am:
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
mkid -fID $$unique
|
||||
tags: TAGS
|
||||
|
||||
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
|
||||
test -n "$$unique" || unique=$$empty_fix; \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
$$tags $$unique; \
|
||||
fi
|
||||
ctags: CTAGS
|
||||
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|
||||
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
||||
$$tags $$unique
|
||||
|
||||
GTAGS:
|
||||
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||
&& cd $(top_srcdir) \
|
||||
&& gtags -i $(GTAGS_ARGS) $$here
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
|
||||
list='$(DISTFILES)'; for file in $$list; do \
|
||||
case $$file in \
|
||||
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
|
||||
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
|
||||
esac; \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
|
||||
dir="/$$dir"; \
|
||||
$(mkdir_p) "$(distdir)$$dir"; \
|
||||
else \
|
||||
dir=''; \
|
||||
fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
|
||||
fi; \
|
||||
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
|
||||
else \
|
||||
test -f $(distdir)/$$file \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
check-am: all-am
|
||||
check: check-am
|
||||
all-am: Makefile $(LTLIBRARIES)
|
||||
installdirs:
|
||||
install: install-am
|
||||
install-exec: install-exec-am
|
||||
install-data: install-data-am
|
||||
uninstall: uninstall-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-am
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
`test -z '$(STRIP)' || \
|
||||
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-am
|
||||
|
||||
clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
|
||||
mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -rf ./$(DEPDIR)
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-compile distclean-generic \
|
||||
distclean-libtool distclean-tags
|
||||
|
||||
dvi: dvi-am
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-am
|
||||
|
||||
info: info-am
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am:
|
||||
|
||||
install-exec-am:
|
||||
|
||||
install-info: install-info-am
|
||||
|
||||
install-man:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
-rm -rf ./$(DEPDIR)
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
|
||||
mostlyclean-libtool
|
||||
|
||||
pdf: pdf-am
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-am
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am: uninstall-info-am
|
||||
|
||||
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
|
||||
clean-libtool clean-noinstLTLIBRARIES ctags distclean \
|
||||
distclean-compile distclean-generic distclean-libtool \
|
||||
distclean-tags distdir dvi dvi-am html html-am info info-am \
|
||||
install install-am install-data install-data-am install-exec \
|
||||
install-exec-am install-info install-info-am install-man \
|
||||
install-strip installcheck installcheck-am installdirs \
|
||||
maintainer-clean maintainer-clean-generic mostlyclean \
|
||||
mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
|
||||
pdf pdf-am ps ps-am tags uninstall uninstall-am \
|
||||
uninstall-info-am
|
||||
|
||||
|
||||
JudyLTables.c: JudyLTablesGen.c
|
||||
$(CC) $(INCLUDES) $(AM_CFLAGS) @CFLAGS@ -o JudyLTablesGen JudyLTablesGen.c; ./JudyLTablesGen
|
||||
|
||||
JudyLCascade.c: copies
|
||||
|
||||
copies:
|
||||
cp -f ../JudyCommon/JudyByCount.c JudyLByCount.c
|
||||
cp -f ../JudyCommon/JudyCascade.c JudyLCascade.c
|
||||
cp -f ../JudyCommon/JudyCount.c JudyLCount.c
|
||||
cp -f ../JudyCommon/JudyCreateBranch.c JudyLCreateBranch.c
|
||||
cp -f ../JudyCommon/JudyDecascade.c JudyLDecascade.c
|
||||
cp -f ../JudyCommon/JudyDel.c JudyLDel.c
|
||||
cp -f ../JudyCommon/JudyFirst.c JudyLFirst.c
|
||||
cp -f ../JudyCommon/JudyFreeArray.c JudyLFreeArray.c
|
||||
cp -f ../JudyCommon/JudyGet.c JudyLGet.c
|
||||
cp -f ../JudyCommon/JudyGet.c j__udyLGet.c
|
||||
cp -f ../JudyCommon/JudyInsArray.c JudyLInsArray.c
|
||||
cp -f ../JudyCommon/JudyIns.c JudyLIns.c
|
||||
cp -f ../JudyCommon/JudyInsertBranch.c JudyLInsertBranch.c
|
||||
cp -f ../JudyCommon/JudyMallocIF.c JudyLMallocIF.c
|
||||
cp -f ../JudyCommon/JudyMemActive.c JudyLMemActive.c
|
||||
cp -f ../JudyCommon/JudyMemUsed.c JudyLMemUsed.c
|
||||
cp -f ../JudyCommon/JudyPrevNext.c JudyLNext.c
|
||||
cp -f ../JudyCommon/JudyPrevNext.c JudyLPrev.c
|
||||
cp -f ../JudyCommon/JudyPrevNextEmpty.c JudyLNextEmpty.c
|
||||
cp -f ../JudyCommon/JudyPrevNextEmpty.c JudyLPrevEmpty.c
|
||||
cp -f ../JudyCommon/JudyTables.c JudyLTablesGen.c
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
8
dlls/arrayx/Judy-1.0.1/src/JudyL/README
Normal file
8
dlls/arrayx/Judy-1.0.1/src/JudyL/README
Normal file
|
@ -0,0 +1,8 @@
|
|||
# @(#) $Revision$ $Source$
|
||||
#
|
||||
# This tree contains sources for the JudyL*() functions.
|
||||
#
|
||||
|
||||
JudyL.h
|
||||
|
||||
lint.waivers see usage in makefile
|
1094
dlls/arrayx/Judy-1.0.1/src/JudyL/j__udyLGet.c
Normal file
1094
dlls/arrayx/Judy-1.0.1/src/JudyL/j__udyLGet.c
Normal file
File diff suppressed because it is too large
Load Diff
1127
dlls/arrayx/Judy-1.0.1/src/JudySL/JudySL.c
Normal file
1127
dlls/arrayx/Judy-1.0.1/src/JudySL/JudySL.c
Normal file
File diff suppressed because it is too large
Load Diff
6
dlls/arrayx/Judy-1.0.1/src/JudySL/Makefile.am
Normal file
6
dlls/arrayx/Judy-1.0.1/src/JudySL/Makefile.am
Normal file
|
@ -0,0 +1,6 @@
|
|||
INCLUDES = -I. -I.. -I../JudyCommon/
|
||||
AM_CFLAGS = @CFLAGS@ @WARN_CFLAGS@
|
||||
|
||||
noinst_LTLIBRARIES = libJudySL.la
|
||||
|
||||
libJudySL_la_SOURCES = JudySL.c
|
430
dlls/arrayx/Judy-1.0.1/src/JudySL/Makefile.in
Normal file
430
dlls/arrayx/Judy-1.0.1/src/JudySL/Makefile.in
Normal file
|
@ -0,0 +1,430 @@
|
|||
# Makefile.in generated by automake 1.9.3 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
# 2003, 2004 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
|
||||
SOURCES = $(libJudySL_la_SOURCES)
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
top_builddir = ../..
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
INSTALL = @INSTALL@
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
subdir = src/JudySL
|
||||
DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_HEADER = $(top_builddir)/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
LTLIBRARIES = $(noinst_LTLIBRARIES)
|
||||
libJudySL_la_LIBADD =
|
||||
am_libJudySL_la_OBJECTS = JudySL.lo
|
||||
libJudySL_la_OBJECTS = $(am_libJudySL_la_OBJECTS)
|
||||
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
|
||||
depcomp = $(SHELL) $(top_srcdir)/depcomp
|
||||
am__depfiles_maybe = depfiles
|
||||
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
|
||||
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \
|
||||
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
|
||||
$(AM_CFLAGS) $(CFLAGS)
|
||||
CCLD = $(CC)
|
||||
LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
|
||||
$(AM_LDFLAGS) $(LDFLAGS) -o $@
|
||||
SOURCES = $(libJudySL_la_SOURCES)
|
||||
DIST_SOURCES = $(libJudySL_la_SOURCES)
|
||||
ETAGS = etags
|
||||
CTAGS = ctags
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AMDEP_FALSE = @AMDEP_FALSE@
|
||||
AMDEP_TRUE = @AMDEP_TRUE@
|
||||
AMTAR = @AMTAR@
|
||||
AR = @AR@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CXX = @CXX@
|
||||
CXXCPP = @CXXCPP@
|
||||
CXXDEPMODE = @CXXDEPMODE@
|
||||
CXXFLAGS = @CXXFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
ECHO = @ECHO@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
F77 = @F77@
|
||||
FFLAGS = @FFLAGS@
|
||||
FLAVOR = @FLAVOR@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
LD = @LD@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LN_S = @LN_S@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAINT = @MAINT@
|
||||
MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
|
||||
MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
OBJEXT = @OBJEXT@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
RANLIB = @RANLIB@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
STRIP = @STRIP@
|
||||
VERSION = @VERSION@
|
||||
VERSION_INFO = @VERSION_INFO@
|
||||
WARN_CFLAGS = @WARN_CFLAGS@
|
||||
ac_ct_AR = @ac_ct_AR@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_CXX = @ac_ct_CXX@
|
||||
ac_ct_F77 = @ac_ct_F77@
|
||||
ac_ct_LD = @ac_ct_LD@
|
||||
ac_ct_RANLIB = @ac_ct_RANLIB@
|
||||
ac_ct_STRIP = @ac_ct_STRIP@
|
||||
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
|
||||
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
|
||||
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
|
||||
am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
build_cpu = @build_cpu@
|
||||
build_os = @build_os@
|
||||
build_vendor = @build_vendor@
|
||||
datadir = @datadir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host = @host@
|
||||
host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
host_os = @host_os@
|
||||
host_vendor = @host_vendor@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target_alias = @target_alias@
|
||||
INCLUDES = -I. -I.. -I../JudyCommon/
|
||||
AM_CFLAGS = @CFLAGS@ @WARN_CFLAGS@
|
||||
noinst_LTLIBRARIES = libJudySL.la
|
||||
libJudySL_la_SOURCES = JudySL.c
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .c .lo .o .obj
|
||||
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
|
||||
&& exit 0; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/JudySL/Makefile'; \
|
||||
cd $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu src/JudySL/Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
clean-noinstLTLIBRARIES:
|
||||
-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
|
||||
@list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
|
||||
dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
|
||||
test "$$dir" != "$$p" || dir=.; \
|
||||
echo "rm -f \"$${dir}/so_locations\""; \
|
||||
rm -f "$${dir}/so_locations"; \
|
||||
done
|
||||
libJudySL.la: $(libJudySL_la_OBJECTS) $(libJudySL_la_DEPENDENCIES)
|
||||
$(LINK) $(libJudySL_la_LDFLAGS) $(libJudySL_la_OBJECTS) $(libJudySL_la_LIBADD) $(LIBS)
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.$(OBJEXT)
|
||||
|
||||
distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/JudySL.Plo@am__quote@
|
||||
|
||||
.c.o:
|
||||
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
|
||||
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
|
||||
|
||||
.c.obj:
|
||||
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
|
||||
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
|
||||
|
||||
.c.lo:
|
||||
@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
|
||||
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
|
||||
distclean-libtool:
|
||||
-rm -f libtool
|
||||
uninstall-info-am:
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
mkid -fID $$unique
|
||||
tags: TAGS
|
||||
|
||||
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
|
||||
test -n "$$unique" || unique=$$empty_fix; \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
$$tags $$unique; \
|
||||
fi
|
||||
ctags: CTAGS
|
||||
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|
||||
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
||||
$$tags $$unique
|
||||
|
||||
GTAGS:
|
||||
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||
&& cd $(top_srcdir) \
|
||||
&& gtags -i $(GTAGS_ARGS) $$here
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
|
||||
list='$(DISTFILES)'; for file in $$list; do \
|
||||
case $$file in \
|
||||
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
|
||||
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
|
||||
esac; \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
|
||||
dir="/$$dir"; \
|
||||
$(mkdir_p) "$(distdir)$$dir"; \
|
||||
else \
|
||||
dir=''; \
|
||||
fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
|
||||
fi; \
|
||||
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
|
||||
else \
|
||||
test -f $(distdir)/$$file \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
check-am: all-am
|
||||
check: check-am
|
||||
all-am: Makefile $(LTLIBRARIES)
|
||||
installdirs:
|
||||
install: install-am
|
||||
install-exec: install-exec-am
|
||||
install-data: install-data-am
|
||||
uninstall: uninstall-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-am
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
`test -z '$(STRIP)' || \
|
||||
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-am
|
||||
|
||||
clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
|
||||
mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -rf ./$(DEPDIR)
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-compile distclean-generic \
|
||||
distclean-libtool distclean-tags
|
||||
|
||||
dvi: dvi-am
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-am
|
||||
|
||||
info: info-am
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am:
|
||||
|
||||
install-exec-am:
|
||||
|
||||
install-info: install-info-am
|
||||
|
||||
install-man:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
-rm -rf ./$(DEPDIR)
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
|
||||
mostlyclean-libtool
|
||||
|
||||
pdf: pdf-am
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-am
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am: uninstall-info-am
|
||||
|
||||
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
|
||||
clean-libtool clean-noinstLTLIBRARIES ctags distclean \
|
||||
distclean-compile distclean-generic distclean-libtool \
|
||||
distclean-tags distdir dvi dvi-am html html-am info info-am \
|
||||
install install-am install-data install-data-am install-exec \
|
||||
install-exec-am install-info install-info-am install-man \
|
||||
install-strip installcheck installcheck-am installdirs \
|
||||
maintainer-clean maintainer-clean-generic mostlyclean \
|
||||
mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
|
||||
pdf pdf-am ps ps-am tags uninstall uninstall-am \
|
||||
uninstall-info-am
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
6
dlls/arrayx/Judy-1.0.1/src/JudySL/README
Normal file
6
dlls/arrayx/Judy-1.0.1/src/JudySL/README
Normal file
|
@ -0,0 +1,6 @@
|
|||
# @(#) $Revision$ $Source$
|
||||
#
|
||||
# This tree contains sources for the JudySL*() functions.
|
||||
|
||||
JudySL.c source file
|
||||
Note: JudySL.h is no longer needed (May 2004)
|
1
dlls/arrayx/Judy-1.0.1/src/Makefile.am
Normal file
1
dlls/arrayx/Judy-1.0.1/src/Makefile.am
Normal file
|
@ -0,0 +1 @@
|
|||
SUBDIRS = . JudyCommon JudyL Judy1 JudySL JudyHS obj
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user