1
0
mirror of https://github.com/aziascreations/BakaShrot.git synced 2026-11-23 20:58:46 +01:00

Moved the PureBasic version to OldSource/, Started the Rust rewrite in Source/

The rewrite's plan and decisions are in revamp.md. Steps 0 to 10 are done:
the workspace and checks, bakashrot-proto, bakashrot-pki and
bakashrot-cert, bakashrot-config, bakashrot-storage (schema v9), the
server and the client library (every request but replication's,
attachments and retention included), the C DLL with its C, PureBasic and
Python bindings, and the bakashrot tool. Step 11 (replication) is next.

OldSource/ is the old implementation, kept building and passing as the
reference.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RwFeVTGs2SsufaH6zquzcb
This commit is contained in:
2026-11-14 12:47:40 +01:00
parent d0048b17c8
commit e044fcf359
225 changed files with 21849 additions and 123 deletions
+73
View File
@@ -0,0 +1,73 @@
;{- Code Header
; ==- Basic Info -================================
; Name: ToolConsole.pbi
; Version: 0.0.1
; Author: Herwin Bozet (NibblePoker)
;
; ==- Compatibility -=============================
; Tested compiler versions:
; * PureBasic 5.73 LTS (Windows x64, Linux x64)
; * PureBasic 6.40 C Backend (Windows x64)
; * PureBasic 6.41 (Linux x64)
; * PureBasic 6.41 C Backend (Linux x64)
;
; ==- Links -=====================================
; GitHub: https://github.com/aziascreations/BakaShrot
;}
; ============================================================================
; BakaShrot Tools - Console
;
; Shared by every tool. Started from Explorer (a double-click, a shortcut),
; a console program gets a console of its own that closes as soon as it
; ends, before what it printed can be read: ToolConsole_End() waits for
; Enter then, and ends at once otherwise.
; As https://github.com/aziascreations/PB-Template-Win32-CliApp does it: a
; program started from a shell shares the shell's console, one started
; directly is alone in its own.
; ============================================================================
CompilerIf #PB_Compiler_OS = #PB_OS_Windows
; Not in PureBasic 5.73's API functions, named so it can't clash with a
; compiler that has it.
Import "kernel32.lib"
CompilerIf #PB_Compiler_Processor = #PB_Processor_x86
ToolConsole_GetConsoleProcessList.l(*ProcessList, ProcessCount.l) As "_GetConsoleProcessList@8"
CompilerElse
ToolConsole_GetConsoleProcessList.l(*ProcessList, ProcessCount.l) As "GetConsoleProcessList"
CompilerEndIf
EndImport
CompilerEndIf
; #True if the tool was started directly rather than from a shell: it is the
; only process on its console. Input or output redirected is #False, someone
; else reads it (a test starting it with Start-Process gets a new hidden
; console too, alone on it). Always #False outside of Windows.
Procedure.i ToolConsole_IsRunDirectly()
CompilerIf #PB_Compiler_OS = #PB_OS_Windows
Protected Mode.l, ProcessList.q ; ProcessList: room for 2 process ids
If Not GetConsoleMode_(GetStdHandle_(#STD_INPUT_HANDLE), @Mode)
ProcedureReturn #False
EndIf
If Not GetConsoleMode_(GetStdHandle_(#STD_OUTPUT_HANDLE), @Mode)
ProcedureReturn #False
EndIf
ProcedureReturn Bool(ToolConsole_GetConsoleProcessList(@ProcessList, 2) <= 1)
CompilerElse
ProcedureReturn #False
CompilerEndIf
EndProcedure
; Ends the tool with ExitCode, after waiting for Enter if it was started
; directly (ToolConsole_IsRunDirectly()).
Procedure ToolConsole_End(ExitCode.i)
If ToolConsole_IsRunDirectly()
PrintN("")
Print("Press Enter to close...")
Input()
EndIf
End ExitCode
EndProcedure