From 02fd0b59edbcb2b5c08ab1f36bbffc12ba08a5d3 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Wed, 25 Dec 2024 09:58:00 +0100 Subject: IMPL: New tool for ZkaOS 'make_container' Signed-off-by: Amlal El Mahrouss --- .gitignore | 4 ++ private/tools/Common.h | 17 -------- private/tools/Framework.h | 17 -------- private/tools/make_application.sh | 3 -- private/tools/make_framework.json | 12 ------ private/tools/src/Framework.cc | 68 -------------------------------- public/tools/Common.h | 19 +++++++++ public/tools/Framework.h | 17 ++++++++ public/tools/Steps.h | 14 +++++++ public/tools/make_application.sh | 3 ++ public/tools/make_container.json | 12 ++++++ public/tools/src/CLI.cc | 81 +++++++++++++++++++++++++++++++++++++++ 12 files changed, 150 insertions(+), 117 deletions(-) delete mode 100644 private/tools/Common.h delete mode 100644 private/tools/Framework.h delete mode 100644 private/tools/make_application.sh delete mode 100644 private/tools/make_framework.json delete mode 100644 private/tools/src/Framework.cc create mode 100644 public/tools/Common.h create mode 100644 public/tools/Framework.h create mode 100644 public/tools/Steps.h create mode 100644 public/tools/make_application.sh create mode 100644 public/tools/make_container.json create mode 100644 public/tools/src/CLI.cc diff --git a/.gitignore b/.gitignore index 859a79ba..fc9558d6 100644 --- a/.gitignore +++ b/.gitignore @@ -10,11 +10,15 @@ xcuserdata/ */xcuserdata/* *.xcworkspacedata +public/tools/make_container + minoskrnl/minoskrnl.xcodeproj/project.xcworkspace/xcshareddata/ html/ latex/ +public/tools/src.fwrk + .cmake/ .qtc_clangd/ CMakeCache.txt diff --git a/private/tools/Common.h b/private/tools/Common.h deleted file mode 100644 index ae483545..00000000 --- a/private/tools/Common.h +++ /dev/null @@ -1,17 +0,0 @@ -/** - Sat Oct 26 07:03:28 AM CEST 2024 - (c) Theater Quality Inc. -*/ - -#ifndef APPS_COMMON_H -#define APPS_COMMON_H - -#include -#include -#include -#include -#include -#include -#include - -#endif // APPS_COMMON_H diff --git a/private/tools/Framework.h b/private/tools/Framework.h deleted file mode 100644 index d5d7ac27..00000000 --- a/private/tools/Framework.h +++ /dev/null @@ -1,17 +0,0 @@ -/** - Thu Oct 17 07:57:43 CEST 2024 - (c) Theater Quality Inc. -*/ - -#ifndef APPS_FRAMEWORK_H -#define APPS_FRAMEWORK_H - -#include - -#define kExecDirectory "ML/Exec/" -#define kRsrcDirectory "ML/Resources/" -#define kRootDirectory "ML/" -#define kFKExtension ".fwrk" -#define kAppExtension ".app" - -#endif // !APPS_FRAMEWORK_H diff --git a/private/tools/make_application.sh b/private/tools/make_application.sh deleted file mode 100644 index 2878f5b6..00000000 --- a/private/tools/make_application.sh +++ /dev/null @@ -1,3 +0,0 @@ -# !/bin/sh - -cp make_framework.o make_application.o \ No newline at end of file diff --git a/private/tools/make_framework.json b/private/tools/make_framework.json deleted file mode 100644 index 6071ebaa..00000000 --- a/private/tools/make_framework.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "compiler_path": "g++", - "compiler_std": "c++20", - "headers_path": ["./"], - "sources_path": ["src/Framework.cc"], - "output_name": "make_framework.o", - "cpp_macros": [ - "kMKFVersion=0x0100", - "kMKFVersionHighest=0x0100", - "kMKFVersionLowest=0x0100" - ] -} diff --git a/private/tools/src/Framework.cc b/private/tools/src/Framework.cc deleted file mode 100644 index 7fcf5a7a..00000000 --- a/private/tools/src/Framework.cc +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Created on Thu Oct 17 08:00:42 CEST 2024 - * - * Copyright (c) 2024 Theater Quality Inc - */ - -#include -#include -#include -#include - -/// @brief This program makes a framework directory for ZKA OS. - -int main(int argc, char* argv[]) -{ - std::vector files; - - auto ext = kFKExtension; - - for (size_t i = 2UL; i < argc; ++i) - { - if (strcmp(argv[i], "-h") == 0) - { - std::cout << "make_framework: Framework/Application Creation Tool.\n"; - std::cout << "make_framework: © Theater Quality Inc, All rights reserved.\n"; - - return EXIT_SUCCESS; - } - - if (strcmp(argv[i], "-a") == 0) - { - ext = kAppExtension; - continue; - } - - files.push_back(argv[i]); - } - - auto path = std::string(argv[1]); - - if (!path.ends_with(ext)) - return EXIT_FAILURE; - - std::filesystem::path path_arg = path; - - if (std::filesystem::create_directory(path_arg)) - { - std::filesystem::create_directory(path_arg / kRootDirectory); - std::filesystem::create_directory(path_arg / kExecDirectory); - - for (auto& file : files) - { - std::string file_cpy = file; - - while (file_cpy.find("/") != std::string::npos) - { - file_cpy.erase(0, file_cpy.find("/")); - file_cpy.erase(file_cpy.find("/"), 1); - } - - std::filesystem::copy(path, path_arg / kExecDirectory / file_cpy); - } - - return EXIT_SUCCESS; - } - - return EXIT_FAILURE; -} diff --git a/public/tools/Common.h b/public/tools/Common.h new file mode 100644 index 00000000..2633df38 --- /dev/null +++ b/public/tools/Common.h @@ -0,0 +1,19 @@ +/** + Sat Oct 26 07:03:28 AM CEST 2024 + (c) Theater Quality Inc. +*/ + +#ifndef APPS_COMMON_H +#define APPS_COMMON_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#endif // APPS_COMMON_H diff --git a/public/tools/Framework.h b/public/tools/Framework.h new file mode 100644 index 00000000..d5d7ac27 --- /dev/null +++ b/public/tools/Framework.h @@ -0,0 +1,17 @@ +/** + Thu Oct 17 07:57:43 CEST 2024 + (c) Theater Quality Inc. +*/ + +#ifndef APPS_FRAMEWORK_H +#define APPS_FRAMEWORK_H + +#include + +#define kExecDirectory "ML/Exec/" +#define kRsrcDirectory "ML/Resources/" +#define kRootDirectory "ML/" +#define kFKExtension ".fwrk" +#define kAppExtension ".app" + +#endif // !APPS_FRAMEWORK_H diff --git a/public/tools/Steps.h b/public/tools/Steps.h new file mode 100644 index 00000000..be16b61a --- /dev/null +++ b/public/tools/Steps.h @@ -0,0 +1,14 @@ +/** + Thu Oct 17 07:57:43 CEST 2024 + (c) Theater Quality Inc. +*/ + +#ifndef APPS_STEPS_H +#define APPS_STEPS_H + +#include +#include + +#define kStepsExtension ".steps" + +#endif // ifndef APPS_STEPS_H \ No newline at end of file diff --git a/public/tools/make_application.sh b/public/tools/make_application.sh new file mode 100644 index 00000000..2878f5b6 --- /dev/null +++ b/public/tools/make_application.sh @@ -0,0 +1,3 @@ +# !/bin/sh + +cp make_framework.o make_application.o \ No newline at end of file diff --git a/public/tools/make_container.json b/public/tools/make_container.json new file mode 100644 index 00000000..1f66e5af --- /dev/null +++ b/public/tools/make_container.json @@ -0,0 +1,12 @@ +{ + "compiler_path": "g++", + "compiler_std": "c++20", + "headers_path": ["./"], + "sources_path": ["src/CLI.cc"], + "output_name": "make_container", + "cpp_macros": [ + "kMKFVersion=0x0100", + "kMKFVersionHighest=0x0100", + "kMKFVersionLowest=0x0100" + ] +} diff --git a/public/tools/src/CLI.cc b/public/tools/src/CLI.cc new file mode 100644 index 00000000..b7f2b853 --- /dev/null +++ b/public/tools/src/CLI.cc @@ -0,0 +1,81 @@ +/* + * Created on Thu Oct 17 08:00:42 CEST 2024 + * + * Copyright (c) 2024 Theater Quality Inc + */ + +#include +#include + +/// @brief This program makes a framework directory for ZKA OS. + +int main(int argc, char* argv[]) +{ + std::vector files; + + auto ext = kFKExtension; + + for (size_t i = 2UL; i < argc; ++i) + { + if (strcmp(argv[i], "-h") == 0) + { + std::cout << "make_container: Framework/Application Creation Tool.\n"; + std::cout << "make_container: © Theater Quality Inc, All rights reserved.\n"; + + std::cout << "make_container: -app: Application directory.\n"; + std::cout << "make_container: -steps: Steps directory.\n"; + std::cout << "make_container: -fwrk: Framework directory.\n"; + + return EXIT_SUCCESS; + } + + if (strcmp(argv[i], "-app") == 0) + { + ext = kAppExtension; + continue; + } + else if (strcmp(argv[i], "-steps") == 0) + { + ext = kStepsExtension; + continue; + } + else if (strcmp(argv[i], "-fwrk") == 0) + { + ext = kFKExtension; + continue; + } + + + files.push_back(argv[i]); + } + + auto path = std::string(argv[1]); + + if (!std::filesystem::exists(path)) + return EXIT_FAILURE; + + std::filesystem::path path_arg = path + ext; + + if (std::filesystem::create_directory(path_arg)) + { + std::filesystem::create_directory(path_arg / kRootDirectory); + std::filesystem::create_directory(path_arg / kExecDirectory); + + for (auto& file : files) + { + std::string file_cpy = file; + + while (file_cpy.find("/") != std::string::npos) + { + file_cpy.erase(0, file_cpy.find("/")); + file_cpy.erase(file_cpy.find("/"), 1); + } + + std::filesystem::copy(path, path_arg / kExecDirectory / file_cpy); + } + + return EXIT_SUCCESS; + } + + return EXIT_FAILURE; +} -- cgit v1.2.3