This commit is contained in:
timerix 2023-02-09 01:42:13 +06:00
commit d2eb241d0d
8 changed files with 86 additions and 56 deletions

8
.vscode/launch.json vendored
View File

@ -5,10 +5,10 @@
"name": "(gdb) Debug", "name": "(gdb) Debug",
"type": "cppdbg", "type": "cppdbg",
"request": "launch", "request": "launch",
"program": "$kerep.com", "program": "${workspaceFolder}/bin/kerep.com",
"cwd": "${workspaceFolder}/bin",
"preLaunchTask": "build_exec_dbg", "preLaunchTask": "build_exec_dbg",
"stopAtEntry": false, "stopAtEntry": false,
"cwd": "${fileDirname}/bin",
"externalConsole": false, "externalConsole": false,
"MIMode": "gdb", "MIMode": "gdb",
"miDebuggerPath": "gdb", "miDebuggerPath": "gdb",
@ -31,8 +31,8 @@
"request": "launch", "request": "launch",
"preLaunchTask": "build_exec_dbg", "preLaunchTask": "build_exec_dbg",
"program": "${workspaceFolder}/bin/kerep.com", "program": "${workspaceFolder}/bin/kerep.com",
"cwd": "${workspaceFolder}/bin",
"stopAtEntry": false, "stopAtEntry": false,
"cwd": "${workspaceFolder}",
"externalConsole": false, "externalConsole": false,
"miDebuggerPath": "/usr/bin/gdb", "miDebuggerPath": "/usr/bin/gdb",
"MIMode": "gdb", "MIMode": "gdb",
@ -48,8 +48,8 @@
"type": "cppvsdbg", "type": "cppvsdbg",
"request": "launch", "request": "launch",
"preLaunchTask": "build_dbg", "preLaunchTask": "build_dbg",
"cwd": "${workspaceFolder}\\bin",
"program": "${workspaceFolder}\\bin\\kerep.com", "program": "${workspaceFolder}\\bin\\kerep.com",
"cwd": "${workspaceFolder}\\bin",
"stopAtEntry": false, "stopAtEntry": false,
"console": "integratedTerminal" "console": "integratedTerminal"
} }

26
.vscode/tasks.json vendored
View File

@ -3,32 +3,6 @@
"version": "2.0.0", "version": "2.0.0",
"tasks": [ "tasks": [
{
"label": "build_exec",
"detail": "build project",
"type": "cppbuild",
"command": "make",
"args": [
"build_exec"
],
"options": {
"cwd": "${workspaceFolder}"
},
"problemMatcher": ["$gcc"],
"group": {
"kind": "build",
"isDefault": true
},
"presentation": {
"echo": true,
"reveal": "always",
"focus": true,
"panel": "shared",
"showReuseMessage": false,
"clear": true
}
},
{ {
"label": "build_exec_dbg", "label": "build_exec_dbg",
"detail": "build project with debug symbols", "detail": "build project with debug symbols",

2
cbuild

@ -1 +1 @@
Subproject commit 47808ee989c85b6d011851dbec24c39580b55cbb Subproject commit 15a9661c467facf65b2155eab3fad1ecf5f0c945

View File

@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
CBUILD_VERSION=3 CBUILD_VERSION=4
CONFIG_VERSION=4 CONFIG_VERSION=4
PROJECT=kerep PROJECT=kerep
@ -26,7 +26,7 @@ case $TASK in
CPP_ARGS="$C_ARGS" CPP_ARGS="$C_ARGS"
LINKER_ARGS="" LINKER_ARGS=""
TASK_SCRIPT=cbuild/default_tasks/build_exec.sh TASK_SCRIPT=cbuild/default_tasks/build_exec.sh
PRE_TASK_SCRIPT=tasks/pre_build.sh PRE_TASK_SCRIPT=
POST_TASK_SCRIPT= POST_TASK_SCRIPT=
;; ;;
build_exec_dbg) build_exec_dbg)
@ -34,7 +34,7 @@ case $TASK in
CPP_ARGS="$C_ARGS" CPP_ARGS="$C_ARGS"
LINKER_ARGS="" LINKER_ARGS=""
TASK_SCRIPT=cbuild/default_tasks/build_exec.sh TASK_SCRIPT=cbuild/default_tasks/build_exec.sh
PRE_TASK_SCRIPT=tasks/pre_build.sh PRE_TASK_SCRIPT=
POST_TASK_SCRIPT= POST_TASK_SCRIPT=
;; ;;
build_shared_lib) build_shared_lib)
@ -42,7 +42,7 @@ case $TASK in
CPP_ARGS="$C_ARGS" CPP_ARGS="$C_ARGS"
LINKER_ARGS="-Wl,-soname,$SHARED_LIB_FILE" LINKER_ARGS="-Wl,-soname,$SHARED_LIB_FILE"
TASK_SCRIPT=cbuild/default_tasks/build_shared_lib.sh TASK_SCRIPT=cbuild/default_tasks/build_shared_lib.sh
PRE_TASK_SCRIPT=tasks/pre_build.sh PRE_TASK_SCRIPT=
POST_TASK_SCRIPT= POST_TASK_SCRIPT=
;; ;;
build_shared_lib_dbg) build_shared_lib_dbg)
@ -50,21 +50,21 @@ case $TASK in
CPP_ARGS="$C_ARGS" CPP_ARGS="$C_ARGS"
LINKER_ARGS="-Wl,-soname,$SHARED_LIB_FILE" LINKER_ARGS="-Wl,-soname,$SHARED_LIB_FILE"
TASK_SCRIPT=cbuild/default_tasks/build_shared_lib.sh TASK_SCRIPT=cbuild/default_tasks/build_shared_lib.sh
PRE_TASK_SCRIPT=tasks/pre_build.sh PRE_TASK_SCRIPT=
POST_TASK_SCRIPT= POST_TASK_SCRIPT=
;; ;;
build_static_lib) build_static_lib)
C_ARGS="-O2 -fpic" C_ARGS="-O2 -fpic"
CPP_ARGS="$C_ARGS" CPP_ARGS="$C_ARGS"
TASK_SCRIPT=cbuild/default_tasks/build_static_lib.sh TASK_SCRIPT=cbuild/default_tasks/build_static_lib.sh
PRE_TASK_SCRIPT=tasks/pre_build.sh PRE_TASK_SCRIPT=
POST_TASK_SCRIPT= POST_TASK_SCRIPT=
;; ;;
build_static_lib_dbg) build_static_lib_dbg)
C_ARGS="-O0 -g" C_ARGS="-O0 -g"
CPP_ARGS="$C_ARGS" CPP_ARGS="$C_ARGS"
TASK_SCRIPT=cbuild/default_tasks/build_static_lib.sh TASK_SCRIPT=cbuild/default_tasks/build_static_lib.sh
PRE_TASK_SCRIPT=tasks/pre_build.sh PRE_TASK_SCRIPT=
POST_TASK_SCRIPT= POST_TASK_SCRIPT=
;; ;;
exec) exec)
@ -75,3 +75,14 @@ case $TASK in
TASK_SCRIPT=cbuild/default_tasks/valgrind.sh TASK_SCRIPT=cbuild/default_tasks/valgrind.sh
;; ;;
esac esac
case $OS in
WINDOWS)
;;
LINUX)
;;
*)
printf "${RED}operating system $OS has no configuration variants\n"
exit 1
;;
esac

View File

@ -19,46 +19,88 @@
</ProjectConfiguration> </ProjectConfiguration>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="src\Array\Array.c" />
<ClCompile Include="src\Autoarr\Autoarr.c" /> <ClCompile Include="src\Autoarr\Autoarr.c" />
<ClCompile Include="src\Autoarr\Autoarr_KVPair_exported.c" /> <ClCompile Include="src\Autoarr\Autoarr_KVPair_exported.c" />
<ClCompile Include="src\Autoarr\Autoarr_Unitype.c" />
<ClCompile Include="src\Autoarr\Autoarr_Unitype_exported.c" /> <ClCompile Include="src\Autoarr\Autoarr_Unitype_exported.c" />
<ClCompile Include="src\base\cptr.c" /> <ClCompile Include="src\base\cptr.c" />
<ClCompile Include="src\base\endian.c" />
<ClCompile Include="src\base\errors.c" /> <ClCompile Include="src\base\errors.c" />
<ClCompile Include="src\base\types.c" /> <ClCompile Include="src\base\type_system\base_toString.c" />
<ClCompile Include="src\base\type_system\init.c" />
<ClCompile Include="src\base\type_system\kt_functions.c" />
<ClCompile Include="src\base\type_system\unitype.c" />
<ClCompile Include="src\DtsodParser\DtsodV24.c" /> <ClCompile Include="src\DtsodParser\DtsodV24.c" />
<ClCompile Include="src\DtsodParser\DtsodV24_deserialize.c" /> <ClCompile Include="src\DtsodParser\DtsodV24_deserialize.c" />
<ClCompile Include="src\DtsodParser\DtsodV24_exported.c" /> <ClCompile Include="src\DtsodParser\DtsodV24_exported.c" />
<ClCompile Include="src\DtsodParser\DtsodV24_serialize.c" /> <ClCompile Include="src\DtsodParser\DtsodV24_serialize.c" />
<ClCompile Include="src\Filesystem\dir.c" />
<ClCompile Include="src\Filesystem\file.c" />
<ClCompile Include="src\Filesystem\path.c" />
<ClCompile Include="src\HashFunctions\hash.c" /> <ClCompile Include="src\HashFunctions\hash.c" />
<ClCompile Include="src\Hashtable\Hashtable.c" /> <ClCompile Include="src\Hashtable\Hashtable.c" />
<ClCompile Include="src\Hashtable\KeyValuePair.c" /> <ClCompile Include="src\Hashtable\KeyValuePair.c" />
<ClCompile Include="src\kprint\kprint.c" />
<ClCompile Include="src\kprint\kprintf.c" />
<ClCompile Include="src\random\splitmix64\splitmix64.c" />
<ClCompile Include="src\random\xoroshiro\32bitValue\xoroshiro64star.c" />
<ClCompile Include="src\random\xoroshiro\32bitValue\xoroshiro64starstar.c" />
<ClCompile Include="src\random\xoroshiro\64bitValue\xoroshiro128plus.c" />
<ClCompile Include="src\random\xoroshiro\64bitValue\xoroshiro128plusplus.c" />
<ClCompile Include="src\random\xoroshiro\64bitValue\xoroshiro128starstar.c" />
<ClCompile Include="src\random\xoshiro\32bitValue\xoshiro128plus.c" />
<ClCompile Include="src\random\xoshiro\32bitValue\xoshiro128plusplus.c" />
<ClCompile Include="src\random\xoshiro\32bitValue\xoshiro128starstar.c" />
<ClCompile Include="src\random\xoshiro\64bitValue\xoshiro256plus.c" />
<ClCompile Include="src\random\xoshiro\64bitValue\xoshiro256plusplus.c" />
<ClCompile Include="src\random\xoshiro\64bitValue\xoshiro256starstar.c" />
<ClCompile Include="src\SearchTree\SearchTree.c" /> <ClCompile Include="src\SearchTree\SearchTree.c" />
<ClCompile Include="src\String\string.c" /> <ClCompile Include="src\String\string.c" />
<ClCompile Include="src\String\StringBuilder.c" /> <ClCompile Include="src\String\StringBuilder.c" />
<ClCompile Include="tests\main.cpp" />
<ClCompile Include="tests\test_autoarr.c" />
<ClCompile Include="tests\test_dtsod.c" />
<ClCompile Include="tests\test_hashtable.c" />
<ClCompile Include="tests\test_hash_functions.c" />
<ClCompile Include="tests\test_marshalling.c" /> <ClCompile Include="tests\test_marshalling.c" />
<ClCompile Include="tests\test_safethrow.c" />
<ClCompile Include="tests\test_searchtree.c" />
<ClCompile Include="tests\test_string.c" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="src\Array\Array.h" />
<ClInclude Include="src\Array\Array_declare.h" />
<ClInclude Include="src\Array\Array_define.h" />
<ClInclude Include="src\Autoarr\Autoarr.h" /> <ClInclude Include="src\Autoarr\Autoarr.h" />
<ClInclude Include="src\Autoarr\Autoarr_declare.h" /> <ClInclude Include="src\Autoarr\Autoarr_declare.h" />
<ClInclude Include="src\Autoarr\Autoarr_define.h" /> <ClInclude Include="src\Autoarr\Autoarr_define.h" />
<ClInclude Include="src\Autoarr\Autoarr_Unitype.h" />
<ClInclude Include="src\base\base.h" /> <ClInclude Include="src\base\base.h" />
<ClInclude Include="src\base\cptr.h" /> <ClInclude Include="src\base\cptr.h" />
<ClInclude Include="src\base\endian.h" />
<ClInclude Include="src\base\errors.h" /> <ClInclude Include="src\base\errors.h" />
<ClInclude Include="src\base\optime.h" /> <ClInclude Include="src\base\optime.h" />
<ClInclude Include="src\base\std.h" /> <ClInclude Include="src\base\std.h" />
<ClInclude Include="src\base\types.h" /> <ClInclude Include="src\base\type_system\base_toString.h" />
<ClInclude Include="src\base\type_system\init.h" />
<ClInclude Include="src\base\type_system\ktDescriptor.h" />
<ClInclude Include="src\base\type_system\ktid.h" />
<ClInclude Include="src\base\type_system\kt_functions.h" />
<ClInclude Include="src\base\type_system\type_system.h" />
<ClInclude Include="src\base\type_system\unitype.h" />
<ClInclude Include="src\DtsodParser\DtsodV24.h" /> <ClInclude Include="src\DtsodParser\DtsodV24.h" />
<ClInclude Include="src\Filesystem\dir.h" />
<ClInclude Include="src\Filesystem\file.h" />
<ClInclude Include="src\Filesystem\filesystem.h" />
<ClInclude Include="src\Filesystem\path.h" />
<ClInclude Include="src\HashFunctions\hash.h" /> <ClInclude Include="src\HashFunctions\hash.h" />
<ClInclude Include="src\Hashtable\Hashtable.h" /> <ClInclude Include="src\Hashtable\Hashtable.h" />
<ClInclude Include="src\Hashtable\KeyValuePair.h" /> <ClInclude Include="src\Hashtable\KeyValuePair.h" />
<ClInclude Include="src\kprint\kprint.h" />
<ClInclude Include="src\kprint\kprintf.h" />
<ClInclude Include="src\kprint\kprint_colors.h" />
<ClInclude Include="src\kprint\kprint_format.h" />
<ClInclude Include="src\random\krandom.h" />
<ClInclude Include="src\random\splitmix64\splitmix64.h" />
<ClInclude Include="src\random\xoroshiro\32bitValue\xoroshiro64.h" />
<ClInclude Include="src\random\xoroshiro\64bitValue\xoroshiro128.h" />
<ClInclude Include="src\random\xoroshiro\xoroshiro.h" />
<ClInclude Include="src\random\xoshiro\32bitValue\xoshiro128.h" />
<ClInclude Include="src\random\xoshiro\64bitValue\xoshiro256.h" />
<ClInclude Include="src\random\xoshiro\xoshiro.h" />
<ClInclude Include="src\SearchTree\SearchTree.h" /> <ClInclude Include="src\SearchTree\SearchTree.h" />
<ClInclude Include="src\String\string.h" /> <ClInclude Include="src\String\string.h" />
<ClInclude Include="src\String\StringBuilder.h" /> <ClInclude Include="src\String\StringBuilder.h" />
@ -156,7 +198,7 @@
<LanguageStandard_C>stdc17</LanguageStandard_C> <LanguageStandard_C>stdc17</LanguageStandard_C>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<PrecompiledHeaderOutputFile /> <PrecompiledHeaderOutputFile />
<AdditionalOptions>/Zc:twoPhase- /MP -fms-compatibility-version=14 %(AdditionalOptions)</AdditionalOptions> <AdditionalOptions>/Zc:twoPhase- /MP -fms-compatibility-version=14 -Wno-clang-analyzer-valist.Uninitialized %(AdditionalOptions)</AdditionalOptions>
<CompileAs>Default</CompileAs> <CompileAs>Default</CompileAs>
<LanguageStandard>stdcpp17</LanguageStandard> <LanguageStandard>stdcpp17</LanguageStandard>
<DebugInformationFormat>None</DebugInformationFormat> <DebugInformationFormat>None</DebugInformationFormat>
@ -182,7 +224,7 @@
<LanguageStandard_C>stdc17</LanguageStandard_C> <LanguageStandard_C>stdc17</LanguageStandard_C>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<PrecompiledHeaderOutputFile /> <PrecompiledHeaderOutputFile />
<AdditionalOptions>/Zc:twoPhase- /MP -fms-compatibility-version=14 %(AdditionalOptions)</AdditionalOptions> <AdditionalOptions>/Zc:twoPhase- /MP -fms-compatibility-version=14 -Wno-clang-analyzer-valist.Uninitialized %(AdditionalOptions)</AdditionalOptions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<CompileAs>Default</CompileAs> <CompileAs>Default</CompileAs>
<LanguageStandard>stdcpp17</LanguageStandard> <LanguageStandard>stdcpp17</LanguageStandard>
@ -208,7 +250,7 @@
<LanguageStandard_C>stdc17</LanguageStandard_C> <LanguageStandard_C>stdc17</LanguageStandard_C>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<PrecompiledHeaderOutputFile /> <PrecompiledHeaderOutputFile />
<AdditionalOptions>/Zc:twoPhase- /MP -fms-compatibility-version=14 %(AdditionalOptions)</AdditionalOptions> <AdditionalOptions>/Zc:twoPhase- /MP -fms-compatibility-version=14 -Wno-clang-analyzer-valist.Uninitialized %(AdditionalOptions)</AdditionalOptions>
<CompileAs>Default</CompileAs> <CompileAs>Default</CompileAs>
<LanguageStandard>stdcpp17</LanguageStandard> <LanguageStandard>stdcpp17</LanguageStandard>
<DebugInformationFormat>None</DebugInformationFormat> <DebugInformationFormat>None</DebugInformationFormat>
@ -235,7 +277,7 @@
<LanguageStandard_C>stdc17</LanguageStandard_C> <LanguageStandard_C>stdc17</LanguageStandard_C>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<PrecompiledHeaderOutputFile /> <PrecompiledHeaderOutputFile />
<AdditionalOptions>/Zc:twoPhase- /MP -fms-compatibility-version=14 %(AdditionalOptions)</AdditionalOptions> <AdditionalOptions>/Zc:twoPhase- /MP -fms-compatibility-version=14 -Wno-clang-analyzer-valist.Uninitialized %(AdditionalOptions)</AdditionalOptions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<CompileAs>Default</CompileAs> <CompileAs>Default</CompileAs>
<LanguageStandard>stdcpp17</LanguageStandard> <LanguageStandard>stdcpp17</LanguageStandard>
@ -252,4 +294,4 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">
</ImportGroup> </ImportGroup>
</Project> </Project>

View File

@ -67,7 +67,7 @@ typedef uint8 bool;
#endif #endif
#ifndef sprintf_s #ifndef sprintf_s
#define sprintf_s(BUF, BUFSIZE, FORMAT, ...) sprintf(BUF, FORMAT, ## __VA_ARGS__) //#define sprintf_s(BUF, BUFSIZE, FORMAT, ...) sprintf(BUF, FORMAT, ## __VA_ARGS__)
#endif #endif

View File

@ -67,7 +67,10 @@ char* toString_uint(uint64 n, bool withPostfix, bool uppercase){
throw("too big precision");\ throw("too big precision");\
if(precision==0)\ if(precision==0)\
precision=toString_float_default_precision;\ precision=toString_float_default_precision;\
int cn=sprintf(str, "%.*f", precision, n);\ int cn=IFMSC(\
sprintf_s(str, bufsize, "%.*f", precision, n),\
sprintf(str, "%.*f", precision, n)\
);\
/* remove trailing zeroes except .0*/\ /* remove trailing zeroes except .0*/\
while(str[cn-1]=='0' && str[cn-2]!='.')\ while(str[cn-1]=='0' && str[cn-2]!='.')\
cn--;\ cn--;\

View File

@ -133,7 +133,7 @@ void kprintf(const char* format, ...){
putc(c,stdout); putc(c,stdout);
} }
#if defined(_WIN64) || defined(_WIN32) #if defined(_WIN64) || defined(_WIN32)
end_iteration: end_iteration:;
#endif #endif
} }
va_end(vl); va_end(vl);