diff --git a/CMakeLists.txt b/CMakeLists.txt index 5f0f936..401c1ab 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.25) -project(lilfbtf5) +project(lilfbtf5 VERSION 0.1.0) option(ENABLE_ADDRSAN "Enable the address sanitizer" OFF) option(ENABLE_UBSAN "Enable the ub sanitizer" OFF) diff --git a/commit.py b/commit.py new file mode 100755 index 0000000..6adfca0 --- /dev/null +++ b/commit.py @@ -0,0 +1,86 @@ +#!/usr/bin/python3 + +import subprocess + +#--------------------------------------- +# CONFIG +#--------------------------------------- + +VERSION_BEGIN_STR = "lilfbtf5 VERSION " +VERSION_END_STR = ")" +PATCH_LIMIT = 1000 + +#--------------------------------------- +# DO NOT TOUCH +#--------------------------------------- + +def load_cmake(): + cmake_file = open("CMakeLists.txt", 'r') + cmake_text = cmake_file.read() + cmake_file.close() + return cmake_text + +def write_cmake(cmake_text): + cmake_file = open("CMakeLists.txt", 'w') + cmake_file.write(cmake_text) + cmake_file.close() + +def get_version(cmake_text): + begin = cmake_text.find(VERSION_BEGIN_STR) + len(VERSION_BEGIN_STR) + end = cmake_text.find(VERSION_END_STR, begin) + return (cmake_text[begin:end], begin, end) + +def split_version(cmake_text): + version, begin, end = get_version(cmake_text) + version_parts = version.split('.') + return (version_parts, begin, end) + +def recombine(cmake_text, version_parts, begin, end): + constructed_version = version_parts[0] + '.' + version_parts[1] + '.' + version_parts[2] + constructed_text_begin = cmake_text[0:begin] + constrcuted_text_end = cmake_text[end::] + return constructed_text_begin + constructed_version + constrcuted_text_end + + +def inc_major(cmake_text): + version_parts, begin, end = split_version(cmake_text) + version_parts[0] = str(int(version_parts[0]) + 1) + version_parts[1] = '0' + version_parts[2] = '0' + return recombine(cmake_text, version_parts, begin, end) + +def inc_minor(cmake_text): + version_parts, begin, end = split_version(cmake_text) + version_parts[1] = str(int(version_parts[1]) + 1) + version_parts[2] = '0' + return recombine(cmake_text, version_parts, begin, end) + +def inc_patch(cmake_text): + version_parts, begin, end = split_version(cmake_text) + if int(version_parts[2]) + 1 >= PATCH_LIMIT: + return inc_minor(cmake_text) + version_parts[2] = str(int(version_parts[2]) + 1) + return recombine(cmake_text, version_parts, begin, end) + +cmake_text = load_cmake() +cmake_version = get_version(cmake_text)[0] +print(f"Current Version: {cmake_version}") + +try: + type = input("What kind of commit is this ((M)ajor, (m)inor, (p)atch)? ") + + if type.startswith('M'): + print("Selected major") + write_cmake(inc_major(cmake_text)) + elif type.startswith('m'): + print("Selected minor") + write_cmake(inc_minor(cmake_text)) + elif type.startswith('p') or type.startswith('P') or len(type) == 0: + print("Selected patch") + write_cmake(inc_patch(cmake_text)) + + subprocess.call(["git", "add", "*"]) + subprocess.call(["git", "commit"]) + subprocess.call(["sh", "-c", "git remote | xargs -L1 git push --all"]) +except KeyboardInterrupt: + print("\nCancelling!") diff --git a/libs/BLT b/libs/BLT index 06892a3..19857f3 160000 --- a/libs/BLT +++ b/libs/BLT @@ -1 +1 @@ -Subproject commit 06892a3418b8340701a57393e725dc5379305897 +Subproject commit 19857f3b2b498e6b6d19749e6f02e7e44ecb12b9 diff --git a/tests/include/lilfbtf/test3.h b/tests/include/lilfbtf/test3.h new file mode 100644 index 0000000..6f52c22 --- /dev/null +++ b/tests/include/lilfbtf/test3.h @@ -0,0 +1,27 @@ +/* + * + * Copyright (C) 2024 Brett Terpstra + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef LILFBTF5_TEST3_H +#define LILFBTF5_TEST3_H + +namespace fb +{ + void test3(); +} + +#endif //LILFBTF5_TEST3_H diff --git a/tests/src/main.cpp b/tests/src/main.cpp index 7b3f4dc..c9d1c3c 100644 --- a/tests/src/main.cpp +++ b/tests/src/main.cpp @@ -4,6 +4,7 @@ #include #include #include +#include struct data { float f; @@ -44,7 +45,10 @@ int main(int argc, const char** argv) auto args = parser.parse_args(argc, argv); if (args.contains("--tests")) - fb::execute_tests(); + { + //fb::execute_tests(); + fb::test3(); + } return 0; } diff --git a/tests/src/tests2.cpp b/tests/src/tests2.cpp index 118ff8c..830ad17 100644 --- a/tests/src/tests2.cpp +++ b/tests/src/tests2.cpp @@ -239,8 +239,10 @@ namespace fb constexpr auto tree_size = 17; engine.reset(); tree1 love[size]; + BLT_START_INTERVAL("Tree Construction", blt::type_string() + ": Single Class Tree"); for (auto& i : love) i.create(tree_size); + BLT_END_INTERVAL("Tree Construction", blt::type_string() + ": Single Class Tree"); BLT_START_INTERVAL("Tree Evaluation", blt::type_string() + ": Single Class Tree"); for (auto& i : love) blt::black_box(i.evaluate()); @@ -249,10 +251,11 @@ namespace fb void funny() { - bump>(); - bump>(); - bump>(); + bump>(); + bump>(); + bump>(); + BLT_PRINT_PROFILE("Tree Construction"); BLT_PRINT_PROFILE("Tree Evaluation"); BLT_PRINT_PROFILE("Tree Destruction"); } diff --git a/tests/src/tests3.cpp b/tests/src/tests3.cpp new file mode 100644 index 0000000..d9e5638 --- /dev/null +++ b/tests/src/tests3.cpp @@ -0,0 +1,51 @@ +/* + * + * Copyright (C) 2024 Brett Terpstra + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#include +#include +#include "blt/std/utility.h" +#include "blt/std/logging.h" + +namespace fb +{ + class base + { + + }; + + void test3() + { + auto cum = new blt::u8[512]; + auto v = blt::array::construct(cum, 512); + auto& vr = *v; + + BLT_TRACE("%p", cum); + BLT_TRACE(v); + BLT_TRACE(*vr); + vr[0] = 0; + BLT_TRACE(*vr); + vr[1] = 0; + BLT_TRACE(*vr); + vr[5] = 50; + BLT_DEBUG(vr[5]); + BLT_TRACE(*vr); + + blt::black_box(v); + + delete[] cum; + } +} \ No newline at end of file