summaryrefslogtreecommitdiffhomepage
path: root/public/tools/make_app
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2025-01-07 07:39:26 +0100
committerAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2025-01-07 07:40:47 +0100
commitecf2a09a48ef029d09075af744c04e643661ec27 (patch)
treeb492c7cbbe1fcdc1779e62ce56e4c06960328849 /public/tools/make_app
parent395148f821e118f587cf31b0d1c724f06e2398da (diff)
ADD: Moved system call handler in HalCommonAPI.asm (AMD64)
ADD: Replace make_container with make_app. ADD: Reference SwapDisk.h and TeamScheduler.h in unix_layer for future POSIX work too. Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'public/tools/make_app')
-rw-r--r--public/tools/make_app/Common.h19
-rw-r--r--public/tools/make_app/Framework.h17
-rw-r--r--public/tools/make_app/Steps.h14
-rw-r--r--public/tools/make_app/dist/.keep0
-rw-r--r--public/tools/make_app/make_app.json12
-rw-r--r--public/tools/make_app/src/CLI.cc80
6 files changed, 142 insertions, 0 deletions
diff --git a/public/tools/make_app/Common.h b/public/tools/make_app/Common.h
new file mode 100644
index 00000000..65748608
--- /dev/null
+++ b/public/tools/make_app/Common.h
@@ -0,0 +1,19 @@
+/**
+ Sat Oct 26 07:03:28 AM CEST 2024
+ (c) Theater Quality Corp.
+*/
+
+#ifndef APPS_COMMON_H
+#define APPS_COMMON_H
+
+#include <cstdint>
+#include <iostream>
+#include <fstream>
+#include <string>
+#include <cstring>
+#include <sstream>
+#include <filesystem>
+#include <cstdlib>
+#include <vector>
+
+#endif // APPS_COMMON_H
diff --git a/public/tools/make_app/Framework.h b/public/tools/make_app/Framework.h
new file mode 100644
index 00000000..bd2adf08
--- /dev/null
+++ b/public/tools/make_app/Framework.h
@@ -0,0 +1,17 @@
+/**
+ Thu Oct 17 07:57:43 CEST 2024
+ (c) Theater Quality Corp.
+*/
+
+#ifndef APPS_FRAMEWORK_H
+#define APPS_FRAMEWORK_H
+
+#include <Common.h>
+
+#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/make_app/Steps.h b/public/tools/make_app/Steps.h
new file mode 100644
index 00000000..c503c56c
--- /dev/null
+++ b/public/tools/make_app/Steps.h
@@ -0,0 +1,14 @@
+/**
+ Thu Oct 17 07:57:43 CEST 2024
+ (c) Theater Quality Corp.
+*/
+
+#ifndef APPS_STEPS_H
+#define APPS_STEPS_H
+
+#include <Common.h>
+#include <Framework.h>
+
+#define kStepsExtension ".steps"
+
+#endif // ifndef APPS_STEPS_H \ No newline at end of file
diff --git a/public/tools/make_app/dist/.keep b/public/tools/make_app/dist/.keep
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/public/tools/make_app/dist/.keep
diff --git a/public/tools/make_app/make_app.json b/public/tools/make_app/make_app.json
new file mode 100644
index 00000000..ba103467
--- /dev/null
+++ b/public/tools/make_app/make_app.json
@@ -0,0 +1,12 @@
+{
+ "compiler_path": "g++",
+ "compiler_std": "c++20",
+ "headers_path": ["./"],
+ "sources_path": ["src/CLI.cc"],
+ "output_name": "./dist/make_app",
+ "cpp_macros": [
+ "kMKFVersion=0x0100",
+ "kMKFVersionHighest=0x0100",
+ "kMKFVersionLowest=0x0100"
+ ]
+}
diff --git a/public/tools/make_app/src/CLI.cc b/public/tools/make_app/src/CLI.cc
new file mode 100644
index 00000000..ed686294
--- /dev/null
+++ b/public/tools/make_app/src/CLI.cc
@@ -0,0 +1,80 @@
+/*
+ * Created on Thu Oct 17 08:00:42 CEST 2024
+ *
+ * Copyright (c) 2024 Theater Quality Corp
+ */
+
+#include <Framework.h>
+#include <Steps.h>
+
+/// @brief This program makes a framework directory for ZKA OS.
+
+int main(int argc, char* argv[])
+{
+ std::vector<std::string> 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 Corp, 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;
+}