Update .gitignore, _ChainedHashMap.pbi, HashMap.pbi, and 4 more files
This commit is contained in:
+18
@@ -0,0 +1,18 @@
|
||||
# IDEs
|
||||
.vs/
|
||||
.idea/
|
||||
|
||||
# Build Artifacts
|
||||
*.exe
|
||||
*.dll
|
||||
*.lib
|
||||
*.exp
|
||||
*.a
|
||||
*.so
|
||||
|
||||
# Trash
|
||||
*.pb.cfg
|
||||
*.pbi.cfg
|
||||
*.pbf.cfg
|
||||
*.7z
|
||||
*.zip
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<project xmlns="http://www.purebasic.com/namespace" version="1.0" creator="PureBasic 6.40 (Windows - x64)">
|
||||
<section name="config">
|
||||
<options closefiles="1" openmode="0" name="YASS 13"/>
|
||||
</section>
|
||||
<section name="data">
|
||||
<explorer view="C:\ProgramData\PureBasic\Examples\" pattern="0"/>
|
||||
<log show="1"/>
|
||||
<lastopen date="2026-09-30 22:17" user="Herwin" host="DESKTOP-N6M1VPH"/>
|
||||
</section>
|
||||
<section name="files">
|
||||
<file name="core\server\Server.pb">
|
||||
<config load="0" scan="1" panel="1" warn="1" lastopen="1" sortindex="1" panelstate="+++"/>
|
||||
<fingerprint md5="25549acd32d8d0d0756cc0efee9c7db0"/>
|
||||
</file>
|
||||
<file name="core\commons\CRC32B\CRC32B.pbi">
|
||||
<config load="0" scan="1" panel="1" warn="1" lastopen="0" sortindex="999" panelstate="++++"/>
|
||||
<fingerprint md5="2cc7b90cb70b04ad9d5c760026ece7b6"/>
|
||||
</file>
|
||||
<file name="core\commons\HashMap\_ChainedHashMap.pbi">
|
||||
<config load="0" scan="1" panel="1" warn="1" lastopen="0" sortindex="999" panelstate="++++"/>
|
||||
<fingerprint md5="77d25aae630058fddc892733df336d74"/>
|
||||
</file>
|
||||
<file name="core\commons\HashMap\HashMap.pbi">
|
||||
<config load="0" scan="1" panel="1" warn="1" lastopen="0" sortindex="999" panelstate="++++"/>
|
||||
<fingerprint md5="d9bc3767bd8144d646f0bcfa5239c5aa"/>
|
||||
</file>
|
||||
</section>
|
||||
<section name="targets">
|
||||
<target name="Server - MSVCRT - x64" enabled="1" default="1">
|
||||
<inputfile value="core\server\Server.pb"/>
|
||||
<outputfile value="Server.exe"/>
|
||||
<compiler version="PureBasic 5.73 LTS (Windows - x64)"/>
|
||||
<options dllprotection="1" shareducrt="1" debug="1" optimizer="1"/>
|
||||
<temporaryexe value="source"/>
|
||||
<format exe="console" cpu="0"/>
|
||||
</target>
|
||||
</section>
|
||||
</project>
|
||||
@@ -1,8 +1,23 @@
|
||||
|
||||
#YASS13_HashMap_Type = "Chained"
|
||||
|
||||
CompilerIf #YASS13_HashMap_Type = "Chained"
|
||||
; Common prototypes every hashmap implementation must match.
|
||||
Prototype.i HashMapProto_Create(SizePower.b)
|
||||
Prototype.i HashMapProto_GetByHash(*Map, Hash.q)
|
||||
Prototype.b HashMapProto_OverwriteByHash(*Map, *Data, Hash.q, *FreeingCallback = #Null)
|
||||
Prototype HashMapProto_DeleteByHash(*Map, Hash.q)
|
||||
Prototype HashMapProto_Free(*Map)
|
||||
Prototype HashMapProto_FreeCallback(*Data)
|
||||
|
||||
CompilerIf #YASS13_HashMap_Type = "Chained"
|
||||
XIncludeFile "./_ChainedHashMap.pbi"
|
||||
|
||||
Global HashMap_Create.HashMapProto_Create = ChainedHashMap::@Create()
|
||||
Global HashMap_GetByHash.HashMapProto_GetByHash = ChainedHashMap::@GetByHash()
|
||||
Global HashMap_OverwriteByHash.HashMapProto_OverwriteByHash = ChainedHashMap::@OverwriteByHash()
|
||||
Global HashMap_DeleteByHash.HashMapProto_DeleteByHash = ChainedHashMap::@DeleteByHash()
|
||||
Global HashMap_Free.HashMapProto_Free = ChainedHashMap::@Free()
|
||||
Global HashMap_NoopFree.HashMapProto_FreeCallback = ChainedHashMap::@NoopFree()
|
||||
CompilerElse
|
||||
CompilerError("You must defined a valid core hashmap type !")
|
||||
CompilerEndIf
|
||||
|
||||
@@ -1,27 +1,36 @@
|
||||
|
||||
DeclareModule ChainedHashMap
|
||||
EnableExplicit
|
||||
|
||||
#HashMap_InitialPower = 9
|
||||
#HashMap_InsertIterations = 100000
|
||||
#InitialPower = 9
|
||||
#InsertIterations = 100000
|
||||
|
||||
;{
|
||||
|
||||
Structure ChainedHashMapBucket
|
||||
Structure Bucket
|
||||
*BucketData
|
||||
*Next.ChainedHashMapBucket
|
||||
*Next.Bucket
|
||||
Hash.q
|
||||
EndStructure
|
||||
|
||||
Structure ChainedHashMap
|
||||
Structure HashMap
|
||||
EntryCount.i
|
||||
Capacity.i
|
||||
SizePower.a
|
||||
*Buckets.ChainedHashMapBucket[0]
|
||||
*Buckets.Bucket[0]
|
||||
EndStructure
|
||||
|
||||
|
||||
Prototype CbFree(*Data)
|
||||
|
||||
Declare.i Create(SizePower.b)
|
||||
Declare.i GetByHash(*CHM.HashMap, Hash.q)
|
||||
Declare.b OverwriteByHash(*CHM.HashMap, *Data, Hash.q, *FreeingCallback.CbFree = #Null)
|
||||
Declare DeleteByHash(*CHM.HashMap, Hash.q)
|
||||
Declare Free(*CHM.HashMap)
|
||||
Declare NoopFree(*Data)
|
||||
EndDeclareModule
|
||||
|
||||
Module ChainedHashMap
|
||||
EnableExplicit
|
||||
|
||||
Procedure.l MakeBitMask(BitCount.b)
|
||||
EnableASM
|
||||
MOV eax, $00000001
|
||||
@@ -32,8 +41,8 @@ Procedure.l MakeBitMask(BitCount.b)
|
||||
DisableASM
|
||||
EndProcedure
|
||||
|
||||
Procedure.i CHM_Create(SizePower.b)
|
||||
Protected *CHM.ChainedHashMap = AllocateMemory(SizeOf(ChainedHashMap) + (SizeOf(Integer) * (MakeBitMask(SizePower) + 1)))
|
||||
Procedure.i Create(SizePower.b)
|
||||
Protected *CHM.HashMap = AllocateMemory(SizeOf(HashMap) + (SizeOf(Integer) * (MakeBitMask(SizePower) + 1)))
|
||||
|
||||
If *CHM <> #Null
|
||||
*CHM\EntryCount = 0
|
||||
@@ -48,9 +57,9 @@ Procedure.i CHM_Create(SizePower.b)
|
||||
ProcedureReturn *CHM
|
||||
EndProcedure
|
||||
|
||||
Procedure.i CHM_GetByHash(*CHM.ChainedHashMap, Hash.q)
|
||||
Procedure.i GetByHash(*CHM.HashMap, Hash.q)
|
||||
If *CHM <> #Null
|
||||
Protected *CurrentBucket.ChainedHashMapBucket = *CHM\Buckets[(Hash & MakeBitMask(*CHM\SizePower))]
|
||||
Protected *CurrentBucket.Bucket = *CHM\Buckets[(Hash & MakeBitMask(*CHM\SizePower))]
|
||||
|
||||
While *CurrentBucket <> #Null
|
||||
If *CurrentBucket\Hash = Hash
|
||||
@@ -63,10 +72,10 @@ Procedure.i CHM_GetByHash(*CHM.ChainedHashMap, Hash.q)
|
||||
ProcedureReturn #Null
|
||||
EndProcedure
|
||||
|
||||
Procedure.b CHM_OverwriteByHash(*CHM.ChainedHashMap, *Data, Hash.q, *FreeingCallback.CbFree = #Null)
|
||||
Procedure.b OverwriteByHash(*CHM.HashMap, *Data, Hash.q, *FreeingCallback.CbFree = #Null)
|
||||
If *CHM <> #Null
|
||||
Protected *PreviousBucket.ChainedHashMapBucket = #Null
|
||||
Protected *CurrentBucket.ChainedHashMapBucket = *CHM\Buckets[(Hash & MakeBitMask(*CHM\SizePower))]
|
||||
Protected *PreviousBucket.Bucket = #Null
|
||||
Protected *CurrentBucket.Bucket = *CHM\Buckets[(Hash & MakeBitMask(*CHM\SizePower))]
|
||||
|
||||
; We iterate over the bucket chain until we find a collision or an in-between.
|
||||
While *CurrentBucket <> #Null
|
||||
@@ -80,7 +89,7 @@ Procedure.b CHM_OverwriteByHash(*CHM.ChainedHashMap, *Data, Hash.q, *FreeingCall
|
||||
If *CurrentBucket = #Null Or *CurrentBucket\Hash <> Hash
|
||||
; We either reached the end of the list, or no buckets was in the current slot.
|
||||
; Or, we have an in-between, or we are at the start of the list.
|
||||
Protected *NewBucket.ChainedHashMapBucket = AllocateMemory(SizeOf(ChainedHashMapBucket))
|
||||
Protected *NewBucket.Bucket = AllocateMemory(SizeOf(Bucket))
|
||||
|
||||
If *NewBucket <> #Null
|
||||
*NewBucket\Next = *CurrentBucket
|
||||
@@ -110,12 +119,13 @@ Procedure.b CHM_OverwriteByHash(*CHM.ChainedHashMap, *Data, Hash.q, *FreeingCall
|
||||
ProcedureReturn #False
|
||||
EndProcedure
|
||||
|
||||
Procedure CHM_DeleteByHash(*CHM.ChainedHashMap, Hash.q)
|
||||
Procedure DeleteByHash(*CHM.HashMap, Hash.q)
|
||||
|
||||
EndProcedure
|
||||
|
||||
Procedure CHM_Free(*CHM.ChainedHashMap)
|
||||
Procedure Free(*CHM.HashMap)
|
||||
|
||||
EndProcedure
|
||||
|
||||
Procedure NoopFree(*Data) : EndProcedure
|
||||
EndModule
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
|
||||
;- Compiler Directives
|
||||
EnableExplicit
|
||||
|
||||
|
||||
XIncludeFile "../Commons/HashMap/HashMap.pbi"
|
||||
|
||||
|
||||
|
||||
|
||||
If Not OpenConsole("YASS13")
|
||||
DebuggerError("Failed to open console !")
|
||||
End 1
|
||||
EndIf
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Debug "Done :)"
|
||||
@@ -0,0 +1,136 @@
|
||||
// Documentation:
|
||||
// * https://docs.microsoft.com/en-us/windows/win32/api/verrsrc/ns-verrsrc-vs_fixedfileinfo
|
||||
// * https://learn.microsoft.com/en-us/windows/win32/menurc/versioninfo-resource
|
||||
|
||||
// File Flags
|
||||
#if !defined(VS_FF_DEBUG)
|
||||
#define VS_FF_DEBUG 0x00000001L
|
||||
#endif
|
||||
#if !defined(VS_FF_PRERELEASE)
|
||||
#define VS_FF_PRERELEASE 0x00000002L
|
||||
#endif
|
||||
#if !defined(VS_FF_PATCHED)
|
||||
#define VS_FF_PATCHED 0x00000004L
|
||||
#endif
|
||||
#if !defined(VS_FF_PRIVATEBUILD)
|
||||
#define VS_FF_PRIVATEBUILD 0x00000008L
|
||||
#endif
|
||||
#if !defined(VS_FF_INFOINFERRED)
|
||||
#define VS_FF_INFOINFERRED 0x00000010L
|
||||
#endif
|
||||
#if !defined(VS_FF_SPECIALBUILD)
|
||||
#define VS_FF_SPECIALBUILD 0x00000020L
|
||||
#endif
|
||||
|
||||
// File OS
|
||||
#if !defined(VOS_UNKNOWN)
|
||||
#define VOS_UNKNOWN 0x00000000L
|
||||
#endif
|
||||
#if !defined(VOS_DOS)
|
||||
#define VOS_DOS 0x00010000L
|
||||
#endif
|
||||
#if !defined(VOS_OS216)
|
||||
#define VOS_OS216 0x00020000L
|
||||
#endif
|
||||
#if !defined(VOS_OS232)
|
||||
#define VOS_OS232 0x00030000L
|
||||
#endif
|
||||
#if !defined(VOS_NT)
|
||||
#define VOS_NT 0x00040000L
|
||||
#endif
|
||||
#if !defined(VOS_WINCE)
|
||||
#define VOS_WINCE 0x00050000L
|
||||
#endif
|
||||
|
||||
#if !defined(VOS__BASE)
|
||||
#define VOS__BASE 0x00000000L
|
||||
#endif
|
||||
#if !defined(VOS__WINDOWS16)
|
||||
#define VOS__WINDOWS16 0x00000001L
|
||||
#endif
|
||||
#if !defined(VOS__PM16)
|
||||
#define VOS__PM16 0x00000002L
|
||||
#endif
|
||||
#if !defined(VOS__PM32)
|
||||
#define VOS__PM32 0x00000003L
|
||||
#endif
|
||||
#if !defined(VOS__WINDOWS32)
|
||||
#define VOS__WINDOWS32 0x00000004L
|
||||
#endif
|
||||
|
||||
#if !defined(VOS_DOS_WINDOWS16)
|
||||
#define VOS_DOS_WINDOWS16 0x00010001L
|
||||
#endif
|
||||
#if !defined(VOS_DOS_WINDOWS32)
|
||||
#define VOS_DOS_WINDOWS32 0x00010004L
|
||||
#endif
|
||||
#if !defined(VOS_OS216_PM16)
|
||||
#define VOS_OS216_PM16 0x00020002L
|
||||
#endif
|
||||
#if !defined(VOS_OS232_PM32)
|
||||
#define VOS_OS232_PM32 0x00030003L
|
||||
#endif
|
||||
#if !defined(VOS_NT_WINDOWS32)
|
||||
#define VOS_NT_WINDOWS32 0x00040004L
|
||||
#endif
|
||||
|
||||
// File type
|
||||
#if !defined(VFT_UNKNOWN)
|
||||
#define VFT_UNKNOWN 0x00000000L
|
||||
#endif
|
||||
#if !defined(VFT_APP)
|
||||
#define VFT_APP 0x00000001L
|
||||
#endif
|
||||
#if !defined(VFT_DLL)
|
||||
#define VFT_DLL 0x00000002L
|
||||
#endif
|
||||
#if !defined(VFT_DRV)
|
||||
#define VFT_DRV 0x00000003L
|
||||
#endif
|
||||
#if !defined(VFT_FONT)
|
||||
#define VFT_FONT 0x00000004L
|
||||
#endif
|
||||
#if !defined(VFT_VXD)
|
||||
#define VFT_VXD 0x00000005L
|
||||
#endif
|
||||
#if !defined(VFT_STATIC_LIB)
|
||||
#define VFT_STATIC_LIB 0x00000007L
|
||||
#endif
|
||||
|
||||
// Relative to the .pb/.pbp file
|
||||
//IDI_ICON1 ICON ".\\Resources\\Icons\\lscom-v2-text-01.ico"
|
||||
|
||||
1 VERSIONINFO
|
||||
FILEVERSION 3,0,0,0
|
||||
PRODUCTVERSION 3,0,0,0
|
||||
//FILEFLAGSMASK 0x3fL
|
||||
//FILEFLAGS 0x0L
|
||||
FILEOS VOS_NT_WINDOWS32
|
||||
FILETYPE VFT_APP
|
||||
//FILESUBTYPE 0x0L
|
||||
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "000004b0"
|
||||
BEGIN
|
||||
//VALUE "Comments", "\0"
|
||||
VALUE "CompanyName", "NibblePoker\0"
|
||||
VALUE "FileDescription", "PEArch CLI Utility\0"
|
||||
VALUE "FileVersion", "3.0.0.0\0"
|
||||
VALUE "InternalName", "PEArch\0"
|
||||
VALUE "LegalCopyright", "Copyright (C) 2026\0"
|
||||
//VALUE "LegalTrademarks", "\0"
|
||||
VALUE "OriginalFilename", "PEArch.exe\0"
|
||||
//VALUE "PrivateBuild", "\0"
|
||||
VALUE "ProductName", "PEArch\0"
|
||||
VALUE "ProductVersion", "3.0.0.0\0"
|
||||
//VALUE "SpecialBuild", "\0"
|
||||
// Website https://github.com/aziascreations/PB-PEArch
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x0000, 0x4b0
|
||||
END
|
||||
END
|
||||
@@ -0,0 +1,9 @@
|
||||
|
||||
|
||||
Structure YassObject
|
||||
|
||||
id.s
|
||||
|
||||
EndStructure
|
||||
|
||||
|
||||
Reference in New Issue
Block a user