New update! 3.1 is liiiive!

Error handling:
Array now has sufficiently advanced error handling to remove most, if not all, disable_checks.

Extention:
With the metaprogramming techniques, new types can be added easily.

Speed:
With the new changes I've made to Judy, the Array module has far exceeded the speed of any traditional datatype
This commit is contained in:
Twilight Suzuka 2006-03-14 02:54:24 +00:00
parent 4457b0d879
commit 5c88803942
39 changed files with 9858 additions and 0 deletions

35
dlls/arrayx/Array.cpp Normal file
View File

@ -0,0 +1,35 @@
#include "amxxmodule.h"
#include "ComboArray.h"
extern AMX_NATIVE_INFO bintrie_exports[];
extern AMX_NATIVE_INFO bintrie_usage_exports[];
extern ComboArray MasterTrie;
extern AMX_NATIVE_INFO list_exports[];
extern AMX_NATIVE_INFO list_creation_exports[];
extern ComboArray MasterList;
extern AMX_NATIVE_INFO map_exports[];
extern AMX_NATIVE_INFO map_creation_exports[];
extern ComboArray MasterMap;
void OnAmxxAttach( void )
{
MF_AddNatives(bintrie_exports);
MF_AddNatives(bintrie_usage_exports);
MF_AddNatives(list_exports);
MF_AddNatives(list_creation_exports);
MF_AddNatives(map_exports);
MF_AddNatives(map_creation_exports);
}
void OnAmxxDetach( void )
{
MasterTrie.Clear();
MasterList.Clear();
MasterMap.Clear();
}

237
dlls/arrayx/Array.dsp Normal file
View File

@ -0,0 +1,237 @@
# 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 Debug
!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 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "Array - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "Array - Win32 Debug" (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
!IF "$(CFG)" == "Array - Win32 Release"
# 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 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# 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 /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ARRAY_EXPORTS" /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"
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 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
!ELSEIF "$(CFG)" == "Array - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ARRAY_EXPORTS" /YX /FD /GZ /c
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ARRAY_EXPORTS" /YX /FD /GZ /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
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 /debug /machine:I386 /pdbtype:sept
# ADD 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 /debug /machine:I386 /pdbtype:sept
!ENDIF
# Begin Target
# Name "Array - Win32 Release"
# Name "Array - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\Array.cpp
# End Source File
# Begin Source File
SOURCE=.\BinTrieNatives.cpp
# End Source File
# Begin Source File
SOURCE=.\Capsule.cpp
# End Source File
# Begin Source File
SOURCE=.\CArray.cpp
# End Source File
# Begin Source File
SOURCE=.\CBinTrie.cpp
# End Source File
# Begin Source File
SOURCE=.\CKeytable.cpp
# End Source File
# Begin Source File
SOURCE=.\JudyExtra.cpp
# End Source File
# Begin Source File
SOURCE=.\ListNatives.cpp
# End Source File
# Begin Source File
SOURCE=.\MapNatives.cpp
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=.\BinTrieNativeFunctions.h
# End Source File
# Begin Source File
SOURCE=.\Capsule.h
# End Source File
# Begin Source File
SOURCE=.\CArray.h
# End Source File
# Begin Source File
SOURCE=.\CBaseList.h
# End Source File
# Begin Source File
SOURCE=.\CBaseMap.h
# End Source File
# Begin Source File
SOURCE=.\CBinTrie.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=.\ComboArray.h
# End Source File
# Begin Source File
SOURCE=.\ComboTable.h
# End Source File
# Begin Source File
SOURCE=.\GenericNatives.h
# End Source File
# Begin Source File
SOURCE=.\JudyIncludes.h
# End Source File
# Begin Source File
SOURCE=.\MapNativeFunctions.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=.\amxxmodule.cpp
# End Source File
# Begin Source File
SOURCE=.\amxxmodule.h
# End Source File
# Begin Source File
SOURCE=.\Judy.h
# End Source File
# Begin Source File
SOURCE=.\JudyEx.h
# End Source File
# Begin Source File
SOURCE=.\JudyExtra.h
# End Source File
# Begin Source File
SOURCE=.\JudyVar.h
# End Source File
# Begin Source File
SOURCE=.\JudyVec.h
# End Source File
# Begin Source File
SOURCE=.\ListNativeFunctions.h
# End Source File
# Begin Source File
SOURCE=.\moduleconfig.h
# End Source File
# Begin Source File
SOURCE=.\NativeIncludes.h
# End Source File
# Begin Source File
SOURCE=.\osdefs.h
# End Source File
# Begin Source File
SOURCE=.\Judy.lib
# End Source File
# End Group
# End Target
# End Project

29
dlls/arrayx/Array.dsw Normal file
View File

@ -0,0 +1,29 @@
Microsoft Developer Studio Workspace File, Format Version 6.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "Array"=".\Array.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################

BIN
dlls/arrayx/Array.ncb Normal file

Binary file not shown.

BIN
dlls/arrayx/Array.opt Normal file

Binary file not shown.

96
dlls/arrayx/Array.plg Normal file
View File

@ -0,0 +1,96 @@
<html>
<body>
<pre>
<h1>Build Log</h1>
<h3>
--------------------Configuration: Array - Win32 Release--------------------
</h3>
<h3>Command Lines</h3>
Creating temporary file "C:\DOCUME~1\Edward\LOCALS~1\Temp\RSPC49.tmp" with contents
[
/nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ARRAY_EXPORTS" /FR"Release/" /Fp"Release/Array.pch" /YX /Fo"Release/" /Fd"Release/" /FD /c
"C:\Documents and Settings\Edward\Desktop\module\Judy Test\Array\Array.cpp"
"C:\Documents and Settings\Edward\Desktop\module\Judy Test\Array\BinTrieNatives.cpp"
"C:\Documents and Settings\Edward\Desktop\module\Judy Test\Array\Capsule.cpp"
"C:\Documents and Settings\Edward\Desktop\module\Judy Test\Array\CArray.cpp"
"C:\Documents and Settings\Edward\Desktop\module\Judy Test\Array\CBinTrie.cpp"
"C:\Documents and Settings\Edward\Desktop\module\Judy Test\Array\CKeytable.cpp"
"C:\Documents and Settings\Edward\Desktop\module\Judy Test\Array\JudyExtra.cpp"
"C:\Documents and Settings\Edward\Desktop\module\Judy Test\Array\ListNatives.cpp"
"C:\Documents and Settings\Edward\Desktop\module\Judy Test\Array\MapNatives.cpp"
"C:\Documents and Settings\Edward\Desktop\module\Judy Test\Array\amxxmodule.cpp"
]
Creating command line "cl.exe @C:\DOCUME~1\Edward\LOCALS~1\Temp\RSPC49.tmp"
Creating temporary file "C:\DOCUME~1\Edward\LOCALS~1\Temp\RSPC4A.tmp" with contents
[
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 /incremental:no /pdb:"Release/Array.pdb" /machine:I386 /out:"Release/Array.dll" /implib:"Release/Array.lib"
".\Release\Array.obj"
".\Release\BinTrieNatives.obj"
".\Release\Capsule.obj"
".\Release\CArray.obj"
".\Release\CBinTrie.obj"
".\Release\CKeytable.obj"
".\Release\JudyExtra.obj"
".\Release\ListNatives.obj"
".\Release\MapNatives.obj"
".\Release\amxxmodule.obj"
".\Judy.lib"
]
Creating command line "link.exe @C:\DOCUME~1\Edward\LOCALS~1\Temp\RSPC4A.tmp"
<h3>Output Window</h3>
Compiling...
Array.cpp
BinTrieNatives.cpp
Capsule.cpp
CArray.cpp
CBinTrie.cpp
CKeytable.cpp
JudyExtra.cpp
C:\Documents and Settings\Edward\Desktop\module\Judy Test\Array\JudyExtra.cpp(8) : warning C4101: 'e' : unreferenced local variable
C:\Documents and Settings\Edward\Desktop\module\Judy Test\Array\JudyExtra.cpp(15) : warning C4101: 'e' : unreferenced local variable
C:\Documents and Settings\Edward\Desktop\module\Judy Test\Array\JudyExtra.cpp(40) : warning C4101: 'e' : unreferenced local variable
C:\Documents and Settings\Edward\Desktop\module\Judy Test\Array\JudyExtra.cpp(75) : warning C4101: 'e' : unreferenced local variable
C:\Documents and Settings\Edward\Desktop\module\Judy Test\Array\JudyExtra.cpp(80) : warning C4101: 'e' : unreferenced local variable
C:\Documents and Settings\Edward\Desktop\module\Judy Test\Array\JudyExtra.cpp(83) : warning C4101: 'e' : unreferenced local variable
C:\Documents and Settings\Edward\Desktop\module\Judy Test\Array\JudyExtra.cpp(103) : warning C4101: 'e' : unreferenced local variable
C:\Documents and Settings\Edward\Desktop\module\Judy Test\Array\JudyExtra.cpp(107) : warning C4101: 'e' : unreferenced local variable
C:\Documents and Settings\Edward\Desktop\module\Judy Test\Array\JudyExtra.cpp(110) : warning C4101: 'e' : unreferenced local variable
C:\Documents and Settings\Edward\Desktop\module\Judy Test\Array\JudyExtra.cpp(133) : warning C4101: 'e' : unreferenced local variable
C:\Documents and Settings\Edward\Desktop\module\Judy Test\Array\JudyExtra.cpp(147) : warning C4101: 'e' : unreferenced local variable
C:\Documents and Settings\Edward\Desktop\module\Judy Test\Array\JudyExtra.cpp(152) : warning C4101: 'e' : unreferenced local variable
C:\Documents and Settings\Edward\Desktop\module\Judy Test\Array\JudyExtra.cpp(155) : warning C4101: 'e' : unreferenced local variable
C:\Documents and Settings\Edward\Desktop\module\Judy Test\Array\JudyExtra.cpp(170) : warning C4101: 'e' : unreferenced local variable
C:\Documents and Settings\Edward\Desktop\module\Judy Test\Array\JudyExtra.cpp(178) : warning C4101: 'e' : unreferenced local variable
C:\Documents and Settings\Edward\Desktop\module\Judy Test\Array\JudyExtra.cpp(186) : warning C4101: 'e' : unreferenced local variable
C:\Documents and Settings\Edward\Desktop\module\Judy Test\Array\JudyExtra.cpp(189) : warning C4101: 'e' : unreferenced local variable
C:\Documents and Settings\Edward\Desktop\module\Judy Test\Array\JudyExtra.cpp(217) : warning C4101: 'e' : unreferenced local variable
ListNatives.cpp
MapNatives.cpp
amxxmodule.cpp
Linking...
Creating library Release/Array.lib and object Release/Array.exp
LINK : warning LNK4098: defaultlib "LIBC" conflicts with use of other libs; use /NODEFAULTLIB:library
Creating temporary file "C:\DOCUME~1\Edward\LOCALS~1\Temp\RSPC4E.tmp" with contents
[
/nologo /o"Release/Array.bsc"
".\Release\Array.sbr"
".\Release\BinTrieNatives.sbr"
".\Release\Capsule.sbr"
".\Release\CArray.sbr"
".\Release\CBinTrie.sbr"
".\Release\CKeytable.sbr"
".\Release\JudyExtra.sbr"
".\Release\ListNatives.sbr"
".\Release\MapNatives.sbr"
".\Release\amxxmodule.sbr"]
Creating command line "bscmake.exe @C:\DOCUME~1\Edward\LOCALS~1\Temp\RSPC4E.tmp"
Creating browse info file...
<h3>Output Window</h3>
<h3>Results</h3>
Array.dll - 0 error(s), 19 warning(s)
</pre>
</body>
</html>

View File

@ -0,0 +1,79 @@
#ifndef _bintrie_NATIVE_FUNC_INC_H
#define _bintrie_NATIVE_FUNC_INC_H
#define JUDY_GLUE_FUNC( x , y ) x ## y
#define JUDY_GLUE_STR( x, y ) #x#y
#define JUDY_MASTER_EDIT_FUNCTIONS
#define JUDY_MASTER_CLEAR_FUNC JUDY_GLUE_FUNC( bintrie , _clear )
#define JUDY_MASTER_CLEAR_STR JUDY_GLUE_STR ( bintrie , _clear )
#define JUDY_MASTER_DELETE_FUNC JUDY_GLUE_FUNC( bintrie , _delete )
#define JUDY_MASTER_DELETE_STR JUDY_GLUE_STR ( bintrie , _delete )
#define JUDY_MASTER_IO_FUNCTIONS
#define JUDY_MASTER_SAVE_FUNC JUDY_GLUE_FUNC( bintrie , _save )
#define JUDY_MASTER_SAVE_STR JUDY_GLUE_STR ( bintrie , _save )
#define JUDY_SAVE_FUNC(bin,file) JudySaveBinTrie(bin , file )
#define JUDY_MASTER_LOAD_FUNC JUDY_GLUE_FUNC( bintrie , _load )
#define JUDY_MASTER_LOAD_STR JUDY_GLUE_STR ( bintrie , _load )
#define JUDY_LOAD_FUNC(bin, file) JudyLoadBinTrie(bin , file )
#define JUDY_MASTER_AMOUNT_FUNCTIONS
#define JUDY_MASTER_COUNT_FUNC JUDY_GLUE_FUNC( bintrie , _count )
#define JUDY_MASTER_COUNT_STR JUDY_GLUE_STR ( bintrie , _count )
#define JUDY_MASTER_BYCOUNT_FUNC JUDY_GLUE_FUNC( bintrie , _bycount )
#define JUDY_MASTER_BYCOUNT_STR JUDY_GLUE_STR ( bintrie , _bycount )
#define JUDY_SLAVE_AMOUNT_FUNCTIONS
#define JUDY_SLAVE_COUNT_FUNC JUDY_GLUE_FUNC( bintrie , _size )
#define JUDY_SLAVE_COUNT_STR JUDY_GLUE_STR ( bintrie , _size )
#define JUDY_SLAVE_BYCOUNT_FUNC JUDY_GLUE_FUNC( bintrie , _get_nth )
#define JUDY_SLAVE_BYCOUNT_STR JUDY_GLUE_STR ( bintrie , _get_nth )
#define JUDY_SLAVE_EDIT_FUNCTIONS
#define JUDY_SLAVE_MEMORY_FUNC JUDY_GLUE_FUNC( bintrie , _memory )
#define JUDY_SLAVE_MEMORY_STR JUDY_GLUE_STR ( bintrie , _memory )
#define JUDY_SLAVE_ISFILLED_FUNC JUDY_GLUE_FUNC( bintrie , _isfilled )
#define JUDY_SLAVE_ISFILLED_STR JUDY_GLUE_STR ( bintrie , _isfilled )
#define JUDY_SLAVE_ISEMPTY_FUNC JUDY_GLUE_FUNC( bintrie , _isempty )
#define JUDY_SLAVE_ISEMPTY_STR JUDY_GLUE_STR ( bintrie , _isempty )
#define JUDY_SLAVE_REMOVE_FUNC JUDY_GLUE_FUNC( bintrie , _remove )
#define JUDY_SLAVE_REMOVE_STR JUDY_GLUE_STR ( bintrie , _remove )
#define JUDY_SLAVE_SEARCH_FUNCTIONS
#define JUDY_SLAVE_FIRST_FUNC JUDY_GLUE_FUNC( bintrie , _first )
#define JUDY_SLAVE_LAST_FUNC JUDY_GLUE_FUNC( bintrie , _last )
#define JUDY_SLAVE_FIRST_STR JUDY_GLUE_STR ( bintrie , _first )
#define JUDY_SLAVE_LAST_STR JUDY_GLUE_STR ( bintrie , _last )
#define JUDY_SLAVE_NEXT_FUNC JUDY_GLUE_FUNC( bintrie , _next )
#define JUDY_SLAVE_PREV_FUNC JUDY_GLUE_FUNC( bintrie , _prev )
#define JUDY_SLAVE_NEXT_STR JUDY_GLUE_STR ( bintrie , _next )
#define JUDY_SLAVE_PREV_STR JUDY_GLUE_STR ( bintrie , _prev )
#define JUDY_SLAVE_SEARCH_EMPTY_FUNCTIONS
#define JUDY_SLAVE_FIRSTEMPTY_FUNC JUDY_GLUE_FUNC( bintrie , _firstempty )
#define JUDY_SLAVE_LASTEMPTY_FUNC JUDY_GLUE_FUNC( bintrie , _lastempty )
#define JUDY_SLAVE_FIRSTEMPTY_STR JUDY_GLUE_STR ( bintrie , _firstempty )
#define JUDY_SLAVE_LASTEMPTY_STR JUDY_GLUE_STR ( bintrie , _lastempty )
#define JUDY_SLAVE_NEXTEMPTY_FUNC JUDY_GLUE_FUNC( bintrie , _nextempty )
#define JUDY_SLAVE_PREVEMPTY_FUNC JUDY_GLUE_FUNC( bintrie , _prevempty )
#define JUDY_SLAVE_NEXTEMPTY_STR JUDY_GLUE_STR ( bintrie , _nextempty )
#define JUDY_SLAVE_PREVEMPTY_STR JUDY_GLUE_STR ( bintrie , _prevempty )
#endif

View File

@ -0,0 +1,57 @@
#include "CBinTrie.h"
#define KEY_TYPE cell
#define DYNAMIC_UNIT_TYPE BinTrie
#define STORAGE_TYPE cell
#define MASTER_NAME MasterTrie
#define EXPORT_NAME bintrie_exports
#define SEARCH_ERROR_OFFSET 0
#define GET_KEY(params, num) params[num]
#define SET_KEY(stuff, parameter) stuff
#include "BinTrieNativeFunctions.h"
#include "NativeIncludes.h"
static cell AMX_NATIVE_CALL bintrie_create(AMX *amx,cell *params)
{
DTYPE* Unit;
M_ITYPE Index = params[1];
JUDY_CREATE_INDEX(MNAME,Unit,BinTrie,Index);
return Index;
}
static cell AMX_NATIVE_CALL bintrie_set(AMX *amx,cell *params)
{
DTYPE* Unit = NULL;
JUDY_GET_INDEX(MNAME,Unit, params[1]);
ITYPE Indice = JUDY_GET_KEY(params,2);
bool Value = (params[3] != NULL);
try { return Unit->Set(Indice, Value ); }
JUDY_ERROR_CATCH("Judy Error: (No error possible) - Slave Set Function ");
}
static cell AMX_NATIVE_CALL bintrie_get(AMX *amx,cell *params)
{
DTYPE* Unit = NULL;
JUDY_GET_INDEX(MNAME,Unit, params[1]);
ITYPE Indice = JUDY_GET_KEY(params,2);
try { return Unit->Get(Indice ); }
JUDY_ERROR_CATCH("Judy Error: (No error possible) - Slave Get Function ");
}
AMX_NATIVE_INFO bintrie_usage_exports[] =
{
{ "bintrie_create", bintrie_create },
{ "bintrie_set", bintrie_set },
{ "bintrie_get", bintrie_get },
{ NULL, NULL }
};

87
dlls/arrayx/CArray.cpp Normal file
View File

@ -0,0 +1,87 @@
#include "CArray.h"
void Array::ThrowSearchError(char* type)
{
char value[50];
sprintf(value,"Function attempted to search %s: Judy returned NULL value", type);
throw JudyEx(value,false);
}
void Array::ThrowIndexError( cell index, bool disable_check )
{
if(disable_check == true) return;
char error[50];
sprintf(error,"Index %i is not set.",index);
throw JudyEx(error,true);
}
cell Array::First( cell Start)
{
PPvoid_t success = JudyLFirst(Table, reinterpret_cast<Word_t *>(&Start), PJE0);
if (success == NULL) ThrowSearchError("Type:First");
return Start;
}
cell Array::FirstEmpty( cell Start)
{
cell success = JudyLFirstEmpty(Table, reinterpret_cast<Word_t *>(&Start), PJE0);
if (success == NULL) ThrowSearchError("Type:FirstEmpty");
return Start;
}
cell Array::Next( cell Start)
{
PPvoid_t success = JudyLNext(Table, reinterpret_cast<Word_t *>(&Start), PJE0);
if (success == NULL) ThrowSearchError("Type:Next");
return Start;
}
cell Array::NextEmpty( cell Start)
{
cell success = JudyLNextEmpty(Table, reinterpret_cast<Word_t *>(&Start), PJE0);
if (success == NULL) ThrowSearchError("Type:NextEmpty");
return Start;
}
cell Array::Prev( cell Start)
{
PPvoid_t success = JudyLPrev(Table, reinterpret_cast<Word_t *>(&Start), PJE0);
if (success == NULL) ThrowSearchError("Type:Prev");
return Start;
}
cell Array::PrevEmpty( cell Start)
{
cell success = JudyLPrevEmpty(Table, reinterpret_cast<Word_t *>(&Start), PJE0);
if (success == NULL) ThrowSearchError("Type:PrevEmpty");
return Start;
}
cell Array::Last( cell Start)
{
PPvoid_t success = JudyLLast(Table, reinterpret_cast<Word_t *>(&Start), PJE0);
if (success == NULL) ThrowSearchError("Type:Last");
return Start;
}
cell Array::LastEmpty( cell Start)
{
cell success = JudyLLastEmpty(Table, reinterpret_cast<Word_t *>(&Start), PJE0);
if (success == NULL) ThrowSearchError("Type:LastEmpty");
return Start;
}
cell Array::ByCount(cell n, cell Start)
{
PPvoid_t success = JudyLByCount(Table, n, reinterpret_cast<Word_t *>(&Start), PJE0);
if (success == NULL) ThrowSearchError("Type:Nth");
return Start;
}

73
dlls/arrayx/CArray.h Normal file
View File

@ -0,0 +1,73 @@
#ifndef _ARRAYCLASS_H
#define _ARRAYCLASS_H
#include "JudyIncludes.h"
#include "CBaseList.h"
#include "JudyExtra.h"
//#include <JudyL.h>
class Array: public CBaseList
{
private:
Pvoid_t Table;
void ThrowIndexError( cell index, bool disable_check = false );
void ThrowSearchError(char* msg);
public:
Array() { Table = NULL; }
~Array() { Clear(); }
Word_t Clear() { JudyClearList(this); return JudyLFreeArray(&Table, PJE0); }
Word_t MemoryUsed() { return JudyLMemUsed(Table); }
int Delete(cell Key) { delete Get(Key,true); return JudyLDel(&Table, Key, PJE0 ); }
void Set(cell Index, Pvoid_t value, bool disable_check)
{
PPvoid_t PValue = JudyLIns(&Table, Index,PJE0);
*PValue = value;
}
Pvoid_t Get(cell Index, bool disable_check = false)
{
PPvoid_t PValue = JudyLGet(Table, Index, PJE0);
if(PValue == NULL) { ThrowIndexError(Index, disable_check); return NULL; }
return *PValue;
}
template<class Type>
void Set(cell Index, Type value)
{
PPvoid_t PValue = JudyLIns(&Table, Index,PJE0);
*PValue = reinterpret_cast<void*>(value);
}
template <class Type>
Type Get(cell Index, Type example, bool disable_check = false)
{
PPvoid_t PValue = JudyLGet(Table, Index, PJE0);
if(PValue == NULL) { ThrowIndexError(Index, disable_check); return (Type)NULL; }
return (Type)(*PValue);
}
cell First(cell Start = 0);
cell Next(cell Start = 0);
cell Prev(cell Start = -1);
cell Last(cell Start = -1);
cell FirstEmpty(cell Start = 0);
cell NextEmpty(cell Start = 0);
cell PrevEmpty(cell Start = -1);
cell LastEmpty(cell Start = -1);
cell ByCount(cell n, cell Start = 0);
cell Count(cell Start = 0, cell Stop = -1) { return JudyLCount(Table, Start, Stop, PJE0); }
bool IsFilled(cell Index) { return ( (Get(Index, true ) != NULL) ? true : false); }
bool IsEmpty(cell Index) { return ( (Get(Index, true ) == NULL) ? true : false); }
};
#endif

35
dlls/arrayx/CBaseList.h Normal file
View File

@ -0,0 +1,35 @@
#ifndef _BASE_ARRAYCLASS_H
#define _BASE_ARRAYCLASS_H
#include "JudyIncludes.h"
class CBaseList
{
public:
virtual Word_t Clear() =0;
virtual Word_t MemoryUsed() =0;
virtual int Delete(cell Key) =0;
virtual void Set(cell Index, Pvoid_t value, bool disable_check = false) =0;
virtual Pvoid_t Get(cell Index, bool disable_check = false) =0;
virtual cell First(cell Start = 0) =0;
virtual cell Next(cell Start = 0) =0;
virtual cell Prev(cell Start = -1) =0;
virtual cell Last(cell Start = -1) =0;
virtual cell FirstEmpty(cell Start = 0) =0;
virtual cell NextEmpty(cell Start = 0) =0;
virtual cell PrevEmpty(cell Start = -1) =0;
virtual cell LastEmpty(cell Start = -1) =0;
virtual cell ByCount(cell n, cell Start = 0) =0;
virtual cell Count(cell Start = 0, cell Stop = -1) =0;
virtual bool IsFilled(cell Index) =0;
virtual bool IsEmpty(cell Index) =0;
};
#endif

28
dlls/arrayx/CBaseMap.h Normal file
View File

@ -0,0 +1,28 @@
#ifndef _BASE_MAPCLASS_H
#define _BASE_MAPCLASS_H
#include "JudyIncludes.h"
class CBaseMap
{
public:
virtual Word_t Clear() =0;
virtual Word_t MemoryUsed() =0;
virtual int Delete(char* Key) =0;
virtual void Set(char* Index, Pvoid_t value, bool disable_check = false) =0;
virtual Pvoid_t Get(char* Index, bool disable_check = false) =0;
virtual char* First(char* Start = "") =0;
virtual char* Next(char* Start) =0;
virtual char* Prev(char* Start) =0;
virtual char* Last(char* Start) =0;
virtual bool IsFilled(char* Index) =0;
virtual bool IsEmpty(char* Index) =0;
};
#endif

76
dlls/arrayx/CBinTrie.cpp Normal file
View File

@ -0,0 +1,76 @@
#include "CBinTrie.h"
void BinTrie::ThrowSearchError(char* type)
{
char value[50];
sprintf(value,"Function attempted to search %s: Judy returned NULL value", type);
throw JudyEx (value,false);
}
cell BinTrie::First( cell Start)
{
cell success = Judy1First(Table, reinterpret_cast<unsigned int*>(&Start), PJE0);
if (success == NULL) ThrowSearchError("Type:First");
return Start;
}
cell BinTrie::FirstEmpty( cell Start)
{
cell success = Judy1FirstEmpty(Table, reinterpret_cast<unsigned int*>(&Start), PJE0);
if (success == NULL) ThrowSearchError("Type:FirstEmpty");
return Start;
}
cell BinTrie::Next( cell Start)
{
cell success = Judy1Next(Table, reinterpret_cast<unsigned int*>(&Start), PJE0);
if (success == NULL) ThrowSearchError("Type:Next");
return Start;
}
cell BinTrie::NextEmpty( cell Start)
{
cell success = Judy1NextEmpty(Table, reinterpret_cast<unsigned int*>(&Start), PJE0);
if (success == NULL) ThrowSearchError("Type:NextEmpty");
return Start;
}
cell BinTrie::Prev( cell Start)
{
cell success = Judy1Prev(Table, reinterpret_cast<unsigned int*>(&Start), PJE0);
if (success == NULL) ThrowSearchError("Type:Prev");
return Start;
}
cell BinTrie::PrevEmpty( cell Start)
{
cell success = Judy1PrevEmpty(Table, reinterpret_cast<unsigned int*>(&Start), PJE0);
if (success == NULL) ThrowSearchError("Type:PrevEmpty");
return Start;
}
cell BinTrie::Last( cell Start)
{
cell success = Judy1Last(Table, reinterpret_cast<unsigned int*>(&Start), PJE0);
if (success == NULL) ThrowSearchError("Type:Last");
return Start;
}
cell BinTrie::LastEmpty( cell Start)
{
cell success = Judy1LastEmpty(Table, reinterpret_cast<unsigned int*>(&Start), PJE0);
if (success == NULL) ThrowSearchError("Type:LastEmpty");
return Start;
}
cell BinTrie::ByCount(cell n, cell Start)
{
cell success = Judy1ByCount(Table, n, reinterpret_cast<unsigned int*>(&Start), PJE0);
if (success == NULL) ThrowSearchError("Type:Nth");
return Start;
}

52
dlls/arrayx/CBinTrie.h Normal file
View File

@ -0,0 +1,52 @@
#ifndef _BINTRIECLASS_H
#define _BINTRIECLASS_H
#include "JudyIncludes.h"
//#include <Judy1.h>
class BinTrie
{
private:
Pvoid_t Table;
void ThrowSearchError(char* msg);
public:
BinTrie() { Table = NULL; }
~BinTrie() { Judy1FreeArray(&Table, PJE0); }
Word_t Clear() { return Judy1FreeArray(&Table, PJE0); }
Word_t MemoryUsed() { return Judy1MemUsed(Table); }
cell Delete(cell Key) { return Judy1Unset(&Table, Key, PJE0 ); }
cell Set(cell Index, bool val)
{
if(val == false) return Delete(Index);
else return Judy1Set(&Table, Index,PJE0);
}
cell Get(cell Index)
{
cell PValue = Judy1Test(Table, Index, PJE0);
return PValue;
}
cell First(cell Start = 0);
cell Next(cell Start = 0);
cell Prev(cell Start = -1);
cell Last(cell Start = -1);
cell FirstEmpty(cell Start = 0);
cell NextEmpty(cell Start = 0);
cell PrevEmpty(cell Start = -1);
cell LastEmpty(cell Start = -1);
cell ByCount(cell n, cell Start);
cell Count(cell Start = 0, cell Stop = -1) { return Judy1Count(Table, Start, Stop, PJE0); }
bool IsFilled(cell Index) { return ( (Get(Index )) ? true : false); }
bool IsEmpty(cell Index) { return ( (Get(Index )) ? true : false); }
};
#endif

81
dlls/arrayx/CHashtable.h Normal file
View File

@ -0,0 +1,81 @@
#ifndef _HASHCLASS_INCLUDED
#define _HASHCLASS_INCLUDED
#include "JudyIncludes.h"
#include "CBaseMap.h"
//#include <JudyHS.h>
class Hashtable: public CBaseMap
{
private:
Pvoid_t Table;
public:
Hashtable() { Table = NULL; }
~Hashtable() { Clear(); }
Word_t Clear() { return JudyHSFreeArray(&Table, PJE0); }
Word_t MemoryUsed() { return JudyLMemUsed(Table); }
int Delete(char* Key) { delete Get(Key,true); return JudyHSDel(&Table, Key, strlen(Key), PJE0 ); }
void Set(char* Index, Pvoid_t value, bool disable_check)
{
int Len = strlen(Index) + 1;
PPvoid_t PValue = JudyHSIns(&Table, Index, Len, PJE0);
*PValue = value;
}
Pvoid_t Get(char* Index, bool disable_check = false)
{
PPvoid_t PValue = JudyHSGet(Table, Index, strlen(Index)+1);
if(PValue == NULL) { ThrowIndexError(Index, disable_check); return NULL; }
return *PValue;
}
template <class Type>
void Set(char* Index, Type value)
{
int Len = strlen(Index) + 1;
PPvoid_t PValue = JudyHSIns(&Table, Index, Len, PJE0);
*PValue = reinterpret_cast<void*>(value);
}
template <class Type>
Type Get(char* Index, Type example, bool disable_check = false)
{
PPvoid_t PValue = JudyHSGet(Table, Index, strlen(Index)+1);
if(PValue == NULL) { ThrowIndexError(Index, disable_check); return (Type)NULL; }
return (Type)(*PValue);
}
char* First( char* Start = "") { ThrowSearchError(); return (char*)NULL; }
char* Next( char* Start = "") { ThrowSearchError(); return (char*)NULL; }
char* Prev( char* Start) { ThrowSearchError(); return (char*)NULL; }
char* Last( char* Start) { ThrowSearchError(); return (char*)NULL; }
bool IsFilled(char* Index) { return ( (Get(Index,(PPvoid_t)(NULL), true ) != NULL) ? true : false);}
bool IsEmpty(char* Index) { return ( (Get(Index,(PPvoid_t)(NULL), true ) == NULL) ? true : false);}
protected:
void ThrowIndexError( char* index, bool disable_check = false )
{
if(disable_check == true) return;
char value[100];
sprintf(value,"Function attempted to read non existant index %s", index );
throw JudyEx(value, true);
}
void ThrowSearchError( void )
{
char value[50];
sprintf(value,"Function attempted to search HashTable!: Invalid action!");
throw JudyEx(value,true);
}
};
#endif

66
dlls/arrayx/CKeytable.cpp Normal file
View File

@ -0,0 +1,66 @@
#include "CKeytable.h"
void Keytable::ThrowIndexError( char* index, bool disable_check = false )
{
if(disable_check == true) return;
char error[50];
sprintf(error,"Index %s is not set.",index);
throw JudyEx(error,true);
}
void Keytable::ThrowSearchError(char* type)
{
char value[50];
sprintf(value,"Function attempted to search %s: Judy returned NULL value", type);
throw JudyEx(value,false);
}
char* Keytable::First( char* Start)
{
PPvoid_t index = JudySLFirst(Table, Start, PJE0);
if (index == NULL)
{
sprintf(Start,"dne");
ThrowSearchError("Type:First");
}
return Start;
}
char* Keytable::Next( char* Start)
{
PPvoid_t index = JudySLNext(Table, Start, PJE0);
if (index == NULL)
{
sprintf(Start,"dne");
ThrowSearchError("Type:Next");
}
return Start;
}
char* Keytable::Prev( char* Start)
{
PPvoid_t index = JudySLPrev(Table, Start, PJE0);
if (index == NULL)
{
sprintf(Start,"dne");
ThrowSearchError("Type:Prev");
}
return Start;
}
char* Keytable::Last( char* Start)
{
PPvoid_t index = JudySLLast(Table, Start, PJE0);
if (index == NULL)
{
sprintf(Start,"dne");
ThrowSearchError("Type:Last");
}
return Start;
}

65
dlls/arrayx/CKeytable.h Normal file
View File

@ -0,0 +1,65 @@
#ifndef _KEYCLASS_INCLUDED
#define _KEYCLASS_INCLUDED
#include "JudyIncludes.h"
#include "CBaseMap.h"
#include "JudyExtra.h"
//#include <JudySL.h>
class Keytable: public CBaseMap
{
private:
Pvoid_t Table;
void ThrowSearchError(char* type);
void ThrowIndexError( char* index, bool disable_check);
public:
Keytable() { Table = NULL; }
~Keytable() { Clear(); }
Word_t Clear() { JudyClearMap(this); return JudySLFreeArray(&Table, PJE0); }
Word_t MemoryUsed() { return JudyLMemUsed(Table); }
int Delete(char* Key) { delete Get(Key,true); return JudySLDel(&Table, Key, PJE0 ); }
void Set(char* Index, Pvoid_t value, bool disable_check)
{
PPvoid_t PValue = JudySLIns(&Table, Index,PJE0);
*PValue = value;
}
Pvoid_t Get(char* Index, bool disable_check = false)
{
PPvoid_t PValue = JudySLGet(Table, Index, PJE0);
if(PValue == NULL) { ThrowIndexError(Index, disable_check); return NULL; }
return *PValue;
}
template <class Type>
void Set(char* Index, Type value)
{
PPvoid_t PValue = JudySLIns(&Table, Index,PJE0);
*PValue = reinterpret_cast<void*>(value);
}
template <class Type>
Type Get(char* Index, Type example, bool disable_check = false)
{
PPvoid_t PValue = JudySLGet(Table, Index, PJE0);
if(PValue == NULL) { ThrowIndexError(Index, disable_check); return (Type)NULL; }
return (Type)*PValue;
}
char* First(char* Start = "");
char* Next(char* Start = "");
char* Prev(char* Start = "");
char* Last(char* Start = "");
bool IsFilled(char* Index) { return ( (Get(Index,(PPvoid_t)(NULL), true ) != NULL) ? true : false); }
bool IsEmpty(char* Index) { return ( (Get(Index,(PPvoid_t)(NULL), true ) == NULL) ? true : false); }
};
#endif

261
dlls/arrayx/Capsule.cpp Normal file
View File

@ -0,0 +1,261 @@
#include "Capsule.h"
const char* capsule_types[] =
{
"-NO VALUE-",
"BOOLEAN",
"INTEGER",
"FLOAT",
"VECTOR",
"STRING"
};
void Capsule::ThrowTypeError(cell get_type)
{
char ValStr[15];
GetAsStr(ValStr);
char value[100];
sprintf(value,"Function attempted to read NON-%s value, actual type is: %s, actual value is: %s", capsule_types[get_type], capsule_types[type], ValStr );
throw JudyEx(value, true);
}
bool Capsule::CheckEmpty(bool clear)
{
bool empty = ( data == NULL );
if(empty != true && clear == true) Clear();
return empty;
}
void Capsule::Clear()
{
//This function intelligently creates a pointer x,
//which will be of correct type and then deletes it.
switch (type)
{
case capsule_type_flo:
{
REAL *real_val = reinterpret_cast<REAL*>(data);
delete real_val;
break;
}
case capsule_type_vec:
{
JudyVec *vector_val = reinterpret_cast<JudyVec*>(data);
delete vector_val;
break;
}
case capsule_type_str:
{
char *char_val = reinterpret_cast<char*>(data);
delete char_val;
break;
}
}
data = NULL; //Null the address as well. (Used for ints too.)
}
bool Capsule::GetBool( void )
{
if (type != capsule_type_bool) ThrowTypeError(capsule_type_bool);
return reinterpret_cast<bool>(data);
}
void Capsule::SetBool(bool Value)
{
CheckEmpty(true);
type = capsule_type_bool;
data = reinterpret_cast<void*>(Value);
};
cell Capsule::GetInt( void )
{
if (type != capsule_type_int) ThrowTypeError(capsule_type_int);
return reinterpret_cast<cell>(data);
}
void Capsule::SetInt(cell Value)
{
CheckEmpty(true);
type = capsule_type_int;
data = reinterpret_cast<void*>(Value);
};
REAL Capsule::GetFlo( void )
{
if (type != capsule_type_flo) ThrowTypeError(capsule_type_flo);
return *reinterpret_cast<REAL*>(data);
}
void Capsule::SetFlo(REAL Value)
{
CheckEmpty(true);
type = capsule_type_flo;
data = new REAL(Value);
};
const JudyVec* Capsule::GetVec( void )
{
if (type != capsule_type_vec) ThrowTypeError(capsule_type_vec);
return reinterpret_cast<const JudyVec*>(data);
}
void Capsule::SetVec(JudyVec* Value)
{
CheckEmpty(true);
type = capsule_type_vec;
data = reinterpret_cast<void*>(Value);
}
const char* Capsule::GetStr( void )
{
if (type != capsule_type_str) ThrowTypeError(capsule_type_str);
return reinterpret_cast<const char*>(data);
}
void Capsule::SetStr(char* Value)
{
CheckEmpty(true);
type = capsule_type_str;
char *string_val = new char[strlen(Value)+1];
strcpy(string_val,Value);
data = reinterpret_cast<void*>(string_val);
}
void Capsule::GetAsStr(char* value)
{
switch (type)
{
case capsule_type_bool:
sprintf(value, "%i",(cell)GetBool());
break;
case capsule_type_int:
sprintf(value, "%d", GetInt() );
break;
case capsule_type_flo:
sprintf(value, "%f", GetFlo() );
break;
case capsule_type_vec:
sprintf(value, "{%f,%f,%f}", GetVec()->first, GetVec()->second, GetVec()->third);
break;
case capsule_type_str:
sprintf(value, "\"%s\"", GetStr() );
break;
default:
sprintf(value, "-NO VALUE-");
}
}
void Capsule::Save(FILE* capsuleDB)
{
fwrite(&type,sizeof(char),1,capsuleDB);
switch(type)
{
case capsule_type_none: { break; }
case capsule_type_bool: { bool var = GetBool(); fwrite(&var, sizeof(bool), 1, capsuleDB); break; }
case capsule_type_int: { cell var = GetInt(); fwrite(&var, sizeof(cell), 1, capsuleDB); break; }
case capsule_type_flo: { fwrite(reinterpret_cast<REAL*>(GetData()), sizeof(REAL), 1, capsuleDB); break; }
case capsule_type_str:
{
const char* str = GetStr();
size_t len = strlen(str);
fwrite(&len,sizeof(size_t), 1, capsuleDB);
fwrite(&str, sizeof(char), len, capsuleDB);
break;
}
case capsule_type_vec:
{
const JudyVec* buffer = GetVec();
fwrite(buffer, sizeof(JudyVec), 1, capsuleDB);
break;
}
default:
{
char value[20];
sprintf(value,"Invalid type found!");
throw JudyEx(value, true);
break;
}
};
}
void Capsule::Load(FILE* capsuleDB)
{
fread(&type, sizeof(char), 1, capsuleDB);
switch(type)
{
case capsule_type_none: { CheckEmpty(true); break; }
case capsule_type_bool:
{
bool value = false;
fread(&value, sizeof(bool), 1, capsuleDB);
SetBool(value);
break;
}
case capsule_type_int:
{
cell value = NULL;
fread(&value, sizeof(cell), 1, capsuleDB);
SetInt(value);
break;
}
case capsule_type_flo:
{
REAL value = NULL;
fread(&value, sizeof(REAL), 1, capsuleDB);
SetFlo(value);
break;
}
case capsule_type_str:
{
size_t length;
fread(&length, sizeof(size_t), 1, capsuleDB);
char* value = new char[length+1];
fgets(value, length+1, capsuleDB);
SetStr(value);
delete(value);
break;
}
case capsule_type_vec:
{
JudyVec* value = new JudyVec(NULL,NULL,NULL);
fread(value, sizeof(JudyVec), 1, capsuleDB);
SetVec(value);
break;
}
default:
{
char value[20];
sprintf(value,"Invalid type found: %i",(int)type);
throw JudyEx(value, true);
}
};
}

64
dlls/arrayx/Capsule.h Normal file
View File

@ -0,0 +1,64 @@
#ifndef _JUDYCAP_INCLUDED
#define _JUDYCAP_INCLUDED
#include "JudyIncludes.h"
enum
{
capsule_type_none,
capsule_type_bool,
capsule_type_int,
capsule_type_flo,
capsule_type_vec,
capsule_type_str
};
extern const char* capsule_types[];
class Capsule
{
private:
Pvoid_t data;
char type;
protected:
void Clear( void );
void ThrowTypeError(cell get_type);
public:
Capsule() { data = NULL; type = capsule_type_none;}
~Capsule() { Clear(); }
Capsule(bool set) { SetBool(set); }
Capsule(cell set) { SetInt(set); }
Capsule(REAL set) { SetFlo(set); }
Capsule(JudyVec* set) { SetVec(set); }
Capsule(char* set) { SetStr(set); }
bool GetBool( void );
void SetBool(bool set);
cell GetInt( void );
void SetInt(cell set);
REAL GetFlo( void );
void SetFlo(REAL set);
const JudyVec* GetVec( void );
void SetVec(JudyVec* set);
const char* GetStr( void );
void SetStr(char* set);
void GetAsStr(char* value);
void Load(FILE* db);
void Save(FILE* db);
bool CheckEmpty(bool clear);
Pvoid_t GetData( void ) { return data; }
char GetType( void ) { return type; }
};
#endif

79
dlls/arrayx/ComboArray.h Normal file
View File

@ -0,0 +1,79 @@
#ifndef _COMBOARRAY_INCLUDED
#define _COMBOARRAY_INCLUDED
#include "CBinTrie.h"
#include "CArray.h"
#include "CBaseList.h"
class ComboArray: public CBaseList
{
private:
BinTrie MasterBin;
Array MasterArray;
public:
ComboArray() {}
~ComboArray() { Clear(); }
Word_t Clear() { return (MasterBin.Clear() + MasterArray.Clear() ); }
Word_t MemoryUsed() { return (MasterBin.MemoryUsed() + MasterArray.MemoryUsed() ); }
int Delete(cell Key) { return (MasterBin.Delete(Key) + MasterArray.Delete(Key) ); }
void Set(cell Index, Pvoid_t value, bool disable_check)
{
MasterBin.Set(Index, true);
MasterArray.Set(Index, value, disable_check);
}
Pvoid_t Get(cell Index, bool disable_check = false)
{
if(MasterBin.Get(Index) == NULL) { ThrowIndexError(Index, disable_check); return NULL; }
return MasterArray.Get(Index);
}
template <class Type>
void Set(cell Index, Type value)
{
MasterBin.Set(Index, true);
MasterArray.Set(Index, value);
}
template <class Type>
Type Get(cell Index, Type example, bool disable_check = false)
{
if(MasterBin.Get(Index) == NULL) { ThrowIndexError(Index, disable_check); return (Type)NULL; }
return MasterArray.Get(Index,example);
}
cell First(cell Start = 0) { return MasterBin.First(Start); }
cell Next(cell Start = 0) { return MasterBin.Next(Start); }
cell Prev(cell Start = -1) { return MasterBin.Prev(Start); }
cell Last(cell Start = -1) { return MasterBin.Last(Start); }
cell FirstEmpty(cell Start = 0) { return MasterBin.FirstEmpty(Start); }
cell NextEmpty(cell Start = 0) { return MasterBin.NextEmpty(Start); }
cell PrevEmpty(cell Start = -1) { return MasterBin.PrevEmpty(Start); }
cell LastEmpty(cell Start = -1) { return MasterBin.LastEmpty(Start); }
cell ByCount(cell n, cell Start = 0) { return MasterBin.ByCount(n, Start); }
cell Count(cell Start = 0, cell Stop = -1) { return MasterBin.Count(Start, Stop); }
bool IsFilled(cell Index) { return ( (MasterBin.Get(Index) != NULL) ? true : false); }
bool IsEmpty(cell Index) { return ( (MasterBin.Get(Index) == NULL) ? true : false); }
protected:
void ThrowIndexError(cell Index, bool disable_check = false)
{
if(disable_check == true) return;
char error[50];
sprintf(error,"Index %i is not set.",Index);
throw JudyEx(error,true);
}
};
#endif

67
dlls/arrayx/ComboTable.h Normal file
View File

@ -0,0 +1,67 @@
#ifndef _COMBOTABLE_INCLUDED
#define _COMBOTABLE_INCLUDED
#include "CKeytable.h"
#include "CHashtable.h"
#include "CBaseMap.h"
class ComboTable: public CBaseMap
{
private:
Keytable MasterKey;
Hashtable MasterHash;
public:
ComboTable() { }
~ComboTable() { Clear(); }
Word_t Clear() { return (MasterKey.Clear() + MasterHash.Clear() ); }
Word_t MemoryUsed() { return (MasterKey.MemoryUsed() + MasterHash.MemoryUsed() ); }
int Delete(char* Key) { return (MasterKey.Delete(Key) + MasterHash.Delete(Key) ); }
bool IsFilled(char* Index) { return ( (MasterHash.Get(Index,(PPvoid_t)(NULL), true ) != NULL) ? true : false);}
bool IsEmpty(char* Index) { return ( (MasterHash.Get(Index,(PPvoid_t)(NULL), true ) == NULL) ? true : false);}
void Set(char* Index, Pvoid_t value, bool disable_check)
{
MasterHash.Set(Index, value);
MasterKey.Set(Index, value);
}
Pvoid_t Get(char* Index, bool disable_check = false)
{
return MasterHash.Get(Index, disable_check);
}
template <class Type>
void Set(char* Index, Type value)
{
MasterHash.Set(Index, value);
MasterKey.Set(Index, value);
}
template <class Type>
Type Get(char* Index, Type example, bool disable_check = false)
{
return MasterHash.Get(Index, example, disable_check);
}
char* First( char* Start = "") { return MasterKey.First(Start);}
char* Next( char* Start = "") { return MasterKey.Next(Start);}
char* Prev( char* Start = "") { return MasterKey.Prev(Start); }
char* Last( char* Start = "") { return MasterKey.Last(Start);}
protected:
void ThrowIndexError( char* index, bool disable_check = false )
{
if(disable_check == true) return;
char value[100];
sprintf(value,"Function attempted to read non existant index %s", index );
throw JudyEx(value, true);
}
};
#endif

View File

@ -0,0 +1,844 @@
#ifndef _GENERIC_INC_H
#define _GENERIC_INC_H
// Master table
ComboArray MNAME;
///* MASTER FUNCTIONS *///
///* Start Master Edit Funcs *///
#ifdef JUDY_MASTER_EDIT_FUNCTIONS
#ifdef JUDY_MASTER_DELETE_FUNC
// generic_delete(id)
static cell AMX_NATIVE_CALL JUDY_MASTER_DELETE_FUNC(AMX *amx,cell *params)
{
try { return MNAME.Delete( params[1] ); }
JUDY_ERROR_CATCH("Judy Error: (No error possible) - Delete function ");
}
#else
#error Must Have Delete func: JUDY_MASTER_DELETE_FUNC not defined!
#endif
#ifdef JUDY_MASTER_CLEAR_FUNC
// generic_clear(id)
static cell AMX_NATIVE_CALL JUDY_MASTER_CLEAR_FUNC(AMX *amx,cell *params)
{
DTYPE* Unit = NULL;
JUDY_GET_INDEX(MNAME,Unit, params[1] );
try { return Unit->Clear(); }
JUDY_ERROR_CATCH("Judy Error: (Search error likely) - Clear function ");
}
#else
#error Must Have Clear func: JUDY_MASTER_CLEAR_FUNC not defined!
#endif
///* End Master Edit Funcs *///
#endif
///* Start Master IO Funcs *///
#ifdef JUDY_MASTER_IO_FUNCTIONS
#ifdef JUDY_MASTER_SAVE_FUNC
// generic_save(id,file[])
static cell AMX_NATIVE_CALL JUDY_MASTER_SAVE_FUNC(AMX *amx,cell *params)
{
DTYPE* Unit = NULL;
JUDY_GET_INDEX(MNAME,Unit, params[1]);
return JUDY_SAVE_FUNC(Unit, JUDY_BUILD_PATH(amx,params[2]) );
}
#else
#error Must Have Save func: JUDY_MASTER_SAVE_FUNC not defined properly!
#endif
#ifdef JUDY_MASTER_LOAD_FUNC
// generic_load(file[],id)
static cell AMX_NATIVE_CALL JUDY_MASTER_LOAD_FUNC(AMX *amx,cell *params)
{
DTYPE* Unit = NULL;
JUDY_GET_INDEX(MNAME,Unit, params[2]);
return JUDY_LOAD_FUNC(Unit, JUDY_BUILD_PATH(amx,params[1]) );
}
#else
#error Must Have Load func: JUDY_MASTER_LOAD_FUNC not defined!
#endif
///* End Master IO Funcs *///
#endif
///* Start Master Amount Funcs *///
#ifdef JUDY_MASTER_AMOUNT_FUNCTIONS
#ifdef JUDY_MASTER_COUNT_FUNC
// generic_count(start = 0, stop = -1)
static cell AMX_NATIVE_CALL JUDY_MASTER_COUNT_FUNC(AMX *amx,cell *params)
{
try { return MNAME.Count(params[1],params[2] ); }
JUDY_ERROR_CATCH("Judy Error: (Search error likely) - Count Function ");
}
#else
#error Must Have Count func: JUDY_MASTER_COUNT_FUNC not defined!
#endif
#ifdef JUDY_MASTER_BYCOUNT_FUNC
// generic_bycount(nth, start = -1)
static cell AMX_NATIVE_CALL JUDY_MASTER_BYCOUNT_FUNC(AMX *amx,cell *params)
{
try { return MNAME.ByCount(params[1],params[2] ); }
JUDY_ERROR_CATCH("Judy Error: (Search error likely) - ByCount Function ");
}
#else
#error Must Have ByCount func: JUDY_MASTER_BYCOUNT_FUNC not defined!
#endif
///* End Master Amount Funcs *///
#endif
///* SLAVE FUNCTIONS *///
///* Start Slave Amount Funcs *///
#ifdef JUDY_SLAVE_AMOUNT_FUNCTIONS
#ifdef JUDY_SLAVE_COUNT_FUNC
// generic_size(id, start = 0, stop = -1)
static cell AMX_NATIVE_CALL JUDY_SLAVE_COUNT_FUNC(AMX *amx,cell *params)
{
DTYPE* Unit = NULL;
JUDY_GET_INDEX(MNAME,Unit, params[1]);
try { return Unit->Count(JUDY_GET_KEY(params,2),JUDY_GET_KEY(params, 3) ); }
JUDY_ERROR_CATCH("Judy Error: (Search error likely) - Slave Count Function ");
}
#else
#error Must Have Count func: JUDY_SLAVE_COUNT_FUNC not defined!
#endif
#ifdef JUDY_SLAVE_BYCOUNT_FUNC
// generic_get_nth(id, nth, start = -1)
static cell AMX_NATIVE_CALL JUDY_SLAVE_BYCOUNT_FUNC(AMX *amx,cell *params)
{
DTYPE* Unit = NULL;
JUDY_GET_INDEX(MNAME,Unit, params[1]);
try { return Unit->ByCount(JUDY_GET_KEY(params,2),JUDY_GET_KEY(params, 3) ); }
JUDY_ERROR_CATCH("Judy Error: (Search error likely) - Slave ByCount Function ");
}
#else
#error Must Have ByCount func: JUDY_SLAVE_BYCOUNT_FUNC not defined!
#endif
///* End Slave Amount Funcs *///
#endif
///* Start Slave Edit Funcs *///
#ifdef JUDY_SLAVE_EDIT_FUNCTIONS
#ifdef JUDY_SLAVE_MEMORY_FUNC
// generic_memory(id)
static cell AMX_NATIVE_CALL JUDY_SLAVE_MEMORY_FUNC(AMX *amx,cell *params)
{
DTYPE* Unit = NULL;
JUDY_GET_INDEX(MNAME,Unit, params[1]);
try { return Unit->MemoryUsed(); }
JUDY_ERROR_CATCH("Judy Error: (Search error likely) - Slave ByCount Function ");
}
#else
#error Must Have Memory func: JUDY_SLAVE_MEMORY_FUNC not defined!
#endif
#ifdef JUDY_SLAVE_ISFILLED_FUNC
// generic_isfilled(id, index)
static cell AMX_NATIVE_CALL JUDY_SLAVE_ISFILLED_FUNC(AMX *amx,cell *params)
{
DTYPE* Unit = NULL;
JUDY_GET_INDEX(MNAME,Unit, params[1]);
try { return Unit->IsFilled(JUDY_GET_KEY(params,2) ); }
JUDY_ERROR_CATCH("Judy Error: (No error possible) - Slave IsFilled Function ");
}
#else
#error Must Have IsFilled func: JUDY_SLAVE_ISFILLED_FUNC not defined!
#endif
#ifdef JUDY_SLAVE_ISEMPTY_FUNC
// generic_isempty(id, index)
static cell AMX_NATIVE_CALL JUDY_SLAVE_ISEMPTY_FUNC(AMX *amx,cell *params)
{
DTYPE* Unit = NULL;
JUDY_GET_INDEX(MNAME,Unit, params[1]);
try { return Unit->IsEmpty(JUDY_GET_KEY(params,2) ); }
JUDY_ERROR_CATCH("Judy Error: (No error possible) - Slave IsEmpty Function ");
}
#else
#error Must Have IsEmpty func: JUDY_SLAVE_ISEMPTY_FUNC not defined!
#endif
#ifdef JUDY_SLAVE_REMOVE_FUNC
// generic_remove(id, index)
static cell AMX_NATIVE_CALL JUDY_SLAVE_REMOVE_FUNC(AMX *amx,cell *params)
{
DTYPE* Unit = NULL;
JUDY_GET_INDEX(MNAME,Unit, params[1]);
try { return Unit->Delete(JUDY_GET_KEY(params,2) ); }
JUDY_ERROR_CATCH("Judy Error: (No error possible) - Slave Delete Function ");
}
#else
#error Must Have Delete func: JUDY_SLAVE_DELETE_FUNC not defined!
#endif
///* End Required Slave Edit Funcs *///
///* Start Slave Bool Funcs *///
#ifdef JUDY_SLAVE_EDIT_BOOL
#ifdef JUDY_SLAVE_SET_BOOL_FUNC
// generic_set_bool(id, index, Bool:val)
static cell AMX_NATIVE_CALL JUDY_SLAVE_SET_BOOL_FUNC(AMX *amx,cell *params)
{
DTYPE* Unit = NULL;
STYPE* Storage;
JUDY_GET_INDEX(MNAME,Unit, params[1]);
ITYPE Indice = JUDY_GET_KEY(params,2);
bool Value = (params[3] != NULL);
Storage = reinterpret_cast<Capsule*>( Unit->Get(Indice, true ) );
if(Storage == NULL) Storage = new STYPE(Value);
else Storage->SetBool(Value);
JUDY_SET_INDEX_P(Unit,Storage,Indice);
}
#else
#error Must Have Set func: JUDY_SLAVE_SET_BOOL_FUNC not defined!
#endif
#ifdef JUDY_SLAVE_GET_BOOL_FUNC
// Bool:generic_get_bool(id, index, disable_check = 0)
static cell AMX_NATIVE_CALL JUDY_SLAVE_GET_BOOL_FUNC(AMX *amx,cell *params)
{
DTYPE* Unit = NULL;
STYPE* Storage;
JUDY_GET_INDEX(MNAME,Unit, params[1]);
ITYPE Indice = JUDY_GET_KEY(params,2);
bool disable_check = (params[3] != NULL);
try { Storage = reinterpret_cast<Capsule*>( Unit->Get(Indice, disable_check ) ); }
JUDY_ERROR_CATCH("Judy Error: (Retrieve unset value) - Slave Get Function ");
if(Storage == NULL) return 0;
return Storage->GetBool();
}
#else
#error Must Have Get func: JUDY_SLAVE_GET_BOOL_FUNC not defined!
#endif
///* End Slave Bool Funcs *///
#endif
///* Start Slave Int Funcs *///
#ifdef JUDY_SLAVE_EDIT_INT
#ifdef JUDY_SLAVE_SET_INT_FUNC
// generic_set_bool(id, index, val)
static cell AMX_NATIVE_CALL JUDY_SLAVE_SET_INT_FUNC(AMX *amx,cell *params)
{
DTYPE* Unit = NULL;
STYPE* Storage;
JUDY_GET_INDEX(MNAME,Unit, params[1]);
ITYPE Indice = JUDY_GET_KEY(params,2);
cell Value = params[3];
Storage = reinterpret_cast<Capsule*>( Unit->Get(Indice, true ) );
if(Storage == NULL) Storage = new STYPE(Value);
else Storage->SetInt(Value);
JUDY_SET_INDEX_P(Unit,Storage,Indice);
}
#else
#error Must Have Set func: JUDY_SLAVE_SET_INT_FUNC not defined!
#endif
#ifdef JUDY_SLAVE_GET_INT_FUNC
// generic_get_int(id, index, disable_check = 0)
static cell AMX_NATIVE_CALL JUDY_SLAVE_GET_INT_FUNC(AMX *amx,cell *params)
{
DTYPE* Unit = NULL;
STYPE* Storage;
JUDY_GET_INDEX(MNAME,Unit, params[1]);
ITYPE Indice = JUDY_GET_KEY(params,2);
bool disable_check = (params[3] != NULL);
try { Storage = reinterpret_cast<Capsule*>( Unit->Get(Indice, disable_check ) ); }
JUDY_ERROR_CATCH("Judy Error: (Retrieve unset value) - Slave Get Function ");
if(Storage == NULL) return 0;
return Storage->GetInt();
}
#else
#error Must Have Get func: JUDY_SLAVE_GET_INT_FUNC not defined!
#endif
///* End Slave Int Funcs *///
#endif
///* Start Slave Float Funcs *///
#ifdef JUDY_SLAVE_EDIT_FLO
#ifdef JUDY_SLAVE_SET_FLO_FUNC
// generic_set_float(id, index, Float:val)
static cell AMX_NATIVE_CALL JUDY_SLAVE_SET_FLO_FUNC(AMX *amx,cell *params)
{
DTYPE* Unit = NULL;
STYPE* Storage;
JUDY_GET_INDEX(MNAME,Unit, params[1]);
ITYPE Indice = JUDY_GET_KEY(params,2);
REAL Value = amx_ctof(params[3]);
Storage = reinterpret_cast<Capsule*>( Unit->Get(Indice, true ) );
if(Storage == NULL) Storage = new STYPE(Value);
else Storage->SetFlo(Value);
JUDY_SET_INDEX_P(Unit,Storage,Indice);
}
#else
#error Must Have Set func: JUDY_SLAVE_SET_FLO_FUNC not defined!
#endif
#ifdef JUDY_SLAVE_GET_FLO_FUNC
// Float:generic_get_float(id, index, disable_check = 0)
static cell AMX_NATIVE_CALL JUDY_SLAVE_GET_FLO_FUNC(AMX *amx,cell *params)
{
DTYPE* Unit = NULL;
STYPE* Storage;
JUDY_GET_INDEX(MNAME,Unit, params[1]);
ITYPE Indice = JUDY_GET_KEY(params,2);
bool disable_check = (params[3] != NULL);
try { Storage = reinterpret_cast<Capsule*>( Unit->Get(Indice, disable_check ) ); }
JUDY_ERROR_CATCH("Judy Error: (Retrieve unset value) - Slave Get Function ");
if(Storage == NULL) return 0;
return amx_ftoc(Storage->GetFlo() );
}
#else
#error Must Have Get func: JUDY_SLAVE_GET_FLO_FUNC not defined!
#endif
///* End Slave Float Funcs *///
#endif
///* Start Slave String Funcs *///
#ifdef JUDY_SLAVE_EDIT_STR
#ifdef JUDY_SLAVE_SET_STR_FUNC
// generic_set_string(id, index, val[])
static cell AMX_NATIVE_CALL JUDY_SLAVE_SET_STR_FUNC(AMX *amx,cell *params)
{
DTYPE* Unit = NULL;
STYPE* Storage;
JUDY_GET_INDEX(MNAME,Unit, params[1]);
ITYPE Indice = JUDY_GET_KEY(params,2);
char* Value = MF_GetAmxString(amx,params[3],3,NULL);
Storage = reinterpret_cast<Capsule*>( Unit->Get(Indice, true ) );
if(Storage == NULL) Storage = new STYPE(Value);
else Storage->SetStr(Value);
JUDY_SET_INDEX_P(Unit,Storage,Indice);
}
#else
#error Must Have Set func: JUDY_SLAVE_SET_STR_FUNC not defined!
#endif
#ifdef JUDY_SLAVE_GET_STR_FUNC
// generic_get_string(id, index, val[], len, disable_check = 0)
static cell AMX_NATIVE_CALL JUDY_SLAVE_GET_STR_FUNC(AMX *amx,cell *params)
{
DTYPE* Unit = NULL;
STYPE* Storage;
JUDY_GET_INDEX(MNAME,Unit, params[1]);
ITYPE Indice = JUDY_GET_KEY(params,2);
bool disable_check = (params[5] != NULL);
try { Storage = reinterpret_cast<Capsule*>( Unit->Get(Indice, disable_check ) ); }
JUDY_ERROR_CATCH("Judy Error: (Retrieve unset value) - Slave Get Function ");
if(Storage == NULL) return 0;
return MF_SetAmxString(amx,params[3], Storage->GetStr(), params[4] );
}
#else
#error Must Have Get func: JUDY_SLAVE_GET_STR_FUNC not defined!
#endif
///* End Slave String Funcs *///
#endif
///* Start Slave Vector Funcs *///
#ifdef JUDY_SLAVE_EDIT_VEC
#ifdef JUDY_SLAVE_SET_VEC_FUNC
// generic_set_vec(id, index, Float:val[3])
static cell AMX_NATIVE_CALL JUDY_SLAVE_SET_VEC_FUNC(AMX *amx,cell *params)
{
DTYPE* Unit = NULL;
STYPE* Storage;
JUDY_GET_INDEX(MNAME,Unit, params[1]);
ITYPE Indice = JUDY_GET_KEY(params,2);
cell *input_vec = MF_GetAmxAddr(amx, params[3]);
JudyVec *Value = new JudyVec(
amx_ctof(input_vec[0]),
amx_ctof(input_vec[1]),
amx_ctof(input_vec[2])
);
Storage = reinterpret_cast<Capsule*>( Unit->Get(Indice, true ) );
if(Storage == NULL) Storage = new STYPE(Value);
else Storage->SetVec(Value);
JUDY_SET_INDEX_P(Unit,Storage,Indice);
}
#else
#error Must Have Set func: JUDY_SLAVE_SET_VEC_FUNC not defined!
#endif
#ifdef JUDY_SLAVE_GET_FLO_FUNC
// generic_get_vec(id,index,Float:vec[3], disable_check = 0)
static cell AMX_NATIVE_CALL JUDY_SLAVE_GET_VEC_FUNC(AMX *amx,cell *params)
{
DTYPE* Unit = NULL;
STYPE* Storage;
JUDY_GET_INDEX(MNAME,Unit, params[1]);
ITYPE Indice = JUDY_GET_KEY(params,2);
cell *vAmx = MF_GetAmxAddr(amx, params[3]);
bool disable_check = (params[4] != NULL);
try { Storage = reinterpret_cast<Capsule*>( Unit->Get(Indice, disable_check ) ); }
JUDY_ERROR_CATCH("Judy Error: (Retrieve unset value) - Slave Get Function ");
if(Storage == NULL)
{
vAmx[0] = amx_ftoc(0);
vAmx[1] = amx_ftoc(0);
vAmx[2] = amx_ftoc(0);
return 0;
}
JudyVec* Vec = const_cast<JudyVec*>( Storage->GetVec() );
REAL One, Two, Three;
Vec->Get(One, Two, Three);
vAmx[0] = amx_ftoc(One);
vAmx[1] = amx_ftoc(Two);
vAmx[2] = amx_ftoc(Three);
return 1;
}
#else
#error Must Have Get func: JUDY_SLAVE_GET_VEC_FUNC not defined!
#endif
///* End Slave VEC Funcs *///
#endif
///* End Slave Edit Funcs *///
#endif
///* Start Slave Search Funcs
#ifdef JUDY_SLAVE_SEARCH_FUNCTIONS
#ifdef JUDY_SLAVE_FIRST_FUNC
// generic_first(id, index,...)
static cell AMX_NATIVE_CALL JUDY_SLAVE_FIRST_FUNC(AMX *amx,cell *params)
{
DTYPE* Unit = NULL;
JUDY_GET_INDEX(MNAME,Unit, params[1]);
ITYPE Indice = JUDY_GET_KEY(params,2);
cell* success = MF_GetAmxAddr(amx, params[3 + SE_OFFSET]);
*success = 1;
try { return JUDY_SET_KEY(Unit->First(Indice),3); }
JUDY_SEARCH_ERROR_CATCH("Judy Error (Search failed) - Slave Search Function", *success);
}
#else
#error Must Have Search func: JUDY_SLAVE_FIRST_FUNC not defined!
#endif
#ifdef JUDY_SLAVE_NEXT_FUNC
// generic_next(id, index,...)
static cell AMX_NATIVE_CALL JUDY_SLAVE_NEXT_FUNC(AMX *amx,cell *params)
{
DTYPE* Unit = NULL;
JUDY_GET_INDEX(MNAME,Unit, params[1]);
ITYPE Indice = JUDY_GET_KEY(params,2);
cell* success = MF_GetAmxAddr(amx, params[3 + SE_OFFSET]);
*success = 1;
try { return JUDY_SET_KEY(Unit->Next(Indice),3); }
JUDY_SEARCH_ERROR_CATCH("Judy Error (Search failed) - Slave Search Function", *success);
}
#else
#error Must Have Search func: JUDY_SLAVE_NEXT_FUNC not defined!
#endif
#ifdef JUDY_SLAVE_PREV_FUNC
// generic_prev(id, index,...)
static cell AMX_NATIVE_CALL JUDY_SLAVE_PREV_FUNC(AMX *amx,cell *params)
{
DTYPE* Unit = NULL;
JUDY_GET_INDEX(MNAME,Unit, params[1]);
ITYPE Indice = JUDY_GET_KEY(params,2);
cell* success = MF_GetAmxAddr(amx, params[3 + SE_OFFSET]);
*success = 1;
try { return JUDY_SET_KEY(Unit->Prev(Indice),3); }
JUDY_SEARCH_ERROR_CATCH("Judy Error (Search failed) - Slave Search Function", *success);
}
#else
#error Must Have Search func: JUDY_SLAVE_PREV_FUNC not defined!
#endif
#ifdef JUDY_SLAVE_LAST_FUNC
// generic_first(id, index,...)
static cell AMX_NATIVE_CALL JUDY_SLAVE_LAST_FUNC(AMX *amx,cell *params)
{
DTYPE* Unit = NULL;
JUDY_GET_INDEX(MNAME,Unit, params[1]);
ITYPE Indice = JUDY_GET_KEY(params,2);
cell* success = MF_GetAmxAddr(amx, params[3 + SE_OFFSET]);
*success = 1;
try { return JUDY_SET_KEY(Unit->Last(Indice),3); }
JUDY_SEARCH_ERROR_CATCH("Judy Error (Search failed) - Slave Search Function", *success);
}
#else
#error Must Have Search func: JUDY_SLAVE_LAST_FUNC not defined!
#endif
///* End Slave Search Funcs *///
#endif
///* Start Slave Empty Search Funcs
#ifdef JUDY_SLAVE_SEARCH_EMPTY_FUNCTIONS
#ifdef JUDY_SLAVE_FIRSTEMPTY_FUNC
// generic_firstempty(id, index,...)
static cell AMX_NATIVE_CALL JUDY_SLAVE_FIRSTEMPTY_FUNC(AMX *amx,cell *params)
{
DTYPE* Unit = NULL;
JUDY_GET_INDEX(MNAME,Unit, params[1]);
ITYPE Indice = JUDY_GET_KEY(params,2);
cell* success = MF_GetAmxAddr(amx, params[3 + SE_OFFSET]);
*success = 1;
try { return JUDY_SET_KEY(Unit->FirstEmpty(Indice),3); }
JUDY_SEARCH_ERROR_CATCH("Judy Error (Search failed) - Slave Search Function", *success);
}
#else
#error Must Have Search func: JUDY_SLAVE_FIRSTEMPTY_FUNC not defined!
#endif
#ifdef JUDY_SLAVE_NEXTEMPTY_FUNC
// generic_next(id, index,...)
static cell AMX_NATIVE_CALL JUDY_SLAVE_NEXTEMPTY_FUNC(AMX *amx,cell *params)
{
DTYPE* Unit = NULL;
JUDY_GET_INDEX(MNAME,Unit, params[1]);
ITYPE Indice = JUDY_GET_KEY(params,2);
cell* success = MF_GetAmxAddr(amx, params[3 + SE_OFFSET]);
*success = 1;
try { return JUDY_SET_KEY(Unit->NextEmpty(Indice),3); }
JUDY_SEARCH_ERROR_CATCH("Judy Error (Search failed) - Slave Search Function", *success);
}
#else
#error Must Have Search func: JUDY_SLAVE_NEXTEMPTY_FUNC not defined!
#endif
#ifdef JUDY_SLAVE_PREVEMPTY_FUNC
// generic_prev(id, index,...)
static cell AMX_NATIVE_CALL JUDY_SLAVE_PREVEMPTY_FUNC(AMX *amx,cell *params)
{
DTYPE* Unit = NULL;
JUDY_GET_INDEX(MNAME,Unit, params[1]);
ITYPE Indice = JUDY_GET_KEY(params,2);
cell* success = MF_GetAmxAddr(amx, params[3 + SE_OFFSET]);
*success = 1;
try { return JUDY_SET_KEY(Unit->PrevEmpty(Indice),3); }
JUDY_SEARCH_ERROR_CATCH("Judy Error (Search failed) - Slave Search Function", *success);
}
#else
#error Must Have Search func: JUDY_SLAVE_PREVEMPTY_FUNC not defined!
#endif
#ifdef JUDY_SLAVE_LASTEMPTY_FUNC
// generic_first(id, index,...)
static cell AMX_NATIVE_CALL JUDY_SLAVE_LASTEMPTY_FUNC(AMX *amx,cell *params)
{
DTYPE* Unit = NULL;
JUDY_GET_INDEX(MNAME,Unit, params[1]);
ITYPE Indice = JUDY_GET_KEY(params,2);
cell* success = MF_GetAmxAddr(amx, params[3 + SE_OFFSET]);
*success = 1;
try { return JUDY_SET_KEY(Unit->LastEmpty(Indice),3); }
JUDY_SEARCH_ERROR_CATCH("Judy Error (Search failed) - Slave Search Function",*success);
}
#else
#error Must Have Search func: JUDY_SLAVE_LASTEMPTY_FUNC not defined!
#endif
///* End Slave Search Empty Funcs *///
#endif
AMX_NATIVE_INFO EXPORT_NAME[] =
{
#ifdef JUDY_MASTER_EDIT_FUNCTIONS
{ JUDY_MASTER_CLEAR_STR , JUDY_MASTER_CLEAR_FUNC },
{ JUDY_MASTER_DELETE_STR , JUDY_MASTER_DELETE_FUNC },
#endif
#ifdef JUDY_MASTER_IO_FUNCTIONS
{ JUDY_MASTER_SAVE_STR , JUDY_MASTER_SAVE_FUNC },
{ JUDY_MASTER_LOAD_STR , JUDY_MASTER_LOAD_FUNC },
#endif
#ifdef JUDY_MASTER_AMOUNT_FUNCTIONS
{ JUDY_MASTER_COUNT_STR , JUDY_MASTER_COUNT_FUNC },
{ JUDY_MASTER_BYCOUNT_STR , JUDY_MASTER_BYCOUNT_FUNC },
#endif
#ifdef JUDY_SLAVE_AMOUNT_FUNCTIONS
{ JUDY_SLAVE_COUNT_STR , JUDY_SLAVE_COUNT_FUNC },
{ JUDY_SLAVE_BYCOUNT_STR , JUDY_SLAVE_BYCOUNT_FUNC },
#endif
#ifdef JUDY_SLAVE_EDIT_FUNCTIONS
{ JUDY_SLAVE_MEMORY_STR , JUDY_SLAVE_MEMORY_FUNC },
{ JUDY_SLAVE_ISFILLED_STR , JUDY_SLAVE_ISFILLED_FUNC },
{ JUDY_SLAVE_ISEMPTY_STR , JUDY_SLAVE_ISEMPTY_FUNC },
{ JUDY_SLAVE_REMOVE_STR , JUDY_SLAVE_REMOVE_FUNC },
#ifdef JUDY_SLAVE_EDIT_BOOL
{ JUDY_SLAVE_GET_BOOL_STR , JUDY_SLAVE_GET_BOOL_FUNC },
{ JUDY_SLAVE_SET_BOOL_STR , JUDY_SLAVE_SET_BOOL_FUNC },
#endif
#ifdef JUDY_SLAVE_EDIT_INT
{ JUDY_SLAVE_GET_INT_STR , JUDY_SLAVE_GET_INT_FUNC },
{ JUDY_SLAVE_SET_INT_STR , JUDY_SLAVE_SET_INT_FUNC },
#endif
#ifdef JUDY_SLAVE_EDIT_FLO
{ JUDY_SLAVE_GET_FLO_STR , JUDY_SLAVE_GET_FLO_FUNC },
{ JUDY_SLAVE_SET_FLO_STR , JUDY_SLAVE_SET_FLO_FUNC },
#endif
#ifdef JUDY_SLAVE_EDIT_STR
{ JUDY_SLAVE_GET_STR_STR , JUDY_SLAVE_GET_STR_FUNC },
{ JUDY_SLAVE_SET_STR_STR , JUDY_SLAVE_SET_STR_FUNC },
#endif
#ifdef JUDY_SLAVE_EDIT_VEC
{ JUDY_SLAVE_GET_VEC_STR , JUDY_SLAVE_GET_VEC_FUNC },
{ JUDY_SLAVE_SET_VEC_STR , JUDY_SLAVE_SET_VEC_FUNC },
#endif
// End all edit functions
#endif
#ifdef JUDY_SLAVE_SEARCH_FUNCTIONS
{ JUDY_SLAVE_FIRST_STR , JUDY_SLAVE_FIRST_FUNC },
{ JUDY_SLAVE_LAST_STR , JUDY_SLAVE_LAST_FUNC },
{ JUDY_SLAVE_NEXT_STR , JUDY_SLAVE_NEXT_FUNC },
{ JUDY_SLAVE_PREV_STR , JUDY_SLAVE_PREV_FUNC },
#endif
#ifdef JUDY_SLAVE_SEARCH_EMPTY_FUNCTIONS
{ JUDY_SLAVE_FIRSTEMPTY_STR , JUDY_SLAVE_FIRSTEMPTY_FUNC },
{ JUDY_SLAVE_LASTEMPTY_STR , JUDY_SLAVE_LASTEMPTY_FUNC },
{ JUDY_SLAVE_NEXTEMPTY_STR , JUDY_SLAVE_NEXTEMPTY_FUNC },
{ JUDY_SLAVE_PREVEMPTY_STR , JUDY_SLAVE_PREVEMPTY_FUNC },
#endif
{ NULL, NULL }
};
#endif

742
dlls/arrayx/Judy.h Normal file
View 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 */

BIN
dlls/arrayx/Judy.lib Normal file

Binary file not shown.

50
dlls/arrayx/JudyEx.h Normal file
View File

@ -0,0 +1,50 @@
#ifndef _JUDYEX_INCLUDED
#define _JUDYEX_INCLUDED
#include <exception>
class JudyEx
{
private:
char* ex_message;
bool fatal;
public:
JudyEx() { ex_message = NULL; fatal = true; }
JudyEx(char* set, bool isfatal)
{
ex_message = new char[strlen(set) + 1];
strcpy(ex_message, set);
fatal = isfatal;
}
JudyEx(const JudyEx &copy)
{
ex_message = new char[strlen(copy.ex_message) + 1];
strcpy(ex_message, copy.ex_message);
fatal = copy.fatal;
}
~JudyEx() { delete ex_message; }
void Destroy() { delete ex_message; }
void SetIsFatal(bool isfatal) { fatal = isfatal; }
bool IsFatal( void ) { return fatal; }
char* SetErrorMessage(char* set)
{
ex_message = new char[strlen(set) + 1];
strcpy(ex_message, set);
}
char* ErrorMessage( void )
{
return ex_message;
}
};
#endif

225
dlls/arrayx/JudyExtra.cpp Normal file
View File

@ -0,0 +1,225 @@
#include "JudyExtra.h"
bool JudyClearBinTrie(BinTrie* trie)
{
Word_t trie_iten = 0;
try { trie_iten = trie->First(); }
catch(JudyEx& e) { return false; }
while( true )
{
trie->Delete(trie_iten);
try { trie_iten = trie->Next(trie_iten); }
catch(JudyEx& e) { break; }
}
return true;
};
bool JudySaveBinTrie(BinTrie* trie, char* file)
{
Word_t trie_iten = 0;
try { trie_iten = trie->First(); }
catch(JudyEx e) { return false; }
FILE *trieDB = fopen(file,"wb");
if (!trieDB) return false;
bool value = false;
while( true )
{
fwrite(&trie_iten, sizeof(Word_t), 1, trieDB);
value = (trie->Get(trie_iten) != NULL);
fwrite(&value, sizeof(bool), 1, trieDB);
try { trie_iten = trie->Next(trie_iten); }
catch(JudyEx& e) { break; }
}
fclose(trieDB);
return true;
};
bool JudyLoadBinTrie(BinTrie* trie, char* file)
{
FILE *trieDB = fopen(file, "ab+");
if (!trieDB) return false;
Word_t trie_iten = 0;
bool value = false;
while(!feof(trieDB))
{
fread(&trie_iten, sizeof(Word_t), 1, trieDB);
if (feof(trieDB) || ferror(trieDB)) break;
fread(&value, sizeof(bool), 1, trieDB);
trie->Set(trie_iten,value);
}
fclose(trieDB);
return true;
}
bool JudyClearList(CBaseList* list)
{
Word_t list_iten = 0;
try { list_iten = list->First(); }
catch(JudyEx& e) { return false; }
while( true )
{
try { list->Delete(list_iten); }
catch(JudyEx& e) { break; }
try { list_iten = list->Next(list_iten); }
catch(JudyEx& e) { break; }
}
return true;
};
bool JudySaveList(CBaseList* list, char* file)
{
Capsule* Storage = NULL;
Word_t list_iten = 0;
bool no_error = true;
try { list_iten = list->First(); }
catch(JudyEx e) { return false; }
FILE* listDB = fopen(file,"wb");
if (!listDB) return false;
while( true )
{
try { Storage = reinterpret_cast<Capsule*>(list->Get(list_iten) ); }
catch(JudyEx& e) { no_error = false; break; }
fwrite(&list_iten, sizeof(Word_t), 1, listDB);
try { Storage->Save(listDB); }
catch(JudyEx& e) { no_error = false; break; }
try { list_iten = list->Next(list_iten); }
catch(JudyEx& e) { break; }
}
fclose(listDB);
return no_error;
};
bool JudyLoadList(CBaseList* list, char* file)
{
FILE *listDB = fopen(file, "ab+");
if (!listDB) return false;
Capsule* Storage = NULL;
Word_t list_iten = 0;
bool no_error = true;
while(!feof(listDB))
{
fread(&list_iten, sizeof(Word_t), 1, listDB);
if (feof(listDB) || ferror(listDB)) break;
Storage = new Capsule;
try { Storage->Load(listDB); }
catch(JudyEx& e) { no_error = false; break; }
list->Set(list_iten,Storage);
}
fclose(listDB);
return no_error;
}
bool JudyClearMap(CBaseMap* map)
{
char* map_iten = NULL;
try { map_iten = map->First(); }
catch(JudyEx& e) { return false; }
while( true )
{
try { map->Delete(map_iten); }
catch(JudyEx& e) { return false; }
try { map_iten = map->Next(map_iten); }
catch(JudyEx& e) { break; }
}
return true;
};
bool JudySaveMap(CBaseMap* map, char* file)
{
Capsule* Storage = NULL;
char* map_iten = NULL;
size_t key_len = 0;
bool no_error = true;
try { map_iten = map->First(); }
catch(JudyEx& e) { return false; }
FILE *mapDB = fopen(file,"wb");
if (!mapDB) return false;
while( true )
{
try { Storage = reinterpret_cast<Capsule*>(map->Get(map_iten) ); }
catch(JudyEx& e) { return false; }
key_len = strlen(map_iten);
fwrite(&key_len, sizeof(size_t), 1, mapDB);
fwrite(&map_iten, sizeof(char), strlen(map_iten), mapDB);
try { Storage->Save(mapDB); }
catch(JudyEx& e) { no_error = false; break; }
try { map_iten = map->Next(map_iten); }
catch(JudyEx& e) { break; }
}
fclose(mapDB);
return no_error;
};
bool JudyLoadMap(CBaseMap* map, char* file)
{
FILE *mapDB = fopen(file, "ab+");
if (!mapDB) return false;
Capsule* Storage = NULL;
char* map_iten = NULL;
size_t key_len = 0;
bool no_error = true;
while(!feof(mapDB))
{
fread(&key_len,sizeof(size_t),1,mapDB);
map_iten = new char[key_len+1];
fgets(map_iten, key_len+1, mapDB);
if (feof(mapDB) || ferror(mapDB)) break;
Storage = new Capsule;
try { Storage->Load(mapDB); }
catch(JudyEx& e) { no_error = false; break; }
map->Set(map_iten,Storage);
delete map_iten;
}
fclose(mapDB);
return no_error;
}

20
dlls/arrayx/JudyExtra.h Normal file
View File

@ -0,0 +1,20 @@
#ifndef _JUDYARRAY_SHARED_INCLUDED
#define _JUDYARRAY_SHARED_INCLUDED
#include "CBinTrie.h"
#include "CBaseList.h"
#include "CBaseMap.h"
extern bool JudyClearBinTrie(BinTrie* trie);
extern bool JudySaveBinTrie(BinTrie* trie, char* file);
extern bool JudyLoadBinTrie(BinTrie* trie, char* file);
extern bool JudyClearList(CBaseList* list);
extern bool JudySaveList(CBaseList* list, char* file);
extern bool JudyLoadList(CBaseList* list, char* file);
extern bool JudyClearMap(CBaseMap* map);
extern bool JudySaveMap(CBaseMap* array, char* file);
extern bool JudyLoadMap(CBaseMap* array, char* file);
#endif

View File

@ -0,0 +1,43 @@
#ifndef _JUDYINC_INCLUDED
#define _JUDYINC_INCLUDED
#include "osdefs.h"
//#include <extdll.h>
#ifndef __linux__
#define JU_WIN
#endif
#ifdef __WIN32__
#define JU_WIN
#endif
#define JUDYERROR_NOTEST 1
#include "Judy.h"
#ifdef __GNUC__
#include <sys/types.h>
#include <sys/stat.h>
#include <dirent.h>
#endif
#ifdef __linux__
#include <unistd.h>
#else
#define WINDOWS_LEAN_AND_MEAN
#include <windows.h>
#include <io.h>
#endif
#include <stdio.h>
#include <string.h>
#include "amxxmodule.h"
#include "JudyVar.h"
#include "JudyVec.h"
#include "JudyEx.h"
#include "Capsule.h"
#endif

70
dlls/arrayx/JudyVar.h Normal file
View File

@ -0,0 +1,70 @@
#ifndef _JUDYVAR_H
#define _JUDYVAR_H
#if defined HAVE_STDINT_H
//#include <stdint.h>
#else
#if defined __LCC__ || defined __DMC__ || defined LINUX
#if defined HAVE_INTTYPES_H
#include <inttypes.h>
#else
#include <stdint.h>
#endif
#elif !defined __STDC_VERSION__ || __STDC_VERSION__ < 199901L
/* The ISO C99 defines the int16_t and int_32t types. If the compiler got
* here, these types are probably undefined.
*/
#if defined __MACH__
#include <ppc/types.h>
typedef unsigned short int uint16_t;
typedef unsigned long int uint32_t;
#elif defined __FreeBSD__
#include <inttypes.h>
#else
typedef short int int16_t;
typedef unsigned short int uint16_t;
#if defined SN_TARGET_PS2
typedef int int32_t;
typedef unsigned int uint32_t;
#else
typedef long int int32_t;
typedef unsigned long int uint32_t;
#endif
#if defined __WIN32__ || defined _WIN32 || defined WIN32
typedef __int64 int64_t;
typedef unsigned __int64 uint64_t;
#define HAVE_I64
#elif defined __GNUC__
typedef long long int64_t;
typedef unsigned long long uint64_t;
#define HAVE_I64
#endif
#endif
#endif
#endif
#if defined _LP64 || defined WIN64 || defined _WIN64
#if !defined __64BIT__
#define __64BIT__
#endif
#endif
#if !defined PAWN_CELL_SIZE
#define PAWN_CELL_SIZE 32 /* by default, use 32-bit cells */
#endif
#if PAWN_CELL_SIZE==16
typedef uint16_t ucell;
typedef int16_t cell;
#elif PAWN_CELL_SIZE==32
typedef uint32_t ucell;
typedef int32_t cell;
#define REAL float
#elif PAWN_CELL_SIZE==64
typedef uint64_t ucell;
typedef int64_t cell;
#define REAL double
#else
#error Unsupported cell size (PAWN_CELL_SIZE)
#endif
#endif

20
dlls/arrayx/JudyVec.h Normal file
View File

@ -0,0 +1,20 @@
#ifndef _JUDYVEC_INCLUDED
#define _JUDYVEC_INCLUDED
#include "JudyIncludes.h"
class JudyVec
{
public:
REAL first;
REAL second;
REAL third;
JudyVec(REAL one, REAL two, REAL three) { Set(one, two, three); }
~JudyVec() {}
void Get(REAL& one, REAL& two, REAL& three) { one = first; two = second; three = third; }
void Set(REAL one, REAL two, REAL three) { first = one; second = two; third = three; }
};
#endif

View File

@ -0,0 +1,114 @@
#ifndef _LIST_NATIVE_FUNC_INC_H
#define _LIST_NATIVE_FUNC_INC_H
#define JUDY_GLUE_FUNC( x , y ) x ## y
#define JUDY_GLUE_STR( x, y ) #x#y
#define JUDY_MASTER_EDIT_FUNCTIONS
#define JUDY_MASTER_CLEAR_FUNC JUDY_GLUE_FUNC( list , _clear )
#define JUDY_MASTER_CLEAR_STR JUDY_GLUE_STR ( list , _clear )
#define JUDY_MASTER_DELETE_FUNC JUDY_GLUE_FUNC( list , _delete )
#define JUDY_MASTER_DELETE_STR JUDY_GLUE_STR ( list , _delete )
#define JUDY_MASTER_IO_FUNCTIONS
#define JUDY_MASTER_SAVE_FUNC JUDY_GLUE_FUNC( list , _save )
#define JUDY_MASTER_SAVE_STR JUDY_GLUE_STR ( list , _save )
#define JUDY_SAVE_FUNC(list, file) JudySaveList ( list , file )
#define JUDY_MASTER_LOAD_FUNC JUDY_GLUE_FUNC( list , _load )
#define JUDY_MASTER_LOAD_STR JUDY_GLUE_STR ( list , _load )
#define JUDY_LOAD_FUNC(list, file) JudyLoadList ( list , file )
#define JUDY_MASTER_AMOUNT_FUNCTIONS
#define JUDY_MASTER_COUNT_FUNC JUDY_GLUE_FUNC( list , _count )
#define JUDY_MASTER_COUNT_STR JUDY_GLUE_STR ( list , _count )
#define JUDY_MASTER_BYCOUNT_FUNC JUDY_GLUE_FUNC( list , _bycount )
#define JUDY_MASTER_BYCOUNT_STR JUDY_GLUE_STR ( list , _bycount )
#define JUDY_SLAVE_AMOUNT_FUNCTIONS
#define JUDY_SLAVE_COUNT_FUNC JUDY_GLUE_FUNC( list , _size )
#define JUDY_SLAVE_COUNT_STR JUDY_GLUE_STR ( list , _size )
#define JUDY_SLAVE_BYCOUNT_FUNC JUDY_GLUE_FUNC( list , _get_nth )
#define JUDY_SLAVE_BYCOUNT_STR JUDY_GLUE_STR ( list , _get_nth )
#define JUDY_SLAVE_EDIT_FUNCTIONS
#define JUDY_SLAVE_MEMORY_FUNC JUDY_GLUE_FUNC( list , _memory )
#define JUDY_SLAVE_MEMORY_STR JUDY_GLUE_STR ( list , _memory )
#define JUDY_SLAVE_ISFILLED_FUNC JUDY_GLUE_FUNC( list , _isfilled )
#define JUDY_SLAVE_ISFILLED_STR JUDY_GLUE_STR ( list , _isfilled )
#define JUDY_SLAVE_ISEMPTY_FUNC JUDY_GLUE_FUNC( list , _isempty )
#define JUDY_SLAVE_ISEMPTY_STR JUDY_GLUE_STR ( list , _isempty )
#define JUDY_SLAVE_REMOVE_FUNC JUDY_GLUE_FUNC( list , _remove )
#define JUDY_SLAVE_REMOVE_STR JUDY_GLUE_STR ( list , _remove )
#define JUDY_SLAVE_EDIT_BOOL
#define JUDY_SLAVE_GET_BOOL_FUNC JUDY_GLUE_FUNC( list , _get_bool )
#define JUDY_SLAVE_SET_BOOL_FUNC JUDY_GLUE_FUNC( list , _set_bool )
#define JUDY_SLAVE_GET_BOOL_STR JUDY_GLUE_STR ( list , _get_bool )
#define JUDY_SLAVE_SET_BOOL_STR JUDY_GLUE_STR ( list , _set_bool )
#define JUDY_SLAVE_EDIT_INT
#define JUDY_SLAVE_GET_INT_FUNC JUDY_GLUE_FUNC( list , _get_int )
#define JUDY_SLAVE_SET_INT_FUNC JUDY_GLUE_FUNC( list , _set_int )
#define JUDY_SLAVE_GET_INT_STR JUDY_GLUE_STR ( list , _get_int )
#define JUDY_SLAVE_SET_INT_STR JUDY_GLUE_STR ( list , _set_int )
#define JUDY_SLAVE_EDIT_FLO
#define JUDY_SLAVE_GET_FLO_FUNC JUDY_GLUE_FUNC( list , _get_float )
#define JUDY_SLAVE_SET_FLO_FUNC JUDY_GLUE_FUNC( list , _set_float )
#define JUDY_SLAVE_GET_FLO_STR JUDY_GLUE_STR ( list , _get_float )
#define JUDY_SLAVE_SET_FLO_STR JUDY_GLUE_STR ( list , _set_float )
#define JUDY_SLAVE_EDIT_STR
#define JUDY_SLAVE_GET_STR_FUNC JUDY_GLUE_FUNC( list , _get_string )
#define JUDY_SLAVE_SET_STR_FUNC JUDY_GLUE_FUNC( list , _set_string )
#define JUDY_SLAVE_GET_STR_STR JUDY_GLUE_STR ( list , _get_string )
#define JUDY_SLAVE_SET_STR_STR JUDY_GLUE_STR ( list , _set_string )
#define JUDY_SLAVE_EDIT_VEC
#define JUDY_SLAVE_GET_VEC_FUNC JUDY_GLUE_FUNC( list , _get_vector )
#define JUDY_SLAVE_SET_VEC_FUNC JUDY_GLUE_FUNC( list , _set_vector )
#define JUDY_SLAVE_GET_VEC_STR JUDY_GLUE_STR ( list , _get_vector )
#define JUDY_SLAVE_SET_VEC_STR JUDY_GLUE_STR ( list , _set_vector )
#define JUDY_SLAVE_SEARCH_FUNCTIONS
#define JUDY_SLAVE_FIRST_FUNC JUDY_GLUE_FUNC( list , _first )
#define JUDY_SLAVE_LAST_FUNC JUDY_GLUE_FUNC( list , _last )
#define JUDY_SLAVE_FIRST_STR JUDY_GLUE_STR ( list , _first )
#define JUDY_SLAVE_LAST_STR JUDY_GLUE_STR ( list , _last )
#define JUDY_SLAVE_NEXT_FUNC JUDY_GLUE_FUNC( list , _next )
#define JUDY_SLAVE_PREV_FUNC JUDY_GLUE_FUNC( list , _prev )
#define JUDY_SLAVE_NEXT_STR JUDY_GLUE_STR ( list , _next )
#define JUDY_SLAVE_PREV_STR JUDY_GLUE_STR ( list , _prev )
#define JUDY_SLAVE_SEARCH_EMPTY_FUNCTIONS
#define JUDY_SLAVE_FIRSTEMPTY_FUNC JUDY_GLUE_FUNC( list , _firstempty )
#define JUDY_SLAVE_LASTEMPTY_FUNC JUDY_GLUE_FUNC( list , _lastempty )
#define JUDY_SLAVE_FIRSTEMPTY_STR JUDY_GLUE_STR ( list , _firstempty )
#define JUDY_SLAVE_LASTEMPTY_STR JUDY_GLUE_STR ( list , _lastempty )
#define JUDY_SLAVE_NEXTEMPTY_FUNC JUDY_GLUE_FUNC( list , _nextempty )
#define JUDY_SLAVE_PREVEMPTY_FUNC JUDY_GLUE_FUNC( list , _prevempty )
#define JUDY_SLAVE_NEXTEMPTY_STR JUDY_GLUE_STR ( list , _nextempty )
#define JUDY_SLAVE_PREVEMPTY_STR JUDY_GLUE_STR ( list , _prevempty )
#endif

View File

@ -0,0 +1,43 @@
#include "CBaseList.h"
#include "CArray.h"
#include "ComboArray.h"
#define KEY_TYPE cell
#define DYNAMIC_UNIT_TYPE CBaseList
#define STORAGE_TYPE Capsule
#define MASTER_NAME MasterList
#define EXPORT_NAME list_exports
#define SEARCH_ERROR_OFFSET 0
#define GET_KEY(params, num) params[num]
#define SET_KEY(stuff, parameter) stuff
#include "ListNativeFunctions.h"
#include "NativeIncludes.h"
static cell AMX_NATIVE_CALL array_create(AMX *amx,cell *params)
{
DTYPE* Unit;
M_ITYPE Index = params[1];
JUDY_CREATE_INDEX(MNAME,Unit,Array,Index);
return Index;
}
static cell AMX_NATIVE_CALL comboarray_create(AMX *amx,cell *params)
{
DTYPE* Unit;
M_ITYPE Index = params[1];
JUDY_CREATE_INDEX(MNAME,Unit,ComboArray,Index);
return Index;
}
AMX_NATIVE_INFO list_creation_exports[] =
{
{ "array_create", array_create },
{ "comboarray_create", comboarray_create },
{ NULL, NULL }
};

View File

@ -0,0 +1,94 @@
#ifndef _MAP_NATIVE_FUNC_INC_H
#define _MAP_NATIVE_FUNC_INC_H
#define JUDY_GLUE_FUNC( x , y ) x ## y
#define JUDY_GLUE_STR( x, y ) #x#y
#define JUDY_MASTER_EDIT_FUNCTIONS
#define JUDY_MASTER_CLEAR_FUNC JUDY_GLUE_FUNC( map , _clear )
#define JUDY_MASTER_CLEAR_STR JUDY_GLUE_STR ( map , _clear )
#define JUDY_MASTER_DELETE_FUNC JUDY_GLUE_FUNC( map , _delete )
#define JUDY_MASTER_DELETE_STR JUDY_GLUE_STR ( map , _delete )
#define JUDY_MASTER_IO_FUNCTIONS
#define JUDY_MASTER_SAVE_FUNC JUDY_GLUE_FUNC( map , _save )
#define JUDY_MASTER_SAVE_STR JUDY_GLUE_STR ( map , _save )
#define JUDY_SAVE_FUNC(map, file) JudySaveMap ( map , file )
#define JUDY_MASTER_LOAD_FUNC JUDY_GLUE_FUNC( map , _load )
#define JUDY_MASTER_LOAD_STR JUDY_GLUE_STR ( map , _load )
#define JUDY_LOAD_FUNC(map, file) JudyLoadMap ( map , file )
#define JUDY_MASTER_AMOUNT_FUNCTIONS
#define JUDY_MASTER_COUNT_FUNC JUDY_GLUE_FUNC( map , _count )
#define JUDY_MASTER_COUNT_STR JUDY_GLUE_STR ( map , _count )
#define JUDY_MASTER_BYCOUNT_FUNC JUDY_GLUE_FUNC( map , _bycount )
#define JUDY_MASTER_BYCOUNT_STR JUDY_GLUE_STR ( map , _bycount )
#define JUDY_SLAVE_EDIT_FUNCTIONS
#define JUDY_SLAVE_MEMORY_FUNC JUDY_GLUE_FUNC( map , _memory )
#define JUDY_SLAVE_MEMORY_STR JUDY_GLUE_STR ( map , _memory )
#define JUDY_SLAVE_ISFILLED_FUNC JUDY_GLUE_FUNC( map , _isfilled )
#define JUDY_SLAVE_ISFILLED_STR JUDY_GLUE_STR ( map , _isfilled )
#define JUDY_SLAVE_ISEMPTY_FUNC JUDY_GLUE_FUNC( map , _isempty )
#define JUDY_SLAVE_ISEMPTY_STR JUDY_GLUE_STR ( map , _isempty )
#define JUDY_SLAVE_REMOVE_FUNC JUDY_GLUE_FUNC( map , _remove )
#define JUDY_SLAVE_REMOVE_STR JUDY_GLUE_STR ( map , _remove )
#define JUDY_SLAVE_EDIT_BOOL
#define JUDY_SLAVE_GET_BOOL_FUNC JUDY_GLUE_FUNC( map , _get_bool )
#define JUDY_SLAVE_SET_BOOL_FUNC JUDY_GLUE_FUNC( map , _set_bool )
#define JUDY_SLAVE_GET_BOOL_STR JUDY_GLUE_STR ( map , _get_bool )
#define JUDY_SLAVE_SET_BOOL_STR JUDY_GLUE_STR ( map , _set_bool )
#define JUDY_SLAVE_EDIT_INT
#define JUDY_SLAVE_GET_INT_FUNC JUDY_GLUE_FUNC( map , _get_int )
#define JUDY_SLAVE_SET_INT_FUNC JUDY_GLUE_FUNC( map , _set_int )
#define JUDY_SLAVE_GET_INT_STR JUDY_GLUE_STR ( map , _get_int )
#define JUDY_SLAVE_SET_INT_STR JUDY_GLUE_STR ( map , _set_int )
#define JUDY_SLAVE_EDIT_FLO
#define JUDY_SLAVE_GET_FLO_FUNC JUDY_GLUE_FUNC( map , _get_float )
#define JUDY_SLAVE_SET_FLO_FUNC JUDY_GLUE_FUNC( map , _set_float )
#define JUDY_SLAVE_GET_FLO_STR JUDY_GLUE_STR ( map , _get_float )
#define JUDY_SLAVE_SET_FLO_STR JUDY_GLUE_STR ( map , _set_float )
#define JUDY_SLAVE_EDIT_STR
#define JUDY_SLAVE_GET_STR_FUNC JUDY_GLUE_FUNC( map , _get_string )
#define JUDY_SLAVE_SET_STR_FUNC JUDY_GLUE_FUNC( map , _set_string )
#define JUDY_SLAVE_GET_STR_STR JUDY_GLUE_STR ( map , _get_string )
#define JUDY_SLAVE_SET_STR_STR JUDY_GLUE_STR ( map , _set_string )
#define JUDY_SLAVE_EDIT_VEC
#define JUDY_SLAVE_GET_VEC_FUNC JUDY_GLUE_FUNC( map , _get_vector )
#define JUDY_SLAVE_SET_VEC_FUNC JUDY_GLUE_FUNC( map , _set_vector )
#define JUDY_SLAVE_GET_VEC_STR JUDY_GLUE_STR ( map , _get_vector )
#define JUDY_SLAVE_SET_VEC_STR JUDY_GLUE_STR ( map , _set_vector )
#define JUDY_SLAVE_SEARCH_FUNCTIONS
#define JUDY_SLAVE_FIRST_FUNC JUDY_GLUE_FUNC( map , _first )
#define JUDY_SLAVE_LAST_FUNC JUDY_GLUE_FUNC( map , _last )
#define JUDY_SLAVE_FIRST_STR JUDY_GLUE_STR ( map , _first )
#define JUDY_SLAVE_LAST_STR JUDY_GLUE_STR ( map , _last )
#define JUDY_SLAVE_NEXT_FUNC JUDY_GLUE_FUNC( map , _next )
#define JUDY_SLAVE_PREV_FUNC JUDY_GLUE_FUNC( map , _prev )
#define JUDY_SLAVE_NEXT_STR JUDY_GLUE_STR ( map , _next )
#define JUDY_SLAVE_PREV_STR JUDY_GLUE_STR ( map , _prev )
#endif

View File

@ -0,0 +1,54 @@
#include "CBaseMap.h"
#include "CKeytable.h"
#include "ComboTable.h"
#include "CHashtable.h"
#define KEY_TYPE char*
#define DYNAMIC_UNIT_TYPE CBaseMap
#define STORAGE_TYPE Capsule
#define MASTER_NAME MasterMap
#define EXPORT_NAME map_exports
#define SEARCH_ERROR_OFFSET 2
#define GET_KEY(params, num) MF_GetAmxString(amx,params[num],num,NULL)
#define SET_KEY(str, num) MF_SetAmxString(amx,params[num],str,params[num + 1])
#include "MapNativeFunctions.h"
#include "NativeIncludes.h"
static cell AMX_NATIVE_CALL keytable_create(AMX *amx,cell *params)
{
DTYPE* Unit = NULL;
M_ITYPE Index = NULL;
JUDY_CREATE_INDEX(MNAME,Unit,Keytable,Index);
return Index;
}
static cell AMX_NATIVE_CALL combotable_create(AMX *amx,cell *params)
{
DTYPE* Unit = NULL;
M_ITYPE Index = NULL;
JUDY_CREATE_INDEX(MNAME,Unit,ComboTable,Index);
return Index;
}
static cell AMX_NATIVE_CALL hashtable_create(AMX *amx,cell *params)
{
DTYPE* Unit;
M_ITYPE Index = params[1];
JUDY_CREATE_INDEX(MNAME,Unit,Hashtable,Index);
return Index;
}
AMX_NATIVE_INFO map_creation_exports[] =
{
{ "keytable_create", keytable_create },
{ "combotable_create", combotable_create },
{ "hashtable_create", hashtable_create },
{ NULL, NULL }
};

View File

@ -0,0 +1,130 @@
#ifndef _NATIVE_INC_H
#define _NATIVE_INC_H
#include "ComboArray.h"
#ifndef SEARCH_ERROR_OFFSET
#define SEARCH_ERROR_OFFSET 0
#endif
#define SE_OFFSET SEARCH_ERROR_OFFSET
#ifndef STORAGE_TYPE
#error No storage type declared
#endif
#define STYPE STORAGE_TYPE
#ifndef KEY_TYPE
#error No key type declared
#endif
#define ITYPE KEY_TYPE
#ifndef DYNAMIC_UNIT_TYPE
#error No Dynamic type declared
#endif
#define DTYPE DYNAMIC_UNIT_TYPE
#ifndef MASTER_NAME
#error No master name declared
#endif
#define MNAME MASTER_NAME
#define M_ITYPE cell
#ifndef GET_KEY
#error No method of getting keys has been declared
#endif
#ifndef EXPORT_NAME
#define EXPORT_NAME MNAME_exports
#endif
#define SE_OFFSET SEARCH_ERROR_OFFSET
#define JUDY_GET_KEY GET_KEY
#ifndef SET_KEY
#error No method of setting keys has been declared
#endif
#define JUDY_SET_KEY SET_KEY
#ifndef JUDY_ERROR_CATCH
#define JUDY_ERROR_CATCH(x_str) \
catch(JudyEx& e) \
{ \
if(e.IsFatal() )\
{\
MF_LogError(amx,AMX_ERR_NATIVE, "%s || Judy Error: %s", x_str, e.ErrorMessage());\
return NULL;\
};\
return NULL;\
}\
catch(...) { MF_LogError(amx,AMX_ERR_NATIVE,"Unknown error occured, please post a bug report at www.amxmodx.org/forums"); return NULL; }
#endif
#ifndef JUDY_SEARCH_ERROR_CATCH
#define JUDY_SEARCH_ERROR_CATCH(x_str, success) \
catch(JudyEx& e) \
{ \
if(e.IsFatal() )\
{\
MF_LogError(amx,AMX_ERR_NATIVE, "%s || Judy Error: %s", x_str, e.ErrorMessage());\
return NULL;\
};\
return (success = 0);\
}\
catch(...) { MF_LogError(amx,AMX_ERR_NATIVE,"Unknown error occured, please post a bug report at www.amxmodx.org/forums"); return NULL; }
#endif
#ifndef JUDY_CREATE_INDEX
#define JUDY_CREATE_INDEX(master, slave, slave_type, index)\
\
if( index == NULL )\
{\
try { index = master.FirstEmpty(); }\
JUDY_ERROR_CATCH("Unable to create new unit (out of memory)");\
\
slave = new slave_type;\
master.Set(index,slave);\
} \
else if(master.IsEmpty(index) )\
{\
slave = new slave_type;\
master.Set(index,slave);\
}\
else slave = master.Get(index, slave );
#endif
#ifndef JUDY_GET_INDEX
#define JUDY_GET_INDEX(master,slave, where) \
try { slave = master.Get(where,slave); } \
JUDY_ERROR_CATCH("Unable to access old unit (invalid index)");
#endif
#ifndef JUDY_SET_INDEX
#define JUDY_SET_INDEX(master,slave, where) \
try { master.Set(where,slave); } \
JUDY_ERROR_CATCH("Unknown Error occured (No error possible) - Set Function");\
return 1;
#endif
#ifndef JUDY_SET_INDEX_P
#define JUDY_SET_INDEX_P(master,slave, where) \
try { master->Set(where,slave); } \
JUDY_ERROR_CATCH("Unknown Error occured (No error possible) - Set Function");\
return 1;
#endif
inline char* JUDY_BUILD_PATH(AMX *amx, cell param, int buffer = 0)
{
char *file = MF_GetAmxString(amx, param, 0, NULL);
return MF_BuildPathname("%s", file);
}
#include "GenericNatives.h"
#endif

3078
dlls/arrayx/amxxmodule.cpp Normal file

File diff suppressed because it is too large Load Diff

2241
dlls/arrayx/amxxmodule.h Normal file

File diff suppressed because it is too large Load Diff

463
dlls/arrayx/moduleconfig.h Normal file
View File

@ -0,0 +1,463 @@
// Configuration
#ifndef __MODULECONFIG_H__
#define __MODULECONFIG_H__
// Module info
#define MODULE_NAME "Array"
#define MODULE_VERSION "1.7"
#define MODULE_AUTHOR "Twilight Suzuka"
#define MODULE_URL "www.amxmodx.org"
#define MODULE_LOGTAG "ARRAY"
// If you want the module not to be reloaded on mapchange, remove / comment out the next line
#define MODULE_RELOAD_ON_MAPCHANGE
#ifdef __DATE__
#define MODULE_DATE __DATE__
#else // __DATE__
#define MODULE_DATE "Unknown"
#endif // __DATE__
// metamod plugin?
//#define USE_METAMOD
// - AMXX Init functions
// Also consider using FN_META_*
// AMXX query
//#define FN_AMXX_QUERY OnAmxxQuery
// AMXX attach
// Do native functions init here (MF_AddNatives)
#define FN_AMXX_ATTACH OnAmxxAttach
// AMXX dettach
#define FN_AMXX_DETTACH OnAmxxDettach
// All plugins loaded
// Do forward functions init here (MF_RegisterForward)
// #define FN_AMXX_PLUGINSLOADED OnPluginsLoaded
/**** METAMOD ****/
// If your module doesn't use metamod, you may close the file now :)
#ifdef USE_METAMOD
// ----
// Hook Functions
// Uncomment these to be called
// You can also change the function name
// - Metamod init functions
// Also consider using FN_AMXX_*
// Meta query
//#define FN_META_QUERY OnMetaQuery
// Meta attach
//#define FN_META_ATTACH OnMetaAttach
// Meta dettach
//#define FN_META_DETTACH OnMetaDettach
// (wd) are Will Day's notes
// - GetEntityAPI2 functions
// #define FN_GameDLLInit GameDLLInit /* pfnGameInit() */
// #define FN_DispatchSpawn DispatchSpawn /* pfnSpawn() */
// #define FN_DispatchThink DispatchThink /* pfnThink() */
// #define FN_DispatchUse DispatchUse /* pfnUse() */
// #define FN_DispatchTouch DispatchTouch /* pfnTouch() */
// #define FN_DispatchBlocked DispatchBlocked /* pfnBlocked() */
// #define FN_DispatchKeyValue DispatchKeyValue /* pfnKeyValue() */
// #define FN_DispatchSave DispatchSave /* pfnSave() */
// #define FN_DispatchRestore DispatchRestore /* pfnRestore() */
// #define FN_DispatchObjectCollsionBox DispatchObjectCollsionBox /* pfnSetAbsBox() */
// #define FN_SaveWriteFields SaveWriteFields /* pfnSaveWriteFields() */
// #define FN_SaveReadFields SaveReadFields /* pfnSaveReadFields() */
// #define FN_SaveGlobalState SaveGlobalState /* pfnSaveGlobalState() */
// #define FN_RestoreGlobalState RestoreGlobalState /* pfnRestoreGlobalState() */
// #define FN_ResetGlobalState ResetGlobalState /* pfnResetGlobalState() */
// #define FN_ClientConnect ClientConnect /* pfnClientConnect() (wd) Client has connected */
// #define FN_ClientDisconnect ClientDisconnect /* pfnClientDisconnect() (wd) Player has left the game */
// #define FN_ClientKill ClientKill /* pfnClientKill() (wd) Player has typed "kill" */
// #define FN_ClientPutInServer ClientPutInServer /* pfnClientPutInServer() (wd) Client is entering the game */
// #define FN_ClientCommand ClientCommand /* pfnClientCommand() (wd) Player has sent a command (typed or from a bind) */
// #define FN_ClientUserInfoChanged ClientUserInfoChanged /* pfnClientUserInfoChanged() (wd) Client has updated their setinfo structure */
// #define FN_ServerActivate ServerActivate /* pfnServerActivate() (wd) Server is starting a new map */
// #define FN_ServerDeactivate ServerDeactivate /* pfnServerDeactivate() (wd) Server is leaving the map (shutdown or changelevel); SDK2 */
// #define FN_PlayerPreThink PlayerPreThink /* pfnPlayerPreThink() */
// #define FN_PlayerPostThink PlayerPostThink /* pfnPlayerPostThink() */
// #define FN_StartFrame StartFrame /* pfnStartFrame() */
// #define FN_ParmsNewLevel ParmsNewLevel /* pfnParmsNewLevel() */
// #define FN_ParmsChangeLevel ParmsChangeLevel /* pfnParmsChangeLevel() */
// #define FN_GetGameDescription GetGameDescription /* pfnGetGameDescription() Returns string describing current .dll. E.g. "TeamFotrress 2" "Half-Life" */
// #define FN_PlayerCustomization PlayerCustomization /* pfnPlayerCustomization() Notifies .dll of new customization for player. */
// #define FN_SpectatorConnect SpectatorConnect /* pfnSpectatorConnect() Called when spectator joins server */
// #define FN_SpectatorDisconnect SpectatorDisconnect /* pfnSpectatorDisconnect() Called when spectator leaves the server */
// #define FN_SpectatorThink SpectatorThink /* pfnSpectatorThink() Called when spectator sends a command packet (usercmd_t) */
// #define FN_Sys_Error Sys_Error /* pfnSys_Error() Notify game .dll that engine is going to shut down. Allows mod authors to set a breakpoint. SDK2 */
// #define FN_PM_Move PM_Move /* pfnPM_Move() (wd) SDK2 */
// #define FN_PM_Init PM_Init /* pfnPM_Init() Server version of player movement initialization; (wd) SDK2 */
// #define FN_PM_FindTextureType PM_FindTextureType /* pfnPM_FindTextureType() (wd) SDK2 */
// #define FN_SetupVisibility SetupVisibility /* pfnSetupVisibility() Set up PVS and PAS for networking for this client; (wd) SDK2 */
// #define FN_UpdateClientData UpdateClientData /* pfnUpdateClientData() Set up data sent only to specific client; (wd) SDK2 */
// #define FN_AddToFullPack AddToFullPack /* pfnAddToFullPack() (wd) SDK2 */
// #define FN_CreateBaseline CreateBaseline /* pfnCreateBaseline() Tweak entity baseline for network encoding allows setup of player baselines too.; (wd) SDK2 */
// #define FN_RegisterEncoders RegisterEncoders /* pfnRegisterEncoders() Callbacks for network encoding; (wd) SDK2 */
// #define FN_GetWeaponData GetWeaponData /* pfnGetWeaponData() (wd) SDK2 */
// #define FN_CmdStart CmdStart /* pfnCmdStart() (wd) SDK2 */
// #define FN_CmdEnd CmdEnd /* pfnCmdEnd() (wd) SDK2 */
// #define FN_ConnectionlessPacket ConnectionlessPacket /* pfnConnectionlessPacket() (wd) SDK2 */
// #define FN_GetHullBounds GetHullBounds /* pfnGetHullBounds() (wd) SDK2 */
// #define FN_CreateInstancedBaselines CreateInstancedBaselines /* pfnCreateInstancedBaselines() (wd) SDK2 */
// #define FN_InconsistentFile InconsistentFile /* pfnInconsistentFile() (wd) SDK2 */
// #define FN_AllowLagCompensation AllowLagCompensation /* pfnAllowLagCompensation() (wd) SDK2 */
// - GetEntityAPI2_Post functions
// #define FN_GameDLLInit_Post GameDLLInit_Post
// #define FN_DispatchSpawn_Post DispatchSpawn_Post
// #define FN_DispatchThink_Post DispatchThink_Post
// #define FN_DispatchUse_Post DispatchUse_Post
// #define FN_DispatchTouch_Post DispatchTouch_Post
// #define FN_DispatchBlocked_Post DispatchBlocked_Post
// #define FN_DispatchKeyValue_Post DispatchKeyValue_Post
// #define FN_DispatchSave_Post DispatchSave_Post
// #define FN_DispatchRestore_Post DispatchRestore_Post
// #define FN_DispatchObjectCollsionBox_Post DispatchObjectCollsionBox_Post
// #define FN_SaveWriteFields_Post SaveWriteFields_Post
// #define FN_SaveReadFields_Post SaveReadFields_Post
// #define FN_SaveGlobalState_Post SaveGlobalState_Post
// #define FN_RestoreGlobalState_Post RestoreGlobalState_Post
// #define FN_ResetGlobalState_Post ResetGlobalState_Post
// #define FN_ClientConnect_Post ClientConnect_Post
// #define FN_ClientDisconnect_Post ClientDisconnect_Post
// #define FN_ClientKill_Post ClientKill_Post
// #define FN_ClientPutInServer_Post ClientPutInServer_Post
// #define FN_ClientCommand_Post ClientCommand_Post
// #define FN_ClientUserInfoChanged_Post ClientUserInfoChanged_Post
// #define FN_ServerActivate_Post ServerActivate_Post
// #define FN_ServerDeactivate_Post ServerDeactivate_Post
// #define FN_PlayerPreThink_Post PlayerPreThink_Post
// #define FN_PlayerPostThink_Post PlayerPostThink_Post
// #define FN_StartFrame_Post StartFrame_Post
// #define FN_ParmsNewLevel_Post ParmsNewLevel_Post
// #define FN_ParmsChangeLevel_Post ParmsChangeLevel_Post
// #define FN_GetGameDescription_Post GetGameDescription_Post
// #define FN_PlayerCustomization_Post PlayerCustomization_Post
// #define FN_SpectatorConnect_Post SpectatorConnect_Post
// #define FN_SpectatorDisconnect_Post SpectatorDisconnect_Post
// #define FN_SpectatorThink_Post SpectatorThink_Post
// #define FN_Sys_Error_Post Sys_Error_Post
// #define FN_PM_Move_Post PM_Move_Post
// #define FN_PM_Init_Post PM_Init_Post
// #define FN_PM_FindTextureType_Post PM_FindTextureType_Post
// #define FN_SetupVisibility_Post SetupVisibility_Post
// #define FN_UpdateClientData_Post UpdateClientData_Post
// #define FN_AddToFullPack_Post AddToFullPack_Post
// #define FN_CreateBaseline_Post CreateBaseline_Post
// #define FN_RegisterEncoders_Post RegisterEncoders_Post
// #define FN_GetWeaponData_Post GetWeaponData_Post
// #define FN_CmdStart_Post CmdStart_Post
// #define FN_CmdEnd_Post CmdEnd_Post
// #define FN_ConnectionlessPacket_Post ConnectionlessPacket_Post
// #define FN_GetHullBounds_Post GetHullBounds_Post
// #define FN_CreateInstancedBaselines_Post CreateInstancedBaselines_Post
// #define FN_InconsistentFile_Post InconsistentFile_Post
// #define FN_AllowLagCompensation_Post AllowLagCompensation_Post
// - GetEngineAPI functions
// #define FN_PrecacheModel PrecacheModel
// #define FN_PrecacheSound PrecacheSound
// #define FN_SetModel SetModel
// #define FN_ModelIndex ModelIndex
// #define FN_ModelFrames ModelFrames
// #define FN_SetSize SetSize
// #define FN_ChangeLevel ChangeLevel
// #define FN_GetSpawnParms GetSpawnParms
// #define FN_SaveSpawnParms SaveSpawnParms
// #define FN_VecToYaw VecToYaw
// #define FN_VecToAngles VecToAngles
// #define FN_MoveToOrigin MoveToOrigin
// #define FN_ChangeYaw ChangeYaw
// #define FN_ChangePitch ChangePitch
// #define FN_FindEntityByString FindEntityByString
// #define FN_GetEntityIllum GetEntityIllum
// #define FN_FindEntityInSphere FindEntityInSphere
// #define FN_FindClientInPVS FindClientInPVS
// #define FN_EntitiesInPVS EntitiesInPVS
// #define FN_MakeVectors MakeVectors
// #define FN_AngleVectors AngleVectors
// #define FN_CreateEntity CreateEntity
// #define FN_RemoveEntity RemoveEntity
// #define FN_CreateNamedEntity CreateNamedEntity
// #define FN_MakeStatic MakeStatic
// #define FN_EntIsOnFloor EntIsOnFloor
// #define FN_DropToFloor DropToFloor
// #define FN_WalkMove WalkMove
// #define FN_SetOrigin SetOrigin
// #define FN_EmitSound EmitSound
// #define FN_EmitAmbientSound EmitAmbientSound
// #define FN_TraceLine TraceLine
// #define FN_TraceToss TraceToss
// #define FN_TraceMonsterHull TraceMonsterHull
// #define FN_TraceHull TraceHull
// #define FN_TraceModel TraceModel
// #define FN_TraceTexture TraceTexture
// #define FN_TraceSphere TraceSphere
// #define FN_GetAimVector GetAimVector
// #define FN_ServerCommand ServerCommand
// #define FN_ServerExecute ServerExecute
// #define FN_engClientCommand engClientCommand
// #define FN_ParticleEffect ParticleEffect
// #define FN_LightStyle LightStyle
// #define FN_DecalIndex DecalIndex
// #define FN_PointContents PointContents
// #define FN_MessageBegin MessageBegin
// #define FN_MessageEnd MessageEnd
// #define FN_WriteByte WriteByte
// #define FN_WriteChar WriteChar
// #define FN_WriteShort WriteShort
// #define FN_WriteLong WriteLong
// #define FN_WriteAngle WriteAngle
// #define FN_WriteCoord WriteCoord
// #define FN_WriteString WriteString
// #define FN_WriteEntity WriteEntity
// #define FN_CVarRegister CVarRegister
// #define FN_CVarGetFloat CVarGetFloat
// #define FN_CVarGetString CVarGetString
// #define FN_CVarSetFloat CVarSetFloat
// #define FN_CVarSetString CVarSetString
// #define FN_AlertMessage AlertMessage
// #define FN_EngineFprintf EngineFprintf
// #define FN_PvAllocEntPrivateData PvAllocEntPrivateData
// #define FN_PvEntPrivateData PvEntPrivateData
// #define FN_FreeEntPrivateData FreeEntPrivateData
// #define FN_SzFromIndex SzFromIndex
// #define FN_AllocString AllocString
// #define FN_GetVarsOfEnt GetVarsOfEnt
// #define FN_PEntityOfEntOffset PEntityOfEntOffset
// #define FN_EntOffsetOfPEntity EntOffsetOfPEntity
// #define FN_IndexOfEdict IndexOfEdict
// #define FN_PEntityOfEntIndex PEntityOfEntIndex
// #define FN_FindEntityByVars FindEntityByVars
// #define FN_GetModelPtr GetModelPtr
// #define FN_RegUserMsg RegUserMsg
// #define FN_AnimationAutomove AnimationAutomove
// #define FN_GetBonePosition GetBonePosition
// #define FN_FunctionFromName FunctionFromName
// #define FN_NameForFunction NameForFunction
// #define FN_ClientPrintf ClientPrintf
// #define FN_ServerPrint ServerPrint
// #define FN_Cmd_Args Cmd_Args
// #define FN_Cmd_Argv Cmd_Argv
// #define FN_Cmd_Argc Cmd_Argc
// #define FN_GetAttachment GetAttachment
// #define FN_CRC32_Init CRC32_Init
// #define FN_CRC32_ProcessBuffer CRC32_ProcessBuffer
// #define FN_CRC32_ProcessByte CRC32_ProcessByte
// #define FN_CRC32_Final CRC32_Final
// #define FN_RandomLong RandomLong
// #define FN_RandomFloat RandomFloat
// #define FN_SetView SetView
// #define FN_Time Time
// #define FN_CrosshairAngle CrosshairAngle
// #define FN_LoadFileForMe LoadFileForMe
// #define FN_FreeFile FreeFile
// #define FN_EndSection EndSection
// #define FN_CompareFileTime CompareFileTime
// #define FN_GetGameDir GetGameDir
// #define FN_Cvar_RegisterVariable Cvar_RegisterVariable
// #define FN_FadeClientVolume FadeClientVolume
// #define FN_SetClientMaxspeed SetClientMaxspeed
// #define FN_CreateFakeClient CreateFakeClient
// #define FN_RunPlayerMove RunPlayerMove
// #define FN_NumberOfEntities NumberOfEntities
// #define FN_GetInfoKeyBuffer GetInfoKeyBuffer
// #define FN_InfoKeyValue InfoKeyValue
// #define FN_SetKeyValue SetKeyValue
// #define FN_SetClientKeyValue SetClientKeyValue
// #define FN_IsMapValid IsMapValid
// #define FN_StaticDecal StaticDecal
// #define FN_PrecacheGeneric PrecacheGeneric
// #define FN_GetPlayerUserId GetPlayerUserId
// #define FN_BuildSoundMsg BuildSoundMsg
// #define FN_IsDedicatedServer IsDedicatedServer
// #define FN_CVarGetPointer CVarGetPointer
// #define FN_GetPlayerWONId GetPlayerWONId
// #define FN_Info_RemoveKey Info_RemoveKey
// #define FN_GetPhysicsKeyValue GetPhysicsKeyValue
// #define FN_SetPhysicsKeyValue SetPhysicsKeyValue
// #define FN_GetPhysicsInfoString GetPhysicsInfoString
// #define FN_PrecacheEvent PrecacheEvent
// #define FN_PlaybackEvent PlaybackEvent
// #define FN_SetFatPVS SetFatPVS
// #define FN_SetFatPAS SetFatPAS
// #define FN_CheckVisibility CheckVisibility
// #define FN_DeltaSetField DeltaSetField
// #define FN_DeltaUnsetField DeltaUnsetField
// #define FN_DeltaAddEncoder DeltaAddEncoder
// #define FN_GetCurrentPlayer GetCurrentPlayer
// #define FN_CanSkipPlayer CanSkipPlayer
// #define FN_DeltaFindField DeltaFindField
// #define FN_DeltaSetFieldByIndex DeltaSetFieldByIndex
// #define FN_DeltaUnsetFieldByIndex DeltaUnsetFieldByIndex
// #define FN_SetGroupMask SetGroupMask
// #define FN_engCreateInstancedBaseline engCreateInstancedBaseline
// #define FN_Cvar_DirectSet Cvar_DirectSet
// #define FN_ForceUnmodified ForceUnmodified
// #define FN_GetPlayerStats GetPlayerStats
// #define FN_AddServerCommand AddServerCommand
// #define FN_Voice_GetClientListening Voice_GetClientListening
// #define FN_Voice_SetClientListening Voice_SetClientListening
// #define FN_GetPlayerAuthId GetPlayerAuthId
// - GetEngineAPI_Post functions
// #define FN_PrecacheModel_Post PrecacheModel_Post
// #define FN_PrecacheSound_Post PrecacheSound_Post
// #define FN_SetModel_Post SetModel_Post
// #define FN_ModelIndex_Post ModelIndex_Post
// #define FN_ModelFrames_Post ModelFrames_Post
// #define FN_SetSize_Post SetSize_Post
// #define FN_ChangeLevel_Post ChangeLevel_Post
// #define FN_GetSpawnParms_Post GetSpawnParms_Post
// #define FN_SaveSpawnParms_Post SaveSpawnParms_Post
// #define FN_VecToYaw_Post VecToYaw_Post
// #define FN_VecToAngles_Post VecToAngles_Post
// #define FN_MoveToOrigin_Post MoveToOrigin_Post
// #define FN_ChangeYaw_Post ChangeYaw_Post
// #define FN_ChangePitch_Post ChangePitch_Post
// #define FN_FindEntityByString_Post FindEntityByString_Post
// #define FN_GetEntityIllum_Post GetEntityIllum_Post
// #define FN_FindEntityInSphere_Post FindEntityInSphere_Post
// #define FN_FindClientInPVS_Post FindClientInPVS_Post
// #define FN_EntitiesInPVS_Post EntitiesInPVS_Post
// #define FN_MakeVectors_Post MakeVectors_Post
// #define FN_AngleVectors_Post AngleVectors_Post
// #define FN_CreateEntity_Post CreateEntity_Post
// #define FN_RemoveEntity_Post RemoveEntity_Post
// #define FN_CreateNamedEntity_Post CreateNamedEntity_Post
// #define FN_MakeStatic_Post MakeStatic_Post
// #define FN_EntIsOnFloor_Post EntIsOnFloor_Post
// #define FN_DropToFloor_Post DropToFloor_Post
// #define FN_WalkMove_Post WalkMove_Post
// #define FN_SetOrigin_Post SetOrigin_Post
// #define FN_EmitSound_Post EmitSound_Post
// #define FN_EmitAmbientSound_Post EmitAmbientSound_Post
// #define FN_TraceLine_Post TraceLine_Post
// #define FN_TraceToss_Post TraceToss_Post
// #define FN_TraceMonsterHull_Post TraceMonsterHull_Post
// #define FN_TraceHull_Post TraceHull_Post
// #define FN_TraceModel_Post TraceModel_Post
// #define FN_TraceTexture_Post TraceTexture_Post
// #define FN_TraceSphere_Post TraceSphere_Post
// #define FN_GetAimVector_Post GetAimVector_Post
// #define FN_ServerCommand_Post ServerCommand_Post
// #define FN_ServerExecute_Post ServerExecute_Post
// #define FN_engClientCommand_Post engClientCommand_Post
// #define FN_ParticleEffect_Post ParticleEffect_Post
// #define FN_LightStyle_Post LightStyle_Post
// #define FN_DecalIndex_Post DecalIndex_Post
// #define FN_PointContents_Post PointContents_Post
// #define FN_MessageBegin_Post MessageBegin_Post
// #define FN_MessageEnd_Post MessageEnd_Post
// #define FN_WriteByte_Post WriteByte_Post
// #define FN_WriteChar_Post WriteChar_Post
// #define FN_WriteShort_Post WriteShort_Post
// #define FN_WriteLong_Post WriteLong_Post
// #define FN_WriteAngle_Post WriteAngle_Post
// #define FN_WriteCoord_Post WriteCoord_Post
// #define FN_WriteString_Post WriteString_Post
// #define FN_WriteEntity_Post WriteEntity_Post
// #define FN_CVarRegister_Post CVarRegister_Post
// #define FN_CVarGetFloat_Post CVarGetFloat_Post
// #define FN_CVarGetString_Post CVarGetString_Post
// #define FN_CVarSetFloat_Post CVarSetFloat_Post
// #define FN_CVarSetString_Post CVarSetString_Post
// #define FN_AlertMessage_Post AlertMessage_Post
// #define FN_EngineFprintf_Post EngineFprintf_Post
// #define FN_PvAllocEntPrivateData_Post PvAllocEntPrivateData_Post
// #define FN_PvEntPrivateData_Post PvEntPrivateData_Post
// #define FN_FreeEntPrivateData_Post FreeEntPrivateData_Post
// #define FN_SzFromIndex_Post SzFromIndex_Post
// #define FN_AllocString_Post AllocString_Post
// #define FN_GetVarsOfEnt_Post GetVarsOfEnt_Post
// #define FN_PEntityOfEntOffset_Post PEntityOfEntOffset_Post
// #define FN_EntOffsetOfPEntity_Post EntOffsetOfPEntity_Post
// #define FN_IndexOfEdict_Post IndexOfEdict_Post
// #define FN_PEntityOfEntIndex_Post PEntityOfEntIndex_Post
// #define FN_FindEntityByVars_Post FindEntityByVars_Post
// #define FN_GetModelPtr_Post GetModelPtr_Post
// #define FN_RegUserMsg_Post RegUserMsg_Post
// #define FN_AnimationAutomove_Post AnimationAutomove_Post
// #define FN_GetBonePosition_Post GetBonePosition_Post
// #define FN_FunctionFromName_Post FunctionFromName_Post
// #define FN_NameForFunction_Post NameForFunction_Post
// #define FN_ClientPrintf_Post ClientPrintf_Post
// #define FN_ServerPrint_Post ServerPrint_Post
// #define FN_Cmd_Args_Post Cmd_Args_Post
// #define FN_Cmd_Argv_Post Cmd_Argv_Post
// #define FN_Cmd_Argc_Post Cmd_Argc_Post
// #define FN_GetAttachment_Post GetAttachment_Post
// #define FN_CRC32_Init_Post CRC32_Init_Post
// #define FN_CRC32_ProcessBuffer_Post CRC32_ProcessBuffer_Post
// #define FN_CRC32_ProcessByte_Post CRC32_ProcessByte_Post
// #define FN_CRC32_Final_Post CRC32_Final_Post
// #define FN_RandomLong_Post RandomLong_Post
// #define FN_RandomFloat_Post RandomFloat_Post
// #define FN_SetView_Post SetView_Post
// #define FN_Time_Post Time_Post
// #define FN_CrosshairAngle_Post CrosshairAngle_Post
// #define FN_LoadFileForMe_Post LoadFileForMe_Post
// #define FN_FreeFile_Post FreeFile_Post
// #define FN_EndSection_Post EndSection_Post
// #define FN_CompareFileTime_Post CompareFileTime_Post
// #define FN_GetGameDir_Post GetGameDir_Post
// #define FN_Cvar_RegisterVariable_Post Cvar_RegisterVariable_Post
// #define FN_FadeClientVolume_Post FadeClientVolume_Post
// #define FN_SetClientMaxspeed_Post SetClientMaxspeed_Post
// #define FN_CreateFakeClient_Post CreateFakeClient_Post
// #define FN_RunPlayerMove_Post RunPlayerMove_Post
// #define FN_NumberOfEntities_Post NumberOfEntities_Post
// #define FN_GetInfoKeyBuffer_Post GetInfoKeyBuffer_Post
// #define FN_InfoKeyValue_Post InfoKeyValue_Post
// #define FN_SetKeyValue_Post SetKeyValue_Post
// #define FN_SetClientKeyValue_Post SetClientKeyValue_Post
// #define FN_IsMapValid_Post IsMapValid_Post
// #define FN_StaticDecal_Post StaticDecal_Post
// #define FN_PrecacheGeneric_Post PrecacheGeneric_Post
// #define FN_GetPlayerUserId_Post GetPlayerUserId_Post
// #define FN_BuildSoundMsg_Post BuildSoundMsg_Post
// #define FN_IsDedicatedServer_Post IsDedicatedServer_Post
// #define FN_CVarGetPointer_Post CVarGetPointer_Post
// #define FN_GetPlayerWONId_Post GetPlayerWONId_Post
// #define FN_Info_RemoveKey_Post Info_RemoveKey_Post
// #define FN_GetPhysicsKeyValue_Post GetPhysicsKeyValue_Post
// #define FN_SetPhysicsKeyValue_Post SetPhysicsKeyValue_Post
// #define FN_GetPhysicsInfoString_Post GetPhysicsInfoString_Post
// #define FN_PrecacheEvent_Post PrecacheEvent_Post
// #define FN_PlaybackEvent_Post PlaybackEvent_Post
// #define FN_SetFatPVS_Post SetFatPVS_Post
// #define FN_SetFatPAS_Post SetFatPAS_Post
// #define FN_CheckVisibility_Post CheckVisibility_Post
// #define FN_DeltaSetField_Post DeltaSetField_Post
// #define FN_DeltaUnsetField_Post DeltaUnsetField_Post
// #define FN_DeltaAddEncoder_Post DeltaAddEncoder_Post
// #define FN_GetCurrentPlayer_Post GetCurrentPlayer_Post
// #define FN_CanSkipPlayer_Post CanSkipPlayer_Post
// #define FN_DeltaFindField_Post DeltaFindField_Post
// #define FN_DeltaSetFieldByIndex_Post DeltaSetFieldByIndex_Post
// #define FN_DeltaUnsetFieldByIndex_Post DeltaUnsetFieldByIndex_Post
// #define FN_SetGroupMask_Post SetGroupMask_Post
// #define FN_engCreateInstancedBaseline_Post engCreateInstancedBaseline_Post
// #define FN_Cvar_DirectSet_Post Cvar_DirectSet_Post
// #define FN_ForceUnmodified_Post ForceUnmodified_Post
// #define FN_GetPlayerStats_Post GetPlayerStats_Post
// #define FN_AddServerCommand_Post AddServerCommand_Post
// #define FN_Voice_GetClientListening_Post Voice_GetClientListening_Post
// #define FN_Voice_SetClientListening_Post Voice_SetClientListening_Post
// #define FN_GetPlayerAuthId_Post GetPlayerAuthId_Post
// #define FN_OnFreeEntPrivateData OnFreeEntPrivateData
// #define FN_GameShutdown GameShutdown
// #define FN_ShouldCollide ShouldCollide
// #define FN_OnFreeEntPrivateData_Post OnFreeEntPrivateData_Post
// #define FN_GameShutdown_Post GameShutdown_Post
// #define FN_ShouldCollide_Post ShouldCollide_Post
#endif // USE_METAMOD
#endif // __MODULECONFIG_H__

60
dlls/arrayx/osdefs.h Normal file
View File

@ -0,0 +1,60 @@
/* __MSDOS__ set when compiling for DOS (not Windows)
* _Windows set when compiling for any version of Microsoft Windows
* __WIN32__ set when compiling for Windows95 or WindowsNT (32 bit mode)
* __32BIT__ set when compiling in 32-bit "flat" mode (DOS or Windows)
*
* Copyright 1998-2002, ITB CompuPhase, The Netherlands.
* info@compuphase.com.
*/
#ifndef _OSDEFS_H
#define _OSDEFS_H
/* Every compiler uses different "default" macros to indicate the mode
* it is in. Throughout the source, we use the Borland C++ macros, so
* the macros of Watcom C/C++ and Microsoft Visual C/C++ are mapped to
* those of Borland C++.
*/
#if defined(__WATCOMC__)
# if defined(__WINDOWS__) || defined(__NT__)
# define _Windows 1
# endif
# ifdef __386__
# define __32BIT__ 1
# endif
# if defined(_Windows) && defined(__32BIT__)
# define __WIN32__ 1
# endif
#elif defined(_MSC_VER)
# if defined(_WINDOWS) || defined(_WIN32)
# define _Windows 1
# endif
# ifdef _WIN32
# define __WIN32__ 1
# define __32BIT__ 1
# endif
#endif
#if defined __linux__
#include <endian.h>
#endif
/* Linux NOW has these */
#if !defined BIG_ENDIAN
#define BIG_ENDIAN 4321
#endif
#if !defined LITTLE_ENDIAN
#define LITTLE_ENDIAN 1234
#endif
/* educated guess, BYTE_ORDER is undefined, i386 is common => little endian */
#if !defined BYTE_ORDER
#if defined UCLINUX
#define BYTE_ORDER BIG_ENDIAN
#else
#define BYTE_ORDER LITTLE_ENDIAN
#endif
#endif
#endif /* _OSDEFS_H */